@adecore/ui 0.31.12 → 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,3 +1,4 @@
1
+ import { c as _c } from "react/compiler-runtime";
1
2
  import clsx from 'clsx';
2
3
  import { useRender } from '@base-ui/react/use-render';
3
4
  /* A label takes the line height of the row it sits in, which is why the size carries `/[inherit]`. */
@@ -6,11 +7,64 @@ const SECTION_LABEL = 'text-xs/[inherit] font-medium text-text-faint';
6
7
  * The small label above a group of rows outside a popup: a sidebar's groups, a palette's sections,
7
8
  * the name of a field. Always sentence case. A `<span>` unless `render` makes it a heading or a label.
8
9
  */
9
- export function SectionLabel({ render, className, ref, ...props }) {
10
- return useRender({
11
- render,
12
- ref,
13
- defaultTagName: 'span',
14
- props: { ...props, className: clsx(SECTION_LABEL, className) }
15
- });
16
- }
10
+ export function SectionLabel(t0) {
11
+ const $ = _c(14);
12
+ let className;
13
+ let props;
14
+ let ref;
15
+ let render;
16
+ if ($[0] !== t0) {
17
+ ({
18
+ render,
19
+ className,
20
+ ref,
21
+ ...props
22
+ } = t0);
23
+ $[0] = t0;
24
+ $[1] = className;
25
+ $[2] = props;
26
+ $[3] = ref;
27
+ $[4] = render;
28
+ } else {
29
+ className = $[1];
30
+ props = $[2];
31
+ ref = $[3];
32
+ render = $[4];
33
+ }
34
+ let t1;
35
+ if ($[5] !== className) {
36
+ t1 = clsx(SECTION_LABEL, className);
37
+ $[5] = className;
38
+ $[6] = t1;
39
+ } else {
40
+ t1 = $[6];
41
+ }
42
+ let t2;
43
+ if ($[7] !== props || $[8] !== t1) {
44
+ t2 = {
45
+ ...props,
46
+ className: t1
47
+ };
48
+ $[7] = props;
49
+ $[8] = t1;
50
+ $[9] = t2;
51
+ } else {
52
+ t2 = $[9];
53
+ }
54
+ let t3;
55
+ if ($[10] !== ref || $[11] !== render || $[12] !== t2) {
56
+ t3 = {
57
+ render,
58
+ ref,
59
+ defaultTagName: "span",
60
+ props: t2
61
+ };
62
+ $[10] = ref;
63
+ $[11] = render;
64
+ $[12] = t2;
65
+ $[13] = t3;
66
+ } else {
67
+ t3 = $[13];
68
+ }
69
+ return useRender(t3);
70
+ }
@@ -1,45 +1,206 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useMemo, useRef, useState } from 'react';
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { useEffect, useRef, useState } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { mergeRefs } from './merge-refs.js';
5
- import { Tooltip } from './Tooltip.js';
5
+ import { Tooltip } from "./Tooltip.js";
6
6
  import { useMeasuredWidth } from './useMeasuredWidth.js';
7
7
  /* A whole split into parts, each as wide as it lasts, so they compare at a glance. A part starts exactly at its
8
8
  place; the gap between two parts that touch comes out of the one before. */
9
- export function SegmentBar({ parts, range, size = 'md', onSelect, label, className, ref }) {
10
- const [measure, width] = useMeasuredWidth();
11
- const rootRef = useMemo(() => mergeRefs(ref, measure), [ref, measure]);
12
- const labels = useRef([]);
13
- const [cut, setCut] = useState([]);
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ export function SegmentBar(t0) {
11
+ const $ = _c(38);
12
+ const {
13
+ parts,
14
+ range,
15
+ size: t1,
16
+ onSelect,
17
+ label,
18
+ className,
19
+ ref
20
+ } = t0;
21
+ const size = t1 === undefined ? "md" : t1;
22
+ const [measure, width] = useMeasuredWidth();
23
+ let t2;
24
+ if ($[0] !== measure || $[1] !== ref) {
25
+ t2 = mergeRefs(ref, measure);
26
+ $[0] = measure;
27
+ $[1] = ref;
28
+ $[2] = t2;
29
+ } else {
30
+ t2 = $[2];
31
+ }
32
+ const rootRef = t2;
33
+ let t3;
34
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
35
+ t3 = [];
36
+ $[3] = t3;
37
+ } else {
38
+ t3 = $[3];
39
+ }
40
+ const labels = useRef(t3);
41
+ let t4;
42
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
43
+ t4 = [];
44
+ $[4] = t4;
45
+ } else {
46
+ t4 = $[4];
47
+ }
48
+ const [cut, setCut] = useState(t4);
49
+ let from_0;
50
+ let span;
51
+ let t5;
52
+ let to;
53
+ if ($[5] !== parts || $[6] !== range) {
14
54
  let end = 0;
15
55
  const placed = parts.map((part, index) => {
16
- const from = part.start ?? end;
17
- end = from + Math.max(0, part.value);
18
- return { part, index, from, to: end };
56
+ const from = part.start ?? end;
57
+ end = from + Math.max(0, part.value);
58
+ return {
59
+ part,
60
+ index,
61
+ from,
62
+ to: end
63
+ };
64
+ });
65
+ [from_0, to] = range ?? [0, end];
66
+ span = to - from_0;
67
+ t5 = span > 0 ? placed.filter(placement => placement.to > from_0 && placement.from < to) : [];
68
+ $[5] = parts;
69
+ $[6] = range;
70
+ $[7] = from_0;
71
+ $[8] = span;
72
+ $[9] = t5;
73
+ $[10] = to;
74
+ } else {
75
+ from_0 = $[7];
76
+ span = $[8];
77
+ t5 = $[9];
78
+ to = $[10];
79
+ }
80
+ const visible = t5;
81
+ const hidden = onSelect === undefined && !parts.some(_temp);
82
+ let t6;
83
+ if ($[11] !== visible.length) {
84
+ t6 = () => {
85
+ const next = labels.current.slice(0, visible.length).map(_temp2);
86
+ setCut(current => current.length === next.length && current.every((value, i) => value === next[i]) ? current : next);
87
+ };
88
+ $[11] = visible.length;
89
+ $[12] = t6;
90
+ } else {
91
+ t6 = $[12];
92
+ }
93
+ let t7;
94
+ if ($[13] !== from_0 || $[14] !== parts || $[15] !== size || $[16] !== to || $[17] !== visible.length || $[18] !== width) {
95
+ t7 = [width, parts, from_0, to, size, visible.length];
96
+ $[13] = from_0;
97
+ $[14] = parts;
98
+ $[15] = size;
99
+ $[16] = to;
100
+ $[17] = visible.length;
101
+ $[18] = width;
102
+ $[19] = t7;
103
+ } else {
104
+ t7 = $[19];
105
+ }
106
+ useEffect(t6, t7);
107
+ const t8 = hidden ? undefined : label;
108
+ const t9 = hidden ? true : undefined;
109
+ const t10 = size === "sm" ? "h-1.5" : "h-7";
110
+ let t11;
111
+ if ($[20] !== className || $[21] !== t10) {
112
+ t11 = clsx("relative min-w-0", t10, className);
113
+ $[20] = className;
114
+ $[21] = t10;
115
+ $[22] = t11;
116
+ } else {
117
+ t11 = $[22];
118
+ }
119
+ let t12;
120
+ if ($[23] !== cut || $[24] !== from_0 || $[25] !== onSelect || $[26] !== size || $[27] !== span || $[28] !== to || $[29] !== visible || $[30] !== width) {
121
+ t12 = visible.map((t13, i_0) => {
122
+ const {
123
+ part: part_1,
124
+ index: index_0,
125
+ from: partFrom,
126
+ to: partTo
127
+ } = t13;
128
+ const left = (Math.max(partFrom, from_0) - from_0) / span;
129
+ const right = (Math.min(partTo, to) - from_0) / span;
130
+ const next_0 = visible[i_0 + 1];
131
+ const touches = next_0 !== undefined && (next_0.from - partTo) / span * width < 1;
132
+ const fill = clsx("flex size-full min-w-0 items-center", size === "sm" ? "rounded-full" : "rounded-sm px-1.5 text-left text-xs", part_1.current && (size === "sm" ? "bg-accent" : "bg-accent-soft text-text"), !part_1.current && part_1.color === undefined && "bg-surface-active", !part_1.current && size === "md" && "text-text-muted", onSelect !== undefined && "cursor-pointer hover:opacity-80");
133
+ const text = /*#__PURE__*/_jsx("span", {
134
+ ref: element_0 => {
135
+ labels.current[i_0] = element_0;
136
+ },
137
+ className: size === "sm" ? "sr-only" : "min-w-0 truncate",
138
+ children: part_1.label
139
+ });
140
+ const look = {
141
+ className: fill,
142
+ style: {
143
+ backgroundColor: part_1.color
144
+ },
145
+ "aria-current": part_1.current ? true : undefined
146
+ };
147
+ const body = onSelect === undefined ? /*#__PURE__*/_jsx("span", {
148
+ ...look,
149
+ children: text
150
+ }) : /*#__PURE__*/_jsx("button", {
151
+ type: "button",
152
+ ...look,
153
+ onClick: () => onSelect(index_0),
154
+ children: text
155
+ });
156
+ return /*#__PURE__*/_jsx("li", {
157
+ className: clsx("absolute inset-y-0 focus-within:z-10", touches && "pr-0.5"),
158
+ style: {
159
+ left: `${left * 100}%`,
160
+ width: `${(right - left) * 100}%`
161
+ },
162
+ children: part_1.label === undefined ? body : /*#__PURE__*/_jsx(Tooltip, {
163
+ label: part_1.label,
164
+ disabled: size === "md" && !cut[i_0],
165
+ children: body
166
+ })
167
+ }, index_0);
19
168
  });
20
- const [from, to] = range ?? [0, end];
21
- const span = to - from;
22
- const visible = span > 0 ? placed.filter((placement) => placement.to > from && placement.from < to) : [];
23
- // Parts without a name say nothing a screen reader could use; the element around the bar names it, as a meter does.
24
- // Parts a person can press stay reachable, since a hidden list must not hold focusable buttons.
25
- const hidden = onSelect === undefined && !parts.some((part) => part.label !== undefined);
26
- // A label that stops fitting after a resize or a new range gets its tooltip.
27
- useEffect(() => {
28
- const next = labels.current.slice(0, visible.length).map((element) => element !== null && element.scrollWidth > element.clientWidth);
29
- setCut((current) => (current.length === next.length && current.every((value, i) => value === next[i]) ? current : next));
30
- }, [width, parts, from, to, size, visible.length]);
31
- return (_jsx("ol", { ref: rootRef, "aria-label": hidden ? undefined : label, "aria-hidden": hidden ? true : undefined, className: clsx('relative min-w-0', size === 'sm' ? 'h-1.5' : 'h-7', className), children: visible.map(({ part, index, from: partFrom, to: partTo }, i) => {
32
- const left = (Math.max(partFrom, from) - from) / span;
33
- const right = (Math.min(partTo, to) - from) / span;
34
- const next = visible[i + 1];
35
- // Less than a pixel apart they touch, whatever rounding the caller's starts carry.
36
- const touches = next !== undefined && ((next.from - partTo) / span) * width < 1;
37
- const fill = clsx('flex size-full min-w-0 items-center', size === 'sm' ? 'rounded-full' : 'rounded-sm px-1.5 text-left text-xs', part.current && (size === 'sm' ? 'bg-accent' : 'bg-accent-soft text-text'), !part.current && part.color === undefined && 'bg-surface-active', !part.current && size === 'md' && 'text-text-muted', onSelect !== undefined && 'cursor-pointer hover:opacity-80');
38
- const text = (_jsx("span", { ref: (element) => {
39
- labels.current[i] = element;
40
- }, className: size === 'sm' ? 'sr-only' : 'min-w-0 truncate', children: part.label }));
41
- const look = { className: fill, style: { backgroundColor: part.color }, 'aria-current': part.current ? true : undefined };
42
- const body = onSelect === undefined ? (_jsx("span", { ...look, children: text })) : (_jsx("button", { type: "button", ...look, onClick: () => onSelect(index), children: text }));
43
- return (_jsx("li", { className: clsx('absolute inset-y-0 focus-within:z-10', touches && 'pr-0.5'), style: { left: `${left * 100}%`, width: `${(right - left) * 100}%` }, children: part.label === undefined ? (body) : (_jsx(Tooltip, { label: part.label, disabled: size === 'md' && !cut[i], children: body })) }, index));
44
- }) }));
169
+ $[23] = cut;
170
+ $[24] = from_0;
171
+ $[25] = onSelect;
172
+ $[26] = size;
173
+ $[27] = span;
174
+ $[28] = to;
175
+ $[29] = visible;
176
+ $[30] = width;
177
+ $[31] = t12;
178
+ } else {
179
+ t12 = $[31];
180
+ }
181
+ let t13;
182
+ if ($[32] !== rootRef || $[33] !== t11 || $[34] !== t12 || $[35] !== t8 || $[36] !== t9) {
183
+ t13 = /*#__PURE__*/_jsx("ol", {
184
+ ref: rootRef,
185
+ "aria-label": t8,
186
+ "aria-hidden": t9,
187
+ className: t11,
188
+ children: t12
189
+ });
190
+ $[32] = rootRef;
191
+ $[33] = t11;
192
+ $[34] = t12;
193
+ $[35] = t8;
194
+ $[36] = t9;
195
+ $[37] = t13;
196
+ } else {
197
+ t13 = $[37];
198
+ }
199
+ return t13;
200
+ }
201
+ function _temp2(element) {
202
+ return element !== null && element.scrollWidth > element.clientWidth;
45
203
  }
204
+ function _temp(part_0) {
205
+ return part_0.label !== undefined;
206
+ }
package/dist/Segmented.js CHANGED
@@ -1,29 +1,136 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import clsx from 'clsx';
3
- import { Icon } from './Icon.js';
4
- const STEPS = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 };
3
+ import { Icon } from "./Icon.js";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ const STEPS = {
6
+ ArrowRight: 1,
7
+ ArrowDown: 1,
8
+ ArrowLeft: -1,
9
+ ArrowUp: -1
10
+ };
5
11
  /*
6
12
  * One of a few options side by side in one sunken track, the picked one lifted out of it. A radio
7
13
  * group: one tab stop, and the arrows pick and focus the next option, around the ends.
8
14
  */
9
- export function Segmented({ value, onValueChange, options, label, disabled, orientation = 'horizontal', className, ref }) {
10
- const vertical = orientation === 'vertical';
11
- const picked = options.findIndex((option) => option.id === value);
12
- const stop = picked === -1 ? 0 : picked;
13
- function move(event, index) {
14
- const next = event.key in STEPS
15
- ? (index + STEPS[event.key] + options.length) % options.length
16
- : event.key === 'Home'
17
- ? 0
18
- : event.key === 'End'
19
- ? options.length - 1
20
- : null;
21
- if (next === null) {
22
- return;
23
- }
24
- event.preventDefault();
25
- onValueChange(options[next].id);
26
- event.currentTarget.parentElement?.querySelectorAll('[role="radio"]')[next]?.focus();
15
+ export function Segmented(t0) {
16
+ const $ = _c(30);
17
+ const {
18
+ value,
19
+ onValueChange,
20
+ options,
21
+ label,
22
+ disabled,
23
+ orientation: t1,
24
+ className,
25
+ ref
26
+ } = t0;
27
+ const orientation = t1 === undefined ? "horizontal" : t1;
28
+ const vertical = orientation === "vertical";
29
+ let t2;
30
+ if ($[0] !== options || $[1] !== value) {
31
+ let t3;
32
+ if ($[3] !== value) {
33
+ t3 = option => option.id === value;
34
+ $[3] = value;
35
+ $[4] = t3;
36
+ } else {
37
+ t3 = $[4];
38
+ }
39
+ t2 = options.findIndex(t3);
40
+ $[0] = options;
41
+ $[1] = value;
42
+ $[2] = t2;
43
+ } else {
44
+ t2 = $[2];
45
+ }
46
+ const picked = t2;
47
+ const stop = picked === -1 ? 0 : picked;
48
+ let t3;
49
+ if ($[5] !== onValueChange || $[6] !== options) {
50
+ t3 = function move(event, index) {
51
+ const next = event.key in STEPS ? (index + STEPS[event.key] + options.length) % options.length : event.key === "Home" ? 0 : event.key === "End" ? options.length - 1 : null;
52
+ if (next === null) {
53
+ return;
54
+ }
55
+ event.preventDefault();
56
+ onValueChange(options[next].id);
57
+ event.currentTarget.parentElement?.querySelectorAll("[role=\"radio\"]")[next]?.focus();
58
+ };
59
+ $[5] = onValueChange;
60
+ $[6] = options;
61
+ $[7] = t3;
62
+ } else {
63
+ t3 = $[7];
64
+ }
65
+ const move = t3;
66
+ const t4 = vertical ? "w-full flex-col items-stretch gap-0.5" : "min-h-8 w-fit items-center";
67
+ let t5;
68
+ if ($[8] !== className || $[9] !== t4) {
69
+ t5 = clsx("flex rounded-lg bg-surface-sunken p-0.5 text-xs font-medium", t4, className);
70
+ $[8] = className;
71
+ $[9] = t4;
72
+ $[10] = t5;
73
+ } else {
74
+ t5 = $[10];
75
+ }
76
+ const t6 = vertical ? "vertical" : undefined;
77
+ let t7;
78
+ if ($[11] !== disabled || $[12] !== move || $[13] !== onValueChange || $[14] !== options || $[15] !== stop || $[16] !== value) {
79
+ let t8;
80
+ if ($[18] !== disabled || $[19] !== move || $[20] !== onValueChange || $[21] !== stop || $[22] !== value) {
81
+ t8 = (option_0, index_0) => /*#__PURE__*/_jsxs("button", {
82
+ type: "button",
83
+ role: "radio",
84
+ "aria-checked": value === option_0.id,
85
+ tabIndex: index_0 === stop ? 0 : -1,
86
+ disabled: disabled,
87
+ className: clsx("flex min-h-7 items-center gap-1.5 rounded-md px-3 py-1 text-left transition-colors disabled:opacity-50", value === option_0.id ? "bg-surface-raised text-text shadow-raised" : "text-text-muted hover:text-text"),
88
+ onClick: () => onValueChange(option_0.id),
89
+ onKeyDown: event_0 => move(event_0, index_0),
90
+ children: [option_0.icon && /*#__PURE__*/_jsx(Icon, {
91
+ icon: option_0.icon,
92
+ size: 14,
93
+ className: "shrink-0"
94
+ }), option_0.label]
95
+ }, option_0.id);
96
+ $[18] = disabled;
97
+ $[19] = move;
98
+ $[20] = onValueChange;
99
+ $[21] = stop;
100
+ $[22] = value;
101
+ $[23] = t8;
102
+ } else {
103
+ t8 = $[23];
27
104
  }
28
- return (_jsx("div", { ref: ref, className: clsx('flex rounded-lg bg-surface-sunken p-0.5 text-xs font-medium', vertical ? 'w-full flex-col items-stretch gap-0.5' : 'min-h-8 w-fit items-center', className), role: "radiogroup", "aria-label": label, "aria-orientation": vertical ? 'vertical' : undefined, children: options.map((option, index) => (_jsxs("button", { type: "button", role: "radio", "aria-checked": value === option.id, tabIndex: index === stop ? 0 : -1, disabled: disabled, className: clsx('flex min-h-7 items-center gap-1.5 rounded-md px-3 py-1 text-left transition-colors disabled:opacity-50', value === option.id ? 'bg-surface-raised text-text shadow-raised' : 'text-text-muted hover:text-text'), onClick: () => onValueChange(option.id), onKeyDown: (event) => move(event, index), children: [option.icon && _jsx(Icon, { icon: option.icon, size: 14, className: "shrink-0" }), option.label] }, option.id))) }));
29
- }
105
+ t7 = options.map(t8);
106
+ $[11] = disabled;
107
+ $[12] = move;
108
+ $[13] = onValueChange;
109
+ $[14] = options;
110
+ $[15] = stop;
111
+ $[16] = value;
112
+ $[17] = t7;
113
+ } else {
114
+ t7 = $[17];
115
+ }
116
+ let t8;
117
+ if ($[24] !== label || $[25] !== ref || $[26] !== t5 || $[27] !== t6 || $[28] !== t7) {
118
+ t8 = /*#__PURE__*/_jsx("div", {
119
+ ref: ref,
120
+ className: t5,
121
+ role: "radiogroup",
122
+ "aria-label": label,
123
+ "aria-orientation": t6,
124
+ children: t7
125
+ });
126
+ $[24] = label;
127
+ $[25] = ref;
128
+ $[26] = t5;
129
+ $[27] = t6;
130
+ $[28] = t7;
131
+ $[29] = t8;
132
+ } else {
133
+ t8 = $[29];
134
+ }
135
+ return t8;
136
+ }