@mirror-physics/fractal-ui 0.2.0-next.72 → 0.2.0-next.74
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 +396 -265
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +141 -16
- 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 +401 -272
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -835,6 +835,21 @@ function Slider(props) {
|
|
|
835
835
|
clamp(nextUpper, nextLower, max)
|
|
836
836
|
]);
|
|
837
837
|
};
|
|
838
|
+
const getKeyboardValue = (event, value) => {
|
|
839
|
+
const pageStep = step * 10;
|
|
840
|
+
const adjustments = {
|
|
841
|
+
ArrowDown: -step,
|
|
842
|
+
ArrowLeft: -step,
|
|
843
|
+
ArrowRight: step,
|
|
844
|
+
ArrowUp: step,
|
|
845
|
+
PageDown: -pageStep,
|
|
846
|
+
PageUp: pageStep
|
|
847
|
+
};
|
|
848
|
+
if (event.key === "Home") return min;
|
|
849
|
+
if (event.key === "End") return max;
|
|
850
|
+
if (!(event.key in adjustments)) return null;
|
|
851
|
+
return value + adjustments[event.key];
|
|
852
|
+
};
|
|
838
853
|
return /* @__PURE__ */ jsxs8(
|
|
839
854
|
"div",
|
|
840
855
|
{
|
|
@@ -869,6 +884,13 @@ function Slider(props) {
|
|
|
869
884
|
if (knobs === 2) changeRangeValue(Math.min(nextValue, secondValue), secondValue);
|
|
870
885
|
else changeSingleValue(nextValue);
|
|
871
886
|
},
|
|
887
|
+
onKeyDown: (event) => {
|
|
888
|
+
const nextValue = getKeyboardValue(event, firstValue);
|
|
889
|
+
if (nextValue === null) return;
|
|
890
|
+
event.preventDefault();
|
|
891
|
+
if (knobs === 2) changeRangeValue(Math.min(nextValue, secondValue), secondValue);
|
|
892
|
+
else changeSingleValue(nextValue);
|
|
893
|
+
},
|
|
872
894
|
step,
|
|
873
895
|
type: "range",
|
|
874
896
|
value: firstValue
|
|
@@ -885,6 +907,12 @@ function Slider(props) {
|
|
|
885
907
|
const nextValue = event.currentTarget.valueAsNumber;
|
|
886
908
|
changeRangeValue(firstValue, Math.max(nextValue, firstValue));
|
|
887
909
|
},
|
|
910
|
+
onKeyDown: (event) => {
|
|
911
|
+
const nextValue = getKeyboardValue(event, secondValue);
|
|
912
|
+
if (nextValue === null) return;
|
|
913
|
+
event.preventDefault();
|
|
914
|
+
changeRangeValue(firstValue, Math.max(nextValue, firstValue));
|
|
915
|
+
},
|
|
888
916
|
step,
|
|
889
917
|
type: "range",
|
|
890
918
|
value: secondValue
|
|
@@ -1005,10 +1033,109 @@ var AlertDescription = React9.forwardRef(
|
|
|
1005
1033
|
);
|
|
1006
1034
|
AlertDescription.displayName = "AlertDescription";
|
|
1007
1035
|
|
|
1008
|
-
// src/components/
|
|
1036
|
+
// src/components/Toast/Toast.tsx
|
|
1037
|
+
import * as React10 from "react";
|
|
1038
|
+
import { createPortal } from "react-dom";
|
|
1039
|
+
import { CircleCheck as CircleCheck2, CircleClose as CircleClose2, CircleInfo as CircleInfo2, Close, Warning as Warning2 } from "@mirror-physics/fractal-icons";
|
|
1009
1040
|
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1010
|
-
|
|
1041
|
+
var defaultIcons2 = {
|
|
1042
|
+
default: CircleInfo2,
|
|
1043
|
+
info: CircleInfo2,
|
|
1044
|
+
success: CircleCheck2,
|
|
1045
|
+
warning: Warning2,
|
|
1046
|
+
error: CircleClose2
|
|
1047
|
+
};
|
|
1048
|
+
var Toast = React10.forwardRef(function Toast2({
|
|
1049
|
+
action,
|
|
1050
|
+
children,
|
|
1051
|
+
className,
|
|
1052
|
+
dismissLabel = "Dismiss notification",
|
|
1053
|
+
duration,
|
|
1054
|
+
icon,
|
|
1055
|
+
onBlurCapture,
|
|
1056
|
+
onDismiss,
|
|
1057
|
+
onFocusCapture,
|
|
1058
|
+
onPointerEnter,
|
|
1059
|
+
onPointerLeave,
|
|
1060
|
+
role,
|
|
1061
|
+
variant = "default",
|
|
1062
|
+
...props
|
|
1063
|
+
}, ref) {
|
|
1064
|
+
const [paused, setPaused] = React10.useState(false);
|
|
1065
|
+
const dismissRef = React10.useRef(onDismiss);
|
|
1066
|
+
const DefaultIcon = defaultIcons2[variant];
|
|
1067
|
+
const resolvedDuration = duration === void 0 ? variant === "error" ? null : 5e3 : duration;
|
|
1068
|
+
React10.useEffect(() => {
|
|
1069
|
+
dismissRef.current = onDismiss;
|
|
1070
|
+
}, [onDismiss]);
|
|
1071
|
+
React10.useEffect(() => {
|
|
1072
|
+
if (!dismissRef.current || paused || resolvedDuration === null || resolvedDuration <= 0) return;
|
|
1073
|
+
const timeout = window.setTimeout(() => dismissRef.current?.(), resolvedDuration);
|
|
1074
|
+
return () => window.clearTimeout(timeout);
|
|
1075
|
+
}, [paused, resolvedDuration]);
|
|
1076
|
+
const announcementRole = role ?? (variant === "error" ? "alert" : "status");
|
|
1011
1077
|
return /* @__PURE__ */ jsxs11(
|
|
1078
|
+
"div",
|
|
1079
|
+
{
|
|
1080
|
+
ref,
|
|
1081
|
+
"aria-atomic": "true",
|
|
1082
|
+
"aria-live": announcementRole === "alert" ? "assertive" : "polite",
|
|
1083
|
+
className: cn("fractal-toast", `fractal-toast--${variant}`, className),
|
|
1084
|
+
role: announcementRole,
|
|
1085
|
+
onBlurCapture: (event) => {
|
|
1086
|
+
onBlurCapture?.(event);
|
|
1087
|
+
if (!event.currentTarget.contains(event.relatedTarget)) setPaused(false);
|
|
1088
|
+
},
|
|
1089
|
+
onFocusCapture: (event) => {
|
|
1090
|
+
onFocusCapture?.(event);
|
|
1091
|
+
setPaused(true);
|
|
1092
|
+
},
|
|
1093
|
+
onPointerEnter: (event) => {
|
|
1094
|
+
onPointerEnter?.(event);
|
|
1095
|
+
setPaused(true);
|
|
1096
|
+
},
|
|
1097
|
+
onPointerLeave: (event) => {
|
|
1098
|
+
onPointerLeave?.(event);
|
|
1099
|
+
setPaused(false);
|
|
1100
|
+
},
|
|
1101
|
+
...props,
|
|
1102
|
+
children: [
|
|
1103
|
+
/* @__PURE__ */ jsx12("span", { "aria-hidden": "true", className: "fractal-toast__icon", children: icon ?? /* @__PURE__ */ jsx12(DefaultIcon, { size: 18 }) }),
|
|
1104
|
+
/* @__PURE__ */ jsx12("div", { className: "fractal-toast__content", children }),
|
|
1105
|
+
action && /* @__PURE__ */ jsx12("div", { className: "fractal-toast__action", children: action }),
|
|
1106
|
+
/* @__PURE__ */ jsx12(
|
|
1107
|
+
"button",
|
|
1108
|
+
{
|
|
1109
|
+
"aria-label": dismissLabel,
|
|
1110
|
+
className: "fractal-toast__dismiss",
|
|
1111
|
+
onClick: onDismiss,
|
|
1112
|
+
type: "button",
|
|
1113
|
+
children: /* @__PURE__ */ jsx12(Close, { "aria-hidden": "true", size: 14 })
|
|
1114
|
+
}
|
|
1115
|
+
)
|
|
1116
|
+
]
|
|
1117
|
+
}
|
|
1118
|
+
);
|
|
1119
|
+
});
|
|
1120
|
+
var ToastViewport = React10.forwardRef(function ToastViewport2({ children, className, portal = true, position = "top-center", ...props }, ref) {
|
|
1121
|
+
const viewport = /* @__PURE__ */ jsx12(
|
|
1122
|
+
"div",
|
|
1123
|
+
{
|
|
1124
|
+
ref,
|
|
1125
|
+
className: cn("fractal-toast-viewport", `fractal-toast-viewport--${position}`, className),
|
|
1126
|
+
"data-position": position,
|
|
1127
|
+
...props,
|
|
1128
|
+
children
|
|
1129
|
+
}
|
|
1130
|
+
);
|
|
1131
|
+
if (!portal || typeof document === "undefined") return viewport;
|
|
1132
|
+
return createPortal(viewport, document.body);
|
|
1133
|
+
});
|
|
1134
|
+
|
|
1135
|
+
// src/components/Toggle/Toggle.tsx
|
|
1136
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1137
|
+
function Toggle({ checked, onChange, label, className }) {
|
|
1138
|
+
return /* @__PURE__ */ jsxs12(
|
|
1012
1139
|
"button",
|
|
1013
1140
|
{
|
|
1014
1141
|
type: "button",
|
|
@@ -1017,19 +1144,19 @@ function Toggle({ checked, onChange, label, className }) {
|
|
|
1017
1144
|
className: cn("fractal-toggle", className),
|
|
1018
1145
|
onClick: () => onChange(!checked),
|
|
1019
1146
|
children: [
|
|
1020
|
-
/* @__PURE__ */
|
|
1021
|
-
label && /* @__PURE__ */
|
|
1147
|
+
/* @__PURE__ */ jsx13("span", { className: cn("fractal-toggle-track", checked && "fractal-toggle-track--checked"), children: /* @__PURE__ */ jsx13("span", { className: cn("fractal-toggle-thumb", checked && "fractal-toggle-thumb--checked") }) }),
|
|
1148
|
+
label && /* @__PURE__ */ jsx13("span", { className: "fractal-toggle-label", children: label })
|
|
1022
1149
|
]
|
|
1023
1150
|
}
|
|
1024
1151
|
);
|
|
1025
1152
|
}
|
|
1026
1153
|
|
|
1027
1154
|
// src/components/Modal/Modal.tsx
|
|
1028
|
-
import * as
|
|
1029
|
-
import { createPortal } from "react-dom";
|
|
1155
|
+
import * as React11 from "react";
|
|
1156
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
1030
1157
|
|
|
1031
1158
|
// src/hooks/useEscapeDismiss.ts
|
|
1032
|
-
import { useEffect as
|
|
1159
|
+
import { useEffect as useEffect3, useRef as useRef4 } from "react";
|
|
1033
1160
|
var nextId = 0;
|
|
1034
1161
|
var stack = [];
|
|
1035
1162
|
function insertSorted(entry) {
|
|
@@ -1062,9 +1189,9 @@ function ensureGlobalListener() {
|
|
|
1062
1189
|
);
|
|
1063
1190
|
}
|
|
1064
1191
|
function useEscapeDismiss(priority, handler, enabled = true) {
|
|
1065
|
-
const handlerRef =
|
|
1192
|
+
const handlerRef = useRef4(handler);
|
|
1066
1193
|
handlerRef.current = handler;
|
|
1067
|
-
|
|
1194
|
+
useEffect3(() => {
|
|
1068
1195
|
if (!enabled) return;
|
|
1069
1196
|
ensureGlobalListener();
|
|
1070
1197
|
const id = nextId++;
|
|
@@ -1080,7 +1207,7 @@ function useEscapeDismiss(priority, handler, enabled = true) {
|
|
|
1080
1207
|
|
|
1081
1208
|
// src/components/UILoader/UILoader.tsx
|
|
1082
1209
|
import { useId } from "react";
|
|
1083
|
-
import { jsx as
|
|
1210
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1084
1211
|
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";
|
|
1085
1212
|
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";
|
|
1086
1213
|
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";
|
|
@@ -1089,7 +1216,7 @@ function UILoader({ size = 48, tone = "neutral", className, style, label = "Load
|
|
|
1089
1216
|
const clipId = `fractal-ui-loader-clip-${rawId}`;
|
|
1090
1217
|
const gradientId = `fractal-ui-loader-gradient-${rawId}`;
|
|
1091
1218
|
const height = typeof size === "number" ? `${size}px` : size;
|
|
1092
|
-
return /* @__PURE__ */
|
|
1219
|
+
return /* @__PURE__ */ jsx14(
|
|
1093
1220
|
"span",
|
|
1094
1221
|
{
|
|
1095
1222
|
"aria-hidden": ariaHidden || void 0,
|
|
@@ -1097,52 +1224,52 @@ function UILoader({ size = 48, tone = "neutral", className, style, label = "Load
|
|
|
1097
1224
|
className: cn("fractal-ui-loader", `fractal-ui-loader--${tone}`, className),
|
|
1098
1225
|
role: ariaHidden ? void 0 : "status",
|
|
1099
1226
|
style,
|
|
1100
|
-
children: /* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */
|
|
1102
|
-
/* @__PURE__ */
|
|
1103
|
-
/* @__PURE__ */
|
|
1104
|
-
/* @__PURE__ */
|
|
1227
|
+
children: /* @__PURE__ */ jsxs13("svg", { "aria-hidden": "true", fill: "none", viewBox: "0 0 144 92", style: { height, width: "auto" }, children: [
|
|
1228
|
+
/* @__PURE__ */ jsxs13("defs", { children: [
|
|
1229
|
+
/* @__PURE__ */ jsxs13("linearGradient", { id: gradientId, x1: "59", x2: "94.3", y1: "0", y2: "89.1", gradientUnits: "userSpaceOnUse", children: [
|
|
1230
|
+
/* @__PURE__ */ jsx14("stop", { className: "fractal-ui-loader__stop-start", offset: "0" }),
|
|
1231
|
+
/* @__PURE__ */ jsx14("stop", { className: "fractal-ui-loader__stop-end", offset: "1" })
|
|
1105
1232
|
] }),
|
|
1106
|
-
/* @__PURE__ */
|
|
1107
|
-
/* @__PURE__ */
|
|
1108
|
-
/* @__PURE__ */
|
|
1109
|
-
/* @__PURE__ */
|
|
1233
|
+
/* @__PURE__ */ jsxs13("linearGradient", { id: `${gradientId}-shine`, x1: "0", x2: "1", y1: "0", y2: "0", children: [
|
|
1234
|
+
/* @__PURE__ */ jsx14("stop", { offset: "0.4", stopColor: "white", stopOpacity: "0" }),
|
|
1235
|
+
/* @__PURE__ */ jsx14("stop", { offset: "0.5", stopColor: "white", stopOpacity: "0.62" }),
|
|
1236
|
+
/* @__PURE__ */ jsx14("stop", { offset: "0.6", stopColor: "white", stopOpacity: "0" })
|
|
1110
1237
|
] }),
|
|
1111
|
-
/* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
/* @__PURE__ */
|
|
1114
|
-
/* @__PURE__ */
|
|
1238
|
+
/* @__PURE__ */ jsxs13("clipPath", { id: clipId, children: [
|
|
1239
|
+
/* @__PURE__ */ jsx14("path", { d: LEFT }),
|
|
1240
|
+
/* @__PURE__ */ jsx14("path", { d: CENTER }),
|
|
1241
|
+
/* @__PURE__ */ jsx14("path", { d: RIGHT })
|
|
1115
1242
|
] })
|
|
1116
1243
|
] }),
|
|
1117
|
-
/* @__PURE__ */
|
|
1118
|
-
/* @__PURE__ */
|
|
1119
|
-
/* @__PURE__ */
|
|
1120
|
-
/* @__PURE__ */
|
|
1244
|
+
/* @__PURE__ */ jsx14("path", { d: CENTER, fill: `url(#${gradientId})` }),
|
|
1245
|
+
/* @__PURE__ */ jsx14("path", { d: RIGHT, fill: `url(#${gradientId})` }),
|
|
1246
|
+
/* @__PURE__ */ jsx14("path", { d: LEFT, fill: `url(#${gradientId})` }),
|
|
1247
|
+
/* @__PURE__ */ jsx14("g", { clipPath: `url(#${clipId})`, children: /* @__PURE__ */ jsx14("g", { className: "fractal-ui-loader__shine-axis", transform: "translate(72 46) rotate(68.4)", children: /* @__PURE__ */ jsx14("rect", { className: "fractal-ui-loader__shine", x: "-160", y: "-100", width: "320", height: "200", fill: `url(#${gradientId}-shine)` }) }) })
|
|
1121
1248
|
] })
|
|
1122
1249
|
}
|
|
1123
1250
|
);
|
|
1124
1251
|
}
|
|
1125
1252
|
|
|
1126
1253
|
// src/components/Modal/Modal.tsx
|
|
1127
|
-
import { jsx as
|
|
1128
|
-
var CloseIcon = () => /* @__PURE__ */
|
|
1254
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1255
|
+
var CloseIcon = () => /* @__PURE__ */ jsx15("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx15("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1129
1256
|
function Modal({ open, onClose, title, children, danger, warn, footer, noClose, closeDisabled = false, size = "sm", loading = false, loadingLabel = "Loading", scrollable = false, className }) {
|
|
1130
|
-
const [bodyScrolled, setBodyScrolled] =
|
|
1257
|
+
const [bodyScrolled, setBodyScrolled] = React11.useState(false);
|
|
1131
1258
|
useEscapeDismiss(80, onClose, open && !noClose && !closeDisabled);
|
|
1132
|
-
|
|
1259
|
+
React11.useEffect(() => {
|
|
1133
1260
|
if (open) setBodyScrolled(false);
|
|
1134
1261
|
}, [open]);
|
|
1135
1262
|
if (!open) return null;
|
|
1136
1263
|
const sizeClass = `fractal-modal-panel--${size}`;
|
|
1137
1264
|
const accentClass = danger ? "fractal-modal-panel--danger" : warn ? "fractal-modal-panel--warn" : "";
|
|
1138
|
-
return
|
|
1139
|
-
/* @__PURE__ */
|
|
1265
|
+
return createPortal2(
|
|
1266
|
+
/* @__PURE__ */ jsx15("div", { className: "fractal-modal-overlay", onClick: noClose || closeDisabled ? void 0 : onClose, children: /* @__PURE__ */ jsxs14(
|
|
1140
1267
|
"div",
|
|
1141
1268
|
{
|
|
1142
1269
|
className: cn("fractal-modal-panel", sizeClass, accentClass, scrollable && "fractal-modal-panel--scrollable", className),
|
|
1143
1270
|
onClick: (e) => e.stopPropagation(),
|
|
1144
1271
|
children: [
|
|
1145
|
-
/* @__PURE__ */
|
|
1272
|
+
/* @__PURE__ */ jsxs14(
|
|
1146
1273
|
"div",
|
|
1147
1274
|
{
|
|
1148
1275
|
className: cn(
|
|
@@ -1151,12 +1278,12 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
1151
1278
|
scrollable && bodyScrolled && "fractal-modal-title-row--scrolled"
|
|
1152
1279
|
),
|
|
1153
1280
|
children: [
|
|
1154
|
-
/* @__PURE__ */
|
|
1155
|
-
!noClose && /* @__PURE__ */
|
|
1281
|
+
/* @__PURE__ */ jsx15("h3", { className: cn("fractal-modal-title", danger && "fractal-modal-title--danger", warn && "fractal-modal-title--warn"), children: title }),
|
|
1282
|
+
!noClose && /* @__PURE__ */ jsx15("button", { type: "button", onClick: onClose, title: "Close", disabled: closeDisabled, className: "fractal-modal-close", children: /* @__PURE__ */ jsx15(CloseIcon, {}) })
|
|
1156
1283
|
]
|
|
1157
1284
|
}
|
|
1158
1285
|
),
|
|
1159
|
-
/* @__PURE__ */
|
|
1286
|
+
/* @__PURE__ */ jsx15(
|
|
1160
1287
|
"div",
|
|
1161
1288
|
{
|
|
1162
1289
|
"aria-busy": loading || void 0,
|
|
@@ -1167,10 +1294,10 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
1167
1294
|
scrollable && "fractal-modal-body--scrollable"
|
|
1168
1295
|
),
|
|
1169
1296
|
onScroll: scrollable ? (event) => setBodyScrolled(event.currentTarget.scrollTop > 0) : void 0,
|
|
1170
|
-
children: loading ? /* @__PURE__ */
|
|
1297
|
+
children: loading ? /* @__PURE__ */ jsx15(UILoader, { label: loadingLabel }) : children
|
|
1171
1298
|
}
|
|
1172
1299
|
),
|
|
1173
|
-
footer && /* @__PURE__ */
|
|
1300
|
+
footer && /* @__PURE__ */ jsx15("div", { className: cn("fractal-modal-footer", scrollable && "fractal-modal-footer--divided"), children: footer })
|
|
1174
1301
|
]
|
|
1175
1302
|
}
|
|
1176
1303
|
) }),
|
|
@@ -1179,17 +1306,17 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
1179
1306
|
}
|
|
1180
1307
|
|
|
1181
1308
|
// src/components/DataTable/DataTable.tsx
|
|
1182
|
-
import { jsx as
|
|
1309
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1183
1310
|
function DataTable({ columns, data, emptyMessage, header, size = "md", className }) {
|
|
1184
|
-
return /* @__PURE__ */
|
|
1185
|
-
header && /* @__PURE__ */
|
|
1186
|
-
data.length === 0 ? /* @__PURE__ */
|
|
1187
|
-
/* @__PURE__ */
|
|
1188
|
-
/* @__PURE__ */
|
|
1311
|
+
return /* @__PURE__ */ jsx16("div", { className: cn("fractal-datatable", `fractal-datatable--${size}`, className), children: /* @__PURE__ */ jsxs15("div", { className: "fractal-datatable-surface", children: [
|
|
1312
|
+
header && /* @__PURE__ */ jsx16("div", { className: "fractal-datatable-header", children: header }),
|
|
1313
|
+
data.length === 0 ? /* @__PURE__ */ jsx16("div", { className: "fractal-datatable-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ jsxs15("table", { className: "fractal-datatable-table", children: [
|
|
1314
|
+
/* @__PURE__ */ jsx16("thead", { children: /* @__PURE__ */ jsx16("tr", { className: "fractal-datatable-thead-row", children: columns.map((col) => /* @__PURE__ */ jsx16("th", { className: "fractal-datatable-th", style: { width: col.width }, children: col.header }, col.key)) }) }),
|
|
1315
|
+
/* @__PURE__ */ jsx16("tbody", { children: data.map((row, rowIndex) => /* @__PURE__ */ jsx16(
|
|
1189
1316
|
"tr",
|
|
1190
1317
|
{
|
|
1191
1318
|
className: "fractal-datatable-row",
|
|
1192
|
-
children: columns.map((col) => /* @__PURE__ */
|
|
1319
|
+
children: columns.map((col) => /* @__PURE__ */ jsx16("td", { className: "fractal-datatable-td", style: { width: col.width }, children: col.render(row, rowIndex) }, col.key))
|
|
1193
1320
|
},
|
|
1194
1321
|
rowIndex
|
|
1195
1322
|
)) })
|
|
@@ -1198,9 +1325,9 @@ function DataTable({ columns, data, emptyMessage, header, size = "md", className
|
|
|
1198
1325
|
}
|
|
1199
1326
|
|
|
1200
1327
|
// src/components/Dropdown/Dropdown.tsx
|
|
1201
|
-
import * as
|
|
1328
|
+
import * as React12 from "react";
|
|
1202
1329
|
import { ChevronDown, ChevronLeft, ChevronRight as ChevronRight2, ChevronUp } from "@mirror-physics/fractal-icons";
|
|
1203
|
-
import { Fragment as Fragment2, jsx as
|
|
1330
|
+
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1204
1331
|
var MARGIN = 4;
|
|
1205
1332
|
function Dropdown({
|
|
1206
1333
|
items,
|
|
@@ -1222,10 +1349,10 @@ function Dropdown({
|
|
|
1222
1349
|
closeOnSelect = true,
|
|
1223
1350
|
disabled = false
|
|
1224
1351
|
}) {
|
|
1225
|
-
const [open, setOpen] =
|
|
1226
|
-
const triggerRef =
|
|
1227
|
-
const panelRef =
|
|
1228
|
-
const [panelStyle, setPanelStyle] =
|
|
1352
|
+
const [open, setOpen] = React12.useState(false);
|
|
1353
|
+
const triggerRef = React12.useRef(null);
|
|
1354
|
+
const panelRef = React12.useRef(null);
|
|
1355
|
+
const [panelStyle, setPanelStyle] = React12.useState({});
|
|
1229
1356
|
const visibleItems = items.filter(
|
|
1230
1357
|
(item) => item.icon != null || item.description != null && (typeof item.description === "string" ? item.description !== "" : true)
|
|
1231
1358
|
);
|
|
@@ -1235,7 +1362,7 @@ function Dropdown({
|
|
|
1235
1362
|
const isUp = direction === "up";
|
|
1236
1363
|
const isHorizontalDirection = direction === "left" || direction === "right";
|
|
1237
1364
|
const ChevronIcon = direction === "up" ? ChevronUp : direction === "left" ? ChevronLeft : direction === "right" ? ChevronRight2 : ChevronDown;
|
|
1238
|
-
|
|
1365
|
+
React12.useLayoutEffect(() => {
|
|
1239
1366
|
if (!open || !triggerRef.current || !panelRef.current) return;
|
|
1240
1367
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
1241
1368
|
const panelRect = panelRef.current.getBoundingClientRect();
|
|
@@ -1286,7 +1413,7 @@ function Dropdown({
|
|
|
1286
1413
|
}
|
|
1287
1414
|
setPanelStyle({ top, left, right });
|
|
1288
1415
|
}, [open, direction, isHorizontalDirection, isUp, align]);
|
|
1289
|
-
|
|
1416
|
+
React12.useEffect(() => {
|
|
1290
1417
|
if (!open) return;
|
|
1291
1418
|
const handleClickOutside = (e) => {
|
|
1292
1419
|
const target = e.target;
|
|
@@ -1296,8 +1423,8 @@ function Dropdown({
|
|
|
1296
1423
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1297
1424
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1298
1425
|
}, [open]);
|
|
1299
|
-
return /* @__PURE__ */
|
|
1300
|
-
/* @__PURE__ */
|
|
1426
|
+
return /* @__PURE__ */ jsxs16("div", { className: cn("fractal-dropdown", className), children: [
|
|
1427
|
+
/* @__PURE__ */ jsxs16(
|
|
1301
1428
|
"button",
|
|
1302
1429
|
{
|
|
1303
1430
|
ref: triggerRef,
|
|
@@ -1316,15 +1443,15 @@ function Dropdown({
|
|
|
1316
1443
|
triggerClassName
|
|
1317
1444
|
),
|
|
1318
1445
|
children: [
|
|
1319
|
-
triggerContent != null ? triggerContent : /* @__PURE__ */
|
|
1320
|
-
selected.icon != null && /* @__PURE__ */
|
|
1321
|
-
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */
|
|
1446
|
+
triggerContent != null ? triggerContent : /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
1447
|
+
selected.icon != null && /* @__PURE__ */ jsx17("span", { className: "fractal-dropdown-icon fractal-dropdown-icon--trigger", children: selected.icon }),
|
|
1448
|
+
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */ jsx17("span", { className: "fractal-dropdown-selected-text", children: selected.description })
|
|
1322
1449
|
] }),
|
|
1323
|
-
!noChevron && !iconOnly && /* @__PURE__ */
|
|
1450
|
+
!noChevron && !iconOnly && /* @__PURE__ */ jsx17("span", { className: "fractal-dropdown-chevron", "aria-hidden": true, children: /* @__PURE__ */ jsx17(ChevronIcon, { size: size === "sm" ? 14 : 16 }) })
|
|
1324
1451
|
]
|
|
1325
1452
|
}
|
|
1326
1453
|
),
|
|
1327
|
-
open && /* @__PURE__ */
|
|
1454
|
+
open && /* @__PURE__ */ jsxs16(
|
|
1328
1455
|
"div",
|
|
1329
1456
|
{
|
|
1330
1457
|
ref: panelRef,
|
|
@@ -1333,21 +1460,21 @@ function Dropdown({
|
|
|
1333
1460
|
className: cn("fractal-dropdown-panel", `fractal-dropdown-panel--${size}`, panelClassName),
|
|
1334
1461
|
style: panelStyle,
|
|
1335
1462
|
children: [
|
|
1336
|
-
label != null && /* @__PURE__ */
|
|
1463
|
+
label != null && /* @__PURE__ */ jsx17("div", { className: "fractal-dropdown-label", children: label }),
|
|
1337
1464
|
visibleItems.map((item, index) => {
|
|
1338
|
-
const topDivider = item.border === "top" ? /* @__PURE__ */
|
|
1339
|
-
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */
|
|
1465
|
+
const topDivider = item.border === "top" ? /* @__PURE__ */ jsx17("div", { className: "fractal-dropdown-separator" }) : null;
|
|
1466
|
+
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */ jsx17("div", { className: "fractal-dropdown-separator" }) : null;
|
|
1340
1467
|
if (item.kind === "header") {
|
|
1341
|
-
return /* @__PURE__ */
|
|
1468
|
+
return /* @__PURE__ */ jsxs16(React12.Fragment, { children: [
|
|
1342
1469
|
topDivider,
|
|
1343
|
-
/* @__PURE__ */
|
|
1470
|
+
/* @__PURE__ */ jsx17("div", { role: "presentation", className: "fractal-dropdown-label", children: item.description }),
|
|
1344
1471
|
bottomDivider
|
|
1345
1472
|
] }, `header-${index}`);
|
|
1346
1473
|
}
|
|
1347
1474
|
const isSelected = item.value === selectedValue;
|
|
1348
|
-
return /* @__PURE__ */
|
|
1475
|
+
return /* @__PURE__ */ jsxs16(React12.Fragment, { children: [
|
|
1349
1476
|
topDivider,
|
|
1350
|
-
/* @__PURE__ */
|
|
1477
|
+
/* @__PURE__ */ jsxs16(
|
|
1351
1478
|
"button",
|
|
1352
1479
|
{
|
|
1353
1480
|
type: "button",
|
|
@@ -1359,9 +1486,9 @@ function Dropdown({
|
|
|
1359
1486
|
},
|
|
1360
1487
|
className: "fractal-dropdown-option",
|
|
1361
1488
|
children: [
|
|
1362
|
-
item.icon != null && /* @__PURE__ */
|
|
1363
|
-
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */
|
|
1364
|
-
item.trailing != null && /* @__PURE__ */
|
|
1489
|
+
item.icon != null && /* @__PURE__ */ jsx17("span", { className: "fractal-dropdown-icon", children: item.icon }),
|
|
1490
|
+
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */ jsx17("span", { className: "fractal-dropdown-option-text", children: item.description }),
|
|
1491
|
+
item.trailing != null && /* @__PURE__ */ jsx17("span", { className: "fractal-dropdown-trailing", children: item.trailing })
|
|
1365
1492
|
]
|
|
1366
1493
|
}
|
|
1367
1494
|
),
|
|
@@ -1375,10 +1502,10 @@ function Dropdown({
|
|
|
1375
1502
|
}
|
|
1376
1503
|
|
|
1377
1504
|
// src/components/Link/Link.tsx
|
|
1378
|
-
import * as
|
|
1379
|
-
import { jsx as
|
|
1380
|
-
var Link =
|
|
1381
|
-
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */
|
|
1505
|
+
import * as React13 from "react";
|
|
1506
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1507
|
+
var Link = React13.forwardRef(
|
|
1508
|
+
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
1382
1509
|
"a",
|
|
1383
1510
|
{
|
|
1384
1511
|
ref,
|
|
@@ -1390,10 +1517,10 @@ var Link = React12.forwardRef(
|
|
|
1390
1517
|
Link.displayName = "Link";
|
|
1391
1518
|
|
|
1392
1519
|
// src/components/Chip/Chip.tsx
|
|
1393
|
-
import * as
|
|
1394
|
-
import { jsx as
|
|
1395
|
-
var Chip =
|
|
1396
|
-
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */
|
|
1520
|
+
import * as React14 from "react";
|
|
1521
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1522
|
+
var Chip = React14.forwardRef(
|
|
1523
|
+
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */ jsx19(
|
|
1397
1524
|
"span",
|
|
1398
1525
|
{
|
|
1399
1526
|
ref,
|
|
@@ -1406,7 +1533,7 @@ Chip.displayName = "Chip";
|
|
|
1406
1533
|
|
|
1407
1534
|
// src/components/Checkbox/Checkbox.tsx
|
|
1408
1535
|
import { Checkbox as CheckboxIcon, CheckboxChecked, Minus as Minus2 } from "@mirror-physics/fractal-icons";
|
|
1409
|
-
import { jsx as
|
|
1536
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1410
1537
|
function Checkbox({
|
|
1411
1538
|
checked,
|
|
1412
1539
|
indeterminate = false,
|
|
@@ -1417,7 +1544,7 @@ function Checkbox({
|
|
|
1417
1544
|
onKeyDown,
|
|
1418
1545
|
...props
|
|
1419
1546
|
}) {
|
|
1420
|
-
return /* @__PURE__ */
|
|
1547
|
+
return /* @__PURE__ */ jsx20(
|
|
1421
1548
|
"button",
|
|
1422
1549
|
{
|
|
1423
1550
|
...props,
|
|
@@ -1439,18 +1566,18 @@ function Checkbox({
|
|
|
1439
1566
|
onKeyDown?.(event);
|
|
1440
1567
|
if (event.key === " " || event.key === "Enter") event.stopPropagation();
|
|
1441
1568
|
},
|
|
1442
|
-
children: indeterminate ? /* @__PURE__ */
|
|
1443
|
-
/* @__PURE__ */
|
|
1444
|
-
/* @__PURE__ */
|
|
1445
|
-
] }) : checked ? /* @__PURE__ */
|
|
1569
|
+
children: indeterminate ? /* @__PURE__ */ jsxs17("span", { className: "fractal-checkbox__indeterminate-icon", "aria-hidden": "true", children: [
|
|
1570
|
+
/* @__PURE__ */ jsx20(CheckboxIcon, { size: 18 }),
|
|
1571
|
+
/* @__PURE__ */ jsx20(Minus2, { className: "fractal-checkbox__indeterminate-mark", size: 12 })
|
|
1572
|
+
] }) : checked ? /* @__PURE__ */ jsx20(CheckboxChecked, { "aria-hidden": "true", size: 18 }) : /* @__PURE__ */ jsx20(CheckboxIcon, { "aria-hidden": "true", size: 18 })
|
|
1446
1573
|
}
|
|
1447
1574
|
);
|
|
1448
1575
|
}
|
|
1449
1576
|
|
|
1450
1577
|
// src/components/SortableTable/SortableTable.tsx
|
|
1451
|
-
import { useMemo as useMemo2, useState as
|
|
1578
|
+
import { useMemo as useMemo2, useState as useState7 } from "react";
|
|
1452
1579
|
import { ArrowUp, ArrowDown, ArrowsUpDown } from "@mirror-physics/fractal-icons";
|
|
1453
|
-
import { jsx as
|
|
1580
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1454
1581
|
function SortableTable({
|
|
1455
1582
|
columns,
|
|
1456
1583
|
data,
|
|
@@ -1475,8 +1602,8 @@ function SortableTable({
|
|
|
1475
1602
|
onRowDoubleClick,
|
|
1476
1603
|
rowAction
|
|
1477
1604
|
}) {
|
|
1478
|
-
const [internalKey, setInternalKey] =
|
|
1479
|
-
const [internalDirection, setInternalDirection] =
|
|
1605
|
+
const [internalKey, setInternalKey] = useState7(defaultSortKey ?? null);
|
|
1606
|
+
const [internalDirection, setInternalDirection] = useState7(defaultSortDirection);
|
|
1480
1607
|
const isControlled = controlledKey !== void 0 && controlledDirection !== void 0;
|
|
1481
1608
|
const activeKey = isControlled ? controlledKey : internalKey;
|
|
1482
1609
|
const activeDirection = isControlled ? controlledDirection : internalDirection;
|
|
@@ -1545,16 +1672,16 @@ function SortableTable({
|
|
|
1545
1672
|
onSortChange?.(nextKey, nextDirection);
|
|
1546
1673
|
}
|
|
1547
1674
|
};
|
|
1548
|
-
return /* @__PURE__ */
|
|
1549
|
-
header && /* @__PURE__ */
|
|
1550
|
-
visibleRows.length === 0 ? /* @__PURE__ */
|
|
1551
|
-
/* @__PURE__ */
|
|
1552
|
-
selection && /* @__PURE__ */
|
|
1675
|
+
return /* @__PURE__ */ jsx21("div", { className: cn("fractal-sortable-table", `fractal-sortable-table--${size}`, embedded && "fractal-sortable-table--embedded", className), children: /* @__PURE__ */ jsxs18("div", { className: "fractal-sortable-table-surface", children: [
|
|
1676
|
+
header && /* @__PURE__ */ jsx21("div", { className: "fractal-sortable-table-header", children: header }),
|
|
1677
|
+
visibleRows.length === 0 ? /* @__PURE__ */ jsx21("div", { className: "fractal-sortable-table-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ jsxs18("table", { "aria-label": ariaLabel, className: "fractal-sortable-table-table", children: [
|
|
1678
|
+
/* @__PURE__ */ jsx21("thead", { children: /* @__PURE__ */ jsxs18("tr", { className: "fractal-sortable-table-thead-row", children: [
|
|
1679
|
+
selection && /* @__PURE__ */ jsx21(
|
|
1553
1680
|
"th",
|
|
1554
1681
|
{
|
|
1555
1682
|
className: "fractal-sortable-table-th fractal-sortable-table-selection-cell",
|
|
1556
1683
|
scope: "col",
|
|
1557
|
-
children: /* @__PURE__ */
|
|
1684
|
+
children: /* @__PURE__ */ jsx21(
|
|
1558
1685
|
Checkbox,
|
|
1559
1686
|
{
|
|
1560
1687
|
"aria-label": selection.selectAllLabel ?? "Select all rows",
|
|
@@ -1580,7 +1707,7 @@ function SortableTable({
|
|
|
1580
1707
|
columns.map((col) => {
|
|
1581
1708
|
const isActive = activeKey === col.key && activeDirection !== null;
|
|
1582
1709
|
if (!col.sortable) {
|
|
1583
|
-
return /* @__PURE__ */
|
|
1710
|
+
return /* @__PURE__ */ jsx21(
|
|
1584
1711
|
"th",
|
|
1585
1712
|
{
|
|
1586
1713
|
className: "fractal-sortable-table-th",
|
|
@@ -1591,13 +1718,13 @@ function SortableTable({
|
|
|
1591
1718
|
col.key
|
|
1592
1719
|
);
|
|
1593
1720
|
}
|
|
1594
|
-
return /* @__PURE__ */
|
|
1721
|
+
return /* @__PURE__ */ jsx21(
|
|
1595
1722
|
"th",
|
|
1596
1723
|
{
|
|
1597
1724
|
className: "fractal-sortable-table-th fractal-sortable-table-th--sortable",
|
|
1598
1725
|
scope: "col",
|
|
1599
1726
|
style: { width: col.width },
|
|
1600
|
-
children: /* @__PURE__ */
|
|
1727
|
+
children: /* @__PURE__ */ jsxs18(
|
|
1601
1728
|
"button",
|
|
1602
1729
|
{
|
|
1603
1730
|
type: "button",
|
|
@@ -1608,8 +1735,8 @@ function SortableTable({
|
|
|
1608
1735
|
onClick: () => handleSortClick(col.key),
|
|
1609
1736
|
"aria-sort": isActive ? activeDirection === "asc" ? "ascending" : "descending" : "none",
|
|
1610
1737
|
children: [
|
|
1611
|
-
/* @__PURE__ */
|
|
1612
|
-
/* @__PURE__ */
|
|
1738
|
+
/* @__PURE__ */ jsx21("span", { children: col.header }),
|
|
1739
|
+
/* @__PURE__ */ jsx21("span", { className: "fractal-sortable-table-sort-icon", "aria-hidden": "true", children: isActive && activeDirection === "asc" ? /* @__PURE__ */ jsx21(ArrowUp, { size: 14 }) : isActive && activeDirection === "desc" ? /* @__PURE__ */ jsx21(ArrowDown, { size: 14 }) : /* @__PURE__ */ jsx21(ArrowsUpDown, { size: 14 }) })
|
|
1613
1740
|
]
|
|
1614
1741
|
}
|
|
1615
1742
|
)
|
|
@@ -1618,7 +1745,7 @@ function SortableTable({
|
|
|
1618
1745
|
);
|
|
1619
1746
|
})
|
|
1620
1747
|
] }) }),
|
|
1621
|
-
/* @__PURE__ */
|
|
1748
|
+
/* @__PURE__ */ jsx21("tbody", { children: visibleRows.map((row, rowIndex) => {
|
|
1622
1749
|
const highlighted = highlightRow?.(row, rowIndex) ?? false;
|
|
1623
1750
|
const disabled = isRowDisabled?.(row) ?? false;
|
|
1624
1751
|
const selectionDisabled = disabled || (isRowSelectionDisabled?.(row) ?? false);
|
|
@@ -1627,7 +1754,7 @@ function SortableTable({
|
|
|
1627
1754
|
label: rowAction.label(row, rowIndex),
|
|
1628
1755
|
icon: rowAction.icon(row, rowIndex)
|
|
1629
1756
|
} : null;
|
|
1630
|
-
return /* @__PURE__ */
|
|
1757
|
+
return /* @__PURE__ */ jsxs18(
|
|
1631
1758
|
"tr",
|
|
1632
1759
|
{
|
|
1633
1760
|
className: cn(
|
|
@@ -1651,7 +1778,7 @@ function SortableTable({
|
|
|
1651
1778
|
role: interactive ? "button" : void 0,
|
|
1652
1779
|
tabIndex: interactive ? 0 : void 0,
|
|
1653
1780
|
children: [
|
|
1654
|
-
selection && /* @__PURE__ */
|
|
1781
|
+
selection && /* @__PURE__ */ jsx21("td", { className: "fractal-sortable-table-td fractal-sortable-table-selection-cell", children: /* @__PURE__ */ jsx21(
|
|
1655
1782
|
Checkbox,
|
|
1656
1783
|
{
|
|
1657
1784
|
"aria-label": selection.getRowLabel(row),
|
|
@@ -1663,7 +1790,7 @@ function SortableTable({
|
|
|
1663
1790
|
}
|
|
1664
1791
|
}
|
|
1665
1792
|
) }),
|
|
1666
|
-
columns.map((col, columnIndex) => /* @__PURE__ */
|
|
1793
|
+
columns.map((col, columnIndex) => /* @__PURE__ */ jsxs18(
|
|
1667
1794
|
"td",
|
|
1668
1795
|
{
|
|
1669
1796
|
className: cn(
|
|
@@ -1673,7 +1800,7 @@ function SortableTable({
|
|
|
1673
1800
|
style: { width: col.width, textAlign: col.align ?? "left" },
|
|
1674
1801
|
children: [
|
|
1675
1802
|
col.render(row, rowIndex),
|
|
1676
|
-
action && columnIndex === columns.length - 1 && /* @__PURE__ */
|
|
1803
|
+
action && columnIndex === columns.length - 1 && /* @__PURE__ */ jsx21("span", { className: "fractal-sortable-table-row-action", "aria-hidden": "true", children: /* @__PURE__ */ jsx21("span", { className: "fractal-sortable-table-row-action__icon", children: action.icon }) })
|
|
1677
1804
|
]
|
|
1678
1805
|
},
|
|
1679
1806
|
col.key
|
|
@@ -1688,8 +1815,8 @@ function SortableTable({
|
|
|
1688
1815
|
}
|
|
1689
1816
|
|
|
1690
1817
|
// src/components/Tabs/Tabs.tsx
|
|
1691
|
-
import { useId as useId2, useLayoutEffect as useLayoutEffect2, useRef as
|
|
1692
|
-
import { jsx as
|
|
1818
|
+
import { useId as useId2, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useState as useState8 } from "react";
|
|
1819
|
+
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1693
1820
|
function Tabs({
|
|
1694
1821
|
items,
|
|
1695
1822
|
defaultValue,
|
|
@@ -1701,14 +1828,14 @@ function Tabs({
|
|
|
1701
1828
|
variant = "line"
|
|
1702
1829
|
}) {
|
|
1703
1830
|
const reactId = useId2();
|
|
1704
|
-
const [internalValue, setInternalValue] =
|
|
1831
|
+
const [internalValue, setInternalValue] = useState8(
|
|
1705
1832
|
defaultValue ?? items.find((i) => !i.disabled)?.id ?? items[0]?.id ?? ""
|
|
1706
1833
|
);
|
|
1707
1834
|
const isControlled = controlledValue !== void 0;
|
|
1708
1835
|
const activeId = isControlled ? controlledValue : internalValue;
|
|
1709
|
-
const tabListRef =
|
|
1710
|
-
const tabRefs =
|
|
1711
|
-
const [indicator, setIndicator] =
|
|
1836
|
+
const tabListRef = useRef6(null);
|
|
1837
|
+
const tabRefs = useRef6({});
|
|
1838
|
+
const [indicator, setIndicator] = useState8(null);
|
|
1712
1839
|
useLayoutEffect2(() => {
|
|
1713
1840
|
const updateIndicator = () => {
|
|
1714
1841
|
const activeTab = tabRefs.current[activeId];
|
|
@@ -1760,8 +1887,8 @@ function Tabs({
|
|
|
1760
1887
|
selectTab(nextId2);
|
|
1761
1888
|
requestAnimationFrame(() => tabRefs.current[nextId2]?.focus());
|
|
1762
1889
|
};
|
|
1763
|
-
return /* @__PURE__ */
|
|
1764
|
-
/* @__PURE__ */
|
|
1890
|
+
return /* @__PURE__ */ jsxs19("div", { className: cn("fractal-tabs", `fractal-tabs--${variant}`, divider && "fractal-tabs--divider", className), children: [
|
|
1891
|
+
/* @__PURE__ */ jsx22(
|
|
1765
1892
|
"div",
|
|
1766
1893
|
{
|
|
1767
1894
|
ref: tabListRef,
|
|
@@ -1774,7 +1901,7 @@ function Tabs({
|
|
|
1774
1901
|
const isActive = item.id === activeId;
|
|
1775
1902
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
1776
1903
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
1777
|
-
return /* @__PURE__ */
|
|
1904
|
+
return /* @__PURE__ */ jsx22(
|
|
1778
1905
|
"button",
|
|
1779
1906
|
{
|
|
1780
1907
|
ref: (el) => {
|
|
@@ -1805,7 +1932,7 @@ function Tabs({
|
|
|
1805
1932
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
1806
1933
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
1807
1934
|
const isActive = item.id === activeId;
|
|
1808
|
-
return /* @__PURE__ */
|
|
1935
|
+
return /* @__PURE__ */ jsx22(
|
|
1809
1936
|
"div",
|
|
1810
1937
|
{
|
|
1811
1938
|
id: panelId,
|
|
@@ -1822,14 +1949,14 @@ function Tabs({
|
|
|
1822
1949
|
}
|
|
1823
1950
|
|
|
1824
1951
|
// src/components/ContentSwitcher/ContentSwitcher.tsx
|
|
1825
|
-
import * as
|
|
1826
|
-
import { jsx as
|
|
1952
|
+
import * as React15 from "react";
|
|
1953
|
+
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1827
1954
|
function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = false, className }) {
|
|
1828
|
-
const switcherRef =
|
|
1829
|
-
const buttonRefs =
|
|
1830
|
-
const indicatorMotionReadyRef =
|
|
1955
|
+
const switcherRef = React15.useRef(null);
|
|
1956
|
+
const buttonRefs = React15.useRef([]);
|
|
1957
|
+
const indicatorMotionReadyRef = React15.useRef(false);
|
|
1831
1958
|
const activeIndex = items.findIndex((item) => item.value === value);
|
|
1832
|
-
|
|
1959
|
+
React15.useLayoutEffect(() => {
|
|
1833
1960
|
const switcher = switcherRef.current;
|
|
1834
1961
|
const activeButton = buttonRefs.current[activeIndex];
|
|
1835
1962
|
let motionFrame = 0;
|
|
@@ -1881,7 +2008,7 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1881
2008
|
onValueChange(items[nextIndex].value);
|
|
1882
2009
|
}
|
|
1883
2010
|
};
|
|
1884
|
-
return /* @__PURE__ */
|
|
2011
|
+
return /* @__PURE__ */ jsxs20(
|
|
1885
2012
|
"div",
|
|
1886
2013
|
{
|
|
1887
2014
|
className: cn("fractal-content-switcher", fullWidth && "fractal-content-switcher--full-width", className),
|
|
@@ -1889,10 +2016,10 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1889
2016
|
"aria-label": ariaLabel,
|
|
1890
2017
|
ref: switcherRef,
|
|
1891
2018
|
children: [
|
|
1892
|
-
/* @__PURE__ */
|
|
2019
|
+
/* @__PURE__ */ jsx23("span", { className: "fractal-content-switcher__indicator", "aria-hidden": true }),
|
|
1893
2020
|
items.map((item, index) => {
|
|
1894
2021
|
const active = item.value === value;
|
|
1895
|
-
return /* @__PURE__ */
|
|
2022
|
+
return /* @__PURE__ */ jsx23(
|
|
1896
2023
|
"button",
|
|
1897
2024
|
{
|
|
1898
2025
|
className: cn("fractal-content-switcher__item", active && "fractal-content-switcher__item--active"),
|
|
@@ -1924,9 +2051,9 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1924
2051
|
}
|
|
1925
2052
|
|
|
1926
2053
|
// src/components/Disclosure/Disclosure.tsx
|
|
1927
|
-
import { useId as useId3, useState as
|
|
2054
|
+
import { useId as useId3, useState as useState9 } from "react";
|
|
1928
2055
|
import { ChevronRight as ChevronRight3, ChevronDown as ChevronDown2 } from "@mirror-physics/fractal-icons";
|
|
1929
|
-
import { jsx as
|
|
2056
|
+
import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1930
2057
|
function Disclosure({
|
|
1931
2058
|
title,
|
|
1932
2059
|
meta,
|
|
@@ -1941,7 +2068,7 @@ function Disclosure({
|
|
|
1941
2068
|
const reactId = useId3();
|
|
1942
2069
|
const headerId = `${reactId}-header`;
|
|
1943
2070
|
const panelId = `${reactId}-panel`;
|
|
1944
|
-
const [internalOpen, setInternalOpen] =
|
|
2071
|
+
const [internalOpen, setInternalOpen] = useState9(defaultOpen);
|
|
1945
2072
|
const isControlled = controlledOpen !== void 0;
|
|
1946
2073
|
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
1947
2074
|
const toggle = () => {
|
|
@@ -1954,7 +2081,7 @@ function Disclosure({
|
|
|
1954
2081
|
onOpenChange?.(next);
|
|
1955
2082
|
}
|
|
1956
2083
|
};
|
|
1957
|
-
return /* @__PURE__ */
|
|
2084
|
+
return /* @__PURE__ */ jsxs21(
|
|
1958
2085
|
"div",
|
|
1959
2086
|
{
|
|
1960
2087
|
className: cn(
|
|
@@ -1965,7 +2092,7 @@ function Disclosure({
|
|
|
1965
2092
|
className
|
|
1966
2093
|
),
|
|
1967
2094
|
children: [
|
|
1968
|
-
/* @__PURE__ */
|
|
2095
|
+
/* @__PURE__ */ jsxs21(
|
|
1969
2096
|
"button",
|
|
1970
2097
|
{
|
|
1971
2098
|
type: "button",
|
|
@@ -1976,13 +2103,13 @@ function Disclosure({
|
|
|
1976
2103
|
disabled,
|
|
1977
2104
|
onClick: toggle,
|
|
1978
2105
|
children: [
|
|
1979
|
-
/* @__PURE__ */
|
|
1980
|
-
/* @__PURE__ */
|
|
1981
|
-
meta && /* @__PURE__ */
|
|
2106
|
+
/* @__PURE__ */ jsx24("span", { className: "fractal-disclosure-icon", "aria-hidden": "true", children: isOpen ? /* @__PURE__ */ jsx24(ChevronDown2, { size: 16 }) : /* @__PURE__ */ jsx24(ChevronRight3, { size: 16 }) }),
|
|
2107
|
+
/* @__PURE__ */ jsx24("span", { className: "fractal-disclosure-title", children: title }),
|
|
2108
|
+
meta && /* @__PURE__ */ jsx24("span", { className: "fractal-disclosure-meta", children: meta })
|
|
1982
2109
|
]
|
|
1983
2110
|
}
|
|
1984
2111
|
),
|
|
1985
|
-
/* @__PURE__ */
|
|
2112
|
+
/* @__PURE__ */ jsx24(
|
|
1986
2113
|
"div",
|
|
1987
2114
|
{
|
|
1988
2115
|
id: panelId,
|
|
@@ -1990,7 +2117,7 @@ function Disclosure({
|
|
|
1990
2117
|
"aria-labelledby": headerId,
|
|
1991
2118
|
className: "fractal-disclosure-panel",
|
|
1992
2119
|
hidden: !isOpen,
|
|
1993
|
-
children: /* @__PURE__ */
|
|
2120
|
+
children: /* @__PURE__ */ jsx24("div", { className: "fractal-disclosure-panel-inner", children })
|
|
1994
2121
|
}
|
|
1995
2122
|
)
|
|
1996
2123
|
]
|
|
@@ -1999,18 +2126,18 @@ function Disclosure({
|
|
|
1999
2126
|
}
|
|
2000
2127
|
|
|
2001
2128
|
// src/components/LatticeLoader/LatticeLoader.tsx
|
|
2002
|
-
import { jsx as
|
|
2129
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
2003
2130
|
var LATTICE_COUNT = 160;
|
|
2004
2131
|
var WAVE_PERIOD = 80;
|
|
2005
2132
|
function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
2006
|
-
return /* @__PURE__ */
|
|
2133
|
+
return /* @__PURE__ */ jsx25(
|
|
2007
2134
|
"span",
|
|
2008
2135
|
{
|
|
2009
2136
|
"aria-label": label,
|
|
2010
2137
|
className: cn("fractal-lattice-loader", className),
|
|
2011
2138
|
role: "progressbar",
|
|
2012
2139
|
...props,
|
|
2013
|
-
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */
|
|
2140
|
+
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ jsx25(
|
|
2014
2141
|
"span",
|
|
2015
2142
|
{
|
|
2016
2143
|
"aria-hidden": "true",
|
|
@@ -2024,10 +2151,10 @@ function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
|
2024
2151
|
}
|
|
2025
2152
|
|
|
2026
2153
|
// src/components/Ghost/Ghost.tsx
|
|
2027
|
-
import { jsx as
|
|
2154
|
+
import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2028
2155
|
var toCssLength = (value) => typeof value === "number" ? `${value}px` : value;
|
|
2029
2156
|
function Ghost({ className, width, height, radius, style, ...props }) {
|
|
2030
|
-
return /* @__PURE__ */
|
|
2157
|
+
return /* @__PURE__ */ jsx26(
|
|
2031
2158
|
"div",
|
|
2032
2159
|
{
|
|
2033
2160
|
"aria-hidden": "true",
|
|
@@ -2043,15 +2170,15 @@ function Ghost({ className, width, height, radius, style, ...props }) {
|
|
|
2043
2170
|
);
|
|
2044
2171
|
}
|
|
2045
2172
|
function GhostLine({ className, size = "md", width = "100%", ...props }) {
|
|
2046
|
-
return /* @__PURE__ */
|
|
2173
|
+
return /* @__PURE__ */ jsx26(Ghost, { className: cn("fractal-ghost-line", `fractal-ghost-line--${size}`, className), width, ...props });
|
|
2047
2174
|
}
|
|
2048
2175
|
function ButtonGhost({ className, size = "md", iconOnly = false, width, ...props }) {
|
|
2049
|
-
return /* @__PURE__ */
|
|
2176
|
+
return /* @__PURE__ */ jsx26(Ghost, { className: cn("fractal-ghost-button", `fractal-ghost-button--${size}`, iconOnly && "fractal-ghost-button--icon-only", className), width, ...props });
|
|
2050
2177
|
}
|
|
2051
2178
|
function CardGhost({ className, lines = 3, showHeader = true, ...props }) {
|
|
2052
|
-
return /* @__PURE__ */
|
|
2053
|
-
showHeader && /* @__PURE__ */
|
|
2054
|
-
/* @__PURE__ */
|
|
2179
|
+
return /* @__PURE__ */ jsxs22("div", { "aria-hidden": "true", className: cn("fractal-ghost-card", className), ...props, children: [
|
|
2180
|
+
showHeader && /* @__PURE__ */ jsx26(GhostLine, { width: "38%" }),
|
|
2181
|
+
/* @__PURE__ */ jsx26("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx26(GhostLine, { width: index === lines - 1 ? "62%" : "100%" }, index)) })
|
|
2055
2182
|
] });
|
|
2056
2183
|
}
|
|
2057
2184
|
function DataTableGhost({
|
|
@@ -2065,81 +2192,81 @@ function DataTableGhost({
|
|
|
2065
2192
|
...props
|
|
2066
2193
|
}) {
|
|
2067
2194
|
const cells = Array.from({ length: columns }, (_, index) => index);
|
|
2068
|
-
return /* @__PURE__ */
|
|
2069
|
-
(showHeader || headers) && /* @__PURE__ */
|
|
2070
|
-
/* @__PURE__ */
|
|
2195
|
+
return /* @__PURE__ */ jsx26("div", { "aria-busy": "true", "aria-label": "Loading table", className: cn("fractal-ghost-table", `fractal-ghost-table--${size}`, className), role: "status", ...props, children: /* @__PURE__ */ jsxs22("table", { className: "fractal-ghost-table__table", children: [
|
|
2196
|
+
(showHeader || headers) && /* @__PURE__ */ jsx26("thead", { children: /* @__PURE__ */ jsx26("tr", { className: "fractal-ghost-table__head-row", children: cells.map((index) => /* @__PURE__ */ jsx26("th", { style: { width: columnWidths?.[index] }, children: headers?.[index] ?? /* @__PURE__ */ jsx26(GhostLine, { size: "sm", width: index === columns - 1 ? "62%" : "76%" }) }, index)) }) }),
|
|
2197
|
+
/* @__PURE__ */ jsx26("tbody", { children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ jsx26("tr", { className: "fractal-ghost-table__row", children: cells.map((columnIndex) => /* @__PURE__ */ jsx26("td", { style: { width: columnWidths?.[columnIndex] }, children: /* @__PURE__ */ jsx26(GhostLine, { width: `${[72, 54, 82, 63, 46][(rowIndex + columnIndex) % 5]}%` }) }, columnIndex)) }, rowIndex)) })
|
|
2071
2198
|
] }) });
|
|
2072
2199
|
}
|
|
2073
2200
|
function InputGhost({ className, labelWidth = "26%", ...props }) {
|
|
2074
|
-
return /* @__PURE__ */
|
|
2201
|
+
return /* @__PURE__ */ jsx26(FormFieldGhost, { className, labelWidth, ...props });
|
|
2075
2202
|
}
|
|
2076
2203
|
function TextareaGhost({ className, labelWidth = "26%", ...props }) {
|
|
2077
|
-
return /* @__PURE__ */
|
|
2204
|
+
return /* @__PURE__ */ jsx26(FormFieldGhost, { className, labelWidth, multiline: true, ...props });
|
|
2078
2205
|
}
|
|
2079
2206
|
function LabelGhost({ className, width = "26%", ...props }) {
|
|
2080
|
-
return /* @__PURE__ */
|
|
2207
|
+
return /* @__PURE__ */ jsx26(GhostLine, { className: cn("fractal-ghost-label", className), size: "sm", width, ...props });
|
|
2081
2208
|
}
|
|
2082
2209
|
function FormFieldGhost({ className, labelWidth = "26%", multiline = false, ...props }) {
|
|
2083
|
-
return /* @__PURE__ */
|
|
2084
|
-
/* @__PURE__ */
|
|
2085
|
-
/* @__PURE__ */
|
|
2210
|
+
return /* @__PURE__ */ jsxs22("div", { "aria-hidden": "true", className: cn("fractal-ghost-field", className), ...props, children: [
|
|
2211
|
+
/* @__PURE__ */ jsx26(LabelGhost, { width: labelWidth }),
|
|
2212
|
+
/* @__PURE__ */ jsx26(Ghost, { className: cn("fractal-ghost-field__control", multiline && "fractal-ghost-field__control--multiline") })
|
|
2086
2213
|
] });
|
|
2087
2214
|
}
|
|
2088
2215
|
function AlertGhost({ className, ...props }) {
|
|
2089
|
-
return /* @__PURE__ */
|
|
2090
|
-
/* @__PURE__ */
|
|
2091
|
-
/* @__PURE__ */
|
|
2216
|
+
return /* @__PURE__ */ jsxs22("div", { "aria-hidden": "true", className: cn("fractal-ghost-alert", className), ...props, children: [
|
|
2217
|
+
/* @__PURE__ */ jsx26(GhostLine, { width: "30%" }),
|
|
2218
|
+
/* @__PURE__ */ jsx26(GhostLine, { size: "sm", width: "78%" })
|
|
2092
2219
|
] });
|
|
2093
2220
|
}
|
|
2094
2221
|
function CheckboxGhost({ className, ...props }) {
|
|
2095
|
-
return /* @__PURE__ */
|
|
2096
|
-
/* @__PURE__ */
|
|
2097
|
-
/* @__PURE__ */
|
|
2222
|
+
return /* @__PURE__ */ jsxs22("div", { "aria-hidden": "true", className: cn("fractal-ghost-choice", className), ...props, children: [
|
|
2223
|
+
/* @__PURE__ */ jsx26(Ghost, { className: "fractal-ghost-choice__control" }),
|
|
2224
|
+
/* @__PURE__ */ jsx26(GhostLine, { width: "42%" })
|
|
2098
2225
|
] });
|
|
2099
2226
|
}
|
|
2100
2227
|
var ToggleGhost = CheckboxGhost;
|
|
2101
2228
|
function ChipGhost({ className, width = 74, ...props }) {
|
|
2102
|
-
return /* @__PURE__ */
|
|
2229
|
+
return /* @__PURE__ */ jsx26(Ghost, { className: cn("fractal-ghost-chip", className), height: 24, width, ...props });
|
|
2103
2230
|
}
|
|
2104
2231
|
function LinkGhost({ className, width = 96, ...props }) {
|
|
2105
|
-
return /* @__PURE__ */
|
|
2232
|
+
return /* @__PURE__ */ jsx26(GhostLine, { className: cn("fractal-ghost-link", className), size: "sm", width, ...props });
|
|
2106
2233
|
}
|
|
2107
2234
|
var TextButtonGhost = LinkGhost;
|
|
2108
2235
|
function DropdownGhost({ className, ...props }) {
|
|
2109
|
-
return /* @__PURE__ */
|
|
2110
|
-
/* @__PURE__ */
|
|
2111
|
-
/* @__PURE__ */
|
|
2236
|
+
return /* @__PURE__ */ jsxs22("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropdown", className), ...props, children: [
|
|
2237
|
+
/* @__PURE__ */ jsx26(GhostLine, { width: "38%" }),
|
|
2238
|
+
/* @__PURE__ */ jsx26(Ghost, { className: "fractal-ghost-dropdown__chevron" })
|
|
2112
2239
|
] });
|
|
2113
2240
|
}
|
|
2114
2241
|
function ContentSwitcherGhost({ className, options = 3, ...props }) {
|
|
2115
|
-
return /* @__PURE__ */
|
|
2242
|
+
return /* @__PURE__ */ jsx26("div", { "aria-hidden": "true", className: cn("fractal-ghost-switcher", className), ...props, children: Array.from({ length: options }, (_, index) => /* @__PURE__ */ jsx26(Ghost, {}, index)) });
|
|
2116
2243
|
}
|
|
2117
2244
|
var TabsGhost = ContentSwitcherGhost;
|
|
2118
2245
|
function DisclosureGhost({ className, ...props }) {
|
|
2119
|
-
return /* @__PURE__ */
|
|
2120
|
-
/* @__PURE__ */
|
|
2121
|
-
/* @__PURE__ */
|
|
2246
|
+
return /* @__PURE__ */ jsxs22("div", { "aria-hidden": "true", className: cn("fractal-ghost-disclosure", className), ...props, children: [
|
|
2247
|
+
/* @__PURE__ */ jsx26(Ghost, { className: "fractal-ghost-disclosure__icon" }),
|
|
2248
|
+
/* @__PURE__ */ jsx26(GhostLine, { width: "42%" })
|
|
2122
2249
|
] });
|
|
2123
2250
|
}
|
|
2124
2251
|
function PaginationGhost({ className, pages = 5, ...props }) {
|
|
2125
|
-
return /* @__PURE__ */
|
|
2252
|
+
return /* @__PURE__ */ jsx26("div", { "aria-hidden": "true", className: cn("fractal-ghost-pagination", className), ...props, children: Array.from({ length: pages }, (_, index) => /* @__PURE__ */ jsx26(Ghost, {}, index)) });
|
|
2126
2253
|
}
|
|
2127
2254
|
function FileDropzoneGhost({ className, ...props }) {
|
|
2128
|
-
return /* @__PURE__ */
|
|
2129
|
-
/* @__PURE__ */
|
|
2130
|
-
/* @__PURE__ */
|
|
2131
|
-
/* @__PURE__ */
|
|
2255
|
+
return /* @__PURE__ */ jsxs22("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropzone", className), ...props, children: [
|
|
2256
|
+
/* @__PURE__ */ jsx26(Ghost, { className: "fractal-ghost-dropzone__icon" }),
|
|
2257
|
+
/* @__PURE__ */ jsx26(GhostLine, { width: "26%" }),
|
|
2258
|
+
/* @__PURE__ */ jsx26(GhostLine, { size: "sm", width: "46%" })
|
|
2132
2259
|
] });
|
|
2133
2260
|
}
|
|
2134
2261
|
function PromptCardGhost({ className, ...props }) {
|
|
2135
|
-
return /* @__PURE__ */
|
|
2262
|
+
return /* @__PURE__ */ jsx26(CardGhost, { className: cn("fractal-ghost-prompt-card", className), lines: 4, ...props });
|
|
2136
2263
|
}
|
|
2137
2264
|
function ConversationGhost({
|
|
2138
2265
|
className,
|
|
2139
2266
|
"aria-label": ariaLabel = "Loading conversation",
|
|
2140
2267
|
...props
|
|
2141
2268
|
}) {
|
|
2142
|
-
return /* @__PURE__ */
|
|
2269
|
+
return /* @__PURE__ */ jsxs22(
|
|
2143
2270
|
"div",
|
|
2144
2271
|
{
|
|
2145
2272
|
"aria-busy": "true",
|
|
@@ -2148,54 +2275,54 @@ function ConversationGhost({
|
|
|
2148
2275
|
role: "status",
|
|
2149
2276
|
...props,
|
|
2150
2277
|
children: [
|
|
2151
|
-
/* @__PURE__ */
|
|
2152
|
-
/* @__PURE__ */
|
|
2153
|
-
/* @__PURE__ */
|
|
2154
|
-
/* @__PURE__ */
|
|
2278
|
+
/* @__PURE__ */ jsx26("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--user", children: /* @__PURE__ */ jsxs22("div", { className: "fractal-ghost-conversation__bubble", children: [
|
|
2279
|
+
/* @__PURE__ */ jsx26(GhostLine, { width: "100%" }),
|
|
2280
|
+
/* @__PURE__ */ jsx26(GhostLine, { width: "86%" }),
|
|
2281
|
+
/* @__PURE__ */ jsx26(GhostLine, { width: "64%" })
|
|
2155
2282
|
] }) }),
|
|
2156
|
-
/* @__PURE__ */
|
|
2157
|
-
/* @__PURE__ */
|
|
2158
|
-
/* @__PURE__ */
|
|
2159
|
-
/* @__PURE__ */
|
|
2283
|
+
/* @__PURE__ */ jsxs22("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--assistant", children: [
|
|
2284
|
+
/* @__PURE__ */ jsx26(GhostLine, { width: "92%" }),
|
|
2285
|
+
/* @__PURE__ */ jsx26(GhostLine, { width: "78%" }),
|
|
2286
|
+
/* @__PURE__ */ jsx26(GhostLine, { width: "58%" })
|
|
2160
2287
|
] })
|
|
2161
2288
|
]
|
|
2162
2289
|
}
|
|
2163
2290
|
);
|
|
2164
2291
|
}
|
|
2165
2292
|
function SortableTableGhost(props) {
|
|
2166
|
-
return /* @__PURE__ */
|
|
2293
|
+
return /* @__PURE__ */ jsx26(DataTableGhost, { ...props });
|
|
2167
2294
|
}
|
|
2168
2295
|
function SidebarGhost({ className, items = 6, ...props }) {
|
|
2169
|
-
return /* @__PURE__ */
|
|
2170
|
-
/* @__PURE__ */
|
|
2171
|
-
/* @__PURE__ */
|
|
2172
|
-
/* @__PURE__ */
|
|
2173
|
-
/* @__PURE__ */
|
|
2296
|
+
return /* @__PURE__ */ jsxs22("aside", { "aria-hidden": "true", className: cn("fractal-ghost-sidebar", className), ...props, children: [
|
|
2297
|
+
/* @__PURE__ */ jsx26(Ghost, { className: "fractal-ghost-sidebar__brand" }),
|
|
2298
|
+
/* @__PURE__ */ jsx26("div", { className: "fractal-ghost-sidebar__items", children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ jsxs22("div", { className: "fractal-ghost-sidebar__item", children: [
|
|
2299
|
+
/* @__PURE__ */ jsx26(Ghost, {}),
|
|
2300
|
+
/* @__PURE__ */ jsx26(GhostLine, { width: `${[54, 68, 44, 61][index % 4]}%` })
|
|
2174
2301
|
] }, index)) })
|
|
2175
2302
|
] });
|
|
2176
2303
|
}
|
|
2177
2304
|
function ModalGhost({ className, title, lines = 3, ...props }) {
|
|
2178
|
-
return /* @__PURE__ */
|
|
2305
|
+
return /* @__PURE__ */ jsx26(SurfaceGhost, { className: cn("fractal-ghost-modal", className), title, lines, ...props });
|
|
2179
2306
|
}
|
|
2180
2307
|
function SidePanelGhost({ className, title, lines = 5, ...props }) {
|
|
2181
|
-
return /* @__PURE__ */
|
|
2308
|
+
return /* @__PURE__ */ jsx26(SurfaceGhost, { className: cn("fractal-ghost-side-panel", className), title, lines, ...props });
|
|
2182
2309
|
}
|
|
2183
2310
|
function SurfaceGhost({ className, title, lines = 3, ...props }) {
|
|
2184
|
-
return /* @__PURE__ */
|
|
2185
|
-
/* @__PURE__ */
|
|
2186
|
-
/* @__PURE__ */
|
|
2187
|
-
/* @__PURE__ */
|
|
2311
|
+
return /* @__PURE__ */ jsxs22("div", { "aria-hidden": "true", className: cn("fractal-ghost-surface", className), ...props, children: [
|
|
2312
|
+
/* @__PURE__ */ jsxs22("div", { className: "fractal-ghost-surface__header", children: [
|
|
2313
|
+
/* @__PURE__ */ jsx26(GhostLine, { width: "42%" }),
|
|
2314
|
+
/* @__PURE__ */ jsx26(Ghost, { className: "fractal-ghost-surface__close" })
|
|
2188
2315
|
] }),
|
|
2189
|
-
title && /* @__PURE__ */
|
|
2190
|
-
/* @__PURE__ */
|
|
2316
|
+
title && /* @__PURE__ */ jsx26("div", { className: "fractal-ghost-surface__title", children: title }),
|
|
2317
|
+
/* @__PURE__ */ jsx26("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx26(GhostLine, { width: index === lines - 1 ? "64%" : "100%" }, index)) })
|
|
2191
2318
|
] });
|
|
2192
2319
|
}
|
|
2193
2320
|
|
|
2194
2321
|
// src/components/Sidebar/Sidebar.tsx
|
|
2195
|
-
import * as
|
|
2196
|
-
import { Fragment as Fragment3, jsx as
|
|
2197
|
-
var Sidebar =
|
|
2198
|
-
({ className, width, compact = false, style, ...props }, ref) => /* @__PURE__ */
|
|
2322
|
+
import * as React16 from "react";
|
|
2323
|
+
import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2324
|
+
var Sidebar = React16.forwardRef(
|
|
2325
|
+
({ className, width, compact = false, style, ...props }, ref) => /* @__PURE__ */ jsx27(
|
|
2199
2326
|
"aside",
|
|
2200
2327
|
{
|
|
2201
2328
|
ref,
|
|
@@ -2207,12 +2334,12 @@ var Sidebar = React15.forwardRef(
|
|
|
2207
2334
|
)
|
|
2208
2335
|
);
|
|
2209
2336
|
Sidebar.displayName = "Sidebar";
|
|
2210
|
-
var SidebarHeader =
|
|
2211
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2337
|
+
var SidebarHeader = React16.forwardRef(
|
|
2338
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx27("div", { ref, className: cn("fractal-sidebar__header", className), ...props })
|
|
2212
2339
|
);
|
|
2213
2340
|
SidebarHeader.displayName = "SidebarHeader";
|
|
2214
|
-
var SidebarBrand =
|
|
2215
|
-
({ className, type = "button", ...props }, ref) => /* @__PURE__ */
|
|
2341
|
+
var SidebarBrand = React16.forwardRef(
|
|
2342
|
+
({ className, type = "button", ...props }, ref) => /* @__PURE__ */ jsx27("button", { ref, type, className: cn("fractal-sidebar__brand", className), ...props })
|
|
2216
2343
|
);
|
|
2217
2344
|
SidebarBrand.displayName = "SidebarBrand";
|
|
2218
2345
|
function SidebarAccountMenu({
|
|
@@ -2223,7 +2350,7 @@ function SidebarAccountMenu({
|
|
|
2223
2350
|
icon,
|
|
2224
2351
|
className
|
|
2225
2352
|
}) {
|
|
2226
|
-
return /* @__PURE__ */
|
|
2353
|
+
return /* @__PURE__ */ jsx27(
|
|
2227
2354
|
Dropdown,
|
|
2228
2355
|
{
|
|
2229
2356
|
align: "left",
|
|
@@ -2233,25 +2360,25 @@ function SidebarAccountMenu({
|
|
|
2233
2360
|
panelClassName: "fractal-sidebar__account-panel",
|
|
2234
2361
|
selectedValue: "",
|
|
2235
2362
|
triggerClassName: "fractal-sidebar__account-trigger",
|
|
2236
|
-
triggerContent: /* @__PURE__ */
|
|
2237
|
-
icon && /* @__PURE__ */
|
|
2238
|
-
/* @__PURE__ */
|
|
2363
|
+
triggerContent: /* @__PURE__ */ jsxs23(Fragment3, { children: [
|
|
2364
|
+
icon && /* @__PURE__ */ jsx27("span", { className: "fractal-sidebar__account-icon", "aria-hidden": "true", children: icon }),
|
|
2365
|
+
/* @__PURE__ */ jsx27("span", { className: "fractal-sidebar__account-name", children: name })
|
|
2239
2366
|
] }),
|
|
2240
2367
|
triggerLabel,
|
|
2241
2368
|
triggerVariant: "tertiary"
|
|
2242
2369
|
}
|
|
2243
2370
|
);
|
|
2244
2371
|
}
|
|
2245
|
-
var SidebarNav =
|
|
2246
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2372
|
+
var SidebarNav = React16.forwardRef(
|
|
2373
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx27("nav", { ref, className: cn("fractal-sidebar__nav", className), ...props })
|
|
2247
2374
|
);
|
|
2248
2375
|
SidebarNav.displayName = "SidebarNav";
|
|
2249
|
-
var SidebarSection =
|
|
2250
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2376
|
+
var SidebarSection = React16.forwardRef(
|
|
2377
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx27("div", { ref, className: cn("fractal-sidebar__section", className), ...props })
|
|
2251
2378
|
);
|
|
2252
2379
|
SidebarSection.displayName = "SidebarSection";
|
|
2253
|
-
var SidebarNavItem =
|
|
2254
|
-
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */
|
|
2380
|
+
var SidebarNavItem = React16.forwardRef(
|
|
2381
|
+
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ jsxs23(
|
|
2255
2382
|
"button",
|
|
2256
2383
|
{
|
|
2257
2384
|
ref,
|
|
@@ -2261,28 +2388,28 @@ var SidebarNavItem = React15.forwardRef(
|
|
|
2261
2388
|
"aria-current": active ? "page" : void 0,
|
|
2262
2389
|
...props,
|
|
2263
2390
|
children: [
|
|
2264
|
-
icon && /* @__PURE__ */
|
|
2265
|
-
/* @__PURE__ */
|
|
2266
|
-
endAdornment && /* @__PURE__ */
|
|
2391
|
+
icon && /* @__PURE__ */ jsx27("span", { className: "fractal-sidebar__nav-item-icon", "aria-hidden": "true", children: icon }),
|
|
2392
|
+
/* @__PURE__ */ jsx27("span", { className: "fractal-sidebar__nav-item-label", children }),
|
|
2393
|
+
endAdornment && /* @__PURE__ */ jsx27("span", { className: "fractal-sidebar__nav-item-end", children: endAdornment })
|
|
2267
2394
|
]
|
|
2268
2395
|
}
|
|
2269
2396
|
)
|
|
2270
2397
|
);
|
|
2271
2398
|
SidebarNavItem.displayName = "SidebarNavItem";
|
|
2272
|
-
var SidebarFooter =
|
|
2273
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2399
|
+
var SidebarFooter = React16.forwardRef(
|
|
2400
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx27("div", { ref, className: cn("fractal-sidebar__footer", className), ...props })
|
|
2274
2401
|
);
|
|
2275
2402
|
SidebarFooter.displayName = "SidebarFooter";
|
|
2276
2403
|
|
|
2277
2404
|
// src/components/SidePanel/SidePanel.tsx
|
|
2278
|
-
import { createPortal as
|
|
2279
|
-
import { Close } from "@mirror-physics/fractal-icons";
|
|
2280
|
-
import { jsx as
|
|
2405
|
+
import { createPortal as createPortal3 } from "react-dom";
|
|
2406
|
+
import { Close as Close2 } from "@mirror-physics/fractal-icons";
|
|
2407
|
+
import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2281
2408
|
function SidePanel({ open, onClose, title, description, children, footer, size = "md", loading = false, loadingLabel = "Loading", className }) {
|
|
2282
2409
|
useEscapeDismiss(80, onClose, open);
|
|
2283
2410
|
if (!open) return null;
|
|
2284
|
-
return
|
|
2285
|
-
/* @__PURE__ */
|
|
2411
|
+
return createPortal3(
|
|
2412
|
+
/* @__PURE__ */ jsx28("div", { className: "fractal-side-panel-overlay", onMouseDown: onClose, children: /* @__PURE__ */ jsxs24(
|
|
2286
2413
|
"aside",
|
|
2287
2414
|
{
|
|
2288
2415
|
className: cn("fractal-side-panel", `fractal-side-panel--${size}`, className),
|
|
@@ -2291,15 +2418,15 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
2291
2418
|
role: "dialog",
|
|
2292
2419
|
onMouseDown: (event) => event.stopPropagation(),
|
|
2293
2420
|
children: [
|
|
2294
|
-
/* @__PURE__ */
|
|
2295
|
-
/* @__PURE__ */
|
|
2296
|
-
typeof title === "string" ? /* @__PURE__ */
|
|
2297
|
-
description && /* @__PURE__ */
|
|
2421
|
+
/* @__PURE__ */ jsxs24("header", { className: "fractal-side-panel__header", children: [
|
|
2422
|
+
/* @__PURE__ */ jsxs24("div", { className: "fractal-side-panel__heading", children: [
|
|
2423
|
+
typeof title === "string" ? /* @__PURE__ */ jsx28("h2", { className: "fractal-side-panel__title", children: title }) : /* @__PURE__ */ jsx28("div", { className: "fractal-side-panel__title", children: title }),
|
|
2424
|
+
description && /* @__PURE__ */ jsx28("p", { className: "fractal-side-panel__description", children: description })
|
|
2298
2425
|
] }),
|
|
2299
|
-
/* @__PURE__ */
|
|
2426
|
+
/* @__PURE__ */ jsx28("button", { type: "button", className: "fractal-side-panel__close", "aria-label": "Close panel", onClick: onClose, children: /* @__PURE__ */ jsx28(Close2, { size: 18 }) })
|
|
2300
2427
|
] }),
|
|
2301
|
-
/* @__PURE__ */
|
|
2302
|
-
footer && /* @__PURE__ */
|
|
2428
|
+
/* @__PURE__ */ jsx28("div", { "aria-busy": loading || void 0, className: cn("fractal-side-panel__body", loading && "fractal-side-panel__body--loading"), children: loading ? /* @__PURE__ */ jsx28(UILoader, { label: loadingLabel }) : children }),
|
|
2429
|
+
footer && /* @__PURE__ */ jsx28("footer", { className: "fractal-side-panel__footer", children: footer })
|
|
2303
2430
|
]
|
|
2304
2431
|
}
|
|
2305
2432
|
) }),
|
|
@@ -2308,18 +2435,18 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
2308
2435
|
}
|
|
2309
2436
|
|
|
2310
2437
|
// src/components/Textarea/Textarea.tsx
|
|
2311
|
-
import * as
|
|
2312
|
-
import { jsx as
|
|
2313
|
-
var Textarea =
|
|
2314
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2438
|
+
import * as React17 from "react";
|
|
2439
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
2440
|
+
var Textarea = React17.forwardRef(
|
|
2441
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx29("textarea", { ref, className: cn("fractal-textarea", className), ...props })
|
|
2315
2442
|
);
|
|
2316
2443
|
Textarea.displayName = "Textarea";
|
|
2317
2444
|
|
|
2318
2445
|
// src/components/TextButton/TextButton.tsx
|
|
2319
|
-
import * as
|
|
2320
|
-
import { jsx as
|
|
2321
|
-
var TextButton =
|
|
2322
|
-
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */
|
|
2446
|
+
import * as React18 from "react";
|
|
2447
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2448
|
+
var TextButton = React18.forwardRef(
|
|
2449
|
+
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ jsxs25(
|
|
2323
2450
|
"button",
|
|
2324
2451
|
{
|
|
2325
2452
|
ref,
|
|
@@ -2327,9 +2454,9 @@ var TextButton = React17.forwardRef(
|
|
|
2327
2454
|
type: "button",
|
|
2328
2455
|
...props,
|
|
2329
2456
|
children: [
|
|
2330
|
-
icon && iconPosition === "start" && /* @__PURE__ */
|
|
2331
|
-
/* @__PURE__ */
|
|
2332
|
-
icon && iconPosition === "end" && /* @__PURE__ */
|
|
2457
|
+
icon && iconPosition === "start" && /* @__PURE__ */ jsx30("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon }),
|
|
2458
|
+
/* @__PURE__ */ jsx30("span", { children }),
|
|
2459
|
+
icon && iconPosition === "end" && /* @__PURE__ */ jsx30("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon })
|
|
2333
2460
|
]
|
|
2334
2461
|
}
|
|
2335
2462
|
)
|
|
@@ -2337,9 +2464,9 @@ var TextButton = React17.forwardRef(
|
|
|
2337
2464
|
TextButton.displayName = "TextButton";
|
|
2338
2465
|
|
|
2339
2466
|
// src/components/FileDropzone/FileDropzone.tsx
|
|
2340
|
-
import * as
|
|
2341
|
-
import { Close as
|
|
2342
|
-
import { jsx as
|
|
2467
|
+
import * as React19 from "react";
|
|
2468
|
+
import { Close as Close3, FileArrowUp } from "@mirror-physics/fractal-icons";
|
|
2469
|
+
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2343
2470
|
function FileDropzone({
|
|
2344
2471
|
files,
|
|
2345
2472
|
onFilesChange,
|
|
@@ -2350,17 +2477,17 @@ function FileDropzone({
|
|
|
2350
2477
|
description = "Files stay attached to this record.",
|
|
2351
2478
|
className
|
|
2352
2479
|
}) {
|
|
2353
|
-
const inputId =
|
|
2354
|
-
const inputRef =
|
|
2355
|
-
const [isDragging, setIsDragging] =
|
|
2480
|
+
const inputId = React19.useId();
|
|
2481
|
+
const inputRef = React19.useRef(null);
|
|
2482
|
+
const [isDragging, setIsDragging] = React19.useState(false);
|
|
2356
2483
|
const addFiles = (nextFiles) => {
|
|
2357
2484
|
if (disabled) return;
|
|
2358
2485
|
const additions = Array.from(nextFiles);
|
|
2359
2486
|
if (additions.length === 0) return;
|
|
2360
2487
|
onFilesChange(multiple ? [...files, ...additions] : additions.slice(0, 1));
|
|
2361
2488
|
};
|
|
2362
|
-
return /* @__PURE__ */
|
|
2363
|
-
/* @__PURE__ */
|
|
2489
|
+
return /* @__PURE__ */ jsxs26("div", { className: cn("fractal-file-dropzone", className), children: [
|
|
2490
|
+
/* @__PURE__ */ jsx31(
|
|
2364
2491
|
"input",
|
|
2365
2492
|
{
|
|
2366
2493
|
ref: inputRef,
|
|
@@ -2376,7 +2503,7 @@ function FileDropzone({
|
|
|
2376
2503
|
}
|
|
2377
2504
|
}
|
|
2378
2505
|
),
|
|
2379
|
-
/* @__PURE__ */
|
|
2506
|
+
/* @__PURE__ */ jsxs26(
|
|
2380
2507
|
"button",
|
|
2381
2508
|
{
|
|
2382
2509
|
className: "fractal-file-dropzone__target",
|
|
@@ -2399,18 +2526,18 @@ function FileDropzone({
|
|
|
2399
2526
|
addFiles(event.dataTransfer.files);
|
|
2400
2527
|
},
|
|
2401
2528
|
children: [
|
|
2402
|
-
/* @__PURE__ */
|
|
2403
|
-
/* @__PURE__ */
|
|
2404
|
-
/* @__PURE__ */
|
|
2405
|
-
description && /* @__PURE__ */
|
|
2529
|
+
/* @__PURE__ */ jsx31(FileArrowUp, { "aria-hidden": "true", size: 20 }),
|
|
2530
|
+
/* @__PURE__ */ jsxs26("span", { className: "fractal-file-dropzone__copy", children: [
|
|
2531
|
+
/* @__PURE__ */ jsx31("span", { className: "fractal-file-dropzone__title", children: title }),
|
|
2532
|
+
description && /* @__PURE__ */ jsx31("span", { className: "fractal-file-dropzone__description", children: description })
|
|
2406
2533
|
] })
|
|
2407
2534
|
]
|
|
2408
2535
|
}
|
|
2409
2536
|
),
|
|
2410
|
-
files.length > 0 && /* @__PURE__ */
|
|
2411
|
-
/* @__PURE__ */
|
|
2412
|
-
/* @__PURE__ */
|
|
2413
|
-
/* @__PURE__ */
|
|
2537
|
+
files.length > 0 && /* @__PURE__ */ jsx31("ul", { className: "fractal-file-dropzone__files", "aria-label": "Attached files", children: files.map((file, index) => /* @__PURE__ */ jsxs26("li", { className: "fractal-file-dropzone__file", children: [
|
|
2538
|
+
/* @__PURE__ */ jsx31("span", { className: "fractal-file-dropzone__file-name", children: file.name }),
|
|
2539
|
+
/* @__PURE__ */ jsx31("span", { className: "fractal-file-dropzone__file-meta", children: formatFileSize(file.size) }),
|
|
2540
|
+
/* @__PURE__ */ jsx31(
|
|
2414
2541
|
"button",
|
|
2415
2542
|
{
|
|
2416
2543
|
className: "fractal-file-dropzone__remove",
|
|
@@ -2418,7 +2545,7 @@ function FileDropzone({
|
|
|
2418
2545
|
"aria-label": `Remove ${file.name}`,
|
|
2419
2546
|
disabled,
|
|
2420
2547
|
onClick: () => onFilesChange(files.filter((_, fileIndex) => fileIndex !== index)),
|
|
2421
|
-
children: /* @__PURE__ */
|
|
2548
|
+
children: /* @__PURE__ */ jsx31(Close3, { "aria-hidden": "true", size: 14 })
|
|
2422
2549
|
}
|
|
2423
2550
|
)
|
|
2424
2551
|
] }, `${file.name}-${file.size}-${index}`)) })
|
|
@@ -2432,7 +2559,7 @@ function formatFileSize(bytes) {
|
|
|
2432
2559
|
|
|
2433
2560
|
// src/components/Pagination/Pagination.tsx
|
|
2434
2561
|
import { ArrowLeft, ArrowRight } from "@mirror-physics/fractal-icons";
|
|
2435
|
-
import { jsx as
|
|
2562
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2436
2563
|
function Pagination({
|
|
2437
2564
|
page,
|
|
2438
2565
|
pageSize,
|
|
@@ -2448,10 +2575,10 @@ function Pagination({
|
|
|
2448
2575
|
const start = totalItems === 0 ? 0 : (currentPage - 1) * pageSize + 1;
|
|
2449
2576
|
const end = Math.min(currentPage * pageSize, totalItems);
|
|
2450
2577
|
const canChangePageSize = pageSizeOptions != null && pageSizeOptions.length > 0 && onPageSizeChange != null;
|
|
2451
|
-
return /* @__PURE__ */
|
|
2452
|
-
/* @__PURE__ */
|
|
2453
|
-
/* @__PURE__ */
|
|
2454
|
-
canChangePageSize && /* @__PURE__ */
|
|
2578
|
+
return /* @__PURE__ */ jsxs27("nav", { className: cn("fractal-pagination", className), "aria-label": ariaLabel, children: [
|
|
2579
|
+
/* @__PURE__ */ jsx32("span", { className: "fractal-pagination__summary", children: totalItems === 0 ? "No results" : `${start}-${end} of ${totalItems}` }),
|
|
2580
|
+
/* @__PURE__ */ jsxs27("div", { className: "fractal-pagination__controls", children: [
|
|
2581
|
+
canChangePageSize && /* @__PURE__ */ jsx32(
|
|
2455
2582
|
Dropdown,
|
|
2456
2583
|
{
|
|
2457
2584
|
align: "right",
|
|
@@ -2468,7 +2595,7 @@ function Pagination({
|
|
|
2468
2595
|
triggerVariant: "tertiary"
|
|
2469
2596
|
}
|
|
2470
2597
|
),
|
|
2471
|
-
/* @__PURE__ */
|
|
2598
|
+
/* @__PURE__ */ jsx32(
|
|
2472
2599
|
"button",
|
|
2473
2600
|
{
|
|
2474
2601
|
className: "fractal-pagination__button",
|
|
@@ -2477,15 +2604,15 @@ function Pagination({
|
|
|
2477
2604
|
title: "Previous page",
|
|
2478
2605
|
disabled: currentPage === 1 || totalItems === 0,
|
|
2479
2606
|
onClick: () => onPageChange(currentPage - 1),
|
|
2480
|
-
children: /* @__PURE__ */
|
|
2607
|
+
children: /* @__PURE__ */ jsx32(ArrowLeft, { "aria-hidden": "true", size: 16 })
|
|
2481
2608
|
}
|
|
2482
2609
|
),
|
|
2483
|
-
/* @__PURE__ */
|
|
2610
|
+
/* @__PURE__ */ jsxs27("span", { className: "fractal-pagination__page", "aria-current": "page", children: [
|
|
2484
2611
|
currentPage,
|
|
2485
2612
|
" of ",
|
|
2486
2613
|
totalPages
|
|
2487
2614
|
] }),
|
|
2488
|
-
/* @__PURE__ */
|
|
2615
|
+
/* @__PURE__ */ jsx32(
|
|
2489
2616
|
"button",
|
|
2490
2617
|
{
|
|
2491
2618
|
className: "fractal-pagination__button",
|
|
@@ -2494,7 +2621,7 @@ function Pagination({
|
|
|
2494
2621
|
title: "Next page",
|
|
2495
2622
|
disabled: currentPage === totalPages || totalItems === 0,
|
|
2496
2623
|
onClick: () => onPageChange(currentPage + 1),
|
|
2497
|
-
children: /* @__PURE__ */
|
|
2624
|
+
children: /* @__PURE__ */ jsx32(ArrowRight, { "aria-hidden": "true", size: 16 })
|
|
2498
2625
|
}
|
|
2499
2626
|
)
|
|
2500
2627
|
] })
|
|
@@ -2572,6 +2699,8 @@ export {
|
|
|
2572
2699
|
TextButtonGhost,
|
|
2573
2700
|
Textarea,
|
|
2574
2701
|
TextareaGhost,
|
|
2702
|
+
Toast,
|
|
2703
|
+
ToastViewport,
|
|
2575
2704
|
Toggle,
|
|
2576
2705
|
ToggleGhost,
|
|
2577
2706
|
UILoader,
|