@oliasoft-open-source/react-ui-library 4.6.6-beta-1 → 4.6.6
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/404.html +1 -0
- package/dist/index.d.ts +1 -22
- package/dist/index.js +2 -146
- package/dist/index.js.map +1 -1
- package/dist/storybook/project.json +1 -1
- package/package.json +1 -1
package/dist/404.html
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!doctype html><head><title>React UI Library</title><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1" user-scalable="no"><meta name="apple-mobile-web-app-capable" content="yes"><script type="module" crossorigin src="/react-ui-library/assets/index-21EwET8E.js"></script><link rel="stylesheet" crossorigin href="/react-ui-library/assets/index-2LJjuVRB.css"></head><body><div id="content"></div></body>
|
package/dist/index.d.ts
CHANGED
|
@@ -1131,6 +1131,7 @@ declare interface ISelectCell extends TCommonCell {
|
|
|
1131
1131
|
deprecatedEventHandler?: boolean;
|
|
1132
1132
|
maxTooltipWidth?: TStringOrNumber;
|
|
1133
1133
|
autoLayerWidth?: boolean;
|
|
1134
|
+
multi?: boolean;
|
|
1134
1135
|
}
|
|
1135
1136
|
|
|
1136
1137
|
export declare interface ISelectProps {
|
|
@@ -1665,8 +1666,6 @@ export declare const SideBar: React_2.MemoExoticComponent<({ options, startOpen,
|
|
|
1665
1666
|
|
|
1666
1667
|
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
1668
|
|
|
1668
|
-
export declare const SmartUploadModal: ({ visible, prompt, onCloseModal, onUpload, onComplete, onFailed, onError, width, heading, dialogText, fileInputText, fileInputPlaceholder, uploadText, cancelText, testId, }: TSmartUploadModalProps) => JSX_2.Element;
|
|
1669
|
-
|
|
1670
1669
|
export declare const Spacer: ({ height, width, flex, }: ISpacerProps) => JSX_2.Element;
|
|
1671
1670
|
|
|
1672
1671
|
export declare const Spinner: ({ small, colored, dark, tiny, }: ISpinnerProps) => JSX_2.Element;
|
|
@@ -1802,26 +1801,6 @@ declare type TSliderMark = {
|
|
|
1802
1801
|
tooltip?: number | string | ReactNode;
|
|
1803
1802
|
};
|
|
1804
1803
|
|
|
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
|
-
onFailed?: () => void;
|
|
1814
|
-
onError?: (error: any) => void;
|
|
1815
|
-
width?: number;
|
|
1816
|
-
heading?: string;
|
|
1817
|
-
dialogText?: string;
|
|
1818
|
-
fileInputText?: string;
|
|
1819
|
-
fileInputPlaceholder?: string;
|
|
1820
|
-
uploadText?: string;
|
|
1821
|
-
cancelText?: string;
|
|
1822
|
-
testId?: string;
|
|
1823
|
-
};
|
|
1824
|
-
|
|
1825
1804
|
declare type TStringNumberNull = string | number | null;
|
|
1826
1805
|
|
|
1827
1806
|
declare type TStringOrNumber = string | number;
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import * as PropTypes from "prop-types";
|
|
|
11
11
|
import PropTypes__default from "prop-types";
|
|
12
12
|
import ReactDOM, { createPortal, unstable_batchedUpdates, render } from "react-dom";
|
|
13
13
|
import _$1, { set, get as get$2, isString as isString$3, isNumber as isNumber$1, isBoolean as isBoolean$2, isFunction as isFunction$3, isEmpty, isArray as isArray$1, toNumber, debounce as debounce$2, isObject as isObject$5, isObjectLike, has as has$1, isEqual as isEqual$4 } from "lodash";
|
|
14
|
-
import { roundToFixed, validateNumber, cleanNumStr, unitFromQuantity, isValueWithUnit, withUnit, convertSamePrecision, getValue as getValue$1, getUnit, KNOWN_UNITS, split as split$1, checkAndCleanDecimalComma, label as label$b, altUnitsList, getUnitsForQuantity, convertAndGetValue, isScientificStringNum, roundToPrecision
|
|
14
|
+
import { roundToFixed, validateNumber, cleanNumStr, unitFromQuantity, isValueWithUnit, withUnit, convertSamePrecision, getValue as getValue$1, getUnit, KNOWN_UNITS, split as split$1, checkAndCleanDecimalComma, label as label$b, altUnitsList, getUnitsForQuantity, convertAndGetValue, isScientificStringNum, roundToPrecision } from "@oliasoft-open-source/units";
|
|
15
15
|
import { isValueWithUnit as isValueWithUnit$1 } from "@oliasoft-open-source/units/dist/units";
|
|
16
16
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
17
17
|
function getDefaultExportFromCjs(x2) {
|
|
@@ -55945,6 +55945,7 @@ const SelectCell = ({
|
|
|
55945
55945
|
maxTooltipWidth: cell2.maxTooltipWidth,
|
|
55946
55946
|
width: "100%",
|
|
55947
55947
|
autoLayerWidth: cell2.autoLayerWidth,
|
|
55948
|
+
multi: cell2.multi,
|
|
55948
55949
|
right: columnAlignment === Align.RIGHT,
|
|
55949
55950
|
testId,
|
|
55950
55951
|
tabIndex: cell2.disabled ? -1 : 0
|
|
@@ -70855,150 +70856,6 @@ const UnitTable = ({
|
|
|
70855
70856
|
}
|
|
70856
70857
|
);
|
|
70857
70858
|
};
|
|
70858
|
-
const INTERVAL_TIME = 250;
|
|
70859
|
-
const REQUEST_TIME = 4e4;
|
|
70860
|
-
const FINISH_INTERVALS = 20;
|
|
70861
|
-
const FINISH_TIME = 500;
|
|
70862
|
-
const SmartUploadModal = ({
|
|
70863
|
-
visible,
|
|
70864
|
-
prompt,
|
|
70865
|
-
onCloseModal,
|
|
70866
|
-
onUpload,
|
|
70867
|
-
onComplete,
|
|
70868
|
-
onFailed,
|
|
70869
|
-
onError: onError3,
|
|
70870
|
-
width: width2,
|
|
70871
|
-
heading: heading2,
|
|
70872
|
-
dialogText,
|
|
70873
|
-
fileInputText,
|
|
70874
|
-
fileInputPlaceholder,
|
|
70875
|
-
uploadText,
|
|
70876
|
-
cancelText,
|
|
70877
|
-
testId
|
|
70878
|
-
}) => {
|
|
70879
|
-
const [file, setFile] = useState(void 0);
|
|
70880
|
-
const [isFetching, setFetching] = useState(false);
|
|
70881
|
-
const [requestTimer, setRequestTimer] = useState(0);
|
|
70882
|
-
let timer = 0;
|
|
70883
|
-
const updateTimer = () => {
|
|
70884
|
-
const newTime = timer + INTERVAL_TIME;
|
|
70885
|
-
timer = newTime;
|
|
70886
|
-
setRequestTimer(timer);
|
|
70887
|
-
};
|
|
70888
|
-
const finishTimer = (deltaTime) => {
|
|
70889
|
-
let newTime = timer + deltaTime;
|
|
70890
|
-
if (newTime >= 0.99 * REQUEST_TIME) {
|
|
70891
|
-
newTime = REQUEST_TIME;
|
|
70892
|
-
}
|
|
70893
|
-
timer = newTime;
|
|
70894
|
-
setRequestTimer(timer);
|
|
70895
|
-
};
|
|
70896
|
-
useEffect(() => {
|
|
70897
|
-
setFile(void 0);
|
|
70898
|
-
}, [visible]);
|
|
70899
|
-
const handleFileChange = (event) => {
|
|
70900
|
-
if (!event.target.value)
|
|
70901
|
-
return;
|
|
70902
|
-
setFile(event.target.value);
|
|
70903
|
-
};
|
|
70904
|
-
const handleUpload = async () => {
|
|
70905
|
-
setRequestTimer(0);
|
|
70906
|
-
const id2 = setInterval(updateTimer, INTERVAL_TIME);
|
|
70907
|
-
try {
|
|
70908
|
-
if (!file)
|
|
70909
|
-
return;
|
|
70910
|
-
setFetching(true);
|
|
70911
|
-
const data = await onUpload(prompt, file);
|
|
70912
|
-
if (data) {
|
|
70913
|
-
clearInterval(id2);
|
|
70914
|
-
const id22 = setInterval(
|
|
70915
|
-
finishTimer,
|
|
70916
|
-
FINISH_TIME / FINISH_INTERVALS,
|
|
70917
|
-
(REQUEST_TIME - timer) / (FINISH_INTERVALS - 1)
|
|
70918
|
-
);
|
|
70919
|
-
await setTimeout(() => {
|
|
70920
|
-
onComplete(data);
|
|
70921
|
-
clearInterval(id22);
|
|
70922
|
-
setFetching(false);
|
|
70923
|
-
}, FINISH_TIME);
|
|
70924
|
-
} else {
|
|
70925
|
-
onFailed == null ? void 0 : onFailed();
|
|
70926
|
-
setFetching(false);
|
|
70927
|
-
}
|
|
70928
|
-
} catch (error2) {
|
|
70929
|
-
onError3 == null ? void 0 : onError3(error2);
|
|
70930
|
-
setFetching(false);
|
|
70931
|
-
} finally {
|
|
70932
|
-
clearInterval(id2);
|
|
70933
|
-
}
|
|
70934
|
-
};
|
|
70935
|
-
const onConfirm = () => {
|
|
70936
|
-
handleUpload();
|
|
70937
|
-
};
|
|
70938
|
-
const onClose = () => {
|
|
70939
|
-
onCloseModal();
|
|
70940
|
-
};
|
|
70941
|
-
const content2 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
70942
|
-
/* @__PURE__ */ jsx(Text, { children: dialogText || "Upload file and extract data using a LLM" }),
|
|
70943
|
-
/* @__PURE__ */ jsx(Spacer, {}),
|
|
70944
|
-
/* @__PURE__ */ jsx(
|
|
70945
|
-
FileInput,
|
|
70946
|
-
{
|
|
70947
|
-
placeholder: fileInputPlaceholder || "No file",
|
|
70948
|
-
label: fileInputText || "Select",
|
|
70949
|
-
file: file || void 0,
|
|
70950
|
-
onChange: handleFileChange,
|
|
70951
|
-
testId: `${testId}-file-input`,
|
|
70952
|
-
accept: "image/*"
|
|
70953
|
-
}
|
|
70954
|
-
),
|
|
70955
|
-
/* @__PURE__ */ jsx(Spacer, {}),
|
|
70956
|
-
isFetching && /* @__PURE__ */ jsx(
|
|
70957
|
-
ProgressBar$1,
|
|
70958
|
-
{
|
|
70959
|
-
percentage: roundByMagnitudeToFixed(
|
|
70960
|
-
100 * requestTimer / REQUEST_TIME,
|
|
70961
|
-
3
|
|
70962
|
-
)
|
|
70963
|
-
}
|
|
70964
|
-
)
|
|
70965
|
-
] });
|
|
70966
|
-
const footer2 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
70967
|
-
/* @__PURE__ */ jsx(
|
|
70968
|
-
Button$1,
|
|
70969
|
-
{
|
|
70970
|
-
label: uploadText || "Upload",
|
|
70971
|
-
colored: true,
|
|
70972
|
-
onClick: onConfirm,
|
|
70973
|
-
disabled: !file || isFetching,
|
|
70974
|
-
testId: `${testId}-button-upload`
|
|
70975
|
-
}
|
|
70976
|
-
),
|
|
70977
|
-
/* @__PURE__ */ jsx(
|
|
70978
|
-
Button$1,
|
|
70979
|
-
{
|
|
70980
|
-
label: cancelText || "Cancel",
|
|
70981
|
-
onClick: onClose,
|
|
70982
|
-
testId: `${testId}-button-cancel`
|
|
70983
|
-
}
|
|
70984
|
-
)
|
|
70985
|
-
] });
|
|
70986
|
-
useKeyboardEvent("Escape", () => onClose());
|
|
70987
|
-
return /* @__PURE__ */ jsx(Modal, { visible, centered: true, children: /* @__PURE__ */ jsx(
|
|
70988
|
-
Dialog,
|
|
70989
|
-
{
|
|
70990
|
-
dialog: {
|
|
70991
|
-
scroll: true,
|
|
70992
|
-
heading: heading2 || "Smart Upload",
|
|
70993
|
-
content: content2,
|
|
70994
|
-
footer: footer2,
|
|
70995
|
-
onClose,
|
|
70996
|
-
width: width2 || 350,
|
|
70997
|
-
testId
|
|
70998
|
-
}
|
|
70999
|
-
}
|
|
71000
|
-
) });
|
|
71001
|
-
};
|
|
71002
70859
|
export {
|
|
71003
70860
|
Accordion,
|
|
71004
70861
|
AccordionWithDefaultToggle,
|
|
@@ -71063,7 +70920,6 @@ export {
|
|
|
71063
70920
|
Select,
|
|
71064
70921
|
SideBar,
|
|
71065
70922
|
Slider,
|
|
71066
|
-
SmartUploadModal,
|
|
71067
70923
|
Spacer,
|
|
71068
70924
|
Spinner$1 as Spinner,
|
|
71069
70925
|
Table,
|