@mirror-physics/fractal-ui 0.2.0-next.47 → 0.2.0-next.48
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 +500 -302
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +107 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +32 -2
- package/dist/index.d.ts +32 -2
- package/dist/index.js +477 -280
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
package/dist/index.cjs
CHANGED
|
@@ -48,6 +48,7 @@ __export(index_exports, {
|
|
|
48
48
|
CheckboxGhost: () => CheckboxGhost,
|
|
49
49
|
Chip: () => Chip,
|
|
50
50
|
ChipGhost: () => ChipGhost,
|
|
51
|
+
CodeBlock: () => CodeBlock,
|
|
51
52
|
ContentSwitcher: () => ContentSwitcher,
|
|
52
53
|
ContentSwitcherGhost: () => ContentSwitcherGhost,
|
|
53
54
|
ConversationGhost: () => ConversationGhost,
|
|
@@ -273,22 +274,218 @@ var Button = React.forwardRef(
|
|
|
273
274
|
);
|
|
274
275
|
Button.displayName = "Button";
|
|
275
276
|
|
|
276
|
-
// src/components/
|
|
277
|
+
// src/components/CodeBlock/CodeBlock.tsx
|
|
278
|
+
var import_react = require("react");
|
|
279
|
+
var import_react_codemirror = __toESM(require("@uiw/react-codemirror"), 1);
|
|
280
|
+
var import_language = require("@codemirror/language");
|
|
281
|
+
var import_language_data = require("@codemirror/language-data");
|
|
282
|
+
var import_view = require("@codemirror/view");
|
|
283
|
+
var import_highlight = require("@lezer/highlight");
|
|
277
284
|
var import_fractal_icons = require("@mirror-physics/fractal-icons");
|
|
278
285
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
286
|
+
var codeTheme = import_view.EditorView.theme({
|
|
287
|
+
"&": {
|
|
288
|
+
backgroundColor: "transparent",
|
|
289
|
+
color: "var(--fg-primary)",
|
|
290
|
+
fontSize: "0.75rem"
|
|
291
|
+
},
|
|
292
|
+
"&.cm-focused": { outline: "none" },
|
|
293
|
+
".cm-scroller": {
|
|
294
|
+
fontFamily: "var(--font-mono)",
|
|
295
|
+
lineHeight: "1.55",
|
|
296
|
+
overscrollBehavior: "contain"
|
|
297
|
+
},
|
|
298
|
+
".cm-content": { padding: "10px 0" },
|
|
299
|
+
".cm-line": { padding: "0 12px" },
|
|
300
|
+
".cm-cursor, .cm-dropCursor": { borderLeftColor: "var(--fg-primary)" },
|
|
301
|
+
".cm-gutters": {
|
|
302
|
+
backgroundColor: "var(--bg-surface-1)",
|
|
303
|
+
borderRight: "1px solid var(--border-subtle)",
|
|
304
|
+
color: "var(--fg-tertiary)"
|
|
305
|
+
},
|
|
306
|
+
".cm-lineNumbers .cm-gutterElement": { padding: "0 10px 0 12px" },
|
|
307
|
+
".cm-foldGutter .cm-gutterElement": { padding: "0 8px 0 2px" },
|
|
308
|
+
".cm-activeLine, .cm-activeLineGutter": { backgroundColor: "var(--bg-surface-1)" },
|
|
309
|
+
".cm-selectionBackground, &.cm-focused .cm-selectionBackground, ::selection": {
|
|
310
|
+
backgroundColor: "var(--accent-surface-stroke) !important"
|
|
311
|
+
},
|
|
312
|
+
".cm-searchMatch": {
|
|
313
|
+
backgroundColor: "var(--warning-surface)",
|
|
314
|
+
outline: "1px solid var(--warning-surface-stroke)"
|
|
315
|
+
},
|
|
316
|
+
".cm-searchMatch.cm-searchMatch-selected": { backgroundColor: "var(--warning-subtle)" },
|
|
317
|
+
".cm-panels": { backgroundColor: "var(--bg-surface-1)", color: "var(--fg-primary)" },
|
|
318
|
+
".cm-tooltip": {
|
|
319
|
+
borderColor: "var(--border-subtle)",
|
|
320
|
+
backgroundColor: "var(--bg-canvas)",
|
|
321
|
+
color: "var(--fg-primary)"
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
var fractalHighlightStyle = import_language.HighlightStyle.define([
|
|
325
|
+
{ tag: import_highlight.tags.comment, color: "var(--fg-tertiary)", fontStyle: "italic" },
|
|
326
|
+
{ tag: [import_highlight.tags.keyword, import_highlight.tags.controlKeyword, import_highlight.tags.operatorKeyword], color: "var(--purple-default)" },
|
|
327
|
+
{ tag: [import_highlight.tags.string, import_highlight.tags.special(import_highlight.tags.string)], color: "var(--success-default)" },
|
|
328
|
+
{ tag: [import_highlight.tags.number, import_highlight.tags.bool, import_highlight.tags.null], color: "var(--orange-default)" },
|
|
329
|
+
{ tag: [import_highlight.tags.function(import_highlight.tags.variableName), import_highlight.tags.labelName], color: "var(--accent-default)" },
|
|
330
|
+
{ tag: [import_highlight.tags.typeName, import_highlight.tags.className, import_highlight.tags.namespace], color: "var(--pink-default)" },
|
|
331
|
+
{ tag: [import_highlight.tags.propertyName, import_highlight.tags.attributeName], color: "var(--fg-primary)" },
|
|
332
|
+
{ tag: [import_highlight.tags.operator, import_highlight.tags.punctuation, import_highlight.tags.bracket], color: "var(--fg-secondary)" },
|
|
333
|
+
{ tag: [import_highlight.tags.heading, import_highlight.tags.strong], color: "var(--fg-primary)", fontWeight: "600" },
|
|
334
|
+
{ tag: import_highlight.tags.emphasis, fontStyle: "italic" },
|
|
335
|
+
{ tag: import_highlight.tags.link, color: "var(--accent-default)", textDecoration: "underline" },
|
|
336
|
+
{ tag: import_highlight.tags.invalid, color: "var(--error-default)", textDecoration: "underline wavy" }
|
|
337
|
+
]);
|
|
338
|
+
function findLanguage(language, fileName) {
|
|
339
|
+
const normalized = language?.trim();
|
|
340
|
+
if (normalized && !["text", "txt", "plaintext", "plain"].includes(normalized.toLowerCase())) {
|
|
341
|
+
return import_language.LanguageDescription.matchLanguageName(import_language_data.languages, normalized, true);
|
|
342
|
+
}
|
|
343
|
+
return fileName ? import_language.LanguageDescription.matchFilename(import_language_data.languages, fileName) : null;
|
|
344
|
+
}
|
|
345
|
+
function useLanguageSupport(language, fileName) {
|
|
346
|
+
const description = (0, import_react.useMemo)(() => findLanguage(language, fileName), [fileName, language]);
|
|
347
|
+
const [support, setSupport] = (0, import_react.useState)(null);
|
|
348
|
+
(0, import_react.useEffect)(() => {
|
|
349
|
+
let cancelled = false;
|
|
350
|
+
setSupport(null);
|
|
351
|
+
if (!description) return () => {
|
|
352
|
+
cancelled = true;
|
|
353
|
+
};
|
|
354
|
+
void description.load().then((loaded) => {
|
|
355
|
+
if (!cancelled) setSupport(loaded);
|
|
356
|
+
}).catch(() => {
|
|
357
|
+
if (!cancelled) setSupport(null);
|
|
358
|
+
});
|
|
359
|
+
return () => {
|
|
360
|
+
cancelled = true;
|
|
361
|
+
};
|
|
362
|
+
}, [description]);
|
|
363
|
+
return { description, support };
|
|
364
|
+
}
|
|
365
|
+
function CodeBlock({
|
|
366
|
+
value,
|
|
367
|
+
language,
|
|
368
|
+
fileName,
|
|
369
|
+
label,
|
|
370
|
+
editable = false,
|
|
371
|
+
onChange,
|
|
372
|
+
lineNumbers = true,
|
|
373
|
+
wrap = true,
|
|
374
|
+
copyable = true,
|
|
375
|
+
ariaLabel,
|
|
376
|
+
height,
|
|
377
|
+
minHeight,
|
|
378
|
+
maxHeight = "28rem",
|
|
379
|
+
placeholder,
|
|
380
|
+
autoFocus,
|
|
381
|
+
className,
|
|
382
|
+
...props
|
|
383
|
+
}) {
|
|
384
|
+
const { description, support } = useLanguageSupport(language, fileName);
|
|
385
|
+
const [copyStatus, setCopyStatus] = (0, import_react.useState)("idle");
|
|
386
|
+
const copyResetTimer = (0, import_react.useRef)(null);
|
|
387
|
+
(0, import_react.useEffect)(() => () => {
|
|
388
|
+
if (copyResetTimer.current) clearTimeout(copyResetTimer.current);
|
|
389
|
+
}, []);
|
|
390
|
+
const extensions = (0, import_react.useMemo)(() => [
|
|
391
|
+
codeTheme,
|
|
392
|
+
(0, import_language.syntaxHighlighting)(fractalHighlightStyle),
|
|
393
|
+
...support ? [support] : [],
|
|
394
|
+
...wrap ? [import_view.EditorView.lineWrapping] : []
|
|
395
|
+
], [support, wrap]);
|
|
396
|
+
const languageLabel = language?.trim() || description?.name;
|
|
397
|
+
const toolbarLabel = label ?? fileName ?? languageLabel;
|
|
398
|
+
const surfaceLabel = ariaLabel ?? (fileName ? `${fileName} ${editable ? "editor" : "viewer"}` : `Code ${editable ? "editor" : "viewer"}`);
|
|
399
|
+
const copyCode = async () => {
|
|
400
|
+
try {
|
|
401
|
+
await navigator.clipboard.writeText(value);
|
|
402
|
+
setCopyStatus("copied");
|
|
403
|
+
} catch {
|
|
404
|
+
setCopyStatus("error");
|
|
405
|
+
}
|
|
406
|
+
if (copyResetTimer.current) clearTimeout(copyResetTimer.current);
|
|
407
|
+
copyResetTimer.current = setTimeout(() => setCopyStatus("idle"), 1800);
|
|
408
|
+
};
|
|
409
|
+
const showToolbar = toolbarLabel !== void 0 || copyable || editable;
|
|
410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
411
|
+
"div",
|
|
412
|
+
{
|
|
413
|
+
className: cn(
|
|
414
|
+
"fractal-code-block",
|
|
415
|
+
editable && "fractal-code-block--editable",
|
|
416
|
+
!lineNumbers && "fractal-code-block--no-line-numbers",
|
|
417
|
+
className
|
|
418
|
+
),
|
|
419
|
+
...props,
|
|
420
|
+
children: [
|
|
421
|
+
showToolbar && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fractal-code-block__toolbar", children: [
|
|
422
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fractal-code-block__identity", children: [
|
|
423
|
+
toolbarLabel !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "fractal-code-block__label", title: typeof toolbarLabel === "string" ? toolbarLabel : void 0, children: toolbarLabel }),
|
|
424
|
+
fileName && languageLabel && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "fractal-code-block__language", children: languageLabel }),
|
|
425
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "fractal-code-block__mode", children: "Editing" })
|
|
426
|
+
] }),
|
|
427
|
+
copyable && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
428
|
+
"button",
|
|
429
|
+
{
|
|
430
|
+
type: "button",
|
|
431
|
+
className: "fractal-code-block__copy",
|
|
432
|
+
"aria-label": copyStatus === "copied" ? "Code copied" : "Copy code",
|
|
433
|
+
onClick: () => void copyCode(),
|
|
434
|
+
children: [
|
|
435
|
+
copyStatus === "copied" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_fractal_icons.Check, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_fractal_icons.Copy, { size: 14 }),
|
|
436
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: copyStatus === "copied" ? "Copied" : copyStatus === "error" ? "Copy failed" : "Copy" })
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
)
|
|
440
|
+
] }),
|
|
441
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "fractal-code-block__surface", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
442
|
+
import_react_codemirror.default,
|
|
443
|
+
{
|
|
444
|
+
"aria-label": surfaceLabel,
|
|
445
|
+
value,
|
|
446
|
+
editable,
|
|
447
|
+
readOnly: !editable,
|
|
448
|
+
onChange,
|
|
449
|
+
extensions,
|
|
450
|
+
theme: "none",
|
|
451
|
+
basicSetup: {
|
|
452
|
+
lineNumbers,
|
|
453
|
+
foldGutter: lineNumbers,
|
|
454
|
+
highlightActiveLine: editable,
|
|
455
|
+
highlightActiveLineGutter: editable,
|
|
456
|
+
autocompletion: editable,
|
|
457
|
+
history: editable
|
|
458
|
+
},
|
|
459
|
+
indentWithTab: editable,
|
|
460
|
+
height,
|
|
461
|
+
minHeight,
|
|
462
|
+
maxHeight,
|
|
463
|
+
placeholder,
|
|
464
|
+
autoFocus
|
|
465
|
+
}
|
|
466
|
+
) }),
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "fractal-code-block__status", "aria-live": "polite", children: copyStatus === "copied" ? "Code copied to clipboard." : copyStatus === "error" ? "Code could not be copied." : "" })
|
|
468
|
+
]
|
|
469
|
+
}
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
|
474
|
+
var import_fractal_icons2 = require("@mirror-physics/fractal-icons");
|
|
475
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
279
476
|
function Breadcrumbs({
|
|
280
477
|
items,
|
|
281
478
|
ariaLabel = "Breadcrumbs",
|
|
282
|
-
separator = /* @__PURE__ */ (0,
|
|
479
|
+
separator = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_fractal_icons2.ChevronRight, { "aria-hidden": "true", size: 14 }),
|
|
283
480
|
className,
|
|
284
481
|
...props
|
|
285
482
|
}) {
|
|
286
483
|
if (items.length === 0) return null;
|
|
287
|
-
return /* @__PURE__ */ (0,
|
|
484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("nav", { "aria-label": ariaLabel, className: cn("fractal-breadcrumbs", className), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ol", { className: "fractal-breadcrumbs__list", children: items.map((item, index) => {
|
|
288
485
|
const isCurrent = index === items.length - 1;
|
|
289
|
-
const content = isCurrent ? /* @__PURE__ */ (0,
|
|
290
|
-
return /* @__PURE__ */ (0,
|
|
291
|
-
index > 0 && /* @__PURE__ */ (0,
|
|
486
|
+
const content = isCurrent ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-current": "page", className: "fractal-breadcrumbs__current", children: item.label }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { className: "fractal-breadcrumbs__link", href: item.href ?? "#", onClick: item.onClick, children: item.label });
|
|
487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { className: "fractal-breadcrumbs__item", children: [
|
|
488
|
+
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-hidden": "true", className: "fractal-breadcrumbs__separator", children: separator }),
|
|
292
489
|
content
|
|
293
490
|
] }, index);
|
|
294
491
|
}) }) });
|
|
@@ -296,42 +493,42 @@ function Breadcrumbs({
|
|
|
296
493
|
|
|
297
494
|
// src/components/Card/Card.tsx
|
|
298
495
|
var React2 = __toESM(require("react"), 1);
|
|
299
|
-
var
|
|
300
|
-
var
|
|
496
|
+
var import_fractal_icons3 = require("@mirror-physics/fractal-icons");
|
|
497
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
301
498
|
var Card = React2.forwardRef(
|
|
302
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
499
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("fractal-card", className), ...props })
|
|
303
500
|
);
|
|
304
501
|
Card.displayName = "Card";
|
|
305
502
|
var CardHeader = React2.forwardRef(
|
|
306
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
503
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("fractal-card-header", className), ...props })
|
|
307
504
|
);
|
|
308
505
|
CardHeader.displayName = "CardHeader";
|
|
309
506
|
var CardTitle = React2.forwardRef(
|
|
310
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
507
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { ref, className: cn("fractal-card-title", className), ...props })
|
|
311
508
|
);
|
|
312
509
|
CardTitle.displayName = "CardTitle";
|
|
313
510
|
var CardDescription = React2.forwardRef(
|
|
314
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
511
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { ref, className: cn("fractal-card-description", className), ...props })
|
|
315
512
|
);
|
|
316
513
|
CardDescription.displayName = "CardDescription";
|
|
317
514
|
var CardContent = React2.forwardRef(
|
|
318
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
515
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("fractal-card-content", className), ...props })
|
|
319
516
|
);
|
|
320
517
|
CardContent.displayName = "CardContent";
|
|
321
518
|
var CardFooter = React2.forwardRef(
|
|
322
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
519
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("fractal-card-footer", className), ...props })
|
|
323
520
|
);
|
|
324
521
|
CardFooter.displayName = "CardFooter";
|
|
325
522
|
var FeatureCard = React2.forwardRef(
|
|
326
|
-
({ icon, title, description, className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
327
|
-
icon && /* @__PURE__ */ (0,
|
|
328
|
-
/* @__PURE__ */ (0,
|
|
329
|
-
/* @__PURE__ */ (0,
|
|
523
|
+
({ icon, title, description, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref, className: cn("fractal-feature-card", className), ...props, children: [
|
|
524
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "fractal-feature-card__icon", children: icon }),
|
|
525
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "fractal-feature-card__title", children: title }),
|
|
526
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "fractal-feature-card__description", children: description })
|
|
330
527
|
] })
|
|
331
528
|
);
|
|
332
529
|
FeatureCard.displayName = "FeatureCard";
|
|
333
530
|
var FolderCard = React2.forwardRef(
|
|
334
|
-
({ name, sessionCount, selected, className, onClick, ...props }, ref) => /* @__PURE__ */ (0,
|
|
531
|
+
({ name, sessionCount, selected, className, onClick, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
335
532
|
"div",
|
|
336
533
|
{
|
|
337
534
|
ref,
|
|
@@ -347,11 +544,11 @@ var FolderCard = React2.forwardRef(
|
|
|
347
544
|
className: cn("fractal-folder-card", selected && "fractal-folder-card--selected", className),
|
|
348
545
|
...props,
|
|
349
546
|
children: [
|
|
350
|
-
/* @__PURE__ */ (0,
|
|
351
|
-
/* @__PURE__ */ (0,
|
|
352
|
-
/* @__PURE__ */ (0,
|
|
547
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fractal-folder-card__header", children: [
|
|
548
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_fractal_icons3.Folder, { size: 16, className: "fractal-folder-card__icon", "aria-hidden": true }),
|
|
549
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "fractal-folder-card__name", children: name })
|
|
353
550
|
] }),
|
|
354
|
-
sessionCount !== void 0 && /* @__PURE__ */ (0,
|
|
551
|
+
sessionCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "fractal-folder-card__footer", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "fractal-folder-card__sessions", children: [
|
|
355
552
|
sessionCount,
|
|
356
553
|
" ",
|
|
357
554
|
sessionCount === 1 ? "session" : "sessions"
|
|
@@ -364,7 +561,7 @@ FolderCard.displayName = "FolderCard";
|
|
|
364
561
|
|
|
365
562
|
// src/components/PromptCard/PromptCard.tsx
|
|
366
563
|
var React3 = __toESM(require("react"), 1);
|
|
367
|
-
var
|
|
564
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
368
565
|
var titleToPrompt = (title) => typeof title === "string" || typeof title === "number" ? String(title) : "";
|
|
369
566
|
var PromptCard = React3.forwardRef(
|
|
370
567
|
({
|
|
@@ -385,7 +582,7 @@ var PromptCard = React3.forwardRef(
|
|
|
385
582
|
onPromptSelect?.(prompt ?? titleToPrompt(title));
|
|
386
583
|
}
|
|
387
584
|
};
|
|
388
|
-
return /* @__PURE__ */ (0,
|
|
585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
389
586
|
"button",
|
|
390
587
|
{
|
|
391
588
|
ref,
|
|
@@ -400,8 +597,8 @@ var PromptCard = React3.forwardRef(
|
|
|
400
597
|
onClick: handleClick,
|
|
401
598
|
...props,
|
|
402
599
|
children: [
|
|
403
|
-
icon && /* @__PURE__ */ (0,
|
|
404
|
-
/* @__PURE__ */ (0,
|
|
600
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fractal-prompt-card__icon", "aria-hidden": "true", children: icon }),
|
|
601
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fractal-prompt-card__title", children: title })
|
|
405
602
|
]
|
|
406
603
|
}
|
|
407
604
|
);
|
|
@@ -409,7 +606,7 @@ var PromptCard = React3.forwardRef(
|
|
|
409
606
|
);
|
|
410
607
|
PromptCard.displayName = "PromptCard";
|
|
411
608
|
var PromptGrid = React3.forwardRef(
|
|
412
|
-
({ compact, padded, className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
609
|
+
({ compact, padded, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
413
610
|
"div",
|
|
414
611
|
{
|
|
415
612
|
ref,
|
|
@@ -427,9 +624,9 @@ PromptGrid.displayName = "PromptGrid";
|
|
|
427
624
|
|
|
428
625
|
// src/components/Input/Input.tsx
|
|
429
626
|
var React4 = __toESM(require("react"), 1);
|
|
430
|
-
var
|
|
627
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
431
628
|
var Input = React4.forwardRef(
|
|
432
|
-
({ className, type, ...props }, ref) => /* @__PURE__ */ (0,
|
|
629
|
+
({ className, type, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
433
630
|
"input",
|
|
434
631
|
{
|
|
435
632
|
type,
|
|
@@ -443,8 +640,8 @@ Input.displayName = "Input";
|
|
|
443
640
|
|
|
444
641
|
// src/components/NumberInput/NumberInput.tsx
|
|
445
642
|
var React5 = __toESM(require("react"), 1);
|
|
446
|
-
var
|
|
447
|
-
var
|
|
643
|
+
var import_fractal_icons4 = require("@mirror-physics/fractal-icons");
|
|
644
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
448
645
|
function NumberInput({
|
|
449
646
|
unit,
|
|
450
647
|
className,
|
|
@@ -470,8 +667,8 @@ function NumberInput({
|
|
|
470
667
|
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
471
668
|
input.focus();
|
|
472
669
|
};
|
|
473
|
-
return /* @__PURE__ */ (0,
|
|
474
|
-
/* @__PURE__ */ (0,
|
|
670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cn("fractal-number-input", unit && "fractal-number-input--with-unit", className), children: [
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
475
672
|
Input,
|
|
476
673
|
{
|
|
477
674
|
ref: inputRef,
|
|
@@ -485,7 +682,7 @@ function NumberInput({
|
|
|
485
682
|
...props
|
|
486
683
|
}
|
|
487
684
|
),
|
|
488
|
-
unit && /* @__PURE__ */ (0,
|
|
685
|
+
unit && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
489
686
|
"span",
|
|
490
687
|
{
|
|
491
688
|
className: "fractal-number-input-unit",
|
|
@@ -494,8 +691,8 @@ function NumberInput({
|
|
|
494
691
|
children: unit
|
|
495
692
|
}
|
|
496
693
|
),
|
|
497
|
-
/* @__PURE__ */ (0,
|
|
498
|
-
/* @__PURE__ */ (0,
|
|
694
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "fractal-number-input-controls", children: [
|
|
695
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
499
696
|
"button",
|
|
500
697
|
{
|
|
501
698
|
type: "button",
|
|
@@ -503,10 +700,10 @@ function NumberInput({
|
|
|
503
700
|
"aria-label": `Decrease ${controlLabel}`,
|
|
504
701
|
disabled: decrementDisabled,
|
|
505
702
|
onClick: () => changeByStep(-1),
|
|
506
|
-
children: /* @__PURE__ */ (0,
|
|
703
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_fractal_icons4.Minus, { "aria-hidden": "true", size: 16 })
|
|
507
704
|
}
|
|
508
705
|
),
|
|
509
|
-
/* @__PURE__ */ (0,
|
|
706
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
510
707
|
"button",
|
|
511
708
|
{
|
|
512
709
|
type: "button",
|
|
@@ -514,7 +711,7 @@ function NumberInput({
|
|
|
514
711
|
"aria-label": `Increase ${controlLabel}`,
|
|
515
712
|
disabled: incrementDisabled,
|
|
516
713
|
onClick: () => changeByStep(1),
|
|
517
|
-
children: /* @__PURE__ */ (0,
|
|
714
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_fractal_icons4.Plus, { "aria-hidden": "true", size: 16 })
|
|
518
715
|
}
|
|
519
716
|
)
|
|
520
717
|
] })
|
|
@@ -523,8 +720,8 @@ function NumberInput({
|
|
|
523
720
|
|
|
524
721
|
// src/components/PasswordInput/PasswordInput.tsx
|
|
525
722
|
var React6 = __toESM(require("react"), 1);
|
|
526
|
-
var
|
|
527
|
-
var
|
|
723
|
+
var import_fractal_icons5 = require("@mirror-physics/fractal-icons");
|
|
724
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
528
725
|
var PasswordInput = React6.forwardRef(
|
|
529
726
|
({
|
|
530
727
|
className,
|
|
@@ -535,13 +732,13 @@ var PasswordInput = React6.forwardRef(
|
|
|
535
732
|
}, ref) => {
|
|
536
733
|
const [passwordVisible, setPasswordVisible] = React6.useState(false);
|
|
537
734
|
const toggleLabel = passwordVisible ? hidePasswordLabel : showPasswordLabel;
|
|
538
|
-
return /* @__PURE__ */ (0,
|
|
735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
539
736
|
"div",
|
|
540
737
|
{
|
|
541
738
|
className: cn("fractal-password-input", className),
|
|
542
739
|
"data-password-visible": passwordVisible ? "" : void 0,
|
|
543
740
|
children: [
|
|
544
|
-
/* @__PURE__ */ (0,
|
|
741
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
545
742
|
Input,
|
|
546
743
|
{
|
|
547
744
|
...props,
|
|
@@ -551,7 +748,7 @@ var PasswordInput = React6.forwardRef(
|
|
|
551
748
|
type: passwordVisible ? "text" : "password"
|
|
552
749
|
}
|
|
553
750
|
),
|
|
554
|
-
/* @__PURE__ */ (0,
|
|
751
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
555
752
|
"button",
|
|
556
753
|
{
|
|
557
754
|
type: "button",
|
|
@@ -561,7 +758,7 @@ var PasswordInput = React6.forwardRef(
|
|
|
561
758
|
disabled,
|
|
562
759
|
title: toggleLabel,
|
|
563
760
|
onClick: () => setPasswordVisible((visible) => !visible),
|
|
564
|
-
children: passwordVisible ? /* @__PURE__ */ (0,
|
|
761
|
+
children: passwordVisible ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_fractal_icons5.EyeSlash, { "aria-hidden": "true", size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_fractal_icons5.Eye, { "aria-hidden": "true", size: 18 })
|
|
565
762
|
}
|
|
566
763
|
)
|
|
567
764
|
]
|
|
@@ -573,9 +770,9 @@ PasswordInput.displayName = "PasswordInput";
|
|
|
573
770
|
|
|
574
771
|
// src/components/Label/Label.tsx
|
|
575
772
|
var React7 = __toESM(require("react"), 1);
|
|
576
|
-
var
|
|
773
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
577
774
|
var Label = React7.forwardRef(
|
|
578
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
775
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
579
776
|
"label",
|
|
580
777
|
{
|
|
581
778
|
ref,
|
|
@@ -588,19 +785,19 @@ Label.displayName = "Label";
|
|
|
588
785
|
|
|
589
786
|
// src/components/Alert/Alert.tsx
|
|
590
787
|
var React8 = __toESM(require("react"), 1);
|
|
591
|
-
var
|
|
592
|
-
var
|
|
788
|
+
var import_fractal_icons6 = require("@mirror-physics/fractal-icons");
|
|
789
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
593
790
|
var defaultIcons = {
|
|
594
|
-
default:
|
|
595
|
-
info:
|
|
596
|
-
success:
|
|
597
|
-
warning:
|
|
598
|
-
error:
|
|
791
|
+
default: import_fractal_icons6.CircleInfo,
|
|
792
|
+
info: import_fractal_icons6.CircleInfo,
|
|
793
|
+
success: import_fractal_icons6.CircleCheck,
|
|
794
|
+
warning: import_fractal_icons6.Warning,
|
|
795
|
+
error: import_fractal_icons6.CircleClose
|
|
599
796
|
};
|
|
600
797
|
var Alert = React8.forwardRef(
|
|
601
798
|
({ className, variant = "default", icon, children, ...props }, ref) => {
|
|
602
799
|
const DefaultIcon = defaultIcons[variant];
|
|
603
|
-
return /* @__PURE__ */ (0,
|
|
800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
604
801
|
"div",
|
|
605
802
|
{
|
|
606
803
|
ref,
|
|
@@ -608,8 +805,8 @@ var Alert = React8.forwardRef(
|
|
|
608
805
|
className: cn("fractal-alert", `fractal-alert--${variant}`, className),
|
|
609
806
|
...props,
|
|
610
807
|
children: [
|
|
611
|
-
/* @__PURE__ */ (0,
|
|
612
|
-
/* @__PURE__ */ (0,
|
|
808
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "fractal-alert-icon", "aria-hidden": true, children: icon ?? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DefaultIcon, { size: 18 }) }),
|
|
809
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "fractal-alert-content", children })
|
|
613
810
|
]
|
|
614
811
|
}
|
|
615
812
|
);
|
|
@@ -617,18 +814,18 @@ var Alert = React8.forwardRef(
|
|
|
617
814
|
);
|
|
618
815
|
Alert.displayName = "Alert";
|
|
619
816
|
var AlertTitle = React8.forwardRef(
|
|
620
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
817
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h5", { ref, className: cn("fractal-alert-title", className), ...props })
|
|
621
818
|
);
|
|
622
819
|
AlertTitle.displayName = "AlertTitle";
|
|
623
820
|
var AlertDescription = React8.forwardRef(
|
|
624
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
821
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { ref, className: cn("fractal-alert-description", className), ...props })
|
|
625
822
|
);
|
|
626
823
|
AlertDescription.displayName = "AlertDescription";
|
|
627
824
|
|
|
628
825
|
// src/components/Toggle/Toggle.tsx
|
|
629
|
-
var
|
|
826
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
630
827
|
function Toggle({ checked, onChange, label, className }) {
|
|
631
|
-
return /* @__PURE__ */ (0,
|
|
828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
632
829
|
"button",
|
|
633
830
|
{
|
|
634
831
|
type: "button",
|
|
@@ -637,8 +834,8 @@ function Toggle({ checked, onChange, label, className }) {
|
|
|
637
834
|
className: cn("fractal-toggle", className),
|
|
638
835
|
onClick: () => onChange(!checked),
|
|
639
836
|
children: [
|
|
640
|
-
/* @__PURE__ */ (0,
|
|
641
|
-
label && /* @__PURE__ */ (0,
|
|
837
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: cn("fractal-toggle-track", checked && "fractal-toggle-track--checked"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: cn("fractal-toggle-thumb", checked && "fractal-toggle-thumb--checked") }) }),
|
|
838
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "fractal-toggle-label", children: label })
|
|
642
839
|
]
|
|
643
840
|
}
|
|
644
841
|
);
|
|
@@ -648,7 +845,7 @@ function Toggle({ checked, onChange, label, className }) {
|
|
|
648
845
|
var import_react_dom = require("react-dom");
|
|
649
846
|
|
|
650
847
|
// src/hooks/useEscapeDismiss.ts
|
|
651
|
-
var
|
|
848
|
+
var import_react2 = require("react");
|
|
652
849
|
var nextId = 0;
|
|
653
850
|
var stack = [];
|
|
654
851
|
function insertSorted(entry) {
|
|
@@ -681,9 +878,9 @@ function ensureGlobalListener() {
|
|
|
681
878
|
);
|
|
682
879
|
}
|
|
683
880
|
function useEscapeDismiss(priority, handler, enabled = true) {
|
|
684
|
-
const handlerRef = (0,
|
|
881
|
+
const handlerRef = (0, import_react2.useRef)(handler);
|
|
685
882
|
handlerRef.current = handler;
|
|
686
|
-
(0,
|
|
883
|
+
(0, import_react2.useEffect)(() => {
|
|
687
884
|
if (!enabled) return;
|
|
688
885
|
ensureGlobalListener();
|
|
689
886
|
const id = nextId++;
|
|
@@ -698,17 +895,17 @@ function useEscapeDismiss(priority, handler, enabled = true) {
|
|
|
698
895
|
}
|
|
699
896
|
|
|
700
897
|
// src/components/UILoader/UILoader.tsx
|
|
701
|
-
var
|
|
702
|
-
var
|
|
898
|
+
var import_react3 = require("react");
|
|
899
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
703
900
|
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";
|
|
704
901
|
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";
|
|
705
902
|
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";
|
|
706
903
|
function UILoader({ size = 48, tone = "neutral", className, style, label = "Loading", ariaHidden = false }) {
|
|
707
|
-
const rawId = (0,
|
|
904
|
+
const rawId = (0, import_react3.useId)().replace(/[^a-zA-Z0-9_-]/g, "");
|
|
708
905
|
const clipId = `fractal-ui-loader-clip-${rawId}`;
|
|
709
906
|
const gradientId = `fractal-ui-loader-gradient-${rawId}`;
|
|
710
907
|
const height = typeof size === "number" ? `${size}px` : size;
|
|
711
|
-
return /* @__PURE__ */ (0,
|
|
908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
712
909
|
"span",
|
|
713
910
|
{
|
|
714
911
|
"aria-hidden": ariaHidden || void 0,
|
|
@@ -716,52 +913,52 @@ function UILoader({ size = 48, tone = "neutral", className, style, label = "Load
|
|
|
716
913
|
className: cn("fractal-ui-loader", `fractal-ui-loader--${tone}`, className),
|
|
717
914
|
role: ariaHidden ? void 0 : "status",
|
|
718
915
|
style,
|
|
719
|
-
children: /* @__PURE__ */ (0,
|
|
720
|
-
/* @__PURE__ */ (0,
|
|
721
|
-
/* @__PURE__ */ (0,
|
|
722
|
-
/* @__PURE__ */ (0,
|
|
723
|
-
/* @__PURE__ */ (0,
|
|
916
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { "aria-hidden": "true", fill: "none", viewBox: "0 0 144 92", style: { height, width: "auto" }, children: [
|
|
917
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("defs", { children: [
|
|
918
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("linearGradient", { id: gradientId, x1: "59", x2: "94.3", y1: "0", y2: "89.1", gradientUnits: "userSpaceOnUse", children: [
|
|
919
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { className: "fractal-ui-loader__stop-start", offset: "0" }),
|
|
920
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { className: "fractal-ui-loader__stop-end", offset: "1" })
|
|
724
921
|
] }),
|
|
725
|
-
/* @__PURE__ */ (0,
|
|
726
|
-
/* @__PURE__ */ (0,
|
|
727
|
-
/* @__PURE__ */ (0,
|
|
728
|
-
/* @__PURE__ */ (0,
|
|
922
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("linearGradient", { id: `${gradientId}-shine`, x1: "0", x2: "1", y1: "0", y2: "0", children: [
|
|
923
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: "0.4", stopColor: "white", stopOpacity: "0" }),
|
|
924
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: "0.5", stopColor: "white", stopOpacity: "0.62" }),
|
|
925
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: "0.6", stopColor: "white", stopOpacity: "0" })
|
|
729
926
|
] }),
|
|
730
|
-
/* @__PURE__ */ (0,
|
|
731
|
-
/* @__PURE__ */ (0,
|
|
732
|
-
/* @__PURE__ */ (0,
|
|
733
|
-
/* @__PURE__ */ (0,
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("clipPath", { id: clipId, children: [
|
|
928
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: LEFT }),
|
|
929
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: CENTER }),
|
|
930
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: RIGHT })
|
|
734
931
|
] })
|
|
735
932
|
] }),
|
|
736
|
-
/* @__PURE__ */ (0,
|
|
737
|
-
/* @__PURE__ */ (0,
|
|
738
|
-
/* @__PURE__ */ (0,
|
|
739
|
-
/* @__PURE__ */ (0,
|
|
933
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: CENTER, fill: `url(#${gradientId})` }),
|
|
934
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: RIGHT, fill: `url(#${gradientId})` }),
|
|
935
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: LEFT, fill: `url(#${gradientId})` }),
|
|
936
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("g", { clipPath: `url(#${clipId})`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("g", { className: "fractal-ui-loader__shine-axis", transform: "translate(72 46) rotate(68.4)", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { className: "fractal-ui-loader__shine", x: "-160", y: "-100", width: "320", height: "200", fill: `url(#${gradientId}-shine)` }) }) })
|
|
740
937
|
] })
|
|
741
938
|
}
|
|
742
939
|
);
|
|
743
940
|
}
|
|
744
941
|
|
|
745
942
|
// src/components/Modal/Modal.tsx
|
|
746
|
-
var
|
|
747
|
-
var CloseIcon = () => /* @__PURE__ */ (0,
|
|
943
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
944
|
+
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime13.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_runtime13.jsx)("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
748
945
|
function Modal({ open, onClose, title, children, danger, warn, footer, noClose, closeDisabled = false, size = "sm", loading = false, loadingLabel = "Loading", scrollable = false, className }) {
|
|
749
946
|
useEscapeDismiss(80, onClose, open && !noClose && !closeDisabled);
|
|
750
947
|
if (!open) return null;
|
|
751
948
|
const sizeClass = `fractal-modal-panel--${size}`;
|
|
752
949
|
const accentClass = danger ? "fractal-modal-panel--danger" : warn ? "fractal-modal-panel--warn" : "";
|
|
753
950
|
return (0, import_react_dom.createPortal)(
|
|
754
|
-
/* @__PURE__ */ (0,
|
|
951
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "fractal-modal-overlay", onClick: noClose || closeDisabled ? void 0 : onClose, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
755
952
|
"div",
|
|
756
953
|
{
|
|
757
954
|
className: cn("fractal-modal-panel", sizeClass, accentClass, scrollable && "fractal-modal-panel--scrollable", className),
|
|
758
955
|
onClick: (e) => e.stopPropagation(),
|
|
759
956
|
children: [
|
|
760
|
-
/* @__PURE__ */ (0,
|
|
761
|
-
/* @__PURE__ */ (0,
|
|
762
|
-
!noClose && /* @__PURE__ */ (0,
|
|
957
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "fractal-modal-title-row", children: [
|
|
958
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h3", { className: cn("fractal-modal-title", danger && "fractal-modal-title--danger", warn && "fractal-modal-title--warn"), children: title }),
|
|
959
|
+
!noClose && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: onClose, title: "Close", disabled: closeDisabled, className: "fractal-modal-close", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CloseIcon, {}) })
|
|
763
960
|
] }),
|
|
764
|
-
/* @__PURE__ */ (0,
|
|
961
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
765
962
|
"div",
|
|
766
963
|
{
|
|
767
964
|
"aria-busy": loading || void 0,
|
|
@@ -771,10 +968,10 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
771
968
|
loading && "fractal-modal-body--loading",
|
|
772
969
|
scrollable && "fractal-modal-body--scrollable"
|
|
773
970
|
),
|
|
774
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
971
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(UILoader, { label: loadingLabel }) : children
|
|
775
972
|
}
|
|
776
973
|
),
|
|
777
|
-
footer && /* @__PURE__ */ (0,
|
|
974
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: cn("fractal-modal-footer", scrollable && "fractal-modal-footer--divided"), children: footer })
|
|
778
975
|
]
|
|
779
976
|
}
|
|
780
977
|
) }),
|
|
@@ -783,17 +980,17 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
783
980
|
}
|
|
784
981
|
|
|
785
982
|
// src/components/DataTable/DataTable.tsx
|
|
786
|
-
var
|
|
983
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
787
984
|
function DataTable({ columns, data, emptyMessage, header, size = "md", className }) {
|
|
788
|
-
return /* @__PURE__ */ (0,
|
|
789
|
-
header && /* @__PURE__ */ (0,
|
|
790
|
-
data.length === 0 ? /* @__PURE__ */ (0,
|
|
791
|
-
/* @__PURE__ */ (0,
|
|
792
|
-
/* @__PURE__ */ (0,
|
|
985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn("fractal-datatable", `fractal-datatable--${size}`, className), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fractal-datatable-surface", children: [
|
|
986
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "fractal-datatable-header", children: header }),
|
|
987
|
+
data.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "fractal-datatable-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: "fractal-datatable-table", children: [
|
|
988
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { className: "fractal-datatable-thead-row", children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "fractal-datatable-th", style: { width: col.width }, children: col.header }, col.key)) }) }),
|
|
989
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { children: data.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
793
990
|
"tr",
|
|
794
991
|
{
|
|
795
992
|
className: "fractal-datatable-row",
|
|
796
|
-
children: columns.map((col) => /* @__PURE__ */ (0,
|
|
993
|
+
children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "fractal-datatable-td", style: { width: col.width }, children: col.render(row, rowIndex) }, col.key))
|
|
797
994
|
},
|
|
798
995
|
rowIndex
|
|
799
996
|
)) })
|
|
@@ -803,8 +1000,8 @@ function DataTable({ columns, data, emptyMessage, header, size = "md", className
|
|
|
803
1000
|
|
|
804
1001
|
// src/components/Dropdown/Dropdown.tsx
|
|
805
1002
|
var React9 = __toESM(require("react"), 1);
|
|
806
|
-
var
|
|
807
|
-
var
|
|
1003
|
+
var import_fractal_icons7 = require("@mirror-physics/fractal-icons");
|
|
1004
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
808
1005
|
var MARGIN = 4;
|
|
809
1006
|
function Dropdown({
|
|
810
1007
|
items,
|
|
@@ -836,7 +1033,7 @@ function Dropdown({
|
|
|
836
1033
|
const selectableItems = visibleItems.filter((i) => i.kind !== "header");
|
|
837
1034
|
const selected = items.find((i) => i.value === selectedValue && i.kind !== "header") ?? selectableItems[0] ?? visibleItems[0];
|
|
838
1035
|
const isUp = direction === "up";
|
|
839
|
-
const ChevronIcon = isUp ?
|
|
1036
|
+
const ChevronIcon = isUp ? import_fractal_icons7.ChevronUp : import_fractal_icons7.ChevronDown;
|
|
840
1037
|
React9.useLayoutEffect(() => {
|
|
841
1038
|
if (!open || !triggerRef.current || !panelRef.current) return;
|
|
842
1039
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
@@ -881,8 +1078,8 @@ function Dropdown({
|
|
|
881
1078
|
document.addEventListener("mousedown", handleClickOutside);
|
|
882
1079
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
883
1080
|
}, [open]);
|
|
884
|
-
return /* @__PURE__ */ (0,
|
|
885
|
-
/* @__PURE__ */ (0,
|
|
1081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn("fractal-dropdown", className), children: [
|
|
1082
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
886
1083
|
"button",
|
|
887
1084
|
{
|
|
888
1085
|
ref: triggerRef,
|
|
@@ -900,15 +1097,15 @@ function Dropdown({
|
|
|
900
1097
|
triggerClassName
|
|
901
1098
|
),
|
|
902
1099
|
children: [
|
|
903
|
-
triggerContent != null ? triggerContent : /* @__PURE__ */ (0,
|
|
904
|
-
selected.icon != null && /* @__PURE__ */ (0,
|
|
905
|
-
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */ (0,
|
|
1100
|
+
triggerContent != null ? triggerContent : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
1101
|
+
selected.icon != null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "fractal-dropdown-icon fractal-dropdown-icon--trigger", children: selected.icon }),
|
|
1102
|
+
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "fractal-dropdown-selected-text", children: selected.description })
|
|
906
1103
|
] }),
|
|
907
|
-
!noChevron && !iconOnly && /* @__PURE__ */ (0,
|
|
1104
|
+
!noChevron && !iconOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "fractal-dropdown-chevron", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronIcon, { size: size === "sm" ? 14 : 16 }) })
|
|
908
1105
|
]
|
|
909
1106
|
}
|
|
910
1107
|
),
|
|
911
|
-
open && /* @__PURE__ */ (0,
|
|
1108
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
912
1109
|
"div",
|
|
913
1110
|
{
|
|
914
1111
|
ref: panelRef,
|
|
@@ -917,21 +1114,21 @@ function Dropdown({
|
|
|
917
1114
|
className: cn("fractal-dropdown-panel", `fractal-dropdown-panel--${size}`, panelClassName),
|
|
918
1115
|
style: panelStyle,
|
|
919
1116
|
children: [
|
|
920
|
-
label != null && /* @__PURE__ */ (0,
|
|
1117
|
+
label != null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "fractal-dropdown-label", children: label }),
|
|
921
1118
|
visibleItems.map((item, index) => {
|
|
922
|
-
const topDivider = item.border === "top" ? /* @__PURE__ */ (0,
|
|
923
|
-
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */ (0,
|
|
1119
|
+
const topDivider = item.border === "top" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "fractal-dropdown-separator" }) : null;
|
|
1120
|
+
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "fractal-dropdown-separator" }) : null;
|
|
924
1121
|
if (item.kind === "header") {
|
|
925
|
-
return /* @__PURE__ */ (0,
|
|
1122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(React9.Fragment, { children: [
|
|
926
1123
|
topDivider,
|
|
927
|
-
/* @__PURE__ */ (0,
|
|
1124
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { role: "presentation", className: "fractal-dropdown-label", children: item.description }),
|
|
928
1125
|
bottomDivider
|
|
929
1126
|
] }, `header-${index}`);
|
|
930
1127
|
}
|
|
931
1128
|
const isSelected = item.value === selectedValue;
|
|
932
|
-
return /* @__PURE__ */ (0,
|
|
1129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(React9.Fragment, { children: [
|
|
933
1130
|
topDivider,
|
|
934
|
-
/* @__PURE__ */ (0,
|
|
1131
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
935
1132
|
"button",
|
|
936
1133
|
{
|
|
937
1134
|
type: "button",
|
|
@@ -943,9 +1140,9 @@ function Dropdown({
|
|
|
943
1140
|
},
|
|
944
1141
|
className: "fractal-dropdown-option",
|
|
945
1142
|
children: [
|
|
946
|
-
item.icon != null && /* @__PURE__ */ (0,
|
|
947
|
-
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */ (0,
|
|
948
|
-
item.trailing != null && /* @__PURE__ */ (0,
|
|
1143
|
+
item.icon != null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "fractal-dropdown-icon", children: item.icon }),
|
|
1144
|
+
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "fractal-dropdown-option-text", children: item.description }),
|
|
1145
|
+
item.trailing != null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "fractal-dropdown-trailing", children: item.trailing })
|
|
949
1146
|
]
|
|
950
1147
|
}
|
|
951
1148
|
),
|
|
@@ -960,9 +1157,9 @@ function Dropdown({
|
|
|
960
1157
|
|
|
961
1158
|
// src/components/Link/Link.tsx
|
|
962
1159
|
var React10 = __toESM(require("react"), 1);
|
|
963
|
-
var
|
|
1160
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
964
1161
|
var Link = React10.forwardRef(
|
|
965
|
-
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */ (0,
|
|
1162
|
+
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
966
1163
|
"a",
|
|
967
1164
|
{
|
|
968
1165
|
ref,
|
|
@@ -975,9 +1172,9 @@ Link.displayName = "Link";
|
|
|
975
1172
|
|
|
976
1173
|
// src/components/Chip/Chip.tsx
|
|
977
1174
|
var React11 = __toESM(require("react"), 1);
|
|
978
|
-
var
|
|
1175
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
979
1176
|
var Chip = React11.forwardRef(
|
|
980
|
-
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */ (0,
|
|
1177
|
+
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
981
1178
|
"span",
|
|
982
1179
|
{
|
|
983
1180
|
ref,
|
|
@@ -989,8 +1186,8 @@ var Chip = React11.forwardRef(
|
|
|
989
1186
|
Chip.displayName = "Chip";
|
|
990
1187
|
|
|
991
1188
|
// src/components/Checkbox/Checkbox.tsx
|
|
992
|
-
var
|
|
993
|
-
var
|
|
1189
|
+
var import_fractal_icons8 = require("@mirror-physics/fractal-icons");
|
|
1190
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
994
1191
|
function Checkbox({
|
|
995
1192
|
checked,
|
|
996
1193
|
indeterminate = false,
|
|
@@ -1001,7 +1198,7 @@ function Checkbox({
|
|
|
1001
1198
|
onKeyDown,
|
|
1002
1199
|
...props
|
|
1003
1200
|
}) {
|
|
1004
|
-
return /* @__PURE__ */ (0,
|
|
1201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1005
1202
|
"button",
|
|
1006
1203
|
{
|
|
1007
1204
|
...props,
|
|
@@ -1023,18 +1220,18 @@ function Checkbox({
|
|
|
1023
1220
|
onKeyDown?.(event);
|
|
1024
1221
|
if (event.key === " " || event.key === "Enter") event.stopPropagation();
|
|
1025
1222
|
},
|
|
1026
|
-
children: indeterminate ? /* @__PURE__ */ (0,
|
|
1027
|
-
/* @__PURE__ */ (0,
|
|
1028
|
-
/* @__PURE__ */ (0,
|
|
1029
|
-
] }) : checked ? /* @__PURE__ */ (0,
|
|
1223
|
+
children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "fractal-checkbox__indeterminate-icon", "aria-hidden": "true", children: [
|
|
1224
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fractal_icons8.Checkbox, { size: 18 }),
|
|
1225
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fractal_icons8.Minus, { className: "fractal-checkbox__indeterminate-mark", size: 12 })
|
|
1226
|
+
] }) : checked ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fractal_icons8.CheckboxChecked, { "aria-hidden": "true", size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fractal_icons8.Checkbox, { "aria-hidden": "true", size: 18 })
|
|
1030
1227
|
}
|
|
1031
1228
|
);
|
|
1032
1229
|
}
|
|
1033
1230
|
|
|
1034
1231
|
// src/components/SortableTable/SortableTable.tsx
|
|
1035
|
-
var
|
|
1036
|
-
var
|
|
1037
|
-
var
|
|
1232
|
+
var import_react4 = require("react");
|
|
1233
|
+
var import_fractal_icons9 = require("@mirror-physics/fractal-icons");
|
|
1234
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1038
1235
|
function SortableTable({
|
|
1039
1236
|
columns,
|
|
1040
1237
|
data,
|
|
@@ -1053,8 +1250,8 @@ function SortableTable({
|
|
|
1053
1250
|
onRowClick,
|
|
1054
1251
|
rowAction
|
|
1055
1252
|
}) {
|
|
1056
|
-
const [internalKey, setInternalKey] = (0,
|
|
1057
|
-
const [internalDirection, setInternalDirection] = (0,
|
|
1253
|
+
const [internalKey, setInternalKey] = (0, import_react4.useState)(defaultSortKey ?? null);
|
|
1254
|
+
const [internalDirection, setInternalDirection] = (0, import_react4.useState)(defaultSortDirection);
|
|
1058
1255
|
const isControlled = controlledKey !== void 0 && controlledDirection !== void 0;
|
|
1059
1256
|
const activeKey = isControlled ? controlledKey : internalKey;
|
|
1060
1257
|
const activeDirection = isControlled ? controlledDirection : internalDirection;
|
|
@@ -1062,7 +1259,7 @@ function SortableTable({
|
|
|
1062
1259
|
const baselineDirection = defaultSort?.direction ?? null;
|
|
1063
1260
|
const effectiveKey = activeKey && activeDirection ? activeKey : baselineKey;
|
|
1064
1261
|
const effectiveDirection = activeKey && activeDirection ? activeDirection : baselineDirection;
|
|
1065
|
-
const sorted = (0,
|
|
1262
|
+
const sorted = (0, import_react4.useMemo)(() => {
|
|
1066
1263
|
if (!effectiveKey || !effectiveDirection) return data;
|
|
1067
1264
|
const col = columns.find((c) => c.key === effectiveKey);
|
|
1068
1265
|
if (!col) return data;
|
|
@@ -1110,13 +1307,13 @@ function SortableTable({
|
|
|
1110
1307
|
onSortChange?.(nextKey, nextDirection);
|
|
1111
1308
|
}
|
|
1112
1309
|
};
|
|
1113
|
-
return /* @__PURE__ */ (0,
|
|
1114
|
-
header && /* @__PURE__ */ (0,
|
|
1115
|
-
sorted.length === 0 ? /* @__PURE__ */ (0,
|
|
1116
|
-
/* @__PURE__ */ (0,
|
|
1310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: cn("fractal-sortable-table", `fractal-sortable-table--${size}`, embedded && "fractal-sortable-table--embedded", className), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "fractal-sortable-table-surface", children: [
|
|
1311
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "fractal-sortable-table-header", children: header }),
|
|
1312
|
+
sorted.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "fractal-sortable-table-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("table", { className: "fractal-sortable-table-table", children: [
|
|
1313
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tr", { className: "fractal-sortable-table-thead-row", children: columns.map((col) => {
|
|
1117
1314
|
const isActive = activeKey === col.key && activeDirection !== null;
|
|
1118
1315
|
if (!col.sortable) {
|
|
1119
|
-
return /* @__PURE__ */ (0,
|
|
1316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1120
1317
|
"th",
|
|
1121
1318
|
{
|
|
1122
1319
|
className: "fractal-sortable-table-th",
|
|
@@ -1126,12 +1323,12 @@ function SortableTable({
|
|
|
1126
1323
|
col.key
|
|
1127
1324
|
);
|
|
1128
1325
|
}
|
|
1129
|
-
return /* @__PURE__ */ (0,
|
|
1326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1130
1327
|
"th",
|
|
1131
1328
|
{
|
|
1132
1329
|
className: "fractal-sortable-table-th fractal-sortable-table-th--sortable",
|
|
1133
1330
|
style: { width: col.width },
|
|
1134
|
-
children: /* @__PURE__ */ (0,
|
|
1331
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1135
1332
|
"button",
|
|
1136
1333
|
{
|
|
1137
1334
|
type: "button",
|
|
@@ -1142,8 +1339,8 @@ function SortableTable({
|
|
|
1142
1339
|
onClick: () => handleSortClick(col.key),
|
|
1143
1340
|
"aria-sort": isActive ? activeDirection === "asc" ? "ascending" : "descending" : "none",
|
|
1144
1341
|
children: [
|
|
1145
|
-
/* @__PURE__ */ (0,
|
|
1146
|
-
/* @__PURE__ */ (0,
|
|
1342
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: col.header }),
|
|
1343
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "fractal-sortable-table-sort-icon", "aria-hidden": "true", children: isActive && activeDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fractal_icons9.ArrowUp, { size: 14 }) : isActive && activeDirection === "desc" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fractal_icons9.ArrowDown, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fractal_icons9.ArrowsUpDown, { size: 14 }) })
|
|
1147
1344
|
]
|
|
1148
1345
|
}
|
|
1149
1346
|
)
|
|
@@ -1151,13 +1348,13 @@ function SortableTable({
|
|
|
1151
1348
|
col.key
|
|
1152
1349
|
);
|
|
1153
1350
|
}) }) }),
|
|
1154
|
-
/* @__PURE__ */ (0,
|
|
1351
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tbody", { children: sorted.map((row, rowIndex) => {
|
|
1155
1352
|
const highlighted = highlightRow?.(row, rowIndex) ?? false;
|
|
1156
1353
|
const action = rowAction ? {
|
|
1157
1354
|
label: rowAction.label(row, rowIndex),
|
|
1158
1355
|
icon: rowAction.icon(row, rowIndex)
|
|
1159
1356
|
} : null;
|
|
1160
|
-
return /* @__PURE__ */ (0,
|
|
1357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1161
1358
|
"tr",
|
|
1162
1359
|
{
|
|
1163
1360
|
className: cn(
|
|
@@ -1175,7 +1372,7 @@ function SortableTable({
|
|
|
1175
1372
|
"aria-label": action?.label,
|
|
1176
1373
|
role: onRowClick ? "button" : void 0,
|
|
1177
1374
|
tabIndex: onRowClick ? 0 : void 0,
|
|
1178
|
-
children: columns.map((col, columnIndex) => /* @__PURE__ */ (0,
|
|
1375
|
+
children: columns.map((col, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1179
1376
|
"td",
|
|
1180
1377
|
{
|
|
1181
1378
|
className: cn(
|
|
@@ -1185,7 +1382,7 @@ function SortableTable({
|
|
|
1185
1382
|
style: { width: col.width, textAlign: col.align ?? "left" },
|
|
1186
1383
|
children: [
|
|
1187
1384
|
col.render(row, rowIndex),
|
|
1188
|
-
action && columnIndex === columns.length - 1 && /* @__PURE__ */ (0,
|
|
1385
|
+
action && columnIndex === columns.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "fractal-sortable-table-row-action", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "fractal-sortable-table-row-action__icon", children: action.icon }) })
|
|
1189
1386
|
]
|
|
1190
1387
|
},
|
|
1191
1388
|
col.key
|
|
@@ -1199,8 +1396,8 @@ function SortableTable({
|
|
|
1199
1396
|
}
|
|
1200
1397
|
|
|
1201
1398
|
// src/components/Tabs/Tabs.tsx
|
|
1202
|
-
var
|
|
1203
|
-
var
|
|
1399
|
+
var import_react5 = require("react");
|
|
1400
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1204
1401
|
function Tabs({
|
|
1205
1402
|
items,
|
|
1206
1403
|
defaultValue,
|
|
@@ -1211,16 +1408,16 @@ function Tabs({
|
|
|
1211
1408
|
divider = false,
|
|
1212
1409
|
variant = "line"
|
|
1213
1410
|
}) {
|
|
1214
|
-
const reactId = (0,
|
|
1215
|
-
const [internalValue, setInternalValue] = (0,
|
|
1411
|
+
const reactId = (0, import_react5.useId)();
|
|
1412
|
+
const [internalValue, setInternalValue] = (0, import_react5.useState)(
|
|
1216
1413
|
defaultValue ?? items.find((i) => !i.disabled)?.id ?? items[0]?.id ?? ""
|
|
1217
1414
|
);
|
|
1218
1415
|
const isControlled = controlledValue !== void 0;
|
|
1219
1416
|
const activeId = isControlled ? controlledValue : internalValue;
|
|
1220
|
-
const tabListRef = (0,
|
|
1221
|
-
const tabRefs = (0,
|
|
1222
|
-
const [indicator, setIndicator] = (0,
|
|
1223
|
-
(0,
|
|
1417
|
+
const tabListRef = (0, import_react5.useRef)(null);
|
|
1418
|
+
const tabRefs = (0, import_react5.useRef)({});
|
|
1419
|
+
const [indicator, setIndicator] = (0, import_react5.useState)(null);
|
|
1420
|
+
(0, import_react5.useLayoutEffect)(() => {
|
|
1224
1421
|
const updateIndicator = () => {
|
|
1225
1422
|
const activeTab = tabRefs.current[activeId];
|
|
1226
1423
|
if (!activeTab) return;
|
|
@@ -1271,8 +1468,8 @@ function Tabs({
|
|
|
1271
1468
|
selectTab(nextId2);
|
|
1272
1469
|
requestAnimationFrame(() => tabRefs.current[nextId2]?.focus());
|
|
1273
1470
|
};
|
|
1274
|
-
return /* @__PURE__ */ (0,
|
|
1275
|
-
/* @__PURE__ */ (0,
|
|
1471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cn("fractal-tabs", `fractal-tabs--${variant}`, divider && "fractal-tabs--divider", className), children: [
|
|
1472
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1276
1473
|
"div",
|
|
1277
1474
|
{
|
|
1278
1475
|
ref: tabListRef,
|
|
@@ -1285,7 +1482,7 @@ function Tabs({
|
|
|
1285
1482
|
const isActive = item.id === activeId;
|
|
1286
1483
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
1287
1484
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
1288
|
-
return /* @__PURE__ */ (0,
|
|
1485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1289
1486
|
"button",
|
|
1290
1487
|
{
|
|
1291
1488
|
ref: (el) => {
|
|
@@ -1316,7 +1513,7 @@ function Tabs({
|
|
|
1316
1513
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
1317
1514
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
1318
1515
|
const isActive = item.id === activeId;
|
|
1319
|
-
return /* @__PURE__ */ (0,
|
|
1516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1320
1517
|
"div",
|
|
1321
1518
|
{
|
|
1322
1519
|
id: panelId,
|
|
@@ -1334,7 +1531,7 @@ function Tabs({
|
|
|
1334
1531
|
|
|
1335
1532
|
// src/components/ContentSwitcher/ContentSwitcher.tsx
|
|
1336
1533
|
var React12 = __toESM(require("react"), 1);
|
|
1337
|
-
var
|
|
1534
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1338
1535
|
function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = false, className }) {
|
|
1339
1536
|
const switcherRef = React12.useRef(null);
|
|
1340
1537
|
const buttonRefs = React12.useRef([]);
|
|
@@ -1392,7 +1589,7 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1392
1589
|
onValueChange(items[nextIndex].value);
|
|
1393
1590
|
}
|
|
1394
1591
|
};
|
|
1395
|
-
return /* @__PURE__ */ (0,
|
|
1592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1396
1593
|
"div",
|
|
1397
1594
|
{
|
|
1398
1595
|
className: cn("fractal-content-switcher", fullWidth && "fractal-content-switcher--full-width", className),
|
|
@@ -1400,10 +1597,10 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1400
1597
|
"aria-label": ariaLabel,
|
|
1401
1598
|
ref: switcherRef,
|
|
1402
1599
|
children: [
|
|
1403
|
-
/* @__PURE__ */ (0,
|
|
1600
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fractal-content-switcher__indicator", "aria-hidden": true }),
|
|
1404
1601
|
items.map((item, index) => {
|
|
1405
1602
|
const active = item.value === value;
|
|
1406
|
-
return /* @__PURE__ */ (0,
|
|
1603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1407
1604
|
"button",
|
|
1408
1605
|
{
|
|
1409
1606
|
className: cn("fractal-content-switcher__item", active && "fractal-content-switcher__item--active"),
|
|
@@ -1435,9 +1632,9 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1435
1632
|
}
|
|
1436
1633
|
|
|
1437
1634
|
// src/components/Disclosure/Disclosure.tsx
|
|
1438
|
-
var
|
|
1439
|
-
var
|
|
1440
|
-
var
|
|
1635
|
+
var import_react6 = require("react");
|
|
1636
|
+
var import_fractal_icons10 = require("@mirror-physics/fractal-icons");
|
|
1637
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1441
1638
|
function Disclosure({
|
|
1442
1639
|
title,
|
|
1443
1640
|
meta,
|
|
@@ -1449,10 +1646,10 @@ function Disclosure({
|
|
|
1449
1646
|
className,
|
|
1450
1647
|
variant = "card"
|
|
1451
1648
|
}) {
|
|
1452
|
-
const reactId = (0,
|
|
1649
|
+
const reactId = (0, import_react6.useId)();
|
|
1453
1650
|
const headerId = `${reactId}-header`;
|
|
1454
1651
|
const panelId = `${reactId}-panel`;
|
|
1455
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
1652
|
+
const [internalOpen, setInternalOpen] = (0, import_react6.useState)(defaultOpen);
|
|
1456
1653
|
const isControlled = controlledOpen !== void 0;
|
|
1457
1654
|
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
1458
1655
|
const toggle = () => {
|
|
@@ -1465,7 +1662,7 @@ function Disclosure({
|
|
|
1465
1662
|
onOpenChange?.(next);
|
|
1466
1663
|
}
|
|
1467
1664
|
};
|
|
1468
|
-
return /* @__PURE__ */ (0,
|
|
1665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1469
1666
|
"div",
|
|
1470
1667
|
{
|
|
1471
1668
|
className: cn(
|
|
@@ -1476,7 +1673,7 @@ function Disclosure({
|
|
|
1476
1673
|
className
|
|
1477
1674
|
),
|
|
1478
1675
|
children: [
|
|
1479
|
-
/* @__PURE__ */ (0,
|
|
1676
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1480
1677
|
"button",
|
|
1481
1678
|
{
|
|
1482
1679
|
type: "button",
|
|
@@ -1487,13 +1684,13 @@ function Disclosure({
|
|
|
1487
1684
|
disabled,
|
|
1488
1685
|
onClick: toggle,
|
|
1489
1686
|
children: [
|
|
1490
|
-
/* @__PURE__ */ (0,
|
|
1491
|
-
/* @__PURE__ */ (0,
|
|
1492
|
-
meta && /* @__PURE__ */ (0,
|
|
1687
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fractal-disclosure-icon", "aria-hidden": "true", children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_fractal_icons10.ChevronDown, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_fractal_icons10.ChevronRight, { size: 16 }) }),
|
|
1688
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fractal-disclosure-title", children: title }),
|
|
1689
|
+
meta && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fractal-disclosure-meta", children: meta })
|
|
1493
1690
|
]
|
|
1494
1691
|
}
|
|
1495
1692
|
),
|
|
1496
|
-
/* @__PURE__ */ (0,
|
|
1693
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1497
1694
|
"div",
|
|
1498
1695
|
{
|
|
1499
1696
|
id: panelId,
|
|
@@ -1501,7 +1698,7 @@ function Disclosure({
|
|
|
1501
1698
|
"aria-labelledby": headerId,
|
|
1502
1699
|
className: "fractal-disclosure-panel",
|
|
1503
1700
|
hidden: !isOpen,
|
|
1504
|
-
children: /* @__PURE__ */ (0,
|
|
1701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "fractal-disclosure-panel-inner", children })
|
|
1505
1702
|
}
|
|
1506
1703
|
)
|
|
1507
1704
|
]
|
|
@@ -1510,18 +1707,18 @@ function Disclosure({
|
|
|
1510
1707
|
}
|
|
1511
1708
|
|
|
1512
1709
|
// src/components/LatticeLoader/LatticeLoader.tsx
|
|
1513
|
-
var
|
|
1710
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1514
1711
|
var LATTICE_COUNT = 160;
|
|
1515
1712
|
var WAVE_PERIOD = 80;
|
|
1516
1713
|
function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
1517
|
-
return /* @__PURE__ */ (0,
|
|
1714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1518
1715
|
"span",
|
|
1519
1716
|
{
|
|
1520
1717
|
"aria-label": label,
|
|
1521
1718
|
className: cn("fractal-lattice-loader", className),
|
|
1522
1719
|
role: "progressbar",
|
|
1523
1720
|
...props,
|
|
1524
|
-
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ (0,
|
|
1721
|
+
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1525
1722
|
"span",
|
|
1526
1723
|
{
|
|
1527
1724
|
"aria-hidden": "true",
|
|
@@ -1535,10 +1732,10 @@ function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
|
1535
1732
|
}
|
|
1536
1733
|
|
|
1537
1734
|
// src/components/Ghost/Ghost.tsx
|
|
1538
|
-
var
|
|
1735
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1539
1736
|
var toCssLength = (value) => typeof value === "number" ? `${value}px` : value;
|
|
1540
1737
|
function Ghost({ className, width, height, radius, style, ...props }) {
|
|
1541
|
-
return /* @__PURE__ */ (0,
|
|
1738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1542
1739
|
"div",
|
|
1543
1740
|
{
|
|
1544
1741
|
"aria-hidden": "true",
|
|
@@ -1554,15 +1751,15 @@ function Ghost({ className, width, height, radius, style, ...props }) {
|
|
|
1554
1751
|
);
|
|
1555
1752
|
}
|
|
1556
1753
|
function GhostLine({ className, size = "md", width = "100%", ...props }) {
|
|
1557
|
-
return /* @__PURE__ */ (0,
|
|
1754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Ghost, { className: cn("fractal-ghost-line", `fractal-ghost-line--${size}`, className), width, ...props });
|
|
1558
1755
|
}
|
|
1559
1756
|
function ButtonGhost({ className, size = "md", iconOnly = false, width, ...props }) {
|
|
1560
|
-
return /* @__PURE__ */ (0,
|
|
1757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Ghost, { className: cn("fractal-ghost-button", `fractal-ghost-button--${size}`, iconOnly && "fractal-ghost-button--icon-only", className), width, ...props });
|
|
1561
1758
|
}
|
|
1562
1759
|
function CardGhost({ className, lines = 3, showHeader = true, ...props }) {
|
|
1563
|
-
return /* @__PURE__ */ (0,
|
|
1564
|
-
showHeader && /* @__PURE__ */ (0,
|
|
1565
|
-
/* @__PURE__ */ (0,
|
|
1760
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-card", className), ...props, children: [
|
|
1761
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: "38%" }),
|
|
1762
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: index === lines - 1 ? "62%" : "100%" }, index)) })
|
|
1566
1763
|
] });
|
|
1567
1764
|
}
|
|
1568
1765
|
function DataTableGhost({
|
|
@@ -1576,81 +1773,81 @@ function DataTableGhost({
|
|
|
1576
1773
|
...props
|
|
1577
1774
|
}) {
|
|
1578
1775
|
const cells = Array.from({ length: columns }, (_, index) => index);
|
|
1579
|
-
return /* @__PURE__ */ (0,
|
|
1580
|
-
(showHeader || headers) && /* @__PURE__ */ (0,
|
|
1581
|
-
/* @__PURE__ */ (0,
|
|
1776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsxs)("table", { className: "fractal-ghost-table__table", children: [
|
|
1777
|
+
(showHeader || headers) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("tr", { className: "fractal-ghost-table__head-row", children: cells.map((index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("th", { style: { width: columnWidths?.[index] }, children: headers?.[index] ?? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { size: "sm", width: index === columns - 1 ? "62%" : "76%" }) }, index)) }) }),
|
|
1778
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("tbody", { children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("tr", { className: "fractal-ghost-table__row", children: cells.map((columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("td", { style: { width: columnWidths?.[columnIndex] }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: `${[72, 54, 82, 63, 46][(rowIndex + columnIndex) % 5]}%` }) }, columnIndex)) }, rowIndex)) })
|
|
1582
1779
|
] }) });
|
|
1583
1780
|
}
|
|
1584
1781
|
function InputGhost({ className, labelWidth = "26%", ...props }) {
|
|
1585
|
-
return /* @__PURE__ */ (0,
|
|
1782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FormFieldGhost, { className, labelWidth, ...props });
|
|
1586
1783
|
}
|
|
1587
1784
|
function TextareaGhost({ className, labelWidth = "26%", ...props }) {
|
|
1588
|
-
return /* @__PURE__ */ (0,
|
|
1785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FormFieldGhost, { className, labelWidth, multiline: true, ...props });
|
|
1589
1786
|
}
|
|
1590
1787
|
function LabelGhost({ className, width = "26%", ...props }) {
|
|
1591
|
-
return /* @__PURE__ */ (0,
|
|
1788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { className: cn("fractal-ghost-label", className), size: "sm", width, ...props });
|
|
1592
1789
|
}
|
|
1593
1790
|
function FormFieldGhost({ className, labelWidth = "26%", multiline = false, ...props }) {
|
|
1594
|
-
return /* @__PURE__ */ (0,
|
|
1595
|
-
/* @__PURE__ */ (0,
|
|
1596
|
-
/* @__PURE__ */ (0,
|
|
1791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-field", className), ...props, children: [
|
|
1792
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(LabelGhost, { width: labelWidth }),
|
|
1793
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Ghost, { className: cn("fractal-ghost-field__control", multiline && "fractal-ghost-field__control--multiline") })
|
|
1597
1794
|
] });
|
|
1598
1795
|
}
|
|
1599
1796
|
function AlertGhost({ className, ...props }) {
|
|
1600
|
-
return /* @__PURE__ */ (0,
|
|
1601
|
-
/* @__PURE__ */ (0,
|
|
1602
|
-
/* @__PURE__ */ (0,
|
|
1797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-alert", className), ...props, children: [
|
|
1798
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: "30%" }),
|
|
1799
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { size: "sm", width: "78%" })
|
|
1603
1800
|
] });
|
|
1604
1801
|
}
|
|
1605
1802
|
function CheckboxGhost({ className, ...props }) {
|
|
1606
|
-
return /* @__PURE__ */ (0,
|
|
1607
|
-
/* @__PURE__ */ (0,
|
|
1608
|
-
/* @__PURE__ */ (0,
|
|
1803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-choice", className), ...props, children: [
|
|
1804
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Ghost, { className: "fractal-ghost-choice__control" }),
|
|
1805
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: "42%" })
|
|
1609
1806
|
] });
|
|
1610
1807
|
}
|
|
1611
1808
|
var ToggleGhost = CheckboxGhost;
|
|
1612
1809
|
function ChipGhost({ className, width = 74, ...props }) {
|
|
1613
|
-
return /* @__PURE__ */ (0,
|
|
1810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Ghost, { className: cn("fractal-ghost-chip", className), height: 24, width, ...props });
|
|
1614
1811
|
}
|
|
1615
1812
|
function LinkGhost({ className, width = 96, ...props }) {
|
|
1616
|
-
return /* @__PURE__ */ (0,
|
|
1813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { className: cn("fractal-ghost-link", className), size: "sm", width, ...props });
|
|
1617
1814
|
}
|
|
1618
1815
|
var TextButtonGhost = LinkGhost;
|
|
1619
1816
|
function DropdownGhost({ className, ...props }) {
|
|
1620
|
-
return /* @__PURE__ */ (0,
|
|
1621
|
-
/* @__PURE__ */ (0,
|
|
1622
|
-
/* @__PURE__ */ (0,
|
|
1817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropdown", className), ...props, children: [
|
|
1818
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: "38%" }),
|
|
1819
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Ghost, { className: "fractal-ghost-dropdown__chevron" })
|
|
1623
1820
|
] });
|
|
1624
1821
|
}
|
|
1625
1822
|
function ContentSwitcherGhost({ className, options = 3, ...props }) {
|
|
1626
|
-
return /* @__PURE__ */ (0,
|
|
1823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { "aria-hidden": "true", className: cn("fractal-ghost-switcher", className), ...props, children: Array.from({ length: options }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Ghost, {}, index)) });
|
|
1627
1824
|
}
|
|
1628
1825
|
var TabsGhost = ContentSwitcherGhost;
|
|
1629
1826
|
function DisclosureGhost({ className, ...props }) {
|
|
1630
|
-
return /* @__PURE__ */ (0,
|
|
1631
|
-
/* @__PURE__ */ (0,
|
|
1632
|
-
/* @__PURE__ */ (0,
|
|
1827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-disclosure", className), ...props, children: [
|
|
1828
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Ghost, { className: "fractal-ghost-disclosure__icon" }),
|
|
1829
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: "42%" })
|
|
1633
1830
|
] });
|
|
1634
1831
|
}
|
|
1635
1832
|
function PaginationGhost({ className, pages = 5, ...props }) {
|
|
1636
|
-
return /* @__PURE__ */ (0,
|
|
1833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { "aria-hidden": "true", className: cn("fractal-ghost-pagination", className), ...props, children: Array.from({ length: pages }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Ghost, {}, index)) });
|
|
1637
1834
|
}
|
|
1638
1835
|
function FileDropzoneGhost({ className, ...props }) {
|
|
1639
|
-
return /* @__PURE__ */ (0,
|
|
1640
|
-
/* @__PURE__ */ (0,
|
|
1641
|
-
/* @__PURE__ */ (0,
|
|
1642
|
-
/* @__PURE__ */ (0,
|
|
1836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropzone", className), ...props, children: [
|
|
1837
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Ghost, { className: "fractal-ghost-dropzone__icon" }),
|
|
1838
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: "26%" }),
|
|
1839
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { size: "sm", width: "46%" })
|
|
1643
1840
|
] });
|
|
1644
1841
|
}
|
|
1645
1842
|
function PromptCardGhost({ className, ...props }) {
|
|
1646
|
-
return /* @__PURE__ */ (0,
|
|
1843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CardGhost, { className: cn("fractal-ghost-prompt-card", className), lines: 4, ...props });
|
|
1647
1844
|
}
|
|
1648
1845
|
function ConversationGhost({
|
|
1649
1846
|
className,
|
|
1650
1847
|
"aria-label": ariaLabel = "Loading conversation",
|
|
1651
1848
|
...props
|
|
1652
1849
|
}) {
|
|
1653
|
-
return /* @__PURE__ */ (0,
|
|
1850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1654
1851
|
"div",
|
|
1655
1852
|
{
|
|
1656
1853
|
"aria-busy": "true",
|
|
@@ -1659,54 +1856,54 @@ function ConversationGhost({
|
|
|
1659
1856
|
role: "status",
|
|
1660
1857
|
...props,
|
|
1661
1858
|
children: [
|
|
1662
|
-
/* @__PURE__ */ (0,
|
|
1663
|
-
/* @__PURE__ */ (0,
|
|
1664
|
-
/* @__PURE__ */ (0,
|
|
1665
|
-
/* @__PURE__ */ (0,
|
|
1859
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--user", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fractal-ghost-conversation__bubble", children: [
|
|
1860
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: "100%" }),
|
|
1861
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: "86%" }),
|
|
1862
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: "64%" })
|
|
1666
1863
|
] }) }),
|
|
1667
|
-
/* @__PURE__ */ (0,
|
|
1668
|
-
/* @__PURE__ */ (0,
|
|
1669
|
-
/* @__PURE__ */ (0,
|
|
1670
|
-
/* @__PURE__ */ (0,
|
|
1864
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--assistant", children: [
|
|
1865
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: "92%" }),
|
|
1866
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: "78%" }),
|
|
1867
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: "58%" })
|
|
1671
1868
|
] })
|
|
1672
1869
|
]
|
|
1673
1870
|
}
|
|
1674
1871
|
);
|
|
1675
1872
|
}
|
|
1676
1873
|
function SortableTableGhost(props) {
|
|
1677
|
-
return /* @__PURE__ */ (0,
|
|
1874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DataTableGhost, { ...props });
|
|
1678
1875
|
}
|
|
1679
1876
|
function SidebarGhost({ className, items = 6, ...props }) {
|
|
1680
|
-
return /* @__PURE__ */ (0,
|
|
1681
|
-
/* @__PURE__ */ (0,
|
|
1682
|
-
/* @__PURE__ */ (0,
|
|
1683
|
-
/* @__PURE__ */ (0,
|
|
1684
|
-
/* @__PURE__ */ (0,
|
|
1877
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("aside", { "aria-hidden": "true", className: cn("fractal-ghost-sidebar", className), ...props, children: [
|
|
1878
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Ghost, { className: "fractal-ghost-sidebar__brand" }),
|
|
1879
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "fractal-ghost-sidebar__items", children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fractal-ghost-sidebar__item", children: [
|
|
1880
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Ghost, {}),
|
|
1881
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: `${[54, 68, 44, 61][index % 4]}%` })
|
|
1685
1882
|
] }, index)) })
|
|
1686
1883
|
] });
|
|
1687
1884
|
}
|
|
1688
1885
|
function ModalGhost({ className, title, lines = 3, ...props }) {
|
|
1689
|
-
return /* @__PURE__ */ (0,
|
|
1886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SurfaceGhost, { className: cn("fractal-ghost-modal", className), title, lines, ...props });
|
|
1690
1887
|
}
|
|
1691
1888
|
function SidePanelGhost({ className, title, lines = 5, ...props }) {
|
|
1692
|
-
return /* @__PURE__ */ (0,
|
|
1889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SurfaceGhost, { className: cn("fractal-ghost-side-panel", className), title, lines, ...props });
|
|
1693
1890
|
}
|
|
1694
1891
|
function SurfaceGhost({ className, title, lines = 3, ...props }) {
|
|
1695
|
-
return /* @__PURE__ */ (0,
|
|
1696
|
-
/* @__PURE__ */ (0,
|
|
1697
|
-
/* @__PURE__ */ (0,
|
|
1698
|
-
/* @__PURE__ */ (0,
|
|
1892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-surface", className), ...props, children: [
|
|
1893
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fractal-ghost-surface__header", children: [
|
|
1894
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: "42%" }),
|
|
1895
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Ghost, { className: "fractal-ghost-surface__close" })
|
|
1699
1896
|
] }),
|
|
1700
|
-
title && /* @__PURE__ */ (0,
|
|
1701
|
-
/* @__PURE__ */ (0,
|
|
1897
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "fractal-ghost-surface__title", children: title }),
|
|
1898
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GhostLine, { width: index === lines - 1 ? "64%" : "100%" }, index)) })
|
|
1702
1899
|
] });
|
|
1703
1900
|
}
|
|
1704
1901
|
|
|
1705
1902
|
// src/components/Sidebar/Sidebar.tsx
|
|
1706
1903
|
var React13 = __toESM(require("react"), 1);
|
|
1707
|
-
var
|
|
1904
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1708
1905
|
var Sidebar = React13.forwardRef(
|
|
1709
|
-
({ className, width, compact = false, style, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1906
|
+
({ className, width, compact = false, style, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1710
1907
|
"aside",
|
|
1711
1908
|
{
|
|
1712
1909
|
ref,
|
|
@@ -1719,11 +1916,11 @@ var Sidebar = React13.forwardRef(
|
|
|
1719
1916
|
);
|
|
1720
1917
|
Sidebar.displayName = "Sidebar";
|
|
1721
1918
|
var SidebarHeader = React13.forwardRef(
|
|
1722
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1919
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, className: cn("fractal-sidebar__header", className), ...props })
|
|
1723
1920
|
);
|
|
1724
1921
|
SidebarHeader.displayName = "SidebarHeader";
|
|
1725
1922
|
var SidebarBrand = React13.forwardRef(
|
|
1726
|
-
({ className, type = "button", ...props }, ref) => /* @__PURE__ */ (0,
|
|
1923
|
+
({ className, type = "button", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { ref, type, className: cn("fractal-sidebar__brand", className), ...props })
|
|
1727
1924
|
);
|
|
1728
1925
|
SidebarBrand.displayName = "SidebarBrand";
|
|
1729
1926
|
function SidebarAccountMenu({
|
|
@@ -1734,7 +1931,7 @@ function SidebarAccountMenu({
|
|
|
1734
1931
|
icon,
|
|
1735
1932
|
className
|
|
1736
1933
|
}) {
|
|
1737
|
-
return /* @__PURE__ */ (0,
|
|
1934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1738
1935
|
Dropdown,
|
|
1739
1936
|
{
|
|
1740
1937
|
align: "left",
|
|
@@ -1744,9 +1941,9 @@ function SidebarAccountMenu({
|
|
|
1744
1941
|
panelClassName: "fractal-sidebar__account-panel",
|
|
1745
1942
|
selectedValue: "",
|
|
1746
1943
|
triggerClassName: "fractal-sidebar__account-trigger",
|
|
1747
|
-
triggerContent: /* @__PURE__ */ (0,
|
|
1748
|
-
icon && /* @__PURE__ */ (0,
|
|
1749
|
-
/* @__PURE__ */ (0,
|
|
1944
|
+
triggerContent: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
1945
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "fractal-sidebar__account-icon", "aria-hidden": "true", children: icon }),
|
|
1946
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "fractal-sidebar__account-name", children: name })
|
|
1750
1947
|
] }),
|
|
1751
1948
|
triggerLabel,
|
|
1752
1949
|
triggerVariant: "tertiary"
|
|
@@ -1754,15 +1951,15 @@ function SidebarAccountMenu({
|
|
|
1754
1951
|
);
|
|
1755
1952
|
}
|
|
1756
1953
|
var SidebarNav = React13.forwardRef(
|
|
1757
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1954
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("nav", { ref, className: cn("fractal-sidebar__nav", className), ...props })
|
|
1758
1955
|
);
|
|
1759
1956
|
SidebarNav.displayName = "SidebarNav";
|
|
1760
1957
|
var SidebarSection = React13.forwardRef(
|
|
1761
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1958
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, className: cn("fractal-sidebar__section", className), ...props })
|
|
1762
1959
|
);
|
|
1763
1960
|
SidebarSection.displayName = "SidebarSection";
|
|
1764
1961
|
var SidebarNavItem = React13.forwardRef(
|
|
1765
|
-
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1962
|
+
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1766
1963
|
"button",
|
|
1767
1964
|
{
|
|
1768
1965
|
ref,
|
|
@@ -1772,28 +1969,28 @@ var SidebarNavItem = React13.forwardRef(
|
|
|
1772
1969
|
"aria-current": active ? "page" : void 0,
|
|
1773
1970
|
...props,
|
|
1774
1971
|
children: [
|
|
1775
|
-
icon && /* @__PURE__ */ (0,
|
|
1776
|
-
/* @__PURE__ */ (0,
|
|
1777
|
-
endAdornment && /* @__PURE__ */ (0,
|
|
1972
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "fractal-sidebar__nav-item-icon", "aria-hidden": "true", children: icon }),
|
|
1973
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "fractal-sidebar__nav-item-label", children }),
|
|
1974
|
+
endAdornment && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "fractal-sidebar__nav-item-end", children: endAdornment })
|
|
1778
1975
|
]
|
|
1779
1976
|
}
|
|
1780
1977
|
)
|
|
1781
1978
|
);
|
|
1782
1979
|
SidebarNavItem.displayName = "SidebarNavItem";
|
|
1783
1980
|
var SidebarFooter = React13.forwardRef(
|
|
1784
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1981
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, className: cn("fractal-sidebar__footer", className), ...props })
|
|
1785
1982
|
);
|
|
1786
1983
|
SidebarFooter.displayName = "SidebarFooter";
|
|
1787
1984
|
|
|
1788
1985
|
// src/components/SidePanel/SidePanel.tsx
|
|
1789
1986
|
var import_react_dom2 = require("react-dom");
|
|
1790
|
-
var
|
|
1791
|
-
var
|
|
1987
|
+
var import_fractal_icons11 = require("@mirror-physics/fractal-icons");
|
|
1988
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1792
1989
|
function SidePanel({ open, onClose, title, description, children, footer, size = "md", loading = false, loadingLabel = "Loading", className }) {
|
|
1793
1990
|
useEscapeDismiss(80, onClose, open);
|
|
1794
1991
|
if (!open) return null;
|
|
1795
1992
|
return (0, import_react_dom2.createPortal)(
|
|
1796
|
-
/* @__PURE__ */ (0,
|
|
1993
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "fractal-side-panel-overlay", onMouseDown: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1797
1994
|
"aside",
|
|
1798
1995
|
{
|
|
1799
1996
|
className: cn("fractal-side-panel", `fractal-side-panel--${size}`, className),
|
|
@@ -1802,15 +1999,15 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
1802
1999
|
role: "dialog",
|
|
1803
2000
|
onMouseDown: (event) => event.stopPropagation(),
|
|
1804
2001
|
children: [
|
|
1805
|
-
/* @__PURE__ */ (0,
|
|
1806
|
-
/* @__PURE__ */ (0,
|
|
1807
|
-
typeof title === "string" ? /* @__PURE__ */ (0,
|
|
1808
|
-
description && /* @__PURE__ */ (0,
|
|
2002
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("header", { className: "fractal-side-panel__header", children: [
|
|
2003
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "fractal-side-panel__heading", children: [
|
|
2004
|
+
typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h2", { className: "fractal-side-panel__title", children: title }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "fractal-side-panel__title", children: title }),
|
|
2005
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "fractal-side-panel__description", children: description })
|
|
1809
2006
|
] }),
|
|
1810
|
-
/* @__PURE__ */ (0,
|
|
2007
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: "fractal-side-panel__close", "aria-label": "Close panel", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_fractal_icons11.Close, { size: 18 }) })
|
|
1811
2008
|
] }),
|
|
1812
|
-
/* @__PURE__ */ (0,
|
|
1813
|
-
footer && /* @__PURE__ */ (0,
|
|
2009
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.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_runtime26.jsx)(UILoader, { label: loadingLabel }) : children }),
|
|
2010
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("footer", { className: "fractal-side-panel__footer", children: footer })
|
|
1814
2011
|
]
|
|
1815
2012
|
}
|
|
1816
2013
|
) }),
|
|
@@ -1820,17 +2017,17 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
1820
2017
|
|
|
1821
2018
|
// src/components/Textarea/Textarea.tsx
|
|
1822
2019
|
var React14 = __toESM(require("react"), 1);
|
|
1823
|
-
var
|
|
2020
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1824
2021
|
var Textarea = React14.forwardRef(
|
|
1825
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2022
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("textarea", { ref, className: cn("fractal-textarea", className), ...props })
|
|
1826
2023
|
);
|
|
1827
2024
|
Textarea.displayName = "Textarea";
|
|
1828
2025
|
|
|
1829
2026
|
// src/components/TextButton/TextButton.tsx
|
|
1830
2027
|
var React15 = __toESM(require("react"), 1);
|
|
1831
|
-
var
|
|
2028
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1832
2029
|
var TextButton = React15.forwardRef(
|
|
1833
|
-
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2030
|
+
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1834
2031
|
"button",
|
|
1835
2032
|
{
|
|
1836
2033
|
ref,
|
|
@@ -1838,9 +2035,9 @@ var TextButton = React15.forwardRef(
|
|
|
1838
2035
|
type: "button",
|
|
1839
2036
|
...props,
|
|
1840
2037
|
children: [
|
|
1841
|
-
icon && iconPosition === "start" && /* @__PURE__ */ (0,
|
|
1842
|
-
/* @__PURE__ */ (0,
|
|
1843
|
-
icon && iconPosition === "end" && /* @__PURE__ */ (0,
|
|
2038
|
+
icon && iconPosition === "start" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon }),
|
|
2039
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children }),
|
|
2040
|
+
icon && iconPosition === "end" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon })
|
|
1844
2041
|
]
|
|
1845
2042
|
}
|
|
1846
2043
|
)
|
|
@@ -1849,8 +2046,8 @@ TextButton.displayName = "TextButton";
|
|
|
1849
2046
|
|
|
1850
2047
|
// src/components/FileDropzone/FileDropzone.tsx
|
|
1851
2048
|
var React16 = __toESM(require("react"), 1);
|
|
1852
|
-
var
|
|
1853
|
-
var
|
|
2049
|
+
var import_fractal_icons12 = require("@mirror-physics/fractal-icons");
|
|
2050
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1854
2051
|
function FileDropzone({
|
|
1855
2052
|
files,
|
|
1856
2053
|
onFilesChange,
|
|
@@ -1870,8 +2067,8 @@ function FileDropzone({
|
|
|
1870
2067
|
if (additions.length === 0) return;
|
|
1871
2068
|
onFilesChange(multiple ? [...files, ...additions] : additions.slice(0, 1));
|
|
1872
2069
|
};
|
|
1873
|
-
return /* @__PURE__ */ (0,
|
|
1874
|
-
/* @__PURE__ */ (0,
|
|
2070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cn("fractal-file-dropzone", className), children: [
|
|
2071
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1875
2072
|
"input",
|
|
1876
2073
|
{
|
|
1877
2074
|
ref: inputRef,
|
|
@@ -1887,7 +2084,7 @@ function FileDropzone({
|
|
|
1887
2084
|
}
|
|
1888
2085
|
}
|
|
1889
2086
|
),
|
|
1890
|
-
/* @__PURE__ */ (0,
|
|
2087
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
1891
2088
|
"button",
|
|
1892
2089
|
{
|
|
1893
2090
|
className: "fractal-file-dropzone__target",
|
|
@@ -1910,18 +2107,18 @@ function FileDropzone({
|
|
|
1910
2107
|
addFiles(event.dataTransfer.files);
|
|
1911
2108
|
},
|
|
1912
2109
|
children: [
|
|
1913
|
-
/* @__PURE__ */ (0,
|
|
1914
|
-
/* @__PURE__ */ (0,
|
|
1915
|
-
/* @__PURE__ */ (0,
|
|
1916
|
-
description && /* @__PURE__ */ (0,
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_fractal_icons12.FileArrowUp, { "aria-hidden": "true", size: 20 }),
|
|
2111
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "fractal-file-dropzone__copy", children: [
|
|
2112
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "fractal-file-dropzone__title", children: title }),
|
|
2113
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "fractal-file-dropzone__description", children: description })
|
|
1917
2114
|
] })
|
|
1918
2115
|
]
|
|
1919
2116
|
}
|
|
1920
2117
|
),
|
|
1921
|
-
files.length > 0 && /* @__PURE__ */ (0,
|
|
1922
|
-
/* @__PURE__ */ (0,
|
|
1923
|
-
/* @__PURE__ */ (0,
|
|
1924
|
-
/* @__PURE__ */ (0,
|
|
2118
|
+
files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("ul", { className: "fractal-file-dropzone__files", "aria-label": "Attached files", children: files.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("li", { className: "fractal-file-dropzone__file", children: [
|
|
2119
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "fractal-file-dropzone__file-name", children: file.name }),
|
|
2120
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "fractal-file-dropzone__file-meta", children: formatFileSize(file.size) }),
|
|
2121
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1925
2122
|
"button",
|
|
1926
2123
|
{
|
|
1927
2124
|
className: "fractal-file-dropzone__remove",
|
|
@@ -1929,7 +2126,7 @@ function FileDropzone({
|
|
|
1929
2126
|
"aria-label": `Remove ${file.name}`,
|
|
1930
2127
|
disabled,
|
|
1931
2128
|
onClick: () => onFilesChange(files.filter((_, fileIndex) => fileIndex !== index)),
|
|
1932
|
-
children: /* @__PURE__ */ (0,
|
|
2129
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_fractal_icons12.Close, { "aria-hidden": "true", size: 14 })
|
|
1933
2130
|
}
|
|
1934
2131
|
)
|
|
1935
2132
|
] }, `${file.name}-${file.size}-${index}`)) })
|
|
@@ -1942,8 +2139,8 @@ function formatFileSize(bytes) {
|
|
|
1942
2139
|
}
|
|
1943
2140
|
|
|
1944
2141
|
// src/components/Pagination/Pagination.tsx
|
|
1945
|
-
var
|
|
1946
|
-
var
|
|
2142
|
+
var import_fractal_icons13 = require("@mirror-physics/fractal-icons");
|
|
2143
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1947
2144
|
function Pagination({
|
|
1948
2145
|
page,
|
|
1949
2146
|
pageSize,
|
|
@@ -1959,10 +2156,10 @@ function Pagination({
|
|
|
1959
2156
|
const start = totalItems === 0 ? 0 : (currentPage - 1) * pageSize + 1;
|
|
1960
2157
|
const end = Math.min(currentPage * pageSize, totalItems);
|
|
1961
2158
|
const canChangePageSize = pageSizeOptions != null && pageSizeOptions.length > 0 && onPageSizeChange != null;
|
|
1962
|
-
return /* @__PURE__ */ (0,
|
|
1963
|
-
/* @__PURE__ */ (0,
|
|
1964
|
-
/* @__PURE__ */ (0,
|
|
1965
|
-
canChangePageSize && /* @__PURE__ */ (0,
|
|
2159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("nav", { className: cn("fractal-pagination", className), "aria-label": ariaLabel, children: [
|
|
2160
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "fractal-pagination__summary", children: totalItems === 0 ? "No results" : `${start}-${end} of ${totalItems}` }),
|
|
2161
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "fractal-pagination__controls", children: [
|
|
2162
|
+
canChangePageSize && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1966
2163
|
Dropdown,
|
|
1967
2164
|
{
|
|
1968
2165
|
align: "right",
|
|
@@ -1979,7 +2176,7 @@ function Pagination({
|
|
|
1979
2176
|
triggerVariant: "tertiary"
|
|
1980
2177
|
}
|
|
1981
2178
|
),
|
|
1982
|
-
/* @__PURE__ */ (0,
|
|
2179
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1983
2180
|
"button",
|
|
1984
2181
|
{
|
|
1985
2182
|
className: "fractal-pagination__button",
|
|
@@ -1988,15 +2185,15 @@ function Pagination({
|
|
|
1988
2185
|
title: "Previous page",
|
|
1989
2186
|
disabled: currentPage === 1 || totalItems === 0,
|
|
1990
2187
|
onClick: () => onPageChange(currentPage - 1),
|
|
1991
|
-
children: /* @__PURE__ */ (0,
|
|
2188
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_fractal_icons13.ArrowLeft, { "aria-hidden": "true", size: 16 })
|
|
1992
2189
|
}
|
|
1993
2190
|
),
|
|
1994
|
-
/* @__PURE__ */ (0,
|
|
2191
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "fractal-pagination__page", "aria-current": "page", children: [
|
|
1995
2192
|
currentPage,
|
|
1996
2193
|
" of ",
|
|
1997
2194
|
totalPages
|
|
1998
2195
|
] }),
|
|
1999
|
-
/* @__PURE__ */ (0,
|
|
2196
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2000
2197
|
"button",
|
|
2001
2198
|
{
|
|
2002
2199
|
className: "fractal-pagination__button",
|
|
@@ -2005,7 +2202,7 @@ function Pagination({
|
|
|
2005
2202
|
title: "Next page",
|
|
2006
2203
|
disabled: currentPage === totalPages || totalItems === 0,
|
|
2007
2204
|
onClick: () => onPageChange(currentPage + 1),
|
|
2008
|
-
children: /* @__PURE__ */ (0,
|
|
2205
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_fractal_icons13.ArrowRight, { "aria-hidden": "true", size: 16 })
|
|
2009
2206
|
}
|
|
2010
2207
|
)
|
|
2011
2208
|
] })
|
|
@@ -2031,6 +2228,7 @@ function Pagination({
|
|
|
2031
2228
|
CheckboxGhost,
|
|
2032
2229
|
Chip,
|
|
2033
2230
|
ChipGhost,
|
|
2231
|
+
CodeBlock,
|
|
2034
2232
|
ContentSwitcher,
|
|
2035
2233
|
ContentSwitcherGhost,
|
|
2036
2234
|
ConversationGhost,
|