@jfrader/ui 0.2.0 → 0.4.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/accordion-Bd-j04hW.js +198 -0
- package/dist/accordion.js +1 -1
- package/dist/alert-BBqaKI4k.js +135 -0
- package/dist/alert.js +1 -1
- package/dist/avatar-BahDVO9t.js +132 -0
- package/dist/avatar.js +1 -1
- package/dist/badge-B_sLygxU.js +108 -0
- package/dist/badge.js +1 -1
- package/dist/breadcrumbs-DVAOxfvL.js +141 -0
- package/dist/breadcrumbs.js +1 -1
- package/dist/button-P2e7_44z.js +200 -0
- package/dist/button.js +1 -1
- package/dist/calendar-C9Yad_-w.js +394 -0
- package/dist/calendar.js +1 -1
- package/dist/card-D-aI2QHx.js +158 -0
- package/dist/card.js +1 -1
- package/dist/checkbox-COYG6L7d.js +140 -0
- package/dist/checkbox.js +1 -1
- package/dist/{choice-control-ByFogYcT.js → choice-control-5kJkLXgv.js} +1 -1
- package/dist/{collection-registry-1l9f3XJZ.js → collection-registry-BTYi6zGh.js} +1 -1
- package/dist/combobox-DiMC2g_u.js +327 -0
- package/dist/combobox.js +1 -1
- package/dist/command-palette-V_2pEay7.js +379 -0
- package/dist/command-palette.js +1 -1
- package/dist/container-BOaSptJa.js +41 -0
- package/dist/container.js +1 -1
- package/dist/date-picker-C29Uo4Tx.js +250 -0
- package/dist/date-picker.js +1 -1
- package/dist/dialog-xaydbXl2.js +218 -0
- package/dist/dialog.js +1 -1
- package/dist/divider-DYoJf0I_.js +84 -0
- package/dist/divider.js +1 -1
- package/dist/field-anatomy-D2ToMeRa.js +109 -0
- package/dist/flex-Dh-_J5-U.js +28 -0
- package/dist/flex.js +1 -1
- package/dist/{icon-wrapper-CFWzew5m.js → icon-wrapper-stN8sD7R.js} +1 -1
- package/dist/index.js +38 -37
- package/dist/kbd-C3ACoMoE.js +71 -0
- package/dist/kbd.js +1 -1
- package/dist/{layout-style-7ZTOiWGR.js → layout-style-Cbd1Vilw.js} +1 -1
- package/dist/{loading-ring-BpdB0aFi.js → loading-ring-B8-30Dl1.js} +1 -1
- package/dist/menu-CGPTNRnF.js +216 -0
- package/dist/menu.js +1 -1
- package/dist/navigation-DhnKriOp.js +197 -0
- package/dist/navigation.js +1 -1
- package/dist/pagination-DYdwsxwe.js +156 -0
- package/dist/pagination.js +1 -1
- package/dist/pill-DO2gHzMb.js +56 -0
- package/dist/pill.js +1 -1
- package/dist/popover-CdRXjQqI.js +113 -0
- package/dist/popover.js +1 -1
- package/dist/progress-BpJswTG4.js +90 -0
- package/dist/progress.js +1 -1
- package/dist/radio-group-Ce0_IWQr.js +145 -0
- package/dist/radio-group.js +1 -1
- package/dist/select-BgG7WgSh.js +286 -0
- package/dist/select.js +1 -1
- package/dist/skeleton-OoFlOEXO.js +54 -0
- package/dist/skeleton.js +1 -1
- package/dist/spinner-C2YDoiMn.js +56 -0
- package/dist/spinner.js +1 -1
- package/dist/stack-DC3IbtWk.js +27 -0
- package/dist/stack.js +1 -1
- package/dist/switch-Dr-qjmT4.js +142 -0
- package/dist/switch.js +1 -1
- package/dist/sx-Dx9JUKp5.js +23 -0
- package/dist/tabs-CK_g1RKa.js +203 -0
- package/dist/tabs.js +1 -1
- package/dist/{text-field-8PQAqRpM.js → text-field-D60ok14S.js} +19 -18
- package/dist/text-field.js +1 -1
- package/dist/{textarea-CcGWuntL.js → textarea-DyfjtP0A.js} +19 -18
- package/dist/textarea.js +1 -1
- package/dist/theme-root-BbTBuLMQ.js +46 -0
- package/dist/theme-root.js +1 -1
- package/dist/theme-scope-t7nAKc2c.js +27 -0
- package/dist/toast-CjmELMZZ.js +283 -0
- package/dist/toast.js +1 -1
- package/dist/toggle-group-CI0e7hFm.js +166 -0
- package/dist/toggle-group.js +1 -1
- package/dist/tooltip-CaL3rKbV.js +108 -0
- package/dist/tooltip.js +1 -1
- package/dist/{trigger-style-B1GFmH7M.js → trigger-style-B1KVC8O1.js} +1 -1
- package/dist/types/components/accordion/accordion.d.ts +9 -8
- package/dist/types/components/alert/alert.d.ts +3 -2
- package/dist/types/components/avatar/avatar.d.ts +3 -2
- package/dist/types/components/badge/badge.d.ts +3 -2
- package/dist/types/components/breadcrumbs/breadcrumbs.d.ts +5 -4
- package/dist/types/components/button/button.d.ts +3 -2
- package/dist/types/components/calendar/calendar.d.ts +7 -6
- package/dist/types/components/card/card.d.ts +13 -12
- package/dist/types/components/checkbox/checkbox.d.ts +3 -2
- package/dist/types/components/combobox/combobox.d.ts +8 -7
- package/dist/types/components/command-palette/command-palette.d.ts +15 -14
- package/dist/types/components/container/container.d.ts +3 -2
- package/dist/types/components/date-picker/date-picker.d.ts +3 -2
- package/dist/types/components/dialog/dialog.d.ts +11 -10
- package/dist/types/components/divider/divider.d.ts +3 -2
- package/dist/types/components/field/field-anatomy.d.ts +3 -2
- package/dist/types/components/flex/flex.d.ts +3 -2
- package/dist/types/components/kbd/kbd.d.ts +5 -4
- package/dist/types/components/menu/menu.d.ts +9 -8
- package/dist/types/components/navigation/navigation.d.ts +7 -6
- package/dist/types/components/pagination/pagination.d.ts +3 -2
- package/dist/types/components/pill/pill.d.ts +3 -2
- package/dist/types/components/popover/popover.d.ts +5 -4
- package/dist/types/components/progress/progress.d.ts +3 -2
- package/dist/types/components/radio-group/radio-group.d.ts +5 -4
- package/dist/types/components/select/select.d.ts +9 -8
- package/dist/types/components/skeleton/skeleton.d.ts +3 -2
- package/dist/types/components/spinner/spinner.d.ts +3 -2
- package/dist/types/components/stack/stack.d.ts +1 -1
- package/dist/types/components/switch/switch.d.ts +3 -2
- package/dist/types/components/tabs/tabs.d.ts +9 -8
- package/dist/types/components/text-field/text-field.d.ts +3 -2
- package/dist/types/components/textarea/textarea.d.ts +3 -2
- package/dist/types/components/theme-provider/theme-provider.d.ts +11 -0
- package/dist/types/components/theme-root/theme-root.d.ts +11 -4
- package/dist/types/components/toast/toast.d.ts +3 -2
- package/dist/types/components/toggle-group/toggle-group.d.ts +5 -4
- package/dist/types/components/tooltip/tooltip.d.ts +5 -4
- package/dist/types/index.d.ts +4 -0
- package/dist/types/overlay/overlay-portal.d.ts +7 -0
- package/dist/types/styling/css.d.ts +3 -2
- package/dist/types/styling/styled.d.ts +1 -0
- package/dist/types/styling/sx.d.ts +16 -0
- package/dist/types/styling/theme-scope.d.ts +19 -0
- package/dist/types/styling/theme.d.ts +98 -0
- package/dist/use-overlay-floating-Bit-f0FU.js +31 -0
- package/dist/{visually-hidden-DCWhf0Cb.js → visually-hidden-BJdvqqvn.js} +1 -1
- package/package.json +3 -2
- package/dist/accordion-CkOZ-tvs.js +0 -178
- package/dist/alert-Dsjx14UW.js +0 -131
- package/dist/avatar-BRGKkoSr.js +0 -127
- package/dist/badge-DLxUMsCx.js +0 -104
- package/dist/breadcrumbs-694hF_hm.js +0 -131
- package/dist/button-CoaIcykB.js +0 -190
- package/dist/calendar-Doj7PTdG.js +0 -379
- package/dist/card-2IM71XZj.js +0 -134
- package/dist/checkbox-B7xGNFzp.js +0 -136
- package/dist/combobox-Bjhxv5U3.js +0 -311
- package/dist/command-palette-BhJwm6cS.js +0 -344
- package/dist/container-BhnrGPu-.js +0 -36
- package/dist/css-Cgj6sCHn.js +0 -2
- package/dist/date-picker-Jk8SpoiO.js +0 -245
- package/dist/dialog-fhS07G41.js +0 -187
- package/dist/divider-v_78HYF5.js +0 -79
- package/dist/field-anatomy-BzGw1Ch9.js +0 -105
- package/dist/flex-COZzFqI8.js +0 -22
- package/dist/kbd-CeP8Kfvp.js +0 -61
- package/dist/menu-B6KCbLCr.js +0 -196
- package/dist/navigation-BDht6S2-.js +0 -182
- package/dist/pagination-B50PCaDU.js +0 -151
- package/dist/pill-2_XzBdkD.js +0 -51
- package/dist/popover-DRHbeIVq.js +0 -103
- package/dist/progress-CpsskKTD.js +0 -85
- package/dist/radio-group-DPI5KUCj.js +0 -136
- package/dist/select-C1xGrOhT.js +0 -266
- package/dist/skeleton-DitdP-yz.js +0 -49
- package/dist/spinner-CFq5HPoo.js +0 -51
- package/dist/stack-D_g6NJzo.js +0 -21
- package/dist/switch-B5TTU-oJ.js +0 -138
- package/dist/tabs-C26PWl2c.js +0 -183
- package/dist/theme-root-BRLIA4eb.js +0 -22
- package/dist/toast-B1PXuwZ4.js +0 -277
- package/dist/toggle-group-N_owicT0.js +0 -156
- package/dist/tooltip-BJPisf60.js +0 -98
- package/dist/use-overlay-floating-efeqppiw.js +0 -19
package/dist/textarea.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Textarea } from "./textarea-
|
|
2
|
+
export { t as Textarea } from "./textarea-DyfjtP0A.js";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { a as e, n as t, t as n } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { n as r, r as i } from "./theme-scope-t7nAKc2c.js";
|
|
4
|
+
import { useContext as a, useMemo as o } from "react";
|
|
5
|
+
import { vars as s } from "@jfrader/tokens/vars";
|
|
6
|
+
import { jsx as c } from "@emotion/react/jsx-runtime";
|
|
7
|
+
//#region src/styling/theme.ts
|
|
8
|
+
var l = s;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/components/theme-provider/theme-provider.tsx
|
|
11
|
+
function u({ theme: e = l, children: n }) {
|
|
12
|
+
return /* @__PURE__ */ c(t, {
|
|
13
|
+
theme: e,
|
|
14
|
+
children: n
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
u.displayName = "ThemeProvider";
|
|
18
|
+
function d() {
|
|
19
|
+
return e();
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/components/theme-root/theme-root.tsx
|
|
23
|
+
function f({ ref: e, theme: t = "dark", portalContainer: s, className: l, sx: d, ...f }) {
|
|
24
|
+
let p = a(r), m = s === void 0 ? p?.portalContainer : s, h = o(() => ({
|
|
25
|
+
theme: t,
|
|
26
|
+
portalContainer: m
|
|
27
|
+
}), [t, m]);
|
|
28
|
+
return /* @__PURE__ */ c(r.Provider, {
|
|
29
|
+
value: h,
|
|
30
|
+
children: /* @__PURE__ */ c(u, { children: /* @__PURE__ */ c(n, {
|
|
31
|
+
className: l,
|
|
32
|
+
styles: i,
|
|
33
|
+
sx: d,
|
|
34
|
+
children: (n) => /* @__PURE__ */ c("div", {
|
|
35
|
+
"data-ui": "theme-root",
|
|
36
|
+
"data-theme": t,
|
|
37
|
+
...f,
|
|
38
|
+
ref: e,
|
|
39
|
+
className: n
|
|
40
|
+
})
|
|
41
|
+
}) })
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
f.displayName = "ThemeRoot";
|
|
45
|
+
//#endregion
|
|
46
|
+
export { l as i, u as n, d as r, f as t };
|
package/dist/theme-root.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as ThemeRoot } from "./theme-root-
|
|
2
|
+
export { t as ThemeRoot } from "./theme-root-BbTBuLMQ.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { createContext as t, useContext as n } from "react";
|
|
4
|
+
import { vars as r } from "@jfrader/tokens/vars";
|
|
5
|
+
import { jsx as i } from "@emotion/react/jsx-runtime";
|
|
6
|
+
//#region src/styling/theme-scope.tsx
|
|
7
|
+
var a = t(null);
|
|
8
|
+
function o() {
|
|
9
|
+
return n(a);
|
|
10
|
+
}
|
|
11
|
+
var s = e({
|
|
12
|
+
color: r.color.text,
|
|
13
|
+
colorScheme: "dark",
|
|
14
|
+
"&[data-theme=\"light\"]": { colorScheme: "light" }
|
|
15
|
+
}), c = e({ display: "contents" });
|
|
16
|
+
function l({ children: e }) {
|
|
17
|
+
let t = o();
|
|
18
|
+
return t ? /* @__PURE__ */ i("div", {
|
|
19
|
+
"data-ui": "theme-boundary",
|
|
20
|
+
"data-theme": t.theme,
|
|
21
|
+
css: [s, c],
|
|
22
|
+
children: e
|
|
23
|
+
}) : e;
|
|
24
|
+
}
|
|
25
|
+
l.displayName = "ThemeBoundary";
|
|
26
|
+
//#endregion
|
|
27
|
+
export { o as i, a as n, s as r, l as t };
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { n } from "./media-D_eA_I-e.js";
|
|
4
|
+
import { t as r } from "./renderable-DzcIj1Lo.js";
|
|
5
|
+
import { t as i } from "./button-P2e7_44z.js";
|
|
6
|
+
import { i as a, t as o } from "./theme-scope-t7nAKc2c.js";
|
|
7
|
+
import { createContext as s, useCallback as c, useContext as l, useEffect as u, useId as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
8
|
+
import { vars as h } from "@jfrader/tokens/vars";
|
|
9
|
+
import { Fragment as g, jsx as _, jsxs as v } from "@emotion/react/jsx-runtime";
|
|
10
|
+
import { createPortal as y } from "react-dom";
|
|
11
|
+
//#region src/components/toast/toast.tsx
|
|
12
|
+
var b = 4, x = 5e3, S = "Dismiss", C = 100, w = "min(380px, calc(100vw - 32px))", T = "3px", E = s(null), D = s(null), O = e({
|
|
13
|
+
position: "fixed",
|
|
14
|
+
insetBlockEnd: 0,
|
|
15
|
+
insetInlineEnd: 0,
|
|
16
|
+
display: "flex",
|
|
17
|
+
flexDirection: "column",
|
|
18
|
+
gap: h.space[2],
|
|
19
|
+
inlineSize: w,
|
|
20
|
+
margin: 0,
|
|
21
|
+
paddingInlineEnd: h.space[4],
|
|
22
|
+
paddingBlockEnd: h.space[4],
|
|
23
|
+
pointerEvents: "none",
|
|
24
|
+
fontFamily: h.font.sans
|
|
25
|
+
}), k = e({
|
|
26
|
+
boxSizing: "border-box",
|
|
27
|
+
display: "grid",
|
|
28
|
+
gridTemplateColumns: "minmax(0, 1fr) auto",
|
|
29
|
+
alignItems: "start",
|
|
30
|
+
gap: h.space[2],
|
|
31
|
+
backgroundColor: h.color.surfaceRaised,
|
|
32
|
+
border: `1px solid ${h.color.border}`,
|
|
33
|
+
borderRadius: h.radius.lg,
|
|
34
|
+
boxShadow: h.shadow.floating,
|
|
35
|
+
padding: h.space[3],
|
|
36
|
+
color: h.color.text,
|
|
37
|
+
lineHeight: h.lineHeight.base,
|
|
38
|
+
pointerEvents: "auto",
|
|
39
|
+
transitionProperty: "opacity, transform",
|
|
40
|
+
transitionDuration: h.motion.duration.base,
|
|
41
|
+
transitionTimingFunction: h.motion.easeStandard,
|
|
42
|
+
"&[data-populated=\"false\"]": { opacity: 0 },
|
|
43
|
+
"&[data-state=\"closing\"]": {
|
|
44
|
+
opacity: 0,
|
|
45
|
+
transform: `translateY(${h.space[2]})`,
|
|
46
|
+
pointerEvents: "none"
|
|
47
|
+
},
|
|
48
|
+
[n]: { transitionDuration: "0s" }
|
|
49
|
+
}), A = {
|
|
50
|
+
neutral: e({ borderInlineStart: `${T} solid ${h.color.borderStrong}` }),
|
|
51
|
+
success: e({ borderInlineStart: `${T} solid ${h.color.success}` }),
|
|
52
|
+
danger: e({ borderInlineStart: `${T} solid ${h.color.danger}` })
|
|
53
|
+
}, j = e({
|
|
54
|
+
display: "grid",
|
|
55
|
+
gap: h.space[1],
|
|
56
|
+
alignSelf: "center",
|
|
57
|
+
minInlineSize: 0
|
|
58
|
+
}), M = e({
|
|
59
|
+
margin: 0,
|
|
60
|
+
fontSize: h.textSize.sm,
|
|
61
|
+
fontWeight: h.fontWeight.semibold
|
|
62
|
+
}), N = e({
|
|
63
|
+
margin: 0,
|
|
64
|
+
fontSize: h.textSize.sm,
|
|
65
|
+
color: h.color.textMuted
|
|
66
|
+
}), P = e({
|
|
67
|
+
gridColumn: 2,
|
|
68
|
+
gridRow: 1,
|
|
69
|
+
inlineSize: "32px",
|
|
70
|
+
paddingInline: 0
|
|
71
|
+
}), F = e({ display: "contents" }), I = e({
|
|
72
|
+
gridColumn: "1 / -1",
|
|
73
|
+
display: "flex",
|
|
74
|
+
gap: h.space[2]
|
|
75
|
+
});
|
|
76
|
+
function L(e) {
|
|
77
|
+
let t = l(D);
|
|
78
|
+
if (!t) throw Error(`Toast.${e} must be rendered inside <Toast.Provider>.`);
|
|
79
|
+
return t;
|
|
80
|
+
}
|
|
81
|
+
function R() {
|
|
82
|
+
let e = l(E);
|
|
83
|
+
if (!e) throw Error("useToast() must be called inside <Toast.Provider>.");
|
|
84
|
+
return e;
|
|
85
|
+
}
|
|
86
|
+
function z({ children: e, max: t = b, duration: n = x, dismissLabel: r = S }) {
|
|
87
|
+
let i = d(), a = p(0), [o, s] = m([]), l = p([]), u = p(/* @__PURE__ */ new Map()), h = Math.max(1, Math.floor(Number.isFinite(t) ? t : b)), g = c((e, t) => {
|
|
88
|
+
t ? u.current.set(e, t) : u.current.delete(e);
|
|
89
|
+
}, []), v = c((e, t) => {
|
|
90
|
+
let n = new Set(t.filter((e) => e.state === "open").map((e) => u.current.get(e.id)));
|
|
91
|
+
for (let t of e) {
|
|
92
|
+
let e = u.current.get(t.id);
|
|
93
|
+
if (e?.contains(e.ownerDocument.activeElement)) {
|
|
94
|
+
Array.from(e.parentElement?.querySelectorAll("[data-ui=\"toast\"]") ?? []).find((e) => n.has(e))?.querySelector("[data-toast-dismiss]")?.focus();
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}, []), y = c((e) => {
|
|
99
|
+
a.current += 1;
|
|
100
|
+
let t = `${i}toast-${a.current}`, r = {
|
|
101
|
+
id: t,
|
|
102
|
+
options: {
|
|
103
|
+
...e,
|
|
104
|
+
duration: e.duration === void 0 ? n : e.duration
|
|
105
|
+
},
|
|
106
|
+
state: "open"
|
|
107
|
+
}, o = l.current, c = [...o, r].slice(-h);
|
|
108
|
+
return v(o.filter((e) => !c.includes(e)), c), l.current = c, s(c), t;
|
|
109
|
+
}, [
|
|
110
|
+
i,
|
|
111
|
+
h,
|
|
112
|
+
n,
|
|
113
|
+
v
|
|
114
|
+
]), C = c((e) => {
|
|
115
|
+
let t = l.current;
|
|
116
|
+
v(t.filter((t) => t.id === e), t.filter((t) => t.id !== e));
|
|
117
|
+
let n = t.map((t) => t.id === e && t.state === "open" ? {
|
|
118
|
+
...t,
|
|
119
|
+
state: "closing"
|
|
120
|
+
} : t);
|
|
121
|
+
l.current = n, s(n);
|
|
122
|
+
}, [v]), w = c((e) => {
|
|
123
|
+
let t = l.current, n = t.filter((t) => t.id !== e);
|
|
124
|
+
v(t.filter((t) => t.id === e), n), l.current = n, s(n);
|
|
125
|
+
}, [v]), T = f(() => ({
|
|
126
|
+
toast: y,
|
|
127
|
+
dismiss: C
|
|
128
|
+
}), [y, C]), O = f(() => ({
|
|
129
|
+
toasts: o,
|
|
130
|
+
dismiss: C,
|
|
131
|
+
remove: w,
|
|
132
|
+
registerRoot: g,
|
|
133
|
+
dismissLabel: r
|
|
134
|
+
}), [
|
|
135
|
+
o,
|
|
136
|
+
C,
|
|
137
|
+
w,
|
|
138
|
+
g,
|
|
139
|
+
r
|
|
140
|
+
]);
|
|
141
|
+
return /* @__PURE__ */ _(E.Provider, {
|
|
142
|
+
value: T,
|
|
143
|
+
children: /* @__PURE__ */ _(D.Provider, {
|
|
144
|
+
value: O,
|
|
145
|
+
children: e
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
z.displayName = "Toast.Provider";
|
|
150
|
+
function B({ ref: e, className: n, sx: r, ...i }) {
|
|
151
|
+
let { toasts: s } = L("Viewport"), c = p(null), [l, d] = m(null), f = a()?.portalContainer, h = f === void 0 ? l : f;
|
|
152
|
+
return u(() => {
|
|
153
|
+
d(c.current?.ownerDocument.body ?? null);
|
|
154
|
+
}, []), /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
|
|
155
|
+
hidden: !0,
|
|
156
|
+
ref: c
|
|
157
|
+
}), h && y(/* @__PURE__ */ _(o, { children: /* @__PURE__ */ _(t, {
|
|
158
|
+
className: n,
|
|
159
|
+
styles: O,
|
|
160
|
+
sx: r,
|
|
161
|
+
children: (t) => /* @__PURE__ */ _("div", {
|
|
162
|
+
...i,
|
|
163
|
+
ref: e,
|
|
164
|
+
"data-ui": "toast-viewport",
|
|
165
|
+
className: t,
|
|
166
|
+
children: s.map((e) => /* @__PURE__ */ _(V, { record: e }, e.id))
|
|
167
|
+
})
|
|
168
|
+
}) }), h)] });
|
|
169
|
+
}
|
|
170
|
+
B.displayName = "Toast.Viewport";
|
|
171
|
+
function V({ record: e }) {
|
|
172
|
+
let { dismiss: t, remove: n, registerRoot: a, dismissLabel: o } = L("Viewport"), { id: s, options: l, state: d } = e, { title: f, description: h, tone: y = "neutral", action: b } = l, x = l.duration, S = p(null), w = c((e) => {
|
|
173
|
+
S.current = e, a(s, e);
|
|
174
|
+
}, [s, a]), [T, E] = m(!1), [D, O] = m(!1), [R, z] = m(!1), B = p(x ?? 0);
|
|
175
|
+
u(() => {
|
|
176
|
+
let e = setTimeout(() => E(!0), C);
|
|
177
|
+
return () => clearTimeout(e);
|
|
178
|
+
}, []);
|
|
179
|
+
let V = T && d === "open" && x !== null && !D && !R;
|
|
180
|
+
return u(() => {
|
|
181
|
+
if (!V) return;
|
|
182
|
+
let e = performance.now(), n = setTimeout(() => t(s), B.current);
|
|
183
|
+
return () => {
|
|
184
|
+
clearTimeout(n), B.current -= performance.now() - e;
|
|
185
|
+
};
|
|
186
|
+
}, [
|
|
187
|
+
V,
|
|
188
|
+
t,
|
|
189
|
+
s
|
|
190
|
+
]), u(() => {
|
|
191
|
+
if (d !== "closing") return;
|
|
192
|
+
let e = S.current, t = e && typeof e.getAnimations == "function" ? e.getAnimations() : [], r = !1;
|
|
193
|
+
return Promise.allSettled(t.map((e) => e.finished)).then(() => {
|
|
194
|
+
r || n(s);
|
|
195
|
+
}), () => {
|
|
196
|
+
r = !0;
|
|
197
|
+
};
|
|
198
|
+
}, [
|
|
199
|
+
d,
|
|
200
|
+
n,
|
|
201
|
+
s
|
|
202
|
+
]), /* @__PURE__ */ v("div", {
|
|
203
|
+
ref: w,
|
|
204
|
+
inert: d === "closing",
|
|
205
|
+
"data-ui": "toast",
|
|
206
|
+
"data-tone": y,
|
|
207
|
+
"data-state": d,
|
|
208
|
+
"data-populated": T,
|
|
209
|
+
onPointerEnter: () => O(!0),
|
|
210
|
+
onPointerLeave: () => O(!1),
|
|
211
|
+
onFocus: () => z(!0),
|
|
212
|
+
onBlur: (e) => {
|
|
213
|
+
e.currentTarget.contains(e.relatedTarget) || z(!1);
|
|
214
|
+
},
|
|
215
|
+
css: [k, A[y]],
|
|
216
|
+
children: [/* @__PURE__ */ _("div", {
|
|
217
|
+
role: y === "danger" ? "alert" : "status",
|
|
218
|
+
"aria-atomic": "true",
|
|
219
|
+
css: j,
|
|
220
|
+
children: T && /* @__PURE__ */ v(g, { children: [r(f) && /* @__PURE__ */ _("div", {
|
|
221
|
+
css: M,
|
|
222
|
+
children: f
|
|
223
|
+
}), r(h) && /* @__PURE__ */ _("div", {
|
|
224
|
+
css: N,
|
|
225
|
+
children: h
|
|
226
|
+
})] })
|
|
227
|
+
}), T && /* @__PURE__ */ v("div", {
|
|
228
|
+
css: F,
|
|
229
|
+
children: [/* @__PURE__ */ _(i, {
|
|
230
|
+
variant: "ghost",
|
|
231
|
+
size: "sm",
|
|
232
|
+
"aria-label": o,
|
|
233
|
+
"data-toast-dismiss": "",
|
|
234
|
+
onClick: () => t(s),
|
|
235
|
+
css: P,
|
|
236
|
+
children: /* @__PURE__ */ _(H, {})
|
|
237
|
+
}), b && /* @__PURE__ */ _("div", {
|
|
238
|
+
css: I,
|
|
239
|
+
children: /* @__PURE__ */ _(i, {
|
|
240
|
+
variant: "outline",
|
|
241
|
+
size: "sm",
|
|
242
|
+
onClick: (e) => {
|
|
243
|
+
b?.onClick(e), e.defaultPrevented || t(s);
|
|
244
|
+
},
|
|
245
|
+
children: b.label
|
|
246
|
+
})
|
|
247
|
+
})]
|
|
248
|
+
})]
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function H() {
|
|
252
|
+
return /* @__PURE__ */ v("svg", {
|
|
253
|
+
"aria-hidden": "true",
|
|
254
|
+
viewBox: "0 0 16 16",
|
|
255
|
+
width: "16",
|
|
256
|
+
height: "16",
|
|
257
|
+
fill: "none",
|
|
258
|
+
stroke: "currentColor",
|
|
259
|
+
strokeWidth: "2",
|
|
260
|
+
strokeLinecap: "round",
|
|
261
|
+
children: [/* @__PURE__ */ _("line", {
|
|
262
|
+
x1: "4",
|
|
263
|
+
y1: "4",
|
|
264
|
+
x2: "12",
|
|
265
|
+
y2: "12"
|
|
266
|
+
}), /* @__PURE__ */ _("line", {
|
|
267
|
+
x1: "12",
|
|
268
|
+
y1: "4",
|
|
269
|
+
x2: "4",
|
|
270
|
+
y2: "12"
|
|
271
|
+
})]
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
function U(e) {
|
|
275
|
+
return /* @__PURE__ */ _(z, { ...e });
|
|
276
|
+
}
|
|
277
|
+
U.displayName = "Toast";
|
|
278
|
+
var W = Object.assign(U, {
|
|
279
|
+
Provider: z,
|
|
280
|
+
Viewport: B
|
|
281
|
+
});
|
|
282
|
+
//#endregion
|
|
283
|
+
export { R as n, W 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-CjmELMZZ.js";
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { t as n } from "./focus-ring-BK5W5_NY.js";
|
|
4
|
+
import { n as r, t as i } from "./media-D_eA_I-e.js";
|
|
5
|
+
import { n as a, r as o, t as s } from "./roving-focus-CYlo_Kf8.js";
|
|
6
|
+
import { t as c } from "./use-controlled-state-CVXDa-qM.js";
|
|
7
|
+
import { createContext as l, useContext as u, useEffect as d, useImperativeHandle as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
8
|
+
import { vars as g } from "@jfrader/tokens/vars";
|
|
9
|
+
import { jsx as _ } from "@emotion/react/jsx-runtime";
|
|
10
|
+
//#region src/components/toggle-group/toggle-group.tsx
|
|
11
|
+
var v = l(null);
|
|
12
|
+
function y(e) {
|
|
13
|
+
let t = u(v);
|
|
14
|
+
if (!t) throw Error(`ToggleGroup.${e} must be rendered inside <ToggleGroup>.`);
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
var b = [], x = (e, t) => {
|
|
18
|
+
if (Array.isArray(e)) {
|
|
19
|
+
if (t === "multiple") return e;
|
|
20
|
+
e = e[0] ?? "";
|
|
21
|
+
}
|
|
22
|
+
return e === void 0 || e === "" ? b : [e];
|
|
23
|
+
}, S = {
|
|
24
|
+
itemSelector: "[data-ui=\"toggle-group-item\"]:not([disabled])",
|
|
25
|
+
ownerSelector: "[data-ui=\"toggle-group-root\"]"
|
|
26
|
+
}, C = "2px", w = e({
|
|
27
|
+
display: "inline-flex",
|
|
28
|
+
gap: C,
|
|
29
|
+
padding: C,
|
|
30
|
+
border: `1px solid ${g.color.borderControl}`,
|
|
31
|
+
borderRadius: g.radius.md,
|
|
32
|
+
backgroundColor: g.color.surfaceInset
|
|
33
|
+
}), T = {
|
|
34
|
+
horizontal: e({ flexDirection: "row" }),
|
|
35
|
+
vertical: e({
|
|
36
|
+
flexDirection: "column",
|
|
37
|
+
alignItems: "stretch"
|
|
38
|
+
})
|
|
39
|
+
}, E = e({
|
|
40
|
+
appearance: "none",
|
|
41
|
+
display: "inline-flex",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
justifyContent: "center",
|
|
44
|
+
gap: g.space[2],
|
|
45
|
+
minBlockSize: "32px",
|
|
46
|
+
boxSizing: "border-box",
|
|
47
|
+
border: "1px solid transparent",
|
|
48
|
+
borderRadius: g.radius.sm,
|
|
49
|
+
background: "transparent",
|
|
50
|
+
cursor: "pointer",
|
|
51
|
+
paddingBlock: g.space[1],
|
|
52
|
+
paddingInline: g.space[3],
|
|
53
|
+
font: "inherit",
|
|
54
|
+
fontSize: g.textSize.sm,
|
|
55
|
+
fontWeight: g.fontWeight.medium,
|
|
56
|
+
color: g.color.textMuted,
|
|
57
|
+
transitionProperty: "background-color, border-color, color",
|
|
58
|
+
transitionDuration: g.motion.duration.fast,
|
|
59
|
+
transitionTimingFunction: g.motion.easeStandard,
|
|
60
|
+
"&:hover:not(:disabled):not([aria-pressed=\"true\"])": {
|
|
61
|
+
backgroundColor: g.color.surfaceHover,
|
|
62
|
+
color: g.color.text
|
|
63
|
+
},
|
|
64
|
+
"&[aria-pressed=\"true\"]": {
|
|
65
|
+
backgroundColor: g.color.accentSoft,
|
|
66
|
+
borderColor: g.color.accent,
|
|
67
|
+
color: g.color.accentText
|
|
68
|
+
},
|
|
69
|
+
"&[aria-pressed=\"true\"]:hover:not(:disabled)": { backgroundColor: g.color.accentSoftHover },
|
|
70
|
+
"&:disabled": {
|
|
71
|
+
opacity: .55,
|
|
72
|
+
cursor: "not-allowed"
|
|
73
|
+
},
|
|
74
|
+
"&:focus-visible": { ...n },
|
|
75
|
+
[r]: { transitionDuration: "0s" },
|
|
76
|
+
[i]: { "&[aria-pressed=\"true\"]": {
|
|
77
|
+
backgroundColor: "SelectedItem",
|
|
78
|
+
borderColor: "SelectedItem",
|
|
79
|
+
color: "SelectedItemText"
|
|
80
|
+
} }
|
|
81
|
+
});
|
|
82
|
+
function D({ ref: e, type: n = "single", value: r, defaultValue: i, onValueChange: l, orientation: u = "horizontal", disabled: g = !1, allowEmpty: y = !1, label: b, "aria-label": C, onKeyDown: E, className: D, sx: O, ...k }) {
|
|
83
|
+
let [A, j] = c(r, i, l), [M, N] = h(null), P = m(null);
|
|
84
|
+
f(e, () => P.current, []);
|
|
85
|
+
let F = p(() => x(A, n), [A, n]), I = p(() => ({
|
|
86
|
+
pressed: F,
|
|
87
|
+
toggle: (e) => {
|
|
88
|
+
let t = F.includes(e);
|
|
89
|
+
n === "multiple" ? j(t ? F.filter((t) => t !== e) : [...F, e]) : t ? y && j("") : j(e);
|
|
90
|
+
},
|
|
91
|
+
focused: M,
|
|
92
|
+
setFocused: N,
|
|
93
|
+
disabled: g
|
|
94
|
+
}), [
|
|
95
|
+
F,
|
|
96
|
+
j,
|
|
97
|
+
n,
|
|
98
|
+
y,
|
|
99
|
+
M,
|
|
100
|
+
g
|
|
101
|
+
]);
|
|
102
|
+
d(() => {
|
|
103
|
+
let e = P.current;
|
|
104
|
+
if (!e) return;
|
|
105
|
+
let t = o(e, S);
|
|
106
|
+
if (t.length === 0 || t.some((e) => e.tabIndex === 0)) return;
|
|
107
|
+
let n = t.find((e) => e.getAttribute("aria-pressed") === "true");
|
|
108
|
+
N((n ?? s(t, M) ?? t[0])?.dataset.value ?? null);
|
|
109
|
+
});
|
|
110
|
+
let L = (e) => {
|
|
111
|
+
E?.(e);
|
|
112
|
+
let t = P.current;
|
|
113
|
+
!e.defaultPrevented && t && a(e, t, u, S);
|
|
114
|
+
};
|
|
115
|
+
return /* @__PURE__ */ _(v.Provider, {
|
|
116
|
+
value: I,
|
|
117
|
+
children: /* @__PURE__ */ _(t, {
|
|
118
|
+
className: D,
|
|
119
|
+
styles: [w, T[u]],
|
|
120
|
+
sx: O,
|
|
121
|
+
children: (e) => /* @__PURE__ */ _("div", {
|
|
122
|
+
...k,
|
|
123
|
+
ref: P,
|
|
124
|
+
role: "group",
|
|
125
|
+
"aria-label": b ?? C,
|
|
126
|
+
"aria-disabled": g || void 0,
|
|
127
|
+
"data-ui": "toggle-group-root",
|
|
128
|
+
"data-type": n,
|
|
129
|
+
"data-orientation": u,
|
|
130
|
+
onKeyDown: L,
|
|
131
|
+
className: e
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
D.displayName = "ToggleGroup";
|
|
137
|
+
function O({ ref: e, value: n, disabled: r, onClick: i, onFocus: a, className: o, sx: s, ...c }) {
|
|
138
|
+
let { pressed: l, toggle: u, focused: d, setFocused: f, disabled: p } = y("Item"), m = p || r, h = l.includes(n), g = !m && (d === null ? l[0] === n : d === n), v = (e) => {
|
|
139
|
+
i?.(e), !e.defaultPrevented && u(n);
|
|
140
|
+
}, b = (e) => {
|
|
141
|
+
a?.(e), f(n);
|
|
142
|
+
};
|
|
143
|
+
return /* @__PURE__ */ _(t, {
|
|
144
|
+
className: o,
|
|
145
|
+
styles: E,
|
|
146
|
+
sx: s,
|
|
147
|
+
children: (t) => /* @__PURE__ */ _("button", {
|
|
148
|
+
...c,
|
|
149
|
+
ref: e,
|
|
150
|
+
type: "button",
|
|
151
|
+
"aria-pressed": h,
|
|
152
|
+
"data-ui": "toggle-group-item",
|
|
153
|
+
"data-value": n,
|
|
154
|
+
"data-state": h ? "on" : "off",
|
|
155
|
+
tabIndex: g ? 0 : -1,
|
|
156
|
+
disabled: m,
|
|
157
|
+
onClick: v,
|
|
158
|
+
onFocus: b,
|
|
159
|
+
className: t
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
O.displayName = "ToggleGroup.Item";
|
|
164
|
+
var k = Object.assign(D, { Item: O });
|
|
165
|
+
//#endregion
|
|
166
|
+
export { k 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-CI0e7hFm.js";
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { t as n } from "./use-controlled-state-CVXDa-qM.js";
|
|
4
|
+
import { t as r } from "./trigger-style-B1KVC8O1.js";
|
|
5
|
+
import { n as i, t as a } from "./use-overlay-floating-Bit-f0FU.js";
|
|
6
|
+
import { createContext as o, useContext as s, useMemo as c } from "react";
|
|
7
|
+
import { vars as l } from "@jfrader/tokens/vars";
|
|
8
|
+
import { jsx as u } from "@emotion/react/jsx-runtime";
|
|
9
|
+
import { useDismiss as d, useFocus as f, useHover as p, useInteractions as m, useMergeRefs as h, useRole as g } from "@floating-ui/react";
|
|
10
|
+
//#region src/components/tooltip/tooltip.tsx
|
|
11
|
+
var _ = 300, v = 100, y = o(null);
|
|
12
|
+
function b(e) {
|
|
13
|
+
let t = s(y);
|
|
14
|
+
if (!t) throw Error(`Tooltip.${e} must be rendered inside <Tooltip>.`);
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
var x = e({
|
|
18
|
+
boxSizing: "border-box",
|
|
19
|
+
backgroundColor: l.color.bgSoft,
|
|
20
|
+
border: `1px solid ${l.color.border}`,
|
|
21
|
+
borderRadius: l.radius.sm,
|
|
22
|
+
boxShadow: l.shadow.raised,
|
|
23
|
+
padding: `${l.space[1]} ${l.space[2]}`,
|
|
24
|
+
maxInlineSize: "260px",
|
|
25
|
+
color: l.color.text,
|
|
26
|
+
fontFamily: l.font.sans,
|
|
27
|
+
fontSize: l.textSize.sm,
|
|
28
|
+
lineHeight: l.lineHeight.base
|
|
29
|
+
});
|
|
30
|
+
function S({ open: e, defaultOpen: t = !1, onOpenChange: r, placement: i = "top", openDelay: o = _, closeDelay: s = v, children: l }) {
|
|
31
|
+
let [h = !1, b] = n(e, t, r), { refs: x, floatingStyles: S, context: C } = a({
|
|
32
|
+
open: h,
|
|
33
|
+
placement: i,
|
|
34
|
+
onOpenChange: b
|
|
35
|
+
}), w = p(C, {
|
|
36
|
+
delay: {
|
|
37
|
+
open: o,
|
|
38
|
+
close: s
|
|
39
|
+
},
|
|
40
|
+
move: !1
|
|
41
|
+
}), T = f(C), E = d(C, { escapeKey: !0 }), D = g(C, { role: "tooltip" }), { getReferenceProps: O, getFloatingProps: k } = m([
|
|
42
|
+
w,
|
|
43
|
+
T,
|
|
44
|
+
E,
|
|
45
|
+
D
|
|
46
|
+
]), A = c(() => ({
|
|
47
|
+
open: h,
|
|
48
|
+
refs: x,
|
|
49
|
+
floatingStyles: S,
|
|
50
|
+
getReferenceProps: O,
|
|
51
|
+
getFloatingProps: k
|
|
52
|
+
}), [
|
|
53
|
+
h,
|
|
54
|
+
x,
|
|
55
|
+
S,
|
|
56
|
+
O,
|
|
57
|
+
k
|
|
58
|
+
]);
|
|
59
|
+
return /* @__PURE__ */ u(y.Provider, {
|
|
60
|
+
value: A,
|
|
61
|
+
children: l
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
S.displayName = "Tooltip";
|
|
65
|
+
function C({ ref: e, "aria-describedby": n, className: i, sx: a, ...o }) {
|
|
66
|
+
let { refs: s, getReferenceProps: c } = b("Trigger"), l = h([s.setReference, e]), d = c(o), f = [n, d["aria-describedby"]].filter(Boolean).join(" ") || void 0;
|
|
67
|
+
return /* @__PURE__ */ u(t, {
|
|
68
|
+
className: i,
|
|
69
|
+
styles: r,
|
|
70
|
+
sx: a,
|
|
71
|
+
children: (e) => /* @__PURE__ */ u("button", {
|
|
72
|
+
type: "button",
|
|
73
|
+
...d,
|
|
74
|
+
ref: l,
|
|
75
|
+
"aria-describedby": f,
|
|
76
|
+
"data-ui": "tooltip-trigger",
|
|
77
|
+
className: e
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
C.displayName = "Tooltip.Trigger";
|
|
82
|
+
function w({ ref: e, style: n, className: r, sx: a, ...o }) {
|
|
83
|
+
let { open: s, refs: c, floatingStyles: l, getFloatingProps: d } = b("Content"), f = h([c.setFloating, e]);
|
|
84
|
+
if (!s) return null;
|
|
85
|
+
let { tabIndex: p, ...m } = d(o);
|
|
86
|
+
return /* @__PURE__ */ u(i, { children: /* @__PURE__ */ u(t, {
|
|
87
|
+
className: r,
|
|
88
|
+
styles: x,
|
|
89
|
+
sx: a,
|
|
90
|
+
children: (e) => /* @__PURE__ */ u("div", {
|
|
91
|
+
...m,
|
|
92
|
+
ref: f,
|
|
93
|
+
"data-ui": "tooltip",
|
|
94
|
+
style: {
|
|
95
|
+
...n,
|
|
96
|
+
...l
|
|
97
|
+
},
|
|
98
|
+
className: e
|
|
99
|
+
})
|
|
100
|
+
}) });
|
|
101
|
+
}
|
|
102
|
+
w.displayName = "Tooltip.Content";
|
|
103
|
+
var T = Object.assign(S, {
|
|
104
|
+
Trigger: C,
|
|
105
|
+
Content: w
|
|
106
|
+
});
|
|
107
|
+
//#endregion
|
|
108
|
+
export { T 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-CaL3rKbV.js";
|