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