@mirror-physics/fractal-ui 0.2.0-next.14 → 0.2.0-next.15

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 CHANGED
@@ -51,6 +51,7 @@ __export(index_exports, {
51
51
  FolderCard: () => FolderCard,
52
52
  Input: () => Input,
53
53
  Label: () => Label,
54
+ LatticeLoader: () => LatticeLoader,
54
55
  Link: () => Link,
55
56
  Modal: () => Modal,
56
57
  Pagination: () => Pagination,
@@ -1148,11 +1149,35 @@ function Disclosure({
1148
1149
  );
1149
1150
  }
1150
1151
 
1152
+ // src/components/LatticeLoader/LatticeLoader.tsx
1153
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1154
+ var LATTICE_COUNT = 48;
1155
+ function LatticeLoader({ className, label = "Loading", ...props }) {
1156
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1157
+ "span",
1158
+ {
1159
+ "aria-label": label,
1160
+ className: cn("fractal-lattice-loader", className),
1161
+ role: "progressbar",
1162
+ ...props,
1163
+ children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1164
+ "span",
1165
+ {
1166
+ "aria-hidden": "true",
1167
+ className: "fractal-lattice-loader__cell",
1168
+ style: { "--fractal-lattice-index": index }
1169
+ },
1170
+ index
1171
+ ))
1172
+ }
1173
+ );
1174
+ }
1175
+
1151
1176
  // src/components/Sidebar/Sidebar.tsx
1152
1177
  var React11 = __toESM(require("react"), 1);
1153
- var import_jsx_runtime18 = require("react/jsx-runtime");
1178
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1154
1179
  var Sidebar = React11.forwardRef(
1155
- ({ className, width, style, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1180
+ ({ className, width, style, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1156
1181
  "aside",
1157
1182
  {
1158
1183
  ref,
@@ -1164,23 +1189,23 @@ var Sidebar = React11.forwardRef(
1164
1189
  );
1165
1190
  Sidebar.displayName = "Sidebar";
1166
1191
  var SidebarHeader = React11.forwardRef(
1167
- ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref, className: cn("fractal-sidebar__header", className), ...props })
1192
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref, className: cn("fractal-sidebar__header", className), ...props })
1168
1193
  );
1169
1194
  SidebarHeader.displayName = "SidebarHeader";
1170
1195
  var SidebarBrand = React11.forwardRef(
1171
- ({ className, type = "button", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { ref, type, className: cn("fractal-sidebar__brand", className), ...props })
1196
+ ({ className, type = "button", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { ref, type, className: cn("fractal-sidebar__brand", className), ...props })
1172
1197
  );
1173
1198
  SidebarBrand.displayName = "SidebarBrand";
1174
1199
  var SidebarNav = React11.forwardRef(
1175
- ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("nav", { ref, className: cn("fractal-sidebar__nav", className), ...props })
1200
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("nav", { ref, className: cn("fractal-sidebar__nav", className), ...props })
1176
1201
  );
1177
1202
  SidebarNav.displayName = "SidebarNav";
1178
1203
  var SidebarSection = React11.forwardRef(
1179
- ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref, className: cn("fractal-sidebar__section", className), ...props })
1204
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref, className: cn("fractal-sidebar__section", className), ...props })
1180
1205
  );
1181
1206
  SidebarSection.displayName = "SidebarSection";
1182
1207
  var SidebarNavItem = React11.forwardRef(
1183
- ({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1208
+ ({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1184
1209
  "button",
1185
1210
  {
1186
1211
  ref,
@@ -1190,28 +1215,28 @@ var SidebarNavItem = React11.forwardRef(
1190
1215
  "aria-current": active ? "page" : void 0,
1191
1216
  ...props,
1192
1217
  children: [
1193
- icon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fractal-sidebar__nav-item-icon", "aria-hidden": "true", children: icon }),
1194
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fractal-sidebar__nav-item-label", children }),
1195
- endAdornment && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fractal-sidebar__nav-item-end", children: endAdornment })
1218
+ icon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "fractal-sidebar__nav-item-icon", "aria-hidden": "true", children: icon }),
1219
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "fractal-sidebar__nav-item-label", children }),
1220
+ endAdornment && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "fractal-sidebar__nav-item-end", children: endAdornment })
1196
1221
  ]
1197
1222
  }
1198
1223
  )
1199
1224
  );
1200
1225
  SidebarNavItem.displayName = "SidebarNavItem";
1201
1226
  var SidebarFooter = React11.forwardRef(
1202
- ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref, className: cn("fractal-sidebar__footer", className), ...props })
1227
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref, className: cn("fractal-sidebar__footer", className), ...props })
1203
1228
  );
1204
1229
  SidebarFooter.displayName = "SidebarFooter";
1205
1230
 
1206
1231
  // src/components/SidePanel/SidePanel.tsx
1207
1232
  var import_react_dom2 = require("react-dom");
1208
1233
  var import_fractal_icons6 = require("@mirror-physics/fractal-icons");
1209
- var import_jsx_runtime19 = require("react/jsx-runtime");
1234
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1210
1235
  function SidePanel({ open, onClose, title, description, children, footer, size = "md", className }) {
1211
1236
  useEscapeDismiss(80, onClose, open);
1212
1237
  if (!open) return null;
1213
1238
  return (0, import_react_dom2.createPortal)(
1214
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "fractal-side-panel-overlay", onMouseDown: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1239
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "fractal-side-panel-overlay", onMouseDown: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
1215
1240
  "aside",
1216
1241
  {
1217
1242
  className: cn("fractal-side-panel", `fractal-side-panel--${size}`, className),
@@ -1220,15 +1245,15 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
1220
1245
  role: "dialog",
1221
1246
  onMouseDown: (event) => event.stopPropagation(),
1222
1247
  children: [
1223
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("header", { className: "fractal-side-panel__header", children: [
1224
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "fractal-side-panel__heading", children: [
1225
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { className: "fractal-side-panel__title", children: title }),
1226
- description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "fractal-side-panel__description", children: description })
1248
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("header", { className: "fractal-side-panel__header", children: [
1249
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "fractal-side-panel__heading", children: [
1250
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h2", { className: "fractal-side-panel__title", children: title }),
1251
+ description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "fractal-side-panel__description", children: description })
1227
1252
  ] }),
1228
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: "fractal-side-panel__close", "aria-label": "Close panel", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fractal_icons6.Close, { size: 18 }) })
1253
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: "fractal-side-panel__close", "aria-label": "Close panel", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_fractal_icons6.Close, { size: 18 }) })
1229
1254
  ] }),
1230
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "fractal-side-panel__body", children }),
1231
- footer && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("footer", { className: "fractal-side-panel__footer", children: footer })
1255
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "fractal-side-panel__body", children }),
1256
+ footer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("footer", { className: "fractal-side-panel__footer", children: footer })
1232
1257
  ]
1233
1258
  }
1234
1259
  ) }),
@@ -1238,17 +1263,17 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
1238
1263
 
1239
1264
  // src/components/Textarea/Textarea.tsx
1240
1265
  var React12 = __toESM(require("react"), 1);
1241
- var import_jsx_runtime20 = require("react/jsx-runtime");
1266
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1242
1267
  var Textarea = React12.forwardRef(
1243
- ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("textarea", { ref, className: cn("fractal-textarea", className), ...props })
1268
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("textarea", { ref, className: cn("fractal-textarea", className), ...props })
1244
1269
  );
1245
1270
  Textarea.displayName = "Textarea";
1246
1271
 
1247
1272
  // src/components/TextButton/TextButton.tsx
1248
1273
  var React13 = __toESM(require("react"), 1);
1249
- var import_jsx_runtime21 = require("react/jsx-runtime");
1274
+ var import_jsx_runtime22 = require("react/jsx-runtime");
1250
1275
  var TextButton = React13.forwardRef(
1251
- ({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1276
+ ({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
1252
1277
  "button",
1253
1278
  {
1254
1279
  ref,
@@ -1256,9 +1281,9 @@ var TextButton = React13.forwardRef(
1256
1281
  type: "button",
1257
1282
  ...props,
1258
1283
  children: [
1259
- icon && iconPosition === "start" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon }),
1260
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children }),
1261
- icon && iconPosition === "end" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon })
1284
+ icon && iconPosition === "start" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon }),
1285
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children }),
1286
+ icon && iconPosition === "end" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon })
1262
1287
  ]
1263
1288
  }
1264
1289
  )
@@ -1268,7 +1293,7 @@ TextButton.displayName = "TextButton";
1268
1293
  // src/components/FileDropzone/FileDropzone.tsx
1269
1294
  var React14 = __toESM(require("react"), 1);
1270
1295
  var import_fractal_icons7 = require("@mirror-physics/fractal-icons");
1271
- var import_jsx_runtime22 = require("react/jsx-runtime");
1296
+ var import_jsx_runtime23 = require("react/jsx-runtime");
1272
1297
  function FileDropzone({
1273
1298
  files,
1274
1299
  onFilesChange,
@@ -1288,8 +1313,8 @@ function FileDropzone({
1288
1313
  if (additions.length === 0) return;
1289
1314
  onFilesChange(multiple ? [...files, ...additions] : additions.slice(0, 1));
1290
1315
  };
1291
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cn("fractal-file-dropzone", className), children: [
1292
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1316
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: cn("fractal-file-dropzone", className), children: [
1317
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1293
1318
  "input",
1294
1319
  {
1295
1320
  ref: inputRef,
@@ -1305,7 +1330,7 @@ function FileDropzone({
1305
1330
  }
1306
1331
  }
1307
1332
  ),
1308
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
1333
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1309
1334
  "button",
1310
1335
  {
1311
1336
  className: "fractal-file-dropzone__target",
@@ -1328,18 +1353,18 @@ function FileDropzone({
1328
1353
  addFiles(event.dataTransfer.files);
1329
1354
  },
1330
1355
  children: [
1331
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_fractal_icons7.FileArrowUp, { "aria-hidden": "true", size: 20 }),
1332
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "fractal-file-dropzone__copy", children: [
1333
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fractal-file-dropzone__title", children: title }),
1334
- description && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fractal-file-dropzone__description", children: description })
1356
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fractal_icons7.FileArrowUp, { "aria-hidden": "true", size: 20 }),
1357
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "fractal-file-dropzone__copy", children: [
1358
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "fractal-file-dropzone__title", children: title }),
1359
+ description && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "fractal-file-dropzone__description", children: description })
1335
1360
  ] })
1336
1361
  ]
1337
1362
  }
1338
1363
  ),
1339
- files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ul", { className: "fractal-file-dropzone__files", "aria-label": "Attached files", children: files.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("li", { className: "fractal-file-dropzone__file", children: [
1340
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fractal-file-dropzone__file-name", children: file.name }),
1341
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fractal-file-dropzone__file-meta", children: formatFileSize(file.size) }),
1342
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1364
+ files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ul", { className: "fractal-file-dropzone__files", "aria-label": "Attached files", children: files.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("li", { className: "fractal-file-dropzone__file", children: [
1365
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "fractal-file-dropzone__file-name", children: file.name }),
1366
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "fractal-file-dropzone__file-meta", children: formatFileSize(file.size) }),
1367
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1343
1368
  "button",
1344
1369
  {
1345
1370
  className: "fractal-file-dropzone__remove",
@@ -1347,7 +1372,7 @@ function FileDropzone({
1347
1372
  "aria-label": `Remove ${file.name}`,
1348
1373
  disabled,
1349
1374
  onClick: () => onFilesChange(files.filter((_, fileIndex) => fileIndex !== index)),
1350
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_fractal_icons7.Close, { "aria-hidden": "true", size: 14 })
1375
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fractal_icons7.Close, { "aria-hidden": "true", size: 14 })
1351
1376
  }
1352
1377
  )
1353
1378
  ] }, `${file.name}-${file.size}-${index}`)) })
@@ -1361,7 +1386,7 @@ function formatFileSize(bytes) {
1361
1386
 
1362
1387
  // src/components/Pagination/Pagination.tsx
1363
1388
  var import_fractal_icons8 = require("@mirror-physics/fractal-icons");
1364
- var import_jsx_runtime23 = require("react/jsx-runtime");
1389
+ var import_jsx_runtime24 = require("react/jsx-runtime");
1365
1390
  function Pagination({
1366
1391
  page,
1367
1392
  pageSize,
@@ -1377,10 +1402,10 @@ function Pagination({
1377
1402
  const start = totalItems === 0 ? 0 : (currentPage - 1) * pageSize + 1;
1378
1403
  const end = Math.min(currentPage * pageSize, totalItems);
1379
1404
  const canChangePageSize = pageSizeOptions != null && pageSizeOptions.length > 0 && onPageSizeChange != null;
1380
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("nav", { className: cn("fractal-pagination", className), "aria-label": ariaLabel, children: [
1381
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "fractal-pagination__summary", children: totalItems === 0 ? "No results" : `${start}-${end} of ${totalItems}` }),
1382
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "fractal-pagination__controls", children: [
1383
- canChangePageSize && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1405
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("nav", { className: cn("fractal-pagination", className), "aria-label": ariaLabel, children: [
1406
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fractal-pagination__summary", children: totalItems === 0 ? "No results" : `${start}-${end} of ${totalItems}` }),
1407
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fractal-pagination__controls", children: [
1408
+ canChangePageSize && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1384
1409
  Dropdown,
1385
1410
  {
1386
1411
  align: "right",
@@ -1397,7 +1422,7 @@ function Pagination({
1397
1422
  triggerVariant: "tertiary"
1398
1423
  }
1399
1424
  ),
1400
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1425
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1401
1426
  "button",
1402
1427
  {
1403
1428
  className: "fractal-pagination__button",
@@ -1406,15 +1431,15 @@ function Pagination({
1406
1431
  title: "Previous page",
1407
1432
  disabled: currentPage === 1 || totalItems === 0,
1408
1433
  onClick: () => onPageChange(currentPage - 1),
1409
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fractal_icons8.ArrowLeft, { "aria-hidden": "true", size: 16 })
1434
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_fractal_icons8.ArrowLeft, { "aria-hidden": "true", size: 16 })
1410
1435
  }
1411
1436
  ),
1412
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "fractal-pagination__page", "aria-current": "page", children: [
1437
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "fractal-pagination__page", "aria-current": "page", children: [
1413
1438
  currentPage,
1414
1439
  " of ",
1415
1440
  totalPages
1416
1441
  ] }),
1417
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1442
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1418
1443
  "button",
1419
1444
  {
1420
1445
  className: "fractal-pagination__button",
@@ -1423,7 +1448,7 @@ function Pagination({
1423
1448
  title: "Next page",
1424
1449
  disabled: currentPage === totalPages || totalItems === 0,
1425
1450
  onClick: () => onPageChange(currentPage + 1),
1426
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fractal_icons8.ArrowRight, { "aria-hidden": "true", size: 16 })
1451
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_fractal_icons8.ArrowRight, { "aria-hidden": "true", size: 16 })
1427
1452
  }
1428
1453
  )
1429
1454
  ] })
@@ -1452,6 +1477,7 @@ function Pagination({
1452
1477
  FolderCard,
1453
1478
  Input,
1454
1479
  Label,
1480
+ LatticeLoader,
1455
1481
  Link,
1456
1482
  Modal,
1457
1483
  Pagination,