@jfrader/ui 0.1.2 → 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/README.md +1 -1
- package/dist/accordion-Bd-j04hW.js +198 -0
- package/dist/accordion.js +1 -1
- package/dist/{alert-CA9ZlIZp.js → alert-BBqaKI4k.js} +57 -52
- package/dist/alert.js +1 -1
- package/dist/{avatar-IUW4yJl0.js → avatar-BahDVO9t.js} +40 -33
- package/dist/avatar.js +1 -1
- package/dist/{badge-Bru30HEn.js → badge-B_sLygxU.js} +32 -27
- package/dist/badge.js +1 -1
- package/dist/breadcrumbs-DVAOxfvL.js +141 -0
- package/dist/breadcrumbs.js +1 -1
- package/dist/{button-Cmixur4Q.js → button-P2e7_44z.js} +65 -53
- 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-DrHJMt2p.js → date-picker-ClUYBIBh.js} +69 -59
- 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-B03_qIwQ.js → kbd-C3ACoMoE.js} +36 -21
- 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-CrVqffKM.js → pill-DO2gHzMb.js} +16 -10
- 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-gJ4ImO5u.js → skeleton-OoFlOEXO.js} +24 -18
- 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-2hm2WnWt.js → switch-Dr-qjmT4.js} +63 -57
- 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-D60ok14S.js +76 -0
- package/dist/text-field.js +1 -1
- package/dist/textarea-DyfjtP0A.js +86 -0
- package/dist/textarea.js +1 -1
- package/dist/theme-root-BiXXvQvr.js +42 -0
- package/dist/theme-root.js +1 -1
- package/dist/{toast-D3Y6OAsg.js → toast-iqelR-r0.js} +41 -30
- 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 +14 -9
- package/dist/types/components/alert/alert.d.ts +7 -3
- package/dist/types/components/avatar/avatar.d.ts +7 -3
- package/dist/types/components/badge/badge.d.ts +7 -3
- package/dist/types/components/breadcrumbs/breadcrumbs.d.ts +9 -5
- package/dist/types/components/button/button.d.ts +7 -3
- package/dist/types/components/calendar/calendar.d.ts +12 -7
- package/dist/types/components/card/card.d.ts +21 -13
- package/dist/types/components/checkbox/checkbox.d.ts +7 -3
- package/dist/types/components/combobox/combobox.d.ts +13 -8
- package/dist/types/components/command-palette/command-palette.d.ts +23 -15
- package/dist/types/components/container/container.d.ts +7 -3
- package/dist/types/components/date-picker/date-picker.d.ts +7 -4
- package/dist/types/components/dialog/dialog.d.ts +17 -11
- package/dist/types/components/divider/divider.d.ts +7 -3
- package/dist/types/components/field/field-anatomy.d.ts +3 -2
- package/dist/types/components/flex/flex.d.ts +7 -3
- package/dist/types/components/kbd/kbd.d.ts +9 -5
- package/dist/types/components/menu/menu.d.ts +14 -9
- package/dist/types/components/navigation/navigation.d.ts +12 -7
- package/dist/types/components/pagination/pagination.d.ts +7 -3
- package/dist/types/components/pill/pill.d.ts +7 -3
- package/dist/types/components/popover/popover.d.ts +8 -5
- package/dist/types/components/progress/progress.d.ts +7 -3
- package/dist/types/components/radio-group/radio-group.d.ts +9 -5
- package/dist/types/components/select/select.d.ts +14 -9
- package/dist/types/components/skeleton/skeleton.d.ts +7 -3
- package/dist/types/components/spinner/spinner.d.ts +7 -3
- package/dist/types/components/stack/stack.d.ts +4 -1
- package/dist/types/components/switch/switch.d.ts +7 -3
- package/dist/types/components/tabs/tabs.d.ts +15 -9
- package/dist/types/components/text-field/text-field.d.ts +7 -3
- package/dist/types/components/textarea/textarea.d.ts +7 -3
- package/dist/types/components/theme-provider/theme-provider.d.ts +11 -0
- package/dist/types/components/theme-root/theme-root.d.ts +7 -3
- package/dist/types/components/toast/toast.d.ts +7 -4
- package/dist/types/components/toggle-group/toggle-group.d.ts +8 -5
- package/dist/types/components/tooltip/tooltip.d.ts +8 -5
- package/dist/types/index.d.ts +4 -0
- package/dist/types/overlay/use-native-dialog.d.ts +2 -2
- 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 +5 -4
- package/dist/accordion-C3YbYFBi.js +0 -169
- package/dist/breadcrumbs-CQaviWRc.js +0 -126
- package/dist/calendar-DUgS0xmp.js +0 -373
- package/dist/card-D9CHtouU.js +0 -121
- package/dist/checkbox-DKa5BCdy.js +0 -135
- package/dist/combobox-Dq3V88Zt.js +0 -302
- package/dist/command-palette-6c158eH1.js +0 -329
- package/dist/container-xUEIoZzj.js +0 -35
- package/dist/css-Cgj6sCHn.js +0 -2
- package/dist/dialog-C2NSOOP-.js +0 -176
- package/dist/divider-yF5EmhhT.js +0 -77
- package/dist/field-anatomy-BzGw1Ch9.js +0 -105
- package/dist/flex-5-NI5SSy.js +0 -22
- package/dist/menu-bvKRJOhJ.js +0 -187
- package/dist/navigation-xPoqh_Iz.js +0 -175
- package/dist/pagination-BIKYsxK1.js +0 -149
- package/dist/popover-CVAZ_C1a.js +0 -98
- package/dist/progress-C8bgujFI.js +0 -84
- package/dist/radio-group-CvQ4x8ii.js +0 -131
- package/dist/select-CNNiUhKB.js +0 -257
- package/dist/spinner-CSFiP0Oi.js +0 -50
- package/dist/stack-mEAryjKz.js +0 -21
- package/dist/tabs-GBppQabg.js +0 -174
- package/dist/text-field-DDPqQu29.js +0 -74
- package/dist/textarea-OP8_3IUR.js +0 -84
- package/dist/theme-root-eLka0ZP1.js +0 -21
- package/dist/toggle-group-BxzJ-6Cp.js +0 -151
- package/dist/tooltip-CVl8HS4S.js +0 -93
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { t as n } from "./focus-ring-BK5W5_NY.js";
|
|
4
|
+
import { t as r } from "./use-controlled-state-CVXDa-qM.js";
|
|
5
|
+
import { t as i } from "./visually-hidden-BJdvqqvn.js";
|
|
6
|
+
import { t as a } from "./renderable-DzcIj1Lo.js";
|
|
7
|
+
import { a as o, r as s, s as c, t as l } from "./collection-registry-BTYi6zGh.js";
|
|
8
|
+
import { t as u } from "./trigger-style-B1KVC8O1.js";
|
|
9
|
+
import { i as d, r as f, t as p } from "./use-native-dialog-DWpIUVO1.js";
|
|
10
|
+
import { n as m, t as h } from "./surface-DZ4d-2aL.js";
|
|
11
|
+
import { createContext as g, useCallback as _, useContext as v, useId as y, useMemo as b, useRef as x, useState as S } from "react";
|
|
12
|
+
import { vars as C } from "@jfrader/tokens/vars";
|
|
13
|
+
import { jsx as w, jsxs as T } from "@emotion/react/jsx-runtime";
|
|
14
|
+
import { FloatingList as E, useFloatingRootContext as D, useInteractions as O, useListNavigation as ee, useMergeRefs as k } from "@floating-ui/react";
|
|
15
|
+
//#region src/components/command-palette/command-palette.styles.ts
|
|
16
|
+
var A = e({
|
|
17
|
+
...h,
|
|
18
|
+
marginBlockStart: C.space[12]
|
|
19
|
+
}), j = e({
|
|
20
|
+
...m,
|
|
21
|
+
display: "flex",
|
|
22
|
+
flexDirection: "column",
|
|
23
|
+
borderRadius: C.radius.lg,
|
|
24
|
+
boxShadow: C.shadow.floating,
|
|
25
|
+
inlineSize: "min(560px, calc(100vw - 32px))"
|
|
26
|
+
}), M = e({
|
|
27
|
+
boxSizing: "border-box",
|
|
28
|
+
inlineSize: "100%",
|
|
29
|
+
blockSize: "48px",
|
|
30
|
+
margin: 0,
|
|
31
|
+
border: 0,
|
|
32
|
+
borderBlockEnd: `1px solid ${C.color.borderControl}`,
|
|
33
|
+
borderStartStartRadius: C.radius.lg,
|
|
34
|
+
borderStartEndRadius: C.radius.lg,
|
|
35
|
+
backgroundColor: "transparent",
|
|
36
|
+
paddingInline: C.space[4],
|
|
37
|
+
font: "inherit",
|
|
38
|
+
fontSize: C.textSize.md,
|
|
39
|
+
color: C.color.text,
|
|
40
|
+
"&::placeholder": { color: C.color.textSubtle },
|
|
41
|
+
"&:focus-visible": { ...n }
|
|
42
|
+
}), N = e({
|
|
43
|
+
boxSizing: "border-box",
|
|
44
|
+
display: "flex",
|
|
45
|
+
flexDirection: "column",
|
|
46
|
+
maxBlockSize: "320px",
|
|
47
|
+
overflow: "auto",
|
|
48
|
+
padding: C.space[1],
|
|
49
|
+
"&[hidden]": { display: "none" }
|
|
50
|
+
}), P = e({
|
|
51
|
+
display: "flex",
|
|
52
|
+
flexDirection: "column",
|
|
53
|
+
"&[hidden]": { display: "none" }
|
|
54
|
+
}), F = e({
|
|
55
|
+
paddingBlock: C.space[1],
|
|
56
|
+
paddingInline: C.space[2],
|
|
57
|
+
fontSize: C.textSize.xs,
|
|
58
|
+
fontWeight: C.fontWeight.medium,
|
|
59
|
+
color: C.color.textMuted
|
|
60
|
+
}), te = e({
|
|
61
|
+
"&:hover, &[data-active]": { backgroundColor: C.color.surfaceHover },
|
|
62
|
+
"&[hidden]": { display: "none" }
|
|
63
|
+
}), I = e({
|
|
64
|
+
paddingBlock: C.space[6],
|
|
65
|
+
paddingInline: C.space[4],
|
|
66
|
+
textAlign: "center",
|
|
67
|
+
fontSize: C.textSize.sm,
|
|
68
|
+
color: C.color.textMuted
|
|
69
|
+
}), ne = "Command palette", re = "No results", L = new Intl.PluralRules("en"), ie = (e, t) => e.toLocaleLowerCase().includes(t.toLocaleLowerCase()), ae = (e) => `${e} ${L.select(e) === "one" ? "result" : "results"}`, R = g(null), z = g(null);
|
|
70
|
+
function B(e) {
|
|
71
|
+
let t = v(R);
|
|
72
|
+
if (!t) throw Error(`CommandPalette.${e} must be rendered inside <CommandPalette>.`);
|
|
73
|
+
return t;
|
|
74
|
+
}
|
|
75
|
+
var V = (e) => {
|
|
76
|
+
e?.setAttribute("autofocus", "");
|
|
77
|
+
};
|
|
78
|
+
function H({ open: e, defaultOpen: t = !1, onOpenChange: n, label: i = ne, filter: a = ie, emptyMessage: s = re, formatResultCount: c = ae, children: l }) {
|
|
79
|
+
let u = y(), [f = !1, p] = r(e, t, n), { dialogElementRef: m, setDialogElement: h, setOpen: g, requestClose: v, repairToken: C } = d(f, p), [T, E] = S(""), [k, A] = S(!1), [j, M] = S(null), [N, P] = o(), [F, te] = S(null), [I, L] = S(null), [z, B] = S(f), V = x([]);
|
|
80
|
+
f !== z && (B(f), f && (E(""), A(!1), M(null)));
|
|
81
|
+
let H = _(() => {
|
|
82
|
+
g(!(f && m.current?.open));
|
|
83
|
+
}, [
|
|
84
|
+
f,
|
|
85
|
+
g,
|
|
86
|
+
m
|
|
87
|
+
]), { matchedValues: U, matchedIndices: W, visibleGroupIds: G } = b(() => {
|
|
88
|
+
let e = /* @__PURE__ */ new Set(), t = [], n = /* @__PURE__ */ new Set();
|
|
89
|
+
return N.forEach((r, i) => {
|
|
90
|
+
r.index !== -1 && (T === "" || a(r.label, T) || r.keywords !== void 0 && a(r.keywords, T)) && (e.add(i), t.push(r.index), r.groupId !== null && n.add(r.groupId));
|
|
91
|
+
}), t.sort((e, t) => e - t), {
|
|
92
|
+
matchedValues: e,
|
|
93
|
+
matchedIndices: t,
|
|
94
|
+
visibleGroupIds: n
|
|
95
|
+
};
|
|
96
|
+
}, [
|
|
97
|
+
N,
|
|
98
|
+
T,
|
|
99
|
+
a
|
|
100
|
+
]), K = b(() => new Set(W), [W]), q = j !== null && K.has(j) ? j : W[0] ?? null, J = D({
|
|
101
|
+
open: f,
|
|
102
|
+
onOpenChange: (e) => g(e),
|
|
103
|
+
elements: {
|
|
104
|
+
reference: F,
|
|
105
|
+
floating: I
|
|
106
|
+
}
|
|
107
|
+
}), Y = ee(J, {
|
|
108
|
+
listRef: V,
|
|
109
|
+
activeIndex: q,
|
|
110
|
+
onNavigate: (e) => {
|
|
111
|
+
e !== null && M(e);
|
|
112
|
+
},
|
|
113
|
+
virtual: !0,
|
|
114
|
+
loop: !0,
|
|
115
|
+
focusItemOnOpen: !1,
|
|
116
|
+
disabledIndices: (e) => !K.has(e)
|
|
117
|
+
}), { getReferenceProps: X, getFloatingProps: Z, getItemProps: Q } = O([Y]), $ = W.length, oe = k ? c($) : "", se = b(() => ({
|
|
118
|
+
open: f,
|
|
119
|
+
setOpen: g,
|
|
120
|
+
toggleOpen: H,
|
|
121
|
+
requestClose: v,
|
|
122
|
+
repairToken: C,
|
|
123
|
+
setDialogElement: h,
|
|
124
|
+
label: i,
|
|
125
|
+
emptyMessage: s,
|
|
126
|
+
baseId: u,
|
|
127
|
+
listId: `${u}-list`,
|
|
128
|
+
query: T,
|
|
129
|
+
announcement: oe,
|
|
130
|
+
matchCount: $,
|
|
131
|
+
matchedValues: U,
|
|
132
|
+
visibleGroupIds: G,
|
|
133
|
+
activeIndex: q,
|
|
134
|
+
elementsRef: V,
|
|
135
|
+
setInputElement: te,
|
|
136
|
+
setListElement: L,
|
|
137
|
+
getReferenceProps: X,
|
|
138
|
+
getFloatingProps: Z,
|
|
139
|
+
getItemProps: Q,
|
|
140
|
+
changeQuery: (e) => {
|
|
141
|
+
E(e), A(!0), M(null);
|
|
142
|
+
},
|
|
143
|
+
moveToEdge: (e) => {
|
|
144
|
+
let t = e === "first" ? W[0] : W[W.length - 1];
|
|
145
|
+
t !== void 0 && M(t);
|
|
146
|
+
},
|
|
147
|
+
registration: P
|
|
148
|
+
}), [
|
|
149
|
+
f,
|
|
150
|
+
g,
|
|
151
|
+
H,
|
|
152
|
+
v,
|
|
153
|
+
C,
|
|
154
|
+
h,
|
|
155
|
+
i,
|
|
156
|
+
s,
|
|
157
|
+
u,
|
|
158
|
+
T,
|
|
159
|
+
oe,
|
|
160
|
+
$,
|
|
161
|
+
U,
|
|
162
|
+
W,
|
|
163
|
+
G,
|
|
164
|
+
q,
|
|
165
|
+
X,
|
|
166
|
+
Z,
|
|
167
|
+
Q,
|
|
168
|
+
P
|
|
169
|
+
]);
|
|
170
|
+
return /* @__PURE__ */ w(R.Provider, {
|
|
171
|
+
value: se,
|
|
172
|
+
children: l
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
H.displayName = "CommandPalette";
|
|
176
|
+
function U({ ref: e, onClick: n, className: r, sx: i, ...a }) {
|
|
177
|
+
let { open: o, toggleOpen: s } = B("Trigger"), c = (e) => {
|
|
178
|
+
n?.(e), e.defaultPrevented || s();
|
|
179
|
+
};
|
|
180
|
+
return /* @__PURE__ */ w(t, {
|
|
181
|
+
className: r,
|
|
182
|
+
styles: u,
|
|
183
|
+
sx: i,
|
|
184
|
+
children: (t) => /* @__PURE__ */ w("button", {
|
|
185
|
+
type: "button",
|
|
186
|
+
...a,
|
|
187
|
+
ref: e,
|
|
188
|
+
"data-ui": "command-palette-trigger",
|
|
189
|
+
"aria-haspopup": "dialog",
|
|
190
|
+
"aria-expanded": o,
|
|
191
|
+
onClick: c,
|
|
192
|
+
className: t
|
|
193
|
+
})
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
U.displayName = "CommandPalette.Trigger";
|
|
197
|
+
function W({ ref: e, className: n, sx: r, ...a }) {
|
|
198
|
+
let { children: o, onCancel: s, onClick: c, onClose: l, ...u } = p(a), d = B("Content"), { label: m, announcement: h } = d, g = f(d, {
|
|
199
|
+
onCancel: s,
|
|
200
|
+
onClick: c,
|
|
201
|
+
onClose: l
|
|
202
|
+
}, e);
|
|
203
|
+
return /* @__PURE__ */ w(t, {
|
|
204
|
+
className: n,
|
|
205
|
+
styles: A,
|
|
206
|
+
sx: r,
|
|
207
|
+
children: (e) => /* @__PURE__ */ w("dialog", {
|
|
208
|
+
"aria-label": m,
|
|
209
|
+
...u,
|
|
210
|
+
...g,
|
|
211
|
+
"data-ui": "command-palette",
|
|
212
|
+
"aria-modal": "true",
|
|
213
|
+
className: e,
|
|
214
|
+
children: /* @__PURE__ */ T("div", {
|
|
215
|
+
css: j,
|
|
216
|
+
children: [o, /* @__PURE__ */ w("div", {
|
|
217
|
+
role: "status",
|
|
218
|
+
"aria-live": "polite",
|
|
219
|
+
"aria-atomic": "true",
|
|
220
|
+
css: i,
|
|
221
|
+
children: h
|
|
222
|
+
})]
|
|
223
|
+
})
|
|
224
|
+
})
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
W.displayName = "CommandPalette.Content";
|
|
228
|
+
function G({ ref: e, onChange: n, onKeyDown: r, className: i, sx: a, ...o }) {
|
|
229
|
+
let { label: s, listId: c, query: l, matchCount: u, activeIndex: d, elementsRef: f, requestClose: p, setInputElement: m, getReferenceProps: h, changeQuery: g, moveToEdge: _ } = B("Input"), v = k([
|
|
230
|
+
m,
|
|
231
|
+
V,
|
|
232
|
+
e
|
|
233
|
+
]), y = (e) => {
|
|
234
|
+
n?.(e), g(e.currentTarget.value);
|
|
235
|
+
}, b = (e) => {
|
|
236
|
+
r?.(e), !(e.defaultPrevented || e.nativeEvent.isComposing) && (e.key === "Escape" ? (e.preventDefault(), p()) : (e.key === "Home" || e.key === "End") && !e.shiftKey && !e.ctrlKey && !e.metaKey && !e.altKey ? (e.preventDefault(), _(e.key === "Home" ? "first" : "last")) : e.key === "Enter" && d !== null && (e.preventDefault(), f.current[d]?.click()));
|
|
237
|
+
};
|
|
238
|
+
return /* @__PURE__ */ w(t, {
|
|
239
|
+
className: i,
|
|
240
|
+
styles: M,
|
|
241
|
+
sx: a,
|
|
242
|
+
children: (e) => /* @__PURE__ */ w("input", {
|
|
243
|
+
"aria-label": s,
|
|
244
|
+
autoComplete: "off",
|
|
245
|
+
spellCheck: !1,
|
|
246
|
+
...h({
|
|
247
|
+
...o,
|
|
248
|
+
onChange: y,
|
|
249
|
+
onKeyDown: b
|
|
250
|
+
}),
|
|
251
|
+
ref: v,
|
|
252
|
+
type: "text",
|
|
253
|
+
value: l,
|
|
254
|
+
role: "combobox",
|
|
255
|
+
"aria-autocomplete": "list",
|
|
256
|
+
"aria-expanded": u > 0,
|
|
257
|
+
"aria-controls": c,
|
|
258
|
+
"data-ui": "command-palette-input",
|
|
259
|
+
className: e
|
|
260
|
+
})
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
G.displayName = "CommandPalette.Input";
|
|
264
|
+
function K({ ref: e, onMouseDown: n, children: r, className: i, sx: a, ...o }) {
|
|
265
|
+
let { label: s, listId: c, matchCount: l, elementsRef: u, setListElement: d, getFloatingProps: f } = B("List"), p = k([d, e]), m = (e) => {
|
|
266
|
+
n?.(e), e.preventDefault();
|
|
267
|
+
};
|
|
268
|
+
return /* @__PURE__ */ w(t, {
|
|
269
|
+
className: i,
|
|
270
|
+
styles: N,
|
|
271
|
+
sx: a,
|
|
272
|
+
children: (e) => /* @__PURE__ */ w("div", {
|
|
273
|
+
"aria-label": s,
|
|
274
|
+
...f({
|
|
275
|
+
...o,
|
|
276
|
+
onMouseDown: m
|
|
277
|
+
}),
|
|
278
|
+
ref: p,
|
|
279
|
+
id: c,
|
|
280
|
+
role: "listbox",
|
|
281
|
+
hidden: l === 0,
|
|
282
|
+
"data-ui": "command-palette-list",
|
|
283
|
+
className: e,
|
|
284
|
+
children: /* @__PURE__ */ w(E, {
|
|
285
|
+
elementsRef: u,
|
|
286
|
+
children: r
|
|
287
|
+
})
|
|
288
|
+
})
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
K.displayName = "CommandPalette.List";
|
|
292
|
+
function q({ ref: e, children: n, className: r, sx: i, ...o }) {
|
|
293
|
+
let { matchCount: s, emptyMessage: c } = B("Empty");
|
|
294
|
+
return s > 0 ? null : /* @__PURE__ */ w(t, {
|
|
295
|
+
className: r,
|
|
296
|
+
styles: I,
|
|
297
|
+
sx: i,
|
|
298
|
+
children: (t) => /* @__PURE__ */ w("div", {
|
|
299
|
+
...o,
|
|
300
|
+
ref: e,
|
|
301
|
+
"data-ui": "command-palette-empty",
|
|
302
|
+
className: t,
|
|
303
|
+
children: a(n) ? n : c
|
|
304
|
+
})
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
q.displayName = "CommandPalette.Empty";
|
|
308
|
+
function J({ ref: e, label: n, children: r, "aria-labelledby": i, className: a, sx: o, ...s }) {
|
|
309
|
+
let { visibleGroupIds: c } = B("Group"), l = y(), u = `${l}-heading`;
|
|
310
|
+
return /* @__PURE__ */ w(t, {
|
|
311
|
+
className: a,
|
|
312
|
+
styles: P,
|
|
313
|
+
sx: o,
|
|
314
|
+
children: (t) => /* @__PURE__ */ T("div", {
|
|
315
|
+
...s,
|
|
316
|
+
ref: e,
|
|
317
|
+
role: "group",
|
|
318
|
+
"aria-labelledby": [i, u].filter(Boolean).join(" "),
|
|
319
|
+
hidden: !c.has(l),
|
|
320
|
+
"data-ui": "command-palette-group",
|
|
321
|
+
className: t,
|
|
322
|
+
children: [/* @__PURE__ */ w("div", {
|
|
323
|
+
id: u,
|
|
324
|
+
css: F,
|
|
325
|
+
children: n
|
|
326
|
+
}), /* @__PURE__ */ w(z.Provider, {
|
|
327
|
+
value: l,
|
|
328
|
+
children: r
|
|
329
|
+
})]
|
|
330
|
+
})
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
J.displayName = "CommandPalette.Group";
|
|
334
|
+
function Y({ ref: e, value: n, onSelect: r, keywords: i, onClick: a, children: o, className: u, sx: d, ...f }) {
|
|
335
|
+
let { baseId: p, activeIndex: m, matchedValues: h, getItemProps: g, setOpen: _, registration: y } = B("Item"), b = v(z), S = x(null), { ref: C, index: T } = s(n, y, S, (e, t) => ({
|
|
336
|
+
index: e,
|
|
337
|
+
label: t,
|
|
338
|
+
keywords: i,
|
|
339
|
+
groupId: b
|
|
340
|
+
})), E = k([
|
|
341
|
+
C,
|
|
342
|
+
S,
|
|
343
|
+
e
|
|
344
|
+
]), D = T !== -1 && m === T, O = (e) => {
|
|
345
|
+
a?.(e), !e.defaultPrevented && (r?.(), _(!1));
|
|
346
|
+
};
|
|
347
|
+
return /* @__PURE__ */ w(t, {
|
|
348
|
+
className: u,
|
|
349
|
+
styles: [c, te],
|
|
350
|
+
sx: d,
|
|
351
|
+
children: (e) => /* @__PURE__ */ w("div", {
|
|
352
|
+
...g({
|
|
353
|
+
id: l(p, n),
|
|
354
|
+
...f,
|
|
355
|
+
onClick: O
|
|
356
|
+
}),
|
|
357
|
+
ref: E,
|
|
358
|
+
role: "option",
|
|
359
|
+
"aria-selected": D,
|
|
360
|
+
hidden: !h.has(n),
|
|
361
|
+
"data-active": D || void 0,
|
|
362
|
+
"data-ui": "command-palette-item",
|
|
363
|
+
className: e,
|
|
364
|
+
children: o
|
|
365
|
+
})
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
Y.displayName = "CommandPalette.Item";
|
|
369
|
+
var X = Object.assign(H, {
|
|
370
|
+
Trigger: U,
|
|
371
|
+
Content: W,
|
|
372
|
+
Input: G,
|
|
373
|
+
List: K,
|
|
374
|
+
Empty: q,
|
|
375
|
+
Group: J,
|
|
376
|
+
Item: Y
|
|
377
|
+
});
|
|
378
|
+
//#endregion
|
|
379
|
+
export { X as t };
|
package/dist/command-palette.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as CommandPalette } from "./command-palette-
|
|
2
|
+
export { t as CommandPalette } from "./command-palette-V_2pEay7.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { n } from "./layout-style-Cbd1Vilw.js";
|
|
4
|
+
import { jsx as r } from "@emotion/react/jsx-runtime";
|
|
5
|
+
//#region src/components/container/container.tsx
|
|
6
|
+
var i = {
|
|
7
|
+
sm: "640px",
|
|
8
|
+
md: "768px",
|
|
9
|
+
lg: "1024px",
|
|
10
|
+
xl: "1280px"
|
|
11
|
+
}, a = e({
|
|
12
|
+
boxSizing: "border-box",
|
|
13
|
+
inlineSize: "100%",
|
|
14
|
+
marginInline: "auto"
|
|
15
|
+
}), o = {
|
|
16
|
+
sm: e({ maxInlineSize: i.sm }),
|
|
17
|
+
md: e({ maxInlineSize: i.md }),
|
|
18
|
+
lg: e({ maxInlineSize: i.lg }),
|
|
19
|
+
xl: e({ maxInlineSize: i.xl })
|
|
20
|
+
}, s = n("paddingInline");
|
|
21
|
+
function c({ ref: e, size: n = "lg", paddingInline: i = "md", className: c, sx: l, ...u }) {
|
|
22
|
+
return /* @__PURE__ */ r(t, {
|
|
23
|
+
className: c,
|
|
24
|
+
styles: [
|
|
25
|
+
a,
|
|
26
|
+
o[n],
|
|
27
|
+
s[i]
|
|
28
|
+
],
|
|
29
|
+
sx: l,
|
|
30
|
+
children: (t) => /* @__PURE__ */ r("div", {
|
|
31
|
+
...u,
|
|
32
|
+
ref: e,
|
|
33
|
+
"data-ui": "container",
|
|
34
|
+
"data-size": n,
|
|
35
|
+
className: t
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
c.displayName = "Container";
|
|
40
|
+
//#endregion
|
|
41
|
+
export { c as t };
|
package/dist/container.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Container } from "./container-
|
|
2
|
+
export { t as Container } from "./container-BOaSptJa.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import { t } from "./use-controlled-state-CVXDa-qM.js";
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
6
|
-
import { n as
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as
|
|
9
|
-
import { createContext as
|
|
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 "./renderable-DzcIj1Lo.js";
|
|
5
|
+
import { t as i } from "./calendar-C9Yad_-w.js";
|
|
6
|
+
import { n as a } from "./surface-DZ4d-2aL.js";
|
|
7
|
+
import { t as o } from "./use-overlay-floating-efeqppiw.js";
|
|
8
|
+
import { t as s } from "./text-field-D60ok14S.js";
|
|
9
|
+
import { createContext as c, useContext as l, useEffect as u, useId as d, useLayoutEffect as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
10
10
|
import { vars as g } from "@jfrader/tokens/vars";
|
|
11
11
|
import { jsx as _, jsxs as v } from "@emotion/react/jsx-runtime";
|
|
12
12
|
import { FloatingFocusManager as y, FloatingPortal as b, useClick as x, useDismiss as S, useInteractions as C, useMergeRefs as w, useRole as T } from "@floating-ui/react";
|
|
@@ -15,7 +15,7 @@ var E = "bottom-start", D = /* @__PURE__ */ new Set(["Enter", "ArrowDown"]), O =
|
|
|
15
15
|
calendar: "gregory",
|
|
16
16
|
timeZone: "UTC",
|
|
17
17
|
dateStyle: "medium"
|
|
18
|
-
}, N =
|
|
18
|
+
}, N = c(null);
|
|
19
19
|
function P(e) {
|
|
20
20
|
let t = l(N);
|
|
21
21
|
if (!t) throw Error(`DatePicker.${e} must be rendered inside <DatePicker>.`);
|
|
@@ -48,13 +48,13 @@ var B = e({
|
|
|
48
48
|
cursor: "pointer",
|
|
49
49
|
"&:disabled": { cursor: "not-allowed" }
|
|
50
50
|
}), V = e({
|
|
51
|
-
...
|
|
51
|
+
...a,
|
|
52
52
|
borderRadius: g.radius.md,
|
|
53
53
|
boxShadow: g.shadow.overlay,
|
|
54
54
|
padding: g.space[3]
|
|
55
55
|
});
|
|
56
|
-
function H({ value: e, defaultValue:
|
|
57
|
-
let [D, O] =
|
|
56
|
+
function H({ value: e, defaultValue: t, onValueChange: r, open: i, defaultOpen: a = !1, onOpenChange: s, min: c, max: l, locale: d, firstDayOfWeek: f, disabled: g = !1, name: y, placeholder: b, children: w }) {
|
|
57
|
+
let [D, O] = n(e, t, r), [k = !1, A] = n(i, a, s), [j, P] = h(!1), F = g || j, I = k && !F, [z, B] = h(null), V = m(null), H = m(!1), U = p(() => new Intl.DateTimeFormat(d ?? ne()).resolvedOptions().locale, [d]), W = p(() => new Intl.DateTimeFormat(U, M), [U]), G = p(() => re(W, U), [W, U]), K = L(D), q = K ? W.format(K) : "", J = R(c), Y = R(l), X = ee(R(D) ?? te(), J, Y).slice(0, 7), { refs: Z, floatingStyles: Q, context: $ } = o({
|
|
58
58
|
open: I,
|
|
59
59
|
placement: E,
|
|
60
60
|
onOpenChange: (e, t, n) => {
|
|
@@ -141,12 +141,13 @@ function H({ value: e, defaultValue: n, onValueChange: r, open: i, defaultOpen:
|
|
|
141
141
|
})]
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
H.displayName = "DatePicker";
|
|
145
|
+
function U({ ref: e, label: t, id: n, disabled: i, slotProps: a, onKeyDown: o, onKeyUp: c, ...l }) {
|
|
146
|
+
let { open: u, disabled: p, displayValue: m, placeholder: h, gridRef: g, refs: v, getReferenceProps: y, requestOpenChange: b, setInputLabelling: x, setInputDisabled: S } = P("Input"), C = w([v.setReference, e]), T = d(), E = n ?? T, k = `${E}-label`, A = r(t), j = l["aria-labelledby"], M = l["aria-label"], N = M ?? (typeof t == "string" ? t : void 0), F = p || i === !0;
|
|
147
|
+
f(() => (S(i === !0), () => S(!1)), [i, S]), f(() => (x(j === void 0 ? M === void 0 ? typeof t == "string" ? { label: t } : { labelledBy: A ? k : void 0 } : { label: M } : { labelledBy: j }), () => x(null)), [
|
|
147
148
|
j,
|
|
148
149
|
M,
|
|
149
|
-
|
|
150
|
+
t,
|
|
150
151
|
A,
|
|
151
152
|
k,
|
|
152
153
|
x
|
|
@@ -154,13 +155,13 @@ var U = c(function({ label: e, id: t, disabled: r, slotProps: i, onKeyDown: a, o
|
|
|
154
155
|
let I = () => {
|
|
155
156
|
F || (u ? z(g.current) : b(!0));
|
|
156
157
|
}, L = (e) => {
|
|
157
|
-
|
|
158
|
+
o?.(e), !(e.defaultPrevented || F) && (e.key === O ? e.preventDefault() : D.has(e.key) && (e.preventDefault(), I()));
|
|
158
159
|
}, R = (e) => {
|
|
159
|
-
|
|
160
|
+
c?.(e), !(e.defaultPrevented || F || e.key !== O) && I();
|
|
160
161
|
};
|
|
161
|
-
return /* @__PURE__ */ _(
|
|
162
|
+
return /* @__PURE__ */ _(s, {
|
|
162
163
|
...y({
|
|
163
|
-
...
|
|
164
|
+
...l,
|
|
164
165
|
onKeyDown: L,
|
|
165
166
|
onKeyUp: R
|
|
166
167
|
}),
|
|
@@ -168,13 +169,13 @@ var U = c(function({ label: e, id: t, disabled: r, slotProps: i, onKeyDown: a, o
|
|
|
168
169
|
id: E,
|
|
169
170
|
label: A ? /* @__PURE__ */ _("span", {
|
|
170
171
|
id: k,
|
|
171
|
-
children:
|
|
172
|
-
}) :
|
|
172
|
+
children: t
|
|
173
|
+
}) : t,
|
|
173
174
|
slotProps: {
|
|
174
|
-
...
|
|
175
|
+
...a,
|
|
175
176
|
control: {
|
|
176
|
-
...
|
|
177
|
-
css: [B,
|
|
177
|
+
...a?.control,
|
|
178
|
+
css: [B, a?.control?.css]
|
|
178
179
|
}
|
|
179
180
|
},
|
|
180
181
|
value: m,
|
|
@@ -187,52 +188,61 @@ var U = c(function({ label: e, id: t, disabled: r, slotProps: i, onKeyDown: a, o
|
|
|
187
188
|
"data-state": u ? "open" : "closed",
|
|
188
189
|
"data-ui": "date-picker-input"
|
|
189
190
|
});
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
}
|
|
192
|
+
U.displayName = "DatePicker.Input";
|
|
193
|
+
function W({ ref: e, style: n, className: r, sx: a, ...o }) {
|
|
194
|
+
let { open: s, value: c, initialMonth: l, min: u, max: d, locale: f, firstDayOfWeek: p, inputLabelling: h, gridRef: g, refs: x, floatingContext: S, floatingStyles: C, getFloatingProps: T, selectDate: E } = P("Popup"), D = w([x.setFloating, e]), O = m(null), k = w([(e) => {
|
|
195
|
+
g.current = e, O.current = z(e);
|
|
193
196
|
}]);
|
|
194
|
-
if (!
|
|
195
|
-
let
|
|
197
|
+
if (!s) return null;
|
|
198
|
+
let j = o["aria-labelledby"] !== void 0 || o["aria-label"] !== void 0 ? {} : h?.labelledBy === void 0 ? { "aria-label": h?.label } : { "aria-labelledby": h.labelledBy }, M = (e) => {
|
|
196
199
|
let t = e.target.closest(A);
|
|
197
200
|
if (t?.disabled) return;
|
|
198
201
|
let n = t?.dataset.date;
|
|
199
|
-
n !== void 0 &&
|
|
200
|
-
},
|
|
202
|
+
n !== void 0 && E(n);
|
|
203
|
+
}, N = (e) => {
|
|
201
204
|
e.target.closest(A)?.disabled && e.preventDefault();
|
|
202
205
|
};
|
|
203
206
|
return /* @__PURE__ */ _(b, { children: /* @__PURE__ */ _(y, {
|
|
204
|
-
context:
|
|
207
|
+
context: S,
|
|
205
208
|
modal: !1,
|
|
206
|
-
initialFocus:
|
|
209
|
+
initialFocus: O,
|
|
207
210
|
returnFocus: !1,
|
|
208
|
-
children: /* @__PURE__ */ _(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
211
|
+
children: /* @__PURE__ */ _(t, {
|
|
212
|
+
className: r,
|
|
213
|
+
styles: V,
|
|
214
|
+
sx: a,
|
|
215
|
+
children: (e) => /* @__PURE__ */ _("div", {
|
|
216
|
+
...T({
|
|
217
|
+
...j,
|
|
218
|
+
...o
|
|
219
|
+
}),
|
|
220
|
+
ref: D,
|
|
221
|
+
"data-ui": "date-picker-popup",
|
|
222
|
+
style: {
|
|
223
|
+
...n,
|
|
224
|
+
...C
|
|
225
|
+
},
|
|
226
|
+
className: e,
|
|
227
|
+
children: /* @__PURE__ */ v(i, {
|
|
228
|
+
value: c ?? "",
|
|
229
|
+
defaultVisibleMonth: l,
|
|
230
|
+
min: u,
|
|
231
|
+
max: d,
|
|
232
|
+
locale: f,
|
|
233
|
+
firstDayOfWeek: p,
|
|
234
|
+
children: [/* @__PURE__ */ _(i.Header, {}), /* @__PURE__ */ _(i.Grid, {
|
|
235
|
+
ref: k,
|
|
236
|
+
onClick: M,
|
|
237
|
+
onPointerDownCapture: N
|
|
238
|
+
})]
|
|
239
|
+
})
|
|
232
240
|
})
|
|
233
241
|
})
|
|
234
242
|
}) });
|
|
235
|
-
}
|
|
243
|
+
}
|
|
244
|
+
W.displayName = "DatePicker.Popup";
|
|
245
|
+
var G = Object.assign(H, {
|
|
236
246
|
Input: U,
|
|
237
247
|
Popup: W
|
|
238
248
|
});
|
package/dist/date-picker.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as DatePicker } from "./date-picker-
|
|
2
|
+
export { t as DatePicker } from "./date-picker-ClUYBIBh.js";
|