@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.cjs
CHANGED
|
@@ -101,6 +101,8 @@ __export(index_exports, {
|
|
|
101
101
|
TextButtonGhost: () => TextButtonGhost,
|
|
102
102
|
Textarea: () => Textarea,
|
|
103
103
|
TextareaGhost: () => TextareaGhost,
|
|
104
|
+
Toast: () => Toast,
|
|
105
|
+
ToastViewport: () => ToastViewport,
|
|
104
106
|
Toggle: () => Toggle,
|
|
105
107
|
ToggleGhost: () => ToggleGhost,
|
|
106
108
|
UILoader: () => UILoader,
|
|
@@ -940,6 +942,21 @@ function Slider(props) {
|
|
|
940
942
|
clamp(nextUpper, nextLower, max)
|
|
941
943
|
]);
|
|
942
944
|
};
|
|
945
|
+
const getKeyboardValue = (event, value) => {
|
|
946
|
+
const pageStep = step * 10;
|
|
947
|
+
const adjustments = {
|
|
948
|
+
ArrowDown: -step,
|
|
949
|
+
ArrowLeft: -step,
|
|
950
|
+
ArrowRight: step,
|
|
951
|
+
ArrowUp: step,
|
|
952
|
+
PageDown: -pageStep,
|
|
953
|
+
PageUp: pageStep
|
|
954
|
+
};
|
|
955
|
+
if (event.key === "Home") return min;
|
|
956
|
+
if (event.key === "End") return max;
|
|
957
|
+
if (!(event.key in adjustments)) return null;
|
|
958
|
+
return value + adjustments[event.key];
|
|
959
|
+
};
|
|
943
960
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
944
961
|
"div",
|
|
945
962
|
{
|
|
@@ -974,6 +991,13 @@ function Slider(props) {
|
|
|
974
991
|
if (knobs === 2) changeRangeValue(Math.min(nextValue, secondValue), secondValue);
|
|
975
992
|
else changeSingleValue(nextValue);
|
|
976
993
|
},
|
|
994
|
+
onKeyDown: (event) => {
|
|
995
|
+
const nextValue = getKeyboardValue(event, firstValue);
|
|
996
|
+
if (nextValue === null) return;
|
|
997
|
+
event.preventDefault();
|
|
998
|
+
if (knobs === 2) changeRangeValue(Math.min(nextValue, secondValue), secondValue);
|
|
999
|
+
else changeSingleValue(nextValue);
|
|
1000
|
+
},
|
|
977
1001
|
step,
|
|
978
1002
|
type: "range",
|
|
979
1003
|
value: firstValue
|
|
@@ -990,6 +1014,12 @@ function Slider(props) {
|
|
|
990
1014
|
const nextValue = event.currentTarget.valueAsNumber;
|
|
991
1015
|
changeRangeValue(firstValue, Math.max(nextValue, firstValue));
|
|
992
1016
|
},
|
|
1017
|
+
onKeyDown: (event) => {
|
|
1018
|
+
const nextValue = getKeyboardValue(event, secondValue);
|
|
1019
|
+
if (nextValue === null) return;
|
|
1020
|
+
event.preventDefault();
|
|
1021
|
+
changeRangeValue(firstValue, Math.max(nextValue, firstValue));
|
|
1022
|
+
},
|
|
993
1023
|
step,
|
|
994
1024
|
type: "range",
|
|
995
1025
|
value: secondValue
|
|
@@ -1110,10 +1140,109 @@ var AlertDescription = React9.forwardRef(
|
|
|
1110
1140
|
);
|
|
1111
1141
|
AlertDescription.displayName = "AlertDescription";
|
|
1112
1142
|
|
|
1113
|
-
// src/components/
|
|
1143
|
+
// src/components/Toast/Toast.tsx
|
|
1144
|
+
var React10 = __toESM(require("react"), 1);
|
|
1145
|
+
var import_react_dom = require("react-dom");
|
|
1146
|
+
var import_fractal_icons8 = require("@mirror-physics/fractal-icons");
|
|
1114
1147
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1115
|
-
|
|
1148
|
+
var defaultIcons2 = {
|
|
1149
|
+
default: import_fractal_icons8.CircleInfo,
|
|
1150
|
+
info: import_fractal_icons8.CircleInfo,
|
|
1151
|
+
success: import_fractal_icons8.CircleCheck,
|
|
1152
|
+
warning: import_fractal_icons8.Warning,
|
|
1153
|
+
error: import_fractal_icons8.CircleClose
|
|
1154
|
+
};
|
|
1155
|
+
var Toast = React10.forwardRef(function Toast2({
|
|
1156
|
+
action,
|
|
1157
|
+
children,
|
|
1158
|
+
className,
|
|
1159
|
+
dismissLabel = "Dismiss notification",
|
|
1160
|
+
duration,
|
|
1161
|
+
icon,
|
|
1162
|
+
onBlurCapture,
|
|
1163
|
+
onDismiss,
|
|
1164
|
+
onFocusCapture,
|
|
1165
|
+
onPointerEnter,
|
|
1166
|
+
onPointerLeave,
|
|
1167
|
+
role,
|
|
1168
|
+
variant = "default",
|
|
1169
|
+
...props
|
|
1170
|
+
}, ref) {
|
|
1171
|
+
const [paused, setPaused] = React10.useState(false);
|
|
1172
|
+
const dismissRef = React10.useRef(onDismiss);
|
|
1173
|
+
const DefaultIcon = defaultIcons2[variant];
|
|
1174
|
+
const resolvedDuration = duration === void 0 ? variant === "error" ? null : 5e3 : duration;
|
|
1175
|
+
React10.useEffect(() => {
|
|
1176
|
+
dismissRef.current = onDismiss;
|
|
1177
|
+
}, [onDismiss]);
|
|
1178
|
+
React10.useEffect(() => {
|
|
1179
|
+
if (!dismissRef.current || paused || resolvedDuration === null || resolvedDuration <= 0) return;
|
|
1180
|
+
const timeout = window.setTimeout(() => dismissRef.current?.(), resolvedDuration);
|
|
1181
|
+
return () => window.clearTimeout(timeout);
|
|
1182
|
+
}, [paused, resolvedDuration]);
|
|
1183
|
+
const announcementRole = role ?? (variant === "error" ? "alert" : "status");
|
|
1116
1184
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1185
|
+
"div",
|
|
1186
|
+
{
|
|
1187
|
+
ref,
|
|
1188
|
+
"aria-atomic": "true",
|
|
1189
|
+
"aria-live": announcementRole === "alert" ? "assertive" : "polite",
|
|
1190
|
+
className: cn("fractal-toast", `fractal-toast--${variant}`, className),
|
|
1191
|
+
role: announcementRole,
|
|
1192
|
+
onBlurCapture: (event) => {
|
|
1193
|
+
onBlurCapture?.(event);
|
|
1194
|
+
if (!event.currentTarget.contains(event.relatedTarget)) setPaused(false);
|
|
1195
|
+
},
|
|
1196
|
+
onFocusCapture: (event) => {
|
|
1197
|
+
onFocusCapture?.(event);
|
|
1198
|
+
setPaused(true);
|
|
1199
|
+
},
|
|
1200
|
+
onPointerEnter: (event) => {
|
|
1201
|
+
onPointerEnter?.(event);
|
|
1202
|
+
setPaused(true);
|
|
1203
|
+
},
|
|
1204
|
+
onPointerLeave: (event) => {
|
|
1205
|
+
onPointerLeave?.(event);
|
|
1206
|
+
setPaused(false);
|
|
1207
|
+
},
|
|
1208
|
+
...props,
|
|
1209
|
+
children: [
|
|
1210
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-hidden": "true", className: "fractal-toast__icon", children: icon ?? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DefaultIcon, { size: 18 }) }),
|
|
1211
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "fractal-toast__content", children }),
|
|
1212
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "fractal-toast__action", children: action }),
|
|
1213
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1214
|
+
"button",
|
|
1215
|
+
{
|
|
1216
|
+
"aria-label": dismissLabel,
|
|
1217
|
+
className: "fractal-toast__dismiss",
|
|
1218
|
+
onClick: onDismiss,
|
|
1219
|
+
type: "button",
|
|
1220
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_fractal_icons8.Close, { "aria-hidden": "true", size: 14 })
|
|
1221
|
+
}
|
|
1222
|
+
)
|
|
1223
|
+
]
|
|
1224
|
+
}
|
|
1225
|
+
);
|
|
1226
|
+
});
|
|
1227
|
+
var ToastViewport = React10.forwardRef(function ToastViewport2({ children, className, portal = true, position = "top-center", ...props }, ref) {
|
|
1228
|
+
const viewport = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1229
|
+
"div",
|
|
1230
|
+
{
|
|
1231
|
+
ref,
|
|
1232
|
+
className: cn("fractal-toast-viewport", `fractal-toast-viewport--${position}`, className),
|
|
1233
|
+
"data-position": position,
|
|
1234
|
+
...props,
|
|
1235
|
+
children
|
|
1236
|
+
}
|
|
1237
|
+
);
|
|
1238
|
+
if (!portal || typeof document === "undefined") return viewport;
|
|
1239
|
+
return (0, import_react_dom.createPortal)(viewport, document.body);
|
|
1240
|
+
});
|
|
1241
|
+
|
|
1242
|
+
// src/components/Toggle/Toggle.tsx
|
|
1243
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1244
|
+
function Toggle({ checked, onChange, label, className }) {
|
|
1245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1117
1246
|
"button",
|
|
1118
1247
|
{
|
|
1119
1248
|
type: "button",
|
|
@@ -1122,16 +1251,16 @@ function Toggle({ checked, onChange, label, className }) {
|
|
|
1122
1251
|
className: cn("fractal-toggle", className),
|
|
1123
1252
|
onClick: () => onChange(!checked),
|
|
1124
1253
|
children: [
|
|
1125
|
-
/* @__PURE__ */ (0,
|
|
1126
|
-
label && /* @__PURE__ */ (0,
|
|
1254
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: cn("fractal-toggle-track", checked && "fractal-toggle-track--checked"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: cn("fractal-toggle-thumb", checked && "fractal-toggle-thumb--checked") }) }),
|
|
1255
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fractal-toggle-label", children: label })
|
|
1127
1256
|
]
|
|
1128
1257
|
}
|
|
1129
1258
|
);
|
|
1130
1259
|
}
|
|
1131
1260
|
|
|
1132
1261
|
// src/components/Modal/Modal.tsx
|
|
1133
|
-
var
|
|
1134
|
-
var
|
|
1262
|
+
var React11 = __toESM(require("react"), 1);
|
|
1263
|
+
var import_react_dom2 = require("react-dom");
|
|
1135
1264
|
|
|
1136
1265
|
// src/hooks/useEscapeDismiss.ts
|
|
1137
1266
|
var import_react2 = require("react");
|
|
@@ -1185,7 +1314,7 @@ function useEscapeDismiss(priority, handler, enabled = true) {
|
|
|
1185
1314
|
|
|
1186
1315
|
// src/components/UILoader/UILoader.tsx
|
|
1187
1316
|
var import_react3 = require("react");
|
|
1188
|
-
var
|
|
1317
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1189
1318
|
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";
|
|
1190
1319
|
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";
|
|
1191
1320
|
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";
|
|
@@ -1194,7 +1323,7 @@ function UILoader({ size = 48, tone = "neutral", className, style, label = "Load
|
|
|
1194
1323
|
const clipId = `fractal-ui-loader-clip-${rawId}`;
|
|
1195
1324
|
const gradientId = `fractal-ui-loader-gradient-${rawId}`;
|
|
1196
1325
|
const height = typeof size === "number" ? `${size}px` : size;
|
|
1197
|
-
return /* @__PURE__ */ (0,
|
|
1326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1198
1327
|
"span",
|
|
1199
1328
|
{
|
|
1200
1329
|
"aria-hidden": ariaHidden || void 0,
|
|
@@ -1202,52 +1331,52 @@ function UILoader({ size = 48, tone = "neutral", className, style, label = "Load
|
|
|
1202
1331
|
className: cn("fractal-ui-loader", `fractal-ui-loader--${tone}`, className),
|
|
1203
1332
|
role: ariaHidden ? void 0 : "status",
|
|
1204
1333
|
style,
|
|
1205
|
-
children: /* @__PURE__ */ (0,
|
|
1206
|
-
/* @__PURE__ */ (0,
|
|
1207
|
-
/* @__PURE__ */ (0,
|
|
1208
|
-
/* @__PURE__ */ (0,
|
|
1209
|
-
/* @__PURE__ */ (0,
|
|
1334
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { "aria-hidden": "true", fill: "none", viewBox: "0 0 144 92", style: { height, width: "auto" }, children: [
|
|
1335
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("defs", { children: [
|
|
1336
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("linearGradient", { id: gradientId, x1: "59", x2: "94.3", y1: "0", y2: "89.1", gradientUnits: "userSpaceOnUse", children: [
|
|
1337
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("stop", { className: "fractal-ui-loader__stop-start", offset: "0" }),
|
|
1338
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("stop", { className: "fractal-ui-loader__stop-end", offset: "1" })
|
|
1210
1339
|
] }),
|
|
1211
|
-
/* @__PURE__ */ (0,
|
|
1212
|
-
/* @__PURE__ */ (0,
|
|
1213
|
-
/* @__PURE__ */ (0,
|
|
1214
|
-
/* @__PURE__ */ (0,
|
|
1340
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("linearGradient", { id: `${gradientId}-shine`, x1: "0", x2: "1", y1: "0", y2: "0", children: [
|
|
1341
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("stop", { offset: "0.4", stopColor: "white", stopOpacity: "0" }),
|
|
1342
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("stop", { offset: "0.5", stopColor: "white", stopOpacity: "0.62" }),
|
|
1343
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("stop", { offset: "0.6", stopColor: "white", stopOpacity: "0" })
|
|
1215
1344
|
] }),
|
|
1216
|
-
/* @__PURE__ */ (0,
|
|
1217
|
-
/* @__PURE__ */ (0,
|
|
1218
|
-
/* @__PURE__ */ (0,
|
|
1219
|
-
/* @__PURE__ */ (0,
|
|
1345
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("clipPath", { id: clipId, children: [
|
|
1346
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: LEFT }),
|
|
1347
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: CENTER }),
|
|
1348
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: RIGHT })
|
|
1220
1349
|
] })
|
|
1221
1350
|
] }),
|
|
1222
|
-
/* @__PURE__ */ (0,
|
|
1223
|
-
/* @__PURE__ */ (0,
|
|
1224
|
-
/* @__PURE__ */ (0,
|
|
1225
|
-
/* @__PURE__ */ (0,
|
|
1351
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: CENTER, fill: `url(#${gradientId})` }),
|
|
1352
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: RIGHT, fill: `url(#${gradientId})` }),
|
|
1353
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: LEFT, fill: `url(#${gradientId})` }),
|
|
1354
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { clipPath: `url(#${clipId})`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { className: "fractal-ui-loader__shine-axis", transform: "translate(72 46) rotate(68.4)", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { className: "fractal-ui-loader__shine", x: "-160", y: "-100", width: "320", height: "200", fill: `url(#${gradientId}-shine)` }) }) })
|
|
1226
1355
|
] })
|
|
1227
1356
|
}
|
|
1228
1357
|
);
|
|
1229
1358
|
}
|
|
1230
1359
|
|
|
1231
1360
|
// src/components/Modal/Modal.tsx
|
|
1232
|
-
var
|
|
1233
|
-
var CloseIcon = () => /* @__PURE__ */ (0,
|
|
1361
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1362
|
+
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime16.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_runtime16.jsx)("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1234
1363
|
function Modal({ open, onClose, title, children, danger, warn, footer, noClose, closeDisabled = false, size = "sm", loading = false, loadingLabel = "Loading", scrollable = false, className }) {
|
|
1235
|
-
const [bodyScrolled, setBodyScrolled] =
|
|
1364
|
+
const [bodyScrolled, setBodyScrolled] = React11.useState(false);
|
|
1236
1365
|
useEscapeDismiss(80, onClose, open && !noClose && !closeDisabled);
|
|
1237
|
-
|
|
1366
|
+
React11.useEffect(() => {
|
|
1238
1367
|
if (open) setBodyScrolled(false);
|
|
1239
1368
|
}, [open]);
|
|
1240
1369
|
if (!open) return null;
|
|
1241
1370
|
const sizeClass = `fractal-modal-panel--${size}`;
|
|
1242
1371
|
const accentClass = danger ? "fractal-modal-panel--danger" : warn ? "fractal-modal-panel--warn" : "";
|
|
1243
|
-
return (0,
|
|
1244
|
-
/* @__PURE__ */ (0,
|
|
1372
|
+
return (0, import_react_dom2.createPortal)(
|
|
1373
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "fractal-modal-overlay", onClick: noClose || closeDisabled ? void 0 : onClose, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1245
1374
|
"div",
|
|
1246
1375
|
{
|
|
1247
1376
|
className: cn("fractal-modal-panel", sizeClass, accentClass, scrollable && "fractal-modal-panel--scrollable", className),
|
|
1248
1377
|
onClick: (e) => e.stopPropagation(),
|
|
1249
1378
|
children: [
|
|
1250
|
-
/* @__PURE__ */ (0,
|
|
1379
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1251
1380
|
"div",
|
|
1252
1381
|
{
|
|
1253
1382
|
className: cn(
|
|
@@ -1256,12 +1385,12 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
1256
1385
|
scrollable && bodyScrolled && "fractal-modal-title-row--scrolled"
|
|
1257
1386
|
),
|
|
1258
1387
|
children: [
|
|
1259
|
-
/* @__PURE__ */ (0,
|
|
1260
|
-
!noClose && /* @__PURE__ */ (0,
|
|
1388
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h3", { className: cn("fractal-modal-title", danger && "fractal-modal-title--danger", warn && "fractal-modal-title--warn"), children: title }),
|
|
1389
|
+
!noClose && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", onClick: onClose, title: "Close", disabled: closeDisabled, className: "fractal-modal-close", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CloseIcon, {}) })
|
|
1261
1390
|
]
|
|
1262
1391
|
}
|
|
1263
1392
|
),
|
|
1264
|
-
/* @__PURE__ */ (0,
|
|
1393
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1265
1394
|
"div",
|
|
1266
1395
|
{
|
|
1267
1396
|
"aria-busy": loading || void 0,
|
|
@@ -1272,10 +1401,10 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
1272
1401
|
scrollable && "fractal-modal-body--scrollable"
|
|
1273
1402
|
),
|
|
1274
1403
|
onScroll: scrollable ? (event) => setBodyScrolled(event.currentTarget.scrollTop > 0) : void 0,
|
|
1275
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
1404
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UILoader, { label: loadingLabel }) : children
|
|
1276
1405
|
}
|
|
1277
1406
|
),
|
|
1278
|
-
footer && /* @__PURE__ */ (0,
|
|
1407
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: cn("fractal-modal-footer", scrollable && "fractal-modal-footer--divided"), children: footer })
|
|
1279
1408
|
]
|
|
1280
1409
|
}
|
|
1281
1410
|
) }),
|
|
@@ -1284,17 +1413,17 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
1284
1413
|
}
|
|
1285
1414
|
|
|
1286
1415
|
// src/components/DataTable/DataTable.tsx
|
|
1287
|
-
var
|
|
1416
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1288
1417
|
function DataTable({ columns, data, emptyMessage, header, size = "md", className }) {
|
|
1289
|
-
return /* @__PURE__ */ (0,
|
|
1290
|
-
header && /* @__PURE__ */ (0,
|
|
1291
|
-
data.length === 0 ? /* @__PURE__ */ (0,
|
|
1292
|
-
/* @__PURE__ */ (0,
|
|
1293
|
-
/* @__PURE__ */ (0,
|
|
1418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: cn("fractal-datatable", `fractal-datatable--${size}`, className), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "fractal-datatable-surface", children: [
|
|
1419
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "fractal-datatable-header", children: header }),
|
|
1420
|
+
data.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "fractal-datatable-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("table", { className: "fractal-datatable-table", children: [
|
|
1421
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tr", { className: "fractal-datatable-thead-row", children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "fractal-datatable-th", style: { width: col.width }, children: col.header }, col.key)) }) }),
|
|
1422
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tbody", { children: data.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1294
1423
|
"tr",
|
|
1295
1424
|
{
|
|
1296
1425
|
className: "fractal-datatable-row",
|
|
1297
|
-
children: columns.map((col) => /* @__PURE__ */ (0,
|
|
1426
|
+
children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "fractal-datatable-td", style: { width: col.width }, children: col.render(row, rowIndex) }, col.key))
|
|
1298
1427
|
},
|
|
1299
1428
|
rowIndex
|
|
1300
1429
|
)) })
|
|
@@ -1303,9 +1432,9 @@ function DataTable({ columns, data, emptyMessage, header, size = "md", className
|
|
|
1303
1432
|
}
|
|
1304
1433
|
|
|
1305
1434
|
// src/components/Dropdown/Dropdown.tsx
|
|
1306
|
-
var
|
|
1307
|
-
var
|
|
1308
|
-
var
|
|
1435
|
+
var React12 = __toESM(require("react"), 1);
|
|
1436
|
+
var import_fractal_icons9 = require("@mirror-physics/fractal-icons");
|
|
1437
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1309
1438
|
var MARGIN = 4;
|
|
1310
1439
|
function Dropdown({
|
|
1311
1440
|
items,
|
|
@@ -1327,10 +1456,10 @@ function Dropdown({
|
|
|
1327
1456
|
closeOnSelect = true,
|
|
1328
1457
|
disabled = false
|
|
1329
1458
|
}) {
|
|
1330
|
-
const [open, setOpen] =
|
|
1331
|
-
const triggerRef =
|
|
1332
|
-
const panelRef =
|
|
1333
|
-
const [panelStyle, setPanelStyle] =
|
|
1459
|
+
const [open, setOpen] = React12.useState(false);
|
|
1460
|
+
const triggerRef = React12.useRef(null);
|
|
1461
|
+
const panelRef = React12.useRef(null);
|
|
1462
|
+
const [panelStyle, setPanelStyle] = React12.useState({});
|
|
1334
1463
|
const visibleItems = items.filter(
|
|
1335
1464
|
(item) => item.icon != null || item.description != null && (typeof item.description === "string" ? item.description !== "" : true)
|
|
1336
1465
|
);
|
|
@@ -1339,8 +1468,8 @@ function Dropdown({
|
|
|
1339
1468
|
const selected = items.find((i) => i.value === selectedValue && i.kind !== "header") ?? selectableItems[0] ?? visibleItems[0];
|
|
1340
1469
|
const isUp = direction === "up";
|
|
1341
1470
|
const isHorizontalDirection = direction === "left" || direction === "right";
|
|
1342
|
-
const ChevronIcon = direction === "up" ?
|
|
1343
|
-
|
|
1471
|
+
const ChevronIcon = direction === "up" ? import_fractal_icons9.ChevronUp : direction === "left" ? import_fractal_icons9.ChevronLeft : direction === "right" ? import_fractal_icons9.ChevronRight : import_fractal_icons9.ChevronDown;
|
|
1472
|
+
React12.useLayoutEffect(() => {
|
|
1344
1473
|
if (!open || !triggerRef.current || !panelRef.current) return;
|
|
1345
1474
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
1346
1475
|
const panelRect = panelRef.current.getBoundingClientRect();
|
|
@@ -1391,7 +1520,7 @@ function Dropdown({
|
|
|
1391
1520
|
}
|
|
1392
1521
|
setPanelStyle({ top, left, right });
|
|
1393
1522
|
}, [open, direction, isHorizontalDirection, isUp, align]);
|
|
1394
|
-
|
|
1523
|
+
React12.useEffect(() => {
|
|
1395
1524
|
if (!open) return;
|
|
1396
1525
|
const handleClickOutside = (e) => {
|
|
1397
1526
|
const target = e.target;
|
|
@@ -1401,8 +1530,8 @@ function Dropdown({
|
|
|
1401
1530
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1402
1531
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1403
1532
|
}, [open]);
|
|
1404
|
-
return /* @__PURE__ */ (0,
|
|
1405
|
-
/* @__PURE__ */ (0,
|
|
1533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: cn("fractal-dropdown", className), children: [
|
|
1534
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1406
1535
|
"button",
|
|
1407
1536
|
{
|
|
1408
1537
|
ref: triggerRef,
|
|
@@ -1421,15 +1550,15 @@ function Dropdown({
|
|
|
1421
1550
|
triggerClassName
|
|
1422
1551
|
),
|
|
1423
1552
|
children: [
|
|
1424
|
-
triggerContent != null ? triggerContent : /* @__PURE__ */ (0,
|
|
1425
|
-
selected.icon != null && /* @__PURE__ */ (0,
|
|
1426
|
-
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */ (0,
|
|
1553
|
+
triggerContent != null ? triggerContent : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1554
|
+
selected.icon != null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fractal-dropdown-icon fractal-dropdown-icon--trigger", children: selected.icon }),
|
|
1555
|
+
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fractal-dropdown-selected-text", children: selected.description })
|
|
1427
1556
|
] }),
|
|
1428
|
-
!noChevron && !iconOnly && /* @__PURE__ */ (0,
|
|
1557
|
+
!noChevron && !iconOnly && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fractal-dropdown-chevron", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronIcon, { size: size === "sm" ? 14 : 16 }) })
|
|
1429
1558
|
]
|
|
1430
1559
|
}
|
|
1431
1560
|
),
|
|
1432
|
-
open && /* @__PURE__ */ (0,
|
|
1561
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1433
1562
|
"div",
|
|
1434
1563
|
{
|
|
1435
1564
|
ref: panelRef,
|
|
@@ -1438,21 +1567,21 @@ function Dropdown({
|
|
|
1438
1567
|
className: cn("fractal-dropdown-panel", `fractal-dropdown-panel--${size}`, panelClassName),
|
|
1439
1568
|
style: panelStyle,
|
|
1440
1569
|
children: [
|
|
1441
|
-
label != null && /* @__PURE__ */ (0,
|
|
1570
|
+
label != null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "fractal-dropdown-label", children: label }),
|
|
1442
1571
|
visibleItems.map((item, index) => {
|
|
1443
|
-
const topDivider = item.border === "top" ? /* @__PURE__ */ (0,
|
|
1444
|
-
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */ (0,
|
|
1572
|
+
const topDivider = item.border === "top" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "fractal-dropdown-separator" }) : null;
|
|
1573
|
+
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "fractal-dropdown-separator" }) : null;
|
|
1445
1574
|
if (item.kind === "header") {
|
|
1446
|
-
return /* @__PURE__ */ (0,
|
|
1575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(React12.Fragment, { children: [
|
|
1447
1576
|
topDivider,
|
|
1448
|
-
/* @__PURE__ */ (0,
|
|
1577
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { role: "presentation", className: "fractal-dropdown-label", children: item.description }),
|
|
1449
1578
|
bottomDivider
|
|
1450
1579
|
] }, `header-${index}`);
|
|
1451
1580
|
}
|
|
1452
1581
|
const isSelected = item.value === selectedValue;
|
|
1453
|
-
return /* @__PURE__ */ (0,
|
|
1582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(React12.Fragment, { children: [
|
|
1454
1583
|
topDivider,
|
|
1455
|
-
/* @__PURE__ */ (0,
|
|
1584
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1456
1585
|
"button",
|
|
1457
1586
|
{
|
|
1458
1587
|
type: "button",
|
|
@@ -1464,9 +1593,9 @@ function Dropdown({
|
|
|
1464
1593
|
},
|
|
1465
1594
|
className: "fractal-dropdown-option",
|
|
1466
1595
|
children: [
|
|
1467
|
-
item.icon != null && /* @__PURE__ */ (0,
|
|
1468
|
-
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */ (0,
|
|
1469
|
-
item.trailing != null && /* @__PURE__ */ (0,
|
|
1596
|
+
item.icon != null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fractal-dropdown-icon", children: item.icon }),
|
|
1597
|
+
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fractal-dropdown-option-text", children: item.description }),
|
|
1598
|
+
item.trailing != null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fractal-dropdown-trailing", children: item.trailing })
|
|
1470
1599
|
]
|
|
1471
1600
|
}
|
|
1472
1601
|
),
|
|
@@ -1480,10 +1609,10 @@ function Dropdown({
|
|
|
1480
1609
|
}
|
|
1481
1610
|
|
|
1482
1611
|
// src/components/Link/Link.tsx
|
|
1483
|
-
var
|
|
1484
|
-
var
|
|
1485
|
-
var Link =
|
|
1486
|
-
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */ (0,
|
|
1612
|
+
var React13 = __toESM(require("react"), 1);
|
|
1613
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1614
|
+
var Link = React13.forwardRef(
|
|
1615
|
+
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1487
1616
|
"a",
|
|
1488
1617
|
{
|
|
1489
1618
|
ref,
|
|
@@ -1495,10 +1624,10 @@ var Link = React12.forwardRef(
|
|
|
1495
1624
|
Link.displayName = "Link";
|
|
1496
1625
|
|
|
1497
1626
|
// src/components/Chip/Chip.tsx
|
|
1498
|
-
var
|
|
1499
|
-
var
|
|
1500
|
-
var Chip =
|
|
1501
|
-
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */ (0,
|
|
1627
|
+
var React14 = __toESM(require("react"), 1);
|
|
1628
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1629
|
+
var Chip = React14.forwardRef(
|
|
1630
|
+
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1502
1631
|
"span",
|
|
1503
1632
|
{
|
|
1504
1633
|
ref,
|
|
@@ -1510,8 +1639,8 @@ var Chip = React13.forwardRef(
|
|
|
1510
1639
|
Chip.displayName = "Chip";
|
|
1511
1640
|
|
|
1512
1641
|
// src/components/Checkbox/Checkbox.tsx
|
|
1513
|
-
var
|
|
1514
|
-
var
|
|
1642
|
+
var import_fractal_icons10 = require("@mirror-physics/fractal-icons");
|
|
1643
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1515
1644
|
function Checkbox({
|
|
1516
1645
|
checked,
|
|
1517
1646
|
indeterminate = false,
|
|
@@ -1522,7 +1651,7 @@ function Checkbox({
|
|
|
1522
1651
|
onKeyDown,
|
|
1523
1652
|
...props
|
|
1524
1653
|
}) {
|
|
1525
|
-
return /* @__PURE__ */ (0,
|
|
1654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1526
1655
|
"button",
|
|
1527
1656
|
{
|
|
1528
1657
|
...props,
|
|
@@ -1544,18 +1673,18 @@ function Checkbox({
|
|
|
1544
1673
|
onKeyDown?.(event);
|
|
1545
1674
|
if (event.key === " " || event.key === "Enter") event.stopPropagation();
|
|
1546
1675
|
},
|
|
1547
|
-
children: indeterminate ? /* @__PURE__ */ (0,
|
|
1548
|
-
/* @__PURE__ */ (0,
|
|
1549
|
-
/* @__PURE__ */ (0,
|
|
1550
|
-
] }) : checked ? /* @__PURE__ */ (0,
|
|
1676
|
+
children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "fractal-checkbox__indeterminate-icon", "aria-hidden": "true", children: [
|
|
1677
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_fractal_icons10.Checkbox, { size: 18 }),
|
|
1678
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_fractal_icons10.Minus, { className: "fractal-checkbox__indeterminate-mark", size: 12 })
|
|
1679
|
+
] }) : checked ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_fractal_icons10.CheckboxChecked, { "aria-hidden": "true", size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_fractal_icons10.Checkbox, { "aria-hidden": "true", size: 18 })
|
|
1551
1680
|
}
|
|
1552
1681
|
);
|
|
1553
1682
|
}
|
|
1554
1683
|
|
|
1555
1684
|
// src/components/SortableTable/SortableTable.tsx
|
|
1556
1685
|
var import_react4 = require("react");
|
|
1557
|
-
var
|
|
1558
|
-
var
|
|
1686
|
+
var import_fractal_icons11 = require("@mirror-physics/fractal-icons");
|
|
1687
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1559
1688
|
function SortableTable({
|
|
1560
1689
|
columns,
|
|
1561
1690
|
data,
|
|
@@ -1650,16 +1779,16 @@ function SortableTable({
|
|
|
1650
1779
|
onSortChange?.(nextKey, nextDirection);
|
|
1651
1780
|
}
|
|
1652
1781
|
};
|
|
1653
|
-
return /* @__PURE__ */ (0,
|
|
1654
|
-
header && /* @__PURE__ */ (0,
|
|
1655
|
-
visibleRows.length === 0 ? /* @__PURE__ */ (0,
|
|
1656
|
-
/* @__PURE__ */ (0,
|
|
1657
|
-
selection && /* @__PURE__ */ (0,
|
|
1782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cn("fractal-sortable-table", `fractal-sortable-table--${size}`, embedded && "fractal-sortable-table--embedded", className), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "fractal-sortable-table-surface", children: [
|
|
1783
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "fractal-sortable-table-header", children: header }),
|
|
1784
|
+
visibleRows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "fractal-sortable-table-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("table", { "aria-label": ariaLabel, className: "fractal-sortable-table-table", children: [
|
|
1785
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("tr", { className: "fractal-sortable-table-thead-row", children: [
|
|
1786
|
+
selection && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1658
1787
|
"th",
|
|
1659
1788
|
{
|
|
1660
1789
|
className: "fractal-sortable-table-th fractal-sortable-table-selection-cell",
|
|
1661
1790
|
scope: "col",
|
|
1662
|
-
children: /* @__PURE__ */ (0,
|
|
1791
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1663
1792
|
Checkbox,
|
|
1664
1793
|
{
|
|
1665
1794
|
"aria-label": selection.selectAllLabel ?? "Select all rows",
|
|
@@ -1685,7 +1814,7 @@ function SortableTable({
|
|
|
1685
1814
|
columns.map((col) => {
|
|
1686
1815
|
const isActive = activeKey === col.key && activeDirection !== null;
|
|
1687
1816
|
if (!col.sortable) {
|
|
1688
|
-
return /* @__PURE__ */ (0,
|
|
1817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1689
1818
|
"th",
|
|
1690
1819
|
{
|
|
1691
1820
|
className: "fractal-sortable-table-th",
|
|
@@ -1696,13 +1825,13 @@ function SortableTable({
|
|
|
1696
1825
|
col.key
|
|
1697
1826
|
);
|
|
1698
1827
|
}
|
|
1699
|
-
return /* @__PURE__ */ (0,
|
|
1828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1700
1829
|
"th",
|
|
1701
1830
|
{
|
|
1702
1831
|
className: "fractal-sortable-table-th fractal-sortable-table-th--sortable",
|
|
1703
1832
|
scope: "col",
|
|
1704
1833
|
style: { width: col.width },
|
|
1705
|
-
children: /* @__PURE__ */ (0,
|
|
1834
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1706
1835
|
"button",
|
|
1707
1836
|
{
|
|
1708
1837
|
type: "button",
|
|
@@ -1713,8 +1842,8 @@ function SortableTable({
|
|
|
1713
1842
|
onClick: () => handleSortClick(col.key),
|
|
1714
1843
|
"aria-sort": isActive ? activeDirection === "asc" ? "ascending" : "descending" : "none",
|
|
1715
1844
|
children: [
|
|
1716
|
-
/* @__PURE__ */ (0,
|
|
1717
|
-
/* @__PURE__ */ (0,
|
|
1845
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: col.header }),
|
|
1846
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fractal-sortable-table-sort-icon", "aria-hidden": "true", children: isActive && activeDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_fractal_icons11.ArrowUp, { size: 14 }) : isActive && activeDirection === "desc" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_fractal_icons11.ArrowDown, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_fractal_icons11.ArrowsUpDown, { size: 14 }) })
|
|
1718
1847
|
]
|
|
1719
1848
|
}
|
|
1720
1849
|
)
|
|
@@ -1723,7 +1852,7 @@ function SortableTable({
|
|
|
1723
1852
|
);
|
|
1724
1853
|
})
|
|
1725
1854
|
] }) }),
|
|
1726
|
-
/* @__PURE__ */ (0,
|
|
1855
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("tbody", { children: visibleRows.map((row, rowIndex) => {
|
|
1727
1856
|
const highlighted = highlightRow?.(row, rowIndex) ?? false;
|
|
1728
1857
|
const disabled = isRowDisabled?.(row) ?? false;
|
|
1729
1858
|
const selectionDisabled = disabled || (isRowSelectionDisabled?.(row) ?? false);
|
|
@@ -1732,7 +1861,7 @@ function SortableTable({
|
|
|
1732
1861
|
label: rowAction.label(row, rowIndex),
|
|
1733
1862
|
icon: rowAction.icon(row, rowIndex)
|
|
1734
1863
|
} : null;
|
|
1735
|
-
return /* @__PURE__ */ (0,
|
|
1864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1736
1865
|
"tr",
|
|
1737
1866
|
{
|
|
1738
1867
|
className: cn(
|
|
@@ -1756,7 +1885,7 @@ function SortableTable({
|
|
|
1756
1885
|
role: interactive ? "button" : void 0,
|
|
1757
1886
|
tabIndex: interactive ? 0 : void 0,
|
|
1758
1887
|
children: [
|
|
1759
|
-
selection && /* @__PURE__ */ (0,
|
|
1888
|
+
selection && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("td", { className: "fractal-sortable-table-td fractal-sortable-table-selection-cell", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1760
1889
|
Checkbox,
|
|
1761
1890
|
{
|
|
1762
1891
|
"aria-label": selection.getRowLabel(row),
|
|
@@ -1768,7 +1897,7 @@ function SortableTable({
|
|
|
1768
1897
|
}
|
|
1769
1898
|
}
|
|
1770
1899
|
) }),
|
|
1771
|
-
columns.map((col, columnIndex) => /* @__PURE__ */ (0,
|
|
1900
|
+
columns.map((col, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1772
1901
|
"td",
|
|
1773
1902
|
{
|
|
1774
1903
|
className: cn(
|
|
@@ -1778,7 +1907,7 @@ function SortableTable({
|
|
|
1778
1907
|
style: { width: col.width, textAlign: col.align ?? "left" },
|
|
1779
1908
|
children: [
|
|
1780
1909
|
col.render(row, rowIndex),
|
|
1781
|
-
action && columnIndex === columns.length - 1 && /* @__PURE__ */ (0,
|
|
1910
|
+
action && columnIndex === columns.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fractal-sortable-table-row-action", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fractal-sortable-table-row-action__icon", children: action.icon }) })
|
|
1782
1911
|
]
|
|
1783
1912
|
},
|
|
1784
1913
|
col.key
|
|
@@ -1794,7 +1923,7 @@ function SortableTable({
|
|
|
1794
1923
|
|
|
1795
1924
|
// src/components/Tabs/Tabs.tsx
|
|
1796
1925
|
var import_react5 = require("react");
|
|
1797
|
-
var
|
|
1926
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1798
1927
|
function Tabs({
|
|
1799
1928
|
items,
|
|
1800
1929
|
defaultValue,
|
|
@@ -1865,8 +1994,8 @@ function Tabs({
|
|
|
1865
1994
|
selectTab(nextId2);
|
|
1866
1995
|
requestAnimationFrame(() => tabRefs.current[nextId2]?.focus());
|
|
1867
1996
|
};
|
|
1868
|
-
return /* @__PURE__ */ (0,
|
|
1869
|
-
/* @__PURE__ */ (0,
|
|
1997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: cn("fractal-tabs", `fractal-tabs--${variant}`, divider && "fractal-tabs--divider", className), children: [
|
|
1998
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1870
1999
|
"div",
|
|
1871
2000
|
{
|
|
1872
2001
|
ref: tabListRef,
|
|
@@ -1879,7 +2008,7 @@ function Tabs({
|
|
|
1879
2008
|
const isActive = item.id === activeId;
|
|
1880
2009
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
1881
2010
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
1882
|
-
return /* @__PURE__ */ (0,
|
|
2011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1883
2012
|
"button",
|
|
1884
2013
|
{
|
|
1885
2014
|
ref: (el) => {
|
|
@@ -1910,7 +2039,7 @@ function Tabs({
|
|
|
1910
2039
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
1911
2040
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
1912
2041
|
const isActive = item.id === activeId;
|
|
1913
|
-
return /* @__PURE__ */ (0,
|
|
2042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1914
2043
|
"div",
|
|
1915
2044
|
{
|
|
1916
2045
|
id: panelId,
|
|
@@ -1927,14 +2056,14 @@ function Tabs({
|
|
|
1927
2056
|
}
|
|
1928
2057
|
|
|
1929
2058
|
// src/components/ContentSwitcher/ContentSwitcher.tsx
|
|
1930
|
-
var
|
|
1931
|
-
var
|
|
2059
|
+
var React15 = __toESM(require("react"), 1);
|
|
2060
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1932
2061
|
function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = false, className }) {
|
|
1933
|
-
const switcherRef =
|
|
1934
|
-
const buttonRefs =
|
|
1935
|
-
const indicatorMotionReadyRef =
|
|
2062
|
+
const switcherRef = React15.useRef(null);
|
|
2063
|
+
const buttonRefs = React15.useRef([]);
|
|
2064
|
+
const indicatorMotionReadyRef = React15.useRef(false);
|
|
1936
2065
|
const activeIndex = items.findIndex((item) => item.value === value);
|
|
1937
|
-
|
|
2066
|
+
React15.useLayoutEffect(() => {
|
|
1938
2067
|
const switcher = switcherRef.current;
|
|
1939
2068
|
const activeButton = buttonRefs.current[activeIndex];
|
|
1940
2069
|
let motionFrame = 0;
|
|
@@ -1986,7 +2115,7 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1986
2115
|
onValueChange(items[nextIndex].value);
|
|
1987
2116
|
}
|
|
1988
2117
|
};
|
|
1989
|
-
return /* @__PURE__ */ (0,
|
|
2118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1990
2119
|
"div",
|
|
1991
2120
|
{
|
|
1992
2121
|
className: cn("fractal-content-switcher", fullWidth && "fractal-content-switcher--full-width", className),
|
|
@@ -1994,10 +2123,10 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1994
2123
|
"aria-label": ariaLabel,
|
|
1995
2124
|
ref: switcherRef,
|
|
1996
2125
|
children: [
|
|
1997
|
-
/* @__PURE__ */ (0,
|
|
2126
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fractal-content-switcher__indicator", "aria-hidden": true }),
|
|
1998
2127
|
items.map((item, index) => {
|
|
1999
2128
|
const active = item.value === value;
|
|
2000
|
-
return /* @__PURE__ */ (0,
|
|
2129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2001
2130
|
"button",
|
|
2002
2131
|
{
|
|
2003
2132
|
className: cn("fractal-content-switcher__item", active && "fractal-content-switcher__item--active"),
|
|
@@ -2030,8 +2159,8 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
2030
2159
|
|
|
2031
2160
|
// src/components/Disclosure/Disclosure.tsx
|
|
2032
2161
|
var import_react6 = require("react");
|
|
2033
|
-
var
|
|
2034
|
-
var
|
|
2162
|
+
var import_fractal_icons12 = require("@mirror-physics/fractal-icons");
|
|
2163
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2035
2164
|
function Disclosure({
|
|
2036
2165
|
title,
|
|
2037
2166
|
meta,
|
|
@@ -2059,7 +2188,7 @@ function Disclosure({
|
|
|
2059
2188
|
onOpenChange?.(next);
|
|
2060
2189
|
}
|
|
2061
2190
|
};
|
|
2062
|
-
return /* @__PURE__ */ (0,
|
|
2191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2063
2192
|
"div",
|
|
2064
2193
|
{
|
|
2065
2194
|
className: cn(
|
|
@@ -2070,7 +2199,7 @@ function Disclosure({
|
|
|
2070
2199
|
className
|
|
2071
2200
|
),
|
|
2072
2201
|
children: [
|
|
2073
|
-
/* @__PURE__ */ (0,
|
|
2202
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2074
2203
|
"button",
|
|
2075
2204
|
{
|
|
2076
2205
|
type: "button",
|
|
@@ -2081,13 +2210,13 @@ function Disclosure({
|
|
|
2081
2210
|
disabled,
|
|
2082
2211
|
onClick: toggle,
|
|
2083
2212
|
children: [
|
|
2084
|
-
/* @__PURE__ */ (0,
|
|
2085
|
-
/* @__PURE__ */ (0,
|
|
2086
|
-
meta && /* @__PURE__ */ (0,
|
|
2213
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "fractal-disclosure-icon", "aria-hidden": "true", children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_fractal_icons12.ChevronDown, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_fractal_icons12.ChevronRight, { size: 16 }) }),
|
|
2214
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "fractal-disclosure-title", children: title }),
|
|
2215
|
+
meta && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "fractal-disclosure-meta", children: meta })
|
|
2087
2216
|
]
|
|
2088
2217
|
}
|
|
2089
2218
|
),
|
|
2090
|
-
/* @__PURE__ */ (0,
|
|
2219
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2091
2220
|
"div",
|
|
2092
2221
|
{
|
|
2093
2222
|
id: panelId,
|
|
@@ -2095,7 +2224,7 @@ function Disclosure({
|
|
|
2095
2224
|
"aria-labelledby": headerId,
|
|
2096
2225
|
className: "fractal-disclosure-panel",
|
|
2097
2226
|
hidden: !isOpen,
|
|
2098
|
-
children: /* @__PURE__ */ (0,
|
|
2227
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "fractal-disclosure-panel-inner", children })
|
|
2099
2228
|
}
|
|
2100
2229
|
)
|
|
2101
2230
|
]
|
|
@@ -2104,18 +2233,18 @@ function Disclosure({
|
|
|
2104
2233
|
}
|
|
2105
2234
|
|
|
2106
2235
|
// src/components/LatticeLoader/LatticeLoader.tsx
|
|
2107
|
-
var
|
|
2236
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2108
2237
|
var LATTICE_COUNT = 160;
|
|
2109
2238
|
var WAVE_PERIOD = 80;
|
|
2110
2239
|
function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
2111
|
-
return /* @__PURE__ */ (0,
|
|
2240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2112
2241
|
"span",
|
|
2113
2242
|
{
|
|
2114
2243
|
"aria-label": label,
|
|
2115
2244
|
className: cn("fractal-lattice-loader", className),
|
|
2116
2245
|
role: "progressbar",
|
|
2117
2246
|
...props,
|
|
2118
|
-
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ (0,
|
|
2247
|
+
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2119
2248
|
"span",
|
|
2120
2249
|
{
|
|
2121
2250
|
"aria-hidden": "true",
|
|
@@ -2129,10 +2258,10 @@ function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
|
2129
2258
|
}
|
|
2130
2259
|
|
|
2131
2260
|
// src/components/Ghost/Ghost.tsx
|
|
2132
|
-
var
|
|
2261
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2133
2262
|
var toCssLength = (value) => typeof value === "number" ? `${value}px` : value;
|
|
2134
2263
|
function Ghost({ className, width, height, radius, style, ...props }) {
|
|
2135
|
-
return /* @__PURE__ */ (0,
|
|
2264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2136
2265
|
"div",
|
|
2137
2266
|
{
|
|
2138
2267
|
"aria-hidden": "true",
|
|
@@ -2148,15 +2277,15 @@ function Ghost({ className, width, height, radius, style, ...props }) {
|
|
|
2148
2277
|
);
|
|
2149
2278
|
}
|
|
2150
2279
|
function GhostLine({ className, size = "md", width = "100%", ...props }) {
|
|
2151
|
-
return /* @__PURE__ */ (0,
|
|
2280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Ghost, { className: cn("fractal-ghost-line", `fractal-ghost-line--${size}`, className), width, ...props });
|
|
2152
2281
|
}
|
|
2153
2282
|
function ButtonGhost({ className, size = "md", iconOnly = false, width, ...props }) {
|
|
2154
|
-
return /* @__PURE__ */ (0,
|
|
2283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Ghost, { className: cn("fractal-ghost-button", `fractal-ghost-button--${size}`, iconOnly && "fractal-ghost-button--icon-only", className), width, ...props });
|
|
2155
2284
|
}
|
|
2156
2285
|
function CardGhost({ className, lines = 3, showHeader = true, ...props }) {
|
|
2157
|
-
return /* @__PURE__ */ (0,
|
|
2158
|
-
showHeader && /* @__PURE__ */ (0,
|
|
2159
|
-
/* @__PURE__ */ (0,
|
|
2286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-card", className), ...props, children: [
|
|
2287
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: "38%" }),
|
|
2288
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: index === lines - 1 ? "62%" : "100%" }, index)) })
|
|
2160
2289
|
] });
|
|
2161
2290
|
}
|
|
2162
2291
|
function DataTableGhost({
|
|
@@ -2170,81 +2299,81 @@ function DataTableGhost({
|
|
|
2170
2299
|
...props
|
|
2171
2300
|
}) {
|
|
2172
2301
|
const cells = Array.from({ length: columns }, (_, index) => index);
|
|
2173
|
-
return /* @__PURE__ */ (0,
|
|
2174
|
-
(showHeader || headers) && /* @__PURE__ */ (0,
|
|
2175
|
-
/* @__PURE__ */ (0,
|
|
2302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsxs)("table", { className: "fractal-ghost-table__table", children: [
|
|
2303
|
+
(showHeader || headers) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("tr", { className: "fractal-ghost-table__head-row", children: cells.map((index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("th", { style: { width: columnWidths?.[index] }, children: headers?.[index] ?? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { size: "sm", width: index === columns - 1 ? "62%" : "76%" }) }, index)) }) }),
|
|
2304
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("tbody", { children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("tr", { className: "fractal-ghost-table__row", children: cells.map((columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("td", { style: { width: columnWidths?.[columnIndex] }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: `${[72, 54, 82, 63, 46][(rowIndex + columnIndex) % 5]}%` }) }, columnIndex)) }, rowIndex)) })
|
|
2176
2305
|
] }) });
|
|
2177
2306
|
}
|
|
2178
2307
|
function InputGhost({ className, labelWidth = "26%", ...props }) {
|
|
2179
|
-
return /* @__PURE__ */ (0,
|
|
2308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FormFieldGhost, { className, labelWidth, ...props });
|
|
2180
2309
|
}
|
|
2181
2310
|
function TextareaGhost({ className, labelWidth = "26%", ...props }) {
|
|
2182
|
-
return /* @__PURE__ */ (0,
|
|
2311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FormFieldGhost, { className, labelWidth, multiline: true, ...props });
|
|
2183
2312
|
}
|
|
2184
2313
|
function LabelGhost({ className, width = "26%", ...props }) {
|
|
2185
|
-
return /* @__PURE__ */ (0,
|
|
2314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { className: cn("fractal-ghost-label", className), size: "sm", width, ...props });
|
|
2186
2315
|
}
|
|
2187
2316
|
function FormFieldGhost({ className, labelWidth = "26%", multiline = false, ...props }) {
|
|
2188
|
-
return /* @__PURE__ */ (0,
|
|
2189
|
-
/* @__PURE__ */ (0,
|
|
2190
|
-
/* @__PURE__ */ (0,
|
|
2317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-field", className), ...props, children: [
|
|
2318
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LabelGhost, { width: labelWidth }),
|
|
2319
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Ghost, { className: cn("fractal-ghost-field__control", multiline && "fractal-ghost-field__control--multiline") })
|
|
2191
2320
|
] });
|
|
2192
2321
|
}
|
|
2193
2322
|
function AlertGhost({ className, ...props }) {
|
|
2194
|
-
return /* @__PURE__ */ (0,
|
|
2195
|
-
/* @__PURE__ */ (0,
|
|
2196
|
-
/* @__PURE__ */ (0,
|
|
2323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-alert", className), ...props, children: [
|
|
2324
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: "30%" }),
|
|
2325
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { size: "sm", width: "78%" })
|
|
2197
2326
|
] });
|
|
2198
2327
|
}
|
|
2199
2328
|
function CheckboxGhost({ className, ...props }) {
|
|
2200
|
-
return /* @__PURE__ */ (0,
|
|
2201
|
-
/* @__PURE__ */ (0,
|
|
2202
|
-
/* @__PURE__ */ (0,
|
|
2329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-choice", className), ...props, children: [
|
|
2330
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Ghost, { className: "fractal-ghost-choice__control" }),
|
|
2331
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: "42%" })
|
|
2203
2332
|
] });
|
|
2204
2333
|
}
|
|
2205
2334
|
var ToggleGhost = CheckboxGhost;
|
|
2206
2335
|
function ChipGhost({ className, width = 74, ...props }) {
|
|
2207
|
-
return /* @__PURE__ */ (0,
|
|
2336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Ghost, { className: cn("fractal-ghost-chip", className), height: 24, width, ...props });
|
|
2208
2337
|
}
|
|
2209
2338
|
function LinkGhost({ className, width = 96, ...props }) {
|
|
2210
|
-
return /* @__PURE__ */ (0,
|
|
2339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { className: cn("fractal-ghost-link", className), size: "sm", width, ...props });
|
|
2211
2340
|
}
|
|
2212
2341
|
var TextButtonGhost = LinkGhost;
|
|
2213
2342
|
function DropdownGhost({ className, ...props }) {
|
|
2214
|
-
return /* @__PURE__ */ (0,
|
|
2215
|
-
/* @__PURE__ */ (0,
|
|
2216
|
-
/* @__PURE__ */ (0,
|
|
2343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropdown", className), ...props, children: [
|
|
2344
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: "38%" }),
|
|
2345
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Ghost, { className: "fractal-ghost-dropdown__chevron" })
|
|
2217
2346
|
] });
|
|
2218
2347
|
}
|
|
2219
2348
|
function ContentSwitcherGhost({ className, options = 3, ...props }) {
|
|
2220
|
-
return /* @__PURE__ */ (0,
|
|
2349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { "aria-hidden": "true", className: cn("fractal-ghost-switcher", className), ...props, children: Array.from({ length: options }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Ghost, {}, index)) });
|
|
2221
2350
|
}
|
|
2222
2351
|
var TabsGhost = ContentSwitcherGhost;
|
|
2223
2352
|
function DisclosureGhost({ className, ...props }) {
|
|
2224
|
-
return /* @__PURE__ */ (0,
|
|
2225
|
-
/* @__PURE__ */ (0,
|
|
2226
|
-
/* @__PURE__ */ (0,
|
|
2353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-disclosure", className), ...props, children: [
|
|
2354
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Ghost, { className: "fractal-ghost-disclosure__icon" }),
|
|
2355
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: "42%" })
|
|
2227
2356
|
] });
|
|
2228
2357
|
}
|
|
2229
2358
|
function PaginationGhost({ className, pages = 5, ...props }) {
|
|
2230
|
-
return /* @__PURE__ */ (0,
|
|
2359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { "aria-hidden": "true", className: cn("fractal-ghost-pagination", className), ...props, children: Array.from({ length: pages }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Ghost, {}, index)) });
|
|
2231
2360
|
}
|
|
2232
2361
|
function FileDropzoneGhost({ className, ...props }) {
|
|
2233
|
-
return /* @__PURE__ */ (0,
|
|
2234
|
-
/* @__PURE__ */ (0,
|
|
2235
|
-
/* @__PURE__ */ (0,
|
|
2236
|
-
/* @__PURE__ */ (0,
|
|
2362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropzone", className), ...props, children: [
|
|
2363
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Ghost, { className: "fractal-ghost-dropzone__icon" }),
|
|
2364
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: "26%" }),
|
|
2365
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { size: "sm", width: "46%" })
|
|
2237
2366
|
] });
|
|
2238
2367
|
}
|
|
2239
2368
|
function PromptCardGhost({ className, ...props }) {
|
|
2240
|
-
return /* @__PURE__ */ (0,
|
|
2369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CardGhost, { className: cn("fractal-ghost-prompt-card", className), lines: 4, ...props });
|
|
2241
2370
|
}
|
|
2242
2371
|
function ConversationGhost({
|
|
2243
2372
|
className,
|
|
2244
2373
|
"aria-label": ariaLabel = "Loading conversation",
|
|
2245
2374
|
...props
|
|
2246
2375
|
}) {
|
|
2247
|
-
return /* @__PURE__ */ (0,
|
|
2376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2248
2377
|
"div",
|
|
2249
2378
|
{
|
|
2250
2379
|
"aria-busy": "true",
|
|
@@ -2253,54 +2382,54 @@ function ConversationGhost({
|
|
|
2253
2382
|
role: "status",
|
|
2254
2383
|
...props,
|
|
2255
2384
|
children: [
|
|
2256
|
-
/* @__PURE__ */ (0,
|
|
2257
|
-
/* @__PURE__ */ (0,
|
|
2258
|
-
/* @__PURE__ */ (0,
|
|
2259
|
-
/* @__PURE__ */ (0,
|
|
2385
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--user", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fractal-ghost-conversation__bubble", children: [
|
|
2386
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: "100%" }),
|
|
2387
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: "86%" }),
|
|
2388
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: "64%" })
|
|
2260
2389
|
] }) }),
|
|
2261
|
-
/* @__PURE__ */ (0,
|
|
2262
|
-
/* @__PURE__ */ (0,
|
|
2263
|
-
/* @__PURE__ */ (0,
|
|
2264
|
-
/* @__PURE__ */ (0,
|
|
2390
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--assistant", children: [
|
|
2391
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: "92%" }),
|
|
2392
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: "78%" }),
|
|
2393
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: "58%" })
|
|
2265
2394
|
] })
|
|
2266
2395
|
]
|
|
2267
2396
|
}
|
|
2268
2397
|
);
|
|
2269
2398
|
}
|
|
2270
2399
|
function SortableTableGhost(props) {
|
|
2271
|
-
return /* @__PURE__ */ (0,
|
|
2400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DataTableGhost, { ...props });
|
|
2272
2401
|
}
|
|
2273
2402
|
function SidebarGhost({ className, items = 6, ...props }) {
|
|
2274
|
-
return /* @__PURE__ */ (0,
|
|
2275
|
-
/* @__PURE__ */ (0,
|
|
2276
|
-
/* @__PURE__ */ (0,
|
|
2277
|
-
/* @__PURE__ */ (0,
|
|
2278
|
-
/* @__PURE__ */ (0,
|
|
2403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("aside", { "aria-hidden": "true", className: cn("fractal-ghost-sidebar", className), ...props, children: [
|
|
2404
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Ghost, { className: "fractal-ghost-sidebar__brand" }),
|
|
2405
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "fractal-ghost-sidebar__items", children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fractal-ghost-sidebar__item", children: [
|
|
2406
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Ghost, {}),
|
|
2407
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: `${[54, 68, 44, 61][index % 4]}%` })
|
|
2279
2408
|
] }, index)) })
|
|
2280
2409
|
] });
|
|
2281
2410
|
}
|
|
2282
2411
|
function ModalGhost({ className, title, lines = 3, ...props }) {
|
|
2283
|
-
return /* @__PURE__ */ (0,
|
|
2412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SurfaceGhost, { className: cn("fractal-ghost-modal", className), title, lines, ...props });
|
|
2284
2413
|
}
|
|
2285
2414
|
function SidePanelGhost({ className, title, lines = 5, ...props }) {
|
|
2286
|
-
return /* @__PURE__ */ (0,
|
|
2415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SurfaceGhost, { className: cn("fractal-ghost-side-panel", className), title, lines, ...props });
|
|
2287
2416
|
}
|
|
2288
2417
|
function SurfaceGhost({ className, title, lines = 3, ...props }) {
|
|
2289
|
-
return /* @__PURE__ */ (0,
|
|
2290
|
-
/* @__PURE__ */ (0,
|
|
2291
|
-
/* @__PURE__ */ (0,
|
|
2292
|
-
/* @__PURE__ */ (0,
|
|
2418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-surface", className), ...props, children: [
|
|
2419
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fractal-ghost-surface__header", children: [
|
|
2420
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: "42%" }),
|
|
2421
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Ghost, { className: "fractal-ghost-surface__close" })
|
|
2293
2422
|
] }),
|
|
2294
|
-
title && /* @__PURE__ */ (0,
|
|
2295
|
-
/* @__PURE__ */ (0,
|
|
2423
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "fractal-ghost-surface__title", children: title }),
|
|
2424
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GhostLine, { width: index === lines - 1 ? "64%" : "100%" }, index)) })
|
|
2296
2425
|
] });
|
|
2297
2426
|
}
|
|
2298
2427
|
|
|
2299
2428
|
// src/components/Sidebar/Sidebar.tsx
|
|
2300
|
-
var
|
|
2301
|
-
var
|
|
2302
|
-
var Sidebar =
|
|
2303
|
-
({ className, width, compact = false, style, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2429
|
+
var React16 = __toESM(require("react"), 1);
|
|
2430
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2431
|
+
var Sidebar = React16.forwardRef(
|
|
2432
|
+
({ className, width, compact = false, style, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2304
2433
|
"aside",
|
|
2305
2434
|
{
|
|
2306
2435
|
ref,
|
|
@@ -2312,12 +2441,12 @@ var Sidebar = React15.forwardRef(
|
|
|
2312
2441
|
)
|
|
2313
2442
|
);
|
|
2314
2443
|
Sidebar.displayName = "Sidebar";
|
|
2315
|
-
var SidebarHeader =
|
|
2316
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2444
|
+
var SidebarHeader = React16.forwardRef(
|
|
2445
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { ref, className: cn("fractal-sidebar__header", className), ...props })
|
|
2317
2446
|
);
|
|
2318
2447
|
SidebarHeader.displayName = "SidebarHeader";
|
|
2319
|
-
var SidebarBrand =
|
|
2320
|
-
({ className, type = "button", ...props }, ref) => /* @__PURE__ */ (0,
|
|
2448
|
+
var SidebarBrand = React16.forwardRef(
|
|
2449
|
+
({ className, type = "button", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { ref, type, className: cn("fractal-sidebar__brand", className), ...props })
|
|
2321
2450
|
);
|
|
2322
2451
|
SidebarBrand.displayName = "SidebarBrand";
|
|
2323
2452
|
function SidebarAccountMenu({
|
|
@@ -2328,7 +2457,7 @@ function SidebarAccountMenu({
|
|
|
2328
2457
|
icon,
|
|
2329
2458
|
className
|
|
2330
2459
|
}) {
|
|
2331
|
-
return /* @__PURE__ */ (0,
|
|
2460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2332
2461
|
Dropdown,
|
|
2333
2462
|
{
|
|
2334
2463
|
align: "left",
|
|
@@ -2338,25 +2467,25 @@ function SidebarAccountMenu({
|
|
|
2338
2467
|
panelClassName: "fractal-sidebar__account-panel",
|
|
2339
2468
|
selectedValue: "",
|
|
2340
2469
|
triggerClassName: "fractal-sidebar__account-trigger",
|
|
2341
|
-
triggerContent: /* @__PURE__ */ (0,
|
|
2342
|
-
icon && /* @__PURE__ */ (0,
|
|
2343
|
-
/* @__PURE__ */ (0,
|
|
2470
|
+
triggerContent: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
2471
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fractal-sidebar__account-icon", "aria-hidden": "true", children: icon }),
|
|
2472
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fractal-sidebar__account-name", children: name })
|
|
2344
2473
|
] }),
|
|
2345
2474
|
triggerLabel,
|
|
2346
2475
|
triggerVariant: "tertiary"
|
|
2347
2476
|
}
|
|
2348
2477
|
);
|
|
2349
2478
|
}
|
|
2350
|
-
var SidebarNav =
|
|
2351
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2479
|
+
var SidebarNav = React16.forwardRef(
|
|
2480
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("nav", { ref, className: cn("fractal-sidebar__nav", className), ...props })
|
|
2352
2481
|
);
|
|
2353
2482
|
SidebarNav.displayName = "SidebarNav";
|
|
2354
|
-
var SidebarSection =
|
|
2355
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2483
|
+
var SidebarSection = React16.forwardRef(
|
|
2484
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { ref, className: cn("fractal-sidebar__section", className), ...props })
|
|
2356
2485
|
);
|
|
2357
2486
|
SidebarSection.displayName = "SidebarSection";
|
|
2358
|
-
var SidebarNavItem =
|
|
2359
|
-
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2487
|
+
var SidebarNavItem = React16.forwardRef(
|
|
2488
|
+
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2360
2489
|
"button",
|
|
2361
2490
|
{
|
|
2362
2491
|
ref,
|
|
@@ -2366,28 +2495,28 @@ var SidebarNavItem = React15.forwardRef(
|
|
|
2366
2495
|
"aria-current": active ? "page" : void 0,
|
|
2367
2496
|
...props,
|
|
2368
2497
|
children: [
|
|
2369
|
-
icon && /* @__PURE__ */ (0,
|
|
2370
|
-
/* @__PURE__ */ (0,
|
|
2371
|
-
endAdornment && /* @__PURE__ */ (0,
|
|
2498
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fractal-sidebar__nav-item-icon", "aria-hidden": "true", children: icon }),
|
|
2499
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fractal-sidebar__nav-item-label", children }),
|
|
2500
|
+
endAdornment && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fractal-sidebar__nav-item-end", children: endAdornment })
|
|
2372
2501
|
]
|
|
2373
2502
|
}
|
|
2374
2503
|
)
|
|
2375
2504
|
);
|
|
2376
2505
|
SidebarNavItem.displayName = "SidebarNavItem";
|
|
2377
|
-
var SidebarFooter =
|
|
2378
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2506
|
+
var SidebarFooter = React16.forwardRef(
|
|
2507
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { ref, className: cn("fractal-sidebar__footer", className), ...props })
|
|
2379
2508
|
);
|
|
2380
2509
|
SidebarFooter.displayName = "SidebarFooter";
|
|
2381
2510
|
|
|
2382
2511
|
// src/components/SidePanel/SidePanel.tsx
|
|
2383
|
-
var
|
|
2384
|
-
var
|
|
2385
|
-
var
|
|
2512
|
+
var import_react_dom3 = require("react-dom");
|
|
2513
|
+
var import_fractal_icons13 = require("@mirror-physics/fractal-icons");
|
|
2514
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2386
2515
|
function SidePanel({ open, onClose, title, description, children, footer, size = "md", loading = false, loadingLabel = "Loading", className }) {
|
|
2387
2516
|
useEscapeDismiss(80, onClose, open);
|
|
2388
2517
|
if (!open) return null;
|
|
2389
|
-
return (0,
|
|
2390
|
-
/* @__PURE__ */ (0,
|
|
2518
|
+
return (0, import_react_dom3.createPortal)(
|
|
2519
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "fractal-side-panel-overlay", onMouseDown: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2391
2520
|
"aside",
|
|
2392
2521
|
{
|
|
2393
2522
|
className: cn("fractal-side-panel", `fractal-side-panel--${size}`, className),
|
|
@@ -2396,15 +2525,15 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
2396
2525
|
role: "dialog",
|
|
2397
2526
|
onMouseDown: (event) => event.stopPropagation(),
|
|
2398
2527
|
children: [
|
|
2399
|
-
/* @__PURE__ */ (0,
|
|
2400
|
-
/* @__PURE__ */ (0,
|
|
2401
|
-
typeof title === "string" ? /* @__PURE__ */ (0,
|
|
2402
|
-
description && /* @__PURE__ */ (0,
|
|
2528
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("header", { className: "fractal-side-panel__header", children: [
|
|
2529
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "fractal-side-panel__heading", children: [
|
|
2530
|
+
typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h2", { className: "fractal-side-panel__title", children: title }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "fractal-side-panel__title", children: title }),
|
|
2531
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "fractal-side-panel__description", children: description })
|
|
2403
2532
|
] }),
|
|
2404
|
-
/* @__PURE__ */ (0,
|
|
2533
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: "fractal-side-panel__close", "aria-label": "Close panel", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_fractal_icons13.Close, { size: 18 }) })
|
|
2405
2534
|
] }),
|
|
2406
|
-
/* @__PURE__ */ (0,
|
|
2407
|
-
footer && /* @__PURE__ */ (0,
|
|
2535
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.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_runtime29.jsx)(UILoader, { label: loadingLabel }) : children }),
|
|
2536
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("footer", { className: "fractal-side-panel__footer", children: footer })
|
|
2408
2537
|
]
|
|
2409
2538
|
}
|
|
2410
2539
|
) }),
|
|
@@ -2413,18 +2542,18 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
2413
2542
|
}
|
|
2414
2543
|
|
|
2415
2544
|
// src/components/Textarea/Textarea.tsx
|
|
2416
|
-
var
|
|
2417
|
-
var
|
|
2418
|
-
var Textarea =
|
|
2419
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2545
|
+
var React17 = __toESM(require("react"), 1);
|
|
2546
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2547
|
+
var Textarea = React17.forwardRef(
|
|
2548
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("textarea", { ref, className: cn("fractal-textarea", className), ...props })
|
|
2420
2549
|
);
|
|
2421
2550
|
Textarea.displayName = "Textarea";
|
|
2422
2551
|
|
|
2423
2552
|
// src/components/TextButton/TextButton.tsx
|
|
2424
|
-
var
|
|
2425
|
-
var
|
|
2426
|
-
var TextButton =
|
|
2427
|
-
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2553
|
+
var React18 = __toESM(require("react"), 1);
|
|
2554
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2555
|
+
var TextButton = React18.forwardRef(
|
|
2556
|
+
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
2428
2557
|
"button",
|
|
2429
2558
|
{
|
|
2430
2559
|
ref,
|
|
@@ -2432,9 +2561,9 @@ var TextButton = React17.forwardRef(
|
|
|
2432
2561
|
type: "button",
|
|
2433
2562
|
...props,
|
|
2434
2563
|
children: [
|
|
2435
|
-
icon && iconPosition === "start" && /* @__PURE__ */ (0,
|
|
2436
|
-
/* @__PURE__ */ (0,
|
|
2437
|
-
icon && iconPosition === "end" && /* @__PURE__ */ (0,
|
|
2564
|
+
icon && iconPosition === "start" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon }),
|
|
2565
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children }),
|
|
2566
|
+
icon && iconPosition === "end" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon })
|
|
2438
2567
|
]
|
|
2439
2568
|
}
|
|
2440
2569
|
)
|
|
@@ -2442,9 +2571,9 @@ var TextButton = React17.forwardRef(
|
|
|
2442
2571
|
TextButton.displayName = "TextButton";
|
|
2443
2572
|
|
|
2444
2573
|
// src/components/FileDropzone/FileDropzone.tsx
|
|
2445
|
-
var
|
|
2446
|
-
var
|
|
2447
|
-
var
|
|
2574
|
+
var React19 = __toESM(require("react"), 1);
|
|
2575
|
+
var import_fractal_icons14 = require("@mirror-physics/fractal-icons");
|
|
2576
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2448
2577
|
function FileDropzone({
|
|
2449
2578
|
files,
|
|
2450
2579
|
onFilesChange,
|
|
@@ -2455,17 +2584,17 @@ function FileDropzone({
|
|
|
2455
2584
|
description = "Files stay attached to this record.",
|
|
2456
2585
|
className
|
|
2457
2586
|
}) {
|
|
2458
|
-
const inputId =
|
|
2459
|
-
const inputRef =
|
|
2460
|
-
const [isDragging, setIsDragging] =
|
|
2587
|
+
const inputId = React19.useId();
|
|
2588
|
+
const inputRef = React19.useRef(null);
|
|
2589
|
+
const [isDragging, setIsDragging] = React19.useState(false);
|
|
2461
2590
|
const addFiles = (nextFiles) => {
|
|
2462
2591
|
if (disabled) return;
|
|
2463
2592
|
const additions = Array.from(nextFiles);
|
|
2464
2593
|
if (additions.length === 0) return;
|
|
2465
2594
|
onFilesChange(multiple ? [...files, ...additions] : additions.slice(0, 1));
|
|
2466
2595
|
};
|
|
2467
|
-
return /* @__PURE__ */ (0,
|
|
2468
|
-
/* @__PURE__ */ (0,
|
|
2596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: cn("fractal-file-dropzone", className), children: [
|
|
2597
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2469
2598
|
"input",
|
|
2470
2599
|
{
|
|
2471
2600
|
ref: inputRef,
|
|
@@ -2481,7 +2610,7 @@ function FileDropzone({
|
|
|
2481
2610
|
}
|
|
2482
2611
|
}
|
|
2483
2612
|
),
|
|
2484
|
-
/* @__PURE__ */ (0,
|
|
2613
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2485
2614
|
"button",
|
|
2486
2615
|
{
|
|
2487
2616
|
className: "fractal-file-dropzone__target",
|
|
@@ -2504,18 +2633,18 @@ function FileDropzone({
|
|
|
2504
2633
|
addFiles(event.dataTransfer.files);
|
|
2505
2634
|
},
|
|
2506
2635
|
children: [
|
|
2507
|
-
/* @__PURE__ */ (0,
|
|
2508
|
-
/* @__PURE__ */ (0,
|
|
2509
|
-
/* @__PURE__ */ (0,
|
|
2510
|
-
description && /* @__PURE__ */ (0,
|
|
2636
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_fractal_icons14.FileArrowUp, { "aria-hidden": "true", size: 20 }),
|
|
2637
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "fractal-file-dropzone__copy", children: [
|
|
2638
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "fractal-file-dropzone__title", children: title }),
|
|
2639
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "fractal-file-dropzone__description", children: description })
|
|
2511
2640
|
] })
|
|
2512
2641
|
]
|
|
2513
2642
|
}
|
|
2514
2643
|
),
|
|
2515
|
-
files.length > 0 && /* @__PURE__ */ (0,
|
|
2516
|
-
/* @__PURE__ */ (0,
|
|
2517
|
-
/* @__PURE__ */ (0,
|
|
2518
|
-
/* @__PURE__ */ (0,
|
|
2644
|
+
files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("ul", { className: "fractal-file-dropzone__files", "aria-label": "Attached files", children: files.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("li", { className: "fractal-file-dropzone__file", children: [
|
|
2645
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "fractal-file-dropzone__file-name", children: file.name }),
|
|
2646
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "fractal-file-dropzone__file-meta", children: formatFileSize(file.size) }),
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2519
2648
|
"button",
|
|
2520
2649
|
{
|
|
2521
2650
|
className: "fractal-file-dropzone__remove",
|
|
@@ -2523,7 +2652,7 @@ function FileDropzone({
|
|
|
2523
2652
|
"aria-label": `Remove ${file.name}`,
|
|
2524
2653
|
disabled,
|
|
2525
2654
|
onClick: () => onFilesChange(files.filter((_, fileIndex) => fileIndex !== index)),
|
|
2526
|
-
children: /* @__PURE__ */ (0,
|
|
2655
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_fractal_icons14.Close, { "aria-hidden": "true", size: 14 })
|
|
2527
2656
|
}
|
|
2528
2657
|
)
|
|
2529
2658
|
] }, `${file.name}-${file.size}-${index}`)) })
|
|
@@ -2536,8 +2665,8 @@ function formatFileSize(bytes) {
|
|
|
2536
2665
|
}
|
|
2537
2666
|
|
|
2538
2667
|
// src/components/Pagination/Pagination.tsx
|
|
2539
|
-
var
|
|
2540
|
-
var
|
|
2668
|
+
var import_fractal_icons15 = require("@mirror-physics/fractal-icons");
|
|
2669
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2541
2670
|
function Pagination({
|
|
2542
2671
|
page,
|
|
2543
2672
|
pageSize,
|
|
@@ -2553,10 +2682,10 @@ function Pagination({
|
|
|
2553
2682
|
const start = totalItems === 0 ? 0 : (currentPage - 1) * pageSize + 1;
|
|
2554
2683
|
const end = Math.min(currentPage * pageSize, totalItems);
|
|
2555
2684
|
const canChangePageSize = pageSizeOptions != null && pageSizeOptions.length > 0 && onPageSizeChange != null;
|
|
2556
|
-
return /* @__PURE__ */ (0,
|
|
2557
|
-
/* @__PURE__ */ (0,
|
|
2558
|
-
/* @__PURE__ */ (0,
|
|
2559
|
-
canChangePageSize && /* @__PURE__ */ (0,
|
|
2685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("nav", { className: cn("fractal-pagination", className), "aria-label": ariaLabel, children: [
|
|
2686
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "fractal-pagination__summary", children: totalItems === 0 ? "No results" : `${start}-${end} of ${totalItems}` }),
|
|
2687
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "fractal-pagination__controls", children: [
|
|
2688
|
+
canChangePageSize && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2560
2689
|
Dropdown,
|
|
2561
2690
|
{
|
|
2562
2691
|
align: "right",
|
|
@@ -2573,7 +2702,7 @@ function Pagination({
|
|
|
2573
2702
|
triggerVariant: "tertiary"
|
|
2574
2703
|
}
|
|
2575
2704
|
),
|
|
2576
|
-
/* @__PURE__ */ (0,
|
|
2705
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2577
2706
|
"button",
|
|
2578
2707
|
{
|
|
2579
2708
|
className: "fractal-pagination__button",
|
|
@@ -2582,15 +2711,15 @@ function Pagination({
|
|
|
2582
2711
|
title: "Previous page",
|
|
2583
2712
|
disabled: currentPage === 1 || totalItems === 0,
|
|
2584
2713
|
onClick: () => onPageChange(currentPage - 1),
|
|
2585
|
-
children: /* @__PURE__ */ (0,
|
|
2714
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_fractal_icons15.ArrowLeft, { "aria-hidden": "true", size: 16 })
|
|
2586
2715
|
}
|
|
2587
2716
|
),
|
|
2588
|
-
/* @__PURE__ */ (0,
|
|
2717
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "fractal-pagination__page", "aria-current": "page", children: [
|
|
2589
2718
|
currentPage,
|
|
2590
2719
|
" of ",
|
|
2591
2720
|
totalPages
|
|
2592
2721
|
] }),
|
|
2593
|
-
/* @__PURE__ */ (0,
|
|
2722
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2594
2723
|
"button",
|
|
2595
2724
|
{
|
|
2596
2725
|
className: "fractal-pagination__button",
|
|
@@ -2599,7 +2728,7 @@ function Pagination({
|
|
|
2599
2728
|
title: "Next page",
|
|
2600
2729
|
disabled: currentPage === totalPages || totalItems === 0,
|
|
2601
2730
|
onClick: () => onPageChange(currentPage + 1),
|
|
2602
|
-
children: /* @__PURE__ */ (0,
|
|
2731
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_fractal_icons15.ArrowRight, { "aria-hidden": "true", size: 16 })
|
|
2603
2732
|
}
|
|
2604
2733
|
)
|
|
2605
2734
|
] })
|
|
@@ -2678,6 +2807,8 @@ function Pagination({
|
|
|
2678
2807
|
TextButtonGhost,
|
|
2679
2808
|
Textarea,
|
|
2680
2809
|
TextareaGhost,
|
|
2810
|
+
Toast,
|
|
2811
|
+
ToastViewport,
|
|
2681
2812
|
Toggle,
|
|
2682
2813
|
ToggleGhost,
|
|
2683
2814
|
UILoader,
|