@brett_lamy/ui 5.0.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/adaptive-pane.d.ts +12 -1
- package/dist/components/adaptive-pane.d.ts.map +1 -1
- package/dist/components/adaptive-pane.js +122 -19
- package/dist/components/avatar.d.ts +47 -5
- package/dist/components/avatar.d.ts.map +1 -1
- package/dist/components/avatar.js +101 -14
- package/dist/components/breadcrumb.d.ts +87 -0
- package/dist/components/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb.js +312 -0
- package/dist/components/calendar.d.ts +26 -0
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +97 -0
- package/dist/components/color-field.d.ts +22 -0
- package/dist/components/color-field.d.ts.map +1 -0
- package/dist/components/color-field.js +60 -0
- package/dist/components/color-picker.d.ts +49 -0
- package/dist/components/color-picker.d.ts.map +1 -0
- package/dist/components/color-picker.js +121 -0
- package/dist/components/command-menu.js +13 -13
- package/dist/components/credenza.d.ts +5 -2
- package/dist/components/credenza.d.ts.map +1 -1
- package/dist/components/credenza.js +62 -60
- package/dist/components/date-field.d.ts +19 -0
- package/dist/components/date-field.d.ts.map +1 -0
- package/dist/components/date-field.js +79 -0
- package/dist/components/date-picker.d.ts +38 -0
- package/dist/components/date-picker.d.ts.map +1 -0
- package/dist/components/date-picker.js +110 -0
- package/dist/components/edge-drawer.d.ts +7 -2
- package/dist/components/edge-drawer.d.ts.map +1 -1
- package/dist/components/edge-drawer.js +7 -4
- package/dist/components/filmstrip.d.ts +19 -0
- package/dist/components/filmstrip.d.ts.map +1 -0
- package/dist/components/filmstrip.js +59 -0
- package/dist/components/filter-input.js +4 -4
- package/dist/components/filter.js +62 -62
- package/dist/components/font-picker.d.ts +67 -0
- package/dist/components/font-picker.d.ts.map +1 -0
- package/dist/components/font-picker.js +373 -0
- package/dist/components/markdown-editor.d.ts +11 -0
- package/dist/components/markdown-editor.d.ts.map +1 -1
- package/dist/components/markdown-editor.js +72 -65
- package/dist/components/navigation-stack.d.ts.map +1 -1
- package/dist/components/navigation-stack.js +75 -65
- package/dist/components/number-morph.d.ts.map +1 -1
- package/dist/components/number-morph.js +5 -5
- package/dist/components/replay-preview.d.ts +2 -2
- package/dist/components/replay-preview.d.ts.map +1 -1
- package/dist/components/replay-preview.js +3 -3
- package/dist/components/result-table.js +10 -10
- package/dist/components/schema-tree.d.ts.map +1 -1
- package/dist/components/schema-tree.js +62 -131
- package/dist/components/segmented.d.ts +1 -1
- package/dist/components/segmented.d.ts.map +1 -1
- package/dist/components/segmented.js +1 -1
- package/dist/components/sidebar.d.ts.map +1 -1
- package/dist/components/sidebar.js +8 -4
- package/dist/components/spinner-shapes.d.ts +36 -0
- package/dist/components/spinner-shapes.d.ts.map +1 -1
- package/dist/components/spinner-shapes.js +105 -0
- package/dist/components/spinner.d.ts +1 -1
- package/dist/components/spinner.d.ts.map +1 -1
- package/dist/components/split-view.d.ts +3 -1
- package/dist/components/split-view.d.ts.map +1 -1
- package/dist/components/split-view.js +211 -211
- package/dist/components/spreadsheet.d.ts +58 -0
- package/dist/components/spreadsheet.d.ts.map +1 -0
- package/dist/components/spreadsheet.js +804 -0
- package/dist/components/sql-console.d.ts.map +1 -1
- package/dist/components/sql-console.js +2 -1
- package/dist/components/sql-editor.js +8 -8
- package/dist/components/stl-viewer.d.ts +3 -0
- package/dist/components/stl-viewer.d.ts.map +1 -0
- package/dist/components/stl-viewer.js +2 -0
- package/dist/components/strudel-player.d.ts +3 -0
- package/dist/components/strudel-player.d.ts.map +1 -0
- package/dist/components/strudel-player.js +2 -0
- package/dist/components/strudel-rack.d.ts +3 -0
- package/dist/components/strudel-rack.d.ts.map +1 -0
- package/dist/components/strudel-rack.js +2 -0
- package/dist/components/strudel-syntax.d.ts +3 -0
- package/dist/components/strudel-syntax.d.ts.map +1 -0
- package/dist/components/strudel-syntax.js +2 -0
- package/dist/components/tabs.js +3 -3
- package/dist/components/tailscale-menu.d.ts +69 -0
- package/dist/components/tailscale-menu.d.ts.map +1 -0
- package/dist/components/tailscale-menu.js +202 -0
- package/dist/components/toggle-group.js +3 -3
- package/dist/components/tree.d.ts +82 -0
- package/dist/components/tree.d.ts.map +1 -0
- package/dist/components/tree.js +494 -0
- package/dist/components/video-preview.d.ts +46 -0
- package/dist/components/video-preview.d.ts.map +1 -0
- package/dist/components/video-preview.js +197 -0
- package/dist/components/video-timeline.d.ts +64 -0
- package/dist/components/video-timeline.d.ts.map +1 -0
- package/dist/components/video-timeline.js +479 -0
- package/dist/components/waveform.d.ts +23 -0
- package/dist/components/waveform.d.ts.map +1 -0
- package/dist/components/waveform.js +56 -0
- package/dist/ffmpeg-worker.js +118 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +53 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +145 -116
- package/dist/lib/csv.d.ts +28 -0
- package/dist/lib/csv.d.ts.map +1 -0
- package/dist/lib/csv.js +90 -0
- package/dist/lib/drawer-swipe.d.ts +31 -0
- package/dist/lib/drawer-swipe.d.ts.map +1 -0
- package/dist/lib/drawer-swipe.js +68 -0
- package/dist/lib/ffmpeg/index.d.ts +117 -0
- package/dist/lib/ffmpeg/index.d.ts.map +1 -0
- package/dist/lib/ffmpeg/index.js +204 -0
- package/dist/lib/ffmpeg/media.d.ts +39 -0
- package/dist/lib/ffmpeg/media.d.ts.map +1 -0
- package/dist/lib/ffmpeg/media.js +100 -0
- package/dist/lib/ffmpeg/react.d.ts +51 -0
- package/dist/lib/ffmpeg/react.d.ts.map +1 -0
- package/dist/lib/ffmpeg/react.js +113 -0
- package/dist/lib/google-fonts.d.ts +47 -0
- package/dist/lib/google-fonts.d.ts.map +1 -0
- package/dist/lib/google-fonts.generated.d.ts +2 -0
- package/dist/lib/google-fonts.generated.d.ts.map +1 -0
- package/dist/lib/google-fonts.generated.js +1925 -0
- package/dist/lib/google-fonts.js +112 -0
- package/dist/lib/icon.d.ts +6 -1
- package/dist/lib/icon.d.ts.map +1 -1
- package/dist/lib/icon.js +2 -0
- package/dist/lib/playback.d.ts +34 -0
- package/dist/lib/playback.d.ts.map +1 -0
- package/dist/lib/playback.js +79 -0
- package/dist/lib/spreadsheet-gpu.d.ts +9 -0
- package/dist/lib/spreadsheet-gpu.d.ts.map +1 -0
- package/dist/lib/spreadsheet-gpu.js +237 -0
- package/dist/lib/spreadsheet.d.ts +82 -0
- package/dist/lib/spreadsheet.d.ts.map +1 -0
- package/dist/lib/spreadsheet.js +162 -0
- package/dist/lib/syntax.d.ts +2 -6
- package/dist/lib/syntax.d.ts.map +1 -1
- package/dist/lib/syntax.js +53 -75
- package/dist/lib/tailscale-connect.d.ts +33 -0
- package/dist/lib/tailscale-connect.d.ts.map +1 -1
- package/dist/lib/tailscale-connect.js +221 -42
- package/dist/lib/tailscale-exit.d.ts +19 -0
- package/dist/lib/tailscale-exit.d.ts.map +1 -0
- package/dist/lib/tailscale-exit.js +14 -0
- package/dist/lib/tailscale-fake.d.ts +8 -0
- package/dist/lib/tailscale-fake.d.ts.map +1 -1
- package/dist/lib/tailscale-fake.js +51 -26
- package/dist/lib/tailscale-roots.d.ts +3 -0
- package/dist/lib/tailscale-roots.d.ts.map +1 -0
- package/dist/lib/tailscale-roots.js +4 -0
- package/dist/lib/tailscale.d.ts +23 -0
- package/dist/lib/tailscale.d.ts.map +1 -1
- package/dist/lib/tailscale.js +156 -94
- package/dist/lib/title-flight.d.ts +4 -0
- package/dist/lib/title-flight.d.ts.map +1 -1
- package/dist/lib/title-flight.js +15 -12
- package/dist/lib/tokens.generated.d.ts +2 -2
- package/dist/lib/tokens.generated.d.ts.map +1 -1
- package/dist/lib/tokens.generated.js +2 -2
- package/dist/lib/video-render.d.ts +38 -0
- package/dist/lib/video-render.d.ts.map +1 -0
- package/dist/lib/video-render.js +147 -0
- package/dist/lib/video-timeline.d.ts +154 -0
- package/dist/lib/video-timeline.d.ts.map +1 -0
- package/dist/lib/video-timeline.js +265 -0
- package/dist/lib/webgpu.d.ts +26 -0
- package/dist/lib/webgpu.d.ts.map +1 -0
- package/dist/lib/webgpu.js +28 -0
- package/dist/theme.css +3 -0
- package/package.json +10 -4
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { Icon as t } from "../lib/icon.js";
|
|
4
|
+
import { DropdownMenu as n, DropdownMenuContent as r, DropdownMenuItem as i, DropdownMenuSub as a } from "./dropdown-menu.js";
|
|
5
|
+
import { Children as o, createContext as s, isValidElement as c, useCallback as l, useContext as u, useLayoutEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
6
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
7
|
+
import { Breadcrumb as v, Breadcrumbs as y, Button as b, Link as x } from "react-aria-components";
|
|
8
|
+
import { cva as S } from "class-variance-authority";
|
|
9
|
+
//#region src/components/breadcrumb.tsx
|
|
10
|
+
function C(e, t, n = 0, r = 0, { keepHead: i = 1, keepTail: a = 1 } = {}) {
|
|
11
|
+
let o = e.length, s = {
|
|
12
|
+
head: o,
|
|
13
|
+
tail: 0
|
|
14
|
+
}, c = Math.max(0, Math.min(i, o)), l = Math.max(0, a);
|
|
15
|
+
if (t <= 0 || o - c <= l) return s;
|
|
16
|
+
let u = (t, n) => {
|
|
17
|
+
let r = 0;
|
|
18
|
+
for (let i = t; i < n; i++) r += e[i];
|
|
19
|
+
return r;
|
|
20
|
+
};
|
|
21
|
+
if (u(0, o) + (o - 1) * n <= t) return s;
|
|
22
|
+
let d = (e) => u(0, c) + r + u(o - e, o) + (c + e) * n;
|
|
23
|
+
for (let e = o - c - 1; e > l; e--) if (d(e) <= t) return {
|
|
24
|
+
head: c,
|
|
25
|
+
tail: e
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
head: c,
|
|
29
|
+
tail: l
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
var w = S("relative block w-full min-w-0 overflow-clip whitespace-nowrap text-foreground [overflow-clip-margin:4px]", {
|
|
33
|
+
variants: { size: {
|
|
34
|
+
sm: "text-caption",
|
|
35
|
+
default: "text-footnote",
|
|
36
|
+
lg: "text-subhead"
|
|
37
|
+
} },
|
|
38
|
+
defaultVariants: { size: "default" }
|
|
39
|
+
}), T = S([
|
|
40
|
+
"bl-btn box-border inline-flex max-w-full min-w-0 items-center rounded-md border-0 bg-transparent text-foreground/70 no-underline [font-family:inherit] whitespace-nowrap outline-none transition-colors motion-reduce:transition-none",
|
|
41
|
+
"data-current:text-foreground",
|
|
42
|
+
"data-focus-visible:ring-2 data-focus-visible:ring-ring"
|
|
43
|
+
], {
|
|
44
|
+
variants: {
|
|
45
|
+
size: {
|
|
46
|
+
sm: "h-5 gap-1 px-1",
|
|
47
|
+
default: "h-6 gap-1.5 px-1.5",
|
|
48
|
+
lg: "h-7 gap-1.5 px-2"
|
|
49
|
+
},
|
|
50
|
+
interactive: {
|
|
51
|
+
true: "cursor-pointer data-hovered:bg-secondary data-hovered:text-foreground data-pressed:bg-secondary-strong aria-expanded:bg-secondary aria-expanded:text-foreground data-disabled:cursor-default",
|
|
52
|
+
false: "cursor-default"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
size: "default",
|
|
57
|
+
interactive: !0
|
|
58
|
+
}
|
|
59
|
+
}), E = {
|
|
60
|
+
sm: 13,
|
|
61
|
+
default: 14,
|
|
62
|
+
lg: 16
|
|
63
|
+
}, D = {
|
|
64
|
+
sm: 12,
|
|
65
|
+
default: 13,
|
|
66
|
+
lg: 15
|
|
67
|
+
}, O = s({ size: "default" }), k = s(!1), A = (e, n) => typeof e == "string" ? /* @__PURE__ */ g(t, {
|
|
68
|
+
name: e,
|
|
69
|
+
size: n
|
|
70
|
+
}) : e;
|
|
71
|
+
function j({ className: n, children: r, ...i }) {
|
|
72
|
+
let { size: a } = u(O);
|
|
73
|
+
return /* @__PURE__ */ g("span", {
|
|
74
|
+
"data-slot": "breadcrumb-separator",
|
|
75
|
+
"aria-hidden": !0,
|
|
76
|
+
className: e("grid shrink-0 place-items-center px-0.5 text-tertiary-foreground", n),
|
|
77
|
+
...i,
|
|
78
|
+
children: r ?? /* @__PURE__ */ g(t, {
|
|
79
|
+
name: "chevron-right",
|
|
80
|
+
size: D[a],
|
|
81
|
+
sw: 2.2
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function M() {
|
|
86
|
+
let { separator: e } = u(O);
|
|
87
|
+
return e === null ? null : /* @__PURE__ */ g(j, { children: e });
|
|
88
|
+
}
|
|
89
|
+
var N = "min-h-9 py-1.5 text-subhead leading-5";
|
|
90
|
+
function P({ entry: e }) {
|
|
91
|
+
let t = {
|
|
92
|
+
id: e.id,
|
|
93
|
+
textValue: e.textValue ?? (typeof e.label == "string" ? e.label : void 0),
|
|
94
|
+
icon: e.icon ? A(e.icon, 18) : void 0,
|
|
95
|
+
className: N
|
|
96
|
+
};
|
|
97
|
+
return e.items?.length ? /* @__PURE__ */ _(a, { children: [/* @__PURE__ */ g(i, {
|
|
98
|
+
...t,
|
|
99
|
+
children: e.label
|
|
100
|
+
}), /* @__PURE__ */ g(F, {
|
|
101
|
+
entries: e.items,
|
|
102
|
+
selectedId: e.selectedId
|
|
103
|
+
})] }) : /* @__PURE__ */ g(i, {
|
|
104
|
+
...t,
|
|
105
|
+
href: e.href,
|
|
106
|
+
onAction: e.onPress,
|
|
107
|
+
children: e.label
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function F({ entries: e, selectedId: t }) {
|
|
111
|
+
let n = t != null;
|
|
112
|
+
return /* @__PURE__ */ g(r, {
|
|
113
|
+
placement: "bottom start",
|
|
114
|
+
offset: 4,
|
|
115
|
+
popoverClassName: "min-w-44",
|
|
116
|
+
selectionMode: n ? "single" : "none",
|
|
117
|
+
selectedKeys: n ? [t] : void 0,
|
|
118
|
+
disallowEmptySelection: n,
|
|
119
|
+
children: e.map((e) => /* @__PURE__ */ g(P, { entry: e }, e.id))
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function I({ icon: e, children: t }) {
|
|
123
|
+
let { size: n } = u(O);
|
|
124
|
+
return /* @__PURE__ */ _(h, { children: [e ? /* @__PURE__ */ g("span", {
|
|
125
|
+
className: "grid shrink-0 place-items-center",
|
|
126
|
+
children: A(e, E[n])
|
|
127
|
+
}) : null, t != null && t !== !1 ? /* @__PURE__ */ g("span", {
|
|
128
|
+
className: "min-w-0 truncate",
|
|
129
|
+
children: t
|
|
130
|
+
}) : null] });
|
|
131
|
+
}
|
|
132
|
+
var L = (t, n) => e("flex min-w-0 items-center", t ? "shrink" : "shrink-0", n);
|
|
133
|
+
function R({ isCurrent: e, icon: t, href: r, onPress: i, items: a, selectedId: o, children: s }) {
|
|
134
|
+
let { size: c } = u(O), l = /* @__PURE__ */ g(I, {
|
|
135
|
+
icon: t,
|
|
136
|
+
children: s
|
|
137
|
+
}), d = !!(r || i), f;
|
|
138
|
+
return f = a?.length ? /* @__PURE__ */ _(n, { children: [/* @__PURE__ */ g(b, {
|
|
139
|
+
"data-slot": "breadcrumb-link",
|
|
140
|
+
"data-current": e || void 0,
|
|
141
|
+
"aria-current": e ? "page" : void 0,
|
|
142
|
+
className: T({ size: c }),
|
|
143
|
+
children: l
|
|
144
|
+
}), /* @__PURE__ */ g(F, {
|
|
145
|
+
entries: a,
|
|
146
|
+
selectedId: o
|
|
147
|
+
})] }) : d || e ? /* @__PURE__ */ g(x, {
|
|
148
|
+
"data-slot": "breadcrumb-link",
|
|
149
|
+
href: r,
|
|
150
|
+
onPress: i,
|
|
151
|
+
...d ? { isDisabled: !1 } : null,
|
|
152
|
+
className: T({
|
|
153
|
+
size: c,
|
|
154
|
+
interactive: d
|
|
155
|
+
}),
|
|
156
|
+
children: l
|
|
157
|
+
}) : /* @__PURE__ */ g("span", {
|
|
158
|
+
"data-slot": "breadcrumb-link",
|
|
159
|
+
className: T({
|
|
160
|
+
size: c,
|
|
161
|
+
interactive: !1
|
|
162
|
+
}),
|
|
163
|
+
children: l
|
|
164
|
+
}), /* @__PURE__ */ _(h, { children: [f, e ? null : /* @__PURE__ */ g(M, {})] });
|
|
165
|
+
}
|
|
166
|
+
function z({ icon: e, className: t, children: n }) {
|
|
167
|
+
let { size: r } = u(O);
|
|
168
|
+
return /* @__PURE__ */ _("li", {
|
|
169
|
+
className: L(!1, t),
|
|
170
|
+
children: [/* @__PURE__ */ g("span", {
|
|
171
|
+
className: T({
|
|
172
|
+
size: r,
|
|
173
|
+
interactive: !1
|
|
174
|
+
}),
|
|
175
|
+
children: /* @__PURE__ */ g(I, {
|
|
176
|
+
icon: e,
|
|
177
|
+
children: n
|
|
178
|
+
})
|
|
179
|
+
}), /* @__PURE__ */ g(M, {})]
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function B({ id: e, label: t, children: n, className: r, ...i }) {
|
|
183
|
+
let a = u(k), o = n ?? t;
|
|
184
|
+
return a ? /* @__PURE__ */ g(z, {
|
|
185
|
+
icon: i.icon,
|
|
186
|
+
className: r,
|
|
187
|
+
children: o
|
|
188
|
+
}) : /* @__PURE__ */ g(v, {
|
|
189
|
+
id: e,
|
|
190
|
+
"data-slot": "breadcrumb-item",
|
|
191
|
+
className: ({ isCurrent: e }) => L(e, r),
|
|
192
|
+
children: ({ isCurrent: e }) => /* @__PURE__ */ g(R, {
|
|
193
|
+
...i,
|
|
194
|
+
isCurrent: e,
|
|
195
|
+
children: o
|
|
196
|
+
})
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function V({ items: e, label: r = "More", className: i }) {
|
|
200
|
+
let a = u(k), { size: o } = u(O), s = /* @__PURE__ */ g("span", {
|
|
201
|
+
className: "grid shrink-0 place-items-center",
|
|
202
|
+
children: /* @__PURE__ */ g(t, {
|
|
203
|
+
name: "ellipsis",
|
|
204
|
+
size: E[o] + 2
|
|
205
|
+
})
|
|
206
|
+
});
|
|
207
|
+
return a ? /* @__PURE__ */ _("li", {
|
|
208
|
+
"data-ellipsis": "",
|
|
209
|
+
className: L(!1, i),
|
|
210
|
+
children: [/* @__PURE__ */ g("span", {
|
|
211
|
+
className: T({
|
|
212
|
+
size: o,
|
|
213
|
+
interactive: !1
|
|
214
|
+
}),
|
|
215
|
+
children: s
|
|
216
|
+
}), /* @__PURE__ */ g(M, {})]
|
|
217
|
+
}) : /* @__PURE__ */ g(v, {
|
|
218
|
+
"data-slot": "breadcrumb-ellipsis",
|
|
219
|
+
className: ({ isCurrent: e }) => L(e, i),
|
|
220
|
+
children: ({ isCurrent: t }) => /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _(n, { children: [/* @__PURE__ */ g(b, {
|
|
221
|
+
"data-slot": "breadcrumb-link",
|
|
222
|
+
"aria-label": r,
|
|
223
|
+
className: T({ size: o }),
|
|
224
|
+
children: s
|
|
225
|
+
}), /* @__PURE__ */ g(F, { entries: e })] }), t ? null : /* @__PURE__ */ g(M, {})] })
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
var H = (e, t) => !!e && e.available === t.available && e.separator === t.separator && e.ellipsis === t.ellipsis && e.widths.length === t.widths.length && e.widths.every((e, n) => e === t.widths[n]);
|
|
229
|
+
function U(e) {
|
|
230
|
+
let t = getComputedStyle(e);
|
|
231
|
+
return e.clientWidth - (parseFloat(t.paddingLeft) || 0) - (parseFloat(t.paddingRight) || 0);
|
|
232
|
+
}
|
|
233
|
+
var W = (e) => {
|
|
234
|
+
let { id: t, label: n, children: r, icon: i, href: a, onPress: o, items: s, selectedId: c } = e.props;
|
|
235
|
+
return {
|
|
236
|
+
id: t ?? e.key ?? "",
|
|
237
|
+
label: r ?? n,
|
|
238
|
+
icon: i,
|
|
239
|
+
href: a,
|
|
240
|
+
onPress: o,
|
|
241
|
+
items: s,
|
|
242
|
+
selectedId: c
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
function G({ items: t, children: n, size: r, separator: i, collapse: a = !0, ellipsisLabel: s, keepHead: u, keepTail: h, className: v, "aria-label": b = "Breadcrumb", ...x }) {
|
|
246
|
+
let S = r ?? "default", T = f(() => t ? t.map((e) => /* @__PURE__ */ g(B, { ...e }, e.id)) : o.toArray(n).filter(c), [t, n]), E = p(null), D = p(null), [A, j] = m(null), M = l(() => {
|
|
247
|
+
let e = E.current, t = D.current;
|
|
248
|
+
if (!e || !t) return;
|
|
249
|
+
let n = Array.from(t.children), r = t.querySelector("[data-slot=breadcrumb-separator]")?.offsetWidth ?? 0, i = n.map((e) => Math.max(0, e.offsetWidth - r)), a = {
|
|
250
|
+
widths: i.slice(0, -1),
|
|
251
|
+
separator: r,
|
|
252
|
+
ellipsis: i[i.length - 1] ?? 0,
|
|
253
|
+
available: U(e)
|
|
254
|
+
};
|
|
255
|
+
j((e) => H(e, a) ? e : a);
|
|
256
|
+
}, []);
|
|
257
|
+
d(() => {
|
|
258
|
+
a && M();
|
|
259
|
+
}), d(() => {
|
|
260
|
+
if (!a) return;
|
|
261
|
+
let e = !0, t = () => {
|
|
262
|
+
e && M();
|
|
263
|
+
}, n = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
|
|
264
|
+
return n && (E.current && n.observe(E.current), D.current && n.observe(D.current)), document.fonts?.ready.then(t), () => {
|
|
265
|
+
e = !1, n?.disconnect();
|
|
266
|
+
};
|
|
267
|
+
}, [a, M]);
|
|
268
|
+
let N = a && A && A.widths.length === T.length ? C(A.widths, A.available, A.separator, A.ellipsis, {
|
|
269
|
+
keepHead: u,
|
|
270
|
+
keepTail: h
|
|
271
|
+
}) : null, P = N ? T.length - N.head - N.tail : 0, F = N && P > 0 ? [
|
|
272
|
+
...T.slice(0, N.head),
|
|
273
|
+
/* @__PURE__ */ g(V, {
|
|
274
|
+
label: s,
|
|
275
|
+
items: T.slice(N.head, T.length - N.tail).map(W)
|
|
276
|
+
}, "breadcrumb-ellipsis"),
|
|
277
|
+
...T.slice(T.length - N.tail)
|
|
278
|
+
] : T, I = f(() => ({
|
|
279
|
+
size: S,
|
|
280
|
+
separator: i
|
|
281
|
+
}), [S, i]);
|
|
282
|
+
return /* @__PURE__ */ g(O.Provider, {
|
|
283
|
+
value: I,
|
|
284
|
+
children: /* @__PURE__ */ _("nav", {
|
|
285
|
+
ref: E,
|
|
286
|
+
"data-slot": "breadcrumb",
|
|
287
|
+
"aria-label": b,
|
|
288
|
+
className: e(w({ size: r }), v),
|
|
289
|
+
...x,
|
|
290
|
+
children: [/* @__PURE__ */ g(y, {
|
|
291
|
+
"data-slot": "breadcrumb-list",
|
|
292
|
+
className: "m-0 flex min-w-0 list-none items-center p-0",
|
|
293
|
+
children: F
|
|
294
|
+
}), a ? /* @__PURE__ */ g("div", {
|
|
295
|
+
"data-slot": "breadcrumb-measure",
|
|
296
|
+
"aria-hidden": !0,
|
|
297
|
+
inert: !0,
|
|
298
|
+
className: "pointer-events-none invisible absolute top-0 left-0 size-0 overflow-hidden",
|
|
299
|
+
children: /* @__PURE__ */ g(k.Provider, {
|
|
300
|
+
value: !0,
|
|
301
|
+
children: /* @__PURE__ */ _("ol", {
|
|
302
|
+
ref: D,
|
|
303
|
+
className: "m-0 flex w-max list-none p-0",
|
|
304
|
+
children: [T, /* @__PURE__ */ g(V, { items: [] })]
|
|
305
|
+
})
|
|
306
|
+
})
|
|
307
|
+
}) : null]
|
|
308
|
+
})
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
//#endregion
|
|
312
|
+
export { G as Breadcrumb, V as BreadcrumbEllipsis, B as BreadcrumbItem, j as BreadcrumbSeparator, T as breadcrumbItemVariants, w as breadcrumbVariants, C as fitBreadcrumbs };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { CalendarProps as AriaCalendarProps, CalendarCellProps as AriaCalendarCellProps, CalendarGridProps as AriaCalendarGridProps, RangeCalendarProps as AriaRangeCalendarProps, DateValue } from 'react-aria-components';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
export declare const calendarVariants: (props?: ({
|
|
5
|
+
variant?: "card" | "plain" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
/** Previous / next buttons around the month and year. Must sit inside a Calendar or RangeCalendar. */
|
|
8
|
+
export declare function CalendarHeader({ className, ...props }: ComponentProps<'header'>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export interface CalendarCellProps extends Omit<AriaCalendarCellProps, 'children'> {
|
|
10
|
+
}
|
|
11
|
+
/** One day. In a RangeCalendar the days between the ends are joined by a band; today is tinted. */
|
|
12
|
+
export declare function CalendarCell({ className, date, ...props }: CalendarCellProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
/** A month: the weekday row and its days. `offset` shifts it forward by months (for a multi-month calendar). */
|
|
14
|
+
export declare function CalendarGrid({ className, ...props }: Omit<AriaCalendarGridProps, 'children'>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
interface CalendarExtras extends VariantProps<typeof calendarVariants> {
|
|
16
|
+
/** How many months to show side by side. Default: 1. */
|
|
17
|
+
visibleMonths?: 1 | 2 | 3;
|
|
18
|
+
}
|
|
19
|
+
export interface CalendarProps<T extends DateValue> extends AriaCalendarProps<T>, CalendarExtras {
|
|
20
|
+
}
|
|
21
|
+
export declare function Calendar<T extends DateValue>({ className, variant, visibleMonths, children, ...props }: CalendarProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export interface RangeCalendarProps<T extends DateValue> extends AriaRangeCalendarProps<T>, CalendarExtras {
|
|
23
|
+
}
|
|
24
|
+
export declare function RangeCalendar<T extends DateValue>({ className, variant, visibleMonths, children, ...props }: RangeCalendarProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/components/calendar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EACqB,KAAK,aAAa,IAAI,iBAAiB,EAC/B,KAAK,iBAAiB,IAAI,qBAAqB,EAC/C,KAAK,iBAAiB,IAAI,qBAAqB,EAE7C,KAAK,kBAAkB,IAAI,sBAAsB,EAIrF,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAYlE,eAAO,MAAM,gBAAgB;;8EAS3B,CAAC;AAEH,sGAAsG;AACtG,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAY/E;AAED,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC;CAAG;AAErF,mGAAmG;AACnG,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,2CAkC5E;AAED,gHAAgH;AAChH,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,2CAS5F;AAUD,UAAU,cAAe,SAAQ,YAAY,CAAC,OAAO,gBAAgB,CAAC;IACpE,wDAAwD;IACxD,aAAa,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,SAAS,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC,EAAE,cAAc;CAAG;AAEnG,wBAAgB,QAAQ,CAAC,CAAC,SAAS,SAAS,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,aAAiB,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC,2CAgB5H;AAED,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,SAAS,CAAE,SAAQ,sBAAsB,CAAC,CAAC,CAAC,EAAE,cAAc;CAAG;AAE7G,wBAAgB,aAAa,CAAC,CAAC,SAAS,SAAS,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,aAAiB,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAgBtI"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { Icon as t } from "../lib/icon.js";
|
|
4
|
+
import { Button as n } from "./button.js";
|
|
5
|
+
import { useContext as r } from "react";
|
|
6
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
import { Calendar as s, CalendarCell as c, CalendarGrid as l, CalendarGridBody as u, CalendarGridHeader as d, CalendarHeaderCell as f, Heading as p, RangeCalendar as m, RangeCalendarStateContext as h, composeRenderProps as g } from "react-aria-components";
|
|
8
|
+
import { cva as _ } from "class-variance-authority";
|
|
9
|
+
import { getLocalTimeZone as v, isToday as y } from "@internationalized/date";
|
|
10
|
+
//#region src/components/calendar.tsx
|
|
11
|
+
var b = _("flex w-fit max-w-full flex-col text-foreground data-disabled:opacity-50", {
|
|
12
|
+
variants: { variant: {
|
|
13
|
+
plain: "",
|
|
14
|
+
card: "rounded-panel bg-secondary p-3"
|
|
15
|
+
} },
|
|
16
|
+
defaultVariants: { variant: "plain" }
|
|
17
|
+
});
|
|
18
|
+
function x({ className: r, ...i }) {
|
|
19
|
+
return /* @__PURE__ */ o("header", {
|
|
20
|
+
"data-slot": "calendar-header",
|
|
21
|
+
className: e("flex items-center gap-1 pb-2", r),
|
|
22
|
+
...i,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ a(n, {
|
|
25
|
+
slot: "previous",
|
|
26
|
+
variant: "quiet",
|
|
27
|
+
size: "icon",
|
|
28
|
+
className: "size-8",
|
|
29
|
+
children: /* @__PURE__ */ a(t, {
|
|
30
|
+
name: "chevron-left",
|
|
31
|
+
size: 16
|
|
32
|
+
})
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ a(p, { className: "min-w-0 flex-1 truncate text-center text-subhead font-semibold" }),
|
|
35
|
+
/* @__PURE__ */ a(n, {
|
|
36
|
+
slot: "next",
|
|
37
|
+
variant: "quiet",
|
|
38
|
+
size: "icon",
|
|
39
|
+
className: "size-8",
|
|
40
|
+
children: /* @__PURE__ */ a(t, {
|
|
41
|
+
name: "chevron-right",
|
|
42
|
+
size: 16
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function S({ className: t, date: n, ...i }) {
|
|
49
|
+
let o = r(h) != null, s = y(n, v());
|
|
50
|
+
return /* @__PURE__ */ a(c, {
|
|
51
|
+
"data-slot": "calendar-cell",
|
|
52
|
+
date: n,
|
|
53
|
+
className: g(t, (t) => e("group/cell relative flex size-9 cursor-default items-center justify-center text-subhead outline-none data-outside-month:invisible data-disabled:opacity-30", o && "before:absolute before:inset-y-0 before:inset-x-0 before:hidden before:bg-primary/15 data-selected:before:block data-selection-start:before:left-1/2 data-selection-end:before:right-1/2", t)),
|
|
54
|
+
...i,
|
|
55
|
+
children: ({ formattedDate: t }) => /* @__PURE__ */ a("span", {
|
|
56
|
+
className: e("relative z-1 grid size-9 place-items-center rounded-full tabular-nums transition-colors duration-spring-snappy ease-spring-snappy", "cursor-pointer not-group-data-selected/cell:group-data-hovered/cell:bg-secondary-strong group-data-focus-visible/cell:ring-2 group-data-focus-visible/cell:ring-ring", "group-data-unavailable/cell:text-destructive group-data-unavailable/cell:line-through group-data-disabled/cell:cursor-default", s && "font-semibold text-primary", o ? "group-data-selection-start/cell:bg-primary group-data-selection-start/cell:text-primary-foreground group-data-selection-end/cell:bg-primary group-data-selection-end/cell:text-primary-foreground" : "group-data-selected/cell:bg-primary group-data-selected/cell:text-primary-foreground"),
|
|
57
|
+
children: t
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function C({ className: t, ...n }) {
|
|
62
|
+
return /* @__PURE__ */ o(l, {
|
|
63
|
+
"data-slot": "calendar-grid",
|
|
64
|
+
className: e("border-separate border-spacing-0", t),
|
|
65
|
+
...n,
|
|
66
|
+
children: [/* @__PURE__ */ a(d, { children: (e) => /* @__PURE__ */ a(f, {
|
|
67
|
+
className: "h-8 text-center text-caption font-medium text-muted-foreground",
|
|
68
|
+
children: e
|
|
69
|
+
}) }), /* @__PURE__ */ a(u, { children: (e) => /* @__PURE__ */ a(S, { date: e }) })]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function w({ count: e }) {
|
|
73
|
+
return /* @__PURE__ */ a("div", {
|
|
74
|
+
className: "flex gap-6",
|
|
75
|
+
children: Array.from({ length: e }, (e, t) => /* @__PURE__ */ a(C, { offset: { months: t } }, t))
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function T({ className: t, variant: n, visibleMonths: r = 1, children: c, ...l }) {
|
|
79
|
+
return /* @__PURE__ */ a(s, {
|
|
80
|
+
"data-slot": "calendar",
|
|
81
|
+
visibleDuration: { months: r },
|
|
82
|
+
className: g(t, (t) => e(b({ variant: n }), t)),
|
|
83
|
+
...l,
|
|
84
|
+
children: c ?? /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(x, {}), /* @__PURE__ */ a(w, { count: r })] })
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function E({ className: t, variant: n, visibleMonths: r = 1, children: s, ...c }) {
|
|
88
|
+
return /* @__PURE__ */ a(m, {
|
|
89
|
+
"data-slot": "range-calendar",
|
|
90
|
+
visibleDuration: { months: r },
|
|
91
|
+
className: g(t, (t) => e(b({ variant: n }), t)),
|
|
92
|
+
...c,
|
|
93
|
+
children: s ?? /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(x, {}), /* @__PURE__ */ a(w, { count: r })] })
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { T as Calendar, S as CalendarCell, C as CalendarGrid, x as CalendarHeader, E as RangeCalendar, b as calendarVariants };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { ColorFieldProps as AriaColorFieldProps, ColorSwatchProps as AriaColorSwatchProps, Group, InputProps as AriaInputProps } from 'react-aria-components';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
export interface ColorFieldProps extends AriaColorFieldProps {
|
|
5
|
+
}
|
|
6
|
+
export declare function ColorField({ className, ...props }: ColorFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const colorFieldGroupVariants: (props?: ({
|
|
8
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
9
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
10
|
+
export interface ColorFieldGroupProps extends ComponentProps<typeof Group>, VariantProps<typeof colorFieldGroupVariants> {
|
|
11
|
+
}
|
|
12
|
+
/** The filled field around a swatch and the input. Without a swatch, a plain `Input` from the library does the same job. */
|
|
13
|
+
export declare function ColorFieldGroup({ className, size, ...props }: ColorFieldGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
/** The text box inside a ColorFieldGroup: no fill or outline of its own. */
|
|
15
|
+
export declare function ColorFieldInput({ className, ...props }: AriaInputProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export interface ColorSwatchProps extends AriaColorSwatchProps {
|
|
17
|
+
}
|
|
18
|
+
/** A color chip. Give it a `color`, or place it where a color is in context (a ColorPicker, ColorFieldSwatch …). */
|
|
19
|
+
export declare function ColorSwatch({ className, ...props }: ColorSwatchProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
/** A swatch of what the surrounding ColorField currently holds (clear while the field is empty or unparsable). */
|
|
21
|
+
export declare function ColorFieldSwatch({ className, ...props }: Omit<ColorSwatchProps, 'color'>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=color-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-field.d.ts","sourceRoot":"","sources":["../../src/components/color-field.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EACyB,KAAK,eAAe,IAAI,mBAAmB,EAEzC,KAAK,gBAAgB,IAAI,oBAAoB,EAC7E,KAAK,EACe,KAAK,UAAU,IAAI,cAAc,EAGtD,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAalE,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;CAAG;AAE/D,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAQlE;AAED,eAAO,MAAM,uBAAuB;;8EAgBnC,CAAC;AAEF,MAAM,WAAW,oBAAqB,SAAQ,cAAc,CAAC,OAAO,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,uBAAuB,CAAC;CAAG;AAE3H,4HAA4H;AAC5H,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,2CAQlF;AAED,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAUtE;AAID,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;CAAG;AAEjE,oHAAoH;AACpH,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAQpE;AAED,kHAAkH;AAClH,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,2CAGxF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { selectableText as t } from "../lib/primitives.js";
|
|
4
|
+
import { useContext as n } from "react";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
import { ColorField as i, ColorFieldStateContext as a, ColorSwatch as o, Group as s, Input as c, composeRenderProps as l, parseColor as u } from "react-aria-components";
|
|
7
|
+
import { cva as d } from "class-variance-authority";
|
|
8
|
+
//#region src/components/color-field.tsx
|
|
9
|
+
function f({ className: t, ...n }) {
|
|
10
|
+
return /* @__PURE__ */ r(i, {
|
|
11
|
+
"data-slot": "color-field",
|
|
12
|
+
className: l(t, (t) => e("group flex flex-col gap-1.5", t)),
|
|
13
|
+
...n
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
var p = d([
|
|
17
|
+
"box-border flex w-full min-w-0 items-center gap-2 bg-input px-3 text-foreground outline-none transition-[box-shadow,background-color] duration-spring-snappy ease-spring-snappy",
|
|
18
|
+
"data-focus-within:bg-transparent data-focus-within:ring-[1.5px] data-focus-within:ring-primary data-focus-within:ring-inset",
|
|
19
|
+
"data-invalid:ring-[1.5px] data-invalid:ring-destructive data-invalid:ring-inset data-disabled:cursor-not-allowed data-disabled:opacity-50"
|
|
20
|
+
], {
|
|
21
|
+
variants: { size: {
|
|
22
|
+
sm: "h-8 rounded-lg text-subhead",
|
|
23
|
+
default: "h-11 rounded-ctl text-body",
|
|
24
|
+
lg: "h-[50px] rounded-xl text-body"
|
|
25
|
+
} },
|
|
26
|
+
defaultVariants: { size: "default" }
|
|
27
|
+
});
|
|
28
|
+
function m({ className: t, size: n, ...i }) {
|
|
29
|
+
return /* @__PURE__ */ r(s, {
|
|
30
|
+
"data-slot": "color-field-group",
|
|
31
|
+
className: l(t, (t) => e(p({ size: n }), t)),
|
|
32
|
+
...i
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function h({ className: n, ...i }) {
|
|
36
|
+
return /* @__PURE__ */ r(c, {
|
|
37
|
+
"data-slot": "color-field-input",
|
|
38
|
+
className: l(n, (n) => e("h-full min-w-0 flex-1 border-0 bg-transparent p-0 [font-family:inherit] [font-size:inherit] text-foreground outline-none placeholder:text-tertiary-foreground", t, n)),
|
|
39
|
+
...i
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
var g = u("hsla(0, 0%, 0%, 0)");
|
|
43
|
+
function _({ className: t, ...n }) {
|
|
44
|
+
return /* @__PURE__ */ r(o, {
|
|
45
|
+
"data-slot": "color-swatch",
|
|
46
|
+
className: l(t, (t) => e("size-6 shrink-0 rounded-full shadow-hairline", t)),
|
|
47
|
+
...n
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function v({ className: e, ...t }) {
|
|
51
|
+
let i = n(a);
|
|
52
|
+
return /* @__PURE__ */ r(_, {
|
|
53
|
+
"data-slot": "color-field-swatch",
|
|
54
|
+
className: e,
|
|
55
|
+
color: i?.colorValue ?? g,
|
|
56
|
+
...t
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { f as ColorField, m as ColorFieldGroup, h as ColorFieldInput, v as ColorFieldSwatch, _ as ColorSwatch, p as colorFieldGroupVariants };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ColorAreaProps as AriaColorAreaProps, ColorPicker as AriaColorPicker, ColorPickerProps as AriaColorPickerProps, ColorSliderProps as AriaColorSliderProps, ColorSwatchPickerProps as AriaColorSwatchPickerProps, ColorSwatchPickerItemProps as AriaColorSwatchPickerItemProps, ColorThumbProps as AriaColorThumbProps } from 'react-aria-components';
|
|
3
|
+
import { ButtonProps } from './button';
|
|
4
|
+
import { PopoverProps } from './popover';
|
|
5
|
+
export declare const ColorPicker: typeof AriaColorPicker;
|
|
6
|
+
export type ColorPickerProps = AriaColorPickerProps;
|
|
7
|
+
export interface ColorThumbProps extends AriaColorThumbProps {
|
|
8
|
+
}
|
|
9
|
+
/** The draggable handle of a ColorArea or ColorSlider; it is filled with the color it sits on. */
|
|
10
|
+
export declare function ColorThumb({ className, ...props }: ColorThumbProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export interface ColorAreaProps extends AriaColorAreaProps {
|
|
12
|
+
}
|
|
13
|
+
/** A square of two channels (saturation across, brightness up by default). The background is the color space itself, so it
|
|
14
|
+
sets its own `style`; size it with `className` (`h-40 w-full`). */
|
|
15
|
+
export declare function ColorArea({ className, colorSpace, xChannel, yChannel, ...props }: ColorAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export interface ColorSliderProps extends AriaColorSliderProps {
|
|
17
|
+
/** Text above the track, naming the channel. Without it, pass `aria-label`. */
|
|
18
|
+
label?: ReactNode;
|
|
19
|
+
/** Show the channel's value opposite the label. */
|
|
20
|
+
showValue?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** One channel as a gradient track (`channel="hue"`, `"alpha"`, `"saturation"` …; `colorSpace` picks the model). The alpha
|
|
23
|
+
track sits on a checkerboard. */
|
|
24
|
+
export declare function ColorSlider({ className, label, showValue, ...props }: ColorSliderProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export interface ColorSwatchPickerProps extends AriaColorSwatchPickerProps {
|
|
26
|
+
}
|
|
27
|
+
/** A row of preset colors; one at a time is selected. Fill it with ColorSwatchPickerItems. */
|
|
28
|
+
export declare function ColorSwatchPicker({ className, ...props }: ColorSwatchPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export interface ColorSwatchPickerItemProps extends Omit<AriaColorSwatchPickerItemProps, 'children'> {
|
|
30
|
+
}
|
|
31
|
+
export declare function ColorSwatchPickerItem({ className, ...props }: ColorSwatchPickerItemProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export interface ColorPickerTriggerProps extends Omit<ButtonProps, 'variant' | 'size' | 'children'> {
|
|
33
|
+
size?: 'sm' | 'default' | 'lg';
|
|
34
|
+
/** Show the hex value beside the swatch. Default: true. */
|
|
35
|
+
showValue?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** A filled button showing the current color (and its hex, with the opacity when it is below 1); press it to open the ColorPickerContent beside it. */
|
|
38
|
+
export declare function ColorPickerTrigger({ className, size, showValue, ...props }: ColorPickerTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export interface ColorPickerContentProps extends Omit<PopoverProps, 'children'> {
|
|
40
|
+
/** Preset colors shown as a row of swatches under the sliders. */
|
|
41
|
+
swatches?: readonly string[];
|
|
42
|
+
/** Add an opacity slider. Default: false. */
|
|
43
|
+
alpha?: boolean;
|
|
44
|
+
/** Replace the default area, hue slider, hex field and swatches. */
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
}
|
|
47
|
+
/** The popover: a ColorArea, a hue slider, an optional opacity slider, a hex field and optional swatches. */
|
|
48
|
+
export declare function ColorPickerContent({ swatches, alpha, children, className, placement, ...props }: ColorPickerContentProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
//# sourceMappingURL=color-picker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-picker.d.ts","sourceRoot":"","sources":["../../src/components/color-picker.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EACuB,KAAK,cAAc,IAAI,kBAAkB,EACrE,WAAW,IAAI,eAAe,EAAE,KAAK,gBAAgB,IAAI,oBAAoB,EAE7C,KAAK,gBAAgB,IAAI,oBAAoB,EACjC,KAAK,sBAAsB,IAAI,0BAA0B,EACjD,KAAK,0BAA0B,IAAI,8BAA8B,EACvF,KAAK,eAAe,IAAI,mBAAmB,EAK1E,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGlE,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAcrE,eAAO,MAAM,WAAW,wBAAkB,CAAC;AAC3C,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAEpD,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;CAAG;AAE/D,kGAAkG;AAClG,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAclE;AAED,MAAM,WAAW,cAAe,SAAQ,kBAAkB;CAAG;AAE7D;sEACsE;AACtE,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,UAAkB,EAAE,QAAuB,EAAE,QAAuB,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAatI;AAED,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;IAC5D,+EAA+E;IAC/E,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,mDAAmD;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;oCACoC;AACpC,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAyBtF;AAED,MAAM,WAAW,sBAAuB,SAAQ,0BAA0B;CAAG;AAE7E,8FAA8F;AAC9F,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,2CAQhF;AAED,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CAAC,8BAA8B,EAAE,UAAU,CAAC;CAAG;AAEvG,wBAAgB,qBAAqB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,0BAA0B,2CAgBxF;AAED,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;IACjG,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/B,2DAA2D;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAID,uJAAuJ;AACvJ,wBAAgB,kBAAkB,CAAC,EAAE,SAAS,EAAE,IAAgB,EAAE,SAAgB,EAAE,GAAG,KAAK,EAAE,EAAE,uBAAuB,2CAetH;AAED,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC;IAC7E,kEAAkE;IAClE,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,6CAA6C;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,6GAA6G;AAC7G,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,SAA0B,EAAE,GAAG,KAAK,EAAE,EAAE,uBAAuB,2CAyBzI"}
|