@med-o/ui 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +59 -2
- package/dist/index.js +718 -657
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/src/alert/alert.css +1 -0
- package/src/button/button.css +1 -1
- package/src/layout/layout.css +148 -0
- package/src/list-view/list-view.css +1 -1
- package/src/media/media.css +1 -1
- package/src/styles.css +1 -0
package/dist/index.js
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
// src/utils/cx.ts
|
|
4
|
+
var cx = (...classes) => classes.filter(Boolean).join(" ");
|
|
5
|
+
|
|
6
|
+
// src/layout/Layout.tsx
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
function Stack({ as: Tag2 = "div", direction = "vertical", gap, align, justify, wrap, className, ...props }) {
|
|
9
|
+
const El = Tag2;
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
El,
|
|
12
|
+
{
|
|
13
|
+
...props,
|
|
14
|
+
className: cx(
|
|
15
|
+
"medo-stack",
|
|
16
|
+
direction === "horizontal" && "medo-stack--horizontal",
|
|
17
|
+
wrap && "medo-stack--wrap",
|
|
18
|
+
align && `medo-stack--align-${align}`,
|
|
19
|
+
justify && `medo-stack--justify-${justify}`,
|
|
20
|
+
gap && `medo-gap-${gap}`,
|
|
21
|
+
className
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function Grid({ as: Tag2 = "div", columns, minItemSize, gap, className, style, ...props }) {
|
|
27
|
+
const El = Tag2;
|
|
28
|
+
const vars = {
|
|
29
|
+
...typeof columns === "number" ? { "--medo-grid-columns": columns } : {},
|
|
30
|
+
...minItemSize ? { "--medo-grid-min": minItemSize } : {}
|
|
31
|
+
};
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
El,
|
|
34
|
+
{
|
|
35
|
+
...props,
|
|
36
|
+
style: { ...vars, ...style },
|
|
37
|
+
className: cx(
|
|
38
|
+
"medo-grid",
|
|
39
|
+
typeof columns === "number" && "medo-grid--columns",
|
|
40
|
+
columns === "layout" && "medo-grid--layout",
|
|
41
|
+
gap && `medo-gap-${gap}`,
|
|
42
|
+
className
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function GridItem({ as: Tag2 = "div", span = 1, className, style, ...props }) {
|
|
48
|
+
const El = Tag2;
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
El,
|
|
51
|
+
{
|
|
52
|
+
...props,
|
|
53
|
+
style: span === "full" ? style : { "--medo-grid-span": span, ...style },
|
|
54
|
+
className: cx("medo-grid__item", span === "full" && "medo-grid__item--full", className)
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function Container({ as: Tag2 = "div", size = "xl", className, ...props }) {
|
|
59
|
+
const El = Tag2;
|
|
60
|
+
return /* @__PURE__ */ jsx(El, { ...props, className: cx("medo-container", size !== "xl" && `medo-container--${size}`, className) });
|
|
61
|
+
}
|
|
62
|
+
|
|
3
63
|
// src/button/Button.tsx
|
|
4
64
|
import { Button as AriaButton } from "react-aria-components";
|
|
5
65
|
|
|
@@ -7,9 +67,6 @@ import { Button as AriaButton } from "react-aria-components";
|
|
|
7
67
|
import { useId } from "react";
|
|
8
68
|
import { Label, ProgressBar as AriaProgressBar } from "react-aria-components";
|
|
9
69
|
|
|
10
|
-
// src/utils/cx.ts
|
|
11
|
-
var cx = (...classes) => classes.filter(Boolean).join(" ");
|
|
12
|
-
|
|
13
70
|
// src/i18n/I18n.tsx
|
|
14
71
|
import { createContext, useContext } from "react";
|
|
15
72
|
import { useLocale } from "react-aria-components";
|
|
@@ -316,11 +373,11 @@ var en = {
|
|
|
316
373
|
};
|
|
317
374
|
|
|
318
375
|
// src/i18n/I18n.tsx
|
|
319
|
-
import { jsx } from "react/jsx-runtime";
|
|
376
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
320
377
|
var builtIn = { en, de };
|
|
321
378
|
var MessagesContext = createContext(null);
|
|
322
379
|
function MessagesProvider({ messages, children }) {
|
|
323
|
-
return /* @__PURE__ */
|
|
380
|
+
return /* @__PURE__ */ jsx2(MessagesContext.Provider, { value: messages, children });
|
|
324
381
|
}
|
|
325
382
|
function useMessages() {
|
|
326
383
|
const custom = useContext(MessagesContext);
|
|
@@ -329,18 +386,18 @@ function useMessages() {
|
|
|
329
386
|
}
|
|
330
387
|
|
|
331
388
|
// src/progress/Progress.tsx
|
|
332
|
-
import { Fragment, jsx as
|
|
389
|
+
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
333
390
|
var SpinnerGraphic = () => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: [
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
-
/* @__PURE__ */
|
|
391
|
+
/* @__PURE__ */ jsx3("circle", { className: "medo-spinner__track", cx: "12", cy: "12", r: "10" }),
|
|
392
|
+
/* @__PURE__ */ jsx3("circle", { className: "medo-spinner__arc", cx: "12", cy: "12", r: "10", pathLength: 100 })
|
|
336
393
|
] });
|
|
337
394
|
function Spinner({ size = "md", tone = "current", decorative, className, style, ...props }) {
|
|
338
395
|
const m = useMessages();
|
|
339
396
|
const classes = cx("medo-spinner", `medo-spinner--${size}`, tone !== "current" && `medo-spinner--${tone}`, className);
|
|
340
397
|
if (decorative) {
|
|
341
|
-
return /* @__PURE__ */
|
|
398
|
+
return /* @__PURE__ */ jsx3("span", { className: classes, style, "aria-hidden": "true", children: /* @__PURE__ */ jsx3(SpinnerGraphic, {}) });
|
|
342
399
|
}
|
|
343
|
-
return /* @__PURE__ */
|
|
400
|
+
return /* @__PURE__ */ jsx3(AriaProgressBar, { isIndeterminate: true, "aria-label": props["aria-label"] ?? m.common.loading, className: classes, style, children: /* @__PURE__ */ jsx3(SpinnerGraphic, {}) });
|
|
344
401
|
}
|
|
345
402
|
function ProgressBar({
|
|
346
403
|
label,
|
|
@@ -353,7 +410,7 @@ function ProgressBar({
|
|
|
353
410
|
...props
|
|
354
411
|
}) {
|
|
355
412
|
const descriptionId = useId();
|
|
356
|
-
return /* @__PURE__ */
|
|
413
|
+
return /* @__PURE__ */ jsx3(
|
|
357
414
|
AriaProgressBar,
|
|
358
415
|
{
|
|
359
416
|
...props,
|
|
@@ -368,31 +425,31 @@ function ProgressBar({
|
|
|
368
425
|
style,
|
|
369
426
|
children: ({ percentage, valueText, isIndeterminate }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
370
427
|
(label || showValue && !isIndeterminate) && /* @__PURE__ */ jsxs("div", { className: "medo-progress__header", children: [
|
|
371
|
-
label && /* @__PURE__ */
|
|
372
|
-
showValue && !isIndeterminate && /* @__PURE__ */
|
|
428
|
+
label && /* @__PURE__ */ jsx3(Label, { className: "medo-progress__label", children: label }),
|
|
429
|
+
showValue && !isIndeterminate && /* @__PURE__ */ jsx3("span", { className: "medo-progress__value", children: valueText })
|
|
373
430
|
] }),
|
|
374
|
-
/* @__PURE__ */
|
|
431
|
+
/* @__PURE__ */ jsx3("div", { className: "medo-progress__track", children: /* @__PURE__ */ jsx3("div", { className: "medo-progress__fill", style: isIndeterminate ? void 0 : { inlineSize: `${percentage}%` } }) }),
|
|
375
432
|
description && // Live only for the final state, so regular updates (“12 s left”) do not chatter.
|
|
376
|
-
/* @__PURE__ */
|
|
433
|
+
/* @__PURE__ */ jsx3("span", { id: descriptionId, className: "medo-progress__description", "aria-live": status === "default" ? void 0 : "polite", children: description })
|
|
377
434
|
] })
|
|
378
435
|
}
|
|
379
436
|
);
|
|
380
437
|
}
|
|
381
438
|
function Skeleton({ shape = "text", lines = 1, width, height, className }) {
|
|
382
439
|
const style = { inlineSize: width, blockSize: height };
|
|
383
|
-
const one = (key) => /* @__PURE__ */
|
|
440
|
+
const one = (key) => /* @__PURE__ */ jsx3("span", { className: cx("medo-skeleton", `medo-skeleton--${shape}`, className), style, "aria-hidden": "true" }, key);
|
|
384
441
|
if (shape !== "text" || lines <= 1) return one();
|
|
385
|
-
return /* @__PURE__ */
|
|
442
|
+
return /* @__PURE__ */ jsx3("span", { className: "medo-skeleton-lines", "aria-hidden": "true", children: Array.from({ length: lines }, (_, i) => one(i)) });
|
|
386
443
|
}
|
|
387
444
|
|
|
388
445
|
// src/button/Button.tsx
|
|
389
|
-
import { jsx as
|
|
446
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
390
447
|
function Button({ variant = "primary", size = "md", startIcon, endIcon, className, children, ...props }) {
|
|
391
|
-
const icon = props.isPending ? /* @__PURE__ */
|
|
448
|
+
const icon = props.isPending ? /* @__PURE__ */ jsx4(Spinner, { decorative: true }) : startIcon;
|
|
392
449
|
return /* @__PURE__ */ jsxs2(AriaButton, { ...props, className: cx("medo-button", `medo-button--${variant}`, `medo-button--${size}`, className), children: [
|
|
393
|
-
icon && /* @__PURE__ */
|
|
394
|
-
/* @__PURE__ */
|
|
395
|
-
endIcon && /* @__PURE__ */
|
|
450
|
+
icon && /* @__PURE__ */ jsx4("span", { className: "medo-button__icon", "aria-hidden": "true", children: icon }),
|
|
451
|
+
/* @__PURE__ */ jsx4("span", { className: "medo-button__label", children }),
|
|
452
|
+
endIcon && /* @__PURE__ */ jsx4("span", { className: "medo-button__icon", "aria-hidden": "true", children: endIcon })
|
|
396
453
|
] });
|
|
397
454
|
}
|
|
398
455
|
function ButtonGroup({ context = "footer", children, destructive, className, ...props }) {
|
|
@@ -403,7 +460,7 @@ function ButtonGroup({ context = "footer", children, destructive, className, ...
|
|
|
403
460
|
"aria-label": props["aria-label"],
|
|
404
461
|
className: cx("medo-button-group", `medo-button-group--${context}`, className),
|
|
405
462
|
children: [
|
|
406
|
-
destructive && context === "footer" && /* @__PURE__ */
|
|
463
|
+
destructive && context === "footer" && /* @__PURE__ */ jsx4("div", { className: "medo-button-group__destructive", children: destructive }),
|
|
407
464
|
children
|
|
408
465
|
]
|
|
409
466
|
}
|
|
@@ -421,9 +478,9 @@ import {
|
|
|
421
478
|
TooltipTrigger as AriaTooltipTrigger,
|
|
422
479
|
TooltipTriggerStateContext
|
|
423
480
|
} from "react-aria-components";
|
|
424
|
-
import { jsx as
|
|
481
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
425
482
|
function TooltipTrigger({ delay = 500, closeDelay = 100, ...props }) {
|
|
426
|
-
return /* @__PURE__ */
|
|
483
|
+
return /* @__PURE__ */ jsx5(AriaTooltipTrigger, { delay, closeDelay, ...props });
|
|
427
484
|
}
|
|
428
485
|
var KEY_LABELS = { Meta: "\u2318", Shift: "\u21E7", Alt: "Alt" };
|
|
429
486
|
var isApple = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
|
|
@@ -431,32 +488,32 @@ var resolveShortcut = (keys) => keys.replace(/\bMod\b/g, isApple() ? "Meta" : "C
|
|
|
431
488
|
var formatShortcut = (keys, control = "Ctrl") => resolveShortcut(keys).split("+").map((k) => k === "Control" ? control : KEY_LABELS[k] ?? k).join(" ");
|
|
432
489
|
function Tooltip({ children, shortcut, placement = "top", offset = 8, className, ...props }) {
|
|
433
490
|
return /* @__PURE__ */ jsxs3(AriaTooltip, { ...props, placement, offset, className: cx("medo-tooltip", className), children: [
|
|
434
|
-
/* @__PURE__ */
|
|
435
|
-
shortcut && /* @__PURE__ */
|
|
491
|
+
/* @__PURE__ */ jsx5("span", { children }),
|
|
492
|
+
shortcut && /* @__PURE__ */ jsx5("kbd", { className: "medo-tooltip__shortcut", children: shortcut })
|
|
436
493
|
] });
|
|
437
494
|
}
|
|
438
495
|
function TooltipLink(props) {
|
|
439
496
|
const tooltip = useContext2(TooltipTriggerStateContext);
|
|
440
|
-
return /* @__PURE__ */
|
|
497
|
+
return /* @__PURE__ */ jsx5(AriaLink, { ...props, onHoverStart: () => tooltip?.open(), onHoverEnd: () => tooltip?.close() });
|
|
441
498
|
}
|
|
442
499
|
|
|
443
500
|
// src/icon-button/IconButton.tsx
|
|
444
|
-
import { jsx as
|
|
501
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
445
502
|
function IconButton({ icon, variant = "ghost", size = "md", tooltip, shortcut, shortcutLabel, className, ...props }) {
|
|
446
503
|
const m = useMessages();
|
|
447
|
-
const button = /* @__PURE__ */
|
|
504
|
+
const button = /* @__PURE__ */ jsx6(
|
|
448
505
|
AriaButton2,
|
|
449
506
|
{
|
|
450
507
|
...props,
|
|
451
508
|
"aria-keyshortcuts": shortcut && resolveShortcut(shortcut),
|
|
452
509
|
className: cx("medo-button", "medo-button--icon-only", `medo-button--${variant}`, `medo-button--${size}`, className),
|
|
453
|
-
children: /* @__PURE__ */
|
|
510
|
+
children: /* @__PURE__ */ jsx6("span", { className: "medo-button__icon", "aria-hidden": "true", children: props.isPending ? /* @__PURE__ */ jsx6(Spinner, { decorative: true }) : icon })
|
|
454
511
|
}
|
|
455
512
|
);
|
|
456
513
|
if (tooltip === false) return button;
|
|
457
514
|
return /* @__PURE__ */ jsxs4(TooltipTrigger, { children: [
|
|
458
515
|
button,
|
|
459
|
-
/* @__PURE__ */
|
|
516
|
+
/* @__PURE__ */ jsx6(Tooltip, { shortcut: shortcutLabel ?? (shortcut && formatShortcut(shortcut, m.keys.control)), children: tooltip ?? props["aria-label"] })
|
|
460
517
|
] });
|
|
461
518
|
}
|
|
462
519
|
|
|
@@ -472,11 +529,11 @@ import {
|
|
|
472
529
|
// src/field/Field.tsx
|
|
473
530
|
import { FieldError, Label as Label2, Text } from "react-aria-components";
|
|
474
531
|
import { CircleAlert } from "lucide-react";
|
|
475
|
-
import { Fragment as Fragment2, jsx as
|
|
532
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
476
533
|
function FieldLabel({ children, isRequired }) {
|
|
477
534
|
return /* @__PURE__ */ jsxs5(Label2, { className: "medo-field__label", children: [
|
|
478
535
|
children,
|
|
479
|
-
isRequired && /* @__PURE__ */
|
|
536
|
+
isRequired && /* @__PURE__ */ jsx7("span", { className: "medo-field__required", "aria-hidden": "true", children: "*" })
|
|
480
537
|
] });
|
|
481
538
|
}
|
|
482
539
|
function FieldFooter({
|
|
@@ -485,17 +542,17 @@ function FieldFooter({
|
|
|
485
542
|
children
|
|
486
543
|
}) {
|
|
487
544
|
return /* @__PURE__ */ jsxs5("div", { className: "medo-field__footer", children: [
|
|
488
|
-
description && /* @__PURE__ */
|
|
489
|
-
/* @__PURE__ */
|
|
490
|
-
/* @__PURE__ */
|
|
491
|
-
/* @__PURE__ */
|
|
545
|
+
description && /* @__PURE__ */ jsx7(Text, { slot: "description", className: "medo-field__description", children: description }),
|
|
546
|
+
/* @__PURE__ */ jsx7(FieldError, { className: "medo-field__error", children: (validation) => /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
547
|
+
/* @__PURE__ */ jsx7(CircleAlert, { "aria-hidden": "true" }),
|
|
548
|
+
/* @__PURE__ */ jsx7("span", { children: (typeof errorMessage === "function" ? errorMessage(validation) : errorMessage) || validation.validationErrors.join(" ") })
|
|
492
549
|
] }) }),
|
|
493
550
|
children
|
|
494
551
|
] });
|
|
495
552
|
}
|
|
496
553
|
|
|
497
554
|
// src/text-field/TextField.tsx
|
|
498
|
-
import { Fragment as Fragment3, jsx as
|
|
555
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
499
556
|
function TextField({
|
|
500
557
|
label,
|
|
501
558
|
description,
|
|
@@ -522,13 +579,13 @@ function TextField({
|
|
|
522
579
|
onChange?.(value);
|
|
523
580
|
},
|
|
524
581
|
children: [
|
|
525
|
-
label && /* @__PURE__ */
|
|
526
|
-
multiline ? /* @__PURE__ */
|
|
527
|
-
leadingIcon && /* @__PURE__ */
|
|
528
|
-
/* @__PURE__ */
|
|
582
|
+
label && /* @__PURE__ */ jsx8(FieldLabel, { isRequired: props.isRequired, children: label }),
|
|
583
|
+
multiline ? /* @__PURE__ */ jsx8(AriaTextArea, { className: cx("medo-textarea", `medo-textarea--${size === "lg" ? "lg" : "md"}`), placeholder, onInput: clearErrorWhenValid }) : /* @__PURE__ */ jsxs6("div", { className: cx("medo-input", `medo-input--${size}`), children: [
|
|
584
|
+
leadingIcon && /* @__PURE__ */ jsx8("span", { className: "medo-input__icon", "aria-hidden": "true", children: leadingIcon }),
|
|
585
|
+
/* @__PURE__ */ jsx8(AriaInput, { className: "medo-input__control", placeholder, onInput: clearErrorWhenValid }),
|
|
529
586
|
trailing
|
|
530
587
|
] }),
|
|
531
|
-
/* @__PURE__ */
|
|
588
|
+
/* @__PURE__ */ jsx8(FieldFooter, { description, errorMessage, children: characterLimit !== void 0 && /* @__PURE__ */ jsx8(CharacterCount, { count, limit: characterLimit }) })
|
|
532
589
|
]
|
|
533
590
|
}
|
|
534
591
|
);
|
|
@@ -552,12 +609,12 @@ function CharacterCount({ count, limit }) {
|
|
|
552
609
|
return () => clearTimeout(id);
|
|
553
610
|
}, [count, limit, over, m]);
|
|
554
611
|
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
555
|
-
/* @__PURE__ */
|
|
556
|
-
/* @__PURE__ */
|
|
612
|
+
/* @__PURE__ */ jsx8("span", { className: "medo-field__counter", "data-over": over > 0 || void 0, "aria-hidden": "true", children: text }),
|
|
613
|
+
/* @__PURE__ */ jsx8("span", { className: "medo-visually-hidden", "aria-live": "polite", children: announcement })
|
|
557
614
|
] });
|
|
558
615
|
}
|
|
559
616
|
function InputAction({ icon, ...props }) {
|
|
560
|
-
return /* @__PURE__ */
|
|
617
|
+
return /* @__PURE__ */ jsx8(AriaButton3, { ...props, className: "medo-input__action", children: icon });
|
|
561
618
|
}
|
|
562
619
|
|
|
563
620
|
// src/checkbox/Checkbox.tsx
|
|
@@ -569,52 +626,52 @@ import {
|
|
|
569
626
|
Text as Text2
|
|
570
627
|
} from "react-aria-components";
|
|
571
628
|
import { Check, Minus } from "lucide-react";
|
|
572
|
-
import { Fragment as Fragment4, jsx as
|
|
629
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
573
630
|
var ChoiceSizeContext = createContext2("md");
|
|
574
631
|
function Checkbox({ children, description, size, className, ...props }) {
|
|
575
632
|
const groupSize = useContext3(ChoiceSizeContext);
|
|
576
633
|
return /* @__PURE__ */ jsxs7(CheckboxField, { ...props, className: cx("medo-choice", "medo-checkbox", `medo-choice--${size ?? groupSize}`, className), children: [
|
|
577
|
-
/* @__PURE__ */
|
|
578
|
-
/* @__PURE__ */
|
|
579
|
-
children && /* @__PURE__ */
|
|
634
|
+
/* @__PURE__ */ jsx9(CheckboxButton, { className: "medo-choice__button", children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
635
|
+
/* @__PURE__ */ jsx9("span", { className: "medo-choice__control", "aria-hidden": "true", children: isIndeterminate ? /* @__PURE__ */ jsx9(Minus, {}) : isSelected ? /* @__PURE__ */ jsx9(Check, {}) : null }),
|
|
636
|
+
children && /* @__PURE__ */ jsx9("span", { className: "medo-choice__label", children })
|
|
580
637
|
] }) }),
|
|
581
|
-
description && /* @__PURE__ */
|
|
638
|
+
description && /* @__PURE__ */ jsx9(Text2, { slot: "description", className: "medo-choice__description", children: description })
|
|
582
639
|
] });
|
|
583
640
|
}
|
|
584
641
|
function CheckboxGroup({ label, description, errorMessage, size = "md", orientation = "vertical", children, className, ...props }) {
|
|
585
642
|
return /* @__PURE__ */ jsxs7(AriaCheckboxGroup, { ...props, className: cx("medo-field", "medo-field--group", className), "data-orientation": orientation, children: [
|
|
586
|
-
label && /* @__PURE__ */
|
|
587
|
-
/* @__PURE__ */
|
|
588
|
-
/* @__PURE__ */
|
|
643
|
+
label && /* @__PURE__ */ jsx9(FieldLabel, { isRequired: props.isRequired, children: label }),
|
|
644
|
+
/* @__PURE__ */ jsx9(ChoiceSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx9("div", { className: "medo-field__options", children }) }),
|
|
645
|
+
/* @__PURE__ */ jsx9(FieldFooter, { description, errorMessage })
|
|
589
646
|
] });
|
|
590
647
|
}
|
|
591
648
|
|
|
592
649
|
// src/radio/Radio.tsx
|
|
593
650
|
import { useContext as useContext4 } from "react";
|
|
594
651
|
import { RadioButton, RadioField, RadioGroup as AriaRadioGroup, Text as Text3 } from "react-aria-components";
|
|
595
|
-
import { jsx as
|
|
652
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
596
653
|
function Radio({ children, description, size, className, ...props }) {
|
|
597
654
|
const groupSize = useContext4(ChoiceSizeContext);
|
|
598
655
|
return /* @__PURE__ */ jsxs8(RadioField, { ...props, className: cx("medo-choice", "medo-radio", `medo-choice--${size ?? groupSize}`, className), children: [
|
|
599
656
|
/* @__PURE__ */ jsxs8(RadioButton, { className: "medo-choice__button", children: [
|
|
600
|
-
/* @__PURE__ */
|
|
601
|
-
children && /* @__PURE__ */
|
|
657
|
+
/* @__PURE__ */ jsx10("span", { className: "medo-choice__control", "aria-hidden": "true" }),
|
|
658
|
+
children && /* @__PURE__ */ jsx10("span", { className: "medo-choice__label", children })
|
|
602
659
|
] }),
|
|
603
|
-
description && /* @__PURE__ */
|
|
660
|
+
description && /* @__PURE__ */ jsx10(Text3, { slot: "description", className: "medo-choice__description", children: description })
|
|
604
661
|
] });
|
|
605
662
|
}
|
|
606
663
|
function RadioGroup({ label, description, errorMessage, size = "md", children, className, ...props }) {
|
|
607
664
|
return /* @__PURE__ */ jsxs8(AriaRadioGroup, { ...props, className: cx("medo-field", "medo-field--group", className), children: [
|
|
608
|
-
label && /* @__PURE__ */
|
|
609
|
-
/* @__PURE__ */
|
|
610
|
-
/* @__PURE__ */
|
|
665
|
+
label && /* @__PURE__ */ jsx10(FieldLabel, { isRequired: props.isRequired, children: label }),
|
|
666
|
+
/* @__PURE__ */ jsx10(ChoiceSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx10("div", { className: "medo-field__options", children }) }),
|
|
667
|
+
/* @__PURE__ */ jsx10(FieldFooter, { description, errorMessage })
|
|
611
668
|
] });
|
|
612
669
|
}
|
|
613
670
|
|
|
614
671
|
// src/switch/Switch.tsx
|
|
615
672
|
import { SwitchButton, SwitchField, Text as Text4 } from "react-aria-components";
|
|
616
673
|
import { Check as Check2, LoaderCircle, X } from "lucide-react";
|
|
617
|
-
import { Fragment as Fragment5, jsx as
|
|
674
|
+
import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
618
675
|
function Switch({
|
|
619
676
|
children,
|
|
620
677
|
description,
|
|
@@ -633,21 +690,21 @@ function Switch({
|
|
|
633
690
|
"aria-busy": isLoading || void 0,
|
|
634
691
|
className: cx("medo-switch", `medo-switch--${size}`, `medo-switch--label-${labelPosition}`, className),
|
|
635
692
|
children: [
|
|
636
|
-
/* @__PURE__ */
|
|
637
|
-
/* @__PURE__ */
|
|
638
|
-
/* @__PURE__ */
|
|
693
|
+
/* @__PURE__ */ jsx11(SwitchButton, { className: "medo-switch__button", children: ({ isSelected }) => /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
694
|
+
/* @__PURE__ */ jsx11("span", { className: "medo-switch__track", "aria-hidden": "true", children: /* @__PURE__ */ jsx11("span", { className: "medo-switch__thumb", children: isLoading ? /* @__PURE__ */ jsx11(LoaderCircle, { className: "medo-switch__spinner" }) : isSelected ? /* @__PURE__ */ jsx11(Check2, {}) : /* @__PURE__ */ jsx11(X, {}) }) }),
|
|
695
|
+
/* @__PURE__ */ jsx11("span", { className: "medo-switch__label", children })
|
|
639
696
|
] }) }),
|
|
640
|
-
description && /* @__PURE__ */
|
|
697
|
+
description && /* @__PURE__ */ jsx11(Text4, { slot: "description", className: "medo-switch__description", children: description })
|
|
641
698
|
]
|
|
642
699
|
}
|
|
643
700
|
);
|
|
644
701
|
}
|
|
645
702
|
|
|
646
703
|
// src/badge/Badge.tsx
|
|
647
|
-
import { jsx as
|
|
704
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
648
705
|
function Badge({ tone = "neutral", size = "md", dot, icon, className, children, ...props }) {
|
|
649
706
|
return /* @__PURE__ */ jsxs10("span", { ...props, className: cx("medo-badge", `medo-badge--${tone}`, `medo-badge--${size}`, className), children: [
|
|
650
|
-
dot ? /* @__PURE__ */
|
|
707
|
+
dot ? /* @__PURE__ */ jsx12("span", { className: "medo-badge__dot", "aria-hidden": "true" }) : icon && /* @__PURE__ */ jsx12("span", { className: "medo-badge__icon", "aria-hidden": "true", children: icon }),
|
|
651
708
|
children
|
|
652
709
|
] });
|
|
653
710
|
}
|
|
@@ -661,14 +718,14 @@ function BadgeCount({ count, max = 99, tone = "danger", size = "md", label, clas
|
|
|
661
718
|
"aria-hidden": label ? void 0 : true,
|
|
662
719
|
className: cx("medo-badge-count", `medo-badge-count--${tone}`, `medo-badge-count--${size}`, className),
|
|
663
720
|
children: [
|
|
664
|
-
/* @__PURE__ */
|
|
665
|
-
label && /* @__PURE__ */
|
|
721
|
+
/* @__PURE__ */ jsx12("span", { "aria-hidden": label ? true : void 0, children: text }),
|
|
722
|
+
label && /* @__PURE__ */ jsx12("span", { className: "medo-visually-hidden", children: label })
|
|
666
723
|
]
|
|
667
724
|
}
|
|
668
725
|
);
|
|
669
726
|
}
|
|
670
727
|
function BadgeDot({ tone = "neutral", label, className, ...props }) {
|
|
671
|
-
return /* @__PURE__ */
|
|
728
|
+
return /* @__PURE__ */ jsx12(
|
|
672
729
|
"span",
|
|
673
730
|
{
|
|
674
731
|
...props,
|
|
@@ -690,7 +747,7 @@ import {
|
|
|
690
747
|
Text as Text5
|
|
691
748
|
} from "react-aria-components";
|
|
692
749
|
import { Check as Check3, X as X2 } from "lucide-react";
|
|
693
|
-
import { Fragment as Fragment6, jsx as
|
|
750
|
+
import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
694
751
|
var TagSizeContext = createContext3("md");
|
|
695
752
|
function TagGroup({
|
|
696
753
|
label,
|
|
@@ -716,24 +773,24 @@ function TagGroup({
|
|
|
716
773
|
setAnnouncement(removedMessage(labels));
|
|
717
774
|
});
|
|
718
775
|
return /* @__PURE__ */ jsxs11(AriaTagGroup, { ...props, ref, onRemove: handleRemove, className: cx("medo-field", "medo-field--group", className), children: [
|
|
719
|
-
label && /* @__PURE__ */
|
|
720
|
-
/* @__PURE__ */
|
|
721
|
-
description && /* @__PURE__ */
|
|
722
|
-
/* @__PURE__ */
|
|
776
|
+
label && /* @__PURE__ */ jsx13(FieldLabel, { children: label }),
|
|
777
|
+
/* @__PURE__ */ jsx13(TagSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx13(TagList, { items, renderEmptyState, className: "medo-tag-list", children }) }),
|
|
778
|
+
description && /* @__PURE__ */ jsx13("div", { className: "medo-field__footer", children: /* @__PURE__ */ jsx13(Text5, { slot: "description", className: "medo-field__description", children: description }) }),
|
|
779
|
+
/* @__PURE__ */ jsx13("span", { className: "medo-visually-hidden", "aria-live": "polite", children: announcement })
|
|
723
780
|
] });
|
|
724
781
|
}
|
|
725
782
|
function Tag({ children, icon, textValue, className, ...props }) {
|
|
726
783
|
const size = useContext5(TagSizeContext);
|
|
727
|
-
return /* @__PURE__ */
|
|
784
|
+
return /* @__PURE__ */ jsx13(
|
|
728
785
|
AriaTag,
|
|
729
786
|
{
|
|
730
787
|
...props,
|
|
731
788
|
textValue: textValue ?? (typeof children === "string" ? children : void 0),
|
|
732
789
|
className: ({ selectionMode }) => cx("medo-tag", `medo-tag--${size}`, selectionMode !== "none" && "medo-tag--selectable", className),
|
|
733
790
|
children: ({ allowsRemoving, isSelected, selectionMode }) => /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
734
|
-
selectionMode !== "none" && isSelected ? /* @__PURE__ */
|
|
735
|
-
/* @__PURE__ */
|
|
736
|
-
allowsRemoving && /* @__PURE__ */
|
|
791
|
+
selectionMode !== "none" && isSelected ? /* @__PURE__ */ jsx13("span", { className: "medo-tag__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(Check3, {}) }) : icon && /* @__PURE__ */ jsx13("span", { className: "medo-tag__icon", "aria-hidden": "true", children: icon }),
|
|
792
|
+
/* @__PURE__ */ jsx13("span", { className: "medo-tag__label", children }),
|
|
793
|
+
allowsRemoving && /* @__PURE__ */ jsx13(AriaButton4, { slot: "remove", className: "medo-tag__remove", children: /* @__PURE__ */ jsx13(X2, { "aria-hidden": "true" }) })
|
|
737
794
|
] })
|
|
738
795
|
}
|
|
739
796
|
);
|
|
@@ -751,7 +808,7 @@ import {
|
|
|
751
808
|
} from "react";
|
|
752
809
|
import { Button as AriaButton5 } from "react-aria-components";
|
|
753
810
|
import { Building2, User } from "lucide-react";
|
|
754
|
-
import { jsx as
|
|
811
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
755
812
|
var TONES = ["blue", "violet", "pink", "amber", "green", "teal"];
|
|
756
813
|
var AvatarSizeContext = createContext4(void 0);
|
|
757
814
|
function toneFor(key) {
|
|
@@ -805,9 +862,9 @@ function Avatar({
|
|
|
805
862
|
),
|
|
806
863
|
style,
|
|
807
864
|
children: [
|
|
808
|
-
initials ? /* @__PURE__ */
|
|
809
|
-
showImage && /* @__PURE__ */
|
|
810
|
-
status && /* @__PURE__ */
|
|
865
|
+
initials ? /* @__PURE__ */ jsx14("span", { className: "medo-avatar__initials", "aria-hidden": "true", children: initials }) : /* @__PURE__ */ jsx14("span", { className: "medo-avatar__icon", "aria-hidden": "true", children: shape === "square" ? /* @__PURE__ */ jsx14(Building2, {}) : /* @__PURE__ */ jsx14(User, {}) }),
|
|
866
|
+
showImage && /* @__PURE__ */ jsx14("img", { className: "medo-avatar__image", src, alt: "", onError: () => setFailed(true) }),
|
|
867
|
+
status && /* @__PURE__ */ jsx14("span", { className: cx("medo-avatar__status", `medo-avatar__status--${status}`), "aria-hidden": "true" })
|
|
811
868
|
]
|
|
812
869
|
}
|
|
813
870
|
);
|
|
@@ -828,7 +885,7 @@ function AvatarGroup({
|
|
|
828
885
|
const hidden = items.length - visible.length;
|
|
829
886
|
const moreClass = cx("medo-avatar", `medo-avatar--${size}`, "medo-avatar--circle", "medo-avatar--neutral", "medo-avatar--more");
|
|
830
887
|
return /* @__PURE__ */ jsxs12("div", { role: "group", "aria-label": props["aria-label"], className: cx("medo-avatar-group", `medo-avatar-group--${size}`, className), children: [
|
|
831
|
-
/* @__PURE__ */
|
|
888
|
+
/* @__PURE__ */ jsx14(AvatarSizeContext.Provider, { value: size, children: visible.map(
|
|
832
889
|
(child, i) => (
|
|
833
890
|
// The first avatar sits on top.
|
|
834
891
|
isValidElement(child) ? cloneElement(child, { style: { ...child.props.style, zIndex: visible.length - i } }) : child
|
|
@@ -853,7 +910,7 @@ import {
|
|
|
853
910
|
ToggleButtonGroup as AriaToggleButtonGroup,
|
|
854
911
|
Toolbar as AriaToolbar
|
|
855
912
|
} from "react-aria-components";
|
|
856
|
-
import { jsx as
|
|
913
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
857
914
|
var ToggleSizeContext = createContext5(null);
|
|
858
915
|
var SegmentedContext = createContext5(false);
|
|
859
916
|
function ToggleButton({ children, icon, size, tooltip, shortcut, className, ...props }) {
|
|
@@ -869,8 +926,8 @@ function ToggleButton({ children, icon, size, tooltip, shortcut, className, ...p
|
|
|
869
926
|
"aria-keyshortcuts": shortcut && resolveShortcut(shortcut),
|
|
870
927
|
className: cx("medo-button", `medo-button--${s2}`, iconOnly && "medo-button--icon-only", "medo-toggle", className),
|
|
871
928
|
children: [
|
|
872
|
-
segmented && /* @__PURE__ */
|
|
873
|
-
icon && /* @__PURE__ */
|
|
929
|
+
segmented && /* @__PURE__ */ jsx15(SelectionIndicator, { className: "medo-toggle__indicator" }),
|
|
930
|
+
icon && /* @__PURE__ */ jsx15("span", { className: "medo-button__icon", "aria-hidden": "true", children: icon }),
|
|
874
931
|
children
|
|
875
932
|
]
|
|
876
933
|
}
|
|
@@ -878,7 +935,7 @@ function ToggleButton({ children, icon, size, tooltip, shortcut, className, ...p
|
|
|
878
935
|
if (!iconOnly || tooltip === false) return button;
|
|
879
936
|
return /* @__PURE__ */ jsxs13(TooltipTrigger, { children: [
|
|
880
937
|
button,
|
|
881
|
-
/* @__PURE__ */
|
|
938
|
+
/* @__PURE__ */ jsx15(Tooltip, { shortcut: shortcut && formatShortcut(shortcut, m.keys.control), children: tooltip ?? props["aria-label"] })
|
|
882
939
|
] });
|
|
883
940
|
}
|
|
884
941
|
function ToggleButtonGroup({
|
|
@@ -905,7 +962,7 @@ function ToggleButtonGroup({
|
|
|
905
962
|
return () => observer.disconnect();
|
|
906
963
|
}, []);
|
|
907
964
|
const itemSize = segmented ? size === "lg" ? "md" : "sm" : size;
|
|
908
|
-
return /* @__PURE__ */
|
|
965
|
+
return /* @__PURE__ */ jsx15(
|
|
909
966
|
AriaToggleButtonGroup,
|
|
910
967
|
{
|
|
911
968
|
...props,
|
|
@@ -913,15 +970,15 @@ function ToggleButtonGroup({
|
|
|
913
970
|
selectionMode: segmented ? "single" : selectionMode ?? "multiple",
|
|
914
971
|
disallowEmptySelection: segmented || disallowEmptySelection,
|
|
915
972
|
className: cx("medo-toggle-group", `medo-toggle-group--${variant}`, `medo-toggle-group--${size}`, segmented && fullWidth && "medo-toggle-group--full", className),
|
|
916
|
-
children: /* @__PURE__ */
|
|
973
|
+
children: /* @__PURE__ */ jsx15(SegmentedContext.Provider, { value: segmented, children: /* @__PURE__ */ jsx15(ToggleSizeContext.Provider, { value: itemSize, children }) })
|
|
917
974
|
}
|
|
918
975
|
);
|
|
919
976
|
}
|
|
920
977
|
function Toolbar({ className, ...props }) {
|
|
921
|
-
return /* @__PURE__ */
|
|
978
|
+
return /* @__PURE__ */ jsx15(AriaToolbar, { ...props, className: cx("medo-toolbar", className) });
|
|
922
979
|
}
|
|
923
980
|
function ToolbarSeparator() {
|
|
924
|
-
return /* @__PURE__ */
|
|
981
|
+
return /* @__PURE__ */ jsx15(Separator, { orientation: "vertical", className: "medo-toolbar__separator" });
|
|
925
982
|
}
|
|
926
983
|
|
|
927
984
|
// src/listbox/ListBox.tsx
|
|
@@ -938,7 +995,7 @@ import {
|
|
|
938
995
|
import { Check as Check4 } from "lucide-react";
|
|
939
996
|
|
|
940
997
|
// src/utils/highlight.tsx
|
|
941
|
-
import { jsx as
|
|
998
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
942
999
|
var plain = (text) => text.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLocaleLowerCase();
|
|
943
1000
|
function matchParts(text, query, all = false) {
|
|
944
1001
|
const q = plain(query.trim());
|
|
@@ -977,44 +1034,44 @@ function Highlight({
|
|
|
977
1034
|
}) {
|
|
978
1035
|
if (!query?.trim()) return text;
|
|
979
1036
|
return matchParts(text, query, all).map(
|
|
980
|
-
(part, i) => part.match ? /* @__PURE__ */
|
|
1037
|
+
(part, i) => part.match ? /* @__PURE__ */ jsx16(Tag2, { className, children: part.text }, i) : part.text
|
|
981
1038
|
);
|
|
982
1039
|
}
|
|
983
1040
|
|
|
984
1041
|
// src/listbox/ListBox.tsx
|
|
985
|
-
import { Fragment as Fragment7, jsx as
|
|
1042
|
+
import { Fragment as Fragment7, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
986
1043
|
var ListBoxSizeContext = createContext6("md");
|
|
987
1044
|
function ListBox({ size = "md", className, ...props }) {
|
|
988
|
-
return /* @__PURE__ */
|
|
1045
|
+
return /* @__PURE__ */ jsx17(ListBoxSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx17(AriaListBox, { ...props, className: cx("medo-listbox", `medo-listbox--${size}`, className) }) });
|
|
989
1046
|
}
|
|
990
1047
|
function Option({ children, description, icon, textValue, ...props }) {
|
|
991
1048
|
const size = useContext8(ListBoxSizeContext);
|
|
992
|
-
return /* @__PURE__ */
|
|
993
|
-
selectionMode === "multiple" && /* @__PURE__ */
|
|
1049
|
+
return /* @__PURE__ */ jsx17(ListBoxItem, { ...props, textValue: textValue ?? (typeof children === "string" ? children : void 0), className: "medo-option", children: ({ isSelected, selectionMode }) => /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
1050
|
+
selectionMode === "multiple" && /* @__PURE__ */ jsx17(
|
|
994
1051
|
"span",
|
|
995
1052
|
{
|
|
996
1053
|
className: cx("medo-choice", "medo-checkbox", `medo-choice--${size}`, "medo-option__checkbox"),
|
|
997
1054
|
"data-selected": isSelected || void 0,
|
|
998
1055
|
"aria-hidden": "true",
|
|
999
|
-
children: /* @__PURE__ */
|
|
1056
|
+
children: /* @__PURE__ */ jsx17("span", { className: "medo-choice__control", children: isSelected && /* @__PURE__ */ jsx17(Check4, {}) })
|
|
1000
1057
|
}
|
|
1001
1058
|
),
|
|
1002
|
-
icon && /* @__PURE__ */
|
|
1059
|
+
icon && /* @__PURE__ */ jsx17("span", { className: "medo-option__icon", "aria-hidden": "true", children: icon }),
|
|
1003
1060
|
/* @__PURE__ */ jsxs14("span", { className: "medo-option__content", children: [
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
description && /* @__PURE__ */
|
|
1061
|
+
/* @__PURE__ */ jsx17(Text6, { slot: "label", className: "medo-option__label", children: /* @__PURE__ */ jsx17(Highlight2, { children }) }),
|
|
1062
|
+
description && /* @__PURE__ */ jsx17(Text6, { slot: "description", className: "medo-option__description", children: description })
|
|
1006
1063
|
] }),
|
|
1007
|
-
selectionMode !== "multiple" && isSelected && /* @__PURE__ */
|
|
1064
|
+
selectionMode !== "multiple" && isSelected && /* @__PURE__ */ jsx17("span", { className: "medo-option__check", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(Check4, {}) })
|
|
1008
1065
|
] }) });
|
|
1009
1066
|
}
|
|
1010
1067
|
function ListBoxSection({ title, children, items, id, ...props }) {
|
|
1011
1068
|
return /* @__PURE__ */ jsxs14(AriaListBoxSection, { id, "aria-label": props["aria-label"], className: "medo-listbox__section", children: [
|
|
1012
|
-
title && /* @__PURE__ */
|
|
1013
|
-
typeof children === "function" ? /* @__PURE__ */
|
|
1069
|
+
title && /* @__PURE__ */ jsx17(Header, { className: "medo-listbox__header", children: title }),
|
|
1070
|
+
typeof children === "function" ? /* @__PURE__ */ jsx17(Collection, { items, children }) : children
|
|
1014
1071
|
] });
|
|
1015
1072
|
}
|
|
1016
1073
|
function ListBoxMessage({ children }) {
|
|
1017
|
-
return /* @__PURE__ */
|
|
1074
|
+
return /* @__PURE__ */ jsx17("div", { className: "medo-listbox__message", role: "status", children });
|
|
1018
1075
|
}
|
|
1019
1076
|
var OptionHighlightContext = createContext6(null);
|
|
1020
1077
|
function Highlight2({ children }) {
|
|
@@ -1022,8 +1079,8 @@ function Highlight2({ children }) {
|
|
|
1022
1079
|
const external = useContext8(OptionHighlightContext);
|
|
1023
1080
|
let query = (external ?? combo?.inputValue ?? "").trim();
|
|
1024
1081
|
if (combo?.selectedItems.some((item) => item?.textValue === query)) query = "";
|
|
1025
|
-
if (!query || typeof children !== "string") return /* @__PURE__ */
|
|
1026
|
-
return /* @__PURE__ */
|
|
1082
|
+
if (!query || typeof children !== "string") return /* @__PURE__ */ jsx17(Fragment7, { children });
|
|
1083
|
+
return /* @__PURE__ */ jsx17(Highlight, { text: children, query, as: "span", className: "medo-option__match" });
|
|
1027
1084
|
}
|
|
1028
1085
|
|
|
1029
1086
|
// src/select/Select.tsx
|
|
@@ -1041,7 +1098,7 @@ import { ChevronDown, X as X4 } from "lucide-react";
|
|
|
1041
1098
|
import { useContext as useContext9, useId as useId2, useRef as useRef3 } from "react";
|
|
1042
1099
|
import { Dialog, Heading, Modal, ModalOverlay, OverlayTriggerStateContext, Popover } from "react-aria-components";
|
|
1043
1100
|
import { ChevronLeft, X as X3 } from "lucide-react";
|
|
1044
|
-
import { Fragment as Fragment8, jsx as
|
|
1101
|
+
import { Fragment as Fragment8, jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1045
1102
|
var CLOSE_DISTANCE = 0.25;
|
|
1046
1103
|
var CLOSE_VELOCITY = 0.5;
|
|
1047
1104
|
function BottomSheet({
|
|
@@ -1057,17 +1114,17 @@ function BottomSheet({
|
|
|
1057
1114
|
...props
|
|
1058
1115
|
}) {
|
|
1059
1116
|
const m = useMessages();
|
|
1060
|
-
return /* @__PURE__ */
|
|
1117
|
+
return /* @__PURE__ */ jsx18(ModalOverlay, { ...props, isDismissable, className: "medo-sheet-overlay", children: /* @__PURE__ */ jsx18(Modal, { className: cx("medo-sheet", height === "full" && "medo-sheet--full", className), children: /* @__PURE__ */ jsx18(Dialog, { className: "medo-sheet__dialog", children: ({ close }) => /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
1061
1118
|
/* @__PURE__ */ jsxs15(SwipeArea, { onClose: close, children: [
|
|
1062
|
-
/* @__PURE__ */
|
|
1119
|
+
/* @__PURE__ */ jsx18("span", { className: "medo-sheet__handle", "aria-hidden": "true" }),
|
|
1063
1120
|
/* @__PURE__ */ jsxs15("div", { className: "medo-sheet__header", children: [
|
|
1064
|
-
onBack && /* @__PURE__ */
|
|
1065
|
-
/* @__PURE__ */
|
|
1066
|
-
/* @__PURE__ */
|
|
1121
|
+
onBack && /* @__PURE__ */ jsx18(IconButton, { variant: "ghost", size: "lg", icon: /* @__PURE__ */ jsx18(ChevronLeft, {}), "aria-label": backLabel ?? m.common.back, tooltip: false, onPress: onBack }),
|
|
1122
|
+
/* @__PURE__ */ jsx18(Heading, { slot: "title", className: "medo-sheet__title", children: title }),
|
|
1123
|
+
/* @__PURE__ */ jsx18(IconButton, { variant: "ghost", size: "lg", icon: /* @__PURE__ */ jsx18(X3, {}), "aria-label": closeLabel ?? m.common.close, tooltip: false, onPress: close })
|
|
1067
1124
|
] })
|
|
1068
1125
|
] }),
|
|
1069
|
-
/* @__PURE__ */
|
|
1070
|
-
footer && /* @__PURE__ */
|
|
1126
|
+
/* @__PURE__ */ jsx18("div", { className: "medo-sheet__content", children }),
|
|
1127
|
+
footer && /* @__PURE__ */ jsx18("div", { className: "medo-sheet__footer", children: typeof footer === "function" ? footer(close) : footer })
|
|
1071
1128
|
] }) }) }) });
|
|
1072
1129
|
}
|
|
1073
1130
|
function SwipeArea({ onClose, children }) {
|
|
@@ -1095,7 +1152,7 @@ function SwipeArea({ onClose, children }) {
|
|
|
1095
1152
|
d.sheet.style.transform = "";
|
|
1096
1153
|
if (dy > d.sheet.offsetHeight * CLOSE_DISTANCE || velocity > CLOSE_VELOCITY && dy > 24) onClose();
|
|
1097
1154
|
};
|
|
1098
|
-
return /* @__PURE__ */
|
|
1155
|
+
return /* @__PURE__ */ jsx18("div", { className: "medo-sheet__grab", onPointerDown, onPointerMove, onPointerUp: end, onPointerCancel: end, children });
|
|
1099
1156
|
}
|
|
1100
1157
|
function BottomSheetPopover({
|
|
1101
1158
|
title,
|
|
@@ -1104,7 +1161,7 @@ function BottomSheetPopover({
|
|
|
1104
1161
|
height = "content",
|
|
1105
1162
|
closeLabel
|
|
1106
1163
|
}) {
|
|
1107
|
-
return /* @__PURE__ */
|
|
1164
|
+
return /* @__PURE__ */ jsx18(Popover, { className: "medo-sheet-overlay medo-sheet-overlay--popover", offset: 0, containerPadding: 0, children: /* @__PURE__ */ jsx18(SheetPopoverBody, { title, footer, height, closeLabel, children }) });
|
|
1108
1165
|
}
|
|
1109
1166
|
function SheetPopoverBody({ title, children, footer, height, closeLabel }) {
|
|
1110
1167
|
const m = useMessages();
|
|
@@ -1113,16 +1170,16 @@ function SheetPopoverBody({ title, children, footer, height, closeLabel }) {
|
|
|
1113
1170
|
const close = () => state?.close();
|
|
1114
1171
|
return (
|
|
1115
1172
|
// A tap on the scrim (outside the sheet) closes it.
|
|
1116
|
-
/* @__PURE__ */
|
|
1173
|
+
/* @__PURE__ */ jsx18("div", { className: "medo-sheet-scrim", onClick: (e) => e.target === e.currentTarget && close(), children: /* @__PURE__ */ jsxs15("section", { className: cx("medo-sheet", height === "full" && "medo-sheet--full"), "aria-labelledby": titleId, children: [
|
|
1117
1174
|
/* @__PURE__ */ jsxs15(SwipeArea, { onClose: close, children: [
|
|
1118
|
-
/* @__PURE__ */
|
|
1175
|
+
/* @__PURE__ */ jsx18("span", { className: "medo-sheet__handle", "aria-hidden": "true" }),
|
|
1119
1176
|
/* @__PURE__ */ jsxs15("div", { className: "medo-sheet__header", children: [
|
|
1120
|
-
/* @__PURE__ */
|
|
1121
|
-
/* @__PURE__ */
|
|
1177
|
+
/* @__PURE__ */ jsx18("h2", { id: titleId, className: "medo-sheet__title", children: title }),
|
|
1178
|
+
/* @__PURE__ */ jsx18(IconButton, { slot: null, variant: "ghost", size: "lg", icon: /* @__PURE__ */ jsx18(X3, {}), "aria-label": closeLabel ?? m.common.close, tooltip: false, onPress: close })
|
|
1122
1179
|
] })
|
|
1123
1180
|
] }),
|
|
1124
|
-
/* @__PURE__ */
|
|
1125
|
-
footer && /* @__PURE__ */
|
|
1181
|
+
/* @__PURE__ */ jsx18("div", { className: "medo-sheet__content", children }),
|
|
1182
|
+
footer && /* @__PURE__ */ jsx18("div", { className: "medo-sheet__footer", children: typeof footer === "function" ? footer(close) : footer })
|
|
1126
1183
|
] }) })
|
|
1127
1184
|
);
|
|
1128
1185
|
}
|
|
@@ -1175,7 +1232,7 @@ function useMediaQuery(query) {
|
|
|
1175
1232
|
}
|
|
1176
1233
|
|
|
1177
1234
|
// src/select/Select.tsx
|
|
1178
|
-
import { Fragment as Fragment9, jsx as
|
|
1235
|
+
import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1179
1236
|
function Select({
|
|
1180
1237
|
label,
|
|
1181
1238
|
description,
|
|
@@ -1219,39 +1276,39 @@ function Select({
|
|
|
1219
1276
|
className
|
|
1220
1277
|
),
|
|
1221
1278
|
children: [
|
|
1222
|
-
label && /* @__PURE__ */
|
|
1279
|
+
label && /* @__PURE__ */ jsx19(FieldLabel, { isRequired: props.isRequired, children: label }),
|
|
1223
1280
|
/* @__PURE__ */ jsxs16("div", { ref: fieldRef, className: cx("medo-input", `medo-input--${size}`, "medo-select__field"), children: [
|
|
1224
|
-
/* @__PURE__ */
|
|
1225
|
-
leadingIcon && /* @__PURE__ */
|
|
1226
|
-
/* @__PURE__ */
|
|
1227
|
-
isPlaceholder ? defaultChildren : multiple ? /* @__PURE__ */
|
|
1228
|
-
isReadOnly && /* @__PURE__ */
|
|
1281
|
+
/* @__PURE__ */ jsx19(ReadOnlyKeys, { isReadOnly, children: /* @__PURE__ */ jsxs16(AriaButton6, { className: "medo-select__trigger", excludeFromTabOrder: mode === "native", "aria-hidden": mode === "native" || void 0, children: [
|
|
1282
|
+
leadingIcon && /* @__PURE__ */ jsx19("span", { className: "medo-input__icon", "aria-hidden": "true", children: leadingIcon }),
|
|
1283
|
+
/* @__PURE__ */ jsx19(SelectValue, { className: "medo-select__value", children: ({ defaultChildren, isPlaceholder, selectedText }) => /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
1284
|
+
isPlaceholder ? defaultChildren : multiple ? /* @__PURE__ */ jsx19(SelectedTags, { size }) : selectedText,
|
|
1285
|
+
isReadOnly && /* @__PURE__ */ jsx19("span", { className: "medo-visually-hidden", children: ", read only" })
|
|
1229
1286
|
] }) }),
|
|
1230
|
-
!isReadOnly && /* @__PURE__ */
|
|
1287
|
+
!isReadOnly && /* @__PURE__ */ jsx19("span", { className: "medo-select__chevron", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(ChevronDown, {}) })
|
|
1231
1288
|
] }) }),
|
|
1232
|
-
mode === "native" && !isReadOnly && /* @__PURE__ */
|
|
1233
|
-
/* @__PURE__ */
|
|
1289
|
+
mode === "native" && !isReadOnly && /* @__PURE__ */ jsx19(NativePicker, { label: label ?? props["aria-label"], placeholder, isRequired: props.isRequired }),
|
|
1290
|
+
/* @__PURE__ */ jsx19(ClearButton, { enabled: (multiple || !!clearable) && !isReadOnly && !props.isDisabled, onHasValue: setHasValue })
|
|
1234
1291
|
] }),
|
|
1235
|
-
/* @__PURE__ */
|
|
1236
|
-
commit === "onClose" && onApply && /* @__PURE__ */
|
|
1237
|
-
mode === "sheet" ? /* @__PURE__ */
|
|
1292
|
+
/* @__PURE__ */ jsx19(FieldFooter, { description, errorMessage }),
|
|
1293
|
+
commit === "onClose" && onApply && /* @__PURE__ */ jsx19(ApplyOnClose, { onApply }),
|
|
1294
|
+
mode === "sheet" ? /* @__PURE__ */ jsx19(
|
|
1238
1295
|
BottomSheetPopover,
|
|
1239
1296
|
{
|
|
1240
1297
|
title: label ?? props["aria-label"],
|
|
1241
|
-
footer: multiple ? /* @__PURE__ */
|
|
1242
|
-
children: /* @__PURE__ */
|
|
1298
|
+
footer: multiple ? /* @__PURE__ */ jsx19(SheetFooter, { commit, resultLabel }) : void 0,
|
|
1299
|
+
children: /* @__PURE__ */ jsx19(ListBox, { size: "lg", items, children })
|
|
1243
1300
|
}
|
|
1244
|
-
) : /* @__PURE__ */
|
|
1301
|
+
) : /* @__PURE__ */ jsx19(Popover2, { triggerRef: fieldRef, offset: 4, className: "medo-listbox-popover", children: /* @__PURE__ */ jsx19(ListBox, { size: size === "lg" ? "lg" : "md", items, children }) })
|
|
1245
1302
|
]
|
|
1246
1303
|
}
|
|
1247
1304
|
);
|
|
1248
1305
|
}
|
|
1249
1306
|
function ReadOnlyKeys({ isReadOnly, children }) {
|
|
1250
|
-
if (!isReadOnly) return /* @__PURE__ */
|
|
1307
|
+
if (!isReadOnly) return /* @__PURE__ */ jsx19(Fragment9, { children });
|
|
1251
1308
|
const block = (e) => {
|
|
1252
1309
|
if (e.key !== "Tab") e.stopPropagation();
|
|
1253
1310
|
};
|
|
1254
|
-
return /* @__PURE__ */
|
|
1311
|
+
return /* @__PURE__ */ jsx19("div", { style: { display: "contents" }, onKeyDownCapture: block, children });
|
|
1255
1312
|
}
|
|
1256
1313
|
function ClearButton({ enabled, onHasValue }) {
|
|
1257
1314
|
const m = useMessages();
|
|
@@ -1260,12 +1317,12 @@ function ClearButton({ enabled, onHasValue }) {
|
|
|
1260
1317
|
useLayoutEffect2(() => onHasValue(hasValue), [hasValue, onHasValue]);
|
|
1261
1318
|
const ref = useRef4(null);
|
|
1262
1319
|
if (!enabled || !hasValue || !state) return null;
|
|
1263
|
-
return /* @__PURE__ */
|
|
1320
|
+
return /* @__PURE__ */ jsx19("span", { className: "medo-select__clear", ref, children: /* @__PURE__ */ jsx19(
|
|
1264
1321
|
InputAction,
|
|
1265
1322
|
{
|
|
1266
1323
|
slot: null,
|
|
1267
1324
|
"aria-label": Array.isArray(state.value) ? m.common.clearAll : m.select.clearSelection,
|
|
1268
|
-
icon: /* @__PURE__ */
|
|
1325
|
+
icon: /* @__PURE__ */ jsx19(X4, {}),
|
|
1269
1326
|
onPress: () => {
|
|
1270
1327
|
state.setValue(Array.isArray(state.value) ? [] : null);
|
|
1271
1328
|
ref.current?.parentElement?.querySelector(".medo-select__trigger")?.focus();
|
|
@@ -1283,15 +1340,15 @@ function SelectedTags({ size }) {
|
|
|
1283
1340
|
const tagClass = cx("medo-tag", size === "lg" ? "medo-tag--md" : "medo-tag--sm");
|
|
1284
1341
|
const hidden = labels.length - visible;
|
|
1285
1342
|
return /* @__PURE__ */ jsxs16("span", { className: "medo-select__tags", ref: rowRef, children: [
|
|
1286
|
-
/* @__PURE__ */
|
|
1343
|
+
/* @__PURE__ */ jsx19("span", { className: "medo-visually-hidden", children: labels.join(", ") }),
|
|
1287
1344
|
/* @__PURE__ */ jsxs16("span", { className: "medo-select__measure", ref: measureRef, "aria-hidden": "true", children: [
|
|
1288
|
-
labels.map((label, i) => /* @__PURE__ */
|
|
1345
|
+
labels.map((label, i) => /* @__PURE__ */ jsx19("span", { className: tagClass, children: label }, i)),
|
|
1289
1346
|
/* @__PURE__ */ jsxs16("span", { className: tagClass, children: [
|
|
1290
1347
|
"+",
|
|
1291
1348
|
labels.length
|
|
1292
1349
|
] })
|
|
1293
1350
|
] }),
|
|
1294
|
-
labels.slice(0, visible).map((label, i) => /* @__PURE__ */
|
|
1351
|
+
labels.slice(0, visible).map((label, i) => /* @__PURE__ */ jsx19("span", { className: tagClass, "aria-hidden": "true", children: /* @__PURE__ */ jsx19("span", { className: "medo-select__tag-label", children: label }) }, i)),
|
|
1295
1352
|
hidden > 0 && /* @__PURE__ */ jsxs16("span", { className: tagClass, "aria-hidden": "true", children: [
|
|
1296
1353
|
"+",
|
|
1297
1354
|
hidden
|
|
@@ -1306,7 +1363,7 @@ function NativePicker({ label, placeholder, isRequired }) {
|
|
|
1306
1363
|
const node = state.collection.getItem(key);
|
|
1307
1364
|
if (!node || node.type !== "item") return null;
|
|
1308
1365
|
keys.set(String(key), key);
|
|
1309
|
-
return /* @__PURE__ */
|
|
1366
|
+
return /* @__PURE__ */ jsx19("option", { value: String(key), disabled: state.selectionManager.isDisabled(key), children: node.textValue }, String(key));
|
|
1310
1367
|
};
|
|
1311
1368
|
const value = state.value == null || Array.isArray(state.value) ? "" : String(state.value);
|
|
1312
1369
|
return /* @__PURE__ */ jsxs16(
|
|
@@ -1318,9 +1375,9 @@ function NativePicker({ label, placeholder, isRequired }) {
|
|
|
1318
1375
|
value,
|
|
1319
1376
|
onChange: (e) => state.setValue(e.target.value === "" ? null : keys.get(e.target.value) ?? e.target.value),
|
|
1320
1377
|
children: [
|
|
1321
|
-
/* @__PURE__ */
|
|
1378
|
+
/* @__PURE__ */ jsx19("option", { value: "", disabled: isRequired, children: placeholder }),
|
|
1322
1379
|
[...state.collection].map(
|
|
1323
|
-
(node) => node.type === "section" ? /* @__PURE__ */
|
|
1380
|
+
(node) => node.type === "section" ? /* @__PURE__ */ jsx19("optgroup", { label: node.textValue || node["aria-label"] || "", children: [...state.collection.getChildren(node.key)].map((child) => option(child.key)) }, String(node.key)) : option(node.key)
|
|
1324
1381
|
)
|
|
1325
1382
|
]
|
|
1326
1383
|
}
|
|
@@ -1332,11 +1389,11 @@ function SheetFooter({ commit, resultLabel }) {
|
|
|
1332
1389
|
if (!state) return null;
|
|
1333
1390
|
const count = Array.isArray(state.value) ? state.value.length : state.value == null ? 0 : 1;
|
|
1334
1391
|
return commit === "onClose" ? /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
1335
|
-
/* @__PURE__ */
|
|
1336
|
-
/* @__PURE__ */
|
|
1392
|
+
/* @__PURE__ */ jsx19(Button, { size: "lg", onPress: () => state.close(), children: resultLabel(state.value) }),
|
|
1393
|
+
/* @__PURE__ */ jsx19(Button, { size: "lg", variant: "secondary", onPress: () => state.setValue([]), isDisabled: count === 0, children: m.common.reset })
|
|
1337
1394
|
] }) : /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
1338
|
-
/* @__PURE__ */
|
|
1339
|
-
/* @__PURE__ */
|
|
1395
|
+
/* @__PURE__ */ jsx19("p", { className: "medo-sheet__count", "aria-live": "polite", children: m.common.countSelected(count) }),
|
|
1396
|
+
/* @__PURE__ */ jsx19(Button, { size: "lg", onPress: () => state.close(), children: m.common.done })
|
|
1340
1397
|
] });
|
|
1341
1398
|
}
|
|
1342
1399
|
function ApplyOnClose({ onApply }) {
|
|
@@ -1369,47 +1426,47 @@ import {
|
|
|
1369
1426
|
Text as Text7
|
|
1370
1427
|
} from "react-aria-components";
|
|
1371
1428
|
import { ChevronRight, Ellipsis } from "lucide-react";
|
|
1372
|
-
import { Fragment as Fragment10, jsx as
|
|
1429
|
+
import { Fragment as Fragment10, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1373
1430
|
import { createElement } from "react";
|
|
1374
1431
|
var MenuModeContext = createContext7({ size: "md" });
|
|
1375
1432
|
function MenuTrigger(props) {
|
|
1376
|
-
return /* @__PURE__ */
|
|
1433
|
+
return /* @__PURE__ */ jsx20(AriaMenuTrigger, { ...props });
|
|
1377
1434
|
}
|
|
1378
1435
|
function MenuButton({ "aria-label": label, size = "md" }) {
|
|
1379
|
-
return /* @__PURE__ */
|
|
1436
|
+
return /* @__PURE__ */ jsx20(IconButton, { variant: "ghost", size, icon: /* @__PURE__ */ jsx20(Ellipsis, {}), "aria-label": label });
|
|
1380
1437
|
}
|
|
1381
1438
|
function Menu({ title, overlay = "auto", className, ...props }) {
|
|
1382
1439
|
const mobile = useMediaQuery(MOBILE_QUERY);
|
|
1383
1440
|
const sheet = overlay === "sheet" || overlay === "auto" && mobile;
|
|
1384
|
-
if (sheet) return /* @__PURE__ */
|
|
1385
|
-
return /* @__PURE__ */
|
|
1441
|
+
if (sheet) return /* @__PURE__ */ jsx20(SheetMenu, { title, className, ...props });
|
|
1442
|
+
return /* @__PURE__ */ jsx20(Popover3, { placement: "bottom end", offset: 4, className: "medo-menu-popover", children: /* @__PURE__ */ jsx20(MenuModeContext.Provider, { value: { size: "md" }, children: /* @__PURE__ */ jsx20(AriaMenu, { ...props, className: cx("medo-menu", "medo-menu--md", className) }) }) });
|
|
1386
1443
|
}
|
|
1387
1444
|
function SheetMenu({ title, className, ...props }) {
|
|
1388
1445
|
const [view, setView] = useState6(null);
|
|
1389
|
-
return /* @__PURE__ */
|
|
1446
|
+
return /* @__PURE__ */ jsx20(
|
|
1390
1447
|
BottomSheet,
|
|
1391
1448
|
{
|
|
1392
1449
|
title: view ? view.title : title ?? props["aria-label"],
|
|
1393
1450
|
onBack: view ? () => setView(null) : void 0,
|
|
1394
1451
|
onOpenChange: (open) => !open && setView(null),
|
|
1395
|
-
children: /* @__PURE__ */
|
|
1452
|
+
children: /* @__PURE__ */ jsx20(MenuModeContext.Provider, { value: { size: "lg", push: (t, c) => setView({ title: t, children: c }) }, children: view ? /* @__PURE__ */ jsx20(AriaMenu, { "aria-label": typeof view.title === "string" ? view.title : void 0, autoFocus: "first", className: cx("medo-menu", "medo-menu--lg", className), children: view.children }, "sub") : /* @__PURE__ */ createElement(AriaMenu, { ...props, key: "main", className: cx("medo-menu", "medo-menu--lg", className) }) })
|
|
1396
1453
|
}
|
|
1397
1454
|
);
|
|
1398
1455
|
}
|
|
1399
1456
|
function MenuItem({ children, icon, shortcut, variant = "default", textValue, ...props }) {
|
|
1400
1457
|
const m = useMessages();
|
|
1401
1458
|
const { size } = useContext11(MenuModeContext);
|
|
1402
|
-
return /* @__PURE__ */
|
|
1459
|
+
return /* @__PURE__ */ jsx20(
|
|
1403
1460
|
AriaMenuItem,
|
|
1404
1461
|
{
|
|
1405
1462
|
...props,
|
|
1406
1463
|
textValue: textValue ?? children,
|
|
1407
1464
|
className: cx("medo-menu-item", variant === "danger" && "medo-menu-item--danger"),
|
|
1408
1465
|
children: ({ hasSubmenu }) => /* @__PURE__ */ jsxs17(Fragment10, { children: [
|
|
1409
|
-
/* @__PURE__ */
|
|
1410
|
-
/* @__PURE__ */
|
|
1411
|
-
shortcut && size === "md" && /* @__PURE__ */
|
|
1412
|
-
hasSubmenu && /* @__PURE__ */
|
|
1466
|
+
/* @__PURE__ */ jsx20("span", { className: "medo-menu-item__icon", "aria-hidden": "true", children: icon }),
|
|
1467
|
+
/* @__PURE__ */ jsx20(Text7, { slot: "label", className: "medo-menu-item__label", children }),
|
|
1468
|
+
shortcut && size === "md" && /* @__PURE__ */ jsx20(Keyboard, { className: "medo-menu-item__shortcut", children: formatShortcut(shortcut, m.keys.control) }),
|
|
1469
|
+
hasSubmenu && /* @__PURE__ */ jsx20("span", { className: "medo-menu-item__chevron", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(ChevronRight, {}) })
|
|
1413
1470
|
] })
|
|
1414
1471
|
}
|
|
1415
1472
|
);
|
|
@@ -1426,21 +1483,21 @@ function Submenu({ label, icon, children, isDisabled }) {
|
|
|
1426
1483
|
onAction: () => push(label, children),
|
|
1427
1484
|
className: "medo-menu-item",
|
|
1428
1485
|
children: [
|
|
1429
|
-
/* @__PURE__ */
|
|
1430
|
-
/* @__PURE__ */
|
|
1431
|
-
/* @__PURE__ */
|
|
1486
|
+
/* @__PURE__ */ jsx20("span", { className: "medo-menu-item__icon", "aria-hidden": "true", children: icon }),
|
|
1487
|
+
/* @__PURE__ */ jsx20(Text7, { slot: "label", className: "medo-menu-item__label", children: label }),
|
|
1488
|
+
/* @__PURE__ */ jsx20("span", { className: "medo-menu-item__chevron", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(ChevronRight, {}) })
|
|
1432
1489
|
]
|
|
1433
1490
|
}
|
|
1434
1491
|
);
|
|
1435
1492
|
}
|
|
1436
1493
|
return /* @__PURE__ */ jsxs17(SubmenuTrigger, { children: [
|
|
1437
|
-
/* @__PURE__ */
|
|
1438
|
-
/* @__PURE__ */
|
|
1494
|
+
/* @__PURE__ */ jsx20(MenuItem, { icon, isDisabled, children: label }),
|
|
1495
|
+
/* @__PURE__ */ jsx20(Popover3, { placement: "end top", offset: 4, crossOffset: -5, className: "medo-menu-popover", children: /* @__PURE__ */ jsx20(AriaMenu, { "aria-label": label, className: cx("medo-menu", `medo-menu--${size}`), children }) })
|
|
1439
1496
|
] });
|
|
1440
1497
|
}
|
|
1441
1498
|
function MenuSection({ title, children, ...props }) {
|
|
1442
1499
|
return /* @__PURE__ */ jsxs17(AriaMenuSection, { "aria-label": props["aria-label"], className: "medo-menu__section", children: [
|
|
1443
|
-
title && /* @__PURE__ */
|
|
1500
|
+
title && /* @__PURE__ */ jsx20(Header2, { className: "medo-listbox__header", children: title }),
|
|
1444
1501
|
children
|
|
1445
1502
|
] });
|
|
1446
1503
|
}
|
|
@@ -1450,7 +1507,7 @@ import { useContext as useContext12, useEffect as useEffect5, useId as useId3, u
|
|
|
1450
1507
|
import { Dialog as AriaDialog, DialogContext, Heading as Heading2, Modal as Modal2, ModalOverlay as ModalOverlay2, OverlayTriggerStateContext as OverlayTriggerStateContext2, Provider } from "react-aria-components";
|
|
1451
1508
|
import { CircleAlert as CircleAlert2, Info, TriangleAlert, X as X5 } from "lucide-react";
|
|
1452
1509
|
import { DialogTrigger } from "react-aria-components";
|
|
1453
|
-
import { Fragment as Fragment11, jsx as
|
|
1510
|
+
import { Fragment as Fragment11, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1454
1511
|
function useOpenState({ isOpen, onOpenChange }) {
|
|
1455
1512
|
const trigger = useContext12(OverlayTriggerStateContext2);
|
|
1456
1513
|
const open = isOpen ?? trigger?.isOpen ?? false;
|
|
@@ -1473,7 +1530,7 @@ function ActionButton({ action, close, size, variant }) {
|
|
|
1473
1530
|
setPending(false);
|
|
1474
1531
|
}
|
|
1475
1532
|
};
|
|
1476
|
-
return /* @__PURE__ */
|
|
1533
|
+
return /* @__PURE__ */ jsx21(
|
|
1477
1534
|
Button,
|
|
1478
1535
|
{
|
|
1479
1536
|
variant: action.variant ?? variant,
|
|
@@ -1488,7 +1545,7 @@ function ActionButton({ action, close, size, variant }) {
|
|
|
1488
1545
|
);
|
|
1489
1546
|
}
|
|
1490
1547
|
function Nested({ children }) {
|
|
1491
|
-
return /* @__PURE__ */
|
|
1548
|
+
return /* @__PURE__ */ jsx21(
|
|
1492
1549
|
Provider,
|
|
1493
1550
|
{
|
|
1494
1551
|
values: [
|
|
@@ -1514,7 +1571,7 @@ function useDirtyGuard({ isDirty = false, discardText, ...openProps }) {
|
|
|
1514
1571
|
cancelLabel: m.dialog.discardCancel,
|
|
1515
1572
|
...discardText
|
|
1516
1573
|
};
|
|
1517
|
-
const confirmDiscard = /* @__PURE__ */
|
|
1574
|
+
const confirmDiscard = /* @__PURE__ */ jsx21(Nested, { children: /* @__PURE__ */ jsx21(
|
|
1518
1575
|
AlertDialog,
|
|
1519
1576
|
{
|
|
1520
1577
|
tone: "warning",
|
|
@@ -1564,25 +1621,25 @@ function Dialog2({
|
|
|
1564
1621
|
isDismissable: !isDirty,
|
|
1565
1622
|
className,
|
|
1566
1623
|
footer: primaryAction && ((close) => /* @__PURE__ */ jsxs18(ButtonGroup, { children: [
|
|
1567
|
-
/* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
1624
|
+
/* @__PURE__ */ jsx21(Button, { variant: "secondary", size: "lg", onPress: close, children: cancelLabel }),
|
|
1625
|
+
/* @__PURE__ */ jsx21(ActionButton, { action: primaryAction, close: forceClose, size: "lg", variant: "primary" })
|
|
1569
1626
|
] })),
|
|
1570
1627
|
children: [
|
|
1571
|
-
/* @__PURE__ */
|
|
1628
|
+
/* @__PURE__ */ jsx21(SheetContent, { description, children: content(forceClose) }),
|
|
1572
1629
|
confirmDiscard
|
|
1573
1630
|
]
|
|
1574
1631
|
}
|
|
1575
1632
|
);
|
|
1576
1633
|
}
|
|
1577
1634
|
const fullscreen = layout === "fullscreen";
|
|
1578
|
-
return /* @__PURE__ */
|
|
1635
|
+
return /* @__PURE__ */ jsx21(
|
|
1579
1636
|
ModalOverlay2,
|
|
1580
1637
|
{
|
|
1581
1638
|
isOpen: open,
|
|
1582
1639
|
onOpenChange,
|
|
1583
1640
|
isDismissable: !isDirty,
|
|
1584
1641
|
className: cx("medo-dialog-overlay", fullscreen && "medo-dialog-overlay--fullscreen"),
|
|
1585
|
-
children: /* @__PURE__ */
|
|
1642
|
+
children: /* @__PURE__ */ jsx21(Modal2, { className: cx("medo-dialog", fullscreen ? "medo-dialog--fullscreen" : `medo-dialog--${size}`, className), children: /* @__PURE__ */ jsx21(
|
|
1586
1643
|
DialogFrame,
|
|
1587
1644
|
{
|
|
1588
1645
|
title,
|
|
@@ -1605,29 +1662,29 @@ function DialogFrame({ title, description, fullscreen, primaryAction, cancelLabe
|
|
|
1605
1662
|
const ref = useRef5(null);
|
|
1606
1663
|
const [scrolls, setScrolls] = useState7(false);
|
|
1607
1664
|
useInitialFocus(ref);
|
|
1608
|
-
return /* @__PURE__ */
|
|
1665
|
+
return /* @__PURE__ */ jsx21(AriaDialog, { ref, className: "medo-dialog__dialog", "aria-describedby": description ? descriptionId : void 0, "data-scrolled": scrolls || void 0, children: ({ close }) => fullscreen ? /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
1609
1666
|
/* @__PURE__ */ jsxs18("div", { className: "medo-dialog__bar", children: [
|
|
1610
|
-
/* @__PURE__ */
|
|
1611
|
-
/* @__PURE__ */
|
|
1612
|
-
primaryAction ? /* @__PURE__ */
|
|
1667
|
+
/* @__PURE__ */ jsx21(Button, { variant: "ghost", size: "md", onPress: close, children: primaryAction ? cancelLabel : closeLabel }),
|
|
1668
|
+
/* @__PURE__ */ jsx21(Heading2, { slot: "title", className: "medo-dialog__bar-title", children: title }),
|
|
1669
|
+
primaryAction ? /* @__PURE__ */ jsx21(ActionButton, { action: primaryAction, close: forceClose, size: "md", variant: "primary" }) : /* @__PURE__ */ jsx21("span", {})
|
|
1613
1670
|
] }),
|
|
1614
1671
|
/* @__PURE__ */ jsxs18(DialogBody, { onScrollsChange: setScrolls, children: [
|
|
1615
|
-
description && /* @__PURE__ */
|
|
1672
|
+
description && /* @__PURE__ */ jsx21("p", { id: descriptionId, className: "medo-dialog__description", children: description }),
|
|
1616
1673
|
children(forceClose)
|
|
1617
1674
|
] }),
|
|
1618
1675
|
nested
|
|
1619
1676
|
] }) : /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
1620
1677
|
/* @__PURE__ */ jsxs18("div", { className: "medo-dialog__header", children: [
|
|
1621
1678
|
/* @__PURE__ */ jsxs18("div", { className: "medo-dialog__heading", children: [
|
|
1622
|
-
/* @__PURE__ */
|
|
1623
|
-
description && /* @__PURE__ */
|
|
1679
|
+
/* @__PURE__ */ jsx21(Heading2, { slot: "title", className: "medo-dialog__title", children: title }),
|
|
1680
|
+
description && /* @__PURE__ */ jsx21("p", { id: descriptionId, className: "medo-dialog__description", children: description })
|
|
1624
1681
|
] }),
|
|
1625
|
-
showClose && /* @__PURE__ */
|
|
1682
|
+
showClose && /* @__PURE__ */ jsx21(IconButton, { variant: "ghost", size: "sm", icon: /* @__PURE__ */ jsx21(X5, {}), "aria-label": closeLabel, tooltip: false, onPress: close })
|
|
1626
1683
|
] }),
|
|
1627
|
-
/* @__PURE__ */
|
|
1628
|
-
primaryAction && /* @__PURE__ */
|
|
1629
|
-
/* @__PURE__ */
|
|
1630
|
-
/* @__PURE__ */
|
|
1684
|
+
/* @__PURE__ */ jsx21(DialogBody, { onScrollsChange: setScrolls, children: children(forceClose) }),
|
|
1685
|
+
primaryAction && /* @__PURE__ */ jsx21("div", { className: "medo-dialog__footer", children: /* @__PURE__ */ jsxs18(ButtonGroup, { children: [
|
|
1686
|
+
/* @__PURE__ */ jsx21(Button, { variant: "secondary", onPress: close, children: cancelLabel }),
|
|
1687
|
+
/* @__PURE__ */ jsx21(ActionButton, { action: primaryAction, close: forceClose, size: "md", variant: "primary" })
|
|
1631
1688
|
] }) }),
|
|
1632
1689
|
nested
|
|
1633
1690
|
] }) });
|
|
@@ -1646,11 +1703,11 @@ function DialogBody({ children, onScrollsChange }) {
|
|
|
1646
1703
|
return () => observer.disconnect();
|
|
1647
1704
|
}, []);
|
|
1648
1705
|
useEffect5(() => onScrollsChange(scrolls), [scrolls, onScrollsChange]);
|
|
1649
|
-
return /* @__PURE__ */
|
|
1706
|
+
return /* @__PURE__ */ jsx21("div", { ref, className: "medo-dialog__body", tabIndex: scrolls ? 0 : void 0, children: /* @__PURE__ */ jsx21("div", { className: "medo-dialog__body-inner", children }) });
|
|
1650
1707
|
}
|
|
1651
1708
|
function SheetContent({ description, children }) {
|
|
1652
1709
|
return /* @__PURE__ */ jsxs18("div", { className: "medo-dialog__sheet-body", children: [
|
|
1653
|
-
description && /* @__PURE__ */
|
|
1710
|
+
description && /* @__PURE__ */ jsx21("p", { className: "medo-dialog__description", children: description }),
|
|
1654
1711
|
children
|
|
1655
1712
|
] });
|
|
1656
1713
|
}
|
|
@@ -1677,17 +1734,17 @@ function AlertDialog({ tone = "danger", title, children, actionLabel, onAction,
|
|
|
1677
1734
|
const descriptionId = useId3();
|
|
1678
1735
|
const Icon = TONE_ICONS[tone];
|
|
1679
1736
|
const size = isMobile ? "lg" : "md";
|
|
1680
|
-
return /* @__PURE__ */
|
|
1737
|
+
return /* @__PURE__ */ jsx21(ModalOverlay2, { isOpen: open, onOpenChange: setOpen, isDismissable: false, className: "medo-dialog-overlay", children: /* @__PURE__ */ jsx21(Modal2, { className: cx("medo-dialog", "medo-alert-dialog", `medo-alert-dialog--${tone}`, className), children: /* @__PURE__ */ jsx21(AriaDialog, { role: "alertdialog", "aria-describedby": children ? descriptionId : void 0, className: "medo-dialog__dialog", children: ({ close }) => /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
1681
1738
|
/* @__PURE__ */ jsxs18("div", { className: "medo-alert-dialog__content", children: [
|
|
1682
|
-
/* @__PURE__ */
|
|
1739
|
+
/* @__PURE__ */ jsx21("span", { className: "medo-alert-dialog__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx21(Icon, {}) }),
|
|
1683
1740
|
/* @__PURE__ */ jsxs18("div", { className: "medo-alert-dialog__text", children: [
|
|
1684
|
-
/* @__PURE__ */
|
|
1685
|
-
children && /* @__PURE__ */
|
|
1741
|
+
/* @__PURE__ */ jsx21(Heading2, { slot: "title", className: "medo-alert-dialog__title", children: title }),
|
|
1742
|
+
children && /* @__PURE__ */ jsx21("div", { id: descriptionId, className: "medo-alert-dialog__description", children })
|
|
1686
1743
|
] })
|
|
1687
1744
|
] }),
|
|
1688
1745
|
/* @__PURE__ */ jsxs18(ButtonGroup, { children: [
|
|
1689
|
-
/* @__PURE__ */
|
|
1690
|
-
/* @__PURE__ */
|
|
1746
|
+
/* @__PURE__ */ jsx21(Button, { variant: "secondary", size, autoFocus: true, onPress: close, children: cancelLabel }),
|
|
1747
|
+
/* @__PURE__ */ jsx21(ActionButton, { action: { label: actionLabel, onAction }, close, size, variant: tone === "danger" ? "danger" : "primary" })
|
|
1691
1748
|
] })
|
|
1692
1749
|
] }) }) }) });
|
|
1693
1750
|
}
|
|
@@ -1708,7 +1765,7 @@ import {
|
|
|
1708
1765
|
useFilter
|
|
1709
1766
|
} from "react-aria-components";
|
|
1710
1767
|
import { ChevronDown as ChevronDown2, CircleAlert as CircleAlert3, Plus, Search, X as X6 } from "lucide-react";
|
|
1711
|
-
import { Fragment as Fragment12, jsx as
|
|
1768
|
+
import { Fragment as Fragment12, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1712
1769
|
var CREATE_KEY = "__medo_create__";
|
|
1713
1770
|
function Combobox({
|
|
1714
1771
|
label,
|
|
@@ -1762,7 +1819,7 @@ function Combobox({
|
|
|
1762
1819
|
};
|
|
1763
1820
|
const mobile = useMediaQuery(MOBILE_QUERY);
|
|
1764
1821
|
if (overlay === "sheet" || overlay === "auto" && mobile) {
|
|
1765
|
-
return /* @__PURE__ */
|
|
1822
|
+
return /* @__PURE__ */ jsx22(
|
|
1766
1823
|
ComboboxSheet,
|
|
1767
1824
|
{
|
|
1768
1825
|
...{
|
|
@@ -1819,22 +1876,22 @@ function Combobox({
|
|
|
1819
1876
|
allowsEmptyCollection: true,
|
|
1820
1877
|
className: cx("medo-field", "medo-combobox", className),
|
|
1821
1878
|
children: [
|
|
1822
|
-
/* @__PURE__ */
|
|
1879
|
+
/* @__PURE__ */ jsx22(FieldLabel, { isRequired: props.isRequired, children: label }),
|
|
1823
1880
|
/* @__PURE__ */ jsxs19(Group, { ref: groupRef, className: cx("medo-input", `medo-input--${size}`, "medo-combobox__field"), onMouseDown: focusInput, children: [
|
|
1824
|
-
leadingIcon && /* @__PURE__ */
|
|
1881
|
+
leadingIcon && /* @__PURE__ */ jsx22("span", { className: "medo-input__icon", "aria-hidden": "true", children: leadingIcon }),
|
|
1825
1882
|
multiple ? (
|
|
1826
1883
|
/* Tags and input share one line; the tags get what is left after 4 rem for typing. */
|
|
1827
1884
|
/* @__PURE__ */ jsxs19("span", { className: "medo-combobox__entry", ref: entryRef, children: [
|
|
1828
|
-
/* @__PURE__ */
|
|
1829
|
-
/* @__PURE__ */
|
|
1885
|
+
/* @__PURE__ */ jsx22(SelectedTags2, { entryRef, size, label, isDisabled: props.isDisabled, isReadOnly: props.isReadOnly }),
|
|
1886
|
+
/* @__PURE__ */ jsx22(ComboInput, { ref: inputRef, placeholder, multiple: true, onRemoved: setAnnouncement })
|
|
1830
1887
|
] })
|
|
1831
|
-
) : /* @__PURE__ */
|
|
1832
|
-
/* @__PURE__ */
|
|
1833
|
-
!props.isReadOnly && /* @__PURE__ */
|
|
1888
|
+
) : /* @__PURE__ */ jsx22(ComboInput, { ref: inputRef, placeholder, multiple: false, onRemoved: setAnnouncement }),
|
|
1889
|
+
/* @__PURE__ */ jsx22(ClearButton2, { inputRef, isDisabled: props.isDisabled || props.isReadOnly }),
|
|
1890
|
+
!props.isReadOnly && /* @__PURE__ */ jsx22(AriaButton7, { className: "medo-input__action medo-combobox__toggle", children: /* @__PURE__ */ jsx22(ChevronDown2, { "aria-hidden": "true" }) })
|
|
1834
1891
|
] }),
|
|
1835
|
-
/* @__PURE__ */
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
-
/* @__PURE__ */
|
|
1892
|
+
/* @__PURE__ */ jsx22(FieldFooter, { description, errorMessage }),
|
|
1893
|
+
/* @__PURE__ */ jsx22("span", { className: "medo-visually-hidden", "aria-live": "polite", children: announcement }),
|
|
1894
|
+
/* @__PURE__ */ jsx22(Popover4, { offset: 4, className: "medo-listbox-popover", children: /* @__PURE__ */ jsx22(
|
|
1838
1895
|
ComboList,
|
|
1839
1896
|
{
|
|
1840
1897
|
size,
|
|
@@ -1867,7 +1924,7 @@ function ComboInput({
|
|
|
1867
1924
|
state.setValue(values.slice(0, -1));
|
|
1868
1925
|
if (last) onRemoved(m.common.removed([last.textValue]));
|
|
1869
1926
|
};
|
|
1870
|
-
return /* @__PURE__ */
|
|
1927
|
+
return /* @__PURE__ */ jsx22(
|
|
1871
1928
|
Input,
|
|
1872
1929
|
{
|
|
1873
1930
|
ref,
|
|
@@ -1883,13 +1940,13 @@ function ClearButton2({ inputRef, isDisabled }) {
|
|
|
1883
1940
|
if (!state || isDisabled) return null;
|
|
1884
1941
|
const hasValue = Array.isArray(state.value) ? state.value.length > 0 : state.value != null;
|
|
1885
1942
|
if (!hasValue && !state.inputValue) return null;
|
|
1886
|
-
return /* @__PURE__ */
|
|
1943
|
+
return /* @__PURE__ */ jsx22(
|
|
1887
1944
|
InputAction,
|
|
1888
1945
|
{
|
|
1889
1946
|
slot: null,
|
|
1890
1947
|
excludeFromTabOrder: true,
|
|
1891
1948
|
"aria-label": Array.isArray(state.value) ? m.common.clearAll : m.common.clear,
|
|
1892
|
-
icon: /* @__PURE__ */
|
|
1949
|
+
icon: /* @__PURE__ */ jsx22(X6, {}),
|
|
1893
1950
|
onPress: () => {
|
|
1894
1951
|
state.setValue(Array.isArray(state.value) ? [] : null);
|
|
1895
1952
|
state.setInputValue("");
|
|
@@ -1919,15 +1976,15 @@ function SelectedTags2({
|
|
|
1919
1976
|
return /* @__PURE__ */ jsxs19("span", { className: "medo-combobox__tags-row", children: [
|
|
1920
1977
|
/* @__PURE__ */ jsxs19("span", { className: cx("medo-combobox__measure"), ref: measureRef, "aria-hidden": "true", children: [
|
|
1921
1978
|
items.map((item) => /* @__PURE__ */ jsxs19("span", { className: cx("medo-tag", `medo-tag--${tagSize}`), "data-allows-removing": "", children: [
|
|
1922
|
-
/* @__PURE__ */
|
|
1923
|
-
/* @__PURE__ */
|
|
1979
|
+
/* @__PURE__ */ jsx22("span", { className: "medo-tag__label", children: item.textValue }),
|
|
1980
|
+
/* @__PURE__ */ jsx22("span", { className: "medo-tag__remove" })
|
|
1924
1981
|
] }, item.key)),
|
|
1925
1982
|
/* @__PURE__ */ jsxs19("span", { className: cx("medo-tag", `medo-tag--${tagSize}`), children: [
|
|
1926
1983
|
"+",
|
|
1927
1984
|
items.length
|
|
1928
1985
|
] })
|
|
1929
1986
|
] }),
|
|
1930
|
-
/* @__PURE__ */
|
|
1987
|
+
/* @__PURE__ */ jsx22(
|
|
1931
1988
|
TagGroup,
|
|
1932
1989
|
{
|
|
1933
1990
|
"aria-label": m.common.selected(name),
|
|
@@ -1936,13 +1993,13 @@ function SelectedTags2({
|
|
|
1936
1993
|
items: items.slice(0, visible),
|
|
1937
1994
|
disabledKeys: isDisabled ? items.map((item) => item.key) : void 0,
|
|
1938
1995
|
onRemove: isReadOnly ? void 0 : (keys) => state.setValue(values.filter((k) => !keys.has(k))),
|
|
1939
|
-
children: (item) => /* @__PURE__ */
|
|
1996
|
+
children: (item) => /* @__PURE__ */ jsx22(Tag, { id: item.key, children: item.textValue })
|
|
1940
1997
|
}
|
|
1941
1998
|
),
|
|
1942
1999
|
hidden > 0 && /* @__PURE__ */ jsxs19("span", { className: cx("medo-tag", `medo-tag--${tagSize}`, "medo-combobox__more"), children: [
|
|
1943
2000
|
"+",
|
|
1944
2001
|
hidden,
|
|
1945
|
-
/* @__PURE__ */
|
|
2002
|
+
/* @__PURE__ */ jsx22("span", { className: "medo-visually-hidden", children: " more selected" })
|
|
1946
2003
|
] })
|
|
1947
2004
|
] });
|
|
1948
2005
|
}
|
|
@@ -1987,10 +2044,10 @@ function ComboList({
|
|
|
1987
2044
|
ListBox,
|
|
1988
2045
|
{
|
|
1989
2046
|
size: size === "lg" ? "lg" : "md",
|
|
1990
|
-
renderEmptyState: () => /* @__PURE__ */
|
|
2047
|
+
renderEmptyState: () => /* @__PURE__ */ jsx22(ListBoxMessage, { children: isLoading ? `${m.common.loading}\u2026` : noResultsMessage(text) }),
|
|
1991
2048
|
children: [
|
|
1992
|
-
typeof children === "function" ? /* @__PURE__ */
|
|
1993
|
-
creatable && text && !exact && /* @__PURE__ */
|
|
2049
|
+
typeof children === "function" ? /* @__PURE__ */ jsx22(Collection2, { items, children }) : children,
|
|
2050
|
+
creatable && text && !exact && /* @__PURE__ */ jsx22(ListBoxSection, { "aria-label": m.common.create, children: /* @__PURE__ */ jsx22(Option, { id: CREATE_KEY, icon: /* @__PURE__ */ jsx22(Plus, {}), textValue: text, children: m.common.add(text) }) })
|
|
1994
2051
|
]
|
|
1995
2052
|
}
|
|
1996
2053
|
),
|
|
@@ -2044,7 +2101,7 @@ function ComboboxSheet({
|
|
|
2044
2101
|
const keys = Array.isArray(value) ? value : value == null ? [] : [value];
|
|
2045
2102
|
const opened = useRef6(null);
|
|
2046
2103
|
const query = search.trim();
|
|
2047
|
-
const content = typeof children === "function" ? /* @__PURE__ */
|
|
2104
|
+
const content = typeof children === "function" ? /* @__PURE__ */ jsx22(Collection2, { items: list, children }) : children;
|
|
2048
2105
|
const open = (next) => {
|
|
2049
2106
|
if (next) {
|
|
2050
2107
|
setSearch("");
|
|
@@ -2066,7 +2123,7 @@ function ComboboxSheet({
|
|
|
2066
2123
|
};
|
|
2067
2124
|
const descId = description ? `${id}-desc` : void 0;
|
|
2068
2125
|
const errId = isInvalid && errorMessage ? `${id}-err` : void 0;
|
|
2069
|
-
return /* @__PURE__ */
|
|
2126
|
+
return /* @__PURE__ */ jsx22(CollectionBuilder, { content, children: (collection) => {
|
|
2070
2127
|
const nodes = [...collection.getKeys()].map((key) => collection.getItem(key)).filter((node) => node?.type === "item");
|
|
2071
2128
|
const text = keys.map((key) => collection.getItem(key)?.textValue ?? String(key));
|
|
2072
2129
|
const exact = nodes.some((node) => node.textValue.toLocaleLowerCase() === query.toLocaleLowerCase());
|
|
@@ -2081,9 +2138,9 @@ function ComboboxSheet({
|
|
|
2081
2138
|
children: [
|
|
2082
2139
|
/* @__PURE__ */ jsxs19("span", { className: "medo-field__label", id: `${id}-label`, children: [
|
|
2083
2140
|
label,
|
|
2084
|
-
isRequired && /* @__PURE__ */
|
|
2141
|
+
isRequired && /* @__PURE__ */ jsx22("span", { className: "medo-field__required", "aria-hidden": "true", children: "*" })
|
|
2085
2142
|
] }),
|
|
2086
|
-
/* @__PURE__ */
|
|
2143
|
+
/* @__PURE__ */ jsx22("div", { className: cx("medo-input", `medo-input--${size}`, "medo-select__field"), children: /* @__PURE__ */ jsxs19(
|
|
2087
2144
|
AriaButton7,
|
|
2088
2145
|
{
|
|
2089
2146
|
className: "medo-select__trigger",
|
|
@@ -2093,21 +2150,21 @@ function ComboboxSheet({
|
|
|
2093
2150
|
"aria-describedby": [errId ?? descId].filter(Boolean).join(" ") || void 0,
|
|
2094
2151
|
onPress: () => !isReadOnly && open(true),
|
|
2095
2152
|
children: [
|
|
2096
|
-
leadingIcon && /* @__PURE__ */
|
|
2153
|
+
leadingIcon && /* @__PURE__ */ jsx22("span", { className: "medo-input__icon", "aria-hidden": "true", children: leadingIcon }),
|
|
2097
2154
|
/* @__PURE__ */ jsxs19("span", { className: "medo-select__value", id: `${id}-value`, "data-placeholder": keys.length === 0 || void 0, children: [
|
|
2098
|
-
keys.length === 0 ? placeholder : multiple ? /* @__PURE__ */
|
|
2099
|
-
isReadOnly && /* @__PURE__ */
|
|
2155
|
+
keys.length === 0 ? placeholder : multiple ? /* @__PURE__ */ jsx22(DisplayTags, { labels: text, size }) : text[0],
|
|
2156
|
+
isReadOnly && /* @__PURE__ */ jsx22("span", { className: "medo-visually-hidden", children: ", read only" })
|
|
2100
2157
|
] }),
|
|
2101
|
-
!isReadOnly && /* @__PURE__ */
|
|
2158
|
+
!isReadOnly && /* @__PURE__ */ jsx22("span", { className: "medo-select__chevron", "aria-hidden": "true", children: /* @__PURE__ */ jsx22(ChevronDown2, {}) })
|
|
2102
2159
|
]
|
|
2103
2160
|
}
|
|
2104
2161
|
) }),
|
|
2105
|
-
/* @__PURE__ */
|
|
2106
|
-
/* @__PURE__ */
|
|
2107
|
-
/* @__PURE__ */
|
|
2108
|
-
] }) : description && /* @__PURE__ */
|
|
2109
|
-
name && keys.map((key) => /* @__PURE__ */
|
|
2110
|
-
/* @__PURE__ */
|
|
2162
|
+
/* @__PURE__ */ jsx22("div", { className: "medo-field__footer", children: isInvalid && errorMessage ? /* @__PURE__ */ jsxs19("span", { className: "medo-field__error", id: errId, children: [
|
|
2163
|
+
/* @__PURE__ */ jsx22(CircleAlert3, { "aria-hidden": "true" }),
|
|
2164
|
+
/* @__PURE__ */ jsx22("span", { children: errorMessage })
|
|
2165
|
+
] }) : description && /* @__PURE__ */ jsx22("span", { className: "medo-field__description", id: descId, children: description }) }),
|
|
2166
|
+
name && keys.map((key) => /* @__PURE__ */ jsx22("input", { type: "hidden", name, value: String(key) }, String(key))),
|
|
2167
|
+
/* @__PURE__ */ jsx22(
|
|
2111
2168
|
BottomSheet,
|
|
2112
2169
|
{
|
|
2113
2170
|
title: label,
|
|
@@ -2115,18 +2172,18 @@ function ComboboxSheet({
|
|
|
2115
2172
|
isOpen,
|
|
2116
2173
|
onOpenChange: open,
|
|
2117
2174
|
footer: multiple ? commit === "onClose" ? (close) => /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
2118
|
-
/* @__PURE__ */
|
|
2119
|
-
/* @__PURE__ */
|
|
2175
|
+
/* @__PURE__ */ jsx22(Button, { size: "lg", onPress: close, children: resultLabel(keys) }),
|
|
2176
|
+
/* @__PURE__ */ jsx22(Button, { size: "lg", variant: "secondary", onPress: () => onValueChange([]), isDisabled: keys.length === 0, children: m.common.reset })
|
|
2120
2177
|
] }) : (close) => /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
2121
|
-
/* @__PURE__ */
|
|
2122
|
-
/* @__PURE__ */
|
|
2178
|
+
/* @__PURE__ */ jsx22("p", { className: "medo-sheet__count", "aria-live": "polite", children: m.common.countSelected(keys.length) }),
|
|
2179
|
+
/* @__PURE__ */ jsx22(Button, { size: "lg", onPress: close, children: m.common.done })
|
|
2123
2180
|
] }) : void 0,
|
|
2124
2181
|
children: /* @__PURE__ */ jsxs19(Autocomplete, { inputValue: search, onInputChange: setSearch, filter: items ? void 0 : contains, children: [
|
|
2125
|
-
/* @__PURE__ */
|
|
2126
|
-
/* @__PURE__ */
|
|
2127
|
-
/* @__PURE__ */
|
|
2182
|
+
/* @__PURE__ */ jsx22("div", { className: "medo-sheet__search", children: /* @__PURE__ */ jsxs19(AriaTextField2, { "aria-label": m.common.search, autoFocus: true, className: "medo-input medo-input--lg", children: [
|
|
2183
|
+
/* @__PURE__ */ jsx22("span", { className: "medo-input__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx22(Search, {}) }),
|
|
2184
|
+
/* @__PURE__ */ jsx22(Input, { className: "medo-input__control", placeholder })
|
|
2128
2185
|
] }) }),
|
|
2129
|
-
/* @__PURE__ */
|
|
2186
|
+
/* @__PURE__ */ jsx22(OptionHighlightContext.Provider, { value: query, children: /* @__PURE__ */ jsxs19(
|
|
2130
2187
|
ListBox,
|
|
2131
2188
|
{
|
|
2132
2189
|
size: "lg",
|
|
@@ -2134,14 +2191,14 @@ function ComboboxSheet({
|
|
|
2134
2191
|
selectionMode: multiple ? "multiple" : "single",
|
|
2135
2192
|
selectedKeys: keys,
|
|
2136
2193
|
onSelectionChange,
|
|
2137
|
-
renderEmptyState: () => /* @__PURE__ */
|
|
2194
|
+
renderEmptyState: () => /* @__PURE__ */ jsx22(ListBoxMessage, { children: isLoading ? `${m.common.loading}\u2026` : noResultsMessage(query) }),
|
|
2138
2195
|
children: [
|
|
2139
2196
|
content,
|
|
2140
|
-
multiple && onCreate && query && !exact && /* @__PURE__ */
|
|
2197
|
+
multiple && onCreate && query && !exact && /* @__PURE__ */ jsx22(ListBoxSection, { "aria-label": m.common.create, children: /* @__PURE__ */ jsx22(Option, { id: CREATE_KEY, icon: /* @__PURE__ */ jsx22(Plus, {}), textValue: query, children: m.common.add(query) }) })
|
|
2141
2198
|
]
|
|
2142
2199
|
}
|
|
2143
2200
|
) }),
|
|
2144
|
-
isLoading && list && [...list].length > 0 && /* @__PURE__ */
|
|
2201
|
+
isLoading && list && [...list].length > 0 && /* @__PURE__ */ jsx22(ListBoxMessage, { children: "Loading\u2026" })
|
|
2145
2202
|
] })
|
|
2146
2203
|
}
|
|
2147
2204
|
)
|
|
@@ -2156,15 +2213,15 @@ function DisplayTags({ labels, size }) {
|
|
|
2156
2213
|
const visible = useFitCount(rowRef, measureRef, labels.join("\0"), labels.length);
|
|
2157
2214
|
const tagClass = cx("medo-tag", size === "lg" ? "medo-tag--md" : "medo-tag--sm");
|
|
2158
2215
|
return /* @__PURE__ */ jsxs19("span", { className: "medo-select__tags", ref: rowRef, children: [
|
|
2159
|
-
/* @__PURE__ */
|
|
2216
|
+
/* @__PURE__ */ jsx22("span", { className: "medo-visually-hidden", children: labels.join(", ") }),
|
|
2160
2217
|
/* @__PURE__ */ jsxs19("span", { className: "medo-select__measure", ref: measureRef, "aria-hidden": "true", children: [
|
|
2161
|
-
labels.map((l, i) => /* @__PURE__ */
|
|
2218
|
+
labels.map((l, i) => /* @__PURE__ */ jsx22("span", { className: tagClass, children: l }, i)),
|
|
2162
2219
|
/* @__PURE__ */ jsxs19("span", { className: tagClass, children: [
|
|
2163
2220
|
"+",
|
|
2164
2221
|
labels.length
|
|
2165
2222
|
] })
|
|
2166
2223
|
] }),
|
|
2167
|
-
labels.slice(0, visible).map((l, i) => /* @__PURE__ */
|
|
2224
|
+
labels.slice(0, visible).map((l, i) => /* @__PURE__ */ jsx22("span", { className: tagClass, "aria-hidden": "true", children: /* @__PURE__ */ jsx22("span", { className: "medo-select__tag-label", children: l }) }, i)),
|
|
2168
2225
|
labels.length > visible && /* @__PURE__ */ jsxs19("span", { className: tagClass, "aria-hidden": "true", children: [
|
|
2169
2226
|
"+",
|
|
2170
2227
|
labels.length - visible
|
|
@@ -2184,7 +2241,7 @@ import {
|
|
|
2184
2241
|
UNSTABLE_ToastRegion as AriaToastRegion
|
|
2185
2242
|
} from "react-aria-components";
|
|
2186
2243
|
import { X as X7 } from "lucide-react";
|
|
2187
|
-
import { jsx as
|
|
2244
|
+
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2188
2245
|
var TIMEOUT = 5e3;
|
|
2189
2246
|
var TIMEOUT_ACTION = 8e3;
|
|
2190
2247
|
var MAX_VISIBLE = 3;
|
|
@@ -2233,7 +2290,7 @@ function ToastRegion({ closeLabel, ...props }) {
|
|
|
2233
2290
|
};
|
|
2234
2291
|
}, []);
|
|
2235
2292
|
if (!active) return null;
|
|
2236
|
-
return /* @__PURE__ */
|
|
2293
|
+
return /* @__PURE__ */ jsx23(AriaToastRegion, { ...props, queue, className: "medo-toast-region", children: ({ toast: t }) => /* @__PURE__ */ jsxs20(
|
|
2237
2294
|
AriaToast,
|
|
2238
2295
|
{
|
|
2239
2296
|
toast: t,
|
|
@@ -2241,8 +2298,8 @@ function ToastRegion({ closeLabel, ...props }) {
|
|
|
2241
2298
|
style: { viewTransitionName: t.key },
|
|
2242
2299
|
ref: (el) => closeOnEscape(el, t.key),
|
|
2243
2300
|
children: [
|
|
2244
|
-
/* @__PURE__ */
|
|
2245
|
-
t.content.action && /* @__PURE__ */
|
|
2301
|
+
/* @__PURE__ */ jsx23(AriaToastContent, { className: "medo-toast__content", children: /* @__PURE__ */ jsx23(Text8, { slot: "title", className: "medo-toast__message", children: t.content.message }) }),
|
|
2302
|
+
t.content.action && /* @__PURE__ */ jsx23(
|
|
2246
2303
|
Button2,
|
|
2247
2304
|
{
|
|
2248
2305
|
className: "medo-toast__button medo-toast__action",
|
|
@@ -2253,7 +2310,7 @@ function ToastRegion({ closeLabel, ...props }) {
|
|
|
2253
2310
|
children: t.content.action.label
|
|
2254
2311
|
}
|
|
2255
2312
|
),
|
|
2256
|
-
/* @__PURE__ */
|
|
2313
|
+
/* @__PURE__ */ jsx23(Button2, { slot: "close", "aria-label": closeLabel ?? m.common.close, className: "medo-toast__button medo-toast__close", children: /* @__PURE__ */ jsx23(X7, { "aria-hidden": "true" }) })
|
|
2257
2314
|
]
|
|
2258
2315
|
}
|
|
2259
2316
|
) });
|
|
@@ -2268,25 +2325,25 @@ import {
|
|
|
2268
2325
|
TabPanel as AriaTabPanel,
|
|
2269
2326
|
Tabs as AriaTabs
|
|
2270
2327
|
} from "react-aria-components";
|
|
2271
|
-
import { jsx as
|
|
2328
|
+
import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2272
2329
|
function Tabs({ size = "md", fullWidth = false, className, ...props }) {
|
|
2273
|
-
return /* @__PURE__ */
|
|
2330
|
+
return /* @__PURE__ */ jsx24(AriaTabs, { ...props, className: cx("medo-tabs", `medo-tabs--${size}`, fullWidth && "medo-tabs--full", className) });
|
|
2274
2331
|
}
|
|
2275
2332
|
function TabList({ className, ...props }) {
|
|
2276
2333
|
const ref = useRef7(null);
|
|
2277
2334
|
useScrollEdges(ref);
|
|
2278
|
-
return /* @__PURE__ */
|
|
2335
|
+
return /* @__PURE__ */ jsx24(AriaTabList, { ...props, ref, className: cx("medo-tabs__list", className) });
|
|
2279
2336
|
}
|
|
2280
2337
|
function Tab({ children, icon, count, countLabel, ...props }) {
|
|
2281
2338
|
return /* @__PURE__ */ jsxs21(AriaTab, { ...props, className: "medo-tab", children: [
|
|
2282
|
-
/* @__PURE__ */
|
|
2283
|
-
icon && /* @__PURE__ */
|
|
2284
|
-
/* @__PURE__ */
|
|
2285
|
-
count !== void 0 && /* @__PURE__ */
|
|
2339
|
+
/* @__PURE__ */ jsx24(SelectionIndicator2, { className: "medo-tab__thumb", ref: revealInList }),
|
|
2340
|
+
icon && /* @__PURE__ */ jsx24("span", { className: "medo-tab__icon", "aria-hidden": "true", children: icon }),
|
|
2341
|
+
/* @__PURE__ */ jsx24("span", { className: "medo-tab__label", children }),
|
|
2342
|
+
count !== void 0 && /* @__PURE__ */ jsx24(BadgeCount, { count, tone: "neutral", size: "sm", label: countLabel ?? String(count) })
|
|
2286
2343
|
] });
|
|
2287
2344
|
}
|
|
2288
2345
|
function TabPanel({ keepMounted = true, className, ...props }) {
|
|
2289
|
-
return /* @__PURE__ */
|
|
2346
|
+
return /* @__PURE__ */ jsx24(AriaTabPanel, { ...props, shouldForceMount: keepMounted, className: cx("medo-tabs__panel", className) });
|
|
2290
2347
|
}
|
|
2291
2348
|
function revealInList(thumb) {
|
|
2292
2349
|
const tab = thumb?.parentElement;
|
|
@@ -2332,7 +2389,7 @@ import { Info as Info2, X as X8 } from "lucide-react";
|
|
|
2332
2389
|
// src/link/Link.tsx
|
|
2333
2390
|
import { Link as AriaLink2 } from "react-aria-components";
|
|
2334
2391
|
import { ArrowRight, ExternalLink } from "lucide-react";
|
|
2335
|
-
import { jsx as
|
|
2392
|
+
import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2336
2393
|
function Link({
|
|
2337
2394
|
children,
|
|
2338
2395
|
variant = "inline",
|
|
@@ -2352,8 +2409,8 @@ function Link({
|
|
|
2352
2409
|
className: cx("medo-link", variant === "standalone" && "medo-link--standalone", variant === "standalone" && `medo-link--${size}`, className),
|
|
2353
2410
|
children: [
|
|
2354
2411
|
children,
|
|
2355
|
-
external && /* @__PURE__ */
|
|
2356
|
-
!external && arrow && variant === "standalone" && /* @__PURE__ */
|
|
2412
|
+
external && /* @__PURE__ */ jsx25(ExternalLink, { className: "medo-link__icon", "aria-hidden": "true" }),
|
|
2413
|
+
!external && arrow && variant === "standalone" && /* @__PURE__ */ jsx25(ArrowRight, { className: "medo-link__icon", "aria-hidden": "true" }),
|
|
2357
2414
|
newTab && /* @__PURE__ */ jsxs22("span", { className: "medo-visually-hidden", children: [
|
|
2358
2415
|
" ",
|
|
2359
2416
|
newTabLabel
|
|
@@ -2364,7 +2421,7 @@ function Link({
|
|
|
2364
2421
|
}
|
|
2365
2422
|
|
|
2366
2423
|
// src/popover/Popover.tsx
|
|
2367
|
-
import { Fragment as Fragment13, jsx as
|
|
2424
|
+
import { Fragment as Fragment13, jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2368
2425
|
var PopoverTrigger = DialogTrigger2;
|
|
2369
2426
|
function Popover5({
|
|
2370
2427
|
title,
|
|
@@ -2384,47 +2441,47 @@ function Popover5({
|
|
|
2384
2441
|
const mobile = useMediaQuery(MOBILE_QUERY);
|
|
2385
2442
|
const content = (close) => typeof children === "function" ? children(close) : children;
|
|
2386
2443
|
if (overlay === "sheet" || overlay === "auto" && mobile) {
|
|
2387
|
-
return /* @__PURE__ */
|
|
2444
|
+
return /* @__PURE__ */ jsx26(
|
|
2388
2445
|
BottomSheet,
|
|
2389
2446
|
{
|
|
2390
2447
|
title: title ?? ariaLabel,
|
|
2391
2448
|
closeLabel,
|
|
2392
2449
|
className,
|
|
2393
2450
|
footer: primaryAction && ((close) => /* @__PURE__ */ jsxs23(ButtonGroup, { children: [
|
|
2394
|
-
/* @__PURE__ */
|
|
2395
|
-
/* @__PURE__ */
|
|
2451
|
+
/* @__PURE__ */ jsx26(Button, { variant: "secondary", size: "lg", onPress: close, children: cancelLabel }),
|
|
2452
|
+
/* @__PURE__ */ jsx26(ActionButton, { action: primaryAction, close, size: "lg", variant: "primary" })
|
|
2396
2453
|
] })),
|
|
2397
|
-
children: /* @__PURE__ */
|
|
2454
|
+
children: /* @__PURE__ */ jsx26(SheetBody, { children: content })
|
|
2398
2455
|
}
|
|
2399
2456
|
);
|
|
2400
2457
|
}
|
|
2401
|
-
return /* @__PURE__ */
|
|
2458
|
+
return /* @__PURE__ */ jsx26(AriaPopover, { placement, offset: 8, containerPadding: 16, className: cx("medo-popover", `medo-popover--${size}`, className), children: /* @__PURE__ */ jsx26(PopoverDialog, { "aria-label": title ? void 0 : ariaLabel, children: ({ close }) => /* @__PURE__ */ jsxs23(Fragment13, { children: [
|
|
2402
2459
|
title && /* @__PURE__ */ jsxs23("div", { className: "medo-popover__header", children: [
|
|
2403
|
-
/* @__PURE__ */
|
|
2404
|
-
/* @__PURE__ */
|
|
2460
|
+
/* @__PURE__ */ jsx26(Heading3, { slot: "title", className: "medo-popover__title", children: title }),
|
|
2461
|
+
/* @__PURE__ */ jsx26(IconButton, { variant: "ghost", size: "sm", icon: /* @__PURE__ */ jsx26(X8, {}), "aria-label": closeLabel, tooltip: false, onPress: close })
|
|
2405
2462
|
] }),
|
|
2406
|
-
/* @__PURE__ */
|
|
2407
|
-
primaryAction && /* @__PURE__ */
|
|
2408
|
-
/* @__PURE__ */
|
|
2409
|
-
/* @__PURE__ */
|
|
2463
|
+
/* @__PURE__ */ jsx26("div", { className: "medo-popover__body", children: content(close) }),
|
|
2464
|
+
primaryAction && /* @__PURE__ */ jsx26("div", { className: "medo-popover__footer", children: /* @__PURE__ */ jsxs23(ButtonGroup, { children: [
|
|
2465
|
+
/* @__PURE__ */ jsx26(Button, { variant: "secondary", size: "sm", onPress: close, children: cancelLabel }),
|
|
2466
|
+
/* @__PURE__ */ jsx26(ActionButton, { action: primaryAction, close, size: "sm", variant: "primary" })
|
|
2410
2467
|
] }) })
|
|
2411
2468
|
] }) }) });
|
|
2412
2469
|
}
|
|
2413
2470
|
function PopoverDialog({ children, ...props }) {
|
|
2414
2471
|
const ref = useRef8(null);
|
|
2415
2472
|
useInitialFocus(ref);
|
|
2416
|
-
return /* @__PURE__ */
|
|
2473
|
+
return /* @__PURE__ */ jsx26(AriaDialog2, { ...props, ref, className: "medo-popover__dialog", children });
|
|
2417
2474
|
}
|
|
2418
2475
|
function SheetBody({ children }) {
|
|
2419
2476
|
const state = useContext14(OverlayTriggerStateContext3);
|
|
2420
|
-
return /* @__PURE__ */
|
|
2477
|
+
return /* @__PURE__ */ jsx26("div", { className: "medo-popover__sheet-body", children: children(() => state?.close()) });
|
|
2421
2478
|
}
|
|
2422
2479
|
function Toggletip({ "aria-label": label, children, link, className }) {
|
|
2423
2480
|
return /* @__PURE__ */ jsxs23(DialogTrigger2, { children: [
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
/* @__PURE__ */
|
|
2426
|
-
/* @__PURE__ */
|
|
2427
|
-
link && /* @__PURE__ */
|
|
2481
|
+
/* @__PURE__ */ jsx26(IconButton, { variant: "ghost", size: "sm", icon: /* @__PURE__ */ jsx26(Info2, {}), "aria-label": label, tooltip: false }),
|
|
2482
|
+
/* @__PURE__ */ jsx26(AriaPopover, { placement: "bottom start", offset: 8, containerPadding: 16, className: cx("medo-popover", "medo-toggletip", className), children: /* @__PURE__ */ jsxs23(AriaDialog2, { "aria-label": label, className: "medo-popover__dialog medo-toggletip__dialog", children: [
|
|
2483
|
+
/* @__PURE__ */ jsx26("div", { className: "medo-toggletip__text", children }),
|
|
2484
|
+
link && /* @__PURE__ */ jsx26(Link, { variant: "standalone", size: "md", href: link.href, external: link.external, target: link.external ? "_blank" : void 0, children: link.label })
|
|
2428
2485
|
] }) })
|
|
2429
2486
|
] });
|
|
2430
2487
|
}
|
|
@@ -2446,7 +2503,7 @@ import { ChevronDown as ChevronDown3, Ellipsis as Ellipsis2, Menu as MenuIcon, P
|
|
|
2446
2503
|
import { useEffect as useEffect8, useRef as useRef9 } from "react";
|
|
2447
2504
|
import { Dialog as AriaDialog3, Heading as Heading4, Modal as Modal3, ModalOverlay as ModalOverlay3 } from "react-aria-components";
|
|
2448
2505
|
import { X as X9 } from "lucide-react";
|
|
2449
|
-
import { Fragment as Fragment14, jsx as
|
|
2506
|
+
import { Fragment as Fragment14, jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2450
2507
|
function Drawer({
|
|
2451
2508
|
title,
|
|
2452
2509
|
"aria-label": ariaLabel,
|
|
@@ -2462,20 +2519,20 @@ function Drawer({
|
|
|
2462
2519
|
}) {
|
|
2463
2520
|
const m = useMessages();
|
|
2464
2521
|
const { open, onOpenChange, confirmDiscard, forceClose } = useDirtyGuard({ isDirty, discardText, ...openProps });
|
|
2465
|
-
return /* @__PURE__ */
|
|
2522
|
+
return /* @__PURE__ */ jsx27(ModalOverlay3, { isOpen: open, onOpenChange, isDismissable: !isDirty, className: cx("medo-drawer-overlay", `medo-drawer-overlay--${side}`), children: /* @__PURE__ */ jsx27(Modal3, { className: cx("medo-drawer", `medo-drawer--${side}`, `medo-drawer--${size}`, className), children: /* @__PURE__ */ jsx27(DrawerDialog, { "aria-label": ariaLabel, side, children: (close) => /* @__PURE__ */ jsxs24(Fragment14, { children: [
|
|
2466
2523
|
/* @__PURE__ */ jsxs24("div", { className: "medo-drawer__header", children: [
|
|
2467
|
-
ariaLabel ? /* @__PURE__ */
|
|
2468
|
-
/* @__PURE__ */
|
|
2524
|
+
ariaLabel ? /* @__PURE__ */ jsx27("div", { className: "medo-drawer__title", children: title }) : /* @__PURE__ */ jsx27(Heading4, { slot: "title", className: "medo-drawer__title", children: title }),
|
|
2525
|
+
/* @__PURE__ */ jsx27(IconButton, { variant: "ghost", size: "md", icon: /* @__PURE__ */ jsx27(X9, {}), "aria-label": closeLabel ?? m.common.close, tooltip: false, onPress: close })
|
|
2469
2526
|
] }),
|
|
2470
|
-
/* @__PURE__ */
|
|
2471
|
-
footer && /* @__PURE__ */
|
|
2527
|
+
/* @__PURE__ */ jsx27("div", { className: "medo-drawer__body", children: typeof children === "function" ? children(forceClose) : children }),
|
|
2528
|
+
footer && /* @__PURE__ */ jsx27("div", { className: "medo-drawer__footer", children: typeof footer === "function" ? footer(forceClose, close) : footer }),
|
|
2472
2529
|
confirmDiscard
|
|
2473
2530
|
] }) }) }) });
|
|
2474
2531
|
}
|
|
2475
2532
|
function DrawerDialog({ children, side, ...props }) {
|
|
2476
2533
|
const ref = useRef9(null);
|
|
2477
|
-
return /* @__PURE__ */
|
|
2478
|
-
/* @__PURE__ */
|
|
2534
|
+
return /* @__PURE__ */ jsx27(AriaDialog3, { ...props, ref, className: "medo-drawer__dialog", children: ({ close }) => /* @__PURE__ */ jsxs24(Fragment14, { children: [
|
|
2535
|
+
/* @__PURE__ */ jsx27(SwipeToClose, { target: ref, side, onClose: close }),
|
|
2479
2536
|
children(close)
|
|
2480
2537
|
] }) });
|
|
2481
2538
|
}
|
|
@@ -2535,7 +2592,7 @@ function SwipeToClose({ target, side, onClose }) {
|
|
|
2535
2592
|
}
|
|
2536
2593
|
|
|
2537
2594
|
// src/navigation/Navigation.tsx
|
|
2538
|
-
import { Fragment as Fragment15, jsx as
|
|
2595
|
+
import { Fragment as Fragment15, jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2539
2596
|
var NavVariantContext = createContext8("sidebar");
|
|
2540
2597
|
var SideNavContext = createContext8(null);
|
|
2541
2598
|
var TABLET_QUERY = "(min-width: 640px) and (max-width: 1023.98px)";
|
|
@@ -2545,9 +2602,9 @@ function NavItem({ children, icon, isCurrent, count, countLabel, unread, ...prop
|
|
|
2545
2602
|
const sideNav = useContext15(SideNavContext);
|
|
2546
2603
|
const rail = variant === "rail";
|
|
2547
2604
|
const content = /* @__PURE__ */ jsxs25(Fragment15, { children: [
|
|
2548
|
-
icon && variant !== "header" && /* @__PURE__ */
|
|
2549
|
-
/* @__PURE__ */
|
|
2550
|
-
count !== void 0 && (rail ? unread && count > 0 && /* @__PURE__ */
|
|
2605
|
+
icon && variant !== "header" && /* @__PURE__ */ jsx28("span", { className: "medo-nav-item__icon", "aria-hidden": "true", children: icon }),
|
|
2606
|
+
/* @__PURE__ */ jsx28("span", { className: rail ? "medo-visually-hidden" : "medo-nav-item__label", children }),
|
|
2607
|
+
count !== void 0 && (rail ? unread && count > 0 && /* @__PURE__ */ jsx28(BadgeDot, { tone: "danger", label: countLabel ?? String(count), className: "medo-nav-item__dot" }) : /* @__PURE__ */ jsx28(BadgeCount, { count, tone: "neutral", size: "sm", label: countLabel ?? String(count) }))
|
|
2551
2608
|
] });
|
|
2552
2609
|
const linkProps = {
|
|
2553
2610
|
...props,
|
|
@@ -2558,13 +2615,13 @@ function NavItem({ children, icon, isCurrent, count, countLabel, unread, ...prop
|
|
|
2558
2615
|
"aria-current": isCurrent ? "page" : void 0,
|
|
2559
2616
|
className: cx("medo-nav-item", `medo-nav-item--${variant}`)
|
|
2560
2617
|
};
|
|
2561
|
-
return /* @__PURE__ */
|
|
2618
|
+
return /* @__PURE__ */ jsx28("li", { className: "medo-nav__entry", children: rail ? (
|
|
2562
2619
|
// Collapsed: the label appears as tooltip on hover and focus.
|
|
2563
2620
|
/* @__PURE__ */ jsxs25(TooltipTrigger, { children: [
|
|
2564
|
-
/* @__PURE__ */
|
|
2565
|
-
/* @__PURE__ */
|
|
2621
|
+
/* @__PURE__ */ jsx28(TooltipLink, { ...linkProps, children: content }),
|
|
2622
|
+
/* @__PURE__ */ jsx28(Tooltip, { placement: "end", children })
|
|
2566
2623
|
] })
|
|
2567
|
-
) : /* @__PURE__ */
|
|
2624
|
+
) : /* @__PURE__ */ jsx28(AriaLink3, { ...linkProps, children: content }) });
|
|
2568
2625
|
}
|
|
2569
2626
|
function containsCurrent(children) {
|
|
2570
2627
|
return Children2.toArray(children).some((c) => isValidElement2(c) && c.props.isCurrent);
|
|
@@ -2598,7 +2655,7 @@ function NavGroup({ label, icon, children, defaultOpen }) {
|
|
|
2598
2655
|
};
|
|
2599
2656
|
}, [floating, open]);
|
|
2600
2657
|
if (variant === "rail") {
|
|
2601
|
-
return /* @__PURE__ */
|
|
2658
|
+
return /* @__PURE__ */ jsx28("li", { className: "medo-nav__entry", children: /* @__PURE__ */ jsxs25(TooltipTrigger, { children: [
|
|
2602
2659
|
/* @__PURE__ */ jsxs25(
|
|
2603
2660
|
AriaButton8,
|
|
2604
2661
|
{
|
|
@@ -2609,12 +2666,12 @@ function NavGroup({ label, icon, children, defaultOpen }) {
|
|
|
2609
2666
|
sideNav?.expand(label);
|
|
2610
2667
|
},
|
|
2611
2668
|
children: [
|
|
2612
|
-
/* @__PURE__ */
|
|
2613
|
-
/* @__PURE__ */
|
|
2669
|
+
/* @__PURE__ */ jsx28("span", { className: "medo-nav-item__icon", "aria-hidden": "true", children: icon }),
|
|
2670
|
+
/* @__PURE__ */ jsx28("span", { className: "medo-visually-hidden", children: label })
|
|
2614
2671
|
]
|
|
2615
2672
|
}
|
|
2616
2673
|
),
|
|
2617
|
-
/* @__PURE__ */
|
|
2674
|
+
/* @__PURE__ */ jsx28(Tooltip, { placement: "end", children: label })
|
|
2618
2675
|
] }) });
|
|
2619
2676
|
}
|
|
2620
2677
|
return /* @__PURE__ */ jsxs25("li", { ref: itemRef, className: cx("medo-nav__entry", "medo-nav-group", floating && "medo-nav-group--floating"), children: [
|
|
@@ -2628,32 +2685,32 @@ function NavGroup({ label, icon, children, defaultOpen }) {
|
|
|
2628
2685
|
onPress: () => setOpen((o) => !o),
|
|
2629
2686
|
className: cx("medo-nav-item", `medo-nav-item--${variant}`, "medo-nav-group__button"),
|
|
2630
2687
|
children: [
|
|
2631
|
-
icon && !floating && /* @__PURE__ */
|
|
2632
|
-
/* @__PURE__ */
|
|
2633
|
-
/* @__PURE__ */
|
|
2688
|
+
icon && !floating && /* @__PURE__ */ jsx28("span", { className: "medo-nav-item__icon", "aria-hidden": "true", children: icon }),
|
|
2689
|
+
/* @__PURE__ */ jsx28("span", { className: "medo-nav-item__label", children: label }),
|
|
2690
|
+
/* @__PURE__ */ jsx28(ChevronDown3, { className: "medo-nav-group__chevron", "aria-hidden": "true" })
|
|
2634
2691
|
]
|
|
2635
2692
|
}
|
|
2636
2693
|
),
|
|
2637
|
-
/* @__PURE__ */
|
|
2694
|
+
/* @__PURE__ */ jsx28(NavVariantContext.Provider, { value: floating ? "sidebar" : variant, children: /* @__PURE__ */ jsx28("ul", { id: panelId, hidden: !open, className: cx("medo-nav__list", floating ? "medo-nav-group__panel" : "medo-nav-group__list"), children }) })
|
|
2638
2695
|
] });
|
|
2639
2696
|
}
|
|
2640
2697
|
function NavList({ variant = "sidebar", "aria-label": label, children, className }) {
|
|
2641
|
-
return /* @__PURE__ */
|
|
2698
|
+
return /* @__PURE__ */ jsx28("nav", { "aria-label": label, className, children: /* @__PURE__ */ jsx28(NavVariantContext.Provider, { value: variant, children: /* @__PURE__ */ jsx28("ul", { className: cx("medo-nav__list", variant === "header" && "medo-nav__list--row", variant === "rail" && "medo-nav__list--rail"), children }) }) });
|
|
2642
2699
|
}
|
|
2643
2700
|
function NavSection({ title, children }) {
|
|
2644
2701
|
const variant = useContext15(NavVariantContext);
|
|
2645
2702
|
const id = useId5();
|
|
2646
2703
|
return /* @__PURE__ */ jsxs25("li", { className: "medo-nav__entry medo-nav-section", children: [
|
|
2647
|
-
variant === "rail" ? /* @__PURE__ */
|
|
2648
|
-
/* @__PURE__ */
|
|
2704
|
+
variant === "rail" ? /* @__PURE__ */ jsx28("span", { className: "medo-nav-section__divider", role: "presentation" }) : /* @__PURE__ */ jsx28("span", { id, className: "medo-nav-section__title", children: title }),
|
|
2705
|
+
/* @__PURE__ */ jsx28("ul", { className: "medo-nav__list", "aria-labelledby": variant === "rail" ? void 0 : id, "aria-label": variant === "rail" ? title : void 0, children })
|
|
2649
2706
|
] });
|
|
2650
2707
|
}
|
|
2651
2708
|
function SkipLink({ href = "#main", children }) {
|
|
2652
2709
|
const m = useMessages();
|
|
2653
|
-
return /* @__PURE__ */
|
|
2710
|
+
return /* @__PURE__ */ jsx28("a", { href, className: "medo-skip-link", children: children ?? m.navigation.skipToContent });
|
|
2654
2711
|
}
|
|
2655
2712
|
function ActionLink({ action, size }) {
|
|
2656
|
-
return /* @__PURE__ */
|
|
2713
|
+
return /* @__PURE__ */ jsx28(AriaLink3, { href: action.href, onPress: action.onPress, className: cx("medo-button", `medo-button--${action.variant ?? "ghost"}`, `medo-button--${size}`), children: /* @__PURE__ */ jsx28("span", { className: "medo-button__label", children: action.label }) });
|
|
2657
2714
|
}
|
|
2658
2715
|
function SiteHeader({ logo, children, actions = [], "aria-label": labelProp, menuLabel: menuLabelProp, closeLabel: closeLabelProp, layout = "auto" }) {
|
|
2659
2716
|
const m = useMessages();
|
|
@@ -2665,13 +2722,13 @@ function SiteHeader({ logo, children, actions = [], "aria-label": labelProp, men
|
|
|
2665
2722
|
const scrolled = useScrolled();
|
|
2666
2723
|
const primary = actions.find((a) => a.variant === "primary");
|
|
2667
2724
|
return /* @__PURE__ */ jsxs25("header", { className: cx("medo-site-header", compact && "medo-site-header--compact"), "data-scrolled": scrolled || void 0, children: [
|
|
2668
|
-
/* @__PURE__ */
|
|
2725
|
+
/* @__PURE__ */ jsx28("div", { className: "medo-site-header__logo", children: logo }),
|
|
2669
2726
|
compact ? /* @__PURE__ */ jsxs25("div", { className: "medo-site-header__actions", children: [
|
|
2670
|
-
primary && /* @__PURE__ */
|
|
2671
|
-
/* @__PURE__ */
|
|
2727
|
+
primary && /* @__PURE__ */ jsx28(ActionLink, { action: primary, size: "sm" }),
|
|
2728
|
+
/* @__PURE__ */ jsx28(NavFullscreen, { logo, actions, "aria-label": label, menuLabel, closeLabel, children })
|
|
2672
2729
|
] }) : /* @__PURE__ */ jsxs25(Fragment15, { children: [
|
|
2673
|
-
/* @__PURE__ */
|
|
2674
|
-
actions.length > 0 && /* @__PURE__ */
|
|
2730
|
+
/* @__PURE__ */ jsx28("nav", { "aria-label": label, className: "medo-site-header__nav", children: /* @__PURE__ */ jsx28(NavVariantContext.Provider, { value: "header", children: /* @__PURE__ */ jsx28("ul", { className: "medo-nav__list medo-nav__list--row", children }) }) }),
|
|
2731
|
+
actions.length > 0 && /* @__PURE__ */ jsx28("div", { className: "medo-site-header__actions", children: actions.map((a) => /* @__PURE__ */ jsx28(ActionLink, { action: a, size: "md" }, a.label)) })
|
|
2675
2732
|
] })
|
|
2676
2733
|
] });
|
|
2677
2734
|
}
|
|
@@ -2685,24 +2742,24 @@ function NavFullscreen({
|
|
|
2685
2742
|
}) {
|
|
2686
2743
|
const ordered = [...actions].sort((a, b) => Number(b.variant === "primary") - Number(a.variant === "primary"));
|
|
2687
2744
|
return /* @__PURE__ */ jsxs25(DialogTrigger3, { children: [
|
|
2688
|
-
/* @__PURE__ */
|
|
2689
|
-
/* @__PURE__ */
|
|
2745
|
+
/* @__PURE__ */ jsx28(IconButton, { variant: "ghost", size: "md", icon: /* @__PURE__ */ jsx28(MenuIcon, {}), "aria-label": menuLabel, tooltip: false }),
|
|
2746
|
+
/* @__PURE__ */ jsx28(ModalOverlay4, { className: "medo-nav-fullscreen-overlay", children: /* @__PURE__ */ jsx28(Modal4, { className: "medo-nav-fullscreen", children: /* @__PURE__ */ jsx28(AriaDialog4, { "aria-label": menuLabel, className: "medo-nav-fullscreen__dialog", children: ({ close }) => /* @__PURE__ */ jsxs25(Fragment15, { children: [
|
|
2690
2747
|
/* @__PURE__ */ jsxs25("div", { className: "medo-nav-fullscreen__header", children: [
|
|
2691
|
-
/* @__PURE__ */
|
|
2692
|
-
/* @__PURE__ */
|
|
2748
|
+
/* @__PURE__ */ jsx28("div", { className: "medo-site-header__logo", children: logo }),
|
|
2749
|
+
/* @__PURE__ */ jsx28(IconButton, { variant: "ghost", size: "md", icon: /* @__PURE__ */ jsx28(X10, {}), "aria-label": closeLabel, tooltip: false, onPress: close })
|
|
2693
2750
|
] }),
|
|
2694
|
-
/* @__PURE__ */
|
|
2695
|
-
ordered.length > 0 && /* @__PURE__ */
|
|
2751
|
+
/* @__PURE__ */ jsx28("nav", { "aria-label": label, className: "medo-nav-fullscreen__nav", children: /* @__PURE__ */ jsx28(NavVariantContext.Provider, { value: "sheet", children: /* @__PURE__ */ jsx28("ul", { className: "medo-nav__list", children }) }) }),
|
|
2752
|
+
ordered.length > 0 && /* @__PURE__ */ jsx28("div", { className: "medo-nav-fullscreen__actions", children: ordered.map((a) => /* @__PURE__ */ jsx28(ActionLink, { action: a.variant === "ghost" || !a.variant ? { ...a, variant: "secondary" } : a, size: "lg" }, a.label)) })
|
|
2696
2753
|
] }) }) }) })
|
|
2697
2754
|
] });
|
|
2698
2755
|
}
|
|
2699
2756
|
function AppHeader({ title, headingLevel = 1, logo, search, actions }) {
|
|
2700
2757
|
const scrolled = useScrolled();
|
|
2701
2758
|
return /* @__PURE__ */ jsxs25("header", { className: "medo-app-header", "data-scrolled": scrolled || void 0, children: [
|
|
2702
|
-
logo && /* @__PURE__ */
|
|
2703
|
-
/* @__PURE__ */
|
|
2704
|
-
search && /* @__PURE__ */
|
|
2705
|
-
actions && /* @__PURE__ */
|
|
2759
|
+
logo && /* @__PURE__ */ jsx28("div", { className: "medo-app-header__logo", children: logo }),
|
|
2760
|
+
/* @__PURE__ */ jsx28(Heading5, { level: headingLevel, className: "medo-app-header__title", children: title }),
|
|
2761
|
+
search && /* @__PURE__ */ jsx28("div", { className: "medo-app-header__search", children: search }),
|
|
2762
|
+
actions && /* @__PURE__ */ jsx28("div", { className: "medo-app-header__actions", children: actions })
|
|
2706
2763
|
] });
|
|
2707
2764
|
}
|
|
2708
2765
|
function SideNav({
|
|
@@ -2741,12 +2798,12 @@ function SideNav({
|
|
|
2741
2798
|
useEffect9(() => {
|
|
2742
2799
|
if (!tablet) setDrawer(false);
|
|
2743
2800
|
}, [tablet]);
|
|
2744
|
-
const toggle = /* @__PURE__ */
|
|
2801
|
+
const toggle = /* @__PURE__ */ jsx28(
|
|
2745
2802
|
IconButton,
|
|
2746
2803
|
{
|
|
2747
2804
|
variant: "ghost",
|
|
2748
2805
|
size: "sm",
|
|
2749
|
-
icon: /* @__PURE__ */
|
|
2806
|
+
icon: /* @__PURE__ */ jsx28(PanelLeft, {}),
|
|
2750
2807
|
"aria-label": collapsed ? expandLabel : collapseLabel,
|
|
2751
2808
|
"aria-expanded": tablet ? drawer : !collapsed,
|
|
2752
2809
|
onPress: () => collapsed ? expand() : collapse()
|
|
@@ -2755,52 +2812,52 @@ function SideNav({
|
|
|
2755
2812
|
return /* @__PURE__ */ jsxs25("aside", { className: cx("medo-sidenav", collapsed && "medo-sidenav--collapsed"), children: [
|
|
2756
2813
|
/* @__PURE__ */ jsxs25("div", { className: "medo-sidenav__panel", children: [
|
|
2757
2814
|
/* @__PURE__ */ jsxs25("div", { className: "medo-sidenav__top", children: [
|
|
2758
|
-
/* @__PURE__ */
|
|
2815
|
+
/* @__PURE__ */ jsx28("div", { className: "medo-sidenav__logo", children: collapsed ? logoMark : logo }),
|
|
2759
2816
|
!collapsed && toggle
|
|
2760
2817
|
] }),
|
|
2761
|
-
/* @__PURE__ */
|
|
2818
|
+
/* @__PURE__ */ jsx28("nav", { "aria-label": label, className: "medo-sidenav__nav", children: /* @__PURE__ */ jsx28(SideNavContext.Provider, { value: { expand, openGroup }, children: /* @__PURE__ */ jsx28(NavVariantContext.Provider, { value: collapsed ? "rail" : "sidebar", children: /* @__PURE__ */ jsx28("ul", { className: "medo-nav__list", children }) }) }) }),
|
|
2762
2819
|
/* @__PURE__ */ jsxs25("div", { className: "medo-sidenav__bottom", children: [
|
|
2763
2820
|
collapsed && toggle,
|
|
2764
2821
|
user && /* @__PURE__ */ jsxs25("div", { className: "medo-sidenav__user", children: [
|
|
2765
|
-
/* @__PURE__ */
|
|
2822
|
+
/* @__PURE__ */ jsx28(Avatar, { name: user.name, src: user.src, size: "md", decorative: !collapsed }),
|
|
2766
2823
|
!collapsed && /* @__PURE__ */ jsxs25("span", { className: "medo-sidenav__user-text", children: [
|
|
2767
|
-
/* @__PURE__ */
|
|
2768
|
-
user.email && /* @__PURE__ */
|
|
2824
|
+
/* @__PURE__ */ jsx28("span", { className: "medo-sidenav__user-name", children: user.name }),
|
|
2825
|
+
user.email && /* @__PURE__ */ jsx28("span", { className: "medo-sidenav__user-email", children: user.email })
|
|
2769
2826
|
] })
|
|
2770
2827
|
] })
|
|
2771
2828
|
] })
|
|
2772
2829
|
] }),
|
|
2773
2830
|
tablet && // Tablet: the full navigation as a Drawer on the left. Choosing a page closes it.
|
|
2774
|
-
/* @__PURE__ */
|
|
2831
|
+
/* @__PURE__ */ jsx28(Drawer, { side: "left", size: "sm", title: logo, "aria-label": label, closeLabel, isOpen: drawer, onOpenChange: setDrawer, children: /* @__PURE__ */ jsx28("nav", { "aria-label": label, children: /* @__PURE__ */ jsx28(SideNavContext.Provider, { value: { expand, openGroup, onNavigate: () => setDrawer(false) }, children: /* @__PURE__ */ jsx28(NavVariantContext.Provider, { value: "sidebar", children: /* @__PURE__ */ jsx28("ul", { className: "medo-nav__list", children }) }) }) }) })
|
|
2775
2832
|
] });
|
|
2776
2833
|
}
|
|
2777
2834
|
function BottomTabBar({ children, "aria-label": labelProp, display = "mobile" }) {
|
|
2778
2835
|
const m = useMessages();
|
|
2779
2836
|
const label = labelProp ?? m.navigation.app;
|
|
2780
|
-
return /* @__PURE__ */
|
|
2837
|
+
return /* @__PURE__ */ jsx28("nav", { "aria-label": label, className: cx("medo-tab-bar", display === "always" && "medo-tab-bar--always"), children: /* @__PURE__ */ jsx28("ul", { className: "medo-tab-bar__list", children }) });
|
|
2781
2838
|
}
|
|
2782
2839
|
function TabBarItem({ children, icon, isCurrent, dot, dotLabel = "new", ...props }) {
|
|
2783
|
-
return /* @__PURE__ */
|
|
2784
|
-
/* @__PURE__ */
|
|
2785
|
-
/* @__PURE__ */
|
|
2840
|
+
return /* @__PURE__ */ jsx28("li", { className: "medo-tab-bar__entry", children: /* @__PURE__ */ jsxs25(AriaLink3, { ...props, "aria-current": isCurrent ? "page" : void 0, className: "medo-tab-bar-item", children: [
|
|
2841
|
+
/* @__PURE__ */ jsx28(TabBarIcon, { icon, dot, dotLabel }),
|
|
2842
|
+
/* @__PURE__ */ jsx28("span", { className: "medo-tab-bar-item__label", children })
|
|
2786
2843
|
] }) });
|
|
2787
2844
|
}
|
|
2788
2845
|
function TabBarIcon({ icon, dot, dotLabel }) {
|
|
2789
2846
|
return /* @__PURE__ */ jsxs25("span", { className: "medo-tab-bar-item__indicator", children: [
|
|
2790
|
-
/* @__PURE__ */
|
|
2791
|
-
dot && /* @__PURE__ */
|
|
2847
|
+
/* @__PURE__ */ jsx28("span", { className: "medo-tab-bar-item__icon", "aria-hidden": "true", children: icon }),
|
|
2848
|
+
dot && /* @__PURE__ */ jsx28(BadgeDot, { tone: "danger", label: dotLabel, className: "medo-tab-bar-item__dot" })
|
|
2792
2849
|
] });
|
|
2793
2850
|
}
|
|
2794
2851
|
function TabBarMore({ label: labelProp, children, closeLabel }) {
|
|
2795
2852
|
const m = useMessages();
|
|
2796
2853
|
const label = labelProp ?? m.common.more;
|
|
2797
2854
|
const hasCurrent = containsCurrent(children);
|
|
2798
|
-
return /* @__PURE__ */
|
|
2855
|
+
return /* @__PURE__ */ jsx28("li", { className: "medo-tab-bar__entry", children: /* @__PURE__ */ jsxs25(DialogTrigger3, { children: [
|
|
2799
2856
|
/* @__PURE__ */ jsxs25(AriaButton8, { className: "medo-tab-bar-item", "aria-haspopup": "dialog", "data-current": hasCurrent || void 0, children: [
|
|
2800
|
-
/* @__PURE__ */
|
|
2801
|
-
/* @__PURE__ */
|
|
2857
|
+
/* @__PURE__ */ jsx28(TabBarIcon, { icon: /* @__PURE__ */ jsx28(Ellipsis2, {}) }),
|
|
2858
|
+
/* @__PURE__ */ jsx28("span", { className: "medo-tab-bar-item__label", children: label })
|
|
2802
2859
|
] }),
|
|
2803
|
-
/* @__PURE__ */
|
|
2860
|
+
/* @__PURE__ */ jsx28(BottomSheet, { title: label, closeLabel, children: /* @__PURE__ */ jsx28("nav", { "aria-label": label, className: "medo-nav-sheet", children: /* @__PURE__ */ jsx28(NavVariantContext.Provider, { value: "sheet", children: /* @__PURE__ */ jsx28("ul", { className: "medo-nav__list", children }) }) }) })
|
|
2804
2861
|
] }) });
|
|
2805
2862
|
}
|
|
2806
2863
|
function useScrolled() {
|
|
@@ -2817,12 +2874,12 @@ function useScrolled() {
|
|
|
2817
2874
|
// src/list/List.tsx
|
|
2818
2875
|
import { createContext as createContext9, useContext as useContext16 } from "react";
|
|
2819
2876
|
import { Check as Check5, X as X11 } from "lucide-react";
|
|
2820
|
-
import { jsx as
|
|
2877
|
+
import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2821
2878
|
var ListTypeContext = createContext9("bullet");
|
|
2822
2879
|
function List({ type = "bullet", size, start, className, style, children, ...props }) {
|
|
2823
2880
|
const Tag2 = type === "number" ? "ol" : "ul";
|
|
2824
2881
|
const counter = type === "number" && start !== void 0 ? { counterReset: `medo-list ${start - 1}` } : void 0;
|
|
2825
|
-
return /* @__PURE__ */
|
|
2882
|
+
return /* @__PURE__ */ jsx29(ListTypeContext.Provider, { value: type, children: /* @__PURE__ */ jsx29(
|
|
2826
2883
|
Tag2,
|
|
2827
2884
|
{
|
|
2828
2885
|
...props,
|
|
@@ -2839,7 +2896,7 @@ function ListItem({ children, excluded, excludedLabel, className, ...props }) {
|
|
|
2839
2896
|
const type = useContext16(ListTypeContext);
|
|
2840
2897
|
const check = type === "check";
|
|
2841
2898
|
return /* @__PURE__ */ jsxs26("li", { ...props, className: cx("medo-list__item", check && excluded && "medo-list__item--excluded", className), children: [
|
|
2842
|
-
check && /* @__PURE__ */
|
|
2899
|
+
check && /* @__PURE__ */ jsx29("span", { className: "medo-list__icon", "aria-hidden": "true", children: excluded ? /* @__PURE__ */ jsx29(X11, {}) : /* @__PURE__ */ jsx29(Check5, {}) }),
|
|
2843
2900
|
check && excluded && /* @__PURE__ */ jsxs26("span", { className: "medo-visually-hidden", children: [
|
|
2844
2901
|
excludedLabel ?? m.list.notIncluded,
|
|
2845
2902
|
" "
|
|
@@ -2848,12 +2905,12 @@ function ListItem({ children, excluded, excludedLabel, className, ...props }) {
|
|
|
2848
2905
|
] });
|
|
2849
2906
|
}
|
|
2850
2907
|
function DescriptionList({ layout = "auto", className, children, ...props }) {
|
|
2851
|
-
return /* @__PURE__ */
|
|
2908
|
+
return /* @__PURE__ */ jsx29("dl", { ...props, className: cx("medo-dl", `medo-dl--${layout}`, className), children });
|
|
2852
2909
|
}
|
|
2853
2910
|
function DescriptionItem({ term, children }) {
|
|
2854
2911
|
return /* @__PURE__ */ jsxs26("div", { className: "medo-dl__row", children: [
|
|
2855
|
-
/* @__PURE__ */
|
|
2856
|
-
/* @__PURE__ */
|
|
2912
|
+
/* @__PURE__ */ jsx29("dt", { className: "medo-dl__term", children: term }),
|
|
2913
|
+
/* @__PURE__ */ jsx29("dd", { className: "medo-dl__value", children })
|
|
2857
2914
|
] });
|
|
2858
2915
|
}
|
|
2859
2916
|
|
|
@@ -2861,31 +2918,31 @@ function DescriptionItem({ term, children }) {
|
|
|
2861
2918
|
import { useEffect as useEffect10, useRef as useRef11, useState as useState11 } from "react";
|
|
2862
2919
|
import { GridList, GridListItem, useLocale as useLocale2 } from "react-aria-components";
|
|
2863
2920
|
import { ChevronRight as ChevronRight2 } from "lucide-react";
|
|
2864
|
-
import { Fragment as Fragment16, jsx as
|
|
2921
|
+
import { Fragment as Fragment16, jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2865
2922
|
function ListView({ variant = "plain", isLoading = false, emptyState, className, children, items, ...props }) {
|
|
2866
2923
|
if (isLoading) {
|
|
2867
|
-
return /* @__PURE__ */
|
|
2924
|
+
return /* @__PURE__ */ jsx30("div", { role: "list", "aria-busy": "true", "aria-label": props["aria-label"], className: cx("medo-list-view", `medo-list-view--${variant}`, className), children: Array.from(
|
|
2868
2925
|
{ length: 3 },
|
|
2869
|
-
(_, i) => variant === "cards" ? /* @__PURE__ */
|
|
2870
|
-
/* @__PURE__ */
|
|
2871
|
-
/* @__PURE__ */
|
|
2872
|
-
/* @__PURE__ */
|
|
2926
|
+
(_, i) => variant === "cards" ? /* @__PURE__ */ jsx30("div", { role: "listitem", className: "medo-list-card medo-list-card--loading", children: /* @__PURE__ */ jsxs27("span", { className: "medo-list-card__content", children: [
|
|
2927
|
+
/* @__PURE__ */ jsx30(Skeleton, { width: "50%" }),
|
|
2928
|
+
/* @__PURE__ */ jsx30(Skeleton, { width: "35%" }),
|
|
2929
|
+
/* @__PURE__ */ jsx30(Skeleton, { width: "70%" })
|
|
2873
2930
|
] }) }, i) : /* @__PURE__ */ jsxs27("div", { role: "listitem", className: "medo-list-row medo-list-row--loading", children: [
|
|
2874
|
-
/* @__PURE__ */
|
|
2875
|
-
/* @__PURE__ */
|
|
2876
|
-
/* @__PURE__ */
|
|
2877
|
-
/* @__PURE__ */
|
|
2931
|
+
/* @__PURE__ */ jsx30("span", { className: "medo-list-row__leading", children: /* @__PURE__ */ jsx30(Skeleton, { shape: "circle", width: 40, height: 40 }) }),
|
|
2932
|
+
/* @__PURE__ */ jsx30("span", { className: "medo-list-row__main", children: /* @__PURE__ */ jsxs27("span", { className: "medo-list-row__content", children: [
|
|
2933
|
+
/* @__PURE__ */ jsx30(Skeleton, { width: "40%" }),
|
|
2934
|
+
/* @__PURE__ */ jsx30(Skeleton, { width: "70%" })
|
|
2878
2935
|
] }) })
|
|
2879
2936
|
] }, i)
|
|
2880
2937
|
) });
|
|
2881
2938
|
}
|
|
2882
|
-
return /* @__PURE__ */
|
|
2939
|
+
return /* @__PURE__ */ jsx30(
|
|
2883
2940
|
GridList,
|
|
2884
2941
|
{
|
|
2885
2942
|
...props,
|
|
2886
2943
|
items,
|
|
2887
2944
|
keyboardNavigationBehavior: "tab",
|
|
2888
|
-
renderEmptyState: emptyState ? () => /* @__PURE__ */
|
|
2945
|
+
renderEmptyState: emptyState ? () => /* @__PURE__ */ jsx30("div", { className: "medo-list-view__empty", children: emptyState }) : void 0,
|
|
2889
2946
|
className: cx("medo-list-view", `medo-list-view--${variant}`, className),
|
|
2890
2947
|
children
|
|
2891
2948
|
}
|
|
@@ -2895,7 +2952,7 @@ function ListRow({ title, description, lines, leading, meta, trailing, chevron,
|
|
|
2895
2952
|
const m = useMessages();
|
|
2896
2953
|
const rowLines = description ? lines ?? 2 : 1;
|
|
2897
2954
|
const swipe = swipeActions?.start || swipeActions?.end;
|
|
2898
|
-
return /* @__PURE__ */
|
|
2955
|
+
return /* @__PURE__ */ jsx30(
|
|
2899
2956
|
GridListItem,
|
|
2900
2957
|
{
|
|
2901
2958
|
...props,
|
|
@@ -2903,9 +2960,9 @@ function ListRow({ title, description, lines, leading, meta, trailing, chevron,
|
|
|
2903
2960
|
className: cx("medo-list-row", `medo-list-row--lines-${rowLines}`, unread && "medo-list-row--unread", swipe && "medo-list-row--swipe"),
|
|
2904
2961
|
children: ({ selectionMode }) => {
|
|
2905
2962
|
const content = /* @__PURE__ */ jsxs27(Fragment16, { children: [
|
|
2906
|
-
selectionMode !== "none" && /* @__PURE__ */
|
|
2963
|
+
selectionMode !== "none" && /* @__PURE__ */ jsx30("span", { className: "medo-list-row__check", children: /* @__PURE__ */ jsx30(Checkbox, { slot: "selection" }) }),
|
|
2907
2964
|
leading && // Avatars size themselves: sm in 1-line rows, lg in 2–3 lines.
|
|
2908
|
-
/* @__PURE__ */
|
|
2965
|
+
/* @__PURE__ */ jsx30(AvatarSizeContext.Provider, { value: rowLines === 1 ? "sm" : "lg", children: /* @__PURE__ */ jsx30("span", { className: "medo-list-row__leading", children: leading }) }),
|
|
2909
2966
|
/* @__PURE__ */ jsxs27("span", { className: "medo-list-row__main", children: [
|
|
2910
2967
|
/* @__PURE__ */ jsxs27("span", { className: "medo-list-row__content", children: [
|
|
2911
2968
|
/* @__PURE__ */ jsxs27("span", { className: "medo-list-row__title", children: [
|
|
@@ -2915,17 +2972,17 @@ function ListRow({ title, description, lines, leading, meta, trailing, chevron,
|
|
|
2915
2972
|
] }),
|
|
2916
2973
|
title
|
|
2917
2974
|
] }),
|
|
2918
|
-
description && /* @__PURE__ */
|
|
2975
|
+
description && /* @__PURE__ */ jsx30("span", { className: "medo-list-row__description", children: description })
|
|
2919
2976
|
] }),
|
|
2920
2977
|
(meta || unread) && /* @__PURE__ */ jsxs27("span", { className: "medo-list-row__meta", children: [
|
|
2921
|
-
meta && /* @__PURE__ */
|
|
2922
|
-
unread && /* @__PURE__ */
|
|
2978
|
+
meta && /* @__PURE__ */ jsx30("span", { className: "medo-list-row__meta-text", children: meta }),
|
|
2979
|
+
unread && /* @__PURE__ */ jsx30("span", { className: "medo-list-row__dot", "aria-hidden": "true" })
|
|
2923
2980
|
] }),
|
|
2924
|
-
trailing && /* @__PURE__ */
|
|
2925
|
-
chevron && /* @__PURE__ */
|
|
2981
|
+
trailing && /* @__PURE__ */ jsx30("span", { className: "medo-list-row__trailing", children: trailing }),
|
|
2982
|
+
chevron && /* @__PURE__ */ jsx30("span", { className: "medo-list-row__chevron", "aria-hidden": "true", children: /* @__PURE__ */ jsx30(ChevronRight2, {}) })
|
|
2926
2983
|
] })
|
|
2927
2984
|
] });
|
|
2928
|
-
return swipe ? /* @__PURE__ */
|
|
2985
|
+
return swipe ? /* @__PURE__ */ jsx30(Swipeable, { actions: swipeActions, children: content }) : content;
|
|
2929
2986
|
}
|
|
2930
2987
|
}
|
|
2931
2988
|
);
|
|
@@ -3021,7 +3078,7 @@ function Swipeable({ actions, children }) {
|
|
|
3021
3078
|
const revealed = actionFor(offset);
|
|
3022
3079
|
return /* @__PURE__ */ jsxs27(Fragment16, { children: [
|
|
3023
3080
|
revealed && // Visual shortcut for touch; keyboard and screen readers use the “…” menu, so it is hidden from them.
|
|
3024
|
-
/* @__PURE__ */
|
|
3081
|
+
/* @__PURE__ */ jsx30(
|
|
3025
3082
|
"span",
|
|
3026
3083
|
{
|
|
3027
3084
|
className: cx(
|
|
@@ -3057,7 +3114,7 @@ function Swipeable({ actions, children }) {
|
|
|
3057
3114
|
},
|
|
3058
3115
|
children: [
|
|
3059
3116
|
children,
|
|
3060
|
-
open && /* @__PURE__ */
|
|
3117
|
+
open && /* @__PURE__ */ jsx30(
|
|
3061
3118
|
"span",
|
|
3062
3119
|
{
|
|
3063
3120
|
className: "medo-list-row__swipe-shield",
|
|
@@ -3074,19 +3131,19 @@ function Swipeable({ actions, children }) {
|
|
|
3074
3131
|
] });
|
|
3075
3132
|
}
|
|
3076
3133
|
function ListRowIcon({ children }) {
|
|
3077
|
-
return /* @__PURE__ */
|
|
3134
|
+
return /* @__PURE__ */ jsx30("span", { className: "medo-list-row__icon", "aria-hidden": "true", children });
|
|
3078
3135
|
}
|
|
3079
3136
|
function ListCard({ title, amount, description, meta, status, ...props }) {
|
|
3080
|
-
return /* @__PURE__ */
|
|
3081
|
-
selectionMode !== "none" && /* @__PURE__ */
|
|
3137
|
+
return /* @__PURE__ */ jsx30(GridListItem, { ...props, textValue: title, className: "medo-list-card", children: ({ selectionMode }) => /* @__PURE__ */ jsxs27(Fragment16, { children: [
|
|
3138
|
+
selectionMode !== "none" && /* @__PURE__ */ jsx30("span", { className: "medo-list-card__check", children: /* @__PURE__ */ jsx30(Checkbox, { slot: "selection", size: "lg" }) }),
|
|
3082
3139
|
/* @__PURE__ */ jsxs27("span", { className: "medo-list-card__content", children: [
|
|
3083
3140
|
/* @__PURE__ */ jsxs27("span", { className: "medo-list-card__top", children: [
|
|
3084
|
-
/* @__PURE__ */
|
|
3085
|
-
amount && /* @__PURE__ */
|
|
3141
|
+
/* @__PURE__ */ jsx30("span", { className: "medo-list-card__title", children: title }),
|
|
3142
|
+
amount && /* @__PURE__ */ jsx30("span", { className: "medo-list-card__amount", children: amount })
|
|
3086
3143
|
] }),
|
|
3087
|
-
description && /* @__PURE__ */
|
|
3144
|
+
description && /* @__PURE__ */ jsx30(AvatarSizeContext.Provider, { value: "xs", children: /* @__PURE__ */ jsx30("span", { className: "medo-list-card__description", children: description }) }),
|
|
3088
3145
|
(meta || status) && /* @__PURE__ */ jsxs27("span", { className: "medo-list-card__bottom", children: [
|
|
3089
|
-
/* @__PURE__ */
|
|
3146
|
+
/* @__PURE__ */ jsx30("span", { className: "medo-list-card__meta", children: meta }),
|
|
3090
3147
|
status
|
|
3091
3148
|
] })
|
|
3092
3149
|
] })
|
|
@@ -3097,7 +3154,7 @@ function ListCard({ title, amount, description, meta, status, ...props }) {
|
|
|
3097
3154
|
import { useEffect as useEffect11, useRef as useRef12 } from "react";
|
|
3098
3155
|
import { Button as AriaButton9, Toolbar as Toolbar2 } from "react-aria-components";
|
|
3099
3156
|
import { Ellipsis as Ellipsis3, X as X12 } from "lucide-react";
|
|
3100
|
-
import { Fragment as Fragment17, jsx as
|
|
3157
|
+
import { Fragment as Fragment17, jsx as jsx31, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3101
3158
|
function BulkActionBar({
|
|
3102
3159
|
count,
|
|
3103
3160
|
actions,
|
|
@@ -3134,16 +3191,16 @@ function BulkActionBar({
|
|
|
3134
3191
|
}
|
|
3135
3192
|
};
|
|
3136
3193
|
const overflow = more.length > 0 && (isMobile ? /* @__PURE__ */ jsxs28(MenuTrigger, { children: [
|
|
3137
|
-
/* @__PURE__ */
|
|
3138
|
-
/* @__PURE__ */
|
|
3194
|
+
/* @__PURE__ */ jsx31(MenuButton, { "aria-label": moreLabel, size: "lg" }),
|
|
3195
|
+
/* @__PURE__ */ jsx31(OverflowMenu, { actions: more })
|
|
3139
3196
|
] }) : /* @__PURE__ */ jsxs28(MenuTrigger, { children: [
|
|
3140
|
-
/* @__PURE__ */
|
|
3141
|
-
/* @__PURE__ */
|
|
3197
|
+
/* @__PURE__ */ jsx31(AriaButton9, { "aria-label": moreLabel, className: "medo-toast__button medo-toast__close", children: /* @__PURE__ */ jsx31(Ellipsis3, { "aria-hidden": "true" }) }),
|
|
3198
|
+
/* @__PURE__ */ jsx31(OverflowMenu, { actions: more })
|
|
3142
3199
|
] }));
|
|
3143
3200
|
return /* @__PURE__ */ jsxs28(Fragment17, { children: [
|
|
3144
|
-
/* @__PURE__ */
|
|
3201
|
+
/* @__PURE__ */ jsx31("span", { role: "status", className: "medo-visually-hidden", children: visible ? countLabel(count) : "" }),
|
|
3145
3202
|
visible && // The wrapper handles Esc and remembers where focus came from (events bubble from the toolbar).
|
|
3146
|
-
/* @__PURE__ */
|
|
3203
|
+
/* @__PURE__ */ jsx31(
|
|
3147
3204
|
"div",
|
|
3148
3205
|
{
|
|
3149
3206
|
className: "medo-bulk-bar-host",
|
|
@@ -3156,41 +3213,41 @@ function BulkActionBar({
|
|
|
3156
3213
|
onBlur: (e) => {
|
|
3157
3214
|
if (!e.currentTarget.contains(e.relatedTarget)) focusInside.current = false;
|
|
3158
3215
|
},
|
|
3159
|
-
children: /* @__PURE__ */
|
|
3216
|
+
children: /* @__PURE__ */ jsx31(Toolbar2, { "aria-label": ariaLabel, className: cx("medo-bulk-bar", isMobile ? "medo-bulk-bar--mobile" : "medo-bulk-bar--desktop", className), children: isMobile ? /* @__PURE__ */ jsxs28(Fragment17, { children: [
|
|
3160
3217
|
/* @__PURE__ */ jsxs28("span", { className: "medo-bulk-bar__start", children: [
|
|
3161
|
-
/* @__PURE__ */
|
|
3162
|
-
/* @__PURE__ */
|
|
3218
|
+
/* @__PURE__ */ jsx31(IconButton, { variant: "ghost", size: "lg", icon: /* @__PURE__ */ jsx31(X12, {}), "aria-label": clearLabel, tooltip: false, onPress: onClear }),
|
|
3219
|
+
/* @__PURE__ */ jsx31("span", { className: "medo-bulk-bar__count", children: countLabel(count) })
|
|
3163
3220
|
] }),
|
|
3164
3221
|
/* @__PURE__ */ jsxs28("span", { className: "medo-bulk-bar__actions", children: [
|
|
3165
|
-
shown.map((a) => /* @__PURE__ */
|
|
3222
|
+
shown.map((a) => /* @__PURE__ */ jsx31(Button, { variant: a.variant === "danger" ? "ghost-danger" : "ghost", size: "lg", onPress: a.onAction, children: a.label }, a.label)),
|
|
3166
3223
|
overflow
|
|
3167
3224
|
] })
|
|
3168
3225
|
] }) : /* @__PURE__ */ jsxs28(Fragment17, { children: [
|
|
3169
|
-
/* @__PURE__ */
|
|
3170
|
-
/* @__PURE__ */
|
|
3171
|
-
shown.map((a) => /* @__PURE__ */
|
|
3226
|
+
/* @__PURE__ */ jsx31("span", { className: "medo-bulk-bar__count", children: countLabel(count) }),
|
|
3227
|
+
/* @__PURE__ */ jsx31("span", { className: "medo-bulk-bar__divider", "aria-hidden": "true" }),
|
|
3228
|
+
shown.map((a) => /* @__PURE__ */ jsx31(AriaButton9, { className: "medo-toast__button medo-toast__action", onPress: a.onAction, children: a.label }, a.label)),
|
|
3172
3229
|
overflow,
|
|
3173
|
-
/* @__PURE__ */
|
|
3174
|
-
/* @__PURE__ */
|
|
3230
|
+
/* @__PURE__ */ jsx31("span", { className: "medo-bulk-bar__divider", "aria-hidden": "true" }),
|
|
3231
|
+
/* @__PURE__ */ jsx31(AriaButton9, { "aria-label": clearLabel, className: "medo-toast__button medo-toast__close", onPress: onClear, children: /* @__PURE__ */ jsx31(X12, { "aria-hidden": "true" }) })
|
|
3175
3232
|
] }) })
|
|
3176
3233
|
}
|
|
3177
3234
|
)
|
|
3178
3235
|
] });
|
|
3179
3236
|
}
|
|
3180
3237
|
function OverflowMenu({ actions }) {
|
|
3181
|
-
return /* @__PURE__ */
|
|
3238
|
+
return /* @__PURE__ */ jsx31(Menu, { onAction: (key) => actions[Number(key)]?.onAction(), children: actions.map((a, i) => /* @__PURE__ */ jsx31(MenuItem, { id: i, icon: a.icon, variant: a.variant === "danger" ? "danger" : "default", children: a.label }, i)) });
|
|
3182
3239
|
}
|
|
3183
3240
|
|
|
3184
3241
|
// src/empty-state/EmptyState.tsx
|
|
3185
3242
|
import { useId as useId6 } from "react";
|
|
3186
3243
|
import { CircleAlert as CircleAlert4, CircleCheck, Folder, Lock, Search as Search2 } from "lucide-react";
|
|
3187
|
-
import { jsx as
|
|
3244
|
+
import { jsx as jsx32, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3188
3245
|
var defaults = {
|
|
3189
|
-
"first-use": { icon: /* @__PURE__ */
|
|
3190
|
-
"no-results": { icon: /* @__PURE__ */
|
|
3191
|
-
error: { icon: /* @__PURE__ */
|
|
3192
|
-
"no-access": { icon: /* @__PURE__ */
|
|
3193
|
-
"all-done": { icon: /* @__PURE__ */
|
|
3246
|
+
"first-use": { icon: /* @__PURE__ */ jsx32(Folder, {}), tone: "neutral" },
|
|
3247
|
+
"no-results": { icon: /* @__PURE__ */ jsx32(Search2, {}), tone: "neutral" },
|
|
3248
|
+
error: { icon: /* @__PURE__ */ jsx32(CircleAlert4, {}), tone: "danger" },
|
|
3249
|
+
"no-access": { icon: /* @__PURE__ */ jsx32(Lock, {}), tone: "neutral" },
|
|
3250
|
+
"all-done": { icon: /* @__PURE__ */ jsx32(CircleCheck, {}), tone: "success" }
|
|
3194
3251
|
};
|
|
3195
3252
|
var tileSize = { page: "lg", section: "md", inline: "sm" };
|
|
3196
3253
|
function EmptyState({
|
|
@@ -3213,26 +3270,26 @@ function EmptyState({
|
|
|
3213
3270
|
const Title = isInline ? "p" : `h${headingLevel ?? (size === "page" ? 2 : 3)}`;
|
|
3214
3271
|
const buttonSize = size === "page" ? "md" : "sm";
|
|
3215
3272
|
return /* @__PURE__ */ jsxs29(Tag2, { ...props, "aria-labelledby": isInline ? void 0 : titleId, className: cx("medo-empty-state", `medo-empty-state--${size}`, className), children: [
|
|
3216
|
-
illustration ? /* @__PURE__ */
|
|
3273
|
+
illustration ? /* @__PURE__ */ jsx32("span", { className: "medo-empty-state__illustration", "aria-hidden": "true", children: illustration }) : /* @__PURE__ */ jsx32(IconTile, { size: tileSize[size], tone, children: icon ?? defaultIcon }),
|
|
3217
3274
|
/* @__PURE__ */ jsxs29("div", { className: "medo-empty-state__content", role: type === "no-results" ? "status" : void 0, children: [
|
|
3218
|
-
/* @__PURE__ */
|
|
3219
|
-
description && /* @__PURE__ */
|
|
3275
|
+
/* @__PURE__ */ jsx32(Title, { id: titleId, className: "medo-empty-state__title", children: title }),
|
|
3276
|
+
description && /* @__PURE__ */ jsx32("p", { className: "medo-empty-state__description", children: description })
|
|
3220
3277
|
] }),
|
|
3221
3278
|
(action || secondaryAction) && /* @__PURE__ */ jsxs29("div", { className: "medo-empty-state__actions", children: [
|
|
3222
|
-
action && /* @__PURE__ */
|
|
3223
|
-
secondaryAction && (secondaryAction.href ? /* @__PURE__ */
|
|
3279
|
+
action && /* @__PURE__ */ jsx32(Button, { variant: type === "first-use" ? "primary" : "secondary", size: buttonSize, onPress: action.onPress, isDisabled: action.isDisabled, children: action.label }),
|
|
3280
|
+
secondaryAction && (secondaryAction.href ? /* @__PURE__ */ jsx32(Link, { variant: "standalone", href: secondaryAction.href, isDisabled: secondaryAction.isDisabled, children: secondaryAction.label }) : /* @__PURE__ */ jsx32(Button, { variant: "text", size: buttonSize, onPress: secondaryAction.onPress, isDisabled: secondaryAction.isDisabled, children: secondaryAction.label }))
|
|
3224
3281
|
] })
|
|
3225
3282
|
] });
|
|
3226
3283
|
}
|
|
3227
3284
|
function IconTile({ size = "md", tone = "neutral", children }) {
|
|
3228
|
-
return /* @__PURE__ */
|
|
3285
|
+
return /* @__PURE__ */ jsx32("span", { className: cx("medo-icon-tile", `medo-icon-tile--${size}`, `medo-icon-tile--${tone}`), "aria-hidden": "true", children });
|
|
3229
3286
|
}
|
|
3230
3287
|
|
|
3231
3288
|
// src/pagination/Pagination.tsx
|
|
3232
3289
|
import { useId as useId7, useRef as useRef13, useState as useState12 } from "react";
|
|
3233
3290
|
import { Button as AriaButton10, Link as AriaLink4 } from "react-aria-components";
|
|
3234
3291
|
import { ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight3 } from "lucide-react";
|
|
3235
|
-
import { Fragment as Fragment18, jsx as
|
|
3292
|
+
import { Fragment as Fragment18, jsx as jsx33, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3236
3293
|
function getPageItems(page, totalPages) {
|
|
3237
3294
|
if (totalPages <= 7) return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
3238
3295
|
if (page <= 4) return [1, 2, 3, 4, 5, "ellipsis", totalPages];
|
|
@@ -3286,23 +3343,23 @@ function Pagination({
|
|
|
3286
3343
|
(nav.querySelector('[aria-current="page"]') ?? nav.querySelector(".medo-button:not([data-disabled])"))?.focus();
|
|
3287
3344
|
});
|
|
3288
3345
|
};
|
|
3289
|
-
const item = (target, props) => getPageHref ? /* @__PURE__ */
|
|
3346
|
+
const item = (target, props) => getPageHref ? /* @__PURE__ */ jsx33(AriaLink4, { ...props, href: props.isDisabled ? void 0 : getPageHref(target), onPress: () => go(target) }) : /* @__PURE__ */ jsx33(AriaButton10, { ...props, onPress: () => go(target) });
|
|
3290
3347
|
const step = (target, label, icon) => item(target, {
|
|
3291
3348
|
className: cx("medo-button", "medo-button--icon-only", "medo-button--ghost", `medo-button--${itemSize}`),
|
|
3292
3349
|
"aria-label": label,
|
|
3293
3350
|
isDisabled: target < 1 || target > totalPages,
|
|
3294
|
-
children: /* @__PURE__ */
|
|
3351
|
+
children: /* @__PURE__ */ jsx33("span", { className: "medo-button__icon", "aria-hidden": "true", children: icon })
|
|
3295
3352
|
});
|
|
3296
3353
|
const from = (page - 1) * pageSize + 1;
|
|
3297
3354
|
const to = totalItems !== void 0 ? Math.min(page * pageSize, totalItems) : page * pageSize;
|
|
3298
|
-
return /* @__PURE__ */
|
|
3299
|
-
step(page - 1, previousLabel, /* @__PURE__ */
|
|
3300
|
-
/* @__PURE__ */
|
|
3301
|
-
step(page + 1, nextLabel, /* @__PURE__ */
|
|
3355
|
+
return /* @__PURE__ */ jsx33("nav", { ref: navRef, "aria-label": ariaLabel, className: cx("medo-pagination", compact ? "medo-pagination--compact" : "medo-pagination--full", className), children: compact ? /* @__PURE__ */ jsxs30(Fragment18, { children: [
|
|
3356
|
+
step(page - 1, previousLabel, /* @__PURE__ */ jsx33(ChevronLeft2, {})),
|
|
3357
|
+
/* @__PURE__ */ jsx33("p", { role: "status", className: "medo-pagination__compact-label", children: compactLabel(page, totalPages) }),
|
|
3358
|
+
step(page + 1, nextLabel, /* @__PURE__ */ jsx33(ChevronRight3, {}))
|
|
3302
3359
|
] }) : /* @__PURE__ */ jsxs30(Fragment18, { children: [
|
|
3303
3360
|
(totalItems !== void 0 || onPageSizeChange) && /* @__PURE__ */ jsxs30("div", { className: "medo-pagination__info", children: [
|
|
3304
|
-
totalItems !== void 0 && /* @__PURE__ */
|
|
3305
|
-
onPageSizeChange && /* @__PURE__ */
|
|
3361
|
+
totalItems !== void 0 && /* @__PURE__ */ jsx33("p", { id: statusId, role: "status", className: "medo-pagination__summary", children: summary(from, to, totalItems) }),
|
|
3362
|
+
onPageSizeChange && /* @__PURE__ */ jsx33(
|
|
3306
3363
|
Select,
|
|
3307
3364
|
{
|
|
3308
3365
|
label: pageSizeLabel,
|
|
@@ -3310,24 +3367,24 @@ function Pagination({
|
|
|
3310
3367
|
selectedKey: pageSize,
|
|
3311
3368
|
onSelectionChange: (key) => key != null && onPageSizeChange(Number(key)),
|
|
3312
3369
|
className: "medo-pagination__size",
|
|
3313
|
-
children: pageSizeOptions.map((n) => /* @__PURE__ */
|
|
3370
|
+
children: pageSizeOptions.map((n) => /* @__PURE__ */ jsx33(Option, { id: n, children: String(n) }, n))
|
|
3314
3371
|
}
|
|
3315
3372
|
)
|
|
3316
3373
|
] }),
|
|
3317
3374
|
/* @__PURE__ */ jsxs30("ul", { className: "medo-pagination__pages", role: "list", children: [
|
|
3318
|
-
/* @__PURE__ */
|
|
3375
|
+
/* @__PURE__ */ jsx33("li", { children: step(page - 1, previousLabel, /* @__PURE__ */ jsx33(ChevronLeft2, {})) }),
|
|
3319
3376
|
getPageItems(page, totalPages).map(
|
|
3320
3377
|
(p, i) => p === "ellipsis" ? (
|
|
3321
3378
|
// Text, not a button – hidden from screen readers (the page names say where they jump).
|
|
3322
|
-
/* @__PURE__ */
|
|
3323
|
-
) : /* @__PURE__ */
|
|
3379
|
+
/* @__PURE__ */ jsx33("li", { className: cx("medo-page-item", "medo-page-item--ellipsis", `medo-page-item--${itemSize}`), "aria-hidden": "true", children: "\u2026" }, `e${i}`)
|
|
3380
|
+
) : /* @__PURE__ */ jsx33("li", { children: item(p, {
|
|
3324
3381
|
className: cx("medo-button", "medo-button--ghost", `medo-button--${itemSize}`, "medo-page-item", `medo-page-item--${itemSize}`),
|
|
3325
3382
|
"aria-label": pageLabel(p),
|
|
3326
3383
|
"aria-current": p === page ? "page" : void 0,
|
|
3327
3384
|
children: p
|
|
3328
3385
|
}) }, p)
|
|
3329
3386
|
),
|
|
3330
|
-
/* @__PURE__ */
|
|
3387
|
+
/* @__PURE__ */ jsx33("li", { children: step(page + 1, nextLabel, /* @__PURE__ */ jsx33(ChevronRight3, {})) })
|
|
3331
3388
|
] })
|
|
3332
3389
|
] }) });
|
|
3333
3390
|
}
|
|
@@ -3335,25 +3392,25 @@ function Pagination({
|
|
|
3335
3392
|
// src/search/SearchField.tsx
|
|
3336
3393
|
import { Button as AriaButton11, Input as AriaInput2, SearchField as AriaSearchField } from "react-aria-components";
|
|
3337
3394
|
import { Search as Search3, X as X13 } from "lucide-react";
|
|
3338
|
-
import { jsx as
|
|
3395
|
+
import { jsx as jsx34, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3339
3396
|
function SearchField({ label, description, placeholder, size = "md", clearLabel, className, ...props }) {
|
|
3340
3397
|
const m = useMessages();
|
|
3341
3398
|
return /* @__PURE__ */ jsxs31(AriaSearchField, { ...props, className: cx("medo-field", "medo-search-field", className), children: [
|
|
3342
|
-
label && /* @__PURE__ */
|
|
3399
|
+
label && /* @__PURE__ */ jsx34(FieldLabel, { isRequired: props.isRequired, children: label }),
|
|
3343
3400
|
/* @__PURE__ */ jsxs31("div", { className: cx("medo-input", `medo-input--${size}`), children: [
|
|
3344
|
-
/* @__PURE__ */
|
|
3345
|
-
/* @__PURE__ */
|
|
3346
|
-
/* @__PURE__ */
|
|
3401
|
+
/* @__PURE__ */ jsx34("span", { className: "medo-input__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx34(Search3, {}) }),
|
|
3402
|
+
/* @__PURE__ */ jsx34(AriaInput2, { className: "medo-input__control", placeholder }),
|
|
3403
|
+
/* @__PURE__ */ jsx34(AriaButton11, { "aria-label": clearLabel ?? m.searchField.clear, className: "medo-input__action medo-search-field__clear", children: /* @__PURE__ */ jsx34(X13, {}) })
|
|
3347
3404
|
] }),
|
|
3348
|
-
description && /* @__PURE__ */
|
|
3405
|
+
description && /* @__PURE__ */ jsx34(FieldFooter, { description })
|
|
3349
3406
|
] });
|
|
3350
3407
|
}
|
|
3351
3408
|
|
|
3352
3409
|
// src/search/SearchResult.tsx
|
|
3353
3410
|
import { Link as AriaLink5 } from "react-aria-components";
|
|
3354
3411
|
import { FileText, Globe } from "lucide-react";
|
|
3355
|
-
import { jsx as
|
|
3356
|
-
var icons = { page: /* @__PURE__ */
|
|
3412
|
+
import { jsx as jsx35, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3413
|
+
var icons = { page: /* @__PURE__ */ jsx35(Globe, {}), document: /* @__PURE__ */ jsx35(FileText, {}) };
|
|
3357
3414
|
function SearchResult({
|
|
3358
3415
|
type = "page",
|
|
3359
3416
|
variant = "base",
|
|
@@ -3370,16 +3427,16 @@ function SearchResult({
|
|
|
3370
3427
|
className
|
|
3371
3428
|
}) {
|
|
3372
3429
|
const Heading7 = `h${headingLevel}`;
|
|
3373
|
-
const lead = leading ?? (icons[type] && /* @__PURE__ */
|
|
3430
|
+
const lead = leading ?? (icons[type] && /* @__PURE__ */ jsx35(IconTile, { size: "sm", children: icons[type] }));
|
|
3374
3431
|
return /* @__PURE__ */ jsxs32("article", { className: cx("medo-search-result", `medo-search-result--${variant}`, `medo-search-result--${type}`, className), children: [
|
|
3375
|
-
lead && /* @__PURE__ */
|
|
3432
|
+
lead && /* @__PURE__ */ jsx35(AvatarSizeContext.Provider, { value: "lg", children: /* @__PURE__ */ jsx35("span", { className: "medo-search-result__leading", children: lead }) }),
|
|
3376
3433
|
/* @__PURE__ */ jsxs32("div", { className: "medo-search-result__content", children: [
|
|
3377
|
-
path && /* @__PURE__ */
|
|
3378
|
-
/* @__PURE__ */
|
|
3379
|
-
snippet && /* @__PURE__ */
|
|
3434
|
+
path && /* @__PURE__ */ jsx35("span", { className: "medo-search-result__path", children: path }),
|
|
3435
|
+
/* @__PURE__ */ jsx35(Heading7, { className: "medo-search-result__title", children: /* @__PURE__ */ jsx35(AriaLink5, { ...linkProps, href, className: "medo-search-result__link", children: /* @__PURE__ */ jsx35(Highlight, { text: title, query, all: true, className: "medo-search-result__match" }) }) }),
|
|
3436
|
+
snippet && /* @__PURE__ */ jsx35("p", { className: "medo-search-result__snippet", children: typeof snippet === "string" ? /* @__PURE__ */ jsx35(Highlight, { text: snippet, query, all: true, className: "medo-search-result__match" }) : snippet }),
|
|
3380
3437
|
(badge || meta) && /* @__PURE__ */ jsxs32("span", { className: "medo-search-result__meta", children: [
|
|
3381
|
-
badge && /* @__PURE__ */
|
|
3382
|
-
meta && /* @__PURE__ */
|
|
3438
|
+
badge && /* @__PURE__ */ jsx35(Badge, { tone: "neutral", size: "sm", children: badge }),
|
|
3439
|
+
meta && /* @__PURE__ */ jsx35("span", { className: "medo-search-result__meta-text", children: meta })
|
|
3383
3440
|
] })
|
|
3384
3441
|
] })
|
|
3385
3442
|
] });
|
|
@@ -3389,7 +3446,7 @@ function SearchResult({
|
|
|
3389
3446
|
import { useEffect as useEffect12, useLayoutEffect as useLayoutEffect5, useState as useState13 } from "react";
|
|
3390
3447
|
import { Autocomplete as Autocomplete2, Button as AriaButton12, Dialog as Dialog3, Modal as Modal5, ModalOverlay as ModalOverlay5, useFilter as useFilter2 } from "react-aria-components";
|
|
3391
3448
|
import { Search as Search4 } from "lucide-react";
|
|
3392
|
-
import { jsx as
|
|
3449
|
+
import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3393
3450
|
function QuickSearch({
|
|
3394
3451
|
isOpen,
|
|
3395
3452
|
defaultOpen,
|
|
@@ -3450,17 +3507,17 @@ function QuickSearch({
|
|
|
3450
3507
|
const term = query.trim();
|
|
3451
3508
|
const close = () => setOpen(false);
|
|
3452
3509
|
const [empty, setEmpty] = useState13(false);
|
|
3453
|
-
return /* @__PURE__ */
|
|
3510
|
+
return /* @__PURE__ */ jsx36(
|
|
3454
3511
|
ModalOverlay5,
|
|
3455
3512
|
{
|
|
3456
3513
|
isOpen: open,
|
|
3457
3514
|
onOpenChange: setOpen,
|
|
3458
3515
|
isDismissable: true,
|
|
3459
3516
|
className: cx("medo-dialog-overlay", "medo-quick-search-overlay", mobile && "medo-quick-search-overlay--mobile"),
|
|
3460
|
-
children: /* @__PURE__ */
|
|
3517
|
+
children: /* @__PURE__ */ jsx36(Modal5, { className: cx("medo-dialog", "medo-quick-search", mobile && "medo-quick-search--mobile"), children: /* @__PURE__ */ jsxs33(Dialog3, { "aria-label": ariaLabel, className: "medo-quick-search__dialog", children: [
|
|
3461
3518
|
/* @__PURE__ */ jsxs33(Autocomplete2, { inputValue: query, onInputChange: setQuery, filter: clientFilter ? contains : void 0, children: [
|
|
3462
3519
|
/* @__PURE__ */ jsxs33("div", { className: "medo-quick-search__bar", children: [
|
|
3463
|
-
/* @__PURE__ */
|
|
3520
|
+
/* @__PURE__ */ jsx36(
|
|
3464
3521
|
SearchField,
|
|
3465
3522
|
{
|
|
3466
3523
|
"aria-label": ariaLabel,
|
|
@@ -3471,10 +3528,10 @@ function QuickSearch({
|
|
|
3471
3528
|
className: "medo-quick-search__field"
|
|
3472
3529
|
}
|
|
3473
3530
|
),
|
|
3474
|
-
mobile && /* @__PURE__ */
|
|
3531
|
+
mobile && /* @__PURE__ */ jsx36(Button, { variant: "text", size: "lg", onPress: close, children: cancelLabel })
|
|
3475
3532
|
] }),
|
|
3476
3533
|
/* @__PURE__ */ jsxs33("div", { className: "medo-quick-search__scroll", tabIndex: 0, "aria-label": suggestionsLabel, role: "region", children: [
|
|
3477
|
-
/* @__PURE__ */
|
|
3534
|
+
/* @__PURE__ */ jsx36(OptionHighlightContext.Provider, { value: term, children: /* @__PURE__ */ jsx36(
|
|
3478
3535
|
ListBox,
|
|
3479
3536
|
{
|
|
3480
3537
|
"aria-label": ariaLabel,
|
|
@@ -3485,30 +3542,30 @@ function QuickSearch({
|
|
|
3485
3542
|
close();
|
|
3486
3543
|
},
|
|
3487
3544
|
className: "medo-quick-search__list",
|
|
3488
|
-
renderEmptyState: () => term ? /* @__PURE__ */
|
|
3545
|
+
renderEmptyState: () => term ? /* @__PURE__ */ jsx36(EmptyReporter, { onChange: setEmpty, message: noResultsLabel(term) }) : null,
|
|
3489
3546
|
children
|
|
3490
3547
|
}
|
|
3491
3548
|
) }),
|
|
3492
3549
|
empty && term && onSearch && /* @__PURE__ */ jsxs33(AriaButton12, { className: "medo-quick-search__all", onPress: () => onSearch(term), children: [
|
|
3493
|
-
/* @__PURE__ */
|
|
3550
|
+
/* @__PURE__ */ jsx36(Search4, { "aria-hidden": "true" }),
|
|
3494
3551
|
searchAllLabel(term)
|
|
3495
3552
|
] })
|
|
3496
3553
|
] })
|
|
3497
3554
|
] }),
|
|
3498
3555
|
!mobile && /* @__PURE__ */ jsxs33("div", { className: "medo-quick-search__footer", children: [
|
|
3499
3556
|
/* @__PURE__ */ jsxs33("span", { className: "medo-quick-search__hint", "aria-hidden": "true", children: [
|
|
3500
|
-
/* @__PURE__ */
|
|
3557
|
+
/* @__PURE__ */ jsx36(Badge, { size: "sm", children: "\u2191 \u2193" }),
|
|
3501
3558
|
hints.navigate
|
|
3502
3559
|
] }),
|
|
3503
3560
|
/* @__PURE__ */ jsxs33("span", { className: "medo-quick-search__hint", "aria-hidden": "true", children: [
|
|
3504
|
-
/* @__PURE__ */
|
|
3561
|
+
/* @__PURE__ */ jsx36(Badge, { size: "sm", children: "Enter" }),
|
|
3505
3562
|
hints.open
|
|
3506
3563
|
] }),
|
|
3507
3564
|
/* @__PURE__ */ jsxs33("span", { className: "medo-quick-search__hint", "aria-hidden": "true", children: [
|
|
3508
|
-
/* @__PURE__ */
|
|
3565
|
+
/* @__PURE__ */ jsx36(Badge, { size: "sm", children: "Esc" }),
|
|
3509
3566
|
hints.close
|
|
3510
3567
|
] }),
|
|
3511
|
-
term && !empty && allResultsHref && /* @__PURE__ */
|
|
3568
|
+
term && !empty && allResultsHref && /* @__PURE__ */ jsx36(Link, { variant: "standalone", size: "md", arrow: true, href: allResultsHref(term), className: "medo-quick-search__all-results", onPress: close, children: allResultsLabel(term) })
|
|
3512
3569
|
] })
|
|
3513
3570
|
] }) })
|
|
3514
3571
|
}
|
|
@@ -3519,14 +3576,14 @@ function EmptyReporter({ message, onChange }) {
|
|
|
3519
3576
|
onChange(true);
|
|
3520
3577
|
return () => onChange(false);
|
|
3521
3578
|
}, [onChange]);
|
|
3522
|
-
return /* @__PURE__ */
|
|
3579
|
+
return /* @__PURE__ */ jsx36("p", { role: "status", className: "medo-quick-search__message", children: message });
|
|
3523
3580
|
}
|
|
3524
3581
|
|
|
3525
3582
|
// src/breadcrumbs/Breadcrumbs.tsx
|
|
3526
3583
|
import { useLayoutEffect as useLayoutEffect6, useRef as useRef14, useState as useState14 } from "react";
|
|
3527
3584
|
import { Breadcrumb, Breadcrumbs as AriaBreadcrumbs, Button as AriaButton13, Link as AriaLink6 } from "react-aria-components";
|
|
3528
3585
|
import { ChevronLeft as ChevronLeft3, ChevronRight as ChevronRight4, Ellipsis as Ellipsis4, Folder as Folder2, House } from "lucide-react";
|
|
3529
|
-
import { jsx as
|
|
3586
|
+
import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3530
3587
|
function Breadcrumbs({
|
|
3531
3588
|
items,
|
|
3532
3589
|
size = "md",
|
|
@@ -3544,38 +3601,38 @@ function Breadcrumbs({
|
|
|
3544
3601
|
if (items.length < 2) return null;
|
|
3545
3602
|
if (back) {
|
|
3546
3603
|
const parent = items[items.length - 2];
|
|
3547
|
-
return /* @__PURE__ */
|
|
3548
|
-
/* @__PURE__ */
|
|
3549
|
-
/* @__PURE__ */
|
|
3604
|
+
return /* @__PURE__ */ jsx37("nav", { "aria-label": ariaLabel, className: cx("medo-breadcrumbs", `medo-breadcrumbs--${size}`, "medo-breadcrumbs--back", className), children: /* @__PURE__ */ jsxs34(AriaLink6, { href: parent.href, className: "medo-breadcrumbs__link medo-breadcrumbs__back", children: [
|
|
3605
|
+
/* @__PURE__ */ jsx37(ChevronLeft3, { className: "medo-breadcrumbs__back-icon", "aria-hidden": "true" }),
|
|
3606
|
+
/* @__PURE__ */ jsx37(Label3, { text: parent.label })
|
|
3550
3607
|
] }) });
|
|
3551
3608
|
}
|
|
3552
3609
|
const collapse = items.length >= 5;
|
|
3553
3610
|
const hidden = collapse ? items.slice(1, -3) : [];
|
|
3554
3611
|
const shown = collapse ? [items[0], null, ...items.slice(-3)] : items;
|
|
3555
3612
|
const last = shown.length - 1;
|
|
3556
|
-
return /* @__PURE__ */
|
|
3557
|
-
const separator = i < last && /* @__PURE__ */
|
|
3613
|
+
return /* @__PURE__ */ jsx37("nav", { "aria-label": ariaLabel, className: cx("medo-breadcrumbs", `medo-breadcrumbs--${size}`, className), children: /* @__PURE__ */ jsx37(AriaBreadcrumbs, { className: "medo-breadcrumbs__list", children: shown.map((item, i) => {
|
|
3614
|
+
const separator = i < last && /* @__PURE__ */ jsx37(ChevronRight4, { className: "medo-breadcrumbs__separator", "aria-hidden": "true" });
|
|
3558
3615
|
if (!item) {
|
|
3559
3616
|
return /* @__PURE__ */ jsxs34(Breadcrumb, { id: "more", className: "medo-breadcrumbs__item", children: [
|
|
3560
3617
|
/* @__PURE__ */ jsxs34(MenuTrigger, { children: [
|
|
3561
|
-
/* @__PURE__ */
|
|
3562
|
-
/* @__PURE__ */
|
|
3618
|
+
/* @__PURE__ */ jsx37(AriaButton13, { "aria-label": moreLabel(hidden.length), className: "medo-breadcrumbs__icon-part", children: /* @__PURE__ */ jsx37(Ellipsis4, { "aria-hidden": "true" }) }),
|
|
3619
|
+
/* @__PURE__ */ jsx37(Menu, { children: hidden.map((h) => /* @__PURE__ */ jsx37(MenuItem, { id: h.label, href: h.href, icon: /* @__PURE__ */ jsx37(Folder2, {}), children: h.label }, h.label)) })
|
|
3563
3620
|
] }),
|
|
3564
3621
|
separator
|
|
3565
3622
|
] }, "more");
|
|
3566
3623
|
}
|
|
3567
3624
|
const isHome = homeIcon && i === 0;
|
|
3568
3625
|
return /* @__PURE__ */ jsxs34(Breadcrumb, { id: `${i}-${item.label}`, className: "medo-breadcrumbs__item", children: [
|
|
3569
|
-
isHome ? /* @__PURE__ */
|
|
3626
|
+
isHome ? /* @__PURE__ */ jsx37(AriaLink6, { href: item.href, "aria-label": item.label, className: "medo-breadcrumbs__icon-part", children: /* @__PURE__ */ jsx37(House, { "aria-hidden": "true" }) }) : i === last ? (
|
|
3570
3627
|
// The current page: not a link (React Aria sets aria-current="page").
|
|
3571
|
-
/* @__PURE__ */
|
|
3572
|
-
) : /* @__PURE__ */
|
|
3628
|
+
/* @__PURE__ */ jsx37(AriaLink6, { className: "medo-breadcrumbs__link medo-breadcrumbs__current", children: /* @__PURE__ */ jsx37(Label3, { text: item.label }) })
|
|
3629
|
+
) : /* @__PURE__ */ jsx37(TruncatedLink, { href: item.href, label: item.label }),
|
|
3573
3630
|
separator
|
|
3574
3631
|
] }, `${i}-${item.label}`);
|
|
3575
3632
|
}) }) });
|
|
3576
3633
|
}
|
|
3577
3634
|
function Label3({ text }) {
|
|
3578
|
-
return /* @__PURE__ */
|
|
3635
|
+
return /* @__PURE__ */ jsx37("span", { className: "medo-breadcrumbs__label", children: text });
|
|
3579
3636
|
}
|
|
3580
3637
|
function TruncatedLink({ href, label }) {
|
|
3581
3638
|
const ref = useRef14(null);
|
|
@@ -3584,13 +3641,13 @@ function TruncatedLink({ href, label }) {
|
|
|
3584
3641
|
const el = ref.current;
|
|
3585
3642
|
if (el) setCut(el.scrollWidth > el.clientWidth);
|
|
3586
3643
|
}, [label]);
|
|
3587
|
-
const text = /* @__PURE__ */
|
|
3644
|
+
const text = /* @__PURE__ */ jsx37("span", { ref, className: "medo-breadcrumbs__label", children: label });
|
|
3588
3645
|
if (!cut) {
|
|
3589
|
-
return /* @__PURE__ */
|
|
3646
|
+
return /* @__PURE__ */ jsx37(AriaLink6, { href, className: "medo-breadcrumbs__link", children: text });
|
|
3590
3647
|
}
|
|
3591
3648
|
return /* @__PURE__ */ jsxs34(TooltipTrigger, { children: [
|
|
3592
|
-
/* @__PURE__ */
|
|
3593
|
-
/* @__PURE__ */
|
|
3649
|
+
/* @__PURE__ */ jsx37(TooltipLink, { href, className: "medo-breadcrumbs__link", children: text }),
|
|
3650
|
+
/* @__PURE__ */ jsx37(Tooltip, { children: label })
|
|
3594
3651
|
] });
|
|
3595
3652
|
}
|
|
3596
3653
|
|
|
@@ -3598,7 +3655,7 @@ function TruncatedLink({ href, label }) {
|
|
|
3598
3655
|
import { Children as Children3, createContext as createContext10, isValidElement as isValidElement3, useContext as useContext17, useEffect as useEffect13, useId as useId8, useState as useState15 } from "react";
|
|
3599
3656
|
import { Button as AriaButton14, Disclosure, DisclosureGroup, DisclosurePanel, Heading as Heading6 } from "react-aria-components";
|
|
3600
3657
|
import { ChevronDown as ChevronDown4 } from "lucide-react";
|
|
3601
|
-
import { jsx as
|
|
3658
|
+
import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3602
3659
|
var AccordionContext = createContext10({ size: "md", headingLevel: 3 });
|
|
3603
3660
|
var hashId = () => typeof window === "undefined" ? "" : decodeURIComponent(window.location.hash.slice(1));
|
|
3604
3661
|
function Accordion({
|
|
@@ -3641,9 +3698,9 @@ function Accordion({
|
|
|
3641
3698
|
});
|
|
3642
3699
|
const allOpen = ids.length > 0 && ids.every((id) => expanded.has(id));
|
|
3643
3700
|
const showToggle = expandAll && allowsMultipleExpanded && Children3.count(children) > 6;
|
|
3644
|
-
return /* @__PURE__ */
|
|
3645
|
-
showToggle && /* @__PURE__ */
|
|
3646
|
-
/* @__PURE__ */
|
|
3701
|
+
return /* @__PURE__ */ jsx38(AccordionContext.Provider, { value: { size, headingLevel }, children: /* @__PURE__ */ jsxs35("div", { className: cx("medo-accordion-wrap", className), children: [
|
|
3702
|
+
showToggle && /* @__PURE__ */ jsx38("div", { className: "medo-accordion__toolbar", children: /* @__PURE__ */ jsx38(Button, { variant: "text", size: "sm", onPress: () => setExpanded(allOpen ? /* @__PURE__ */ new Set() : new Set(ids)), children: allOpen ? collapseAllLabel ?? m.accordion.collapseAll : expandAllLabel ?? m.accordion.expandAll }) }),
|
|
3703
|
+
/* @__PURE__ */ jsx38(
|
|
3647
3704
|
DisclosureGroup,
|
|
3648
3705
|
{
|
|
3649
3706
|
...props,
|
|
@@ -3660,17 +3717,17 @@ function AccordionItem({ id, title, description, icon, badge, isDisabled, childr
|
|
|
3660
3717
|
const { headingLevel } = useContext17(AccordionContext);
|
|
3661
3718
|
const descId = useId8();
|
|
3662
3719
|
return /* @__PURE__ */ jsxs35(Disclosure, { id, isDisabled, className: cx("medo-accordion__item", !!icon && "medo-accordion__item--icon"), children: [
|
|
3663
|
-
/* @__PURE__ */
|
|
3664
|
-
icon && /* @__PURE__ */
|
|
3720
|
+
/* @__PURE__ */ jsx38(Heading6, { level: headingLevel, id, className: "medo-accordion__heading", children: /* @__PURE__ */ jsxs35(AriaButton14, { slot: "trigger", className: "medo-accordion__trigger", "aria-describedby": description ? descId : void 0, children: [
|
|
3721
|
+
icon && /* @__PURE__ */ jsx38("span", { className: "medo-accordion__icon", "aria-hidden": "true", children: icon }),
|
|
3665
3722
|
/* @__PURE__ */ jsxs35("span", { className: "medo-accordion__text", children: [
|
|
3666
|
-
/* @__PURE__ */
|
|
3723
|
+
/* @__PURE__ */ jsx38("span", { className: "medo-accordion__title", children: title }),
|
|
3667
3724
|
description && // Read as description, not as part of the name.
|
|
3668
|
-
/* @__PURE__ */
|
|
3725
|
+
/* @__PURE__ */ jsx38("span", { id: descId, className: "medo-accordion__description", "aria-hidden": "true", children: description })
|
|
3669
3726
|
] }),
|
|
3670
|
-
badge && /* @__PURE__ */
|
|
3671
|
-
/* @__PURE__ */
|
|
3727
|
+
badge && /* @__PURE__ */ jsx38("span", { className: "medo-accordion__badge", children: badge }),
|
|
3728
|
+
/* @__PURE__ */ jsx38(ChevronDown4, { className: "medo-accordion__chevron", "aria-hidden": "true" })
|
|
3672
3729
|
] }) }),
|
|
3673
|
-
/* @__PURE__ */
|
|
3730
|
+
/* @__PURE__ */ jsx38(DisclosurePanel, { className: "medo-accordion__panel", children: /* @__PURE__ */ jsx38("div", { className: "medo-accordion__content", children }) })
|
|
3674
3731
|
] });
|
|
3675
3732
|
}
|
|
3676
3733
|
|
|
@@ -3680,17 +3737,17 @@ import { Label as Label4, Slider as AriaSlider, SliderOutput, SliderThumb, Slide
|
|
|
3680
3737
|
|
|
3681
3738
|
// src/number-field/NumberField.tsx
|
|
3682
3739
|
import { Input as AriaInput3, NumberField as AriaNumberField } from "react-aria-components";
|
|
3683
|
-
import { jsx as
|
|
3740
|
+
import { jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3684
3741
|
function NumberField({ label, description, errorMessage, placeholder, size = "md", className, ...props }) {
|
|
3685
3742
|
return /* @__PURE__ */ jsxs36(AriaNumberField, { ...props, className: cx("medo-field", "medo-number-field", className), children: [
|
|
3686
|
-
label && /* @__PURE__ */
|
|
3687
|
-
/* @__PURE__ */
|
|
3688
|
-
(description || errorMessage) && /* @__PURE__ */
|
|
3743
|
+
label && /* @__PURE__ */ jsx39(FieldLabel, { isRequired: props.isRequired, children: label }),
|
|
3744
|
+
/* @__PURE__ */ jsx39("div", { className: cx("medo-input", `medo-input--${size}`), children: /* @__PURE__ */ jsx39(AriaInput3, { className: "medo-input__control medo-number-field__control", placeholder }) }),
|
|
3745
|
+
(description || errorMessage) && /* @__PURE__ */ jsx39(FieldFooter, { description, errorMessage })
|
|
3689
3746
|
] });
|
|
3690
3747
|
}
|
|
3691
3748
|
|
|
3692
3749
|
// src/slider/Slider.tsx
|
|
3693
|
-
import { Fragment as Fragment19, jsx as
|
|
3750
|
+
import { Fragment as Fragment19, jsx as jsx40, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3694
3751
|
function Slider({
|
|
3695
3752
|
label,
|
|
3696
3753
|
thumbLabels,
|
|
@@ -3709,20 +3766,20 @@ function Slider({
|
|
|
3709
3766
|
const format = useMemo(() => new Intl.NumberFormat(locale, formatOptions), [locale, formatOptions]);
|
|
3710
3767
|
const steps = Math.round((maxValue - minValue) / step);
|
|
3711
3768
|
const labelText = typeof label === "string" ? label : props["aria-label"] ?? "";
|
|
3712
|
-
return /* @__PURE__ */
|
|
3769
|
+
return /* @__PURE__ */ jsx40(AriaSlider, { ...props, minValue, maxValue, step, formatOptions, className: cx("medo-slider", className), children: ({ state }) => {
|
|
3713
3770
|
const range = state.values.length > 1;
|
|
3714
3771
|
const start = range ? state.getThumbPercent(0) : 0;
|
|
3715
3772
|
const end = state.getThumbPercent(state.values.length - 1);
|
|
3716
3773
|
return /* @__PURE__ */ jsxs37(Fragment19, { children: [
|
|
3717
3774
|
(label || showValue) && /* @__PURE__ */ jsxs37("div", { className: "medo-slider__header", children: [
|
|
3718
|
-
label && /* @__PURE__ */
|
|
3719
|
-
showValue && /* @__PURE__ */
|
|
3775
|
+
label && /* @__PURE__ */ jsx40(Label4, { className: "medo-slider__label", "aria-disabled": props.isDisabled || void 0, children: label }),
|
|
3776
|
+
showValue && /* @__PURE__ */ jsx40(SliderOutput, { className: "medo-slider__value", "aria-disabled": props.isDisabled || void 0 })
|
|
3720
3777
|
] }),
|
|
3721
3778
|
/* @__PURE__ */ jsxs37(SliderTrack, { className: "medo-slider__track", children: [
|
|
3722
|
-
/* @__PURE__ */
|
|
3723
|
-
showTicks && steps <= 10 && /* @__PURE__ */
|
|
3724
|
-
/* @__PURE__ */
|
|
3725
|
-
state.values.map((_, i) => /* @__PURE__ */
|
|
3779
|
+
/* @__PURE__ */ jsx40("span", { className: "medo-slider__rail", "aria-hidden": "true" }),
|
|
3780
|
+
showTicks && steps <= 10 && /* @__PURE__ */ jsx40("span", { className: "medo-slider__ticks", "aria-hidden": "true", children: Array.from({ length: steps + 1 }, (_, i) => /* @__PURE__ */ jsx40("span", { className: "medo-slider__tick", style: { insetInlineStart: `${i / steps * 100}%` } }, i)) }),
|
|
3781
|
+
/* @__PURE__ */ jsx40("span", { className: "medo-slider__fill", style: { insetInlineStart: `${start * 100}%`, inlineSize: `${(end - start) * 100}%` }, "aria-hidden": "true" }),
|
|
3782
|
+
state.values.map((_, i) => /* @__PURE__ */ jsx40(
|
|
3726
3783
|
SliderThumb,
|
|
3727
3784
|
{
|
|
3728
3785
|
index: i,
|
|
@@ -3730,15 +3787,15 @@ function Slider({
|
|
|
3730
3787
|
className: "medo-slider__thumb",
|
|
3731
3788
|
children: ({ isDragging }) => (
|
|
3732
3789
|
// The finger covers the thumb: show the value above it while dragging.
|
|
3733
|
-
isDragging && /* @__PURE__ */
|
|
3790
|
+
isDragging && /* @__PURE__ */ jsx40("span", { className: "medo-tooltip medo-slider__bubble", "aria-hidden": "true", children: state.getThumbValueLabel(i) })
|
|
3734
3791
|
)
|
|
3735
3792
|
},
|
|
3736
3793
|
i
|
|
3737
3794
|
))
|
|
3738
3795
|
] }),
|
|
3739
3796
|
showMinMax && /* @__PURE__ */ jsxs37("div", { className: "medo-slider__limits", "aria-hidden": "true", children: [
|
|
3740
|
-
/* @__PURE__ */
|
|
3741
|
-
/* @__PURE__ */
|
|
3797
|
+
/* @__PURE__ */ jsx40("span", { children: format.format(minValue) }),
|
|
3798
|
+
/* @__PURE__ */ jsx40("span", { children: format.format(maxValue) })
|
|
3742
3799
|
] })
|
|
3743
3800
|
] });
|
|
3744
3801
|
} });
|
|
@@ -3752,17 +3809,17 @@ function SliderField({ value, onChange, inputLabels, ...props }) {
|
|
|
3752
3809
|
const [lo, hi] = value;
|
|
3753
3810
|
const names = inputLabels ?? thumbLabels ?? [m.slider.minimum(labelText), m.slider.maximum(labelText)];
|
|
3754
3811
|
return /* @__PURE__ */ jsxs37("div", { className: "medo-slider-field medo-slider-field--range", children: [
|
|
3755
|
-
/* @__PURE__ */
|
|
3812
|
+
/* @__PURE__ */ jsx40(Slider, { ...props, value, onChange }),
|
|
3756
3813
|
/* @__PURE__ */ jsxs37("div", { className: "medo-slider-field__inputs", children: [
|
|
3757
|
-
/* @__PURE__ */
|
|
3758
|
-
/* @__PURE__ */
|
|
3759
|
-
/* @__PURE__ */
|
|
3814
|
+
/* @__PURE__ */ jsx40(NumberField, { ...field, "aria-label": names[0], minValue, maxValue: hi, value: lo, onChange: (v) => !Number.isNaN(v) && onChange([v, hi]) }),
|
|
3815
|
+
/* @__PURE__ */ jsx40("span", { className: "medo-slider-field__dash", "aria-hidden": "true", children: "\u2013" }),
|
|
3816
|
+
/* @__PURE__ */ jsx40(NumberField, { ...field, "aria-label": names[1], minValue: lo, maxValue, value: hi, onChange: (v) => !Number.isNaN(v) && onChange([lo, v]) })
|
|
3760
3817
|
] })
|
|
3761
3818
|
] });
|
|
3762
3819
|
}
|
|
3763
3820
|
return /* @__PURE__ */ jsxs37("div", { className: "medo-slider-field medo-slider-field--single", children: [
|
|
3764
|
-
/* @__PURE__ */
|
|
3765
|
-
/* @__PURE__ */
|
|
3821
|
+
/* @__PURE__ */ jsx40(Slider, { ...props, value, onChange, showValue: false }),
|
|
3822
|
+
/* @__PURE__ */ jsx40(
|
|
3766
3823
|
NumberField,
|
|
3767
3824
|
{
|
|
3768
3825
|
...field,
|
|
@@ -3779,7 +3836,7 @@ function SliderField({ value, onChange, inputLabels, ...props }) {
|
|
|
3779
3836
|
|
|
3780
3837
|
// src/alert/Alert.tsx
|
|
3781
3838
|
import { CircleAlert as CircleAlert5, CircleCheck as CircleCheck2, Info as Info3, TriangleAlert as TriangleAlert2, X as X14 } from "lucide-react";
|
|
3782
|
-
import { jsx as
|
|
3839
|
+
import { jsx as jsx41, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3783
3840
|
var ICONS = {
|
|
3784
3841
|
info: Info3,
|
|
3785
3842
|
success: CircleCheck2,
|
|
@@ -3802,19 +3859,19 @@ function Alert({
|
|
|
3802
3859
|
const Icon = ICONS[tone];
|
|
3803
3860
|
const role = announce ? tone === "danger" || tone === "warning" ? "alert" : "status" : void 0;
|
|
3804
3861
|
return /* @__PURE__ */ jsxs38("div", { ...props, role: role ?? props.role, className: cx("medo-alert", `medo-alert--${tone}`, variant === "banner" && "medo-alert--banner", className), children: [
|
|
3805
|
-
/* @__PURE__ */
|
|
3862
|
+
/* @__PURE__ */ jsx41(Icon, { className: "medo-alert__icon", "aria-hidden": "true" }),
|
|
3806
3863
|
/* @__PURE__ */ jsxs38("div", { className: "medo-alert__content", children: [
|
|
3807
|
-
/* @__PURE__ */
|
|
3808
|
-
children && /* @__PURE__ */
|
|
3809
|
-
actions && /* @__PURE__ */
|
|
3864
|
+
/* @__PURE__ */ jsx41("p", { className: "medo-alert__title", children: title }),
|
|
3865
|
+
children && /* @__PURE__ */ jsx41("div", { className: "medo-alert__description", children }),
|
|
3866
|
+
actions && /* @__PURE__ */ jsx41("div", { className: "medo-alert__actions", children: actions })
|
|
3810
3867
|
] }),
|
|
3811
|
-
onDismiss && /* @__PURE__ */
|
|
3868
|
+
onDismiss && /* @__PURE__ */ jsx41(IconButton, { className: "medo-alert__close", variant: "ghost", size: "sm", icon: /* @__PURE__ */ jsx41(X14, {}), "aria-label": dismissLabel ?? m.alert.dismiss, onPress: onDismiss })
|
|
3812
3869
|
] });
|
|
3813
3870
|
}
|
|
3814
3871
|
|
|
3815
3872
|
// src/card/Card.tsx
|
|
3816
3873
|
import { Link as AriaLink7 } from "react-aria-components";
|
|
3817
|
-
import { jsx as
|
|
3874
|
+
import { jsx as jsx42, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3818
3875
|
function Card({
|
|
3819
3876
|
title,
|
|
3820
3877
|
subtitle,
|
|
@@ -3846,17 +3903,17 @@ function Card({
|
|
|
3846
3903
|
),
|
|
3847
3904
|
style,
|
|
3848
3905
|
children: [
|
|
3849
|
-
media && /* @__PURE__ */
|
|
3906
|
+
media && /* @__PURE__ */ jsx42("div", { className: "medo-card__media", children: media }),
|
|
3850
3907
|
/* @__PURE__ */ jsxs39("div", { className: "medo-card__main", children: [
|
|
3851
3908
|
/* @__PURE__ */ jsxs39("div", { className: "medo-card__header", children: [
|
|
3852
3909
|
/* @__PURE__ */ jsxs39("div", { className: "medo-card__heading", children: [
|
|
3853
|
-
/* @__PURE__ */
|
|
3854
|
-
subtitle && /* @__PURE__ */
|
|
3910
|
+
/* @__PURE__ */ jsx42(Heading7, { className: "medo-card__title", children: interactive ? /* @__PURE__ */ jsx42(AriaLink7, { ...linkProps, href, className: "medo-card__link", children: title }) : title }),
|
|
3911
|
+
subtitle && /* @__PURE__ */ jsx42("p", { className: "medo-card__subtitle", children: subtitle })
|
|
3855
3912
|
] }),
|
|
3856
|
-
headerActions && /* @__PURE__ */
|
|
3913
|
+
headerActions && /* @__PURE__ */ jsx42("div", { className: "medo-card__header-actions", children: headerActions })
|
|
3857
3914
|
] }),
|
|
3858
|
-
children && /* @__PURE__ */
|
|
3859
|
-
footer && /* @__PURE__ */
|
|
3915
|
+
children && /* @__PURE__ */ jsx42("div", { className: "medo-card__body", children }),
|
|
3916
|
+
footer && /* @__PURE__ */ jsx42("div", { className: "medo-card__footer", children: footer })
|
|
3860
3917
|
] })
|
|
3861
3918
|
]
|
|
3862
3919
|
}
|
|
@@ -3877,7 +3934,7 @@ import {
|
|
|
3877
3934
|
useTableOptions
|
|
3878
3935
|
} from "react-aria-components";
|
|
3879
3936
|
import { ArrowDown, ArrowUp, ArrowUpDown, Check as Check6, Minus as Minus2 } from "lucide-react";
|
|
3880
|
-
import { jsx as
|
|
3937
|
+
import { jsx as jsx43, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3881
3938
|
function useScrollsSideways() {
|
|
3882
3939
|
const ref = useRef15(null);
|
|
3883
3940
|
const [scrolls, setScrolls] = useState16(false);
|
|
@@ -3898,71 +3955,71 @@ function StaticTable({ children, caption, captionHidden, density = "standard", s
|
|
|
3898
3955
|
const captionId = useId9();
|
|
3899
3956
|
const m = useMessages();
|
|
3900
3957
|
const region = scrolls ? caption ? { role: "region", tabIndex: 0, "aria-labelledby": captionId } : { role: "region", tabIndex: 0, "aria-label": m.table.scrollRegion } : {};
|
|
3901
|
-
return /* @__PURE__ */
|
|
3902
|
-
caption && /* @__PURE__ */
|
|
3958
|
+
return /* @__PURE__ */ jsx43("div", { ref, ...region, className: cx("medo-table-container", plain2 && "medo-table-container--plain", className), style, children: /* @__PURE__ */ jsxs40("table", { className: cx("medo-table", density === "compact" && "medo-table--compact", striped && "medo-table--striped"), children: [
|
|
3959
|
+
caption && /* @__PURE__ */ jsx43("caption", { id: captionId, className: captionHidden ? "medo-visually-hidden" : void 0, children: caption }),
|
|
3903
3960
|
children
|
|
3904
3961
|
] }) });
|
|
3905
3962
|
}
|
|
3906
3963
|
function Table({ density = "standard", striped, plain: plain2, toolbar, footer, className, style, ...props }) {
|
|
3907
|
-
const table = /* @__PURE__ */
|
|
3964
|
+
const table = /* @__PURE__ */ jsx43(AriaTable, { ...props, className: cx("medo-table", density === "compact" && "medo-table--compact", striped && "medo-table--striped") });
|
|
3908
3965
|
if (!toolbar && !footer) {
|
|
3909
|
-
return /* @__PURE__ */
|
|
3966
|
+
return /* @__PURE__ */ jsx43("div", { className: cx("medo-table-container", plain2 && "medo-table-container--plain", className), style, children: table });
|
|
3910
3967
|
}
|
|
3911
3968
|
return /* @__PURE__ */ jsxs40("div", { className: cx("medo-table-frame", plain2 && "medo-table-frame--plain", className), style, children: [
|
|
3912
|
-
toolbar && /* @__PURE__ */
|
|
3913
|
-
/* @__PURE__ */
|
|
3914
|
-
footer && /* @__PURE__ */
|
|
3969
|
+
toolbar && /* @__PURE__ */ jsx43("div", { className: "medo-table__toolbar", children: toolbar }),
|
|
3970
|
+
/* @__PURE__ */ jsx43("div", { className: "medo-table-container medo-table-container--plain", children: table }),
|
|
3971
|
+
footer && /* @__PURE__ */ jsx43("div", { className: "medo-table__footer", children: footer })
|
|
3915
3972
|
] });
|
|
3916
3973
|
}
|
|
3917
3974
|
function SelectionCheckbox() {
|
|
3918
|
-
return /* @__PURE__ */
|
|
3975
|
+
return /* @__PURE__ */ jsx43(AriaCheckbox, { slot: "selection", className: "medo-choice medo-checkbox medo-choice--md medo-choice__button", children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ jsx43("span", { className: "medo-choice__control", "aria-hidden": "true", children: isIndeterminate ? /* @__PURE__ */ jsx43(Minus2, {}) : isSelected ? /* @__PURE__ */ jsx43(Check6, {}) : null }) });
|
|
3919
3976
|
}
|
|
3920
3977
|
function TableHeader({ columns, children, ...props }) {
|
|
3921
3978
|
const { selectionBehavior, selectionMode, allowsDragging } = useTableOptions();
|
|
3922
3979
|
return /* @__PURE__ */ jsxs40(AriaTableHeader, { ...props, className: "medo-table__header", children: [
|
|
3923
|
-
allowsDragging && /* @__PURE__ */
|
|
3924
|
-
selectionBehavior === "toggle" && selectionMode !== "none" && /* @__PURE__ */
|
|
3925
|
-
/* @__PURE__ */
|
|
3980
|
+
allowsDragging && /* @__PURE__ */ jsx43(AriaColumn, { className: "medo-table__column medo-table__column--utility" }),
|
|
3981
|
+
selectionBehavior === "toggle" && selectionMode !== "none" && /* @__PURE__ */ jsx43(AriaColumn, { className: "medo-table__column medo-table__column--utility", children: selectionMode === "multiple" && /* @__PURE__ */ jsx43(SelectionCheckbox, {}) }),
|
|
3982
|
+
/* @__PURE__ */ jsx43(Collection3, { items: columns, children })
|
|
3926
3983
|
] });
|
|
3927
3984
|
}
|
|
3928
3985
|
function Column({ children, align = "start", ...props }) {
|
|
3929
|
-
return /* @__PURE__ */
|
|
3986
|
+
return /* @__PURE__ */ jsx43(AriaColumn, { ...props, "data-align": align, className: "medo-table__column", children: ({ allowsSorting, sortDirection }) => /* @__PURE__ */ jsxs40("span", { className: "medo-table__column-inner", children: [
|
|
3930
3987
|
children,
|
|
3931
|
-
allowsSorting && (sortDirection === "ascending" ? /* @__PURE__ */
|
|
3988
|
+
allowsSorting && (sortDirection === "ascending" ? /* @__PURE__ */ jsx43(ArrowUp, { className: "medo-table__sort", "aria-hidden": "true" }) : sortDirection === "descending" ? /* @__PURE__ */ jsx43(ArrowDown, { className: "medo-table__sort", "aria-hidden": "true" }) : /* @__PURE__ */ jsx43(ArrowUpDown, { className: "medo-table__sort", "aria-hidden": "true" }))
|
|
3932
3989
|
] }) });
|
|
3933
3990
|
}
|
|
3934
3991
|
function TableBody(props) {
|
|
3935
|
-
return /* @__PURE__ */
|
|
3992
|
+
return /* @__PURE__ */ jsx43(AriaTableBody, { ...props, className: "medo-table__body" });
|
|
3936
3993
|
}
|
|
3937
3994
|
function Row({ id, columns, children, ...props }) {
|
|
3938
3995
|
const { selectionBehavior, selectionMode, allowsDragging } = useTableOptions();
|
|
3939
3996
|
return /* @__PURE__ */ jsxs40(AriaRow, { id, ...props, className: "medo-table__row", children: [
|
|
3940
|
-
allowsDragging && /* @__PURE__ */
|
|
3941
|
-
selectionBehavior === "toggle" && selectionMode !== "none" && /* @__PURE__ */
|
|
3942
|
-
/* @__PURE__ */
|
|
3997
|
+
allowsDragging && /* @__PURE__ */ jsx43(AriaCell, { className: "medo-table__cell medo-table__cell--utility" }),
|
|
3998
|
+
selectionBehavior === "toggle" && selectionMode !== "none" && /* @__PURE__ */ jsx43(AriaCell, { className: "medo-table__cell medo-table__cell--utility", children: /* @__PURE__ */ jsx43(SelectionCheckbox, {}) }),
|
|
3999
|
+
/* @__PURE__ */ jsx43(Collection3, { items: columns, children })
|
|
3943
4000
|
] });
|
|
3944
4001
|
}
|
|
3945
4002
|
function Cell({ align = "start", ...props }) {
|
|
3946
|
-
return /* @__PURE__ */
|
|
4003
|
+
return /* @__PURE__ */ jsx43(AriaCell, { ...props, "data-align": align, className: "medo-table__cell" });
|
|
3947
4004
|
}
|
|
3948
4005
|
|
|
3949
4006
|
// src/table/ColumnsMenu.tsx
|
|
3950
4007
|
import { Columns3 } from "lucide-react";
|
|
3951
|
-
import { jsx as
|
|
4008
|
+
import { jsx as jsx44, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3952
4009
|
function ColumnsMenu({ columns, visibleColumns, onVisibleColumnsChange, label: labelProp, title: titleProp }) {
|
|
3953
4010
|
const m = useMessages();
|
|
3954
4011
|
const label = labelProp ?? m.table.columns;
|
|
3955
4012
|
const title = titleProp ?? m.table.showColumns;
|
|
3956
4013
|
const locked = columns.filter((c) => c.isLocked).map((c) => c.id);
|
|
3957
4014
|
return /* @__PURE__ */ jsxs41(PopoverTrigger, { children: [
|
|
3958
|
-
/* @__PURE__ */
|
|
3959
|
-
/* @__PURE__ */
|
|
4015
|
+
/* @__PURE__ */ jsx44(Button, { variant: "ghost", size: "sm", startIcon: /* @__PURE__ */ jsx44(Columns3, {}), children: label }),
|
|
4016
|
+
/* @__PURE__ */ jsx44(Popover5, { size: "sm", "aria-label": title, children: /* @__PURE__ */ jsx44(
|
|
3960
4017
|
CheckboxGroup,
|
|
3961
4018
|
{
|
|
3962
4019
|
label: title,
|
|
3963
4020
|
value: visibleColumns,
|
|
3964
4021
|
onChange: (ids) => onVisibleColumnsChange(columns.map((c) => c.id).filter((id) => ids.includes(id) || locked.includes(id))),
|
|
3965
|
-
children: columns.map((c) => /* @__PURE__ */
|
|
4022
|
+
children: columns.map((c) => /* @__PURE__ */ jsx44(Checkbox, { value: c.id, isDisabled: c.isLocked, children: c.label }, c.id))
|
|
3966
4023
|
}
|
|
3967
4024
|
) })
|
|
3968
4025
|
] });
|
|
@@ -3978,7 +4035,7 @@ import {
|
|
|
3978
4035
|
useLocale as useLocale4
|
|
3979
4036
|
} from "react-aria-components";
|
|
3980
4037
|
import { CircleAlert as CircleAlert6, CircleCheck as CircleCheck3, CloudUpload, FileText as FileText2, Image as ImageIcon, RotateCw, Trash2, Upload, X as X15 } from "lucide-react";
|
|
3981
|
-
import { Fragment as Fragment20, jsx as
|
|
4038
|
+
import { Fragment as Fragment20, jsx as jsx45, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
3982
4039
|
var units = ["byte", "kilobyte", "megabyte", "gigabyte"];
|
|
3983
4040
|
function unitOf(bytes) {
|
|
3984
4041
|
let i = 0;
|
|
@@ -4014,10 +4071,10 @@ function FileName({ name, className }) {
|
|
|
4014
4071
|
const start = name.length > keep + 4 ? name.slice(0, -keep) : name;
|
|
4015
4072
|
const end = name.length > keep + 4 ? name.slice(-keep) : "";
|
|
4016
4073
|
return /* @__PURE__ */ jsxs42("span", { className: cx("medo-file-name", className), children: [
|
|
4017
|
-
/* @__PURE__ */
|
|
4074
|
+
/* @__PURE__ */ jsx45("span", { className: "medo-visually-hidden", children: name }),
|
|
4018
4075
|
/* @__PURE__ */ jsxs42("span", { className: "medo-file-name__visual", title: name, "aria-hidden": "true", children: [
|
|
4019
|
-
/* @__PURE__ */
|
|
4020
|
-
end && /* @__PURE__ */
|
|
4076
|
+
/* @__PURE__ */ jsx45("span", { className: "medo-file-name__start", children: start }),
|
|
4077
|
+
end && /* @__PURE__ */ jsx45("span", { className: "medo-file-name__end", children: end })
|
|
4021
4078
|
] })
|
|
4022
4079
|
] });
|
|
4023
4080
|
}
|
|
@@ -4033,8 +4090,8 @@ function FileItem({ file, onRemove, onCancel, onRetry, texts: own, className })
|
|
|
4033
4090
|
let meta;
|
|
4034
4091
|
if (file.status === "uploading") {
|
|
4035
4092
|
meta = /* @__PURE__ */ jsxs42(Fragment20, { children: [
|
|
4036
|
-
/* @__PURE__ */
|
|
4037
|
-
/* @__PURE__ */
|
|
4093
|
+
/* @__PURE__ */ jsx45("span", { className: "medo-file-item__meta", children: percent != null ? t.progress(formatLoaded(file.loaded ?? 0, file.size, locale), size, percent) : size }),
|
|
4094
|
+
/* @__PURE__ */ jsx45(
|
|
4038
4095
|
ProgressBar,
|
|
4039
4096
|
{
|
|
4040
4097
|
size: "sm",
|
|
@@ -4049,20 +4106,20 @@ function FileItem({ file, onRemove, onCancel, onRetry, texts: own, className })
|
|
|
4049
4106
|
} else {
|
|
4050
4107
|
const error = file.status === "error";
|
|
4051
4108
|
meta = /* @__PURE__ */ jsxs42("span", { className: cx("medo-file-item__meta", error && "medo-file-item__meta--error"), children: [
|
|
4052
|
-
error ? /* @__PURE__ */
|
|
4053
|
-
/* @__PURE__ */
|
|
4109
|
+
error ? /* @__PURE__ */ jsx45(CircleAlert6, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx45(CircleCheck3, { "aria-hidden": "true", className: "medo-file-item__done" }),
|
|
4110
|
+
/* @__PURE__ */ jsx45("span", { children: error ? file.error : size })
|
|
4054
4111
|
] });
|
|
4055
4112
|
}
|
|
4056
4113
|
return /* @__PURE__ */ jsxs42("div", { className: cx("medo-file-item", `medo-file-item--${file.status}`, className), children: [
|
|
4057
|
-
isImage(file) ? /* @__PURE__ */
|
|
4114
|
+
isImage(file) ? /* @__PURE__ */ jsx45("img", { className: "medo-file-item__thumb", src: file.previewUrl, alt: "" }) : /* @__PURE__ */ jsx45("span", { className: "medo-file-item__icon", "aria-hidden": "true", children: file.type?.startsWith("image/") ? /* @__PURE__ */ jsx45(ImageIcon, {}) : /* @__PURE__ */ jsx45(FileText2, {}) }),
|
|
4058
4115
|
/* @__PURE__ */ jsxs42("div", { className: "medo-file-item__content", children: [
|
|
4059
|
-
/* @__PURE__ */
|
|
4116
|
+
/* @__PURE__ */ jsx45(FileName, { name: file.name, className: "medo-file-item__name" }),
|
|
4060
4117
|
meta
|
|
4061
4118
|
] }),
|
|
4062
4119
|
/* @__PURE__ */ jsxs42("div", { className: "medo-file-item__actions", children: [
|
|
4063
|
-
file.status === "uploading" && /* @__PURE__ */
|
|
4064
|
-
file.status === "error" && onRetry && file.canRetry !== false && /* @__PURE__ */
|
|
4065
|
-
file.status !== "uploading" && /* @__PURE__ */
|
|
4120
|
+
file.status === "uploading" && /* @__PURE__ */ jsx45(IconButton, { size: "sm", icon: /* @__PURE__ */ jsx45(X15, {}), "aria-label": t.cancel(file.name), onPress: () => (onCancel ?? onRemove)(file.id) }),
|
|
4121
|
+
file.status === "error" && onRetry && file.canRetry !== false && /* @__PURE__ */ jsx45(IconButton, { size: "sm", icon: /* @__PURE__ */ jsx45(RotateCw, {}), "aria-label": t.retry(file.name), onPress: () => onRetry(file.id) }),
|
|
4122
|
+
file.status !== "uploading" && /* @__PURE__ */ jsx45(IconButton, { size: "sm", icon: file.status === "done" ? /* @__PURE__ */ jsx45(Trash2, {}) : /* @__PURE__ */ jsx45(X15, {}), "aria-label": t.remove(file.name), onPress: () => onRemove(file.id) })
|
|
4066
4123
|
] })
|
|
4067
4124
|
] });
|
|
4068
4125
|
}
|
|
@@ -4073,10 +4130,10 @@ function FileTile({ file, onRemove, onCancel, onRetry, texts: own, className })
|
|
|
4073
4130
|
const retry = file.status === "error" && onRetry && file.canRetry !== false;
|
|
4074
4131
|
return /* @__PURE__ */ jsxs42("div", { className: cx("medo-file-tile", `medo-file-tile--${file.status}`, className), children: [
|
|
4075
4132
|
/* @__PURE__ */ jsxs42("div", { className: "medo-file-tile__media", children: [
|
|
4076
|
-
file.previewUrl ? /* @__PURE__ */
|
|
4133
|
+
file.previewUrl ? /* @__PURE__ */ jsx45("img", { className: "medo-file-tile__image", src: file.previewUrl, alt: "" }) : /* @__PURE__ */ jsx45("span", { className: "medo-file-tile__placeholder", "aria-hidden": "true", children: /* @__PURE__ */ jsx45(ImageIcon, {}) }),
|
|
4077
4134
|
file.status === "uploading" && /* @__PURE__ */ jsxs42("div", { className: "medo-file-tile__overlay", children: [
|
|
4078
|
-
/* @__PURE__ */
|
|
4079
|
-
/* @__PURE__ */
|
|
4135
|
+
/* @__PURE__ */ jsx45("span", { className: "medo-file-tile__percent", "aria-hidden": "true", children: percent != null ? `${percent} %` : "" }),
|
|
4136
|
+
/* @__PURE__ */ jsx45(
|
|
4080
4137
|
ProgressBar,
|
|
4081
4138
|
{
|
|
4082
4139
|
size: "sm",
|
|
@@ -4089,15 +4146,15 @@ function FileTile({ file, onRemove, onCancel, onRetry, texts: own, className })
|
|
|
4089
4146
|
)
|
|
4090
4147
|
] }),
|
|
4091
4148
|
file.status === "error" && (retry ? /* @__PURE__ */ jsxs42(AriaButton15, { className: "medo-file-tile__overlay medo-file-tile__retry", "aria-label": t.retry(file.name), onPress: () => onRetry(file.id), children: [
|
|
4092
|
-
/* @__PURE__ */
|
|
4093
|
-
/* @__PURE__ */
|
|
4094
|
-
] }) : /* @__PURE__ */
|
|
4095
|
-
/* @__PURE__ */
|
|
4149
|
+
/* @__PURE__ */ jsx45(CircleAlert6, { "aria-hidden": "true" }),
|
|
4150
|
+
/* @__PURE__ */ jsx45("span", { "aria-hidden": "true", children: t.retryShort })
|
|
4151
|
+
] }) : /* @__PURE__ */ jsx45("div", { className: "medo-file-tile__overlay", "aria-hidden": "true", children: /* @__PURE__ */ jsx45(CircleAlert6, {}) })),
|
|
4152
|
+
/* @__PURE__ */ jsx45(
|
|
4096
4153
|
IconButton,
|
|
4097
4154
|
{
|
|
4098
4155
|
variant: "media",
|
|
4099
4156
|
size: "sm",
|
|
4100
|
-
icon: /* @__PURE__ */
|
|
4157
|
+
icon: /* @__PURE__ */ jsx45(X15, {}),
|
|
4101
4158
|
"aria-label": file.status === "uploading" ? t.cancel(file.name) : t.remove(file.name),
|
|
4102
4159
|
onPress: () => (file.status === "uploading" ? onCancel ?? onRemove : onRemove)(file.id),
|
|
4103
4160
|
className: "medo-file-tile__remove"
|
|
@@ -4110,7 +4167,7 @@ function FileTile({ file, onRemove, onCancel, onRetry, texts: own, className })
|
|
|
4110
4167
|
": "
|
|
4111
4168
|
] }),
|
|
4112
4169
|
file.error
|
|
4113
|
-
] }) : /* @__PURE__ */
|
|
4170
|
+
] }) : /* @__PURE__ */ jsx45(FileName, { name: file.name, className: "medo-file-tile__caption" })
|
|
4114
4171
|
] });
|
|
4115
4172
|
}
|
|
4116
4173
|
async function filesFrom(e) {
|
|
@@ -4133,7 +4190,7 @@ function Dropzone({
|
|
|
4133
4190
|
const t = { ...m.upload, ...own };
|
|
4134
4191
|
const hintId = useId10();
|
|
4135
4192
|
const errorId = useId10();
|
|
4136
|
-
return /* @__PURE__ */
|
|
4193
|
+
return /* @__PURE__ */ jsx45(
|
|
4137
4194
|
DropZone,
|
|
4138
4195
|
{
|
|
4139
4196
|
"aria-labelledby": props["aria-labelledby"],
|
|
@@ -4141,16 +4198,16 @@ function Dropzone({
|
|
|
4141
4198
|
onDrop: async (e) => onSelect(await filesFrom(e)),
|
|
4142
4199
|
className: cx("medo-dropzone", !!errorMessage && "medo-dropzone--invalid", className),
|
|
4143
4200
|
children: ({ isDropTarget }) => /* @__PURE__ */ jsxs42(Fragment20, { children: [
|
|
4144
|
-
/* @__PURE__ */
|
|
4145
|
-
/* @__PURE__ */
|
|
4146
|
-
/* @__PURE__ */
|
|
4201
|
+
/* @__PURE__ */ jsx45(IconTile, { size: "md", children: /* @__PURE__ */ jsx45(CloudUpload, {}) }),
|
|
4202
|
+
/* @__PURE__ */ jsx45(Text9, { slot: "label", className: "medo-dropzone__title", "aria-disabled": isDisabled || void 0, children: isDropTarget ? t.dropTitle : t.title }),
|
|
4203
|
+
/* @__PURE__ */ jsx45(
|
|
4147
4204
|
AriaFileTrigger,
|
|
4148
4205
|
{
|
|
4149
4206
|
acceptedFileTypes,
|
|
4150
4207
|
allowsMultiple,
|
|
4151
4208
|
defaultCamera,
|
|
4152
4209
|
onSelect: (list) => list && onSelect([...list]),
|
|
4153
|
-
children: /* @__PURE__ */
|
|
4210
|
+
children: /* @__PURE__ */ jsx45(
|
|
4154
4211
|
Button,
|
|
4155
4212
|
{
|
|
4156
4213
|
variant: "secondary",
|
|
@@ -4163,10 +4220,10 @@ function Dropzone({
|
|
|
4163
4220
|
)
|
|
4164
4221
|
}
|
|
4165
4222
|
),
|
|
4166
|
-
hint && /* @__PURE__ */
|
|
4223
|
+
hint && /* @__PURE__ */ jsx45("span", { id: hintId, className: "medo-dropzone__hint", "aria-disabled": isDisabled || void 0, children: hint }),
|
|
4167
4224
|
errorMessage && /* @__PURE__ */ jsxs42("span", { id: errorId, className: "medo-field__error medo-dropzone__error", children: [
|
|
4168
|
-
/* @__PURE__ */
|
|
4169
|
-
/* @__PURE__ */
|
|
4225
|
+
/* @__PURE__ */ jsx45(CircleAlert6, { "aria-hidden": "true" }),
|
|
4226
|
+
/* @__PURE__ */ jsx45("span", { children: errorMessage })
|
|
4170
4227
|
] })
|
|
4171
4228
|
] })
|
|
4172
4229
|
}
|
|
@@ -4194,21 +4251,21 @@ function FileTrigger({
|
|
|
4194
4251
|
return /* @__PURE__ */ jsxs42("div", { className: cx("medo-field", "medo-file-trigger", className), children: [
|
|
4195
4252
|
label && /* @__PURE__ */ jsxs42("span", { id: labelId, className: "medo-field__label", children: [
|
|
4196
4253
|
label,
|
|
4197
|
-
isRequired && /* @__PURE__ */
|
|
4254
|
+
isRequired && /* @__PURE__ */ jsx45("span", { className: "medo-field__required", "aria-hidden": "true", children: "*" })
|
|
4198
4255
|
] }),
|
|
4199
|
-
/* @__PURE__ */
|
|
4256
|
+
/* @__PURE__ */ jsx45("div", { children: /* @__PURE__ */ jsx45(
|
|
4200
4257
|
AriaFileTrigger,
|
|
4201
4258
|
{
|
|
4202
4259
|
acceptedFileTypes,
|
|
4203
4260
|
allowsMultiple,
|
|
4204
4261
|
defaultCamera,
|
|
4205
4262
|
onSelect: (list) => list && onSelect([...list]),
|
|
4206
|
-
children: /* @__PURE__ */
|
|
4263
|
+
children: /* @__PURE__ */ jsx45(
|
|
4207
4264
|
Button,
|
|
4208
4265
|
{
|
|
4209
4266
|
id: buttonId,
|
|
4210
4267
|
variant: "secondary",
|
|
4211
|
-
startIcon: /* @__PURE__ */
|
|
4268
|
+
startIcon: /* @__PURE__ */ jsx45(Upload, {}),
|
|
4212
4269
|
isDisabled,
|
|
4213
4270
|
className: "medo-upload__choose",
|
|
4214
4271
|
"aria-labelledby": label ? `${labelId} ${buttonId}` : void 0,
|
|
@@ -4219,10 +4276,10 @@ function FileTrigger({
|
|
|
4219
4276
|
}
|
|
4220
4277
|
) }),
|
|
4221
4278
|
(hint || errorMessage) && /* @__PURE__ */ jsxs42("div", { className: "medo-field__footer", children: [
|
|
4222
|
-
hint && !errorMessage && /* @__PURE__ */
|
|
4279
|
+
hint && !errorMessage && /* @__PURE__ */ jsx45("span", { id: hintId, className: "medo-field__description", children: hint }),
|
|
4223
4280
|
errorMessage && /* @__PURE__ */ jsxs42("span", { id: errorId, className: "medo-field__error", children: [
|
|
4224
|
-
/* @__PURE__ */
|
|
4225
|
-
/* @__PURE__ */
|
|
4281
|
+
/* @__PURE__ */ jsx45(CircleAlert6, { "aria-hidden": "true" }),
|
|
4282
|
+
/* @__PURE__ */ jsx45("span", { children: errorMessage })
|
|
4226
4283
|
] })
|
|
4227
4284
|
] })
|
|
4228
4285
|
] });
|
|
@@ -4332,15 +4389,15 @@ function UploadField({
|
|
|
4332
4389
|
"aria-label": label || compact ? void 0 : ariaLabel,
|
|
4333
4390
|
className: cx("medo-upload", grid && "medo-upload--grid", compact && "medo-upload--compact", className),
|
|
4334
4391
|
children: [
|
|
4335
|
-
compact ? /* @__PURE__ */
|
|
4392
|
+
compact ? /* @__PURE__ */ jsx45(FileTrigger, { ...picker, label, isRequired }) : /* @__PURE__ */ jsxs42(Fragment20, { children: [
|
|
4336
4393
|
label && /* @__PURE__ */ jsxs42("span", { id: labelId, className: "medo-field__label", children: [
|
|
4337
4394
|
label,
|
|
4338
|
-
isRequired && /* @__PURE__ */
|
|
4395
|
+
isRequired && /* @__PURE__ */ jsx45("span", { className: "medo-field__required", "aria-hidden": "true", children: "*" })
|
|
4339
4396
|
] }),
|
|
4340
|
-
/* @__PURE__ */
|
|
4397
|
+
/* @__PURE__ */ jsx45(Dropzone, { ...picker, "aria-labelledby": label ? labelId : void 0 })
|
|
4341
4398
|
] }),
|
|
4342
|
-
all.length > 0 && /* @__PURE__ */
|
|
4343
|
-
/* @__PURE__ */
|
|
4399
|
+
all.length > 0 && /* @__PURE__ */ jsx45("ul", { className: cx("medo-upload__list", grid && "medo-upload__list--grid"), "aria-label": t.listLabel, children: all.map((file) => /* @__PURE__ */ jsx45("li", { className: "medo-upload__item", children: grid ? /* @__PURE__ */ jsx45(FileTile, { file, ...actions }) : /* @__PURE__ */ jsx45(FileItem, { file, ...actions }) }, file.id)) }),
|
|
4400
|
+
/* @__PURE__ */ jsx45("span", { role: "status", className: "medo-visually-hidden", children: announcement })
|
|
4344
4401
|
]
|
|
4345
4402
|
}
|
|
4346
4403
|
);
|
|
@@ -4361,7 +4418,7 @@ import {
|
|
|
4361
4418
|
} from "react-aria-components";
|
|
4362
4419
|
import { DateFormatter, getDayOfWeek, getLocalTimeZone, today } from "@internationalized/date";
|
|
4363
4420
|
import { ChevronDown as ChevronDown5, ChevronLeft as ChevronLeft4, ChevronRight as ChevronRight5 } from "lucide-react";
|
|
4364
|
-
import { jsx as
|
|
4421
|
+
import { jsx as jsx46, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
4365
4422
|
var defaultCalendarTexts = en.calendar;
|
|
4366
4423
|
function isoWeek(date) {
|
|
4367
4424
|
const d = new Date(Date.UTC(date.year, date.month - 1, date.day));
|
|
@@ -4389,35 +4446,35 @@ function Header3({
|
|
|
4389
4446
|
if (view !== "days") {
|
|
4390
4447
|
const title = view === "months" ? yearTitle.format(focused.toDate(tz)) : `${yearStart} \u2013 ${yearStart + 11}`;
|
|
4391
4448
|
return /* @__PURE__ */ jsxs43("div", { className: "medo-calendar__header", children: [
|
|
4392
|
-
view === "months" ? /* @__PURE__ */
|
|
4449
|
+
view === "months" ? /* @__PURE__ */ jsx46(
|
|
4393
4450
|
Button,
|
|
4394
4451
|
{
|
|
4395
4452
|
slot: null,
|
|
4396
4453
|
variant: "ghost",
|
|
4397
4454
|
size: buttonSize,
|
|
4398
|
-
endIcon: /* @__PURE__ */
|
|
4455
|
+
endIcon: /* @__PURE__ */ jsx46(ChevronDown5, {}),
|
|
4399
4456
|
onPress: () => setView("years"),
|
|
4400
4457
|
"aria-label": t.chooseYear(title),
|
|
4401
4458
|
className: "medo-calendar__title",
|
|
4402
4459
|
children: title
|
|
4403
4460
|
}
|
|
4404
|
-
) : /* @__PURE__ */
|
|
4461
|
+
) : /* @__PURE__ */ jsx46("span", { className: "medo-calendar__title medo-calendar__title--static", "aria-live": "polite", children: title }),
|
|
4405
4462
|
/* @__PURE__ */ jsxs43("div", { className: "medo-calendar__nav", children: [
|
|
4406
|
-
/* @__PURE__ */
|
|
4407
|
-
/* @__PURE__ */
|
|
4463
|
+
/* @__PURE__ */ jsx46(IconButton, { slot: null, size: buttonSize, icon: /* @__PURE__ */ jsx46(ChevronLeft4, {}), "aria-label": view === "months" ? t.previousYear : t.previousYears, onPress: () => shift(-1) }),
|
|
4464
|
+
/* @__PURE__ */ jsx46(IconButton, { slot: null, size: buttonSize, icon: /* @__PURE__ */ jsx46(ChevronRight5, {}), "aria-label": view === "months" ? t.nextYear : t.nextYears, onPress: () => shift(1) })
|
|
4408
4465
|
] })
|
|
4409
4466
|
] });
|
|
4410
4467
|
}
|
|
4411
|
-
return /* @__PURE__ */
|
|
4468
|
+
return /* @__PURE__ */ jsx46("div", { className: "medo-calendar__headers", style: { gridTemplateColumns: `repeat(${months}, 1fr)` }, children: Array.from({ length: months }, (_, i) => {
|
|
4412
4469
|
const title = monthTitle.format(focused.add({ months: i }).toDate(tz));
|
|
4413
4470
|
return /* @__PURE__ */ jsxs43("div", { className: "medo-calendar__header", children: [
|
|
4414
|
-
/* @__PURE__ */
|
|
4471
|
+
/* @__PURE__ */ jsx46(
|
|
4415
4472
|
Button,
|
|
4416
4473
|
{
|
|
4417
4474
|
slot: null,
|
|
4418
4475
|
variant: "ghost",
|
|
4419
4476
|
size: buttonSize,
|
|
4420
|
-
endIcon: /* @__PURE__ */
|
|
4477
|
+
endIcon: /* @__PURE__ */ jsx46(ChevronDown5, {}),
|
|
4421
4478
|
onPress: () => setView("months"),
|
|
4422
4479
|
"aria-label": t.chooseMonth(title),
|
|
4423
4480
|
className: "medo-calendar__title",
|
|
@@ -4425,8 +4482,8 @@ function Header3({
|
|
|
4425
4482
|
}
|
|
4426
4483
|
),
|
|
4427
4484
|
/* @__PURE__ */ jsxs43("div", { className: "medo-calendar__nav", children: [
|
|
4428
|
-
i === 0 && /* @__PURE__ */
|
|
4429
|
-
i === months - 1 && /* @__PURE__ */
|
|
4485
|
+
i === 0 && /* @__PURE__ */ jsx46(IconButton, { slot: "previous", size: buttonSize, icon: /* @__PURE__ */ jsx46(ChevronLeft4, {}), "aria-label": t.previousMonth }),
|
|
4486
|
+
i === months - 1 && /* @__PURE__ */ jsx46(IconButton, { slot: "next", size: buttonSize, icon: /* @__PURE__ */ jsx46(ChevronRight5, {}), "aria-label": t.nextMonth })
|
|
4430
4487
|
] })
|
|
4431
4488
|
] }, i);
|
|
4432
4489
|
}) });
|
|
@@ -4460,7 +4517,7 @@ function PeriodGrid({ view, setView, state }) {
|
|
|
4460
4517
|
useEffect16(() => {
|
|
4461
4518
|
ref.current?.querySelector("[data-focus-target]")?.focus();
|
|
4462
4519
|
}, [view]);
|
|
4463
|
-
return /* @__PURE__ */
|
|
4520
|
+
return /* @__PURE__ */ jsx46("div", { ref, className: "medo-calendar__periods", role: "group", children: items.map((item) => /* @__PURE__ */ jsx46(
|
|
4464
4521
|
AriaButton16,
|
|
4465
4522
|
{
|
|
4466
4523
|
slot: null,
|
|
@@ -4480,12 +4537,12 @@ function PeriodGrid({ view, setView, state }) {
|
|
|
4480
4537
|
function DayGrid({ offset, showWeekNumbers, t }) {
|
|
4481
4538
|
const { locale } = useLocale5();
|
|
4482
4539
|
return /* @__PURE__ */ jsxs43("div", { className: cx("medo-calendar__month", showWeekNumbers && "medo-calendar__month--weeks"), children: [
|
|
4483
|
-
showWeekNumbers && /* @__PURE__ */
|
|
4540
|
+
showWeekNumbers && /* @__PURE__ */ jsx46("span", { className: "medo-calendar__weeks-label", "aria-hidden": "true", children: t.weekNumber }),
|
|
4484
4541
|
/* @__PURE__ */ jsxs43(CalendarGrid, { offset: offset ? { months: offset } : void 0, weekdayStyle: "short", className: "medo-calendar__grid", children: [
|
|
4485
|
-
/* @__PURE__ */
|
|
4486
|
-
/* @__PURE__ */
|
|
4542
|
+
/* @__PURE__ */ jsx46(CalendarGridHeader, { children: (day) => /* @__PURE__ */ jsx46(CalendarHeaderCell, { className: "medo-calendar__weekday", children: day.replace(/\.$/, "").slice(0, 2) }) }),
|
|
4543
|
+
/* @__PURE__ */ jsx46(CalendarGridBody, { children: (date) => /* @__PURE__ */ jsx46(CalendarCell, { date, className: "medo-calendar__cell", children: ({ formattedDate }) => (
|
|
4487
4544
|
// The week number is drawn by CSS (data-week), so it is not part of the day's visible name (WCAG 2.5.3).
|
|
4488
|
-
/* @__PURE__ */
|
|
4545
|
+
/* @__PURE__ */ jsx46("span", { className: "medo-calendar__day", "data-week": showWeekNumbers && getDayOfWeek(date, locale) === 0 ? isoWeek(date.add({ days: 3 })) : void 0, children: formattedDate })
|
|
4489
4546
|
) }) })
|
|
4490
4547
|
] })
|
|
4491
4548
|
] });
|
|
@@ -4504,21 +4561,21 @@ function CalendarBody({ state, size, months, showWeekNumbers, t }) {
|
|
|
4504
4561
|
setView(v);
|
|
4505
4562
|
};
|
|
4506
4563
|
return /* @__PURE__ */ jsxs43("div", { ref, className: "medo-calendar__body", children: [
|
|
4507
|
-
/* @__PURE__ */
|
|
4508
|
-
view === "days" ? /* @__PURE__ */
|
|
4564
|
+
/* @__PURE__ */ jsx46(Header3, { view, setView: changeView, state, size, months: view === "days" ? months : 1, t }),
|
|
4565
|
+
view === "days" ? /* @__PURE__ */ jsx46("div", { className: "medo-calendar__months", style: { gridTemplateColumns: `repeat(${months}, auto)` }, children: Array.from({ length: months }, (_, i) => /* @__PURE__ */ jsx46(DayGrid, { offset: i, showWeekNumbers, t }, i)) }) : /* @__PURE__ */ jsx46(PeriodGrid, { view, setView: changeView, state })
|
|
4509
4566
|
] });
|
|
4510
4567
|
}
|
|
4511
4568
|
function Calendar({ size = "md", showWeekNumbers, texts, className, ...props }) {
|
|
4512
4569
|
const m = useMessages();
|
|
4513
4570
|
const t = { ...m.calendar, ...texts };
|
|
4514
|
-
return /* @__PURE__ */
|
|
4571
|
+
return /* @__PURE__ */ jsx46(AriaCalendar, { ...props, className: cx("medo-calendar", `medo-calendar--${size}`, className), children: ({ state }) => /* @__PURE__ */ jsx46(CalendarBody, { state, size, months: 1, showWeekNumbers, t }) });
|
|
4515
4572
|
}
|
|
4516
4573
|
function RangeCalendar({ size = "md", showWeekNumbers, visibleMonths = "auto", texts, className, ...props }) {
|
|
4517
4574
|
const m = useMessages();
|
|
4518
4575
|
const t = { ...m.calendar, ...texts };
|
|
4519
4576
|
const mobile = useMediaQuery(MOBILE_QUERY);
|
|
4520
4577
|
const months = visibleMonths === "auto" ? mobile ? 1 : 2 : visibleMonths;
|
|
4521
|
-
return /* @__PURE__ */
|
|
4578
|
+
return /* @__PURE__ */ jsx46(AriaRangeCalendar, { ...props, visibleDuration: { months }, className: cx("medo-calendar", "medo-calendar--range", `medo-calendar--${size}`, className), children: ({ state }) => /* @__PURE__ */ jsx46(
|
|
4522
4579
|
CalendarBody,
|
|
4523
4580
|
{
|
|
4524
4581
|
state: {
|
|
@@ -4548,18 +4605,18 @@ import {
|
|
|
4548
4605
|
} from "react-aria-components";
|
|
4549
4606
|
import { DateFormatter as DateFormatter2 } from "@internationalized/date";
|
|
4550
4607
|
import { Clock } from "lucide-react";
|
|
4551
|
-
import { jsx as
|
|
4608
|
+
import { jsx as jsx47, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
4552
4609
|
function DateSegments({ size = "md", children }) {
|
|
4553
4610
|
return /* @__PURE__ */ jsxs44("div", { className: cx("medo-input", `medo-input--${size}`, "medo-date-box"), children: [
|
|
4554
|
-
/* @__PURE__ */
|
|
4611
|
+
/* @__PURE__ */ jsx47(DateInput, { className: "medo-date-input", children: (segment) => /* @__PURE__ */ jsx47(DateSegment, { segment, className: "medo-date-segment" }) }),
|
|
4555
4612
|
children
|
|
4556
4613
|
] });
|
|
4557
4614
|
}
|
|
4558
4615
|
function DateField({ label, description, errorMessage, size = "md", className, ...props }) {
|
|
4559
4616
|
return /* @__PURE__ */ jsxs44(AriaDateField, { shouldForceLeadingZeros: true, ...props, className: cx("medo-field", "medo-date-field", className), children: [
|
|
4560
|
-
label && /* @__PURE__ */
|
|
4561
|
-
/* @__PURE__ */
|
|
4562
|
-
/* @__PURE__ */
|
|
4617
|
+
label && /* @__PURE__ */ jsx47(FieldLabel, { isRequired: props.isRequired, children: label }),
|
|
4618
|
+
/* @__PURE__ */ jsx47(DateSegments, { size }),
|
|
4619
|
+
/* @__PURE__ */ jsx47(FieldFooter, { description, errorMessage })
|
|
4563
4620
|
] });
|
|
4564
4621
|
}
|
|
4565
4622
|
function TimeField({
|
|
@@ -4590,10 +4647,10 @@ function TimeField({
|
|
|
4590
4647
|
const key = (v) => v ? `${v.hour}:${v.minute}` : "";
|
|
4591
4648
|
const text = (v) => format.format(new Date(2e3, 0, 1, v.hour, v.minute));
|
|
4592
4649
|
return /* @__PURE__ */ jsxs44(AriaTimeField, { shouldForceLeadingZeros: true, ...props, value, onChange: change, className: cx("medo-field", "medo-date-field", "medo-time-field", className), children: [
|
|
4593
|
-
label && /* @__PURE__ */
|
|
4594
|
-
/* @__PURE__ */
|
|
4595
|
-
/* @__PURE__ */
|
|
4596
|
-
/* @__PURE__ */
|
|
4650
|
+
label && /* @__PURE__ */ jsx47(FieldLabel, { isRequired: props.isRequired, children: label }),
|
|
4651
|
+
/* @__PURE__ */ jsx47(DateSegments, { size, children: slots && /* @__PURE__ */ jsxs44(PopoverTrigger, { children: [
|
|
4652
|
+
/* @__PURE__ */ jsx47(InputAction, { icon: /* @__PURE__ */ jsx47(Clock, {}), "aria-label": slotsLabel, isDisabled: props.isDisabled || props.isReadOnly }),
|
|
4653
|
+
/* @__PURE__ */ jsx47(Popover5, { size: "auto", "aria-label": slotsLabel, placement: "bottom end", className: "medo-time-slots", children: (close) => /* @__PURE__ */ jsx47(
|
|
4597
4654
|
ListBox,
|
|
4598
4655
|
{
|
|
4599
4656
|
"aria-label": slotsLabel,
|
|
@@ -4607,11 +4664,11 @@ function TimeField({
|
|
|
4607
4664
|
if (slot) change(slot.value);
|
|
4608
4665
|
close();
|
|
4609
4666
|
},
|
|
4610
|
-
children: slots.map((s2) => /* @__PURE__ */
|
|
4667
|
+
children: slots.map((s2) => /* @__PURE__ */ jsx47(Option, { id: key(s2.value), textValue: text(s2.value), description: s2.isDisabled ? s2.reason : void 0, children: text(s2.value) }, key(s2.value)))
|
|
4611
4668
|
}
|
|
4612
4669
|
) })
|
|
4613
4670
|
] }) }),
|
|
4614
|
-
/* @__PURE__ */
|
|
4671
|
+
/* @__PURE__ */ jsx47(FieldFooter, { description, errorMessage })
|
|
4615
4672
|
] });
|
|
4616
4673
|
}
|
|
4617
4674
|
|
|
@@ -4631,7 +4688,7 @@ import {
|
|
|
4631
4688
|
} from "react-aria-components";
|
|
4632
4689
|
import { DateFormatter as DateFormatter3, endOfMonth, getLocalTimeZone as getLocalTimeZone2, startOfMonth, today as today2 } from "@internationalized/date";
|
|
4633
4690
|
import { Calendar as CalendarIcon } from "lucide-react";
|
|
4634
|
-
import { jsx as
|
|
4691
|
+
import { jsx as jsx48, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
4635
4692
|
function pickerTexts(m) {
|
|
4636
4693
|
const d = m.datePicker;
|
|
4637
4694
|
return {
|
|
@@ -4660,22 +4717,22 @@ function useValidationMessages(t, minValue, maxValue) {
|
|
|
4660
4717
|
}
|
|
4661
4718
|
function PickerOverlay({ title, sheet, t, children }) {
|
|
4662
4719
|
if (sheet) {
|
|
4663
|
-
return /* @__PURE__ */
|
|
4720
|
+
return /* @__PURE__ */ jsx48(
|
|
4664
4721
|
BottomSheet,
|
|
4665
4722
|
{
|
|
4666
4723
|
title,
|
|
4667
4724
|
className: "medo-date-sheet",
|
|
4668
|
-
footer: (close) => /* @__PURE__ */
|
|
4669
|
-
children: /* @__PURE__ */
|
|
4725
|
+
footer: (close) => /* @__PURE__ */ jsx48(Button, { variant: "primary", size: "lg", onPress: close, children: t.done }),
|
|
4726
|
+
children: /* @__PURE__ */ jsx48("div", { className: "medo-date-panel", children })
|
|
4670
4727
|
}
|
|
4671
4728
|
);
|
|
4672
4729
|
}
|
|
4673
|
-
return /* @__PURE__ */
|
|
4730
|
+
return /* @__PURE__ */ jsx48(AriaPopover2, { placement: "bottom start", offset: 8, containerPadding: 16, className: "medo-popover medo-popover--auto medo-date-popover", children: /* @__PURE__ */ jsx48(AriaDialog5, { "aria-label": title, className: "medo-popover__dialog", children: /* @__PURE__ */ jsx48("div", { className: "medo-popover__body medo-date-panel", children }) }) });
|
|
4674
4731
|
}
|
|
4675
4732
|
function PanelTime({ label, size }) {
|
|
4676
4733
|
const state = useContext18(DatePickerStateContext);
|
|
4677
4734
|
if (!state) return null;
|
|
4678
|
-
return /* @__PURE__ */
|
|
4735
|
+
return /* @__PURE__ */ jsx48("div", { className: "medo-date-panel__time", children: /* @__PURE__ */ jsx48(TimeField, { label, size, value: state.timeValue, onChange: (v) => v && state.setTimeValue(v) }) });
|
|
4679
4736
|
}
|
|
4680
4737
|
var textOf = (label, ariaLabel) => typeof label === "string" ? label : ariaLabel ?? "";
|
|
4681
4738
|
function DatePicker({
|
|
@@ -4702,15 +4759,15 @@ function DatePicker({
|
|
|
4702
4759
|
...props,
|
|
4703
4760
|
className: cx("medo-field", "medo-date-field", "medo-date-picker", hasTime && "medo-date-picker--time", className),
|
|
4704
4761
|
children: [
|
|
4705
|
-
label && /* @__PURE__ */
|
|
4762
|
+
label && /* @__PURE__ */ jsx48(FieldLabel, { isRequired: props.isRequired, children: label }),
|
|
4706
4763
|
/* @__PURE__ */ jsxs45(Group2, { className: cx("medo-input", `medo-input--${size}`, "medo-date-box"), children: [
|
|
4707
|
-
/* @__PURE__ */
|
|
4708
|
-
/* @__PURE__ */
|
|
4764
|
+
/* @__PURE__ */ jsx48(DateInput2, { className: "medo-date-input", children: (segment) => /* @__PURE__ */ jsx48(DateSegment2, { segment, className: "medo-date-segment" }) }),
|
|
4765
|
+
/* @__PURE__ */ jsx48(InputAction, { icon: /* @__PURE__ */ jsx48(CalendarIcon, {}), "aria-label": t.openCalendar })
|
|
4709
4766
|
] }),
|
|
4710
|
-
/* @__PURE__ */
|
|
4767
|
+
/* @__PURE__ */ jsx48(FieldFooter, { description, errorMessage: errorMessage ?? messages }),
|
|
4711
4768
|
/* @__PURE__ */ jsxs45(PickerOverlay, { title: textOf(label, props["aria-label"]), sheet, t, children: [
|
|
4712
|
-
/* @__PURE__ */
|
|
4713
|
-
hasTime && /* @__PURE__ */
|
|
4769
|
+
/* @__PURE__ */ jsx48(Calendar, { size: sheet ? "lg" : "md", showWeekNumbers, texts: t }),
|
|
4770
|
+
hasTime && /* @__PURE__ */ jsx48(PanelTime, { label: t.time, size: sheet ? "lg" : "md" })
|
|
4714
4771
|
] })
|
|
4715
4772
|
]
|
|
4716
4773
|
}
|
|
@@ -4735,7 +4792,7 @@ function Presets({ presets, label, size }) {
|
|
|
4735
4792
|
if (!state) return null;
|
|
4736
4793
|
const same = (a, b) => !!a && !!b && a.compare(b) === 0;
|
|
4737
4794
|
const active = presets.findIndex((p) => same(state.value?.start, p.value.start) && same(state.value?.end, p.value.end));
|
|
4738
|
-
return /* @__PURE__ */
|
|
4795
|
+
return /* @__PURE__ */ jsx48(
|
|
4739
4796
|
ListBox,
|
|
4740
4797
|
{
|
|
4741
4798
|
"aria-label": label,
|
|
@@ -4749,7 +4806,7 @@ function Presets({ presets, label, size }) {
|
|
|
4749
4806
|
state.close();
|
|
4750
4807
|
},
|
|
4751
4808
|
className: "medo-date-panel__presets",
|
|
4752
|
-
children: presets.map((p, i) => /* @__PURE__ */
|
|
4809
|
+
children: presets.map((p, i) => /* @__PURE__ */ jsx48(Option, { id: String(i), children: p.label }, i))
|
|
4753
4810
|
}
|
|
4754
4811
|
);
|
|
4755
4812
|
}
|
|
@@ -4772,17 +4829,17 @@ function DateRangePicker({
|
|
|
4772
4829
|
const messages = useValidationMessages(t, props.minValue, props.maxValue);
|
|
4773
4830
|
const list = presets === true ? defaultDatePresets({}, m) : presets || void 0;
|
|
4774
4831
|
return /* @__PURE__ */ jsxs45(AriaDateRangePicker, { shouldForceLeadingZeros: true, ...props, className: cx("medo-field", "medo-date-field", "medo-date-picker", "medo-date-picker--range", className), children: [
|
|
4775
|
-
label && /* @__PURE__ */
|
|
4832
|
+
label && /* @__PURE__ */ jsx48(FieldLabel, { isRequired: props.isRequired, children: label }),
|
|
4776
4833
|
/* @__PURE__ */ jsxs45(Group2, { className: cx("medo-input", `medo-input--${size}`, "medo-date-box"), children: [
|
|
4777
|
-
/* @__PURE__ */
|
|
4778
|
-
/* @__PURE__ */
|
|
4779
|
-
/* @__PURE__ */
|
|
4780
|
-
/* @__PURE__ */
|
|
4834
|
+
/* @__PURE__ */ jsx48(DateInput2, { slot: "start", className: "medo-date-input", children: (segment) => /* @__PURE__ */ jsx48(DateSegment2, { segment, className: "medo-date-segment" }) }),
|
|
4835
|
+
/* @__PURE__ */ jsx48("span", { className: "medo-date-box__dash", "aria-hidden": "true", children: "\u2013" }),
|
|
4836
|
+
/* @__PURE__ */ jsx48(DateInput2, { slot: "end", className: "medo-date-input", children: (segment) => /* @__PURE__ */ jsx48(DateSegment2, { segment, className: "medo-date-segment" }) }),
|
|
4837
|
+
/* @__PURE__ */ jsx48(InputAction, { icon: /* @__PURE__ */ jsx48(CalendarIcon, {}), "aria-label": t.openCalendar })
|
|
4781
4838
|
] }),
|
|
4782
|
-
/* @__PURE__ */
|
|
4783
|
-
/* @__PURE__ */
|
|
4784
|
-
list && /* @__PURE__ */
|
|
4785
|
-
/* @__PURE__ */
|
|
4839
|
+
/* @__PURE__ */ jsx48(FieldFooter, { description, errorMessage: errorMessage ?? messages }),
|
|
4840
|
+
/* @__PURE__ */ jsx48(PickerOverlay, { title: textOf(label, props["aria-label"]), sheet, t, children: /* @__PURE__ */ jsxs45("div", { className: cx("medo-date-panel__range", !!list && "medo-date-panel__range--presets"), children: [
|
|
4841
|
+
list && /* @__PURE__ */ jsx48(Presets, { presets: list, label: t.presets, size: sheet ? "lg" : "md" }),
|
|
4842
|
+
/* @__PURE__ */ jsx48(RangeCalendar, { size: sheet ? "lg" : "md", visibleMonths: sheet ? 1 : 2, showWeekNumbers, texts: t })
|
|
4786
4843
|
] }) })
|
|
4787
4844
|
] });
|
|
4788
4845
|
}
|
|
@@ -4807,9 +4864,9 @@ import {
|
|
|
4807
4864
|
// src/media/Image.tsx
|
|
4808
4865
|
import { useEffect as useEffect17, useLayoutEffect as useLayoutEffect8, useRef as useRef18, useState as useState20 } from "react";
|
|
4809
4866
|
import { ImageOff, Play } from "lucide-react";
|
|
4810
|
-
import { jsx as
|
|
4867
|
+
import { jsx as jsx49, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4811
4868
|
function MediaPlayButton({ size = "md", className }) {
|
|
4812
|
-
return /* @__PURE__ */
|
|
4869
|
+
return /* @__PURE__ */ jsx49("span", { className: cx("medo-media-play", `medo-media-play--${size}`, className), "aria-hidden": "true", children: /* @__PURE__ */ jsx49(Play, {}) });
|
|
4813
4870
|
}
|
|
4814
4871
|
function Image({
|
|
4815
4872
|
src,
|
|
@@ -4846,9 +4903,9 @@ function Image({
|
|
|
4846
4903
|
"data-state": state,
|
|
4847
4904
|
style: { aspectRatio: aspect, ...style },
|
|
4848
4905
|
children: [
|
|
4849
|
-
state === "loading" && (placeholder ? /* @__PURE__ */
|
|
4850
|
-
state === "error" && /* @__PURE__ */
|
|
4851
|
-
/* @__PURE__ */
|
|
4906
|
+
state === "loading" && (placeholder ? /* @__PURE__ */ jsx49("img", { className: "medo-image__preview", src: placeholder, alt: "", "aria-hidden": "true" }) : /* @__PURE__ */ jsx49(Skeleton, { shape: "rect", className: "medo-image__skeleton" })),
|
|
4907
|
+
state === "error" && /* @__PURE__ */ jsx49("span", { className: "medo-image__error", role: alt ? "img" : void 0, "aria-label": alt || void 0, "aria-hidden": alt ? void 0 : true, children: /* @__PURE__ */ jsx49(ImageOff, { "aria-hidden": "true" }) }),
|
|
4908
|
+
/* @__PURE__ */ jsx49(
|
|
4852
4909
|
"img",
|
|
4853
4910
|
{
|
|
4854
4911
|
...props,
|
|
@@ -4871,11 +4928,11 @@ function Image({
|
|
|
4871
4928
|
}
|
|
4872
4929
|
),
|
|
4873
4930
|
state === "loaded" && overlay && /* @__PURE__ */ jsxs46("div", { className: cx("medo-image__overlay", `medo-image__overlay--${overlay.position ?? "bottom"}`), children: [
|
|
4874
|
-
/* @__PURE__ */
|
|
4875
|
-
overlay.meta && /* @__PURE__ */
|
|
4931
|
+
/* @__PURE__ */ jsx49("span", { className: "medo-image__title", children: overlay.title }),
|
|
4932
|
+
overlay.meta && /* @__PURE__ */ jsx49("span", { className: "medo-image__meta", children: overlay.meta })
|
|
4876
4933
|
] }),
|
|
4877
|
-
state === "loaded" && badge && /* @__PURE__ */
|
|
4878
|
-
state === "loaded" && play && /* @__PURE__ */
|
|
4934
|
+
state === "loaded" && badge && /* @__PURE__ */ jsx49("span", { className: "medo-image__badge", children: badge }),
|
|
4935
|
+
state === "loaded" && play && /* @__PURE__ */ jsx49(MediaPlayButton, { size: play, className: "medo-image__play" })
|
|
4879
4936
|
]
|
|
4880
4937
|
}
|
|
4881
4938
|
);
|
|
@@ -4884,8 +4941,8 @@ function Figure({ children, caption, credit, className }) {
|
|
|
4884
4941
|
return /* @__PURE__ */ jsxs46("figure", { className: cx("medo-figure", className), children: [
|
|
4885
4942
|
children,
|
|
4886
4943
|
(caption || credit) && /* @__PURE__ */ jsxs46("figcaption", { className: "medo-figure__caption", children: [
|
|
4887
|
-
caption && /* @__PURE__ */
|
|
4888
|
-
credit && /* @__PURE__ */
|
|
4944
|
+
caption && /* @__PURE__ */ jsx49("span", { children: caption }),
|
|
4945
|
+
credit && /* @__PURE__ */ jsx49("span", { className: "medo-figure__credit", children: credit })
|
|
4889
4946
|
] })
|
|
4890
4947
|
] });
|
|
4891
4948
|
}
|
|
@@ -4893,7 +4950,7 @@ function Figure({ children, caption, credit, className }) {
|
|
|
4893
4950
|
// src/media/EmbedConsent.tsx
|
|
4894
4951
|
import { useEffect as useEffect18, useLayoutEffect as useLayoutEffect9, useRef as useRef19, useState as useState21 } from "react";
|
|
4895
4952
|
import { Globe as Globe2, MapPin, Play as Play2 } from "lucide-react";
|
|
4896
|
-
import { jsx as
|
|
4953
|
+
import { jsx as jsx50, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
4897
4954
|
function defaultEmbedTexts(type, provider, company, messages = en) {
|
|
4898
4955
|
const to = company ?? provider;
|
|
4899
4956
|
const e = messages.embed[type];
|
|
@@ -4906,7 +4963,7 @@ function defaultEmbedTexts(type, provider, company, messages = en) {
|
|
|
4906
4963
|
privacy: messages.embed.privacy
|
|
4907
4964
|
};
|
|
4908
4965
|
}
|
|
4909
|
-
var icons2 = { video: /* @__PURE__ */
|
|
4966
|
+
var icons2 = { video: /* @__PURE__ */ jsx50(Play2, {}), map: /* @__PURE__ */ jsx50(MapPin, {}), generic: /* @__PURE__ */ jsx50(Globe2, {}) };
|
|
4910
4967
|
function EmbedConsent({
|
|
4911
4968
|
type = "generic",
|
|
4912
4969
|
provider,
|
|
@@ -4941,7 +4998,7 @@ function EmbedConsent({
|
|
|
4941
4998
|
}, [clicked]);
|
|
4942
4999
|
const style = { aspectRatio: ratio.replace(":", " / ") };
|
|
4943
5000
|
if (loaded) {
|
|
4944
|
-
return /* @__PURE__ */
|
|
5001
|
+
return /* @__PURE__ */ jsx50("div", { className: cx("medo-embed", "medo-embed--loaded", className), style, children: /* @__PURE__ */ jsx50(
|
|
4945
5002
|
"iframe",
|
|
4946
5003
|
{
|
|
4947
5004
|
ref: frame,
|
|
@@ -4956,13 +5013,13 @@ function EmbedConsent({
|
|
|
4956
5013
|
) });
|
|
4957
5014
|
}
|
|
4958
5015
|
return /* @__PURE__ */ jsxs47("div", { ref, role: "region", "aria-label": title, className: cx("medo-embed", compact && "medo-embed--compact", className), style, children: [
|
|
4959
|
-
!compact && /* @__PURE__ */
|
|
5016
|
+
!compact && /* @__PURE__ */ jsx50(IconTile, { size: "sm", tone: "raised", children: icons2[type] }),
|
|
4960
5017
|
/* @__PURE__ */ jsxs47("div", { className: "medo-embed__content", children: [
|
|
4961
|
-
/* @__PURE__ */
|
|
4962
|
-
/* @__PURE__ */
|
|
5018
|
+
/* @__PURE__ */ jsx50("p", { className: "medo-embed__title", children: t.title }),
|
|
5019
|
+
/* @__PURE__ */ jsx50("p", { className: "medo-embed__body", children: compact ? t.bodyCompact : t.body })
|
|
4963
5020
|
] }),
|
|
4964
5021
|
/* @__PURE__ */ jsxs47("div", { className: "medo-embed__actions", children: [
|
|
4965
|
-
/* @__PURE__ */
|
|
5022
|
+
/* @__PURE__ */ jsx50(
|
|
4966
5023
|
Button,
|
|
4967
5024
|
{
|
|
4968
5025
|
size: compact ? "sm" : "md",
|
|
@@ -4973,9 +5030,9 @@ function EmbedConsent({
|
|
|
4973
5030
|
children: t.load
|
|
4974
5031
|
}
|
|
4975
5032
|
),
|
|
4976
|
-
/* @__PURE__ */
|
|
5033
|
+
/* @__PURE__ */ jsx50(Link, { variant: "standalone", size: compact ? "sm" : "md", href: privacyHref, children: t.privacy })
|
|
4977
5034
|
] }),
|
|
4978
|
-
!compact && /* @__PURE__ */
|
|
5035
|
+
!compact && /* @__PURE__ */ jsx50(Checkbox, { isSelected: remember, onChange: setRemember, children: t.remember })
|
|
4979
5036
|
] });
|
|
4980
5037
|
}
|
|
4981
5038
|
export {
|
|
@@ -5005,6 +5062,7 @@ export {
|
|
|
5005
5062
|
Column,
|
|
5006
5063
|
ColumnsMenu,
|
|
5007
5064
|
Combobox,
|
|
5065
|
+
Container,
|
|
5008
5066
|
DateField,
|
|
5009
5067
|
DatePicker,
|
|
5010
5068
|
DateRangePicker,
|
|
@@ -5022,6 +5080,8 @@ export {
|
|
|
5022
5080
|
FileItem,
|
|
5023
5081
|
FileTile,
|
|
5024
5082
|
FileTrigger,
|
|
5083
|
+
Grid,
|
|
5084
|
+
GridItem,
|
|
5025
5085
|
Highlight,
|
|
5026
5086
|
IconButton,
|
|
5027
5087
|
Image,
|
|
@@ -5068,6 +5128,7 @@ export {
|
|
|
5068
5128
|
Slider,
|
|
5069
5129
|
SliderField,
|
|
5070
5130
|
Spinner,
|
|
5131
|
+
Stack,
|
|
5071
5132
|
StaticTable,
|
|
5072
5133
|
Submenu,
|
|
5073
5134
|
Switch,
|