@haklex/rich-editor-ui 0.57.0 → 0.59.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/dist/components/action-button/index.d.ts +13 -3
- package/dist/components/action-button/index.d.ts.map +1 -1
- package/dist/components/action-button/styles.css.d.ts +41 -25
- package/dist/components/action-button/styles.css.d.ts.map +1 -1
- package/dist/components/alert/index.d.ts +3 -2
- package/dist/components/alert/index.d.ts.map +1 -1
- package/dist/components/alert/styles.css.d.ts +46 -6
- package/dist/components/alert/styles.css.d.ts.map +1 -1
- package/dist/components/animated-tabs/styles.css.d.ts.map +1 -1
- package/dist/components/auto-resize-textarea/styles.css.d.ts.map +1 -1
- package/dist/components/badge/index.d.ts +2 -1
- package/dist/components/badge/index.d.ts.map +1 -1
- package/dist/components/badge/styles.css.d.ts +16 -11
- package/dist/components/badge/styles.css.d.ts.map +1 -1
- package/dist/components/checkbox/index.d.ts +3 -1
- package/dist/components/checkbox/index.d.ts.map +1 -1
- package/dist/components/checkbox/styles.css.d.ts +3 -6
- package/dist/components/checkbox/styles.css.d.ts.map +1 -1
- package/dist/components/code-block/CodeBlockCard.d.ts.map +1 -1
- package/dist/components/code-block/styles.css.d.ts.map +1 -1
- package/dist/components/collapsible/index.d.ts.map +1 -1
- package/dist/components/collapsible/styles.css.d.ts +1 -0
- package/dist/components/collapsible/styles.css.d.ts.map +1 -1
- package/dist/components/color-picker/index.d.ts +5 -1
- package/dist/components/color-picker/index.d.ts.map +1 -1
- package/dist/components/color-picker/picker-view.d.ts.map +1 -1
- package/dist/components/color-picker/preset-view.d.ts +12 -0
- package/dist/components/color-picker/preset-view.d.ts.map +1 -0
- package/dist/components/color-picker/presets.d.ts +12 -0
- package/dist/components/color-picker/presets.d.ts.map +1 -0
- package/dist/components/color-picker/recent.d.ts +5 -0
- package/dist/components/color-picker/recent.d.ts.map +1 -0
- package/dist/components/color-picker/styles.css.d.ts +8 -4
- package/dist/components/color-picker/styles.css.d.ts.map +1 -1
- package/dist/components/combobox/styles.css.d.ts +1 -0
- package/dist/components/combobox/styles.css.d.ts.map +1 -1
- package/dist/components/dialog/confirm.d.ts +10 -0
- package/dist/components/dialog/confirm.d.ts.map +1 -0
- package/dist/components/dialog/sheet.d.ts.map +1 -1
- package/dist/components/dialog/stack.d.ts.map +1 -1
- package/dist/components/dialog/store.d.ts +9 -1
- package/dist/components/dialog/store.d.ts.map +1 -1
- package/dist/components/dialog/styles.css.d.ts.map +1 -1
- package/dist/components/dropdown-menu/index.d.ts +12 -2
- package/dist/components/dropdown-menu/index.d.ts.map +1 -1
- package/dist/components/dropdown-menu/styles.css.d.ts +4 -0
- package/dist/components/dropdown-menu/styles.css.d.ts.map +1 -1
- package/dist/components/field/index.d.ts +12 -0
- package/dist/components/field/index.d.ts.map +1 -0
- package/dist/components/field/styles.css.d.ts +5 -0
- package/dist/components/field/styles.css.d.ts.map +1 -0
- package/dist/components/kbd/index.d.ts +15 -0
- package/dist/components/kbd/index.d.ts.map +1 -0
- package/dist/components/kbd/keys.d.ts +14 -0
- package/dist/components/kbd/keys.d.ts.map +1 -0
- package/dist/components/kbd/styles.css.d.ts +8 -0
- package/dist/components/kbd/styles.css.d.ts.map +1 -0
- package/dist/components/modal-shell/index.d.ts +35 -0
- package/dist/components/modal-shell/index.d.ts.map +1 -0
- package/dist/components/modal-shell/styles.css.d.ts +13 -0
- package/dist/components/modal-shell/styles.css.d.ts.map +1 -0
- package/dist/components/popover/index.d.ts +22 -2
- package/dist/components/popover/index.d.ts.map +1 -1
- package/dist/components/popover/styles.css.d.ts +9 -0
- package/dist/components/popover/styles.css.d.ts.map +1 -1
- package/dist/components/quote-attribution/QuoteAttributionPlugin.d.ts.map +1 -1
- package/dist/components/quote-attribution/styles.css.d.ts +4 -7
- package/dist/components/quote-attribution/styles.css.d.ts.map +1 -1
- package/dist/components/scroll-area/styles.css.d.ts.map +1 -1
- package/dist/components/segmented-control/styles.css.d.ts +10 -6
- package/dist/components/segmented-control/styles.css.d.ts.map +1 -1
- package/dist/components/select/styles.css.d.ts.map +1 -1
- package/dist/components/spinner/index.d.ts +1 -1
- package/dist/components/spinner/index.d.ts.map +1 -1
- package/dist/components/spinner/styles.css.d.ts +9 -2
- package/dist/components/spinner/styles.css.d.ts.map +1 -1
- package/dist/components/status-dot/styles.css.d.ts +4 -4
- package/dist/components/status-dot/styles.css.d.ts.map +1 -1
- package/dist/components/text-input/index.d.ts +10 -0
- package/dist/components/text-input/index.d.ts.map +1 -0
- package/dist/components/text-input/styles.css.d.ts +3 -0
- package/dist/components/text-input/styles.css.d.ts.map +1 -0
- package/dist/components/toast/index.d.ts +4 -0
- package/dist/components/toast/index.d.ts.map +1 -0
- package/dist/components/toast/store.d.ts +21 -0
- package/dist/components/toast/store.d.ts.map +1 -0
- package/dist/components/toast/styles.css.d.ts +8 -0
- package/dist/components/toast/styles.css.d.ts.map +1 -0
- package/dist/components/tooltip/index.d.ts +2 -1
- package/dist/components/tooltip/index.d.ts.map +1 -1
- package/dist/components/tooltip/styles.css.d.ts +1 -0
- package/dist/components/tooltip/styles.css.d.ts.map +1 -1
- package/dist/hooks/use-live-edit.d.ts +6 -0
- package/dist/hooks/use-live-edit.d.ts.map +1 -0
- package/dist/index.d.ts +20 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1491 -704
- package/dist/rich-editor-ui.css +1 -1
- package/dist/styles/menu.css.d.ts +14 -0
- package/dist/styles/menu.css.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AlertCircle, AlertTriangle, ArrowLeft, Check, ChevronDown, ChevronRight, ChevronUp, Copy, Info, Pipette, Plus, X } from "lucide-react";
|
|
2
|
+
import { AlertCircle, AlertTriangle, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, Check, CheckCircle2, ChevronDown, ChevronRight, ChevronUp, CircleAlert, CircleCheck, Copy, CornerDownLeft, Delete, Info, LoaderCircle, Pipette, Plus, X } from "lucide-react";
|
|
3
3
|
import { createContext, createElement, forwardRef, use, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
|
|
5
5
|
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
6
|
-
import { PortalThemeProvider, PortalThemeProvider as PortalThemeProvider$1, PortalThemeWrapper, PortalThemeWrapper as PortalThemeWrapper$1,
|
|
6
|
+
import { PortalThemeProvider, PortalThemeProvider as PortalThemeProvider$1, PortalThemeWrapper, PortalThemeWrapper as PortalThemeWrapper$1, usePortalTheme } from "@haklex/rich-style-token";
|
|
7
|
+
import { Tooltip } from "@base-ui/react/tooltip";
|
|
7
8
|
import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
|
|
8
9
|
import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
10
|
+
import { chromeWidth } from "@haklex/rich-style-token/styles";
|
|
11
|
+
import { createPortal } from "react-dom";
|
|
9
12
|
import { Menu } from "@base-ui/react/menu";
|
|
10
13
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
11
|
-
import { $getNodeByKey, $getRoot } from "lexical";
|
|
12
|
-
import { createPortal } from "react-dom";
|
|
14
|
+
import { $getNodeByKey, $getRoot, $getSelection, $isRangeSelection } from "lexical";
|
|
13
15
|
import { Select as Select$1 } from "@base-ui/react/select";
|
|
14
|
-
import { Tooltip } from "@base-ui/react/tooltip";
|
|
15
16
|
//#region ../../node_modules/.pnpm/@vanilla-extract+recipes@0.5.7_@vanilla-extract+css@1.21.3/node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js
|
|
16
17
|
function toPrimitive(t, r) {
|
|
17
18
|
if ("object" != typeof t || !t) return t;
|
|
@@ -101,43 +102,49 @@ var createRuntimeFn = (config) => {
|
|
|
101
102
|
};
|
|
102
103
|
//#endregion
|
|
103
104
|
//#region src/components/action-button/styles.css.ts
|
|
104
|
-
var
|
|
105
|
+
var levelTone = {
|
|
106
|
+
"1": "_73ej2i1",
|
|
107
|
+
"2": "_73ej2i2",
|
|
108
|
+
"3": "_73ej2i3",
|
|
109
|
+
"4": "_73ej2i4"
|
|
110
|
+
};
|
|
111
|
+
var semanticClassNames = {
|
|
105
112
|
actionBar: "re-ui-action-bar",
|
|
106
113
|
actionButton: "re-ui-action-btn",
|
|
107
114
|
actionButtonEnd: "re-ui-action-btn--end",
|
|
108
115
|
actionButtonDanger: "re-ui-action-btn--danger",
|
|
109
116
|
actionButtonIcon: "re-ui-action-btn--icon"
|
|
110
117
|
};
|
|
111
|
-
var actionBar = "
|
|
118
|
+
var actionBar = "_73ej2i5";
|
|
112
119
|
var actionButton$1 = createRuntimeFn({
|
|
113
|
-
defaultClassName: "
|
|
120
|
+
defaultClassName: "_73ej2i6",
|
|
114
121
|
variantClassNames: {
|
|
115
122
|
variant: {
|
|
116
|
-
ghost: "
|
|
117
|
-
solid: "
|
|
118
|
-
outline: "
|
|
119
|
-
accent: "
|
|
123
|
+
ghost: "_73ej2i7",
|
|
124
|
+
solid: "_73ej2i8",
|
|
125
|
+
outline: "_73ej2i9",
|
|
126
|
+
accent: "_73ej2ia"
|
|
120
127
|
},
|
|
121
128
|
size: {
|
|
122
|
-
sm: "
|
|
123
|
-
md: "
|
|
124
|
-
lg: "
|
|
129
|
+
sm: "_73ej2ib",
|
|
130
|
+
md: "_73ej2ic",
|
|
131
|
+
lg: "_73ej2id"
|
|
125
132
|
},
|
|
126
133
|
icon: {
|
|
127
|
-
true: "
|
|
128
|
-
false: "
|
|
134
|
+
true: "_73ej2ie",
|
|
135
|
+
false: "_73ej2if"
|
|
129
136
|
},
|
|
130
137
|
end: {
|
|
131
|
-
true: "
|
|
132
|
-
false: "
|
|
138
|
+
true: "_73ej2ig",
|
|
139
|
+
false: "_73ej2ih"
|
|
133
140
|
},
|
|
134
141
|
danger: {
|
|
135
|
-
true: "
|
|
136
|
-
false: "
|
|
142
|
+
true: "_73ej2ii",
|
|
143
|
+
false: "_73ej2ij"
|
|
137
144
|
},
|
|
138
145
|
rounded: {
|
|
139
|
-
true: "
|
|
140
|
-
false: "
|
|
146
|
+
true: "_73ej2ik",
|
|
147
|
+
false: "_73ej2il"
|
|
141
148
|
}
|
|
142
149
|
},
|
|
143
150
|
defaultVariants: {
|
|
@@ -152,27 +159,39 @@ var actionButton$1 = createRuntimeFn({
|
|
|
152
159
|
[{
|
|
153
160
|
icon: true,
|
|
154
161
|
size: "sm"
|
|
155
|
-
}, "
|
|
162
|
+
}, "_73ej2im"],
|
|
156
163
|
[{
|
|
157
164
|
icon: true,
|
|
158
165
|
size: "md"
|
|
159
|
-
}, "
|
|
166
|
+
}, "_73ej2in"],
|
|
160
167
|
[{
|
|
161
168
|
icon: true,
|
|
162
169
|
size: "lg"
|
|
163
|
-
}, "
|
|
170
|
+
}, "_73ej2io"],
|
|
171
|
+
[{
|
|
172
|
+
icon: true,
|
|
173
|
+
variant: "outline"
|
|
174
|
+
}, "_73ej2ip"],
|
|
175
|
+
[{
|
|
176
|
+
icon: true,
|
|
177
|
+
variant: "ghost"
|
|
178
|
+
}, "_73ej2iq"],
|
|
164
179
|
[{
|
|
165
180
|
rounded: true,
|
|
166
181
|
icon: true
|
|
167
|
-
}, "
|
|
168
|
-
[{
|
|
182
|
+
}, "_73ej2ir"],
|
|
183
|
+
[{
|
|
184
|
+
danger: true,
|
|
185
|
+
variant: "solid"
|
|
186
|
+
}, "_73ej2is"],
|
|
187
|
+
[{ danger: true }, "_73ej2it"]
|
|
169
188
|
]
|
|
170
189
|
});
|
|
171
190
|
//#endregion
|
|
172
191
|
//#region src/components/action-button/index.tsx
|
|
173
192
|
function ActionBar({ className, gap, style, ...props }) {
|
|
174
193
|
return /* @__PURE__ */ jsx("div", {
|
|
175
|
-
className: `${actionBar} ${semanticClassNames
|
|
194
|
+
className: `${actionBar} ${semanticClassNames.actionBar}${className ? ` ${className}` : ""}`,
|
|
176
195
|
style: gap != null ? {
|
|
177
196
|
...style,
|
|
178
197
|
gap
|
|
@@ -180,11 +199,12 @@ function ActionBar({ className, gap, style, ...props }) {
|
|
|
180
199
|
...props
|
|
181
200
|
});
|
|
182
201
|
}
|
|
183
|
-
function ActionButton({ variant, size, end = false, danger = false, icon = false, rounded = false, className, type = "button", ...props }) {
|
|
184
|
-
const semanticParts = [semanticClassNames
|
|
185
|
-
if (end) semanticParts.push(semanticClassNames
|
|
186
|
-
if (danger) semanticParts.push(semanticClassNames
|
|
187
|
-
if (icon) semanticParts.push(semanticClassNames
|
|
202
|
+
function ActionButton({ variant, size, end = false, danger = false, icon = false, rounded = false, level, className, type = "button", ...props }) {
|
|
203
|
+
const semanticParts = [semanticClassNames.actionButton];
|
|
204
|
+
if (end) semanticParts.push(semanticClassNames.actionButtonEnd);
|
|
205
|
+
if (danger) semanticParts.push(semanticClassNames.actionButtonDanger);
|
|
206
|
+
if (icon) semanticParts.push(semanticClassNames.actionButtonIcon);
|
|
207
|
+
if (level && !icon) semanticParts.push(levelTone[level]);
|
|
188
208
|
const recipeClass = actionButton$1({
|
|
189
209
|
variant,
|
|
190
210
|
size,
|
|
@@ -200,42 +220,53 @@ function ActionButton({ variant, size, end = false, danger = false, icon = false
|
|
|
200
220
|
});
|
|
201
221
|
}
|
|
202
222
|
function getActionButtonClassName(options) {
|
|
203
|
-
|
|
223
|
+
const { level, ...recipe } = options ?? {};
|
|
224
|
+
const levelClass = level ? ` ${levelTone[level]}` : "";
|
|
225
|
+
return `${actionButton$1(recipe)} ${semanticClassNames.actionButton}${levelClass}`;
|
|
204
226
|
}
|
|
205
227
|
//#endregion
|
|
206
228
|
//#region src/components/alert/styles.css.ts
|
|
207
229
|
var alert = createRuntimeFn({
|
|
208
|
-
defaultClassName: "
|
|
230
|
+
defaultClassName: "_15r7gwx5",
|
|
209
231
|
variantClassNames: { variant: {
|
|
210
|
-
info: "
|
|
211
|
-
|
|
212
|
-
|
|
232
|
+
info: "_15r7gwx6",
|
|
233
|
+
success: "_15r7gwx7",
|
|
234
|
+
warning: "_15r7gwx8",
|
|
235
|
+
error: "_15r7gwx9",
|
|
236
|
+
neutral: "_15r7gwxa"
|
|
213
237
|
} },
|
|
214
238
|
defaultVariants: { variant: "info" },
|
|
215
239
|
compoundVariants: []
|
|
216
240
|
});
|
|
217
|
-
var alertContent = "
|
|
218
|
-
var alertIcon = "
|
|
241
|
+
var alertContent = "_15r7gwxb";
|
|
242
|
+
var alertIcon = "_15r7gwxd";
|
|
219
243
|
//#endregion
|
|
220
244
|
//#region src/components/alert/index.tsx
|
|
221
|
-
var icons = {
|
|
245
|
+
var icons$1 = {
|
|
222
246
|
info: Info,
|
|
247
|
+
success: CheckCircle2,
|
|
223
248
|
warning: AlertTriangle,
|
|
224
|
-
error: AlertCircle
|
|
249
|
+
error: AlertCircle,
|
|
250
|
+
neutral: Info
|
|
225
251
|
};
|
|
226
|
-
function Alert({ variant, children, action, className }) {
|
|
227
|
-
const IconComponent = icons[variant];
|
|
252
|
+
function Alert({ variant, title, children, action, className }) {
|
|
253
|
+
const IconComponent = icons$1[variant];
|
|
228
254
|
return /* @__PURE__ */ jsxs("div", {
|
|
229
255
|
className: `${alert({ variant })}${className ? ` ${className}` : ""}`,
|
|
256
|
+
"data-variant": variant,
|
|
230
257
|
role: "alert",
|
|
231
258
|
children: [
|
|
232
259
|
/* @__PURE__ */ jsx(IconComponent, { className: alertIcon }),
|
|
233
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ jsxs("div", {
|
|
234
261
|
className: alertContent,
|
|
235
|
-
children
|
|
262
|
+
children: [title && /* @__PURE__ */ jsx("div", {
|
|
263
|
+
className: "_15r7gwxc",
|
|
264
|
+
"data-slot": "alert-title",
|
|
265
|
+
children: title
|
|
266
|
+
}), /* @__PURE__ */ jsx("div", { children })]
|
|
236
267
|
}),
|
|
237
268
|
action && /* @__PURE__ */ jsx("div", {
|
|
238
|
-
className: "
|
|
269
|
+
className: "_15r7gwxe",
|
|
239
270
|
children: action
|
|
240
271
|
})
|
|
241
272
|
]
|
|
@@ -385,87 +416,84 @@ var badge = createRuntimeFn({
|
|
|
385
416
|
});
|
|
386
417
|
//#endregion
|
|
387
418
|
//#region src/components/badge/index.tsx
|
|
388
|
-
function Badge({ variant, size, children, className }) {
|
|
389
|
-
return /* @__PURE__ */
|
|
419
|
+
function Badge({ variant, size, dot, children, className }) {
|
|
420
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
390
421
|
className: `${badge({
|
|
391
422
|
variant,
|
|
392
423
|
size
|
|
393
424
|
})}${className ? ` ${className}` : ""}`,
|
|
394
|
-
children
|
|
425
|
+
children: [dot && /* @__PURE__ */ jsx("span", {
|
|
426
|
+
"aria-hidden": true,
|
|
427
|
+
className: "_1vt0sm18",
|
|
428
|
+
"data-slot": "badge-dot"
|
|
429
|
+
}), children]
|
|
395
430
|
});
|
|
396
431
|
}
|
|
397
432
|
//#endregion
|
|
398
433
|
//#region src/components/checkbox/styles.css.ts
|
|
399
|
-
var root = "
|
|
400
|
-
var box = "
|
|
401
|
-
var boxUnchecked = "
|
|
402
|
-
var boxChecked = "
|
|
403
|
-
var
|
|
404
|
-
var
|
|
405
|
-
var
|
|
406
|
-
var ripple = "_10muorcb";
|
|
434
|
+
var root = "_10muorc0";
|
|
435
|
+
var box = "_10muorc2";
|
|
436
|
+
var boxUnchecked = "_10muorc3";
|
|
437
|
+
var boxChecked = "_10muorc4";
|
|
438
|
+
var mark = "_10muorc5";
|
|
439
|
+
var markVisible = "_10muorc6";
|
|
440
|
+
var markHidden = "_10muorc7";
|
|
407
441
|
//#endregion
|
|
408
442
|
//#region src/components/checkbox/index.tsx
|
|
409
443
|
function cx(...args) {
|
|
410
444
|
return args.filter(Boolean).join(" ");
|
|
411
445
|
}
|
|
412
|
-
function AnimatedCheckbox({ label, description, checked: controlledChecked, defaultChecked = false, onChange, disabled = false, className }) {
|
|
446
|
+
function AnimatedCheckbox({ label, description, checked: controlledChecked, defaultChecked = false, indeterminate = false, onChange, disabled = false, className }) {
|
|
413
447
|
const [internalChecked, setInternalChecked] = useState(defaultChecked);
|
|
414
|
-
const [bouncing, setBouncing] = useState(false);
|
|
415
448
|
const isControlled = controlledChecked !== void 0;
|
|
416
449
|
const isChecked = isControlled ? controlledChecked : internalChecked;
|
|
417
|
-
const
|
|
418
|
-
const rippleKey = useRef(0);
|
|
419
|
-
useEffect(() => {
|
|
420
|
-
if (isFirstRender.current) {
|
|
421
|
-
isFirstRender.current = false;
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
setBouncing(true);
|
|
425
|
-
rippleKey.current += 1;
|
|
426
|
-
const timer = setTimeout(() => setBouncing(false), 400);
|
|
427
|
-
return () => clearTimeout(timer);
|
|
428
|
-
}, [isChecked]);
|
|
450
|
+
const filled = indeterminate || isChecked;
|
|
429
451
|
const handleToggle = () => {
|
|
430
452
|
if (disabled) return;
|
|
431
|
-
const next = !isChecked;
|
|
453
|
+
const next = indeterminate ? true : !isChecked;
|
|
432
454
|
if (!isControlled) setInternalChecked(next);
|
|
433
455
|
onChange?.(next);
|
|
434
456
|
};
|
|
435
457
|
return /* @__PURE__ */ jsxs("button", {
|
|
436
|
-
"aria-checked": isChecked,
|
|
458
|
+
"aria-checked": indeterminate ? "mixed" : isChecked,
|
|
437
459
|
"aria-disabled": disabled,
|
|
438
|
-
className: cx(root, disabled && "
|
|
460
|
+
className: cx(root, disabled && "_10muorc1", className),
|
|
439
461
|
role: "checkbox",
|
|
440
462
|
type: "button",
|
|
441
463
|
onClick: handleToggle,
|
|
442
464
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
443
|
-
className: cx(box,
|
|
465
|
+
className: cx(box, filled ? boxChecked : boxUnchecked),
|
|
444
466
|
children: [/* @__PURE__ */ jsx("svg", {
|
|
445
|
-
|
|
467
|
+
"aria-hidden": true,
|
|
468
|
+
className: cx(mark, isChecked && !indeterminate ? markVisible : markHidden),
|
|
446
469
|
fill: "none",
|
|
447
|
-
viewBox: "0 0 12
|
|
470
|
+
viewBox: "0 0 12 12",
|
|
448
471
|
children: /* @__PURE__ */ jsx("path", {
|
|
449
|
-
d: "
|
|
472
|
+
d: "M2.5 6.25L5 8.75L9.5 3.5",
|
|
450
473
|
stroke: "currentColor",
|
|
451
474
|
strokeLinecap: "round",
|
|
452
475
|
strokeLinejoin: "round",
|
|
453
|
-
strokeWidth: "
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
476
|
+
strokeWidth: "1.75"
|
|
477
|
+
})
|
|
478
|
+
}), /* @__PURE__ */ jsx("svg", {
|
|
479
|
+
"aria-hidden": true,
|
|
480
|
+
className: cx(mark, indeterminate ? markVisible : markHidden),
|
|
481
|
+
fill: "none",
|
|
482
|
+
viewBox: "0 0 12 12",
|
|
483
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
484
|
+
d: "M3 6H9",
|
|
485
|
+
stroke: "currentColor",
|
|
486
|
+
strokeLinecap: "round",
|
|
487
|
+
strokeWidth: "1.75"
|
|
460
488
|
})
|
|
461
|
-
})
|
|
489
|
+
})]
|
|
462
490
|
}), (label || description) && /* @__PURE__ */ jsxs("span", {
|
|
463
|
-
className: "
|
|
491
|
+
className: "_10muorc8",
|
|
464
492
|
children: [label && /* @__PURE__ */ jsx("span", {
|
|
465
|
-
className: cx("
|
|
493
|
+
className: cx("_10muorc9", disabled && "_10muorca"),
|
|
466
494
|
children: label
|
|
467
495
|
}), description && /* @__PURE__ */ jsx("span", {
|
|
468
|
-
className: "
|
|
496
|
+
className: "_10muorcb",
|
|
469
497
|
children: description
|
|
470
498
|
})]
|
|
471
499
|
})]
|
|
@@ -603,6 +631,7 @@ function CodeBlockCard({ children, chrome = "bar", className, code, collapsible
|
|
|
603
631
|
}), showCopyButton && /* @__PURE__ */ jsxs("button", {
|
|
604
632
|
"aria-label": copied ? "Copied" : "Copy code",
|
|
605
633
|
className: "_1gq8hf94",
|
|
634
|
+
"data-copied": copied || void 0,
|
|
606
635
|
type: "button",
|
|
607
636
|
onClick: handleCopy,
|
|
608
637
|
children: [copied ? CheckIcon$1 : CopyIcon, /* @__PURE__ */ jsx("span", { children: copied ? "Copied" : "Copy" })]
|
|
@@ -1106,7 +1135,8 @@ function CodeBlock({ chrome, className, collapsible = true, code, language, show
|
|
|
1106
1135
|
//#endregion
|
|
1107
1136
|
//#region src/components/collapsible/styles.css.ts
|
|
1108
1137
|
var trigger$1 = "_1hdi6a90";
|
|
1109
|
-
var panel$
|
|
1138
|
+
var panel$1 = "_1hdi6a92";
|
|
1139
|
+
var panelContent = "_1hdi6a93";
|
|
1110
1140
|
//#endregion
|
|
1111
1141
|
//#region src/components/collapsible/index.tsx
|
|
1112
1142
|
function Collapsible(props) {
|
|
@@ -1116,14 +1146,18 @@ function CollapsibleTrigger({ children, className, hideChevron, ...props }) {
|
|
|
1116
1146
|
return /* @__PURE__ */ jsxs(Collapsible$1.Trigger, {
|
|
1117
1147
|
...props,
|
|
1118
1148
|
className: `${trigger$1}${className ? ` ${className}` : ""}`,
|
|
1149
|
+
"data-no-chevron": hideChevron || void 0,
|
|
1119
1150
|
children: [!hideChevron && /* @__PURE__ */ jsx(ChevronRight, { className: "_1hdi6a91" }), children]
|
|
1120
1151
|
});
|
|
1121
1152
|
}
|
|
1122
1153
|
function CollapsiblePanel({ children, className, ...props }) {
|
|
1123
1154
|
return /* @__PURE__ */ jsx(Collapsible$1.Panel, {
|
|
1124
1155
|
...props,
|
|
1125
|
-
className: `${panel$
|
|
1126
|
-
children
|
|
1156
|
+
className: `${panel$1}${className ? ` ${className}` : ""}`,
|
|
1157
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1158
|
+
className: panelContent,
|
|
1159
|
+
children
|
|
1160
|
+
})
|
|
1127
1161
|
});
|
|
1128
1162
|
}
|
|
1129
1163
|
//#endregion
|
|
@@ -1143,10 +1177,20 @@ function getStrictContext(name) {
|
|
|
1143
1177
|
}
|
|
1144
1178
|
//#endregion
|
|
1145
1179
|
//#region src/components/popover/styles.css.ts
|
|
1146
|
-
var popup$5 = "
|
|
1147
|
-
var arrow = "
|
|
1148
|
-
var title$
|
|
1149
|
-
var description$1 = "
|
|
1180
|
+
var popup$5 = "f2q44l0";
|
|
1181
|
+
var arrow = "f2q44l1";
|
|
1182
|
+
var title$2 = "f2q44l2";
|
|
1183
|
+
var description$1 = "f2q44l3";
|
|
1184
|
+
var size$1 = {
|
|
1185
|
+
sm: "f2q44l4",
|
|
1186
|
+
md: "f2q44l5",
|
|
1187
|
+
lg: "f2q44l6"
|
|
1188
|
+
};
|
|
1189
|
+
var flush = "f2q44l7";
|
|
1190
|
+
var header$2 = "f2q44l8";
|
|
1191
|
+
var headerTitle$1 = "f2q44la";
|
|
1192
|
+
var body$1 = "f2q44lc";
|
|
1193
|
+
var footer$3 = "f2q44ld";
|
|
1150
1194
|
//#endregion
|
|
1151
1195
|
//#region src/components/popover/index.tsx
|
|
1152
1196
|
var [PopoverProvider, usePopover] = getStrictContext("PopoverContext");
|
|
@@ -1179,14 +1223,18 @@ function PopoverPortal({ children, ...props }) {
|
|
|
1179
1223
|
function PopoverPositioner(props) {
|
|
1180
1224
|
return /* @__PURE__ */ jsx(Popover$1.Positioner, { ...props });
|
|
1181
1225
|
}
|
|
1182
|
-
function PopoverPopup({ className, children, ...props }) {
|
|
1226
|
+
function PopoverPopup({ className, children, flush: flush$1, size, ...props }) {
|
|
1227
|
+
const classes = [popup$5];
|
|
1228
|
+
if (size) classes.push(size$1[size]);
|
|
1229
|
+
if (flush$1) classes.push(flush);
|
|
1230
|
+
if (className) classes.push(className);
|
|
1183
1231
|
return /* @__PURE__ */ jsx(Popover$1.Popup, {
|
|
1184
|
-
className:
|
|
1232
|
+
className: classes.join(" "),
|
|
1185
1233
|
...props,
|
|
1186
1234
|
children
|
|
1187
1235
|
});
|
|
1188
1236
|
}
|
|
1189
|
-
function PopoverPanel({ align = "center", side, sideOffset =
|
|
1237
|
+
function PopoverPanel({ align = "center", side, sideOffset = 8, className, children, ...popupProps }) {
|
|
1190
1238
|
return /* @__PURE__ */ jsx(PopoverPortal, { children: /* @__PURE__ */ jsx(PopoverPositioner, {
|
|
1191
1239
|
align,
|
|
1192
1240
|
side,
|
|
@@ -1209,7 +1257,7 @@ function PopoverClose(props) {
|
|
|
1209
1257
|
}
|
|
1210
1258
|
function PopoverTitle({ className, ...props }) {
|
|
1211
1259
|
return /* @__PURE__ */ jsx(Popover$1.Title, {
|
|
1212
|
-
className: `${title$
|
|
1260
|
+
className: `${title$2}${className ? ` ${className}` : ""}`,
|
|
1213
1261
|
...props
|
|
1214
1262
|
});
|
|
1215
1263
|
}
|
|
@@ -1219,6 +1267,268 @@ function PopoverDescription({ className, ...props }) {
|
|
|
1219
1267
|
...props
|
|
1220
1268
|
});
|
|
1221
1269
|
}
|
|
1270
|
+
function PopoverHeader({ actions, className, icon, title }) {
|
|
1271
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1272
|
+
className: `${header$2}${className ? ` ${className}` : ""}`,
|
|
1273
|
+
children: [
|
|
1274
|
+
icon && /* @__PURE__ */ jsx("span", {
|
|
1275
|
+
className: "f2q44l9",
|
|
1276
|
+
children: icon
|
|
1277
|
+
}),
|
|
1278
|
+
/* @__PURE__ */ jsx("span", {
|
|
1279
|
+
className: headerTitle$1,
|
|
1280
|
+
children: title
|
|
1281
|
+
}),
|
|
1282
|
+
actions && /* @__PURE__ */ jsx("span", {
|
|
1283
|
+
className: "f2q44lb",
|
|
1284
|
+
children: actions
|
|
1285
|
+
})
|
|
1286
|
+
]
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
function PopoverBody({ children, className }) {
|
|
1290
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1291
|
+
className: `${body$1}${className ? ` ${className}` : ""}`,
|
|
1292
|
+
children
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
function PopoverFooter({ children, className, hint }) {
|
|
1296
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1297
|
+
className: `${footer$3}${className ? ` ${className}` : ""}`,
|
|
1298
|
+
children: [hint && /* @__PURE__ */ jsx("span", {
|
|
1299
|
+
className: "f2q44le",
|
|
1300
|
+
children: hint
|
|
1301
|
+
}), children]
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
//#endregion
|
|
1305
|
+
//#region src/components/kbd/keys.ts
|
|
1306
|
+
var aliases = {
|
|
1307
|
+
"ctrl": "mod",
|
|
1308
|
+
"control": "mod",
|
|
1309
|
+
"cmd": "mod",
|
|
1310
|
+
"command": "mod",
|
|
1311
|
+
"meta": "mod",
|
|
1312
|
+
"mod": "mod",
|
|
1313
|
+
"option": "alt",
|
|
1314
|
+
"opt": "alt",
|
|
1315
|
+
"alt": "alt",
|
|
1316
|
+
"shift": "shift",
|
|
1317
|
+
"return": "enter",
|
|
1318
|
+
"enter": "enter",
|
|
1319
|
+
"esc": "escape",
|
|
1320
|
+
"escape": "escape",
|
|
1321
|
+
"backspace": "backspace",
|
|
1322
|
+
"del": "delete",
|
|
1323
|
+
"delete": "delete",
|
|
1324
|
+
"arrowup": "up",
|
|
1325
|
+
"up": "up",
|
|
1326
|
+
"arrowdown": "down",
|
|
1327
|
+
"down": "down",
|
|
1328
|
+
"arrowleft": "left",
|
|
1329
|
+
"left": "left",
|
|
1330
|
+
"arrowright": "right",
|
|
1331
|
+
"right": "right",
|
|
1332
|
+
"⌘": "mod",
|
|
1333
|
+
"⌃": "mod",
|
|
1334
|
+
"⇧": "shift",
|
|
1335
|
+
"⌥": "alt",
|
|
1336
|
+
"↵": "enter",
|
|
1337
|
+
"⏎": "enter",
|
|
1338
|
+
"⌫": "backspace",
|
|
1339
|
+
"⌦": "delete",
|
|
1340
|
+
"↑": "up",
|
|
1341
|
+
"↓": "down",
|
|
1342
|
+
"←": "left",
|
|
1343
|
+
"→": "right"
|
|
1344
|
+
};
|
|
1345
|
+
var glyphs = /[←↑→↓↵⇧⌃⌘⌥⌦⌫⏎]/g;
|
|
1346
|
+
function normalize(token) {
|
|
1347
|
+
const lower = token.trim().toLowerCase();
|
|
1348
|
+
return aliases[lower] ?? lower;
|
|
1349
|
+
}
|
|
1350
|
+
function parseShortcut(shortcut) {
|
|
1351
|
+
return (shortcut.includes("+") ? shortcut.split("+") : shortcut.replaceAll(glyphs, (g) => `+${g}+`).split("+")).filter((p) => p.trim() !== "").map(normalize);
|
|
1352
|
+
}
|
|
1353
|
+
var macModifiers = {
|
|
1354
|
+
mod: {
|
|
1355
|
+
label: "⌘",
|
|
1356
|
+
name: "Command"
|
|
1357
|
+
},
|
|
1358
|
+
shift: {
|
|
1359
|
+
label: "⇧",
|
|
1360
|
+
name: "Shift"
|
|
1361
|
+
},
|
|
1362
|
+
alt: {
|
|
1363
|
+
label: "⌥",
|
|
1364
|
+
name: "Option"
|
|
1365
|
+
}
|
|
1366
|
+
};
|
|
1367
|
+
var otherModifiers = {
|
|
1368
|
+
mod: {
|
|
1369
|
+
label: "Ctrl",
|
|
1370
|
+
name: "Control"
|
|
1371
|
+
},
|
|
1372
|
+
shift: {
|
|
1373
|
+
label: "Shift",
|
|
1374
|
+
name: "Shift"
|
|
1375
|
+
},
|
|
1376
|
+
alt: {
|
|
1377
|
+
label: "Alt",
|
|
1378
|
+
name: "Alt"
|
|
1379
|
+
}
|
|
1380
|
+
};
|
|
1381
|
+
var iconKeys = {
|
|
1382
|
+
enter: "Enter",
|
|
1383
|
+
backspace: "Backspace",
|
|
1384
|
+
delete: "Delete",
|
|
1385
|
+
up: "Up",
|
|
1386
|
+
down: "Down",
|
|
1387
|
+
left: "Left",
|
|
1388
|
+
right: "Right"
|
|
1389
|
+
};
|
|
1390
|
+
var namedKeys = {
|
|
1391
|
+
escape: {
|
|
1392
|
+
label: "Esc",
|
|
1393
|
+
name: "Escape"
|
|
1394
|
+
},
|
|
1395
|
+
tab: {
|
|
1396
|
+
label: "Tab",
|
|
1397
|
+
name: "Tab"
|
|
1398
|
+
},
|
|
1399
|
+
space: {
|
|
1400
|
+
label: "Space",
|
|
1401
|
+
name: "Space"
|
|
1402
|
+
}
|
|
1403
|
+
};
|
|
1404
|
+
function keyDisplay(key, platform) {
|
|
1405
|
+
const modifiers = platform === "mac" ? macModifiers : otherModifiers;
|
|
1406
|
+
if (modifiers[key]) return modifiers[key];
|
|
1407
|
+
if (key in iconKeys) return {
|
|
1408
|
+
icon: key,
|
|
1409
|
+
name: iconKeys[key]
|
|
1410
|
+
};
|
|
1411
|
+
if (namedKeys[key]) return namedKeys[key];
|
|
1412
|
+
const label = key.length === 1 ? key.toUpperCase() : key[0].toUpperCase() + key.slice(1);
|
|
1413
|
+
return {
|
|
1414
|
+
label,
|
|
1415
|
+
name: label
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1418
|
+
function detectPlatform(nav) {
|
|
1419
|
+
if (!nav) return "other";
|
|
1420
|
+
const source = `${nav.platform ?? ""} ${nav.userAgent ?? ""}`;
|
|
1421
|
+
return /mac|iphone|ipad|ipod/i.test(source) ? "mac" : "other";
|
|
1422
|
+
}
|
|
1423
|
+
//#endregion
|
|
1424
|
+
//#region src/components/kbd/styles.css.ts
|
|
1425
|
+
var group$1 = "lhlko40";
|
|
1426
|
+
var cap = "lhlko41";
|
|
1427
|
+
var size = {
|
|
1428
|
+
sm: "lhlko42",
|
|
1429
|
+
md: "lhlko43"
|
|
1430
|
+
};
|
|
1431
|
+
var tone = {
|
|
1432
|
+
"default": "lhlko44",
|
|
1433
|
+
muted: "lhlko45",
|
|
1434
|
+
inverted: "lhlko46"
|
|
1435
|
+
};
|
|
1436
|
+
var icon$2 = "lhlko47";
|
|
1437
|
+
var mirrored = "lhlko48";
|
|
1438
|
+
var visuallyHidden = "lhlko49";
|
|
1439
|
+
//#endregion
|
|
1440
|
+
//#region src/components/kbd/index.tsx
|
|
1441
|
+
var icons = {
|
|
1442
|
+
enter: CornerDownLeft,
|
|
1443
|
+
backspace: Delete,
|
|
1444
|
+
delete: Delete,
|
|
1445
|
+
up: ArrowUp,
|
|
1446
|
+
down: ArrowDown,
|
|
1447
|
+
left: ArrowLeft,
|
|
1448
|
+
right: ArrowRight
|
|
1449
|
+
};
|
|
1450
|
+
var subscribe$2 = () => () => {};
|
|
1451
|
+
var clientPlatform = () => detectPlatform(typeof navigator === "undefined" ? void 0 : navigator);
|
|
1452
|
+
var serverPlatform = () => "other";
|
|
1453
|
+
function useKbdPlatform() {
|
|
1454
|
+
return useSyncExternalStore(subscribe$2, clientPlatform, serverPlatform);
|
|
1455
|
+
}
|
|
1456
|
+
function Kbd({ className, keys, platform, size: size$2 = "md", tone: tone$1 = "default" }) {
|
|
1457
|
+
const detected = useKbdPlatform();
|
|
1458
|
+
const resolved = platform ?? detected;
|
|
1459
|
+
const displays = (typeof keys === "string" ? parseShortcut(keys) : keys).map((key) => keyDisplay(key, resolved));
|
|
1460
|
+
const iconSize = size$2 === "sm" ? 11 : 12;
|
|
1461
|
+
const capClass = `${cap} ${size[size$2]} ${tone[tone$1]}`;
|
|
1462
|
+
return /* @__PURE__ */ jsxs("kbd", {
|
|
1463
|
+
className: `${group$1}${className ? ` ${className}` : ""}`,
|
|
1464
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1465
|
+
className: visuallyHidden,
|
|
1466
|
+
"data-slot": "kbd-label",
|
|
1467
|
+
children: displays.map((d) => d.name).join(" ")
|
|
1468
|
+
}), displays.map((d, i) => {
|
|
1469
|
+
const Icon = d.icon ? icons[d.icon] : void 0;
|
|
1470
|
+
return /* @__PURE__ */ jsx("kbd", {
|
|
1471
|
+
"aria-hidden": "true",
|
|
1472
|
+
className: capClass,
|
|
1473
|
+
children: Icon ? /* @__PURE__ */ jsx(Icon, {
|
|
1474
|
+
className: d.icon === "delete" ? `${icon$2} ${mirrored}` : icon$2,
|
|
1475
|
+
size: iconSize,
|
|
1476
|
+
strokeWidth: 2
|
|
1477
|
+
}) : d.label
|
|
1478
|
+
}, `${d.name}-${i}`);
|
|
1479
|
+
})]
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
//#endregion
|
|
1483
|
+
//#region src/components/tooltip/styles.css.ts
|
|
1484
|
+
var positioner$2 = "_1cspf2m0";
|
|
1485
|
+
var popup$4 = "_1cspf2m1";
|
|
1486
|
+
//#endregion
|
|
1487
|
+
//#region src/components/tooltip/index.tsx
|
|
1488
|
+
function TooltipProvider(props) {
|
|
1489
|
+
return /* @__PURE__ */ jsx(Tooltip.Provider, { ...props });
|
|
1490
|
+
}
|
|
1491
|
+
function TooltipRoot(props) {
|
|
1492
|
+
return /* @__PURE__ */ jsx(Tooltip.Root, { ...props });
|
|
1493
|
+
}
|
|
1494
|
+
function TooltipTrigger(props) {
|
|
1495
|
+
return /* @__PURE__ */ jsx(Tooltip.Trigger, { ...props });
|
|
1496
|
+
}
|
|
1497
|
+
function TooltipPortal({ children, ...props }) {
|
|
1498
|
+
return /* @__PURE__ */ jsx(Tooltip.Portal, {
|
|
1499
|
+
...props,
|
|
1500
|
+
children: /* @__PURE__ */ jsx(PortalThemeWrapper$1, { children })
|
|
1501
|
+
});
|
|
1502
|
+
}
|
|
1503
|
+
function TooltipPositioner(props) {
|
|
1504
|
+
return /* @__PURE__ */ jsx(Tooltip.Positioner, { ...props });
|
|
1505
|
+
}
|
|
1506
|
+
function TooltipPopup({ className, children, shortcut, ...props }) {
|
|
1507
|
+
return /* @__PURE__ */ jsxs(Tooltip.Popup, {
|
|
1508
|
+
className: `${popup$4}${className ? ` ${className}` : ""}`,
|
|
1509
|
+
...props,
|
|
1510
|
+
children: [children, shortcut && /* @__PURE__ */ jsx(Kbd, {
|
|
1511
|
+
className: "_1cspf2m2",
|
|
1512
|
+
keys: shortcut,
|
|
1513
|
+
size: "sm",
|
|
1514
|
+
tone: "inverted"
|
|
1515
|
+
})]
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
function TooltipContent({ side = "top", sideOffset = 6, align = "center", className, children, ...popupProps }) {
|
|
1519
|
+
return /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(TooltipPositioner, {
|
|
1520
|
+
align,
|
|
1521
|
+
className: positioner$2,
|
|
1522
|
+
side,
|
|
1523
|
+
sideOffset,
|
|
1524
|
+
children: /* @__PURE__ */ jsx(TooltipPopup, {
|
|
1525
|
+
className,
|
|
1526
|
+
...popupProps,
|
|
1527
|
+
children
|
|
1528
|
+
})
|
|
1529
|
+
}) });
|
|
1530
|
+
}
|
|
1531
|
+
var createTooltipHandle = Tooltip.createHandle;
|
|
1222
1532
|
//#endregion
|
|
1223
1533
|
//#region src/components/color-picker/color-math.ts
|
|
1224
1534
|
var clamp = (n, min, max) => n < min ? min : n > max ? max : n;
|
|
@@ -1327,36 +1637,41 @@ function huePreviewHex(h) {
|
|
|
1327
1637
|
}
|
|
1328
1638
|
//#endregion
|
|
1329
1639
|
//#region src/components/color-picker/styles.css.ts
|
|
1330
|
-
var trigger = "
|
|
1331
|
-
var triggerLabel = "
|
|
1332
|
-
var triggerLetter = "
|
|
1333
|
-
var triggerBar = "
|
|
1334
|
-
var triggerChevron = "
|
|
1335
|
-
var panel
|
|
1336
|
-
var
|
|
1337
|
-
var
|
|
1338
|
-
var
|
|
1339
|
-
var
|
|
1340
|
-
var
|
|
1341
|
-
var
|
|
1342
|
-
var
|
|
1343
|
-
var
|
|
1344
|
-
var
|
|
1345
|
-
var
|
|
1346
|
-
var
|
|
1347
|
-
var
|
|
1348
|
-
var
|
|
1349
|
-
var
|
|
1350
|
-
var
|
|
1351
|
-
var
|
|
1352
|
-
var
|
|
1353
|
-
var
|
|
1354
|
-
var
|
|
1355
|
-
var
|
|
1356
|
-
var
|
|
1357
|
-
var
|
|
1358
|
-
var
|
|
1359
|
-
var
|
|
1640
|
+
var trigger = "_17r50hf0";
|
|
1641
|
+
var triggerLabel = "_17r50hf1";
|
|
1642
|
+
var triggerLetter = "_17r50hf2";
|
|
1643
|
+
var triggerBar = "_17r50hf3";
|
|
1644
|
+
var triggerChevron = "_17r50hf4";
|
|
1645
|
+
var panel = "_17r50hf5";
|
|
1646
|
+
var presetView = "_17r50hf6";
|
|
1647
|
+
var section = "_17r50hf7";
|
|
1648
|
+
var sectionLabel = "_17r50hf8";
|
|
1649
|
+
var grid = "_17r50hf9";
|
|
1650
|
+
var swatch = "_17r50hfa";
|
|
1651
|
+
var swatchDot = "_17r50hfb";
|
|
1652
|
+
var defaultDot = "_17r50hfc";
|
|
1653
|
+
var backgroundChip = "_17r50hfd";
|
|
1654
|
+
var footer$2 = "_17r50hfe";
|
|
1655
|
+
var footerButton = "_17r50hff";
|
|
1656
|
+
var footerIcon = "_17r50hfg";
|
|
1657
|
+
var pickerView = "_17r50hfh";
|
|
1658
|
+
var backButton = "_17r50hfi";
|
|
1659
|
+
var backIcon = "_17r50hfj";
|
|
1660
|
+
var satSquare = "_17r50hfk";
|
|
1661
|
+
var satOverlayX = "_17r50hfl";
|
|
1662
|
+
var satOverlayY = "_17r50hfm";
|
|
1663
|
+
var satThumb = "_17r50hfn";
|
|
1664
|
+
var hueTrack = "_17r50hfo";
|
|
1665
|
+
var alphaTrack = "_17r50hfp";
|
|
1666
|
+
var alphaGradient = "_17r50hfq";
|
|
1667
|
+
var sliderThumb = "_17r50hfr";
|
|
1668
|
+
var hexRow = "_17r50hfs";
|
|
1669
|
+
var hexInput = "_17r50hft";
|
|
1670
|
+
var hexInputInvalid = "_17r50hfu";
|
|
1671
|
+
var previewPair = "_17r50hfx";
|
|
1672
|
+
var previewCell = "_17r50hfy";
|
|
1673
|
+
var actionRow = "_17r50hfz";
|
|
1674
|
+
var actionButton = "_17r50hf10";
|
|
1360
1675
|
//#endregion
|
|
1361
1676
|
//#region src/components/color-picker/picker-view.tsx
|
|
1362
1677
|
var FALLBACK = {
|
|
@@ -1540,11 +1855,11 @@ function PickerView({ initialColor, onApply, onCancel, onBack }) {
|
|
|
1540
1855
|
}),
|
|
1541
1856
|
hasEyeDropper && /* @__PURE__ */ jsx("button", {
|
|
1542
1857
|
"aria-label": "Pick color from screen",
|
|
1543
|
-
className: "
|
|
1858
|
+
className: "_17r50hfv",
|
|
1544
1859
|
type: "button",
|
|
1545
1860
|
onClick: openEyeDropper,
|
|
1546
1861
|
onMouseDown: (e) => e.preventDefault(),
|
|
1547
|
-
children: /* @__PURE__ */ jsx(Pipette, { className: "
|
|
1862
|
+
children: /* @__PURE__ */ jsx(Pipette, { className: "_17r50hfw" })
|
|
1548
1863
|
}),
|
|
1549
1864
|
/* @__PURE__ */ jsxs("div", {
|
|
1550
1865
|
"aria-hidden": true,
|
|
@@ -1561,15 +1876,17 @@ function PickerView({ initialColor, onApply, onCancel, onBack }) {
|
|
|
1561
1876
|
}),
|
|
1562
1877
|
/* @__PURE__ */ jsxs("div", {
|
|
1563
1878
|
className: actionRow,
|
|
1564
|
-
children: [/* @__PURE__ */ jsx(
|
|
1879
|
+
children: [/* @__PURE__ */ jsx(ActionButton, {
|
|
1565
1880
|
className: actionButton,
|
|
1566
|
-
|
|
1881
|
+
size: "md",
|
|
1882
|
+
variant: "outline",
|
|
1567
1883
|
onClick: onCancel,
|
|
1568
1884
|
onMouseDown: (e) => e.preventDefault(),
|
|
1569
1885
|
children: "Cancel"
|
|
1570
|
-
}), /* @__PURE__ */ jsx(
|
|
1571
|
-
className:
|
|
1572
|
-
|
|
1886
|
+
}), /* @__PURE__ */ jsx(ActionButton, {
|
|
1887
|
+
className: actionButton,
|
|
1888
|
+
size: "md",
|
|
1889
|
+
variant: "solid",
|
|
1573
1890
|
onClick: handleApply,
|
|
1574
1891
|
onMouseDown: (e) => e.preventDefault(),
|
|
1575
1892
|
children: "Apply"
|
|
@@ -1579,163 +1896,475 @@ function PickerView({ initialColor, onApply, onCancel, onBack }) {
|
|
|
1579
1896
|
});
|
|
1580
1897
|
}
|
|
1581
1898
|
//#endregion
|
|
1582
|
-
//#region src/components/
|
|
1583
|
-
var
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
value: "#ef4444"
|
|
1595
|
-
},
|
|
1596
|
-
{
|
|
1597
|
-
name: "Orange",
|
|
1598
|
-
value: "#f97316"
|
|
1599
|
-
},
|
|
1600
|
-
{
|
|
1601
|
-
name: "Amber",
|
|
1602
|
-
value: "#f59e0b"
|
|
1603
|
-
},
|
|
1604
|
-
{
|
|
1605
|
-
name: "Green",
|
|
1606
|
-
value: "#22c55e"
|
|
1607
|
-
},
|
|
1608
|
-
{
|
|
1609
|
-
name: "Teal",
|
|
1610
|
-
value: "#14b8a6"
|
|
1899
|
+
//#region src/components/segmented-control/styles.css.ts
|
|
1900
|
+
var container = createRuntimeFn({
|
|
1901
|
+
defaultClassName: "_6d8tz20",
|
|
1902
|
+
variantClassNames: {
|
|
1903
|
+
size: {
|
|
1904
|
+
sm: "_6d8tz21",
|
|
1905
|
+
md: "_6d8tz22"
|
|
1906
|
+
},
|
|
1907
|
+
fullWidth: {
|
|
1908
|
+
true: "_6d8tz23",
|
|
1909
|
+
false: "_6d8tz24"
|
|
1910
|
+
}
|
|
1611
1911
|
},
|
|
1612
|
-
{
|
|
1613
|
-
|
|
1614
|
-
|
|
1912
|
+
defaultVariants: {
|
|
1913
|
+
size: "sm",
|
|
1914
|
+
fullWidth: false
|
|
1615
1915
|
},
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1916
|
+
compoundVariants: []
|
|
1917
|
+
});
|
|
1918
|
+
var indicator = createRuntimeFn({
|
|
1919
|
+
defaultClassName: "_6d8tz25",
|
|
1920
|
+
variantClassNames: { ready: {
|
|
1921
|
+
true: "_6d8tz26",
|
|
1922
|
+
false: "_6d8tz27"
|
|
1923
|
+
} },
|
|
1924
|
+
defaultVariants: { ready: true },
|
|
1925
|
+
compoundVariants: []
|
|
1926
|
+
});
|
|
1927
|
+
var item$3 = createRuntimeFn({
|
|
1928
|
+
defaultClassName: "_6d8tz28",
|
|
1929
|
+
variantClassNames: {
|
|
1930
|
+
size: {
|
|
1931
|
+
sm: "_6d8tz29",
|
|
1932
|
+
md: "_6d8tz2a"
|
|
1933
|
+
},
|
|
1934
|
+
active: {
|
|
1935
|
+
true: "_6d8tz2b",
|
|
1936
|
+
false: "_6d8tz2c"
|
|
1937
|
+
},
|
|
1938
|
+
disabled: {
|
|
1939
|
+
true: "_6d8tz2d",
|
|
1940
|
+
false: "_6d8tz2e"
|
|
1941
|
+
},
|
|
1942
|
+
fullWidth: {
|
|
1943
|
+
true: "_6d8tz2f",
|
|
1944
|
+
false: "_6d8tz2g"
|
|
1945
|
+
}
|
|
1619
1946
|
},
|
|
1620
|
-
{
|
|
1621
|
-
|
|
1622
|
-
|
|
1947
|
+
defaultVariants: {
|
|
1948
|
+
size: "sm",
|
|
1949
|
+
active: false,
|
|
1950
|
+
disabled: false,
|
|
1951
|
+
fullWidth: false
|
|
1623
1952
|
},
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
value: "#ec4899"
|
|
1627
|
-
}
|
|
1628
|
-
];
|
|
1629
|
-
function ColorPicker({ currentColor, onSelect, className }) {
|
|
1630
|
-
const [open, setOpen] = useState(false);
|
|
1631
|
-
const [view, setView] = useState("preset");
|
|
1632
|
-
const displayColor = currentColor === "inherit" || !currentColor ? "currentColor" : currentColor;
|
|
1633
|
-
const handleOpenChange = (next) => {
|
|
1634
|
-
setOpen(next);
|
|
1635
|
-
if (!next) setView("preset");
|
|
1636
|
-
};
|
|
1637
|
-
const handlePreset = (value) => {
|
|
1638
|
-
onSelect(value);
|
|
1639
|
-
handleOpenChange(false);
|
|
1640
|
-
};
|
|
1641
|
-
const handleApply = (hex) => {
|
|
1642
|
-
onSelect(hex);
|
|
1643
|
-
handleOpenChange(false);
|
|
1644
|
-
};
|
|
1645
|
-
const handleCancel = () => handleOpenChange(false);
|
|
1646
|
-
return /* @__PURE__ */ jsxs(Popover, {
|
|
1647
|
-
open,
|
|
1648
|
-
onOpenChange: handleOpenChange,
|
|
1649
|
-
children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
|
|
1650
|
-
className: `${trigger}${className ? ` ${className}` : ""}`,
|
|
1651
|
-
render: /* @__PURE__ */ jsx("button", {
|
|
1652
|
-
type: "button",
|
|
1653
|
-
onMouseDown: (e) => e.preventDefault()
|
|
1654
|
-
}),
|
|
1655
|
-
children: [/* @__PURE__ */ jsxs("span", {
|
|
1656
|
-
className: triggerLabel,
|
|
1657
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
1658
|
-
className: triggerLetter,
|
|
1659
|
-
style: { color: displayColor },
|
|
1660
|
-
children: "A"
|
|
1661
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1662
|
-
className: triggerBar,
|
|
1663
|
-
style: { backgroundColor: displayColor }
|
|
1664
|
-
})]
|
|
1665
|
-
}), /* @__PURE__ */ jsx(ChevronDown, { className: triggerChevron })]
|
|
1666
|
-
}), /* @__PURE__ */ jsx(PopoverPanel, {
|
|
1667
|
-
className: panel$1,
|
|
1668
|
-
side: "bottom",
|
|
1669
|
-
sideOffset: 6,
|
|
1670
|
-
children: view === "preset" ? /* @__PURE__ */ jsxs("div", {
|
|
1671
|
-
className: grid,
|
|
1672
|
-
children: [TEXT_COLORS.map((color) => /* @__PURE__ */ jsxs("button", {
|
|
1673
|
-
"aria-label": color.name,
|
|
1674
|
-
className: swatch,
|
|
1675
|
-
type: "button",
|
|
1676
|
-
onClick: () => handlePreset(color.value),
|
|
1677
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
1678
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
1679
|
-
className: swatchDot,
|
|
1680
|
-
style: { backgroundColor: color.value === "inherit" ? "currentColor" : color.value }
|
|
1681
|
-
}), currentColor === color.value && /* @__PURE__ */ jsx(Check, { className: "_17r50hfa" })]
|
|
1682
|
-
}, color.value)), /* @__PURE__ */ jsx("button", {
|
|
1683
|
-
"aria-label": "Custom color",
|
|
1684
|
-
className: swatch,
|
|
1685
|
-
type: "button",
|
|
1686
|
-
onClick: () => setView("picker"),
|
|
1687
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
1688
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
1689
|
-
className: addSwatchDot,
|
|
1690
|
-
children: /* @__PURE__ */ jsx(Plus, { className: addSwatchIcon })
|
|
1691
|
-
})
|
|
1692
|
-
})]
|
|
1693
|
-
}) : /* @__PURE__ */ jsx(PickerView, {
|
|
1694
|
-
initialColor: currentColor,
|
|
1695
|
-
onApply: handleApply,
|
|
1696
|
-
onBack: () => setView("preset"),
|
|
1697
|
-
onCancel: handleCancel
|
|
1698
|
-
})
|
|
1699
|
-
})]
|
|
1700
|
-
});
|
|
1701
|
-
}
|
|
1702
|
-
//#endregion
|
|
1703
|
-
//#region src/components/combobox/styles.css.ts
|
|
1704
|
-
var popup$4 = "_2buwsh0";
|
|
1705
|
-
var item$3 = "_2buwsh1";
|
|
1706
|
-
var empty = "_2buwsh2";
|
|
1953
|
+
compoundVariants: []
|
|
1954
|
+
});
|
|
1707
1955
|
//#endregion
|
|
1708
|
-
//#region src/components/
|
|
1709
|
-
function
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
...props
|
|
1716
|
-
});
|
|
1717
|
-
}
|
|
1718
|
-
function ComboboxInput({ className, ...props }) {
|
|
1719
|
-
return /* @__PURE__ */ jsx(Combobox$1.Input, {
|
|
1720
|
-
className,
|
|
1721
|
-
...props
|
|
1956
|
+
//#region src/components/segmented-control/index.tsx
|
|
1957
|
+
function SegmentedControl({ items, value, onChange, size = "sm", fullWidth = false, className }) {
|
|
1958
|
+
const containerRef = useRef(null);
|
|
1959
|
+
const itemElementsRef = useRef(/* @__PURE__ */ new Map());
|
|
1960
|
+
const [indicator$2, setIndicator] = useState({
|
|
1961
|
+
left: 0,
|
|
1962
|
+
width: 0
|
|
1722
1963
|
});
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1964
|
+
const [isReady, setIsReady] = useState(false);
|
|
1965
|
+
const updateIndicator = useCallback(() => {
|
|
1966
|
+
const container = containerRef.current;
|
|
1967
|
+
const activeEl = itemElementsRef.current.get(value);
|
|
1968
|
+
if (!container || !activeEl) return;
|
|
1969
|
+
const containerRect = container.getBoundingClientRect();
|
|
1970
|
+
const activeRect = activeEl.getBoundingClientRect();
|
|
1971
|
+
setIndicator({
|
|
1972
|
+
left: activeRect.left - containerRect.left,
|
|
1973
|
+
width: activeRect.width
|
|
1974
|
+
});
|
|
1975
|
+
setIsReady(true);
|
|
1976
|
+
}, [value]);
|
|
1977
|
+
useEffect(() => {
|
|
1978
|
+
updateIndicator();
|
|
1979
|
+
}, [updateIndicator]);
|
|
1980
|
+
useEffect(() => {
|
|
1981
|
+
const container = containerRef.current;
|
|
1982
|
+
if (!container) return;
|
|
1983
|
+
const observer = new ResizeObserver(() => {
|
|
1984
|
+
updateIndicator();
|
|
1985
|
+
});
|
|
1986
|
+
observer.observe(container);
|
|
1987
|
+
return () => observer.disconnect();
|
|
1988
|
+
}, [updateIndicator]);
|
|
1989
|
+
const handleKeyDown = (e) => {
|
|
1990
|
+
const enabledItems = items.filter((item) => !item.disabled);
|
|
1991
|
+
const currentIndex = enabledItems.findIndex((item) => item.value === value);
|
|
1992
|
+
let nextIndex = currentIndex;
|
|
1993
|
+
switch (e.key) {
|
|
1994
|
+
case "ArrowRight":
|
|
1995
|
+
case "ArrowDown":
|
|
1996
|
+
e.preventDefault();
|
|
1997
|
+
nextIndex = (currentIndex + 1) % enabledItems.length;
|
|
1998
|
+
break;
|
|
1999
|
+
case "ArrowLeft":
|
|
2000
|
+
case "ArrowUp":
|
|
2001
|
+
e.preventDefault();
|
|
2002
|
+
nextIndex = (currentIndex - 1 + enabledItems.length) % enabledItems.length;
|
|
2003
|
+
break;
|
|
2004
|
+
case "Home":
|
|
2005
|
+
e.preventDefault();
|
|
2006
|
+
nextIndex = 0;
|
|
2007
|
+
break;
|
|
2008
|
+
case "End":
|
|
2009
|
+
e.preventDefault();
|
|
2010
|
+
nextIndex = enabledItems.length - 1;
|
|
2011
|
+
}
|
|
2012
|
+
if (nextIndex !== currentIndex) {
|
|
2013
|
+
const nextItem = enabledItems[nextIndex];
|
|
2014
|
+
onChange(nextItem.value);
|
|
2015
|
+
itemElementsRef.current.get(nextItem.value)?.focus();
|
|
2016
|
+
}
|
|
2017
|
+
};
|
|
2018
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2019
|
+
"aria-orientation": "horizontal",
|
|
2020
|
+
className: `${container({
|
|
2021
|
+
size,
|
|
2022
|
+
fullWidth
|
|
2023
|
+
})} ${className || ""}`.trim(),
|
|
2024
|
+
ref: containerRef,
|
|
2025
|
+
role: "tablist",
|
|
2026
|
+
onKeyDown: handleKeyDown,
|
|
2027
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
2028
|
+
"aria-hidden": "true",
|
|
2029
|
+
className: indicator({ ready: isReady }),
|
|
2030
|
+
style: {
|
|
2031
|
+
left: indicator$2.left,
|
|
2032
|
+
width: indicator$2.width
|
|
2033
|
+
}
|
|
2034
|
+
}), items.map((item) => {
|
|
2035
|
+
const isActive = item.value === value;
|
|
2036
|
+
return /* @__PURE__ */ jsx("button", {
|
|
2037
|
+
"aria-selected": isActive,
|
|
2038
|
+
"data-active": isActive || void 0,
|
|
2039
|
+
disabled: item.disabled,
|
|
2040
|
+
role: "tab",
|
|
2041
|
+
tabIndex: isActive ? 0 : -1,
|
|
2042
|
+
type: "button",
|
|
2043
|
+
className: item$3({
|
|
2044
|
+
size,
|
|
2045
|
+
active: isActive,
|
|
2046
|
+
disabled: Boolean(item.disabled),
|
|
2047
|
+
fullWidth
|
|
2048
|
+
}),
|
|
2049
|
+
ref: (el) => {
|
|
2050
|
+
if (el) itemElementsRef.current.set(item.value, el);
|
|
2051
|
+
else itemElementsRef.current.delete(item.value);
|
|
2052
|
+
},
|
|
2053
|
+
onClick: () => onChange(item.value),
|
|
2054
|
+
children: item.label
|
|
2055
|
+
}, item.value);
|
|
2056
|
+
})]
|
|
2057
|
+
});
|
|
2058
|
+
}
|
|
2059
|
+
//#endregion
|
|
2060
|
+
//#region src/components/color-picker/presets.ts
|
|
2061
|
+
var DEFAULT_COLOR = "inherit";
|
|
2062
|
+
var HUES = [
|
|
2063
|
+
["Gray", "#737373"],
|
|
2064
|
+
["Red", "#ef4444"],
|
|
2065
|
+
["Orange", "#f97316"],
|
|
2066
|
+
["Amber", "#f59e0b"],
|
|
2067
|
+
["Green", "#22c55e"],
|
|
2068
|
+
["Teal", "#14b8a6"],
|
|
2069
|
+
["Blue", "#3b82f6"],
|
|
2070
|
+
["Indigo", "#6366f1"],
|
|
2071
|
+
["Purple", "#a855f7"],
|
|
2072
|
+
["Pink", "#ec4899"]
|
|
2073
|
+
];
|
|
2074
|
+
var textValue = (base) => `color-mix(in oklab, ${base} 75%, var(--rc-text, #171717))`;
|
|
2075
|
+
var backgroundValue = (base) => `color-mix(in oklab, ${base} 18%, transparent)`;
|
|
2076
|
+
var PRESETS = {
|
|
2077
|
+
text: HUES.map(([name, base]) => ({
|
|
2078
|
+
name,
|
|
2079
|
+
value: textValue(base)
|
|
2080
|
+
})),
|
|
2081
|
+
background: HUES.map(([name, base]) => ({
|
|
2082
|
+
name,
|
|
2083
|
+
value: backgroundValue(base)
|
|
2084
|
+
}))
|
|
2085
|
+
};
|
|
2086
|
+
function isDefaultColor(value) {
|
|
2087
|
+
return !value || value === "inherit" || value === "transparent";
|
|
2088
|
+
}
|
|
2089
|
+
function presetName(target, value) {
|
|
2090
|
+
return PRESETS[target].find((p) => p.value === value)?.name ?? value;
|
|
2091
|
+
}
|
|
2092
|
+
//#endregion
|
|
2093
|
+
//#region src/components/color-picker/preset-view.tsx
|
|
2094
|
+
var GRID_COLUMNS = 8;
|
|
2095
|
+
var TARGET_ITEMS = [{
|
|
2096
|
+
label: "Text",
|
|
2097
|
+
value: "text"
|
|
2098
|
+
}, {
|
|
2099
|
+
label: "Background",
|
|
2100
|
+
value: "background"
|
|
2101
|
+
}];
|
|
2102
|
+
function moveFocus(e) {
|
|
2103
|
+
const step = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : e.key === "ArrowDown" ? GRID_COLUMNS : e.key === "ArrowUp" ? -8 : 0;
|
|
2104
|
+
if (!step) return;
|
|
2105
|
+
const buttons = Array.from(e.currentTarget.querySelectorAll("button"));
|
|
2106
|
+
const index = buttons.indexOf(document.activeElement);
|
|
2107
|
+
if (index === -1) return;
|
|
2108
|
+
const next = buttons[Math.max(0, Math.min(buttons.length - 1, index + step))];
|
|
2109
|
+
e.preventDefault();
|
|
2110
|
+
next?.focus();
|
|
2111
|
+
}
|
|
2112
|
+
function Swatch({ current, onPick, preset, target }) {
|
|
2113
|
+
const isDefault = preset.value === DEFAULT_COLOR;
|
|
2114
|
+
const pressed = isDefault ? isDefaultColor(current) : current === preset.value;
|
|
2115
|
+
return /* @__PURE__ */ jsx("button", {
|
|
2116
|
+
"aria-label": preset.name,
|
|
2117
|
+
"aria-pressed": pressed,
|
|
2118
|
+
className: swatch,
|
|
2119
|
+
title: preset.name,
|
|
2120
|
+
type: "button",
|
|
2121
|
+
onClick: () => onPick(preset.value),
|
|
2122
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
2123
|
+
children: isDefault ? /* @__PURE__ */ jsx("span", {
|
|
2124
|
+
"data-default-swatch": true,
|
|
2125
|
+
className: `${swatchDot} ${defaultDot}`
|
|
2126
|
+
}) : target === "background" ? /* @__PURE__ */ jsx("span", {
|
|
2127
|
+
className: backgroundChip,
|
|
2128
|
+
style: { backgroundColor: preset.value },
|
|
2129
|
+
children: "A"
|
|
2130
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
2131
|
+
className: swatchDot,
|
|
2132
|
+
style: { backgroundColor: preset.value }
|
|
2133
|
+
})
|
|
2134
|
+
});
|
|
2135
|
+
}
|
|
2136
|
+
function PresetView({ current, onCustom, onPick, onTargetChange, recent, target }) {
|
|
2137
|
+
const presets = [{
|
|
2138
|
+
name: "Default",
|
|
2139
|
+
value: DEFAULT_COLOR
|
|
2140
|
+
}, ...PRESETS[target]];
|
|
2141
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2142
|
+
className: presetView,
|
|
2143
|
+
children: [
|
|
2144
|
+
onTargetChange && /* @__PURE__ */ jsx(SegmentedControl, {
|
|
2145
|
+
fullWidth: true,
|
|
2146
|
+
items: TARGET_ITEMS,
|
|
2147
|
+
value: target,
|
|
2148
|
+
onChange: onTargetChange
|
|
2149
|
+
}),
|
|
2150
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2151
|
+
className: section,
|
|
2152
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
2153
|
+
className: sectionLabel,
|
|
2154
|
+
children: "Theme colors"
|
|
2155
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
2156
|
+
"aria-label": "Theme colors",
|
|
2157
|
+
className: grid,
|
|
2158
|
+
role: "group",
|
|
2159
|
+
onKeyDown: moveFocus,
|
|
2160
|
+
children: presets.map((preset) => /* @__PURE__ */ jsx(Swatch, {
|
|
2161
|
+
current,
|
|
2162
|
+
preset,
|
|
2163
|
+
target,
|
|
2164
|
+
onPick
|
|
2165
|
+
}, preset.value))
|
|
2166
|
+
})]
|
|
2167
|
+
}),
|
|
2168
|
+
recent.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
2169
|
+
className: "_17r50hf7",
|
|
2170
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
2171
|
+
className: "_17r50hf8",
|
|
2172
|
+
children: "Recent"
|
|
2173
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
2174
|
+
"aria-label": "Recent colors",
|
|
2175
|
+
className: "_17r50hf9",
|
|
2176
|
+
role: "group",
|
|
2177
|
+
onKeyDown: moveFocus,
|
|
2178
|
+
children: recent.map((value) => /* @__PURE__ */ jsx(Swatch, {
|
|
2179
|
+
current,
|
|
2180
|
+
preset: {
|
|
2181
|
+
name: presetName(target, value),
|
|
2182
|
+
value
|
|
2183
|
+
},
|
|
2184
|
+
target,
|
|
2185
|
+
onPick
|
|
2186
|
+
}, value))
|
|
2187
|
+
})]
|
|
2188
|
+
}),
|
|
2189
|
+
/* @__PURE__ */ jsx("div", {
|
|
2190
|
+
className: footer$2,
|
|
2191
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
2192
|
+
"aria-label": "Custom color",
|
|
2193
|
+
className: footerButton,
|
|
2194
|
+
type: "button",
|
|
2195
|
+
onClick: onCustom,
|
|
2196
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
2197
|
+
children: [/* @__PURE__ */ jsx(Plus, { className: footerIcon }), "Custom…"]
|
|
2198
|
+
})
|
|
2199
|
+
})
|
|
2200
|
+
]
|
|
2201
|
+
});
|
|
2202
|
+
}
|
|
2203
|
+
//#endregion
|
|
2204
|
+
//#region src/components/color-picker/recent.ts
|
|
2205
|
+
var MAX_RECENT = 5;
|
|
2206
|
+
var STORAGE_KEY = "haklex:color-picker:recent";
|
|
2207
|
+
var EMPTY$1 = {
|
|
2208
|
+
text: [],
|
|
2209
|
+
background: []
|
|
2210
|
+
};
|
|
2211
|
+
var state = null;
|
|
2212
|
+
var listeners$2 = /* @__PURE__ */ new Set();
|
|
2213
|
+
function sanitize(value) {
|
|
2214
|
+
if (!Array.isArray(value)) return [];
|
|
2215
|
+
return value.filter((v) => typeof v === "string").slice(0, MAX_RECENT);
|
|
2216
|
+
}
|
|
2217
|
+
function load() {
|
|
2218
|
+
if (state) return state;
|
|
2219
|
+
state = EMPTY$1;
|
|
2220
|
+
try {
|
|
2221
|
+
const raw = localStorage.getItem(STORAGE_KEY);
|
|
2222
|
+
if (raw) {
|
|
2223
|
+
const parsed = JSON.parse(raw);
|
|
2224
|
+
state = {
|
|
2225
|
+
text: sanitize(parsed.text),
|
|
2226
|
+
background: sanitize(parsed.background)
|
|
2227
|
+
};
|
|
2228
|
+
}
|
|
2229
|
+
} catch {
|
|
2230
|
+
state = EMPTY$1;
|
|
2231
|
+
}
|
|
2232
|
+
return state;
|
|
2233
|
+
}
|
|
2234
|
+
function persist(next) {
|
|
2235
|
+
try {
|
|
2236
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(next));
|
|
2237
|
+
return true;
|
|
2238
|
+
} catch {
|
|
2239
|
+
return false;
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
function pushRecentColor(target, color) {
|
|
2243
|
+
const current = load();
|
|
2244
|
+
const list = [color, ...current[target].filter((c) => c !== color)].slice(0, MAX_RECENT);
|
|
2245
|
+
state = {
|
|
2246
|
+
...current,
|
|
2247
|
+
[target]: list
|
|
2248
|
+
};
|
|
2249
|
+
persist(state);
|
|
2250
|
+
for (const listener of listeners$2) listener();
|
|
2251
|
+
}
|
|
2252
|
+
function subscribe$1(listener) {
|
|
2253
|
+
listeners$2.add(listener);
|
|
2254
|
+
return () => {
|
|
2255
|
+
listeners$2.delete(listener);
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2258
|
+
var getServerSnapshot = () => EMPTY$1;
|
|
2259
|
+
function useRecentColors(target) {
|
|
2260
|
+
return useSyncExternalStore(subscribe$1, load, getServerSnapshot)[target];
|
|
2261
|
+
}
|
|
2262
|
+
//#endregion
|
|
2263
|
+
//#region src/components/color-picker/index.tsx
|
|
2264
|
+
function ColorPicker({ currentColor, currentBackground, onSelect, onSelectBackground, className, tooltip }) {
|
|
2265
|
+
const [open, setOpen] = useState(false);
|
|
2266
|
+
const [view, setView] = useState("preset");
|
|
2267
|
+
const [target, setTarget] = useState("text");
|
|
2268
|
+
const recent = useRecentColors(target);
|
|
2269
|
+
const activeTarget = onSelectBackground ? target : "text";
|
|
2270
|
+
const current = activeTarget === "text" ? currentColor : currentBackground ?? "";
|
|
2271
|
+
const textColor = isDefaultColor(currentColor) ? "currentColor" : currentColor;
|
|
2272
|
+
const background = isDefaultColor(currentBackground) ? void 0 : currentBackground;
|
|
2273
|
+
const handleOpenChange = (next) => {
|
|
2274
|
+
setOpen(next);
|
|
2275
|
+
if (!next) setView("preset");
|
|
2276
|
+
};
|
|
2277
|
+
const pick = (value) => {
|
|
2278
|
+
if (value !== "inherit") pushRecentColor(activeTarget, value);
|
|
2279
|
+
if (activeTarget === "background") onSelectBackground?.(value);
|
|
2280
|
+
else onSelect(value);
|
|
2281
|
+
handleOpenChange(false);
|
|
2282
|
+
};
|
|
2283
|
+
const triggerButton = /* @__PURE__ */ jsx("button", {
|
|
2284
|
+
"aria-label": "Text color",
|
|
2285
|
+
"data-tooltip": tooltip,
|
|
2286
|
+
type: "button",
|
|
2287
|
+
onMouseDown: (e) => e.preventDefault()
|
|
2288
|
+
});
|
|
2289
|
+
const trigger$2 = /* @__PURE__ */ jsxs(PopoverTrigger, {
|
|
2290
|
+
className: `${trigger}${className ? ` ${className}` : ""}`,
|
|
2291
|
+
render: triggerButton,
|
|
2292
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
2293
|
+
className: triggerLabel,
|
|
2294
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2295
|
+
className: triggerLetter,
|
|
2296
|
+
style: {
|
|
2297
|
+
color: textColor,
|
|
2298
|
+
backgroundColor: background
|
|
2299
|
+
},
|
|
2300
|
+
children: "A"
|
|
2301
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
2302
|
+
className: triggerBar,
|
|
2303
|
+
style: { backgroundColor: textColor }
|
|
2304
|
+
})]
|
|
2305
|
+
}), /* @__PURE__ */ jsx(ChevronDown, { className: triggerChevron })]
|
|
2306
|
+
});
|
|
2307
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
2308
|
+
open,
|
|
2309
|
+
onOpenChange: handleOpenChange,
|
|
2310
|
+
children: [tooltip ? /* @__PURE__ */ jsxs(TooltipRoot, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: trigger$2 }), /* @__PURE__ */ jsx(TooltipContent, {
|
|
2311
|
+
side: "bottom",
|
|
2312
|
+
children: tooltip
|
|
2313
|
+
})] }) : trigger$2, /* @__PURE__ */ jsx(PopoverPanel, {
|
|
2314
|
+
className: panel,
|
|
2315
|
+
side: "bottom",
|
|
2316
|
+
size: "md",
|
|
2317
|
+
children: view === "preset" ? /* @__PURE__ */ jsx(PresetView, {
|
|
2318
|
+
current,
|
|
2319
|
+
recent,
|
|
2320
|
+
target: activeTarget,
|
|
2321
|
+
onCustom: () => setView("picker"),
|
|
2322
|
+
onPick: pick,
|
|
2323
|
+
onTargetChange: onSelectBackground ? setTarget : void 0
|
|
2324
|
+
}) : /* @__PURE__ */ jsx(PickerView, {
|
|
2325
|
+
initialColor: current,
|
|
2326
|
+
onApply: pick,
|
|
2327
|
+
onBack: () => setView("preset"),
|
|
2328
|
+
onCancel: () => handleOpenChange(false)
|
|
2329
|
+
})
|
|
2330
|
+
})]
|
|
2331
|
+
});
|
|
2332
|
+
}
|
|
2333
|
+
var popup$3 = "_2buwsh1";
|
|
2334
|
+
var item$2 = "_2buwsh2";
|
|
2335
|
+
var empty = "_2buwsh3";
|
|
2336
|
+
//#endregion
|
|
2337
|
+
//#region src/components/combobox/index.tsx
|
|
2338
|
+
function Combobox(props) {
|
|
2339
|
+
return /* @__PURE__ */ jsx(Combobox$1.Root, { ...props });
|
|
2340
|
+
}
|
|
2341
|
+
function ComboboxTrigger({ className, ...props }) {
|
|
2342
|
+
return /* @__PURE__ */ jsx(Combobox$1.Trigger, {
|
|
2343
|
+
className,
|
|
2344
|
+
...props
|
|
2345
|
+
});
|
|
2346
|
+
}
|
|
2347
|
+
function ComboboxInput({ className, ...props }) {
|
|
2348
|
+
return /* @__PURE__ */ jsx(Combobox$1.Input, {
|
|
2349
|
+
className: className ?? "_2buwsh0",
|
|
2350
|
+
...props
|
|
2351
|
+
});
|
|
2352
|
+
}
|
|
2353
|
+
function ComboboxPortal({ children }) {
|
|
2354
|
+
return /* @__PURE__ */ jsx(Combobox$1.Portal, { children: /* @__PURE__ */ jsx(PortalThemeWrapper$1, { children }) });
|
|
2355
|
+
}
|
|
2356
|
+
function ComboboxContent({ align = "start", alignOffset = 0, side = "bottom", sideOffset = 4, className, positionMethod = "absolute", children, ...popupProps }) {
|
|
2357
|
+
return /* @__PURE__ */ jsx(ComboboxPortal, { children: /* @__PURE__ */ jsx(Combobox$1.Positioner, {
|
|
2358
|
+
align,
|
|
2359
|
+
alignOffset,
|
|
2360
|
+
positionMethod,
|
|
2361
|
+
side,
|
|
2362
|
+
sideOffset,
|
|
2363
|
+
style: { zIndex: 50 },
|
|
2364
|
+
children: /* @__PURE__ */ jsx(Combobox$1.Popup, {
|
|
2365
|
+
className: `${popup$3}${className ? ` ${className}` : ""}`,
|
|
2366
|
+
...popupProps,
|
|
2367
|
+
children
|
|
1739
2368
|
})
|
|
1740
2369
|
}) });
|
|
1741
2370
|
}
|
|
@@ -1744,7 +2373,7 @@ function ComboboxList(props) {
|
|
|
1744
2373
|
}
|
|
1745
2374
|
function ComboboxItem({ className, ...props }) {
|
|
1746
2375
|
return /* @__PURE__ */ jsx(Combobox$1.Item, {
|
|
1747
|
-
className: `${item$
|
|
2376
|
+
className: `${item$2}${className ? ` ${className}` : ""}`,
|
|
1748
2377
|
...props
|
|
1749
2378
|
});
|
|
1750
2379
|
}
|
|
@@ -1765,18 +2394,18 @@ function ComboboxGroupLabel(props) {
|
|
|
1765
2394
|
}
|
|
1766
2395
|
//#endregion
|
|
1767
2396
|
//#region src/components/dialog/styles.css.ts
|
|
1768
|
-
var backdrop = "
|
|
1769
|
-
var popup$
|
|
1770
|
-
var header = "
|
|
1771
|
-
var headerContent = "
|
|
1772
|
-
var footer = "
|
|
1773
|
-
var title = "
|
|
1774
|
-
var description = "
|
|
1775
|
-
var sheetBackdrop = "
|
|
1776
|
-
var sheetContainer = "
|
|
1777
|
-
var sheetDragHandle = "
|
|
1778
|
-
var sheetDragPill = "
|
|
1779
|
-
var sheetContent = "
|
|
2397
|
+
var backdrop = "vwlngv0";
|
|
2398
|
+
var popup$2 = "vwlngv1";
|
|
2399
|
+
var header$1 = "vwlngv3";
|
|
2400
|
+
var headerContent = "vwlngv4";
|
|
2401
|
+
var footer$1 = "vwlngv5";
|
|
2402
|
+
var title$1 = "vwlngv6";
|
|
2403
|
+
var description = "vwlngv7";
|
|
2404
|
+
var sheetBackdrop = "vwlngva";
|
|
2405
|
+
var sheetContainer = "vwlngvb";
|
|
2406
|
+
var sheetDragHandle = "vwlngvc";
|
|
2407
|
+
var sheetDragPill = "vwlngvd";
|
|
2408
|
+
var sheetContent = "vwlngve";
|
|
1780
2409
|
//#endregion
|
|
1781
2410
|
//#region src/components/dialog/index.tsx
|
|
1782
2411
|
function Dialog(props) {
|
|
@@ -1799,10 +2428,10 @@ function DialogBackdrop({ className, ...props }) {
|
|
|
1799
2428
|
}
|
|
1800
2429
|
function DialogPopup({ showCloseButton = true, className, children, ...props }) {
|
|
1801
2430
|
return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogBackdrop, {}), /* @__PURE__ */ jsxs(Dialog$1.Popup, {
|
|
1802
|
-
className: `${popup$
|
|
2431
|
+
className: `${popup$2}${className ? ` ${className}` : ""}`,
|
|
1803
2432
|
...props,
|
|
1804
2433
|
children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
1805
|
-
className: "
|
|
2434
|
+
className: "vwlngv2",
|
|
1806
2435
|
children: /* @__PURE__ */ jsx(X, {})
|
|
1807
2436
|
})]
|
|
1808
2437
|
})] });
|
|
@@ -1812,7 +2441,7 @@ function DialogClose(props) {
|
|
|
1812
2441
|
}
|
|
1813
2442
|
function DialogHeader({ className, children, ...props }) {
|
|
1814
2443
|
return /* @__PURE__ */ jsx("div", {
|
|
1815
|
-
className: `${header}${className ? ` ${className}` : ""}`,
|
|
2444
|
+
className: `${header$1}${className ? ` ${className}` : ""}`,
|
|
1816
2445
|
...props,
|
|
1817
2446
|
children: /* @__PURE__ */ jsx("div", {
|
|
1818
2447
|
className: headerContent,
|
|
@@ -1822,13 +2451,13 @@ function DialogHeader({ className, children, ...props }) {
|
|
|
1822
2451
|
}
|
|
1823
2452
|
function DialogFooter({ className, ...props }) {
|
|
1824
2453
|
return /* @__PURE__ */ jsx("div", {
|
|
1825
|
-
className: `${footer}${className ? ` ${className}` : ""}`,
|
|
2454
|
+
className: `${footer$1}${className ? ` ${className}` : ""}`,
|
|
1826
2455
|
...props
|
|
1827
2456
|
});
|
|
1828
2457
|
}
|
|
1829
2458
|
function DialogTitle({ className, ...props }) {
|
|
1830
2459
|
return /* @__PURE__ */ jsx(Dialog$1.Title, {
|
|
1831
|
-
className: `${title}${className ? ` ${className}` : ""}`,
|
|
2460
|
+
className: `${title$1}${className ? ` ${className}` : ""}`,
|
|
1832
2461
|
...props
|
|
1833
2462
|
});
|
|
1834
2463
|
}
|
|
@@ -1841,33 +2470,33 @@ function DialogDescription({ className, ...props }) {
|
|
|
1841
2470
|
//#endregion
|
|
1842
2471
|
//#region src/components/dialog/store.ts
|
|
1843
2472
|
var stack = [];
|
|
1844
|
-
var idCounter = 0;
|
|
1845
|
-
var listeners = /* @__PURE__ */ new Set();
|
|
1846
|
-
function emit() {
|
|
1847
|
-
for (const fn of listeners) fn();
|
|
2473
|
+
var idCounter$1 = 0;
|
|
2474
|
+
var listeners$1 = /* @__PURE__ */ new Set();
|
|
2475
|
+
function emit$1() {
|
|
2476
|
+
for (const fn of listeners$1) fn();
|
|
1848
2477
|
}
|
|
1849
2478
|
function subscribe(fn) {
|
|
1850
|
-
listeners.add(fn);
|
|
2479
|
+
listeners$1.add(fn);
|
|
1851
2480
|
return () => {
|
|
1852
|
-
listeners.delete(fn);
|
|
2481
|
+
listeners$1.delete(fn);
|
|
1853
2482
|
};
|
|
1854
2483
|
}
|
|
1855
2484
|
function getSnapshot() {
|
|
1856
2485
|
return stack;
|
|
1857
2486
|
}
|
|
1858
2487
|
function presentDialog(props) {
|
|
1859
|
-
const id = `dialog-${++idCounter}`;
|
|
2488
|
+
const id = `dialog-${++idCounter$1}`;
|
|
1860
2489
|
stack = [...stack, {
|
|
1861
2490
|
...props,
|
|
1862
2491
|
id,
|
|
1863
2492
|
open: true
|
|
1864
2493
|
}];
|
|
1865
|
-
emit();
|
|
2494
|
+
emit$1();
|
|
1866
2495
|
return () => dismissDialog(id);
|
|
1867
2496
|
}
|
|
1868
2497
|
function removeDialog(id) {
|
|
1869
2498
|
stack = stack.filter((item) => item.id !== id);
|
|
1870
|
-
emit();
|
|
2499
|
+
emit$1();
|
|
1871
2500
|
}
|
|
1872
2501
|
function dismissDialog(id) {
|
|
1873
2502
|
const target = stack.find((item) => item.id === id);
|
|
@@ -1876,9 +2505,19 @@ function dismissDialog(id) {
|
|
|
1876
2505
|
...item,
|
|
1877
2506
|
open: false
|
|
1878
2507
|
} : item);
|
|
1879
|
-
emit();
|
|
2508
|
+
emit$1();
|
|
1880
2509
|
target.onClose?.();
|
|
1881
2510
|
}
|
|
2511
|
+
async function requestDismissDialog(id) {
|
|
2512
|
+
const target = stack.find((item) => item.id === id);
|
|
2513
|
+
if (!target || !target.open) return;
|
|
2514
|
+
if (target.confirmDismiss && !await target.confirmDismiss()) return;
|
|
2515
|
+
dismissDialog(id);
|
|
2516
|
+
}
|
|
2517
|
+
function dialogWidthStyle(width) {
|
|
2518
|
+
if (width === void 0) return {};
|
|
2519
|
+
return { "--rc-dialog-width": typeof width === "number" ? `${width}px` : chromeWidth[width] };
|
|
2520
|
+
}
|
|
1882
2521
|
function dismissTopDialog() {
|
|
1883
2522
|
for (let i = stack.length - 1; i >= 0; i--) if (stack[i].open) {
|
|
1884
2523
|
dismissDialog(stack[i].id);
|
|
@@ -1891,14 +2530,168 @@ function dismissAllDialogs() {
|
|
|
1891
2530
|
...item,
|
|
1892
2531
|
open: false
|
|
1893
2532
|
}));
|
|
1894
|
-
emit();
|
|
2533
|
+
emit$1();
|
|
1895
2534
|
for (const item of closing) item.onClose?.();
|
|
1896
2535
|
}
|
|
1897
2536
|
//#endregion
|
|
2537
|
+
//#region src/components/dialog/confirm.tsx
|
|
2538
|
+
function confirmDiscardChanges({ cancelLabel = "Keep editing", confirmLabel = "Discard", description = "Your edits haven’t been saved.", title = "Discard changes?" } = {}) {
|
|
2539
|
+
return new Promise((resolve) => {
|
|
2540
|
+
let settled = false;
|
|
2541
|
+
const settle = (value) => {
|
|
2542
|
+
if (settled) return;
|
|
2543
|
+
settled = true;
|
|
2544
|
+
resolve(value);
|
|
2545
|
+
};
|
|
2546
|
+
presentDialog({
|
|
2547
|
+
title,
|
|
2548
|
+
description,
|
|
2549
|
+
showCloseButton: false,
|
|
2550
|
+
width: 360,
|
|
2551
|
+
onClose: () => settle(false),
|
|
2552
|
+
content: ({ dismiss }) => /* @__PURE__ */ jsxs("div", {
|
|
2553
|
+
className: footer$1,
|
|
2554
|
+
children: [/* @__PURE__ */ jsx(ActionButton, {
|
|
2555
|
+
size: "md",
|
|
2556
|
+
variant: "outline",
|
|
2557
|
+
onClick: () => {
|
|
2558
|
+
settle(false);
|
|
2559
|
+
dismiss();
|
|
2560
|
+
},
|
|
2561
|
+
children: cancelLabel
|
|
2562
|
+
}), /* @__PURE__ */ jsx(ActionButton, {
|
|
2563
|
+
autoFocus: true,
|
|
2564
|
+
danger: true,
|
|
2565
|
+
size: "md",
|
|
2566
|
+
variant: "solid",
|
|
2567
|
+
onClick: () => {
|
|
2568
|
+
settle(true);
|
|
2569
|
+
dismiss();
|
|
2570
|
+
},
|
|
2571
|
+
children: confirmLabel
|
|
2572
|
+
})]
|
|
2573
|
+
})
|
|
2574
|
+
});
|
|
2575
|
+
});
|
|
2576
|
+
}
|
|
2577
|
+
//#endregion
|
|
2578
|
+
//#region src/components/toast/store.ts
|
|
2579
|
+
var DEFAULT_DURATION = 2400;
|
|
2580
|
+
var toasts = [];
|
|
2581
|
+
var idCounter = 0;
|
|
2582
|
+
var timers = /* @__PURE__ */ new Map();
|
|
2583
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
2584
|
+
function emit() {
|
|
2585
|
+
for (const fn of listeners) fn();
|
|
2586
|
+
}
|
|
2587
|
+
function schedule(item) {
|
|
2588
|
+
const existing = timers.get(item.id);
|
|
2589
|
+
if (existing) clearTimeout(existing);
|
|
2590
|
+
timers.delete(item.id);
|
|
2591
|
+
if (item.tone === "loading" && item.duration === void 0) return;
|
|
2592
|
+
timers.set(item.id, setTimeout(() => dismissToast(item.id), item.duration ?? DEFAULT_DURATION));
|
|
2593
|
+
}
|
|
2594
|
+
function subscribeToasts(fn) {
|
|
2595
|
+
listeners.add(fn);
|
|
2596
|
+
return () => {
|
|
2597
|
+
listeners.delete(fn);
|
|
2598
|
+
};
|
|
2599
|
+
}
|
|
2600
|
+
function getToasts() {
|
|
2601
|
+
return toasts;
|
|
2602
|
+
}
|
|
2603
|
+
function toast(options) {
|
|
2604
|
+
const item = {
|
|
2605
|
+
...options,
|
|
2606
|
+
id: `toast-${++idCounter}`
|
|
2607
|
+
};
|
|
2608
|
+
toasts = [...toasts, item];
|
|
2609
|
+
schedule(item);
|
|
2610
|
+
emit();
|
|
2611
|
+
return item.id;
|
|
2612
|
+
}
|
|
2613
|
+
function updateToast(id, patch) {
|
|
2614
|
+
let updated;
|
|
2615
|
+
toasts = toasts.map((item) => {
|
|
2616
|
+
if (item.id !== id) return item;
|
|
2617
|
+
updated = {
|
|
2618
|
+
...item,
|
|
2619
|
+
...patch
|
|
2620
|
+
};
|
|
2621
|
+
return updated;
|
|
2622
|
+
});
|
|
2623
|
+
if (!updated) return;
|
|
2624
|
+
schedule(updated);
|
|
2625
|
+
emit();
|
|
2626
|
+
}
|
|
2627
|
+
function dismissToast(id) {
|
|
2628
|
+
const timer = timers.get(id);
|
|
2629
|
+
if (timer) clearTimeout(timer);
|
|
2630
|
+
timers.delete(id);
|
|
2631
|
+
if (!toasts.some((item) => item.id === id)) return;
|
|
2632
|
+
toasts = toasts.filter((item) => item.id !== id);
|
|
2633
|
+
emit();
|
|
2634
|
+
}
|
|
2635
|
+
//#endregion
|
|
2636
|
+
//#region src/components/toast/styles.css.ts
|
|
2637
|
+
var viewport = "xom7f32";
|
|
2638
|
+
var toast$1 = "xom7f33";
|
|
2639
|
+
var title = "xom7f34";
|
|
2640
|
+
var icon = "xom7f35";
|
|
2641
|
+
var spin = "xom7f36";
|
|
2642
|
+
var success = "xom7f37";
|
|
2643
|
+
var error$1 = "xom7f38";
|
|
2644
|
+
//#endregion
|
|
2645
|
+
//#region src/components/toast/index.tsx
|
|
2646
|
+
var EMPTY = [];
|
|
2647
|
+
function ToastIcon({ tone }) {
|
|
2648
|
+
if (tone === "loading") return /* @__PURE__ */ jsx(LoaderCircle, { className: `${icon} ${spin}` });
|
|
2649
|
+
if (tone === "success") return /* @__PURE__ */ jsx(CircleCheck, { className: `${icon} ${success}` });
|
|
2650
|
+
if (tone === "error") return /* @__PURE__ */ jsx(CircleAlert, { className: `${icon} ${error$1}` });
|
|
2651
|
+
return null;
|
|
2652
|
+
}
|
|
2653
|
+
function ToastViewport() {
|
|
2654
|
+
const items = useSyncExternalStore(subscribeToasts, getToasts, () => EMPTY);
|
|
2655
|
+
if (typeof document === "undefined") return null;
|
|
2656
|
+
return createPortal(/* @__PURE__ */ jsx(PortalThemeWrapper$1, { children: /* @__PURE__ */ jsx("div", {
|
|
2657
|
+
"aria-live": "polite",
|
|
2658
|
+
className: viewport,
|
|
2659
|
+
role: "status",
|
|
2660
|
+
children: items.map((item) => /* @__PURE__ */ jsxs("div", {
|
|
2661
|
+
className: toast$1,
|
|
2662
|
+
children: [
|
|
2663
|
+
/* @__PURE__ */ jsx(ToastIcon, { tone: item.tone }),
|
|
2664
|
+
/* @__PURE__ */ jsx("span", {
|
|
2665
|
+
className: title,
|
|
2666
|
+
children: item.title
|
|
2667
|
+
}),
|
|
2668
|
+
item.action && /* @__PURE__ */ jsx(ActionButton, {
|
|
2669
|
+
size: "sm",
|
|
2670
|
+
onClick: () => {
|
|
2671
|
+
item.action?.onClick();
|
|
2672
|
+
dismissToast(item.id);
|
|
2673
|
+
},
|
|
2674
|
+
children: item.action.label
|
|
2675
|
+
})
|
|
2676
|
+
]
|
|
2677
|
+
}, item.id))
|
|
2678
|
+
}) }), document.body);
|
|
2679
|
+
}
|
|
2680
|
+
//#endregion
|
|
1898
2681
|
//#region src/components/dialog/sheet.tsx
|
|
2682
|
+
function isScrollRegion(el) {
|
|
2683
|
+
if (el.isContentEditable || el.classList.contains("cm-editor")) return true;
|
|
2684
|
+
const { overflowY } = getComputedStyle(el);
|
|
2685
|
+
return (overflowY === "auto" || overflowY === "scroll") && el.scrollHeight > el.clientHeight;
|
|
2686
|
+
}
|
|
2687
|
+
function isInsideScrolledRegion(target, boundary) {
|
|
2688
|
+
for (let el = target; el && el !== boundary; el = el.parentElement) if (el.scrollTop > 0 && isScrollRegion(el)) return true;
|
|
2689
|
+
return false;
|
|
2690
|
+
}
|
|
1899
2691
|
var SheetStackEntry = ({ item, index }) => {
|
|
1900
|
-
const { id, open, title
|
|
2692
|
+
const { id, open, title, description: description$4, content, className, portalClassName, theme = "light", clickOutsideToDismiss = true } = item;
|
|
1901
2693
|
const dismiss = useCallback(() => dismissDialog(id), [id]);
|
|
2694
|
+
const requestDismiss = useCallback(() => requestDismissDialog(id), [id]);
|
|
1902
2695
|
useEffect(() => {
|
|
1903
2696
|
if (!open) {
|
|
1904
2697
|
const timer = setTimeout(() => removeDialog(id), 200);
|
|
@@ -1913,16 +2706,13 @@ var SheetStackEntry = ({ item, index }) => {
|
|
|
1913
2706
|
};
|
|
1914
2707
|
}, []);
|
|
1915
2708
|
const sheetRef = useRef(null);
|
|
1916
|
-
const contentRef = useRef(null);
|
|
1917
2709
|
const dragState = useRef(null);
|
|
1918
2710
|
const [translateY, setTranslateY] = useState(0);
|
|
1919
2711
|
const [isDragging, setIsDragging] = useState(false);
|
|
1920
2712
|
const handleTouchStart = useCallback((e) => {
|
|
1921
2713
|
const touch = e.touches[0];
|
|
1922
|
-
const
|
|
1923
|
-
|
|
1924
|
-
const isContentAtTop = !contentEl || contentEl.scrollTop <= 0;
|
|
1925
|
-
if (!isHandle && !isContentAtTop) return;
|
|
2714
|
+
const target = e.target;
|
|
2715
|
+
if (!(target.closest(`.vwlngvc, .vwlngvf`) !== null) && isInsideScrolledRegion(target, sheetRef.current)) return;
|
|
1926
2716
|
dragState.current = {
|
|
1927
2717
|
startY: touch.clientY,
|
|
1928
2718
|
startTime: Date.now(),
|
|
@@ -1962,14 +2752,15 @@ var SheetStackEntry = ({ item, index }) => {
|
|
|
1962
2752
|
const deltaY = state.currentY - state.startY;
|
|
1963
2753
|
const elapsed = Date.now() - state.startTime;
|
|
1964
2754
|
const velocity = deltaY / Math.max(elapsed, 1) * 1e3;
|
|
1965
|
-
|
|
1966
|
-
|
|
2755
|
+
const threshold = (sheetRef.current?.offsetHeight ?? 0) * .25;
|
|
2756
|
+
setTranslateY(0);
|
|
2757
|
+
if (deltaY > threshold || velocity > 500) requestDismiss();
|
|
1967
2758
|
setIsDragging(false);
|
|
1968
2759
|
dragState.current = null;
|
|
1969
|
-
}, [
|
|
2760
|
+
}, [requestDismiss]);
|
|
1970
2761
|
const zIndex = 50 + index;
|
|
1971
2762
|
const sheetHeight = sheetRef.current?.offsetHeight || 1;
|
|
1972
|
-
const backdropOpacity = isDragging ? Math.max(0, 1 - translateY / sheetHeight)
|
|
2763
|
+
const backdropOpacity = isDragging ? Math.max(0, 1 - translateY / sheetHeight) : 1;
|
|
1973
2764
|
return /* @__PURE__ */ jsx(PortalThemeProvider$1, {
|
|
1974
2765
|
className: portalClassName ?? "",
|
|
1975
2766
|
theme,
|
|
@@ -1980,7 +2771,7 @@ var SheetStackEntry = ({ item, index }) => {
|
|
|
1980
2771
|
opacity: open ? backdropOpacity : 0,
|
|
1981
2772
|
pointerEvents: open ? "auto" : "none"
|
|
1982
2773
|
},
|
|
1983
|
-
onClick: clickOutsideToDismiss ?
|
|
2774
|
+
onClick: clickOutsideToDismiss ? requestDismiss : void 0
|
|
1984
2775
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1985
2776
|
className: `${sheetContainer}${className ? ` ${className}` : ""}`,
|
|
1986
2777
|
"data-closed": !open ? "" : void 0,
|
|
@@ -1999,20 +2790,22 @@ var SheetStackEntry = ({ item, index }) => {
|
|
|
1999
2790
|
className: sheetDragHandle,
|
|
2000
2791
|
children: /* @__PURE__ */ jsx("div", { className: sheetDragPill })
|
|
2001
2792
|
}),
|
|
2002
|
-
(title
|
|
2003
|
-
className: "
|
|
2004
|
-
children: [title
|
|
2005
|
-
className: "
|
|
2006
|
-
children: title
|
|
2793
|
+
(title || description$4) && /* @__PURE__ */ jsxs("div", {
|
|
2794
|
+
className: "vwlngvf",
|
|
2795
|
+
children: [title && /* @__PURE__ */ jsx("div", {
|
|
2796
|
+
className: "vwlngv6",
|
|
2797
|
+
children: title
|
|
2007
2798
|
}), description$4 && /* @__PURE__ */ jsx("div", {
|
|
2008
|
-
className: "
|
|
2799
|
+
className: "vwlngv7",
|
|
2009
2800
|
children: description$4
|
|
2010
2801
|
})]
|
|
2011
2802
|
}),
|
|
2012
2803
|
/* @__PURE__ */ jsx("div", {
|
|
2013
2804
|
className: sheetContent,
|
|
2014
|
-
|
|
2015
|
-
|
|
2805
|
+
children: createElement(content, {
|
|
2806
|
+
dismiss,
|
|
2807
|
+
requestDismiss
|
|
2808
|
+
})
|
|
2016
2809
|
})
|
|
2017
2810
|
]
|
|
2018
2811
|
})] })
|
|
@@ -2035,8 +2828,9 @@ function shouldUseSheet(sheet, isMobile) {
|
|
|
2035
2828
|
}
|
|
2036
2829
|
var CloseIcon = () => /* @__PURE__ */ jsx(X, {});
|
|
2037
2830
|
var DialogStackEntry = ({ item, index }) => {
|
|
2038
|
-
const { id, open, title
|
|
2831
|
+
const { id, open, title, description: description$3, content, className, portalClassName, theme = "light", showCloseButton = true, clickOutsideToDismiss = true, width } = item;
|
|
2039
2832
|
const dismiss = useCallback(() => dismissDialog(id), [id]);
|
|
2833
|
+
const requestDismiss = useCallback(() => requestDismissDialog(id), [id]);
|
|
2040
2834
|
useEffect(() => {
|
|
2041
2835
|
if (!open) {
|
|
2042
2836
|
const timer = setTimeout(() => {
|
|
@@ -2050,7 +2844,7 @@ var DialogStackEntry = ({ item, index }) => {
|
|
|
2050
2844
|
disablePointerDismissal: !clickOutsideToDismiss,
|
|
2051
2845
|
open,
|
|
2052
2846
|
onOpenChange: (open) => {
|
|
2053
|
-
if (!open)
|
|
2847
|
+
if (!open) requestDismiss();
|
|
2054
2848
|
},
|
|
2055
2849
|
children: /* @__PURE__ */ jsx(Dialog$1.Portal, { children: /* @__PURE__ */ jsx(PortalThemeProvider$1, {
|
|
2056
2850
|
className: portalClassName ?? "",
|
|
@@ -2060,25 +2854,31 @@ var DialogStackEntry = ({ item, index }) => {
|
|
|
2060
2854
|
style: { zIndex }
|
|
2061
2855
|
}), /* @__PURE__ */ jsxs(Dialog$1.Popup, {
|
|
2062
2856
|
suppressHydrationWarning: true,
|
|
2063
|
-
className: `${popup$
|
|
2857
|
+
className: `${popup$2}${className ? ` ${className}` : ""}`,
|
|
2064
2858
|
"data-theme": theme,
|
|
2065
|
-
style: {
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2859
|
+
style: {
|
|
2860
|
+
zIndex: zIndex + 1,
|
|
2861
|
+
...dialogWidthStyle(width)
|
|
2862
|
+
},
|
|
2863
|
+
children: [(title || description$3 || showCloseButton) && /* @__PURE__ */ jsxs("div", {
|
|
2864
|
+
className: "vwlngv3",
|
|
2865
|
+
children: [(title || description$3) && /* @__PURE__ */ jsxs("div", {
|
|
2866
|
+
className: "vwlngv4",
|
|
2867
|
+
children: [title && /* @__PURE__ */ jsx(Dialog$1.Title, {
|
|
2868
|
+
className: "vwlngv6",
|
|
2869
|
+
children: title
|
|
2073
2870
|
}), description$3 && /* @__PURE__ */ jsx(Dialog$1.Description, {
|
|
2074
|
-
className: "
|
|
2871
|
+
className: "vwlngv7",
|
|
2075
2872
|
children: description$3
|
|
2076
2873
|
})]
|
|
2077
2874
|
}), showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
2078
|
-
className: "
|
|
2875
|
+
className: "vwlngv2",
|
|
2079
2876
|
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
2080
2877
|
})]
|
|
2081
|
-
}), createElement(content, {
|
|
2878
|
+
}), createElement(content, {
|
|
2879
|
+
dismiss,
|
|
2880
|
+
requestDismiss
|
|
2881
|
+
})]
|
|
2082
2882
|
})] })
|
|
2083
2883
|
}) })
|
|
2084
2884
|
});
|
|
@@ -2086,25 +2886,31 @@ var DialogStackEntry = ({ item, index }) => {
|
|
|
2086
2886
|
var DialogStackProvider = ({ children }) => {
|
|
2087
2887
|
const stack = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
2088
2888
|
const isMobile = useIsMobile();
|
|
2089
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2889
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2890
|
+
children,
|
|
2891
|
+
/* @__PURE__ */ jsx(ToastViewport, {}),
|
|
2892
|
+
stack.map((item, index) => shouldUseSheet(item.sheet, isMobile) ? /* @__PURE__ */ jsx(SheetStackEntry, {
|
|
2893
|
+
index,
|
|
2894
|
+
item
|
|
2895
|
+
}, item.id) : /* @__PURE__ */ jsx(DialogStackEntry, {
|
|
2896
|
+
index,
|
|
2897
|
+
item
|
|
2898
|
+
}, item.id))
|
|
2899
|
+
] });
|
|
2096
2900
|
};
|
|
2097
2901
|
//#endregion
|
|
2098
2902
|
//#region src/components/dropdown-menu/styles.css.ts
|
|
2099
|
-
var popup$
|
|
2100
|
-
var positioner$
|
|
2101
|
-
var item$
|
|
2102
|
-
var separator$1 = "
|
|
2103
|
-
var label = "
|
|
2903
|
+
var popup$1 = "oih0op0";
|
|
2904
|
+
var positioner$1 = "oih0op1";
|
|
2905
|
+
var item$1 = "oih0op2";
|
|
2906
|
+
var separator$1 = "_1sxaacb3";
|
|
2907
|
+
var label$1 = "_1sxaacb4";
|
|
2104
2908
|
var checkboxItem = "oih0op3";
|
|
2105
2909
|
var radioItem = "oih0op3";
|
|
2106
2910
|
var checkboxIndicator = "oih0op4";
|
|
2107
|
-
var radioIndicator = "
|
|
2911
|
+
var radioIndicator = "oih0op4";
|
|
2912
|
+
var subTrigger = "oih0op5";
|
|
2913
|
+
var subTriggerValue = "oih0op6";
|
|
2108
2914
|
//#endregion
|
|
2109
2915
|
//#region src/components/dropdown-menu/index.tsx
|
|
2110
2916
|
function DropdownMenu(props) {
|
|
@@ -2126,14 +2932,14 @@ function DropdownMenuContent({ align = "start", alignOffset = 0, side = "bottom"
|
|
|
2126
2932
|
return /* @__PURE__ */ jsx(DropdownMenuPortal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
2127
2933
|
align,
|
|
2128
2934
|
alignOffset,
|
|
2129
|
-
className: positioner$
|
|
2935
|
+
className: positioner$1,
|
|
2130
2936
|
"data-slot": "dropdown-menu-positioner",
|
|
2131
2937
|
positionMethod,
|
|
2132
2938
|
side,
|
|
2133
2939
|
sideOffset,
|
|
2134
2940
|
style: { zIndex: 50 },
|
|
2135
2941
|
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
2136
|
-
className: `${popup$
|
|
2942
|
+
className: `${popup$1}${className ? ` ${className}` : ""}`,
|
|
2137
2943
|
"data-slot": "dropdown-menu-content",
|
|
2138
2944
|
...popupProps,
|
|
2139
2945
|
children
|
|
@@ -2148,16 +2954,41 @@ function DropdownMenuGroup(props) {
|
|
|
2148
2954
|
}
|
|
2149
2955
|
function DropdownMenuLabel({ className, ...props }) {
|
|
2150
2956
|
return /* @__PURE__ */ jsx(Menu.GroupLabel, {
|
|
2151
|
-
className: `${label}${className ? ` ${className}` : ""}`,
|
|
2957
|
+
className: `${label$1}${className ? ` ${className}` : ""}`,
|
|
2152
2958
|
"data-slot": "dropdown-menu-label",
|
|
2153
2959
|
...props
|
|
2154
2960
|
});
|
|
2155
2961
|
}
|
|
2156
|
-
function DropdownMenuItem({ className, ...props }) {
|
|
2157
|
-
|
|
2158
|
-
|
|
2962
|
+
function DropdownMenuItem({ className, children, shortcut: shortcut$2, variant = "default", ...props }) {
|
|
2963
|
+
const classes = [
|
|
2964
|
+
item$1,
|
|
2965
|
+
variant === "destructive" && "_1sxaacb1",
|
|
2966
|
+
className
|
|
2967
|
+
].filter(Boolean).join(" ");
|
|
2968
|
+
return /* @__PURE__ */ jsxs(Menu.Item, {
|
|
2969
|
+
className: classes,
|
|
2159
2970
|
"data-slot": "dropdown-menu-item",
|
|
2160
|
-
...props
|
|
2971
|
+
...props,
|
|
2972
|
+
children: [children, shortcut$2 && /* @__PURE__ */ jsx(Kbd, {
|
|
2973
|
+
className: "_1sxaacb2",
|
|
2974
|
+
keys: shortcut$2,
|
|
2975
|
+
size: "sm",
|
|
2976
|
+
tone: "muted"
|
|
2977
|
+
})]
|
|
2978
|
+
});
|
|
2979
|
+
}
|
|
2980
|
+
function DropdownMenuSub(props) {
|
|
2981
|
+
return /* @__PURE__ */ jsx(Menu.SubmenuRoot, { ...props });
|
|
2982
|
+
}
|
|
2983
|
+
function DropdownMenuSubTrigger({ className, children, value, ...props }) {
|
|
2984
|
+
return /* @__PURE__ */ jsxs(Menu.SubmenuTrigger, {
|
|
2985
|
+
className: `${item$1} ${subTrigger}${className ? ` ${className}` : ""}`,
|
|
2986
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
2987
|
+
...props,
|
|
2988
|
+
children: [children, /* @__PURE__ */ jsxs("span", {
|
|
2989
|
+
className: subTriggerValue,
|
|
2990
|
+
children: [value, /* @__PURE__ */ jsx(ChevronRight, {})]
|
|
2991
|
+
})]
|
|
2161
2992
|
});
|
|
2162
2993
|
}
|
|
2163
2994
|
function DropdownMenuSeparator({ className, ...props }) {
|
|
@@ -2175,7 +3006,7 @@ function DropdownMenuRadioGroup(props) {
|
|
|
2175
3006
|
}
|
|
2176
3007
|
function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
2177
3008
|
return /* @__PURE__ */ jsxs(Menu.RadioItem, {
|
|
2178
|
-
className: `${item$
|
|
3009
|
+
className: `${item$1} ${radioItem}${className ? ` ${className}` : ""}`,
|
|
2179
3010
|
"data-slot": "dropdown-menu-radio-item",
|
|
2180
3011
|
...props,
|
|
2181
3012
|
children: [children, /* @__PURE__ */ jsx(Menu.RadioItemIndicator, {
|
|
@@ -2187,7 +3018,7 @@ function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
|
2187
3018
|
}
|
|
2188
3019
|
function DropdownMenuCheckboxItem({ className, children, ...props }) {
|
|
2189
3020
|
return /* @__PURE__ */ jsxs(Menu.CheckboxItem, {
|
|
2190
|
-
className: `${item$
|
|
3021
|
+
className: `${item$1} ${checkboxItem}${className ? ` ${className}` : ""}`,
|
|
2191
3022
|
"data-slot": "dropdown-menu-checkbox-item",
|
|
2192
3023
|
...props,
|
|
2193
3024
|
children: [children, /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, {
|
|
@@ -2201,18 +3032,144 @@ function CheckIcon() {
|
|
|
2201
3032
|
return /* @__PURE__ */ jsx(Check, { size: 16 });
|
|
2202
3033
|
}
|
|
2203
3034
|
//#endregion
|
|
3035
|
+
//#region src/components/field/styles.css.ts
|
|
3036
|
+
var field$1 = "_1i1no470";
|
|
3037
|
+
var label = "_1i1no471";
|
|
3038
|
+
var hint = "_1i1no472";
|
|
3039
|
+
var error = "_1i1no473";
|
|
3040
|
+
//#endregion
|
|
3041
|
+
//#region src/components/field/index.tsx
|
|
3042
|
+
function Field({ children, className, error: error$2, hint: hint$1, id, label: label$3 }) {
|
|
3043
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3044
|
+
className: `${field$1}${className ? ` ${className}` : ""}`,
|
|
3045
|
+
children: [
|
|
3046
|
+
/* @__PURE__ */ jsx("label", {
|
|
3047
|
+
className: label,
|
|
3048
|
+
htmlFor: id,
|
|
3049
|
+
children: label$3
|
|
3050
|
+
}),
|
|
3051
|
+
children,
|
|
3052
|
+
error$2 ? /* @__PURE__ */ jsx("p", {
|
|
3053
|
+
className: error,
|
|
3054
|
+
id: `${id}-error`,
|
|
3055
|
+
role: "alert",
|
|
3056
|
+
children: error$2
|
|
3057
|
+
}) : hint$1 ? /* @__PURE__ */ jsx("p", {
|
|
3058
|
+
className: hint,
|
|
3059
|
+
id: `${id}-hint`,
|
|
3060
|
+
children: hint$1
|
|
3061
|
+
}) : null
|
|
3062
|
+
]
|
|
3063
|
+
});
|
|
3064
|
+
}
|
|
3065
|
+
//#endregion
|
|
3066
|
+
//#region src/components/modal-shell/styles.css.ts
|
|
3067
|
+
var shell = "_1q3gqvh0";
|
|
3068
|
+
var header = "_1q3gqvh1";
|
|
3069
|
+
var headerLead = "_1q3gqvh2";
|
|
3070
|
+
var headerTitle = "_1q3gqvh4";
|
|
3071
|
+
var headerCenter = "_1q3gqvh5";
|
|
3072
|
+
var headerActions = "_1q3gqvh6";
|
|
3073
|
+
var body = "_1q3gqvh8";
|
|
3074
|
+
var footer = "_1q3gqvh9";
|
|
3075
|
+
var footerStatus = "_1q3gqvha";
|
|
3076
|
+
//#endregion
|
|
3077
|
+
//#region src/components/modal-shell/index.tsx
|
|
3078
|
+
function ModalShell({ children, className, onSave }) {
|
|
3079
|
+
const handleKeyDown = (event) => {
|
|
3080
|
+
if (!onSave || event.defaultPrevented || !(event.metaKey || event.ctrlKey)) return;
|
|
3081
|
+
if (event.key === "s" || event.key === "Enter") {
|
|
3082
|
+
event.preventDefault();
|
|
3083
|
+
onSave();
|
|
3084
|
+
}
|
|
3085
|
+
};
|
|
3086
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3087
|
+
className: `${shell}${className ? ` ${className}` : ""}`,
|
|
3088
|
+
onKeyDown: handleKeyDown,
|
|
3089
|
+
children
|
|
3090
|
+
});
|
|
3091
|
+
}
|
|
3092
|
+
function ModalShellHeader({ actions, center, closeLabel = "Close", icon, onClose, title }) {
|
|
3093
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3094
|
+
className: header,
|
|
3095
|
+
children: [
|
|
3096
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3097
|
+
className: headerLead,
|
|
3098
|
+
children: [icon && /* @__PURE__ */ jsx("span", {
|
|
3099
|
+
className: "_1q3gqvh3",
|
|
3100
|
+
children: icon
|
|
3101
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
3102
|
+
className: headerTitle,
|
|
3103
|
+
children: title
|
|
3104
|
+
})]
|
|
3105
|
+
}),
|
|
3106
|
+
/* @__PURE__ */ jsx("div", {
|
|
3107
|
+
className: headerCenter,
|
|
3108
|
+
children: center
|
|
3109
|
+
}),
|
|
3110
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3111
|
+
className: headerActions,
|
|
3112
|
+
children: [actions, onClose && /* @__PURE__ */ jsxs(Fragment, { children: [actions && /* @__PURE__ */ jsx("span", { className: "_1q3gqvh7" }), /* @__PURE__ */ jsx(ActionButton, {
|
|
3113
|
+
icon: true,
|
|
3114
|
+
"aria-label": closeLabel,
|
|
3115
|
+
size: "md",
|
|
3116
|
+
title: closeLabel,
|
|
3117
|
+
onClick: onClose,
|
|
3118
|
+
children: /* @__PURE__ */ jsx(X, {})
|
|
3119
|
+
})] })]
|
|
3120
|
+
})
|
|
3121
|
+
]
|
|
3122
|
+
});
|
|
3123
|
+
}
|
|
3124
|
+
function ModalShellBody({ children, className }) {
|
|
3125
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3126
|
+
className: `${body}${className ? ` ${className}` : ""}`,
|
|
3127
|
+
children
|
|
3128
|
+
});
|
|
3129
|
+
}
|
|
3130
|
+
function ModalShellFooter({ cancelLabel = "Cancel", children, dirty, onCancel, onSave, saveDisabled, saveLabel = "Save", status }) {
|
|
3131
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3132
|
+
className: footer,
|
|
3133
|
+
children: [
|
|
3134
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3135
|
+
className: footerStatus,
|
|
3136
|
+
children: [dirty && /* @__PURE__ */ jsx("span", {
|
|
3137
|
+
"aria-hidden": true,
|
|
3138
|
+
className: "_1q3gqvhb"
|
|
3139
|
+
}), status]
|
|
3140
|
+
}),
|
|
3141
|
+
children,
|
|
3142
|
+
onCancel && /* @__PURE__ */ jsx(ActionButton, {
|
|
3143
|
+
size: "md",
|
|
3144
|
+
variant: "outline",
|
|
3145
|
+
onClick: onCancel,
|
|
3146
|
+
children: cancelLabel
|
|
3147
|
+
}),
|
|
3148
|
+
onSave && /* @__PURE__ */ jsxs(ActionButton, {
|
|
3149
|
+
disabled: saveDisabled,
|
|
3150
|
+
size: "md",
|
|
3151
|
+
variant: "solid",
|
|
3152
|
+
onClick: onSave,
|
|
3153
|
+
children: [saveLabel, /* @__PURE__ */ jsx(Kbd, {
|
|
3154
|
+
keys: ["mod", "s"],
|
|
3155
|
+
size: "sm",
|
|
3156
|
+
tone: "inverted"
|
|
3157
|
+
})]
|
|
3158
|
+
})
|
|
3159
|
+
]
|
|
3160
|
+
});
|
|
3161
|
+
}
|
|
3162
|
+
//#endregion
|
|
2204
3163
|
//#region src/components/quote-attribution/styles.css.ts
|
|
2205
|
-
var
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
var overlay = "_1dj5lvb0";
|
|
2211
|
-
var panel = "_1dj5lvb1";
|
|
2212
|
-
var input = "_1dj5lvb2";
|
|
3164
|
+
var slot = "_1dj5lvb0";
|
|
3165
|
+
var text = "_1dj5lvb1";
|
|
3166
|
+
var field = "_1dj5lvb2";
|
|
3167
|
+
var dash = "_1dj5lvb3";
|
|
3168
|
+
var input$1 = "_1dj5lvb4";
|
|
2213
3169
|
//#endregion
|
|
2214
3170
|
//#region src/components/quote-attribution/QuoteAttributionPlugin.tsx
|
|
2215
3171
|
var RICH_QUOTE_TYPE = "rich-quote";
|
|
3172
|
+
var SLOT_ATTR = "data-quote-attribution-slot";
|
|
2216
3173
|
function $isRichQuoteLike(node) {
|
|
2217
3174
|
if (!node) return false;
|
|
2218
3175
|
const ctor = node.constructor;
|
|
@@ -2227,98 +3184,104 @@ function $collectQuotes() {
|
|
|
2227
3184
|
for (const child of $getRoot().getChildren()) visit(child);
|
|
2228
3185
|
return out;
|
|
2229
3186
|
}
|
|
2230
|
-
function
|
|
2231
|
-
const
|
|
2232
|
-
return
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
}
|
|
3187
|
+
function $activeQuoteKey() {
|
|
3188
|
+
const selection = $getSelection();
|
|
3189
|
+
if (!$isRangeSelection(selection)) return null;
|
|
3190
|
+
let node = selection.anchor.getNode();
|
|
3191
|
+
while (node) {
|
|
3192
|
+
if ($isRichQuoteLike(node)) return node.getKey();
|
|
3193
|
+
node = node.getParent();
|
|
3194
|
+
}
|
|
3195
|
+
return null;
|
|
2238
3196
|
}
|
|
2239
|
-
function
|
|
2240
|
-
if (
|
|
2241
|
-
|
|
2242
|
-
return
|
|
3197
|
+
function findSlot(quote) {
|
|
3198
|
+
if (!quote) return null;
|
|
3199
|
+
for (const child of quote.children) if (child.hasAttribute(SLOT_ATTR)) return child;
|
|
3200
|
+
return null;
|
|
2243
3201
|
}
|
|
2244
3202
|
function QuoteAttributionPlugin() {
|
|
2245
3203
|
const [editor] = useLexicalComposerContext();
|
|
2246
|
-
const portalContainer = usePortalContainer();
|
|
2247
3204
|
const [quotes, setQuotes] = useState([]);
|
|
3205
|
+
const [activeKey, setActiveKey] = useState(null);
|
|
3206
|
+
const [editable, setEditable] = useState(() => editor.isEditable());
|
|
3207
|
+
useEffect(() => editor.registerEditableListener(setEditable), [editor]);
|
|
2248
3208
|
useEffect(() => {
|
|
2249
3209
|
const collect = () => {
|
|
2250
3210
|
editor.getEditorState().read(() => {
|
|
2251
3211
|
const list = [];
|
|
2252
3212
|
for (const node of $collectQuotes()) {
|
|
2253
|
-
const
|
|
2254
|
-
if (
|
|
3213
|
+
const slot = findSlot(editor.getElementByKey(node.getKey()));
|
|
3214
|
+
if (slot) list.push({
|
|
2255
3215
|
key: node.getKey(),
|
|
2256
3216
|
attribution: node.getAttribution() ?? "",
|
|
2257
|
-
|
|
3217
|
+
slot
|
|
2258
3218
|
});
|
|
2259
3219
|
}
|
|
2260
3220
|
setQuotes(list);
|
|
3221
|
+
setActiveKey($activeQuoteKey());
|
|
2261
3222
|
});
|
|
2262
3223
|
};
|
|
2263
|
-
|
|
2264
|
-
|
|
3224
|
+
const removeRoot = editor.registerRootListener(() => queueMicrotask(collect));
|
|
3225
|
+
const removeUpdate = editor.registerUpdateListener(collect);
|
|
3226
|
+
return () => {
|
|
3227
|
+
removeRoot();
|
|
3228
|
+
removeUpdate();
|
|
3229
|
+
};
|
|
2265
3230
|
}, [editor]);
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
3231
|
+
return /* @__PURE__ */ jsx(Fragment, { children: quotes.map((quote) => createPortal(/* @__PURE__ */ jsx(QuoteAttribution, {
|
|
3232
|
+
active: quote.key === activeKey,
|
|
3233
|
+
attribution: quote.attribution,
|
|
3234
|
+
editable,
|
|
2270
3235
|
editor,
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
},
|
|
3236
|
+
quoteKey: quote.key,
|
|
3237
|
+
slot: quote.slot
|
|
3238
|
+
}), quote.slot, quote.key)) });
|
|
2274
3239
|
}
|
|
2275
|
-
|
|
2276
|
-
|
|
3240
|
+
var stop = (event) => event.stopPropagation();
|
|
3241
|
+
function QuoteAttribution({ active, attribution, editable, editor, quoteKey, slot: slot$1 }) {
|
|
2277
3242
|
const [value, setValue] = useState(attribution);
|
|
2278
3243
|
const [focused, setFocused] = useState(false);
|
|
2279
3244
|
useEffect(() => {
|
|
2280
3245
|
if (!focused) setValue(attribution);
|
|
2281
3246
|
}, [attribution, focused]);
|
|
2282
3247
|
useLayoutEffect(() => {
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
return () => {
|
|
2298
|
-
quoteDom.removeAttribute("data-attribution-panel");
|
|
2299
|
-
ro.disconnect();
|
|
2300
|
-
window.removeEventListener("scroll", sync, true);
|
|
2301
|
-
window.removeEventListener("resize", sync);
|
|
2302
|
-
};
|
|
2303
|
-
}, [quoteDom]);
|
|
3248
|
+
slot$1.classList.add(slot);
|
|
3249
|
+
slot$1.toggleAttribute("data-empty", !attribution);
|
|
3250
|
+
slot$1.toggleAttribute("data-active", active || focused);
|
|
3251
|
+
}, [
|
|
3252
|
+
active,
|
|
3253
|
+
attribution,
|
|
3254
|
+
focused,
|
|
3255
|
+
slot$1
|
|
3256
|
+
]);
|
|
3257
|
+
useLayoutEffect(() => () => {
|
|
3258
|
+
slot$1.classList.remove(slot);
|
|
3259
|
+
slot$1.removeAttribute("data-empty");
|
|
3260
|
+
slot$1.removeAttribute("data-active");
|
|
3261
|
+
}, [slot$1]);
|
|
2304
3262
|
const commit = useCallback((raw) => {
|
|
2305
|
-
const
|
|
3263
|
+
const next = raw.trim() || null;
|
|
3264
|
+
if (next === (attribution || null)) return;
|
|
2306
3265
|
editor.update(() => {
|
|
2307
3266
|
const node = $getNodeByKey(quoteKey);
|
|
2308
|
-
if ($isRichQuoteLike(node)) node.setAttribution(
|
|
3267
|
+
if ($isRichQuoteLike(node)) node.setAttribution(next);
|
|
2309
3268
|
});
|
|
2310
|
-
}, [
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
3269
|
+
}, [
|
|
3270
|
+
attribution,
|
|
3271
|
+
editor,
|
|
3272
|
+
quoteKey
|
|
3273
|
+
]);
|
|
3274
|
+
const handleKeyDown = useCallback((event) => {
|
|
3275
|
+
event.stopPropagation();
|
|
3276
|
+
if (event.key === "Enter") {
|
|
3277
|
+
event.preventDefault();
|
|
2315
3278
|
commit(value);
|
|
2316
|
-
|
|
3279
|
+
event.currentTarget.blur();
|
|
2317
3280
|
editor.focus();
|
|
2318
|
-
} else if (
|
|
2319
|
-
|
|
3281
|
+
} else if (event.key === "Escape") {
|
|
3282
|
+
event.preventDefault();
|
|
2320
3283
|
setValue(attribution);
|
|
2321
|
-
|
|
3284
|
+
event.currentTarget.blur();
|
|
2322
3285
|
editor.focus();
|
|
2323
3286
|
}
|
|
2324
3287
|
}, [
|
|
@@ -2327,53 +3290,44 @@ function QuotePanel({ attribution, editor, quoteDom, quoteKey }) {
|
|
|
2327
3290
|
editor,
|
|
2328
3291
|
value
|
|
2329
3292
|
]);
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
return /* @__PURE__ */
|
|
2335
|
-
className:
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
setFocused(false);
|
|
2369
|
-
commit(e.currentTarget.value);
|
|
2370
|
-
},
|
|
2371
|
-
onChange: (e) => {
|
|
2372
|
-
e.stopPropagation();
|
|
2373
|
-
setValue(e.target.value);
|
|
2374
|
-
}
|
|
2375
|
-
})
|
|
2376
|
-
})
|
|
3293
|
+
if (!editable) return attribution ? /* @__PURE__ */ jsxs("span", {
|
|
3294
|
+
className: text,
|
|
3295
|
+
children: ["— ", attribution]
|
|
3296
|
+
}) : null;
|
|
3297
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
3298
|
+
className: field,
|
|
3299
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3300
|
+
"aria-hidden": true,
|
|
3301
|
+
className: dash,
|
|
3302
|
+
children: "—"
|
|
3303
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
3304
|
+
"aria-label": "Quote attribution",
|
|
3305
|
+
className: input$1,
|
|
3306
|
+
placeholder: "Author, Work",
|
|
3307
|
+
type: "text",
|
|
3308
|
+
value,
|
|
3309
|
+
onBeforeInput: stop,
|
|
3310
|
+
onChange: (event) => setValue(event.target.value),
|
|
3311
|
+
onClick: stop,
|
|
3312
|
+
onCompositionEnd: stop,
|
|
3313
|
+
onCompositionStart: stop,
|
|
3314
|
+
onCompositionUpdate: stop,
|
|
3315
|
+
onCopy: stop,
|
|
3316
|
+
onCut: stop,
|
|
3317
|
+
onDragStart: stop,
|
|
3318
|
+
onDrop: stop,
|
|
3319
|
+
onFocus: () => setFocused(true),
|
|
3320
|
+
onInput: stop,
|
|
3321
|
+
onKeyDown: handleKeyDown,
|
|
3322
|
+
onKeyUp: stop,
|
|
3323
|
+
onMouseDown: stop,
|
|
3324
|
+
onPaste: stop,
|
|
3325
|
+
onPointerDown: stop,
|
|
3326
|
+
onBlur: (event) => {
|
|
3327
|
+
setFocused(false);
|
|
3328
|
+
commit(event.currentTarget.value);
|
|
3329
|
+
}
|
|
3330
|
+
})]
|
|
2377
3331
|
});
|
|
2378
3332
|
}
|
|
2379
3333
|
//#endregion
|
|
@@ -2407,178 +3361,17 @@ function ScrollArea({ children, className, autoScrollToBottom = false, scrollRef
|
|
|
2407
3361
|
});
|
|
2408
3362
|
}
|
|
2409
3363
|
//#endregion
|
|
2410
|
-
//#region src/components/segmented-control/styles.css.ts
|
|
2411
|
-
var container = createRuntimeFn({
|
|
2412
|
-
defaultClassName: "_6d8tz20",
|
|
2413
|
-
variantClassNames: {
|
|
2414
|
-
size: {
|
|
2415
|
-
sm: "_6d8tz21",
|
|
2416
|
-
md: "_6d8tz22"
|
|
2417
|
-
},
|
|
2418
|
-
fullWidth: {
|
|
2419
|
-
true: "_6d8tz23",
|
|
2420
|
-
false: "_6d8tz24"
|
|
2421
|
-
}
|
|
2422
|
-
},
|
|
2423
|
-
defaultVariants: {
|
|
2424
|
-
size: "sm",
|
|
2425
|
-
fullWidth: false
|
|
2426
|
-
},
|
|
2427
|
-
compoundVariants: []
|
|
2428
|
-
});
|
|
2429
|
-
var indicator = createRuntimeFn({
|
|
2430
|
-
defaultClassName: "_6d8tz25",
|
|
2431
|
-
variantClassNames: { ready: {
|
|
2432
|
-
true: "_6d8tz26",
|
|
2433
|
-
false: "_6d8tz27"
|
|
2434
|
-
} },
|
|
2435
|
-
defaultVariants: { ready: true },
|
|
2436
|
-
compoundVariants: []
|
|
2437
|
-
});
|
|
2438
|
-
var item$1 = createRuntimeFn({
|
|
2439
|
-
defaultClassName: "_6d8tz28",
|
|
2440
|
-
variantClassNames: {
|
|
2441
|
-
size: {
|
|
2442
|
-
sm: "_6d8tz29",
|
|
2443
|
-
md: "_6d8tz2a"
|
|
2444
|
-
},
|
|
2445
|
-
active: {
|
|
2446
|
-
true: "_6d8tz2b",
|
|
2447
|
-
false: "_6d8tz2c"
|
|
2448
|
-
},
|
|
2449
|
-
disabled: {
|
|
2450
|
-
true: "_6d8tz2d",
|
|
2451
|
-
false: "_6d8tz2e"
|
|
2452
|
-
},
|
|
2453
|
-
fullWidth: {
|
|
2454
|
-
true: "_6d8tz2f",
|
|
2455
|
-
false: "_6d8tz2g"
|
|
2456
|
-
}
|
|
2457
|
-
},
|
|
2458
|
-
defaultVariants: {
|
|
2459
|
-
size: "sm",
|
|
2460
|
-
active: false,
|
|
2461
|
-
disabled: false,
|
|
2462
|
-
fullWidth: false
|
|
2463
|
-
},
|
|
2464
|
-
compoundVariants: []
|
|
2465
|
-
});
|
|
2466
|
-
//#endregion
|
|
2467
|
-
//#region src/components/segmented-control/index.tsx
|
|
2468
|
-
function SegmentedControl({ items, value, onChange, size = "sm", fullWidth = false, className }) {
|
|
2469
|
-
const containerRef = useRef(null);
|
|
2470
|
-
const itemElementsRef = useRef(/* @__PURE__ */ new Map());
|
|
2471
|
-
const [indicator$2, setIndicator] = useState({
|
|
2472
|
-
left: 0,
|
|
2473
|
-
width: 0
|
|
2474
|
-
});
|
|
2475
|
-
const [isReady, setIsReady] = useState(false);
|
|
2476
|
-
const updateIndicator = useCallback(() => {
|
|
2477
|
-
const container = containerRef.current;
|
|
2478
|
-
const activeEl = itemElementsRef.current.get(value);
|
|
2479
|
-
if (!container || !activeEl) return;
|
|
2480
|
-
const containerRect = container.getBoundingClientRect();
|
|
2481
|
-
const activeRect = activeEl.getBoundingClientRect();
|
|
2482
|
-
setIndicator({
|
|
2483
|
-
left: activeRect.left - containerRect.left,
|
|
2484
|
-
width: activeRect.width
|
|
2485
|
-
});
|
|
2486
|
-
setIsReady(true);
|
|
2487
|
-
}, [value]);
|
|
2488
|
-
useEffect(() => {
|
|
2489
|
-
updateIndicator();
|
|
2490
|
-
}, [updateIndicator]);
|
|
2491
|
-
useEffect(() => {
|
|
2492
|
-
const container = containerRef.current;
|
|
2493
|
-
if (!container) return;
|
|
2494
|
-
const observer = new ResizeObserver(() => {
|
|
2495
|
-
updateIndicator();
|
|
2496
|
-
});
|
|
2497
|
-
observer.observe(container);
|
|
2498
|
-
return () => observer.disconnect();
|
|
2499
|
-
}, [updateIndicator]);
|
|
2500
|
-
const handleKeyDown = (e) => {
|
|
2501
|
-
const enabledItems = items.filter((item) => !item.disabled);
|
|
2502
|
-
const currentIndex = enabledItems.findIndex((item) => item.value === value);
|
|
2503
|
-
let nextIndex = currentIndex;
|
|
2504
|
-
switch (e.key) {
|
|
2505
|
-
case "ArrowRight":
|
|
2506
|
-
case "ArrowDown":
|
|
2507
|
-
e.preventDefault();
|
|
2508
|
-
nextIndex = (currentIndex + 1) % enabledItems.length;
|
|
2509
|
-
break;
|
|
2510
|
-
case "ArrowLeft":
|
|
2511
|
-
case "ArrowUp":
|
|
2512
|
-
e.preventDefault();
|
|
2513
|
-
nextIndex = (currentIndex - 1 + enabledItems.length) % enabledItems.length;
|
|
2514
|
-
break;
|
|
2515
|
-
case "Home":
|
|
2516
|
-
e.preventDefault();
|
|
2517
|
-
nextIndex = 0;
|
|
2518
|
-
break;
|
|
2519
|
-
case "End":
|
|
2520
|
-
e.preventDefault();
|
|
2521
|
-
nextIndex = enabledItems.length - 1;
|
|
2522
|
-
}
|
|
2523
|
-
if (nextIndex !== currentIndex) {
|
|
2524
|
-
const nextItem = enabledItems[nextIndex];
|
|
2525
|
-
onChange(nextItem.value);
|
|
2526
|
-
itemElementsRef.current.get(nextItem.value)?.focus();
|
|
2527
|
-
}
|
|
2528
|
-
};
|
|
2529
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
2530
|
-
"aria-orientation": "horizontal",
|
|
2531
|
-
className: `${container({
|
|
2532
|
-
size,
|
|
2533
|
-
fullWidth
|
|
2534
|
-
})} ${className || ""}`.trim(),
|
|
2535
|
-
ref: containerRef,
|
|
2536
|
-
role: "tablist",
|
|
2537
|
-
onKeyDown: handleKeyDown,
|
|
2538
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
2539
|
-
"aria-hidden": "true",
|
|
2540
|
-
className: indicator({ ready: isReady }),
|
|
2541
|
-
style: {
|
|
2542
|
-
left: indicator$2.left,
|
|
2543
|
-
width: indicator$2.width
|
|
2544
|
-
}
|
|
2545
|
-
}), items.map((item) => {
|
|
2546
|
-
const isActive = item.value === value;
|
|
2547
|
-
return /* @__PURE__ */ jsx("button", {
|
|
2548
|
-
"aria-selected": isActive,
|
|
2549
|
-
"data-active": isActive || void 0,
|
|
2550
|
-
disabled: item.disabled,
|
|
2551
|
-
role: "tab",
|
|
2552
|
-
tabIndex: isActive ? 0 : -1,
|
|
2553
|
-
type: "button",
|
|
2554
|
-
className: item$1({
|
|
2555
|
-
size,
|
|
2556
|
-
active: isActive,
|
|
2557
|
-
disabled: Boolean(item.disabled),
|
|
2558
|
-
fullWidth
|
|
2559
|
-
}),
|
|
2560
|
-
ref: (el) => {
|
|
2561
|
-
if (el) itemElementsRef.current.set(item.value, el);
|
|
2562
|
-
else itemElementsRef.current.delete(item.value);
|
|
2563
|
-
},
|
|
2564
|
-
onClick: () => onChange(item.value),
|
|
2565
|
-
children: item.label
|
|
2566
|
-
}, item.value);
|
|
2567
|
-
})]
|
|
2568
|
-
});
|
|
2569
|
-
}
|
|
2570
|
-
//#endregion
|
|
2571
3364
|
//#region src/components/select/styles.css.ts
|
|
2572
|
-
var triggerButton = "
|
|
2573
|
-
var triggerIcon = "
|
|
2574
|
-
var positioner
|
|
2575
|
-
var popup
|
|
2576
|
-
var group = "
|
|
2577
|
-
var item = "
|
|
2578
|
-
var itemIndicator = "
|
|
2579
|
-
var groupLabel = "
|
|
2580
|
-
var separator = "
|
|
2581
|
-
var scrollButton = "
|
|
3365
|
+
var triggerButton = "p74a620";
|
|
3366
|
+
var triggerIcon = "p74a621";
|
|
3367
|
+
var positioner = "p74a622";
|
|
3368
|
+
var popup = "p74a623";
|
|
3369
|
+
var group = "p74a624";
|
|
3370
|
+
var item = "p74a625";
|
|
3371
|
+
var itemIndicator = "p74a626";
|
|
3372
|
+
var groupLabel = "_1sxaacb4";
|
|
3373
|
+
var separator = "_1sxaacb3";
|
|
3374
|
+
var scrollButton = "p74a627";
|
|
2582
3375
|
//#endregion
|
|
2583
3376
|
//#region src/components/select/index.tsx
|
|
2584
3377
|
function Select(props) {
|
|
@@ -2601,12 +3394,12 @@ function SelectContent({ children, className, align = "center", alignItemWithTri
|
|
|
2601
3394
|
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(PortalThemeWrapper, { children: /* @__PURE__ */ jsx(Select$1.Positioner, {
|
|
2602
3395
|
align,
|
|
2603
3396
|
alignItemWithTrigger,
|
|
2604
|
-
className: positioner
|
|
3397
|
+
className: positioner,
|
|
2605
3398
|
side,
|
|
2606
3399
|
sideOffset,
|
|
2607
3400
|
children: /* @__PURE__ */ jsxs(Select$1.Popup, {
|
|
2608
3401
|
...props,
|
|
2609
|
-
className: `${popup
|
|
3402
|
+
className: `${popup}${className ? ` ${className}` : ""}`,
|
|
2610
3403
|
children: [
|
|
2611
3404
|
/* @__PURE__ */ jsx(Select$1.ScrollUpArrow, {
|
|
2612
3405
|
className: scrollButton,
|
|
@@ -2652,7 +3445,8 @@ var spinner = createRuntimeFn({
|
|
|
2652
3445
|
defaultClassName: "_131cfek1",
|
|
2653
3446
|
variantClassNames: { size: {
|
|
2654
3447
|
sm: "_131cfek2",
|
|
2655
|
-
md: "_131cfek3"
|
|
3448
|
+
md: "_131cfek3",
|
|
3449
|
+
lg: "_131cfek4"
|
|
2656
3450
|
} },
|
|
2657
3451
|
defaultVariants: { size: "sm" },
|
|
2658
3452
|
compoundVariants: []
|
|
@@ -2726,50 +3520,20 @@ function StatusDot({ status, pulse: showPulse, size, className }) {
|
|
|
2726
3520
|
});
|
|
2727
3521
|
}
|
|
2728
3522
|
//#endregion
|
|
2729
|
-
//#region src/components/
|
|
2730
|
-
var
|
|
2731
|
-
var
|
|
3523
|
+
//#region src/components/text-input/styles.css.ts
|
|
3524
|
+
var input = "i56btd0";
|
|
3525
|
+
var mono = "i56btd1";
|
|
2732
3526
|
//#endregion
|
|
2733
|
-
//#region src/components/
|
|
2734
|
-
function
|
|
2735
|
-
return /* @__PURE__ */ jsx(
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
function TooltipTrigger(props) {
|
|
2741
|
-
return /* @__PURE__ */ jsx(Tooltip.Trigger, { ...props });
|
|
2742
|
-
}
|
|
2743
|
-
function TooltipPortal({ children, ...props }) {
|
|
2744
|
-
return /* @__PURE__ */ jsx(Tooltip.Portal, {
|
|
2745
|
-
...props,
|
|
2746
|
-
children: /* @__PURE__ */ jsx(PortalThemeWrapper$1, { children })
|
|
2747
|
-
});
|
|
2748
|
-
}
|
|
2749
|
-
function TooltipPositioner(props) {
|
|
2750
|
-
return /* @__PURE__ */ jsx(Tooltip.Positioner, { ...props });
|
|
2751
|
-
}
|
|
2752
|
-
function TooltipPopup({ className, children, ...props }) {
|
|
2753
|
-
return /* @__PURE__ */ jsx(Tooltip.Popup, {
|
|
2754
|
-
className: `${popup}${className ? ` ${className}` : ""}`,
|
|
2755
|
-
...props,
|
|
2756
|
-
children
|
|
3527
|
+
//#region src/components/text-input/index.tsx
|
|
3528
|
+
function TextInput({ invalid, mono: mono$1, className, type = "text", ...props }) {
|
|
3529
|
+
return /* @__PURE__ */ jsx("input", {
|
|
3530
|
+
"aria-invalid": invalid || void 0,
|
|
3531
|
+
className: `${input}${mono$1 ? ` ${mono}` : ""}${className ? ` ${className}` : ""}`,
|
|
3532
|
+
type,
|
|
3533
|
+
...props
|
|
2757
3534
|
});
|
|
2758
3535
|
}
|
|
2759
|
-
|
|
2760
|
-
return /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(TooltipPositioner, {
|
|
2761
|
-
align,
|
|
2762
|
-
className: positioner,
|
|
2763
|
-
side,
|
|
2764
|
-
sideOffset,
|
|
2765
|
-
children: /* @__PURE__ */ jsx(TooltipPopup, {
|
|
2766
|
-
className,
|
|
2767
|
-
...popupProps,
|
|
2768
|
-
children
|
|
2769
|
-
})
|
|
2770
|
-
}) });
|
|
2771
|
-
}
|
|
2772
|
-
var createTooltipHandle = Tooltip.createHandle;
|
|
3536
|
+
var textInputClassName = input;
|
|
2773
3537
|
//#endregion
|
|
2774
3538
|
//#region src/components/viewport-gate/index.tsx
|
|
2775
3539
|
function ViewportGate({ children, fallback, threshold = .5 }) {
|
|
@@ -2795,4 +3559,27 @@ function ViewportGate({ children, fallback, threshold = .5 }) {
|
|
|
2795
3559
|
});
|
|
2796
3560
|
}
|
|
2797
3561
|
//#endregion
|
|
2798
|
-
|
|
3562
|
+
//#region src/hooks/use-live-edit.ts
|
|
3563
|
+
function useLiveEdit(values, open, onApply) {
|
|
3564
|
+
const latestRef = useRef(values);
|
|
3565
|
+
latestRef.current = values;
|
|
3566
|
+
const snapshotRef = useRef(open ? values : null);
|
|
3567
|
+
const changedRef = useRef(false);
|
|
3568
|
+
useEffect(() => {
|
|
3569
|
+
snapshotRef.current = open ? latestRef.current : null;
|
|
3570
|
+
changedRef.current = false;
|
|
3571
|
+
}, [open]);
|
|
3572
|
+
return {
|
|
3573
|
+
apply: useCallback((patch) => {
|
|
3574
|
+
onApply(patch, changedRef.current);
|
|
3575
|
+
changedRef.current = true;
|
|
3576
|
+
}, [onApply]),
|
|
3577
|
+
revert: useCallback(() => {
|
|
3578
|
+
const snapshot = snapshotRef.current;
|
|
3579
|
+
if (snapshot && changedRef.current) onApply(snapshot, true);
|
|
3580
|
+
changedRef.current = false;
|
|
3581
|
+
}, [onApply])
|
|
3582
|
+
};
|
|
3583
|
+
}
|
|
3584
|
+
//#endregion
|
|
3585
|
+
export { ActionBar, ActionButton, Alert, AnimatedCheckbox, AnimatedTabs, AutoResizeTextArea, Badge, CodeBlock, Collapsible, CollapsiblePanel, CollapsibleTrigger, ColorPicker, Combobox, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxItemIndicator, ComboboxList, ComboboxTrigger, Dialog, DialogBackdrop, DialogClose, DialogDescription, DialogFooter, DialogHeader, DialogPopup, DialogPortal, DialogStackProvider, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuTrigger, Field, Kbd, ModalShell, ModalShellBody, ModalShellFooter, ModalShellHeader, Popover, PopoverArrow, PopoverBody, PopoverClose, PopoverDescription, PopoverFooter, PopoverHeader, PopoverPanel, PopoverPopup, PopoverPortal, PopoverPositioner, PopoverTitle, PopoverTrigger, PortalThemeProvider, PortalThemeWrapper, QuoteAttributionPlugin, ScrollArea, SegmentedControl, Select, SelectContent, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger, SelectValue, Spinner, StatusDot, TextInput, ToastViewport, TooltipContent, TooltipPopup, TooltipPortal, TooltipPositioner, TooltipProvider, TooltipRoot, TooltipTrigger, ViewportGate, codeLanguages, confirmDiscardChanges, createTooltipHandle, detectPlatform, dismissAllDialogs, dismissDialog, dismissToast, dismissTopDialog, getActionButtonClassName, highlightCode, keyDisplay, parseShortcut, presentDialog, requestDismissDialog, streamdownCodePlugin, textInputClassName, toast, updateToast, useKbdPlatform, useLiveEdit, usePopover, usePortalTheme };
|