@jfrader/ui 0.1.1 → 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 +3 -1
- package/dist/accordion-CkOZ-tvs.js +178 -0
- package/dist/accordion.js +2 -1
- package/dist/alert-Dsjx14UW.js +131 -0
- package/dist/alert.js +2 -1
- package/dist/avatar-BRGKkoSr.js +127 -0
- package/dist/avatar.js +2 -1
- package/dist/badge-DLxUMsCx.js +104 -0
- package/dist/badge.js +2 -1
- package/dist/breadcrumbs-694hF_hm.js +131 -0
- package/dist/breadcrumbs.js +2 -1
- package/dist/button-CoaIcykB.js +190 -0
- package/dist/button.js +2 -1
- package/dist/calendar-Doj7PTdG.js +379 -0
- package/dist/calendar.js +2 -1
- package/dist/card-2IM71XZj.js +134 -0
- package/dist/card.js +2 -1
- package/dist/checkbox-B7xGNFzp.js +136 -0
- package/dist/checkbox.js +2 -1
- package/dist/{choice-control-DCyQ_hVw.js → choice-control-ByFogYcT.js} +2 -1
- package/dist/{collection-registry-C2jnQa7X.js → collection-registry-1l9f3XJZ.js} +3 -2
- package/dist/combobox-Bjhxv5U3.js +311 -0
- package/dist/combobox.js +2 -1
- package/dist/command-palette-BhJwm6cS.js +344 -0
- package/dist/command-palette.js +2 -1
- package/dist/container-BhnrGPu-.js +36 -0
- package/dist/container.js +2 -1
- package/dist/{css-CW_HG55W.js → css-Cgj6sCHn.js} +1 -0
- package/dist/date-picker-Jk8SpoiO.js +245 -0
- package/dist/date-picker.js +2 -1
- package/dist/dialog-fhS07G41.js +187 -0
- package/dist/dialog.js +2 -1
- package/dist/{disclosure-caret-BC6P8AsM.js → disclosure-caret-C5T3fcl6.js} +1 -0
- package/dist/divider-v_78HYF5.js +79 -0
- package/dist/divider.js +2 -1
- package/dist/{field-anatomy-DKkB268x.js → field-anatomy-BzGw1Ch9.js} +4 -3
- package/dist/flex-COZzFqI8.js +22 -0
- package/dist/flex.js +2 -1
- package/dist/{focus-ring-qOS3rPlM.js → focus-ring-BK5W5_NY.js} +1 -0
- package/dist/{icon-wrapper-BKo4FI-O.js → icon-wrapper-CFWzew5m.js} +2 -1
- package/dist/index.js +37 -36
- package/dist/kbd-CeP8Kfvp.js +61 -0
- package/dist/kbd.js +2 -1
- package/dist/{layout-style-B_6YHQ6Q.js → layout-style-7ZTOiWGR.js} +2 -1
- package/dist/{loading-ring-CTpT-IrT.js → loading-ring-BpdB0aFi.js} +2 -1
- package/dist/{media-8K3xDAxM.js → media-D_eA_I-e.js} +1 -0
- package/dist/menu-B6KCbLCr.js +196 -0
- package/dist/menu.js +2 -1
- package/dist/navigation-BDht6S2-.js +182 -0
- package/dist/navigation.js +2 -1
- package/dist/pagination-B50PCaDU.js +151 -0
- package/dist/pagination.js +2 -1
- package/dist/{part-id-Bg1LSlk7.js → part-id-D0zksy32.js} +1 -0
- package/dist/pill-2_XzBdkD.js +51 -0
- package/dist/pill.js +2 -1
- package/dist/popover-DRHbeIVq.js +103 -0
- package/dist/popover.js +2 -1
- package/dist/progress-CpsskKTD.js +85 -0
- package/dist/progress.js +2 -1
- package/dist/radio-group-DPI5KUCj.js +136 -0
- package/dist/radio-group.js +2 -1
- package/dist/{renderable-DwPvt1I8.js → renderable-DzcIj1Lo.js} +1 -0
- package/dist/{roving-focus-DeEZ55-T.js → roving-focus-CYlo_Kf8.js} +1 -0
- package/dist/select-C1xGrOhT.js +266 -0
- package/dist/select.js +2 -1
- package/dist/skeleton-DitdP-yz.js +49 -0
- package/dist/skeleton.js +2 -1
- package/dist/spinner-CFq5HPoo.js +51 -0
- package/dist/spinner.js +2 -1
- package/dist/stack-D_g6NJzo.js +21 -0
- package/dist/stack.js +2 -1
- package/dist/{surface-Bo_aSQOb.js → surface-DZ4d-2aL.js} +1 -0
- package/dist/switch-B5TTU-oJ.js +138 -0
- package/dist/switch.js +2 -1
- package/dist/tabs-C26PWl2c.js +183 -0
- package/dist/tabs.js +2 -1
- package/dist/text-field-8PQAqRpM.js +75 -0
- package/dist/text-field.js +2 -1
- package/dist/textarea-CcGWuntL.js +85 -0
- package/dist/textarea.js +2 -1
- package/dist/theme-root-BRLIA4eb.js +22 -0
- package/dist/theme-root.js +2 -1
- package/dist/toast-B1PXuwZ4.js +277 -0
- package/dist/toast.js +2 -1
- package/dist/toggle-group-N_owicT0.js +156 -0
- package/dist/toggle-group.js +2 -1
- package/dist/tooltip-BJPisf60.js +98 -0
- package/dist/tooltip.js +2 -1
- package/dist/{trigger-style-f54idgjT.js → trigger-style-B1GFmH7M.js} +2 -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/dist/{use-controlled-state-DQXkiTQI.js → use-controlled-state-CVXDa-qM.js} +1 -0
- package/dist/{use-native-dialog-BCp1chwO.js → use-native-dialog-DWpIUVO1.js} +1 -0
- package/dist/{use-overlay-floating-CsZd3qxa.js → use-overlay-floating-efeqppiw.js} +1 -0
- package/dist/{visually-hidden-BXVyhj0y.js → visually-hidden-DCWhf0Cb.js} +2 -1
- package/package.json +4 -4
- package/dist/accordion-Dl-kvgPQ.js +0 -168
- package/dist/alert-BzntPa_5.js +0 -129
- package/dist/avatar-Dk2ES3ru.js +0 -124
- package/dist/badge-DZefC7rm.js +0 -102
- package/dist/breadcrumbs-5MCZ_Jr3.js +0 -125
- package/dist/button-qy-50NPd.js +0 -187
- package/dist/calendar-DcCAiN3b.js +0 -372
- package/dist/card-L-Z_1vZN.js +0 -120
- package/dist/checkbox-B7em7B-6.js +0 -134
- package/dist/combobox-DQcXR94r.js +0 -301
- package/dist/command-palette-BRJ8A5De.js +0 -328
- package/dist/container-COHiEjI8.js +0 -34
- package/dist/date-picker-D1GwiRB9.js +0 -239
- package/dist/dialog-CYf9fCZO.js +0 -175
- package/dist/divider-bi7OgCI5.js +0 -76
- package/dist/flex-CDFDDaiu.js +0 -21
- package/dist/kbd-DpiJgDJ2.js +0 -55
- package/dist/menu-A9fZUaAG.js +0 -186
- package/dist/navigation-Cemnmc_J.js +0 -174
- package/dist/pagination-orCjUsn_.js +0 -148
- package/dist/pill-Dg2JJHHW.js +0 -49
- package/dist/popover-D_YU34WS.js +0 -97
- package/dist/progress-XdvBG0Vv.js +0 -83
- package/dist/radio-group-CxMJ2Vq7.js +0 -130
- package/dist/select-mwFbmzsn.js +0 -256
- package/dist/skeleton-qas9ZKK9.js +0 -47
- package/dist/spinner-ros2CfIf.js +0 -49
- package/dist/stack-Hs8THnIL.js +0 -20
- package/dist/switch-E375Bz4X.js +0 -135
- package/dist/tabs-CBwRiuul.js +0 -173
- package/dist/text-field-BlP8qGn_.js +0 -73
- package/dist/textarea-CUG26CH2.js +0 -83
- package/dist/theme-root-CrdzwfSo.js +0 -20
- package/dist/toast-D_dnqnn-.js +0 -270
- package/dist/toggle-group-B7gXCea8.js +0 -150
- package/dist/tooltip-BJ2hLV1b.js +0 -92
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { t as e } from "./css-Cgj6sCHn.js";
|
|
3
|
+
import { createContext as t, useContext as n } from "react";
|
|
4
|
+
import { vars as r } from "@jfrader/tokens/vars";
|
|
5
|
+
import { jsx as i } from "@emotion/react/jsx-runtime";
|
|
6
|
+
//#region src/components/card/card.tsx
|
|
7
|
+
var a = t(void 0);
|
|
8
|
+
function o(...e) {
|
|
9
|
+
return e.filter(Boolean).join(" ") || void 0;
|
|
10
|
+
}
|
|
11
|
+
var s = e({
|
|
12
|
+
boxSizing: "border-box",
|
|
13
|
+
minInlineSize: 0,
|
|
14
|
+
backgroundColor: r.color.surfaceRaised,
|
|
15
|
+
border: `1px solid ${r.color.border}`,
|
|
16
|
+
borderRadius: r.radius.lg,
|
|
17
|
+
paddingBlock: r.space[4],
|
|
18
|
+
paddingInline: r.space[5],
|
|
19
|
+
fontFamily: r.font.sans,
|
|
20
|
+
lineHeight: r.lineHeight.base,
|
|
21
|
+
color: r.color.text
|
|
22
|
+
}), c = {
|
|
23
|
+
flat: e({ boxShadow: "none" }),
|
|
24
|
+
raised: e({ boxShadow: r.shadow.raised })
|
|
25
|
+
}, l = e({
|
|
26
|
+
display: "grid",
|
|
27
|
+
gap: r.space[1],
|
|
28
|
+
marginBlockEnd: r.space[4]
|
|
29
|
+
}), u = e({
|
|
30
|
+
margin: 0,
|
|
31
|
+
fontSize: r.textSize.md,
|
|
32
|
+
fontWeight: r.fontWeight.semibold,
|
|
33
|
+
lineHeight: r.lineHeight.tight,
|
|
34
|
+
color: r.color.text
|
|
35
|
+
}), d = e({
|
|
36
|
+
margin: 0,
|
|
37
|
+
fontSize: r.textSize.sm,
|
|
38
|
+
color: r.color.textMuted
|
|
39
|
+
}), f = e({
|
|
40
|
+
fontSize: r.textSize.sm,
|
|
41
|
+
color: r.color.text
|
|
42
|
+
}), p = e({
|
|
43
|
+
display: "flex",
|
|
44
|
+
flexWrap: "wrap",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
justifyContent: "space-between",
|
|
47
|
+
gap: r.space[2],
|
|
48
|
+
marginBlockStart: r.space[4],
|
|
49
|
+
paddingBlockStart: r.space[4],
|
|
50
|
+
borderBlockStart: `1px solid ${r.color.borderSubtle}`,
|
|
51
|
+
"& > :only-child": { marginInlineStart: "auto" }
|
|
52
|
+
});
|
|
53
|
+
function m({ ref: e, variant: t = "raised", slotProps: n, className: r, ...l }) {
|
|
54
|
+
return /* @__PURE__ */ i(a.Provider, {
|
|
55
|
+
value: n,
|
|
56
|
+
children: /* @__PURE__ */ i("div", {
|
|
57
|
+
...l,
|
|
58
|
+
ref: e,
|
|
59
|
+
"data-ui": "card",
|
|
60
|
+
"data-variant": t,
|
|
61
|
+
className: o(n?.root?.className, r),
|
|
62
|
+
css: [
|
|
63
|
+
s,
|
|
64
|
+
c[t],
|
|
65
|
+
n?.root?.css
|
|
66
|
+
]
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
m.displayName = "Card";
|
|
71
|
+
function h({ ref: e, className: t, ...r }) {
|
|
72
|
+
let s = n(a)?.header;
|
|
73
|
+
return /* @__PURE__ */ i("div", {
|
|
74
|
+
...r,
|
|
75
|
+
ref: e,
|
|
76
|
+
"data-ui": "card-header",
|
|
77
|
+
className: o(s?.className, t),
|
|
78
|
+
css: [l, s?.css]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
h.displayName = "Card.Header";
|
|
82
|
+
function g({ ref: e, level: t = 3, className: r, ...s }) {
|
|
83
|
+
let c = n(a)?.title, l = `h${t}`;
|
|
84
|
+
return /* @__PURE__ */ i(l, {
|
|
85
|
+
...s,
|
|
86
|
+
ref: e,
|
|
87
|
+
"data-ui": "card-title",
|
|
88
|
+
className: o(c?.className, r),
|
|
89
|
+
css: [u, c?.css]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
g.displayName = "Card.Title";
|
|
93
|
+
function _({ ref: e, className: t, ...r }) {
|
|
94
|
+
let s = n(a)?.description;
|
|
95
|
+
return /* @__PURE__ */ i("p", {
|
|
96
|
+
...r,
|
|
97
|
+
ref: e,
|
|
98
|
+
"data-ui": "card-description",
|
|
99
|
+
className: o(s?.className, t),
|
|
100
|
+
css: [d, s?.css]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
_.displayName = "Card.Description";
|
|
104
|
+
function v({ ref: e, className: t, ...r }) {
|
|
105
|
+
let s = n(a)?.content;
|
|
106
|
+
return /* @__PURE__ */ i("div", {
|
|
107
|
+
...r,
|
|
108
|
+
ref: e,
|
|
109
|
+
"data-ui": "card-content",
|
|
110
|
+
className: o(s?.className, t),
|
|
111
|
+
css: [f, s?.css]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
v.displayName = "Card.Content";
|
|
115
|
+
function y({ ref: e, className: t, ...r }) {
|
|
116
|
+
let s = n(a)?.footer;
|
|
117
|
+
return /* @__PURE__ */ i("div", {
|
|
118
|
+
...r,
|
|
119
|
+
ref: e,
|
|
120
|
+
"data-ui": "card-footer",
|
|
121
|
+
className: o(s?.className, t),
|
|
122
|
+
css: [p, s?.css]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
y.displayName = "Card.Footer";
|
|
126
|
+
var b = Object.assign(m, {
|
|
127
|
+
Header: h,
|
|
128
|
+
Title: g,
|
|
129
|
+
Description: _,
|
|
130
|
+
Content: v,
|
|
131
|
+
Footer: y
|
|
132
|
+
});
|
|
133
|
+
//#endregion
|
|
134
|
+
export { b as t };
|
package/dist/card.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
export { t as Card } from "./card-2IM71XZj.js";
|
|
@@ -0,0 +1,136 @@
|
|
|
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 { i as r, n as i, r as a, t as o } from "./choice-control-ByFogYcT.js";
|
|
6
|
+
import { useEffect as s, useId as c, useImperativeHandle as l, useRef as u } from "react";
|
|
7
|
+
import { vars as d } from "@jfrader/tokens/vars";
|
|
8
|
+
import { jsx as f, jsxs as p } from "@emotion/react/jsx-runtime";
|
|
9
|
+
//#region src/components/checkbox/checkbox.tsx
|
|
10
|
+
var m = {
|
|
11
|
+
sm: "16px",
|
|
12
|
+
md: "20px"
|
|
13
|
+
}, h = e({
|
|
14
|
+
"input:checked + span svg": { opacity: 1 },
|
|
15
|
+
"&[data-indeterminate] input + span": {
|
|
16
|
+
backgroundColor: d.color.accent,
|
|
17
|
+
borderColor: d.color.accent
|
|
18
|
+
},
|
|
19
|
+
"&[data-indeterminate] input + span svg": { opacity: 1 }
|
|
20
|
+
}), g = e({
|
|
21
|
+
display: "inline-flex",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
justifyContent: "center",
|
|
24
|
+
flexShrink: 0,
|
|
25
|
+
boxSizing: "border-box",
|
|
26
|
+
border: `1px solid ${d.color.borderControl}`,
|
|
27
|
+
borderRadius: d.radius.sm,
|
|
28
|
+
backgroundColor: d.color.surfaceRaised,
|
|
29
|
+
color: d.color.accentContrast,
|
|
30
|
+
transitionProperty: "background-color, border-color",
|
|
31
|
+
transitionDuration: d.motion.duration.fast,
|
|
32
|
+
transitionTimingFunction: d.motion.easeStandard,
|
|
33
|
+
"& svg": {
|
|
34
|
+
inlineSize: "75%",
|
|
35
|
+
blockSize: "75%",
|
|
36
|
+
opacity: 0
|
|
37
|
+
},
|
|
38
|
+
[t]: { transitionDuration: "0s" }
|
|
39
|
+
}), _ = {
|
|
40
|
+
sm: e({
|
|
41
|
+
inlineSize: m.sm,
|
|
42
|
+
blockSize: m.sm
|
|
43
|
+
}),
|
|
44
|
+
md: e({
|
|
45
|
+
inlineSize: m.md,
|
|
46
|
+
blockSize: m.md
|
|
47
|
+
})
|
|
48
|
+
}, v = {
|
|
49
|
+
sm: e({ fontSize: d.textSize.sm }),
|
|
50
|
+
md: e({ fontSize: d.textSize.md })
|
|
51
|
+
}, y = e({
|
|
52
|
+
fontSize: d.textSize.sm,
|
|
53
|
+
color: d.color.textMuted
|
|
54
|
+
}), b = {
|
|
55
|
+
sm: e({ marginInlineStart: `calc(${m.sm} + ${d.space[2]})` }),
|
|
56
|
+
md: e({ marginInlineStart: `calc(${m.md} + ${d.space[2]})` })
|
|
57
|
+
};
|
|
58
|
+
function x({ indeterminate: e }) {
|
|
59
|
+
return /* @__PURE__ */ f("svg", {
|
|
60
|
+
viewBox: "0 0 16 16",
|
|
61
|
+
fill: "none",
|
|
62
|
+
stroke: "currentColor",
|
|
63
|
+
strokeWidth: "2",
|
|
64
|
+
strokeLinecap: "round",
|
|
65
|
+
strokeLinejoin: "round",
|
|
66
|
+
children: e ? /* @__PURE__ */ f("line", {
|
|
67
|
+
x1: "4",
|
|
68
|
+
y1: "8",
|
|
69
|
+
x2: "12",
|
|
70
|
+
y2: "8"
|
|
71
|
+
}) : /* @__PURE__ */ f("polyline", { points: "3.5 8.5 6.5 11.5 12.5 4.5" })
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function S({ ref: e, label: t, description: d, indeterminate: m = !1, size: S = "md", onChange: C, onCheckedChange: w, slotProps: T, className: E, "aria-labelledby": D, "aria-describedby": O, ...k }) {
|
|
75
|
+
let A = u(null);
|
|
76
|
+
l(e, () => A.current, []), s(() => {
|
|
77
|
+
A.current && (A.current.indeterminate = m);
|
|
78
|
+
}, [m]);
|
|
79
|
+
let j = c(), M = `${j}-label`, N = `${j}-description`, P = n(t), F = n(d), I = [D, P && M].filter(Boolean).join(" ") || void 0, L = [O, F && N].filter(Boolean).join(" ") || void 0, R = [E, T?.root?.className].filter(Boolean).join(" ") || void 0, z = (e) => {
|
|
80
|
+
m && (e.currentTarget.indeterminate = !0), C?.(e), w?.(e.currentTarget.checked);
|
|
81
|
+
};
|
|
82
|
+
return /* @__PURE__ */ p("label", {
|
|
83
|
+
"data-ui": "checkbox",
|
|
84
|
+
"data-indeterminate": m || void 0,
|
|
85
|
+
className: R,
|
|
86
|
+
css: [
|
|
87
|
+
a,
|
|
88
|
+
h,
|
|
89
|
+
i,
|
|
90
|
+
T?.root?.css
|
|
91
|
+
],
|
|
92
|
+
children: [/* @__PURE__ */ p("span", {
|
|
93
|
+
css: r,
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ f("input", {
|
|
96
|
+
...k,
|
|
97
|
+
ref: A,
|
|
98
|
+
type: "checkbox",
|
|
99
|
+
"aria-labelledby": I,
|
|
100
|
+
"aria-describedby": L,
|
|
101
|
+
"aria-checked": m ? "mixed" : void 0,
|
|
102
|
+
onChange: z,
|
|
103
|
+
css: o
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ f("span", {
|
|
106
|
+
"aria-hidden": "true",
|
|
107
|
+
className: T?.control?.className,
|
|
108
|
+
css: [
|
|
109
|
+
g,
|
|
110
|
+
_[S],
|
|
111
|
+
T?.control?.css
|
|
112
|
+
],
|
|
113
|
+
children: /* @__PURE__ */ f(x, { indeterminate: m })
|
|
114
|
+
}),
|
|
115
|
+
P && /* @__PURE__ */ f("span", {
|
|
116
|
+
id: M,
|
|
117
|
+
className: T?.label?.className,
|
|
118
|
+
css: [v[S], T?.label?.css],
|
|
119
|
+
children: t
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
}), F && /* @__PURE__ */ f("span", {
|
|
123
|
+
id: N,
|
|
124
|
+
className: T?.description?.className,
|
|
125
|
+
css: [
|
|
126
|
+
y,
|
|
127
|
+
b[S],
|
|
128
|
+
T?.description?.css
|
|
129
|
+
],
|
|
130
|
+
children: d
|
|
131
|
+
})]
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
S.displayName = "Checkbox";
|
|
135
|
+
//#endregion
|
|
136
|
+
export { S as t };
|
package/dist/checkbox.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
export { t as Checkbox } from "./checkbox-B7xGNFzp.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { t } from "./
|
|
1
|
+
'use client';
|
|
2
|
+
import { t as e } from "./css-Cgj6sCHn.js";
|
|
3
|
+
import { t } from "./part-id-D0zksy32.js";
|
|
3
4
|
import { useCallback as n, useLayoutEffect as r, useMemo as i, useState as a } from "react";
|
|
4
5
|
import { vars as o } from "@jfrader/tokens/vars";
|
|
5
6
|
import { useListItem as s } from "@floating-ui/react";
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { t as e } from "./css-Cgj6sCHn.js";
|
|
3
|
+
import { n as t, t as n } from "./use-controlled-state-CVXDa-qM.js";
|
|
4
|
+
import { t as r } from "./renderable-DzcIj1Lo.js";
|
|
5
|
+
import { a as i, c as a, d as o, f as s, l as c, o as l, r as u, s as d, t as f, u as p } from "./collection-registry-1l9f3XJZ.js";
|
|
6
|
+
import { t as m } from "./use-overlay-floating-efeqppiw.js";
|
|
7
|
+
import { t as h } from "./text-field-8PQAqRpM.js";
|
|
8
|
+
import { createContext as g, useCallback as _, useContext as v, useId as y, useLayoutEffect as b, useMemo as x, useRef as S, useState as C } from "react";
|
|
9
|
+
import { vars as w } from "@jfrader/tokens/vars";
|
|
10
|
+
import { jsx as T, jsxs as E } from "@emotion/react/jsx-runtime";
|
|
11
|
+
import { FloatingList as D, FloatingPortal as O, useDismiss as k, useInteractions as ee, useListNavigation as A, useMergeRefs as j } from "@floating-ui/react";
|
|
12
|
+
//#region src/components/combobox/combobox.tsx
|
|
13
|
+
var M = "bottom-start", N = "✓", P = "No results", te = (e, t) => e.toLocaleLowerCase().includes(t.toLocaleLowerCase()), F = g(null), I = g(!1);
|
|
14
|
+
function L(e) {
|
|
15
|
+
let t = v(F);
|
|
16
|
+
if (!t) throw Error(`Combobox.${e} must be rendered inside <Combobox>.`);
|
|
17
|
+
return t;
|
|
18
|
+
}
|
|
19
|
+
function R(e) {
|
|
20
|
+
let t = L(e);
|
|
21
|
+
if (!v(I)) throw Error(`Combobox.${e} must be rendered inside <Combobox.List>.`);
|
|
22
|
+
return t;
|
|
23
|
+
}
|
|
24
|
+
var z = e({ "&[hidden]": { display: "none" } }), B = e({
|
|
25
|
+
paddingBlock: w.space[1],
|
|
26
|
+
paddingInline: w.space[2],
|
|
27
|
+
fontSize: w.textSize.sm,
|
|
28
|
+
color: w.color.textMuted
|
|
29
|
+
});
|
|
30
|
+
function V({ value: e, defaultValue: r, onValueChange: a, open: o, defaultOpen: s = !1, onOpenChange: c, name: l, filter: u = te, onInputChange: d, children: f }) {
|
|
31
|
+
let p = y(), [h, g] = C(`${p}-listbox`), [v, b] = C(!1), [w = null, D] = n(e, r ?? null, a), [O = !1, j] = n(o, s, c), [N, P] = C(null), [I, L] = C(""), [R, z] = i(), [B, V] = C(null), H = S([]), U = S(null), W = t(d), G = _((e, t) => t === "" || u(e, t), [u]), { valuesByIndex: K, skippedIndices: q, matchCount: J } = x(() => {
|
|
32
|
+
let e = [], t = /* @__PURE__ */ new Set(), n = 0;
|
|
33
|
+
return R.forEach((r, i) => {
|
|
34
|
+
if (r.index === -1) return;
|
|
35
|
+
e[r.index] = i;
|
|
36
|
+
let a = G(r.label, I);
|
|
37
|
+
a && (n += 1), (r.disabled || !a) && t.add(r.index);
|
|
38
|
+
}), {
|
|
39
|
+
valuesByIndex: e,
|
|
40
|
+
skippedIndices: t,
|
|
41
|
+
matchCount: n
|
|
42
|
+
};
|
|
43
|
+
}, [
|
|
44
|
+
R,
|
|
45
|
+
I,
|
|
46
|
+
G
|
|
47
|
+
]), { refs: Y, floatingStyles: X, context: Z } = m({
|
|
48
|
+
open: O,
|
|
49
|
+
placement: M,
|
|
50
|
+
onOpenChange: (e) => j(e)
|
|
51
|
+
}), ne = k(Z, {
|
|
52
|
+
escapeKey: !0,
|
|
53
|
+
outsidePress: !0
|
|
54
|
+
}), re = A(Z, {
|
|
55
|
+
listRef: H,
|
|
56
|
+
activeIndex: N,
|
|
57
|
+
onNavigate: P,
|
|
58
|
+
virtual: !0,
|
|
59
|
+
loop: !0,
|
|
60
|
+
disabledIndices: (e) => q.has(e)
|
|
61
|
+
}), { getReferenceProps: Q, getFloatingProps: $, getItemProps: ie } = ee([ne, re]), ae = x(() => {
|
|
62
|
+
let e = (e) => {
|
|
63
|
+
D(e), j(!1), U.current?.commitLabel(R.get(e)?.label ?? "");
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
baseId: p,
|
|
67
|
+
listId: h,
|
|
68
|
+
setListId: g,
|
|
69
|
+
setInputDisabled: b,
|
|
70
|
+
open: O,
|
|
71
|
+
selectedValue: w,
|
|
72
|
+
activeIndex: N,
|
|
73
|
+
options: R,
|
|
74
|
+
matchCount: J,
|
|
75
|
+
inputLabelling: B,
|
|
76
|
+
inputHandleRef: U,
|
|
77
|
+
refs: Y,
|
|
78
|
+
floatingStyles: X,
|
|
79
|
+
elementsRef: H,
|
|
80
|
+
getReferenceProps: Q,
|
|
81
|
+
getFloatingProps: $,
|
|
82
|
+
getItemProps: ie,
|
|
83
|
+
onInputChange: W,
|
|
84
|
+
isVisible: (e) => G(e, I),
|
|
85
|
+
findMatches: (e) => {
|
|
86
|
+
let t = 0, n = null, r = null;
|
|
87
|
+
return R.forEach((i) => {
|
|
88
|
+
i.index !== -1 && G(i.label, e) && (t += 1, !i.disabled && ((n === null || i.index < n) && (n = i.index), (r === null || i.index > r) && (r = i.index)));
|
|
89
|
+
}), {
|
|
90
|
+
count: t,
|
|
91
|
+
first: n,
|
|
92
|
+
last: r
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
setQuery: L,
|
|
96
|
+
setActiveIndex: P,
|
|
97
|
+
selectValue: e,
|
|
98
|
+
selectIndex: (t) => {
|
|
99
|
+
let n = K[t];
|
|
100
|
+
n === void 0 || q.has(t) || e(n);
|
|
101
|
+
},
|
|
102
|
+
clearValue: () => D(null),
|
|
103
|
+
requestOpenChange: j,
|
|
104
|
+
registration: z,
|
|
105
|
+
setInputLabelling: V
|
|
106
|
+
};
|
|
107
|
+
}, [
|
|
108
|
+
p,
|
|
109
|
+
h,
|
|
110
|
+
O,
|
|
111
|
+
w,
|
|
112
|
+
N,
|
|
113
|
+
R,
|
|
114
|
+
I,
|
|
115
|
+
J,
|
|
116
|
+
B,
|
|
117
|
+
Y,
|
|
118
|
+
X,
|
|
119
|
+
Q,
|
|
120
|
+
$,
|
|
121
|
+
ie,
|
|
122
|
+
W,
|
|
123
|
+
G,
|
|
124
|
+
K,
|
|
125
|
+
q,
|
|
126
|
+
D,
|
|
127
|
+
j,
|
|
128
|
+
z
|
|
129
|
+
]);
|
|
130
|
+
return /* @__PURE__ */ E(F.Provider, {
|
|
131
|
+
value: ae,
|
|
132
|
+
children: [f, l !== void 0 && /* @__PURE__ */ T("input", {
|
|
133
|
+
type: "hidden",
|
|
134
|
+
name: l,
|
|
135
|
+
value: w ?? "",
|
|
136
|
+
disabled: v
|
|
137
|
+
})]
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
V.displayName = "Combobox";
|
|
141
|
+
function H({ ref: e, inputValue: t, defaultInputValue: i, label: a, description: o, error: s, size: c, slotProps: l, className: u, id: d, onChange: f, onKeyDown: p, onBlur: m, disabled: g = !1, ..._ }) {
|
|
142
|
+
let { listId: v, open: x, selectedValue: S, activeIndex: w, options: E, inputHandleRef: D, refs: O, getReferenceProps: k, onInputChange: ee, findMatches: A, setQuery: M, setActiveIndex: N, selectIndex: P, clearValue: te, requestOpenChange: F, setInputLabelling: I, setInputDisabled: R } = L("Input"), z = j([O.setReference, e]), B = y(), V = d ?? B, H = `${V}-label`, U = r(a), W = _["aria-labelledby"], G = _["aria-label"], [K, q] = C(i), [J, Y] = C(() => (t ?? i) !== void 0), X = S === null ? void 0 : E.get(S)?.label, Z = t ?? (J ? K ?? "" : X ?? K ?? ""), [, ne] = n(Z, void 0, ee), re = (e) => {
|
|
143
|
+
ne(e), t === void 0 && q(e);
|
|
144
|
+
}, Q = t !== void 0 || J ? Z : "", $ = (e) => {
|
|
145
|
+
Y(!1), re(e);
|
|
146
|
+
};
|
|
147
|
+
b(() => {
|
|
148
|
+
M(Q);
|
|
149
|
+
}, [Q, M]), b(() => (R(g), () => R(!1)), [g, R]), b(() => (D.current = { commitLabel: $ }, () => {
|
|
150
|
+
D.current = null;
|
|
151
|
+
})), b(() => (I(W !== void 0 || !U ? {
|
|
152
|
+
labelledBy: W,
|
|
153
|
+
label: G
|
|
154
|
+
} : { labelledBy: H }), () => I(null)), [
|
|
155
|
+
W,
|
|
156
|
+
G,
|
|
157
|
+
U,
|
|
158
|
+
H,
|
|
159
|
+
I
|
|
160
|
+
]);
|
|
161
|
+
let ie = (e) => {
|
|
162
|
+
f?.(e);
|
|
163
|
+
let n = e.currentTarget.value;
|
|
164
|
+
Y(!0), re(n), n === "" && te();
|
|
165
|
+
let r = t ?? n;
|
|
166
|
+
if (r === "") {
|
|
167
|
+
N(null), F(!1);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
let i = A(r);
|
|
171
|
+
N(i.first), i.count > 0 && F(!0);
|
|
172
|
+
}, ae = (e) => {
|
|
173
|
+
if (p?.(e), !e.defaultPrevented) {
|
|
174
|
+
if (e.key === "Escape") J && X !== void 0 && $(X);
|
|
175
|
+
else if (x) {
|
|
176
|
+
if (e.key === "Enter" && w !== null) e.preventDefault(), P(w);
|
|
177
|
+
else if (e.key === "Home" || e.key === "End") {
|
|
178
|
+
let t = A(Q), n = e.key === "Home" ? t.first : t.last;
|
|
179
|
+
if (n === null) return;
|
|
180
|
+
e.preventDefault(), N(n);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}, oe = (e) => {
|
|
185
|
+
m?.(e), x && F(!1);
|
|
186
|
+
};
|
|
187
|
+
return /* @__PURE__ */ T(h, {
|
|
188
|
+
...k({
|
|
189
|
+
..._,
|
|
190
|
+
onKeyDown: ae,
|
|
191
|
+
onBlur: oe
|
|
192
|
+
}),
|
|
193
|
+
ref: z,
|
|
194
|
+
id: V,
|
|
195
|
+
label: U ? /* @__PURE__ */ T("span", {
|
|
196
|
+
id: H,
|
|
197
|
+
children: a
|
|
198
|
+
}) : a,
|
|
199
|
+
description: o,
|
|
200
|
+
error: s,
|
|
201
|
+
size: c,
|
|
202
|
+
slotProps: l,
|
|
203
|
+
className: u,
|
|
204
|
+
value: Z,
|
|
205
|
+
disabled: g,
|
|
206
|
+
onChange: ie,
|
|
207
|
+
role: "combobox",
|
|
208
|
+
autoComplete: "off",
|
|
209
|
+
"aria-autocomplete": "list",
|
|
210
|
+
"aria-expanded": x,
|
|
211
|
+
"aria-controls": x ? v : void 0,
|
|
212
|
+
"data-state": x ? "open" : "closed",
|
|
213
|
+
"data-ui": "combobox-input"
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
H.displayName = "Combobox.Input";
|
|
217
|
+
function U({ ref: e, id: t, style: n, onMouseDown: r, children: i, ...a }) {
|
|
218
|
+
let { baseId: c, setListId: l, open: u, inputLabelling: d, refs: f, floatingStyles: p, elementsRef: m, getFloatingProps: h } = L("List"), g = t ?? `${c}-listbox`;
|
|
219
|
+
b(() => (l(g), () => l(`${c}-listbox`)), [
|
|
220
|
+
c,
|
|
221
|
+
g,
|
|
222
|
+
l
|
|
223
|
+
]);
|
|
224
|
+
let _ = j([u ? f.setFloating : null, e]), v = a["aria-labelledby"] !== void 0 || a["aria-label"] !== void 0 ? {} : d?.labelledBy === void 0 ? { "aria-label": d?.label } : { "aria-labelledby": d.labelledBy }, y = (e) => {
|
|
225
|
+
r?.(e), e.preventDefault();
|
|
226
|
+
};
|
|
227
|
+
return /* @__PURE__ */ T(O, { children: /* @__PURE__ */ T("div", {
|
|
228
|
+
...h({
|
|
229
|
+
id: g,
|
|
230
|
+
...v,
|
|
231
|
+
...a,
|
|
232
|
+
onMouseDown: y
|
|
233
|
+
}),
|
|
234
|
+
ref: _,
|
|
235
|
+
role: "listbox",
|
|
236
|
+
hidden: !u,
|
|
237
|
+
"data-state": u ? "open" : "closed",
|
|
238
|
+
"data-ui": "combobox-list",
|
|
239
|
+
style: {
|
|
240
|
+
...n,
|
|
241
|
+
...p
|
|
242
|
+
},
|
|
243
|
+
css: [s, o],
|
|
244
|
+
children: /* @__PURE__ */ T(D, {
|
|
245
|
+
elementsRef: m,
|
|
246
|
+
children: /* @__PURE__ */ T(I.Provider, {
|
|
247
|
+
value: !0,
|
|
248
|
+
children: i
|
|
249
|
+
})
|
|
250
|
+
})
|
|
251
|
+
}) });
|
|
252
|
+
}
|
|
253
|
+
U.displayName = "Combobox.List";
|
|
254
|
+
function W({ ref: e, value: t, disabled: n = !1, onClick: r, children: i, ...o }) {
|
|
255
|
+
let { baseId: s, selectedValue: m, activeIndex: h, options: g, isVisible: _, getItemProps: v, selectValue: y, registration: b } = R("Item"), x = S(null), { ref: C, index: w } = u(t, b, x, (e, t) => ({
|
|
256
|
+
index: e,
|
|
257
|
+
label: t,
|
|
258
|
+
disabled: n
|
|
259
|
+
})), D = j([C, e]), O = g.get(t)?.label, k = O !== void 0 && !_(O), ee = w !== -1 && h === w, A = m === t, M = (e) => {
|
|
260
|
+
r?.(e), !(n || e.defaultPrevented) && y(t);
|
|
261
|
+
};
|
|
262
|
+
return /* @__PURE__ */ E("div", {
|
|
263
|
+
...v({
|
|
264
|
+
id: f(s, t),
|
|
265
|
+
...o,
|
|
266
|
+
onClick: M
|
|
267
|
+
}),
|
|
268
|
+
ref: D,
|
|
269
|
+
role: "option",
|
|
270
|
+
hidden: k,
|
|
271
|
+
"aria-selected": A,
|
|
272
|
+
"aria-disabled": n || void 0,
|
|
273
|
+
"data-active": ee || void 0,
|
|
274
|
+
"data-ui": "combobox-item",
|
|
275
|
+
css: [
|
|
276
|
+
d,
|
|
277
|
+
l,
|
|
278
|
+
c,
|
|
279
|
+
z
|
|
280
|
+
],
|
|
281
|
+
children: [/* @__PURE__ */ T("span", {
|
|
282
|
+
ref: x,
|
|
283
|
+
css: p,
|
|
284
|
+
children: i
|
|
285
|
+
}), A && /* @__PURE__ */ T("span", {
|
|
286
|
+
"aria-hidden": "true",
|
|
287
|
+
css: a,
|
|
288
|
+
children: N
|
|
289
|
+
})]
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
W.displayName = "Combobox.Item";
|
|
293
|
+
function G({ ref: e, children: t, ...n }) {
|
|
294
|
+
let { matchCount: i } = R("Empty");
|
|
295
|
+
return i > 0 ? null : /* @__PURE__ */ T("div", {
|
|
296
|
+
...n,
|
|
297
|
+
ref: e,
|
|
298
|
+
"data-ui": "combobox-empty",
|
|
299
|
+
css: B,
|
|
300
|
+
children: r(t) ? t : P
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
G.displayName = "Combobox.Empty";
|
|
304
|
+
var K = Object.assign(V, {
|
|
305
|
+
Input: H,
|
|
306
|
+
List: U,
|
|
307
|
+
Item: W,
|
|
308
|
+
Empty: G
|
|
309
|
+
});
|
|
310
|
+
//#endregion
|
|
311
|
+
export { K as t };
|
package/dist/combobox.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
export { t as Combobox } from "./combobox-Bjhxv5U3.js";
|