@jfrader/ui 0.2.0 → 0.3.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-DrmjBbo7.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-ClUYBIBh.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-DU60SMdt.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-BtN_0ejj.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-BCS0-LVW.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-BiXXvQvr.js +42 -0
- package/dist/theme-root.js +1 -1
- package/dist/toast-iqelR-r0.js +282 -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-CB-HC1js.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 +3 -2
- 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/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.d.ts +98 -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
|
@@ -0,0 +1,113 @@
|
|
|
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 } from "./surface-DZ4d-2aL.js";
|
|
6
|
+
import { t as a } from "./use-overlay-floating-efeqppiw.js";
|
|
7
|
+
import { createContext as o, useContext as s, useEffect as c, useMemo as l, useRef as u } from "react";
|
|
8
|
+
import { vars as d } from "@jfrader/tokens/vars";
|
|
9
|
+
import { jsx as f } from "@emotion/react/jsx-runtime";
|
|
10
|
+
import { FloatingFocusManager as p, FloatingPortal as m, useClick as h, useDismiss as g, useInteractions as _, useMergeRefs as v, useRole as y } from "@floating-ui/react";
|
|
11
|
+
//#region src/components/popover/popover.tsx
|
|
12
|
+
var b = o(null);
|
|
13
|
+
function x(e) {
|
|
14
|
+
let t = s(b);
|
|
15
|
+
if (!t) throw Error(`Popover.${e} must be rendered inside <Popover>.`);
|
|
16
|
+
return t;
|
|
17
|
+
}
|
|
18
|
+
var S = e({
|
|
19
|
+
...i,
|
|
20
|
+
borderRadius: d.radius.lg,
|
|
21
|
+
boxShadow: d.shadow.overlay,
|
|
22
|
+
padding: d.space[4],
|
|
23
|
+
minInlineSize: "200px",
|
|
24
|
+
maxInlineSize: "min(360px, calc(100vw - 32px))",
|
|
25
|
+
fontSize: d.textSize.sm
|
|
26
|
+
});
|
|
27
|
+
function C({ open: e, defaultOpen: t = !1, onOpenChange: r, placement: i = "bottom", children: o }) {
|
|
28
|
+
let [s = !1, d] = n(e, t, r), p = u(!1), { refs: m, floatingStyles: v, context: x } = a({
|
|
29
|
+
open: s,
|
|
30
|
+
placement: i,
|
|
31
|
+
onOpenChange: (e, t, n) => {
|
|
32
|
+
e || (p.current = n === "escape-key"), d(e);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
c(() => {
|
|
36
|
+
!s && p.current && (p.current = !1, m.domReference.current?.focus());
|
|
37
|
+
}, [s, m]);
|
|
38
|
+
let S = h(x), C = g(x, {
|
|
39
|
+
escapeKey: !0,
|
|
40
|
+
outsidePress: !0
|
|
41
|
+
}), w = y(x, { role: "dialog" }), { getReferenceProps: T, getFloatingProps: E } = _([
|
|
42
|
+
S,
|
|
43
|
+
C,
|
|
44
|
+
w
|
|
45
|
+
]), D = l(() => ({
|
|
46
|
+
open: s,
|
|
47
|
+
refs: m,
|
|
48
|
+
floatingContext: x,
|
|
49
|
+
floatingStyles: v,
|
|
50
|
+
getReferenceProps: T,
|
|
51
|
+
getFloatingProps: E
|
|
52
|
+
}), [
|
|
53
|
+
s,
|
|
54
|
+
m,
|
|
55
|
+
x,
|
|
56
|
+
v,
|
|
57
|
+
T,
|
|
58
|
+
E
|
|
59
|
+
]);
|
|
60
|
+
return /* @__PURE__ */ f(b.Provider, {
|
|
61
|
+
value: D,
|
|
62
|
+
children: o
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
C.displayName = "Popover";
|
|
66
|
+
function w({ ref: e, className: n, sx: i, ...a }) {
|
|
67
|
+
let { refs: o, getReferenceProps: s } = x("Trigger"), c = v([o.setReference, e]);
|
|
68
|
+
return /* @__PURE__ */ f(t, {
|
|
69
|
+
className: n,
|
|
70
|
+
styles: r,
|
|
71
|
+
sx: i,
|
|
72
|
+
children: (e) => /* @__PURE__ */ f("button", {
|
|
73
|
+
type: "button",
|
|
74
|
+
...s(a),
|
|
75
|
+
ref: c,
|
|
76
|
+
"data-ui": "popover-trigger",
|
|
77
|
+
className: e
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
w.displayName = "Popover.Trigger";
|
|
82
|
+
function T({ ref: e, style: n, className: r, sx: i, ...a }) {
|
|
83
|
+
let { open: o, refs: s, floatingContext: c, floatingStyles: l, getFloatingProps: u } = x("Content"), d = v([s.setFloating, e]);
|
|
84
|
+
return o ? /* @__PURE__ */ f(m, { children: /* @__PURE__ */ f(p, {
|
|
85
|
+
context: c,
|
|
86
|
+
modal: !1,
|
|
87
|
+
initialFocus: -1,
|
|
88
|
+
returnFocus: !1,
|
|
89
|
+
closeOnFocusOut: !1,
|
|
90
|
+
children: /* @__PURE__ */ f(t, {
|
|
91
|
+
className: r,
|
|
92
|
+
styles: S,
|
|
93
|
+
sx: i,
|
|
94
|
+
children: (e) => /* @__PURE__ */ f("div", {
|
|
95
|
+
...u(a),
|
|
96
|
+
ref: d,
|
|
97
|
+
"data-ui": "popover",
|
|
98
|
+
style: {
|
|
99
|
+
...n,
|
|
100
|
+
...l
|
|
101
|
+
},
|
|
102
|
+
className: e
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
}) }) : null;
|
|
106
|
+
}
|
|
107
|
+
T.displayName = "Popover.Content";
|
|
108
|
+
var E = Object.assign(C, {
|
|
109
|
+
Trigger: w,
|
|
110
|
+
Content: T
|
|
111
|
+
});
|
|
112
|
+
//#endregion
|
|
113
|
+
export { E as t };
|
package/dist/popover.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Popover } from "./popover-
|
|
2
|
+
export { t as Popover } from "./popover-BtN_0ejj.js";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { i as e, r as t, t as n } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { n as r, t as i } from "./media-D_eA_I-e.js";
|
|
4
|
+
import { t as a } from "./visually-hidden-BJdvqqvn.js";
|
|
5
|
+
import { t as o } from "./renderable-DzcIj1Lo.js";
|
|
6
|
+
import { useId as s } from "react";
|
|
7
|
+
import { vars as c } from "@jfrader/tokens/vars";
|
|
8
|
+
import { jsx as l, jsxs as u } from "@emotion/react/jsx-runtime";
|
|
9
|
+
//#region src/components/progress/progress.tsx
|
|
10
|
+
var d = "40%", f = "1.4s ease-in-out infinite", p = 100, m = e({
|
|
11
|
+
from: { transform: "translateX(-100%)" },
|
|
12
|
+
to: { transform: "translateX(250%)" }
|
|
13
|
+
}), h = e({
|
|
14
|
+
from: { transform: "translateX(100%)" },
|
|
15
|
+
to: { transform: "translateX(-250%)" }
|
|
16
|
+
}), g = t({
|
|
17
|
+
position: "relative",
|
|
18
|
+
display: "block",
|
|
19
|
+
boxSizing: "border-box",
|
|
20
|
+
blockSize: "4px",
|
|
21
|
+
overflow: "hidden",
|
|
22
|
+
backgroundColor: c.color.surfaceHover,
|
|
23
|
+
border: `1px solid ${c.color.borderSubtle}`,
|
|
24
|
+
borderRadius: c.radius.full
|
|
25
|
+
}), _ = t({
|
|
26
|
+
blockSize: "100%",
|
|
27
|
+
backgroundColor: c.color.accent,
|
|
28
|
+
borderRadius: c.radius.full,
|
|
29
|
+
transitionProperty: "width",
|
|
30
|
+
transitionDuration: c.motion.duration.base,
|
|
31
|
+
transitionTimingFunction: c.motion.easeStandard,
|
|
32
|
+
[r]: { transitionDuration: "0s" },
|
|
33
|
+
[i]: {
|
|
34
|
+
forcedColorAdjust: "none",
|
|
35
|
+
backgroundColor: "Highlight"
|
|
36
|
+
}
|
|
37
|
+
}), v = t({
|
|
38
|
+
inlineSize: d,
|
|
39
|
+
animation: `${m} ${f}`,
|
|
40
|
+
"&:dir(rtl)": { animation: `${h} ${f}` },
|
|
41
|
+
[r]: {
|
|
42
|
+
"&, &:dir(rtl)": { animation: "none" },
|
|
43
|
+
opacity: .7
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
function y(e, t) {
|
|
47
|
+
let n = Number.isFinite(t) && t > 0 ? t : p;
|
|
48
|
+
return {
|
|
49
|
+
value: e === void 0 ? void 0 : Math.min(Math.max(Number.isFinite(e) ? e : 0, 0), n),
|
|
50
|
+
max: n
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function b({ ref: e, value: t, max: r = p, label: i, getValueLabel: c, slotProps: d, "aria-labelledby": f, className: m, sx: h, ...b }) {
|
|
54
|
+
let x = `${s()}-label`, S = o(i), C = [f, S && x].filter(Boolean).join(" ") || void 0, { value: w, max: T } = y(t, r), E = w === void 0, D = w === void 0 ? 0 : w / T * 100;
|
|
55
|
+
return /* @__PURE__ */ l(n, {
|
|
56
|
+
className: m,
|
|
57
|
+
styles: g,
|
|
58
|
+
sx: h,
|
|
59
|
+
children: (t) => /* @__PURE__ */ u("div", {
|
|
60
|
+
...b,
|
|
61
|
+
ref: e,
|
|
62
|
+
role: "progressbar",
|
|
63
|
+
"data-ui": "progress",
|
|
64
|
+
"data-state": E ? "indeterminate" : "determinate",
|
|
65
|
+
"aria-labelledby": C,
|
|
66
|
+
"aria-valuemin": 0,
|
|
67
|
+
"aria-valuemax": T,
|
|
68
|
+
"aria-valuenow": w,
|
|
69
|
+
"aria-valuetext": w === void 0 ? void 0 : c?.(w, T),
|
|
70
|
+
className: t,
|
|
71
|
+
children: [S && /* @__PURE__ */ l("span", {
|
|
72
|
+
id: x,
|
|
73
|
+
css: a,
|
|
74
|
+
children: i
|
|
75
|
+
}), /* @__PURE__ */ l("div", {
|
|
76
|
+
"data-ui": "progress-indicator",
|
|
77
|
+
className: d?.indicator?.className,
|
|
78
|
+
style: E ? void 0 : { width: `${D}%` },
|
|
79
|
+
css: [
|
|
80
|
+
_,
|
|
81
|
+
E && v,
|
|
82
|
+
d?.indicator?.css
|
|
83
|
+
]
|
|
84
|
+
})]
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
b.displayName = "Progress";
|
|
89
|
+
//#endregion
|
|
90
|
+
export { b as t };
|
package/dist/progress.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Progress } from "./progress-
|
|
2
|
+
export { t as Progress } from "./progress-BpJswTG4.js";
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { n, t as r } from "./media-D_eA_I-e.js";
|
|
4
|
+
import { t as i } from "./use-controlled-state-CVXDa-qM.js";
|
|
5
|
+
import { t as a } from "./renderable-DzcIj1Lo.js";
|
|
6
|
+
import { i as o, n as s, r as c, t as l } from "./choice-control-5kJkLXgv.js";
|
|
7
|
+
import { createContext as u, useContext as d, useId as f, useMemo as p } from "react";
|
|
8
|
+
import { vars as m } from "@jfrader/tokens/vars";
|
|
9
|
+
import { jsx as h, jsxs as g } from "@emotion/react/jsx-runtime";
|
|
10
|
+
//#region src/components/radio-group/radio-group.tsx
|
|
11
|
+
var _ = u(null);
|
|
12
|
+
function v(e) {
|
|
13
|
+
let t = d(_);
|
|
14
|
+
if (!t) throw Error(`RadioGroup.${e} must be rendered inside <RadioGroup>.`);
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
var y = "16px", b = {
|
|
18
|
+
vertical: e({
|
|
19
|
+
display: "grid",
|
|
20
|
+
justifyItems: "start",
|
|
21
|
+
gap: m.space[3]
|
|
22
|
+
}),
|
|
23
|
+
horizontal: e({
|
|
24
|
+
display: "flex",
|
|
25
|
+
flexWrap: "wrap",
|
|
26
|
+
alignItems: "flex-start",
|
|
27
|
+
gap: m.space[4]
|
|
28
|
+
})
|
|
29
|
+
}, x = e({ "input:checked + span::after": { opacity: 1 } }), S = e({ minBlockSize: "32px" }), C = e({
|
|
30
|
+
display: "inline-flex",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
justifyContent: "center",
|
|
33
|
+
flexShrink: 0,
|
|
34
|
+
boxSizing: "border-box",
|
|
35
|
+
inlineSize: y,
|
|
36
|
+
blockSize: y,
|
|
37
|
+
border: `1px solid ${m.color.borderControl}`,
|
|
38
|
+
borderRadius: m.radius.full,
|
|
39
|
+
backgroundColor: m.color.surfaceRaised,
|
|
40
|
+
transitionProperty: "background-color, border-color",
|
|
41
|
+
transitionDuration: m.motion.duration.fast,
|
|
42
|
+
transitionTimingFunction: m.motion.easeStandard,
|
|
43
|
+
"&::after": {
|
|
44
|
+
content: "\"\"",
|
|
45
|
+
inlineSize: "40%",
|
|
46
|
+
blockSize: "40%",
|
|
47
|
+
borderRadius: m.radius.full,
|
|
48
|
+
backgroundColor: m.color.accentContrast,
|
|
49
|
+
opacity: 0
|
|
50
|
+
},
|
|
51
|
+
[n]: { transitionDuration: "0s" },
|
|
52
|
+
[r]: { "&::after": { backgroundColor: "CanvasText" } }
|
|
53
|
+
}), w = e({ fontSize: m.textSize.sm }), T = e({
|
|
54
|
+
marginInlineStart: `calc(${y} + ${m.space[2]})`,
|
|
55
|
+
fontSize: m.textSize.sm,
|
|
56
|
+
color: m.color.textMuted
|
|
57
|
+
});
|
|
58
|
+
function E({ ref: e, value: n, defaultValue: r, onValueChange: a, name: o, disabled: s = !1, orientation: c = "vertical", className: l, sx: u, ...d }) {
|
|
59
|
+
let m = f(), g = o ?? m, [v, y] = i(n, r, a), x = p(() => ({
|
|
60
|
+
value: v,
|
|
61
|
+
setValue: y,
|
|
62
|
+
name: g,
|
|
63
|
+
disabled: s
|
|
64
|
+
}), [
|
|
65
|
+
v,
|
|
66
|
+
y,
|
|
67
|
+
g,
|
|
68
|
+
s
|
|
69
|
+
]);
|
|
70
|
+
return /* @__PURE__ */ h(_.Provider, {
|
|
71
|
+
value: x,
|
|
72
|
+
children: /* @__PURE__ */ h(t, {
|
|
73
|
+
className: l,
|
|
74
|
+
styles: b[c],
|
|
75
|
+
sx: u,
|
|
76
|
+
children: (t) => /* @__PURE__ */ h("div", {
|
|
77
|
+
...d,
|
|
78
|
+
ref: e,
|
|
79
|
+
role: "radiogroup",
|
|
80
|
+
"aria-orientation": c,
|
|
81
|
+
"data-ui": "radio-group-root",
|
|
82
|
+
"data-orientation": c,
|
|
83
|
+
className: t
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
E.displayName = "RadioGroup";
|
|
89
|
+
function D({ ref: e, value: n, label: r, description: i, disabled: u, onChange: d, slotProps: p, className: m, sx: _, "aria-labelledby": y, "aria-describedby": b, ...E }) {
|
|
90
|
+
let { value: D, setValue: O, name: k, disabled: A } = v("Radio"), j = A || u, M = f(), N = `${M}-label`, P = `${M}-description`, F = a(r), I = a(i), L = [y, F && N].filter(Boolean).join(" ") || void 0, R = [b, I && P].filter(Boolean).join(" ") || void 0, z = [m, p?.root?.className].filter(Boolean).join(" ") || void 0, B = (e) => {
|
|
91
|
+
d?.(e), e.currentTarget.checked && O(n);
|
|
92
|
+
};
|
|
93
|
+
return /* @__PURE__ */ h(t, {
|
|
94
|
+
className: z,
|
|
95
|
+
styles: [
|
|
96
|
+
c,
|
|
97
|
+
x,
|
|
98
|
+
s,
|
|
99
|
+
p?.root?.css
|
|
100
|
+
],
|
|
101
|
+
sx: _,
|
|
102
|
+
children: (t) => /* @__PURE__ */ g("label", {
|
|
103
|
+
"data-ui": "radio-group-radio",
|
|
104
|
+
className: t,
|
|
105
|
+
children: [/* @__PURE__ */ g("span", {
|
|
106
|
+
css: [o, S],
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ h("input", {
|
|
109
|
+
...E,
|
|
110
|
+
ref: e,
|
|
111
|
+
type: "radio",
|
|
112
|
+
name: k,
|
|
113
|
+
value: n,
|
|
114
|
+
checked: D === n,
|
|
115
|
+
disabled: j,
|
|
116
|
+
"aria-labelledby": L,
|
|
117
|
+
"aria-describedby": R,
|
|
118
|
+
onChange: B,
|
|
119
|
+
css: l
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ h("span", {
|
|
122
|
+
"aria-hidden": "true",
|
|
123
|
+
className: p?.control?.className,
|
|
124
|
+
css: [C, p?.control?.css]
|
|
125
|
+
}),
|
|
126
|
+
F && /* @__PURE__ */ h("span", {
|
|
127
|
+
id: N,
|
|
128
|
+
className: p?.label?.className,
|
|
129
|
+
css: [w, p?.label?.css],
|
|
130
|
+
children: r
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
}), I && /* @__PURE__ */ h("span", {
|
|
134
|
+
id: P,
|
|
135
|
+
className: p?.description?.className,
|
|
136
|
+
css: [T, p?.description?.css],
|
|
137
|
+
children: i
|
|
138
|
+
})]
|
|
139
|
+
})
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
D.displayName = "RadioGroup.Radio";
|
|
143
|
+
var O = Object.assign(E, { Radio: D });
|
|
144
|
+
//#endregion
|
|
145
|
+
export { O as t };
|
package/dist/radio-group.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as RadioGroup } from "./radio-group-
|
|
2
|
+
export { t as RadioGroup } from "./radio-group-Ce0_IWQr.js";
|
|
@@ -0,0 +1,286 @@
|
|
|
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 { a as r, c as i, d as a, f as o, l as s, o as c, r as l, s as u, t as d, u as f } from "./collection-registry-BTYi6zGh.js";
|
|
5
|
+
import { t as p } from "./trigger-style-B1KVC8O1.js";
|
|
6
|
+
import { t as m } from "./use-overlay-floating-efeqppiw.js";
|
|
7
|
+
import { createContext as h, useContext as g, useId as _, useLayoutEffect as v, useMemo as y, useRef as b, useState as x } from "react";
|
|
8
|
+
import { vars as S } from "@jfrader/tokens/vars";
|
|
9
|
+
import { jsx as C, jsxs as w } from "@emotion/react/jsx-runtime";
|
|
10
|
+
import { FloatingList as T, FloatingPortal as E, useClick as D, useDismiss as O, useInteractions as k, useListNavigation as A, useMergeRefs as j, useRole as M } from "@floating-ui/react";
|
|
11
|
+
//#region src/components/select/select.tsx
|
|
12
|
+
var N = 500, P = new Intl.Collator(void 0, {
|
|
13
|
+
usage: "search",
|
|
14
|
+
sensitivity: "base"
|
|
15
|
+
}), F = "✓", I = h(null), L = h(!1);
|
|
16
|
+
function R(e) {
|
|
17
|
+
let t = g(I);
|
|
18
|
+
if (!t) throw Error(`Select.${e} must be rendered inside <Select>.`);
|
|
19
|
+
return t;
|
|
20
|
+
}
|
|
21
|
+
function z() {
|
|
22
|
+
let e = R("Item");
|
|
23
|
+
if (!g(L)) throw Error("Select.Item must be rendered inside <Select.Content>.");
|
|
24
|
+
return e;
|
|
25
|
+
}
|
|
26
|
+
var B = e({
|
|
27
|
+
justifyContent: "flex-start",
|
|
28
|
+
minInlineSize: "180px",
|
|
29
|
+
"&[aria-expanded=\"true\"]": { backgroundColor: S.color.surfaceHover }
|
|
30
|
+
}), V = e({
|
|
31
|
+
overflow: "hidden",
|
|
32
|
+
textOverflow: "ellipsis",
|
|
33
|
+
whiteSpace: "nowrap",
|
|
34
|
+
"&[data-placeholder]": { color: S.color.textMuted }
|
|
35
|
+
});
|
|
36
|
+
function H({ value: e, defaultValue: t, onValueChange: i, open: a, defaultOpen: o = !1, onOpenChange: s, placement: c = "bottom-start", disabled: l = !1, name: u, children: d }) {
|
|
37
|
+
let f = _(), [p, h] = n(e, t, i), [g = !1, v] = n(a, o, s), [S, T] = x(null), [E, j] = x(!1), [N, F] = r(), [L, R] = x(null), z = b([]), B = b([]), V = b(null);
|
|
38
|
+
!g && E && (j(!1), T(null));
|
|
39
|
+
let { valuesByIndex: H, disabledIndices: U } = y(() => {
|
|
40
|
+
let e = [], t = /* @__PURE__ */ new Set();
|
|
41
|
+
return N.forEach((n, r) => {
|
|
42
|
+
n.index !== -1 && (e[n.index] = r, n.disabled && t.add(n.index));
|
|
43
|
+
}), {
|
|
44
|
+
valuesByIndex: e,
|
|
45
|
+
disabledIndices: t
|
|
46
|
+
};
|
|
47
|
+
}, [N]), W = p === void 0 ? void 0 : N.get(p), G = W && W.index !== -1 ? W.index : null, { refs: K, floatingStyles: q, context: J } = m({
|
|
48
|
+
open: g,
|
|
49
|
+
placement: c,
|
|
50
|
+
onOpenChange: (e) => v(e)
|
|
51
|
+
}), Y = D(J), X = M(J, { role: "listbox" }), ee = O(J, {
|
|
52
|
+
escapeKey: !0,
|
|
53
|
+
outsidePress: !0
|
|
54
|
+
}), te = A(J, {
|
|
55
|
+
listRef: z,
|
|
56
|
+
activeIndex: S,
|
|
57
|
+
onNavigate: T,
|
|
58
|
+
virtual: !0,
|
|
59
|
+
virtualItemRef: V,
|
|
60
|
+
loop: !0,
|
|
61
|
+
focusItemOnOpen: !0,
|
|
62
|
+
selectedIndex: E ? null : G,
|
|
63
|
+
disabledIndices: (e) => U.has(e)
|
|
64
|
+
}), { getReferenceProps: Z, getFloatingProps: Q, getItemProps: $ } = k([
|
|
65
|
+
Y,
|
|
66
|
+
X,
|
|
67
|
+
ee,
|
|
68
|
+
te
|
|
69
|
+
]), ne = y(() => {
|
|
70
|
+
let e = (e) => {
|
|
71
|
+
h(e), v(!1);
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
baseId: f,
|
|
75
|
+
open: g,
|
|
76
|
+
disabled: l,
|
|
77
|
+
selectedValue: p,
|
|
78
|
+
activeIndex: S,
|
|
79
|
+
options: N,
|
|
80
|
+
triggerLabelling: L,
|
|
81
|
+
refs: K,
|
|
82
|
+
floatingStyles: q,
|
|
83
|
+
elementsRef: z,
|
|
84
|
+
labelsRef: B,
|
|
85
|
+
getReferenceProps: Z,
|
|
86
|
+
getFloatingProps: Q,
|
|
87
|
+
getItemProps: $,
|
|
88
|
+
selectValue: e,
|
|
89
|
+
matchTypeahead: (e) => {
|
|
90
|
+
let t = B.current, n = S ?? -1;
|
|
91
|
+
for (let r = 1; r <= t.length; r += 1) {
|
|
92
|
+
let i = (n + r) % t.length, a = t[i];
|
|
93
|
+
if (!(a == null || U.has(i)) && P.compare(a.slice(0, e.length), e) === 0) {
|
|
94
|
+
T(i), g || (j(!0), v(!0));
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
selectIndex: (t) => {
|
|
100
|
+
let n = H[t];
|
|
101
|
+
n === void 0 || U.has(t) || e(n);
|
|
102
|
+
},
|
|
103
|
+
requestOpenChange: v,
|
|
104
|
+
registration: F,
|
|
105
|
+
setTriggerLabelling: R
|
|
106
|
+
};
|
|
107
|
+
}, [
|
|
108
|
+
f,
|
|
109
|
+
g,
|
|
110
|
+
l,
|
|
111
|
+
p,
|
|
112
|
+
S,
|
|
113
|
+
N,
|
|
114
|
+
L,
|
|
115
|
+
K,
|
|
116
|
+
q,
|
|
117
|
+
Z,
|
|
118
|
+
Q,
|
|
119
|
+
$,
|
|
120
|
+
H,
|
|
121
|
+
U,
|
|
122
|
+
h,
|
|
123
|
+
v,
|
|
124
|
+
F
|
|
125
|
+
]);
|
|
126
|
+
return /* @__PURE__ */ w(I.Provider, {
|
|
127
|
+
value: ne,
|
|
128
|
+
children: [d, u !== void 0 && /* @__PURE__ */ C("input", {
|
|
129
|
+
type: "hidden",
|
|
130
|
+
name: u,
|
|
131
|
+
value: p ?? "",
|
|
132
|
+
disabled: l
|
|
133
|
+
})]
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
H.displayName = "Select";
|
|
137
|
+
function U({ ref: e, id: n, disabled: r, onKeyDown: i, className: a, sx: o, ...s }) {
|
|
138
|
+
let { baseId: c, open: l, disabled: u, activeIndex: d, refs: f, getReferenceProps: m, selectIndex: h, matchTypeahead: g, requestOpenChange: _, setTriggerLabelling: y } = R("Trigger"), x = j([f.setReference, e]), S = b({
|
|
139
|
+
search: "",
|
|
140
|
+
lastKeyAt: 0
|
|
141
|
+
}), w = n ?? `${c}-trigger`, T = s["aria-labelledby"], E = s["aria-label"];
|
|
142
|
+
v(() => (y({
|
|
143
|
+
id: w,
|
|
144
|
+
labelledBy: T,
|
|
145
|
+
label: E
|
|
146
|
+
}), () => y(null)), [
|
|
147
|
+
w,
|
|
148
|
+
T,
|
|
149
|
+
E,
|
|
150
|
+
y
|
|
151
|
+
]);
|
|
152
|
+
let D = (e) => {
|
|
153
|
+
if (i?.(e), !(e.defaultPrevented || u || r)) {
|
|
154
|
+
if (e.key.length === 1 && e.key !== " " && !e.ctrlKey && !e.altKey && !e.metaKey) {
|
|
155
|
+
let t = performance.now(), n = S.current, r = (t - n.lastKeyAt > N ? "" : n.search) + e.key;
|
|
156
|
+
S.current = {
|
|
157
|
+
search: r,
|
|
158
|
+
lastKeyAt: t
|
|
159
|
+
}, g(r);
|
|
160
|
+
} else l && (e.key === "Tab" ? _(!1) : (e.key === "Enter" || e.key === " ") && d !== null && (e.preventDefault(), h(d)));
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
return /* @__PURE__ */ C(t, {
|
|
164
|
+
className: a,
|
|
165
|
+
styles: [p, B],
|
|
166
|
+
sx: o,
|
|
167
|
+
children: (e) => /* @__PURE__ */ C("button", {
|
|
168
|
+
type: "button",
|
|
169
|
+
...m({
|
|
170
|
+
...s,
|
|
171
|
+
id: w,
|
|
172
|
+
disabled: u || r,
|
|
173
|
+
onKeyDown: D
|
|
174
|
+
}),
|
|
175
|
+
ref: x,
|
|
176
|
+
"data-state": l ? "open" : "closed",
|
|
177
|
+
"data-ui": "select-trigger",
|
|
178
|
+
className: e
|
|
179
|
+
})
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
U.displayName = "Select.Trigger";
|
|
183
|
+
function W({ ref: e, placeholder: n, className: r, sx: i, ...a }) {
|
|
184
|
+
let { selectedValue: o, options: s } = R("Value"), c = o === void 0 ? void 0 : s.get(o)?.label, l = c === void 0;
|
|
185
|
+
return /* @__PURE__ */ C(t, {
|
|
186
|
+
className: r,
|
|
187
|
+
styles: V,
|
|
188
|
+
sx: i,
|
|
189
|
+
children: (t) => /* @__PURE__ */ C("span", {
|
|
190
|
+
...a,
|
|
191
|
+
ref: e,
|
|
192
|
+
"data-placeholder": l || void 0,
|
|
193
|
+
"data-ui": "select-value",
|
|
194
|
+
className: t,
|
|
195
|
+
children: l ? n : c
|
|
196
|
+
})
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
W.displayName = "Select.Value";
|
|
200
|
+
function G({ ref: e, style: n, onMouseDown: r, children: i, className: s, sx: c, ...l }) {
|
|
201
|
+
let { open: u, triggerLabelling: d, refs: f, floatingStyles: p, elementsRef: m, getFloatingProps: h } = R("Content"), g = j([u ? f.setFloating : null, e]), _ = l["aria-labelledby"] !== void 0 || l["aria-label"] !== void 0 ? {} : d?.labelledBy === void 0 ? d?.label === void 0 ? { "aria-labelledby": d?.id } : { "aria-label": d.label } : { "aria-labelledby": d.labelledBy }, v = (e) => {
|
|
202
|
+
r?.(e), e.preventDefault();
|
|
203
|
+
};
|
|
204
|
+
return /* @__PURE__ */ C(E, { children: /* @__PURE__ */ C(t, {
|
|
205
|
+
className: s,
|
|
206
|
+
styles: [o, a],
|
|
207
|
+
sx: c,
|
|
208
|
+
children: (e) => /* @__PURE__ */ C("div", {
|
|
209
|
+
...h({
|
|
210
|
+
..._,
|
|
211
|
+
...l,
|
|
212
|
+
onMouseDown: v
|
|
213
|
+
}),
|
|
214
|
+
ref: g,
|
|
215
|
+
hidden: !u,
|
|
216
|
+
"data-state": u ? "open" : "closed",
|
|
217
|
+
"data-ui": "select-listbox",
|
|
218
|
+
style: {
|
|
219
|
+
...n,
|
|
220
|
+
...p
|
|
221
|
+
},
|
|
222
|
+
className: e,
|
|
223
|
+
children: /* @__PURE__ */ C(T, {
|
|
224
|
+
elementsRef: m,
|
|
225
|
+
children: /* @__PURE__ */ C(L.Provider, {
|
|
226
|
+
value: !0,
|
|
227
|
+
children: i
|
|
228
|
+
})
|
|
229
|
+
})
|
|
230
|
+
})
|
|
231
|
+
}) });
|
|
232
|
+
}
|
|
233
|
+
G.displayName = "Select.Content";
|
|
234
|
+
function K({ ref: e, value: n, disabled: r = !1, onClick: a, children: o, className: p, sx: m, ...h }) {
|
|
235
|
+
let { baseId: g, selectedValue: _, activeIndex: v, labelsRef: y, getItemProps: x, selectValue: S, registration: T } = z(), E = b(null), { ref: D, index: O } = l(n, T, E, (e, t) => ({
|
|
236
|
+
index: e,
|
|
237
|
+
label: t,
|
|
238
|
+
disabled: r
|
|
239
|
+
}), {
|
|
240
|
+
labelsRef: y,
|
|
241
|
+
include: !r
|
|
242
|
+
}), k = j([D, e]), A = O !== -1 && v === O, M = _ === n, N = (e) => {
|
|
243
|
+
a?.(e), !(r || e.defaultPrevented) && S(n);
|
|
244
|
+
};
|
|
245
|
+
return /* @__PURE__ */ C(t, {
|
|
246
|
+
className: p,
|
|
247
|
+
styles: [
|
|
248
|
+
u,
|
|
249
|
+
c,
|
|
250
|
+
s
|
|
251
|
+
],
|
|
252
|
+
sx: m,
|
|
253
|
+
children: (e) => /* @__PURE__ */ w("div", {
|
|
254
|
+
...x({
|
|
255
|
+
id: d(g, n),
|
|
256
|
+
...h,
|
|
257
|
+
onClick: N
|
|
258
|
+
}),
|
|
259
|
+
ref: k,
|
|
260
|
+
role: "option",
|
|
261
|
+
"aria-selected": M,
|
|
262
|
+
"aria-disabled": r || void 0,
|
|
263
|
+
"data-active": A || void 0,
|
|
264
|
+
"data-ui": "select-item",
|
|
265
|
+
className: e,
|
|
266
|
+
children: [/* @__PURE__ */ C("span", {
|
|
267
|
+
ref: E,
|
|
268
|
+
css: f,
|
|
269
|
+
children: o
|
|
270
|
+
}), M && /* @__PURE__ */ C("span", {
|
|
271
|
+
"aria-hidden": "true",
|
|
272
|
+
css: i,
|
|
273
|
+
children: F
|
|
274
|
+
})]
|
|
275
|
+
})
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
K.displayName = "Select.Item";
|
|
279
|
+
var q = Object.assign(H, {
|
|
280
|
+
Trigger: U,
|
|
281
|
+
Value: W,
|
|
282
|
+
Content: G,
|
|
283
|
+
Item: K
|
|
284
|
+
});
|
|
285
|
+
//#endregion
|
|
286
|
+
export { q as t };
|
package/dist/select.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Select } from "./select-
|
|
2
|
+
export { t as Select } from "./select-BCS0-LVW.js";
|