@oliasoft-open-source/react-ui-library 4.6.4-beta-2 → 4.6.4-beta-4

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.
Files changed (31) hide show
  1. package/dist/index.d.ts +0 -21
  2. package/dist/index.js +13 -104
  3. package/dist/index.js.map +1 -1
  4. package/dist/storybook/assets/{Color-6VNJS4EI-iy5uGJ7u.js → Color-6VNJS4EI-0dI5E6B1.js} +1 -1
  5. package/dist/storybook/assets/{DocsRenderer-NNNQARDV-AhEJPUwR.js → DocsRenderer-NNNQARDV-kmVtXdCN.js} +1 -1
  6. package/dist/storybook/assets/{WithTooltip-V3YHNWJZ-YFfE9e35.js → WithTooltip-V3YHNWJZ-aK2veb6S.js} +1 -1
  7. package/dist/storybook/assets/{buttons-and-links-wdNf59Lc.js → buttons-and-links-HrdPUmHC.js} +1 -1
  8. package/dist/storybook/assets/{casing-loads.stories-Ilvo3kc-.js → casing-loads.stories-2DfdZN2W.js} +1 -1
  9. package/dist/storybook/assets/{chunk-HLWAVYOI-5KO74sPP.js → chunk-HLWAVYOI-gvmdwlMH.js} +1 -1
  10. package/dist/storybook/assets/{color-TbXmV_Ph.js → color-w8aIacWp.js} +1 -1
  11. package/dist/storybook/assets/dialog-Tgs8CXhN.js +1 -0
  12. package/dist/storybook/assets/{file-input.stories-8w1taUk6.js → file-input.stories-lKF1ABXX.js} +1 -1
  13. package/dist/storybook/assets/{form.stories-b8fSf1KV.js → form.stories-AikCzsZc.js} +1 -1
  14. package/dist/storybook/assets/{formatter-SWP5E3XI-wfu1opC9.js → formatter-SWP5E3XI-r4EhXc_R.js} +1 -1
  15. package/dist/storybook/assets/{iframe-TnxAEFPL.js → iframe-zoU5m22n.js} +2 -2
  16. package/dist/storybook/assets/{index-q9WFXtCQ.js → index-PcK6wy6Y.js} +5 -5
  17. package/dist/storybook/assets/{input-validation-wvL0mORs.js → input-validation-ik-_pZic.js} +1 -1
  18. package/dist/storybook/assets/{inputs-nNUbso5i.js → inputs-HOOmATSd.js} +1 -1
  19. package/dist/storybook/assets/{layout-forms-yYtEuB-g.js → layout-forms-ajzntTiw.js} +1 -1
  20. package/dist/storybook/assets/{layout-general-YHJfkzS0.js → layout-general-YrHqYgMj.js} +1 -1
  21. package/dist/storybook/assets/{modal.stories-dirXv4n_.js → modal.stories-RrJYxEqH.js} +1 -1
  22. package/dist/storybook/assets/{padding-and-spacing-r_ZtBCv6.js → padding-and-spacing-5OwJ6VNS.js} +1 -1
  23. package/dist/storybook/assets/{preview-0937QeI9.js → preview-OTui_ocs.js} +1 -1
  24. package/dist/storybook/assets/{preview-1QmXPv7x.js → preview-gEzSBjvP.js} +2 -2
  25. package/dist/storybook/assets/{syntaxhighlighter-B5GMVT5T-TuCuVbvB.js → syntaxhighlighter-B5GMVT5T-QX51XDDe.js} +1 -1
  26. package/dist/storybook/assets/{textarea-gwm6gdQO.js → textarea-TSoWqDT8.js} +1 -1
  27. package/dist/storybook/assets/{textarea.stories-eOTtHmL4.js → textarea.stories-w6XYooLd.js} +1 -1
  28. package/dist/storybook/iframe.html +1 -1
  29. package/dist/storybook/project.json +1 -1
  30. package/package.json +1 -1
  31. package/dist/storybook/assets/dialog-roJ8Yns6.js +0 -1
package/dist/index.d.ts CHANGED
@@ -1665,8 +1665,6 @@ export declare const SideBar: React_2.MemoExoticComponent<({ options, startOpen,
1665
1665
 
1666
1666
  export declare const Slider: ({ name, label, width, labelWidth, value, min, max, step, marks, showArrows, showTooltip, tooltipFormatter, disabled, range, small, vertical, onChange, }: ISliderProps) => JSX_2.Element;
1667
1667
 
1668
- export declare const SmartUploadModal: ({ visible, prompt, onCloseModal, onComplete, onError, onUpload, width, heading, dialogText, fileInputText, fileInputPlaceholder, uploadText, cancelText, testId, }: TSmartUploadModalProps) => JSX_2.Element;
1669
-
1670
1668
  export declare const Spacer: ({ height, width, flex, }: ISpacerProps) => JSX_2.Element;
1671
1669
 
1672
1670
  export declare const Spinner: ({ small, colored, dark, tiny, }: ISpinnerProps) => JSX_2.Element;
@@ -1802,25 +1800,6 @@ declare type TSliderMark = {
1802
1800
  tooltip?: number | string | ReactNode;
1803
1801
  };
1804
1802
 
1805
- export declare type TSmartUploadModalProps = {
1806
- visible: boolean;
1807
- prompt: string;
1808
- onCloseModal: () => void;
1809
- onUpload: (prompt: string, file: File) => any;
1810
- onComplete: (data: {
1811
- [key: string]: string;
1812
- }[]) => void;
1813
- onError?: (error: any) => void;
1814
- width?: number;
1815
- heading?: string;
1816
- dialogText?: string;
1817
- fileInputText?: string;
1818
- fileInputPlaceholder?: string;
1819
- uploadText?: string;
1820
- cancelText?: string;
1821
- testId?: string;
1822
- };
1823
-
1824
1803
  declare type TStringNumberNull = string | number | null;
1825
1804
 
1826
1805
  declare type TStringOrNumber = string | number;
package/dist/index.js CHANGED
@@ -19534,6 +19534,18 @@ const Modal = ({
19534
19534
  onEnter,
19535
19535
  onEscape
19536
19536
  }) => {
19537
+ const MODAL_CONTAINER_ID = "modalContainer";
19538
+ useEffect(() => {
19539
+ if (!document.getElementById(MODAL_CONTAINER_ID)) {
19540
+ return;
19541
+ }
19542
+ const container2 = document.createElement("div");
19543
+ container2.id = MODAL_CONTAINER_ID;
19544
+ document.body.appendChild(container2);
19545
+ return () => {
19546
+ document.body.removeChild(container2);
19547
+ };
19548
+ }, []);
19537
19549
  useKeyboardEvent(
19538
19550
  "Enter",
19539
19551
  () => {
@@ -19552,10 +19564,7 @@ const Modal = ({
19552
19564
  },
19553
19565
  [visible, onEscape]
19554
19566
  );
19555
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
19556
- /* @__PURE__ */ jsx(Portal, { id: "modalContainer", children: visible ? /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsx(Content$2, { width: width2, centered: centered2, children }) }) : null }),
19557
- /* @__PURE__ */ jsx("div", { id: "modalContainer" })
19558
- ] });
19567
+ return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Portal, { id: MODAL_CONTAINER_ID, children: visible ? /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsx(Content$2, { width: width2, centered: centered2, children }) }) : null }) });
19559
19568
  };
19560
19569
  const menu$1 = "_menu_12x4u_1";
19561
19570
  const header = "_header_12x4u_11";
@@ -70842,105 +70851,6 @@ const UnitTable = ({
70842
70851
  }
70843
70852
  );
70844
70853
  };
70845
- const SmartUploadModal = ({
70846
- visible,
70847
- prompt,
70848
- onCloseModal,
70849
- onComplete,
70850
- onError: onError3,
70851
- onUpload,
70852
- width: width2,
70853
- heading: heading2,
70854
- dialogText,
70855
- fileInputText,
70856
- fileInputPlaceholder,
70857
- uploadText,
70858
- cancelText,
70859
- testId
70860
- }) => {
70861
- const [file, setFile] = useState(void 0);
70862
- const [isFetching, setFetching] = useState(false);
70863
- useEffect(() => {
70864
- setFile(void 0);
70865
- }, [visible]);
70866
- const handleFileChange = (event) => {
70867
- setFile(event.target.value);
70868
- };
70869
- const handleUpload = async () => {
70870
- try {
70871
- if (!file)
70872
- return;
70873
- setFetching(true);
70874
- const data = await onUpload(prompt, file);
70875
- setFetching(false);
70876
- if (data) {
70877
- onComplete(data);
70878
- }
70879
- } catch (error2) {
70880
- setFetching(false);
70881
- onError3 == null ? void 0 : onError3(error2);
70882
- }
70883
- };
70884
- const onConfirm = () => {
70885
- handleUpload();
70886
- };
70887
- const onClose = () => {
70888
- onCloseModal();
70889
- };
70890
- const content2 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
70891
- /* @__PURE__ */ jsx(Text, { children: dialogText || "Upload file and extract data using a LLM" }),
70892
- /* @__PURE__ */ jsx(Spacer, {}),
70893
- /* @__PURE__ */ jsxs(Flex, { gap: "var(--padding-sm)", children: [
70894
- /* @__PURE__ */ jsx(
70895
- FileInput,
70896
- {
70897
- placeholder: fileInputPlaceholder || "No file",
70898
- label: fileInputText || "Select",
70899
- file: file || void 0,
70900
- onChange: handleFileChange,
70901
- testId: `${testId}-file-input`,
70902
- accept: "image/*"
70903
- }
70904
- ),
70905
- isFetching && /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Spinner$1, { dark: true }) })
70906
- ] })
70907
- ] });
70908
- const footer2 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
70909
- /* @__PURE__ */ jsx(
70910
- Button$1,
70911
- {
70912
- label: uploadText || "Upload",
70913
- colored: true,
70914
- onClick: onConfirm,
70915
- disabled: !file || isFetching,
70916
- testId: `${testId}-button-upload`
70917
- }
70918
- ),
70919
- /* @__PURE__ */ jsx(
70920
- Button$1,
70921
- {
70922
- label: cancelText || "Cancel",
70923
- onClick: onClose,
70924
- testId: `${testId}-button-cancel`
70925
- }
70926
- )
70927
- ] });
70928
- useKeyboardEvent("Escape", () => onClose());
70929
- return /* @__PURE__ */ jsx(Modal, { visible, centered: true, children: /* @__PURE__ */ jsx(
70930
- Dialog,
70931
- {
70932
- dialog: {
70933
- scroll: true,
70934
- heading: heading2 || "Smart Upload",
70935
- content: content2,
70936
- footer: footer2,
70937
- onClose,
70938
- width: width2 || 350,
70939
- testId
70940
- }
70941
- }
70942
- ) });
70943
- };
70944
70854
  export {
70945
70855
  Accordion,
70946
70856
  AccordionWithDefaultToggle,
@@ -71005,7 +70915,6 @@ export {
71005
70915
  Select,
71006
70916
  SideBar,
71007
70917
  Slider,
71008
- SmartUploadModal,
71009
70918
  Spacer,
71010
70919
  Spinner$1 as Spinner,
71011
70920
  Table,