@peerproblem/sw3-ui 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +109 -2
- package/agent/components/accordion.md +95 -0
- package/agent/components/action-square.md +106 -0
- package/agent/components/agent-bridge.md +87 -0
- package/agent/components/agent-console.md +123 -0
- package/agent/components/alert-dialog.md +82 -0
- package/agent/components/app-shell.md +105 -0
- package/agent/components/area-chart.md +56 -0
- package/agent/components/async-options.md +47 -0
- package/agent/components/autocomplete.md +69 -0
- package/agent/components/avatar.md +88 -0
- package/agent/components/badge.md +51 -0
- package/agent/components/bar-chart.md +56 -0
- package/agent/components/bar-list.md +49 -0
- package/agent/components/breadcrumbs.md +43 -0
- package/agent/components/button.md +109 -0
- package/agent/components/calendar.md +114 -0
- package/agent/components/canvas.md +105 -0
- package/agent/components/card.md +78 -0
- package/agent/components/carousel.md +113 -0
- package/agent/components/chart-card.md +41 -0
- package/agent/components/chart-surface.md +56 -0
- package/agent/components/checkbox.md +88 -0
- package/agent/components/citation-chip.md +61 -0
- package/agent/components/collapsible.md +69 -0
- package/agent/components/color-picker.md +82 -0
- package/agent/components/combobox.md +104 -0
- package/agent/components/command.md +92 -0
- package/agent/components/dashboard-grid.md +73 -0
- package/agent/components/date-input.md +87 -0
- package/agent/components/date-picker.md +122 -0
- package/agent/components/dialog.md +97 -0
- package/agent/components/donut-chart.md +50 -0
- package/agent/components/drawer.md +101 -0
- package/agent/components/empty-state.md +52 -0
- package/agent/components/field.md +80 -0
- package/agent/components/file-input.md +84 -0
- package/agent/components/hover-card.md +64 -0
- package/agent/components/image-cropper.md +77 -0
- package/agent/components/input.md +49 -0
- package/agent/components/label.md +53 -0
- package/agent/components/line-chart.md +60 -0
- package/agent/components/listbox.md +84 -0
- package/agent/components/map-view.md +104 -0
- package/agent/components/menu.md +117 -0
- package/agent/components/menubar.md +67 -0
- package/agent/components/meter.md +59 -0
- package/agent/components/navigation-menu.md +98 -0
- package/agent/components/number-input.md +81 -0
- package/agent/components/otp-input.md +67 -0
- package/agent/components/pagination.md +80 -0
- package/agent/components/password-input.md +67 -0
- package/agent/components/pill-button.md +116 -0
- package/agent/components/popover.md +85 -0
- package/agent/components/poster-card.md +61 -0
- package/agent/components/preferences.md +92 -0
- package/agent/components/progress.md +63 -0
- package/agent/components/provider.md +47 -0
- package/agent/components/radio.md +91 -0
- package/agent/components/rating.md +66 -0
- package/agent/components/reorder.md +61 -0
- package/agent/components/resizable.md +87 -0
- package/agent/components/scatter-chart.md +49 -0
- package/agent/components/scroll-area.md +81 -0
- package/agent/components/segmented-control.md +56 -0
- package/agent/components/select.md +130 -0
- package/agent/components/separator.md +60 -0
- package/agent/components/shortcuts.md +50 -0
- package/agent/components/sidebar-nav.md +68 -0
- package/agent/components/skeleton.md +58 -0
- package/agent/components/slider.md +79 -0
- package/agent/components/sparkline.md +39 -0
- package/agent/components/squircle.md +58 -0
- package/agent/components/stat.md +58 -0
- package/agent/components/switch.md +48 -0
- package/agent/components/table.md +58 -0
- package/agent/components/tabs.md +108 -0
- package/agent/components/textarea.md +68 -0
- package/agent/components/time-input.md +84 -0
- package/agent/components/timeline.md +91 -0
- package/agent/components/toast.md +85 -0
- package/agent/components/toggle.md +76 -0
- package/agent/components/token-input.md +66 -0
- package/agent/components/toolbar.md +76 -0
- package/agent/components/tooltip.md +83 -0
- package/agent/components/tracker.md +47 -0
- package/agent/components/tree.md +87 -0
- package/agent/components/treemap.md +72 -0
- package/agent/components/trend-chart.md +80 -0
- package/agent/components/trigger-menu.md +67 -0
- package/agent/components/typography.md +51 -0
- package/agent/components/waterfall.md +78 -0
- package/agent/components/week-schedule.md +113 -0
- package/agent/llms/actions-and-layout.txt +1749 -0
- package/agent/llms/agents.txt +505 -0
- package/agent/llms/charts.txt +778 -0
- package/agent/llms/dashboards.txt +457 -0
- package/agent/llms/extend.txt +132 -0
- package/agent/llms/extras.txt +527 -0
- package/agent/llms/forms.txt +2152 -0
- package/agent/llms/foundations.txt +674 -0
- package/agent/llms/hooks.txt +178 -0
- package/agent/llms/maps.txt +229 -0
- package/agent/llms/overlays-and-navigation.txt +1167 -0
- package/agent/llms-full.txt +8717 -0
- package/agent/llms.txt +145 -0
- package/agent/registry.json +11289 -0
- package/agent/tokens.md +66 -0
- package/dist/agent/index.d.ts +235 -0
- package/dist/agent/index.js +21 -0
- package/dist/card-Ipm-Cj5f.d.ts +490 -0
- package/dist/charts/index.d.ts +289 -0
- package/dist/charts/index.js +815 -0
- package/dist/check/cli.d.ts +1 -0
- package/dist/check/cli.js +48 -0
- package/dist/check/rendered.d.ts +11 -0
- package/dist/check/rendered.js +77 -0
- package/dist/check/source.d.ts +13 -0
- package/dist/check/source.js +182 -0
- package/dist/chunk-3DXBM65D.js +65 -0
- package/dist/chunk-3H5X4ZP6.js +55 -0
- package/dist/chunk-6XC4BC5C.js +92 -0
- package/dist/chunk-7H6TEAWD.js +507 -0
- package/dist/chunk-I63ZTJOI.js +1089 -0
- package/dist/chunk-JCIRUM4W.js +33 -0
- package/dist/chunk-LTBEHZ3P.js +25 -0
- package/dist/chunk-QDPPLO4U.js +60 -0
- package/dist/chunk-U2XFBPU4.js +56 -0
- package/dist/chunk-UY2WH5AY.js +681 -0
- package/dist/extras.d.ts +203 -0
- package/dist/extras.js +904 -0
- package/dist/icons-BJiGEAnU.d.ts +68 -0
- package/dist/index.d.ts +3737 -0
- package/dist/index.js +14477 -0
- package/dist/map/index.d.ts +115 -0
- package/dist/map/index.js +394 -0
- package/dist/meta/index.d.ts +3314 -0
- package/dist/meta/index.js +5106 -0
- package/dist/rules-1RIZ_JZr.d.ts +38 -0
- package/dist/styles.css +4037 -0
- package/dist/themes/calm.css +42 -0
- package/dist/themes/frost.css +40 -0
- package/package.json +142 -4
|
@@ -0,0 +1,681 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
useAgentBinding
|
|
4
|
+
} from "./chunk-JCIRUM4W.js";
|
|
5
|
+
import {
|
|
6
|
+
motion,
|
|
7
|
+
radius,
|
|
8
|
+
smoothing
|
|
9
|
+
} from "./chunk-6XC4BC5C.js";
|
|
10
|
+
|
|
11
|
+
// src/primitives/squircle.tsx
|
|
12
|
+
import {
|
|
13
|
+
forwardRef,
|
|
14
|
+
useCallback,
|
|
15
|
+
useEffect,
|
|
16
|
+
useLayoutEffect,
|
|
17
|
+
useMemo,
|
|
18
|
+
useRef,
|
|
19
|
+
useState
|
|
20
|
+
} from "react";
|
|
21
|
+
import { getSvgPath } from "figma-squircle";
|
|
22
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
+
var useIsoLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
24
|
+
function resolveRadius(r, fallback = "md") {
|
|
25
|
+
const v = r ?? fallback;
|
|
26
|
+
return typeof v === "number" ? v : radius[v];
|
|
27
|
+
}
|
|
28
|
+
function resolveSmoothing(s) {
|
|
29
|
+
const v = s ?? "soft";
|
|
30
|
+
return typeof v === "number" ? Math.min(1, Math.max(0, v)) : smoothing[v];
|
|
31
|
+
}
|
|
32
|
+
function smoothCapsulePath(width, height) {
|
|
33
|
+
const half = height / 2;
|
|
34
|
+
const cap = Math.min(height * 0.6, width / 2);
|
|
35
|
+
const left = cap;
|
|
36
|
+
const right = width - cap;
|
|
37
|
+
const shoulder = (x, y, sx, sy, reverse = false) => {
|
|
38
|
+
const point = (dx, dy) => `${x + cap * dx * sx} ${y + half * dy * sy}`;
|
|
39
|
+
return reverse ? `C ${point(1, 0.55)} ${point(0.74, 0.275)} ${point(0.54, 0.1375)} C ${point(0.34, 0)} ${point(0.2, 0)} ${point(0, 0)}` : `C ${point(0.2, 0)} ${point(0.34, 0)} ${point(0.54, 0.1375)} C ${point(0.74, 0.275)} ${point(1, 0.55)} ${point(1, 1)}`;
|
|
40
|
+
};
|
|
41
|
+
return [
|
|
42
|
+
`M ${left} 0 H ${right}`,
|
|
43
|
+
shoulder(right, 0, 1, 1),
|
|
44
|
+
shoulder(right, height, 1, -1, true),
|
|
45
|
+
`H ${left}`,
|
|
46
|
+
shoulder(left, height, -1, -1),
|
|
47
|
+
shoulder(left, 0, -1, 1, true),
|
|
48
|
+
"Z"
|
|
49
|
+
].join(" ");
|
|
50
|
+
}
|
|
51
|
+
function buildPaths(w, h, r, s, preserve, offset, shape) {
|
|
52
|
+
const clamp = (rad, ww, hh) => Math.min(rad, ww / 2, hh / 2);
|
|
53
|
+
if (w <= 0 || h <= 0) return { d: "", ring: "", width: w, height: h };
|
|
54
|
+
if (shape === "smooth-capsule") return {
|
|
55
|
+
d: smoothCapsulePath(w, h),
|
|
56
|
+
ring: smoothCapsulePath(w + offset * 2, h + offset * 2),
|
|
57
|
+
border: w > 1 && h > 1 ? smoothCapsulePath(w - 1, h - 1) : void 0,
|
|
58
|
+
width: w,
|
|
59
|
+
height: h
|
|
60
|
+
};
|
|
61
|
+
const d = getSvgPath({ width: w, height: h, cornerRadius: clamp(r, w, h), cornerSmoothing: s, preserveSmoothing: preserve });
|
|
62
|
+
const rw = w + offset * 2;
|
|
63
|
+
const rh = h + offset * 2;
|
|
64
|
+
const ring = getSvgPath({ width: rw, height: rh, cornerRadius: clamp(r + offset, rw, rh), cornerSmoothing: s, preserveSmoothing: preserve });
|
|
65
|
+
const border = w > 1 && h > 1 ? getSvgPath({ width: w - 1, height: h - 1, cornerRadius: clamp(Math.max(0, r - 0.5), w - 1, h - 1), cornerSmoothing: s, preserveSmoothing: preserve }) : void 0;
|
|
66
|
+
return { d, ring, border, width: w, height: h };
|
|
67
|
+
}
|
|
68
|
+
function useSquircle(opts = {}) {
|
|
69
|
+
const { radius: radius2, smoothing: smoothing2, shape = "squircle", preserveSmoothing = true, ringOffset = 3, concentric = false, enabled = true } = opts;
|
|
70
|
+
const [element, setNode] = useState(null);
|
|
71
|
+
const node = enabled ? element : null;
|
|
72
|
+
const [nested, setNested] = useState(null);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
const parent = concentric ? node?.parentElement : null;
|
|
75
|
+
if (!parent) return setNested(null);
|
|
76
|
+
const frame = parent.closest(".sw-sq");
|
|
77
|
+
const measure = () => {
|
|
78
|
+
const style = getComputedStyle(parent);
|
|
79
|
+
const outer = parseFloat(style.getPropertyValue("--sw-sq-r"));
|
|
80
|
+
const inset = parseFloat(style.getPropertyValue("--sw-inset"));
|
|
81
|
+
if (!Number.isFinite(outer) || !(inset >= 0)) return setNested(null);
|
|
82
|
+
const effectiveOuter = frame ? Math.min(outer, frame.offsetWidth / 2, frame.offsetHeight / 2) : outer;
|
|
83
|
+
const nextRadius = Math.max(0, effectiveOuter - inset);
|
|
84
|
+
const nextSmoothing = Number(frame?.dataset.swSmoothing ?? smoothing.soft);
|
|
85
|
+
setNested((prev) => prev?.radius === nextRadius && prev.smoothing === nextSmoothing ? prev : { radius: nextRadius, smoothing: nextSmoothing });
|
|
86
|
+
};
|
|
87
|
+
measure();
|
|
88
|
+
const resize = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
|
|
89
|
+
resize?.observe(parent);
|
|
90
|
+
if (frame && frame !== parent) resize?.observe(frame);
|
|
91
|
+
const attributes = new MutationObserver(measure);
|
|
92
|
+
const attributeFilter = ["data-sw-radius", "data-sw-smoothing", "class", "style"];
|
|
93
|
+
attributes.observe(parent, { attributeFilter });
|
|
94
|
+
if (frame && frame !== parent) attributes.observe(frame, { attributeFilter });
|
|
95
|
+
return () => {
|
|
96
|
+
resize?.disconnect();
|
|
97
|
+
attributes.disconnect();
|
|
98
|
+
};
|
|
99
|
+
}, [concentric, node]);
|
|
100
|
+
const r = nested?.radius ?? resolveRadius(radius2);
|
|
101
|
+
const s = smoothing2 === void 0 && nested ? nested.smoothing : resolveSmoothing(smoothing2);
|
|
102
|
+
const [size, setSize] = useState({ width: 0, height: 0 });
|
|
103
|
+
const paths2 = useMemo(
|
|
104
|
+
() => buildPaths(size.width, size.height, r, s, preserveSmoothing, ringOffset, shape),
|
|
105
|
+
[size, r, s, preserveSmoothing, ringOffset, shape]
|
|
106
|
+
);
|
|
107
|
+
const ref = useCallback((el) => setNode(el), []);
|
|
108
|
+
useIsoLayoutEffect(() => {
|
|
109
|
+
if (!node) return setSize((prev) => prev.width || prev.height ? { width: 0, height: 0 } : prev);
|
|
110
|
+
const set = (width, height) => setSize((prev) => prev.width === width && prev.height === height ? prev : { width, height });
|
|
111
|
+
const cs = getComputedStyle(node);
|
|
112
|
+
const exact = (v) => parseFloat(v) || 0;
|
|
113
|
+
const pad = (a, b) => cs.boxSizing === "border-box" ? 0 : exact(cs.getPropertyValue(a)) + exact(cs.getPropertyValue(b));
|
|
114
|
+
const w = exact(cs.width) + pad("padding-left", "padding-right") + pad("border-left-width", "border-right-width");
|
|
115
|
+
const h = exact(cs.height) + pad("padding-top", "padding-bottom") + pad("border-top-width", "border-bottom-width");
|
|
116
|
+
if (w > 0 && h > 0) set(w, h);
|
|
117
|
+
else set(node.offsetWidth, node.offsetHeight);
|
|
118
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
119
|
+
const ro = new ResizeObserver(([entry]) => {
|
|
120
|
+
const box = entry?.borderBoxSize?.[0];
|
|
121
|
+
if (box) set(box.inlineSize, box.blockSize);
|
|
122
|
+
else set(node.offsetWidth, node.offsetHeight);
|
|
123
|
+
});
|
|
124
|
+
ro.observe(node);
|
|
125
|
+
return () => ro.disconnect();
|
|
126
|
+
}, [node]);
|
|
127
|
+
useIsoLayoutEffect(() => {
|
|
128
|
+
if (!node) {
|
|
129
|
+
if (element) {
|
|
130
|
+
delete element.dataset.swRadius;
|
|
131
|
+
delete element.dataset.swSmoothing;
|
|
132
|
+
delete element.dataset.swShape;
|
|
133
|
+
}
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
node.dataset.swRadius = String(r);
|
|
137
|
+
node.dataset.swSmoothing = String(s);
|
|
138
|
+
if (shape === "smooth-capsule") node.dataset.swShape = shape;
|
|
139
|
+
else delete node.dataset.swShape;
|
|
140
|
+
}, [node, element, r, s, shape]);
|
|
141
|
+
return { ref, paths: paths2, radius: r, smoothing: s, ringOffset };
|
|
142
|
+
}
|
|
143
|
+
function SquircleLayers({ paths: paths2, radius: radius2, ringOffset = 3, borderWidth = 0 }) {
|
|
144
|
+
const ready = !!paths2.d;
|
|
145
|
+
const fallback = ready ? {} : { borderRadius: radius2 };
|
|
146
|
+
const fillRef = useRef(null);
|
|
147
|
+
useIsoLayoutEffect(() => {
|
|
148
|
+
const host = fillRef.current?.parentElement;
|
|
149
|
+
host?.style.setProperty("--sw-sq-r", `${radius2}px`);
|
|
150
|
+
return () => {
|
|
151
|
+
host?.style.removeProperty("--sw-sq-r");
|
|
152
|
+
};
|
|
153
|
+
}, [radius2]);
|
|
154
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
155
|
+
/* @__PURE__ */ jsx(
|
|
156
|
+
"span",
|
|
157
|
+
{
|
|
158
|
+
ref: fillRef,
|
|
159
|
+
"aria-hidden": true,
|
|
160
|
+
className: "sw-sq-fill",
|
|
161
|
+
style: ready ? { clipPath: `path('${paths2.d}')` } : fallback
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
borderWidth === 1 && ready && paths2.border && /* @__PURE__ */ jsx(
|
|
165
|
+
"svg",
|
|
166
|
+
{
|
|
167
|
+
"aria-hidden": true,
|
|
168
|
+
className: "sw-sq-stroke",
|
|
169
|
+
width: paths2.width,
|
|
170
|
+
height: paths2.height,
|
|
171
|
+
viewBox: `0 0 ${paths2.width} ${paths2.height}`,
|
|
172
|
+
style: { width: paths2.width, height: paths2.height },
|
|
173
|
+
children: /* @__PURE__ */ jsx("path", { d: paths2.border, transform: "translate(0.5 0.5)", fill: "none", strokeWidth: 1 })
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
borderWidth > 0 && !(borderWidth === 1 && paths2.border) && ready && // Other widths: stroke is centred on the path; doubling it and clipping to the shape draws it fully inside.
|
|
177
|
+
/* @__PURE__ */ jsx(
|
|
178
|
+
"svg",
|
|
179
|
+
{
|
|
180
|
+
"aria-hidden": true,
|
|
181
|
+
className: "sw-sq-stroke",
|
|
182
|
+
width: paths2.width,
|
|
183
|
+
height: paths2.height,
|
|
184
|
+
viewBox: `0 0 ${paths2.width} ${paths2.height}`,
|
|
185
|
+
style: { width: paths2.width, height: paths2.height, clipPath: `path('${paths2.d}')` },
|
|
186
|
+
children: /* @__PURE__ */ jsx("path", { d: paths2.d, fill: "none", strokeWidth: borderWidth * 2 })
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
ready && /* @__PURE__ */ jsx(
|
|
190
|
+
"svg",
|
|
191
|
+
{
|
|
192
|
+
"aria-hidden": true,
|
|
193
|
+
className: "sw-sq-ring",
|
|
194
|
+
width: paths2.width + ringOffset * 2,
|
|
195
|
+
height: paths2.height + ringOffset * 2,
|
|
196
|
+
style: { left: -ringOffset, top: -ringOffset, width: paths2.width + ringOffset * 2, height: paths2.height + ringOffset * 2 },
|
|
197
|
+
children: /* @__PURE__ */ jsx("path", { d: paths2.ring, fill: "none", strokeWidth: 2 })
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
] });
|
|
201
|
+
}
|
|
202
|
+
var InsetSquircleButton = forwardRef(function InsetSquircleButton2({ className, children, ...props }, ref) {
|
|
203
|
+
const sq = useSquircle({ radius: "xs", concentric: true, ringOffset: 0 });
|
|
204
|
+
const setRef = useCallback((el) => {
|
|
205
|
+
sq.ref(el);
|
|
206
|
+
if (typeof ref === "function") ref(el);
|
|
207
|
+
else if (ref) ref.current = el;
|
|
208
|
+
}, [sq.ref, ref]);
|
|
209
|
+
return /* @__PURE__ */ jsxs("button", { ref: setRef, type: "button", className: cx("sw-inset-button sw-sq", className), ...props, children: [
|
|
210
|
+
/* @__PURE__ */ jsx(SquircleLayers, { paths: sq.paths, radius: sq.radius, ringOffset: sq.ringOffset }),
|
|
211
|
+
children
|
|
212
|
+
] });
|
|
213
|
+
});
|
|
214
|
+
var Squircle = forwardRef(function Squircle2({ radius: radius2, smoothing: smoothing2, shape, preserveSmoothing, ringOffset, concentric, borderWidth = 1, clipContent, className, style, children, ...rest }, forwarded) {
|
|
215
|
+
const sq = useSquircle({ radius: radius2, smoothing: smoothing2, shape, preserveSmoothing, ringOffset, concentric });
|
|
216
|
+
const localRef = useRef(null);
|
|
217
|
+
const setRef = (el) => {
|
|
218
|
+
localRef.current = el;
|
|
219
|
+
sq.ref(el);
|
|
220
|
+
if (typeof forwarded === "function") forwarded(el);
|
|
221
|
+
else if (forwarded) forwarded.current = el;
|
|
222
|
+
};
|
|
223
|
+
const clip = clipContent && sq.paths.d ? { clipPath: `path('${sq.paths.d}')` } : {};
|
|
224
|
+
return /* @__PURE__ */ jsxs(
|
|
225
|
+
"div",
|
|
226
|
+
{
|
|
227
|
+
ref: setRef,
|
|
228
|
+
"data-sw": "squircle",
|
|
229
|
+
className: cx("sw-sq", className),
|
|
230
|
+
style: { ...clip, ...style },
|
|
231
|
+
...rest,
|
|
232
|
+
children: [
|
|
233
|
+
/* @__PURE__ */ jsx(SquircleLayers, { paths: sq.paths, radius: sq.radius, ringOffset: sq.ringOffset, borderWidth }),
|
|
234
|
+
children
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
);
|
|
238
|
+
});
|
|
239
|
+
function cx(...parts) {
|
|
240
|
+
return parts.filter(Boolean).join(" ");
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// src/motion/presets.ts
|
|
244
|
+
var transitions = {
|
|
245
|
+
snappy: motion.spring.snappy,
|
|
246
|
+
gentle: motion.spring.gentle,
|
|
247
|
+
bouncy: motion.spring.bouncy,
|
|
248
|
+
fast: { duration: motion.duration.fast, ease: motion.ease.standard },
|
|
249
|
+
base: { duration: motion.duration.base, ease: motion.ease.standard },
|
|
250
|
+
slow: { duration: motion.duration.slow, ease: motion.ease.emphasized }
|
|
251
|
+
};
|
|
252
|
+
var press = {
|
|
253
|
+
whileTap: { scale: 0.97 },
|
|
254
|
+
transition: transitions.snappy
|
|
255
|
+
};
|
|
256
|
+
var lift = {
|
|
257
|
+
whileHover: { y: -2 },
|
|
258
|
+
whileTap: { y: 0, scale: 0.995 },
|
|
259
|
+
transition: transitions.gentle
|
|
260
|
+
};
|
|
261
|
+
var enter = {
|
|
262
|
+
fadeUp: {
|
|
263
|
+
hidden: { opacity: 0, y: 12 },
|
|
264
|
+
show: { opacity: 1, y: 0, transition: transitions.slow }
|
|
265
|
+
},
|
|
266
|
+
fade: {
|
|
267
|
+
hidden: { opacity: 0 },
|
|
268
|
+
show: { opacity: 1, transition: transitions.base }
|
|
269
|
+
},
|
|
270
|
+
scaleIn: {
|
|
271
|
+
hidden: { opacity: 0, scale: 0.96 },
|
|
272
|
+
show: { opacity: 1, scale: 1, transition: transitions.gentle }
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
var stagger = (step = 0.06, delay = 0) => ({
|
|
276
|
+
hidden: {},
|
|
277
|
+
show: { transition: { staggerChildren: step, delayChildren: delay } }
|
|
278
|
+
});
|
|
279
|
+
var motionPresets = { transitions, press, lift, enter, stagger };
|
|
280
|
+
|
|
281
|
+
// src/utils/index.ts
|
|
282
|
+
function mergeRefs(...refs) {
|
|
283
|
+
return (value) => {
|
|
284
|
+
for (const ref of refs) {
|
|
285
|
+
if (!ref) continue;
|
|
286
|
+
if (typeof ref === "function") ref(value);
|
|
287
|
+
else ref.current = value;
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
function moveFocus(container, e, orientation = "both") {
|
|
292
|
+
if (!container) return;
|
|
293
|
+
const items = Array.from(container.querySelectorAll("[data-sw-item]:not([disabled])"));
|
|
294
|
+
const i = items.indexOf(document.activeElement);
|
|
295
|
+
if (i < 0) return;
|
|
296
|
+
const next = orientation !== "vertical" && e.key === "ArrowRight" || orientation !== "horizontal" && e.key === "ArrowDown";
|
|
297
|
+
const prev = orientation !== "vertical" && e.key === "ArrowLeft" || orientation !== "horizontal" && e.key === "ArrowUp";
|
|
298
|
+
let target = -1;
|
|
299
|
+
if (next) target = (i + 1) % items.length;
|
|
300
|
+
else if (prev) target = (i - 1 + items.length) % items.length;
|
|
301
|
+
else if (e.key === "Home") target = 0;
|
|
302
|
+
else if (e.key === "End") target = items.length - 1;
|
|
303
|
+
if (target >= 0) {
|
|
304
|
+
e.preventDefault();
|
|
305
|
+
items[target].focus();
|
|
306
|
+
items[target].click();
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// src/primitives/controllable.ts
|
|
311
|
+
import { useCallback as useCallback2, useRef as useRef2, useState as useState2 } from "react";
|
|
312
|
+
function useControllableState({
|
|
313
|
+
value,
|
|
314
|
+
defaultValue,
|
|
315
|
+
onChange
|
|
316
|
+
}) {
|
|
317
|
+
const [inner, setInner] = useState2(defaultValue);
|
|
318
|
+
const controlled = value !== void 0;
|
|
319
|
+
const current = controlled ? value : inner;
|
|
320
|
+
const ref = useRef2(current);
|
|
321
|
+
ref.current = current;
|
|
322
|
+
const onChangeRef = useRef2(onChange);
|
|
323
|
+
onChangeRef.current = onChange;
|
|
324
|
+
const set = useCallback2(
|
|
325
|
+
(next) => {
|
|
326
|
+
const resolved = typeof next === "function" ? next(ref.current) : next;
|
|
327
|
+
if (Object.is(resolved, ref.current)) return;
|
|
328
|
+
if (!controlled) setInner(resolved);
|
|
329
|
+
ref.current = resolved;
|
|
330
|
+
onChangeRef.current?.(resolved);
|
|
331
|
+
},
|
|
332
|
+
[controlled]
|
|
333
|
+
);
|
|
334
|
+
return [current, set];
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// src/components/icons.tsx
|
|
338
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
339
|
+
var paths = {
|
|
340
|
+
plus: "M4 12h16M12 4v16",
|
|
341
|
+
minus: "M4 12h16",
|
|
342
|
+
close: "M6 6l12 12M18 6 6 18",
|
|
343
|
+
corner: "M12 3v9H3m18 0h-9v9",
|
|
344
|
+
"chevron-right": "m10 6 6 6-6 6",
|
|
345
|
+
"chevron-up": "m6 15 6-6 6 6",
|
|
346
|
+
"chevron-down": "m6 9 6 6 6-6",
|
|
347
|
+
"arrow-up-right": "M7 17 17 7M9 7h8v8",
|
|
348
|
+
expand: "m13.5 10.5 5-5m-4.5 0h4.5V10M10.5 13.5l-5 5m0-4.5v4.5H10",
|
|
349
|
+
import: "M12 3v11m0 0 4-4m-4 4-4-4M4 15v2a4 4 0 0 0 4 4h8a4 4 0 0 0 4-4v-2",
|
|
350
|
+
note: "M8 3h8a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4H8a4 4 0 0 1-4-4V7a4 4 0 0 1 4-4Zm0 6h8m-8 4h8m-8 4h5",
|
|
351
|
+
check: "m6 12 4 4 8-8",
|
|
352
|
+
"chevron-left": "m14 6-6 6 6 6",
|
|
353
|
+
"arrow-left": "M19 12H5m6-6-6 6 6 6",
|
|
354
|
+
"arrow-right": "M5 12h14m-6-6 6 6-6 6",
|
|
355
|
+
search: "M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14Zm9 2-4-4",
|
|
356
|
+
calendar: "M7 3v3m10-3v3M4 9h16M6 5h12a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2Z",
|
|
357
|
+
clock: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-13v4l3 2",
|
|
358
|
+
eye: "M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Zm9.5 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",
|
|
359
|
+
"eye-off": "M3 3l18 18M10.6 5.6A9.7 9.7 0 0 1 12 5.5c6 0 9.5 6.5 9.5 6.5a17 17 0 0 1-2.6 3.4M6.6 6.6C3.9 8.3 2.5 12 2.5 12S6 18.5 12 18.5a9 9 0 0 0 4.4-1.1M9.9 9.9a3 3 0 0 0 4.2 4.2",
|
|
360
|
+
star: "m12 3.5 2.6 5.3 5.9.9-4.3 4.1 1 5.8-5.2-2.7-5.2 2.7 1-5.8-4.3-4.1 5.9-.9L12 3.5Z",
|
|
361
|
+
upload: "M12 15V4m0 0-4 4m4-4 4 4M4 15v2a4 4 0 0 0 4 4h8a4 4 0 0 0 4-4v-2",
|
|
362
|
+
file: "M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8l-5-5Zm0 0v5h5",
|
|
363
|
+
folder: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z",
|
|
364
|
+
user: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm-7 8a7 7 0 0 1 14 0",
|
|
365
|
+
settings: "M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm7.4-3a7.4 7.4 0 0 0-.1-1.2l2-1.6-2-3.4-2.4 1a7.5 7.5 0 0 0-2-1.2L14.5 3h-5l-.4 2.6a7.5 7.5 0 0 0-2 1.2l-2.4-1-2 3.4 2 1.6a7.4 7.4 0 0 0 0 2.4l-2 1.6 2 3.4 2.4-1a7.5 7.5 0 0 0 2 1.2l.4 2.6h5l.4-2.6a7.5 7.5 0 0 0 2-1.2l2.4 1 2-3.4-2-1.6c.1-.4.1-.8.1-1.2Z",
|
|
366
|
+
copy: "M9 9h10v10a2 2 0 0 1-2 2H11a2 2 0 0 1-2-2V9Zm0 0V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4",
|
|
367
|
+
trash: "M4 7h16m-10 4v6m4-6v6M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12M9 7V4h6v3",
|
|
368
|
+
// Dots are r=1 rings (≈3.5 units with the stroke), so they weigh the same as line icons at any size.
|
|
369
|
+
more: "M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0",
|
|
370
|
+
info: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-10v6m0-9h.01",
|
|
371
|
+
alert: "M12 9v4m0 4h.01M10.3 3.9 2.4 17.5A2 2 0 0 0 4.1 20.5h15.8a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z",
|
|
372
|
+
grip: "M9 6m-1 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0M15 6m-1 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0M9 18m-1 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0M15 18m-1 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0",
|
|
373
|
+
sun: "M12 16a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm0-14v2m0 16v2M4.9 4.9l1.4 1.4m11.4 11.4 1.4 1.4M2 12h2m16 0h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",
|
|
374
|
+
moon: "M20 14.5A8 8 0 0 1 9.5 4 8 8 0 1 0 20 14.5Z",
|
|
375
|
+
command: "M9 9V6a3 3 0 1 0-3 3h3Zm0 0h6m-6 0v6m6-6V6a3 3 0 1 1 3 3h-3Zm0 0v6m0 0h3a3 3 0 1 1-3 3v-3Zm0 0H9m0 0v3a3 3 0 1 1-3-3h3Z",
|
|
376
|
+
dot: "M12 12h.01",
|
|
377
|
+
"sidebar-left": "M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm4 0v16",
|
|
378
|
+
"sidebar-right": "M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm8 0v16",
|
|
379
|
+
sort: "M7 4v16m0 0-3-3m3 3 3-3M17 20V4m0 0-3 3m3-3 3 3",
|
|
380
|
+
filter: "M4 6h16M7 12h10m-7 6h4",
|
|
381
|
+
"arrow-up": "M12 19V5m-6 6 6-6 6 6",
|
|
382
|
+
"arrow-down": "M12 5v14m-6-6 6 6 6-6",
|
|
383
|
+
home: "m4 10 8-6 8 6v9a1 1 0 0 1-1 1h-4v-6h-6v6H5a1 1 0 0 1-1-1v-9Z",
|
|
384
|
+
inbox: "M4 13h4l1.5 3h5L16 13h4M5.5 5h13L20 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-5l1.5-8Z",
|
|
385
|
+
chart: "M4 20h16M7 16v-5m5 5V7m5 9v-3",
|
|
386
|
+
bell: "M6 16V11a6 6 0 1 1 12 0v5l1.5 2h-15L6 16Zm4 4h4",
|
|
387
|
+
layers: "m12 4 8 4-8 4-8-4 8-4Zm-8 8 8 4 8-4m-16 4 8 4 8-4",
|
|
388
|
+
activity: "M3 12h4l3-7 4 14 3-7h4"
|
|
389
|
+
};
|
|
390
|
+
function Icon({ name, weight = 1.5, ...props }) {
|
|
391
|
+
return /* @__PURE__ */ jsx2(
|
|
392
|
+
"svg",
|
|
393
|
+
{
|
|
394
|
+
viewBox: "0 0 24 24",
|
|
395
|
+
fill: "none",
|
|
396
|
+
stroke: "currentColor",
|
|
397
|
+
strokeWidth: weight,
|
|
398
|
+
strokeLinecap: "round",
|
|
399
|
+
strokeLinejoin: "round",
|
|
400
|
+
"aria-hidden": "true",
|
|
401
|
+
focusable: "false",
|
|
402
|
+
...props,
|
|
403
|
+
children: /* @__PURE__ */ jsx2("path", { d: paths[name] })
|
|
404
|
+
}
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// src/components/card.tsx
|
|
409
|
+
import { createContext, forwardRef as forwardRef2, useContext, useId, useRef as useRef3 } from "react";
|
|
410
|
+
import { motion as motion3 } from "motion/react";
|
|
411
|
+
|
|
412
|
+
// src/components/_structure-shared.tsx
|
|
413
|
+
import { useState as useState3 } from "react";
|
|
414
|
+
import { AnimatePresence, motion as motion2 } from "motion/react";
|
|
415
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
416
|
+
var shown = { height: "auto", opacity: 1 };
|
|
417
|
+
var hidden = { height: 0, opacity: 0 };
|
|
418
|
+
function Collapse({ open, keepMounted, children, className, innerRef, innerClassName, ...props }) {
|
|
419
|
+
const rest = props;
|
|
420
|
+
const [settledClosed, setSettledClosed] = useState3(!open);
|
|
421
|
+
if (open && settledClosed) setSettledClosed(false);
|
|
422
|
+
const inner = /* @__PURE__ */ jsx3("div", { className: cx("sw-collapse__inner", innerClassName), children });
|
|
423
|
+
if (keepMounted) {
|
|
424
|
+
return /* @__PURE__ */ jsx3(
|
|
425
|
+
motion2.div,
|
|
426
|
+
{
|
|
427
|
+
ref: innerRef,
|
|
428
|
+
className: cx("sw-collapse", className),
|
|
429
|
+
initial: false,
|
|
430
|
+
animate: open ? shown : hidden,
|
|
431
|
+
transition: transitions.base,
|
|
432
|
+
onAnimationComplete: () => {
|
|
433
|
+
if (!open) setSettledClosed(true);
|
|
434
|
+
},
|
|
435
|
+
hidden: !open && settledClosed,
|
|
436
|
+
"aria-hidden": !open || void 0,
|
|
437
|
+
inert: !open || void 0,
|
|
438
|
+
...rest,
|
|
439
|
+
children: inner
|
|
440
|
+
}
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
return /* @__PURE__ */ jsx3(AnimatePresence, { initial: false, children: open && /* @__PURE__ */ jsx3(
|
|
444
|
+
motion2.div,
|
|
445
|
+
{
|
|
446
|
+
ref: innerRef,
|
|
447
|
+
className: cx("sw-collapse", className),
|
|
448
|
+
initial: hidden,
|
|
449
|
+
animate: shown,
|
|
450
|
+
exit: hidden,
|
|
451
|
+
transition: transitions.base,
|
|
452
|
+
...rest,
|
|
453
|
+
children: inner
|
|
454
|
+
}
|
|
455
|
+
) });
|
|
456
|
+
}
|
|
457
|
+
var idPart = (v) => v.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
458
|
+
var isBrowser = () => typeof window !== "undefined";
|
|
459
|
+
function prefersReducedMotion() {
|
|
460
|
+
return isBrowser() && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// src/components/card.tsx
|
|
464
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
465
|
+
var FrameContext = createContext(false);
|
|
466
|
+
var NESTED_CONTROL = 'a[href], button, input, select, textarea, summary, label, [contenteditable="true"], [role="button"], [role="link"], [role="switch"], [role="checkbox"], [role="radio"], [role="slider"], [role="tab"], [role="option"], [role="menuitem"], [role="combobox"], [role="spinbutton"], [role="treeitem"], [role="gridcell"], [role="separator"], [role="scrollbar"]';
|
|
467
|
+
function fromNestedControl(event) {
|
|
468
|
+
const card = event.currentTarget;
|
|
469
|
+
const target = event.target;
|
|
470
|
+
const hit = target?.closest?.(NESTED_CONTROL);
|
|
471
|
+
if (hit && hit !== card && card.contains(hit)) return true;
|
|
472
|
+
const own = card.dataset.sw ?? "card";
|
|
473
|
+
const comp = target?.closest?.("[data-sw]");
|
|
474
|
+
if (comp && comp !== card && card.contains(comp)) {
|
|
475
|
+
const sw = comp.getAttribute("data-sw") ?? "";
|
|
476
|
+
if (!sw.startsWith("card-") && !sw.startsWith(`${own}-`)) return true;
|
|
477
|
+
}
|
|
478
|
+
return false;
|
|
479
|
+
}
|
|
480
|
+
var Card = forwardRef2(function Card2({
|
|
481
|
+
variant = "surface",
|
|
482
|
+
padding: paddingProp,
|
|
483
|
+
radius: radiusProp,
|
|
484
|
+
smoothing: smoothing2,
|
|
485
|
+
bordered,
|
|
486
|
+
interactive,
|
|
487
|
+
href,
|
|
488
|
+
target,
|
|
489
|
+
rel,
|
|
490
|
+
clipContent,
|
|
491
|
+
className,
|
|
492
|
+
style,
|
|
493
|
+
children,
|
|
494
|
+
title,
|
|
495
|
+
icon,
|
|
496
|
+
count,
|
|
497
|
+
actions,
|
|
498
|
+
toolbar,
|
|
499
|
+
footer,
|
|
500
|
+
collapsible = false,
|
|
501
|
+
open: openProp,
|
|
502
|
+
defaultOpen = true,
|
|
503
|
+
onOpenChange,
|
|
504
|
+
headingLevel = 3,
|
|
505
|
+
leading,
|
|
506
|
+
framed: framedProp,
|
|
507
|
+
...rest
|
|
508
|
+
}, ref) {
|
|
509
|
+
const panel = title != null || toolbar != null || footer != null;
|
|
510
|
+
const inFrame = useContext(FrameContext);
|
|
511
|
+
const framed = framedProp ?? !inFrame;
|
|
512
|
+
const padding = paddingProp ?? (panel ? "sm" : "md");
|
|
513
|
+
const radius2 = radiusProp ?? (panel ? "md" : "lg");
|
|
514
|
+
const sq = useSquircle({ radius: radius2, smoothing: smoothing2, enabled: framed });
|
|
515
|
+
const border = framed && (bordered ?? variant !== "ghost");
|
|
516
|
+
const [openState, setOpen] = useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange });
|
|
517
|
+
const open = !collapsible || openState;
|
|
518
|
+
const panelId = useId();
|
|
519
|
+
const rootRef = useRef3(null);
|
|
520
|
+
useAgentBinding(rootRef, {
|
|
521
|
+
kind: "card",
|
|
522
|
+
label: typeof title === "string" ? title : void 0,
|
|
523
|
+
state: () => ({ open, collapsible }),
|
|
524
|
+
actions: collapsible ? { open: () => setOpen(true), close: () => setOpen(false), toggle: () => setOpen((o) => !o) } : {}
|
|
525
|
+
});
|
|
526
|
+
const contentId = useId();
|
|
527
|
+
const linkRef = useRef3(null);
|
|
528
|
+
const { onClick, onKeyDown, onPointerDown, ...props } = rest;
|
|
529
|
+
const down = useRef3(null);
|
|
530
|
+
return /* @__PURE__ */ jsxs2(
|
|
531
|
+
motion3.div,
|
|
532
|
+
{
|
|
533
|
+
ref: mergeRefs(ref, rootRef, sq.ref),
|
|
534
|
+
"data-sw": "card",
|
|
535
|
+
"data-variant": variant,
|
|
536
|
+
"data-padding": padding,
|
|
537
|
+
"data-layout": panel ? "panel" : void 0,
|
|
538
|
+
"data-framed": framed ? "" : void 0,
|
|
539
|
+
"data-state": collapsible ? open ? "open" : "closed" : void 0,
|
|
540
|
+
"data-interactive": interactive || href ? "" : void 0,
|
|
541
|
+
"data-linked": href ? "" : void 0,
|
|
542
|
+
className: cx("sw-card", framed && "sw-sq", className),
|
|
543
|
+
style: { ...clipContent && sq.paths.d ? { clipPath: `path('${sq.paths.d}')` } : null, ...style },
|
|
544
|
+
tabIndex: !href && interactive && onClick ? 0 : void 0,
|
|
545
|
+
onPointerDown: (e) => {
|
|
546
|
+
onPointerDown?.(e);
|
|
547
|
+
down.current = { x: e.clientX, y: e.clientY };
|
|
548
|
+
},
|
|
549
|
+
onClick: href || interactive && onClick ? (e) => {
|
|
550
|
+
const start = down.current;
|
|
551
|
+
down.current = null;
|
|
552
|
+
const dragged = !!start && e.detail > 0 && Math.hypot(e.clientX - start.x, e.clientY - start.y) > 4;
|
|
553
|
+
if (dragged || fromNestedControl(e)) return;
|
|
554
|
+
onClick?.(e);
|
|
555
|
+
if (href && !e.defaultPrevented && linkRef.current) {
|
|
556
|
+
linkRef.current.dispatchEvent(new MouseEvent("click", {
|
|
557
|
+
bubbles: true,
|
|
558
|
+
cancelable: true,
|
|
559
|
+
ctrlKey: e.ctrlKey,
|
|
560
|
+
metaKey: e.metaKey,
|
|
561
|
+
altKey: e.altKey,
|
|
562
|
+
shiftKey: e.shiftKey
|
|
563
|
+
}));
|
|
564
|
+
}
|
|
565
|
+
} : onClick,
|
|
566
|
+
onKeyDown: (e) => {
|
|
567
|
+
onKeyDown?.(e);
|
|
568
|
+
if (!href && interactive && onClick && !e.defaultPrevented && e.target === e.currentTarget && (e.key === "Enter" || e.key === " ")) {
|
|
569
|
+
e.preventDefault();
|
|
570
|
+
e.currentTarget.click();
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
...props,
|
|
574
|
+
children: [
|
|
575
|
+
framed && /* @__PURE__ */ jsx4(SquircleLayers, { paths: sq.paths, radius: sq.radius, ringOffset: sq.ringOffset, borderWidth: border ? 1 : 0 }),
|
|
576
|
+
panel ? /* @__PURE__ */ jsx4(
|
|
577
|
+
PanelLayout,
|
|
578
|
+
{
|
|
579
|
+
id: panelId,
|
|
580
|
+
title,
|
|
581
|
+
icon,
|
|
582
|
+
count,
|
|
583
|
+
actions,
|
|
584
|
+
toolbar,
|
|
585
|
+
footer,
|
|
586
|
+
collapsible,
|
|
587
|
+
open,
|
|
588
|
+
onToggle: () => setOpen((o) => !o),
|
|
589
|
+
headingLevel,
|
|
590
|
+
leading,
|
|
591
|
+
children: /* @__PURE__ */ jsx4(FrameContext.Provider, { value: true, children })
|
|
592
|
+
}
|
|
593
|
+
) : href ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
594
|
+
/* @__PURE__ */ jsx4(
|
|
595
|
+
"a",
|
|
596
|
+
{
|
|
597
|
+
ref: linkRef,
|
|
598
|
+
"data-sw": "link",
|
|
599
|
+
className: "sw-card__link",
|
|
600
|
+
href,
|
|
601
|
+
target,
|
|
602
|
+
rel,
|
|
603
|
+
"aria-label": rest["aria-label"],
|
|
604
|
+
"aria-labelledby": rest["aria-labelledby"] ?? (rest["aria-label"] ? void 0 : contentId)
|
|
605
|
+
}
|
|
606
|
+
),
|
|
607
|
+
/* @__PURE__ */ jsx4("div", { id: contentId, className: "sw-card__linked-content", children })
|
|
608
|
+
] }) : children
|
|
609
|
+
]
|
|
610
|
+
}
|
|
611
|
+
);
|
|
612
|
+
});
|
|
613
|
+
function CardHeader({ className, ...p }) {
|
|
614
|
+
return /* @__PURE__ */ jsx4("div", { "data-sw": "card-header", className: cx("sw-card__header", className), ...p });
|
|
615
|
+
}
|
|
616
|
+
function CardTitle({ className, as: As = "h3", ...p }) {
|
|
617
|
+
return /* @__PURE__ */ jsx4(As, { "data-sw": "card-title", className: cx("sw-card__title", className), ...p });
|
|
618
|
+
}
|
|
619
|
+
function CardDescription({ className, ...p }) {
|
|
620
|
+
return /* @__PURE__ */ jsx4("p", { "data-sw": "card-description", className: cx("sw-card__description", className), ...p });
|
|
621
|
+
}
|
|
622
|
+
function CardContent({ className, ...p }) {
|
|
623
|
+
return /* @__PURE__ */ jsx4("div", { "data-sw": "card-content", className: cx("sw-card__content", className), ...p });
|
|
624
|
+
}
|
|
625
|
+
function CardFooter({ className, ...p }) {
|
|
626
|
+
return /* @__PURE__ */ jsx4("div", { "data-sw": "card-footer", className: cx("sw-card__footer", className), ...p });
|
|
627
|
+
}
|
|
628
|
+
function PanelLayout({ id, title, icon, count, actions, toolbar, footer, collapsible, open, onToggle, headingLevel, leading, children }) {
|
|
629
|
+
const H = `h${headingLevel}`;
|
|
630
|
+
const label = /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
631
|
+
icon && /* @__PURE__ */ jsx4("span", { className: "sw-card__icon", "aria-hidden": true, children: icon }),
|
|
632
|
+
/* @__PURE__ */ jsx4("span", { className: "sw-card__bar-title", children: title }),
|
|
633
|
+
count != null && /* @__PURE__ */ jsx4("span", { className: "sw-card__count", children: count })
|
|
634
|
+
] });
|
|
635
|
+
const body = /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
636
|
+
toolbar && /* @__PURE__ */ jsx4("div", { className: "sw-card__toolbar", children: toolbar }),
|
|
637
|
+
/* @__PURE__ */ jsx4("div", { className: "sw-card__body", children }),
|
|
638
|
+
footer && /* @__PURE__ */ jsx4("div", { className: "sw-card__foot", children: footer })
|
|
639
|
+
] });
|
|
640
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
641
|
+
title != null && /* @__PURE__ */ jsxs2("div", { className: "sw-card__bar", children: [
|
|
642
|
+
leading,
|
|
643
|
+
/* @__PURE__ */ jsx4(H, { className: "sw-card__heading", children: collapsible ? /* @__PURE__ */ jsxs2("button", { type: "button", id: `${id}-t`, "aria-expanded": open, "aria-controls": `${id}-b`, className: "sw-card__trigger", onClick: onToggle, children: [
|
|
644
|
+
/* @__PURE__ */ jsx4("span", { className: "sw-card__chevron", "aria-hidden": true, children: /* @__PURE__ */ jsx4(Icon, { name: "chevron-right", weight: 2 }) }),
|
|
645
|
+
label
|
|
646
|
+
] }) : /* @__PURE__ */ jsx4("span", { id: `${id}-t`, className: "sw-card__trigger", "data-static": "", children: label }) }),
|
|
647
|
+
actions && /* @__PURE__ */ jsx4("div", { className: "sw-card__actions", children: actions })
|
|
648
|
+
] }),
|
|
649
|
+
collapsible ? /* @__PURE__ */ jsx4(Collapse, { open, id: `${id}-b`, role: "region", "aria-labelledby": `${id}-t`, className: "sw-card__fold", innerClassName: "sw-card__inner", children: body }) : /* @__PURE__ */ jsx4("div", { className: "sw-card__inner", children: body })
|
|
650
|
+
] });
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
export {
|
|
654
|
+
resolveRadius,
|
|
655
|
+
resolveSmoothing,
|
|
656
|
+
useSquircle,
|
|
657
|
+
SquircleLayers,
|
|
658
|
+
InsetSquircleButton,
|
|
659
|
+
Squircle,
|
|
660
|
+
cx,
|
|
661
|
+
transitions,
|
|
662
|
+
press,
|
|
663
|
+
lift,
|
|
664
|
+
enter,
|
|
665
|
+
stagger,
|
|
666
|
+
motionPresets,
|
|
667
|
+
mergeRefs,
|
|
668
|
+
moveFocus,
|
|
669
|
+
useControllableState,
|
|
670
|
+
Collapse,
|
|
671
|
+
idPart,
|
|
672
|
+
prefersReducedMotion,
|
|
673
|
+
Icon,
|
|
674
|
+
FrameContext,
|
|
675
|
+
Card,
|
|
676
|
+
CardHeader,
|
|
677
|
+
CardTitle,
|
|
678
|
+
CardDescription,
|
|
679
|
+
CardContent,
|
|
680
|
+
CardFooter
|
|
681
|
+
};
|