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,20 +1,440 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Arc's Skeleton (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): placeholders that reserve space while
|
|
5
|
+
* content loads, with a calm, finite pulse that ripples down the blocks and rests after about 20 seconds. Besides the
|
|
6
|
+
* bare block it renders Arc's composed placeholder (`lines`, `avatar`) and its reveal, which crossfades into the
|
|
7
|
+
* content while the height springs to its new size (`loading` with children).
|
|
8
|
+
*/
|
|
9
|
+
import { useEffect, useLayoutEffect, useRef } from "react";
|
|
10
|
+
import { AnimatePresence, animate, motion, useIsPresent } from "motion/react";
|
|
11
|
+
import { SKELETON_DEFAULT_LABEL, SKELETON_DEFAULT_LINES, SKELETON_LINE_LIMITS, SKELETON_MORPH_WINDOW_MS, SKELETON_REVEAL_OFFSET_PX } from "../constants/skeleton.js";
|
|
12
|
+
import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
|
|
2
13
|
import { cn } from "../lib/utils.js";
|
|
3
|
-
import {
|
|
14
|
+
import { ARC_DURATION, ARC_EASE, ARC_SPRING_SMOOTH } from "../motion/arc-tokens.js";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
/**
|
|
17
|
+
* Arc's block: a soft fill mixed from the strong border, and a 1.8s pulse that starts a beat later for each
|
|
18
|
+
* `--index` and stops after 11 rounds. Reduced motion shows a still block.
|
|
19
|
+
*/
|
|
20
|
+
const blockClassName = "block rounded-(--radius-control) bg-[color-mix(in_oklab,var(--border-strong)_38%,var(--surface))] animate-pulse [animation-delay:calc(var(--index,0)*90ms)] [animation-duration:1.8s] [animation-fill-mode:both] [animation-iteration-count:11] [animation-timing-function:var(--ease-in-out)] motion-reduce:animate-none";
|
|
21
|
+
/**
|
|
22
|
+
* Follows the content height. After `busy` flips, the frame springs from its old height to its new one, owning its
|
|
23
|
+
* inline height and overflow only while it moves and restoring the consumer's values afterwards, so a fixed height
|
|
24
|
+
* from `className` or `style` keeps applying at rest. It clips only while moving, so focus rings stay visible at rest.
|
|
25
|
+
* @param contentRef - The measured content; its parent is the frame that springs.
|
|
26
|
+
* @param busy - Whether the placeholder is showing; a change opens the window in which resizes spring.
|
|
27
|
+
* @param reduceMotion - Whether every resize should jump.
|
|
28
|
+
*/
|
|
29
|
+
function useMorphHeight(contentRef, busy, reduceMotion) {
|
|
30
|
+
const changedAt = useRef(0);
|
|
31
|
+
useLayoutEffect(() => {
|
|
32
|
+
changedAt.current = performance.now();
|
|
33
|
+
}, [busy]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const content = contentRef.current;
|
|
36
|
+
const frame = content?.parentElement;
|
|
37
|
+
if (!content || !frame || typeof ResizeObserver === "undefined") return;
|
|
38
|
+
let lastFrameHeight;
|
|
39
|
+
let controls;
|
|
40
|
+
let restingStyle;
|
|
41
|
+
const readFrameHeight = () => frame.getBoundingClientRect().height;
|
|
42
|
+
const settle = () => {
|
|
43
|
+
if (restingStyle) Object.assign(frame.style, restingStyle);
|
|
44
|
+
restingStyle = undefined;
|
|
45
|
+
};
|
|
46
|
+
const observer = new ResizeObserver(() => {
|
|
47
|
+
controls?.stop();
|
|
48
|
+
const fromHeight = restingStyle ? readFrameHeight() : lastFrameHeight;
|
|
49
|
+
if (restingStyle) frame.style.height = restingStyle.height;
|
|
50
|
+
const nextHeight = readFrameHeight();
|
|
51
|
+
lastFrameHeight = nextHeight;
|
|
52
|
+
const isOutsideWindow = performance.now() - changedAt.current > SKELETON_MORPH_WINDOW_MS;
|
|
53
|
+
if (reduceMotion || fromHeight === undefined || fromHeight === nextHeight || isOutsideWindow) return settle();
|
|
54
|
+
restingStyle ??= {
|
|
55
|
+
height: frame.style.height,
|
|
56
|
+
overflow: frame.style.overflow
|
|
57
|
+
};
|
|
58
|
+
frame.style.overflow = "hidden";
|
|
59
|
+
frame.style.height = `${fromHeight}px`;
|
|
60
|
+
controls = animate(fromHeight, nextHeight, {
|
|
61
|
+
...ARC_SPRING_SMOOTH,
|
|
62
|
+
onUpdate: (animatedHeight) => {
|
|
63
|
+
frame.style.height = `${animatedHeight}px`;
|
|
64
|
+
},
|
|
65
|
+
onComplete: settle
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
observer.observe(content);
|
|
69
|
+
return () => {
|
|
70
|
+
observer.disconnect();
|
|
71
|
+
controls?.stop();
|
|
72
|
+
settle();
|
|
73
|
+
};
|
|
74
|
+
}, [contentRef, reduceMotion]);
|
|
75
|
+
}
|
|
76
|
+
/** Arc's composed placeholder: an optional avatar and a column of lines, announced once as a busy status. */
|
|
77
|
+
function SkeletonPlaceholder(t0) {
|
|
78
|
+
const $ = _c(21);
|
|
79
|
+
let avatar;
|
|
80
|
+
let className;
|
|
81
|
+
let label;
|
|
82
|
+
let lines;
|
|
83
|
+
let props;
|
|
84
|
+
if ($[0] !== t0) {
|
|
85
|
+
({lines, avatar, label, className, ...props} = t0);
|
|
86
|
+
$[0] = t0;
|
|
87
|
+
$[1] = avatar;
|
|
88
|
+
$[2] = className;
|
|
89
|
+
$[3] = label;
|
|
90
|
+
$[4] = lines;
|
|
91
|
+
$[5] = props;
|
|
92
|
+
} else {
|
|
93
|
+
avatar = $[1];
|
|
94
|
+
className = $[2];
|
|
95
|
+
label = $[3];
|
|
96
|
+
lines = $[4];
|
|
97
|
+
props = $[5];
|
|
98
|
+
}
|
|
99
|
+
const lineCount = Math.min(Math.max(Math.floor(lines), SKELETON_LINE_LIMITS.min), SKELETON_LINE_LIMITS.max);
|
|
100
|
+
const firstLineIndex = avatar ? 1 : 0;
|
|
101
|
+
let t1;
|
|
102
|
+
if ($[6] !== className) {
|
|
103
|
+
t1 = cn("flex w-full min-w-0 items-start gap-(--space-4)", className);
|
|
104
|
+
$[6] = className;
|
|
105
|
+
$[7] = t1;
|
|
106
|
+
} else {
|
|
107
|
+
t1 = $[7];
|
|
108
|
+
}
|
|
109
|
+
let t2;
|
|
110
|
+
if ($[8] !== avatar) {
|
|
111
|
+
t2 = avatar ? /* @__PURE__ */ _jsx("span", {
|
|
112
|
+
"data-slot": "skeleton",
|
|
113
|
+
"aria-hidden": "true",
|
|
114
|
+
className: cn(blockClassName, "size-(--control-height-md) flex-none rounded-(--radius-pill)")
|
|
115
|
+
}) : null;
|
|
116
|
+
$[8] = avatar;
|
|
117
|
+
$[9] = t2;
|
|
118
|
+
} else {
|
|
119
|
+
t2 = $[9];
|
|
120
|
+
}
|
|
121
|
+
let t3;
|
|
122
|
+
if ($[10] !== firstLineIndex || $[11] !== lineCount) {
|
|
123
|
+
let t4;
|
|
124
|
+
if ($[13] !== firstLineIndex) {
|
|
125
|
+
t4 = (_, lineIndex) => /* @__PURE__ */ _jsx("span", {
|
|
126
|
+
"data-slot": "skeleton",
|
|
127
|
+
className: cn(blockClassName, "h-(--space-3) w-full first:h-(--space-4) first:w-[48%] last:not-first:w-[72%]"),
|
|
128
|
+
style: { "--index": lineIndex + firstLineIndex }
|
|
129
|
+
}, lineIndex);
|
|
130
|
+
$[13] = firstLineIndex;
|
|
131
|
+
$[14] = t4;
|
|
132
|
+
} else {
|
|
133
|
+
t4 = $[14];
|
|
134
|
+
}
|
|
135
|
+
t3 = /* @__PURE__ */ _jsx("span", {
|
|
136
|
+
"aria-hidden": "true",
|
|
137
|
+
className: "grid flex-1 gap-(--space-3) pt-(--space-1)",
|
|
138
|
+
children: Array.from({ length: lineCount }, t4)
|
|
139
|
+
});
|
|
140
|
+
$[10] = firstLineIndex;
|
|
141
|
+
$[11] = lineCount;
|
|
142
|
+
$[12] = t3;
|
|
143
|
+
} else {
|
|
144
|
+
t3 = $[12];
|
|
145
|
+
}
|
|
146
|
+
let t4;
|
|
147
|
+
if ($[15] !== label || $[16] !== props || $[17] !== t1 || $[18] !== t2 || $[19] !== t3) {
|
|
148
|
+
t4 = /* @__PURE__ */ _jsxs("div", {
|
|
149
|
+
"data-slot": "skeleton-placeholder",
|
|
150
|
+
role: "status",
|
|
151
|
+
"aria-label": label,
|
|
152
|
+
"aria-busy": "true",
|
|
153
|
+
className: t1,
|
|
154
|
+
...props,
|
|
155
|
+
children: [t2, t3]
|
|
156
|
+
});
|
|
157
|
+
$[15] = label;
|
|
158
|
+
$[16] = props;
|
|
159
|
+
$[17] = t1;
|
|
160
|
+
$[18] = t2;
|
|
161
|
+
$[19] = t3;
|
|
162
|
+
$[20] = t4;
|
|
163
|
+
} else {
|
|
164
|
+
t4 = $[20];
|
|
165
|
+
}
|
|
166
|
+
return t4;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* One side of the reveal. While it fades out it turns inert and hidden from assistive technology, so stale content
|
|
170
|
+
* under the new branch cannot be clicked, focused or announced.
|
|
171
|
+
*/
|
|
172
|
+
function SkeletonBranch(t0) {
|
|
173
|
+
const $ = _c(8);
|
|
174
|
+
let props;
|
|
175
|
+
let ref;
|
|
176
|
+
if ($[0] !== t0) {
|
|
177
|
+
({ref, ...props} = t0);
|
|
178
|
+
$[0] = t0;
|
|
179
|
+
$[1] = props;
|
|
180
|
+
$[2] = ref;
|
|
181
|
+
} else {
|
|
182
|
+
props = $[1];
|
|
183
|
+
ref = $[2];
|
|
184
|
+
}
|
|
185
|
+
const isPresent = useIsPresent();
|
|
186
|
+
const t1 = isPresent ? undefined : true;
|
|
187
|
+
const t2 = !isPresent || undefined;
|
|
188
|
+
let t3;
|
|
189
|
+
if ($[3] !== props || $[4] !== ref || $[5] !== t1 || $[6] !== t2) {
|
|
190
|
+
t3 = /* @__PURE__ */ _jsx(motion.div, {
|
|
191
|
+
ref,
|
|
192
|
+
...props,
|
|
193
|
+
"aria-hidden": t1,
|
|
194
|
+
inert: t2
|
|
195
|
+
});
|
|
196
|
+
$[3] = props;
|
|
197
|
+
$[4] = ref;
|
|
198
|
+
$[5] = t1;
|
|
199
|
+
$[6] = t2;
|
|
200
|
+
$[7] = t3;
|
|
201
|
+
} else {
|
|
202
|
+
t3 = $[7];
|
|
203
|
+
}
|
|
204
|
+
return t3;
|
|
205
|
+
}
|
|
206
|
+
/** Arc's reveal: the placeholder crossfades into the content while the frame springs to the new height. */
|
|
207
|
+
function SkeletonReveal(t0) {
|
|
208
|
+
const $ = _c(21);
|
|
209
|
+
let children;
|
|
210
|
+
let className;
|
|
211
|
+
let loading;
|
|
212
|
+
let placeholder;
|
|
213
|
+
let props;
|
|
214
|
+
let style;
|
|
215
|
+
if ($[0] !== t0) {
|
|
216
|
+
({loading, placeholder, children, className, style, ...props} = t0);
|
|
217
|
+
$[0] = t0;
|
|
218
|
+
$[1] = children;
|
|
219
|
+
$[2] = className;
|
|
220
|
+
$[3] = loading;
|
|
221
|
+
$[4] = placeholder;
|
|
222
|
+
$[5] = props;
|
|
223
|
+
$[6] = style;
|
|
224
|
+
} else {
|
|
225
|
+
children = $[1];
|
|
226
|
+
className = $[2];
|
|
227
|
+
loading = $[3];
|
|
228
|
+
placeholder = $[4];
|
|
229
|
+
props = $[5];
|
|
230
|
+
style = $[6];
|
|
231
|
+
}
|
|
232
|
+
const reduceMotion = usePrefersReducedMotion();
|
|
233
|
+
const contentRef = useRef(null);
|
|
234
|
+
useMorphHeight(contentRef, loading, reduceMotion);
|
|
235
|
+
const t1 = reduceMotion ? ARC_DURATION.instant : ARC_DURATION.fast;
|
|
236
|
+
let t2;
|
|
237
|
+
if ($[7] !== t1) {
|
|
238
|
+
t2 = { duration: t1 };
|
|
239
|
+
$[7] = t1;
|
|
240
|
+
$[8] = t2;
|
|
241
|
+
} else {
|
|
242
|
+
t2 = $[8];
|
|
243
|
+
}
|
|
244
|
+
const exitTransition = t2;
|
|
245
|
+
const t3 = props;
|
|
246
|
+
let t4;
|
|
247
|
+
if ($[9] !== children || $[10] !== exitTransition || $[11] !== loading || $[12] !== placeholder || $[13] !== reduceMotion) {
|
|
248
|
+
t4 = /* @__PURE__ */ _jsx("div", {
|
|
249
|
+
ref: contentRef,
|
|
250
|
+
className: "relative flow-root",
|
|
251
|
+
children: /* @__PURE__ */ _jsx(AnimatePresence, {
|
|
252
|
+
mode: "popLayout",
|
|
253
|
+
initial: false,
|
|
254
|
+
children: loading ? /* @__PURE__ */ _jsx(SkeletonBranch, {
|
|
255
|
+
initial: { opacity: 0 },
|
|
256
|
+
animate: { opacity: 1 },
|
|
257
|
+
exit: {
|
|
258
|
+
opacity: 0,
|
|
259
|
+
transition: exitTransition
|
|
260
|
+
},
|
|
261
|
+
transition: {
|
|
262
|
+
duration: reduceMotion ? ARC_DURATION.instant : ARC_DURATION.fast,
|
|
263
|
+
ease: [...ARC_EASE.standard]
|
|
264
|
+
},
|
|
265
|
+
children: placeholder
|
|
266
|
+
}, "placeholder") : /* @__PURE__ */ _jsx(SkeletonBranch, {
|
|
267
|
+
initial: reduceMotion ? { opacity: 0 } : {
|
|
268
|
+
opacity: 0,
|
|
269
|
+
y: SKELETON_REVEAL_OFFSET_PX
|
|
270
|
+
},
|
|
271
|
+
animate: {
|
|
272
|
+
opacity: 1,
|
|
273
|
+
y: 0
|
|
274
|
+
},
|
|
275
|
+
exit: {
|
|
276
|
+
opacity: 0,
|
|
277
|
+
transition: exitTransition
|
|
278
|
+
},
|
|
279
|
+
transition: {
|
|
280
|
+
duration: reduceMotion ? ARC_DURATION.instant : ARC_DURATION.standard,
|
|
281
|
+
ease: [...ARC_EASE.enter]
|
|
282
|
+
},
|
|
283
|
+
children
|
|
284
|
+
}, "content")
|
|
285
|
+
})
|
|
286
|
+
});
|
|
287
|
+
$[9] = children;
|
|
288
|
+
$[10] = exitTransition;
|
|
289
|
+
$[11] = loading;
|
|
290
|
+
$[12] = placeholder;
|
|
291
|
+
$[13] = reduceMotion;
|
|
292
|
+
$[14] = t4;
|
|
293
|
+
} else {
|
|
294
|
+
t4 = $[14];
|
|
295
|
+
}
|
|
296
|
+
let t5;
|
|
297
|
+
if ($[15] !== className || $[16] !== loading || $[17] !== style || $[18] !== t3 || $[19] !== t4) {
|
|
298
|
+
t5 = /* @__PURE__ */ _jsx(motion.div, {
|
|
299
|
+
"data-slot": "skeleton-reveal",
|
|
300
|
+
"aria-busy": loading,
|
|
301
|
+
className,
|
|
302
|
+
...t3,
|
|
303
|
+
style,
|
|
304
|
+
children: t4
|
|
305
|
+
});
|
|
306
|
+
$[15] = className;
|
|
307
|
+
$[16] = loading;
|
|
308
|
+
$[17] = style;
|
|
309
|
+
$[18] = t3;
|
|
310
|
+
$[19] = t4;
|
|
311
|
+
$[20] = t5;
|
|
312
|
+
} else {
|
|
313
|
+
t5 = $[20];
|
|
314
|
+
}
|
|
315
|
+
return t5;
|
|
316
|
+
}
|
|
4
317
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @param props -
|
|
8
|
-
* @returns The placeholder
|
|
318
|
+
* Reserves space while content loads. Without Arc's props it is a bare block sized by `className`; with `lines` or
|
|
319
|
+
* `avatar` it draws Arc's composed placeholder; with `loading` it reveals `children` once loading finishes.
|
|
320
|
+
* @param props - Optional placeholder shape, label and loading state, plus native div attributes.
|
|
321
|
+
* @returns The placeholder, or the reveal frame when `loading` is set.
|
|
9
322
|
*/
|
|
10
|
-
function Skeleton(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
323
|
+
function Skeleton(t0) {
|
|
324
|
+
const $ = _c(30);
|
|
325
|
+
let avatar;
|
|
326
|
+
let children;
|
|
327
|
+
let className;
|
|
328
|
+
let lines;
|
|
329
|
+
let loading;
|
|
330
|
+
let props;
|
|
331
|
+
let t1;
|
|
332
|
+
if ($[0] !== t0) {
|
|
333
|
+
({lines, avatar, label: t1, loading, className, children, ...props} = t0);
|
|
334
|
+
$[0] = t0;
|
|
335
|
+
$[1] = avatar;
|
|
336
|
+
$[2] = children;
|
|
337
|
+
$[3] = className;
|
|
338
|
+
$[4] = lines;
|
|
339
|
+
$[5] = loading;
|
|
340
|
+
$[6] = props;
|
|
341
|
+
$[7] = t1;
|
|
342
|
+
} else {
|
|
343
|
+
avatar = $[1];
|
|
344
|
+
children = $[2];
|
|
345
|
+
className = $[3];
|
|
346
|
+
lines = $[4];
|
|
347
|
+
loading = $[5];
|
|
348
|
+
props = $[6];
|
|
349
|
+
t1 = $[7];
|
|
350
|
+
}
|
|
351
|
+
const label = t1 === undefined ? SKELETON_DEFAULT_LABEL : t1;
|
|
352
|
+
const t2 = lines ?? SKELETON_DEFAULT_LINES;
|
|
353
|
+
const t3 = avatar ?? false;
|
|
354
|
+
let t4;
|
|
355
|
+
if ($[8] !== label || $[9] !== t2 || $[10] !== t3) {
|
|
356
|
+
t4 = {
|
|
357
|
+
lines: t2,
|
|
358
|
+
avatar: t3,
|
|
359
|
+
label
|
|
360
|
+
};
|
|
361
|
+
$[8] = label;
|
|
362
|
+
$[9] = t2;
|
|
363
|
+
$[10] = t3;
|
|
364
|
+
$[11] = t4;
|
|
365
|
+
} else {
|
|
366
|
+
t4 = $[11];
|
|
367
|
+
}
|
|
368
|
+
const shape = t4;
|
|
369
|
+
if (loading !== undefined) {
|
|
370
|
+
let t5;
|
|
371
|
+
if ($[12] !== shape) {
|
|
372
|
+
t5 = /* @__PURE__ */ _jsx(SkeletonPlaceholder, { ...shape });
|
|
373
|
+
$[12] = shape;
|
|
374
|
+
$[13] = t5;
|
|
375
|
+
} else {
|
|
376
|
+
t5 = $[13];
|
|
377
|
+
}
|
|
378
|
+
let t6;
|
|
379
|
+
if ($[14] !== children || $[15] !== className || $[16] !== loading || $[17] !== props || $[18] !== t5) {
|
|
380
|
+
t6 = /* @__PURE__ */ _jsx(SkeletonReveal, {
|
|
381
|
+
loading,
|
|
382
|
+
placeholder: t5,
|
|
383
|
+
className,
|
|
384
|
+
...props,
|
|
385
|
+
children
|
|
386
|
+
});
|
|
387
|
+
$[14] = children;
|
|
388
|
+
$[15] = className;
|
|
389
|
+
$[16] = loading;
|
|
390
|
+
$[17] = props;
|
|
391
|
+
$[18] = t5;
|
|
392
|
+
$[19] = t6;
|
|
393
|
+
} else {
|
|
394
|
+
t6 = $[19];
|
|
395
|
+
}
|
|
396
|
+
return t6;
|
|
397
|
+
}
|
|
398
|
+
if (lines !== undefined || avatar) {
|
|
399
|
+
let t5;
|
|
400
|
+
if ($[20] !== className || $[21] !== props || $[22] !== shape) {
|
|
401
|
+
t5 = /* @__PURE__ */ _jsx(SkeletonPlaceholder, {
|
|
402
|
+
...shape,
|
|
403
|
+
className,
|
|
404
|
+
...props
|
|
405
|
+
});
|
|
406
|
+
$[20] = className;
|
|
407
|
+
$[21] = props;
|
|
408
|
+
$[22] = shape;
|
|
409
|
+
$[23] = t5;
|
|
410
|
+
} else {
|
|
411
|
+
t5 = $[23];
|
|
412
|
+
}
|
|
413
|
+
return t5;
|
|
414
|
+
}
|
|
415
|
+
let t5;
|
|
416
|
+
if ($[24] !== className) {
|
|
417
|
+
t5 = cn(blockClassName, className);
|
|
418
|
+
$[24] = className;
|
|
419
|
+
$[25] = t5;
|
|
420
|
+
} else {
|
|
421
|
+
t5 = $[25];
|
|
422
|
+
}
|
|
423
|
+
let t6;
|
|
424
|
+
if ($[26] !== children || $[27] !== props || $[28] !== t5) {
|
|
425
|
+
t6 = /* @__PURE__ */ _jsx("div", {
|
|
14
426
|
"data-slot": "skeleton",
|
|
15
|
-
className:
|
|
16
|
-
...props
|
|
17
|
-
|
|
18
|
-
|
|
427
|
+
className: t5,
|
|
428
|
+
...props,
|
|
429
|
+
children
|
|
430
|
+
});
|
|
431
|
+
$[26] = children;
|
|
432
|
+
$[27] = props;
|
|
433
|
+
$[28] = t5;
|
|
434
|
+
$[29] = t6;
|
|
435
|
+
} else {
|
|
436
|
+
t6 = $[29];
|
|
437
|
+
}
|
|
438
|
+
return t6;
|
|
19
439
|
}
|
|
20
440
|
export { Skeleton };
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
2
|
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import type { SwitchSize } from "../constants/switch.js";
|
|
4
|
+
export type SwitchProps = ComponentProps<typeof SwitchPrimitive.Root> & {
|
|
5
|
+
/** Track size: Arc's 42 by 24 track (`default`) or a compact one for dense rows (`sm`). */
|
|
6
|
+
size?: SwitchSize;
|
|
7
|
+
/** Visible text rendered inside the control, after the track; it also names the switch. */
|
|
8
|
+
label?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A binary setting that applies at once, controlled or uncontrolled like Radix's switch.
|
|
12
|
+
* @param switchProps - Every Radix switch prop, including `ref`, plus the Arc `size` and `label`.
|
|
13
|
+
* @returns The switch button, with its label inside when one is passed.
|
|
14
|
+
*/
|
|
15
|
+
declare function Switch({ className, size, label, checked, defaultChecked, onCheckedChange, onPointerDown, onPointerUp, onPointerLeave, onPointerCancel, onKeyDown, onKeyUp, onBlur, disabled, "aria-label": ariaLabel, ...props }: SwitchProps): import("react").JSX.Element;
|
|
6
16
|
export { Switch };
|