@oliasoft-open-source/react-ui-library 5.6.1-beta-7 → 5.6.2-beta-1

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
@@ -98,7 +98,7 @@ export declare enum ElementType {
98
98
 
99
99
  export declare const Empty: ({ width, height, text, children, testId, }: IEmptyProps) => JSX_2.Element;
100
100
 
101
- export declare const Field: ({ label, labelLeft, labelWidth, children, helpText, helpTextMaxWidth, onClickHelp, lock, info, libraryIcon, testId, }: IFieldProps) => JSX_2.Element;
101
+ export declare const Field: ({ label, labelLeft, labelWidth, children, helpText, helpTextMaxWidth, onClickHelp, lock, info, libraryIcon, testId, textTransform, }: IFieldProps) => JSX_2.Element;
102
102
 
103
103
  export declare const FileButton: ({ file, accept, multi, name, disabled, onChange, ...buttonProps }: IFileButtonProps) => JSX_2.Element;
104
104
 
@@ -446,6 +446,7 @@ export declare interface IFieldProps {
446
446
  info?: string;
447
447
  libraryIcon?: ILabelIcon;
448
448
  testId?: string;
449
+ textTransform?: TTextTransform;
449
450
  }
450
451
 
451
452
  export declare interface IFileButtonProps extends IButtonProps {
@@ -629,6 +630,7 @@ export declare interface ILabelProps {
629
630
  lock?: ILabelLockProps;
630
631
  libraryIcon?: ILabelIcon;
631
632
  labelLeft?: boolean;
633
+ textTransform?: TTextTransform;
632
634
  }
633
635
 
634
636
  export declare interface ILayoutColumnProps {
@@ -1816,7 +1818,7 @@ export declare interface IUnitTableRow extends Omit<TRowType, 'cells'> {
1816
1818
  declare interface IUnitTableStaticCell extends IStaticCell, IUnitTableCell {
1817
1819
  }
1818
1820
 
1819
- export declare const Label: ({ label, width, helpText, helpTextMaxWidth, onClickHelp, lock, info, libraryIcon, labelLeft, }: ILabelProps) => JSX_2.Element;
1821
+ export declare const Label: ({ label, width, helpText, helpTextMaxWidth, onClickHelp, lock, info, libraryIcon, labelLeft, textTransform, }: ILabelProps) => JSX_2.Element;
1820
1822
 
1821
1823
  export declare const List: ({ list, bordered, expanding, narrow, toggleNarrow, onToggleNarrow, invokeEditOnRowClick, noHeader, stickyHeader, draggable, onListReorder, marginBottom, height, testId, scrollDetails, }: IListProps) => JSX_2.Element;
1822
1824
 
@@ -2093,6 +2095,8 @@ declare type TStringNumberNull = string | number | null;
2093
2095
 
2094
2096
  declare type TStringOrNumber = string | number;
2095
2097
 
2098
+ declare type TTextTransform = 'uppercase' | 'lowercase' | 'capitalize' | 'none';
2099
+
2096
2100
  export declare type TTheme = 'dark' | 'white' | 'light' | 'inherit';
2097
2101
 
2098
2102
  declare type TTopBarContent = TLinkElement | TButtonElement | TMenuElement | TComponentElement;
package/dist/index.js CHANGED
@@ -42,6 +42,8 @@ let TriggerType = /* @__PURE__ */ function(e) {
42
42
  return e.TOP = "top", e.BOTTOM = "bottom", e;
43
43
  }({}), IconType = /* @__PURE__ */ function(e) {
44
44
  return e.LIBRARY = "library", e.ADD = "add", e.DRAG = "drag", e.HELP = "help", e.NOTIFICATION = "notification", e.MENU = "menu", e.EDIT = "edit", e.FAST_FORWARD = "fast forward", e.INDENT = "indent", e.STAR = "star", e.LIST = "list", e.SETTINGS = "settings", e.CHECK = "check", e.LOCK = "lock", e.UNLOCK = "unlock", e.CLOSE = "close", e.SUCCESS = "success", e.WARNING = "warning", e.ERROR = "error", e.INFO = "info", e.LEFT = "left", e.COLLAPSE = "collapse", e.EXPAND = "expand", e.SORT_ASCENDING = "sort ascending", e.SORT_DESCENDING = "sort descending", e.FAST_BACKWARD = "fast backward", e.CHEVRON_DOWN = "chevron down", e.CHEVRON_RIGHT = "chevron right", e.CHEVRON_LEFT = "chevron left", e.CHEVRON_DOUBLE_LEFT = "chevron double left", e.CHEVRON_DOUBLE_RIGHT = "chevron double right", e;
45
+ }({}), TextTransform = /* @__PURE__ */ function(e) {
46
+ return e.UPPERCASE = "uppercase", e.LOWERCASE = "lowercase", e.CAPITALIZE = "capitalize", e.NONE = "none", e;
45
47
  }({}), Theme = /* @__PURE__ */ function(e) {
46
48
  return e.DARK = "dark", e.WHITE = "white", e.LIGHT = "light", e.INHERIT = "inherit", e;
47
49
  }({}), InputType = /* @__PURE__ */ function(e) {
@@ -3472,7 +3474,7 @@ const Popover = ({ children: t, content: n, placement: r = "top-center", closeOn
3472
3474
  }
3473
3475
  };
3474
3476
  let CellType = /* @__PURE__ */ function(e) {
3475
- return e.INPUT = "Input", e.NUMBER_INPUT = "NumberInput", e.SELECT = "Select", e.POPOVER = "Popover", e.SLIDER = "Slider", e.CHECKBOX = "CheckBox", e.ACTIONS = "Actions", e.AUTO_UNIT = "AutoUnit", e;
3477
+ return e.INPUT = "Input", e.NUMBER_INPUT = "NumberInput", e.SELECT = "Select", e.POPOVER = "Popover", e.SLIDER = "Slider", e.CHECKBOX = "CheckBox", e.ACTIONS = "Actions", e.AUTO_UNIT = "AutoUnit", e.UNIT = "Unit", e.STATIC = "Static", e;
3476
3478
  }({});
3477
3479
  const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment: r = Align.LEFT, width: i, testId: a }) => {
3478
3480
  if (!e) return null;
@@ -3480,15 +3482,16 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
3480
3482
  bodyAlignment: r,
3481
3483
  headerAlignment: n,
3482
3484
  isHeader: t
3483
- }, f = getCellAlignment(d, cell_module_default), m = getCellAlignment(d, cell_module_default, !0), h = e.type === CellType.INPUT || e.type === CellType.NUMBER_INPUT || e.type === CellType.SELECT || e.type === CellType.POPOVER ? cell_module_default.inputCell : e.type === CellType.SLIDER ? cell_module_default.sliderCell : e.type === CellType.CHECKBOX ? cell_module_default.checkBoxCell : e.type === CellType.ACTIONS ? cell_module_default.actionsCell : cell_module_default.staticCell, _ = cx(cell_module_default.cell, h, e.hasSort ? cell_module_default.sortingCell : null, f, e.breakWord ? cell_module_default.breakWord : ""), v = l ?? i ?? void 0, y = {
3485
+ }, f = getCellAlignment(d, cell_module_default), m = getCellAlignment(d, cell_module_default, !0), h = e.type === CellType.INPUT || e.type === CellType.NUMBER_INPUT || e.type === CellType.SELECT || e.type === CellType.POPOVER ? cell_module_default.inputCell : e.type === CellType.SLIDER ? cell_module_default.sliderCell : e.type === CellType.CHECKBOX ? cell_module_default.checkBoxCell : e.type === CellType.ACTIONS ? cell_module_default.actionsCell : cell_module_default.staticCell, _ = cx(cell_module_default.cell, h, e.hasSort ? cell_module_default.sortingCell : null, f, e.breakWord ? cell_module_default.breakWord : ""), v = l ?? i ?? void 0, y = e.type === CellType.STATIC || !e.type, b = t && y ? TextTransform.CAPITALIZE : void 0, x = {
3484
3486
  width: v,
3485
3487
  minWidth: v,
3488
+ textTransform: b,
3486
3489
  ...o
3487
3490
  };
3488
3491
  return /* @__PURE__ */ jsx(t ? "th" : "td", {
3489
3492
  ref: u,
3490
3493
  className: _,
3491
- style: y,
3494
+ style: x,
3492
3495
  colSpan: s,
3493
3496
  rowSpan: c,
3494
3497
  children: /* @__PURE__ */ jsx(CellWrapper, {
@@ -5038,10 +5041,13 @@ const Label = ({ label: e = null, width: t = "auto", helpText: n = "", helpTextM
5038
5041
  onClick: () => {},
5039
5042
  tooltip: "",
5040
5043
  testId: void 0
5041
- }, info: o, libraryIcon: s, labelLeft: c = !1 }) => /* @__PURE__ */ jsx("div", {
5044
+ }, info: o, libraryIcon: s, labelLeft: c = !1, textTransform: l = TextTransform.CAPITALIZE }) => /* @__PURE__ */ jsx("div", {
5042
5045
  className: cx(label_module_default.label, c ? label_module_default.labelLeft : ""),
5043
5046
  children: /* @__PURE__ */ jsxs("label", {
5044
- style: { width: t || "" },
5047
+ style: {
5048
+ textTransform: l,
5049
+ width: t || ""
5050
+ },
5045
5051
  children: [e, /* @__PURE__ */ jsxs("div", {
5046
5052
  className: label_module_default.icons,
5047
5053
  children: [
@@ -5083,7 +5089,7 @@ const Field = ({ label: e, labelLeft: t = !1, labelWidth: n = "auto", children:
5083
5089
  onClick: () => {},
5084
5090
  tooltip: "",
5085
5091
  testId: void 0
5086
- }, info: c, libraryIcon: l, testId: u }) => /* @__PURE__ */ jsxs("div", {
5092
+ }, info: c, libraryIcon: l, testId: u, textTransform: d = TextTransform.CAPITALIZE }) => /* @__PURE__ */ jsxs("div", {
5087
5093
  className: cx(form_module_default.field, t ? form_module_default.labelLeft : ""),
5088
5094
  "data-testid": u,
5089
5095
  children: [(e || t) && /* @__PURE__ */ jsx(Label, {
@@ -5095,7 +5101,8 @@ const Field = ({ label: e, labelLeft: t = !1, labelWidth: n = "auto", children:
5095
5101
  lock: s,
5096
5102
  info: c,
5097
5103
  libraryIcon: l,
5098
- labelLeft: t
5104
+ labelLeft: t,
5105
+ textTransform: d
5099
5106
  }), /* @__PURE__ */ jsx("div", {
5100
5107
  className: form_module_default.fieldInput,
5101
5108
  children: r
@@ -6556,7 +6563,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6556
6563
  } : {
6557
6564
  value: G,
6558
6565
  unit: U
6559
- }), Cu = k || K?.value === void 0, [J, wu] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Tu = !!(O || n), Y = C && C.find((e) => {
6566
+ }), wu = k || K?.value === void 0, [J, Tu] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Eu = !!(O || n), Y = C && C.find((e) => {
6560
6567
  if (!e?.value) return;
6561
6568
  if (E) return E === e.valueKey;
6562
6569
  let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
@@ -6565,7 +6572,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6565
6572
  toUnit: t
6566
6573
  });
6567
6574
  return withUnit(n, t) === e.value;
6568
- }), Eu = () => {
6575
+ }), Du = () => {
6569
6576
  let e = l ?? "", t = K.unit;
6570
6577
  if (checkConversion({
6571
6578
  value: e,
@@ -6579,7 +6586,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6579
6586
  return null;
6580
6587
  }
6581
6588
  } else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
6582
- }, Du = (t) => {
6589
+ }, Ou = (t) => {
6583
6590
  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;
6584
6591
  h({ target: {
6585
6592
  value: s,
@@ -6592,7 +6599,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6592
6599
  }), R(() => {
6593
6600
  r.selectionStart = a, r.selectionEnd = a;
6594
6601
  });
6595
- }, Ou = (e, t) => {
6602
+ }, ku = (e, t) => {
6596
6603
  t === K.unit || isNaN(Number(e)) || (q({
6597
6604
  value: e,
6598
6605
  unit: t
@@ -6623,7 +6630,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6623
6630
  e !== void 0 && q({
6624
6631
  value: e,
6625
6632
  unit: t
6626
- }), C && wu(Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
6633
+ }), C && Tu(Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
6627
6634
  }
6628
6635
  }, [
6629
6636
  U,
@@ -6631,7 +6638,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6631
6638
  i,
6632
6639
  T
6633
6640
  ]);
6634
- let X = Eu(), Z = label(K.unit) || K.unit || "", ku = p || !X || X && X.length === 1, Q = getStringName(e), $, Au = (t) => {
6641
+ let X = Du(), Z = label(K.unit) || K.unit || "", Au = p || !X || X && X.length === 1, Q = getStringName(e), $, ju = (t) => {
6635
6642
  let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
6636
6643
  if (checkConversion({
6637
6644
  value: r,
@@ -6651,7 +6658,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6651
6658
  type: MenuType.OPTION,
6652
6659
  inline: !0,
6653
6660
  onClick: () => {
6654
- validateNumber(i).valid && !n && (wu(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
6661
+ validateNumber(i).valid && !n && (Tu(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
6655
6662
  value: r,
6656
6663
  name: typeof e == "string" ? e : e?.fieldName || "",
6657
6664
  predefinedSelected: !0,
@@ -6678,10 +6685,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6678
6685
  label: "Custom",
6679
6686
  selected: J === PredefinedOptionsMenuState.CUSTOM
6680
6687
  }], C?.length) {
6681
- let e = C.map(Au);
6688
+ let e = C.map(ju);
6682
6689
  $ = [...$, ...e];
6683
6690
  }
6684
- let ju = (e) => {
6691
+ let Mu = (e) => {
6685
6692
  if (isValueWithUnit(e)) {
6686
6693
  let t = getUnit(e), { value: n } = safeConvertValue({
6687
6694
  value: e,
@@ -6693,7 +6700,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6693
6700
  return n;
6694
6701
  }
6695
6702
  return e;
6696
- }, Mu = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Nu = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
6703
+ }, Nu = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Pu = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
6697
6704
  return /* @__PURE__ */ jsx("div", {
6698
6705
  className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
6699
6706
  children: /* @__PURE__ */ jsxs(InputGroup, {
@@ -6725,31 +6732,31 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6725
6732
  name: Q,
6726
6733
  testId: x,
6727
6734
  disabled: n,
6728
- placeholder: ju(t),
6735
+ placeholder: Mu(t),
6729
6736
  value: K.value,
6730
- onChange: Du,
6737
+ onChange: Ou,
6731
6738
  onFocus: v,
6732
6739
  error: i === null ? void 0 : i,
6733
6740
  warning: S === null ? void 0 : S,
6734
6741
  left: a,
6735
- allowEmpty: Cu,
6742
+ allowEmpty: wu,
6736
6743
  validationCallback: (e, t) => D(Q, t),
6737
6744
  enableCosmeticRounding: j,
6738
6745
  enableDisplayRounding: M,
6739
6746
  roundDisplayValue: N,
6740
- groupOrder: Mu,
6741
- disableInternalErrorValidationMessages: Tu,
6747
+ groupOrder: Nu,
6748
+ disableInternalErrorValidationMessages: Eu,
6742
6749
  small: o,
6743
6750
  selectOnFocus: P,
6744
6751
  tooltip: I
6745
6752
  }, Q)
6746
6753
  }),
6747
- Z && (ku || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
6748
- groupOrder: Nu,
6754
+ Z && (Au || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
6755
+ groupOrder: Pu,
6749
6756
  small: o,
6750
6757
  children: Z
6751
6758
  }) : /* @__PURE__ */ jsx(Menu, {
6752
- groupOrder: Nu,
6759
+ groupOrder: Pu,
6753
6760
  maxHeight: 380,
6754
6761
  disabled: r,
6755
6762
  testId: x && `${x}-menu`,
@@ -6765,7 +6772,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6765
6772
  label: j ? safeRoundNumbers(i) : i,
6766
6773
  inline: !0,
6767
6774
  onClick: (n) => {
6768
- n.stopPropagation(), Ou(e, t);
6775
+ n.stopPropagation(), ku(e, t);
6769
6776
  },
6770
6777
  description: r,
6771
6778
  selected: r === Z,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "5.6.1-beta-7",
3
+ "version": "5.6.2-beta-1",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {