@mond-design-system/react 1.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1246 @@
1
+ import { createContext, createElement, useContext, Children, useId, useState, useRef, useCallback, useMemo, useEffect } from 'react';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { createPortal } from 'react-dom';
4
+
5
+ // src/internal/cx.ts
6
+ function cx(...parts) {
7
+ return parts.filter(Boolean).join(" ");
8
+ }
9
+
10
+ // src/components/Text/Text.module.css
11
+ var Text_default = {
12
+ text: "Text_text",
13
+ "variant-body": "Text_variant-body",
14
+ "variant-label": "Text_variant-label",
15
+ "variant-note": "Text_variant-note",
16
+ "variant-meta": "Text_variant-meta",
17
+ "variant-eyebrow": "Text_variant-eyebrow",
18
+ "tone-primary": "Text_tone-primary",
19
+ "tone-secondary": "Text_tone-secondary",
20
+ "tone-muted": "Text_tone-muted",
21
+ "tone-inverse": "Text_tone-inverse",
22
+ "tone-accent": "Text_tone-accent",
23
+ "tone-on-media": "Text_tone-on-media",
24
+ "tone-danger": "Text_tone-danger",
25
+ "tone-warning": "Text_tone-warning",
26
+ "tone-success": "Text_tone-success",
27
+ "align-left": "Text_align-left",
28
+ "align-center": "Text_align-center",
29
+ "align-right": "Text_align-right",
30
+ truncate: "Text_truncate"
31
+ };
32
+
33
+ // src/components/Text/Text.tsx
34
+ var ELEMENT = {
35
+ body: "p",
36
+ label: "span",
37
+ note: "p",
38
+ meta: "span",
39
+ eyebrow: "span"
40
+ };
41
+ var DEFAULT_TONE = {
42
+ note: "secondary",
43
+ meta: "muted",
44
+ eyebrow: "muted"
45
+ };
46
+ function Text({
47
+ variant = "body",
48
+ as,
49
+ tone,
50
+ align,
51
+ truncate = false,
52
+ className,
53
+ ...rest
54
+ }) {
55
+ const element = as ?? ELEMENT[variant];
56
+ const resolvedTone = tone ?? DEFAULT_TONE[variant] ?? "primary";
57
+ return createElement(element, {
58
+ className: cx(
59
+ Text_default.text,
60
+ Text_default[`variant-${variant}`],
61
+ Text_default[`tone-${resolvedTone}`],
62
+ align && Text_default[`align-${align}`],
63
+ truncate && Text_default.truncate,
64
+ className
65
+ ),
66
+ ...rest
67
+ });
68
+ }
69
+
70
+ // src/components/Heading/Heading.module.css
71
+ var Heading_default = {
72
+ heading: "Heading_heading",
73
+ "variant-display": "Heading_variant-display",
74
+ "variant-title": "Heading_variant-title",
75
+ "variant-subtitle": "Heading_variant-subtitle",
76
+ "tone-primary": "Heading_tone-primary",
77
+ "tone-secondary": "Heading_tone-secondary",
78
+ "tone-inverse": "Heading_tone-inverse",
79
+ "tone-accent": "Heading_tone-accent",
80
+ "tone-on-media": "Heading_tone-on-media"
81
+ };
82
+
83
+ // src/components/Heading/Heading.tsx
84
+ var LEVEL_VARIANT = {
85
+ 1: "display",
86
+ 2: "title",
87
+ 3: "subtitle",
88
+ 4: "subtitle"
89
+ };
90
+ function Heading({
91
+ level = 2,
92
+ variant,
93
+ tone = "primary",
94
+ className,
95
+ ...rest
96
+ }) {
97
+ return createElement(`h${level}`, {
98
+ className: cx(
99
+ Heading_default.heading,
100
+ Heading_default[`variant-${variant ?? LEVEL_VARIANT[level]}`],
101
+ Heading_default[`tone-${tone}`],
102
+ className
103
+ ),
104
+ ...rest
105
+ });
106
+ }
107
+
108
+ // src/components/Spinner/Spinner.module.css
109
+ var Spinner_default = {
110
+ spinner: "Spinner_spinner"
111
+ };
112
+ function Spinner({
113
+ size = 20,
114
+ label = "Loading",
115
+ className,
116
+ style,
117
+ ...rest
118
+ }) {
119
+ const vars = {
120
+ "--spinner-size": `${size}px`,
121
+ "--spinner-border": `${Math.max(2, Math.round(size / 10))}px`
122
+ };
123
+ return /* @__PURE__ */ jsx(
124
+ "span",
125
+ {
126
+ role: "status",
127
+ "aria-label": label,
128
+ className: cx(Spinner_default.spinner, className),
129
+ style: { ...vars, ...style },
130
+ ...rest
131
+ }
132
+ );
133
+ }
134
+
135
+ // src/components/Icon/Icon.module.css
136
+ var Icon_default = {
137
+ icon: "Icon_icon",
138
+ "size-sm": "Icon_size-sm",
139
+ "size-md": "Icon_size-md",
140
+ "size-lg": "Icon_size-lg"
141
+ };
142
+ var IconContext = createContext(null);
143
+ function IconProvider({ render, children }) {
144
+ return /* @__PURE__ */ jsx(IconContext.Provider, { value: render, children });
145
+ }
146
+ var SIZE_PX = { sm: 16, md: 20, lg: 24 };
147
+ var warned = /* @__PURE__ */ new Set();
148
+ function Icon({ name, size = "md", label, className, ...rest }) {
149
+ const render = useContext(IconContext);
150
+ if (render === null && !warned.has(name)) {
151
+ warned.add(name);
152
+ console.error(
153
+ `Icon "${name}": no IconProvider above this tree. Register the app's icon set once at the root.`
154
+ );
155
+ }
156
+ return /* @__PURE__ */ jsx(
157
+ "span",
158
+ {
159
+ className: cx(Icon_default.icon, Icon_default[`size-${size}`], className),
160
+ ...label ? { role: "img", "aria-label": label } : { "aria-hidden": true },
161
+ ...rest,
162
+ children: render?.(name, { size: SIZE_PX[size] })
163
+ }
164
+ );
165
+ }
166
+
167
+ // src/components/Button/Button.module.css
168
+ var Button_default = {
169
+ button: "Button_button",
170
+ "size-sm": "Button_size-sm",
171
+ "size-md": "Button_size-md",
172
+ "size-lg": "Button_size-lg",
173
+ "variant-primary": "Button_variant-primary",
174
+ "variant-secondary": "Button_variant-secondary",
175
+ "variant-ghost": "Button_variant-ghost",
176
+ "variant-danger": "Button_variant-danger",
177
+ fullWidth: "Button_fullWidth",
178
+ "icon-only": "Button_icon-only"
179
+ };
180
+ var SPINNER_PX = { sm: 16, md: 18, lg: 20 };
181
+ function Button({
182
+ variant = "primary",
183
+ size = "md",
184
+ iconLeft,
185
+ iconRight,
186
+ loading = false,
187
+ disabled = false,
188
+ fullWidth = false,
189
+ iconOnly = false,
190
+ type = "button",
191
+ href,
192
+ as,
193
+ className,
194
+ children,
195
+ ...rest
196
+ }) {
197
+ const Element = as ?? (href !== void 0 ? "a" : "button");
198
+ const isButton = Element === "button";
199
+ const own = isButton ? { type, disabled: disabled || loading } : { href };
200
+ return /* @__PURE__ */ jsxs(
201
+ Element,
202
+ {
203
+ className: cx(
204
+ Button_default.button,
205
+ Button_default[`variant-${variant}`],
206
+ Button_default[`size-${size}`],
207
+ fullWidth && Button_default.fullWidth,
208
+ iconOnly && Button_default["icon-only"],
209
+ className
210
+ ),
211
+ "aria-busy": loading || void 0,
212
+ ...own,
213
+ ...rest,
214
+ children: [
215
+ loading ? /* @__PURE__ */ jsx(Spinner, { size: SPINNER_PX[size] }) : iconLeft,
216
+ children,
217
+ !loading && iconRight
218
+ ]
219
+ }
220
+ );
221
+ }
222
+
223
+ // src/components/Link/Link.module.css
224
+ var Link_default = {
225
+ link: "Link_link",
226
+ "variant-inline": "Link_variant-inline",
227
+ "variant-standalone": "Link_variant-standalone"
228
+ };
229
+ function Link({
230
+ variant = "inline",
231
+ external = false,
232
+ as: Element = "a",
233
+ className,
234
+ ...rest
235
+ }) {
236
+ const externalProps = external ? { target: "_blank", rel: "noopener noreferrer" } : {};
237
+ return /* @__PURE__ */ jsx(
238
+ Element,
239
+ {
240
+ className: cx(Link_default.link, Link_default[`variant-${variant}`], className),
241
+ ...externalProps,
242
+ ...rest
243
+ }
244
+ );
245
+ }
246
+
247
+ // src/components/Avatar/Avatar.module.css
248
+ var Avatar_default = {
249
+ avatar: "Avatar_avatar",
250
+ "size-sm": "Avatar_size-sm",
251
+ "size-md": "Avatar_size-md",
252
+ "size-lg": "Avatar_size-lg",
253
+ image: "Avatar_image",
254
+ initials: "Avatar_initials"
255
+ };
256
+ function initials(name) {
257
+ const words = name.trim().split(/\s+/).filter(Boolean);
258
+ const first = words[0]?.[0] ?? "";
259
+ const last = words.length > 1 ? words.at(-1)?.[0] ?? "" : "";
260
+ return (first + last).toUpperCase();
261
+ }
262
+ function Avatar({ name, src, size = "md", className, ...rest }) {
263
+ return /* @__PURE__ */ jsx("span", { className: cx(Avatar_default.avatar, Avatar_default[`size-${size}`], className), ...rest, children: src ? /* @__PURE__ */ jsx("img", { className: Avatar_default.image, src, alt: name }) : /* @__PURE__ */ jsx("span", { role: "img", "aria-label": name, className: Avatar_default.initials, children: initials(name) }) });
264
+ }
265
+
266
+ // src/components/AvatarGroup/AvatarGroup.module.css
267
+ var AvatarGroup_default = {
268
+ group: "AvatarGroup_group",
269
+ item: "AvatarGroup_item",
270
+ overflow: "AvatarGroup_overflow",
271
+ "size-sm": "AvatarGroup_size-sm",
272
+ "size-md": "AvatarGroup_size-md",
273
+ "size-lg": "AvatarGroup_size-lg"
274
+ };
275
+ function AvatarGroup({
276
+ children,
277
+ max = 4,
278
+ size = "md",
279
+ className,
280
+ ...rest
281
+ }) {
282
+ const all = Children.toArray(children);
283
+ const visible = all.slice(0, max);
284
+ const hidden = all.length - visible.length;
285
+ return /* @__PURE__ */ jsxs("div", { className: cx(AvatarGroup_default.group, className), ...rest, children: [
286
+ visible.map((child, i) => /* @__PURE__ */ jsx("span", { className: AvatarGroup_default.item, children: child }, i)),
287
+ hidden > 0 && /* @__PURE__ */ jsxs(
288
+ "span",
289
+ {
290
+ className: cx(AvatarGroup_default.item, AvatarGroup_default.overflow, AvatarGroup_default[`size-${size}`]),
291
+ "aria-label": `${hidden} more`,
292
+ children: [
293
+ "+",
294
+ hidden
295
+ ]
296
+ }
297
+ )
298
+ ] });
299
+ }
300
+
301
+ // src/components/Badge/Badge.module.css
302
+ var Badge_default = {
303
+ badge: "Badge_badge",
304
+ "tone-neutral": "Badge_tone-neutral",
305
+ "tone-accent": "Badge_tone-accent",
306
+ "tone-danger": "Badge_tone-danger",
307
+ "tone-warning": "Badge_tone-warning",
308
+ "tone-success": "Badge_tone-success"
309
+ };
310
+ function Badge({ tone = "neutral", className, ...rest }) {
311
+ return /* @__PURE__ */ jsx("span", { className: cx(Badge_default.badge, Badge_default[`tone-${tone}`], className), ...rest });
312
+ }
313
+
314
+ // src/components/Tag/Tag.module.css
315
+ var Tag_default = {
316
+ tag: "Tag_tag",
317
+ "tone-accent": "Tag_tone-accent",
318
+ remove: "Tag_remove",
319
+ removeGlyph: "Tag_removeGlyph"
320
+ };
321
+ function Tag({ children, tone = "neutral", onRemove, className, ...rest }) {
322
+ const text = typeof children === "string" ? children : void 0;
323
+ return /* @__PURE__ */ jsxs("span", { className: cx(Tag_default.tag, Tag_default[`tone-${tone}`], className), ...rest, children: [
324
+ children,
325
+ onRemove && /* @__PURE__ */ jsx(
326
+ "button",
327
+ {
328
+ type: "button",
329
+ className: Tag_default.remove,
330
+ "aria-label": text ? `Remove ${text}` : "Remove",
331
+ onClick: onRemove,
332
+ children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className: Tag_default.removeGlyph, children: /* @__PURE__ */ jsx("path", { d: "M4 4l8 8M12 4l-8 8", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round" }) })
333
+ }
334
+ )
335
+ ] });
336
+ }
337
+
338
+ // src/components/Divider/Divider.module.css
339
+ var Divider_default = {
340
+ divider: "Divider_divider",
341
+ horizontal: "Divider_horizontal",
342
+ vertical: "Divider_vertical"
343
+ };
344
+ function Divider({ orientation = "horizontal", className, ...rest }) {
345
+ return /* @__PURE__ */ jsx(
346
+ "div",
347
+ {
348
+ role: "separator",
349
+ "aria-orientation": orientation === "vertical" ? "vertical" : void 0,
350
+ className: cx(Divider_default.divider, Divider_default[orientation], className),
351
+ ...rest
352
+ }
353
+ );
354
+ }
355
+
356
+ // src/components/Skeleton/Skeleton.module.css
357
+ var Skeleton_default = {
358
+ skeleton: "Skeleton_skeleton",
359
+ pulse: "Skeleton_pulse",
360
+ "variant-text": "Skeleton_variant-text",
361
+ "variant-rect": "Skeleton_variant-rect",
362
+ "variant-circle": "Skeleton_variant-circle"
363
+ };
364
+ function Skeleton({
365
+ variant = "text",
366
+ width,
367
+ height,
368
+ className,
369
+ style,
370
+ ...rest
371
+ }) {
372
+ const vars = {
373
+ ...width ? { "--skeleton-w": width } : {},
374
+ ...height ? { "--skeleton-h": height } : {}
375
+ };
376
+ return /* @__PURE__ */ jsx(
377
+ "span",
378
+ {
379
+ "aria-hidden": "true",
380
+ className: cx(Skeleton_default.skeleton, Skeleton_default[`variant-${variant}`], className),
381
+ style: { ...vars, ...style },
382
+ ...rest
383
+ }
384
+ );
385
+ }
386
+
387
+ // src/components/ProgressBar/ProgressBar.module.css
388
+ var ProgressBar_default = {
389
+ track: "ProgressBar_track",
390
+ fill: "ProgressBar_fill",
391
+ indeterminate: "ProgressBar_indeterminate"};
392
+ function ProgressBar({
393
+ value = 0,
394
+ label,
395
+ indeterminate = false,
396
+ className,
397
+ style,
398
+ ...rest
399
+ }) {
400
+ const clamped = Math.min(100, Math.max(0, value));
401
+ return /* @__PURE__ */ jsx(
402
+ "div",
403
+ {
404
+ role: "progressbar",
405
+ "aria-label": label,
406
+ "aria-valuemin": 0,
407
+ "aria-valuemax": 100,
408
+ "aria-valuenow": indeterminate ? void 0 : clamped,
409
+ className: cx(ProgressBar_default.track, indeterminate && ProgressBar_default.indeterminate, className),
410
+ style: { ...{ "--progress": `${clamped}%` }, ...style },
411
+ ...rest,
412
+ children: /* @__PURE__ */ jsx("span", { className: ProgressBar_default.fill })
413
+ }
414
+ );
415
+ }
416
+
417
+ // src/components/Field/Field.module.css
418
+ var Field_default = {
419
+ field: "Field_field",
420
+ label: "Field_label",
421
+ required: "Field_required",
422
+ message: "Field_message",
423
+ error: "Field_error"
424
+ };
425
+ var FieldContext = createContext(null);
426
+ function useFieldContext() {
427
+ return useContext(FieldContext);
428
+ }
429
+ function Field({ label, children, hint, error, required = false, className }) {
430
+ const id = useId();
431
+ const messageId = `${id}-message`;
432
+ const message = error ?? hint;
433
+ return /* @__PURE__ */ jsxs("div", { className: cx(Field_default.field, className), children: [
434
+ /* @__PURE__ */ jsxs("label", { className: Field_default.label, htmlFor: id, children: [
435
+ label,
436
+ required && /* @__PURE__ */ jsx("span", { className: Field_default.required, "aria-hidden": "true", children: "*" })
437
+ ] }),
438
+ /* @__PURE__ */ jsx(
439
+ FieldContext.Provider,
440
+ {
441
+ value: { id, describedBy: message ? messageId : void 0, invalid: error !== void 0 },
442
+ children
443
+ }
444
+ ),
445
+ message && /* @__PURE__ */ jsx("span", { id: messageId, className: cx(Field_default.message, error !== void 0 && Field_default.error), children: message })
446
+ ] });
447
+ }
448
+
449
+ // src/components/Input/Input.module.css
450
+ var Input_default = {
451
+ input: "Input_input",
452
+ "size-sm": "Input_size-sm",
453
+ "size-md": "Input_size-md",
454
+ "size-lg": "Input_size-lg"
455
+ };
456
+ function Input({ size = "md", className, ...rest }) {
457
+ const field = useFieldContext();
458
+ return /* @__PURE__ */ jsx(
459
+ "input",
460
+ {
461
+ id: rest.id ?? field?.id,
462
+ "aria-describedby": rest["aria-describedby"] ?? field?.describedBy,
463
+ "aria-invalid": rest["aria-invalid"] ?? (field?.invalid || void 0),
464
+ className: cx(Input_default.input, Input_default[`size-${size}`], className),
465
+ ...rest
466
+ }
467
+ );
468
+ }
469
+
470
+ // src/components/PasswordInput/PasswordInput.module.css
471
+ var PasswordInput_default = {
472
+ wrap: "PasswordInput_wrap",
473
+ input: "PasswordInput_input",
474
+ toggle: "PasswordInput_toggle"
475
+ };
476
+ function PasswordInput({ className, ...rest }) {
477
+ const [visible, setVisible] = useState(false);
478
+ return /* @__PURE__ */ jsxs("span", { className: PasswordInput_default.wrap, children: [
479
+ /* @__PURE__ */ jsx(Input, { ...rest, type: visible ? "text" : "password", className: cx(PasswordInput_default.input, className) }),
480
+ /* @__PURE__ */ jsx(
481
+ "button",
482
+ {
483
+ type: "button",
484
+ className: PasswordInput_default.toggle,
485
+ "aria-label": visible ? "Hide password" : "Show password",
486
+ "aria-pressed": visible,
487
+ onClick: () => setVisible((v) => !v),
488
+ children: visible ? (
489
+ /* eye-off */
490
+ /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
491
+ /* @__PURE__ */ jsx("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94" }),
492
+ /* @__PURE__ */ jsx("path", { d: "M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19" }),
493
+ /* @__PURE__ */ jsx("path", { d: "M14.12 14.12a3 3 0 1 1-4.24-4.24" }),
494
+ /* @__PURE__ */ jsx("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
495
+ ] })
496
+ ) : (
497
+ /* eye */
498
+ /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
499
+ /* @__PURE__ */ jsx("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8Z" }),
500
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" })
501
+ ] })
502
+ )
503
+ }
504
+ )
505
+ ] });
506
+ }
507
+
508
+ // src/components/Textarea/Textarea.module.css
509
+ var Textarea_default = {
510
+ textarea: "Textarea_textarea",
511
+ wrap: "Textarea_wrap",
512
+ count: "Textarea_count"
513
+ };
514
+ function Textarea({ rows = 3, showCount = false, className, ...rest }) {
515
+ const field = useFieldContext();
516
+ const [tracked, setTracked] = useState(() => String(rest.defaultValue ?? ""));
517
+ const current = rest.value !== void 0 ? String(rest.value) : tracked;
518
+ const onChange = (event) => {
519
+ setTracked(event.target.value);
520
+ rest.onChange?.(event);
521
+ };
522
+ const textarea = /* @__PURE__ */ jsx(
523
+ "textarea",
524
+ {
525
+ id: rest.id ?? field?.id,
526
+ "aria-describedby": rest["aria-describedby"] ?? field?.describedBy,
527
+ "aria-invalid": rest["aria-invalid"] ?? (field?.invalid || void 0),
528
+ rows,
529
+ className: cx(Textarea_default.textarea, className),
530
+ ...rest,
531
+ ...showCount ? { onChange } : {}
532
+ }
533
+ );
534
+ if (!showCount) return textarea;
535
+ return /* @__PURE__ */ jsxs("span", { className: Textarea_default.wrap, children: [
536
+ textarea,
537
+ /* @__PURE__ */ jsx("span", { className: Textarea_default.count, "aria-hidden": "true", children: rest.maxLength !== void 0 ? `${current.length}/${rest.maxLength}` : current.length })
538
+ ] });
539
+ }
540
+
541
+ // src/components/Select/Select.module.css
542
+ var Select_default = {
543
+ wrap: "Select_wrap",
544
+ select: "Select_select",
545
+ "size-sm": "Select_size-sm",
546
+ "size-md": "Select_size-md",
547
+ "size-lg": "Select_size-lg",
548
+ chevron: "Select_chevron"
549
+ };
550
+ function Select({ size = "md", className, children, ...rest }) {
551
+ const field = useFieldContext();
552
+ return /* @__PURE__ */ jsxs("span", { className: Select_default.wrap, children: [
553
+ /* @__PURE__ */ jsx(
554
+ "select",
555
+ {
556
+ id: rest.id ?? field?.id,
557
+ "aria-describedby": rest["aria-describedby"] ?? field?.describedBy,
558
+ "aria-invalid": rest["aria-invalid"] ?? (field?.invalid || void 0),
559
+ className: cx(Select_default.select, Select_default[`size-${size}`], className),
560
+ ...rest,
561
+ children
562
+ }
563
+ ),
564
+ /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className: Select_default.chevron, children: /* @__PURE__ */ jsx("path", { d: "M4 6l4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) })
565
+ ] });
566
+ }
567
+
568
+ // src/components/Checkbox/Checkbox.module.css
569
+ var Checkbox_default = {
570
+ root: "Checkbox_root",
571
+ box: "Checkbox_box",
572
+ label: "Checkbox_label"
573
+ };
574
+ function Checkbox({ label, className, ...rest }) {
575
+ return /* @__PURE__ */ jsxs("label", { className: cx(Checkbox_default.root, className), children: [
576
+ /* @__PURE__ */ jsx("input", { type: "checkbox", className: Checkbox_default.box, ...rest }),
577
+ /* @__PURE__ */ jsx("span", { className: Checkbox_default.label, children: label })
578
+ ] });
579
+ }
580
+
581
+ // src/components/Radio/Radio.module.css
582
+ var Radio_default = {
583
+ root: "Radio_root",
584
+ dot: "Radio_dot",
585
+ label: "Radio_label"
586
+ };
587
+ function Radio({ label, className, ...rest }) {
588
+ return /* @__PURE__ */ jsxs("label", { className: cx(Radio_default.root, className), children: [
589
+ /* @__PURE__ */ jsx("input", { type: "radio", className: Radio_default.dot, ...rest }),
590
+ /* @__PURE__ */ jsx("span", { className: Radio_default.label, children: label })
591
+ ] });
592
+ }
593
+
594
+ // src/components/Switch/Switch.module.css
595
+ var Switch_default = {
596
+ root: "Switch_root",
597
+ track: "Switch_track",
598
+ label: "Switch_label"
599
+ };
600
+ function Switch({ label, className, ...rest }) {
601
+ return /* @__PURE__ */ jsxs("label", { className: cx(Switch_default.root, className), children: [
602
+ /* @__PURE__ */ jsx("input", { type: "checkbox", role: "switch", className: Switch_default.track, ...rest }),
603
+ /* @__PURE__ */ jsx("span", { className: Switch_default.label, children: label })
604
+ ] });
605
+ }
606
+
607
+ // src/components/SegmentedControl/SegmentedControl.module.css
608
+ var SegmentedControl_default = {
609
+ group: "SegmentedControl_group",
610
+ segment: "SegmentedControl_segment",
611
+ input: "SegmentedControl_input",
612
+ face: "SegmentedControl_face"
613
+ };
614
+ function SegmentedControl({
615
+ label,
616
+ options,
617
+ value,
618
+ onChange,
619
+ className
620
+ }) {
621
+ const name = useId();
622
+ return /* @__PURE__ */ jsx("div", { role: "radiogroup", "aria-label": label, className: cx(SegmentedControl_default.group, className), children: options.map((option) => /* @__PURE__ */ jsxs("label", { className: SegmentedControl_default.segment, children: [
623
+ /* @__PURE__ */ jsx(
624
+ "input",
625
+ {
626
+ type: "radio",
627
+ name,
628
+ value: option.value,
629
+ checked: option.value === value,
630
+ onChange: () => onChange(option.value),
631
+ className: SegmentedControl_default.input
632
+ }
633
+ ),
634
+ /* @__PURE__ */ jsx("span", { className: SegmentedControl_default.face, children: option.label })
635
+ ] }, option.value)) });
636
+ }
637
+
638
+ // src/components/SearchField/SearchField.module.css
639
+ var SearchField_default = {
640
+ wrap: "SearchField_wrap",
641
+ glass: "SearchField_glass",
642
+ input: "SearchField_input",
643
+ clear: "SearchField_clear",
644
+ clearGlyph: "SearchField_clearGlyph"
645
+ };
646
+ function SearchField({ label, value, onChange, className, ...rest }) {
647
+ return /* @__PURE__ */ jsxs("span", { className: cx(SearchField_default.wrap, className), children: [
648
+ /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className: SearchField_default.glass, children: /* @__PURE__ */ jsx(
649
+ "path",
650
+ {
651
+ d: "M7 12a5 5 0 1 1 0-10 5 5 0 0 1 0 10Zm7 2-3.5-3.5",
652
+ fill: "none",
653
+ stroke: "currentColor",
654
+ strokeWidth: "1.5",
655
+ strokeLinecap: "round"
656
+ }
657
+ ) }),
658
+ /* @__PURE__ */ jsx(
659
+ "input",
660
+ {
661
+ type: "search",
662
+ "aria-label": label,
663
+ value,
664
+ onChange: (event) => onChange(event.target.value),
665
+ className: SearchField_default.input,
666
+ ...rest
667
+ }
668
+ ),
669
+ value !== "" && /* @__PURE__ */ jsx(
670
+ "button",
671
+ {
672
+ type: "button",
673
+ "aria-label": "Clear search",
674
+ className: SearchField_default.clear,
675
+ onClick: () => onChange(""),
676
+ children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className: SearchField_default.clearGlyph, children: /* @__PURE__ */ jsx("path", { d: "M4 4l8 8M12 4l-8 8", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round" }) })
677
+ }
678
+ )
679
+ ] });
680
+ }
681
+
682
+ // src/components/List/List.module.css
683
+ var List_default = {
684
+ group: "List_group",
685
+ item: "List_item",
686
+ row: "List_row",
687
+ interactive: "List_interactive",
688
+ leading: "List_leading",
689
+ trailing: "List_trailing",
690
+ text: "List_text",
691
+ title: "List_title",
692
+ description: "List_description"
693
+ };
694
+ function ListGroup({ className, ...rest }) {
695
+ return /* @__PURE__ */ jsx("ul", { className: cx(List_default.group, className), ...rest });
696
+ }
697
+ function ListItem({
698
+ title,
699
+ description,
700
+ leading,
701
+ trailing,
702
+ onClick,
703
+ href,
704
+ className,
705
+ ...rest
706
+ }) {
707
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
708
+ leading != null && /* @__PURE__ */ jsx("span", { className: List_default.leading, children: leading }),
709
+ /* @__PURE__ */ jsxs("span", { className: List_default.text, children: [
710
+ /* @__PURE__ */ jsx("span", { className: List_default.title, children: title }),
711
+ description != null && /* @__PURE__ */ jsx("span", { className: List_default.description, children: description })
712
+ ] }),
713
+ trailing != null && /* @__PURE__ */ jsx("span", { className: List_default.trailing, children: trailing })
714
+ ] });
715
+ return /* @__PURE__ */ jsx("li", { className: cx(List_default.item, className), ...rest, children: href !== void 0 ? /* @__PURE__ */ jsx("a", { className: cx(List_default.row, List_default.interactive), href, children: content }) : onClick !== void 0 ? /* @__PURE__ */ jsx("button", { type: "button", className: cx(List_default.row, List_default.interactive), onClick, children: content }) : /* @__PURE__ */ jsx("span", { className: List_default.row, children: content }) });
716
+ }
717
+
718
+ // src/components/EmptyState/EmptyState.module.css
719
+ var EmptyState_default = {
720
+ root: "EmptyState_root",
721
+ icon: "EmptyState_icon",
722
+ action: "EmptyState_action"
723
+ };
724
+ function EmptyState({ title, description, icon, action, className }) {
725
+ return /* @__PURE__ */ jsxs("div", { className: cx(EmptyState_default.root, className), children: [
726
+ icon != null && /* @__PURE__ */ jsx("span", { className: EmptyState_default.icon, "aria-hidden": "true", children: icon }),
727
+ /* @__PURE__ */ jsx(Heading, { level: 3, children: title }),
728
+ description !== void 0 && /* @__PURE__ */ jsx(Text, { tone: "secondary", children: description }),
729
+ action != null && /* @__PURE__ */ jsx("span", { className: EmptyState_default.action, children: action })
730
+ ] });
731
+ }
732
+
733
+ // src/components/Tabs/Tabs.module.css
734
+ var Tabs_default = {
735
+ list: "Tabs_list",
736
+ tab: "Tabs_tab",
737
+ selected: "Tabs_selected",
738
+ panel: "Tabs_panel"
739
+ };
740
+ var TabsContext = createContext(null);
741
+ function useTabs(component) {
742
+ const context = useContext(TabsContext);
743
+ if (context === null) throw new Error(`${component} must sit inside <Tabs>`);
744
+ return context;
745
+ }
746
+ function Tabs({ value, onChange, children }) {
747
+ const baseId = useId();
748
+ return /* @__PURE__ */ jsx(TabsContext.Provider, { value: { value, onChange, baseId }, children });
749
+ }
750
+ function onArrow(event, onChange) {
751
+ const keys = ["ArrowLeft", "ArrowRight", "Home", "End"];
752
+ if (!keys.includes(event.key)) return;
753
+ const tabs = [...event.currentTarget.querySelectorAll('[role="tab"]')];
754
+ const current = tabs.findIndex((tab2) => tab2 === document.activeElement);
755
+ if (current === -1) return;
756
+ event.preventDefault();
757
+ const next = event.key === "Home" ? 0 : event.key === "End" ? tabs.length - 1 : (current + (event.key === "ArrowRight" ? 1 : -1) + tabs.length) % tabs.length;
758
+ const tab = tabs[next];
759
+ if (!tab) return;
760
+ tab.focus();
761
+ const value = tab.dataset.value;
762
+ if (value !== void 0) onChange(value);
763
+ }
764
+ function TabList({ label, className, children, ...rest }) {
765
+ const { onChange } = useTabs("TabList");
766
+ return /* @__PURE__ */ jsx(
767
+ "div",
768
+ {
769
+ role: "tablist",
770
+ "aria-label": label,
771
+ className: cx(Tabs_default.list, className),
772
+ onKeyDown: (event) => onArrow(event, onChange),
773
+ ...rest,
774
+ children
775
+ }
776
+ );
777
+ }
778
+ function Tab({ value, className, children, ...rest }) {
779
+ const tabs = useTabs("Tab");
780
+ const selected = tabs.value === value;
781
+ return /* @__PURE__ */ jsx(
782
+ "button",
783
+ {
784
+ type: "button",
785
+ role: "tab",
786
+ id: `${tabs.baseId}-tab-${value}`,
787
+ "aria-selected": selected,
788
+ "aria-controls": `${tabs.baseId}-panel-${value}`,
789
+ tabIndex: selected ? 0 : -1,
790
+ "data-value": value,
791
+ className: cx(Tabs_default.tab, selected && Tabs_default.selected, className),
792
+ onClick: () => tabs.onChange(value),
793
+ ...rest,
794
+ children
795
+ }
796
+ );
797
+ }
798
+ function TabPanel({ value, className, children, ...rest }) {
799
+ const tabs = useTabs("TabPanel");
800
+ const selected = tabs.value === value;
801
+ return /* @__PURE__ */ jsx(
802
+ "div",
803
+ {
804
+ role: "tabpanel",
805
+ id: `${tabs.baseId}-panel-${value}`,
806
+ "aria-labelledby": `${tabs.baseId}-tab-${value}`,
807
+ hidden: !selected,
808
+ className: cx(Tabs_default.panel, className),
809
+ ...rest,
810
+ children
811
+ }
812
+ );
813
+ }
814
+
815
+ // src/components/Toast/Toast.module.css
816
+ var Toast_default = {
817
+ viewport: "Toast_viewport",
818
+ toast: "Toast_toast",
819
+ "tone-success": "Toast_tone-success",
820
+ "tone-danger": "Toast_tone-danger",
821
+ body: "Toast_body",
822
+ title: "Toast_title",
823
+ description: "Toast_description",
824
+ close: "Toast_close",
825
+ closeGlyph: "Toast_closeGlyph"
826
+ };
827
+ var ToastContext = createContext(null);
828
+ function useToast() {
829
+ const context = useContext(ToastContext);
830
+ if (context === null) throw new Error("useToast needs a <ToastProvider> above it");
831
+ return context;
832
+ }
833
+ function ToastProvider({ children }) {
834
+ const [toasts, setToasts] = useState([]);
835
+ const nextId = useRef(1);
836
+ const dismiss = useCallback((id) => {
837
+ setToasts((current) => current.filter((entry) => entry.id !== id));
838
+ }, []);
839
+ const toast = useCallback(
840
+ ({ title, description, tone = "neutral", duration = 5e3 }) => {
841
+ const id = nextId.current++;
842
+ setToasts((current) => [...current, { id, title, description, tone }]);
843
+ if (duration > 0) setTimeout(() => dismiss(id), duration);
844
+ return id;
845
+ },
846
+ [dismiss]
847
+ );
848
+ const value = useMemo(() => ({ toast, dismiss }), [toast, dismiss]);
849
+ return /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
850
+ children,
851
+ /* @__PURE__ */ jsx("div", { role: "region", "aria-label": "Notifications", className: Toast_default.viewport, children: toasts.map((entry) => /* @__PURE__ */ jsxs("div", { role: "status", className: cx(Toast_default.toast, Toast_default[`tone-${entry.tone}`]), children: [
852
+ /* @__PURE__ */ jsxs("span", { className: Toast_default.body, children: [
853
+ /* @__PURE__ */ jsx("span", { className: Toast_default.title, children: entry.title }),
854
+ entry.description !== void 0 && /* @__PURE__ */ jsx("span", { className: Toast_default.description, children: entry.description })
855
+ ] }),
856
+ /* @__PURE__ */ jsx(
857
+ "button",
858
+ {
859
+ type: "button",
860
+ "aria-label": "Dismiss",
861
+ className: Toast_default.close,
862
+ onClick: () => dismiss(entry.id),
863
+ children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className: Toast_default.closeGlyph, children: /* @__PURE__ */ jsx("path", { d: "M4 4l8 8M12 4l-8 8", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round" }) })
864
+ }
865
+ )
866
+ ] }, entry.id)) })
867
+ ] });
868
+ }
869
+
870
+ // src/components/Stack/Stack.module.css
871
+ var Stack_default = {
872
+ stack: "Stack_stack",
873
+ "gap-hairline": "Stack_gap-hairline",
874
+ "gap-tight": "Stack_gap-tight",
875
+ "gap-base": "Stack_gap-base",
876
+ "gap-loose": "Stack_gap-loose",
877
+ "gap-section": "Stack_gap-section",
878
+ "align-start": "Stack_align-start",
879
+ "align-center": "Stack_align-center",
880
+ "align-end": "Stack_align-end",
881
+ "align-stretch": "Stack_align-stretch"
882
+ };
883
+
884
+ // src/components/Stack/Stack.tsx
885
+ function Stack({
886
+ gap = "base",
887
+ align = "stretch",
888
+ as = "div",
889
+ className,
890
+ ...rest
891
+ }) {
892
+ return createElement(as, {
893
+ className: cx(Stack_default.stack, Stack_default[`gap-${gap}`], Stack_default[`align-${align}`], className),
894
+ ...rest
895
+ });
896
+ }
897
+
898
+ // src/components/Inline/Inline.module.css
899
+ var Inline_default = {
900
+ inline: "Inline_inline",
901
+ "gap-hairline": "Inline_gap-hairline",
902
+ "gap-tight": "Inline_gap-tight",
903
+ "gap-base": "Inline_gap-base",
904
+ "gap-loose": "Inline_gap-loose",
905
+ "align-start": "Inline_align-start",
906
+ "align-center": "Inline_align-center",
907
+ "align-end": "Inline_align-end",
908
+ "align-baseline": "Inline_align-baseline",
909
+ "justify-start": "Inline_justify-start",
910
+ "justify-center": "Inline_justify-center",
911
+ "justify-end": "Inline_justify-end",
912
+ "justify-between": "Inline_justify-between",
913
+ wrap: "Inline_wrap"
914
+ };
915
+
916
+ // src/components/Inline/Inline.tsx
917
+ function Inline({
918
+ gap = "base",
919
+ align = "center",
920
+ justify = "start",
921
+ wrap = false,
922
+ as = "div",
923
+ className,
924
+ ...rest
925
+ }) {
926
+ return createElement(as, {
927
+ className: cx(
928
+ Inline_default.inline,
929
+ Inline_default[`gap-${gap}`],
930
+ Inline_default[`align-${align}`],
931
+ Inline_default[`justify-${justify}`],
932
+ wrap && Inline_default.wrap,
933
+ className
934
+ ),
935
+ ...rest
936
+ });
937
+ }
938
+
939
+ // src/components/Container/Container.module.css
940
+ var Container_default = {
941
+ container: "Container_container",
942
+ "width-content": "Container_width-content",
943
+ "width-wide": "Container_width-wide"
944
+ };
945
+
946
+ // src/components/Container/Container.tsx
947
+ function Container({
948
+ width = "content",
949
+ as = "div",
950
+ className,
951
+ ...rest
952
+ }) {
953
+ return createElement(as, {
954
+ className: cx(Container_default.container, Container_default[`width-${width}`], className),
955
+ ...rest
956
+ });
957
+ }
958
+
959
+ // src/components/Card/Card.module.css
960
+ var Card_default = {
961
+ card: "Card_card",
962
+ "variant-raised": "Card_variant-raised",
963
+ interactive: "Card_interactive",
964
+ header: "Card_header",
965
+ body: "Card_body",
966
+ footer: "Card_footer"
967
+ };
968
+ function Card({ children, variant = "card", onClick, href, className, ...rest }) {
969
+ const cardClass = cx(Card_default.card, Card_default[`variant-${variant}`], className);
970
+ if (href !== void 0) {
971
+ return /* @__PURE__ */ jsx("a", { className: cx(cardClass, Card_default.interactive), href, ...rest, children });
972
+ }
973
+ if (onClick !== void 0) {
974
+ return /* @__PURE__ */ jsx("button", { type: "button", className: cx(cardClass, Card_default.interactive), onClick, ...rest, children });
975
+ }
976
+ return /* @__PURE__ */ jsx("div", { className: cardClass, ...rest, children });
977
+ }
978
+ function CardHeader({ className, ...rest }) {
979
+ return /* @__PURE__ */ jsx("div", { className: cx(Card_default.header, className), ...rest });
980
+ }
981
+ function CardBody({ className, ...rest }) {
982
+ return /* @__PURE__ */ jsx("div", { className: cx(Card_default.body, className), ...rest });
983
+ }
984
+ function CardFooter({ className, ...rest }) {
985
+ return /* @__PURE__ */ jsx("div", { className: cx(Card_default.footer, className), ...rest });
986
+ }
987
+ var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
988
+ function useOverlay(options) {
989
+ const ref = useRef(null);
990
+ const { open, onClose } = options;
991
+ const close = useRef(onClose);
992
+ useEffect(() => {
993
+ close.current = onClose;
994
+ }, [onClose]);
995
+ useEffect(() => {
996
+ if (!open) return;
997
+ const panel = ref.current;
998
+ const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null;
999
+ panel?.focus();
1000
+ const onKeyDown = (event) => {
1001
+ if (event.key === "Escape") {
1002
+ event.stopPropagation();
1003
+ close.current();
1004
+ return;
1005
+ }
1006
+ if (event.key !== "Tab" || !panel) return;
1007
+ const focusable = [...panel.querySelectorAll(FOCUSABLE)];
1008
+ if (focusable.length === 0) {
1009
+ event.preventDefault();
1010
+ panel.focus();
1011
+ return;
1012
+ }
1013
+ const first = focusable[0];
1014
+ const last = focusable[focusable.length - 1];
1015
+ const active = document.activeElement;
1016
+ if (event.shiftKey && (active === first || active === panel)) {
1017
+ event.preventDefault();
1018
+ last?.focus();
1019
+ } else if (!event.shiftKey && active === last) {
1020
+ event.preventDefault();
1021
+ first?.focus();
1022
+ }
1023
+ };
1024
+ document.addEventListener("keydown", onKeyDown);
1025
+ const bodyOverflow = document.body.style.overflow;
1026
+ document.body.style.overflow = "hidden";
1027
+ return () => {
1028
+ document.removeEventListener("keydown", onKeyDown);
1029
+ document.body.style.overflow = bodyOverflow;
1030
+ previous?.focus();
1031
+ };
1032
+ }, [open]);
1033
+ return ref;
1034
+ }
1035
+ function usePresence(open, durationMs) {
1036
+ const [mounted, setMounted] = useState(open);
1037
+ if (open && !mounted) setMounted(true);
1038
+ useEffect(() => {
1039
+ if (open) return;
1040
+ const timer = setTimeout(() => setMounted(false), durationMs);
1041
+ return () => clearTimeout(timer);
1042
+ }, [open, durationMs]);
1043
+ return { mounted: open || mounted, visible: open };
1044
+ }
1045
+
1046
+ // src/components/Overlay/Overlay.module.css
1047
+ var Overlay_default = {
1048
+ scrim: "Overlay_scrim",
1049
+ "variant-modal": "Overlay_variant-modal",
1050
+ "variant-sheet": "Overlay_variant-sheet"
1051
+ };
1052
+ var OVERLAY_EXIT_MS = 200;
1053
+ function Overlay({ open, onClose, label, variant, closeOnScrimClick, panelClassName, children }) {
1054
+ const { mounted, visible } = usePresence(open, OVERLAY_EXIT_MS);
1055
+ const ref = useOverlay({ open, onClose });
1056
+ if (!mounted) return null;
1057
+ return createPortal(
1058
+ /* @__PURE__ */ jsx(
1059
+ "div",
1060
+ {
1061
+ className: cx(Overlay_default.scrim, Overlay_default[`variant-${variant}`]),
1062
+ "data-open": visible || void 0,
1063
+ "data-testid": "mds-scrim",
1064
+ onClick: closeOnScrimClick ? onClose : void 0,
1065
+ children: /* @__PURE__ */ jsx(
1066
+ "div",
1067
+ {
1068
+ ref,
1069
+ role: "dialog",
1070
+ "aria-modal": "true",
1071
+ "aria-label": label,
1072
+ tabIndex: -1,
1073
+ className: panelClassName,
1074
+ "data-open": visible || void 0,
1075
+ onClick: (event) => event.stopPropagation(),
1076
+ children
1077
+ }
1078
+ )
1079
+ }
1080
+ ),
1081
+ document.body
1082
+ );
1083
+ }
1084
+
1085
+ // src/components/Modal/Modal.module.css
1086
+ var Modal_default = {
1087
+ panel: "Modal_panel",
1088
+ header: "Modal_header",
1089
+ body: "Modal_body",
1090
+ footer: "Modal_footer"
1091
+ };
1092
+ function Modal({ open, onClose, label, closeOnScrimClick = true, children }) {
1093
+ return /* @__PURE__ */ jsx(
1094
+ Overlay,
1095
+ {
1096
+ open,
1097
+ onClose,
1098
+ label,
1099
+ variant: "modal",
1100
+ closeOnScrimClick,
1101
+ panelClassName: Modal_default.panel,
1102
+ children
1103
+ }
1104
+ );
1105
+ }
1106
+ function ModalHeader({ children }) {
1107
+ return /* @__PURE__ */ jsx("div", { className: Modal_default.header, children });
1108
+ }
1109
+ function ModalBody({ children }) {
1110
+ return /* @__PURE__ */ jsx("div", { className: Modal_default.body, children });
1111
+ }
1112
+ function ModalFooter({ children }) {
1113
+ return /* @__PURE__ */ jsx("div", { className: Modal_default.footer, children });
1114
+ }
1115
+
1116
+ // src/components/Sheet/Sheet.module.css
1117
+ var Sheet_default = {
1118
+ panel: "Sheet_panel",
1119
+ header: "Sheet_header",
1120
+ body: "Sheet_body",
1121
+ footer: "Sheet_footer"
1122
+ };
1123
+ function Sheet({ open, onClose, label, closeOnScrimClick = true, children }) {
1124
+ return /* @__PURE__ */ jsx(
1125
+ Overlay,
1126
+ {
1127
+ open,
1128
+ onClose,
1129
+ label,
1130
+ variant: "sheet",
1131
+ closeOnScrimClick,
1132
+ panelClassName: Sheet_default.panel,
1133
+ children
1134
+ }
1135
+ );
1136
+ }
1137
+ function SheetHeader({ children }) {
1138
+ return /* @__PURE__ */ jsx("div", { className: Sheet_default.header, children });
1139
+ }
1140
+ function SheetBody({ children }) {
1141
+ return /* @__PURE__ */ jsx("div", { className: Sheet_default.body, children });
1142
+ }
1143
+ function SheetFooter({ children }) {
1144
+ return /* @__PURE__ */ jsx("div", { className: Sheet_default.footer, children });
1145
+ }
1146
+
1147
+ // src/components/ConfirmDialog/ConfirmDialog.module.css
1148
+ var ConfirmDialog_default = {
1149
+ description: "ConfirmDialog_description"
1150
+ };
1151
+ function ConfirmDialog({
1152
+ open,
1153
+ onClose,
1154
+ onConfirm,
1155
+ title,
1156
+ description,
1157
+ confirmLabel,
1158
+ cancelLabel = "Cancel",
1159
+ danger = false
1160
+ }) {
1161
+ return /* @__PURE__ */ jsxs(Modal, { open, onClose, label: title, closeOnScrimClick: false, children: [
1162
+ /* @__PURE__ */ jsx(ModalHeader, { children: title }),
1163
+ /* @__PURE__ */ jsx(ModalBody, { children: description ? /* @__PURE__ */ jsx("p", { className: ConfirmDialog_default.description, children: description }) : null }),
1164
+ /* @__PURE__ */ jsxs(ModalFooter, { children: [
1165
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: onClose, children: cancelLabel }),
1166
+ /* @__PURE__ */ jsx(Button, { variant: danger ? "danger" : "primary", onClick: onConfirm, children: confirmLabel })
1167
+ ] })
1168
+ ] });
1169
+ }
1170
+
1171
+ // src/components/Screen/Screen.module.css
1172
+ var Screen_default = {
1173
+ screen: "Screen_screen",
1174
+ content: "Screen_content"
1175
+ };
1176
+ function Screen({ children }) {
1177
+ return /* @__PURE__ */ jsx("div", { className: Screen_default.screen, children });
1178
+ }
1179
+ function ScreenContent({ children }) {
1180
+ return /* @__PURE__ */ jsx("main", { className: Screen_default.content, children });
1181
+ }
1182
+
1183
+ // src/components/AppBar/AppBar.module.css
1184
+ var AppBar_default = {
1185
+ bar: "AppBar_bar",
1186
+ title: "AppBar_title",
1187
+ slot: "AppBar_slot"
1188
+ };
1189
+ function AppBar({ title, leading, trailing }) {
1190
+ return /* @__PURE__ */ jsxs("header", { className: AppBar_default.bar, children: [
1191
+ leading ? /* @__PURE__ */ jsx("div", { className: AppBar_default.slot, children: leading }) : null,
1192
+ title ? /* @__PURE__ */ jsx("h1", { className: AppBar_default.title, children: title }) : null,
1193
+ trailing ? /* @__PURE__ */ jsx("div", { className: AppBar_default.slot, children: trailing }) : null
1194
+ ] });
1195
+ }
1196
+
1197
+ // src/components/TabBar/TabBar.module.css
1198
+ var TabBar_default = {
1199
+ bar: "TabBar_bar",
1200
+ item: "TabBar_item",
1201
+ active: "TabBar_active",
1202
+ icon: "TabBar_icon",
1203
+ label: "TabBar_label"
1204
+ };
1205
+ function TabBar({ label, children }) {
1206
+ return /* @__PURE__ */ jsx("nav", { "aria-label": label, className: TabBar_default.bar, children });
1207
+ }
1208
+ function TabBarItem({ label, icon, href, onClick, active = false }) {
1209
+ const className = cx(TabBar_default.item, active && TabBar_default.active);
1210
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
1211
+ /* @__PURE__ */ jsx("span", { className: TabBar_default.icon, "aria-hidden": "true", children: icon }),
1212
+ /* @__PURE__ */ jsx("span", { className: TabBar_default.label, children: label })
1213
+ ] });
1214
+ if (href !== void 0) {
1215
+ return /* @__PURE__ */ jsx("a", { href, className, "aria-current": active ? "page" : void 0, onClick, children: content });
1216
+ }
1217
+ return /* @__PURE__ */ jsx("button", { type: "button", className, "aria-current": active ? "page" : void 0, onClick, children: content });
1218
+ }
1219
+ function useRovingGroup(ref, { selector, orientation = "horizontal" }) {
1220
+ return useCallback(
1221
+ (event) => {
1222
+ const horizontal = orientation !== "vertical";
1223
+ const vertical = orientation !== "horizontal";
1224
+ const forward = horizontal && event.key === "ArrowRight" || vertical && event.key === "ArrowDown";
1225
+ const backward = horizontal && event.key === "ArrowLeft" || vertical && event.key === "ArrowUp";
1226
+ const home = event.key === "Home";
1227
+ const end = event.key === "End";
1228
+ if (!forward && !backward && !home && !end) return;
1229
+ const container = ref.current;
1230
+ if (container === null) return;
1231
+ const items = [...container.querySelectorAll(selector)].filter(
1232
+ (item) => !item.hasAttribute("disabled")
1233
+ );
1234
+ const current = items.indexOf(document.activeElement);
1235
+ if (items.length === 0 || current === -1) return;
1236
+ event.preventDefault();
1237
+ const next = home ? 0 : end ? items.length - 1 : (current + (forward ? 1 : -1) + items.length) % items.length;
1238
+ items[next]?.focus();
1239
+ },
1240
+ [ref, selector, orientation]
1241
+ );
1242
+ }
1243
+
1244
+ export { AppBar, Avatar, AvatarGroup, Badge, Button, Card, CardBody, CardFooter, CardHeader, Checkbox, ConfirmDialog, Container, Divider, EmptyState, Field, Heading, Icon, IconProvider, Inline, Input, Link, ListGroup, ListItem, Modal, ModalBody, ModalFooter, ModalHeader, PasswordInput, ProgressBar, Radio, Screen, ScreenContent, SearchField, SegmentedControl, Select, Sheet, SheetBody, SheetFooter, SheetHeader, Skeleton, Spinner, Stack, Switch, Tab, TabBar, TabBarItem, TabList, TabPanel, Tabs, Tag, Text, Textarea, ToastProvider, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
1245
+ //# sourceMappingURL=index.js.map
1246
+ //# sourceMappingURL=index.js.map