@mindlogic-ai/logician-ui 5.0.0-alpha.12 → 5.0.0-alpha.13

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.
Files changed (77) hide show
  1. package/README.md +1 -0
  2. package/dist/components/NavList/NavList.d.ts +34 -0
  3. package/dist/components/NavList/NavList.d.ts.map +1 -0
  4. package/dist/components/NavList/NavList.js +113 -0
  5. package/dist/components/NavList/NavList.js.map +1 -0
  6. package/dist/components/NavList/NavList.mjs +111 -0
  7. package/dist/components/NavList/NavList.mjs.map +1 -0
  8. package/dist/components/NavList/NavList.styles.d.ts +90 -0
  9. package/dist/components/NavList/NavList.styles.d.ts.map +1 -0
  10. package/dist/components/NavList/NavList.styles.js +104 -0
  11. package/dist/components/NavList/NavList.styles.js.map +1 -0
  12. package/dist/components/NavList/NavList.styles.mjs +97 -0
  13. package/dist/components/NavList/NavList.styles.mjs.map +1 -0
  14. package/dist/components/NavList/NavList.translations.json.js +19 -0
  15. package/dist/components/NavList/NavList.translations.json.js.map +1 -0
  16. package/dist/components/NavList/NavList.translations.json.mjs +14 -0
  17. package/dist/components/NavList/NavList.translations.json.mjs.map +1 -0
  18. package/dist/components/NavList/NavList.types.d.ts +131 -0
  19. package/dist/components/NavList/NavList.types.d.ts.map +1 -0
  20. package/dist/components/NavList/NavListContext.d.ts +30 -0
  21. package/dist/components/NavList/NavListContext.d.ts.map +1 -0
  22. package/dist/components/NavList/NavListContext.js +16 -0
  23. package/dist/components/NavList/NavListContext.js.map +1 -0
  24. package/dist/components/NavList/NavListContext.mjs +13 -0
  25. package/dist/components/NavList/NavListContext.mjs.map +1 -0
  26. package/dist/components/NavList/NavListGroup.d.ts +31 -0
  27. package/dist/components/NavList/NavListGroup.d.ts.map +1 -0
  28. package/dist/components/NavList/NavListGroup.js +115 -0
  29. package/dist/components/NavList/NavListGroup.js.map +1 -0
  30. package/dist/components/NavList/NavListGroup.mjs +113 -0
  31. package/dist/components/NavList/NavListGroup.mjs.map +1 -0
  32. package/dist/components/NavList/NavListItem.d.ts +15 -0
  33. package/dist/components/NavList/NavListItem.d.ts.map +1 -0
  34. package/dist/components/NavList/NavListItem.js +269 -0
  35. package/dist/components/NavList/NavListItem.js.map +1 -0
  36. package/dist/components/NavList/NavListItem.mjs +267 -0
  37. package/dist/components/NavList/NavListItem.mjs.map +1 -0
  38. package/dist/components/NavList/NavListSkeleton.d.ts +17 -0
  39. package/dist/components/NavList/NavListSkeleton.d.ts.map +1 -0
  40. package/dist/components/NavList/NavListSkeleton.js +33 -0
  41. package/dist/components/NavList/NavListSkeleton.js.map +1 -0
  42. package/dist/components/NavList/NavListSkeleton.mjs +31 -0
  43. package/dist/components/NavList/NavListSkeleton.mjs.map +1 -0
  44. package/dist/components/NavList/index.d.ts +7 -0
  45. package/dist/components/NavList/index.d.ts.map +1 -0
  46. package/dist/index.d.ts +2 -1
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +12 -0
  49. package/dist/index.js.map +1 -1
  50. package/dist/index.mjs +6 -1
  51. package/dist/index.mjs.map +1 -1
  52. package/dist/utils/focusRing.d.ts +22 -0
  53. package/dist/utils/focusRing.d.ts.map +1 -1
  54. package/dist/utils/focusRing.js +22 -0
  55. package/dist/utils/focusRing.js.map +1 -1
  56. package/dist/utils/focusRing.mjs +21 -1
  57. package/dist/utils/focusRing.mjs.map +1 -1
  58. package/package.json +2 -1
  59. package/src/components/Menu/Menu.usage.mdx +8 -0
  60. package/src/components/NavList/NavList.stories.tsx +895 -0
  61. package/src/components/NavList/NavList.styles.ts +114 -0
  62. package/src/components/NavList/NavList.test.tsx +1254 -0
  63. package/src/components/NavList/NavList.translations.json +9 -0
  64. package/src/components/NavList/NavList.tsx +160 -0
  65. package/src/components/NavList/NavList.types.ts +145 -0
  66. package/src/components/NavList/NavList.usage.mdx +540 -0
  67. package/src/components/NavList/NavListContext.ts +25 -0
  68. package/src/components/NavList/NavListGroup.tsx +243 -0
  69. package/src/components/NavList/NavListItem.tsx +525 -0
  70. package/src/components/NavList/NavListSkeleton.tsx +57 -0
  71. package/src/components/NavList/index.ts +14 -0
  72. package/src/components/Tabs/Tabs.usage.mdx +58 -14
  73. package/src/components/Tooltip/Tooltip.usage.mdx +8 -0
  74. package/src/components/a11y.kwcag.test.tsx +66 -0
  75. package/src/components/claude.md +1 -1
  76. package/src/index.ts +7 -1
  77. package/src/utils/focusRing.ts +23 -0
@@ -0,0 +1,269 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var React = require('react');
6
+ var react = require('@chakra-ui/react');
7
+ var Tooltip = require('../Tooltip/Tooltip.js');
8
+ var useTranslate = require('../../hooks/useTranslate.js');
9
+ var disabledControl = require('../../utils/disabledControl.js');
10
+ var focusRing = require('../../utils/focusRing.js');
11
+ var NavList_styles = require('./NavList.styles.js');
12
+ var NavList_translations = require('./NavList.translations.json.js');
13
+ var NavListContext = require('./NavListContext.js');
14
+
15
+ /** The label span is cut off by its ellipsis. */
16
+ // Every selector below names the row by this attribute, not by `data-part`:
17
+ // the tooltip trigger's own `data-part="trigger"` lands on the same element.
18
+ const ROW = '[data-nav-list-row]';
19
+ const ACTION = '[data-part="trailing-action"]';
20
+ /** Touch screens: no hover to reveal on, and a finger needs the space kept. */
21
+ const NO_HOVER = '@media (hover: none), (pointer: coarse)';
22
+ /** The row, not the action beside it, is being pressed. */
23
+ const PRESSED = `&:has(${ROW}:active)`;
24
+ const isTruncated = (el) => el != null && el.scrollWidth > el.clientWidth + 1;
25
+ const NavListItem = React.forwardRef(({ children, href, asChild = false, onClick, isCurrent = false, isDisabled = false, leadingVisual, trailingVisual, trailingAction, trailingActionVisibility = 'always', tooltip, ...rest }, ref) => {
26
+ const { orientation, isCollapsed, tooltipDir, revealCurrent } = NavListContext.useNavListContext();
27
+ const translate = useTranslate.useTranslate(NavList_translations.default);
28
+ const labelRef = React.useRef(null);
29
+ const descriptionId = React.useId();
30
+ const [isTooltipOpen, setIsTooltipOpen] = React.useState(false);
31
+ React.useEffect(() => {
32
+ if (isCurrent)
33
+ revealCurrent();
34
+ }, [isCurrent, revealCurrent]);
35
+ const isLink = asChild || href != null;
36
+ const child = isLink && asChild ? React.Children.only(children) : null;
37
+ if (asChild && !React.isValidElement(child)) {
38
+ throw new Error('NavList.Item with asChild needs exactly one element child');
39
+ }
40
+ const routerChild = child;
41
+ const label = routerChild ? routerChild.props.children : children;
42
+ const opensNewWindow = !isDisabled &&
43
+ isLink &&
44
+ (routerChild?.props.target ?? rest.target) ===
45
+ '_blank';
46
+ const inherited = react.useLocaleContext();
47
+ const content = (jsxRuntime.jsxs(react.LocaleProvider, { locale: inherited.locale, children: [leadingVisual != null && (jsxRuntime.jsx(react.chakra.span, { "aria-hidden": true, display: "inline-flex", alignItems: "center", flexShrink: 0, children: leadingVisual })), jsxRuntime.jsx(react.chakra.span, { ref: labelRef, "data-part": "label", flex: NavList_styles.byOrientation(orientation, '1 1 auto', '0 0 auto'), minW: isCollapsed ? '1px' : 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", opacity: isCollapsed ? 0 : 1, animationStyle: "feedback", transitionProperty: "opacity", children: label }), opensNewWindow && (jsxRuntime.jsx(react.VisuallyHidden, { children: ` (${translate('nav_list_opens_new_window')})` })), trailingVisual != null && (jsxRuntime.jsx(react.chakra.span, { display: "inline-flex", alignItems: "center", flexShrink: 0, ms: "auto", color: isDisabled ? 'disabled.fg' : NavList_styles.NAV_LIST_RAMP.trailing, fontWeight: "normal", fontVariantNumeric: "tabular-nums",
48
+ // Fades with the label. `visibility` flips at the END of the fade
49
+ // (it is discrete), which is when the count leaves the row's name.
50
+ opacity: isCollapsed ? 0 : 1, visibility: isCollapsed ? 'hidden' : 'visible', animationStyle: "feedback", transitionProperty: "opacity, visibility", children: trailingVisual }))] }));
51
+ // One tooltip per row, three jobs. Collapsed: the label, beside the icon.
52
+ // `tooltip`: the caller's description. Otherwise: the label again, only
53
+ // while the ellipsis is actually cutting it off.
54
+ const tooltipKind = isCollapsed
55
+ ? 'label'
56
+ : tooltip != null
57
+ ? 'description'
58
+ : 'overflow';
59
+ // The overflow tooltip is gated at the trigger: zag skips opening when the
60
+ // event that would open it was `defaultPrevented`, and the row's own
61
+ // handlers run before zag's. A controlled `open` cannot do this — zag
62
+ // enters its open state first and only re-syncs when the prop CHANGES.
63
+ const restHandlers = rest;
64
+ // A POINTER also waits for the label to finish fading when the rail is
65
+ // toggled, so no tooltip flashes over a row that is still changing shape:
66
+ // the label one only once the label is fully gone, the others only once
67
+ // it is fully back. The next pointermove after the fade opens it. Focus
68
+ // is never held back — a cancelled focus is not re-fired, so a row
69
+ // focused mid-fade would never show its label.
70
+ const isSettled = () => {
71
+ const el = labelRef.current;
72
+ if (!el)
73
+ return true;
74
+ const opacity = parseFloat(getComputedStyle(el).opacity);
75
+ if (Number.isNaN(opacity))
76
+ return true;
77
+ return isCollapsed ? opacity === 0 : opacity === 1;
78
+ };
79
+ const gate = (handler, waitForFade = true) => (event) => {
80
+ if ((waitForFade && !isSettled()) ||
81
+ (tooltipKind === 'overflow' && !isTruncated(labelRef.current)))
82
+ event.preventDefault();
83
+ handler?.(event);
84
+ };
85
+ const tooltipGate = {
86
+ onPointerMove: gate(restHandlers.onPointerMove),
87
+ onPointerOver: gate(restHandlers.onPointerOver),
88
+ onFocus: gate(restHandlers.onFocus, false),
89
+ };
90
+ // The description is a visually hidden element of its own, referenced
91
+ // all the time — not the tooltip, which zag only references while it is
92
+ // open. A disabled row cannot take focus, so a description that existed
93
+ // only while open would never reach a keyboard or screen-reader user,
94
+ // which is exactly when "why is this disabled" matters. The tooltip
95
+ // itself is then never a description (`aria-label` on its root takes its
96
+ // id away), and while it is open the row's own value — the caller's ids,
97
+ // or an empty list — outranks the dangling id zag would leave behind.
98
+ const callerDescribedBy = rest['aria-describedby'];
99
+ const describedBy = [callerDescribedBy, tooltip != null ? descriptionId : undefined]
100
+ .filter(Boolean)
101
+ .join(' ') || (isTooltipOpen ? '' : undefined);
102
+ const describedByProps = { 'aria-describedby': describedBy };
103
+ const handleClick = (event) => {
104
+ // Belt and braces: a disabled `<button>` fires no click and a disabled
105
+ // link has no `href`, so this only guards a caller who forces one.
106
+ if (isDisabled) {
107
+ event.preventDefault();
108
+ return;
109
+ }
110
+ onClick?.(event);
111
+ };
112
+ // `hover`: the action floats over the end of the label instead of keeping
113
+ // its own column, so a resting row spends its full width on the label —
114
+ // the app's HoverRevealedKebab. The row and the action share one grid
115
+ // cell's row; the row spans both columns at rest and gives the second one
116
+ // back to the action when it shows. Only the label's end moves: the row
117
+ // is as tall as it ever was, so nothing below it shifts. Vertical only —
118
+ // a horizontal row is as wide as its label, so there is nothing to give.
119
+ const overlaysAction = trailingActionVisibility === 'hover' &&
120
+ trailingAction != null &&
121
+ !isCollapsed;
122
+ // The fill lives on the `<li>`, not the row, so a trailing action sits on
123
+ // the same surface: hovering the action keeps the row lit, and the current
124
+ // row's fill runs under its action instead of stopping short of it.
125
+ const rowStyles = {
126
+ display: 'flex',
127
+ alignItems: 'center',
128
+ gap: 2,
129
+ flex: NavList_styles.byOrientation(orientation, '1 1 auto', '0 0 auto'),
130
+ minW: 0,
131
+ // The same inline padding and start alignment in both modes, so the
132
+ // icon does not move when the rail is toggled: at 2.5 a row is the
133
+ // 40px square around an `sm` icon. The `<li>` is what narrows.
134
+ minH: isCollapsed ? 10 : 9,
135
+ px: 2.5,
136
+ py: 2,
137
+ // Clips the label and count while the rail narrows around them. Only
138
+ // collapsed, so an expanded row never clips a badge or a dot that a
139
+ // visual draws past its own box.
140
+ overflow: isCollapsed ? 'hidden' : undefined,
141
+ borderRadius: 'md',
142
+ border: 'none',
143
+ bg: 'transparent',
144
+ textAlign: 'start',
145
+ textDecoration: 'none',
146
+ textStyle: 'p',
147
+ cursor: 'pointer',
148
+ color: isCurrent ? NavList_styles.NAV_LIST_RAMP.currentLabel : NavList_styles.NAV_LIST_RAMP.label,
149
+ fontWeight: isCurrent ? 'bold' : 'normal',
150
+ _hover: { textDecoration: 'none' },
151
+ _disabled: { ...disabledControl.disabledText, cursor: 'not-allowed' },
152
+ ...NavList_styles.inheritDirection,
153
+ ...(overlaysAction && { gridRow: 1, gridColumn: '1 / -1' }),
154
+ // Inset: rows sit 2px apart and a horizontal rail scrolls, so the
155
+ // outward ring would land on the neighbour or be clipped.
156
+ ...focusRing.focusRingInset,
157
+ };
158
+ // Both state attributes go on the element that carries the role, and on
159
+ // the router child's own props when there is one (its props win the
160
+ // `asChild` merge). `data-current` is the hook for scroll-to-current.
161
+ const stateProps = {
162
+ 'aria-current': isCurrent ? (isLink ? 'page' : 'true') : undefined,
163
+ 'data-current': isCurrent ? '' : undefined,
164
+ 'data-nav-list-row': '',
165
+ };
166
+ let row;
167
+ if (!isLink) {
168
+ row = (jsxRuntime.jsx(react.chakra.button, { ref: ref, type: "button", disabled: isDisabled, ...stateProps, onClick: handleClick, ...rowStyles, ...rest, ...describedByProps, ...tooltipGate, children: content }));
169
+ }
170
+ else {
171
+ const linkProps = {
172
+ ref: ref,
173
+ ...rowStyles,
174
+ ...rest,
175
+ ...describedByProps,
176
+ ...tooltipGate,
177
+ };
178
+ if (isDisabled) {
179
+ // A disabled link has no destination, so it is not rendered as one —
180
+ // not even the router link, which would keep its href for middle-click,
181
+ // "open in new tab" and prefetch. Still announced as a link, with
182
+ // `aria-disabled`, the same way whether or not `asChild` was used. With
183
+ // no `href` it is out of the tab order.
184
+ row = (jsxRuntime.jsx(react.chakra.a, { role: "link", "aria-disabled": "true", ...stateProps, ...linkProps, target: undefined, children: content }));
185
+ }
186
+ else if (routerChild) {
187
+ // Our state goes on the CHILD's props, not on the slot: Chakra's
188
+ // `asChild` merge lets the child's own props win, so a router NavLink
189
+ // that sets its own `aria-current` would otherwise contradict
190
+ // `isCurrent`. The child's own click handler still runs, after ours.
191
+ row = (jsxRuntime.jsx(react.chakra.a, { asChild: true, ...linkProps, children: React.cloneElement(routerChild, {
192
+ ...stateProps,
193
+ ...describedByProps,
194
+ onClick: (event) => {
195
+ handleClick(event);
196
+ routerChild.props.onClick?.(event);
197
+ },
198
+ }, content) }));
199
+ }
200
+ else {
201
+ row = (jsxRuntime.jsx(react.chakra.a, { href: href, ...stateProps, onClick: handleClick, ...linkProps, children: content }));
202
+ }
203
+ }
204
+ // The two label tooltips name the tooltip itself (`aria-label`), which
205
+ // takes it out of the trigger's description — the row is already called that.
206
+ const tooltipContent = tooltipKind === 'description' ? (tooltip) : isCollapsed && tooltip != null ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [label, jsxRuntime.jsx(react.Box, { children: tooltip })] })) : (label);
207
+ const labelText = typeof label === 'string' || typeof label === 'number'
208
+ ? String(label)
209
+ : undefined;
210
+ const withTooltip = (jsxRuntime.jsx(Tooltip.Tooltip, { content: tooltipContent,
211
+ // Beside the icon, towards the content: the rail is on the right of
212
+ // a right-to-left page. Popper placements are physical.
213
+ placement: isCollapsed ? (tooltipDir === 'rtl' ? 'left' : 'right') : 'top', onOpenChange: ({ open }) => setIsTooltipOpen(open), "aria-label": labelText ?? 'tooltip', contentProps: { 'aria-hidden': true }, children: row }));
214
+ const fills = isDisabled
215
+ ? undefined
216
+ : {
217
+ // On the `<li>`, like the hover fill, so the press covers the
218
+ // action's end of the row too — but only a press on the ROW: a
219
+ // press on the action is the action's, and lights its own button.
220
+ // No `>` inside `:has()`: jsdom's selector engine throws on a
221
+ // relative selector, which would break every consumer's tests.
222
+ [PRESSED]: NavList_styles.pressedFill,
223
+ };
224
+ // Shown: hovered, focus anywhere in the row, or the action's menu open.
225
+ const shown = [`&:hover > ${ACTION}`, `&:focus-within > ${ACTION}`].join(', ');
226
+ const revealOnHover = trailingActionVisibility === 'hover'
227
+ ? {
228
+ [`& > ${ACTION}`]: { opacity: 0 },
229
+ [shown]: { opacity: 1 },
230
+ // Its own rule: `:has()` is not forgiving, and a browser without
231
+ // it would drop every selector listed beside it.
232
+ [`& > ${ACTION}:has([aria-expanded="true"], [data-state="open"])`]: { opacity: 1 },
233
+ // Touch: always shown, and with its space kept.
234
+ [NO_HOVER]: {
235
+ [`& > ${ACTION}`]: { opacity: 1 },
236
+ ...(overlaysAction && { [`& > ${ROW}`]: { gridColumn: 1 } }),
237
+ },
238
+ ...(overlaysAction && {
239
+ // The row gives the action its column back exactly when the
240
+ // action shows, so the label ends before it.
241
+ [`&:hover > ${ROW}, &:focus-within > ${ROW}`]: { gridColumn: 1 },
242
+ [`&:has(${ACTION} [aria-expanded="true"], ${ACTION} [data-state="open"]) > ${ROW}`]: { gridColumn: 1 },
243
+ }),
244
+ }
245
+ : undefined;
246
+ return (jsxRuntime.jsxs(react.chakra.li, { display: overlaysAction ? NavList_styles.byOrientation(orientation, 'grid', 'flex') : 'flex', gridTemplateColumns: overlaysAction ? 'minmax(0, 1fr) auto' : undefined, alignItems: "center", gap: 0.5, flexShrink: 0, minW: 0,
247
+ // Narrows to the square when the rail collapses, on the label's clock,
248
+ // so the fill shrinks with the rail instead of snapping to 40px.
249
+ maxW: isCollapsed ? 10 : NavList_styles.byOrientation(orientation, '100%', 'none'), animationStyle: "feedback", transitionProperty: "max-width", borderRadius: "md", bg: isCurrent ? NavList_styles.NAV_LIST_RAMP.currentFill : 'transparent', _hover: isDisabled
250
+ ? undefined
251
+ : {
252
+ bg: NavList_styles.NAV_LIST_RAMP.hoverFill,
253
+ // Again inside hover: Chakra's hover rule is as specific as the
254
+ // press rule and comes later, so a pointer press would lose.
255
+ [PRESSED]: NavList_styles.pressedFill,
256
+ }, css: { ...fills, ...revealOnHover }, children: [jsxRuntime.jsx(react.LocaleProvider, { locale: NavList_styles.localeFor(inherited, tooltipDir), children: withTooltip }), tooltip != null && (
257
+ // `hidden`, not visually hidden: a description reference still
258
+ // reads hidden text, and browse mode does not read it a second time.
259
+ jsxRuntime.jsx(react.chakra.span, { id: descriptionId, hidden: true, children: tooltip })), trailingAction != null && !isCollapsed && (jsxRuntime.jsx(react.chakra.span, { "data-part": "trailing-action", display: "inline-flex", alignItems: "center", flexShrink: 0, pe: 0.5, ...(overlaysAction && {
260
+ gridRow: 1,
261
+ gridColumn: 2,
262
+ position: 'relative',
263
+ zIndex: 1,
264
+ }), children: trailingAction }))] }));
265
+ });
266
+ NavListItem.displayName = 'NavList.Item';
267
+
268
+ exports.NavListItem = NavListItem;
269
+ //# sourceMappingURL=NavListItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavListItem.js","sources":["../../../src/components/NavList/NavListItem.tsx"],"sourcesContent":[null],"names":["forwardRef","useNavListContext","useTranslate","NavListTranslations","useRef","useId","useState","useEffect","Children","isValidElement","useLocaleContext","_jsxs","LocaleProvider","_jsx","chakra","byOrientation","VisuallyHidden","NAV_LIST_RAMP","disabledText","inheritDirection","focusRingInset","cloneElement","_Fragment","Box","Tooltip","pressedFill","localeFor"],"mappings":";;;;;;;;;;;;;;AAwDA;AACA;AACA;AACA,MAAM,GAAG,GAAG,qBAAqB;AACjC,MAAM,MAAM,GAAG,+BAA+B;AAC9C;AACA,MAAM,QAAQ,GAAG,yCAAyC;AAC1D;AACA,MAAM,OAAO,GAAG,CAAA,MAAA,EAAS,GAAG,UAAU;AAEtC,MAAM,WAAW,GAAG,CAAC,EAAsB,KACzC,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,GAAG,CAAC;MAEtC,WAAW,GAAGA,gBAAU,CACnC,CACE,EACE,QAAQ,EACR,IAAI,EACJ,OAAO,GAAG,KAAK,EACf,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,aAAa,EACb,cAAc,EACd,cAAc,EACd,wBAAwB,GAAG,QAAQ,EACnC,OAAO,EACP,GAAG,IAAI,EACR,EACD,GAAG,KACD;AACF,IAAA,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,GAC3DC,gCAAiB,EAAE;AACrB,IAAA,MAAM,SAAS,GAAGC,yBAAY,CAACC,4BAAmB,CAAC;AACnD,IA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kB,EAAC,WAAW,EAC9B,YAAY,EAAC,IAAI,EACjB,EAAE,EAAE,SAAS,GAAGE,4BAAa,CAAC,WAAW,GAAG,aAAa,EACzD,MAAM,EACJ;AACE,cAAE;AACF,cAAE;gBACE,EAAE,EAAEA,4BAAa,CAAC,SAAS;;;gBAG3B,CAAC,OAAO,GAAGQ,0BAAW;AACvB,aAAA,EAEP,GAAG,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,aAAa,EAAE,EAAA,QAAA,EAAA,CAQnCZ,cAAA,CAACD,oBAAc,EAAA,EAAC,MAAM,EAAEc,wBAAS,CAAC,SAAS,EAAE,UAAU,CAAC,EAAA,QAAA,EACrD,WAAW,EAAA,CACG,EAChB,OAAO,IAAI,IAAI;;;YAGdb,cAAA,CAACC,YAAM,CAAC,IAAI,EAAA,EAAC,EAAE,EAAE,aAAa,EAAE,MAAM,EAAA,IAAA,EAAA,QAAA,EACnC,OAAO,EAAA,CACI,CACf,EACA,cAAc,IAAI,IAAI,IAAI,CAAC,WAAW,KACrCD,cAAA,CAACC,YAAM,CAAC,IAAI,iBACA,iBAAiB,EAC3B,OAAO,EAAC,aAAa,EACrB,UAAU,EAAC,QAAQ,EACnB,UAAU,EAAE,CAAC,EACb,EAAE,EAAE,GAAG,EAAA,IAEF,cAAc,IAAI;AACrB,oBAAA,OAAO,EAAE,CAAC;AACV,oBAAA,UAAU,EAAE,CAAC;AACb,oBAAA,QAAQ,EAAE,UAAU;AACpB,oBAAA,MAAM,EAAE,CAAC;AACV,iBAAA,CAAC,YAED,cAAc,EAAA,CACH,CACf,CAAA,EAAA,CACS;AAEhB,CAAC;AAGH,WAAW,CAAC,WAAW,GAAG,cAAc;;;;"}
@@ -0,0 +1,267 @@
1
+ "use client";
2
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
+ import { forwardRef, useRef, useId, useState, useEffect, Children, isValidElement, cloneElement } from 'react';
4
+ import { useLocaleContext, LocaleProvider, chakra, VisuallyHidden, Box } from '@chakra-ui/react';
5
+ import { Tooltip } from '../Tooltip/Tooltip.mjs';
6
+ import { useTranslate } from '../../hooks/useTranslate.mjs';
7
+ import { disabledText } from '../../utils/disabledControl.mjs';
8
+ import { focusRingInset } from '../../utils/focusRing.mjs';
9
+ import { byOrientation, NAV_LIST_RAMP, inheritDirection, pressedFill, localeFor } from './NavList.styles.mjs';
10
+ import NavListTranslations from './NavList.translations.json.mjs';
11
+ import { useNavListContext } from './NavListContext.mjs';
12
+
13
+ /** The label span is cut off by its ellipsis. */
14
+ // Every selector below names the row by this attribute, not by `data-part`:
15
+ // the tooltip trigger's own `data-part="trigger"` lands on the same element.
16
+ const ROW = '[data-nav-list-row]';
17
+ const ACTION = '[data-part="trailing-action"]';
18
+ /** Touch screens: no hover to reveal on, and a finger needs the space kept. */
19
+ const NO_HOVER = '@media (hover: none), (pointer: coarse)';
20
+ /** The row, not the action beside it, is being pressed. */
21
+ const PRESSED = `&:has(${ROW}:active)`;
22
+ const isTruncated = (el) => el != null && el.scrollWidth > el.clientWidth + 1;
23
+ const NavListItem = forwardRef(({ children, href, asChild = false, onClick, isCurrent = false, isDisabled = false, leadingVisual, trailingVisual, trailingAction, trailingActionVisibility = 'always', tooltip, ...rest }, ref) => {
24
+ const { orientation, isCollapsed, tooltipDir, revealCurrent } = useNavListContext();
25
+ const translate = useTranslate(NavListTranslations);
26
+ const labelRef = useRef(null);
27
+ const descriptionId = useId();
28
+ const [isTooltipOpen, setIsTooltipOpen] = useState(false);
29
+ useEffect(() => {
30
+ if (isCurrent)
31
+ revealCurrent();
32
+ }, [isCurrent, revealCurrent]);
33
+ const isLink = asChild || href != null;
34
+ const child = isLink && asChild ? Children.only(children) : null;
35
+ if (asChild && !isValidElement(child)) {
36
+ throw new Error('NavList.Item with asChild needs exactly one element child');
37
+ }
38
+ const routerChild = child;
39
+ const label = routerChild ? routerChild.props.children : children;
40
+ const opensNewWindow = !isDisabled &&
41
+ isLink &&
42
+ (routerChild?.props.target ?? rest.target) ===
43
+ '_blank';
44
+ const inherited = useLocaleContext();
45
+ const content = (jsxs(LocaleProvider, { locale: inherited.locale, children: [leadingVisual != null && (jsx(chakra.span, { "aria-hidden": true, display: "inline-flex", alignItems: "center", flexShrink: 0, children: leadingVisual })), jsx(chakra.span, { ref: labelRef, "data-part": "label", flex: byOrientation(orientation, '1 1 auto', '0 0 auto'), minW: isCollapsed ? '1px' : 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", opacity: isCollapsed ? 0 : 1, animationStyle: "feedback", transitionProperty: "opacity", children: label }), opensNewWindow && (jsx(VisuallyHidden, { children: ` (${translate('nav_list_opens_new_window')})` })), trailingVisual != null && (jsx(chakra.span, { display: "inline-flex", alignItems: "center", flexShrink: 0, ms: "auto", color: isDisabled ? 'disabled.fg' : NAV_LIST_RAMP.trailing, fontWeight: "normal", fontVariantNumeric: "tabular-nums",
46
+ // Fades with the label. `visibility` flips at the END of the fade
47
+ // (it is discrete), which is when the count leaves the row's name.
48
+ opacity: isCollapsed ? 0 : 1, visibility: isCollapsed ? 'hidden' : 'visible', animationStyle: "feedback", transitionProperty: "opacity, visibility", children: trailingVisual }))] }));
49
+ // One tooltip per row, three jobs. Collapsed: the label, beside the icon.
50
+ // `tooltip`: the caller's description. Otherwise: the label again, only
51
+ // while the ellipsis is actually cutting it off.
52
+ const tooltipKind = isCollapsed
53
+ ? 'label'
54
+ : tooltip != null
55
+ ? 'description'
56
+ : 'overflow';
57
+ // The overflow tooltip is gated at the trigger: zag skips opening when the
58
+ // event that would open it was `defaultPrevented`, and the row's own
59
+ // handlers run before zag's. A controlled `open` cannot do this — zag
60
+ // enters its open state first and only re-syncs when the prop CHANGES.
61
+ const restHandlers = rest;
62
+ // A POINTER also waits for the label to finish fading when the rail is
63
+ // toggled, so no tooltip flashes over a row that is still changing shape:
64
+ // the label one only once the label is fully gone, the others only once
65
+ // it is fully back. The next pointermove after the fade opens it. Focus
66
+ // is never held back — a cancelled focus is not re-fired, so a row
67
+ // focused mid-fade would never show its label.
68
+ const isSettled = () => {
69
+ const el = labelRef.current;
70
+ if (!el)
71
+ return true;
72
+ const opacity = parseFloat(getComputedStyle(el).opacity);
73
+ if (Number.isNaN(opacity))
74
+ return true;
75
+ return isCollapsed ? opacity === 0 : opacity === 1;
76
+ };
77
+ const gate = (handler, waitForFade = true) => (event) => {
78
+ if ((waitForFade && !isSettled()) ||
79
+ (tooltipKind === 'overflow' && !isTruncated(labelRef.current)))
80
+ event.preventDefault();
81
+ handler?.(event);
82
+ };
83
+ const tooltipGate = {
84
+ onPointerMove: gate(restHandlers.onPointerMove),
85
+ onPointerOver: gate(restHandlers.onPointerOver),
86
+ onFocus: gate(restHandlers.onFocus, false),
87
+ };
88
+ // The description is a visually hidden element of its own, referenced
89
+ // all the time — not the tooltip, which zag only references while it is
90
+ // open. A disabled row cannot take focus, so a description that existed
91
+ // only while open would never reach a keyboard or screen-reader user,
92
+ // which is exactly when "why is this disabled" matters. The tooltip
93
+ // itself is then never a description (`aria-label` on its root takes its
94
+ // id away), and while it is open the row's own value — the caller's ids,
95
+ // or an empty list — outranks the dangling id zag would leave behind.
96
+ const callerDescribedBy = rest['aria-describedby'];
97
+ const describedBy = [callerDescribedBy, tooltip != null ? descriptionId : undefined]
98
+ .filter(Boolean)
99
+ .join(' ') || (isTooltipOpen ? '' : undefined);
100
+ const describedByProps = { 'aria-describedby': describedBy };
101
+ const handleClick = (event) => {
102
+ // Belt and braces: a disabled `<button>` fires no click and a disabled
103
+ // link has no `href`, so this only guards a caller who forces one.
104
+ if (isDisabled) {
105
+ event.preventDefault();
106
+ return;
107
+ }
108
+ onClick?.(event);
109
+ };
110
+ // `hover`: the action floats over the end of the label instead of keeping
111
+ // its own column, so a resting row spends its full width on the label —
112
+ // the app's HoverRevealedKebab. The row and the action share one grid
113
+ // cell's row; the row spans both columns at rest and gives the second one
114
+ // back to the action when it shows. Only the label's end moves: the row
115
+ // is as tall as it ever was, so nothing below it shifts. Vertical only —
116
+ // a horizontal row is as wide as its label, so there is nothing to give.
117
+ const overlaysAction = trailingActionVisibility === 'hover' &&
118
+ trailingAction != null &&
119
+ !isCollapsed;
120
+ // The fill lives on the `<li>`, not the row, so a trailing action sits on
121
+ // the same surface: hovering the action keeps the row lit, and the current
122
+ // row's fill runs under its action instead of stopping short of it.
123
+ const rowStyles = {
124
+ display: 'flex',
125
+ alignItems: 'center',
126
+ gap: 2,
127
+ flex: byOrientation(orientation, '1 1 auto', '0 0 auto'),
128
+ minW: 0,
129
+ // The same inline padding and start alignment in both modes, so the
130
+ // icon does not move when the rail is toggled: at 2.5 a row is the
131
+ // 40px square around an `sm` icon. The `<li>` is what narrows.
132
+ minH: isCollapsed ? 10 : 9,
133
+ px: 2.5,
134
+ py: 2,
135
+ // Clips the label and count while the rail narrows around them. Only
136
+ // collapsed, so an expanded row never clips a badge or a dot that a
137
+ // visual draws past its own box.
138
+ overflow: isCollapsed ? 'hidden' : undefined,
139
+ borderRadius: 'md',
140
+ border: 'none',
141
+ bg: 'transparent',
142
+ textAlign: 'start',
143
+ textDecoration: 'none',
144
+ textStyle: 'p',
145
+ cursor: 'pointer',
146
+ color: isCurrent ? NAV_LIST_RAMP.currentLabel : NAV_LIST_RAMP.label,
147
+ fontWeight: isCurrent ? 'bold' : 'normal',
148
+ _hover: { textDecoration: 'none' },
149
+ _disabled: { ...disabledText, cursor: 'not-allowed' },
150
+ ...inheritDirection,
151
+ ...(overlaysAction && { gridRow: 1, gridColumn: '1 / -1' }),
152
+ // Inset: rows sit 2px apart and a horizontal rail scrolls, so the
153
+ // outward ring would land on the neighbour or be clipped.
154
+ ...focusRingInset,
155
+ };
156
+ // Both state attributes go on the element that carries the role, and on
157
+ // the router child's own props when there is one (its props win the
158
+ // `asChild` merge). `data-current` is the hook for scroll-to-current.
159
+ const stateProps = {
160
+ 'aria-current': isCurrent ? (isLink ? 'page' : 'true') : undefined,
161
+ 'data-current': isCurrent ? '' : undefined,
162
+ 'data-nav-list-row': '',
163
+ };
164
+ let row;
165
+ if (!isLink) {
166
+ row = (jsx(chakra.button, { ref: ref, type: "button", disabled: isDisabled, ...stateProps, onClick: handleClick, ...rowStyles, ...rest, ...describedByProps, ...tooltipGate, children: content }));
167
+ }
168
+ else {
169
+ const linkProps = {
170
+ ref: ref,
171
+ ...rowStyles,
172
+ ...rest,
173
+ ...describedByProps,
174
+ ...tooltipGate,
175
+ };
176
+ if (isDisabled) {
177
+ // A disabled link has no destination, so it is not rendered as one —
178
+ // not even the router link, which would keep its href for middle-click,
179
+ // "open in new tab" and prefetch. Still announced as a link, with
180
+ // `aria-disabled`, the same way whether or not `asChild` was used. With
181
+ // no `href` it is out of the tab order.
182
+ row = (jsx(chakra.a, { role: "link", "aria-disabled": "true", ...stateProps, ...linkProps, target: undefined, children: content }));
183
+ }
184
+ else if (routerChild) {
185
+ // Our state goes on the CHILD's props, not on the slot: Chakra's
186
+ // `asChild` merge lets the child's own props win, so a router NavLink
187
+ // that sets its own `aria-current` would otherwise contradict
188
+ // `isCurrent`. The child's own click handler still runs, after ours.
189
+ row = (jsx(chakra.a, { asChild: true, ...linkProps, children: cloneElement(routerChild, {
190
+ ...stateProps,
191
+ ...describedByProps,
192
+ onClick: (event) => {
193
+ handleClick(event);
194
+ routerChild.props.onClick?.(event);
195
+ },
196
+ }, content) }));
197
+ }
198
+ else {
199
+ row = (jsx(chakra.a, { href: href, ...stateProps, onClick: handleClick, ...linkProps, children: content }));
200
+ }
201
+ }
202
+ // The two label tooltips name the tooltip itself (`aria-label`), which
203
+ // takes it out of the trigger's description — the row is already called that.
204
+ const tooltipContent = tooltipKind === 'description' ? (tooltip) : isCollapsed && tooltip != null ? (jsxs(Fragment, { children: [label, jsx(Box, { children: tooltip })] })) : (label);
205
+ const labelText = typeof label === 'string' || typeof label === 'number'
206
+ ? String(label)
207
+ : undefined;
208
+ const withTooltip = (jsx(Tooltip, { content: tooltipContent,
209
+ // Beside the icon, towards the content: the rail is on the right of
210
+ // a right-to-left page. Popper placements are physical.
211
+ placement: isCollapsed ? (tooltipDir === 'rtl' ? 'left' : 'right') : 'top', onOpenChange: ({ open }) => setIsTooltipOpen(open), "aria-label": labelText ?? 'tooltip', contentProps: { 'aria-hidden': true }, children: row }));
212
+ const fills = isDisabled
213
+ ? undefined
214
+ : {
215
+ // On the `<li>`, like the hover fill, so the press covers the
216
+ // action's end of the row too — but only a press on the ROW: a
217
+ // press on the action is the action's, and lights its own button.
218
+ // No `>` inside `:has()`: jsdom's selector engine throws on a
219
+ // relative selector, which would break every consumer's tests.
220
+ [PRESSED]: pressedFill,
221
+ };
222
+ // Shown: hovered, focus anywhere in the row, or the action's menu open.
223
+ const shown = [`&:hover > ${ACTION}`, `&:focus-within > ${ACTION}`].join(', ');
224
+ const revealOnHover = trailingActionVisibility === 'hover'
225
+ ? {
226
+ [`& > ${ACTION}`]: { opacity: 0 },
227
+ [shown]: { opacity: 1 },
228
+ // Its own rule: `:has()` is not forgiving, and a browser without
229
+ // it would drop every selector listed beside it.
230
+ [`& > ${ACTION}:has([aria-expanded="true"], [data-state="open"])`]: { opacity: 1 },
231
+ // Touch: always shown, and with its space kept.
232
+ [NO_HOVER]: {
233
+ [`& > ${ACTION}`]: { opacity: 1 },
234
+ ...(overlaysAction && { [`& > ${ROW}`]: { gridColumn: 1 } }),
235
+ },
236
+ ...(overlaysAction && {
237
+ // The row gives the action its column back exactly when the
238
+ // action shows, so the label ends before it.
239
+ [`&:hover > ${ROW}, &:focus-within > ${ROW}`]: { gridColumn: 1 },
240
+ [`&:has(${ACTION} [aria-expanded="true"], ${ACTION} [data-state="open"]) > ${ROW}`]: { gridColumn: 1 },
241
+ }),
242
+ }
243
+ : undefined;
244
+ return (jsxs(chakra.li, { display: overlaysAction ? byOrientation(orientation, 'grid', 'flex') : 'flex', gridTemplateColumns: overlaysAction ? 'minmax(0, 1fr) auto' : undefined, alignItems: "center", gap: 0.5, flexShrink: 0, minW: 0,
245
+ // Narrows to the square when the rail collapses, on the label's clock,
246
+ // so the fill shrinks with the rail instead of snapping to 40px.
247
+ maxW: isCollapsed ? 10 : byOrientation(orientation, '100%', 'none'), animationStyle: "feedback", transitionProperty: "max-width", borderRadius: "md", bg: isCurrent ? NAV_LIST_RAMP.currentFill : 'transparent', _hover: isDisabled
248
+ ? undefined
249
+ : {
250
+ bg: NAV_LIST_RAMP.hoverFill,
251
+ // Again inside hover: Chakra's hover rule is as specific as the
252
+ // press rule and comes later, so a pointer press would lose.
253
+ [PRESSED]: pressedFill,
254
+ }, css: { ...fills, ...revealOnHover }, children: [jsx(LocaleProvider, { locale: localeFor(inherited, tooltipDir), children: withTooltip }), tooltip != null && (
255
+ // `hidden`, not visually hidden: a description reference still
256
+ // reads hidden text, and browse mode does not read it a second time.
257
+ jsx(chakra.span, { id: descriptionId, hidden: true, children: tooltip })), trailingAction != null && !isCollapsed && (jsx(chakra.span, { "data-part": "trailing-action", display: "inline-flex", alignItems: "center", flexShrink: 0, pe: 0.5, ...(overlaysAction && {
258
+ gridRow: 1,
259
+ gridColumn: 2,
260
+ position: 'relative',
261
+ zIndex: 1,
262
+ }), children: trailingAction }))] }));
263
+ });
264
+ NavListItem.displayName = 'NavList.Item';
265
+
266
+ export { NavListItem };
267
+ //# sourceMappingURL=NavListItem.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavListItem.mjs","sources":["../../../src/components/NavList/NavListItem.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","_Fragment"],"mappings":";;;;;;;;;;;;AAwDA;AACA;AACA;AACA,MAAM,GAAG,GAAG,qBAAqB;AACjC,MAAM,MAAM,GAAG,+BAA+B;AAC9C;AACA,MAAM,QAAQ,GAAG,yCAAyC;AAC1D;AACA,MAAM,OAAO,GAAG,CAAA,MAAA,EAAS,GAAG,UAAU;AAEtC,MAAM,WAAW,GAAG,CAAC,EAAsB,KACzC,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,GAAG,CAAC;MAEtC,WAAW,GAAG,UAAU,CACnC,CACE,EAC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,EAAE,CAAC;AACV,iBAAA,CAAC,YAED,cAAc,EAAA,CACH,CACf,CAAA,EAAA,CACS;AAEhB,CAAC;AAGH,WAAW,CAAC,WAAW,GAAG,cAAc;;;;"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Placeholder rows while a rail's entries load, with the same row height,
3
+ * radius and gap as the real list, so nothing moves when it swaps in.
4
+ *
5
+ * Render it INSTEAD of the `NavList`, not inside it. It is `aria-hidden`: a
6
+ * column of grey bars says nothing to a screen reader, and "loading" belongs
7
+ * to the region that is loading (`aria-busy`, or a status message) rather
8
+ * than to one of its placeholders.
9
+ *
10
+ * Counts that are still loading are not this — leave `trailingVisual` unset
11
+ * until they arrive, and the row keeps its label.
12
+ */
13
+ export declare const NavListSkeleton: import("react").ForwardRefExoticComponent<Omit<import("@chakra-ui/react").HTMLChakraProps<"ul">, "children"> & {
14
+ count?: number;
15
+ orientation?: import("./NavList.types").NavListResponsiveOrientation;
16
+ } & import("react").RefAttributes<HTMLUListElement>>;
17
+ //# sourceMappingURL=NavListSkeleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavListSkeleton.d.ts","sourceRoot":"","sources":["../../../src/components/NavList/NavListSkeleton.tsx"],"names":[],"mappings":"AASA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe;;;oDAiC1B,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var React = require('react');
6
+ var react = require('@chakra-ui/react');
7
+ var NavList_styles = require('./NavList.styles.js');
8
+
9
+ /** Widths that vary row to row, so the placeholder does not read as a table. */
10
+ const WIDTHS = ['72%', '56%', '84%', '64%', '48%', '76%'];
11
+ /**
12
+ * Placeholder rows while a rail's entries load, with the same row height,
13
+ * radius and gap as the real list, so nothing moves when it swaps in.
14
+ *
15
+ * Render it INSTEAD of the `NavList`, not inside it. It is `aria-hidden`: a
16
+ * column of grey bars says nothing to a screen reader, and "loading" belongs
17
+ * to the region that is loading (`aria-busy`, or a status message) rather
18
+ * than to one of its placeholders.
19
+ *
20
+ * Counts that are still loading are not this — leave `trailingVisual` unset
21
+ * until they arrive, and the row keeps its label.
22
+ */
23
+ const NavListSkeleton = React.forwardRef(({ count = 5, orientation = 'vertical', ...rest }, ref) => (jsxRuntime.jsx(react.chakra.ul, { ref: ref, "aria-hidden": true, ...NavList_styles.listStyles(orientation), ...rest, children: Array.from({ length: count }, (_, i) => (jsxRuntime.jsxs(react.chakra.li, { display: "flex", alignItems: "center", flexShrink: 0,
24
+ // The row's own box: `minH`, padding and one line of `p` text, so
25
+ // the placeholder is exactly as tall as the row that replaces it.
26
+ minH: 9, px: 2.5, py: 2, textStyle: "p", w: NavList_styles.byOrientation(orientation, 'auto', '96px'), children: [jsxRuntime.jsx(react.Skeleton, { h: 4, w: NavList_styles.byOrientation(orientation, WIDTHS[i % WIDTHS.length], 'full'), borderRadius: "sm",
27
+ // A placeholder that stops pulsing is still a placeholder; there
28
+ // is no progress for the motion to carry.
29
+ _motionReduce: { animation: 'none' } }), jsxRuntime.jsx(react.chakra.span, { w: 0, overflow: "hidden", children: '\u00A0' })] }, i))) })));
30
+ NavListSkeleton.displayName = 'NavList.Skeleton';
31
+
32
+ exports.NavListSkeleton = NavListSkeleton;
33
+ //# sourceMappingURL=NavListSkeleton.js.map