@crewlethq/ui 0.38.0 → 0.40.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 (157) hide show
  1. package/README.md +79 -3
  2. package/dist/AgentHandoffPanel/index.js +3 -3
  3. package/dist/AppShell/AppShell.d.ts +13 -2
  4. package/dist/AppShell/index.js +1 -1
  5. package/dist/{AppShell-NDU4XMGF.css → AppShell-NPSWZ3XW.css} +45 -4
  6. package/dist/ArtifactBar/index.js +6 -5
  7. package/dist/{ArtifactBar-FWPBBKQ5.css → ArtifactBar-6PGWGKN2.css} +13 -1
  8. package/dist/ArtifactCard/index.js +2 -2
  9. package/dist/AuthLayout/index.js +2 -2
  10. package/dist/AvatarPicker/index.js +10 -6
  11. package/dist/Card/Card.d.ts +14 -2
  12. package/dist/Card/index.js +1 -1
  13. package/dist/{Card-G2ZGT5Z6.css → Card-JR2UPQH7.css} +20 -0
  14. package/dist/CatalogTile/CatalogTile.d.ts +47 -0
  15. package/dist/CatalogTile/index.d.ts +3 -0
  16. package/dist/CatalogTile/index.js +3 -0
  17. package/dist/CatalogTile-XL4XLFUH.css +135 -0
  18. package/dist/CharacterPicker/index.js +2 -2
  19. package/dist/Charts/Histogram.d.ts +71 -0
  20. package/dist/Charts/index.d.ts +2 -0
  21. package/dist/Charts/index.js +1 -1
  22. package/dist/{Charts-MBJG72BS.css → Charts-TZ744HT6.css} +118 -0
  23. package/dist/CodeBlock/index.js +1 -1
  24. package/dist/{CodeBlock-GYNJ2HI6.css → CodeBlock-N5ETJF24.css} +13 -0
  25. package/dist/CommandPalette/index.js +3 -3
  26. package/dist/CommentThread/index.js +3 -3
  27. package/dist/Composer/index.js +2 -2
  28. package/dist/DataGrid/DataGrid.d.ts +267 -0
  29. package/dist/DataGrid/index.d.ts +3 -0
  30. package/dist/DataGrid/index.js +7 -0
  31. package/dist/DataGrid-AQKPJD7W.css +482 -0
  32. package/dist/DataTable/index.js +2 -2
  33. package/dist/DataView/index.js +4 -4
  34. package/dist/DatasetSource/DatasetSource.d.ts +7 -1
  35. package/dist/DatasetSource/index.js +1 -1
  36. package/dist/HuePicker/index.js +11 -4
  37. package/dist/LayersList/index.js +2 -2
  38. package/dist/LinkInterstitial/index.js +2 -2
  39. package/dist/List/List.d.ts +8 -0
  40. package/dist/List/index.js +1 -1
  41. package/dist/{List-MYJIV6MP.css → List-YHLIZFK4.css} +46 -0
  42. package/dist/ListInput/ListInput.d.ts +9 -1
  43. package/dist/ListInput/index.js +2 -2
  44. package/dist/LockedLabel/LockedLabel.d.ts +34 -0
  45. package/dist/LockedLabel/index.d.ts +3 -0
  46. package/dist/LockedLabel/index.js +3 -0
  47. package/dist/LockedLabel-VQEGEB7G.css +16 -0
  48. package/dist/MarkdownEditor/index.js +8 -5
  49. package/dist/MergeConflicts/index.js +11 -5
  50. package/dist/Modal/index.js +1 -1
  51. package/dist/{Modal-7MWRCWAI.css → Modal-TOEWHDCQ.css} +5 -0
  52. package/dist/ObjectHeader/index.js +1 -1
  53. package/dist/{ObjectHeader-D7GU7QNI.css → ObjectHeader-ZOS22FKX.css} +7 -8
  54. package/dist/PageNote/PageNote.d.ts +14 -0
  55. package/dist/PageNote/index.d.ts +3 -0
  56. package/dist/PageNote/index.js +2 -0
  57. package/dist/PageNote-RHLXH3ML.css +12 -0
  58. package/dist/PropertyList/PropertyList.d.ts +88 -0
  59. package/dist/PropertyList/index.d.ts +3 -0
  60. package/dist/PropertyList/index.js +7 -0
  61. package/dist/PropertyList-SCYM66LL.css +96 -0
  62. package/dist/RelatedRow/RelatedRow.d.ts +27 -0
  63. package/dist/RelatedRow/index.d.ts +3 -0
  64. package/dist/RelatedRow/index.js +9 -0
  65. package/dist/RelatedRow-2FVS6QQA.css +6 -0
  66. package/dist/RichEditor/index.js +1 -1
  67. package/dist/SectionFrame/SectionFrame.d.ts +76 -0
  68. package/dist/SectionFrame/index.d.ts +3 -0
  69. package/dist/SectionFrame/index.js +7 -0
  70. package/dist/SectionFrame-M62UUVFQ.css +164 -0
  71. package/dist/SegmentedControl/index.js +11 -4
  72. package/dist/SettingsTable/SettingsTable.d.ts +66 -0
  73. package/dist/SettingsTable/index.d.ts +3 -0
  74. package/dist/SettingsTable/index.js +3 -0
  75. package/dist/SettingsTable-6DUFAFXG.css +160 -0
  76. package/dist/ShareDialog/index.js +2 -2
  77. package/dist/SheetColumnEditor/index.js +7 -6
  78. package/dist/SheetGrid/index.js +3 -3
  79. package/dist/SidebarNav/SidebarNav.d.ts +35 -2
  80. package/dist/SidebarNav/index.js +2 -1
  81. package/dist/{SidebarNav-7SGUZYKK.css → SidebarNav-YI74SPDC.css} +10 -0
  82. package/dist/StatCard/index.js +1 -1
  83. package/dist/{StatCard-4T7TMWMN.css → StatCard-HAA3F5GX.css} +8 -3
  84. package/dist/StatGroup/index.js +1 -1
  85. package/dist/{StatGroup-DOFHX5QJ.css → StatGroup-ZMW7VQWP.css} +27 -0
  86. package/dist/Switcher/index.js +2 -2
  87. package/dist/Tabs/Tabs.d.ts +55 -1
  88. package/dist/Tabs/fold.d.ts +54 -0
  89. package/dist/Tabs/index.d.ts +1 -1
  90. package/dist/Tabs/index.js +9 -2
  91. package/dist/Tabs/roving.d.ts +3 -3
  92. package/dist/{Tabs-WIF7457H.css → Tabs-S7F4RWAN.css} +77 -0
  93. package/dist/TagsInput/index.js +1 -1
  94. package/dist/ThemeGallery/index.js +2 -2
  95. package/dist/ThemeSwitcher/index.js +12 -5
  96. package/dist/TileGrid/TileGrid.d.ts +33 -0
  97. package/dist/TileGrid/index.d.ts +3 -0
  98. package/dist/TileGrid/index.js +2 -0
  99. package/dist/TileGrid-I6LNYD2H.css +52 -0
  100. package/dist/VersionCompare/index.js +12 -5
  101. package/dist/{chunk-B5J23C73.js → chunk-2PEXZ7L4.js} +1 -1
  102. package/dist/{chunk-S27UBCVX.js → chunk-2VOHUGUA.js} +2 -2
  103. package/dist/{chunk-XBURIXHO.js → chunk-3TXY3PJZ.js} +1 -1
  104. package/dist/{chunk-2QZ2VPHR.js → chunk-4OK4DX3V.js} +2 -2
  105. package/dist/chunk-4RKTZSEW.js +64 -0
  106. package/dist/{chunk-ECGGQX2H.js → chunk-A44YHLCQ.js} +2 -2
  107. package/dist/{chunk-F4LPQA4E.js → chunk-BA32AVKS.js} +1 -1
  108. package/dist/chunk-CV4NES3P.js +9 -0
  109. package/dist/{chunk-PPHTIKZO.js → chunk-E4BOVKNJ.js} +1 -1
  110. package/dist/{chunk-W7PAIVAP.js → chunk-E7QLG3PG.js} +30 -9
  111. package/dist/{chunk-RKKO7QHH.js → chunk-EGMQURBR.js} +5 -4
  112. package/dist/{chunk-GMW4ZHST.js → chunk-EX22Q5SH.js} +2 -2
  113. package/dist/{chunk-A23KDROH.js → chunk-FXBGEANQ.js} +1 -1
  114. package/dist/{chunk-4L2BWSHR.js → chunk-GFYQKMQZ.js} +2 -2
  115. package/dist/{chunk-HG5VF3TZ.js → chunk-HMVQQEHW.js} +91 -2
  116. package/dist/{chunk-IPWU6ERC.js → chunk-HQJ24WPM.js} +4 -2
  117. package/dist/{chunk-SVGARBDY.js → chunk-IAGYPTEJ.js} +2 -2
  118. package/dist/{chunk-ZK3VYY7L.js → chunk-INHXF2CL.js} +24 -11
  119. package/dist/chunk-INVSUFJK.js +71 -0
  120. package/dist/{chunk-6NNY5WBF.js → chunk-JKAGN4V4.js} +1 -1
  121. package/dist/{chunk-4LRAJXHL.js → chunk-JSWOXRRE.js} +1 -1
  122. package/dist/{chunk-DYB66CNM.js → chunk-KKNHMXTE.js} +6 -3
  123. package/dist/{chunk-UWRBD2YO.js → chunk-KNHUBHFX.js} +1 -1
  124. package/dist/{chunk-ZMDYQ2HH.js → chunk-KWWP3D7M.js} +1 -1
  125. package/dist/{chunk-46RL3E54.js → chunk-M6NQ4XGK.js} +1 -1
  126. package/dist/{chunk-PT6WKXKW.js → chunk-MMPKN7WV.js} +1 -1
  127. package/dist/{chunk-NRBAXRWE.js → chunk-N3TFYBN3.js} +1 -1
  128. package/dist/chunk-NNTO3TNC.js +9 -0
  129. package/dist/{chunk-DS2C73RJ.js → chunk-NZWX27J7.js} +2 -2
  130. package/dist/{chunk-VGE3G3T4.js → chunk-ODOJJGXH.js} +1 -1
  131. package/dist/chunk-OHGH7O6T.js +19 -0
  132. package/dist/{chunk-4ISUIS6F.js → chunk-OOC7Q67K.js} +1 -1
  133. package/dist/{chunk-BT5H2THK.js → chunk-OUD75UB2.js} +1 -1
  134. package/dist/chunk-PCT47E7O.js +48 -0
  135. package/dist/{chunk-X3UYTAOG.js → chunk-PFZOFAQ6.js} +1 -1
  136. package/dist/{chunk-YQG4PZGC.js → chunk-QRKT4XTT.js} +2 -2
  137. package/dist/{chunk-BJI3RFXG.js → chunk-S4DREXGM.js} +1 -1
  138. package/dist/{chunk-GDDE4UM7.js → chunk-SEC2GR2V.js} +1 -1
  139. package/dist/{chunk-YEVG2X5R.js → chunk-SNQRGH4A.js} +1 -1
  140. package/dist/chunk-T6MXORP5.js +116 -0
  141. package/dist/{chunk-OTCXRJ7D.js → chunk-U2XAJONO.js} +1 -1
  142. package/dist/{chunk-3ZUINC7C.js → chunk-WYYCPV46.js} +6 -1
  143. package/dist/chunk-X4IXXLWM.js +306 -0
  144. package/dist/{chunk-PAQXOP2M.js → chunk-XGBUUQDU.js} +2 -2
  145. package/dist/chunk-XIDD7PJO.js +416 -0
  146. package/dist/{chunk-XO7PUL4F.js → chunk-YPTTSJPM.js} +1 -1
  147. package/dist/chunk-ZUTUI27P.js +21 -0
  148. package/dist/generated/index.d.ts +9 -0
  149. package/dist/generated/index.js +83 -74
  150. package/dist/index.js +83 -74
  151. package/dist/styles.css +1627 -104
  152. package/package.json +3 -3
  153. package/dist/chunk-7SDUKCNW.js +0 -141
  154. package/dist/{Editor-QV4JP242.js → Editor-IRDQ3JDZ.js} +1 -1
  155. package/dist/{chunk-JZPK4IXR.js → chunk-3PR65I3H.js} +2 -2
  156. package/dist/{chunk-ETVEGR2Y.js → chunk-ISA2O2BK.js} +1 -1
  157. /package/dist/{chunk-4QQ3MND5.js → chunk-S3QTFUJX.js} +0 -0
@@ -1,12 +1,12 @@
1
1
  import { PageHeader } from './chunk-HOXGBLEY.js';
2
- import { DataTable } from './chunk-A23KDROH.js';
3
2
  import { DateTimePicker } from './chunk-UB6MLXUL.js';
3
+ import { DataTable } from './chunk-FXBGEANQ.js';
4
4
  import { useListbox, useOptionKeys } from './chunk-7KHM2FZH.js';
5
5
  import { Popover } from './chunk-KHJIEPZV.js';
6
6
  import { Toolbar } from './chunk-NR4CPM4T.js';
7
7
  import { RelativeTime } from './chunk-3CZ7XAVY.js';
8
- import { Kbd } from './chunk-SMBKXWML.js';
9
8
  import { Input } from './chunk-TYONQSOK.js';
9
+ import { Kbd } from './chunk-SMBKXWML.js';
10
10
  import { Count } from './chunk-BHHIIK3M.js';
11
11
  import { Menu } from './chunk-D6FEHY5G.js';
12
12
  import { Button } from './chunk-OG6CL3EB.js';
@@ -1,5 +1,5 @@
1
1
  import { BrandLockup } from './chunk-7KBNFFM3.js';
2
- import { Card } from './chunk-ZK3VYY7L.js';
2
+ import { Card } from './chunk-INHXF2CL.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import './AuthLayout-ODHBUPHQ.css';
5
5
  import { useId } from 'react';
@@ -1,6 +1,6 @@
1
1
  import { CopyButton } from './chunk-W46LPU4R.js';
2
2
  import { cx } from './chunk-ODEQTPFM.js';
3
- import './CodeBlock-GYNJ2HI6.css';
3
+ import './CodeBlock-N5ETJF24.css';
4
4
  import { forwardRef, useRef, useState, useLayoutEffect } from 'react';
5
5
  import { jsxs, jsx } from 'react/jsx-runtime';
6
6
 
@@ -1,4 +1,4 @@
1
- import { useRoving, tabStop } from './chunk-RKKO7QHH.js';
1
+ import { useRoving, tabStop } from './chunk-EGMQURBR.js';
2
2
  import { Avatar } from './chunk-PZKHBB7D.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import { CREWLET_CHARACTERS, CREWLET_CHARACTER_GEOMETRY } from '@crewlethq/icons/characters';
@@ -0,0 +1,116 @@
1
+ import { SetByLine } from './chunk-ODOJJGXH.js';
2
+ import { Link } from './chunk-FBSEJO2C.js';
3
+ import { DescriptionList, DescriptionListItem } from './chunk-MFS6F2P7.js';
4
+ import { EmptyValue } from './chunk-EUCC37WY.js';
5
+ import { cx } from './chunk-ODEQTPFM.js';
6
+ import './PropertyList-SCYM66LL.css';
7
+ import { useId, Fragment } from 'react';
8
+ import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
9
+
10
+ function absent(value) {
11
+ return value === null || value === void 0 || value === "";
12
+ }
13
+ function drawnSetBy(item) {
14
+ if (!item.setBy) return void 0;
15
+ if (absent(item.value) && !item.setBy.cleared) return void 0;
16
+ return item.setBy;
17
+ }
18
+ function attributions(items) {
19
+ const out = items.map(() => void 0);
20
+ let start = -1;
21
+ let key = "";
22
+ const close = (end) => {
23
+ if (start < 0) return;
24
+ out[end] = {
25
+ setBy: drawnSetBy(items[start]),
26
+ labels: items.slice(start, end + 1).map((item) => item.label)
27
+ };
28
+ start = -1;
29
+ key = "";
30
+ };
31
+ items.forEach((item, i) => {
32
+ const line = drawnSetBy(item);
33
+ if (!line) {
34
+ close(i - 1);
35
+ return;
36
+ }
37
+ const next = [line.actor, line.ago, line.turnHref, line.cleared, item.change].join("\0");
38
+ if (start >= 0 && next === key) return;
39
+ close(i - 1);
40
+ start = i;
41
+ key = next;
42
+ });
43
+ close(items.length - 1);
44
+ return out;
45
+ }
46
+ function PropertyList({
47
+ groups,
48
+ headings = "eyebrow",
49
+ emptyLabel = "Not set",
50
+ turnLabel,
51
+ "aria-label": ariaLabel,
52
+ className
53
+ }) {
54
+ const id = useId();
55
+ return /* @__PURE__ */ jsx(
56
+ "div",
57
+ {
58
+ role: ariaLabel ? "group" : void 0,
59
+ "aria-label": ariaLabel,
60
+ className: cx("crewlet-property-list", `crewlet-property-list--${headings}`, className),
61
+ children: groups.map((group, index) => {
62
+ const headingId = `${id}-group-${index}`;
63
+ const collapsed = group.whenAllAbsent !== void 0 && group.items.every((item) => absent(item.value));
64
+ const lines = collapsed ? [] : attributions(group.items);
65
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
66
+ group.name ? /* @__PURE__ */ jsx("div", { id: headingId, className: "crewlet-property-list__heading", children: group.name }) : null,
67
+ collapsed ? /* @__PURE__ */ jsx("p", { className: "crewlet-property-list__empty", children: group.whenAllAbsent }) : /* @__PURE__ */ jsx(
68
+ DescriptionList,
69
+ {
70
+ className: "crewlet-property-list__group",
71
+ "aria-labelledby": group.name ? headingId : void 0,
72
+ children: group.items.map((item, row) => {
73
+ const line = lines[row];
74
+ return /* @__PURE__ */ jsxs(
75
+ DescriptionListItem,
76
+ {
77
+ term: item.title || item.identifierLabel ? /* @__PURE__ */ jsx(
78
+ "span",
79
+ {
80
+ title: item.title,
81
+ className: item.identifierLabel ? "crewlet-property-list__identifier" : void 0,
82
+ children: item.label
83
+ }
84
+ ) : item.label,
85
+ children: [
86
+ /* @__PURE__ */ jsx(Value, { item, emptyLabel }),
87
+ line ? /* @__PURE__ */ jsx(
88
+ SetByLine,
89
+ {
90
+ setBy: line.setBy,
91
+ fields: line.labels,
92
+ turnLabel,
93
+ className: "crewlet-property-list__set-by"
94
+ }
95
+ ) : null
96
+ ]
97
+ },
98
+ item.label
99
+ );
100
+ })
101
+ }
102
+ )
103
+ ] }, group.name ?? index);
104
+ })
105
+ }
106
+ );
107
+ }
108
+ function Value({ item, emptyLabel }) {
109
+ if (absent(item.value)) return /* @__PURE__ */ jsx(EmptyValue, { label: emptyLabel });
110
+ if (item.href) {
111
+ return /* @__PURE__ */ jsx(Link, { href: item.href, size: "inherit", children: item.value });
112
+ }
113
+ return /* @__PURE__ */ jsx(Fragment$1, { children: item.value });
114
+ }
115
+
116
+ export { PropertyList };
@@ -2,7 +2,7 @@ import { Skeleton } from './chunk-TEUQWOWZ.js';
2
2
  import { PrincipalAvatar } from './chunk-CI3VPIJN.js';
3
3
  import { RelativeTime } from './chunk-3CZ7XAVY.js';
4
4
  import { ArtifactKindGround } from './chunk-UBZDYOCA.js';
5
- import { Card } from './chunk-ZK3VYY7L.js';
5
+ import { Card } from './chunk-INHXF2CL.js';
6
6
  import { AvatarStack } from './chunk-5AQBPHZD.js';
7
7
  import { ArtifactAccessGlyph } from './chunk-BGLKLXL3.js';
8
8
  import { ArtifactKindGlyph } from './chunk-CE2THTQR.js';
@@ -1,5 +1,5 @@
1
- import { Kbd } from './chunk-SMBKXWML.js';
2
1
  import { FormField, Textarea, Input } from './chunk-TYONQSOK.js';
2
+ import { Kbd } from './chunk-SMBKXWML.js';
3
3
  import { announce } from './chunk-RSAQOKH3.js';
4
4
  import { isComposing } from './chunk-H5XTJ7GJ.js';
5
5
  import { IconButton } from './chunk-4FQT6ZAY.js';
@@ -24,6 +24,7 @@ function ListInput({
24
24
  disabled = false,
25
25
  optional,
26
26
  enterHint = true,
27
+ focusOnMount = false,
27
28
  addLabel = (name) => `Add ${name}`,
28
29
  itemLabel = (name, position) => `${name} ${position}`,
29
30
  newItemLabel = (name) => `New ${name}`,
@@ -45,6 +46,10 @@ function ListInput({
45
46
  const downs = useRef(/* @__PURE__ */ new Map());
46
47
  const addBox = useRef(null);
47
48
  const focusNext = useRef(null);
49
+ const focusAtMount = useRef(focusOnMount);
50
+ useLayoutEffect(() => {
51
+ if (focusAtMount.current) addBox.current?.focus();
52
+ }, []);
48
53
  useLayoutEffect(() => {
49
54
  const want = focusNext.current;
50
55
  if (!want) return;
@@ -0,0 +1,306 @@
1
+ import { StatusDot } from './chunk-WIATRXEJ.js';
2
+ import { useRoving, tabStop } from './chunk-EGMQURBR.js';
3
+ import { Count } from './chunk-BHHIIK3M.js';
4
+ import { Menu } from './chunk-D6FEHY5G.js';
5
+ import { HIT_AREA_CLASS } from './chunk-2YTOOH3A.js';
6
+ import { VisuallyHidden } from './chunk-BZFWDIV6.js';
7
+ import { cx } from './chunk-ODEQTPFM.js';
8
+ import './HitArea-QUOS6ZDJ.css';
9
+ import './Tabs-S7F4RWAN.css';
10
+ import React, { useRef, useImperativeHandle, useLayoutEffect, useState } from 'react';
11
+ import { ChevronDownGlyph } from '@crewlethq/icons/glyphs';
12
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
13
+
14
+ function foldTabs({
15
+ widths,
16
+ current,
17
+ space,
18
+ gap,
19
+ more
20
+ }) {
21
+ const all = widths.reduce((sum, w) => sum + w, 0) + gap * Math.max(0, widths.length - 1);
22
+ if (all <= space) return [];
23
+ let used = more + (current >= 0 ? (widths[current] ?? 0) + gap : 0);
24
+ const kept = new Set(current >= 0 ? [current] : []);
25
+ for (let i = 0; i < widths.length; i++) {
26
+ if (i === current) continue;
27
+ const next = used + (widths[i] ?? 0) + gap;
28
+ if (next > space) break;
29
+ used = next;
30
+ kept.add(i);
31
+ }
32
+ return widths.map((_, i) => i).filter((i) => !kept.has(i));
33
+ }
34
+ function noteFits({
35
+ widths,
36
+ space,
37
+ gap,
38
+ note
39
+ }) {
40
+ if (note <= 0) return false;
41
+ const tabs = widths.reduce((sum, w) => sum + w, 0) + gap * Math.max(0, widths.length - 1);
42
+ return tabs + gap + note <= space;
43
+ }
44
+ var NOTHING_FOLDED = { folded: [], note: true };
45
+ var px = (value) => parseFloat(value) || 0;
46
+ var widthOf = (el) => el ? el.getBoundingClientRect().width : 0;
47
+ function useFold(enabled, box, row, values, current) {
48
+ const [fold, setFold] = useState(NOTHING_FOLDED);
49
+ const signature = values.join("\n");
50
+ useLayoutEffect(() => {
51
+ const outer = box.current;
52
+ const inner = row.current;
53
+ if (!enabled || !outer || !inner) return;
54
+ const keys = signature === "" ? [] : signature.split("\n");
55
+ const measure = () => {
56
+ const boxStyle = getComputedStyle(outer);
57
+ let space = outer.clientWidth - px(boxStyle.paddingLeft) - px(boxStyle.paddingRight);
58
+ const rowStyle = getComputedStyle(inner);
59
+ const gap = px(rowStyle.columnGap);
60
+ let more = widthOf(outer.querySelector("[data-tabs-more]"));
61
+ if (inner !== outer) {
62
+ space -= px(rowStyle.paddingLeft) + px(rowStyle.paddingRight) + px(rowStyle.borderLeftWidth) + px(rowStyle.borderRightWidth);
63
+ more += px(boxStyle.columnGap) - gap;
64
+ }
65
+ const trailing = outer.querySelector("[data-tabs-trailing]");
66
+ if (trailing) space -= widthOf(trailing) + gap;
67
+ const widths = [...inner.querySelectorAll(".crewlet-tabs__tab")].map(widthOf);
68
+ const next = foldTabs({ widths, current: current ? keys.indexOf(current) : -1, space, gap, more }).map((i) => keys[i]).filter((key) => key !== void 0);
69
+ const note = noteFits({ widths, space, gap, note: widthOf(outer.querySelector("[data-tabs-note]")) });
70
+ setFold(
71
+ (was) => was.note === note && was.folded.join("\n") === next.join("\n") ? was : { folded: next, note }
72
+ );
73
+ };
74
+ measure();
75
+ if (typeof ResizeObserver !== "function") return;
76
+ const watch = new ResizeObserver(measure);
77
+ watch.observe(outer);
78
+ for (const item of outer.querySelectorAll(
79
+ ".crewlet-tabs__tab, [data-tabs-more], [data-tabs-note], [data-tabs-trailing]"
80
+ )) {
81
+ watch.observe(item);
82
+ }
83
+ return () => watch.disconnect();
84
+ }, [enabled, box, row, signature, current]);
85
+ return enabled ? fold : NOTHING_FOLDED;
86
+ }
87
+ var FOLDED = { "aria-hidden": true, inert: true };
88
+ var SHOWN = {};
89
+ function figureOf(count) {
90
+ if (count === null || count === void 0 || count === "") return void 0;
91
+ return typeof count === "number" ? count.toLocaleString() : count;
92
+ }
93
+ function tabId(panelId, value) {
94
+ return `${panelId}-tab-${value}`;
95
+ }
96
+ function reveal(nav) {
97
+ const active = nav.querySelector(".crewlet-tabs__tab.is-active");
98
+ if (!active) return;
99
+ const row = nav.getBoundingClientRect();
100
+ const tab = active.getBoundingClientRect();
101
+ if (tab.left < row.left) nav.scrollLeft -= row.left - tab.left;
102
+ else if (tab.right > row.right) nav.scrollLeft += tab.right - row.right;
103
+ }
104
+ function Tabs({
105
+ items,
106
+ variant = "pill",
107
+ size = "md",
108
+ ariaLabel,
109
+ className = "",
110
+ value,
111
+ onValueChange,
112
+ panelId,
113
+ renderItem,
114
+ trailing,
115
+ overflow = "scroll",
116
+ moreLabel = "More",
117
+ moreMenuLabel,
118
+ note,
119
+ ref
120
+ }) {
121
+ const navRef = useRef(null);
122
+ const boxRef = useRef(null);
123
+ const folding = overflow === "menu";
124
+ const boxed = folding && !renderItem;
125
+ useImperativeHandle(ref, () => boxed ? boxRef.current : navRef.current, [boxed]);
126
+ const { buttons, onKeyDown } = useRoving(items.length, null);
127
+ const fold = useFold(
128
+ folding,
129
+ boxed ? boxRef : navRef,
130
+ navRef,
131
+ items.map((item) => item.value),
132
+ value
133
+ );
134
+ const isFolded = (item) => fold.folded.includes(item.value);
135
+ useLayoutEffect(() => {
136
+ if (variant !== "underline") return;
137
+ const nav = navRef.current;
138
+ if (!nav) return;
139
+ const update = () => {
140
+ const active = nav.querySelector(".crewlet-tabs__tab.is-active");
141
+ if (!active) {
142
+ nav.style.setProperty("--crewlet-tabs-slider-width", "0px");
143
+ return;
144
+ }
145
+ const navRect = nav.getBoundingClientRect();
146
+ const activeRect = active.getBoundingClientRect();
147
+ const left = activeRect.left - navRect.left + nav.scrollLeft;
148
+ nav.style.setProperty("--crewlet-tabs-slider-left", `${left}px`);
149
+ nav.style.setProperty("--crewlet-tabs-slider-width", `${activeRect.width}px`);
150
+ };
151
+ update();
152
+ reveal(nav);
153
+ const mutation = new MutationObserver(update);
154
+ const resize = typeof ResizeObserver === "function" ? new ResizeObserver(update) : null;
155
+ nav.querySelectorAll(".crewlet-tabs__tab").forEach((tab) => {
156
+ mutation.observe(tab, { attributes: true, attributeFilter: ["class"] });
157
+ resize?.observe(tab);
158
+ });
159
+ resize?.observe(nav);
160
+ return () => {
161
+ mutation.disconnect();
162
+ resize?.disconnect();
163
+ };
164
+ }, [variant, value, items]);
165
+ const rootClass = cx(
166
+ "crewlet-tabs",
167
+ `crewlet-tabs--${variant}`,
168
+ `crewlet-tabs--${size}`,
169
+ folding && "crewlet-tabs--fold",
170
+ !boxed && className
171
+ );
172
+ const selected = tabStop(
173
+ items.map((item) => ({ disabled: item.disabled || isFolded(item) })),
174
+ Math.max(
175
+ 0,
176
+ items.findIndex((item) => item.value === value)
177
+ )
178
+ );
179
+ const rows = items.map((item, index) => {
180
+ const isActive = value !== void 0 && value === item.value;
181
+ const folded = isFolded(item);
182
+ const tabClassName = cx(
183
+ "crewlet-tabs__tab",
184
+ HIT_AREA_CLASS,
185
+ isActive && "is-active",
186
+ item.disabled && "is-disabled",
187
+ folded && "is-folded"
188
+ );
189
+ const icon = item.live ? /* @__PURE__ */ jsx(StatusDot, { tone: "info", pulse: true }) : item.icon;
190
+ const children = /* @__PURE__ */ jsxs(Fragment, { children: [
191
+ icon ? /* @__PURE__ */ jsx("span", { className: "crewlet-tabs__icon", children: icon }) : null,
192
+ /* @__PURE__ */ jsxs("span", { className: "crewlet-tabs__label", children: [
193
+ item.label,
194
+ item.live ? /* @__PURE__ */ jsx(VisuallyHidden, { children: `, ${item.live}` }) : null
195
+ ] }),
196
+ item.marker ? item.marker.tone === "danger" ? /* @__PURE__ */ jsxs("span", { className: "crewlet-tabs__marker crewlet-tabs__marker--danger", children: [
197
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: item.marker.count }),
198
+ /* @__PURE__ */ jsx(VisuallyHidden, { children: item.marker.label })
199
+ ] }) : /* @__PURE__ */ jsx("span", { className: `crewlet-tabs__marker crewlet-tabs__marker--${item.marker.tone}`, children: /* @__PURE__ */ jsx(VisuallyHidden, { children: item.marker.label }) }) : item.count != null && item.count !== "" ? /* @__PURE__ */ jsx(Count, { value: item.count }) : null
200
+ ] });
201
+ const onSelect = () => {
202
+ if (item.disabled) return;
203
+ onValueChange?.(item.value);
204
+ };
205
+ if (renderItem) {
206
+ return /* @__PURE__ */ jsx(React.Fragment, { children: renderItem({
207
+ item,
208
+ className: tabClassName,
209
+ isActive,
210
+ onSelect,
211
+ children,
212
+ folded,
213
+ foldProps: folded ? FOLDED : SHOWN
214
+ }) }, item.value);
215
+ }
216
+ return /* @__PURE__ */ jsx(
217
+ "button",
218
+ {
219
+ ref: (el) => {
220
+ buttons.current[index] = el;
221
+ },
222
+ type: "button",
223
+ role: "tab",
224
+ id: panelId ? tabId(panelId, item.value) : void 0,
225
+ "aria-selected": isActive,
226
+ "aria-controls": panelId,
227
+ tabIndex: index === selected ? 0 : -1,
228
+ disabled: item.disabled,
229
+ className: tabClassName,
230
+ ...folded ? FOLDED : SHOWN,
231
+ onClick: onSelect,
232
+ onKeyDown: (event) => onKeyDown(event, false),
233
+ children
234
+ },
235
+ item.value
236
+ );
237
+ });
238
+ const out = folding ? items.filter(isFolded) : [];
239
+ const more = folding ? /* @__PURE__ */ jsx(
240
+ "span",
241
+ {
242
+ className: cx("crewlet-tabs__more", out.length === 0 && "is-folded"),
243
+ "data-tabs-more": "",
244
+ ...out.length === 0 ? FOLDED : SHOWN,
245
+ children: /* @__PURE__ */ jsx(
246
+ Menu,
247
+ {
248
+ label: moreMenuLabel ?? (ariaLabel ? `More of ${ariaLabel}` : moreLabel),
249
+ trigger: moreLabel,
250
+ trailingIcon: /* @__PURE__ */ jsx(ChevronDownGlyph, { size: "xs", "aria-hidden": "true" }),
251
+ triggerVariant: "ghost",
252
+ align: "end",
253
+ items: out.map(
254
+ (item) => ({
255
+ key: item.value,
256
+ label: item.menuLabel ?? (typeof item.label === "string" ? item.label : item.value),
257
+ hint: figureOf(item.count),
258
+ disabled: item.disabled,
259
+ ...item.live ? { icon: /* @__PURE__ */ jsx(StatusDot, { tone: "info", pulse: true }), description: item.live } : {},
260
+ ...!item.live && item.marker ? { description: item.marker.label } : {},
261
+ onSelect: () => onValueChange?.(item.value)
262
+ })
263
+ )
264
+ }
265
+ )
266
+ }
267
+ ) : null;
268
+ const noteNode = folding && note ? /* @__PURE__ */ jsx(
269
+ "span",
270
+ {
271
+ className: cx("crewlet-tabs__note", !fold.note && "is-folded"),
272
+ "data-tabs-note": "",
273
+ ...fold.note ? {} : { "aria-hidden": true },
274
+ children: note
275
+ }
276
+ ) : null;
277
+ if (renderItem) {
278
+ return /* @__PURE__ */ jsxs("nav", { ref: navRef, className: rootClass, "aria-label": ariaLabel, children: [
279
+ rows,
280
+ more,
281
+ noteNode,
282
+ folding && trailing ? /* @__PURE__ */ jsx("span", { className: "crewlet-tabs__trailing", "data-tabs-trailing": "", children: trailing }) : trailing
283
+ ] });
284
+ }
285
+ const list = /* @__PURE__ */ jsx("div", { ref: navRef, className: rootClass, "aria-label": ariaLabel, role: "tablist", children: rows });
286
+ if (!boxed) return list;
287
+ return /* @__PURE__ */ jsxs("div", { ref: boxRef, className: cx("crewlet-tabs-fold", `crewlet-tabs-fold--${variant}`, className), children: [
288
+ list,
289
+ more,
290
+ noteNode
291
+ ] });
292
+ }
293
+ function TabPanel({ id, value, children, className }) {
294
+ return /* @__PURE__ */ jsx(
295
+ "div",
296
+ {
297
+ role: "tabpanel",
298
+ id,
299
+ "aria-labelledby": tabId(id, value),
300
+ className: cx("crewlet-tab-panel", className),
301
+ children
302
+ }
303
+ );
304
+ }
305
+
306
+ export { TabPanel, Tabs, tabId };
@@ -1,7 +1,7 @@
1
- import { Modal } from './chunk-SVGARBDY.js';
1
+ import { Modal } from './chunk-IAGYPTEJ.js';
2
2
  import { useListbox, useHighlightRest } from './chunk-7KHM2FZH.js';
3
- import { Kbd } from './chunk-SMBKXWML.js';
4
3
  import { Input } from './chunk-TYONQSOK.js';
4
+ import { Kbd } from './chunk-SMBKXWML.js';
5
5
  import { Count } from './chunk-BHHIIK3M.js';
6
6
  import { isComposing } from './chunk-H5XTJ7GJ.js';
7
7
  import { HIT_AREA_CLASS } from './chunk-2YTOOH3A.js';