@tensor_1/react 2.10.0 → 2.11.0
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/chart.cjs +3 -12
- package/dist/components/Alert.js +7 -15
- package/dist/components/AppShell.d.ts +1 -3
- package/dist/components/AppShell.js +1 -3
- package/dist/components/Avatar.js +1 -2
- package/dist/components/Button.js +16 -32
- package/dist/components/Card.d.ts +1 -3
- package/dist/components/Card.js +2 -2
- package/dist/components/Chart.js +3 -12
- package/dist/components/CommandPalette.d.ts +2 -4
- package/dist/components/CommandPalette.js +13 -66
- package/dist/components/Comments.d.ts +1 -5
- package/dist/components/Comments.js +1 -1
- package/dist/components/Composer.d.ts +1 -8
- package/dist/components/Composer.js +2 -7
- package/dist/components/DetailLayout.js +1 -1
- package/dist/components/Drawer.d.ts +4 -3
- package/dist/components/Drawer.js +4 -6
- package/dist/components/Field.js +3 -6
- package/dist/components/Inbox.d.ts +3 -13
- package/dist/components/Inbox.js +3 -61
- package/dist/components/Input.d.ts +2 -13
- package/dist/components/Input.js +5 -20
- package/dist/components/Kanban.d.ts +3 -15
- package/dist/components/Kanban.js +10 -42
- package/dist/components/Meter.d.ts +1 -3
- package/dist/components/Meter.js +1 -9
- package/dist/components/Modal.d.ts +5 -3
- package/dist/components/Modal.js +4 -6
- package/dist/components/NavFavourites.js +0 -11
- package/dist/components/PageHeader.d.ts +1 -3
- package/dist/components/PageHeader.js +2 -2
- package/dist/components/Peek.d.ts +4 -3
- package/dist/components/Peek.js +6 -9
- package/dist/components/Progress.d.ts +1 -3
- package/dist/components/Progress.js +3 -5
- package/dist/components/Radio.d.ts +1 -3
- package/dist/components/Radio.js +2 -6
- package/dist/components/Sidebar.js +2 -4
- package/dist/components/Spinner.d.ts +1 -3
- package/dist/components/Spinner.js +3 -3
- package/dist/components/Stat.js +1 -5
- package/dist/components/States.d.ts +1 -3
- package/dist/components/States.js +2 -8
- package/dist/components/Table.d.ts +2 -9
- package/dist/components/Table.js +6 -10
- package/dist/components/Tabs.d.ts +1 -13
- package/dist/components/Tabs.js +3 -78
- package/dist/components/Timeline.d.ts +3 -3
- package/dist/components/Timeline.js +3 -3
- package/dist/components/Toast.js +5 -42
- package/dist/components/Tooltip.d.ts +1 -3
- package/dist/components/Tooltip.js +5 -44
- package/dist/components/Tree.d.ts +0 -2
- package/dist/components/Tree.js +4 -26
- package/dist/hooks/useDialog.d.ts +1 -1
- package/dist/hooks/useDialog.js +2 -17
- package/dist/hooks/useTable.d.ts +0 -5
- package/dist/hooks/useTable.js +1 -20
- package/dist/index.cjs +162 -616
- package/dist/index.d.cts +37 -127
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -2
- package/dist/tree-model.d.ts +0 -4
- package/dist/tree-model.js +0 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -103,7 +103,6 @@ __export(src_exports, {
|
|
|
103
103
|
SubNavItem: () => SubNavItem,
|
|
104
104
|
Switch: () => Switch,
|
|
105
105
|
Tab: () => Tab,
|
|
106
|
-
TabPanel: () => TabPanel,
|
|
107
106
|
Table: () => Table,
|
|
108
107
|
TableWrap: () => TableWrap,
|
|
109
108
|
Tabs: () => Tabs,
|
|
@@ -182,10 +181,8 @@ function unlockBodyScroll() {
|
|
|
182
181
|
saved = null;
|
|
183
182
|
}
|
|
184
183
|
}
|
|
185
|
-
function useDialog(open
|
|
184
|
+
function useDialog(open) {
|
|
186
185
|
const ref = (0, import_react.useRef)(null);
|
|
187
|
-
const onCloseRef = (0, import_react.useRef)(onClose);
|
|
188
|
-
onCloseRef.current = onClose;
|
|
189
186
|
(0, import_react.useEffect)(() => {
|
|
190
187
|
const el = ref.current;
|
|
191
188
|
if (!el || !open) {
|
|
@@ -194,21 +191,8 @@ function useDialog(open, onClose) {
|
|
|
194
191
|
}
|
|
195
192
|
if (!el.open) el.showModal();
|
|
196
193
|
lockBodyScroll();
|
|
197
|
-
let locked = true;
|
|
198
|
-
const handleClose = () => {
|
|
199
|
-
if (locked) {
|
|
200
|
-
locked = false;
|
|
201
|
-
unlockBodyScroll();
|
|
202
|
-
}
|
|
203
|
-
onCloseRef.current?.();
|
|
204
|
-
};
|
|
205
|
-
el.addEventListener("close", handleClose);
|
|
206
194
|
return () => {
|
|
207
|
-
|
|
208
|
-
if (locked) {
|
|
209
|
-
locked = false;
|
|
210
|
-
unlockBodyScroll();
|
|
211
|
-
}
|
|
195
|
+
unlockBodyScroll();
|
|
212
196
|
if (el.open) el.close();
|
|
213
197
|
};
|
|
214
198
|
}, [open]);
|
|
@@ -475,24 +459,6 @@ function useTable(data, options = {}) {
|
|
|
475
459
|
const toggleAllRows = (0, import_react2.useCallback)(() => setSelected((s) => togglePage(s, pageIds)), [pageIds]);
|
|
476
460
|
const clearSelection = (0, import_react2.useCallback)(() => setSelected(/* @__PURE__ */ new Set()), []);
|
|
477
461
|
const togglePin = (0, import_react2.useCallback)((id) => setPinned((s) => toggleId(s, id)), []);
|
|
478
|
-
const [announcement, setAnnouncement] = (0, import_react2.useState)("");
|
|
479
|
-
const mounted = (0, import_react2.useRef)(false);
|
|
480
|
-
(0, import_react2.useEffect)(() => {
|
|
481
|
-
if (!mounted.current) return;
|
|
482
|
-
const key = sort[0];
|
|
483
|
-
setAnnouncement(key ? `Sorted by ${key.field}, ${key.dir}` : "Sort cleared");
|
|
484
|
-
}, [sort]);
|
|
485
|
-
(0, import_react2.useEffect)(() => {
|
|
486
|
-
if (!mounted.current) return;
|
|
487
|
-
setAnnouncement(`${rows.length} result${rows.length === 1 ? "" : "s"}`);
|
|
488
|
-
}, [filters, query]);
|
|
489
|
-
(0, import_react2.useEffect)(() => {
|
|
490
|
-
if (!mounted.current) return;
|
|
491
|
-
setAnnouncement(`${selected.size} selected`);
|
|
492
|
-
}, [selected]);
|
|
493
|
-
(0, import_react2.useEffect)(() => {
|
|
494
|
-
mounted.current = true;
|
|
495
|
-
}, []);
|
|
496
462
|
const view = (0, import_react2.useMemo)(() => ({ sort, filters, q: query }), [sort, filters, query]);
|
|
497
463
|
const viewQueryString = (0, import_react2.useMemo)(() => serializeView(view), [view]);
|
|
498
464
|
const applyView = (0, import_react2.useCallback)((queryString) => {
|
|
@@ -509,7 +475,6 @@ function useTable(data, options = {}) {
|
|
|
509
475
|
selected,
|
|
510
476
|
pinned,
|
|
511
477
|
selectAll,
|
|
512
|
-
announcement,
|
|
513
478
|
toggleSort: doToggleSort,
|
|
514
479
|
setSort,
|
|
515
480
|
setFilters,
|
|
@@ -632,40 +597,24 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
|
|
|
632
597
|
// src/components/Button.tsx
|
|
633
598
|
var import_react4 = require("react");
|
|
634
599
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
635
|
-
var warnedIconButton = false;
|
|
636
600
|
var Button = (0, import_react4.forwardRef)(
|
|
637
|
-
({ variant = "secondary", size = "md", icon = false, loading = false, className, children, disabled,
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
601
|
+
({ variant = "secondary", size = "md", icon = false, loading = false, className, children, disabled, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
602
|
+
"button",
|
|
603
|
+
{
|
|
604
|
+
ref,
|
|
605
|
+
className: cx(
|
|
606
|
+
"uix-btn",
|
|
607
|
+
`uix-btn--${variant}`,
|
|
608
|
+
size !== "md" && `uix-btn--${size}`,
|
|
609
|
+
icon && "uix-btn--icon",
|
|
610
|
+
className
|
|
611
|
+
),
|
|
612
|
+
disabled: disabled || loading,
|
|
613
|
+
"data-loading": loading || void 0,
|
|
614
|
+
...props,
|
|
615
|
+
children
|
|
641
616
|
}
|
|
642
|
-
|
|
643
|
-
"button",
|
|
644
|
-
{
|
|
645
|
-
ref,
|
|
646
|
-
className: cx(
|
|
647
|
-
"uix-btn",
|
|
648
|
-
`uix-btn--${variant}`,
|
|
649
|
-
size !== "md" && `uix-btn--${size}`,
|
|
650
|
-
icon && "uix-btn--icon",
|
|
651
|
-
className
|
|
652
|
-
),
|
|
653
|
-
disabled,
|
|
654
|
-
"aria-disabled": loading || void 0,
|
|
655
|
-
"aria-busy": loading || void 0,
|
|
656
|
-
"data-loading": loading || void 0,
|
|
657
|
-
onClick: loading || onClick ? (e) => {
|
|
658
|
-
if (loading) {
|
|
659
|
-
e.preventDefault();
|
|
660
|
-
return;
|
|
661
|
-
}
|
|
662
|
-
onClick?.(e);
|
|
663
|
-
} : void 0,
|
|
664
|
-
...props,
|
|
665
|
-
children
|
|
666
|
-
}
|
|
667
|
-
);
|
|
668
|
-
}
|
|
617
|
+
)
|
|
669
618
|
);
|
|
670
619
|
Button.displayName = "Button";
|
|
671
620
|
function ButtonGroup({ children, className }) {
|
|
@@ -688,22 +637,7 @@ var Input = (0, import_react5.forwardRef)(
|
|
|
688
637
|
)
|
|
689
638
|
);
|
|
690
639
|
Input.displayName = "Input";
|
|
691
|
-
function InputGroup({
|
|
692
|
-
children,
|
|
693
|
-
leadingIcon,
|
|
694
|
-
trailingIcon,
|
|
695
|
-
className,
|
|
696
|
-
id,
|
|
697
|
-
"aria-describedby": describedBy,
|
|
698
|
-
"aria-invalid": invalid,
|
|
699
|
-
"aria-required": required
|
|
700
|
-
}) {
|
|
701
|
-
const control = (0, import_react5.isValidElement)(children) && (id ?? describedBy ?? invalid ?? required) != null ? (0, import_react5.cloneElement)(children, {
|
|
702
|
-
id: children.props.id ?? id,
|
|
703
|
-
"aria-describedby": children.props["aria-describedby"] ?? describedBy,
|
|
704
|
-
"aria-invalid": children.props["aria-invalid"] ?? invalid,
|
|
705
|
-
"aria-required": children.props["aria-required"] ?? required
|
|
706
|
-
}) : children;
|
|
640
|
+
function InputGroup({ children, leadingIcon, trailingIcon, className }) {
|
|
707
641
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
708
642
|
"div",
|
|
709
643
|
{
|
|
@@ -714,9 +648,9 @@ function InputGroup({
|
|
|
714
648
|
className
|
|
715
649
|
),
|
|
716
650
|
children: [
|
|
717
|
-
leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "uix-input-group__icon",
|
|
718
|
-
|
|
719
|
-
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "uix-input-group__icon uix-input-group__icon--trailing",
|
|
651
|
+
leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "uix-input-group__icon", children: leadingIcon }),
|
|
652
|
+
children,
|
|
653
|
+
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "uix-input-group__icon uix-input-group__icon--trailing", children: trailingIcon })
|
|
720
654
|
]
|
|
721
655
|
}
|
|
722
656
|
);
|
|
@@ -796,12 +730,8 @@ var Radio = (0, import_react9.forwardRef)(
|
|
|
796
730
|
] })
|
|
797
731
|
);
|
|
798
732
|
Radio.displayName = "Radio";
|
|
799
|
-
function RadioGroup({ children, className
|
|
800
|
-
|
|
801
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("fieldset", { className: cx("uix-radio-group", className), children: [
|
|
802
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("legend", { className: "uix-radio-group__legend", children: label }),
|
|
803
|
-
children
|
|
804
|
-
] });
|
|
733
|
+
function RadioGroup({ children, className }) {
|
|
734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cx("uix-radio-group", className), children });
|
|
805
735
|
}
|
|
806
736
|
|
|
807
737
|
// src/components/Switch.tsx
|
|
@@ -823,30 +753,25 @@ function Field({ label, hint, error, success, required, children, className, htm
|
|
|
823
753
|
const uid = (0, import_react11.useId)();
|
|
824
754
|
const msgId = `${uid}-msg`;
|
|
825
755
|
const describedBy = error || success || hint ? msgId : void 0;
|
|
826
|
-
const controlId = (0, import_react11.isValidElement)(children) ? children.props.id ?? `${uid}-ctl` : void 0;
|
|
827
756
|
const control = (0, import_react11.isValidElement)(children) ? (0, import_react11.cloneElement)(children, {
|
|
828
|
-
id: controlId,
|
|
829
757
|
"aria-describedby": [children.props["aria-describedby"], describedBy].filter(Boolean).join(" ") || void 0,
|
|
830
|
-
"aria-invalid": error ? true : children.props["aria-invalid"]
|
|
831
|
-
"aria-required": children.props["aria-required"] ?? (required || void 0)
|
|
758
|
+
"aria-invalid": error ? true : children.props["aria-invalid"]
|
|
832
759
|
}) : children;
|
|
833
760
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cx("uix-field", className), children: [
|
|
834
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "uix-field__label", htmlFor
|
|
761
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "uix-field__label", htmlFor, "data-required": required || void 0, children: label }),
|
|
835
762
|
control,
|
|
836
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "uix-field__msg", id: msgId, children: error ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "uix-field__error", role: "alert", children: error }) : success ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "uix-field__success",
|
|
763
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "uix-field__msg", id: msgId, children: error ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "uix-field__error", role: "alert", children: error }) : success ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "uix-field__success", children: success }) : hint ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "uix-field__hint", children: hint }) : null })
|
|
837
764
|
] });
|
|
838
765
|
}
|
|
839
766
|
|
|
840
767
|
// src/components/Modal.tsx
|
|
841
|
-
var import_react12 = require("react");
|
|
842
768
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
843
769
|
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
844
|
-
function Modal({ open, onClose, title, children, footer, className,
|
|
845
|
-
const ref = useDialog(open
|
|
846
|
-
|
|
847
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("dialog", { ref, className: cx("uix-dialog", className), "aria-labelledby": title ? titleId : void 0, ...rest, children: [
|
|
770
|
+
function Modal({ open, onClose, title, children, footer, className, style }) {
|
|
771
|
+
const ref = useDialog(open);
|
|
772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("dialog", { ref, className: cx("uix-dialog", className), style, onClose, children: [
|
|
848
773
|
(title != null || onClose) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "uix-dialog__header", children: [
|
|
849
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("
|
|
774
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "uix-dialog__title", children: title }),
|
|
850
775
|
onClose && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { className: "uix-dialog__close", onClick: onClose, "aria-label": "Close dialog", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CloseIcon, {}) })
|
|
851
776
|
] }),
|
|
852
777
|
children != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "uix-dialog__body", children }),
|
|
@@ -855,15 +780,13 @@ function Modal({ open, onClose, title, children, footer, className, ...rest }) {
|
|
|
855
780
|
}
|
|
856
781
|
|
|
857
782
|
// src/components/Drawer.tsx
|
|
858
|
-
var import_react13 = require("react");
|
|
859
783
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
860
784
|
var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
861
|
-
function Drawer({ open, onClose, title, children, footer, className
|
|
862
|
-
const ref = useDialog(open
|
|
863
|
-
|
|
864
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("dialog", { ref, className: cx("uix-drawer", className), "aria-labelledby": title ? titleId : void 0, ...rest, children: [
|
|
785
|
+
function Drawer({ open, onClose, title, children, footer, className }) {
|
|
786
|
+
const ref = useDialog(open);
|
|
787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("dialog", { ref, className: cx("uix-drawer", className), onClose, children: [
|
|
865
788
|
(title != null || onClose) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "uix-drawer__header", children: [
|
|
866
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("
|
|
789
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontWeight: 600, fontSize: "var(--uix-text-h3)" }, children: title }),
|
|
867
790
|
onClose && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
868
791
|
"button",
|
|
869
792
|
{
|
|
@@ -880,30 +803,27 @@ function Drawer({ open, onClose, title, children, footer, className, ...rest })
|
|
|
880
803
|
}
|
|
881
804
|
|
|
882
805
|
// src/components/Peek.tsx
|
|
883
|
-
var import_react14 = require("react");
|
|
884
806
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
885
807
|
var CloseIcon3 = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
886
808
|
var ChevronUp = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M2 8l4-4 4 4" }) });
|
|
887
809
|
var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M2 4l4 4 4-4" }) });
|
|
888
|
-
function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hint, className
|
|
889
|
-
const ref = useDialog(open
|
|
810
|
+
function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hint, className }) {
|
|
811
|
+
const ref = useDialog(open);
|
|
890
812
|
const hasNav = onNavPrev != null || onNavNext != null;
|
|
891
|
-
const titleId = (0, import_react14.useId)();
|
|
892
813
|
const onBackdropClick = (e) => {
|
|
893
|
-
onClick?.(e);
|
|
894
814
|
if (!onClose || e.target !== e.currentTarget) return;
|
|
895
815
|
const r = e.currentTarget.getBoundingClientRect();
|
|
896
816
|
if (r.width === 0) return;
|
|
897
817
|
const outside = e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom;
|
|
898
818
|
if (outside) onClose();
|
|
899
819
|
};
|
|
900
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("dialog", { ref, className: cx("uix-peek", className),
|
|
820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("dialog", { ref, className: cx("uix-peek", className), onClose, onClick: onBackdropClick, children: [
|
|
901
821
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "uix-peek__header", children: [
|
|
902
822
|
hasNav && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "uix-peek__nav", children: [
|
|
903
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "uix-peek__navbtn", onClick:
|
|
904
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "uix-peek__navbtn", onClick:
|
|
823
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "uix-peek__navbtn", onClick: onNavPrev, disabled: !onNavPrev, "aria-label": "Previous record", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChevronUp, {}) }),
|
|
824
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "uix-peek__navbtn", onClick: onNavNext, disabled: !onNavNext, "aria-label": "Next record", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChevronDown, {}) })
|
|
905
825
|
] }),
|
|
906
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("
|
|
826
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "uix-peek__title", children: title }),
|
|
907
827
|
hint && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "uix-peek__hint", children: hint }),
|
|
908
828
|
onClose && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "uix-peek__close", onClick: onClose, "aria-label": "Close preview", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CloseIcon3, {}) })
|
|
909
829
|
] }),
|
|
@@ -914,12 +834,12 @@ function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hi
|
|
|
914
834
|
|
|
915
835
|
// src/components/Card.tsx
|
|
916
836
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
917
|
-
function Card({ title,
|
|
837
|
+
function Card({ title, subtitle, headerAction, footer, children, className, ...props }) {
|
|
918
838
|
const hasHeader = title != null || subtitle != null || headerAction != null;
|
|
919
839
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cx("uix-card", className), ...props, children: [
|
|
920
840
|
hasHeader && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "uix-card__header", children: [
|
|
921
841
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { flex: 1 }, children: [
|
|
922
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
842
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "uix-card__title", children: title }),
|
|
923
843
|
subtitle && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "uix-card__subtitle", children: subtitle })
|
|
924
844
|
] }),
|
|
925
845
|
headerAction
|
|
@@ -931,11 +851,11 @@ function Card({ title, titleAs: TitleTag = "div", subtitle, headerAction, footer
|
|
|
931
851
|
|
|
932
852
|
// src/components/PageHeader.tsx
|
|
933
853
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
934
|
-
function PageHeader({ eyebrow, title, subtitle, actions,
|
|
854
|
+
function PageHeader({ eyebrow, title, subtitle, actions, className, ...props }) {
|
|
935
855
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("header", { className: cx("uix-page-header", className), ...props, children: [
|
|
936
856
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "uix-page-header__titles", children: [
|
|
937
857
|
eyebrow != null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "uix-page-header__eyebrow", children: eyebrow }),
|
|
938
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h1", { className: "uix-page-header__title", children: title }),
|
|
939
859
|
subtitle != null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "uix-page-header__subtitle", children: subtitle })
|
|
940
860
|
] }),
|
|
941
861
|
actions != null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "uix-page-header__actions", children: actions })
|
|
@@ -947,7 +867,7 @@ var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
|
947
867
|
function DetailLayout({ side, children, className, ...props }) {
|
|
948
868
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cx("uix-detail", className), ...props, children: [
|
|
949
869
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uix-detail__main", children }),
|
|
950
|
-
side != null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("
|
|
870
|
+
side != null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uix-detail__side", children: side })
|
|
951
871
|
] });
|
|
952
872
|
}
|
|
953
873
|
|
|
@@ -970,11 +890,11 @@ function ListItem({ title, meta, trail, leading, children, className, ...props }
|
|
|
970
890
|
}
|
|
971
891
|
|
|
972
892
|
// src/components/DescriptionList.tsx
|
|
973
|
-
var
|
|
893
|
+
var import_react12 = require("react");
|
|
974
894
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
975
895
|
function DescriptionList({ items, children, className, ...props }) {
|
|
976
896
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("dl", { className: cx("uix-dl", className), ...props, children: [
|
|
977
|
-
items?.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
897
|
+
items?.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react12.Fragment, { children: [
|
|
978
898
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dt", { children: item.term }),
|
|
979
899
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dd", { children: item.description })
|
|
980
900
|
] }, item.id ?? i)),
|
|
@@ -989,80 +909,21 @@ function DescriptionItem({ term, children }) {
|
|
|
989
909
|
}
|
|
990
910
|
|
|
991
911
|
// src/components/Tabs.tsx
|
|
992
|
-
var
|
|
912
|
+
var import_react13 = require("react");
|
|
993
913
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
994
|
-
var TabsCtx = (0,
|
|
914
|
+
var TabsCtx = (0, import_react13.createContext)({});
|
|
995
915
|
function Tabs({ variant = "line", value, onChange, children, className }) {
|
|
996
|
-
|
|
997
|
-
const listRef = (0, import_react16.useRef)(null);
|
|
998
|
-
const kids = import_react16.Children.toArray(children);
|
|
999
|
-
const panels = kids.filter((k) => (0, import_react16.isValidElement)(k) && k.type === TabPanel);
|
|
1000
|
-
const tabs = kids.filter((k) => !((0, import_react16.isValidElement)(k) && k.type === TabPanel));
|
|
1001
|
-
(0, import_react16.useEffect)(() => {
|
|
1002
|
-
const list = listRef.current;
|
|
1003
|
-
if (!list) return;
|
|
1004
|
-
const all = Array.from(list.querySelectorAll('[role="tab"]'));
|
|
1005
|
-
const enabled = all.filter((t) => !t.matches(":disabled"));
|
|
1006
|
-
const active = enabled.find((t) => t.getAttribute("aria-selected") === "true") ?? enabled[0];
|
|
1007
|
-
for (const t of all) t.tabIndex = t === active ? 0 : -1;
|
|
1008
|
-
});
|
|
1009
|
-
const onKeyDown = (e) => {
|
|
1010
|
-
const items = Array.from(
|
|
1011
|
-
listRef.current?.querySelectorAll('[role="tab"]:not(:disabled)') ?? []
|
|
1012
|
-
);
|
|
1013
|
-
const cur = e.target.closest('[role="tab"]');
|
|
1014
|
-
const idx = cur ? items.indexOf(cur) : -1;
|
|
1015
|
-
if (idx < 0 || items.length === 0) return;
|
|
1016
|
-
let next;
|
|
1017
|
-
switch (e.key) {
|
|
1018
|
-
case "ArrowRight":
|
|
1019
|
-
next = (idx + 1) % items.length;
|
|
1020
|
-
break;
|
|
1021
|
-
case "ArrowLeft":
|
|
1022
|
-
next = (idx - 1 + items.length) % items.length;
|
|
1023
|
-
break;
|
|
1024
|
-
case "Home":
|
|
1025
|
-
next = 0;
|
|
1026
|
-
break;
|
|
1027
|
-
case "End":
|
|
1028
|
-
next = items.length - 1;
|
|
1029
|
-
break;
|
|
1030
|
-
default:
|
|
1031
|
-
return;
|
|
1032
|
-
}
|
|
1033
|
-
e.preventDefault();
|
|
1034
|
-
const target = items[next];
|
|
1035
|
-
if (target) {
|
|
1036
|
-
target.focus();
|
|
1037
|
-
target.click();
|
|
1038
|
-
}
|
|
1039
|
-
};
|
|
1040
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(TabsCtx.Provider, { value: { value, onChange, baseId }, children: [
|
|
1041
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1042
|
-
"div",
|
|
1043
|
-
{
|
|
1044
|
-
ref: listRef,
|
|
1045
|
-
role: "tablist",
|
|
1046
|
-
className: cx("uix-tabs", `uix-tabs--${variant}`, className),
|
|
1047
|
-
onKeyDown,
|
|
1048
|
-
children: tabs
|
|
1049
|
-
}
|
|
1050
|
-
),
|
|
1051
|
-
panels
|
|
1052
|
-
] });
|
|
916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TabsCtx.Provider, { value: { value, onChange }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { role: "tablist", className: cx("uix-tabs", `uix-tabs--${variant}`, className), children }) });
|
|
1053
917
|
}
|
|
1054
918
|
function Tab({ value, children, disabled, className, onClick, ...props }) {
|
|
1055
|
-
const ctx = (0,
|
|
919
|
+
const ctx = (0, import_react13.useContext)(TabsCtx);
|
|
1056
920
|
const selected = ctx.value === value;
|
|
1057
921
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1058
922
|
"button",
|
|
1059
923
|
{
|
|
1060
924
|
role: "tab",
|
|
1061
|
-
id: ctx.baseId ? `${ctx.baseId}-tab-${value}` : void 0,
|
|
1062
|
-
"aria-controls": ctx.baseId ? `${ctx.baseId}-panel-${value}` : void 0,
|
|
1063
925
|
className: cx("uix-tab", className),
|
|
1064
926
|
"aria-selected": selected,
|
|
1065
|
-
tabIndex: selected ? 0 : -1,
|
|
1066
927
|
disabled,
|
|
1067
928
|
onClick: (e) => {
|
|
1068
929
|
ctx.onChange?.(value);
|
|
@@ -1073,24 +934,9 @@ function Tab({ value, children, disabled, className, onClick, ...props }) {
|
|
|
1073
934
|
}
|
|
1074
935
|
);
|
|
1075
936
|
}
|
|
1076
|
-
function TabPanel({ value, children, ...props }) {
|
|
1077
|
-
const ctx = (0, import_react16.useContext)(TabsCtx);
|
|
1078
|
-
if (ctx.value !== value) return null;
|
|
1079
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1080
|
-
"div",
|
|
1081
|
-
{
|
|
1082
|
-
role: "tabpanel",
|
|
1083
|
-
id: ctx.baseId ? `${ctx.baseId}-panel-${value}` : void 0,
|
|
1084
|
-
"aria-labelledby": ctx.baseId ? `${ctx.baseId}-tab-${value}` : void 0,
|
|
1085
|
-
tabIndex: 0,
|
|
1086
|
-
...props,
|
|
1087
|
-
children
|
|
1088
|
-
}
|
|
1089
|
-
);
|
|
1090
|
-
}
|
|
1091
937
|
|
|
1092
938
|
// src/components/AppShell.tsx
|
|
1093
|
-
var
|
|
939
|
+
var import_react14 = require("react");
|
|
1094
940
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1095
941
|
function AppShell({
|
|
1096
942
|
nav,
|
|
@@ -1098,7 +944,6 @@ function AppShell({
|
|
|
1098
944
|
focus,
|
|
1099
945
|
onExitFocus,
|
|
1100
946
|
mainBleed,
|
|
1101
|
-
mainId = "uix-main",
|
|
1102
947
|
sidebar,
|
|
1103
948
|
topbar,
|
|
1104
949
|
children,
|
|
@@ -1106,7 +951,7 @@ function AppShell({
|
|
|
1106
951
|
...props
|
|
1107
952
|
}) {
|
|
1108
953
|
const navState = nav ?? (collapsed ? "rail" : "full");
|
|
1109
|
-
(0,
|
|
954
|
+
(0, import_react14.useEffect)(() => {
|
|
1110
955
|
if (!focus || !onExitFocus) return;
|
|
1111
956
|
const onKey = (e) => {
|
|
1112
957
|
if (e.key === "Escape") onExitFocus();
|
|
@@ -1123,10 +968,9 @@ function AppShell({
|
|
|
1123
968
|
"data-focus": focus || void 0,
|
|
1124
969
|
...props,
|
|
1125
970
|
children: [
|
|
1126
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("a", { className: "uix-skiplink", href: `#${mainId}`, children: "Skip to content" }),
|
|
1127
971
|
sidebar && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "uix-shell__sidebar", children: sidebar }),
|
|
1128
972
|
topbar && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "uix-shell__topbar", children: topbar }),
|
|
1129
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("main", {
|
|
973
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("main", { className: cx("uix-shell__main", mainBleed && "uix-shell__main--bleed"), children }),
|
|
1130
974
|
focus && onExitFocus && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "uix-shell__focus-exit", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", onClick: onExitFocus, children: "Esc \xB7 Exit focus" }) })
|
|
1131
975
|
]
|
|
1132
976
|
}
|
|
@@ -1134,7 +978,7 @@ function AppShell({
|
|
|
1134
978
|
}
|
|
1135
979
|
|
|
1136
980
|
// src/components/Sidebar.tsx
|
|
1137
|
-
var
|
|
981
|
+
var import_react15 = require("react");
|
|
1138
982
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1139
983
|
var ChevronIcon = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { className: "uix-navgroup__chevron", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M2 4l4 4 4-4" }) });
|
|
1140
984
|
function Sidebar({ collapsed, onToggle, brand, toggleIcon, children, className, ...props }) {
|
|
@@ -1188,15 +1032,13 @@ function NavItem({ icon, badge, active, as: Tag = "a", children, className, ...p
|
|
|
1188
1032
|
);
|
|
1189
1033
|
}
|
|
1190
1034
|
function NavGroup({ icon, label, children, defaultExpanded = true }) {
|
|
1191
|
-
const [expanded, setExpanded] = (0,
|
|
1192
|
-
const panelId = (0, import_react18.useId)();
|
|
1035
|
+
const [expanded, setExpanded] = (0, import_react15.useState)(defaultExpanded);
|
|
1193
1036
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "uix-navgroup", children: [
|
|
1194
1037
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1195
1038
|
"button",
|
|
1196
1039
|
{
|
|
1197
1040
|
className: "uix-navitem uix-navgroup__trigger",
|
|
1198
1041
|
"aria-expanded": expanded,
|
|
1199
|
-
"aria-controls": panelId,
|
|
1200
1042
|
onClick: () => setExpanded((v) => !v),
|
|
1201
1043
|
children: [
|
|
1202
1044
|
icon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "uix-navitem__icon", "aria-hidden": "true", children: icon }),
|
|
@@ -1205,7 +1047,7 @@ function NavGroup({ icon, label, children, defaultExpanded = true }) {
|
|
|
1205
1047
|
]
|
|
1206
1048
|
}
|
|
1207
1049
|
),
|
|
1208
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uix-navgroup__panel",
|
|
1050
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uix-navgroup__panel", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children }) })
|
|
1209
1051
|
] });
|
|
1210
1052
|
}
|
|
1211
1053
|
function SubNavItem({ active, as: Tag = "a", children, className, ...props }) {
|
|
@@ -1258,7 +1100,7 @@ function StarButton({
|
|
|
1258
1100
|
}
|
|
1259
1101
|
|
|
1260
1102
|
// src/components/NavFavourites.tsx
|
|
1261
|
-
var
|
|
1103
|
+
var import_react16 = require("react");
|
|
1262
1104
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1263
1105
|
var ChevronDownIcon = () => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1264
1106
|
"svg",
|
|
@@ -1322,14 +1164,13 @@ function NavFavourites({
|
|
|
1322
1164
|
emptyReason,
|
|
1323
1165
|
className
|
|
1324
1166
|
}) {
|
|
1325
|
-
const regionId = (0,
|
|
1326
|
-
const headerRef = (0,
|
|
1327
|
-
const regionRef = (0,
|
|
1328
|
-
const
|
|
1329
|
-
const
|
|
1330
|
-
const triggerRefs = (0, import_react19.useRef)(/* @__PURE__ */ new Map());
|
|
1167
|
+
const regionId = (0, import_react16.useId)();
|
|
1168
|
+
const headerRef = (0, import_react16.useRef)(null);
|
|
1169
|
+
const regionRef = (0, import_react16.useRef)(null);
|
|
1170
|
+
const focusAfterRef = (0, import_react16.useRef)(null);
|
|
1171
|
+
const triggerRefs = (0, import_react16.useRef)(/* @__PURE__ */ new Map());
|
|
1331
1172
|
const order = items.map((i) => i.id);
|
|
1332
|
-
(0,
|
|
1173
|
+
(0, import_react16.useEffect)(() => {
|
|
1333
1174
|
const id = focusAfterRef.current;
|
|
1334
1175
|
if (!id) return;
|
|
1335
1176
|
focusAfterRef.current = null;
|
|
@@ -1355,8 +1196,6 @@ function NavFavourites({
|
|
|
1355
1196
|
if (it === void 0) return;
|
|
1356
1197
|
reordered.splice(next, 0, it);
|
|
1357
1198
|
focusAfterRef.current = id;
|
|
1358
|
-
const moved = items.find((i) => i.id === id);
|
|
1359
|
-
if (moved) setAnnouncement(`${moved.label} moved to position ${next + 1} of ${order.length}`);
|
|
1360
1199
|
onReorder(reordered);
|
|
1361
1200
|
};
|
|
1362
1201
|
const remove = (id) => {
|
|
@@ -1366,7 +1205,6 @@ function NavFavourites({
|
|
|
1366
1205
|
onRemove(id);
|
|
1367
1206
|
};
|
|
1368
1207
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cx("uix-favourites", className), style: { marginBottom: "var(--uix-space-1)" }, children: [
|
|
1369
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { role: "status", className: "uix-visually-hidden", children: announcement }),
|
|
1370
1208
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1371
1209
|
"button",
|
|
1372
1210
|
{
|
|
@@ -1443,18 +1281,18 @@ function FavouriteRow({
|
|
|
1443
1281
|
onRemove,
|
|
1444
1282
|
registerTrigger
|
|
1445
1283
|
}) {
|
|
1446
|
-
const [open, setOpen] = (0,
|
|
1447
|
-
const [revealed, setRevealed] = (0,
|
|
1448
|
-
const menuId = (0,
|
|
1449
|
-
const triggerRef = (0,
|
|
1450
|
-
const itemRefs = (0,
|
|
1284
|
+
const [open, setOpen] = (0, import_react16.useState)(false);
|
|
1285
|
+
const [revealed, setRevealed] = (0, import_react16.useState)(false);
|
|
1286
|
+
const menuId = (0, import_react16.useId)();
|
|
1287
|
+
const triggerRef = (0, import_react16.useRef)(null);
|
|
1288
|
+
const itemRefs = (0, import_react16.useRef)([]);
|
|
1451
1289
|
const optionsTemplate = labels.options ?? "{label} favourite options";
|
|
1452
1290
|
const actions = [
|
|
1453
1291
|
...isFirst ? [] : [{ label: labels.moveUp, onSelect: onMoveUp }],
|
|
1454
1292
|
...isLast ? [] : [{ label: labels.moveDown, onSelect: onMoveDown }],
|
|
1455
1293
|
{ label: labels.remove.replace("{label}", item.label), onSelect: onRemove }
|
|
1456
1294
|
];
|
|
1457
|
-
(0,
|
|
1295
|
+
(0, import_react16.useEffect)(() => {
|
|
1458
1296
|
if (open) itemRefs.current[0]?.focus();
|
|
1459
1297
|
}, [open]);
|
|
1460
1298
|
const closeAndReturnFocus = () => {
|
|
@@ -1470,12 +1308,6 @@ function FavouriteRow({
|
|
|
1470
1308
|
} else if (e.key === "ArrowUp") {
|
|
1471
1309
|
e.preventDefault();
|
|
1472
1310
|
menuItems[(currentIdx - 1 + menuItems.length) % menuItems.length]?.focus();
|
|
1473
|
-
} else if (e.key === "Home") {
|
|
1474
|
-
e.preventDefault();
|
|
1475
|
-
menuItems[0]?.focus();
|
|
1476
|
-
} else if (e.key === "End") {
|
|
1477
|
-
e.preventDefault();
|
|
1478
|
-
menuItems[menuItems.length - 1]?.focus();
|
|
1479
1311
|
} else if (e.key === "Escape") {
|
|
1480
1312
|
e.preventDefault();
|
|
1481
1313
|
closeAndReturnFocus();
|
|
@@ -1556,7 +1388,6 @@ function FavouriteRow({
|
|
|
1556
1388
|
{
|
|
1557
1389
|
id: menuId,
|
|
1558
1390
|
role: "menu",
|
|
1559
|
-
"aria-label": optionsTemplate.replace("{label}", item.label),
|
|
1560
1391
|
onKeyDown: onMenuKeyDown,
|
|
1561
1392
|
style: {
|
|
1562
1393
|
position: "absolute",
|
|
@@ -1620,107 +1451,60 @@ function FavouriteRow({
|
|
|
1620
1451
|
// src/components/Alert.tsx
|
|
1621
1452
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1622
1453
|
function Alert({ tone, title, icon, children, className, ...props }) {
|
|
1623
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1624
|
-
"div",
|
|
1625
|
-
{
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "uix-alert__icon", children: icon }),
|
|
1631
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
|
|
1632
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "uix-alert__title", children: title }),
|
|
1633
|
-
children && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "uix-alert__body", children })
|
|
1634
|
-
] })
|
|
1635
|
-
]
|
|
1636
|
-
}
|
|
1637
|
-
);
|
|
1454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cx("uix-alert", tone && tone !== "neutral" && `uix-alert--${tone}`, className), ...props, children: [
|
|
1455
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "uix-alert__icon", children: icon }),
|
|
1456
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
|
|
1457
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "uix-alert__title", children: title }),
|
|
1458
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "uix-alert__body", children })
|
|
1459
|
+
] })
|
|
1460
|
+
] });
|
|
1638
1461
|
}
|
|
1639
1462
|
|
|
1640
1463
|
// src/components/Spinner.tsx
|
|
1641
1464
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1642
|
-
function Spinner({ size = "md", accent,
|
|
1465
|
+
function Spinner({ size = "md", accent, className, ...props }) {
|
|
1643
1466
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1644
1467
|
"span",
|
|
1645
1468
|
{
|
|
1646
1469
|
className: cx("uix-spinner", accent && "uix-spinner--accent", size === "lg" && "uix-spinner--lg", className),
|
|
1647
1470
|
role: "status",
|
|
1648
|
-
|
|
1649
|
-
|
|
1471
|
+
"aria-label": "Loading",
|
|
1472
|
+
...props
|
|
1650
1473
|
}
|
|
1651
1474
|
);
|
|
1652
1475
|
}
|
|
1653
1476
|
|
|
1654
1477
|
// src/components/Toast.tsx
|
|
1655
|
-
var import_react20 = require("react");
|
|
1656
1478
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1657
|
-
var ToasterContext = (0, import_react20.createContext)(null);
|
|
1658
1479
|
function Toast({ title, message, tone, icon, onClose, leaving, className, ...props }) {
|
|
1659
1480
|
const assertive = tone === "danger";
|
|
1660
|
-
const toaster = (0, import_react20.useContext)(ToasterContext);
|
|
1661
|
-
const bodyRef = (0, import_react20.useRef)(null);
|
|
1662
|
-
(0, import_react20.useEffect)(() => {
|
|
1663
|
-
if (assertive || !toaster) return;
|
|
1664
|
-
const text = bodyRef.current?.textContent?.trim();
|
|
1665
|
-
if (text) toaster.announce(text);
|
|
1666
|
-
}, []);
|
|
1667
|
-
const handleClose = (e) => {
|
|
1668
|
-
const btn = e.currentTarget;
|
|
1669
|
-
if (document.activeElement === btn) {
|
|
1670
|
-
const toasterEl = btn.closest(".uix-toaster");
|
|
1671
|
-
if (toasterEl) {
|
|
1672
|
-
const closes = Array.from(toasterEl.querySelectorAll(".uix-toast__close"));
|
|
1673
|
-
const i = closes.indexOf(btn);
|
|
1674
|
-
(closes[i + 1] ?? closes[i - 1])?.focus();
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
onClose?.();
|
|
1678
|
-
};
|
|
1679
|
-
const ownLiveRegion = assertive || !toaster;
|
|
1680
1481
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1681
1482
|
"div",
|
|
1682
1483
|
{
|
|
1683
1484
|
className: cx("uix-toast", tone && `uix-toast--${tone}`, className),
|
|
1684
1485
|
"data-leaving": leaving || void 0,
|
|
1685
|
-
role:
|
|
1686
|
-
"aria-live":
|
|
1486
|
+
role: assertive ? "alert" : "status",
|
|
1487
|
+
"aria-live": assertive ? "assertive" : "polite",
|
|
1687
1488
|
...props,
|
|
1688
1489
|
children: [
|
|
1689
1490
|
icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "uix-toast__icon", "aria-hidden": "true", children: icon }),
|
|
1690
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "uix-toast__body",
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "uix-toast__body", children: [
|
|
1691
1492
|
title && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "uix-toast__title", children: title }),
|
|
1692
1493
|
message && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "uix-toast__msg", children: message })
|
|
1693
1494
|
] }),
|
|
1694
|
-
onClose && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { className: "uix-toast__close", onClick:
|
|
1495
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { className: "uix-toast__close", onClick: onClose, "aria-label": "Dismiss", children: "\xD7" })
|
|
1695
1496
|
]
|
|
1696
1497
|
}
|
|
1697
1498
|
);
|
|
1698
1499
|
}
|
|
1699
1500
|
function Toaster({ children, className, ...props }) {
|
|
1700
|
-
|
|
1701
|
-
const clearTimer = (0, import_react20.useRef)(null);
|
|
1702
|
-
const announce = (0, import_react20.useCallback)((text) => {
|
|
1703
|
-
setAnnounced((cur) => cur ? `${cur} ${text}` : text);
|
|
1704
|
-
if (clearTimer.current != null) clearTimeout(clearTimer.current);
|
|
1705
|
-
clearTimer.current = window.setTimeout(() => setAnnounced(""), 3e3);
|
|
1706
|
-
}, []);
|
|
1707
|
-
(0, import_react20.useEffect)(() => () => {
|
|
1708
|
-
if (clearTimer.current != null) clearTimeout(clearTimer.current);
|
|
1709
|
-
}, []);
|
|
1710
|
-
const ctx = (0, import_react20.useMemo)(() => ({ announce }), [announce]);
|
|
1711
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ToasterContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cx("uix-toaster", className), role: "region", "aria-label": "Notifications", ...props, children: [
|
|
1712
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uix-visually-hidden", role: "status", "aria-live": "polite", children: announced }),
|
|
1713
|
-
children
|
|
1714
|
-
] }) });
|
|
1501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cx("uix-toaster", className), ...props, children });
|
|
1715
1502
|
}
|
|
1716
1503
|
|
|
1717
1504
|
// src/components/Table.tsx
|
|
1718
1505
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1719
|
-
function TableWrap({
|
|
1720
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.
|
|
1721
|
-
announcement != null && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { role: "status", className: "uix-visually-hidden", children: announcement }),
|
|
1722
|
-
children
|
|
1723
|
-
] });
|
|
1506
|
+
function TableWrap({ children, className, ...props }) {
|
|
1507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: cx("uix-table-wrap", className), ...props, children });
|
|
1724
1508
|
}
|
|
1725
1509
|
function Table({
|
|
1726
1510
|
density = "standard",
|
|
@@ -1759,9 +1543,9 @@ function Th({ sortable, sortDirection, sortOrder, onSort, className, children, o
|
|
|
1759
1543
|
"data-sort": sortable || void 0,
|
|
1760
1544
|
"data-sort-order": sortOrder != null && sortOrder > 0 ? sortOrder : void 0,
|
|
1761
1545
|
"aria-sort": sortDirection && sortDirection !== "none" ? sortDirection : void 0,
|
|
1762
|
-
onClick: sortable
|
|
1546
|
+
onClick: sortable ? onSort ?? onClick : onClick,
|
|
1763
1547
|
...props,
|
|
1764
|
-
children
|
|
1548
|
+
children
|
|
1765
1549
|
}
|
|
1766
1550
|
);
|
|
1767
1551
|
}
|
|
@@ -1773,7 +1557,7 @@ function Tr({ selected, pinned, className, children, ...props }) {
|
|
|
1773
1557
|
"tr",
|
|
1774
1558
|
{
|
|
1775
1559
|
className,
|
|
1776
|
-
"
|
|
1560
|
+
"aria-selected": selected || void 0,
|
|
1777
1561
|
"data-pinned": pinned || void 0,
|
|
1778
1562
|
...props,
|
|
1779
1563
|
children
|
|
@@ -1796,14 +1580,13 @@ function RowActions({ children, className, ...props }) {
|
|
|
1796
1580
|
function RowAction({ children, className, type = "button", ...props }) {
|
|
1797
1581
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type, className: cx("uix-rowact", className), ...props, children });
|
|
1798
1582
|
}
|
|
1799
|
-
function ExpandToggle({ expanded,
|
|
1583
|
+
function ExpandToggle({ expanded, className, type = "button", ...props }) {
|
|
1800
1584
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1801
1585
|
"button",
|
|
1802
1586
|
{
|
|
1803
1587
|
type,
|
|
1804
1588
|
className: cx("uix-table__expand", className),
|
|
1805
1589
|
"aria-expanded": expanded,
|
|
1806
|
-
"aria-controls": controls,
|
|
1807
1590
|
"aria-label": expanded ? "Collapse row" : "Expand row",
|
|
1808
1591
|
...props,
|
|
1809
1592
|
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M6 4l4 4-4 4" }) })
|
|
@@ -1894,17 +1677,15 @@ function StatusPill({ tone = "neutral", treatment = "filled", dot, children, cla
|
|
|
1894
1677
|
|
|
1895
1678
|
// src/components/Progress.tsx
|
|
1896
1679
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1897
|
-
function Progress({ value = 0, max = 100, indeterminate,
|
|
1898
|
-
const
|
|
1899
|
-
const pct = clamped / (max || 100) * 100;
|
|
1680
|
+
function Progress({ value = 0, max = 100, indeterminate, className, ...props }) {
|
|
1681
|
+
const pct = Math.max(0, Math.min(100, value / (max || 100) * 100));
|
|
1900
1682
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1901
1683
|
"div",
|
|
1902
1684
|
{
|
|
1903
1685
|
role: "progressbar",
|
|
1904
1686
|
"aria-valuemin": 0,
|
|
1905
1687
|
"aria-valuemax": max,
|
|
1906
|
-
"aria-valuenow": indeterminate ? void 0 :
|
|
1907
|
-
"aria-label": label,
|
|
1688
|
+
"aria-valuenow": indeterminate ? void 0 : value,
|
|
1908
1689
|
className: cx("uix-progress", indeterminate && "uix-progress--indeterminate", className),
|
|
1909
1690
|
...props,
|
|
1910
1691
|
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uix-progress__bar", style: indeterminate ? void 0 : { width: `${pct}%` } })
|
|
@@ -1914,13 +1695,7 @@ function Progress({ value = 0, max = 100, indeterminate, label, className, ...pr
|
|
|
1914
1695
|
|
|
1915
1696
|
// src/components/Meter.tsx
|
|
1916
1697
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1917
|
-
|
|
1918
|
-
warning: "warning",
|
|
1919
|
-
danger: "critical",
|
|
1920
|
-
attention: "needs attention",
|
|
1921
|
-
overdue: "overdue"
|
|
1922
|
-
};
|
|
1923
|
-
function Meter({ value = 0, tone, label, className, ...props }) {
|
|
1698
|
+
function Meter({ value = 0, tone, className, ...props }) {
|
|
1924
1699
|
const pct = Math.max(0, Math.min(100, value));
|
|
1925
1700
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1926
1701
|
"div",
|
|
@@ -1929,8 +1704,6 @@ function Meter({ value = 0, tone, label, className, ...props }) {
|
|
|
1929
1704
|
"aria-valuenow": pct,
|
|
1930
1705
|
"aria-valuemin": 0,
|
|
1931
1706
|
"aria-valuemax": 100,
|
|
1932
|
-
"aria-valuetext": tone && tone !== "success" ? `${pct}%, ${toneText[tone]}` : void 0,
|
|
1933
|
-
"aria-label": label,
|
|
1934
1707
|
className: cx("uix-meter", className),
|
|
1935
1708
|
...props,
|
|
1936
1709
|
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
@@ -1955,34 +1728,22 @@ function Stat({ label, value, icon, meta, trend, className, ...props }) {
|
|
|
1955
1728
|
] }),
|
|
1956
1729
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "uix-stat__value", children: value }),
|
|
1957
1730
|
(meta != null || trend != null) && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "uix-stat__meta", children: [
|
|
1958
|
-
trend != null && /* @__PURE__ */ (0, import_jsx_runtime30.
|
|
1959
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: trend.direction === "up" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M12 19V5m-6 6 6-6 6 6" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M12 5v14m6-6-6 6-6-6" }) }),
|
|
1960
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "uix-visually-hidden", children: trend.direction === "up" ? "up" : "down" }),
|
|
1961
|
-
trend.label
|
|
1962
|
-
] }),
|
|
1731
|
+
trend != null && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: cx("uix-stat__trend", `uix-stat__trend--${trend.direction}`), children: trend.label }),
|
|
1963
1732
|
meta
|
|
1964
1733
|
] })
|
|
1965
1734
|
] });
|
|
1966
1735
|
}
|
|
1967
1736
|
|
|
1968
1737
|
// src/components/Tooltip.tsx
|
|
1969
|
-
var
|
|
1738
|
+
var import_react17 = require("react");
|
|
1970
1739
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1971
1740
|
function Tooltip({ label, placement = "top", className, children, ...props }) {
|
|
1972
|
-
const triggerRef = (0,
|
|
1973
|
-
const bubbleRef = (0,
|
|
1974
|
-
const
|
|
1975
|
-
const
|
|
1976
|
-
const id = (0, import_react21.useId)();
|
|
1741
|
+
const triggerRef = (0, import_react17.useRef)(null);
|
|
1742
|
+
const bubbleRef = (0, import_react17.useRef)(null);
|
|
1743
|
+
const [open, setOpen] = (0, import_react17.useState)(false);
|
|
1744
|
+
const id = (0, import_react17.useId)();
|
|
1977
1745
|
useAnchoredPosition(triggerRef, bubbleRef, { open, placement, offset: 6 });
|
|
1978
|
-
const cancelClose = () => {
|
|
1979
|
-
if (closeTimer.current != null) {
|
|
1980
|
-
clearTimeout(closeTimer.current);
|
|
1981
|
-
closeTimer.current = null;
|
|
1982
|
-
}
|
|
1983
|
-
};
|
|
1984
1746
|
const show = () => {
|
|
1985
|
-
cancelClose();
|
|
1986
1747
|
const b = bubbleRef.current;
|
|
1987
1748
|
if (b && !b.matches(":popover-open")) {
|
|
1988
1749
|
try {
|
|
@@ -1993,7 +1754,6 @@ function Tooltip({ label, placement = "top", className, children, ...props }) {
|
|
|
1993
1754
|
setOpen(true);
|
|
1994
1755
|
};
|
|
1995
1756
|
const hide = () => {
|
|
1996
|
-
cancelClose();
|
|
1997
1757
|
const b = bubbleRef.current;
|
|
1998
1758
|
if (b && b.matches(":popover-open")) {
|
|
1999
1759
|
try {
|
|
@@ -2003,20 +1763,7 @@ function Tooltip({ label, placement = "top", className, children, ...props }) {
|
|
|
2003
1763
|
}
|
|
2004
1764
|
setOpen(false);
|
|
2005
1765
|
};
|
|
2006
|
-
|
|
2007
|
-
cancelClose();
|
|
2008
|
-
closeTimer.current = window.setTimeout(hide, 100);
|
|
2009
|
-
};
|
|
2010
|
-
(0, import_react21.useEffect)(() => {
|
|
2011
|
-
if (!open) return;
|
|
2012
|
-
const onKey = (e) => {
|
|
2013
|
-
if (e.key === "Escape") hide();
|
|
2014
|
-
};
|
|
2015
|
-
document.addEventListener("keydown", onKey);
|
|
2016
|
-
return () => document.removeEventListener("keydown", onKey);
|
|
2017
|
-
}, [open]);
|
|
2018
|
-
(0, import_react21.useEffect)(() => () => {
|
|
2019
|
-
if (closeTimer.current != null) clearTimeout(closeTimer.current);
|
|
1766
|
+
(0, import_react17.useEffect)(() => () => {
|
|
2020
1767
|
const b = bubbleRef.current;
|
|
2021
1768
|
if (b && b.matches(":popover-open")) {
|
|
2022
1769
|
try {
|
|
@@ -2026,19 +1773,14 @@ function Tooltip({ label, placement = "top", className, children, ...props }) {
|
|
|
2026
1773
|
}
|
|
2027
1774
|
}, []);
|
|
2028
1775
|
const bubbleAttr = { popover: "manual" };
|
|
2029
|
-
const single = (0, import_react21.isValidElement)(children);
|
|
2030
|
-
const child = single ? (0, import_react21.cloneElement)(children, {
|
|
2031
|
-
"aria-describedby": [children.props["aria-describedby"], id].filter(Boolean).join(" ")
|
|
2032
|
-
}) : children;
|
|
2033
1776
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
2034
1777
|
"span",
|
|
2035
1778
|
{
|
|
2036
1779
|
ref: triggerRef,
|
|
2037
1780
|
className: cx("uix-tooltip", className),
|
|
2038
|
-
"aria-describedby":
|
|
2039
|
-
tabIndex: single ? void 0 : 0,
|
|
1781
|
+
"aria-describedby": id,
|
|
2040
1782
|
onMouseEnter: show,
|
|
2041
|
-
onMouseLeave:
|
|
1783
|
+
onMouseLeave: hide,
|
|
2042
1784
|
onFocus: show,
|
|
2043
1785
|
onBlur: hide,
|
|
2044
1786
|
onKeyDown: (e) => {
|
|
@@ -2046,20 +1788,8 @@ function Tooltip({ label, placement = "top", className, children, ...props }) {
|
|
|
2046
1788
|
},
|
|
2047
1789
|
...props,
|
|
2048
1790
|
children: [
|
|
2049
|
-
|
|
2050
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2051
|
-
"span",
|
|
2052
|
-
{
|
|
2053
|
-
ref: bubbleRef,
|
|
2054
|
-
id,
|
|
2055
|
-
role: "tooltip",
|
|
2056
|
-
className: "uix-tooltip__bubble",
|
|
2057
|
-
onMouseEnter: cancelClose,
|
|
2058
|
-
onMouseLeave: scheduleHide,
|
|
2059
|
-
...bubbleAttr,
|
|
2060
|
-
children: label
|
|
2061
|
-
}
|
|
2062
|
-
)
|
|
1791
|
+
children,
|
|
1792
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { ref: bubbleRef, id, role: "tooltip", className: "uix-tooltip__bubble", ...bubbleAttr, children: label })
|
|
2063
1793
|
]
|
|
2064
1794
|
}
|
|
2065
1795
|
);
|
|
@@ -2099,14 +1829,8 @@ function Skeleton({ variant = "block", width, height, className, style, ...props
|
|
|
2099
1829
|
}
|
|
2100
1830
|
);
|
|
2101
1831
|
}
|
|
2102
|
-
function LoadingState({ rows = 3,
|
|
2103
|
-
return (
|
|
2104
|
-
// no aria-busy: busy=true tells AT the region isn't ready and suppresses the announcement (UIX-A11Y-4)
|
|
2105
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: cx("uix-stack", className), role: "status", ...props, children: [
|
|
2106
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "uix-visually-hidden", children: label ?? "Loading" }),
|
|
2107
|
-
Array.from({ length: rows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Skeleton, { variant: "text", width: `${92 - i % 3 * 14}%` }, i))
|
|
2108
|
-
] })
|
|
2109
|
-
);
|
|
1832
|
+
function LoadingState({ rows = 3, className, ...props }) {
|
|
1833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: cx("uix-stack", className), role: "status", "aria-busy": "true", ...props, children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Skeleton, { variant: "text", width: `${92 - i % 3 * 14}%` }, i)) });
|
|
2110
1834
|
}
|
|
2111
1835
|
|
|
2112
1836
|
// src/components/Label.tsx
|
|
@@ -2124,8 +1848,7 @@ var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
|
2124
1848
|
function Avatar({ size = "md", src, alt, children, status, className, ...props }) {
|
|
2125
1849
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: cx("uix-avatar", size !== "md" && `uix-avatar--${size}`, className), ...props, children: [
|
|
2126
1850
|
src ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("img", { src, alt: alt ?? "" }) : children,
|
|
2127
|
-
status && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "uix-avatar__status"
|
|
2128
|
-
status && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "uix-visually-hidden", children: "online" })
|
|
1851
|
+
status && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "uix-avatar__status" })
|
|
2129
1852
|
] });
|
|
2130
1853
|
}
|
|
2131
1854
|
function AvatarGroup({ children, className, ...props }) {
|
|
@@ -2145,7 +1868,7 @@ function UserChip({ avatar, name, sub, className, children, ...props }) {
|
|
|
2145
1868
|
// src/components/Comments.tsx
|
|
2146
1869
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2147
1870
|
function Comments({ children, className, ...props }) {
|
|
2148
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", {
|
|
1871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: cx("uix-comments", className), ...props, children });
|
|
2149
1872
|
}
|
|
2150
1873
|
function Comment({ avatar, author, meta, children, className, ...props }) {
|
|
2151
1874
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: cx("uix-comment", className), ...props, children: [
|
|
@@ -2162,23 +1885,18 @@ function Comment({ avatar, author, meta, children, className, ...props }) {
|
|
|
2162
1885
|
}
|
|
2163
1886
|
|
|
2164
1887
|
// src/components/Composer.tsx
|
|
2165
|
-
var import_react22 = require("react");
|
|
2166
1888
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2167
|
-
function Composer({ children, className,
|
|
2168
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: cx("uix-composer", className), ...props, children
|
|
2169
|
-
if (!(0, import_react22.isValidElement)(child) || child.type !== "textarea") return child;
|
|
2170
|
-
const p = child.props;
|
|
2171
|
-
return p["aria-label"] || p["aria-labelledby"] || p.id ? child : (0, import_react22.cloneElement)(child, { "aria-label": label });
|
|
2172
|
-
}) });
|
|
1889
|
+
function Composer({ children, className, ...props }) {
|
|
1890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: cx("uix-composer", className), ...props, children });
|
|
2173
1891
|
}
|
|
2174
1892
|
function ComposerBar({ children, className, ...props }) {
|
|
2175
1893
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: cx("uix-composer__bar", className), ...props, children });
|
|
2176
1894
|
}
|
|
2177
1895
|
|
|
2178
1896
|
// src/components/Segmented.tsx
|
|
2179
|
-
var
|
|
1897
|
+
var import_react18 = require("react");
|
|
2180
1898
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2181
|
-
var SegmentedCtx = (0,
|
|
1899
|
+
var SegmentedCtx = (0, import_react18.createContext)({});
|
|
2182
1900
|
function Segmented({ value, onChange, children, className, ...props }) {
|
|
2183
1901
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(SegmentedCtx.Provider, { value: { value, onChange }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { role: "group", className: cx("uix-segmented", className), ...props, children }) });
|
|
2184
1902
|
}
|
|
@@ -2189,7 +1907,7 @@ function SegmentedOption({
|
|
|
2189
1907
|
onClick,
|
|
2190
1908
|
...props
|
|
2191
1909
|
}) {
|
|
2192
|
-
const ctx = (0,
|
|
1910
|
+
const ctx = (0, import_react18.useContext)(SegmentedCtx);
|
|
2193
1911
|
const selected = ctx.value === value;
|
|
2194
1912
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2195
1913
|
"button",
|
|
@@ -2210,11 +1928,11 @@ function SegmentedOption({
|
|
|
2210
1928
|
// src/components/Timeline.tsx
|
|
2211
1929
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2212
1930
|
function Timeline({ children, className, ...props }) {
|
|
2213
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("
|
|
1931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: cx("uix-timeline", className), ...props, children });
|
|
2214
1932
|
}
|
|
2215
1933
|
function TimelineItem({ node, meta, children, className, ...props }) {
|
|
2216
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("
|
|
2217
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "uix-timeline__rail",
|
|
1934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: cx("uix-timeline__item", className), ...props, children: [
|
|
1935
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "uix-timeline__rail", children: [
|
|
2218
1936
|
node ?? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "uix-timeline__node" }),
|
|
2219
1937
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "uix-timeline__line" })
|
|
2220
1938
|
] }),
|
|
@@ -2238,7 +1956,7 @@ function Note({ tone, icon, children, className, ...props }) {
|
|
|
2238
1956
|
}
|
|
2239
1957
|
|
|
2240
1958
|
// src/components/Popover.tsx
|
|
2241
|
-
var
|
|
1959
|
+
var import_react19 = require("react");
|
|
2242
1960
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2243
1961
|
function Popover({
|
|
2244
1962
|
popover = "auto",
|
|
@@ -2249,15 +1967,15 @@ function Popover({
|
|
|
2249
1967
|
children,
|
|
2250
1968
|
...props
|
|
2251
1969
|
}) {
|
|
2252
|
-
const ref = (0,
|
|
2253
|
-
const [open, setOpen] = (0,
|
|
1970
|
+
const ref = (0, import_react19.useRef)(null);
|
|
1971
|
+
const [open, setOpen] = (0, import_react19.useState)(false);
|
|
2254
1972
|
const popoverAttr = { popover };
|
|
2255
1973
|
const reposition = useAnchoredPosition(anchor ?? null, ref, {
|
|
2256
1974
|
open: open && !!anchor,
|
|
2257
1975
|
placement,
|
|
2258
1976
|
offset
|
|
2259
1977
|
});
|
|
2260
|
-
(0,
|
|
1978
|
+
(0, import_react19.useEffect)(() => {
|
|
2261
1979
|
const el = ref.current;
|
|
2262
1980
|
if (!el || !anchor) return;
|
|
2263
1981
|
const sync = () => {
|
|
@@ -2272,138 +1990,34 @@ function Popover({
|
|
|
2272
1990
|
}
|
|
2273
1991
|
|
|
2274
1992
|
// src/components/CommandPalette.tsx
|
|
2275
|
-
var import_react25 = require("react");
|
|
2276
1993
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2277
|
-
var CmdkContext = (0, import_react25.createContext)(null);
|
|
2278
1994
|
function CommandPalette({ inputProps, children, className, ...props }) {
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
const setActive = (0, import_react25.useCallback)((id, active) => {
|
|
2284
|
-
setActiveId((cur) => active ? id : cur === id ? null : cur);
|
|
2285
|
-
}, []);
|
|
2286
|
-
const registerItem = (0, import_react25.useCallback)(() => {
|
|
2287
|
-
setCount((c) => c + 1);
|
|
2288
|
-
return () => setCount((c) => c - 1);
|
|
2289
|
-
}, []);
|
|
2290
|
-
(0, import_react25.useEffect)(() => {
|
|
2291
|
-
const t = window.setTimeout(() => setAnnounced(`${count} result${count === 1 ? "" : "s"}`), 150);
|
|
2292
|
-
return () => clearTimeout(t);
|
|
2293
|
-
}, [count]);
|
|
2294
|
-
const ctx = (0, import_react25.useMemo)(() => ({ listId, setActive, registerItem }), [listId, setActive, registerItem]);
|
|
2295
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CmdkContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: cx("uix-cmdk", className), ...props, children: [
|
|
2296
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2297
|
-
"input",
|
|
2298
|
-
{
|
|
2299
|
-
className: "uix-cmdk__input",
|
|
2300
|
-
role: "combobox",
|
|
2301
|
-
"aria-expanded": "true",
|
|
2302
|
-
"aria-autocomplete": "list",
|
|
2303
|
-
"aria-controls": listId,
|
|
2304
|
-
"aria-activedescendant": activeId ?? void 0,
|
|
2305
|
-
"aria-label": "Command palette",
|
|
2306
|
-
...inputProps
|
|
2307
|
-
}
|
|
2308
|
-
),
|
|
2309
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "uix-cmdk__list", role: "listbox", id: listId, children }),
|
|
2310
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "uix-visually-hidden", role: "status", children: announced })
|
|
2311
|
-
] }) });
|
|
1995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: cx("uix-cmdk", className), ...props, children: [
|
|
1996
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { className: "uix-cmdk__input", ...inputProps }),
|
|
1997
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "uix-cmdk__list", children })
|
|
1998
|
+
] });
|
|
2312
1999
|
}
|
|
2313
2000
|
function CommandGroup({ label, children }) {
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
label != null && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "uix-cmdk__group", id: labelId, children: label }),
|
|
2001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
2002
|
+
label != null && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "uix-cmdk__group", children: label }),
|
|
2317
2003
|
children
|
|
2318
2004
|
] });
|
|
2319
2005
|
}
|
|
2320
|
-
function CommandItem({ icon, shortcut, active, children, className,
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
if (!ctx || !active) return;
|
|
2327
|
-
ctx.setActive(itemId, true);
|
|
2328
|
-
return () => ctx.setActive(itemId, false);
|
|
2329
|
-
}, [ctx, itemId, active]);
|
|
2330
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
2331
|
-
"div",
|
|
2332
|
-
{
|
|
2333
|
-
className: cx("uix-cmdk__item", className),
|
|
2334
|
-
"data-active": active || void 0,
|
|
2335
|
-
id: itemId,
|
|
2336
|
-
role: "option",
|
|
2337
|
-
"aria-selected": !!active,
|
|
2338
|
-
...props,
|
|
2339
|
-
children: [
|
|
2340
|
-
icon,
|
|
2341
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children }),
|
|
2342
|
-
shortcut
|
|
2343
|
-
]
|
|
2344
|
-
}
|
|
2345
|
-
);
|
|
2006
|
+
function CommandItem({ icon, shortcut, active, children, className, ...props }) {
|
|
2007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: cx("uix-cmdk__item", className), "data-active": active || void 0, ...props, children: [
|
|
2008
|
+
icon,
|
|
2009
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children }),
|
|
2010
|
+
shortcut
|
|
2011
|
+
] });
|
|
2346
2012
|
}
|
|
2347
2013
|
|
|
2348
2014
|
// src/components/Inbox.tsx
|
|
2349
|
-
var import_react26 = require("react");
|
|
2350
2015
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2351
|
-
function Inbox({
|
|
2352
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: cx("uix-inbox", className),
|
|
2016
|
+
function Inbox({ children, className, ...props }) {
|
|
2017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: cx("uix-inbox", className), ...props, children });
|
|
2353
2018
|
}
|
|
2354
|
-
var InboxListCtx = (0, import_react26.createContext)({});
|
|
2355
2019
|
function InboxList({ children, className, ...props }) {
|
|
2356
|
-
|
|
2357
|
-
const [activeId, setActiveId] = (0, import_react26.useState)(void 0);
|
|
2358
|
-
const ctx = (0, import_react26.useMemo)(() => ({ activeId }), [activeId]);
|
|
2359
|
-
const onKeyDown = (e) => {
|
|
2360
|
-
const opts = Array.from(listRef.current?.querySelectorAll('[role="option"]') ?? []);
|
|
2361
|
-
if (opts.length === 0) return;
|
|
2362
|
-
const idx = opts.findIndex((el2) => el2.id === activeId);
|
|
2363
|
-
let next;
|
|
2364
|
-
switch (e.key) {
|
|
2365
|
-
case "ArrowDown":
|
|
2366
|
-
next = Math.min(idx + 1, opts.length - 1);
|
|
2367
|
-
break;
|
|
2368
|
-
case "ArrowUp":
|
|
2369
|
-
next = idx < 0 ? 0 : Math.max(idx - 1, 0);
|
|
2370
|
-
break;
|
|
2371
|
-
case "Home":
|
|
2372
|
-
next = 0;
|
|
2373
|
-
break;
|
|
2374
|
-
case "End":
|
|
2375
|
-
next = opts.length - 1;
|
|
2376
|
-
break;
|
|
2377
|
-
case "Enter":
|
|
2378
|
-
case " ":
|
|
2379
|
-
if (idx >= 0) {
|
|
2380
|
-
e.preventDefault();
|
|
2381
|
-
opts[idx]?.click();
|
|
2382
|
-
}
|
|
2383
|
-
return;
|
|
2384
|
-
default:
|
|
2385
|
-
return;
|
|
2386
|
-
}
|
|
2387
|
-
e.preventDefault();
|
|
2388
|
-
const el = opts[next];
|
|
2389
|
-
if (!el || !el.id) return;
|
|
2390
|
-
setActiveId(el.id);
|
|
2391
|
-
el.scrollIntoView({ block: "nearest" });
|
|
2392
|
-
};
|
|
2393
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(InboxListCtx.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2394
|
-
"div",
|
|
2395
|
-
{
|
|
2396
|
-
ref: listRef,
|
|
2397
|
-
className: cx("uix-inbox__list", className),
|
|
2398
|
-
role: "listbox",
|
|
2399
|
-
tabIndex: 0,
|
|
2400
|
-
"aria-label": "Inbox",
|
|
2401
|
-
"aria-activedescendant": activeId,
|
|
2402
|
-
onKeyDown,
|
|
2403
|
-
...props,
|
|
2404
|
-
children
|
|
2405
|
-
}
|
|
2406
|
-
) });
|
|
2020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: cx("uix-inbox__list", className), role: "listbox", ...props, children });
|
|
2407
2021
|
}
|
|
2408
2022
|
function InboxItem({
|
|
2409
2023
|
subject,
|
|
@@ -2413,19 +2027,13 @@ function InboxItem({
|
|
|
2413
2027
|
selected,
|
|
2414
2028
|
children,
|
|
2415
2029
|
className,
|
|
2416
|
-
id,
|
|
2417
2030
|
...props
|
|
2418
2031
|
}) {
|
|
2419
|
-
const autoId = (0, import_react26.useId)();
|
|
2420
|
-
const itemId = id ?? autoId;
|
|
2421
|
-
const { activeId } = (0, import_react26.useContext)(InboxListCtx);
|
|
2422
2032
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
2423
2033
|
"div",
|
|
2424
2034
|
{
|
|
2425
2035
|
role: "option",
|
|
2426
|
-
id: itemId,
|
|
2427
2036
|
"aria-selected": selected ?? false,
|
|
2428
|
-
"data-active": activeId === itemId ? "" : void 0,
|
|
2429
2037
|
className: cx("uix-inbox__item", className),
|
|
2430
2038
|
...unread ? { "data-unread": "" } : {},
|
|
2431
2039
|
...props,
|
|
@@ -2443,60 +2051,29 @@ function InboxDetail({ children, className, ...props }) {
|
|
|
2443
2051
|
}
|
|
2444
2052
|
|
|
2445
2053
|
// src/components/Kanban.tsx
|
|
2446
|
-
var import_react27 = require("react");
|
|
2447
2054
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2448
|
-
function Kanban({
|
|
2449
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.
|
|
2450
|
-
announcement != null && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { role: "status", className: "uix-visually-hidden", children: announcement }),
|
|
2451
|
-
children
|
|
2452
|
-
] });
|
|
2055
|
+
function Kanban({ children, className, ...props }) {
|
|
2056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: cx("uix-kanban", className), ...props, children });
|
|
2453
2057
|
}
|
|
2454
2058
|
function KanbanColumn({ title, count, children, className, ...props }) {
|
|
2455
|
-
const headId = (0, import_react27.useId)();
|
|
2456
|
-
const hasHead = title != null || count != null;
|
|
2457
2059
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: cx("uix-kanban__col", className), ...props, children: [
|
|
2458
|
-
|
|
2060
|
+
(title != null || count != null) && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "uix-kanban__head", children: [
|
|
2459
2061
|
title,
|
|
2460
2062
|
count != null && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "uix-kanban__count", children: count })
|
|
2461
2063
|
] }),
|
|
2462
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "uix-kanban__body",
|
|
2064
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "uix-kanban__body", children })
|
|
2463
2065
|
] });
|
|
2464
2066
|
}
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
};
|
|
2471
|
-
function KanbanCard({ title, meta, children, className, onMove, onKeyDown, ...props }) {
|
|
2472
|
-
const handleKeyDown = (e) => {
|
|
2473
|
-
onKeyDown?.(e);
|
|
2474
|
-
if (!onMove || !e.altKey || e.defaultPrevented) return;
|
|
2475
|
-
const dir = MOVE_KEYS[e.key];
|
|
2476
|
-
if (dir) {
|
|
2477
|
-
e.preventDefault();
|
|
2478
|
-
onMove(dir);
|
|
2479
|
-
}
|
|
2480
|
-
};
|
|
2481
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
2482
|
-
"div",
|
|
2483
|
-
{
|
|
2484
|
-
role: "listitem",
|
|
2485
|
-
tabIndex: 0,
|
|
2486
|
-
className: cx("uix-kanban__card", className),
|
|
2487
|
-
onKeyDown: handleKeyDown,
|
|
2488
|
-
...props,
|
|
2489
|
-
children: [
|
|
2490
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "uix-kanban__card-title", children: title }),
|
|
2491
|
-
meta && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "uix-kanban__card-meta", children: meta }),
|
|
2492
|
-
children
|
|
2493
|
-
]
|
|
2494
|
-
}
|
|
2495
|
-
);
|
|
2067
|
+
function KanbanCard({ title, meta, children, className, ...props }) {
|
|
2068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: cx("uix-kanban__card", className), ...props, children: [
|
|
2069
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "uix-kanban__card-title", children: title }),
|
|
2070
|
+
meta && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "uix-kanban__card-meta", children: meta }),
|
|
2071
|
+
children
|
|
2072
|
+
] });
|
|
2496
2073
|
}
|
|
2497
2074
|
|
|
2498
2075
|
// src/components/Tree.tsx
|
|
2499
|
-
var
|
|
2076
|
+
var import_react20 = require("react");
|
|
2500
2077
|
|
|
2501
2078
|
// src/tree-model.ts
|
|
2502
2079
|
function flattenTree(nodes, expanded, level = 1) {
|
|
@@ -2541,14 +2118,6 @@ function treeNav(flat, currentId, key) {
|
|
|
2541
2118
|
case " ":
|
|
2542
2119
|
return cur.hasChildren ? { toggleId: cur.node.id, selectId: cur.node.id } : { selectId: cur.node.id };
|
|
2543
2120
|
default:
|
|
2544
|
-
if (key.length === 1) {
|
|
2545
|
-
const q = key.toLowerCase();
|
|
2546
|
-
for (let step = 1; step <= flat.length; step++) {
|
|
2547
|
-
const f = flat[(idx + step) % flat.length];
|
|
2548
|
-
const label = f.node.typeaheadLabel ?? (typeof f.node.label === "string" ? f.node.label : void 0);
|
|
2549
|
-
if (label != null && label.toLowerCase().startsWith(q)) return { focusId: f.node.id };
|
|
2550
|
-
}
|
|
2551
|
-
}
|
|
2552
2121
|
return {};
|
|
2553
2122
|
}
|
|
2554
2123
|
}
|
|
@@ -2616,12 +2185,12 @@ function Tree({
|
|
|
2616
2185
|
className,
|
|
2617
2186
|
...props
|
|
2618
2187
|
}) {
|
|
2619
|
-
const [internalExpanded, setInternalExpanded] = (0,
|
|
2188
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react20.useState)(defaultExpanded ?? /* @__PURE__ */ new Set());
|
|
2620
2189
|
const expanded = controlledExpanded ?? internalExpanded;
|
|
2621
|
-
const rootRef = (0,
|
|
2622
|
-
const [focusedId, setFocusedId] = (0,
|
|
2190
|
+
const rootRef = (0, import_react20.useRef)(null);
|
|
2191
|
+
const [focusedId, setFocusedId] = (0, import_react20.useState)(void 0);
|
|
2623
2192
|
const selectable = selected !== void 0 || onSelect != null;
|
|
2624
|
-
const handleToggle = (0,
|
|
2193
|
+
const handleToggle = (0, import_react20.useCallback)((id) => {
|
|
2625
2194
|
if (!controlledExpanded) {
|
|
2626
2195
|
setInternalExpanded((prev) => {
|
|
2627
2196
|
const next = new Set(prev);
|
|
@@ -2632,7 +2201,7 @@ function Tree({
|
|
|
2632
2201
|
}
|
|
2633
2202
|
onToggle?.(id);
|
|
2634
2203
|
}, [controlledExpanded, onToggle]);
|
|
2635
|
-
const flat = (0,
|
|
2204
|
+
const flat = (0, import_react20.useMemo)(() => flattenTree(nodes, expanded), [nodes, expanded]);
|
|
2636
2205
|
const useVirtual = virtualize ?? shouldVirtualize(flat.length);
|
|
2637
2206
|
const tabbableId = focusedId ?? selected ?? nodes[0]?.id;
|
|
2638
2207
|
if (useVirtual) {
|
|
@@ -2703,13 +2272,6 @@ function Tree({
|
|
|
2703
2272
|
setFocusedId(id);
|
|
2704
2273
|
break;
|
|
2705
2274
|
default:
|
|
2706
|
-
if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
2707
|
-
const act = treeNav(flat, id, e.key);
|
|
2708
|
-
if (act.focusId !== void 0) {
|
|
2709
|
-
e.preventDefault();
|
|
2710
|
-
focusItem(rootRef.current?.querySelector(`[role="treeitem"][data-id="${CSS.escape(act.focusId)}"]`));
|
|
2711
|
-
}
|
|
2712
|
-
}
|
|
2713
2275
|
break;
|
|
2714
2276
|
}
|
|
2715
2277
|
};
|
|
@@ -2743,14 +2305,12 @@ function VirtualTreeView({
|
|
|
2743
2305
|
className,
|
|
2744
2306
|
...props
|
|
2745
2307
|
}) {
|
|
2746
|
-
const scrollRef = (0,
|
|
2747
|
-
const [scrollTop, setScrollTop] = (0,
|
|
2748
|
-
const pendingFocus = (0,
|
|
2749
|
-
const hadFocus = (0, import_react28.useRef)(false);
|
|
2308
|
+
const scrollRef = (0, import_react20.useRef)(null);
|
|
2309
|
+
const [scrollTop, setScrollTop] = (0, import_react20.useState)(0);
|
|
2310
|
+
const pendingFocus = (0, import_react20.useRef)(false);
|
|
2750
2311
|
const win = virtualWindow(scrollTop, maxHeight, rowHeight, flat.length);
|
|
2751
2312
|
const rows = flat.slice(win.start, win.end);
|
|
2752
|
-
|
|
2753
|
-
(0, import_react28.useEffect)(() => {
|
|
2313
|
+
(0, import_react20.useEffect)(() => {
|
|
2754
2314
|
if (!pendingFocus.current || focusedId == null) return;
|
|
2755
2315
|
const el = scrollRef.current?.querySelector(`[role="treeitem"][data-id="${CSS.escape(focusedId)}"]`);
|
|
2756
2316
|
if (el) {
|
|
@@ -2758,11 +2318,6 @@ function VirtualTreeView({
|
|
|
2758
2318
|
pendingFocus.current = false;
|
|
2759
2319
|
}
|
|
2760
2320
|
}, [focusedId, win.start, win.end]);
|
|
2761
|
-
(0, import_react28.useEffect)(() => {
|
|
2762
|
-
if (!hadFocus.current || pendingFocus.current) return;
|
|
2763
|
-
const active = document.activeElement;
|
|
2764
|
-
if (active === document.body || active == null) scrollRef.current?.focus({ preventScroll: true });
|
|
2765
|
-
});
|
|
2766
2321
|
const moveTo = (id) => {
|
|
2767
2322
|
const i = flat.findIndex((f) => f.node.id === id);
|
|
2768
2323
|
if (i < 0) return;
|
|
@@ -2778,7 +2333,6 @@ function VirtualTreeView({
|
|
|
2778
2333
|
setFocusedId(id);
|
|
2779
2334
|
};
|
|
2780
2335
|
const onKeyDown = (e) => {
|
|
2781
|
-
if (e.key.length === 1 && (e.ctrlKey || e.metaKey || e.altKey)) return;
|
|
2782
2336
|
const curId = e.target.closest('[role="treeitem"]')?.dataset.id ?? focusedId;
|
|
2783
2337
|
const act = treeNav(flat, curId, e.key);
|
|
2784
2338
|
if (act.focusId === void 0 && act.toggleId === void 0 && act.selectId === void 0) return;
|
|
@@ -2799,20 +2353,13 @@ function VirtualTreeView({
|
|
|
2799
2353
|
ref: scrollRef,
|
|
2800
2354
|
className: cx("uix-tree", "uix-tree--virtual", className),
|
|
2801
2355
|
role: "tree",
|
|
2802
|
-
tabIndex: -1,
|
|
2803
2356
|
style: { maxHeight, overflow: "auto" },
|
|
2804
2357
|
onScroll: (e) => setScrollTop(e.currentTarget.scrollTop),
|
|
2805
2358
|
onKeyDown,
|
|
2806
|
-
onFocus: () => {
|
|
2807
|
-
hadFocus.current = true;
|
|
2808
|
-
},
|
|
2809
|
-
onBlur: (e) => {
|
|
2810
|
-
if (!e.currentTarget.contains(e.relatedTarget)) hadFocus.current = false;
|
|
2811
|
-
},
|
|
2812
2359
|
...props,
|
|
2813
2360
|
children: [
|
|
2814
|
-
win.padTop > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", {
|
|
2815
|
-
rows.map((f
|
|
2361
|
+
win.padTop > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { "aria-hidden": "true", style: { height: win.padTop } }),
|
|
2362
|
+
rows.map((f) => {
|
|
2816
2363
|
const rowStyle = { height: rowHeight, paddingLeft: `calc(${f.level - 1} * var(--uix-space-5))` };
|
|
2817
2364
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2818
2365
|
"li",
|
|
@@ -2824,7 +2371,7 @@ function VirtualTreeView({
|
|
|
2824
2371
|
"aria-expanded": f.hasChildren ? f.isExpanded : void 0,
|
|
2825
2372
|
"aria-selected": selectable ? selected === f.node.id : void 0,
|
|
2826
2373
|
"data-id": f.node.id,
|
|
2827
|
-
tabIndex: tabbableId === f.node.id
|
|
2374
|
+
tabIndex: tabbableId === f.node.id ? 0 : -1,
|
|
2828
2375
|
className: "uix-tree__item",
|
|
2829
2376
|
onFocus: (e) => {
|
|
2830
2377
|
if (e.target === e.currentTarget) setFocusedId(f.node.id);
|
|
@@ -2844,7 +2391,7 @@ function VirtualTreeView({
|
|
|
2844
2391
|
f.node.id
|
|
2845
2392
|
);
|
|
2846
2393
|
}),
|
|
2847
|
-
win.padBottom > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", {
|
|
2394
|
+
win.padBottom > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { "aria-hidden": "true", style: { height: win.padBottom } })
|
|
2848
2395
|
]
|
|
2849
2396
|
}
|
|
2850
2397
|
);
|
|
@@ -3103,7 +2650,6 @@ function StatusRow({ indicator, name, meta, className, ...props }) {
|
|
|
3103
2650
|
SubNavItem,
|
|
3104
2651
|
Switch,
|
|
3105
2652
|
Tab,
|
|
3106
|
-
TabPanel,
|
|
3107
2653
|
Table,
|
|
3108
2654
|
TableWrap,
|
|
3109
2655
|
Tabs,
|