pragmate-ui
Version:
An advanced, on-demand React UI library optimized for BeyondJS. Pragmate UI provides modular, responsive, and accessible components with a focus on efficient bundle sizes and a streamlined development process.
159 lines (141 loc) • 4.91 kB
TypeScript
/************
Processor: ts
************/
import * as __beyond_dep_ns_0 from 'react';
import * as __beyond_dep_ns_1 from 'pragmate-ui/base';
// alert.tsx
declare namespace ns_0 {
import React = __beyond_dep_ns_0;
import IAlertModalProps = ns_5.IAlertModalProps;
export function AlertModal(props: IAlertModalProps): React.JSX.Element;
}
// children.tsx
declare namespace ns_1 {
import Context = __beyond_dep_ns_0.Context;
import ReactNode = __beyond_dep_ns_0.ReactNode;
import SyntheticEvent = __beyond_dep_ns_0.SyntheticEvent;
export const ModalContext: Context<any>;
export const useModalContext: () => any;
type props = {
children?: ReactNode;
close?: (e: SyntheticEvent<HTMLElement, Event>) => void;
dismiss?: boolean;
};
export const Children: ({
children,
close,
dismiss
}: props) => JSX.Element;
export {};
}
// confirm\index.tsx
declare namespace ns_2 {
/// <reference types="react" />
import IConfirmModalProps = ns_6.IConfirmModalProps;
export const ConfirmModal: (properties: IConfirmModalProps) => JSX.Element;
}
// confirm\use-action-properties.tsx
declare namespace ns_3 {
/**
* useActionProperties function
*
* This function is designed to process and return action properties for the Button component
* in the Pragmate UI library. It supports the current API structure of the Button component
* while maintaining backward compatibility with an older configuration format.
*
* The function takes a `properties` object as an argument. If this object contains an `actions` property,
* it directly returns the `confirm` and `cancel` actions defined within. This is aligned with the current API design.
*
* For backward compatibility, the function also handles the scenario where the `actions` property is not present.
* In this case, it extracts and processes individual properties like `onCancel`, `onConfirm`, `btnConfirm`, and `btnCancel`
* from the `properties` object. These are then used to construct and return `confirm` and `cancel` action objects
* with appropriate labels, class names, variants, and onClick handlers.
*
* @param {object} properties - The properties object containing either a direct `actions` property
* or individual properties for backward compatibility.
* @returns An array containing two action objects: confirm and cancel.
*/
export function useActionProperties(properties: any, setState: any): any[];
}
// modal.tsx
declare namespace ns_4 {
import React = __beyond_dep_ns_0;
import IModalProps = ns_7.IModalProps;
export function Modal(props: IModalProps): React.JSX.Element;
}
// types\alert.ts
declare namespace ns_5 {
import IPUIProps = __beyond_dep_ns_1.IPUIProps;
type ButtonProps = {
className: string;
label: string;
onClick: () => void;
};
export interface IAlertModalProps extends Omit<IPUIProps<IAlertModalProps>, 'variant'> {
text?: string;
onConfirm?: () => void | Promise<void>;
onClose?: () => void;
/**
* @deprecated
*/
btn?: ButtonProps;
buttonLabel?: string;
button?: ButtonProps;
centered?: boolean;
}
export {};
}
// types\confirm.ts
declare namespace ns_6 {
/// <reference types="react" />
/**
* @todo: the button action interface should be moved to a common place
* and be the same used in the button component.
*/
export interface IButtonAction {
label?: string;
className?: string;
variant?: string;
onClick?: () => void | Promise<void>;
disabled?: boolean;
}
export interface IConfirmModalActions {
confirm: IButtonAction;
cancel: IButtonAction;
}
export interface IConfirmModalProps {
show?: boolean;
title?: string;
text?: string;
actions?: IConfirmModalActions;
centered?: boolean;
className?: string;
btnConfirm?: Record<string, any>;
btnCancel?: Record<string, any>;
children?: React.ReactNode;
onCancel?: () => void;
onConfirm?: (event: any) => void | Promise<void>;
onClose?: () => void;
}
}
// types\modal-props.ts
declare namespace ns_7 {
import IPUIProps = __beyond_dep_ns_1.IPUIProps;
import SyntheticEvent = __beyond_dep_ns_0.SyntheticEvent;
export interface IModalProps extends Omit<IPUIProps<IModalProps>, 'variant'> {
onClose?: (e: SyntheticEvent<HTMLElement, Event>) => void;
show?: boolean;
closeClicked?: boolean;
closeBackdrop?: boolean;
}
export interface IModalState {
container?: HTMLDivElement;
show: boolean;
closeClicked: boolean;
}
}
export import AlertModal = ns_0.AlertModal;
export import ConfirmModal = ns_2.ConfirmModal;
export import Modal = ns_4.Modal;
export import IModalProps = ns_7.IModalProps;
export declare const hmr: {on: (event: string, listener: any) => void, off: (event: string, listener: any) => void };