@eqtylab/equality 5.2.0 → 5.3.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,63 @@
2
2
 
3
3
  Notable changes to Equality are recorded here, following [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
4
4
 
5
+ ## 5.3.0 - 2026-11-02
6
+
7
+ ### Added
8
+
9
+ - `NavListExpandable`, `NavListExpandableTrigger` and `NavListExpandableContent`: a nav group the
10
+ user opens and closes with its header row. A closed group keeps its links in the page, hidden,
11
+ so they are in server-rendered HTML. Its arrow points down when closed and up when open, and a
12
+ closed group holding the current page lights its header row. A top-level group's header leads
13
+ in primary text, and a link beside it takes the same colour; its rows indent their text. A
14
+ group inside a group reads as a row, and its rows are inset behind a tree line, highlight
15
+ included. The header takes `prefix` and `suffix` like a row, so a status badge sits after its
16
+ label and screen readers read it out. A folder opens itself, and every folder around
17
+ it, when the current page moves inside, such as after a link that changes the page without a
18
+ reload. A reader can still close it; it opens again at their next page inside it. Inside
19
+ `NavDrill`, give a group a `value`, unique within its level, so it stays as the reader left it
20
+ after they drill away and come back. With JavaScript off, every group shows open without its
21
+ arrow, and its header leaves `aria-expanded` out until it loads, so it never reads as collapsed
22
+ over visible links. Browsers from before 2023 keep closed groups closed.
23
+ - `--eq-nav-motion-duration`, `--eq-nav-motion-ease` and `--eq-nav-motion-nudge`: the nav's motion,
24
+ named once. `NavDrill` reads them, and a folder group opens with the same motion: its rows nudge
25
+ 12px down as they fade in, and on the way out are gone within the first third.
26
+ - `--eq-switcher-name-fade`: the fade on `NavSwitcher`'s name, from primary to secondary text, as
27
+ before. It is now a variable, so a site can set its own.
28
+ - `--eq-list-item-muted-color`: the colour of a row's quiet marks, tertiary text. The drill ›, a
29
+ group's arrow, the back row's ‹, `NavSwitcher`'s ↕ and the new-tab ↗ all read it, so a site
30
+ sets them in one place.
31
+ - `NavListItem` marks a link with `target="_blank"`, set on it or on its `asChild` link: a muted ↗
32
+ after the label, "(opens in a new tab)" for screen readers, and `rel="noopener noreferrer"`
33
+ unless you pass your own. Remove any ↗ or "(opens in a new tab)" you put in `suffix`.
34
+
35
+ ### Changed
36
+
37
+ - Nav spacing comes from one gap. Items in `NavPanel`, `NavList` and a `NavDrill` level sit
38
+ `--eq-list-gap` (2px) apart, and a group label carries the group gap above it as its own top
39
+ padding, so it sits 12px below whatever comes before it. A string `header` in `NavPanel` is now
40
+ 32px tall, like the switcher, so its text and the rows below sit 6px lower. Anything else an app
41
+ puts straight into the panel or list, such as a search field, gets the 2px gap.
42
+ - Nav chevrons, the drill › and a group's arrow, are muted, as quiet as a switcher's. Every muted
43
+ mark takes its row's colour on hover and on the current row, the back row's ‹ and the
44
+ switcher's ↕ included. Studio's › gets quieter.
45
+ - A nav row's hover fill shows only with a mouse or trackpad, so a row tapped on a touch screen
46
+ no longer stays lit.
47
+ - `Badge` and `Icon` render spans, not divs, so they are valid inside a button, such as a folder
48
+ header's `prefix` or `suffix`. They look the same. A ref or props typed `HTMLDivElement` on
49
+ either now needs `HTMLSpanElement`.
50
+
51
+ ### Fixed
52
+
53
+ - `MotionCollapsibleContent` no longer grows from nothing when it first renders open, such as an
54
+ `Input` that loads with an error.
55
+ - `MotionCollapsibleContent` clips its content while it opens again after a close. It mounted
56
+ unclipped for a frame and could paint over what follows.
57
+ - Rows under a `NavSwitcher` in `NavPanel`'s header sit 2px below it, as rows sit below each other.
58
+ Without a group label, they touched it.
59
+ - In forced colours, only the current nav row and rail item keep a border. Every row was boxed, and
60
+ the current rail item had no mark at all.
61
+
5
62
  ## 5.2.0 - 2026-11-02
6
63
 
7
64
  ### Added
package/dist/index.cjs CHANGED
@@ -55,6 +55,7 @@ var styles33 = require('./loading-overlay.module.module.css.module.css');
55
55
  var styles32 = require('./spinner.module.module.css.module.css');
56
56
  var styles34 = require('./metric-card.module.module.css.module.css');
57
57
  var styles36 = require('./nav-list.module.module.css.module.css');
58
+ var CollapsiblePrimitive = require('@radix-ui/react-collapsible');
58
59
  var styles41 = require('./nav.module.module.css.module.css');
59
60
  var SelectPrimitive = require('@radix-ui/react-select');
60
61
  var styles39 = require('./select.module.module.css.module.css');
@@ -157,6 +158,7 @@ var styles33__default = /*#__PURE__*/_interopDefault(styles33);
157
158
  var styles32__default = /*#__PURE__*/_interopDefault(styles32);
158
159
  var styles34__default = /*#__PURE__*/_interopDefault(styles34);
159
160
  var styles36__default = /*#__PURE__*/_interopDefault(styles36);
161
+ var CollapsiblePrimitive__namespace = /*#__PURE__*/_interopNamespace(CollapsiblePrimitive);
160
162
  var styles41__default = /*#__PURE__*/_interopDefault(styles41);
161
163
  var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
162
164
  var styles39__default = /*#__PURE__*/_interopDefault(styles39);
@@ -417,7 +419,7 @@ var Icon = React16.forwardRef(
417
419
  throw new Error("Icon must be either a string (Lucide icon name) or a React element");
418
420
  }
419
421
  return /* @__PURE__ */ jsxRuntime.jsx(
420
- "div",
422
+ "span",
421
423
  {
422
424
  ref,
423
425
  className: cn(
@@ -621,7 +623,7 @@ function Badge({
621
623
  const shouldShowChildren = effectiveDisplay !== "icon-only";
622
624
  const isIconOnly = effectiveDisplay === "icon-only" && effectiveIcon;
623
625
  return /* @__PURE__ */ jsxRuntime.jsxs(
624
- "div",
626
+ "span",
625
627
  {
626
628
  className: cn(
627
629
  variant !== null && badgeVariants({ variant, size }),
@@ -2725,36 +2727,22 @@ var MotionCollapsibleContent = ({
2725
2727
  children,
2726
2728
  className
2727
2729
  }) => {
2728
- const [contentHeight, setContentHeight] = React16.useState(0);
2729
- const [isSettled, setIsSettled] = React16.useState(false);
2730
- const contentRef = React16.useRef(null);
2731
- React16.useEffect(() => {
2732
- if (contentRef.current) {
2733
- const resizeObserver = new ResizeObserver(() => {
2734
- if (contentRef.current) {
2735
- setContentHeight(contentRef.current.scrollHeight);
2736
- }
2737
- });
2738
- resizeObserver.observe(contentRef.current);
2739
- setContentHeight(contentRef.current.scrollHeight);
2740
- return () => resizeObserver.disconnect();
2741
- }
2742
- }, [children]);
2730
+ const [isSettled, setIsSettled] = React16.useState(isOpen);
2743
2731
  return /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, mode: "wait", children: isOpen && /* @__PURE__ */ jsxRuntime.jsx(
2744
2732
  react.motion.div,
2745
2733
  {
2746
2734
  initial: { height: 0, opacity: 0 },
2747
- animate: { height: contentHeight, opacity: 1 },
2735
+ animate: { height: "auto", opacity: 1 },
2748
2736
  exit: { height: 0, opacity: 0 },
2749
2737
  transition: { duration: 0.3, ease: "easeInOut" },
2750
2738
  onAnimationStart: () => setIsSettled(false),
2751
- onAnimationComplete: () => setIsSettled(isOpen),
2739
+ onAnimationComplete: (definition) => setIsSettled(definition.height === "auto"),
2752
2740
  className: cn(
2753
2741
  styles30__default.default["motion-collapsible"],
2754
2742
  isSettled && styles30__default.default["motion-collapsible--settled"],
2755
2743
  className
2756
2744
  ),
2757
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: contentRef, children })
2745
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { children })
2758
2746
  },
2759
2747
  "motion-content"
2760
2748
  ) });
@@ -2887,35 +2875,50 @@ var MetricCard = ({
2887
2875
  ] });
2888
2876
  };
2889
2877
  var NavDrillContext = React16__namespace.createContext(null);
2878
+ var FolderMemoryContext = React16__namespace.createContext(null);
2890
2879
  var useIsomorphicLayoutEffect = typeof window === "undefined" ? React16.useEffect : React16.useLayoutEffect;
2891
- var MOTION = {
2892
- drill: {
2893
- current: [
2894
- { transform: "translateX(12px)", opacity: 0 },
2895
- { transform: "translateX(0)", opacity: 1 }
2896
- ],
2897
- previous: [
2898
- { transform: "translateX(0)", opacity: 1 },
2899
- { opacity: 0, offset: 0.35 },
2900
- { transform: "translateX(-12px)", opacity: 0 }
2901
- ]
2902
- },
2903
- back: {
2880
+ var motion2 = (direction, nudge) => {
2881
+ const sign = direction === "drill" ? 1 : -1;
2882
+ return {
2904
2883
  current: [
2905
- { transform: "translateX(-12px)", opacity: 0 },
2884
+ { transform: `translateX(${sign * nudge}px)`, opacity: 0 },
2906
2885
  { transform: "translateX(0)", opacity: 1 }
2907
2886
  ],
2908
2887
  previous: [
2909
2888
  { transform: "translateX(0)", opacity: 1 },
2910
2889
  { opacity: 0, offset: 0.35 },
2911
- { transform: "translateX(12px)", opacity: 0 }
2890
+ { transform: `translateX(${-sign * nudge}px)`, opacity: 0 }
2912
2891
  ]
2913
- }
2892
+ };
2914
2893
  };
2915
- var TIMING = { duration: 300, easing: "cubic-bezier(.2, .8, .2, 1)" };
2894
+ function navMotion(element) {
2895
+ const style = getComputedStyle(element);
2896
+ const read = (name) => style.getPropertyValue(name).trim();
2897
+ const duration = read("--eq-nav-motion-duration");
2898
+ const ms = duration.endsWith("ms") ? parseFloat(duration) : parseFloat(duration) * 1e3;
2899
+ const raw = read("--eq-nav-motion-nudge");
2900
+ const nudge = /^-?[\d.]+px$/.test(raw) ? parseFloat(raw) : resolveNudge(element);
2901
+ return {
2902
+ nudge: Number.isFinite(nudge) ? nudge : 12,
2903
+ timing: {
2904
+ duration: Number.isFinite(ms) ? ms : 300,
2905
+ easing: read("--eq-nav-motion-ease") || "cubic-bezier(.2, .8, .2, 1)"
2906
+ }
2907
+ };
2908
+ }
2909
+ function resolveNudge(element) {
2910
+ const previous = element.style.outlineOffset;
2911
+ element.style.outlineOffset = "var(--eq-nav-motion-nudge, 12px)";
2912
+ const nudge = parseFloat(getComputedStyle(element).outlineOffset);
2913
+ element.style.outlineOffset = previous;
2914
+ return nudge;
2915
+ }
2916
2916
  var LEVEL = '[data-slot="nav-drill-level"]';
2917
2917
  var NavDrillBackContext = React16__namespace.createContext(() => {
2918
2918
  });
2919
+ var LevelFoldersContext = React16__namespace.createContext(
2920
+ null
2921
+ );
2919
2922
  var LEAVING_DRILL_CONTEXT = { requestDrill: () => {
2920
2923
  }, leaving: true };
2921
2924
  var NO_BACK = () => {
@@ -2941,6 +2944,7 @@ var NavDrill = React16__namespace.forwardRef(
2941
2944
  const focusRequest = React16__namespace.useRef(null);
2942
2945
  const observer = React16__namespace.useRef(null);
2943
2946
  const previousView = React16__namespace.useRef(view);
2947
+ const [levelFolders] = React16__namespace.useState(() => /* @__PURE__ */ new Map());
2944
2948
  const level = React16__namespace.Children.toArray(children).find(
2945
2949
  (child) => React16__namespace.isValidElement(child) && child.props.value === view
2946
2950
  ) ?? null;
@@ -3027,9 +3031,11 @@ var NavDrill = React16__namespace.forwardRef(
3027
3031
  const ghostLevel = ghost?.querySelector(LEVEL);
3028
3032
  if (!leaving || !live || !ghost || !ghostLevel) return;
3029
3033
  ghostLevel.style.marginTop = `${leaving.top - live.getBoundingClientRect().top}px`;
3034
+ const { nudge, timing } = navMotion(live);
3035
+ const frames = motion2(leaving.direction, nudge);
3030
3036
  const animations = [
3031
- live.animate(MOTION[leaving.direction].current, TIMING),
3032
- ghost.animate(MOTION[leaving.direction].previous, TIMING)
3037
+ live.animate(frames.current, timing),
3038
+ ghost.animate(frames.previous, timing)
3033
3039
  ];
3034
3040
  running.current = animations;
3035
3041
  Promise.all(animations.map((animation) => animation.finished)).then(
@@ -3072,7 +3078,7 @@ var NavDrill = React16__namespace.forwardRef(
3072
3078
  ghostRef.current = node;
3073
3079
  if (node) node.inert = true;
3074
3080
  }, []);
3075
- return /* @__PURE__ */ jsxRuntime.jsxs(
3081
+ return /* @__PURE__ */ jsxRuntime.jsx(
3076
3082
  "div",
3077
3083
  {
3078
3084
  ref: setRootRef,
@@ -3080,7 +3086,7 @@ var NavDrill = React16__namespace.forwardRef(
3080
3086
  "data-motion": leaving?.direction,
3081
3087
  className: cn(styles36__default.default["nav-drill"], className),
3082
3088
  ...props,
3083
- children: [
3089
+ children: /* @__PURE__ */ jsxRuntime.jsxs(LevelFoldersContext.Provider, { value: levelFolders, children: [
3084
3090
  /* @__PURE__ */ jsxRuntime.jsx(NavDrillContext.Provider, { value: drillContext, children: /* @__PURE__ */ jsxRuntime.jsx(NavDrillBackContext.Provider, { value: requestBack, children: level && /* @__PURE__ */ jsxRuntime.jsx(React16__namespace.Fragment, { children: level }, view) }) }),
3085
3091
  leaving && /* @__PURE__ */ jsxRuntime.jsx(
3086
3092
  "div",
@@ -3094,7 +3100,7 @@ var NavDrill = React16__namespace.forwardRef(
3094
3100
  },
3095
3101
  leaving.id
3096
3102
  )
3097
- ]
3103
+ ] })
3098
3104
  }
3099
3105
  );
3100
3106
  }
@@ -3103,6 +3109,12 @@ NavDrill.displayName = "NavDrill";
3103
3109
  var NavDrillLevel = React16__namespace.forwardRef(
3104
3110
  ({ value, parent, label, backLabel, className, children, ...props }, ref) => {
3105
3111
  const requestBack = React16__namespace.useContext(NavDrillBackContext);
3112
+ const levelFolders = React16__namespace.useContext(LevelFoldersContext);
3113
+ let folders = levelFolders?.get(value) ?? null;
3114
+ if (levelFolders && !folders) {
3115
+ folders = /* @__PURE__ */ new Map();
3116
+ levelFolders.set(value, folders);
3117
+ }
3106
3118
  React16__namespace.useEffect(() => {
3107
3119
  if (typeof process !== "undefined" && process.env.NODE_ENV !== "production" && parent !== void 0 && backLabel && label && !backLabel.startsWith(label)) {
3108
3120
  console.warn(
@@ -3129,14 +3141,21 @@ var NavDrillLevel = React16__namespace.forwardRef(
3129
3141
  className: cn(styles36__default.default["nav-list-item"], styles36__default.default["nav-list-item--back"]),
3130
3142
  onClick: () => requestBack(parent),
3131
3143
  children: [
3132
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles36__default.default["nav-list-item-prefix"], "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.ChevronLeft, {}) }),
3144
+ /* @__PURE__ */ jsxRuntime.jsx(
3145
+ "span",
3146
+ {
3147
+ className: cn(styles36__default.default["nav-list-item-prefix"], styles36__default.default["nav-list-item-muted"]),
3148
+ "aria-hidden": "true",
3149
+ children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.ChevronLeft, {})
3150
+ }
3151
+ ),
3133
3152
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles36__default.default["nav-list-item-label"], title: label, children: label })
3134
3153
  ]
3135
3154
  }
3136
3155
  ),
3137
3156
  /* @__PURE__ */ jsxRuntime.jsx("hr", { className: styles36__default.default["nav-drill-rule"] })
3138
3157
  ] }),
3139
- children
3158
+ /* @__PURE__ */ jsxRuntime.jsx(FolderMemoryContext.Provider, { value: folders, children })
3140
3159
  ]
3141
3160
  }
3142
3161
  );
@@ -3144,7 +3163,8 @@ var NavDrillLevel = React16__namespace.forwardRef(
3144
3163
  );
3145
3164
  NavDrillLevel.displayName = "NavDrillLevel";
3146
3165
  var ListDepthContext = React16__namespace.createContext(0);
3147
- var NavList = React16__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn(styles36__default.default["nav-list"], className), ...props }));
3166
+ var RevealFolderContext = React16__namespace.createContext(null);
3167
+ var NavList = React16__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, "data-slot": "nav-list", className: cn(styles36__default.default["nav-list"], className), ...props }));
3148
3168
  NavList.displayName = "NavList";
3149
3169
  var NavListGroup = React16__namespace.forwardRef(
3150
3170
  ({ label, className, children, ...props }, ref) => {
@@ -3154,11 +3174,8 @@ var NavListGroup = React16__namespace.forwardRef(
3154
3174
  "div",
3155
3175
  {
3156
3176
  ref,
3157
- className: cn(
3158
- styles36__default.default["nav-list-group"],
3159
- !label && styles36__default.default["nav-list-group--unlabelled"],
3160
- className
3161
- ),
3177
+ "data-slot": "nav-list-group",
3178
+ className: cn(styles36__default.default["nav-list-group"], className),
3162
3179
  ...props,
3163
3180
  children: [
3164
3181
  label && /* @__PURE__ */ jsxRuntime.jsx("div", { id: labelId, className: styles36__default.default["nav-list-group-label"], children: label }),
@@ -3192,8 +3209,12 @@ var NavListItem = React16__namespace.forwardRef(
3192
3209
  ...props
3193
3210
  }, ref) => {
3194
3211
  const drillContext = React16__namespace.useContext(NavDrillContext);
3212
+ const revealFolder = React16__namespace.useContext(RevealFolderContext);
3213
+ const wasCurrent = React16__namespace.useRef(current);
3195
3214
  const Comp = asChild ? reactSlot.Slot : props.href ? "a" : "button";
3196
3215
  const leaving = drillContext?.leaving ?? false;
3216
+ const childTarget = asChild && React16__namespace.isValidElement(children) ? children.props.target : void 0;
3217
+ const newTab = (props.target ?? childTarget) === "_blank";
3197
3218
  const handleClick = (event) => {
3198
3219
  onClick?.(event);
3199
3220
  if (!drill || !drillContext) return;
@@ -3201,6 +3222,10 @@ var NavListItem = React16__namespace.forwardRef(
3201
3222
  return;
3202
3223
  drillContext.requestDrill(drill);
3203
3224
  };
3225
+ useIsomorphicLayoutEffect(() => {
3226
+ if (current) revealFolder?.(wasCurrent.current ? "mount" : "change");
3227
+ wasCurrent.current = current;
3228
+ }, [current, revealFolder]);
3204
3229
  return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
3205
3230
  Comp,
3206
3231
  {
@@ -3212,13 +3237,32 @@ var NavListItem = React16__namespace.forwardRef(
3212
3237
  "data-current": current && leaving ? "page" : void 0,
3213
3238
  className: cn(styles36__default.default["nav-list-item"], className),
3214
3239
  onClick: handleClick,
3240
+ rel: newTab ? "noopener noreferrer" : void 0,
3215
3241
  ...props,
3216
3242
  children: [
3217
3243
  prefix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles36__default.default["nav-list-item-prefix"], "aria-hidden": "true", children: prefix }),
3218
3244
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles36__default.default["nav-list-item-label"], title: label, children: label }),
3219
3245
  /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slottable, { children }),
3220
3246
  suffix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles36__default.default["nav-list-item-suffix"], children: suffix }),
3221
- drill && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles36__default.default["nav-list-item-caret"], "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.ChevronRight, {}) })
3247
+ newTab && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3248
+ /* @__PURE__ */ jsxRuntime.jsx(
3249
+ "span",
3250
+ {
3251
+ className: cn(styles36__default.default["nav-list-item-caret"], styles36__default.default["nav-list-item-muted"]),
3252
+ "aria-hidden": "true",
3253
+ children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.ArrowUpRight, {})
3254
+ }
3255
+ ),
3256
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles36__default.default["nav-list-item-new-tab"], children: " (opens in a new tab)" })
3257
+ ] }),
3258
+ drill && /* @__PURE__ */ jsxRuntime.jsx(
3259
+ "span",
3260
+ {
3261
+ className: cn(styles36__default.default["nav-list-item-caret"], styles36__default.default["nav-list-item-muted"]),
3262
+ "aria-hidden": "true",
3263
+ children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.ChevronRight, {})
3264
+ }
3265
+ )
3222
3266
  ]
3223
3267
  }
3224
3268
  ) });
@@ -3241,6 +3285,105 @@ var NavListSeparator = React16__namespace.forwardRef(
3241
3285
  }
3242
3286
  );
3243
3287
  NavListSeparator.displayName = "NavListSeparator";
3288
+ var NavListExpandable = React16__namespace.forwardRef(
3289
+ ({ open, defaultOpen = false, onOpenChange, value, className, ...props }, ref) => {
3290
+ const revealParent = React16__namespace.useContext(RevealFolderContext);
3291
+ const folders = React16__namespace.useContext(FolderMemoryContext);
3292
+ const memory = value === void 0 ? void 0 : folders?.get(value);
3293
+ const [ownOpen, setOwnOpen] = React16__namespace.useState(memory?.open ?? defaultOpen);
3294
+ const [instant, setInstant] = React16__namespace.useState(false);
3295
+ const isOpen = open ?? ownOpen;
3296
+ const mounting = React16__namespace.useRef(true);
3297
+ const closedByReader = React16__namespace.useRef(memory?.closedByReader ?? false);
3298
+ const askedToOpen = React16__namespace.useRef(false);
3299
+ const handleOpenChange = (next) => {
3300
+ closedByReader.current = !next;
3301
+ if (open === void 0) setOwnOpen(next);
3302
+ onOpenChange?.(next);
3303
+ };
3304
+ const latest = React16__namespace.useRef({ isOpen, handleOpenChange, revealParent });
3305
+ useIsomorphicLayoutEffect(() => {
3306
+ latest.current = { isOpen, handleOpenChange, revealParent };
3307
+ if (isOpen) askedToOpen.current = false;
3308
+ if (value !== void 0)
3309
+ folders?.set(value, { open: isOpen, closedByReader: closedByReader.current });
3310
+ });
3311
+ React16__namespace.useEffect(() => {
3312
+ const frame = requestAnimationFrame(() => {
3313
+ mounting.current = false;
3314
+ });
3315
+ return () => cancelAnimationFrame(frame);
3316
+ }, []);
3317
+ React16__namespace.useEffect(() => {
3318
+ if (!instant) return;
3319
+ const frame = requestAnimationFrame(() => setInstant(false));
3320
+ return () => cancelAnimationFrame(frame);
3321
+ }, [instant]);
3322
+ const reveal = React16__namespace.useCallback((reason) => {
3323
+ const folder = latest.current;
3324
+ folder.revealParent?.(reason);
3325
+ if (folder.isOpen) return;
3326
+ if (reason === "mount" && (closedByReader.current || askedToOpen.current)) return;
3327
+ askedToOpen.current = true;
3328
+ if (mounting.current) setInstant(true);
3329
+ folder.handleOpenChange(true);
3330
+ }, []);
3331
+ return /* @__PURE__ */ jsxRuntime.jsx(RevealFolderContext.Provider, { value: reveal, children: /* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.Root, { asChild: true, open: isOpen, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(
3332
+ "li",
3333
+ {
3334
+ ref,
3335
+ "data-instant": instant ? "" : void 0,
3336
+ className: cn(styles36__default.default["nav-list-expandable"], className),
3337
+ ...props
3338
+ }
3339
+ ) }) });
3340
+ }
3341
+ );
3342
+ NavListExpandable.displayName = "NavListExpandable";
3343
+ var NavListExpandableTrigger = React16__namespace.forwardRef(
3344
+ ({ label, prefix, suffix, className, ...props }, ref) => {
3345
+ const [mounted, setMounted] = React16__namespace.useState(false);
3346
+ React16__namespace.useEffect(() => setMounted(true), []);
3347
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3348
+ CollapsiblePrimitive__namespace.Trigger,
3349
+ {
3350
+ ref,
3351
+ "data-slot": "nav-list-expandable-trigger",
3352
+ className: cn(styles36__default.default["nav-list-item"], styles36__default.default["nav-list-expandable-trigger"], className),
3353
+ ...mounted ? {} : { "aria-expanded": void 0 },
3354
+ ...props,
3355
+ children: [
3356
+ prefix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles36__default.default["nav-list-item-prefix"], "aria-hidden": "true", children: prefix }),
3357
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles36__default.default["nav-list-item-label"], title: label, children: label }),
3358
+ suffix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles36__default.default["nav-list-item-suffix"], children: suffix }),
3359
+ /* @__PURE__ */ jsxRuntime.jsx(
3360
+ "span",
3361
+ {
3362
+ className: cn(styles36__default.default["nav-list-expandable-chevron"], styles36__default.default["nav-list-item-muted"]),
3363
+ "aria-hidden": "true",
3364
+ children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.ChevronDown, {})
3365
+ }
3366
+ )
3367
+ ]
3368
+ }
3369
+ );
3370
+ }
3371
+ );
3372
+ NavListExpandableTrigger.displayName = "NavListExpandableTrigger";
3373
+ var NavListExpandableContent = React16__namespace.forwardRef(({ className, children, ...props }, ref) => {
3374
+ const depth = React16__namespace.useContext(ListDepthContext);
3375
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles36__default.default["nav-list-expandable-panel"], children: /* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.Content, { forceMount: true, className: styles36__default.default["nav-list-expandable-content"], children: /* @__PURE__ */ jsxRuntime.jsx(
3376
+ "ul",
3377
+ {
3378
+ ref,
3379
+ "data-depth": depth,
3380
+ className: cn(styles36__default.default["nav-list-items"], styles36__default.default["nav-list-expandable-items"], className),
3381
+ ...props,
3382
+ children: /* @__PURE__ */ jsxRuntime.jsx(ListDepthContext.Provider, { value: depth + 1, children })
3383
+ }
3384
+ ) }) });
3385
+ });
3386
+ NavListExpandableContent.displayName = "NavListExpandableContent";
3244
3387
  var NavPanel = React16__namespace.forwardRef(
3245
3388
  ({ header, className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("nav", { ref, className: cn(styles41__default.default["nav-panel"], className), ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles41__default.default["nav-scroller"], "data-nav-scroller": "", children: [
3246
3389
  header && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles41__default.default["nav-panel-header"], children: header }),
@@ -5451,6 +5594,9 @@ exports.MotionCollapsibleContent = MotionCollapsibleContent;
5451
5594
  exports.NavDrill = NavDrill;
5452
5595
  exports.NavDrillLevel = NavDrillLevel;
5453
5596
  exports.NavList = NavList;
5597
+ exports.NavListExpandable = NavListExpandable;
5598
+ exports.NavListExpandableContent = NavListExpandableContent;
5599
+ exports.NavListExpandableTrigger = NavListExpandableTrigger;
5454
5600
  exports.NavListGroup = NavListGroup;
5455
5601
  exports.NavListItem = NavListItem;
5456
5602
  exports.NavListSeparator = NavListSeparator;