@oliasoft-open-source/react-ui-library 4.7.4 → 4.7.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.
Files changed (78) hide show
  1. package/dist/index.d.ts +5 -0
  2. package/dist/index.js +85 -38
  3. package/dist/index.js.map +1 -1
  4. package/dist/storybook/assets/{Color-KGDBMAHA-fBkbFrxl.js → Color-KGDBMAHA-C0EpwEFf.js} +1 -1
  5. package/dist/storybook/assets/{DocsRenderer-PKQXORMH-BCXpse5g.js → DocsRenderer-PKQXORMH-CWe5JIRI.js} +1 -1
  6. package/dist/storybook/assets/{accordion.stories-MGPZF2zs.js → accordion.stories-YuQaNHcr.js} +1 -1
  7. package/dist/storybook/assets/{afe.stories-Zs5w8AL0.js → afe.stories-CT81gs6M.js} +1 -1
  8. package/dist/storybook/assets/{buttons-and-links-DGEwyzdQ.js → buttons-and-links-CtOaPZlv.js} +1 -1
  9. package/dist/storybook/assets/{casing-loads.stories-BZZ4ps89.js → casing-loads.stories-DQy8gjj6.js} +1 -1
  10. package/dist/storybook/assets/{cell.stories-DtPT5vsK.js → cell.stories-ChfAWqCt.js} +1 -1
  11. package/dist/storybook/assets/check-box.stories-BAH78tMZ.js +126 -0
  12. package/dist/storybook/assets/{chunk-HLWAVYOI-B_e8hbrU.js → chunk-HLWAVYOI-CkQdzq8g.js} +1 -1
  13. package/dist/storybook/assets/{color-BWuYLPlh.js → color-eaylxLAo.js} +1 -1
  14. package/dist/storybook/assets/dialog-vClt2ahZ.js +1 -0
  15. package/dist/storybook/assets/{file-input.stories-BH_glmEk.js → file-input.stories-Br89AkVv.js} +1 -1
  16. package/dist/storybook/assets/{footer.stories-CsvsDr1-.js → footer.stories-BM5UBN62.js} +1 -1
  17. package/dist/storybook/assets/{form.stories-BwzDZgen.js → form.stories-CYcggA-f.js} +1 -1
  18. package/dist/storybook/assets/{formation.stories-2ZjWA25v.js → formation.stories-NDB_Sbor.js} +1 -1
  19. package/dist/storybook/assets/iframe-WLuE3PcW.js +2 -0
  20. package/dist/storybook/assets/index-Be0hXiyp.js +179 -0
  21. package/dist/storybook/assets/index-CF7H4eMJ.js +28 -0
  22. package/dist/storybook/assets/{index-BrCAgVdx.js → index-CXmS_Aty.js} +1 -1
  23. package/dist/storybook/assets/{index-tzHbUYOM.js → index-Cf2IDQZ4.js} +4 -4
  24. package/dist/storybook/assets/{input-group.stories-D1i3gaZ1.js → input-group.stories-BmeUtBOK.js} +1 -1
  25. package/dist/storybook/assets/{input-validation-BcgNUeij.js → input-validation-U3o9_8IY.js} +2 -2
  26. package/dist/storybook/assets/{inputs-gN3bum_f.js → inputs-gP7hGRtM.js} +2 -2
  27. package/dist/storybook/assets/{layout-forms-DXG6Da8u.js → layout-forms-r2wYyx-8.js} +1 -1
  28. package/dist/storybook/assets/{layout-general-CEpJsTnH.js → layout-general-Bw291PmI.js} +1 -1
  29. package/dist/storybook/assets/menu.stories-QTzp0Z7C.js +84 -0
  30. package/dist/storybook/assets/message-B7G1ESkC.js +1 -0
  31. package/dist/storybook/assets/{message.stories-o5jcKCK_.js → message.stories-Czui5Ym7.js} +1 -1
  32. package/dist/storybook/assets/modal.stories-DAxDpo0A.js +220 -0
  33. package/dist/storybook/assets/number-input.stories-CFTNLnHw.js +105 -0
  34. package/dist/storybook/assets/{padding-and-spacing-By28ROLj.js → padding-and-spacing-DLeCWmND.js} +1 -1
  35. package/dist/storybook/assets/{pagination-CqvxiZHR.js → pagination-BtguPxeR.js} +1 -1
  36. package/dist/storybook/assets/{pagination.stories-BzMlcLsN.js → pagination.stories-CgG4wp8P.js} +1 -1
  37. package/dist/storybook/assets/{pop-confirm.stories-MFDc3UAq.js → pop-confirm.stories-CZpYmUBz.js} +1 -1
  38. package/dist/storybook/assets/{popover.stories-CPW_LGAh.js → popover.stories-CtaFGXR_.js} +1 -1
  39. package/dist/storybook/assets/{preview-eMMARKcW.js → preview-BjyexbB3.js} +2 -2
  40. package/dist/storybook/assets/preview-DLBQXbKW.js +1 -0
  41. package/dist/storybook/assets/{preview-CO5-Yrmk.js → preview-Dml2wSQG.js} +1 -1
  42. package/dist/storybook/assets/radio-button.stories-BNE-U9db.js +71 -0
  43. package/dist/storybook/assets/{reservoirs.stories-Cql_9W4F.js → reservoirs.stories-ux3hZbkX.js} +1 -1
  44. package/dist/storybook/assets/{rich-text-input.stories-BuDUgUsz.js → rich-text-input.stories-savcIJ5B.js} +1 -1
  45. package/dist/storybook/assets/{row.stories-C-bEP9pE.js → row.stories-CG6Eipay.js} +1 -1
  46. package/dist/storybook/assets/select-Z-GCZ-pY.js +40 -0
  47. package/dist/storybook/assets/select.stories-CX_B6BvR.js +579 -0
  48. package/dist/storybook/assets/{smart-upload-modal.stories-DGIErcSu.js → smart-upload-modal.stories-BrsVuS4a.js} +1 -1
  49. package/dist/storybook/assets/{table-CXUwJOBt.js → table-CaaSoHex.js} +1 -1
  50. package/dist/storybook/assets/{table.stories-Cp0UIPUQ.js → table.stories-BiBivAvh.js} +1 -1
  51. package/dist/storybook/assets/{title.stories-hn5F8-2J.js → title.stories-CfdJbgvT.js} +1 -1
  52. package/dist/storybook/assets/toaster-DJeREs3e.js +1 -0
  53. package/dist/storybook/assets/toaster.stories-QjvljKdT.js +89 -0
  54. package/dist/storybook/assets/toggle.stories-BYrikgrA.js +141 -0
  55. package/dist/storybook/assets/{unit-input.stories-DGvDLll8.js → unit-input.stories-BSWm9641.js} +1 -1
  56. package/dist/storybook/assets/{unit-table.stories-D0q58B-1.js → unit-table.stories-CgF-UOP3.js} +1 -1
  57. package/dist/storybook/iframe.html +1 -1
  58. package/dist/storybook/index.html +6 -2
  59. package/dist/storybook/index.json +1 -1
  60. package/dist/storybook/project.json +1 -1
  61. package/dist/storybook/sb-addons/interactions-2/manager-bundle.js +233 -0
  62. package/dist/storybook/sb-addons/storybook-dark-mode-esm-preset-3/manager-bundle.js.LEGAL.txt +0 -0
  63. package/package.json +6 -2
  64. package/dist/storybook/assets/check-box.stories-J1keUUs0.js +0 -102
  65. package/dist/storybook/assets/dialog-lhPZkAI2.js +0 -1
  66. package/dist/storybook/assets/iframe-DLWAAiXM.js +0 -2
  67. package/dist/storybook/assets/menu.stories-BE0AzXUY.js +0 -82
  68. package/dist/storybook/assets/message-ttrR1AaP.js +0 -1
  69. package/dist/storybook/assets/modal.stories-Ns1ikKLR.js +0 -200
  70. package/dist/storybook/assets/number-input.stories-BfRW8wgL.js +0 -97
  71. package/dist/storybook/assets/radio-button.stories-D7uvMLbK.js +0 -61
  72. package/dist/storybook/assets/select-tIEV7vnw.js +0 -40
  73. package/dist/storybook/assets/select.stories-BuW6SmRZ.js +0 -914
  74. package/dist/storybook/assets/toaster-DPbde9Mi.js +0 -1
  75. package/dist/storybook/assets/toaster.stories-DtRx7MDa.js +0 -86
  76. package/dist/storybook/assets/toggle.stories-CBkCAQh6.js +0 -117
  77. /package/dist/storybook/sb-addons/{storybook-dark-mode-esm-preset-2 → interactions-2}/manager-bundle.js.LEGAL.txt +0 -0
  78. /package/dist/storybook/sb-addons/{storybook-dark-mode-esm-preset-2 → storybook-dark-mode-esm-preset-3}/manager-bundle.js +0 -0
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ChangeEvent } from 'react';
2
+ import { Context } from 'react';
2
3
  import { CSSProperties } from 'react';
3
4
  import { default as default_2 } from 'react';
4
5
  import { DependencyList } from 'react';
@@ -866,6 +867,8 @@ export declare interface INativeSelectProps {
866
867
  maxTooltipWidth?: TStringOrNumber;
867
868
  }
868
869
 
870
+ export declare const initializeContext: (context: Context<UnitContextType | null>) => void;
871
+
869
872
  export declare const Input: default_2.ForwardRefExoticComponent<IInputProps & default_2.RefAttributes<HTMLInputElement>>;
870
873
 
871
874
  export declare const InputGroup: ({ children, small, width, }: IInputGroupProps) => ReactElement;
@@ -1852,6 +1855,8 @@ export declare type TTriggerType = 'Text' | 'Button' | 'DropDownButton' | 'Compo
1852
1855
 
1853
1856
  declare type TUnitTableCellShape = TCellShape | IUnitTableStaticCell | IUnitTableInputCell | IUnitTableNumberInputCell;
1854
1857
 
1858
+ declare type UnitContextType = any;
1859
+
1855
1860
  export declare const UnitInput: ({ name, placeholder, disabled, disabledUnit, error, left, small, width, value, unitkey, initUnit, noConversion, onChange, onClick, onFocus, onSwitchUnit, unitTemplate, doNotConvertValue, testId, warning, predefinedOptions, initialPredefinedOption, shouldLinkAutomaticly, selectedPredefinedOptionKey, validationCallback, disabledValidation, allowEmpty, autoValue, }: IUnitInputProps) => JSX_2.Element;
1856
1861
 
1857
1862
  export declare const UnitTable: ({ table, unitConfig, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, }: IUnitTableProps) => JSX_2.Element;
package/dist/index.js CHANGED
@@ -6649,7 +6649,8 @@ const Dialog = ({ dialog: dialog2 }) => {
6649
6649
  basic: true,
6650
6650
  small: true,
6651
6651
  colored: "muted",
6652
- onClick: onClose
6652
+ onClick: onClose,
6653
+ testId: testId && `${testId}-dismiss`
6653
6654
  }
6654
6655
  ) }) : null
6655
6656
  ] }),
@@ -19214,7 +19215,12 @@ var MessageToggle = /* @__PURE__ */ ((MessageToggle2) => {
19214
19215
  MessageToggle2["TOGGLE_DETAILS"] = "TOGGLE_DETAILS";
19215
19216
  return MessageToggle2;
19216
19217
  })(MessageToggle || {});
19217
- const Dismiss = ({ type, onClose, isInToast }) => {
19218
+ const Dismiss = ({
19219
+ type,
19220
+ onClose,
19221
+ isInToast,
19222
+ testId
19223
+ }) => {
19218
19224
  return /* @__PURE__ */ jsx(
19219
19225
  "div",
19220
19226
  {
@@ -19223,7 +19229,7 @@ const Dismiss = ({ type, onClose, isInToast }) => {
19223
19229
  isInToast ? styles$s.absolute : "",
19224
19230
  type === MessageType.INFO ? styles$s.info : type === MessageType.SUCCESS ? styles$s.success : type === MessageType.WARNING ? styles$s.warning : type === MessageType.ERROR ? styles$s.error : null
19225
19231
  ),
19226
- children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CLOSE, onClick: onClose })
19232
+ children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CLOSE, onClick: onClose, testId })
19227
19233
  }
19228
19234
  );
19229
19235
  };
@@ -20710,7 +20716,8 @@ const styles$m = {
20710
20716
  const MultiSelectedOptions = ({
20711
20717
  selectedOptions,
20712
20718
  small: small2,
20713
- width: width2
20719
+ width: width2,
20720
+ testId
20714
20721
  }) => {
20715
20722
  const isFontLoaded = useFontsReady();
20716
20723
  const [displayedOptions, setDisplayedOptions] = useState([]);
@@ -20732,27 +20739,34 @@ const MultiSelectedOptions = ({
20732
20739
  setDisplayedOptions(displayed);
20733
20740
  setOverflowOptions(overflow);
20734
20741
  }, [selectedOptions, isFontLoaded, width2]);
20735
- return /* @__PURE__ */ jsxs("div", { className: styles$m.multiOptions, children: [
20736
- displayedOptions.filter((option2) => option2 && option2.label).map((option2, index2) => /* @__PURE__ */ jsx(
20737
- "span",
20738
- {
20739
- className: styles$m.multiOption,
20740
- onClick: (evt) => {
20741
- evt.stopPropagation();
20742
- },
20743
- children: option2.label
20744
- },
20745
- index2
20746
- )),
20747
- overflowOptions.length > 0 && /* @__PURE__ */ jsx(
20748
- Tooltip,
20749
- {
20750
- text: overflowOptions.map((option2, index2) => /* @__PURE__ */ jsx("div", { children: option2.label }, index2)),
20751
- display: "inline-flex",
20752
- children: /* @__PURE__ */ jsx("span", { className: styles$m.multiOption, children: displayedOptions.length ? `+${overflowOptions.length}` : `${overflowOptions.length} items` })
20753
- }
20754
- )
20755
- ] });
20742
+ return /* @__PURE__ */ jsxs(
20743
+ "div",
20744
+ {
20745
+ className: styles$m.multiOptions,
20746
+ "data-testid": testId && `${testId}-value`,
20747
+ children: [
20748
+ displayedOptions.filter((option2) => option2 && option2.label).map((option2, index2) => /* @__PURE__ */ jsx(
20749
+ "span",
20750
+ {
20751
+ className: styles$m.multiOption,
20752
+ onClick: (evt) => {
20753
+ evt.stopPropagation();
20754
+ },
20755
+ children: option2.label
20756
+ },
20757
+ index2
20758
+ )),
20759
+ overflowOptions.length > 0 && /* @__PURE__ */ jsx(
20760
+ Tooltip,
20761
+ {
20762
+ text: overflowOptions.map((option2, index2) => /* @__PURE__ */ jsx("div", { children: option2.label }, index2)),
20763
+ display: "inline-flex",
20764
+ children: /* @__PURE__ */ jsx("span", { className: styles$m.multiOption, children: displayedOptions.length ? `+${overflowOptions.length}` : `${overflowOptions.length} items` })
20765
+ }
20766
+ )
20767
+ ]
20768
+ }
20769
+ );
20756
20770
  };
20757
20771
  const Input = ({
20758
20772
  selectedOptions,
@@ -20763,7 +20777,8 @@ const Input = ({
20763
20777
  inputRef,
20764
20778
  error: error2,
20765
20779
  placeholder: placeholder3 = "Select...",
20766
- small: small2
20780
+ small: small2,
20781
+ testId
20767
20782
  }) => {
20768
20783
  const containerRef = useRef(null);
20769
20784
  const isMulti2 = Array.isArray(selectedOptions);
@@ -20781,9 +20796,17 @@ const Input = ({
20781
20796
  {
20782
20797
  selectedOptions,
20783
20798
  small: small2,
20784
- width: getMultiOptionsWidth()
20799
+ width: getMultiOptionsWidth(),
20800
+ testId
20785
20801
  }
20786
- ) : /* @__PURE__ */ jsx("span", { className: styles$m.selectedSingleValue, children: !(searchValue == null ? void 0 : searchValue.length) ? selectedOptions == null ? void 0 : selectedOptions.label : "" }),
20802
+ ) : /* @__PURE__ */ jsx(
20803
+ "span",
20804
+ {
20805
+ className: styles$m.selectedSingleValue,
20806
+ "data-testid": testId && `${testId}-value`,
20807
+ children: !(searchValue == null ? void 0 : searchValue.length) ? selectedOptions == null ? void 0 : selectedOptions.label : ""
20808
+ }
20809
+ ),
20787
20810
  searchable ? /* @__PURE__ */ jsx(
20788
20811
  "input",
20789
20812
  {
@@ -20792,7 +20815,8 @@ const Input = ({
20792
20815
  size: inputSize,
20793
20816
  className: cx$2(styles$m.input, error2 ? styles$m.error : ""),
20794
20817
  value: searchValue,
20795
- onChange: (evt) => onChange(evt.target.value)
20818
+ onChange: (evt) => onChange(evt.target.value),
20819
+ "data-testid": testId && `${testId}-input`
20796
20820
  }
20797
20821
  ) : null
20798
20822
  ] });
@@ -20888,7 +20912,8 @@ const Trigger = ({
20888
20912
  inputRef,
20889
20913
  onChange: onChangeSearch,
20890
20914
  error: error2,
20891
- small: small2
20915
+ small: small2,
20916
+ testId
20892
20917
  }
20893
20918
  ),
20894
20919
  /* @__PURE__ */ jsx("span", { className: styles$m.icons, children: canClear ? /* @__PURE__ */ jsx(
@@ -20904,6 +20929,7 @@ const Trigger = ({
20904
20929
  onClickClear(evt);
20905
20930
  }
20906
20931
  },
20932
+ "data-testid": testId && `${testId}-clear`,
20907
20933
  children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CLOSE })
20908
20934
  }
20909
20935
  ) : /* @__PURE__ */ jsx("span", { className: cx$2(styles$m.iconOpen), children: /* @__PURE__ */ jsx(Icon, { icon: "chevron down" }) }) })
@@ -57704,7 +57730,15 @@ const toast = ({
57704
57730
  const { type = MessageType.INFO } = message2 ?? {};
57705
57731
  const CloseButton2 = ({
57706
57732
  closeToast
57707
- }) => /* @__PURE__ */ jsx(Dismiss, { type, onClose: closeToast, isInToast: true });
57733
+ }) => /* @__PURE__ */ jsx(
57734
+ Dismiss,
57735
+ {
57736
+ type,
57737
+ onClose: closeToast,
57738
+ isInToast: true,
57739
+ testId: id2 !== void 0 ? id2.toString() + "-dismiss" : void 0
57740
+ }
57741
+ );
57708
57742
  const content2 = /* @__PURE__ */ jsx(
57709
57743
  Message,
57710
57744
  {
@@ -70016,7 +70050,7 @@ const getPreferredUnit = (unitkey, unitTemplate) => {
70016
70050
  const preferredUnit = unitTemplate == null ? void 0 : unitTemplate[unitkey];
70017
70051
  if (!preferredUnit) {
70018
70052
  console.log(
70019
- `Warning: 'unitTemplate' does not define a preferred unit for '${unitkey}'. Defaulting to standard unit.`
70053
+ `Warning: 'unitTemplate' missing for '${unitkey}'. Using initial unit, preferred unit or value unit.`
70020
70054
  );
70021
70055
  return unitFromQuantity(unitkey) ?? "";
70022
70056
  }
@@ -70114,6 +70148,17 @@ const isKnownUnit = (valueWithUnit, defaultUnit) => {
70114
70148
  const unitFromValue = getUnit(valueWithUnit || "");
70115
70149
  return isUnitKnown(defaultUnit) && isUnitKnown(unitFromValue);
70116
70150
  };
70151
+ let UnitContext = createContext(null);
70152
+ const useUnitContext = () => {
70153
+ return useContext(UnitContext);
70154
+ };
70155
+ let isInitialized = false;
70156
+ const initializeContext = (context2) => {
70157
+ if (!isInitialized) {
70158
+ isInitialized = true;
70159
+ UnitContext = context2;
70160
+ }
70161
+ };
70117
70162
  const predefinedMenuActive = "_predefinedMenuActive_1yvt4_1";
70118
70163
  const styles = {
70119
70164
  predefinedMenuActive
@@ -70152,18 +70197,19 @@ const UnitInput = ({
70152
70197
  allowEmpty = false,
70153
70198
  autoValue
70154
70199
  }) => {
70200
+ const context2 = useUnitContext();
70201
+ const runAfterUpdate = useRunAfterUpdate();
70155
70202
  if (typeof value === "number") {
70156
70203
  value = `${value}`;
70157
70204
  }
70158
- const runAfterUpdate = useRunAfterUpdate();
70159
70205
  const [propValue = "", propUnit = ""] = value !== void 0 ? split$1(value) : [];
70160
70206
  const propAutoUnit = autoValue ? getUnit(autoValue) : "";
70161
- const defaultUnit = useMemo$1(
70162
- () => getPreferredUnit(unitkey, unitTemplate),
70163
- [unitkey, unitTemplate]
70207
+ const preferredUnit = useMemo$1(
70208
+ () => getPreferredUnit(unitkey, unitTemplate || (context2 == null ? void 0 : context2.unitTemplate)),
70209
+ [unitkey, unitTemplate, context2 == null ? void 0 : context2.unitTemplate]
70164
70210
  );
70165
- const knownUnit = isKnownUnit(value, defaultUnit);
70166
- const initDisplayUnit = initUnit || defaultUnit || propUnit;
70211
+ const knownUnit = isKnownUnit(value, preferredUnit);
70212
+ const initDisplayUnit = initUnit || preferredUnit || propUnit;
70167
70213
  const previousInitUnit = usePrevious(initDisplayUnit);
70168
70214
  const convertedValue = safeConvertValue(
70169
70215
  value,
@@ -70832,6 +70878,7 @@ export {
70832
70878
  UnitInput,
70833
70879
  UnitTable,
70834
70880
  dismissToast,
70881
+ initializeContext,
70835
70882
  readFile,
70836
70883
  toast,
70837
70884
  useFocus,