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