@mirror-physics/fractal-ui 0.2.0-next.27 → 0.2.0-next.29
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 +475 -195
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +420 -28
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +106 -4
- package/dist/index.d.ts +106 -4
- package/dist/index.js +431 -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
|
-
|
|
441
|
-
|
|
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, closeDisabled = false, size = "sm", loading = false, loadingLabel = "Loading", className }) {
|
|
490
|
+
useEscapeDismiss(80, onClose, open && !noClose && !closeDisabled);
|
|
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 || closeDisabled ? 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", disabled: closeDisabled, 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,
|
|
@@ -560,8 +609,8 @@ function Dropdown({
|
|
|
560
609
|
document.addEventListener("mousedown", handleClickOutside);
|
|
561
610
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
562
611
|
}, [open]);
|
|
563
|
-
return /* @__PURE__ */
|
|
564
|
-
/* @__PURE__ */
|
|
612
|
+
return /* @__PURE__ */ jsxs9("div", { className: cn("fractal-dropdown", className), children: [
|
|
613
|
+
/* @__PURE__ */ jsxs9(
|
|
565
614
|
"button",
|
|
566
615
|
{
|
|
567
616
|
ref: triggerRef,
|
|
@@ -578,15 +627,15 @@ function Dropdown({
|
|
|
578
627
|
triggerClassName
|
|
579
628
|
),
|
|
580
629
|
children: [
|
|
581
|
-
triggerContent != null ? triggerContent : /* @__PURE__ */
|
|
582
|
-
selected.icon != null && /* @__PURE__ */
|
|
583
|
-
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 })
|
|
584
633
|
] }),
|
|
585
|
-
!noChevron && /* @__PURE__ */
|
|
634
|
+
!noChevron && /* @__PURE__ */ jsx10("span", { className: "fractal-dropdown-chevron", "aria-hidden": true, children: /* @__PURE__ */ jsx10(ChevronIcon, { size: size === "sm" ? 14 : 16 }) })
|
|
586
635
|
]
|
|
587
636
|
}
|
|
588
637
|
),
|
|
589
|
-
open && /* @__PURE__ */
|
|
638
|
+
open && /* @__PURE__ */ jsxs9(
|
|
590
639
|
"div",
|
|
591
640
|
{
|
|
592
641
|
ref: panelRef,
|
|
@@ -595,21 +644,21 @@ function Dropdown({
|
|
|
595
644
|
className: cn("fractal-dropdown-panel", `fractal-dropdown-panel--${size}`, panelClassName),
|
|
596
645
|
style: panelStyle,
|
|
597
646
|
children: [
|
|
598
|
-
label != null && /* @__PURE__ */
|
|
647
|
+
label != null && /* @__PURE__ */ jsx10("div", { className: "fractal-dropdown-label", children: label }),
|
|
599
648
|
visibleItems.map((item, index) => {
|
|
600
|
-
const topDivider = item.border === "top" ? /* @__PURE__ */
|
|
601
|
-
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;
|
|
602
651
|
if (item.kind === "header") {
|
|
603
|
-
return /* @__PURE__ */
|
|
652
|
+
return /* @__PURE__ */ jsxs9(React7.Fragment, { children: [
|
|
604
653
|
topDivider,
|
|
605
|
-
/* @__PURE__ */
|
|
654
|
+
/* @__PURE__ */ jsx10("div", { role: "presentation", className: "fractal-dropdown-label", children: item.description }),
|
|
606
655
|
bottomDivider
|
|
607
656
|
] }, `header-${index}`);
|
|
608
657
|
}
|
|
609
658
|
const isSelected = item.value === selectedValue;
|
|
610
|
-
return /* @__PURE__ */
|
|
659
|
+
return /* @__PURE__ */ jsxs9(React7.Fragment, { children: [
|
|
611
660
|
topDivider,
|
|
612
|
-
/* @__PURE__ */
|
|
661
|
+
/* @__PURE__ */ jsxs9(
|
|
613
662
|
"button",
|
|
614
663
|
{
|
|
615
664
|
type: "button",
|
|
@@ -621,9 +670,9 @@ function Dropdown({
|
|
|
621
670
|
},
|
|
622
671
|
className: "fractal-dropdown-option",
|
|
623
672
|
children: [
|
|
624
|
-
item.icon != null && /* @__PURE__ */
|
|
625
|
-
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */
|
|
626
|
-
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 })
|
|
627
676
|
]
|
|
628
677
|
}
|
|
629
678
|
),
|
|
@@ -638,9 +687,9 @@ function Dropdown({
|
|
|
638
687
|
|
|
639
688
|
// src/components/Link/Link.tsx
|
|
640
689
|
import * as React8 from "react";
|
|
641
|
-
import { jsx as
|
|
690
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
642
691
|
var Link = React8.forwardRef(
|
|
643
|
-
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */
|
|
692
|
+
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
644
693
|
"a",
|
|
645
694
|
{
|
|
646
695
|
ref,
|
|
@@ -653,9 +702,9 @@ Link.displayName = "Link";
|
|
|
653
702
|
|
|
654
703
|
// src/components/Chip/Chip.tsx
|
|
655
704
|
import * as React9 from "react";
|
|
656
|
-
import { jsx as
|
|
705
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
657
706
|
var Chip = React9.forwardRef(
|
|
658
|
-
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */
|
|
707
|
+
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
659
708
|
"span",
|
|
660
709
|
{
|
|
661
710
|
ref,
|
|
@@ -668,9 +717,9 @@ Chip.displayName = "Chip";
|
|
|
668
717
|
|
|
669
718
|
// src/components/Checkbox/Checkbox.tsx
|
|
670
719
|
import { Checkbox as CheckboxIcon, CheckboxChecked } from "@mirror-physics/fractal-icons";
|
|
671
|
-
import { jsx as
|
|
720
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
672
721
|
function Checkbox({ checked, onCheckedChange, className, disabled, onClick, onKeyDown, ...props }) {
|
|
673
|
-
return /* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ jsx13(
|
|
674
723
|
"button",
|
|
675
724
|
{
|
|
676
725
|
...props,
|
|
@@ -687,7 +736,7 @@ function Checkbox({ checked, onCheckedChange, className, disabled, onClick, onKe
|
|
|
687
736
|
onKeyDown?.(event);
|
|
688
737
|
if (event.key === " " || event.key === "Enter") event.stopPropagation();
|
|
689
738
|
},
|
|
690
|
-
children: checked ? /* @__PURE__ */
|
|
739
|
+
children: checked ? /* @__PURE__ */ jsx13(CheckboxChecked, { "aria-hidden": "true", size: 18 }) : /* @__PURE__ */ jsx13(CheckboxIcon, { "aria-hidden": "true", size: 18 })
|
|
691
740
|
}
|
|
692
741
|
);
|
|
693
742
|
}
|
|
@@ -695,7 +744,7 @@ function Checkbox({ checked, onCheckedChange, className, disabled, onClick, onKe
|
|
|
695
744
|
// src/components/SortableTable/SortableTable.tsx
|
|
696
745
|
import { useMemo, useState as useState3 } from "react";
|
|
697
746
|
import { ArrowUp, ArrowDown, ArrowsUpDown } from "@mirror-physics/fractal-icons";
|
|
698
|
-
import { jsx as
|
|
747
|
+
import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
699
748
|
function SortableTable({
|
|
700
749
|
columns,
|
|
701
750
|
data,
|
|
@@ -755,12 +804,12 @@ function SortableTable({
|
|
|
755
804
|
nextDirection = baselineKey === key && baselineDirection ? baselineDirection : "asc";
|
|
756
805
|
} else if (activeKey !== key) {
|
|
757
806
|
nextDirection = "asc";
|
|
807
|
+
} else if (baselineKey === key && baselineDirection) {
|
|
808
|
+
nextDirection = activeDirection === baselineDirection ? baselineDirection === "asc" ? "desc" : "asc" : null;
|
|
758
809
|
} else if (activeDirection === "asc") {
|
|
759
810
|
nextDirection = "desc";
|
|
760
|
-
} else if (activeDirection === "desc") {
|
|
761
|
-
nextDirection = null;
|
|
762
811
|
} else {
|
|
763
|
-
nextDirection =
|
|
812
|
+
nextDirection = null;
|
|
764
813
|
}
|
|
765
814
|
const nextKey = nextDirection === null ? null : key;
|
|
766
815
|
if (isControlled) {
|
|
@@ -771,13 +820,13 @@ function SortableTable({
|
|
|
771
820
|
onSortChange?.(nextKey, nextDirection);
|
|
772
821
|
}
|
|
773
822
|
};
|
|
774
|
-
return /* @__PURE__ */
|
|
775
|
-
header && /* @__PURE__ */
|
|
776
|
-
sorted.length === 0 ? /* @__PURE__ */
|
|
777
|
-
/* @__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) => {
|
|
778
827
|
const isActive = activeKey === col.key && activeDirection !== null;
|
|
779
828
|
if (!col.sortable) {
|
|
780
|
-
return /* @__PURE__ */
|
|
829
|
+
return /* @__PURE__ */ jsx14(
|
|
781
830
|
"th",
|
|
782
831
|
{
|
|
783
832
|
className: "fractal-sortable-table-th",
|
|
@@ -787,12 +836,12 @@ function SortableTable({
|
|
|
787
836
|
col.key
|
|
788
837
|
);
|
|
789
838
|
}
|
|
790
|
-
return /* @__PURE__ */
|
|
839
|
+
return /* @__PURE__ */ jsx14(
|
|
791
840
|
"th",
|
|
792
841
|
{
|
|
793
842
|
className: "fractal-sortable-table-th fractal-sortable-table-th--sortable",
|
|
794
843
|
style: { width: col.width },
|
|
795
|
-
children: /* @__PURE__ */
|
|
844
|
+
children: /* @__PURE__ */ jsxs10(
|
|
796
845
|
"button",
|
|
797
846
|
{
|
|
798
847
|
type: "button",
|
|
@@ -803,8 +852,8 @@ function SortableTable({
|
|
|
803
852
|
onClick: () => handleSortClick(col.key),
|
|
804
853
|
"aria-sort": isActive ? activeDirection === "asc" ? "ascending" : "descending" : "none",
|
|
805
854
|
children: [
|
|
806
|
-
/* @__PURE__ */
|
|
807
|
-
/* @__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 }) })
|
|
808
857
|
]
|
|
809
858
|
}
|
|
810
859
|
)
|
|
@@ -812,13 +861,13 @@ function SortableTable({
|
|
|
812
861
|
col.key
|
|
813
862
|
);
|
|
814
863
|
}) }) }),
|
|
815
|
-
/* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ jsx14("tbody", { children: sorted.map((row, rowIndex) => {
|
|
816
865
|
const highlighted = highlightRow?.(row, rowIndex) ?? false;
|
|
817
866
|
const action = rowAction ? {
|
|
818
867
|
label: rowAction.label(row, rowIndex),
|
|
819
868
|
icon: rowAction.icon(row, rowIndex)
|
|
820
869
|
} : null;
|
|
821
|
-
return /* @__PURE__ */
|
|
870
|
+
return /* @__PURE__ */ jsx14(
|
|
822
871
|
"tr",
|
|
823
872
|
{
|
|
824
873
|
className: cn(
|
|
@@ -836,7 +885,7 @@ function SortableTable({
|
|
|
836
885
|
"aria-label": action?.label,
|
|
837
886
|
role: onRowClick ? "button" : void 0,
|
|
838
887
|
tabIndex: onRowClick ? 0 : void 0,
|
|
839
|
-
children: columns.map((col, columnIndex) => /* @__PURE__ */
|
|
888
|
+
children: columns.map((col, columnIndex) => /* @__PURE__ */ jsxs10(
|
|
840
889
|
"td",
|
|
841
890
|
{
|
|
842
891
|
className: cn(
|
|
@@ -846,7 +895,7 @@ function SortableTable({
|
|
|
846
895
|
style: { width: col.width, textAlign: col.align ?? "left" },
|
|
847
896
|
children: [
|
|
848
897
|
col.render(row, rowIndex),
|
|
849
|
-
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 }) })
|
|
850
899
|
]
|
|
851
900
|
},
|
|
852
901
|
col.key
|
|
@@ -860,8 +909,8 @@ function SortableTable({
|
|
|
860
909
|
}
|
|
861
910
|
|
|
862
911
|
// src/components/Tabs/Tabs.tsx
|
|
863
|
-
import { useId, useLayoutEffect as useLayoutEffect2, useRef as useRef3, useState as useState4 } from "react";
|
|
864
|
-
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";
|
|
865
914
|
function Tabs({
|
|
866
915
|
items,
|
|
867
916
|
defaultValue,
|
|
@@ -871,7 +920,7 @@ function Tabs({
|
|
|
871
920
|
ariaLabel,
|
|
872
921
|
divider = false
|
|
873
922
|
}) {
|
|
874
|
-
const reactId =
|
|
923
|
+
const reactId = useId2();
|
|
875
924
|
const [internalValue, setInternalValue] = useState4(
|
|
876
925
|
defaultValue ?? items.find((i) => !i.disabled)?.id ?? items[0]?.id ?? ""
|
|
877
926
|
);
|
|
@@ -931,8 +980,8 @@ function Tabs({
|
|
|
931
980
|
selectTab(nextId2);
|
|
932
981
|
requestAnimationFrame(() => tabRefs.current[nextId2]?.focus());
|
|
933
982
|
};
|
|
934
|
-
return /* @__PURE__ */
|
|
935
|
-
/* @__PURE__ */
|
|
983
|
+
return /* @__PURE__ */ jsxs11("div", { className: cn("fractal-tabs", divider && "fractal-tabs--divider", className), children: [
|
|
984
|
+
/* @__PURE__ */ jsx15(
|
|
936
985
|
"div",
|
|
937
986
|
{
|
|
938
987
|
ref: tabListRef,
|
|
@@ -945,7 +994,7 @@ function Tabs({
|
|
|
945
994
|
const isActive = item.id === activeId;
|
|
946
995
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
947
996
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
948
|
-
return /* @__PURE__ */
|
|
997
|
+
return /* @__PURE__ */ jsx15(
|
|
949
998
|
"button",
|
|
950
999
|
{
|
|
951
1000
|
ref: (el) => {
|
|
@@ -976,7 +1025,7 @@ function Tabs({
|
|
|
976
1025
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
977
1026
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
978
1027
|
const isActive = item.id === activeId;
|
|
979
|
-
return /* @__PURE__ */
|
|
1028
|
+
return /* @__PURE__ */ jsx15(
|
|
980
1029
|
"div",
|
|
981
1030
|
{
|
|
982
1031
|
id: panelId,
|
|
@@ -994,9 +1043,36 @@ function Tabs({
|
|
|
994
1043
|
|
|
995
1044
|
// src/components/ContentSwitcher/ContentSwitcher.tsx
|
|
996
1045
|
import * as React10 from "react";
|
|
997
|
-
import { jsx as
|
|
1046
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
998
1047
|
function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = false, className }) {
|
|
1048
|
+
const switcherRef = React10.useRef(null);
|
|
999
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]);
|
|
1000
1076
|
const moveFocus = (index, direction) => {
|
|
1001
1077
|
let nextIndex = index;
|
|
1002
1078
|
do {
|
|
@@ -1007,40 +1083,52 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1007
1083
|
onValueChange(items[nextIndex].value);
|
|
1008
1084
|
}
|
|
1009
1085
|
};
|
|
1010
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
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
|
+
);
|
|
1038
1126
|
}
|
|
1039
1127
|
|
|
1040
1128
|
// src/components/Disclosure/Disclosure.tsx
|
|
1041
|
-
import { useId as
|
|
1129
|
+
import { useId as useId3, useState as useState5 } from "react";
|
|
1042
1130
|
import { ChevronRight, ChevronDown as ChevronDown2 } from "@mirror-physics/fractal-icons";
|
|
1043
|
-
import { jsx as
|
|
1131
|
+
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1044
1132
|
function Disclosure({
|
|
1045
1133
|
title,
|
|
1046
1134
|
meta,
|
|
@@ -1052,7 +1140,7 @@ function Disclosure({
|
|
|
1052
1140
|
className,
|
|
1053
1141
|
variant = "card"
|
|
1054
1142
|
}) {
|
|
1055
|
-
const reactId =
|
|
1143
|
+
const reactId = useId3();
|
|
1056
1144
|
const headerId = `${reactId}-header`;
|
|
1057
1145
|
const panelId = `${reactId}-panel`;
|
|
1058
1146
|
const [internalOpen, setInternalOpen] = useState5(defaultOpen);
|
|
@@ -1068,7 +1156,7 @@ function Disclosure({
|
|
|
1068
1156
|
onOpenChange?.(next);
|
|
1069
1157
|
}
|
|
1070
1158
|
};
|
|
1071
|
-
return /* @__PURE__ */
|
|
1159
|
+
return /* @__PURE__ */ jsxs13(
|
|
1072
1160
|
"div",
|
|
1073
1161
|
{
|
|
1074
1162
|
className: cn(
|
|
@@ -1079,7 +1167,7 @@ function Disclosure({
|
|
|
1079
1167
|
className
|
|
1080
1168
|
),
|
|
1081
1169
|
children: [
|
|
1082
|
-
/* @__PURE__ */
|
|
1170
|
+
/* @__PURE__ */ jsxs13(
|
|
1083
1171
|
"button",
|
|
1084
1172
|
{
|
|
1085
1173
|
type: "button",
|
|
@@ -1090,13 +1178,13 @@ function Disclosure({
|
|
|
1090
1178
|
disabled,
|
|
1091
1179
|
onClick: toggle,
|
|
1092
1180
|
children: [
|
|
1093
|
-
/* @__PURE__ */
|
|
1094
|
-
/* @__PURE__ */
|
|
1095
|
-
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 })
|
|
1096
1184
|
]
|
|
1097
1185
|
}
|
|
1098
1186
|
),
|
|
1099
|
-
/* @__PURE__ */
|
|
1187
|
+
/* @__PURE__ */ jsx17(
|
|
1100
1188
|
"div",
|
|
1101
1189
|
{
|
|
1102
1190
|
id: panelId,
|
|
@@ -1104,7 +1192,7 @@ function Disclosure({
|
|
|
1104
1192
|
"aria-labelledby": headerId,
|
|
1105
1193
|
className: "fractal-disclosure-panel",
|
|
1106
1194
|
hidden: !isOpen,
|
|
1107
|
-
children: /* @__PURE__ */
|
|
1195
|
+
children: /* @__PURE__ */ jsx17("div", { className: "fractal-disclosure-panel-inner", children })
|
|
1108
1196
|
}
|
|
1109
1197
|
)
|
|
1110
1198
|
]
|
|
@@ -1113,18 +1201,18 @@ function Disclosure({
|
|
|
1113
1201
|
}
|
|
1114
1202
|
|
|
1115
1203
|
// src/components/LatticeLoader/LatticeLoader.tsx
|
|
1116
|
-
import { jsx as
|
|
1204
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1117
1205
|
var LATTICE_COUNT = 160;
|
|
1118
1206
|
var WAVE_PERIOD = 80;
|
|
1119
1207
|
function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
1120
|
-
return /* @__PURE__ */
|
|
1208
|
+
return /* @__PURE__ */ jsx18(
|
|
1121
1209
|
"span",
|
|
1122
1210
|
{
|
|
1123
1211
|
"aria-label": label,
|
|
1124
1212
|
className: cn("fractal-lattice-loader", className),
|
|
1125
1213
|
role: "progressbar",
|
|
1126
1214
|
...props,
|
|
1127
|
-
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */
|
|
1215
|
+
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ jsx18(
|
|
1128
1216
|
"span",
|
|
1129
1217
|
{
|
|
1130
1218
|
"aria-hidden": "true",
|
|
@@ -1137,11 +1225,151 @@ function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
|
1137
1225
|
);
|
|
1138
1226
|
}
|
|
1139
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
|
+
|
|
1140
1368
|
// src/components/Sidebar/Sidebar.tsx
|
|
1141
1369
|
import * as React11 from "react";
|
|
1142
|
-
import { jsx as
|
|
1370
|
+
import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1143
1371
|
var Sidebar = React11.forwardRef(
|
|
1144
|
-
({ className, width, style, ...props }, ref) => /* @__PURE__ */
|
|
1372
|
+
({ className, width, style, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
1145
1373
|
"aside",
|
|
1146
1374
|
{
|
|
1147
1375
|
ref,
|
|
@@ -1153,23 +1381,23 @@ var Sidebar = React11.forwardRef(
|
|
|
1153
1381
|
);
|
|
1154
1382
|
Sidebar.displayName = "Sidebar";
|
|
1155
1383
|
var SidebarHeader = React11.forwardRef(
|
|
1156
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1384
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx20("div", { ref, className: cn("fractal-sidebar__header", className), ...props })
|
|
1157
1385
|
);
|
|
1158
1386
|
SidebarHeader.displayName = "SidebarHeader";
|
|
1159
1387
|
var SidebarBrand = React11.forwardRef(
|
|
1160
|
-
({ className, type = "button", ...props }, ref) => /* @__PURE__ */
|
|
1388
|
+
({ className, type = "button", ...props }, ref) => /* @__PURE__ */ jsx20("button", { ref, type, className: cn("fractal-sidebar__brand", className), ...props })
|
|
1161
1389
|
);
|
|
1162
1390
|
SidebarBrand.displayName = "SidebarBrand";
|
|
1163
1391
|
var SidebarNav = React11.forwardRef(
|
|
1164
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1392
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx20("nav", { ref, className: cn("fractal-sidebar__nav", className), ...props })
|
|
1165
1393
|
);
|
|
1166
1394
|
SidebarNav.displayName = "SidebarNav";
|
|
1167
1395
|
var SidebarSection = React11.forwardRef(
|
|
1168
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1396
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx20("div", { ref, className: cn("fractal-sidebar__section", className), ...props })
|
|
1169
1397
|
);
|
|
1170
1398
|
SidebarSection.displayName = "SidebarSection";
|
|
1171
1399
|
var SidebarNavItem = React11.forwardRef(
|
|
1172
|
-
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */
|
|
1400
|
+
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ jsxs15(
|
|
1173
1401
|
"button",
|
|
1174
1402
|
{
|
|
1175
1403
|
ref,
|
|
@@ -1179,28 +1407,28 @@ var SidebarNavItem = React11.forwardRef(
|
|
|
1179
1407
|
"aria-current": active ? "page" : void 0,
|
|
1180
1408
|
...props,
|
|
1181
1409
|
children: [
|
|
1182
|
-
icon && /* @__PURE__ */
|
|
1183
|
-
/* @__PURE__ */
|
|
1184
|
-
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 })
|
|
1185
1413
|
]
|
|
1186
1414
|
}
|
|
1187
1415
|
)
|
|
1188
1416
|
);
|
|
1189
1417
|
SidebarNavItem.displayName = "SidebarNavItem";
|
|
1190
1418
|
var SidebarFooter = React11.forwardRef(
|
|
1191
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1419
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx20("div", { ref, className: cn("fractal-sidebar__footer", className), ...props })
|
|
1192
1420
|
);
|
|
1193
1421
|
SidebarFooter.displayName = "SidebarFooter";
|
|
1194
1422
|
|
|
1195
1423
|
// src/components/SidePanel/SidePanel.tsx
|
|
1196
1424
|
import { createPortal as createPortal2 } from "react-dom";
|
|
1197
1425
|
import { Close } from "@mirror-physics/fractal-icons";
|
|
1198
|
-
import { jsx as
|
|
1199
|
-
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 }) {
|
|
1200
1428
|
useEscapeDismiss(80, onClose, open);
|
|
1201
1429
|
if (!open) return null;
|
|
1202
1430
|
return createPortal2(
|
|
1203
|
-
/* @__PURE__ */
|
|
1431
|
+
/* @__PURE__ */ jsx21("div", { className: "fractal-side-panel-overlay", onMouseDown: onClose, children: /* @__PURE__ */ jsxs16(
|
|
1204
1432
|
"aside",
|
|
1205
1433
|
{
|
|
1206
1434
|
className: cn("fractal-side-panel", `fractal-side-panel--${size}`, className),
|
|
@@ -1209,15 +1437,15 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
1209
1437
|
role: "dialog",
|
|
1210
1438
|
onMouseDown: (event) => event.stopPropagation(),
|
|
1211
1439
|
children: [
|
|
1212
|
-
/* @__PURE__ */
|
|
1213
|
-
/* @__PURE__ */
|
|
1214
|
-
/* @__PURE__ */
|
|
1215
|
-
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 })
|
|
1216
1444
|
] }),
|
|
1217
|
-
/* @__PURE__ */
|
|
1445
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: "fractal-side-panel__close", "aria-label": "Close panel", onClick: onClose, children: /* @__PURE__ */ jsx21(Close, { size: 18 }) })
|
|
1218
1446
|
] }),
|
|
1219
|
-
/* @__PURE__ */
|
|
1220
|
-
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 })
|
|
1221
1449
|
]
|
|
1222
1450
|
}
|
|
1223
1451
|
) }),
|
|
@@ -1227,17 +1455,17 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
1227
1455
|
|
|
1228
1456
|
// src/components/Textarea/Textarea.tsx
|
|
1229
1457
|
import * as React12 from "react";
|
|
1230
|
-
import { jsx as
|
|
1458
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1231
1459
|
var Textarea = React12.forwardRef(
|
|
1232
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1460
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx22("textarea", { ref, className: cn("fractal-textarea", className), ...props })
|
|
1233
1461
|
);
|
|
1234
1462
|
Textarea.displayName = "Textarea";
|
|
1235
1463
|
|
|
1236
1464
|
// src/components/TextButton/TextButton.tsx
|
|
1237
1465
|
import * as React13 from "react";
|
|
1238
|
-
import { jsx as
|
|
1466
|
+
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1239
1467
|
var TextButton = React13.forwardRef(
|
|
1240
|
-
({ 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(
|
|
1241
1469
|
"button",
|
|
1242
1470
|
{
|
|
1243
1471
|
ref,
|
|
@@ -1245,9 +1473,9 @@ var TextButton = React13.forwardRef(
|
|
|
1245
1473
|
type: "button",
|
|
1246
1474
|
...props,
|
|
1247
1475
|
children: [
|
|
1248
|
-
icon && iconPosition === "start" && /* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */
|
|
1250
|
-
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 })
|
|
1251
1479
|
]
|
|
1252
1480
|
}
|
|
1253
1481
|
)
|
|
@@ -1257,7 +1485,7 @@ TextButton.displayName = "TextButton";
|
|
|
1257
1485
|
// src/components/FileDropzone/FileDropzone.tsx
|
|
1258
1486
|
import * as React14 from "react";
|
|
1259
1487
|
import { Close as Close2, FileArrowUp } from "@mirror-physics/fractal-icons";
|
|
1260
|
-
import { jsx as
|
|
1488
|
+
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1261
1489
|
function FileDropzone({
|
|
1262
1490
|
files,
|
|
1263
1491
|
onFilesChange,
|
|
@@ -1277,8 +1505,8 @@ function FileDropzone({
|
|
|
1277
1505
|
if (additions.length === 0) return;
|
|
1278
1506
|
onFilesChange(multiple ? [...files, ...additions] : additions.slice(0, 1));
|
|
1279
1507
|
};
|
|
1280
|
-
return /* @__PURE__ */
|
|
1281
|
-
/* @__PURE__ */
|
|
1508
|
+
return /* @__PURE__ */ jsxs18("div", { className: cn("fractal-file-dropzone", className), children: [
|
|
1509
|
+
/* @__PURE__ */ jsx24(
|
|
1282
1510
|
"input",
|
|
1283
1511
|
{
|
|
1284
1512
|
ref: inputRef,
|
|
@@ -1294,7 +1522,7 @@ function FileDropzone({
|
|
|
1294
1522
|
}
|
|
1295
1523
|
}
|
|
1296
1524
|
),
|
|
1297
|
-
/* @__PURE__ */
|
|
1525
|
+
/* @__PURE__ */ jsxs18(
|
|
1298
1526
|
"button",
|
|
1299
1527
|
{
|
|
1300
1528
|
className: "fractal-file-dropzone__target",
|
|
@@ -1317,18 +1545,18 @@ function FileDropzone({
|
|
|
1317
1545
|
addFiles(event.dataTransfer.files);
|
|
1318
1546
|
},
|
|
1319
1547
|
children: [
|
|
1320
|
-
/* @__PURE__ */
|
|
1321
|
-
/* @__PURE__ */
|
|
1322
|
-
/* @__PURE__ */
|
|
1323
|
-
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 })
|
|
1324
1552
|
] })
|
|
1325
1553
|
]
|
|
1326
1554
|
}
|
|
1327
1555
|
),
|
|
1328
|
-
files.length > 0 && /* @__PURE__ */
|
|
1329
|
-
/* @__PURE__ */
|
|
1330
|
-
/* @__PURE__ */
|
|
1331
|
-
/* @__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(
|
|
1332
1560
|
"button",
|
|
1333
1561
|
{
|
|
1334
1562
|
className: "fractal-file-dropzone__remove",
|
|
@@ -1336,7 +1564,7 @@ function FileDropzone({
|
|
|
1336
1564
|
"aria-label": `Remove ${file.name}`,
|
|
1337
1565
|
disabled,
|
|
1338
1566
|
onClick: () => onFilesChange(files.filter((_, fileIndex) => fileIndex !== index)),
|
|
1339
|
-
children: /* @__PURE__ */
|
|
1567
|
+
children: /* @__PURE__ */ jsx24(Close2, { "aria-hidden": "true", size: 14 })
|
|
1340
1568
|
}
|
|
1341
1569
|
)
|
|
1342
1570
|
] }, `${file.name}-${file.size}-${index}`)) })
|
|
@@ -1350,7 +1578,7 @@ function formatFileSize(bytes) {
|
|
|
1350
1578
|
|
|
1351
1579
|
// src/components/Pagination/Pagination.tsx
|
|
1352
1580
|
import { ArrowLeft, ArrowRight } from "@mirror-physics/fractal-icons";
|
|
1353
|
-
import { jsx as
|
|
1581
|
+
import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1354
1582
|
function Pagination({
|
|
1355
1583
|
page,
|
|
1356
1584
|
pageSize,
|
|
@@ -1366,10 +1594,10 @@ function Pagination({
|
|
|
1366
1594
|
const start = totalItems === 0 ? 0 : (currentPage - 1) * pageSize + 1;
|
|
1367
1595
|
const end = Math.min(currentPage * pageSize, totalItems);
|
|
1368
1596
|
const canChangePageSize = pageSizeOptions != null && pageSizeOptions.length > 0 && onPageSizeChange != null;
|
|
1369
|
-
return /* @__PURE__ */
|
|
1370
|
-
/* @__PURE__ */
|
|
1371
|
-
/* @__PURE__ */
|
|
1372
|
-
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(
|
|
1373
1601
|
Dropdown,
|
|
1374
1602
|
{
|
|
1375
1603
|
align: "right",
|
|
@@ -1386,7 +1614,7 @@ function Pagination({
|
|
|
1386
1614
|
triggerVariant: "tertiary"
|
|
1387
1615
|
}
|
|
1388
1616
|
),
|
|
1389
|
-
/* @__PURE__ */
|
|
1617
|
+
/* @__PURE__ */ jsx25(
|
|
1390
1618
|
"button",
|
|
1391
1619
|
{
|
|
1392
1620
|
className: "fractal-pagination__button",
|
|
@@ -1395,15 +1623,15 @@ function Pagination({
|
|
|
1395
1623
|
title: "Previous page",
|
|
1396
1624
|
disabled: currentPage === 1 || totalItems === 0,
|
|
1397
1625
|
onClick: () => onPageChange(currentPage - 1),
|
|
1398
|
-
children: /* @__PURE__ */
|
|
1626
|
+
children: /* @__PURE__ */ jsx25(ArrowLeft, { "aria-hidden": "true", size: 16 })
|
|
1399
1627
|
}
|
|
1400
1628
|
),
|
|
1401
|
-
/* @__PURE__ */
|
|
1629
|
+
/* @__PURE__ */ jsxs19("span", { className: "fractal-pagination__page", "aria-current": "page", children: [
|
|
1402
1630
|
currentPage,
|
|
1403
1631
|
" of ",
|
|
1404
1632
|
totalPages
|
|
1405
1633
|
] }),
|
|
1406
|
-
/* @__PURE__ */
|
|
1634
|
+
/* @__PURE__ */ jsx25(
|
|
1407
1635
|
"button",
|
|
1408
1636
|
{
|
|
1409
1637
|
className: "fractal-pagination__button",
|
|
@@ -1412,7 +1640,7 @@ function Pagination({
|
|
|
1412
1640
|
title: "Next page",
|
|
1413
1641
|
disabled: currentPage === totalPages || totalItems === 0,
|
|
1414
1642
|
onClick: () => onPageChange(currentPage + 1),
|
|
1415
|
-
children: /* @__PURE__ */
|
|
1643
|
+
children: /* @__PURE__ */ jsx25(ArrowRight, { "aria-hidden": "true", size: 16 })
|
|
1416
1644
|
}
|
|
1417
1645
|
)
|
|
1418
1646
|
] })
|
|
@@ -1421,44 +1649,70 @@ function Pagination({
|
|
|
1421
1649
|
export {
|
|
1422
1650
|
Alert,
|
|
1423
1651
|
AlertDescription,
|
|
1652
|
+
AlertGhost,
|
|
1424
1653
|
AlertTitle,
|
|
1425
1654
|
Button,
|
|
1655
|
+
ButtonGhost,
|
|
1426
1656
|
Card,
|
|
1427
1657
|
CardContent,
|
|
1428
1658
|
CardDescription,
|
|
1429
1659
|
CardFooter,
|
|
1660
|
+
CardGhost,
|
|
1430
1661
|
CardHeader,
|
|
1431
1662
|
CardTitle,
|
|
1432
1663
|
Checkbox,
|
|
1664
|
+
CheckboxGhost,
|
|
1433
1665
|
Chip,
|
|
1666
|
+
ChipGhost,
|
|
1434
1667
|
ContentSwitcher,
|
|
1668
|
+
ContentSwitcherGhost,
|
|
1435
1669
|
DataTable,
|
|
1670
|
+
DataTableGhost,
|
|
1436
1671
|
Disclosure,
|
|
1672
|
+
DisclosureGhost,
|
|
1437
1673
|
Dropdown,
|
|
1674
|
+
DropdownGhost,
|
|
1438
1675
|
FeatureCard,
|
|
1439
1676
|
FileDropzone,
|
|
1677
|
+
FileDropzoneGhost,
|
|
1440
1678
|
FolderCard,
|
|
1679
|
+
Ghost,
|
|
1680
|
+
GhostLine,
|
|
1441
1681
|
Input,
|
|
1682
|
+
InputGhost,
|
|
1442
1683
|
Label,
|
|
1684
|
+
LabelGhost,
|
|
1443
1685
|
LatticeLoader,
|
|
1444
1686
|
Link,
|
|
1687
|
+
LinkGhost,
|
|
1445
1688
|
Modal,
|
|
1689
|
+
ModalGhost,
|
|
1446
1690
|
Pagination,
|
|
1691
|
+
PaginationGhost,
|
|
1447
1692
|
PromptCard,
|
|
1693
|
+
PromptCardGhost,
|
|
1448
1694
|
PromptGrid,
|
|
1449
1695
|
SidePanel,
|
|
1696
|
+
SidePanelGhost,
|
|
1450
1697
|
Sidebar,
|
|
1451
1698
|
SidebarBrand,
|
|
1452
1699
|
SidebarFooter,
|
|
1700
|
+
SidebarGhost,
|
|
1453
1701
|
SidebarHeader,
|
|
1454
1702
|
SidebarNav,
|
|
1455
1703
|
SidebarNavItem,
|
|
1456
1704
|
SidebarSection,
|
|
1457
1705
|
SortableTable,
|
|
1706
|
+
SortableTableGhost,
|
|
1458
1707
|
Tabs,
|
|
1708
|
+
TabsGhost,
|
|
1459
1709
|
TextButton,
|
|
1710
|
+
TextButtonGhost,
|
|
1460
1711
|
Textarea,
|
|
1712
|
+
TextareaGhost,
|
|
1461
1713
|
Toggle,
|
|
1714
|
+
ToggleGhost,
|
|
1715
|
+
UILoader,
|
|
1462
1716
|
cn,
|
|
1463
1717
|
useEscapeDismiss
|
|
1464
1718
|
};
|