@northlight/ui 2.12.2 → 2.12.3

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.
@@ -490,8 +490,8 @@ const useCurrentTheme = () => {
490
490
  };
491
491
 
492
492
  var __defProp$25 = Object.defineProperty;
493
- var __defProps$y = Object.defineProperties;
494
- var __getOwnPropDescs$y = Object.getOwnPropertyDescriptors;
493
+ var __defProps$z = Object.defineProperties;
494
+ var __getOwnPropDescs$z = Object.getOwnPropertyDescriptors;
495
495
  var __getOwnPropSymbols$25 = Object.getOwnPropertySymbols;
496
496
  var __hasOwnProp$25 = Object.prototype.hasOwnProperty;
497
497
  var __propIsEnum$25 = Object.prototype.propertyIsEnumerable;
@@ -507,43 +507,43 @@ var __spreadValues$25 = (a, b) => {
507
507
  }
508
508
  return a;
509
509
  };
510
- var __spreadProps$y = (a, b) => __defProps$y(a, __getOwnPropDescs$y(b));
510
+ var __spreadProps$z = (a, b) => __defProps$z(a, __getOwnPropDescs$z(b));
511
511
  const customSelectStyles = {
512
- container: (provided) => __spreadProps$y(__spreadValues$25({}, provided), {
512
+ container: (provided) => __spreadProps$z(__spreadValues$25({}, provided), {
513
513
  width: "100%",
514
514
  color: "text.default"
515
515
  }),
516
- option: (provided, state) => __spreadProps$y(__spreadValues$25({}, provided), {
516
+ option: (provided, state) => __spreadProps$z(__spreadValues$25({}, provided), {
517
517
  background: state.isFocused && "background.select.option-focus",
518
518
  _active: {
519
519
  background: "background.select.option-active"
520
520
  }
521
521
  }),
522
- valueContainer: (provided) => __spreadProps$y(__spreadValues$25({}, provided), {
522
+ valueContainer: (provided) => __spreadProps$z(__spreadValues$25({}, provided), {
523
523
  paddingInlineStart: "padding-inline.select.default"
524
524
  }),
525
- downChevron: (provided) => __spreadProps$y(__spreadValues$25({}, provided), {
525
+ downChevron: (provided) => __spreadProps$z(__spreadValues$25({}, provided), {
526
526
  color: "icon.select.default"
527
527
  }),
528
- placeholder: (provided) => __spreadProps$y(__spreadValues$25({}, provided), {
528
+ placeholder: (provided) => __spreadProps$z(__spreadValues$25({}, provided), {
529
529
  color: "text.select.placeholder"
530
530
  }),
531
531
  multiValue: (provided, state) => {
532
532
  var _a;
533
533
  const background = state.data.isFixed ? "background.select.option-disabled" : (_a = state.data.color) != null ? _a : provided.bgColor;
534
- return __spreadProps$y(__spreadValues$25({}, provided), {
534
+ return __spreadProps$z(__spreadValues$25({}, provided), {
535
535
  bgColor: background,
536
536
  color: getContrastColor(background)
537
537
  });
538
538
  },
539
- menuList: (provided) => __spreadProps$y(__spreadValues$25({}, provided), {
539
+ menuList: (provided) => __spreadProps$z(__spreadValues$25({}, provided), {
540
540
  bgColor: "background.default"
541
541
  })
542
542
  };
543
543
 
544
544
  var __defProp$24 = Object.defineProperty;
545
- var __defProps$x = Object.defineProperties;
546
- var __getOwnPropDescs$x = Object.getOwnPropertyDescriptors;
545
+ var __defProps$y = Object.defineProperties;
546
+ var __getOwnPropDescs$y = Object.getOwnPropertyDescriptors;
547
547
  var __getOwnPropSymbols$24 = Object.getOwnPropertySymbols;
548
548
  var __hasOwnProp$24 = Object.prototype.hasOwnProperty;
549
549
  var __propIsEnum$24 = Object.prototype.propertyIsEnumerable;
@@ -559,9 +559,9 @@ var __spreadValues$24 = (a, b) => {
559
559
  }
560
560
  return a;
561
561
  };
562
- var __spreadProps$x = (a, b) => __defProps$x(a, __getOwnPropDescs$x(b));
563
- const tagsInputStyles = (isFocused, borderColor) => __spreadProps$x(__spreadValues$24({}, customSelectStyles), {
564
- container: (provided) => __spreadProps$x(__spreadValues$24({}, provided), {
562
+ var __spreadProps$y = (a, b) => __defProps$y(a, __getOwnPropDescs$y(b));
563
+ const tagsInputStyles = (isFocused, borderColor) => __spreadProps$y(__spreadValues$24({}, customSelectStyles), {
564
+ container: (provided) => __spreadProps$y(__spreadValues$24({}, provided), {
565
565
  w: "full",
566
566
  height: "100%",
567
567
  resize: "vertical",
@@ -574,12 +574,12 @@ const tagsInputStyles = (isFocused, borderColor) => __spreadProps$x(__spreadValu
574
574
  color: "text.default",
575
575
  boxShadow: isFocused ? `0 0 0 1px ${borderColor}` : "none"
576
576
  }),
577
- control: (provided) => __spreadProps$x(__spreadValues$24({}, provided), {
577
+ control: (provided) => __spreadProps$y(__spreadValues$24({}, provided), {
578
578
  minHeight: "20",
579
579
  height: "100%",
580
580
  alignItems: "start"
581
581
  }),
582
- valueContainer: (provided) => __spreadProps$x(__spreadValues$24({}, provided), {
582
+ valueContainer: (provided) => __spreadProps$y(__spreadValues$24({}, provided), {
583
583
  paddingInlineStart: "padding-inline.select.default",
584
584
  overflowY: "auto",
585
585
  maxH: "100%"
@@ -587,8 +587,8 @@ const tagsInputStyles = (isFocused, borderColor) => __spreadProps$x(__spreadValu
587
587
  });
588
588
 
589
589
  var __defProp$23 = Object.defineProperty;
590
- var __defProps$w = Object.defineProperties;
591
- var __getOwnPropDescs$w = Object.getOwnPropertyDescriptors;
590
+ var __defProps$x = Object.defineProperties;
591
+ var __getOwnPropDescs$x = Object.getOwnPropertyDescriptors;
592
592
  var __getOwnPropSymbols$23 = Object.getOwnPropertySymbols;
593
593
  var __hasOwnProp$23 = Object.prototype.hasOwnProperty;
594
594
  var __propIsEnum$23 = Object.prototype.propertyIsEnumerable;
@@ -604,7 +604,7 @@ var __spreadValues$23 = (a, b) => {
604
604
  }
605
605
  return a;
606
606
  };
607
- var __spreadProps$w = (a, b) => __defProps$w(a, __getOwnPropDescs$w(b));
607
+ var __spreadProps$x = (a, b) => __defProps$x(a, __getOwnPropDescs$x(b));
608
608
  var __objRest$1w = (source, exclude) => {
609
609
  var target = {};
610
610
  for (var prop in source)
@@ -693,7 +693,7 @@ function TagsInput(_a) {
693
693
  };
694
694
  return /* @__PURE__ */ React.createElement(Box, { w: "full", "data-testid": testId }, /* @__PURE__ */ React.createElement(
695
695
  CustomSelect,
696
- __spreadValues$23(__spreadProps$w(__spreadValues$23({
696
+ __spreadValues$23(__spreadProps$x(__spreadValues$23({
697
697
  isMulti: true,
698
698
  menuPortalTarget: document.body,
699
699
  placeholder: "Type something and press Enter or comma...",
@@ -1547,7 +1547,7 @@ var __objRest$1f = (source, exclude) => {
1547
1547
  }
1548
1548
  return target;
1549
1549
  };
1550
- const Label$1 = (_a) => {
1550
+ const Label$1 = forwardRef$1((_a, ref) => {
1551
1551
  var _b = _a, {
1552
1552
  children,
1553
1553
  size = "sm",
@@ -1562,11 +1562,12 @@ const Label$1 = (_a) => {
1562
1562
  FormLabel$1,
1563
1563
  __spreadValues$1N({
1564
1564
  sx: styles,
1565
- requiredIndicator: /* @__PURE__ */ React.createElement(VisuallyHidden, null)
1565
+ requiredIndicator: /* @__PURE__ */ React.createElement(VisuallyHidden, null),
1566
+ ref
1566
1567
  }, rest),
1567
1568
  children
1568
1569
  );
1569
- };
1570
+ });
1570
1571
 
1571
1572
  const positiveOrZero = ifElse(gt(0), always(0), identity);
1572
1573
  const EMPTY_RECT = {
@@ -1939,6 +1940,8 @@ const Form = forwardRef$1((_a, ref) => {
1939
1940
  });
1940
1941
 
1941
1942
  var __defProp$1G = Object.defineProperty;
1943
+ var __defProps$w = Object.defineProperties;
1944
+ var __getOwnPropDescs$w = Object.getOwnPropertyDescriptors;
1942
1945
  var __getOwnPropSymbols$1G = Object.getOwnPropertySymbols;
1943
1946
  var __hasOwnProp$1G = Object.prototype.hasOwnProperty;
1944
1947
  var __propIsEnum$1G = Object.prototype.propertyIsEnumerable;
@@ -1954,6 +1957,7 @@ var __spreadValues$1G = (a, b) => {
1954
1957
  }
1955
1958
  return a;
1956
1959
  };
1960
+ var __spreadProps$w = (a, b) => __defProps$w(a, __getOwnPropDescs$w(b));
1957
1961
  var __objRest$19 = (source, exclude) => {
1958
1962
  var target = {};
1959
1963
  for (var prop in source)
@@ -1966,7 +1970,7 @@ var __objRest$19 = (source, exclude) => {
1966
1970
  }
1967
1971
  return target;
1968
1972
  };
1969
- const FormLabel = (_a) => {
1973
+ const FormLabel = forwardRef$1((_a, ref) => {
1970
1974
  var _b = _a, {
1971
1975
  children: label
1972
1976
  } = _b, rest = __objRest$19(_b, [
@@ -1974,7 +1978,7 @@ const FormLabel = (_a) => {
1974
1978
  ]);
1975
1979
  return /* @__PURE__ */ React.createElement(
1976
1980
  Label$1,
1977
- __spreadValues$1G({
1981
+ __spreadProps$w(__spreadValues$1G({
1978
1982
  size: "sm",
1979
1983
  sx: {
1980
1984
  width: "80%",
@@ -1983,10 +1987,12 @@ const FormLabel = (_a) => {
1983
1987
  marginInlineEnd: 3
1984
1988
  },
1985
1989
  requiredIndicator: void 0
1986
- }, rest),
1990
+ }, rest), {
1991
+ ref
1992
+ }),
1987
1993
  label
1988
1994
  );
1989
- };
1995
+ });
1990
1996
 
1991
1997
  var __defProp$1F = Object.defineProperty;
1992
1998
  var __getOwnPropSymbols$1F = Object.getOwnPropertySymbols;
@@ -2016,7 +2022,7 @@ var __objRest$18 = (source, exclude) => {
2016
2022
  }
2017
2023
  return target;
2018
2024
  };
2019
- function Field(_a) {
2025
+ const BaseField = (_a, ref) => {
2020
2026
  var _b = _a, {
2021
2027
  name,
2022
2028
  label,
@@ -2040,7 +2046,7 @@ function Field(_a) {
2040
2046
  const { formState: { errors } } = methods;
2041
2047
  const control = passedControl != null ? passedControl : methods.control;
2042
2048
  const fieldError = getFieldError(name, errors);
2043
- return /* @__PURE__ */ React.createElement(FormControl, { isInvalid: !!fieldError, isRequired }, /* @__PURE__ */ React.createElement(
2049
+ return /* @__PURE__ */ React.createElement(FormControl, { isInvalid: !!fieldError, isRequired, ref }, /* @__PURE__ */ React.createElement(
2044
2050
  Stack,
2045
2051
  __spreadValues$1F({
2046
2052
  spacing: "auto",
@@ -2058,7 +2064,8 @@ function Field(_a) {
2058
2064
  }
2059
2065
  )
2060
2066
  ), /* @__PURE__ */ React.createElement(FormErrorMessage, null, fieldError && (fieldError == null ? void 0 : fieldError.message)));
2061
- }
2067
+ };
2068
+ const Field = forwardRef$1(BaseField);
2062
2069
 
2063
2070
  const useSetValueRefreshed = () => {
2064
2071
  const { setValue, watch } = useFormContext();
@@ -2097,7 +2104,7 @@ var __objRest$17 = (source, exclude) => {
2097
2104
  }
2098
2105
  return target;
2099
2106
  };
2100
- const CheckboxField = (_a) => {
2107
+ const CheckboxField = forwardRef$1((_a, ref) => {
2101
2108
  var _b = _a, {
2102
2109
  name,
2103
2110
  label,
@@ -2132,7 +2139,8 @@ const CheckboxField = (_a) => {
2132
2139
  label: "",
2133
2140
  isRequired,
2134
2141
  direction,
2135
- validate
2142
+ validate,
2143
+ ref
2136
2144
  },
2137
2145
  ({ onChange, value }) => /* @__PURE__ */ React.createElement(
2138
2146
  Flex,
@@ -2157,7 +2165,7 @@ const CheckboxField = (_a) => {
2157
2165
  )
2158
2166
  )
2159
2167
  );
2160
- };
2168
+ });
2161
2169
 
2162
2170
  var __defProp$1D = Object.defineProperty;
2163
2171
  var __getOwnPropSymbols$1D = Object.getOwnPropertySymbols;
@@ -2763,7 +2771,7 @@ var __objRest$11 = (source, exclude) => {
2763
2771
  }
2764
2772
  return target;
2765
2773
  };
2766
- const FlipButtonGroupField = (_a) => {
2774
+ const FlipButtonGroupField = forwardRef$1((_a, ref) => {
2767
2775
  var _b = _a, {
2768
2776
  name,
2769
2777
  label,
@@ -2790,7 +2798,8 @@ const FlipButtonGroupField = (_a) => {
2790
2798
  label,
2791
2799
  direction,
2792
2800
  isRequired,
2793
- validate
2801
+ validate,
2802
+ ref
2794
2803
  },
2795
2804
  ({ onChange, value }) => /* @__PURE__ */ React.createElement(
2796
2805
  FlipButtonGroup,
@@ -2807,7 +2816,7 @@ const FlipButtonGroupField = (_a) => {
2807
2816
  children
2808
2817
  )
2809
2818
  );
2810
- };
2819
+ });
2811
2820
 
2812
2821
  var __defProp$1w = Object.defineProperty;
2813
2822
  var __defProps$s = Object.defineProperties;
@@ -3400,13 +3409,20 @@ const DatePicker$1 = (props) => {
3400
3409
  dateFormat
3401
3410
  })
3402
3411
  )
3403
- )), /* @__PURE__ */ React.createElement(InputRightElement, { zIndex: 0 }, /* @__PURE__ */ React.createElement(
3404
- Trigger,
3405
- __spreadProps$l(__spreadValues$1n({}, buttonProps), {
3406
- isDisabled,
3407
- handleClick: togglePopup
3408
- })
3409
- ))), /* @__PURE__ */ React.createElement(
3412
+ )), /* @__PURE__ */ React.createElement(
3413
+ InputRightElement,
3414
+ {
3415
+ sx: { height: "100%", paddingRight: "1" },
3416
+ zIndex: 0
3417
+ },
3418
+ /* @__PURE__ */ React.createElement(
3419
+ Trigger,
3420
+ __spreadProps$l(__spreadValues$1n({}, buttonProps), {
3421
+ isDisabled,
3422
+ handleClick: togglePopup
3423
+ })
3424
+ )
3425
+ )), /* @__PURE__ */ React.createElement(
3410
3426
  IconButton,
3411
3427
  {
3412
3428
  "aria-label": "reset-date",
@@ -4700,7 +4716,7 @@ const DateRangePicker = (props) => {
4700
4716
  dateFormat
4701
4717
  })
4702
4718
  )
4703
- )), /* @__PURE__ */ React.createElement(InputRightElement, null, /* @__PURE__ */ React.createElement(
4719
+ )), /* @__PURE__ */ React.createElement(InputRightElement, { sx: { height: "100%", paddingRight: "1" } }, /* @__PURE__ */ React.createElement(
4704
4720
  Trigger,
4705
4721
  __spreadProps$f(__spreadValues$1a({}, buttonProps), {
4706
4722
  isDisabled,
@@ -4811,7 +4827,7 @@ var __objRest$S = (source, exclude) => {
4811
4827
  }
4812
4828
  return target;
4813
4829
  };
4814
- const DatePickerField = (_a) => {
4830
+ const DatePickerField = forwardRef$1((_a, ref) => {
4815
4831
  var _b = _a, {
4816
4832
  name,
4817
4833
  minValue,
@@ -4857,7 +4873,8 @@ const DatePickerField = (_a) => {
4857
4873
  label,
4858
4874
  direction,
4859
4875
  isRequired,
4860
- validate
4876
+ validate,
4877
+ ref
4861
4878
  },
4862
4879
  ({ value, onChange }, { formState: { errors } }) => /* @__PURE__ */ React.createElement(
4863
4880
  InputGroupWrapper,
@@ -4881,7 +4898,7 @@ const DatePickerField = (_a) => {
4881
4898
  )
4882
4899
  )
4883
4900
  );
4884
- };
4901
+ });
4885
4902
 
4886
4903
  var __defProp$17 = Object.defineProperty;
4887
4904
  var __getOwnPropSymbols$17 = Object.getOwnPropertySymbols;
@@ -4911,7 +4928,7 @@ var __objRest$R = (source, exclude) => {
4911
4928
  }
4912
4929
  return target;
4913
4930
  };
4914
- const DateRangePickerField = (_a) => {
4931
+ const DateRangePickerField = forwardRef$1((_a, ref) => {
4915
4932
  var _b = _a, {
4916
4933
  name,
4917
4934
  minValue,
@@ -4955,7 +4972,8 @@ const DateRangePickerField = (_a) => {
4955
4972
  label,
4956
4973
  direction,
4957
4974
  isRequired,
4958
- validate
4975
+ validate,
4976
+ ref
4959
4977
  },
4960
4978
  ({ value, onChange }, { formState: { errors } }) => /* @__PURE__ */ React.createElement(
4961
4979
  DateRangePicker,
@@ -4973,7 +4991,7 @@ const DateRangePickerField = (_a) => {
4973
4991
  }, rest)
4974
4992
  )
4975
4993
  );
4976
- };
4994
+ });
4977
4995
 
4978
4996
  var __defProp$16 = Object.defineProperty;
4979
4997
  var __defProps$e = Object.defineProperties;
@@ -5338,7 +5356,7 @@ var __objRest$K = (source, exclude) => {
5338
5356
  }
5339
5357
  return target;
5340
5358
  };
5341
- const RadioGroupField = (_a) => {
5359
+ const RadioGroupField = forwardRef$1((_a, ref) => {
5342
5360
  var _b = _a, {
5343
5361
  name,
5344
5362
  label,
@@ -5363,7 +5381,8 @@ const RadioGroupField = (_a) => {
5363
5381
  label,
5364
5382
  direction,
5365
5383
  isRequired,
5366
- validate
5384
+ validate,
5385
+ ref
5367
5386
  },
5368
5387
  ({ onChange, value }) => /* @__PURE__ */ React.createElement(
5369
5388
  RadioGroup,
@@ -5380,7 +5399,7 @@ const RadioGroupField = (_a) => {
5380
5399
  children
5381
5400
  )
5382
5401
  ));
5383
- };
5402
+ });
5384
5403
 
5385
5404
  const carouselItemWidth = 150;
5386
5405
  const carouselItemSpacing = 60;
@@ -5860,7 +5879,7 @@ var __objRest$F = (source, exclude) => {
5860
5879
  }
5861
5880
  return target;
5862
5881
  };
5863
- const SearchBarField = (_a) => {
5882
+ const BaseSearchBarField = (_a, ref) => {
5864
5883
  var _b = _a, {
5865
5884
  name,
5866
5885
  label,
@@ -5892,7 +5911,8 @@ const SearchBarField = (_a) => {
5892
5911
  direction,
5893
5912
  isRequired,
5894
5913
  noLabelConnection: true,
5895
- validate
5914
+ validate,
5915
+ ref
5896
5916
  },
5897
5917
  ({ value, onChange }) => /* @__PURE__ */ React.createElement(HStack, { w: "full" }, /* @__PURE__ */ React.createElement(
5898
5918
  InputGroupWrapper,
@@ -5928,6 +5948,7 @@ const SearchBarField = (_a) => {
5928
5948
  ))
5929
5949
  );
5930
5950
  };
5951
+ const SearchBarField = forwardRef$1(BaseSearchBarField);
5931
5952
 
5932
5953
  var __defProp$V = Object.defineProperty;
5933
5954
  var __getOwnPropSymbols$V = Object.getOwnPropertySymbols;
@@ -6835,7 +6856,7 @@ const EditableText$1 = (_a) => {
6835
6856
  "leftItem"
6836
6857
  ]);
6837
6858
  const [value, setValue] = useState(inputValue);
6838
- const { input, preview } = useMultiStyleConfig("EditableText", { size });
6859
+ const { input, preview } = useMultiStyleConfig("EditableText", { size, value });
6839
6860
  useEffect(() => {
6840
6861
  setValue(inputValue);
6841
6862
  }, [inputValue]);
@@ -10541,7 +10562,7 @@ const EditableText = {
10541
10562
  }
10542
10563
  })
10543
10564
  },
10544
- baseStyle: {
10565
+ baseStyle: ({ value }) => ({
10545
10566
  controls: {
10546
10567
  mr: 1
10547
10568
  },
@@ -10551,12 +10572,13 @@ const EditableText = {
10551
10572
  whiteSpace: "nowrap",
10552
10573
  overflow: "hidden",
10553
10574
  paddingTop: 0,
10554
- paddingBottom: 0
10575
+ paddingBottom: 0,
10576
+ color: isNil(value) || isEmpty(value) ? "text.subdued" : "text.default"
10555
10577
  },
10556
10578
  input: {
10557
10579
  fontWeight: "semibold"
10558
10580
  }
10559
- }
10581
+ })
10560
10582
  };
10561
10583
 
10562
10584
  const Toolbox = {
@@ -10928,7 +10950,7 @@ const MediatoolThemeProvider = ({
10928
10950
 
10929
10951
  const NumberInputStepper = ({
10930
10952
  includePercentage = false
10931
- }) => /* @__PURE__ */ React.createElement(NumberInputStepper$1, null, /* @__PURE__ */ React.createElement(HStack, { alignItems: "center", h: "full" }, includePercentage && /* @__PURE__ */ React.createElement(Center, { bgColor: "gray.50", borderRadius: "md", boxSize: "6" }, /* @__PURE__ */ React.createElement(P$1, null, "%")), /* @__PURE__ */ React.createElement(Divider, { orientation: "vertical", h: "50%" }), /* @__PURE__ */ React.createElement(NumberIncrementStepper, { border: "none" }, /* @__PURE__ */ React.createElement(
10953
+ }) => /* @__PURE__ */ React.createElement(NumberInputStepper$1, null, /* @__PURE__ */ React.createElement(HStack, { alignItems: "center", h: "full" }, includePercentage && /* @__PURE__ */ React.createElement(Center, { bgColor: "gray.50", borderRadius: "md", boxSize: "6" }, /* @__PURE__ */ React.createElement(P$1, null, "%")), /* @__PURE__ */ React.createElement(HStack, { alignItems: "center", h: "full" }, /* @__PURE__ */ React.createElement(Divider, { orientation: "vertical", h: "50%" }), /* @__PURE__ */ React.createElement(NumberIncrementStepper, { border: "none" }, /* @__PURE__ */ React.createElement(
10932
10954
  Icon$1,
10933
10955
  {
10934
10956
  as: ChevronUpSolid,
@@ -10942,7 +10964,7 @@ const NumberInputStepper = ({
10942
10964
  color: "icon.input-stepper.default",
10943
10965
  boxSize: 4
10944
10966
  }
10945
- ))));
10967
+ )))));
10946
10968
 
10947
10969
  const regex = /(9{13,}|0{13,})(\d)*$/gm;
10948
10970
  const advancedParseFloat = (value) => {
@@ -11064,7 +11086,7 @@ var __objRest$k = (source, exclude) => {
11064
11086
  }
11065
11087
  return target;
11066
11088
  };
11067
- const NumberInputField = (_a) => {
11089
+ const NumberInputField = forwardRef$1((_a, ref) => {
11068
11090
  var _b = _a, {
11069
11091
  name,
11070
11092
  label,
@@ -11094,7 +11116,8 @@ const NumberInputField = (_a) => {
11094
11116
  label,
11095
11117
  direction,
11096
11118
  isRequired,
11097
- validate
11119
+ validate,
11120
+ ref
11098
11121
  },
11099
11122
  ({ onChange, value }) => {
11100
11123
  const initialValue = isNil(value) || Number.isNaN(parseFloat(value)) ? "" : formatNumber(value, 100);
@@ -11123,7 +11146,7 @@ const NumberInputField = (_a) => {
11123
11146
  );
11124
11147
  }
11125
11148
  );
11126
- };
11149
+ });
11127
11150
 
11128
11151
  var __defProp$o = Object.defineProperty;
11129
11152
  var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
@@ -11250,6 +11273,49 @@ const getMatchingValue = (value, options) => {
11250
11273
  return value;
11251
11274
  };
11252
11275
 
11276
+ const useAdaptiveMenuPlacement = ({
11277
+ dropdownHeightPx,
11278
+ containerRef
11279
+ }) => {
11280
+ const [menuPlacement, setMenuPlacement] = useState("bottom");
11281
+ const selectContainerRef = useRef(null);
11282
+ const adjustMenuPlacement = () => {
11283
+ if (isNil(selectContainerRef.current))
11284
+ return;
11285
+ let node = selectContainerRef.current.parentNode;
11286
+ while (node.parentNode) {
11287
+ const { overflowY, maxHeight, height } = getComputedStyle(node);
11288
+ if (overflowY !== "visible" || maxHeight || height)
11289
+ break;
11290
+ node = node.parentNode;
11291
+ }
11292
+ const selectRect = selectContainerRef.current.getBoundingClientRect();
11293
+ const containerRect = containerRef && containerRef.current ? containerRef.current.getBoundingClientRect() : node.getBoundingClientRect();
11294
+ const pxToContainerBottom = Math.abs(
11295
+ selectRect.bottom - containerRect.bottom
11296
+ );
11297
+ const pxToContainerTop = Math.abs(selectRect.top - containerRect.top);
11298
+ const pxToWindowBottom = Math.abs(selectRect.bottom - window.innerHeight);
11299
+ const shouldBeAtTop = dropdownHeightPx > pxToContainerBottom && pxToContainerTop > pxToContainerBottom || dropdownHeightPx > pxToWindowBottom && selectRect.top > pxToWindowBottom;
11300
+ setMenuPlacement(shouldBeAtTop ? "top" : "bottom");
11301
+ };
11302
+ useEffect(() => {
11303
+ adjustMenuPlacement();
11304
+ window.addEventListener("resize", adjustMenuPlacement);
11305
+ window.addEventListener("scroll", adjustMenuPlacement);
11306
+ return () => {
11307
+ window.removeEventListener("resize", adjustMenuPlacement);
11308
+ window.addEventListener("scroll", adjustMenuPlacement);
11309
+ };
11310
+ }, []);
11311
+ return { selectContainerRef, menuPlacement };
11312
+ };
11313
+
11314
+ const DROPDOWN_MAX_HEIGHT = 300;
11315
+ const DROPDOWN_MIN_HEIGHT = 55;
11316
+ const DROPDOWN_OPTION_HEIGHT = 37;
11317
+ const DROPDOWN_PADDING = 30;
11318
+
11253
11319
  var __defProp$m = Object.defineProperty;
11254
11320
  var __defProps$3 = Object.defineProperties;
11255
11321
  var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
@@ -11294,7 +11360,9 @@ const Select = forwardRef$1((_a, ref) => {
11294
11360
  customOption = null,
11295
11361
  customTag = null,
11296
11362
  value,
11297
- icon
11363
+ icon,
11364
+ containerRef,
11365
+ dropdownMinHeightPx = DROPDOWN_MIN_HEIGHT
11298
11366
  } = _b, rest = __objRest$h(_b, [
11299
11367
  "options",
11300
11368
  "isMulti",
@@ -11307,7 +11375,9 @@ const Select = forwardRef$1((_a, ref) => {
11307
11375
  "customOption",
11308
11376
  "customTag",
11309
11377
  "value",
11310
- "icon"
11378
+ "icon",
11379
+ "containerRef",
11380
+ "dropdownMinHeightPx"
11311
11381
  ]);
11312
11382
  const handleChange = useSelectCallbacks({
11313
11383
  onChange,
@@ -11329,7 +11399,18 @@ const Select = forwardRef$1((_a, ref) => {
11329
11399
  }
11330
11400
  return prevOptions.current;
11331
11401
  }, [options]);
11332
- return /* @__PURE__ */ React.createElement(Box, { w: "full", "data-testid": testId }, /* @__PURE__ */ React.createElement(
11402
+ const dropdownHeightPx = Math.max(
11403
+ Math.min(
11404
+ length(options || []) * DROPDOWN_OPTION_HEIGHT + DROPDOWN_PADDING,
11405
+ DROPDOWN_MAX_HEIGHT
11406
+ ),
11407
+ dropdownMinHeightPx
11408
+ );
11409
+ const { selectContainerRef, menuPlacement } = useAdaptiveMenuPlacement({
11410
+ dropdownHeightPx,
11411
+ containerRef
11412
+ });
11413
+ return /* @__PURE__ */ React.createElement(Box, { w: "full", "data-testid": testId, "data-role": "select-container", ref: selectContainerRef }, /* @__PURE__ */ React.createElement(
11333
11414
  Select$3,
11334
11415
  __spreadValues$m(__spreadProps$3(__spreadValues$m({
11335
11416
  isMulti,
@@ -11347,6 +11428,7 @@ const Select = forwardRef$1((_a, ref) => {
11347
11428
  customOption,
11348
11429
  customTag,
11349
11430
  icon,
11431
+ menuPlacement,
11350
11432
  components: customComponents,
11351
11433
  ref
11352
11434
  }), rest)
@@ -11381,7 +11463,7 @@ var __objRest$g = (source, exclude) => {
11381
11463
  }
11382
11464
  return target;
11383
11465
  };
11384
- function SelectField(_a) {
11466
+ const BaseSelectField = (_a, ref) => {
11385
11467
  var _b = _a, {
11386
11468
  name,
11387
11469
  label,
@@ -11415,7 +11497,8 @@ function SelectField(_a) {
11415
11497
  direction,
11416
11498
  isRequired,
11417
11499
  noLabelConnection: true,
11418
- validate
11500
+ validate,
11501
+ ref
11419
11502
  },
11420
11503
  ({ value, onChange }) => /* @__PURE__ */ React.createElement(HStack, { w: "full" }, /* @__PURE__ */ React.createElement(
11421
11504
  InputGroupWrapper,
@@ -11453,7 +11536,8 @@ function SelectField(_a) {
11453
11536
  }
11454
11537
  ))
11455
11538
  );
11456
- }
11539
+ };
11540
+ const SelectField = forwardRef$1(BaseSelectField);
11457
11541
 
11458
11542
  var __defProp$k = Object.defineProperty;
11459
11543
  var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
@@ -11534,7 +11618,7 @@ var __objRest$e = (source, exclude) => {
11534
11618
  }
11535
11619
  return target;
11536
11620
  };
11537
- const SwitchField = (_a) => {
11621
+ const SwitchField = forwardRef$1((_a, ref) => {
11538
11622
  var _b = _a, {
11539
11623
  name,
11540
11624
  label,
@@ -11542,7 +11626,8 @@ const SwitchField = (_a) => {
11542
11626
  validate,
11543
11627
  onChange: onChangeCallback = identity,
11544
11628
  direction = "row",
11545
- labelPosition = "right"
11629
+ labelPlacement = "right",
11630
+ labelSize = "md"
11546
11631
  } = _b, rest = __objRest$e(_b, [
11547
11632
  "name",
11548
11633
  "label",
@@ -11550,22 +11635,26 @@ const SwitchField = (_a) => {
11550
11635
  "validate",
11551
11636
  "onChange",
11552
11637
  "direction",
11553
- "labelPosition"
11638
+ "labelPlacement",
11639
+ "labelSize"
11554
11640
  ]);
11555
- return /* @__PURE__ */ React.createElement(Box, { w: label ? "full" : "fit-content" }, /* @__PURE__ */ React.createElement(
11641
+ return /* @__PURE__ */ React.createElement(Box, { w: label ? "full" : "fit-content", display: "inline-flex" }, /* @__PURE__ */ React.createElement(
11556
11642
  Field,
11557
11643
  {
11558
11644
  name,
11559
11645
  label: "",
11560
11646
  isRequired,
11561
11647
  direction,
11562
- validate
11648
+ validate,
11649
+ ref
11563
11650
  },
11564
11651
  ({ onChange, value }) => /* @__PURE__ */ React.createElement(
11565
11652
  Flex,
11566
11653
  {
11654
+ display: "inline-flex",
11655
+ alignItems: "center",
11567
11656
  gap: 2,
11568
- direction: labelPosition === "left" ? "row-reverse" : "row"
11657
+ direction: labelPlacement === "left" ? "row-reverse" : "row"
11569
11658
  },
11570
11659
  /* @__PURE__ */ React.createElement(
11571
11660
  Switch,
@@ -11579,10 +11668,10 @@ const SwitchField = (_a) => {
11579
11668
  "data-testid": "switch-field-test-id"
11580
11669
  }, rest)
11581
11670
  ),
11582
- label && /* @__PURE__ */ React.createElement(Label$1, { htmlFor: name }, label)
11671
+ /* @__PURE__ */ React.createElement(Label$1, { htmlFor: name, sx: { fontWeight: "normal" }, size: labelSize }, label)
11583
11672
  )
11584
11673
  ));
11585
- };
11674
+ });
11586
11675
 
11587
11676
  var __defProp$i = Object.defineProperty;
11588
11677
  var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
@@ -11729,7 +11818,7 @@ var __objRest$b = (source, exclude) => {
11729
11818
  }
11730
11819
  return target;
11731
11820
  };
11732
- const TextareaField = (_a) => {
11821
+ const TextareaField = forwardRef$1((_a, ref) => {
11733
11822
  var _b = _a, {
11734
11823
  name,
11735
11824
  label,
@@ -11752,7 +11841,8 @@ const TextareaField = (_a) => {
11752
11841
  label,
11753
11842
  isRequired,
11754
11843
  validate,
11755
- direction
11844
+ direction,
11845
+ ref
11756
11846
  },
11757
11847
  ({ onChange, value }) => /* @__PURE__ */ React.createElement(
11758
11848
  Textarea,
@@ -11767,7 +11857,7 @@ const TextareaField = (_a) => {
11767
11857
  }, rest)
11768
11858
  )
11769
11859
  );
11770
- };
11860
+ });
11771
11861
 
11772
11862
  const roundToPrecision = (value, numberOfDecimals) => parseFloat(value.toFixed(numberOfDecimals));
11773
11863
 
@@ -11824,7 +11914,9 @@ const FormattedNumberInput = (_a) => {
11824
11914
  value,
11825
11915
  numberOfDecimals = 2,
11826
11916
  max = Infinity,
11827
- min = -Infinity
11917
+ min = -Infinity,
11918
+ inputLeftElement,
11919
+ inputRightElement
11828
11920
  } = _b, rest = __objRest$a(_b, [
11829
11921
  "preset",
11830
11922
  "isPercentage",
@@ -11832,33 +11924,54 @@ const FormattedNumberInput = (_a) => {
11832
11924
  "value",
11833
11925
  "numberOfDecimals",
11834
11926
  "max",
11835
- "min"
11927
+ "min",
11928
+ "inputLeftElement",
11929
+ "inputRightElement"
11836
11930
  ]);
11837
11931
  const props = presetMap[preset];
11932
+ const [v, setV] = useState(value);
11933
+ const validateRange = () => {
11934
+ if (isNil(v))
11935
+ return;
11936
+ const vNum = typeof v === "string" ? parseFloat(v) : v;
11937
+ const factor = isPercentage ? 100 : 1;
11938
+ if (vNum * factor > max) {
11939
+ const newValue = roundToPrecision(max / factor, numberOfDecimals);
11940
+ setV(newValue);
11941
+ }
11942
+ if (vNum * factor < min) {
11943
+ const newValue = roundToPrecision(min / factor, numberOfDecimals);
11944
+ setV(newValue);
11945
+ }
11946
+ };
11838
11947
  const onValueChangeHandler = (values, sourceInfo) => {
11948
+ const newFloatValue = values.floatValue && isPercentage ? roundToPrecision(values.floatValue / 100, numberOfDecimals) : values.floatValue;
11949
+ setV(newFloatValue);
11839
11950
  onChange(
11840
11951
  __spreadProps$2(__spreadValues$e({}, values), {
11841
- floatValue: values.floatValue && isPercentage ? roundToPrecision(values.floatValue / 100, numberOfDecimals) : values.floatValue
11952
+ floatValue: newFloatValue
11842
11953
  }),
11843
11954
  sourceInfo
11844
11955
  );
11845
11956
  };
11846
11957
  return /* @__PURE__ */ React.createElement(
11847
- NumericFormat,
11848
- __spreadValues$e(__spreadValues$e({
11849
- allowLeadingZeros: true,
11850
- customInput: Input$1,
11851
- max: 100,
11852
- min: 0,
11853
- onValueChange: onValueChangeHandler,
11854
- decimalScale: numberOfDecimals,
11855
- value: isPercentage ? roundToPrecision(parseFloat(`${value != null ? value : 0}`) * 100, numberOfDecimals) : value,
11856
- suffix: isPercentage ? "%" : "",
11857
- isAllowed: (values) => {
11858
- const { floatValue } = values;
11859
- return floatValue ? floatValue < max && floatValue > min : false;
11860
- }
11861
- }, props), rest)
11958
+ InputGroupWrapper,
11959
+ {
11960
+ inputLeftElement,
11961
+ inputRightElement
11962
+ },
11963
+ /* @__PURE__ */ React.createElement(
11964
+ NumericFormat,
11965
+ __spreadValues$e(__spreadValues$e({
11966
+ allowLeadingZeros: true,
11967
+ customInput: Input$1,
11968
+ onBlur: validateRange,
11969
+ onValueChange: onValueChangeHandler,
11970
+ decimalScale: numberOfDecimals,
11971
+ value: isPercentage ? roundToPrecision(parseFloat(`${v != null ? v : 0}`) * 100, numberOfDecimals) : v,
11972
+ suffix: isPercentage ? "%" : ""
11973
+ }, props), rest)
11974
+ )
11862
11975
  );
11863
11976
  };
11864
11977
 
@@ -11890,7 +12003,7 @@ var __objRest$9 = (source, exclude) => {
11890
12003
  }
11891
12004
  return target;
11892
12005
  };
11893
- const FormattedNumberInputField = (_a) => {
12006
+ const FormattedNumberInputField = forwardRef$1((_a, ref) => {
11894
12007
  var _b = _a, {
11895
12008
  name,
11896
12009
  label,
@@ -11913,7 +12026,8 @@ const FormattedNumberInputField = (_a) => {
11913
12026
  label,
11914
12027
  isRequired,
11915
12028
  direction,
11916
- validate
12029
+ validate,
12030
+ ref
11917
12031
  },
11918
12032
  ({ onChange, value }) => /* @__PURE__ */ React.createElement(
11919
12033
  FormattedNumberInput,
@@ -11927,7 +12041,7 @@ const FormattedNumberInputField = (_a) => {
11927
12041
  }, rest)
11928
12042
  )
11929
12043
  );
11930
- };
12044
+ });
11931
12045
 
11932
12046
  var __defProp$c = Object.defineProperty;
11933
12047
  var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
@@ -12028,7 +12142,7 @@ var __objRest$7 = (source, exclude) => {
12028
12142
  }
12029
12143
  return target;
12030
12144
  };
12031
- const TextField = (_a) => {
12145
+ const TextField = forwardRef$1((_a, ref) => {
12032
12146
  var _b = _a, {
12033
12147
  name,
12034
12148
  label,
@@ -12057,7 +12171,8 @@ const TextField = (_a) => {
12057
12171
  label,
12058
12172
  isRequired,
12059
12173
  validate: isNil(validate) && isRequired ? { validate: (value) => !!value.trim() } : validate,
12060
- direction
12174
+ direction,
12175
+ ref
12061
12176
  },
12062
12177
  ({ onChange, value }) => /* @__PURE__ */ React.createElement(
12063
12178
  InputGroupWrapper,
@@ -12080,7 +12195,7 @@ const TextField = (_a) => {
12080
12195
  )
12081
12196
  )
12082
12197
  );
12083
- };
12198
+ });
12084
12199
 
12085
12200
  const toastIconMap = {
12086
12201
  success: CheckCircleSolid,