pixelize-design-library 2.4.2-beta.64 → 2.4.2-beta.65
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/CHANGELOG.md +83 -8
- package/COMPONENT-GOTCHAS.md +37 -4
- package/DESIGN-GUIDE.md +7 -3
- package/dist/Components/CopyButton/CopyButton.d.ts +3 -1
- package/dist/Components/CopyButton/CopyButton.js +2 -2
- package/dist/Components/Drawer/Drawer.d.ts +1 -1
- package/dist/Components/Drawer/Drawer.js +6 -2
- package/dist/Components/Drawer/DrawerProps.d.ts +4 -0
- package/dist/Components/FormDrawer/FormDrawer.d.ts +1 -1
- package/dist/Components/FormDrawer/FormDrawer.js +3 -3
- package/dist/Components/FormDrawer/FormDrawerProps.d.ts +2 -0
- package/dist/Components/Modal/dialogNaming.d.ts +8 -0
- package/dist/Components/Modal/dialogNaming.js +21 -0
- package/dist/Components/NavLauncher/LauncherTabs.js +2 -2
- package/dist/Components/NavLauncher/NavLauncher.d.ts +1 -1
- package/dist/Components/NavLauncher/NavLauncher.js +257 -47
- package/dist/Components/NavLauncher/NavLauncherProps.d.ts +79 -3
- package/dist/Components/NavLauncher/ScopeBar.d.ts +14 -0
- package/dist/Components/NavLauncher/ScopeBar.js +137 -0
- package/dist/Components/NavLauncher/engine/distance.d.ts +4 -0
- package/dist/Components/NavLauncher/engine/distance.js +41 -0
- package/dist/Components/NavLauncher/engine/engine.d.ts +84 -0
- package/dist/Components/NavLauncher/engine/engine.js +471 -0
- package/dist/Components/NavLauncher/engine/fold.d.ts +15 -0
- package/dist/Components/NavLauncher/engine/fold.js +83 -0
- package/dist/Components/NavLauncher/engine/index.d.ts +21 -0
- package/dist/Components/NavLauncher/engine/index.js +17 -0
- package/dist/Components/NavLauncher/launcherParts.d.ts +2 -0
- package/dist/Components/NavLauncher/launcherParts.js +11 -7
- package/dist/Components/NavLauncher/match.d.ts +13 -2
- package/dist/Components/NavLauncher/match.js +26 -12
- package/dist/Components/NavLauncher/searchLayout.d.ts +60 -0
- package/dist/Components/NavLauncher/searchLayout.js +108 -0
- package/dist/Components/NavLauncher/spotlight.d.ts +39 -0
- package/dist/Components/NavLauncher/spotlight.js +202 -0
- package/dist/Components/NavLauncher/spotlightParts.d.ts +49 -0
- package/dist/Components/NavLauncher/spotlightParts.js +108 -0
- package/dist/Components/Table/components/TableHeader.js +3 -1
- package/dist/Components/Table/components/TableLoading.js +8 -2
- package/dist/Components/WizardDialog/WizardDialog.d.ts +1 -1
- package/dist/Components/WizardDialog/WizardDialog.js +15 -3
- package/dist/Components/WizardDialog/WizardDialogProps.d.ts +5 -3
- package/dist/Components/WorkspaceWindow/WorkspaceWindow.js +3 -2
- package/dist/Components/WorkspaceWindow/WorkspaceWindowProps.d.ts +2 -8
- package/dist/Theme/chakra/ringShadow.d.ts +3 -0
- package/dist/Theme/chakra/ringShadow.js +7 -0
- package/dist/Theme/tokens/builders/buildDarkPalette.d.ts +1 -1
- package/dist/Theme/tokens/builders/buildDarkPalette.js +5 -5
- package/dist/esm/Components/CopyButton/CopyButton.js +2 -2
- package/dist/esm/Components/Drawer/Drawer.js +6 -2
- package/dist/esm/Components/FormDrawer/FormDrawer.js +3 -3
- package/dist/esm/Components/Modal/dialogNaming.js +18 -0
- package/dist/esm/Components/NavLauncher/LauncherTabs.js +2 -2
- package/dist/esm/Components/NavLauncher/NavLauncher.js +259 -49
- package/dist/esm/Components/NavLauncher/ScopeBar.js +134 -0
- package/dist/esm/Components/NavLauncher/engine/distance.js +37 -0
- package/dist/esm/Components/NavLauncher/engine/engine.js +458 -0
- package/dist/esm/Components/NavLauncher/engine/fold.js +74 -0
- package/dist/esm/Components/NavLauncher/engine/index.js +14 -0
- package/dist/esm/Components/NavLauncher/launcherParts.js +10 -6
- package/dist/esm/Components/NavLauncher/match.js +25 -12
- package/dist/esm/Components/NavLauncher/searchLayout.js +100 -0
- package/dist/esm/Components/NavLauncher/spotlight.js +194 -0
- package/dist/esm/Components/NavLauncher/spotlightParts.js +95 -0
- package/dist/esm/Components/Table/components/TableHeader.js +4 -2
- package/dist/esm/Components/Table/components/TableLoading.js +6 -3
- package/dist/esm/Components/WizardDialog/WizardDialog.js +15 -3
- package/dist/esm/Components/WorkspaceWindow/WorkspaceWindow.js +4 -3
- package/dist/esm/Theme/chakra/ringShadow.js +3 -0
- package/dist/esm/Theme/tokens/builders/buildDarkPalette.js +5 -5
- package/dist/esm/index.js +2 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.describeFacts = exports.QUICK_ACTION_LIMIT = void 0;
|
|
7
|
+
exports.QuickActionsRow = QuickActionsRow;
|
|
8
|
+
exports.TopHitCard = TopHitCard;
|
|
9
|
+
exports.AnswerCard = AnswerCard;
|
|
10
|
+
exports.ShowMoreOption = ShowMoreOption;
|
|
11
|
+
exports.FactList = FactList;
|
|
12
|
+
exports.PreviewPane = PreviewPane;
|
|
13
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
14
|
+
const react_1 = require("@chakra-ui/react");
|
|
15
|
+
const lucide_react_1 = require("lucide-react");
|
|
16
|
+
const react_2 = require("react");
|
|
17
|
+
const motion_1 = require("../../Theme/chakra/motion");
|
|
18
|
+
const rowStates_1 = require("../../Theme/tokens/builders/rowStates");
|
|
19
|
+
const motion_2 = require("../../Theme/tokens/primitives/motion");
|
|
20
|
+
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
21
|
+
const Button_1 = __importDefault(require("../Button/Button"));
|
|
22
|
+
const CopyButton_1 = __importDefault(require("../CopyButton/CopyButton"));
|
|
23
|
+
const Kbd_1 = require("../Kbd/Kbd");
|
|
24
|
+
const launcherParts_1 = require("./launcherParts");
|
|
25
|
+
exports.QUICK_ACTION_LIMIT = 5;
|
|
26
|
+
const HIDE_ON_TOUCH = { "@media (hover: none)": { display: "none" } };
|
|
27
|
+
function QuickActionsRow({ items, label, link, onRun, }) {
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Flex, { role: "group", "aria-label": label, "data-testid": "launcher-quick-actions", gap: "6px", minW: 0, flexWrap: "wrap", px: "4px", children: items.slice(0, exports.QUICK_ACTION_LIMIT).map((item) => {
|
|
29
|
+
const Icon = item.icon;
|
|
30
|
+
const common = {
|
|
31
|
+
variant: "outline",
|
|
32
|
+
colorScheme: "gray",
|
|
33
|
+
size: "sm",
|
|
34
|
+
borderRadius: "full",
|
|
35
|
+
flexShrink: 0,
|
|
36
|
+
label: item.label,
|
|
37
|
+
leftIcon: Icon ? ((0, jsx_runtime_1.jsx)(Icon, { size: 14, strokeWidth: 2, "aria-hidden": true })) : undefined,
|
|
38
|
+
};
|
|
39
|
+
return item.href && !item.run ? ((0, jsx_runtime_1.jsx)(Button_1.default, { ...common, as: link.linkAs, href: item.href, onClick: link.onPlainClick }, item.id)) : ((0, jsx_runtime_1.jsx)(Button_1.default, { ...common, onClick: () => onRun(item) }, item.id));
|
|
40
|
+
}) }));
|
|
41
|
+
}
|
|
42
|
+
const useCardSurface = (isActive) => {
|
|
43
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
44
|
+
const { edge, fill } = (0, launcherParts_1.activeRowStyle)(colors);
|
|
45
|
+
return {
|
|
46
|
+
position: "relative",
|
|
47
|
+
borderRadius: "xl",
|
|
48
|
+
borderWidth: "1px",
|
|
49
|
+
borderColor: isActive ? edge : colors.boxborder[200],
|
|
50
|
+
bg: isActive ? fill : colors.surfaceRaised,
|
|
51
|
+
transition: (0, motion_2.transitionFor)(["background-color", "border-color"]),
|
|
52
|
+
sx: (0, motion_1.reducedMotionSx)(),
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
function IconChip({ icon, size }) {
|
|
56
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
57
|
+
const Icon = icon !== null && icon !== void 0 ? icon : lucide_react_1.Search;
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Flex, { boxSize: `${size}px`, borderRadius: "10px", bg: colors.primary.opacity[8], color: colors.accentText, align: "center", justify: "center", flexShrink: 0, children: (0, jsx_runtime_1.jsx)(Icon, { size: Math.round(size / 2), strokeWidth: 1.8, "aria-hidden": true }) }));
|
|
59
|
+
}
|
|
60
|
+
function CardAnchor({ item, link }) {
|
|
61
|
+
if (!item.href)
|
|
62
|
+
return null;
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Box, { as: link.linkAs, href: item.href, tabIndex: -1, "aria-hidden": true, onClick: link.onPlainClick, position: "absolute", inset: 0, borderRadius: "xl" }));
|
|
64
|
+
}
|
|
65
|
+
function TopHitCard({ item, query, isActive, optionId, link, labels, onOpen, onHover, describedBy, }) {
|
|
66
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
67
|
+
const surface = useCardSurface(isActive);
|
|
68
|
+
const meta = [item.context, item.hint].filter(Boolean).join(" · ");
|
|
69
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { role: "presentation", "data-group": true, "data-reveal": isActive, direction: "column", gap: "10px", p: "12px", onMouseMove: onHover, ...surface, children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { id: optionId, role: "option", "aria-selected": isActive, "aria-describedby": describedBy, "data-active": isActive, align: "center", gap: "12px", minW: 0, cursor: "pointer", onClick: () => {
|
|
70
|
+
if (!item.href)
|
|
71
|
+
onOpen();
|
|
72
|
+
}, children: [(0, jsx_runtime_1.jsx)(IconChip, { icon: item.icon, size: 40 }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { direction: "column", flex: 1, minW: 0, gap: "2px", children: [(0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "md", lineHeight: "22px", fontWeight: 600, color: colors.text[900], noOfLines: 1, children: (0, jsx_runtime_1.jsx)(launcherParts_1.Highlight, { text: item.label, query: query }) }), meta ? ((0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "12.5px", color: colors.textMuted, noOfLines: 1, children: meta })) : null, item.keywordHint ? ((0, jsx_runtime_1.jsxs)(react_1.Text, { fontSize: "xs", color: colors.textMuted, noOfLines: 1, children: [`${labels.matchedOn} “`, (0, jsx_runtime_1.jsx)(launcherParts_1.Highlight, { text: item.keywordHint, query: query }), "\u201D"] })) : null] }), (0, jsx_runtime_1.jsx)(launcherParts_1.CountBadge, { value: item.badge }), (0, jsx_runtime_1.jsx)(react_1.Box, { "aria-hidden": true, flexShrink: 0, sx: HIDE_ON_TOUCH, children: (0, jsx_runtime_1.jsx)(Kbd_1.KbdShortcut, { shortcut: "enter", size: "sm" }) })] }), (0, jsx_runtime_1.jsx)(CardAnchor, { item: item, link: link })] }));
|
|
73
|
+
}
|
|
74
|
+
function AnswerCard({ item, isActive, optionId, link, labels, onOpen, onHover, describedBy, }) {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
77
|
+
const surface = useCardSurface(isActive);
|
|
78
|
+
const answer = (_a = item.answer) !== null && _a !== void 0 ? _a : {
|
|
79
|
+
label: (_b = item.context) !== null && _b !== void 0 ? _b : "",
|
|
80
|
+
value: item.label,
|
|
81
|
+
};
|
|
82
|
+
const acts = Boolean(item.href || item.run);
|
|
83
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { role: "presentation", "data-group": true, p: "12px 14px", onMouseMove: onHover, ...surface, children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { id: optionId, role: "option", "aria-selected": isActive, "aria-describedby": describedBy, "data-active": isActive, align: "center", gap: "12px", flex: 1, minW: 0, cursor: "pointer", onClick: () => {
|
|
84
|
+
if (!item.href)
|
|
85
|
+
onOpen();
|
|
86
|
+
}, children: [(0, jsx_runtime_1.jsx)(IconChip, { icon: item.icon, size: 36 }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { direction: "column", flex: 1, minW: 0, gap: "1px", children: [answer.label ? ((0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "xs-minus", fontWeight: 600, letterSpacing: "0.06em", textTransform: "uppercase", color: colors.textMuted, noOfLines: 1, children: answer.label })) : null, (0, jsx_runtime_1.jsx)(react_1.Text, { id: `${optionId}-value`, fontSize: "lg", lineHeight: "24px", fontWeight: 600, color: colors.text[900], noOfLines: 2, children: answer.value }), answer.hint ? ((0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "xs", color: colors.textMuted, noOfLines: 1, children: answer.hint })) : null] }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { "aria-hidden": true, align: "center", gap: "6px", flexShrink: 0, fontSize: "11.5px", color: colors.textMuted, sx: HIDE_ON_TOUCH, children: [(0, jsx_runtime_1.jsx)(Kbd_1.KbdShortcut, { shortcut: "enter", size: "xs" }), acts ? labels.hintOpen : labels.hintCopy] })] }), (0, jsx_runtime_1.jsx)(CardAnchor, { item: item, link: link })] }));
|
|
87
|
+
}
|
|
88
|
+
function ShowMoreOption({ count, isActive, optionId, label, onExpand, onHover, }) {
|
|
89
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
90
|
+
const isTouch = (0, launcherParts_1.useTouchDensity)();
|
|
91
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { id: optionId, role: "option", "aria-selected": isActive, "data-active": isActive, align: "center", gap: "6px", minH: isTouch ? "44px" : "30px", px: "8px", mt: "2px", borderRadius: "lg", cursor: "pointer", fontSize: "12.5px", fontWeight: 500, color: colors.accentText, onClick: onExpand, onMouseMove: onHover, _hover: { bg: (0, rowStates_1.listRowBackgrounds)(colors).active }, sx: isActive ? (0, launcherParts_1.activeRowSurface)(colors) : undefined, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { size: 14, strokeWidth: 2, "aria-hidden": true }), label(count)] }));
|
|
92
|
+
}
|
|
93
|
+
const describeFacts = (facts) => facts.map((f) => `${f.label}: ${f.value}`).join("; ");
|
|
94
|
+
exports.describeFacts = describeFacts;
|
|
95
|
+
function FactList({ facts, labels, layout, onCopied, onCopyBlocked, }) {
|
|
96
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
97
|
+
const values = (0, react_2.useRef)([]);
|
|
98
|
+
const isPane = layout === "pane";
|
|
99
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "dl", m: 0, display: "grid", gridTemplateColumns: isPane ? "minmax(0, 1fr)" : "repeat(auto-fill, minmax(11rem, 1fr))", gap: isPane ? "12px" : "6px 16px", children: facts.map((fact, i) => ((0, jsx_runtime_1.jsxs)(react_1.Box, { minW: 0, children: [(0, jsx_runtime_1.jsx)(react_1.Text, { as: "dt", fontSize: "11.5px", lineHeight: "16px", color: colors.textMuted, children: fact.label }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "dd", m: 0, align: "center", gap: "2px", minW: 0, children: [(0, jsx_runtime_1.jsx)(react_1.Text, { ref: (node) => {
|
|
100
|
+
values.current[i] = node;
|
|
101
|
+
}, fontSize: isPane ? "13.5px" : "12.5px", lineHeight: "20px", color: colors.text[900], wordBreak: "break-word", minW: 0, children: fact.value }), fact.copyable ? ((0, jsx_runtime_1.jsx)(CopyButton_1.default, { value: fact.value, tooltip: labels.copy(fact.label), copiedLabel: labels.copied, size: isPane ? "xs" : "sm", iconSize: 14, onCopy: onCopied, onCopyError: () => onCopyBlocked(values.current[i]) })) : null] })] }, `${fact.label}-${i}`))) }));
|
|
102
|
+
}
|
|
103
|
+
function PreviewPane({ item, placement, width, labels, onCopied, onCopyBlocked, }) {
|
|
104
|
+
var _a, _b, _c, _d, _e;
|
|
105
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
106
|
+
const isDock = placement === "dock";
|
|
107
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Flex, { as: "aside", "aria-label": labels.preview, "data-testid": "launcher-preview", "data-scroll-region": true, direction: "column", gap: isDock ? "10px" : "16px", w: isDock ? "100%" : width, maxH: isDock ? "min(45vh, 20rem)" : undefined, flexShrink: 0, px: "18px", pt: isDock ? "12px" : "16px", pb: isDock ? "12px" : "16px", bg: colors.backgroundColor.subtle, ...(isDock ? { borderTopWidth: "1px" } : { borderLeftWidth: "1px" }), borderColor: colors.boxborder[200], overflowY: "auto", children: item ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: "10px", minW: 0, children: [(0, jsx_runtime_1.jsx)(IconChip, { icon: item.icon, size: isDock ? 28 : 36 }), (0, jsx_runtime_1.jsxs)(react_1.Box, { minW: 0, children: [(0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: isDock ? "14px" : "15px", fontWeight: 600, color: colors.text[900], noOfLines: isDock ? 1 : 2, children: (_b = (_a = item.answer) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : item.label }), item.context || item.answer ? ((0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "xs", color: colors.textMuted, noOfLines: 1, children: (_d = (_c = item.answer) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : item.context })) : null] })] }), ((_e = item.facts) === null || _e === void 0 ? void 0 : _e.length) ? ((0, jsx_runtime_1.jsx)(FactList, { facts: item.facts, labels: labels, layout: isDock ? "inline" : "pane", onCopied: onCopied, onCopyBlocked: onCopyBlocked }, item.id)) : ((0, jsx_runtime_1.jsxs)(react_1.Flex, { "aria-hidden": true, align: "center", gap: "6px", fontSize: "xs", color: colors.textMuted, children: [(0, jsx_runtime_1.jsx)(Kbd_1.KbdShortcut, { shortcut: "enter", size: "xs" }), labels.hintOpen] }))] })) : null }));
|
|
108
|
+
}
|
|
@@ -13,8 +13,10 @@ const TableFilters_1 = __importDefault(require("../filters/TableFilters"));
|
|
|
13
13
|
const columnLabel_1 = require("../columnLabel");
|
|
14
14
|
const lucide_react_1 = require("lucide-react");
|
|
15
15
|
const Checkbox_1 = __importDefault(require("../../Checkbox/Checkbox"));
|
|
16
|
+
const Skeletons_1 = __importDefault(require("../../Skeletons/Skeletons"));
|
|
16
17
|
const TableVariantContext_1 = require("../variants/TableVariantContext");
|
|
17
18
|
const motion_1 = require("../../../Theme/tokens/primitives/motion");
|
|
19
|
+
const borderWidths_1 = require("../../../Theme/tokens/primitives/borderWidths");
|
|
18
20
|
const motion_2 = require("../../../Theme/chakra/motion");
|
|
19
21
|
const focusRing_styles_1 = require("../../../Theme/chakra/focusRing.styles");
|
|
20
22
|
const rowDetail_1 = require("./rowDetail");
|
|
@@ -37,7 +39,7 @@ const SelectAllCell = (0, react_2.memo)(({ slotRef, freezedTextColor, noBorders,
|
|
|
37
39
|
});
|
|
38
40
|
const LoadingHeaderCells = ({ noBorders }) => {
|
|
39
41
|
const variant = (0, TableVariantContext_1.useTableVariant)();
|
|
40
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Array.from({ length: TableLoading_1.LOADING_PLACEHOLDER_COLUMNS }, (_, i) => ((0, jsx_runtime_1.jsx)(react_1.Th, { scope: "col", "aria-hidden": "true", px: 3, backgroundColor: variant.header.bg, borderBottom: noBorders ? "none" :
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Array.from({ length: TableLoading_1.LOADING_PLACEHOLDER_COLUMNS }, (_, i) => ((0, jsx_runtime_1.jsx)(react_1.Th, { scope: "col", "aria-hidden": "true", px: 3, backgroundColor: variant.header.bg, borderBottom: noBorders ? "none" : `${borderWidths_1.BORDER_WIDTHS.hairline} solid ${variant.header.ruleColor}`, children: (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: "0.75rem", width: i % 2 ? "50%" : "70%", borderRadius: "full" }) }, i))) }));
|
|
41
43
|
};
|
|
42
44
|
const ContentSpacerCell = (0, react_2.memo)(({ noBorders }) => {
|
|
43
45
|
const variant = (0, TableVariantContext_1.useTableVariant)();
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.TableBodyLoading = exports.LOADING_PLACEHOLDER_COLUMNS = void 0;
|
|
4
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
8
|
const react_1 = require("@chakra-ui/react");
|
|
9
|
+
const Skeletons_1 = __importDefault(require("../../Skeletons/Skeletons"));
|
|
10
|
+
const borderWidths_1 = require("../../../Theme/tokens/primitives/borderWidths");
|
|
11
|
+
const CHECKBOX_PLACEHOLDER_STYLE = { display: "inline-block", verticalAlign: "middle" };
|
|
6
12
|
const TableLoading = () => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Box, { overflowX: "auto", p: 4, children: (0, jsx_runtime_1.jsxs)(react_1.Table, { variant: "simple", width: "full", children: [(0, jsx_runtime_1.jsx)(react_1.Thead, { children: (0, jsx_runtime_1.jsxs)(react_1.Tr, { children: [(0, jsx_runtime_1.jsx)(react_1.Th, { p: 2, children: (0, jsx_runtime_1.jsx)(
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Box, { overflowX: "auto", p: 4, children: (0, jsx_runtime_1.jsxs)(react_1.Table, { variant: "simple", width: "full", children: [(0, jsx_runtime_1.jsx)(react_1.Thead, { children: (0, jsx_runtime_1.jsxs)(react_1.Tr, { children: [(0, jsx_runtime_1.jsx)(react_1.Th, { p: 2, children: (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: "20px" }) }), (0, jsx_runtime_1.jsx)(react_1.Th, { p: 2, children: (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: "20px" }) }), (0, jsx_runtime_1.jsx)(react_1.Th, { p: 2, children: (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: "20px" }) }), (0, jsx_runtime_1.jsx)(react_1.Th, { p: 2, children: (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: "20px" }) })] }) }), (0, jsx_runtime_1.jsx)(react_1.Tbody, { children: Array.from({ length: 5 }).map((_, rowIndex) => ((0, jsx_runtime_1.jsxs)(react_1.Tr, { children: [(0, jsx_runtime_1.jsx)(react_1.Td, { p: 2, children: (0, jsx_runtime_1.jsx)(react_1.SkeletonText, { noOfLines: 1, skeletonHeight: "2" }) }), (0, jsx_runtime_1.jsx)(react_1.Td, { p: 2, children: (0, jsx_runtime_1.jsx)(react_1.SkeletonText, { noOfLines: 1, skeletonHeight: "2" }) }), (0, jsx_runtime_1.jsx)(react_1.Td, { p: 2, children: (0, jsx_runtime_1.jsx)(react_1.SkeletonText, { noOfLines: 1, skeletonHeight: "2" }) }), (0, jsx_runtime_1.jsx)(react_1.Td, { p: 2, children: (0, jsx_runtime_1.jsx)(react_1.SkeletonText, { noOfLines: 1, skeletonHeight: "2" }) })] }, rowIndex))) })] }) }));
|
|
8
14
|
};
|
|
9
15
|
exports.default = TableLoading;
|
|
10
16
|
exports.LOADING_PLACEHOLDER_COLUMNS = 4;
|
|
11
17
|
const BAR_WIDTHS = ["72%", "58%", "84%", "46%", "66%", "78%"];
|
|
12
18
|
const TableBodyLoading = ({ noOfColumns, cells, borderColor, rowsCount = 4, rowHeight = 45, }) => {
|
|
13
19
|
const layout = cells !== null && cells !== void 0 ? cells : Array.from({ length: noOfColumns }, () => "bar");
|
|
14
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Array.from({ length: rowsCount }).map((_, row) => ((0, jsx_runtime_1.jsx)(react_1.Tr, { "aria-hidden": "true", children: layout.map((kind, col) => ((0, jsx_runtime_1.jsxs)(react_1.Td, { px: kind === "checkbox" ? 0 : 3, py: 0, height: `${rowHeight}px`, boxSizing: "border-box", border: "none", borderBottom:
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Array.from({ length: rowsCount }).map((_, row) => ((0, jsx_runtime_1.jsx)(react_1.Tr, { "aria-hidden": "true", children: layout.map((kind, col) => ((0, jsx_runtime_1.jsxs)(react_1.Td, { px: kind === "checkbox" ? 0 : 3, py: 0, height: `${rowHeight}px`, boxSizing: "border-box", border: "none", borderBottom: `${borderWidths_1.BORDER_WIDTHS.hairline} solid ${borderColor}`, textAlign: kind === "checkbox" ? "center" : undefined, children: [kind === "checkbox" && ((0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: "1rem", width: "1rem", borderRadius: "sm", style: CHECKBOX_PLACEHOLDER_STYLE })), kind === "bar" && ((0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: "0.75rem", width: BAR_WIDTHS[(row * 3 + col) % BAR_WIDTHS.length], borderRadius: "full" }))] }, col))) }, row))) }));
|
|
15
21
|
};
|
|
16
22
|
exports.TableBodyLoading = TableBodyLoading;
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import type { WizardDialogProps, WizardProps } from "./WizardDialogProps";
|
|
3
3
|
export { wizardTransition, firstInvalidStep, INITIAL_WIZARD_STATE } from "./wizardSteps";
|
|
4
4
|
export type { WizardAction, WizardState, StepValidator } from "./wizardSteps";
|
|
5
|
-
/**
|
|
5
|
+
/** Wizard that owns step state: validated Continue, locked future steps, error summary, review on the last step. A Modal by default; `chrome="inline"` draws it in place. */
|
|
6
6
|
export declare const WizardDialog: React.FC<WizardDialogProps>;
|
|
7
7
|
/** The same wizard inline, for a full-page flow rather than a modal. */
|
|
8
8
|
export declare const Wizard: React.FC<WizardProps>;
|
|
@@ -41,6 +41,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
41
41
|
const react_1 = require("react");
|
|
42
42
|
const react_2 = require("@chakra-ui/react");
|
|
43
43
|
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
44
|
+
const surfaceRaised_1 = require("../../Theme/tokens/builders/surfaceRaised");
|
|
44
45
|
const Modal_1 = __importStar(require("../Modal/Modal"));
|
|
45
46
|
const Button_1 = __importDefault(require("../Button/Button"));
|
|
46
47
|
const StageProgress_1 = __importDefault(require("../StageProgress/StageProgress"));
|
|
@@ -86,15 +87,26 @@ const WizardFooter = ({ flow, labels, isFinishing, finishDisabled, finishBlocked
|
|
|
86
87
|
const reason = finishDisabled && !isFinishing ? finishBlockedReason : undefined;
|
|
87
88
|
return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { w: "100%", justify: "space-between", gap: 2, wrap: "wrap", children: [onCancel ? ((0, jsx_runtime_1.jsx)(Button_1.default, { variant: "ghost", colorScheme: "gray", label: labels.cancel, onClick: onCancel, isDisabled: isFinishing, "data-testid": "wizard-cancel" })) : ((0, jsx_runtime_1.jsx)("span", {})), (0, jsx_runtime_1.jsxs)(react_2.Flex, { gap: 2, align: reason ? "center" : undefined, children: [!flow.isFirst ? ((0, jsx_runtime_1.jsx)(Button_1.default, { variant: "outline", colorScheme: "gray", label: labels.back, onClick: flow.back, isDisabled: isFinishing, "data-testid": "wizard-back" })) : null, flow.isLast && reason ? ((0, jsx_runtime_1.jsx)(react_2.Text, { id: reasonId, fontSize: "xs", color: colors.textMuted, "data-testid": "wizard-finish-reason", children: reason })) : null, flow.isLast ? ((0, jsx_runtime_1.jsx)(Button_1.default, { variant: "solid", colorScheme: "primary", label: labels.finish, onClick: flow.finish, isLoading: isFinishing, isDisabled: finishDisabled, "aria-describedby": reason ? reasonId : undefined, loadingText: labels.finish, "data-testid": "wizard-finish" })) : ((0, jsx_runtime_1.jsx)(Button_1.default, { variant: "solid", colorScheme: "primary", label: labels.next, onClick: flow.next, "data-testid": "wizard-next" }))] })] }));
|
|
88
89
|
};
|
|
89
|
-
|
|
90
|
-
const
|
|
90
|
+
const WizardInlineFrame = ({ title, subtitle, testId, footer, children }) => {
|
|
91
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
92
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { direction: "column", gap: 4, "data-testid": testId, children: [(0, jsx_runtime_1.jsxs)(react_2.Box, { children: [(0, jsx_runtime_1.jsx)(react_2.Heading, { as: "h2", fontSize: "md", fontWeight: 600, color: colors.header[900], children: title }), subtitle ? ((0, jsx_runtime_1.jsx)(react_2.Text, { mt: 0.5, fontSize: "sm", color: colors.textMuted, children: subtitle })) : null] }), children, (0, jsx_runtime_1.jsx)(react_2.Box, { position: "sticky", bottom: 0, pt: 3, borderTopWidth: "1px", borderColor: (0, surfaceRaised_1.raisedRule)(colors), bg: colors.surfaceRaised, children: footer })] }));
|
|
93
|
+
};
|
|
94
|
+
/** Wizard that owns step state: validated Continue, locked future steps, error summary, review on the last step. A Modal by default; `chrome="inline"` draws it in place. */
|
|
95
|
+
const WizardDialog = ({ isOpen, onClose, title, subtitle, steps, onFinish, isFinishing = false, finishDisabled = false, finishBlockedReason, stepId, onStepChange, size = "3xl", chrome = "modal", labels, "data-testid": testId, }) => {
|
|
91
96
|
const flow = (0, useWizardFlow_1.useWizardFlow)({ steps, stepId, onStepChange, onFinish, resetWhen: !isOpen });
|
|
92
97
|
const resolved = { ...DEFAULT_LABELS, ...labels };
|
|
93
98
|
const guardedClose = () => {
|
|
94
99
|
if (!isFinishing)
|
|
95
100
|
onClose();
|
|
96
101
|
};
|
|
97
|
-
|
|
102
|
+
const body = ((0, jsx_runtime_1.jsx)(WizardBody, { flow: flow, steps: steps, labels: resolved, testId: testId !== null && testId !== void 0 ? testId : "wizard-dialog" }));
|
|
103
|
+
const footer = ((0, jsx_runtime_1.jsx)(WizardFooter, { flow: flow, labels: resolved, isFinishing: isFinishing, finishDisabled: finishDisabled, finishBlockedReason: finishBlockedReason, onCancel: guardedClose }));
|
|
104
|
+
if (chrome === "inline") {
|
|
105
|
+
if (!isOpen)
|
|
106
|
+
return null;
|
|
107
|
+
return ((0, jsx_runtime_1.jsx)(WizardInlineFrame, { title: title, subtitle: subtitle, testId: testId ? `${testId}-inline` : "wizard-inline", footer: footer, children: body }));
|
|
108
|
+
}
|
|
109
|
+
return ((0, jsx_runtime_1.jsxs)(Modal_1.default, { isOpen: isOpen, onClose: guardedClose, size: size, isCentered: true, scrollBehavior: "inside", title: title, subtitle: subtitle, closeOnOverlayClick: false, closeOnEsc: !isFinishing, hideCloseButton: isFinishing, children: [(0, jsx_runtime_1.jsx)(Modal_1.ModalBody, { children: body }), (0, jsx_runtime_1.jsx)(Modal_1.ModalFooter, { children: footer })] }));
|
|
98
110
|
};
|
|
99
111
|
exports.WizardDialog = WizardDialog;
|
|
100
112
|
/** The same wizard inline, for a full-page flow rather than a modal. */
|
|
@@ -20,7 +20,7 @@ export type WizardLabels = Partial<{
|
|
|
20
20
|
fixErrors: string;
|
|
21
21
|
review: string;
|
|
22
22
|
}>;
|
|
23
|
-
/** Props for the
|
|
23
|
+
/** Props for the wizard dialog: Modal (or inline with `chrome`) + stepper + per-step validation + review on the last step. */
|
|
24
24
|
export interface WizardDialogProps {
|
|
25
25
|
isOpen: boolean;
|
|
26
26
|
/** Ignored while `isFinishing`. */
|
|
@@ -40,13 +40,15 @@ export interface WizardDialogProps {
|
|
|
40
40
|
stepId?: string;
|
|
41
41
|
/** Fires whenever the visible step changes, controlled or not. */
|
|
42
42
|
onStepChange?: (stepId: string) => void;
|
|
43
|
-
/** Modal width; default "3xl". */
|
|
43
|
+
/** Modal width; default "3xl". Ignored when `chrome` is "inline". */
|
|
44
44
|
size?: "lg" | "xl" | "2xl" | "3xl" | "4xl";
|
|
45
|
+
/** "inline" draws the wizard in place with no Modal (no overlay, focus trap, close X, Esc or dialog role) for a host that is already the dialog, such as a WorkspaceWindow; it renders nothing while closed and Cancel still calls `onClose`. Default "modal". */
|
|
46
|
+
chrome?: "modal" | "inline";
|
|
45
47
|
labels?: WizardLabels;
|
|
46
48
|
"data-testid"?: string;
|
|
47
49
|
}
|
|
48
50
|
/** Same flow inline (a page section, not a modal) — for full-page wizards. */
|
|
49
|
-
export interface WizardProps extends Omit<WizardDialogProps, "isOpen" | "onClose" | "title" | "subtitle" | "size"> {
|
|
51
|
+
export interface WizardProps extends Omit<WizardDialogProps, "isOpen" | "onClose" | "title" | "subtitle" | "size" | "chrome"> {
|
|
50
52
|
/** Renders a Cancel button in the footer when provided. */
|
|
51
53
|
onCancel?: () => void;
|
|
52
54
|
}
|
|
@@ -59,9 +59,10 @@ function WorkspaceTray({ items, onRestore, onClose, testId = "workspace-tray", p
|
|
|
59
59
|
restore: () => onRestore === null || onRestore === void 0 ? void 0 : onRestore(item.id),
|
|
60
60
|
close: () => onClose === null || onClose === void 0 ? void 0 : onClose(item.id),
|
|
61
61
|
};
|
|
62
|
+
const pill = ((0, jsx_runtime_1.jsxs)(react_1.HStack, { spacing: 1, pl: 3, pr: 1, py: 1, borderRadius: "full", bg: theme.colors.primary[100], color: ink, boxShadow: "md", borderWidth: "1px", borderColor: theme.colors.primary[200], "data-testid": `${testId}-pill`, children: [item.isDirty ? ((0, jsx_runtime_1.jsx)(react_1.Box, { role: "img", "aria-label": dirtyLabel, boxSize: "0.5rem", borderRadius: "full", bg: "currentColor", flexShrink: 0, "data-testid": `${testId}-dirty` })) : null, (0, jsx_runtime_1.jsxs)(react_1.Box, { as: "button", type: "button", fontSize: "sm", onClick: api.restore, "data-testid": `${testId}-restore`, maxW: "16rem", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: [item.title, item.subtitle ? ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "span", fontWeight: 400, ml: 1.5, children: item.subtitle })) : null] }), onClose ? ((0, jsx_runtime_1.jsx)(react_1.IconButton, { "aria-label": closeLabel ? closeLabel(item) : "Close", size: "xs", variant: "ghost", borderRadius: "full", minW: "auto", h: "auto", p: 1, color: "inherit", icon: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { size: 13 }), onClick: api.close, "data-testid": `${testId}-close` })) : null] }));
|
|
62
63
|
if (renderItem) {
|
|
63
|
-
return (0, jsx_runtime_1.jsx)(react_1.Box, { children: renderItem(item, api) }, item.id);
|
|
64
|
+
return (0, jsx_runtime_1.jsx)(react_1.Box, { children: renderItem(item, api, pill) }, item.id);
|
|
64
65
|
}
|
|
65
|
-
return (
|
|
66
|
+
return (0, jsx_runtime_1.jsx)(react_2.Fragment, { children: pill }, item.id);
|
|
66
67
|
}) }) }));
|
|
67
68
|
}
|
|
@@ -82,17 +82,11 @@ export interface WorkspaceTrayProps {
|
|
|
82
82
|
dirtyLabel?: string;
|
|
83
83
|
/** Accessible name of the tray region. Default "Minimized windows". */
|
|
84
84
|
label?: string;
|
|
85
|
-
/**
|
|
86
|
-
* Full override for a single item's pill markup — e.g. to wrap it in an
|
|
87
|
-
* app-specific hover preview, or to show extra state (a dirty dot) the
|
|
88
|
-
* generic pill doesn't know about. Receives the item plus ready-bound
|
|
89
|
-
* restore/close callbacks; when provided, the built-in pill is skipped for
|
|
90
|
-
* that item and this renders in its place inside the same positioned tray.
|
|
91
|
-
*/
|
|
85
|
+
/** Replaces one item's pill inside the same tray; gets the item, bound restore/close and `pill`, the built-in pill (dot, subtitle, close button) to return as is or wrap, e.g. in WorkspaceTrayPreview. */
|
|
92
86
|
renderItem?: (item: WorkspaceTrayItem, api: {
|
|
93
87
|
restore: () => void;
|
|
94
88
|
close: () => void;
|
|
95
|
-
}) => ReactNode;
|
|
89
|
+
}, pill: ReactNode) => ReactNode;
|
|
96
90
|
}
|
|
97
91
|
/** Props for WorkspaceTrayPreview — despite the name, works for any hover trigger, not just tray pills. */
|
|
98
92
|
export interface WorkspaceTrayPreviewProps {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.insetRingShadow = void 0;
|
|
4
|
+
const borderWidths_1 = require("../tokens/primitives/borderWidths");
|
|
5
|
+
/** A stroke drawn inside the border box as a box-shadow, so it never costs layout. */
|
|
6
|
+
const insetRingShadow = (color, width = "hairline") => `inset 0 0 0 ${borderWidths_1.BORDER_WIDTHS[width]} ${color}`;
|
|
7
|
+
exports.insetRingShadow = insetRingShadow;
|
|
@@ -6,7 +6,7 @@ export declare const shiftLighter: (scale: ColorScale) => ColorScale;
|
|
|
6
6
|
export declare const accentLightnessDelta: (accent500: string, white: string) => number;
|
|
7
7
|
/** Raises every rung by the same lightness delta, preserving the ramp's shape and hue. */
|
|
8
8
|
export declare const liftScale: (scale: ColorScale, delta: number) => ColorScale;
|
|
9
|
-
/** `lifted`:
|
|
9
|
+
/** `lifted`: the card sits a CARD_LIFT step above the canvas. `flat`: the card is the canvas. */
|
|
10
10
|
export type DarkPlanes = "lifted" | "flat";
|
|
11
11
|
export interface DarkPaletteOptions {
|
|
12
12
|
planes?: DarkPlanes;
|
|
@@ -151,7 +151,8 @@ const NAMED_SURFACE_L = {
|
|
|
151
151
|
accent: 17,
|
|
152
152
|
muted: 18,
|
|
153
153
|
};
|
|
154
|
-
|
|
154
|
+
// NOTE: surfaces are hue-neutral on every brand; brand hue stays on accents, ink and rules.
|
|
155
|
+
const SURFACE_SAT = 0;
|
|
155
156
|
const TEXT_SAT = 12;
|
|
156
157
|
const PLACEHOLDER_SAT = 10;
|
|
157
158
|
const BORDER_SAT = 12;
|
|
@@ -182,16 +183,15 @@ const cardPlane = (canvas, white, planes) => {
|
|
|
182
183
|
function buildDarkPalette(light, { planes = "lifted" } = {}) {
|
|
183
184
|
const hueSource = light.primary[500];
|
|
184
185
|
const { h } = (0, color_1.hexToHsl)(hueSource);
|
|
185
|
-
const surfaceSat = SURFACE_SAT[planes];
|
|
186
186
|
const namedSurfaces = Object.fromEntries(Object.entries(NAMED_SURFACE_L).map(([key, l]) => [
|
|
187
187
|
key,
|
|
188
|
-
(0, color_1.hslToHex)({ h, s:
|
|
188
|
+
(0, color_1.hslToHex)({ h, s: SURFACE_SAT, l }),
|
|
189
189
|
]));
|
|
190
190
|
const white = light.white;
|
|
191
191
|
const { card, rise, tableHover } = cardPlane(namedSurfaces.main, white, planes);
|
|
192
192
|
const primary = liftBrand(light.primary, white);
|
|
193
193
|
const background = {
|
|
194
|
-
...fromTargets(hueSource, raise(SURFACE_TARGETS, BACKGROUND_FILLS, rise),
|
|
194
|
+
...fromTargets(hueSource, raise(SURFACE_TARGETS, BACKGROUND_FILLS, rise), SURFACE_SAT),
|
|
195
195
|
50: card,
|
|
196
196
|
};
|
|
197
197
|
const semantic = {
|
|
@@ -231,7 +231,7 @@ function buildDarkPalette(light, { planes = "lifted" } = {}) {
|
|
|
231
231
|
border: dividerRamp,
|
|
232
232
|
boxborder: dividerRamp,
|
|
233
233
|
table: {
|
|
234
|
-
hover: fromTargets(hueSource, tableHover,
|
|
234
|
+
hover: fromTargets(hueSource, tableHover, SURFACE_SAT),
|
|
235
235
|
},
|
|
236
236
|
disabled: fromTargets(hueSource, DISABLED_TARGETS, DISABLED_SAT),
|
|
237
237
|
accentText: (0, accentText_1.pickAccentText)(primary, namedSurfaces.main),
|
|
@@ -10,7 +10,7 @@ import { transitionFor } from "../../Theme/tokens/primitives/index.js";
|
|
|
10
10
|
import { focusVisibleRing } from "../../Theme/chakra/focusRing.styles.js";
|
|
11
11
|
import ToolTip from "../ToolTip/ToolTip.js";
|
|
12
12
|
/** Copies `value` to the clipboard in 3 layouts (icon/button/menu-item) — not a full share/export action. */
|
|
13
|
-
const CopyButton = ({ value, variant = "icon", label = "Copy", copiedLabel = "Copied!", tooltip = "Copy", feedbackDuration = 1500, iconSize = 16, size = "sm", onCopy, }) => {
|
|
13
|
+
const CopyButton = ({ value, variant = "icon", label = "Copy", copiedLabel = "Copied!", tooltip = "Copy", feedbackDuration = 1500, iconSize = 16, size = "sm", onCopy, onCopyError, }) => {
|
|
14
14
|
const theme = useCustomTheme();
|
|
15
15
|
const [copied, setCopied] = useState(false);
|
|
16
16
|
const timer = useRef();
|
|
@@ -25,7 +25,7 @@ const CopyButton = ({ value, variant = "icon", label = "Copy", copiedLabel = "Co
|
|
|
25
25
|
timer.current = setTimeout(() => setCopied(false), feedbackDuration);
|
|
26
26
|
}
|
|
27
27
|
catch {
|
|
28
|
-
|
|
28
|
+
onCopyError === null || onCopyError === void 0 ? void 0 : onCopyError(value);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
// NOTE: primary[500] fails AA as canvas ink in 5/7 brands (dark) — accentTextOnCanvas steps to a clearing rung.
|
|
@@ -2,6 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
4
4
|
import { raisedRule } from "../../Theme/tokens/builders/surfaceRaised.js";
|
|
5
|
+
import { DialogNaming } from "../Modal/dialogNaming.js";
|
|
5
6
|
import { warnDroppedSlotChildren } from "../Modal/warnDroppedSlotChildren.js";
|
|
6
7
|
import { Drawer as ChakraDrawer, DrawerBody as ChakraDrawerBody, DrawerFooter as ChakraDrawerFooter, DrawerHeader as ChakraDrawerHeader, DrawerOverlay, DrawerContent, DrawerCloseButton, } from "@chakra-ui/react";
|
|
7
8
|
export const DrawerHeader = ({ children }) => {
|
|
@@ -29,12 +30,15 @@ const findSlot = (children, slot) => {
|
|
|
29
30
|
}
|
|
30
31
|
return undefined;
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
+
function DialogContent({ label, labelledBy, ...props }) {
|
|
34
|
+
return (_jsx(DialogNaming, { label: label, labelledBy: labelledBy, children: _jsx(DrawerContent, { ...props }) }));
|
|
35
|
+
}
|
|
36
|
+
export default function Drawer({ isOpen, onClose, placement = "right", size = "xl", id, variant, vaiant, initialFocusRef, finalFocusRef, closeOnOverlayClick, closeOnEsc, contentProps, hideCloseButton, portalChildren, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, }) {
|
|
33
37
|
var _a, _b;
|
|
34
38
|
const { colors } = useCustomTheme();
|
|
35
39
|
const headerSlot = findSlot(children, DrawerHeader);
|
|
36
40
|
const bodySlot = findSlot(children, DrawerBody);
|
|
37
41
|
const footerSlot = findSlot(children, DrawerFooter);
|
|
38
42
|
warnDroppedSlotChildren("Drawer", children, [DrawerHeader, DrawerBody, DrawerFooter]);
|
|
39
|
-
return (_jsxs(ChakraDrawer, { isOpen: isOpen, placement: placement, onClose: onClose, size: size, variant: (_a = variant !== null && variant !== void 0 ? variant : vaiant) !== null && _a !== void 0 ? _a : "solid", id: id, initialFocusRef: initialFocusRef, finalFocusRef: finalFocusRef, closeOnOverlayClick: closeOnOverlayClick, closeOnEsc: closeOnEsc, children: [_jsx(DrawerOverlay, {}), _jsxs(
|
|
43
|
+
return (_jsxs(ChakraDrawer, { isOpen: isOpen, placement: placement, onClose: onClose, size: size, variant: (_a = variant !== null && variant !== void 0 ? variant : vaiant) !== null && _a !== void 0 ? _a : "solid", id: id, initialFocusRef: initialFocusRef, finalFocusRef: finalFocusRef, closeOnOverlayClick: closeOnOverlayClick, closeOnEsc: closeOnEsc, children: [_jsx(DrawerOverlay, {}), _jsxs(DialogContent, { ...contentProps, label: ariaLabel, labelledBy: ariaLabelledBy, children: [!hideCloseButton && _jsx(DrawerCloseButton, {}), headerSlot && (_jsx(ChakraDrawerHeader, { borderBottomWidth: "1px", borderColor: raisedRule(colors), ...headerSlot.props, children: headerSlot })), _jsx(ChakraDrawerBody, { ...((_b = bodySlot === null || bodySlot === void 0 ? void 0 : bodySlot.props) !== null && _b !== void 0 ? _b : {}), children: bodySlot }), footerSlot && (_jsx(ChakraDrawerFooter, { borderTopWidth: "1px", borderColor: raisedRule(colors), ...footerSlot.props, children: footerSlot })), portalChildren] })] }));
|
|
40
44
|
}
|
|
@@ -12,7 +12,7 @@ const DEFAULT_LABELS = {
|
|
|
12
12
|
discard: "Discard",
|
|
13
13
|
keepEditing: "Keep editing",
|
|
14
14
|
};
|
|
15
|
-
export default function FormDrawer({ isOpen, onClose, title, description, sections, errors = [], isDirty, onSubmit, isSubmitting = false, submitLabel = "Save", cancelLabel = "Cancel", secondaryAction, size = "md", labels, "data-testid": testId = "form-drawer", }) {
|
|
15
|
+
export default function FormDrawer({ isOpen, onClose, title, description, sections, errors = [], isDirty, onSubmit, isSubmitting = false, isSubmitDisabled = false, submitLabel = "Save", cancelLabel = "Cancel", secondaryAction, size = "md", labels, "data-testid": testId = "form-drawer", }) {
|
|
16
16
|
const { colors } = useCustomTheme();
|
|
17
17
|
const uid = useId();
|
|
18
18
|
const formId = `${uid}-form`;
|
|
@@ -45,7 +45,7 @@ export default function FormDrawer({ isOpen, onClose, title, description, sectio
|
|
|
45
45
|
};
|
|
46
46
|
const submit = (event) => {
|
|
47
47
|
event.preventDefault();
|
|
48
|
-
if (isSubmitting)
|
|
48
|
+
if (isSubmitting || isSubmitDisabled)
|
|
49
49
|
return;
|
|
50
50
|
focusPending.current = true;
|
|
51
51
|
setAttempt((n) => n + 1);
|
|
@@ -54,5 +54,5 @@ export default function FormDrawer({ isOpen, onClose, title, description, sectio
|
|
|
54
54
|
return (_jsxs(Drawer, { isOpen: isOpen, onClose: requestClose, size: size, closeOnEsc: !isSubmitting, closeOnOverlayClick: !isSubmitting, portalChildren: _jsx(AlertDialog, { isOpen: confirmDiscard, onClose: () => setConfirmDiscard(false), leastDestructiveRef: keepEditingRef, isCentered: true, tone: "danger", title: text.discardTitle, content: _jsx(Text, { fontSize: "sm", color: colors.text[800], children: text.discardBody }), cancelButtonText: text.keepEditing, confirmButtonText: text.discard, onConfirm: () => {
|
|
55
55
|
setConfirmDiscard(false);
|
|
56
56
|
onClose();
|
|
57
|
-
} }), children: [_jsxs(DrawerHeader, { children: [_jsx(Heading, { id: titleId, as: "h2", fontSize: "md", fontWeight: 600, color: colors.header[900], children: title }), description ? (_jsx(Text, { mt: 0.5, fontSize: "sm", fontWeight: 400, color: colors.textMuted, children: description })) : null] }), _jsx(DrawerBody, { children: _jsx(Box, { as: "form", id: formId, "aria-labelledby": titleId, onSubmit: submit, noValidate: true, "data-testid": testId, children: _jsxs(Flex, { direction: "column", gap: 5, pt: 2, children: [errors.length ? (_jsxs(Alert, { ref: summaryRef, tabIndex: -1, status: "error", variant: "subtle", borderRadius: "md", alignItems: "flex-start", "data-testid": `${testId}-errors`, children: [_jsx(AlertIcon, {}), _jsxs(Box, { children: [_jsx(AlertTitle, { fontSize: "sm", children: text.fixErrors }), _jsx(AlertDescription, { fontSize: "sm", children: _jsx(UnorderedList, { mt: 1, children: errors.map((message) => (_jsx(ListItem, { children: message }, message))) }) })] })] })) : null, sections.map((section, index) => (_jsxs(Fragment, { children: [index > 0 ? _jsx(Divider, { borderColor: colors.boxborder[200] }) : null, _jsxs(Flex, { as: "section", direction: "column", gap: 4, "aria-label": section.title, children: [section.title ? (_jsxs(Box, { children: [_jsx(Heading, { as: "h3", fontSize: "sm", fontWeight: 600, color: colors.header[900], children: section.title }), section.description ? (_jsx(Text, { mt: 0.5, fontSize: "xs", color: colors.textMuted, children: section.description })) : null] })) : null, section.content] })] }, section.id)))] }) }) }), _jsx(DrawerFooter, { children: _jsxs(Flex, { gap: 2, w: "100%", justify: "flex-end", wrap: "wrap", children: [secondaryAction, _jsx(Button, { variant: "ghost", colorScheme: "gray", onClick: requestClose, isDisabled: isSubmitting, label: cancelLabel }), _jsx(Button, { variant: "solid", colorScheme: "primary", type: "submit", form: formId, isLoading: isSubmitting, loadingText: submitLabel, label: submitLabel, "data-testid": `${testId}-submit` })] }) })] }));
|
|
57
|
+
} }), children: [_jsxs(DrawerHeader, { children: [_jsx(Heading, { id: titleId, as: "h2", fontSize: "md", fontWeight: 600, color: colors.header[900], children: title }), description ? (_jsx(Text, { mt: 0.5, fontSize: "sm", fontWeight: 400, color: colors.textMuted, children: description })) : null] }), _jsx(DrawerBody, { children: _jsx(Box, { as: "form", id: formId, "aria-labelledby": titleId, onSubmit: submit, noValidate: true, "data-testid": testId, children: _jsxs(Flex, { direction: "column", gap: 5, pt: 2, children: [errors.length ? (_jsxs(Alert, { ref: summaryRef, tabIndex: -1, status: "error", variant: "subtle", borderRadius: "md", alignItems: "flex-start", "data-testid": `${testId}-errors`, children: [_jsx(AlertIcon, {}), _jsxs(Box, { children: [_jsx(AlertTitle, { fontSize: "sm", children: text.fixErrors }), _jsx(AlertDescription, { fontSize: "sm", children: _jsx(UnorderedList, { mt: 1, children: errors.map((message) => (_jsx(ListItem, { children: message }, message))) }) })] })] })) : null, sections.map((section, index) => (_jsxs(Fragment, { children: [index > 0 ? _jsx(Divider, { borderColor: colors.boxborder[200] }) : null, _jsxs(Flex, { as: "section", direction: "column", gap: 4, "aria-label": section.title, children: [section.title ? (_jsxs(Box, { children: [_jsx(Heading, { as: "h3", fontSize: "sm", fontWeight: 600, color: colors.header[900], children: section.title }), section.description ? (_jsx(Text, { mt: 0.5, fontSize: "xs", color: colors.textMuted, children: section.description })) : null] })) : null, section.content] })] }, section.id)))] }) }) }), _jsx(DrawerFooter, { children: _jsxs(Flex, { gap: 2, w: "100%", justify: "flex-end", wrap: "wrap", children: [secondaryAction, _jsx(Button, { variant: "ghost", colorScheme: "gray", onClick: requestClose, isDisabled: isSubmitting, label: cancelLabel }), _jsx(Button, { variant: "solid", colorScheme: "primary", type: "submit", form: formId, isLoading: isSubmitting, isDisabled: isSubmitDisabled, loadingText: submitLabel, label: submitLabel, "data-testid": `${testId}-submit` })] }) })] }));
|
|
58
58
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { ModalContextProvider, useModalContext } from "@chakra-ui/react";
|
|
4
|
+
// Chakra's getDialogProps always points aria-labelledby at the header, so override it at the source.
|
|
5
|
+
export function DialogNaming({ label, labelledBy, children }) {
|
|
6
|
+
const modal = useModalContext();
|
|
7
|
+
const value = useMemo(() => label || labelledBy
|
|
8
|
+
? {
|
|
9
|
+
...modal,
|
|
10
|
+
getDialogProps: ((...args) => ({
|
|
11
|
+
...modal.getDialogProps(...args),
|
|
12
|
+
...(label ? { "aria-label": label } : {}),
|
|
13
|
+
"aria-labelledby": labelledBy,
|
|
14
|
+
})),
|
|
15
|
+
}
|
|
16
|
+
: modal, [modal, label, labelledBy]);
|
|
17
|
+
return _jsx(ModalContextProvider, { value: value, children: children });
|
|
18
|
+
}
|
|
@@ -42,7 +42,7 @@ export function LauncherTabs({ tabs, selected, onSelect, idBase, label, onLeaveU
|
|
|
42
42
|
refs.current.set(tab.id, node);
|
|
43
43
|
else
|
|
44
44
|
refs.current.delete(tab.id);
|
|
45
|
-
}, "aria-selected": isSelected, "aria-controls": isSelected ? panelId(idBase) : undefined, tabIndex: isSelected ? 0 : -1, onClick: () => onSelect(tab.id), position: "relative", flex: { base: 1, md: "none" }, minW: { md: "112px" }, h: "46px", px: { base: "6px", md: "14px" }, whiteSpace: "nowrap", fontSize: "
|
|
45
|
+
}, "aria-selected": isSelected, "aria-controls": isSelected ? panelId(idBase) : undefined, tabIndex: isSelected ? 0 : -1, onClick: () => onSelect(tab.id), position: "relative", flex: { base: 1, md: "none" }, minW: { md: "112px" }, h: "46px", px: { base: "6px", md: "14px" }, whiteSpace: "nowrap", fontSize: "sm", fontWeight: isSelected ? 600 : 500, color: isSelected ? colors.accentText : colors.textMuted, transition: transitionFor(["color"]), _hover: {
|
|
46
46
|
color: isSelected ? colors.accentText : colors.text[900],
|
|
47
47
|
}, _after: {
|
|
48
48
|
content: '""',
|
|
@@ -53,6 +53,6 @@ export function LauncherTabs({ tabs, selected, onSelect, idBase, label, onLeaveU
|
|
|
53
53
|
h: "2px",
|
|
54
54
|
borderRadius: "2px 2px 0 0",
|
|
55
55
|
bg: isSelected ? colors.primary[500] : "transparent",
|
|
56
|
-
}, sx: { ...ring, borderRadius: "
|
|
56
|
+
}, sx: { ...ring, borderRadius: "lg" }, children: tab.label }, tab.id));
|
|
57
57
|
}) }));
|
|
58
58
|
}
|