@mirror-physics/fractal-ui 0.2.0-next.43 → 0.2.0-next.45
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 +352 -265
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +72 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +345 -260
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -50,6 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
ChipGhost: () => ChipGhost,
|
|
51
51
|
ContentSwitcher: () => ContentSwitcher,
|
|
52
52
|
ContentSwitcherGhost: () => ContentSwitcherGhost,
|
|
53
|
+
ConversationGhost: () => ConversationGhost,
|
|
53
54
|
DataTable: () => DataTable,
|
|
54
55
|
DataTableGhost: () => DataTableGhost,
|
|
55
56
|
Disclosure: () => Disclosure,
|
|
@@ -74,6 +75,7 @@ __export(index_exports, {
|
|
|
74
75
|
NumberInput: () => NumberInput,
|
|
75
76
|
Pagination: () => Pagination,
|
|
76
77
|
PaginationGhost: () => PaginationGhost,
|
|
78
|
+
PasswordInput: () => PasswordInput,
|
|
77
79
|
PromptCard: () => PromptCard,
|
|
78
80
|
PromptCardGhost: () => PromptCardGhost,
|
|
79
81
|
PromptGrid: () => PromptGrid,
|
|
@@ -519,11 +521,61 @@ function NumberInput({
|
|
|
519
521
|
] });
|
|
520
522
|
}
|
|
521
523
|
|
|
522
|
-
// src/components/
|
|
524
|
+
// src/components/PasswordInput/PasswordInput.tsx
|
|
523
525
|
var React6 = __toESM(require("react"), 1);
|
|
526
|
+
var import_fractal_icons4 = require("@mirror-physics/fractal-icons");
|
|
524
527
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
525
|
-
var
|
|
526
|
-
({
|
|
528
|
+
var PasswordInput = React6.forwardRef(
|
|
529
|
+
({
|
|
530
|
+
className,
|
|
531
|
+
disabled,
|
|
532
|
+
showPasswordLabel = "Show password",
|
|
533
|
+
hidePasswordLabel = "Hide password",
|
|
534
|
+
...props
|
|
535
|
+
}, ref) => {
|
|
536
|
+
const [passwordVisible, setPasswordVisible] = React6.useState(false);
|
|
537
|
+
const toggleLabel = passwordVisible ? hidePasswordLabel : showPasswordLabel;
|
|
538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
539
|
+
"div",
|
|
540
|
+
{
|
|
541
|
+
className: cn("fractal-password-input", className),
|
|
542
|
+
"data-password-visible": passwordVisible ? "" : void 0,
|
|
543
|
+
children: [
|
|
544
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
545
|
+
Input,
|
|
546
|
+
{
|
|
547
|
+
...props,
|
|
548
|
+
ref,
|
|
549
|
+
className: "fractal-password-input-field",
|
|
550
|
+
disabled,
|
|
551
|
+
type: passwordVisible ? "text" : "password"
|
|
552
|
+
}
|
|
553
|
+
),
|
|
554
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
555
|
+
"button",
|
|
556
|
+
{
|
|
557
|
+
type: "button",
|
|
558
|
+
className: "fractal-password-input-toggle",
|
|
559
|
+
"aria-label": toggleLabel,
|
|
560
|
+
"aria-pressed": passwordVisible,
|
|
561
|
+
disabled,
|
|
562
|
+
title: toggleLabel,
|
|
563
|
+
onClick: () => setPasswordVisible((visible) => !visible),
|
|
564
|
+
children: passwordVisible ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_fractal_icons4.EyeSlash, { "aria-hidden": "true", size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_fractal_icons4.Eye, { "aria-hidden": "true", size: 18 })
|
|
565
|
+
}
|
|
566
|
+
)
|
|
567
|
+
]
|
|
568
|
+
}
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
);
|
|
572
|
+
PasswordInput.displayName = "PasswordInput";
|
|
573
|
+
|
|
574
|
+
// src/components/Label/Label.tsx
|
|
575
|
+
var React7 = __toESM(require("react"), 1);
|
|
576
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
577
|
+
var Label = React7.forwardRef(
|
|
578
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
527
579
|
"label",
|
|
528
580
|
{
|
|
529
581
|
ref,
|
|
@@ -535,20 +587,20 @@ var Label = React6.forwardRef(
|
|
|
535
587
|
Label.displayName = "Label";
|
|
536
588
|
|
|
537
589
|
// src/components/Alert/Alert.tsx
|
|
538
|
-
var
|
|
539
|
-
var
|
|
540
|
-
var
|
|
590
|
+
var React8 = __toESM(require("react"), 1);
|
|
591
|
+
var import_fractal_icons5 = require("@mirror-physics/fractal-icons");
|
|
592
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
541
593
|
var defaultIcons = {
|
|
542
|
-
default:
|
|
543
|
-
info:
|
|
544
|
-
success:
|
|
545
|
-
warning:
|
|
546
|
-
error:
|
|
594
|
+
default: import_fractal_icons5.CircleInfo,
|
|
595
|
+
info: import_fractal_icons5.CircleInfo,
|
|
596
|
+
success: import_fractal_icons5.CircleCheck,
|
|
597
|
+
warning: import_fractal_icons5.Warning,
|
|
598
|
+
error: import_fractal_icons5.CircleClose
|
|
547
599
|
};
|
|
548
|
-
var Alert =
|
|
600
|
+
var Alert = React8.forwardRef(
|
|
549
601
|
({ className, variant = "default", icon, children, ...props }, ref) => {
|
|
550
602
|
const DefaultIcon = defaultIcons[variant];
|
|
551
|
-
return /* @__PURE__ */ (0,
|
|
603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
552
604
|
"div",
|
|
553
605
|
{
|
|
554
606
|
ref,
|
|
@@ -556,27 +608,27 @@ var Alert = React7.forwardRef(
|
|
|
556
608
|
className: cn("fractal-alert", `fractal-alert--${variant}`, className),
|
|
557
609
|
...props,
|
|
558
610
|
children: [
|
|
559
|
-
/* @__PURE__ */ (0,
|
|
560
|
-
/* @__PURE__ */ (0,
|
|
611
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "fractal-alert-icon", "aria-hidden": true, children: icon ?? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DefaultIcon, { size: 18 }) }),
|
|
612
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "fractal-alert-content", children })
|
|
561
613
|
]
|
|
562
614
|
}
|
|
563
615
|
);
|
|
564
616
|
}
|
|
565
617
|
);
|
|
566
618
|
Alert.displayName = "Alert";
|
|
567
|
-
var AlertTitle =
|
|
568
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
619
|
+
var AlertTitle = React8.forwardRef(
|
|
620
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h5", { ref, className: cn("fractal-alert-title", className), ...props })
|
|
569
621
|
);
|
|
570
622
|
AlertTitle.displayName = "AlertTitle";
|
|
571
|
-
var AlertDescription =
|
|
572
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
623
|
+
var AlertDescription = React8.forwardRef(
|
|
624
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { ref, className: cn("fractal-alert-description", className), ...props })
|
|
573
625
|
);
|
|
574
626
|
AlertDescription.displayName = "AlertDescription";
|
|
575
627
|
|
|
576
628
|
// src/components/Toggle/Toggle.tsx
|
|
577
|
-
var
|
|
629
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
578
630
|
function Toggle({ checked, onChange, label, className }) {
|
|
579
|
-
return /* @__PURE__ */ (0,
|
|
631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
580
632
|
"button",
|
|
581
633
|
{
|
|
582
634
|
type: "button",
|
|
@@ -585,8 +637,8 @@ function Toggle({ checked, onChange, label, className }) {
|
|
|
585
637
|
className: cn("fractal-toggle", className),
|
|
586
638
|
onClick: () => onChange(!checked),
|
|
587
639
|
children: [
|
|
588
|
-
/* @__PURE__ */ (0,
|
|
589
|
-
label && /* @__PURE__ */ (0,
|
|
640
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: cn("fractal-toggle-track", checked && "fractal-toggle-track--checked"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: cn("fractal-toggle-thumb", checked && "fractal-toggle-thumb--checked") }) }),
|
|
641
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "fractal-toggle-label", children: label })
|
|
590
642
|
]
|
|
591
643
|
}
|
|
592
644
|
);
|
|
@@ -647,7 +699,7 @@ function useEscapeDismiss(priority, handler, enabled = true) {
|
|
|
647
699
|
|
|
648
700
|
// src/components/UILoader/UILoader.tsx
|
|
649
701
|
var import_react2 = require("react");
|
|
650
|
-
var
|
|
702
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
651
703
|
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";
|
|
652
704
|
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";
|
|
653
705
|
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";
|
|
@@ -656,7 +708,7 @@ function UILoader({ size = 48, tone = "neutral", className, style, label = "Load
|
|
|
656
708
|
const clipId = `fractal-ui-loader-clip-${rawId}`;
|
|
657
709
|
const gradientId = `fractal-ui-loader-gradient-${rawId}`;
|
|
658
710
|
const height = typeof size === "number" ? `${size}px` : size;
|
|
659
|
-
return /* @__PURE__ */ (0,
|
|
711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
660
712
|
"span",
|
|
661
713
|
{
|
|
662
714
|
"aria-hidden": ariaHidden || void 0,
|
|
@@ -664,52 +716,52 @@ function UILoader({ size = 48, tone = "neutral", className, style, label = "Load
|
|
|
664
716
|
className: cn("fractal-ui-loader", `fractal-ui-loader--${tone}`, className),
|
|
665
717
|
role: ariaHidden ? void 0 : "status",
|
|
666
718
|
style,
|
|
667
|
-
children: /* @__PURE__ */ (0,
|
|
668
|
-
/* @__PURE__ */ (0,
|
|
669
|
-
/* @__PURE__ */ (0,
|
|
670
|
-
/* @__PURE__ */ (0,
|
|
671
|
-
/* @__PURE__ */ (0,
|
|
719
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { "aria-hidden": "true", fill: "none", viewBox: "0 0 144 92", style: { height, width: "auto" }, children: [
|
|
720
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("defs", { children: [
|
|
721
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("linearGradient", { id: gradientId, x1: "59", x2: "94.3", y1: "0", y2: "89.1", gradientUnits: "userSpaceOnUse", children: [
|
|
722
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("stop", { className: "fractal-ui-loader__stop-start", offset: "0" }),
|
|
723
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("stop", { className: "fractal-ui-loader__stop-end", offset: "1" })
|
|
672
724
|
] }),
|
|
673
|
-
/* @__PURE__ */ (0,
|
|
674
|
-
/* @__PURE__ */ (0,
|
|
675
|
-
/* @__PURE__ */ (0,
|
|
676
|
-
/* @__PURE__ */ (0,
|
|
725
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("linearGradient", { id: `${gradientId}-shine`, x1: "0", x2: "1", y1: "0", y2: "0", children: [
|
|
726
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("stop", { offset: "0.4", stopColor: "white", stopOpacity: "0" }),
|
|
727
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("stop", { offset: "0.5", stopColor: "white", stopOpacity: "0.62" }),
|
|
728
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("stop", { offset: "0.6", stopColor: "white", stopOpacity: "0" })
|
|
677
729
|
] }),
|
|
678
|
-
/* @__PURE__ */ (0,
|
|
679
|
-
/* @__PURE__ */ (0,
|
|
680
|
-
/* @__PURE__ */ (0,
|
|
681
|
-
/* @__PURE__ */ (0,
|
|
730
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("clipPath", { id: clipId, children: [
|
|
731
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: LEFT }),
|
|
732
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: CENTER }),
|
|
733
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: RIGHT })
|
|
682
734
|
] })
|
|
683
735
|
] }),
|
|
684
|
-
/* @__PURE__ */ (0,
|
|
685
|
-
/* @__PURE__ */ (0,
|
|
686
|
-
/* @__PURE__ */ (0,
|
|
687
|
-
/* @__PURE__ */ (0,
|
|
736
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: CENTER, fill: `url(#${gradientId})` }),
|
|
737
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: RIGHT, fill: `url(#${gradientId})` }),
|
|
738
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: LEFT, fill: `url(#${gradientId})` }),
|
|
739
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { clipPath: `url(#${clipId})`, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { className: "fractal-ui-loader__shine-axis", transform: "translate(72 46) rotate(68.4)", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { className: "fractal-ui-loader__shine", x: "-160", y: "-100", width: "320", height: "200", fill: `url(#${gradientId}-shine)` }) }) })
|
|
688
740
|
] })
|
|
689
741
|
}
|
|
690
742
|
);
|
|
691
743
|
}
|
|
692
744
|
|
|
693
745
|
// src/components/Modal/Modal.tsx
|
|
694
|
-
var
|
|
695
|
-
var CloseIcon = () => /* @__PURE__ */ (0,
|
|
746
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
747
|
+
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.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_runtime12.jsx)("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
696
748
|
function Modal({ open, onClose, title, children, danger, warn, footer, noClose, closeDisabled = false, size = "sm", loading = false, loadingLabel = "Loading", scrollable = false, className }) {
|
|
697
749
|
useEscapeDismiss(80, onClose, open && !noClose && !closeDisabled);
|
|
698
750
|
if (!open) return null;
|
|
699
751
|
const sizeClass = `fractal-modal-panel--${size}`;
|
|
700
752
|
const accentClass = danger ? "fractal-modal-panel--danger" : warn ? "fractal-modal-panel--warn" : "";
|
|
701
753
|
return (0, import_react_dom.createPortal)(
|
|
702
|
-
/* @__PURE__ */ (0,
|
|
754
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "fractal-modal-overlay", onClick: noClose || closeDisabled ? void 0 : onClose, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
703
755
|
"div",
|
|
704
756
|
{
|
|
705
757
|
className: cn("fractal-modal-panel", sizeClass, accentClass, scrollable && "fractal-modal-panel--scrollable", className),
|
|
706
758
|
onClick: (e) => e.stopPropagation(),
|
|
707
759
|
children: [
|
|
708
|
-
/* @__PURE__ */ (0,
|
|
709
|
-
/* @__PURE__ */ (0,
|
|
710
|
-
!noClose && /* @__PURE__ */ (0,
|
|
760
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "fractal-modal-title-row", children: [
|
|
761
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: cn("fractal-modal-title", danger && "fractal-modal-title--danger", warn && "fractal-modal-title--warn"), children: title }),
|
|
762
|
+
!noClose && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: onClose, title: "Close", disabled: closeDisabled, className: "fractal-modal-close", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseIcon, {}) })
|
|
711
763
|
] }),
|
|
712
|
-
/* @__PURE__ */ (0,
|
|
764
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
713
765
|
"div",
|
|
714
766
|
{
|
|
715
767
|
"aria-busy": loading || void 0,
|
|
@@ -719,10 +771,10 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
719
771
|
loading && "fractal-modal-body--loading",
|
|
720
772
|
scrollable && "fractal-modal-body--scrollable"
|
|
721
773
|
),
|
|
722
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
774
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(UILoader, { label: loadingLabel }) : children
|
|
723
775
|
}
|
|
724
776
|
),
|
|
725
|
-
footer && /* @__PURE__ */ (0,
|
|
777
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("fractal-modal-footer", scrollable && "fractal-modal-footer--divided"), children: footer })
|
|
726
778
|
]
|
|
727
779
|
}
|
|
728
780
|
) }),
|
|
@@ -731,17 +783,17 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
731
783
|
}
|
|
732
784
|
|
|
733
785
|
// src/components/DataTable/DataTable.tsx
|
|
734
|
-
var
|
|
786
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
735
787
|
function DataTable({ columns, data, emptyMessage, header, size = "md", className }) {
|
|
736
|
-
return /* @__PURE__ */ (0,
|
|
737
|
-
header && /* @__PURE__ */ (0,
|
|
738
|
-
data.length === 0 ? /* @__PURE__ */ (0,
|
|
739
|
-
/* @__PURE__ */ (0,
|
|
740
|
-
/* @__PURE__ */ (0,
|
|
788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: cn("fractal-datatable", `fractal-datatable--${size}`, className), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "fractal-datatable-surface", children: [
|
|
789
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "fractal-datatable-header", children: header }),
|
|
790
|
+
data.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "fractal-datatable-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { className: "fractal-datatable-table", children: [
|
|
791
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tr", { className: "fractal-datatable-thead-row", children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { className: "fractal-datatable-th", style: { width: col.width }, children: col.header }, col.key)) }) }),
|
|
792
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tbody", { children: data.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
741
793
|
"tr",
|
|
742
794
|
{
|
|
743
795
|
className: "fractal-datatable-row",
|
|
744
|
-
children: columns.map((col) => /* @__PURE__ */ (0,
|
|
796
|
+
children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "fractal-datatable-td", style: { width: col.width }, children: col.render(row, rowIndex) }, col.key))
|
|
745
797
|
},
|
|
746
798
|
rowIndex
|
|
747
799
|
)) })
|
|
@@ -750,9 +802,9 @@ function DataTable({ columns, data, emptyMessage, header, size = "md", className
|
|
|
750
802
|
}
|
|
751
803
|
|
|
752
804
|
// src/components/Dropdown/Dropdown.tsx
|
|
753
|
-
var
|
|
754
|
-
var
|
|
755
|
-
var
|
|
805
|
+
var React9 = __toESM(require("react"), 1);
|
|
806
|
+
var import_fractal_icons6 = require("@mirror-physics/fractal-icons");
|
|
807
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
756
808
|
var MARGIN = 4;
|
|
757
809
|
function Dropdown({
|
|
758
810
|
items,
|
|
@@ -773,10 +825,10 @@ function Dropdown({
|
|
|
773
825
|
closeOnSelect = true,
|
|
774
826
|
disabled = false
|
|
775
827
|
}) {
|
|
776
|
-
const [open, setOpen] =
|
|
777
|
-
const triggerRef =
|
|
778
|
-
const panelRef =
|
|
779
|
-
const [panelStyle, setPanelStyle] =
|
|
828
|
+
const [open, setOpen] = React9.useState(false);
|
|
829
|
+
const triggerRef = React9.useRef(null);
|
|
830
|
+
const panelRef = React9.useRef(null);
|
|
831
|
+
const [panelStyle, setPanelStyle] = React9.useState({});
|
|
780
832
|
const visibleItems = items.filter(
|
|
781
833
|
(item) => item.icon != null || item.description != null && (typeof item.description === "string" ? item.description !== "" : true)
|
|
782
834
|
);
|
|
@@ -784,8 +836,8 @@ function Dropdown({
|
|
|
784
836
|
const selectableItems = visibleItems.filter((i) => i.kind !== "header");
|
|
785
837
|
const selected = items.find((i) => i.value === selectedValue && i.kind !== "header") ?? selectableItems[0] ?? visibleItems[0];
|
|
786
838
|
const isUp = direction === "up";
|
|
787
|
-
const ChevronIcon = isUp ?
|
|
788
|
-
|
|
839
|
+
const ChevronIcon = isUp ? import_fractal_icons6.ChevronUp : import_fractal_icons6.ChevronDown;
|
|
840
|
+
React9.useLayoutEffect(() => {
|
|
789
841
|
if (!open || !triggerRef.current || !panelRef.current) return;
|
|
790
842
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
791
843
|
const panelRect = panelRef.current.getBoundingClientRect();
|
|
@@ -819,7 +871,7 @@ function Dropdown({
|
|
|
819
871
|
}
|
|
820
872
|
setPanelStyle({ top, left, right });
|
|
821
873
|
}, [open, isUp, align]);
|
|
822
|
-
|
|
874
|
+
React9.useEffect(() => {
|
|
823
875
|
if (!open) return;
|
|
824
876
|
const handleClickOutside = (e) => {
|
|
825
877
|
const target = e.target;
|
|
@@ -829,8 +881,8 @@ function Dropdown({
|
|
|
829
881
|
document.addEventListener("mousedown", handleClickOutside);
|
|
830
882
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
831
883
|
}, [open]);
|
|
832
|
-
return /* @__PURE__ */ (0,
|
|
833
|
-
/* @__PURE__ */ (0,
|
|
884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cn("fractal-dropdown", className), children: [
|
|
885
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
834
886
|
"button",
|
|
835
887
|
{
|
|
836
888
|
ref: triggerRef,
|
|
@@ -848,15 +900,15 @@ function Dropdown({
|
|
|
848
900
|
triggerClassName
|
|
849
901
|
),
|
|
850
902
|
children: [
|
|
851
|
-
triggerContent != null ? triggerContent : /* @__PURE__ */ (0,
|
|
852
|
-
selected.icon != null && /* @__PURE__ */ (0,
|
|
853
|
-
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */ (0,
|
|
903
|
+
triggerContent != null ? triggerContent : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
904
|
+
selected.icon != null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fractal-dropdown-icon fractal-dropdown-icon--trigger", children: selected.icon }),
|
|
905
|
+
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fractal-dropdown-selected-text", children: selected.description })
|
|
854
906
|
] }),
|
|
855
|
-
!noChevron && !iconOnly && /* @__PURE__ */ (0,
|
|
907
|
+
!noChevron && !iconOnly && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fractal-dropdown-chevron", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChevronIcon, { size: size === "sm" ? 14 : 16 }) })
|
|
856
908
|
]
|
|
857
909
|
}
|
|
858
910
|
),
|
|
859
|
-
open && /* @__PURE__ */ (0,
|
|
911
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
860
912
|
"div",
|
|
861
913
|
{
|
|
862
914
|
ref: panelRef,
|
|
@@ -865,21 +917,21 @@ function Dropdown({
|
|
|
865
917
|
className: cn("fractal-dropdown-panel", `fractal-dropdown-panel--${size}`, panelClassName),
|
|
866
918
|
style: panelStyle,
|
|
867
919
|
children: [
|
|
868
|
-
label != null && /* @__PURE__ */ (0,
|
|
920
|
+
label != null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "fractal-dropdown-label", children: label }),
|
|
869
921
|
visibleItems.map((item, index) => {
|
|
870
|
-
const topDivider = item.border === "top" ? /* @__PURE__ */ (0,
|
|
871
|
-
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */ (0,
|
|
922
|
+
const topDivider = item.border === "top" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "fractal-dropdown-separator" }) : null;
|
|
923
|
+
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "fractal-dropdown-separator" }) : null;
|
|
872
924
|
if (item.kind === "header") {
|
|
873
|
-
return /* @__PURE__ */ (0,
|
|
925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(React9.Fragment, { children: [
|
|
874
926
|
topDivider,
|
|
875
|
-
/* @__PURE__ */ (0,
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { role: "presentation", className: "fractal-dropdown-label", children: item.description }),
|
|
876
928
|
bottomDivider
|
|
877
929
|
] }, `header-${index}`);
|
|
878
930
|
}
|
|
879
931
|
const isSelected = item.value === selectedValue;
|
|
880
|
-
return /* @__PURE__ */ (0,
|
|
932
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(React9.Fragment, { children: [
|
|
881
933
|
topDivider,
|
|
882
|
-
/* @__PURE__ */ (0,
|
|
934
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
883
935
|
"button",
|
|
884
936
|
{
|
|
885
937
|
type: "button",
|
|
@@ -891,9 +943,9 @@ function Dropdown({
|
|
|
891
943
|
},
|
|
892
944
|
className: "fractal-dropdown-option",
|
|
893
945
|
children: [
|
|
894
|
-
item.icon != null && /* @__PURE__ */ (0,
|
|
895
|
-
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */ (0,
|
|
896
|
-
item.trailing != null && /* @__PURE__ */ (0,
|
|
946
|
+
item.icon != null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fractal-dropdown-icon", children: item.icon }),
|
|
947
|
+
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fractal-dropdown-option-text", children: item.description }),
|
|
948
|
+
item.trailing != null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fractal-dropdown-trailing", children: item.trailing })
|
|
897
949
|
]
|
|
898
950
|
}
|
|
899
951
|
),
|
|
@@ -907,10 +959,10 @@ function Dropdown({
|
|
|
907
959
|
}
|
|
908
960
|
|
|
909
961
|
// src/components/Link/Link.tsx
|
|
910
|
-
var
|
|
911
|
-
var
|
|
912
|
-
var Link =
|
|
913
|
-
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */ (0,
|
|
962
|
+
var React10 = __toESM(require("react"), 1);
|
|
963
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
964
|
+
var Link = React10.forwardRef(
|
|
965
|
+
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
914
966
|
"a",
|
|
915
967
|
{
|
|
916
968
|
ref,
|
|
@@ -922,10 +974,10 @@ var Link = React9.forwardRef(
|
|
|
922
974
|
Link.displayName = "Link";
|
|
923
975
|
|
|
924
976
|
// src/components/Chip/Chip.tsx
|
|
925
|
-
var
|
|
926
|
-
var
|
|
927
|
-
var Chip =
|
|
928
|
-
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */ (0,
|
|
977
|
+
var React11 = __toESM(require("react"), 1);
|
|
978
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
979
|
+
var Chip = React11.forwardRef(
|
|
980
|
+
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
929
981
|
"span",
|
|
930
982
|
{
|
|
931
983
|
ref,
|
|
@@ -937,8 +989,8 @@ var Chip = React10.forwardRef(
|
|
|
937
989
|
Chip.displayName = "Chip";
|
|
938
990
|
|
|
939
991
|
// src/components/Checkbox/Checkbox.tsx
|
|
940
|
-
var
|
|
941
|
-
var
|
|
992
|
+
var import_fractal_icons7 = require("@mirror-physics/fractal-icons");
|
|
993
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
942
994
|
function Checkbox({
|
|
943
995
|
checked,
|
|
944
996
|
indeterminate = false,
|
|
@@ -949,7 +1001,7 @@ function Checkbox({
|
|
|
949
1001
|
onKeyDown,
|
|
950
1002
|
...props
|
|
951
1003
|
}) {
|
|
952
|
-
return /* @__PURE__ */ (0,
|
|
1004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
953
1005
|
"button",
|
|
954
1006
|
{
|
|
955
1007
|
...props,
|
|
@@ -971,18 +1023,18 @@ function Checkbox({
|
|
|
971
1023
|
onKeyDown?.(event);
|
|
972
1024
|
if (event.key === " " || event.key === "Enter") event.stopPropagation();
|
|
973
1025
|
},
|
|
974
|
-
children: indeterminate ? /* @__PURE__ */ (0,
|
|
975
|
-
/* @__PURE__ */ (0,
|
|
976
|
-
/* @__PURE__ */ (0,
|
|
977
|
-
] }) : checked ? /* @__PURE__ */ (0,
|
|
1026
|
+
children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "fractal-checkbox__indeterminate-icon", "aria-hidden": "true", children: [
|
|
1027
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_fractal_icons7.Checkbox, { size: 18 }),
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_fractal_icons7.Minus, { className: "fractal-checkbox__indeterminate-mark", size: 12 })
|
|
1029
|
+
] }) : checked ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_fractal_icons7.CheckboxChecked, { "aria-hidden": "true", size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_fractal_icons7.Checkbox, { "aria-hidden": "true", size: 18 })
|
|
978
1030
|
}
|
|
979
1031
|
);
|
|
980
1032
|
}
|
|
981
1033
|
|
|
982
1034
|
// src/components/SortableTable/SortableTable.tsx
|
|
983
1035
|
var import_react3 = require("react");
|
|
984
|
-
var
|
|
985
|
-
var
|
|
1036
|
+
var import_fractal_icons8 = require("@mirror-physics/fractal-icons");
|
|
1037
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
986
1038
|
function SortableTable({
|
|
987
1039
|
columns,
|
|
988
1040
|
data,
|
|
@@ -1058,13 +1110,13 @@ function SortableTable({
|
|
|
1058
1110
|
onSortChange?.(nextKey, nextDirection);
|
|
1059
1111
|
}
|
|
1060
1112
|
};
|
|
1061
|
-
return /* @__PURE__ */ (0,
|
|
1062
|
-
header && /* @__PURE__ */ (0,
|
|
1063
|
-
sorted.length === 0 ? /* @__PURE__ */ (0,
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: cn("fractal-sortable-table", `fractal-sortable-table--${size}`, embedded && "fractal-sortable-table--embedded", className), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "fractal-sortable-table-surface", children: [
|
|
1114
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "fractal-sortable-table-header", children: header }),
|
|
1115
|
+
sorted.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "fractal-sortable-table-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("table", { className: "fractal-sortable-table-table", children: [
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tr", { className: "fractal-sortable-table-thead-row", children: columns.map((col) => {
|
|
1065
1117
|
const isActive = activeKey === col.key && activeDirection !== null;
|
|
1066
1118
|
if (!col.sortable) {
|
|
1067
|
-
return /* @__PURE__ */ (0,
|
|
1119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1068
1120
|
"th",
|
|
1069
1121
|
{
|
|
1070
1122
|
className: "fractal-sortable-table-th",
|
|
@@ -1074,12 +1126,12 @@ function SortableTable({
|
|
|
1074
1126
|
col.key
|
|
1075
1127
|
);
|
|
1076
1128
|
}
|
|
1077
|
-
return /* @__PURE__ */ (0,
|
|
1129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1078
1130
|
"th",
|
|
1079
1131
|
{
|
|
1080
1132
|
className: "fractal-sortable-table-th fractal-sortable-table-th--sortable",
|
|
1081
1133
|
style: { width: col.width },
|
|
1082
|
-
children: /* @__PURE__ */ (0,
|
|
1134
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1083
1135
|
"button",
|
|
1084
1136
|
{
|
|
1085
1137
|
type: "button",
|
|
@@ -1090,8 +1142,8 @@ function SortableTable({
|
|
|
1090
1142
|
onClick: () => handleSortClick(col.key),
|
|
1091
1143
|
"aria-sort": isActive ? activeDirection === "asc" ? "ascending" : "descending" : "none",
|
|
1092
1144
|
children: [
|
|
1093
|
-
/* @__PURE__ */ (0,
|
|
1094
|
-
/* @__PURE__ */ (0,
|
|
1145
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: col.header }),
|
|
1146
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fractal-sortable-table-sort-icon", "aria-hidden": "true", children: isActive && activeDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fractal_icons8.ArrowUp, { size: 14 }) : isActive && activeDirection === "desc" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fractal_icons8.ArrowDown, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fractal_icons8.ArrowsUpDown, { size: 14 }) })
|
|
1095
1147
|
]
|
|
1096
1148
|
}
|
|
1097
1149
|
)
|
|
@@ -1099,13 +1151,13 @@ function SortableTable({
|
|
|
1099
1151
|
col.key
|
|
1100
1152
|
);
|
|
1101
1153
|
}) }) }),
|
|
1102
|
-
/* @__PURE__ */ (0,
|
|
1154
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { children: sorted.map((row, rowIndex) => {
|
|
1103
1155
|
const highlighted = highlightRow?.(row, rowIndex) ?? false;
|
|
1104
1156
|
const action = rowAction ? {
|
|
1105
1157
|
label: rowAction.label(row, rowIndex),
|
|
1106
1158
|
icon: rowAction.icon(row, rowIndex)
|
|
1107
1159
|
} : null;
|
|
1108
|
-
return /* @__PURE__ */ (0,
|
|
1160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1109
1161
|
"tr",
|
|
1110
1162
|
{
|
|
1111
1163
|
className: cn(
|
|
@@ -1123,7 +1175,7 @@ function SortableTable({
|
|
|
1123
1175
|
"aria-label": action?.label,
|
|
1124
1176
|
role: onRowClick ? "button" : void 0,
|
|
1125
1177
|
tabIndex: onRowClick ? 0 : void 0,
|
|
1126
|
-
children: columns.map((col, columnIndex) => /* @__PURE__ */ (0,
|
|
1178
|
+
children: columns.map((col, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1127
1179
|
"td",
|
|
1128
1180
|
{
|
|
1129
1181
|
className: cn(
|
|
@@ -1133,7 +1185,7 @@ function SortableTable({
|
|
|
1133
1185
|
style: { width: col.width, textAlign: col.align ?? "left" },
|
|
1134
1186
|
children: [
|
|
1135
1187
|
col.render(row, rowIndex),
|
|
1136
|
-
action && columnIndex === columns.length - 1 && /* @__PURE__ */ (0,
|
|
1188
|
+
action && columnIndex === columns.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fractal-sortable-table-row-action", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fractal-sortable-table-row-action__icon", children: action.icon }) })
|
|
1137
1189
|
]
|
|
1138
1190
|
},
|
|
1139
1191
|
col.key
|
|
@@ -1148,7 +1200,7 @@ function SortableTable({
|
|
|
1148
1200
|
|
|
1149
1201
|
// src/components/Tabs/Tabs.tsx
|
|
1150
1202
|
var import_react4 = require("react");
|
|
1151
|
-
var
|
|
1203
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1152
1204
|
function Tabs({
|
|
1153
1205
|
items,
|
|
1154
1206
|
defaultValue,
|
|
@@ -1219,8 +1271,8 @@ function Tabs({
|
|
|
1219
1271
|
selectTab(nextId2);
|
|
1220
1272
|
requestAnimationFrame(() => tabRefs.current[nextId2]?.focus());
|
|
1221
1273
|
};
|
|
1222
|
-
return /* @__PURE__ */ (0,
|
|
1223
|
-
/* @__PURE__ */ (0,
|
|
1274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: cn("fractal-tabs", `fractal-tabs--${variant}`, divider && "fractal-tabs--divider", className), children: [
|
|
1275
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1224
1276
|
"div",
|
|
1225
1277
|
{
|
|
1226
1278
|
ref: tabListRef,
|
|
@@ -1233,7 +1285,7 @@ function Tabs({
|
|
|
1233
1285
|
const isActive = item.id === activeId;
|
|
1234
1286
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
1235
1287
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
1236
|
-
return /* @__PURE__ */ (0,
|
|
1288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1237
1289
|
"button",
|
|
1238
1290
|
{
|
|
1239
1291
|
ref: (el) => {
|
|
@@ -1264,7 +1316,7 @@ function Tabs({
|
|
|
1264
1316
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
1265
1317
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
1266
1318
|
const isActive = item.id === activeId;
|
|
1267
|
-
return /* @__PURE__ */ (0,
|
|
1319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1268
1320
|
"div",
|
|
1269
1321
|
{
|
|
1270
1322
|
id: panelId,
|
|
@@ -1281,14 +1333,14 @@ function Tabs({
|
|
|
1281
1333
|
}
|
|
1282
1334
|
|
|
1283
1335
|
// src/components/ContentSwitcher/ContentSwitcher.tsx
|
|
1284
|
-
var
|
|
1285
|
-
var
|
|
1336
|
+
var React12 = __toESM(require("react"), 1);
|
|
1337
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1286
1338
|
function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = false, className }) {
|
|
1287
|
-
const switcherRef =
|
|
1288
|
-
const buttonRefs =
|
|
1289
|
-
const indicatorMotionReadyRef =
|
|
1339
|
+
const switcherRef = React12.useRef(null);
|
|
1340
|
+
const buttonRefs = React12.useRef([]);
|
|
1341
|
+
const indicatorMotionReadyRef = React12.useRef(false);
|
|
1290
1342
|
const activeIndex = items.findIndex((item) => item.value === value);
|
|
1291
|
-
|
|
1343
|
+
React12.useLayoutEffect(() => {
|
|
1292
1344
|
const switcher = switcherRef.current;
|
|
1293
1345
|
const activeButton = buttonRefs.current[activeIndex];
|
|
1294
1346
|
let motionFrame = 0;
|
|
@@ -1340,7 +1392,7 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1340
1392
|
onValueChange(items[nextIndex].value);
|
|
1341
1393
|
}
|
|
1342
1394
|
};
|
|
1343
|
-
return /* @__PURE__ */ (0,
|
|
1395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1344
1396
|
"div",
|
|
1345
1397
|
{
|
|
1346
1398
|
className: cn("fractal-content-switcher", fullWidth && "fractal-content-switcher--full-width", className),
|
|
@@ -1348,10 +1400,10 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1348
1400
|
"aria-label": ariaLabel,
|
|
1349
1401
|
ref: switcherRef,
|
|
1350
1402
|
children: [
|
|
1351
|
-
/* @__PURE__ */ (0,
|
|
1403
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "fractal-content-switcher__indicator", "aria-hidden": true }),
|
|
1352
1404
|
items.map((item, index) => {
|
|
1353
1405
|
const active = item.value === value;
|
|
1354
|
-
return /* @__PURE__ */ (0,
|
|
1406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1355
1407
|
"button",
|
|
1356
1408
|
{
|
|
1357
1409
|
className: cn("fractal-content-switcher__item", active && "fractal-content-switcher__item--active"),
|
|
@@ -1384,8 +1436,8 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1384
1436
|
|
|
1385
1437
|
// src/components/Disclosure/Disclosure.tsx
|
|
1386
1438
|
var import_react5 = require("react");
|
|
1387
|
-
var
|
|
1388
|
-
var
|
|
1439
|
+
var import_fractal_icons9 = require("@mirror-physics/fractal-icons");
|
|
1440
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1389
1441
|
function Disclosure({
|
|
1390
1442
|
title,
|
|
1391
1443
|
meta,
|
|
@@ -1413,7 +1465,7 @@ function Disclosure({
|
|
|
1413
1465
|
onOpenChange?.(next);
|
|
1414
1466
|
}
|
|
1415
1467
|
};
|
|
1416
|
-
return /* @__PURE__ */ (0,
|
|
1468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1417
1469
|
"div",
|
|
1418
1470
|
{
|
|
1419
1471
|
className: cn(
|
|
@@ -1424,7 +1476,7 @@ function Disclosure({
|
|
|
1424
1476
|
className
|
|
1425
1477
|
),
|
|
1426
1478
|
children: [
|
|
1427
|
-
/* @__PURE__ */ (0,
|
|
1479
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1428
1480
|
"button",
|
|
1429
1481
|
{
|
|
1430
1482
|
type: "button",
|
|
@@ -1435,13 +1487,13 @@ function Disclosure({
|
|
|
1435
1487
|
disabled,
|
|
1436
1488
|
onClick: toggle,
|
|
1437
1489
|
children: [
|
|
1438
|
-
/* @__PURE__ */ (0,
|
|
1439
|
-
/* @__PURE__ */ (0,
|
|
1440
|
-
meta && /* @__PURE__ */ (0,
|
|
1490
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fractal-disclosure-icon", "aria-hidden": "true", children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_fractal_icons9.ChevronDown, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_fractal_icons9.ChevronRight, { size: 16 }) }),
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fractal-disclosure-title", children: title }),
|
|
1492
|
+
meta && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fractal-disclosure-meta", children: meta })
|
|
1441
1493
|
]
|
|
1442
1494
|
}
|
|
1443
1495
|
),
|
|
1444
|
-
/* @__PURE__ */ (0,
|
|
1496
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1445
1497
|
"div",
|
|
1446
1498
|
{
|
|
1447
1499
|
id: panelId,
|
|
@@ -1449,7 +1501,7 @@ function Disclosure({
|
|
|
1449
1501
|
"aria-labelledby": headerId,
|
|
1450
1502
|
className: "fractal-disclosure-panel",
|
|
1451
1503
|
hidden: !isOpen,
|
|
1452
|
-
children: /* @__PURE__ */ (0,
|
|
1504
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "fractal-disclosure-panel-inner", children })
|
|
1453
1505
|
}
|
|
1454
1506
|
)
|
|
1455
1507
|
]
|
|
@@ -1458,18 +1510,18 @@ function Disclosure({
|
|
|
1458
1510
|
}
|
|
1459
1511
|
|
|
1460
1512
|
// src/components/LatticeLoader/LatticeLoader.tsx
|
|
1461
|
-
var
|
|
1513
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1462
1514
|
var LATTICE_COUNT = 160;
|
|
1463
1515
|
var WAVE_PERIOD = 80;
|
|
1464
1516
|
function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
1465
|
-
return /* @__PURE__ */ (0,
|
|
1517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1466
1518
|
"span",
|
|
1467
1519
|
{
|
|
1468
1520
|
"aria-label": label,
|
|
1469
1521
|
className: cn("fractal-lattice-loader", className),
|
|
1470
1522
|
role: "progressbar",
|
|
1471
1523
|
...props,
|
|
1472
|
-
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ (0,
|
|
1524
|
+
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1473
1525
|
"span",
|
|
1474
1526
|
{
|
|
1475
1527
|
"aria-hidden": "true",
|
|
@@ -1483,10 +1535,10 @@ function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
|
1483
1535
|
}
|
|
1484
1536
|
|
|
1485
1537
|
// src/components/Ghost/Ghost.tsx
|
|
1486
|
-
var
|
|
1538
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1487
1539
|
var toCssLength = (value) => typeof value === "number" ? `${value}px` : value;
|
|
1488
1540
|
function Ghost({ className, width, height, radius, style, ...props }) {
|
|
1489
|
-
return /* @__PURE__ */ (0,
|
|
1541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1490
1542
|
"div",
|
|
1491
1543
|
{
|
|
1492
1544
|
"aria-hidden": "true",
|
|
@@ -1502,15 +1554,15 @@ function Ghost({ className, width, height, radius, style, ...props }) {
|
|
|
1502
1554
|
);
|
|
1503
1555
|
}
|
|
1504
1556
|
function GhostLine({ className, size = "md", width = "100%", ...props }) {
|
|
1505
|
-
return /* @__PURE__ */ (0,
|
|
1557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Ghost, { className: cn("fractal-ghost-line", `fractal-ghost-line--${size}`, className), width, ...props });
|
|
1506
1558
|
}
|
|
1507
1559
|
function ButtonGhost({ className, size = "md", iconOnly = false, width, ...props }) {
|
|
1508
|
-
return /* @__PURE__ */ (0,
|
|
1560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Ghost, { className: cn("fractal-ghost-button", `fractal-ghost-button--${size}`, iconOnly && "fractal-ghost-button--icon-only", className), width, ...props });
|
|
1509
1561
|
}
|
|
1510
1562
|
function CardGhost({ className, lines = 3, showHeader = true, ...props }) {
|
|
1511
|
-
return /* @__PURE__ */ (0,
|
|
1512
|
-
showHeader && /* @__PURE__ */ (0,
|
|
1513
|
-
/* @__PURE__ */ (0,
|
|
1563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-card", className), ...props, children: [
|
|
1564
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "38%" }),
|
|
1565
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: index === lines - 1 ? "62%" : "100%" }, index)) })
|
|
1514
1566
|
] });
|
|
1515
1567
|
}
|
|
1516
1568
|
function DataTableGhost({
|
|
@@ -1524,109 +1576,142 @@ function DataTableGhost({
|
|
|
1524
1576
|
...props
|
|
1525
1577
|
}) {
|
|
1526
1578
|
const cells = Array.from({ length: columns }, (_, index) => index);
|
|
1527
|
-
return /* @__PURE__ */ (0,
|
|
1528
|
-
(showHeader || headers) && /* @__PURE__ */ (0,
|
|
1529
|
-
/* @__PURE__ */ (0,
|
|
1579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.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_runtime23.jsxs)("table", { className: "fractal-ghost-table__table", children: [
|
|
1580
|
+
(showHeader || headers) && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "fractal-ghost-table__head-row", children: cells.map((index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("th", { style: { width: columnWidths?.[index] }, children: headers?.[index] ?? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { size: "sm", width: index === columns - 1 ? "62%" : "76%" }) }, index)) }) }),
|
|
1581
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tbody", { children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "fractal-ghost-table__row", children: cells.map((columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { style: { width: columnWidths?.[columnIndex] }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: `${[72, 54, 82, 63, 46][(rowIndex + columnIndex) % 5]}%` }) }, columnIndex)) }, rowIndex)) })
|
|
1530
1582
|
] }) });
|
|
1531
1583
|
}
|
|
1532
1584
|
function InputGhost({ className, labelWidth = "26%", ...props }) {
|
|
1533
|
-
return /* @__PURE__ */ (0,
|
|
1585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FormFieldGhost, { className, labelWidth, ...props });
|
|
1534
1586
|
}
|
|
1535
1587
|
function TextareaGhost({ className, labelWidth = "26%", ...props }) {
|
|
1536
|
-
return /* @__PURE__ */ (0,
|
|
1588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FormFieldGhost, { className, labelWidth, multiline: true, ...props });
|
|
1537
1589
|
}
|
|
1538
1590
|
function LabelGhost({ className, width = "26%", ...props }) {
|
|
1539
|
-
return /* @__PURE__ */ (0,
|
|
1591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { className: cn("fractal-ghost-label", className), size: "sm", width, ...props });
|
|
1540
1592
|
}
|
|
1541
1593
|
function FormFieldGhost({ className, labelWidth = "26%", multiline = false, ...props }) {
|
|
1542
|
-
return /* @__PURE__ */ (0,
|
|
1543
|
-
/* @__PURE__ */ (0,
|
|
1544
|
-
/* @__PURE__ */ (0,
|
|
1594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-field", className), ...props, children: [
|
|
1595
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LabelGhost, { width: labelWidth }),
|
|
1596
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Ghost, { className: cn("fractal-ghost-field__control", multiline && "fractal-ghost-field__control--multiline") })
|
|
1545
1597
|
] });
|
|
1546
1598
|
}
|
|
1547
1599
|
function AlertGhost({ className, ...props }) {
|
|
1548
|
-
return /* @__PURE__ */ (0,
|
|
1549
|
-
/* @__PURE__ */ (0,
|
|
1550
|
-
/* @__PURE__ */ (0,
|
|
1600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-alert", className), ...props, children: [
|
|
1601
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "30%" }),
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { size: "sm", width: "78%" })
|
|
1551
1603
|
] });
|
|
1552
1604
|
}
|
|
1553
1605
|
function CheckboxGhost({ className, ...props }) {
|
|
1554
|
-
return /* @__PURE__ */ (0,
|
|
1555
|
-
/* @__PURE__ */ (0,
|
|
1556
|
-
/* @__PURE__ */ (0,
|
|
1606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-choice", className), ...props, children: [
|
|
1607
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Ghost, { className: "fractal-ghost-choice__control" }),
|
|
1608
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "42%" })
|
|
1557
1609
|
] });
|
|
1558
1610
|
}
|
|
1559
1611
|
var ToggleGhost = CheckboxGhost;
|
|
1560
1612
|
function ChipGhost({ className, width = 74, ...props }) {
|
|
1561
|
-
return /* @__PURE__ */ (0,
|
|
1613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Ghost, { className: cn("fractal-ghost-chip", className), height: 24, width, ...props });
|
|
1562
1614
|
}
|
|
1563
1615
|
function LinkGhost({ className, width = 96, ...props }) {
|
|
1564
|
-
return /* @__PURE__ */ (0,
|
|
1616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { className: cn("fractal-ghost-link", className), size: "sm", width, ...props });
|
|
1565
1617
|
}
|
|
1566
1618
|
var TextButtonGhost = LinkGhost;
|
|
1567
1619
|
function DropdownGhost({ className, ...props }) {
|
|
1568
|
-
return /* @__PURE__ */ (0,
|
|
1569
|
-
/* @__PURE__ */ (0,
|
|
1570
|
-
/* @__PURE__ */ (0,
|
|
1620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropdown", className), ...props, children: [
|
|
1621
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "38%" }),
|
|
1622
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Ghost, { className: "fractal-ghost-dropdown__chevron" })
|
|
1571
1623
|
] });
|
|
1572
1624
|
}
|
|
1573
1625
|
function ContentSwitcherGhost({ className, options = 3, ...props }) {
|
|
1574
|
-
return /* @__PURE__ */ (0,
|
|
1626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { "aria-hidden": "true", className: cn("fractal-ghost-switcher", className), ...props, children: Array.from({ length: options }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Ghost, {}, index)) });
|
|
1575
1627
|
}
|
|
1576
1628
|
var TabsGhost = ContentSwitcherGhost;
|
|
1577
1629
|
function DisclosureGhost({ className, ...props }) {
|
|
1578
|
-
return /* @__PURE__ */ (0,
|
|
1579
|
-
/* @__PURE__ */ (0,
|
|
1580
|
-
/* @__PURE__ */ (0,
|
|
1630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-disclosure", className), ...props, children: [
|
|
1631
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Ghost, { className: "fractal-ghost-disclosure__icon" }),
|
|
1632
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "42%" })
|
|
1581
1633
|
] });
|
|
1582
1634
|
}
|
|
1583
1635
|
function PaginationGhost({ className, pages = 5, ...props }) {
|
|
1584
|
-
return /* @__PURE__ */ (0,
|
|
1636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { "aria-hidden": "true", className: cn("fractal-ghost-pagination", className), ...props, children: Array.from({ length: pages }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Ghost, {}, index)) });
|
|
1585
1637
|
}
|
|
1586
1638
|
function FileDropzoneGhost({ className, ...props }) {
|
|
1587
|
-
return /* @__PURE__ */ (0,
|
|
1588
|
-
/* @__PURE__ */ (0,
|
|
1589
|
-
/* @__PURE__ */ (0,
|
|
1590
|
-
/* @__PURE__ */ (0,
|
|
1639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropzone", className), ...props, children: [
|
|
1640
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Ghost, { className: "fractal-ghost-dropzone__icon" }),
|
|
1641
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "26%" }),
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { size: "sm", width: "46%" })
|
|
1591
1643
|
] });
|
|
1592
1644
|
}
|
|
1593
1645
|
function PromptCardGhost({ className, ...props }) {
|
|
1594
|
-
return /* @__PURE__ */ (0,
|
|
1646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CardGhost, { className: cn("fractal-ghost-prompt-card", className), lines: 4, ...props });
|
|
1647
|
+
}
|
|
1648
|
+
function ConversationGhost({
|
|
1649
|
+
className,
|
|
1650
|
+
"aria-label": ariaLabel = "Loading conversation",
|
|
1651
|
+
...props
|
|
1652
|
+
}) {
|
|
1653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1654
|
+
"div",
|
|
1655
|
+
{
|
|
1656
|
+
"aria-busy": "true",
|
|
1657
|
+
"aria-label": ariaLabel,
|
|
1658
|
+
className: cn("fractal-ghost-conversation", className),
|
|
1659
|
+
role: "status",
|
|
1660
|
+
...props,
|
|
1661
|
+
children: [
|
|
1662
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--assistant", children: [
|
|
1663
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "92%" }),
|
|
1664
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "78%" }),
|
|
1665
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "58%" })
|
|
1666
|
+
] }),
|
|
1667
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--user", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "fractal-ghost-conversation__bubble", children: [
|
|
1668
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "100%" }),
|
|
1669
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "86%" }),
|
|
1670
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "64%" })
|
|
1671
|
+
] }) }),
|
|
1672
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--assistant", children: [
|
|
1673
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "84%" }),
|
|
1674
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "96%" }),
|
|
1675
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "46%" })
|
|
1676
|
+
] })
|
|
1677
|
+
]
|
|
1678
|
+
}
|
|
1679
|
+
);
|
|
1595
1680
|
}
|
|
1596
1681
|
function SortableTableGhost(props) {
|
|
1597
|
-
return /* @__PURE__ */ (0,
|
|
1682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DataTableGhost, { ...props });
|
|
1598
1683
|
}
|
|
1599
1684
|
function SidebarGhost({ className, items = 6, ...props }) {
|
|
1600
|
-
return /* @__PURE__ */ (0,
|
|
1601
|
-
/* @__PURE__ */ (0,
|
|
1602
|
-
/* @__PURE__ */ (0,
|
|
1603
|
-
/* @__PURE__ */ (0,
|
|
1604
|
-
/* @__PURE__ */ (0,
|
|
1685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("aside", { "aria-hidden": "true", className: cn("fractal-ghost-sidebar", className), ...props, children: [
|
|
1686
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Ghost, { className: "fractal-ghost-sidebar__brand" }),
|
|
1687
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "fractal-ghost-sidebar__items", children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "fractal-ghost-sidebar__item", children: [
|
|
1688
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Ghost, {}),
|
|
1689
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: `${[54, 68, 44, 61][index % 4]}%` })
|
|
1605
1690
|
] }, index)) })
|
|
1606
1691
|
] });
|
|
1607
1692
|
}
|
|
1608
1693
|
function ModalGhost({ className, title, lines = 3, ...props }) {
|
|
1609
|
-
return /* @__PURE__ */ (0,
|
|
1694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SurfaceGhost, { className: cn("fractal-ghost-modal", className), title, lines, ...props });
|
|
1610
1695
|
}
|
|
1611
1696
|
function SidePanelGhost({ className, title, lines = 5, ...props }) {
|
|
1612
|
-
return /* @__PURE__ */ (0,
|
|
1697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SurfaceGhost, { className: cn("fractal-ghost-side-panel", className), title, lines, ...props });
|
|
1613
1698
|
}
|
|
1614
1699
|
function SurfaceGhost({ className, title, lines = 3, ...props }) {
|
|
1615
|
-
return /* @__PURE__ */ (0,
|
|
1616
|
-
/* @__PURE__ */ (0,
|
|
1617
|
-
/* @__PURE__ */ (0,
|
|
1618
|
-
/* @__PURE__ */ (0,
|
|
1700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "aria-hidden": "true", className: cn("fractal-ghost-surface", className), ...props, children: [
|
|
1701
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "fractal-ghost-surface__header", children: [
|
|
1702
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: "42%" }),
|
|
1703
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Ghost, { className: "fractal-ghost-surface__close" })
|
|
1619
1704
|
] }),
|
|
1620
|
-
title && /* @__PURE__ */ (0,
|
|
1621
|
-
/* @__PURE__ */ (0,
|
|
1705
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "fractal-ghost-surface__title", children: title }),
|
|
1706
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GhostLine, { width: index === lines - 1 ? "64%" : "100%" }, index)) })
|
|
1622
1707
|
] });
|
|
1623
1708
|
}
|
|
1624
1709
|
|
|
1625
1710
|
// src/components/Sidebar/Sidebar.tsx
|
|
1626
|
-
var
|
|
1627
|
-
var
|
|
1628
|
-
var Sidebar =
|
|
1629
|
-
({ className, width, compact = false, style, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1711
|
+
var React13 = __toESM(require("react"), 1);
|
|
1712
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1713
|
+
var Sidebar = React13.forwardRef(
|
|
1714
|
+
({ className, width, compact = false, style, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1630
1715
|
"aside",
|
|
1631
1716
|
{
|
|
1632
1717
|
ref,
|
|
@@ -1638,12 +1723,12 @@ var Sidebar = React12.forwardRef(
|
|
|
1638
1723
|
)
|
|
1639
1724
|
);
|
|
1640
1725
|
Sidebar.displayName = "Sidebar";
|
|
1641
|
-
var SidebarHeader =
|
|
1642
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1726
|
+
var SidebarHeader = React13.forwardRef(
|
|
1727
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref, className: cn("fractal-sidebar__header", className), ...props })
|
|
1643
1728
|
);
|
|
1644
1729
|
SidebarHeader.displayName = "SidebarHeader";
|
|
1645
|
-
var SidebarBrand =
|
|
1646
|
-
({ className, type = "button", ...props }, ref) => /* @__PURE__ */ (0,
|
|
1730
|
+
var SidebarBrand = React13.forwardRef(
|
|
1731
|
+
({ className, type = "button", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { ref, type, className: cn("fractal-sidebar__brand", className), ...props })
|
|
1647
1732
|
);
|
|
1648
1733
|
SidebarBrand.displayName = "SidebarBrand";
|
|
1649
1734
|
function SidebarAccountMenu({
|
|
@@ -1654,7 +1739,7 @@ function SidebarAccountMenu({
|
|
|
1654
1739
|
icon,
|
|
1655
1740
|
className
|
|
1656
1741
|
}) {
|
|
1657
|
-
return /* @__PURE__ */ (0,
|
|
1742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1658
1743
|
Dropdown,
|
|
1659
1744
|
{
|
|
1660
1745
|
align: "left",
|
|
@@ -1664,25 +1749,25 @@ function SidebarAccountMenu({
|
|
|
1664
1749
|
panelClassName: "fractal-sidebar__account-panel",
|
|
1665
1750
|
selectedValue: "",
|
|
1666
1751
|
triggerClassName: "fractal-sidebar__account-trigger",
|
|
1667
|
-
triggerContent: /* @__PURE__ */ (0,
|
|
1668
|
-
icon && /* @__PURE__ */ (0,
|
|
1669
|
-
/* @__PURE__ */ (0,
|
|
1752
|
+
triggerContent: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1753
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fractal-sidebar__account-icon", "aria-hidden": "true", children: icon }),
|
|
1754
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fractal-sidebar__account-name", children: name })
|
|
1670
1755
|
] }),
|
|
1671
1756
|
triggerLabel,
|
|
1672
1757
|
triggerVariant: "tertiary"
|
|
1673
1758
|
}
|
|
1674
1759
|
);
|
|
1675
1760
|
}
|
|
1676
|
-
var SidebarNav =
|
|
1677
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1761
|
+
var SidebarNav = React13.forwardRef(
|
|
1762
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("nav", { ref, className: cn("fractal-sidebar__nav", className), ...props })
|
|
1678
1763
|
);
|
|
1679
1764
|
SidebarNav.displayName = "SidebarNav";
|
|
1680
|
-
var SidebarSection =
|
|
1681
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1765
|
+
var SidebarSection = React13.forwardRef(
|
|
1766
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref, className: cn("fractal-sidebar__section", className), ...props })
|
|
1682
1767
|
);
|
|
1683
1768
|
SidebarSection.displayName = "SidebarSection";
|
|
1684
|
-
var SidebarNavItem =
|
|
1685
|
-
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1769
|
+
var SidebarNavItem = React13.forwardRef(
|
|
1770
|
+
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1686
1771
|
"button",
|
|
1687
1772
|
{
|
|
1688
1773
|
ref,
|
|
@@ -1692,28 +1777,28 @@ var SidebarNavItem = React12.forwardRef(
|
|
|
1692
1777
|
"aria-current": active ? "page" : void 0,
|
|
1693
1778
|
...props,
|
|
1694
1779
|
children: [
|
|
1695
|
-
icon && /* @__PURE__ */ (0,
|
|
1696
|
-
/* @__PURE__ */ (0,
|
|
1697
|
-
endAdornment && /* @__PURE__ */ (0,
|
|
1780
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fractal-sidebar__nav-item-icon", "aria-hidden": "true", children: icon }),
|
|
1781
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fractal-sidebar__nav-item-label", children }),
|
|
1782
|
+
endAdornment && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fractal-sidebar__nav-item-end", children: endAdornment })
|
|
1698
1783
|
]
|
|
1699
1784
|
}
|
|
1700
1785
|
)
|
|
1701
1786
|
);
|
|
1702
1787
|
SidebarNavItem.displayName = "SidebarNavItem";
|
|
1703
|
-
var SidebarFooter =
|
|
1704
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1788
|
+
var SidebarFooter = React13.forwardRef(
|
|
1789
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref, className: cn("fractal-sidebar__footer", className), ...props })
|
|
1705
1790
|
);
|
|
1706
1791
|
SidebarFooter.displayName = "SidebarFooter";
|
|
1707
1792
|
|
|
1708
1793
|
// src/components/SidePanel/SidePanel.tsx
|
|
1709
1794
|
var import_react_dom2 = require("react-dom");
|
|
1710
|
-
var
|
|
1711
|
-
var
|
|
1795
|
+
var import_fractal_icons10 = require("@mirror-physics/fractal-icons");
|
|
1796
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1712
1797
|
function SidePanel({ open, onClose, title, description, children, footer, size = "md", loading = false, loadingLabel = "Loading", className }) {
|
|
1713
1798
|
useEscapeDismiss(80, onClose, open);
|
|
1714
1799
|
if (!open) return null;
|
|
1715
1800
|
return (0, import_react_dom2.createPortal)(
|
|
1716
|
-
/* @__PURE__ */ (0,
|
|
1801
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "fractal-side-panel-overlay", onMouseDown: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1717
1802
|
"aside",
|
|
1718
1803
|
{
|
|
1719
1804
|
className: cn("fractal-side-panel", `fractal-side-panel--${size}`, className),
|
|
@@ -1722,15 +1807,15 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
1722
1807
|
role: "dialog",
|
|
1723
1808
|
onMouseDown: (event) => event.stopPropagation(),
|
|
1724
1809
|
children: [
|
|
1725
|
-
/* @__PURE__ */ (0,
|
|
1726
|
-
/* @__PURE__ */ (0,
|
|
1727
|
-
typeof title === "string" ? /* @__PURE__ */ (0,
|
|
1728
|
-
description && /* @__PURE__ */ (0,
|
|
1810
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("header", { className: "fractal-side-panel__header", children: [
|
|
1811
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "fractal-side-panel__heading", children: [
|
|
1812
|
+
typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h2", { className: "fractal-side-panel__title", children: title }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "fractal-side-panel__title", children: title }),
|
|
1813
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "fractal-side-panel__description", children: description })
|
|
1729
1814
|
] }),
|
|
1730
|
-
/* @__PURE__ */ (0,
|
|
1815
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: "fractal-side-panel__close", "aria-label": "Close panel", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_fractal_icons10.Close, { size: 18 }) })
|
|
1731
1816
|
] }),
|
|
1732
|
-
/* @__PURE__ */ (0,
|
|
1733
|
-
footer && /* @__PURE__ */ (0,
|
|
1817
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.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_runtime25.jsx)(UILoader, { label: loadingLabel }) : children }),
|
|
1818
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("footer", { className: "fractal-side-panel__footer", children: footer })
|
|
1734
1819
|
]
|
|
1735
1820
|
}
|
|
1736
1821
|
) }),
|
|
@@ -1739,18 +1824,18 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
1739
1824
|
}
|
|
1740
1825
|
|
|
1741
1826
|
// src/components/Textarea/Textarea.tsx
|
|
1742
|
-
var
|
|
1743
|
-
var
|
|
1744
|
-
var Textarea =
|
|
1745
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1827
|
+
var React14 = __toESM(require("react"), 1);
|
|
1828
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1829
|
+
var Textarea = React14.forwardRef(
|
|
1830
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("textarea", { ref, className: cn("fractal-textarea", className), ...props })
|
|
1746
1831
|
);
|
|
1747
1832
|
Textarea.displayName = "Textarea";
|
|
1748
1833
|
|
|
1749
1834
|
// src/components/TextButton/TextButton.tsx
|
|
1750
|
-
var
|
|
1751
|
-
var
|
|
1752
|
-
var TextButton =
|
|
1753
|
-
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1835
|
+
var React15 = __toESM(require("react"), 1);
|
|
1836
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1837
|
+
var TextButton = React15.forwardRef(
|
|
1838
|
+
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
1754
1839
|
"button",
|
|
1755
1840
|
{
|
|
1756
1841
|
ref,
|
|
@@ -1758,9 +1843,9 @@ var TextButton = React14.forwardRef(
|
|
|
1758
1843
|
type: "button",
|
|
1759
1844
|
...props,
|
|
1760
1845
|
children: [
|
|
1761
|
-
icon && iconPosition === "start" && /* @__PURE__ */ (0,
|
|
1762
|
-
/* @__PURE__ */ (0,
|
|
1763
|
-
icon && iconPosition === "end" && /* @__PURE__ */ (0,
|
|
1846
|
+
icon && iconPosition === "start" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon }),
|
|
1847
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children }),
|
|
1848
|
+
icon && iconPosition === "end" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon })
|
|
1764
1849
|
]
|
|
1765
1850
|
}
|
|
1766
1851
|
)
|
|
@@ -1768,9 +1853,9 @@ var TextButton = React14.forwardRef(
|
|
|
1768
1853
|
TextButton.displayName = "TextButton";
|
|
1769
1854
|
|
|
1770
1855
|
// src/components/FileDropzone/FileDropzone.tsx
|
|
1771
|
-
var
|
|
1772
|
-
var
|
|
1773
|
-
var
|
|
1856
|
+
var React16 = __toESM(require("react"), 1);
|
|
1857
|
+
var import_fractal_icons11 = require("@mirror-physics/fractal-icons");
|
|
1858
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1774
1859
|
function FileDropzone({
|
|
1775
1860
|
files,
|
|
1776
1861
|
onFilesChange,
|
|
@@ -1781,17 +1866,17 @@ function FileDropzone({
|
|
|
1781
1866
|
description = "Files stay attached to this record.",
|
|
1782
1867
|
className
|
|
1783
1868
|
}) {
|
|
1784
|
-
const inputId =
|
|
1785
|
-
const inputRef =
|
|
1786
|
-
const [isDragging, setIsDragging] =
|
|
1869
|
+
const inputId = React16.useId();
|
|
1870
|
+
const inputRef = React16.useRef(null);
|
|
1871
|
+
const [isDragging, setIsDragging] = React16.useState(false);
|
|
1787
1872
|
const addFiles = (nextFiles) => {
|
|
1788
1873
|
if (disabled) return;
|
|
1789
1874
|
const additions = Array.from(nextFiles);
|
|
1790
1875
|
if (additions.length === 0) return;
|
|
1791
1876
|
onFilesChange(multiple ? [...files, ...additions] : additions.slice(0, 1));
|
|
1792
1877
|
};
|
|
1793
|
-
return /* @__PURE__ */ (0,
|
|
1794
|
-
/* @__PURE__ */ (0,
|
|
1878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: cn("fractal-file-dropzone", className), children: [
|
|
1879
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1795
1880
|
"input",
|
|
1796
1881
|
{
|
|
1797
1882
|
ref: inputRef,
|
|
@@ -1807,7 +1892,7 @@ function FileDropzone({
|
|
|
1807
1892
|
}
|
|
1808
1893
|
}
|
|
1809
1894
|
),
|
|
1810
|
-
/* @__PURE__ */ (0,
|
|
1895
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1811
1896
|
"button",
|
|
1812
1897
|
{
|
|
1813
1898
|
className: "fractal-file-dropzone__target",
|
|
@@ -1830,18 +1915,18 @@ function FileDropzone({
|
|
|
1830
1915
|
addFiles(event.dataTransfer.files);
|
|
1831
1916
|
},
|
|
1832
1917
|
children: [
|
|
1833
|
-
/* @__PURE__ */ (0,
|
|
1834
|
-
/* @__PURE__ */ (0,
|
|
1835
|
-
/* @__PURE__ */ (0,
|
|
1836
|
-
description && /* @__PURE__ */ (0,
|
|
1918
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_fractal_icons11.FileArrowUp, { "aria-hidden": "true", size: 20 }),
|
|
1919
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "fractal-file-dropzone__copy", children: [
|
|
1920
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fractal-file-dropzone__title", children: title }),
|
|
1921
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fractal-file-dropzone__description", children: description })
|
|
1837
1922
|
] })
|
|
1838
1923
|
]
|
|
1839
1924
|
}
|
|
1840
1925
|
),
|
|
1841
|
-
files.length > 0 && /* @__PURE__ */ (0,
|
|
1842
|
-
/* @__PURE__ */ (0,
|
|
1843
|
-
/* @__PURE__ */ (0,
|
|
1844
|
-
/* @__PURE__ */ (0,
|
|
1926
|
+
files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ul", { className: "fractal-file-dropzone__files", "aria-label": "Attached files", children: files.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("li", { className: "fractal-file-dropzone__file", children: [
|
|
1927
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fractal-file-dropzone__file-name", children: file.name }),
|
|
1928
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fractal-file-dropzone__file-meta", children: formatFileSize(file.size) }),
|
|
1929
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1845
1930
|
"button",
|
|
1846
1931
|
{
|
|
1847
1932
|
className: "fractal-file-dropzone__remove",
|
|
@@ -1849,7 +1934,7 @@ function FileDropzone({
|
|
|
1849
1934
|
"aria-label": `Remove ${file.name}`,
|
|
1850
1935
|
disabled,
|
|
1851
1936
|
onClick: () => onFilesChange(files.filter((_, fileIndex) => fileIndex !== index)),
|
|
1852
|
-
children: /* @__PURE__ */ (0,
|
|
1937
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_fractal_icons11.Close, { "aria-hidden": "true", size: 14 })
|
|
1853
1938
|
}
|
|
1854
1939
|
)
|
|
1855
1940
|
] }, `${file.name}-${file.size}-${index}`)) })
|
|
@@ -1862,8 +1947,8 @@ function formatFileSize(bytes) {
|
|
|
1862
1947
|
}
|
|
1863
1948
|
|
|
1864
1949
|
// src/components/Pagination/Pagination.tsx
|
|
1865
|
-
var
|
|
1866
|
-
var
|
|
1950
|
+
var import_fractal_icons12 = require("@mirror-physics/fractal-icons");
|
|
1951
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1867
1952
|
function Pagination({
|
|
1868
1953
|
page,
|
|
1869
1954
|
pageSize,
|
|
@@ -1879,10 +1964,10 @@ function Pagination({
|
|
|
1879
1964
|
const start = totalItems === 0 ? 0 : (currentPage - 1) * pageSize + 1;
|
|
1880
1965
|
const end = Math.min(currentPage * pageSize, totalItems);
|
|
1881
1966
|
const canChangePageSize = pageSizeOptions != null && pageSizeOptions.length > 0 && onPageSizeChange != null;
|
|
1882
|
-
return /* @__PURE__ */ (0,
|
|
1883
|
-
/* @__PURE__ */ (0,
|
|
1884
|
-
/* @__PURE__ */ (0,
|
|
1885
|
-
canChangePageSize && /* @__PURE__ */ (0,
|
|
1967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("nav", { className: cn("fractal-pagination", className), "aria-label": ariaLabel, children: [
|
|
1968
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "fractal-pagination__summary", children: totalItems === 0 ? "No results" : `${start}-${end} of ${totalItems}` }),
|
|
1969
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "fractal-pagination__controls", children: [
|
|
1970
|
+
canChangePageSize && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1886
1971
|
Dropdown,
|
|
1887
1972
|
{
|
|
1888
1973
|
align: "right",
|
|
@@ -1899,7 +1984,7 @@ function Pagination({
|
|
|
1899
1984
|
triggerVariant: "tertiary"
|
|
1900
1985
|
}
|
|
1901
1986
|
),
|
|
1902
|
-
/* @__PURE__ */ (0,
|
|
1987
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1903
1988
|
"button",
|
|
1904
1989
|
{
|
|
1905
1990
|
className: "fractal-pagination__button",
|
|
@@ -1908,15 +1993,15 @@ function Pagination({
|
|
|
1908
1993
|
title: "Previous page",
|
|
1909
1994
|
disabled: currentPage === 1 || totalItems === 0,
|
|
1910
1995
|
onClick: () => onPageChange(currentPage - 1),
|
|
1911
|
-
children: /* @__PURE__ */ (0,
|
|
1996
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_fractal_icons12.ArrowLeft, { "aria-hidden": "true", size: 16 })
|
|
1912
1997
|
}
|
|
1913
1998
|
),
|
|
1914
|
-
/* @__PURE__ */ (0,
|
|
1999
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "fractal-pagination__page", "aria-current": "page", children: [
|
|
1915
2000
|
currentPage,
|
|
1916
2001
|
" of ",
|
|
1917
2002
|
totalPages
|
|
1918
2003
|
] }),
|
|
1919
|
-
/* @__PURE__ */ (0,
|
|
2004
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1920
2005
|
"button",
|
|
1921
2006
|
{
|
|
1922
2007
|
className: "fractal-pagination__button",
|
|
@@ -1925,7 +2010,7 @@ function Pagination({
|
|
|
1925
2010
|
title: "Next page",
|
|
1926
2011
|
disabled: currentPage === totalPages || totalItems === 0,
|
|
1927
2012
|
onClick: () => onPageChange(currentPage + 1),
|
|
1928
|
-
children: /* @__PURE__ */ (0,
|
|
2013
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_fractal_icons12.ArrowRight, { "aria-hidden": "true", size: 16 })
|
|
1929
2014
|
}
|
|
1930
2015
|
)
|
|
1931
2016
|
] })
|
|
@@ -1953,6 +2038,7 @@ function Pagination({
|
|
|
1953
2038
|
ChipGhost,
|
|
1954
2039
|
ContentSwitcher,
|
|
1955
2040
|
ContentSwitcherGhost,
|
|
2041
|
+
ConversationGhost,
|
|
1956
2042
|
DataTable,
|
|
1957
2043
|
DataTableGhost,
|
|
1958
2044
|
Disclosure,
|
|
@@ -1977,6 +2063,7 @@ function Pagination({
|
|
|
1977
2063
|
NumberInput,
|
|
1978
2064
|
Pagination,
|
|
1979
2065
|
PaginationGhost,
|
|
2066
|
+
PasswordInput,
|
|
1980
2067
|
PromptCard,
|
|
1981
2068
|
PromptCardGhost,
|
|
1982
2069
|
PromptGrid,
|