@jfrader/ui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +123 -2
- package/dist/accordion-Dl-kvgPQ.js +168 -0
- package/dist/accordion.js +1 -0
- package/dist/alert-BzntPa_5.js +129 -0
- package/dist/alert.js +1 -0
- package/dist/avatar-Dk2ES3ru.js +124 -0
- package/dist/avatar.js +1 -0
- package/dist/badge-DZefC7rm.js +102 -0
- package/dist/badge.js +1 -0
- package/dist/breadcrumbs-5MCZ_Jr3.js +125 -0
- package/dist/breadcrumbs.js +1 -0
- package/dist/button-qy-50NPd.js +187 -0
- package/dist/button.js +1 -0
- package/dist/calendar-DcCAiN3b.js +372 -0
- package/dist/calendar.js +1 -0
- package/dist/card-L-Z_1vZN.js +120 -0
- package/dist/card.js +1 -0
- package/dist/checkbox-B7em7B-6.js +134 -0
- package/dist/checkbox.js +1 -0
- package/dist/choice-control-DCyQ_hVw.js +35 -0
- package/dist/collection-registry-C2jnQa7X.js +97 -0
- package/dist/combobox-DQcXR94r.js +301 -0
- package/dist/combobox.js +1 -0
- package/dist/command-palette-BRJ8A5De.js +328 -0
- package/dist/command-palette.js +1 -0
- package/dist/container-COHiEjI8.js +34 -0
- package/dist/container.js +1 -0
- package/dist/css-CW_HG55W.js +1 -0
- package/dist/date-picker-D1GwiRB9.js +239 -0
- package/dist/date-picker.js +1 -0
- package/dist/dialog-CYf9fCZO.js +175 -0
- package/dist/dialog.js +1 -0
- package/dist/disclosure-caret-BC6P8AsM.js +13 -0
- package/dist/divider-bi7OgCI5.js +76 -0
- package/dist/divider.js +1 -0
- package/dist/field-anatomy-DKkB268x.js +104 -0
- package/dist/flex-CDFDDaiu.js +21 -0
- package/dist/flex.js +1 -0
- package/dist/focus-ring-qOS3rPlM.js +11 -0
- package/dist/icon-wrapper-BKo4FI-O.js +12 -0
- package/dist/index.js +37 -0
- package/dist/kbd-DpiJgDJ2.js +55 -0
- package/dist/kbd.js +1 -0
- package/dist/layout-style-B_6YHQ6Q.js +56 -0
- package/dist/loading-ring-CTpT-IrT.js +18 -0
- package/dist/media-8K3xDAxM.js +4 -0
- package/dist/menu-A9fZUaAG.js +186 -0
- package/dist/menu.js +1 -0
- package/dist/navigation-Cemnmc_J.js +174 -0
- package/dist/navigation.js +1 -0
- package/dist/pagination-orCjUsn_.js +148 -0
- package/dist/pagination.js +1 -0
- package/dist/part-id-Bg1LSlk7.js +4 -0
- package/dist/pill-Dg2JJHHW.js +49 -0
- package/dist/pill.js +1 -0
- package/dist/popover-D_YU34WS.js +97 -0
- package/dist/popover.js +1 -0
- package/dist/progress-XdvBG0Vv.js +83 -0
- package/dist/progress.js +1 -0
- package/dist/radio-group-CxMJ2Vq7.js +130 -0
- package/dist/radio-group.js +1 -0
- package/dist/renderable-DwPvt1I8.js +6 -0
- package/dist/roving-focus-DeEZ55-T.js +35 -0
- package/dist/select-mwFbmzsn.js +256 -0
- package/dist/select.js +1 -0
- package/dist/skeleton-qas9ZKK9.js +47 -0
- package/dist/skeleton.js +1 -0
- package/dist/spinner-ros2CfIf.js +49 -0
- package/dist/spinner.js +1 -0
- package/dist/stack-Hs8THnIL.js +20 -0
- package/dist/stack.js +1 -0
- package/dist/surface-Bo_aSQOb.js +18 -0
- package/dist/switch-E375Bz4X.js +135 -0
- package/dist/switch.js +1 -0
- package/dist/tabs-CBwRiuul.js +173 -0
- package/dist/tabs.js +1 -0
- package/dist/text-field-BlP8qGn_.js +73 -0
- package/dist/text-field.js +1 -0
- package/dist/textarea-CUG26CH2.js +83 -0
- package/dist/textarea.js +1 -0
- package/dist/theme-root-CrdzwfSo.js +20 -0
- package/dist/theme-root.js +1 -0
- package/dist/toast-D_dnqnn-.js +270 -0
- package/dist/toast.js +1 -0
- package/dist/toggle-group-B7gXCea8.js +150 -0
- package/dist/toggle-group.js +1 -0
- package/dist/tooltip-BJ2hLV1b.js +92 -0
- package/dist/tooltip.js +1 -0
- package/dist/trigger-style-f54idgjT.js +35 -0
- package/dist/types/components/accordion/accordion.d.ts +33 -0
- package/dist/types/components/accordion/index.d.ts +2 -0
- package/dist/types/components/alert/alert.d.ts +23 -0
- package/dist/types/components/alert/index.d.ts +2 -0
- package/dist/types/components/avatar/avatar.d.ts +23 -0
- package/dist/types/components/avatar/index.d.ts +2 -0
- package/dist/types/components/badge/badge.d.ts +36 -0
- package/dist/types/components/badge/index.d.ts +2 -0
- package/dist/types/components/breadcrumbs/breadcrumbs.d.ts +15 -0
- package/dist/types/components/breadcrumbs/index.d.ts +2 -0
- package/dist/types/components/button/button.d.ts +34 -0
- package/dist/types/components/button/index.d.ts +2 -0
- package/dist/types/components/calendar/calendar.d.ts +28 -0
- package/dist/types/components/calendar/calendar.styles.d.ts +9 -0
- package/dist/types/components/calendar/calendar.utils.d.ts +37 -0
- package/dist/types/components/calendar/index.d.ts +2 -0
- package/dist/types/components/card/card.d.ts +34 -0
- package/dist/types/components/card/index.d.ts +2 -0
- package/dist/types/components/checkbox/checkbox.d.ts +21 -0
- package/dist/types/components/checkbox/index.d.ts +2 -0
- package/dist/types/components/combobox/combobox.d.ts +44 -0
- package/dist/types/components/combobox/index.d.ts +2 -0
- package/dist/types/components/command-palette/command-palette.d.ts +47 -0
- package/dist/types/components/command-palette/command-palette.styles.d.ts +8 -0
- package/dist/types/components/command-palette/index.d.ts +2 -0
- package/dist/types/components/container/container.d.ts +14 -0
- package/dist/types/components/container/index.d.ts +3 -0
- package/dist/types/components/date-picker/date-picker.d.ts +39 -0
- package/dist/types/components/date-picker/index.d.ts +2 -0
- package/dist/types/components/dialog/dialog.d.ts +61 -0
- package/dist/types/components/dialog/index.d.ts +2 -0
- package/dist/types/components/divider/divider.d.ts +14 -0
- package/dist/types/components/divider/index.d.ts +2 -0
- package/dist/types/components/field/field-anatomy.d.ts +49 -0
- package/dist/types/components/flex/flex.d.ts +4 -0
- package/dist/types/components/flex/index.d.ts +3 -0
- package/dist/types/components/kbd/index.d.ts +2 -0
- package/dist/types/components/kbd/kbd.d.ts +6 -0
- package/dist/types/components/menu/index.d.ts +2 -0
- package/dist/types/components/menu/menu.d.ts +29 -0
- package/dist/types/components/navigation/index.d.ts +2 -0
- package/dist/types/components/navigation/navigation.d.ts +24 -0
- package/dist/types/components/pagination/index.d.ts +2 -0
- package/dist/types/components/pagination/pagination.d.ts +14 -0
- package/dist/types/components/pill/index.d.ts +2 -0
- package/dist/types/components/pill/pill.d.ts +6 -0
- package/dist/types/components/popover/index.d.ts +2 -0
- package/dist/types/components/popover/popover.d.ts +19 -0
- package/dist/types/components/progress/index.d.ts +2 -0
- package/dist/types/components/progress/progress.d.ts +19 -0
- package/dist/types/components/radio-group/index.d.ts +2 -0
- package/dist/types/components/radio-group/radio-group.d.ts +29 -0
- package/dist/types/components/select/index.d.ts +2 -0
- package/dist/types/components/select/select.d.ts +38 -0
- package/dist/types/components/skeleton/index.d.ts +2 -0
- package/dist/types/components/skeleton/skeleton.d.ts +11 -0
- package/dist/types/components/spinner/index.d.ts +2 -0
- package/dist/types/components/spinner/spinner.d.ts +8 -0
- package/dist/types/components/stack/index.d.ts +3 -0
- package/dist/types/components/stack/stack.d.ts +7 -0
- package/dist/types/components/switch/index.d.ts +2 -0
- package/dist/types/components/switch/switch.d.ts +20 -0
- package/dist/types/components/tabs/index.d.ts +2 -0
- package/dist/types/components/tabs/tabs.d.ts +22 -0
- package/dist/types/components/text-field/index.d.ts +2 -0
- package/dist/types/components/text-field/text-field.d.ts +14 -0
- package/dist/types/components/textarea/index.d.ts +2 -0
- package/dist/types/components/textarea/textarea.d.ts +17 -0
- package/dist/types/components/theme-root/index.d.ts +2 -0
- package/dist/types/components/theme-root/theme-root.d.ts +7 -0
- package/dist/types/components/toast/index.d.ts +2 -0
- package/dist/types/components/toast/toast.d.ts +37 -0
- package/dist/types/components/toggle-group/index.d.ts +2 -0
- package/dist/types/components/toggle-group/toggle-group.d.ts +29 -0
- package/dist/types/components/tooltip/index.d.ts +2 -0
- package/dist/types/components/tooltip/tooltip.d.ts +23 -0
- package/dist/types/index.d.ts +36 -0
- package/dist/types/overlay/use-native-dialog.d.ts +39 -0
- package/dist/types/overlay/use-overlay-floating.d.ts +11 -0
- package/dist/types/overlay/use-scroll-lock.d.ts +5 -0
- package/dist/types/styling/choice-control.d.ts +8 -0
- package/dist/types/styling/css.d.ts +2 -0
- package/dist/types/styling/disclosure-caret.d.ts +9 -0
- package/dist/types/styling/focus-ring.d.ts +10 -0
- package/dist/types/styling/icon-wrapper.d.ts +1 -0
- package/dist/types/styling/input-control.d.ts +1 -0
- package/dist/types/styling/layout-style.d.ts +26 -0
- package/dist/types/styling/listbox-style.d.ts +12 -0
- package/dist/types/styling/loading-ring.d.ts +14 -0
- package/dist/types/styling/media.d.ts +2 -0
- package/dist/types/styling/surface.d.ts +19 -0
- package/dist/types/styling/trigger-style.d.ts +1 -0
- package/dist/types/styling/visually-hidden.d.ts +1 -0
- package/dist/types/utils/collection-registry.d.ts +41 -0
- package/dist/types/utils/part-id.d.ts +2 -0
- package/dist/types/utils/renderable.d.ts +3 -0
- package/dist/types/utils/roving-focus.d.ts +18 -0
- package/dist/types/utils/use-controlled-state.d.ts +7 -0
- package/dist/types/utils/use-latest-callback.d.ts +10 -0
- package/dist/use-controlled-state-DQXkiTQI.js +20 -0
- package/dist/use-native-dialog-BCp1chwO.js +83 -0
- package/dist/use-overlay-floating-CsZd3qxa.js +18 -0
- package/dist/visually-hidden-BXVyhj0y.js +16 -0
- package/package.json +198 -3
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { t as e } from "./css-CW_HG55W.js";
|
|
2
|
+
import { n as t } from "./media-8K3xDAxM.js";
|
|
3
|
+
import { t as n } from "./renderable-DwPvt1I8.js";
|
|
4
|
+
import { t as r } from "./button-qy-50NPd.js";
|
|
5
|
+
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";
|
|
6
|
+
import { vars as p } from "@jfrader/tokens/vars";
|
|
7
|
+
import { Fragment as m, jsx as h, jsxs as g } from "@emotion/react/jsx-runtime";
|
|
8
|
+
import { createPortal as _ } from "react-dom";
|
|
9
|
+
//#region src/components/toast/toast.tsx
|
|
10
|
+
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({
|
|
11
|
+
position: "fixed",
|
|
12
|
+
insetBlockEnd: 0,
|
|
13
|
+
insetInlineEnd: 0,
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: "column",
|
|
16
|
+
gap: p.space[2],
|
|
17
|
+
inlineSize: S,
|
|
18
|
+
margin: 0,
|
|
19
|
+
paddingInlineEnd: p.space[4],
|
|
20
|
+
paddingBlockEnd: p.space[4],
|
|
21
|
+
pointerEvents: "none",
|
|
22
|
+
fontFamily: p.font.sans
|
|
23
|
+
}), D = e({
|
|
24
|
+
boxSizing: "border-box",
|
|
25
|
+
display: "grid",
|
|
26
|
+
gridTemplateColumns: "minmax(0, 1fr) auto",
|
|
27
|
+
alignItems: "start",
|
|
28
|
+
gap: p.space[2],
|
|
29
|
+
backgroundColor: p.color.surfaceRaised,
|
|
30
|
+
border: `1px solid ${p.color.border}`,
|
|
31
|
+
borderRadius: p.radius.lg,
|
|
32
|
+
boxShadow: p.shadow.floating,
|
|
33
|
+
padding: p.space[3],
|
|
34
|
+
color: p.color.text,
|
|
35
|
+
lineHeight: p.lineHeight.base,
|
|
36
|
+
pointerEvents: "auto",
|
|
37
|
+
transitionProperty: "opacity, transform",
|
|
38
|
+
transitionDuration: p.motion.duration.base,
|
|
39
|
+
transitionTimingFunction: p.motion.easeStandard,
|
|
40
|
+
"&[data-populated=\"false\"]": { opacity: 0 },
|
|
41
|
+
"&[data-state=\"closing\"]": {
|
|
42
|
+
opacity: 0,
|
|
43
|
+
transform: `translateY(${p.space[2]})`,
|
|
44
|
+
pointerEvents: "none"
|
|
45
|
+
},
|
|
46
|
+
[t]: { transitionDuration: "0s" }
|
|
47
|
+
}), O = {
|
|
48
|
+
neutral: e({ borderInlineStart: `${C} solid ${p.color.borderStrong}` }),
|
|
49
|
+
success: e({ borderInlineStart: `${C} solid ${p.color.success}` }),
|
|
50
|
+
danger: e({ borderInlineStart: `${C} solid ${p.color.danger}` })
|
|
51
|
+
}, k = e({
|
|
52
|
+
display: "grid",
|
|
53
|
+
gap: p.space[1],
|
|
54
|
+
alignSelf: "center",
|
|
55
|
+
minInlineSize: 0
|
|
56
|
+
}), A = e({
|
|
57
|
+
margin: 0,
|
|
58
|
+
fontSize: p.textSize.sm,
|
|
59
|
+
fontWeight: p.fontWeight.semibold
|
|
60
|
+
}), j = e({
|
|
61
|
+
margin: 0,
|
|
62
|
+
fontSize: p.textSize.sm,
|
|
63
|
+
color: p.color.textMuted
|
|
64
|
+
}), M = e({
|
|
65
|
+
gridColumn: 2,
|
|
66
|
+
gridRow: 1,
|
|
67
|
+
inlineSize: "32px",
|
|
68
|
+
paddingInline: 0
|
|
69
|
+
}), N = e({ display: "contents" }), P = e({
|
|
70
|
+
gridColumn: "1 / -1",
|
|
71
|
+
display: "flex",
|
|
72
|
+
gap: p.space[2]
|
|
73
|
+
});
|
|
74
|
+
function F(e) {
|
|
75
|
+
let t = s(T);
|
|
76
|
+
if (!t) throw Error(`Toast.${e} must be rendered inside <Toast.Provider>.`);
|
|
77
|
+
return t;
|
|
78
|
+
}
|
|
79
|
+
function I() {
|
|
80
|
+
let e = s(w);
|
|
81
|
+
if (!e) throw Error("useToast() must be called inside <Toast.Provider>.");
|
|
82
|
+
return e;
|
|
83
|
+
}
|
|
84
|
+
function L({ children: e, max: t = v, duration: n = y, dismissLabel: r = b }) {
|
|
85
|
+
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) => {
|
|
86
|
+
t ? m.current.set(e, t) : m.current.delete(e);
|
|
87
|
+
}, []), x = o((e, t) => {
|
|
88
|
+
let n = new Set(t.filter((e) => e.state === "open").map((e) => m.current.get(e.id)));
|
|
89
|
+
for (let t of e) {
|
|
90
|
+
let e = m.current.get(t.id);
|
|
91
|
+
if (e?.contains(e.ownerDocument.activeElement)) {
|
|
92
|
+
Array.from(e.parentElement?.querySelectorAll("[data-ui=\"toast\"]") ?? []).find((e) => n.has(e))?.querySelector("[data-toast-dismiss]")?.focus();
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, []), S = o((e) => {
|
|
97
|
+
a.current += 1;
|
|
98
|
+
let t = `${i}toast-${a.current}`, r = {
|
|
99
|
+
id: t,
|
|
100
|
+
options: {
|
|
101
|
+
...e,
|
|
102
|
+
duration: e.duration === void 0 ? n : e.duration
|
|
103
|
+
},
|
|
104
|
+
state: "open"
|
|
105
|
+
}, o = p.current, s = [...o, r].slice(-g);
|
|
106
|
+
return x(o.filter((e) => !s.includes(e)), s), p.current = s, c(s), t;
|
|
107
|
+
}, [
|
|
108
|
+
i,
|
|
109
|
+
g,
|
|
110
|
+
n,
|
|
111
|
+
x
|
|
112
|
+
]), C = o((e) => {
|
|
113
|
+
let t = p.current;
|
|
114
|
+
x(t.filter((t) => t.id === e), t.filter((t) => t.id !== e));
|
|
115
|
+
let n = t.map((t) => t.id === e && t.state === "open" ? {
|
|
116
|
+
...t,
|
|
117
|
+
state: "closing"
|
|
118
|
+
} : t);
|
|
119
|
+
p.current = n, c(n);
|
|
120
|
+
}, [x]), E = o((e) => {
|
|
121
|
+
let t = p.current, n = t.filter((t) => t.id !== e);
|
|
122
|
+
x(t.filter((t) => t.id === e), n), p.current = n, c(n);
|
|
123
|
+
}, [x]), D = u(() => ({
|
|
124
|
+
toast: S,
|
|
125
|
+
dismiss: C
|
|
126
|
+
}), [S, C]), O = u(() => ({
|
|
127
|
+
toasts: s,
|
|
128
|
+
dismiss: C,
|
|
129
|
+
remove: E,
|
|
130
|
+
registerRoot: _,
|
|
131
|
+
dismissLabel: r
|
|
132
|
+
}), [
|
|
133
|
+
s,
|
|
134
|
+
C,
|
|
135
|
+
E,
|
|
136
|
+
_,
|
|
137
|
+
r
|
|
138
|
+
]);
|
|
139
|
+
return /* @__PURE__ */ h(w.Provider, {
|
|
140
|
+
value: D,
|
|
141
|
+
children: /* @__PURE__ */ h(T.Provider, {
|
|
142
|
+
value: O,
|
|
143
|
+
children: e
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
var R = a(function(e, t) {
|
|
148
|
+
let { toasts: n } = F("Viewport"), r = d(null), [i, a] = f(null);
|
|
149
|
+
return c(() => {
|
|
150
|
+
a(r.current?.ownerDocument.body ?? null);
|
|
151
|
+
}, []), /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
|
|
152
|
+
hidden: !0,
|
|
153
|
+
ref: r
|
|
154
|
+
}), i && _(/* @__PURE__ */ h("div", {
|
|
155
|
+
...e,
|
|
156
|
+
ref: t,
|
|
157
|
+
"data-ui": "toast-viewport",
|
|
158
|
+
css: E,
|
|
159
|
+
children: n.map((e) => /* @__PURE__ */ h(z, { record: e }, e.id))
|
|
160
|
+
}), i)] });
|
|
161
|
+
});
|
|
162
|
+
function z({ record: e }) {
|
|
163
|
+
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) => {
|
|
164
|
+
C.current = e, a(l, e);
|
|
165
|
+
}, [l, a]), [T, E] = f(!1), [I, L] = f(!1), [R, z] = f(!1), V = d(S ?? 0);
|
|
166
|
+
c(() => {
|
|
167
|
+
let e = setTimeout(() => E(!0), x);
|
|
168
|
+
return () => clearTimeout(e);
|
|
169
|
+
}, []);
|
|
170
|
+
let H = T && p === "open" && S !== null && !I && !R;
|
|
171
|
+
return c(() => {
|
|
172
|
+
if (!H) return;
|
|
173
|
+
let e = performance.now(), n = setTimeout(() => t(l), V.current);
|
|
174
|
+
return () => {
|
|
175
|
+
clearTimeout(n), V.current -= performance.now() - e;
|
|
176
|
+
};
|
|
177
|
+
}, [
|
|
178
|
+
H,
|
|
179
|
+
t,
|
|
180
|
+
l
|
|
181
|
+
]), c(() => {
|
|
182
|
+
if (p !== "closing") return;
|
|
183
|
+
let e = C.current, t = e && typeof e.getAnimations == "function" ? e.getAnimations() : [], n = !1;
|
|
184
|
+
return Promise.allSettled(t.map((e) => e.finished)).then(() => {
|
|
185
|
+
n || i(l);
|
|
186
|
+
}), () => {
|
|
187
|
+
n = !0;
|
|
188
|
+
};
|
|
189
|
+
}, [
|
|
190
|
+
p,
|
|
191
|
+
i,
|
|
192
|
+
l
|
|
193
|
+
]), /* @__PURE__ */ g("div", {
|
|
194
|
+
ref: w,
|
|
195
|
+
inert: p === "closing",
|
|
196
|
+
"data-ui": "toast",
|
|
197
|
+
"data-tone": y,
|
|
198
|
+
"data-state": p,
|
|
199
|
+
"data-populated": T,
|
|
200
|
+
onPointerEnter: () => L(!0),
|
|
201
|
+
onPointerLeave: () => L(!1),
|
|
202
|
+
onFocus: () => z(!0),
|
|
203
|
+
onBlur: (e) => {
|
|
204
|
+
e.currentTarget.contains(e.relatedTarget) || z(!1);
|
|
205
|
+
},
|
|
206
|
+
css: [D, O[y]],
|
|
207
|
+
children: [/* @__PURE__ */ h("div", {
|
|
208
|
+
role: y === "danger" ? "alert" : "status",
|
|
209
|
+
"aria-atomic": "true",
|
|
210
|
+
css: k,
|
|
211
|
+
children: T && /* @__PURE__ */ g(m, { children: [n(_) && /* @__PURE__ */ h("div", {
|
|
212
|
+
css: A,
|
|
213
|
+
children: _
|
|
214
|
+
}), n(v) && /* @__PURE__ */ h("div", {
|
|
215
|
+
css: j,
|
|
216
|
+
children: v
|
|
217
|
+
})] })
|
|
218
|
+
}), T && /* @__PURE__ */ g("div", {
|
|
219
|
+
css: N,
|
|
220
|
+
children: [/* @__PURE__ */ h(r, {
|
|
221
|
+
variant: "ghost",
|
|
222
|
+
size: "sm",
|
|
223
|
+
"aria-label": s,
|
|
224
|
+
"data-toast-dismiss": "",
|
|
225
|
+
onClick: () => t(l),
|
|
226
|
+
css: M,
|
|
227
|
+
children: /* @__PURE__ */ h(B, {})
|
|
228
|
+
}), b && /* @__PURE__ */ h("div", {
|
|
229
|
+
css: P,
|
|
230
|
+
children: /* @__PURE__ */ h(r, {
|
|
231
|
+
variant: "outline",
|
|
232
|
+
size: "sm",
|
|
233
|
+
onClick: (e) => {
|
|
234
|
+
b?.onClick(e), e.defaultPrevented || t(l);
|
|
235
|
+
},
|
|
236
|
+
children: b.label
|
|
237
|
+
})
|
|
238
|
+
})]
|
|
239
|
+
})]
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
function B() {
|
|
243
|
+
return /* @__PURE__ */ g("svg", {
|
|
244
|
+
"aria-hidden": "true",
|
|
245
|
+
viewBox: "0 0 16 16",
|
|
246
|
+
width: "16",
|
|
247
|
+
height: "16",
|
|
248
|
+
fill: "none",
|
|
249
|
+
stroke: "currentColor",
|
|
250
|
+
strokeWidth: "2",
|
|
251
|
+
strokeLinecap: "round",
|
|
252
|
+
children: [/* @__PURE__ */ h("line", {
|
|
253
|
+
x1: "4",
|
|
254
|
+
y1: "4",
|
|
255
|
+
x2: "12",
|
|
256
|
+
y2: "12"
|
|
257
|
+
}), /* @__PURE__ */ h("line", {
|
|
258
|
+
x1: "12",
|
|
259
|
+
y1: "4",
|
|
260
|
+
x2: "4",
|
|
261
|
+
y2: "12"
|
|
262
|
+
})]
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
var V = Object.assign(L, {
|
|
266
|
+
Provider: L,
|
|
267
|
+
Viewport: R
|
|
268
|
+
});
|
|
269
|
+
//#endregion
|
|
270
|
+
export { I as n, V as t };
|
package/dist/toast.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as Toast, n as useToast } from "./toast-D_dnqnn-.js";
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { t as e } from "./css-CW_HG55W.js";
|
|
2
|
+
import { t } from "./focus-ring-qOS3rPlM.js";
|
|
3
|
+
import { n, t as r } from "./media-8K3xDAxM.js";
|
|
4
|
+
import { n as i, r as a, t as o } from "./roving-focus-DeEZ55-T.js";
|
|
5
|
+
import { t as s } from "./use-controlled-state-DQXkiTQI.js";
|
|
6
|
+
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";
|
|
7
|
+
import { vars as g } from "@jfrader/tokens/vars";
|
|
8
|
+
import { jsx as _ } from "@emotion/react/jsx-runtime";
|
|
9
|
+
//#region src/components/toggle-group/toggle-group.tsx
|
|
10
|
+
var v = c(null);
|
|
11
|
+
function y(e) {
|
|
12
|
+
let t = u(v);
|
|
13
|
+
if (!t) throw Error(`ToggleGroup.${e} must be rendered inside <ToggleGroup>.`);
|
|
14
|
+
return t;
|
|
15
|
+
}
|
|
16
|
+
var b = [], x = (e, t) => {
|
|
17
|
+
if (Array.isArray(e)) {
|
|
18
|
+
if (t === "multiple") return e;
|
|
19
|
+
e = e[0] ?? "";
|
|
20
|
+
}
|
|
21
|
+
return e === void 0 || e === "" ? b : [e];
|
|
22
|
+
}, S = {
|
|
23
|
+
itemSelector: "[data-ui=\"toggle-group-item\"]:not([disabled])",
|
|
24
|
+
ownerSelector: "[data-ui=\"toggle-group-root\"]"
|
|
25
|
+
}, C = "2px", w = e({
|
|
26
|
+
display: "inline-flex",
|
|
27
|
+
gap: C,
|
|
28
|
+
padding: C,
|
|
29
|
+
border: `1px solid ${g.color.borderControl}`,
|
|
30
|
+
borderRadius: g.radius.md,
|
|
31
|
+
backgroundColor: g.color.surfaceInset
|
|
32
|
+
}), T = {
|
|
33
|
+
horizontal: e({ flexDirection: "row" }),
|
|
34
|
+
vertical: e({
|
|
35
|
+
flexDirection: "column",
|
|
36
|
+
alignItems: "stretch"
|
|
37
|
+
})
|
|
38
|
+
}, E = e({
|
|
39
|
+
appearance: "none",
|
|
40
|
+
display: "inline-flex",
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
justifyContent: "center",
|
|
43
|
+
gap: g.space[2],
|
|
44
|
+
minBlockSize: "32px",
|
|
45
|
+
boxSizing: "border-box",
|
|
46
|
+
border: "1px solid transparent",
|
|
47
|
+
borderRadius: g.radius.sm,
|
|
48
|
+
background: "transparent",
|
|
49
|
+
cursor: "pointer",
|
|
50
|
+
paddingBlock: g.space[1],
|
|
51
|
+
paddingInline: g.space[3],
|
|
52
|
+
font: "inherit",
|
|
53
|
+
fontSize: g.textSize.sm,
|
|
54
|
+
fontWeight: g.fontWeight.medium,
|
|
55
|
+
color: g.color.textMuted,
|
|
56
|
+
transitionProperty: "background-color, border-color, color",
|
|
57
|
+
transitionDuration: g.motion.duration.fast,
|
|
58
|
+
transitionTimingFunction: g.motion.easeStandard,
|
|
59
|
+
"&:hover:not(:disabled):not([aria-pressed=\"true\"])": {
|
|
60
|
+
backgroundColor: g.color.surfaceHover,
|
|
61
|
+
color: g.color.text
|
|
62
|
+
},
|
|
63
|
+
"&[aria-pressed=\"true\"]": {
|
|
64
|
+
backgroundColor: g.color.accentSoft,
|
|
65
|
+
borderColor: g.color.accent,
|
|
66
|
+
color: g.color.accentText
|
|
67
|
+
},
|
|
68
|
+
"&[aria-pressed=\"true\"]:hover:not(:disabled)": { backgroundColor: g.color.accentSoftHover },
|
|
69
|
+
"&:disabled": {
|
|
70
|
+
opacity: .55,
|
|
71
|
+
cursor: "not-allowed"
|
|
72
|
+
},
|
|
73
|
+
"&:focus-visible": { ...t },
|
|
74
|
+
[n]: { transitionDuration: "0s" },
|
|
75
|
+
[r]: { "&[aria-pressed=\"true\"]": {
|
|
76
|
+
backgroundColor: "SelectedItem",
|
|
77
|
+
borderColor: "SelectedItem",
|
|
78
|
+
color: "SelectedItemText"
|
|
79
|
+
} }
|
|
80
|
+
}), 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) {
|
|
81
|
+
let [D, O] = s(t, n, r), [k, A] = h(null), j = m(null);
|
|
82
|
+
f(E, () => j.current, []);
|
|
83
|
+
let M = p(() => x(D, e), [D, e]), N = p(() => ({
|
|
84
|
+
pressed: M,
|
|
85
|
+
toggle: (t) => {
|
|
86
|
+
let n = M.includes(t);
|
|
87
|
+
e === "multiple" ? O(n ? M.filter((e) => e !== t) : [...M, t]) : n ? u && O("") : O(t);
|
|
88
|
+
},
|
|
89
|
+
focused: k,
|
|
90
|
+
setFocused: A,
|
|
91
|
+
disabled: l
|
|
92
|
+
}), [
|
|
93
|
+
M,
|
|
94
|
+
O,
|
|
95
|
+
e,
|
|
96
|
+
u,
|
|
97
|
+
k,
|
|
98
|
+
l
|
|
99
|
+
]);
|
|
100
|
+
d(() => {
|
|
101
|
+
let e = j.current;
|
|
102
|
+
if (!e) return;
|
|
103
|
+
let t = a(e, S);
|
|
104
|
+
if (t.length === 0 || t.some((e) => e.tabIndex === 0)) return;
|
|
105
|
+
let n = t.find((e) => e.getAttribute("aria-pressed") === "true");
|
|
106
|
+
A((n ?? o(t, k) ?? t[0])?.dataset.value ?? null);
|
|
107
|
+
});
|
|
108
|
+
let P = (e) => {
|
|
109
|
+
b?.(e);
|
|
110
|
+
let t = j.current;
|
|
111
|
+
!e.defaultPrevented && t && i(e, t, c, S);
|
|
112
|
+
};
|
|
113
|
+
return /* @__PURE__ */ _(v.Provider, {
|
|
114
|
+
value: N,
|
|
115
|
+
children: /* @__PURE__ */ _("div", {
|
|
116
|
+
...C,
|
|
117
|
+
ref: j,
|
|
118
|
+
role: "group",
|
|
119
|
+
"aria-label": g ?? y,
|
|
120
|
+
"aria-disabled": l || void 0,
|
|
121
|
+
"data-ui": "toggle-group-root",
|
|
122
|
+
"data-type": e,
|
|
123
|
+
"data-orientation": c,
|
|
124
|
+
onKeyDown: P,
|
|
125
|
+
css: [w, T[c]]
|
|
126
|
+
})
|
|
127
|
+
});
|
|
128
|
+
}), O = l(function({ value: e, disabled: t, onClick: n, onFocus: r, ...i }, a) {
|
|
129
|
+
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) => {
|
|
130
|
+
n?.(t), !t.defaultPrevented && s(e);
|
|
131
|
+
}, h = (t) => {
|
|
132
|
+
r?.(t), l(e);
|
|
133
|
+
};
|
|
134
|
+
return /* @__PURE__ */ _("button", {
|
|
135
|
+
...i,
|
|
136
|
+
ref: a,
|
|
137
|
+
type: "button",
|
|
138
|
+
"aria-pressed": f,
|
|
139
|
+
"data-ui": "toggle-group-item",
|
|
140
|
+
"data-value": e,
|
|
141
|
+
"data-state": f ? "on" : "off",
|
|
142
|
+
tabIndex: p ? 0 : -1,
|
|
143
|
+
disabled: d,
|
|
144
|
+
onClick: m,
|
|
145
|
+
onFocus: h,
|
|
146
|
+
css: E
|
|
147
|
+
});
|
|
148
|
+
}), k = Object.assign(D, { Item: O });
|
|
149
|
+
//#endregion
|
|
150
|
+
export { k as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as ToggleGroup } from "./toggle-group-B7gXCea8.js";
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { t as e } from "./css-CW_HG55W.js";
|
|
2
|
+
import { t } from "./use-controlled-state-DQXkiTQI.js";
|
|
3
|
+
import { t as n } from "./trigger-style-f54idgjT.js";
|
|
4
|
+
import { t as r } from "./use-overlay-floating-CsZd3qxa.js";
|
|
5
|
+
import { createContext as i, forwardRef as a, useContext as o, useMemo as s } from "react";
|
|
6
|
+
import { vars as c } from "@jfrader/tokens/vars";
|
|
7
|
+
import { jsx as l } from "@emotion/react/jsx-runtime";
|
|
8
|
+
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";
|
|
9
|
+
//#region src/components/tooltip/tooltip.tsx
|
|
10
|
+
var _ = 300, v = 100, y = i(null);
|
|
11
|
+
function b(e) {
|
|
12
|
+
let t = o(y);
|
|
13
|
+
if (!t) throw Error(`Tooltip.${e} must be rendered inside <Tooltip>.`);
|
|
14
|
+
return t;
|
|
15
|
+
}
|
|
16
|
+
var x = e({
|
|
17
|
+
boxSizing: "border-box",
|
|
18
|
+
backgroundColor: c.color.bgSoft,
|
|
19
|
+
border: `1px solid ${c.color.border}`,
|
|
20
|
+
borderRadius: c.radius.sm,
|
|
21
|
+
boxShadow: c.shadow.raised,
|
|
22
|
+
padding: `${c.space[1]} ${c.space[2]}`,
|
|
23
|
+
maxInlineSize: "260px",
|
|
24
|
+
color: c.color.text,
|
|
25
|
+
fontFamily: c.font.sans,
|
|
26
|
+
fontSize: c.textSize.sm,
|
|
27
|
+
lineHeight: c.lineHeight.base
|
|
28
|
+
});
|
|
29
|
+
function S({ open: e, defaultOpen: n = !1, onOpenChange: i, placement: a = "top", openDelay: o = _, closeDelay: c = v, children: u }) {
|
|
30
|
+
let [h = !1, b] = t(e, n, i), { refs: x, floatingStyles: S, context: C } = r({
|
|
31
|
+
open: h,
|
|
32
|
+
placement: a,
|
|
33
|
+
onOpenChange: b
|
|
34
|
+
}), w = p(C, {
|
|
35
|
+
delay: {
|
|
36
|
+
open: o,
|
|
37
|
+
close: c
|
|
38
|
+
},
|
|
39
|
+
move: !1
|
|
40
|
+
}), T = f(C), E = d(C, { escapeKey: !0 }), D = g(C, { role: "tooltip" }), { getReferenceProps: O, getFloatingProps: k } = m([
|
|
41
|
+
w,
|
|
42
|
+
T,
|
|
43
|
+
E,
|
|
44
|
+
D
|
|
45
|
+
]), A = s(() => ({
|
|
46
|
+
open: h,
|
|
47
|
+
refs: x,
|
|
48
|
+
floatingStyles: S,
|
|
49
|
+
getReferenceProps: O,
|
|
50
|
+
getFloatingProps: k
|
|
51
|
+
}), [
|
|
52
|
+
h,
|
|
53
|
+
x,
|
|
54
|
+
S,
|
|
55
|
+
O,
|
|
56
|
+
k
|
|
57
|
+
]);
|
|
58
|
+
return /* @__PURE__ */ l(y.Provider, {
|
|
59
|
+
value: A,
|
|
60
|
+
children: u
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
var C = a(function({ "aria-describedby": e, ...t }, r) {
|
|
64
|
+
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;
|
|
65
|
+
return /* @__PURE__ */ l("button", {
|
|
66
|
+
type: "button",
|
|
67
|
+
...s,
|
|
68
|
+
ref: o,
|
|
69
|
+
"aria-describedby": c,
|
|
70
|
+
"data-ui": "tooltip-trigger",
|
|
71
|
+
css: n
|
|
72
|
+
});
|
|
73
|
+
}), w = a(function({ style: e, ...t }, n) {
|
|
74
|
+
let { open: r, refs: i, floatingStyles: a, getFloatingProps: o } = b("Content"), s = h([i.setFloating, n]);
|
|
75
|
+
if (!r) return null;
|
|
76
|
+
let { tabIndex: c, ...d } = o(t);
|
|
77
|
+
return /* @__PURE__ */ l(u, { children: /* @__PURE__ */ l("div", {
|
|
78
|
+
...d,
|
|
79
|
+
ref: s,
|
|
80
|
+
"data-ui": "tooltip",
|
|
81
|
+
style: {
|
|
82
|
+
...e,
|
|
83
|
+
...a
|
|
84
|
+
},
|
|
85
|
+
css: x
|
|
86
|
+
}) });
|
|
87
|
+
}), T = Object.assign(S, {
|
|
88
|
+
Trigger: C,
|
|
89
|
+
Content: w
|
|
90
|
+
});
|
|
91
|
+
//#endregion
|
|
92
|
+
export { T as t };
|
package/dist/tooltip.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as Tooltip } from "./tooltip-BJ2hLV1b.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { t as e } from "./css-CW_HG55W.js";
|
|
2
|
+
import { vars as t } from "@jfrader/tokens/vars";
|
|
3
|
+
//#region src/styling/trigger-style.ts
|
|
4
|
+
var n = e({
|
|
5
|
+
appearance: "none",
|
|
6
|
+
display: "inline-flex",
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
justifyContent: "center",
|
|
9
|
+
border: `1px solid ${t.color.borderControl}`,
|
|
10
|
+
borderRadius: t.radius.md,
|
|
11
|
+
backgroundColor: t.color.surfaceRaised,
|
|
12
|
+
minBlockSize: "40px",
|
|
13
|
+
paddingBlock: t.space[2],
|
|
14
|
+
paddingInline: t.space[4],
|
|
15
|
+
font: "inherit",
|
|
16
|
+
fontSize: t.textSize.sm,
|
|
17
|
+
fontWeight: t.fontWeight.medium,
|
|
18
|
+
color: t.color.text,
|
|
19
|
+
cursor: "pointer",
|
|
20
|
+
transitionProperty: "background-color, border-color",
|
|
21
|
+
transitionDuration: t.motion.duration.fast,
|
|
22
|
+
transitionTimingFunction: t.motion.easeStandard,
|
|
23
|
+
"&:hover:not(:disabled)": { backgroundColor: t.color.surfaceHover },
|
|
24
|
+
"&:focus-visible": {
|
|
25
|
+
outline: `2px solid ${t.color.focusRing}`,
|
|
26
|
+
outlineOffset: "2px"
|
|
27
|
+
},
|
|
28
|
+
"&:disabled": {
|
|
29
|
+
opacity: .55,
|
|
30
|
+
cursor: "not-allowed"
|
|
31
|
+
},
|
|
32
|
+
"@media (prefers-reduced-motion: reduce)": { transitionDuration: "0s" }
|
|
33
|
+
});
|
|
34
|
+
//#endregion
|
|
35
|
+
export { n as t };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
|
|
2
|
+
export type AccordionType = 'single' | 'multiple';
|
|
3
|
+
export type AccordionValue = string | string[];
|
|
4
|
+
interface AccordionBaseProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
5
|
+
/** Allow closing the last open panel. */
|
|
6
|
+
collapsible?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface AccordionSingleProps extends AccordionBaseProps {
|
|
9
|
+
type?: 'single';
|
|
10
|
+
value?: string;
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
onValueChange?: (value: string) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface AccordionMultipleProps extends AccordionBaseProps {
|
|
15
|
+
/** Allow several panels open at once. */
|
|
16
|
+
type: 'multiple';
|
|
17
|
+
value?: string[];
|
|
18
|
+
defaultValue?: string[];
|
|
19
|
+
onValueChange?: (value: string[]) => void;
|
|
20
|
+
}
|
|
21
|
+
export type AccordionProps = AccordionSingleProps | AccordionMultipleProps;
|
|
22
|
+
export interface AccordionItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
23
|
+
value: string;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export type AccordionTriggerProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
27
|
+
export type AccordionPanelProps = HTMLAttributes<HTMLDivElement>;
|
|
28
|
+
export declare const Accordion: import("react").ForwardRefExoticComponent<AccordionProps & import("react").RefAttributes<HTMLDivElement>> & {
|
|
29
|
+
Item: import("react").ForwardRefExoticComponent<AccordionItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
30
|
+
Trigger: import("react").ForwardRefExoticComponent<AccordionTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
31
|
+
Panel: import("react").ForwardRefExoticComponent<AccordionPanelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type Interpolation, type Theme } from '../../styling/css';
|
|
3
|
+
export type AlertTone = 'info' | 'success' | 'warning' | 'danger';
|
|
4
|
+
export interface AlertPartProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
css?: Interpolation<Theme>;
|
|
7
|
+
}
|
|
8
|
+
export interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'role'> {
|
|
9
|
+
tone?: AlertTone;
|
|
10
|
+
/** Announced tone word. Put visible meaning in the title text. */
|
|
11
|
+
toneLabel?: string;
|
|
12
|
+
title?: ReactNode;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
onDismiss?: () => void;
|
|
15
|
+
dismissLabel?: string;
|
|
16
|
+
slotProps?: {
|
|
17
|
+
root?: AlertPartProps;
|
|
18
|
+
title?: AlertPartProps;
|
|
19
|
+
body?: AlertPartProps;
|
|
20
|
+
dismiss?: AlertPartProps;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare const Alert: import("react").ForwardRefExoticComponent<AlertProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
import { type Interpolation, type Theme } from '../../styling/css';
|
|
3
|
+
export type AvatarSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export type AvatarStatus = 'online' | 'away' | 'busy' | 'offline';
|
|
5
|
+
export interface AvatarPartProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
css?: Interpolation<Theme>;
|
|
8
|
+
}
|
|
9
|
+
export interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'role' | 'aria-label'> {
|
|
10
|
+
/** Used for the accessible name and the initials fallback. */
|
|
11
|
+
name: string;
|
|
12
|
+
src?: string;
|
|
13
|
+
size?: AvatarSize;
|
|
14
|
+
status?: AvatarStatus;
|
|
15
|
+
/** Spoken status word; defaults to the `status` value. Pass a translated word for other locales. */
|
|
16
|
+
statusLabel?: string;
|
|
17
|
+
slotProps?: {
|
|
18
|
+
image?: AvatarPartProps;
|
|
19
|
+
fallback?: AvatarPartProps;
|
|
20
|
+
status?: AvatarPartProps;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare const Avatar: import("react").ForwardRefExoticComponent<AvatarProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type Interpolation, type Theme } from '../../styling/css';
|
|
3
|
+
export type BadgeVariant = 'standard' | 'dot';
|
|
4
|
+
export type BadgeTone = 'accent' | 'danger' | 'neutral';
|
|
5
|
+
export type BadgeOverlap = 'rectangular' | 'circular';
|
|
6
|
+
export type BadgeAnchor = {
|
|
7
|
+
vertical?: 'top' | 'bottom';
|
|
8
|
+
horizontal?: 'start' | 'end';
|
|
9
|
+
};
|
|
10
|
+
export interface BadgePartProps {
|
|
11
|
+
className?: string;
|
|
12
|
+
css?: Interpolation<Theme>;
|
|
13
|
+
}
|
|
14
|
+
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
badgeContent?: ReactNode;
|
|
17
|
+
/** Numbers above `max` render as `max+`. */
|
|
18
|
+
max?: number;
|
|
19
|
+
/** Shows the marker when `badgeContent` is 0. */
|
|
20
|
+
showZero?: boolean;
|
|
21
|
+
invisible?: boolean;
|
|
22
|
+
variant?: BadgeVariant;
|
|
23
|
+
tone?: BadgeTone;
|
|
24
|
+
anchor?: BadgeAnchor;
|
|
25
|
+
overlap?: BadgeOverlap;
|
|
26
|
+
slotProps?: {
|
|
27
|
+
root?: BadgePartProps;
|
|
28
|
+
badge?: BadgePartProps;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The marker text never joins the wrapped control's accessible name.
|
|
33
|
+
* - Control with an explicit `aria-label`: put the count in the label (`aria-label="Inbox, 3 unread"`).
|
|
34
|
+
* - Control named by its visible text: the count is read right after the control's name.
|
|
35
|
+
*/
|
|
36
|
+
export declare const Badge: import("react").ForwardRefExoticComponent<BadgeProps & import("react").RefAttributes<HTMLSpanElement>>;
|