@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.
- package/dist/AccentSwatches.js +290 -13
- package/dist/Banner.js +90 -9
- package/dist/Button.js +114 -22
- package/dist/ButtonGroup.js +62 -8
- package/dist/Checkbox.js +73 -4
- package/dist/ChoiceCards.js +205 -11
- package/dist/CloseButton.js +87 -7
- package/dist/ColorSwatch.js +132 -15
- package/dist/ColorWheelPicker.js +305 -71
- package/dist/ColumnResizeHandle.js +43 -8
- package/dist/DisabledReason.js +27 -8
- package/dist/DockShell.js +144 -37
- package/dist/EmptyState.js +95 -6
- package/dist/ErrorBoundary.js +254 -31
- package/dist/Field.js +349 -31
- package/dist/FileIcon.js +67 -6
- package/dist/Icon.js +38 -6
- package/dist/IconButton.js +176 -20
- package/dist/IconPicker.js +344 -73
- package/dist/Input.js +233 -14
- package/dist/Kbd.js +150 -10
- package/dist/LazyBoundary.js +14 -5
- package/dist/ListRow.js +75 -15
- package/dist/Meter.js +108 -5
- package/dist/MiddleTruncate.js +126 -45
- package/dist/PanelEmpty.js +64 -5
- package/dist/PanelHeader.js +95 -13
- package/dist/Pill.js +114 -19
- package/dist/ProjectSwitcher.js +225 -12
- package/dist/PromptDialog.js +352 -37
- package/dist/SectionLabel.js +62 -8
- package/dist/SegmentBar.js +197 -36
- package/dist/Segmented.js +130 -23
- package/dist/Select.js +310 -19
- package/dist/SelectSearch.js +344 -29
- package/dist/Separator.js +35 -4
- package/dist/ShortcutHints.js +146 -76
- package/dist/Skeleton.js +31 -4
- package/dist/Slider.js +172 -10
- package/dist/SlidingColumn.js +194 -34
- package/dist/Spinner.js +100 -3
- package/dist/Stepper.js +232 -11
- package/dist/Surface.js +62 -8
- package/dist/Switch.js +60 -6
- package/dist/TextMenu.js +212 -17
- package/dist/Tile.js +149 -5
- package/dist/Toasts.js +391 -33
- package/dist/Tooltip.js +153 -16
- package/dist/UIProvider.js +62 -15
- package/dist/Waveform.js +362 -93
- package/dist/Wipe.js +259 -34
- package/dist/ZoomControls.js +356 -14
- package/dist/class-name.js +1 -1
- package/dist/clipboard.js +15 -17
- package/dist/context-menu/index.parts.js +1 -1
- package/dist/dialog/index.parts.js +1 -1
- package/dist/dialog/parts.js +378 -29
- package/dist/dialog-layer.js +51 -18
- package/dist/error-boundary.js +19 -19
- package/dist/error-message.js +1 -1
- package/dist/field-context.js +7 -5
- package/dist/file-icon.js +23 -21
- package/dist/file-tree/helpers.js +133 -119
- package/dist/file-tree/index.parts.js +3 -3
- package/dist/file-tree/parts.js +418 -127
- package/dist/file-tree/style.js +1 -1
- package/dist/file-tree/use-file-tree-shift.js +43 -30
- package/dist/file-tree/use-file-tree.js +60 -18
- package/dist/file-tree/use-slots.js +220 -192
- package/dist/floating.js +2 -2
- package/dist/format/datetime.js +88 -38
- package/dist/format/duration.js +59 -53
- package/dist/format/index.js +1 -1
- package/dist/format/locale.js +76 -56
- package/dist/format/number.js +77 -61
- package/dist/format/regions.js +4 -2
- package/dist/format/time-zone.js +1 -1
- package/dist/icon-button-size.js +12 -2
- package/dist/icon-picker.js +70 -61
- package/dist/index.js +57 -57
- package/dist/key-value-list/index.parts.js +1 -1
- package/dist/key-value-list/parts.js +256 -22
- package/dist/lazy-landings.js +10 -10
- package/dist/lazy.js +84 -71
- package/dist/locales/en.js +80 -80
- package/dist/locales/nl.js +80 -80
- package/dist/locales.js +10 -7
- package/dist/menu/index.parts.js +1 -1
- package/dist/menu/parts.js +882 -44
- package/dist/merge-refs.js +8 -9
- package/dist/middle-truncate.js +24 -25
- package/dist/modality.js +27 -19
- package/dist/placement.js +11 -20
- package/dist/platform.js +6 -6
- package/dist/popover/index.parts.js +1 -1
- package/dist/popover/parts.js +173 -11
- package/dist/popup-layer.js +38 -17
- package/dist/prefetch.js +78 -79
- package/dist/preview-card/index.parts.js +1 -1
- package/dist/project-switcher-row.js +153 -12
- package/dist/select-row.js +69 -5
- package/dist/select-shared.js +6 -6
- package/dist/selection.js +16 -16
- package/dist/seti-icons.js +413 -413
- package/dist/settings/ConfirmDialog.js +55 -8
- package/dist/settings/DetailHeader.js +72 -4
- package/dist/settings/MasterDetail.js +119 -7
- package/dist/settings/SettingsDialog.js +820 -80
- package/dist/settings/SettingsRow.js +205 -18
- package/dist/settings/SettingsSection.js +96 -6
- package/dist/settings/index.js +7 -7
- package/dist/settings/target.js +7 -2
- package/dist/shortcut-hints.js +73 -55
- package/dist/shortcut.js +140 -104
- package/dist/step-places.js +1 -1
- package/dist/tabs/index.parts.js +1 -1
- package/dist/tabs/overflow.js +18 -18
- package/dist/tabs/parts.js +780 -166
- package/dist/testing/dedupe.js +82 -75
- package/dist/testing/fake-source.js +12 -12
- package/dist/testing/index.js +1 -1
- package/dist/toast-store.js +65 -46
- package/dist/tree/index.parts.js +1 -1
- package/dist/tree/parts.js +721 -94
- package/dist/tree/shift.js +28 -22
- package/dist/tree/style.js +2 -2
- package/dist/tree/use-tree-shift.js +178 -117
- package/dist/useAsyncAction.js +23 -19
- package/dist/useColumnResize.js +36 -34
- package/dist/useContentSize.js +62 -18
- package/dist/useMeasuredWidth.js +14 -3
- package/dist/useNow.js +73 -30
- package/dist/wipe-split.js +14 -14
- package/dist/workspace/DropPreview.js +60 -7
- package/dist/workspace/SplitView.js +1025 -441
- package/dist/workspace/TabStrip.js +810 -191
- package/dist/workspace/Workspace.js +276 -26
- package/dist/workspace/context.js +8 -3
- package/dist/workspace/geometry.js +173 -150
- package/dist/workspace/model.js +313 -250
- package/dist/workspace/preview.js +61 -61
- package/dist/zoom.js +2 -2
- package/package.json +1 -1
- package/src/ErrorBoundary.tsx +1 -1
- package/src/Field.tsx +4 -3
- package/src/IconPicker.tsx +3 -3
- package/src/LazyBoundary.tsx +2 -0
- package/src/MiddleTruncate.tsx +2 -2
- package/src/SegmentBar.tsx +2 -2
- package/src/Toasts.tsx +3 -1
- package/src/Tooltip.tsx +7 -10
- package/src/Waveform.tsx +3 -3
- package/src/file-tree/parts.tsx +6 -9
- package/src/file-tree/use-file-tree-shift.tsx +6 -9
- package/src/lazy.tsx +4 -0
- package/src/locales/en.ts +4 -4
- package/src/locales/nl.ts +5 -5
- package/src/settings/SettingsDialog.tsx +1 -1
- package/src/tree/parts.tsx +5 -8
- package/src/useContentSize.ts +3 -3
- package/src/workspace/SplitView.tsx +2 -2
- package/src/workspace/TabStrip.tsx +2 -3
- package/src/workspace/Workspace.tsx +2 -5
package/dist/SectionLabel.js
CHANGED
|
@@ -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(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
}
|
package/dist/SegmentBar.js
CHANGED
|
@@ -1,45 +1,206 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useEffect,
|
|
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
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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 {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { Icon } from
|
|
4
|
-
|
|
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(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
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
|
+
}
|