@jfrader/ui 0.1.2 → 0.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/README.md +1 -1
- package/dist/accordion-CkOZ-tvs.js +178 -0
- package/dist/accordion.js +1 -1
- package/dist/alert-Dsjx14UW.js +131 -0
- package/dist/alert.js +1 -1
- package/dist/avatar-BRGKkoSr.js +127 -0
- package/dist/avatar.js +1 -1
- package/dist/badge-DLxUMsCx.js +104 -0
- package/dist/badge.js +1 -1
- package/dist/breadcrumbs-694hF_hm.js +131 -0
- package/dist/breadcrumbs.js +1 -1
- package/dist/button-CoaIcykB.js +190 -0
- package/dist/button.js +1 -1
- package/dist/calendar-Doj7PTdG.js +379 -0
- package/dist/calendar.js +1 -1
- package/dist/card-2IM71XZj.js +134 -0
- package/dist/card.js +1 -1
- package/dist/checkbox-B7xGNFzp.js +136 -0
- package/dist/checkbox.js +1 -1
- package/dist/combobox-Bjhxv5U3.js +311 -0
- package/dist/combobox.js +1 -1
- package/dist/{command-palette-6c158eH1.js → command-palette-BhJwm6cS.js} +144 -129
- package/dist/command-palette.js +1 -1
- package/dist/container-BhnrGPu-.js +36 -0
- package/dist/container.js +1 -1
- package/dist/date-picker-Jk8SpoiO.js +245 -0
- package/dist/date-picker.js +1 -1
- package/dist/dialog-fhS07G41.js +187 -0
- package/dist/dialog.js +1 -1
- package/dist/divider-v_78HYF5.js +79 -0
- package/dist/divider.js +1 -1
- package/dist/flex-COZzFqI8.js +22 -0
- package/dist/flex.js +1 -1
- package/dist/index.js +36 -36
- package/dist/kbd-CeP8Kfvp.js +61 -0
- package/dist/kbd.js +1 -1
- package/dist/menu-B6KCbLCr.js +196 -0
- package/dist/menu.js +1 -1
- package/dist/navigation-BDht6S2-.js +182 -0
- package/dist/navigation.js +1 -1
- package/dist/{pagination-BIKYsxK1.js → pagination-B50PCaDU.js} +58 -56
- package/dist/pagination.js +1 -1
- package/dist/pill-2_XzBdkD.js +51 -0
- package/dist/pill.js +1 -1
- package/dist/popover-DRHbeIVq.js +103 -0
- package/dist/popover.js +1 -1
- package/dist/{progress-C8bgujFI.js → progress-CpsskKTD.js} +37 -36
- package/dist/progress.js +1 -1
- package/dist/radio-group-DPI5KUCj.js +136 -0
- package/dist/radio-group.js +1 -1
- package/dist/select-C1xGrOhT.js +266 -0
- package/dist/select.js +1 -1
- package/dist/skeleton-DitdP-yz.js +49 -0
- package/dist/skeleton.js +1 -1
- package/dist/{spinner-CSFiP0Oi.js → spinner-CFq5HPoo.js} +24 -23
- package/dist/spinner.js +1 -1
- package/dist/stack-D_g6NJzo.js +21 -0
- package/dist/stack.js +1 -1
- package/dist/switch-B5TTU-oJ.js +138 -0
- package/dist/switch.js +1 -1
- package/dist/tabs-C26PWl2c.js +183 -0
- package/dist/tabs.js +1 -1
- package/dist/text-field-8PQAqRpM.js +75 -0
- package/dist/text-field.js +1 -1
- package/dist/textarea-CcGWuntL.js +85 -0
- package/dist/textarea.js +1 -1
- package/dist/theme-root-BRLIA4eb.js +22 -0
- package/dist/theme-root.js +1 -1
- package/dist/toast-B1PXuwZ4.js +277 -0
- package/dist/toast.js +1 -1
- package/dist/toggle-group-N_owicT0.js +156 -0
- package/dist/toggle-group.js +1 -1
- package/dist/tooltip-BJPisf60.js +98 -0
- package/dist/tooltip.js +1 -1
- package/dist/types/components/accordion/accordion.d.ts +13 -9
- package/dist/types/components/alert/alert.d.ts +6 -3
- package/dist/types/components/avatar/avatar.d.ts +6 -3
- package/dist/types/components/badge/badge.d.ts +6 -3
- package/dist/types/components/breadcrumbs/breadcrumbs.d.ts +8 -5
- package/dist/types/components/button/button.d.ts +6 -3
- package/dist/types/components/calendar/calendar.d.ts +11 -7
- package/dist/types/components/card/card.d.ts +20 -13
- package/dist/types/components/checkbox/checkbox.d.ts +6 -3
- package/dist/types/components/combobox/combobox.d.ts +12 -8
- package/dist/types/components/command-palette/command-palette.d.ts +22 -15
- package/dist/types/components/container/container.d.ts +6 -3
- package/dist/types/components/date-picker/date-picker.d.ts +6 -4
- package/dist/types/components/dialog/dialog.d.ts +16 -11
- package/dist/types/components/divider/divider.d.ts +6 -3
- package/dist/types/components/flex/flex.d.ts +6 -3
- package/dist/types/components/kbd/kbd.d.ts +8 -5
- package/dist/types/components/menu/menu.d.ts +13 -9
- package/dist/types/components/navigation/navigation.d.ts +11 -7
- package/dist/types/components/pagination/pagination.d.ts +6 -3
- package/dist/types/components/pill/pill.d.ts +6 -3
- package/dist/types/components/popover/popover.d.ts +7 -5
- package/dist/types/components/progress/progress.d.ts +6 -3
- package/dist/types/components/radio-group/radio-group.d.ts +8 -5
- package/dist/types/components/select/select.d.ts +13 -9
- package/dist/types/components/skeleton/skeleton.d.ts +6 -3
- package/dist/types/components/spinner/spinner.d.ts +6 -3
- package/dist/types/components/stack/stack.d.ts +4 -1
- package/dist/types/components/switch/switch.d.ts +6 -3
- package/dist/types/components/tabs/tabs.d.ts +14 -9
- package/dist/types/components/text-field/text-field.d.ts +6 -3
- package/dist/types/components/textarea/textarea.d.ts +6 -3
- package/dist/types/components/theme-root/theme-root.d.ts +6 -3
- package/dist/types/components/toast/toast.d.ts +6 -4
- package/dist/types/components/toggle-group/toggle-group.d.ts +7 -5
- package/dist/types/components/tooltip/tooltip.d.ts +7 -5
- package/dist/types/overlay/use-native-dialog.d.ts +2 -2
- package/package.json +4 -4
- package/dist/accordion-C3YbYFBi.js +0 -169
- package/dist/alert-CA9ZlIZp.js +0 -130
- package/dist/avatar-IUW4yJl0.js +0 -125
- package/dist/badge-Bru30HEn.js +0 -103
- package/dist/breadcrumbs-CQaviWRc.js +0 -126
- package/dist/button-Cmixur4Q.js +0 -188
- package/dist/calendar-DUgS0xmp.js +0 -373
- package/dist/card-D9CHtouU.js +0 -121
- package/dist/checkbox-DKa5BCdy.js +0 -135
- package/dist/combobox-Dq3V88Zt.js +0 -302
- package/dist/container-xUEIoZzj.js +0 -35
- package/dist/date-picker-DrHJMt2p.js +0 -240
- package/dist/dialog-C2NSOOP-.js +0 -176
- package/dist/divider-yF5EmhhT.js +0 -77
- package/dist/flex-5-NI5SSy.js +0 -22
- package/dist/kbd-B03_qIwQ.js +0 -56
- package/dist/menu-bvKRJOhJ.js +0 -187
- package/dist/navigation-xPoqh_Iz.js +0 -175
- package/dist/pill-CrVqffKM.js +0 -50
- package/dist/popover-CVAZ_C1a.js +0 -98
- package/dist/radio-group-CvQ4x8ii.js +0 -131
- package/dist/select-CNNiUhKB.js +0 -257
- package/dist/skeleton-gJ4ImO5u.js +0 -48
- package/dist/stack-mEAryjKz.js +0 -21
- package/dist/switch-2hm2WnWt.js +0 -136
- package/dist/tabs-GBppQabg.js +0 -174
- package/dist/text-field-DDPqQu29.js +0 -74
- package/dist/textarea-OP8_3IUR.js +0 -84
- package/dist/theme-root-eLka0ZP1.js +0 -21
- package/dist/toast-D3Y6OAsg.js +0 -271
- package/dist/toggle-group-BxzJ-6Cp.js +0 -151
- package/dist/tooltip-CVl8HS4S.js +0 -93
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { t as e } from "./css-Cgj6sCHn.js";
|
|
3
|
+
import { n as t } from "./media-D_eA_I-e.js";
|
|
4
|
+
import { t as n } from "./renderable-DzcIj1Lo.js";
|
|
5
|
+
import { t as r } from "./button-CoaIcykB.js";
|
|
6
|
+
import { createContext as i, useCallback as a, useContext as o, useEffect as s, useId as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
7
|
+
import { vars as f } from "@jfrader/tokens/vars";
|
|
8
|
+
import { Fragment as p, jsx as m, jsxs as h } from "@emotion/react/jsx-runtime";
|
|
9
|
+
import { createPortal as g } from "react-dom";
|
|
10
|
+
//#region src/components/toast/toast.tsx
|
|
11
|
+
var _ = 4, v = 5e3, y = "Dismiss", b = 100, x = "min(380px, calc(100vw - 32px))", S = "3px", C = i(null), w = i(null), T = e({
|
|
12
|
+
position: "fixed",
|
|
13
|
+
insetBlockEnd: 0,
|
|
14
|
+
insetInlineEnd: 0,
|
|
15
|
+
display: "flex",
|
|
16
|
+
flexDirection: "column",
|
|
17
|
+
gap: f.space[2],
|
|
18
|
+
inlineSize: x,
|
|
19
|
+
margin: 0,
|
|
20
|
+
paddingInlineEnd: f.space[4],
|
|
21
|
+
paddingBlockEnd: f.space[4],
|
|
22
|
+
pointerEvents: "none",
|
|
23
|
+
fontFamily: f.font.sans
|
|
24
|
+
}), E = e({
|
|
25
|
+
boxSizing: "border-box",
|
|
26
|
+
display: "grid",
|
|
27
|
+
gridTemplateColumns: "minmax(0, 1fr) auto",
|
|
28
|
+
alignItems: "start",
|
|
29
|
+
gap: f.space[2],
|
|
30
|
+
backgroundColor: f.color.surfaceRaised,
|
|
31
|
+
border: `1px solid ${f.color.border}`,
|
|
32
|
+
borderRadius: f.radius.lg,
|
|
33
|
+
boxShadow: f.shadow.floating,
|
|
34
|
+
padding: f.space[3],
|
|
35
|
+
color: f.color.text,
|
|
36
|
+
lineHeight: f.lineHeight.base,
|
|
37
|
+
pointerEvents: "auto",
|
|
38
|
+
transitionProperty: "opacity, transform",
|
|
39
|
+
transitionDuration: f.motion.duration.base,
|
|
40
|
+
transitionTimingFunction: f.motion.easeStandard,
|
|
41
|
+
"&[data-populated=\"false\"]": { opacity: 0 },
|
|
42
|
+
"&[data-state=\"closing\"]": {
|
|
43
|
+
opacity: 0,
|
|
44
|
+
transform: `translateY(${f.space[2]})`,
|
|
45
|
+
pointerEvents: "none"
|
|
46
|
+
},
|
|
47
|
+
[t]: { transitionDuration: "0s" }
|
|
48
|
+
}), D = {
|
|
49
|
+
neutral: e({ borderInlineStart: `${S} solid ${f.color.borderStrong}` }),
|
|
50
|
+
success: e({ borderInlineStart: `${S} solid ${f.color.success}` }),
|
|
51
|
+
danger: e({ borderInlineStart: `${S} solid ${f.color.danger}` })
|
|
52
|
+
}, O = e({
|
|
53
|
+
display: "grid",
|
|
54
|
+
gap: f.space[1],
|
|
55
|
+
alignSelf: "center",
|
|
56
|
+
minInlineSize: 0
|
|
57
|
+
}), k = e({
|
|
58
|
+
margin: 0,
|
|
59
|
+
fontSize: f.textSize.sm,
|
|
60
|
+
fontWeight: f.fontWeight.semibold
|
|
61
|
+
}), A = e({
|
|
62
|
+
margin: 0,
|
|
63
|
+
fontSize: f.textSize.sm,
|
|
64
|
+
color: f.color.textMuted
|
|
65
|
+
}), j = e({
|
|
66
|
+
gridColumn: 2,
|
|
67
|
+
gridRow: 1,
|
|
68
|
+
inlineSize: "32px",
|
|
69
|
+
paddingInline: 0
|
|
70
|
+
}), M = e({ display: "contents" }), N = e({
|
|
71
|
+
gridColumn: "1 / -1",
|
|
72
|
+
display: "flex",
|
|
73
|
+
gap: f.space[2]
|
|
74
|
+
});
|
|
75
|
+
function P(e) {
|
|
76
|
+
let t = o(w);
|
|
77
|
+
if (!t) throw Error(`Toast.${e} must be rendered inside <Toast.Provider>.`);
|
|
78
|
+
return t;
|
|
79
|
+
}
|
|
80
|
+
function F() {
|
|
81
|
+
let e = o(C);
|
|
82
|
+
if (!e) throw Error("useToast() must be called inside <Toast.Provider>.");
|
|
83
|
+
return e;
|
|
84
|
+
}
|
|
85
|
+
function I({ children: e, max: t = _, duration: n = v, dismissLabel: r = y }) {
|
|
86
|
+
let i = c(), o = u(0), [s, f] = d([]), p = u([]), h = u(/* @__PURE__ */ new Map()), g = Math.max(1, Math.floor(Number.isFinite(t) ? t : _)), b = a((e, t) => {
|
|
87
|
+
t ? h.current.set(e, t) : h.current.delete(e);
|
|
88
|
+
}, []), x = a((e, t) => {
|
|
89
|
+
let n = new Set(t.filter((e) => e.state === "open").map((e) => h.current.get(e.id)));
|
|
90
|
+
for (let t of e) {
|
|
91
|
+
let e = h.current.get(t.id);
|
|
92
|
+
if (e?.contains(e.ownerDocument.activeElement)) {
|
|
93
|
+
Array.from(e.parentElement?.querySelectorAll("[data-ui=\"toast\"]") ?? []).find((e) => n.has(e))?.querySelector("[data-toast-dismiss]")?.focus();
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}, []), S = a((e) => {
|
|
98
|
+
o.current += 1;
|
|
99
|
+
let t = `${i}toast-${o.current}`, r = {
|
|
100
|
+
id: t,
|
|
101
|
+
options: {
|
|
102
|
+
...e,
|
|
103
|
+
duration: e.duration === void 0 ? n : e.duration
|
|
104
|
+
},
|
|
105
|
+
state: "open"
|
|
106
|
+
}, a = p.current, s = [...a, r].slice(-g);
|
|
107
|
+
return x(a.filter((e) => !s.includes(e)), s), p.current = s, f(s), t;
|
|
108
|
+
}, [
|
|
109
|
+
i,
|
|
110
|
+
g,
|
|
111
|
+
n,
|
|
112
|
+
x
|
|
113
|
+
]), T = a((e) => {
|
|
114
|
+
let t = p.current;
|
|
115
|
+
x(t.filter((t) => t.id === e), t.filter((t) => t.id !== e));
|
|
116
|
+
let n = t.map((t) => t.id === e && t.state === "open" ? {
|
|
117
|
+
...t,
|
|
118
|
+
state: "closing"
|
|
119
|
+
} : t);
|
|
120
|
+
p.current = n, f(n);
|
|
121
|
+
}, [x]), E = a((e) => {
|
|
122
|
+
let t = p.current, n = t.filter((t) => t.id !== e);
|
|
123
|
+
x(t.filter((t) => t.id === e), n), p.current = n, f(n);
|
|
124
|
+
}, [x]), D = l(() => ({
|
|
125
|
+
toast: S,
|
|
126
|
+
dismiss: T
|
|
127
|
+
}), [S, T]), O = l(() => ({
|
|
128
|
+
toasts: s,
|
|
129
|
+
dismiss: T,
|
|
130
|
+
remove: E,
|
|
131
|
+
registerRoot: b,
|
|
132
|
+
dismissLabel: r
|
|
133
|
+
}), [
|
|
134
|
+
s,
|
|
135
|
+
T,
|
|
136
|
+
E,
|
|
137
|
+
b,
|
|
138
|
+
r
|
|
139
|
+
]);
|
|
140
|
+
return /* @__PURE__ */ m(C.Provider, {
|
|
141
|
+
value: D,
|
|
142
|
+
children: /* @__PURE__ */ m(w.Provider, {
|
|
143
|
+
value: O,
|
|
144
|
+
children: e
|
|
145
|
+
})
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
I.displayName = "Toast.Provider";
|
|
149
|
+
function L({ ref: e, ...t }) {
|
|
150
|
+
let { toasts: n } = P("Viewport"), r = u(null), [i, a] = d(null);
|
|
151
|
+
return s(() => {
|
|
152
|
+
a(r.current?.ownerDocument.body ?? null);
|
|
153
|
+
}, []), /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("span", {
|
|
154
|
+
hidden: !0,
|
|
155
|
+
ref: r
|
|
156
|
+
}), i && g(/* @__PURE__ */ m("div", {
|
|
157
|
+
...t,
|
|
158
|
+
ref: e,
|
|
159
|
+
"data-ui": "toast-viewport",
|
|
160
|
+
css: T,
|
|
161
|
+
children: n.map((e) => /* @__PURE__ */ m(R, { record: e }, e.id))
|
|
162
|
+
}), i)] });
|
|
163
|
+
}
|
|
164
|
+
L.displayName = "Toast.Viewport";
|
|
165
|
+
function R({ record: e }) {
|
|
166
|
+
let { dismiss: t, remove: i, registerRoot: o, dismissLabel: c } = P("Viewport"), { id: l, options: f, state: g } = e, { title: _, description: v, tone: y = "neutral", action: x } = f, S = f.duration, C = u(null), w = a((e) => {
|
|
167
|
+
C.current = e, o(l, e);
|
|
168
|
+
}, [l, o]), [T, F] = d(!1), [I, L] = d(!1), [R, B] = d(!1), V = u(S ?? 0);
|
|
169
|
+
s(() => {
|
|
170
|
+
let e = setTimeout(() => F(!0), b);
|
|
171
|
+
return () => clearTimeout(e);
|
|
172
|
+
}, []);
|
|
173
|
+
let H = T && g === "open" && S !== null && !I && !R;
|
|
174
|
+
return s(() => {
|
|
175
|
+
if (!H) return;
|
|
176
|
+
let e = performance.now(), n = setTimeout(() => t(l), V.current);
|
|
177
|
+
return () => {
|
|
178
|
+
clearTimeout(n), V.current -= performance.now() - e;
|
|
179
|
+
};
|
|
180
|
+
}, [
|
|
181
|
+
H,
|
|
182
|
+
t,
|
|
183
|
+
l
|
|
184
|
+
]), s(() => {
|
|
185
|
+
if (g !== "closing") return;
|
|
186
|
+
let e = C.current, t = e && typeof e.getAnimations == "function" ? e.getAnimations() : [], n = !1;
|
|
187
|
+
return Promise.allSettled(t.map((e) => e.finished)).then(() => {
|
|
188
|
+
n || i(l);
|
|
189
|
+
}), () => {
|
|
190
|
+
n = !0;
|
|
191
|
+
};
|
|
192
|
+
}, [
|
|
193
|
+
g,
|
|
194
|
+
i,
|
|
195
|
+
l
|
|
196
|
+
]), /* @__PURE__ */ h("div", {
|
|
197
|
+
ref: w,
|
|
198
|
+
inert: g === "closing",
|
|
199
|
+
"data-ui": "toast",
|
|
200
|
+
"data-tone": y,
|
|
201
|
+
"data-state": g,
|
|
202
|
+
"data-populated": T,
|
|
203
|
+
onPointerEnter: () => L(!0),
|
|
204
|
+
onPointerLeave: () => L(!1),
|
|
205
|
+
onFocus: () => B(!0),
|
|
206
|
+
onBlur: (e) => {
|
|
207
|
+
e.currentTarget.contains(e.relatedTarget) || B(!1);
|
|
208
|
+
},
|
|
209
|
+
css: [E, D[y]],
|
|
210
|
+
children: [/* @__PURE__ */ m("div", {
|
|
211
|
+
role: y === "danger" ? "alert" : "status",
|
|
212
|
+
"aria-atomic": "true",
|
|
213
|
+
css: O,
|
|
214
|
+
children: T && /* @__PURE__ */ h(p, { children: [n(_) && /* @__PURE__ */ m("div", {
|
|
215
|
+
css: k,
|
|
216
|
+
children: _
|
|
217
|
+
}), n(v) && /* @__PURE__ */ m("div", {
|
|
218
|
+
css: A,
|
|
219
|
+
children: v
|
|
220
|
+
})] })
|
|
221
|
+
}), T && /* @__PURE__ */ h("div", {
|
|
222
|
+
css: M,
|
|
223
|
+
children: [/* @__PURE__ */ m(r, {
|
|
224
|
+
variant: "ghost",
|
|
225
|
+
size: "sm",
|
|
226
|
+
"aria-label": c,
|
|
227
|
+
"data-toast-dismiss": "",
|
|
228
|
+
onClick: () => t(l),
|
|
229
|
+
css: j,
|
|
230
|
+
children: /* @__PURE__ */ m(z, {})
|
|
231
|
+
}), x && /* @__PURE__ */ m("div", {
|
|
232
|
+
css: N,
|
|
233
|
+
children: /* @__PURE__ */ m(r, {
|
|
234
|
+
variant: "outline",
|
|
235
|
+
size: "sm",
|
|
236
|
+
onClick: (e) => {
|
|
237
|
+
x?.onClick(e), e.defaultPrevented || t(l);
|
|
238
|
+
},
|
|
239
|
+
children: x.label
|
|
240
|
+
})
|
|
241
|
+
})]
|
|
242
|
+
})]
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
function z() {
|
|
246
|
+
return /* @__PURE__ */ h("svg", {
|
|
247
|
+
"aria-hidden": "true",
|
|
248
|
+
viewBox: "0 0 16 16",
|
|
249
|
+
width: "16",
|
|
250
|
+
height: "16",
|
|
251
|
+
fill: "none",
|
|
252
|
+
stroke: "currentColor",
|
|
253
|
+
strokeWidth: "2",
|
|
254
|
+
strokeLinecap: "round",
|
|
255
|
+
children: [/* @__PURE__ */ m("line", {
|
|
256
|
+
x1: "4",
|
|
257
|
+
y1: "4",
|
|
258
|
+
x2: "12",
|
|
259
|
+
y2: "12"
|
|
260
|
+
}), /* @__PURE__ */ m("line", {
|
|
261
|
+
x1: "12",
|
|
262
|
+
y1: "4",
|
|
263
|
+
x2: "4",
|
|
264
|
+
y2: "12"
|
|
265
|
+
})]
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function B(e) {
|
|
269
|
+
return /* @__PURE__ */ m(I, { ...e });
|
|
270
|
+
}
|
|
271
|
+
B.displayName = "Toast";
|
|
272
|
+
var V = Object.assign(B, {
|
|
273
|
+
Provider: I,
|
|
274
|
+
Viewport: L
|
|
275
|
+
});
|
|
276
|
+
//#endregion
|
|
277
|
+
export { F as n, V as t };
|
package/dist/toast.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Toast, n as useToast } from "./toast-
|
|
2
|
+
export { t as Toast, n as useToast } from "./toast-B1PXuwZ4.js";
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { t as e } from "./css-Cgj6sCHn.js";
|
|
3
|
+
import { t } from "./focus-ring-BK5W5_NY.js";
|
|
4
|
+
import { n, t as r } from "./media-D_eA_I-e.js";
|
|
5
|
+
import { n as i, r as a, t as o } from "./roving-focus-CYlo_Kf8.js";
|
|
6
|
+
import { t as s } from "./use-controlled-state-CVXDa-qM.js";
|
|
7
|
+
import { createContext as c, useContext as l, useEffect as u, useImperativeHandle as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
8
|
+
import { vars as h } from "@jfrader/tokens/vars";
|
|
9
|
+
import { jsx as g } from "@emotion/react/jsx-runtime";
|
|
10
|
+
//#region src/components/toggle-group/toggle-group.tsx
|
|
11
|
+
var _ = c(null);
|
|
12
|
+
function v(e) {
|
|
13
|
+
let t = l(_);
|
|
14
|
+
if (!t) throw Error(`ToggleGroup.${e} must be rendered inside <ToggleGroup>.`);
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
var y = [], b = (e, t) => {
|
|
18
|
+
if (Array.isArray(e)) {
|
|
19
|
+
if (t === "multiple") return e;
|
|
20
|
+
e = e[0] ?? "";
|
|
21
|
+
}
|
|
22
|
+
return e === void 0 || e === "" ? y : [e];
|
|
23
|
+
}, x = {
|
|
24
|
+
itemSelector: "[data-ui=\"toggle-group-item\"]:not([disabled])",
|
|
25
|
+
ownerSelector: "[data-ui=\"toggle-group-root\"]"
|
|
26
|
+
}, S = "2px", C = e({
|
|
27
|
+
display: "inline-flex",
|
|
28
|
+
gap: S,
|
|
29
|
+
padding: S,
|
|
30
|
+
border: `1px solid ${h.color.borderControl}`,
|
|
31
|
+
borderRadius: h.radius.md,
|
|
32
|
+
backgroundColor: h.color.surfaceInset
|
|
33
|
+
}), w = {
|
|
34
|
+
horizontal: e({ flexDirection: "row" }),
|
|
35
|
+
vertical: e({
|
|
36
|
+
flexDirection: "column",
|
|
37
|
+
alignItems: "stretch"
|
|
38
|
+
})
|
|
39
|
+
}, T = e({
|
|
40
|
+
appearance: "none",
|
|
41
|
+
display: "inline-flex",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
justifyContent: "center",
|
|
44
|
+
gap: h.space[2],
|
|
45
|
+
minBlockSize: "32px",
|
|
46
|
+
boxSizing: "border-box",
|
|
47
|
+
border: "1px solid transparent",
|
|
48
|
+
borderRadius: h.radius.sm,
|
|
49
|
+
background: "transparent",
|
|
50
|
+
cursor: "pointer",
|
|
51
|
+
paddingBlock: h.space[1],
|
|
52
|
+
paddingInline: h.space[3],
|
|
53
|
+
font: "inherit",
|
|
54
|
+
fontSize: h.textSize.sm,
|
|
55
|
+
fontWeight: h.fontWeight.medium,
|
|
56
|
+
color: h.color.textMuted,
|
|
57
|
+
transitionProperty: "background-color, border-color, color",
|
|
58
|
+
transitionDuration: h.motion.duration.fast,
|
|
59
|
+
transitionTimingFunction: h.motion.easeStandard,
|
|
60
|
+
"&:hover:not(:disabled):not([aria-pressed=\"true\"])": {
|
|
61
|
+
backgroundColor: h.color.surfaceHover,
|
|
62
|
+
color: h.color.text
|
|
63
|
+
},
|
|
64
|
+
"&[aria-pressed=\"true\"]": {
|
|
65
|
+
backgroundColor: h.color.accentSoft,
|
|
66
|
+
borderColor: h.color.accent,
|
|
67
|
+
color: h.color.accentText
|
|
68
|
+
},
|
|
69
|
+
"&[aria-pressed=\"true\"]:hover:not(:disabled)": { backgroundColor: h.color.accentSoftHover },
|
|
70
|
+
"&:disabled": {
|
|
71
|
+
opacity: .55,
|
|
72
|
+
cursor: "not-allowed"
|
|
73
|
+
},
|
|
74
|
+
"&:focus-visible": { ...t },
|
|
75
|
+
[n]: { transitionDuration: "0s" },
|
|
76
|
+
[r]: { "&[aria-pressed=\"true\"]": {
|
|
77
|
+
backgroundColor: "SelectedItem",
|
|
78
|
+
borderColor: "SelectedItem",
|
|
79
|
+
color: "SelectedItemText"
|
|
80
|
+
} }
|
|
81
|
+
});
|
|
82
|
+
function E({ ref: e, type: t = "single", value: n, defaultValue: r, onValueChange: c, orientation: l = "horizontal", disabled: h = !1, allowEmpty: v = !1, label: y, "aria-label": S, onKeyDown: T, ...E }) {
|
|
83
|
+
let [D, O] = s(n, r, c), [k, A] = m(null), j = p(null);
|
|
84
|
+
d(e, () => j.current, []);
|
|
85
|
+
let M = f(() => b(D, t), [D, t]), N = f(() => ({
|
|
86
|
+
pressed: M,
|
|
87
|
+
toggle: (e) => {
|
|
88
|
+
let n = M.includes(e);
|
|
89
|
+
t === "multiple" ? O(n ? M.filter((t) => t !== e) : [...M, e]) : n ? v && O("") : O(e);
|
|
90
|
+
},
|
|
91
|
+
focused: k,
|
|
92
|
+
setFocused: A,
|
|
93
|
+
disabled: h
|
|
94
|
+
}), [
|
|
95
|
+
M,
|
|
96
|
+
O,
|
|
97
|
+
t,
|
|
98
|
+
v,
|
|
99
|
+
k,
|
|
100
|
+
h
|
|
101
|
+
]);
|
|
102
|
+
u(() => {
|
|
103
|
+
let e = j.current;
|
|
104
|
+
if (!e) return;
|
|
105
|
+
let t = a(e, x);
|
|
106
|
+
if (t.length === 0 || t.some((e) => e.tabIndex === 0)) return;
|
|
107
|
+
let n = t.find((e) => e.getAttribute("aria-pressed") === "true");
|
|
108
|
+
A((n ?? o(t, k) ?? t[0])?.dataset.value ?? null);
|
|
109
|
+
});
|
|
110
|
+
let P = (e) => {
|
|
111
|
+
T?.(e);
|
|
112
|
+
let t = j.current;
|
|
113
|
+
!e.defaultPrevented && t && i(e, t, l, x);
|
|
114
|
+
};
|
|
115
|
+
return /* @__PURE__ */ g(_.Provider, {
|
|
116
|
+
value: N,
|
|
117
|
+
children: /* @__PURE__ */ g("div", {
|
|
118
|
+
...E,
|
|
119
|
+
ref: j,
|
|
120
|
+
role: "group",
|
|
121
|
+
"aria-label": y ?? S,
|
|
122
|
+
"aria-disabled": h || void 0,
|
|
123
|
+
"data-ui": "toggle-group-root",
|
|
124
|
+
"data-type": t,
|
|
125
|
+
"data-orientation": l,
|
|
126
|
+
onKeyDown: P,
|
|
127
|
+
css: [C, w[l]]
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
E.displayName = "ToggleGroup";
|
|
132
|
+
function D({ ref: e, value: t, disabled: n, onClick: r, onFocus: i, ...a }) {
|
|
133
|
+
let { pressed: o, toggle: s, focused: c, setFocused: l, disabled: u } = v("Item"), d = u || n, f = o.includes(t), p = !d && (c === null ? o[0] === t : c === t), m = (e) => {
|
|
134
|
+
r?.(e), !e.defaultPrevented && s(t);
|
|
135
|
+
}, h = (e) => {
|
|
136
|
+
i?.(e), l(t);
|
|
137
|
+
};
|
|
138
|
+
return /* @__PURE__ */ g("button", {
|
|
139
|
+
...a,
|
|
140
|
+
ref: e,
|
|
141
|
+
type: "button",
|
|
142
|
+
"aria-pressed": f,
|
|
143
|
+
"data-ui": "toggle-group-item",
|
|
144
|
+
"data-value": t,
|
|
145
|
+
"data-state": f ? "on" : "off",
|
|
146
|
+
tabIndex: p ? 0 : -1,
|
|
147
|
+
disabled: d,
|
|
148
|
+
onClick: m,
|
|
149
|
+
onFocus: h,
|
|
150
|
+
css: T
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
D.displayName = "ToggleGroup.Item";
|
|
154
|
+
var O = Object.assign(E, { Item: D });
|
|
155
|
+
//#endregion
|
|
156
|
+
export { O as t };
|
package/dist/toggle-group.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as ToggleGroup } from "./toggle-group-
|
|
2
|
+
export { t as ToggleGroup } from "./toggle-group-N_owicT0.js";
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { t as e } from "./css-Cgj6sCHn.js";
|
|
3
|
+
import { t } from "./use-controlled-state-CVXDa-qM.js";
|
|
4
|
+
import { t as n } from "./trigger-style-B1GFmH7M.js";
|
|
5
|
+
import { t as r } from "./use-overlay-floating-efeqppiw.js";
|
|
6
|
+
import { createContext as i, useContext as a, useMemo as o } from "react";
|
|
7
|
+
import { vars as s } from "@jfrader/tokens/vars";
|
|
8
|
+
import { jsx as c } from "@emotion/react/jsx-runtime";
|
|
9
|
+
import { FloatingPortal as l, useDismiss as u, useFocus as d, useHover as f, useInteractions as p, useMergeRefs as m, useRole as h } from "@floating-ui/react";
|
|
10
|
+
//#region src/components/tooltip/tooltip.tsx
|
|
11
|
+
var g = 300, _ = 100, v = i(null);
|
|
12
|
+
function y(e) {
|
|
13
|
+
let t = a(v);
|
|
14
|
+
if (!t) throw Error(`Tooltip.${e} must be rendered inside <Tooltip>.`);
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
var b = e({
|
|
18
|
+
boxSizing: "border-box",
|
|
19
|
+
backgroundColor: s.color.bgSoft,
|
|
20
|
+
border: `1px solid ${s.color.border}`,
|
|
21
|
+
borderRadius: s.radius.sm,
|
|
22
|
+
boxShadow: s.shadow.raised,
|
|
23
|
+
padding: `${s.space[1]} ${s.space[2]}`,
|
|
24
|
+
maxInlineSize: "260px",
|
|
25
|
+
color: s.color.text,
|
|
26
|
+
fontFamily: s.font.sans,
|
|
27
|
+
fontSize: s.textSize.sm,
|
|
28
|
+
lineHeight: s.lineHeight.base
|
|
29
|
+
});
|
|
30
|
+
function x({ open: e, defaultOpen: n = !1, onOpenChange: i, placement: a = "top", openDelay: s = g, closeDelay: l = _, children: m }) {
|
|
31
|
+
let [y = !1, b] = t(e, n, i), { refs: x, floatingStyles: S, context: C } = r({
|
|
32
|
+
open: y,
|
|
33
|
+
placement: a,
|
|
34
|
+
onOpenChange: b
|
|
35
|
+
}), w = f(C, {
|
|
36
|
+
delay: {
|
|
37
|
+
open: s,
|
|
38
|
+
close: l
|
|
39
|
+
},
|
|
40
|
+
move: !1
|
|
41
|
+
}), T = d(C), E = u(C, { escapeKey: !0 }), D = h(C, { role: "tooltip" }), { getReferenceProps: O, getFloatingProps: k } = p([
|
|
42
|
+
w,
|
|
43
|
+
T,
|
|
44
|
+
E,
|
|
45
|
+
D
|
|
46
|
+
]), A = o(() => ({
|
|
47
|
+
open: y,
|
|
48
|
+
refs: x,
|
|
49
|
+
floatingStyles: S,
|
|
50
|
+
getReferenceProps: O,
|
|
51
|
+
getFloatingProps: k
|
|
52
|
+
}), [
|
|
53
|
+
y,
|
|
54
|
+
x,
|
|
55
|
+
S,
|
|
56
|
+
O,
|
|
57
|
+
k
|
|
58
|
+
]);
|
|
59
|
+
return /* @__PURE__ */ c(v.Provider, {
|
|
60
|
+
value: A,
|
|
61
|
+
children: m
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
x.displayName = "Tooltip";
|
|
65
|
+
function S({ ref: e, "aria-describedby": t, ...r }) {
|
|
66
|
+
let { refs: i, getReferenceProps: a } = y("Trigger"), o = m([i.setReference, e]), s = a(r), l = [t, s["aria-describedby"]].filter(Boolean).join(" ") || void 0;
|
|
67
|
+
return /* @__PURE__ */ c("button", {
|
|
68
|
+
type: "button",
|
|
69
|
+
...s,
|
|
70
|
+
ref: o,
|
|
71
|
+
"aria-describedby": l,
|
|
72
|
+
"data-ui": "tooltip-trigger",
|
|
73
|
+
css: n
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
S.displayName = "Tooltip.Trigger";
|
|
77
|
+
function C({ ref: e, style: t, ...n }) {
|
|
78
|
+
let { open: r, refs: i, floatingStyles: a, getFloatingProps: o } = y("Content"), s = m([i.setFloating, e]);
|
|
79
|
+
if (!r) return null;
|
|
80
|
+
let { tabIndex: u, ...d } = o(n);
|
|
81
|
+
return /* @__PURE__ */ c(l, { children: /* @__PURE__ */ c("div", {
|
|
82
|
+
...d,
|
|
83
|
+
ref: s,
|
|
84
|
+
"data-ui": "tooltip",
|
|
85
|
+
style: {
|
|
86
|
+
...t,
|
|
87
|
+
...a
|
|
88
|
+
},
|
|
89
|
+
css: b
|
|
90
|
+
}) });
|
|
91
|
+
}
|
|
92
|
+
C.displayName = "Tooltip.Content";
|
|
93
|
+
var w = Object.assign(x, {
|
|
94
|
+
Trigger: S,
|
|
95
|
+
Content: C
|
|
96
|
+
});
|
|
97
|
+
//#endregion
|
|
98
|
+
export { w as t };
|
package/dist/tooltip.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Tooltip } from "./tooltip-
|
|
2
|
+
export { t as Tooltip } from "./tooltip-BJPisf60.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentPropsWithRef } from 'react';
|
|
2
2
|
export type AccordionType = 'single' | 'multiple';
|
|
3
3
|
export type AccordionValue = string | string[];
|
|
4
|
-
interface AccordionBaseProps extends Omit<
|
|
4
|
+
interface AccordionBaseProps extends Omit<ComponentPropsWithRef<'div'>, 'onChange' | 'defaultValue'> {
|
|
5
5
|
/** Allow closing the last open panel. */
|
|
6
6
|
collapsible?: boolean;
|
|
7
7
|
}
|
|
@@ -19,15 +19,19 @@ export interface AccordionMultipleProps extends AccordionBaseProps {
|
|
|
19
19
|
onValueChange?: (value: string[]) => void;
|
|
20
20
|
}
|
|
21
21
|
export type AccordionProps = AccordionSingleProps | AccordionMultipleProps;
|
|
22
|
-
export interface AccordionItemProps extends
|
|
22
|
+
export interface AccordionItemProps extends ComponentPropsWithRef<'div'> {
|
|
23
23
|
value: string;
|
|
24
24
|
disabled?: boolean;
|
|
25
25
|
}
|
|
26
|
-
export type AccordionTriggerProps =
|
|
27
|
-
export type AccordionPanelProps =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
export type AccordionTriggerProps = ComponentPropsWithRef<'button'>;
|
|
27
|
+
export type AccordionPanelProps = ComponentPropsWithRef<'div'>;
|
|
28
|
+
declare function AccordionRoot({ ref, value: valueProp, defaultValue, onValueChange, type, collapsible, onKeyDown, ...rest }: AccordionProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
29
|
+
declare function AccordionItem({ ref, value, disabled, ...rest }: AccordionItemProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
30
|
+
declare function AccordionTrigger({ ref, onClick, disabled: disabledProp, ...rest }: AccordionTriggerProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
31
|
+
declare function AccordionPanel({ ref, 'aria-labelledby': ariaLabelledByProp, ...rest }: AccordionPanelProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare const Accordion: typeof AccordionRoot & {
|
|
33
|
+
Item: typeof AccordionItem;
|
|
34
|
+
Trigger: typeof AccordionTrigger;
|
|
35
|
+
Panel: typeof AccordionPanel;
|
|
32
36
|
};
|
|
33
37
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
2
|
import { type Interpolation, type Theme } from '../../styling/css';
|
|
3
3
|
export type AlertTone = 'info' | 'success' | 'warning' | 'danger';
|
|
4
4
|
export interface AlertPartProps {
|
|
5
5
|
className?: string;
|
|
6
6
|
css?: Interpolation<Theme>;
|
|
7
7
|
}
|
|
8
|
-
export interface AlertProps extends Omit<
|
|
8
|
+
export interface AlertProps extends Omit<ComponentPropsWithRef<'div'>, 'title' | 'role'> {
|
|
9
9
|
tone?: AlertTone;
|
|
10
10
|
/** Announced tone word. Put visible meaning in the title text. */
|
|
11
11
|
toneLabel?: string;
|
|
@@ -20,4 +20,7 @@ export interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'
|
|
|
20
20
|
dismiss?: AlertPartProps;
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
export declare
|
|
23
|
+
export declare function Alert({ ref, tone, toneLabel, title, children, onDismiss, dismissLabel, slotProps, className, ...rest }: AlertProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare namespace Alert {
|
|
25
|
+
var displayName: string;
|
|
26
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentPropsWithRef } from 'react';
|
|
2
2
|
import { type Interpolation, type Theme } from '../../styling/css';
|
|
3
3
|
export type AvatarSize = 'sm' | 'md' | 'lg';
|
|
4
4
|
export type AvatarStatus = 'online' | 'away' | 'busy' | 'offline';
|
|
@@ -6,7 +6,7 @@ export interface AvatarPartProps {
|
|
|
6
6
|
className?: string;
|
|
7
7
|
css?: Interpolation<Theme>;
|
|
8
8
|
}
|
|
9
|
-
export interface AvatarProps extends Omit<
|
|
9
|
+
export interface AvatarProps extends Omit<ComponentPropsWithRef<'span'>, 'children' | 'role' | 'aria-label'> {
|
|
10
10
|
/** Used for the accessible name and the initials fallback. */
|
|
11
11
|
name: string;
|
|
12
12
|
src?: string;
|
|
@@ -20,4 +20,7 @@ export interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'chil
|
|
|
20
20
|
status?: AvatarPartProps;
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
export declare
|
|
23
|
+
export declare function Avatar({ ref, name, src, size, status, statusLabel, slotProps, ...rest }: AvatarProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare namespace Avatar {
|
|
25
|
+
var displayName: string;
|
|
26
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
2
|
import { type Interpolation, type Theme } from '../../styling/css';
|
|
3
3
|
export type BadgeVariant = 'standard' | 'dot';
|
|
4
4
|
export type BadgeTone = 'accent' | 'danger' | 'neutral';
|
|
@@ -11,7 +11,7 @@ export interface BadgePartProps {
|
|
|
11
11
|
className?: string;
|
|
12
12
|
css?: Interpolation<Theme>;
|
|
13
13
|
}
|
|
14
|
-
export interface BadgeProps extends
|
|
14
|
+
export interface BadgeProps extends ComponentPropsWithRef<'span'> {
|
|
15
15
|
children: ReactNode;
|
|
16
16
|
badgeContent?: ReactNode;
|
|
17
17
|
/** Numbers above `max` render as `max+`. */
|
|
@@ -33,4 +33,7 @@ export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
33
33
|
* - Control with an explicit `aria-label`: put the count in the label (`aria-label="Inbox, 3 unread"`).
|
|
34
34
|
* - Control named by its visible text: the count is read right after the control's name.
|
|
35
35
|
*/
|
|
36
|
-
export declare
|
|
36
|
+
export declare function Badge({ ref, children, badgeContent, max, showZero, invisible, variant, tone, anchor, overlap, slotProps, className, ...rest }: BadgeProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare namespace Badge {
|
|
38
|
+
var displayName: string;
|
|
39
|
+
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export interface BreadcrumbsProps extends
|
|
1
|
+
import { type ComponentPropsWithRef, type ReactNode } from 'react';
|
|
2
|
+
export interface BreadcrumbsProps extends ComponentPropsWithRef<'nav'> {
|
|
3
3
|
/** Accessible name of the navigation landmark. */
|
|
4
4
|
label?: string;
|
|
5
5
|
/** Rendered (aria-hidden) between items. */
|
|
6
6
|
separator?: ReactNode;
|
|
7
7
|
}
|
|
8
|
-
export interface BreadcrumbsItemProps extends
|
|
8
|
+
export interface BreadcrumbsItemProps extends ComponentPropsWithRef<'li'> {
|
|
9
9
|
href?: string;
|
|
10
10
|
/** Marks the current page. Defaults to the last item when no item sets it. */
|
|
11
11
|
current?: boolean;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
declare function BreadcrumbsRoot({ ref, label, separator, children, ...rest }: BreadcrumbsProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function BreadcrumbsItem({ ref, href, current, children, ...rest }: BreadcrumbsItemProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const Breadcrumbs: typeof BreadcrumbsRoot & {
|
|
16
|
+
Item: typeof BreadcrumbsItem;
|
|
15
17
|
};
|
|
18
|
+
export {};
|