@oliasoft-open-source/react-ui-library 5.11.5 → 5.11.6-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.
package/dist/index.d.ts CHANGED
@@ -93,6 +93,8 @@ export declare enum Color {
93
93
  MUTED = "muted"
94
94
  }
95
95
 
96
+ export declare const ColorInput: ({ columns, disabled, options, small, value, onChange, }: IColorInputProps) => JSX_2.Element;
97
+
96
98
  export declare const Column: ({ background, borderLeft, borderRight, children, flex, flexbox, padding, scroll, showScrollbar, spacing, width, widthMobile, widthTablet, testId, }: ILayoutColumnProps) => JSX_2.Element;
97
99
 
98
100
  export declare const Dialog: ({ dialog }: IDialogProps) => JSX_2.Element;
@@ -330,6 +332,18 @@ export declare interface ICollapseProps {
330
332
  expanded: boolean;
331
333
  }
332
334
 
335
+ export declare interface IColorInputProps {
336
+ columns?: number;
337
+ disabled?: boolean;
338
+ options?: {
339
+ value: string;
340
+ label: string;
341
+ }[];
342
+ small?: boolean;
343
+ value?: string;
344
+ onChange?: (value: string) => void;
345
+ }
346
+
333
347
  /**
334
348
  * Icon wrapper component to support different icon formats:
335
349
  * - string names (default recommendation)
package/dist/index.js CHANGED
@@ -1264,6 +1264,118 @@ const Card = ({ bordered: e = !0, heading: t = null, children: n, margin: r = "0
1264
1264
  children: n
1265
1265
  })]
1266
1266
  });
1267
+ var popover_module_default = {
1268
+ toggleBox: "_toggleBox_rwod1_1",
1269
+ enter: "_enter_rwod1_8",
1270
+ enterActive: "_enterActive_rwod1_12",
1271
+ fullWidthStyleFix: "_fullWidthStyleFix_rwod1_17",
1272
+ dismiss: "_dismiss_rwod1_22"
1273
+ };
1274
+ const Popover = ({ children: t, content: n, placement: r = "top-center", closeOnOutsideClick: i = !0, fullWidth: a = !1, showCloseButton: o = !1, testId: l, disabled: u = !1, overflowContainer: d = !1, isOpen: f, onToggle: h }) => {
1275
+ let _ = useContext(DisabledContext), v = useRef(null), [y, b] = f === void 0 ? useState(!1) : [f, h], x = () => {
1276
+ !u && !_ && b && b(!1);
1277
+ }, S = () => {
1278
+ u || _ || b && b(!y);
1279
+ };
1280
+ useEffect(() => {
1281
+ (u || _) && x();
1282
+ }, [u, _]);
1283
+ let { renderLayer: C, arrowProps: w, layerProps: T, triggerProps: E } = useLayer({
1284
+ isOpen: y,
1285
+ placement: r,
1286
+ auto: !0,
1287
+ triggerOffset: 6,
1288
+ onOutsideClick: i ? x : void 0,
1289
+ ResizeObserver: ResizeObserver$1,
1290
+ overflowContainer: d
1291
+ });
1292
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
1293
+ ref: E.ref,
1294
+ onClick: S,
1295
+ "data-testid": l,
1296
+ children: t
1297
+ }), /* @__PURE__ */ jsx(CSSTransition, {
1298
+ nodeRef: v,
1299
+ in: y,
1300
+ timeout: 100,
1301
+ classNames: {
1302
+ enter: popover_module_default.enter,
1303
+ enterActive: popover_module_default.enterActive
1304
+ },
1305
+ unmountOnExit: !0,
1306
+ children: /* @__PURE__ */ jsx(Fragment$1, { children: y && C(/* @__PURE__ */ jsxs("div", {
1307
+ className: a ? cx(popover_module_default.toggleBox, popover_module_default.fullWidthStyleFix) : cx(popover_module_default.toggleBox),
1308
+ ...T,
1309
+ ref: (e) => {
1310
+ v.current = e, T.ref(e);
1311
+ },
1312
+ children: [/* @__PURE__ */ jsxs("div", { children: [React.isValidElement(n) ? React.cloneElement(n, { close: x }) : n, o && /* @__PURE__ */ jsx("div", {
1313
+ className: popover_module_default.dismiss,
1314
+ children: /* @__PURE__ */ jsx(Button, {
1315
+ small: !0,
1316
+ round: !0,
1317
+ onClick: x,
1318
+ icon: IconType.CLOSE
1319
+ })
1320
+ })] }), /* @__PURE__ */ jsx(Arrow, {
1321
+ ...w,
1322
+ backgroundColor: "var(--color-background-layer)",
1323
+ borderColor: "var(--color-border)",
1324
+ borderWidth: 1,
1325
+ size: 6
1326
+ })]
1327
+ })) })
1328
+ })] });
1329
+ };
1330
+ var color_input_module_default = {
1331
+ colorInput: "_colorInput_14lq1_1",
1332
+ trigger: "_trigger_14lq1_7",
1333
+ buttonColor: "_buttonColor_14lq1_11",
1334
+ options: "_options_14lq1_16",
1335
+ option: "_option_14lq1_16"
1336
+ };
1337
+ const ColorInput = ({ columns: e = 9, disabled: t, options: n = [], small: r, value: i, onChange: a }) => {
1338
+ let [o, s] = useState(!1), c = n.find((e) => e.value === i)?.label;
1339
+ return /* @__PURE__ */ jsx("div", {
1340
+ className: color_input_module_default.colorInput,
1341
+ children: /* @__PURE__ */ jsx(Popover, {
1342
+ placement: "bottom-start",
1343
+ isOpen: o,
1344
+ onToggle: s,
1345
+ content: /* @__PURE__ */ jsx("div", {
1346
+ className: color_input_module_default.options,
1347
+ style: { gridTemplateColumns: `repeat(${e}, auto)` },
1348
+ children: n.map((e) => /* @__PURE__ */ jsx("div", {
1349
+ className: color_input_module_default.option,
1350
+ children: /* @__PURE__ */ jsx(Button, {
1351
+ basic: !0,
1352
+ disabled: t,
1353
+ width: "var(--size)",
1354
+ tooltip: e.label,
1355
+ label: /* @__PURE__ */ jsx("div", {
1356
+ className: color_input_module_default.buttonColor,
1357
+ style: { backgroundColor: e.value }
1358
+ }),
1359
+ onClick: () => {
1360
+ a?.(e.value), s(!1);
1361
+ }
1362
+ }, e.value)
1363
+ }))
1364
+ }),
1365
+ children: /* @__PURE__ */ jsx(Button, {
1366
+ disabled: t,
1367
+ small: r,
1368
+ active: o,
1369
+ width: r ? "var(--size-sm)" : "var(--size)",
1370
+ tooltip: c,
1371
+ label: /* @__PURE__ */ jsx("div", {
1372
+ className: color_input_module_default.buttonColor,
1373
+ style: { backgroundColor: i }
1374
+ })
1375
+ })
1376
+ })
1377
+ });
1378
+ };
1267
1379
  var noScrollbars = css`
1268
1380
  scrollbar-width: none;
1269
1381
  -ms-overflow-style: none;
@@ -2741,7 +2853,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
2741
2853
  layerFocus: initialLayerFocus(e, C ?? 0),
2742
2854
  triggerFocus: initialTriggerFocus,
2743
2855
  isLayerOpen: !1
2744
- })), { getTriggerWidth: F, onKeyEvent: I, clearAllIsFocused: L, triggerProps: R, onClickTrigger: z, onChangeSearch: B, onClickDeselectOption: V, onClickClearAll: H, renderLayer: U, layerProps: W, closeLayer: G, onSelectOption: K, getLayerWidth: q, triggerBounds: Rd } = useCustomSelectLogic({
2856
+ })), { getTriggerWidth: F, onKeyEvent: I, clearAllIsFocused: L, triggerProps: R, onClickTrigger: z, onChangeSearch: B, onClickDeselectOption: V, onClickClearAll: H, renderLayer: U, layerProps: W, closeLayer: G, onSelectOption: K, getLayerWidth: q, triggerBounds: Bd } = useCustomSelectLogic({
2745
2857
  ...e,
2746
2858
  state: N,
2747
2859
  dispatch: P,
@@ -2809,7 +2921,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
2809
2921
  closeLayer: () => {
2810
2922
  b && G();
2811
2923
  },
2812
- width: q(Rd),
2924
+ width: q(Bd),
2813
2925
  small: d,
2814
2926
  focusedOptionIndex: N.layerFocus.current,
2815
2927
  firstSelectedOptionIndex: C ?? 0,
@@ -3411,70 +3523,7 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
3411
3523
  children: /* @__PURE__ */ jsx(Icon, { icon: n })
3412
3524
  })
3413
3525
  });
3414
- }, ActionsCell = ({ cell: e }) => /* @__PURE__ */ jsx(Actions, { actions: e.actions });
3415
- var popover_module_default = {
3416
- toggleBox: "_toggleBox_rwod1_1",
3417
- enter: "_enter_rwod1_8",
3418
- enterActive: "_enterActive_rwod1_12",
3419
- fullWidthStyleFix: "_fullWidthStyleFix_rwod1_17",
3420
- dismiss: "_dismiss_rwod1_22"
3421
- };
3422
- const Popover = ({ children: t, content: n, placement: r = "top-center", closeOnOutsideClick: i = !0, fullWidth: a = !1, showCloseButton: o = !1, testId: l, disabled: u = !1, overflowContainer: d = !1, isOpen: f, onToggle: h }) => {
3423
- let _ = useContext(DisabledContext), v = useRef(null), [y, b] = f === void 0 ? useState(!1) : [f, h], x = () => {
3424
- !u && !_ && b && b(!1);
3425
- }, S = () => {
3426
- u || _ || b && b(!y);
3427
- };
3428
- useEffect(() => {
3429
- (u || _) && x();
3430
- }, [u, _]);
3431
- let { renderLayer: C, arrowProps: w, layerProps: T, triggerProps: E } = useLayer({
3432
- isOpen: y,
3433
- placement: r,
3434
- auto: !0,
3435
- triggerOffset: 6,
3436
- onOutsideClick: i ? x : void 0,
3437
- ResizeObserver: ResizeObserver$1,
3438
- overflowContainer: d
3439
- });
3440
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
3441
- ref: E.ref,
3442
- onClick: S,
3443
- "data-testid": l,
3444
- children: t
3445
- }), /* @__PURE__ */ jsx(CSSTransition, {
3446
- nodeRef: v,
3447
- in: y,
3448
- timeout: 100,
3449
- classNames: {
3450
- enter: popover_module_default.enter,
3451
- enterActive: popover_module_default.enterActive
3452
- },
3453
- unmountOnExit: !0,
3454
- children: /* @__PURE__ */ jsx(Fragment$1, { children: y && C(/* @__PURE__ */ jsxs("div", {
3455
- className: a ? cx(popover_module_default.toggleBox, popover_module_default.fullWidthStyleFix) : cx(popover_module_default.toggleBox),
3456
- ...T,
3457
- ref: (e) => {
3458
- v.current = e, T.ref(e);
3459
- },
3460
- children: [/* @__PURE__ */ jsxs("div", { children: [React.isValidElement(n) ? React.cloneElement(n, { close: x }) : n, o && /* @__PURE__ */ jsx("div", {
3461
- className: popover_module_default.dismiss,
3462
- children: /* @__PURE__ */ jsx(Button, {
3463
- small: !0,
3464
- round: !0,
3465
- onClick: x,
3466
- icon: IconType.CLOSE
3467
- })
3468
- })] }), /* @__PURE__ */ jsx(Arrow, {
3469
- ...w,
3470
- backgroundColor: "var(--color-background-layer)",
3471
- borderColor: "var(--color-border)",
3472
- borderWidth: 1,
3473
- size: 6
3474
- })]
3475
- })) })
3476
- })] });
3477
- }, CellHelpIcon = ({ cell: e }) => {
3526
+ }, ActionsCell = ({ cell: e }) => /* @__PURE__ */ jsx(Actions, { actions: e.actions }), CellHelpIcon = ({ cell: e }) => {
3478
3527
  let { helpIcon: t } = e;
3479
3528
  return t ? /* @__PURE__ */ jsx("div", {
3480
3529
  className: cell_module_default.icon,
@@ -6735,7 +6784,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6735
6784
  } : {
6736
6785
  value: G,
6737
6786
  unit: U
6738
- }), Rd = k || K?.value === void 0, [J, zd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Bd = !!(O || n), Y = C && C.find((e) => {
6787
+ }), Bd = k || K?.value === void 0, [J, Vd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Hd = !!(O || n), Y = C && C.find((e) => {
6739
6788
  if (!e?.value) return;
6740
6789
  if (E) return E === e.valueKey;
6741
6790
  let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
@@ -6744,7 +6793,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6744
6793
  toUnit: t
6745
6794
  });
6746
6795
  return withUnit(n, t) === e.value;
6747
- }), Vd = () => {
6796
+ }), Ud = () => {
6748
6797
  let e = l ?? "", t = K.unit;
6749
6798
  if (checkConversion({
6750
6799
  value: e,
@@ -6758,7 +6807,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6758
6807
  return null;
6759
6808
  }
6760
6809
  } else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
6761
- }, Hd = (t) => {
6810
+ }, Wd = (t) => {
6762
6811
  let n = getStringName(e), r = t.target, { value: i, selectionStart: a } = r, o = withUnit(i, K?.unit || ""), s = A ? withUnit(convertAndGetValue(o, B), B) : o;
6763
6812
  h({ target: {
6764
6813
  value: s,
@@ -6771,7 +6820,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6771
6820
  }), R(() => {
6772
6821
  r.selectionStart = a, r.selectionEnd = a;
6773
6822
  });
6774
- }, Ud = (e, t) => {
6823
+ }, Gd = (e, t) => {
6775
6824
  t === K.unit || isNaN(Number(e)) || (q({
6776
6825
  value: e,
6777
6826
  unit: t
@@ -6802,7 +6851,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6802
6851
  e !== void 0 && q({
6803
6852
  value: e,
6804
6853
  unit: t
6805
- }), zd(C && Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
6854
+ }), Vd(C && Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
6806
6855
  }
6807
6856
  }, [
6808
6857
  U,
@@ -6810,7 +6859,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6810
6859
  i,
6811
6860
  T
6812
6861
  ]);
6813
- let X = Vd(), Z = label(K.unit) || K.unit || "", Wd = p || !X || X && X.length === 1, Q = getStringName(e), $, Gd = (t) => {
6862
+ let X = Ud(), Z = label(K.unit) || K.unit || "", Kd = p || !X || X && X.length === 1, Q = getStringName(e), $, qd = (t) => {
6814
6863
  let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
6815
6864
  if (checkConversion({
6816
6865
  value: r,
@@ -6830,7 +6879,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6830
6879
  type: MenuType.OPTION,
6831
6880
  inline: !0,
6832
6881
  onClick: () => {
6833
- validateNumber(i).valid && !n && (zd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
6882
+ validateNumber(i).valid && !n && (Vd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
6834
6883
  value: r,
6835
6884
  name: typeof e == "string" ? e : e?.fieldName || "",
6836
6885
  predefinedSelected: !0,
@@ -6857,10 +6906,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6857
6906
  label: "Custom",
6858
6907
  selected: J === PredefinedOptionsMenuState.CUSTOM
6859
6908
  }], C?.length) {
6860
- let e = C.map(Gd);
6909
+ let e = C.map(qd);
6861
6910
  $ = [...$, ...e];
6862
6911
  }
6863
- let Kd = (e) => {
6912
+ let Jd = (e) => {
6864
6913
  if (isValueWithUnit(e)) {
6865
6914
  let t = getUnit(e), { value: n } = safeConvertValue({
6866
6915
  value: e,
@@ -6872,7 +6921,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6872
6921
  return n;
6873
6922
  }
6874
6923
  return e;
6875
- }, qd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Jd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
6924
+ }, Yd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Xd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
6876
6925
  return /* @__PURE__ */ jsx("div", {
6877
6926
  className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
6878
6927
  children: /* @__PURE__ */ jsxs(InputGroup, {
@@ -6904,31 +6953,31 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6904
6953
  name: Q,
6905
6954
  testId: x,
6906
6955
  disabled: n,
6907
- placeholder: Kd(t),
6956
+ placeholder: Jd(t),
6908
6957
  value: K.value,
6909
- onChange: Hd,
6958
+ onChange: Wd,
6910
6959
  onFocus: v,
6911
6960
  error: i === null ? void 0 : i,
6912
6961
  warning: S === null ? void 0 : S,
6913
6962
  left: a,
6914
- allowEmpty: Rd,
6963
+ allowEmpty: Bd,
6915
6964
  validationCallback: (e, t) => D(Q, t),
6916
6965
  enableCosmeticRounding: j,
6917
6966
  enableDisplayRounding: M,
6918
6967
  roundDisplayValue: N,
6919
- groupOrder: qd,
6920
- disableInternalErrorValidationMessages: Bd,
6968
+ groupOrder: Yd,
6969
+ disableInternalErrorValidationMessages: Hd,
6921
6970
  small: o,
6922
6971
  selectOnFocus: P,
6923
6972
  tooltip: I
6924
6973
  }, Q)
6925
6974
  }),
6926
- Z && (Wd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
6927
- groupOrder: Jd,
6975
+ Z && (Kd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
6976
+ groupOrder: Xd,
6928
6977
  small: o,
6929
6978
  children: Z
6930
6979
  }) : /* @__PURE__ */ jsx(Menu, {
6931
- groupOrder: Jd,
6980
+ groupOrder: Xd,
6932
6981
  maxHeight: 380,
6933
6982
  disabled: r,
6934
6983
  testId: x && `${x}-menu`,
@@ -6944,7 +6993,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6944
6993
  label: j ? safeRoundNumbers(i) : i,
6945
6994
  inline: !0,
6946
6995
  onClick: (n) => {
6947
- n.stopPropagation(), Ud(e, t);
6996
+ n.stopPropagation(), Gd(e, t);
6948
6997
  },
6949
6998
  description: r,
6950
6999
  selected: r === Z,
@@ -8844,4 +8893,4 @@ const ComparisonViewModal = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, se
8844
8893
  }
8845
8894
  });
8846
8895
  };
8847
- export { Accordion, AccordionWithDefaultToggle, Actions, Align, AuditLog, Badge, Breadcrumb, BreadcrumbLinkType, Button, ButtonGroup, ButtonPosition, ButtonType, Card, CheckBox, Chevron, Collapse, Color, Column, Dialog, DiffViewer, DisabledContext, Divider, Drawer, ElementType, Empty, Field, FileButton, FileInput, Flex, FormRow, Grid, GroupOrder, Heading, HelpIcon, Icon, IconType, Input, InputGroup, InputGroupAddon, InputReaderMethods, InputType, Label, List, ListHeading, ListSubheading, Loader, Menu, MenuCarat, MenuType, Message, MessageType, Modal, NativeSelect, NumberInput, OptionDropdown, Page, Pagination, PopConfirm, Popover, Portal, PrintHeader, ProgressBar, RadioButton, RichTextInput, Row, Select, SettingField, SideBar, Slider, SmartUploadModal, Spacer, Spinner, Table, TableImportExport, Tabs, Text, TextArea, TextLink, TextTransform, Theme, Toaster, Toggle, Tooltip, TopBar, Tree, TriggerType, UnitInput, UnitTable, UsageTracker, dismissToast, initializeContext, initializeGuiLibrary, readFile, toast, useFocus, useKeyboardEvent, useWindowWidth };
8896
+ export { Accordion, AccordionWithDefaultToggle, Actions, Align, AuditLog, Badge, Breadcrumb, BreadcrumbLinkType, Button, ButtonGroup, ButtonPosition, ButtonType, Card, CheckBox, Chevron, Collapse, Color, ColorInput, Column, Dialog, DiffViewer, DisabledContext, Divider, Drawer, ElementType, Empty, Field, FileButton, FileInput, Flex, FormRow, Grid, GroupOrder, Heading, HelpIcon, Icon, IconType, Input, InputGroup, InputGroupAddon, InputReaderMethods, InputType, Label, List, ListHeading, ListSubheading, Loader, Menu, MenuCarat, MenuType, Message, MessageType, Modal, NativeSelect, NumberInput, OptionDropdown, Page, Pagination, PopConfirm, Popover, Portal, PrintHeader, ProgressBar, RadioButton, RichTextInput, Row, Select, SettingField, SideBar, Slider, SmartUploadModal, Spacer, Spinner, Table, TableImportExport, Tabs, Text, TextArea, TextLink, TextTransform, Theme, Toaster, Toggle, Tooltip, TopBar, Tree, TriggerType, UnitInput, UnitTable, UsageTracker, dismissToast, initializeContext, initializeGuiLibrary, readFile, toast, useFocus, useKeyboardEvent, useWindowWidth };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "5.11.5",
3
+ "version": "5.11.6-beta-2",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {