@jfrader/ui 0.7.0 → 0.7.3
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 +14 -28
- package/dist/avatar-BuM1zB_f.js +164 -0
- package/dist/{avatar-group-BlMLNw4J.js → avatar-group-D1UEihvh.js} +1 -1
- package/dist/avatar-group.js +1 -1
- package/dist/avatar.js +1 -1
- package/dist/card-frame-CcLa6NQ4.js +13 -0
- package/dist/{chat-thread-DkB-WMWJ.js → chat-thread-CMhwxhoA.js} +1 -1
- package/dist/chat-thread.js +1 -1
- package/dist/{comment-thread-DXfqgRNI.js → comment-thread-DbOzYr0q.js} +1 -1
- package/dist/comment-thread.js +1 -1
- package/dist/editable-details-BndqEnYF.js +365 -0
- package/dist/editable-details.js +2 -0
- package/dist/flip-game-card-BOJIhBrh.js +104 -0
- package/dist/flip-game-card.js +2 -0
- package/dist/{game-card-Oeu74giK.js → game-card-Bnhpz78f.js} +42 -49
- package/dist/game-card.js +1 -1
- package/dist/{hover-card-Dgu2CwMD.js → hover-card--ijYr1cd.js} +1 -1
- package/dist/hover-card.js +1 -1
- package/dist/index.js +90 -90
- package/dist/{locale-switcher-DTkySKsM.js → locale-switcher-Ce_tN4Gb.js} +2 -2
- package/dist/locale-switcher.js +1 -1
- package/dist/{thread-parts-Cpktor6D.js → thread-parts-DbKhuwVU.js} +1 -1
- package/dist/{timeline-BcF46lG9.js → timeline-BPKY94mT.js} +1 -1
- package/dist/timeline.js +1 -1
- package/dist/{billing-toggle-CgC7yxxo.js → toggle-subscription-Ytz7ew1q.js} +19 -19
- package/dist/toggle-subscription.js +2 -0
- package/dist/types/components/avatar/avatar.d.ts +3 -1
- package/dist/types/components/editable-details/editable-details.d.ts +58 -0
- package/dist/types/components/editable-details/index.d.ts +2 -0
- package/dist/types/components/flip-game-card/flip-game-card.d.ts +22 -0
- package/dist/types/components/flip-game-card/index.d.ts +2 -0
- package/dist/types/components/locale-switcher/locale-switcher.d.ts +2 -2
- package/dist/types/components/toggle-subscription/index.d.ts +2 -0
- package/dist/types/components/toggle-subscription/toggle-subscription.d.ts +57 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/styling/motion-timings.d.ts +8 -0
- package/dist/types/styling/theme.d.ts +5 -0
- package/dist/{user-menu-MctRu_Lh.js → user-menu-Czrrk93A.js} +1 -1
- package/dist/user-menu.js +1 -1
- package/package.json +14 -14
- package/dist/avatar-sPxDqFiZ.js +0 -133
- package/dist/billing-toggle.js +0 -2
- package/dist/in-view-title-BUZCMqge.js +0 -225
- package/dist/in-view-title.js +0 -2
- package/dist/shortcut-recorder-VgTQdjjn.js +0 -688
- package/dist/shortcut-recorder.js +0 -2
- package/dist/types/components/billing-toggle/billing-toggle.d.ts +0 -57
- package/dist/types/components/billing-toggle/index.d.ts +0 -2
- package/dist/types/components/in-view-title/in-view-title.d.ts +0 -23
- package/dist/types/components/in-view-title/index.d.ts +0 -1
- package/dist/types/components/shortcut-recorder/index.d.ts +0 -2
- package/dist/types/components/shortcut-recorder/shortcut-recorder.d.ts +0 -117
|
@@ -1,688 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { i as e } from "./css-BYJhdGh-.js";
|
|
3
|
-
import { n as t } from "./focus-ring-BK5W5_NY.js";
|
|
4
|
-
import { n, r } from "./media-8yrN85VT.js";
|
|
5
|
-
import { t as i } from "./sx-BJXJ2xJK.js";
|
|
6
|
-
import { t as a } from "./use-controlled-state-DpeVQZNR.js";
|
|
7
|
-
import { t as o } from "./visually-hidden-DgVO3NaB.js";
|
|
8
|
-
import { t as s } from "./renderable-DzcIj1Lo.js";
|
|
9
|
-
import { t as c } from "./button-C6OV0C7J.js";
|
|
10
|
-
import { a as ee, i as te, n as l, t as u } from "./field-anatomy-BDIP42MI.js";
|
|
11
|
-
import { t as ne } from "./text-field-D0VP7b4P.js";
|
|
12
|
-
import { t as d } from "./kbd-BI_9qzYr.js";
|
|
13
|
-
import { useEffect as f, useId as re, useMemo as ie, useRef as p, useState as m, useSyncExternalStore as h } from "react";
|
|
14
|
-
import { vars as g } from "@jfrader/tokens/vars";
|
|
15
|
-
import { Fragment as ae, jsx as _, jsxs as v } from "@emotion/react/jsx-runtime";
|
|
16
|
-
import { useMergeRefs as oe } from "@floating-ui/react";
|
|
17
|
-
//#region src/components/shortcut-recorder/shortcut-recorder.tsx
|
|
18
|
-
var y = [
|
|
19
|
-
"mod",
|
|
20
|
-
"ctrl",
|
|
21
|
-
"alt",
|
|
22
|
-
"shift",
|
|
23
|
-
"meta"
|
|
24
|
-
], se = {
|
|
25
|
-
Comma: ",",
|
|
26
|
-
Equal: "=",
|
|
27
|
-
Minus: "-",
|
|
28
|
-
Period: ".",
|
|
29
|
-
Slash: "/",
|
|
30
|
-
Semicolon: ";",
|
|
31
|
-
Quote: "'",
|
|
32
|
-
BracketLeft: "[",
|
|
33
|
-
BracketRight: "]",
|
|
34
|
-
Backslash: "\\",
|
|
35
|
-
Backquote: "`",
|
|
36
|
-
Space: "space",
|
|
37
|
-
Escape: "escape",
|
|
38
|
-
Backspace: "backspace",
|
|
39
|
-
Delete: "delete",
|
|
40
|
-
Enter: "enter",
|
|
41
|
-
ArrowUp: "arrowup",
|
|
42
|
-
ArrowDown: "arrowdown",
|
|
43
|
-
ArrowLeft: "arrowleft",
|
|
44
|
-
ArrowRight: "arrowright",
|
|
45
|
-
Home: "home",
|
|
46
|
-
End: "end",
|
|
47
|
-
PageUp: "pageup",
|
|
48
|
-
PageDown: "pagedown",
|
|
49
|
-
Insert: "insert"
|
|
50
|
-
}, ce = new Set(Object.values(se)), b = {
|
|
51
|
-
ctrl: "Control",
|
|
52
|
-
alt: "Alt",
|
|
53
|
-
shift: "Shift",
|
|
54
|
-
meta: "Meta",
|
|
55
|
-
space: "Space",
|
|
56
|
-
escape: "Escape",
|
|
57
|
-
backspace: "Backspace",
|
|
58
|
-
delete: "Delete",
|
|
59
|
-
enter: "Enter",
|
|
60
|
-
arrowup: "Up arrow",
|
|
61
|
-
arrowdown: "Down arrow",
|
|
62
|
-
arrowleft: "Left arrow",
|
|
63
|
-
arrowright: "Right arrow",
|
|
64
|
-
pageup: "Page Up",
|
|
65
|
-
pagedown: "Page Down",
|
|
66
|
-
home: "Home",
|
|
67
|
-
end: "End",
|
|
68
|
-
insert: "Insert",
|
|
69
|
-
",": "Comma",
|
|
70
|
-
"=": "Equals",
|
|
71
|
-
"-": "Minus",
|
|
72
|
-
".": "Period",
|
|
73
|
-
"/": "Slash",
|
|
74
|
-
";": "Semicolon",
|
|
75
|
-
"'": "Quote",
|
|
76
|
-
"[": "Left bracket",
|
|
77
|
-
"]": "Right bracket",
|
|
78
|
-
"\\": "Backslash",
|
|
79
|
-
"`": "Backquote"
|
|
80
|
-
}, x = {
|
|
81
|
-
ctrl: "⌃",
|
|
82
|
-
alt: "⌥",
|
|
83
|
-
shift: "⇧",
|
|
84
|
-
meta: "⌘"
|
|
85
|
-
}, S = (e) => /^[a-z0-9]$/.test(e) || /^f(?:[1-9]|1[0-9]|2[0-4])$/.test(e) || ce.has(e), C = (e) => e === "mac" ? "meta" : "ctrl";
|
|
86
|
-
function w(e, t) {
|
|
87
|
-
let n = e.toLowerCase().split("+").map((e) => e.trim()), r = n.at(-1);
|
|
88
|
-
if (!r || !S(r)) return null;
|
|
89
|
-
let i = n.slice(0, -1);
|
|
90
|
-
if (i.some((e) => !y.some((t) => t === e))) return null;
|
|
91
|
-
let a = i.map((e) => e === C(t) ? "mod" : e);
|
|
92
|
-
return new Set(a).size === a.length ? [...y.filter((e) => a.includes(e)), r].join("+") : null;
|
|
93
|
-
}
|
|
94
|
-
function T(e, t) {
|
|
95
|
-
return y.filter((n) => ({
|
|
96
|
-
mod: t === "mac" ? e.metaKey : e.ctrlKey,
|
|
97
|
-
ctrl: t === "mac" && e.ctrlKey,
|
|
98
|
-
alt: e.altKey,
|
|
99
|
-
shift: e.shiftKey,
|
|
100
|
-
meta: t === "other" && e.metaKey
|
|
101
|
-
})[n]);
|
|
102
|
-
}
|
|
103
|
-
function E(e, t) {
|
|
104
|
-
if (e.repeat || e.isComposing || [
|
|
105
|
-
"Dead",
|
|
106
|
-
"Process",
|
|
107
|
-
"Unidentified",
|
|
108
|
-
"AltGraph"
|
|
109
|
-
].includes(e.key) || e.getModifierState?.("AltGraph")) return null;
|
|
110
|
-
let n = se[e.code] ?? (/^Key[A-Z]$/.test(e.code) ? e.code.slice(3).toLowerCase() : /^Digit[0-9]$/.test(e.code) ? e.code.slice(5) : e.code.toLowerCase());
|
|
111
|
-
return S(n) ? [...T(e, t), n].join("+") : null;
|
|
112
|
-
}
|
|
113
|
-
function le(e, t, n) {
|
|
114
|
-
let r = w(t, n);
|
|
115
|
-
return r !== null && r === E(e, n);
|
|
116
|
-
}
|
|
117
|
-
function ue(e, t) {
|
|
118
|
-
return `${new Intl.NumberFormat(t).format(e)} ${new Intl.PluralRules(t).select(e) === "one" ? "shortcut" : "shortcuts"}`;
|
|
119
|
-
}
|
|
120
|
-
var D = {
|
|
121
|
-
placeholder: "Record shortcut",
|
|
122
|
-
recording: "Recording",
|
|
123
|
-
canceled: "Recording canceled",
|
|
124
|
-
cleared: "Shortcut cleared",
|
|
125
|
-
noShortcut: "No shortcut",
|
|
126
|
-
clearLabel: "Clear shortcut",
|
|
127
|
-
cancelLabel: "Cancel",
|
|
128
|
-
confirmLabel: "Use anyway",
|
|
129
|
-
reset: (e) => `Reset to ${e}`,
|
|
130
|
-
set: (e) => `Shortcut set to ${e}`,
|
|
131
|
-
requireModifier: (e) => `Use ${e === "mac" ? "Command, Control" : "Control, Meta"} or Alt, or a function key`,
|
|
132
|
-
conflict: (e, t, n) => `${e}: ${n ? "Reserved shortcut" : "Already assigned"} — ${t.label}`,
|
|
133
|
-
listLabel: "Keyboard shortcuts",
|
|
134
|
-
searchLabel: "Search shortcuts",
|
|
135
|
-
searchPlaceholder: "Search shortcuts",
|
|
136
|
-
empty: "No shortcuts found",
|
|
137
|
-
results: ue,
|
|
138
|
-
keyName: (e, t) => {
|
|
139
|
-
let n = e === "mod" ? C(t) : e, r = n === "meta" && t === "mac" ? "Command" : n === "alt" && t === "mac" ? "Option" : b[n] ?? n.toUpperCase();
|
|
140
|
-
return {
|
|
141
|
-
label: t === "mac" ? x[n] ?? (n.length === 1 ? n.toUpperCase() : r) : n.length === 1 ? n.toUpperCase() : r,
|
|
142
|
-
spoken: r
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
function O(e, t, n = D) {
|
|
147
|
-
let r = w(e, t)?.split("+").map((e) => n.keyName(e, t)) ?? [];
|
|
148
|
-
return {
|
|
149
|
-
text: r.map((e) => e.label).join(" + "),
|
|
150
|
-
spoken: r.length ? r.map((e) => e.spoken).join(" + ") : n.noShortcut
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
var de = () => () => {}, k = () => "other", A = () => /Mac|iPhone|iPad/.test(globalThis.navigator?.platform ?? "") ? "mac" : "other";
|
|
154
|
-
function fe(e) {
|
|
155
|
-
let t = h(de, A, k);
|
|
156
|
-
return e ?? t;
|
|
157
|
-
}
|
|
158
|
-
function j(e, t) {
|
|
159
|
-
let [n, r] = m(/* @__PURE__ */ new Set());
|
|
160
|
-
return f(() => {
|
|
161
|
-
let n = t ?? (typeof window > "u" ? void 0 : window);
|
|
162
|
-
if (!e || !n) {
|
|
163
|
-
r(/* @__PURE__ */ new Set());
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
let i = (e) => {
|
|
167
|
-
if (e.isComposing || e.getModifierState("AltGraph")) return;
|
|
168
|
-
let t = E(e, "other"), n = T(e, "other").map((e) => e === "mod" ? "ctrl" : e), i = t?.split("+").at(-1);
|
|
169
|
-
r((e) => /* @__PURE__ */ new Set([
|
|
170
|
-
...e,
|
|
171
|
-
...n,
|
|
172
|
-
...i ? [i] : []
|
|
173
|
-
]));
|
|
174
|
-
}, a = () => r(/* @__PURE__ */ new Set()), o = (e) => {
|
|
175
|
-
if (e.key === "Meta") {
|
|
176
|
-
a();
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
let t = E({
|
|
180
|
-
code: e.code,
|
|
181
|
-
key: e.key,
|
|
182
|
-
ctrlKey: !1,
|
|
183
|
-
altKey: !1,
|
|
184
|
-
shiftKey: !1,
|
|
185
|
-
metaKey: !1
|
|
186
|
-
}, "other"), n = {
|
|
187
|
-
Control: "ctrl",
|
|
188
|
-
Alt: "alt",
|
|
189
|
-
Shift: "shift"
|
|
190
|
-
}[e.key] ?? t;
|
|
191
|
-
r((e) => new Set([...e].filter((e) => e !== n)));
|
|
192
|
-
}, s = () => {
|
|
193
|
-
n.document.visibilityState !== "visible" && a();
|
|
194
|
-
};
|
|
195
|
-
return n.addEventListener("keydown", i), n.addEventListener("keyup", o), n.addEventListener("blur", a), n.document.addEventListener("visibilitychange", s), () => {
|
|
196
|
-
n.removeEventListener("keydown", i), n.removeEventListener("keyup", o), n.removeEventListener("blur", a), n.document.removeEventListener("visibilitychange", s);
|
|
197
|
-
};
|
|
198
|
-
}, [e, t]), n;
|
|
199
|
-
}
|
|
200
|
-
function pe(e = !0) {
|
|
201
|
-
return j(e);
|
|
202
|
-
}
|
|
203
|
-
var me = e({
|
|
204
|
-
display: "flex",
|
|
205
|
-
alignItems: "center",
|
|
206
|
-
flexWrap: "wrap",
|
|
207
|
-
gap: g.space[2],
|
|
208
|
-
minInlineSize: 0,
|
|
209
|
-
maxInlineSize: "100%"
|
|
210
|
-
}), M = e({
|
|
211
|
-
minBlockSize: g.space[8],
|
|
212
|
-
blockSize: "auto",
|
|
213
|
-
maxInlineSize: "100%",
|
|
214
|
-
whiteSpace: "normal",
|
|
215
|
-
paddingBlock: g.space[1]
|
|
216
|
-
}), he = e({
|
|
217
|
-
display: "inline-flex",
|
|
218
|
-
flexWrap: "wrap",
|
|
219
|
-
alignItems: "center",
|
|
220
|
-
gap: g.space[1],
|
|
221
|
-
direction: "ltr",
|
|
222
|
-
maxInlineSize: "100%"
|
|
223
|
-
}), ge = e({
|
|
224
|
-
"@starting-style": { opacity: 0 },
|
|
225
|
-
transitionProperty: "border-color, color, opacity",
|
|
226
|
-
transitionDuration: g.motion.duration.fast,
|
|
227
|
-
transitionTimingFunction: g.motion.easeStandard,
|
|
228
|
-
"&[data-pressed=\"true\"]": {
|
|
229
|
-
borderColor: g.color.borderControl,
|
|
230
|
-
color: g.color.accentText
|
|
231
|
-
},
|
|
232
|
-
[r]: { transitionDuration: "0s" },
|
|
233
|
-
[n]: {
|
|
234
|
-
borderColor: "ButtonText",
|
|
235
|
-
"&[data-pressed=\"true\"]": {
|
|
236
|
-
borderBlockEndColor: "Highlight",
|
|
237
|
-
color: "Highlight"
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}), _e = e({
|
|
241
|
-
fontSize: g.textSize.xs,
|
|
242
|
-
paddingInline: g.space[1]
|
|
243
|
-
}), ve = e({
|
|
244
|
-
display: "inline-flex",
|
|
245
|
-
flexWrap: "wrap",
|
|
246
|
-
alignItems: "center",
|
|
247
|
-
gap: g.space[2],
|
|
248
|
-
boxSizing: "border-box",
|
|
249
|
-
maxInlineSize: "100%",
|
|
250
|
-
paddingBlock: g.space[1],
|
|
251
|
-
paddingInline: g.space[3],
|
|
252
|
-
border: `1px solid ${g.color.borderControl}`,
|
|
253
|
-
borderRadius: g.radius.sm,
|
|
254
|
-
backgroundColor: g.color.surface,
|
|
255
|
-
color: g.color.text,
|
|
256
|
-
fontFamily: g.font.sans,
|
|
257
|
-
lineHeight: g.lineHeight.base,
|
|
258
|
-
cursor: "pointer",
|
|
259
|
-
transitionProperty: "background-color, border-color",
|
|
260
|
-
transitionDuration: g.motion.duration.fast,
|
|
261
|
-
transitionTimingFunction: g.motion.easeStandard,
|
|
262
|
-
"&:focus-visible": t,
|
|
263
|
-
"&[aria-pressed=\"true\"]": { backgroundColor: g.color.accentSoft },
|
|
264
|
-
"&:disabled, &[aria-disabled=\"true\"]": { cursor: "not-allowed" },
|
|
265
|
-
[r]: { transitionDuration: "0s" },
|
|
266
|
-
[n]: { borderColor: "ButtonText" }
|
|
267
|
-
}), ye = {
|
|
268
|
-
sm: e({
|
|
269
|
-
minBlockSize: g.space[8],
|
|
270
|
-
fontSize: g.textSize.sm
|
|
271
|
-
}),
|
|
272
|
-
md: e({
|
|
273
|
-
minBlockSize: g.space[10],
|
|
274
|
-
fontSize: g.textSize.sm
|
|
275
|
-
}),
|
|
276
|
-
lg: e({
|
|
277
|
-
minBlockSize: g.space[12],
|
|
278
|
-
fontSize: g.textSize.md
|
|
279
|
-
})
|
|
280
|
-
}, be = e({
|
|
281
|
-
color: g.color.text,
|
|
282
|
-
fontSize: g.textSize.sm,
|
|
283
|
-
fontWeight: g.fontWeight.medium
|
|
284
|
-
}), xe = e({
|
|
285
|
-
color: g.color.text,
|
|
286
|
-
backgroundColor: g.color.warningSoft,
|
|
287
|
-
padding: g.space[2],
|
|
288
|
-
borderRadius: g.radius.sm,
|
|
289
|
-
transitionProperty: "opacity",
|
|
290
|
-
transitionDuration: g.motion.duration.fast,
|
|
291
|
-
transitionTimingFunction: g.motion.easeStandard,
|
|
292
|
-
"@starting-style": { opacity: 0 },
|
|
293
|
-
[r]: { transitionDuration: "0s" }
|
|
294
|
-
}), N = e({
|
|
295
|
-
display: "grid",
|
|
296
|
-
gap: g.space[4],
|
|
297
|
-
color: g.color.text
|
|
298
|
-
}), Se = e({
|
|
299
|
-
display: "grid",
|
|
300
|
-
gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 16rem), 1fr))",
|
|
301
|
-
gap: g.space[6]
|
|
302
|
-
}), Ce = e({
|
|
303
|
-
display: "flex",
|
|
304
|
-
justifyContent: "space-between",
|
|
305
|
-
alignItems: "center",
|
|
306
|
-
flexWrap: "wrap",
|
|
307
|
-
gap: g.space[2],
|
|
308
|
-
paddingBlock: g.space[2]
|
|
309
|
-
}), we = e({
|
|
310
|
-
listStyle: "none",
|
|
311
|
-
padding: 0,
|
|
312
|
-
margin: 0
|
|
313
|
-
}), Te = e({
|
|
314
|
-
fontSize: g.textSize.md,
|
|
315
|
-
margin: 0
|
|
316
|
-
});
|
|
317
|
-
function P({ shortcut: e, platform: t, pressed: n, size: r = "md", messages: a = D, locale: o, slotProps: s, className: c, sx: ee, ...te }) {
|
|
318
|
-
let l = fe(t), u = w(e, l);
|
|
319
|
-
return /* @__PURE__ */ _(i, {
|
|
320
|
-
className: c,
|
|
321
|
-
styles: he,
|
|
322
|
-
sx: ee,
|
|
323
|
-
children: (t) => /* @__PURE__ */ _("span", {
|
|
324
|
-
role: "img",
|
|
325
|
-
"aria-label": O(e, l, a).spoken,
|
|
326
|
-
...te,
|
|
327
|
-
"data-ui": "shortcut-recorder-keys",
|
|
328
|
-
className: t,
|
|
329
|
-
children: /* @__PURE__ */ _(d.Group, {
|
|
330
|
-
"aria-hidden": !0,
|
|
331
|
-
css: he,
|
|
332
|
-
children: u?.split("+").map((e) => /* @__PURE__ */ _(d, {
|
|
333
|
-
"data-pressed": n?.has(e) || n?.has(e === "mod" ? C(l) : e) || void 0,
|
|
334
|
-
className: s?.key?.className,
|
|
335
|
-
css: [
|
|
336
|
-
ge,
|
|
337
|
-
r === "sm" && _e,
|
|
338
|
-
s?.key?.css
|
|
339
|
-
],
|
|
340
|
-
children: a.keyName(e, l).label
|
|
341
|
-
}, e))
|
|
342
|
-
})
|
|
343
|
-
})
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
P.displayName = "ShortcutRecorder.Keys";
|
|
347
|
-
function Ee({ ref: e, value: t, defaultValue: n = null, onValueChange: r, recording: i, defaultRecording: ne = !1, onRecordingChange: ie, resetValue: h, bindings: g = [], reservedBindings: y = [], warnReserved: se = !0, requireModifier: ce = !0, platform: b, label: x, description: S, error: C, hideLabel: le = !1, size: ue = "md", locale: de, messages: k = D, readOnly: A = !1, disabled: j = !1, name: pe, dir: _e, slotProps: N, className: Se, sx: Ce, onClick: we, onKeyDown: Te, onKeyUp: Ee, onBlur: De, onFocus: Oe, "aria-labelledby": ke, "aria-describedby": Ae, "aria-invalid": je, id: Me, children: Ne, ...F }) {
|
|
348
|
-
let I = fe(b), L = (e) => e === null ? null : w(e, I), Pe = p({
|
|
349
|
-
value: n,
|
|
350
|
-
recording: ne
|
|
351
|
-
}), R = p(void 0), [z, Fe] = a(t === void 0 ? void 0 : L(t), L(n), (e) => r?.(e, R.current ? { replaced: R.current } : {})), [B, Ie] = a(i, ne, ie), [V, H] = m(null), [Le, U] = m(""), [Re, W] = m(""), [ze, G] = m(null), [Be, K] = m([]), [Ve, He] = m(!1), q = p(null), Ue = oe([q, e]), J = p(!1), Y = p(!1), We = p(!1), Ge = s(x) && x !== "", X = ee({
|
|
352
|
-
id: Me,
|
|
353
|
-
description: S === "" ? void 0 : S,
|
|
354
|
-
error: C === "" ? void 0 : C,
|
|
355
|
-
"aria-describedby": Ae,
|
|
356
|
-
"aria-invalid": je
|
|
357
|
-
}), Ke = re(), qe = `${Ke}-summary`, Je = `${Ke}-label`, Ye = `${Ke}-conflict`, Z = !j && !A, Q = () => {
|
|
358
|
-
Ie(!1), K([]), W("");
|
|
359
|
-
}, $ = (e, t) => {
|
|
360
|
-
R.current = t, Fe(e), R.current = void 0;
|
|
361
|
-
}, Xe = () => {
|
|
362
|
-
H(null), Q(), $(null), U(""), G({
|
|
363
|
-
value: null,
|
|
364
|
-
text: k.cleared
|
|
365
|
-
});
|
|
366
|
-
}, Ze = () => {
|
|
367
|
-
H(null), G(null), U(k.canceled), q.current?.focus();
|
|
368
|
-
};
|
|
369
|
-
f(() => {
|
|
370
|
-
let e = q.current;
|
|
371
|
-
if (!e) return;
|
|
372
|
-
let t = e.ownerDocument.defaultView, n = () => {
|
|
373
|
-
K([]), J.current = !1, He(!1);
|
|
374
|
-
}, r = () => {
|
|
375
|
-
e.ownerDocument.visibilityState !== "visible" && n();
|
|
376
|
-
};
|
|
377
|
-
return t?.addEventListener("blur", n), e.ownerDocument.addEventListener("visibilitychange", r), () => {
|
|
378
|
-
t?.removeEventListener("blur", n), e.ownerDocument.removeEventListener("visibilitychange", r);
|
|
379
|
-
};
|
|
380
|
-
}, []), f(() => {
|
|
381
|
-
let e = q.current?.form, n = () => {
|
|
382
|
-
t === void 0 && Fe(L(Pe.current.value)), i === void 0 && Ie(Pe.current.recording), H(null), K([]), J.current = !1, U(""), G(null), W("");
|
|
383
|
-
};
|
|
384
|
-
return e?.addEventListener("reset", n), () => e?.removeEventListener("reset", n);
|
|
385
|
-
});
|
|
386
|
-
let Qe = V ? k.conflict(O(V.shortcut, I, k).spoken, V.binding, V.reserved) : "", $e = L(h === void 0 ? Pe.current.value : h), et = z ? O(z, I, k).spoken : k.noShortcut;
|
|
387
|
-
return /* @__PURE__ */ v(te, {
|
|
388
|
-
"data-ui": "shortcut-recorder",
|
|
389
|
-
dir: _e,
|
|
390
|
-
className: Se,
|
|
391
|
-
sx: Ce,
|
|
392
|
-
part: N?.root,
|
|
393
|
-
children: [
|
|
394
|
-
Ge && /* @__PURE__ */ _("span", {
|
|
395
|
-
id: Je,
|
|
396
|
-
className: N?.label?.className,
|
|
397
|
-
css: [
|
|
398
|
-
be,
|
|
399
|
-
le && o,
|
|
400
|
-
N?.label?.css
|
|
401
|
-
],
|
|
402
|
-
children: x
|
|
403
|
-
}),
|
|
404
|
-
/* @__PURE__ */ v("div", {
|
|
405
|
-
className: N?.control?.className,
|
|
406
|
-
css: [me, N?.control?.css],
|
|
407
|
-
children: [/* @__PURE__ */ v("button", {
|
|
408
|
-
...F,
|
|
409
|
-
ref: Ue,
|
|
410
|
-
id: X.id,
|
|
411
|
-
type: "button",
|
|
412
|
-
disabled: j,
|
|
413
|
-
"aria-disabled": A || F["aria-disabled"],
|
|
414
|
-
"aria-pressed": B ?? !1,
|
|
415
|
-
"aria-invalid": X.ariaInvalid,
|
|
416
|
-
"aria-labelledby": [
|
|
417
|
-
ke,
|
|
418
|
-
Ge && Je,
|
|
419
|
-
(ke || Ge || !F["aria-label"]) && qe
|
|
420
|
-
].filter(Boolean).join(" ") || void 0,
|
|
421
|
-
"aria-describedby": [X.describedBy, V && Ye].filter(Boolean).join(" ") || void 0,
|
|
422
|
-
className: N?.recorder?.className,
|
|
423
|
-
css: [
|
|
424
|
-
ve,
|
|
425
|
-
ye[ue],
|
|
426
|
-
N?.recorder?.css
|
|
427
|
-
],
|
|
428
|
-
onFocus: (e) => {
|
|
429
|
-
He(!0), We.current = !1, Oe?.(e);
|
|
430
|
-
},
|
|
431
|
-
onBlur: (e) => {
|
|
432
|
-
He(!1), J.current = !1, Y.current = !1, We.current ? K([]) : Q(), We.current = !1, De?.(e);
|
|
433
|
-
},
|
|
434
|
-
onClick: (e) => {
|
|
435
|
-
we?.(e), !Z || e.defaultPrevented || Y.current ? Y.current = !1 : (H(null), K([]), G(null), W(""), J.current = !1, Ie(!B), U(B ? k.canceled : ""));
|
|
436
|
-
},
|
|
437
|
-
onKeyDown: (e) => {
|
|
438
|
-
if (Te?.(e), !Z || e.defaultPrevented || !Ve || e.currentTarget.ownerDocument.activeElement !== e.currentTarget) return;
|
|
439
|
-
let t = e.nativeEvent;
|
|
440
|
-
if (t.isComposing || t.repeat || [
|
|
441
|
-
"Dead",
|
|
442
|
-
"Process",
|
|
443
|
-
"Unidentified",
|
|
444
|
-
"AltGraph"
|
|
445
|
-
].includes(t.key) || t.getModifierState("AltGraph")) return;
|
|
446
|
-
let n = !e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey;
|
|
447
|
-
if (e.key === "Tab") {
|
|
448
|
-
B && (We.current = !0, Q());
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
if (n && e.key === "Escape" && (B || V)) {
|
|
452
|
-
e.preventDefault(), e.stopPropagation(), V ? Ze() : (Q(), U(k.canceled));
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
if (n && ["Backspace", "Delete"].includes(e.key)) {
|
|
456
|
-
e.preventDefault(), e.stopPropagation(), J.current || (J.current = !0, Xe());
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
if (!B) return;
|
|
460
|
-
n && ["Enter", " "].includes(e.key) && (e.preventDefault(), Y.current = e.key === " "), K(T(t, I));
|
|
461
|
-
let r = E(t, I);
|
|
462
|
-
if (!r || J.current) return;
|
|
463
|
-
if (ce && !e.ctrlKey && !e.altKey && !e.metaKey && !/^f\d+$/.test(r)) {
|
|
464
|
-
W(k.requireModifier(I));
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
|
-
e.preventDefault(), e.stopPropagation(), J.current = !0, Q();
|
|
468
|
-
let i = g.find((e) => w(e.shortcut, I) === r), a = !i && se ? y.find((e) => w(e.shortcut, I) === r) : void 0;
|
|
469
|
-
i || a ? H({
|
|
470
|
-
shortcut: r,
|
|
471
|
-
binding: i ?? a,
|
|
472
|
-
reserved: !!a
|
|
473
|
-
}) : ($(r), U(""), G({
|
|
474
|
-
value: r,
|
|
475
|
-
text: k.set(O(r, I, k).spoken)
|
|
476
|
-
}));
|
|
477
|
-
},
|
|
478
|
-
onKeyUp: (e) => {
|
|
479
|
-
Ee?.(e), J.current = !1, Y.current && e.key === " " && e.preventDefault(), Y.current = !1, B && K(e.key === "Meta" ? [] : T(e.nativeEvent, I));
|
|
480
|
-
},
|
|
481
|
-
children: [/* @__PURE__ */ _("span", {
|
|
482
|
-
id: qe,
|
|
483
|
-
css: o,
|
|
484
|
-
children: B ? [
|
|
485
|
-
k.recording,
|
|
486
|
-
...Be.map((e) => k.keyName(e, I).spoken),
|
|
487
|
-
et
|
|
488
|
-
].join(" ") : z ? et : `${k.placeholder} ${et}`
|
|
489
|
-
}), /* @__PURE__ */ _("span", {
|
|
490
|
-
"aria-hidden": !0,
|
|
491
|
-
css: he,
|
|
492
|
-
children: B ? /* @__PURE__ */ v(ae, { children: [k.recording, Be.map((e) => /* @__PURE__ */ _(d, {
|
|
493
|
-
css: [ge, N?.key?.css],
|
|
494
|
-
className: N?.key?.className,
|
|
495
|
-
children: k.keyName(e, I).label
|
|
496
|
-
}, e))] }) : z ? /* @__PURE__ */ _(P, {
|
|
497
|
-
shortcut: z,
|
|
498
|
-
platform: I,
|
|
499
|
-
messages: k,
|
|
500
|
-
locale: de,
|
|
501
|
-
"aria-hidden": !0,
|
|
502
|
-
role: "presentation",
|
|
503
|
-
slotProps: { key: N?.key }
|
|
504
|
-
}) : k.placeholder
|
|
505
|
-
})]
|
|
506
|
-
}), /* @__PURE__ */ v("div", {
|
|
507
|
-
css: [me, N?.actions?.css],
|
|
508
|
-
className: N?.actions?.className,
|
|
509
|
-
children: [/* @__PURE__ */ _(c, {
|
|
510
|
-
size: "sm",
|
|
511
|
-
variant: "outline",
|
|
512
|
-
disabled: j,
|
|
513
|
-
"aria-disabled": A,
|
|
514
|
-
css: [M, N?.reset?.css],
|
|
515
|
-
className: N?.reset?.className,
|
|
516
|
-
onClick: () => {
|
|
517
|
-
Z && (Q(), H(null), G(null), $($e));
|
|
518
|
-
},
|
|
519
|
-
children: k.reset($e ? O($e, I, k).spoken : k.noShortcut)
|
|
520
|
-
}), /* @__PURE__ */ _(c, {
|
|
521
|
-
size: "sm",
|
|
522
|
-
variant: "outline",
|
|
523
|
-
disabled: j,
|
|
524
|
-
"aria-disabled": A,
|
|
525
|
-
css: [M, N?.clear?.css],
|
|
526
|
-
className: N?.clear?.className,
|
|
527
|
-
onClick: () => {
|
|
528
|
-
Z && Xe();
|
|
529
|
-
},
|
|
530
|
-
children: k.clearLabel
|
|
531
|
-
})]
|
|
532
|
-
})]
|
|
533
|
-
}),
|
|
534
|
-
/* @__PURE__ */ _(u, {
|
|
535
|
-
id: X.descriptionId,
|
|
536
|
-
part: N?.description,
|
|
537
|
-
children: S === "" ? void 0 : S
|
|
538
|
-
}),
|
|
539
|
-
/* @__PURE__ */ _(l, {
|
|
540
|
-
id: X.errorId,
|
|
541
|
-
part: N?.error,
|
|
542
|
-
children: C === "" ? void 0 : C
|
|
543
|
-
}),
|
|
544
|
-
V && /* @__PURE__ */ v("div", {
|
|
545
|
-
onKeyDown: (e) => {
|
|
546
|
-
e.key === "Escape" && !e.defaultPrevented && (e.preventDefault(), e.stopPropagation(), Ze());
|
|
547
|
-
},
|
|
548
|
-
children: [/* @__PURE__ */ _("div", {
|
|
549
|
-
id: Ye,
|
|
550
|
-
css: [xe, N?.message?.css],
|
|
551
|
-
className: N?.message?.className,
|
|
552
|
-
children: Qe
|
|
553
|
-
}), /* @__PURE__ */ v("div", {
|
|
554
|
-
css: me,
|
|
555
|
-
children: [/* @__PURE__ */ _(c, {
|
|
556
|
-
size: "sm",
|
|
557
|
-
disabled: j,
|
|
558
|
-
"aria-disabled": A,
|
|
559
|
-
css: [M, N?.confirm?.css],
|
|
560
|
-
className: N?.confirm?.className,
|
|
561
|
-
onClick: () => {
|
|
562
|
-
Z && ($(V.shortcut, V.reserved ? void 0 : V.binding), H(null), U(""), G({
|
|
563
|
-
value: V.shortcut,
|
|
564
|
-
text: k.set(O(V.shortcut, I, k).spoken)
|
|
565
|
-
}), q.current?.focus());
|
|
566
|
-
},
|
|
567
|
-
children: k.confirmLabel
|
|
568
|
-
}), /* @__PURE__ */ _(c, {
|
|
569
|
-
size: "sm",
|
|
570
|
-
disabled: j,
|
|
571
|
-
"aria-disabled": A,
|
|
572
|
-
css: [M, N?.cancel?.css],
|
|
573
|
-
className: N?.cancel?.className,
|
|
574
|
-
onClick: Ze,
|
|
575
|
-
children: k.cancelLabel
|
|
576
|
-
})]
|
|
577
|
-
})]
|
|
578
|
-
}),
|
|
579
|
-
/* @__PURE__ */ _("span", {
|
|
580
|
-
role: "status",
|
|
581
|
-
"aria-live": "polite",
|
|
582
|
-
"aria-atomic": "true",
|
|
583
|
-
css: [o, N?.status?.css],
|
|
584
|
-
className: N?.status?.className,
|
|
585
|
-
children: Qe || (B ? Re || k.recording : ze && z === ze.value ? ze.text : Le)
|
|
586
|
-
}),
|
|
587
|
-
pe !== void 0 && /* @__PURE__ */ _("input", {
|
|
588
|
-
type: "hidden",
|
|
589
|
-
name: pe,
|
|
590
|
-
value: z ?? "",
|
|
591
|
-
disabled: j,
|
|
592
|
-
form: F.form
|
|
593
|
-
})
|
|
594
|
-
]
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
Ee.displayName = "ShortcutRecorder";
|
|
598
|
-
function De({ groups: e, searchable: t = !0, highlightPressed: n = !0, platform: r, locale: s, messages: c = D, inputValue: ee, defaultInputValue: te = "", onInputChange: l, slotProps: u, className: d, sx: f, ref: re, ...p }) {
|
|
599
|
-
let [h, g] = a(ee, te, l), [ae, y] = m(null), se = oe([re, y]), ce = j(n, ae?.ownerDocument.defaultView), b = ie(() => {
|
|
600
|
-
let t = new Intl.Collator(s, {
|
|
601
|
-
usage: "search",
|
|
602
|
-
sensitivity: "base"
|
|
603
|
-
}), n = h ?? "", r = Array.from(n), i = (e) => {
|
|
604
|
-
let i = Array.from(e);
|
|
605
|
-
return !n || i.some((e, a) => t.compare(i.slice(a, a + r.length).join(""), n) === 0);
|
|
606
|
-
};
|
|
607
|
-
return e.map((e) => ({
|
|
608
|
-
...e,
|
|
609
|
-
items: e.items.filter((e) => i(`${e.label} ${e.keywords ?? ""} ${e.shortcut}`))
|
|
610
|
-
})).filter((e) => e.items.length);
|
|
611
|
-
}, [
|
|
612
|
-
s,
|
|
613
|
-
h,
|
|
614
|
-
e
|
|
615
|
-
]), x = b.reduce((e, t) => e + t.items.length, 0), S = c.results === ue ? ue(x, s) : c.results(x);
|
|
616
|
-
return /* @__PURE__ */ _(i, {
|
|
617
|
-
className: [d, u?.root?.className].filter(Boolean).join(" "),
|
|
618
|
-
styles: [N, u?.root?.css],
|
|
619
|
-
sx: f,
|
|
620
|
-
children: (e) => /* @__PURE__ */ v("section", {
|
|
621
|
-
"aria-label": c.listLabel,
|
|
622
|
-
...p,
|
|
623
|
-
ref: se,
|
|
624
|
-
"data-ui": "shortcut-recorder-list",
|
|
625
|
-
className: e,
|
|
626
|
-
children: [
|
|
627
|
-
t && /* @__PURE__ */ _(ne, {
|
|
628
|
-
label: c.searchLabel,
|
|
629
|
-
placeholder: c.searchPlaceholder,
|
|
630
|
-
value: h ?? "",
|
|
631
|
-
onValueChange: g,
|
|
632
|
-
slotProps: { control: u?.search },
|
|
633
|
-
onKeyDown: (e) => {
|
|
634
|
-
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), g(""));
|
|
635
|
-
}
|
|
636
|
-
}),
|
|
637
|
-
/* @__PURE__ */ _("div", {
|
|
638
|
-
css: [Se, u?.groups?.css],
|
|
639
|
-
className: u?.groups?.className,
|
|
640
|
-
children: b.map((e) => /* @__PURE__ */ v("div", {
|
|
641
|
-
css: u?.group?.css,
|
|
642
|
-
className: u?.group?.className,
|
|
643
|
-
children: [/* @__PURE__ */ _("h3", {
|
|
644
|
-
css: [Te, u?.heading?.css],
|
|
645
|
-
className: u?.heading?.className,
|
|
646
|
-
children: e.label
|
|
647
|
-
}), /* @__PURE__ */ _("ul", {
|
|
648
|
-
css: we,
|
|
649
|
-
children: e.items.map((e) => /* @__PURE__ */ v("li", {
|
|
650
|
-
css: [Ce, u?.item?.css],
|
|
651
|
-
className: u?.item?.className,
|
|
652
|
-
children: [/* @__PURE__ */ _("span", { children: e.label }), /* @__PURE__ */ _(P, {
|
|
653
|
-
shortcut: e.shortcut,
|
|
654
|
-
platform: r,
|
|
655
|
-
locale: s,
|
|
656
|
-
messages: c,
|
|
657
|
-
pressed: n ? ce : void 0,
|
|
658
|
-
css: u?.keys?.css,
|
|
659
|
-
className: u?.keys?.className
|
|
660
|
-
})]
|
|
661
|
-
}, e.label))
|
|
662
|
-
})]
|
|
663
|
-
}, e.label))
|
|
664
|
-
}),
|
|
665
|
-
!x && /* @__PURE__ */ _("p", {
|
|
666
|
-
css: u?.empty?.css,
|
|
667
|
-
className: u?.empty?.className,
|
|
668
|
-
children: c.empty
|
|
669
|
-
}),
|
|
670
|
-
/* @__PURE__ */ _("span", {
|
|
671
|
-
role: "status",
|
|
672
|
-
"aria-live": "polite",
|
|
673
|
-
"aria-atomic": "true",
|
|
674
|
-
css: [o, u?.status?.css],
|
|
675
|
-
className: u?.status?.className,
|
|
676
|
-
children: S
|
|
677
|
-
})
|
|
678
|
-
]
|
|
679
|
-
})
|
|
680
|
-
});
|
|
681
|
-
}
|
|
682
|
-
De.displayName = "ShortcutRecorder.List";
|
|
683
|
-
var Oe = Object.assign(Ee, {
|
|
684
|
-
Keys: P,
|
|
685
|
-
List: De
|
|
686
|
-
});
|
|
687
|
-
//#endregion
|
|
688
|
-
export { w as a, le as i, D as n, pe as o, O as r, fe as s, Oe as t };
|