@adecore/ui 0.31.12 → 0.33.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
package/dist/Wipe.js CHANGED
@@ -1,8 +1,8 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { useRef } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { ChevronsLeftRight } from 'lucide-react';
5
- import { Icon } from './Icon.js';
5
+ import { Icon } from "./Icon.js";
6
6
  import { formatPercent } from './format/number.js';
7
7
  import { mergeRefs } from './merge-refs.js';
8
8
  import { splitAt, splitForKey } from './wipe-split.js';
@@ -12,36 +12,261 @@ import { splitAt, splitForKey } from './wipe-split.js';
12
12
  * sits in. The handle is a line with a round knob on it, or the plain line, which is dragged anywhere
13
13
  * along its height.
14
14
  */
15
- export function Wipe({ value: split, onValueChange: onSplit, before, after, label, handle = 'knob', className, ref }) {
16
- const frame = useRef(null);
17
- const percent = `${split * 100}%`;
18
- function moveTo(clientX) {
19
- const rect = frame.current?.getBoundingClientRect();
20
- const next = rect ? splitAt(clientX, rect) : null;
21
- if (next !== null) {
22
- onSplit(next);
23
- }
24
- }
25
- function onPointerDown(e) {
26
- e.preventDefault();
27
- e.stopPropagation();
28
- e.currentTarget.setPointerCapture(e.pointerId);
29
- moveTo(e.clientX);
30
- }
31
- function onPointerMove(e) {
32
- if (e.currentTarget.hasPointerCapture(e.pointerId)) {
33
- moveTo(e.clientX);
34
- }
35
- }
36
- function onKeyDown(e) {
37
- const next = splitForKey(split, e.key);
38
- if (next === null) {
39
- return;
40
- }
41
- // Only while the handle has the focus, so a canvas or a timeline around it never hears these keys.
42
- e.preventDefault();
43
- e.stopPropagation();
15
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
+ export function Wipe(t0) {
17
+ const $ = _c(54);
18
+ const {
19
+ value: split,
20
+ onValueChange: onSplit,
21
+ before,
22
+ after,
23
+ label,
24
+ handle: t1,
25
+ className,
26
+ ref
27
+ } = t0;
28
+ const handle = t1 === undefined ? "knob" : t1;
29
+ const frame = useRef(null);
30
+ const percent = `${split * 100}%`;
31
+ let t2;
32
+ if ($[0] !== onSplit) {
33
+ t2 = function moveTo(clientX) {
34
+ const rect = frame.current?.getBoundingClientRect();
35
+ const next = rect ? splitAt(clientX, rect) : null;
36
+ if (next !== null) {
44
37
  onSplit(next);
45
- }
46
- return (_jsxs("div", { ref: mergeRefs(frame, ref), className: clsx('absolute inset-0', className), children: [_jsx("div", { className: "absolute inset-0", style: { clipPath: `inset(0 ${(1 - split) * 100}% 0 0)` }, children: before }), _jsx("div", { className: "absolute inset-0", style: { clipPath: `inset(0 0 0 ${percent})` }, children: after }), _jsxs("div", { role: "slider", tabIndex: 0, "aria-label": label, "aria-orientation": "horizontal", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(split * 100), "aria-valuetext": formatPercent(Math.round(split * 100)), className: clsx('group absolute inset-y-0 z-10 -ml-3.5 w-7 cursor-ew-resize touch-none', handle === 'line' && 'outline-none'), style: { left: percent }, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onKeyDown: onKeyDown, children: [_jsx("span", { className: clsx('absolute inset-y-0 left-3.25 w-0.5 bg-media-handle shadow-media-handle-edge', handle === 'line' && 'group-focus-visible:bg-accent') }), handle === 'knob' && (_jsx("span", { className: "absolute top-1/2 left-3.5 grid h-7 w-7 -translate-1/2 place-items-center rounded-full bg-media-handle text-media-handle-text shadow-media-handle", children: _jsx(Icon, { icon: ChevronsLeftRight, size: 14 }) }))] })] }));
47
- }
38
+ }
39
+ };
40
+ $[0] = onSplit;
41
+ $[1] = t2;
42
+ } else {
43
+ t2 = $[1];
44
+ }
45
+ const moveTo = t2;
46
+ let t3;
47
+ if ($[2] !== moveTo) {
48
+ t3 = function onPointerDown(e) {
49
+ e.preventDefault();
50
+ e.stopPropagation();
51
+ e.currentTarget.setPointerCapture(e.pointerId);
52
+ moveTo(e.clientX);
53
+ };
54
+ $[2] = moveTo;
55
+ $[3] = t3;
56
+ } else {
57
+ t3 = $[3];
58
+ }
59
+ const onPointerDown = t3;
60
+ let t4;
61
+ if ($[4] !== moveTo) {
62
+ t4 = function onPointerMove(e_0) {
63
+ if (e_0.currentTarget.hasPointerCapture(e_0.pointerId)) {
64
+ moveTo(e_0.clientX);
65
+ }
66
+ };
67
+ $[4] = moveTo;
68
+ $[5] = t4;
69
+ } else {
70
+ t4 = $[5];
71
+ }
72
+ const onPointerMove = t4;
73
+ let t5;
74
+ if ($[6] !== onSplit || $[7] !== split) {
75
+ t5 = function onKeyDown(e_1) {
76
+ const next_0 = splitForKey(split, e_1.key);
77
+ if (next_0 === null) {
78
+ return;
79
+ }
80
+ e_1.preventDefault();
81
+ e_1.stopPropagation();
82
+ onSplit(next_0);
83
+ };
84
+ $[6] = onSplit;
85
+ $[7] = split;
86
+ $[8] = t5;
87
+ } else {
88
+ t5 = $[8];
89
+ }
90
+ const onKeyDown = t5;
91
+ let t6;
92
+ if ($[9] !== ref) {
93
+ t6 = mergeRefs(frame, ref);
94
+ $[9] = ref;
95
+ $[10] = t6;
96
+ } else {
97
+ t6 = $[10];
98
+ }
99
+ let t7;
100
+ if ($[11] !== className) {
101
+ t7 = clsx("absolute inset-0", className);
102
+ $[11] = className;
103
+ $[12] = t7;
104
+ } else {
105
+ t7 = $[12];
106
+ }
107
+ const t8 = `inset(0 ${(1 - split) * 100}% 0 0)`;
108
+ let t9;
109
+ if ($[13] !== t8) {
110
+ t9 = {
111
+ clipPath: t8
112
+ };
113
+ $[13] = t8;
114
+ $[14] = t9;
115
+ } else {
116
+ t9 = $[14];
117
+ }
118
+ let t10;
119
+ if ($[15] !== before || $[16] !== t9) {
120
+ t10 = /*#__PURE__*/_jsx("div", {
121
+ className: "absolute inset-0",
122
+ style: t9,
123
+ children: before
124
+ });
125
+ $[15] = before;
126
+ $[16] = t9;
127
+ $[17] = t10;
128
+ } else {
129
+ t10 = $[17];
130
+ }
131
+ const t11 = `inset(0 0 0 ${percent})`;
132
+ let t12;
133
+ if ($[18] !== t11) {
134
+ t12 = {
135
+ clipPath: t11
136
+ };
137
+ $[18] = t11;
138
+ $[19] = t12;
139
+ } else {
140
+ t12 = $[19];
141
+ }
142
+ let t13;
143
+ if ($[20] !== after || $[21] !== t12) {
144
+ t13 = /*#__PURE__*/_jsx("div", {
145
+ className: "absolute inset-0",
146
+ style: t12,
147
+ children: after
148
+ });
149
+ $[20] = after;
150
+ $[21] = t12;
151
+ $[22] = t13;
152
+ } else {
153
+ t13 = $[22];
154
+ }
155
+ let t14;
156
+ if ($[23] !== split) {
157
+ t14 = Math.round(split * 100);
158
+ $[23] = split;
159
+ $[24] = t14;
160
+ } else {
161
+ t14 = $[24];
162
+ }
163
+ let t15;
164
+ if ($[25] !== split) {
165
+ t15 = formatPercent(Math.round(split * 100));
166
+ $[25] = split;
167
+ $[26] = t15;
168
+ } else {
169
+ t15 = $[26];
170
+ }
171
+ const t16 = handle === "line" && "outline-none";
172
+ let t17;
173
+ if ($[27] !== t16) {
174
+ t17 = clsx("group absolute inset-y-0 z-10 -ml-3.5 w-7 cursor-ew-resize touch-none", t16);
175
+ $[27] = t16;
176
+ $[28] = t17;
177
+ } else {
178
+ t17 = $[28];
179
+ }
180
+ let t18;
181
+ if ($[29] !== percent) {
182
+ t18 = {
183
+ left: percent
184
+ };
185
+ $[29] = percent;
186
+ $[30] = t18;
187
+ } else {
188
+ t18 = $[30];
189
+ }
190
+ const t19 = handle === "line" && "group-focus-visible:bg-accent";
191
+ let t20;
192
+ if ($[31] !== t19) {
193
+ t20 = clsx("absolute inset-y-0 left-3.25 w-0.5 bg-media-handle shadow-media-handle-edge", t19);
194
+ $[31] = t19;
195
+ $[32] = t20;
196
+ } else {
197
+ t20 = $[32];
198
+ }
199
+ let t21;
200
+ if ($[33] !== t20) {
201
+ t21 = /*#__PURE__*/_jsx("span", {
202
+ className: t20
203
+ });
204
+ $[33] = t20;
205
+ $[34] = t21;
206
+ } else {
207
+ t21 = $[34];
208
+ }
209
+ let t22;
210
+ if ($[35] !== handle) {
211
+ t22 = handle === "knob" && /*#__PURE__*/_jsx("span", {
212
+ className: "absolute top-1/2 left-3.5 grid h-7 w-7 -translate-1/2 place-items-center rounded-full bg-media-handle text-media-handle-text shadow-media-handle",
213
+ children: /*#__PURE__*/_jsx(Icon, {
214
+ icon: ChevronsLeftRight,
215
+ size: 14
216
+ })
217
+ });
218
+ $[35] = handle;
219
+ $[36] = t22;
220
+ } else {
221
+ t22 = $[36];
222
+ }
223
+ let t23;
224
+ if ($[37] !== label || $[38] !== onKeyDown || $[39] !== onPointerDown || $[40] !== onPointerMove || $[41] !== t14 || $[42] !== t15 || $[43] !== t17 || $[44] !== t18 || $[45] !== t21 || $[46] !== t22) {
225
+ t23 = /*#__PURE__*/_jsxs("div", {
226
+ role: "slider",
227
+ tabIndex: 0,
228
+ "aria-label": label,
229
+ "aria-orientation": "horizontal",
230
+ "aria-valuemin": 0,
231
+ "aria-valuemax": 100,
232
+ "aria-valuenow": t14,
233
+ "aria-valuetext": t15,
234
+ className: t17,
235
+ style: t18,
236
+ onPointerDown: onPointerDown,
237
+ onPointerMove: onPointerMove,
238
+ onKeyDown: onKeyDown,
239
+ children: [t21, t22]
240
+ });
241
+ $[37] = label;
242
+ $[38] = onKeyDown;
243
+ $[39] = onPointerDown;
244
+ $[40] = onPointerMove;
245
+ $[41] = t14;
246
+ $[42] = t15;
247
+ $[43] = t17;
248
+ $[44] = t18;
249
+ $[45] = t21;
250
+ $[46] = t22;
251
+ $[47] = t23;
252
+ } else {
253
+ t23 = $[47];
254
+ }
255
+ let t24;
256
+ if ($[48] !== t10 || $[49] !== t13 || $[50] !== t23 || $[51] !== t6 || $[52] !== t7) {
257
+ t24 = /*#__PURE__*/_jsxs("div", {
258
+ ref: t6,
259
+ className: t7,
260
+ children: [t10, t13, t23]
261
+ });
262
+ $[48] = t10;
263
+ $[49] = t13;
264
+ $[50] = t23;
265
+ $[51] = t6;
266
+ $[52] = t7;
267
+ $[53] = t24;
268
+ } else {
269
+ t24 = $[53];
270
+ }
271
+ return t24;
272
+ }
@@ -1,19 +1,361 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Maximize, Minus, Plus, Scan } from 'lucide-react';
3
3
  import { useTranslation } from 'react-i18next';
4
- import { ButtonGroup } from './ButtonGroup.js';
5
- import { Icon } from './Icon.js';
6
- import { IconButton } from './IconButton.js';
7
- import { Kbd } from './Kbd.js';
8
- import { MenuItem, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuRoot, MenuSeparator, MenuTrigger } from './menu/parts.js';
9
- import { Tooltip } from './Tooltip.js';
4
+ import { ButtonGroup } from "./ButtonGroup.js";
5
+ import { Icon } from "./Icon.js";
6
+ import { IconButton } from "./IconButton.js";
7
+ import { Kbd } from "./Kbd.js";
8
+ import { MenuItem, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuRoot, MenuSeparator, MenuTrigger } from "./menu/parts.js";
9
+ import { Tooltip } from "./Tooltip.js";
10
10
  import { activeZoomPreset, steppedZoom, ZOOM_PRESETS } from './zoom.js';
11
- function MenuIcon({ icon }) {
12
- return (_jsx("span", { className: "grid h-4 w-4 place-items-center", children: _jsx(Icon, { icon: icon, size: 14 }) }));
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ function MenuIcon(t0) {
13
+ const $ = _c(2);
14
+ const {
15
+ icon
16
+ } = t0;
17
+ let t1;
18
+ if ($[0] !== icon) {
19
+ t1 = /*#__PURE__*/_jsx("span", {
20
+ className: "grid h-4 w-4 place-items-center",
21
+ children: /*#__PURE__*/_jsx(Icon, {
22
+ icon: icon,
23
+ size: 14
24
+ })
25
+ });
26
+ $[0] = icon;
27
+ $[1] = t1;
28
+ } else {
29
+ t1 = $[1];
30
+ }
31
+ return t1;
13
32
  }
14
33
  /* The zoom group of a dock: out, the readout with its presets, in, and fit everything. */
15
- export function ZoomControls({ zoom, onZoomChange, onFitAll, presets = ZOOM_PRESETS, labels = {}, shortcuts = {}, selection, className, ref }) {
16
- const { t } = useTranslation('ui');
17
- const preset = activeZoomPreset(zoom, presets);
18
- return (_jsxs(ButtonGroup, { ref: ref, className: className, children: [_jsx(IconButton, { icon: Minus, label: labels.out ?? t('zoom.out'), onClick: () => onZoomChange(steppedZoom(zoom, -10)) }), _jsxs(MenuRoot, { children: [_jsx(Tooltip, { label: labels.presets ?? t('zoom.presets'), children: _jsxs(MenuTrigger, { className: "h-8 min-w-14 rounded-lg px-1 text-xs text-text-muted tabular-nums hover:bg-surface-hover hover:text-text data-[popup-open]:bg-surface-active data-[popup-open]:text-text", children: [Math.round(zoom * 100), "%"] }) }), _jsxs(MenuPopup, { side: "top", sideOffset: 10, align: "center", className: "min-w-44", children: [_jsx(MenuRadioGroup, { value: preset, onValueChange: (value) => onZoomChange(value / 100), children: presets.map((percent) => (_jsxs(MenuRadioItem, { value: percent, children: [_jsxs("span", { className: "tabular-nums", children: [percent, "%"] }), percent === 100 && shortcuts.zoomReset && _jsx(Kbd, { shortcut: shortcuts.zoomReset })] }, percent))) }), _jsx(MenuSeparator, {}), _jsxs(MenuItem, { onClick: onFitAll, children: [_jsx(MenuIcon, { icon: Maximize }), labels.fit ?? t('zoom.fit'), " ", shortcuts.fitAll && _jsx(Kbd, { shortcut: shortcuts.fitAll })] }), selection && (_jsxs(MenuItem, { disabled: !selection.enabled, onClick: selection.onZoom, children: [_jsx(MenuIcon, { icon: Scan }), selection.label, " ", selection.shortcut && _jsx(Kbd, { shortcut: selection.shortcut })] }))] })] }), _jsx(IconButton, { icon: Plus, label: labels.in ?? t('zoom.in'), onClick: () => onZoomChange(steppedZoom(zoom, 10)) }), _jsx(IconButton, { icon: Maximize, label: labels.fitEverything ?? t('zoom.fitEverything'), kbd: shortcuts.fitAll, onClick: onFitAll })] }));
19
- }
34
+ export function ZoomControls(t0) {
35
+ const $ = _c(80);
36
+ const {
37
+ zoom,
38
+ onZoomChange,
39
+ onFitAll,
40
+ presets: t1,
41
+ labels: t2,
42
+ shortcuts: t3,
43
+ selection,
44
+ className,
45
+ ref
46
+ } = t0;
47
+ const presets = t1 === undefined ? ZOOM_PRESETS : t1;
48
+ let t4;
49
+ if ($[0] !== t2) {
50
+ t4 = t2 === undefined ? {} : t2;
51
+ $[0] = t2;
52
+ $[1] = t4;
53
+ } else {
54
+ t4 = $[1];
55
+ }
56
+ const labels = t4;
57
+ let t5;
58
+ if ($[2] !== t3) {
59
+ t5 = t3 === undefined ? {} : t3;
60
+ $[2] = t3;
61
+ $[3] = t5;
62
+ } else {
63
+ t5 = $[3];
64
+ }
65
+ const shortcuts = t5;
66
+ const {
67
+ t
68
+ } = useTranslation("ui");
69
+ let t6;
70
+ if ($[4] !== presets || $[5] !== zoom) {
71
+ t6 = activeZoomPreset(zoom, presets);
72
+ $[4] = presets;
73
+ $[5] = zoom;
74
+ $[6] = t6;
75
+ } else {
76
+ t6 = $[6];
77
+ }
78
+ const preset = t6;
79
+ let t7;
80
+ if ($[7] !== labels.out || $[8] !== t) {
81
+ t7 = labels.out ?? t("zoom.out");
82
+ $[7] = labels.out;
83
+ $[8] = t;
84
+ $[9] = t7;
85
+ } else {
86
+ t7 = $[9];
87
+ }
88
+ let t8;
89
+ if ($[10] !== onZoomChange || $[11] !== zoom) {
90
+ t8 = () => onZoomChange(steppedZoom(zoom, -10));
91
+ $[10] = onZoomChange;
92
+ $[11] = zoom;
93
+ $[12] = t8;
94
+ } else {
95
+ t8 = $[12];
96
+ }
97
+ let t9;
98
+ if ($[13] !== t7 || $[14] !== t8) {
99
+ t9 = /*#__PURE__*/_jsx(IconButton, {
100
+ icon: Minus,
101
+ label: t7,
102
+ onClick: t8
103
+ });
104
+ $[13] = t7;
105
+ $[14] = t8;
106
+ $[15] = t9;
107
+ } else {
108
+ t9 = $[15];
109
+ }
110
+ let t10;
111
+ if ($[16] !== labels.presets || $[17] !== t) {
112
+ t10 = labels.presets ?? t("zoom.presets");
113
+ $[16] = labels.presets;
114
+ $[17] = t;
115
+ $[18] = t10;
116
+ } else {
117
+ t10 = $[18];
118
+ }
119
+ let t11;
120
+ if ($[19] !== zoom) {
121
+ t11 = Math.round(zoom * 100);
122
+ $[19] = zoom;
123
+ $[20] = t11;
124
+ } else {
125
+ t11 = $[20];
126
+ }
127
+ let t12;
128
+ if ($[21] !== t11) {
129
+ t12 = /*#__PURE__*/_jsxs(MenuTrigger, {
130
+ className: "h-8 min-w-14 rounded-lg px-1 text-xs text-text-muted tabular-nums hover:bg-surface-hover hover:text-text data-[popup-open]:bg-surface-active data-[popup-open]:text-text",
131
+ children: [t11, "%"]
132
+ });
133
+ $[21] = t11;
134
+ $[22] = t12;
135
+ } else {
136
+ t12 = $[22];
137
+ }
138
+ let t13;
139
+ if ($[23] !== t10 || $[24] !== t12) {
140
+ t13 = /*#__PURE__*/_jsx(Tooltip, {
141
+ label: t10,
142
+ children: t12
143
+ });
144
+ $[23] = t10;
145
+ $[24] = t12;
146
+ $[25] = t13;
147
+ } else {
148
+ t13 = $[25];
149
+ }
150
+ let t14;
151
+ if ($[26] !== onZoomChange) {
152
+ t14 = value => onZoomChange(value / 100);
153
+ $[26] = onZoomChange;
154
+ $[27] = t14;
155
+ } else {
156
+ t14 = $[27];
157
+ }
158
+ let t15;
159
+ if ($[28] !== presets || $[29] !== shortcuts.zoomReset) {
160
+ let t16;
161
+ if ($[31] !== shortcuts.zoomReset) {
162
+ t16 = percent => /*#__PURE__*/_jsxs(MenuRadioItem, {
163
+ value: percent,
164
+ children: [/*#__PURE__*/_jsxs("span", {
165
+ className: "tabular-nums",
166
+ children: [percent, "%"]
167
+ }), percent === 100 && shortcuts.zoomReset && /*#__PURE__*/_jsx(Kbd, {
168
+ shortcut: shortcuts.zoomReset
169
+ })]
170
+ }, percent);
171
+ $[31] = shortcuts.zoomReset;
172
+ $[32] = t16;
173
+ } else {
174
+ t16 = $[32];
175
+ }
176
+ t15 = presets.map(t16);
177
+ $[28] = presets;
178
+ $[29] = shortcuts.zoomReset;
179
+ $[30] = t15;
180
+ } else {
181
+ t15 = $[30];
182
+ }
183
+ let t16;
184
+ if ($[33] !== preset || $[34] !== t14 || $[35] !== t15) {
185
+ t16 = /*#__PURE__*/_jsx(MenuRadioGroup, {
186
+ value: preset,
187
+ onValueChange: t14,
188
+ children: t15
189
+ });
190
+ $[33] = preset;
191
+ $[34] = t14;
192
+ $[35] = t15;
193
+ $[36] = t16;
194
+ } else {
195
+ t16 = $[36];
196
+ }
197
+ let t17;
198
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
199
+ t17 = /*#__PURE__*/_jsx(MenuSeparator, {});
200
+ $[37] = t17;
201
+ } else {
202
+ t17 = $[37];
203
+ }
204
+ let t18;
205
+ if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
206
+ t18 = /*#__PURE__*/_jsx(MenuIcon, {
207
+ icon: Maximize
208
+ });
209
+ $[38] = t18;
210
+ } else {
211
+ t18 = $[38];
212
+ }
213
+ let t19;
214
+ if ($[39] !== labels.fit || $[40] !== t) {
215
+ t19 = labels.fit ?? t("zoom.fit");
216
+ $[39] = labels.fit;
217
+ $[40] = t;
218
+ $[41] = t19;
219
+ } else {
220
+ t19 = $[41];
221
+ }
222
+ let t20;
223
+ if ($[42] !== shortcuts.fitAll) {
224
+ t20 = shortcuts.fitAll && /*#__PURE__*/_jsx(Kbd, {
225
+ shortcut: shortcuts.fitAll
226
+ });
227
+ $[42] = shortcuts.fitAll;
228
+ $[43] = t20;
229
+ } else {
230
+ t20 = $[43];
231
+ }
232
+ let t21;
233
+ if ($[44] !== onFitAll || $[45] !== t19 || $[46] !== t20) {
234
+ t21 = /*#__PURE__*/_jsxs(MenuItem, {
235
+ onClick: onFitAll,
236
+ children: [t18, t19, " ", t20]
237
+ });
238
+ $[44] = onFitAll;
239
+ $[45] = t19;
240
+ $[46] = t20;
241
+ $[47] = t21;
242
+ } else {
243
+ t21 = $[47];
244
+ }
245
+ let t22;
246
+ if ($[48] !== selection) {
247
+ t22 = selection && /*#__PURE__*/_jsxs(MenuItem, {
248
+ disabled: !selection.enabled,
249
+ onClick: selection.onZoom,
250
+ children: [/*#__PURE__*/_jsx(MenuIcon, {
251
+ icon: Scan
252
+ }), selection.label, " ", selection.shortcut && /*#__PURE__*/_jsx(Kbd, {
253
+ shortcut: selection.shortcut
254
+ })]
255
+ });
256
+ $[48] = selection;
257
+ $[49] = t22;
258
+ } else {
259
+ t22 = $[49];
260
+ }
261
+ let t23;
262
+ if ($[50] !== t16 || $[51] !== t21 || $[52] !== t22) {
263
+ t23 = /*#__PURE__*/_jsxs(MenuPopup, {
264
+ side: "top",
265
+ sideOffset: 10,
266
+ align: "center",
267
+ className: "min-w-44",
268
+ children: [t16, t17, t21, t22]
269
+ });
270
+ $[50] = t16;
271
+ $[51] = t21;
272
+ $[52] = t22;
273
+ $[53] = t23;
274
+ } else {
275
+ t23 = $[53];
276
+ }
277
+ let t24;
278
+ if ($[54] !== t13 || $[55] !== t23) {
279
+ t24 = /*#__PURE__*/_jsxs(MenuRoot, {
280
+ children: [t13, t23]
281
+ });
282
+ $[54] = t13;
283
+ $[55] = t23;
284
+ $[56] = t24;
285
+ } else {
286
+ t24 = $[56];
287
+ }
288
+ let t25;
289
+ if ($[57] !== labels.in || $[58] !== t) {
290
+ t25 = labels.in ?? t("zoom.in");
291
+ $[57] = labels.in;
292
+ $[58] = t;
293
+ $[59] = t25;
294
+ } else {
295
+ t25 = $[59];
296
+ }
297
+ let t26;
298
+ if ($[60] !== onZoomChange || $[61] !== zoom) {
299
+ t26 = () => onZoomChange(steppedZoom(zoom, 10));
300
+ $[60] = onZoomChange;
301
+ $[61] = zoom;
302
+ $[62] = t26;
303
+ } else {
304
+ t26 = $[62];
305
+ }
306
+ let t27;
307
+ if ($[63] !== t25 || $[64] !== t26) {
308
+ t27 = /*#__PURE__*/_jsx(IconButton, {
309
+ icon: Plus,
310
+ label: t25,
311
+ onClick: t26
312
+ });
313
+ $[63] = t25;
314
+ $[64] = t26;
315
+ $[65] = t27;
316
+ } else {
317
+ t27 = $[65];
318
+ }
319
+ let t28;
320
+ if ($[66] !== labels.fitEverything || $[67] !== t) {
321
+ t28 = labels.fitEverything ?? t("zoom.fitEverything");
322
+ $[66] = labels.fitEverything;
323
+ $[67] = t;
324
+ $[68] = t28;
325
+ } else {
326
+ t28 = $[68];
327
+ }
328
+ let t29;
329
+ if ($[69] !== onFitAll || $[70] !== shortcuts.fitAll || $[71] !== t28) {
330
+ t29 = /*#__PURE__*/_jsx(IconButton, {
331
+ icon: Maximize,
332
+ label: t28,
333
+ kbd: shortcuts.fitAll,
334
+ onClick: onFitAll
335
+ });
336
+ $[69] = onFitAll;
337
+ $[70] = shortcuts.fitAll;
338
+ $[71] = t28;
339
+ $[72] = t29;
340
+ } else {
341
+ t29 = $[72];
342
+ }
343
+ let t30;
344
+ if ($[73] !== className || $[74] !== ref || $[75] !== t24 || $[76] !== t27 || $[77] !== t29 || $[78] !== t9) {
345
+ t30 = /*#__PURE__*/_jsxs(ButtonGroup, {
346
+ ref: ref,
347
+ className: className,
348
+ children: [t9, t24, t27, t29]
349
+ });
350
+ $[73] = className;
351
+ $[74] = ref;
352
+ $[75] = t24;
353
+ $[76] = t27;
354
+ $[77] = t29;
355
+ $[78] = t9;
356
+ $[79] = t30;
357
+ } else {
358
+ t30 = $[79];
359
+ }
360
+ return t30;
361
+ }
@@ -1,3 +1,3 @@
1
1
  import clsx from 'clsx';
2
2
  /* Puts the library's own classes before a caller's, whichever form the caller's takes. */
3
- export const withClass = (own, className) => typeof className === 'function' ? (state) => clsx(own, className(state)) : clsx(own, className);
3
+ export const withClass = (own, className) => typeof className === 'function' ? state => clsx(own, className(state)) : clsx(own, className);