@nsaa/core 0.1.0-alpha.1 → 0.1.0-alpha.3
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/README.md +30 -8
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/accordion/accordion.d.ts +7 -0
- package/dist/accordion/accordion.js +54 -0
- package/dist/accordion/index.d.ts +3 -0
- package/dist/alert/alert.d.ts +19 -0
- package/dist/alert/alert.js +58 -0
- package/dist/alert/index.d.ts +3 -0
- package/dist/alert-dialog/alert-dialog.d.ts +19 -0
- package/dist/alert-dialog/alert-dialog.js +106 -0
- package/dist/alert-dialog/index.d.ts +3 -0
- package/dist/avatar/avatar.d.ts +12 -0
- package/dist/avatar/avatar.js +50 -0
- package/dist/avatar/index.d.ts +3 -0
- package/dist/badge/badge.d.ts +8 -0
- package/dist/badge/badge.js +29 -0
- package/dist/badge/index.d.ts +3 -0
- package/dist/button/button.d.ts +25 -0
- package/dist/button/button.js +136 -0
- package/dist/button/index.d.ts +3 -0
- package/dist/calendar/calendar.d.ts +11 -0
- package/dist/calendar/calendar.js +131 -0
- package/dist/calendar/index.d.ts +3 -0
- package/dist/card/card.d.ts +12 -0
- package/dist/card/card.js +55 -0
- package/dist/card/index.d.ts +3 -0
- package/dist/checkbox/checkbox.d.ts +4 -0
- package/dist/checkbox/checkbox.js +35 -0
- package/dist/checkbox/index.d.ts +3 -0
- package/dist/collapsible/collapsible.d.ts +6 -0
- package/dist/collapsible/collapsible.js +24 -0
- package/dist/collapsible/index.d.ts +3 -0
- package/dist/combobox/combobox.d.ts +27 -0
- package/dist/combobox/combobox.js +226 -0
- package/dist/combobox/index.d.ts +3 -0
- package/dist/command/command.d.ts +20 -0
- package/dist/command/command.js +116 -0
- package/dist/command/index.d.ts +3 -0
- package/dist/context-menu/context-menu.d.ts +30 -0
- package/dist/context-menu/context-menu.js +173 -0
- package/dist/context-menu/index.d.ts +3 -0
- package/dist/dialog/dialog.d.ts +18 -0
- package/dist/dialog/dialog.js +112 -0
- package/dist/dialog/index.d.ts +3 -0
- package/dist/direction.d.ts +3 -0
- package/dist/direction.js +2 -0
- package/dist/drawer/drawer.d.ts +17 -0
- package/dist/drawer/drawer.js +136 -0
- package/dist/drawer/index.d.ts +3 -0
- package/dist/dropdown-menu/dropdown-menu.d.ts +30 -0
- package/dist/dropdown-menu/dropdown-menu.js +177 -0
- package/dist/dropdown-menu/index.d.ts +3 -0
- package/dist/empty/empty.d.ts +35 -0
- package/dist/empty/empty.js +93 -0
- package/dist/empty/index.d.ts +3 -0
- package/dist/field/field.d.ts +26 -0
- package/dist/field/field.js +109 -0
- package/dist/field/index.d.ts +3 -0
- package/dist/index.d.ts +90 -674
- package/dist/index.js +50 -3877
- package/dist/input/index.d.ts +3 -0
- package/dist/input/input.d.ts +4 -0
- package/dist/input/input.js +14 -0
- package/dist/input-group/index.d.ts +3 -0
- package/dist/input-group/input-group.d.ts +19 -0
- package/dist/input-group/input-group.js +78 -0
- package/dist/input-otp/index.d.ts +3 -0
- package/dist/input-otp/input-otp.d.ts +12 -0
- package/dist/input-otp/input-otp.js +73 -0
- package/dist/kbd/index.d.ts +3 -0
- package/dist/kbd/kbd.d.ts +5 -0
- package/dist/kbd/kbd.js +19 -0
- package/dist/label/index.d.ts +3 -0
- package/dist/label/label.d.ts +4 -0
- package/dist/label/label.js +13 -0
- package/dist/legacy/icon-button/icon-swap.js +58 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/{cn-DxFBFdwT.js → lib/cn.js} +1 -1
- package/dist/lib/control-defaults.js +8 -0
- package/dist/lib/icon-swap.d.ts +15 -0
- package/dist/lib/icon-swap.js +26 -0
- package/dist/lib/input-modality.js +39 -0
- package/dist/lib/merge-refs.js +21 -0
- package/dist/lib/opener.js +29 -0
- package/dist/lib/shortcut.js +50 -0
- package/dist/lib/track-input-modality.d.ts +2 -0
- package/dist/lib/track-input-modality.js +4 -0
- package/dist/lib/tv.js +7 -0
- package/dist/lib/use-press.js +48 -0
- package/dist/lib/user-action.js +13 -0
- package/dist/loaders/arc.d.ts +6 -0
- package/dist/loaders/arc.js +31 -0
- package/dist/loaders/atom.d.ts +5 -0
- package/dist/loaders/atom.js +70 -0
- package/dist/loaders/blocks.d.ts +8 -0
- package/dist/loaders/blocks.js +74 -0
- package/dist/loaders/bouncing-dots.d.ts +3 -0
- package/dist/loaders/bouncing-dots.js +45 -0
- package/dist/loaders/cap.d.ts +6 -0
- package/dist/loaders/cap.js +7 -0
- package/dist/loaders/cascade.d.ts +5 -0
- package/dist/loaders/cascade.js +50 -0
- package/dist/loaders/circular-dots.d.ts +3 -0
- package/dist/loaders/circular-dots.js +40 -0
- package/dist/loaders/classic-v2.d.ts +3 -0
- package/dist/loaders/classic-v2.js +41 -0
- package/dist/loaders/classic.d.ts +3 -0
- package/dist/loaders/classic.js +48 -0
- package/dist/loaders/clock.d.ts +5 -0
- package/dist/loaders/clock.js +31 -0
- package/dist/loaders/comet.d.ts +5 -0
- package/dist/loaders/comet.js +52 -0
- package/dist/loaders/compass.d.ts +3 -0
- package/dist/loaders/compass.js +39 -0
- package/dist/loaders/dual.d.ts +6 -0
- package/dist/loaders/dual.js +47 -0
- package/dist/loaders/easing.d.ts +6 -0
- package/dist/loaders/easing.js +34 -0
- package/dist/loaders/eclipse.d.ts +3 -0
- package/dist/loaders/eclipse.js +69 -0
- package/dist/loaders/fade.js +28 -0
- package/dist/loaders/flip.d.ts +3 -0
- package/dist/loaders/flip.js +41 -0
- package/dist/{frame-CK9IBOZB.js → loaders/frame.js} +2 -50
- package/dist/loaders/gather.d.ts +3 -0
- package/dist/loaders/gather.js +85 -0
- package/dist/loaders/leap.d.ts +3 -0
- package/dist/loaders/leap.js +67 -0
- package/dist/loaders/linear-dots.d.ts +3 -0
- package/dist/loaders/linear-dots.js +54 -0
- package/dist/loaders/loading.d.ts +3 -0
- package/dist/loaders/loading.js +64 -0
- package/dist/loaders/morph.d.ts +3 -0
- package/dist/loaders/morph.js +40 -0
- package/dist/loaders/motion.d.ts +35 -0
- package/dist/loaders/motion.js +51 -0
- package/dist/loaders/orbit.d.ts +5 -0
- package/dist/loaders/orbit.js +44 -0
- package/dist/loaders/pulse.d.ts +3 -0
- package/dist/loaders/pulse.js +52 -0
- package/dist/loaders/radar.d.ts +5 -0
- package/dist/loaders/radar.js +64 -0
- package/dist/loaders/ring.d.ts +6 -0
- package/dist/loaders/ring.js +38 -0
- package/dist/loaders/ripple.d.ts +8 -0
- package/dist/loaders/ripple.js +57 -0
- package/dist/loaders/slide.d.ts +3 -0
- package/dist/loaders/slide.js +74 -0
- package/dist/loaders/snake.d.ts +6 -0
- package/dist/loaders/snake.js +59 -0
- package/dist/loaders/spinners.d.ts +61 -0
- package/dist/loaders/spinners.js +63 -0
- package/dist/loaders/swirl.d.ts +3 -0
- package/dist/loaders/swirl.js +50 -0
- package/dist/loaders/text/shared.js +25 -0
- package/dist/loaders/text/text-loaders.d.ts +48 -0
- package/dist/loaders/text/text-loaders.js +723 -0
- package/dist/loaders/trace.d.ts +6 -0
- package/dist/loaders/trace.js +46 -0
- package/dist/loaders/types.d.ts +10 -0
- package/dist/loaders/wave.d.ts +8 -0
- package/dist/loaders/wave.js +59 -0
- package/dist/loaders-text.d.ts +2 -47
- package/dist/loaders-text.js +1 -743
- package/dist/loaders.d.ts +36 -132
- package/dist/loaders.js +35 -1096
- package/dist/native-select/index.d.ts +3 -0
- package/dist/native-select/native-select.d.ts +9 -0
- package/dist/native-select/native-select.js +44 -0
- package/dist/pagination/index.d.ts +3 -0
- package/dist/pagination/pagination.d.ts +18 -0
- package/dist/pagination/pagination.js +134 -0
- package/dist/popover/index.d.ts +3 -0
- package/dist/popover/popover.d.ts +10 -0
- package/dist/popover/popover.js +54 -0
- package/dist/radio-group/index.d.ts +3 -0
- package/dist/radio-group/radio-group.d.ts +6 -0
- package/dist/radio-group/radio-group.js +33 -0
- package/dist/select/index.d.ts +3 -0
- package/dist/select/select.d.ts +16 -0
- package/dist/select/select.js +148 -0
- package/dist/separator/index.d.ts +3 -0
- package/dist/separator/separator.d.ts +4 -0
- package/dist/separator/separator.js +15 -0
- package/dist/skeleton/index.d.ts +3 -0
- package/dist/skeleton/skeleton.d.ts +10 -0
- package/dist/skeleton/skeleton.js +24 -0
- package/dist/slider/index.d.ts +3 -0
- package/dist/slider/slider.d.ts +4 -0
- package/dist/slider/slider.js +39 -0
- package/dist/sound/lazy-uisfx.d.ts +20 -0
- package/dist/sound/lazy-uisfx.js +68 -0
- package/dist/sound/sound-map.d.ts +72 -0
- package/dist/sound/sound-map.js +76 -0
- package/dist/sound/sound.d.ts +38 -0
- package/dist/sound/sound.js +136 -0
- package/dist/sound/uisfx.d.ts +41 -0
- package/dist/sound/uisfx.js +59 -0
- package/dist/sound-uisfx.d.ts +2 -37
- package/dist/sound-uisfx.js +1 -58
- package/dist/sources/accordion.css +3 -0
- package/dist/sources/alert-dialog.css +26 -0
- package/dist/sources/alert.css +8 -0
- package/dist/sources/avatar.css +3 -0
- package/dist/sources/badge.css +3 -0
- package/dist/sources/button.css +24 -0
- package/dist/sources/calendar.css +25 -0
- package/dist/sources/card.css +3 -0
- package/dist/sources/checkbox.css +6 -0
- package/dist/sources/collapsible.css +2 -0
- package/dist/sources/combobox.css +28 -0
- package/dist/sources/command.css +30 -0
- package/dist/sources/context-menu.css +6 -0
- package/dist/sources/dialog.css +26 -0
- package/dist/sources/drawer.css +6 -0
- package/dist/sources/dropdown-menu.css +6 -0
- package/dist/sources/empty.css +3 -0
- package/dist/sources/field.css +5 -0
- package/dist/sources/input-group.css +27 -0
- package/dist/sources/input-otp.css +8 -0
- package/dist/sources/input.css +3 -0
- package/dist/sources/kbd.css +3 -0
- package/dist/sources/label.css +3 -0
- package/dist/sources/loaders-text.css +8 -0
- package/dist/sources/loaders.css +40 -0
- package/dist/sources/native-select.css +3 -0
- package/dist/sources/pagination.css +25 -0
- package/dist/sources/popover.css +3 -0
- package/dist/sources/radio-group.css +6 -0
- package/dist/sources/select.css +6 -0
- package/dist/sources/separator.css +3 -0
- package/dist/sources/skeleton.css +3 -0
- package/dist/sources/slider.css +6 -0
- package/dist/sources/spinner.css +20 -0
- package/dist/sources/switch.css +6 -0
- package/dist/sources/table.css +3 -0
- package/dist/sources/tabs.css +3 -0
- package/dist/sources/textarea.css +3 -0
- package/dist/sources/toast.css +25 -0
- package/dist/sources/toggle-group.css +32 -0
- package/dist/sources/toolbar.css +34 -0
- package/dist/sources/tooltip.css +3 -0
- package/dist/spinner/index.d.ts +5 -0
- package/dist/spinner/loader-provider.d.ts +16 -0
- package/dist/spinner/loader-provider.js +28 -0
- package/dist/spinner/registry.d.ts +9 -0
- package/dist/spinner/registry.js +15 -0
- package/dist/spinner/spinner.d.ts +26 -0
- package/dist/spinner/spinner.js +143 -0
- package/dist/switch/index.d.ts +3 -0
- package/dist/switch/switch.d.ts +6 -0
- package/dist/switch/switch.js +25 -0
- package/dist/table/index.d.ts +3 -0
- package/dist/table/table.d.ts +17 -0
- package/dist/table/table.js +66 -0
- package/dist/tabs/index.d.ts +3 -0
- package/dist/tabs/tabs.d.ts +11 -0
- package/dist/tabs/tabs.js +46 -0
- package/dist/textarea/index.d.ts +3 -0
- package/dist/textarea/textarea.d.ts +4 -0
- package/dist/textarea/textarea.js +12 -0
- package/dist/toast/index.d.ts +3 -0
- package/dist/toast/toast.d.ts +17 -0
- package/dist/toast/toast.js +211 -0
- package/dist/toggle-group/index.d.ts +3 -0
- package/dist/toggle-group/toggle-group.d.ts +64 -0
- package/dist/toggle-group/toggle-group.js +95 -0
- package/dist/tokens/dist/motion.d.ts +24 -0
- package/dist/{motion-NQq2BA78.js → tokens/dist/motion.js} +1 -1
- package/dist/toolbar/index.d.ts +3 -0
- package/dist/toolbar/overflow.d.ts +4 -0
- package/dist/toolbar/overflow.js +242 -0
- package/dist/toolbar/toolbar-item.d.ts +29 -0
- package/dist/toolbar/toolbar-item.js +71 -0
- package/dist/toolbar/toolbar.d.ts +73 -0
- package/dist/toolbar/toolbar.js +250 -0
- package/dist/tooltip/index.d.ts +3 -0
- package/dist/tooltip/tooltip.d.ts +7 -0
- package/dist/tooltip/tooltip.js +41 -0
- package/package.json +9 -5
- package/src/feel.css +52 -0
- package/src/styles-base.css +142 -0
- package/src/styles.css +3 -133
- package/dist/registry-2PyPW9Xw.js +0 -390
- package/dist/registry-DjfWNw3R.d.ts +0 -18
- package/dist/sound-DiYNAnR_.d.ts +0 -61
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { loader } from "../tokens/dist/motion.js";
|
|
4
|
+
import { useSound } from "../sound/sound.js";
|
|
5
|
+
import { Arc } from "../loaders/arc.js";
|
|
6
|
+
import { BouncingDots } from "../loaders/bouncing-dots.js";
|
|
7
|
+
import { CircularDots } from "../loaders/circular-dots.js";
|
|
8
|
+
import { Classic } from "../loaders/classic.js";
|
|
9
|
+
import { Orbit } from "../loaders/orbit.js";
|
|
10
|
+
import { Pulse } from "../loaders/pulse.js";
|
|
11
|
+
import { Ring } from "../loaders/ring.js";
|
|
12
|
+
import { Wave } from "../loaders/wave.js";
|
|
13
|
+
import { useLoaderContext } from "./loader-provider.js";
|
|
14
|
+
import { getLoader, registerLoaders } from "./registry.js";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
import * as React from "react";
|
|
17
|
+
// src/spinner/spinner.tsx
|
|
18
|
+
registerLoaders({
|
|
19
|
+
arc: Arc,
|
|
20
|
+
ring: Ring,
|
|
21
|
+
classic: Classic,
|
|
22
|
+
"circular-dots": CircularDots,
|
|
23
|
+
"bouncing-dots": BouncingDots,
|
|
24
|
+
pulse: Pulse,
|
|
25
|
+
orbit: Orbit,
|
|
26
|
+
wave: Wave
|
|
27
|
+
});
|
|
28
|
+
/** The decorative glyph: a registered loader (Arc when the name isn't registered) or shadcn's Loader2. */
|
|
29
|
+
function glyph(variant) {
|
|
30
|
+
if (variant !== "lucide") return React.createElement(getLoader(variant) ?? Arc);
|
|
31
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
32
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
33
|
+
viewBox: "0 0 24 24",
|
|
34
|
+
fill: "none",
|
|
35
|
+
stroke: "currentColor",
|
|
36
|
+
strokeWidth: "2",
|
|
37
|
+
strokeLinecap: "round",
|
|
38
|
+
strokeLinejoin: "round",
|
|
39
|
+
"aria-hidden": "true",
|
|
40
|
+
"data-loader": "lucide",
|
|
41
|
+
className: "animate-spin",
|
|
42
|
+
children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/** Paused while scrolled out of view or while the tab is hidden (performance, #63). */
|
|
46
|
+
function useOutOfSight(element, active) {
|
|
47
|
+
const [offscreen, setOffscreen] = React.useState(false);
|
|
48
|
+
const [hidden, setHidden] = React.useState(false);
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
if (!active) return;
|
|
51
|
+
const el = element.current;
|
|
52
|
+
const onVisibility = () => setHidden(document.visibilityState === "hidden");
|
|
53
|
+
onVisibility();
|
|
54
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
55
|
+
let observer;
|
|
56
|
+
if (el && typeof IntersectionObserver !== "undefined") {
|
|
57
|
+
observer = new IntersectionObserver(([entry]) => setOffscreen(!entry?.isIntersecting));
|
|
58
|
+
observer.observe(el);
|
|
59
|
+
}
|
|
60
|
+
return () => {
|
|
61
|
+
document.removeEventListener("visibilitychange", onVisibility);
|
|
62
|
+
observer?.disconnect();
|
|
63
|
+
};
|
|
64
|
+
}, [element, active]);
|
|
65
|
+
return offscreen || hidden;
|
|
66
|
+
}
|
|
67
|
+
function Spinner({ variant = "arc", size, label, delay: delayProp, minDisplay = loader["min-display"], loading = true, duration, paused = false, sound = false, className, style, ...props }) {
|
|
68
|
+
const context = useLoaderContext();
|
|
69
|
+
const root = React.useRef(null);
|
|
70
|
+
const delay = delayProp ?? loader.delay;
|
|
71
|
+
const [phase, setPhase] = React.useState(!loading ? "hidden" : delay > 0 ? "pending" : "shown");
|
|
72
|
+
const shownAt = React.useRef(0);
|
|
73
|
+
const [wasLoading, setWasLoading] = React.useState(loading);
|
|
74
|
+
if (loading !== wasLoading) {
|
|
75
|
+
setWasLoading(loading);
|
|
76
|
+
if (loading && phase === "hidden") setPhase(delay > 0 ? "pending" : "shown");
|
|
77
|
+
if (!loading && phase === "pending") setPhase("hidden");
|
|
78
|
+
}
|
|
79
|
+
React.useEffect(() => {
|
|
80
|
+
if (phase === "shown") shownAt.current = Date.now();
|
|
81
|
+
}, [phase]);
|
|
82
|
+
React.useEffect(() => {
|
|
83
|
+
if (loading && phase === "pending") {
|
|
84
|
+
const timer = setTimeout(() => setPhase("shown"), delay);
|
|
85
|
+
return () => clearTimeout(timer);
|
|
86
|
+
}
|
|
87
|
+
if (!loading && phase === "shown") {
|
|
88
|
+
const left = shownAt.current + minDisplay - Date.now();
|
|
89
|
+
const timer = setTimeout(() => setPhase("hidden"), Math.max(0, left));
|
|
90
|
+
return () => clearTimeout(timer);
|
|
91
|
+
}
|
|
92
|
+
}, [
|
|
93
|
+
loading,
|
|
94
|
+
phase,
|
|
95
|
+
delay,
|
|
96
|
+
minDisplay
|
|
97
|
+
]);
|
|
98
|
+
const pendingRef = React.useCallback((node) => {
|
|
99
|
+
root.current = node;
|
|
100
|
+
if (node?.closest("button, [role=\"button\"], [data-slot=\"input-group\"]")) setPhase("shown");
|
|
101
|
+
}, []);
|
|
102
|
+
const outOfSight = useOutOfSight(root, phase === "shown");
|
|
103
|
+
const { loop } = useSound();
|
|
104
|
+
const audible = sound && phase === "shown" && !paused && !outOfSight;
|
|
105
|
+
React.useEffect(() => {
|
|
106
|
+
if (!audible) return;
|
|
107
|
+
return loop("progress.loop");
|
|
108
|
+
}, [audible, loop]);
|
|
109
|
+
if (phase === "hidden") return null;
|
|
110
|
+
if (phase === "pending") return /* @__PURE__ */ jsx("span", {
|
|
111
|
+
ref: pendingRef,
|
|
112
|
+
role: "status",
|
|
113
|
+
"data-slot": "spinner",
|
|
114
|
+
"data-pending": "",
|
|
115
|
+
className,
|
|
116
|
+
style,
|
|
117
|
+
...props
|
|
118
|
+
});
|
|
119
|
+
const vars = {
|
|
120
|
+
...size === void 0 && /(^|\s)size-/.test(className ?? "") ? { "--nsaa-loader-size": "100%" } : null,
|
|
121
|
+
...size === void 0 ? null : { "--nsaa-loader-size": typeof size === "number" ? `${size}px` : `var(--nsaa-loader-size-${size})` },
|
|
122
|
+
...duration === void 0 ? null : { "--nsaa-loader-duration": `${duration}ms` }
|
|
123
|
+
};
|
|
124
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
125
|
+
ref: root,
|
|
126
|
+
role: "status",
|
|
127
|
+
"data-slot": "spinner",
|
|
128
|
+
"data-variant": variant,
|
|
129
|
+
"data-loader-paused": paused || outOfSight ? "" : void 0,
|
|
130
|
+
className: cn("inline-flex shrink-0 items-center gap-1.5", className),
|
|
131
|
+
style: {
|
|
132
|
+
...vars,
|
|
133
|
+
...style
|
|
134
|
+
},
|
|
135
|
+
...props,
|
|
136
|
+
children: [glyph(variant), /* @__PURE__ */ jsx("span", {
|
|
137
|
+
"data-slot": "spinner-label",
|
|
138
|
+
className: "sr-only",
|
|
139
|
+
children: label ?? context.label ?? "Loading"
|
|
140
|
+
})]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
export { Spinner };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { useCue } from "../sound/sound-map.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Switch } from "@base-ui/react/switch";
|
|
7
|
+
// src/switch/switch.tsx
|
|
8
|
+
function Switch$1({ className, size = "default", onCheckedChange, ...props }) {
|
|
9
|
+
const cue = useCue("switch");
|
|
10
|
+
return /* @__PURE__ */ jsx(Switch.Root, {
|
|
11
|
+
"data-slot": "switch",
|
|
12
|
+
"data-size": size,
|
|
13
|
+
className: cn("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50", className),
|
|
14
|
+
onCheckedChange: (checked, details) => {
|
|
15
|
+
onCheckedChange?.(checked, details);
|
|
16
|
+
if (!details.isCanceled) cue(checked ? "on" : "off");
|
|
17
|
+
},
|
|
18
|
+
...props,
|
|
19
|
+
children: /* @__PURE__ */ jsx(Switch.Thumb, {
|
|
20
|
+
"data-slot": "switch-thumb",
|
|
21
|
+
className: "pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export { Switch$1 as Switch };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare function Table({ className, containerProps, ...props }: React.ComponentProps<"table"> & {
|
|
4
|
+
/**
|
|
5
|
+
* Props for the scrolling container (Nsaa, #123). A table wider than its box scrolls inside it,
|
|
6
|
+
* so give it `tabIndex={0}`, `role="region"` and an `aria-label` to make it reachable by keyboard.
|
|
7
|
+
*/
|
|
8
|
+
containerProps?: React.ComponentProps<"div">;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
|
|
11
|
+
declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
|
|
12
|
+
declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
|
|
13
|
+
declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): React.JSX.Element;
|
|
14
|
+
declare function TableHead({ className, ...props }: React.ComponentProps<"th">): React.JSX.Element;
|
|
15
|
+
declare function TableCell({ className, ...props }: React.ComponentProps<"td">): React.JSX.Element;
|
|
16
|
+
declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
|
|
17
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/table/table.tsx
|
|
5
|
+
function Table({ className, containerProps, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
"data-slot": "table-container",
|
|
8
|
+
...containerProps,
|
|
9
|
+
className: cn("relative w-full overflow-x-auto", containerProps?.className),
|
|
10
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
11
|
+
"data-slot": "table",
|
|
12
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
13
|
+
...props
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function TableHeader({ className, ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
19
|
+
"data-slot": "table-header",
|
|
20
|
+
className: cn("[&_tr]:border-b", className),
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function TableBody({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
26
|
+
"data-slot": "table-body",
|
|
27
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function TableFooter({ className, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx("tfoot", {
|
|
33
|
+
"data-slot": "table-footer",
|
|
34
|
+
className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function TableRow({ className, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
40
|
+
"data-slot": "table-row",
|
|
41
|
+
className: cn("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted", className),
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function TableHead({ className, ...props }) {
|
|
46
|
+
return /* @__PURE__ */ jsx("th", {
|
|
47
|
+
"data-slot": "table-head",
|
|
48
|
+
className: cn("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0", className),
|
|
49
|
+
...props
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function TableCell({ className, ...props }) {
|
|
53
|
+
return /* @__PURE__ */ jsx("td", {
|
|
54
|
+
"data-slot": "table-cell",
|
|
55
|
+
className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0", className),
|
|
56
|
+
...props
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function TableCaption({ className, ...props }) {
|
|
60
|
+
return /* @__PURE__ */ jsx("caption", {
|
|
61
|
+
"data-slot": "table-caption",
|
|
62
|
+
className: cn("mt-4 text-sm text-muted-foreground", className),
|
|
63
|
+
...props
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import { Tabs } from "@base-ui/react/tabs";
|
|
4
|
+
declare function Tabs$1({ className, orientation, ...props }: Tabs.Root.Props): import("react").JSX.Element;
|
|
5
|
+
declare const tabsListVariants: (props?: ({
|
|
6
|
+
variant?: "default" | "line" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare function TabsList({ className, variant, ...props }: Tabs.List.Props & VariantProps<typeof tabsListVariants>): import("react").JSX.Element;
|
|
9
|
+
declare function TabsTrigger({ className, ...props }: Tabs.Tab.Props): import("react").JSX.Element;
|
|
10
|
+
declare function TabsContent({ className, ...props }: Tabs.Panel.Props): import("react").JSX.Element;
|
|
11
|
+
export { Tabs$1 as Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { Tabs } from "@base-ui/react/tabs";
|
|
7
|
+
// src/tabs/tabs.tsx
|
|
8
|
+
function Tabs$1({ className, orientation = "horizontal", ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Tabs.Root, {
|
|
10
|
+
"data-slot": "tabs",
|
|
11
|
+
"data-orientation": orientation,
|
|
12
|
+
orientation,
|
|
13
|
+
className: cn("group/tabs flex gap-2 data-horizontal:flex-col", className),
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
const tabsListVariants = cva("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none", {
|
|
18
|
+
variants: { variant: {
|
|
19
|
+
default: "bg-muted",
|
|
20
|
+
line: "gap-1 bg-transparent"
|
|
21
|
+
} },
|
|
22
|
+
defaultVariants: { variant: "default" }
|
|
23
|
+
});
|
|
24
|
+
function TabsList({ className, variant = "default", ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx(Tabs.List, {
|
|
26
|
+
"data-slot": "tabs-list",
|
|
27
|
+
"data-variant": variant,
|
|
28
|
+
className: cn(tabsListVariants({ variant }), className),
|
|
29
|
+
...props
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function TabsTrigger({ className, ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsx(Tabs.Tab, {
|
|
34
|
+
"data-slot": "tabs-trigger",
|
|
35
|
+
className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent", "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", className),
|
|
36
|
+
...props
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function TabsContent({ className, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx(Tabs.Panel, {
|
|
41
|
+
"data-slot": "tabs-content",
|
|
42
|
+
className: cn("flex-1 text-sm outline-none", className),
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export { Tabs$1 as Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/textarea/textarea.tsx
|
|
5
|
+
function Textarea({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
7
|
+
"data-slot": "textarea",
|
|
8
|
+
className: cn("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export { Textarea };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { Toast, ToastAction, ToastClose, ToastContent, ToastDescription, ToastPortal, ToastProvider, ToastTitle, ToastViewport, Toaster, createToastManager, toast, useToastManager } from "./toast.js";
|
|
3
|
+
export { Toast, ToastAction, ToastClose, ToastContent, ToastDescription, ToastPortal, ToastProvider, ToastTitle, ToastViewport, Toaster, createToastManager, toast, useToastManager };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Toast } from "@base-ui/react/toast";
|
|
4
|
+
declare const toast: import("@base-ui/react").ToastManager<any>;
|
|
5
|
+
declare function ToastProvider({ ...props }: Toast.Provider.Props): React.JSX.Element;
|
|
6
|
+
declare function ToastPortal({ ...props }: Toast.Portal.Props): React.JSX.Element;
|
|
7
|
+
declare function ToastViewport({ className, ...props }: Toast.Viewport.Props): React.JSX.Element;
|
|
8
|
+
declare function Toast$1({ className, ...props }: Toast.Root.Props): React.JSX.Element;
|
|
9
|
+
declare function ToastContent({ className, ...props }: Toast.Content.Props): React.JSX.Element;
|
|
10
|
+
declare function ToastTitle({ className, ...props }: Toast.Title.Props): React.JSX.Element;
|
|
11
|
+
declare function ToastDescription({ className, ...props }: Toast.Description.Props): React.JSX.Element;
|
|
12
|
+
declare function ToastAction({ className, render, ...props }: Toast.Action.Props): React.JSX.Element;
|
|
13
|
+
declare function ToastClose({ className, children, render, ...props }: Toast.Close.Props): React.JSX.Element;
|
|
14
|
+
declare function Toaster({ children, toastManager, ...props }: Toast.Provider.Props): React.JSX.Element;
|
|
15
|
+
declare const createToastManager: typeof Toast.createToastManager;
|
|
16
|
+
declare const useToastManager: typeof Toast.useToastManager;
|
|
17
|
+
export { Toast$1 as Toast, ToastAction, ToastClose, ToastContent, ToastDescription, ToastPortal, ToastProvider, ToastTitle, ToastViewport, Toaster, createToastManager, toast, useToastManager };
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { useCue } from "../sound/sound-map.js";
|
|
5
|
+
import { Arc } from "../loaders/arc.js";
|
|
6
|
+
import { Button } from "../button/button.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Toast } from "@base-ui/react/toast";
|
|
10
|
+
// src/toast/toast.tsx
|
|
11
|
+
const toast = Toast.createToastManager();
|
|
12
|
+
function ToastProvider({ ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx(Toast.Provider, { ...props });
|
|
14
|
+
}
|
|
15
|
+
function ToastPortal({ ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsx(Toast.Portal, {
|
|
17
|
+
"data-slot": "toast-portal",
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function ToastViewport({ className, ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsx(Toast.Viewport, {
|
|
23
|
+
"data-slot": "toast-viewport",
|
|
24
|
+
className: cn("pointer-events-none fixed inset-x-4 bottom-4 z-50 mx-auto w-auto max-w-sm outline-none sm:right-4 sm:left-auto sm:mx-0 sm:w-full", className),
|
|
25
|
+
...props
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function Toast$1({ className, ...props }) {
|
|
29
|
+
return /* @__PURE__ */ jsx(Toast.Root, {
|
|
30
|
+
"data-slot": "toast",
|
|
31
|
+
className: cn("group/toast pointer-events-auto absolute right-0 bottom-0 z-[calc(1000-var(--toast-index))] w-full origin-bottom rounded-2xl border bg-popover text-popover-foreground shadow-lg will-change-transform outline-none select-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50", "[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]", "h-(--height) [transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_500ms_cubic-bezier(0.22,1,0.36,1),opacity_500ms,height_150ms]", "after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']", "data-expanded:h-(--toast-height) data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]", "data-limited:opacity-0 data-starting-style:[transform:translateY(150%)]", "[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]", "data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]", "data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]", "data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]", "data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]", "data-expanded:data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]", "data-expanded:data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]", "data-expanded:data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]", "data-expanded:data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]", className),
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function ToastContent({ className, ...props }) {
|
|
36
|
+
return /* @__PURE__ */ jsx(Toast.Content, {
|
|
37
|
+
"data-slot": "toast-content",
|
|
38
|
+
className: cn("flex h-full items-center gap-3 overflow-hidden p-4 transition-opacity duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] data-behind:opacity-0 data-expanded:opacity-100", className),
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function ToastTitle({ className, ...props }) {
|
|
43
|
+
return /* @__PURE__ */ jsx(Toast.Title, {
|
|
44
|
+
"data-slot": "toast-title",
|
|
45
|
+
className: cn("text-sm font-medium", className),
|
|
46
|
+
...props
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function ToastDescription({ className, ...props }) {
|
|
50
|
+
return /* @__PURE__ */ jsx(Toast.Description, {
|
|
51
|
+
"data-slot": "toast-description",
|
|
52
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function ToastAction({ className, render = /* @__PURE__ */ jsx(Button, {
|
|
57
|
+
variant: "outline",
|
|
58
|
+
size: "sm"
|
|
59
|
+
}), ...props }) {
|
|
60
|
+
return /* @__PURE__ */ jsx(Toast.Action, {
|
|
61
|
+
"data-slot": "toast-action",
|
|
62
|
+
render,
|
|
63
|
+
className: cn("shrink-0", className),
|
|
64
|
+
...props
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function ToastClose({ className, children, render = /* @__PURE__ */ jsx(Button, {
|
|
68
|
+
variant: "ghost",
|
|
69
|
+
size: "icon-sm"
|
|
70
|
+
}), ...props }) {
|
|
71
|
+
return /* @__PURE__ */ jsx(Toast.Close, {
|
|
72
|
+
"data-slot": "toast-close",
|
|
73
|
+
"aria-label": "Close toast",
|
|
74
|
+
"aria-hidden": false,
|
|
75
|
+
render,
|
|
76
|
+
className: cn("relative shrink-0 text-muted-foreground after:absolute after:-inset-2 after:content-[''] hover:text-foreground", className),
|
|
77
|
+
...props,
|
|
78
|
+
children: children ?? /* @__PURE__ */ jsxs("svg", {
|
|
79
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
80
|
+
viewBox: "0 0 24 24",
|
|
81
|
+
fill: "none",
|
|
82
|
+
stroke: "currentColor",
|
|
83
|
+
strokeWidth: "2",
|
|
84
|
+
strokeLinecap: "round",
|
|
85
|
+
strokeLinejoin: "round",
|
|
86
|
+
"aria-hidden": "true",
|
|
87
|
+
children: [/* @__PURE__ */ jsx("path", { d: "M18 6 6 18" }), /* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })]
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function ToastIcon({ type }) {
|
|
92
|
+
let icon = null;
|
|
93
|
+
if (type === "success") icon = /* @__PURE__ */ jsxs("svg", {
|
|
94
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
95
|
+
viewBox: "0 0 24 24",
|
|
96
|
+
fill: "none",
|
|
97
|
+
stroke: "currentColor",
|
|
98
|
+
strokeWidth: "2",
|
|
99
|
+
strokeLinecap: "round",
|
|
100
|
+
strokeLinejoin: "round",
|
|
101
|
+
"aria-hidden": "true",
|
|
102
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
103
|
+
cx: "12",
|
|
104
|
+
cy: "12",
|
|
105
|
+
r: "10"
|
|
106
|
+
}), /* @__PURE__ */ jsx("path", { d: "m16 9-5.5 5.5L8 12" })]
|
|
107
|
+
});
|
|
108
|
+
if (type === "info") icon = /* @__PURE__ */ jsxs("svg", {
|
|
109
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
110
|
+
viewBox: "0 0 24 24",
|
|
111
|
+
fill: "none",
|
|
112
|
+
stroke: "currentColor",
|
|
113
|
+
strokeWidth: "2",
|
|
114
|
+
strokeLinecap: "round",
|
|
115
|
+
strokeLinejoin: "round",
|
|
116
|
+
"aria-hidden": "true",
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ jsx("circle", {
|
|
119
|
+
cx: "12",
|
|
120
|
+
cy: "12",
|
|
121
|
+
r: "10"
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ jsx("path", { d: "M12 16v-4" }),
|
|
124
|
+
/* @__PURE__ */ jsx("path", { d: "M12 8h.01" })
|
|
125
|
+
]
|
|
126
|
+
});
|
|
127
|
+
if (type === "warning") icon = /* @__PURE__ */ jsxs("svg", {
|
|
128
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
129
|
+
viewBox: "0 0 24 24",
|
|
130
|
+
fill: "none",
|
|
131
|
+
stroke: "currentColor",
|
|
132
|
+
strokeWidth: "2",
|
|
133
|
+
strokeLinecap: "round",
|
|
134
|
+
strokeLinejoin: "round",
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
|
|
138
|
+
/* @__PURE__ */ jsx("path", { d: "M12 9v4" }),
|
|
139
|
+
/* @__PURE__ */ jsx("path", { d: "M12 17h.01" })
|
|
140
|
+
]
|
|
141
|
+
});
|
|
142
|
+
if (type === "error") icon = /* @__PURE__ */ jsxs("svg", {
|
|
143
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
144
|
+
viewBox: "0 0 24 24",
|
|
145
|
+
fill: "none",
|
|
146
|
+
stroke: "currentColor",
|
|
147
|
+
strokeWidth: "2",
|
|
148
|
+
strokeLinecap: "round",
|
|
149
|
+
strokeLinejoin: "round",
|
|
150
|
+
className: "text-destructive",
|
|
151
|
+
"aria-hidden": "true",
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ jsx("path", { d: "m15 9-6 6" }),
|
|
154
|
+
/* @__PURE__ */ jsx("path", { d: "M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z" }),
|
|
155
|
+
/* @__PURE__ */ jsx("path", { d: "m9 9 6 6" })
|
|
156
|
+
]
|
|
157
|
+
});
|
|
158
|
+
if (type === "loading") icon = /* @__PURE__ */ jsx(Arc, {});
|
|
159
|
+
if (!icon) return null;
|
|
160
|
+
return /* @__PURE__ */ jsx("span", {
|
|
161
|
+
"data-slot": "toast-icon",
|
|
162
|
+
className: "shrink-0 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
163
|
+
children: icon
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Nsaa feel layer (#108): success, warning and error toasts play their feedback cue once, when the
|
|
168
|
+
* toast appears or when a promise toast settles into that type. Default, info and loading are silent.
|
|
169
|
+
*/
|
|
170
|
+
function useToastCues(toasts) {
|
|
171
|
+
const cue = useCue("toast");
|
|
172
|
+
const played = React.useRef(null);
|
|
173
|
+
React.useEffect(() => {
|
|
174
|
+
const first = played.current === null;
|
|
175
|
+
played.current ??= /* @__PURE__ */ new Map();
|
|
176
|
+
const activated = typeof navigator === "undefined" || navigator.userActivation?.hasBeenActive !== false;
|
|
177
|
+
for (const { id, type } of toasts) {
|
|
178
|
+
if (played.current.get(id) === type) continue;
|
|
179
|
+
played.current.set(id, type);
|
|
180
|
+
if (type && !first && activated) cue(type);
|
|
181
|
+
}
|
|
182
|
+
const live = new Set(toasts.map((t) => t.id));
|
|
183
|
+
for (const id of played.current.keys()) if (!live.has(id)) played.current.delete(id);
|
|
184
|
+
}, [toasts, cue]);
|
|
185
|
+
}
|
|
186
|
+
function ToastList() {
|
|
187
|
+
const { toasts } = Toast.useToastManager();
|
|
188
|
+
useToastCues(toasts);
|
|
189
|
+
return toasts.map((toastItem) => /* @__PURE__ */ jsx(Toast$1, {
|
|
190
|
+
toast: toastItem,
|
|
191
|
+
children: /* @__PURE__ */ jsxs(ToastContent, { children: [
|
|
192
|
+
/* @__PURE__ */ jsx(ToastIcon, { type: toastItem.type }),
|
|
193
|
+
/* @__PURE__ */ jsxs("div", {
|
|
194
|
+
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
195
|
+
children: [/* @__PURE__ */ jsx(ToastTitle, {}), /* @__PURE__ */ jsx(ToastDescription, {})]
|
|
196
|
+
}),
|
|
197
|
+
/* @__PURE__ */ jsx(ToastAction, {}),
|
|
198
|
+
/* @__PURE__ */ jsx(ToastClose, {})
|
|
199
|
+
] })
|
|
200
|
+
}, toastItem.id));
|
|
201
|
+
}
|
|
202
|
+
function Toaster({ children, toastManager = toast, ...props }) {
|
|
203
|
+
return /* @__PURE__ */ jsxs(ToastProvider, {
|
|
204
|
+
toastManager,
|
|
205
|
+
...props,
|
|
206
|
+
children: [children, /* @__PURE__ */ jsx(ToastPortal, { children: /* @__PURE__ */ jsx(ToastViewport, { children: /* @__PURE__ */ jsx(ToastList, {}) }) })]
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
const createToastManager = Toast.createToastManager;
|
|
210
|
+
const useToastManager = Toast.useToastManager;
|
|
211
|
+
export { Toast$1 as Toast, ToastAction, ToastClose, ToastContent, ToastDescription, ToastPortal, ToastProvider, ToastTitle, ToastViewport, Toaster, createToastManager, toast, useToastManager };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { ToggleGroup, ToggleGroupItemProps, ToggleGroupMultipleProps, ToggleGroupProps, ToggleGroupSingleProps, ToggleGroupSize, ToggleGroupVariant } from "./toggle-group.js";
|
|
3
|
+
export { ToggleGroup, type ToggleGroupItemProps, type ToggleGroupMultipleProps, type ToggleGroupProps, type ToggleGroupSingleProps, type ToggleGroupSize, type ToggleGroupVariant };
|