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

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
@@ -15259,13 +15259,17 @@ function CompoundFilterSelect({
15259
15259
  const { theme } = useTheme();
15260
15260
  const themeClass = theme === "dark" ? "dark" : "light";
15261
15261
  const [open, setOpen] = React40.useState(false);
15262
- const container = React40.useMemo(
15263
- () => {
15264
- var _a5;
15265
- return typeof document !== "undefined" ? (_a5 = document.querySelector(".lego-land")) != null ? _a5 : void 0 : void 0;
15266
- },
15267
- []
15262
+ const sentinelRef = React40.useRef(null);
15263
+ const [container, setContainer] = React40.useState(
15264
+ void 0
15268
15265
  );
15266
+ React40.useEffect(() => {
15267
+ var _a5, _b5;
15268
+ const el = (_a5 = sentinelRef.current) == null ? void 0 : _a5.closest(".lego-land");
15269
+ setContainer(
15270
+ el != null ? el : typeof document !== "undefined" ? (_b5 = document.querySelector(".lego-land")) != null ? _b5 : void 0 : void 0
15271
+ );
15272
+ }, []);
15269
15273
  const selectedOption = options.find((opt) => opt.value === value);
15270
15274
  const effectiveLeadingIcon = leadingIcon != null ? leadingIcon : selectedOption == null ? void 0 : selectedOption.icon;
15271
15275
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
@@ -15284,6 +15288,7 @@ function CompoundFilterSelect({
15284
15288
  ),
15285
15289
  ...props,
15286
15290
  children: [
15291
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { ref: sentinelRef, style: { display: "contents" }, "aria-hidden": "true" }),
15287
15292
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(DropdownMenuPrimitive4.Root, { open, onOpenChange: setOpen, children: [
15288
15293
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropdownMenuPrimitive4.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
15289
15294
  "button",
@@ -15332,12 +15337,17 @@ function CompoundFilterSelect({
15332
15337
  className: cn(
15333
15338
  "bg-token-white flex flex-col gap-1 p-1 rounded-[12px] shadow-sm min-w-[160px]",
15334
15339
  "relative z-50 font-sans outline-none",
15340
+ // Cap height + scroll: with many options (e.g. a country
15341
+ // code list) the menu would otherwise overflow the viewport
15342
+ // and be impossible to reach the bottom items.
15343
+ "max-h-[var(--radix-dropdown-menu-content-available-height,300px)] overflow-y-auto",
15335
15344
  "data-[state=open]:animate-in data-[state=closed]:animate-out",
15336
15345
  "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
15337
15346
  ),
15338
15347
  side: "bottom",
15339
15348
  align: "start",
15340
15349
  sideOffset: 6,
15350
+ collisionPadding: 8,
15341
15351
  children: options.map((opt) => {
15342
15352
  const isSelected = opt.value === value;
15343
15353
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
@@ -17298,15 +17308,27 @@ var Popover = React46.forwardRef(
17298
17308
  };
17299
17309
  const onScroll = (e) => {
17300
17310
  var _a6;
17301
- if ((_a6 = popoverRef.current) == null ? void 0 : _a6.contains(e.target)) return;
17311
+ const target = e.target;
17312
+ if ((_a6 = popoverRef.current) == null ? void 0 : _a6.contains(target)) return;
17313
+ if (target && typeof target.closest === "function" && target.closest(
17314
+ '[data-lego-popover][data-state="open"], [data-radix-popper-content-wrapper]'
17315
+ )) {
17316
+ return;
17317
+ }
17302
17318
  update();
17303
17319
  };
17304
17320
  update();
17305
17321
  window.addEventListener("resize", update);
17306
17322
  window.addEventListener("scroll", onScroll, true);
17323
+ let ro;
17324
+ if (typeof ResizeObserver !== "undefined") {
17325
+ ro = new ResizeObserver(() => update());
17326
+ ro.observe(p);
17327
+ }
17307
17328
  return () => {
17308
17329
  window.removeEventListener("resize", update);
17309
17330
  window.removeEventListener("scroll", onScroll, true);
17331
+ ro == null ? void 0 : ro.disconnect();
17310
17332
  };
17311
17333
  }, [open, side, align, sideOffset]);
17312
17334
  React46.useEffect(() => {
@@ -17833,6 +17855,10 @@ var TimeRangeInput = React49.forwardRef(
17833
17855
  const parsed = React49.useMemo(() => parse24To12(value), [value]);
17834
17856
  const [hour, setHour] = React49.useState(parsed.hour);
17835
17857
  const [minute, setMinute] = React49.useState(parsed.minute);
17858
+ const hourValueRef = React49.useRef(hour);
17859
+ const minuteValueRef = React49.useRef(minute);
17860
+ hourValueRef.current = hour;
17861
+ minuteValueRef.current = minute;
17836
17862
  React49.useEffect(() => {
17837
17863
  setHour(parsed.hour);
17838
17864
  setMinute(parsed.minute);
@@ -17842,8 +17868,8 @@ var TimeRangeInput = React49.forwardRef(
17842
17868
  const commit = (next) => {
17843
17869
  var _a5, _b5, _c;
17844
17870
  const merged = {
17845
- hour: (_a5 = next.hour) != null ? _a5 : hour,
17846
- minute: (_b5 = next.minute) != null ? _b5 : minute,
17871
+ hour: (_a5 = next.hour) != null ? _a5 : hourValueRef.current,
17872
+ minute: (_b5 = next.minute) != null ? _b5 : minuteValueRef.current,
17847
17873
  period: (_c = next.period) != null ? _c : parsed.period
17848
17874
  };
17849
17875
  onChange(format12To24(merged));
@@ -17852,26 +17878,32 @@ var TimeRangeInput = React49.forwardRef(
17852
17878
  var _a5;
17853
17879
  const digits = raw.replace(/\D/g, "").slice(0, 2);
17854
17880
  setHour(digits);
17881
+ hourValueRef.current = digits;
17855
17882
  const n = Number.parseInt(digits) || 0;
17856
17883
  if (digits.length === 2 && n >= 1 && n <= 12) {
17857
17884
  (_a5 = minuteRef.current) == null ? void 0 : _a5.focus();
17858
17885
  }
17859
17886
  };
17860
17887
  const handleHourBlur = () => {
17861
- const n = Number.parseInt(hour);
17862
- const clamped = !hour || n < 1 || n > 12 ? "12" : String(n);
17888
+ const current = hourValueRef.current;
17889
+ const n = Number.parseInt(current);
17890
+ const clamped = !current || n < 1 || n > 12 ? "12" : String(n);
17863
17891
  setHour(clamped);
17864
- commit({ hour: clamped, minute: minute.padStart(2, "0") });
17892
+ hourValueRef.current = clamped;
17893
+ commit({ hour: clamped, minute: minuteValueRef.current.padStart(2, "0") });
17865
17894
  };
17866
17895
  const handleMinuteChange = (raw) => {
17867
17896
  const digits = raw.replace(/\D/g, "").slice(0, 2);
17868
17897
  setMinute(digits);
17898
+ minuteValueRef.current = digits;
17869
17899
  };
17870
17900
  const handleMinuteBlur = () => {
17871
- const n = Number.parseInt(minute) || 0;
17901
+ const current = minuteValueRef.current;
17902
+ const n = Number.parseInt(current) || 0;
17872
17903
  const clamped = n > 59 ? "00" : String(n).padStart(2, "0");
17873
17904
  setMinute(clamped);
17874
- commit({ hour, minute: clamped });
17905
+ minuteValueRef.current = clamped;
17906
+ commit({ hour: hourValueRef.current, minute: clamped });
17875
17907
  };
17876
17908
  const handlePeriodChange = (next) => {
17877
17909
  if (next === "AM" || next === "PM") commit({ period: next });
package/dist/index.mjs CHANGED
@@ -15154,13 +15154,17 @@ function CompoundFilterSelect({
15154
15154
  const { theme } = useTheme();
15155
15155
  const themeClass = theme === "dark" ? "dark" : "light";
15156
15156
  const [open, setOpen] = React40.useState(false);
15157
- const container = React40.useMemo(
15158
- () => {
15159
- var _a5;
15160
- return typeof document !== "undefined" ? (_a5 = document.querySelector(".lego-land")) != null ? _a5 : void 0 : void 0;
15161
- },
15162
- []
15157
+ const sentinelRef = React40.useRef(null);
15158
+ const [container, setContainer] = React40.useState(
15159
+ void 0
15163
15160
  );
15161
+ React40.useEffect(() => {
15162
+ var _a5, _b5;
15163
+ const el = (_a5 = sentinelRef.current) == null ? void 0 : _a5.closest(".lego-land");
15164
+ setContainer(
15165
+ el != null ? el : typeof document !== "undefined" ? (_b5 = document.querySelector(".lego-land")) != null ? _b5 : void 0 : void 0
15166
+ );
15167
+ }, []);
15164
15168
  const selectedOption = options.find((opt) => opt.value === value);
15165
15169
  const effectiveLeadingIcon = leadingIcon != null ? leadingIcon : selectedOption == null ? void 0 : selectedOption.icon;
15166
15170
  return /* @__PURE__ */ jsxs27(
@@ -15179,6 +15183,7 @@ function CompoundFilterSelect({
15179
15183
  ),
15180
15184
  ...props,
15181
15185
  children: [
15186
+ /* @__PURE__ */ jsx36("span", { ref: sentinelRef, style: { display: "contents" }, "aria-hidden": "true" }),
15182
15187
  /* @__PURE__ */ jsxs27(DropdownMenuPrimitive4.Root, { open, onOpenChange: setOpen, children: [
15183
15188
  /* @__PURE__ */ jsx36(DropdownMenuPrimitive4.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs27(
15184
15189
  "button",
@@ -15227,12 +15232,17 @@ function CompoundFilterSelect({
15227
15232
  className: cn(
15228
15233
  "bg-token-white flex flex-col gap-1 p-1 rounded-[12px] shadow-sm min-w-[160px]",
15229
15234
  "relative z-50 font-sans outline-none",
15235
+ // Cap height + scroll: with many options (e.g. a country
15236
+ // code list) the menu would otherwise overflow the viewport
15237
+ // and be impossible to reach the bottom items.
15238
+ "max-h-[var(--radix-dropdown-menu-content-available-height,300px)] overflow-y-auto",
15230
15239
  "data-[state=open]:animate-in data-[state=closed]:animate-out",
15231
15240
  "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
15232
15241
  ),
15233
15242
  side: "bottom",
15234
15243
  align: "start",
15235
15244
  sideOffset: 6,
15245
+ collisionPadding: 8,
15236
15246
  children: options.map((opt) => {
15237
15247
  const isSelected = opt.value === value;
15238
15248
  return /* @__PURE__ */ jsxs27(
@@ -16167,7 +16177,7 @@ var MONACO_OPTIONS_DIALOG = {
16167
16177
 
16168
16178
  // src/json-editor/useJsonEditor.tsx
16169
16179
  var import_ajv = __toESM(require_ajv());
16170
- import { useCallback as useCallback12, useEffect as useEffect13, useId, useRef as useRef9, useState as useState19 } from "react";
16180
+ import { useCallback as useCallback12, useEffect as useEffect14, useId, useRef as useRef10, useState as useState19 } from "react";
16171
16181
 
16172
16182
  // src/json-editor/useJsonEditorErrorStore.ts
16173
16183
  var state = {
@@ -16223,16 +16233,16 @@ function useJsonEditor({
16223
16233
  const editorKey = useId();
16224
16234
  const registerError = useJsonEditorErrorStore((s) => s.registerError);
16225
16235
  const clearError = useJsonEditorErrorStore((s) => s.clearError);
16226
- const editorRef = useRef9(null);
16227
- const monacoRef = useRef9(null);
16228
- const expandedEditorRef = useRef9(null);
16236
+ const editorRef = useRef10(null);
16237
+ const monacoRef = useRef10(null);
16238
+ const expandedEditorRef = useRef10(null);
16229
16239
  const [errors, setErrors] = useState19([]);
16230
16240
  const [copied, setCopied] = useState19(false);
16231
16241
  const [monacoReady, setMonacoReady] = useState19(false);
16232
16242
  const resolvedNodeId = nodeId != null ? nodeId : `_unbound_${editorKey}`;
16233
- const resolvedNodeIdRef = useRef9(resolvedNodeId);
16243
+ const resolvedNodeIdRef = useRef10(resolvedNodeId);
16234
16244
  resolvedNodeIdRef.current = resolvedNodeId;
16235
- useEffect13(
16245
+ useEffect14(
16236
16246
  () => () => {
16237
16247
  clearError(resolvedNodeIdRef.current, editorKey);
16238
16248
  },
@@ -16357,7 +16367,7 @@ function useJsonEditor({
16357
16367
  },
16358
16368
  [normalizeInput, onChange, validateJson]
16359
16369
  );
16360
- useEffect13(() => {
16370
+ useEffect14(() => {
16361
16371
  const normalized = normalizeInput(value);
16362
16372
  if (normalized !== value) onChange(normalized);
16363
16373
  validateJson(normalized);
@@ -17193,15 +17203,27 @@ var Popover = React46.forwardRef(
17193
17203
  };
17194
17204
  const onScroll = (e) => {
17195
17205
  var _a6;
17196
- if ((_a6 = popoverRef.current) == null ? void 0 : _a6.contains(e.target)) return;
17206
+ const target = e.target;
17207
+ if ((_a6 = popoverRef.current) == null ? void 0 : _a6.contains(target)) return;
17208
+ if (target && typeof target.closest === "function" && target.closest(
17209
+ '[data-lego-popover][data-state="open"], [data-radix-popper-content-wrapper]'
17210
+ )) {
17211
+ return;
17212
+ }
17197
17213
  update();
17198
17214
  };
17199
17215
  update();
17200
17216
  window.addEventListener("resize", update);
17201
17217
  window.addEventListener("scroll", onScroll, true);
17218
+ let ro;
17219
+ if (typeof ResizeObserver !== "undefined") {
17220
+ ro = new ResizeObserver(() => update());
17221
+ ro.observe(p);
17222
+ }
17202
17223
  return () => {
17203
17224
  window.removeEventListener("resize", update);
17204
17225
  window.removeEventListener("scroll", onScroll, true);
17226
+ ro == null ? void 0 : ro.disconnect();
17205
17227
  };
17206
17228
  }, [open, side, align, sideOffset]);
17207
17229
  React46.useEffect(() => {
@@ -17728,6 +17750,10 @@ var TimeRangeInput = React49.forwardRef(
17728
17750
  const parsed = React49.useMemo(() => parse24To12(value), [value]);
17729
17751
  const [hour, setHour] = React49.useState(parsed.hour);
17730
17752
  const [minute, setMinute] = React49.useState(parsed.minute);
17753
+ const hourValueRef = React49.useRef(hour);
17754
+ const minuteValueRef = React49.useRef(minute);
17755
+ hourValueRef.current = hour;
17756
+ minuteValueRef.current = minute;
17731
17757
  React49.useEffect(() => {
17732
17758
  setHour(parsed.hour);
17733
17759
  setMinute(parsed.minute);
@@ -17737,8 +17763,8 @@ var TimeRangeInput = React49.forwardRef(
17737
17763
  const commit = (next) => {
17738
17764
  var _a5, _b5, _c;
17739
17765
  const merged = {
17740
- hour: (_a5 = next.hour) != null ? _a5 : hour,
17741
- minute: (_b5 = next.minute) != null ? _b5 : minute,
17766
+ hour: (_a5 = next.hour) != null ? _a5 : hourValueRef.current,
17767
+ minute: (_b5 = next.minute) != null ? _b5 : minuteValueRef.current,
17742
17768
  period: (_c = next.period) != null ? _c : parsed.period
17743
17769
  };
17744
17770
  onChange(format12To24(merged));
@@ -17747,26 +17773,32 @@ var TimeRangeInput = React49.forwardRef(
17747
17773
  var _a5;
17748
17774
  const digits = raw.replace(/\D/g, "").slice(0, 2);
17749
17775
  setHour(digits);
17776
+ hourValueRef.current = digits;
17750
17777
  const n = Number.parseInt(digits) || 0;
17751
17778
  if (digits.length === 2 && n >= 1 && n <= 12) {
17752
17779
  (_a5 = minuteRef.current) == null ? void 0 : _a5.focus();
17753
17780
  }
17754
17781
  };
17755
17782
  const handleHourBlur = () => {
17756
- const n = Number.parseInt(hour);
17757
- const clamped = !hour || n < 1 || n > 12 ? "12" : String(n);
17783
+ const current = hourValueRef.current;
17784
+ const n = Number.parseInt(current);
17785
+ const clamped = !current || n < 1 || n > 12 ? "12" : String(n);
17758
17786
  setHour(clamped);
17759
- commit({ hour: clamped, minute: minute.padStart(2, "0") });
17787
+ hourValueRef.current = clamped;
17788
+ commit({ hour: clamped, minute: minuteValueRef.current.padStart(2, "0") });
17760
17789
  };
17761
17790
  const handleMinuteChange = (raw) => {
17762
17791
  const digits = raw.replace(/\D/g, "").slice(0, 2);
17763
17792
  setMinute(digits);
17793
+ minuteValueRef.current = digits;
17764
17794
  };
17765
17795
  const handleMinuteBlur = () => {
17766
- const n = Number.parseInt(minute) || 0;
17796
+ const current = minuteValueRef.current;
17797
+ const n = Number.parseInt(current) || 0;
17767
17798
  const clamped = n > 59 ? "00" : String(n).padStart(2, "0");
17768
17799
  setMinute(clamped);
17769
- commit({ hour, minute: clamped });
17800
+ minuteValueRef.current = clamped;
17801
+ commit({ hour: hourValueRef.current, minute: clamped });
17770
17802
  };
17771
17803
  const handlePeriodChange = (next) => {
17772
17804
  if (next === "AM" || next === "PM") commit({ period: next });
package/dist/styles.css CHANGED
@@ -646,6 +646,9 @@
646
646
  .lego-land .max-h-\[507px\] {
647
647
  max-height: 507px;
648
648
  }
649
+ .lego-land .max-h-\[var\(--radix-dropdown-menu-content-available-height\,300px\)\] {
650
+ max-height: var(--radix-dropdown-menu-content-available-height,300px);
651
+ }
649
652
  .lego-land .min-h-0 {
650
653
  min-height: calc(var(--spacing) * 0);
651
654
  }
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.139",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",