@mirror-physics/fractal-ui 0.2.0-next.26 → 0.2.0-next.28
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 +477 -195
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +423 -28
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +106 -5
- package/dist/index.d.ts +106 -5
- package/dist/index.js +433 -177
- package/dist/index.js.map +1 -1
- package/dist/tokens.css +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -329,28 +329,32 @@ Label.displayName = "Label";
|
|
|
329
329
|
|
|
330
330
|
// src/components/Alert/Alert.tsx
|
|
331
331
|
import * as React6 from "react";
|
|
332
|
+
import { CircleCheck, CircleClose, CircleInfo, Warning } from "@mirror-physics/fractal-icons";
|
|
332
333
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
333
334
|
var defaultIcons = {
|
|
334
|
-
default:
|
|
335
|
-
info:
|
|
336
|
-
success:
|
|
337
|
-
warning:
|
|
338
|
-
error:
|
|
335
|
+
default: CircleInfo,
|
|
336
|
+
info: CircleInfo,
|
|
337
|
+
success: CircleCheck,
|
|
338
|
+
warning: Warning,
|
|
339
|
+
error: CircleClose
|
|
339
340
|
};
|
|
340
341
|
var Alert = React6.forwardRef(
|
|
341
|
-
({ className, variant = "default", icon, children, ...props }, ref) =>
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
342
|
+
({ className, variant = "default", icon, children, ...props }, ref) => {
|
|
343
|
+
const DefaultIcon = defaultIcons[variant];
|
|
344
|
+
return /* @__PURE__ */ jsxs4(
|
|
345
|
+
"div",
|
|
346
|
+
{
|
|
347
|
+
ref,
|
|
348
|
+
role: "alert",
|
|
349
|
+
className: cn("fractal-alert", `fractal-alert--${variant}`, className),
|
|
350
|
+
...props,
|
|
351
|
+
children: [
|
|
352
|
+
/* @__PURE__ */ jsx5("span", { className: "fractal-alert-icon", "aria-hidden": true, children: icon ?? /* @__PURE__ */ jsx5(DefaultIcon, { size: 18 }) }),
|
|
353
|
+
/* @__PURE__ */ jsx5("div", { className: "fractal-alert-content", children })
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
);
|
|
357
|
+
}
|
|
354
358
|
);
|
|
355
359
|
Alert.displayName = "Alert";
|
|
356
360
|
var AlertTitle = React6.forwardRef(
|
|
@@ -434,27 +438,72 @@ function useEscapeDismiss(priority, handler, enabled = true) {
|
|
|
434
438
|
}, [priority, enabled]);
|
|
435
439
|
}
|
|
436
440
|
|
|
437
|
-
// src/components/
|
|
441
|
+
// src/components/UILoader/UILoader.tsx
|
|
442
|
+
import { useId } from "react";
|
|
438
443
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
439
|
-
var
|
|
440
|
-
|
|
444
|
+
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";
|
|
445
|
+
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";
|
|
446
|
+
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";
|
|
447
|
+
function UILoader({ size = 48, tone = "neutral", className, style, label = "Loading", ariaHidden = false }) {
|
|
448
|
+
const rawId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
|
|
449
|
+
const clipId = `fractal-ui-loader-clip-${rawId}`;
|
|
450
|
+
const gradientId = `fractal-ui-loader-gradient-${rawId}`;
|
|
451
|
+
const height = typeof size === "number" ? `${size}px` : size;
|
|
452
|
+
return /* @__PURE__ */ jsx7(
|
|
453
|
+
"span",
|
|
454
|
+
{
|
|
455
|
+
"aria-hidden": ariaHidden || void 0,
|
|
456
|
+
"aria-label": ariaHidden ? void 0 : label,
|
|
457
|
+
className: cn("fractal-ui-loader", `fractal-ui-loader--${tone}`, className),
|
|
458
|
+
role: ariaHidden ? void 0 : "status",
|
|
459
|
+
style,
|
|
460
|
+
children: /* @__PURE__ */ jsxs6("svg", { "aria-hidden": "true", fill: "none", viewBox: "0 0 144 92", style: { height, width: "auto" }, children: [
|
|
461
|
+
/* @__PURE__ */ jsxs6("defs", { children: [
|
|
462
|
+
/* @__PURE__ */ jsxs6("linearGradient", { id: gradientId, x1: "59", x2: "94.3", y1: "0", y2: "89.1", gradientUnits: "userSpaceOnUse", children: [
|
|
463
|
+
/* @__PURE__ */ jsx7("stop", { className: "fractal-ui-loader__stop-start", offset: "0" }),
|
|
464
|
+
/* @__PURE__ */ jsx7("stop", { className: "fractal-ui-loader__stop-end", offset: "1" })
|
|
465
|
+
] }),
|
|
466
|
+
/* @__PURE__ */ jsxs6("linearGradient", { id: `${gradientId}-shine`, x1: "0", x2: "1", y1: "0", y2: "0", children: [
|
|
467
|
+
/* @__PURE__ */ jsx7("stop", { offset: "0.4", stopColor: "white", stopOpacity: "0" }),
|
|
468
|
+
/* @__PURE__ */ jsx7("stop", { offset: "0.5", stopColor: "white", stopOpacity: "0.62" }),
|
|
469
|
+
/* @__PURE__ */ jsx7("stop", { offset: "0.6", stopColor: "white", stopOpacity: "0" })
|
|
470
|
+
] }),
|
|
471
|
+
/* @__PURE__ */ jsxs6("clipPath", { id: clipId, children: [
|
|
472
|
+
/* @__PURE__ */ jsx7("path", { d: LEFT }),
|
|
473
|
+
/* @__PURE__ */ jsx7("path", { d: CENTER }),
|
|
474
|
+
/* @__PURE__ */ jsx7("path", { d: RIGHT })
|
|
475
|
+
] })
|
|
476
|
+
] }),
|
|
477
|
+
/* @__PURE__ */ jsx7("path", { d: CENTER, fill: `url(#${gradientId})` }),
|
|
478
|
+
/* @__PURE__ */ jsx7("path", { d: RIGHT, fill: `url(#${gradientId})` }),
|
|
479
|
+
/* @__PURE__ */ jsx7("path", { d: LEFT, fill: `url(#${gradientId})` }),
|
|
480
|
+
/* @__PURE__ */ jsx7("g", { clipPath: `url(#${clipId})`, children: /* @__PURE__ */ jsx7("g", { className: "fractal-ui-loader__shine-axis", transform: "translate(72 46) rotate(68.4)", children: /* @__PURE__ */ jsx7("rect", { className: "fractal-ui-loader__shine", x: "-160", y: "-100", width: "320", height: "200", fill: `url(#${gradientId}-shine)` }) }) })
|
|
481
|
+
] })
|
|
482
|
+
}
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// src/components/Modal/Modal.tsx
|
|
487
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
488
|
+
var CloseIcon = () => /* @__PURE__ */ jsx8("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx8("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
489
|
+
function Modal({ open, onClose, title, children, danger, warn, footer, noClose, size = "sm", loading = false, loadingLabel = "Loading", className }) {
|
|
441
490
|
useEscapeDismiss(80, onClose, open && !noClose);
|
|
442
491
|
if (!open) return null;
|
|
443
492
|
const sizeClass = `fractal-modal-panel--${size}`;
|
|
444
493
|
const accentClass = danger ? "fractal-modal-panel--danger" : warn ? "fractal-modal-panel--warn" : "";
|
|
445
494
|
return createPortal(
|
|
446
|
-
/* @__PURE__ */
|
|
495
|
+
/* @__PURE__ */ jsx8("div", { className: "fractal-modal-overlay", onClick: noClose ? void 0 : onClose, children: /* @__PURE__ */ jsxs7(
|
|
447
496
|
"div",
|
|
448
497
|
{
|
|
449
498
|
className: cn("fractal-modal-panel", sizeClass, accentClass, className),
|
|
450
499
|
onClick: (e) => e.stopPropagation(),
|
|
451
500
|
children: [
|
|
452
|
-
/* @__PURE__ */
|
|
453
|
-
/* @__PURE__ */
|
|
454
|
-
!noClose && /* @__PURE__ */
|
|
501
|
+
/* @__PURE__ */ jsxs7("div", { className: "fractal-modal-title-row", children: [
|
|
502
|
+
/* @__PURE__ */ jsx8("h3", { className: cn("fractal-modal-title", danger && "fractal-modal-title--danger", warn && "fractal-modal-title--warn"), children: title }),
|
|
503
|
+
!noClose && /* @__PURE__ */ jsx8("button", { type: "button", onClick: onClose, title: "Close", className: "fractal-modal-close", children: /* @__PURE__ */ jsx8(CloseIcon, {}) })
|
|
455
504
|
] }),
|
|
456
|
-
/* @__PURE__ */
|
|
457
|
-
footer && /* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ jsx8("div", { "aria-busy": loading || void 0, className: cn("fractal-modal-body", size === "lg" && "fractal-modal-body--lg", loading && "fractal-modal-body--loading"), children: loading ? /* @__PURE__ */ jsx8(UILoader, { label: loadingLabel }) : children }),
|
|
506
|
+
footer && /* @__PURE__ */ jsx8("div", { className: "fractal-modal-footer", children: footer })
|
|
458
507
|
]
|
|
459
508
|
}
|
|
460
509
|
) }),
|
|
@@ -463,17 +512,17 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
463
512
|
}
|
|
464
513
|
|
|
465
514
|
// src/components/DataTable/DataTable.tsx
|
|
466
|
-
import { jsx as
|
|
515
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
467
516
|
function DataTable({ columns, data, emptyMessage, header, size = "md", className }) {
|
|
468
|
-
return /* @__PURE__ */
|
|
469
|
-
header && /* @__PURE__ */
|
|
470
|
-
data.length === 0 ? /* @__PURE__ */
|
|
471
|
-
/* @__PURE__ */
|
|
472
|
-
/* @__PURE__ */
|
|
517
|
+
return /* @__PURE__ */ jsx9("div", { className: cn("fractal-datatable", `fractal-datatable--${size}`, className), children: /* @__PURE__ */ jsxs8("div", { className: "fractal-datatable-surface", children: [
|
|
518
|
+
header && /* @__PURE__ */ jsx9("div", { className: "fractal-datatable-header", children: header }),
|
|
519
|
+
data.length === 0 ? /* @__PURE__ */ jsx9("div", { className: "fractal-datatable-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ jsxs8("table", { className: "fractal-datatable-table", children: [
|
|
520
|
+
/* @__PURE__ */ jsx9("thead", { children: /* @__PURE__ */ jsx9("tr", { className: "fractal-datatable-thead-row", children: columns.map((col) => /* @__PURE__ */ jsx9("th", { className: "fractal-datatable-th", style: { width: col.width }, children: col.header }, col.key)) }) }),
|
|
521
|
+
/* @__PURE__ */ jsx9("tbody", { children: data.map((row, rowIndex) => /* @__PURE__ */ jsx9(
|
|
473
522
|
"tr",
|
|
474
523
|
{
|
|
475
524
|
className: "fractal-datatable-row",
|
|
476
|
-
children: columns.map((col) => /* @__PURE__ */
|
|
525
|
+
children: columns.map((col) => /* @__PURE__ */ jsx9("td", { className: "fractal-datatable-td", style: { width: col.width }, children: col.render(row, rowIndex) }, col.key))
|
|
477
526
|
},
|
|
478
527
|
rowIndex
|
|
479
528
|
)) })
|
|
@@ -484,7 +533,7 @@ function DataTable({ columns, data, emptyMessage, header, size = "md", className
|
|
|
484
533
|
// src/components/Dropdown/Dropdown.tsx
|
|
485
534
|
import * as React7 from "react";
|
|
486
535
|
import { ChevronDown, ChevronUp } from "@mirror-physics/fractal-icons";
|
|
487
|
-
import { Fragment as Fragment2, jsx as
|
|
536
|
+
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
488
537
|
var MARGIN = 4;
|
|
489
538
|
function Dropdown({
|
|
490
539
|
items,
|
|
@@ -501,7 +550,8 @@ function Dropdown({
|
|
|
501
550
|
className,
|
|
502
551
|
triggerClassName,
|
|
503
552
|
panelClassName,
|
|
504
|
-
closeOnSelect = true
|
|
553
|
+
closeOnSelect = true,
|
|
554
|
+
disabled = false
|
|
505
555
|
}) {
|
|
506
556
|
const [open, setOpen] = React7.useState(false);
|
|
507
557
|
const triggerRef = React7.useRef(null);
|
|
@@ -559,12 +609,13 @@ function Dropdown({
|
|
|
559
609
|
document.addEventListener("mousedown", handleClickOutside);
|
|
560
610
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
561
611
|
}, [open]);
|
|
562
|
-
return /* @__PURE__ */
|
|
563
|
-
/* @__PURE__ */
|
|
612
|
+
return /* @__PURE__ */ jsxs9("div", { className: cn("fractal-dropdown", className), children: [
|
|
613
|
+
/* @__PURE__ */ jsxs9(
|
|
564
614
|
"button",
|
|
565
615
|
{
|
|
566
616
|
ref: triggerRef,
|
|
567
617
|
type: "button",
|
|
618
|
+
disabled,
|
|
568
619
|
"aria-haspopup": "listbox",
|
|
569
620
|
"aria-expanded": open,
|
|
570
621
|
"aria-label": triggerLabel,
|
|
@@ -576,15 +627,15 @@ function Dropdown({
|
|
|
576
627
|
triggerClassName
|
|
577
628
|
),
|
|
578
629
|
children: [
|
|
579
|
-
triggerContent != null ? triggerContent : /* @__PURE__ */
|
|
580
|
-
selected.icon != null && /* @__PURE__ */
|
|
581
|
-
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */
|
|
630
|
+
triggerContent != null ? triggerContent : /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
631
|
+
selected.icon != null && /* @__PURE__ */ jsx10("span", { className: "fractal-dropdown-icon fractal-dropdown-icon--trigger", children: selected.icon }),
|
|
632
|
+
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */ jsx10("span", { className: "fractal-dropdown-selected-text", children: selected.description })
|
|
582
633
|
] }),
|
|
583
|
-
!noChevron && /* @__PURE__ */
|
|
634
|
+
!noChevron && /* @__PURE__ */ jsx10("span", { className: "fractal-dropdown-chevron", "aria-hidden": true, children: /* @__PURE__ */ jsx10(ChevronIcon, { size: size === "sm" ? 14 : 16 }) })
|
|
584
635
|
]
|
|
585
636
|
}
|
|
586
637
|
),
|
|
587
|
-
open && /* @__PURE__ */
|
|
638
|
+
open && /* @__PURE__ */ jsxs9(
|
|
588
639
|
"div",
|
|
589
640
|
{
|
|
590
641
|
ref: panelRef,
|
|
@@ -593,21 +644,21 @@ function Dropdown({
|
|
|
593
644
|
className: cn("fractal-dropdown-panel", `fractal-dropdown-panel--${size}`, panelClassName),
|
|
594
645
|
style: panelStyle,
|
|
595
646
|
children: [
|
|
596
|
-
label != null && /* @__PURE__ */
|
|
647
|
+
label != null && /* @__PURE__ */ jsx10("div", { className: "fractal-dropdown-label", children: label }),
|
|
597
648
|
visibleItems.map((item, index) => {
|
|
598
|
-
const topDivider = item.border === "top" ? /* @__PURE__ */
|
|
599
|
-
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */
|
|
649
|
+
const topDivider = item.border === "top" ? /* @__PURE__ */ jsx10("div", { className: "fractal-dropdown-separator" }) : null;
|
|
650
|
+
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */ jsx10("div", { className: "fractal-dropdown-separator" }) : null;
|
|
600
651
|
if (item.kind === "header") {
|
|
601
|
-
return /* @__PURE__ */
|
|
652
|
+
return /* @__PURE__ */ jsxs9(React7.Fragment, { children: [
|
|
602
653
|
topDivider,
|
|
603
|
-
/* @__PURE__ */
|
|
654
|
+
/* @__PURE__ */ jsx10("div", { role: "presentation", className: "fractal-dropdown-label", children: item.description }),
|
|
604
655
|
bottomDivider
|
|
605
656
|
] }, `header-${index}`);
|
|
606
657
|
}
|
|
607
658
|
const isSelected = item.value === selectedValue;
|
|
608
|
-
return /* @__PURE__ */
|
|
659
|
+
return /* @__PURE__ */ jsxs9(React7.Fragment, { children: [
|
|
609
660
|
topDivider,
|
|
610
|
-
/* @__PURE__ */
|
|
661
|
+
/* @__PURE__ */ jsxs9(
|
|
611
662
|
"button",
|
|
612
663
|
{
|
|
613
664
|
type: "button",
|
|
@@ -619,9 +670,9 @@ function Dropdown({
|
|
|
619
670
|
},
|
|
620
671
|
className: "fractal-dropdown-option",
|
|
621
672
|
children: [
|
|
622
|
-
item.icon != null && /* @__PURE__ */
|
|
623
|
-
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */
|
|
624
|
-
item.trailing != null && /* @__PURE__ */
|
|
673
|
+
item.icon != null && /* @__PURE__ */ jsx10("span", { className: "fractal-dropdown-icon", children: item.icon }),
|
|
674
|
+
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */ jsx10("span", { className: "fractal-dropdown-option-text", children: item.description }),
|
|
675
|
+
item.trailing != null && /* @__PURE__ */ jsx10("span", { className: "fractal-dropdown-trailing", children: item.trailing })
|
|
625
676
|
]
|
|
626
677
|
}
|
|
627
678
|
),
|
|
@@ -636,9 +687,9 @@ function Dropdown({
|
|
|
636
687
|
|
|
637
688
|
// src/components/Link/Link.tsx
|
|
638
689
|
import * as React8 from "react";
|
|
639
|
-
import { jsx as
|
|
690
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
640
691
|
var Link = React8.forwardRef(
|
|
641
|
-
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */
|
|
692
|
+
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
642
693
|
"a",
|
|
643
694
|
{
|
|
644
695
|
ref,
|
|
@@ -651,9 +702,9 @@ Link.displayName = "Link";
|
|
|
651
702
|
|
|
652
703
|
// src/components/Chip/Chip.tsx
|
|
653
704
|
import * as React9 from "react";
|
|
654
|
-
import { jsx as
|
|
705
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
655
706
|
var Chip = React9.forwardRef(
|
|
656
|
-
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */
|
|
707
|
+
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
657
708
|
"span",
|
|
658
709
|
{
|
|
659
710
|
ref,
|
|
@@ -666,9 +717,9 @@ Chip.displayName = "Chip";
|
|
|
666
717
|
|
|
667
718
|
// src/components/Checkbox/Checkbox.tsx
|
|
668
719
|
import { Checkbox as CheckboxIcon, CheckboxChecked } from "@mirror-physics/fractal-icons";
|
|
669
|
-
import { jsx as
|
|
720
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
670
721
|
function Checkbox({ checked, onCheckedChange, className, disabled, onClick, onKeyDown, ...props }) {
|
|
671
|
-
return /* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ jsx13(
|
|
672
723
|
"button",
|
|
673
724
|
{
|
|
674
725
|
...props,
|
|
@@ -685,7 +736,7 @@ function Checkbox({ checked, onCheckedChange, className, disabled, onClick, onKe
|
|
|
685
736
|
onKeyDown?.(event);
|
|
686
737
|
if (event.key === " " || event.key === "Enter") event.stopPropagation();
|
|
687
738
|
},
|
|
688
|
-
children: checked ? /* @__PURE__ */
|
|
739
|
+
children: checked ? /* @__PURE__ */ jsx13(CheckboxChecked, { "aria-hidden": "true", size: 18 }) : /* @__PURE__ */ jsx13(CheckboxIcon, { "aria-hidden": "true", size: 18 })
|
|
689
740
|
}
|
|
690
741
|
);
|
|
691
742
|
}
|
|
@@ -693,7 +744,7 @@ function Checkbox({ checked, onCheckedChange, className, disabled, onClick, onKe
|
|
|
693
744
|
// src/components/SortableTable/SortableTable.tsx
|
|
694
745
|
import { useMemo, useState as useState3 } from "react";
|
|
695
746
|
import { ArrowUp, ArrowDown, ArrowsUpDown } from "@mirror-physics/fractal-icons";
|
|
696
|
-
import { jsx as
|
|
747
|
+
import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
697
748
|
function SortableTable({
|
|
698
749
|
columns,
|
|
699
750
|
data,
|
|
@@ -753,12 +804,12 @@ function SortableTable({
|
|
|
753
804
|
nextDirection = baselineKey === key && baselineDirection ? baselineDirection : "asc";
|
|
754
805
|
} else if (activeKey !== key) {
|
|
755
806
|
nextDirection = "asc";
|
|
807
|
+
} else if (baselineKey === key && baselineDirection) {
|
|
808
|
+
nextDirection = activeDirection === baselineDirection ? baselineDirection === "asc" ? "desc" : "asc" : null;
|
|
756
809
|
} else if (activeDirection === "asc") {
|
|
757
810
|
nextDirection = "desc";
|
|
758
|
-
} else if (activeDirection === "desc") {
|
|
759
|
-
nextDirection = null;
|
|
760
811
|
} else {
|
|
761
|
-
nextDirection =
|
|
812
|
+
nextDirection = null;
|
|
762
813
|
}
|
|
763
814
|
const nextKey = nextDirection === null ? null : key;
|
|
764
815
|
if (isControlled) {
|
|
@@ -769,13 +820,13 @@ function SortableTable({
|
|
|
769
820
|
onSortChange?.(nextKey, nextDirection);
|
|
770
821
|
}
|
|
771
822
|
};
|
|
772
|
-
return /* @__PURE__ */
|
|
773
|
-
header && /* @__PURE__ */
|
|
774
|
-
sorted.length === 0 ? /* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
823
|
+
return /* @__PURE__ */ jsx14("div", { className: cn("fractal-sortable-table", `fractal-sortable-table--${size}`, embedded && "fractal-sortable-table--embedded", className), children: /* @__PURE__ */ jsxs10("div", { className: "fractal-sortable-table-surface", children: [
|
|
824
|
+
header && /* @__PURE__ */ jsx14("div", { className: "fractal-sortable-table-header", children: header }),
|
|
825
|
+
sorted.length === 0 ? /* @__PURE__ */ jsx14("div", { className: "fractal-sortable-table-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ jsxs10("table", { className: "fractal-sortable-table-table", children: [
|
|
826
|
+
/* @__PURE__ */ jsx14("thead", { children: /* @__PURE__ */ jsx14("tr", { className: "fractal-sortable-table-thead-row", children: columns.map((col) => {
|
|
776
827
|
const isActive = activeKey === col.key && activeDirection !== null;
|
|
777
828
|
if (!col.sortable) {
|
|
778
|
-
return /* @__PURE__ */
|
|
829
|
+
return /* @__PURE__ */ jsx14(
|
|
779
830
|
"th",
|
|
780
831
|
{
|
|
781
832
|
className: "fractal-sortable-table-th",
|
|
@@ -785,12 +836,12 @@ function SortableTable({
|
|
|
785
836
|
col.key
|
|
786
837
|
);
|
|
787
838
|
}
|
|
788
|
-
return /* @__PURE__ */
|
|
839
|
+
return /* @__PURE__ */ jsx14(
|
|
789
840
|
"th",
|
|
790
841
|
{
|
|
791
842
|
className: "fractal-sortable-table-th fractal-sortable-table-th--sortable",
|
|
792
843
|
style: { width: col.width },
|
|
793
|
-
children: /* @__PURE__ */
|
|
844
|
+
children: /* @__PURE__ */ jsxs10(
|
|
794
845
|
"button",
|
|
795
846
|
{
|
|
796
847
|
type: "button",
|
|
@@ -801,8 +852,8 @@ function SortableTable({
|
|
|
801
852
|
onClick: () => handleSortClick(col.key),
|
|
802
853
|
"aria-sort": isActive ? activeDirection === "asc" ? "ascending" : "descending" : "none",
|
|
803
854
|
children: [
|
|
804
|
-
/* @__PURE__ */
|
|
805
|
-
/* @__PURE__ */
|
|
855
|
+
/* @__PURE__ */ jsx14("span", { children: col.header }),
|
|
856
|
+
/* @__PURE__ */ jsx14("span", { className: "fractal-sortable-table-sort-icon", "aria-hidden": "true", children: isActive && activeDirection === "asc" ? /* @__PURE__ */ jsx14(ArrowUp, { size: 14 }) : isActive && activeDirection === "desc" ? /* @__PURE__ */ jsx14(ArrowDown, { size: 14 }) : /* @__PURE__ */ jsx14(ArrowsUpDown, { size: 14 }) })
|
|
806
857
|
]
|
|
807
858
|
}
|
|
808
859
|
)
|
|
@@ -810,13 +861,13 @@ function SortableTable({
|
|
|
810
861
|
col.key
|
|
811
862
|
);
|
|
812
863
|
}) }) }),
|
|
813
|
-
/* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ jsx14("tbody", { children: sorted.map((row, rowIndex) => {
|
|
814
865
|
const highlighted = highlightRow?.(row, rowIndex) ?? false;
|
|
815
866
|
const action = rowAction ? {
|
|
816
867
|
label: rowAction.label(row, rowIndex),
|
|
817
868
|
icon: rowAction.icon(row, rowIndex)
|
|
818
869
|
} : null;
|
|
819
|
-
return /* @__PURE__ */
|
|
870
|
+
return /* @__PURE__ */ jsx14(
|
|
820
871
|
"tr",
|
|
821
872
|
{
|
|
822
873
|
className: cn(
|
|
@@ -834,7 +885,7 @@ function SortableTable({
|
|
|
834
885
|
"aria-label": action?.label,
|
|
835
886
|
role: onRowClick ? "button" : void 0,
|
|
836
887
|
tabIndex: onRowClick ? 0 : void 0,
|
|
837
|
-
children: columns.map((col, columnIndex) => /* @__PURE__ */
|
|
888
|
+
children: columns.map((col, columnIndex) => /* @__PURE__ */ jsxs10(
|
|
838
889
|
"td",
|
|
839
890
|
{
|
|
840
891
|
className: cn(
|
|
@@ -844,7 +895,7 @@ function SortableTable({
|
|
|
844
895
|
style: { width: col.width, textAlign: col.align ?? "left" },
|
|
845
896
|
children: [
|
|
846
897
|
col.render(row, rowIndex),
|
|
847
|
-
action && columnIndex === columns.length - 1 && /* @__PURE__ */
|
|
898
|
+
action && columnIndex === columns.length - 1 && /* @__PURE__ */ jsx14("span", { className: "fractal-sortable-table-row-action", "aria-hidden": "true", children: /* @__PURE__ */ jsx14("span", { className: "fractal-sortable-table-row-action__icon", children: action.icon }) })
|
|
848
899
|
]
|
|
849
900
|
},
|
|
850
901
|
col.key
|
|
@@ -858,8 +909,8 @@ function SortableTable({
|
|
|
858
909
|
}
|
|
859
910
|
|
|
860
911
|
// src/components/Tabs/Tabs.tsx
|
|
861
|
-
import { useId, useLayoutEffect as useLayoutEffect2, useRef as useRef3, useState as useState4 } from "react";
|
|
862
|
-
import { jsx as
|
|
912
|
+
import { useId as useId2, useLayoutEffect as useLayoutEffect2, useRef as useRef3, useState as useState4 } from "react";
|
|
913
|
+
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
863
914
|
function Tabs({
|
|
864
915
|
items,
|
|
865
916
|
defaultValue,
|
|
@@ -869,7 +920,7 @@ function Tabs({
|
|
|
869
920
|
ariaLabel,
|
|
870
921
|
divider = false
|
|
871
922
|
}) {
|
|
872
|
-
const reactId =
|
|
923
|
+
const reactId = useId2();
|
|
873
924
|
const [internalValue, setInternalValue] = useState4(
|
|
874
925
|
defaultValue ?? items.find((i) => !i.disabled)?.id ?? items[0]?.id ?? ""
|
|
875
926
|
);
|
|
@@ -929,8 +980,8 @@ function Tabs({
|
|
|
929
980
|
selectTab(nextId2);
|
|
930
981
|
requestAnimationFrame(() => tabRefs.current[nextId2]?.focus());
|
|
931
982
|
};
|
|
932
|
-
return /* @__PURE__ */
|
|
933
|
-
/* @__PURE__ */
|
|
983
|
+
return /* @__PURE__ */ jsxs11("div", { className: cn("fractal-tabs", divider && "fractal-tabs--divider", className), children: [
|
|
984
|
+
/* @__PURE__ */ jsx15(
|
|
934
985
|
"div",
|
|
935
986
|
{
|
|
936
987
|
ref: tabListRef,
|
|
@@ -943,7 +994,7 @@ function Tabs({
|
|
|
943
994
|
const isActive = item.id === activeId;
|
|
944
995
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
945
996
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
946
|
-
return /* @__PURE__ */
|
|
997
|
+
return /* @__PURE__ */ jsx15(
|
|
947
998
|
"button",
|
|
948
999
|
{
|
|
949
1000
|
ref: (el) => {
|
|
@@ -974,7 +1025,7 @@ function Tabs({
|
|
|
974
1025
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
975
1026
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
976
1027
|
const isActive = item.id === activeId;
|
|
977
|
-
return /* @__PURE__ */
|
|
1028
|
+
return /* @__PURE__ */ jsx15(
|
|
978
1029
|
"div",
|
|
979
1030
|
{
|
|
980
1031
|
id: panelId,
|
|
@@ -992,9 +1043,36 @@ function Tabs({
|
|
|
992
1043
|
|
|
993
1044
|
// src/components/ContentSwitcher/ContentSwitcher.tsx
|
|
994
1045
|
import * as React10 from "react";
|
|
995
|
-
import { jsx as
|
|
1046
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
996
1047
|
function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = false, className }) {
|
|
1048
|
+
const switcherRef = React10.useRef(null);
|
|
997
1049
|
const buttonRefs = React10.useRef([]);
|
|
1050
|
+
const activeIndex = items.findIndex((item) => item.value === value);
|
|
1051
|
+
React10.useLayoutEffect(() => {
|
|
1052
|
+
const switcher = switcherRef.current;
|
|
1053
|
+
const activeButton = buttonRefs.current[activeIndex];
|
|
1054
|
+
if (!switcher || !activeButton) {
|
|
1055
|
+
switcher?.removeAttribute("data-indicator-ready");
|
|
1056
|
+
return;
|
|
1057
|
+
}
|
|
1058
|
+
const updateIndicator = () => {
|
|
1059
|
+
const switcherRect = switcher.getBoundingClientRect();
|
|
1060
|
+
const activeButtonRect = activeButton.getBoundingClientRect();
|
|
1061
|
+
switcher.style.setProperty("--fractal-content-switcher-indicator-x", `${activeButtonRect.left - switcherRect.left - switcher.clientLeft}px`);
|
|
1062
|
+
switcher.style.setProperty("--fractal-content-switcher-indicator-y", `${activeButtonRect.top - switcherRect.top - switcher.clientTop}px`);
|
|
1063
|
+
switcher.style.setProperty("--fractal-content-switcher-indicator-width", `${activeButtonRect.width}px`);
|
|
1064
|
+
switcher.style.setProperty("--fractal-content-switcher-indicator-height", `${activeButtonRect.height}px`);
|
|
1065
|
+
switcher.setAttribute("data-indicator-ready", "true");
|
|
1066
|
+
};
|
|
1067
|
+
updateIndicator();
|
|
1068
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
1069
|
+
const resizeObserver = new ResizeObserver(updateIndicator);
|
|
1070
|
+
resizeObserver.observe(switcher);
|
|
1071
|
+
buttonRefs.current.forEach((button) => {
|
|
1072
|
+
if (button) resizeObserver.observe(button);
|
|
1073
|
+
});
|
|
1074
|
+
return () => resizeObserver.disconnect();
|
|
1075
|
+
}, [activeIndex, items.length]);
|
|
998
1076
|
const moveFocus = (index, direction) => {
|
|
999
1077
|
let nextIndex = index;
|
|
1000
1078
|
do {
|
|
@@ -1005,40 +1083,52 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1005
1083
|
onValueChange(items[nextIndex].value);
|
|
1006
1084
|
}
|
|
1007
1085
|
};
|
|
1008
|
-
return /* @__PURE__ */
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
"
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1086
|
+
return /* @__PURE__ */ jsxs12(
|
|
1087
|
+
"div",
|
|
1088
|
+
{
|
|
1089
|
+
className: cn("fractal-content-switcher", fullWidth && "fractal-content-switcher--full-width", className),
|
|
1090
|
+
role: "group",
|
|
1091
|
+
"aria-label": ariaLabel,
|
|
1092
|
+
ref: switcherRef,
|
|
1093
|
+
children: [
|
|
1094
|
+
/* @__PURE__ */ jsx16("span", { className: "fractal-content-switcher__indicator", "aria-hidden": true }),
|
|
1095
|
+
items.map((item, index) => {
|
|
1096
|
+
const active = item.value === value;
|
|
1097
|
+
return /* @__PURE__ */ jsx16(
|
|
1098
|
+
"button",
|
|
1099
|
+
{
|
|
1100
|
+
className: cn("fractal-content-switcher__item", active && "fractal-content-switcher__item--active"),
|
|
1101
|
+
type: "button",
|
|
1102
|
+
"aria-pressed": active,
|
|
1103
|
+
disabled: item.disabled,
|
|
1104
|
+
onClick: () => onValueChange(item.value),
|
|
1105
|
+
onKeyDown: (event) => {
|
|
1106
|
+
if (event.key === "ArrowRight") {
|
|
1107
|
+
event.preventDefault();
|
|
1108
|
+
moveFocus(index, 1);
|
|
1109
|
+
}
|
|
1110
|
+
if (event.key === "ArrowLeft") {
|
|
1111
|
+
event.preventDefault();
|
|
1112
|
+
moveFocus(index, -1);
|
|
1113
|
+
}
|
|
1114
|
+
},
|
|
1115
|
+
ref: (element) => {
|
|
1116
|
+
buttonRefs.current[index] = element;
|
|
1117
|
+
},
|
|
1118
|
+
children: item.label
|
|
1119
|
+
},
|
|
1120
|
+
item.value
|
|
1121
|
+
);
|
|
1122
|
+
})
|
|
1123
|
+
]
|
|
1124
|
+
}
|
|
1125
|
+
);
|
|
1036
1126
|
}
|
|
1037
1127
|
|
|
1038
1128
|
// src/components/Disclosure/Disclosure.tsx
|
|
1039
|
-
import { useId as
|
|
1129
|
+
import { useId as useId3, useState as useState5 } from "react";
|
|
1040
1130
|
import { ChevronRight, ChevronDown as ChevronDown2 } from "@mirror-physics/fractal-icons";
|
|
1041
|
-
import { jsx as
|
|
1131
|
+
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1042
1132
|
function Disclosure({
|
|
1043
1133
|
title,
|
|
1044
1134
|
meta,
|
|
@@ -1050,7 +1140,7 @@ function Disclosure({
|
|
|
1050
1140
|
className,
|
|
1051
1141
|
variant = "card"
|
|
1052
1142
|
}) {
|
|
1053
|
-
const reactId =
|
|
1143
|
+
const reactId = useId3();
|
|
1054
1144
|
const headerId = `${reactId}-header`;
|
|
1055
1145
|
const panelId = `${reactId}-panel`;
|
|
1056
1146
|
const [internalOpen, setInternalOpen] = useState5(defaultOpen);
|
|
@@ -1066,7 +1156,7 @@ function Disclosure({
|
|
|
1066
1156
|
onOpenChange?.(next);
|
|
1067
1157
|
}
|
|
1068
1158
|
};
|
|
1069
|
-
return /* @__PURE__ */
|
|
1159
|
+
return /* @__PURE__ */ jsxs13(
|
|
1070
1160
|
"div",
|
|
1071
1161
|
{
|
|
1072
1162
|
className: cn(
|
|
@@ -1077,7 +1167,7 @@ function Disclosure({
|
|
|
1077
1167
|
className
|
|
1078
1168
|
),
|
|
1079
1169
|
children: [
|
|
1080
|
-
/* @__PURE__ */
|
|
1170
|
+
/* @__PURE__ */ jsxs13(
|
|
1081
1171
|
"button",
|
|
1082
1172
|
{
|
|
1083
1173
|
type: "button",
|
|
@@ -1088,13 +1178,13 @@ function Disclosure({
|
|
|
1088
1178
|
disabled,
|
|
1089
1179
|
onClick: toggle,
|
|
1090
1180
|
children: [
|
|
1091
|
-
/* @__PURE__ */
|
|
1092
|
-
/* @__PURE__ */
|
|
1093
|
-
meta && /* @__PURE__ */
|
|
1181
|
+
/* @__PURE__ */ jsx17("span", { className: "fractal-disclosure-icon", "aria-hidden": "true", children: isOpen ? /* @__PURE__ */ jsx17(ChevronDown2, { size: 16 }) : /* @__PURE__ */ jsx17(ChevronRight, { size: 16 }) }),
|
|
1182
|
+
/* @__PURE__ */ jsx17("span", { className: "fractal-disclosure-title", children: title }),
|
|
1183
|
+
meta && /* @__PURE__ */ jsx17("span", { className: "fractal-disclosure-meta", children: meta })
|
|
1094
1184
|
]
|
|
1095
1185
|
}
|
|
1096
1186
|
),
|
|
1097
|
-
/* @__PURE__ */
|
|
1187
|
+
/* @__PURE__ */ jsx17(
|
|
1098
1188
|
"div",
|
|
1099
1189
|
{
|
|
1100
1190
|
id: panelId,
|
|
@@ -1102,7 +1192,7 @@ function Disclosure({
|
|
|
1102
1192
|
"aria-labelledby": headerId,
|
|
1103
1193
|
className: "fractal-disclosure-panel",
|
|
1104
1194
|
hidden: !isOpen,
|
|
1105
|
-
children: /* @__PURE__ */
|
|
1195
|
+
children: /* @__PURE__ */ jsx17("div", { className: "fractal-disclosure-panel-inner", children })
|
|
1106
1196
|
}
|
|
1107
1197
|
)
|
|
1108
1198
|
]
|
|
@@ -1111,18 +1201,18 @@ function Disclosure({
|
|
|
1111
1201
|
}
|
|
1112
1202
|
|
|
1113
1203
|
// src/components/LatticeLoader/LatticeLoader.tsx
|
|
1114
|
-
import { jsx as
|
|
1204
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1115
1205
|
var LATTICE_COUNT = 160;
|
|
1116
1206
|
var WAVE_PERIOD = 80;
|
|
1117
1207
|
function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
1118
|
-
return /* @__PURE__ */
|
|
1208
|
+
return /* @__PURE__ */ jsx18(
|
|
1119
1209
|
"span",
|
|
1120
1210
|
{
|
|
1121
1211
|
"aria-label": label,
|
|
1122
1212
|
className: cn("fractal-lattice-loader", className),
|
|
1123
1213
|
role: "progressbar",
|
|
1124
1214
|
...props,
|
|
1125
|
-
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */
|
|
1215
|
+
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ jsx18(
|
|
1126
1216
|
"span",
|
|
1127
1217
|
{
|
|
1128
1218
|
"aria-hidden": "true",
|
|
@@ -1135,11 +1225,151 @@ function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
|
1135
1225
|
);
|
|
1136
1226
|
}
|
|
1137
1227
|
|
|
1228
|
+
// src/components/Ghost/Ghost.tsx
|
|
1229
|
+
import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1230
|
+
var toCssLength = (value) => typeof value === "number" ? `${value}px` : value;
|
|
1231
|
+
function Ghost({ className, width, height, radius, style, ...props }) {
|
|
1232
|
+
return /* @__PURE__ */ jsx19(
|
|
1233
|
+
"div",
|
|
1234
|
+
{
|
|
1235
|
+
"aria-hidden": "true",
|
|
1236
|
+
className: cn("fractal-ghost", className),
|
|
1237
|
+
style: {
|
|
1238
|
+
width: toCssLength(width),
|
|
1239
|
+
height: toCssLength(height),
|
|
1240
|
+
borderRadius: toCssLength(radius),
|
|
1241
|
+
...style
|
|
1242
|
+
},
|
|
1243
|
+
...props
|
|
1244
|
+
}
|
|
1245
|
+
);
|
|
1246
|
+
}
|
|
1247
|
+
function GhostLine({ className, size = "md", width = "100%", ...props }) {
|
|
1248
|
+
return /* @__PURE__ */ jsx19(Ghost, { className: cn("fractal-ghost-line", `fractal-ghost-line--${size}`, className), width, ...props });
|
|
1249
|
+
}
|
|
1250
|
+
function ButtonGhost({ className, size = "md", iconOnly = false, width, ...props }) {
|
|
1251
|
+
return /* @__PURE__ */ jsx19(Ghost, { className: cn("fractal-ghost-button", `fractal-ghost-button--${size}`, iconOnly && "fractal-ghost-button--icon-only", className), width, ...props });
|
|
1252
|
+
}
|
|
1253
|
+
function CardGhost({ className, lines = 3, showHeader = true, ...props }) {
|
|
1254
|
+
return /* @__PURE__ */ jsxs14("div", { "aria-hidden": "true", className: cn("fractal-ghost-card", className), ...props, children: [
|
|
1255
|
+
showHeader && /* @__PURE__ */ jsx19(GhostLine, { width: "38%" }),
|
|
1256
|
+
/* @__PURE__ */ jsx19("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx19(GhostLine, { width: index === lines - 1 ? "62%" : "100%" }, index)) })
|
|
1257
|
+
] });
|
|
1258
|
+
}
|
|
1259
|
+
function DataTableGhost({
|
|
1260
|
+
className,
|
|
1261
|
+
showHeader = true,
|
|
1262
|
+
headers,
|
|
1263
|
+
columns = 4,
|
|
1264
|
+
rows = 5,
|
|
1265
|
+
columnWidths,
|
|
1266
|
+
size = "md",
|
|
1267
|
+
...props
|
|
1268
|
+
}) {
|
|
1269
|
+
const cells = Array.from({ length: columns }, (_, index) => index);
|
|
1270
|
+
return /* @__PURE__ */ jsx19("div", { "aria-busy": "true", "aria-label": "Loading table", className: cn("fractal-ghost-table", `fractal-ghost-table--${size}`, className), role: "status", ...props, children: /* @__PURE__ */ jsxs14("table", { className: "fractal-ghost-table__table", children: [
|
|
1271
|
+
(showHeader || headers) && /* @__PURE__ */ jsx19("thead", { children: /* @__PURE__ */ jsx19("tr", { className: "fractal-ghost-table__head-row", children: cells.map((index) => /* @__PURE__ */ jsx19("th", { style: { width: columnWidths?.[index] }, children: headers?.[index] ?? /* @__PURE__ */ jsx19(GhostLine, { size: "sm", width: index === columns - 1 ? "62%" : "76%" }) }, index)) }) }),
|
|
1272
|
+
/* @__PURE__ */ jsx19("tbody", { children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ jsx19("tr", { className: "fractal-ghost-table__row", children: cells.map((columnIndex) => /* @__PURE__ */ jsx19("td", { style: { width: columnWidths?.[columnIndex] }, children: /* @__PURE__ */ jsx19(GhostLine, { width: `${[72, 54, 82, 63, 46][(rowIndex + columnIndex) % 5]}%` }) }, columnIndex)) }, rowIndex)) })
|
|
1273
|
+
] }) });
|
|
1274
|
+
}
|
|
1275
|
+
function InputGhost({ className, labelWidth = "26%", ...props }) {
|
|
1276
|
+
return /* @__PURE__ */ jsx19(FormFieldGhost, { className, labelWidth, ...props });
|
|
1277
|
+
}
|
|
1278
|
+
function TextareaGhost({ className, labelWidth = "26%", ...props }) {
|
|
1279
|
+
return /* @__PURE__ */ jsx19(FormFieldGhost, { className, labelWidth, multiline: true, ...props });
|
|
1280
|
+
}
|
|
1281
|
+
function LabelGhost({ className, width = "26%", ...props }) {
|
|
1282
|
+
return /* @__PURE__ */ jsx19(GhostLine, { className: cn("fractal-ghost-label", className), size: "sm", width, ...props });
|
|
1283
|
+
}
|
|
1284
|
+
function FormFieldGhost({ className, labelWidth = "26%", multiline = false, ...props }) {
|
|
1285
|
+
return /* @__PURE__ */ jsxs14("div", { "aria-hidden": "true", className: cn("fractal-ghost-field", className), ...props, children: [
|
|
1286
|
+
/* @__PURE__ */ jsx19(LabelGhost, { width: labelWidth }),
|
|
1287
|
+
/* @__PURE__ */ jsx19(Ghost, { className: cn("fractal-ghost-field__control", multiline && "fractal-ghost-field__control--multiline") })
|
|
1288
|
+
] });
|
|
1289
|
+
}
|
|
1290
|
+
function AlertGhost({ className, ...props }) {
|
|
1291
|
+
return /* @__PURE__ */ jsxs14("div", { "aria-hidden": "true", className: cn("fractal-ghost-alert", className), ...props, children: [
|
|
1292
|
+
/* @__PURE__ */ jsx19(GhostLine, { width: "30%" }),
|
|
1293
|
+
/* @__PURE__ */ jsx19(GhostLine, { size: "sm", width: "78%" })
|
|
1294
|
+
] });
|
|
1295
|
+
}
|
|
1296
|
+
function CheckboxGhost({ className, ...props }) {
|
|
1297
|
+
return /* @__PURE__ */ jsxs14("div", { "aria-hidden": "true", className: cn("fractal-ghost-choice", className), ...props, children: [
|
|
1298
|
+
/* @__PURE__ */ jsx19(Ghost, { className: "fractal-ghost-choice__control" }),
|
|
1299
|
+
/* @__PURE__ */ jsx19(GhostLine, { width: "42%" })
|
|
1300
|
+
] });
|
|
1301
|
+
}
|
|
1302
|
+
var ToggleGhost = CheckboxGhost;
|
|
1303
|
+
function ChipGhost({ className, width = 74, ...props }) {
|
|
1304
|
+
return /* @__PURE__ */ jsx19(Ghost, { className: cn("fractal-ghost-chip", className), height: 24, width, ...props });
|
|
1305
|
+
}
|
|
1306
|
+
function LinkGhost({ className, width = 96, ...props }) {
|
|
1307
|
+
return /* @__PURE__ */ jsx19(GhostLine, { className: cn("fractal-ghost-link", className), size: "sm", width, ...props });
|
|
1308
|
+
}
|
|
1309
|
+
var TextButtonGhost = LinkGhost;
|
|
1310
|
+
function DropdownGhost({ className, ...props }) {
|
|
1311
|
+
return /* @__PURE__ */ jsxs14("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropdown", className), ...props, children: [
|
|
1312
|
+
/* @__PURE__ */ jsx19(GhostLine, { width: "38%" }),
|
|
1313
|
+
/* @__PURE__ */ jsx19(Ghost, { className: "fractal-ghost-dropdown__chevron" })
|
|
1314
|
+
] });
|
|
1315
|
+
}
|
|
1316
|
+
function ContentSwitcherGhost({ className, options = 3, ...props }) {
|
|
1317
|
+
return /* @__PURE__ */ jsx19("div", { "aria-hidden": "true", className: cn("fractal-ghost-switcher", className), ...props, children: Array.from({ length: options }, (_, index) => /* @__PURE__ */ jsx19(Ghost, {}, index)) });
|
|
1318
|
+
}
|
|
1319
|
+
var TabsGhost = ContentSwitcherGhost;
|
|
1320
|
+
function DisclosureGhost({ className, ...props }) {
|
|
1321
|
+
return /* @__PURE__ */ jsxs14("div", { "aria-hidden": "true", className: cn("fractal-ghost-disclosure", className), ...props, children: [
|
|
1322
|
+
/* @__PURE__ */ jsx19(Ghost, { className: "fractal-ghost-disclosure__icon" }),
|
|
1323
|
+
/* @__PURE__ */ jsx19(GhostLine, { width: "42%" })
|
|
1324
|
+
] });
|
|
1325
|
+
}
|
|
1326
|
+
function PaginationGhost({ className, pages = 5, ...props }) {
|
|
1327
|
+
return /* @__PURE__ */ jsx19("div", { "aria-hidden": "true", className: cn("fractal-ghost-pagination", className), ...props, children: Array.from({ length: pages }, (_, index) => /* @__PURE__ */ jsx19(Ghost, {}, index)) });
|
|
1328
|
+
}
|
|
1329
|
+
function FileDropzoneGhost({ className, ...props }) {
|
|
1330
|
+
return /* @__PURE__ */ jsxs14("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropzone", className), ...props, children: [
|
|
1331
|
+
/* @__PURE__ */ jsx19(Ghost, { className: "fractal-ghost-dropzone__icon" }),
|
|
1332
|
+
/* @__PURE__ */ jsx19(GhostLine, { width: "26%" }),
|
|
1333
|
+
/* @__PURE__ */ jsx19(GhostLine, { size: "sm", width: "46%" })
|
|
1334
|
+
] });
|
|
1335
|
+
}
|
|
1336
|
+
function PromptCardGhost({ className, ...props }) {
|
|
1337
|
+
return /* @__PURE__ */ jsx19(CardGhost, { className: cn("fractal-ghost-prompt-card", className), lines: 4, ...props });
|
|
1338
|
+
}
|
|
1339
|
+
function SortableTableGhost(props) {
|
|
1340
|
+
return /* @__PURE__ */ jsx19(DataTableGhost, { ...props });
|
|
1341
|
+
}
|
|
1342
|
+
function SidebarGhost({ className, items = 6, ...props }) {
|
|
1343
|
+
return /* @__PURE__ */ jsxs14("aside", { "aria-hidden": "true", className: cn("fractal-ghost-sidebar", className), ...props, children: [
|
|
1344
|
+
/* @__PURE__ */ jsx19(Ghost, { className: "fractal-ghost-sidebar__brand" }),
|
|
1345
|
+
/* @__PURE__ */ jsx19("div", { className: "fractal-ghost-sidebar__items", children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ jsxs14("div", { className: "fractal-ghost-sidebar__item", children: [
|
|
1346
|
+
/* @__PURE__ */ jsx19(Ghost, {}),
|
|
1347
|
+
/* @__PURE__ */ jsx19(GhostLine, { width: `${[54, 68, 44, 61][index % 4]}%` })
|
|
1348
|
+
] }, index)) })
|
|
1349
|
+
] });
|
|
1350
|
+
}
|
|
1351
|
+
function ModalGhost({ className, title, lines = 3, ...props }) {
|
|
1352
|
+
return /* @__PURE__ */ jsx19(SurfaceGhost, { className: cn("fractal-ghost-modal", className), title, lines, ...props });
|
|
1353
|
+
}
|
|
1354
|
+
function SidePanelGhost({ className, title, lines = 5, ...props }) {
|
|
1355
|
+
return /* @__PURE__ */ jsx19(SurfaceGhost, { className: cn("fractal-ghost-side-panel", className), title, lines, ...props });
|
|
1356
|
+
}
|
|
1357
|
+
function SurfaceGhost({ className, title, lines = 3, ...props }) {
|
|
1358
|
+
return /* @__PURE__ */ jsxs14("div", { "aria-hidden": "true", className: cn("fractal-ghost-surface", className), ...props, children: [
|
|
1359
|
+
/* @__PURE__ */ jsxs14("div", { className: "fractal-ghost-surface__header", children: [
|
|
1360
|
+
/* @__PURE__ */ jsx19(GhostLine, { width: "42%" }),
|
|
1361
|
+
/* @__PURE__ */ jsx19(Ghost, { className: "fractal-ghost-surface__close" })
|
|
1362
|
+
] }),
|
|
1363
|
+
title && /* @__PURE__ */ jsx19("div", { className: "fractal-ghost-surface__title", children: title }),
|
|
1364
|
+
/* @__PURE__ */ jsx19("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx19(GhostLine, { width: index === lines - 1 ? "64%" : "100%" }, index)) })
|
|
1365
|
+
] });
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1138
1368
|
// src/components/Sidebar/Sidebar.tsx
|
|
1139
1369
|
import * as React11 from "react";
|
|
1140
|
-
import { jsx as
|
|
1370
|
+
import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1141
1371
|
var Sidebar = React11.forwardRef(
|
|
1142
|
-
({ className, width, style, ...props }, ref) => /* @__PURE__ */
|
|
1372
|
+
({ className, width, style, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
1143
1373
|
"aside",
|
|
1144
1374
|
{
|
|
1145
1375
|
ref,
|
|
@@ -1151,23 +1381,23 @@ var Sidebar = React11.forwardRef(
|
|
|
1151
1381
|
);
|
|
1152
1382
|
Sidebar.displayName = "Sidebar";
|
|
1153
1383
|
var SidebarHeader = React11.forwardRef(
|
|
1154
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1384
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx20("div", { ref, className: cn("fractal-sidebar__header", className), ...props })
|
|
1155
1385
|
);
|
|
1156
1386
|
SidebarHeader.displayName = "SidebarHeader";
|
|
1157
1387
|
var SidebarBrand = React11.forwardRef(
|
|
1158
|
-
({ className, type = "button", ...props }, ref) => /* @__PURE__ */
|
|
1388
|
+
({ className, type = "button", ...props }, ref) => /* @__PURE__ */ jsx20("button", { ref, type, className: cn("fractal-sidebar__brand", className), ...props })
|
|
1159
1389
|
);
|
|
1160
1390
|
SidebarBrand.displayName = "SidebarBrand";
|
|
1161
1391
|
var SidebarNav = React11.forwardRef(
|
|
1162
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1392
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx20("nav", { ref, className: cn("fractal-sidebar__nav", className), ...props })
|
|
1163
1393
|
);
|
|
1164
1394
|
SidebarNav.displayName = "SidebarNav";
|
|
1165
1395
|
var SidebarSection = React11.forwardRef(
|
|
1166
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1396
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx20("div", { ref, className: cn("fractal-sidebar__section", className), ...props })
|
|
1167
1397
|
);
|
|
1168
1398
|
SidebarSection.displayName = "SidebarSection";
|
|
1169
1399
|
var SidebarNavItem = React11.forwardRef(
|
|
1170
|
-
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */
|
|
1400
|
+
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ jsxs15(
|
|
1171
1401
|
"button",
|
|
1172
1402
|
{
|
|
1173
1403
|
ref,
|
|
@@ -1177,28 +1407,28 @@ var SidebarNavItem = React11.forwardRef(
|
|
|
1177
1407
|
"aria-current": active ? "page" : void 0,
|
|
1178
1408
|
...props,
|
|
1179
1409
|
children: [
|
|
1180
|
-
icon && /* @__PURE__ */
|
|
1181
|
-
/* @__PURE__ */
|
|
1182
|
-
endAdornment && /* @__PURE__ */
|
|
1410
|
+
icon && /* @__PURE__ */ jsx20("span", { className: "fractal-sidebar__nav-item-icon", "aria-hidden": "true", children: icon }),
|
|
1411
|
+
/* @__PURE__ */ jsx20("span", { className: "fractal-sidebar__nav-item-label", children }),
|
|
1412
|
+
endAdornment && /* @__PURE__ */ jsx20("span", { className: "fractal-sidebar__nav-item-end", children: endAdornment })
|
|
1183
1413
|
]
|
|
1184
1414
|
}
|
|
1185
1415
|
)
|
|
1186
1416
|
);
|
|
1187
1417
|
SidebarNavItem.displayName = "SidebarNavItem";
|
|
1188
1418
|
var SidebarFooter = React11.forwardRef(
|
|
1189
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1419
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx20("div", { ref, className: cn("fractal-sidebar__footer", className), ...props })
|
|
1190
1420
|
);
|
|
1191
1421
|
SidebarFooter.displayName = "SidebarFooter";
|
|
1192
1422
|
|
|
1193
1423
|
// src/components/SidePanel/SidePanel.tsx
|
|
1194
1424
|
import { createPortal as createPortal2 } from "react-dom";
|
|
1195
1425
|
import { Close } from "@mirror-physics/fractal-icons";
|
|
1196
|
-
import { jsx as
|
|
1197
|
-
function SidePanel({ open, onClose, title, description, children, footer, size = "md", className }) {
|
|
1426
|
+
import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1427
|
+
function SidePanel({ open, onClose, title, description, children, footer, size = "md", loading = false, loadingLabel = "Loading", className }) {
|
|
1198
1428
|
useEscapeDismiss(80, onClose, open);
|
|
1199
1429
|
if (!open) return null;
|
|
1200
1430
|
return createPortal2(
|
|
1201
|
-
/* @__PURE__ */
|
|
1431
|
+
/* @__PURE__ */ jsx21("div", { className: "fractal-side-panel-overlay", onMouseDown: onClose, children: /* @__PURE__ */ jsxs16(
|
|
1202
1432
|
"aside",
|
|
1203
1433
|
{
|
|
1204
1434
|
className: cn("fractal-side-panel", `fractal-side-panel--${size}`, className),
|
|
@@ -1207,15 +1437,15 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
1207
1437
|
role: "dialog",
|
|
1208
1438
|
onMouseDown: (event) => event.stopPropagation(),
|
|
1209
1439
|
children: [
|
|
1210
|
-
/* @__PURE__ */
|
|
1211
|
-
/* @__PURE__ */
|
|
1212
|
-
/* @__PURE__ */
|
|
1213
|
-
description && /* @__PURE__ */
|
|
1440
|
+
/* @__PURE__ */ jsxs16("header", { className: "fractal-side-panel__header", children: [
|
|
1441
|
+
/* @__PURE__ */ jsxs16("div", { className: "fractal-side-panel__heading", children: [
|
|
1442
|
+
/* @__PURE__ */ jsx21("h2", { className: "fractal-side-panel__title", children: title }),
|
|
1443
|
+
description && /* @__PURE__ */ jsx21("p", { className: "fractal-side-panel__description", children: description })
|
|
1214
1444
|
] }),
|
|
1215
|
-
/* @__PURE__ */
|
|
1445
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: "fractal-side-panel__close", "aria-label": "Close panel", onClick: onClose, children: /* @__PURE__ */ jsx21(Close, { size: 18 }) })
|
|
1216
1446
|
] }),
|
|
1217
|
-
/* @__PURE__ */
|
|
1218
|
-
footer && /* @__PURE__ */
|
|
1447
|
+
/* @__PURE__ */ jsx21("div", { "aria-busy": loading || void 0, className: cn("fractal-side-panel__body", loading && "fractal-side-panel__body--loading"), children: loading ? /* @__PURE__ */ jsx21(UILoader, { label: loadingLabel }) : children }),
|
|
1448
|
+
footer && /* @__PURE__ */ jsx21("footer", { className: "fractal-side-panel__footer", children: footer })
|
|
1219
1449
|
]
|
|
1220
1450
|
}
|
|
1221
1451
|
) }),
|
|
@@ -1225,17 +1455,17 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
1225
1455
|
|
|
1226
1456
|
// src/components/Textarea/Textarea.tsx
|
|
1227
1457
|
import * as React12 from "react";
|
|
1228
|
-
import { jsx as
|
|
1458
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1229
1459
|
var Textarea = React12.forwardRef(
|
|
1230
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1460
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx22("textarea", { ref, className: cn("fractal-textarea", className), ...props })
|
|
1231
1461
|
);
|
|
1232
1462
|
Textarea.displayName = "Textarea";
|
|
1233
1463
|
|
|
1234
1464
|
// src/components/TextButton/TextButton.tsx
|
|
1235
1465
|
import * as React13 from "react";
|
|
1236
|
-
import { jsx as
|
|
1466
|
+
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1237
1467
|
var TextButton = React13.forwardRef(
|
|
1238
|
-
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */
|
|
1468
|
+
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ jsxs17(
|
|
1239
1469
|
"button",
|
|
1240
1470
|
{
|
|
1241
1471
|
ref,
|
|
@@ -1243,9 +1473,9 @@ var TextButton = React13.forwardRef(
|
|
|
1243
1473
|
type: "button",
|
|
1244
1474
|
...props,
|
|
1245
1475
|
children: [
|
|
1246
|
-
icon && iconPosition === "start" && /* @__PURE__ */
|
|
1247
|
-
/* @__PURE__ */
|
|
1248
|
-
icon && iconPosition === "end" && /* @__PURE__ */
|
|
1476
|
+
icon && iconPosition === "start" && /* @__PURE__ */ jsx23("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon }),
|
|
1477
|
+
/* @__PURE__ */ jsx23("span", { children }),
|
|
1478
|
+
icon && iconPosition === "end" && /* @__PURE__ */ jsx23("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon })
|
|
1249
1479
|
]
|
|
1250
1480
|
}
|
|
1251
1481
|
)
|
|
@@ -1255,7 +1485,7 @@ TextButton.displayName = "TextButton";
|
|
|
1255
1485
|
// src/components/FileDropzone/FileDropzone.tsx
|
|
1256
1486
|
import * as React14 from "react";
|
|
1257
1487
|
import { Close as Close2, FileArrowUp } from "@mirror-physics/fractal-icons";
|
|
1258
|
-
import { jsx as
|
|
1488
|
+
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1259
1489
|
function FileDropzone({
|
|
1260
1490
|
files,
|
|
1261
1491
|
onFilesChange,
|
|
@@ -1275,8 +1505,8 @@ function FileDropzone({
|
|
|
1275
1505
|
if (additions.length === 0) return;
|
|
1276
1506
|
onFilesChange(multiple ? [...files, ...additions] : additions.slice(0, 1));
|
|
1277
1507
|
};
|
|
1278
|
-
return /* @__PURE__ */
|
|
1279
|
-
/* @__PURE__ */
|
|
1508
|
+
return /* @__PURE__ */ jsxs18("div", { className: cn("fractal-file-dropzone", className), children: [
|
|
1509
|
+
/* @__PURE__ */ jsx24(
|
|
1280
1510
|
"input",
|
|
1281
1511
|
{
|
|
1282
1512
|
ref: inputRef,
|
|
@@ -1292,7 +1522,7 @@ function FileDropzone({
|
|
|
1292
1522
|
}
|
|
1293
1523
|
}
|
|
1294
1524
|
),
|
|
1295
|
-
/* @__PURE__ */
|
|
1525
|
+
/* @__PURE__ */ jsxs18(
|
|
1296
1526
|
"button",
|
|
1297
1527
|
{
|
|
1298
1528
|
className: "fractal-file-dropzone__target",
|
|
@@ -1315,18 +1545,18 @@ function FileDropzone({
|
|
|
1315
1545
|
addFiles(event.dataTransfer.files);
|
|
1316
1546
|
},
|
|
1317
1547
|
children: [
|
|
1318
|
-
/* @__PURE__ */
|
|
1319
|
-
/* @__PURE__ */
|
|
1320
|
-
/* @__PURE__ */
|
|
1321
|
-
description && /* @__PURE__ */
|
|
1548
|
+
/* @__PURE__ */ jsx24(FileArrowUp, { "aria-hidden": "true", size: 20 }),
|
|
1549
|
+
/* @__PURE__ */ jsxs18("span", { className: "fractal-file-dropzone__copy", children: [
|
|
1550
|
+
/* @__PURE__ */ jsx24("span", { className: "fractal-file-dropzone__title", children: title }),
|
|
1551
|
+
description && /* @__PURE__ */ jsx24("span", { className: "fractal-file-dropzone__description", children: description })
|
|
1322
1552
|
] })
|
|
1323
1553
|
]
|
|
1324
1554
|
}
|
|
1325
1555
|
),
|
|
1326
|
-
files.length > 0 && /* @__PURE__ */
|
|
1327
|
-
/* @__PURE__ */
|
|
1328
|
-
/* @__PURE__ */
|
|
1329
|
-
/* @__PURE__ */
|
|
1556
|
+
files.length > 0 && /* @__PURE__ */ jsx24("ul", { className: "fractal-file-dropzone__files", "aria-label": "Attached files", children: files.map((file, index) => /* @__PURE__ */ jsxs18("li", { className: "fractal-file-dropzone__file", children: [
|
|
1557
|
+
/* @__PURE__ */ jsx24("span", { className: "fractal-file-dropzone__file-name", children: file.name }),
|
|
1558
|
+
/* @__PURE__ */ jsx24("span", { className: "fractal-file-dropzone__file-meta", children: formatFileSize(file.size) }),
|
|
1559
|
+
/* @__PURE__ */ jsx24(
|
|
1330
1560
|
"button",
|
|
1331
1561
|
{
|
|
1332
1562
|
className: "fractal-file-dropzone__remove",
|
|
@@ -1334,7 +1564,7 @@ function FileDropzone({
|
|
|
1334
1564
|
"aria-label": `Remove ${file.name}`,
|
|
1335
1565
|
disabled,
|
|
1336
1566
|
onClick: () => onFilesChange(files.filter((_, fileIndex) => fileIndex !== index)),
|
|
1337
|
-
children: /* @__PURE__ */
|
|
1567
|
+
children: /* @__PURE__ */ jsx24(Close2, { "aria-hidden": "true", size: 14 })
|
|
1338
1568
|
}
|
|
1339
1569
|
)
|
|
1340
1570
|
] }, `${file.name}-${file.size}-${index}`)) })
|
|
@@ -1348,7 +1578,7 @@ function formatFileSize(bytes) {
|
|
|
1348
1578
|
|
|
1349
1579
|
// src/components/Pagination/Pagination.tsx
|
|
1350
1580
|
import { ArrowLeft, ArrowRight } from "@mirror-physics/fractal-icons";
|
|
1351
|
-
import { jsx as
|
|
1581
|
+
import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1352
1582
|
function Pagination({
|
|
1353
1583
|
page,
|
|
1354
1584
|
pageSize,
|
|
@@ -1364,10 +1594,10 @@ function Pagination({
|
|
|
1364
1594
|
const start = totalItems === 0 ? 0 : (currentPage - 1) * pageSize + 1;
|
|
1365
1595
|
const end = Math.min(currentPage * pageSize, totalItems);
|
|
1366
1596
|
const canChangePageSize = pageSizeOptions != null && pageSizeOptions.length > 0 && onPageSizeChange != null;
|
|
1367
|
-
return /* @__PURE__ */
|
|
1368
|
-
/* @__PURE__ */
|
|
1369
|
-
/* @__PURE__ */
|
|
1370
|
-
canChangePageSize && /* @__PURE__ */
|
|
1597
|
+
return /* @__PURE__ */ jsxs19("nav", { className: cn("fractal-pagination", className), "aria-label": ariaLabel, children: [
|
|
1598
|
+
/* @__PURE__ */ jsx25("span", { className: "fractal-pagination__summary", children: totalItems === 0 ? "No results" : `${start}-${end} of ${totalItems}` }),
|
|
1599
|
+
/* @__PURE__ */ jsxs19("div", { className: "fractal-pagination__controls", children: [
|
|
1600
|
+
canChangePageSize && /* @__PURE__ */ jsx25(
|
|
1371
1601
|
Dropdown,
|
|
1372
1602
|
{
|
|
1373
1603
|
align: "right",
|
|
@@ -1384,7 +1614,7 @@ function Pagination({
|
|
|
1384
1614
|
triggerVariant: "tertiary"
|
|
1385
1615
|
}
|
|
1386
1616
|
),
|
|
1387
|
-
/* @__PURE__ */
|
|
1617
|
+
/* @__PURE__ */ jsx25(
|
|
1388
1618
|
"button",
|
|
1389
1619
|
{
|
|
1390
1620
|
className: "fractal-pagination__button",
|
|
@@ -1393,15 +1623,15 @@ function Pagination({
|
|
|
1393
1623
|
title: "Previous page",
|
|
1394
1624
|
disabled: currentPage === 1 || totalItems === 0,
|
|
1395
1625
|
onClick: () => onPageChange(currentPage - 1),
|
|
1396
|
-
children: /* @__PURE__ */
|
|
1626
|
+
children: /* @__PURE__ */ jsx25(ArrowLeft, { "aria-hidden": "true", size: 16 })
|
|
1397
1627
|
}
|
|
1398
1628
|
),
|
|
1399
|
-
/* @__PURE__ */
|
|
1629
|
+
/* @__PURE__ */ jsxs19("span", { className: "fractal-pagination__page", "aria-current": "page", children: [
|
|
1400
1630
|
currentPage,
|
|
1401
1631
|
" of ",
|
|
1402
1632
|
totalPages
|
|
1403
1633
|
] }),
|
|
1404
|
-
/* @__PURE__ */
|
|
1634
|
+
/* @__PURE__ */ jsx25(
|
|
1405
1635
|
"button",
|
|
1406
1636
|
{
|
|
1407
1637
|
className: "fractal-pagination__button",
|
|
@@ -1410,7 +1640,7 @@ function Pagination({
|
|
|
1410
1640
|
title: "Next page",
|
|
1411
1641
|
disabled: currentPage === totalPages || totalItems === 0,
|
|
1412
1642
|
onClick: () => onPageChange(currentPage + 1),
|
|
1413
|
-
children: /* @__PURE__ */
|
|
1643
|
+
children: /* @__PURE__ */ jsx25(ArrowRight, { "aria-hidden": "true", size: 16 })
|
|
1414
1644
|
}
|
|
1415
1645
|
)
|
|
1416
1646
|
] })
|
|
@@ -1419,44 +1649,70 @@ function Pagination({
|
|
|
1419
1649
|
export {
|
|
1420
1650
|
Alert,
|
|
1421
1651
|
AlertDescription,
|
|
1652
|
+
AlertGhost,
|
|
1422
1653
|
AlertTitle,
|
|
1423
1654
|
Button,
|
|
1655
|
+
ButtonGhost,
|
|
1424
1656
|
Card,
|
|
1425
1657
|
CardContent,
|
|
1426
1658
|
CardDescription,
|
|
1427
1659
|
CardFooter,
|
|
1660
|
+
CardGhost,
|
|
1428
1661
|
CardHeader,
|
|
1429
1662
|
CardTitle,
|
|
1430
1663
|
Checkbox,
|
|
1664
|
+
CheckboxGhost,
|
|
1431
1665
|
Chip,
|
|
1666
|
+
ChipGhost,
|
|
1432
1667
|
ContentSwitcher,
|
|
1668
|
+
ContentSwitcherGhost,
|
|
1433
1669
|
DataTable,
|
|
1670
|
+
DataTableGhost,
|
|
1434
1671
|
Disclosure,
|
|
1672
|
+
DisclosureGhost,
|
|
1435
1673
|
Dropdown,
|
|
1674
|
+
DropdownGhost,
|
|
1436
1675
|
FeatureCard,
|
|
1437
1676
|
FileDropzone,
|
|
1677
|
+
FileDropzoneGhost,
|
|
1438
1678
|
FolderCard,
|
|
1679
|
+
Ghost,
|
|
1680
|
+
GhostLine,
|
|
1439
1681
|
Input,
|
|
1682
|
+
InputGhost,
|
|
1440
1683
|
Label,
|
|
1684
|
+
LabelGhost,
|
|
1441
1685
|
LatticeLoader,
|
|
1442
1686
|
Link,
|
|
1687
|
+
LinkGhost,
|
|
1443
1688
|
Modal,
|
|
1689
|
+
ModalGhost,
|
|
1444
1690
|
Pagination,
|
|
1691
|
+
PaginationGhost,
|
|
1445
1692
|
PromptCard,
|
|
1693
|
+
PromptCardGhost,
|
|
1446
1694
|
PromptGrid,
|
|
1447
1695
|
SidePanel,
|
|
1696
|
+
SidePanelGhost,
|
|
1448
1697
|
Sidebar,
|
|
1449
1698
|
SidebarBrand,
|
|
1450
1699
|
SidebarFooter,
|
|
1700
|
+
SidebarGhost,
|
|
1451
1701
|
SidebarHeader,
|
|
1452
1702
|
SidebarNav,
|
|
1453
1703
|
SidebarNavItem,
|
|
1454
1704
|
SidebarSection,
|
|
1455
1705
|
SortableTable,
|
|
1706
|
+
SortableTableGhost,
|
|
1456
1707
|
Tabs,
|
|
1708
|
+
TabsGhost,
|
|
1457
1709
|
TextButton,
|
|
1710
|
+
TextButtonGhost,
|
|
1458
1711
|
Textarea,
|
|
1712
|
+
TextareaGhost,
|
|
1459
1713
|
Toggle,
|
|
1714
|
+
ToggleGhost,
|
|
1715
|
+
UILoader,
|
|
1460
1716
|
cn,
|
|
1461
1717
|
useEscapeDismiss
|
|
1462
1718
|
};
|