@nurix/ui-component-library 1.1.7-stage.137 → 1.1.7-stage.138

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.js CHANGED
@@ -17298,15 +17298,27 @@ var Popover = React46.forwardRef(
17298
17298
  };
17299
17299
  const onScroll = (e) => {
17300
17300
  var _a6;
17301
- if ((_a6 = popoverRef.current) == null ? void 0 : _a6.contains(e.target)) return;
17301
+ const target = e.target;
17302
+ if ((_a6 = popoverRef.current) == null ? void 0 : _a6.contains(target)) return;
17303
+ if (target && typeof target.closest === "function" && target.closest(
17304
+ '[data-lego-popover][data-state="open"], [data-radix-popper-content-wrapper]'
17305
+ )) {
17306
+ return;
17307
+ }
17302
17308
  update();
17303
17309
  };
17304
17310
  update();
17305
17311
  window.addEventListener("resize", update);
17306
17312
  window.addEventListener("scroll", onScroll, true);
17313
+ let ro;
17314
+ if (typeof ResizeObserver !== "undefined") {
17315
+ ro = new ResizeObserver(() => update());
17316
+ ro.observe(p);
17317
+ }
17307
17318
  return () => {
17308
17319
  window.removeEventListener("resize", update);
17309
17320
  window.removeEventListener("scroll", onScroll, true);
17321
+ ro == null ? void 0 : ro.disconnect();
17310
17322
  };
17311
17323
  }, [open, side, align, sideOffset]);
17312
17324
  React46.useEffect(() => {
@@ -17833,6 +17845,10 @@ var TimeRangeInput = React49.forwardRef(
17833
17845
  const parsed = React49.useMemo(() => parse24To12(value), [value]);
17834
17846
  const [hour, setHour] = React49.useState(parsed.hour);
17835
17847
  const [minute, setMinute] = React49.useState(parsed.minute);
17848
+ const hourValueRef = React49.useRef(hour);
17849
+ const minuteValueRef = React49.useRef(minute);
17850
+ hourValueRef.current = hour;
17851
+ minuteValueRef.current = minute;
17836
17852
  React49.useEffect(() => {
17837
17853
  setHour(parsed.hour);
17838
17854
  setMinute(parsed.minute);
@@ -17842,8 +17858,8 @@ var TimeRangeInput = React49.forwardRef(
17842
17858
  const commit = (next) => {
17843
17859
  var _a5, _b5, _c;
17844
17860
  const merged = {
17845
- hour: (_a5 = next.hour) != null ? _a5 : hour,
17846
- minute: (_b5 = next.minute) != null ? _b5 : minute,
17861
+ hour: (_a5 = next.hour) != null ? _a5 : hourValueRef.current,
17862
+ minute: (_b5 = next.minute) != null ? _b5 : minuteValueRef.current,
17847
17863
  period: (_c = next.period) != null ? _c : parsed.period
17848
17864
  };
17849
17865
  onChange(format12To24(merged));
@@ -17852,26 +17868,32 @@ var TimeRangeInput = React49.forwardRef(
17852
17868
  var _a5;
17853
17869
  const digits = raw.replace(/\D/g, "").slice(0, 2);
17854
17870
  setHour(digits);
17871
+ hourValueRef.current = digits;
17855
17872
  const n = Number.parseInt(digits) || 0;
17856
17873
  if (digits.length === 2 && n >= 1 && n <= 12) {
17857
17874
  (_a5 = minuteRef.current) == null ? void 0 : _a5.focus();
17858
17875
  }
17859
17876
  };
17860
17877
  const handleHourBlur = () => {
17861
- const n = Number.parseInt(hour);
17862
- const clamped = !hour || n < 1 || n > 12 ? "12" : String(n);
17878
+ const current = hourValueRef.current;
17879
+ const n = Number.parseInt(current);
17880
+ const clamped = !current || n < 1 || n > 12 ? "12" : String(n);
17863
17881
  setHour(clamped);
17864
- commit({ hour: clamped, minute: minute.padStart(2, "0") });
17882
+ hourValueRef.current = clamped;
17883
+ commit({ hour: clamped, minute: minuteValueRef.current.padStart(2, "0") });
17865
17884
  };
17866
17885
  const handleMinuteChange = (raw) => {
17867
17886
  const digits = raw.replace(/\D/g, "").slice(0, 2);
17868
17887
  setMinute(digits);
17888
+ minuteValueRef.current = digits;
17869
17889
  };
17870
17890
  const handleMinuteBlur = () => {
17871
- const n = Number.parseInt(minute) || 0;
17891
+ const current = minuteValueRef.current;
17892
+ const n = Number.parseInt(current) || 0;
17872
17893
  const clamped = n > 59 ? "00" : String(n).padStart(2, "0");
17873
17894
  setMinute(clamped);
17874
- commit({ hour, minute: clamped });
17895
+ minuteValueRef.current = clamped;
17896
+ commit({ hour: hourValueRef.current, minute: clamped });
17875
17897
  };
17876
17898
  const handlePeriodChange = (next) => {
17877
17899
  if (next === "AM" || next === "PM") commit({ period: next });
package/dist/index.mjs CHANGED
@@ -17193,15 +17193,27 @@ var Popover = React46.forwardRef(
17193
17193
  };
17194
17194
  const onScroll = (e) => {
17195
17195
  var _a6;
17196
- if ((_a6 = popoverRef.current) == null ? void 0 : _a6.contains(e.target)) return;
17196
+ const target = e.target;
17197
+ if ((_a6 = popoverRef.current) == null ? void 0 : _a6.contains(target)) return;
17198
+ if (target && typeof target.closest === "function" && target.closest(
17199
+ '[data-lego-popover][data-state="open"], [data-radix-popper-content-wrapper]'
17200
+ )) {
17201
+ return;
17202
+ }
17197
17203
  update();
17198
17204
  };
17199
17205
  update();
17200
17206
  window.addEventListener("resize", update);
17201
17207
  window.addEventListener("scroll", onScroll, true);
17208
+ let ro;
17209
+ if (typeof ResizeObserver !== "undefined") {
17210
+ ro = new ResizeObserver(() => update());
17211
+ ro.observe(p);
17212
+ }
17202
17213
  return () => {
17203
17214
  window.removeEventListener("resize", update);
17204
17215
  window.removeEventListener("scroll", onScroll, true);
17216
+ ro == null ? void 0 : ro.disconnect();
17205
17217
  };
17206
17218
  }, [open, side, align, sideOffset]);
17207
17219
  React46.useEffect(() => {
@@ -17728,6 +17740,10 @@ var TimeRangeInput = React49.forwardRef(
17728
17740
  const parsed = React49.useMemo(() => parse24To12(value), [value]);
17729
17741
  const [hour, setHour] = React49.useState(parsed.hour);
17730
17742
  const [minute, setMinute] = React49.useState(parsed.minute);
17743
+ const hourValueRef = React49.useRef(hour);
17744
+ const minuteValueRef = React49.useRef(minute);
17745
+ hourValueRef.current = hour;
17746
+ minuteValueRef.current = minute;
17731
17747
  React49.useEffect(() => {
17732
17748
  setHour(parsed.hour);
17733
17749
  setMinute(parsed.minute);
@@ -17737,8 +17753,8 @@ var TimeRangeInput = React49.forwardRef(
17737
17753
  const commit = (next) => {
17738
17754
  var _a5, _b5, _c;
17739
17755
  const merged = {
17740
- hour: (_a5 = next.hour) != null ? _a5 : hour,
17741
- minute: (_b5 = next.minute) != null ? _b5 : minute,
17756
+ hour: (_a5 = next.hour) != null ? _a5 : hourValueRef.current,
17757
+ minute: (_b5 = next.minute) != null ? _b5 : minuteValueRef.current,
17742
17758
  period: (_c = next.period) != null ? _c : parsed.period
17743
17759
  };
17744
17760
  onChange(format12To24(merged));
@@ -17747,26 +17763,32 @@ var TimeRangeInput = React49.forwardRef(
17747
17763
  var _a5;
17748
17764
  const digits = raw.replace(/\D/g, "").slice(0, 2);
17749
17765
  setHour(digits);
17766
+ hourValueRef.current = digits;
17750
17767
  const n = Number.parseInt(digits) || 0;
17751
17768
  if (digits.length === 2 && n >= 1 && n <= 12) {
17752
17769
  (_a5 = minuteRef.current) == null ? void 0 : _a5.focus();
17753
17770
  }
17754
17771
  };
17755
17772
  const handleHourBlur = () => {
17756
- const n = Number.parseInt(hour);
17757
- const clamped = !hour || n < 1 || n > 12 ? "12" : String(n);
17773
+ const current = hourValueRef.current;
17774
+ const n = Number.parseInt(current);
17775
+ const clamped = !current || n < 1 || n > 12 ? "12" : String(n);
17758
17776
  setHour(clamped);
17759
- commit({ hour: clamped, minute: minute.padStart(2, "0") });
17777
+ hourValueRef.current = clamped;
17778
+ commit({ hour: clamped, minute: minuteValueRef.current.padStart(2, "0") });
17760
17779
  };
17761
17780
  const handleMinuteChange = (raw) => {
17762
17781
  const digits = raw.replace(/\D/g, "").slice(0, 2);
17763
17782
  setMinute(digits);
17783
+ minuteValueRef.current = digits;
17764
17784
  };
17765
17785
  const handleMinuteBlur = () => {
17766
- const n = Number.parseInt(minute) || 0;
17786
+ const current = minuteValueRef.current;
17787
+ const n = Number.parseInt(current) || 0;
17767
17788
  const clamped = n > 59 ? "00" : String(n).padStart(2, "0");
17768
17789
  setMinute(clamped);
17769
- commit({ hour, minute: clamped });
17790
+ minuteValueRef.current = clamped;
17791
+ commit({ hour: hourValueRef.current, minute: clamped });
17770
17792
  };
17771
17793
  const handlePeriodChange = (next) => {
17772
17794
  if (next === "AM" || next === "PM") commit({ period: next });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nurix/ui-component-library",
3
- "version": "1.1.7-stage.137",
3
+ "version": "1.1.7-stage.138",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",