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.js
CHANGED
|
@@ -520,53 +520,14 @@ function Textarea({ label, hint, error, size = "md", block = true, className = "
|
|
|
520
520
|
return /* @__PURE__ */ jsx7(Chrome, { id: inputId, label, hint, error, block: true, children: el });
|
|
521
521
|
}
|
|
522
522
|
|
|
523
|
-
// src/components/select/select.tsx
|
|
524
|
-
import React5 from "react";
|
|
525
|
-
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
526
|
-
function Select({
|
|
527
|
-
label,
|
|
528
|
-
hint,
|
|
529
|
-
error,
|
|
530
|
-
size = "md",
|
|
531
|
-
options,
|
|
532
|
-
placeholder,
|
|
533
|
-
className = "",
|
|
534
|
-
id,
|
|
535
|
-
children,
|
|
536
|
-
...rest
|
|
537
|
-
}) {
|
|
538
|
-
const autoId = React5.useId();
|
|
539
|
-
const selectId = id ?? autoId;
|
|
540
|
-
const select = /* @__PURE__ */ jsx8("span", { className: `mcl-select-shell ${className}`.trim(), children: /* @__PURE__ */ jsxs4(
|
|
541
|
-
"select",
|
|
542
|
-
{
|
|
543
|
-
id: selectId,
|
|
544
|
-
className: `mcl-select mcl-select-${size}${error ? " mcl-select-invalid" : ""}`,
|
|
545
|
-
"aria-invalid": error ? true : void 0,
|
|
546
|
-
...rest,
|
|
547
|
-
children: [
|
|
548
|
-
placeholder && /* @__PURE__ */ jsx8("option", { value: "", disabled: true, children: placeholder }),
|
|
549
|
-
options?.map((o) => /* @__PURE__ */ jsx8("option", { value: o.value, children: o.label }, o.value)),
|
|
550
|
-
children
|
|
551
|
-
]
|
|
552
|
-
}
|
|
553
|
-
) });
|
|
554
|
-
if (!label && !hint && !error) return select;
|
|
555
|
-
return /* @__PURE__ */ jsxs4("div", { className: "mcl-field", children: [
|
|
556
|
-
label && /* @__PURE__ */ jsx8("label", { className: "mcl-label", htmlFor: selectId, children: label }),
|
|
557
|
-
select,
|
|
558
|
-
error ? /* @__PURE__ */ jsx8("div", { className: "mcl-hint mcl-hint-error", role: "alert", children: error }) : hint ? /* @__PURE__ */ jsx8("div", { className: "mcl-hint", children: hint }) : null
|
|
559
|
-
] });
|
|
560
|
-
}
|
|
561
|
-
|
|
562
523
|
// src/components/checks/checks.tsx
|
|
563
524
|
import { useEffect as useEffect3, useRef as useRef3, useState as useState3 } from "react";
|
|
564
|
-
import { Fragment, jsx as
|
|
525
|
+
import { Fragment, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
565
526
|
function withLabel(input, label) {
|
|
566
527
|
if (label === void 0 || label === null) return input;
|
|
567
|
-
return /* @__PURE__ */
|
|
528
|
+
return /* @__PURE__ */ jsxs4("label", { className: "mcl-check", children: [
|
|
568
529
|
input,
|
|
569
|
-
/* @__PURE__ */
|
|
530
|
+
/* @__PURE__ */ jsx8("span", { className: "mcl-check-label", children: label })
|
|
570
531
|
] });
|
|
571
532
|
}
|
|
572
533
|
function Checkbox({ label, indeterminate = false, className = "", ...rest }) {
|
|
@@ -575,9 +536,9 @@ function Checkbox({ label, indeterminate = false, className = "", ...rest }) {
|
|
|
575
536
|
if (inputRef.current) inputRef.current.indeterminate = indeterminate;
|
|
576
537
|
}, [indeterminate]);
|
|
577
538
|
return withLabel(
|
|
578
|
-
/* @__PURE__ */
|
|
579
|
-
/* @__PURE__ */
|
|
580
|
-
/* @__PURE__ */
|
|
539
|
+
/* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
540
|
+
/* @__PURE__ */ jsx8("input", { ref: inputRef, type: "checkbox", className: `mcl-check-input ${className}`.trim(), ...rest }),
|
|
541
|
+
/* @__PURE__ */ jsx8("span", { className: "mcl-check-box", "aria-hidden": "true" })
|
|
581
542
|
] }),
|
|
582
543
|
label
|
|
583
544
|
);
|
|
@@ -612,16 +573,16 @@ function CheckboxGroup({
|
|
|
612
573
|
const toggleAll = () => {
|
|
613
574
|
commit(allOn ? selected.filter((v) => !enabled.includes(v)) : Array.from(/* @__PURE__ */ new Set([...selected, ...enabled])));
|
|
614
575
|
};
|
|
615
|
-
return /* @__PURE__ */
|
|
576
|
+
return /* @__PURE__ */ jsxs4(
|
|
616
577
|
"div",
|
|
617
578
|
{
|
|
618
579
|
className: `mcl-check-group ${className}`.trim(),
|
|
619
580
|
role: "group",
|
|
620
581
|
"aria-label": typeof label === "string" ? label : void 0,
|
|
621
582
|
children: [
|
|
622
|
-
label && /* @__PURE__ */
|
|
623
|
-
selectAll && /* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */
|
|
583
|
+
label && /* @__PURE__ */ jsx8("span", { className: "mcl-label", children: label }),
|
|
584
|
+
selectAll && /* @__PURE__ */ jsxs4("label", { className: `mcl-check mcl-check-group-all${disabled ? " mcl-check-disabled" : ""}`, children: [
|
|
585
|
+
/* @__PURE__ */ jsx8(
|
|
625
586
|
"input",
|
|
626
587
|
{
|
|
627
588
|
ref: allRef,
|
|
@@ -632,11 +593,11 @@ function CheckboxGroup({
|
|
|
632
593
|
onChange: toggleAll
|
|
633
594
|
}
|
|
634
595
|
),
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
/* @__PURE__ */
|
|
596
|
+
/* @__PURE__ */ jsx8("span", { className: "mcl-check-box", "aria-hidden": "true" }),
|
|
597
|
+
/* @__PURE__ */ jsx8("span", { className: "mcl-check-label", children: selectAllLabel })
|
|
637
598
|
] }),
|
|
638
|
-
/* @__PURE__ */
|
|
639
|
-
/* @__PURE__ */
|
|
599
|
+
/* @__PURE__ */ jsx8("div", { className: "mcl-check-group-items", children: options.map((o) => /* @__PURE__ */ jsxs4("label", { className: `mcl-check${o.disabled || disabled ? " mcl-check-disabled" : ""}`, children: [
|
|
600
|
+
/* @__PURE__ */ jsx8(
|
|
640
601
|
"input",
|
|
641
602
|
{
|
|
642
603
|
type: "checkbox",
|
|
@@ -646,8 +607,8 @@ function CheckboxGroup({
|
|
|
646
607
|
onChange: () => toggle(o.value)
|
|
647
608
|
}
|
|
648
609
|
),
|
|
649
|
-
/* @__PURE__ */
|
|
650
|
-
/* @__PURE__ */
|
|
610
|
+
/* @__PURE__ */ jsx8("span", { className: "mcl-check-box", "aria-hidden": "true" }),
|
|
611
|
+
/* @__PURE__ */ jsx8("span", { className: "mcl-check-label", children: o.label })
|
|
651
612
|
] }, o.value)) })
|
|
652
613
|
]
|
|
653
614
|
}
|
|
@@ -655,17 +616,17 @@ function CheckboxGroup({
|
|
|
655
616
|
}
|
|
656
617
|
function Radio({ label, className = "", ...rest }) {
|
|
657
618
|
return withLabel(
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
-
/* @__PURE__ */
|
|
660
|
-
/* @__PURE__ */
|
|
619
|
+
/* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
620
|
+
/* @__PURE__ */ jsx8("input", { type: "radio", className: `mcl-check-input ${className}`.trim(), ...rest }),
|
|
621
|
+
/* @__PURE__ */ jsx8("span", { className: "mcl-check-box mcl-radio-box", "aria-hidden": "true" })
|
|
661
622
|
] }),
|
|
662
623
|
label
|
|
663
624
|
);
|
|
664
625
|
}
|
|
665
626
|
function Switch({ label, className = "", ...rest }) {
|
|
666
627
|
return withLabel(
|
|
667
|
-
/* @__PURE__ */
|
|
668
|
-
/* @__PURE__ */
|
|
628
|
+
/* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
629
|
+
/* @__PURE__ */ jsx8(
|
|
669
630
|
"input",
|
|
670
631
|
{
|
|
671
632
|
type: "checkbox",
|
|
@@ -674,7 +635,7 @@ function Switch({ label, className = "", ...rest }) {
|
|
|
674
635
|
...rest
|
|
675
636
|
}
|
|
676
637
|
),
|
|
677
|
-
/* @__PURE__ */
|
|
638
|
+
/* @__PURE__ */ jsx8("span", { className: "mcl-switch-track", "aria-hidden": "true", children: /* @__PURE__ */ jsx8("span", { className: "mcl-switch-knob" }) })
|
|
678
639
|
] }),
|
|
679
640
|
label
|
|
680
641
|
);
|
|
@@ -682,7 +643,7 @@ function Switch({ label, className = "", ...rest }) {
|
|
|
682
643
|
|
|
683
644
|
// src/components/dropdown/dropdown.tsx
|
|
684
645
|
import { useEffect as useEffect4, useRef as useRef4, useState as useState4 } from "react";
|
|
685
|
-
import { jsx as
|
|
646
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
686
647
|
function Dropdown({
|
|
687
648
|
items,
|
|
688
649
|
value,
|
|
@@ -815,15 +776,15 @@ function Dropdown({
|
|
|
815
776
|
setOpen(true);
|
|
816
777
|
}
|
|
817
778
|
};
|
|
818
|
-
return /* @__PURE__ */
|
|
819
|
-
label && /* @__PURE__ */
|
|
820
|
-
/* @__PURE__ */
|
|
779
|
+
return /* @__PURE__ */ jsxs5("div", { className: `mcl-field${block ? " mcl-field-block" : ""} ${className}`.trim(), children: [
|
|
780
|
+
label && /* @__PURE__ */ jsx9("span", { className: "mcl-label", children: label }),
|
|
781
|
+
/* @__PURE__ */ jsxs5(
|
|
821
782
|
"div",
|
|
822
783
|
{
|
|
823
784
|
ref: shellRef,
|
|
824
785
|
className: `mcl-dropdown-shell${block ? " mcl-dropdown-block" : ""}`,
|
|
825
786
|
children: [
|
|
826
|
-
/* @__PURE__ */
|
|
787
|
+
/* @__PURE__ */ jsxs5(
|
|
827
788
|
"button",
|
|
828
789
|
{
|
|
829
790
|
ref: triggerRef,
|
|
@@ -835,12 +796,12 @@ function Dropdown({
|
|
|
835
796
|
onClick: () => setOpen((o) => !o),
|
|
836
797
|
onKeyDown: onTriggerKeyDown,
|
|
837
798
|
children: [
|
|
838
|
-
/* @__PURE__ */
|
|
839
|
-
/* @__PURE__ */
|
|
799
|
+
/* @__PURE__ */ jsx9("span", { className: `mcl-dropdown-value${hasSelection ? "" : " mcl-dropdown-placeholder"}`, children: triggerText }),
|
|
800
|
+
/* @__PURE__ */ jsx9("span", { className: "mcl-dropdown-chevron", "aria-hidden": "true" })
|
|
840
801
|
]
|
|
841
802
|
}
|
|
842
803
|
),
|
|
843
|
-
open && /* @__PURE__ */
|
|
804
|
+
open && /* @__PURE__ */ jsx9(
|
|
844
805
|
"div",
|
|
845
806
|
{
|
|
846
807
|
ref: menuRef,
|
|
@@ -857,7 +818,7 @@ function Dropdown({
|
|
|
857
818
|
onKeyDown: onMenuKeyDown,
|
|
858
819
|
children: items.map((it, i) => {
|
|
859
820
|
const selected = multiple ? selectedValues.includes(it.value) : singleValue === it.value;
|
|
860
|
-
return /* @__PURE__ */
|
|
821
|
+
return /* @__PURE__ */ jsxs5(
|
|
861
822
|
"div",
|
|
862
823
|
{
|
|
863
824
|
role: "option",
|
|
@@ -874,9 +835,9 @@ function Dropdown({
|
|
|
874
835
|
if (!it.disabled) commit(it.value);
|
|
875
836
|
},
|
|
876
837
|
children: [
|
|
877
|
-
multiple && /* @__PURE__ */
|
|
878
|
-
/* @__PURE__ */
|
|
879
|
-
!multiple && selected && /* @__PURE__ */
|
|
838
|
+
multiple && /* @__PURE__ */ jsx9("span", { className: "mcl-dropdown-check", "aria-hidden": "true" }),
|
|
839
|
+
/* @__PURE__ */ jsx9("span", { className: "mcl-dropdown-item-label", children: it.label }),
|
|
840
|
+
!multiple && selected && /* @__PURE__ */ jsx9("span", { className: "mcl-dropdown-tick", "aria-hidden": "true", children: "\u2713" })
|
|
880
841
|
]
|
|
881
842
|
},
|
|
882
843
|
it.value
|
|
@@ -887,13 +848,13 @@ function Dropdown({
|
|
|
887
848
|
]
|
|
888
849
|
}
|
|
889
850
|
),
|
|
890
|
-
hint && /* @__PURE__ */
|
|
851
|
+
hint && /* @__PURE__ */ jsx9("div", { className: "mcl-hint", children: hint })
|
|
891
852
|
] });
|
|
892
853
|
}
|
|
893
854
|
|
|
894
855
|
// src/components/range/range.tsx
|
|
895
|
-
import
|
|
896
|
-
import { jsx as
|
|
856
|
+
import React7, { useState as useState5 } from "react";
|
|
857
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
897
858
|
function Range({
|
|
898
859
|
label,
|
|
899
860
|
hint,
|
|
@@ -905,14 +866,14 @@ function Range({
|
|
|
905
866
|
id,
|
|
906
867
|
...rest
|
|
907
868
|
}) {
|
|
908
|
-
const autoId =
|
|
869
|
+
const autoId = React7.useId();
|
|
909
870
|
const inputId = id ?? autoId;
|
|
910
871
|
const isControlled = value !== void 0;
|
|
911
872
|
const [inner, setInner] = useState5(
|
|
912
873
|
() => value !== void 0 ? String(value) : defaultValue !== void 0 ? String(defaultValue) : "0"
|
|
913
874
|
);
|
|
914
875
|
const current = isControlled ? String(value) : inner;
|
|
915
|
-
const input = /* @__PURE__ */
|
|
876
|
+
const input = /* @__PURE__ */ jsx10(
|
|
916
877
|
"input",
|
|
917
878
|
{
|
|
918
879
|
id: inputId,
|
|
@@ -926,22 +887,22 @@ function Range({
|
|
|
926
887
|
...rest
|
|
927
888
|
}
|
|
928
889
|
);
|
|
929
|
-
const field = /* @__PURE__ */
|
|
930
|
-
label && /* @__PURE__ */
|
|
931
|
-
/* @__PURE__ */
|
|
932
|
-
showValue && /* @__PURE__ */
|
|
890
|
+
const field = /* @__PURE__ */ jsxs6("div", { className: "mcl-field", children: [
|
|
891
|
+
label && /* @__PURE__ */ jsxs6("label", { className: "mcl-range-head", htmlFor: inputId, children: [
|
|
892
|
+
/* @__PURE__ */ jsx10("span", { className: "mcl-label", children: label }),
|
|
893
|
+
showValue && /* @__PURE__ */ jsx10("span", { className: "mcl-range-value", children: current })
|
|
933
894
|
] }),
|
|
934
895
|
input,
|
|
935
|
-
hint && /* @__PURE__ */
|
|
896
|
+
hint && /* @__PURE__ */ jsx10("div", { className: "mcl-hint", children: hint })
|
|
936
897
|
] });
|
|
937
898
|
if (!label && !hint) return input;
|
|
938
899
|
return field;
|
|
939
900
|
}
|
|
940
901
|
|
|
941
902
|
// src/components/badge/badge.tsx
|
|
942
|
-
import { jsx as
|
|
903
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
943
904
|
function Badge({ variant = "neutral", solid = false, className = "", ...rest }) {
|
|
944
|
-
return /* @__PURE__ */
|
|
905
|
+
return /* @__PURE__ */ jsx11(
|
|
945
906
|
"span",
|
|
946
907
|
{
|
|
947
908
|
className: `mcl-badge mcl-badge-${variant}${solid ? " mcl-badge-solid" : ""} ${className}`.trim(),
|
|
@@ -951,7 +912,7 @@ function Badge({ variant = "neutral", solid = false, className = "", ...rest })
|
|
|
951
912
|
}
|
|
952
913
|
|
|
953
914
|
// src/components/alert/alert.tsx
|
|
954
|
-
import { jsx as
|
|
915
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
955
916
|
var DEFAULT_ICONS = {
|
|
956
917
|
success: "\u2713",
|
|
957
918
|
danger: "\u2715",
|
|
@@ -967,18 +928,18 @@ function Alert({
|
|
|
967
928
|
children,
|
|
968
929
|
...rest
|
|
969
930
|
}) {
|
|
970
|
-
return /* @__PURE__ */
|
|
971
|
-
/* @__PURE__ */
|
|
972
|
-
/* @__PURE__ */
|
|
973
|
-
title && /* @__PURE__ */
|
|
931
|
+
return /* @__PURE__ */ jsxs7("div", { className: `mcl-alert mcl-alert-${variant} ${className}`.trim(), role: "alert", ...rest, children: [
|
|
932
|
+
/* @__PURE__ */ jsx12("span", { className: "mcl-alert-icon", "aria-hidden": "true", children: icon ?? DEFAULT_ICONS[variant] }),
|
|
933
|
+
/* @__PURE__ */ jsxs7("div", { className: "mcl-alert-content", children: [
|
|
934
|
+
title && /* @__PURE__ */ jsx12("p", { className: "mcl-alert-title", children: title }),
|
|
974
935
|
children
|
|
975
936
|
] }),
|
|
976
|
-
onClose && /* @__PURE__ */
|
|
937
|
+
onClose && /* @__PURE__ */ jsx12("button", { type: "button", className: "mcl-alert-close", onClick: onClose, "aria-label": "Dismiss", children: "\u2715" })
|
|
977
938
|
] });
|
|
978
939
|
}
|
|
979
940
|
|
|
980
941
|
// src/components/avatar/avatar.tsx
|
|
981
|
-
import { jsx as
|
|
942
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
982
943
|
function initialsOf(name) {
|
|
983
944
|
const parts = name.trim().split(/\s+/).slice(0, 2);
|
|
984
945
|
return parts.map((p) => p[0]?.toUpperCase() ?? "").join("");
|
|
@@ -995,7 +956,7 @@ function Avatar({
|
|
|
995
956
|
...rest
|
|
996
957
|
}) {
|
|
997
958
|
const label = alt ?? (name ? `${name}'s avatar` : "avatar");
|
|
998
|
-
return /* @__PURE__ */
|
|
959
|
+
return /* @__PURE__ */ jsxs8(
|
|
999
960
|
"span",
|
|
1000
961
|
{
|
|
1001
962
|
className: `mcl-avatar mcl-avatar-${size}${gradient ? " mcl-avatar-gradient" : ""} ${className}`.trim(),
|
|
@@ -1003,18 +964,18 @@ function Avatar({
|
|
|
1003
964
|
"aria-label": label,
|
|
1004
965
|
...rest,
|
|
1005
966
|
children: [
|
|
1006
|
-
src ? /* @__PURE__ */
|
|
1007
|
-
status && /* @__PURE__ */
|
|
967
|
+
src ? /* @__PURE__ */ jsx13("img", { src, alt: "", className: "mcl-avatar-img", loading: "lazy", decoding: "async" }) : children ?? initialsOf(name ?? "??") ?? "",
|
|
968
|
+
status && /* @__PURE__ */ jsx13("span", { className: `mcl-avatar-status mcl-avatar-status-${status}`, "aria-hidden": "true" })
|
|
1008
969
|
]
|
|
1009
970
|
}
|
|
1010
971
|
);
|
|
1011
972
|
}
|
|
1012
973
|
function AvatarGroup({ className = "", children, ...rest }) {
|
|
1013
|
-
return /* @__PURE__ */
|
|
974
|
+
return /* @__PURE__ */ jsx13("span", { className: `mcl-avatar-group ${className}`.trim(), ...rest, children });
|
|
1014
975
|
}
|
|
1015
976
|
|
|
1016
977
|
// src/components/progress/progress.tsx
|
|
1017
|
-
import { jsx as
|
|
978
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1018
979
|
function Progress({
|
|
1019
980
|
value = 0,
|
|
1020
981
|
max = 100,
|
|
@@ -1026,7 +987,7 @@ function Progress({
|
|
|
1026
987
|
className = ""
|
|
1027
988
|
}) {
|
|
1028
989
|
const pct = Math.max(0, Math.min(100, value / max * 100));
|
|
1029
|
-
return /* @__PURE__ */
|
|
990
|
+
return /* @__PURE__ */ jsxs9(
|
|
1030
991
|
"div",
|
|
1031
992
|
{
|
|
1032
993
|
className: `mcl-progress mcl-progress-${size} ${className}`.trim(),
|
|
@@ -1035,11 +996,11 @@ function Progress({
|
|
|
1035
996
|
"aria-valuemax": max,
|
|
1036
997
|
"aria-valuenow": indeterminate ? void 0 : Math.round(pct),
|
|
1037
998
|
children: [
|
|
1038
|
-
(label || showValue) && /* @__PURE__ */
|
|
1039
|
-
label && /* @__PURE__ */
|
|
1040
|
-
showValue && /* @__PURE__ */
|
|
999
|
+
(label || showValue) && /* @__PURE__ */ jsxs9("div", { className: "mcl-progress-head", children: [
|
|
1000
|
+
label && /* @__PURE__ */ jsx14("span", { children: label }),
|
|
1001
|
+
showValue && /* @__PURE__ */ jsx14("span", { className: "mcl-progress-value", children: indeterminate ? "\u2026" : `${Math.round(pct)}%` })
|
|
1041
1002
|
] }),
|
|
1042
|
-
/* @__PURE__ */
|
|
1003
|
+
/* @__PURE__ */ jsx14("div", { className: "mcl-progress-track", children: /* @__PURE__ */ jsx14(
|
|
1043
1004
|
"span",
|
|
1044
1005
|
{
|
|
1045
1006
|
className: `mcl-progress-fill mcl-progress-fill-${tone}${indeterminate ? " mcl-progress-fill-indeterminate" : ""}`,
|
|
@@ -1052,13 +1013,13 @@ function Progress({
|
|
|
1052
1013
|
}
|
|
1053
1014
|
|
|
1054
1015
|
// src/components/spinner/spinner.tsx
|
|
1055
|
-
import { jsx as
|
|
1016
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1056
1017
|
function Spinner({ size = "md", className = "" }) {
|
|
1057
|
-
return /* @__PURE__ */
|
|
1018
|
+
return /* @__PURE__ */ jsx15("span", { className: `mcl-spinner mcl-spinner-${size} ${className}`.trim(), role: "status", "aria-label": "Loading" });
|
|
1058
1019
|
}
|
|
1059
1020
|
|
|
1060
1021
|
// src/components/skeleton/skeleton.tsx
|
|
1061
|
-
import { jsx as
|
|
1022
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1062
1023
|
function Skeleton({ variant = "text", width, height, count = 1, className = "" }) {
|
|
1063
1024
|
const lines = variant === "text" ? Math.max(1, count) : 1;
|
|
1064
1025
|
const style = (last) => ({
|
|
@@ -1067,7 +1028,7 @@ function Skeleton({ variant = "text", width, height, count = 1, className = "" }
|
|
|
1067
1028
|
...variant === "text" && count > 1 && last ? { width: "62%" } : null
|
|
1068
1029
|
});
|
|
1069
1030
|
if (lines === 1) {
|
|
1070
|
-
return /* @__PURE__ */
|
|
1031
|
+
return /* @__PURE__ */ jsx16(
|
|
1071
1032
|
"span",
|
|
1072
1033
|
{
|
|
1073
1034
|
className: `mcl-skeleton mcl-skeleton-${variant} ${className}`.trim(),
|
|
@@ -1076,13 +1037,13 @@ function Skeleton({ variant = "text", width, height, count = 1, className = "" }
|
|
|
1076
1037
|
}
|
|
1077
1038
|
);
|
|
1078
1039
|
}
|
|
1079
|
-
return /* @__PURE__ */
|
|
1040
|
+
return /* @__PURE__ */ jsx16("span", { className: `mcl-skeleton-lines ${className}`.trim(), "aria-hidden": "true", children: Array.from({ length: lines }, (_, i) => /* @__PURE__ */ jsx16("span", { className: "mcl-skeleton mcl-skeleton-text", style: style(i === lines - 1) }, i)) });
|
|
1080
1041
|
}
|
|
1081
1042
|
|
|
1082
1043
|
// src/components/modal/modal.tsx
|
|
1083
1044
|
import { useEffect as useEffect5, useId, useRef as useRef5, useState as useState6 } from "react";
|
|
1084
1045
|
import { createPortal } from "react-dom";
|
|
1085
|
-
import { jsx as
|
|
1046
|
+
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1086
1047
|
var FOCUSABLE = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
1087
1048
|
function Modal({
|
|
1088
1049
|
open,
|
|
@@ -1138,14 +1099,14 @@ function Modal({
|
|
|
1138
1099
|
};
|
|
1139
1100
|
if (!open || !mounted) return null;
|
|
1140
1101
|
return createPortal(
|
|
1141
|
-
/* @__PURE__ */
|
|
1102
|
+
/* @__PURE__ */ jsx17(
|
|
1142
1103
|
"div",
|
|
1143
1104
|
{
|
|
1144
1105
|
className: "mcl-modal-overlay",
|
|
1145
1106
|
onMouseDown: (e) => {
|
|
1146
1107
|
if (e.target === e.currentTarget && closeOnBackdrop) onClose();
|
|
1147
1108
|
},
|
|
1148
|
-
children: /* @__PURE__ */
|
|
1109
|
+
children: /* @__PURE__ */ jsxs10(
|
|
1149
1110
|
"div",
|
|
1150
1111
|
{
|
|
1151
1112
|
ref: panelRef,
|
|
@@ -1156,12 +1117,12 @@ function Modal({
|
|
|
1156
1117
|
tabIndex: -1,
|
|
1157
1118
|
onKeyDown: trapFocus,
|
|
1158
1119
|
children: [
|
|
1159
|
-
/* @__PURE__ */
|
|
1160
|
-
title ? /* @__PURE__ */
|
|
1161
|
-
/* @__PURE__ */
|
|
1120
|
+
/* @__PURE__ */ jsxs10("div", { className: "mcl-modal-header", children: [
|
|
1121
|
+
title ? /* @__PURE__ */ jsx17("h3", { id: titleId, className: "mcl-modal-title", children: title }) : /* @__PURE__ */ jsx17("span", {}),
|
|
1122
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: "mcl-modal-close", onClick: onClose, "aria-label": "Close dialog", children: "\u2715" })
|
|
1162
1123
|
] }),
|
|
1163
|
-
/* @__PURE__ */
|
|
1164
|
-
footer && /* @__PURE__ */
|
|
1124
|
+
/* @__PURE__ */ jsx17("div", { className: "mcl-modal-body mcl-scroll", children }),
|
|
1125
|
+
footer && /* @__PURE__ */ jsx17("div", { className: "mcl-modal-footer", children: footer })
|
|
1165
1126
|
]
|
|
1166
1127
|
}
|
|
1167
1128
|
)
|
|
@@ -1172,14 +1133,14 @@ function Modal({
|
|
|
1172
1133
|
}
|
|
1173
1134
|
|
|
1174
1135
|
// src/components/tooltip/tooltip.tsx
|
|
1175
|
-
import { jsx as
|
|
1136
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1176
1137
|
function Tooltip({ label, placement = "top", className = "", children }) {
|
|
1177
|
-
return /* @__PURE__ */
|
|
1138
|
+
return /* @__PURE__ */ jsx18("span", { className: `mcl-tooltip mcl-tooltip-${placement} ${className}`.trim(), "data-mcl-tooltip": label, children });
|
|
1178
1139
|
}
|
|
1179
1140
|
|
|
1180
1141
|
// src/components/tabs/tabs.tsx
|
|
1181
1142
|
import { useId as useId2, useRef as useRef6, useState as useState7 } from "react";
|
|
1182
|
-
import { jsx as
|
|
1143
|
+
import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1183
1144
|
function Tabs({ items, value, onChange, className = "" }) {
|
|
1184
1145
|
const uid = useId2();
|
|
1185
1146
|
const [inner, setInner] = useState7(0);
|
|
@@ -1204,8 +1165,8 @@ function Tabs({ items, value, onChange, className = "" }) {
|
|
|
1204
1165
|
}
|
|
1205
1166
|
};
|
|
1206
1167
|
const current = items[active];
|
|
1207
|
-
return /* @__PURE__ */
|
|
1208
|
-
/* @__PURE__ */
|
|
1168
|
+
return /* @__PURE__ */ jsxs11("div", { className: `mcl-tabs ${className}`.trim(), children: [
|
|
1169
|
+
/* @__PURE__ */ jsx19("div", { className: "mcl-tablist", role: "tablist", "aria-label": "Tabs", onKeyDown, children: items.map((it, i) => /* @__PURE__ */ jsx19(
|
|
1209
1170
|
"button",
|
|
1210
1171
|
{
|
|
1211
1172
|
ref: (el) => {
|
|
@@ -1224,7 +1185,7 @@ function Tabs({ items, value, onChange, className = "" }) {
|
|
|
1224
1185
|
},
|
|
1225
1186
|
it.key
|
|
1226
1187
|
)) }),
|
|
1227
|
-
current && /* @__PURE__ */
|
|
1188
|
+
current && /* @__PURE__ */ jsx19(
|
|
1228
1189
|
"div",
|
|
1229
1190
|
{
|
|
1230
1191
|
role: "tabpanel",
|
|
@@ -1240,7 +1201,7 @@ function Tabs({ items, value, onChange, className = "" }) {
|
|
|
1240
1201
|
|
|
1241
1202
|
// src/components/accordion/accordion.tsx
|
|
1242
1203
|
import { useEffect as useEffect6, useId as useId3, useRef as useRef7, useState as useState8 } from "react";
|
|
1243
|
-
import { jsx as
|
|
1204
|
+
import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1244
1205
|
function Accordion({ items, defaultOpen = -1, exclusive = true, className = "" }) {
|
|
1245
1206
|
const uid = useId3();
|
|
1246
1207
|
const [openSet, setOpenSet] = useState8(
|
|
@@ -1268,10 +1229,10 @@ function Accordion({ items, defaultOpen = -1, exclusive = true, className = "" }
|
|
|
1268
1229
|
return next;
|
|
1269
1230
|
});
|
|
1270
1231
|
};
|
|
1271
|
-
return /* @__PURE__ */
|
|
1232
|
+
return /* @__PURE__ */ jsx20("div", { className: `mcl-accordion ${className}`.trim(), children: items.map((item, i) => {
|
|
1272
1233
|
const open = openSet.has(i);
|
|
1273
|
-
return /* @__PURE__ */
|
|
1274
|
-
/* @__PURE__ */
|
|
1234
|
+
return /* @__PURE__ */ jsxs12("div", { className: `mcl-accordion-item${open ? " mcl-accordion-item-open" : ""}`, children: [
|
|
1235
|
+
/* @__PURE__ */ jsxs12(
|
|
1275
1236
|
"button",
|
|
1276
1237
|
{
|
|
1277
1238
|
type: "button",
|
|
@@ -1280,12 +1241,12 @@ function Accordion({ items, defaultOpen = -1, exclusive = true, className = "" }
|
|
|
1280
1241
|
"aria-controls": `mcl-acc-${uid}-${i}`,
|
|
1281
1242
|
onClick: () => toggle(i),
|
|
1282
1243
|
children: [
|
|
1283
|
-
/* @__PURE__ */
|
|
1284
|
-
/* @__PURE__ */
|
|
1244
|
+
/* @__PURE__ */ jsx20("span", { children: item.title }),
|
|
1245
|
+
/* @__PURE__ */ jsx20("span", { className: "mcl-accordion-chevron", "aria-hidden": "true", children: "\u25BE" })
|
|
1285
1246
|
]
|
|
1286
1247
|
}
|
|
1287
1248
|
),
|
|
1288
|
-
/* @__PURE__ */
|
|
1249
|
+
/* @__PURE__ */ jsx20(
|
|
1289
1250
|
"div",
|
|
1290
1251
|
{
|
|
1291
1252
|
id: `mcl-acc-${uid}-${i}`,
|
|
@@ -1295,7 +1256,7 @@ function Accordion({ items, defaultOpen = -1, exclusive = true, className = "" }
|
|
|
1295
1256
|
className: "mcl-accordion-panel",
|
|
1296
1257
|
style: { maxHeight: open ? heights[i] || 999 : 0 },
|
|
1297
1258
|
role: "region",
|
|
1298
|
-
children: /* @__PURE__ */
|
|
1259
|
+
children: /* @__PURE__ */ jsx20("div", { className: "mcl-accordion-panel-inner", children: item.content })
|
|
1299
1260
|
}
|
|
1300
1261
|
)
|
|
1301
1262
|
] }, i);
|
|
@@ -1304,7 +1265,7 @@ function Accordion({ items, defaultOpen = -1, exclusive = true, className = "" }
|
|
|
1304
1265
|
|
|
1305
1266
|
// src/components/toast/toast.tsx
|
|
1306
1267
|
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect7, useRef as useRef8, useState as useState9 } from "react";
|
|
1307
|
-
import { jsx as
|
|
1268
|
+
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1308
1269
|
var ToastContext = createContext2(null);
|
|
1309
1270
|
function ToastProvider({ children, placement = "bottom-right" }) {
|
|
1310
1271
|
const [toasts, setToasts] = useState9([]);
|
|
@@ -1337,19 +1298,19 @@ function ToastProvider({ children, placement = "bottom-right" }) {
|
|
|
1337
1298
|
},
|
|
1338
1299
|
[]
|
|
1339
1300
|
);
|
|
1340
|
-
return /* @__PURE__ */
|
|
1301
|
+
return /* @__PURE__ */ jsxs13(ToastContext.Provider, { value: { toast, dismiss }, children: [
|
|
1341
1302
|
children,
|
|
1342
|
-
/* @__PURE__ */
|
|
1303
|
+
/* @__PURE__ */ jsx21("div", { className: `mcl-toasts mcl-toasts-${placement}`, "aria-live": "polite", children: toasts.map((t) => /* @__PURE__ */ jsx21(ToastCard, { item: t, onClose: () => dismiss(t.id) }, t.id)) })
|
|
1343
1304
|
] });
|
|
1344
1305
|
}
|
|
1345
1306
|
function ToastCard({ item, onClose }) {
|
|
1346
|
-
return /* @__PURE__ */
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
/* @__PURE__ */
|
|
1349
|
-
item.title && /* @__PURE__ */
|
|
1350
|
-
item.message && /* @__PURE__ */
|
|
1307
|
+
return /* @__PURE__ */ jsxs13("div", { className: `mcl-toast mcl-toast-${item.variant ?? "info"}`, role: "status", children: [
|
|
1308
|
+
/* @__PURE__ */ jsx21("span", { className: "mcl-toast-dot", "aria-hidden": "true" }),
|
|
1309
|
+
/* @__PURE__ */ jsxs13("div", { className: "mcl-toast-content", children: [
|
|
1310
|
+
item.title && /* @__PURE__ */ jsx21("div", { className: "mcl-toast-title", children: item.title }),
|
|
1311
|
+
item.message && /* @__PURE__ */ jsx21("div", { className: "mcl-toast-message", children: item.message })
|
|
1351
1312
|
] }),
|
|
1352
|
-
/* @__PURE__ */
|
|
1313
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: "mcl-toast-close", onClick: onClose, "aria-label": "Dismiss notification", children: "\u2715" })
|
|
1353
1314
|
] });
|
|
1354
1315
|
}
|
|
1355
1316
|
function useToast() {
|
|
@@ -1360,12 +1321,12 @@ function useToast() {
|
|
|
1360
1321
|
|
|
1361
1322
|
// src/components/navbar/navbar.tsx
|
|
1362
1323
|
import { useState as useState10 } from "react";
|
|
1363
|
-
import { jsx as
|
|
1324
|
+
import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1364
1325
|
function Navbar({ brand, links = [], activeHref, right, sticky = true, className = "" }) {
|
|
1365
1326
|
const [open, setOpen] = useState10(false);
|
|
1366
|
-
return /* @__PURE__ */
|
|
1367
|
-
brand && /* @__PURE__ */
|
|
1368
|
-
links.length > 0 && /* @__PURE__ */
|
|
1327
|
+
return /* @__PURE__ */ jsx22("nav", { className: `mcl-navbar${sticky ? " mcl-navbar-sticky" : ""} ${className}`.trim(), children: /* @__PURE__ */ jsxs14("div", { className: "mcl-navbar-inner", children: [
|
|
1328
|
+
brand && /* @__PURE__ */ jsx22("a", { className: "mcl-navbar-brand", href: "/", children: brand }),
|
|
1329
|
+
links.length > 0 && /* @__PURE__ */ jsx22(
|
|
1369
1330
|
"button",
|
|
1370
1331
|
{
|
|
1371
1332
|
type: "button",
|
|
@@ -1373,10 +1334,10 @@ function Navbar({ brand, links = [], activeHref, right, sticky = true, className
|
|
|
1373
1334
|
"aria-expanded": open,
|
|
1374
1335
|
"aria-label": "Toggle menu",
|
|
1375
1336
|
onClick: () => setOpen((o) => !o),
|
|
1376
|
-
children: /* @__PURE__ */
|
|
1337
|
+
children: /* @__PURE__ */ jsx22("span", { className: "mcl-navbar-burger", "aria-hidden": "true" })
|
|
1377
1338
|
}
|
|
1378
1339
|
),
|
|
1379
|
-
links.length > 0 && /* @__PURE__ */
|
|
1340
|
+
links.length > 0 && /* @__PURE__ */ jsx22("ul", { className: `mcl-navbar-links${open ? " mcl-navbar-open" : ""}`, children: links.map((l) => /* @__PURE__ */ jsx22("li", { children: /* @__PURE__ */ jsx22(
|
|
1380
1341
|
"a",
|
|
1381
1342
|
{
|
|
1382
1343
|
href: l.href,
|
|
@@ -1386,26 +1347,26 @@ function Navbar({ brand, links = [], activeHref, right, sticky = true, className
|
|
|
1386
1347
|
children: l.label
|
|
1387
1348
|
}
|
|
1388
1349
|
) }, l.href)) }),
|
|
1389
|
-
right && /* @__PURE__ */
|
|
1350
|
+
right && /* @__PURE__ */ jsx22("div", { className: "mcl-navbar-right", children: right })
|
|
1390
1351
|
] }) });
|
|
1391
1352
|
}
|
|
1392
1353
|
|
|
1393
1354
|
// src/components/stat/stat.tsx
|
|
1394
|
-
import { jsx as
|
|
1355
|
+
import { jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1395
1356
|
function Stat({ value, label, tone = "primary", className = "" }) {
|
|
1396
|
-
return /* @__PURE__ */
|
|
1397
|
-
/* @__PURE__ */
|
|
1398
|
-
label && /* @__PURE__ */
|
|
1357
|
+
return /* @__PURE__ */ jsxs15("div", { className: `mcl-stat mcl-stat-${tone} ${className}`.trim(), children: [
|
|
1358
|
+
/* @__PURE__ */ jsx23("b", { className: "mcl-stat-value", children: value }),
|
|
1359
|
+
label && /* @__PURE__ */ jsx23("span", { className: "mcl-stat-label", children: label })
|
|
1399
1360
|
] });
|
|
1400
1361
|
}
|
|
1401
1362
|
|
|
1402
1363
|
// src/components/divider/divider.tsx
|
|
1403
|
-
import { jsx as
|
|
1364
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1404
1365
|
function Divider({ orientation = "horizontal", label, className = "", ...rest }) {
|
|
1405
1366
|
if (label !== void 0 && label !== null) {
|
|
1406
|
-
return /* @__PURE__ */
|
|
1367
|
+
return /* @__PURE__ */ jsx24("div", { className: `mcl-divider-label ${className}`.trim(), role: "separator", ...rest, children: /* @__PURE__ */ jsx24("span", { className: "mcl-divider-label-text", children: label }) });
|
|
1407
1368
|
}
|
|
1408
|
-
return /* @__PURE__ */
|
|
1369
|
+
return /* @__PURE__ */ jsx24(
|
|
1409
1370
|
"div",
|
|
1410
1371
|
{
|
|
1411
1372
|
className: `mcl-divider mcl-divider-${orientation} ${className}`.trim(),
|
|
@@ -1416,7 +1377,7 @@ function Divider({ orientation = "horizontal", label, className = "", ...rest })
|
|
|
1416
1377
|
}
|
|
1417
1378
|
|
|
1418
1379
|
// src/components/stack/stack.tsx
|
|
1419
|
-
import { jsx as
|
|
1380
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1420
1381
|
function Stack({
|
|
1421
1382
|
direction = "column",
|
|
1422
1383
|
gap = "md",
|
|
@@ -1435,7 +1396,7 @@ function Stack({
|
|
|
1435
1396
|
justify ? `mcl-stack-justify-${justify}` : "",
|
|
1436
1397
|
className
|
|
1437
1398
|
].filter(Boolean).join(" ");
|
|
1438
|
-
return /* @__PURE__ */
|
|
1399
|
+
return /* @__PURE__ */ jsx25("div", { className: cls, ...rest });
|
|
1439
1400
|
}
|
|
1440
1401
|
export {
|
|
1441
1402
|
Accordion,
|
|
@@ -1464,7 +1425,6 @@ export {
|
|
|
1464
1425
|
Progress,
|
|
1465
1426
|
Radio,
|
|
1466
1427
|
Range,
|
|
1467
|
-
Select,
|
|
1468
1428
|
Skeleton,
|
|
1469
1429
|
Spinner,
|
|
1470
1430
|
Stack,
|