beez-ui 2.5.0 → 2.6.1
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/CHANGELOG.md +63 -0
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/components/alert-dialog.d.ts +15 -4
- package/dist/components/alert-dialog.js +84 -44
- package/dist/components/alert.d.ts +30 -9
- package/dist/components/alert.js +360 -39
- package/dist/components/avatar.d.ts +33 -10
- package/dist/components/avatar.js +110 -30
- package/dist/components/badge.d.ts +39 -7
- package/dist/components/badge.js +348 -24
- package/dist/components/calendar.d.ts +29 -2
- package/dist/components/calendar.js +1035 -223
- package/dist/components/card.d.ts +17 -1
- package/dist/components/card.js +34 -8
- package/dist/components/carousel.d.ts +29 -2
- package/dist/components/carousel.js +471 -90
- package/dist/components/checkbox.d.ts +13 -2
- package/dist/components/checkbox.js +301 -41
- package/dist/components/dialog-surface.d.ts +27 -0
- package/dist/components/dialog-surface.js +137 -0
- package/dist/components/dialog.d.ts +21 -4
- package/dist/components/dialog.js +163 -96
- package/dist/components/dropdown-menu.d.ts +30 -16
- package/dist/components/dropdown-menu.js +139 -83
- package/dist/components/hover-card.d.ts +46 -3
- package/dist/components/hover-card.js +423 -60
- package/dist/components/pagination.d.ts +32 -14
- package/dist/components/pagination.js +136 -59
- package/dist/components/popover.d.ts +14 -5
- package/dist/components/popover.js +78 -36
- package/dist/components/radio-group.d.ts +19 -3
- package/dist/components/radio-group.js +400 -57
- package/dist/components/select.d.ts +17 -6
- package/dist/components/select.js +83 -71
- package/dist/components/sheet.js +37 -26
- package/dist/components/sidebar.js +11 -0
- package/dist/components/skeleton.d.ts +19 -5
- package/dist/components/skeleton.js +434 -14
- package/dist/components/switch.d.ts +14 -4
- package/dist/components/switch.js +424 -40
- package/dist/components/tabs.d.ts +38 -5
- package/dist/components/tabs.js +564 -97
- package/dist/components/themed-toaster.d.ts +6 -2
- package/dist/components/themed-toaster.js +80 -50
- package/dist/components/tooltip.d.ts +33 -2
- package/dist/components/tooltip.js +197 -69
- package/dist/constants/alert.d.ts +12 -0
- package/dist/constants/alert.js +9 -0
- package/dist/constants/avatar.d.ts +10 -0
- package/dist/constants/avatar.js +7 -0
- package/dist/constants/badge.d.ts +6 -0
- package/dist/constants/badge.js +6 -0
- package/dist/constants/calendar.d.ts +24 -0
- package/dist/constants/calendar.js +22 -0
- package/dist/constants/carousel.d.ts +37 -0
- package/dist/constants/carousel.js +53 -0
- package/dist/constants/checkbox.d.ts +17 -0
- package/dist/constants/checkbox.js +17 -0
- package/dist/constants/dialog.d.ts +6 -0
- package/dist/constants/dialog.js +6 -0
- package/dist/constants/dropdown-menu.d.ts +5 -0
- package/dist/constants/dropdown-menu.js +5 -0
- package/dist/constants/hover-card.d.ts +37 -0
- package/dist/constants/hover-card.js +85 -0
- package/dist/constants/pagination.d.ts +9 -0
- package/dist/constants/pagination.js +9 -0
- package/dist/constants/popover.d.ts +7 -0
- package/dist/constants/popover.js +39 -0
- package/dist/constants/radio-group.d.ts +10 -0
- package/dist/constants/radio-group.js +10 -0
- package/dist/constants/select.d.ts +3 -0
- package/dist/constants/select.js +3 -0
- package/dist/constants/skeleton.d.ts +17 -0
- package/dist/constants/skeleton.js +17 -0
- package/dist/constants/switch.d.ts +44 -0
- package/dist/constants/switch.js +49 -0
- package/dist/constants/tabs.d.ts +17 -0
- package/dist/constants/tabs.js +17 -0
- package/dist/constants/toast.d.ts +3 -0
- package/dist/constants/toast.js +3 -0
- package/dist/constants/tooltip.d.ts +13 -0
- package/dist/constants/tooltip.js +52 -0
- package/dist/lib/toast-layer.d.ts +24 -0
- package/dist/lib/toast-layer.js +76 -0
- package/dist/motion/arc-floating-slot.d.ts +40 -0
- package/dist/motion/arc-floating-slot.js +167 -0
- package/dist/motion/glide-indicator.d.ts +6 -7
- package/dist/motion/glide-indicator.js +5 -3
- package/dist/motion/overlay-warmth.d.ts +24 -0
- package/dist/motion/overlay-warmth.js +70 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,98 +1,441 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Arc's RadioGroup (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md) on Radix's radio group: the mark dips
|
|
5
|
+
* on press, previews a faint dot while held, and the new dot springs in while the old one shrinks away. Items with a
|
|
6
|
+
* `label` render Arc's option rows, and one highlight travels to the chosen row on the morph spring, so a change reads
|
|
7
|
+
* as a single physical move; arrow keys take the same path. Bare items keep the plain mark for compositions that place
|
|
8
|
+
* their own label.
|
|
9
|
+
*/
|
|
10
|
+
import { createContext, useContext, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
4
11
|
import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
|
|
5
|
-
import {
|
|
12
|
+
import { animate, motion } from "motion/react";
|
|
13
|
+
import { RADIO_GROUP_DOT_HIDDEN_SCALE, RADIO_GROUP_OPTION_ID_SUFFIX, RADIO_GROUP_READY_ATTRIBUTE } from "../constants/radio-group.js";
|
|
14
|
+
import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
|
|
6
15
|
import { cn } from "../lib/utils.js";
|
|
7
|
-
import {
|
|
16
|
+
import { ARC_DURATION, ARC_SPRING_MORPH, ARC_SPRING_SNAPPY } from "../motion/arc-tokens.js";
|
|
17
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
/** Selector of the option row that holds the checked radio. */
|
|
19
|
+
const CHECKED_OPTION_SELECTOR = "[data-slot=\"radio-group-option\"]:has([data-slot=\"radio-group-item\"][data-state=\"checked\"])";
|
|
20
|
+
/** Selector of every option row, observed so the highlight follows rows that resize. */
|
|
21
|
+
const OPTION_SELECTOR = "[data-slot=\"radio-group-option\"]";
|
|
22
|
+
/** The value chosen in the enclosing group, read by each item to spring its dot in or out. */
|
|
23
|
+
const RadioGroupValueContext = createContext(undefined);
|
|
24
|
+
/**
|
|
25
|
+
* Sizes the highlight to the chosen row. A new choice glides on the morph spring; the first paint and resizes place it
|
|
26
|
+
* at once, and a group without a chosen row hides it.
|
|
27
|
+
* @param highlight - The travelling highlight element.
|
|
28
|
+
* @param row - The checked option row, if any.
|
|
29
|
+
* @param placedAt - Geometry the highlight was last placed at; updated in place.
|
|
30
|
+
* @param shouldGlide - Whether this change should travel instead of jumping.
|
|
31
|
+
*/
|
|
32
|
+
function placeHighlight(highlight, row, placedAt, shouldGlide) {
|
|
33
|
+
const nextGeometry = row ? `${row.offsetLeft} ${row.offsetTop} ${row.offsetWidth} ${row.offsetHeight}` : "";
|
|
34
|
+
if (!highlight || nextGeometry === placedAt.current) return;
|
|
35
|
+
const wasVisible = placedAt.current !== "";
|
|
36
|
+
placedAt.current = nextGeometry;
|
|
37
|
+
if (!row) {
|
|
38
|
+
animate(highlight, { opacity: 0 }, { duration: 0 });
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const target = {
|
|
42
|
+
x: row.offsetLeft,
|
|
43
|
+
y: row.offsetTop,
|
|
44
|
+
width: row.offsetWidth,
|
|
45
|
+
height: row.offsetHeight,
|
|
46
|
+
opacity: 1
|
|
47
|
+
};
|
|
48
|
+
if (shouldGlide && wasVisible) {
|
|
49
|
+
animate(highlight, target, {
|
|
50
|
+
...ARC_SPRING_MORPH,
|
|
51
|
+
opacity: { duration: 0 }
|
|
52
|
+
});
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
Object.assign(highlight.style, {
|
|
56
|
+
transform: `translateX(${target.x}px) translateY(${target.y}px)`,
|
|
57
|
+
width: `${target.width}px`,
|
|
58
|
+
height: `${target.height}px`,
|
|
59
|
+
opacity: "1"
|
|
60
|
+
});
|
|
61
|
+
animate(highlight, target, { duration: 0 });
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Hosts the radios, controlled or uncontrolled like Radix's radio group, and moves the highlight of option rows.
|
|
65
|
+
* @param radioGroupProps - Every Radix radio group prop, including `ref`.
|
|
66
|
+
* @returns The radio group.
|
|
67
|
+
*/
|
|
8
68
|
function RadioGroup(t0) {
|
|
9
|
-
const $ = _c(
|
|
69
|
+
const $ = _c(36);
|
|
70
|
+
let asChild;
|
|
71
|
+
let children;
|
|
10
72
|
let className;
|
|
73
|
+
let defaultValue;
|
|
74
|
+
let onValueChange;
|
|
11
75
|
let props;
|
|
76
|
+
let ref;
|
|
77
|
+
let value;
|
|
12
78
|
if ($[0] !== t0) {
|
|
13
|
-
({className, ...props} = t0);
|
|
79
|
+
({className, children, value, defaultValue, onValueChange, ref, asChild, ...props} = t0);
|
|
14
80
|
$[0] = t0;
|
|
15
|
-
$[1] =
|
|
16
|
-
$[2] =
|
|
81
|
+
$[1] = asChild;
|
|
82
|
+
$[2] = children;
|
|
83
|
+
$[3] = className;
|
|
84
|
+
$[4] = defaultValue;
|
|
85
|
+
$[5] = onValueChange;
|
|
86
|
+
$[6] = props;
|
|
87
|
+
$[7] = ref;
|
|
88
|
+
$[8] = value;
|
|
17
89
|
} else {
|
|
18
|
-
|
|
19
|
-
|
|
90
|
+
asChild = $[1];
|
|
91
|
+
children = $[2];
|
|
92
|
+
className = $[3];
|
|
93
|
+
defaultValue = $[4];
|
|
94
|
+
onValueChange = $[5];
|
|
95
|
+
props = $[6];
|
|
96
|
+
ref = $[7];
|
|
97
|
+
value = $[8];
|
|
20
98
|
}
|
|
99
|
+
const reduceMotion = usePrefersReducedMotion();
|
|
100
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
101
|
+
const selectedValue = value ?? uncontrolledValue;
|
|
102
|
+
const groupRef = useRef(null);
|
|
103
|
+
const highlightRef = useRef(null);
|
|
104
|
+
const shownValue = useRef(null);
|
|
105
|
+
const placedAt = useRef("");
|
|
21
106
|
let t1;
|
|
22
|
-
if ($[
|
|
23
|
-
t1 =
|
|
24
|
-
$[
|
|
25
|
-
$[4] = t1;
|
|
107
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
108
|
+
t1 = () => groupRef.current?.querySelector(CHECKED_OPTION_SELECTOR) ?? null;
|
|
109
|
+
$[9] = t1;
|
|
26
110
|
} else {
|
|
27
|
-
t1 = $[
|
|
111
|
+
t1 = $[9];
|
|
28
112
|
}
|
|
113
|
+
const findCheckedRow = t1;
|
|
29
114
|
let t2;
|
|
30
|
-
|
|
31
|
-
|
|
115
|
+
let t3;
|
|
116
|
+
if ($[10] !== reduceMotion || $[11] !== selectedValue) {
|
|
117
|
+
t2 = () => {
|
|
118
|
+
const hasChanged = shownValue.current !== null && shownValue.current !== selectedValue;
|
|
119
|
+
placeHighlight(highlightRef.current, findCheckedRow(), placedAt, hasChanged && !reduceMotion);
|
|
120
|
+
shownValue.current = selectedValue;
|
|
121
|
+
if (highlightRef.current) {
|
|
122
|
+
groupRef.current?.setAttribute(RADIO_GROUP_READY_ATTRIBUTE, "");
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
t3 = [selectedValue, reduceMotion];
|
|
126
|
+
$[10] = reduceMotion;
|
|
127
|
+
$[11] = selectedValue;
|
|
128
|
+
$[12] = t2;
|
|
129
|
+
$[13] = t3;
|
|
130
|
+
} else {
|
|
131
|
+
t2 = $[12];
|
|
132
|
+
t3 = $[13];
|
|
133
|
+
}
|
|
134
|
+
useLayoutEffect(t2, t3);
|
|
135
|
+
let t4;
|
|
136
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
137
|
+
t4 = () => {
|
|
138
|
+
const group = groupRef.current;
|
|
139
|
+
if (!group || typeof ResizeObserver === "undefined") {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const observer = new ResizeObserver(() => placeHighlight(highlightRef.current, findCheckedRow(), placedAt, false));
|
|
143
|
+
observer.observe(group);
|
|
144
|
+
group.querySelectorAll(OPTION_SELECTOR).forEach((row) => observer.observe(row));
|
|
145
|
+
return () => observer.disconnect();
|
|
146
|
+
};
|
|
147
|
+
$[14] = t4;
|
|
148
|
+
} else {
|
|
149
|
+
t4 = $[14];
|
|
150
|
+
}
|
|
151
|
+
useEffect(t4);
|
|
152
|
+
let t5;
|
|
153
|
+
if ($[15] !== className) {
|
|
154
|
+
t5 = cn("relative grid w-full gap-2", className);
|
|
155
|
+
$[15] = className;
|
|
156
|
+
$[16] = t5;
|
|
157
|
+
} else {
|
|
158
|
+
t5 = $[16];
|
|
159
|
+
}
|
|
160
|
+
let t6;
|
|
161
|
+
if ($[17] !== ref) {
|
|
162
|
+
t6 = (node) => {
|
|
163
|
+
groupRef.current = node;
|
|
164
|
+
if (typeof ref === "function") {
|
|
165
|
+
return ref(node);
|
|
166
|
+
}
|
|
167
|
+
if (ref) {
|
|
168
|
+
ref.current = node;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
$[17] = ref;
|
|
172
|
+
$[18] = t6;
|
|
173
|
+
} else {
|
|
174
|
+
t6 = $[18];
|
|
175
|
+
}
|
|
176
|
+
let t7;
|
|
177
|
+
if ($[19] !== onValueChange || $[20] !== value) {
|
|
178
|
+
t7 = (nextValue) => {
|
|
179
|
+
if (value === undefined) {
|
|
180
|
+
setUncontrolledValue(nextValue);
|
|
181
|
+
}
|
|
182
|
+
onValueChange?.(nextValue);
|
|
183
|
+
};
|
|
184
|
+
$[19] = onValueChange;
|
|
185
|
+
$[20] = value;
|
|
186
|
+
$[21] = t7;
|
|
187
|
+
} else {
|
|
188
|
+
t7 = $[21];
|
|
189
|
+
}
|
|
190
|
+
let t8;
|
|
191
|
+
if ($[22] !== asChild || $[23] !== children) {
|
|
192
|
+
t8 = asChild ? children : /* @__PURE__ */ _jsxs(_Fragment, { children: [/* @__PURE__ */ _jsx("span", {
|
|
193
|
+
ref: highlightRef,
|
|
194
|
+
"data-slot": "radio-group-highlight",
|
|
195
|
+
"aria-hidden": "true",
|
|
196
|
+
className: "pointer-events-none absolute top-0 left-0 z-1 box-border rounded-(--radius-control) border border-(--control-on) bg-[color-mix(in_oklab,var(--control-on)_5%,transparent)] opacity-0"
|
|
197
|
+
}), children] });
|
|
198
|
+
$[22] = asChild;
|
|
199
|
+
$[23] = children;
|
|
200
|
+
$[24] = t8;
|
|
201
|
+
} else {
|
|
202
|
+
t8 = $[24];
|
|
203
|
+
}
|
|
204
|
+
let t9;
|
|
205
|
+
if ($[25] !== asChild || $[26] !== props || $[27] !== selectedValue || $[28] !== t5 || $[29] !== t6 || $[30] !== t7 || $[31] !== t8) {
|
|
206
|
+
t9 = /* @__PURE__ */ _jsx(RadioGroupPrimitive.Root, {
|
|
32
207
|
"data-slot": "radio-group",
|
|
33
|
-
className:
|
|
34
|
-
...props
|
|
208
|
+
className: t5,
|
|
209
|
+
...props,
|
|
210
|
+
asChild,
|
|
211
|
+
ref: t6,
|
|
212
|
+
value: selectedValue,
|
|
213
|
+
onValueChange: t7,
|
|
214
|
+
children: t8
|
|
35
215
|
});
|
|
36
|
-
$[
|
|
37
|
-
$[
|
|
38
|
-
$[
|
|
216
|
+
$[25] = asChild;
|
|
217
|
+
$[26] = props;
|
|
218
|
+
$[27] = selectedValue;
|
|
219
|
+
$[28] = t5;
|
|
220
|
+
$[29] = t6;
|
|
221
|
+
$[30] = t7;
|
|
222
|
+
$[31] = t8;
|
|
223
|
+
$[32] = t9;
|
|
224
|
+
} else {
|
|
225
|
+
t9 = $[32];
|
|
226
|
+
}
|
|
227
|
+
let t10;
|
|
228
|
+
if ($[33] !== selectedValue || $[34] !== t9) {
|
|
229
|
+
t10 = /* @__PURE__ */ _jsx(RadioGroupValueContext.Provider, {
|
|
230
|
+
value: selectedValue,
|
|
231
|
+
children: t9
|
|
232
|
+
});
|
|
233
|
+
$[33] = selectedValue;
|
|
234
|
+
$[34] = t9;
|
|
235
|
+
$[35] = t10;
|
|
39
236
|
} else {
|
|
40
|
-
|
|
237
|
+
t10 = $[35];
|
|
41
238
|
}
|
|
42
|
-
return
|
|
239
|
+
return t10;
|
|
43
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Arc's mark recipe. The bare mark keeps its 17px box and widens its hit area with a pseudo-element; the faint preview
|
|
243
|
+
* dot and the press dip answer the mark itself, or its whole row when it has a label.
|
|
244
|
+
*/
|
|
245
|
+
const radioGroupItemClassName = "peer group/radio-group-item relative grid aspect-square size-[17px] shrink-0 cursor-pointer place-items-center rounded-full border border-border-strong bg-transparent p-0 [-webkit-tap-highlight-color:transparent] [transition:border-color_var(--duration-fast)_var(--ease-standard),background-color_var(--duration-fast)_var(--ease-standard),scale_var(--duration-spring)_var(--ease-spring)] before:size-[7px] before:rounded-full before:bg-foreground before:opacity-0 before:transition-opacity before:duration-(--duration-instant) before:ease-(--ease-standard) before:[grid-area:1/1] before:content-[''] after:absolute after:-inset-[13px] disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-(--control-on) data-[state=checked]:bg-(--control-on) aria-invalid:data-[state=unchecked]:border-danger hover-fine:data-[state=unchecked]:not-disabled:border-text-muted active:not-disabled:scale-[.88] active:not-disabled:[transition:border-color_var(--duration-fast)_var(--ease-standard),background-color_var(--duration-fast)_var(--ease-standard),scale_100ms_var(--ease-standard)] active:not-disabled:data-[state=unchecked]:before:opacity-[.22] group-active/radio-group-option:not-disabled:scale-[.88] group-active/radio-group-option:not-disabled:data-[state=unchecked]:before:opacity-[.22] motion-reduce:scale-100 motion-reduce:transition-none motion-reduce:before:transition-none";
|
|
246
|
+
/** Arc's option row: answers a press with color only, while the mark is what moves. */
|
|
247
|
+
const optionClassName = "group/radio-group-option relative flex cursor-pointer items-center gap-(--space-3) rounded-(--radius-control) border border-border p-(--space-3) [-webkit-tap-highlight-color:transparent] transition-[background-color,border-color] duration-(--duration-fast) ease-(--ease-standard) hover-fine:bg-surface-muted active:bg-surface-muted has-disabled:cursor-not-allowed has-disabled:opacity-50 [[data-slot=radio-group]:not([data-ready])_&]:has-data-[state=checked]:border-(--control-on) [[data-slot=radio-group]:not([data-ready])_&]:has-data-[state=checked]:bg-[color-mix(in_oklab,var(--control-on)_5%,transparent)] motion-reduce:transition-none";
|
|
248
|
+
/**
|
|
249
|
+
* One radio of the group: a bare mark, or Arc's option row when it receives a `label`.
|
|
250
|
+
* @param radioGroupItemProps - Every Radix radio item prop, including `ref`, plus optional Arc `label` and `description`.
|
|
251
|
+
* @returns The radio, wrapped in its option row when it has a label.
|
|
252
|
+
*/
|
|
44
253
|
function RadioGroupItem(t0) {
|
|
45
|
-
const $ = _c(
|
|
254
|
+
const $ = _c(43);
|
|
46
255
|
let className;
|
|
256
|
+
let description;
|
|
257
|
+
let id;
|
|
258
|
+
let label;
|
|
47
259
|
let props;
|
|
260
|
+
let value;
|
|
48
261
|
if ($[0] !== t0) {
|
|
49
|
-
({className, ...props} = t0);
|
|
262
|
+
({className, label, description, id, value, ...props} = t0);
|
|
50
263
|
$[0] = t0;
|
|
51
264
|
$[1] = className;
|
|
52
|
-
$[2] =
|
|
265
|
+
$[2] = description;
|
|
266
|
+
$[3] = id;
|
|
267
|
+
$[4] = label;
|
|
268
|
+
$[5] = props;
|
|
269
|
+
$[6] = value;
|
|
53
270
|
} else {
|
|
54
271
|
className = $[1];
|
|
55
|
-
|
|
272
|
+
description = $[2];
|
|
273
|
+
id = $[3];
|
|
274
|
+
label = $[4];
|
|
275
|
+
props = $[5];
|
|
276
|
+
value = $[6];
|
|
56
277
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
278
|
+
const generatedId = useId();
|
|
279
|
+
const rowId = id ?? generatedId;
|
|
280
|
+
const labelId = `${rowId}-${RADIO_GROUP_OPTION_ID_SUFFIX.label}`;
|
|
281
|
+
const descriptionId = `${rowId}-${RADIO_GROUP_OPTION_ID_SUFFIX.description}`;
|
|
282
|
+
const reduceMotion = usePrefersReducedMotion();
|
|
283
|
+
const isChecked = useContext(RadioGroupValueContext) === value;
|
|
284
|
+
const hasRow = Boolean(label);
|
|
285
|
+
const t1 = hasRow && "z-2 after:hidden";
|
|
286
|
+
let t2;
|
|
287
|
+
if ($[7] !== className || $[8] !== t1) {
|
|
288
|
+
t2 = cn(radioGroupItemClassName, t1, className);
|
|
289
|
+
$[7] = className;
|
|
290
|
+
$[8] = t1;
|
|
291
|
+
$[9] = t2;
|
|
62
292
|
} else {
|
|
63
|
-
|
|
293
|
+
t2 = $[9];
|
|
64
294
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
295
|
+
const t3 = hasRow ? props["aria-labelledby"] ?? labelId : props["aria-labelledby"];
|
|
296
|
+
let t4;
|
|
297
|
+
if ($[10] !== description || $[11] !== descriptionId || $[12] !== hasRow || $[13] !== props) {
|
|
298
|
+
t4 = [props["aria-describedby"], hasRow && description ? descriptionId : undefined].filter(Boolean).join(" ") || undefined;
|
|
299
|
+
$[10] = description;
|
|
300
|
+
$[11] = descriptionId;
|
|
301
|
+
$[12] = hasRow;
|
|
302
|
+
$[13] = props;
|
|
303
|
+
$[14] = t4;
|
|
304
|
+
} else {
|
|
305
|
+
t4 = $[14];
|
|
306
|
+
}
|
|
307
|
+
let t5;
|
|
308
|
+
if ($[15] !== isChecked) {
|
|
309
|
+
t5 = isChecked ? {
|
|
310
|
+
scale: 1,
|
|
311
|
+
opacity: 1
|
|
312
|
+
} : {
|
|
313
|
+
scale: RADIO_GROUP_DOT_HIDDEN_SCALE,
|
|
314
|
+
opacity: 0
|
|
315
|
+
};
|
|
316
|
+
$[15] = isChecked;
|
|
317
|
+
$[16] = t5;
|
|
318
|
+
} else {
|
|
319
|
+
t5 = $[16];
|
|
320
|
+
}
|
|
321
|
+
let t6;
|
|
322
|
+
if ($[17] !== isChecked || $[18] !== reduceMotion) {
|
|
323
|
+
t6 = reduceMotion ? { duration: 0 } : {
|
|
324
|
+
...ARC_SPRING_SNAPPY,
|
|
325
|
+
opacity: { duration: isChecked ? ARC_DURATION.fast : ARC_DURATION.instant }
|
|
326
|
+
};
|
|
327
|
+
$[17] = isChecked;
|
|
328
|
+
$[18] = reduceMotion;
|
|
329
|
+
$[19] = t6;
|
|
330
|
+
} else {
|
|
331
|
+
t6 = $[19];
|
|
332
|
+
}
|
|
333
|
+
let t7;
|
|
334
|
+
if ($[20] !== t5 || $[21] !== t6) {
|
|
335
|
+
t7 = /* @__PURE__ */ _jsx(RadioGroupPrimitive.Indicator, {
|
|
336
|
+
forceMount: true,
|
|
337
|
+
asChild: true,
|
|
338
|
+
children: /* @__PURE__ */ _jsx(motion.span, {
|
|
70
339
|
"data-slot": "radio-group-indicator",
|
|
71
|
-
className: "
|
|
72
|
-
|
|
340
|
+
className: "pointer-events-none block size-[7px] rounded-full bg-(--control-glyph) [grid-area:1/1]",
|
|
341
|
+
initial: false,
|
|
342
|
+
animate: t5,
|
|
343
|
+
transition: t6
|
|
73
344
|
})
|
|
74
345
|
});
|
|
75
|
-
$[
|
|
346
|
+
$[20] = t5;
|
|
347
|
+
$[21] = t6;
|
|
348
|
+
$[22] = t7;
|
|
76
349
|
} else {
|
|
77
|
-
|
|
350
|
+
t7 = $[22];
|
|
78
351
|
}
|
|
79
|
-
let
|
|
80
|
-
if ($[
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
352
|
+
let t8;
|
|
353
|
+
if ($[23] !== id || $[24] !== props || $[25] !== t2 || $[26] !== t3 || $[27] !== t4 || $[28] !== t7 || $[29] !== value) {
|
|
354
|
+
t8 = /* @__PURE__ */ _jsx(RadioGroupPrimitive.Item, {
|
|
355
|
+
"data-slot": "radio-group-item",
|
|
356
|
+
className: t2,
|
|
357
|
+
...props,
|
|
358
|
+
id,
|
|
359
|
+
value,
|
|
360
|
+
"aria-labelledby": t3,
|
|
361
|
+
"aria-describedby": t4,
|
|
362
|
+
children: t7
|
|
89
363
|
});
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
364
|
+
$[23] = id;
|
|
365
|
+
$[24] = props;
|
|
366
|
+
$[25] = t2;
|
|
367
|
+
$[26] = t3;
|
|
368
|
+
$[27] = t4;
|
|
369
|
+
$[28] = t7;
|
|
370
|
+
$[29] = value;
|
|
371
|
+
$[30] = t8;
|
|
93
372
|
} else {
|
|
94
|
-
|
|
373
|
+
t8 = $[30];
|
|
374
|
+
}
|
|
375
|
+
const item = t8;
|
|
376
|
+
if (!hasRow) {
|
|
377
|
+
return item;
|
|
378
|
+
}
|
|
379
|
+
let t9;
|
|
380
|
+
if ($[31] !== label || $[32] !== labelId) {
|
|
381
|
+
t9 = /* @__PURE__ */ _jsx("span", {
|
|
382
|
+
id: labelId,
|
|
383
|
+
"data-slot": "radio-group-option-label",
|
|
384
|
+
className: "block text-sm font-medium text-text-secondary transition-colors duration-(--duration-standard) ease-(--ease-standard) group-has-data-[state=checked]/radio-group-option:text-foreground motion-reduce:transition-none",
|
|
385
|
+
children: label
|
|
386
|
+
});
|
|
387
|
+
$[31] = label;
|
|
388
|
+
$[32] = labelId;
|
|
389
|
+
$[33] = t9;
|
|
390
|
+
} else {
|
|
391
|
+
t9 = $[33];
|
|
392
|
+
}
|
|
393
|
+
let t10;
|
|
394
|
+
if ($[34] !== description || $[35] !== descriptionId) {
|
|
395
|
+
t10 = description ? /* @__PURE__ */ _jsx("span", {
|
|
396
|
+
id: descriptionId,
|
|
397
|
+
"data-slot": "radio-group-option-description",
|
|
398
|
+
className: "mt-0.5 block text-xs text-text-muted",
|
|
399
|
+
children: description
|
|
400
|
+
}) : null;
|
|
401
|
+
$[34] = description;
|
|
402
|
+
$[35] = descriptionId;
|
|
403
|
+
$[36] = t10;
|
|
404
|
+
} else {
|
|
405
|
+
t10 = $[36];
|
|
406
|
+
}
|
|
407
|
+
let t11;
|
|
408
|
+
if ($[37] !== t10 || $[38] !== t9) {
|
|
409
|
+
t11 = /* @__PURE__ */ _jsxs("span", {
|
|
410
|
+
className: "relative z-2 min-w-0",
|
|
411
|
+
children: [t9, t10]
|
|
412
|
+
});
|
|
413
|
+
$[37] = t10;
|
|
414
|
+
$[38] = t9;
|
|
415
|
+
$[39] = t11;
|
|
416
|
+
} else {
|
|
417
|
+
t11 = $[39];
|
|
418
|
+
}
|
|
419
|
+
let t12;
|
|
420
|
+
if ($[40] !== item || $[41] !== t11) {
|
|
421
|
+
t12 = /* @__PURE__ */ _jsxs("label", {
|
|
422
|
+
"data-slot": "radio-group-option",
|
|
423
|
+
className: optionClassName,
|
|
424
|
+
onClick: _temp,
|
|
425
|
+
children: [item, t11]
|
|
426
|
+
});
|
|
427
|
+
$[40] = item;
|
|
428
|
+
$[41] = t11;
|
|
429
|
+
$[42] = t12;
|
|
430
|
+
} else {
|
|
431
|
+
t12 = $[42];
|
|
432
|
+
}
|
|
433
|
+
return t12;
|
|
434
|
+
}
|
|
435
|
+
function _temp(event) {
|
|
436
|
+
const radio = event.currentTarget.querySelector("[data-slot=\"radio-group-item\"]");
|
|
437
|
+
if (radio && !radio.disabled && event.target !== radio) {
|
|
438
|
+
radio.focus({ preventScroll: true });
|
|
95
439
|
}
|
|
96
|
-
return t3;
|
|
97
440
|
}
|
|
98
441
|
export { RadioGroup, RadioGroupItem };
|
|
@@ -1,30 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arc's Select (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md) as beez-ui's composable Radix select:
|
|
3
|
+
* Arc's trigger, whose hover, press and open states answer in color only so the anchored list never shifts, and its
|
|
4
|
+
* raised list with option rows and an end check, on Arc's tokens. It keeps every subcomponent, prop and `data-slot`
|
|
5
|
+
* of the previous API and beez-ui's option entrance, check pop and chevron rotation.
|
|
6
|
+
*/
|
|
1
7
|
import * as React from "react";
|
|
2
8
|
import { Select as SelectPrimitive } from "radix-ui";
|
|
3
9
|
declare function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>): React.JSX.Element;
|
|
4
10
|
declare function SelectGroup({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): React.JSX.Element;
|
|
5
11
|
declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): React.JSX.Element;
|
|
6
12
|
/**
|
|
7
|
-
* Renders
|
|
8
|
-
*
|
|
13
|
+
* Renders Arc's selection control: `default` matches the height of `Input` and `Button`, `sm` their small size.
|
|
14
|
+
* Hover only answers on fine pointers, keyboard focus draws the shared outline, and `aria-invalid` turns the border
|
|
15
|
+
* to the danger color.
|
|
16
|
+
* @param props - Primitive properties, the `size` and optional consumer overrides.
|
|
9
17
|
* @returns The styled primitive with its original interaction contract.
|
|
10
18
|
*/
|
|
11
19
|
declare function SelectTrigger({ className, size, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
12
20
|
size?: "sm" | "default";
|
|
13
21
|
}): React.JSX.Element;
|
|
14
22
|
/**
|
|
15
|
-
*
|
|
23
|
+
* Renders Arc's raised option list, at least twelve rem wide so options stay readable. With `position="popper"` it
|
|
24
|
+
* grows from the trigger edge, matches the trigger width, keeps 12px from the viewport edges and caps its height at
|
|
25
|
+
* 20rem.
|
|
16
26
|
* @param props - Primitive properties and optional consumer overrides.
|
|
17
27
|
* @returns The styled primitive with its original interaction contract.
|
|
18
28
|
*/
|
|
19
|
-
declare function SelectContent({ className, children, position, align, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): React.JSX.Element;
|
|
29
|
+
declare function SelectContent({ className, children, position, align, collisionPadding, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): React.JSX.Element;
|
|
20
30
|
/**
|
|
21
|
-
* Renders
|
|
31
|
+
* Renders a muted option group label aligned with the option text.
|
|
22
32
|
* @param props - Primitive properties and optional consumer overrides.
|
|
23
33
|
* @returns The styled primitive with its original interaction contract.
|
|
24
34
|
*/
|
|
25
35
|
declare function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>): React.JSX.Element;
|
|
26
36
|
/**
|
|
27
|
-
* Renders
|
|
37
|
+
* Renders Arc's option row: 36px tall, a muted fill when highlighted and the check of the chosen option at the end,
|
|
38
|
+
* while retaining selection and disabled semantics.
|
|
28
39
|
* @param props - Primitive properties and optional consumer overrides.
|
|
29
40
|
* @returns The styled primitive with its original interaction contract.
|
|
30
41
|
*/
|