@mirror-physics/fractal-ui 0.2.0-next.58 → 0.2.0-next.59
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 +336 -294
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +21 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +321 -280
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -93,6 +93,7 @@ __export(index_exports, {
|
|
|
93
93
|
SidebarSection: () => SidebarSection,
|
|
94
94
|
SortableTable: () => SortableTable,
|
|
95
95
|
SortableTableGhost: () => SortableTableGhost,
|
|
96
|
+
TableSearch: () => TableSearch,
|
|
96
97
|
Tabs: () => Tabs,
|
|
97
98
|
TabsGhost: () => TabsGhost,
|
|
98
99
|
TextButton: () => TextButton,
|
|
@@ -786,10 +787,50 @@ var Input = React4.forwardRef(
|
|
|
786
787
|
);
|
|
787
788
|
Input.displayName = "Input";
|
|
788
789
|
|
|
789
|
-
// src/components/
|
|
790
|
+
// src/components/TableSearch/TableSearch.tsx
|
|
790
791
|
var React5 = __toESM(require("react"), 1);
|
|
791
792
|
var import_fractal_icons4 = require("@mirror-physics/fractal-icons");
|
|
792
793
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
794
|
+
var TableSearch = React5.forwardRef(
|
|
795
|
+
({
|
|
796
|
+
searchType = "text",
|
|
797
|
+
className,
|
|
798
|
+
inputClassName,
|
|
799
|
+
placeholder,
|
|
800
|
+
title,
|
|
801
|
+
...props
|
|
802
|
+
}, ref) => {
|
|
803
|
+
const isGlob = searchType === "glob";
|
|
804
|
+
const SearchIcon = isGlob ? import_fractal_icons4.MagnifyingGlassLines : import_fractal_icons4.MagnifyingGlass;
|
|
805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
806
|
+
"div",
|
|
807
|
+
{
|
|
808
|
+
className: cn("fractal-table-search", className),
|
|
809
|
+
"data-search-type": searchType,
|
|
810
|
+
children: [
|
|
811
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SearchIcon, { className: "fractal-table-search__icon", size: 17, "aria-hidden": "true" }),
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
813
|
+
Input,
|
|
814
|
+
{
|
|
815
|
+
...props,
|
|
816
|
+
ref,
|
|
817
|
+
type: "search",
|
|
818
|
+
className: cn("fractal-table-search__input", inputClassName),
|
|
819
|
+
placeholder: placeholder ?? (isGlob ? "Glob search \u2014 use *, ?, or [a-z]" : "Search"),
|
|
820
|
+
title: title ?? (isGlob ? "Glob pattern: *, **, ?, [abc], [a-z], and [!abc]" : void 0)
|
|
821
|
+
}
|
|
822
|
+
)
|
|
823
|
+
]
|
|
824
|
+
}
|
|
825
|
+
);
|
|
826
|
+
}
|
|
827
|
+
);
|
|
828
|
+
TableSearch.displayName = "TableSearch";
|
|
829
|
+
|
|
830
|
+
// src/components/NumberInput/NumberInput.tsx
|
|
831
|
+
var React6 = __toESM(require("react"), 1);
|
|
832
|
+
var import_fractal_icons5 = require("@mirror-physics/fractal-icons");
|
|
833
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
793
834
|
function NumberInput({
|
|
794
835
|
unit,
|
|
795
836
|
className,
|
|
@@ -801,7 +842,7 @@ function NumberInput({
|
|
|
801
842
|
max,
|
|
802
843
|
...props
|
|
803
844
|
}) {
|
|
804
|
-
const inputRef =
|
|
845
|
+
const inputRef = React6.useRef(null);
|
|
805
846
|
const numericValue = Number(value ?? defaultValue);
|
|
806
847
|
const characterCount = Math.max(String(value ?? defaultValue ?? "").length, 1);
|
|
807
848
|
const controlLabel = typeof props["aria-label"] === "string" ? props["aria-label"] : "value";
|
|
@@ -815,8 +856,8 @@ function NumberInput({
|
|
|
815
856
|
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
816
857
|
input.focus();
|
|
817
858
|
};
|
|
818
|
-
return /* @__PURE__ */ (0,
|
|
819
|
-
/* @__PURE__ */ (0,
|
|
859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cn("fractal-number-input", unit && "fractal-number-input--with-unit", className), children: [
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
820
861
|
Input,
|
|
821
862
|
{
|
|
822
863
|
ref: inputRef,
|
|
@@ -830,7 +871,7 @@ function NumberInput({
|
|
|
830
871
|
...props
|
|
831
872
|
}
|
|
832
873
|
),
|
|
833
|
-
unit && /* @__PURE__ */ (0,
|
|
874
|
+
unit && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
834
875
|
"span",
|
|
835
876
|
{
|
|
836
877
|
className: "fractal-number-input-unit",
|
|
@@ -839,8 +880,8 @@ function NumberInput({
|
|
|
839
880
|
children: unit
|
|
840
881
|
}
|
|
841
882
|
),
|
|
842
|
-
/* @__PURE__ */ (0,
|
|
843
|
-
/* @__PURE__ */ (0,
|
|
883
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "fractal-number-input-controls", children: [
|
|
884
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
844
885
|
"button",
|
|
845
886
|
{
|
|
846
887
|
type: "button",
|
|
@@ -848,10 +889,10 @@ function NumberInput({
|
|
|
848
889
|
"aria-label": `Decrease ${controlLabel}`,
|
|
849
890
|
disabled: decrementDisabled,
|
|
850
891
|
onClick: () => changeByStep(-1),
|
|
851
|
-
children: /* @__PURE__ */ (0,
|
|
892
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_fractal_icons5.Minus, { "aria-hidden": "true", size: 16 })
|
|
852
893
|
}
|
|
853
894
|
),
|
|
854
|
-
/* @__PURE__ */ (0,
|
|
895
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
855
896
|
"button",
|
|
856
897
|
{
|
|
857
898
|
type: "button",
|
|
@@ -859,7 +900,7 @@ function NumberInput({
|
|
|
859
900
|
"aria-label": `Increase ${controlLabel}`,
|
|
860
901
|
disabled: incrementDisabled,
|
|
861
902
|
onClick: () => changeByStep(1),
|
|
862
|
-
children: /* @__PURE__ */ (0,
|
|
903
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_fractal_icons5.Plus, { "aria-hidden": "true", size: 16 })
|
|
863
904
|
}
|
|
864
905
|
)
|
|
865
906
|
] })
|
|
@@ -867,10 +908,10 @@ function NumberInput({
|
|
|
867
908
|
}
|
|
868
909
|
|
|
869
910
|
// src/components/PasswordInput/PasswordInput.tsx
|
|
870
|
-
var
|
|
871
|
-
var
|
|
872
|
-
var
|
|
873
|
-
var PasswordInput =
|
|
911
|
+
var React7 = __toESM(require("react"), 1);
|
|
912
|
+
var import_fractal_icons6 = require("@mirror-physics/fractal-icons");
|
|
913
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
914
|
+
var PasswordInput = React7.forwardRef(
|
|
874
915
|
({
|
|
875
916
|
className,
|
|
876
917
|
disabled,
|
|
@@ -878,15 +919,15 @@ var PasswordInput = React6.forwardRef(
|
|
|
878
919
|
hidePasswordLabel = "Hide password",
|
|
879
920
|
...props
|
|
880
921
|
}, ref) => {
|
|
881
|
-
const [passwordVisible, setPasswordVisible] =
|
|
922
|
+
const [passwordVisible, setPasswordVisible] = React7.useState(false);
|
|
882
923
|
const toggleLabel = passwordVisible ? hidePasswordLabel : showPasswordLabel;
|
|
883
|
-
return /* @__PURE__ */ (0,
|
|
924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
884
925
|
"div",
|
|
885
926
|
{
|
|
886
927
|
className: cn("fractal-password-input", className),
|
|
887
928
|
"data-password-visible": passwordVisible ? "" : void 0,
|
|
888
929
|
children: [
|
|
889
|
-
/* @__PURE__ */ (0,
|
|
930
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
890
931
|
Input,
|
|
891
932
|
{
|
|
892
933
|
...props,
|
|
@@ -896,7 +937,7 @@ var PasswordInput = React6.forwardRef(
|
|
|
896
937
|
type: passwordVisible ? "text" : "password"
|
|
897
938
|
}
|
|
898
939
|
),
|
|
899
|
-
/* @__PURE__ */ (0,
|
|
940
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
900
941
|
"button",
|
|
901
942
|
{
|
|
902
943
|
type: "button",
|
|
@@ -906,7 +947,7 @@ var PasswordInput = React6.forwardRef(
|
|
|
906
947
|
disabled,
|
|
907
948
|
title: toggleLabel,
|
|
908
949
|
onClick: () => setPasswordVisible((visible) => !visible),
|
|
909
|
-
children: passwordVisible ? /* @__PURE__ */ (0,
|
|
950
|
+
children: passwordVisible ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_fractal_icons6.EyeSlash, { "aria-hidden": "true", size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_fractal_icons6.Eye, { "aria-hidden": "true", size: 18 })
|
|
910
951
|
}
|
|
911
952
|
)
|
|
912
953
|
]
|
|
@@ -917,10 +958,10 @@ var PasswordInput = React6.forwardRef(
|
|
|
917
958
|
PasswordInput.displayName = "PasswordInput";
|
|
918
959
|
|
|
919
960
|
// src/components/Label/Label.tsx
|
|
920
|
-
var
|
|
921
|
-
var
|
|
922
|
-
var Label =
|
|
923
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
961
|
+
var React8 = __toESM(require("react"), 1);
|
|
962
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
963
|
+
var Label = React8.forwardRef(
|
|
964
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
924
965
|
"label",
|
|
925
966
|
{
|
|
926
967
|
ref,
|
|
@@ -932,20 +973,20 @@ var Label = React7.forwardRef(
|
|
|
932
973
|
Label.displayName = "Label";
|
|
933
974
|
|
|
934
975
|
// src/components/Alert/Alert.tsx
|
|
935
|
-
var
|
|
936
|
-
var
|
|
937
|
-
var
|
|
976
|
+
var React9 = __toESM(require("react"), 1);
|
|
977
|
+
var import_fractal_icons7 = require("@mirror-physics/fractal-icons");
|
|
978
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
938
979
|
var defaultIcons = {
|
|
939
|
-
default:
|
|
940
|
-
info:
|
|
941
|
-
success:
|
|
942
|
-
warning:
|
|
943
|
-
error:
|
|
980
|
+
default: import_fractal_icons7.CircleInfo,
|
|
981
|
+
info: import_fractal_icons7.CircleInfo,
|
|
982
|
+
success: import_fractal_icons7.CircleCheck,
|
|
983
|
+
warning: import_fractal_icons7.Warning,
|
|
984
|
+
error: import_fractal_icons7.CircleClose
|
|
944
985
|
};
|
|
945
|
-
var Alert =
|
|
986
|
+
var Alert = React9.forwardRef(
|
|
946
987
|
({ className, variant = "default", icon, children, ...props }, ref) => {
|
|
947
988
|
const DefaultIcon = defaultIcons[variant];
|
|
948
|
-
return /* @__PURE__ */ (0,
|
|
989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
949
990
|
"div",
|
|
950
991
|
{
|
|
951
992
|
ref,
|
|
@@ -953,27 +994,27 @@ var Alert = React8.forwardRef(
|
|
|
953
994
|
className: cn("fractal-alert", `fractal-alert--${variant}`, className),
|
|
954
995
|
...props,
|
|
955
996
|
children: [
|
|
956
|
-
/* @__PURE__ */ (0,
|
|
957
|
-
/* @__PURE__ */ (0,
|
|
997
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "fractal-alert-icon", "aria-hidden": true, children: icon ?? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DefaultIcon, { size: 18 }) }),
|
|
998
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "fractal-alert-content", children })
|
|
958
999
|
]
|
|
959
1000
|
}
|
|
960
1001
|
);
|
|
961
1002
|
}
|
|
962
1003
|
);
|
|
963
1004
|
Alert.displayName = "Alert";
|
|
964
|
-
var AlertTitle =
|
|
965
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1005
|
+
var AlertTitle = React9.forwardRef(
|
|
1006
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h5", { ref, className: cn("fractal-alert-title", className), ...props })
|
|
966
1007
|
);
|
|
967
1008
|
AlertTitle.displayName = "AlertTitle";
|
|
968
|
-
var AlertDescription =
|
|
969
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1009
|
+
var AlertDescription = React9.forwardRef(
|
|
1010
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ref, className: cn("fractal-alert-description", className), ...props })
|
|
970
1011
|
);
|
|
971
1012
|
AlertDescription.displayName = "AlertDescription";
|
|
972
1013
|
|
|
973
1014
|
// src/components/Toggle/Toggle.tsx
|
|
974
|
-
var
|
|
1015
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
975
1016
|
function Toggle({ checked, onChange, label, className }) {
|
|
976
|
-
return /* @__PURE__ */ (0,
|
|
1017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
977
1018
|
"button",
|
|
978
1019
|
{
|
|
979
1020
|
type: "button",
|
|
@@ -982,8 +1023,8 @@ function Toggle({ checked, onChange, label, className }) {
|
|
|
982
1023
|
className: cn("fractal-toggle", className),
|
|
983
1024
|
onClick: () => onChange(!checked),
|
|
984
1025
|
children: [
|
|
985
|
-
/* @__PURE__ */ (0,
|
|
986
|
-
label && /* @__PURE__ */ (0,
|
|
1026
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: cn("fractal-toggle-track", checked && "fractal-toggle-track--checked"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: cn("fractal-toggle-thumb", checked && "fractal-toggle-thumb--checked") }) }),
|
|
1027
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "fractal-toggle-label", children: label })
|
|
987
1028
|
]
|
|
988
1029
|
}
|
|
989
1030
|
);
|
|
@@ -1044,7 +1085,7 @@ function useEscapeDismiss(priority, handler, enabled = true) {
|
|
|
1044
1085
|
|
|
1045
1086
|
// src/components/UILoader/UILoader.tsx
|
|
1046
1087
|
var import_react3 = require("react");
|
|
1047
|
-
var
|
|
1088
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1048
1089
|
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";
|
|
1049
1090
|
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";
|
|
1050
1091
|
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";
|
|
@@ -1053,7 +1094,7 @@ function UILoader({ size = 48, tone = "neutral", className, style, label = "Load
|
|
|
1053
1094
|
const clipId = `fractal-ui-loader-clip-${rawId}`;
|
|
1054
1095
|
const gradientId = `fractal-ui-loader-gradient-${rawId}`;
|
|
1055
1096
|
const height = typeof size === "number" ? `${size}px` : size;
|
|
1056
|
-
return /* @__PURE__ */ (0,
|
|
1097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1057
1098
|
"span",
|
|
1058
1099
|
{
|
|
1059
1100
|
"aria-hidden": ariaHidden || void 0,
|
|
@@ -1061,52 +1102,52 @@ function UILoader({ size = 48, tone = "neutral", className, style, label = "Load
|
|
|
1061
1102
|
className: cn("fractal-ui-loader", `fractal-ui-loader--${tone}`, className),
|
|
1062
1103
|
role: ariaHidden ? void 0 : "status",
|
|
1063
1104
|
style,
|
|
1064
|
-
children: /* @__PURE__ */ (0,
|
|
1065
|
-
/* @__PURE__ */ (0,
|
|
1066
|
-
/* @__PURE__ */ (0,
|
|
1067
|
-
/* @__PURE__ */ (0,
|
|
1068
|
-
/* @__PURE__ */ (0,
|
|
1105
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { "aria-hidden": "true", fill: "none", viewBox: "0 0 144 92", style: { height, width: "auto" }, children: [
|
|
1106
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("defs", { children: [
|
|
1107
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("linearGradient", { id: gradientId, x1: "59", x2: "94.3", y1: "0", y2: "89.1", gradientUnits: "userSpaceOnUse", children: [
|
|
1108
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("stop", { className: "fractal-ui-loader__stop-start", offset: "0" }),
|
|
1109
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("stop", { className: "fractal-ui-loader__stop-end", offset: "1" })
|
|
1069
1110
|
] }),
|
|
1070
|
-
/* @__PURE__ */ (0,
|
|
1071
|
-
/* @__PURE__ */ (0,
|
|
1072
|
-
/* @__PURE__ */ (0,
|
|
1073
|
-
/* @__PURE__ */ (0,
|
|
1111
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("linearGradient", { id: `${gradientId}-shine`, x1: "0", x2: "1", y1: "0", y2: "0", children: [
|
|
1112
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("stop", { offset: "0.4", stopColor: "white", stopOpacity: "0" }),
|
|
1113
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("stop", { offset: "0.5", stopColor: "white", stopOpacity: "0.62" }),
|
|
1114
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("stop", { offset: "0.6", stopColor: "white", stopOpacity: "0" })
|
|
1074
1115
|
] }),
|
|
1075
|
-
/* @__PURE__ */ (0,
|
|
1076
|
-
/* @__PURE__ */ (0,
|
|
1077
|
-
/* @__PURE__ */ (0,
|
|
1078
|
-
/* @__PURE__ */ (0,
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("clipPath", { id: clipId, children: [
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: LEFT }),
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: CENTER }),
|
|
1119
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: RIGHT })
|
|
1079
1120
|
] })
|
|
1080
1121
|
] }),
|
|
1081
|
-
/* @__PURE__ */ (0,
|
|
1082
|
-
/* @__PURE__ */ (0,
|
|
1083
|
-
/* @__PURE__ */ (0,
|
|
1084
|
-
/* @__PURE__ */ (0,
|
|
1122
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: CENTER, fill: `url(#${gradientId})` }),
|
|
1123
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: RIGHT, fill: `url(#${gradientId})` }),
|
|
1124
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: LEFT, fill: `url(#${gradientId})` }),
|
|
1125
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("g", { clipPath: `url(#${clipId})`, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("g", { className: "fractal-ui-loader__shine-axis", transform: "translate(72 46) rotate(68.4)", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { className: "fractal-ui-loader__shine", x: "-160", y: "-100", width: "320", height: "200", fill: `url(#${gradientId}-shine)` }) }) })
|
|
1085
1126
|
] })
|
|
1086
1127
|
}
|
|
1087
1128
|
);
|
|
1088
1129
|
}
|
|
1089
1130
|
|
|
1090
1131
|
// src/components/Modal/Modal.tsx
|
|
1091
|
-
var
|
|
1092
|
-
var CloseIcon = () => /* @__PURE__ */ (0,
|
|
1132
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1133
|
+
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1093
1134
|
function Modal({ open, onClose, title, children, danger, warn, footer, noClose, closeDisabled = false, size = "sm", loading = false, loadingLabel = "Loading", scrollable = false, className }) {
|
|
1094
1135
|
useEscapeDismiss(80, onClose, open && !noClose && !closeDisabled);
|
|
1095
1136
|
if (!open) return null;
|
|
1096
1137
|
const sizeClass = `fractal-modal-panel--${size}`;
|
|
1097
1138
|
const accentClass = danger ? "fractal-modal-panel--danger" : warn ? "fractal-modal-panel--warn" : "";
|
|
1098
1139
|
return (0, import_react_dom.createPortal)(
|
|
1099
|
-
/* @__PURE__ */ (0,
|
|
1140
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "fractal-modal-overlay", onClick: noClose || closeDisabled ? void 0 : onClose, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1100
1141
|
"div",
|
|
1101
1142
|
{
|
|
1102
1143
|
className: cn("fractal-modal-panel", sizeClass, accentClass, scrollable && "fractal-modal-panel--scrollable", className),
|
|
1103
1144
|
onClick: (e) => e.stopPropagation(),
|
|
1104
1145
|
children: [
|
|
1105
|
-
/* @__PURE__ */ (0,
|
|
1106
|
-
/* @__PURE__ */ (0,
|
|
1107
|
-
!noClose && /* @__PURE__ */ (0,
|
|
1146
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fractal-modal-title-row", children: [
|
|
1147
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: cn("fractal-modal-title", danger && "fractal-modal-title--danger", warn && "fractal-modal-title--warn"), children: title }),
|
|
1148
|
+
!noClose && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: onClose, title: "Close", disabled: closeDisabled, className: "fractal-modal-close", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CloseIcon, {}) })
|
|
1108
1149
|
] }),
|
|
1109
|
-
/* @__PURE__ */ (0,
|
|
1150
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1110
1151
|
"div",
|
|
1111
1152
|
{
|
|
1112
1153
|
"aria-busy": loading || void 0,
|
|
@@ -1116,10 +1157,10 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
1116
1157
|
loading && "fractal-modal-body--loading",
|
|
1117
1158
|
scrollable && "fractal-modal-body--scrollable"
|
|
1118
1159
|
),
|
|
1119
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
1160
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(UILoader, { label: loadingLabel }) : children
|
|
1120
1161
|
}
|
|
1121
1162
|
),
|
|
1122
|
-
footer && /* @__PURE__ */ (0,
|
|
1163
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn("fractal-modal-footer", scrollable && "fractal-modal-footer--divided"), children: footer })
|
|
1123
1164
|
]
|
|
1124
1165
|
}
|
|
1125
1166
|
) }),
|
|
@@ -1128,17 +1169,17 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
1128
1169
|
}
|
|
1129
1170
|
|
|
1130
1171
|
// src/components/DataTable/DataTable.tsx
|
|
1131
|
-
var
|
|
1172
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1132
1173
|
function DataTable({ columns, data, emptyMessage, header, size = "md", className }) {
|
|
1133
|
-
return /* @__PURE__ */ (0,
|
|
1134
|
-
header && /* @__PURE__ */ (0,
|
|
1135
|
-
data.length === 0 ? /* @__PURE__ */ (0,
|
|
1136
|
-
/* @__PURE__ */ (0,
|
|
1137
|
-
/* @__PURE__ */ (0,
|
|
1174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: cn("fractal-datatable", `fractal-datatable--${size}`, className), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "fractal-datatable-surface", children: [
|
|
1175
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "fractal-datatable-header", children: header }),
|
|
1176
|
+
data.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "fractal-datatable-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { className: "fractal-datatable-table", children: [
|
|
1177
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { className: "fractal-datatable-thead-row", children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("th", { className: "fractal-datatable-th", style: { width: col.width }, children: col.header }, col.key)) }) }),
|
|
1178
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { children: data.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1138
1179
|
"tr",
|
|
1139
1180
|
{
|
|
1140
1181
|
className: "fractal-datatable-row",
|
|
1141
|
-
children: columns.map((col) => /* @__PURE__ */ (0,
|
|
1182
|
+
children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: "fractal-datatable-td", style: { width: col.width }, children: col.render(row, rowIndex) }, col.key))
|
|
1142
1183
|
},
|
|
1143
1184
|
rowIndex
|
|
1144
1185
|
)) })
|
|
@@ -1147,9 +1188,9 @@ function DataTable({ columns, data, emptyMessage, header, size = "md", className
|
|
|
1147
1188
|
}
|
|
1148
1189
|
|
|
1149
1190
|
// src/components/Dropdown/Dropdown.tsx
|
|
1150
|
-
var
|
|
1151
|
-
var
|
|
1152
|
-
var
|
|
1191
|
+
var React10 = __toESM(require("react"), 1);
|
|
1192
|
+
var import_fractal_icons8 = require("@mirror-physics/fractal-icons");
|
|
1193
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1153
1194
|
var MARGIN = 4;
|
|
1154
1195
|
function Dropdown({
|
|
1155
1196
|
items,
|
|
@@ -1171,10 +1212,10 @@ function Dropdown({
|
|
|
1171
1212
|
closeOnSelect = true,
|
|
1172
1213
|
disabled = false
|
|
1173
1214
|
}) {
|
|
1174
|
-
const [open, setOpen] =
|
|
1175
|
-
const triggerRef =
|
|
1176
|
-
const panelRef =
|
|
1177
|
-
const [panelStyle, setPanelStyle] =
|
|
1215
|
+
const [open, setOpen] = React10.useState(false);
|
|
1216
|
+
const triggerRef = React10.useRef(null);
|
|
1217
|
+
const panelRef = React10.useRef(null);
|
|
1218
|
+
const [panelStyle, setPanelStyle] = React10.useState({});
|
|
1178
1219
|
const visibleItems = items.filter(
|
|
1179
1220
|
(item) => item.icon != null || item.description != null && (typeof item.description === "string" ? item.description !== "" : true)
|
|
1180
1221
|
);
|
|
@@ -1183,8 +1224,8 @@ function Dropdown({
|
|
|
1183
1224
|
const selected = items.find((i) => i.value === selectedValue && i.kind !== "header") ?? selectableItems[0] ?? visibleItems[0];
|
|
1184
1225
|
const isUp = direction === "up";
|
|
1185
1226
|
const isHorizontalDirection = direction === "left" || direction === "right";
|
|
1186
|
-
const ChevronIcon = direction === "up" ?
|
|
1187
|
-
|
|
1227
|
+
const ChevronIcon = direction === "up" ? import_fractal_icons8.ChevronUp : direction === "left" ? import_fractal_icons8.ChevronLeft : direction === "right" ? import_fractal_icons8.ChevronRight : import_fractal_icons8.ChevronDown;
|
|
1228
|
+
React10.useLayoutEffect(() => {
|
|
1188
1229
|
if (!open || !triggerRef.current || !panelRef.current) return;
|
|
1189
1230
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
1190
1231
|
const panelRect = panelRef.current.getBoundingClientRect();
|
|
@@ -1235,7 +1276,7 @@ function Dropdown({
|
|
|
1235
1276
|
}
|
|
1236
1277
|
setPanelStyle({ top, left, right });
|
|
1237
1278
|
}, [open, direction, isHorizontalDirection, isUp, align]);
|
|
1238
|
-
|
|
1279
|
+
React10.useEffect(() => {
|
|
1239
1280
|
if (!open) return;
|
|
1240
1281
|
const handleClickOutside = (e) => {
|
|
1241
1282
|
const target = e.target;
|
|
@@ -1245,8 +1286,8 @@ function Dropdown({
|
|
|
1245
1286
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1246
1287
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1247
1288
|
}, [open]);
|
|
1248
|
-
return /* @__PURE__ */ (0,
|
|
1249
|
-
/* @__PURE__ */ (0,
|
|
1289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: cn("fractal-dropdown", className), children: [
|
|
1290
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1250
1291
|
"button",
|
|
1251
1292
|
{
|
|
1252
1293
|
ref: triggerRef,
|
|
@@ -1265,15 +1306,15 @@ function Dropdown({
|
|
|
1265
1306
|
triggerClassName
|
|
1266
1307
|
),
|
|
1267
1308
|
children: [
|
|
1268
|
-
triggerContent != null ? triggerContent : /* @__PURE__ */ (0,
|
|
1269
|
-
selected.icon != null && /* @__PURE__ */ (0,
|
|
1270
|
-
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */ (0,
|
|
1309
|
+
triggerContent != null ? triggerContent : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
1310
|
+
selected.icon != null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "fractal-dropdown-icon fractal-dropdown-icon--trigger", children: selected.icon }),
|
|
1311
|
+
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "fractal-dropdown-selected-text", children: selected.description })
|
|
1271
1312
|
] }),
|
|
1272
|
-
!noChevron && !iconOnly && /* @__PURE__ */ (0,
|
|
1313
|
+
!noChevron && !iconOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "fractal-dropdown-chevron", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronIcon, { size: size === "sm" ? 14 : 16 }) })
|
|
1273
1314
|
]
|
|
1274
1315
|
}
|
|
1275
1316
|
),
|
|
1276
|
-
open && /* @__PURE__ */ (0,
|
|
1317
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1277
1318
|
"div",
|
|
1278
1319
|
{
|
|
1279
1320
|
ref: panelRef,
|
|
@@ -1282,21 +1323,21 @@ function Dropdown({
|
|
|
1282
1323
|
className: cn("fractal-dropdown-panel", `fractal-dropdown-panel--${size}`, panelClassName),
|
|
1283
1324
|
style: panelStyle,
|
|
1284
1325
|
children: [
|
|
1285
|
-
label != null && /* @__PURE__ */ (0,
|
|
1326
|
+
label != null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "fractal-dropdown-label", children: label }),
|
|
1286
1327
|
visibleItems.map((item, index) => {
|
|
1287
|
-
const topDivider = item.border === "top" ? /* @__PURE__ */ (0,
|
|
1288
|
-
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */ (0,
|
|
1328
|
+
const topDivider = item.border === "top" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "fractal-dropdown-separator" }) : null;
|
|
1329
|
+
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "fractal-dropdown-separator" }) : null;
|
|
1289
1330
|
if (item.kind === "header") {
|
|
1290
|
-
return /* @__PURE__ */ (0,
|
|
1331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(React10.Fragment, { children: [
|
|
1291
1332
|
topDivider,
|
|
1292
|
-
/* @__PURE__ */ (0,
|
|
1333
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { role: "presentation", className: "fractal-dropdown-label", children: item.description }),
|
|
1293
1334
|
bottomDivider
|
|
1294
1335
|
] }, `header-${index}`);
|
|
1295
1336
|
}
|
|
1296
1337
|
const isSelected = item.value === selectedValue;
|
|
1297
|
-
return /* @__PURE__ */ (0,
|
|
1338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(React10.Fragment, { children: [
|
|
1298
1339
|
topDivider,
|
|
1299
|
-
/* @__PURE__ */ (0,
|
|
1340
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1300
1341
|
"button",
|
|
1301
1342
|
{
|
|
1302
1343
|
type: "button",
|
|
@@ -1308,9 +1349,9 @@ function Dropdown({
|
|
|
1308
1349
|
},
|
|
1309
1350
|
className: "fractal-dropdown-option",
|
|
1310
1351
|
children: [
|
|
1311
|
-
item.icon != null && /* @__PURE__ */ (0,
|
|
1312
|
-
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */ (0,
|
|
1313
|
-
item.trailing != null && /* @__PURE__ */ (0,
|
|
1352
|
+
item.icon != null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "fractal-dropdown-icon", children: item.icon }),
|
|
1353
|
+
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "fractal-dropdown-option-text", children: item.description }),
|
|
1354
|
+
item.trailing != null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "fractal-dropdown-trailing", children: item.trailing })
|
|
1314
1355
|
]
|
|
1315
1356
|
}
|
|
1316
1357
|
),
|
|
@@ -1324,10 +1365,10 @@ function Dropdown({
|
|
|
1324
1365
|
}
|
|
1325
1366
|
|
|
1326
1367
|
// src/components/Link/Link.tsx
|
|
1327
|
-
var
|
|
1328
|
-
var
|
|
1329
|
-
var Link =
|
|
1330
|
-
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */ (0,
|
|
1368
|
+
var React11 = __toESM(require("react"), 1);
|
|
1369
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1370
|
+
var Link = React11.forwardRef(
|
|
1371
|
+
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1331
1372
|
"a",
|
|
1332
1373
|
{
|
|
1333
1374
|
ref,
|
|
@@ -1339,10 +1380,10 @@ var Link = React10.forwardRef(
|
|
|
1339
1380
|
Link.displayName = "Link";
|
|
1340
1381
|
|
|
1341
1382
|
// src/components/Chip/Chip.tsx
|
|
1342
|
-
var
|
|
1343
|
-
var
|
|
1344
|
-
var Chip =
|
|
1345
|
-
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */ (0,
|
|
1383
|
+
var React12 = __toESM(require("react"), 1);
|
|
1384
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1385
|
+
var Chip = React12.forwardRef(
|
|
1386
|
+
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1346
1387
|
"span",
|
|
1347
1388
|
{
|
|
1348
1389
|
ref,
|
|
@@ -1354,8 +1395,8 @@ var Chip = React11.forwardRef(
|
|
|
1354
1395
|
Chip.displayName = "Chip";
|
|
1355
1396
|
|
|
1356
1397
|
// src/components/Checkbox/Checkbox.tsx
|
|
1357
|
-
var
|
|
1358
|
-
var
|
|
1398
|
+
var import_fractal_icons9 = require("@mirror-physics/fractal-icons");
|
|
1399
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1359
1400
|
function Checkbox({
|
|
1360
1401
|
checked,
|
|
1361
1402
|
indeterminate = false,
|
|
@@ -1366,7 +1407,7 @@ function Checkbox({
|
|
|
1366
1407
|
onKeyDown,
|
|
1367
1408
|
...props
|
|
1368
1409
|
}) {
|
|
1369
|
-
return /* @__PURE__ */ (0,
|
|
1410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1370
1411
|
"button",
|
|
1371
1412
|
{
|
|
1372
1413
|
...props,
|
|
@@ -1388,18 +1429,18 @@ function Checkbox({
|
|
|
1388
1429
|
onKeyDown?.(event);
|
|
1389
1430
|
if (event.key === " " || event.key === "Enter") event.stopPropagation();
|
|
1390
1431
|
},
|
|
1391
|
-
children: indeterminate ? /* @__PURE__ */ (0,
|
|
1392
|
-
/* @__PURE__ */ (0,
|
|
1393
|
-
/* @__PURE__ */ (0,
|
|
1394
|
-
] }) : checked ? /* @__PURE__ */ (0,
|
|
1432
|
+
children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "fractal-checkbox__indeterminate-icon", "aria-hidden": "true", children: [
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fractal_icons9.Checkbox, { size: 18 }),
|
|
1434
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fractal_icons9.Minus, { className: "fractal-checkbox__indeterminate-mark", size: 12 })
|
|
1435
|
+
] }) : checked ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fractal_icons9.CheckboxChecked, { "aria-hidden": "true", size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fractal_icons9.Checkbox, { "aria-hidden": "true", size: 18 })
|
|
1395
1436
|
}
|
|
1396
1437
|
);
|
|
1397
1438
|
}
|
|
1398
1439
|
|
|
1399
1440
|
// src/components/SortableTable/SortableTable.tsx
|
|
1400
1441
|
var import_react4 = require("react");
|
|
1401
|
-
var
|
|
1402
|
-
var
|
|
1442
|
+
var import_fractal_icons10 = require("@mirror-physics/fractal-icons");
|
|
1443
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1403
1444
|
function SortableTable({
|
|
1404
1445
|
columns,
|
|
1405
1446
|
data,
|
|
@@ -1475,13 +1516,13 @@ function SortableTable({
|
|
|
1475
1516
|
onSortChange?.(nextKey, nextDirection);
|
|
1476
1517
|
}
|
|
1477
1518
|
};
|
|
1478
|
-
return /* @__PURE__ */ (0,
|
|
1479
|
-
header && /* @__PURE__ */ (0,
|
|
1480
|
-
sorted.length === 0 ? /* @__PURE__ */ (0,
|
|
1481
|
-
/* @__PURE__ */ (0,
|
|
1519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("fractal-sortable-table", `fractal-sortable-table--${size}`, embedded && "fractal-sortable-table--embedded", className), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "fractal-sortable-table-surface", children: [
|
|
1520
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "fractal-sortable-table-header", children: header }),
|
|
1521
|
+
sorted.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "fractal-sortable-table-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("table", { className: "fractal-sortable-table-table", children: [
|
|
1522
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("tr", { className: "fractal-sortable-table-thead-row", children: columns.map((col) => {
|
|
1482
1523
|
const isActive = activeKey === col.key && activeDirection !== null;
|
|
1483
1524
|
if (!col.sortable) {
|
|
1484
|
-
return /* @__PURE__ */ (0,
|
|
1525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1485
1526
|
"th",
|
|
1486
1527
|
{
|
|
1487
1528
|
className: "fractal-sortable-table-th",
|
|
@@ -1491,12 +1532,12 @@ function SortableTable({
|
|
|
1491
1532
|
col.key
|
|
1492
1533
|
);
|
|
1493
1534
|
}
|
|
1494
|
-
return /* @__PURE__ */ (0,
|
|
1535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1495
1536
|
"th",
|
|
1496
1537
|
{
|
|
1497
1538
|
className: "fractal-sortable-table-th fractal-sortable-table-th--sortable",
|
|
1498
1539
|
style: { width: col.width },
|
|
1499
|
-
children: /* @__PURE__ */ (0,
|
|
1540
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1500
1541
|
"button",
|
|
1501
1542
|
{
|
|
1502
1543
|
type: "button",
|
|
@@ -1507,8 +1548,8 @@ function SortableTable({
|
|
|
1507
1548
|
onClick: () => handleSortClick(col.key),
|
|
1508
1549
|
"aria-sort": isActive ? activeDirection === "asc" ? "ascending" : "descending" : "none",
|
|
1509
1550
|
children: [
|
|
1510
|
-
/* @__PURE__ */ (0,
|
|
1511
|
-
/* @__PURE__ */ (0,
|
|
1551
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: col.header }),
|
|
1552
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "fractal-sortable-table-sort-icon", "aria-hidden": "true", children: isActive && activeDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_fractal_icons10.ArrowUp, { size: 14 }) : isActive && activeDirection === "desc" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_fractal_icons10.ArrowDown, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_fractal_icons10.ArrowsUpDown, { size: 14 }) })
|
|
1512
1553
|
]
|
|
1513
1554
|
}
|
|
1514
1555
|
)
|
|
@@ -1516,13 +1557,13 @@ function SortableTable({
|
|
|
1516
1557
|
col.key
|
|
1517
1558
|
);
|
|
1518
1559
|
}) }) }),
|
|
1519
|
-
/* @__PURE__ */ (0,
|
|
1560
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("tbody", { children: sorted.map((row, rowIndex) => {
|
|
1520
1561
|
const highlighted = highlightRow?.(row, rowIndex) ?? false;
|
|
1521
1562
|
const action = rowAction ? {
|
|
1522
1563
|
label: rowAction.label(row, rowIndex),
|
|
1523
1564
|
icon: rowAction.icon(row, rowIndex)
|
|
1524
1565
|
} : null;
|
|
1525
|
-
return /* @__PURE__ */ (0,
|
|
1566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1526
1567
|
"tr",
|
|
1527
1568
|
{
|
|
1528
1569
|
className: cn(
|
|
@@ -1540,7 +1581,7 @@ function SortableTable({
|
|
|
1540
1581
|
"aria-label": action?.label,
|
|
1541
1582
|
role: onRowClick ? "button" : void 0,
|
|
1542
1583
|
tabIndex: onRowClick ? 0 : void 0,
|
|
1543
|
-
children: columns.map((col, columnIndex) => /* @__PURE__ */ (0,
|
|
1584
|
+
children: columns.map((col, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1544
1585
|
"td",
|
|
1545
1586
|
{
|
|
1546
1587
|
className: cn(
|
|
@@ -1550,7 +1591,7 @@ function SortableTable({
|
|
|
1550
1591
|
style: { width: col.width, textAlign: col.align ?? "left" },
|
|
1551
1592
|
children: [
|
|
1552
1593
|
col.render(row, rowIndex),
|
|
1553
|
-
action && columnIndex === columns.length - 1 && /* @__PURE__ */ (0,
|
|
1594
|
+
action && columnIndex === columns.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "fractal-sortable-table-row-action", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "fractal-sortable-table-row-action__icon", children: action.icon }) })
|
|
1554
1595
|
]
|
|
1555
1596
|
},
|
|
1556
1597
|
col.key
|
|
@@ -1565,7 +1606,7 @@ function SortableTable({
|
|
|
1565
1606
|
|
|
1566
1607
|
// src/components/Tabs/Tabs.tsx
|
|
1567
1608
|
var import_react5 = require("react");
|
|
1568
|
-
var
|
|
1609
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1569
1610
|
function Tabs({
|
|
1570
1611
|
items,
|
|
1571
1612
|
defaultValue,
|
|
@@ -1636,8 +1677,8 @@ function Tabs({
|
|
|
1636
1677
|
selectTab(nextId2);
|
|
1637
1678
|
requestAnimationFrame(() => tabRefs.current[nextId2]?.focus());
|
|
1638
1679
|
};
|
|
1639
|
-
return /* @__PURE__ */ (0,
|
|
1640
|
-
/* @__PURE__ */ (0,
|
|
1680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cn("fractal-tabs", `fractal-tabs--${variant}`, divider && "fractal-tabs--divider", className), children: [
|
|
1681
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1641
1682
|
"div",
|
|
1642
1683
|
{
|
|
1643
1684
|
ref: tabListRef,
|
|
@@ -1650,7 +1691,7 @@ function Tabs({
|
|
|
1650
1691
|
const isActive = item.id === activeId;
|
|
1651
1692
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
1652
1693
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
1653
|
-
return /* @__PURE__ */ (0,
|
|
1694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1654
1695
|
"button",
|
|
1655
1696
|
{
|
|
1656
1697
|
ref: (el) => {
|
|
@@ -1681,7 +1722,7 @@ function Tabs({
|
|
|
1681
1722
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
1682
1723
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
1683
1724
|
const isActive = item.id === activeId;
|
|
1684
|
-
return /* @__PURE__ */ (0,
|
|
1725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1685
1726
|
"div",
|
|
1686
1727
|
{
|
|
1687
1728
|
id: panelId,
|
|
@@ -1698,14 +1739,14 @@ function Tabs({
|
|
|
1698
1739
|
}
|
|
1699
1740
|
|
|
1700
1741
|
// src/components/ContentSwitcher/ContentSwitcher.tsx
|
|
1701
|
-
var
|
|
1702
|
-
var
|
|
1742
|
+
var React13 = __toESM(require("react"), 1);
|
|
1743
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1703
1744
|
function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = false, className }) {
|
|
1704
|
-
const switcherRef =
|
|
1705
|
-
const buttonRefs =
|
|
1706
|
-
const indicatorMotionReadyRef =
|
|
1745
|
+
const switcherRef = React13.useRef(null);
|
|
1746
|
+
const buttonRefs = React13.useRef([]);
|
|
1747
|
+
const indicatorMotionReadyRef = React13.useRef(false);
|
|
1707
1748
|
const activeIndex = items.findIndex((item) => item.value === value);
|
|
1708
|
-
|
|
1749
|
+
React13.useLayoutEffect(() => {
|
|
1709
1750
|
const switcher = switcherRef.current;
|
|
1710
1751
|
const activeButton = buttonRefs.current[activeIndex];
|
|
1711
1752
|
let motionFrame = 0;
|
|
@@ -1757,7 +1798,7 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1757
1798
|
onValueChange(items[nextIndex].value);
|
|
1758
1799
|
}
|
|
1759
1800
|
};
|
|
1760
|
-
return /* @__PURE__ */ (0,
|
|
1801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1761
1802
|
"div",
|
|
1762
1803
|
{
|
|
1763
1804
|
className: cn("fractal-content-switcher", fullWidth && "fractal-content-switcher--full-width", className),
|
|
@@ -1765,10 +1806,10 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1765
1806
|
"aria-label": ariaLabel,
|
|
1766
1807
|
ref: switcherRef,
|
|
1767
1808
|
children: [
|
|
1768
|
-
/* @__PURE__ */ (0,
|
|
1809
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fractal-content-switcher__indicator", "aria-hidden": true }),
|
|
1769
1810
|
items.map((item, index) => {
|
|
1770
1811
|
const active = item.value === value;
|
|
1771
|
-
return /* @__PURE__ */ (0,
|
|
1812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1772
1813
|
"button",
|
|
1773
1814
|
{
|
|
1774
1815
|
className: cn("fractal-content-switcher__item", active && "fractal-content-switcher__item--active"),
|
|
@@ -1801,8 +1842,8 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1801
1842
|
|
|
1802
1843
|
// src/components/Disclosure/Disclosure.tsx
|
|
1803
1844
|
var import_react6 = require("react");
|
|
1804
|
-
var
|
|
1805
|
-
var
|
|
1845
|
+
var import_fractal_icons11 = require("@mirror-physics/fractal-icons");
|
|
1846
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1806
1847
|
function Disclosure({
|
|
1807
1848
|
title,
|
|
1808
1849
|
meta,
|
|
@@ -1830,7 +1871,7 @@ function Disclosure({
|
|
|
1830
1871
|
onOpenChange?.(next);
|
|
1831
1872
|
}
|
|
1832
1873
|
};
|
|
1833
|
-
return /* @__PURE__ */ (0,
|
|
1874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1834
1875
|
"div",
|
|
1835
1876
|
{
|
|
1836
1877
|
className: cn(
|
|
@@ -1841,7 +1882,7 @@ function Disclosure({
|
|
|
1841
1882
|
className
|
|
1842
1883
|
),
|
|
1843
1884
|
children: [
|
|
1844
|
-
/* @__PURE__ */ (0,
|
|
1885
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1845
1886
|
"button",
|
|
1846
1887
|
{
|
|
1847
1888
|
type: "button",
|
|
@@ -1852,13 +1893,13 @@ function Disclosure({
|
|
|
1852
1893
|
disabled,
|
|
1853
1894
|
onClick: toggle,
|
|
1854
1895
|
children: [
|
|
1855
|
-
/* @__PURE__ */ (0,
|
|
1856
|
-
/* @__PURE__ */ (0,
|
|
1857
|
-
meta && /* @__PURE__ */ (0,
|
|
1896
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "fractal-disclosure-icon", "aria-hidden": "true", children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fractal_icons11.ChevronDown, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fractal_icons11.ChevronRight, { size: 16 }) }),
|
|
1897
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "fractal-disclosure-title", children: title }),
|
|
1898
|
+
meta && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "fractal-disclosure-meta", children: meta })
|
|
1858
1899
|
]
|
|
1859
1900
|
}
|
|
1860
1901
|
),
|
|
1861
|
-
/* @__PURE__ */ (0,
|
|
1902
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1862
1903
|
"div",
|
|
1863
1904
|
{
|
|
1864
1905
|
id: panelId,
|
|
@@ -1866,7 +1907,7 @@ function Disclosure({
|
|
|
1866
1907
|
"aria-labelledby": headerId,
|
|
1867
1908
|
className: "fractal-disclosure-panel",
|
|
1868
1909
|
hidden: !isOpen,
|
|
1869
|
-
children: /* @__PURE__ */ (0,
|
|
1910
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "fractal-disclosure-panel-inner", children })
|
|
1870
1911
|
}
|
|
1871
1912
|
)
|
|
1872
1913
|
]
|
|
@@ -1875,18 +1916,18 @@ function Disclosure({
|
|
|
1875
1916
|
}
|
|
1876
1917
|
|
|
1877
1918
|
// src/components/LatticeLoader/LatticeLoader.tsx
|
|
1878
|
-
var
|
|
1919
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1879
1920
|
var LATTICE_COUNT = 160;
|
|
1880
1921
|
var WAVE_PERIOD = 80;
|
|
1881
1922
|
function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
1882
|
-
return /* @__PURE__ */ (0,
|
|
1923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1883
1924
|
"span",
|
|
1884
1925
|
{
|
|
1885
1926
|
"aria-label": label,
|
|
1886
1927
|
className: cn("fractal-lattice-loader", className),
|
|
1887
1928
|
role: "progressbar",
|
|
1888
1929
|
...props,
|
|
1889
|
-
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ (0,
|
|
1930
|
+
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1890
1931
|
"span",
|
|
1891
1932
|
{
|
|
1892
1933
|
"aria-hidden": "true",
|
|
@@ -1900,10 +1941,10 @@ function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
|
1900
1941
|
}
|
|
1901
1942
|
|
|
1902
1943
|
// src/components/Ghost/Ghost.tsx
|
|
1903
|
-
var
|
|
1944
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1904
1945
|
var toCssLength = (value) => typeof value === "number" ? `${value}px` : value;
|
|
1905
1946
|
function Ghost({ className, width, height, radius, style, ...props }) {
|
|
1906
|
-
return /* @__PURE__ */ (0,
|
|
1947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1907
1948
|
"div",
|
|
1908
1949
|
{
|
|
1909
1950
|
"aria-hidden": "true",
|
|
@@ -1919,15 +1960,15 @@ function Ghost({ className, width, height, radius, style, ...props }) {
|
|
|
1919
1960
|
);
|
|
1920
1961
|
}
|
|
1921
1962
|
function GhostLine({ className, size = "md", width = "100%", ...props }) {
|
|
1922
|
-
return /* @__PURE__ */ (0,
|
|
1963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Ghost, { className: cn("fractal-ghost-line", `fractal-ghost-line--${size}`, className), width, ...props });
|
|
1923
1964
|
}
|
|
1924
1965
|
function ButtonGhost({ className, size = "md", iconOnly = false, width, ...props }) {
|
|
1925
|
-
return /* @__PURE__ */ (0,
|
|
1966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Ghost, { className: cn("fractal-ghost-button", `fractal-ghost-button--${size}`, iconOnly && "fractal-ghost-button--icon-only", className), width, ...props });
|
|
1926
1967
|
}
|
|
1927
1968
|
function CardGhost({ className, lines = 3, showHeader = true, ...props }) {
|
|
1928
|
-
return /* @__PURE__ */ (0,
|
|
1929
|
-
showHeader && /* @__PURE__ */ (0,
|
|
1930
|
-
/* @__PURE__ */ (0,
|
|
1969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-card", className), ...props, children: [
|
|
1970
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: "38%" }),
|
|
1971
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: index === lines - 1 ? "62%" : "100%" }, index)) })
|
|
1931
1972
|
] });
|
|
1932
1973
|
}
|
|
1933
1974
|
function DataTableGhost({
|
|
@@ -1941,81 +1982,81 @@ function DataTableGhost({
|
|
|
1941
1982
|
...props
|
|
1942
1983
|
}) {
|
|
1943
1984
|
const cells = Array.from({ length: columns }, (_, index) => index);
|
|
1944
|
-
return /* @__PURE__ */ (0,
|
|
1945
|
-
(showHeader || headers) && /* @__PURE__ */ (0,
|
|
1946
|
-
/* @__PURE__ */ (0,
|
|
1985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { "aria-busy": "true", "aria-label": "Loading table", className: cn("fractal-ghost-table", `fractal-ghost-table--${size}`, className), role: "status", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("table", { className: "fractal-ghost-table__table", children: [
|
|
1986
|
+
(showHeader || headers) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tr", { className: "fractal-ghost-table__head-row", children: cells.map((index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("th", { style: { width: columnWidths?.[index] }, children: headers?.[index] ?? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { size: "sm", width: index === columns - 1 ? "62%" : "76%" }) }, index)) }) }),
|
|
1987
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tbody", { children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tr", { className: "fractal-ghost-table__row", children: cells.map((columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { style: { width: columnWidths?.[columnIndex] }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: `${[72, 54, 82, 63, 46][(rowIndex + columnIndex) % 5]}%` }) }, columnIndex)) }, rowIndex)) })
|
|
1947
1988
|
] }) });
|
|
1948
1989
|
}
|
|
1949
1990
|
function InputGhost({ className, labelWidth = "26%", ...props }) {
|
|
1950
|
-
return /* @__PURE__ */ (0,
|
|
1991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FormFieldGhost, { className, labelWidth, ...props });
|
|
1951
1992
|
}
|
|
1952
1993
|
function TextareaGhost({ className, labelWidth = "26%", ...props }) {
|
|
1953
|
-
return /* @__PURE__ */ (0,
|
|
1994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FormFieldGhost, { className, labelWidth, multiline: true, ...props });
|
|
1954
1995
|
}
|
|
1955
1996
|
function LabelGhost({ className, width = "26%", ...props }) {
|
|
1956
|
-
return /* @__PURE__ */ (0,
|
|
1997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { className: cn("fractal-ghost-label", className), size: "sm", width, ...props });
|
|
1957
1998
|
}
|
|
1958
1999
|
function FormFieldGhost({ className, labelWidth = "26%", multiline = false, ...props }) {
|
|
1959
|
-
return /* @__PURE__ */ (0,
|
|
1960
|
-
/* @__PURE__ */ (0,
|
|
1961
|
-
/* @__PURE__ */ (0,
|
|
2000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-field", className), ...props, children: [
|
|
2001
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LabelGhost, { width: labelWidth }),
|
|
2002
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Ghost, { className: cn("fractal-ghost-field__control", multiline && "fractal-ghost-field__control--multiline") })
|
|
1962
2003
|
] });
|
|
1963
2004
|
}
|
|
1964
2005
|
function AlertGhost({ className, ...props }) {
|
|
1965
|
-
return /* @__PURE__ */ (0,
|
|
1966
|
-
/* @__PURE__ */ (0,
|
|
1967
|
-
/* @__PURE__ */ (0,
|
|
2006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-alert", className), ...props, children: [
|
|
2007
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: "30%" }),
|
|
2008
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { size: "sm", width: "78%" })
|
|
1968
2009
|
] });
|
|
1969
2010
|
}
|
|
1970
2011
|
function CheckboxGhost({ className, ...props }) {
|
|
1971
|
-
return /* @__PURE__ */ (0,
|
|
1972
|
-
/* @__PURE__ */ (0,
|
|
1973
|
-
/* @__PURE__ */ (0,
|
|
2012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-choice", className), ...props, children: [
|
|
2013
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Ghost, { className: "fractal-ghost-choice__control" }),
|
|
2014
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: "42%" })
|
|
1974
2015
|
] });
|
|
1975
2016
|
}
|
|
1976
2017
|
var ToggleGhost = CheckboxGhost;
|
|
1977
2018
|
function ChipGhost({ className, width = 74, ...props }) {
|
|
1978
|
-
return /* @__PURE__ */ (0,
|
|
2019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Ghost, { className: cn("fractal-ghost-chip", className), height: 24, width, ...props });
|
|
1979
2020
|
}
|
|
1980
2021
|
function LinkGhost({ className, width = 96, ...props }) {
|
|
1981
|
-
return /* @__PURE__ */ (0,
|
|
2022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { className: cn("fractal-ghost-link", className), size: "sm", width, ...props });
|
|
1982
2023
|
}
|
|
1983
2024
|
var TextButtonGhost = LinkGhost;
|
|
1984
2025
|
function DropdownGhost({ className, ...props }) {
|
|
1985
|
-
return /* @__PURE__ */ (0,
|
|
1986
|
-
/* @__PURE__ */ (0,
|
|
1987
|
-
/* @__PURE__ */ (0,
|
|
2026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropdown", className), ...props, children: [
|
|
2027
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: "38%" }),
|
|
2028
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Ghost, { className: "fractal-ghost-dropdown__chevron" })
|
|
1988
2029
|
] });
|
|
1989
2030
|
}
|
|
1990
2031
|
function ContentSwitcherGhost({ className, options = 3, ...props }) {
|
|
1991
|
-
return /* @__PURE__ */ (0,
|
|
2032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { "aria-hidden": "true", className: cn("fractal-ghost-switcher", className), ...props, children: Array.from({ length: options }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Ghost, {}, index)) });
|
|
1992
2033
|
}
|
|
1993
2034
|
var TabsGhost = ContentSwitcherGhost;
|
|
1994
2035
|
function DisclosureGhost({ className, ...props }) {
|
|
1995
|
-
return /* @__PURE__ */ (0,
|
|
1996
|
-
/* @__PURE__ */ (0,
|
|
1997
|
-
/* @__PURE__ */ (0,
|
|
2036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-disclosure", className), ...props, children: [
|
|
2037
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Ghost, { className: "fractal-ghost-disclosure__icon" }),
|
|
2038
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: "42%" })
|
|
1998
2039
|
] });
|
|
1999
2040
|
}
|
|
2000
2041
|
function PaginationGhost({ className, pages = 5, ...props }) {
|
|
2001
|
-
return /* @__PURE__ */ (0,
|
|
2042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { "aria-hidden": "true", className: cn("fractal-ghost-pagination", className), ...props, children: Array.from({ length: pages }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Ghost, {}, index)) });
|
|
2002
2043
|
}
|
|
2003
2044
|
function FileDropzoneGhost({ className, ...props }) {
|
|
2004
|
-
return /* @__PURE__ */ (0,
|
|
2005
|
-
/* @__PURE__ */ (0,
|
|
2006
|
-
/* @__PURE__ */ (0,
|
|
2007
|
-
/* @__PURE__ */ (0,
|
|
2045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropzone", className), ...props, children: [
|
|
2046
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Ghost, { className: "fractal-ghost-dropzone__icon" }),
|
|
2047
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: "26%" }),
|
|
2048
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { size: "sm", width: "46%" })
|
|
2008
2049
|
] });
|
|
2009
2050
|
}
|
|
2010
2051
|
function PromptCardGhost({ className, ...props }) {
|
|
2011
|
-
return /* @__PURE__ */ (0,
|
|
2052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CardGhost, { className: cn("fractal-ghost-prompt-card", className), lines: 4, ...props });
|
|
2012
2053
|
}
|
|
2013
2054
|
function ConversationGhost({
|
|
2014
2055
|
className,
|
|
2015
2056
|
"aria-label": ariaLabel = "Loading conversation",
|
|
2016
2057
|
...props
|
|
2017
2058
|
}) {
|
|
2018
|
-
return /* @__PURE__ */ (0,
|
|
2059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2019
2060
|
"div",
|
|
2020
2061
|
{
|
|
2021
2062
|
"aria-busy": "true",
|
|
@@ -2024,54 +2065,54 @@ function ConversationGhost({
|
|
|
2024
2065
|
role: "status",
|
|
2025
2066
|
...props,
|
|
2026
2067
|
children: [
|
|
2027
|
-
/* @__PURE__ */ (0,
|
|
2028
|
-
/* @__PURE__ */ (0,
|
|
2029
|
-
/* @__PURE__ */ (0,
|
|
2030
|
-
/* @__PURE__ */ (0,
|
|
2068
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--user", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "fractal-ghost-conversation__bubble", children: [
|
|
2069
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: "100%" }),
|
|
2070
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: "86%" }),
|
|
2071
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: "64%" })
|
|
2031
2072
|
] }) }),
|
|
2032
|
-
/* @__PURE__ */ (0,
|
|
2033
|
-
/* @__PURE__ */ (0,
|
|
2034
|
-
/* @__PURE__ */ (0,
|
|
2035
|
-
/* @__PURE__ */ (0,
|
|
2073
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--assistant", children: [
|
|
2074
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: "92%" }),
|
|
2075
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: "78%" }),
|
|
2076
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: "58%" })
|
|
2036
2077
|
] })
|
|
2037
2078
|
]
|
|
2038
2079
|
}
|
|
2039
2080
|
);
|
|
2040
2081
|
}
|
|
2041
2082
|
function SortableTableGhost(props) {
|
|
2042
|
-
return /* @__PURE__ */ (0,
|
|
2083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DataTableGhost, { ...props });
|
|
2043
2084
|
}
|
|
2044
2085
|
function SidebarGhost({ className, items = 6, ...props }) {
|
|
2045
|
-
return /* @__PURE__ */ (0,
|
|
2046
|
-
/* @__PURE__ */ (0,
|
|
2047
|
-
/* @__PURE__ */ (0,
|
|
2048
|
-
/* @__PURE__ */ (0,
|
|
2049
|
-
/* @__PURE__ */ (0,
|
|
2086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("aside", { "aria-hidden": "true", className: cn("fractal-ghost-sidebar", className), ...props, children: [
|
|
2087
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Ghost, { className: "fractal-ghost-sidebar__brand" }),
|
|
2088
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "fractal-ghost-sidebar__items", children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "fractal-ghost-sidebar__item", children: [
|
|
2089
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Ghost, {}),
|
|
2090
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: `${[54, 68, 44, 61][index % 4]}%` })
|
|
2050
2091
|
] }, index)) })
|
|
2051
2092
|
] });
|
|
2052
2093
|
}
|
|
2053
2094
|
function ModalGhost({ className, title, lines = 3, ...props }) {
|
|
2054
|
-
return /* @__PURE__ */ (0,
|
|
2095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SurfaceGhost, { className: cn("fractal-ghost-modal", className), title, lines, ...props });
|
|
2055
2096
|
}
|
|
2056
2097
|
function SidePanelGhost({ className, title, lines = 5, ...props }) {
|
|
2057
|
-
return /* @__PURE__ */ (0,
|
|
2098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SurfaceGhost, { className: cn("fractal-ghost-side-panel", className), title, lines, ...props });
|
|
2058
2099
|
}
|
|
2059
2100
|
function SurfaceGhost({ className, title, lines = 3, ...props }) {
|
|
2060
|
-
return /* @__PURE__ */ (0,
|
|
2061
|
-
/* @__PURE__ */ (0,
|
|
2062
|
-
/* @__PURE__ */ (0,
|
|
2063
|
-
/* @__PURE__ */ (0,
|
|
2101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-surface", className), ...props, children: [
|
|
2102
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "fractal-ghost-surface__header", children: [
|
|
2103
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: "42%" }),
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Ghost, { className: "fractal-ghost-surface__close" })
|
|
2064
2105
|
] }),
|
|
2065
|
-
title && /* @__PURE__ */ (0,
|
|
2066
|
-
/* @__PURE__ */ (0,
|
|
2106
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "fractal-ghost-surface__title", children: title }),
|
|
2107
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GhostLine, { width: index === lines - 1 ? "64%" : "100%" }, index)) })
|
|
2067
2108
|
] });
|
|
2068
2109
|
}
|
|
2069
2110
|
|
|
2070
2111
|
// src/components/Sidebar/Sidebar.tsx
|
|
2071
|
-
var
|
|
2072
|
-
var
|
|
2073
|
-
var Sidebar =
|
|
2074
|
-
({ className, width, compact = false, style, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2112
|
+
var React14 = __toESM(require("react"), 1);
|
|
2113
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2114
|
+
var Sidebar = React14.forwardRef(
|
|
2115
|
+
({ className, width, compact = false, style, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2075
2116
|
"aside",
|
|
2076
2117
|
{
|
|
2077
2118
|
ref,
|
|
@@ -2083,12 +2124,12 @@ var Sidebar = React13.forwardRef(
|
|
|
2083
2124
|
)
|
|
2084
2125
|
);
|
|
2085
2126
|
Sidebar.displayName = "Sidebar";
|
|
2086
|
-
var SidebarHeader =
|
|
2087
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2127
|
+
var SidebarHeader = React14.forwardRef(
|
|
2128
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { ref, className: cn("fractal-sidebar__header", className), ...props })
|
|
2088
2129
|
);
|
|
2089
2130
|
SidebarHeader.displayName = "SidebarHeader";
|
|
2090
|
-
var SidebarBrand =
|
|
2091
|
-
({ className, type = "button", ...props }, ref) => /* @__PURE__ */ (0,
|
|
2131
|
+
var SidebarBrand = React14.forwardRef(
|
|
2132
|
+
({ className, type = "button", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { ref, type, className: cn("fractal-sidebar__brand", className), ...props })
|
|
2092
2133
|
);
|
|
2093
2134
|
SidebarBrand.displayName = "SidebarBrand";
|
|
2094
2135
|
function SidebarAccountMenu({
|
|
@@ -2099,7 +2140,7 @@ function SidebarAccountMenu({
|
|
|
2099
2140
|
icon,
|
|
2100
2141
|
className
|
|
2101
2142
|
}) {
|
|
2102
|
-
return /* @__PURE__ */ (0,
|
|
2143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2103
2144
|
Dropdown,
|
|
2104
2145
|
{
|
|
2105
2146
|
align: "left",
|
|
@@ -2109,25 +2150,25 @@ function SidebarAccountMenu({
|
|
|
2109
2150
|
panelClassName: "fractal-sidebar__account-panel",
|
|
2110
2151
|
selectedValue: "",
|
|
2111
2152
|
triggerClassName: "fractal-sidebar__account-trigger",
|
|
2112
|
-
triggerContent: /* @__PURE__ */ (0,
|
|
2113
|
-
icon && /* @__PURE__ */ (0,
|
|
2114
|
-
/* @__PURE__ */ (0,
|
|
2153
|
+
triggerContent: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
2154
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "fractal-sidebar__account-icon", "aria-hidden": "true", children: icon }),
|
|
2155
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "fractal-sidebar__account-name", children: name })
|
|
2115
2156
|
] }),
|
|
2116
2157
|
triggerLabel,
|
|
2117
2158
|
triggerVariant: "tertiary"
|
|
2118
2159
|
}
|
|
2119
2160
|
);
|
|
2120
2161
|
}
|
|
2121
|
-
var SidebarNav =
|
|
2122
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2162
|
+
var SidebarNav = React14.forwardRef(
|
|
2163
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("nav", { ref, className: cn("fractal-sidebar__nav", className), ...props })
|
|
2123
2164
|
);
|
|
2124
2165
|
SidebarNav.displayName = "SidebarNav";
|
|
2125
|
-
var SidebarSection =
|
|
2126
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2166
|
+
var SidebarSection = React14.forwardRef(
|
|
2167
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { ref, className: cn("fractal-sidebar__section", className), ...props })
|
|
2127
2168
|
);
|
|
2128
2169
|
SidebarSection.displayName = "SidebarSection";
|
|
2129
|
-
var SidebarNavItem =
|
|
2130
|
-
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2170
|
+
var SidebarNavItem = React14.forwardRef(
|
|
2171
|
+
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2131
2172
|
"button",
|
|
2132
2173
|
{
|
|
2133
2174
|
ref,
|
|
@@ -2137,28 +2178,28 @@ var SidebarNavItem = React13.forwardRef(
|
|
|
2137
2178
|
"aria-current": active ? "page" : void 0,
|
|
2138
2179
|
...props,
|
|
2139
2180
|
children: [
|
|
2140
|
-
icon && /* @__PURE__ */ (0,
|
|
2141
|
-
/* @__PURE__ */ (0,
|
|
2142
|
-
endAdornment && /* @__PURE__ */ (0,
|
|
2181
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "fractal-sidebar__nav-item-icon", "aria-hidden": "true", children: icon }),
|
|
2182
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "fractal-sidebar__nav-item-label", children }),
|
|
2183
|
+
endAdornment && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "fractal-sidebar__nav-item-end", children: endAdornment })
|
|
2143
2184
|
]
|
|
2144
2185
|
}
|
|
2145
2186
|
)
|
|
2146
2187
|
);
|
|
2147
2188
|
SidebarNavItem.displayName = "SidebarNavItem";
|
|
2148
|
-
var SidebarFooter =
|
|
2149
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2189
|
+
var SidebarFooter = React14.forwardRef(
|
|
2190
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { ref, className: cn("fractal-sidebar__footer", className), ...props })
|
|
2150
2191
|
);
|
|
2151
2192
|
SidebarFooter.displayName = "SidebarFooter";
|
|
2152
2193
|
|
|
2153
2194
|
// src/components/SidePanel/SidePanel.tsx
|
|
2154
2195
|
var import_react_dom2 = require("react-dom");
|
|
2155
|
-
var
|
|
2156
|
-
var
|
|
2196
|
+
var import_fractal_icons12 = require("@mirror-physics/fractal-icons");
|
|
2197
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2157
2198
|
function SidePanel({ open, onClose, title, description, children, footer, size = "md", loading = false, loadingLabel = "Loading", className }) {
|
|
2158
2199
|
useEscapeDismiss(80, onClose, open);
|
|
2159
2200
|
if (!open) return null;
|
|
2160
2201
|
return (0, import_react_dom2.createPortal)(
|
|
2161
|
-
/* @__PURE__ */ (0,
|
|
2202
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "fractal-side-panel-overlay", onMouseDown: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2162
2203
|
"aside",
|
|
2163
2204
|
{
|
|
2164
2205
|
className: cn("fractal-side-panel", `fractal-side-panel--${size}`, className),
|
|
@@ -2167,15 +2208,15 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
2167
2208
|
role: "dialog",
|
|
2168
2209
|
onMouseDown: (event) => event.stopPropagation(),
|
|
2169
2210
|
children: [
|
|
2170
|
-
/* @__PURE__ */ (0,
|
|
2171
|
-
/* @__PURE__ */ (0,
|
|
2172
|
-
typeof title === "string" ? /* @__PURE__ */ (0,
|
|
2173
|
-
description && /* @__PURE__ */ (0,
|
|
2211
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("header", { className: "fractal-side-panel__header", children: [
|
|
2212
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fractal-side-panel__heading", children: [
|
|
2213
|
+
typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h2", { className: "fractal-side-panel__title", children: title }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "fractal-side-panel__title", children: title }),
|
|
2214
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "fractal-side-panel__description", children: description })
|
|
2174
2215
|
] }),
|
|
2175
|
-
/* @__PURE__ */ (0,
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: "fractal-side-panel__close", "aria-label": "Close panel", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_fractal_icons12.Close, { size: 18 }) })
|
|
2176
2217
|
] }),
|
|
2177
|
-
/* @__PURE__ */ (0,
|
|
2178
|
-
footer && /* @__PURE__ */ (0,
|
|
2218
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { "aria-busy": loading || void 0, className: cn("fractal-side-panel__body", loading && "fractal-side-panel__body--loading"), children: loading ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(UILoader, { label: loadingLabel }) : children }),
|
|
2219
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("footer", { className: "fractal-side-panel__footer", children: footer })
|
|
2179
2220
|
]
|
|
2180
2221
|
}
|
|
2181
2222
|
) }),
|
|
@@ -2184,18 +2225,18 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
2184
2225
|
}
|
|
2185
2226
|
|
|
2186
2227
|
// src/components/Textarea/Textarea.tsx
|
|
2187
|
-
var
|
|
2188
|
-
var
|
|
2189
|
-
var Textarea =
|
|
2190
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2228
|
+
var React15 = __toESM(require("react"), 1);
|
|
2229
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2230
|
+
var Textarea = React15.forwardRef(
|
|
2231
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("textarea", { ref, className: cn("fractal-textarea", className), ...props })
|
|
2191
2232
|
);
|
|
2192
2233
|
Textarea.displayName = "Textarea";
|
|
2193
2234
|
|
|
2194
2235
|
// src/components/TextButton/TextButton.tsx
|
|
2195
|
-
var
|
|
2196
|
-
var
|
|
2197
|
-
var TextButton =
|
|
2198
|
-
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2236
|
+
var React16 = __toESM(require("react"), 1);
|
|
2237
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2238
|
+
var TextButton = React16.forwardRef(
|
|
2239
|
+
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2199
2240
|
"button",
|
|
2200
2241
|
{
|
|
2201
2242
|
ref,
|
|
@@ -2203,9 +2244,9 @@ var TextButton = React15.forwardRef(
|
|
|
2203
2244
|
type: "button",
|
|
2204
2245
|
...props,
|
|
2205
2246
|
children: [
|
|
2206
|
-
icon && iconPosition === "start" && /* @__PURE__ */ (0,
|
|
2207
|
-
/* @__PURE__ */ (0,
|
|
2208
|
-
icon && iconPosition === "end" && /* @__PURE__ */ (0,
|
|
2247
|
+
icon && iconPosition === "start" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon }),
|
|
2248
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children }),
|
|
2249
|
+
icon && iconPosition === "end" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon })
|
|
2209
2250
|
]
|
|
2210
2251
|
}
|
|
2211
2252
|
)
|
|
@@ -2213,9 +2254,9 @@ var TextButton = React15.forwardRef(
|
|
|
2213
2254
|
TextButton.displayName = "TextButton";
|
|
2214
2255
|
|
|
2215
2256
|
// src/components/FileDropzone/FileDropzone.tsx
|
|
2216
|
-
var
|
|
2217
|
-
var
|
|
2218
|
-
var
|
|
2257
|
+
var React17 = __toESM(require("react"), 1);
|
|
2258
|
+
var import_fractal_icons13 = require("@mirror-physics/fractal-icons");
|
|
2259
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2219
2260
|
function FileDropzone({
|
|
2220
2261
|
files,
|
|
2221
2262
|
onFilesChange,
|
|
@@ -2226,17 +2267,17 @@ function FileDropzone({
|
|
|
2226
2267
|
description = "Files stay attached to this record.",
|
|
2227
2268
|
className
|
|
2228
2269
|
}) {
|
|
2229
|
-
const inputId =
|
|
2230
|
-
const inputRef =
|
|
2231
|
-
const [isDragging, setIsDragging] =
|
|
2270
|
+
const inputId = React17.useId();
|
|
2271
|
+
const inputRef = React17.useRef(null);
|
|
2272
|
+
const [isDragging, setIsDragging] = React17.useState(false);
|
|
2232
2273
|
const addFiles = (nextFiles) => {
|
|
2233
2274
|
if (disabled) return;
|
|
2234
2275
|
const additions = Array.from(nextFiles);
|
|
2235
2276
|
if (additions.length === 0) return;
|
|
2236
2277
|
onFilesChange(multiple ? [...files, ...additions] : additions.slice(0, 1));
|
|
2237
2278
|
};
|
|
2238
|
-
return /* @__PURE__ */ (0,
|
|
2239
|
-
/* @__PURE__ */ (0,
|
|
2279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: cn("fractal-file-dropzone", className), children: [
|
|
2280
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2240
2281
|
"input",
|
|
2241
2282
|
{
|
|
2242
2283
|
ref: inputRef,
|
|
@@ -2252,7 +2293,7 @@ function FileDropzone({
|
|
|
2252
2293
|
}
|
|
2253
2294
|
}
|
|
2254
2295
|
),
|
|
2255
|
-
/* @__PURE__ */ (0,
|
|
2296
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
2256
2297
|
"button",
|
|
2257
2298
|
{
|
|
2258
2299
|
className: "fractal-file-dropzone__target",
|
|
@@ -2275,18 +2316,18 @@ function FileDropzone({
|
|
|
2275
2316
|
addFiles(event.dataTransfer.files);
|
|
2276
2317
|
},
|
|
2277
2318
|
children: [
|
|
2278
|
-
/* @__PURE__ */ (0,
|
|
2279
|
-
/* @__PURE__ */ (0,
|
|
2280
|
-
/* @__PURE__ */ (0,
|
|
2281
|
-
description && /* @__PURE__ */ (0,
|
|
2319
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_fractal_icons13.FileArrowUp, { "aria-hidden": "true", size: 20 }),
|
|
2320
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "fractal-file-dropzone__copy", children: [
|
|
2321
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "fractal-file-dropzone__title", children: title }),
|
|
2322
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "fractal-file-dropzone__description", children: description })
|
|
2282
2323
|
] })
|
|
2283
2324
|
]
|
|
2284
2325
|
}
|
|
2285
2326
|
),
|
|
2286
|
-
files.length > 0 && /* @__PURE__ */ (0,
|
|
2287
|
-
/* @__PURE__ */ (0,
|
|
2288
|
-
/* @__PURE__ */ (0,
|
|
2289
|
-
/* @__PURE__ */ (0,
|
|
2327
|
+
files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ul", { className: "fractal-file-dropzone__files", "aria-label": "Attached files", children: files.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("li", { className: "fractal-file-dropzone__file", children: [
|
|
2328
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "fractal-file-dropzone__file-name", children: file.name }),
|
|
2329
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "fractal-file-dropzone__file-meta", children: formatFileSize(file.size) }),
|
|
2330
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2290
2331
|
"button",
|
|
2291
2332
|
{
|
|
2292
2333
|
className: "fractal-file-dropzone__remove",
|
|
@@ -2294,7 +2335,7 @@ function FileDropzone({
|
|
|
2294
2335
|
"aria-label": `Remove ${file.name}`,
|
|
2295
2336
|
disabled,
|
|
2296
2337
|
onClick: () => onFilesChange(files.filter((_, fileIndex) => fileIndex !== index)),
|
|
2297
|
-
children: /* @__PURE__ */ (0,
|
|
2338
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_fractal_icons13.Close, { "aria-hidden": "true", size: 14 })
|
|
2298
2339
|
}
|
|
2299
2340
|
)
|
|
2300
2341
|
] }, `${file.name}-${file.size}-${index}`)) })
|
|
@@ -2307,8 +2348,8 @@ function formatFileSize(bytes) {
|
|
|
2307
2348
|
}
|
|
2308
2349
|
|
|
2309
2350
|
// src/components/Pagination/Pagination.tsx
|
|
2310
|
-
var
|
|
2311
|
-
var
|
|
2351
|
+
var import_fractal_icons14 = require("@mirror-physics/fractal-icons");
|
|
2352
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2312
2353
|
function Pagination({
|
|
2313
2354
|
page,
|
|
2314
2355
|
pageSize,
|
|
@@ -2324,10 +2365,10 @@ function Pagination({
|
|
|
2324
2365
|
const start = totalItems === 0 ? 0 : (currentPage - 1) * pageSize + 1;
|
|
2325
2366
|
const end = Math.min(currentPage * pageSize, totalItems);
|
|
2326
2367
|
const canChangePageSize = pageSizeOptions != null && pageSizeOptions.length > 0 && onPageSizeChange != null;
|
|
2327
|
-
return /* @__PURE__ */ (0,
|
|
2328
|
-
/* @__PURE__ */ (0,
|
|
2329
|
-
/* @__PURE__ */ (0,
|
|
2330
|
-
canChangePageSize && /* @__PURE__ */ (0,
|
|
2368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("nav", { className: cn("fractal-pagination", className), "aria-label": ariaLabel, children: [
|
|
2369
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "fractal-pagination__summary", children: totalItems === 0 ? "No results" : `${start}-${end} of ${totalItems}` }),
|
|
2370
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "fractal-pagination__controls", children: [
|
|
2371
|
+
canChangePageSize && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2331
2372
|
Dropdown,
|
|
2332
2373
|
{
|
|
2333
2374
|
align: "right",
|
|
@@ -2344,7 +2385,7 @@ function Pagination({
|
|
|
2344
2385
|
triggerVariant: "tertiary"
|
|
2345
2386
|
}
|
|
2346
2387
|
),
|
|
2347
|
-
/* @__PURE__ */ (0,
|
|
2388
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2348
2389
|
"button",
|
|
2349
2390
|
{
|
|
2350
2391
|
className: "fractal-pagination__button",
|
|
@@ -2353,15 +2394,15 @@ function Pagination({
|
|
|
2353
2394
|
title: "Previous page",
|
|
2354
2395
|
disabled: currentPage === 1 || totalItems === 0,
|
|
2355
2396
|
onClick: () => onPageChange(currentPage - 1),
|
|
2356
|
-
children: /* @__PURE__ */ (0,
|
|
2397
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_fractal_icons14.ArrowLeft, { "aria-hidden": "true", size: 16 })
|
|
2357
2398
|
}
|
|
2358
2399
|
),
|
|
2359
|
-
/* @__PURE__ */ (0,
|
|
2400
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "fractal-pagination__page", "aria-current": "page", children: [
|
|
2360
2401
|
currentPage,
|
|
2361
2402
|
" of ",
|
|
2362
2403
|
totalPages
|
|
2363
2404
|
] }),
|
|
2364
|
-
/* @__PURE__ */ (0,
|
|
2405
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2365
2406
|
"button",
|
|
2366
2407
|
{
|
|
2367
2408
|
className: "fractal-pagination__button",
|
|
@@ -2370,7 +2411,7 @@ function Pagination({
|
|
|
2370
2411
|
title: "Next page",
|
|
2371
2412
|
disabled: currentPage === totalPages || totalItems === 0,
|
|
2372
2413
|
onClick: () => onPageChange(currentPage + 1),
|
|
2373
|
-
children: /* @__PURE__ */ (0,
|
|
2414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_fractal_icons14.ArrowRight, { "aria-hidden": "true", size: 16 })
|
|
2374
2415
|
}
|
|
2375
2416
|
)
|
|
2376
2417
|
] })
|
|
@@ -2441,6 +2482,7 @@ function Pagination({
|
|
|
2441
2482
|
SidebarSection,
|
|
2442
2483
|
SortableTable,
|
|
2443
2484
|
SortableTableGhost,
|
|
2485
|
+
TableSearch,
|
|
2444
2486
|
Tabs,
|
|
2445
2487
|
TabsGhost,
|
|
2446
2488
|
TextButton,
|