@jfrader/ui 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +123 -2
- package/dist/accordion-Dl-kvgPQ.js +168 -0
- package/dist/accordion.js +1 -0
- package/dist/alert-BzntPa_5.js +129 -0
- package/dist/alert.js +1 -0
- package/dist/avatar-Dk2ES3ru.js +124 -0
- package/dist/avatar.js +1 -0
- package/dist/badge-DZefC7rm.js +102 -0
- package/dist/badge.js +1 -0
- package/dist/breadcrumbs-5MCZ_Jr3.js +125 -0
- package/dist/breadcrumbs.js +1 -0
- package/dist/button-qy-50NPd.js +187 -0
- package/dist/button.js +1 -0
- package/dist/calendar-DcCAiN3b.js +372 -0
- package/dist/calendar.js +1 -0
- package/dist/card-L-Z_1vZN.js +120 -0
- package/dist/card.js +1 -0
- package/dist/checkbox-B7em7B-6.js +134 -0
- package/dist/checkbox.js +1 -0
- package/dist/choice-control-DCyQ_hVw.js +35 -0
- package/dist/collection-registry-C2jnQa7X.js +97 -0
- package/dist/combobox-DQcXR94r.js +301 -0
- package/dist/combobox.js +1 -0
- package/dist/command-palette-BRJ8A5De.js +328 -0
- package/dist/command-palette.js +1 -0
- package/dist/container-COHiEjI8.js +34 -0
- package/dist/container.js +1 -0
- package/dist/css-CW_HG55W.js +1 -0
- package/dist/date-picker-D1GwiRB9.js +239 -0
- package/dist/date-picker.js +1 -0
- package/dist/dialog-CYf9fCZO.js +175 -0
- package/dist/dialog.js +1 -0
- package/dist/disclosure-caret-BC6P8AsM.js +13 -0
- package/dist/divider-bi7OgCI5.js +76 -0
- package/dist/divider.js +1 -0
- package/dist/field-anatomy-DKkB268x.js +104 -0
- package/dist/flex-CDFDDaiu.js +21 -0
- package/dist/flex.js +1 -0
- package/dist/focus-ring-qOS3rPlM.js +11 -0
- package/dist/icon-wrapper-BKo4FI-O.js +12 -0
- package/dist/index.js +37 -0
- package/dist/kbd-DpiJgDJ2.js +55 -0
- package/dist/kbd.js +1 -0
- package/dist/layout-style-B_6YHQ6Q.js +56 -0
- package/dist/loading-ring-CTpT-IrT.js +18 -0
- package/dist/media-8K3xDAxM.js +4 -0
- package/dist/menu-A9fZUaAG.js +186 -0
- package/dist/menu.js +1 -0
- package/dist/navigation-Cemnmc_J.js +174 -0
- package/dist/navigation.js +1 -0
- package/dist/pagination-orCjUsn_.js +148 -0
- package/dist/pagination.js +1 -0
- package/dist/part-id-Bg1LSlk7.js +4 -0
- package/dist/pill-Dg2JJHHW.js +49 -0
- package/dist/pill.js +1 -0
- package/dist/popover-D_YU34WS.js +97 -0
- package/dist/popover.js +1 -0
- package/dist/progress-XdvBG0Vv.js +83 -0
- package/dist/progress.js +1 -0
- package/dist/radio-group-CxMJ2Vq7.js +130 -0
- package/dist/radio-group.js +1 -0
- package/dist/renderable-DwPvt1I8.js +6 -0
- package/dist/roving-focus-DeEZ55-T.js +35 -0
- package/dist/select-mwFbmzsn.js +256 -0
- package/dist/select.js +1 -0
- package/dist/skeleton-qas9ZKK9.js +47 -0
- package/dist/skeleton.js +1 -0
- package/dist/spinner-ros2CfIf.js +49 -0
- package/dist/spinner.js +1 -0
- package/dist/stack-Hs8THnIL.js +20 -0
- package/dist/stack.js +1 -0
- package/dist/surface-Bo_aSQOb.js +18 -0
- package/dist/switch-E375Bz4X.js +135 -0
- package/dist/switch.js +1 -0
- package/dist/tabs-CBwRiuul.js +173 -0
- package/dist/tabs.js +1 -0
- package/dist/text-field-BlP8qGn_.js +73 -0
- package/dist/text-field.js +1 -0
- package/dist/textarea-CUG26CH2.js +83 -0
- package/dist/textarea.js +1 -0
- package/dist/theme-root-CrdzwfSo.js +20 -0
- package/dist/theme-root.js +1 -0
- package/dist/toast-D_dnqnn-.js +270 -0
- package/dist/toast.js +1 -0
- package/dist/toggle-group-B7gXCea8.js +150 -0
- package/dist/toggle-group.js +1 -0
- package/dist/tooltip-BJ2hLV1b.js +92 -0
- package/dist/tooltip.js +1 -0
- package/dist/trigger-style-f54idgjT.js +35 -0
- package/dist/types/components/accordion/accordion.d.ts +33 -0
- package/dist/types/components/accordion/index.d.ts +2 -0
- package/dist/types/components/alert/alert.d.ts +23 -0
- package/dist/types/components/alert/index.d.ts +2 -0
- package/dist/types/components/avatar/avatar.d.ts +23 -0
- package/dist/types/components/avatar/index.d.ts +2 -0
- package/dist/types/components/badge/badge.d.ts +36 -0
- package/dist/types/components/badge/index.d.ts +2 -0
- package/dist/types/components/breadcrumbs/breadcrumbs.d.ts +15 -0
- package/dist/types/components/breadcrumbs/index.d.ts +2 -0
- package/dist/types/components/button/button.d.ts +34 -0
- package/dist/types/components/button/index.d.ts +2 -0
- package/dist/types/components/calendar/calendar.d.ts +28 -0
- package/dist/types/components/calendar/calendar.styles.d.ts +9 -0
- package/dist/types/components/calendar/calendar.utils.d.ts +37 -0
- package/dist/types/components/calendar/index.d.ts +2 -0
- package/dist/types/components/card/card.d.ts +34 -0
- package/dist/types/components/card/index.d.ts +2 -0
- package/dist/types/components/checkbox/checkbox.d.ts +21 -0
- package/dist/types/components/checkbox/index.d.ts +2 -0
- package/dist/types/components/combobox/combobox.d.ts +44 -0
- package/dist/types/components/combobox/index.d.ts +2 -0
- package/dist/types/components/command-palette/command-palette.d.ts +47 -0
- package/dist/types/components/command-palette/command-palette.styles.d.ts +8 -0
- package/dist/types/components/command-palette/index.d.ts +2 -0
- package/dist/types/components/container/container.d.ts +14 -0
- package/dist/types/components/container/index.d.ts +3 -0
- package/dist/types/components/date-picker/date-picker.d.ts +39 -0
- package/dist/types/components/date-picker/index.d.ts +2 -0
- package/dist/types/components/dialog/dialog.d.ts +61 -0
- package/dist/types/components/dialog/index.d.ts +2 -0
- package/dist/types/components/divider/divider.d.ts +14 -0
- package/dist/types/components/divider/index.d.ts +2 -0
- package/dist/types/components/field/field-anatomy.d.ts +49 -0
- package/dist/types/components/flex/flex.d.ts +4 -0
- package/dist/types/components/flex/index.d.ts +3 -0
- package/dist/types/components/kbd/index.d.ts +2 -0
- package/dist/types/components/kbd/kbd.d.ts +6 -0
- package/dist/types/components/menu/index.d.ts +2 -0
- package/dist/types/components/menu/menu.d.ts +29 -0
- package/dist/types/components/navigation/index.d.ts +2 -0
- package/dist/types/components/navigation/navigation.d.ts +24 -0
- package/dist/types/components/pagination/index.d.ts +2 -0
- package/dist/types/components/pagination/pagination.d.ts +14 -0
- package/dist/types/components/pill/index.d.ts +2 -0
- package/dist/types/components/pill/pill.d.ts +6 -0
- package/dist/types/components/popover/index.d.ts +2 -0
- package/dist/types/components/popover/popover.d.ts +19 -0
- package/dist/types/components/progress/index.d.ts +2 -0
- package/dist/types/components/progress/progress.d.ts +19 -0
- package/dist/types/components/radio-group/index.d.ts +2 -0
- package/dist/types/components/radio-group/radio-group.d.ts +29 -0
- package/dist/types/components/select/index.d.ts +2 -0
- package/dist/types/components/select/select.d.ts +38 -0
- package/dist/types/components/skeleton/index.d.ts +2 -0
- package/dist/types/components/skeleton/skeleton.d.ts +11 -0
- package/dist/types/components/spinner/index.d.ts +2 -0
- package/dist/types/components/spinner/spinner.d.ts +8 -0
- package/dist/types/components/stack/index.d.ts +3 -0
- package/dist/types/components/stack/stack.d.ts +7 -0
- package/dist/types/components/switch/index.d.ts +2 -0
- package/dist/types/components/switch/switch.d.ts +20 -0
- package/dist/types/components/tabs/index.d.ts +2 -0
- package/dist/types/components/tabs/tabs.d.ts +22 -0
- package/dist/types/components/text-field/index.d.ts +2 -0
- package/dist/types/components/text-field/text-field.d.ts +14 -0
- package/dist/types/components/textarea/index.d.ts +2 -0
- package/dist/types/components/textarea/textarea.d.ts +17 -0
- package/dist/types/components/theme-root/index.d.ts +2 -0
- package/dist/types/components/theme-root/theme-root.d.ts +7 -0
- package/dist/types/components/toast/index.d.ts +2 -0
- package/dist/types/components/toast/toast.d.ts +37 -0
- package/dist/types/components/toggle-group/index.d.ts +2 -0
- package/dist/types/components/toggle-group/toggle-group.d.ts +29 -0
- package/dist/types/components/tooltip/index.d.ts +2 -0
- package/dist/types/components/tooltip/tooltip.d.ts +23 -0
- package/dist/types/index.d.ts +36 -0
- package/dist/types/overlay/use-native-dialog.d.ts +39 -0
- package/dist/types/overlay/use-overlay-floating.d.ts +11 -0
- package/dist/types/overlay/use-scroll-lock.d.ts +5 -0
- package/dist/types/styling/choice-control.d.ts +8 -0
- package/dist/types/styling/css.d.ts +2 -0
- package/dist/types/styling/disclosure-caret.d.ts +9 -0
- package/dist/types/styling/focus-ring.d.ts +10 -0
- package/dist/types/styling/icon-wrapper.d.ts +1 -0
- package/dist/types/styling/input-control.d.ts +1 -0
- package/dist/types/styling/layout-style.d.ts +26 -0
- package/dist/types/styling/listbox-style.d.ts +12 -0
- package/dist/types/styling/loading-ring.d.ts +14 -0
- package/dist/types/styling/media.d.ts +2 -0
- package/dist/types/styling/surface.d.ts +19 -0
- package/dist/types/styling/trigger-style.d.ts +1 -0
- package/dist/types/styling/visually-hidden.d.ts +1 -0
- package/dist/types/utils/collection-registry.d.ts +41 -0
- package/dist/types/utils/part-id.d.ts +2 -0
- package/dist/types/utils/renderable.d.ts +3 -0
- package/dist/types/utils/roving-focus.d.ts +18 -0
- package/dist/types/utils/use-controlled-state.d.ts +7 -0
- package/dist/types/utils/use-latest-callback.d.ts +10 -0
- package/dist/use-controlled-state-DQXkiTQI.js +20 -0
- package/dist/use-native-dialog-BCp1chwO.js +83 -0
- package/dist/use-overlay-floating-CsZd3qxa.js +18 -0
- package/dist/visually-hidden-BXVyhj0y.js +16 -0
- package/package.json +198 -3
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { t as e } from "./css-CW_HG55W.js";
|
|
2
|
+
import { t } from "./focus-ring-qOS3rPlM.js";
|
|
3
|
+
import { t as n } from "./use-controlled-state-DQXkiTQI.js";
|
|
4
|
+
import { t as r } from "./visually-hidden-BXVyhj0y.js";
|
|
5
|
+
import { t as i } from "./renderable-DwPvt1I8.js";
|
|
6
|
+
import { a, r as o, s, t as c } from "./collection-registry-C2jnQa7X.js";
|
|
7
|
+
import { t as l } from "./trigger-style-f54idgjT.js";
|
|
8
|
+
import { i as u, r as d, t as f } from "./use-native-dialog-BCp1chwO.js";
|
|
9
|
+
import { n as p, t as m } from "./surface-Bo_aSQOb.js";
|
|
10
|
+
import { createContext as h, forwardRef as g, useCallback as _, useContext as v, useId as y, useMemo as b, useRef as x, useState as S } from "react";
|
|
11
|
+
import { vars as C } from "@jfrader/tokens/vars";
|
|
12
|
+
import { jsx as w, jsxs as T } from "@emotion/react/jsx-runtime";
|
|
13
|
+
import { FloatingList as E, useFloatingRootContext as ee, useInteractions as te, useListNavigation as ne, useMergeRefs as D } from "@floating-ui/react";
|
|
14
|
+
//#region src/components/command-palette/command-palette.styles.ts
|
|
15
|
+
var O = e({
|
|
16
|
+
...m,
|
|
17
|
+
marginBlockStart: C.space[12]
|
|
18
|
+
}), k = e({
|
|
19
|
+
...p,
|
|
20
|
+
display: "flex",
|
|
21
|
+
flexDirection: "column",
|
|
22
|
+
borderRadius: C.radius.lg,
|
|
23
|
+
boxShadow: C.shadow.floating,
|
|
24
|
+
inlineSize: "min(560px, calc(100vw - 32px))"
|
|
25
|
+
}), A = e({
|
|
26
|
+
boxSizing: "border-box",
|
|
27
|
+
inlineSize: "100%",
|
|
28
|
+
blockSize: "48px",
|
|
29
|
+
margin: 0,
|
|
30
|
+
border: 0,
|
|
31
|
+
borderBlockEnd: `1px solid ${C.color.borderControl}`,
|
|
32
|
+
borderStartStartRadius: C.radius.lg,
|
|
33
|
+
borderStartEndRadius: C.radius.lg,
|
|
34
|
+
backgroundColor: "transparent",
|
|
35
|
+
paddingInline: C.space[4],
|
|
36
|
+
font: "inherit",
|
|
37
|
+
fontSize: C.textSize.md,
|
|
38
|
+
color: C.color.text,
|
|
39
|
+
"&::placeholder": { color: C.color.textSubtle },
|
|
40
|
+
"&:focus-visible": { ...t }
|
|
41
|
+
}), j = e({
|
|
42
|
+
boxSizing: "border-box",
|
|
43
|
+
display: "flex",
|
|
44
|
+
flexDirection: "column",
|
|
45
|
+
maxBlockSize: "320px",
|
|
46
|
+
overflow: "auto",
|
|
47
|
+
padding: C.space[1],
|
|
48
|
+
"&[hidden]": { display: "none" }
|
|
49
|
+
}), M = e({
|
|
50
|
+
display: "flex",
|
|
51
|
+
flexDirection: "column",
|
|
52
|
+
"&[hidden]": { display: "none" }
|
|
53
|
+
}), N = e({
|
|
54
|
+
paddingBlock: C.space[1],
|
|
55
|
+
paddingInline: C.space[2],
|
|
56
|
+
fontSize: C.textSize.xs,
|
|
57
|
+
fontWeight: C.fontWeight.medium,
|
|
58
|
+
color: C.color.textMuted
|
|
59
|
+
}), P = e({
|
|
60
|
+
"&:hover, &[data-active]": { backgroundColor: C.color.surfaceHover },
|
|
61
|
+
"&[hidden]": { display: "none" }
|
|
62
|
+
}), F = e({
|
|
63
|
+
paddingBlock: C.space[6],
|
|
64
|
+
paddingInline: C.space[4],
|
|
65
|
+
textAlign: "center",
|
|
66
|
+
fontSize: C.textSize.sm,
|
|
67
|
+
color: C.color.textMuted
|
|
68
|
+
}), re = "Command palette", ie = "No results", I = new Intl.PluralRules("en"), ae = (e, t) => e.toLocaleLowerCase().includes(t.toLocaleLowerCase()), oe = (e) => `${e} ${I.select(e) === "one" ? "result" : "results"}`, L = h(null), R = h(null);
|
|
69
|
+
function z(e) {
|
|
70
|
+
let t = v(L);
|
|
71
|
+
if (!t) throw Error(`CommandPalette.${e} must be rendered inside <CommandPalette>.`);
|
|
72
|
+
return t;
|
|
73
|
+
}
|
|
74
|
+
var B = (e) => {
|
|
75
|
+
e?.setAttribute("autofocus", "");
|
|
76
|
+
};
|
|
77
|
+
function V({ open: e, defaultOpen: t = !1, onOpenChange: r, label: i = re, filter: o = ae, emptyMessage: s = ie, formatResultCount: c = oe, children: l }) {
|
|
78
|
+
let d = y(), [f = !1, p] = n(e, t, r), { dialogElementRef: m, setDialogElement: h, setOpen: g, requestClose: v, repairToken: C } = u(f, p), [T, E] = S(""), [D, O] = S(!1), [k, A] = S(null), [j, M] = a(), [N, P] = S(null), [F, I] = S(null), [R, z] = S(f), B = x([]);
|
|
79
|
+
f !== R && (z(f), f && (E(""), O(!1), A(null)));
|
|
80
|
+
let V = _(() => {
|
|
81
|
+
g(!(f && m.current?.open));
|
|
82
|
+
}, [
|
|
83
|
+
f,
|
|
84
|
+
g,
|
|
85
|
+
m
|
|
86
|
+
]), { matchedValues: H, matchedIndices: U, visibleGroupIds: W } = b(() => {
|
|
87
|
+
let e = /* @__PURE__ */ new Set(), t = [], n = /* @__PURE__ */ new Set();
|
|
88
|
+
return j.forEach((r, i) => {
|
|
89
|
+
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));
|
|
90
|
+
}), t.sort((e, t) => e - t), {
|
|
91
|
+
matchedValues: e,
|
|
92
|
+
matchedIndices: t,
|
|
93
|
+
visibleGroupIds: n
|
|
94
|
+
};
|
|
95
|
+
}, [
|
|
96
|
+
j,
|
|
97
|
+
T,
|
|
98
|
+
o
|
|
99
|
+
]), G = b(() => new Set(U), [U]), K = k !== null && G.has(k) ? k : U[0] ?? null, q = ee({
|
|
100
|
+
open: f,
|
|
101
|
+
onOpenChange: (e) => g(e),
|
|
102
|
+
elements: {
|
|
103
|
+
reference: N,
|
|
104
|
+
floating: F
|
|
105
|
+
}
|
|
106
|
+
}), J = ne(q, {
|
|
107
|
+
listRef: B,
|
|
108
|
+
activeIndex: K,
|
|
109
|
+
onNavigate: (e) => {
|
|
110
|
+
e !== null && A(e);
|
|
111
|
+
},
|
|
112
|
+
virtual: !0,
|
|
113
|
+
loop: !0,
|
|
114
|
+
focusItemOnOpen: !1,
|
|
115
|
+
disabledIndices: (e) => !G.has(e)
|
|
116
|
+
}), { getReferenceProps: Y, getFloatingProps: X, getItemProps: Z } = te([J]), Q = U.length, $ = D ? c(Q) : "", se = b(() => ({
|
|
117
|
+
open: f,
|
|
118
|
+
setOpen: g,
|
|
119
|
+
toggleOpen: V,
|
|
120
|
+
requestClose: v,
|
|
121
|
+
repairToken: C,
|
|
122
|
+
setDialogElement: h,
|
|
123
|
+
label: i,
|
|
124
|
+
emptyMessage: s,
|
|
125
|
+
baseId: d,
|
|
126
|
+
listId: `${d}-list`,
|
|
127
|
+
query: T,
|
|
128
|
+
announcement: $,
|
|
129
|
+
matchCount: Q,
|
|
130
|
+
matchedValues: H,
|
|
131
|
+
visibleGroupIds: W,
|
|
132
|
+
activeIndex: K,
|
|
133
|
+
elementsRef: B,
|
|
134
|
+
setInputElement: P,
|
|
135
|
+
setListElement: I,
|
|
136
|
+
getReferenceProps: Y,
|
|
137
|
+
getFloatingProps: X,
|
|
138
|
+
getItemProps: Z,
|
|
139
|
+
changeQuery: (e) => {
|
|
140
|
+
E(e), O(!0), A(null);
|
|
141
|
+
},
|
|
142
|
+
moveToEdge: (e) => {
|
|
143
|
+
let t = e === "first" ? U[0] : U[U.length - 1];
|
|
144
|
+
t !== void 0 && A(t);
|
|
145
|
+
},
|
|
146
|
+
registration: M
|
|
147
|
+
}), [
|
|
148
|
+
f,
|
|
149
|
+
g,
|
|
150
|
+
V,
|
|
151
|
+
v,
|
|
152
|
+
C,
|
|
153
|
+
h,
|
|
154
|
+
i,
|
|
155
|
+
s,
|
|
156
|
+
d,
|
|
157
|
+
T,
|
|
158
|
+
$,
|
|
159
|
+
Q,
|
|
160
|
+
H,
|
|
161
|
+
U,
|
|
162
|
+
W,
|
|
163
|
+
K,
|
|
164
|
+
Y,
|
|
165
|
+
X,
|
|
166
|
+
Z,
|
|
167
|
+
M
|
|
168
|
+
]);
|
|
169
|
+
return /* @__PURE__ */ w(L.Provider, {
|
|
170
|
+
value: se,
|
|
171
|
+
children: l
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
var H = g(function({ onClick: e, ...t }, n) {
|
|
175
|
+
let { open: r, toggleOpen: i } = z("Trigger"), a = (t) => {
|
|
176
|
+
e?.(t), t.defaultPrevented || i();
|
|
177
|
+
};
|
|
178
|
+
return /* @__PURE__ */ w("button", {
|
|
179
|
+
type: "button",
|
|
180
|
+
...t,
|
|
181
|
+
ref: n,
|
|
182
|
+
"data-ui": "command-palette-trigger",
|
|
183
|
+
"aria-haspopup": "dialog",
|
|
184
|
+
"aria-expanded": r,
|
|
185
|
+
onClick: a,
|
|
186
|
+
css: l
|
|
187
|
+
});
|
|
188
|
+
}), U = g(function(e, t) {
|
|
189
|
+
let { children: n, onCancel: i, onClick: a, onClose: o, ...s } = f(e), c = z("Content"), { label: l, announcement: u } = c, p = d(c, {
|
|
190
|
+
onCancel: i,
|
|
191
|
+
onClick: a,
|
|
192
|
+
onClose: o
|
|
193
|
+
}, t);
|
|
194
|
+
return /* @__PURE__ */ w("dialog", {
|
|
195
|
+
"aria-label": l,
|
|
196
|
+
...s,
|
|
197
|
+
...p,
|
|
198
|
+
"data-ui": "command-palette",
|
|
199
|
+
"aria-modal": "true",
|
|
200
|
+
css: O,
|
|
201
|
+
children: /* @__PURE__ */ T("div", {
|
|
202
|
+
css: k,
|
|
203
|
+
children: [n, /* @__PURE__ */ w("div", {
|
|
204
|
+
role: "status",
|
|
205
|
+
"aria-live": "polite",
|
|
206
|
+
"aria-atomic": "true",
|
|
207
|
+
css: r,
|
|
208
|
+
children: u
|
|
209
|
+
})]
|
|
210
|
+
})
|
|
211
|
+
});
|
|
212
|
+
}), W = g(function({ onChange: e, onKeyDown: t, ...n }, r) {
|
|
213
|
+
let { label: i, listId: a, query: o, matchCount: s, activeIndex: c, elementsRef: l, requestClose: u, setInputElement: d, getReferenceProps: f, changeQuery: p, moveToEdge: m } = z("Input"), h = D([
|
|
214
|
+
d,
|
|
215
|
+
B,
|
|
216
|
+
r
|
|
217
|
+
]), g = (t) => {
|
|
218
|
+
e?.(t), p(t.currentTarget.value);
|
|
219
|
+
}, _ = (e) => {
|
|
220
|
+
t?.(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()));
|
|
221
|
+
};
|
|
222
|
+
return /* @__PURE__ */ w("input", {
|
|
223
|
+
"aria-label": i,
|
|
224
|
+
autoComplete: "off",
|
|
225
|
+
spellCheck: !1,
|
|
226
|
+
...f({
|
|
227
|
+
...n,
|
|
228
|
+
onChange: g,
|
|
229
|
+
onKeyDown: _
|
|
230
|
+
}),
|
|
231
|
+
ref: h,
|
|
232
|
+
type: "text",
|
|
233
|
+
value: o,
|
|
234
|
+
role: "combobox",
|
|
235
|
+
"aria-autocomplete": "list",
|
|
236
|
+
"aria-expanded": s > 0,
|
|
237
|
+
"aria-controls": a,
|
|
238
|
+
"data-ui": "command-palette-input",
|
|
239
|
+
css: A
|
|
240
|
+
});
|
|
241
|
+
}), G = g(function({ onMouseDown: e, children: t, ...n }, r) {
|
|
242
|
+
let { label: i, listId: a, matchCount: o, elementsRef: s, setListElement: c, getFloatingProps: l } = z("List"), u = D([c, r]), d = (t) => {
|
|
243
|
+
e?.(t), t.preventDefault();
|
|
244
|
+
};
|
|
245
|
+
return /* @__PURE__ */ w("div", {
|
|
246
|
+
"aria-label": i,
|
|
247
|
+
...l({
|
|
248
|
+
...n,
|
|
249
|
+
onMouseDown: d
|
|
250
|
+
}),
|
|
251
|
+
ref: u,
|
|
252
|
+
id: a,
|
|
253
|
+
role: "listbox",
|
|
254
|
+
hidden: o === 0,
|
|
255
|
+
"data-ui": "command-palette-list",
|
|
256
|
+
css: j,
|
|
257
|
+
children: /* @__PURE__ */ w(E, {
|
|
258
|
+
elementsRef: s,
|
|
259
|
+
children: t
|
|
260
|
+
})
|
|
261
|
+
});
|
|
262
|
+
}), K = g(function({ children: e, ...t }, n) {
|
|
263
|
+
let { matchCount: r, emptyMessage: a } = z("Empty");
|
|
264
|
+
return r > 0 ? null : /* @__PURE__ */ w("div", {
|
|
265
|
+
...t,
|
|
266
|
+
ref: n,
|
|
267
|
+
"data-ui": "command-palette-empty",
|
|
268
|
+
css: F,
|
|
269
|
+
children: i(e) ? e : a
|
|
270
|
+
});
|
|
271
|
+
}), q = g(function({ label: e, children: t, "aria-labelledby": n, ...r }, i) {
|
|
272
|
+
let { visibleGroupIds: a } = z("Group"), o = y(), s = `${o}-heading`;
|
|
273
|
+
return /* @__PURE__ */ T("div", {
|
|
274
|
+
...r,
|
|
275
|
+
ref: i,
|
|
276
|
+
role: "group",
|
|
277
|
+
"aria-labelledby": [n, s].filter(Boolean).join(" "),
|
|
278
|
+
hidden: !a.has(o),
|
|
279
|
+
"data-ui": "command-palette-group",
|
|
280
|
+
css: M,
|
|
281
|
+
children: [/* @__PURE__ */ w("div", {
|
|
282
|
+
id: s,
|
|
283
|
+
css: N,
|
|
284
|
+
children: e
|
|
285
|
+
}), /* @__PURE__ */ w(R.Provider, {
|
|
286
|
+
value: o,
|
|
287
|
+
children: t
|
|
288
|
+
})]
|
|
289
|
+
});
|
|
290
|
+
}), J = g(function({ value: e, onSelect: t, keywords: n, onClick: r, children: i, ...a }, l) {
|
|
291
|
+
let { baseId: u, activeIndex: d, matchedValues: f, getItemProps: p, setOpen: m, registration: h } = z("Item"), g = v(R), _ = x(null), { ref: y, index: b } = o(e, h, _, (e, t) => ({
|
|
292
|
+
index: e,
|
|
293
|
+
label: t,
|
|
294
|
+
keywords: n,
|
|
295
|
+
groupId: g
|
|
296
|
+
})), S = D([
|
|
297
|
+
y,
|
|
298
|
+
_,
|
|
299
|
+
l
|
|
300
|
+
]), C = b !== -1 && d === b, T = (e) => {
|
|
301
|
+
r?.(e), !e.defaultPrevented && (t?.(), m(!1));
|
|
302
|
+
};
|
|
303
|
+
return /* @__PURE__ */ w("div", {
|
|
304
|
+
...p({
|
|
305
|
+
id: c(u, e),
|
|
306
|
+
...a,
|
|
307
|
+
onClick: T
|
|
308
|
+
}),
|
|
309
|
+
ref: S,
|
|
310
|
+
role: "option",
|
|
311
|
+
"aria-selected": C,
|
|
312
|
+
hidden: !f.has(e),
|
|
313
|
+
"data-active": C || void 0,
|
|
314
|
+
"data-ui": "command-palette-item",
|
|
315
|
+
css: [s, P],
|
|
316
|
+
children: i
|
|
317
|
+
});
|
|
318
|
+
}), Y = Object.assign(V, {
|
|
319
|
+
Trigger: H,
|
|
320
|
+
Content: U,
|
|
321
|
+
Input: W,
|
|
322
|
+
List: G,
|
|
323
|
+
Empty: K,
|
|
324
|
+
Group: q,
|
|
325
|
+
Item: J
|
|
326
|
+
});
|
|
327
|
+
//#endregion
|
|
328
|
+
export { Y as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as CommandPalette } from "./command-palette-BRJ8A5De.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { t as e } from "./css-CW_HG55W.js";
|
|
2
|
+
import { n as t } from "./layout-style-B_6YHQ6Q.js";
|
|
3
|
+
import { forwardRef as n } from "react";
|
|
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 = t("paddingInline"), c = n(function({ size: e = "lg", paddingInline: t = "md", ...n }, i) {
|
|
21
|
+
return /* @__PURE__ */ r("div", {
|
|
22
|
+
...n,
|
|
23
|
+
ref: i,
|
|
24
|
+
"data-ui": "container",
|
|
25
|
+
"data-size": e,
|
|
26
|
+
css: [
|
|
27
|
+
a,
|
|
28
|
+
o[e],
|
|
29
|
+
s[t]
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
//#endregion
|
|
34
|
+
export { c as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as Container } from "./container-COHiEjI8.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { keyframes as n, css as t } from "@emotion/react";
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { t as e } from "./css-CW_HG55W.js";
|
|
2
|
+
import { t } from "./use-controlled-state-DQXkiTQI.js";
|
|
3
|
+
import { t as n } from "./renderable-DwPvt1I8.js";
|
|
4
|
+
import { t as r } from "./calendar-DcCAiN3b.js";
|
|
5
|
+
import { n as i } from "./surface-Bo_aSQOb.js";
|
|
6
|
+
import { t as a } from "./use-overlay-floating-CsZd3qxa.js";
|
|
7
|
+
import { t as o } from "./text-field-BlP8qGn_.js";
|
|
8
|
+
import { createContext as s, forwardRef 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";
|
|
9
|
+
import { vars as g } from "@jfrader/tokens/vars";
|
|
10
|
+
import { jsx as _, jsxs as v } from "@emotion/react/jsx-runtime";
|
|
11
|
+
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";
|
|
12
|
+
//#region src/components/date-picker/date-picker.tsx
|
|
13
|
+
var E = "bottom-start", D = /* @__PURE__ */ new Set(["Enter", "ArrowDown"]), O = " ", k = "[data-ui=\"calendar-day\"][tabindex=\"0\"]", A = "[data-ui=\"calendar-day\"]", j = /^\d{4}-\d{2}-\d{2}$/, M = {
|
|
14
|
+
calendar: "gregory",
|
|
15
|
+
timeZone: "UTC",
|
|
16
|
+
dateStyle: "medium"
|
|
17
|
+
}, N = s(null);
|
|
18
|
+
function P(e) {
|
|
19
|
+
let t = l(N);
|
|
20
|
+
if (!t) throw Error(`DatePicker.${e} must be rendered inside <DatePicker>.`);
|
|
21
|
+
return t;
|
|
22
|
+
}
|
|
23
|
+
var F = (e, t) => String(e).padStart(t, "0"), I = (e, t, n) => `${F(e, 4)}-${F(t, 2)}-${F(n, 2)}`;
|
|
24
|
+
function L(e) {
|
|
25
|
+
if (e === void 0 || !j.test(e)) return;
|
|
26
|
+
let [t = NaN, n = NaN, r = NaN] = e.split("-").map(Number), i = new Date(Date.UTC(0, 0, 1));
|
|
27
|
+
return i.setUTCFullYear(t, n - 1, r), I(i.getUTCFullYear(), i.getUTCMonth() + 1, i.getUTCDate()) === e ? i : void 0;
|
|
28
|
+
}
|
|
29
|
+
var R = (e) => L(e) ? e : void 0;
|
|
30
|
+
function ee(e, t, n) {
|
|
31
|
+
return t !== void 0 && e < t ? t : n !== void 0 && e > n ? n : e;
|
|
32
|
+
}
|
|
33
|
+
function te() {
|
|
34
|
+
let e = /* @__PURE__ */ new Date();
|
|
35
|
+
return I(e.getFullYear(), e.getMonth() + 1, e.getDate());
|
|
36
|
+
}
|
|
37
|
+
var ne = () => typeof navigator > "u" ? void 0 : navigator.language;
|
|
38
|
+
function re(e, t) {
|
|
39
|
+
let n = new Intl.DisplayNames(t, { type: "dateTimeField" });
|
|
40
|
+
return e.formatToParts(/* @__PURE__ */ new Date(0)).map((e) => e.type === "literal" ? e.value : n.of(e.type) ?? e.value).join("");
|
|
41
|
+
}
|
|
42
|
+
function z(e) {
|
|
43
|
+
let t = e?.querySelector(k) ?? null;
|
|
44
|
+
return t?.focus({ preventScroll: !0 }), t;
|
|
45
|
+
}
|
|
46
|
+
var B = e({
|
|
47
|
+
cursor: "pointer",
|
|
48
|
+
"&:disabled": { cursor: "not-allowed" }
|
|
49
|
+
}), V = e({
|
|
50
|
+
...i,
|
|
51
|
+
borderRadius: g.radius.md,
|
|
52
|
+
boxShadow: g.shadow.overlay,
|
|
53
|
+
padding: g.space[3]
|
|
54
|
+
});
|
|
55
|
+
function H({ value: e, defaultValue: n, onValueChange: r, open: i, defaultOpen: o = !1, onOpenChange: s, min: c, max: l, locale: d, firstDayOfWeek: f, disabled: g = !1, name: y, placeholder: b, children: w }) {
|
|
56
|
+
let [D, O] = t(e, n, r), [k = !1, A] = t(i, o, 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: $ } = a({
|
|
57
|
+
open: I,
|
|
58
|
+
placement: E,
|
|
59
|
+
onOpenChange: (e, t, n) => {
|
|
60
|
+
F && e || (e || (H.current = n === "escape-key"), A(e));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
u(() => {
|
|
64
|
+
F && (H.current = !1, k && A(!1));
|
|
65
|
+
}, [
|
|
66
|
+
F,
|
|
67
|
+
k,
|
|
68
|
+
A
|
|
69
|
+
]), u(() => {
|
|
70
|
+
!F && !I && H.current && (H.current = !1, Z.domReference.current?.focus());
|
|
71
|
+
}, [
|
|
72
|
+
F,
|
|
73
|
+
I,
|
|
74
|
+
Z
|
|
75
|
+
]);
|
|
76
|
+
let ie = x($, {
|
|
77
|
+
enabled: !F,
|
|
78
|
+
keyboardHandlers: !1
|
|
79
|
+
}), ae = S($, {
|
|
80
|
+
escapeKey: !0,
|
|
81
|
+
outsidePress: !0
|
|
82
|
+
}), oe = T($, { role: "dialog" }), { getReferenceProps: se, getFloatingProps: ce } = C([
|
|
83
|
+
ie,
|
|
84
|
+
ae,
|
|
85
|
+
oe
|
|
86
|
+
]), le = p(() => ({
|
|
87
|
+
open: I,
|
|
88
|
+
disabled: F,
|
|
89
|
+
value: D,
|
|
90
|
+
displayValue: q,
|
|
91
|
+
placeholder: b ?? G,
|
|
92
|
+
initialMonth: X,
|
|
93
|
+
min: J,
|
|
94
|
+
max: Y,
|
|
95
|
+
locale: U,
|
|
96
|
+
firstDayOfWeek: f,
|
|
97
|
+
inputLabelling: z,
|
|
98
|
+
gridRef: V,
|
|
99
|
+
refs: Z,
|
|
100
|
+
floatingContext: $,
|
|
101
|
+
floatingStyles: Q,
|
|
102
|
+
getReferenceProps: se,
|
|
103
|
+
getFloatingProps: ce,
|
|
104
|
+
requestOpenChange: (e) => {
|
|
105
|
+
F && e || A(e);
|
|
106
|
+
},
|
|
107
|
+
selectDate: (e) => {
|
|
108
|
+
F || (O(e), H.current = !0, A(!1));
|
|
109
|
+
},
|
|
110
|
+
setInputLabelling: B,
|
|
111
|
+
setInputDisabled: P
|
|
112
|
+
}), [
|
|
113
|
+
I,
|
|
114
|
+
F,
|
|
115
|
+
D,
|
|
116
|
+
q,
|
|
117
|
+
b,
|
|
118
|
+
G,
|
|
119
|
+
X,
|
|
120
|
+
J,
|
|
121
|
+
Y,
|
|
122
|
+
U,
|
|
123
|
+
f,
|
|
124
|
+
z,
|
|
125
|
+
Z,
|
|
126
|
+
$,
|
|
127
|
+
Q,
|
|
128
|
+
se,
|
|
129
|
+
ce,
|
|
130
|
+
A,
|
|
131
|
+
O
|
|
132
|
+
]);
|
|
133
|
+
return /* @__PURE__ */ v(N.Provider, {
|
|
134
|
+
value: le,
|
|
135
|
+
children: [w, y !== void 0 && /* @__PURE__ */ _("input", {
|
|
136
|
+
type: "hidden",
|
|
137
|
+
name: y,
|
|
138
|
+
value: D ?? "",
|
|
139
|
+
disabled: F
|
|
140
|
+
})]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
var U = c(function({ label: e, id: t, disabled: r, slotProps: i, onKeyDown: a, onKeyUp: s, ...c }, l) {
|
|
144
|
+
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, l]), T = d(), E = t ?? T, k = `${E}-label`, A = n(e), j = c["aria-labelledby"], M = c["aria-label"], N = M ?? (typeof e == "string" ? e : void 0), F = p || r === !0;
|
|
145
|
+
f(() => (S(r === !0), () => S(!1)), [r, S]), f(() => (x(j === void 0 ? M === void 0 ? typeof e == "string" ? { label: e } : { labelledBy: A ? k : void 0 } : { label: M } : { labelledBy: j }), () => x(null)), [
|
|
146
|
+
j,
|
|
147
|
+
M,
|
|
148
|
+
e,
|
|
149
|
+
A,
|
|
150
|
+
k,
|
|
151
|
+
x
|
|
152
|
+
]);
|
|
153
|
+
let I = () => {
|
|
154
|
+
F || (u ? z(g.current) : b(!0));
|
|
155
|
+
}, L = (e) => {
|
|
156
|
+
a?.(e), !(e.defaultPrevented || F) && (e.key === O ? e.preventDefault() : D.has(e.key) && (e.preventDefault(), I()));
|
|
157
|
+
}, R = (e) => {
|
|
158
|
+
s?.(e), !(e.defaultPrevented || F || e.key !== O) && I();
|
|
159
|
+
};
|
|
160
|
+
return /* @__PURE__ */ _(o, {
|
|
161
|
+
...y({
|
|
162
|
+
...c,
|
|
163
|
+
onKeyDown: L,
|
|
164
|
+
onKeyUp: R
|
|
165
|
+
}),
|
|
166
|
+
ref: C,
|
|
167
|
+
id: E,
|
|
168
|
+
label: A ? /* @__PURE__ */ _("span", {
|
|
169
|
+
id: k,
|
|
170
|
+
children: e
|
|
171
|
+
}) : e,
|
|
172
|
+
slotProps: {
|
|
173
|
+
...i,
|
|
174
|
+
control: {
|
|
175
|
+
...i?.control,
|
|
176
|
+
css: [B, i?.control?.css]
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
value: m,
|
|
180
|
+
placeholder: h,
|
|
181
|
+
disabled: F,
|
|
182
|
+
readOnly: !0,
|
|
183
|
+
role: "combobox",
|
|
184
|
+
"aria-label": N,
|
|
185
|
+
"aria-autocomplete": "none",
|
|
186
|
+
"data-state": u ? "open" : "closed",
|
|
187
|
+
"data-ui": "date-picker-input"
|
|
188
|
+
});
|
|
189
|
+
}), W = c(function({ style: e, ...t }, n) {
|
|
190
|
+
let { open: i, value: a, initialMonth: o, min: s, max: c, locale: l, firstDayOfWeek: u, inputLabelling: d, gridRef: f, refs: p, floatingContext: h, floatingStyles: g, getFloatingProps: x, selectDate: S } = P("Popup"), C = w([p.setFloating, n]), T = m(null), E = w([(e) => {
|
|
191
|
+
f.current = e, T.current = z(e);
|
|
192
|
+
}]);
|
|
193
|
+
if (!i) return null;
|
|
194
|
+
let D = t["aria-labelledby"] !== void 0 || t["aria-label"] !== void 0 ? {} : d?.labelledBy === void 0 ? { "aria-label": d?.label } : { "aria-labelledby": d.labelledBy }, O = (e) => {
|
|
195
|
+
let t = e.target.closest(A);
|
|
196
|
+
if (t?.disabled) return;
|
|
197
|
+
let n = t?.dataset.date;
|
|
198
|
+
n !== void 0 && S(n);
|
|
199
|
+
}, k = (e) => {
|
|
200
|
+
e.target.closest(A)?.disabled && e.preventDefault();
|
|
201
|
+
};
|
|
202
|
+
return /* @__PURE__ */ _(b, { children: /* @__PURE__ */ _(y, {
|
|
203
|
+
context: h,
|
|
204
|
+
modal: !1,
|
|
205
|
+
initialFocus: T,
|
|
206
|
+
returnFocus: !1,
|
|
207
|
+
children: /* @__PURE__ */ _("div", {
|
|
208
|
+
...x({
|
|
209
|
+
...D,
|
|
210
|
+
...t
|
|
211
|
+
}),
|
|
212
|
+
ref: C,
|
|
213
|
+
"data-ui": "date-picker-popup",
|
|
214
|
+
style: {
|
|
215
|
+
...e,
|
|
216
|
+
...g
|
|
217
|
+
},
|
|
218
|
+
css: V,
|
|
219
|
+
children: /* @__PURE__ */ v(r, {
|
|
220
|
+
value: a ?? "",
|
|
221
|
+
defaultVisibleMonth: o,
|
|
222
|
+
min: s,
|
|
223
|
+
max: c,
|
|
224
|
+
locale: l,
|
|
225
|
+
firstDayOfWeek: u,
|
|
226
|
+
children: [/* @__PURE__ */ _(r.Header, {}), /* @__PURE__ */ _(r.Grid, {
|
|
227
|
+
ref: E,
|
|
228
|
+
onClick: O,
|
|
229
|
+
onPointerDownCapture: k
|
|
230
|
+
})]
|
|
231
|
+
})
|
|
232
|
+
})
|
|
233
|
+
}) });
|
|
234
|
+
}), G = Object.assign(H, {
|
|
235
|
+
Input: U,
|
|
236
|
+
Popup: W
|
|
237
|
+
});
|
|
238
|
+
//#endregion
|
|
239
|
+
export { G as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as DatePicker } from "./date-picker-D1GwiRB9.js";
|