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

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.js CHANGED
@@ -1072,11 +1072,35 @@ function Disclosure({
1072
1072
  );
1073
1073
  }
1074
1074
 
1075
+ // src/components/LatticeLoader/LatticeLoader.tsx
1076
+ import { jsx as jsx17 } from "react/jsx-runtime";
1077
+ var LATTICE_COUNT = 48;
1078
+ function LatticeLoader({ className, label = "Loading", ...props }) {
1079
+ return /* @__PURE__ */ jsx17(
1080
+ "span",
1081
+ {
1082
+ "aria-label": label,
1083
+ className: cn("fractal-lattice-loader", className),
1084
+ role: "progressbar",
1085
+ ...props,
1086
+ children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ jsx17(
1087
+ "span",
1088
+ {
1089
+ "aria-hidden": "true",
1090
+ className: "fractal-lattice-loader__cell",
1091
+ style: { "--fractal-lattice-index": index }
1092
+ },
1093
+ index
1094
+ ))
1095
+ }
1096
+ );
1097
+ }
1098
+
1075
1099
  // src/components/Sidebar/Sidebar.tsx
1076
1100
  import * as React11 from "react";
1077
- import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
1101
+ import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
1078
1102
  var Sidebar = React11.forwardRef(
1079
- ({ className, width, style, ...props }, ref) => /* @__PURE__ */ jsx17(
1103
+ ({ className, width, style, ...props }, ref) => /* @__PURE__ */ jsx18(
1080
1104
  "aside",
1081
1105
  {
1082
1106
  ref,
@@ -1088,19 +1112,19 @@ var Sidebar = React11.forwardRef(
1088
1112
  );
1089
1113
  Sidebar.displayName = "Sidebar";
1090
1114
  var SidebarHeader = React11.forwardRef(
1091
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx17("div", { ref, className: cn("fractal-sidebar__header", className), ...props })
1115
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx18("div", { ref, className: cn("fractal-sidebar__header", className), ...props })
1092
1116
  );
1093
1117
  SidebarHeader.displayName = "SidebarHeader";
1094
1118
  var SidebarBrand = React11.forwardRef(
1095
- ({ className, type = "button", ...props }, ref) => /* @__PURE__ */ jsx17("button", { ref, type, className: cn("fractal-sidebar__brand", className), ...props })
1119
+ ({ className, type = "button", ...props }, ref) => /* @__PURE__ */ jsx18("button", { ref, type, className: cn("fractal-sidebar__brand", className), ...props })
1096
1120
  );
1097
1121
  SidebarBrand.displayName = "SidebarBrand";
1098
1122
  var SidebarNav = React11.forwardRef(
1099
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx17("nav", { ref, className: cn("fractal-sidebar__nav", className), ...props })
1123
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx18("nav", { ref, className: cn("fractal-sidebar__nav", className), ...props })
1100
1124
  );
1101
1125
  SidebarNav.displayName = "SidebarNav";
1102
1126
  var SidebarSection = React11.forwardRef(
1103
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx17("div", { ref, className: cn("fractal-sidebar__section", className), ...props })
1127
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx18("div", { ref, className: cn("fractal-sidebar__section", className), ...props })
1104
1128
  );
1105
1129
  SidebarSection.displayName = "SidebarSection";
1106
1130
  var SidebarNavItem = React11.forwardRef(
@@ -1114,28 +1138,28 @@ var SidebarNavItem = React11.forwardRef(
1114
1138
  "aria-current": active ? "page" : void 0,
1115
1139
  ...props,
1116
1140
  children: [
1117
- icon && /* @__PURE__ */ jsx17("span", { className: "fractal-sidebar__nav-item-icon", "aria-hidden": "true", children: icon }),
1118
- /* @__PURE__ */ jsx17("span", { className: "fractal-sidebar__nav-item-label", children }),
1119
- endAdornment && /* @__PURE__ */ jsx17("span", { className: "fractal-sidebar__nav-item-end", children: endAdornment })
1141
+ icon && /* @__PURE__ */ jsx18("span", { className: "fractal-sidebar__nav-item-icon", "aria-hidden": "true", children: icon }),
1142
+ /* @__PURE__ */ jsx18("span", { className: "fractal-sidebar__nav-item-label", children }),
1143
+ endAdornment && /* @__PURE__ */ jsx18("span", { className: "fractal-sidebar__nav-item-end", children: endAdornment })
1120
1144
  ]
1121
1145
  }
1122
1146
  )
1123
1147
  );
1124
1148
  SidebarNavItem.displayName = "SidebarNavItem";
1125
1149
  var SidebarFooter = React11.forwardRef(
1126
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx17("div", { ref, className: cn("fractal-sidebar__footer", className), ...props })
1150
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx18("div", { ref, className: cn("fractal-sidebar__footer", className), ...props })
1127
1151
  );
1128
1152
  SidebarFooter.displayName = "SidebarFooter";
1129
1153
 
1130
1154
  // src/components/SidePanel/SidePanel.tsx
1131
1155
  import { createPortal as createPortal2 } from "react-dom";
1132
1156
  import { Close } from "@mirror-physics/fractal-icons";
1133
- import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
1157
+ import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
1134
1158
  function SidePanel({ open, onClose, title, description, children, footer, size = "md", className }) {
1135
1159
  useEscapeDismiss(80, onClose, open);
1136
1160
  if (!open) return null;
1137
1161
  return createPortal2(
1138
- /* @__PURE__ */ jsx18("div", { className: "fractal-side-panel-overlay", onMouseDown: onClose, children: /* @__PURE__ */ jsxs13(
1162
+ /* @__PURE__ */ jsx19("div", { className: "fractal-side-panel-overlay", onMouseDown: onClose, children: /* @__PURE__ */ jsxs13(
1139
1163
  "aside",
1140
1164
  {
1141
1165
  className: cn("fractal-side-panel", `fractal-side-panel--${size}`, className),
@@ -1146,13 +1170,13 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
1146
1170
  children: [
1147
1171
  /* @__PURE__ */ jsxs13("header", { className: "fractal-side-panel__header", children: [
1148
1172
  /* @__PURE__ */ jsxs13("div", { className: "fractal-side-panel__heading", children: [
1149
- /* @__PURE__ */ jsx18("h2", { className: "fractal-side-panel__title", children: title }),
1150
- description && /* @__PURE__ */ jsx18("p", { className: "fractal-side-panel__description", children: description })
1173
+ /* @__PURE__ */ jsx19("h2", { className: "fractal-side-panel__title", children: title }),
1174
+ description && /* @__PURE__ */ jsx19("p", { className: "fractal-side-panel__description", children: description })
1151
1175
  ] }),
1152
- /* @__PURE__ */ jsx18("button", { type: "button", className: "fractal-side-panel__close", "aria-label": "Close panel", onClick: onClose, children: /* @__PURE__ */ jsx18(Close, { size: 18 }) })
1176
+ /* @__PURE__ */ jsx19("button", { type: "button", className: "fractal-side-panel__close", "aria-label": "Close panel", onClick: onClose, children: /* @__PURE__ */ jsx19(Close, { size: 18 }) })
1153
1177
  ] }),
1154
- /* @__PURE__ */ jsx18("div", { className: "fractal-side-panel__body", children }),
1155
- footer && /* @__PURE__ */ jsx18("footer", { className: "fractal-side-panel__footer", children: footer })
1178
+ /* @__PURE__ */ jsx19("div", { className: "fractal-side-panel__body", children }),
1179
+ footer && /* @__PURE__ */ jsx19("footer", { className: "fractal-side-panel__footer", children: footer })
1156
1180
  ]
1157
1181
  }
1158
1182
  ) }),
@@ -1162,15 +1186,15 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
1162
1186
 
1163
1187
  // src/components/Textarea/Textarea.tsx
1164
1188
  import * as React12 from "react";
1165
- import { jsx as jsx19 } from "react/jsx-runtime";
1189
+ import { jsx as jsx20 } from "react/jsx-runtime";
1166
1190
  var Textarea = React12.forwardRef(
1167
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx19("textarea", { ref, className: cn("fractal-textarea", className), ...props })
1191
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx20("textarea", { ref, className: cn("fractal-textarea", className), ...props })
1168
1192
  );
1169
1193
  Textarea.displayName = "Textarea";
1170
1194
 
1171
1195
  // src/components/TextButton/TextButton.tsx
1172
1196
  import * as React13 from "react";
1173
- import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
1197
+ import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
1174
1198
  var TextButton = React13.forwardRef(
1175
1199
  ({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ jsxs14(
1176
1200
  "button",
@@ -1180,9 +1204,9 @@ var TextButton = React13.forwardRef(
1180
1204
  type: "button",
1181
1205
  ...props,
1182
1206
  children: [
1183
- icon && iconPosition === "start" && /* @__PURE__ */ jsx20("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon }),
1184
- /* @__PURE__ */ jsx20("span", { children }),
1185
- icon && iconPosition === "end" && /* @__PURE__ */ jsx20("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon })
1207
+ icon && iconPosition === "start" && /* @__PURE__ */ jsx21("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon }),
1208
+ /* @__PURE__ */ jsx21("span", { children }),
1209
+ icon && iconPosition === "end" && /* @__PURE__ */ jsx21("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon })
1186
1210
  ]
1187
1211
  }
1188
1212
  )
@@ -1192,7 +1216,7 @@ TextButton.displayName = "TextButton";
1192
1216
  // src/components/FileDropzone/FileDropzone.tsx
1193
1217
  import * as React14 from "react";
1194
1218
  import { Close as Close2, FileArrowUp } from "@mirror-physics/fractal-icons";
1195
- import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
1219
+ import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
1196
1220
  function FileDropzone({
1197
1221
  files,
1198
1222
  onFilesChange,
@@ -1213,7 +1237,7 @@ function FileDropzone({
1213
1237
  onFilesChange(multiple ? [...files, ...additions] : additions.slice(0, 1));
1214
1238
  };
1215
1239
  return /* @__PURE__ */ jsxs15("div", { className: cn("fractal-file-dropzone", className), children: [
1216
- /* @__PURE__ */ jsx21(
1240
+ /* @__PURE__ */ jsx22(
1217
1241
  "input",
1218
1242
  {
1219
1243
  ref: inputRef,
@@ -1252,18 +1276,18 @@ function FileDropzone({
1252
1276
  addFiles(event.dataTransfer.files);
1253
1277
  },
1254
1278
  children: [
1255
- /* @__PURE__ */ jsx21(FileArrowUp, { "aria-hidden": "true", size: 20 }),
1279
+ /* @__PURE__ */ jsx22(FileArrowUp, { "aria-hidden": "true", size: 20 }),
1256
1280
  /* @__PURE__ */ jsxs15("span", { className: "fractal-file-dropzone__copy", children: [
1257
- /* @__PURE__ */ jsx21("span", { className: "fractal-file-dropzone__title", children: title }),
1258
- description && /* @__PURE__ */ jsx21("span", { className: "fractal-file-dropzone__description", children: description })
1281
+ /* @__PURE__ */ jsx22("span", { className: "fractal-file-dropzone__title", children: title }),
1282
+ description && /* @__PURE__ */ jsx22("span", { className: "fractal-file-dropzone__description", children: description })
1259
1283
  ] })
1260
1284
  ]
1261
1285
  }
1262
1286
  ),
1263
- files.length > 0 && /* @__PURE__ */ jsx21("ul", { className: "fractal-file-dropzone__files", "aria-label": "Attached files", children: files.map((file, index) => /* @__PURE__ */ jsxs15("li", { className: "fractal-file-dropzone__file", children: [
1264
- /* @__PURE__ */ jsx21("span", { className: "fractal-file-dropzone__file-name", children: file.name }),
1265
- /* @__PURE__ */ jsx21("span", { className: "fractal-file-dropzone__file-meta", children: formatFileSize(file.size) }),
1266
- /* @__PURE__ */ jsx21(
1287
+ files.length > 0 && /* @__PURE__ */ jsx22("ul", { className: "fractal-file-dropzone__files", "aria-label": "Attached files", children: files.map((file, index) => /* @__PURE__ */ jsxs15("li", { className: "fractal-file-dropzone__file", children: [
1288
+ /* @__PURE__ */ jsx22("span", { className: "fractal-file-dropzone__file-name", children: file.name }),
1289
+ /* @__PURE__ */ jsx22("span", { className: "fractal-file-dropzone__file-meta", children: formatFileSize(file.size) }),
1290
+ /* @__PURE__ */ jsx22(
1267
1291
  "button",
1268
1292
  {
1269
1293
  className: "fractal-file-dropzone__remove",
@@ -1271,7 +1295,7 @@ function FileDropzone({
1271
1295
  "aria-label": `Remove ${file.name}`,
1272
1296
  disabled,
1273
1297
  onClick: () => onFilesChange(files.filter((_, fileIndex) => fileIndex !== index)),
1274
- children: /* @__PURE__ */ jsx21(Close2, { "aria-hidden": "true", size: 14 })
1298
+ children: /* @__PURE__ */ jsx22(Close2, { "aria-hidden": "true", size: 14 })
1275
1299
  }
1276
1300
  )
1277
1301
  ] }, `${file.name}-${file.size}-${index}`)) })
@@ -1285,7 +1309,7 @@ function formatFileSize(bytes) {
1285
1309
 
1286
1310
  // src/components/Pagination/Pagination.tsx
1287
1311
  import { ArrowLeft, ArrowRight } from "@mirror-physics/fractal-icons";
1288
- import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
1312
+ import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
1289
1313
  function Pagination({
1290
1314
  page,
1291
1315
  pageSize,
@@ -1302,9 +1326,9 @@ function Pagination({
1302
1326
  const end = Math.min(currentPage * pageSize, totalItems);
1303
1327
  const canChangePageSize = pageSizeOptions != null && pageSizeOptions.length > 0 && onPageSizeChange != null;
1304
1328
  return /* @__PURE__ */ jsxs16("nav", { className: cn("fractal-pagination", className), "aria-label": ariaLabel, children: [
1305
- /* @__PURE__ */ jsx22("span", { className: "fractal-pagination__summary", children: totalItems === 0 ? "No results" : `${start}-${end} of ${totalItems}` }),
1329
+ /* @__PURE__ */ jsx23("span", { className: "fractal-pagination__summary", children: totalItems === 0 ? "No results" : `${start}-${end} of ${totalItems}` }),
1306
1330
  /* @__PURE__ */ jsxs16("div", { className: "fractal-pagination__controls", children: [
1307
- canChangePageSize && /* @__PURE__ */ jsx22(
1331
+ canChangePageSize && /* @__PURE__ */ jsx23(
1308
1332
  Dropdown,
1309
1333
  {
1310
1334
  align: "right",
@@ -1321,7 +1345,7 @@ function Pagination({
1321
1345
  triggerVariant: "tertiary"
1322
1346
  }
1323
1347
  ),
1324
- /* @__PURE__ */ jsx22(
1348
+ /* @__PURE__ */ jsx23(
1325
1349
  "button",
1326
1350
  {
1327
1351
  className: "fractal-pagination__button",
@@ -1330,7 +1354,7 @@ function Pagination({
1330
1354
  title: "Previous page",
1331
1355
  disabled: currentPage === 1 || totalItems === 0,
1332
1356
  onClick: () => onPageChange(currentPage - 1),
1333
- children: /* @__PURE__ */ jsx22(ArrowLeft, { "aria-hidden": "true", size: 16 })
1357
+ children: /* @__PURE__ */ jsx23(ArrowLeft, { "aria-hidden": "true", size: 16 })
1334
1358
  }
1335
1359
  ),
1336
1360
  /* @__PURE__ */ jsxs16("span", { className: "fractal-pagination__page", "aria-current": "page", children: [
@@ -1338,7 +1362,7 @@ function Pagination({
1338
1362
  " of ",
1339
1363
  totalPages
1340
1364
  ] }),
1341
- /* @__PURE__ */ jsx22(
1365
+ /* @__PURE__ */ jsx23(
1342
1366
  "button",
1343
1367
  {
1344
1368
  className: "fractal-pagination__button",
@@ -1347,7 +1371,7 @@ function Pagination({
1347
1371
  title: "Next page",
1348
1372
  disabled: currentPage === totalPages || totalItems === 0,
1349
1373
  onClick: () => onPageChange(currentPage + 1),
1350
- children: /* @__PURE__ */ jsx22(ArrowRight, { "aria-hidden": "true", size: 16 })
1374
+ children: /* @__PURE__ */ jsx23(ArrowRight, { "aria-hidden": "true", size: 16 })
1351
1375
  }
1352
1376
  )
1353
1377
  ] })
@@ -1375,6 +1399,7 @@ export {
1375
1399
  FolderCard,
1376
1400
  Input,
1377
1401
  Label,
1402
+ LatticeLoader,
1378
1403
  Link,
1379
1404
  Modal,
1380
1405
  Pagination,