@oliasoft-open-source/react-ui-library 4.6.15 → 4.6.17

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 (47) hide show
  1. package/dist/global.css +11 -8
  2. package/dist/index.d.ts +15 -0
  3. package/dist/index.js +80 -9
  4. package/dist/index.js.map +1 -1
  5. package/dist/storybook/assets/{Color-6VNJS4EI--MtBZKKT.js → Color-6VNJS4EI-l_tkm4Ol.js} +1 -1
  6. package/dist/storybook/assets/{DocsRenderer-NNNQARDV-zWIDUW8s.js → DocsRenderer-NNNQARDV-pZpQmDez.js} +1 -1
  7. package/dist/storybook/assets/{WithTooltip-V3YHNWJZ-12HSM2HQ.js → WithTooltip-V3YHNWJZ-iEhMvku5.js} +1 -1
  8. package/dist/storybook/assets/{accordion.stories-TsMdBhhr.js → accordion.stories-lXs4IRds.js} +1 -1
  9. package/dist/storybook/assets/{buttons-and-links-EBr5j6Pb.js → buttons-and-links-kkzfA_fv.js} +1 -1
  10. package/dist/storybook/assets/{casing-loads.stories-cbxQQ8QL.js → casing-loads.stories-g4yBGv5b.js} +1 -1
  11. package/dist/storybook/assets/{cell.stories-S6RxEUZs.js → cell.stories-sVyam_bx.js} +1 -1
  12. package/dist/storybook/assets/{chunk-HLWAVYOI-olKL1DOp.js → chunk-HLWAVYOI-7EffY2hk.js} +1 -1
  13. package/dist/storybook/assets/{color-cEIYsWoC.js → color-0XY3ZHi2.js} +1 -1
  14. package/dist/storybook/assets/{file-input.stories-5kyAKS_C.js → file-input.stories-QbTMh_80.js} +1 -1
  15. package/dist/storybook/assets/{footer.stories-C10mdMff.js → footer.stories-ZEZ_We0f.js} +1 -1
  16. package/dist/storybook/assets/{form.stories-rXc4fhX5.js → form.stories-BaGSZHT3.js} +1 -1
  17. package/dist/storybook/assets/{formation.stories-SDrsEBR-.js → formation.stories-062BdtdZ.js} +1 -1
  18. package/dist/storybook/assets/{formatter-SWP5E3XI-lcnUpu9o.js → formatter-SWP5E3XI-rnZWn7Un.js} +1 -1
  19. package/dist/storybook/assets/{iframe-tFrL7OgV.js → iframe-fk3bQNFP.js} +2 -2
  20. package/dist/storybook/assets/{index-i7J9GoJM.js → index-L7u6rs_t.js} +5 -5
  21. package/dist/storybook/assets/{input-validation-PXF1N2vm.js → input-validation-SIWPb72t.js} +1 -1
  22. package/dist/storybook/assets/{inputs-WqrsreQN.js → inputs-ii5Lb3ZE.js} +1 -1
  23. package/dist/storybook/assets/{layout-forms-5QbjGxm5.js → layout-forms-lx7_nlWB.js} +1 -1
  24. package/dist/storybook/assets/{layout-general-6o2l_EdT.js → layout-general-6yMuf8qw.js} +1 -1
  25. package/dist/storybook/assets/{modal.stories-PLF80IYZ.js → modal.stories-aZGhb1Cl.js} +1 -1
  26. package/dist/storybook/assets/{padding-and-spacing-A6N16ujc.js → padding-and-spacing-Beocy83w.js} +1 -1
  27. package/dist/storybook/assets/{pop-confirm.stories-GmXpbAIC.js → pop-confirm.stories-6V_XrhKa.js} +1 -1
  28. package/dist/storybook/assets/popover-N9B8JT3G.js +1 -0
  29. package/dist/storybook/assets/popover.stories-goIrT_jy.js +10 -0
  30. package/dist/storybook/assets/{preview-xqKimQkP.js → preview-1W-XaElU.js} +2 -2
  31. package/dist/storybook/assets/{preview-jFWbYQuo.js → preview-4yh7mm39.js} +1 -1
  32. package/dist/storybook/assets/{row.stories-JJLYUXaO.js → row.stories-ZibxnXR9.js} +1 -1
  33. package/dist/storybook/assets/{syntaxhighlighter-B5GMVT5T-MZJdrJvC.js → syntaxhighlighter-B5GMVT5T-l5kiIEjw.js} +1 -1
  34. package/dist/storybook/assets/{table-38J6JCSb.js → table-kSTipYE0.js} +1 -1
  35. package/dist/storybook/assets/{table.stories-Sbzi__am.js → table.stories-zdRM5AV8.js} +1 -1
  36. package/dist/storybook/assets/{textarea-JE26Eekm.js → textarea-RrPYPGCC.js} +1 -1
  37. package/dist/storybook/assets/{textarea.stories-c1mkQU4s.js → textarea.stories-rqdJWVro.js} +1 -1
  38. package/dist/storybook/assets/{title.stories-qvk0Or3W.js → title.stories-tcfNoA6z.js} +1 -1
  39. package/dist/storybook/assets/unit-table.stories-Nry33G5L.js +150 -0
  40. package/dist/storybook/iframe.html +1 -1
  41. package/dist/storybook/index.json +1 -1
  42. package/dist/storybook/project.json +1 -1
  43. package/dist/storybook/stories.json +1 -1
  44. package/package.json +1 -1
  45. package/dist/storybook/assets/popover-Ioxe80BK.js +0 -1
  46. package/dist/storybook/assets/popover.stories-NbC7Zba8.js +0 -1
  47. package/dist/storybook/assets/unit-table.stories-0Wv_gCzq.js +0 -142
package/dist/global.css CHANGED
@@ -1685,17 +1685,20 @@ html[data-theme='dark'] {
1685
1685
  transform: rotate(360deg);
1686
1686
  }
1687
1687
  }
1688
- ._actions_1nid8_1 {
1688
+ ._actions_1t7vd_1 {
1689
1689
  margin-left: auto;
1690
1690
  display: flex;
1691
1691
  flex-wrap: nowrap;
1692
1692
  justify-content: flex-end;
1693
1693
  align-items: center;
1694
1694
  }
1695
- ._actions_1nid8_1 > *:not(:last-child) {
1695
+ ._actions_1t7vd_1 > *:not(:last-child) {
1696
1696
  margin-right: var(--padding-xxs);
1697
1697
  }
1698
- ._actionComponentContainer_1nid8_11 {
1698
+ ._childComponent_1t7vd_11 {
1699
+ display: inline-flex;
1700
+ }
1701
+ ._actionComponentContainer_1t7vd_14 {
1699
1702
  width: 24px;
1700
1703
  height: 24px;
1701
1704
  display: inline-flex;
@@ -1708,16 +1711,16 @@ html[data-theme='dark'] {
1708
1711
  transition: color 0.2s;
1709
1712
  line-height: 0;
1710
1713
  }
1711
- ._actionComponentContainer_1nid8_11 i {
1714
+ ._actionComponentContainer_1t7vd_14 i {
1712
1715
  margin: 0;
1713
1716
  line-height: 1 !important;
1714
1717
  }
1715
- ._actionComponentContainer_1nid8_11:hover,
1716
- ._actionComponentContainer_1nid8_11:focus {
1718
+ ._actionComponentContainer_1t7vd_14:hover,
1719
+ ._actionComponentContainer_1t7vd_14:focus {
1717
1720
  color: var(--color-text-primary-hover);
1718
1721
  }
1719
- ._actionComponentContainer_1nid8_11:active,
1720
- ._actionComponentContainer_1nid8_11._active_1nid8_33 {
1722
+ ._actionComponentContainer_1t7vd_14:active,
1723
+ ._actionComponentContainer_1t7vd_14._active_1t7vd_36 {
1721
1724
  color: var(--color-text-primary-active);
1722
1725
  }
1723
1726
  ._wrapper_1iw97_1 {
package/dist/index.d.ts CHANGED
@@ -92,6 +92,8 @@ export declare const Empty: ({ width, height, text, children, testId, }: IEmptyP
92
92
 
93
93
  export declare const Field: ({ label, labelLeft, labelWidth, children, helpText, helpTextMaxWidth, onClickHelp, lock, info, libraryIcon, testId, }: IFieldProps) => JSX_2.Element;
94
94
 
95
+ export declare const FileButton: ({ file, accept, multi, name, disabled, onChange, ...buttonProps }: IFileButtonProps) => JSX_2.Element;
96
+
95
97
  export declare const FileInput: ({ label, loading, placeholder, disabled, file, accept, multi, name, width, onChange, testId, }: IFileInputProps) => ReactElement;
96
98
 
97
99
  export declare const Flex: ({ alignItems, justifyContent, direction, height, children, wrap, gap, }: IFlexProps) => JSX_2.Element;
@@ -397,6 +399,14 @@ export declare interface IFieldProps {
397
399
  testId?: string;
398
400
  }
399
401
 
402
+ export declare interface IFileButtonProps extends IButtonProps {
403
+ file?: File;
404
+ accept?: string;
405
+ multi?: boolean;
406
+ name?: string;
407
+ onChange?: (evt: any) => void;
408
+ }
409
+
400
410
  export declare interface IFileInputProps {
401
411
  label?: string | null;
402
412
  loading?: boolean;
@@ -1536,6 +1546,11 @@ export declare interface ITreeProps {
1536
1546
  }
1537
1547
 
1538
1548
  declare interface IUnitConfigItem {
1549
+ onChange?: (params: {
1550
+ oldUnit: string;
1551
+ newUnit: string;
1552
+ unitKey: string;
1553
+ }) => void;
1539
1554
  unitKey: string;
1540
1555
  storageUnit: string;
1541
1556
  preferredUnit: string;
package/dist/index.js CHANGED
@@ -4211,11 +4211,13 @@ const Button$1 = ({
4211
4211
  }
4212
4212
  ) });
4213
4213
  };
4214
- const actions$2 = "_actions_1nid8_1";
4215
- const actionComponentContainer = "_actionComponentContainer_1nid8_11";
4216
- const active$7 = "_active_1nid8_33";
4214
+ const actions$2 = "_actions_1t7vd_1";
4215
+ const childComponent = "_childComponent_1t7vd_11";
4216
+ const actionComponentContainer = "_actionComponentContainer_1t7vd_14";
4217
+ const active$7 = "_active_1t7vd_36";
4217
4218
  const styles$M = {
4218
4219
  actions: actions$2,
4220
+ childComponent,
4219
4221
  actionComponentContainer,
4220
4222
  active: active$7
4221
4223
  };
@@ -5029,7 +5031,15 @@ const Actions = (props) => {
5029
5031
  const hidden2 = (action2 == null ? void 0 : action2.hidden) || !action2 || !Object.keys(action2).length;
5030
5032
  if (!hidden2) {
5031
5033
  if (action2.childComponent && React__default.isValidElement(action2.childComponent)) {
5032
- return /* @__PURE__ */ jsx("div", { "data-testid": action2.testId, children: action2.childComponent }, index2);
5034
+ return /* @__PURE__ */ jsx(
5035
+ "div",
5036
+ {
5037
+ "data-testid": action2.testId,
5038
+ className: styles$M.childComponent,
5039
+ children: action2.childComponent
5040
+ },
5041
+ index2
5042
+ );
5033
5043
  } else if (action2.subActions) {
5034
5044
  return /* @__PURE__ */ jsx(
5035
5045
  SubmenuActions,
@@ -9068,6 +9078,48 @@ const Empty = ({
9068
9078
  }
9069
9079
  );
9070
9080
  };
9081
+ const FileButton = ({
9082
+ file,
9083
+ accept,
9084
+ multi,
9085
+ name: name2,
9086
+ disabled: disabled2,
9087
+ onChange = () => {
9088
+ },
9089
+ ...buttonProps
9090
+ }) => {
9091
+ const disabledContext = useContext(DisabledContext);
9092
+ const inputRef = useRef(null);
9093
+ const handleClick2 = () => {
9094
+ var _a;
9095
+ if (!(disabled2 || disabledContext))
9096
+ (_a = inputRef.current) == null ? void 0 : _a.click();
9097
+ };
9098
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
9099
+ /* @__PURE__ */ jsx(Button$1, { ...buttonProps, onClick: handleClick2 }),
9100
+ /* @__PURE__ */ jsx(
9101
+ "input",
9102
+ {
9103
+ name: name2,
9104
+ ref: inputRef,
9105
+ style: { display: "none" },
9106
+ type: "file",
9107
+ accept,
9108
+ multiple: multi,
9109
+ onChange: (evt) => {
9110
+ var _a, _b, _c;
9111
+ onChange({
9112
+ ...evt,
9113
+ target: {
9114
+ ...evt.target,
9115
+ value: multi ? (_a = evt == null ? void 0 : evt.target) == null ? void 0 : _a.files : (_c = (_b = evt == null ? void 0 : evt.target) == null ? void 0 : _b.files) == null ? void 0 : _c[0]
9116
+ }
9117
+ });
9118
+ }
9119
+ }
9120
+ )
9121
+ ] });
9122
+ };
9071
9123
  const inputGroup = "_inputGroup_biuoa_1";
9072
9124
  const styles$A = {
9073
9125
  inputGroup
@@ -70812,10 +70864,22 @@ const UnitTable = ({
70812
70864
  const onChangeUnit = ({
70813
70865
  unitKey,
70814
70866
  value
70815
- }) => setSelectedUnits({
70816
- ...selectedUnits,
70817
- [unitKey]: value
70818
- });
70867
+ }) => {
70868
+ setSelectedUnits({
70869
+ ...selectedUnits,
70870
+ [unitKey]: value
70871
+ });
70872
+ const specificUnitConfiguration = unitConfig.find(
70873
+ (configuration) => configuration.unitKey === unitKey
70874
+ );
70875
+ if (specificUnitConfiguration && typeof specificUnitConfiguration.onChange === "function") {
70876
+ specificUnitConfiguration.onChange({
70877
+ oldUnit: selectedUnits[unitKey],
70878
+ newUnit: value,
70879
+ unitKey
70880
+ });
70881
+ }
70882
+ };
70819
70883
  const convertViewData = (selectedUnits2) => convertVisibleRows({
70820
70884
  headers,
70821
70885
  rows,
@@ -70831,7 +70895,13 @@ const UnitTable = ({
70831
70895
  useEffect(() => {
70832
70896
  const templateChanged = !isEqual$4(preferredUnits, previousPreferredUnits);
70833
70897
  if (templateChanged) {
70834
- setSelectedUnits(preferredUnits);
70898
+ Object.keys(preferredUnits).forEach((unitKey) => {
70899
+ const oldUnit = previousPreferredUnits == null ? void 0 : previousPreferredUnits[unitKey];
70900
+ const newUnit = preferredUnits[unitKey];
70901
+ if (oldUnit !== newUnit) {
70902
+ onChangeUnit({ unitKey, value: newUnit });
70903
+ }
70904
+ });
70835
70905
  setViewData(convertViewData(preferredUnits));
70836
70906
  }
70837
70907
  }, [unitConfig]);
@@ -71020,6 +71090,7 @@ export {
71020
71090
  ElementType,
71021
71091
  Empty,
71022
71092
  Field,
71093
+ FileButton,
71023
71094
  FileInput,
71024
71095
  Flex,
71025
71096
  FormRow,