silicaui-react 0.1.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/LICENSE +21 -0
- package/README.md +86 -0
- package/dist/index.d.ts +2754 -0
- package/dist/index.js +4687 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,4687 @@
|
|
|
1
|
+
import * as React74 from 'react';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { Accordion as Accordion$1 } from '@base-ui-components/react/accordion';
|
|
4
|
+
import { Slider as Slider$1 } from '@base-ui-components/react/slider';
|
|
5
|
+
import { Toast } from '@base-ui-components/react/toast';
|
|
6
|
+
import { NumberField as NumberField$1 } from '@base-ui-components/react/number-field';
|
|
7
|
+
import { Dialog as Dialog$1 } from '@base-ui-components/react/dialog';
|
|
8
|
+
import { Meter as Meter$1 } from '@base-ui-components/react/meter';
|
|
9
|
+
import { ScrollArea as ScrollArea$1 } from '@base-ui-components/react/scroll-area';
|
|
10
|
+
import { PreviewCard as PreviewCard$1 } from '@base-ui-components/react/preview-card';
|
|
11
|
+
import { Toolbar as Toolbar$1 } from '@base-ui-components/react/toolbar';
|
|
12
|
+
import { NavigationMenu as NavigationMenu$1 } from '@base-ui-components/react/navigation-menu';
|
|
13
|
+
import { Menubar as Menubar$1 } from '@base-ui-components/react/menubar';
|
|
14
|
+
import { Menu as Menu$1 } from '@base-ui-components/react/menu';
|
|
15
|
+
import { ContextMenu as ContextMenu$1 } from '@base-ui-components/react/context-menu';
|
|
16
|
+
import { ToggleGroup as ToggleGroup$1 } from '@base-ui-components/react/toggle-group';
|
|
17
|
+
import { Toggle as Toggle$1 } from '@base-ui-components/react/toggle';
|
|
18
|
+
import { Field as Field$1 } from '@base-ui-components/react/field';
|
|
19
|
+
import { Form as Form$1 } from '@base-ui-components/react/form';
|
|
20
|
+
import { Switch as Switch$1 } from '@base-ui-components/react/switch';
|
|
21
|
+
import { Collapsible as Collapsible$1 } from '@base-ui-components/react/collapsible';
|
|
22
|
+
import { AlertDialog as AlertDialog$1 } from '@base-ui-components/react/alert-dialog';
|
|
23
|
+
import { Select as Select$1 } from '@base-ui-components/react/select';
|
|
24
|
+
import { Combobox as Combobox$1 } from '@base-ui-components/react/combobox';
|
|
25
|
+
import { Autocomplete as Autocomplete$1 } from '@base-ui-components/react/autocomplete';
|
|
26
|
+
import { Popover as Popover$1 } from '@base-ui-components/react/popover';
|
|
27
|
+
import { Tooltip as Tooltip$1 } from '@base-ui-components/react/tooltip';
|
|
28
|
+
import { Tabs as Tabs$1 } from '@base-ui-components/react/tabs';
|
|
29
|
+
|
|
30
|
+
// src/button.tsx
|
|
31
|
+
|
|
32
|
+
// src/lib/cx.ts
|
|
33
|
+
function cx(...parts) {
|
|
34
|
+
return parts.filter(Boolean).join(" ");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/lib/merge-props.ts
|
|
38
|
+
function mergeProps(ours, theirs) {
|
|
39
|
+
const merged = { ...ours, ...theirs };
|
|
40
|
+
merged.className = cx(ours.className, theirs.className);
|
|
41
|
+
if (ours.style || theirs.style) {
|
|
42
|
+
merged.style = { ...ours.style, ...theirs.style };
|
|
43
|
+
}
|
|
44
|
+
if (ours.children != null) {
|
|
45
|
+
merged.children = ours.children;
|
|
46
|
+
}
|
|
47
|
+
for (const key of Object.keys(theirs)) {
|
|
48
|
+
if (/^on[A-Z]/.test(key) && typeof theirs[key] === "function" && typeof ours[key] === "function") {
|
|
49
|
+
const a = ours[key];
|
|
50
|
+
const b = theirs[key];
|
|
51
|
+
merged[key] = (...args) => {
|
|
52
|
+
a(...args);
|
|
53
|
+
b(...args);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return merged;
|
|
58
|
+
}
|
|
59
|
+
var DEFAULT_CONFIG = { prefix: "" };
|
|
60
|
+
var SilicaConfigContext = React74.createContext(DEFAULT_CONFIG);
|
|
61
|
+
function SilicaProvider({ prefix = "", children }) {
|
|
62
|
+
const value = React74.useMemo(() => ({ prefix }), [prefix]);
|
|
63
|
+
return /* @__PURE__ */ jsx(SilicaConfigContext.Provider, { value, children });
|
|
64
|
+
}
|
|
65
|
+
function useSilicaConfig() {
|
|
66
|
+
return React74.useContext(SilicaConfigContext);
|
|
67
|
+
}
|
|
68
|
+
function useSilicaClass() {
|
|
69
|
+
const { prefix } = React74.useContext(SilicaConfigContext);
|
|
70
|
+
return React74.useCallback(
|
|
71
|
+
(name) => name ? `${prefix}${name}` : name,
|
|
72
|
+
[prefix]
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
var Button = React74.forwardRef(
|
|
76
|
+
function Button2({
|
|
77
|
+
color,
|
|
78
|
+
variant = "solid",
|
|
79
|
+
size = "md",
|
|
80
|
+
shape,
|
|
81
|
+
block,
|
|
82
|
+
wide,
|
|
83
|
+
active,
|
|
84
|
+
loading,
|
|
85
|
+
disabled,
|
|
86
|
+
iconStart,
|
|
87
|
+
iconEnd,
|
|
88
|
+
render,
|
|
89
|
+
className,
|
|
90
|
+
children,
|
|
91
|
+
type,
|
|
92
|
+
...rest
|
|
93
|
+
}, ref) {
|
|
94
|
+
const sc = useSilicaClass();
|
|
95
|
+
const classes = cx(
|
|
96
|
+
sc("btn"),
|
|
97
|
+
color && sc(`btn-${color}`),
|
|
98
|
+
variant !== "solid" && sc(`btn-${variant}`),
|
|
99
|
+
size !== "md" && sc(`btn-${size}`),
|
|
100
|
+
shape && sc(`btn-${shape}`),
|
|
101
|
+
block && sc("btn-block"),
|
|
102
|
+
wide && sc("btn-wide"),
|
|
103
|
+
active && sc("btn-active"),
|
|
104
|
+
className
|
|
105
|
+
);
|
|
106
|
+
const isDisabled = Boolean(disabled) || Boolean(loading);
|
|
107
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
108
|
+
iconStart,
|
|
109
|
+
children,
|
|
110
|
+
iconEnd
|
|
111
|
+
] });
|
|
112
|
+
if (render) {
|
|
113
|
+
const ownProps = {
|
|
114
|
+
...rest,
|
|
115
|
+
className: classes,
|
|
116
|
+
children: content,
|
|
117
|
+
ref,
|
|
118
|
+
"aria-busy": loading || void 0,
|
|
119
|
+
"aria-disabled": isDisabled || void 0,
|
|
120
|
+
"data-disabled": isDisabled ? "" : void 0
|
|
121
|
+
};
|
|
122
|
+
return React74.cloneElement(
|
|
123
|
+
render,
|
|
124
|
+
mergeProps(ownProps, render.props)
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
return /* @__PURE__ */ jsx(
|
|
128
|
+
"button",
|
|
129
|
+
{
|
|
130
|
+
ref,
|
|
131
|
+
type: type ?? "button",
|
|
132
|
+
className: classes,
|
|
133
|
+
disabled: isDisabled,
|
|
134
|
+
"aria-busy": loading || void 0,
|
|
135
|
+
...rest,
|
|
136
|
+
children: content
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
var Badge = React74.forwardRef(
|
|
142
|
+
function Badge2({ color, variant = "solid", size = "md", render, className, children, ...rest }, ref) {
|
|
143
|
+
const sc = useSilicaClass();
|
|
144
|
+
const classes = cx(
|
|
145
|
+
sc("badge"),
|
|
146
|
+
color && sc(`badge-${color}`),
|
|
147
|
+
variant !== "solid" && sc(`badge-${variant}`),
|
|
148
|
+
size !== "md" && sc(`badge-${size}`),
|
|
149
|
+
className
|
|
150
|
+
);
|
|
151
|
+
if (render) {
|
|
152
|
+
const ownProps = {
|
|
153
|
+
...rest,
|
|
154
|
+
className: classes,
|
|
155
|
+
children,
|
|
156
|
+
ref
|
|
157
|
+
};
|
|
158
|
+
return React74.cloneElement(
|
|
159
|
+
render,
|
|
160
|
+
mergeProps(ownProps, render.props)
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
return /* @__PURE__ */ jsx("span", { ref, className: classes, ...rest, children });
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
var Input = React74.forwardRef(
|
|
167
|
+
function Input2({ color, size = "md", className, type, ...rest }, ref) {
|
|
168
|
+
const sc = useSilicaClass();
|
|
169
|
+
const classes = cx(
|
|
170
|
+
sc("input"),
|
|
171
|
+
color && sc(`input-${color}`),
|
|
172
|
+
size !== "md" && sc(`input-${size}`),
|
|
173
|
+
className
|
|
174
|
+
);
|
|
175
|
+
return /* @__PURE__ */ jsx("input", { ref, type: type ?? "text", className: classes, ...rest });
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
var NativeSelect = React74.forwardRef(function NativeSelect2({ color, size = "md", className, children, ...rest }, ref) {
|
|
179
|
+
const sc = useSilicaClass();
|
|
180
|
+
const classes = cx(
|
|
181
|
+
sc("select"),
|
|
182
|
+
color && sc(`select-${color}`),
|
|
183
|
+
size !== "md" && sc(`select-${size}`),
|
|
184
|
+
className
|
|
185
|
+
);
|
|
186
|
+
return /* @__PURE__ */ jsx("select", { ref, className: classes, ...rest, children });
|
|
187
|
+
});
|
|
188
|
+
var Textarea = React74.forwardRef(
|
|
189
|
+
function Textarea2({ color, size = "md", className, ...rest }, ref) {
|
|
190
|
+
const sc = useSilicaClass();
|
|
191
|
+
const classes = cx(
|
|
192
|
+
sc("textarea"),
|
|
193
|
+
color && sc(`textarea-${color}`),
|
|
194
|
+
size !== "md" && sc(`textarea-${size}`),
|
|
195
|
+
className
|
|
196
|
+
);
|
|
197
|
+
return /* @__PURE__ */ jsx("textarea", { ref, className: classes, ...rest });
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
var Card = React74.forwardRef(
|
|
201
|
+
function Card2({ className, ...rest }, ref) {
|
|
202
|
+
const sc = useSilicaClass();
|
|
203
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("card"), className), ...rest });
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
var CardBody = React74.forwardRef(
|
|
207
|
+
function CardBody2({ className, ...rest }, ref) {
|
|
208
|
+
const sc = useSilicaClass();
|
|
209
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("card-body"), className), ...rest });
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
var CardTitle = React74.forwardRef(
|
|
213
|
+
function CardTitle2({ className, ...rest }, ref) {
|
|
214
|
+
const sc = useSilicaClass();
|
|
215
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("card-title"), className), ...rest });
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
var CardActions = React74.forwardRef(
|
|
219
|
+
function CardActions2({ className, ...rest }, ref) {
|
|
220
|
+
const sc = useSilicaClass();
|
|
221
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("card-actions"), className), ...rest });
|
|
222
|
+
}
|
|
223
|
+
);
|
|
224
|
+
var Alert = React74.forwardRef(
|
|
225
|
+
function Alert2({ color, variant = "solid", size = "md", className, ...rest }, ref) {
|
|
226
|
+
const sc = useSilicaClass();
|
|
227
|
+
const classes = cx(
|
|
228
|
+
sc("alert"),
|
|
229
|
+
color && sc(`alert-${color}`),
|
|
230
|
+
variant !== "solid" && sc(`alert-${variant}`),
|
|
231
|
+
size !== "md" && sc(`alert-${size}`),
|
|
232
|
+
className
|
|
233
|
+
);
|
|
234
|
+
return /* @__PURE__ */ jsx("div", { ref, role: "alert", className: classes, ...rest });
|
|
235
|
+
}
|
|
236
|
+
);
|
|
237
|
+
var AlertContent = React74.forwardRef(function AlertContent2({ className, ...rest }, ref) {
|
|
238
|
+
const sc = useSilicaClass();
|
|
239
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("alert-content"), className), ...rest });
|
|
240
|
+
});
|
|
241
|
+
var AlertTitle = React74.forwardRef(function AlertTitle2({ className, ...rest }, ref) {
|
|
242
|
+
const sc = useSilicaClass();
|
|
243
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("alert-title"), className), ...rest });
|
|
244
|
+
});
|
|
245
|
+
var AlertDescription = React74.forwardRef(function AlertDescription2({ className, ...rest }, ref) {
|
|
246
|
+
const sc = useSilicaClass();
|
|
247
|
+
return /* @__PURE__ */ jsx(
|
|
248
|
+
"div",
|
|
249
|
+
{
|
|
250
|
+
ref,
|
|
251
|
+
className: cx(sc("alert-description"), className),
|
|
252
|
+
...rest
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
});
|
|
256
|
+
var AlertActions = React74.forwardRef(function AlertActions2({ className, ...rest }, ref) {
|
|
257
|
+
const sc = useSilicaClass();
|
|
258
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("alert-actions"), className), ...rest });
|
|
259
|
+
});
|
|
260
|
+
var Progress = React74.forwardRef(
|
|
261
|
+
function Progress2({ color, size = "md", value, max = 100, className, ...rest }, ref) {
|
|
262
|
+
const sc = useSilicaClass();
|
|
263
|
+
const indeterminate = value == null;
|
|
264
|
+
const pct = indeterminate || max <= 0 ? 0 : Math.max(0, Math.min(100, value / max * 100));
|
|
265
|
+
const classes = cx(
|
|
266
|
+
sc("progress"),
|
|
267
|
+
color && sc(`progress-${color}`),
|
|
268
|
+
size !== "md" && sc(`progress-${size}`),
|
|
269
|
+
indeterminate && sc("progress-indeterminate"),
|
|
270
|
+
className
|
|
271
|
+
);
|
|
272
|
+
return /* @__PURE__ */ jsx(
|
|
273
|
+
"div",
|
|
274
|
+
{
|
|
275
|
+
ref,
|
|
276
|
+
role: "progressbar",
|
|
277
|
+
"aria-valuemin": 0,
|
|
278
|
+
"aria-valuemax": max,
|
|
279
|
+
"aria-valuenow": indeterminate ? void 0 : value,
|
|
280
|
+
className: classes,
|
|
281
|
+
...rest,
|
|
282
|
+
children: /* @__PURE__ */ jsx(
|
|
283
|
+
"div",
|
|
284
|
+
{
|
|
285
|
+
className: cx(sc("progress-bar")),
|
|
286
|
+
style: indeterminate ? void 0 : { width: `${pct}%` }
|
|
287
|
+
}
|
|
288
|
+
)
|
|
289
|
+
}
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
);
|
|
293
|
+
var Avatar = React74.forwardRef(
|
|
294
|
+
function Avatar2({ color, size = "md", shape = "circle", ring = false, status, src, alt, className, children, ...rest }, ref) {
|
|
295
|
+
const sc = useSilicaClass();
|
|
296
|
+
const [failed, setFailed] = React74.useState(false);
|
|
297
|
+
React74.useEffect(() => setFailed(false), [src]);
|
|
298
|
+
const showImg = Boolean(src) && !failed;
|
|
299
|
+
const classes = cx(
|
|
300
|
+
sc("avatar"),
|
|
301
|
+
color && sc(`avatar-${color}`),
|
|
302
|
+
size !== "md" && sc(`avatar-${size}`),
|
|
303
|
+
shape === "rounded" && sc("avatar-rounded"),
|
|
304
|
+
ring && sc("avatar-ring"),
|
|
305
|
+
status && sc(`avatar-${status}`),
|
|
306
|
+
className
|
|
307
|
+
);
|
|
308
|
+
return /* @__PURE__ */ jsx(
|
|
309
|
+
"span",
|
|
310
|
+
{
|
|
311
|
+
ref,
|
|
312
|
+
className: classes,
|
|
313
|
+
role: !showImg && alt ? "img" : void 0,
|
|
314
|
+
"aria-label": !showImg ? alt : void 0,
|
|
315
|
+
...rest,
|
|
316
|
+
children: showImg ? /* @__PURE__ */ jsx("img", { src, alt: alt ?? "", onError: () => setFailed(true) }) : children
|
|
317
|
+
}
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
var AvatarGroup = React74.forwardRef(function AvatarGroup2({ className, ...rest }, ref) {
|
|
322
|
+
const sc = useSilicaClass();
|
|
323
|
+
return /* @__PURE__ */ jsx("span", { ref, className: cx(sc("avatar-group"), className), ...rest });
|
|
324
|
+
});
|
|
325
|
+
var Skeleton = React74.forwardRef(
|
|
326
|
+
function Skeleton2({ shape = "block", className, ...rest }, ref) {
|
|
327
|
+
const sc = useSilicaClass();
|
|
328
|
+
const classes = cx(
|
|
329
|
+
sc("skeleton"),
|
|
330
|
+
shape === "circle" && sc("skeleton-circle"),
|
|
331
|
+
shape === "text" && sc("skeleton-text"),
|
|
332
|
+
className
|
|
333
|
+
);
|
|
334
|
+
return /* @__PURE__ */ jsx("div", { ref, "aria-hidden": true, className: classes, ...rest });
|
|
335
|
+
}
|
|
336
|
+
);
|
|
337
|
+
var Table = React74.forwardRef(
|
|
338
|
+
function Table2({ zebra = false, hover = false, size = "md", className, wrapperClassName, ...rest }, ref) {
|
|
339
|
+
const sc = useSilicaClass();
|
|
340
|
+
const classes = cx(
|
|
341
|
+
sc("table"),
|
|
342
|
+
zebra && sc("table-zebra"),
|
|
343
|
+
hover && sc("table-hover"),
|
|
344
|
+
size !== "md" && sc(`table-${size}`),
|
|
345
|
+
className
|
|
346
|
+
);
|
|
347
|
+
return /* @__PURE__ */ jsx("div", { className: wrapperClassName, style: { overflowX: "auto" }, children: /* @__PURE__ */ jsx("table", { ref, className: classes, ...rest }) });
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
var Divider = React74.forwardRef(
|
|
351
|
+
function Divider2({ orientation = "horizontal", className, ...rest }, ref) {
|
|
352
|
+
const sc = useSilicaClass();
|
|
353
|
+
return /* @__PURE__ */ jsx(
|
|
354
|
+
"div",
|
|
355
|
+
{
|
|
356
|
+
ref,
|
|
357
|
+
role: "separator",
|
|
358
|
+
className: cx(
|
|
359
|
+
sc("divider"),
|
|
360
|
+
orientation === "vertical" && sc("divider-vertical"),
|
|
361
|
+
className
|
|
362
|
+
),
|
|
363
|
+
...rest
|
|
364
|
+
}
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
);
|
|
368
|
+
var Kbd = React74.forwardRef(
|
|
369
|
+
function Kbd2({ size = "md", className, ...rest }, ref) {
|
|
370
|
+
const sc = useSilicaClass();
|
|
371
|
+
return /* @__PURE__ */ jsx(
|
|
372
|
+
"kbd",
|
|
373
|
+
{
|
|
374
|
+
ref,
|
|
375
|
+
className: cx(sc("kbd"), size !== "md" && sc(`kbd-${size}`), className),
|
|
376
|
+
...rest
|
|
377
|
+
}
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
var Breadcrumb = React74.forwardRef(
|
|
382
|
+
function Breadcrumb2({ className, children, ...rest }, ref) {
|
|
383
|
+
const sc = useSilicaClass();
|
|
384
|
+
return /* @__PURE__ */ jsx(
|
|
385
|
+
"nav",
|
|
386
|
+
{
|
|
387
|
+
ref,
|
|
388
|
+
"aria-label": "Breadcrumb",
|
|
389
|
+
className: cx(sc("breadcrumb"), className),
|
|
390
|
+
...rest,
|
|
391
|
+
children: /* @__PURE__ */ jsx("ol", { children })
|
|
392
|
+
}
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
);
|
|
396
|
+
var Stats = React74.forwardRef(
|
|
397
|
+
function Stats2({ vertical = false, className, ...rest }, ref) {
|
|
398
|
+
const sc = useSilicaClass();
|
|
399
|
+
return /* @__PURE__ */ jsx(
|
|
400
|
+
"div",
|
|
401
|
+
{
|
|
402
|
+
ref,
|
|
403
|
+
className: cx(sc("stats"), vertical && sc("stats-vertical"), className),
|
|
404
|
+
...rest
|
|
405
|
+
}
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
var Stat = React74.forwardRef(
|
|
410
|
+
function Stat2({ className, ...rest }, ref) {
|
|
411
|
+
const sc = useSilicaClass();
|
|
412
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("stat"), className), ...rest });
|
|
413
|
+
}
|
|
414
|
+
);
|
|
415
|
+
var StatTitle = React74.forwardRef(function StatTitle2({ className, ...rest }, ref) {
|
|
416
|
+
const sc = useSilicaClass();
|
|
417
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("stat-title"), className), ...rest });
|
|
418
|
+
});
|
|
419
|
+
var StatValue = React74.forwardRef(function StatValue2({ className, ...rest }, ref) {
|
|
420
|
+
const sc = useSilicaClass();
|
|
421
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("stat-value"), className), ...rest });
|
|
422
|
+
});
|
|
423
|
+
var StatDesc = React74.forwardRef(function StatDesc2({ className, ...rest }, ref) {
|
|
424
|
+
const sc = useSilicaClass();
|
|
425
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("stat-desc"), className), ...rest });
|
|
426
|
+
});
|
|
427
|
+
var StatFigure = React74.forwardRef(function StatFigure2({ className, ...rest }, ref) {
|
|
428
|
+
const sc = useSilicaClass();
|
|
429
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("stat-figure"), className), ...rest });
|
|
430
|
+
});
|
|
431
|
+
var Steps = React74.forwardRef(
|
|
432
|
+
function Steps2({ className, ...rest }, ref) {
|
|
433
|
+
const sc = useSilicaClass();
|
|
434
|
+
return /* @__PURE__ */ jsx("ol", { ref, className: cx(sc("steps"), className), ...rest });
|
|
435
|
+
}
|
|
436
|
+
);
|
|
437
|
+
var Step = React74.forwardRef(
|
|
438
|
+
function Step2({ color, className, ...rest }, ref) {
|
|
439
|
+
const sc = useSilicaClass();
|
|
440
|
+
return /* @__PURE__ */ jsx(
|
|
441
|
+
"li",
|
|
442
|
+
{
|
|
443
|
+
ref,
|
|
444
|
+
className: cx(sc("step"), color && sc(`step-${color}`), className),
|
|
445
|
+
...rest
|
|
446
|
+
}
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
);
|
|
450
|
+
var Join = React74.forwardRef(
|
|
451
|
+
function Join2({ orientation = "horizontal", className, ...rest }, ref) {
|
|
452
|
+
const sc = useSilicaClass();
|
|
453
|
+
return /* @__PURE__ */ jsx(
|
|
454
|
+
"div",
|
|
455
|
+
{
|
|
456
|
+
ref,
|
|
457
|
+
className: cx(
|
|
458
|
+
sc("join"),
|
|
459
|
+
orientation === "vertical" && sc("join-vertical"),
|
|
460
|
+
className
|
|
461
|
+
),
|
|
462
|
+
...rest
|
|
463
|
+
}
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
);
|
|
467
|
+
var Menu = React74.forwardRef(
|
|
468
|
+
function Menu2({ className, ...rest }, ref) {
|
|
469
|
+
const sc = useSilicaClass();
|
|
470
|
+
return /* @__PURE__ */ jsx("ul", { ref, className: cx(sc("menu"), className), ...rest });
|
|
471
|
+
}
|
|
472
|
+
);
|
|
473
|
+
var MenuItem = React74.forwardRef(function MenuItem2({ className, ...rest }, ref) {
|
|
474
|
+
return /* @__PURE__ */ jsx("li", { ref, className, ...rest });
|
|
475
|
+
});
|
|
476
|
+
var MenuTitle = React74.forwardRef(function MenuTitle2({ className, ...rest }, ref) {
|
|
477
|
+
const sc = useSilicaClass();
|
|
478
|
+
return /* @__PURE__ */ jsx("li", { ref, className: cx(sc("menu-title"), className), ...rest });
|
|
479
|
+
});
|
|
480
|
+
var Collapse = React74.forwardRef(
|
|
481
|
+
function Collapse2({ ghost = false, className, ...rest }, ref) {
|
|
482
|
+
const sc = useSilicaClass();
|
|
483
|
+
return /* @__PURE__ */ jsx(
|
|
484
|
+
"details",
|
|
485
|
+
{
|
|
486
|
+
ref,
|
|
487
|
+
className: cx(sc("collapse"), ghost && sc("collapse-ghost"), className),
|
|
488
|
+
...rest
|
|
489
|
+
}
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
);
|
|
493
|
+
var CollapseTitle = React74.forwardRef(function CollapseTitle2({ className, ...rest }, ref) {
|
|
494
|
+
const sc = useSilicaClass();
|
|
495
|
+
return /* @__PURE__ */ jsx("summary", { ref, className: cx(sc("collapse-title"), className), ...rest });
|
|
496
|
+
});
|
|
497
|
+
var CollapseContent = React74.forwardRef(function CollapseContent2({ className, ...rest }, ref) {
|
|
498
|
+
const sc = useSilicaClass();
|
|
499
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("collapse-content"), className), ...rest });
|
|
500
|
+
});
|
|
501
|
+
var Indicator = React74.forwardRef(
|
|
502
|
+
function Indicator2({ className, ...rest }, ref) {
|
|
503
|
+
const sc = useSilicaClass();
|
|
504
|
+
return /* @__PURE__ */ jsx("span", { ref, className: cx(sc("indicator"), className), ...rest });
|
|
505
|
+
}
|
|
506
|
+
);
|
|
507
|
+
var IndicatorItem = React74.forwardRef(function IndicatorItem2({ placement = "top-end", className, ...rest }, ref) {
|
|
508
|
+
const sc = useSilicaClass();
|
|
509
|
+
const start = placement === "top-start" || placement === "bottom-start";
|
|
510
|
+
const bottom = placement === "bottom-end" || placement === "bottom-start";
|
|
511
|
+
return /* @__PURE__ */ jsx(
|
|
512
|
+
"span",
|
|
513
|
+
{
|
|
514
|
+
ref,
|
|
515
|
+
className: cx(
|
|
516
|
+
sc("indicator-item"),
|
|
517
|
+
start && sc("indicator-start"),
|
|
518
|
+
bottom && sc("indicator-bottom"),
|
|
519
|
+
className
|
|
520
|
+
),
|
|
521
|
+
...rest
|
|
522
|
+
}
|
|
523
|
+
);
|
|
524
|
+
});
|
|
525
|
+
var Loading = React74.forwardRef(
|
|
526
|
+
function Loading2({ size = "md", label = "Loading", className, ...rest }, ref) {
|
|
527
|
+
const sc = useSilicaClass();
|
|
528
|
+
return /* @__PURE__ */ jsx(
|
|
529
|
+
"span",
|
|
530
|
+
{
|
|
531
|
+
ref,
|
|
532
|
+
role: "status",
|
|
533
|
+
"aria-label": label,
|
|
534
|
+
className: cx(
|
|
535
|
+
sc("loading"),
|
|
536
|
+
size !== "md" && sc(`loading-${size}`),
|
|
537
|
+
className
|
|
538
|
+
),
|
|
539
|
+
...rest
|
|
540
|
+
}
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
);
|
|
544
|
+
var Prose = React74.forwardRef(
|
|
545
|
+
function Prose2({ size = "md", className, ...rest }, ref) {
|
|
546
|
+
const sc = useSilicaClass();
|
|
547
|
+
return /* @__PURE__ */ jsx(
|
|
548
|
+
"div",
|
|
549
|
+
{
|
|
550
|
+
ref,
|
|
551
|
+
className: cx(
|
|
552
|
+
sc("prose"),
|
|
553
|
+
size !== "md" && sc(`prose-${size}`),
|
|
554
|
+
className
|
|
555
|
+
),
|
|
556
|
+
...rest
|
|
557
|
+
}
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
);
|
|
561
|
+
var Heading = React74.forwardRef(
|
|
562
|
+
function Heading2({ level = 2, size, className, ...rest }, ref) {
|
|
563
|
+
const sc = useSilicaClass();
|
|
564
|
+
const Tag = `h${level}`;
|
|
565
|
+
const sizeClass = size !== void 0 && size !== level ? sc(size === "display" ? "display" : `h${size}`) : void 0;
|
|
566
|
+
return /* @__PURE__ */ jsx(Tag, { ref, className: cx(sizeClass, className), ...rest });
|
|
567
|
+
}
|
|
568
|
+
);
|
|
569
|
+
var Display = React74.forwardRef(
|
|
570
|
+
function Display2({ level = 1, className, ...rest }, ref) {
|
|
571
|
+
const sc = useSilicaClass();
|
|
572
|
+
const Tag = `h${level}`;
|
|
573
|
+
return /* @__PURE__ */ jsx(Tag, { ref, className: cx(sc("display"), className), ...rest });
|
|
574
|
+
}
|
|
575
|
+
);
|
|
576
|
+
var Text = React74.forwardRef(
|
|
577
|
+
function Text2({ variant = "body", as, className, ...rest }, ref) {
|
|
578
|
+
const sc = useSilicaClass();
|
|
579
|
+
const Tag = as ?? "p";
|
|
580
|
+
const variantClass = variant === "lead" ? sc("lead") : variant === "caption" ? sc("caption") : void 0;
|
|
581
|
+
return /* @__PURE__ */ jsx(Tag, { ref, className: cx(variantClass, className) || void 0, ...rest });
|
|
582
|
+
}
|
|
583
|
+
);
|
|
584
|
+
var Navbar = React74.forwardRef(
|
|
585
|
+
function Navbar2({ className, ...rest }, ref) {
|
|
586
|
+
const sc = useSilicaClass();
|
|
587
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("navbar"), className), ...rest });
|
|
588
|
+
}
|
|
589
|
+
);
|
|
590
|
+
var NavbarStart = React74.forwardRef(
|
|
591
|
+
function NavbarStart2({ className, ...rest }, ref) {
|
|
592
|
+
const sc = useSilicaClass();
|
|
593
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("navbar-start"), className), ...rest });
|
|
594
|
+
}
|
|
595
|
+
);
|
|
596
|
+
var NavbarCenter = React74.forwardRef(
|
|
597
|
+
function NavbarCenter2({ className, ...rest }, ref) {
|
|
598
|
+
const sc = useSilicaClass();
|
|
599
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("navbar-center"), className), ...rest });
|
|
600
|
+
}
|
|
601
|
+
);
|
|
602
|
+
var NavbarEnd = React74.forwardRef(
|
|
603
|
+
function NavbarEnd2({ className, ...rest }, ref) {
|
|
604
|
+
const sc = useSilicaClass();
|
|
605
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("navbar-end"), className), ...rest });
|
|
606
|
+
}
|
|
607
|
+
);
|
|
608
|
+
var Footer = React74.forwardRef(
|
|
609
|
+
function Footer2({ center, className, ...rest }, ref) {
|
|
610
|
+
const sc = useSilicaClass();
|
|
611
|
+
return /* @__PURE__ */ jsx(
|
|
612
|
+
"footer",
|
|
613
|
+
{
|
|
614
|
+
ref,
|
|
615
|
+
className: cx(sc("footer"), center && sc("footer-center"), className),
|
|
616
|
+
...rest
|
|
617
|
+
}
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
);
|
|
621
|
+
var FooterTitle = React74.forwardRef(
|
|
622
|
+
function FooterTitle2({ className, ...rest }, ref) {
|
|
623
|
+
const sc = useSilicaClass();
|
|
624
|
+
return /* @__PURE__ */ jsx("h6", { ref, className: cx(sc("footer-title"), className), ...rest });
|
|
625
|
+
}
|
|
626
|
+
);
|
|
627
|
+
var Hero = React74.forwardRef(
|
|
628
|
+
function Hero2({ className, ...rest }, ref) {
|
|
629
|
+
const sc = useSilicaClass();
|
|
630
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("hero"), className), ...rest });
|
|
631
|
+
}
|
|
632
|
+
);
|
|
633
|
+
var HeroContent = React74.forwardRef(
|
|
634
|
+
function HeroContent2({ className, ...rest }, ref) {
|
|
635
|
+
const sc = useSilicaClass();
|
|
636
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("hero-content"), className), ...rest });
|
|
637
|
+
}
|
|
638
|
+
);
|
|
639
|
+
var HeroOverlay = React74.forwardRef(
|
|
640
|
+
function HeroOverlay2({ className, ...rest }, ref) {
|
|
641
|
+
const sc = useSilicaClass();
|
|
642
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("hero-overlay"), className), ...rest });
|
|
643
|
+
}
|
|
644
|
+
);
|
|
645
|
+
var Link = React74.forwardRef(
|
|
646
|
+
function Link2({ color, hover, className, ...rest }, ref) {
|
|
647
|
+
const sc = useSilicaClass();
|
|
648
|
+
return /* @__PURE__ */ jsx(
|
|
649
|
+
"a",
|
|
650
|
+
{
|
|
651
|
+
ref,
|
|
652
|
+
className: cx(
|
|
653
|
+
sc("link"),
|
|
654
|
+
hover && sc("link-hover"),
|
|
655
|
+
color && sc(`link-${color}`),
|
|
656
|
+
className
|
|
657
|
+
),
|
|
658
|
+
...rest
|
|
659
|
+
}
|
|
660
|
+
);
|
|
661
|
+
}
|
|
662
|
+
);
|
|
663
|
+
var MockupWindow = React74.forwardRef(
|
|
664
|
+
function MockupWindow2({ className, ...rest }, ref) {
|
|
665
|
+
const sc = useSilicaClass();
|
|
666
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("mockup-window"), className), ...rest });
|
|
667
|
+
}
|
|
668
|
+
);
|
|
669
|
+
var MockupBrowser = React74.forwardRef(
|
|
670
|
+
function MockupBrowser2({ url, toolbar, className, children, ...rest }, ref) {
|
|
671
|
+
const sc = useSilicaClass();
|
|
672
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: cx(sc("mockup-browser"), className), ...rest, children: [
|
|
673
|
+
/* @__PURE__ */ jsx("div", { className: cx(sc("mockup-browser-toolbar")), children: toolbar ?? /* @__PURE__ */ jsx("div", { className: cx(sc("mockup-browser-input")), children: url }) }),
|
|
674
|
+
children
|
|
675
|
+
] });
|
|
676
|
+
}
|
|
677
|
+
);
|
|
678
|
+
var MockupCode = React74.forwardRef(
|
|
679
|
+
function MockupCode2({ className, ...rest }, ref) {
|
|
680
|
+
const sc = useSilicaClass();
|
|
681
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("mockup-code"), className), ...rest });
|
|
682
|
+
}
|
|
683
|
+
);
|
|
684
|
+
var MockupCodeLine = React74.forwardRef(
|
|
685
|
+
function MockupCodeLine2({ prefix, className, ...rest }, ref) {
|
|
686
|
+
return /* @__PURE__ */ jsx("pre", { ref, "data-prefix": prefix, className, ...rest });
|
|
687
|
+
}
|
|
688
|
+
);
|
|
689
|
+
var MockupPhone = React74.forwardRef(
|
|
690
|
+
function MockupPhone2({ className, children, ...rest }, ref) {
|
|
691
|
+
const sc = useSilicaClass();
|
|
692
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("mockup-phone"), className), ...rest, children: /* @__PURE__ */ jsx("div", { className: cx(sc("mockup-phone-display")), children }) });
|
|
693
|
+
}
|
|
694
|
+
);
|
|
695
|
+
var Timeline = React74.forwardRef(
|
|
696
|
+
function Timeline2({ orientation = "vertical", className, ...rest }, ref) {
|
|
697
|
+
const sc = useSilicaClass();
|
|
698
|
+
return /* @__PURE__ */ jsx(
|
|
699
|
+
"ul",
|
|
700
|
+
{
|
|
701
|
+
ref,
|
|
702
|
+
className: cx(
|
|
703
|
+
sc("timeline"),
|
|
704
|
+
orientation === "horizontal" && sc("timeline-horizontal"),
|
|
705
|
+
className
|
|
706
|
+
),
|
|
707
|
+
...rest
|
|
708
|
+
}
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
);
|
|
712
|
+
var TimelineItem = React74.forwardRef(
|
|
713
|
+
function TimelineItem2({ className, ...rest }, ref) {
|
|
714
|
+
return /* @__PURE__ */ jsx("li", { ref, className, ...rest });
|
|
715
|
+
}
|
|
716
|
+
);
|
|
717
|
+
var TimelineStart = React74.forwardRef(
|
|
718
|
+
function TimelineStart2({ className, ...rest }, ref) {
|
|
719
|
+
const sc = useSilicaClass();
|
|
720
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("timeline-start"), className), ...rest });
|
|
721
|
+
}
|
|
722
|
+
);
|
|
723
|
+
var TimelineMiddle = React74.forwardRef(
|
|
724
|
+
function TimelineMiddle2({ className, children, ...rest }, ref) {
|
|
725
|
+
const sc = useSilicaClass();
|
|
726
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("timeline-middle"), className), ...rest, children: children ?? /* @__PURE__ */ jsx("span", { className: cx(sc("timeline-dot")) }) });
|
|
727
|
+
}
|
|
728
|
+
);
|
|
729
|
+
var TimelineEnd = React74.forwardRef(
|
|
730
|
+
function TimelineEnd2({ box, className, ...rest }, ref) {
|
|
731
|
+
const sc = useSilicaClass();
|
|
732
|
+
return /* @__PURE__ */ jsx(
|
|
733
|
+
"div",
|
|
734
|
+
{
|
|
735
|
+
ref,
|
|
736
|
+
className: cx(sc("timeline-end"), box && sc("timeline-box"), className),
|
|
737
|
+
...rest
|
|
738
|
+
}
|
|
739
|
+
);
|
|
740
|
+
}
|
|
741
|
+
);
|
|
742
|
+
var PrevIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m15 18-6-6 6-6", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
743
|
+
var NextIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
744
|
+
function Carousel({
|
|
745
|
+
snap = "start",
|
|
746
|
+
orientation = "horizontal",
|
|
747
|
+
controls = true,
|
|
748
|
+
indicators = true,
|
|
749
|
+
loop = false,
|
|
750
|
+
autoplay,
|
|
751
|
+
onChange,
|
|
752
|
+
className,
|
|
753
|
+
children,
|
|
754
|
+
...rest
|
|
755
|
+
}) {
|
|
756
|
+
const sc = useSilicaClass();
|
|
757
|
+
const scrollRef = React74.useRef(null);
|
|
758
|
+
const horizontal = orientation !== "vertical";
|
|
759
|
+
const count = React74.Children.count(children);
|
|
760
|
+
const [active, setActive] = React74.useState(0);
|
|
761
|
+
const [paused, setPaused] = React74.useState(false);
|
|
762
|
+
const goTo = React74.useCallback(
|
|
763
|
+
(i) => {
|
|
764
|
+
const container = scrollRef.current;
|
|
765
|
+
if (!container) return;
|
|
766
|
+
const last = container.children.length - 1;
|
|
767
|
+
const target = loop ? (i + container.children.length) % container.children.length : Math.max(0, Math.min(last, i));
|
|
768
|
+
const el = container.children[target];
|
|
769
|
+
if (!el) return;
|
|
770
|
+
container.scrollTo({
|
|
771
|
+
left: horizontal ? el.offsetLeft - container.offsetLeft : 0,
|
|
772
|
+
top: horizontal ? 0 : el.offsetTop - container.offsetTop,
|
|
773
|
+
behavior: "smooth"
|
|
774
|
+
});
|
|
775
|
+
},
|
|
776
|
+
[horizontal, loop]
|
|
777
|
+
);
|
|
778
|
+
const handleScroll = React74.useCallback(() => {
|
|
779
|
+
const container = scrollRef.current;
|
|
780
|
+
if (!container) return;
|
|
781
|
+
const kids = Array.from(container.children);
|
|
782
|
+
const pos = horizontal ? container.scrollLeft : container.scrollTop;
|
|
783
|
+
let nearest = 0;
|
|
784
|
+
let best = Infinity;
|
|
785
|
+
kids.forEach((k, i) => {
|
|
786
|
+
const off = horizontal ? k.offsetLeft - container.offsetLeft : k.offsetTop - container.offsetTop;
|
|
787
|
+
const d = Math.abs(off - pos);
|
|
788
|
+
if (d < best) {
|
|
789
|
+
best = d;
|
|
790
|
+
nearest = i;
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
setActive((prev) => prev === nearest ? prev : nearest);
|
|
794
|
+
}, [horizontal]);
|
|
795
|
+
React74.useEffect(() => {
|
|
796
|
+
onChange?.(active);
|
|
797
|
+
}, [active, onChange]);
|
|
798
|
+
React74.useEffect(() => {
|
|
799
|
+
if (!autoplay || paused || count <= 1) return;
|
|
800
|
+
const id = window.setInterval(() => {
|
|
801
|
+
const next = active + 1 > count - 1 ? loop ? 0 : active : active + 1;
|
|
802
|
+
if (next !== active) goTo(next);
|
|
803
|
+
else if (loop) goTo(0);
|
|
804
|
+
}, autoplay);
|
|
805
|
+
return () => window.clearInterval(id);
|
|
806
|
+
}, [autoplay, paused, active, count, loop, goTo]);
|
|
807
|
+
const atStart = active === 0;
|
|
808
|
+
const atEnd = active === count - 1;
|
|
809
|
+
const indi = indicators === true ? "dots" : indicators;
|
|
810
|
+
return /* @__PURE__ */ jsxs(
|
|
811
|
+
"div",
|
|
812
|
+
{
|
|
813
|
+
className: cx(sc("carousel-root")),
|
|
814
|
+
onMouseEnter: () => setPaused(true),
|
|
815
|
+
onMouseLeave: () => setPaused(false),
|
|
816
|
+
onFocusCapture: () => setPaused(true),
|
|
817
|
+
onBlurCapture: () => setPaused(false),
|
|
818
|
+
children: [
|
|
819
|
+
controls && count > 1 && /* @__PURE__ */ jsx(
|
|
820
|
+
"button",
|
|
821
|
+
{
|
|
822
|
+
type: "button",
|
|
823
|
+
className: cx(sc("carousel-control"), sc("carousel-prev")),
|
|
824
|
+
onClick: () => goTo(active - 1),
|
|
825
|
+
disabled: !loop && atStart,
|
|
826
|
+
"aria-label": "Previous slide",
|
|
827
|
+
children: /* @__PURE__ */ jsx(PrevIcon, {})
|
|
828
|
+
}
|
|
829
|
+
),
|
|
830
|
+
/* @__PURE__ */ jsx(
|
|
831
|
+
"div",
|
|
832
|
+
{
|
|
833
|
+
ref: scrollRef,
|
|
834
|
+
className: cx(
|
|
835
|
+
sc("carousel"),
|
|
836
|
+
snap !== "start" && sc(`carousel-${snap}`),
|
|
837
|
+
orientation === "vertical" && sc("carousel-vertical"),
|
|
838
|
+
className
|
|
839
|
+
),
|
|
840
|
+
onScroll: handleScroll,
|
|
841
|
+
...rest,
|
|
842
|
+
children
|
|
843
|
+
}
|
|
844
|
+
),
|
|
845
|
+
controls && count > 1 && /* @__PURE__ */ jsx(
|
|
846
|
+
"button",
|
|
847
|
+
{
|
|
848
|
+
type: "button",
|
|
849
|
+
className: cx(sc("carousel-control"), sc("carousel-next")),
|
|
850
|
+
onClick: () => goTo(active + 1),
|
|
851
|
+
disabled: !loop && atEnd,
|
|
852
|
+
"aria-label": "Next slide",
|
|
853
|
+
children: /* @__PURE__ */ jsx(NextIcon, {})
|
|
854
|
+
}
|
|
855
|
+
),
|
|
856
|
+
indi && count > 1 && /* @__PURE__ */ jsx("div", { className: cx(sc("carousel-indicators")), children: Array.from(
|
|
857
|
+
{ length: count },
|
|
858
|
+
(_, i) => indi === "numbers" ? /* @__PURE__ */ jsx(
|
|
859
|
+
"button",
|
|
860
|
+
{
|
|
861
|
+
type: "button",
|
|
862
|
+
className: cx(sc("carousel-number"), i === active && sc("carousel-number-active")),
|
|
863
|
+
onClick: () => goTo(i),
|
|
864
|
+
"aria-label": `Go to slide ${i + 1}`,
|
|
865
|
+
"aria-current": i === active,
|
|
866
|
+
children: i + 1
|
|
867
|
+
},
|
|
868
|
+
i
|
|
869
|
+
) : /* @__PURE__ */ jsx(
|
|
870
|
+
"button",
|
|
871
|
+
{
|
|
872
|
+
type: "button",
|
|
873
|
+
className: cx(sc("carousel-dot"), i === active && sc("carousel-dot-active")),
|
|
874
|
+
onClick: () => goTo(i),
|
|
875
|
+
"aria-label": `Go to slide ${i + 1}`,
|
|
876
|
+
"aria-current": i === active
|
|
877
|
+
},
|
|
878
|
+
i
|
|
879
|
+
)
|
|
880
|
+
) })
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
);
|
|
884
|
+
}
|
|
885
|
+
var CarouselItem = React74.forwardRef(
|
|
886
|
+
function CarouselItem2({ className, ...rest }, ref) {
|
|
887
|
+
const sc = useSilicaClass();
|
|
888
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("carousel-item"), className), ...rest });
|
|
889
|
+
}
|
|
890
|
+
);
|
|
891
|
+
function Stack({
|
|
892
|
+
peek = "top",
|
|
893
|
+
interactive = false,
|
|
894
|
+
className,
|
|
895
|
+
children,
|
|
896
|
+
onClick,
|
|
897
|
+
onKeyDown,
|
|
898
|
+
...rest
|
|
899
|
+
}) {
|
|
900
|
+
const sc = useSilicaClass();
|
|
901
|
+
const items = React74.useMemo(() => React74.Children.toArray(children), [children]);
|
|
902
|
+
const [order, setOrder] = React74.useState(() => items.map((_, i) => i));
|
|
903
|
+
React74.useEffect(() => {
|
|
904
|
+
setOrder(items.map((_, i) => i));
|
|
905
|
+
}, [items.length]);
|
|
906
|
+
const cycle = React74.useCallback(() => {
|
|
907
|
+
setOrder((o) => o.length > 1 ? o.slice(1).concat(o.slice(0, 1)) : o);
|
|
908
|
+
}, []);
|
|
909
|
+
const ordered = order.map((i) => items[i]).filter(Boolean);
|
|
910
|
+
const interactiveProps = interactive ? {
|
|
911
|
+
role: "button",
|
|
912
|
+
tabIndex: 0,
|
|
913
|
+
"aria-label": "Cycle stack",
|
|
914
|
+
style: { cursor: "pointer", ...rest.style },
|
|
915
|
+
onClick: (e) => {
|
|
916
|
+
cycle();
|
|
917
|
+
onClick?.(e);
|
|
918
|
+
},
|
|
919
|
+
onKeyDown: (e) => {
|
|
920
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
921
|
+
e.preventDefault();
|
|
922
|
+
cycle();
|
|
923
|
+
}
|
|
924
|
+
onKeyDown?.(e);
|
|
925
|
+
}
|
|
926
|
+
} : { onClick, onKeyDown };
|
|
927
|
+
return /* @__PURE__ */ jsx(
|
|
928
|
+
"div",
|
|
929
|
+
{
|
|
930
|
+
className: cx(sc("stack"), peek !== "top" && sc(`stack-${peek}`), className),
|
|
931
|
+
...rest,
|
|
932
|
+
...interactiveProps,
|
|
933
|
+
children: ordered
|
|
934
|
+
}
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
var StarIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" }) });
|
|
938
|
+
function Rating({
|
|
939
|
+
value,
|
|
940
|
+
defaultValue = 0,
|
|
941
|
+
onChange,
|
|
942
|
+
max = 5,
|
|
943
|
+
color,
|
|
944
|
+
size,
|
|
945
|
+
readOnly,
|
|
946
|
+
icon,
|
|
947
|
+
label = "Rating",
|
|
948
|
+
className,
|
|
949
|
+
...rest
|
|
950
|
+
}) {
|
|
951
|
+
const sc = useSilicaClass();
|
|
952
|
+
const isControlled = value !== void 0;
|
|
953
|
+
const [internal, setInternal] = React74.useState(defaultValue);
|
|
954
|
+
const current = isControlled ? value : internal;
|
|
955
|
+
const [hover, setHover] = React74.useState(null);
|
|
956
|
+
const shown = hover ?? current;
|
|
957
|
+
const refs = React74.useRef([]);
|
|
958
|
+
const setValue = (v) => {
|
|
959
|
+
if (readOnly) return;
|
|
960
|
+
const next = v === current ? 0 : v;
|
|
961
|
+
if (!isControlled) setInternal(next);
|
|
962
|
+
onChange?.(next);
|
|
963
|
+
};
|
|
964
|
+
const focusStar = (i) => {
|
|
965
|
+
const clamped = Math.max(1, Math.min(max, i));
|
|
966
|
+
refs.current[clamped - 1]?.focus();
|
|
967
|
+
if (!isControlled) setInternal(clamped);
|
|
968
|
+
onChange?.(clamped);
|
|
969
|
+
};
|
|
970
|
+
const onKeyDown = (e, i) => {
|
|
971
|
+
if (readOnly) return;
|
|
972
|
+
if (e.key === "ArrowRight" || e.key === "ArrowUp") {
|
|
973
|
+
e.preventDefault();
|
|
974
|
+
focusStar(i + 1);
|
|
975
|
+
} else if (e.key === "ArrowLeft" || e.key === "ArrowDown") {
|
|
976
|
+
e.preventDefault();
|
|
977
|
+
focusStar(i - 1);
|
|
978
|
+
} else if (e.key === "Home") {
|
|
979
|
+
e.preventDefault();
|
|
980
|
+
focusStar(1);
|
|
981
|
+
} else if (e.key === "End") {
|
|
982
|
+
e.preventDefault();
|
|
983
|
+
focusStar(max);
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
const activeIndex = current > 0 ? current - 1 : 0;
|
|
987
|
+
return /* @__PURE__ */ jsx(
|
|
988
|
+
"div",
|
|
989
|
+
{
|
|
990
|
+
role: "radiogroup",
|
|
991
|
+
"aria-label": label,
|
|
992
|
+
className: cx(
|
|
993
|
+
sc("rating"),
|
|
994
|
+
color && sc(`rating-${color}`),
|
|
995
|
+
size && sc(`rating-${size}`),
|
|
996
|
+
readOnly && sc("rating-readonly"),
|
|
997
|
+
className
|
|
998
|
+
),
|
|
999
|
+
onMouseLeave: () => setHover(null),
|
|
1000
|
+
...rest,
|
|
1001
|
+
children: Array.from({ length: max }, (_, idx) => {
|
|
1002
|
+
const starValue = idx + 1;
|
|
1003
|
+
return /* @__PURE__ */ jsx(
|
|
1004
|
+
"button",
|
|
1005
|
+
{
|
|
1006
|
+
ref: (el) => {
|
|
1007
|
+
refs.current[idx] = el;
|
|
1008
|
+
},
|
|
1009
|
+
type: "button",
|
|
1010
|
+
role: "radio",
|
|
1011
|
+
"aria-checked": current === starValue,
|
|
1012
|
+
"aria-label": `${starValue} star${starValue === 1 ? "" : "s"}`,
|
|
1013
|
+
tabIndex: readOnly ? -1 : idx === activeIndex ? 0 : -1,
|
|
1014
|
+
disabled: readOnly,
|
|
1015
|
+
"data-filled": starValue <= shown,
|
|
1016
|
+
className: cx(sc("rating-item")),
|
|
1017
|
+
onClick: () => setValue(starValue),
|
|
1018
|
+
onMouseEnter: () => !readOnly && setHover(starValue),
|
|
1019
|
+
onKeyDown: (e) => onKeyDown(e, starValue),
|
|
1020
|
+
children: icon ?? /* @__PURE__ */ jsx(StarIcon, {})
|
|
1021
|
+
},
|
|
1022
|
+
starValue
|
|
1023
|
+
);
|
|
1024
|
+
})
|
|
1025
|
+
}
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
var RadialProgress = React74.forwardRef(
|
|
1029
|
+
function RadialProgress2({ value, size = "5rem", thickness = "0.5rem", color, className, children, style, ...rest }, ref) {
|
|
1030
|
+
const sc = useSilicaClass();
|
|
1031
|
+
const pct = Math.max(0, Math.min(100, value));
|
|
1032
|
+
return /* @__PURE__ */ jsx(
|
|
1033
|
+
"div",
|
|
1034
|
+
{
|
|
1035
|
+
ref,
|
|
1036
|
+
role: "progressbar",
|
|
1037
|
+
"aria-valuenow": Math.round(pct),
|
|
1038
|
+
"aria-valuemin": 0,
|
|
1039
|
+
"aria-valuemax": 100,
|
|
1040
|
+
className: cx(sc("radial-progress"), className),
|
|
1041
|
+
style: {
|
|
1042
|
+
"--value": pct,
|
|
1043
|
+
"--size": size,
|
|
1044
|
+
"--thickness": thickness,
|
|
1045
|
+
...color ? { "--radial-accent": `var(--color-${color})` } : {},
|
|
1046
|
+
...style
|
|
1047
|
+
},
|
|
1048
|
+
...rest,
|
|
1049
|
+
children: /* @__PURE__ */ jsx("span", { children: children ?? `${Math.round(pct)}%` })
|
|
1050
|
+
}
|
|
1051
|
+
);
|
|
1052
|
+
}
|
|
1053
|
+
);
|
|
1054
|
+
var range = (start, end) => Array.from({ length: Math.max(end - start + 1, 0) }, (_, i) => start + i);
|
|
1055
|
+
function paginationItems(page, count, siblingCount, boundaryCount) {
|
|
1056
|
+
const startPages = range(1, Math.min(boundaryCount, count));
|
|
1057
|
+
const endPages = range(Math.max(count - boundaryCount + 1, boundaryCount + 1), count);
|
|
1058
|
+
const siblingsStart = Math.max(
|
|
1059
|
+
Math.min(page - siblingCount, count - boundaryCount - siblingCount * 2 - 1),
|
|
1060
|
+
boundaryCount + 2
|
|
1061
|
+
);
|
|
1062
|
+
const firstEndPage = endPages.length > 0 ? endPages[0] : count + 1;
|
|
1063
|
+
const siblingsEnd = Math.min(
|
|
1064
|
+
Math.max(page + siblingCount, boundaryCount + siblingCount * 2 + 2),
|
|
1065
|
+
endPages.length > 0 ? firstEndPage - 2 : count - 1
|
|
1066
|
+
);
|
|
1067
|
+
return [
|
|
1068
|
+
...startPages,
|
|
1069
|
+
...siblingsStart > boundaryCount + 2 ? ["ellipsis"] : boundaryCount + 1 < count - boundaryCount ? [boundaryCount + 1] : [],
|
|
1070
|
+
...range(siblingsStart, siblingsEnd),
|
|
1071
|
+
...siblingsEnd < count - boundaryCount - 1 ? ["ellipsis"] : count - boundaryCount > boundaryCount ? [count - boundaryCount] : [],
|
|
1072
|
+
...endPages
|
|
1073
|
+
];
|
|
1074
|
+
}
|
|
1075
|
+
var PrevIcon2 = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m15 18-6-6 6-6", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1076
|
+
var NextIcon2 = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1077
|
+
function Pagination({
|
|
1078
|
+
page,
|
|
1079
|
+
count,
|
|
1080
|
+
onChange,
|
|
1081
|
+
siblingCount = 1,
|
|
1082
|
+
boundaryCount = 1,
|
|
1083
|
+
controls = true,
|
|
1084
|
+
color,
|
|
1085
|
+
size,
|
|
1086
|
+
className,
|
|
1087
|
+
...rest
|
|
1088
|
+
}) {
|
|
1089
|
+
const sc = useSilicaClass();
|
|
1090
|
+
const items = paginationItems(page, count, siblingCount, boundaryCount);
|
|
1091
|
+
const go = (p) => {
|
|
1092
|
+
const clamped = Math.max(1, Math.min(count, p));
|
|
1093
|
+
if (clamped !== page) onChange?.(clamped);
|
|
1094
|
+
};
|
|
1095
|
+
return /* @__PURE__ */ jsxs(
|
|
1096
|
+
"nav",
|
|
1097
|
+
{
|
|
1098
|
+
"aria-label": "Pagination",
|
|
1099
|
+
className: cx(
|
|
1100
|
+
sc("pagination"),
|
|
1101
|
+
color && sc(`pagination-${color}`),
|
|
1102
|
+
size && sc(`pagination-${size}`),
|
|
1103
|
+
className
|
|
1104
|
+
),
|
|
1105
|
+
...rest,
|
|
1106
|
+
children: [
|
|
1107
|
+
controls && /* @__PURE__ */ jsx(
|
|
1108
|
+
"button",
|
|
1109
|
+
{
|
|
1110
|
+
type: "button",
|
|
1111
|
+
className: cx(sc("pagination-item")),
|
|
1112
|
+
onClick: () => go(page - 1),
|
|
1113
|
+
disabled: page <= 1,
|
|
1114
|
+
"aria-label": "Previous page",
|
|
1115
|
+
children: /* @__PURE__ */ jsx(PrevIcon2, {})
|
|
1116
|
+
}
|
|
1117
|
+
),
|
|
1118
|
+
items.map(
|
|
1119
|
+
(item, i) => item === "ellipsis" ? /* @__PURE__ */ jsx("span", { className: cx(sc("pagination-ellipsis")), "aria-hidden": "true", children: "\u2026" }, `e${i}`) : /* @__PURE__ */ jsx(
|
|
1120
|
+
"button",
|
|
1121
|
+
{
|
|
1122
|
+
type: "button",
|
|
1123
|
+
className: cx(
|
|
1124
|
+
sc("pagination-item"),
|
|
1125
|
+
item === page && sc("pagination-item-active")
|
|
1126
|
+
),
|
|
1127
|
+
onClick: () => go(item),
|
|
1128
|
+
"aria-label": `Page ${item}`,
|
|
1129
|
+
"aria-current": item === page ? "page" : void 0,
|
|
1130
|
+
children: item
|
|
1131
|
+
},
|
|
1132
|
+
item
|
|
1133
|
+
)
|
|
1134
|
+
),
|
|
1135
|
+
controls && /* @__PURE__ */ jsx(
|
|
1136
|
+
"button",
|
|
1137
|
+
{
|
|
1138
|
+
type: "button",
|
|
1139
|
+
className: cx(sc("pagination-item")),
|
|
1140
|
+
onClick: () => go(page + 1),
|
|
1141
|
+
disabled: page >= count,
|
|
1142
|
+
"aria-label": "Next page",
|
|
1143
|
+
children: /* @__PURE__ */ jsx(NextIcon2, {})
|
|
1144
|
+
}
|
|
1145
|
+
)
|
|
1146
|
+
]
|
|
1147
|
+
}
|
|
1148
|
+
);
|
|
1149
|
+
}
|
|
1150
|
+
var ChevronIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1151
|
+
function Accordion({ className, ...rest }) {
|
|
1152
|
+
const sc = useSilicaClass();
|
|
1153
|
+
return /* @__PURE__ */ jsx(Accordion$1.Root, { className: cx(sc("accordion"), className), ...rest });
|
|
1154
|
+
}
|
|
1155
|
+
function AccordionItem({ className, ...rest }) {
|
|
1156
|
+
const sc = useSilicaClass();
|
|
1157
|
+
return /* @__PURE__ */ jsx(Accordion$1.Item, { className: cx(sc("accordion-item"), className), ...rest });
|
|
1158
|
+
}
|
|
1159
|
+
function AccordionTrigger({
|
|
1160
|
+
className,
|
|
1161
|
+
children,
|
|
1162
|
+
chevron = true,
|
|
1163
|
+
...rest
|
|
1164
|
+
}) {
|
|
1165
|
+
const sc = useSilicaClass();
|
|
1166
|
+
return /* @__PURE__ */ jsx(Accordion$1.Header, { className: cx(sc("accordion-header")), children: /* @__PURE__ */ jsxs(Accordion$1.Trigger, { className: cx(sc("accordion-trigger"), className), ...rest, children: [
|
|
1167
|
+
/* @__PURE__ */ jsx("span", { children }),
|
|
1168
|
+
chevron && /* @__PURE__ */ jsx(ChevronIcon, {})
|
|
1169
|
+
] }) });
|
|
1170
|
+
}
|
|
1171
|
+
function AccordionPanel({
|
|
1172
|
+
className,
|
|
1173
|
+
children,
|
|
1174
|
+
...rest
|
|
1175
|
+
}) {
|
|
1176
|
+
const sc = useSilicaClass();
|
|
1177
|
+
return /* @__PURE__ */ jsx(Accordion$1.Panel, { className: cx(sc("accordion-panel"), className), ...rest, children: /* @__PURE__ */ jsx("div", { className: cx(sc("accordion-content")), children }) });
|
|
1178
|
+
}
|
|
1179
|
+
var Chat = React74.forwardRef(
|
|
1180
|
+
function Chat2({ side = "start", className, ...rest }, ref) {
|
|
1181
|
+
const sc = useSilicaClass();
|
|
1182
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("chat"), sc(`chat-${side}`), className), ...rest });
|
|
1183
|
+
}
|
|
1184
|
+
);
|
|
1185
|
+
var ChatImage = React74.forwardRef(
|
|
1186
|
+
function ChatImage2({ className, ...rest }, ref) {
|
|
1187
|
+
const sc = useSilicaClass();
|
|
1188
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("chat-image"), className), ...rest });
|
|
1189
|
+
}
|
|
1190
|
+
);
|
|
1191
|
+
var ChatHeader = React74.forwardRef(
|
|
1192
|
+
function ChatHeader2({ className, ...rest }, ref) {
|
|
1193
|
+
const sc = useSilicaClass();
|
|
1194
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("chat-header"), className), ...rest });
|
|
1195
|
+
}
|
|
1196
|
+
);
|
|
1197
|
+
var ChatFooter = React74.forwardRef(
|
|
1198
|
+
function ChatFooter2({ className, ...rest }, ref) {
|
|
1199
|
+
const sc = useSilicaClass();
|
|
1200
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("chat-footer"), className), ...rest });
|
|
1201
|
+
}
|
|
1202
|
+
);
|
|
1203
|
+
var ChatBubble = React74.forwardRef(
|
|
1204
|
+
function ChatBubble2({ color, className, ...rest }, ref) {
|
|
1205
|
+
const sc = useSilicaClass();
|
|
1206
|
+
return /* @__PURE__ */ jsx(
|
|
1207
|
+
"div",
|
|
1208
|
+
{
|
|
1209
|
+
ref,
|
|
1210
|
+
className: cx(sc("chat-bubble"), color && sc(`chat-bubble-${color}`), className),
|
|
1211
|
+
...rest
|
|
1212
|
+
}
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1215
|
+
);
|
|
1216
|
+
function Range({ color, className, value, defaultValue, ...rest }) {
|
|
1217
|
+
const sc = useSilicaClass();
|
|
1218
|
+
const vals = value ?? defaultValue;
|
|
1219
|
+
const thumbCount = Array.isArray(vals) ? vals.length : 1;
|
|
1220
|
+
return /* @__PURE__ */ jsx(
|
|
1221
|
+
Slider$1.Root,
|
|
1222
|
+
{
|
|
1223
|
+
value,
|
|
1224
|
+
defaultValue,
|
|
1225
|
+
className: cx(sc("range"), color && sc(`range-${color}`), className),
|
|
1226
|
+
...rest,
|
|
1227
|
+
children: /* @__PURE__ */ jsx(Slider$1.Control, { className: cx(sc("range-control")), children: /* @__PURE__ */ jsxs(Slider$1.Track, { className: cx(sc("range-track")), children: [
|
|
1228
|
+
/* @__PURE__ */ jsx(Slider$1.Indicator, { className: cx(sc("range-indicator")) }),
|
|
1229
|
+
Array.from({ length: thumbCount }, (_, i) => /* @__PURE__ */ jsx(
|
|
1230
|
+
Slider$1.Thumb,
|
|
1231
|
+
{
|
|
1232
|
+
index: thumbCount > 1 ? i : void 0,
|
|
1233
|
+
className: cx(sc("range-thumb"))
|
|
1234
|
+
},
|
|
1235
|
+
i
|
|
1236
|
+
))
|
|
1237
|
+
] }) })
|
|
1238
|
+
}
|
|
1239
|
+
);
|
|
1240
|
+
}
|
|
1241
|
+
var CloseIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m18 6-12 12M6 6l12 12", strokeLinecap: "round" }) });
|
|
1242
|
+
function ToastList() {
|
|
1243
|
+
const { toasts } = Toast.useToastManager();
|
|
1244
|
+
const sc = useSilicaClass();
|
|
1245
|
+
return /* @__PURE__ */ jsx(Toast.Portal, { children: /* @__PURE__ */ jsx(Toast.Viewport, { className: cx(sc("toast-viewport")), children: toasts.map((toast) => /* @__PURE__ */ jsxs(Toast.Root, { toast, className: cx(sc("toast")), children: [
|
|
1246
|
+
/* @__PURE__ */ jsxs("div", { className: cx(sc("toast-content")), children: [
|
|
1247
|
+
/* @__PURE__ */ jsx(Toast.Title, { className: cx(sc("toast-title")) }),
|
|
1248
|
+
/* @__PURE__ */ jsx(Toast.Description, { className: cx(sc("toast-description")) })
|
|
1249
|
+
] }),
|
|
1250
|
+
/* @__PURE__ */ jsx(Toast.Close, { className: cx(sc("toast-close")), "aria-label": "Close", children: /* @__PURE__ */ jsx(CloseIcon, {}) })
|
|
1251
|
+
] }, toast.id)) }) });
|
|
1252
|
+
}
|
|
1253
|
+
function ToastProvider({ children, ...rest }) {
|
|
1254
|
+
return /* @__PURE__ */ jsxs(Toast.Provider, { ...rest, children: [
|
|
1255
|
+
children,
|
|
1256
|
+
/* @__PURE__ */ jsx(ToastList, {})
|
|
1257
|
+
] });
|
|
1258
|
+
}
|
|
1259
|
+
function useToast() {
|
|
1260
|
+
return Toast.useToastManager();
|
|
1261
|
+
}
|
|
1262
|
+
function Swap({
|
|
1263
|
+
on,
|
|
1264
|
+
off,
|
|
1265
|
+
active,
|
|
1266
|
+
defaultActive,
|
|
1267
|
+
onActiveChange,
|
|
1268
|
+
variant = "fade",
|
|
1269
|
+
label,
|
|
1270
|
+
className,
|
|
1271
|
+
...rest
|
|
1272
|
+
}) {
|
|
1273
|
+
const sc = useSilicaClass();
|
|
1274
|
+
const isControlled = active !== void 0;
|
|
1275
|
+
const [internal, setInternal] = React74.useState(defaultActive ?? false);
|
|
1276
|
+
const checked = isControlled ? active : internal;
|
|
1277
|
+
return /* @__PURE__ */ jsxs(
|
|
1278
|
+
"label",
|
|
1279
|
+
{
|
|
1280
|
+
className: cx(sc("swap"), variant !== "fade" && sc(`swap-${variant}`), className),
|
|
1281
|
+
...rest,
|
|
1282
|
+
children: [
|
|
1283
|
+
/* @__PURE__ */ jsx(
|
|
1284
|
+
"input",
|
|
1285
|
+
{
|
|
1286
|
+
type: "checkbox",
|
|
1287
|
+
checked,
|
|
1288
|
+
"aria-label": label,
|
|
1289
|
+
onChange: (e) => {
|
|
1290
|
+
if (!isControlled) setInternal(e.target.checked);
|
|
1291
|
+
onActiveChange?.(e.target.checked);
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
),
|
|
1295
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("swap-on")), children: on }),
|
|
1296
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("swap-off")), children: off })
|
|
1297
|
+
]
|
|
1298
|
+
}
|
|
1299
|
+
);
|
|
1300
|
+
}
|
|
1301
|
+
var Status = React74.forwardRef(
|
|
1302
|
+
function Status2({ color, size, ping, label, className, ...rest }, ref) {
|
|
1303
|
+
const sc = useSilicaClass();
|
|
1304
|
+
return /* @__PURE__ */ jsx(
|
|
1305
|
+
"span",
|
|
1306
|
+
{
|
|
1307
|
+
ref,
|
|
1308
|
+
role: label ? "status" : void 0,
|
|
1309
|
+
"aria-label": label,
|
|
1310
|
+
className: cx(
|
|
1311
|
+
sc("status"),
|
|
1312
|
+
color && sc(`status-${color}`),
|
|
1313
|
+
size && sc(`status-${size}`),
|
|
1314
|
+
ping && sc("status-ping"),
|
|
1315
|
+
className
|
|
1316
|
+
),
|
|
1317
|
+
...rest
|
|
1318
|
+
}
|
|
1319
|
+
);
|
|
1320
|
+
}
|
|
1321
|
+
);
|
|
1322
|
+
var pad = (n) => String(n).padStart(2, "0");
|
|
1323
|
+
function Countdown({
|
|
1324
|
+
to,
|
|
1325
|
+
units = ["days", "hours", "minutes", "seconds"],
|
|
1326
|
+
plain,
|
|
1327
|
+
onComplete,
|
|
1328
|
+
className,
|
|
1329
|
+
...rest
|
|
1330
|
+
}) {
|
|
1331
|
+
const sc = useSilicaClass();
|
|
1332
|
+
const target = typeof to === "number" ? to : to.getTime();
|
|
1333
|
+
const [now, setNow] = React74.useState(() => Date.now());
|
|
1334
|
+
React74.useEffect(() => {
|
|
1335
|
+
const id = window.setInterval(() => setNow(Date.now()), 1e3);
|
|
1336
|
+
return () => window.clearInterval(id);
|
|
1337
|
+
}, []);
|
|
1338
|
+
const remaining = Math.max(0, target - now);
|
|
1339
|
+
const done = remaining === 0;
|
|
1340
|
+
const completedRef = React74.useRef(false);
|
|
1341
|
+
React74.useEffect(() => {
|
|
1342
|
+
if (done && !completedRef.current) {
|
|
1343
|
+
completedRef.current = true;
|
|
1344
|
+
onComplete?.();
|
|
1345
|
+
}
|
|
1346
|
+
if (!done) completedRef.current = false;
|
|
1347
|
+
}, [done, onComplete]);
|
|
1348
|
+
const total = Math.floor(remaining / 1e3);
|
|
1349
|
+
const values = {
|
|
1350
|
+
days: Math.floor(total / 86400),
|
|
1351
|
+
hours: Math.floor(total % 86400 / 3600),
|
|
1352
|
+
minutes: Math.floor(total % 3600 / 60),
|
|
1353
|
+
seconds: total % 60
|
|
1354
|
+
};
|
|
1355
|
+
return /* @__PURE__ */ jsx(
|
|
1356
|
+
"div",
|
|
1357
|
+
{
|
|
1358
|
+
className: cx(sc("countdown"), plain && sc("countdown-plain"), className),
|
|
1359
|
+
role: "timer",
|
|
1360
|
+
...rest,
|
|
1361
|
+
children: units.map((u) => /* @__PURE__ */ jsxs("div", { className: cx(sc("countdown-unit")), children: [
|
|
1362
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("countdown-value")), children: u === "days" ? values[u] : pad(values[u]) }),
|
|
1363
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("countdown-label")), children: u })
|
|
1364
|
+
] }, u))
|
|
1365
|
+
}
|
|
1366
|
+
);
|
|
1367
|
+
}
|
|
1368
|
+
var MinusIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M5 12h14", strokeLinecap: "round" }) });
|
|
1369
|
+
var PlusIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M12 5v14M5 12h14", strokeLinecap: "round" }) });
|
|
1370
|
+
function NumberField({ className, label, ...rest }) {
|
|
1371
|
+
const sc = useSilicaClass();
|
|
1372
|
+
return /* @__PURE__ */ jsx(NumberField$1.Root, { className: cx(sc("number-field"), className), ...rest, children: /* @__PURE__ */ jsxs(NumberField$1.Group, { className: cx(sc("number-field-group")), children: [
|
|
1373
|
+
/* @__PURE__ */ jsx(
|
|
1374
|
+
NumberField$1.Decrement,
|
|
1375
|
+
{
|
|
1376
|
+
className: cx(sc("number-field-button"), sc("number-field-decrement")),
|
|
1377
|
+
children: /* @__PURE__ */ jsx(MinusIcon, {})
|
|
1378
|
+
}
|
|
1379
|
+
),
|
|
1380
|
+
/* @__PURE__ */ jsx(
|
|
1381
|
+
NumberField$1.Input,
|
|
1382
|
+
{
|
|
1383
|
+
"aria-label": label,
|
|
1384
|
+
className: cx(sc("number-field-input"))
|
|
1385
|
+
}
|
|
1386
|
+
),
|
|
1387
|
+
/* @__PURE__ */ jsx(
|
|
1388
|
+
NumberField$1.Increment,
|
|
1389
|
+
{
|
|
1390
|
+
className: cx(sc("number-field-button"), sc("number-field-increment")),
|
|
1391
|
+
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
1392
|
+
}
|
|
1393
|
+
)
|
|
1394
|
+
] }) });
|
|
1395
|
+
}
|
|
1396
|
+
var asRender = (el) => el;
|
|
1397
|
+
var Drawer = Dialog$1.Root;
|
|
1398
|
+
function DrawerTrigger({ children }) {
|
|
1399
|
+
return /* @__PURE__ */ jsx(Dialog$1.Trigger, { render: asRender(children) });
|
|
1400
|
+
}
|
|
1401
|
+
function DrawerClose({ children }) {
|
|
1402
|
+
return /* @__PURE__ */ jsx(Dialog$1.Close, { render: asRender(children) });
|
|
1403
|
+
}
|
|
1404
|
+
function DrawerContent({
|
|
1405
|
+
side = "left",
|
|
1406
|
+
className,
|
|
1407
|
+
backdropClassName,
|
|
1408
|
+
children,
|
|
1409
|
+
...rest
|
|
1410
|
+
}) {
|
|
1411
|
+
const sc = useSilicaClass();
|
|
1412
|
+
return /* @__PURE__ */ jsxs(Dialog$1.Portal, { children: [
|
|
1413
|
+
/* @__PURE__ */ jsx(Dialog$1.Backdrop, { className: cx(sc("drawer-backdrop"), backdropClassName) }),
|
|
1414
|
+
/* @__PURE__ */ jsx(
|
|
1415
|
+
Dialog$1.Popup,
|
|
1416
|
+
{
|
|
1417
|
+
"data-side": side,
|
|
1418
|
+
className: cx(sc("drawer-popup"), className),
|
|
1419
|
+
...rest,
|
|
1420
|
+
children
|
|
1421
|
+
}
|
|
1422
|
+
)
|
|
1423
|
+
] });
|
|
1424
|
+
}
|
|
1425
|
+
function DrawerTitle({ className, ...rest }) {
|
|
1426
|
+
const sc = useSilicaClass();
|
|
1427
|
+
return /* @__PURE__ */ jsx(Dialog$1.Title, { className: cx(sc("drawer-title"), className), ...rest });
|
|
1428
|
+
}
|
|
1429
|
+
function DrawerDescription({
|
|
1430
|
+
className,
|
|
1431
|
+
...rest
|
|
1432
|
+
}) {
|
|
1433
|
+
const sc = useSilicaClass();
|
|
1434
|
+
return /* @__PURE__ */ jsx(
|
|
1435
|
+
Dialog$1.Description,
|
|
1436
|
+
{
|
|
1437
|
+
className: cx(sc("drawer-description"), className),
|
|
1438
|
+
...rest
|
|
1439
|
+
}
|
|
1440
|
+
);
|
|
1441
|
+
}
|
|
1442
|
+
var List = React74.forwardRef(
|
|
1443
|
+
function List2({ hover, className, ...rest }, ref) {
|
|
1444
|
+
const sc = useSilicaClass();
|
|
1445
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("list"), hover && sc("list-hover"), className), ...rest });
|
|
1446
|
+
}
|
|
1447
|
+
);
|
|
1448
|
+
var ListRow = React74.forwardRef(
|
|
1449
|
+
function ListRow2({ className, ...rest }, ref) {
|
|
1450
|
+
const sc = useSilicaClass();
|
|
1451
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("list-row"), className), ...rest });
|
|
1452
|
+
}
|
|
1453
|
+
);
|
|
1454
|
+
var ListColGrow = React74.forwardRef(
|
|
1455
|
+
function ListColGrow2({ className, ...rest }, ref) {
|
|
1456
|
+
const sc = useSilicaClass();
|
|
1457
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("list-col-grow"), className), ...rest });
|
|
1458
|
+
}
|
|
1459
|
+
);
|
|
1460
|
+
var ListTitle = React74.forwardRef(
|
|
1461
|
+
function ListTitle2({ className, ...rest }, ref) {
|
|
1462
|
+
const sc = useSilicaClass();
|
|
1463
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cx(sc("list-title"), className), ...rest });
|
|
1464
|
+
}
|
|
1465
|
+
);
|
|
1466
|
+
var FileInput = React74.forwardRef(
|
|
1467
|
+
function FileInput2({ size, className, ...rest }, ref) {
|
|
1468
|
+
const sc = useSilicaClass();
|
|
1469
|
+
return /* @__PURE__ */ jsx(
|
|
1470
|
+
"input",
|
|
1471
|
+
{
|
|
1472
|
+
ref,
|
|
1473
|
+
type: "file",
|
|
1474
|
+
className: cx(
|
|
1475
|
+
sc("file-input"),
|
|
1476
|
+
size && size !== "md" && sc(`file-input-${size}`),
|
|
1477
|
+
className
|
|
1478
|
+
),
|
|
1479
|
+
...rest
|
|
1480
|
+
}
|
|
1481
|
+
);
|
|
1482
|
+
}
|
|
1483
|
+
);
|
|
1484
|
+
var Dock = React74.forwardRef(
|
|
1485
|
+
function Dock2({ color, className, ...rest }, ref) {
|
|
1486
|
+
const sc = useSilicaClass();
|
|
1487
|
+
return /* @__PURE__ */ jsx(
|
|
1488
|
+
"nav",
|
|
1489
|
+
{
|
|
1490
|
+
ref,
|
|
1491
|
+
className: cx(sc("dock"), color && sc(`dock-${color}`), className),
|
|
1492
|
+
...rest
|
|
1493
|
+
}
|
|
1494
|
+
);
|
|
1495
|
+
}
|
|
1496
|
+
);
|
|
1497
|
+
var DockItem = React74.forwardRef(
|
|
1498
|
+
function DockItem2({ active, className, type = "button", ...rest }, ref) {
|
|
1499
|
+
const sc = useSilicaClass();
|
|
1500
|
+
return /* @__PURE__ */ jsx(
|
|
1501
|
+
"button",
|
|
1502
|
+
{
|
|
1503
|
+
ref,
|
|
1504
|
+
type,
|
|
1505
|
+
"aria-current": active ? "page" : void 0,
|
|
1506
|
+
className: cx(sc("dock-item"), active && sc("dock-item-active"), className),
|
|
1507
|
+
...rest
|
|
1508
|
+
}
|
|
1509
|
+
);
|
|
1510
|
+
}
|
|
1511
|
+
);
|
|
1512
|
+
var DockLabel = React74.forwardRef(
|
|
1513
|
+
function DockLabel2({ className, ...rest }, ref) {
|
|
1514
|
+
const sc = useSilicaClass();
|
|
1515
|
+
return /* @__PURE__ */ jsx("span", { ref, className: cx(sc("dock-label"), className), ...rest });
|
|
1516
|
+
}
|
|
1517
|
+
);
|
|
1518
|
+
var Fieldset = React74.forwardRef(
|
|
1519
|
+
function Fieldset2({ className, ...rest }, ref) {
|
|
1520
|
+
const sc = useSilicaClass();
|
|
1521
|
+
return /* @__PURE__ */ jsx("fieldset", { ref, className: cx(sc("fieldset"), className), ...rest });
|
|
1522
|
+
}
|
|
1523
|
+
);
|
|
1524
|
+
var FieldsetLegend = React74.forwardRef(function FieldsetLegend2({ className, ...rest }, ref) {
|
|
1525
|
+
const sc = useSilicaClass();
|
|
1526
|
+
return /* @__PURE__ */ jsx("legend", { ref, className: cx(sc("fieldset-legend"), className), ...rest });
|
|
1527
|
+
});
|
|
1528
|
+
var FieldsetLabel = React74.forwardRef(function FieldsetLabel2({ className, ...rest }, ref) {
|
|
1529
|
+
const sc = useSilicaClass();
|
|
1530
|
+
return /* @__PURE__ */ jsx("span", { ref, className: cx(sc("fieldset-label"), className), ...rest });
|
|
1531
|
+
});
|
|
1532
|
+
var Label = React74.forwardRef(
|
|
1533
|
+
function Label2({ className, ...rest }, ref) {
|
|
1534
|
+
const sc = useSilicaClass();
|
|
1535
|
+
return /* @__PURE__ */ jsx("label", { ref, className: cx(sc("label"), className), ...rest });
|
|
1536
|
+
}
|
|
1537
|
+
);
|
|
1538
|
+
var FloatingLabel = React74.forwardRef(function FloatingLabel2({ label, children, className, ...rest }, ref) {
|
|
1539
|
+
const sc = useSilicaClass();
|
|
1540
|
+
const control = React74.isValidElement(children) ? React74.cloneElement(children, {
|
|
1541
|
+
placeholder: children.props.placeholder ?? " "
|
|
1542
|
+
}) : children;
|
|
1543
|
+
return /* @__PURE__ */ jsxs(
|
|
1544
|
+
"label",
|
|
1545
|
+
{
|
|
1546
|
+
ref,
|
|
1547
|
+
className: cx(sc("floating-label"), className),
|
|
1548
|
+
...rest,
|
|
1549
|
+
children: [
|
|
1550
|
+
control,
|
|
1551
|
+
/* @__PURE__ */ jsx("span", { children: label })
|
|
1552
|
+
]
|
|
1553
|
+
}
|
|
1554
|
+
);
|
|
1555
|
+
});
|
|
1556
|
+
function Validator({ children }) {
|
|
1557
|
+
const sc = useSilicaClass();
|
|
1558
|
+
if (!React74.isValidElement(children)) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
1559
|
+
return React74.cloneElement(children, {
|
|
1560
|
+
className: cx(sc("validator"), children.props.className)
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
var ValidatorHint = React74.forwardRef(function ValidatorHint2({ className, ...rest }, ref) {
|
|
1564
|
+
const sc = useSilicaClass();
|
|
1565
|
+
return /* @__PURE__ */ jsx("p", { ref, className: cx(sc("validator-hint"), className), ...rest });
|
|
1566
|
+
});
|
|
1567
|
+
function DiffArrows() {
|
|
1568
|
+
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx(
|
|
1569
|
+
"path",
|
|
1570
|
+
{
|
|
1571
|
+
d: "m9 7-5 5 5 5M15 7l5 5-5 5",
|
|
1572
|
+
strokeLinecap: "round",
|
|
1573
|
+
strokeLinejoin: "round"
|
|
1574
|
+
}
|
|
1575
|
+
) });
|
|
1576
|
+
}
|
|
1577
|
+
var clamp = (n) => Math.max(0, Math.min(100, n));
|
|
1578
|
+
var Diff = React74.forwardRef(function Diff2({
|
|
1579
|
+
before,
|
|
1580
|
+
after,
|
|
1581
|
+
position,
|
|
1582
|
+
defaultPosition = 50,
|
|
1583
|
+
onPositionChange,
|
|
1584
|
+
className,
|
|
1585
|
+
style,
|
|
1586
|
+
...rest
|
|
1587
|
+
}, ref) {
|
|
1588
|
+
const sc = useSilicaClass();
|
|
1589
|
+
const [internal, setInternal] = React74.useState(clamp(defaultPosition));
|
|
1590
|
+
const pos = position === void 0 ? internal : clamp(position);
|
|
1591
|
+
const rootRef = React74.useRef(null);
|
|
1592
|
+
const dragging = React74.useRef(false);
|
|
1593
|
+
const setRefs = React74.useCallback(
|
|
1594
|
+
(node) => {
|
|
1595
|
+
rootRef.current = node;
|
|
1596
|
+
if (typeof ref === "function") ref(node);
|
|
1597
|
+
else if (ref)
|
|
1598
|
+
ref.current = node;
|
|
1599
|
+
},
|
|
1600
|
+
[ref]
|
|
1601
|
+
);
|
|
1602
|
+
const commit = (next) => {
|
|
1603
|
+
const clamped = clamp(next);
|
|
1604
|
+
if (position === void 0) setInternal(clamped);
|
|
1605
|
+
onPositionChange?.(clamped);
|
|
1606
|
+
};
|
|
1607
|
+
const positionFromClientX = (clientX) => {
|
|
1608
|
+
const el = rootRef.current;
|
|
1609
|
+
if (!el) return pos;
|
|
1610
|
+
const rect = el.getBoundingClientRect();
|
|
1611
|
+
if (rect.width === 0) return pos;
|
|
1612
|
+
return (clientX - rect.left) / rect.width * 100;
|
|
1613
|
+
};
|
|
1614
|
+
const onPointerDown = (e) => {
|
|
1615
|
+
dragging.current = true;
|
|
1616
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
1617
|
+
commit(positionFromClientX(e.clientX));
|
|
1618
|
+
};
|
|
1619
|
+
const onPointerMove = (e) => {
|
|
1620
|
+
if (!dragging.current) return;
|
|
1621
|
+
commit(positionFromClientX(e.clientX));
|
|
1622
|
+
};
|
|
1623
|
+
const endDrag = (e) => {
|
|
1624
|
+
dragging.current = false;
|
|
1625
|
+
e.currentTarget.releasePointerCapture?.(e.pointerId);
|
|
1626
|
+
};
|
|
1627
|
+
const onKeyDown = (e) => {
|
|
1628
|
+
const step = e.shiftKey ? 10 : 2;
|
|
1629
|
+
if (e.key === "ArrowLeft") commit(pos - step);
|
|
1630
|
+
else if (e.key === "ArrowRight") commit(pos + step);
|
|
1631
|
+
else if (e.key === "Home") commit(0);
|
|
1632
|
+
else if (e.key === "End") commit(100);
|
|
1633
|
+
else return;
|
|
1634
|
+
e.preventDefault();
|
|
1635
|
+
};
|
|
1636
|
+
const styleVars = {
|
|
1637
|
+
...style,
|
|
1638
|
+
["--diff-pos"]: `${pos}%`
|
|
1639
|
+
};
|
|
1640
|
+
return /* @__PURE__ */ jsxs(
|
|
1641
|
+
"figure",
|
|
1642
|
+
{
|
|
1643
|
+
ref: setRefs,
|
|
1644
|
+
className: cx(sc("diff"), className),
|
|
1645
|
+
style: styleVars,
|
|
1646
|
+
onPointerDown,
|
|
1647
|
+
onPointerMove,
|
|
1648
|
+
onPointerUp: endDrag,
|
|
1649
|
+
onPointerCancel: endDrag,
|
|
1650
|
+
...rest,
|
|
1651
|
+
children: [
|
|
1652
|
+
/* @__PURE__ */ jsx("div", { className: cx(sc("diff-item-1")), children: before }),
|
|
1653
|
+
/* @__PURE__ */ jsx("div", { className: cx(sc("diff-item-2")), children: after }),
|
|
1654
|
+
/* @__PURE__ */ jsx(
|
|
1655
|
+
"div",
|
|
1656
|
+
{
|
|
1657
|
+
className: cx(sc("diff-resizer")),
|
|
1658
|
+
role: "slider",
|
|
1659
|
+
tabIndex: 0,
|
|
1660
|
+
"aria-label": "Comparison position",
|
|
1661
|
+
"aria-valuemin": 0,
|
|
1662
|
+
"aria-valuemax": 100,
|
|
1663
|
+
"aria-valuenow": Math.round(pos),
|
|
1664
|
+
onKeyDown,
|
|
1665
|
+
children: /* @__PURE__ */ jsx("span", { className: cx(sc("diff-grip")), children: /* @__PURE__ */ jsx(DiffArrows, {}) })
|
|
1666
|
+
}
|
|
1667
|
+
)
|
|
1668
|
+
]
|
|
1669
|
+
}
|
|
1670
|
+
);
|
|
1671
|
+
});
|
|
1672
|
+
var Mask = React74.forwardRef(function Mask2({ variant, className, ...rest }, ref) {
|
|
1673
|
+
const sc = useSilicaClass();
|
|
1674
|
+
return /* @__PURE__ */ jsx(
|
|
1675
|
+
"div",
|
|
1676
|
+
{
|
|
1677
|
+
ref,
|
|
1678
|
+
className: cx(sc("mask"), sc(`mask-${variant}`), className),
|
|
1679
|
+
...rest
|
|
1680
|
+
}
|
|
1681
|
+
);
|
|
1682
|
+
});
|
|
1683
|
+
var Meter = React74.forwardRef(function Meter2({
|
|
1684
|
+
value,
|
|
1685
|
+
min = 0,
|
|
1686
|
+
max = 100,
|
|
1687
|
+
color,
|
|
1688
|
+
size = "md",
|
|
1689
|
+
label,
|
|
1690
|
+
showValue = false,
|
|
1691
|
+
format,
|
|
1692
|
+
className,
|
|
1693
|
+
...rest
|
|
1694
|
+
}, ref) {
|
|
1695
|
+
const sc = useSilicaClass();
|
|
1696
|
+
const showHeader = label != null || showValue;
|
|
1697
|
+
return /* @__PURE__ */ jsxs(
|
|
1698
|
+
Meter$1.Root,
|
|
1699
|
+
{
|
|
1700
|
+
ref,
|
|
1701
|
+
value,
|
|
1702
|
+
min,
|
|
1703
|
+
max,
|
|
1704
|
+
format,
|
|
1705
|
+
className: cx(
|
|
1706
|
+
sc("meter"),
|
|
1707
|
+
color && sc(`meter-${color}`),
|
|
1708
|
+
size !== "md" && sc(`meter-${size}`),
|
|
1709
|
+
className
|
|
1710
|
+
),
|
|
1711
|
+
...rest,
|
|
1712
|
+
children: [
|
|
1713
|
+
showHeader && /* @__PURE__ */ jsxs("div", { className: cx(sc("meter-header")), children: [
|
|
1714
|
+
label != null && /* @__PURE__ */ jsx(Meter$1.Label, { className: cx(sc("meter-label")), children: label }),
|
|
1715
|
+
showValue && /* @__PURE__ */ jsx(Meter$1.Value, { className: cx(sc("meter-value")) })
|
|
1716
|
+
] }),
|
|
1717
|
+
/* @__PURE__ */ jsx(Meter$1.Track, { className: cx(sc("meter-track")), children: /* @__PURE__ */ jsx(Meter$1.Indicator, { className: cx(sc("meter-indicator")) }) })
|
|
1718
|
+
]
|
|
1719
|
+
}
|
|
1720
|
+
);
|
|
1721
|
+
});
|
|
1722
|
+
var ScrollArea = React74.forwardRef(
|
|
1723
|
+
function ScrollArea2({ orientation = "vertical", className, children, ...rest }, ref) {
|
|
1724
|
+
const sc = useSilicaClass();
|
|
1725
|
+
const showV = orientation === "vertical" || orientation === "both";
|
|
1726
|
+
const showH = orientation === "horizontal" || orientation === "both";
|
|
1727
|
+
return /* @__PURE__ */ jsxs(
|
|
1728
|
+
ScrollArea$1.Root,
|
|
1729
|
+
{
|
|
1730
|
+
ref,
|
|
1731
|
+
className: cx(sc("scroll-area"), className),
|
|
1732
|
+
...rest,
|
|
1733
|
+
children: [
|
|
1734
|
+
/* @__PURE__ */ jsx(ScrollArea$1.Viewport, { className: cx(sc("scroll-area-viewport")), children: /* @__PURE__ */ jsx(ScrollArea$1.Content, { className: cx(sc("scroll-area-content")), children }) }),
|
|
1735
|
+
showV && /* @__PURE__ */ jsx(
|
|
1736
|
+
ScrollArea$1.Scrollbar,
|
|
1737
|
+
{
|
|
1738
|
+
orientation: "vertical",
|
|
1739
|
+
className: cx(sc("scroll-area-scrollbar")),
|
|
1740
|
+
children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: cx(sc("scroll-area-thumb")) })
|
|
1741
|
+
}
|
|
1742
|
+
),
|
|
1743
|
+
showH && /* @__PURE__ */ jsx(
|
|
1744
|
+
ScrollArea$1.Scrollbar,
|
|
1745
|
+
{
|
|
1746
|
+
orientation: "horizontal",
|
|
1747
|
+
className: cx(sc("scroll-area-scrollbar")),
|
|
1748
|
+
children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: cx(sc("scroll-area-thumb")) })
|
|
1749
|
+
}
|
|
1750
|
+
),
|
|
1751
|
+
orientation === "both" && /* @__PURE__ */ jsx(ScrollArea$1.Corner, { className: cx(sc("scroll-area-corner")) })
|
|
1752
|
+
]
|
|
1753
|
+
}
|
|
1754
|
+
);
|
|
1755
|
+
}
|
|
1756
|
+
);
|
|
1757
|
+
function PreviewCard({
|
|
1758
|
+
children,
|
|
1759
|
+
content,
|
|
1760
|
+
side = "bottom",
|
|
1761
|
+
align = "center",
|
|
1762
|
+
sideOffset = 8,
|
|
1763
|
+
delay,
|
|
1764
|
+
closeDelay,
|
|
1765
|
+
open,
|
|
1766
|
+
defaultOpen,
|
|
1767
|
+
onOpenChange,
|
|
1768
|
+
arrow = false,
|
|
1769
|
+
className
|
|
1770
|
+
}) {
|
|
1771
|
+
const sc = useSilicaClass();
|
|
1772
|
+
return /* @__PURE__ */ jsxs(
|
|
1773
|
+
PreviewCard$1.Root,
|
|
1774
|
+
{
|
|
1775
|
+
open,
|
|
1776
|
+
defaultOpen,
|
|
1777
|
+
onOpenChange,
|
|
1778
|
+
children: [
|
|
1779
|
+
/* @__PURE__ */ jsx(
|
|
1780
|
+
PreviewCard$1.Trigger,
|
|
1781
|
+
{
|
|
1782
|
+
render: children,
|
|
1783
|
+
delay,
|
|
1784
|
+
closeDelay
|
|
1785
|
+
}
|
|
1786
|
+
),
|
|
1787
|
+
/* @__PURE__ */ jsx(PreviewCard$1.Portal, { children: /* @__PURE__ */ jsx(
|
|
1788
|
+
PreviewCard$1.Positioner,
|
|
1789
|
+
{
|
|
1790
|
+
side,
|
|
1791
|
+
align,
|
|
1792
|
+
sideOffset,
|
|
1793
|
+
children: /* @__PURE__ */ jsxs(PreviewCard$1.Popup, { className: cx(sc("preview-card"), className), children: [
|
|
1794
|
+
arrow && /* @__PURE__ */ jsx(PreviewCard$1.Arrow, { className: cx(sc("preview-card-arrow")) }),
|
|
1795
|
+
content
|
|
1796
|
+
] })
|
|
1797
|
+
}
|
|
1798
|
+
) })
|
|
1799
|
+
]
|
|
1800
|
+
}
|
|
1801
|
+
);
|
|
1802
|
+
}
|
|
1803
|
+
var Toolbar = React74.forwardRef(
|
|
1804
|
+
function Toolbar2({ className, ...rest }, ref) {
|
|
1805
|
+
const sc = useSilicaClass();
|
|
1806
|
+
return /* @__PURE__ */ jsx(
|
|
1807
|
+
Toolbar$1.Root,
|
|
1808
|
+
{
|
|
1809
|
+
ref,
|
|
1810
|
+
className: cx(sc("toolbar"), className),
|
|
1811
|
+
...rest
|
|
1812
|
+
}
|
|
1813
|
+
);
|
|
1814
|
+
}
|
|
1815
|
+
);
|
|
1816
|
+
var ToolbarButton = React74.forwardRef(function ToolbarButton2({ className, ...rest }, ref) {
|
|
1817
|
+
const sc = useSilicaClass();
|
|
1818
|
+
return /* @__PURE__ */ jsx(
|
|
1819
|
+
Toolbar$1.Button,
|
|
1820
|
+
{
|
|
1821
|
+
ref,
|
|
1822
|
+
className: cx(sc("toolbar-button"), className),
|
|
1823
|
+
...rest
|
|
1824
|
+
}
|
|
1825
|
+
);
|
|
1826
|
+
});
|
|
1827
|
+
var ToolbarGroup = React74.forwardRef(
|
|
1828
|
+
function ToolbarGroup2({ className, ...rest }, ref) {
|
|
1829
|
+
const sc = useSilicaClass();
|
|
1830
|
+
return /* @__PURE__ */ jsx(
|
|
1831
|
+
Toolbar$1.Group,
|
|
1832
|
+
{
|
|
1833
|
+
ref,
|
|
1834
|
+
className: cx(sc("toolbar-group"), className),
|
|
1835
|
+
...rest
|
|
1836
|
+
}
|
|
1837
|
+
);
|
|
1838
|
+
}
|
|
1839
|
+
);
|
|
1840
|
+
var ToolbarLink = React74.forwardRef(
|
|
1841
|
+
function ToolbarLink2({ className, ...rest }, ref) {
|
|
1842
|
+
const sc = useSilicaClass();
|
|
1843
|
+
return /* @__PURE__ */ jsx(
|
|
1844
|
+
Toolbar$1.Link,
|
|
1845
|
+
{
|
|
1846
|
+
ref,
|
|
1847
|
+
className: cx(sc("toolbar-link"), className),
|
|
1848
|
+
...rest
|
|
1849
|
+
}
|
|
1850
|
+
);
|
|
1851
|
+
}
|
|
1852
|
+
);
|
|
1853
|
+
var ToolbarSeparator = React74.forwardRef(function ToolbarSeparator2({ className, ...rest }, ref) {
|
|
1854
|
+
const sc = useSilicaClass();
|
|
1855
|
+
return /* @__PURE__ */ jsx(
|
|
1856
|
+
Toolbar$1.Separator,
|
|
1857
|
+
{
|
|
1858
|
+
ref,
|
|
1859
|
+
className: cx(sc("toolbar-separator"), className),
|
|
1860
|
+
...rest
|
|
1861
|
+
}
|
|
1862
|
+
);
|
|
1863
|
+
});
|
|
1864
|
+
function SunIcon() {
|
|
1865
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
1866
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "4" }),
|
|
1867
|
+
/* @__PURE__ */ jsx(
|
|
1868
|
+
"path",
|
|
1869
|
+
{
|
|
1870
|
+
d: "M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",
|
|
1871
|
+
strokeLinecap: "round"
|
|
1872
|
+
}
|
|
1873
|
+
)
|
|
1874
|
+
] });
|
|
1875
|
+
}
|
|
1876
|
+
function MoonIcon() {
|
|
1877
|
+
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx(
|
|
1878
|
+
"path",
|
|
1879
|
+
{
|
|
1880
|
+
d: "M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z",
|
|
1881
|
+
strokeLinejoin: "round"
|
|
1882
|
+
}
|
|
1883
|
+
) });
|
|
1884
|
+
}
|
|
1885
|
+
function PaletteIcon() {
|
|
1886
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
1887
|
+
/* @__PURE__ */ jsx("circle", { cx: "13.5", cy: "6.5", r: "1.5", fill: "currentColor", stroke: "none" }),
|
|
1888
|
+
/* @__PURE__ */ jsx("circle", { cx: "17.5", cy: "10.5", r: "1.5", fill: "currentColor", stroke: "none" }),
|
|
1889
|
+
/* @__PURE__ */ jsx("circle", { cx: "6.5", cy: "12.5", r: "1.5", fill: "currentColor", stroke: "none" }),
|
|
1890
|
+
/* @__PURE__ */ jsx("path", { d: "M12 2a10 10 0 1 0 0 20c1.1 0 2-.9 2-2 0-.5-.2-1-.5-1.3-.3-.4-.5-.8-.5-1.2 0-1 .8-1.5 1.8-1.5H16a6 6 0 0 0 6-6c0-4.4-4.5-8-10-8Z" })
|
|
1891
|
+
] });
|
|
1892
|
+
}
|
|
1893
|
+
function ThemeController({
|
|
1894
|
+
themes = ["light", "dark"],
|
|
1895
|
+
value,
|
|
1896
|
+
defaultValue,
|
|
1897
|
+
onChange,
|
|
1898
|
+
target,
|
|
1899
|
+
storageKey = "silica-theme",
|
|
1900
|
+
labels = false,
|
|
1901
|
+
variant = "ghost",
|
|
1902
|
+
color = "neutral",
|
|
1903
|
+
className,
|
|
1904
|
+
"aria-label": ariaLabel
|
|
1905
|
+
}) {
|
|
1906
|
+
const getTarget = React74.useCallback(() => {
|
|
1907
|
+
if (typeof target === "function") return target();
|
|
1908
|
+
if (target) return target;
|
|
1909
|
+
return typeof document !== "undefined" ? document.documentElement : null;
|
|
1910
|
+
}, [target]);
|
|
1911
|
+
const resolveInitial = () => {
|
|
1912
|
+
if (value) return value;
|
|
1913
|
+
if (typeof window !== "undefined") {
|
|
1914
|
+
if (storageKey) {
|
|
1915
|
+
const stored = window.localStorage.getItem(storageKey);
|
|
1916
|
+
if (stored && themes.includes(stored)) return stored;
|
|
1917
|
+
}
|
|
1918
|
+
const attr = getTarget()?.dataset.theme;
|
|
1919
|
+
if (attr && themes.includes(attr)) return attr;
|
|
1920
|
+
}
|
|
1921
|
+
return defaultValue ?? themes[0] ?? "light";
|
|
1922
|
+
};
|
|
1923
|
+
const [internal, setInternal] = React74.useState(resolveInitial);
|
|
1924
|
+
const current = value ?? internal;
|
|
1925
|
+
React74.useEffect(() => {
|
|
1926
|
+
const el = getTarget();
|
|
1927
|
+
if (el) el.dataset.theme = current;
|
|
1928
|
+
}, [current, getTarget]);
|
|
1929
|
+
const apply = (next) => {
|
|
1930
|
+
if (value === void 0) setInternal(next);
|
|
1931
|
+
const el = getTarget();
|
|
1932
|
+
if (el) el.dataset.theme = next;
|
|
1933
|
+
if (storageKey && typeof window !== "undefined") {
|
|
1934
|
+
window.localStorage.setItem(storageKey, next);
|
|
1935
|
+
}
|
|
1936
|
+
onChange?.(next);
|
|
1937
|
+
};
|
|
1938
|
+
const cycle = () => {
|
|
1939
|
+
const i = themes.indexOf(current);
|
|
1940
|
+
const next = themes[(i + 1) % themes.length] ?? themes[0] ?? current;
|
|
1941
|
+
apply(next);
|
|
1942
|
+
};
|
|
1943
|
+
const isLightDarkPair = themes.length === 2 && themes.includes("light") && themes.includes("dark");
|
|
1944
|
+
const icon = isLightDarkPair ? current === "dark" ? /* @__PURE__ */ jsx(SunIcon, {}) : /* @__PURE__ */ jsx(MoonIcon, {}) : /* @__PURE__ */ jsx(PaletteIcon, {});
|
|
1945
|
+
return /* @__PURE__ */ jsxs(
|
|
1946
|
+
Button,
|
|
1947
|
+
{
|
|
1948
|
+
type: "button",
|
|
1949
|
+
variant,
|
|
1950
|
+
color,
|
|
1951
|
+
onClick: cycle,
|
|
1952
|
+
className,
|
|
1953
|
+
"aria-label": ariaLabel ?? `Switch theme (current: ${current})`,
|
|
1954
|
+
title: `Theme: ${current}`,
|
|
1955
|
+
children: [
|
|
1956
|
+
icon,
|
|
1957
|
+
labels && /* @__PURE__ */ jsx("span", { className: "capitalize", children: current })
|
|
1958
|
+
]
|
|
1959
|
+
}
|
|
1960
|
+
);
|
|
1961
|
+
}
|
|
1962
|
+
function ChevronDown() {
|
|
1963
|
+
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1964
|
+
}
|
|
1965
|
+
function NavigationMenu({
|
|
1966
|
+
children,
|
|
1967
|
+
className,
|
|
1968
|
+
side = "bottom",
|
|
1969
|
+
align = "center",
|
|
1970
|
+
sideOffset = 8,
|
|
1971
|
+
...rest
|
|
1972
|
+
}) {
|
|
1973
|
+
const sc = useSilicaClass();
|
|
1974
|
+
return /* @__PURE__ */ jsxs(NavigationMenu$1.Root, { className: cx(sc("navigation-menu"), className), ...rest, children: [
|
|
1975
|
+
/* @__PURE__ */ jsx(NavigationMenu$1.List, { className: cx(sc("navigation-menu-list")), children }),
|
|
1976
|
+
/* @__PURE__ */ jsx(NavigationMenu$1.Portal, { children: /* @__PURE__ */ jsx(
|
|
1977
|
+
NavigationMenu$1.Positioner,
|
|
1978
|
+
{
|
|
1979
|
+
className: cx(sc("navigation-menu-positioner")),
|
|
1980
|
+
side,
|
|
1981
|
+
align,
|
|
1982
|
+
sideOffset,
|
|
1983
|
+
children: /* @__PURE__ */ jsx(NavigationMenu$1.Popup, { className: cx(sc("navigation-menu-popup")), children: /* @__PURE__ */ jsx(
|
|
1984
|
+
NavigationMenu$1.Viewport,
|
|
1985
|
+
{
|
|
1986
|
+
className: cx(sc("navigation-menu-viewport"))
|
|
1987
|
+
}
|
|
1988
|
+
) })
|
|
1989
|
+
}
|
|
1990
|
+
) })
|
|
1991
|
+
] });
|
|
1992
|
+
}
|
|
1993
|
+
var NavigationMenuItem = React74.forwardRef(function NavigationMenuItem2({ className, ...rest }, ref) {
|
|
1994
|
+
return /* @__PURE__ */ jsx(NavigationMenu$1.Item, { ref, className, ...rest });
|
|
1995
|
+
});
|
|
1996
|
+
var NavigationMenuTrigger = React74.forwardRef(function NavigationMenuTrigger2({ className, children, ...rest }, ref) {
|
|
1997
|
+
const sc = useSilicaClass();
|
|
1998
|
+
return /* @__PURE__ */ jsxs(
|
|
1999
|
+
NavigationMenu$1.Trigger,
|
|
2000
|
+
{
|
|
2001
|
+
ref,
|
|
2002
|
+
className: cx(sc("navigation-menu-trigger"), className),
|
|
2003
|
+
...rest,
|
|
2004
|
+
children: [
|
|
2005
|
+
children,
|
|
2006
|
+
/* @__PURE__ */ jsx(NavigationMenu$1.Icon, { className: cx(sc("navigation-menu-icon")), children: /* @__PURE__ */ jsx(ChevronDown, {}) })
|
|
2007
|
+
]
|
|
2008
|
+
}
|
|
2009
|
+
);
|
|
2010
|
+
});
|
|
2011
|
+
var NavigationMenuContent = React74.forwardRef(function NavigationMenuContent2({ className, ...rest }, ref) {
|
|
2012
|
+
const sc = useSilicaClass();
|
|
2013
|
+
return /* @__PURE__ */ jsx(
|
|
2014
|
+
NavigationMenu$1.Content,
|
|
2015
|
+
{
|
|
2016
|
+
ref,
|
|
2017
|
+
className: cx(sc("navigation-menu-content"), className),
|
|
2018
|
+
...rest
|
|
2019
|
+
}
|
|
2020
|
+
);
|
|
2021
|
+
});
|
|
2022
|
+
var NavigationMenuLink = React74.forwardRef(function NavigationMenuLink2({ className, ...rest }, ref) {
|
|
2023
|
+
const sc = useSilicaClass();
|
|
2024
|
+
return /* @__PURE__ */ jsx(
|
|
2025
|
+
NavigationMenu$1.Link,
|
|
2026
|
+
{
|
|
2027
|
+
ref,
|
|
2028
|
+
className: cx(sc("navigation-menu-link"), className),
|
|
2029
|
+
...rest
|
|
2030
|
+
}
|
|
2031
|
+
);
|
|
2032
|
+
});
|
|
2033
|
+
var Menubar = React74.forwardRef(
|
|
2034
|
+
function Menubar2({ className, ...rest }, ref) {
|
|
2035
|
+
const sc = useSilicaClass();
|
|
2036
|
+
return /* @__PURE__ */ jsx(Menubar$1, { ref, className: cx(sc("menubar"), className), ...rest });
|
|
2037
|
+
}
|
|
2038
|
+
);
|
|
2039
|
+
var MenubarMenu = Menu$1.Root;
|
|
2040
|
+
var MenubarTrigger = React74.forwardRef(function MenubarTrigger2({ className, ...rest }, ref) {
|
|
2041
|
+
const sc = useSilicaClass();
|
|
2042
|
+
return /* @__PURE__ */ jsx(
|
|
2043
|
+
Menu$1.Trigger,
|
|
2044
|
+
{
|
|
2045
|
+
ref,
|
|
2046
|
+
className: cx(sc("menubar-trigger"), className),
|
|
2047
|
+
...rest
|
|
2048
|
+
}
|
|
2049
|
+
);
|
|
2050
|
+
});
|
|
2051
|
+
function MenubarContent({
|
|
2052
|
+
className,
|
|
2053
|
+
children,
|
|
2054
|
+
side = "bottom",
|
|
2055
|
+
align = "start",
|
|
2056
|
+
sideOffset = 6,
|
|
2057
|
+
...rest
|
|
2058
|
+
}) {
|
|
2059
|
+
const sc = useSilicaClass();
|
|
2060
|
+
return /* @__PURE__ */ jsx(Menu$1.Portal, { children: /* @__PURE__ */ jsx(Menu$1.Positioner, { side, align, sideOffset, children: /* @__PURE__ */ jsx(Menu$1.Popup, { className: cx(sc("dropdown"), className), ...rest, children }) }) });
|
|
2061
|
+
}
|
|
2062
|
+
function MenubarItem({
|
|
2063
|
+
className,
|
|
2064
|
+
...rest
|
|
2065
|
+
}) {
|
|
2066
|
+
const sc = useSilicaClass();
|
|
2067
|
+
return /* @__PURE__ */ jsx(Menu$1.Item, { className: cx(sc("dropdown-item"), className), ...rest });
|
|
2068
|
+
}
|
|
2069
|
+
function MenubarSeparator({
|
|
2070
|
+
className,
|
|
2071
|
+
...rest
|
|
2072
|
+
}) {
|
|
2073
|
+
const sc = useSilicaClass();
|
|
2074
|
+
return /* @__PURE__ */ jsx(
|
|
2075
|
+
Menu$1.Separator,
|
|
2076
|
+
{
|
|
2077
|
+
className: cx(sc("dropdown-separator"), className),
|
|
2078
|
+
...rest
|
|
2079
|
+
}
|
|
2080
|
+
);
|
|
2081
|
+
}
|
|
2082
|
+
function MenubarGroup(props) {
|
|
2083
|
+
return /* @__PURE__ */ jsx(Menu$1.Group, { ...props });
|
|
2084
|
+
}
|
|
2085
|
+
function MenubarLabel({
|
|
2086
|
+
className,
|
|
2087
|
+
...rest
|
|
2088
|
+
}) {
|
|
2089
|
+
const sc = useSilicaClass();
|
|
2090
|
+
return /* @__PURE__ */ jsx(
|
|
2091
|
+
Menu$1.GroupLabel,
|
|
2092
|
+
{
|
|
2093
|
+
className: cx(sc("dropdown-label"), className),
|
|
2094
|
+
...rest
|
|
2095
|
+
}
|
|
2096
|
+
);
|
|
2097
|
+
}
|
|
2098
|
+
var ContextMenu = ContextMenu$1.Root;
|
|
2099
|
+
var ContextMenuTrigger = React74.forwardRef(function ContextMenuTrigger2({ className, ...rest }, ref) {
|
|
2100
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Trigger, { ref, className, ...rest });
|
|
2101
|
+
});
|
|
2102
|
+
function ContextMenuContent({
|
|
2103
|
+
className,
|
|
2104
|
+
children,
|
|
2105
|
+
...rest
|
|
2106
|
+
}) {
|
|
2107
|
+
const sc = useSilicaClass();
|
|
2108
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Portal, { children: /* @__PURE__ */ jsx(ContextMenu$1.Positioner, { children: /* @__PURE__ */ jsx(ContextMenu$1.Popup, { className: cx(sc("dropdown"), className), ...rest, children }) }) });
|
|
2109
|
+
}
|
|
2110
|
+
function ContextMenuItem({
|
|
2111
|
+
className,
|
|
2112
|
+
...rest
|
|
2113
|
+
}) {
|
|
2114
|
+
const sc = useSilicaClass();
|
|
2115
|
+
return /* @__PURE__ */ jsx(
|
|
2116
|
+
ContextMenu$1.Item,
|
|
2117
|
+
{
|
|
2118
|
+
className: cx(sc("dropdown-item"), className),
|
|
2119
|
+
...rest
|
|
2120
|
+
}
|
|
2121
|
+
);
|
|
2122
|
+
}
|
|
2123
|
+
function ContextMenuSeparator({
|
|
2124
|
+
className,
|
|
2125
|
+
...rest
|
|
2126
|
+
}) {
|
|
2127
|
+
const sc = useSilicaClass();
|
|
2128
|
+
return /* @__PURE__ */ jsx(
|
|
2129
|
+
ContextMenu$1.Separator,
|
|
2130
|
+
{
|
|
2131
|
+
className: cx(sc("dropdown-separator"), className),
|
|
2132
|
+
...rest
|
|
2133
|
+
}
|
|
2134
|
+
);
|
|
2135
|
+
}
|
|
2136
|
+
function ContextMenuGroup(props) {
|
|
2137
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Group, { ...props });
|
|
2138
|
+
}
|
|
2139
|
+
function ContextMenuLabel({
|
|
2140
|
+
className,
|
|
2141
|
+
...rest
|
|
2142
|
+
}) {
|
|
2143
|
+
const sc = useSilicaClass();
|
|
2144
|
+
return /* @__PURE__ */ jsx(
|
|
2145
|
+
ContextMenu$1.GroupLabel,
|
|
2146
|
+
{
|
|
2147
|
+
className: cx(sc("dropdown-label"), className),
|
|
2148
|
+
...rest
|
|
2149
|
+
}
|
|
2150
|
+
);
|
|
2151
|
+
}
|
|
2152
|
+
var ToggleGroup = React74.forwardRef(
|
|
2153
|
+
function ToggleGroup2({ className, ...rest }, ref) {
|
|
2154
|
+
const sc = useSilicaClass();
|
|
2155
|
+
return /* @__PURE__ */ jsx(
|
|
2156
|
+
ToggleGroup$1,
|
|
2157
|
+
{
|
|
2158
|
+
ref,
|
|
2159
|
+
className: cx(sc("toggle-group"), className),
|
|
2160
|
+
...rest
|
|
2161
|
+
}
|
|
2162
|
+
);
|
|
2163
|
+
}
|
|
2164
|
+
);
|
|
2165
|
+
var ToggleGroupItem = React74.forwardRef(function ToggleGroupItem2({ className, ...rest }, ref) {
|
|
2166
|
+
const sc = useSilicaClass();
|
|
2167
|
+
return /* @__PURE__ */ jsx(
|
|
2168
|
+
Toggle$1,
|
|
2169
|
+
{
|
|
2170
|
+
ref,
|
|
2171
|
+
className: cx(sc("toggle-group-item"), className),
|
|
2172
|
+
...rest
|
|
2173
|
+
}
|
|
2174
|
+
);
|
|
2175
|
+
});
|
|
2176
|
+
var Field = React74.forwardRef(function Field2({ className, ...rest }, ref) {
|
|
2177
|
+
const sc = useSilicaClass();
|
|
2178
|
+
return /* @__PURE__ */ jsx(Field$1.Root, { ref, className: cx(sc("field"), className), ...rest });
|
|
2179
|
+
});
|
|
2180
|
+
var FieldLabel = React74.forwardRef(
|
|
2181
|
+
function FieldLabel2({ className, ...rest }, ref) {
|
|
2182
|
+
const sc = useSilicaClass();
|
|
2183
|
+
return /* @__PURE__ */ jsx(
|
|
2184
|
+
Field$1.Label,
|
|
2185
|
+
{
|
|
2186
|
+
ref,
|
|
2187
|
+
className: cx(sc("field-label"), className),
|
|
2188
|
+
...rest
|
|
2189
|
+
}
|
|
2190
|
+
);
|
|
2191
|
+
}
|
|
2192
|
+
);
|
|
2193
|
+
var FieldControl = React74.forwardRef(function FieldControl2({ className, render, ...rest }, ref) {
|
|
2194
|
+
const sc = useSilicaClass();
|
|
2195
|
+
return /* @__PURE__ */ jsx(
|
|
2196
|
+
Field$1.Control,
|
|
2197
|
+
{
|
|
2198
|
+
ref,
|
|
2199
|
+
render,
|
|
2200
|
+
className: cx(render ? void 0 : sc("input"), className),
|
|
2201
|
+
...rest
|
|
2202
|
+
}
|
|
2203
|
+
);
|
|
2204
|
+
});
|
|
2205
|
+
var FieldDescription = React74.forwardRef(function FieldDescription2({ className, ...rest }, ref) {
|
|
2206
|
+
const sc = useSilicaClass();
|
|
2207
|
+
return /* @__PURE__ */ jsx(
|
|
2208
|
+
Field$1.Description,
|
|
2209
|
+
{
|
|
2210
|
+
ref,
|
|
2211
|
+
className: cx(sc("field-description"), className),
|
|
2212
|
+
...rest
|
|
2213
|
+
}
|
|
2214
|
+
);
|
|
2215
|
+
});
|
|
2216
|
+
var FieldError = React74.forwardRef(
|
|
2217
|
+
function FieldError2({ className, ...rest }, ref) {
|
|
2218
|
+
const sc = useSilicaClass();
|
|
2219
|
+
return /* @__PURE__ */ jsx(
|
|
2220
|
+
Field$1.Error,
|
|
2221
|
+
{
|
|
2222
|
+
ref,
|
|
2223
|
+
className: cx(sc("field-error"), className),
|
|
2224
|
+
...rest
|
|
2225
|
+
}
|
|
2226
|
+
);
|
|
2227
|
+
}
|
|
2228
|
+
);
|
|
2229
|
+
var Form = React74.forwardRef(function Form2(props, ref) {
|
|
2230
|
+
return /* @__PURE__ */ jsx(Form$1, { ref, ...props });
|
|
2231
|
+
});
|
|
2232
|
+
var RadioGroupContext = React74.createContext(
|
|
2233
|
+
null
|
|
2234
|
+
);
|
|
2235
|
+
function RadioGroup({
|
|
2236
|
+
value,
|
|
2237
|
+
defaultValue,
|
|
2238
|
+
onValueChange,
|
|
2239
|
+
name,
|
|
2240
|
+
orientation = "vertical",
|
|
2241
|
+
disabled,
|
|
2242
|
+
color,
|
|
2243
|
+
size,
|
|
2244
|
+
className,
|
|
2245
|
+
children,
|
|
2246
|
+
...rest
|
|
2247
|
+
}) {
|
|
2248
|
+
const sc = useSilicaClass();
|
|
2249
|
+
const autoName = React74.useId();
|
|
2250
|
+
const [internal, setInternal] = React74.useState(
|
|
2251
|
+
defaultValue
|
|
2252
|
+
);
|
|
2253
|
+
const current = value !== void 0 ? value : internal;
|
|
2254
|
+
const select = React74.useCallback(
|
|
2255
|
+
(v) => {
|
|
2256
|
+
if (value === void 0) setInternal(v);
|
|
2257
|
+
onValueChange?.(v);
|
|
2258
|
+
},
|
|
2259
|
+
[value, onValueChange]
|
|
2260
|
+
);
|
|
2261
|
+
const ctx = React74.useMemo(
|
|
2262
|
+
() => ({ name: name ?? autoName, value: current, select, disabled, color, size }),
|
|
2263
|
+
[name, autoName, current, select, disabled, color, size]
|
|
2264
|
+
);
|
|
2265
|
+
return /* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
2266
|
+
"div",
|
|
2267
|
+
{
|
|
2268
|
+
role: "radiogroup",
|
|
2269
|
+
"data-orientation": orientation,
|
|
2270
|
+
className: cx(sc("radio-group"), className),
|
|
2271
|
+
...rest,
|
|
2272
|
+
children
|
|
2273
|
+
}
|
|
2274
|
+
) });
|
|
2275
|
+
}
|
|
2276
|
+
function RadioOption({
|
|
2277
|
+
value,
|
|
2278
|
+
disabled,
|
|
2279
|
+
color,
|
|
2280
|
+
size,
|
|
2281
|
+
className,
|
|
2282
|
+
children,
|
|
2283
|
+
...rest
|
|
2284
|
+
}) {
|
|
2285
|
+
const sc = useSilicaClass();
|
|
2286
|
+
const group = React74.useContext(RadioGroupContext);
|
|
2287
|
+
const c = color ?? group?.color;
|
|
2288
|
+
const s = size ?? group?.size ?? "md";
|
|
2289
|
+
const isDisabled = disabled ?? group?.disabled;
|
|
2290
|
+
const radioClasses = cx(
|
|
2291
|
+
sc("radio"),
|
|
2292
|
+
c && sc(`radio-${c}`),
|
|
2293
|
+
s !== "md" && sc(`radio-${s}`)
|
|
2294
|
+
);
|
|
2295
|
+
return /* @__PURE__ */ jsxs("label", { className: cx(sc("radio-option"), className), ...rest, children: [
|
|
2296
|
+
/* @__PURE__ */ jsx(
|
|
2297
|
+
"input",
|
|
2298
|
+
{
|
|
2299
|
+
type: "radio",
|
|
2300
|
+
className: radioClasses,
|
|
2301
|
+
name: group?.name,
|
|
2302
|
+
value,
|
|
2303
|
+
checked: group ? group.value === value : void 0,
|
|
2304
|
+
onChange: group ? () => group.select(value) : void 0,
|
|
2305
|
+
disabled: isDisabled
|
|
2306
|
+
}
|
|
2307
|
+
),
|
|
2308
|
+
children != null && /* @__PURE__ */ jsx("span", { children })
|
|
2309
|
+
] });
|
|
2310
|
+
}
|
|
2311
|
+
var CheckboxGroupContext = React74.createContext(null);
|
|
2312
|
+
function CheckboxGroup({
|
|
2313
|
+
value,
|
|
2314
|
+
defaultValue,
|
|
2315
|
+
onValueChange,
|
|
2316
|
+
orientation = "vertical",
|
|
2317
|
+
disabled,
|
|
2318
|
+
color,
|
|
2319
|
+
size,
|
|
2320
|
+
className,
|
|
2321
|
+
children,
|
|
2322
|
+
...rest
|
|
2323
|
+
}) {
|
|
2324
|
+
const sc = useSilicaClass();
|
|
2325
|
+
const [internal, setInternal] = React74.useState(defaultValue ?? []);
|
|
2326
|
+
const current = value !== void 0 ? value : internal;
|
|
2327
|
+
const toggle = React74.useCallback(
|
|
2328
|
+
(v, checked) => {
|
|
2329
|
+
const next = checked ? [...current, v] : current.filter((x) => x !== v);
|
|
2330
|
+
if (value === void 0) setInternal(next);
|
|
2331
|
+
onValueChange?.(next);
|
|
2332
|
+
},
|
|
2333
|
+
[current, value, onValueChange]
|
|
2334
|
+
);
|
|
2335
|
+
const ctx = React74.useMemo(
|
|
2336
|
+
() => ({ value: current, toggle, disabled, color, size }),
|
|
2337
|
+
[current, toggle, disabled, color, size]
|
|
2338
|
+
);
|
|
2339
|
+
return /* @__PURE__ */ jsx(CheckboxGroupContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
2340
|
+
"div",
|
|
2341
|
+
{
|
|
2342
|
+
role: "group",
|
|
2343
|
+
"data-orientation": orientation,
|
|
2344
|
+
className: cx(sc("checkbox-group"), className),
|
|
2345
|
+
...rest,
|
|
2346
|
+
children
|
|
2347
|
+
}
|
|
2348
|
+
) });
|
|
2349
|
+
}
|
|
2350
|
+
function CheckboxOption({
|
|
2351
|
+
value,
|
|
2352
|
+
disabled,
|
|
2353
|
+
color,
|
|
2354
|
+
size,
|
|
2355
|
+
className,
|
|
2356
|
+
children,
|
|
2357
|
+
...rest
|
|
2358
|
+
}) {
|
|
2359
|
+
const sc = useSilicaClass();
|
|
2360
|
+
const group = React74.useContext(CheckboxGroupContext);
|
|
2361
|
+
const c = color ?? group?.color;
|
|
2362
|
+
const s = size ?? group?.size ?? "md";
|
|
2363
|
+
const isDisabled = disabled ?? group?.disabled;
|
|
2364
|
+
const checkboxClasses = cx(
|
|
2365
|
+
sc("checkbox"),
|
|
2366
|
+
c && sc(`checkbox-${c}`),
|
|
2367
|
+
s !== "md" && sc(`checkbox-${s}`)
|
|
2368
|
+
);
|
|
2369
|
+
return /* @__PURE__ */ jsxs("label", { className: cx(sc("checkbox-option"), className), ...rest, children: [
|
|
2370
|
+
/* @__PURE__ */ jsx(
|
|
2371
|
+
"input",
|
|
2372
|
+
{
|
|
2373
|
+
type: "checkbox",
|
|
2374
|
+
className: checkboxClasses,
|
|
2375
|
+
value,
|
|
2376
|
+
checked: group ? group.value.includes(value) : void 0,
|
|
2377
|
+
onChange: group ? (e) => group.toggle(value, e.target.checked) : void 0,
|
|
2378
|
+
disabled: isDisabled
|
|
2379
|
+
}
|
|
2380
|
+
),
|
|
2381
|
+
children != null && /* @__PURE__ */ jsx("span", { children })
|
|
2382
|
+
] });
|
|
2383
|
+
}
|
|
2384
|
+
var Slider = React74.forwardRef(function Slider2({ color, size = "md", showValue, className, value, defaultValue, ...rest }, ref) {
|
|
2385
|
+
const sc = useSilicaClass();
|
|
2386
|
+
const src = value ?? defaultValue;
|
|
2387
|
+
const thumbCount = Array.isArray(src) ? Math.max(src.length, 1) : 1;
|
|
2388
|
+
return /* @__PURE__ */ jsxs(
|
|
2389
|
+
Slider$1.Root,
|
|
2390
|
+
{
|
|
2391
|
+
ref,
|
|
2392
|
+
value,
|
|
2393
|
+
defaultValue,
|
|
2394
|
+
className: cx(
|
|
2395
|
+
sc("slider"),
|
|
2396
|
+
color && sc(`slider-${color}`),
|
|
2397
|
+
size !== "md" && sc(`slider-${size}`),
|
|
2398
|
+
className
|
|
2399
|
+
),
|
|
2400
|
+
...rest,
|
|
2401
|
+
children: [
|
|
2402
|
+
showValue && /* @__PURE__ */ jsx(Slider$1.Value, { className: cx(sc("slider-value")) }),
|
|
2403
|
+
/* @__PURE__ */ jsx(Slider$1.Control, { className: cx(sc("slider-control")), children: /* @__PURE__ */ jsxs(Slider$1.Track, { className: cx(sc("slider-track")), children: [
|
|
2404
|
+
/* @__PURE__ */ jsx(Slider$1.Indicator, { className: cx(sc("slider-indicator")) }),
|
|
2405
|
+
Array.from({ length: thumbCount }, (_, i) => /* @__PURE__ */ jsx(Slider$1.Thumb, { className: cx(sc("slider-thumb")) }, i))
|
|
2406
|
+
] }) })
|
|
2407
|
+
]
|
|
2408
|
+
}
|
|
2409
|
+
);
|
|
2410
|
+
});
|
|
2411
|
+
var Switch = React74.forwardRef(function Switch2({ color, size = "md", className, ...rest }, ref) {
|
|
2412
|
+
const sc = useSilicaClass();
|
|
2413
|
+
return /* @__PURE__ */ jsx(
|
|
2414
|
+
Switch$1.Root,
|
|
2415
|
+
{
|
|
2416
|
+
ref,
|
|
2417
|
+
className: cx(
|
|
2418
|
+
sc("switch"),
|
|
2419
|
+
color && sc(`switch-${color}`),
|
|
2420
|
+
size !== "md" && sc(`switch-${size}`),
|
|
2421
|
+
className
|
|
2422
|
+
),
|
|
2423
|
+
...rest,
|
|
2424
|
+
children: /* @__PURE__ */ jsx(Switch$1.Thumb, { className: cx(sc("switch-thumb")) })
|
|
2425
|
+
}
|
|
2426
|
+
);
|
|
2427
|
+
});
|
|
2428
|
+
var ChevronIcon2 = () => /* @__PURE__ */ jsx(
|
|
2429
|
+
"svg",
|
|
2430
|
+
{
|
|
2431
|
+
viewBox: "0 0 24 24",
|
|
2432
|
+
fill: "none",
|
|
2433
|
+
stroke: "currentColor",
|
|
2434
|
+
strokeWidth: "2",
|
|
2435
|
+
"aria-hidden": "true",
|
|
2436
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
2437
|
+
}
|
|
2438
|
+
);
|
|
2439
|
+
function Collapsible({ className, ...rest }) {
|
|
2440
|
+
const sc = useSilicaClass();
|
|
2441
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Root, { className: cx(sc("collapsible"), className), ...rest });
|
|
2442
|
+
}
|
|
2443
|
+
function CollapsibleTrigger({
|
|
2444
|
+
className,
|
|
2445
|
+
children,
|
|
2446
|
+
chevron = true,
|
|
2447
|
+
...rest
|
|
2448
|
+
}) {
|
|
2449
|
+
const sc = useSilicaClass();
|
|
2450
|
+
return /* @__PURE__ */ jsxs(
|
|
2451
|
+
Collapsible$1.Trigger,
|
|
2452
|
+
{
|
|
2453
|
+
className: cx(sc("collapsible-trigger"), className),
|
|
2454
|
+
...rest,
|
|
2455
|
+
children: [
|
|
2456
|
+
/* @__PURE__ */ jsx("span", { children }),
|
|
2457
|
+
chevron && /* @__PURE__ */ jsx(ChevronIcon2, {})
|
|
2458
|
+
]
|
|
2459
|
+
}
|
|
2460
|
+
);
|
|
2461
|
+
}
|
|
2462
|
+
function CollapsiblePanel({
|
|
2463
|
+
className,
|
|
2464
|
+
children,
|
|
2465
|
+
...rest
|
|
2466
|
+
}) {
|
|
2467
|
+
const sc = useSilicaClass();
|
|
2468
|
+
return /* @__PURE__ */ jsx(
|
|
2469
|
+
Collapsible$1.Panel,
|
|
2470
|
+
{
|
|
2471
|
+
className: cx(sc("collapsible-panel"), className),
|
|
2472
|
+
...rest,
|
|
2473
|
+
children: /* @__PURE__ */ jsx("div", { className: cx(sc("collapsible-content")), children })
|
|
2474
|
+
}
|
|
2475
|
+
);
|
|
2476
|
+
}
|
|
2477
|
+
var asRender2 = (el) => el;
|
|
2478
|
+
var AlertDialog = AlertDialog$1.Root;
|
|
2479
|
+
function AlertDialogTrigger({
|
|
2480
|
+
children
|
|
2481
|
+
}) {
|
|
2482
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Trigger, { render: asRender2(children) });
|
|
2483
|
+
}
|
|
2484
|
+
function AlertDialogClose({
|
|
2485
|
+
children
|
|
2486
|
+
}) {
|
|
2487
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Close, { render: asRender2(children) });
|
|
2488
|
+
}
|
|
2489
|
+
function AlertDialogContent({
|
|
2490
|
+
className,
|
|
2491
|
+
backdropClassName,
|
|
2492
|
+
children,
|
|
2493
|
+
...rest
|
|
2494
|
+
}) {
|
|
2495
|
+
const sc = useSilicaClass();
|
|
2496
|
+
return /* @__PURE__ */ jsxs(AlertDialog$1.Portal, { children: [
|
|
2497
|
+
/* @__PURE__ */ jsx(
|
|
2498
|
+
AlertDialog$1.Backdrop,
|
|
2499
|
+
{
|
|
2500
|
+
className: cx(sc("dialog-backdrop"), backdropClassName)
|
|
2501
|
+
}
|
|
2502
|
+
),
|
|
2503
|
+
/* @__PURE__ */ jsx(
|
|
2504
|
+
AlertDialog$1.Popup,
|
|
2505
|
+
{
|
|
2506
|
+
className: cx(sc("dialog-popup"), className),
|
|
2507
|
+
...rest,
|
|
2508
|
+
children
|
|
2509
|
+
}
|
|
2510
|
+
)
|
|
2511
|
+
] });
|
|
2512
|
+
}
|
|
2513
|
+
function AlertDialogTitle({
|
|
2514
|
+
className,
|
|
2515
|
+
...rest
|
|
2516
|
+
}) {
|
|
2517
|
+
const sc = useSilicaClass();
|
|
2518
|
+
return /* @__PURE__ */ jsx(
|
|
2519
|
+
AlertDialog$1.Title,
|
|
2520
|
+
{
|
|
2521
|
+
className: cx(sc("dialog-title"), className),
|
|
2522
|
+
...rest
|
|
2523
|
+
}
|
|
2524
|
+
);
|
|
2525
|
+
}
|
|
2526
|
+
function AlertDialogDescription({
|
|
2527
|
+
className,
|
|
2528
|
+
...rest
|
|
2529
|
+
}) {
|
|
2530
|
+
const sc = useSilicaClass();
|
|
2531
|
+
return /* @__PURE__ */ jsx(
|
|
2532
|
+
AlertDialog$1.Description,
|
|
2533
|
+
{
|
|
2534
|
+
className: cx(sc("dialog-description"), className),
|
|
2535
|
+
...rest
|
|
2536
|
+
}
|
|
2537
|
+
);
|
|
2538
|
+
}
|
|
2539
|
+
var FilterContext = React74.createContext(null);
|
|
2540
|
+
var CloseIcon2 = () => /* @__PURE__ */ jsx(
|
|
2541
|
+
"svg",
|
|
2542
|
+
{
|
|
2543
|
+
viewBox: "0 0 24 24",
|
|
2544
|
+
fill: "none",
|
|
2545
|
+
stroke: "currentColor",
|
|
2546
|
+
strokeWidth: "2.25",
|
|
2547
|
+
"aria-hidden": "true",
|
|
2548
|
+
children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12", strokeLinecap: "round" })
|
|
2549
|
+
}
|
|
2550
|
+
);
|
|
2551
|
+
function Filter({
|
|
2552
|
+
value,
|
|
2553
|
+
defaultValue,
|
|
2554
|
+
onValueChange,
|
|
2555
|
+
color,
|
|
2556
|
+
disabled,
|
|
2557
|
+
showReset = true,
|
|
2558
|
+
resetLabel = "Reset filter",
|
|
2559
|
+
className,
|
|
2560
|
+
children,
|
|
2561
|
+
...rest
|
|
2562
|
+
}) {
|
|
2563
|
+
const sc = useSilicaClass();
|
|
2564
|
+
const [internal, setInternal] = React74.useState(
|
|
2565
|
+
defaultValue
|
|
2566
|
+
);
|
|
2567
|
+
const current = value !== void 0 ? value : internal;
|
|
2568
|
+
const select = React74.useCallback(
|
|
2569
|
+
(v) => {
|
|
2570
|
+
if (value === void 0) setInternal(v);
|
|
2571
|
+
onValueChange?.(v);
|
|
2572
|
+
},
|
|
2573
|
+
[value, onValueChange]
|
|
2574
|
+
);
|
|
2575
|
+
const ctx = React74.useMemo(
|
|
2576
|
+
() => ({ value: current, select, disabled }),
|
|
2577
|
+
[current, select, disabled]
|
|
2578
|
+
);
|
|
2579
|
+
return /* @__PURE__ */ jsx(FilterContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
|
|
2580
|
+
"div",
|
|
2581
|
+
{
|
|
2582
|
+
role: "radiogroup",
|
|
2583
|
+
className: cx(sc("filter"), color && sc(`filter-${color}`), className),
|
|
2584
|
+
...rest,
|
|
2585
|
+
children: [
|
|
2586
|
+
showReset && current != null && /* @__PURE__ */ jsx(
|
|
2587
|
+
"button",
|
|
2588
|
+
{
|
|
2589
|
+
type: "button",
|
|
2590
|
+
className: cx(sc("filter-reset")),
|
|
2591
|
+
"aria-label": resetLabel,
|
|
2592
|
+
onClick: () => select(void 0),
|
|
2593
|
+
disabled,
|
|
2594
|
+
children: /* @__PURE__ */ jsx(CloseIcon2, {})
|
|
2595
|
+
}
|
|
2596
|
+
),
|
|
2597
|
+
children
|
|
2598
|
+
]
|
|
2599
|
+
}
|
|
2600
|
+
) });
|
|
2601
|
+
}
|
|
2602
|
+
var FilterItem = React74.forwardRef(
|
|
2603
|
+
function FilterItem2({ value, disabled, className, children, onClick, ...rest }, ref) {
|
|
2604
|
+
const sc = useSilicaClass();
|
|
2605
|
+
const group = React74.useContext(FilterContext);
|
|
2606
|
+
const selected = group?.value === value;
|
|
2607
|
+
const isDisabled = disabled ?? group?.disabled;
|
|
2608
|
+
return /* @__PURE__ */ jsx(
|
|
2609
|
+
"button",
|
|
2610
|
+
{
|
|
2611
|
+
ref,
|
|
2612
|
+
type: "button",
|
|
2613
|
+
role: "radio",
|
|
2614
|
+
"aria-checked": selected,
|
|
2615
|
+
"data-selected": selected ? "" : void 0,
|
|
2616
|
+
disabled: isDisabled,
|
|
2617
|
+
className: cx(sc("filter-item"), className),
|
|
2618
|
+
onClick: (e) => {
|
|
2619
|
+
onClick?.(e);
|
|
2620
|
+
if (!e.defaultPrevented) group?.select(value);
|
|
2621
|
+
},
|
|
2622
|
+
...rest,
|
|
2623
|
+
children
|
|
2624
|
+
}
|
|
2625
|
+
);
|
|
2626
|
+
}
|
|
2627
|
+
);
|
|
2628
|
+
var ChevronDownIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
2629
|
+
var ChevronUpIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m18 15-6-6-6 6", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
2630
|
+
var CheckIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
2631
|
+
function SelectItem({ className, children, ...rest }) {
|
|
2632
|
+
const sc = useSilicaClass();
|
|
2633
|
+
return /* @__PURE__ */ jsxs(Select$1.Item, { className: cx(sc("select-item"), className), ...rest, children: [
|
|
2634
|
+
/* @__PURE__ */ jsx(Select$1.ItemIndicator, { className: cx(sc("select-item-indicator")), children: /* @__PURE__ */ jsx(CheckIcon, {}) }),
|
|
2635
|
+
/* @__PURE__ */ jsx(Select$1.ItemText, { children })
|
|
2636
|
+
] });
|
|
2637
|
+
}
|
|
2638
|
+
function SelectGroup(props) {
|
|
2639
|
+
return /* @__PURE__ */ jsx(Select$1.Group, { ...props });
|
|
2640
|
+
}
|
|
2641
|
+
function SelectGroupLabel({
|
|
2642
|
+
className,
|
|
2643
|
+
...rest
|
|
2644
|
+
}) {
|
|
2645
|
+
const sc = useSilicaClass();
|
|
2646
|
+
return /* @__PURE__ */ jsx(
|
|
2647
|
+
Select$1.GroupLabel,
|
|
2648
|
+
{
|
|
2649
|
+
className: cx(sc("select-group-label"), className),
|
|
2650
|
+
...rest
|
|
2651
|
+
}
|
|
2652
|
+
);
|
|
2653
|
+
}
|
|
2654
|
+
function SelectSeparator({
|
|
2655
|
+
className,
|
|
2656
|
+
...rest
|
|
2657
|
+
}) {
|
|
2658
|
+
const sc = useSilicaClass();
|
|
2659
|
+
return /* @__PURE__ */ jsx(
|
|
2660
|
+
Select$1.Separator,
|
|
2661
|
+
{
|
|
2662
|
+
className: cx(sc("select-separator"), className),
|
|
2663
|
+
...rest
|
|
2664
|
+
}
|
|
2665
|
+
);
|
|
2666
|
+
}
|
|
2667
|
+
function Select({
|
|
2668
|
+
value,
|
|
2669
|
+
defaultValue,
|
|
2670
|
+
onValueChange,
|
|
2671
|
+
multiple,
|
|
2672
|
+
items,
|
|
2673
|
+
name,
|
|
2674
|
+
disabled,
|
|
2675
|
+
required,
|
|
2676
|
+
readOnly,
|
|
2677
|
+
placeholder,
|
|
2678
|
+
color,
|
|
2679
|
+
size = "md",
|
|
2680
|
+
side = "bottom",
|
|
2681
|
+
align = "start",
|
|
2682
|
+
sideOffset = 6,
|
|
2683
|
+
alignItemWithTrigger = false,
|
|
2684
|
+
className,
|
|
2685
|
+
popupClassName,
|
|
2686
|
+
id,
|
|
2687
|
+
children,
|
|
2688
|
+
...aria
|
|
2689
|
+
}) {
|
|
2690
|
+
const sc = useSilicaClass();
|
|
2691
|
+
const autoItems = !children && items ? Array.isArray(items) ? items.map((it) => /* @__PURE__ */ jsx(SelectItem, { value: it.value, children: it.label }, String(it.value))) : Object.entries(items).map(([v, label]) => /* @__PURE__ */ jsx(SelectItem, { value: v, children: label }, v)) : null;
|
|
2692
|
+
return /* @__PURE__ */ jsxs(
|
|
2693
|
+
Select$1.Root,
|
|
2694
|
+
{
|
|
2695
|
+
value,
|
|
2696
|
+
defaultValue,
|
|
2697
|
+
onValueChange,
|
|
2698
|
+
multiple,
|
|
2699
|
+
items,
|
|
2700
|
+
name,
|
|
2701
|
+
disabled,
|
|
2702
|
+
required,
|
|
2703
|
+
readOnly,
|
|
2704
|
+
children: [
|
|
2705
|
+
/* @__PURE__ */ jsxs(
|
|
2706
|
+
Select$1.Trigger,
|
|
2707
|
+
{
|
|
2708
|
+
id,
|
|
2709
|
+
className: cx(
|
|
2710
|
+
sc("select"),
|
|
2711
|
+
color && sc(`select-${color}`),
|
|
2712
|
+
size !== "md" && sc(`select-${size}`),
|
|
2713
|
+
sc("select-trigger"),
|
|
2714
|
+
className
|
|
2715
|
+
),
|
|
2716
|
+
...aria,
|
|
2717
|
+
children: [
|
|
2718
|
+
/* @__PURE__ */ jsx(Select$1.Value, { className: cx(sc("select-value")) }),
|
|
2719
|
+
placeholder != null && /* @__PURE__ */ jsx("span", { className: cx(sc("select-placeholder")), children: placeholder }),
|
|
2720
|
+
/* @__PURE__ */ jsx(Select$1.Icon, { className: cx(sc("select-icon")), children: /* @__PURE__ */ jsx(ChevronDownIcon, {}) })
|
|
2721
|
+
]
|
|
2722
|
+
}
|
|
2723
|
+
),
|
|
2724
|
+
/* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(
|
|
2725
|
+
Select$1.Positioner,
|
|
2726
|
+
{
|
|
2727
|
+
side,
|
|
2728
|
+
align,
|
|
2729
|
+
sideOffset,
|
|
2730
|
+
alignItemWithTrigger,
|
|
2731
|
+
children: /* @__PURE__ */ jsxs(Select$1.Popup, { className: cx(sc("select-popup"), popupClassName), children: [
|
|
2732
|
+
/* @__PURE__ */ jsx(
|
|
2733
|
+
Select$1.ScrollUpArrow,
|
|
2734
|
+
{
|
|
2735
|
+
className: cx(sc("select-scroll-arrow")),
|
|
2736
|
+
"data-direction": "up",
|
|
2737
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, {})
|
|
2738
|
+
}
|
|
2739
|
+
),
|
|
2740
|
+
/* @__PURE__ */ jsx(Select$1.List, { children: children ?? autoItems }),
|
|
2741
|
+
/* @__PURE__ */ jsx(
|
|
2742
|
+
Select$1.ScrollDownArrow,
|
|
2743
|
+
{
|
|
2744
|
+
className: cx(sc("select-scroll-arrow")),
|
|
2745
|
+
"data-direction": "down",
|
|
2746
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
2747
|
+
}
|
|
2748
|
+
)
|
|
2749
|
+
] })
|
|
2750
|
+
}
|
|
2751
|
+
) })
|
|
2752
|
+
]
|
|
2753
|
+
}
|
|
2754
|
+
);
|
|
2755
|
+
}
|
|
2756
|
+
var ChevronDownIcon2 = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
2757
|
+
var CheckIcon2 = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
2758
|
+
var XIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.25", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12", strokeLinecap: "round" }) });
|
|
2759
|
+
function defaultLabel(item) {
|
|
2760
|
+
if (item != null && typeof item === "object" && "label" in item) {
|
|
2761
|
+
return item.label;
|
|
2762
|
+
}
|
|
2763
|
+
return String(item);
|
|
2764
|
+
}
|
|
2765
|
+
function ComboboxItem({
|
|
2766
|
+
className,
|
|
2767
|
+
children,
|
|
2768
|
+
indicator = true,
|
|
2769
|
+
...rest
|
|
2770
|
+
}) {
|
|
2771
|
+
const sc = useSilicaClass();
|
|
2772
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Item, { className: cx(sc("select-item"), className), ...rest, children: [
|
|
2773
|
+
indicator && /* @__PURE__ */ jsx(Combobox$1.ItemIndicator, { className: cx(sc("select-item-indicator")), children: /* @__PURE__ */ jsx(CheckIcon2, {}) }),
|
|
2774
|
+
children
|
|
2775
|
+
] });
|
|
2776
|
+
}
|
|
2777
|
+
function Combobox({
|
|
2778
|
+
items,
|
|
2779
|
+
value,
|
|
2780
|
+
defaultValue,
|
|
2781
|
+
onValueChange,
|
|
2782
|
+
name,
|
|
2783
|
+
disabled,
|
|
2784
|
+
required,
|
|
2785
|
+
placeholder,
|
|
2786
|
+
emptyMessage = "No results.",
|
|
2787
|
+
color,
|
|
2788
|
+
size = "md",
|
|
2789
|
+
clearable = true,
|
|
2790
|
+
side = "bottom",
|
|
2791
|
+
align = "start",
|
|
2792
|
+
sideOffset = 6,
|
|
2793
|
+
className,
|
|
2794
|
+
popupClassName,
|
|
2795
|
+
itemToStringLabel,
|
|
2796
|
+
renderItem,
|
|
2797
|
+
id,
|
|
2798
|
+
...aria
|
|
2799
|
+
}) {
|
|
2800
|
+
const sc = useSilicaClass();
|
|
2801
|
+
return /* @__PURE__ */ jsxs(
|
|
2802
|
+
Combobox$1.Root,
|
|
2803
|
+
{
|
|
2804
|
+
items,
|
|
2805
|
+
value,
|
|
2806
|
+
defaultValue,
|
|
2807
|
+
onValueChange,
|
|
2808
|
+
name,
|
|
2809
|
+
disabled,
|
|
2810
|
+
required,
|
|
2811
|
+
itemToStringLabel,
|
|
2812
|
+
children: [
|
|
2813
|
+
/* @__PURE__ */ jsxs("div", { className: cx(sc("combobox-control")), children: [
|
|
2814
|
+
/* @__PURE__ */ jsx(
|
|
2815
|
+
Combobox$1.Input,
|
|
2816
|
+
{
|
|
2817
|
+
id,
|
|
2818
|
+
placeholder,
|
|
2819
|
+
className: cx(
|
|
2820
|
+
sc("input"),
|
|
2821
|
+
color && sc(`input-${color}`),
|
|
2822
|
+
size !== "md" && sc(`input-${size}`),
|
|
2823
|
+
sc("combobox-input"),
|
|
2824
|
+
className
|
|
2825
|
+
),
|
|
2826
|
+
...aria
|
|
2827
|
+
}
|
|
2828
|
+
),
|
|
2829
|
+
clearable && /* @__PURE__ */ jsx(
|
|
2830
|
+
Combobox$1.Clear,
|
|
2831
|
+
{
|
|
2832
|
+
className: cx(sc("combobox-clear")),
|
|
2833
|
+
"aria-label": "Clear",
|
|
2834
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
2835
|
+
}
|
|
2836
|
+
),
|
|
2837
|
+
/* @__PURE__ */ jsx(
|
|
2838
|
+
Combobox$1.Trigger,
|
|
2839
|
+
{
|
|
2840
|
+
className: cx(sc("combobox-trigger")),
|
|
2841
|
+
"aria-label": "Open",
|
|
2842
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon2, {})
|
|
2843
|
+
}
|
|
2844
|
+
)
|
|
2845
|
+
] }),
|
|
2846
|
+
/* @__PURE__ */ jsx(Combobox$1.Portal, { children: /* @__PURE__ */ jsx(Combobox$1.Positioner, { side, align, sideOffset, children: /* @__PURE__ */ jsxs(Combobox$1.Popup, { className: cx(sc("select-popup"), popupClassName), children: [
|
|
2847
|
+
/* @__PURE__ */ jsx(Combobox$1.Empty, { className: cx(sc("combobox-empty")), children: emptyMessage }),
|
|
2848
|
+
/* @__PURE__ */ jsx(Combobox$1.List, { children: (item, index) => renderItem ? renderItem(item, index) : /* @__PURE__ */ jsx(ComboboxItem, { value: item, children: defaultLabel(item) }, index) })
|
|
2849
|
+
] }) }) })
|
|
2850
|
+
]
|
|
2851
|
+
}
|
|
2852
|
+
);
|
|
2853
|
+
}
|
|
2854
|
+
var XIcon2 = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.25", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12", strokeLinecap: "round" }) });
|
|
2855
|
+
function AutocompleteItem({
|
|
2856
|
+
className,
|
|
2857
|
+
children,
|
|
2858
|
+
...rest
|
|
2859
|
+
}) {
|
|
2860
|
+
const sc = useSilicaClass();
|
|
2861
|
+
return /* @__PURE__ */ jsx(
|
|
2862
|
+
Autocomplete$1.Item,
|
|
2863
|
+
{
|
|
2864
|
+
className: cx(sc("select-item"), sc("combobox-item"), className),
|
|
2865
|
+
...rest,
|
|
2866
|
+
children
|
|
2867
|
+
}
|
|
2868
|
+
);
|
|
2869
|
+
}
|
|
2870
|
+
function Autocomplete({
|
|
2871
|
+
items,
|
|
2872
|
+
value,
|
|
2873
|
+
defaultValue,
|
|
2874
|
+
onValueChange,
|
|
2875
|
+
mode = "list",
|
|
2876
|
+
name,
|
|
2877
|
+
disabled,
|
|
2878
|
+
required,
|
|
2879
|
+
placeholder,
|
|
2880
|
+
emptyMessage = "No results.",
|
|
2881
|
+
color,
|
|
2882
|
+
size = "md",
|
|
2883
|
+
clearable = true,
|
|
2884
|
+
side = "bottom",
|
|
2885
|
+
align = "start",
|
|
2886
|
+
sideOffset = 6,
|
|
2887
|
+
className,
|
|
2888
|
+
popupClassName,
|
|
2889
|
+
renderItem,
|
|
2890
|
+
id,
|
|
2891
|
+
...aria
|
|
2892
|
+
}) {
|
|
2893
|
+
const sc = useSilicaClass();
|
|
2894
|
+
return /* @__PURE__ */ jsxs(
|
|
2895
|
+
Autocomplete$1.Root,
|
|
2896
|
+
{
|
|
2897
|
+
items,
|
|
2898
|
+
value,
|
|
2899
|
+
defaultValue,
|
|
2900
|
+
onValueChange,
|
|
2901
|
+
mode,
|
|
2902
|
+
name,
|
|
2903
|
+
disabled,
|
|
2904
|
+
required,
|
|
2905
|
+
children: [
|
|
2906
|
+
/* @__PURE__ */ jsxs("div", { className: cx(sc("combobox-control")), children: [
|
|
2907
|
+
/* @__PURE__ */ jsx(
|
|
2908
|
+
Autocomplete$1.Input,
|
|
2909
|
+
{
|
|
2910
|
+
id,
|
|
2911
|
+
placeholder,
|
|
2912
|
+
className: cx(
|
|
2913
|
+
sc("input"),
|
|
2914
|
+
color && sc(`input-${color}`),
|
|
2915
|
+
size !== "md" && sc(`input-${size}`),
|
|
2916
|
+
sc("combobox-input"),
|
|
2917
|
+
className
|
|
2918
|
+
),
|
|
2919
|
+
...aria
|
|
2920
|
+
}
|
|
2921
|
+
),
|
|
2922
|
+
clearable && /* @__PURE__ */ jsx(
|
|
2923
|
+
Autocomplete$1.Clear,
|
|
2924
|
+
{
|
|
2925
|
+
className: cx(sc("combobox-clear")),
|
|
2926
|
+
"aria-label": "Clear",
|
|
2927
|
+
children: /* @__PURE__ */ jsx(XIcon2, {})
|
|
2928
|
+
}
|
|
2929
|
+
)
|
|
2930
|
+
] }),
|
|
2931
|
+
/* @__PURE__ */ jsx(Autocomplete$1.Portal, { children: /* @__PURE__ */ jsx(
|
|
2932
|
+
Autocomplete$1.Positioner,
|
|
2933
|
+
{
|
|
2934
|
+
side,
|
|
2935
|
+
align,
|
|
2936
|
+
sideOffset,
|
|
2937
|
+
children: /* @__PURE__ */ jsxs(Autocomplete$1.Popup, { className: cx(sc("select-popup"), popupClassName), children: [
|
|
2938
|
+
/* @__PURE__ */ jsx(Autocomplete$1.Empty, { className: cx(sc("combobox-empty")), children: emptyMessage }),
|
|
2939
|
+
/* @__PURE__ */ jsx(Autocomplete$1.List, { children: (item, index) => renderItem ? renderItem(item, index) : /* @__PURE__ */ jsx(AutocompleteItem, { value: item, children: item }, index) })
|
|
2940
|
+
] })
|
|
2941
|
+
}
|
|
2942
|
+
) })
|
|
2943
|
+
]
|
|
2944
|
+
}
|
|
2945
|
+
);
|
|
2946
|
+
}
|
|
2947
|
+
var REF_SUNDAY = new Date(2023, 0, 1);
|
|
2948
|
+
function startOfDay(d) {
|
|
2949
|
+
const x = new Date(d);
|
|
2950
|
+
x.setHours(0, 0, 0, 0);
|
|
2951
|
+
return x;
|
|
2952
|
+
}
|
|
2953
|
+
function startOfMonth(d) {
|
|
2954
|
+
const x = startOfDay(d);
|
|
2955
|
+
x.setDate(1);
|
|
2956
|
+
return x;
|
|
2957
|
+
}
|
|
2958
|
+
function addDays(d, n) {
|
|
2959
|
+
const x = new Date(d);
|
|
2960
|
+
x.setDate(x.getDate() + n);
|
|
2961
|
+
return x;
|
|
2962
|
+
}
|
|
2963
|
+
function addMonths(d, n) {
|
|
2964
|
+
const x = startOfMonth(d);
|
|
2965
|
+
x.setMonth(x.getMonth() + n);
|
|
2966
|
+
return x;
|
|
2967
|
+
}
|
|
2968
|
+
function isSameDay(a, b) {
|
|
2969
|
+
return !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
2970
|
+
}
|
|
2971
|
+
function isSameMonth(a, b) {
|
|
2972
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();
|
|
2973
|
+
}
|
|
2974
|
+
function compareDay(a, b) {
|
|
2975
|
+
const x = startOfDay(a).getTime();
|
|
2976
|
+
const y = startOfDay(b).getTime();
|
|
2977
|
+
return x < y ? -1 : x > y ? 1 : 0;
|
|
2978
|
+
}
|
|
2979
|
+
function clampDay(d, min, max) {
|
|
2980
|
+
if (min && compareDay(d, min) < 0) return startOfDay(min);
|
|
2981
|
+
if (max && compareDay(d, max) > 0) return startOfDay(max);
|
|
2982
|
+
return startOfDay(d);
|
|
2983
|
+
}
|
|
2984
|
+
function isoDate(d) {
|
|
2985
|
+
const p = (n) => String(n).padStart(2, "0");
|
|
2986
|
+
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}`;
|
|
2987
|
+
}
|
|
2988
|
+
function asRange(v) {
|
|
2989
|
+
if (v && v instanceof Date) return { start: v, end: null };
|
|
2990
|
+
if (v && typeof v === "object") return v;
|
|
2991
|
+
return { start: null, end: null };
|
|
2992
|
+
}
|
|
2993
|
+
function orderedRange(a, b) {
|
|
2994
|
+
return compareDay(a, b) <= 0 ? { start: a, end: b } : { start: b, end: a };
|
|
2995
|
+
}
|
|
2996
|
+
var ChevronLeftIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m15 18-6-6 6-6", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
2997
|
+
var ChevronRightIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
2998
|
+
function Calendar({
|
|
2999
|
+
mode = "single",
|
|
3000
|
+
value,
|
|
3001
|
+
defaultValue,
|
|
3002
|
+
onValueChange,
|
|
3003
|
+
month,
|
|
3004
|
+
defaultMonth,
|
|
3005
|
+
onMonthChange,
|
|
3006
|
+
numberOfMonths = 1,
|
|
3007
|
+
weekStartsOn = 0,
|
|
3008
|
+
min,
|
|
3009
|
+
max,
|
|
3010
|
+
isDateDisabled,
|
|
3011
|
+
locale,
|
|
3012
|
+
color,
|
|
3013
|
+
className,
|
|
3014
|
+
...aria
|
|
3015
|
+
}) {
|
|
3016
|
+
const sc = useSilicaClass();
|
|
3017
|
+
const rootRef = React74.useRef(null);
|
|
3018
|
+
const shouldFocusRef = React74.useRef(false);
|
|
3019
|
+
const today = React74.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
3020
|
+
const [internalValue, setInternalValue] = React74.useState(
|
|
3021
|
+
defaultValue ?? (mode === "range" ? { start: null, end: null } : null)
|
|
3022
|
+
);
|
|
3023
|
+
const current = value !== void 0 ? value : internalValue;
|
|
3024
|
+
const range2 = asRange(current);
|
|
3025
|
+
const initialMonth = defaultMonth ?? (range2.start ? startOfMonth(range2.start) : startOfMonth(today));
|
|
3026
|
+
const [internalMonth, setInternalMonth] = React74.useState(initialMonth);
|
|
3027
|
+
const viewMonth = month !== void 0 ? startOfMonth(month) : internalMonth;
|
|
3028
|
+
const setView = React74.useCallback(
|
|
3029
|
+
(m) => {
|
|
3030
|
+
const next = startOfMonth(m);
|
|
3031
|
+
if (month === void 0) setInternalMonth(next);
|
|
3032
|
+
onMonthChange?.(next);
|
|
3033
|
+
},
|
|
3034
|
+
[month, onMonthChange]
|
|
3035
|
+
);
|
|
3036
|
+
const [focusedDate, setFocusedDate] = React74.useState(
|
|
3037
|
+
() => clampDay(range2.start ?? today, min, max)
|
|
3038
|
+
);
|
|
3039
|
+
const [hoveredDate, setHoveredDate] = React74.useState(null);
|
|
3040
|
+
React74.useEffect(() => {
|
|
3041
|
+
if (!shouldFocusRef.current) return;
|
|
3042
|
+
shouldFocusRef.current = false;
|
|
3043
|
+
const el = rootRef.current?.querySelector(
|
|
3044
|
+
`[data-date="${isoDate(focusedDate)}"][data-in-month]`
|
|
3045
|
+
);
|
|
3046
|
+
el?.focus();
|
|
3047
|
+
}, [focusedDate]);
|
|
3048
|
+
const weekdayLabels = React74.useMemo(() => {
|
|
3049
|
+
const fmt = new Intl.DateTimeFormat(locale, { weekday: "short" });
|
|
3050
|
+
return Array.from(
|
|
3051
|
+
{ length: 7 },
|
|
3052
|
+
(_, i) => fmt.format(addDays(REF_SUNDAY, (weekStartsOn + i) % 7)).slice(0, 2)
|
|
3053
|
+
);
|
|
3054
|
+
}, [locale, weekStartsOn]);
|
|
3055
|
+
const titleFmt = React74.useMemo(
|
|
3056
|
+
() => new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }),
|
|
3057
|
+
[locale]
|
|
3058
|
+
);
|
|
3059
|
+
function isDisabled(d) {
|
|
3060
|
+
if (min && compareDay(d, min) < 0) return true;
|
|
3061
|
+
if (max && compareDay(d, max) > 0) return true;
|
|
3062
|
+
return isDateDisabled?.(d) ?? false;
|
|
3063
|
+
}
|
|
3064
|
+
function commit(next) {
|
|
3065
|
+
if (value === void 0) setInternalValue(next);
|
|
3066
|
+
onValueChange?.(next);
|
|
3067
|
+
}
|
|
3068
|
+
function selectDay(d) {
|
|
3069
|
+
if (isDisabled(d)) return;
|
|
3070
|
+
const day = startOfDay(d);
|
|
3071
|
+
if (mode === "range") {
|
|
3072
|
+
const r = range2;
|
|
3073
|
+
if (!r.start || r.start && r.end) {
|
|
3074
|
+
commit({ start: day, end: null });
|
|
3075
|
+
} else {
|
|
3076
|
+
commit(orderedRange(r.start, day));
|
|
3077
|
+
}
|
|
3078
|
+
} else {
|
|
3079
|
+
commit(day);
|
|
3080
|
+
}
|
|
3081
|
+
setFocusedDate(day);
|
|
3082
|
+
if (!isSameMonth(day, viewMonth)) setView(day);
|
|
3083
|
+
}
|
|
3084
|
+
function moveFocus(next) {
|
|
3085
|
+
const clamped = clampDay(next, min, max);
|
|
3086
|
+
shouldFocusRef.current = true;
|
|
3087
|
+
setFocusedDate(clamped);
|
|
3088
|
+
const firstVisible = viewMonth;
|
|
3089
|
+
const lastVisible = addMonths(viewMonth, numberOfMonths - 1);
|
|
3090
|
+
if (compareDay(clamped, firstVisible) < 0) setView(clamped);
|
|
3091
|
+
else if (compareDay(clamped, addMonths(lastVisible, 1)) >= 0)
|
|
3092
|
+
setView(addMonths(clamped, -(numberOfMonths - 1)));
|
|
3093
|
+
}
|
|
3094
|
+
function shiftView(delta) {
|
|
3095
|
+
const nextView = addMonths(viewMonth, delta);
|
|
3096
|
+
setView(nextView);
|
|
3097
|
+
const dim = new Date(
|
|
3098
|
+
nextView.getFullYear(),
|
|
3099
|
+
nextView.getMonth() + 1,
|
|
3100
|
+
0
|
|
3101
|
+
).getDate();
|
|
3102
|
+
const target = new Date(
|
|
3103
|
+
nextView.getFullYear(),
|
|
3104
|
+
nextView.getMonth(),
|
|
3105
|
+
Math.min(focusedDate.getDate(), dim)
|
|
3106
|
+
);
|
|
3107
|
+
setFocusedDate(clampDay(target, min, max));
|
|
3108
|
+
}
|
|
3109
|
+
function onKeyDown(e) {
|
|
3110
|
+
const key = e.key;
|
|
3111
|
+
let next = null;
|
|
3112
|
+
if (key === "ArrowLeft") next = addDays(focusedDate, -1);
|
|
3113
|
+
else if (key === "ArrowRight") next = addDays(focusedDate, 1);
|
|
3114
|
+
else if (key === "ArrowUp") next = addDays(focusedDate, -7);
|
|
3115
|
+
else if (key === "ArrowDown") next = addDays(focusedDate, 7);
|
|
3116
|
+
else if (key === "PageUp") next = addMonths(focusedDate, -1);
|
|
3117
|
+
else if (key === "PageDown") next = addMonths(focusedDate, 1);
|
|
3118
|
+
else if (key === "Home") next = addDays(focusedDate, -((focusedDate.getDay() - weekStartsOn + 7) % 7));
|
|
3119
|
+
else if (key === "End") next = addDays(focusedDate, 6 - (focusedDate.getDay() - weekStartsOn + 7) % 7);
|
|
3120
|
+
else if (key === "Enter" || key === " ") {
|
|
3121
|
+
e.preventDefault();
|
|
3122
|
+
selectDay(focusedDate);
|
|
3123
|
+
return;
|
|
3124
|
+
} else {
|
|
3125
|
+
return;
|
|
3126
|
+
}
|
|
3127
|
+
e.preventDefault();
|
|
3128
|
+
moveFocus(next);
|
|
3129
|
+
}
|
|
3130
|
+
const paintRange = mode === "range" && range2.start && !range2.end && hoveredDate ? orderedRange(range2.start, hoveredDate) : range2;
|
|
3131
|
+
function renderMonth(offset) {
|
|
3132
|
+
const m = addMonths(viewMonth, offset);
|
|
3133
|
+
const first = startOfMonth(m);
|
|
3134
|
+
const lead = (first.getDay() - weekStartsOn + 7) % 7;
|
|
3135
|
+
const gridStart = addDays(first, -lead);
|
|
3136
|
+
const cells = Array.from({ length: 42 }, (_, i) => addDays(gridStart, i));
|
|
3137
|
+
const showPrev = offset === 0;
|
|
3138
|
+
const showNext = offset === numberOfMonths - 1;
|
|
3139
|
+
const prevDisabled = !!min && compareDay(startOfMonth(m), startOfMonth(min)) <= 0;
|
|
3140
|
+
const nextDisabled = !!max && compareDay(startOfMonth(m), startOfMonth(max)) >= 0;
|
|
3141
|
+
return /* @__PURE__ */ jsxs("div", { className: cx(sc("calendar-month")), children: [
|
|
3142
|
+
/* @__PURE__ */ jsxs("div", { className: cx(sc("calendar-header")), children: [
|
|
3143
|
+
showPrev ? /* @__PURE__ */ jsx(
|
|
3144
|
+
"button",
|
|
3145
|
+
{
|
|
3146
|
+
type: "button",
|
|
3147
|
+
className: cx(sc("calendar-nav")),
|
|
3148
|
+
"aria-label": "Previous month",
|
|
3149
|
+
disabled: prevDisabled,
|
|
3150
|
+
onClick: () => shiftView(-1),
|
|
3151
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
|
|
3152
|
+
}
|
|
3153
|
+
) : /* @__PURE__ */ jsx("span", { className: cx(sc("calendar-nav")), "aria-hidden": "true" }),
|
|
3154
|
+
/* @__PURE__ */ jsx("div", { className: cx(sc("calendar-title")), "aria-live": "polite", children: titleFmt.format(m) }),
|
|
3155
|
+
showNext ? /* @__PURE__ */ jsx(
|
|
3156
|
+
"button",
|
|
3157
|
+
{
|
|
3158
|
+
type: "button",
|
|
3159
|
+
className: cx(sc("calendar-nav")),
|
|
3160
|
+
"aria-label": "Next month",
|
|
3161
|
+
disabled: nextDisabled,
|
|
3162
|
+
onClick: () => shiftView(1),
|
|
3163
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
3164
|
+
}
|
|
3165
|
+
) : /* @__PURE__ */ jsx("span", { className: cx(sc("calendar-nav")), "aria-hidden": "true" })
|
|
3166
|
+
] }),
|
|
3167
|
+
/* @__PURE__ */ jsx("div", { className: cx(sc("calendar-weekdays")), "aria-hidden": "true", children: weekdayLabels.map((w, i) => /* @__PURE__ */ jsx("div", { className: cx(sc("calendar-weekday")), children: w }, i)) }),
|
|
3168
|
+
/* @__PURE__ */ jsx("div", { className: cx(sc("calendar-grid")), role: "grid", children: cells.map((cell) => {
|
|
3169
|
+
const inMonth = isSameMonth(cell, m);
|
|
3170
|
+
const disabled = isDisabled(cell);
|
|
3171
|
+
const selected = mode === "single" && isSameDay(cell, range2.start);
|
|
3172
|
+
const isStart = mode === "range" && isSameDay(cell, paintRange.start);
|
|
3173
|
+
const isEnd = mode === "range" && isSameDay(cell, paintRange.end);
|
|
3174
|
+
const inRange = mode === "range" && !!paintRange.start && !!paintRange.end && compareDay(cell, paintRange.start) > 0 && compareDay(cell, paintRange.end) < 0;
|
|
3175
|
+
const isFocused = isSameDay(cell, focusedDate);
|
|
3176
|
+
return /* @__PURE__ */ jsx(
|
|
3177
|
+
"button",
|
|
3178
|
+
{
|
|
3179
|
+
type: "button",
|
|
3180
|
+
className: cx(sc("calendar-day")),
|
|
3181
|
+
"data-date": isoDate(cell),
|
|
3182
|
+
"data-in-month": inMonth ? "" : void 0,
|
|
3183
|
+
"data-outside": !inMonth ? "" : void 0,
|
|
3184
|
+
"data-today": isSameDay(cell, today) ? "" : void 0,
|
|
3185
|
+
"data-selected": selected ? "" : void 0,
|
|
3186
|
+
"data-range-start": isStart ? "" : void 0,
|
|
3187
|
+
"data-range-end": isEnd ? "" : void 0,
|
|
3188
|
+
"data-in-range": inRange ? "" : void 0,
|
|
3189
|
+
"data-disabled": disabled ? "" : void 0,
|
|
3190
|
+
"aria-disabled": disabled || void 0,
|
|
3191
|
+
"aria-pressed": selected || isStart || isEnd || void 0,
|
|
3192
|
+
tabIndex: inMonth && isFocused ? 0 : -1,
|
|
3193
|
+
onClick: () => selectDay(cell),
|
|
3194
|
+
onMouseEnter: mode === "range" ? () => setHoveredDate(cell) : void 0,
|
|
3195
|
+
onFocus: () => setFocusedDate(startOfDay(cell)),
|
|
3196
|
+
children: cell.getDate()
|
|
3197
|
+
},
|
|
3198
|
+
isoDate(cell) + (inMonth ? "" : "-o")
|
|
3199
|
+
);
|
|
3200
|
+
}) })
|
|
3201
|
+
] }, offset);
|
|
3202
|
+
}
|
|
3203
|
+
return /* @__PURE__ */ jsx(
|
|
3204
|
+
"div",
|
|
3205
|
+
{
|
|
3206
|
+
ref: rootRef,
|
|
3207
|
+
className: cx(
|
|
3208
|
+
sc("calendar"),
|
|
3209
|
+
color && sc(`calendar-${color}`),
|
|
3210
|
+
className
|
|
3211
|
+
),
|
|
3212
|
+
onKeyDown,
|
|
3213
|
+
onMouseLeave: mode === "range" ? () => setHoveredDate(null) : void 0,
|
|
3214
|
+
...aria,
|
|
3215
|
+
children: /* @__PURE__ */ jsx("div", { className: cx(sc("calendar-months")), children: Array.from(
|
|
3216
|
+
{ length: Math.max(1, numberOfMonths) },
|
|
3217
|
+
(_, i) => renderMonth(i)
|
|
3218
|
+
) })
|
|
3219
|
+
}
|
|
3220
|
+
);
|
|
3221
|
+
}
|
|
3222
|
+
var CalendarIcon = () => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: [
|
|
3223
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
3224
|
+
/* @__PURE__ */ jsx("path", { d: "M16 2v4M8 2v4M3 10h18", strokeLinecap: "round" })
|
|
3225
|
+
] });
|
|
3226
|
+
function DateTrigger({
|
|
3227
|
+
color,
|
|
3228
|
+
size = "md",
|
|
3229
|
+
disabled,
|
|
3230
|
+
placeholder,
|
|
3231
|
+
label,
|
|
3232
|
+
className,
|
|
3233
|
+
id,
|
|
3234
|
+
ariaLabel
|
|
3235
|
+
}) {
|
|
3236
|
+
const sc = useSilicaClass();
|
|
3237
|
+
return /* @__PURE__ */ jsxs(
|
|
3238
|
+
Popover$1.Trigger,
|
|
3239
|
+
{
|
|
3240
|
+
id,
|
|
3241
|
+
disabled,
|
|
3242
|
+
"aria-label": ariaLabel,
|
|
3243
|
+
"data-placeholder": label == null ? "" : void 0,
|
|
3244
|
+
className: cx(
|
|
3245
|
+
sc("input"),
|
|
3246
|
+
color && sc(`input-${color}`),
|
|
3247
|
+
size !== "md" && sc(`input-${size}`),
|
|
3248
|
+
sc("date-field"),
|
|
3249
|
+
className
|
|
3250
|
+
),
|
|
3251
|
+
children: [
|
|
3252
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("date-field-value")), children: label ?? placeholder }),
|
|
3253
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("date-field-icon")), children: /* @__PURE__ */ jsx(CalendarIcon, {}) })
|
|
3254
|
+
]
|
|
3255
|
+
}
|
|
3256
|
+
);
|
|
3257
|
+
}
|
|
3258
|
+
function DatePopup({
|
|
3259
|
+
side,
|
|
3260
|
+
align,
|
|
3261
|
+
sideOffset,
|
|
3262
|
+
popupClassName,
|
|
3263
|
+
children
|
|
3264
|
+
}) {
|
|
3265
|
+
const sc = useSilicaClass();
|
|
3266
|
+
return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, { side, align, sideOffset, children: /* @__PURE__ */ jsx(Popover$1.Popup, { className: cx(sc("calendar-popup"), popupClassName), children }) }) });
|
|
3267
|
+
}
|
|
3268
|
+
function DatePicker({
|
|
3269
|
+
value,
|
|
3270
|
+
defaultValue,
|
|
3271
|
+
onValueChange,
|
|
3272
|
+
placeholder = "Pick a date",
|
|
3273
|
+
disabled,
|
|
3274
|
+
weekStartsOn,
|
|
3275
|
+
min,
|
|
3276
|
+
max,
|
|
3277
|
+
isDateDisabled,
|
|
3278
|
+
locale,
|
|
3279
|
+
formatOptions = { dateStyle: "medium" },
|
|
3280
|
+
color,
|
|
3281
|
+
size,
|
|
3282
|
+
side = "bottom",
|
|
3283
|
+
align = "start",
|
|
3284
|
+
sideOffset = 6,
|
|
3285
|
+
className,
|
|
3286
|
+
popupClassName,
|
|
3287
|
+
id,
|
|
3288
|
+
"aria-label": ariaLabel
|
|
3289
|
+
}) {
|
|
3290
|
+
const [open, setOpen] = React74.useState(false);
|
|
3291
|
+
const [internal, setInternal] = React74.useState(
|
|
3292
|
+
defaultValue ?? null
|
|
3293
|
+
);
|
|
3294
|
+
const current = value !== void 0 ? value : internal;
|
|
3295
|
+
const fmt = React74.useMemo(
|
|
3296
|
+
() => new Intl.DateTimeFormat(locale, formatOptions),
|
|
3297
|
+
[locale, formatOptions]
|
|
3298
|
+
);
|
|
3299
|
+
const label = current ? fmt.format(current) : null;
|
|
3300
|
+
function handleChange(v) {
|
|
3301
|
+
const date = v ?? null;
|
|
3302
|
+
if (value === void 0) setInternal(date);
|
|
3303
|
+
onValueChange?.(date);
|
|
3304
|
+
setOpen(false);
|
|
3305
|
+
}
|
|
3306
|
+
return /* @__PURE__ */ jsxs(Popover$1.Root, { open, onOpenChange: setOpen, children: [
|
|
3307
|
+
/* @__PURE__ */ jsx(
|
|
3308
|
+
DateTrigger,
|
|
3309
|
+
{
|
|
3310
|
+
color,
|
|
3311
|
+
size,
|
|
3312
|
+
disabled,
|
|
3313
|
+
placeholder,
|
|
3314
|
+
label,
|
|
3315
|
+
className,
|
|
3316
|
+
id,
|
|
3317
|
+
ariaLabel
|
|
3318
|
+
}
|
|
3319
|
+
),
|
|
3320
|
+
/* @__PURE__ */ jsx(
|
|
3321
|
+
DatePopup,
|
|
3322
|
+
{
|
|
3323
|
+
side,
|
|
3324
|
+
align,
|
|
3325
|
+
sideOffset,
|
|
3326
|
+
popupClassName,
|
|
3327
|
+
children: /* @__PURE__ */ jsx(
|
|
3328
|
+
Calendar,
|
|
3329
|
+
{
|
|
3330
|
+
mode: "single",
|
|
3331
|
+
value: current,
|
|
3332
|
+
onValueChange: handleChange,
|
|
3333
|
+
weekStartsOn,
|
|
3334
|
+
min,
|
|
3335
|
+
max,
|
|
3336
|
+
isDateDisabled,
|
|
3337
|
+
locale,
|
|
3338
|
+
color
|
|
3339
|
+
}
|
|
3340
|
+
)
|
|
3341
|
+
}
|
|
3342
|
+
)
|
|
3343
|
+
] });
|
|
3344
|
+
}
|
|
3345
|
+
var EMPTY_RANGE = { start: null, end: null };
|
|
3346
|
+
function DateRangePicker({
|
|
3347
|
+
value,
|
|
3348
|
+
defaultValue,
|
|
3349
|
+
onValueChange,
|
|
3350
|
+
placeholder = "Pick a range",
|
|
3351
|
+
disabled,
|
|
3352
|
+
numberOfMonths = 2,
|
|
3353
|
+
weekStartsOn,
|
|
3354
|
+
min,
|
|
3355
|
+
max,
|
|
3356
|
+
isDateDisabled,
|
|
3357
|
+
locale,
|
|
3358
|
+
formatOptions = { dateStyle: "medium" },
|
|
3359
|
+
color,
|
|
3360
|
+
size,
|
|
3361
|
+
side = "bottom",
|
|
3362
|
+
align = "start",
|
|
3363
|
+
sideOffset = 6,
|
|
3364
|
+
className,
|
|
3365
|
+
popupClassName,
|
|
3366
|
+
id,
|
|
3367
|
+
"aria-label": ariaLabel
|
|
3368
|
+
}) {
|
|
3369
|
+
const [open, setOpen] = React74.useState(false);
|
|
3370
|
+
const [internal, setInternal] = React74.useState(
|
|
3371
|
+
defaultValue ?? EMPTY_RANGE
|
|
3372
|
+
);
|
|
3373
|
+
const current = value !== void 0 ? value : internal;
|
|
3374
|
+
const fmt = React74.useMemo(
|
|
3375
|
+
() => new Intl.DateTimeFormat(locale, formatOptions),
|
|
3376
|
+
[locale, formatOptions]
|
|
3377
|
+
);
|
|
3378
|
+
const label = current.start && current.end ? `${fmt.format(current.start)} \u2013 ${fmt.format(current.end)}` : current.start ? `${fmt.format(current.start)} \u2013 \u2026` : null;
|
|
3379
|
+
function handleChange(v) {
|
|
3380
|
+
const next = v ?? EMPTY_RANGE;
|
|
3381
|
+
if (value === void 0) setInternal(next);
|
|
3382
|
+
onValueChange?.(next);
|
|
3383
|
+
if (next.start && next.end) setOpen(false);
|
|
3384
|
+
}
|
|
3385
|
+
return /* @__PURE__ */ jsxs(Popover$1.Root, { open, onOpenChange: setOpen, children: [
|
|
3386
|
+
/* @__PURE__ */ jsx(
|
|
3387
|
+
DateTrigger,
|
|
3388
|
+
{
|
|
3389
|
+
color,
|
|
3390
|
+
size,
|
|
3391
|
+
disabled,
|
|
3392
|
+
placeholder,
|
|
3393
|
+
label,
|
|
3394
|
+
className,
|
|
3395
|
+
id,
|
|
3396
|
+
ariaLabel
|
|
3397
|
+
}
|
|
3398
|
+
),
|
|
3399
|
+
/* @__PURE__ */ jsx(
|
|
3400
|
+
DatePopup,
|
|
3401
|
+
{
|
|
3402
|
+
side,
|
|
3403
|
+
align,
|
|
3404
|
+
sideOffset,
|
|
3405
|
+
popupClassName,
|
|
3406
|
+
children: /* @__PURE__ */ jsx(
|
|
3407
|
+
Calendar,
|
|
3408
|
+
{
|
|
3409
|
+
mode: "range",
|
|
3410
|
+
numberOfMonths,
|
|
3411
|
+
value: current,
|
|
3412
|
+
onValueChange: handleChange,
|
|
3413
|
+
weekStartsOn,
|
|
3414
|
+
min,
|
|
3415
|
+
max,
|
|
3416
|
+
isDateDisabled,
|
|
3417
|
+
locale,
|
|
3418
|
+
color
|
|
3419
|
+
}
|
|
3420
|
+
)
|
|
3421
|
+
}
|
|
3422
|
+
)
|
|
3423
|
+
] });
|
|
3424
|
+
}
|
|
3425
|
+
function Tooltip({
|
|
3426
|
+
content,
|
|
3427
|
+
children,
|
|
3428
|
+
side = "top",
|
|
3429
|
+
align = "center",
|
|
3430
|
+
sideOffset = 8,
|
|
3431
|
+
delay,
|
|
3432
|
+
closeDelay,
|
|
3433
|
+
open,
|
|
3434
|
+
defaultOpen,
|
|
3435
|
+
onOpenChange,
|
|
3436
|
+
disabled,
|
|
3437
|
+
arrow = true,
|
|
3438
|
+
className
|
|
3439
|
+
}) {
|
|
3440
|
+
const sc = useSilicaClass();
|
|
3441
|
+
return /* @__PURE__ */ jsxs(
|
|
3442
|
+
Tooltip$1.Root,
|
|
3443
|
+
{
|
|
3444
|
+
open,
|
|
3445
|
+
defaultOpen,
|
|
3446
|
+
onOpenChange,
|
|
3447
|
+
disabled,
|
|
3448
|
+
children: [
|
|
3449
|
+
/* @__PURE__ */ jsx(
|
|
3450
|
+
Tooltip$1.Trigger,
|
|
3451
|
+
{
|
|
3452
|
+
render: children,
|
|
3453
|
+
delay,
|
|
3454
|
+
closeDelay
|
|
3455
|
+
}
|
|
3456
|
+
),
|
|
3457
|
+
/* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, { side, align, sideOffset, children: /* @__PURE__ */ jsxs(Tooltip$1.Popup, { className: cx(sc("tooltip"), className), children: [
|
|
3458
|
+
arrow && /* @__PURE__ */ jsx(Tooltip$1.Arrow, { className: cx(sc("tooltip-arrow")) }),
|
|
3459
|
+
content
|
|
3460
|
+
] }) }) })
|
|
3461
|
+
]
|
|
3462
|
+
}
|
|
3463
|
+
);
|
|
3464
|
+
}
|
|
3465
|
+
function TooltipProvider(props) {
|
|
3466
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Provider, { ...props });
|
|
3467
|
+
}
|
|
3468
|
+
var asRender3 = (el) => el;
|
|
3469
|
+
var Dialog = Dialog$1.Root;
|
|
3470
|
+
function DialogTrigger({ children }) {
|
|
3471
|
+
return /* @__PURE__ */ jsx(Dialog$1.Trigger, { render: asRender3(children) });
|
|
3472
|
+
}
|
|
3473
|
+
function DialogClose({ children }) {
|
|
3474
|
+
return /* @__PURE__ */ jsx(Dialog$1.Close, { render: asRender3(children) });
|
|
3475
|
+
}
|
|
3476
|
+
function DialogContent({
|
|
3477
|
+
className,
|
|
3478
|
+
backdropClassName,
|
|
3479
|
+
children,
|
|
3480
|
+
...rest
|
|
3481
|
+
}) {
|
|
3482
|
+
const sc = useSilicaClass();
|
|
3483
|
+
return /* @__PURE__ */ jsxs(Dialog$1.Portal, { children: [
|
|
3484
|
+
/* @__PURE__ */ jsx(
|
|
3485
|
+
Dialog$1.Backdrop,
|
|
3486
|
+
{
|
|
3487
|
+
className: cx(sc("dialog-backdrop"), backdropClassName)
|
|
3488
|
+
}
|
|
3489
|
+
),
|
|
3490
|
+
/* @__PURE__ */ jsx(Dialog$1.Popup, { className: cx(sc("dialog-popup"), className), ...rest, children })
|
|
3491
|
+
] });
|
|
3492
|
+
}
|
|
3493
|
+
function DialogTitle({ className, ...rest }) {
|
|
3494
|
+
const sc = useSilicaClass();
|
|
3495
|
+
return /* @__PURE__ */ jsx(Dialog$1.Title, { className: cx(sc("dialog-title"), className), ...rest });
|
|
3496
|
+
}
|
|
3497
|
+
function DialogDescription({
|
|
3498
|
+
className,
|
|
3499
|
+
...rest
|
|
3500
|
+
}) {
|
|
3501
|
+
const sc = useSilicaClass();
|
|
3502
|
+
return /* @__PURE__ */ jsx(
|
|
3503
|
+
Dialog$1.Description,
|
|
3504
|
+
{
|
|
3505
|
+
className: cx(sc("dialog-description"), className),
|
|
3506
|
+
...rest
|
|
3507
|
+
}
|
|
3508
|
+
);
|
|
3509
|
+
}
|
|
3510
|
+
var asRender4 = (el) => el;
|
|
3511
|
+
var Popover = Popover$1.Root;
|
|
3512
|
+
function PopoverTrigger({ children }) {
|
|
3513
|
+
return /* @__PURE__ */ jsx(Popover$1.Trigger, { render: asRender4(children) });
|
|
3514
|
+
}
|
|
3515
|
+
function PopoverClose({ children }) {
|
|
3516
|
+
return /* @__PURE__ */ jsx(Popover$1.Close, { render: asRender4(children) });
|
|
3517
|
+
}
|
|
3518
|
+
function PopoverContent({
|
|
3519
|
+
className,
|
|
3520
|
+
children,
|
|
3521
|
+
side = "bottom",
|
|
3522
|
+
align = "center",
|
|
3523
|
+
sideOffset = 8,
|
|
3524
|
+
arrow = false,
|
|
3525
|
+
...rest
|
|
3526
|
+
}) {
|
|
3527
|
+
const sc = useSilicaClass();
|
|
3528
|
+
return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, { side, align, sideOffset, children: /* @__PURE__ */ jsxs(Popover$1.Popup, { className: cx(sc("popover"), className), ...rest, children: [
|
|
3529
|
+
arrow && /* @__PURE__ */ jsx(Popover$1.Arrow, { className: cx(sc("popover-arrow")) }),
|
|
3530
|
+
children
|
|
3531
|
+
] }) }) });
|
|
3532
|
+
}
|
|
3533
|
+
function PopoverTitle({ className, ...rest }) {
|
|
3534
|
+
const sc = useSilicaClass();
|
|
3535
|
+
return /* @__PURE__ */ jsx(Popover$1.Title, { className: cx(sc("popover-title"), className), ...rest });
|
|
3536
|
+
}
|
|
3537
|
+
function PopoverDescription({
|
|
3538
|
+
className,
|
|
3539
|
+
...rest
|
|
3540
|
+
}) {
|
|
3541
|
+
const sc = useSilicaClass();
|
|
3542
|
+
return /* @__PURE__ */ jsx(
|
|
3543
|
+
Popover$1.Description,
|
|
3544
|
+
{
|
|
3545
|
+
className: cx(sc("popover-description"), className),
|
|
3546
|
+
...rest
|
|
3547
|
+
}
|
|
3548
|
+
);
|
|
3549
|
+
}
|
|
3550
|
+
var asRender5 = (el) => el;
|
|
3551
|
+
var DropdownMenu = Menu$1.Root;
|
|
3552
|
+
function DropdownMenuTrigger({ children }) {
|
|
3553
|
+
return /* @__PURE__ */ jsx(Menu$1.Trigger, { render: asRender5(children) });
|
|
3554
|
+
}
|
|
3555
|
+
function DropdownMenuContent({
|
|
3556
|
+
className,
|
|
3557
|
+
children,
|
|
3558
|
+
side = "bottom",
|
|
3559
|
+
align = "start",
|
|
3560
|
+
sideOffset = 6,
|
|
3561
|
+
...rest
|
|
3562
|
+
}) {
|
|
3563
|
+
const sc = useSilicaClass();
|
|
3564
|
+
return /* @__PURE__ */ jsx(Menu$1.Portal, { children: /* @__PURE__ */ jsx(Menu$1.Positioner, { side, align, sideOffset, children: /* @__PURE__ */ jsx(Menu$1.Popup, { className: cx(sc("dropdown"), className), ...rest, children }) }) });
|
|
3565
|
+
}
|
|
3566
|
+
function DropdownMenuItem({ className, ...rest }) {
|
|
3567
|
+
const sc = useSilicaClass();
|
|
3568
|
+
return /* @__PURE__ */ jsx(Menu$1.Item, { className: cx(sc("dropdown-item"), className), ...rest });
|
|
3569
|
+
}
|
|
3570
|
+
function DropdownMenuSeparator({
|
|
3571
|
+
className,
|
|
3572
|
+
...rest
|
|
3573
|
+
}) {
|
|
3574
|
+
const sc = useSilicaClass();
|
|
3575
|
+
return /* @__PURE__ */ jsx(
|
|
3576
|
+
Menu$1.Separator,
|
|
3577
|
+
{
|
|
3578
|
+
className: cx(sc("dropdown-separator"), className),
|
|
3579
|
+
...rest
|
|
3580
|
+
}
|
|
3581
|
+
);
|
|
3582
|
+
}
|
|
3583
|
+
function DropdownMenuGroup(props) {
|
|
3584
|
+
return /* @__PURE__ */ jsx(Menu$1.Group, { ...props });
|
|
3585
|
+
}
|
|
3586
|
+
function DropdownMenuLabel({
|
|
3587
|
+
className,
|
|
3588
|
+
...rest
|
|
3589
|
+
}) {
|
|
3590
|
+
const sc = useSilicaClass();
|
|
3591
|
+
return /* @__PURE__ */ jsx(Menu$1.GroupLabel, { className: cx(sc("dropdown-label"), className), ...rest });
|
|
3592
|
+
}
|
|
3593
|
+
function Tabs({ variant = "underline", color, className, ...rest }) {
|
|
3594
|
+
const sc = useSilicaClass();
|
|
3595
|
+
return /* @__PURE__ */ jsx(
|
|
3596
|
+
Tabs$1.Root,
|
|
3597
|
+
{
|
|
3598
|
+
className: cx(
|
|
3599
|
+
sc("tabs"),
|
|
3600
|
+
variant !== "underline" && sc(`tabs-${variant}`),
|
|
3601
|
+
color && sc(`tabs-${color}`),
|
|
3602
|
+
className
|
|
3603
|
+
),
|
|
3604
|
+
...rest
|
|
3605
|
+
}
|
|
3606
|
+
);
|
|
3607
|
+
}
|
|
3608
|
+
function TabsList({ className, children, indicator = true, ...rest }) {
|
|
3609
|
+
const sc = useSilicaClass();
|
|
3610
|
+
return /* @__PURE__ */ jsxs(Tabs$1.List, { className: cx(sc("tabs-list"), className), ...rest, children: [
|
|
3611
|
+
children,
|
|
3612
|
+
indicator && /* @__PURE__ */ jsx(Tabs$1.Indicator, { className: cx(sc("tabs-indicator")) })
|
|
3613
|
+
] });
|
|
3614
|
+
}
|
|
3615
|
+
function TabsTab({ className, ...rest }) {
|
|
3616
|
+
const sc = useSilicaClass();
|
|
3617
|
+
return /* @__PURE__ */ jsx(Tabs$1.Tab, { className: cx(sc("tabs-tab"), className), ...rest });
|
|
3618
|
+
}
|
|
3619
|
+
function TabsPanel({ className, ...rest }) {
|
|
3620
|
+
const sc = useSilicaClass();
|
|
3621
|
+
return /* @__PURE__ */ jsx(Tabs$1.Panel, { className: cx(sc("tabs-panel"), className), ...rest });
|
|
3622
|
+
}
|
|
3623
|
+
var Checkbox = React74.forwardRef(
|
|
3624
|
+
function Checkbox2({ color, size = "md", className, ...rest }, ref) {
|
|
3625
|
+
const sc = useSilicaClass();
|
|
3626
|
+
const classes = cx(
|
|
3627
|
+
sc("checkbox"),
|
|
3628
|
+
color && sc(`checkbox-${color}`),
|
|
3629
|
+
size !== "md" && sc(`checkbox-${size}`),
|
|
3630
|
+
className
|
|
3631
|
+
);
|
|
3632
|
+
return /* @__PURE__ */ jsx("input", { ref, type: "checkbox", className: classes, ...rest });
|
|
3633
|
+
}
|
|
3634
|
+
);
|
|
3635
|
+
var Radio = React74.forwardRef(
|
|
3636
|
+
function Radio2({ color, size = "md", className, ...rest }, ref) {
|
|
3637
|
+
const sc = useSilicaClass();
|
|
3638
|
+
const classes = cx(
|
|
3639
|
+
sc("radio"),
|
|
3640
|
+
color && sc(`radio-${color}`),
|
|
3641
|
+
size !== "md" && sc(`radio-${size}`),
|
|
3642
|
+
className
|
|
3643
|
+
);
|
|
3644
|
+
return /* @__PURE__ */ jsx("input", { ref, type: "radio", className: classes, ...rest });
|
|
3645
|
+
}
|
|
3646
|
+
);
|
|
3647
|
+
var Toggle = React74.forwardRef(
|
|
3648
|
+
function Toggle2({ color, size = "md", className, ...rest }, ref) {
|
|
3649
|
+
const sc = useSilicaClass();
|
|
3650
|
+
const classes = cx(
|
|
3651
|
+
sc("toggle"),
|
|
3652
|
+
color && sc(`toggle-${color}`),
|
|
3653
|
+
size !== "md" && sc(`toggle-${size}`),
|
|
3654
|
+
className
|
|
3655
|
+
);
|
|
3656
|
+
return /* @__PURE__ */ jsx(
|
|
3657
|
+
"input",
|
|
3658
|
+
{
|
|
3659
|
+
ref,
|
|
3660
|
+
type: "checkbox",
|
|
3661
|
+
role: "switch",
|
|
3662
|
+
className: classes,
|
|
3663
|
+
...rest
|
|
3664
|
+
}
|
|
3665
|
+
);
|
|
3666
|
+
}
|
|
3667
|
+
);
|
|
3668
|
+
var TagInput = React74.forwardRef(
|
|
3669
|
+
function TagInput2({
|
|
3670
|
+
value,
|
|
3671
|
+
defaultValue,
|
|
3672
|
+
onValueChange,
|
|
3673
|
+
placeholder,
|
|
3674
|
+
disabled,
|
|
3675
|
+
color,
|
|
3676
|
+
size = "md",
|
|
3677
|
+
separators = ["Enter", ","],
|
|
3678
|
+
dedupe = true,
|
|
3679
|
+
max,
|
|
3680
|
+
addOnBlur = true,
|
|
3681
|
+
inputProps,
|
|
3682
|
+
className,
|
|
3683
|
+
...rest
|
|
3684
|
+
}, forwardedRef) {
|
|
3685
|
+
const sc = useSilicaClass();
|
|
3686
|
+
const isControlled = value !== void 0;
|
|
3687
|
+
const [uncontrolled, setUncontrolled] = React74.useState(
|
|
3688
|
+
defaultValue ?? []
|
|
3689
|
+
);
|
|
3690
|
+
const tags = isControlled ? value : uncontrolled;
|
|
3691
|
+
const [text, setText] = React74.useState("");
|
|
3692
|
+
const fieldRef = React74.useRef(null);
|
|
3693
|
+
const commit = (next) => {
|
|
3694
|
+
if (!isControlled) setUncontrolled(next);
|
|
3695
|
+
onValueChange?.(next);
|
|
3696
|
+
};
|
|
3697
|
+
const addTag = (raw) => {
|
|
3698
|
+
const t = raw.trim();
|
|
3699
|
+
if (!t) return;
|
|
3700
|
+
setText("");
|
|
3701
|
+
if (dedupe && tags.includes(t)) return;
|
|
3702
|
+
if (max != null && tags.length >= max) return;
|
|
3703
|
+
commit([...tags, t]);
|
|
3704
|
+
};
|
|
3705
|
+
const removeAt = (index) => {
|
|
3706
|
+
commit(tags.filter((_, i) => i !== index));
|
|
3707
|
+
};
|
|
3708
|
+
const handleKeyDown = (e) => {
|
|
3709
|
+
if (separators.includes(e.key)) {
|
|
3710
|
+
e.preventDefault();
|
|
3711
|
+
addTag(text);
|
|
3712
|
+
} else if (e.key === "Backspace" && text === "" && tags.length > 0) {
|
|
3713
|
+
removeAt(tags.length - 1);
|
|
3714
|
+
}
|
|
3715
|
+
inputProps?.onKeyDown?.(e);
|
|
3716
|
+
};
|
|
3717
|
+
return /* @__PURE__ */ jsxs(
|
|
3718
|
+
"div",
|
|
3719
|
+
{
|
|
3720
|
+
ref: forwardedRef,
|
|
3721
|
+
className: cx(
|
|
3722
|
+
sc("tag-input"),
|
|
3723
|
+
color && sc(`tag-input-${color}`),
|
|
3724
|
+
size !== "md" && sc(`tag-input-${size}`),
|
|
3725
|
+
className
|
|
3726
|
+
),
|
|
3727
|
+
"data-disabled": disabled || void 0,
|
|
3728
|
+
onMouseDown: (e) => {
|
|
3729
|
+
if (e.target === e.currentTarget) {
|
|
3730
|
+
e.preventDefault();
|
|
3731
|
+
fieldRef.current?.focus();
|
|
3732
|
+
}
|
|
3733
|
+
},
|
|
3734
|
+
...rest,
|
|
3735
|
+
children: [
|
|
3736
|
+
tags.map((tag, i) => /* @__PURE__ */ jsxs("span", { className: cx(sc("tag-input-chip")), children: [
|
|
3737
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("tag-input-chip-label")), children: tag }),
|
|
3738
|
+
!disabled && /* @__PURE__ */ jsx(
|
|
3739
|
+
"button",
|
|
3740
|
+
{
|
|
3741
|
+
type: "button",
|
|
3742
|
+
className: cx(sc("tag-input-remove")),
|
|
3743
|
+
"aria-label": `Remove ${tag}`,
|
|
3744
|
+
onClick: (e) => {
|
|
3745
|
+
e.stopPropagation();
|
|
3746
|
+
removeAt(i);
|
|
3747
|
+
},
|
|
3748
|
+
children: /* @__PURE__ */ jsx(
|
|
3749
|
+
"svg",
|
|
3750
|
+
{
|
|
3751
|
+
viewBox: "0 0 24 24",
|
|
3752
|
+
fill: "none",
|
|
3753
|
+
stroke: "currentColor",
|
|
3754
|
+
strokeWidth: "2.5",
|
|
3755
|
+
strokeLinecap: "round",
|
|
3756
|
+
children: /* @__PURE__ */ jsx("path", { d: "M6 6l12 12M18 6L6 18" })
|
|
3757
|
+
}
|
|
3758
|
+
)
|
|
3759
|
+
}
|
|
3760
|
+
)
|
|
3761
|
+
] }, `${tag}-${i}`)),
|
|
3762
|
+
/* @__PURE__ */ jsx(
|
|
3763
|
+
"input",
|
|
3764
|
+
{
|
|
3765
|
+
ref: fieldRef,
|
|
3766
|
+
type: "text",
|
|
3767
|
+
className: cx(sc("tag-input-field")),
|
|
3768
|
+
value: text,
|
|
3769
|
+
placeholder: tags.length === 0 ? placeholder : void 0,
|
|
3770
|
+
disabled,
|
|
3771
|
+
...inputProps,
|
|
3772
|
+
onChange: (e) => {
|
|
3773
|
+
setText(e.target.value);
|
|
3774
|
+
inputProps?.onChange?.(e);
|
|
3775
|
+
},
|
|
3776
|
+
onKeyDown: handleKeyDown,
|
|
3777
|
+
onBlur: (e) => {
|
|
3778
|
+
if (addOnBlur) addTag(text);
|
|
3779
|
+
inputProps?.onBlur?.(e);
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
)
|
|
3783
|
+
]
|
|
3784
|
+
}
|
|
3785
|
+
);
|
|
3786
|
+
}
|
|
3787
|
+
);
|
|
3788
|
+
var EmptyState = React74.forwardRef(
|
|
3789
|
+
function EmptyState2({ icon, title, description, actions, size = "md", className, children, ...rest }, ref) {
|
|
3790
|
+
const sc = useSilicaClass();
|
|
3791
|
+
return /* @__PURE__ */ jsxs(
|
|
3792
|
+
"div",
|
|
3793
|
+
{
|
|
3794
|
+
ref,
|
|
3795
|
+
className: cx(
|
|
3796
|
+
sc("empty-state"),
|
|
3797
|
+
size === "sm" && sc("empty-state-sm"),
|
|
3798
|
+
className
|
|
3799
|
+
),
|
|
3800
|
+
...rest,
|
|
3801
|
+
children: [
|
|
3802
|
+
icon != null && /* @__PURE__ */ jsx("div", { className: cx(sc("empty-state-icon")), children: icon }),
|
|
3803
|
+
title != null && /* @__PURE__ */ jsx("div", { className: cx(sc("empty-state-title")), children: title }),
|
|
3804
|
+
description != null && /* @__PURE__ */ jsx("div", { className: cx(sc("empty-state-description")), children: description }),
|
|
3805
|
+
children,
|
|
3806
|
+
actions != null && /* @__PURE__ */ jsx("div", { className: cx(sc("empty-state-actions")), children: actions })
|
|
3807
|
+
]
|
|
3808
|
+
}
|
|
3809
|
+
);
|
|
3810
|
+
}
|
|
3811
|
+
);
|
|
3812
|
+
|
|
3813
|
+
// src/lib/oklch.ts
|
|
3814
|
+
var MAX_CHROMA = 0.37;
|
|
3815
|
+
var clamp01 = (x) => x < 0 ? 0 : x > 1 ? 1 : x;
|
|
3816
|
+
function gammaEncode(x) {
|
|
3817
|
+
return x <= 31308e-7 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055;
|
|
3818
|
+
}
|
|
3819
|
+
function gammaDecode(x) {
|
|
3820
|
+
return x <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
|
|
3821
|
+
}
|
|
3822
|
+
function oklchToLinear(l, c, h) {
|
|
3823
|
+
const hr = h * Math.PI / 180;
|
|
3824
|
+
const a = c * Math.cos(hr);
|
|
3825
|
+
const b = c * Math.sin(hr);
|
|
3826
|
+
const l_ = l + 0.3963377774 * a + 0.2158037573 * b;
|
|
3827
|
+
const m_ = l - 0.1055613458 * a - 0.0638541728 * b;
|
|
3828
|
+
const s_ = l - 0.0894841775 * a - 1.291485548 * b;
|
|
3829
|
+
const L = l_ * l_ * l_;
|
|
3830
|
+
const M = m_ * m_ * m_;
|
|
3831
|
+
const S = s_ * s_ * s_;
|
|
3832
|
+
return [
|
|
3833
|
+
4.0767416621 * L - 3.3077115913 * M + 0.2309699292 * S,
|
|
3834
|
+
-1.2684380046 * L + 2.6097574011 * M - 0.3413193965 * S,
|
|
3835
|
+
-0.0041960863 * L - 0.7034186147 * M + 1.707614701 * S
|
|
3836
|
+
];
|
|
3837
|
+
}
|
|
3838
|
+
function inGamut(l, c, h) {
|
|
3839
|
+
const [r, g, b] = oklchToLinear(l, c, h);
|
|
3840
|
+
const eps = 1e-4;
|
|
3841
|
+
return r >= -eps && r <= 1 + eps && g >= -eps && g <= 1 + eps && b >= -eps && b <= 1 + eps;
|
|
3842
|
+
}
|
|
3843
|
+
function oklchToRgb(l, c, h) {
|
|
3844
|
+
const [r, g, b] = oklchToLinear(l, c, h);
|
|
3845
|
+
return [
|
|
3846
|
+
Math.round(clamp01(gammaEncode(r)) * 255),
|
|
3847
|
+
Math.round(clamp01(gammaEncode(g)) * 255),
|
|
3848
|
+
Math.round(clamp01(gammaEncode(b)) * 255)
|
|
3849
|
+
];
|
|
3850
|
+
}
|
|
3851
|
+
function oklchToHex(l, c, h) {
|
|
3852
|
+
const [r, g, b] = oklchToRgb(l, c, h);
|
|
3853
|
+
const hex = (n) => n.toString(16).padStart(2, "0");
|
|
3854
|
+
return `#${hex(r)}${hex(g)}${hex(b)}`;
|
|
3855
|
+
}
|
|
3856
|
+
function hexToOklch(hex) {
|
|
3857
|
+
const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
|
|
3858
|
+
if (!m || !m[1]) return null;
|
|
3859
|
+
let s = m[1];
|
|
3860
|
+
if (s.length === 3) s = s.replace(/./g, (ch) => ch + ch);
|
|
3861
|
+
const rn = parseInt(s.slice(0, 2), 16) / 255;
|
|
3862
|
+
const gn = parseInt(s.slice(2, 4), 16) / 255;
|
|
3863
|
+
const bn = parseInt(s.slice(4, 6), 16) / 255;
|
|
3864
|
+
const r = gammaDecode(rn);
|
|
3865
|
+
const g = gammaDecode(gn);
|
|
3866
|
+
const b = gammaDecode(bn);
|
|
3867
|
+
const l = 0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b;
|
|
3868
|
+
const m2 = 0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b;
|
|
3869
|
+
const s2 = 0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b;
|
|
3870
|
+
const l_ = Math.cbrt(l);
|
|
3871
|
+
const m_ = Math.cbrt(m2);
|
|
3872
|
+
const s_ = Math.cbrt(s2);
|
|
3873
|
+
const L = 0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_;
|
|
3874
|
+
const a = 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_;
|
|
3875
|
+
const bb = 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_;
|
|
3876
|
+
const c = Math.sqrt(a * a + bb * bb);
|
|
3877
|
+
let hue = Math.atan2(bb, a) * 180 / Math.PI;
|
|
3878
|
+
if (hue < 0) hue += 360;
|
|
3879
|
+
return { l: L, c, h: hue };
|
|
3880
|
+
}
|
|
3881
|
+
function formatOklch(l, c, h) {
|
|
3882
|
+
const r3 = (n) => Math.round(n * 1e3) / 1e3;
|
|
3883
|
+
const r1 = (n) => Math.round(n * 10) / 10;
|
|
3884
|
+
return `oklch(${r3(l)} ${r3(c)} ${r1(h)})`;
|
|
3885
|
+
}
|
|
3886
|
+
function parseOklch(input) {
|
|
3887
|
+
const m = /oklch\(\s*([\d.]+%?)\s+([\d.]+%?)\s+([\d.]+)/i.exec(input);
|
|
3888
|
+
if (!m) return null;
|
|
3889
|
+
const [, ls, cs, hs] = m;
|
|
3890
|
+
if (ls === void 0 || cs === void 0 || hs === void 0) return null;
|
|
3891
|
+
const num = (s, scale) => s.endsWith("%") ? parseFloat(s) / 100 * scale : parseFloat(s);
|
|
3892
|
+
return { l: num(ls, 1), c: num(cs, 1), h: parseFloat(hs) };
|
|
3893
|
+
}
|
|
3894
|
+
var DEFAULT = { l: 0.7, c: 0.15, h: 250 };
|
|
3895
|
+
var clamp2 = (x, lo, hi) => x < lo ? lo : x > hi ? hi : x;
|
|
3896
|
+
function parseInput(s) {
|
|
3897
|
+
if (!s) return DEFAULT;
|
|
3898
|
+
return parseOklch(s) ?? hexToOklch(s) ?? DEFAULT;
|
|
3899
|
+
}
|
|
3900
|
+
function ColorSlider({
|
|
3901
|
+
label,
|
|
3902
|
+
valueText,
|
|
3903
|
+
min,
|
|
3904
|
+
max,
|
|
3905
|
+
step,
|
|
3906
|
+
value,
|
|
3907
|
+
trackStyle,
|
|
3908
|
+
disabled,
|
|
3909
|
+
onChange
|
|
3910
|
+
}) {
|
|
3911
|
+
const sc = useSilicaClass();
|
|
3912
|
+
const trackRef = React74.useRef(null);
|
|
3913
|
+
const pct = (value - min) / (max - min) * 100;
|
|
3914
|
+
const setFromClientX = (clientX) => {
|
|
3915
|
+
const el = trackRef.current;
|
|
3916
|
+
if (!el) return;
|
|
3917
|
+
const rect = el.getBoundingClientRect();
|
|
3918
|
+
const ratio = clamp2((clientX - rect.left) / rect.width, 0, 1);
|
|
3919
|
+
onChange(min + ratio * (max - min));
|
|
3920
|
+
};
|
|
3921
|
+
const onKeyDown = (e) => {
|
|
3922
|
+
const big = step * 10;
|
|
3923
|
+
let next = null;
|
|
3924
|
+
if (e.key === "ArrowLeft" || e.key === "ArrowDown") next = value - step;
|
|
3925
|
+
else if (e.key === "ArrowRight" || e.key === "ArrowUp") next = value + step;
|
|
3926
|
+
else if (e.key === "PageDown") next = value - big;
|
|
3927
|
+
else if (e.key === "PageUp") next = value + big;
|
|
3928
|
+
else if (e.key === "Home") next = min;
|
|
3929
|
+
else if (e.key === "End") next = max;
|
|
3930
|
+
if (next !== null) {
|
|
3931
|
+
e.preventDefault();
|
|
3932
|
+
onChange(clamp2(next, min, max));
|
|
3933
|
+
}
|
|
3934
|
+
};
|
|
3935
|
+
return /* @__PURE__ */ jsx(
|
|
3936
|
+
"div",
|
|
3937
|
+
{
|
|
3938
|
+
ref: trackRef,
|
|
3939
|
+
className: cx(sc("color-picker-track")),
|
|
3940
|
+
style: trackStyle,
|
|
3941
|
+
role: "slider",
|
|
3942
|
+
"aria-label": label,
|
|
3943
|
+
"aria-valuemin": min,
|
|
3944
|
+
"aria-valuemax": max,
|
|
3945
|
+
"aria-valuenow": value,
|
|
3946
|
+
"aria-valuetext": valueText,
|
|
3947
|
+
"aria-disabled": disabled || void 0,
|
|
3948
|
+
tabIndex: disabled ? -1 : 0,
|
|
3949
|
+
onKeyDown: disabled ? void 0 : onKeyDown,
|
|
3950
|
+
onPointerDown: (e) => {
|
|
3951
|
+
if (disabled) return;
|
|
3952
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
3953
|
+
setFromClientX(e.clientX);
|
|
3954
|
+
},
|
|
3955
|
+
onPointerMove: (e) => {
|
|
3956
|
+
if (disabled || !e.currentTarget.hasPointerCapture(e.pointerId)) return;
|
|
3957
|
+
setFromClientX(e.clientX);
|
|
3958
|
+
},
|
|
3959
|
+
children: /* @__PURE__ */ jsx(
|
|
3960
|
+
"span",
|
|
3961
|
+
{
|
|
3962
|
+
className: cx(sc("color-picker-thumb")),
|
|
3963
|
+
style: { left: `${pct}%` }
|
|
3964
|
+
}
|
|
3965
|
+
)
|
|
3966
|
+
}
|
|
3967
|
+
);
|
|
3968
|
+
}
|
|
3969
|
+
var ColorPicker = React74.forwardRef(
|
|
3970
|
+
function ColorPicker2({
|
|
3971
|
+
value,
|
|
3972
|
+
defaultValue,
|
|
3973
|
+
onValueChange,
|
|
3974
|
+
format = "oklch",
|
|
3975
|
+
showHex = true,
|
|
3976
|
+
disabled,
|
|
3977
|
+
className,
|
|
3978
|
+
...rest
|
|
3979
|
+
}, forwardedRef) {
|
|
3980
|
+
const sc = useSilicaClass();
|
|
3981
|
+
const isControlled = value !== void 0;
|
|
3982
|
+
const [internal, setInternal] = React74.useState(
|
|
3983
|
+
() => parseInput(value ?? defaultValue)
|
|
3984
|
+
);
|
|
3985
|
+
const [hexDraft, setHexDraft] = React74.useState(null);
|
|
3986
|
+
React74.useEffect(() => {
|
|
3987
|
+
if (isControlled) setInternal(parseInput(value));
|
|
3988
|
+
}, [value, isControlled]);
|
|
3989
|
+
const { l, c, h } = internal;
|
|
3990
|
+
const commit = (next) => {
|
|
3991
|
+
if (!isControlled) setInternal(next);
|
|
3992
|
+
const out = format === "hex" ? oklchToHex(next.l, next.c, next.h) : formatOklch(next.l, next.c, next.h);
|
|
3993
|
+
onValueChange?.(out, next);
|
|
3994
|
+
};
|
|
3995
|
+
const hex = oklchToHex(l, c, h);
|
|
3996
|
+
const hexValue = hexDraft ?? hex;
|
|
3997
|
+
const commitHex = () => {
|
|
3998
|
+
if (hexDraft !== null) {
|
|
3999
|
+
const parsed = hexToOklch(hexDraft);
|
|
4000
|
+
if (parsed) commit(parsed);
|
|
4001
|
+
setHexDraft(null);
|
|
4002
|
+
}
|
|
4003
|
+
};
|
|
4004
|
+
const lTrack = `linear-gradient(to right in oklch, oklch(0 ${c} ${h}), oklch(1 ${c} ${h}))`;
|
|
4005
|
+
const cTrack = `linear-gradient(to right in oklch, oklch(${l} 0 ${h}), oklch(${l} ${MAX_CHROMA} ${h}))`;
|
|
4006
|
+
const hTrack = `linear-gradient(to right in oklch, oklch(${l} ${c} 0), oklch(${l} ${c} 60), oklch(${l} ${c} 120), oklch(${l} ${c} 180), oklch(${l} ${c} 240), oklch(${l} ${c} 300), oklch(${l} ${c} 360))`;
|
|
4007
|
+
return /* @__PURE__ */ jsxs(
|
|
4008
|
+
"div",
|
|
4009
|
+
{
|
|
4010
|
+
ref: forwardedRef,
|
|
4011
|
+
className: cx(sc("color-picker"), className),
|
|
4012
|
+
"data-disabled": disabled || void 0,
|
|
4013
|
+
...rest,
|
|
4014
|
+
children: [
|
|
4015
|
+
/* @__PURE__ */ jsxs("div", { className: cx(sc("color-picker-preview")), children: [
|
|
4016
|
+
/* @__PURE__ */ jsx(
|
|
4017
|
+
"span",
|
|
4018
|
+
{
|
|
4019
|
+
className: cx(sc("color-picker-swatch")),
|
|
4020
|
+
style: { backgroundColor: `oklch(${l} ${c} ${h})` }
|
|
4021
|
+
}
|
|
4022
|
+
),
|
|
4023
|
+
/* @__PURE__ */ jsxs("div", { className: cx(sc("color-picker-values")), children: [
|
|
4024
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("color-picker-value-oklch")), children: formatOklch(l, c, h) }),
|
|
4025
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("color-picker-value-hex")), children: hex })
|
|
4026
|
+
] })
|
|
4027
|
+
] }),
|
|
4028
|
+
/* @__PURE__ */ jsxs("div", { className: cx(sc("color-picker-sliders")), children: [
|
|
4029
|
+
/* @__PURE__ */ jsxs("div", { className: cx(sc("color-picker-slider")), children: [
|
|
4030
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("color-picker-slider-label")), children: "L" }),
|
|
4031
|
+
/* @__PURE__ */ jsx(
|
|
4032
|
+
ColorSlider,
|
|
4033
|
+
{
|
|
4034
|
+
label: "Lightness",
|
|
4035
|
+
valueText: l.toFixed(2),
|
|
4036
|
+
min: 0,
|
|
4037
|
+
max: 1,
|
|
4038
|
+
step: 0.01,
|
|
4039
|
+
value: l,
|
|
4040
|
+
trackStyle: { background: lTrack },
|
|
4041
|
+
disabled,
|
|
4042
|
+
onChange: (v) => commit({ l: v, c, h })
|
|
4043
|
+
}
|
|
4044
|
+
),
|
|
4045
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("color-picker-slider-value")), children: l.toFixed(2) })
|
|
4046
|
+
] }),
|
|
4047
|
+
/* @__PURE__ */ jsxs("div", { className: cx(sc("color-picker-slider")), children: [
|
|
4048
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("color-picker-slider-label")), children: "C" }),
|
|
4049
|
+
/* @__PURE__ */ jsx(
|
|
4050
|
+
ColorSlider,
|
|
4051
|
+
{
|
|
4052
|
+
label: "Chroma",
|
|
4053
|
+
valueText: c.toFixed(3),
|
|
4054
|
+
min: 0,
|
|
4055
|
+
max: MAX_CHROMA,
|
|
4056
|
+
step: 5e-3,
|
|
4057
|
+
value: c,
|
|
4058
|
+
trackStyle: { background: cTrack },
|
|
4059
|
+
disabled,
|
|
4060
|
+
onChange: (v) => commit({ l, c: v, h })
|
|
4061
|
+
}
|
|
4062
|
+
),
|
|
4063
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("color-picker-slider-value")), children: c.toFixed(2) })
|
|
4064
|
+
] }),
|
|
4065
|
+
/* @__PURE__ */ jsxs("div", { className: cx(sc("color-picker-slider")), children: [
|
|
4066
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("color-picker-slider-label")), children: "H" }),
|
|
4067
|
+
/* @__PURE__ */ jsx(
|
|
4068
|
+
ColorSlider,
|
|
4069
|
+
{
|
|
4070
|
+
label: "Hue",
|
|
4071
|
+
valueText: `${Math.round(h)}\xB0`,
|
|
4072
|
+
min: 0,
|
|
4073
|
+
max: 360,
|
|
4074
|
+
step: 1,
|
|
4075
|
+
value: h,
|
|
4076
|
+
trackStyle: { background: hTrack },
|
|
4077
|
+
disabled,
|
|
4078
|
+
onChange: (v) => commit({ l, c, h: v })
|
|
4079
|
+
}
|
|
4080
|
+
),
|
|
4081
|
+
/* @__PURE__ */ jsxs("span", { className: cx(sc("color-picker-slider-value")), children: [
|
|
4082
|
+
Math.round(h),
|
|
4083
|
+
"\xB0"
|
|
4084
|
+
] })
|
|
4085
|
+
] })
|
|
4086
|
+
] }),
|
|
4087
|
+
showHex && /* @__PURE__ */ jsxs("div", { className: cx(sc("color-picker-hex")), children: [
|
|
4088
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("color-picker-hex-label")), children: "HEX" }),
|
|
4089
|
+
/* @__PURE__ */ jsx(
|
|
4090
|
+
"input",
|
|
4091
|
+
{
|
|
4092
|
+
type: "text",
|
|
4093
|
+
className: cx(sc("color-picker-hex-input")),
|
|
4094
|
+
value: hexValue,
|
|
4095
|
+
disabled,
|
|
4096
|
+
spellCheck: false,
|
|
4097
|
+
onChange: (e) => setHexDraft(e.target.value),
|
|
4098
|
+
onBlur: commitHex,
|
|
4099
|
+
onKeyDown: (e) => {
|
|
4100
|
+
if (e.key === "Enter") {
|
|
4101
|
+
e.preventDefault();
|
|
4102
|
+
commitHex();
|
|
4103
|
+
}
|
|
4104
|
+
}
|
|
4105
|
+
}
|
|
4106
|
+
)
|
|
4107
|
+
] })
|
|
4108
|
+
]
|
|
4109
|
+
}
|
|
4110
|
+
);
|
|
4111
|
+
}
|
|
4112
|
+
);
|
|
4113
|
+
var SearchIcon = /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
4114
|
+
/* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "7" }),
|
|
4115
|
+
/* @__PURE__ */ jsx("path", { d: "m21 21-4.3-4.3" })
|
|
4116
|
+
] });
|
|
4117
|
+
function CommandPalette({
|
|
4118
|
+
items,
|
|
4119
|
+
open,
|
|
4120
|
+
defaultOpen,
|
|
4121
|
+
onOpenChange,
|
|
4122
|
+
placeholder = "Type a command or search\u2026",
|
|
4123
|
+
emptyMessage = "No results found.",
|
|
4124
|
+
hotkey = true,
|
|
4125
|
+
className
|
|
4126
|
+
}) {
|
|
4127
|
+
const sc = useSilicaClass();
|
|
4128
|
+
const isControlled = open !== void 0;
|
|
4129
|
+
const [internalOpen, setInternalOpen] = React74.useState(defaultOpen ?? false);
|
|
4130
|
+
const isOpen = isControlled ? open : internalOpen;
|
|
4131
|
+
const [query, setQuery] = React74.useState("");
|
|
4132
|
+
const [activeIndex, setActiveIndex] = React74.useState(0);
|
|
4133
|
+
const listRef = React74.useRef(null);
|
|
4134
|
+
const setOpen = React74.useCallback(
|
|
4135
|
+
(next) => {
|
|
4136
|
+
if (!isControlled) setInternalOpen(next);
|
|
4137
|
+
onOpenChange?.(next);
|
|
4138
|
+
if (next) {
|
|
4139
|
+
setQuery("");
|
|
4140
|
+
setActiveIndex(0);
|
|
4141
|
+
}
|
|
4142
|
+
},
|
|
4143
|
+
[isControlled, onOpenChange]
|
|
4144
|
+
);
|
|
4145
|
+
React74.useEffect(() => {
|
|
4146
|
+
if (!hotkey) return;
|
|
4147
|
+
const key = (typeof hotkey === "string" ? hotkey : "k").toLowerCase();
|
|
4148
|
+
const onKey = (e) => {
|
|
4149
|
+
if (e.key.toLowerCase() === key && (e.metaKey || e.ctrlKey)) {
|
|
4150
|
+
e.preventDefault();
|
|
4151
|
+
setOpen(!isOpen);
|
|
4152
|
+
}
|
|
4153
|
+
};
|
|
4154
|
+
document.addEventListener("keydown", onKey);
|
|
4155
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
4156
|
+
}, [hotkey, isOpen, setOpen]);
|
|
4157
|
+
const filtered = React74.useMemo(() => {
|
|
4158
|
+
const q = query.trim().toLowerCase();
|
|
4159
|
+
if (!q) return items;
|
|
4160
|
+
return items.filter((it) => {
|
|
4161
|
+
const hay = [it.label, it.description, it.group, ...it.keywords ?? []].filter(Boolean).join(" ").toLowerCase();
|
|
4162
|
+
return hay.includes(q);
|
|
4163
|
+
});
|
|
4164
|
+
}, [items, query]);
|
|
4165
|
+
const groups = React74.useMemo(() => {
|
|
4166
|
+
const map = /* @__PURE__ */ new Map();
|
|
4167
|
+
filtered.forEach((item, index) => {
|
|
4168
|
+
const bucket = map.get(item.group);
|
|
4169
|
+
if (bucket) bucket.push({ item, index });
|
|
4170
|
+
else map.set(item.group, [{ item, index }]);
|
|
4171
|
+
});
|
|
4172
|
+
return [...map.entries()];
|
|
4173
|
+
}, [filtered]);
|
|
4174
|
+
React74.useEffect(() => {
|
|
4175
|
+
if (activeIndex >= filtered.length) setActiveIndex(0);
|
|
4176
|
+
}, [filtered.length, activeIndex]);
|
|
4177
|
+
React74.useEffect(() => {
|
|
4178
|
+
listRef.current?.querySelector("[data-active]")?.scrollIntoView({ block: "nearest" });
|
|
4179
|
+
}, [activeIndex, isOpen]);
|
|
4180
|
+
const move = (dir) => {
|
|
4181
|
+
const n = filtered.length;
|
|
4182
|
+
if (n === 0) return;
|
|
4183
|
+
let i = activeIndex;
|
|
4184
|
+
for (let step = 0; step < n; step++) {
|
|
4185
|
+
i = (i + dir + n) % n;
|
|
4186
|
+
if (!filtered[i]?.disabled) break;
|
|
4187
|
+
}
|
|
4188
|
+
setActiveIndex(i);
|
|
4189
|
+
};
|
|
4190
|
+
const select = (index) => {
|
|
4191
|
+
const it = filtered[index];
|
|
4192
|
+
if (!it || it.disabled) return;
|
|
4193
|
+
it.onSelect?.();
|
|
4194
|
+
setOpen(false);
|
|
4195
|
+
};
|
|
4196
|
+
const onInputKeyDown = (e) => {
|
|
4197
|
+
if (e.key === "ArrowDown") {
|
|
4198
|
+
e.preventDefault();
|
|
4199
|
+
move(1);
|
|
4200
|
+
} else if (e.key === "ArrowUp") {
|
|
4201
|
+
e.preventDefault();
|
|
4202
|
+
move(-1);
|
|
4203
|
+
} else if (e.key === "Enter") {
|
|
4204
|
+
e.preventDefault();
|
|
4205
|
+
select(activeIndex);
|
|
4206
|
+
}
|
|
4207
|
+
};
|
|
4208
|
+
return /* @__PURE__ */ jsx(Dialog$1.Root, { open: isOpen, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(Dialog$1.Portal, { children: [
|
|
4209
|
+
/* @__PURE__ */ jsx(Dialog$1.Backdrop, { className: cx(sc("command-palette-backdrop")) }),
|
|
4210
|
+
/* @__PURE__ */ jsxs(
|
|
4211
|
+
Dialog$1.Popup,
|
|
4212
|
+
{
|
|
4213
|
+
className: cx(sc("command-palette-popup"), className),
|
|
4214
|
+
"aria-label": "Command palette",
|
|
4215
|
+
children: [
|
|
4216
|
+
/* @__PURE__ */ jsxs("div", { className: cx(sc("command-palette-search")), children: [
|
|
4217
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("command-palette-search-icon")), children: SearchIcon }),
|
|
4218
|
+
/* @__PURE__ */ jsx(
|
|
4219
|
+
"input",
|
|
4220
|
+
{
|
|
4221
|
+
autoFocus: true,
|
|
4222
|
+
type: "text",
|
|
4223
|
+
className: cx(sc("command-palette-input")),
|
|
4224
|
+
placeholder,
|
|
4225
|
+
value: query,
|
|
4226
|
+
spellCheck: false,
|
|
4227
|
+
"aria-label": "Search commands",
|
|
4228
|
+
onChange: (e) => {
|
|
4229
|
+
setQuery(e.target.value);
|
|
4230
|
+
setActiveIndex(0);
|
|
4231
|
+
},
|
|
4232
|
+
onKeyDown: onInputKeyDown
|
|
4233
|
+
}
|
|
4234
|
+
)
|
|
4235
|
+
] }),
|
|
4236
|
+
/* @__PURE__ */ jsx("div", { className: cx(sc("command-palette-list")), ref: listRef, role: "listbox", children: filtered.length === 0 ? /* @__PURE__ */ jsx("div", { className: cx(sc("command-palette-empty")), children: emptyMessage }) : groups.map(([groupKey, entries]) => /* @__PURE__ */ jsxs("div", { className: cx(sc("command-palette-group")), children: [
|
|
4237
|
+
groupKey && /* @__PURE__ */ jsx("div", { className: cx(sc("command-palette-group-label")), children: groupKey }),
|
|
4238
|
+
entries.map(({ item, index }) => /* @__PURE__ */ jsxs(
|
|
4239
|
+
"div",
|
|
4240
|
+
{
|
|
4241
|
+
className: cx(sc("command-palette-item")),
|
|
4242
|
+
role: "option",
|
|
4243
|
+
"aria-selected": index === activeIndex,
|
|
4244
|
+
"aria-disabled": item.disabled || void 0,
|
|
4245
|
+
"data-active": index === activeIndex || void 0,
|
|
4246
|
+
"data-disabled": item.disabled || void 0,
|
|
4247
|
+
onPointerMove: () => setActiveIndex(index),
|
|
4248
|
+
onClick: () => select(index),
|
|
4249
|
+
children: [
|
|
4250
|
+
item.icon && /* @__PURE__ */ jsx("span", { className: cx(sc("command-palette-item-icon")), children: item.icon }),
|
|
4251
|
+
/* @__PURE__ */ jsxs("span", { className: cx(sc("command-palette-item-body")), children: [
|
|
4252
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("command-palette-item-label")), children: item.label }),
|
|
4253
|
+
item.description && /* @__PURE__ */ jsx("span", { className: cx(sc("command-palette-item-desc")), children: item.description })
|
|
4254
|
+
] }),
|
|
4255
|
+
item.shortcut && /* @__PURE__ */ jsx("span", { className: cx(sc("command-palette-item-shortcut")), children: item.shortcut })
|
|
4256
|
+
]
|
|
4257
|
+
},
|
|
4258
|
+
item.id
|
|
4259
|
+
))
|
|
4260
|
+
] }, groupKey ?? "\0")) })
|
|
4261
|
+
]
|
|
4262
|
+
}
|
|
4263
|
+
)
|
|
4264
|
+
] }) });
|
|
4265
|
+
}
|
|
4266
|
+
function flatten(nodes, level, expandedSet, parentId, out) {
|
|
4267
|
+
for (const node of nodes) {
|
|
4268
|
+
const hasChildren = !!node.children?.length;
|
|
4269
|
+
const isExpanded = expandedSet.has(node.id);
|
|
4270
|
+
out.push({ node, level, hasChildren, expanded: isExpanded, parentId });
|
|
4271
|
+
if (hasChildren && isExpanded) {
|
|
4272
|
+
flatten(node.children, level + 1, expandedSet, node.id, out);
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
return out;
|
|
4276
|
+
}
|
|
4277
|
+
var Chevron = /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "m9 6 6 6-6 6" }) });
|
|
4278
|
+
var TreeView = React74.forwardRef(
|
|
4279
|
+
function TreeView2({
|
|
4280
|
+
items,
|
|
4281
|
+
expanded,
|
|
4282
|
+
defaultExpanded,
|
|
4283
|
+
onExpandedChange,
|
|
4284
|
+
selected,
|
|
4285
|
+
defaultSelected,
|
|
4286
|
+
onSelectedChange,
|
|
4287
|
+
onSelect,
|
|
4288
|
+
className,
|
|
4289
|
+
...rest
|
|
4290
|
+
}, forwardedRef) {
|
|
4291
|
+
const sc = useSilicaClass();
|
|
4292
|
+
const expandedControlled = expanded !== void 0;
|
|
4293
|
+
const [expandedInternal, setExpandedInternal] = React74.useState(
|
|
4294
|
+
() => new Set(defaultExpanded ?? [])
|
|
4295
|
+
);
|
|
4296
|
+
const expandedSet = expandedControlled ? new Set(expanded) : expandedInternal;
|
|
4297
|
+
const selectedControlled = selected !== void 0;
|
|
4298
|
+
const [selectedInternal, setSelectedInternal] = React74.useState(defaultSelected);
|
|
4299
|
+
const selectedId = selectedControlled ? selected : selectedInternal;
|
|
4300
|
+
const flat = React74.useMemo(
|
|
4301
|
+
() => flatten(items, 0, expandedSet, void 0, []),
|
|
4302
|
+
[items, expandedSet]
|
|
4303
|
+
);
|
|
4304
|
+
const [focusedId, setFocusedId] = React74.useState();
|
|
4305
|
+
const activeId = focusedId ?? flat[0]?.node.id;
|
|
4306
|
+
const nodeRefs = React74.useRef(/* @__PURE__ */ new Map());
|
|
4307
|
+
const commitExpanded = (next) => {
|
|
4308
|
+
if (!expandedControlled) setExpandedInternal(next);
|
|
4309
|
+
onExpandedChange?.([...next]);
|
|
4310
|
+
};
|
|
4311
|
+
const toggleExpand = (id) => {
|
|
4312
|
+
const next = new Set(expandedSet);
|
|
4313
|
+
if (next.has(id)) next.delete(id);
|
|
4314
|
+
else next.add(id);
|
|
4315
|
+
commitExpanded(next);
|
|
4316
|
+
};
|
|
4317
|
+
const setExpand = (id, open) => {
|
|
4318
|
+
if (expandedSet.has(id) === open) return;
|
|
4319
|
+
const next = new Set(expandedSet);
|
|
4320
|
+
if (open) next.add(id);
|
|
4321
|
+
else next.delete(id);
|
|
4322
|
+
commitExpanded(next);
|
|
4323
|
+
};
|
|
4324
|
+
const selectNode = (node) => {
|
|
4325
|
+
if (node.disabled) return;
|
|
4326
|
+
if (!selectedControlled) setSelectedInternal(node.id);
|
|
4327
|
+
onSelectedChange?.(node.id);
|
|
4328
|
+
onSelect?.(node);
|
|
4329
|
+
};
|
|
4330
|
+
const focusId = (id) => {
|
|
4331
|
+
setFocusedId(id);
|
|
4332
|
+
nodeRefs.current.get(id)?.focus();
|
|
4333
|
+
};
|
|
4334
|
+
const onKeyDown = (e, id) => {
|
|
4335
|
+
const idx = flat.findIndex((f) => f.node.id === id);
|
|
4336
|
+
const entry = flat[idx];
|
|
4337
|
+
if (!entry) return;
|
|
4338
|
+
switch (e.key) {
|
|
4339
|
+
case "ArrowDown": {
|
|
4340
|
+
e.preventDefault();
|
|
4341
|
+
const next = flat[idx + 1];
|
|
4342
|
+
if (next) focusId(next.node.id);
|
|
4343
|
+
break;
|
|
4344
|
+
}
|
|
4345
|
+
case "ArrowUp": {
|
|
4346
|
+
e.preventDefault();
|
|
4347
|
+
const prev = flat[idx - 1];
|
|
4348
|
+
if (prev) focusId(prev.node.id);
|
|
4349
|
+
break;
|
|
4350
|
+
}
|
|
4351
|
+
case "Home": {
|
|
4352
|
+
e.preventDefault();
|
|
4353
|
+
if (flat[0]) focusId(flat[0].node.id);
|
|
4354
|
+
break;
|
|
4355
|
+
}
|
|
4356
|
+
case "End": {
|
|
4357
|
+
e.preventDefault();
|
|
4358
|
+
const last = flat[flat.length - 1];
|
|
4359
|
+
if (last) focusId(last.node.id);
|
|
4360
|
+
break;
|
|
4361
|
+
}
|
|
4362
|
+
case "ArrowRight": {
|
|
4363
|
+
e.preventDefault();
|
|
4364
|
+
if (!entry.hasChildren) break;
|
|
4365
|
+
if (!entry.expanded) setExpand(entry.node.id, true);
|
|
4366
|
+
else {
|
|
4367
|
+
const child = flat[idx + 1];
|
|
4368
|
+
if (child && child.parentId === entry.node.id) focusId(child.node.id);
|
|
4369
|
+
}
|
|
4370
|
+
break;
|
|
4371
|
+
}
|
|
4372
|
+
case "ArrowLeft": {
|
|
4373
|
+
e.preventDefault();
|
|
4374
|
+
if (entry.hasChildren && entry.expanded) setExpand(entry.node.id, false);
|
|
4375
|
+
else if (entry.parentId) focusId(entry.parentId);
|
|
4376
|
+
break;
|
|
4377
|
+
}
|
|
4378
|
+
case "Enter": {
|
|
4379
|
+
e.preventDefault();
|
|
4380
|
+
selectNode(entry.node);
|
|
4381
|
+
if (entry.hasChildren) toggleExpand(entry.node.id);
|
|
4382
|
+
break;
|
|
4383
|
+
}
|
|
4384
|
+
case " ": {
|
|
4385
|
+
e.preventDefault();
|
|
4386
|
+
if (entry.hasChildren) toggleExpand(entry.node.id);
|
|
4387
|
+
else selectNode(entry.node);
|
|
4388
|
+
break;
|
|
4389
|
+
}
|
|
4390
|
+
}
|
|
4391
|
+
};
|
|
4392
|
+
const renderNodes = (nodes, level) => /* @__PURE__ */ jsx(Fragment, { children: nodes.map((node) => {
|
|
4393
|
+
const hasChildren = !!node.children?.length;
|
|
4394
|
+
const isExpanded = expandedSet.has(node.id);
|
|
4395
|
+
return /* @__PURE__ */ jsxs(
|
|
4396
|
+
"li",
|
|
4397
|
+
{
|
|
4398
|
+
className: cx(sc("tree-item")),
|
|
4399
|
+
role: "treeitem",
|
|
4400
|
+
"aria-expanded": hasChildren ? isExpanded : void 0,
|
|
4401
|
+
"aria-selected": selectedId === node.id,
|
|
4402
|
+
"aria-disabled": node.disabled || void 0,
|
|
4403
|
+
tabIndex: activeId === node.id ? 0 : -1,
|
|
4404
|
+
ref: (el) => {
|
|
4405
|
+
if (el) nodeRefs.current.set(node.id, el);
|
|
4406
|
+
else nodeRefs.current.delete(node.id);
|
|
4407
|
+
},
|
|
4408
|
+
onFocus: (e) => {
|
|
4409
|
+
if (e.target === e.currentTarget) setFocusedId(node.id);
|
|
4410
|
+
},
|
|
4411
|
+
onKeyDown: (e) => onKeyDown(e, node.id),
|
|
4412
|
+
children: [
|
|
4413
|
+
/* @__PURE__ */ jsxs(
|
|
4414
|
+
"div",
|
|
4415
|
+
{
|
|
4416
|
+
className: cx(sc("tree-node")),
|
|
4417
|
+
style: { "--tree-depth": level },
|
|
4418
|
+
"data-selected": selectedId === node.id || void 0,
|
|
4419
|
+
"data-disabled": node.disabled || void 0,
|
|
4420
|
+
onClick: () => {
|
|
4421
|
+
selectNode(node);
|
|
4422
|
+
if (hasChildren) toggleExpand(node.id);
|
|
4423
|
+
focusId(node.id);
|
|
4424
|
+
},
|
|
4425
|
+
children: [
|
|
4426
|
+
hasChildren ? /* @__PURE__ */ jsx(
|
|
4427
|
+
"button",
|
|
4428
|
+
{
|
|
4429
|
+
type: "button",
|
|
4430
|
+
className: cx(sc("tree-toggle")),
|
|
4431
|
+
"data-expanded": isExpanded || void 0,
|
|
4432
|
+
"aria-hidden": "true",
|
|
4433
|
+
tabIndex: -1,
|
|
4434
|
+
onClick: (e) => {
|
|
4435
|
+
e.stopPropagation();
|
|
4436
|
+
toggleExpand(node.id);
|
|
4437
|
+
},
|
|
4438
|
+
children: Chevron
|
|
4439
|
+
}
|
|
4440
|
+
) : /* @__PURE__ */ jsx("span", { className: cx(sc("tree-toggle-spacer")) }),
|
|
4441
|
+
node.icon && /* @__PURE__ */ jsx("span", { className: cx(sc("tree-node-icon")), children: node.icon }),
|
|
4442
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("tree-node-label")), children: node.label })
|
|
4443
|
+
]
|
|
4444
|
+
}
|
|
4445
|
+
),
|
|
4446
|
+
hasChildren && isExpanded && /* @__PURE__ */ jsx("ul", { className: cx(sc("tree-group")), role: "group", children: renderNodes(node.children, level + 1) })
|
|
4447
|
+
]
|
|
4448
|
+
},
|
|
4449
|
+
node.id
|
|
4450
|
+
);
|
|
4451
|
+
}) });
|
|
4452
|
+
return /* @__PURE__ */ jsx(
|
|
4453
|
+
"ul",
|
|
4454
|
+
{
|
|
4455
|
+
ref: forwardedRef,
|
|
4456
|
+
className: cx(sc("tree"), className),
|
|
4457
|
+
role: "tree",
|
|
4458
|
+
...rest,
|
|
4459
|
+
children: renderNodes(items, 0)
|
|
4460
|
+
}
|
|
4461
|
+
);
|
|
4462
|
+
}
|
|
4463
|
+
);
|
|
4464
|
+
var UploadIcon = /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
4465
|
+
/* @__PURE__ */ jsx("path", { d: "M12 15V3" }),
|
|
4466
|
+
/* @__PURE__ */ jsx("path", { d: "m7 8 5-5 5 5" }),
|
|
4467
|
+
/* @__PURE__ */ jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" })
|
|
4468
|
+
] });
|
|
4469
|
+
function matchesAccept(file, accept) {
|
|
4470
|
+
if (!accept) return true;
|
|
4471
|
+
const types = accept.split(",").map((s) => s.trim().toLowerCase()).filter(Boolean);
|
|
4472
|
+
if (types.length === 0) return true;
|
|
4473
|
+
const name = file.name.toLowerCase();
|
|
4474
|
+
const mime = file.type.toLowerCase();
|
|
4475
|
+
return types.some((t) => {
|
|
4476
|
+
if (t.startsWith(".")) return name.endsWith(t);
|
|
4477
|
+
if (t.endsWith("/*")) return mime.startsWith(t.slice(0, -1));
|
|
4478
|
+
return mime === t;
|
|
4479
|
+
});
|
|
4480
|
+
}
|
|
4481
|
+
var Dropzone = React74.forwardRef(
|
|
4482
|
+
function Dropzone2({
|
|
4483
|
+
onFiles,
|
|
4484
|
+
onReject,
|
|
4485
|
+
accept,
|
|
4486
|
+
multiple = true,
|
|
4487
|
+
maxSize,
|
|
4488
|
+
disabled,
|
|
4489
|
+
title = "Drop files here, or click to browse",
|
|
4490
|
+
hint,
|
|
4491
|
+
icon,
|
|
4492
|
+
inputProps,
|
|
4493
|
+
className,
|
|
4494
|
+
children,
|
|
4495
|
+
...rest
|
|
4496
|
+
}, forwardedRef) {
|
|
4497
|
+
const sc = useSilicaClass();
|
|
4498
|
+
const inputRef = React74.useRef(null);
|
|
4499
|
+
const dragDepth = React74.useRef(0);
|
|
4500
|
+
const [dragging, setDragging] = React74.useState(false);
|
|
4501
|
+
const process = (fileList) => {
|
|
4502
|
+
if (!fileList || disabled) return;
|
|
4503
|
+
const accepted = [];
|
|
4504
|
+
const rejected = [];
|
|
4505
|
+
for (const file of Array.from(fileList)) {
|
|
4506
|
+
if (!matchesAccept(file, accept)) {
|
|
4507
|
+
rejected.push({ file, reason: "type" });
|
|
4508
|
+
} else if (maxSize != null && file.size > maxSize) {
|
|
4509
|
+
rejected.push({ file, reason: "size" });
|
|
4510
|
+
} else {
|
|
4511
|
+
accepted.push(file);
|
|
4512
|
+
}
|
|
4513
|
+
}
|
|
4514
|
+
const finalAccepted = multiple ? accepted : accepted.slice(0, 1);
|
|
4515
|
+
if (finalAccepted.length) onFiles?.(finalAccepted);
|
|
4516
|
+
if (rejected.length) onReject?.(rejected);
|
|
4517
|
+
};
|
|
4518
|
+
const openPicker = () => {
|
|
4519
|
+
if (!disabled) inputRef.current?.click();
|
|
4520
|
+
};
|
|
4521
|
+
return /* @__PURE__ */ jsxs(
|
|
4522
|
+
"div",
|
|
4523
|
+
{
|
|
4524
|
+
ref: forwardedRef,
|
|
4525
|
+
className: cx(sc("dropzone"), className),
|
|
4526
|
+
role: "button",
|
|
4527
|
+
tabIndex: disabled ? -1 : 0,
|
|
4528
|
+
"aria-disabled": disabled || void 0,
|
|
4529
|
+
"data-dragging": dragging || void 0,
|
|
4530
|
+
"data-disabled": disabled || void 0,
|
|
4531
|
+
onClick: (e) => {
|
|
4532
|
+
if (e.target === inputRef.current) return;
|
|
4533
|
+
openPicker();
|
|
4534
|
+
},
|
|
4535
|
+
onKeyDown: (e) => {
|
|
4536
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
4537
|
+
e.preventDefault();
|
|
4538
|
+
openPicker();
|
|
4539
|
+
}
|
|
4540
|
+
},
|
|
4541
|
+
onDragEnter: (e) => {
|
|
4542
|
+
e.preventDefault();
|
|
4543
|
+
if (disabled) return;
|
|
4544
|
+
dragDepth.current += 1;
|
|
4545
|
+
setDragging(true);
|
|
4546
|
+
},
|
|
4547
|
+
onDragOver: (e) => {
|
|
4548
|
+
e.preventDefault();
|
|
4549
|
+
},
|
|
4550
|
+
onDragLeave: (e) => {
|
|
4551
|
+
e.preventDefault();
|
|
4552
|
+
if (disabled) return;
|
|
4553
|
+
dragDepth.current -= 1;
|
|
4554
|
+
if (dragDepth.current <= 0) {
|
|
4555
|
+
dragDepth.current = 0;
|
|
4556
|
+
setDragging(false);
|
|
4557
|
+
}
|
|
4558
|
+
},
|
|
4559
|
+
onDrop: (e) => {
|
|
4560
|
+
e.preventDefault();
|
|
4561
|
+
if (disabled) return;
|
|
4562
|
+
dragDepth.current = 0;
|
|
4563
|
+
setDragging(false);
|
|
4564
|
+
process(e.dataTransfer.files);
|
|
4565
|
+
},
|
|
4566
|
+
...rest,
|
|
4567
|
+
children: [
|
|
4568
|
+
/* @__PURE__ */ jsx(
|
|
4569
|
+
"input",
|
|
4570
|
+
{
|
|
4571
|
+
ref: inputRef,
|
|
4572
|
+
type: "file",
|
|
4573
|
+
className: cx(sc("dropzone-input")),
|
|
4574
|
+
accept,
|
|
4575
|
+
multiple,
|
|
4576
|
+
disabled,
|
|
4577
|
+
tabIndex: -1,
|
|
4578
|
+
...inputProps,
|
|
4579
|
+
onChange: (e) => {
|
|
4580
|
+
process(e.target.files);
|
|
4581
|
+
e.target.value = "";
|
|
4582
|
+
inputProps?.onChange?.(e);
|
|
4583
|
+
}
|
|
4584
|
+
}
|
|
4585
|
+
),
|
|
4586
|
+
children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4587
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("dropzone-icon")), children: icon ?? UploadIcon }),
|
|
4588
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("dropzone-title")), children: title }),
|
|
4589
|
+
hint && /* @__PURE__ */ jsx("span", { className: cx(sc("dropzone-hint")), children: hint })
|
|
4590
|
+
] })
|
|
4591
|
+
]
|
|
4592
|
+
}
|
|
4593
|
+
);
|
|
4594
|
+
}
|
|
4595
|
+
);
|
|
4596
|
+
var CheckIcon3 = /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) });
|
|
4597
|
+
var Wizard = React74.forwardRef(
|
|
4598
|
+
function Wizard2({
|
|
4599
|
+
steps,
|
|
4600
|
+
activeStep,
|
|
4601
|
+
defaultStep = 0,
|
|
4602
|
+
onStepChange,
|
|
4603
|
+
color,
|
|
4604
|
+
linear = true,
|
|
4605
|
+
canGoNext = true,
|
|
4606
|
+
onFinish,
|
|
4607
|
+
backLabel = "Back",
|
|
4608
|
+
nextLabel = "Next",
|
|
4609
|
+
finishLabel = "Finish",
|
|
4610
|
+
hideFooter,
|
|
4611
|
+
children,
|
|
4612
|
+
className,
|
|
4613
|
+
...rest
|
|
4614
|
+
}, forwardedRef) {
|
|
4615
|
+
const sc = useSilicaClass();
|
|
4616
|
+
const isControlled = activeStep !== void 0;
|
|
4617
|
+
const [internal, setInternal] = React74.useState(defaultStep);
|
|
4618
|
+
const current = isControlled ? activeStep : internal;
|
|
4619
|
+
const lastIndex = steps.length - 1;
|
|
4620
|
+
const isLast = current >= lastIndex;
|
|
4621
|
+
const goTo = (index) => {
|
|
4622
|
+
const clamped = Math.max(0, Math.min(lastIndex, index));
|
|
4623
|
+
if (clamped === current) return;
|
|
4624
|
+
if (!isControlled) setInternal(clamped);
|
|
4625
|
+
onStepChange?.(clamped);
|
|
4626
|
+
};
|
|
4627
|
+
const next = () => {
|
|
4628
|
+
if (isLast) onFinish?.();
|
|
4629
|
+
else goTo(current + 1);
|
|
4630
|
+
};
|
|
4631
|
+
const back = () => goTo(current - 1);
|
|
4632
|
+
const activeContent = children ?? steps[current]?.content;
|
|
4633
|
+
return /* @__PURE__ */ jsxs(
|
|
4634
|
+
"div",
|
|
4635
|
+
{
|
|
4636
|
+
ref: forwardedRef,
|
|
4637
|
+
className: cx(sc("wizard"), color && sc(`wizard-${color}`), className),
|
|
4638
|
+
...rest,
|
|
4639
|
+
children: [
|
|
4640
|
+
/* @__PURE__ */ jsx("div", { className: cx(sc("wizard-steps")), role: "list", children: steps.map((step, i) => {
|
|
4641
|
+
const state = i < current ? "complete" : i === current ? "active" : "upcoming";
|
|
4642
|
+
const clickable = !step.disabled && i !== current && (!linear || i < current);
|
|
4643
|
+
return /* @__PURE__ */ jsxs(
|
|
4644
|
+
"button",
|
|
4645
|
+
{
|
|
4646
|
+
type: "button",
|
|
4647
|
+
className: cx(sc("wizard-step")),
|
|
4648
|
+
role: "listitem",
|
|
4649
|
+
"data-state": state,
|
|
4650
|
+
"data-clickable": clickable || void 0,
|
|
4651
|
+
"data-disabled": step.disabled || void 0,
|
|
4652
|
+
"aria-current": i === current ? "step" : void 0,
|
|
4653
|
+
disabled: !clickable,
|
|
4654
|
+
onClick: () => clickable && goTo(i),
|
|
4655
|
+
children: [
|
|
4656
|
+
/* @__PURE__ */ jsx("span", { className: cx(sc("wizard-step-marker")), children: state === "complete" ? CheckIcon3 : i + 1 }),
|
|
4657
|
+
/* @__PURE__ */ jsxs("span", { className: cx(sc("wizard-step-label")), children: [
|
|
4658
|
+
step.title,
|
|
4659
|
+
step.optional && /* @__PURE__ */ jsx("span", { className: cx(sc("wizard-step-optional")), children: "Optional" })
|
|
4660
|
+
] })
|
|
4661
|
+
]
|
|
4662
|
+
},
|
|
4663
|
+
step.id
|
|
4664
|
+
);
|
|
4665
|
+
}) }),
|
|
4666
|
+
/* @__PURE__ */ jsx("div", { className: cx(sc("wizard-content")), children: activeContent }),
|
|
4667
|
+
!hideFooter && /* @__PURE__ */ jsxs("div", { className: cx(sc("wizard-footer")), children: [
|
|
4668
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", disabled: current === 0, onClick: back, children: backLabel }),
|
|
4669
|
+
/* @__PURE__ */ jsx(
|
|
4670
|
+
Button,
|
|
4671
|
+
{
|
|
4672
|
+
color,
|
|
4673
|
+
disabled: !isLast && !canGoNext,
|
|
4674
|
+
onClick: next,
|
|
4675
|
+
children: isLast ? finishLabel : nextLabel
|
|
4676
|
+
}
|
|
4677
|
+
)
|
|
4678
|
+
] })
|
|
4679
|
+
]
|
|
4680
|
+
}
|
|
4681
|
+
);
|
|
4682
|
+
}
|
|
4683
|
+
);
|
|
4684
|
+
|
|
4685
|
+
export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, Alert, AlertActions, AlertContent, AlertDescription, AlertDialog, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Autocomplete, AutocompleteItem, Avatar, AvatarGroup, Badge, Breadcrumb, Button, Calendar, Card, CardActions, CardBody, CardTitle, Carousel, CarouselItem, Chat, ChatBubble, ChatFooter, ChatHeader, ChatImage, Checkbox, CheckboxGroup, CheckboxOption, Collapse, CollapseContent, CollapseTitle, Collapsible, CollapsiblePanel, CollapsibleTrigger, ColorPicker, Combobox, ComboboxItem, CommandPalette, ContextMenu, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuSeparator, ContextMenuTrigger, Countdown, DatePicker, DateRangePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogTitle, DialogTrigger, Diff, Display, Divider, Dock, DockItem, DockLabel, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, Dropzone, EmptyState, Field, FieldControl, FieldDescription, FieldError, FieldLabel, Fieldset, FieldsetLabel, FieldsetLegend, FileInput, Filter, FilterItem, FloatingLabel, Footer, FooterTitle, Form, Heading, Hero, HeroContent, HeroOverlay, Indicator, IndicatorItem, Input, Join, Kbd, Label, Link, List, ListColGrow, ListRow, ListTitle, Loading, MAX_CHROMA, Mask, Menu, MenuItem, MenuTitle, Menubar, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarSeparator, MenubarTrigger, Meter, MockupBrowser, MockupCode, MockupCodeLine, MockupPhone, MockupWindow, NativeSelect, Navbar, NavbarCenter, NavbarEnd, NavbarStart, NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuTrigger, NumberField, Pagination, Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, PreviewCard, Progress, Prose, RadialProgress, Radio, RadioGroup, RadioOption, Range, Rating, ScrollArea, Select, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SilicaProvider, Skeleton, Slider, Stack, Stat, StatDesc, StatFigure, StatTitle, StatValue, Stats, Status, Step, Steps, Swap, Switch, Table, Tabs, TabsList, TabsPanel, TabsTab, TagInput, Text, Textarea, ThemeController, Timeline, TimelineEnd, TimelineItem, TimelineMiddle, TimelineStart, ToastProvider, Toggle, ToggleGroup, ToggleGroupItem, Toolbar, ToolbarButton, ToolbarGroup, ToolbarLink, ToolbarSeparator, Tooltip, TooltipProvider, TreeView, Validator, ValidatorHint, Wizard, cx, formatOklch, hexToOklch, inGamut, oklchToHex, oklchToRgb, parseOklch, useSilicaClass, useSilicaConfig, useToast };
|
|
4686
|
+
//# sourceMappingURL=index.js.map
|
|
4687
|
+
//# sourceMappingURL=index.js.map
|