pixelize-design-library 2.4.2-beta.58 → 2.4.2-beta.60
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 +149 -5
- package/COMPONENT-GOTCHAS.md +205 -18
- package/DESIGN-GUIDE.md +43 -9
- package/dist/Components/AppSwitcher/AppSwitcher.js +5 -1
- package/dist/Components/AppSwitcher/AppSwitcherProps.d.ts +2 -0
- package/dist/Components/AppSwitcher/AppSwitcherProps.js +7 -4
- package/dist/Components/AudioRecorder/AudioRecorder.d.ts +8 -0
- package/dist/Components/AudioRecorder/AudioRecorder.js +169 -0
- package/dist/Components/AudioRecorder/AudioRecorderProps.d.ts +20 -0
- package/dist/Components/AudioRecorder/AudioRecorderProps.js +2 -0
- package/dist/Components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/Components/Breadcrumbs/Breadcrumbs.js +33 -10
- package/dist/Components/Breadcrumbs/BreadcrumbsProps.d.ts +16 -2
- package/dist/Components/BulkSelectionBar/BulkSelectionBar.d.ts +3 -0
- package/dist/Components/BulkSelectionBar/BulkSelectionBar.js +43 -0
- package/dist/Components/BulkSelectionBar/BulkSelectionBarProps.d.ts +35 -0
- package/dist/Components/BulkSelectionBar/BulkSelectionBarProps.js +2 -0
- package/dist/Components/BulkSelectionBar/index.d.ts +2 -0
- package/dist/Components/BulkSelectionBar/index.js +8 -0
- package/dist/Components/CalendarGrid/CalendarGrid.d.ts +3 -0
- package/dist/Components/CalendarGrid/CalendarGrid.js +173 -0
- package/dist/Components/CalendarGrid/CalendarGridProps.d.ts +54 -0
- package/dist/Components/CalendarGrid/CalendarGridProps.js +2 -0
- package/dist/Components/CalendarGrid/calendarMath.d.ts +49 -0
- package/dist/Components/CalendarGrid/calendarMath.js +178 -0
- package/dist/Components/Card/Card.d.ts +3 -1
- package/dist/Components/Card/Card.js +12 -2
- package/dist/Components/Card/CardProps.d.ts +5 -1
- package/dist/Components/CircularProgress/CircularProgress.d.ts +4 -0
- package/dist/Components/CircularProgress/CircularProgress.js +39 -0
- package/dist/Components/CircularProgress/CircularProgressProps.d.ts +22 -0
- package/dist/Components/CircularProgress/CircularProgressProps.js +2 -0
- package/dist/Components/CircularProgress/arc.d.ts +12 -0
- package/dist/Components/CircularProgress/arc.js +16 -0
- package/dist/Components/Common/fieldStyles.d.ts +1 -0
- package/dist/Components/Common/fieldStyles.js +2 -1
- package/dist/Components/Drawer/Drawer.d.ts +1 -1
- package/dist/Components/Drawer/Drawer.js +4 -2
- package/dist/Components/Drawer/DrawerProps.d.ts +3 -1
- package/dist/Components/Editor/Editor.js +50 -2
- package/dist/Components/Editor/EditorFieldBar.d.ts +15 -0
- package/dist/Components/Editor/EditorFieldBar.js +19 -0
- package/dist/Components/Editor/EditorProps.d.ts +74 -1
- package/dist/Components/Editor/MakeDynamicDialog.d.ts +12 -0
- package/dist/Components/Editor/MakeDynamicDialog.js +59 -0
- package/dist/Components/Editor/editorLabels.d.ts +4 -0
- package/dist/Components/Editor/editorLabels.js +24 -0
- package/dist/Components/Editor/editorTokenStyles.d.ts +28 -0
- package/dist/Components/Editor/editorTokenStyles.js +30 -0
- package/dist/Components/Editor/editorTokens.d.ts +26 -0
- package/dist/Components/Editor/editorTokens.js +134 -0
- package/dist/Components/Editor/useEditorBridge.d.ts +40 -0
- package/dist/Components/Editor/useEditorBridge.js +141 -0
- package/dist/Components/EmptyState/EmptyState.js +2 -1
- package/dist/Components/EmptyState/EmptyStateProps.d.ts +2 -2
- package/dist/Components/FormDrawer/FormDrawer.d.ts +2 -0
- package/dist/Components/FormDrawer/FormDrawer.js +97 -0
- package/dist/Components/FormDrawer/FormDrawerProps.d.ts +55 -0
- package/dist/Components/FormDrawer/FormDrawerProps.js +2 -0
- package/dist/Components/Kbd/Kbd.d.ts +6 -0
- package/dist/Components/Kbd/Kbd.js +33 -0
- package/dist/Components/Kbd/KbdProps.d.ts +17 -0
- package/dist/Components/Kbd/KbdProps.js +2 -0
- package/dist/Components/LauncherTrigger/LauncherTrigger.d.ts +4 -0
- package/dist/Components/LauncherTrigger/LauncherTrigger.js +48 -0
- package/dist/Components/LauncherTrigger/LauncherTriggerProps.d.ts +18 -0
- package/dist/Components/LauncherTrigger/LauncherTriggerProps.js +2 -0
- package/dist/Components/Modal/Modal.d.ts +1 -1
- package/dist/Components/Modal/Modal.js +4 -2
- package/dist/Components/Modal/ModalProps.d.ts +3 -1
- package/dist/Components/Modal/warnDroppedSlotChildren.d.ts +2 -0
- package/dist/Components/Modal/warnDroppedSlotChildren.js +45 -0
- package/dist/Components/NavLauncher/NavLauncher.d.ts +3 -0
- package/dist/Components/NavLauncher/NavLauncher.js +452 -0
- package/dist/Components/NavLauncher/NavLauncherProps.d.ts +187 -0
- package/dist/Components/NavLauncher/NavLauncherProps.js +2 -0
- package/dist/Components/NavLauncher/NewTabLink.d.ts +3 -0
- package/dist/Components/NavLauncher/NewTabLink.js +14 -0
- package/dist/Components/NavLauncher/PinToggle.d.ts +3 -0
- package/dist/Components/NavLauncher/PinToggle.js +21 -0
- package/dist/Components/NavLauncher/launcherParts.d.ts +152 -0
- package/dist/Components/NavLauncher/launcherParts.js +212 -0
- package/dist/Components/NavLauncher/match.d.ts +53 -0
- package/dist/Components/NavLauncher/match.js +178 -0
- package/dist/Components/NavLauncher/revealStyles.d.ts +4 -0
- package/dist/Components/NavLauncher/revealStyles.js +19 -0
- package/dist/Components/NavigationBar/NavigationBar.d.ts +1 -1
- package/dist/Components/NavigationBar/NavigationBar.js +2 -2
- package/dist/Components/NavigationBar/NavigationBarProps.d.ts +2 -0
- package/dist/Components/PageHeader/PageHeader.d.ts +1 -1
- package/dist/Components/PageHeader/PageHeader.js +9 -2
- package/dist/Components/PageHeader/PageHeaderProps.d.ts +8 -0
- package/dist/Components/PdfViewer/PdfViewer.d.ts +21 -4
- package/dist/Components/PdfViewer/PdfViewer.js +124 -3
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +5 -0
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewerProps.d.ts +1 -1
- package/dist/Components/QueryState/QueryStateBoundary.d.ts +2 -2
- package/dist/Components/QueryState/QueryStateBoundary.js +9 -3
- package/dist/Components/QueryState/QueryStateProps.d.ts +19 -2
- package/dist/Components/Search/Search.js +2 -1
- package/dist/Components/SectionRail/SectionRail.d.ts +3 -0
- package/dist/Components/SectionRail/SectionRail.js +49 -0
- package/dist/Components/SectionRail/SectionRailProps.d.ts +23 -0
- package/dist/Components/SectionRail/SectionRailProps.js +2 -0
- package/dist/Components/SectionRail/index.d.ts +2 -0
- package/dist/Components/SectionRail/index.js +8 -0
- package/dist/Components/SegmentedControl/SegmentedControl.js +9 -14
- package/dist/Components/SegmentedControl/segmentedInk.d.ts +0 -2
- package/dist/Components/SegmentedControl/segmentedInk.js +1 -5
- package/dist/Components/SideBar/SecondaryBar.js +4 -3
- package/dist/Components/SideBar/SideBar.d.ts +1 -1
- package/dist/Components/SideBar/SideBar.js +30 -9
- package/dist/Components/SideBar/SideBarProps.d.ts +32 -0
- package/dist/Components/SideBar/components/MenuItemBox.d.ts +6 -0
- package/dist/Components/SideBar/components/MenuItemBox.js +8 -4
- package/dist/Components/SideBar/components/MenuPopoverContent.js +3 -2
- package/dist/Components/SideBar/components/OtherApps.js +2 -1
- package/dist/Components/SideBar/components/PinnedSection.d.ts +17 -0
- package/dist/Components/SideBar/components/PinnedSection.js +98 -0
- package/dist/Components/SideBar/sidebarFocus.d.ts +23 -0
- package/dist/Components/SideBar/sidebarFocus.js +20 -0
- package/dist/Components/StageProgress/StageProgress.js +2 -2
- package/dist/Components/StageProgress/StageProgressProps.d.ts +2 -0
- package/dist/Components/StageProgress/StepperStage.js +5 -2
- package/dist/Components/StatCard/StatCard.d.ts +1 -1
- package/dist/Components/StatCard/StatCard.js +6 -2
- package/dist/Components/StatCard/StatCardProps.d.ts +3 -0
- package/dist/Components/StatusTag/StatusTag.d.ts +4 -0
- package/dist/Components/StatusTag/StatusTag.js +24 -0
- package/dist/Components/StatusTag/StatusTagProps.d.ts +20 -0
- package/dist/Components/StatusTag/StatusTagProps.js +2 -0
- package/dist/Components/Table/Table.d.ts +1 -1
- package/dist/Components/Table/Table.js +6 -2
- package/dist/Components/Table/TableProps.d.ts +20 -0
- package/dist/Components/Table/components/TableBody.d.ts +1 -1
- package/dist/Components/Table/components/TableBody.js +43 -18
- package/dist/Components/Table/components/TableHeader.d.ts +1 -1
- package/dist/Components/Table/components/TableHeader.js +7 -5
- package/dist/Components/Table/components/rowDetail.d.ts +32 -0
- package/dist/Components/Table/components/rowDetail.js +20 -0
- package/dist/Components/Table/hooks/useRowExpansion.d.ts +7 -0
- package/dist/Components/Table/hooks/useRowExpansion.js +27 -0
- package/dist/Components/Tabs/Tabs.d.ts +1 -1
- package/dist/Components/Tabs/Tabs.js +15 -2
- package/dist/Components/Tabs/TabsProps.d.ts +6 -2
- package/dist/Components/Tabs/components/Tab.js +4 -33
- package/dist/Components/Tabs/components/TabLinkList.d.ts +7 -0
- package/dist/Components/Tabs/components/TabLinkList.js +34 -0
- package/dist/Components/Tabs/useTabAppearance.d.ts +17 -0
- package/dist/Components/Tabs/useTabAppearance.js +67 -0
- package/dist/Components/Tag/Tag.js +11 -1
- package/dist/Components/Tag/TagProps.d.ts +4 -0
- package/dist/Components/Tag/tagDot.d.ts +3 -0
- package/dist/Components/Tag/tagDot.js +21 -0
- package/dist/Components/WizardDialog/WizardDialog.d.ts +9 -0
- package/dist/Components/WizardDialog/WizardDialog.js +102 -0
- package/dist/Components/WizardDialog/WizardDialogProps.d.ts +48 -0
- package/dist/Components/WizardDialog/WizardDialogProps.js +2 -0
- package/dist/Components/WizardDialog/useWizardFlow.d.ts +22 -0
- package/dist/Components/WizardDialog/useWizardFlow.js +47 -0
- package/dist/Components/WizardDialog/wizardSteps.d.ts +31 -0
- package/dist/Components/WizardDialog/wizardSteps.js +40 -0
- package/dist/esm/Components/AppSwitcher/AppSwitcher.js +2 -1
- package/dist/esm/Components/AppSwitcher/AppSwitcherProps.js +5 -3
- package/dist/esm/Components/AudioRecorder/AudioRecorder.js +161 -0
- package/dist/esm/Components/AudioRecorder/AudioRecorderProps.js +1 -0
- package/dist/esm/Components/Breadcrumbs/Breadcrumbs.js +35 -12
- package/dist/esm/Components/BulkSelectionBar/BulkSelectionBar.js +38 -0
- package/dist/esm/Components/BulkSelectionBar/BulkSelectionBarProps.js +1 -0
- package/dist/esm/Components/BulkSelectionBar/index.js +1 -0
- package/dist/esm/Components/CalendarGrid/CalendarGrid.js +168 -0
- package/dist/esm/Components/CalendarGrid/CalendarGridProps.js +1 -0
- package/dist/esm/Components/CalendarGrid/calendarMath.js +155 -0
- package/dist/esm/Components/Card/Card.js +12 -2
- package/dist/esm/Components/CircularProgress/CircularProgress.js +37 -0
- package/dist/esm/Components/CircularProgress/CircularProgressProps.js +1 -0
- package/dist/esm/Components/CircularProgress/arc.js +11 -0
- package/dist/esm/Components/Common/fieldStyles.js +2 -1
- package/dist/esm/Components/Drawer/Drawer.js +4 -2
- package/dist/esm/Components/Editor/Editor.js +48 -3
- package/dist/esm/Components/Editor/EditorFieldBar.js +13 -0
- package/dist/esm/Components/Editor/MakeDynamicDialog.js +20 -0
- package/dist/esm/Components/Editor/editorLabels.js +20 -0
- package/dist/esm/Components/Editor/editorTokenStyles.js +25 -0
- package/dist/esm/Components/Editor/editorTokens.js +121 -0
- package/dist/esm/Components/Editor/useEditorBridge.js +138 -0
- package/dist/esm/Components/EmptyState/EmptyState.js +2 -1
- package/dist/esm/Components/FormDrawer/FormDrawer.js +58 -0
- package/dist/esm/Components/FormDrawer/FormDrawerProps.js +1 -0
- package/dist/esm/Components/Kbd/Kbd.js +28 -0
- package/dist/esm/Components/Kbd/KbdProps.js +1 -0
- package/dist/esm/Components/LauncherTrigger/LauncherTrigger.js +41 -0
- package/dist/esm/Components/LauncherTrigger/LauncherTriggerProps.js +1 -0
- package/dist/esm/Components/Modal/Modal.js +4 -2
- package/dist/esm/Components/Modal/warnDroppedSlotChildren.js +38 -0
- package/dist/esm/Components/NavLauncher/NavLauncher.js +413 -0
- package/dist/esm/Components/NavLauncher/NavLauncherProps.js +1 -0
- package/dist/esm/Components/NavLauncher/NewTabLink.js +11 -0
- package/dist/esm/Components/NavLauncher/PinToggle.js +18 -0
- package/dist/esm/Components/NavLauncher/launcherParts.js +187 -0
- package/dist/esm/Components/NavLauncher/match.js +172 -0
- package/dist/esm/Components/NavLauncher/revealStyles.js +15 -0
- package/dist/esm/Components/NavigationBar/NavigationBar.js +3 -3
- package/dist/esm/Components/PageHeader/PageHeader.js +9 -2
- package/dist/esm/Components/PdfViewer/PdfViewer.js +123 -2
- package/dist/esm/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +5 -0
- package/dist/esm/Components/QueryState/QueryStateBoundary.js +10 -4
- package/dist/esm/Components/Search/Search.js +3 -2
- package/dist/esm/Components/SectionRail/SectionRail.js +44 -0
- package/dist/esm/Components/SectionRail/SectionRailProps.js +1 -0
- package/dist/esm/Components/SectionRail/index.js +1 -0
- package/dist/esm/Components/SegmentedControl/SegmentedControl.js +11 -16
- package/dist/esm/Components/SegmentedControl/segmentedInk.js +0 -3
- package/dist/esm/Components/SideBar/SecondaryBar.js +4 -3
- package/dist/esm/Components/SideBar/SideBar.js +31 -10
- package/dist/esm/Components/SideBar/components/MenuItemBox.js +4 -2
- package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +3 -2
- package/dist/esm/Components/SideBar/components/OtherApps.js +2 -1
- package/dist/esm/Components/SideBar/components/PinnedSection.js +92 -0
- package/dist/esm/Components/SideBar/sidebarFocus.js +15 -0
- package/dist/esm/Components/StageProgress/StageProgress.js +2 -2
- package/dist/esm/Components/StageProgress/StepperStage.js +5 -2
- package/dist/esm/Components/StatCard/StatCard.js +6 -2
- package/dist/esm/Components/StatusTag/StatusTag.js +19 -0
- package/dist/esm/Components/StatusTag/StatusTagProps.js +1 -0
- package/dist/esm/Components/Table/Table.js +7 -3
- package/dist/esm/Components/Table/components/TableBody.js +43 -18
- package/dist/esm/Components/Table/components/TableHeader.js +7 -5
- package/dist/esm/Components/Table/components/rowDetail.js +14 -0
- package/dist/esm/Components/Table/hooks/useRowExpansion.js +23 -0
- package/dist/esm/Components/Tabs/Tabs.js +15 -2
- package/dist/esm/Components/Tabs/components/Tab.js +4 -33
- package/dist/esm/Components/Tabs/components/TabLinkList.js +29 -0
- package/dist/esm/Components/Tabs/useTabAppearance.js +63 -0
- package/dist/esm/Components/Tag/Tag.js +12 -2
- package/dist/esm/Components/Tag/tagDot.js +17 -0
- package/dist/esm/Components/WizardDialog/WizardDialog.js +58 -0
- package/dist/esm/Components/WizardDialog/WizardDialogProps.js +1 -0
- package/dist/esm/Components/WizardDialog/useWizardFlow.js +44 -0
- package/dist/esm/Components/WizardDialog/wizardSteps.js +35 -0
- package/dist/esm/index.js +14 -0
- package/dist/index.d.ts +35 -6
- package/dist/index.js +38 -4
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
4
|
const react_1 = require("@chakra-ui/react");
|
|
5
5
|
const useCustomTheme_1 = require("../../../Theme/useCustomTheme");
|
|
6
|
+
const sidebarFocus_1 = require("../sidebarFocus");
|
|
6
7
|
const OtherApps = ({ toggle, otherApps }) => {
|
|
7
8
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
8
9
|
if (!otherApps || otherApps.length === 0)
|
|
@@ -12,7 +13,7 @@ const OtherApps = ({ toggle, otherApps }) => {
|
|
|
12
13
|
return ((0, jsx_runtime_1.jsx)(react_1.Box, { display: "flex", alignItems: "center", justifyContent: "center", color: theme.colors.sidebar.mutedIcon, fontSize: "15px", flexShrink: 0, children: (_a = app.icon) !== null && _a !== void 0 ? _a : ((0, jsx_runtime_1.jsx)(react_1.Box, { w: "0.5rem", h: "0.5rem", borderRadius: "full", bg: app.color, boxShadow: `0 0 5px ${app.color}`, flexShrink: 0 })) }));
|
|
13
14
|
};
|
|
14
15
|
// Grid cell: icon on top, truncated label below (label hidden when collapsed).
|
|
15
|
-
const appCell = (app) => ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "button", type: "button", direction: "column", align: "center", justify: "center", gap: "3px", px: "2px", py: "6px", borderRadius: "lg", cursor: "pointer", border: "none", bg: "transparent", w: "100%", _hover: { backgroundColor: "whiteAlpha.200" }, transition: "background 0.12s", onClick: app.onClick, children: [appIcon(app), !toggle && ((0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "9.5px", color: theme.colors.sidebar.mutedLabel, textAlign: "center", maxW: "44px", isTruncated: true, children: app.name }))] }));
|
|
16
|
+
const appCell = (app) => ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "button", type: "button", direction: "column", align: "center", justify: "center", gap: "3px", px: "2px", py: "6px", borderRadius: "lg", cursor: "pointer", border: "none", bg: "transparent", w: "100%", _hover: { backgroundColor: "whiteAlpha.200" }, transition: "background 0.12s", sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors), onClick: app.onClick, children: [appIcon(app), !toggle && ((0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "9.5px", color: theme.colors.sidebar.mutedLabel, textAlign: "center", maxW: "44px", isTruncated: true, children: app.name }))] }));
|
|
16
17
|
const flyoutBody = (app) => {
|
|
17
18
|
var _a;
|
|
18
19
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { alignItems: "center", gap: 2, mb: 1, onClick: app.onClick, children: [(_a = app.icon) !== null && _a !== void 0 ? _a : ((0, jsx_runtime_1.jsx)(react_1.Box, { w: "0.5rem", h: "0.5rem", borderRadius: "full", bg: app.color, boxShadow: `0 0 5px ${app.color}`, flexShrink: 0 })), (0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "sm", fontWeight: 700, color: theme.colors.white, children: app.name })] }), app.description && ((0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "xs", color: theme.colors.sidebar.mutedLabel, children: app.description }))] }));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SidebarPinnedItem, SidebarPinnedLabels } from "../SideBarProps";
|
|
3
|
+
export declare const DEFAULT_PINNED_LABEL = "Pinned";
|
|
4
|
+
export declare const DEFAULT_PINNED_LIMIT = 5;
|
|
5
|
+
type PinnedSectionProps = {
|
|
6
|
+
items: SidebarPinnedItem[];
|
|
7
|
+
label?: string;
|
|
8
|
+
limit?: number;
|
|
9
|
+
toggle: boolean;
|
|
10
|
+
overlay: boolean;
|
|
11
|
+
activeId?: string | number | null;
|
|
12
|
+
labels?: SidebarPinnedLabels;
|
|
13
|
+
onItemClick: (item: SidebarPinnedItem) => void;
|
|
14
|
+
onUnpin?: (item: SidebarPinnedItem) => void;
|
|
15
|
+
};
|
|
16
|
+
declare const PinnedSection: React.FC<PinnedSectionProps>;
|
|
17
|
+
export default PinnedSection;
|
|
@@ -0,0 +1,98 @@
|
|
|
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.DEFAULT_PINNED_LIMIT = exports.DEFAULT_PINNED_LABEL = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const react_2 = require("@chakra-ui/react");
|
|
10
|
+
const lucide_react_1 = require("lucide-react");
|
|
11
|
+
const useCustomTheme_1 = require("../../../Theme/useCustomTheme");
|
|
12
|
+
const sidebarFocus_1 = require("../sidebarFocus");
|
|
13
|
+
const tone_1 = require("../../../Theme/tokens/builders/tone");
|
|
14
|
+
const sidebarAccent_1 = require("../../../Theme/tokens/builders/sidebarAccent");
|
|
15
|
+
const paletteFromTheme_1 = require("../../../Theme/chakra/paletteFromTheme");
|
|
16
|
+
const sidebarAccentColors_1 = require("../sidebarAccentColors");
|
|
17
|
+
const sidebarId_1 = require("../sidebarId");
|
|
18
|
+
const sidebarScale_1 = require("../sidebarScale");
|
|
19
|
+
const ToolTip_1 = __importDefault(require("../../ToolTip/ToolTip"));
|
|
20
|
+
const TextTruncation_1 = __importDefault(require("./TextTruncation"));
|
|
21
|
+
const MenuItemBox_1 = require("./MenuItemBox");
|
|
22
|
+
exports.DEFAULT_PINNED_LABEL = "Pinned";
|
|
23
|
+
exports.DEFAULT_PINNED_LIMIT = 5;
|
|
24
|
+
const DEFAULT_LABELS = {
|
|
25
|
+
showMore: "Show {count} more",
|
|
26
|
+
showLess: "Show less",
|
|
27
|
+
unpin: "Unpin {title}",
|
|
28
|
+
};
|
|
29
|
+
const UNPIN_SIZE = "24px";
|
|
30
|
+
const LADDER = { hover: "whiteAlpha.200", active: "whiteAlpha.300", activeHover: "whiteAlpha.400" };
|
|
31
|
+
const VISUALLY_HIDDEN = {
|
|
32
|
+
position: "absolute",
|
|
33
|
+
width: "1px",
|
|
34
|
+
height: "1px",
|
|
35
|
+
padding: 0,
|
|
36
|
+
margin: "-1px",
|
|
37
|
+
clip: "rect(0, 0, 0, 0)",
|
|
38
|
+
whiteSpace: "nowrap",
|
|
39
|
+
border: 0,
|
|
40
|
+
};
|
|
41
|
+
const readBadge = (badge) => {
|
|
42
|
+
var _a;
|
|
43
|
+
const cfg = typeof badge === "object" && badge !== null ? badge : null;
|
|
44
|
+
const value = (_a = cfg === null || cfg === void 0 ? void 0 : cfg.count) !== null && _a !== void 0 ? _a : (typeof badge !== "object" ? badge : undefined);
|
|
45
|
+
return { cfg, value };
|
|
46
|
+
};
|
|
47
|
+
const PinnedSection = ({ items, label = exports.DEFAULT_PINNED_LABEL, limit = exports.DEFAULT_PINNED_LIMIT, toggle, overlay, activeId, labels, onItemClick, onUnpin, }) => {
|
|
48
|
+
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
49
|
+
const activeAccent = (0, sidebarAccentColors_1.getSidebarActiveAccent)(theme.colors);
|
|
50
|
+
const text = { ...DEFAULT_LABELS, ...labels };
|
|
51
|
+
const headingId = `pinned-${(0, sidebarId_1.sanitizeId)((0, react_1.useId)())}`;
|
|
52
|
+
const cap = Math.max(1, limit);
|
|
53
|
+
const rowHeight = overlay ? sidebarScale_1.SIDEBAR_ROW.overlayHeight : sidebarScale_1.SIDEBAR_ROW.height;
|
|
54
|
+
const activeIndex = activeId == null ? -1 : items.findIndex((i) => String(i.id) === String(activeId));
|
|
55
|
+
const [showAll, setShowAll] = (0, react_1.useState)(activeIndex >= cap);
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
57
|
+
if (activeIndex >= cap)
|
|
58
|
+
setShowAll(true);
|
|
59
|
+
}, [activeIndex, cap]);
|
|
60
|
+
if (items.length === 0)
|
|
61
|
+
return null;
|
|
62
|
+
const hiddenCount = Math.max(0, items.length - cap);
|
|
63
|
+
const visible = showAll ? items : items.slice(0, cap);
|
|
64
|
+
const badgeSurface = (0, sidebarAccent_1.sidebarRowPeak)(theme.colors.sidebar.background[500]);
|
|
65
|
+
const unpinReplacesBadge = !!onUnpin && !overlay;
|
|
66
|
+
const renderBadge = (badge) => {
|
|
67
|
+
var _a, _b, _c;
|
|
68
|
+
const { cfg, value } = readBadge(badge);
|
|
69
|
+
if (value == null)
|
|
70
|
+
return null;
|
|
71
|
+
const tone = (0, tone_1.resolveSoftTone)(theme.colors, (0, paletteFromTheme_1.scaleFor)(theme.colors, (_a = cfg === null || cfg === void 0 ? void 0 : cfg.color) !== null && _a !== void 0 ? _a : "teal"), badgeSurface);
|
|
72
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Badge, { bg: tone.bg, color: tone.fg, fontSize: "xs", variant: (_b = cfg === null || cfg === void 0 ? void 0 : cfg.variant) !== null && _b !== void 0 ? _b : "subtle", borderRadius: (_c = cfg === null || cfg === void 0 ? void 0 : cfg.radius) !== null && _c !== void 0 ? _c : "full", ...(unpinReplacesBadge
|
|
73
|
+
? { _groupHover: { opacity: 0 }, _groupFocusWithin: { opacity: 0 } }
|
|
74
|
+
: {}), children: value }));
|
|
75
|
+
};
|
|
76
|
+
const renderRow = (item) => {
|
|
77
|
+
const isActive = activeIndex >= 0 && String(item.id) === String(activeId);
|
|
78
|
+
const anchor = ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "a", href: item.url, "data-group": "", "data-pinned-id": String(item.id), "aria-label": toggle ? item.title : undefined, "aria-current": isActive ? "page" : undefined, display: "flex", alignItems: "center", textAlign: "left", textDecoration: "none", w: "100%", h: rowHeight, borderRadius: "lg", pl: "10px", pr: !toggle && onUnpin ? `calc(10px + ${UNPIN_SIZE})` : "10px", fontWeight: "medium", borderLeft: "2px solid", borderLeftColor: isActive ? theme.colors.sidebar.activeIcon : "transparent", backgroundColor: isActive ? LADDER.active : "transparent", color: theme.colors.sidebar.mutedIcon, _hover: { backgroundColor: isActive ? LADDER.activeHover : LADDER.hover }, cursor: "pointer", transition: "background 0.12s", sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors), onClick: (e) => {
|
|
79
|
+
if (item.url && (0, MenuItemBox_1.isBrowserNavigationGesture)(e))
|
|
80
|
+
return;
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
onItemClick(item);
|
|
83
|
+
}, children: (0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: "9px", justify: toggle ? "center" : "space-between", w: "100%", children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: "9px", overflow: "hidden", flex: toggle ? undefined : 1, minW: 0, children: [(0, jsx_runtime_1.jsxs)(react_2.Box, { position: "relative", display: "flex", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: item.icon, fontSize: "md", color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), toggle && readBadge(item.badge).value != null && ((0, jsx_runtime_1.jsx)(react_2.Box, { position: "absolute", top: "0", right: "0", w: "0.375rem", h: "0.375rem", borderRadius: "full", bg: theme.colors.sidebar.semanticText.error }))] }), !toggle && ((0, jsx_runtime_1.jsx)(TextTruncation_1.default, { fontSize: sidebarScale_1.SIDEBAR_ROW.fontSize, lineHeight: "1", flex: "1", color: isActive ? activeAccent.label : theme.colors.white, fontWeight: isActive ? 600 : 500, _groupHover: isActive ? undefined : { color: theme.colors.white }, children: item.title }))] }), !toggle && renderBadge(item.badge)] }) }));
|
|
84
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Box, { as: "li", listStyleType: "none", position: "relative", "data-group": "", children: [toggle ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: item.title, placement: "right", children: anchor })) : (anchor), onUnpin && !toggle && ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "button", type: "button", "aria-label": text.unpin.replace("{title}", item.title), onClick: () => onUnpin(item), position: "absolute", top: "50%", right: "6px", transform: "translateY(-50%)", w: UNPIN_SIZE, h: UNPIN_SIZE, display: "flex", alignItems: "center", justifyContent: "center", borderRadius: "lg", border: "none", bg: "transparent", cursor: "pointer", color: theme.colors.sidebar.mutedIcon, opacity: overlay ? 1 : 0, _groupHover: { opacity: 1 }, _groupFocusWithin: { opacity: 1 }, _hover: {
|
|
85
|
+
bg: LADDER.active,
|
|
86
|
+
color: theme.colors.white,
|
|
87
|
+
}, transition: "opacity 0.12s, background 0.12s", sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors), children: (0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.PinOff, fontSize: "sm" }) }))] }, String(item.id)));
|
|
88
|
+
};
|
|
89
|
+
const disclosureLabel = showAll
|
|
90
|
+
? text.showLess
|
|
91
|
+
: text.showMore.replace("{count}", String(hiddenCount));
|
|
92
|
+
const disclosureButton = ((0, jsx_runtime_1.jsxs)(react_2.Box, { as: "button", type: "button", "aria-expanded": showAll, "aria-label": toggle ? disclosureLabel : undefined, onClick: () => setShowAll((v) => !v), display: "flex", alignItems: "center", justifyContent: toggle ? "center" : "flex-start", gap: "9px", w: "100%", h: rowHeight, px: "10px", borderRadius: "lg", border: "none", borderLeft: "2px solid transparent", bg: "transparent", cursor: "pointer", color: theme.colors.sidebar.mutedLabel, fontSize: sidebarScale_1.SIDEBAR_ROW.fontSize, fontWeight: "medium", _hover: {
|
|
93
|
+
backgroundColor: LADDER.hover,
|
|
94
|
+
color: theme.colors.white,
|
|
95
|
+
}, transition: "background 0.12s", sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors), children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: showAll ? lucide_react_1.ChevronUp : lucide_react_1.ChevronDown, fontSize: "md", flexShrink: 0 }), !toggle && (0, jsx_runtime_1.jsx)("span", { children: disclosureLabel })] }));
|
|
96
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Box, { mb: toggle ? "5px" : "3px", "data-testid": "sidebar-pinned", children: [(0, jsx_runtime_1.jsx)(react_2.Box, { id: headingId, as: "h2", px: "10px", pt: overlay ? "6px" : "10px", pb: "3px", fontSize: "9.5px", fontWeight: 600, textTransform: "uppercase", letterSpacing: "0.1em", color: theme.colors.sidebar.mutedLabel, whiteSpace: "nowrap", overflow: "hidden", sx: toggle ? VISUALLY_HIDDEN : undefined, children: label }), (0, jsx_runtime_1.jsxs)(react_2.Box, { as: "ul", "aria-labelledby": headingId, display: "flex", flexDirection: "column", gap: "2px", m: 0, p: 0, children: [visible.map(renderRow), hiddenCount > 0 && ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "li", listStyleType: "none", children: toggle ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: disclosureLabel, placement: "right", children: disclosureButton })) : (disclosureButton) }))] }), (0, jsx_runtime_1.jsx)(react_2.Box, { h: "1px", bg: theme.colors.sidebar.divider, mx: 2, mt: overlay ? "6px" : "8px", mb: overlay ? "3px" : "5px" })] }));
|
|
97
|
+
};
|
|
98
|
+
exports.default = PinnedSection;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PaletteProps } from "../../Theme/tokens/types";
|
|
2
|
+
type RailColors = Pick<PaletteProps, "focusRing" | "sidebar">;
|
|
3
|
+
/** The ring is derived for the canvas; the rail is near-black in both modes, so it is re-settled against the rail. */
|
|
4
|
+
export declare const sidebarFocusRing: (colors: RailColors, surface?: string) => {
|
|
5
|
+
focusRing: {
|
|
6
|
+
ring: string;
|
|
7
|
+
halo: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
/** `focusVisibleStyles` for a control sitting on the rail (or on `surface`, e.g. the flyout). */
|
|
11
|
+
export declare const sidebarFocusStyles: (colors: RailColors, surface?: string) => {
|
|
12
|
+
_focusVisible: {
|
|
13
|
+
outline: string;
|
|
14
|
+
outlineOffset: string;
|
|
15
|
+
boxShadow: string;
|
|
16
|
+
};
|
|
17
|
+
"&:hover:focus-visible, &:active:focus-visible, &[data-active]:focus-visible": {
|
|
18
|
+
outline: string;
|
|
19
|
+
outlineOffset: string;
|
|
20
|
+
boxShadow: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sidebarFocusStyles = exports.sidebarFocusRing = void 0;
|
|
4
|
+
const focusRing_styles_1 = require("../../Theme/chakra/focusRing.styles");
|
|
5
|
+
const outlineRung_1 = require("../../Theme/tokens/builders/outlineRung");
|
|
6
|
+
const cache = new Map();
|
|
7
|
+
/** The ring is derived for the canvas; the rail is near-black in both modes, so it is re-settled against the rail. */
|
|
8
|
+
const sidebarFocusRing = (colors, surface = colors.sidebar.background[500]) => {
|
|
9
|
+
const key = `${colors.focusRing.ring}|${surface}`;
|
|
10
|
+
let tokens = cache.get(key);
|
|
11
|
+
if (!tokens) {
|
|
12
|
+
tokens = { ring: (0, outlineRung_1.liftToContrast)(colors.focusRing.ring, surface, outlineRung_1.AA_NON_TEXT), halo: surface };
|
|
13
|
+
cache.set(key, tokens);
|
|
14
|
+
}
|
|
15
|
+
return { focusRing: tokens };
|
|
16
|
+
};
|
|
17
|
+
exports.sidebarFocusRing = sidebarFocusRing;
|
|
18
|
+
/** `focusVisibleStyles` for a control sitting on the rail (or on `surface`, e.g. the flyout). */
|
|
19
|
+
const sidebarFocusStyles = (colors, surface) => (0, focusRing_styles_1.focusVisibleStyles)((0, exports.sidebarFocusRing)(colors, surface));
|
|
20
|
+
exports.sidebarFocusStyles = sidebarFocusStyles;
|
|
@@ -32,12 +32,12 @@ const StageProgress = ({ stages, variant = "chevron", value, onChange, size = "m
|
|
|
32
32
|
return "upcoming";
|
|
33
33
|
};
|
|
34
34
|
const total = stages.length;
|
|
35
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Box, { display: "flex", alignItems: variant === "stepper" ? "flex-start" : "stretch", gap: gapFor[variant], overflowX: "auto", p: "0.1rem", sx: (0, scrollbar_1.scrollbarStyles)(theme.colors, "overlay"), children: stages.map((stage, index) => {
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Box, { as: variant === "stepper" ? "ol" : undefined, m: variant === "stepper" ? 0 : undefined, listStyleType: variant === "stepper" ? "none" : undefined, display: "flex", alignItems: variant === "stepper" ? "flex-start" : "stretch", gap: gapFor[variant], overflowX: "auto", p: "0.1rem", sx: (0, scrollbar_1.scrollbarStyles)(theme.colors, "overlay"), children: stages.map((stage, index) => {
|
|
36
36
|
var _a;
|
|
37
37
|
const state = stateFor(index);
|
|
38
38
|
const stageDisabled = (_a = stage.isDisabled) !== null && _a !== void 0 ? _a : stage.disabled;
|
|
39
39
|
if (variant === "stepper") {
|
|
40
|
-
return ((0, jsx_runtime_1.jsx)(StepperStage_1.default, { label: stage.label, number: index + 1, state: state, size: size, colorScheme: colorScheme, isReadOnly: isReadOnly, isDisabled: stageDisabled, showCheck: showCheck, isFirst: index === 0, isLast: index === total - 1, leftDone: activeIndex > -1 && index <= activeIndex, rightDone: activeIndex > -1 && index < activeIndex, scrollIntoViewWhenActive: scrollActiveIntoView, onClick: () => onChange === null || onChange === void 0 ? void 0 : onChange(stage.id, stage, index) }, stage.id));
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(StepperStage_1.default, { label: stage.label, number: index + 1, state: state, size: size, colorScheme: colorScheme, isReadOnly: isReadOnly, isDisabled: stageDisabled, showCheck: showCheck, isFirst: index === 0, isLast: index === total - 1, leftDone: activeIndex > -1 && index <= activeIndex, rightDone: activeIndex > -1 && index < activeIndex, scrollIntoViewWhenActive: scrollActiveIntoView, asListItem: true, onClick: () => onChange === null || onChange === void 0 ? void 0 : onChange(stage.id, stage, index) }, stage.id));
|
|
41
41
|
}
|
|
42
42
|
return ((0, jsx_runtime_1.jsx)(StageItem_1.default, { label: stage.label, index: index, total: total, state: state, variant: variant, size: size, colorScheme: colorScheme, isReadOnly: isReadOnly, isDisabled: stageDisabled, showCheck: showCheck, minWidth: minStageWidth, scrollIntoViewWhenActive: scrollActiveIntoView, tooltipThreshold: tooltipThreshold, onClick: () => onChange === null || onChange === void 0 ? void 0 : onChange(stage.id, stage, index) }, stage.id));
|
|
43
43
|
}) }));
|
|
@@ -110,6 +110,8 @@ export interface StepperStageProps {
|
|
|
110
110
|
rightDone: boolean;
|
|
111
111
|
/** Only scrolls when this node's own state is "active" — a no-op otherwise. */
|
|
112
112
|
scrollIntoViewWhenActive?: boolean;
|
|
113
|
+
/** Wraps the node in an `li` so a parent `ol` is a valid list; StageProgress sets it for variant="stepper". */
|
|
114
|
+
asListItem?: boolean;
|
|
113
115
|
}
|
|
114
116
|
/** Color set for one scheme's states, returned by resolveStagePalette (soft/strong/muted + text). */
|
|
115
117
|
export interface StagePalette {
|
|
@@ -13,7 +13,7 @@ const sizeMap = {
|
|
|
13
13
|
md: { circle: "30px", font: "0.8rem", label: "0.8rem", icon: 14, minW: "104px" },
|
|
14
14
|
lg: { circle: "38px", font: "0.95rem", label: "0.9rem", icon: 16, minW: "124px" },
|
|
15
15
|
};
|
|
16
|
-
const StepperStage = ({ label, number, state, size = "md", colorScheme = "primary", onClick, isReadOnly = false, isDisabled, disabled: legacyDisabled = false, showCheck = true, isFirst, isLast, leftDone, rightDone, scrollIntoViewWhenActive = true, }) => {
|
|
16
|
+
const StepperStage = ({ label, number, state, size = "md", colorScheme = "primary", onClick, isReadOnly = false, isDisabled, disabled: legacyDisabled = false, showCheck = true, isFirst, isLast, leftDone, rightDone, scrollIntoViewWhenActive = true, asListItem = false, }) => {
|
|
17
17
|
const disabled = isDisabled !== null && isDisabled !== void 0 ? isDisabled : legacyDisabled;
|
|
18
18
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
19
19
|
const palette = (0, StageProgressProps_1.resolveStagePalette)(theme, colorScheme);
|
|
@@ -35,10 +35,13 @@ const StepperStage = ({ label, number, state, size = "md", colorScheme = "primar
|
|
|
35
35
|
const circleColor = filled ? palette.onStrong : palette.mutedText;
|
|
36
36
|
const circleBorder = filled ? palette.strong : palette.muted;
|
|
37
37
|
const line = (done, hidden) => ((0, jsx_runtime_1.jsx)(react_2.Box, { flex: "1", height: "2px", bg: done ? palette.strong : palette.muted, visibility: hidden ? "hidden" : "visible", transition: "background 0.18s ease" }));
|
|
38
|
-
|
|
38
|
+
const node = ((0, jsx_runtime_1.jsxs)(react_2.Flex, { ref: ref, direction: "column", align: "center", flex: "1", minWidth: s.minW, flexShrink: 0, as: (interactive ? "button" : "div"), type: interactive ? "button" : undefined, "data-group": "", "aria-disabled": disabled ? true : undefined, border: "none", bg: "transparent", cursor: interactive ? "pointer" : "default", opacity: disabled ? 0.55 : 1, onClick: interactive ? onClick : undefined, borderRadius: "lg", sx: interactive ? (0, focusRing_styles_1.focusVisibleStyles)(theme.colors) : undefined, children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", width: "100%", children: [line(leftDone, isFirst), (0, jsx_runtime_1.jsx)(react_2.Flex, { align: "center", justify: "center", boxSize: s.circle, borderRadius: "full", flexShrink: 0, bg: circleBg, color: circleColor, border: "2px solid", borderColor: circleBorder, fontSize: s.font, fontWeight: 600, transition: (0, primitives_1.transitionFor)(["background-color", "border-color", "color", "box-shadow"]), "aria-current": state === "active" ? "step" : undefined, sx: state === "active"
|
|
39
39
|
? { boxShadow: `0 0 0 4px ${palette.soft}` }
|
|
40
40
|
: undefined, _groupHover: interactive
|
|
41
41
|
? { borderColor: palette.strong, bg: palette.strong, color: palette.onStrong }
|
|
42
42
|
: undefined, children: showCheck && state === "completed" ? (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { size: s.icon }) : number }), line(rightDone, isLast)] }), (0, jsx_runtime_1.jsx)(react_2.Text, { mt: 2, px: 1, borderRadius: "sm", fontSize: s.label, fontWeight: state === "active" ? 600 : 500, color: state === "upcoming" ? palette.mutedText : palette.softText, textAlign: "center", noOfLines: 2, transition: "background 0.18s ease, color 0.18s ease", _groupHover: interactive ? { bg: palette.strong, color: palette.onStrong } : undefined, children: label })] }));
|
|
43
|
+
if (!asListItem)
|
|
44
|
+
return node;
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "li", display: "flex", flex: "1", minWidth: s.minW, flexShrink: 0, listStyleType: "none", children: node }));
|
|
43
46
|
};
|
|
44
47
|
exports.default = StepperStage;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { StatCardProps } from "./StatCardProps";
|
|
2
2
|
/** KPI tile: tinted icon chip, label, 2xl tabular value, delta coloured by whether the change is good. */
|
|
3
|
-
declare const StatCard: ({ label, value, delta, trend, goodDirection, hint, sparkline, footer, icon: Icon, isLoading, onClick, "aria-label": ariaLabel, "data-testid": testId, }: StatCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const StatCard: ({ label, value, delta, trend, goodDirection, hint, sparkline, footer, icon: Icon, iconTone, isLoading, onClick, "aria-label": ariaLabel, "data-testid": testId, }: StatCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default StatCard;
|
|
@@ -7,13 +7,14 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
const react_1 = require("@chakra-ui/react");
|
|
8
8
|
const lucide_react_1 = require("lucide-react");
|
|
9
9
|
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
10
|
+
const tone_1 = require("../../Theme/tokens/builders/tone");
|
|
10
11
|
const motion_1 = require("../../Theme/tokens/primitives/motion");
|
|
11
12
|
const motion_2 = require("../../Theme/chakra/motion");
|
|
12
13
|
const focusRing_styles_1 = require("../../Theme/chakra/focusRing.styles");
|
|
13
14
|
const Skeletons_1 = __importDefault(require("../Skeletons/Skeletons"));
|
|
14
15
|
const StatCardSkeleton = ({ hasIcon }) => ((0, jsx_runtime_1.jsxs)(react_1.Flex, { direction: "column", gap: 3, children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: 2, children: [hasIcon && (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: 8, width: 8 }), (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: 3, width: "40%" })] }), (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: 7, width: "55%" }), (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: 3, width: "45%" })] }));
|
|
15
16
|
/** KPI tile: tinted icon chip, label, 2xl tabular value, delta coloured by whether the change is good. */
|
|
16
|
-
const StatCard = ({ label, value, delta, trend, goodDirection = "up", hint, sparkline, footer, icon: Icon, isLoading = false, onClick, "aria-label": ariaLabel, "data-testid": testId, }) => {
|
|
17
|
+
const StatCard = ({ label, value, delta, trend, goodDirection = "up", hint, sparkline, footer, icon: Icon, iconTone, isLoading = false, onClick, "aria-label": ariaLabel, "data-testid": testId, }) => {
|
|
17
18
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
18
19
|
const isInteractive = !!onClick && !isLoading;
|
|
19
20
|
const deltaColor = trend
|
|
@@ -22,6 +23,9 @@ const StatCard = ({ label, value, delta, trend, goodDirection = "up", hint, spar
|
|
|
22
23
|
: colors.semanticText.error
|
|
23
24
|
: colors.textMuted;
|
|
24
25
|
const DeltaIcon = trend === "down" ? lucide_react_1.ArrowDownRight : lucide_react_1.ArrowUpRight;
|
|
26
|
+
const chip = iconTone
|
|
27
|
+
? (0, tone_1.resolveSoftTone)(colors, (0, tone_1.toneScale)(colors, iconTone), colors.background[50])
|
|
28
|
+
: { bg: colors.primary.opacity[8], fg: colors.accentText };
|
|
25
29
|
const surface = {
|
|
26
30
|
display: "block",
|
|
27
31
|
w: "100%",
|
|
@@ -33,7 +37,7 @@ const StatCard = ({ label, value, delta, trend, goodDirection = "up", hint, spar
|
|
|
33
37
|
px: 5,
|
|
34
38
|
py: 4,
|
|
35
39
|
};
|
|
36
|
-
const content = isLoading ? ((0, jsx_runtime_1.jsx)(StatCardSkeleton, { hasIcon: !!Icon })) : ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", direction: "column", gap: 3, children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", align: "center", gap: 2, children: [Icon && ((0, jsx_runtime_1.jsx)(react_1.Flex, { as: "span", boxSize: 8, flexShrink: 0, align: "center", justify: "center", borderRadius: "lg", bg:
|
|
40
|
+
const content = isLoading ? ((0, jsx_runtime_1.jsx)(StatCardSkeleton, { hasIcon: !!Icon })) : ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", direction: "column", gap: 3, children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", align: "center", gap: 2, children: [Icon && ((0, jsx_runtime_1.jsx)(react_1.Flex, { as: "span", boxSize: 8, flexShrink: 0, align: "center", justify: "center", borderRadius: "lg", bg: chip.bg, color: chip.fg, "data-icon-tone": iconTone, children: (0, jsx_runtime_1.jsx)(Icon, { size: 16, "aria-hidden": true }) })), (0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", fontSize: "xs", fontWeight: 500, color: colors.textMuted, children: label })] }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", align: "center", justify: "space-between", gap: 3, children: [(0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", display: "block", fontSize: "2xl", fontWeight: 700, letterSpacing: "-0.02em", lineHeight: "short", color: colors.header[900], sx: { fontVariantNumeric: "tabular-nums" }, children: value }), sparkline && ((0, jsx_runtime_1.jsx)(react_1.Flex, { as: "span", align: "center", justify: "center", flexShrink: 0, h: 8, minW: 16, maxW: 24, overflow: "hidden", "data-testid": "stat-sparkline", children: sparkline }))] }), (delta !== undefined || hint) && ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", align: "center", gap: 1.5, wrap: "wrap", children: [delta !== undefined && ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", align: "center", gap: 0.5, color: deltaColor, "data-testid": "stat-delta", children: [trend && (0, jsx_runtime_1.jsx)(DeltaIcon, { size: 14, "aria-hidden": true }), trend && (0, jsx_runtime_1.jsx)(react_1.VisuallyHidden, { children: trend === "up" ? "Up" : "Down" }), (0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", fontSize: "xs", fontWeight: 600, sx: { fontVariantNumeric: "tabular-nums" }, children: delta })] })), hint && ((0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", fontSize: "xs", color: colors.textMuted, children: hint }))] })), footer && ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "span", pt: 3, borderTopWidth: "1px", borderColor: colors.boxborder[200], "data-testid": "stat-footer", children: footer }))] }));
|
|
37
41
|
if (!isInteractive) {
|
|
38
42
|
return ((0, jsx_runtime_1.jsx)(react_1.Box, { ...surface, "aria-busy": isLoading || undefined, "data-testid": testId, children: content }));
|
|
39
43
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ElementType, MouseEventHandler, ReactNode } from "react";
|
|
2
|
+
import type { Tone } from "../../Theme/tokens/builders/tone";
|
|
2
3
|
type StatTrend = "up" | "down";
|
|
3
4
|
/** KPI tile; delta is green when `trend` matches `goodDirection` (default "up"), else red. */
|
|
4
5
|
export interface StatCardProps {
|
|
@@ -19,6 +20,8 @@ export interface StatCardProps {
|
|
|
19
20
|
footer?: ReactNode;
|
|
20
21
|
/** Icon component (not an element) shown in a tinted chip before the label. */
|
|
21
22
|
icon?: ElementType;
|
|
23
|
+
/** Paints the icon chip with a soft status tone; unset keeps the brand-primary chip, "neutral" is grey. */
|
|
24
|
+
iconTone?: Tone;
|
|
22
25
|
/** Shows a skeleton and disables the click target. */
|
|
23
26
|
isLoading?: boolean;
|
|
24
27
|
/** Turns the tile into a full-size button with hover and focus styles. */
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StatusTagProps } from "./StatusTagProps";
|
|
2
|
+
/** Typed status-to-Tag wrapper: map your vocabulary to tones once, render chips or dots everywhere. */
|
|
3
|
+
declare function StatusTag<S extends string>({ status, label, map, display, size, "data-testid": testId, }: StatusTagProps<S>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default StatusTag;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const Tag_1 = __importDefault(require("../Tag/Tag"));
|
|
8
|
+
const NEUTRAL = { tone: "neutral" };
|
|
9
|
+
const warned = new Set();
|
|
10
|
+
const warnUnknown = (status) => {
|
|
11
|
+
if (process.env.NODE_ENV === "production" || warned.has(status))
|
|
12
|
+
return;
|
|
13
|
+
warned.add(status);
|
|
14
|
+
console.warn(`StatusTag: no appearance mapped for status "${status}"; rendering neutral.`);
|
|
15
|
+
};
|
|
16
|
+
/** Typed status-to-Tag wrapper: map your vocabulary to tones once, render chips or dots everywhere. */
|
|
17
|
+
function StatusTag({ status, label, map, display = "chip", size = "sm", "data-testid": testId, }) {
|
|
18
|
+
const known = Object.prototype.hasOwnProperty.call(map, status);
|
|
19
|
+
if (!known)
|
|
20
|
+
warnUnknown(status);
|
|
21
|
+
const { tone, variant } = known ? map[status] : NEUTRAL;
|
|
22
|
+
return (0, jsx_runtime_1.jsx)(Tag_1.default, { label: label, tone: tone, variant: variant, display: display, size: size, "data-testid": testId });
|
|
23
|
+
}
|
|
24
|
+
exports.default = StatusTag;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Tone } from "../../Theme/tokens/builders/tone";
|
|
2
|
+
import type { TagDisplay, TagVariant } from "../Tag/TagProps";
|
|
3
|
+
/** How one status looks: a tone, plus the chip variant (ignored in dot display). */
|
|
4
|
+
export type StatusAppearance = {
|
|
5
|
+
tone: Tone;
|
|
6
|
+
variant?: TagVariant;
|
|
7
|
+
};
|
|
8
|
+
/** Props for StatusTag; `S` is the app's status union so `map` must cover every status. */
|
|
9
|
+
export interface StatusTagProps<S extends string = string> {
|
|
10
|
+
/** The raw status value; one missing from `map` renders neutral and warns once in development. */
|
|
11
|
+
status: S;
|
|
12
|
+
/** Visible text; the app owns translation, StatusTag never derives it from `status`. */
|
|
13
|
+
label: string;
|
|
14
|
+
/** Status vocabulary to appearance, declared once per app. */
|
|
15
|
+
map: Record<S, StatusAppearance>;
|
|
16
|
+
/** "dot" gives a quiet dot plus label; default "chip". */
|
|
17
|
+
display?: TagDisplay;
|
|
18
|
+
size?: "sm" | "md";
|
|
19
|
+
"data-testid"?: string;
|
|
20
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TableProps } from "./TableProps";
|
|
2
2
|
/** Data table: virtualized-height rows, pagination, filters, selection, and an optional Monday-style grouped board. */
|
|
3
|
-
export default function Table({ data, columns, onSelection, isLoading, isCheckbox, freezedBgColor, freezedTextColor, noBorders, isPagination, onRowClick, selections, isActionFreeze, preferences, paginationMode, infiniteScroll, hasMore, isLoadingMore, groupLoadMore, loadMoreText, loadMorePosition, loadMoreChunkSize, noOfRowsPerPage, totalRecords, onPagination, isTableSettings, headerActions, onGlobalSearch, onNoOfRowsPerPageChange, paginationSelectOptions, tableMaxHeight, minVisibleRows, maxVisibleRows, autoFitViewport, tableSettings, filterSidebar, loadingSkeletonRows, defaultVisibleColumns, density, variant, stripe, groupColors, onAddItem, emptyState, onRefresh, isGlobalSearch, }: TableProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default function Table({ data, columns, onSelection, isLoading, isCheckbox, freezedBgColor, freezedTextColor, noBorders, isPagination, onRowClick, selections, isActionFreeze, preferences, paginationMode, infiniteScroll, hasMore, isLoadingMore, groupLoadMore, loadMoreText, loadMorePosition, loadMoreChunkSize, noOfRowsPerPage, totalRecords, onPagination, isTableSettings, headerActions, onGlobalSearch, onNoOfRowsPerPageChange, paginationSelectOptions, tableMaxHeight, minVisibleRows, maxVisibleRows, autoFitViewport, tableSettings, filterSidebar, loadingSkeletonRows, defaultVisibleColumns, density, variant, stripe, renderRowDetail, expandedRows, onExpandedRowsChange, groupColors, onAddItem, emptyState, onRefresh, isGlobalSearch, }: TableProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -25,6 +25,7 @@ const rowMetrics_1 = require("./components/rowMetrics");
|
|
|
25
25
|
const scrollbar_1 = require("../../Theme/tokens/builders/scrollbar");
|
|
26
26
|
const scrollShadow_1 = require("../../Theme/tokens/builders/scrollShadow");
|
|
27
27
|
const useTable_1 = __importDefault(require("./hooks/useTable"));
|
|
28
|
+
const useRowExpansion_1 = require("./hooks/useRowExpansion");
|
|
28
29
|
const columnLabel_1 = require("./columnLabel");
|
|
29
30
|
const table_1 = require("../../Utils/table");
|
|
30
31
|
const usePreferences_1 = require("../../Hooks/usePreferences");
|
|
@@ -45,12 +46,15 @@ function Table({ data, columns, onSelection, isLoading, isCheckbox = false, free
|
|
|
45
46
|
name: "",
|
|
46
47
|
page: "",
|
|
47
48
|
orgId: "",
|
|
48
|
-
}, paginationMode = "client", infiniteScroll = false, hasMore, isLoadingMore = false, groupLoadMore = false, loadMoreText = "Load more", loadMorePosition = "top", loadMoreChunkSize, noOfRowsPerPage = 50, totalRecords = 0, onPagination, isTableSettings = false, headerActions, onGlobalSearch, onNoOfRowsPerPageChange, paginationSelectOptions, tableMaxHeight, minVisibleRows, maxVisibleRows, autoFitViewport, tableSettings, filterSidebar, loadingSkeletonRows, defaultVisibleColumns, density = "normal", variant = "classic", stripe = false, groupColors, onAddItem, emptyState, onRefresh, isGlobalSearch = true, }) {
|
|
49
|
+
}, paginationMode = "client", infiniteScroll = false, hasMore, isLoadingMore = false, groupLoadMore = false, loadMoreText = "Load more", loadMorePosition = "top", loadMoreChunkSize, noOfRowsPerPage = 50, totalRecords = 0, onPagination, isTableSettings = false, headerActions, onGlobalSearch, onNoOfRowsPerPageChange, paginationSelectOptions, tableMaxHeight, minVisibleRows, maxVisibleRows, autoFitViewport, tableSettings, filterSidebar, loadingSkeletonRows, defaultVisibleColumns, density = "normal", variant = "classic", stripe = false, renderRowDetail, expandedRows, onExpandedRowsChange, groupColors, onAddItem, emptyState, onRefresh, isGlobalSearch = true, }) {
|
|
49
50
|
var _a, _b, _c, _d, _e;
|
|
50
51
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
51
52
|
const clearFiltersTone = (0, react_1.useMemo)(() => (0, filledSurface_1.resolveFilledSurface)(theme.colors.semantic.error, theme.colors), [theme.colors]);
|
|
52
53
|
const variantTokens = (0, react_1.useMemo)(() => variants_1.TABLE_VARIANTS[variant](theme.colors, (0, accentText_1.isDarkCanvas)(theme.colors.backgroundColor.main)), [variant, theme.colors]);
|
|
53
54
|
const [columnsSearch, setColumnsSearch] = (0, react_1.useState)({});
|
|
55
|
+
const detailIdPrefix = (0, react_1.useId)();
|
|
56
|
+
const { expandedIds, toggle: toggleDetail } = (0, useRowExpansion_1.useRowExpansion)(expandedRows, onExpandedRowsChange);
|
|
57
|
+
const rowDetail = (0, react_1.useMemo)(() => (renderRowDetail ? { render: renderRowDetail, toggle: toggleDetail, idPrefix: detailIdPrefix } : undefined), [renderRowDetail, toggleDetail, detailIdPrefix]);
|
|
54
58
|
const tableContainerRef = (0, react_1.useRef)(null);
|
|
55
59
|
const { isOpen: isFilterModalOpen, onOpen: onFilterModalOpen, onClose: onFilterModalClose } = (0, react_2.useDisclosure)();
|
|
56
60
|
// Below `md` the sidebar has no room — default to the modal, unless the consumer picked a mode.
|
|
@@ -448,5 +452,5 @@ function Table({ data, columns, onSelection, isLoading, isCheckbox = false, free
|
|
|
448
452
|
backgroundColor: "transparent",
|
|
449
453
|
zIndex: 999,
|
|
450
454
|
},
|
|
451
|
-
}, children: [(0, jsx_runtime_1.jsx)(react_3.Thead, { position: "sticky", top: 0, zIndex: 4, bg: variantTokens.header.bg, children: (0, jsx_runtime_1.jsx)(TableHeader_1.default, { columns: columnsList, isCheckbox: isCheckbox, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : theme.colors.text[500], handleSort: handleSort, headerRefs: headerRefs, columnWidths: columnWidths, slotRef: slotRef, slotWidth: slotWidth, columnsSort: columnsSort, noBorders: noBorders, handleCheckbox: handleCheckbox, isLoading: isTableLoading, checked: headerChecked, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, setColumnsSearch: setColumnsSearch, columnsSearch: columnsSearch, isSelecting: isSelecting }) }), (0, jsx_runtime_1.jsx)(react_3.Tbody, { children: (0, jsx_runtime_1.jsx)(TableBody_1.default, { data: isGrouped ? groupedSource : _filteredData, groups: renderGroups, onAddItem: onAddItem, columns: columnsList, startRow: isGrouped ? 0 : startRow, rowsPerPage: rowsPerPage, scrollContainerRef: tableContainerRef, isCheckbox: isCheckbox, columnWidths: columnWidths, slotWidth: slotWidth, noBorders: noBorders, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : theme.colors.text[500], handleCheckbox: handleCheckbox, selections: selection, isLoading: isTableLoading, loadingSkeletonRows: loadingSkeletonRows, onRowClick: onRowClick, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, density: densityState, stripe: stripe, emptyState: emptyState }) })] }), canInfinite && isLoadingMore && ((0, jsx_runtime_1.jsxs)(react_2.Flex, { justify: "center", align: "center", py: 3, gap: 2, children: [(0, jsx_runtime_1.jsx)(react_2.Spinner, { size: "sm", color: theme.colors.accentText }), (0, jsx_runtime_1.jsx)(react_2.Box, { fontSize: "0.75rem", color: theme.colors.text[500], children: "Loading more\u2026" })] }))] }), groupLoadMoreActive && loadMorePosition === "bottom" && (groupLoadMoreCaption || canGroupLoadMore) && ((0, jsx_runtime_1.jsxs)(react_2.Flex, { justify: "center", align: "center", gap: 3, py: 3, borderTop: `0.063rem solid ${theme.colors.boxborder[200]}`, children: [groupLoadMoreCaption && ((0, jsx_runtime_1.jsx)(react_2.Box, { fontSize: "0.75rem", color: theme.colors.text[500], children: groupLoadMoreCaption })), canGroupLoadMore && ((0, jsx_runtime_1.jsx)(Button_1.default, { size: "xs", variant: "outline", colorScheme: "gray", isLoading: isLoadingMore, loadingText: loadMoreText, onClick: handleGroupLoadMore, label: loadMoreText }))] }))] })] })] })] }));
|
|
455
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_3.Thead, { position: "sticky", top: 0, zIndex: 4, bg: variantTokens.header.bg, children: (0, jsx_runtime_1.jsx)(TableHeader_1.default, { columns: columnsList, isCheckbox: isCheckbox, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : theme.colors.text[500], handleSort: handleSort, headerRefs: headerRefs, columnWidths: columnWidths, slotRef: slotRef, slotWidth: slotWidth, columnsSort: columnsSort, noBorders: noBorders, handleCheckbox: handleCheckbox, isLoading: isTableLoading, checked: headerChecked, isContent: isContent, isLink: isLink, hasDetail: !!rowDetail, isActionFreeze: isActionFreeze, setColumnsSearch: setColumnsSearch, columnsSearch: columnsSearch, isSelecting: isSelecting }) }), (0, jsx_runtime_1.jsx)(react_3.Tbody, { children: (0, jsx_runtime_1.jsx)(TableBody_1.default, { data: isGrouped ? groupedSource : _filteredData, groups: renderGroups, onAddItem: onAddItem, columns: columnsList, startRow: isGrouped ? 0 : startRow, rowsPerPage: rowsPerPage, scrollContainerRef: tableContainerRef, isCheckbox: isCheckbox, columnWidths: columnWidths, slotWidth: slotWidth, noBorders: noBorders, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : theme.colors.text[500], handleCheckbox: handleCheckbox, selections: selection, isLoading: isTableLoading, loadingSkeletonRows: loadingSkeletonRows, onRowClick: onRowClick, isContent: isContent, isLink: isLink, rowDetail: rowDetail, expandedIds: expandedIds, isActionFreeze: isActionFreeze, density: densityState, stripe: stripe, emptyState: emptyState }) })] }), canInfinite && isLoadingMore && ((0, jsx_runtime_1.jsxs)(react_2.Flex, { justify: "center", align: "center", py: 3, gap: 2, children: [(0, jsx_runtime_1.jsx)(react_2.Spinner, { size: "sm", color: theme.colors.accentText }), (0, jsx_runtime_1.jsx)(react_2.Box, { fontSize: "0.75rem", color: theme.colors.text[500], children: "Loading more\u2026" })] }))] }), groupLoadMoreActive && loadMorePosition === "bottom" && (groupLoadMoreCaption || canGroupLoadMore) && ((0, jsx_runtime_1.jsxs)(react_2.Flex, { justify: "center", align: "center", gap: 3, py: 3, borderTop: `0.063rem solid ${theme.colors.boxborder[200]}`, children: [groupLoadMoreCaption && ((0, jsx_runtime_1.jsx)(react_2.Box, { fontSize: "0.75rem", color: theme.colors.text[500], children: groupLoadMoreCaption })), canGroupLoadMore && ((0, jsx_runtime_1.jsx)(Button_1.default, { size: "xs", variant: "outline", colorScheme: "gray", isLoading: isLoadingMore, loadingText: loadMoreText, onClick: handleGroupLoadMore, label: loadMoreText }))] }))] })] })] })] }));
|
|
452
456
|
}
|
|
@@ -28,6 +28,12 @@ export type TableProps = {
|
|
|
28
28
|
density?: TableDensity;
|
|
29
29
|
/** Visual preset. Defaults to `classic` — the table exactly as it shipped. */
|
|
30
30
|
variant?: TableVariant;
|
|
31
|
+
/** Content shown under a row when expanded; return null for rows with no detail and they get no chevron. Memoize it: an inline function re-renders every row. */
|
|
32
|
+
renderRowDetail?: (row: DataObject) => ReactNode | null;
|
|
33
|
+
/** Controlled expanded row ids; omit for uncontrolled. */
|
|
34
|
+
expandedRows?: (string | number)[];
|
|
35
|
+
/** Fires with the full expanded id list on every chevron toggle, controlled or not. */
|
|
36
|
+
onExpandedRowsChange?: (ids: (string | number)[]) => void;
|
|
31
37
|
/** Zebra rows: every second row gets the variant's `row.stripeBg` fill. Frozen and selected cells keep their own fill. */
|
|
32
38
|
stripe?: boolean;
|
|
33
39
|
/** Shown when there are no rows. An object feeds the library `EmptyState`; any other node renders as-is. */
|
|
@@ -207,6 +213,12 @@ export type ColumnSortingProps = {
|
|
|
207
213
|
column: string | number;
|
|
208
214
|
direction: "asc" | "desc" | "none";
|
|
209
215
|
};
|
|
216
|
+
/** Internal wiring for the row-detail expander, built once by `Table`. */
|
|
217
|
+
export type TableRowDetail = {
|
|
218
|
+
render: (row: DataObject) => ReactNode | null;
|
|
219
|
+
toggle: (id: string | number) => void;
|
|
220
|
+
idPrefix: string;
|
|
221
|
+
};
|
|
210
222
|
/** Props for the TableHeader row subcomponent: all columns, sorting, search, freeze, selection. */
|
|
211
223
|
export type TableHeaderPageProps = Pick<TableProps, "columns" | "isCheckbox" | "freezedTextColor" | "noBorders" | "isLoading" | "isActionFreeze"> & {
|
|
212
224
|
handleSort: (label: string | number, type: "asc" | "desc" | "none") => void;
|
|
@@ -225,6 +237,8 @@ export type TableHeaderPageProps = Pick<TableProps, "columns" | "isCheckbox" | "
|
|
|
225
237
|
checked: boolean | "indeterminate";
|
|
226
238
|
isContent: boolean;
|
|
227
239
|
isLink: boolean;
|
|
240
|
+
/** Adds the empty chevron column header after the checkbox. */
|
|
241
|
+
hasDetail?: boolean;
|
|
228
242
|
setColumnsSearch: React.Dispatch<React.SetStateAction<Record<string, string>>>;
|
|
229
243
|
columnsSearch: Record<string, string>;
|
|
230
244
|
isSelecting?: boolean;
|
|
@@ -241,6 +255,10 @@ export type TableBodyPageProps = Pick<TableProps, "columns" | "isCheckbox" | "da
|
|
|
241
255
|
selections: (string | number)[];
|
|
242
256
|
isContent: boolean;
|
|
243
257
|
isLink: boolean;
|
|
258
|
+
/** Row-detail expander wiring; omitted when `renderRowDetail` is not used. */
|
|
259
|
+
rowDetail?: TableRowDetail;
|
|
260
|
+
/** Ids of the rows whose detail is open. */
|
|
261
|
+
expandedIds?: Set<string | number>;
|
|
244
262
|
scrollContainerRef?: MutableRefObject<HTMLDivElement | null>;
|
|
245
263
|
/** Optional per-row id → accent color (Monday group stripe). */
|
|
246
264
|
accentColors?: Record<string | number, string>;
|
|
@@ -273,6 +291,8 @@ export type ColumnHeaderProps = Pick<TableProps, "isCheckbox" | "noBorders"> & P
|
|
|
273
291
|
index: number;
|
|
274
292
|
columnWidths: number[];
|
|
275
293
|
slotWidth: number;
|
|
294
|
+
/** Width of the detail chevron column to the left of frozen columns; 0 when absent. */
|
|
295
|
+
detailWidth?: number;
|
|
276
296
|
headerRefs: MutableRefObject<(HTMLTableCellElement | null)[]>;
|
|
277
297
|
columnsSearch: Record<string, string>;
|
|
278
298
|
setColumnsSearch: Dispatch<SetStateAction<Record<string, string>>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { TableBodyPageProps } from "../TableProps";
|
|
2
2
|
export declare const findFirstVisibleIndex: (offsets: number[], total: number, target: number) => number;
|
|
3
|
-
declare const TableBody: ({ data, isCheckbox, columns, startRow, rowsPerPage, columnWidths, slotWidth, freezedBgColor, freezedTextColor, noBorders, handleCheckbox, selections, isLoading, onRowClick, isContent, isLink, isActionFreeze, loadingSkeletonRows, scrollContainerRef, density, stripe, accentColors, groups, onAddItem, emptyState, }: TableBodyPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const TableBody: ({ data, isCheckbox, columns, startRow, rowsPerPage, columnWidths, slotWidth, freezedBgColor, freezedTextColor, noBorders, handleCheckbox, selections, isLoading, onRowClick, isContent, isLink, isActionFreeze, loadingSkeletonRows, scrollContainerRef, density, stripe, accentColors, groups, onAddItem, emptyState, rowDetail, expandedIds, }: TableBodyPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default TableBody;
|