@plexui/ui 0.42.0 → 0.43.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.
Files changed (77) hide show
  1. package/dist/es/components/Alert/Alert.js +12 -2
  2. package/dist/es/components/Alert/Alert.js.map +1 -1
  3. package/dist/es/components/ColorPicker/ColorPicker.js +12 -10
  4. package/dist/es/components/ColorPicker/ColorPicker.js.map +1 -1
  5. package/dist/es/components/ColorPicker/ColorWell.js +1 -1
  6. package/dist/es/components/ColorPicker/ColorWell.js.map +1 -1
  7. package/dist/es/components/ColorPicker/shared.js +5 -4
  8. package/dist/es/components/ColorPicker/shared.js.map +1 -1
  9. package/dist/es/components/ContextMenu/ContextMenu.js +9 -9
  10. package/dist/es/components/ContextMenu/ContextMenu.js.map +1 -1
  11. package/dist/es/components/ContextMenu/shared.js +25 -5
  12. package/dist/es/components/ContextMenu/shared.js.map +1 -1
  13. package/dist/es/components/DatePicker/DatePicker.js +3 -3
  14. package/dist/es/components/DatePicker/DatePicker.js.map +1 -1
  15. package/dist/es/components/DatePicker/useCalendarCollisionPadding.js +25 -0
  16. package/dist/es/components/DatePicker/useCalendarCollisionPadding.js.map +1 -0
  17. package/dist/es/components/DateRangePicker/DateRangePicker.js +3 -3
  18. package/dist/es/components/DateRangePicker/DateRangePicker.js.map +1 -1
  19. package/dist/es/components/Dialog/Dialog.js +1 -1
  20. package/dist/es/components/Dialog/Dialog.js.map +1 -1
  21. package/dist/es/components/Input/Input.js +1 -1
  22. package/dist/es/components/Input/Input.js.map +1 -1
  23. package/dist/es/components/Menu/Menu.js +15 -2
  24. package/dist/es/components/Menu/Menu.js.map +1 -1
  25. package/dist/es/components/PhoneLayout/PhoneLayout.js +6 -1
  26. package/dist/es/components/PhoneLayout/PhoneLayout.js.map +1 -1
  27. package/dist/es/components/Popover/Popover.js.map +1 -1
  28. package/dist/es/components/ProgressSteps/ProgressSteps.js +1 -1
  29. package/dist/es/components/ProgressSteps/ProgressSteps.js.map +1 -1
  30. package/dist/es/components/ProgressSteps/index.js.map +1 -1
  31. package/dist/es/components/Select/Select.js +155 -25
  32. package/dist/es/components/Select/Select.js.map +1 -1
  33. package/dist/es/components/SelectControl/SelectControl.js +1 -1
  34. package/dist/es/components/SelectControl/SelectControl.js.map +1 -1
  35. package/dist/es/components/Slider/Slider.js +19 -12
  36. package/dist/es/components/Slider/Slider.js.map +1 -1
  37. package/dist/es/components/Sortable/Sortable.js +1 -1
  38. package/dist/es/components/Sortable/Sortable.js.map +1 -1
  39. package/dist/es/components/StatCard/index.js +5 -1
  40. package/dist/es/components/StatCard/index.js.map +1 -1
  41. package/dist/es/components/StatsCard/StatsCard.js +48 -0
  42. package/dist/es/components/StatsCard/StatsCard.js.map +1 -0
  43. package/dist/es/components/StatsCard/index.js +2 -0
  44. package/dist/es/components/StatsCard/index.js.map +1 -0
  45. package/dist/es/components/SwipeActions/SwipeActions.js +30 -8
  46. package/dist/es/components/SwipeActions/SwipeActions.js.map +1 -1
  47. package/dist/es/components/TabBar/TabBar.js +11 -4
  48. package/dist/es/components/TabBar/TabBar.js.map +1 -1
  49. package/dist/es/components/Tabs/Tabs.js +200 -7
  50. package/dist/es/components/Tabs/Tabs.js.map +1 -1
  51. package/dist/es/components/Toolbar/Toolbar.js.map +1 -1
  52. package/dist/es/lib/menuTriggerCover.js +40 -3
  53. package/dist/es/lib/menuTriggerCover.js.map +1 -1
  54. package/dist/types/components/ColorPicker/ColorPicker.d.ts +3 -2
  55. package/dist/types/components/ColorPicker/shared.d.ts +5 -4
  56. package/dist/types/components/ContextMenu/shared.d.ts +28 -6
  57. package/dist/types/components/DatePicker/useCalendarCollisionPadding.d.ts +8 -0
  58. package/dist/types/components/Dialog/Dialog.d.ts +1 -1
  59. package/dist/types/components/PhoneLayout/PhoneLayout.d.ts +5 -0
  60. package/dist/types/components/Popover/Popover.d.ts +2 -2
  61. package/dist/types/components/ProgressSteps/ProgressSteps.d.ts +11 -4
  62. package/dist/types/components/ProgressSteps/index.d.ts +1 -1
  63. package/dist/types/components/Select/Select.d.ts +11 -3
  64. package/dist/types/components/StatCard/index.d.ts +5 -1
  65. package/dist/types/components/{StatCard/StatCard.d.ts → StatsCard/StatsCard.d.ts} +7 -7
  66. package/dist/types/components/StatsCard/index.d.ts +1 -0
  67. package/dist/types/components/SwipeActions/SwipeActions.d.ts +1 -1
  68. package/dist/types/components/TabBar/TabBar.d.ts +12 -2
  69. package/dist/types/components/Tabs/Tabs.d.ts +12 -0
  70. package/dist/types/components/Toolbar/Toolbar.d.ts +1 -1
  71. package/dist/types/lib/menuTriggerCover.d.ts +16 -2
  72. package/package.json +2 -2
  73. package/dist/es/components/DatePicker/useCalendarGutter.js +0 -8
  74. package/dist/es/components/DatePicker/useCalendarGutter.js.map +0 -1
  75. package/dist/es/components/StatCard/StatCard.js +0 -39
  76. package/dist/es/components/StatCard/StatCard.js.map +0 -1
  77. package/dist/types/components/DatePicker/useCalendarGutter.d.ts +0 -1
@@ -19,10 +19,11 @@ export const Tabs = ({ overflow = "scroll", overflowLabel = "More", ...props })
19
19
  }
20
20
  return _jsx(TabsRoot, { ...props });
21
21
  };
22
- const TabsRoot = ({ value, onChange, children, variant = "segmented", orientation = "horizontal", block, pill = true, flush, size = "md", gutterSize, className, onClick, ...restProps }) => {
22
+ const TabsRoot = ({ value, onChange, children, variant = "segmented", orientation = "horizontal", block, pill = true, flush, size = "md", gutterSize, mobileMaterial, className, onClick, ...restProps }) => {
23
23
  const rootRef = useRef(null);
24
24
  const thumbRef = useRef(null);
25
25
  const prevSizeRef = useRef(size);
26
+ const prevValueRef = useRef(value);
26
27
  const isVertical = orientation === "vertical";
27
28
  const applyThumbSizing = useCallback((attemptScroll) => {
28
29
  const root = rootRef.current;
@@ -126,8 +127,8 @@ const TabsRoot = ({ value, onChange, children, variant = "segmented", orientatio
126
127
  return () => observer.disconnect();
127
128
  }, [applyThumbSizing]);
128
129
  const transitionProperty = isVertical
129
- ? "height var(--tabs-thumb-transition-duration, 200ms) var(--cubic-enter), transform var(--tabs-thumb-transition-duration, 200ms) var(--cubic-enter)"
130
- : "width var(--tabs-thumb-transition-duration, 200ms) var(--cubic-enter), transform var(--tabs-thumb-transition-duration, 200ms) var(--cubic-enter)";
130
+ ? "height var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter)), transform var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter))"
131
+ : "width var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter)), transform var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter))";
131
132
  useLayoutEffect(() => {
132
133
  const root = rootRef.current;
133
134
  const thumb = thumbRef.current;
@@ -136,6 +137,8 @@ const TabsRoot = ({ value, onChange, children, variant = "segmented", orientatio
136
137
  }
137
138
  const sizeChanged = prevSizeRef.current !== size;
138
139
  prevSizeRef.current = size;
140
+ const valueChanged = prevValueRef.current !== value;
141
+ prevValueRef.current = value;
139
142
  if (sizeChanged) {
140
143
  // Size changed - disable transition, wait for CSS, then apply sizing
141
144
  const currentTransition = thumb.style.transition;
@@ -149,7 +152,10 @@ const TabsRoot = ({ value, onChange, children, variant = "segmented", orientatio
149
152
  }
150
153
  else if (thumb.style.transition) {
151
154
  // Normal update (value change, etc.): the thumb leaves with the label's colour
155
+ const from = valueChanged ? thumbBox(thumb) : null;
152
156
  applyThumbSizing(true);
157
+ if (valueChanged)
158
+ playThumbLens(thumb, from);
153
159
  }
154
160
  else {
155
161
  // First measure: apply transition after initial calculation is set
@@ -171,17 +177,204 @@ const TabsRoot = ({ value, onChange, children, variant = "segmented", orientatio
171
177
  const isPill = variant === "segmented" && pill;
172
178
  // Only apply flush for underline variant
173
179
  const isFlush = variant === "underline" && flush;
174
- return (_jsxs(ToggleGroup.Root, { ref: rootRef, className: clsx(s.Tabs, className), type: "single", value: value, loop: false, onValueChange: handleValueChange, onClick: onClick, "data-variant": variant, "data-orientation": orientation, "data-block": block ? "" : undefined, "data-pill": isPill ? "" : undefined, "data-flush": isFlush ? "" : undefined, "data-size": size, "data-gutter-size": gutterSize, "data-disabled": restProps.disabled ? "" : undefined, ...restProps, children: [_jsx("div", { className: s.TabsThumb, ref: thumbRef }), _jsx(TabsVerticalContext.Provider, { value: isVertical, children: children })] }));
180
+ return (_jsxs(ToggleGroup.Root, { ref: rootRef, className: clsx(s.Tabs, className), type: "single", value: value, loop: false, onValueChange: handleValueChange, onClick: onClick, "data-variant": variant, "data-orientation": orientation, "data-block": block ? "" : undefined, "data-pill": isPill ? "" : undefined, "data-flush": isFlush ? "" : undefined, "data-size": size, "data-gutter-size": gutterSize, "data-mobile-material": mobileMaterial, "data-disabled": restProps.disabled ? "" : undefined, ...restProps, children: [_jsx("div", { className: s.TabsThumb, ref: thumbRef }), _jsx(TabsVerticalContext.Provider, { value: isVertical, children: children })] }));
175
181
  };
176
182
  // Type guard for badge object form
177
183
  const isBadgeObject = (badge) => {
178
184
  return badge != null && typeof badge === "object" && "content" in badge;
179
185
  };
186
+ /** True when an icon draws text of its own: a string, a number, or a fragment or array holding one */
187
+ /** A text icon ("☀") stands in an element, as an icon component does, so a phone can hide it beside a label: each
188
+ * text in a fragment or array gets its own span and the elements beside it stay in place. An empty one draws
189
+ * nothing. */
190
+ // Arrays and fragments always go through Children.map, with or without text, so their children keep the same keys
191
+ // when a text child comes or goes; a fragment keeps its element and key, so a new key still remounts its icons.
192
+ /** On a phone the large control's selection travels as a lens of glass, as iOS 27.2 draws it. Recorded frame by frame
193
+ * 11.11 (ref-app segmented-bar-text4, a toolbar Picker of Day, Week, Month and Year switched Day to Year and back,
194
+ * after the owner's «анимация не правильная и стиль» and «day<->year пробуй переключать»; segmented-bar-symbols, a
195
+ * segment away, before it): the gray selection clears into a lens within 45ms, taller than the capsule (11pt) and
196
+ * wider the faster it goes (36pt at 200ms), and carries across; it lands as the gray selection again by 300ms,
197
+ * pressed against its segment's far side (7pt narrower, 6pt taller and its centre 2.5% of the way past at 430ms), and
198
+ * springs back by 750ms while the label under it dims to 76% and comes back. The centre's path is a share of the
199
+ * distance and the growth is in points, as both recordings show: as much growth a segment away as three. touch.css
200
+ * names the lens's growth on the large control only, so everywhere else the selection just slides with its
201
+ * transition. CSS has no refraction, so the lens is its rim, its tint and the capsule's edge seen through it. */
202
+ let lensRun = 0;
203
+ const LENS_ID = "segmented-control-lens";
204
+ const LENS_DURATION = 750;
205
+ // At each measured frame: [ms, the centre's share of the distance, share of the growth's width, share of its height]
206
+ const LENS_PATH = [
207
+ [0, 0, 0, 0],
208
+ [10, 0.014, 0.036, 0.065],
209
+ [32, 0.077, 0.13, 0.19],
210
+ [47, 0.169, 0.22, 0.44],
211
+ [70, 0.378, 0.44, 0.87],
212
+ [92, 0.478, 0.52, 1],
213
+ [125, 0.647, 0.7, 0.93],
214
+ [150, 0.773, 0.85, 0.87],
215
+ [182, 0.856, 0.96, 0.93],
216
+ [205, 0.9, 1, 1],
217
+ [227, 0.932, 0.96, 0.93],
218
+ [245, 0.951, 0.8, 0.44],
219
+ [262, 0.964, 0.67, 0.31],
220
+ [295, 0.989, 0.37, 0.31],
221
+ [330, 1.005, 0.13, 0.31],
222
+ [363, 1.016, -0.02, 0.37],
223
+ [395, 1.023, -0.13, 0.5],
224
+ [430, 1.025, -0.19, 0.56],
225
+ [497, 1.022, -0.19, 0.56],
226
+ [545, 1.018, -0.17, 0.37],
227
+ [597, 1.014, -0.11, 0.25],
228
+ [647, 1.007, -0.075, 0.12],
229
+ [697, 1.004, -0.036, 0],
230
+ [750, 1, 0, 0],
231
+ ];
232
+ // The selected label's opacity as the lens lands: [ms, opacity]
233
+ const LENS_LABEL = [
234
+ [0, 1],
235
+ [380, 1],
236
+ [428, 0.77],
237
+ [460, 0.76],
238
+ [515, 0.85],
239
+ [580, 0.93],
240
+ [650, 0.98],
241
+ [713, 1],
242
+ [750, 1],
243
+ ];
244
+ const lensRuns = new WeakMap();
245
+ const round = (value) => Math.round(value * 100) / 100;
246
+ // The box the lens draws at a time of its run
247
+ const lensBox = ({ from, to }, ms, growth) => {
248
+ const next = LENS_PATH.findIndex(([time]) => time >= ms);
249
+ const at = next < 0 ? LENS_PATH.length - 1 : Math.max(1, next);
250
+ const [t0, share0, wide0] = LENS_PATH[at - 1];
251
+ const [t1, share1, wide1] = LENS_PATH[Math.min(at, LENS_PATH.length - 1)];
252
+ const k = t1 > t0 ? Math.min(1, Math.max(0, (ms - t0) / (t1 - t0))) : 1;
253
+ const share = share0 + (share1 - share0) * k;
254
+ const width = from.width + (to.width - from.width) * Math.min(share, 1) + growth * (wide0 + (wide1 - wide0) * k);
255
+ return { x: from.x + from.width / 2 + (to.x + to.width / 2 - from.x - from.width / 2) * share - width / 2, width };
256
+ };
257
+ /** Where a horizontal thumb is drawn, from its control's left edge: where the script set it, or where a lens still
258
+ * on its way has it, so a switch mid-flight sets off from there */
259
+ const thumbBox = (thumb) => {
260
+ const offset = /^translateX\((-?[\d.]+)px\)$/.exec(thumb.style.transform);
261
+ const width = parseFloat(thumb.style.width);
262
+ if (!offset || !(width > 0))
263
+ return null;
264
+ const run = lensRuns.get(thumb);
265
+ const ms = Number(run?.move.currentTime);
266
+ if (run && (run.move.playState === "running" || run.move.playState === "paused") && ms >= 0) {
267
+ const growth = lensGrowth(getComputedStyle(thumb));
268
+ if (growth)
269
+ return lensBox(run, ms, growth[0]);
270
+ }
271
+ return { x: parseFloat(offset[1]), width };
272
+ };
273
+ // The lens's growth at its widest and tallest, which touch.css names on the large control only
274
+ const lensGrowth = (style) => {
275
+ const [wide = Number.NaN, tall = wide] = style.getPropertyValue("--segmented-control-thumb-lens-outset").trim().split(/\s+/).map(parseFloat);
276
+ return wide >= 0 && tall >= 0 ? [wide, tall] : null;
277
+ };
278
+ const playThumbLens = (thumb, from) => {
279
+ if (typeof thumb.animate !== "function")
280
+ return;
281
+ // A lens still on its way ends first, so the thumb's own fill and edge are read below (and none outlives a switch
282
+ // to reduced motion)
283
+ thumb.getAnimations().forEach((animation) => {
284
+ if (animation.id === LENS_ID)
285
+ animation.cancel();
286
+ });
287
+ lensRuns.get(thumb)?.label?.cancel();
288
+ lensRuns.delete(thumb);
289
+ if (!from || prefersReducedMotion())
290
+ return;
291
+ const style = getComputedStyle(thumb);
292
+ const growth = lensGrowth(style);
293
+ const to = thumbBox(thumb);
294
+ const top = parseFloat(style.top);
295
+ const bottom = parseFloat(style.bottom);
296
+ if (!growth || !to || !Number.isFinite(top) || !Number.isFinite(bottom))
297
+ return;
298
+ const [wide, tall] = growth;
299
+ const timing = { id: LENS_ID, duration: LENS_DURATION };
300
+ const run = { from, to, move: undefined };
301
+ // The thumb's box at each frame replaces its own while the lens runs (its transition is overridden); the height
302
+ // grows about the middle
303
+ run.move = thumb.animate(LENS_PATH.map(([ms, , , high]) => {
304
+ const box = lensBox(run, ms, wide);
305
+ const grown = (tall * high) / 2;
306
+ return {
307
+ offset: ms / LENS_DURATION,
308
+ transform: `translateX(${round(box.x)}px)`,
309
+ width: `${round(Math.max(1, box.width))}px`,
310
+ top: `${round(top - grown)}px`,
311
+ bottom: `${round(bottom - grown)}px`,
312
+ };
313
+ }), timing);
314
+ const lens = {
315
+ backgroundColor: style.getPropertyValue("--segmented-control-thumb-lens-background").trim(),
316
+ boxShadow: style.getPropertyValue("--segmented-control-thumb-lens-shadow").trim(),
317
+ };
318
+ const rest = { backgroundColor: style.backgroundColor, boxShadow: style.boxShadow };
319
+ // The gray clears as the lens lifts (45ms) and comes back as it lands (250 to 300ms)
320
+ const fill = thumb.animate([
321
+ { offset: 0, ...rest },
322
+ { offset: 45 / LENS_DURATION, ...lens },
323
+ { offset: 250 / LENS_DURATION, ...lens },
324
+ { offset: 300 / LENS_DURATION, ...rest },
325
+ { offset: 1, ...rest },
326
+ ], timing);
327
+ const root = thumb.parentElement;
328
+ const selected = root?.querySelector('[data-state="on"]');
329
+ if (selected && typeof selected.animate === "function") {
330
+ run.label = selected.animate(LENS_LABEL.map(([ms, opacity]) => ({ offset: ms / LENS_DURATION, opacity })), timing);
331
+ }
332
+ lensRuns.set(thumb, run);
333
+ // The frame a switch is drawn in also lays out whatever the switch changes around the control, which can take a
334
+ // few frames' time; the lens holds its first frame until then and sets off from the next, so none of its way is
335
+ // skipped (a tap's first 45ms were, recorded in Safari 11.11)
336
+ if (typeof requestAnimationFrame === "function") {
337
+ const held = [run.move, fill, run.label].filter((animation) => typeof animation?.pause === "function");
338
+ held.forEach((animation) => animation.pause());
339
+ requestAnimationFrame(() => {
340
+ held.forEach((animation) => {
341
+ if (animation.playState === "paused")
342
+ animation.play();
343
+ });
344
+ });
345
+ }
346
+ // The lens reaches past the capsule, which clips what scrolls in it: a control whose segments all fit lets it out
347
+ // for the switch
348
+ if (!root || root.scrollWidth > root.clientWidth + 1)
349
+ return;
350
+ const id = String(++lensRun);
351
+ root.setAttribute("data-lens", id);
352
+ const done = () => {
353
+ if (root.getAttribute("data-lens") === id)
354
+ root.removeAttribute("data-lens");
355
+ };
356
+ if (run.move?.finished)
357
+ run.move.finished.then(done, done);
358
+ else
359
+ done();
360
+ };
361
+ const renderTabIcon = (icon) => {
362
+ if (icon === "")
363
+ return null;
364
+ if (typeof icon === "string" || typeof icon === "number")
365
+ return _jsx("span", { children: icon });
366
+ if (Array.isArray(icon))
367
+ return Children.map(icon, renderTabIcon);
368
+ if (isValidElement(icon) && icon.type === Fragment) {
369
+ return cloneElement(icon, undefined, Children.map(icon.props.children, renderTabIcon));
370
+ }
371
+ return icon;
372
+ };
180
373
  const Tab = ({ children, icon, badge, ...restProps }) => {
181
374
  // Normalize badge prop
182
375
  const badgeProps = badge != null ? (isBadgeObject(badge) ? badge : { content: badge }) : null;
183
376
  const vertical = useContext(TabsVerticalContext);
184
- return (_jsxs(ToggleGroup.Item, { className: s.Tab, ...restProps, onPointerEnter: handlePressableMouseEnter, children: [_jsxs("span", { className: s.TabContent, children: [icon, children && _jsx("span", { className: s.TabLabel, children: children }), badgeProps && (_jsx("span", { className: s.TabBadge, "data-color": badgeProps.color ?? "secondary", "data-variant": badgeProps.variant ?? "soft", "data-pill": badgeProps.pill ? "" : undefined, children: badgeProps.loading ? _jsx(LoadingIndicator, {}) : badgeProps.content }))] }), vertical && _jsx(CheckMd, { className: s.TabCheckmark, "aria-hidden": "true" })] }));
377
+ return (_jsxs(ToggleGroup.Item, { className: s.Tab, ...restProps, onPointerEnter: handlePressableMouseEnter, children: [_jsxs("span", { className: s.TabContent, children: [renderTabIcon(icon), children && _jsx("span", { className: s.TabLabel, children: children }), badgeProps && (_jsx("span", { className: s.TabBadge, "data-color": badgeProps.color ?? "secondary", "data-variant": badgeProps.variant ?? "soft", "data-pill": badgeProps.pill ? "" : undefined, children: badgeProps.loading ? _jsx(LoadingIndicator, {}) : badgeProps.content }))] }), vertical && _jsx(CheckMd, { className: s.TabCheckmark, "aria-hidden": "true" })] }));
185
378
  };
186
379
  // =============================================
187
380
  // overflow="menu"
@@ -224,8 +417,8 @@ const MoreTab = (props) => {
224
417
  const OverflowTabs = ({ children, value, onChange, overflowLabel, ...restProps }) => {
225
418
  const items = tabElements(children);
226
419
  // The strip's own props size the tabs and the menu button too
227
- const { size, variant, gutterSize, pill, flush } = restProps;
228
- const signature = [overflowLabel, size, variant, gutterSize, pill, flush, tabsSignature(items)].join("\u0002");
420
+ const { size, variant, gutterSize, pill, flush, mobileMaterial } = restProps;
421
+ const signature = [overflowLabel, size, variant, gutterSize, pill, flush, mobileMaterial, tabsSignature(items)].join("\u0002");
229
422
  const activeIndex = items.findIndex((item) => item.props.value === value);
230
423
  // null while the measuring pass renders every tab and the menu button
231
424
  const [visibleCount, setVisibleCount] = useState(null);
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EACL,QAAQ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EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,QAAQ,EAAE,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,aAElD,IAAI,CAAC,KAAK,CAAC,IAAI,EACf,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAEnE,KAAK,KAAK,EAAE,IAAI,eAAM,SAAS,EAAE,CAAC,CAAC,aAAa,YAAG,KAAK,GAAQ,KAP5D,IAAI,CAAC,KAAK,CAAC,KAAK,CAQN,CAClB,CAAA;wBACH,CAAC,CAAC,GACc,GACL,IACV,GACH,CACP,CAAA;AACH,CAAC,CAAA;AAED,wBAAwB;AACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;AACd,wBAAwB;AACxB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { ToggleGroup } from \"radix-ui\"\nimport {\n Children,\n cloneElement,\n createContext,\n Fragment,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport { useResizeObserver } from \"usehooks-ts\"\nimport { handlePressableMouseEnter, prefersReducedMotion, waitForAnimationFrame } from \"../../lib/helpers\"\nimport { type ControlSize, type SemanticColors, type Sizes, type Variants } from \"../../types\"\nimport { CheckMd, ChevronDownMd } from \"../Icon\"\nimport { LoadingIndicator } from \"../Indicator\"\nimport { Menu } from \"../Menu\"\nimport { visibleTabCount } from \"./overflow\"\nimport s from \"@plexui/styles/components/Tabs/Tabs.module.css\"\n\nexport type SizeVariant = \"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\"\n\nexport type TabsVariant = \"segmented\" | \"underline\"\nexport type TabsOrientation = \"horizontal\" | \"vertical\"\n\nexport type TabsProps<T extends string> = {\n /**\n * Controlled value for the group\n */\n \"value\": T\n /** Callback for when a new value is selected */\n \"onChange\"?: (nextValue: T) => void\n /** Callback any time the control is clicked (even if a new value was not selected) */\n \"onClick\"?: () => void\n /**\n * Text read aloud to screen readers when the control is focused\n */\n \"aria-label\": string\n /**\n * Visual variant of the tab group\n * - `\"segmented\"` — background container with sliding highlight (default)\n * - `\"underline\"` — no background, animated line indicator under active tab\n * @default \"segmented\"\n */\n \"variant\"?: TabsVariant\n /**\n * Orientation of the tab layout\n * @default \"horizontal\"\n */\n \"orientation\"?: TabsOrientation\n /**\n * Controls the size of the tabs\n *\n * | 3xs | 2xs | xs | sm | md | lg | xl | 2xl | 3xl |\n * | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |\n * | `22px` | `24px` | `26px` | `28px` | `32px` | `36px` | `40px` | `44px` | `48px` |\n *\n * @default md\n */\n \"size\"?: ControlSize\n /**\n * Controls gutter on the edges of the button, defaults to value from `size`.\n *\n * | 2xs | xs | sm | md | lg | xl |\n * | ------ | ------ | ------ | ------ | ------ | ------ |\n * | `6px` | `8px` | `10px` | `12px` | `14px` | `16px` |\n */\n \"gutterSize\"?: Sizes<\"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\">\n /** Disable the entire group */\n \"disabled\"?: boolean\n /**\n * Display the control as a block element with equal width segments\n * @default false\n */\n \"block\"?: boolean\n /**\n * Determines if the tabs should be a fully rounded pill shape.\n * Only applies to the `\"segmented\"` variant.\n * @default true\n */\n \"pill\"?: boolean\n /**\n * Flush underline style — removes tab padding so the indicator\n * matches the text width exactly, uses gap for spacing, and\n * removes the bottom border.\n * Only applies to the `\"underline\"` variant.\n * @default false\n */\n \"flush\"?: boolean\n /**\n * What happens to tabs that do not fit in one row: the strip scrolls\n * sideways (`scroll`), or the tabs that do not fit move into a menu at the\n * end of the strip (`menu`). The menu button shows the active tab's name\n * when it is one of the hidden ones. Horizontal tabs without `block` only.\n * @default \"scroll\"\n */\n \"overflow\"?: \"scroll\" | \"menu\"\n /**\n * Text of the menu button with `overflow=\"menu\"`\n * @default \"More\"\n */\n \"overflowLabel\"?: string\n \"className\"?: string\n \"children\": React.ReactNode\n}\n\n/** Vertical tabs are a list on a phone, where the selected row shows a checkmark */\nconst TabsVerticalContext = createContext(false)\n\nexport const Tabs = <T extends string>({ overflow = \"scroll\", overflowLabel = \"More\", ...props }: TabsProps<T>) => {\n if (overflow === \"menu\" && !props.block && props.orientation !== \"vertical\") {\n return <OverflowTabs {...props} overflowLabel={overflowLabel} />\n }\n return <TabsRoot {...props} />\n}\n\nconst TabsRoot = <T extends string>({\n value,\n onChange,\n children,\n variant = \"segmented\",\n orientation = \"horizontal\",\n block,\n pill = true,\n flush,\n size = \"md\",\n gutterSize,\n className,\n onClick,\n ...restProps\n}: Omit<TabsProps<T>, \"overflow\" | \"overflowLabel\">) => {\n const rootRef = useRef<HTMLDivElement>(null)\n const thumbRef = useRef<HTMLDivElement>(null)\n const prevSizeRef = useRef(size)\n const isVertical = orientation === \"vertical\"\n\n const applyThumbSizing = useCallback(\n (attemptScroll: boolean) => {\n const root = rootRef.current\n const thumb = thumbRef.current\n\n if (!root || !thumb) {\n return\n }\n\n // Get selected node\n const activeNode = root?.querySelector<HTMLDivElement>('[data-state=\"on\"]')\n\n // Impossible\n if (!activeNode) {\n return\n }\n\n if (isVertical) {\n const rootHeight = root.clientHeight\n let targetHeight = Math.floor(activeNode.clientHeight)\n const targetOffset = activeNode.offsetTop\n\n // Detect subpixel edge case\n if (rootHeight - (targetHeight + targetOffset) < 2) {\n targetHeight = targetHeight - 1\n }\n\n thumb.style.height = `${Math.floor(targetHeight)}px`\n thumb.style.width = \"\"\n thumb.style.transform = `translateY(${targetOffset}px)`\n\n // Scroll into view if needed\n if (root.scrollHeight > rootHeight) {\n const buffer = rootHeight * 0.15\n const scrollTop = root.scrollTop\n const top = activeNode.offsetTop\n const bottom = top + targetHeight\n if (top < scrollTop + buffer || bottom > scrollTop + rootHeight - buffer) {\n if (attemptScroll) {\n // Scroll the control only: scrollIntoView also scrolls the page to it (a switch to Phone\n // re-rendered a control far down the page and slid the page to it, owner 08.11)\n root.scrollTo({ top: top - (rootHeight - targetHeight) / 2, behavior: prefersReducedMotion() ? \"auto\" : \"smooth\" })\n }\n }\n }\n } else {\n const rootWidth = root.clientWidth\n let targetWidth = Math.floor(activeNode.clientWidth)\n const targetOffset = activeNode.offsetLeft\n\n // Detect if the thumb is moving too far to the edge of the container.\n // This would most commonly be due to subpixel widths adding up to excessive distance.\n if (rootWidth - (targetWidth + targetOffset) < 2) {\n targetWidth = targetWidth - 1\n }\n\n thumb.style.width = `${Math.floor(targetWidth)}px`\n thumb.style.height = \"\"\n thumb.style.transform = `translateX(${targetOffset}px)`\n\n // If the control is scrollable, ensure the active option is visible\n if (root.scrollWidth > rootWidth) {\n // Only scroll items near the edge, but not the inner 2/3.\n const buffer = rootWidth * 0.15\n const scrollLeft = root.scrollLeft\n const left = activeNode.offsetLeft\n const right = left + targetWidth\n if (left < scrollLeft + buffer || right > scrollLeft + rootWidth - buffer) {\n // Cheap trick to avoid unintentional scroll on mount - transition is set after mounting\n if (attemptScroll) {\n // Scroll the control only: scrollIntoView also scrolls the page to it (a switch to Phone\n // re-rendered a control far down the page and slid the page to it, owner 08.11)\n root.scrollTo({ left: left - (rootWidth - targetWidth) / 2, behavior: prefersReducedMotion() ? \"auto\" : \"smooth\" })\n }\n }\n }\n }\n },\n [isVertical],\n )\n\n useResizeObserver({\n // @ts-expect-error(2322) -- bug in types: https://github.com/juliencrn/usehooks-ts/issues/663\n ref: rootRef,\n onResize: () => {\n const thumb = thumbRef.current\n\n if (!thumb) {\n return\n }\n\n // Perform the size update instantly\n const currentTransition = thumb.style.transition\n thumb.style.transition = \"\"\n applyThumbSizing(false)\n thumb.style.transition = currentTransition\n },\n })\n\n // Tabs added, removed, reordered or relabelled move the active tab without\n // resizing the group: measure again, instantly, like a resize\n useEffect(() => {\n const root = rootRef.current\n if (!root || typeof MutationObserver === \"undefined\") return\n const observer = new MutationObserver(() => {\n const thumb = thumbRef.current\n if (!thumb) return\n const currentTransition = thumb.style.transition\n thumb.style.transition = \"\"\n applyThumbSizing(false)\n thumb.style.transition = currentTransition\n })\n observer.observe(root, { childList: true, characterData: true, subtree: true })\n return () => observer.disconnect()\n }, [applyThumbSizing])\n\n const transitionProperty = isVertical\n ? \"height var(--tabs-thumb-transition-duration, 200ms) var(--cubic-enter), transform var(--tabs-thumb-transition-duration, 200ms) var(--cubic-enter)\"\n : \"width var(--tabs-thumb-transition-duration, 200ms) var(--cubic-enter), transform var(--tabs-thumb-transition-duration, 200ms) var(--cubic-enter)\"\n\n useLayoutEffect(() => {\n const root = rootRef.current\n const thumb = thumbRef.current\n\n if (!root || !thumb) {\n return\n }\n\n const sizeChanged = prevSizeRef.current !== size\n prevSizeRef.current = size\n\n if (sizeChanged) {\n // Size changed - disable transition, wait for CSS, then apply sizing\n const currentTransition = thumb.style.transition\n thumb.style.transition = \"\"\n\n waitForAnimationFrame(() => {\n applyThumbSizing(false)\n waitForAnimationFrame(() => {\n thumb.style.transition = currentTransition\n })\n })\n } else if (thumb.style.transition) {\n // Normal update (value change, etc.): the thumb leaves with the label's colour\n applyThumbSizing(true)\n } else {\n // First measure: apply transition after initial calculation is set\n waitForAnimationFrame(() => {\n applyThumbSizing(false)\n waitForAnimationFrame(() => {\n thumb.style.transition = transitionProperty\n })\n })\n }\n }, [applyThumbSizing, value, size, gutterSize, pill, flush, transitionProperty])\n\n const handleValueChange = (nextValue: T) => {\n // Only trigger onChange when a value exists\n // Disallow toggling off enabled items\n if (nextValue && onChange) onChange(nextValue)\n }\n\n // Only apply pill for segmented variant\n const isPill = variant === \"segmented\" && pill\n // Only apply flush for underline variant\n const isFlush = variant === \"underline\" && flush\n\n return (\n <ToggleGroup.Root\n ref={rootRef}\n className={clsx(s.Tabs, className)}\n type=\"single\"\n value={value}\n loop={false}\n onValueChange={handleValueChange}\n onClick={onClick}\n data-variant={variant}\n data-orientation={orientation}\n data-block={block ? \"\" : undefined}\n data-pill={isPill ? \"\" : undefined}\n data-flush={isFlush ? \"\" : undefined}\n data-size={size}\n data-gutter-size={gutterSize}\n data-disabled={restProps.disabled ? \"\" : undefined}\n {...restProps}\n >\n <div className={s.TabsThumb} ref={thumbRef} />\n <TabsVerticalContext.Provider value={isVertical}>{children}</TabsVerticalContext.Provider>\n </ToggleGroup.Root>\n )\n}\n\n/**\n * Badge configuration for Tabs.Tab\n */\nexport type TabsBadgeProp =\n | React.ReactNode\n | {\n content: React.ReactNode\n color?: SemanticColors<\n \"secondary\" | \"success\" | \"danger\" | \"warning\" | \"info\" | \"discovery\" | \"caution\"\n >\n variant?: Variants<\"soft\" | \"solid\">\n pill?: boolean\n loading?: boolean\n }\n\nexport type TabProps = {\n /**\n * Tab value\n */\n \"value\": string\n /**\n * Text read aloud to screen readers when the tab is focused\n */\n \"aria-label\"?: string\n /**\n * Text content to render in the tab\n */\n \"children\"?: React.ReactNode\n /**\n * Icon to render before the text content\n */\n \"icon\"?: React.ReactNode\n /**\n * Badge to render after the text content.\n * Can be a simple value or an object with content, color, variant, and loading options.\n * @example badge={5}\n * @example badge={{ content: 5, color: \"danger\" }}\n */\n \"badge\"?: TabsBadgeProp\n /**\n * Disable the individual tab\n */\n \"disabled\"?: boolean\n}\n\n// Type guard for badge object form\nconst isBadgeObject = (\n badge: TabsBadgeProp,\n): badge is Exclude<TabsBadgeProp, React.ReactNode> & { content: React.ReactNode } => {\n return badge != null && typeof badge === \"object\" && \"content\" in badge\n}\n\nconst Tab = ({ children, icon, badge, ...restProps }: TabProps) => {\n // Normalize badge prop\n const badgeProps = badge != null ? (isBadgeObject(badge) ? badge : { content: badge }) : null\n const vertical = useContext(TabsVerticalContext)\n\n return (\n <ToggleGroup.Item\n className={s.Tab}\n {...restProps}\n onPointerEnter={handlePressableMouseEnter}\n >\n <span className={s.TabContent}>\n {icon}\n {children && <span className={s.TabLabel}>{children}</span>}\n {badgeProps && (\n <span\n className={s.TabBadge}\n data-color={badgeProps.color ?? \"secondary\"}\n data-variant={badgeProps.variant ?? \"soft\"}\n data-pill={badgeProps.pill ? \"\" : undefined}\n >\n {badgeProps.loading ? <LoadingIndicator /> : badgeProps.content}\n </span>\n )}\n </span>\n {vertical && <CheckMd className={s.TabCheckmark} aria-hidden=\"true\" />}\n </ToggleGroup.Item>\n )\n}\n\n// =============================================\n// overflow=\"menu\"\n// =============================================\n\n/** Value of the menu button; no real tab has it */\nconst MORE_VALUE = \"__plexui_tabs_more__\"\n\ntype TabElement = ReactElement<TabProps>\n\n/** The tabs among the children, through fragments */\nconst tabElements = (children: ReactNode): TabElement[] =>\n Children.toArray(children).flatMap((child) => {\n if (!isValidElement<{ children?: ReactNode }>(child)) return []\n return child.type === Fragment ? tabElements(child.props.children) : [child as TabElement]\n })\n\nconst plainText = (node: unknown): string => {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node)\n if (Array.isArray(node)) return node.map(plainText).join(\"\")\n if (isValidElement<{ children?: ReactNode }>(node)) return plainText(node.props.children)\n return \"\"\n}\n\nconst badgeText = (badge: TabsBadgeProp | undefined) =>\n badge != null && isBadgeObject(badge) ? plainText(badge.content) : plainText(badge)\n\n/** A tab's name: its text, else its accessible name, else its value */\nconst tabLabel = (item: TabElement) => plainText(item.props.children) || item.props[\"aria-label\"] || item.props.value\n\n/** What a tab's width depends on: the strip measures again when it changes */\nconst tabsSignature = (items: TabElement[]) =>\n items\n .map((item) =>\n [item.props.value, plainText(item.props.children), badgeText(item.props.badge), item.props.icon != null].join(\"\\u0000\"),\n )\n .join(\"\\u0001\")\n\n/**\n * `Menu.Trigger` sets `data-state` (open or closed) on its child, while a tab\n * keeps `on` or `off` in the same attribute and the thumb finds the active tab\n * by it. The menu's value does not reach the tab; its handlers and\n * `aria-haspopup` / `aria-expanded` do.\n */\nconst MoreTab = (props: TabProps & { \"data-state\"?: string }) => {\n const restProps = { ...props }\n delete restProps[\"data-state\"]\n return <Tab {...restProps} />\n}\n\nconst OverflowTabs = <T extends string>({\n children,\n value,\n onChange,\n overflowLabel,\n ...restProps\n}: Omit<TabsProps<T>, \"overflow\"> & { overflowLabel: string }) => {\n const items = tabElements(children)\n // The strip's own props size the tabs and the menu button too\n const { size, variant, gutterSize, pill, flush } = restProps\n const signature = [overflowLabel, size, variant, gutterSize, pill, flush, tabsSignature(items)].join(\"\\u0002\")\n const activeIndex = items.findIndex((item) => item.props.value === value)\n\n // null while the measuring pass renders every tab and the menu button\n const [visibleCount, setVisibleCount] = useState<number | null>(null)\n const [known, setKnown] = useState({ signature, activeIndex })\n const hostRef = useRef<HTMLDivElement>(null)\n const measuringRef = useRef(true)\n const boxWidthRef = useRef(-1)\n\n // New tabs measure again. A new active tab measures again when it moves\n // under the menu button or back out: the button carries the hidden one's name\n if (known.signature !== signature || known.activeIndex !== activeIndex) {\n const crossed =\n visibleCount !== null && (known.activeIndex >= visibleCount || activeIndex >= visibleCount)\n setKnown({ signature, activeIndex })\n if (visibleCount !== null && (known.signature !== signature || crossed)) setVisibleCount(null)\n }\n\n useLayoutEffect(() => {\n measuringRef.current = visibleCount === null\n }, [visibleCount])\n\n useLayoutEffect(() => {\n if (visibleCount !== null) return\n const root = hostRef.current?.firstElementChild\n if (!(root instanceof HTMLElement)) return\n\n // The measuring pass renders every tab, then the menu button\n const buttons = Array.from(root.querySelectorAll<HTMLElement>(\":scope > button\"))\n if (buttons.length !== items.length + 1) return\n\n const widths = buttons.map((button) => button.getBoundingClientRect().width)\n const moreButton = buttons[buttons.length - 1]\n const moreWidth = widths.pop() ?? 0\n const style = getComputedStyle(root)\n const available =\n root.getBoundingClientRect().width -\n (Number.parseFloat(style.paddingLeft) || 0) -\n (Number.parseFloat(style.paddingRight) || 0)\n const gap = Number.parseFloat(style.columnGap) || 0\n boxWidthRef.current = hostRef.current?.parentElement?.clientWidth ?? -1\n\n // A hidden strip has no width to decide by: show every tab, and measure\n // when it appears (the observer sees the width change)\n if (available <= 0) {\n // Resolve the zero-width measuring pass before paint; the resize observer\n // restarts measurement when this hidden strip becomes visible.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setVisibleCount(items.length)\n return\n }\n\n // The button with the active tab's name: that tab's width plus the chevron\n const chevron = moreButton?.querySelector(\"svg\")\n const chevronWidth = chevron?.getBoundingClientRect().width ?? 0\n const labelGap = chevron?.parentElement ? Number.parseFloat(getComputedStyle(chevron.parentElement).columnGap) || 0 : 0\n const activeWidth = activeIndex < 0 ? 0 : (widths[activeIndex] ?? 0) + chevronWidth + labelGap\n\n // This result depends on committed DOM widths. Apply it before first paint\n // so the temporary full strip never flashes before overflowing tabs move.\n setVisibleCount(visibleTabCount(widths, moreWidth, activeWidth, activeIndex, gap, available))\n }, [visibleCount, items.length, activeIndex])\n\n // The width to fit is the container's, not the strip's: the strip shrinks\n // to its content. Reports during a measuring pass are skipped, since the\n // full strip may be pushing its container wider\n useEffect(() => {\n const box = hostRef.current?.parentElement\n if (!box || typeof ResizeObserver === \"undefined\") return\n const observer = new ResizeObserver(() => {\n if (measuringRef.current) return\n const width = box.clientWidth\n if (width === boxWidthRef.current) return\n boxWidthRef.current = width\n setVisibleCount(null)\n })\n observer.observe(box)\n return () => observer.disconnect()\n }, [])\n\n const measuring = visibleCount === null\n const shown = measuring ? items : items.slice(0, visibleCount)\n const hidden = measuring ? [] : items.slice(visibleCount)\n const hiddenActive = hidden.find((item) => item.props.value === value) ?? null\n\n return (\n <div ref={hostRef} className={s.OverflowHost}>\n <Menu>\n <TabsRoot<string>\n {...restProps}\n data-overflow=\"menu\"\n value={hiddenActive ? MORE_VALUE : value}\n onChange={(next) => {\n // Pressing the menu button opens the menu; it is not a tab\n if (next !== MORE_VALUE) onChange?.(next as T)\n }}\n >\n {/* Keyed by value: tabs from different fragments may share a key */}\n {shown.map((item) => cloneElement(item, { key: item.props.value }))}\n {(measuring || hidden.length > 0) && (\n <Menu.Trigger>\n <MoreTab value={MORE_VALUE}>\n <span className={s.OverflowLabel}>\n {hiddenActive ? tabLabel(hiddenActive) : overflowLabel}\n <ChevronDownMd />\n </span>\n </MoreTab>\n </Menu.Trigger>\n )}\n </TabsRoot>\n <Menu.Content align=\"end\" minWidth=\"auto\">\n <Menu.RadioGroup<string> value={value} onChange={(next) => onChange?.(next as T)}>\n {hidden.map((item) => {\n const count = badgeText(item.props.badge)\n return (\n <Menu.RadioItem<string>\n key={item.props.value}\n value={item.props.value}\n disabled={restProps.disabled || item.props.disabled}\n >\n {item.props.icon}\n {item.props.children ?? item.props[\"aria-label\"] ?? item.props.value}\n {/* A tab's count moves into the menu with it */}\n {count !== \"\" && <span className={s.OverflowBadge}>{count}</span>}\n </Menu.RadioItem>\n )\n })}\n </Menu.RadioGroup>\n </Menu.Content>\n </Menu>\n </div>\n )\n}\n\n// Attach sub-components\nTabs.Tab = Tab\n// Backward-compat alias\nTabs.Option = Tab\n"]}
1
+ {"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,cAAc,EACd,WAAW,EACX,UAAU,EACV,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,GAGT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAC1G,OAAO,EAAoE,MAAM,aAAa,CAAA;AAC9F,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY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IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;4BACzC,OAAO,CACL,MAAC,IAAI,CAAC,SAAS,IAEb,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,QAAQ,EAAE,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,aAElD,IAAI,CAAC,KAAK,CAAC,IAAI,EACf,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAEnE,KAAK,KAAK,EAAE,IAAI,eAAM,SAAS,EAAE,CAAC,CAAC,aAAa,YAAG,KAAK,GAAQ,KAP5D,IAAI,CAAC,KAAK,CAAC,KAAK,CAQN,CAClB,CAAA;wBACH,CAAC,CAAC,GACc,GACL,IACV,GACH,CACP,CAAA;AACH,CAAC,CAAA;AAED,wBAAwB;AACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;AACd,wBAAwB;AACxB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { ToggleGroup } from \"radix-ui\"\nimport {\n Children,\n cloneElement,\n createContext,\n Fragment,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport { useResizeObserver } from \"usehooks-ts\"\nimport { handlePressableMouseEnter, prefersReducedMotion, waitForAnimationFrame } from \"../../lib/helpers\"\nimport { type ControlSize, type SemanticColors, type Sizes, type Variants } from \"../../types\"\nimport { CheckMd, ChevronDownMd } from \"../Icon\"\nimport { LoadingIndicator } from \"../Indicator\"\nimport { Menu } from \"../Menu\"\nimport { visibleTabCount } from \"./overflow\"\nimport s from \"@plexui/styles/components/Tabs/Tabs.module.css\"\n\nexport type SizeVariant = \"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\"\n\nexport type TabsVariant = \"segmented\" | \"underline\"\nexport type TabsOrientation = \"horizontal\" | \"vertical\"\n\nexport type TabsProps<T extends string> = {\n /**\n * Controlled value for the group\n */\n \"value\": T\n /** Callback for when a new value is selected */\n \"onChange\"?: (nextValue: T) => void\n /** Callback any time the control is clicked (even if a new value was not selected) */\n \"onClick\"?: () => void\n /**\n * Text read aloud to screen readers when the control is focused\n */\n \"aria-label\": string\n /**\n * Visual variant of the tab group\n * - `\"segmented\"` — background container with sliding highlight (default)\n * - `\"underline\"` — no background, animated line indicator under active tab\n * @default \"segmented\"\n */\n \"variant\"?: TabsVariant\n /**\n * Orientation of the tab layout\n * @default \"horizontal\"\n */\n \"orientation\"?: TabsOrientation\n /**\n * Controls the size of the tabs\n *\n * | 3xs | 2xs | xs | sm | md | lg | xl | 2xl | 3xl |\n * | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |\n * | `22px` | `24px` | `26px` | `28px` | `32px` | `36px` | `40px` | `44px` | `48px` |\n *\n * On a phone horizontal tabs take the two sizes of the iOS 27 segmented control: `sm` and smaller the small 32px\n * one, `md` and larger the large 48px one (49px with `mobileMaterial=\"flat\"`).\n *\n * @default md\n */\n \"size\"?: ControlSize\n /**\n * Controls gutter on the edges of the button, defaults to value from `size`.\n *\n * | 2xs | xs | sm | md | lg | xl |\n * | ------ | ------ | ------ | ------ | ------ | ------ |\n * | `6px` | `8px` | `10px` | `12px` | `14px` | `16px` |\n */\n \"gutterSize\"?: Sizes<\"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\">\n /** Disable the entire group */\n \"disabled\"?: boolean\n /**\n * Display the control as a block element with equal width segments\n * @default false\n */\n \"block\"?: boolean\n /**\n * Determines if the tabs should be a fully rounded pill shape.\n * Only applies to the `\"segmented\"` variant.\n * @default true\n */\n \"pill\"?: boolean\n /**\n * Flush underline style — removes tab padding so the indicator\n * matches the text width exactly, uses gap for spacing, and\n * removes the bottom border.\n * Only applies to the `\"underline\"` variant.\n * @default false\n */\n \"flush\"?: boolean\n /**\n * What happens to tabs that do not fit in one row: the strip scrolls\n * sideways (`scroll`), or the tabs that do not fit move into a menu at the\n * end of the strip (`menu`). The menu button shows the active tab's name\n * when it is one of the hidden ones. Horizontal tabs without `block` only.\n * @default \"scroll\"\n */\n \"overflow\"?: \"scroll\" | \"menu\"\n /**\n * Text of the menu button with `overflow=\"menu\"`\n * @default \"More\"\n */\n \"overflowLabel\"?: string\n /**\n * Phone surface of horizontal tabs. On a phone the large control (`md` and larger) is the glass capsule of iOS 27\n * apps and the small one (`sm` and smaller) the plain capsule of SwiftUI's segmented Picker; `flat` gives the large\n * one the plain look of SwiftUI's `.controlSize(.large)`, and `glass` gives the small one `.glassEffect()`, as the\n * Button prop of the same name does for a button. Inside a phone Toolbar the control is the large glass one\n * anyway. Desktop keeps the chosen variant.\n * @default \"glass\" at md and larger, \"flat\" at sm and smaller\n */\n \"mobileMaterial\"?: \"glass\" | \"flat\"\n \"className\"?: string\n \"children\": React.ReactNode\n}\n\n/** Vertical tabs are a list on a phone, where the selected row shows a checkmark */\nconst TabsVerticalContext = createContext(false)\n\nexport const Tabs = <T extends string>({ overflow = \"scroll\", overflowLabel = \"More\", ...props }: TabsProps<T>) => {\n if (overflow === \"menu\" && !props.block && props.orientation !== \"vertical\") {\n return <OverflowTabs {...props} overflowLabel={overflowLabel} />\n }\n return <TabsRoot {...props} />\n}\n\nconst TabsRoot = <T extends string>({\n value,\n onChange,\n children,\n variant = \"segmented\",\n orientation = \"horizontal\",\n block,\n pill = true,\n flush,\n size = \"md\",\n gutterSize,\n mobileMaterial,\n className,\n onClick,\n ...restProps\n}: Omit<TabsProps<T>, \"overflow\" | \"overflowLabel\">) => {\n const rootRef = useRef<HTMLDivElement>(null)\n const thumbRef = useRef<HTMLDivElement>(null)\n const prevSizeRef = useRef(size)\n const prevValueRef = useRef(value)\n const isVertical = orientation === \"vertical\"\n\n const applyThumbSizing = useCallback(\n (attemptScroll: boolean) => {\n const root = rootRef.current\n const thumb = thumbRef.current\n\n if (!root || !thumb) {\n return\n }\n\n // Get selected node\n const activeNode = root?.querySelector<HTMLDivElement>('[data-state=\"on\"]')\n\n // Impossible\n if (!activeNode) {\n return\n }\n\n if (isVertical) {\n const rootHeight = root.clientHeight\n let targetHeight = Math.floor(activeNode.clientHeight)\n const targetOffset = activeNode.offsetTop\n\n // Detect subpixel edge case\n if (rootHeight - (targetHeight + targetOffset) < 2) {\n targetHeight = targetHeight - 1\n }\n\n thumb.style.height = `${Math.floor(targetHeight)}px`\n thumb.style.width = \"\"\n thumb.style.transform = `translateY(${targetOffset}px)`\n\n // Scroll into view if needed\n if (root.scrollHeight > rootHeight) {\n const buffer = rootHeight * 0.15\n const scrollTop = root.scrollTop\n const top = activeNode.offsetTop\n const bottom = top + targetHeight\n if (top < scrollTop + buffer || bottom > scrollTop + rootHeight - buffer) {\n if (attemptScroll) {\n // Scroll the control only: scrollIntoView also scrolls the page to it (a switch to Phone\n // re-rendered a control far down the page and slid the page to it, owner 08.11)\n root.scrollTo({ top: top - (rootHeight - targetHeight) / 2, behavior: prefersReducedMotion() ? \"auto\" : \"smooth\" })\n }\n }\n }\n } else {\n const rootWidth = root.clientWidth\n let targetWidth = Math.floor(activeNode.clientWidth)\n const targetOffset = activeNode.offsetLeft\n\n // Detect if the thumb is moving too far to the edge of the container.\n // This would most commonly be due to subpixel widths adding up to excessive distance.\n if (rootWidth - (targetWidth + targetOffset) < 2) {\n targetWidth = targetWidth - 1\n }\n\n thumb.style.width = `${Math.floor(targetWidth)}px`\n thumb.style.height = \"\"\n thumb.style.transform = `translateX(${targetOffset}px)`\n\n // If the control is scrollable, ensure the active option is visible\n if (root.scrollWidth > rootWidth) {\n // Only scroll items near the edge, but not the inner 2/3.\n const buffer = rootWidth * 0.15\n const scrollLeft = root.scrollLeft\n const left = activeNode.offsetLeft\n const right = left + targetWidth\n if (left < scrollLeft + buffer || right > scrollLeft + rootWidth - buffer) {\n // Cheap trick to avoid unintentional scroll on mount - transition is set after mounting\n if (attemptScroll) {\n // Scroll the control only: scrollIntoView also scrolls the page to it (a switch to Phone\n // re-rendered a control far down the page and slid the page to it, owner 08.11)\n root.scrollTo({ left: left - (rootWidth - targetWidth) / 2, behavior: prefersReducedMotion() ? \"auto\" : \"smooth\" })\n }\n }\n }\n }\n },\n [isVertical],\n )\n\n useResizeObserver({\n // @ts-expect-error(2322) -- bug in types: https://github.com/juliencrn/usehooks-ts/issues/663\n ref: rootRef,\n onResize: () => {\n const thumb = thumbRef.current\n\n if (!thumb) {\n return\n }\n\n // Perform the size update instantly\n const currentTransition = thumb.style.transition\n thumb.style.transition = \"\"\n applyThumbSizing(false)\n thumb.style.transition = currentTransition\n },\n })\n\n // Tabs added, removed, reordered or relabelled move the active tab without\n // resizing the group: measure again, instantly, like a resize\n useEffect(() => {\n const root = rootRef.current\n if (!root || typeof MutationObserver === \"undefined\") return\n const observer = new MutationObserver(() => {\n const thumb = thumbRef.current\n if (!thumb) return\n const currentTransition = thumb.style.transition\n thumb.style.transition = \"\"\n applyThumbSizing(false)\n thumb.style.transition = currentTransition\n })\n observer.observe(root, { childList: true, characterData: true, subtree: true })\n return () => observer.disconnect()\n }, [applyThumbSizing])\n\n const transitionProperty = isVertical\n ? \"height var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter)), transform var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter))\"\n : \"width var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter)), transform var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter))\"\n\n useLayoutEffect(() => {\n const root = rootRef.current\n const thumb = thumbRef.current\n\n if (!root || !thumb) {\n return\n }\n\n const sizeChanged = prevSizeRef.current !== size\n prevSizeRef.current = size\n const valueChanged = prevValueRef.current !== value\n prevValueRef.current = value\n\n if (sizeChanged) {\n // Size changed - disable transition, wait for CSS, then apply sizing\n const currentTransition = thumb.style.transition\n thumb.style.transition = \"\"\n\n waitForAnimationFrame(() => {\n applyThumbSizing(false)\n waitForAnimationFrame(() => {\n thumb.style.transition = currentTransition\n })\n })\n } else if (thumb.style.transition) {\n // Normal update (value change, etc.): the thumb leaves with the label's colour\n const from = valueChanged ? thumbBox(thumb) : null\n applyThumbSizing(true)\n if (valueChanged) playThumbLens(thumb, from)\n } else {\n // First measure: apply transition after initial calculation is set\n waitForAnimationFrame(() => {\n applyThumbSizing(false)\n waitForAnimationFrame(() => {\n thumb.style.transition = transitionProperty\n })\n })\n }\n }, [applyThumbSizing, value, size, gutterSize, pill, flush, transitionProperty])\n\n const handleValueChange = (nextValue: T) => {\n // Only trigger onChange when a value exists\n // Disallow toggling off enabled items\n if (nextValue && onChange) onChange(nextValue)\n }\n\n // Only apply pill for segmented variant\n const isPill = variant === \"segmented\" && pill\n // Only apply flush for underline variant\n const isFlush = variant === \"underline\" && flush\n\n return (\n <ToggleGroup.Root\n ref={rootRef}\n className={clsx(s.Tabs, className)}\n type=\"single\"\n value={value}\n loop={false}\n onValueChange={handleValueChange}\n onClick={onClick}\n data-variant={variant}\n data-orientation={orientation}\n data-block={block ? \"\" : undefined}\n data-pill={isPill ? \"\" : undefined}\n data-flush={isFlush ? \"\" : undefined}\n data-size={size}\n data-gutter-size={gutterSize}\n data-mobile-material={mobileMaterial}\n data-disabled={restProps.disabled ? \"\" : undefined}\n {...restProps}\n >\n <div className={s.TabsThumb} ref={thumbRef} />\n <TabsVerticalContext.Provider value={isVertical}>{children}</TabsVerticalContext.Provider>\n </ToggleGroup.Root>\n )\n}\n\n/**\n * Badge configuration for Tabs.Tab\n */\nexport type TabsBadgeProp =\n | React.ReactNode\n | {\n content: React.ReactNode\n color?: SemanticColors<\n \"secondary\" | \"success\" | \"danger\" | \"warning\" | \"info\" | \"discovery\" | \"caution\"\n >\n variant?: Variants<\"soft\" | \"solid\">\n pill?: boolean\n loading?: boolean\n }\n\nexport type TabProps = {\n /**\n * Tab value\n */\n \"value\": string\n /**\n * Text read aloud to screen readers when the tab is focused\n */\n \"aria-label\"?: string\n /**\n * Text content to render in the tab\n */\n \"children\"?: React.ReactNode\n /**\n * Icon to render before the text content\n */\n \"icon\"?: React.ReactNode\n /**\n * Badge to render after the text content.\n * Can be a simple value or an object with content, color, variant, and loading options.\n * @example badge={5}\n * @example badge={{ content: 5, color: \"danger\" }}\n */\n \"badge\"?: TabsBadgeProp\n /**\n * Disable the individual tab\n */\n \"disabled\"?: boolean\n}\n\n// Type guard for badge object form\nconst isBadgeObject = (\n badge: TabsBadgeProp,\n): badge is Exclude<TabsBadgeProp, React.ReactNode> & { content: React.ReactNode } => {\n return badge != null && typeof badge === \"object\" && \"content\" in badge\n}\n\n/** True when an icon draws text of its own: a string, a number, or a fragment or array holding one */\n\n/** A text icon (\"☀\") stands in an element, as an icon component does, so a phone can hide it beside a label: each\n * text in a fragment or array gets its own span and the elements beside it stay in place. An empty one draws\n * nothing. */\n// Arrays and fragments always go through Children.map, with or without text, so their children keep the same keys\n// when a text child comes or goes; a fragment keeps its element and key, so a new key still remounts its icons.\n/** On a phone the large control's selection travels as a lens of glass, as iOS 27.2 draws it. Recorded frame by frame\n * 11.11 (ref-app segmented-bar-text4, a toolbar Picker of Day, Week, Month and Year switched Day to Year and back,\n * after the owner's «анимация не правильная и стиль» and «day<->year пробуй переключать»; segmented-bar-symbols, a\n * segment away, before it): the gray selection clears into a lens within 45ms, taller than the capsule (11pt) and\n * wider the faster it goes (36pt at 200ms), and carries across; it lands as the gray selection again by 300ms,\n * pressed against its segment's far side (7pt narrower, 6pt taller and its centre 2.5% of the way past at 430ms), and\n * springs back by 750ms while the label under it dims to 76% and comes back. The centre's path is a share of the\n * distance and the growth is in points, as both recordings show: as much growth a segment away as three. touch.css\n * names the lens's growth on the large control only, so everywhere else the selection just slides with its\n * transition. CSS has no refraction, so the lens is its rim, its tint and the capsule's edge seen through it. */\nlet lensRun = 0\nconst LENS_ID = \"segmented-control-lens\"\nconst LENS_DURATION = 750\n// At each measured frame: [ms, the centre's share of the distance, share of the growth's width, share of its height]\nconst LENS_PATH = [\n [0, 0, 0, 0],\n [10, 0.014, 0.036, 0.065],\n [32, 0.077, 0.13, 0.19],\n [47, 0.169, 0.22, 0.44],\n [70, 0.378, 0.44, 0.87],\n [92, 0.478, 0.52, 1],\n [125, 0.647, 0.7, 0.93],\n [150, 0.773, 0.85, 0.87],\n [182, 0.856, 0.96, 0.93],\n [205, 0.9, 1, 1],\n [227, 0.932, 0.96, 0.93],\n [245, 0.951, 0.8, 0.44],\n [262, 0.964, 0.67, 0.31],\n [295, 0.989, 0.37, 0.31],\n [330, 1.005, 0.13, 0.31],\n [363, 1.016, -0.02, 0.37],\n [395, 1.023, -0.13, 0.5],\n [430, 1.025, -0.19, 0.56],\n [497, 1.022, -0.19, 0.56],\n [545, 1.018, -0.17, 0.37],\n [597, 1.014, -0.11, 0.25],\n [647, 1.007, -0.075, 0.12],\n [697, 1.004, -0.036, 0],\n [750, 1, 0, 0],\n] as const\n// The selected label's opacity as the lens lands: [ms, opacity]\nconst LENS_LABEL = [\n [0, 1],\n [380, 1],\n [428, 0.77],\n [460, 0.76],\n [515, 0.85],\n [580, 0.93],\n [650, 0.98],\n [713, 1],\n [750, 1],\n] as const\ntype ThumbBox = { x: number; width: number }\ntype LensRun = { from: ThumbBox; to: ThumbBox; move: Animation; label?: Animation }\nconst lensRuns = new WeakMap<HTMLElement, LensRun>()\nconst round = (value: number) => Math.round(value * 100) / 100\n// The box the lens draws at a time of its run\nconst lensBox = ({ from, to }: LensRun, ms: number, growth: number): ThumbBox => {\n const next = LENS_PATH.findIndex(([time]) => time >= ms)\n const at = next < 0 ? LENS_PATH.length - 1 : Math.max(1, next)\n const [t0, share0, wide0] = LENS_PATH[at - 1]\n const [t1, share1, wide1] = LENS_PATH[Math.min(at, LENS_PATH.length - 1)]\n const k = t1 > t0 ? Math.min(1, Math.max(0, (ms - t0) / (t1 - t0))) : 1\n const share = share0 + (share1 - share0) * k\n const width = from.width + (to.width - from.width) * Math.min(share, 1) + growth * (wide0 + (wide1 - wide0) * k)\n return { x: from.x + from.width / 2 + (to.x + to.width / 2 - from.x - from.width / 2) * share - width / 2, width }\n}\n/** Where a horizontal thumb is drawn, from its control's left edge: where the script set it, or where a lens still\n * on its way has it, so a switch mid-flight sets off from there */\nconst thumbBox = (thumb: HTMLElement): ThumbBox | null => {\n const offset = /^translateX\\((-?[\\d.]+)px\\)$/.exec(thumb.style.transform)\n const width = parseFloat(thumb.style.width)\n if (!offset || !(width > 0)) return null\n const run = lensRuns.get(thumb)\n const ms = Number(run?.move.currentTime)\n if (run && (run.move.playState === \"running\" || run.move.playState === \"paused\") && ms >= 0) {\n const growth = lensGrowth(getComputedStyle(thumb))\n if (growth) return lensBox(run, ms, growth[0])\n }\n return { x: parseFloat(offset[1]), width }\n}\n// The lens's growth at its widest and tallest, which touch.css names on the large control only\nconst lensGrowth = (style: CSSStyleDeclaration) => {\n const [wide = Number.NaN, tall = wide] = style.getPropertyValue(\"--segmented-control-thumb-lens-outset\").trim().split(/\\s+/).map(parseFloat)\n return wide >= 0 && tall >= 0 ? ([wide, tall] as const) : null\n}\nconst playThumbLens = (thumb: HTMLElement, from: ThumbBox | null) => {\n if (typeof thumb.animate !== \"function\") return\n // A lens still on its way ends first, so the thumb's own fill and edge are read below (and none outlives a switch\n // to reduced motion)\n thumb.getAnimations().forEach((animation) => {\n if (animation.id === LENS_ID) animation.cancel()\n })\n lensRuns.get(thumb)?.label?.cancel()\n lensRuns.delete(thumb)\n if (!from || prefersReducedMotion()) return\n const style = getComputedStyle(thumb)\n const growth = lensGrowth(style)\n const to = thumbBox(thumb)\n const top = parseFloat(style.top)\n const bottom = parseFloat(style.bottom)\n if (!growth || !to || !Number.isFinite(top) || !Number.isFinite(bottom)) return\n const [wide, tall] = growth\n const timing = { id: LENS_ID, duration: LENS_DURATION }\n const run: LensRun = { from, to, move: undefined as unknown as Animation }\n // The thumb's box at each frame replaces its own while the lens runs (its transition is overridden); the height\n // grows about the middle\n run.move = thumb.animate(\n LENS_PATH.map(([ms, , , high]) => {\n const box = lensBox(run, ms, wide)\n const grown = (tall * high) / 2\n return {\n offset: ms / LENS_DURATION,\n transform: `translateX(${round(box.x)}px)`,\n width: `${round(Math.max(1, box.width))}px`,\n top: `${round(top - grown)}px`,\n bottom: `${round(bottom - grown)}px`,\n }\n }),\n timing,\n )\n const lens = {\n backgroundColor: style.getPropertyValue(\"--segmented-control-thumb-lens-background\").trim(),\n boxShadow: style.getPropertyValue(\"--segmented-control-thumb-lens-shadow\").trim(),\n }\n const rest = { backgroundColor: style.backgroundColor, boxShadow: style.boxShadow }\n // The gray clears as the lens lifts (45ms) and comes back as it lands (250 to 300ms)\n const fill = thumb.animate(\n [\n { offset: 0, ...rest },\n { offset: 45 / LENS_DURATION, ...lens },\n { offset: 250 / LENS_DURATION, ...lens },\n { offset: 300 / LENS_DURATION, ...rest },\n { offset: 1, ...rest },\n ],\n timing,\n )\n const root = thumb.parentElement\n const selected = root?.querySelector<HTMLElement>('[data-state=\"on\"]')\n if (selected && typeof selected.animate === \"function\") {\n run.label = selected.animate(\n LENS_LABEL.map(([ms, opacity]) => ({ offset: ms / LENS_DURATION, opacity })),\n timing,\n )\n }\n lensRuns.set(thumb, run)\n // The frame a switch is drawn in also lays out whatever the switch changes around the control, which can take a\n // few frames' time; the lens holds its first frame until then and sets off from the next, so none of its way is\n // skipped (a tap's first 45ms were, recorded in Safari 11.11)\n if (typeof requestAnimationFrame === \"function\") {\n const held = [run.move, fill, run.label].filter((animation): animation is Animation => typeof animation?.pause === \"function\")\n held.forEach((animation) => animation.pause())\n requestAnimationFrame(() => {\n held.forEach((animation) => {\n if (animation.playState === \"paused\") animation.play()\n })\n })\n }\n // The lens reaches past the capsule, which clips what scrolls in it: a control whose segments all fit lets it out\n // for the switch\n if (!root || root.scrollWidth > root.clientWidth + 1) return\n const id = String(++lensRun)\n root.setAttribute(\"data-lens\", id)\n const done = () => {\n if (root.getAttribute(\"data-lens\") === id) root.removeAttribute(\"data-lens\")\n }\n if (run.move?.finished) run.move.finished.then(done, done)\n else done()\n}\n\nconst renderTabIcon = (icon: React.ReactNode): React.ReactNode => {\n if (icon === \"\") return null\n if (typeof icon === \"string\" || typeof icon === \"number\") return <span>{icon}</span>\n if (Array.isArray(icon)) return Children.map(icon, renderTabIcon)\n if (isValidElement<{ children?: React.ReactNode }>(icon) && icon.type === Fragment) {\n return cloneElement(icon, undefined, Children.map(icon.props.children, renderTabIcon))\n }\n return icon\n}\n\nconst Tab = ({ children, icon, badge, ...restProps }: TabProps) => {\n // Normalize badge prop\n const badgeProps = badge != null ? (isBadgeObject(badge) ? badge : { content: badge }) : null\n const vertical = useContext(TabsVerticalContext)\n\n return (\n <ToggleGroup.Item\n className={s.Tab}\n {...restProps}\n onPointerEnter={handlePressableMouseEnter}\n >\n <span className={s.TabContent}>\n {renderTabIcon(icon)}\n {children && <span className={s.TabLabel}>{children}</span>}\n {badgeProps && (\n <span\n className={s.TabBadge}\n data-color={badgeProps.color ?? \"secondary\"}\n data-variant={badgeProps.variant ?? \"soft\"}\n data-pill={badgeProps.pill ? \"\" : undefined}\n >\n {badgeProps.loading ? <LoadingIndicator /> : badgeProps.content}\n </span>\n )}\n </span>\n {vertical && <CheckMd className={s.TabCheckmark} aria-hidden=\"true\" />}\n </ToggleGroup.Item>\n )\n}\n\n// =============================================\n// overflow=\"menu\"\n// =============================================\n\n/** Value of the menu button; no real tab has it */\nconst MORE_VALUE = \"__plexui_tabs_more__\"\n\ntype TabElement = ReactElement<TabProps>\n\n/** The tabs among the children, through fragments */\nconst tabElements = (children: ReactNode): TabElement[] =>\n Children.toArray(children).flatMap((child) => {\n if (!isValidElement<{ children?: ReactNode }>(child)) return []\n return child.type === Fragment ? tabElements(child.props.children) : [child as TabElement]\n })\n\nconst plainText = (node: unknown): string => {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node)\n if (Array.isArray(node)) return node.map(plainText).join(\"\")\n if (isValidElement<{ children?: ReactNode }>(node)) return plainText(node.props.children)\n return \"\"\n}\n\nconst badgeText = (badge: TabsBadgeProp | undefined) =>\n badge != null && isBadgeObject(badge) ? plainText(badge.content) : plainText(badge)\n\n/** A tab's name: its text, else its accessible name, else its value */\nconst tabLabel = (item: TabElement) => plainText(item.props.children) || item.props[\"aria-label\"] || item.props.value\n\n/** What a tab's width depends on: the strip measures again when it changes */\nconst tabsSignature = (items: TabElement[]) =>\n items\n .map((item) =>\n [item.props.value, plainText(item.props.children), badgeText(item.props.badge), item.props.icon != null].join(\"\\u0000\"),\n )\n .join(\"\\u0001\")\n\n/**\n * `Menu.Trigger` sets `data-state` (open or closed) on its child, while a tab\n * keeps `on` or `off` in the same attribute and the thumb finds the active tab\n * by it. The menu's value does not reach the tab; its handlers and\n * `aria-haspopup` / `aria-expanded` do.\n */\nconst MoreTab = (props: TabProps & { \"data-state\"?: string }) => {\n const restProps = { ...props }\n delete restProps[\"data-state\"]\n return <Tab {...restProps} />\n}\n\nconst OverflowTabs = <T extends string>({\n children,\n value,\n onChange,\n overflowLabel,\n ...restProps\n}: Omit<TabsProps<T>, \"overflow\"> & { overflowLabel: string }) => {\n const items = tabElements(children)\n // The strip's own props size the tabs and the menu button too\n const { size, variant, gutterSize, pill, flush, mobileMaterial } = restProps\n const signature = [overflowLabel, size, variant, gutterSize, pill, flush, mobileMaterial, tabsSignature(items)].join(\"\\u0002\")\n const activeIndex = items.findIndex((item) => item.props.value === value)\n\n // null while the measuring pass renders every tab and the menu button\n const [visibleCount, setVisibleCount] = useState<number | null>(null)\n const [known, setKnown] = useState({ signature, activeIndex })\n const hostRef = useRef<HTMLDivElement>(null)\n const measuringRef = useRef(true)\n const boxWidthRef = useRef(-1)\n\n // New tabs measure again. A new active tab measures again when it moves\n // under the menu button or back out: the button carries the hidden one's name\n if (known.signature !== signature || known.activeIndex !== activeIndex) {\n const crossed =\n visibleCount !== null && (known.activeIndex >= visibleCount || activeIndex >= visibleCount)\n setKnown({ signature, activeIndex })\n if (visibleCount !== null && (known.signature !== signature || crossed)) setVisibleCount(null)\n }\n\n useLayoutEffect(() => {\n measuringRef.current = visibleCount === null\n }, [visibleCount])\n\n useLayoutEffect(() => {\n if (visibleCount !== null) return\n const root = hostRef.current?.firstElementChild\n if (!(root instanceof HTMLElement)) return\n\n // The measuring pass renders every tab, then the menu button\n const buttons = Array.from(root.querySelectorAll<HTMLElement>(\":scope > button\"))\n if (buttons.length !== items.length + 1) return\n\n const widths = buttons.map((button) => button.getBoundingClientRect().width)\n const moreButton = buttons[buttons.length - 1]\n const moreWidth = widths.pop() ?? 0\n const style = getComputedStyle(root)\n const available =\n root.getBoundingClientRect().width -\n (Number.parseFloat(style.paddingLeft) || 0) -\n (Number.parseFloat(style.paddingRight) || 0)\n const gap = Number.parseFloat(style.columnGap) || 0\n boxWidthRef.current = hostRef.current?.parentElement?.clientWidth ?? -1\n\n // A hidden strip has no width to decide by: show every tab, and measure\n // when it appears (the observer sees the width change)\n if (available <= 0) {\n // Resolve the zero-width measuring pass before paint; the resize observer\n // restarts measurement when this hidden strip becomes visible.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setVisibleCount(items.length)\n return\n }\n\n // The button with the active tab's name: that tab's width plus the chevron\n const chevron = moreButton?.querySelector(\"svg\")\n const chevronWidth = chevron?.getBoundingClientRect().width ?? 0\n const labelGap = chevron?.parentElement ? Number.parseFloat(getComputedStyle(chevron.parentElement).columnGap) || 0 : 0\n const activeWidth = activeIndex < 0 ? 0 : (widths[activeIndex] ?? 0) + chevronWidth + labelGap\n\n // This result depends on committed DOM widths. Apply it before first paint\n // so the temporary full strip never flashes before overflowing tabs move.\n setVisibleCount(visibleTabCount(widths, moreWidth, activeWidth, activeIndex, gap, available))\n }, [visibleCount, items.length, activeIndex])\n\n // The width to fit is the container's, not the strip's: the strip shrinks\n // to its content. Reports during a measuring pass are skipped, since the\n // full strip may be pushing its container wider\n useEffect(() => {\n const box = hostRef.current?.parentElement\n if (!box || typeof ResizeObserver === \"undefined\") return\n const observer = new ResizeObserver(() => {\n if (measuringRef.current) return\n const width = box.clientWidth\n if (width === boxWidthRef.current) return\n boxWidthRef.current = width\n setVisibleCount(null)\n })\n observer.observe(box)\n return () => observer.disconnect()\n }, [])\n\n const measuring = visibleCount === null\n const shown = measuring ? items : items.slice(0, visibleCount)\n const hidden = measuring ? [] : items.slice(visibleCount)\n const hiddenActive = hidden.find((item) => item.props.value === value) ?? null\n\n return (\n <div ref={hostRef} className={s.OverflowHost}>\n <Menu>\n <TabsRoot<string>\n {...restProps}\n data-overflow=\"menu\"\n value={hiddenActive ? MORE_VALUE : value}\n onChange={(next) => {\n // Pressing the menu button opens the menu; it is not a tab\n if (next !== MORE_VALUE) onChange?.(next as T)\n }}\n >\n {/* Keyed by value: tabs from different fragments may share a key */}\n {shown.map((item) => cloneElement(item, { key: item.props.value }))}\n {(measuring || hidden.length > 0) && (\n <Menu.Trigger>\n <MoreTab value={MORE_VALUE}>\n <span className={s.OverflowLabel}>\n {hiddenActive ? tabLabel(hiddenActive) : overflowLabel}\n <ChevronDownMd />\n </span>\n </MoreTab>\n </Menu.Trigger>\n )}\n </TabsRoot>\n <Menu.Content align=\"end\" minWidth=\"auto\">\n <Menu.RadioGroup<string> value={value} onChange={(next) => onChange?.(next as T)}>\n {hidden.map((item) => {\n const count = badgeText(item.props.badge)\n return (\n <Menu.RadioItem<string>\n key={item.props.value}\n value={item.props.value}\n disabled={restProps.disabled || item.props.disabled}\n >\n {item.props.icon}\n {item.props.children ?? item.props[\"aria-label\"] ?? item.props.value}\n {/* A tab's count moves into the menu with it */}\n {count !== \"\" && <span className={s.OverflowBadge}>{count}</span>}\n </Menu.RadioItem>\n )\n })}\n </Menu.RadioGroup>\n </Menu.Content>\n </Menu>\n </div>\n )\n}\n\n// Attach sub-components\nTabs.Tab = Tab\n// Backward-compat alias\nTabs.Option = Tab\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../../src/components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AAE,CAAC,CAAC,QAAQ,YAAG,QAAQ,GAAK,IACpD,CACP,CAAA;IACD,IAAI,UAAU,KAAK,OAAO,IAAI,IAAI,EAAE,IAAI,KAAK,MAAM;QAAE,OAAO,OAAO,CAAA;IACnE,yGAAyG;IACzG,8FAA8F;IAC9F,OAAO,CACL,8BACG,OAAO,EACR,eAAM,SAAS,EAAE,CAAC,CAAC,cAAc,iBAAc,MAAM,YAClD,WAAW,CAAC,CAAC,CAAC,8BAAE,eAAM,SAAS,EAAE,CAAC,CAAC,aAAa,YAAG,QAAQ,GAAQ,EAAA,eAAM,SAAS,EAAE,CAAC,CAAC,iBAAiB,YAAG,QAAQ,GAAQ,IAAG,CAAC,CAAC,CAAC,QAAQ,GACpI,IACN,CACJ,CAAA;AACH,CAAC;AACD,YAAY,CAAC,WAAW,GAAG,eAAe,CAAA;AAE1C,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AAExE,MAAM,CAAC,MAAM,OAAO,GAAG,WAMtB,CAAA;AAED,OAAO,CAAC,OAAO,GAAG,cAAc,CAAA;AAChC,OAAO,CAAC,KAAK,GAAG,YAAY,CAAA;AAC5B,OAAO,CAAC,OAAO,GAAG,cAAc,CAAA;AAChC,OAAO,CAAC,KAAK,GAAG,YAAY,CAAA;AAC5B,OAAO,CAAC,QAAQ,GAAG,eAAe,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport {\n createContext,\n useCallback,\n useContext,\n useLayoutEffect,\n useRef,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n} from \"react\"\nimport s from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\nexport type ToolbarPlacement = \"top\" | \"bottom\"\n/** Title layouts of the phone top bar. */\nexport type ToolbarTitleStyle = \"inline\" | \"large\" | \"compact-large\" | \"compact-medium\"\nexport type ToolbarTitleAlign = \"center\" | \"start\"\n/**\n * How a bar meets the content scrolled under it, after the scroll edge effect of iOS 26:\n * - `\"soft\"` (the default of a bottom bar): at the top, the canvas color covers the content under the bar's controls and fades out past them, over a\n * light blur; at the bottom of a page the content stays clear under and around the controls, as on native iOS 26,\n * and a Sheet's bottom bar fades its content into the panel\n * - `\"hard\"`: an opaque bar of the canvas color with a line once content is under it\n * - `\"glass\"` (the default of a top bar): a translucent, blurred bar with a hairline, shown once content is under it\n * - `\"solid\"`: an opaque bar of the canvas color without a line\n */\nexport type BarBackground = \"soft\" | \"hard\" | \"glass\" | \"solid\"\n/** `\"edge\"` is the earlier name of `\"soft\"`. */\nexport type ToolbarBackground = BarBackground | \"edge\"\n\n/**\n * A surface that places phone toolbars: `Page` puts the top bar over its content\n * and reserves the space; `Dialog` puts it under the Sheet's grabber.\n */\nexport type ToolbarHost = {\n kind: \"page\" | \"dialog\"\n setHeight?: (placement: ToolbarPlacement, height: number | undefined) => void\n /** Content has scrolled under the top bar, so its glass casts a shadow and a hard or glass bar shows its line. */\n scrolled?: boolean\n /** Content continues under the bottom bar, so a hard or glass bar shows its line. */\n contentBelow?: boolean\n /** Calls the listener with the content's scroll offset on every scroll; returns the unsubscribe. A TabBar minimizes with it. */\n subscribeScroll?: (listener: (scrollTop: number) => void) => () => void\n}\n\nexport const ToolbarHostContext = createContext<ToolbarHost | null>(null)\n\n// The title style of the top bar, which a large title on a page needs to show itself inline once scrolled.\nconst ToolbarTitleStyleContext = createContext<ToolbarTitleStyle | undefined>(undefined)\n\n/* ------------------------------------------------------------------ */\n/* Root */\n/* ------------------------------------------------------------------ */\n\nexport type ToolbarProps = HTMLAttributes<HTMLDivElement> & {\n /** @default \"top\" */\n placement?: ToolbarPlacement\n /** Layout of `Toolbar.Title` in a top bar. @default \"inline\" */\n titleStyle?: ToolbarTitleStyle\n /** Alignment of an inline title. Compact and large titles always start at the leading edge. @default \"center\" */\n titleAlign?: ToolbarTitleAlign\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" at the top, \"soft\" at the bottom */\n background?: ToolbarBackground\n ref?: Ref<HTMLDivElement>\n}\n\nfunction ToolbarRoot({\n placement = \"top\",\n titleStyle = \"inline\",\n titleAlign = \"center\",\n background = placement === \"bottom\" ? \"soft\" : \"glass\",\n className,\n children,\n ref,\n ...restProps\n}: ToolbarProps) {\n const host = useContext(ToolbarHostContext)\n const element = useRef<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n const setHeight = host?.setHeight\n useLayoutEffect(() => {\n const bar = element.current\n if (!bar || !setHeight) return\n // A desktop layout hides the bar; its height then leaves the host's own header in charge.\n const update = () => {\n setHeight(placement, bar.offsetHeight || undefined)\n measureLargeTitle(bar)\n }\n update()\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n return () => { observer?.disconnect(); setHeight(placement, undefined) }\n }, [placement, setHeight])\n\n return (\n <div\n ref={setRef}\n className={clsx(s.Toolbar, className)}\n data-toolbar=\"\"\n data-placement={placement}\n data-title-style={placement === \"top\" ? titleStyle : undefined}\n data-title-align={placement === \"top\" ? titleAlign : undefined}\n data-background={background === \"edge\" ? \"soft\" : background}\n data-host={host?.kind}\n data-scrolled={placement === \"top\" && host?.scrolled ? \"\" : undefined}\n data-content-below={placement === \"bottom\" && host?.contentBelow ? \"\" : undefined}\n {...restProps}\n >\n <ToolbarTitleStyleContext.Provider value={placement === \"top\" ? titleStyle : undefined}>{children}</ToolbarTitleStyleContext.Provider>\n </div>\n )\n}\nToolbarRoot.displayName = \"Toolbar\"\n\n/**\n * A large title on a page scrolls up with the content under the row of controls; the row shows the\n * title inline once it has gone. The distance it travels (the gap above it and its height) goes to\n * `--toolbar-large-title-travel`, in pixels as a number, as the page's `--page-scroll-y` is.\n */\nfunction measureLargeTitle(bar: HTMLElement) {\n if (bar.dataset.titleStyle !== \"large\") return\n const heading = Array.from(bar.children).find((child): child is HTMLElement => child instanceof HTMLElement && child.classList.contains(s.Heading))\n if (!heading) return\n const gap = Number.parseFloat(getComputedStyle(bar).rowGap) || 0\n bar.style.setProperty(\"--toolbar-large-title-travel\", String(heading.offsetHeight + gap))\n}\n\n/* ------------------------------------------------------------------ */\n/* Parts */\n/* ------------------------------------------------------------------ */\n\nexport type ToolbarSlotProps = HTMLAttributes<HTMLDivElement> & { ref?: Ref<HTMLDivElement> }\n\nfunction ToolbarLeading({ className, ...restProps }: ToolbarSlotProps) {\n return <div className={clsx(s.Leading, className)} {...restProps} />\n}\nToolbarLeading.displayName = \"Toolbar.Leading\"\n\nfunction ToolbarTrailing({ className, ...restProps }: ToolbarSlotProps) {\n return <div className={clsx(s.Trailing, className)} {...restProps} />\n}\nToolbarTrailing.displayName = \"Toolbar.Trailing\"\n\nexport type ToolbarContentProps = ToolbarSlotProps & {\n /** Stretch between the leading and trailing items, as a search field does. */\n fill?: boolean\n}\n\n/** Custom middle content: a search field, a segmented control or a single centered action. */\nfunction ToolbarContent({ fill = false, className, ...restProps }: ToolbarContentProps) {\n return <div className={clsx(s.Content, className)} data-fill={fill ? \"\" : undefined} {...restProps} />\n}\nToolbarContent.displayName = \"Toolbar.Content\"\n\n/** Buttons that share one capsule. */\nfunction ToolbarGroup({ className, ...restProps }: ToolbarSlotProps) {\n return <div role=\"group\" className={clsx(s.Group, className)} {...restProps} />\n}\nToolbarGroup.displayName = \"Toolbar.Group\"\n\nexport type ToolbarTitleProps = Omit<HTMLAttributes<HTMLHeadingElement>, \"children\"> & {\n children: ReactNode\n /** A second, smaller line below the title. */\n subtitle?: ReactNode\n /**\n * Heading level. In a Dialog the dialog's own title names the Sheet, so the bar title is hidden from\n * assistive technology there. @default \"h1\"\n */\n as?: \"h1\" | \"h2\" | \"h3\"\n ref?: Ref<HTMLHeadingElement>\n}\n\nfunction ToolbarTitle({ children, subtitle, as, className, ref, ...restProps }: ToolbarTitleProps) {\n const host = useContext(ToolbarHostContext)\n const titleStyle = useContext(ToolbarTitleStyleContext)\n const decorative = host?.kind === \"dialog\"\n const Tag = as ?? \"h1\"\n const hasSubtitle = subtitle != null && subtitle !== false && subtitle !== \"\"\n const heading = (\n <div className={s.Heading} aria-hidden={decorative || undefined}>\n <Tag ref={ref} className={clsx(s.Title, className)} {...restProps}>{children}</Tag>\n {hasSubtitle && <p className={s.Subtitle}>{subtitle}</p>}\n </div>\n )\n if (titleStyle !== \"large\" || host?.kind !== \"page\") return heading\n // The inline copy the row of controls shows once the large title has scrolled under it. A subtitle stays\n // as a second line, as in the inline title (iOS 26 kit Toolbar - Top - iPhone, Title 2 Line).\n return (\n <>\n {heading}\n <span className={s.CollapsedTitle} aria-hidden=\"true\">\n {hasSubtitle ? <><span className={s.CollapsedLine}>{children}</span><span className={s.CollapsedSubtitle}>{subtitle}</span></> : children}\n </span>\n </>\n )\n}\nToolbarTitle.displayName = \"Toolbar.Title\"\n\n/* ------------------------------------------------------------------ */\n/* Compound */\n/* ------------------------------------------------------------------ */\n\nexport const Toolbar = ToolbarRoot as typeof ToolbarRoot & {\n Leading: typeof ToolbarLeading\n Title: typeof ToolbarTitle\n Content: typeof ToolbarContent\n Group: typeof ToolbarGroup\n Trailing: typeof ToolbarTrailing\n}\n\nToolbar.Leading = ToolbarLeading\nToolbar.Title = ToolbarTitle\nToolbar.Content = ToolbarContent\nToolbar.Group = ToolbarGroup\nToolbar.Trailing = ToolbarTrailing\n"]}
1
+ {"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../../src/components/Toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,MAAM,GAIP,MAAM,OAAO,CAAA;AACd,OAAO,CAAC,MAAM,sDAAsD,CAAA;AAkCpE,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAqB,IAAI,CAAC,CAAA;AAEzE,2GAA2G;AAC3G,MAAM,wBAAwB,GAAG,aAAa,CAAgC,SAAS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Q,EAAA,eAAM,SAAS,EAAE,CAAC,CAAC,iBAAiB,YAAG,QAAQ,GAAQ,IAAG,CAAC,CAAC,CAAC,QAAQ,GACpI,IACN,CACJ,CAAA;AACH,CAAC;AACD,YAAY,CAAC,WAAW,GAAG,eAAe,CAAA;AAE1C,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AAExE,MAAM,CAAC,MAAM,OAAO,GAAG,WAMtB,CAAA;AAED,OAAO,CAAC,OAAO,GAAG,cAAc,CAAA;AAChC,OAAO,CAAC,KAAK,GAAG,YAAY,CAAA;AAC5B,OAAO,CAAC,OAAO,GAAG,cAAc,CAAA;AAChC,OAAO,CAAC,KAAK,GAAG,YAAY,CAAA;AAC5B,OAAO,CAAC,QAAQ,GAAG,eAAe,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport {\n createContext,\n useCallback,\n useContext,\n useLayoutEffect,\n useRef,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n} from \"react\"\nimport s from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\nexport type ToolbarPlacement = \"top\" | \"bottom\"\n/** Title layouts of the phone top bar. */\nexport type ToolbarTitleStyle = \"inline\" | \"large\" | \"compact-large\" | \"compact-medium\"\nexport type ToolbarTitleAlign = \"center\" | \"start\"\n/**\n * How a bar meets the content scrolled under it, after the scroll edge effect of iOS 26:\n * - `\"soft\"` (the default of a bottom bar): at the top, the canvas color covers the content under the bar's controls and fades out past them, over a\n * light blur; at the bottom of a page the content stays clear under and around the controls, as on native iOS 26,\n * and a Sheet's bottom bar fades its content into the panel\n * - `\"hard\"`: an opaque bar of the canvas color with a line once content is under it\n * - `\"glass\"` (the default of a top bar): a translucent, blurred bar with a hairline, shown once content is under it\n * - `\"solid\"`: an opaque bar of the canvas color without a line\n */\nexport type BarBackground = \"soft\" | \"hard\" | \"glass\" | \"solid\"\n/** `\"edge\"` is the earlier name of `\"soft\"`. */\nexport type ToolbarBackground = BarBackground | \"edge\"\n\n/**\n * A surface that places phone toolbars: `Page` puts the top bar over its content\n * and reserves the space; `Dialog` puts it 16px under the Sheet's top edge.\n */\nexport type ToolbarHost = {\n kind: \"page\" | \"dialog\"\n setHeight?: (placement: ToolbarPlacement, height: number | undefined) => void\n /** Content has scrolled under the top bar, so its glass casts a shadow and a hard or glass bar shows its line. */\n scrolled?: boolean\n /** Content continues under the bottom bar, so a hard or glass bar shows its line. */\n contentBelow?: boolean\n /** Calls the listener with the content's scroll offset on every scroll; returns the unsubscribe. A TabBar minimizes with it. */\n subscribeScroll?: (listener: (scrollTop: number) => void) => () => void\n}\n\nexport const ToolbarHostContext = createContext<ToolbarHost | null>(null)\n\n// The title style of the top bar, which a large title on a page needs to show itself inline once scrolled.\nconst ToolbarTitleStyleContext = createContext<ToolbarTitleStyle | undefined>(undefined)\n\n/* ------------------------------------------------------------------ */\n/* Root */\n/* ------------------------------------------------------------------ */\n\nexport type ToolbarProps = HTMLAttributes<HTMLDivElement> & {\n /** @default \"top\" */\n placement?: ToolbarPlacement\n /** Layout of `Toolbar.Title` in a top bar. @default \"inline\" */\n titleStyle?: ToolbarTitleStyle\n /** Alignment of an inline title. Compact and large titles always start at the leading edge. @default \"center\" */\n titleAlign?: ToolbarTitleAlign\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" at the top, \"soft\" at the bottom */\n background?: ToolbarBackground\n ref?: Ref<HTMLDivElement>\n}\n\nfunction ToolbarRoot({\n placement = \"top\",\n titleStyle = \"inline\",\n titleAlign = \"center\",\n background = placement === \"bottom\" ? \"soft\" : \"glass\",\n className,\n children,\n ref,\n ...restProps\n}: ToolbarProps) {\n const host = useContext(ToolbarHostContext)\n const element = useRef<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n const setHeight = host?.setHeight\n useLayoutEffect(() => {\n const bar = element.current\n if (!bar || !setHeight) return\n // A desktop layout hides the bar; its height then leaves the host's own header in charge.\n const update = () => {\n setHeight(placement, bar.offsetHeight || undefined)\n measureLargeTitle(bar)\n }\n update()\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n return () => { observer?.disconnect(); setHeight(placement, undefined) }\n }, [placement, setHeight])\n\n return (\n <div\n ref={setRef}\n className={clsx(s.Toolbar, className)}\n data-toolbar=\"\"\n data-placement={placement}\n data-title-style={placement === \"top\" ? titleStyle : undefined}\n data-title-align={placement === \"top\" ? titleAlign : undefined}\n data-background={background === \"edge\" ? \"soft\" : background}\n data-host={host?.kind}\n data-scrolled={placement === \"top\" && host?.scrolled ? \"\" : undefined}\n data-content-below={placement === \"bottom\" && host?.contentBelow ? \"\" : undefined}\n {...restProps}\n >\n <ToolbarTitleStyleContext.Provider value={placement === \"top\" ? titleStyle : undefined}>{children}</ToolbarTitleStyleContext.Provider>\n </div>\n )\n}\nToolbarRoot.displayName = \"Toolbar\"\n\n/**\n * A large title on a page scrolls up with the content under the row of controls; the row shows the\n * title inline once it has gone. The distance it travels (the gap above it and its height) goes to\n * `--toolbar-large-title-travel`, in pixels as a number, as the page's `--page-scroll-y` is.\n */\nfunction measureLargeTitle(bar: HTMLElement) {\n if (bar.dataset.titleStyle !== \"large\") return\n const heading = Array.from(bar.children).find((child): child is HTMLElement => child instanceof HTMLElement && child.classList.contains(s.Heading))\n if (!heading) return\n const gap = Number.parseFloat(getComputedStyle(bar).rowGap) || 0\n bar.style.setProperty(\"--toolbar-large-title-travel\", String(heading.offsetHeight + gap))\n}\n\n/* ------------------------------------------------------------------ */\n/* Parts */\n/* ------------------------------------------------------------------ */\n\nexport type ToolbarSlotProps = HTMLAttributes<HTMLDivElement> & { ref?: Ref<HTMLDivElement> }\n\nfunction ToolbarLeading({ className, ...restProps }: ToolbarSlotProps) {\n return <div className={clsx(s.Leading, className)} {...restProps} />\n}\nToolbarLeading.displayName = \"Toolbar.Leading\"\n\nfunction ToolbarTrailing({ className, ...restProps }: ToolbarSlotProps) {\n return <div className={clsx(s.Trailing, className)} {...restProps} />\n}\nToolbarTrailing.displayName = \"Toolbar.Trailing\"\n\nexport type ToolbarContentProps = ToolbarSlotProps & {\n /** Stretch between the leading and trailing items, as a search field does. */\n fill?: boolean\n}\n\n/** Custom middle content: a search field, a segmented control or a single centered action. */\nfunction ToolbarContent({ fill = false, className, ...restProps }: ToolbarContentProps) {\n return <div className={clsx(s.Content, className)} data-fill={fill ? \"\" : undefined} {...restProps} />\n}\nToolbarContent.displayName = \"Toolbar.Content\"\n\n/** Buttons that share one capsule. */\nfunction ToolbarGroup({ className, ...restProps }: ToolbarSlotProps) {\n return <div role=\"group\" className={clsx(s.Group, className)} {...restProps} />\n}\nToolbarGroup.displayName = \"Toolbar.Group\"\n\nexport type ToolbarTitleProps = Omit<HTMLAttributes<HTMLHeadingElement>, \"children\"> & {\n children: ReactNode\n /** A second, smaller line below the title. */\n subtitle?: ReactNode\n /**\n * Heading level. In a Dialog the dialog's own title names the Sheet, so the bar title is hidden from\n * assistive technology there. @default \"h1\"\n */\n as?: \"h1\" | \"h2\" | \"h3\"\n ref?: Ref<HTMLHeadingElement>\n}\n\nfunction ToolbarTitle({ children, subtitle, as, className, ref, ...restProps }: ToolbarTitleProps) {\n const host = useContext(ToolbarHostContext)\n const titleStyle = useContext(ToolbarTitleStyleContext)\n const decorative = host?.kind === \"dialog\"\n const Tag = as ?? \"h1\"\n const hasSubtitle = subtitle != null && subtitle !== false && subtitle !== \"\"\n const heading = (\n <div className={s.Heading} aria-hidden={decorative || undefined}>\n <Tag ref={ref} className={clsx(s.Title, className)} {...restProps}>{children}</Tag>\n {hasSubtitle && <p className={s.Subtitle}>{subtitle}</p>}\n </div>\n )\n if (titleStyle !== \"large\" || host?.kind !== \"page\") return heading\n // The inline copy the row of controls shows once the large title has scrolled under it. A subtitle stays\n // as a second line, as in the inline title (iOS 26 kit Toolbar - Top - iPhone, Title 2 Line).\n return (\n <>\n {heading}\n <span className={s.CollapsedTitle} aria-hidden=\"true\">\n {hasSubtitle ? <><span className={s.CollapsedLine}>{children}</span><span className={s.CollapsedSubtitle}>{subtitle}</span></> : children}\n </span>\n </>\n )\n}\nToolbarTitle.displayName = \"Toolbar.Title\"\n\n/* ------------------------------------------------------------------ */\n/* Compound */\n/* ------------------------------------------------------------------ */\n\nexport const Toolbar = ToolbarRoot as typeof ToolbarRoot & {\n Leading: typeof ToolbarLeading\n Title: typeof ToolbarTitle\n Content: typeof ToolbarContent\n Group: typeof ToolbarGroup\n Trailing: typeof ToolbarTrailing\n}\n\nToolbar.Leading = ToolbarLeading\nToolbar.Title = ToolbarTitle\nToolbar.Content = ToolbarContent\nToolbar.Group = ToolbarGroup\nToolbar.Trailing = ToolbarTrailing\n"]}