@adecore/ui 0.35.4 → 0.36.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 (66) hide show
  1. package/dist/Button.d.ts +2 -3
  2. package/dist/Button.js +21 -46
  3. package/dist/Checkbox.js +1 -1
  4. package/dist/ChoiceCards.js +2 -2
  5. package/dist/IconPicker.d.ts +2 -1
  6. package/dist/IconPicker.js +504 -217
  7. package/dist/Input.d.ts +5 -3
  8. package/dist/Input.js +127 -112
  9. package/dist/Segmented.js +1 -1
  10. package/dist/SplitButton.d.ts +17 -0
  11. package/dist/SplitButton.js +237 -0
  12. package/dist/Stepper.js +1 -1
  13. package/dist/Switch.js +1 -1
  14. package/dist/Tile.js +2 -2
  15. package/dist/button-class.d.ts +6 -0
  16. package/dist/button-class.js +92 -0
  17. package/dist/command-palette/parts.d.ts +2 -2
  18. package/dist/command-palette/parts.js +125 -164
  19. package/dist/file-tree/empty-lines.d.ts +11 -0
  20. package/dist/file-tree/empty-lines.js +89 -0
  21. package/dist/file-tree/highlight.d.ts +4 -0
  22. package/dist/file-tree/highlight.js +75 -0
  23. package/dist/file-tree/parts.d.ts +9 -1
  24. package/dist/file-tree/parts.js +297 -205
  25. package/dist/file-tree/style.js +13 -0
  26. package/dist/file-tree/use-empty-lines.d.ts +3 -0
  27. package/dist/file-tree/use-empty-lines.js +176 -0
  28. package/dist/file-tree/use-file-tree.js +5 -1
  29. package/dist/file-tree/use-slots.d.ts +16 -2
  30. package/dist/file-tree/use-slots.js +186 -43
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.js +1 -0
  33. package/dist/locales/en.d.ts +1 -0
  34. package/dist/locales/en.js +1 -0
  35. package/dist/locales/nl.d.ts +1 -0
  36. package/dist/locales/nl.js +1 -0
  37. package/dist/select-shared.d.ts +1 -1
  38. package/dist/select-shared.js +1 -1
  39. package/dist/settings/SettingsDialog.js +1 -1
  40. package/dist/theme.css +33 -3
  41. package/package.json +1 -1
  42. package/src/Button.tsx +3 -36
  43. package/src/Checkbox.tsx +1 -1
  44. package/src/ChoiceCards.tsx +2 -2
  45. package/src/IconPicker.tsx +220 -136
  46. package/src/Input.tsx +19 -10
  47. package/src/Segmented.tsx +1 -1
  48. package/src/SplitButton.tsx +72 -0
  49. package/src/Stepper.tsx +6 -1
  50. package/src/Switch.tsx +1 -1
  51. package/src/Tile.tsx +2 -2
  52. package/src/button-class.ts +111 -0
  53. package/src/command-palette/parts.tsx +34 -2
  54. package/src/file-tree/empty-lines.ts +105 -0
  55. package/src/file-tree/highlight.ts +80 -0
  56. package/src/file-tree/parts.tsx +42 -11
  57. package/src/file-tree/style.ts +13 -0
  58. package/src/file-tree/use-empty-lines.ts +115 -0
  59. package/src/file-tree/use-file-tree.ts +2 -1
  60. package/src/file-tree/use-slots.ts +176 -17
  61. package/src/index.ts +1 -0
  62. package/src/locales/en.ts +1 -0
  63. package/src/locales/nl.ts +1 -0
  64. package/src/select-shared.ts +2 -1
  65. package/src/settings/SettingsDialog.tsx +1 -1
  66. package/src/theme.css +33 -3
@@ -1,17 +1,19 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { useId, useLayoutEffect, useRef, useState } from 'react';
3
3
  import clsx from 'clsx';
4
- import { Ban, Search, X } from 'lucide-react';
4
+ import { Ban, ChevronDown, Search, X } from 'lucide-react';
5
5
  import { useTranslation } from 'react-i18next';
6
+ import { Button } from "./Button.js";
6
7
  import { EmptyState } from "./EmptyState.js";
7
8
  import { formatNumber } from './format/number.js';
8
9
  import { Icon } from "./Icon.js";
9
10
  import { IconButton } from "./IconButton.js";
10
11
  import { cellForKey, escapeClearsSearch, filterSections, isGrouped, sectionsOf, tabStopOf } from './icon-picker.js';
12
+ import { PopoverPopup, PopoverRoot, PopoverTrigger } from "./popover/parts.js";
11
13
  import { SectionLabel } from "./SectionLabel.js";
12
14
  import { Tooltip } from "./Tooltip.js";
13
15
  /* A row of cells is 28 high with a gap of 4. Under a heading of 28 the last row keeps 8 below it; without headings the grid has 6 above as well. */
14
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
16
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
17
  const ROW_HEIGHT = 32;
16
18
  const HEADED_EXTRA = 32;
17
19
  const BARE_EXTRA = 10;
@@ -25,12 +27,12 @@ const markStuckHeadings = area => {
25
27
  }
26
28
  };
27
29
  /*
28
- * The mark a thing wears, one of a set of Lucide icons, as a grid under a label. With a search or a
29
- * height in rows, the search and the grid share one frame. The grid is one tab stop: arrows move the
30
- * focus and only Enter, Space or a click chooses, since a caller may save every choice at once.
30
+ * The mark a thing wears, one of a set of Lucide icons, behind a trigger drawn like a field. The
31
+ * popover holds a search over the grid. The grid is one tab stop: arrows move the focus and only
32
+ * Enter, Space or a click chooses, since a caller may save every choice at once.
31
33
  */
32
34
  export function IconPicker(t0) {
33
- const $ = _c(48);
35
+ const $ = _c(76);
34
36
  const {
35
37
  icons,
36
38
  value,
@@ -41,55 +43,358 @@ export function IconPicker(t0) {
41
43
  disabled: t2,
42
44
  onClear,
43
45
  label,
46
+ hideLabel: t3,
44
47
  className,
45
48
  ref
46
49
  } = t0;
47
- let t3;
50
+ let t4;
48
51
  if ($[0] !== icons || $[1] !== t1) {
49
- t3 = t1 === undefined ? isGrouped(icons) : t1;
52
+ t4 = t1 === undefined ? isGrouped(icons) : t1;
50
53
  $[0] = icons;
51
54
  $[1] = t1;
52
- $[2] = t3;
55
+ $[2] = t4;
53
56
  } else {
54
- t3 = $[2];
57
+ t4 = $[2];
55
58
  }
56
- const searchable = t3;
59
+ const searchable = t4;
57
60
  const disabled = t2 === undefined ? false : t2;
61
+ const hideLabel = t3 === undefined ? false : t3;
58
62
  const {
59
63
  t
60
64
  } = useTranslation("ui");
61
65
  const id = useId();
62
- const area = useRef(null);
63
- const input = useRef(null);
64
- const [query, setQuery] = useState("");
65
- const [focused, setFocused] = useState(null);
66
- let t4;
67
- if ($[3] !== icons) {
68
- t4 = isGrouped(icons);
66
+ const trigger = useRef(null);
67
+ const [open, setOpen] = useState(false);
68
+ let sections;
69
+ let t5;
70
+ if ($[3] !== icons || $[4] !== value) {
71
+ sections = sectionsOf(icons);
72
+ t5 = value === null ? undefined : sections.flatMap(_temp).find(t6 => {
73
+ const [icon] = t6;
74
+ return icon === value;
75
+ })?.[1];
69
76
  $[3] = icons;
70
- $[4] = t4;
77
+ $[4] = value;
78
+ $[5] = sections;
79
+ $[6] = t5;
71
80
  } else {
72
- t4 = $[4];
81
+ sections = $[5];
82
+ t5 = $[6];
73
83
  }
74
- const headed = t4;
75
- const framed = searchable || rows !== undefined;
76
- const sections = sectionsOf(icons);
77
- const shown = filterSections(sections, query, keywords);
78
- const tabStop = tabStopOf(shown.flatMap(_temp2), focused, value);
79
- let t5;
80
- if ($[5] !== label || $[6] !== t) {
81
- t5 = label ?? t("iconPicker.label");
82
- $[5] = label;
83
- $[6] = t;
84
- $[7] = t5;
84
+ const glyph = t5;
85
+ let t6;
86
+ if ($[7] !== label || $[8] !== t) {
87
+ t6 = label ?? t("iconPicker.label");
88
+ $[7] = label;
89
+ $[8] = t;
90
+ $[9] = t6;
85
91
  } else {
86
- t5 = $[7];
92
+ t6 = $[9];
87
93
  }
88
- const name_0 = t5;
89
- let t6;
94
+ const name = t6;
95
+ const clearable = onClear !== undefined && value !== null && !disabled;
90
96
  let t7;
91
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
92
- t6 = () => {
97
+ if ($[10] !== onValueChange) {
98
+ t7 = icon_0 => {
99
+ onValueChange(icon_0);
100
+ setOpen(false);
101
+ };
102
+ $[10] = onValueChange;
103
+ $[11] = t7;
104
+ } else {
105
+ t7 = $[11];
106
+ }
107
+ const choose = t7;
108
+ let t8;
109
+ if ($[12] !== onClear) {
110
+ t8 = () => {
111
+ onClear?.();
112
+ setOpen(false);
113
+ };
114
+ $[12] = onClear;
115
+ $[13] = t8;
116
+ } else {
117
+ t8 = $[13];
118
+ }
119
+ const clear = t8;
120
+ let t9;
121
+ if ($[14] !== className) {
122
+ t9 = clsx("flex flex-col gap-1.5", className);
123
+ $[14] = className;
124
+ $[15] = t9;
125
+ } else {
126
+ t9 = $[15];
127
+ }
128
+ const t10 = `${id}-label`;
129
+ let t11;
130
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
131
+ t11 = /*#__PURE__*/_jsx("div", {});
132
+ $[16] = t11;
133
+ } else {
134
+ t11 = $[16];
135
+ }
136
+ const t12 = hideLabel && "sr-only";
137
+ let t13;
138
+ if ($[17] !== t12) {
139
+ t13 = clsx(t12);
140
+ $[17] = t12;
141
+ $[18] = t13;
142
+ } else {
143
+ t13 = $[18];
144
+ }
145
+ let t14;
146
+ if ($[19] !== name || $[20] !== t10 || $[21] !== t13) {
147
+ t14 = /*#__PURE__*/_jsx(SectionLabel, {
148
+ id: t10,
149
+ render: t11,
150
+ className: t13,
151
+ children: name
152
+ });
153
+ $[19] = name;
154
+ $[20] = t10;
155
+ $[21] = t13;
156
+ $[22] = t14;
157
+ } else {
158
+ t14 = $[22];
159
+ }
160
+ const t15 = `${id}-label ${id}-value`;
161
+ let t16;
162
+ if ($[23] !== glyph) {
163
+ t16 = glyph && /*#__PURE__*/_jsx(Icon, {
164
+ icon: glyph,
165
+ size: 16,
166
+ className: "shrink-0 text-text"
167
+ });
168
+ $[23] = glyph;
169
+ $[24] = t16;
170
+ } else {
171
+ t16 = $[24];
172
+ }
173
+ const t17 = `${id}-value`;
174
+ const t18 = glyph ? "sr-only" : "text-text-faint";
175
+ let t19;
176
+ if ($[25] !== t18) {
177
+ t19 = clsx("min-w-0 truncate", t18);
178
+ $[25] = t18;
179
+ $[26] = t19;
180
+ } else {
181
+ t19 = $[26];
182
+ }
183
+ let t20;
184
+ if ($[27] !== t || $[28] !== value) {
185
+ t20 = value ?? t("iconPicker.placeholder");
186
+ $[27] = t;
187
+ $[28] = value;
188
+ $[29] = t20;
189
+ } else {
190
+ t20 = $[29];
191
+ }
192
+ let t21;
193
+ if ($[30] !== t17 || $[31] !== t19 || $[32] !== t20) {
194
+ t21 = /*#__PURE__*/_jsx("span", {
195
+ id: t17,
196
+ className: t19,
197
+ children: t20
198
+ });
199
+ $[30] = t17;
200
+ $[31] = t19;
201
+ $[32] = t20;
202
+ $[33] = t21;
203
+ } else {
204
+ t21 = $[33];
205
+ }
206
+ let t22;
207
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
208
+ t22 = /*#__PURE__*/_jsx(Icon, {
209
+ icon: ChevronDown,
210
+ size: 14,
211
+ className: "shrink-0 text-text-faint"
212
+ });
213
+ $[34] = t22;
214
+ } else {
215
+ t22 = $[34];
216
+ }
217
+ let t23;
218
+ if ($[35] !== disabled || $[36] !== t15 || $[37] !== t16 || $[38] !== t21) {
219
+ t23 = /*#__PURE__*/_jsxs(PopoverTrigger, {
220
+ ref: trigger,
221
+ disabled: disabled,
222
+ "aria-labelledby": t15,
223
+ className: "field flex w-auto min-w-0 items-center gap-2 text-left hover:bg-surface-hover data-disabled:cursor-default data-disabled:opacity-50 data-disabled:hover:bg-field data-[popup-open]:bg-surface-hover",
224
+ children: [t16, t21, t22]
225
+ });
226
+ $[35] = disabled;
227
+ $[36] = t15;
228
+ $[37] = t16;
229
+ $[38] = t21;
230
+ $[39] = t23;
231
+ } else {
232
+ t23 = $[39];
233
+ }
234
+ let t24;
235
+ if ($[40] !== clearable || $[41] !== onClear || $[42] !== t) {
236
+ t24 = clearable && /*#__PURE__*/_jsx(Tooltip, {
237
+ label: t("iconPicker.none"),
238
+ children: /*#__PURE__*/_jsx(Button, {
239
+ variant: "secondary",
240
+ className: "w-8 shrink-0 px-0!",
241
+ "aria-label": t("iconPicker.none"),
242
+ onClick: () => {
243
+ onClear();
244
+ trigger.current?.focus();
245
+ },
246
+ children: /*#__PURE__*/_jsx(Icon, {
247
+ icon: X,
248
+ size: 16
249
+ })
250
+ })
251
+ });
252
+ $[40] = clearable;
253
+ $[41] = onClear;
254
+ $[42] = t;
255
+ $[43] = t24;
256
+ } else {
257
+ t24 = $[43];
258
+ }
259
+ let t25;
260
+ if ($[44] !== t23 || $[45] !== t24) {
261
+ t25 = /*#__PURE__*/_jsxs("div", {
262
+ className: "flex gap-1.5",
263
+ children: [t23, t24]
264
+ });
265
+ $[44] = t23;
266
+ $[45] = t24;
267
+ $[46] = t25;
268
+ } else {
269
+ t25 = $[46];
270
+ }
271
+ let t26;
272
+ if ($[47] !== id) {
273
+ t26 = () => document.getElementById(`${id}-search`) ?? document.getElementById(`${id}-grid`)?.querySelector("[tabindex=\"0\"]") ?? false;
274
+ $[47] = id;
275
+ $[48] = t26;
276
+ } else {
277
+ t26 = $[48];
278
+ }
279
+ let t27;
280
+ if ($[49] !== icons) {
281
+ t27 = isGrouped(icons);
282
+ $[49] = icons;
283
+ $[50] = t27;
284
+ } else {
285
+ t27 = $[50];
286
+ }
287
+ const t28 = onClear && clear;
288
+ let t29;
289
+ if ($[51] !== choose || $[52] !== disabled || $[53] !== id || $[54] !== keywords || $[55] !== name || $[56] !== rows || $[57] !== searchable || $[58] !== sections || $[59] !== t27 || $[60] !== t28 || $[61] !== value) {
290
+ t29 = /*#__PURE__*/_jsx(IconPickerPanel, {
291
+ id: id,
292
+ name: name,
293
+ sections: sections,
294
+ headed: t27,
295
+ value: value,
296
+ keywords: keywords,
297
+ searchable: searchable,
298
+ rows: rows,
299
+ disabled: disabled,
300
+ onChoose: choose,
301
+ onClear: t28
302
+ });
303
+ $[51] = choose;
304
+ $[52] = disabled;
305
+ $[53] = id;
306
+ $[54] = keywords;
307
+ $[55] = name;
308
+ $[56] = rows;
309
+ $[57] = searchable;
310
+ $[58] = sections;
311
+ $[59] = t27;
312
+ $[60] = t28;
313
+ $[61] = value;
314
+ $[62] = t29;
315
+ } else {
316
+ t29 = $[62];
317
+ }
318
+ let t30;
319
+ if ($[63] !== name || $[64] !== t26 || $[65] !== t29) {
320
+ t30 = /*#__PURE__*/_jsx(PopoverPopup, {
321
+ variant: "picker",
322
+ "aria-label": name,
323
+ className: "w-90",
324
+ initialFocus: t26,
325
+ finalFocus: trigger,
326
+ children: t29
327
+ });
328
+ $[63] = name;
329
+ $[64] = t26;
330
+ $[65] = t29;
331
+ $[66] = t30;
332
+ } else {
333
+ t30 = $[66];
334
+ }
335
+ let t31;
336
+ if ($[67] !== open || $[68] !== t25 || $[69] !== t30) {
337
+ t31 = /*#__PURE__*/_jsxs(PopoverRoot, {
338
+ open: open,
339
+ onOpenChange: setOpen,
340
+ children: [t25, t30]
341
+ });
342
+ $[67] = open;
343
+ $[68] = t25;
344
+ $[69] = t30;
345
+ $[70] = t31;
346
+ } else {
347
+ t31 = $[70];
348
+ }
349
+ let t32;
350
+ if ($[71] !== ref || $[72] !== t14 || $[73] !== t31 || $[74] !== t9) {
351
+ t32 = /*#__PURE__*/_jsxs("div", {
352
+ ref: ref,
353
+ className: t9,
354
+ children: [t14, t31]
355
+ });
356
+ $[71] = ref;
357
+ $[72] = t14;
358
+ $[73] = t31;
359
+ $[74] = t9;
360
+ $[75] = t32;
361
+ } else {
362
+ t32 = $[75];
363
+ }
364
+ return t32;
365
+ }
366
+ /* What the popover holds. It mounts on every open, so a search and the focus start over each time. */
367
+ function _temp(section) {
368
+ return section.icons;
369
+ }
370
+ function IconPickerPanel(t0) {
371
+ const $ = _c(34);
372
+ const {
373
+ id,
374
+ name,
375
+ sections,
376
+ headed,
377
+ value,
378
+ keywords,
379
+ searchable,
380
+ rows,
381
+ disabled,
382
+ onChoose,
383
+ onClear
384
+ } = t0;
385
+ const {
386
+ t
387
+ } = useTranslation("ui");
388
+ const input = useRef(null);
389
+ const area = useRef(null);
390
+ const [query, setQuery] = useState("");
391
+ const [focused, setFocused] = useState(null);
392
+ const shown = filterSections(sections, query, keywords);
393
+ const tabStop = tabStopOf(shown.flatMap(_temp3), focused, value);
394
+ let t1;
395
+ let t2;
396
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
397
+ t1 = () => {
93
398
  const element = area.current;
94
399
  const chosen = element?.querySelector("[aria-checked=\"true\"]");
95
400
  if (!element || !chosen || element.scrollHeight <= element.clientHeight) {
@@ -98,81 +403,137 @@ export function IconPicker(t0) {
98
403
  const heading = element.querySelector("[data-icon-heading]")?.offsetHeight ?? 0;
99
404
  element.scrollTop = Math.round(chosen.offsetTop - heading - (element.clientHeight - heading - chosen.offsetHeight) / 2);
100
405
  };
101
- t7 = [];
102
- $[8] = t6;
103
- $[9] = t7;
406
+ t2 = [];
407
+ $[0] = t1;
408
+ $[1] = t2;
104
409
  } else {
105
- t6 = $[8];
106
- t7 = $[9];
410
+ t1 = $[0];
411
+ t2 = $[1];
107
412
  }
108
- useLayoutEffect(t6, t7);
109
- let t8;
110
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
111
- t8 = next => {
413
+ useLayoutEffect(t1, t2);
414
+ let t3;
415
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
416
+ t3 = next => {
112
417
  setQuery(next);
113
418
  if (area.current) {
114
419
  area.current.scrollTop = 0;
115
420
  }
116
421
  };
117
- $[10] = t8;
422
+ $[2] = t3;
118
423
  } else {
119
- t8 = $[10];
424
+ t3 = $[2];
120
425
  }
121
- const search = t8;
122
- const moveFocus = _temp4;
123
- const t9 = `${id}-grid`;
124
- const t10 = "radiogroup";
125
- const t11 = framed && "relative overflow-y-auto overscroll-contain";
126
- const t12 = framed && (headed ? "scroll-pt-7" : "px-1.5 pt-1.5 pb-2");
127
- let t13;
128
- if ($[11] !== t11 || $[12] !== t12) {
129
- t13 = clsx(t11, t12);
130
- $[11] = t11;
131
- $[12] = t12;
132
- $[13] = t13;
426
+ const search = t3;
427
+ let t4;
428
+ if ($[3] !== query) {
429
+ t4 = event => {
430
+ if (!escapeClearsSearch(event.key, query)) {
431
+ return;
432
+ }
433
+ event.stopPropagation();
434
+ event.preventDefault();
435
+ search("");
436
+ input.current?.focus();
437
+ };
438
+ $[3] = query;
439
+ $[4] = t4;
133
440
  } else {
134
- t13 = $[13];
441
+ t4 = $[4];
135
442
  }
136
- let t14;
137
- if ($[14] !== headed || $[15] !== rows) {
138
- t14 = rows === undefined ? undefined : {
443
+ const clearSearchFirst = t4;
444
+ const moveFocus = _temp5;
445
+ let t5;
446
+ if ($[5] !== disabled || $[6] !== id || $[7] !== query || $[8] !== searchable || $[9] !== t) {
447
+ t5 = searchable && /*#__PURE__*/_jsxs("div", {
448
+ className: "flex h-9 items-center gap-2 border-b border-border pr-1 pl-2.5",
449
+ children: [/*#__PURE__*/_jsx(Icon, {
450
+ icon: Search,
451
+ size: 14,
452
+ className: "shrink-0 text-text-faint"
453
+ }), /*#__PURE__*/_jsx("input", {
454
+ ref: input,
455
+ id: `${id}-search`,
456
+ type: "text",
457
+ value: query,
458
+ placeholder: t("iconPicker.search"),
459
+ "aria-label": t("iconPicker.search"),
460
+ "aria-controls": `${id}-grid`,
461
+ spellCheck: false,
462
+ autoComplete: "off",
463
+ disabled: disabled,
464
+ className: "h-full min-w-0 flex-1 bg-transparent text-sm text-text outline-none placeholder:text-text-faint",
465
+ onChange: event_1 => search(event_1.target.value)
466
+ }), query && /*#__PURE__*/_jsx(IconButton, {
467
+ icon: X,
468
+ size: "sm",
469
+ label: t("iconPicker.clear"),
470
+ tooltip: false,
471
+ onClick: () => {
472
+ search("");
473
+ input.current?.focus();
474
+ }
475
+ })]
476
+ });
477
+ $[5] = disabled;
478
+ $[6] = id;
479
+ $[7] = query;
480
+ $[8] = searchable;
481
+ $[9] = t;
482
+ $[10] = t5;
483
+ } else {
484
+ t5 = $[10];
485
+ }
486
+ const t6 = `${id}-grid`;
487
+ const t7 = "radiogroup";
488
+ const t8 = headed ? "scroll-pt-7" : "px-1.5 pt-1.5 pb-2";
489
+ let t9;
490
+ if ($[11] !== t8) {
491
+ t9 = clsx("relative overflow-y-auto overscroll-contain", t8);
492
+ $[11] = t8;
493
+ $[12] = t9;
494
+ } else {
495
+ t9 = $[12];
496
+ }
497
+ let t10;
498
+ if ($[13] !== headed || $[14] !== rows) {
499
+ t10 = rows === undefined ? undefined : {
139
500
  height: rows * ROW_HEIGHT + (headed ? HEADED_EXTRA : BARE_EXTRA)
140
501
  };
141
- $[14] = headed;
142
- $[15] = rows;
143
- $[16] = t14;
502
+ $[13] = headed;
503
+ $[14] = rows;
504
+ $[15] = t10;
144
505
  } else {
145
- t14 = $[16];
506
+ t10 = $[15];
146
507
  }
147
- const t15 = _temp5;
148
- const t16 = shown.length === 0 && query.trim() !== "" ? /*#__PURE__*/_jsx(EmptyState, {
508
+ const t11 = _temp6;
509
+ const t12 = shown.length === 0 && query.trim() !== "" ? /*#__PURE__*/_jsx(EmptyState, {
149
510
  className: "h-full",
150
511
  children: t("iconPicker.noMatch", {
151
512
  query: query.trim()
152
513
  })
153
514
  }) : shown.map((section_0, index) => {
154
515
  const cells_0 = /*#__PURE__*/_jsx("div", {
155
- className: clsx("grid grid-cols-[repeat(auto-fill,minmax(28px,1fr))] gap-1", framed && section_0.label !== null && "px-1.5 pb-2"),
156
- children: section_0.icons.map(t17 => {
157
- const [icon, glyph] = t17;
516
+ className: clsx("grid grid-cols-[repeat(auto-fill,minmax(28px,1fr))] gap-1", section_0.label !== null && "px-1.5 pb-2"),
517
+ children: section_0.icons.map(t13 => {
518
+ const [icon_0, cellGlyph] = t13;
158
519
  return /*#__PURE__*/_jsx(Tooltip, {
159
- label: icon,
520
+ label: icon_0,
160
521
  name: true,
161
522
  children: /*#__PURE__*/_jsx("button", {
162
523
  type: "button",
163
524
  role: "radio",
164
- "aria-checked": value === icon,
165
- tabIndex: icon === tabStop ? 0 : -1,
525
+ "aria-checked": value === icon_0,
526
+ tabIndex: icon_0 === tabStop ? 0 : -1,
166
527
  disabled: disabled,
167
- className: clsx("flex h-7 items-center justify-center rounded-md hover:bg-surface-hover disabled:opacity-50", value === icon ? "bg-surface-active text-text" : "text-text-muted"),
168
- onFocus: () => setFocused(icon),
169
- onClick: () => onValueChange(icon),
528
+ className: clsx("flex h-7 items-center justify-center rounded-md hover:bg-surface-hover disabled:opacity-50", value === icon_0 ? "bg-surface-active text-text" : "text-text-muted"),
529
+ onFocus: () => setFocused(icon_0),
530
+ onClick: () => onChoose(icon_0),
170
531
  children: /*#__PURE__*/_jsx(Icon, {
171
- icon: glyph,
532
+ icon: cellGlyph,
172
533
  size: 16
173
534
  })
174
535
  })
175
- }, icon);
536
+ }, icon_0);
176
537
  })
177
538
  }, section_0.id);
178
539
  if (section_0.label === null) {
@@ -185,7 +546,7 @@ export function IconPicker(t0) {
185
546
  children: [/*#__PURE__*/_jsxs(SectionLabel, {
186
547
  render: /*#__PURE__*/_jsx("div", {}),
187
548
  "data-icon-heading": "",
188
- className: clsx("flex h-7 items-center gap-2", framed ? "sticky top-0 z-10 bg-surface px-2.5 data-stuck:shadow-[0_1px_0_var(--border)]" : "mt-1"),
549
+ className: "sticky top-0 z-10 flex h-7 items-center gap-2 bg-surface px-2.5 data-stuck:shadow-[0_1px_0_var(--border)] dark:bg-surface-hover",
189
550
  children: [/*#__PURE__*/_jsx("span", {
190
551
  id: headingId,
191
552
  className: "truncate",
@@ -197,168 +558,94 @@ export function IconPicker(t0) {
197
558
  }), cells_0]
198
559
  }, section_0.id);
199
560
  });
200
- let t18;
201
- if ($[17] !== moveFocus || $[18] !== name_0 || $[19] !== t13 || $[20] !== t14 || $[21] !== t15 || $[22] !== t16 || $[23] !== t9) {
202
- t18 = /*#__PURE__*/_jsx("div", {
561
+ let t14;
562
+ if ($[16] !== moveFocus || $[17] !== name || $[18] !== t10 || $[19] !== t11 || $[20] !== t12 || $[21] !== t6 || $[22] !== t9) {
563
+ t14 = /*#__PURE__*/_jsx("div", {
203
564
  ref: area,
204
- id: t9,
205
- role: t10,
206
- "aria-label": name_0,
207
- className: t13,
208
- style: t14,
209
- onScroll: t15,
565
+ id: t6,
566
+ role: t7,
567
+ "aria-label": name,
568
+ className: t9,
569
+ style: t10,
570
+ onScroll: t11,
210
571
  onKeyDown: moveFocus,
211
- children: t16
572
+ children: t12
212
573
  });
213
- $[17] = moveFocus;
214
- $[18] = name_0;
215
- $[19] = t13;
216
- $[20] = t14;
217
- $[21] = t15;
218
- $[22] = t16;
219
- $[23] = t9;
220
- $[24] = t18;
221
- } else {
222
- t18 = $[24];
223
- }
224
- const grid = t18;
225
- let t19;
226
- if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
227
- t19 = /*#__PURE__*/_jsx("div", {});
228
- $[25] = t19;
574
+ $[16] = moveFocus;
575
+ $[17] = name;
576
+ $[18] = t10;
577
+ $[19] = t11;
578
+ $[20] = t12;
579
+ $[21] = t6;
580
+ $[22] = t9;
581
+ $[23] = t14;
229
582
  } else {
230
- t19 = $[25];
583
+ t14 = $[23];
231
584
  }
232
- let t20;
233
- if ($[26] !== disabled || $[27] !== onClear || $[28] !== t || $[29] !== value) {
234
- t20 = onClear && /*#__PURE__*/_jsxs(_Fragment, {
235
- children: [/*#__PURE__*/_jsx("span", {
236
- className: "grow"
237
- }), /*#__PURE__*/_jsx(IconButton, {
238
- icon: Ban,
585
+ let t15;
586
+ if ($[24] !== disabled || $[25] !== onClear || $[26] !== t || $[27] !== value) {
587
+ t15 = onClear && /*#__PURE__*/_jsx("div", {
588
+ className: "flex border-t border-border p-1",
589
+ children: /*#__PURE__*/_jsxs(Button, {
239
590
  size: "sm",
240
- label: t("iconPicker.none"),
241
- className: "-my-1",
242
591
  disabled: disabled || value === null,
243
- onClick: onClear
244
- })]
245
- });
246
- $[26] = disabled;
247
- $[27] = onClear;
248
- $[28] = t;
249
- $[29] = value;
250
- $[30] = t20;
251
- } else {
252
- t20 = $[30];
253
- }
254
- let t21;
255
- if ($[31] !== name_0 || $[32] !== t20) {
256
- t21 = /*#__PURE__*/_jsxs(SectionLabel, {
257
- render: t19,
258
- className: "mb-1.5 flex items-center gap-2",
259
- children: [name_0, t20]
592
+ onClick: onClear,
593
+ children: [/*#__PURE__*/_jsx(Icon, {
594
+ icon: Ban,
595
+ size: 12
596
+ }), t("iconPicker.none")]
597
+ })
260
598
  });
261
- $[31] = name_0;
262
- $[32] = t20;
263
- $[33] = t21;
599
+ $[24] = disabled;
600
+ $[25] = onClear;
601
+ $[26] = t;
602
+ $[27] = value;
603
+ $[28] = t15;
264
604
  } else {
265
- t21 = $[33];
605
+ t15 = $[28];
266
606
  }
267
- let t22;
268
- if ($[34] !== disabled || $[35] !== framed || $[36] !== grid || $[37] !== id || $[38] !== query || $[39] !== search || $[40] !== searchable || $[41] !== t) {
269
- t22 = framed ? /*#__PURE__*/_jsxs("div", {
270
- className: "field h-auto overflow-hidden p-0 has-[input:focus-visible]:outline-2 has-[input:focus-visible]:-outline-offset-1 has-[input:focus-visible]:outline-accent",
271
- children: [searchable && /*#__PURE__*/_jsxs("div", {
272
- className: "flex h-8 items-center gap-2 border-b border-border pr-1 pl-2.5",
273
- children: [/*#__PURE__*/_jsx(Icon, {
274
- icon: Search,
275
- size: 14,
276
- className: "shrink-0 text-text-faint"
277
- }), /*#__PURE__*/_jsx("input", {
278
- ref: input,
279
- type: "text",
280
- value: query,
281
- placeholder: t("iconPicker.search"),
282
- "aria-label": t("iconPicker.search"),
283
- "aria-controls": `${id}-grid`,
284
- spellCheck: false,
285
- autoComplete: "off",
286
- disabled: disabled,
287
- className: "h-full min-w-0 flex-1 bg-transparent outline-none placeholder:text-text-faint",
288
- onChange: event_1 => search(event_1.target.value),
289
- onKeyDown: event_2 => {
290
- if (escapeClearsSearch(event_2.key, query)) {
291
- event_2.stopPropagation();
292
- search("");
293
- }
294
- }
295
- }), query && /*#__PURE__*/_jsx(IconButton, {
296
- icon: X,
297
- size: "sm",
298
- label: t("iconPicker.clear"),
299
- tooltip: false,
300
- onClick: () => {
301
- search("");
302
- input.current?.focus();
303
- }
304
- })]
305
- }), grid]
306
- }) : grid;
307
- $[34] = disabled;
308
- $[35] = framed;
309
- $[36] = grid;
310
- $[37] = id;
311
- $[38] = query;
312
- $[39] = search;
313
- $[40] = searchable;
314
- $[41] = t;
315
- $[42] = t22;
316
- } else {
317
- t22 = $[42];
318
- }
319
- let t23;
320
- if ($[43] !== className || $[44] !== ref || $[45] !== t21 || $[46] !== t22) {
321
- t23 = /*#__PURE__*/_jsxs("div", {
322
- ref: ref,
323
- className: className,
324
- children: [t21, t22]
607
+ let t16;
608
+ if ($[29] !== clearSearchFirst || $[30] !== t14 || $[31] !== t15 || $[32] !== t5) {
609
+ t16 = /*#__PURE__*/_jsxs("div", {
610
+ onKeyDown: clearSearchFirst,
611
+ children: [t5, t14, t15]
325
612
  });
326
- $[43] = className;
327
- $[44] = ref;
328
- $[45] = t21;
329
- $[46] = t22;
330
- $[47] = t23;
613
+ $[29] = clearSearchFirst;
614
+ $[30] = t14;
615
+ $[31] = t15;
616
+ $[32] = t5;
617
+ $[33] = t16;
331
618
  } else {
332
- t23 = $[47];
619
+ t16 = $[33];
333
620
  }
334
- return t23;
621
+ return t16;
335
622
  }
336
- function _temp5(event_0) {
337
- return markStuckHeadings(event_0.currentTarget);
623
+ function _temp6(event_2) {
624
+ return markStuckHeadings(event_2.currentTarget);
338
625
  }
339
- function _temp4(event) {
340
- if (event.metaKey || event.ctrlKey || event.altKey) {
626
+ function _temp5(event_0) {
627
+ if (event_0.metaKey || event_0.ctrlKey || event_0.altKey) {
341
628
  return;
342
629
  }
343
- const cells = [...event.currentTarget.querySelectorAll("[role=\"radio\"]")];
344
- const from = cells.indexOf(event.target);
630
+ const cells = [...event_0.currentTarget.querySelectorAll("[role=\"radio\"]")];
631
+ const from = cells.indexOf(event_0.target);
345
632
  if (from === -1) {
346
633
  return;
347
634
  }
348
- const to = cellForKey(event.key, cells.map(_temp3), from);
635
+ const to = cellForKey(event_0.key, cells.map(_temp4), from);
349
636
  if (to === null) {
350
637
  return;
351
638
  }
352
- event.preventDefault();
639
+ event_0.preventDefault();
353
640
  cells[to]?.focus();
354
641
  }
355
- function _temp3(cell) {
642
+ function _temp4(cell) {
356
643
  return cell.getBoundingClientRect();
357
644
  }
358
- function _temp2(section) {
359
- return section.icons.map(_temp);
645
+ function _temp3(section) {
646
+ return section.icons.map(_temp2);
360
647
  }
361
- function _temp(t0) {
362
- const [name] = t0;
363
- return name;
648
+ function _temp2(t0) {
649
+ const [icon] = t0;
650
+ return icon;
364
651
  }