@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,39 +1,354 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { useState } from 'react';
3
3
  import { Combobox } from '@base-ui/react/combobox';
4
4
  import clsx from 'clsx';
5
5
  import { ChevronDown, Search } from 'lucide-react';
6
6
  import { useTranslation } from 'react-i18next';
7
- import { Icon } from './Icon.js';
8
- import { MENU_LABEL } from './menu/parts.js';
7
+ import { Icon } from "./Icon.js";
8
+ import { MENU_LABEL } from "./menu/parts.js";
9
9
  import { renderPositioner } from './popup-layer.js';
10
- import { RowContent } from './select-row.js';
10
+ import { RowContent } from "./select-row.js";
11
11
  import { isGroup, rowClassName, triggerClassName } from './select-shared.js';
12
12
  /* The `Select` with a search field on top of its options, for lists too long to scan. A combobox of Base UI brings the filtering and the keyboard. */
13
- export function SelectSearch({ value, onValueChange, items, label, placeholder, searchPlaceholder, size = 'md', variant = 'outlined', disabled, align = 'start', truncateValue = true, className, ref }) {
14
- const { t } = useTranslation('ui');
15
- const [query, setQuery] = useState('');
16
- const groups = items.length > 0 && isGroup(items[0]) ? items : null;
17
- const flat = groups ? groups.flatMap((group) => group.items) : items;
18
- const byValue = new Map(flat.map((item) => [item.value, item]));
19
- const selected = value === null ? null : (byValue.get(value) ?? null);
20
- const comboboxItems = groups
21
- ? groups.map((group) => ({ value: group.label, items: group.items.map((item) => item.value) }))
22
- : flat.map((item) => item.value);
23
- const searchLabel = searchPlaceholder ?? t('select.search');
24
- const renderRow = (itemValue) => {
25
- const item = byValue.get(itemValue);
26
- return (_jsx(Combobox.Item, { className: rowClassName(item), value: item.value, disabled: item.disabled, children: _jsx(RowContent, { item: item, picked: item.value === value, text: _jsx("span", { className: "truncate", children: item.label }) }) }, item.value));
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ export function SelectSearch(t0) {
15
+ const $ = _c(67);
16
+ const {
17
+ value,
18
+ onValueChange,
19
+ items,
20
+ label,
21
+ placeholder,
22
+ searchPlaceholder,
23
+ size: t1,
24
+ variant: t2,
25
+ disabled,
26
+ align: t3,
27
+ truncateValue: t4,
28
+ className,
29
+ ref
30
+ } = t0;
31
+ const size = t1 === undefined ? "md" : t1;
32
+ const variant = t2 === undefined ? "outlined" : t2;
33
+ const align = t3 === undefined ? "start" : t3;
34
+ const truncateValue = t4 === undefined ? true : t4;
35
+ const {
36
+ t
37
+ } = useTranslation("ui");
38
+ const [query, setQuery] = useState("");
39
+ const groups = items.length > 0 && isGroup(items[0]) ? items : null;
40
+ let flat;
41
+ let t5;
42
+ if ($[0] !== groups || $[1] !== items) {
43
+ flat = groups ? groups.flatMap(_temp) : items;
44
+ t5 = new Map(flat.map(_temp2));
45
+ $[0] = groups;
46
+ $[1] = items;
47
+ $[2] = flat;
48
+ $[3] = t5;
49
+ } else {
50
+ flat = $[2];
51
+ t5 = $[3];
52
+ }
53
+ const byValue = t5;
54
+ let t6;
55
+ if ($[4] !== byValue || $[5] !== value) {
56
+ t6 = value === null ? null : byValue.get(value) ?? null;
57
+ $[4] = byValue;
58
+ $[5] = value;
59
+ $[6] = t6;
60
+ } else {
61
+ t6 = $[6];
62
+ }
63
+ const selected = t6;
64
+ let t7;
65
+ if ($[7] !== flat || $[8] !== groups) {
66
+ t7 = groups ? groups.map(_temp4) : flat.map(_temp5);
67
+ $[7] = flat;
68
+ $[8] = groups;
69
+ $[9] = t7;
70
+ } else {
71
+ t7 = $[9];
72
+ }
73
+ const comboboxItems = t7;
74
+ let t8;
75
+ if ($[10] !== searchPlaceholder || $[11] !== t) {
76
+ t8 = searchPlaceholder ?? t("select.search");
77
+ $[10] = searchPlaceholder;
78
+ $[11] = t;
79
+ $[12] = t8;
80
+ } else {
81
+ t8 = $[12];
82
+ }
83
+ const searchLabel = t8;
84
+ let t9;
85
+ if ($[13] !== byValue || $[14] !== value) {
86
+ t9 = itemValue => {
87
+ const item_2 = byValue.get(itemValue);
88
+ return /*#__PURE__*/_jsx(Combobox.Item, {
89
+ className: rowClassName(item_2),
90
+ value: item_2.value,
91
+ disabled: item_2.disabled,
92
+ children: /*#__PURE__*/_jsx(RowContent, {
93
+ item: item_2,
94
+ picked: item_2.value === value,
95
+ text: /*#__PURE__*/_jsx("span", {
96
+ className: "truncate",
97
+ children: item_2.label
98
+ })
99
+ })
100
+ }, item_2.value);
101
+ };
102
+ $[13] = byValue;
103
+ $[14] = value;
104
+ $[15] = t9;
105
+ } else {
106
+ t9 = $[15];
107
+ }
108
+ const renderRow = t9;
109
+ let t10;
110
+ if ($[16] !== byValue) {
111
+ t10 = itemValue_0 => byValue.get(itemValue_0)?.label ?? itemValue_0;
112
+ $[16] = byValue;
113
+ $[17] = t10;
114
+ } else {
115
+ t10 = $[17];
116
+ }
117
+ let t11;
118
+ if ($[18] !== onValueChange) {
119
+ t11 = next => {
120
+ if (next !== null) {
121
+ onValueChange(next);
122
+ }
123
+ };
124
+ $[18] = onValueChange;
125
+ $[19] = t11;
126
+ } else {
127
+ t11 = $[19];
128
+ }
129
+ let t12;
130
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
131
+ t12 = open => {
132
+ if (!open) {
133
+ setQuery("");
134
+ }
27
135
  };
28
- return (_jsxs(Combobox.Root, { items: comboboxItems, value: value, disabled: disabled, autoHighlight: true, itemToStringLabel: (itemValue) => byValue.get(itemValue)?.label ?? itemValue, onValueChange: (next) => {
29
- if (next !== null) {
30
- onValueChange(next);
31
- }
32
- }, onInputValueChange: setQuery, onOpenChange: (open) => {
33
- if (!open) {
34
- setQuery('');
35
- }
36
- }, children: [_jsxs(Combobox.Trigger, { ref: ref, "aria-label": label, className: triggerClassName(size, variant, className), children: [selected?.icon, _jsx("span", { className: clsx(truncateValue && 'truncate'), children: selected?.label ?? placeholder ?? t('action.select') }), _jsx("span", { className: "ml-auto flex shrink-0 pl-1", children: _jsx(Icon, { icon: ChevronDown, size: 14 }) })] }), _jsx(Combobox.Portal, { children: _jsx(Combobox.Positioner, { className: "popup-positioner", render: renderPositioner, side: "bottom", align: align, sideOffset: 6, children: _jsxs(Combobox.Popup, { className: "menu-popup flex max-h-96 flex-col", children: [_jsxs("label", { className: "flex shrink-0 items-center gap-2 border-b border-border px-3", children: [_jsx(Icon, { icon: Search, size: 14, className: "shrink-0 text-text-faint" }), _jsx(Combobox.Input, { "aria-label": searchLabel, placeholder: searchLabel, className: "h-9 min-w-0 flex-1 bg-transparent text-sm text-text outline-none placeholder:text-text-faint" })] }), _jsx(Combobox.Empty, { className: "px-3 py-4 text-center text-xs text-text-faint empty:hidden", children: t('select.noMatch', { query }) }), _jsx(Combobox.List, { className: "min-h-0 overflow-auto", children: groups
37
- ? (group) => (_jsxs(Combobox.Group, { items: group.items, children: [_jsx(Combobox.GroupLabel, { className: MENU_LABEL, children: group.value }), _jsx(Combobox.Collection, { children: renderRow })] }, group.value))
38
- : renderRow })] }) }) })] }));
136
+ $[20] = t12;
137
+ } else {
138
+ t12 = $[20];
139
+ }
140
+ let t13;
141
+ if ($[21] !== className || $[22] !== size || $[23] !== variant) {
142
+ t13 = triggerClassName(size, variant, className);
143
+ $[21] = className;
144
+ $[22] = size;
145
+ $[23] = variant;
146
+ $[24] = t13;
147
+ } else {
148
+ t13 = $[24];
149
+ }
150
+ const t14 = selected?.icon;
151
+ const t15 = truncateValue && "truncate";
152
+ let t16;
153
+ if ($[25] !== t15) {
154
+ t16 = clsx(t15);
155
+ $[25] = t15;
156
+ $[26] = t16;
157
+ } else {
158
+ t16 = $[26];
159
+ }
160
+ let t17;
161
+ if ($[27] !== placeholder || $[28] !== selected?.label || $[29] !== t) {
162
+ t17 = selected?.label ?? placeholder ?? t("action.select");
163
+ $[27] = placeholder;
164
+ $[28] = selected?.label;
165
+ $[29] = t;
166
+ $[30] = t17;
167
+ } else {
168
+ t17 = $[30];
169
+ }
170
+ let t18;
171
+ if ($[31] !== t16 || $[32] !== t17) {
172
+ t18 = /*#__PURE__*/_jsx("span", {
173
+ className: t16,
174
+ children: t17
175
+ });
176
+ $[31] = t16;
177
+ $[32] = t17;
178
+ $[33] = t18;
179
+ } else {
180
+ t18 = $[33];
181
+ }
182
+ let t19;
183
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
184
+ t19 = /*#__PURE__*/_jsx("span", {
185
+ className: "ml-auto flex shrink-0 pl-1",
186
+ children: /*#__PURE__*/_jsx(Icon, {
187
+ icon: ChevronDown,
188
+ size: 14
189
+ })
190
+ });
191
+ $[34] = t19;
192
+ } else {
193
+ t19 = $[34];
194
+ }
195
+ let t20;
196
+ if ($[35] !== label || $[36] !== ref || $[37] !== t13 || $[38] !== t14 || $[39] !== t18) {
197
+ t20 = /*#__PURE__*/_jsxs(Combobox.Trigger, {
198
+ ref: ref,
199
+ "aria-label": label,
200
+ className: t13,
201
+ children: [t14, t18, t19]
202
+ });
203
+ $[35] = label;
204
+ $[36] = ref;
205
+ $[37] = t13;
206
+ $[38] = t14;
207
+ $[39] = t18;
208
+ $[40] = t20;
209
+ } else {
210
+ t20 = $[40];
211
+ }
212
+ let t21;
213
+ if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
214
+ t21 = /*#__PURE__*/_jsx(Icon, {
215
+ icon: Search,
216
+ size: 14,
217
+ className: "shrink-0 text-text-faint"
218
+ });
219
+ $[41] = t21;
220
+ } else {
221
+ t21 = $[41];
222
+ }
223
+ let t22;
224
+ if ($[42] !== searchLabel) {
225
+ t22 = /*#__PURE__*/_jsxs("label", {
226
+ className: "flex shrink-0 items-center gap-2 border-b border-border px-3",
227
+ children: [t21, /*#__PURE__*/_jsx(Combobox.Input, {
228
+ "aria-label": searchLabel,
229
+ placeholder: searchLabel,
230
+ className: "h-9 min-w-0 flex-1 bg-transparent text-sm text-text outline-none placeholder:text-text-faint"
231
+ })]
232
+ });
233
+ $[42] = searchLabel;
234
+ $[43] = t22;
235
+ } else {
236
+ t22 = $[43];
237
+ }
238
+ let t23;
239
+ if ($[44] !== query || $[45] !== t) {
240
+ t23 = t("select.noMatch", {
241
+ query
242
+ });
243
+ $[44] = query;
244
+ $[45] = t;
245
+ $[46] = t23;
246
+ } else {
247
+ t23 = $[46];
248
+ }
249
+ let t24;
250
+ if ($[47] !== t23) {
251
+ t24 = /*#__PURE__*/_jsx(Combobox.Empty, {
252
+ className: "px-3 py-4 text-center text-xs text-text-faint empty:hidden",
253
+ children: t23
254
+ });
255
+ $[47] = t23;
256
+ $[48] = t24;
257
+ } else {
258
+ t24 = $[48];
259
+ }
260
+ let t25;
261
+ if ($[49] !== groups || $[50] !== renderRow) {
262
+ t25 = /*#__PURE__*/_jsx(Combobox.List, {
263
+ className: "min-h-0 overflow-auto",
264
+ children: groups ? group_1 => /*#__PURE__*/_jsxs(Combobox.Group, {
265
+ items: group_1.items,
266
+ children: [/*#__PURE__*/_jsx(Combobox.GroupLabel, {
267
+ className: MENU_LABEL,
268
+ children: group_1.value
269
+ }), /*#__PURE__*/_jsx(Combobox.Collection, {
270
+ children: renderRow
271
+ })]
272
+ }, group_1.value) : renderRow
273
+ });
274
+ $[49] = groups;
275
+ $[50] = renderRow;
276
+ $[51] = t25;
277
+ } else {
278
+ t25 = $[51];
279
+ }
280
+ let t26;
281
+ if ($[52] !== t22 || $[53] !== t24 || $[54] !== t25) {
282
+ t26 = /*#__PURE__*/_jsxs(Combobox.Popup, {
283
+ className: "menu-popup flex max-h-96 flex-col",
284
+ children: [t22, t24, t25]
285
+ });
286
+ $[52] = t22;
287
+ $[53] = t24;
288
+ $[54] = t25;
289
+ $[55] = t26;
290
+ } else {
291
+ t26 = $[55];
292
+ }
293
+ let t27;
294
+ if ($[56] !== align || $[57] !== t26) {
295
+ t27 = /*#__PURE__*/_jsx(Combobox.Portal, {
296
+ children: /*#__PURE__*/_jsx(Combobox.Positioner, {
297
+ className: "popup-positioner",
298
+ render: renderPositioner,
299
+ side: "bottom",
300
+ align: align,
301
+ sideOffset: 6,
302
+ children: t26
303
+ })
304
+ });
305
+ $[56] = align;
306
+ $[57] = t26;
307
+ $[58] = t27;
308
+ } else {
309
+ t27 = $[58];
310
+ }
311
+ let t28;
312
+ if ($[59] !== comboboxItems || $[60] !== disabled || $[61] !== t10 || $[62] !== t11 || $[63] !== t20 || $[64] !== t27 || $[65] !== value) {
313
+ t28 = /*#__PURE__*/_jsxs(Combobox.Root, {
314
+ items: comboboxItems,
315
+ value: value,
316
+ disabled: disabled,
317
+ autoHighlight: true,
318
+ itemToStringLabel: t10,
319
+ onValueChange: t11,
320
+ onInputValueChange: setQuery,
321
+ onOpenChange: t12,
322
+ children: [t20, t27]
323
+ });
324
+ $[59] = comboboxItems;
325
+ $[60] = disabled;
326
+ $[61] = t10;
327
+ $[62] = t11;
328
+ $[63] = t20;
329
+ $[64] = t27;
330
+ $[65] = value;
331
+ $[66] = t28;
332
+ } else {
333
+ t28 = $[66];
334
+ }
335
+ return t28;
336
+ }
337
+ function _temp5(item_1) {
338
+ return item_1.value;
339
+ }
340
+ function _temp4(group_0) {
341
+ return {
342
+ value: group_0.label,
343
+ items: group_0.items.map(_temp3)
344
+ };
345
+ }
346
+ function _temp3(item_0) {
347
+ return item_0.value;
348
+ }
349
+ function _temp2(item) {
350
+ return [item.value, item];
39
351
  }
352
+ function _temp(group) {
353
+ return group.items;
354
+ }
package/dist/Separator.js CHANGED
@@ -1,7 +1,38 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import clsx from 'clsx';
3
3
  /* A hairline between two groups of controls in a toolbar-like row. No margin of its own: the row's gap
4
4
  puts 8px on either side, which makes it read as a divider. Between groups of menu rows it is `Menu.Separator`. */
5
- export function Separator({ orientation = 'vertical', className, ref }) {
6
- return _jsx("span", { ref: ref, "aria-hidden": true, className: clsx(orientation === 'vertical' ? 'h-4 w-px' : 'h-px w-full', 'shrink-0 bg-border', className) });
7
- }
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ export function Separator(t0) {
7
+ const $ = _c(6);
8
+ const {
9
+ orientation: t1,
10
+ className,
11
+ ref
12
+ } = t0;
13
+ const orientation = t1 === undefined ? "vertical" : t1;
14
+ const t2 = orientation === "vertical" ? "h-4 w-px" : "h-px w-full";
15
+ let t3;
16
+ if ($[0] !== className || $[1] !== t2) {
17
+ t3 = clsx(t2, "shrink-0 bg-border", className);
18
+ $[0] = className;
19
+ $[1] = t2;
20
+ $[2] = t3;
21
+ } else {
22
+ t3 = $[2];
23
+ }
24
+ let t4;
25
+ if ($[3] !== ref || $[4] !== t3) {
26
+ t4 = /*#__PURE__*/_jsx("span", {
27
+ ref: ref,
28
+ "aria-hidden": true,
29
+ className: t3
30
+ });
31
+ $[3] = ref;
32
+ $[4] = t3;
33
+ $[5] = t4;
34
+ } else {
35
+ t4 = $[5];
36
+ }
37
+ return t4;
38
+ }
@@ -1,36 +1,48 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { useEffect, useLayoutEffect, useRef, useState } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
4
  import { isApplePlatform } from './platform.js';
5
5
  import { formatShortcut } from './shortcut.js';
6
6
  import { ModifierHold, placeHint, shortcutHintTargets } from './shortcut-hints.js';
7
7
  /* Whether a person can see the button now: on screen, not faded out, and not under a dialog or another node. */
8
+ import { jsx as _jsx } from "react/jsx-runtime";
8
9
  const isSeen = (element, rect) => {
9
- if (rect.width === 0 || rect.height === 0 || rect.bottom <= 0 || rect.right <= 0 || rect.top >= window.innerHeight || rect.left >= window.innerWidth) {
10
- return false;
11
- }
12
- if (!element.checkVisibility({ opacityProperty: true, visibilityProperty: true })) {
13
- return false;
14
- }
15
- const hit = document.elementFromPoint((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2);
16
- return hit !== null && element.contains(hit);
10
+ if (rect.width === 0 || rect.height === 0 || rect.bottom <= 0 || rect.right <= 0 || rect.top >= window.innerHeight || rect.left >= window.innerWidth) {
11
+ return false;
12
+ }
13
+ if (!element.checkVisibility({
14
+ opacityProperty: true,
15
+ visibilityProperty: true
16
+ })) {
17
+ return false;
18
+ }
19
+ const hit = document.elementFromPoint((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2);
20
+ return hit !== null && element.contains(hit);
17
21
  };
18
- const measureHints = (apple) => {
19
- const viewport = { width: window.innerWidth, height: window.innerHeight };
20
- const hints = [];
21
- for (const [element, target] of shortcutHintTargets()) {
22
- const rect = element.getBoundingClientRect();
23
- if (!isSeen(element, rect)) {
24
- continue;
25
- }
26
- const placement = placeHint(rect, viewport);
27
- hints.push({
28
- id: target.id,
29
- text: formatShortcut(target.shortcut, apple),
30
- style: { left: placement.left, right: placement.right, top: placement.top, translate: `${placement.translateX} ${placement.translateY}` }
31
- });
22
+ const measureHints = apple => {
23
+ const viewport = {
24
+ width: window.innerWidth,
25
+ height: window.innerHeight
26
+ };
27
+ const hints = [];
28
+ for (const [element, target] of shortcutHintTargets()) {
29
+ const rect = element.getBoundingClientRect();
30
+ if (!isSeen(element, rect)) {
31
+ continue;
32
32
  }
33
- return hints;
33
+ const placement = placeHint(rect, viewport);
34
+ hints.push({
35
+ id: target.id,
36
+ text: formatShortcut(target.shortcut, apple),
37
+ style: {
38
+ left: placement.left,
39
+ right: placement.right,
40
+ top: placement.top,
41
+ translate: `${placement.translateX} ${placement.translateY}`
42
+ }
43
+ });
44
+ }
45
+ return hints;
34
46
  };
35
47
  /*
36
48
  * Every visible button's shortcut, under the button, for as long as the modifier is held on its own.
@@ -38,57 +50,115 @@ const measureHints = (apple) => {
38
50
  * itself still takes the hints down. An embedded page (`<webview>`) has the keyboard to itself and shows none.
39
51
  */
40
52
  export function ShortcutHints() {
41
- const [shown, setShown] = useState(false);
42
- const [hints, setHints] = useState([]);
43
- const holdRef = useRef(null);
44
- useEffect(() => {
45
- const hold = new ModifierHold(isApplePlatform(), setShown);
46
- holdRef.current = hold;
47
- const onKeyDown = (e) => hold.keyDown(e);
48
- const onKeyUp = (e) => hold.keyUp(e);
49
- // A click or a zoom with the modifier down is a gesture, not someone looking for a shortcut.
50
- const cancel = () => hold.cancel();
51
- window.addEventListener('keydown', onKeyDown, true);
52
- window.addEventListener('keyup', onKeyUp, true);
53
- window.addEventListener('pointerdown', cancel, true);
54
- window.addEventListener('wheel', cancel, { capture: true, passive: true });
55
- window.addEventListener('blur', cancel);
56
- return () => {
57
- window.removeEventListener('keydown', onKeyDown, true);
58
- window.removeEventListener('keyup', onKeyUp, true);
59
- window.removeEventListener('pointerdown', cancel, true);
60
- window.removeEventListener('wheel', cancel, true);
61
- window.removeEventListener('blur', cancel);
62
- hold.cancel();
63
- };
64
- }, []);
65
- // Measured before paint and then every frame, so a hint never shows where its button was.
66
- useLayoutEffect(() => {
67
- if (!shown) {
68
- return;
53
+ const $ = _c(10);
54
+ const [shown, setShown] = useState(false);
55
+ let t0;
56
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
57
+ t0 = [];
58
+ $[0] = t0;
59
+ } else {
60
+ t0 = $[0];
61
+ }
62
+ const [hints, setHints] = useState(t0);
63
+ const holdRef = useRef(null);
64
+ let t1;
65
+ let t2;
66
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
67
+ t1 = () => {
68
+ const hold = new ModifierHold(isApplePlatform(), setShown);
69
+ holdRef.current = hold;
70
+ const onKeyDown = e => hold.keyDown(e);
71
+ const onKeyUp = e_0 => hold.keyUp(e_0);
72
+ const cancel = () => hold.cancel();
73
+ window.addEventListener("keydown", onKeyDown, true);
74
+ window.addEventListener("keyup", onKeyUp, true);
75
+ window.addEventListener("pointerdown", cancel, true);
76
+ window.addEventListener("wheel", cancel, {
77
+ capture: true,
78
+ passive: true
79
+ });
80
+ window.addEventListener("blur", cancel);
81
+ return () => {
82
+ window.removeEventListener("keydown", onKeyDown, true);
83
+ window.removeEventListener("keyup", onKeyUp, true);
84
+ window.removeEventListener("pointerdown", cancel, true);
85
+ window.removeEventListener("wheel", cancel, true);
86
+ window.removeEventListener("blur", cancel);
87
+ hold.cancel();
88
+ };
89
+ };
90
+ t2 = [];
91
+ $[1] = t1;
92
+ $[2] = t2;
93
+ } else {
94
+ t1 = $[1];
95
+ t2 = $[2];
96
+ }
97
+ useEffect(t1, t2);
98
+ let t3;
99
+ let t4;
100
+ if ($[3] !== shown) {
101
+ t3 = () => {
102
+ if (!shown) {
103
+ return;
104
+ }
105
+ const apple = isApplePlatform();
106
+ let frame = 0;
107
+ let last = "";
108
+ const measure = () => {
109
+ if (document.activeElement?.tagName === "WEBVIEW") {
110
+ holdRef.current?.cancel();
111
+ return;
69
112
  }
70
- const apple = isApplePlatform();
71
- let frame = 0;
72
- let last = '';
73
- const measure = () => {
74
- // Focus that moved into a page takes the key-up with it, so the embedder never hears the modifier let go.
75
- if (document.activeElement?.tagName === 'WEBVIEW') {
76
- holdRef.current?.cancel();
77
- return;
78
- }
79
- const next = measureHints(apple);
80
- const signature = JSON.stringify(next);
81
- if (signature !== last) {
82
- last = signature;
83
- setHints(next);
84
- }
85
- frame = requestAnimationFrame(measure);
86
- };
87
- measure();
88
- return () => cancelAnimationFrame(frame);
89
- }, [shown]);
90
- if (!shown) {
91
- return null;
92
- }
93
- return createPortal(_jsx("div", { "aria-hidden": true, className: "pointer-events-none fixed inset-0 z-(--z-shortcut-hints)", children: hints.map((hint) => (_jsx("kbd", { className: "absolute rounded-md bg-text px-1.5 font-sans text-xs/tight font-medium whitespace-nowrap text-surface shadow-float", style: hint.style, children: hint.text }, hint.id))) }), document.body);
113
+ const next = measureHints(apple);
114
+ const signature = JSON.stringify(next);
115
+ if (signature !== last) {
116
+ last = signature;
117
+ setHints(next);
118
+ }
119
+ frame = requestAnimationFrame(measure);
120
+ };
121
+ measure();
122
+ return () => cancelAnimationFrame(frame);
123
+ };
124
+ t4 = [shown];
125
+ $[3] = shown;
126
+ $[4] = t3;
127
+ $[5] = t4;
128
+ } else {
129
+ t3 = $[4];
130
+ t4 = $[5];
131
+ }
132
+ useLayoutEffect(t3, t4);
133
+ if (!shown) {
134
+ return null;
135
+ }
136
+ let t5;
137
+ if ($[6] !== hints) {
138
+ t5 = hints.map(_temp);
139
+ $[6] = hints;
140
+ $[7] = t5;
141
+ } else {
142
+ t5 = $[7];
143
+ }
144
+ let t6;
145
+ if ($[8] !== t5) {
146
+ t6 = createPortal(/*#__PURE__*/_jsx("div", {
147
+ "aria-hidden": true,
148
+ className: "pointer-events-none fixed inset-0 z-(--z-shortcut-hints)",
149
+ children: t5
150
+ }), document.body);
151
+ $[8] = t5;
152
+ $[9] = t6;
153
+ } else {
154
+ t6 = $[9];
155
+ }
156
+ return t6;
94
157
  }
158
+ function _temp(hint) {
159
+ return /*#__PURE__*/_jsx("kbd", {
160
+ className: "absolute rounded-md bg-text px-1.5 font-sans text-xs/tight font-medium whitespace-nowrap text-surface shadow-float",
161
+ style: hint.style,
162
+ children: hint.text
163
+ }, hint.id);
164
+ }