@apia/components 4.0.47 → 4.0.50

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
@@ -980,6 +980,7 @@ type TIconButton = Omit<IconButtonProps, 'sx'> & React$1.AriaAttributes & {
980
980
  size?: TIconSize;
981
981
  title?: string;
982
982
  variant?: string;
983
+ 'data-test-id'?: string;
983
984
  };
984
985
  /**
985
986
  * Renderiza un botón con un ícono adentro.
@@ -1066,8 +1067,9 @@ type TDateProps = {
1066
1067
  onError?: (error: string) => unknown;
1067
1068
  value?: string;
1068
1069
  inputRef?: MutableRefObject<any>;
1070
+ props?: React.HTMLAttributes<HTMLInputElement>;
1069
1071
  };
1070
- declare const DateInput: (({ className, disabled, id: outerId, inputRef, onBlur, onChange, onError, readonly, value: outerValue, }: TDateProps) => React$1.JSX.Element) & {
1072
+ declare const DateInput: (({ className, disabled, id: outerId, inputRef, onBlur, onChange, onError, readonly, value: outerValue, props, }: TDateProps) => React$1.JSX.Element) & {
1071
1073
  displayName: string;
1072
1074
  };
1073
1075
 
@@ -1123,15 +1125,17 @@ declare function parseNumberInputValueToNumber(value: string): number;
1123
1125
  declare function parseNumberValueToNumberInput(value: string | number): string;
1124
1126
  declare const NumberInput: React__default.ForwardRefExoticComponent<Omit<TNumberInput, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
1125
1127
 
1126
- interface IRequiredMark {
1128
+ interface IRequiredMark extends Partial<BoxProps> {
1127
1129
  isFormReadonly?: boolean;
1128
1130
  isRequired?: boolean;
1129
1131
  isReadonly?: boolean;
1132
+ sx?: ThemeUICSSObject;
1133
+ style?: Record<string, any>;
1130
1134
  }
1131
1135
  /**
1132
1136
  * Muestra el * en los campos de requerido.
1133
1137
  */
1134
- declare const RequiredMark: ({ isFormReadonly, isRequired, isReadonly, }: IRequiredMark) => React$1.JSX.Element | null;
1138
+ declare const RequiredMark: ({ isFormReadonly, isRequired, isReadonly, sx, style, ...rest }: IRequiredMark) => React$1.JSX.Element | null;
1135
1139
 
1136
1140
  declare const getFieldErrorStyles: (isValid: boolean) => ThemeUICSSObject;
1137
1141
  declare const getFieldTouchedStyles: (isTouched: boolean) => ThemeUICSSObject;
@@ -1901,6 +1905,10 @@ declare const FileCard: React$1.ForwardRefExoticComponent<{
1901
1905
  onDoubleClick?: () => void;
1902
1906
  onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
1903
1907
  onDropFiles?: (files: File[]) => void;
1908
+ previewProps?: {
1909
+ hasPreview?: boolean;
1910
+ previewUrl?: string;
1911
+ };
1904
1912
  } & React$1.RefAttributes<unknown>>;
1905
1913
 
1906
1914
  declare const Dropzone: ({ sx, className, messageError, progress, defaultLabel, draggingLabel, onClick, onChange, handleInfoButton, }: {
package/dist/index.js CHANGED
@@ -1594,9 +1594,15 @@ class ApiaUtilNotifications {
1594
1594
  });
1595
1595
  __publicField$m(this, "notify", (notification) => {
1596
1596
  if (notification.type === "modal") {
1597
- this.util.dialogs.alert({
1597
+ this.util.modals.open({
1598
+ size: "flex",
1598
1599
  children: notification.message,
1599
- title: notification.title || ""
1600
+ title: notification.title || "",
1601
+ onConfirm: () => {
1602
+ },
1603
+ confirmProps: {
1604
+ hideCancelButton: true
1605
+ }
1600
1606
  });
1601
1607
  } else {
1602
1608
  defaultNotifier.notify({
@@ -1867,9 +1873,9 @@ const Confirm = ({
1867
1873
  children,
1868
1874
  additionalButtons,
1869
1875
  additionalButtonsOnRight,
1870
- cancelButtonText: cancelText = getLabel("btnCan").text,
1876
+ cancelButtonText: cancelText,
1871
1877
  className,
1872
- confirmButtonText: confirmText = getLabel("btnCon").text,
1878
+ confirmButtonText: confirmText,
1873
1879
  confirmButtonVariant = "primary",
1874
1880
  contentRef,
1875
1881
  disabled,
@@ -1881,6 +1887,14 @@ const Confirm = ({
1881
1887
  variant
1882
1888
  }) => {
1883
1889
  const { descriptionId } = useModalContext();
1890
+ const showsCancelButton = onCancel && !hideCancelButton;
1891
+ const showsConfirmButton = !hideConfirmButton;
1892
+ if (!showsCancelButton && showsConfirmButton) {
1893
+ confirmText = confirmText || getLabel("btnClose").text;
1894
+ } else if (showsConfirmButton) {
1895
+ confirmText = getLabel("btnCon").text;
1896
+ cancelText = getLabel("btnCan").text;
1897
+ }
1884
1898
  return /* @__PURE__ */ jsxs(
1885
1899
  Box,
1886
1900
  {
@@ -1918,12 +1932,12 @@ const Confirm = ({
1918
1932
  children: additionalButtonsOnRight
1919
1933
  }
1920
1934
  ),
1921
- !hideConfirmButton && /* @__PURE__ */ jsx(
1935
+ showsConfirmButton && /* @__PURE__ */ jsx(
1922
1936
  SimpleButton,
1923
1937
  {
1924
1938
  onClick: onConfirm,
1925
1939
  title: confirmText,
1926
- variant: confirmButtonVariant,
1940
+ variant: !showsCancelButton && showsConfirmButton ? "outline" : confirmButtonVariant,
1927
1941
  disabled: isLoading ?? disabled,
1928
1942
  isLoading,
1929
1943
  className: "confirm__confirmButton",
@@ -1932,7 +1946,7 @@ const Confirm = ({
1932
1946
  children: confirmText
1933
1947
  }
1934
1948
  ),
1935
- onCancel && !hideCancelButton && /* @__PURE__ */ jsx(
1949
+ showsCancelButton && /* @__PURE__ */ jsx(
1936
1950
  SimpleButton,
1937
1951
  {
1938
1952
  onClick: onCancel,
@@ -4273,7 +4287,8 @@ const DateInput = observer(
4273
4287
  onChange,
4274
4288
  onError,
4275
4289
  readonly,
4276
- value: outerValue
4290
+ value: outerValue,
4291
+ props
4277
4292
  }) => {
4278
4293
  const controller = useMemo(
4279
4294
  () => new DateInputController(outerId),
@@ -4288,7 +4303,8 @@ const DateInput = observer(
4288
4303
  onChange,
4289
4304
  onError,
4290
4305
  readonly,
4291
- value: outerValue
4306
+ value: outerValue,
4307
+ props
4292
4308
  });
4293
4309
  return /* @__PURE__ */ jsx(
4294
4310
  Box,
@@ -4320,7 +4336,8 @@ const DateInput = observer(
4320
4336
  onChange: controller.onInputChange.bind(controller),
4321
4337
  value: controller.inputValue,
4322
4338
  id: outerId,
4323
- name: outerId
4339
+ name: outerId,
4340
+ ...props
4324
4341
  },
4325
4342
  mask: getMaskForDateFormat(),
4326
4343
  maskPlaceholder: DEFAULT_MASK_PLACEHOLDER,
@@ -4507,9 +4524,29 @@ const NumberInput = React__default.forwardRef(
4507
4524
  const RequiredMark = ({
4508
4525
  isFormReadonly = false,
4509
4526
  isRequired = false,
4510
- isReadonly = false
4527
+ isReadonly = false,
4528
+ sx,
4529
+ style,
4530
+ ...rest
4511
4531
  }) => {
4512
- return isRequired && !isReadonly && !isFormReadonly ? /* @__PURE__ */ jsx("span", { className: "requiredMark", title: getLabel("msgReqField").text, children: "*" }) : null;
4532
+ const mergedSx = {
4533
+ color: "palette.error.main",
4534
+ fontWeight: "bold",
4535
+ ...sx ?? style ?? {}
4536
+ };
4537
+ if (!isRequired || isReadonly || isFormReadonly)
4538
+ return null;
4539
+ return /* @__PURE__ */ jsx(
4540
+ Box,
4541
+ {
4542
+ as: "span",
4543
+ sx: mergedSx,
4544
+ className: "requiredMark",
4545
+ title: getLabel("msgReqField").text,
4546
+ ...rest,
4547
+ children: "*"
4548
+ }
4549
+ );
4513
4550
  };
4514
4551
 
4515
4552
  const getFieldErrorStyles = (isValid) => {
@@ -7528,7 +7565,8 @@ const FileCard = forwardRef(
7528
7565
  handleClose,
7529
7566
  onDoubleClick,
7530
7567
  onClick,
7531
- onDropFiles
7568
+ onDropFiles,
7569
+ previewProps
7532
7570
  }, ref) => {
7533
7571
  const [isDragOver, setIsDragOver] = useState(false);
7534
7572
  return /* @__PURE__ */ createElement(
@@ -7570,32 +7608,35 @@ const FileCard = forwardRef(
7570
7608
  }
7571
7609
  }
7572
7610
  },
7573
- /* @__PURE__ */ jsxs(Box, { className: "fileCard__content", children: [
7574
- /* @__PURE__ */ jsx(FileIcon, { docName: name, iconSize: iconsSize }),
7575
- /* @__PURE__ */ jsx(Box, { as: "span", className: "fileCard__name", children: name })
7576
- ] }),
7577
- /* @__PURE__ */ jsx(Box, { className: "fileCard__additionalButtons", children: additionalButtons?.map((c) => {
7578
- return /* @__PURE__ */ jsx(
7579
- IconButton,
7611
+ /* @__PURE__ */ jsxs(Box, { className: "fileCard__container", children: [
7612
+ /* @__PURE__ */ jsxs(Box, { className: "fileCard__content", children: [
7613
+ /* @__PURE__ */ jsx(FileIcon, { docName: name, iconSize: iconsSize }),
7614
+ /* @__PURE__ */ jsx(Box, { as: "span", className: "fileCard__name", children: name })
7615
+ ] }),
7616
+ /* @__PURE__ */ jsx(Box, { className: "fileCard__additionalButtons", children: additionalButtons?.map((c) => {
7617
+ return /* @__PURE__ */ jsx(
7618
+ IconButton,
7619
+ {
7620
+ iconSize: "Md",
7621
+ ...c,
7622
+ className: `fileCard__additionalButton ${c.className ?? ""}`
7623
+ }
7624
+ );
7625
+ }) }),
7626
+ handleClose && /* @__PURE__ */ jsx(
7627
+ Close,
7580
7628
  {
7581
- iconSize: "Md",
7582
- ...c,
7583
- className: `fileCard__additionalButton ${c.className ?? ""}`
7584
- }
7585
- );
7586
- }) }),
7587
- handleClose && /* @__PURE__ */ jsx(
7588
- Close,
7589
- {
7590
- type: "button",
7591
- className: "fileCard__delete",
7592
- onClick: (e) => {
7593
- e.stopPropagation();
7594
- e.preventDefault();
7595
- handleClose(name);
7629
+ type: "button",
7630
+ className: "fileCard__delete",
7631
+ onClick: (e) => {
7632
+ e.stopPropagation();
7633
+ e.preventDefault();
7634
+ handleClose(name);
7635
+ }
7596
7636
  }
7597
- }
7598
- )
7637
+ )
7638
+ ] }),
7639
+ previewProps?.hasPreview && previewProps?.previewUrl && /* @__PURE__ */ jsx(Box, { className: "fileCard__preview", children: /* @__PURE__ */ jsx("img", { src: previewProps.previewUrl, alt: name }) })
7599
7640
  );
7600
7641
  }
7601
7642
  );
@@ -8036,7 +8077,7 @@ const NoMemoPagination = ({
8036
8077
  {
8037
8078
  disabled: isPerforming,
8038
8079
  className: "pagination__deleteFiltersButton",
8039
- "data-id": "delete-filters",
8080
+ "data-test-id": "btn-clear-filters",
8040
8081
  onClick: onDeleteFilters,
8041
8082
  children: [
8042
8083
  breakPoint > 3 && /* @__PURE__ */ jsx(Box, { as: "span", className: "pagination__deleteLabels", children: definedLabels.deleteFilters }),
@@ -8062,7 +8103,8 @@ const NoMemoPagination = ({
8062
8103
  disabled: disabled || isLoading,
8063
8104
  variant: "icon-primary",
8064
8105
  isLoading: isPerforming,
8065
- className: "pagiantion__refreshIcon"
8106
+ className: "pagiantion__refreshIcon",
8107
+ "data-test-id": "btn-refresh"
8066
8108
  }
8067
8109
  )
8068
8110
  ] }) })
@@ -8306,7 +8348,8 @@ const TagReplacers = {
8306
8348
  label: Label$1,
8307
8349
  input: Input,
8308
8350
  p: Paragraph,
8309
- select: Select
8351
+ select: Select,
8352
+ table: (props) => /* @__PURE__ */ jsx(Box, { as: "table", ...props })
8310
8353
  };
8311
8354
 
8312
8355
  const contextMethods = {};