@northlight/ui 2.24.2 → 2.24.4

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.
@@ -2392,7 +2392,7 @@
2392
2392
  }
2393
2393
  return a;
2394
2394
  };
2395
- const Popover = (props) => /* @__PURE__ */ React.createElement(react.Popover, __spreadValues$1P({ isLazy: true }, props));
2395
+ const Popover$1 = (props) => /* @__PURE__ */ React.createElement(react.Popover, __spreadValues$1P({ isLazy: true }, props));
2396
2396
 
2397
2397
  const ColorsExpandButton = ({
2398
2398
  onClick,
@@ -2528,7 +2528,7 @@
2528
2528
  onChange(color);
2529
2529
  };
2530
2530
  return /* @__PURE__ */ React.createElement(react.Box, { "data-testid": "color-picker-test-id" }, /* @__PURE__ */ React.createElement(
2531
- Popover,
2531
+ Popover$1,
2532
2532
  __spreadValues$1O({
2533
2533
  isOpen,
2534
2534
  onClose,
@@ -5695,6 +5695,15 @@
5695
5695
  }
5696
5696
  };
5697
5697
 
5698
+ const Popover = {
5699
+ parts: ["popper"],
5700
+ baseStyle: {
5701
+ popper: {
5702
+ zIndex: "popover"
5703
+ }
5704
+ }
5705
+ };
5706
+
5698
5707
  var components = /*#__PURE__*/Object.freeze({
5699
5708
  __proto__: null,
5700
5709
  Alert: Alert,
@@ -5735,6 +5744,7 @@
5735
5744
  P: P,
5736
5745
  PaneDivider: PaneDivider$1,
5737
5746
  PinInput: PinInput$1,
5747
+ Popover: Popover,
5738
5748
  Radio: Radio$1,
5739
5749
  Select: Select$1,
5740
5750
  Small: Small,
@@ -6653,7 +6663,7 @@
6653
6663
  );
6654
6664
  const togglePopup = () => state.setOpen(!state.isOpen);
6655
6665
  return /* @__PURE__ */ React.createElement(
6656
- Popover,
6666
+ Popover$1,
6657
6667
  {
6658
6668
  isOpen: state.isOpen,
6659
6669
  onClose: () => state.setOpen(false),
@@ -7206,7 +7216,7 @@
7206
7216
  state.setOpen(false);
7207
7217
  };
7208
7218
  return /* @__PURE__ */ React.createElement(
7209
- Popover,
7219
+ Popover$1,
7210
7220
  {
7211
7221
  isOpen: state.isOpen,
7212
7222
  onClose: handleClose,
@@ -7239,7 +7249,7 @@
7239
7249
  icon: /* @__PURE__ */ React.createElement(Icon$1, { as: icons.XCloseSolid })
7240
7250
  }
7241
7251
  ))),
7242
- state.isOpen && /* @__PURE__ */ React.createElement(react.PopoverContent, __spreadProps$d(__spreadValues$1o({}, dialogProps), { ref, w: "max-content" }), /* @__PURE__ */ React.createElement(focus.FocusScope, { contain: true, restoreFocus: true }, /* @__PURE__ */ React.createElement(
7252
+ /* @__PURE__ */ React.createElement(react.Portal, null, state.isOpen && /* @__PURE__ */ React.createElement(react.PopoverContent, __spreadProps$d(__spreadValues$1o({}, dialogProps), { ref, w: "max-content" }), /* @__PURE__ */ React.createElement(focus.FocusScope, { contain: true, restoreFocus: true }, /* @__PURE__ */ React.createElement(
7243
7253
  RangeCalendar,
7244
7254
  __spreadProps$d(__spreadValues$1o({}, calendarProps), {
7245
7255
  resetDate,
@@ -7248,7 +7258,7 @@
7248
7258
  fiscalStartDay: fiscalStartDay || 0,
7249
7259
  isClearable
7250
7260
  })
7251
- )))
7261
+ ))))
7252
7262
  );
7253
7263
  };
7254
7264
 
@@ -13811,18 +13821,35 @@
13811
13821
  onOptionChange,
13812
13822
  width = "100%",
13813
13823
  variant = "outline",
13814
- initialValue = ""
13824
+ initialValue
13815
13825
  }) => {
13816
13826
  const initialSelectedOption = React.useMemo(
13817
- () => standardOptions.find(
13818
- (option) => option.value === initialValue
13819
- ) || null,
13827
+ () => {
13828
+ var _a;
13829
+ if (ramda.isNil(initialValue)) {
13830
+ return null;
13831
+ }
13832
+ return (_a = standardOptions.find((option) => option.value === initialValue)) != null ? _a : null;
13833
+ },
13820
13834
  []
13821
13835
  );
13822
13836
  const [selectedOption, setSelectedOption] = React.useState(initialSelectedOption);
13823
13837
  const [newOptionText, setNewOptionText] = React.useState("");
13824
13838
  const [newOptionPlaceholder, setNewOptionPlaceholder] = React.useState(initialPlaceholder);
13825
13839
  const [createdOptions, setCreatedOptions] = React.useState([]);
13840
+ function isCreationOption(option) {
13841
+ return option && typeof option.isCreation === "boolean";
13842
+ }
13843
+ const ref = React.useRef(null);
13844
+ react.useOutsideClick({
13845
+ ref,
13846
+ handler: () => {
13847
+ if (isCreationOption(selectedOption)) {
13848
+ setSelectedOption(initialSelectedOption);
13849
+ setNewOptionPlaceholder(initialPlaceholder);
13850
+ }
13851
+ }
13852
+ });
13826
13853
  const handleInputChange = (newValue) => {
13827
13854
  setNewOptionText(newValue);
13828
13855
  };
@@ -13838,9 +13865,6 @@
13838
13865
  setNewOptionText("");
13839
13866
  setNewOptionPlaceholder(initialPlaceholder);
13840
13867
  };
13841
- function isCreationOption(option) {
13842
- return option && typeof option.isCreation === "string";
13843
- }
13844
13868
  const handleChange = (newValue, _actionMeta) => {
13845
13869
  const option = newValue;
13846
13870
  if (option === null) {
@@ -13848,11 +13872,10 @@
13848
13872
  }
13849
13873
  if (isCreationOption(option)) {
13850
13874
  setNewOptionPlaceholder(addOptionPlaceholder);
13851
- setSelectedOption(null);
13852
13875
  } else {
13853
13876
  setNewOptionPlaceholder(initialPlaceholder);
13854
- setSelectedOption(option);
13855
13877
  }
13878
+ setSelectedOption(option);
13856
13879
  onOptionChange(option);
13857
13880
  };
13858
13881
  const handleKeyDown = (event) => {
@@ -13864,11 +13887,11 @@
13864
13887
  const combinedOptions = [...standardOptions, ...createdOptions];
13865
13888
  const customOptions = [
13866
13889
  __spreadProps(__spreadValues({}, creationOption), {
13867
- icon: /* @__PURE__ */ React.createElement(Icon$1, { as: icons.PlusSolid, color: "brand" })
13890
+ icon: /* @__PURE__ */ React.createElement(react.Icon, { as: icons.PlusSolid, color: "brand" })
13868
13891
  }),
13869
13892
  ...combinedOptions
13870
13893
  ];
13871
- return /* @__PURE__ */ React.createElement(
13894
+ return /* @__PURE__ */ React.createElement(react.Box, { ref }, /* @__PURE__ */ React.createElement(
13872
13895
  chakraReactSelect.CreatableSelect,
13873
13896
  {
13874
13897
  chakraStyles: __spreadProps(__spreadValues({}, customSelectStyles), {
@@ -13892,7 +13915,7 @@
13892
13915
  useBasicStyles: true,
13893
13916
  variant
13894
13917
  }
13895
- );
13918
+ ));
13896
13919
  };
13897
13920
 
13898
13921
  Object.defineProperty(exports, 'AbsoluteCenter', {
@@ -14680,7 +14703,7 @@
14680
14703
  exports.PaneDivider = PaneDivider;
14681
14704
  exports.PaneItem = PaneItem;
14682
14705
  exports.PinInput = PinInput;
14683
- exports.Popover = Popover;
14706
+ exports.Popover = Popover$1;
14684
14707
  exports.ProgressBar = ProgressBar;
14685
14708
  exports.Radio = Radio;
14686
14709
  exports.RadioGroup = RadioGroup;