@mirror-physics/fractal-ui 0.2.0-next.71 → 0.2.0-next.72
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 +331 -231
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +105 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +330 -231
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -803,10 +803,108 @@ function NumberInput({
|
|
|
803
803
|
] });
|
|
804
804
|
}
|
|
805
805
|
|
|
806
|
+
// src/components/Slider/Slider.tsx
|
|
807
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
808
|
+
function Slider(props) {
|
|
809
|
+
const {
|
|
810
|
+
min = 0,
|
|
811
|
+
max = 100,
|
|
812
|
+
step = 1,
|
|
813
|
+
disabled = false,
|
|
814
|
+
className,
|
|
815
|
+
showValues = true,
|
|
816
|
+
formatValue = (value) => value,
|
|
817
|
+
knobs = 1
|
|
818
|
+
} = props;
|
|
819
|
+
const span = Math.max(max - min, 1);
|
|
820
|
+
const rawValues = knobs === 2 ? props.value : [props.value];
|
|
821
|
+
const firstValue = clamp(rawValues[0], min, max);
|
|
822
|
+
const secondValue = knobs === 2 ? clamp(rawValues[1], firstValue, max) : firstValue;
|
|
823
|
+
const selectionStart = knobs === 2 ? firstValue : min;
|
|
824
|
+
const selectionEnd = secondValue;
|
|
825
|
+
const selectionStartPercent = (selectionStart - min) / span * 100;
|
|
826
|
+
const selectionEndPercent = (selectionEnd - min) / span * 100;
|
|
827
|
+
const changeSingleValue = (value) => {
|
|
828
|
+
;
|
|
829
|
+
props.onValueChange(clamp(value, min, max));
|
|
830
|
+
};
|
|
831
|
+
const changeRangeValue = (nextLower, nextUpper) => {
|
|
832
|
+
;
|
|
833
|
+
props.onValueChange([
|
|
834
|
+
clamp(nextLower, min, nextUpper),
|
|
835
|
+
clamp(nextUpper, nextLower, max)
|
|
836
|
+
]);
|
|
837
|
+
};
|
|
838
|
+
return /* @__PURE__ */ jsxs8(
|
|
839
|
+
"div",
|
|
840
|
+
{
|
|
841
|
+
className: cn("fractal-slider", disabled && "fractal-slider--disabled", className),
|
|
842
|
+
"data-disabled": disabled || void 0,
|
|
843
|
+
"data-knobs": knobs,
|
|
844
|
+
children: [
|
|
845
|
+
showValues && /* @__PURE__ */ jsxs8("div", { className: "fractal-slider-values", "aria-hidden": "true", children: [
|
|
846
|
+
/* @__PURE__ */ jsx8("output", { children: formatValue(firstValue) }),
|
|
847
|
+
knobs === 2 && /* @__PURE__ */ jsx8("output", { children: formatValue(secondValue) })
|
|
848
|
+
] }),
|
|
849
|
+
/* @__PURE__ */ jsxs8(
|
|
850
|
+
"div",
|
|
851
|
+
{
|
|
852
|
+
className: "fractal-slider-control",
|
|
853
|
+
style: {
|
|
854
|
+
"--fractal-slider-selection-start": `${selectionStartPercent}%`,
|
|
855
|
+
"--fractal-slider-selection-end": `${selectionEndPercent}%`
|
|
856
|
+
},
|
|
857
|
+
children: [
|
|
858
|
+
/* @__PURE__ */ jsx8("span", { className: "fractal-slider-track", "aria-hidden": "true" }),
|
|
859
|
+
/* @__PURE__ */ jsx8("span", { className: "fractal-slider-selection", "aria-hidden": "true" }),
|
|
860
|
+
/* @__PURE__ */ jsx8(
|
|
861
|
+
"input",
|
|
862
|
+
{
|
|
863
|
+
"aria-label": knobs === 2 ? props.lowerAriaLabel ?? "Lower value" : props.ariaLabel ?? "Slider value",
|
|
864
|
+
disabled,
|
|
865
|
+
max,
|
|
866
|
+
min,
|
|
867
|
+
onChange: (event) => {
|
|
868
|
+
const nextValue = event.currentTarget.valueAsNumber;
|
|
869
|
+
if (knobs === 2) changeRangeValue(Math.min(nextValue, secondValue), secondValue);
|
|
870
|
+
else changeSingleValue(nextValue);
|
|
871
|
+
},
|
|
872
|
+
step,
|
|
873
|
+
type: "range",
|
|
874
|
+
value: firstValue
|
|
875
|
+
}
|
|
876
|
+
),
|
|
877
|
+
knobs === 2 && /* @__PURE__ */ jsx8(
|
|
878
|
+
"input",
|
|
879
|
+
{
|
|
880
|
+
"aria-label": props.upperAriaLabel ?? "Upper value",
|
|
881
|
+
disabled,
|
|
882
|
+
max,
|
|
883
|
+
min,
|
|
884
|
+
onChange: (event) => {
|
|
885
|
+
const nextValue = event.currentTarget.valueAsNumber;
|
|
886
|
+
changeRangeValue(firstValue, Math.max(nextValue, firstValue));
|
|
887
|
+
},
|
|
888
|
+
step,
|
|
889
|
+
type: "range",
|
|
890
|
+
value: secondValue
|
|
891
|
+
}
|
|
892
|
+
)
|
|
893
|
+
]
|
|
894
|
+
}
|
|
895
|
+
)
|
|
896
|
+
]
|
|
897
|
+
}
|
|
898
|
+
);
|
|
899
|
+
}
|
|
900
|
+
function clamp(value, minimum, maximum) {
|
|
901
|
+
return Math.min(maximum, Math.max(minimum, value));
|
|
902
|
+
}
|
|
903
|
+
|
|
806
904
|
// src/components/PasswordInput/PasswordInput.tsx
|
|
807
905
|
import * as React7 from "react";
|
|
808
906
|
import { Eye, EyeSlash } from "@mirror-physics/fractal-icons";
|
|
809
|
-
import { jsx as
|
|
907
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
810
908
|
var PasswordInput = React7.forwardRef(
|
|
811
909
|
({
|
|
812
910
|
className,
|
|
@@ -817,13 +915,13 @@ var PasswordInput = React7.forwardRef(
|
|
|
817
915
|
}, ref) => {
|
|
818
916
|
const [passwordVisible, setPasswordVisible] = React7.useState(false);
|
|
819
917
|
const toggleLabel = passwordVisible ? hidePasswordLabel : showPasswordLabel;
|
|
820
|
-
return /* @__PURE__ */
|
|
918
|
+
return /* @__PURE__ */ jsxs9(
|
|
821
919
|
"div",
|
|
822
920
|
{
|
|
823
921
|
className: cn("fractal-password-input", className),
|
|
824
922
|
"data-password-visible": passwordVisible ? "" : void 0,
|
|
825
923
|
children: [
|
|
826
|
-
/* @__PURE__ */
|
|
924
|
+
/* @__PURE__ */ jsx9(
|
|
827
925
|
Input,
|
|
828
926
|
{
|
|
829
927
|
...props,
|
|
@@ -833,7 +931,7 @@ var PasswordInput = React7.forwardRef(
|
|
|
833
931
|
type: passwordVisible ? "text" : "password"
|
|
834
932
|
}
|
|
835
933
|
),
|
|
836
|
-
/* @__PURE__ */
|
|
934
|
+
/* @__PURE__ */ jsx9(
|
|
837
935
|
"button",
|
|
838
936
|
{
|
|
839
937
|
type: "button",
|
|
@@ -843,7 +941,7 @@ var PasswordInput = React7.forwardRef(
|
|
|
843
941
|
disabled,
|
|
844
942
|
title: toggleLabel,
|
|
845
943
|
onClick: () => setPasswordVisible((visible) => !visible),
|
|
846
|
-
children: passwordVisible ? /* @__PURE__ */
|
|
944
|
+
children: passwordVisible ? /* @__PURE__ */ jsx9(EyeSlash, { "aria-hidden": "true", size: 18 }) : /* @__PURE__ */ jsx9(Eye, { "aria-hidden": "true", size: 18 })
|
|
847
945
|
}
|
|
848
946
|
)
|
|
849
947
|
]
|
|
@@ -855,9 +953,9 @@ PasswordInput.displayName = "PasswordInput";
|
|
|
855
953
|
|
|
856
954
|
// src/components/Label/Label.tsx
|
|
857
955
|
import * as React8 from "react";
|
|
858
|
-
import { jsx as
|
|
956
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
859
957
|
var Label = React8.forwardRef(
|
|
860
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
958
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
861
959
|
"label",
|
|
862
960
|
{
|
|
863
961
|
ref,
|
|
@@ -871,7 +969,7 @@ Label.displayName = "Label";
|
|
|
871
969
|
// src/components/Alert/Alert.tsx
|
|
872
970
|
import * as React9 from "react";
|
|
873
971
|
import { CircleCheck, CircleClose, CircleInfo, Warning } from "@mirror-physics/fractal-icons";
|
|
874
|
-
import { jsx as
|
|
972
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
875
973
|
var defaultIcons = {
|
|
876
974
|
default: CircleInfo,
|
|
877
975
|
info: CircleInfo,
|
|
@@ -882,7 +980,7 @@ var defaultIcons = {
|
|
|
882
980
|
var Alert = React9.forwardRef(
|
|
883
981
|
({ className, variant = "default", icon, children, ...props }, ref) => {
|
|
884
982
|
const DefaultIcon = defaultIcons[variant];
|
|
885
|
-
return /* @__PURE__ */
|
|
983
|
+
return /* @__PURE__ */ jsxs10(
|
|
886
984
|
"div",
|
|
887
985
|
{
|
|
888
986
|
ref,
|
|
@@ -890,8 +988,8 @@ var Alert = React9.forwardRef(
|
|
|
890
988
|
className: cn("fractal-alert", `fractal-alert--${variant}`, className),
|
|
891
989
|
...props,
|
|
892
990
|
children: [
|
|
893
|
-
/* @__PURE__ */
|
|
894
|
-
/* @__PURE__ */
|
|
991
|
+
/* @__PURE__ */ jsx11("span", { className: "fractal-alert-icon", "aria-hidden": true, children: icon ?? /* @__PURE__ */ jsx11(DefaultIcon, { size: 18 }) }),
|
|
992
|
+
/* @__PURE__ */ jsx11("div", { className: "fractal-alert-content", children })
|
|
895
993
|
]
|
|
896
994
|
}
|
|
897
995
|
);
|
|
@@ -899,18 +997,18 @@ var Alert = React9.forwardRef(
|
|
|
899
997
|
);
|
|
900
998
|
Alert.displayName = "Alert";
|
|
901
999
|
var AlertTitle = React9.forwardRef(
|
|
902
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1000
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx11("h5", { ref, className: cn("fractal-alert-title", className), ...props })
|
|
903
1001
|
);
|
|
904
1002
|
AlertTitle.displayName = "AlertTitle";
|
|
905
1003
|
var AlertDescription = React9.forwardRef(
|
|
906
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1004
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx11("div", { ref, className: cn("fractal-alert-description", className), ...props })
|
|
907
1005
|
);
|
|
908
1006
|
AlertDescription.displayName = "AlertDescription";
|
|
909
1007
|
|
|
910
1008
|
// src/components/Toggle/Toggle.tsx
|
|
911
|
-
import { jsx as
|
|
1009
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
912
1010
|
function Toggle({ checked, onChange, label, className }) {
|
|
913
|
-
return /* @__PURE__ */
|
|
1011
|
+
return /* @__PURE__ */ jsxs11(
|
|
914
1012
|
"button",
|
|
915
1013
|
{
|
|
916
1014
|
type: "button",
|
|
@@ -919,8 +1017,8 @@ function Toggle({ checked, onChange, label, className }) {
|
|
|
919
1017
|
className: cn("fractal-toggle", className),
|
|
920
1018
|
onClick: () => onChange(!checked),
|
|
921
1019
|
children: [
|
|
922
|
-
/* @__PURE__ */
|
|
923
|
-
label && /* @__PURE__ */
|
|
1020
|
+
/* @__PURE__ */ jsx12("span", { className: cn("fractal-toggle-track", checked && "fractal-toggle-track--checked"), children: /* @__PURE__ */ jsx12("span", { className: cn("fractal-toggle-thumb", checked && "fractal-toggle-thumb--checked") }) }),
|
|
1021
|
+
label && /* @__PURE__ */ jsx12("span", { className: "fractal-toggle-label", children: label })
|
|
924
1022
|
]
|
|
925
1023
|
}
|
|
926
1024
|
);
|
|
@@ -982,7 +1080,7 @@ function useEscapeDismiss(priority, handler, enabled = true) {
|
|
|
982
1080
|
|
|
983
1081
|
// src/components/UILoader/UILoader.tsx
|
|
984
1082
|
import { useId } from "react";
|
|
985
|
-
import { jsx as
|
|
1083
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
986
1084
|
var LEFT = "M0 53C0 51 1.6 49.5 3.6 49.5h16.5c1 0 1.9.4 2.5 1L42.1 69.6c.7.7 1.1 1.6 1.1 2.5v16.2c0 2-1.6 3.5-3.6 3.5H23.1c-1 0-1.9-.4-2.5-1L1.1 71.7C.4 71 0 70.1 0 69.2V53Z";
|
|
987
1085
|
var CENTER = "M0 3.5C0 1.6 1.6 0 3.6 0h16.5c1 0 1.9.4 2.5 1L92.5 69.6c.7.7 1 1.6 1 2.5v16.2c0 2-1.6 3.5-3.6 3.5H73.4c-1 0-1.9-.4-2.5-1L1.1 22.2C.4 21.6 0 20.7 0 19.7V3.5Z";
|
|
988
1086
|
var RIGHT = "M50.4 3.5C50.4 1.6 52 0 54 0h16.5c1 0 1.9.4 2.5 1l69.8 68.6c.7.7 1.1 1.6 1.1 2.5v16.2c0 2-1.6 3.5-3.6 3.5h-16.5c-1 0-1.9-.4-2.5-1L51.4 22.2c-.7-.6-1-1.5-1-2.5V3.5Z";
|
|
@@ -991,7 +1089,7 @@ function UILoader({ size = 48, tone = "neutral", className, style, label = "Load
|
|
|
991
1089
|
const clipId = `fractal-ui-loader-clip-${rawId}`;
|
|
992
1090
|
const gradientId = `fractal-ui-loader-gradient-${rawId}`;
|
|
993
1091
|
const height = typeof size === "number" ? `${size}px` : size;
|
|
994
|
-
return /* @__PURE__ */
|
|
1092
|
+
return /* @__PURE__ */ jsx13(
|
|
995
1093
|
"span",
|
|
996
1094
|
{
|
|
997
1095
|
"aria-hidden": ariaHidden || void 0,
|
|
@@ -999,35 +1097,35 @@ function UILoader({ size = 48, tone = "neutral", className, style, label = "Load
|
|
|
999
1097
|
className: cn("fractal-ui-loader", `fractal-ui-loader--${tone}`, className),
|
|
1000
1098
|
role: ariaHidden ? void 0 : "status",
|
|
1001
1099
|
style,
|
|
1002
|
-
children: /* @__PURE__ */
|
|
1003
|
-
/* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1006
|
-
/* @__PURE__ */
|
|
1100
|
+
children: /* @__PURE__ */ jsxs12("svg", { "aria-hidden": "true", fill: "none", viewBox: "0 0 144 92", style: { height, width: "auto" }, children: [
|
|
1101
|
+
/* @__PURE__ */ jsxs12("defs", { children: [
|
|
1102
|
+
/* @__PURE__ */ jsxs12("linearGradient", { id: gradientId, x1: "59", x2: "94.3", y1: "0", y2: "89.1", gradientUnits: "userSpaceOnUse", children: [
|
|
1103
|
+
/* @__PURE__ */ jsx13("stop", { className: "fractal-ui-loader__stop-start", offset: "0" }),
|
|
1104
|
+
/* @__PURE__ */ jsx13("stop", { className: "fractal-ui-loader__stop-end", offset: "1" })
|
|
1007
1105
|
] }),
|
|
1008
|
-
/* @__PURE__ */
|
|
1009
|
-
/* @__PURE__ */
|
|
1010
|
-
/* @__PURE__ */
|
|
1011
|
-
/* @__PURE__ */
|
|
1106
|
+
/* @__PURE__ */ jsxs12("linearGradient", { id: `${gradientId}-shine`, x1: "0", x2: "1", y1: "0", y2: "0", children: [
|
|
1107
|
+
/* @__PURE__ */ jsx13("stop", { offset: "0.4", stopColor: "white", stopOpacity: "0" }),
|
|
1108
|
+
/* @__PURE__ */ jsx13("stop", { offset: "0.5", stopColor: "white", stopOpacity: "0.62" }),
|
|
1109
|
+
/* @__PURE__ */ jsx13("stop", { offset: "0.6", stopColor: "white", stopOpacity: "0" })
|
|
1012
1110
|
] }),
|
|
1013
|
-
/* @__PURE__ */
|
|
1014
|
-
/* @__PURE__ */
|
|
1015
|
-
/* @__PURE__ */
|
|
1016
|
-
/* @__PURE__ */
|
|
1111
|
+
/* @__PURE__ */ jsxs12("clipPath", { id: clipId, children: [
|
|
1112
|
+
/* @__PURE__ */ jsx13("path", { d: LEFT }),
|
|
1113
|
+
/* @__PURE__ */ jsx13("path", { d: CENTER }),
|
|
1114
|
+
/* @__PURE__ */ jsx13("path", { d: RIGHT })
|
|
1017
1115
|
] })
|
|
1018
1116
|
] }),
|
|
1019
|
-
/* @__PURE__ */
|
|
1020
|
-
/* @__PURE__ */
|
|
1021
|
-
/* @__PURE__ */
|
|
1022
|
-
/* @__PURE__ */
|
|
1117
|
+
/* @__PURE__ */ jsx13("path", { d: CENTER, fill: `url(#${gradientId})` }),
|
|
1118
|
+
/* @__PURE__ */ jsx13("path", { d: RIGHT, fill: `url(#${gradientId})` }),
|
|
1119
|
+
/* @__PURE__ */ jsx13("path", { d: LEFT, fill: `url(#${gradientId})` }),
|
|
1120
|
+
/* @__PURE__ */ jsx13("g", { clipPath: `url(#${clipId})`, children: /* @__PURE__ */ jsx13("g", { className: "fractal-ui-loader__shine-axis", transform: "translate(72 46) rotate(68.4)", children: /* @__PURE__ */ jsx13("rect", { className: "fractal-ui-loader__shine", x: "-160", y: "-100", width: "320", height: "200", fill: `url(#${gradientId}-shine)` }) }) })
|
|
1023
1121
|
] })
|
|
1024
1122
|
}
|
|
1025
1123
|
);
|
|
1026
1124
|
}
|
|
1027
1125
|
|
|
1028
1126
|
// src/components/Modal/Modal.tsx
|
|
1029
|
-
import { jsx as
|
|
1030
|
-
var CloseIcon = () => /* @__PURE__ */
|
|
1127
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1128
|
+
var CloseIcon = () => /* @__PURE__ */ jsx14("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx14("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1031
1129
|
function Modal({ open, onClose, title, children, danger, warn, footer, noClose, closeDisabled = false, size = "sm", loading = false, loadingLabel = "Loading", scrollable = false, className }) {
|
|
1032
1130
|
const [bodyScrolled, setBodyScrolled] = React10.useState(false);
|
|
1033
1131
|
useEscapeDismiss(80, onClose, open && !noClose && !closeDisabled);
|
|
@@ -1038,13 +1136,13 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
1038
1136
|
const sizeClass = `fractal-modal-panel--${size}`;
|
|
1039
1137
|
const accentClass = danger ? "fractal-modal-panel--danger" : warn ? "fractal-modal-panel--warn" : "";
|
|
1040
1138
|
return createPortal(
|
|
1041
|
-
/* @__PURE__ */
|
|
1139
|
+
/* @__PURE__ */ jsx14("div", { className: "fractal-modal-overlay", onClick: noClose || closeDisabled ? void 0 : onClose, children: /* @__PURE__ */ jsxs13(
|
|
1042
1140
|
"div",
|
|
1043
1141
|
{
|
|
1044
1142
|
className: cn("fractal-modal-panel", sizeClass, accentClass, scrollable && "fractal-modal-panel--scrollable", className),
|
|
1045
1143
|
onClick: (e) => e.stopPropagation(),
|
|
1046
1144
|
children: [
|
|
1047
|
-
/* @__PURE__ */
|
|
1145
|
+
/* @__PURE__ */ jsxs13(
|
|
1048
1146
|
"div",
|
|
1049
1147
|
{
|
|
1050
1148
|
className: cn(
|
|
@@ -1053,12 +1151,12 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
1053
1151
|
scrollable && bodyScrolled && "fractal-modal-title-row--scrolled"
|
|
1054
1152
|
),
|
|
1055
1153
|
children: [
|
|
1056
|
-
/* @__PURE__ */
|
|
1057
|
-
!noClose && /* @__PURE__ */
|
|
1154
|
+
/* @__PURE__ */ jsx14("h3", { className: cn("fractal-modal-title", danger && "fractal-modal-title--danger", warn && "fractal-modal-title--warn"), children: title }),
|
|
1155
|
+
!noClose && /* @__PURE__ */ jsx14("button", { type: "button", onClick: onClose, title: "Close", disabled: closeDisabled, className: "fractal-modal-close", children: /* @__PURE__ */ jsx14(CloseIcon, {}) })
|
|
1058
1156
|
]
|
|
1059
1157
|
}
|
|
1060
1158
|
),
|
|
1061
|
-
/* @__PURE__ */
|
|
1159
|
+
/* @__PURE__ */ jsx14(
|
|
1062
1160
|
"div",
|
|
1063
1161
|
{
|
|
1064
1162
|
"aria-busy": loading || void 0,
|
|
@@ -1069,10 +1167,10 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
1069
1167
|
scrollable && "fractal-modal-body--scrollable"
|
|
1070
1168
|
),
|
|
1071
1169
|
onScroll: scrollable ? (event) => setBodyScrolled(event.currentTarget.scrollTop > 0) : void 0,
|
|
1072
|
-
children: loading ? /* @__PURE__ */
|
|
1170
|
+
children: loading ? /* @__PURE__ */ jsx14(UILoader, { label: loadingLabel }) : children
|
|
1073
1171
|
}
|
|
1074
1172
|
),
|
|
1075
|
-
footer && /* @__PURE__ */
|
|
1173
|
+
footer && /* @__PURE__ */ jsx14("div", { className: cn("fractal-modal-footer", scrollable && "fractal-modal-footer--divided"), children: footer })
|
|
1076
1174
|
]
|
|
1077
1175
|
}
|
|
1078
1176
|
) }),
|
|
@@ -1081,17 +1179,17 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
1081
1179
|
}
|
|
1082
1180
|
|
|
1083
1181
|
// src/components/DataTable/DataTable.tsx
|
|
1084
|
-
import { jsx as
|
|
1182
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1085
1183
|
function DataTable({ columns, data, emptyMessage, header, size = "md", className }) {
|
|
1086
|
-
return /* @__PURE__ */
|
|
1087
|
-
header && /* @__PURE__ */
|
|
1088
|
-
data.length === 0 ? /* @__PURE__ */
|
|
1089
|
-
/* @__PURE__ */
|
|
1090
|
-
/* @__PURE__ */
|
|
1184
|
+
return /* @__PURE__ */ jsx15("div", { className: cn("fractal-datatable", `fractal-datatable--${size}`, className), children: /* @__PURE__ */ jsxs14("div", { className: "fractal-datatable-surface", children: [
|
|
1185
|
+
header && /* @__PURE__ */ jsx15("div", { className: "fractal-datatable-header", children: header }),
|
|
1186
|
+
data.length === 0 ? /* @__PURE__ */ jsx15("div", { className: "fractal-datatable-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ jsxs14("table", { className: "fractal-datatable-table", children: [
|
|
1187
|
+
/* @__PURE__ */ jsx15("thead", { children: /* @__PURE__ */ jsx15("tr", { className: "fractal-datatable-thead-row", children: columns.map((col) => /* @__PURE__ */ jsx15("th", { className: "fractal-datatable-th", style: { width: col.width }, children: col.header }, col.key)) }) }),
|
|
1188
|
+
/* @__PURE__ */ jsx15("tbody", { children: data.map((row, rowIndex) => /* @__PURE__ */ jsx15(
|
|
1091
1189
|
"tr",
|
|
1092
1190
|
{
|
|
1093
1191
|
className: "fractal-datatable-row",
|
|
1094
|
-
children: columns.map((col) => /* @__PURE__ */
|
|
1192
|
+
children: columns.map((col) => /* @__PURE__ */ jsx15("td", { className: "fractal-datatable-td", style: { width: col.width }, children: col.render(row, rowIndex) }, col.key))
|
|
1095
1193
|
},
|
|
1096
1194
|
rowIndex
|
|
1097
1195
|
)) })
|
|
@@ -1102,7 +1200,7 @@ function DataTable({ columns, data, emptyMessage, header, size = "md", className
|
|
|
1102
1200
|
// src/components/Dropdown/Dropdown.tsx
|
|
1103
1201
|
import * as React11 from "react";
|
|
1104
1202
|
import { ChevronDown, ChevronLeft, ChevronRight as ChevronRight2, ChevronUp } from "@mirror-physics/fractal-icons";
|
|
1105
|
-
import { Fragment as Fragment2, jsx as
|
|
1203
|
+
import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1106
1204
|
var MARGIN = 4;
|
|
1107
1205
|
function Dropdown({
|
|
1108
1206
|
items,
|
|
@@ -1198,8 +1296,8 @@ function Dropdown({
|
|
|
1198
1296
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1199
1297
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1200
1298
|
}, [open]);
|
|
1201
|
-
return /* @__PURE__ */
|
|
1202
|
-
/* @__PURE__ */
|
|
1299
|
+
return /* @__PURE__ */ jsxs15("div", { className: cn("fractal-dropdown", className), children: [
|
|
1300
|
+
/* @__PURE__ */ jsxs15(
|
|
1203
1301
|
"button",
|
|
1204
1302
|
{
|
|
1205
1303
|
ref: triggerRef,
|
|
@@ -1218,15 +1316,15 @@ function Dropdown({
|
|
|
1218
1316
|
triggerClassName
|
|
1219
1317
|
),
|
|
1220
1318
|
children: [
|
|
1221
|
-
triggerContent != null ? triggerContent : /* @__PURE__ */
|
|
1222
|
-
selected.icon != null && /* @__PURE__ */
|
|
1223
|
-
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */
|
|
1319
|
+
triggerContent != null ? triggerContent : /* @__PURE__ */ jsxs15(Fragment2, { children: [
|
|
1320
|
+
selected.icon != null && /* @__PURE__ */ jsx16("span", { className: "fractal-dropdown-icon fractal-dropdown-icon--trigger", children: selected.icon }),
|
|
1321
|
+
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */ jsx16("span", { className: "fractal-dropdown-selected-text", children: selected.description })
|
|
1224
1322
|
] }),
|
|
1225
|
-
!noChevron && !iconOnly && /* @__PURE__ */
|
|
1323
|
+
!noChevron && !iconOnly && /* @__PURE__ */ jsx16("span", { className: "fractal-dropdown-chevron", "aria-hidden": true, children: /* @__PURE__ */ jsx16(ChevronIcon, { size: size === "sm" ? 14 : 16 }) })
|
|
1226
1324
|
]
|
|
1227
1325
|
}
|
|
1228
1326
|
),
|
|
1229
|
-
open && /* @__PURE__ */
|
|
1327
|
+
open && /* @__PURE__ */ jsxs15(
|
|
1230
1328
|
"div",
|
|
1231
1329
|
{
|
|
1232
1330
|
ref: panelRef,
|
|
@@ -1235,21 +1333,21 @@ function Dropdown({
|
|
|
1235
1333
|
className: cn("fractal-dropdown-panel", `fractal-dropdown-panel--${size}`, panelClassName),
|
|
1236
1334
|
style: panelStyle,
|
|
1237
1335
|
children: [
|
|
1238
|
-
label != null && /* @__PURE__ */
|
|
1336
|
+
label != null && /* @__PURE__ */ jsx16("div", { className: "fractal-dropdown-label", children: label }),
|
|
1239
1337
|
visibleItems.map((item, index) => {
|
|
1240
|
-
const topDivider = item.border === "top" ? /* @__PURE__ */
|
|
1241
|
-
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */
|
|
1338
|
+
const topDivider = item.border === "top" ? /* @__PURE__ */ jsx16("div", { className: "fractal-dropdown-separator" }) : null;
|
|
1339
|
+
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */ jsx16("div", { className: "fractal-dropdown-separator" }) : null;
|
|
1242
1340
|
if (item.kind === "header") {
|
|
1243
|
-
return /* @__PURE__ */
|
|
1341
|
+
return /* @__PURE__ */ jsxs15(React11.Fragment, { children: [
|
|
1244
1342
|
topDivider,
|
|
1245
|
-
/* @__PURE__ */
|
|
1343
|
+
/* @__PURE__ */ jsx16("div", { role: "presentation", className: "fractal-dropdown-label", children: item.description }),
|
|
1246
1344
|
bottomDivider
|
|
1247
1345
|
] }, `header-${index}`);
|
|
1248
1346
|
}
|
|
1249
1347
|
const isSelected = item.value === selectedValue;
|
|
1250
|
-
return /* @__PURE__ */
|
|
1348
|
+
return /* @__PURE__ */ jsxs15(React11.Fragment, { children: [
|
|
1251
1349
|
topDivider,
|
|
1252
|
-
/* @__PURE__ */
|
|
1350
|
+
/* @__PURE__ */ jsxs15(
|
|
1253
1351
|
"button",
|
|
1254
1352
|
{
|
|
1255
1353
|
type: "button",
|
|
@@ -1261,9 +1359,9 @@ function Dropdown({
|
|
|
1261
1359
|
},
|
|
1262
1360
|
className: "fractal-dropdown-option",
|
|
1263
1361
|
children: [
|
|
1264
|
-
item.icon != null && /* @__PURE__ */
|
|
1265
|
-
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */
|
|
1266
|
-
item.trailing != null && /* @__PURE__ */
|
|
1362
|
+
item.icon != null && /* @__PURE__ */ jsx16("span", { className: "fractal-dropdown-icon", children: item.icon }),
|
|
1363
|
+
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */ jsx16("span", { className: "fractal-dropdown-option-text", children: item.description }),
|
|
1364
|
+
item.trailing != null && /* @__PURE__ */ jsx16("span", { className: "fractal-dropdown-trailing", children: item.trailing })
|
|
1267
1365
|
]
|
|
1268
1366
|
}
|
|
1269
1367
|
),
|
|
@@ -1278,9 +1376,9 @@ function Dropdown({
|
|
|
1278
1376
|
|
|
1279
1377
|
// src/components/Link/Link.tsx
|
|
1280
1378
|
import * as React12 from "react";
|
|
1281
|
-
import { jsx as
|
|
1379
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1282
1380
|
var Link = React12.forwardRef(
|
|
1283
|
-
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */
|
|
1381
|
+
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
1284
1382
|
"a",
|
|
1285
1383
|
{
|
|
1286
1384
|
ref,
|
|
@@ -1293,9 +1391,9 @@ Link.displayName = "Link";
|
|
|
1293
1391
|
|
|
1294
1392
|
// src/components/Chip/Chip.tsx
|
|
1295
1393
|
import * as React13 from "react";
|
|
1296
|
-
import { jsx as
|
|
1394
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1297
1395
|
var Chip = React13.forwardRef(
|
|
1298
|
-
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */
|
|
1396
|
+
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
1299
1397
|
"span",
|
|
1300
1398
|
{
|
|
1301
1399
|
ref,
|
|
@@ -1308,7 +1406,7 @@ Chip.displayName = "Chip";
|
|
|
1308
1406
|
|
|
1309
1407
|
// src/components/Checkbox/Checkbox.tsx
|
|
1310
1408
|
import { Checkbox as CheckboxIcon, CheckboxChecked, Minus as Minus2 } from "@mirror-physics/fractal-icons";
|
|
1311
|
-
import { jsx as
|
|
1409
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1312
1410
|
function Checkbox({
|
|
1313
1411
|
checked,
|
|
1314
1412
|
indeterminate = false,
|
|
@@ -1319,7 +1417,7 @@ function Checkbox({
|
|
|
1319
1417
|
onKeyDown,
|
|
1320
1418
|
...props
|
|
1321
1419
|
}) {
|
|
1322
|
-
return /* @__PURE__ */
|
|
1420
|
+
return /* @__PURE__ */ jsx19(
|
|
1323
1421
|
"button",
|
|
1324
1422
|
{
|
|
1325
1423
|
...props,
|
|
@@ -1341,10 +1439,10 @@ function Checkbox({
|
|
|
1341
1439
|
onKeyDown?.(event);
|
|
1342
1440
|
if (event.key === " " || event.key === "Enter") event.stopPropagation();
|
|
1343
1441
|
},
|
|
1344
|
-
children: indeterminate ? /* @__PURE__ */
|
|
1345
|
-
/* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */
|
|
1347
|
-
] }) : checked ? /* @__PURE__ */
|
|
1442
|
+
children: indeterminate ? /* @__PURE__ */ jsxs16("span", { className: "fractal-checkbox__indeterminate-icon", "aria-hidden": "true", children: [
|
|
1443
|
+
/* @__PURE__ */ jsx19(CheckboxIcon, { size: 18 }),
|
|
1444
|
+
/* @__PURE__ */ jsx19(Minus2, { className: "fractal-checkbox__indeterminate-mark", size: 12 })
|
|
1445
|
+
] }) : checked ? /* @__PURE__ */ jsx19(CheckboxChecked, { "aria-hidden": "true", size: 18 }) : /* @__PURE__ */ jsx19(CheckboxIcon, { "aria-hidden": "true", size: 18 })
|
|
1348
1446
|
}
|
|
1349
1447
|
);
|
|
1350
1448
|
}
|
|
@@ -1352,7 +1450,7 @@ function Checkbox({
|
|
|
1352
1450
|
// src/components/SortableTable/SortableTable.tsx
|
|
1353
1451
|
import { useMemo as useMemo2, useState as useState6 } from "react";
|
|
1354
1452
|
import { ArrowUp, ArrowDown, ArrowsUpDown } from "@mirror-physics/fractal-icons";
|
|
1355
|
-
import { jsx as
|
|
1453
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1356
1454
|
function SortableTable({
|
|
1357
1455
|
columns,
|
|
1358
1456
|
data,
|
|
@@ -1447,16 +1545,16 @@ function SortableTable({
|
|
|
1447
1545
|
onSortChange?.(nextKey, nextDirection);
|
|
1448
1546
|
}
|
|
1449
1547
|
};
|
|
1450
|
-
return /* @__PURE__ */
|
|
1451
|
-
header && /* @__PURE__ */
|
|
1452
|
-
visibleRows.length === 0 ? /* @__PURE__ */
|
|
1453
|
-
/* @__PURE__ */
|
|
1454
|
-
selection && /* @__PURE__ */
|
|
1548
|
+
return /* @__PURE__ */ jsx20("div", { className: cn("fractal-sortable-table", `fractal-sortable-table--${size}`, embedded && "fractal-sortable-table--embedded", className), children: /* @__PURE__ */ jsxs17("div", { className: "fractal-sortable-table-surface", children: [
|
|
1549
|
+
header && /* @__PURE__ */ jsx20("div", { className: "fractal-sortable-table-header", children: header }),
|
|
1550
|
+
visibleRows.length === 0 ? /* @__PURE__ */ jsx20("div", { className: "fractal-sortable-table-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ jsxs17("table", { "aria-label": ariaLabel, className: "fractal-sortable-table-table", children: [
|
|
1551
|
+
/* @__PURE__ */ jsx20("thead", { children: /* @__PURE__ */ jsxs17("tr", { className: "fractal-sortable-table-thead-row", children: [
|
|
1552
|
+
selection && /* @__PURE__ */ jsx20(
|
|
1455
1553
|
"th",
|
|
1456
1554
|
{
|
|
1457
1555
|
className: "fractal-sortable-table-th fractal-sortable-table-selection-cell",
|
|
1458
1556
|
scope: "col",
|
|
1459
|
-
children: /* @__PURE__ */
|
|
1557
|
+
children: /* @__PURE__ */ jsx20(
|
|
1460
1558
|
Checkbox,
|
|
1461
1559
|
{
|
|
1462
1560
|
"aria-label": selection.selectAllLabel ?? "Select all rows",
|
|
@@ -1482,7 +1580,7 @@ function SortableTable({
|
|
|
1482
1580
|
columns.map((col) => {
|
|
1483
1581
|
const isActive = activeKey === col.key && activeDirection !== null;
|
|
1484
1582
|
if (!col.sortable) {
|
|
1485
|
-
return /* @__PURE__ */
|
|
1583
|
+
return /* @__PURE__ */ jsx20(
|
|
1486
1584
|
"th",
|
|
1487
1585
|
{
|
|
1488
1586
|
className: "fractal-sortable-table-th",
|
|
@@ -1493,13 +1591,13 @@ function SortableTable({
|
|
|
1493
1591
|
col.key
|
|
1494
1592
|
);
|
|
1495
1593
|
}
|
|
1496
|
-
return /* @__PURE__ */
|
|
1594
|
+
return /* @__PURE__ */ jsx20(
|
|
1497
1595
|
"th",
|
|
1498
1596
|
{
|
|
1499
1597
|
className: "fractal-sortable-table-th fractal-sortable-table-th--sortable",
|
|
1500
1598
|
scope: "col",
|
|
1501
1599
|
style: { width: col.width },
|
|
1502
|
-
children: /* @__PURE__ */
|
|
1600
|
+
children: /* @__PURE__ */ jsxs17(
|
|
1503
1601
|
"button",
|
|
1504
1602
|
{
|
|
1505
1603
|
type: "button",
|
|
@@ -1510,8 +1608,8 @@ function SortableTable({
|
|
|
1510
1608
|
onClick: () => handleSortClick(col.key),
|
|
1511
1609
|
"aria-sort": isActive ? activeDirection === "asc" ? "ascending" : "descending" : "none",
|
|
1512
1610
|
children: [
|
|
1513
|
-
/* @__PURE__ */
|
|
1514
|
-
/* @__PURE__ */
|
|
1611
|
+
/* @__PURE__ */ jsx20("span", { children: col.header }),
|
|
1612
|
+
/* @__PURE__ */ jsx20("span", { className: "fractal-sortable-table-sort-icon", "aria-hidden": "true", children: isActive && activeDirection === "asc" ? /* @__PURE__ */ jsx20(ArrowUp, { size: 14 }) : isActive && activeDirection === "desc" ? /* @__PURE__ */ jsx20(ArrowDown, { size: 14 }) : /* @__PURE__ */ jsx20(ArrowsUpDown, { size: 14 }) })
|
|
1515
1613
|
]
|
|
1516
1614
|
}
|
|
1517
1615
|
)
|
|
@@ -1520,7 +1618,7 @@ function SortableTable({
|
|
|
1520
1618
|
);
|
|
1521
1619
|
})
|
|
1522
1620
|
] }) }),
|
|
1523
|
-
/* @__PURE__ */
|
|
1621
|
+
/* @__PURE__ */ jsx20("tbody", { children: visibleRows.map((row, rowIndex) => {
|
|
1524
1622
|
const highlighted = highlightRow?.(row, rowIndex) ?? false;
|
|
1525
1623
|
const disabled = isRowDisabled?.(row) ?? false;
|
|
1526
1624
|
const selectionDisabled = disabled || (isRowSelectionDisabled?.(row) ?? false);
|
|
@@ -1529,7 +1627,7 @@ function SortableTable({
|
|
|
1529
1627
|
label: rowAction.label(row, rowIndex),
|
|
1530
1628
|
icon: rowAction.icon(row, rowIndex)
|
|
1531
1629
|
} : null;
|
|
1532
|
-
return /* @__PURE__ */
|
|
1630
|
+
return /* @__PURE__ */ jsxs17(
|
|
1533
1631
|
"tr",
|
|
1534
1632
|
{
|
|
1535
1633
|
className: cn(
|
|
@@ -1553,7 +1651,7 @@ function SortableTable({
|
|
|
1553
1651
|
role: interactive ? "button" : void 0,
|
|
1554
1652
|
tabIndex: interactive ? 0 : void 0,
|
|
1555
1653
|
children: [
|
|
1556
|
-
selection && /* @__PURE__ */
|
|
1654
|
+
selection && /* @__PURE__ */ jsx20("td", { className: "fractal-sortable-table-td fractal-sortable-table-selection-cell", children: /* @__PURE__ */ jsx20(
|
|
1557
1655
|
Checkbox,
|
|
1558
1656
|
{
|
|
1559
1657
|
"aria-label": selection.getRowLabel(row),
|
|
@@ -1565,7 +1663,7 @@ function SortableTable({
|
|
|
1565
1663
|
}
|
|
1566
1664
|
}
|
|
1567
1665
|
) }),
|
|
1568
|
-
columns.map((col, columnIndex) => /* @__PURE__ */
|
|
1666
|
+
columns.map((col, columnIndex) => /* @__PURE__ */ jsxs17(
|
|
1569
1667
|
"td",
|
|
1570
1668
|
{
|
|
1571
1669
|
className: cn(
|
|
@@ -1575,7 +1673,7 @@ function SortableTable({
|
|
|
1575
1673
|
style: { width: col.width, textAlign: col.align ?? "left" },
|
|
1576
1674
|
children: [
|
|
1577
1675
|
col.render(row, rowIndex),
|
|
1578
|
-
action && columnIndex === columns.length - 1 && /* @__PURE__ */
|
|
1676
|
+
action && columnIndex === columns.length - 1 && /* @__PURE__ */ jsx20("span", { className: "fractal-sortable-table-row-action", "aria-hidden": "true", children: /* @__PURE__ */ jsx20("span", { className: "fractal-sortable-table-row-action__icon", children: action.icon }) })
|
|
1579
1677
|
]
|
|
1580
1678
|
},
|
|
1581
1679
|
col.key
|
|
@@ -1591,7 +1689,7 @@ function SortableTable({
|
|
|
1591
1689
|
|
|
1592
1690
|
// src/components/Tabs/Tabs.tsx
|
|
1593
1691
|
import { useId as useId2, useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState7 } from "react";
|
|
1594
|
-
import { jsx as
|
|
1692
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1595
1693
|
function Tabs({
|
|
1596
1694
|
items,
|
|
1597
1695
|
defaultValue,
|
|
@@ -1662,8 +1760,8 @@ function Tabs({
|
|
|
1662
1760
|
selectTab(nextId2);
|
|
1663
1761
|
requestAnimationFrame(() => tabRefs.current[nextId2]?.focus());
|
|
1664
1762
|
};
|
|
1665
|
-
return /* @__PURE__ */
|
|
1666
|
-
/* @__PURE__ */
|
|
1763
|
+
return /* @__PURE__ */ jsxs18("div", { className: cn("fractal-tabs", `fractal-tabs--${variant}`, divider && "fractal-tabs--divider", className), children: [
|
|
1764
|
+
/* @__PURE__ */ jsx21(
|
|
1667
1765
|
"div",
|
|
1668
1766
|
{
|
|
1669
1767
|
ref: tabListRef,
|
|
@@ -1676,7 +1774,7 @@ function Tabs({
|
|
|
1676
1774
|
const isActive = item.id === activeId;
|
|
1677
1775
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
1678
1776
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
1679
|
-
return /* @__PURE__ */
|
|
1777
|
+
return /* @__PURE__ */ jsx21(
|
|
1680
1778
|
"button",
|
|
1681
1779
|
{
|
|
1682
1780
|
ref: (el) => {
|
|
@@ -1707,7 +1805,7 @@ function Tabs({
|
|
|
1707
1805
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
1708
1806
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
1709
1807
|
const isActive = item.id === activeId;
|
|
1710
|
-
return /* @__PURE__ */
|
|
1808
|
+
return /* @__PURE__ */ jsx21(
|
|
1711
1809
|
"div",
|
|
1712
1810
|
{
|
|
1713
1811
|
id: panelId,
|
|
@@ -1725,7 +1823,7 @@ function Tabs({
|
|
|
1725
1823
|
|
|
1726
1824
|
// src/components/ContentSwitcher/ContentSwitcher.tsx
|
|
1727
1825
|
import * as React14 from "react";
|
|
1728
|
-
import { jsx as
|
|
1826
|
+
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1729
1827
|
function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = false, className }) {
|
|
1730
1828
|
const switcherRef = React14.useRef(null);
|
|
1731
1829
|
const buttonRefs = React14.useRef([]);
|
|
@@ -1783,7 +1881,7 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1783
1881
|
onValueChange(items[nextIndex].value);
|
|
1784
1882
|
}
|
|
1785
1883
|
};
|
|
1786
|
-
return /* @__PURE__ */
|
|
1884
|
+
return /* @__PURE__ */ jsxs19(
|
|
1787
1885
|
"div",
|
|
1788
1886
|
{
|
|
1789
1887
|
className: cn("fractal-content-switcher", fullWidth && "fractal-content-switcher--full-width", className),
|
|
@@ -1791,10 +1889,10 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1791
1889
|
"aria-label": ariaLabel,
|
|
1792
1890
|
ref: switcherRef,
|
|
1793
1891
|
children: [
|
|
1794
|
-
/* @__PURE__ */
|
|
1892
|
+
/* @__PURE__ */ jsx22("span", { className: "fractal-content-switcher__indicator", "aria-hidden": true }),
|
|
1795
1893
|
items.map((item, index) => {
|
|
1796
1894
|
const active = item.value === value;
|
|
1797
|
-
return /* @__PURE__ */
|
|
1895
|
+
return /* @__PURE__ */ jsx22(
|
|
1798
1896
|
"button",
|
|
1799
1897
|
{
|
|
1800
1898
|
className: cn("fractal-content-switcher__item", active && "fractal-content-switcher__item--active"),
|
|
@@ -1828,7 +1926,7 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1828
1926
|
// src/components/Disclosure/Disclosure.tsx
|
|
1829
1927
|
import { useId as useId3, useState as useState8 } from "react";
|
|
1830
1928
|
import { ChevronRight as ChevronRight3, ChevronDown as ChevronDown2 } from "@mirror-physics/fractal-icons";
|
|
1831
|
-
import { jsx as
|
|
1929
|
+
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1832
1930
|
function Disclosure({
|
|
1833
1931
|
title,
|
|
1834
1932
|
meta,
|
|
@@ -1856,7 +1954,7 @@ function Disclosure({
|
|
|
1856
1954
|
onOpenChange?.(next);
|
|
1857
1955
|
}
|
|
1858
1956
|
};
|
|
1859
|
-
return /* @__PURE__ */
|
|
1957
|
+
return /* @__PURE__ */ jsxs20(
|
|
1860
1958
|
"div",
|
|
1861
1959
|
{
|
|
1862
1960
|
className: cn(
|
|
@@ -1867,7 +1965,7 @@ function Disclosure({
|
|
|
1867
1965
|
className
|
|
1868
1966
|
),
|
|
1869
1967
|
children: [
|
|
1870
|
-
/* @__PURE__ */
|
|
1968
|
+
/* @__PURE__ */ jsxs20(
|
|
1871
1969
|
"button",
|
|
1872
1970
|
{
|
|
1873
1971
|
type: "button",
|
|
@@ -1878,13 +1976,13 @@ function Disclosure({
|
|
|
1878
1976
|
disabled,
|
|
1879
1977
|
onClick: toggle,
|
|
1880
1978
|
children: [
|
|
1881
|
-
/* @__PURE__ */
|
|
1882
|
-
/* @__PURE__ */
|
|
1883
|
-
meta && /* @__PURE__ */
|
|
1979
|
+
/* @__PURE__ */ jsx23("span", { className: "fractal-disclosure-icon", "aria-hidden": "true", children: isOpen ? /* @__PURE__ */ jsx23(ChevronDown2, { size: 16 }) : /* @__PURE__ */ jsx23(ChevronRight3, { size: 16 }) }),
|
|
1980
|
+
/* @__PURE__ */ jsx23("span", { className: "fractal-disclosure-title", children: title }),
|
|
1981
|
+
meta && /* @__PURE__ */ jsx23("span", { className: "fractal-disclosure-meta", children: meta })
|
|
1884
1982
|
]
|
|
1885
1983
|
}
|
|
1886
1984
|
),
|
|
1887
|
-
/* @__PURE__ */
|
|
1985
|
+
/* @__PURE__ */ jsx23(
|
|
1888
1986
|
"div",
|
|
1889
1987
|
{
|
|
1890
1988
|
id: panelId,
|
|
@@ -1892,7 +1990,7 @@ function Disclosure({
|
|
|
1892
1990
|
"aria-labelledby": headerId,
|
|
1893
1991
|
className: "fractal-disclosure-panel",
|
|
1894
1992
|
hidden: !isOpen,
|
|
1895
|
-
children: /* @__PURE__ */
|
|
1993
|
+
children: /* @__PURE__ */ jsx23("div", { className: "fractal-disclosure-panel-inner", children })
|
|
1896
1994
|
}
|
|
1897
1995
|
)
|
|
1898
1996
|
]
|
|
@@ -1901,18 +1999,18 @@ function Disclosure({
|
|
|
1901
1999
|
}
|
|
1902
2000
|
|
|
1903
2001
|
// src/components/LatticeLoader/LatticeLoader.tsx
|
|
1904
|
-
import { jsx as
|
|
2002
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1905
2003
|
var LATTICE_COUNT = 160;
|
|
1906
2004
|
var WAVE_PERIOD = 80;
|
|
1907
2005
|
function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
1908
|
-
return /* @__PURE__ */
|
|
2006
|
+
return /* @__PURE__ */ jsx24(
|
|
1909
2007
|
"span",
|
|
1910
2008
|
{
|
|
1911
2009
|
"aria-label": label,
|
|
1912
2010
|
className: cn("fractal-lattice-loader", className),
|
|
1913
2011
|
role: "progressbar",
|
|
1914
2012
|
...props,
|
|
1915
|
-
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */
|
|
2013
|
+
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ jsx24(
|
|
1916
2014
|
"span",
|
|
1917
2015
|
{
|
|
1918
2016
|
"aria-hidden": "true",
|
|
@@ -1926,10 +2024,10 @@ function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
|
1926
2024
|
}
|
|
1927
2025
|
|
|
1928
2026
|
// src/components/Ghost/Ghost.tsx
|
|
1929
|
-
import { jsx as
|
|
2027
|
+
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1930
2028
|
var toCssLength = (value) => typeof value === "number" ? `${value}px` : value;
|
|
1931
2029
|
function Ghost({ className, width, height, radius, style, ...props }) {
|
|
1932
|
-
return /* @__PURE__ */
|
|
2030
|
+
return /* @__PURE__ */ jsx25(
|
|
1933
2031
|
"div",
|
|
1934
2032
|
{
|
|
1935
2033
|
"aria-hidden": "true",
|
|
@@ -1945,15 +2043,15 @@ function Ghost({ className, width, height, radius, style, ...props }) {
|
|
|
1945
2043
|
);
|
|
1946
2044
|
}
|
|
1947
2045
|
function GhostLine({ className, size = "md", width = "100%", ...props }) {
|
|
1948
|
-
return /* @__PURE__ */
|
|
2046
|
+
return /* @__PURE__ */ jsx25(Ghost, { className: cn("fractal-ghost-line", `fractal-ghost-line--${size}`, className), width, ...props });
|
|
1949
2047
|
}
|
|
1950
2048
|
function ButtonGhost({ className, size = "md", iconOnly = false, width, ...props }) {
|
|
1951
|
-
return /* @__PURE__ */
|
|
2049
|
+
return /* @__PURE__ */ jsx25(Ghost, { className: cn("fractal-ghost-button", `fractal-ghost-button--${size}`, iconOnly && "fractal-ghost-button--icon-only", className), width, ...props });
|
|
1952
2050
|
}
|
|
1953
2051
|
function CardGhost({ className, lines = 3, showHeader = true, ...props }) {
|
|
1954
|
-
return /* @__PURE__ */
|
|
1955
|
-
showHeader && /* @__PURE__ */
|
|
1956
|
-
/* @__PURE__ */
|
|
2052
|
+
return /* @__PURE__ */ jsxs21("div", { "aria-hidden": "true", className: cn("fractal-ghost-card", className), ...props, children: [
|
|
2053
|
+
showHeader && /* @__PURE__ */ jsx25(GhostLine, { width: "38%" }),
|
|
2054
|
+
/* @__PURE__ */ jsx25("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx25(GhostLine, { width: index === lines - 1 ? "62%" : "100%" }, index)) })
|
|
1957
2055
|
] });
|
|
1958
2056
|
}
|
|
1959
2057
|
function DataTableGhost({
|
|
@@ -1967,81 +2065,81 @@ function DataTableGhost({
|
|
|
1967
2065
|
...props
|
|
1968
2066
|
}) {
|
|
1969
2067
|
const cells = Array.from({ length: columns }, (_, index) => index);
|
|
1970
|
-
return /* @__PURE__ */
|
|
1971
|
-
(showHeader || headers) && /* @__PURE__ */
|
|
1972
|
-
/* @__PURE__ */
|
|
2068
|
+
return /* @__PURE__ */ jsx25("div", { "aria-busy": "true", "aria-label": "Loading table", className: cn("fractal-ghost-table", `fractal-ghost-table--${size}`, className), role: "status", ...props, children: /* @__PURE__ */ jsxs21("table", { className: "fractal-ghost-table__table", children: [
|
|
2069
|
+
(showHeader || headers) && /* @__PURE__ */ jsx25("thead", { children: /* @__PURE__ */ jsx25("tr", { className: "fractal-ghost-table__head-row", children: cells.map((index) => /* @__PURE__ */ jsx25("th", { style: { width: columnWidths?.[index] }, children: headers?.[index] ?? /* @__PURE__ */ jsx25(GhostLine, { size: "sm", width: index === columns - 1 ? "62%" : "76%" }) }, index)) }) }),
|
|
2070
|
+
/* @__PURE__ */ jsx25("tbody", { children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ jsx25("tr", { className: "fractal-ghost-table__row", children: cells.map((columnIndex) => /* @__PURE__ */ jsx25("td", { style: { width: columnWidths?.[columnIndex] }, children: /* @__PURE__ */ jsx25(GhostLine, { width: `${[72, 54, 82, 63, 46][(rowIndex + columnIndex) % 5]}%` }) }, columnIndex)) }, rowIndex)) })
|
|
1973
2071
|
] }) });
|
|
1974
2072
|
}
|
|
1975
2073
|
function InputGhost({ className, labelWidth = "26%", ...props }) {
|
|
1976
|
-
return /* @__PURE__ */
|
|
2074
|
+
return /* @__PURE__ */ jsx25(FormFieldGhost, { className, labelWidth, ...props });
|
|
1977
2075
|
}
|
|
1978
2076
|
function TextareaGhost({ className, labelWidth = "26%", ...props }) {
|
|
1979
|
-
return /* @__PURE__ */
|
|
2077
|
+
return /* @__PURE__ */ jsx25(FormFieldGhost, { className, labelWidth, multiline: true, ...props });
|
|
1980
2078
|
}
|
|
1981
2079
|
function LabelGhost({ className, width = "26%", ...props }) {
|
|
1982
|
-
return /* @__PURE__ */
|
|
2080
|
+
return /* @__PURE__ */ jsx25(GhostLine, { className: cn("fractal-ghost-label", className), size: "sm", width, ...props });
|
|
1983
2081
|
}
|
|
1984
2082
|
function FormFieldGhost({ className, labelWidth = "26%", multiline = false, ...props }) {
|
|
1985
|
-
return /* @__PURE__ */
|
|
1986
|
-
/* @__PURE__ */
|
|
1987
|
-
/* @__PURE__ */
|
|
2083
|
+
return /* @__PURE__ */ jsxs21("div", { "aria-hidden": "true", className: cn("fractal-ghost-field", className), ...props, children: [
|
|
2084
|
+
/* @__PURE__ */ jsx25(LabelGhost, { width: labelWidth }),
|
|
2085
|
+
/* @__PURE__ */ jsx25(Ghost, { className: cn("fractal-ghost-field__control", multiline && "fractal-ghost-field__control--multiline") })
|
|
1988
2086
|
] });
|
|
1989
2087
|
}
|
|
1990
2088
|
function AlertGhost({ className, ...props }) {
|
|
1991
|
-
return /* @__PURE__ */
|
|
1992
|
-
/* @__PURE__ */
|
|
1993
|
-
/* @__PURE__ */
|
|
2089
|
+
return /* @__PURE__ */ jsxs21("div", { "aria-hidden": "true", className: cn("fractal-ghost-alert", className), ...props, children: [
|
|
2090
|
+
/* @__PURE__ */ jsx25(GhostLine, { width: "30%" }),
|
|
2091
|
+
/* @__PURE__ */ jsx25(GhostLine, { size: "sm", width: "78%" })
|
|
1994
2092
|
] });
|
|
1995
2093
|
}
|
|
1996
2094
|
function CheckboxGhost({ className, ...props }) {
|
|
1997
|
-
return /* @__PURE__ */
|
|
1998
|
-
/* @__PURE__ */
|
|
1999
|
-
/* @__PURE__ */
|
|
2095
|
+
return /* @__PURE__ */ jsxs21("div", { "aria-hidden": "true", className: cn("fractal-ghost-choice", className), ...props, children: [
|
|
2096
|
+
/* @__PURE__ */ jsx25(Ghost, { className: "fractal-ghost-choice__control" }),
|
|
2097
|
+
/* @__PURE__ */ jsx25(GhostLine, { width: "42%" })
|
|
2000
2098
|
] });
|
|
2001
2099
|
}
|
|
2002
2100
|
var ToggleGhost = CheckboxGhost;
|
|
2003
2101
|
function ChipGhost({ className, width = 74, ...props }) {
|
|
2004
|
-
return /* @__PURE__ */
|
|
2102
|
+
return /* @__PURE__ */ jsx25(Ghost, { className: cn("fractal-ghost-chip", className), height: 24, width, ...props });
|
|
2005
2103
|
}
|
|
2006
2104
|
function LinkGhost({ className, width = 96, ...props }) {
|
|
2007
|
-
return /* @__PURE__ */
|
|
2105
|
+
return /* @__PURE__ */ jsx25(GhostLine, { className: cn("fractal-ghost-link", className), size: "sm", width, ...props });
|
|
2008
2106
|
}
|
|
2009
2107
|
var TextButtonGhost = LinkGhost;
|
|
2010
2108
|
function DropdownGhost({ className, ...props }) {
|
|
2011
|
-
return /* @__PURE__ */
|
|
2012
|
-
/* @__PURE__ */
|
|
2013
|
-
/* @__PURE__ */
|
|
2109
|
+
return /* @__PURE__ */ jsxs21("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropdown", className), ...props, children: [
|
|
2110
|
+
/* @__PURE__ */ jsx25(GhostLine, { width: "38%" }),
|
|
2111
|
+
/* @__PURE__ */ jsx25(Ghost, { className: "fractal-ghost-dropdown__chevron" })
|
|
2014
2112
|
] });
|
|
2015
2113
|
}
|
|
2016
2114
|
function ContentSwitcherGhost({ className, options = 3, ...props }) {
|
|
2017
|
-
return /* @__PURE__ */
|
|
2115
|
+
return /* @__PURE__ */ jsx25("div", { "aria-hidden": "true", className: cn("fractal-ghost-switcher", className), ...props, children: Array.from({ length: options }, (_, index) => /* @__PURE__ */ jsx25(Ghost, {}, index)) });
|
|
2018
2116
|
}
|
|
2019
2117
|
var TabsGhost = ContentSwitcherGhost;
|
|
2020
2118
|
function DisclosureGhost({ className, ...props }) {
|
|
2021
|
-
return /* @__PURE__ */
|
|
2022
|
-
/* @__PURE__ */
|
|
2023
|
-
/* @__PURE__ */
|
|
2119
|
+
return /* @__PURE__ */ jsxs21("div", { "aria-hidden": "true", className: cn("fractal-ghost-disclosure", className), ...props, children: [
|
|
2120
|
+
/* @__PURE__ */ jsx25(Ghost, { className: "fractal-ghost-disclosure__icon" }),
|
|
2121
|
+
/* @__PURE__ */ jsx25(GhostLine, { width: "42%" })
|
|
2024
2122
|
] });
|
|
2025
2123
|
}
|
|
2026
2124
|
function PaginationGhost({ className, pages = 5, ...props }) {
|
|
2027
|
-
return /* @__PURE__ */
|
|
2125
|
+
return /* @__PURE__ */ jsx25("div", { "aria-hidden": "true", className: cn("fractal-ghost-pagination", className), ...props, children: Array.from({ length: pages }, (_, index) => /* @__PURE__ */ jsx25(Ghost, {}, index)) });
|
|
2028
2126
|
}
|
|
2029
2127
|
function FileDropzoneGhost({ className, ...props }) {
|
|
2030
|
-
return /* @__PURE__ */
|
|
2031
|
-
/* @__PURE__ */
|
|
2032
|
-
/* @__PURE__ */
|
|
2033
|
-
/* @__PURE__ */
|
|
2128
|
+
return /* @__PURE__ */ jsxs21("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropzone", className), ...props, children: [
|
|
2129
|
+
/* @__PURE__ */ jsx25(Ghost, { className: "fractal-ghost-dropzone__icon" }),
|
|
2130
|
+
/* @__PURE__ */ jsx25(GhostLine, { width: "26%" }),
|
|
2131
|
+
/* @__PURE__ */ jsx25(GhostLine, { size: "sm", width: "46%" })
|
|
2034
2132
|
] });
|
|
2035
2133
|
}
|
|
2036
2134
|
function PromptCardGhost({ className, ...props }) {
|
|
2037
|
-
return /* @__PURE__ */
|
|
2135
|
+
return /* @__PURE__ */ jsx25(CardGhost, { className: cn("fractal-ghost-prompt-card", className), lines: 4, ...props });
|
|
2038
2136
|
}
|
|
2039
2137
|
function ConversationGhost({
|
|
2040
2138
|
className,
|
|
2041
2139
|
"aria-label": ariaLabel = "Loading conversation",
|
|
2042
2140
|
...props
|
|
2043
2141
|
}) {
|
|
2044
|
-
return /* @__PURE__ */
|
|
2142
|
+
return /* @__PURE__ */ jsxs21(
|
|
2045
2143
|
"div",
|
|
2046
2144
|
{
|
|
2047
2145
|
"aria-busy": "true",
|
|
@@ -2050,54 +2148,54 @@ function ConversationGhost({
|
|
|
2050
2148
|
role: "status",
|
|
2051
2149
|
...props,
|
|
2052
2150
|
children: [
|
|
2053
|
-
/* @__PURE__ */
|
|
2054
|
-
/* @__PURE__ */
|
|
2055
|
-
/* @__PURE__ */
|
|
2056
|
-
/* @__PURE__ */
|
|
2151
|
+
/* @__PURE__ */ jsx25("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--user", children: /* @__PURE__ */ jsxs21("div", { className: "fractal-ghost-conversation__bubble", children: [
|
|
2152
|
+
/* @__PURE__ */ jsx25(GhostLine, { width: "100%" }),
|
|
2153
|
+
/* @__PURE__ */ jsx25(GhostLine, { width: "86%" }),
|
|
2154
|
+
/* @__PURE__ */ jsx25(GhostLine, { width: "64%" })
|
|
2057
2155
|
] }) }),
|
|
2058
|
-
/* @__PURE__ */
|
|
2059
|
-
/* @__PURE__ */
|
|
2060
|
-
/* @__PURE__ */
|
|
2061
|
-
/* @__PURE__ */
|
|
2156
|
+
/* @__PURE__ */ jsxs21("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--assistant", children: [
|
|
2157
|
+
/* @__PURE__ */ jsx25(GhostLine, { width: "92%" }),
|
|
2158
|
+
/* @__PURE__ */ jsx25(GhostLine, { width: "78%" }),
|
|
2159
|
+
/* @__PURE__ */ jsx25(GhostLine, { width: "58%" })
|
|
2062
2160
|
] })
|
|
2063
2161
|
]
|
|
2064
2162
|
}
|
|
2065
2163
|
);
|
|
2066
2164
|
}
|
|
2067
2165
|
function SortableTableGhost(props) {
|
|
2068
|
-
return /* @__PURE__ */
|
|
2166
|
+
return /* @__PURE__ */ jsx25(DataTableGhost, { ...props });
|
|
2069
2167
|
}
|
|
2070
2168
|
function SidebarGhost({ className, items = 6, ...props }) {
|
|
2071
|
-
return /* @__PURE__ */
|
|
2072
|
-
/* @__PURE__ */
|
|
2073
|
-
/* @__PURE__ */
|
|
2074
|
-
/* @__PURE__ */
|
|
2075
|
-
/* @__PURE__ */
|
|
2169
|
+
return /* @__PURE__ */ jsxs21("aside", { "aria-hidden": "true", className: cn("fractal-ghost-sidebar", className), ...props, children: [
|
|
2170
|
+
/* @__PURE__ */ jsx25(Ghost, { className: "fractal-ghost-sidebar__brand" }),
|
|
2171
|
+
/* @__PURE__ */ jsx25("div", { className: "fractal-ghost-sidebar__items", children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ jsxs21("div", { className: "fractal-ghost-sidebar__item", children: [
|
|
2172
|
+
/* @__PURE__ */ jsx25(Ghost, {}),
|
|
2173
|
+
/* @__PURE__ */ jsx25(GhostLine, { width: `${[54, 68, 44, 61][index % 4]}%` })
|
|
2076
2174
|
] }, index)) })
|
|
2077
2175
|
] });
|
|
2078
2176
|
}
|
|
2079
2177
|
function ModalGhost({ className, title, lines = 3, ...props }) {
|
|
2080
|
-
return /* @__PURE__ */
|
|
2178
|
+
return /* @__PURE__ */ jsx25(SurfaceGhost, { className: cn("fractal-ghost-modal", className), title, lines, ...props });
|
|
2081
2179
|
}
|
|
2082
2180
|
function SidePanelGhost({ className, title, lines = 5, ...props }) {
|
|
2083
|
-
return /* @__PURE__ */
|
|
2181
|
+
return /* @__PURE__ */ jsx25(SurfaceGhost, { className: cn("fractal-ghost-side-panel", className), title, lines, ...props });
|
|
2084
2182
|
}
|
|
2085
2183
|
function SurfaceGhost({ className, title, lines = 3, ...props }) {
|
|
2086
|
-
return /* @__PURE__ */
|
|
2087
|
-
/* @__PURE__ */
|
|
2088
|
-
/* @__PURE__ */
|
|
2089
|
-
/* @__PURE__ */
|
|
2184
|
+
return /* @__PURE__ */ jsxs21("div", { "aria-hidden": "true", className: cn("fractal-ghost-surface", className), ...props, children: [
|
|
2185
|
+
/* @__PURE__ */ jsxs21("div", { className: "fractal-ghost-surface__header", children: [
|
|
2186
|
+
/* @__PURE__ */ jsx25(GhostLine, { width: "42%" }),
|
|
2187
|
+
/* @__PURE__ */ jsx25(Ghost, { className: "fractal-ghost-surface__close" })
|
|
2090
2188
|
] }),
|
|
2091
|
-
title && /* @__PURE__ */
|
|
2092
|
-
/* @__PURE__ */
|
|
2189
|
+
title && /* @__PURE__ */ jsx25("div", { className: "fractal-ghost-surface__title", children: title }),
|
|
2190
|
+
/* @__PURE__ */ jsx25("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx25(GhostLine, { width: index === lines - 1 ? "64%" : "100%" }, index)) })
|
|
2093
2191
|
] });
|
|
2094
2192
|
}
|
|
2095
2193
|
|
|
2096
2194
|
// src/components/Sidebar/Sidebar.tsx
|
|
2097
2195
|
import * as React15 from "react";
|
|
2098
|
-
import { Fragment as Fragment3, jsx as
|
|
2196
|
+
import { Fragment as Fragment3, jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2099
2197
|
var Sidebar = React15.forwardRef(
|
|
2100
|
-
({ className, width, compact = false, style, ...props }, ref) => /* @__PURE__ */
|
|
2198
|
+
({ className, width, compact = false, style, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
2101
2199
|
"aside",
|
|
2102
2200
|
{
|
|
2103
2201
|
ref,
|
|
@@ -2110,11 +2208,11 @@ var Sidebar = React15.forwardRef(
|
|
|
2110
2208
|
);
|
|
2111
2209
|
Sidebar.displayName = "Sidebar";
|
|
2112
2210
|
var SidebarHeader = React15.forwardRef(
|
|
2113
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2211
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx26("div", { ref, className: cn("fractal-sidebar__header", className), ...props })
|
|
2114
2212
|
);
|
|
2115
2213
|
SidebarHeader.displayName = "SidebarHeader";
|
|
2116
2214
|
var SidebarBrand = React15.forwardRef(
|
|
2117
|
-
({ className, type = "button", ...props }, ref) => /* @__PURE__ */
|
|
2215
|
+
({ className, type = "button", ...props }, ref) => /* @__PURE__ */ jsx26("button", { ref, type, className: cn("fractal-sidebar__brand", className), ...props })
|
|
2118
2216
|
);
|
|
2119
2217
|
SidebarBrand.displayName = "SidebarBrand";
|
|
2120
2218
|
function SidebarAccountMenu({
|
|
@@ -2125,7 +2223,7 @@ function SidebarAccountMenu({
|
|
|
2125
2223
|
icon,
|
|
2126
2224
|
className
|
|
2127
2225
|
}) {
|
|
2128
|
-
return /* @__PURE__ */
|
|
2226
|
+
return /* @__PURE__ */ jsx26(
|
|
2129
2227
|
Dropdown,
|
|
2130
2228
|
{
|
|
2131
2229
|
align: "left",
|
|
@@ -2135,9 +2233,9 @@ function SidebarAccountMenu({
|
|
|
2135
2233
|
panelClassName: "fractal-sidebar__account-panel",
|
|
2136
2234
|
selectedValue: "",
|
|
2137
2235
|
triggerClassName: "fractal-sidebar__account-trigger",
|
|
2138
|
-
triggerContent: /* @__PURE__ */
|
|
2139
|
-
icon && /* @__PURE__ */
|
|
2140
|
-
/* @__PURE__ */
|
|
2236
|
+
triggerContent: /* @__PURE__ */ jsxs22(Fragment3, { children: [
|
|
2237
|
+
icon && /* @__PURE__ */ jsx26("span", { className: "fractal-sidebar__account-icon", "aria-hidden": "true", children: icon }),
|
|
2238
|
+
/* @__PURE__ */ jsx26("span", { className: "fractal-sidebar__account-name", children: name })
|
|
2141
2239
|
] }),
|
|
2142
2240
|
triggerLabel,
|
|
2143
2241
|
triggerVariant: "tertiary"
|
|
@@ -2145,15 +2243,15 @@ function SidebarAccountMenu({
|
|
|
2145
2243
|
);
|
|
2146
2244
|
}
|
|
2147
2245
|
var SidebarNav = React15.forwardRef(
|
|
2148
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2246
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx26("nav", { ref, className: cn("fractal-sidebar__nav", className), ...props })
|
|
2149
2247
|
);
|
|
2150
2248
|
SidebarNav.displayName = "SidebarNav";
|
|
2151
2249
|
var SidebarSection = React15.forwardRef(
|
|
2152
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2250
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx26("div", { ref, className: cn("fractal-sidebar__section", className), ...props })
|
|
2153
2251
|
);
|
|
2154
2252
|
SidebarSection.displayName = "SidebarSection";
|
|
2155
2253
|
var SidebarNavItem = React15.forwardRef(
|
|
2156
|
-
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */
|
|
2254
|
+
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ jsxs22(
|
|
2157
2255
|
"button",
|
|
2158
2256
|
{
|
|
2159
2257
|
ref,
|
|
@@ -2163,28 +2261,28 @@ var SidebarNavItem = React15.forwardRef(
|
|
|
2163
2261
|
"aria-current": active ? "page" : void 0,
|
|
2164
2262
|
...props,
|
|
2165
2263
|
children: [
|
|
2166
|
-
icon && /* @__PURE__ */
|
|
2167
|
-
/* @__PURE__ */
|
|
2168
|
-
endAdornment && /* @__PURE__ */
|
|
2264
|
+
icon && /* @__PURE__ */ jsx26("span", { className: "fractal-sidebar__nav-item-icon", "aria-hidden": "true", children: icon }),
|
|
2265
|
+
/* @__PURE__ */ jsx26("span", { className: "fractal-sidebar__nav-item-label", children }),
|
|
2266
|
+
endAdornment && /* @__PURE__ */ jsx26("span", { className: "fractal-sidebar__nav-item-end", children: endAdornment })
|
|
2169
2267
|
]
|
|
2170
2268
|
}
|
|
2171
2269
|
)
|
|
2172
2270
|
);
|
|
2173
2271
|
SidebarNavItem.displayName = "SidebarNavItem";
|
|
2174
2272
|
var SidebarFooter = React15.forwardRef(
|
|
2175
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2273
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx26("div", { ref, className: cn("fractal-sidebar__footer", className), ...props })
|
|
2176
2274
|
);
|
|
2177
2275
|
SidebarFooter.displayName = "SidebarFooter";
|
|
2178
2276
|
|
|
2179
2277
|
// src/components/SidePanel/SidePanel.tsx
|
|
2180
2278
|
import { createPortal as createPortal2 } from "react-dom";
|
|
2181
2279
|
import { Close } from "@mirror-physics/fractal-icons";
|
|
2182
|
-
import { jsx as
|
|
2280
|
+
import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2183
2281
|
function SidePanel({ open, onClose, title, description, children, footer, size = "md", loading = false, loadingLabel = "Loading", className }) {
|
|
2184
2282
|
useEscapeDismiss(80, onClose, open);
|
|
2185
2283
|
if (!open) return null;
|
|
2186
2284
|
return createPortal2(
|
|
2187
|
-
/* @__PURE__ */
|
|
2285
|
+
/* @__PURE__ */ jsx27("div", { className: "fractal-side-panel-overlay", onMouseDown: onClose, children: /* @__PURE__ */ jsxs23(
|
|
2188
2286
|
"aside",
|
|
2189
2287
|
{
|
|
2190
2288
|
className: cn("fractal-side-panel", `fractal-side-panel--${size}`, className),
|
|
@@ -2193,15 +2291,15 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
2193
2291
|
role: "dialog",
|
|
2194
2292
|
onMouseDown: (event) => event.stopPropagation(),
|
|
2195
2293
|
children: [
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */
|
|
2198
|
-
typeof title === "string" ? /* @__PURE__ */
|
|
2199
|
-
description && /* @__PURE__ */
|
|
2294
|
+
/* @__PURE__ */ jsxs23("header", { className: "fractal-side-panel__header", children: [
|
|
2295
|
+
/* @__PURE__ */ jsxs23("div", { className: "fractal-side-panel__heading", children: [
|
|
2296
|
+
typeof title === "string" ? /* @__PURE__ */ jsx27("h2", { className: "fractal-side-panel__title", children: title }) : /* @__PURE__ */ jsx27("div", { className: "fractal-side-panel__title", children: title }),
|
|
2297
|
+
description && /* @__PURE__ */ jsx27("p", { className: "fractal-side-panel__description", children: description })
|
|
2200
2298
|
] }),
|
|
2201
|
-
/* @__PURE__ */
|
|
2299
|
+
/* @__PURE__ */ jsx27("button", { type: "button", className: "fractal-side-panel__close", "aria-label": "Close panel", onClick: onClose, children: /* @__PURE__ */ jsx27(Close, { size: 18 }) })
|
|
2202
2300
|
] }),
|
|
2203
|
-
/* @__PURE__ */
|
|
2204
|
-
footer && /* @__PURE__ */
|
|
2301
|
+
/* @__PURE__ */ jsx27("div", { "aria-busy": loading || void 0, className: cn("fractal-side-panel__body", loading && "fractal-side-panel__body--loading"), children: loading ? /* @__PURE__ */ jsx27(UILoader, { label: loadingLabel }) : children }),
|
|
2302
|
+
footer && /* @__PURE__ */ jsx27("footer", { className: "fractal-side-panel__footer", children: footer })
|
|
2205
2303
|
]
|
|
2206
2304
|
}
|
|
2207
2305
|
) }),
|
|
@@ -2211,17 +2309,17 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
2211
2309
|
|
|
2212
2310
|
// src/components/Textarea/Textarea.tsx
|
|
2213
2311
|
import * as React16 from "react";
|
|
2214
|
-
import { jsx as
|
|
2312
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
2215
2313
|
var Textarea = React16.forwardRef(
|
|
2216
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2314
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx28("textarea", { ref, className: cn("fractal-textarea", className), ...props })
|
|
2217
2315
|
);
|
|
2218
2316
|
Textarea.displayName = "Textarea";
|
|
2219
2317
|
|
|
2220
2318
|
// src/components/TextButton/TextButton.tsx
|
|
2221
2319
|
import * as React17 from "react";
|
|
2222
|
-
import { jsx as
|
|
2320
|
+
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2223
2321
|
var TextButton = React17.forwardRef(
|
|
2224
|
-
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */
|
|
2322
|
+
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ jsxs24(
|
|
2225
2323
|
"button",
|
|
2226
2324
|
{
|
|
2227
2325
|
ref,
|
|
@@ -2229,9 +2327,9 @@ var TextButton = React17.forwardRef(
|
|
|
2229
2327
|
type: "button",
|
|
2230
2328
|
...props,
|
|
2231
2329
|
children: [
|
|
2232
|
-
icon && iconPosition === "start" && /* @__PURE__ */
|
|
2233
|
-
/* @__PURE__ */
|
|
2234
|
-
icon && iconPosition === "end" && /* @__PURE__ */
|
|
2330
|
+
icon && iconPosition === "start" && /* @__PURE__ */ jsx29("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon }),
|
|
2331
|
+
/* @__PURE__ */ jsx29("span", { children }),
|
|
2332
|
+
icon && iconPosition === "end" && /* @__PURE__ */ jsx29("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon })
|
|
2235
2333
|
]
|
|
2236
2334
|
}
|
|
2237
2335
|
)
|
|
@@ -2241,7 +2339,7 @@ TextButton.displayName = "TextButton";
|
|
|
2241
2339
|
// src/components/FileDropzone/FileDropzone.tsx
|
|
2242
2340
|
import * as React18 from "react";
|
|
2243
2341
|
import { Close as Close2, FileArrowUp } from "@mirror-physics/fractal-icons";
|
|
2244
|
-
import { jsx as
|
|
2342
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2245
2343
|
function FileDropzone({
|
|
2246
2344
|
files,
|
|
2247
2345
|
onFilesChange,
|
|
@@ -2261,8 +2359,8 @@ function FileDropzone({
|
|
|
2261
2359
|
if (additions.length === 0) return;
|
|
2262
2360
|
onFilesChange(multiple ? [...files, ...additions] : additions.slice(0, 1));
|
|
2263
2361
|
};
|
|
2264
|
-
return /* @__PURE__ */
|
|
2265
|
-
/* @__PURE__ */
|
|
2362
|
+
return /* @__PURE__ */ jsxs25("div", { className: cn("fractal-file-dropzone", className), children: [
|
|
2363
|
+
/* @__PURE__ */ jsx30(
|
|
2266
2364
|
"input",
|
|
2267
2365
|
{
|
|
2268
2366
|
ref: inputRef,
|
|
@@ -2278,7 +2376,7 @@ function FileDropzone({
|
|
|
2278
2376
|
}
|
|
2279
2377
|
}
|
|
2280
2378
|
),
|
|
2281
|
-
/* @__PURE__ */
|
|
2379
|
+
/* @__PURE__ */ jsxs25(
|
|
2282
2380
|
"button",
|
|
2283
2381
|
{
|
|
2284
2382
|
className: "fractal-file-dropzone__target",
|
|
@@ -2301,18 +2399,18 @@ function FileDropzone({
|
|
|
2301
2399
|
addFiles(event.dataTransfer.files);
|
|
2302
2400
|
},
|
|
2303
2401
|
children: [
|
|
2304
|
-
/* @__PURE__ */
|
|
2305
|
-
/* @__PURE__ */
|
|
2306
|
-
/* @__PURE__ */
|
|
2307
|
-
description && /* @__PURE__ */
|
|
2402
|
+
/* @__PURE__ */ jsx30(FileArrowUp, { "aria-hidden": "true", size: 20 }),
|
|
2403
|
+
/* @__PURE__ */ jsxs25("span", { className: "fractal-file-dropzone__copy", children: [
|
|
2404
|
+
/* @__PURE__ */ jsx30("span", { className: "fractal-file-dropzone__title", children: title }),
|
|
2405
|
+
description && /* @__PURE__ */ jsx30("span", { className: "fractal-file-dropzone__description", children: description })
|
|
2308
2406
|
] })
|
|
2309
2407
|
]
|
|
2310
2408
|
}
|
|
2311
2409
|
),
|
|
2312
|
-
files.length > 0 && /* @__PURE__ */
|
|
2313
|
-
/* @__PURE__ */
|
|
2314
|
-
/* @__PURE__ */
|
|
2315
|
-
/* @__PURE__ */
|
|
2410
|
+
files.length > 0 && /* @__PURE__ */ jsx30("ul", { className: "fractal-file-dropzone__files", "aria-label": "Attached files", children: files.map((file, index) => /* @__PURE__ */ jsxs25("li", { className: "fractal-file-dropzone__file", children: [
|
|
2411
|
+
/* @__PURE__ */ jsx30("span", { className: "fractal-file-dropzone__file-name", children: file.name }),
|
|
2412
|
+
/* @__PURE__ */ jsx30("span", { className: "fractal-file-dropzone__file-meta", children: formatFileSize(file.size) }),
|
|
2413
|
+
/* @__PURE__ */ jsx30(
|
|
2316
2414
|
"button",
|
|
2317
2415
|
{
|
|
2318
2416
|
className: "fractal-file-dropzone__remove",
|
|
@@ -2320,7 +2418,7 @@ function FileDropzone({
|
|
|
2320
2418
|
"aria-label": `Remove ${file.name}`,
|
|
2321
2419
|
disabled,
|
|
2322
2420
|
onClick: () => onFilesChange(files.filter((_, fileIndex) => fileIndex !== index)),
|
|
2323
|
-
children: /* @__PURE__ */
|
|
2421
|
+
children: /* @__PURE__ */ jsx30(Close2, { "aria-hidden": "true", size: 14 })
|
|
2324
2422
|
}
|
|
2325
2423
|
)
|
|
2326
2424
|
] }, `${file.name}-${file.size}-${index}`)) })
|
|
@@ -2334,7 +2432,7 @@ function formatFileSize(bytes) {
|
|
|
2334
2432
|
|
|
2335
2433
|
// src/components/Pagination/Pagination.tsx
|
|
2336
2434
|
import { ArrowLeft, ArrowRight } from "@mirror-physics/fractal-icons";
|
|
2337
|
-
import { jsx as
|
|
2435
|
+
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2338
2436
|
function Pagination({
|
|
2339
2437
|
page,
|
|
2340
2438
|
pageSize,
|
|
@@ -2350,10 +2448,10 @@ function Pagination({
|
|
|
2350
2448
|
const start = totalItems === 0 ? 0 : (currentPage - 1) * pageSize + 1;
|
|
2351
2449
|
const end = Math.min(currentPage * pageSize, totalItems);
|
|
2352
2450
|
const canChangePageSize = pageSizeOptions != null && pageSizeOptions.length > 0 && onPageSizeChange != null;
|
|
2353
|
-
return /* @__PURE__ */
|
|
2354
|
-
/* @__PURE__ */
|
|
2355
|
-
/* @__PURE__ */
|
|
2356
|
-
canChangePageSize && /* @__PURE__ */
|
|
2451
|
+
return /* @__PURE__ */ jsxs26("nav", { className: cn("fractal-pagination", className), "aria-label": ariaLabel, children: [
|
|
2452
|
+
/* @__PURE__ */ jsx31("span", { className: "fractal-pagination__summary", children: totalItems === 0 ? "No results" : `${start}-${end} of ${totalItems}` }),
|
|
2453
|
+
/* @__PURE__ */ jsxs26("div", { className: "fractal-pagination__controls", children: [
|
|
2454
|
+
canChangePageSize && /* @__PURE__ */ jsx31(
|
|
2357
2455
|
Dropdown,
|
|
2358
2456
|
{
|
|
2359
2457
|
align: "right",
|
|
@@ -2370,7 +2468,7 @@ function Pagination({
|
|
|
2370
2468
|
triggerVariant: "tertiary"
|
|
2371
2469
|
}
|
|
2372
2470
|
),
|
|
2373
|
-
/* @__PURE__ */
|
|
2471
|
+
/* @__PURE__ */ jsx31(
|
|
2374
2472
|
"button",
|
|
2375
2473
|
{
|
|
2376
2474
|
className: "fractal-pagination__button",
|
|
@@ -2379,15 +2477,15 @@ function Pagination({
|
|
|
2379
2477
|
title: "Previous page",
|
|
2380
2478
|
disabled: currentPage === 1 || totalItems === 0,
|
|
2381
2479
|
onClick: () => onPageChange(currentPage - 1),
|
|
2382
|
-
children: /* @__PURE__ */
|
|
2480
|
+
children: /* @__PURE__ */ jsx31(ArrowLeft, { "aria-hidden": "true", size: 16 })
|
|
2383
2481
|
}
|
|
2384
2482
|
),
|
|
2385
|
-
/* @__PURE__ */
|
|
2483
|
+
/* @__PURE__ */ jsxs26("span", { className: "fractal-pagination__page", "aria-current": "page", children: [
|
|
2386
2484
|
currentPage,
|
|
2387
2485
|
" of ",
|
|
2388
2486
|
totalPages
|
|
2389
2487
|
] }),
|
|
2390
|
-
/* @__PURE__ */
|
|
2488
|
+
/* @__PURE__ */ jsx31(
|
|
2391
2489
|
"button",
|
|
2392
2490
|
{
|
|
2393
2491
|
className: "fractal-pagination__button",
|
|
@@ -2396,7 +2494,7 @@ function Pagination({
|
|
|
2396
2494
|
title: "Next page",
|
|
2397
2495
|
disabled: currentPage === totalPages || totalItems === 0,
|
|
2398
2496
|
onClick: () => onPageChange(currentPage + 1),
|
|
2399
|
-
children: /* @__PURE__ */
|
|
2497
|
+
children: /* @__PURE__ */ jsx31(ArrowRight, { "aria-hidden": "true", size: 16 })
|
|
2400
2498
|
}
|
|
2401
2499
|
)
|
|
2402
2500
|
] })
|
|
@@ -2464,6 +2562,7 @@ export {
|
|
|
2464
2562
|
SidebarNav,
|
|
2465
2563
|
SidebarNavItem,
|
|
2466
2564
|
SidebarSection,
|
|
2565
|
+
Slider,
|
|
2467
2566
|
SortableTable,
|
|
2468
2567
|
SortableTableGhost,
|
|
2469
2568
|
TableSearch,
|