@adecore/ui 0.31.11 → 0.32.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 (163) hide show
  1. package/dist/AccentSwatches.js +290 -13
  2. package/dist/Banner.js +90 -9
  3. package/dist/Button.js +114 -22
  4. package/dist/ButtonGroup.js +62 -8
  5. package/dist/Checkbox.js +73 -4
  6. package/dist/ChoiceCards.js +205 -11
  7. package/dist/CloseButton.js +87 -7
  8. package/dist/ColorSwatch.js +132 -15
  9. package/dist/ColorWheelPicker.js +305 -71
  10. package/dist/ColumnResizeHandle.js +43 -8
  11. package/dist/DisabledReason.js +27 -8
  12. package/dist/DockShell.js +144 -37
  13. package/dist/EmptyState.js +95 -6
  14. package/dist/ErrorBoundary.js +254 -31
  15. package/dist/Field.js +349 -31
  16. package/dist/FileIcon.js +67 -6
  17. package/dist/Icon.js +38 -6
  18. package/dist/IconButton.js +176 -20
  19. package/dist/IconPicker.js +344 -73
  20. package/dist/Input.js +233 -14
  21. package/dist/Kbd.js +150 -10
  22. package/dist/LazyBoundary.js +14 -5
  23. package/dist/ListRow.js +75 -15
  24. package/dist/Meter.js +108 -5
  25. package/dist/MiddleTruncate.js +126 -45
  26. package/dist/PanelEmpty.js +64 -5
  27. package/dist/PanelHeader.js +95 -13
  28. package/dist/Pill.js +114 -19
  29. package/dist/ProjectSwitcher.js +225 -12
  30. package/dist/PromptDialog.js +352 -37
  31. package/dist/SectionLabel.js +62 -8
  32. package/dist/SegmentBar.js +197 -36
  33. package/dist/Segmented.js +130 -23
  34. package/dist/Select.js +310 -19
  35. package/dist/SelectSearch.js +344 -29
  36. package/dist/Separator.js +35 -4
  37. package/dist/ShortcutHints.js +146 -76
  38. package/dist/Skeleton.js +31 -4
  39. package/dist/Slider.js +172 -10
  40. package/dist/SlidingColumn.js +194 -34
  41. package/dist/Spinner.js +100 -3
  42. package/dist/Stepper.js +232 -11
  43. package/dist/Surface.js +62 -8
  44. package/dist/Switch.js +60 -6
  45. package/dist/TextMenu.js +212 -17
  46. package/dist/Tile.js +149 -5
  47. package/dist/Toasts.js +391 -33
  48. package/dist/Tooltip.js +153 -16
  49. package/dist/UIProvider.js +62 -15
  50. package/dist/Waveform.js +362 -93
  51. package/dist/Wipe.js +259 -34
  52. package/dist/ZoomControls.js +356 -14
  53. package/dist/class-name.js +1 -1
  54. package/dist/clipboard.js +15 -17
  55. package/dist/context-menu/index.parts.js +1 -1
  56. package/dist/dialog/index.parts.js +1 -1
  57. package/dist/dialog/parts.js +378 -29
  58. package/dist/dialog-layer.js +51 -18
  59. package/dist/error-boundary.js +19 -19
  60. package/dist/error-message.js +1 -1
  61. package/dist/field-context.js +7 -5
  62. package/dist/file-icon.js +23 -21
  63. package/dist/file-tree/helpers.js +133 -119
  64. package/dist/file-tree/index.parts.js +3 -3
  65. package/dist/file-tree/parts.js +418 -127
  66. package/dist/file-tree/style.js +1 -1
  67. package/dist/file-tree/use-file-tree-shift.js +43 -30
  68. package/dist/file-tree/use-file-tree.js +60 -18
  69. package/dist/file-tree/use-slots.js +220 -192
  70. package/dist/floating.js +2 -2
  71. package/dist/format/datetime.js +88 -38
  72. package/dist/format/duration.js +59 -53
  73. package/dist/format/index.js +1 -1
  74. package/dist/format/locale.js +76 -56
  75. package/dist/format/number.js +77 -61
  76. package/dist/format/regions.js +4 -2
  77. package/dist/format/time-zone.js +1 -1
  78. package/dist/icon-button-size.js +12 -2
  79. package/dist/icon-picker.js +70 -61
  80. package/dist/index.js +57 -57
  81. package/dist/key-value-list/index.parts.js +1 -1
  82. package/dist/key-value-list/parts.js +256 -22
  83. package/dist/lazy-landings.js +10 -10
  84. package/dist/lazy.js +84 -71
  85. package/dist/locales/en.js +80 -80
  86. package/dist/locales/nl.js +80 -80
  87. package/dist/locales.js +10 -7
  88. package/dist/menu/index.parts.js +1 -1
  89. package/dist/menu/parts.js +882 -44
  90. package/dist/merge-refs.js +8 -9
  91. package/dist/middle-truncate.js +24 -25
  92. package/dist/modality.js +27 -19
  93. package/dist/placement.js +11 -20
  94. package/dist/platform.js +6 -6
  95. package/dist/popover/index.parts.js +1 -1
  96. package/dist/popover/parts.js +173 -11
  97. package/dist/popup-layer.js +38 -17
  98. package/dist/prefetch.js +78 -79
  99. package/dist/preview-card/index.parts.js +1 -1
  100. package/dist/project-switcher-row.js +153 -12
  101. package/dist/select-row.js +69 -5
  102. package/dist/select-shared.js +6 -6
  103. package/dist/selection.js +16 -16
  104. package/dist/seti-icons.js +413 -413
  105. package/dist/settings/ConfirmDialog.js +55 -8
  106. package/dist/settings/DetailHeader.js +72 -4
  107. package/dist/settings/MasterDetail.js +119 -7
  108. package/dist/settings/SettingsDialog.js +820 -80
  109. package/dist/settings/SettingsRow.js +205 -18
  110. package/dist/settings/SettingsSection.js +96 -6
  111. package/dist/settings/index.js +7 -7
  112. package/dist/settings/target.js +7 -2
  113. package/dist/shortcut-hints.js +73 -55
  114. package/dist/shortcut.js +140 -104
  115. package/dist/step-places.js +1 -1
  116. package/dist/tabs/index.parts.js +1 -1
  117. package/dist/tabs/overflow.js +18 -18
  118. package/dist/tabs/parts.js +780 -166
  119. package/dist/testing/dedupe.js +82 -75
  120. package/dist/testing/fake-source.js +12 -12
  121. package/dist/testing/index.js +1 -1
  122. package/dist/toast-store.js +65 -46
  123. package/dist/tree/index.parts.js +1 -1
  124. package/dist/tree/parts.js +721 -94
  125. package/dist/tree/shift.js +28 -22
  126. package/dist/tree/style.js +2 -2
  127. package/dist/tree/use-tree-shift.js +178 -117
  128. package/dist/useAsyncAction.js +23 -19
  129. package/dist/useColumnResize.js +36 -34
  130. package/dist/useContentSize.js +62 -18
  131. package/dist/useMeasuredWidth.js +14 -3
  132. package/dist/useNow.js +73 -30
  133. package/dist/wipe-split.js +14 -14
  134. package/dist/workspace/DropPreview.js +60 -7
  135. package/dist/workspace/SplitView.js +1025 -441
  136. package/dist/workspace/TabStrip.js +810 -191
  137. package/dist/workspace/Workspace.js +276 -26
  138. package/dist/workspace/context.js +8 -3
  139. package/dist/workspace/geometry.js +173 -150
  140. package/dist/workspace/model.js +313 -250
  141. package/dist/workspace/preview.js +61 -61
  142. package/dist/zoom.js +2 -2
  143. package/package.json +1 -1
  144. package/src/ErrorBoundary.tsx +1 -1
  145. package/src/Field.tsx +4 -3
  146. package/src/IconPicker.tsx +3 -3
  147. package/src/LazyBoundary.tsx +2 -0
  148. package/src/MiddleTruncate.tsx +2 -2
  149. package/src/SegmentBar.tsx +2 -2
  150. package/src/Toasts.tsx +3 -1
  151. package/src/Tooltip.tsx +7 -10
  152. package/src/Waveform.tsx +3 -3
  153. package/src/file-tree/parts.tsx +6 -9
  154. package/src/file-tree/use-file-tree-shift.tsx +6 -9
  155. package/src/lazy.tsx +4 -0
  156. package/src/locales/en.ts +4 -4
  157. package/src/locales/nl.ts +5 -5
  158. package/src/settings/SettingsDialog.tsx +1 -1
  159. package/src/tree/parts.tsx +5 -8
  160. package/src/useContentSize.ts +3 -3
  161. package/src/workspace/SplitView.tsx +2 -2
  162. package/src/workspace/TabStrip.tsx +2 -3
  163. package/src/workspace/Workspace.tsx +2 -5
@@ -1,4 +1,4 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Children, createContext, isValidElement, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { ChevronDown, X } from 'lucide-react';
@@ -7,12 +7,16 @@ import { Tabs as BaseTabs } from '@base-ui/react/tabs';
7
7
  import { useRender } from '@base-ui/react/use-render';
8
8
  import { withClass } from '../class-name.js';
9
9
  import { formatNumber } from '../format/number.js';
10
- import { Icon } from '../Icon.js';
11
- import { IconButton } from '../IconButton.js';
12
- import { MenuItem, MenuPopup, MenuRoot, MenuTrigger } from '../menu/parts.js';
13
- import { Pill } from '../Pill.js';
10
+ import { Icon } from "../Icon.js";
11
+ import { IconButton } from "../IconButton.js";
12
+ import { MenuItem, MenuPopup, MenuRoot, MenuTrigger } from "../menu/parts.js";
13
+ import { Pill } from "../Pill.js";
14
14
  import { shownTabs } from './overflow.js';
15
- const SelectionContext = createContext({ value: undefined, select: () => { } });
15
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
16
+ const SelectionContext = createContext({
17
+ value: undefined,
18
+ select: () => {}
19
+ });
16
20
  /* Whether a part is drawn in the menu of tabs that do not fit, where a count goes to the end of its row. */
17
21
  const InMenuContext = createContext(false);
18
22
  /* The underline sits over the strip's border rather than above it, without a negative margin that would make the strip scroll. */
@@ -24,29 +28,124 @@ const PILL = 'relative flex h-7 shrink-0 items-center gap-1.5 whitespace-nowrap
24
28
  const PILL_MORE = clsx(PILL, 'ml-auto data-[popup-open]:bg-surface-active data-[popup-open]:text-text');
25
29
  const VariantContext = createContext('line');
26
30
  const STYLES = {
27
- line: { strip: 'gap-4 border-b border-border', list: 'items-end gap-4', row: 'gap-4', tab: TAB, more: MORE },
28
- pill: { strip: 'gap-1', list: 'items-center gap-1', row: 'gap-1', tab: PILL, more: PILL_MORE }
31
+ line: {
32
+ strip: 'gap-4 border-b border-border',
33
+ list: 'items-end gap-4',
34
+ row: 'gap-4',
35
+ tab: TAB,
36
+ more: MORE
37
+ },
38
+ pill: {
39
+ strip: 'gap-1',
40
+ list: 'items-center gap-1',
41
+ row: 'gap-1',
42
+ tab: PILL,
43
+ more: PILL_MORE
44
+ }
29
45
  };
30
46
  /* Holds the picked tab itself, uncontrolled or not, so a tab picked from the menu of the strip changes it too. */
31
- export function TabsRoot({ value, defaultValue = 0, onValueChange, ...props }) {
32
- const [own, setOwn] = useState(defaultValue);
33
- const controlled = value !== undefined;
34
- const current = controlled ? value : own;
35
- // The latest handler without a new context for every render of a parent that writes it inline.
36
- const latest = useRef(onValueChange);
37
- useLayoutEffect(() => {
38
- latest.current = onValueChange;
47
+ export function TabsRoot(t0) {
48
+ const $ = _c(21);
49
+ let onValueChange;
50
+ let props;
51
+ let t1;
52
+ let value;
53
+ if ($[0] !== t0) {
54
+ ({
55
+ value,
56
+ defaultValue: t1,
57
+ onValueChange,
58
+ ...props
59
+ } = t0);
60
+ $[0] = t0;
61
+ $[1] = onValueChange;
62
+ $[2] = props;
63
+ $[3] = t1;
64
+ $[4] = value;
65
+ } else {
66
+ onValueChange = $[1];
67
+ props = $[2];
68
+ t1 = $[3];
69
+ value = $[4];
70
+ }
71
+ const defaultValue = t1 === undefined ? 0 : t1;
72
+ const [own, setOwn] = useState(defaultValue);
73
+ const controlled = value !== undefined;
74
+ const current = controlled ? value : own;
75
+ const latest = useRef(onValueChange);
76
+ let t2;
77
+ if ($[5] !== onValueChange) {
78
+ t2 = () => {
79
+ latest.current = onValueChange;
80
+ };
81
+ $[5] = onValueChange;
82
+ $[6] = t2;
83
+ } else {
84
+ t2 = $[6];
85
+ }
86
+ useLayoutEffect(t2);
87
+ let t3;
88
+ if ($[7] !== controlled) {
89
+ t3 = next => {
90
+ if (!controlled) {
91
+ setOwn(next);
92
+ }
93
+ latest.current?.(next);
94
+ };
95
+ $[7] = controlled;
96
+ $[8] = t3;
97
+ } else {
98
+ t3 = $[8];
99
+ }
100
+ const select = t3;
101
+ let t4;
102
+ if ($[9] !== current || $[10] !== select) {
103
+ t4 = {
104
+ value: current,
105
+ select
106
+ };
107
+ $[9] = current;
108
+ $[10] = select;
109
+ $[11] = t4;
110
+ } else {
111
+ t4 = $[11];
112
+ }
113
+ const selection = t4;
114
+ let t5;
115
+ if ($[12] !== selection) {
116
+ t5 = next_0 => selection.select(next_0);
117
+ $[12] = selection;
118
+ $[13] = t5;
119
+ } else {
120
+ t5 = $[13];
121
+ }
122
+ let t6;
123
+ if ($[14] !== current || $[15] !== props || $[16] !== t5) {
124
+ t6 = /*#__PURE__*/_jsx(BaseTabs.Root, {
125
+ value: current,
126
+ onValueChange: t5,
127
+ ...props
39
128
  });
40
- const selection = useMemo(() => {
41
- const select = (next) => {
42
- if (!controlled) {
43
- setOwn(next);
44
- }
45
- latest.current?.(next);
46
- };
47
- return { value: current, select };
48
- }, [controlled, current]);
49
- return (_jsx(SelectionContext, { value: selection, children: _jsx(BaseTabs.Root, { value: current, onValueChange: (next) => selection.select(next), ...props }) }));
129
+ $[14] = current;
130
+ $[15] = props;
131
+ $[16] = t5;
132
+ $[17] = t6;
133
+ } else {
134
+ t6 = $[17];
135
+ }
136
+ let t7;
137
+ if ($[18] !== selection || $[19] !== t6) {
138
+ t7 = /*#__PURE__*/_jsx(SelectionContext, {
139
+ value: selection,
140
+ children: t6
141
+ });
142
+ $[18] = selection;
143
+ $[19] = t6;
144
+ $[20] = t7;
145
+ } else {
146
+ t7 = $[20];
147
+ }
148
+ return t7;
50
149
  }
51
150
  const sameIndices = (left, right) => left !== null && left.length === right.length && left.every((index, at) => index === right[at]);
52
151
  /*
@@ -54,158 +153,673 @@ const sameIndices = (left, right) => left !== null && left.length === right.leng
54
153
  * in a row nobody sees, so the strip knows what fits before it draws. The tabs are the direct children,
55
154
  * since the menu repeats what a tab holds.
56
155
  */
57
- export function TabsList({ className, children, start, end, after, variant = 'line', overflow = 'menu', ...props }) {
58
- const style = STYLES[variant];
59
- const { t } = useTranslation('ui');
60
- const { value, select } = useContext(SelectionContext);
61
- const strip = useRef(null);
62
- const measure = useRef(null);
63
- const head = useRef(null);
64
- const tail = useRef(null);
65
- const beside = useRef(null);
66
- const list = useRef(null);
67
- const scrolls = overflow === 'scroll';
68
- // Which edges of a scrolling row still hide a tab, where it fades out.
69
- const [edges, setEdges] = useState({ start: false, end: false });
70
- // Null until the first measure, which runs before the first paint.
71
- const [shown, setShown] = useState(null);
72
- const tabs = Children.toArray(children).filter((child) => isValidElement(child) && child.type === TabsTab);
73
- const kept = tabs.flatMap((tab, index) => (tab.props.value === value || tab.props.pinned === true ? [index] : []));
74
- useLayoutEffect(() => {
75
- const host = strip.current;
76
- const row = measure.current;
77
- if (scrolls || !host || !row) {
78
- return;
156
+ export function TabsList(t0) {
157
+ const $ = _c(48);
158
+ let after;
159
+ let children;
160
+ let className;
161
+ let end;
162
+ let props;
163
+ let start;
164
+ let t1;
165
+ let t2;
166
+ if ($[0] !== t0) {
167
+ ({
168
+ className,
169
+ children,
170
+ start,
171
+ end,
172
+ after,
173
+ variant: t1,
174
+ overflow: t2,
175
+ ...props
176
+ } = t0);
177
+ $[0] = t0;
178
+ $[1] = after;
179
+ $[2] = children;
180
+ $[3] = className;
181
+ $[4] = end;
182
+ $[5] = props;
183
+ $[6] = start;
184
+ $[7] = t1;
185
+ $[8] = t2;
186
+ } else {
187
+ after = $[1];
188
+ children = $[2];
189
+ className = $[3];
190
+ end = $[4];
191
+ props = $[5];
192
+ start = $[6];
193
+ t1 = $[7];
194
+ t2 = $[8];
195
+ }
196
+ const variant = t1 === undefined ? "line" : t1;
197
+ const overflow = t2 === undefined ? "menu" : t2;
198
+ const style = STYLES[variant];
199
+ const {
200
+ t
201
+ } = useTranslation("ui");
202
+ const {
203
+ value,
204
+ select
205
+ } = useContext(SelectionContext);
206
+ const strip = useRef(null);
207
+ const measure = useRef(null);
208
+ const head = useRef(null);
209
+ const tail = useRef(null);
210
+ const beside = useRef(null);
211
+ const list = useRef(null);
212
+ const scrolls = overflow === "scroll";
213
+ let t3;
214
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
215
+ t3 = {
216
+ start: false,
217
+ end: false
218
+ };
219
+ $[9] = t3;
220
+ } else {
221
+ t3 = $[9];
222
+ }
223
+ const [edges, setEdges] = useState(t3);
224
+ const [shown, setShown] = useState(null);
225
+ const tabs = Children.toArray(children).filter(_temp);
226
+ let t4;
227
+ if ($[10] !== value) {
228
+ t4 = (tab, index) => tab.props.value === value || tab.props.pinned === true ? [index] : [];
229
+ $[10] = value;
230
+ $[11] = t4;
231
+ } else {
232
+ t4 = $[11];
233
+ }
234
+ const kept = tabs.flatMap(t4);
235
+ useLayoutEffect(() => {
236
+ const host = strip.current;
237
+ const row = measure.current;
238
+ if (scrolls || !host || !row) {
239
+ return;
240
+ }
241
+ const fit = () => {
242
+ const style_0 = getComputedStyle(host);
243
+ const gap = parseFloat(style_0.columnGap) || 0;
244
+ const taken = [head.current, beside.current, tail.current].reduce((sum, part) => part === null ? sum : sum + part.getBoundingClientRect().width + gap, 0);
245
+ const room = host.clientWidth - parseFloat(style_0.paddingLeft) - parseFloat(style_0.paddingRight) - taken;
246
+ const cells = [...row.children].map(_temp2);
247
+ const more = cells.pop() ?? 0;
248
+ const next = shownTabs(cells, room, parseFloat(getComputedStyle(row).columnGap) || 0, more, kept);
249
+ setShown(current => sameIndices(current, next) ? current : next);
250
+ };
251
+ fit();
252
+ const observer = new ResizeObserver(fit);
253
+ observer.observe(host);
254
+ observer.observe(row);
255
+ for (const part_0 of [head.current, beside.current, tail.current]) {
256
+ if (part_0 !== null) {
257
+ observer.observe(part_0);
258
+ }
259
+ }
260
+ return () => observer.disconnect();
261
+ });
262
+ let t5;
263
+ if ($[12] !== scrolls) {
264
+ t5 = () => {
265
+ const row_0 = list.current;
266
+ const tab_0 = row_0?.querySelector("[aria-selected=\"true\"]");
267
+ if (!scrolls || !row_0 || !tab_0) {
268
+ return;
269
+ }
270
+ const strip_0 = row_0.getBoundingClientRect();
271
+ const picked = tab_0.getBoundingClientRect();
272
+ if (picked.left < strip_0.left) {
273
+ row_0.scrollLeft = row_0.scrollLeft - (strip_0.left - picked.left);
274
+ } else {
275
+ if (picked.right > strip_0.right) {
276
+ row_0.scrollLeft = row_0.scrollLeft + (picked.right - strip_0.right);
79
277
  }
80
- const fit = () => {
81
- const style = getComputedStyle(host);
82
- const gap = parseFloat(style.columnGap) || 0;
83
- const taken = [head.current, beside.current, tail.current].reduce((sum, part) => (part === null ? sum : sum + part.getBoundingClientRect().width + gap), 0);
84
- const room = host.clientWidth - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight) - taken;
85
- const cells = [...row.children].map((cell) => cell.getBoundingClientRect().width);
86
- const more = cells.pop() ?? 0;
87
- const next = shownTabs(cells, room, parseFloat(getComputedStyle(row).columnGap) || 0, more, kept);
88
- setShown((current) => (sameIndices(current, next) ? current : next));
89
- };
90
- fit();
91
- const observer = new ResizeObserver(fit);
92
- observer.observe(host);
93
- observer.observe(row);
94
- for (const part of [head.current, beside.current, tail.current]) {
95
- if (part !== null) {
96
- observer.observe(part);
97
- }
278
+ }
279
+ };
280
+ $[12] = scrolls;
281
+ $[13] = t5;
282
+ } else {
283
+ t5 = $[13];
284
+ }
285
+ let t6;
286
+ if ($[14] !== scrolls || $[15] !== value) {
287
+ t6 = [scrolls, value];
288
+ $[14] = scrolls;
289
+ $[15] = value;
290
+ $[16] = t6;
291
+ } else {
292
+ t6 = $[16];
293
+ }
294
+ useEffect(t5, t6);
295
+ let t7;
296
+ if ($[17] !== scrolls) {
297
+ t7 = () => {
298
+ const row_1 = list.current;
299
+ if (!scrolls || !row_1) {
300
+ return;
301
+ }
302
+ const measure_0 = () => {
303
+ const start_0 = row_1.scrollLeft > 0;
304
+ const end_0 = row_1.scrollLeft + row_1.clientWidth < row_1.scrollWidth - 1;
305
+ setEdges(current_0 => current_0.start === start_0 && current_0.end === end_0 ? current_0 : {
306
+ start: start_0,
307
+ end: end_0
308
+ });
309
+ };
310
+ measure_0();
311
+ row_1.addEventListener("scroll", measure_0, {
312
+ passive: true
313
+ });
314
+ const observer_0 = new ResizeObserver(measure_0);
315
+ observer_0.observe(row_1);
316
+ for (const tab_1 of row_1.children) {
317
+ observer_0.observe(tab_1);
318
+ }
319
+ return () => {
320
+ row_1.removeEventListener("scroll", measure_0);
321
+ observer_0.disconnect();
322
+ };
323
+ };
324
+ $[17] = scrolls;
325
+ $[18] = t7;
326
+ } else {
327
+ t7 = $[18];
328
+ }
329
+ useEffect(t7);
330
+ let t8;
331
+ let t9;
332
+ if ($[19] !== scrolls) {
333
+ t8 = () => {
334
+ const row_2 = list.current;
335
+ if (!scrolls || !row_2) {
336
+ return;
337
+ }
338
+ const onWheel = event => {
339
+ if (!event.deltaX && event.deltaY) {
340
+ row_2.scrollLeft = row_2.scrollLeft + event.deltaY;
98
341
  }
99
- return () => observer.disconnect();
342
+ };
343
+ row_2.addEventListener("wheel", onWheel, {
344
+ passive: true
345
+ });
346
+ return () => row_2.removeEventListener("wheel", onWheel);
347
+ };
348
+ t9 = [scrolls];
349
+ $[19] = scrolls;
350
+ $[20] = t8;
351
+ $[21] = t9;
352
+ } else {
353
+ t8 = $[20];
354
+ t9 = $[21];
355
+ }
356
+ useEffect(t8, t9);
357
+ const visible = shown === null ? tabs : shown.map(index_0 => tabs[index_0]);
358
+ const hidden = shown === null ? [] : tabs.filter((_, index_1) => !shown.includes(index_1));
359
+ let t10;
360
+ if ($[22] !== t) {
361
+ t10 = t("tabs.more");
362
+ $[22] = t;
363
+ $[23] = t10;
364
+ } else {
365
+ t10 = $[23];
366
+ }
367
+ let t11;
368
+ if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
369
+ t11 = /*#__PURE__*/_jsx(Icon, {
370
+ icon: ChevronDown,
371
+ size: 14
100
372
  });
101
- // A picked tab that scrolled out of sight comes back into it, wherever it was picked from. Only the strip
102
- // moves: `scrollIntoView` would scroll every ancestor too, such as a thread that holds a block of tabs.
103
- useEffect(() => {
104
- const row = list.current;
105
- const tab = row?.querySelector('[aria-selected="true"]');
106
- if (!scrolls || !row || !tab) {
107
- return;
108
- }
109
- const strip = row.getBoundingClientRect();
110
- const picked = tab.getBoundingClientRect();
111
- if (picked.left < strip.left) {
112
- row.scrollLeft -= strip.left - picked.left;
113
- }
114
- else if (picked.right > strip.right) {
115
- row.scrollLeft += picked.right - strip.right;
116
- }
117
- }, [scrolls, value]);
118
- useEffect(() => {
119
- const row = list.current;
120
- if (!scrolls || !row) {
121
- return;
122
- }
123
- const measure = () => {
124
- const start = row.scrollLeft > 0;
125
- const end = row.scrollLeft + row.clientWidth < row.scrollWidth - 1;
126
- setEdges((current) => (current.start === start && current.end === end ? current : { start, end }));
127
- };
128
- measure();
129
- row.addEventListener('scroll', measure, { passive: true });
130
- const observer = new ResizeObserver(measure);
131
- observer.observe(row);
132
- for (const tab of row.children) {
133
- observer.observe(tab);
134
- }
135
- return () => {
136
- row.removeEventListener('scroll', measure);
137
- observer.disconnect();
138
- };
373
+ $[24] = t11;
374
+ } else {
375
+ t11 = $[24];
376
+ }
377
+ let t12;
378
+ if ($[25] !== t10) {
379
+ t12 = /*#__PURE__*/_jsxs(_Fragment, {
380
+ children: [t10, t11]
139
381
  });
140
- // A mouse wheel only turns vertically, and on a row that scrolls sideways that is the way it should turn.
141
- useEffect(() => {
142
- const row = list.current;
143
- if (!scrolls || !row) {
144
- return;
145
- }
146
- const onWheel = (event) => {
147
- if (!event.deltaX && event.deltaY) {
148
- row.scrollLeft += event.deltaY;
149
- }
150
- };
151
- row.addEventListener('wheel', onWheel, { passive: true });
152
- return () => row.removeEventListener('wheel', onWheel);
153
- }, [scrolls]);
154
- const visible = shown === null ? tabs : shown.map((index) => tabs[index]);
155
- const hidden = shown === null ? [] : tabs.filter((_, index) => !shown.includes(index));
156
- const more = (_jsxs(_Fragment, { children: [t('tabs.more'), _jsx(Icon, { icon: ChevronDown, size: 14 })] }));
157
- return (_jsx(VariantContext, { value: variant, children: _jsxs("div", { ref: strip, className: clsx('relative flex items-center', style.strip, className), children: [start !== undefined && start !== null && (_jsx("div", { ref: head, className: "flex shrink-0 items-center gap-1", children: start })), _jsx(BaseTabs.List, { ref: list, className: clsx('flex min-w-0', style.list, scrolls && 'tabs-scroll scroll-fade-x'), "data-fade-start": scrolls && edges.start ? '' : undefined, "data-fade-end": scrolls && edges.end ? '' : undefined, ...props, children: visible }), hidden.length > 0 && (_jsxs(MenuRoot, { children: [_jsx(MenuTrigger, { className: style.more, children: more }), _jsx(MenuPopup, { align: "end", className: "min-w-48", children: _jsx(InMenuContext, { value: true, children: hidden.map((tab) => (_jsx(MenuItem, { disabled: tab.props.disabled, onClick: () => select(tab.props.value), children: tab.props.children }, tab.key))) }) })] })), after !== undefined && after !== null && (_jsx("div", { ref: beside, className: "flex shrink-0 items-center gap-1", children: after })), end !== undefined && end !== null && (_jsx("div", { ref: tail, className: clsx('flex shrink-0 items-center gap-1', hidden.length === 0 && 'ml-auto'), children: end })), !scrolls && (_jsxs("div", { ref: measure, "aria-hidden": true, inert: true, className: clsx('pointer-events-none invisible absolute top-0 left-0 flex', style.row), children: [tabs.map((tab) => (_jsxs("span", { className: style.tab, children: [tab.props.children, tab.props.onClose !== undefined && tab.props.pinned !== true && _jsx("span", { className: "size-5 shrink-0" })] }, tab.key))), _jsx("span", { className: style.more, children: more })] }))] }) }));
382
+ $[25] = t10;
383
+ $[26] = t12;
384
+ } else {
385
+ t12 = $[26];
386
+ }
387
+ const more_0 = t12;
388
+ let t13;
389
+ if ($[27] !== className || $[28] !== style.strip) {
390
+ t13 = clsx("relative flex items-center", style.strip, className);
391
+ $[27] = className;
392
+ $[28] = style.strip;
393
+ $[29] = t13;
394
+ } else {
395
+ t13 = $[29];
396
+ }
397
+ const t14 = scrolls && "tabs-scroll scroll-fade-x";
398
+ let t15;
399
+ if ($[30] !== style.list || $[31] !== t14) {
400
+ t15 = clsx("flex min-w-0", style.list, t14);
401
+ $[30] = style.list;
402
+ $[31] = t14;
403
+ $[32] = t15;
404
+ } else {
405
+ t15 = $[32];
406
+ }
407
+ let t16;
408
+ if ($[33] !== after || $[34] !== beside) {
409
+ t16 = after !== undefined && after !== null && /*#__PURE__*/_jsx("div", {
410
+ ref: beside,
411
+ className: "flex shrink-0 items-center gap-1",
412
+ children: after
413
+ });
414
+ $[33] = after;
415
+ $[34] = beside;
416
+ $[35] = t16;
417
+ } else {
418
+ t16 = $[35];
419
+ }
420
+ let t17;
421
+ if ($[36] !== end || $[37] !== hidden || $[38] !== tail) {
422
+ t17 = end !== undefined && end !== null && /*#__PURE__*/_jsx("div", {
423
+ ref: tail,
424
+ className: clsx("flex shrink-0 items-center gap-1", hidden.length === 0 && "ml-auto"),
425
+ children: end
426
+ });
427
+ $[36] = end;
428
+ $[37] = hidden;
429
+ $[38] = tail;
430
+ $[39] = t17;
431
+ } else {
432
+ t17 = $[39];
433
+ }
434
+ let t18;
435
+ if ($[40] !== measure || $[41] !== more_0 || $[42] !== scrolls || $[43] !== style.more || $[44] !== style.row || $[45] !== style.tab || $[46] !== tabs) {
436
+ t18 = !scrolls && /*#__PURE__*/_jsxs("div", {
437
+ ref: measure,
438
+ "aria-hidden": true,
439
+ inert: true,
440
+ className: clsx("pointer-events-none invisible absolute top-0 left-0 flex", style.row),
441
+ children: [tabs.map(tab_3 => /*#__PURE__*/_jsxs("span", {
442
+ className: style.tab,
443
+ children: [tab_3.props.children, tab_3.props.onClose !== undefined && tab_3.props.pinned !== true && /*#__PURE__*/_jsx("span", {
444
+ className: "size-5 shrink-0"
445
+ })]
446
+ }, tab_3.key)), /*#__PURE__*/_jsx("span", {
447
+ className: style.more,
448
+ children: more_0
449
+ })]
450
+ });
451
+ $[40] = measure;
452
+ $[41] = more_0;
453
+ $[42] = scrolls;
454
+ $[43] = style.more;
455
+ $[44] = style.row;
456
+ $[45] = style.tab;
457
+ $[46] = tabs;
458
+ $[47] = t18;
459
+ } else {
460
+ t18 = $[47];
461
+ }
462
+ return /*#__PURE__*/_jsx(VariantContext, {
463
+ value: variant,
464
+ children: /*#__PURE__*/_jsxs("div", {
465
+ ref: strip,
466
+ className: t13,
467
+ children: [start !== undefined && start !== null && /*#__PURE__*/_jsx("div", {
468
+ ref: head,
469
+ className: "flex shrink-0 items-center gap-1",
470
+ children: start
471
+ }), /*#__PURE__*/_jsx(BaseTabs.List, {
472
+ ref: list,
473
+ className: t15,
474
+ "data-fade-start": scrolls && edges.start ? "" : undefined,
475
+ "data-fade-end": scrolls && edges.end ? "" : undefined,
476
+ ...props,
477
+ children: visible
478
+ }), hidden.length > 0 && /*#__PURE__*/_jsxs(MenuRoot, {
479
+ children: [/*#__PURE__*/_jsx(MenuTrigger, {
480
+ className: style.more,
481
+ children: more_0
482
+ }), /*#__PURE__*/_jsx(MenuPopup, {
483
+ align: "end",
484
+ className: "min-w-48",
485
+ children: /*#__PURE__*/_jsx(InMenuContext, {
486
+ value: true,
487
+ children: hidden.map(tab_2 => /*#__PURE__*/_jsx(MenuItem, {
488
+ disabled: tab_2.props.disabled,
489
+ onClick: () => select(tab_2.props.value),
490
+ children: tab_2.props.children
491
+ }, tab_2.key))
492
+ })
493
+ })]
494
+ }), t16, t17, t18]
495
+ })
496
+ });
158
497
  }
159
498
  /* The close button stays out of the tab order, so a closable tab is still one stop; the keys close it from the tab itself. */
160
- export function TabsTab({ className, onClose, pinned = false, children, ...props }) {
161
- const { t } = useTranslation('ui');
162
- const tab = STYLES[useContext(VariantContext)].tab;
163
- if (pinned) {
164
- return (_jsx(BaseTabs.Tab, { className: withClass(tab, className), "data-pinned": "", ...props, children: children }));
499
+ function _temp2(cell) {
500
+ return cell.getBoundingClientRect().width;
501
+ }
502
+ function _temp(child) {
503
+ return isValidElement(child) && child.type === TabsTab;
504
+ }
505
+ export function TabsTab(t0) {
506
+ const $ = _c(52);
507
+ let children;
508
+ let className;
509
+ let onClose;
510
+ let props;
511
+ let t1;
512
+ if ($[0] !== t0) {
513
+ ({
514
+ className,
515
+ onClose,
516
+ pinned: t1,
517
+ children,
518
+ ...props
519
+ } = t0);
520
+ $[0] = t0;
521
+ $[1] = children;
522
+ $[2] = className;
523
+ $[3] = onClose;
524
+ $[4] = props;
525
+ $[5] = t1;
526
+ } else {
527
+ children = $[1];
528
+ className = $[2];
529
+ onClose = $[3];
530
+ props = $[4];
531
+ t1 = $[5];
532
+ }
533
+ const pinned = t1 === undefined ? false : t1;
534
+ const {
535
+ t
536
+ } = useTranslation("ui");
537
+ const tab = STYLES[useContext(VariantContext)].tab;
538
+ if (pinned) {
539
+ let t2;
540
+ if ($[6] !== className || $[7] !== tab) {
541
+ t2 = withClass(tab, className);
542
+ $[6] = className;
543
+ $[7] = tab;
544
+ $[8] = t2;
545
+ } else {
546
+ t2 = $[8];
165
547
  }
166
- if (onClose === undefined) {
167
- return (_jsx(BaseTabs.Tab, { className: withClass(tab, className), ...props, children: children }));
548
+ let t3;
549
+ if ($[9] !== children || $[10] !== props || $[11] !== t2) {
550
+ t3 = /*#__PURE__*/_jsx(BaseTabs.Tab, {
551
+ className: t2,
552
+ "data-pinned": "",
553
+ ...props,
554
+ children: children
555
+ });
556
+ $[9] = children;
557
+ $[10] = props;
558
+ $[11] = t2;
559
+ $[12] = t3;
560
+ } else {
561
+ t3 = $[12];
168
562
  }
169
- const { onKeyDown, onAuxClick, onMouseDown, ...rest } = props;
170
- const handleKeyDown = (e) => {
171
- onKeyDown?.(e);
172
- if (!e.defaultPrevented && e.target === e.currentTarget && (e.key === 'Delete' || e.key === 'Backspace')) {
173
- e.preventDefault();
174
- onClose();
175
- }
563
+ return t3;
564
+ }
565
+ if (onClose === undefined) {
566
+ let t2;
567
+ if ($[13] !== className || $[14] !== tab) {
568
+ t2 = withClass(tab, className);
569
+ $[13] = className;
570
+ $[14] = tab;
571
+ $[15] = t2;
572
+ } else {
573
+ t2 = $[15];
574
+ }
575
+ let t3;
576
+ if ($[16] !== children || $[17] !== props || $[18] !== t2) {
577
+ t3 = /*#__PURE__*/_jsx(BaseTabs.Tab, {
578
+ className: t2,
579
+ ...props,
580
+ children: children
581
+ });
582
+ $[16] = children;
583
+ $[17] = props;
584
+ $[18] = t2;
585
+ $[19] = t3;
586
+ } else {
587
+ t3 = $[19];
588
+ }
589
+ return t3;
590
+ }
591
+ let onAuxClick;
592
+ let onKeyDown;
593
+ let onMouseDown;
594
+ let rest;
595
+ if ($[20] !== props) {
596
+ ({
597
+ onKeyDown,
598
+ onAuxClick,
599
+ onMouseDown,
600
+ ...rest
601
+ } = props);
602
+ $[20] = props;
603
+ $[21] = onAuxClick;
604
+ $[22] = onKeyDown;
605
+ $[23] = onMouseDown;
606
+ $[24] = rest;
607
+ } else {
608
+ onAuxClick = $[21];
609
+ onKeyDown = $[22];
610
+ onMouseDown = $[23];
611
+ rest = $[24];
612
+ }
613
+ let t2;
614
+ if ($[25] !== onClose || $[26] !== onKeyDown) {
615
+ t2 = e => {
616
+ onKeyDown?.(e);
617
+ if (!e.defaultPrevented && e.target === e.currentTarget && (e.key === "Delete" || e.key === "Backspace")) {
618
+ e.preventDefault();
619
+ onClose();
620
+ }
176
621
  };
177
- // A middle press starts autoscroll on some platforms; the release is what closes.
178
- const handleMouseDown = (e) => {
179
- onMouseDown?.(e);
180
- if (e.button === 1) {
181
- e.preventDefault();
182
- }
622
+ $[25] = onClose;
623
+ $[26] = onKeyDown;
624
+ $[27] = t2;
625
+ } else {
626
+ t2 = $[27];
627
+ }
628
+ const handleKeyDown = t2;
629
+ let t3;
630
+ if ($[28] !== onMouseDown) {
631
+ t3 = e_0 => {
632
+ onMouseDown?.(e_0);
633
+ if (e_0.button === 1) {
634
+ e_0.preventDefault();
635
+ }
183
636
  };
184
- const handleAuxClick = (e) => {
185
- onAuxClick?.(e);
186
- if (!e.defaultPrevented && e.button === 1) {
187
- e.preventDefault();
188
- onClose();
189
- }
637
+ $[28] = onMouseDown;
638
+ $[29] = t3;
639
+ } else {
640
+ t3 = $[29];
641
+ }
642
+ const handleMouseDown = t3;
643
+ let t4;
644
+ if ($[30] !== onAuxClick || $[31] !== onClose) {
645
+ t4 = e_1 => {
646
+ onAuxClick?.(e_1);
647
+ if (!e_1.defaultPrevented && e_1.button === 1) {
648
+ e_1.preventDefault();
649
+ onClose();
650
+ }
651
+ };
652
+ $[30] = onAuxClick;
653
+ $[31] = onClose;
654
+ $[32] = t4;
655
+ } else {
656
+ t4 = $[32];
657
+ }
658
+ const handleAuxClick = t4;
659
+ let t5;
660
+ if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
661
+ t5 = /*#__PURE__*/_jsx("div", {});
662
+ $[33] = t5;
663
+ } else {
664
+ t5 = $[33];
665
+ }
666
+ let t6;
667
+ if ($[34] !== className || $[35] !== tab) {
668
+ t6 = withClass(tab, className);
669
+ $[34] = className;
670
+ $[35] = tab;
671
+ $[36] = t6;
672
+ } else {
673
+ t6 = $[36];
674
+ }
675
+ let t7;
676
+ if ($[37] !== t) {
677
+ t7 = t("tabs.close");
678
+ $[37] = t;
679
+ $[38] = t7;
680
+ } else {
681
+ t7 = $[38];
682
+ }
683
+ let t8;
684
+ if ($[39] !== onClose) {
685
+ t8 = e_2 => {
686
+ e_2.stopPropagation();
687
+ onClose();
190
688
  };
191
- return (_jsxs(BaseTabs.Tab, { nativeButton: false, render: _jsx("div", {}), className: withClass(tab, className), onKeyDown: handleKeyDown, onMouseDown: handleMouseDown, onAuxClick: handleAuxClick, ...rest, children: [children, _jsx(IconButton, { icon: X, size: "2xs", label: t('tabs.close'), tabIndex: -1, onClick: (e) => {
192
- e.stopPropagation();
193
- onClose();
194
- } })] }));
689
+ $[39] = onClose;
690
+ $[40] = t8;
691
+ } else {
692
+ t8 = $[40];
693
+ }
694
+ let t9;
695
+ if ($[41] !== t7 || $[42] !== t8) {
696
+ t9 = /*#__PURE__*/_jsx(IconButton, {
697
+ icon: X,
698
+ size: "2xs",
699
+ label: t7,
700
+ tabIndex: -1,
701
+ onClick: t8
702
+ });
703
+ $[41] = t7;
704
+ $[42] = t8;
705
+ $[43] = t9;
706
+ } else {
707
+ t9 = $[43];
708
+ }
709
+ let t10;
710
+ if ($[44] !== children || $[45] !== handleAuxClick || $[46] !== handleKeyDown || $[47] !== handleMouseDown || $[48] !== rest || $[49] !== t6 || $[50] !== t9) {
711
+ t10 = /*#__PURE__*/_jsxs(BaseTabs.Tab, {
712
+ nativeButton: false,
713
+ render: t5,
714
+ className: t6,
715
+ onKeyDown: handleKeyDown,
716
+ onMouseDown: handleMouseDown,
717
+ onAuxClick: handleAuxClick,
718
+ ...rest,
719
+ children: [children, t9]
720
+ });
721
+ $[44] = children;
722
+ $[45] = handleAuxClick;
723
+ $[46] = handleKeyDown;
724
+ $[47] = handleMouseDown;
725
+ $[48] = rest;
726
+ $[49] = t6;
727
+ $[50] = t9;
728
+ $[51] = t10;
729
+ } else {
730
+ t10 = $[51];
731
+ }
732
+ return t10;
195
733
  }
196
734
  export const TabsPanel = BaseTabs.Panel;
197
735
  /* How much a tab holds, after its label. Nothing at zero: an empty view needs no number to say so. */
198
- export function TabsCount({ value, render, className, ref, ...props }) {
199
- const inMenu = useContext(InMenuContext);
200
- const element = useRender({
201
- render,
202
- ref,
203
- defaultTagName: 'span',
204
- props: {
205
- ...props,
206
- children: _jsx(Pill, { className: "tabular-nums", children: formatNumber(value) }),
207
- className: clsx('inline-flex shrink-0', inMenu && 'ml-auto', className)
208
- }
736
+ export function TabsCount(t0) {
737
+ const $ = _c(21);
738
+ let className;
739
+ let props;
740
+ let ref;
741
+ let render;
742
+ let value;
743
+ if ($[0] !== t0) {
744
+ ({
745
+ value,
746
+ render,
747
+ className,
748
+ ref,
749
+ ...props
750
+ } = t0);
751
+ $[0] = t0;
752
+ $[1] = className;
753
+ $[2] = props;
754
+ $[3] = ref;
755
+ $[4] = render;
756
+ $[5] = value;
757
+ } else {
758
+ className = $[1];
759
+ props = $[2];
760
+ ref = $[3];
761
+ render = $[4];
762
+ value = $[5];
763
+ }
764
+ const inMenu = useContext(InMenuContext);
765
+ let t1;
766
+ if ($[6] !== value) {
767
+ t1 = formatNumber(value);
768
+ $[6] = value;
769
+ $[7] = t1;
770
+ } else {
771
+ t1 = $[7];
772
+ }
773
+ let t2;
774
+ if ($[8] !== t1) {
775
+ t2 = /*#__PURE__*/_jsx(Pill, {
776
+ className: "tabular-nums",
777
+ children: t1
209
778
  });
210
- return value === 0 ? null : element;
211
- }
779
+ $[8] = t1;
780
+ $[9] = t2;
781
+ } else {
782
+ t2 = $[9];
783
+ }
784
+ const t3 = inMenu && "ml-auto";
785
+ let t4;
786
+ if ($[10] !== className || $[11] !== t3) {
787
+ t4 = clsx("inline-flex shrink-0", t3, className);
788
+ $[10] = className;
789
+ $[11] = t3;
790
+ $[12] = t4;
791
+ } else {
792
+ t4 = $[12];
793
+ }
794
+ let t5;
795
+ if ($[13] !== props || $[14] !== t2 || $[15] !== t4) {
796
+ t5 = {
797
+ ...props,
798
+ children: t2,
799
+ className: t4
800
+ };
801
+ $[13] = props;
802
+ $[14] = t2;
803
+ $[15] = t4;
804
+ $[16] = t5;
805
+ } else {
806
+ t5 = $[16];
807
+ }
808
+ let t6;
809
+ if ($[17] !== ref || $[18] !== render || $[19] !== t5) {
810
+ t6 = {
811
+ render,
812
+ ref,
813
+ defaultTagName: "span",
814
+ props: t5
815
+ };
816
+ $[17] = ref;
817
+ $[18] = render;
818
+ $[19] = t5;
819
+ $[20] = t6;
820
+ } else {
821
+ t6 = $[20];
822
+ }
823
+ const element = useRender(t6);
824
+ return value === 0 ? null : element;
825
+ }