@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,97 +1,837 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { useEffect, useMemo, useRef, useState } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { Tabs } from '@base-ui/react/tabs';
6
6
  import { Search, X } from 'lucide-react';
7
- import { CloseButton } from '../CloseButton.js';
8
- import { DialogDescription, DialogPopup, DialogRoot, DialogTitle } from '../dialog/parts.js';
9
- import { ErrorBoundary } from '../ErrorBoundary.js';
10
- import { Icon } from '../Icon.js';
11
- import { IconButton } from '../IconButton.js';
12
- import { LazyBoundary } from '../LazyBoundary.js';
13
- import { Input } from '../Input.js';
14
- import { Select } from '../Select.js';
7
+ import { CloseButton } from "../CloseButton.js";
8
+ import { DialogDescription, DialogPopup, DialogRoot, DialogTitle } from "../dialog/parts.js";
9
+ import { ErrorBoundary } from "../ErrorBoundary.js";
10
+ import { Icon } from "../Icon.js";
11
+ import { IconButton } from "../IconButton.js";
12
+ import { LazyBoundary } from "../LazyBoundary.js";
13
+ import { Input } from "../Input.js";
14
+ import { Select } from "../Select.js";
15
15
  import { SettingsTargetContext } from './target.js';
16
16
  /* How far a pane with a hero scrolls before the title bar over it is filled in. */
17
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
18
  const BAR_FILL_DISTANCE = 70;
18
19
  const NAV_ITEM = 'flex h-8 min-w-0 shrink-0 items-center gap-2.5 rounded-md px-2.5 text-sm focus-visible:-outline-offset-2 text-text-muted hover:bg-surface-hover hover:text-text data-active:bg-surface-active data-active:text-text';
19
- function NavTab({ section }) {
20
- return (_jsxs(Tabs.Tab, { value: section.id, className: NAV_ITEM, children: [_jsx(Icon, { icon: section.icon, size: 16, className: "shrink-0 text-text-faint" }), _jsx("span", { className: "truncate", children: section.label })] }));
20
+ function NavTab(t0) {
21
+ const $ = _c(8);
22
+ const {
23
+ section
24
+ } = t0;
25
+ let t1;
26
+ if ($[0] !== section.icon) {
27
+ t1 = /*#__PURE__*/_jsx(Icon, {
28
+ icon: section.icon,
29
+ size: 16,
30
+ className: "shrink-0 text-text-faint"
31
+ });
32
+ $[0] = section.icon;
33
+ $[1] = t1;
34
+ } else {
35
+ t1 = $[1];
36
+ }
37
+ let t2;
38
+ if ($[2] !== section.label) {
39
+ t2 = /*#__PURE__*/_jsx("span", {
40
+ className: "truncate",
41
+ children: section.label
42
+ });
43
+ $[2] = section.label;
44
+ $[3] = t2;
45
+ } else {
46
+ t2 = $[3];
47
+ }
48
+ let t3;
49
+ if ($[4] !== section.id || $[5] !== t1 || $[6] !== t2) {
50
+ t3 = /*#__PURE__*/_jsxs(Tabs.Tab, {
51
+ value: section.id,
52
+ className: NAV_ITEM,
53
+ children: [t1, t2]
54
+ });
55
+ $[4] = section.id;
56
+ $[5] = t1;
57
+ $[6] = t2;
58
+ $[7] = t3;
59
+ } else {
60
+ t3 = $[7];
61
+ }
62
+ return t3;
63
+ }
64
+ function SettingsNav(t0) {
65
+ const $ = _c(13);
66
+ const {
67
+ groups,
68
+ footer,
69
+ account
70
+ } = t0;
71
+ const {
72
+ t
73
+ } = useTranslation("ui");
74
+ let t1;
75
+ if ($[0] !== t) {
76
+ t1 = t("settings.sections");
77
+ $[0] = t;
78
+ $[1] = t1;
79
+ } else {
80
+ t1 = $[1];
81
+ }
82
+ let t2;
83
+ if ($[2] !== groups) {
84
+ t2 = groups.map(_temp2);
85
+ $[2] = groups;
86
+ $[3] = t2;
87
+ } else {
88
+ t2 = $[3];
89
+ }
90
+ let t3;
91
+ if ($[4] !== t2) {
92
+ t3 = /*#__PURE__*/_jsx("div", {
93
+ className: "flex min-h-0 flex-col gap-3.5 overflow-y-auto",
94
+ children: t2
95
+ });
96
+ $[4] = t2;
97
+ $[5] = t3;
98
+ } else {
99
+ t3 = $[5];
100
+ }
101
+ let t4;
102
+ if ($[6] !== account || $[7] !== footer) {
103
+ t4 = (footer?.length || account) && /*#__PURE__*/_jsxs("div", {
104
+ className: "mt-auto flex flex-col gap-3 pt-3.5",
105
+ children: [footer?.map(_temp3), account && /*#__PURE__*/_jsx("div", {
106
+ className: "-mx-3 -mb-1 border-t border-border px-3 pt-3",
107
+ children: account.tab
108
+ })]
109
+ });
110
+ $[6] = account;
111
+ $[7] = footer;
112
+ $[8] = t4;
113
+ } else {
114
+ t4 = $[8];
115
+ }
116
+ let t5;
117
+ if ($[9] !== t1 || $[10] !== t3 || $[11] !== t4) {
118
+ t5 = /*#__PURE__*/_jsxs(Tabs.List, {
119
+ "aria-label": t1,
120
+ activateOnFocus: true,
121
+ className: "flex min-h-0 grow flex-col",
122
+ children: [t3, t4]
123
+ });
124
+ $[9] = t1;
125
+ $[10] = t3;
126
+ $[11] = t4;
127
+ $[12] = t5;
128
+ } else {
129
+ t5 = $[12];
130
+ }
131
+ return t5;
132
+ }
133
+ function _temp3(section_0) {
134
+ return /*#__PURE__*/_jsx(NavTab, {
135
+ section: section_0
136
+ }, section_0.id);
21
137
  }
22
- function SettingsNav({ groups, footer, account }) {
23
- const { t } = useTranslation('ui');
24
- return (_jsxs(Tabs.List, { "aria-label": t('settings.sections'), activateOnFocus: true, className: "flex min-h-0 grow flex-col", children: [_jsx("div", { className: "flex min-h-0 flex-col gap-3.5 overflow-y-auto", children: groups.map((group) => (_jsxs("div", { className: "flex flex-col gap-0.5", children: [group.label !== null && _jsx("span", { className: "px-2.5 pt-2.5 pb-1 text-xs font-medium text-text-faint", children: group.label }), group.sections.map((section) => (_jsx(NavTab, { section: section }, section.id)))] }, group.sections[0].id))) }), (footer?.length || account) && (_jsxs("div", { className: "mt-auto flex flex-col gap-3 pt-3.5", children: [footer?.map((section) => (_jsx(NavTab, { section: section }, section.id))), account && _jsx("div", { className: "-mx-3 -mb-1 border-t border-border px-3 pt-3", children: account.tab })] }))] }));
138
+ function _temp2(group) {
139
+ return /*#__PURE__*/_jsxs("div", {
140
+ className: "flex flex-col gap-0.5",
141
+ children: [group.label !== null && /*#__PURE__*/_jsx("span", {
142
+ className: "px-2.5 pt-2.5 pb-1 text-xs font-medium text-text-faint",
143
+ children: group.label
144
+ }), group.sections.map(_temp)]
145
+ }, group.sections[0].id);
25
146
  }
26
- function SearchField({ search, query, onQuery, onPick }) {
27
- const { t } = useTranslation('ui');
28
- const input = useRef(null);
29
- const focusAt = search.focusAt ?? 0;
30
- useEffect(() => {
31
- if (focusAt > 0) {
32
- input.current?.focus();
33
- input.current?.select();
147
+ function _temp(section) {
148
+ return /*#__PURE__*/_jsx(NavTab, {
149
+ section: section
150
+ }, section.id);
151
+ }
152
+ function SearchField(t0) {
153
+ const $ = _c(29);
154
+ const {
155
+ search,
156
+ query,
157
+ onQuery,
158
+ onPick
159
+ } = t0;
160
+ const {
161
+ t
162
+ } = useTranslation("ui");
163
+ const input = useRef(null);
164
+ const focusAt = search.focusAt ?? 0;
165
+ let t1;
166
+ let t2;
167
+ if ($[0] !== focusAt) {
168
+ t1 = () => {
169
+ if (focusAt > 0) {
170
+ input.current?.focus();
171
+ input.current?.select();
172
+ }
173
+ };
174
+ t2 = [focusAt];
175
+ $[0] = focusAt;
176
+ $[1] = t1;
177
+ $[2] = t2;
178
+ } else {
179
+ t1 = $[1];
180
+ t2 = $[2];
181
+ }
182
+ useEffect(t1, t2);
183
+ let t3;
184
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
185
+ t3 = /*#__PURE__*/_jsx(Icon, {
186
+ icon: Search,
187
+ size: 14,
188
+ className: "pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-text-faint"
189
+ });
190
+ $[3] = t3;
191
+ } else {
192
+ t3 = $[3];
193
+ }
194
+ let t4;
195
+ if ($[4] !== t) {
196
+ t4 = t("settings.search.placeholder");
197
+ $[4] = t;
198
+ $[5] = t4;
199
+ } else {
200
+ t4 = $[5];
201
+ }
202
+ let t5;
203
+ if ($[6] !== t) {
204
+ t5 = t("settings.search.placeholder");
205
+ $[6] = t;
206
+ $[7] = t5;
207
+ } else {
208
+ t5 = $[7];
209
+ }
210
+ let t6;
211
+ if ($[8] !== onQuery) {
212
+ t6 = event => onQuery(event.target.value);
213
+ $[8] = onQuery;
214
+ $[9] = t6;
215
+ } else {
216
+ t6 = $[9];
217
+ }
218
+ let t7;
219
+ if ($[10] !== onPick || $[11] !== onQuery || $[12] !== query || $[13] !== search) {
220
+ t7 = event_0 => {
221
+ if (event_0.key === "Escape" && query) {
222
+ event_0.stopPropagation();
223
+ onQuery("");
224
+ }
225
+ if (event_0.key === "Enter") {
226
+ const first = search.find(query)[0];
227
+ if (first) {
228
+ onPick(first);
34
229
  }
35
- }, [focusAt]);
36
- return (_jsxs("div", { className: "relative shrink-0", children: [_jsx(Icon, { icon: Search, size: 14, className: "pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-text-faint" }), _jsx(Input, { ref: input, className: "bg-surface-sunken pr-12 pl-8 text-xs", placeholder: t('settings.search.placeholder'), "aria-label": t('settings.search.placeholder'), value: query, spellCheck: false, autoComplete: "off", onChange: (event) => onQuery(event.target.value), onKeyDown: (event) => {
37
- // Escape clears the search first; the dialog only closes on an empty field.
38
- if (event.key === 'Escape' && query) {
39
- event.stopPropagation();
40
- onQuery('');
41
- }
42
- if (event.key === 'Enter') {
43
- const first = search.find(query)[0];
44
- if (first) {
45
- onPick(first);
46
- }
47
- }
48
- } }), query ? (_jsx(IconButton, { icon: X, size: "sm", label: t('settings.search.clear'), tooltip: false, className: "absolute top-1/2 right-1 -translate-y-1/2", onClick: () => onQuery('') })) : (search.hint && (_jsx("span", { className: "pointer-events-none absolute top-1/2 right-2.5 -translate-y-1/2 text-xs text-text-faint", "aria-hidden": true, children: search.hint })))] }));
230
+ }
231
+ };
232
+ $[10] = onPick;
233
+ $[11] = onQuery;
234
+ $[12] = query;
235
+ $[13] = search;
236
+ $[14] = t7;
237
+ } else {
238
+ t7 = $[14];
239
+ }
240
+ let t8;
241
+ if ($[15] !== query || $[16] !== t4 || $[17] !== t5 || $[18] !== t6 || $[19] !== t7) {
242
+ t8 = /*#__PURE__*/_jsx(Input, {
243
+ ref: input,
244
+ className: "bg-surface-sunken pr-12 pl-8 text-xs",
245
+ placeholder: t4,
246
+ "aria-label": t5,
247
+ value: query,
248
+ spellCheck: false,
249
+ autoComplete: "off",
250
+ onChange: t6,
251
+ onKeyDown: t7
252
+ });
253
+ $[15] = query;
254
+ $[16] = t4;
255
+ $[17] = t5;
256
+ $[18] = t6;
257
+ $[19] = t7;
258
+ $[20] = t8;
259
+ } else {
260
+ t8 = $[20];
261
+ }
262
+ let t9;
263
+ if ($[21] !== onQuery || $[22] !== query || $[23] !== search.hint || $[24] !== t) {
264
+ t9 = query ? /*#__PURE__*/_jsx(IconButton, {
265
+ icon: X,
266
+ size: "sm",
267
+ label: t("settings.search.clear"),
268
+ tooltip: false,
269
+ className: "absolute top-1/2 right-1 -translate-y-1/2",
270
+ onClick: () => onQuery("")
271
+ }) : search.hint && /*#__PURE__*/_jsx("span", {
272
+ className: "pointer-events-none absolute top-1/2 right-2.5 -translate-y-1/2 text-xs text-text-faint",
273
+ "aria-hidden": true,
274
+ children: search.hint
275
+ });
276
+ $[21] = onQuery;
277
+ $[22] = query;
278
+ $[23] = search.hint;
279
+ $[24] = t;
280
+ $[25] = t9;
281
+ } else {
282
+ t9 = $[25];
283
+ }
284
+ let t10;
285
+ if ($[26] !== t8 || $[27] !== t9) {
286
+ t10 = /*#__PURE__*/_jsxs("div", {
287
+ className: "relative shrink-0",
288
+ children: [t3, t8, t9]
289
+ });
290
+ $[26] = t8;
291
+ $[27] = t9;
292
+ $[28] = t10;
293
+ } else {
294
+ t10 = $[28];
295
+ }
296
+ return t10;
49
297
  }
50
298
  /* In place of the navigation while a query is typed: the panes and rows that match, each a jump to where it lives. */
51
- function SearchResults({ search, query, labelOf, onPick }) {
52
- const { t, i18n } = useTranslation('ui');
53
- // The language is a dependency the linter cannot see; every result reads its words off i18next.
54
- // oxlint-disable-next-line react-hooks/exhaustive-deps
55
- const results = useMemo(() => search.find(query), [search.find, query, i18n.language]);
56
- if (results.length === 0) {
57
- return _jsx("p", { className: "px-2.5 py-1 text-xs break-words text-text-muted", children: t('settings.search.none', { query: query.trim() }) });
58
- }
59
- return (_jsx("ul", { className: "flex min-h-0 flex-col gap-0.5 overflow-y-auto", "aria-label": t('settings.search.results'), children: results.map((result) => (_jsx("li", { children: _jsxs("button", { type: "button", className: "flex w-full min-w-0 flex-col rounded-md px-2.5 py-1.5 text-left hover:bg-surface-hover", onClick: () => onPick(result), children: [_jsx("span", { className: "truncate text-sm text-text", children: result.label }), _jsx("span", { className: "truncate text-xs text-text-faint", children: result.id === null ? t('settings.search.pane') : labelOf(result.section) })] }) }, `${result.section}:${result.id ?? ''}`))) }));
299
+ function SearchResults({
300
+ search,
301
+ query,
302
+ labelOf,
303
+ onPick
304
+ }) {
305
+ const {
306
+ t,
307
+ i18n
308
+ } = useTranslation('ui');
309
+ // The language is a dependency the linter cannot see; every result reads its words off i18next.
310
+ // oxlint-disable-next-line react-hooks/exhaustive-deps
311
+ const results = useMemo(() => search.find(query), [search.find, query, i18n.language]);
312
+ if (results.length === 0) {
313
+ return /*#__PURE__*/_jsx("p", {
314
+ className: "px-2.5 py-1 text-xs break-words text-text-muted",
315
+ children: t('settings.search.none', {
316
+ query: query.trim()
317
+ })
318
+ });
319
+ }
320
+ return /*#__PURE__*/_jsx("ul", {
321
+ className: "flex min-h-0 flex-col gap-0.5 overflow-y-auto",
322
+ "aria-label": t('settings.search.results'),
323
+ children: results.map(result => /*#__PURE__*/_jsx("li", {
324
+ children: /*#__PURE__*/_jsxs("button", {
325
+ type: "button",
326
+ className: "flex w-full min-w-0 flex-col rounded-md px-2.5 py-1.5 text-left hover:bg-surface-hover",
327
+ onClick: () => onPick(result),
328
+ children: [/*#__PURE__*/_jsx("span", {
329
+ className: "truncate text-sm text-text",
330
+ children: result.label
331
+ }), /*#__PURE__*/_jsx("span", {
332
+ className: "truncate text-xs text-text-faint",
333
+ children: result.id === null ? t('settings.search.pane') : labelOf(result.section)
334
+ })]
335
+ })
336
+ }, `${result.section}:${result.id ?? ''}`))
337
+ });
60
338
  }
61
339
  /* Sections on the left, one pane on the right. A pane mounts only while its section is open. */
62
- export function SettingsDialog({ open, onOpenChange, section, onNavigate, groups, footer = [], account, search, target = null, onTargetShown, className, ref }) {
63
- const { t } = useTranslation('ui');
64
- const [query, setQuery] = useState('');
65
- const sections = [...groups.flatMap((group) => group.sections), ...footer, ...(account ? [account.section] : [])];
66
- const meta = sections.find((entry) => entry.id === section) ?? sections[0];
67
- const items = sections.map((entry) => ({ value: entry.id, label: entry.label }));
68
- const searching = search !== undefined && query.trim() !== '';
69
- const floating = meta.hero !== undefined && !meta.split;
70
- const barFill = useRef(null);
71
- // The latest callback behind a stable one, so a lit row's timer does not start over on every render.
72
- const latestShown = useRef(onTargetShown);
73
- useEffect(() => {
74
- latestShown.current = onTargetShown;
75
- });
76
- const targetValue = useMemo(() => ({ target, shown: () => latestShown.current?.() }), [target]);
77
- const labelOf = (id) => sections.find((entry) => entry.id === id)?.label ?? id;
78
- const pick = (result) => onNavigate({ section: result.section, target: result.id });
79
- return (_jsx(DialogRoot, { open: open, onOpenChange: (next) => {
80
- onOpenChange(next);
81
- if (!next) {
82
- setQuery('');
83
- }
84
- }, children: _jsxs(DialogPopup, { ref: ref, className: clsx('flex h-[760px] w-[1200px]', className), children: [_jsxs(Tabs.Root, { value: meta.id, onValueChange: (value) => onNavigate({ section: value }), orientation: "vertical", className: "flex min-h-0 min-w-0 grow max-[640px]:flex-col", children: [_jsxs("div", { className: "flex w-58 shrink-0 flex-col gap-3.5 border-r border-border bg-surface bg-clip-padding px-3 py-4 max-[960px]:w-48 max-[640px]:w-auto max-[640px]:flex-row max-[640px]:items-center max-[640px]:border-r-0 max-[640px]:border-b", children: [_jsx(DialogTitle, { className: "px-2.5 pt-1 max-[640px]:pt-0", children: t('settings.title') }), _jsxs("div", { className: "contents max-[640px]:hidden", children: [search && _jsx(SearchField, { search: search, query: query, onQuery: setQuery, onPick: pick }), searching ? (_jsx(SearchResults, { search: search, query: query, labelOf: labelOf, onPick: pick })) : (_jsx(SettingsNav, { groups: groups, footer: footer, account: account }))] }), _jsx("div", { className: "min-w-0 grow min-[641px]:hidden", children: _jsx(Select, { value: meta.id, items: items, onValueChange: (value) => onNavigate({ section: value }), label: t('settings.section') }) })] }), _jsxs("div", { className: "relative flex min-h-0 min-w-0 grow flex-col", children: [_jsxs("div", { className: clsx('flex min-w-0 items-start gap-4 px-8 pt-5.5 pb-4.5 max-[960px]:px-4', floating && 'absolute inset-x-0 top-0 z-10'), children: [floating && (_jsx("div", { ref: barFill, className: "absolute inset-0 -z-10 border-b border-border bg-surface-raised opacity-0", "aria-hidden": true }, meta.id)), _jsxs("div", { className: "min-w-0 grow", children: [_jsx("h2", { className: "text-lg font-semibold text-text", children: meta.label }), _jsx("p", { className: "mt-0.5 text-xs break-words text-text-muted", children: meta.description })] }), _jsx(CloseButton, { label: t('settings.close'), dialog: true })] }), _jsx(SettingsTargetContext, { value: targetValue, children: sections.map((entry) => {
85
- const Pane = entry.pane;
86
- const Hero = entry.split ? undefined : entry.hero;
87
- return (_jsx(Tabs.Panel, { value: entry.id, keepMounted: false, className: clsx('flex min-h-0 min-w-0 grow flex-col outline-none',
88
- // A split pane scrolls each of its sides itself.
89
- !entry.split && 'gap-7 overflow-y-auto px-8 pb-10 max-[960px]:px-4',
90
- // Under a hero the bar's fill marks the edge; a fade would wipe the hero out behind the clear bar.
91
- !entry.split && !Hero && 'scroll-fade-top pt-1'), onScroll: (event) => {
92
- const top = event.currentTarget.scrollTop;
93
- event.currentTarget.toggleAttribute('data-fade-start', top > 0);
94
- barFill.current?.style.setProperty('opacity', String(Math.min(top / BAR_FILL_DISTANCE, 1)));
95
- }, children: _jsx(ErrorBoundary, { label: t('settings.failed'), className: "min-h-0 grow", children: _jsxs(LazyBoundary, { children: [Hero && (_jsx("div", { className: "-mx-8 shrink-0 max-[960px]:-mx-4", children: _jsx(Hero, {}) })), _jsx(Pane, {})] }) }) }, entry.id));
96
- }) })] })] }), _jsx(DialogDescription, { className: "sr-only", children: meta.description })] }) }));
340
+ export function SettingsDialog(t0) {
341
+ const $ = _c(110);
342
+ const {
343
+ open,
344
+ onOpenChange,
345
+ section,
346
+ onNavigate,
347
+ groups,
348
+ footer: t1,
349
+ account,
350
+ search,
351
+ target: t2,
352
+ onTargetShown,
353
+ className,
354
+ ref
355
+ } = t0;
356
+ let t3;
357
+ if ($[0] !== t1) {
358
+ t3 = t1 === undefined ? [] : t1;
359
+ $[0] = t1;
360
+ $[1] = t3;
361
+ } else {
362
+ t3 = $[1];
363
+ }
364
+ const footer = t3;
365
+ const target = t2 === undefined ? null : t2;
366
+ const {
367
+ t
368
+ } = useTranslation("ui");
369
+ const [query, setQuery] = useState("");
370
+ let t4;
371
+ if ($[2] !== account || $[3] !== footer || $[4] !== groups) {
372
+ let t5;
373
+ if ($[6] !== account) {
374
+ t5 = account ? [account.section] : [];
375
+ $[6] = account;
376
+ $[7] = t5;
377
+ } else {
378
+ t5 = $[7];
379
+ }
380
+ t4 = [...groups.flatMap(_temp4), ...footer, ...t5];
381
+ $[2] = account;
382
+ $[3] = footer;
383
+ $[4] = groups;
384
+ $[5] = t4;
385
+ } else {
386
+ t4 = $[5];
387
+ }
388
+ const sections = t4;
389
+ let t5;
390
+ if ($[8] !== section || $[9] !== sections) {
391
+ t5 = sections.find(entry => entry.id === section) ?? sections[0];
392
+ $[8] = section;
393
+ $[9] = sections;
394
+ $[10] = t5;
395
+ } else {
396
+ t5 = $[10];
397
+ }
398
+ const meta = t5;
399
+ let t6;
400
+ if ($[11] !== sections) {
401
+ t6 = sections.map(_temp5);
402
+ $[11] = sections;
403
+ $[12] = t6;
404
+ } else {
405
+ t6 = $[12];
406
+ }
407
+ const items = t6;
408
+ let t7;
409
+ if ($[13] !== query || $[14] !== search) {
410
+ t7 = search !== undefined && query.trim() !== "";
411
+ $[13] = query;
412
+ $[14] = search;
413
+ $[15] = t7;
414
+ } else {
415
+ t7 = $[15];
416
+ }
417
+ const searching = t7;
418
+ const floating = meta.hero !== undefined && !meta.split;
419
+ const barFill = useRef(null);
420
+ const latestShown = useRef(onTargetShown);
421
+ let t8;
422
+ if ($[16] !== onTargetShown) {
423
+ t8 = () => {
424
+ latestShown.current = onTargetShown;
425
+ };
426
+ $[16] = onTargetShown;
427
+ $[17] = t8;
428
+ } else {
429
+ t8 = $[17];
430
+ }
431
+ useEffect(t8);
432
+ let t9;
433
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
434
+ t9 = () => latestShown.current?.();
435
+ $[18] = t9;
436
+ } else {
437
+ t9 = $[18];
438
+ }
439
+ let t10;
440
+ if ($[19] !== target) {
441
+ t10 = {
442
+ target,
443
+ shown: t9
444
+ };
445
+ $[19] = target;
446
+ $[20] = t10;
447
+ } else {
448
+ t10 = $[20];
449
+ }
450
+ const targetValue = t10;
451
+ let t11;
452
+ if ($[21] !== sections) {
453
+ t11 = id => sections.find(entry_1 => entry_1.id === id)?.label ?? id;
454
+ $[21] = sections;
455
+ $[22] = t11;
456
+ } else {
457
+ t11 = $[22];
458
+ }
459
+ const labelOf = t11;
460
+ let t12;
461
+ if ($[23] !== onNavigate) {
462
+ t12 = result => onNavigate({
463
+ section: result.section,
464
+ target: result.id
465
+ });
466
+ $[23] = onNavigate;
467
+ $[24] = t12;
468
+ } else {
469
+ t12 = $[24];
470
+ }
471
+ const pick = t12;
472
+ let t13;
473
+ if ($[25] !== onOpenChange) {
474
+ t13 = next => {
475
+ onOpenChange(next);
476
+ if (!next) {
477
+ setQuery("");
478
+ }
479
+ };
480
+ $[25] = onOpenChange;
481
+ $[26] = t13;
482
+ } else {
483
+ t13 = $[26];
484
+ }
485
+ let t14;
486
+ if ($[27] !== className) {
487
+ t14 = clsx("flex h-[760px] w-[1200px]", className);
488
+ $[27] = className;
489
+ $[28] = t14;
490
+ } else {
491
+ t14 = $[28];
492
+ }
493
+ const t15 = meta.id;
494
+ let t16;
495
+ if ($[29] !== onNavigate) {
496
+ t16 = value => onNavigate({
497
+ section: value
498
+ });
499
+ $[29] = onNavigate;
500
+ $[30] = t16;
501
+ } else {
502
+ t16 = $[30];
503
+ }
504
+ let t17;
505
+ if ($[31] !== t) {
506
+ t17 = t("settings.title");
507
+ $[31] = t;
508
+ $[32] = t17;
509
+ } else {
510
+ t17 = $[32];
511
+ }
512
+ let t18;
513
+ if ($[33] !== t17) {
514
+ t18 = /*#__PURE__*/_jsx(DialogTitle, {
515
+ className: "px-2.5 pt-1 max-[640px]:pt-0",
516
+ children: t17
517
+ });
518
+ $[33] = t17;
519
+ $[34] = t18;
520
+ } else {
521
+ t18 = $[34];
522
+ }
523
+ let t19;
524
+ if ($[35] !== pick || $[36] !== query || $[37] !== search) {
525
+ t19 = search && /*#__PURE__*/_jsx(SearchField, {
526
+ search: search,
527
+ query: query,
528
+ onQuery: setQuery,
529
+ onPick: pick
530
+ });
531
+ $[35] = pick;
532
+ $[36] = query;
533
+ $[37] = search;
534
+ $[38] = t19;
535
+ } else {
536
+ t19 = $[38];
537
+ }
538
+ let t20;
539
+ if ($[39] !== account || $[40] !== footer || $[41] !== groups || $[42] !== labelOf || $[43] !== pick || $[44] !== query || $[45] !== search || $[46] !== searching) {
540
+ t20 = searching ? /*#__PURE__*/_jsx(SearchResults, {
541
+ search: search,
542
+ query: query,
543
+ labelOf: labelOf,
544
+ onPick: pick
545
+ }) : /*#__PURE__*/_jsx(SettingsNav, {
546
+ groups: groups,
547
+ footer: footer,
548
+ account: account
549
+ });
550
+ $[39] = account;
551
+ $[40] = footer;
552
+ $[41] = groups;
553
+ $[42] = labelOf;
554
+ $[43] = pick;
555
+ $[44] = query;
556
+ $[45] = search;
557
+ $[46] = searching;
558
+ $[47] = t20;
559
+ } else {
560
+ t20 = $[47];
561
+ }
562
+ let t21;
563
+ if ($[48] !== t19 || $[49] !== t20) {
564
+ t21 = /*#__PURE__*/_jsxs("div", {
565
+ className: "contents max-[640px]:hidden",
566
+ children: [t19, t20]
567
+ });
568
+ $[48] = t19;
569
+ $[49] = t20;
570
+ $[50] = t21;
571
+ } else {
572
+ t21 = $[50];
573
+ }
574
+ const t22 = meta.id;
575
+ let t23;
576
+ if ($[51] !== onNavigate) {
577
+ t23 = value_0 => onNavigate({
578
+ section: value_0
579
+ });
580
+ $[51] = onNavigate;
581
+ $[52] = t23;
582
+ } else {
583
+ t23 = $[52];
584
+ }
585
+ let t24;
586
+ if ($[53] !== t) {
587
+ t24 = t("settings.section");
588
+ $[53] = t;
589
+ $[54] = t24;
590
+ } else {
591
+ t24 = $[54];
592
+ }
593
+ let t25;
594
+ if ($[55] !== items || $[56] !== meta.id || $[57] !== t23 || $[58] !== t24) {
595
+ t25 = /*#__PURE__*/_jsx("div", {
596
+ className: "min-w-0 grow min-[641px]:hidden",
597
+ children: /*#__PURE__*/_jsx(Select, {
598
+ value: t22,
599
+ items: items,
600
+ onValueChange: t23,
601
+ label: t24
602
+ })
603
+ });
604
+ $[55] = items;
605
+ $[56] = meta.id;
606
+ $[57] = t23;
607
+ $[58] = t24;
608
+ $[59] = t25;
609
+ } else {
610
+ t25 = $[59];
611
+ }
612
+ let t26;
613
+ if ($[60] !== t18 || $[61] !== t21 || $[62] !== t25) {
614
+ t26 = /*#__PURE__*/_jsxs("div", {
615
+ className: "flex w-58 shrink-0 flex-col gap-3.5 border-r border-border bg-surface bg-clip-padding px-3 py-4 max-[960px]:w-48 max-[640px]:w-auto max-[640px]:flex-row max-[640px]:items-center max-[640px]:border-r-0 max-[640px]:border-b",
616
+ children: [t18, t21, t25]
617
+ });
618
+ $[60] = t18;
619
+ $[61] = t21;
620
+ $[62] = t25;
621
+ $[63] = t26;
622
+ } else {
623
+ t26 = $[63];
624
+ }
625
+ const t27 = floating && "absolute inset-x-0 top-0 z-10";
626
+ let t28;
627
+ if ($[64] !== t27) {
628
+ t28 = clsx("flex min-w-0 items-start gap-4 px-8 pt-5.5 pb-4.5 max-[960px]:px-4", t27);
629
+ $[64] = t27;
630
+ $[65] = t28;
631
+ } else {
632
+ t28 = $[65];
633
+ }
634
+ let t29;
635
+ if ($[66] !== floating || $[67] !== meta.id) {
636
+ t29 = floating && /*#__PURE__*/_jsx("div", {
637
+ ref: barFill,
638
+ className: "absolute inset-0 -z-10 border-b border-border bg-surface-raised opacity-0",
639
+ "aria-hidden": true
640
+ }, meta.id);
641
+ $[66] = floating;
642
+ $[67] = meta.id;
643
+ $[68] = t29;
644
+ } else {
645
+ t29 = $[68];
646
+ }
647
+ let t30;
648
+ if ($[69] !== meta.label) {
649
+ t30 = /*#__PURE__*/_jsx("h2", {
650
+ className: "text-lg font-semibold text-text",
651
+ children: meta.label
652
+ });
653
+ $[69] = meta.label;
654
+ $[70] = t30;
655
+ } else {
656
+ t30 = $[70];
657
+ }
658
+ let t31;
659
+ if ($[71] !== meta.description) {
660
+ t31 = /*#__PURE__*/_jsx("p", {
661
+ className: "mt-0.5 text-xs break-words text-text-muted",
662
+ children: meta.description
663
+ });
664
+ $[71] = meta.description;
665
+ $[72] = t31;
666
+ } else {
667
+ t31 = $[72];
668
+ }
669
+ let t32;
670
+ if ($[73] !== t30 || $[74] !== t31) {
671
+ t32 = /*#__PURE__*/_jsxs("div", {
672
+ className: "min-w-0 grow",
673
+ children: [t30, t31]
674
+ });
675
+ $[73] = t30;
676
+ $[74] = t31;
677
+ $[75] = t32;
678
+ } else {
679
+ t32 = $[75];
680
+ }
681
+ let t33;
682
+ if ($[76] !== t) {
683
+ t33 = t("settings.close");
684
+ $[76] = t;
685
+ $[77] = t33;
686
+ } else {
687
+ t33 = $[77];
688
+ }
689
+ let t34;
690
+ if ($[78] !== t33) {
691
+ t34 = /*#__PURE__*/_jsx(CloseButton, {
692
+ label: t33,
693
+ dialog: true
694
+ });
695
+ $[78] = t33;
696
+ $[79] = t34;
697
+ } else {
698
+ t34 = $[79];
699
+ }
700
+ let t35;
701
+ if ($[80] !== t28 || $[81] !== t29 || $[82] !== t32 || $[83] !== t34) {
702
+ t35 = /*#__PURE__*/_jsxs("div", {
703
+ className: t28,
704
+ children: [t29, t32, t34]
705
+ });
706
+ $[80] = t28;
707
+ $[81] = t29;
708
+ $[82] = t32;
709
+ $[83] = t34;
710
+ $[84] = t35;
711
+ } else {
712
+ t35 = $[84];
713
+ }
714
+ let t36;
715
+ if ($[85] !== sections || $[86] !== t) {
716
+ t36 = sections.map(entry_2 => {
717
+ const Pane = entry_2.pane;
718
+ const Hero = entry_2.split ? undefined : entry_2.hero;
719
+ return /*#__PURE__*/_jsx(Tabs.Panel, {
720
+ value: entry_2.id,
721
+ keepMounted: false,
722
+ className: clsx("flex min-h-0 min-w-0 grow flex-col outline-none", !entry_2.split && "gap-7 overflow-y-auto px-8 pb-10 max-[960px]:px-4", !entry_2.split && !Hero && "scroll-fade-top pt-1"),
723
+ onScroll: event => {
724
+ const top = event.currentTarget.scrollTop;
725
+ event.currentTarget.toggleAttribute("data-fade-start", top > 0);
726
+ barFill.current?.style.setProperty("opacity", String(Math.min(top / BAR_FILL_DISTANCE, 1)));
727
+ },
728
+ children: /*#__PURE__*/_jsx(ErrorBoundary, {
729
+ label: t("settings.failed"),
730
+ className: "min-h-0 grow",
731
+ children: /*#__PURE__*/_jsxs(LazyBoundary, {
732
+ children: [Hero && /*#__PURE__*/_jsx("div", {
733
+ className: "-mx-8 shrink-0 max-[960px]:-mx-4",
734
+ children: /*#__PURE__*/_jsx(Hero, {})
735
+ }), /*#__PURE__*/_jsx(Pane, {})]
736
+ })
737
+ })
738
+ }, entry_2.id);
739
+ });
740
+ $[85] = sections;
741
+ $[86] = t;
742
+ $[87] = t36;
743
+ } else {
744
+ t36 = $[87];
745
+ }
746
+ let t37;
747
+ if ($[88] !== t36 || $[89] !== targetValue) {
748
+ t37 = /*#__PURE__*/_jsx(SettingsTargetContext, {
749
+ value: targetValue,
750
+ children: t36
751
+ });
752
+ $[88] = t36;
753
+ $[89] = targetValue;
754
+ $[90] = t37;
755
+ } else {
756
+ t37 = $[90];
757
+ }
758
+ let t38;
759
+ if ($[91] !== t35 || $[92] !== t37) {
760
+ t38 = /*#__PURE__*/_jsxs("div", {
761
+ className: "relative flex min-h-0 min-w-0 grow flex-col",
762
+ children: [t35, t37]
763
+ });
764
+ $[91] = t35;
765
+ $[92] = t37;
766
+ $[93] = t38;
767
+ } else {
768
+ t38 = $[93];
769
+ }
770
+ let t39;
771
+ if ($[94] !== meta.id || $[95] !== t16 || $[96] !== t26 || $[97] !== t38) {
772
+ t39 = /*#__PURE__*/_jsxs(Tabs.Root, {
773
+ value: t15,
774
+ onValueChange: t16,
775
+ orientation: "vertical",
776
+ className: "flex min-h-0 min-w-0 grow max-[640px]:flex-col",
777
+ children: [t26, t38]
778
+ });
779
+ $[94] = meta.id;
780
+ $[95] = t16;
781
+ $[96] = t26;
782
+ $[97] = t38;
783
+ $[98] = t39;
784
+ } else {
785
+ t39 = $[98];
786
+ }
787
+ let t40;
788
+ if ($[99] !== meta.description) {
789
+ t40 = /*#__PURE__*/_jsx(DialogDescription, {
790
+ className: "sr-only",
791
+ children: meta.description
792
+ });
793
+ $[99] = meta.description;
794
+ $[100] = t40;
795
+ } else {
796
+ t40 = $[100];
797
+ }
798
+ let t41;
799
+ if ($[101] !== ref || $[102] !== t14 || $[103] !== t39 || $[104] !== t40) {
800
+ t41 = /*#__PURE__*/_jsxs(DialogPopup, {
801
+ ref: ref,
802
+ className: t14,
803
+ children: [t39, t40]
804
+ });
805
+ $[101] = ref;
806
+ $[102] = t14;
807
+ $[103] = t39;
808
+ $[104] = t40;
809
+ $[105] = t41;
810
+ } else {
811
+ t41 = $[105];
812
+ }
813
+ let t42;
814
+ if ($[106] !== open || $[107] !== t13 || $[108] !== t41) {
815
+ t42 = /*#__PURE__*/_jsx(DialogRoot, {
816
+ open: open,
817
+ onOpenChange: t13,
818
+ children: t41
819
+ });
820
+ $[106] = open;
821
+ $[107] = t13;
822
+ $[108] = t41;
823
+ $[109] = t42;
824
+ } else {
825
+ t42 = $[109];
826
+ }
827
+ return t42;
828
+ }
829
+ function _temp5(entry_0) {
830
+ return {
831
+ value: entry_0.id,
832
+ label: entry_0.label
833
+ };
97
834
  }
835
+ function _temp4(group) {
836
+ return group.sections;
837
+ }