@apia/components 4.0.16 → 4.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import * as React$1 from 'react';
2
- import React__default, { ReactNode, Ref, RefObject, ChangeEventHandler, MouseEvent as MouseEvent$1, KeyboardEvent, FC, FunctionComponent, ForwardedRef, ComponentType, ReactElement } from 'react';
2
+ import React__default, { ReactNode, Ref, RefObject, DetailedHTMLProps, TextareaHTMLAttributes, ChangeEventHandler, MouseEvent as MouseEvent$1, KeyboardEvent, FC, PropsWithChildren, FunctionComponent, ForwardedRef, ComponentType, ReactElement } from 'react';
3
3
  import * as _apia_util from '@apia/util';
4
4
  import { IOnFocusConfiguration, TFocusRetriever, TId as TId$1, EventEmitter, StatefulEmitter, TModify, TApiaFilter, TApiaFilterValue } from '@apia/util';
5
5
  import { BoxProps, TPalette, ThemeUIStyleObject, IconButtonProps, ButtonProps, ThemeUICSSObject, InputProps, SelectProps } from '@apia/theme';
6
6
  import { TIconName, TIconType } from '@apia/icons';
7
+ import { MenuItemProps, ControlledMenuProps } from '@szhsin/react-menu';
8
+ export { ControlledMenuProps, MenuItemProps } from '@szhsin/react-menu';
7
9
  import { Args } from 'react-cool-portal';
8
10
  import * as _apia_notifications from '@apia/notifications';
9
11
  import { TNotificationId, INotification, TDispatchedNotification, TNotificationSelector } from '@apia/notifications';
10
12
  export { INotification, TDispatchedNotification } from '@apia/notifications';
11
- import { MenuItemProps, ControlledMenuProps } from '@szhsin/react-menu';
12
- export { ControlledMenuProps, MenuItemProps } from '@szhsin/react-menu';
13
13
 
14
14
  type TModalSize = 'editGrid' | 'sm' | 'md' | 'md-fixed' | 'lg' | 'lg-fixed' | 'xl' | 'xl-fixed' | 'xxl' | 'xxxl' | 'xxxl-fixed' | 'flex' | 'cal' | 'finder' | 'fileModal';
15
15
  type TApiaButtonType = 'primary' | 'primary-sm' | 'secondary' | 'light-secondary' | 'secondary-sm' | 'danger' | 'danger-sm' | 'outline' | 'outline-sm' | 'warning' | 'warning-sm' | 'link';
@@ -44,6 +44,7 @@ type TModal = {
44
44
  * que como un modal
45
45
  */
46
46
  draggable?: boolean;
47
+ dragBounded?: boolean;
47
48
  children?: React__default.ReactNode;
48
49
  className?: string;
49
50
  id?: string;
@@ -129,6 +130,7 @@ declare const Modal: React__default.ForwardRefExoticComponent<{
129
130
  * que como un modal
130
131
  */
131
132
  draggable?: boolean | undefined;
133
+ dragBounded?: boolean | undefined;
132
134
  children?: React__default.ReactNode;
133
135
  className?: string | undefined;
134
136
  id?: string | undefined;
@@ -199,7 +201,7 @@ declare const Modal: React__default.ForwardRefExoticComponent<{
199
201
  variant?: string | undefined;
200
202
  } & Pick<IDialogHeader, "hideCloseButton"> & React__default.RefAttributes<HTMLDivElement>>;
201
203
 
202
- type TOpenModal = Pick<TModal, 'NavBar' | 'Portal' | 'children' | 'className' | 'hideCloseButton' | 'initialFocusGetter' | 'initialFocusConfiguration' | 'maxWidth' | 'noHeader' | 'onExited' | 'shouldCloseOnEsc' | 'shouldCloseOnOverlayClick' | 'size' | 'stretch' | 'title' | 'variant' | 'draggable' | 'onClose' | 'onDragStart' | 'defaultPosition'> & {
204
+ type TOpenModal = Pick<TModal, 'NavBar' | 'Portal' | 'children' | 'className' | 'hideCloseButton' | 'initialFocusGetter' | 'initialFocusConfiguration' | 'maxWidth' | 'noHeader' | 'onExited' | 'shouldCloseOnEsc' | 'shouldCloseOnOverlayClick' | 'size' | 'stretch' | 'title' | 'variant' | 'draggable' | 'onClose' | 'onDragStart' | 'defaultPosition' | 'dragBounded'> & {
203
205
  id?: string;
204
206
  children?: React__default.ReactNode;
205
207
  confirmProps?: Omit<IConfirm, 'onConfirmOk' | 'onConfirmCancel' | 'children'>;
@@ -229,16 +231,49 @@ type TOpenModal = Pick<TModal, 'NavBar' | 'Portal' | 'children' | 'className' |
229
231
  };
230
232
 
231
233
  declare class ApiaUtilModalHandler {
232
- private id;
233
234
  close: () => void;
234
- constructor(id: string, close: () => void);
235
+ constructor(close: () => void);
235
236
  }
236
237
  declare class ApiaUtilModals {
237
238
  #private;
239
+ private overlays;
238
240
  constructor();
239
241
  close(id: string): void;
240
242
  open(props: TOpenModal): ApiaUtilModalHandler;
241
- Component: () => React$1.JSX.Element;
243
+ /**
244
+ * The overlay method allows to append an element to the array of overlays, which will be rendered after any existent modal.
245
+ *
246
+ * This way, it's possible to add a completelly custom modal with no style, nor any custom behavior added by this controller.
247
+ *
248
+ * @example
249
+ *
250
+ * const portal = createPortal(
251
+ <iframe
252
+ style={{
253
+ position: 'fixed',
254
+ inset: 0,
255
+ }}
256
+ src={makeApiaUrl({
257
+ action: 'editGrid',
258
+ frmName: grid.getProperty('gridForm'),
259
+ frmParent: grid.getForm().definition.frmParent,
260
+ portalFormMode: false,
261
+ editionMode: true,
262
+ react: true,
263
+ index,
264
+ preventAsXmlParameter: true,
265
+ ajaxUrl: 'apia.execution.FormAction.run',
266
+ })}
267
+ />,
268
+ document.getElementById('AppModals') as HTMLElement,
269
+ );
270
+
271
+ ApiaUtil.instance.modals.overlay(portal);
272
+ */
273
+ overlay(o: ReactNode): () => void;
274
+ Component: (() => React$1.JSX.Element) & {
275
+ displayName: string;
276
+ };
242
277
  }
243
278
 
244
279
  declare class ApiaUtilNotifications {
@@ -264,7 +299,7 @@ declare class Tab<TabType extends TTab = TTab> {
264
299
  * El parámetro force evita que se muestre cartel de confirmación al usuario cuando puede haber pérdida de datos.
265
300
  */
266
301
  close(force?: boolean): Promise<boolean>;
267
- open(): void;
302
+ open(closeOthers?: boolean): void;
268
303
  toggle(isShown?: boolean): void;
269
304
  }
270
305
  declare class TabsController<TabType extends TTab = TTab> {
@@ -853,6 +888,12 @@ type AutocompleteCmpProps = {
853
888
  };
854
889
  declare const Autocomplete: (props: AutocompleteCmpProps) => React$1.JSX.Element | null;
855
890
 
891
+ declare const AutogrowTextarea: ((props: DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement> & {
892
+ error?: boolean;
893
+ }) => React$1.JSX.Element) & {
894
+ displayName: string;
895
+ };
896
+
856
897
  interface IBaseButton {
857
898
  text?: string;
858
899
  children?: string;
@@ -1231,6 +1272,113 @@ interface ILabelBox {
1231
1272
  type TLabelBox = ILabelBox & BoxProps;
1232
1273
  declare const LabelBox: ({ className, label, tooltip, closeTooltip, onClose, ...props }: TLabelBox) => React__default.JSX.Element;
1233
1274
 
1275
+ type TMessageType = 'user' | 'system' | 'warning' | 'error' | 'information' | 'response' | 'multipleChoice' | 'customMessage';
1276
+ interface IAttachment {
1277
+ name: string;
1278
+ id: string;
1279
+ base64: string;
1280
+ description?: string;
1281
+ }
1282
+ type TChatControllerState = {
1283
+ isLoading: boolean;
1284
+ canRecord: boolean;
1285
+ canAttach: boolean;
1286
+ canAddUserMessage: boolean;
1287
+ canAddSystemMessage: boolean;
1288
+ maxAttachmentsSize: number;
1289
+ messages: ChatMessage[];
1290
+ currentMessage: ChatMessage;
1291
+ };
1292
+ interface MessageCallbackProps {
1293
+ message: ChatMessage;
1294
+ }
1295
+ type MessageSubmitCallback = (props: MessageCallbackProps) => unknown;
1296
+
1297
+ declare class ChatMessage {
1298
+ message: ReactNode;
1299
+ messageType: TMessageType;
1300
+ attachments: IAttachment[];
1301
+ reference: ReactNode;
1302
+ id: number;
1303
+ constructor(message?: ReactNode, messageType?: TMessageType, attachments?: IAttachment[], reference?: ReactNode);
1304
+ clone: () => ChatMessage;
1305
+ removeAttachment(attachment: IAttachment): void;
1306
+ addAttachmentDescription(attachment: IAttachment, description: string): void;
1307
+ }
1308
+
1309
+ interface AutoscrollContainerProps {
1310
+ /** How close (in px) to the bottom you have to be *when scrolling down*
1311
+ * for auto-scroll to kick back in. */
1312
+ threshold?: number;
1313
+ className?: string;
1314
+ }
1315
+ declare const AutoscrollContainer: React__default.FC<PropsWithChildren<AutoscrollContainerProps>>;
1316
+
1317
+ declare class ChatController<T extends Record<string, unknown> = Record<string, unknown>> {
1318
+ private onMessageSubmit;
1319
+ private additionalOptions?;
1320
+ currentIndex: number;
1321
+ state: TChatControllerState & T;
1322
+ private internalAudioRecorder;
1323
+ private internalCameraRecorder;
1324
+ private maxId;
1325
+ audioRecorder: {
1326
+ cancelOnStop: boolean;
1327
+ start: () => void;
1328
+ stop: () => Promise<void>;
1329
+ record: number;
1330
+ state: _apia_util.AudioRecorderState;
1331
+ };
1332
+ constructor(props: Partial<TChatControllerState & T>, onMessageSubmit: MessageSubmitCallback, additionalOptions?: TMenuItem[] | undefined);
1333
+ removeMessage(idx: number): void;
1334
+ addMessage(message: ChatMessage): void;
1335
+ clearHistory(): void;
1336
+ clearMessage(): void;
1337
+ removeAttachment(attachment: IAttachment): void;
1338
+ private handleSubmit;
1339
+ private isForHistory;
1340
+ private canGoNext;
1341
+ private canGoPrev;
1342
+ nextMessage(): void;
1343
+ prevMessage(): void;
1344
+ protected getAdditionalProps(): Partial<MessageCallbackProps>;
1345
+ History: (() => React$1.JSX.Element) & {
1346
+ displayName: string;
1347
+ };
1348
+ Attachments: (() => React$1.JSX.Element) & {
1349
+ displayName: string;
1350
+ };
1351
+ TextArea: (() => React$1.JSX.Element) & {
1352
+ displayName: string;
1353
+ };
1354
+ Renderer: () => React$1.JSX.Element;
1355
+ }
1356
+
1357
+ declare class FloatingChatController extends ChatController<{
1358
+ isWindowOpen: boolean;
1359
+ }> {
1360
+ private modalTitle;
1361
+ constructor(props: {
1362
+ props: Partial<TChatControllerState & {
1363
+ isWindowOpen: boolean;
1364
+ }>;
1365
+ onMessageSubmit: MessageSubmitCallback;
1366
+ modalTitle?: string;
1367
+ additionalOptions?: TMenuItem[];
1368
+ });
1369
+ getModalTitle(): string | undefined;
1370
+ setModalTitle(title: string): void;
1371
+ open(): void;
1372
+ Window: (() => React$1.JSX.Element | null) & {
1373
+ displayName: string;
1374
+ };
1375
+ }
1376
+
1377
+ declare function getBase64FromFile(f: File): Promise<string>;
1378
+ declare function getBase64FromBlob(b: Blob): Promise<string>;
1379
+ declare function getFileExtension(name: string): string | undefined;
1380
+ declare function isImage(base64: string): boolean;
1381
+
1234
1382
  declare const ContainerWithHeader: ({ title, children, footerChildren, onClose, additionalButtons, }: {
1235
1383
  title: string;
1236
1384
  children: ReactNode;
@@ -1378,7 +1526,7 @@ declare const ProgressBar: FC<IProgressBar>;
1378
1526
 
1379
1527
  declare const LoaderSpinner: ((props: {
1380
1528
  className?: string | undefined;
1381
- }) => React__default.JSX.Element) & {
1529
+ }) => React$1.JSX.Element) & {
1382
1530
  displayName: string;
1383
1531
  };
1384
1532
 
@@ -1803,6 +1951,29 @@ declare const SortableList: ((props: {
1803
1951
  displayName: string;
1804
1952
  };
1805
1953
 
1954
+ declare const FileCard: React$1.ForwardRefExoticComponent<{
1955
+ name: string;
1956
+ iconsSize?: "sm" | "md" | "lg" | "xl" | undefined;
1957
+ additionalButtons?: TIconButton[] | undefined;
1958
+ className?: string | undefined;
1959
+ sx?: ThemeUIStyleObject | undefined;
1960
+ width?: string | undefined;
1961
+ handleClose?: ((f: string) => void) | undefined;
1962
+ onDoubleClick?: (() => void) | undefined;
1963
+ onClick?: ((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
1964
+ } & React$1.RefAttributes<unknown>>;
1965
+
1966
+ declare const Dropzone: ({ sx, className, messageError, progress, defaultLabel, draggingLabel, onClick, onChange, }: {
1967
+ sx?: ThemeUIStyleObject | undefined;
1968
+ className?: string | undefined;
1969
+ messageError?: string | undefined;
1970
+ progress?: number | undefined;
1971
+ defaultLabel?: string | undefined;
1972
+ draggingLabel?: string | undefined;
1973
+ onClick?: ((e: MouseEvent$1) => void) | undefined;
1974
+ onChange?: ((e: File[]) => any) | undefined;
1975
+ }) => React__default.JSX.Element;
1976
+
1806
1977
  declare class TableParameter extends Parameter<ITableParameterProps> {
1807
1978
  constructor(params: ITableParameterProps);
1808
1979
  }
@@ -1918,7 +2089,6 @@ interface IFilterCondition {
1918
2089
  op: TFilterOp;
1919
2090
  }
1920
2091
  interface IParameter {
1921
- component?: string;
1922
2092
  description: string;
1923
2093
  name: string;
1924
2094
  possibleValues?: ParameterPossibleValue | ParameterPossibleValue[];
@@ -1954,7 +2124,10 @@ declare class Parameter<T extends IParameter = IParameter> implements ParameterO
1954
2124
  state: T & {
1955
2125
  validationError?: string;
1956
2126
  };
1957
- constructor(params: T);
2127
+ component?: string;
2128
+ constructor(params: T & {
2129
+ component?: string;
2130
+ });
1958
2131
  clear(): void;
1959
2132
  getValues(): string[];
1960
2133
  private removeEmptyValues;
@@ -1965,13 +2138,14 @@ declare class Parameter<T extends IParameter = IParameter> implements ParameterO
1965
2138
  asPayloadElement(): string[] | null;
1966
2139
  includes(value: string): boolean;
1967
2140
  validate(): boolean;
2141
+ setComponent(component?: string): void;
1968
2142
  }
1969
2143
 
1970
2144
  declare const ParameterRender: (({ index, omitLabel, parameter, }: {
1971
2145
  index: number;
1972
2146
  omitLabel?: boolean | undefined;
1973
2147
  parameter: Parameter;
1974
- }) => string | React$1.JSX.Element | null) & {
2148
+ }) => React$1.JSX.Element | null) & {
1975
2149
  displayName: string;
1976
2150
  };
1977
2151
 
@@ -2186,5 +2360,5 @@ declare class Templater {
2186
2360
  parseString(content: string, options?: IAlterDefaultOptions): string | JSX.Element | JSX.Element[];
2187
2361
  }
2188
2362
 
2189
- export { Accordion, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, AutoEllipsis, Autocomplete, type AutocompleteCmpProps, AutocompleteController, type AutocompleteOption, type AutocompleteProps, BaseButton, CalendarModal, Captcha, Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DefaultAccordionItemButton, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, FieldErrorMessage, FieldLabel, FilterConditionDTO, FilterDTO, FiltersStore, type IAccordionItemButton, type IAccordionItemProps, type IAccordionProps, type IAlert, type IApiaFilter, type ICalendarModal, type IConfirm, type IDialogButtonBar, type IDialogHeader, type IField, type IFieldErrorMessage, type IFilterCondition, type IFilterDTOState, type IFilterValue, type IIconInput, type IOverlay, type IParameter, type IParametersGroup, type IRequiredMark, type IResponsiveComponent, type ISimpleButton, type ITableParameterProps, IconButton, IconInput, IconsList, LabelBox, LinearLoader, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner, Modal, NumberInput, Overlay, Parameter, type ParameterObject, type ParameterPossibleValue, ParameterRender, type ParameterRenderer, type ParameterRendererProps, type ParameterType, Parameters, type ParametersDefinition, ParametersGroup, type ParametersGroupRenderer, ParametersStore, ParametersTable, type Payload, ProgressBar, RequiredMark, ScreenLocker, SimpleButton, SortableList, SortableListItem, type TAccordionHandler, type TAccordionItemButton, type TApiaButtonType, type TApiaIconButton, type TCheckbox, type TCssProps, type TDateProps, type TFieldLabel, type TFilterOp, type TFilterPayload, type TFilterType, type TFilterValue, type TFilterValueType, type TGetTabsController, type TIcon, type TIconButton, type TIconRenderer, type TIconSize, type TIconsList, type TListbox, type TMenuItem, type TModal, type TModalSize, type TNumberInput, type TNumberInputChangeEvent, type TOnClickNode, type TOnConfirmSelection, type TOnSelectionChange, type TOpenModal, type TParameterType, type TSubmenu, type TTab, type TTabLabelRenderer as TTabRenderer, type TToolbarIconButton as TToolDefinition, type TTooltip, type TUseModalConfiguration, type TVisualizationType, Tab, Tabs, TabsContent, TabsController, TabsList, Templater, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, WaiTypeAhead, getFieldErrorStyles, getFieldTouchedStyles, importComponent, isParametersGroup, makeResponsiveComponent, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useModal, useModalContext, useOtherTagButton, useTabsContext };
2363
+ export { Accordion, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, AutoEllipsis, Autocomplete, type AutocompleteCmpProps, AutocompleteController, type AutocompleteOption, type AutocompleteProps, AutogrowTextarea, AutoscrollContainer, BaseButton, CalendarModal, Captcha, ChatController, ChatMessage, Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DefaultAccordionItemButton, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, Dropzone, FieldErrorMessage, FieldLabel, FileCard, FilterConditionDTO, FilterDTO, FiltersStore, FloatingChatController, type IAccordionItemButton, type IAccordionItemProps, type IAccordionProps, type IAlert, type IApiaFilter, type IAttachment, type ICalendarModal, type IConfirm, type IDialogButtonBar, type IDialogHeader, type IField, type IFieldErrorMessage, type IFilterCondition, type IFilterDTOState, type IFilterValue, type IIconInput, type IOverlay, type IParameter, type IParametersGroup, type IRequiredMark, type IResponsiveComponent, type ISimpleButton, type ITableParameterProps, IconButton, IconInput, IconsList, LabelBox, LinearLoader, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner, type MessageCallbackProps, type MessageSubmitCallback, Modal, NumberInput, Overlay, Parameter, type ParameterObject, type ParameterPossibleValue, ParameterRender, type ParameterRenderer, type ParameterRendererProps, type ParameterType, Parameters, type ParametersDefinition, ParametersGroup, type ParametersGroupRenderer, ParametersStore, ParametersTable, type Payload, ProgressBar, RequiredMark, ScreenLocker, SimpleButton, SortableList, SortableListItem, type TAccordionHandler, type TAccordionItemButton, type TApiaButtonType, type TApiaIconButton, type TChatControllerState, type TCheckbox, type TCssProps, type TDateProps, type TFieldLabel, type TFilterOp, type TFilterPayload, type TFilterType, type TFilterValue, type TFilterValueType, type TGetTabsController, type TIcon, type TIconButton, type TIconRenderer, type TIconSize, type TIconsList, type TListbox, type TMenuItem, type TMessageType, type TModal, type TModalSize, type TNumberInput, type TNumberInputChangeEvent, type TOnClickNode, type TOnConfirmSelection, type TOnSelectionChange, type TOpenModal, type TParameterType, type TSubmenu, type TTab, type TTabLabelRenderer as TTabRenderer, type TToolbarIconButton as TToolDefinition, type TTooltip, type TUseModalConfiguration, type TVisualizationType, Tab, Tabs, TabsContent, TabsController, TabsList, Templater, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, WaiTypeAhead, getBase64FromBlob, getBase64FromFile, getFieldErrorStyles, getFieldTouchedStyles, getFileExtension, importComponent, isImage, isParametersGroup, makeResponsiveComponent, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useModal, useModalContext, useOtherTagButton, useTabsContext };
2190
2364
  //# sourceMappingURL=index.d.ts.map