marclayui 0.3.0 → 0.3.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.cjs +161 -202
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -16
- package/dist/index.d.ts +1 -16
- package/dist/index.js +115 -155
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -3
- package/src/styles/index.css +0 -1
- package/src/components/select/select.css +0 -58
- package/src/components/select/select.tsx +0 -72
package/dist/index.cjs
CHANGED
|
@@ -57,7 +57,6 @@ __export(index_exports, {
|
|
|
57
57
|
Progress: () => Progress,
|
|
58
58
|
Radio: () => Radio,
|
|
59
59
|
Range: () => Range,
|
|
60
|
-
Select: () => Select,
|
|
61
60
|
Skeleton: () => Skeleton,
|
|
62
61
|
Spinner: () => Spinner,
|
|
63
62
|
Stack: () => Stack,
|
|
@@ -587,64 +586,25 @@ function Textarea({ label, hint, error, size = "md", block = true, className = "
|
|
|
587
586
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Chrome, { id: inputId, label, hint, error, block: true, children: el });
|
|
588
587
|
}
|
|
589
588
|
|
|
590
|
-
// src/components/select/select.tsx
|
|
591
|
-
var import_react5 = __toESM(require("react"));
|
|
592
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
593
|
-
function Select({
|
|
594
|
-
label,
|
|
595
|
-
hint,
|
|
596
|
-
error,
|
|
597
|
-
size = "md",
|
|
598
|
-
options,
|
|
599
|
-
placeholder,
|
|
600
|
-
className = "",
|
|
601
|
-
id,
|
|
602
|
-
children,
|
|
603
|
-
...rest
|
|
604
|
-
}) {
|
|
605
|
-
const autoId = import_react5.default.useId();
|
|
606
|
-
const selectId = id ?? autoId;
|
|
607
|
-
const select = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: `mcl-select-shell ${className}`.trim(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
608
|
-
"select",
|
|
609
|
-
{
|
|
610
|
-
id: selectId,
|
|
611
|
-
className: `mcl-select mcl-select-${size}${error ? " mcl-select-invalid" : ""}`,
|
|
612
|
-
"aria-invalid": error ? true : void 0,
|
|
613
|
-
...rest,
|
|
614
|
-
children: [
|
|
615
|
-
placeholder && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", disabled: true, children: placeholder }),
|
|
616
|
-
options?.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: o.value, children: o.label }, o.value)),
|
|
617
|
-
children
|
|
618
|
-
]
|
|
619
|
-
}
|
|
620
|
-
) });
|
|
621
|
-
if (!label && !hint && !error) return select;
|
|
622
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "mcl-field", children: [
|
|
623
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "mcl-label", htmlFor: selectId, children: label }),
|
|
624
|
-
select,
|
|
625
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "mcl-hint mcl-hint-error", role: "alert", children: error }) : hint ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "mcl-hint", children: hint }) : null
|
|
626
|
-
] });
|
|
627
|
-
}
|
|
628
|
-
|
|
629
589
|
// src/components/checks/checks.tsx
|
|
630
|
-
var
|
|
631
|
-
var
|
|
590
|
+
var import_react5 = require("react");
|
|
591
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
632
592
|
function withLabel(input, label) {
|
|
633
593
|
if (label === void 0 || label === null) return input;
|
|
634
|
-
return /* @__PURE__ */ (0,
|
|
594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "mcl-check", children: [
|
|
635
595
|
input,
|
|
636
|
-
/* @__PURE__ */ (0,
|
|
596
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "mcl-check-label", children: label })
|
|
637
597
|
] });
|
|
638
598
|
}
|
|
639
599
|
function Checkbox({ label, indeterminate = false, className = "", ...rest }) {
|
|
640
|
-
const inputRef = (0,
|
|
641
|
-
(0,
|
|
600
|
+
const inputRef = (0, import_react5.useRef)(null);
|
|
601
|
+
(0, import_react5.useEffect)(() => {
|
|
642
602
|
if (inputRef.current) inputRef.current.indeterminate = indeterminate;
|
|
643
603
|
}, [indeterminate]);
|
|
644
604
|
return withLabel(
|
|
645
|
-
/* @__PURE__ */ (0,
|
|
646
|
-
/* @__PURE__ */ (0,
|
|
647
|
-
/* @__PURE__ */ (0,
|
|
605
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
606
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { ref: inputRef, type: "checkbox", className: `mcl-check-input ${className}`.trim(), ...rest }),
|
|
607
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "mcl-check-box", "aria-hidden": "true" })
|
|
648
608
|
] }),
|
|
649
609
|
label
|
|
650
610
|
);
|
|
@@ -660,13 +620,13 @@ function CheckboxGroup({
|
|
|
660
620
|
disabled = false,
|
|
661
621
|
className = ""
|
|
662
622
|
}) {
|
|
663
|
-
const [inner, setInner] = (0,
|
|
664
|
-
const allRef = (0,
|
|
623
|
+
const [inner, setInner] = (0, import_react5.useState)(defaultValue);
|
|
624
|
+
const allRef = (0, import_react5.useRef)(null);
|
|
665
625
|
const selected = value ?? inner;
|
|
666
626
|
const enabled = options.filter((o) => !o.disabled).map((o) => o.value);
|
|
667
627
|
const allOn = enabled.length > 0 && enabled.every((v) => selected.includes(v));
|
|
668
628
|
const someOn = enabled.some((v) => selected.includes(v));
|
|
669
|
-
(0,
|
|
629
|
+
(0, import_react5.useEffect)(() => {
|
|
670
630
|
if (allRef.current) allRef.current.indeterminate = someOn && !allOn;
|
|
671
631
|
}, [someOn, allOn]);
|
|
672
632
|
const commit = (next) => {
|
|
@@ -679,16 +639,16 @@ function CheckboxGroup({
|
|
|
679
639
|
const toggleAll = () => {
|
|
680
640
|
commit(allOn ? selected.filter((v) => !enabled.includes(v)) : Array.from(/* @__PURE__ */ new Set([...selected, ...enabled])));
|
|
681
641
|
};
|
|
682
|
-
return /* @__PURE__ */ (0,
|
|
642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
683
643
|
"div",
|
|
684
644
|
{
|
|
685
645
|
className: `mcl-check-group ${className}`.trim(),
|
|
686
646
|
role: "group",
|
|
687
647
|
"aria-label": typeof label === "string" ? label : void 0,
|
|
688
648
|
children: [
|
|
689
|
-
label && /* @__PURE__ */ (0,
|
|
690
|
-
selectAll && /* @__PURE__ */ (0,
|
|
691
|
-
/* @__PURE__ */ (0,
|
|
649
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "mcl-label", children: label }),
|
|
650
|
+
selectAll && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: `mcl-check mcl-check-group-all${disabled ? " mcl-check-disabled" : ""}`, children: [
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
692
652
|
"input",
|
|
693
653
|
{
|
|
694
654
|
ref: allRef,
|
|
@@ -699,11 +659,11 @@ function CheckboxGroup({
|
|
|
699
659
|
onChange: toggleAll
|
|
700
660
|
}
|
|
701
661
|
),
|
|
702
|
-
/* @__PURE__ */ (0,
|
|
703
|
-
/* @__PURE__ */ (0,
|
|
662
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "mcl-check-box", "aria-hidden": "true" }),
|
|
663
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "mcl-check-label", children: selectAllLabel })
|
|
704
664
|
] }),
|
|
705
|
-
/* @__PURE__ */ (0,
|
|
706
|
-
/* @__PURE__ */ (0,
|
|
665
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "mcl-check-group-items", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: `mcl-check${o.disabled || disabled ? " mcl-check-disabled" : ""}`, children: [
|
|
666
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
707
667
|
"input",
|
|
708
668
|
{
|
|
709
669
|
type: "checkbox",
|
|
@@ -713,8 +673,8 @@ function CheckboxGroup({
|
|
|
713
673
|
onChange: () => toggle(o.value)
|
|
714
674
|
}
|
|
715
675
|
),
|
|
716
|
-
/* @__PURE__ */ (0,
|
|
717
|
-
/* @__PURE__ */ (0,
|
|
676
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "mcl-check-box", "aria-hidden": "true" }),
|
|
677
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "mcl-check-label", children: o.label })
|
|
718
678
|
] }, o.value)) })
|
|
719
679
|
]
|
|
720
680
|
}
|
|
@@ -722,17 +682,17 @@ function CheckboxGroup({
|
|
|
722
682
|
}
|
|
723
683
|
function Radio({ label, className = "", ...rest }) {
|
|
724
684
|
return withLabel(
|
|
725
|
-
/* @__PURE__ */ (0,
|
|
726
|
-
/* @__PURE__ */ (0,
|
|
727
|
-
/* @__PURE__ */ (0,
|
|
685
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
686
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "radio", className: `mcl-check-input ${className}`.trim(), ...rest }),
|
|
687
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "mcl-check-box mcl-radio-box", "aria-hidden": "true" })
|
|
728
688
|
] }),
|
|
729
689
|
label
|
|
730
690
|
);
|
|
731
691
|
}
|
|
732
692
|
function Switch({ label, className = "", ...rest }) {
|
|
733
693
|
return withLabel(
|
|
734
|
-
/* @__PURE__ */ (0,
|
|
735
|
-
/* @__PURE__ */ (0,
|
|
694
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
695
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
736
696
|
"input",
|
|
737
697
|
{
|
|
738
698
|
type: "checkbox",
|
|
@@ -741,15 +701,15 @@ function Switch({ label, className = "", ...rest }) {
|
|
|
741
701
|
...rest
|
|
742
702
|
}
|
|
743
703
|
),
|
|
744
|
-
/* @__PURE__ */ (0,
|
|
704
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "mcl-switch-track", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "mcl-switch-knob" }) })
|
|
745
705
|
] }),
|
|
746
706
|
label
|
|
747
707
|
);
|
|
748
708
|
}
|
|
749
709
|
|
|
750
710
|
// src/components/dropdown/dropdown.tsx
|
|
751
|
-
var
|
|
752
|
-
var
|
|
711
|
+
var import_react6 = require("react");
|
|
712
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
753
713
|
function Dropdown({
|
|
754
714
|
items,
|
|
755
715
|
value,
|
|
@@ -764,13 +724,13 @@ function Dropdown({
|
|
|
764
724
|
disabled = false,
|
|
765
725
|
className = ""
|
|
766
726
|
}) {
|
|
767
|
-
const [open, setOpen] = (0,
|
|
768
|
-
const [inner, setInner] = (0,
|
|
769
|
-
const [active, setActive] = (0,
|
|
770
|
-
const [flip, setFlip] = (0,
|
|
771
|
-
const shellRef = (0,
|
|
772
|
-
const menuRef = (0,
|
|
773
|
-
const triggerRef = (0,
|
|
727
|
+
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
728
|
+
const [inner, setInner] = (0, import_react6.useState)(defaultValue);
|
|
729
|
+
const [active, setActive] = (0, import_react6.useState)(0);
|
|
730
|
+
const [flip, setFlip] = (0, import_react6.useState)({ up: false, left: false });
|
|
731
|
+
const shellRef = (0, import_react6.useRef)(null);
|
|
732
|
+
const menuRef = (0, import_react6.useRef)(null);
|
|
733
|
+
const triggerRef = (0, import_react6.useRef)(null);
|
|
774
734
|
const current = value ?? inner;
|
|
775
735
|
const selectedValues = multiple ? Array.isArray(current) ? current : [] : [];
|
|
776
736
|
const singleValue = !multiple && !Array.isArray(current) ? current : void 0;
|
|
@@ -785,7 +745,7 @@ function Dropdown({
|
|
|
785
745
|
triggerText = labelFor(singleValue) ?? singleValue;
|
|
786
746
|
}
|
|
787
747
|
const hasSelection = multiple ? selectedValues.length > 0 : singleValue !== void 0 && singleValue !== "";
|
|
788
|
-
(0,
|
|
748
|
+
(0, import_react6.useEffect)(() => {
|
|
789
749
|
if (!open) return;
|
|
790
750
|
const onDown = (e) => {
|
|
791
751
|
if (shellRef.current && !shellRef.current.contains(e.target)) {
|
|
@@ -796,7 +756,7 @@ function Dropdown({
|
|
|
796
756
|
document.addEventListener("mousedown", onDown);
|
|
797
757
|
return () => document.removeEventListener("mousedown", onDown);
|
|
798
758
|
}, [open]);
|
|
799
|
-
(0,
|
|
759
|
+
(0, import_react6.useEffect)(() => {
|
|
800
760
|
if (!open) return;
|
|
801
761
|
const firstSelected = multiple ? items.findIndex((i) => selectedValues.includes(i.value)) : items.findIndex((i) => i.value === singleValue);
|
|
802
762
|
const firstEnabled = items.findIndex((i) => !i.disabled);
|
|
@@ -809,7 +769,7 @@ function Dropdown({
|
|
|
809
769
|
}, 0);
|
|
810
770
|
return () => window.clearTimeout(t);
|
|
811
771
|
}, [open]);
|
|
812
|
-
(0,
|
|
772
|
+
(0, import_react6.useEffect)(() => {
|
|
813
773
|
if (!open) return;
|
|
814
774
|
const t = window.setTimeout(() => {
|
|
815
775
|
const trig = triggerRef.current;
|
|
@@ -882,15 +842,15 @@ function Dropdown({
|
|
|
882
842
|
setOpen(true);
|
|
883
843
|
}
|
|
884
844
|
};
|
|
885
|
-
return /* @__PURE__ */ (0,
|
|
886
|
-
label && /* @__PURE__ */ (0,
|
|
887
|
-
/* @__PURE__ */ (0,
|
|
845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `mcl-field${block ? " mcl-field-block" : ""} ${className}`.trim(), children: [
|
|
846
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "mcl-label", children: label }),
|
|
847
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
888
848
|
"div",
|
|
889
849
|
{
|
|
890
850
|
ref: shellRef,
|
|
891
851
|
className: `mcl-dropdown-shell${block ? " mcl-dropdown-block" : ""}`,
|
|
892
852
|
children: [
|
|
893
|
-
/* @__PURE__ */ (0,
|
|
853
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
894
854
|
"button",
|
|
895
855
|
{
|
|
896
856
|
ref: triggerRef,
|
|
@@ -902,12 +862,12 @@ function Dropdown({
|
|
|
902
862
|
onClick: () => setOpen((o) => !o),
|
|
903
863
|
onKeyDown: onTriggerKeyDown,
|
|
904
864
|
children: [
|
|
905
|
-
/* @__PURE__ */ (0,
|
|
906
|
-
/* @__PURE__ */ (0,
|
|
865
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: `mcl-dropdown-value${hasSelection ? "" : " mcl-dropdown-placeholder"}`, children: triggerText }),
|
|
866
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "mcl-dropdown-chevron", "aria-hidden": "true" })
|
|
907
867
|
]
|
|
908
868
|
}
|
|
909
869
|
),
|
|
910
|
-
open && /* @__PURE__ */ (0,
|
|
870
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
911
871
|
"div",
|
|
912
872
|
{
|
|
913
873
|
ref: menuRef,
|
|
@@ -924,7 +884,7 @@ function Dropdown({
|
|
|
924
884
|
onKeyDown: onMenuKeyDown,
|
|
925
885
|
children: items.map((it, i) => {
|
|
926
886
|
const selected = multiple ? selectedValues.includes(it.value) : singleValue === it.value;
|
|
927
|
-
return /* @__PURE__ */ (0,
|
|
887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
928
888
|
"div",
|
|
929
889
|
{
|
|
930
890
|
role: "option",
|
|
@@ -941,9 +901,9 @@ function Dropdown({
|
|
|
941
901
|
if (!it.disabled) commit(it.value);
|
|
942
902
|
},
|
|
943
903
|
children: [
|
|
944
|
-
multiple && /* @__PURE__ */ (0,
|
|
945
|
-
/* @__PURE__ */ (0,
|
|
946
|
-
!multiple && selected && /* @__PURE__ */ (0,
|
|
904
|
+
multiple && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "mcl-dropdown-check", "aria-hidden": "true" }),
|
|
905
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "mcl-dropdown-item-label", children: it.label }),
|
|
906
|
+
!multiple && selected && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "mcl-dropdown-tick", "aria-hidden": "true", children: "\u2713" })
|
|
947
907
|
]
|
|
948
908
|
},
|
|
949
909
|
it.value
|
|
@@ -954,13 +914,13 @@ function Dropdown({
|
|
|
954
914
|
]
|
|
955
915
|
}
|
|
956
916
|
),
|
|
957
|
-
hint && /* @__PURE__ */ (0,
|
|
917
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mcl-hint", children: hint })
|
|
958
918
|
] });
|
|
959
919
|
}
|
|
960
920
|
|
|
961
921
|
// src/components/range/range.tsx
|
|
962
|
-
var
|
|
963
|
-
var
|
|
922
|
+
var import_react7 = __toESM(require("react"));
|
|
923
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
964
924
|
function Range({
|
|
965
925
|
label,
|
|
966
926
|
hint,
|
|
@@ -972,14 +932,14 @@ function Range({
|
|
|
972
932
|
id,
|
|
973
933
|
...rest
|
|
974
934
|
}) {
|
|
975
|
-
const autoId =
|
|
935
|
+
const autoId = import_react7.default.useId();
|
|
976
936
|
const inputId = id ?? autoId;
|
|
977
937
|
const isControlled = value !== void 0;
|
|
978
|
-
const [inner, setInner] = (0,
|
|
938
|
+
const [inner, setInner] = (0, import_react7.useState)(
|
|
979
939
|
() => value !== void 0 ? String(value) : defaultValue !== void 0 ? String(defaultValue) : "0"
|
|
980
940
|
);
|
|
981
941
|
const current = isControlled ? String(value) : inner;
|
|
982
|
-
const input = /* @__PURE__ */ (0,
|
|
942
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
983
943
|
"input",
|
|
984
944
|
{
|
|
985
945
|
id: inputId,
|
|
@@ -993,22 +953,22 @@ function Range({
|
|
|
993
953
|
...rest
|
|
994
954
|
}
|
|
995
955
|
);
|
|
996
|
-
const field = /* @__PURE__ */ (0,
|
|
997
|
-
label && /* @__PURE__ */ (0,
|
|
998
|
-
/* @__PURE__ */ (0,
|
|
999
|
-
showValue && /* @__PURE__ */ (0,
|
|
956
|
+
const field = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mcl-field", children: [
|
|
957
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "mcl-range-head", htmlFor: inputId, children: [
|
|
958
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "mcl-label", children: label }),
|
|
959
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "mcl-range-value", children: current })
|
|
1000
960
|
] }),
|
|
1001
961
|
input,
|
|
1002
|
-
hint && /* @__PURE__ */ (0,
|
|
962
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mcl-hint", children: hint })
|
|
1003
963
|
] });
|
|
1004
964
|
if (!label && !hint) return input;
|
|
1005
965
|
return field;
|
|
1006
966
|
}
|
|
1007
967
|
|
|
1008
968
|
// src/components/badge/badge.tsx
|
|
1009
|
-
var
|
|
969
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1010
970
|
function Badge({ variant = "neutral", solid = false, className = "", ...rest }) {
|
|
1011
|
-
return /* @__PURE__ */ (0,
|
|
971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1012
972
|
"span",
|
|
1013
973
|
{
|
|
1014
974
|
className: `mcl-badge mcl-badge-${variant}${solid ? " mcl-badge-solid" : ""} ${className}`.trim(),
|
|
@@ -1018,7 +978,7 @@ function Badge({ variant = "neutral", solid = false, className = "", ...rest })
|
|
|
1018
978
|
}
|
|
1019
979
|
|
|
1020
980
|
// src/components/alert/alert.tsx
|
|
1021
|
-
var
|
|
981
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1022
982
|
var DEFAULT_ICONS = {
|
|
1023
983
|
success: "\u2713",
|
|
1024
984
|
danger: "\u2715",
|
|
@@ -1034,18 +994,18 @@ function Alert({
|
|
|
1034
994
|
children,
|
|
1035
995
|
...rest
|
|
1036
996
|
}) {
|
|
1037
|
-
return /* @__PURE__ */ (0,
|
|
1038
|
-
/* @__PURE__ */ (0,
|
|
1039
|
-
/* @__PURE__ */ (0,
|
|
1040
|
-
title && /* @__PURE__ */ (0,
|
|
997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `mcl-alert mcl-alert-${variant} ${className}`.trim(), role: "alert", ...rest, children: [
|
|
998
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "mcl-alert-icon", "aria-hidden": "true", children: icon ?? DEFAULT_ICONS[variant] }),
|
|
999
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mcl-alert-content", children: [
|
|
1000
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mcl-alert-title", children: title }),
|
|
1041
1001
|
children
|
|
1042
1002
|
] }),
|
|
1043
|
-
onClose && /* @__PURE__ */ (0,
|
|
1003
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "mcl-alert-close", onClick: onClose, "aria-label": "Dismiss", children: "\u2715" })
|
|
1044
1004
|
] });
|
|
1045
1005
|
}
|
|
1046
1006
|
|
|
1047
1007
|
// src/components/avatar/avatar.tsx
|
|
1048
|
-
var
|
|
1008
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1049
1009
|
function initialsOf(name) {
|
|
1050
1010
|
const parts = name.trim().split(/\s+/).slice(0, 2);
|
|
1051
1011
|
return parts.map((p) => p[0]?.toUpperCase() ?? "").join("");
|
|
@@ -1062,7 +1022,7 @@ function Avatar({
|
|
|
1062
1022
|
...rest
|
|
1063
1023
|
}) {
|
|
1064
1024
|
const label = alt ?? (name ? `${name}'s avatar` : "avatar");
|
|
1065
|
-
return /* @__PURE__ */ (0,
|
|
1025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1066
1026
|
"span",
|
|
1067
1027
|
{
|
|
1068
1028
|
className: `mcl-avatar mcl-avatar-${size}${gradient ? " mcl-avatar-gradient" : ""} ${className}`.trim(),
|
|
@@ -1070,18 +1030,18 @@ function Avatar({
|
|
|
1070
1030
|
"aria-label": label,
|
|
1071
1031
|
...rest,
|
|
1072
1032
|
children: [
|
|
1073
|
-
src ? /* @__PURE__ */ (0,
|
|
1074
|
-
status && /* @__PURE__ */ (0,
|
|
1033
|
+
src ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { src, alt: "", className: "mcl-avatar-img", loading: "lazy", decoding: "async" }) : children ?? initialsOf(name ?? "??") ?? "",
|
|
1034
|
+
status && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: `mcl-avatar-status mcl-avatar-status-${status}`, "aria-hidden": "true" })
|
|
1075
1035
|
]
|
|
1076
1036
|
}
|
|
1077
1037
|
);
|
|
1078
1038
|
}
|
|
1079
1039
|
function AvatarGroup({ className = "", children, ...rest }) {
|
|
1080
|
-
return /* @__PURE__ */ (0,
|
|
1040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: `mcl-avatar-group ${className}`.trim(), ...rest, children });
|
|
1081
1041
|
}
|
|
1082
1042
|
|
|
1083
1043
|
// src/components/progress/progress.tsx
|
|
1084
|
-
var
|
|
1044
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1085
1045
|
function Progress({
|
|
1086
1046
|
value = 0,
|
|
1087
1047
|
max = 100,
|
|
@@ -1093,7 +1053,7 @@ function Progress({
|
|
|
1093
1053
|
className = ""
|
|
1094
1054
|
}) {
|
|
1095
1055
|
const pct = Math.max(0, Math.min(100, value / max * 100));
|
|
1096
|
-
return /* @__PURE__ */ (0,
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1097
1057
|
"div",
|
|
1098
1058
|
{
|
|
1099
1059
|
className: `mcl-progress mcl-progress-${size} ${className}`.trim(),
|
|
@@ -1102,11 +1062,11 @@ function Progress({
|
|
|
1102
1062
|
"aria-valuemax": max,
|
|
1103
1063
|
"aria-valuenow": indeterminate ? void 0 : Math.round(pct),
|
|
1104
1064
|
children: [
|
|
1105
|
-
(label || showValue) && /* @__PURE__ */ (0,
|
|
1106
|
-
label && /* @__PURE__ */ (0,
|
|
1107
|
-
showValue && /* @__PURE__ */ (0,
|
|
1065
|
+
(label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "mcl-progress-head", children: [
|
|
1066
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: label }),
|
|
1067
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "mcl-progress-value", children: indeterminate ? "\u2026" : `${Math.round(pct)}%` })
|
|
1108
1068
|
] }),
|
|
1109
|
-
/* @__PURE__ */ (0,
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "mcl-progress-track", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1110
1070
|
"span",
|
|
1111
1071
|
{
|
|
1112
1072
|
className: `mcl-progress-fill mcl-progress-fill-${tone}${indeterminate ? " mcl-progress-fill-indeterminate" : ""}`,
|
|
@@ -1119,13 +1079,13 @@ function Progress({
|
|
|
1119
1079
|
}
|
|
1120
1080
|
|
|
1121
1081
|
// src/components/spinner/spinner.tsx
|
|
1122
|
-
var
|
|
1082
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1123
1083
|
function Spinner({ size = "md", className = "" }) {
|
|
1124
|
-
return /* @__PURE__ */ (0,
|
|
1084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: `mcl-spinner mcl-spinner-${size} ${className}`.trim(), role: "status", "aria-label": "Loading" });
|
|
1125
1085
|
}
|
|
1126
1086
|
|
|
1127
1087
|
// src/components/skeleton/skeleton.tsx
|
|
1128
|
-
var
|
|
1088
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1129
1089
|
function Skeleton({ variant = "text", width, height, count = 1, className = "" }) {
|
|
1130
1090
|
const lines = variant === "text" ? Math.max(1, count) : 1;
|
|
1131
1091
|
const style = (last) => ({
|
|
@@ -1134,7 +1094,7 @@ function Skeleton({ variant = "text", width, height, count = 1, className = "" }
|
|
|
1134
1094
|
...variant === "text" && count > 1 && last ? { width: "62%" } : null
|
|
1135
1095
|
});
|
|
1136
1096
|
if (lines === 1) {
|
|
1137
|
-
return /* @__PURE__ */ (0,
|
|
1097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1138
1098
|
"span",
|
|
1139
1099
|
{
|
|
1140
1100
|
className: `mcl-skeleton mcl-skeleton-${variant} ${className}`.trim(),
|
|
@@ -1143,13 +1103,13 @@ function Skeleton({ variant = "text", width, height, count = 1, className = "" }
|
|
|
1143
1103
|
}
|
|
1144
1104
|
);
|
|
1145
1105
|
}
|
|
1146
|
-
return /* @__PURE__ */ (0,
|
|
1106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: `mcl-skeleton-lines ${className}`.trim(), "aria-hidden": "true", children: Array.from({ length: lines }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "mcl-skeleton mcl-skeleton-text", style: style(i === lines - 1) }, i)) });
|
|
1147
1107
|
}
|
|
1148
1108
|
|
|
1149
1109
|
// src/components/modal/modal.tsx
|
|
1150
|
-
var
|
|
1110
|
+
var import_react8 = require("react");
|
|
1151
1111
|
var import_react_dom = require("react-dom");
|
|
1152
|
-
var
|
|
1112
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1153
1113
|
var FOCUSABLE = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
1154
1114
|
function Modal({
|
|
1155
1115
|
open,
|
|
@@ -1162,12 +1122,12 @@ function Modal({
|
|
|
1162
1122
|
children,
|
|
1163
1123
|
className = ""
|
|
1164
1124
|
}) {
|
|
1165
|
-
const [mounted, setMounted] = (0,
|
|
1166
|
-
const panelRef = (0,
|
|
1167
|
-
const lastFocusedRef = (0,
|
|
1168
|
-
const titleId = (0,
|
|
1169
|
-
(0,
|
|
1170
|
-
(0,
|
|
1125
|
+
const [mounted, setMounted] = (0, import_react8.useState)(false);
|
|
1126
|
+
const panelRef = (0, import_react8.useRef)(null);
|
|
1127
|
+
const lastFocusedRef = (0, import_react8.useRef)(null);
|
|
1128
|
+
const titleId = (0, import_react8.useId)();
|
|
1129
|
+
(0, import_react8.useEffect)(() => setMounted(true), []);
|
|
1130
|
+
(0, import_react8.useEffect)(() => {
|
|
1171
1131
|
if (!open) return;
|
|
1172
1132
|
lastFocusedRef.current = document.activeElement;
|
|
1173
1133
|
const onKey = (e) => {
|
|
@@ -1205,14 +1165,14 @@ function Modal({
|
|
|
1205
1165
|
};
|
|
1206
1166
|
if (!open || !mounted) return null;
|
|
1207
1167
|
return (0, import_react_dom.createPortal)(
|
|
1208
|
-
/* @__PURE__ */ (0,
|
|
1168
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1209
1169
|
"div",
|
|
1210
1170
|
{
|
|
1211
1171
|
className: "mcl-modal-overlay",
|
|
1212
1172
|
onMouseDown: (e) => {
|
|
1213
1173
|
if (e.target === e.currentTarget && closeOnBackdrop) onClose();
|
|
1214
1174
|
},
|
|
1215
|
-
children: /* @__PURE__ */ (0,
|
|
1175
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1216
1176
|
"div",
|
|
1217
1177
|
{
|
|
1218
1178
|
ref: panelRef,
|
|
@@ -1223,12 +1183,12 @@ function Modal({
|
|
|
1223
1183
|
tabIndex: -1,
|
|
1224
1184
|
onKeyDown: trapFocus,
|
|
1225
1185
|
children: [
|
|
1226
|
-
/* @__PURE__ */ (0,
|
|
1227
|
-
title ? /* @__PURE__ */ (0,
|
|
1228
|
-
/* @__PURE__ */ (0,
|
|
1186
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "mcl-modal-header", children: [
|
|
1187
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h3", { id: titleId, className: "mcl-modal-title", children: title }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", {}),
|
|
1188
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "mcl-modal-close", onClick: onClose, "aria-label": "Close dialog", children: "\u2715" })
|
|
1229
1189
|
] }),
|
|
1230
|
-
/* @__PURE__ */ (0,
|
|
1231
|
-
footer && /* @__PURE__ */ (0,
|
|
1190
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "mcl-modal-body mcl-scroll", children }),
|
|
1191
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "mcl-modal-footer", children: footer })
|
|
1232
1192
|
]
|
|
1233
1193
|
}
|
|
1234
1194
|
)
|
|
@@ -1239,19 +1199,19 @@ function Modal({
|
|
|
1239
1199
|
}
|
|
1240
1200
|
|
|
1241
1201
|
// src/components/tooltip/tooltip.tsx
|
|
1242
|
-
var
|
|
1202
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1243
1203
|
function Tooltip({ label, placement = "top", className = "", children }) {
|
|
1244
|
-
return /* @__PURE__ */ (0,
|
|
1204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: `mcl-tooltip mcl-tooltip-${placement} ${className}`.trim(), "data-mcl-tooltip": label, children });
|
|
1245
1205
|
}
|
|
1246
1206
|
|
|
1247
1207
|
// src/components/tabs/tabs.tsx
|
|
1248
|
-
var
|
|
1249
|
-
var
|
|
1208
|
+
var import_react9 = require("react");
|
|
1209
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1250
1210
|
function Tabs({ items, value, onChange, className = "" }) {
|
|
1251
|
-
const uid = (0,
|
|
1252
|
-
const [inner, setInner] = (0,
|
|
1211
|
+
const uid = (0, import_react9.useId)();
|
|
1212
|
+
const [inner, setInner] = (0, import_react9.useState)(0);
|
|
1253
1213
|
const active = value ?? inner;
|
|
1254
|
-
const tabRefs = (0,
|
|
1214
|
+
const tabRefs = (0, import_react9.useRef)([]);
|
|
1255
1215
|
const select = (i) => {
|
|
1256
1216
|
if (items[i]?.disabled) return;
|
|
1257
1217
|
setInner(i);
|
|
@@ -1271,8 +1231,8 @@ function Tabs({ items, value, onChange, className = "" }) {
|
|
|
1271
1231
|
}
|
|
1272
1232
|
};
|
|
1273
1233
|
const current = items[active];
|
|
1274
|
-
return /* @__PURE__ */ (0,
|
|
1275
|
-
/* @__PURE__ */ (0,
|
|
1234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `mcl-tabs ${className}`.trim(), children: [
|
|
1235
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "mcl-tablist", role: "tablist", "aria-label": "Tabs", onKeyDown, children: items.map((it, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1276
1236
|
"button",
|
|
1277
1237
|
{
|
|
1278
1238
|
ref: (el) => {
|
|
@@ -1291,7 +1251,7 @@ function Tabs({ items, value, onChange, className = "" }) {
|
|
|
1291
1251
|
},
|
|
1292
1252
|
it.key
|
|
1293
1253
|
)) }),
|
|
1294
|
-
current && /* @__PURE__ */ (0,
|
|
1254
|
+
current && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1295
1255
|
"div",
|
|
1296
1256
|
{
|
|
1297
1257
|
role: "tabpanel",
|
|
@@ -1306,19 +1266,19 @@ function Tabs({ items, value, onChange, className = "" }) {
|
|
|
1306
1266
|
}
|
|
1307
1267
|
|
|
1308
1268
|
// src/components/accordion/accordion.tsx
|
|
1309
|
-
var
|
|
1310
|
-
var
|
|
1269
|
+
var import_react10 = require("react");
|
|
1270
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1311
1271
|
function Accordion({ items, defaultOpen = -1, exclusive = true, className = "" }) {
|
|
1312
|
-
const uid = (0,
|
|
1313
|
-
const [openSet, setOpenSet] = (0,
|
|
1272
|
+
const uid = (0, import_react10.useId)();
|
|
1273
|
+
const [openSet, setOpenSet] = (0, import_react10.useState)(
|
|
1314
1274
|
() => new Set(defaultOpen >= 0 ? [defaultOpen] : [])
|
|
1315
1275
|
);
|
|
1316
|
-
const panelRefs = (0,
|
|
1317
|
-
const [heights, setHeights] = (0,
|
|
1276
|
+
const panelRefs = (0, import_react10.useRef)([]);
|
|
1277
|
+
const [heights, setHeights] = (0, import_react10.useState)([]);
|
|
1318
1278
|
const measure = () => {
|
|
1319
1279
|
setHeights(items.map((_, i) => panelRefs.current[i]?.scrollHeight ?? 0));
|
|
1320
1280
|
};
|
|
1321
|
-
(0,
|
|
1281
|
+
(0, import_react10.useEffect)(() => {
|
|
1322
1282
|
measure();
|
|
1323
1283
|
window.addEventListener("resize", measure);
|
|
1324
1284
|
return () => window.removeEventListener("resize", measure);
|
|
@@ -1335,10 +1295,10 @@ function Accordion({ items, defaultOpen = -1, exclusive = true, className = "" }
|
|
|
1335
1295
|
return next;
|
|
1336
1296
|
});
|
|
1337
1297
|
};
|
|
1338
|
-
return /* @__PURE__ */ (0,
|
|
1298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: `mcl-accordion ${className}`.trim(), children: items.map((item, i) => {
|
|
1339
1299
|
const open = openSet.has(i);
|
|
1340
|
-
return /* @__PURE__ */ (0,
|
|
1341
|
-
/* @__PURE__ */ (0,
|
|
1300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `mcl-accordion-item${open ? " mcl-accordion-item-open" : ""}`, children: [
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1342
1302
|
"button",
|
|
1343
1303
|
{
|
|
1344
1304
|
type: "button",
|
|
@@ -1347,12 +1307,12 @@ function Accordion({ items, defaultOpen = -1, exclusive = true, className = "" }
|
|
|
1347
1307
|
"aria-controls": `mcl-acc-${uid}-${i}`,
|
|
1348
1308
|
onClick: () => toggle(i),
|
|
1349
1309
|
children: [
|
|
1350
|
-
/* @__PURE__ */ (0,
|
|
1351
|
-
/* @__PURE__ */ (0,
|
|
1310
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: item.title }),
|
|
1311
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "mcl-accordion-chevron", "aria-hidden": "true", children: "\u25BE" })
|
|
1352
1312
|
]
|
|
1353
1313
|
}
|
|
1354
1314
|
),
|
|
1355
|
-
/* @__PURE__ */ (0,
|
|
1315
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1356
1316
|
"div",
|
|
1357
1317
|
{
|
|
1358
1318
|
id: `mcl-acc-${uid}-${i}`,
|
|
@@ -1362,7 +1322,7 @@ function Accordion({ items, defaultOpen = -1, exclusive = true, className = "" }
|
|
|
1362
1322
|
className: "mcl-accordion-panel",
|
|
1363
1323
|
style: { maxHeight: open ? heights[i] || 999 : 0 },
|
|
1364
1324
|
role: "region",
|
|
1365
|
-
children: /* @__PURE__ */ (0,
|
|
1325
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "mcl-accordion-panel-inner", children: item.content })
|
|
1366
1326
|
}
|
|
1367
1327
|
)
|
|
1368
1328
|
] }, i);
|
|
@@ -1370,14 +1330,14 @@ function Accordion({ items, defaultOpen = -1, exclusive = true, className = "" }
|
|
|
1370
1330
|
}
|
|
1371
1331
|
|
|
1372
1332
|
// src/components/toast/toast.tsx
|
|
1373
|
-
var
|
|
1374
|
-
var
|
|
1375
|
-
var ToastContext = (0,
|
|
1333
|
+
var import_react11 = require("react");
|
|
1334
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1335
|
+
var ToastContext = (0, import_react11.createContext)(null);
|
|
1376
1336
|
function ToastProvider({ children, placement = "bottom-right" }) {
|
|
1377
|
-
const [toasts, setToasts] = (0,
|
|
1378
|
-
const idRef = (0,
|
|
1379
|
-
const timersRef = (0,
|
|
1380
|
-
const dismiss = (0,
|
|
1337
|
+
const [toasts, setToasts] = (0, import_react11.useState)([]);
|
|
1338
|
+
const idRef = (0, import_react11.useRef)(0);
|
|
1339
|
+
const timersRef = (0, import_react11.useRef)(/* @__PURE__ */ new Map());
|
|
1340
|
+
const dismiss = (0, import_react11.useCallback)((id) => {
|
|
1381
1341
|
const timer = timersRef.current.get(id);
|
|
1382
1342
|
if (timer !== void 0) {
|
|
1383
1343
|
window.clearTimeout(timer);
|
|
@@ -1385,7 +1345,7 @@ function ToastProvider({ children, placement = "bottom-right" }) {
|
|
|
1385
1345
|
}
|
|
1386
1346
|
setToasts((list) => list.filter((t) => t.id !== id));
|
|
1387
1347
|
}, []);
|
|
1388
|
-
const toast = (0,
|
|
1348
|
+
const toast = (0, import_react11.useCallback)(
|
|
1389
1349
|
(o) => {
|
|
1390
1350
|
const id = ++idRef.current;
|
|
1391
1351
|
setToasts((list) => [...list, { ...o, id }].slice(-4));
|
|
@@ -1397,42 +1357,42 @@ function ToastProvider({ children, placement = "bottom-right" }) {
|
|
|
1397
1357
|
},
|
|
1398
1358
|
[dismiss]
|
|
1399
1359
|
);
|
|
1400
|
-
(0,
|
|
1360
|
+
(0, import_react11.useEffect)(
|
|
1401
1361
|
() => () => {
|
|
1402
1362
|
timersRef.current.forEach((timer) => window.clearTimeout(timer));
|
|
1403
1363
|
timersRef.current.clear();
|
|
1404
1364
|
},
|
|
1405
1365
|
[]
|
|
1406
1366
|
);
|
|
1407
|
-
return /* @__PURE__ */ (0,
|
|
1367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(ToastContext.Provider, { value: { toast, dismiss }, children: [
|
|
1408
1368
|
children,
|
|
1409
|
-
/* @__PURE__ */ (0,
|
|
1369
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `mcl-toasts mcl-toasts-${placement}`, "aria-live": "polite", children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToastCard, { item: t, onClose: () => dismiss(t.id) }, t.id)) })
|
|
1410
1370
|
] });
|
|
1411
1371
|
}
|
|
1412
1372
|
function ToastCard({ item, onClose }) {
|
|
1413
|
-
return /* @__PURE__ */ (0,
|
|
1414
|
-
/* @__PURE__ */ (0,
|
|
1415
|
-
/* @__PURE__ */ (0,
|
|
1416
|
-
item.title && /* @__PURE__ */ (0,
|
|
1417
|
-
item.message && /* @__PURE__ */ (0,
|
|
1373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `mcl-toast mcl-toast-${item.variant ?? "info"}`, role: "status", children: [
|
|
1374
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "mcl-toast-dot", "aria-hidden": "true" }),
|
|
1375
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mcl-toast-content", children: [
|
|
1376
|
+
item.title && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "mcl-toast-title", children: item.title }),
|
|
1377
|
+
item.message && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "mcl-toast-message", children: item.message })
|
|
1418
1378
|
] }),
|
|
1419
|
-
/* @__PURE__ */ (0,
|
|
1379
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: "mcl-toast-close", onClick: onClose, "aria-label": "Dismiss notification", children: "\u2715" })
|
|
1420
1380
|
] });
|
|
1421
1381
|
}
|
|
1422
1382
|
function useToast() {
|
|
1423
|
-
const ctx = (0,
|
|
1383
|
+
const ctx = (0, import_react11.useContext)(ToastContext);
|
|
1424
1384
|
if (!ctx) throw new Error("useToast must be used inside <ToastProvider>.");
|
|
1425
1385
|
return ctx;
|
|
1426
1386
|
}
|
|
1427
1387
|
|
|
1428
1388
|
// src/components/navbar/navbar.tsx
|
|
1429
|
-
var
|
|
1430
|
-
var
|
|
1389
|
+
var import_react12 = require("react");
|
|
1390
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1431
1391
|
function Navbar({ brand, links = [], activeHref, right, sticky = true, className = "" }) {
|
|
1432
|
-
const [open, setOpen] = (0,
|
|
1433
|
-
return /* @__PURE__ */ (0,
|
|
1434
|
-
brand && /* @__PURE__ */ (0,
|
|
1435
|
-
links.length > 0 && /* @__PURE__ */ (0,
|
|
1392
|
+
const [open, setOpen] = (0, import_react12.useState)(false);
|
|
1393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("nav", { className: `mcl-navbar${sticky ? " mcl-navbar-sticky" : ""} ${className}`.trim(), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mcl-navbar-inner", children: [
|
|
1394
|
+
brand && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("a", { className: "mcl-navbar-brand", href: "/", children: brand }),
|
|
1395
|
+
links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1436
1396
|
"button",
|
|
1437
1397
|
{
|
|
1438
1398
|
type: "button",
|
|
@@ -1440,10 +1400,10 @@ function Navbar({ brand, links = [], activeHref, right, sticky = true, className
|
|
|
1440
1400
|
"aria-expanded": open,
|
|
1441
1401
|
"aria-label": "Toggle menu",
|
|
1442
1402
|
onClick: () => setOpen((o) => !o),
|
|
1443
|
-
children: /* @__PURE__ */ (0,
|
|
1403
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "mcl-navbar-burger", "aria-hidden": "true" })
|
|
1444
1404
|
}
|
|
1445
1405
|
),
|
|
1446
|
-
links.length > 0 && /* @__PURE__ */ (0,
|
|
1406
|
+
links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ul", { className: `mcl-navbar-links${open ? " mcl-navbar-open" : ""}`, children: links.map((l) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1447
1407
|
"a",
|
|
1448
1408
|
{
|
|
1449
1409
|
href: l.href,
|
|
@@ -1453,26 +1413,26 @@ function Navbar({ brand, links = [], activeHref, right, sticky = true, className
|
|
|
1453
1413
|
children: l.label
|
|
1454
1414
|
}
|
|
1455
1415
|
) }, l.href)) }),
|
|
1456
|
-
right && /* @__PURE__ */ (0,
|
|
1416
|
+
right && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mcl-navbar-right", children: right })
|
|
1457
1417
|
] }) });
|
|
1458
1418
|
}
|
|
1459
1419
|
|
|
1460
1420
|
// src/components/stat/stat.tsx
|
|
1461
|
-
var
|
|
1421
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1462
1422
|
function Stat({ value, label, tone = "primary", className = "" }) {
|
|
1463
|
-
return /* @__PURE__ */ (0,
|
|
1464
|
-
/* @__PURE__ */ (0,
|
|
1465
|
-
label && /* @__PURE__ */ (0,
|
|
1423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `mcl-stat mcl-stat-${tone} ${className}`.trim(), children: [
|
|
1424
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("b", { className: "mcl-stat-value", children: value }),
|
|
1425
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "mcl-stat-label", children: label })
|
|
1466
1426
|
] });
|
|
1467
1427
|
}
|
|
1468
1428
|
|
|
1469
1429
|
// src/components/divider/divider.tsx
|
|
1470
|
-
var
|
|
1430
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1471
1431
|
function Divider({ orientation = "horizontal", label, className = "", ...rest }) {
|
|
1472
1432
|
if (label !== void 0 && label !== null) {
|
|
1473
|
-
return /* @__PURE__ */ (0,
|
|
1433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `mcl-divider-label ${className}`.trim(), role: "separator", ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "mcl-divider-label-text", children: label }) });
|
|
1474
1434
|
}
|
|
1475
|
-
return /* @__PURE__ */ (0,
|
|
1435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1476
1436
|
"div",
|
|
1477
1437
|
{
|
|
1478
1438
|
className: `mcl-divider mcl-divider-${orientation} ${className}`.trim(),
|
|
@@ -1483,7 +1443,7 @@ function Divider({ orientation = "horizontal", label, className = "", ...rest })
|
|
|
1483
1443
|
}
|
|
1484
1444
|
|
|
1485
1445
|
// src/components/stack/stack.tsx
|
|
1486
|
-
var
|
|
1446
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1487
1447
|
function Stack({
|
|
1488
1448
|
direction = "column",
|
|
1489
1449
|
gap = "md",
|
|
@@ -1502,7 +1462,7 @@ function Stack({
|
|
|
1502
1462
|
justify ? `mcl-stack-justify-${justify}` : "",
|
|
1503
1463
|
className
|
|
1504
1464
|
].filter(Boolean).join(" ");
|
|
1505
|
-
return /* @__PURE__ */ (0,
|
|
1465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: cls, ...rest });
|
|
1506
1466
|
}
|
|
1507
1467
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1508
1468
|
0 && (module.exports = {
|
|
@@ -1532,7 +1492,6 @@ function Stack({
|
|
|
1532
1492
|
Progress,
|
|
1533
1493
|
Radio,
|
|
1534
1494
|
Range,
|
|
1535
|
-
Select,
|
|
1536
1495
|
Skeleton,
|
|
1537
1496
|
Spinner,
|
|
1538
1497
|
Stack,
|