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

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 (29) hide show
  1. package/dist/index.d.ts +21 -0
  2. package/dist/index.js +100 -0
  3. package/dist/index.js.map +1 -1
  4. package/dist/storybook/assets/{Color-6VNJS4EI-tDs0DW6l.js → Color-6VNJS4EI-iy5uGJ7u.js} +1 -1
  5. package/dist/storybook/assets/{DocsRenderer-NNNQARDV-4FhE5tBt.js → DocsRenderer-NNNQARDV-AhEJPUwR.js} +1 -1
  6. package/dist/storybook/assets/{WithTooltip-V3YHNWJZ-4DkfkReL.js → WithTooltip-V3YHNWJZ-YFfE9e35.js} +1 -1
  7. package/dist/storybook/assets/{buttons-and-links-hjYalcqd.js → buttons-and-links-wdNf59Lc.js} +1 -1
  8. package/dist/storybook/assets/{chunk-HLWAVYOI-cTxm6eFs.js → chunk-HLWAVYOI-5KO74sPP.js} +1 -1
  9. package/dist/storybook/assets/{color-zQ_1Ab3p.js → color-TbXmV_Ph.js} +1 -1
  10. package/dist/storybook/assets/{file-input.stories-lKF1ABXX.js → file-input.stories-8w1taUk6.js} +1 -1
  11. package/dist/storybook/assets/{form.stories-AikCzsZc.js → form.stories-b8fSf1KV.js} +1 -1
  12. package/dist/storybook/assets/{formatter-SWP5E3XI-Cfu_VZgT.js → formatter-SWP5E3XI-wfu1opC9.js} +1 -1
  13. package/dist/storybook/assets/{iframe-uQDN-5FH.js → iframe-TnxAEFPL.js} +2 -2
  14. package/dist/storybook/assets/{index-Y7wjLv-G.js → index-q9WFXtCQ.js} +5 -5
  15. package/dist/storybook/assets/{input-validation-oMZurKNs.js → input-validation-wvL0mORs.js} +1 -1
  16. package/dist/storybook/assets/{inputs-x27d4m44.js → inputs-nNUbso5i.js} +1 -1
  17. package/dist/storybook/assets/{layout-forms-kdhJZ6gZ.js → layout-forms-yYtEuB-g.js} +1 -1
  18. package/dist/storybook/assets/{layout-general-nsHljhz3.js → layout-general-YHJfkzS0.js} +1 -1
  19. package/dist/storybook/assets/{padding-and-spacing-lmVoZ2oR.js → padding-and-spacing-r_ZtBCv6.js} +1 -1
  20. package/dist/storybook/assets/{preview-f8-piscl.js → preview-0937QeI9.js} +1 -1
  21. package/dist/storybook/assets/{preview-oUKV_zRt.js → preview-1QmXPv7x.js} +2 -2
  22. package/dist/storybook/assets/{syntaxhighlighter-B5GMVT5T-rE3BvsrO.js → syntaxhighlighter-B5GMVT5T-TuCuVbvB.js} +1 -1
  23. package/dist/storybook/assets/{textarea-TSoWqDT8.js → textarea-gwm6gdQO.js} +1 -1
  24. package/dist/storybook/assets/{textarea.stories-w6XYooLd.js → textarea.stories-eOTtHmL4.js} +1 -1
  25. package/dist/storybook/assets/{unit-table.stories-CO9oH2A7.js → unit-table.stories-lZ4MjpDy.js} +4 -3
  26. package/dist/storybook/iframe.html +1 -1
  27. package/dist/storybook/project.json +1 -1
  28. package/package.json +1 -1
  29. package/dist/404.html +0 -1
package/dist/index.d.ts CHANGED
@@ -1665,6 +1665,8 @@ 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
+
1668
1670
  export declare const Spacer: ({ height, width, flex, }: ISpacerProps) => JSX_2.Element;
1669
1671
 
1670
1672
  export declare const Spinner: ({ small, colored, dark, tiny, }: ISpinnerProps) => JSX_2.Element;
@@ -1800,6 +1802,25 @@ declare type TSliderMark = {
1800
1802
  tooltip?: number | string | ReactNode;
1801
1803
  };
1802
1804
 
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
+
1803
1824
  declare type TStringNumberNull = string | number | null;
1804
1825
 
1805
1826
  declare type TStringOrNumber = string | number;
package/dist/index.js CHANGED
@@ -70842,6 +70842,105 @@ const UnitTable = ({
70842
70842
  }
70843
70843
  );
70844
70844
  };
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
+ };
70845
70944
  export {
70846
70945
  Accordion,
70847
70946
  AccordionWithDefaultToggle,
@@ -70906,6 +71005,7 @@ export {
70906
71005
  Select,
70907
71006
  SideBar,
70908
71007
  Slider,
71008
+ SmartUploadModal,
70909
71009
  Spacer,
70910
71010
  Spinner$1 as Spinner,
70911
71011
  Table,