@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
package/dist/toast-D3Y6OAsg.js
DELETED
|
@@ -1,271 +0,0 @@
|
|
|
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-Cmixur4Q.js";
|
|
6
|
-
import { createContext as i, forwardRef as a, useCallback as o, useContext as s, useEffect as c, useId as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
7
|
-
import { vars as p } from "@jfrader/tokens/vars";
|
|
8
|
-
import { Fragment as m, jsx as h, jsxs as g } from "@emotion/react/jsx-runtime";
|
|
9
|
-
import { createPortal as _ } from "react-dom";
|
|
10
|
-
//#region src/components/toast/toast.tsx
|
|
11
|
-
var v = 4, y = 5e3, b = "Dismiss", x = 100, S = "min(380px, calc(100vw - 32px))", C = "3px", w = i(null), T = i(null), E = e({
|
|
12
|
-
position: "fixed",
|
|
13
|
-
insetBlockEnd: 0,
|
|
14
|
-
insetInlineEnd: 0,
|
|
15
|
-
display: "flex",
|
|
16
|
-
flexDirection: "column",
|
|
17
|
-
gap: p.space[2],
|
|
18
|
-
inlineSize: S,
|
|
19
|
-
margin: 0,
|
|
20
|
-
paddingInlineEnd: p.space[4],
|
|
21
|
-
paddingBlockEnd: p.space[4],
|
|
22
|
-
pointerEvents: "none",
|
|
23
|
-
fontFamily: p.font.sans
|
|
24
|
-
}), D = e({
|
|
25
|
-
boxSizing: "border-box",
|
|
26
|
-
display: "grid",
|
|
27
|
-
gridTemplateColumns: "minmax(0, 1fr) auto",
|
|
28
|
-
alignItems: "start",
|
|
29
|
-
gap: p.space[2],
|
|
30
|
-
backgroundColor: p.color.surfaceRaised,
|
|
31
|
-
border: `1px solid ${p.color.border}`,
|
|
32
|
-
borderRadius: p.radius.lg,
|
|
33
|
-
boxShadow: p.shadow.floating,
|
|
34
|
-
padding: p.space[3],
|
|
35
|
-
color: p.color.text,
|
|
36
|
-
lineHeight: p.lineHeight.base,
|
|
37
|
-
pointerEvents: "auto",
|
|
38
|
-
transitionProperty: "opacity, transform",
|
|
39
|
-
transitionDuration: p.motion.duration.base,
|
|
40
|
-
transitionTimingFunction: p.motion.easeStandard,
|
|
41
|
-
"&[data-populated=\"false\"]": { opacity: 0 },
|
|
42
|
-
"&[data-state=\"closing\"]": {
|
|
43
|
-
opacity: 0,
|
|
44
|
-
transform: `translateY(${p.space[2]})`,
|
|
45
|
-
pointerEvents: "none"
|
|
46
|
-
},
|
|
47
|
-
[t]: { transitionDuration: "0s" }
|
|
48
|
-
}), O = {
|
|
49
|
-
neutral: e({ borderInlineStart: `${C} solid ${p.color.borderStrong}` }),
|
|
50
|
-
success: e({ borderInlineStart: `${C} solid ${p.color.success}` }),
|
|
51
|
-
danger: e({ borderInlineStart: `${C} solid ${p.color.danger}` })
|
|
52
|
-
}, k = e({
|
|
53
|
-
display: "grid",
|
|
54
|
-
gap: p.space[1],
|
|
55
|
-
alignSelf: "center",
|
|
56
|
-
minInlineSize: 0
|
|
57
|
-
}), A = e({
|
|
58
|
-
margin: 0,
|
|
59
|
-
fontSize: p.textSize.sm,
|
|
60
|
-
fontWeight: p.fontWeight.semibold
|
|
61
|
-
}), j = e({
|
|
62
|
-
margin: 0,
|
|
63
|
-
fontSize: p.textSize.sm,
|
|
64
|
-
color: p.color.textMuted
|
|
65
|
-
}), M = e({
|
|
66
|
-
gridColumn: 2,
|
|
67
|
-
gridRow: 1,
|
|
68
|
-
inlineSize: "32px",
|
|
69
|
-
paddingInline: 0
|
|
70
|
-
}), N = e({ display: "contents" }), P = e({
|
|
71
|
-
gridColumn: "1 / -1",
|
|
72
|
-
display: "flex",
|
|
73
|
-
gap: p.space[2]
|
|
74
|
-
});
|
|
75
|
-
function F(e) {
|
|
76
|
-
let t = s(T);
|
|
77
|
-
if (!t) throw Error(`Toast.${e} must be rendered inside <Toast.Provider>.`);
|
|
78
|
-
return t;
|
|
79
|
-
}
|
|
80
|
-
function I() {
|
|
81
|
-
let e = s(w);
|
|
82
|
-
if (!e) throw Error("useToast() must be called inside <Toast.Provider>.");
|
|
83
|
-
return e;
|
|
84
|
-
}
|
|
85
|
-
function L({ children: e, max: t = v, duration: n = y, dismissLabel: r = b }) {
|
|
86
|
-
let i = l(), a = d(0), [s, c] = f([]), p = d([]), m = d(/* @__PURE__ */ new Map()), g = Math.max(1, Math.floor(Number.isFinite(t) ? t : v)), _ = o((e, t) => {
|
|
87
|
-
t ? m.current.set(e, t) : m.current.delete(e);
|
|
88
|
-
}, []), x = o((e, t) => {
|
|
89
|
-
let n = new Set(t.filter((e) => e.state === "open").map((e) => m.current.get(e.id)));
|
|
90
|
-
for (let t of e) {
|
|
91
|
-
let e = m.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 = o((e) => {
|
|
98
|
-
a.current += 1;
|
|
99
|
-
let t = `${i}toast-${a.current}`, r = {
|
|
100
|
-
id: t,
|
|
101
|
-
options: {
|
|
102
|
-
...e,
|
|
103
|
-
duration: e.duration === void 0 ? n : e.duration
|
|
104
|
-
},
|
|
105
|
-
state: "open"
|
|
106
|
-
}, o = p.current, s = [...o, r].slice(-g);
|
|
107
|
-
return x(o.filter((e) => !s.includes(e)), s), p.current = s, c(s), t;
|
|
108
|
-
}, [
|
|
109
|
-
i,
|
|
110
|
-
g,
|
|
111
|
-
n,
|
|
112
|
-
x
|
|
113
|
-
]), C = o((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, c(n);
|
|
121
|
-
}, [x]), E = o((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, c(n);
|
|
124
|
-
}, [x]), D = u(() => ({
|
|
125
|
-
toast: S,
|
|
126
|
-
dismiss: C
|
|
127
|
-
}), [S, C]), O = u(() => ({
|
|
128
|
-
toasts: s,
|
|
129
|
-
dismiss: C,
|
|
130
|
-
remove: E,
|
|
131
|
-
registerRoot: _,
|
|
132
|
-
dismissLabel: r
|
|
133
|
-
}), [
|
|
134
|
-
s,
|
|
135
|
-
C,
|
|
136
|
-
E,
|
|
137
|
-
_,
|
|
138
|
-
r
|
|
139
|
-
]);
|
|
140
|
-
return /* @__PURE__ */ h(w.Provider, {
|
|
141
|
-
value: D,
|
|
142
|
-
children: /* @__PURE__ */ h(T.Provider, {
|
|
143
|
-
value: O,
|
|
144
|
-
children: e
|
|
145
|
-
})
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
var R = a(function(e, t) {
|
|
149
|
-
let { toasts: n } = F("Viewport"), r = d(null), [i, a] = f(null);
|
|
150
|
-
return c(() => {
|
|
151
|
-
a(r.current?.ownerDocument.body ?? null);
|
|
152
|
-
}, []), /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
|
|
153
|
-
hidden: !0,
|
|
154
|
-
ref: r
|
|
155
|
-
}), i && _(/* @__PURE__ */ h("div", {
|
|
156
|
-
...e,
|
|
157
|
-
ref: t,
|
|
158
|
-
"data-ui": "toast-viewport",
|
|
159
|
-
css: E,
|
|
160
|
-
children: n.map((e) => /* @__PURE__ */ h(z, { record: e }, e.id))
|
|
161
|
-
}), i)] });
|
|
162
|
-
});
|
|
163
|
-
function z({ record: e }) {
|
|
164
|
-
let { dismiss: t, remove: i, registerRoot: a, dismissLabel: s } = F("Viewport"), { id: l, options: u, state: p } = e, { title: _, description: v, tone: y = "neutral", action: b } = u, S = u.duration, C = d(null), w = o((e) => {
|
|
165
|
-
C.current = e, a(l, e);
|
|
166
|
-
}, [l, a]), [T, E] = f(!1), [I, L] = f(!1), [R, z] = f(!1), V = d(S ?? 0);
|
|
167
|
-
c(() => {
|
|
168
|
-
let e = setTimeout(() => E(!0), x);
|
|
169
|
-
return () => clearTimeout(e);
|
|
170
|
-
}, []);
|
|
171
|
-
let H = T && p === "open" && S !== null && !I && !R;
|
|
172
|
-
return c(() => {
|
|
173
|
-
if (!H) return;
|
|
174
|
-
let e = performance.now(), n = setTimeout(() => t(l), V.current);
|
|
175
|
-
return () => {
|
|
176
|
-
clearTimeout(n), V.current -= performance.now() - e;
|
|
177
|
-
};
|
|
178
|
-
}, [
|
|
179
|
-
H,
|
|
180
|
-
t,
|
|
181
|
-
l
|
|
182
|
-
]), c(() => {
|
|
183
|
-
if (p !== "closing") return;
|
|
184
|
-
let e = C.current, t = e && typeof e.getAnimations == "function" ? e.getAnimations() : [], n = !1;
|
|
185
|
-
return Promise.allSettled(t.map((e) => e.finished)).then(() => {
|
|
186
|
-
n || i(l);
|
|
187
|
-
}), () => {
|
|
188
|
-
n = !0;
|
|
189
|
-
};
|
|
190
|
-
}, [
|
|
191
|
-
p,
|
|
192
|
-
i,
|
|
193
|
-
l
|
|
194
|
-
]), /* @__PURE__ */ g("div", {
|
|
195
|
-
ref: w,
|
|
196
|
-
inert: p === "closing",
|
|
197
|
-
"data-ui": "toast",
|
|
198
|
-
"data-tone": y,
|
|
199
|
-
"data-state": p,
|
|
200
|
-
"data-populated": T,
|
|
201
|
-
onPointerEnter: () => L(!0),
|
|
202
|
-
onPointerLeave: () => L(!1),
|
|
203
|
-
onFocus: () => z(!0),
|
|
204
|
-
onBlur: (e) => {
|
|
205
|
-
e.currentTarget.contains(e.relatedTarget) || z(!1);
|
|
206
|
-
},
|
|
207
|
-
css: [D, O[y]],
|
|
208
|
-
children: [/* @__PURE__ */ h("div", {
|
|
209
|
-
role: y === "danger" ? "alert" : "status",
|
|
210
|
-
"aria-atomic": "true",
|
|
211
|
-
css: k,
|
|
212
|
-
children: T && /* @__PURE__ */ g(m, { children: [n(_) && /* @__PURE__ */ h("div", {
|
|
213
|
-
css: A,
|
|
214
|
-
children: _
|
|
215
|
-
}), n(v) && /* @__PURE__ */ h("div", {
|
|
216
|
-
css: j,
|
|
217
|
-
children: v
|
|
218
|
-
})] })
|
|
219
|
-
}), T && /* @__PURE__ */ g("div", {
|
|
220
|
-
css: N,
|
|
221
|
-
children: [/* @__PURE__ */ h(r, {
|
|
222
|
-
variant: "ghost",
|
|
223
|
-
size: "sm",
|
|
224
|
-
"aria-label": s,
|
|
225
|
-
"data-toast-dismiss": "",
|
|
226
|
-
onClick: () => t(l),
|
|
227
|
-
css: M,
|
|
228
|
-
children: /* @__PURE__ */ h(B, {})
|
|
229
|
-
}), b && /* @__PURE__ */ h("div", {
|
|
230
|
-
css: P,
|
|
231
|
-
children: /* @__PURE__ */ h(r, {
|
|
232
|
-
variant: "outline",
|
|
233
|
-
size: "sm",
|
|
234
|
-
onClick: (e) => {
|
|
235
|
-
b?.onClick(e), e.defaultPrevented || t(l);
|
|
236
|
-
},
|
|
237
|
-
children: b.label
|
|
238
|
-
})
|
|
239
|
-
})]
|
|
240
|
-
})]
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
function B() {
|
|
244
|
-
return /* @__PURE__ */ g("svg", {
|
|
245
|
-
"aria-hidden": "true",
|
|
246
|
-
viewBox: "0 0 16 16",
|
|
247
|
-
width: "16",
|
|
248
|
-
height: "16",
|
|
249
|
-
fill: "none",
|
|
250
|
-
stroke: "currentColor",
|
|
251
|
-
strokeWidth: "2",
|
|
252
|
-
strokeLinecap: "round",
|
|
253
|
-
children: [/* @__PURE__ */ h("line", {
|
|
254
|
-
x1: "4",
|
|
255
|
-
y1: "4",
|
|
256
|
-
x2: "12",
|
|
257
|
-
y2: "12"
|
|
258
|
-
}), /* @__PURE__ */ h("line", {
|
|
259
|
-
x1: "12",
|
|
260
|
-
y1: "4",
|
|
261
|
-
x2: "4",
|
|
262
|
-
y2: "12"
|
|
263
|
-
})]
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
var V = Object.assign(L, {
|
|
267
|
-
Provider: L,
|
|
268
|
-
Viewport: R
|
|
269
|
-
});
|
|
270
|
-
//#endregion
|
|
271
|
-
export { I as n, V as t };
|
|
@@ -1,151 +0,0 @@
|
|
|
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, forwardRef 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 = c(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": { ...t },
|
|
75
|
-
[n]: { transitionDuration: "0s" },
|
|
76
|
-
[r]: { "&[aria-pressed=\"true\"]": {
|
|
77
|
-
backgroundColor: "SelectedItem",
|
|
78
|
-
borderColor: "SelectedItem",
|
|
79
|
-
color: "SelectedItemText"
|
|
80
|
-
} }
|
|
81
|
-
}), D = l(function({ type: e = "single", value: t, defaultValue: n, onValueChange: r, orientation: c = "horizontal", disabled: l = !1, allowEmpty: u = !1, label: g, "aria-label": y, onKeyDown: b, ...C }, E) {
|
|
82
|
-
let [D, O] = s(t, n, r), [k, A] = h(null), j = m(null);
|
|
83
|
-
f(E, () => j.current, []);
|
|
84
|
-
let M = p(() => x(D, e), [D, e]), N = p(() => ({
|
|
85
|
-
pressed: M,
|
|
86
|
-
toggle: (t) => {
|
|
87
|
-
let n = M.includes(t);
|
|
88
|
-
e === "multiple" ? O(n ? M.filter((e) => e !== t) : [...M, t]) : n ? u && O("") : O(t);
|
|
89
|
-
},
|
|
90
|
-
focused: k,
|
|
91
|
-
setFocused: A,
|
|
92
|
-
disabled: l
|
|
93
|
-
}), [
|
|
94
|
-
M,
|
|
95
|
-
O,
|
|
96
|
-
e,
|
|
97
|
-
u,
|
|
98
|
-
k,
|
|
99
|
-
l
|
|
100
|
-
]);
|
|
101
|
-
d(() => {
|
|
102
|
-
let e = j.current;
|
|
103
|
-
if (!e) return;
|
|
104
|
-
let t = a(e, S);
|
|
105
|
-
if (t.length === 0 || t.some((e) => e.tabIndex === 0)) return;
|
|
106
|
-
let n = t.find((e) => e.getAttribute("aria-pressed") === "true");
|
|
107
|
-
A((n ?? o(t, k) ?? t[0])?.dataset.value ?? null);
|
|
108
|
-
});
|
|
109
|
-
let P = (e) => {
|
|
110
|
-
b?.(e);
|
|
111
|
-
let t = j.current;
|
|
112
|
-
!e.defaultPrevented && t && i(e, t, c, S);
|
|
113
|
-
};
|
|
114
|
-
return /* @__PURE__ */ _(v.Provider, {
|
|
115
|
-
value: N,
|
|
116
|
-
children: /* @__PURE__ */ _("div", {
|
|
117
|
-
...C,
|
|
118
|
-
ref: j,
|
|
119
|
-
role: "group",
|
|
120
|
-
"aria-label": g ?? y,
|
|
121
|
-
"aria-disabled": l || void 0,
|
|
122
|
-
"data-ui": "toggle-group-root",
|
|
123
|
-
"data-type": e,
|
|
124
|
-
"data-orientation": c,
|
|
125
|
-
onKeyDown: P,
|
|
126
|
-
css: [w, T[c]]
|
|
127
|
-
})
|
|
128
|
-
});
|
|
129
|
-
}), O = l(function({ value: e, disabled: t, onClick: n, onFocus: r, ...i }, a) {
|
|
130
|
-
let { pressed: o, toggle: s, focused: c, setFocused: l, disabled: u } = y("Item"), d = u || t, f = o.includes(e), p = !d && (c === null ? o[0] === e : c === e), m = (t) => {
|
|
131
|
-
n?.(t), !t.defaultPrevented && s(e);
|
|
132
|
-
}, h = (t) => {
|
|
133
|
-
r?.(t), l(e);
|
|
134
|
-
};
|
|
135
|
-
return /* @__PURE__ */ _("button", {
|
|
136
|
-
...i,
|
|
137
|
-
ref: a,
|
|
138
|
-
type: "button",
|
|
139
|
-
"aria-pressed": f,
|
|
140
|
-
"data-ui": "toggle-group-item",
|
|
141
|
-
"data-value": e,
|
|
142
|
-
"data-state": f ? "on" : "off",
|
|
143
|
-
tabIndex: p ? 0 : -1,
|
|
144
|
-
disabled: d,
|
|
145
|
-
onClick: m,
|
|
146
|
-
onFocus: h,
|
|
147
|
-
css: E
|
|
148
|
-
});
|
|
149
|
-
}), k = Object.assign(D, { Item: O });
|
|
150
|
-
//#endregion
|
|
151
|
-
export { k as t };
|
package/dist/tooltip-CVl8HS4S.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
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, forwardRef as a, useContext as o, useMemo as s } from "react";
|
|
7
|
-
import { vars as c } from "@jfrader/tokens/vars";
|
|
8
|
-
import { jsx as l } from "@emotion/react/jsx-runtime";
|
|
9
|
-
import { FloatingPortal as u, 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 = i(null);
|
|
12
|
-
function b(e) {
|
|
13
|
-
let t = o(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: c.color.bgSoft,
|
|
20
|
-
border: `1px solid ${c.color.border}`,
|
|
21
|
-
borderRadius: c.radius.sm,
|
|
22
|
-
boxShadow: c.shadow.raised,
|
|
23
|
-
padding: `${c.space[1]} ${c.space[2]}`,
|
|
24
|
-
maxInlineSize: "260px",
|
|
25
|
-
color: c.color.text,
|
|
26
|
-
fontFamily: c.font.sans,
|
|
27
|
-
fontSize: c.textSize.sm,
|
|
28
|
-
lineHeight: c.lineHeight.base
|
|
29
|
-
});
|
|
30
|
-
function S({ open: e, defaultOpen: n = !1, onOpenChange: i, placement: a = "top", openDelay: o = _, closeDelay: c = v, children: u }) {
|
|
31
|
-
let [h = !1, b] = t(e, n, i), { refs: x, floatingStyles: S, context: C } = r({
|
|
32
|
-
open: h,
|
|
33
|
-
placement: a,
|
|
34
|
-
onOpenChange: b
|
|
35
|
-
}), w = p(C, {
|
|
36
|
-
delay: {
|
|
37
|
-
open: o,
|
|
38
|
-
close: c
|
|
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 = s(() => ({
|
|
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__ */ l(y.Provider, {
|
|
60
|
-
value: A,
|
|
61
|
-
children: u
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
var C = a(function({ "aria-describedby": e, ...t }, r) {
|
|
65
|
-
let { refs: i, getReferenceProps: a } = b("Trigger"), o = h([i.setReference, r]), s = a(t), c = [e, s["aria-describedby"]].filter(Boolean).join(" ") || void 0;
|
|
66
|
-
return /* @__PURE__ */ l("button", {
|
|
67
|
-
type: "button",
|
|
68
|
-
...s,
|
|
69
|
-
ref: o,
|
|
70
|
-
"aria-describedby": c,
|
|
71
|
-
"data-ui": "tooltip-trigger",
|
|
72
|
-
css: n
|
|
73
|
-
});
|
|
74
|
-
}), w = a(function({ style: e, ...t }, n) {
|
|
75
|
-
let { open: r, refs: i, floatingStyles: a, getFloatingProps: o } = b("Content"), s = h([i.setFloating, n]);
|
|
76
|
-
if (!r) return null;
|
|
77
|
-
let { tabIndex: c, ...d } = o(t);
|
|
78
|
-
return /* @__PURE__ */ l(u, { children: /* @__PURE__ */ l("div", {
|
|
79
|
-
...d,
|
|
80
|
-
ref: s,
|
|
81
|
-
"data-ui": "tooltip",
|
|
82
|
-
style: {
|
|
83
|
-
...e,
|
|
84
|
-
...a
|
|
85
|
-
},
|
|
86
|
-
css: x
|
|
87
|
-
}) });
|
|
88
|
-
}), T = Object.assign(S, {
|
|
89
|
-
Trigger: C,
|
|
90
|
-
Content: w
|
|
91
|
-
});
|
|
92
|
-
//#endregion
|
|
93
|
-
export { T as t };
|