pixelize-design-library 2.4.2-beta.2 → 2.4.2-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Components/Accordion/Accordion.js +2 -2
- package/dist/Components/Button/Button.d.ts +2 -2
- package/dist/Components/Button/Button.js +3 -3
- package/dist/Components/Button/Button.styles.js +4 -3
- package/dist/Components/Button/ButtonProps.d.ts +6 -1
- package/dist/Components/ButtonGroupIcon/ButtonGroupIcon.js +6 -6
- package/dist/Components/Card/Card.d.ts +1 -1
- package/dist/Components/Card/Card.js +2 -2
- package/dist/Components/Card/CardProps.d.ts +0 -1
- package/dist/Components/Checkbox/Checkbox.js +1 -1
- package/dist/Components/Checkbox/Checkbox.styles.js +2 -0
- package/dist/Components/Common/fieldStyles.js +1 -1
- package/dist/Components/CopyButton/CopyButton.js +1 -1
- package/dist/Components/CustomModulesTable/EditModuleModal.js +1 -1
- package/dist/Components/DatePicker/CalendarPanel.js +1 -1
- package/dist/Components/DatePicker/RangeDatePicker.js +2 -2
- package/dist/Components/DatePicker/SingleDatePicker.js +2 -2
- package/dist/Components/DatePicker/TimeOnlyPicker.js +1 -1
- package/dist/Components/Dropdown/DropDown.js +3 -13
- package/dist/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtp.js +1 -1
- package/dist/Components/FilePreview/FilePreview.js +1 -1
- package/dist/Components/FileUpload/FileUpload.js +3 -2
- package/dist/Components/FileUpload/FileUploadProps.d.ts +2 -1
- package/dist/Components/FileUpload/constants.js +1 -0
- package/dist/Components/FilterSidebar/FilterSidebar.js +4 -4
- package/dist/Components/Form/FormWrapper.js +1 -1
- package/dist/Components/Input/TextInput.styles.js +6 -4
- package/dist/Components/InputTextArea/InputTextArea.style.js +5 -4
- package/dist/Components/KanbanBoard/KanbanBoard.js +5 -45
- package/dist/Components/LimitReachedModal/LimitReachedModal.js +4 -5
- package/dist/Components/MultiSelect/MultiSelect.js +1 -1
- package/dist/Components/NavigationBar/NavigationBar.js +3 -3
- package/dist/Components/NoteTextArea/NoteTextArea.js +5 -3
- package/dist/Components/NumberInput/NumberInput.styles.js +5 -4
- package/dist/Components/OrgSwitcher/OrgSwitcher.js +2 -2
- package/dist/Components/PinInput/PinInput.js +1 -1
- package/dist/Components/PlanPill/PlanPill.js +5 -5
- package/dist/Components/PlanPill/planPillGradient.d.ts +2 -14
- package/dist/Components/PlanPill/planPillGradient.js +3 -15
- package/dist/Components/Primitives/Primitives.d.ts +6 -0
- package/dist/Components/Primitives/Primitives.js +113 -0
- package/dist/Components/ProductCard/ProductPrice.js +1 -1
- package/dist/Components/ProfileCard/ProfileCard.js +1 -1
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +1 -1
- package/dist/Components/RadioButton/RadioButton.js +1 -1
- package/dist/Components/Reorder/Reorder.js +1 -1
- package/dist/Components/ScrollbarBox/ScrollbarBox.d.ts +13 -0
- package/dist/Components/ScrollbarBox/ScrollbarBox.js +11 -0
- package/dist/Components/SearchSelect/SearchSelect.js +5 -4
- package/dist/Components/Select/Select.styles.js +3 -2
- package/dist/Components/SelectSearch/SelectSearch.js +3 -3
- package/dist/Components/SelectV2/SelectV2.js +5 -11
- package/dist/Components/SideBar/SecondaryBar.js +1 -1
- package/dist/Components/StageProgress/StageProgress.js +2 -9
- package/dist/Components/Table/Table.d.ts +1 -1
- package/dist/Components/Table/Table.js +17 -24
- package/dist/Components/Table/TableProps.d.ts +4 -0
- package/dist/Components/Table/components/TableActions.js +2 -2
- package/dist/Components/Table/components/TableBody.js +41 -12
- package/dist/Components/Table/components/TableGroupRow.js +1 -1
- package/dist/Components/Table/components/TableHeader.js +21 -8
- package/dist/Components/Table/components/TableSearch.js +1 -1
- package/dist/Components/Table/filters/ActiveFilters.js +2 -18
- package/dist/Components/Table/settings/ManageColumns.js +3 -17
- package/dist/Components/Table/settings/TableSettings.js +5 -11
- package/dist/Components/Table/variants/TableVariantContext.d.ts +4 -0
- package/dist/Components/Table/variants/TableVariantContext.js +17 -0
- package/dist/Components/Table/variants/classic.d.ts +6 -0
- package/dist/Components/Table/variants/classic.js +47 -0
- package/dist/Components/Table/variants/index.d.ts +7 -0
- package/dist/Components/Table/variants/index.js +27 -0
- package/dist/Components/Table/variants/pillInk.d.ts +6 -0
- package/dist/Components/Table/variants/pillInk.js +21 -0
- package/dist/Components/Table/variants/studio.d.ts +6 -0
- package/dist/Components/Table/variants/studio.js +50 -0
- package/dist/Components/Table/variants/tokens.d.ts +49 -0
- package/dist/Components/Table/variants/tokens.js +2 -0
- package/dist/Components/Timeline/Timeline.js +2 -2
- package/dist/Components/Toaster/Toaster.js +1 -1
- package/dist/Components/Trail/TrailWorks.js +1 -1
- package/dist/Components/UpgradeButton/UpgradeButton.js +3 -3
- package/dist/Constants/Sidebar.js +3 -2
- package/dist/Theme/chakra/Menu.styles.d.ts +9 -6
- package/dist/Theme/chakra/Menu.styles.js +11 -5
- package/dist/Theme/chakra/Popover.styles.d.ts +6 -3
- package/dist/Theme/chakra/Popover.styles.js +11 -6
- package/dist/Theme/chakra/Switch.styles.d.ts +1 -1
- package/dist/Theme/chakra/Switch.styles.js +7 -9
- package/dist/Theme/chakra/componentStyles.d.ts +15 -9
- package/dist/Theme/chakra/createBrandTheme.js +3 -16
- package/dist/Theme/provider/PixelizeThemeProvider.js +18 -20
- package/dist/Theme/provider/ThemeSwitcher.js +13 -20
- package/dist/Theme/tokens/brands/lavender/palette.light.js +2 -6
- package/dist/Theme/tokens/brands/slate/palette.light.js +1 -5
- package/dist/Theme/tokens/builders/chartColorsFromTheme.js +1 -1
- package/dist/Theme/tokens/builders/gradientInk.d.ts +22 -0
- package/dist/Theme/tokens/builders/gradientInk.js +28 -0
- package/dist/Theme/tokens/builders/index.d.ts +3 -0
- package/dist/Theme/tokens/builders/index.js +3 -0
- package/dist/Theme/tokens/builders/outlineRung.d.ts +32 -3
- package/dist/Theme/tokens/builders/outlineRung.js +74 -5
- package/dist/Theme/tokens/builders/placeholderInk.d.ts +19 -0
- package/dist/Theme/tokens/builders/placeholderInk.js +35 -0
- package/dist/Theme/tokens/builders/resolvedRungs.d.ts +5 -1
- package/dist/Theme/tokens/builders/resolvedRungs.js +7 -2
- package/dist/Theme/tokens/builders/scrollbar.d.ts +12 -0
- package/dist/Theme/tokens/builders/scrollbar.js +57 -0
- package/dist/Theme/tokens/builders/surfaceRungs.d.ts +5 -0
- package/dist/Theme/tokens/builders/surfaceRungs.js +20 -5
- package/dist/esm/Components/Accordion/Accordion.js +2 -2
- package/dist/esm/Components/Button/Button.js +4 -4
- package/dist/esm/Components/Button/Button.styles.js +5 -4
- package/dist/esm/Components/ButtonGroupIcon/ButtonGroupIcon.js +6 -6
- package/dist/esm/Components/Card/Card.js +2 -2
- package/dist/esm/Components/Checkbox/Checkbox.js +1 -1
- package/dist/esm/Components/Checkbox/Checkbox.styles.js +2 -0
- package/dist/esm/Components/Common/fieldStyles.js +1 -1
- package/dist/esm/Components/CopyButton/CopyButton.js +1 -1
- package/dist/esm/Components/CustomModulesTable/EditModuleModal.js +1 -1
- package/dist/esm/Components/DatePicker/CalendarPanel.js +1 -1
- package/dist/esm/Components/DatePicker/RangeDatePicker.js +2 -2
- package/dist/esm/Components/DatePicker/SingleDatePicker.js +2 -2
- package/dist/esm/Components/DatePicker/TimeOnlyPicker.js +1 -1
- package/dist/esm/Components/Dropdown/DropDown.js +3 -13
- package/dist/esm/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtp.js +1 -1
- package/dist/esm/Components/FilePreview/FilePreview.js +1 -1
- package/dist/esm/Components/FileUpload/FileUpload.js +4 -3
- package/dist/esm/Components/FileUpload/constants.js +1 -0
- package/dist/esm/Components/FilterSidebar/FilterSidebar.js +4 -4
- package/dist/esm/Components/Form/FormWrapper.js +1 -1
- package/dist/esm/Components/Input/TextInput.styles.js +6 -4
- package/dist/esm/Components/InputTextArea/InputTextArea.style.js +5 -4
- package/dist/esm/Components/KanbanBoard/KanbanBoard.js +5 -45
- package/dist/esm/Components/LimitReachedModal/LimitReachedModal.js +4 -5
- package/dist/esm/Components/MultiSelect/MultiSelect.js +1 -1
- package/dist/esm/Components/NavigationBar/NavigationBar.js +3 -3
- package/dist/esm/Components/NoteTextArea/NoteTextArea.js +5 -3
- package/dist/esm/Components/NumberInput/NumberInput.styles.js +5 -4
- package/dist/esm/Components/OrgSwitcher/OrgSwitcher.js +2 -2
- package/dist/esm/Components/PinInput/PinInput.js +1 -1
- package/dist/esm/Components/PlanPill/PlanPill.js +6 -6
- package/dist/esm/Components/PlanPill/planPillGradient.js +3 -15
- package/dist/esm/Components/Primitives/Primitives.js +6 -0
- package/dist/esm/Components/ProductCard/ProductPrice.js +1 -1
- package/dist/esm/Components/ProfileCard/ProfileCard.js +1 -1
- package/dist/esm/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +1 -1
- package/dist/esm/Components/RadioButton/RadioButton.js +1 -1
- package/dist/esm/Components/Reorder/Reorder.js +1 -1
- package/dist/esm/Components/ScrollbarBox/ScrollbarBox.js +9 -0
- package/dist/esm/Components/SearchSelect/SearchSelect.js +5 -4
- package/dist/esm/Components/Select/Select.styles.js +3 -2
- package/dist/esm/Components/SelectSearch/SelectSearch.js +3 -3
- package/dist/esm/Components/SelectV2/SelectV2.js +5 -11
- package/dist/esm/Components/SideBar/SecondaryBar.js +1 -1
- package/dist/esm/Components/StageProgress/StageProgress.js +2 -9
- package/dist/esm/Components/Table/Table.js +17 -24
- package/dist/esm/Components/Table/components/TableActions.js +2 -2
- package/dist/esm/Components/Table/components/TableBody.js +42 -13
- package/dist/esm/Components/Table/components/TableGroupRow.js +1 -1
- package/dist/esm/Components/Table/components/TableHeader.js +21 -8
- package/dist/esm/Components/Table/components/TableSearch.js +1 -1
- package/dist/esm/Components/Table/filters/ActiveFilters.js +2 -18
- package/dist/esm/Components/Table/settings/ManageColumns.js +3 -17
- package/dist/esm/Components/Table/settings/TableSettings.js +5 -11
- package/dist/esm/Components/Table/variants/TableVariantContext.js +13 -0
- package/dist/esm/Components/Table/variants/classic.js +43 -0
- package/dist/esm/Components/Table/variants/index.js +9 -0
- package/dist/esm/Components/Table/variants/pillInk.js +18 -0
- package/dist/esm/Components/Table/variants/studio.js +46 -0
- package/dist/esm/Components/Table/variants/tokens.js +1 -0
- package/dist/esm/Components/Timeline/Timeline.js +2 -2
- package/dist/esm/Components/Toaster/Toaster.js +1 -1
- package/dist/esm/Components/Trail/TrailWorks.js +1 -1
- package/dist/esm/Components/UpgradeButton/UpgradeButton.js +3 -3
- package/dist/esm/Constants/Sidebar.js +3 -2
- package/dist/esm/Theme/chakra/Menu.styles.js +11 -5
- package/dist/esm/Theme/chakra/Popover.styles.js +11 -6
- package/dist/esm/Theme/chakra/Switch.styles.js +7 -9
- package/dist/esm/Theme/chakra/createBrandTheme.js +3 -16
- package/dist/esm/Theme/provider/PixelizeThemeProvider.js +18 -20
- package/dist/esm/Theme/provider/ThemeSwitcher.js +13 -20
- package/dist/esm/Theme/tokens/brands/lavender/palette.light.js +2 -6
- package/dist/esm/Theme/tokens/brands/slate/palette.light.js +1 -5
- package/dist/esm/Theme/tokens/builders/chartColorsFromTheme.js +1 -1
- package/dist/esm/Theme/tokens/builders/gradientInk.js +22 -0
- package/dist/esm/Theme/tokens/builders/index.js +3 -0
- package/dist/esm/Theme/tokens/builders/outlineRung.js +70 -4
- package/dist/esm/Theme/tokens/builders/placeholderInk.js +29 -0
- package/dist/esm/Theme/tokens/builders/resolvedRungs.js +7 -2
- package/dist/esm/Theme/tokens/builders/scrollbar.js +52 -0
- package/dist/esm/Theme/tokens/builders/surfaceRungs.js +20 -5
- package/dist/esm/index.js +6 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.js +21 -3
- package/package.json +4 -2
|
@@ -15,7 +15,7 @@ const ReorderList = ({ label = "", items, onReorder, showRemoveIcon = false, onR
|
|
|
15
15
|
};
|
|
16
16
|
return (_jsxs(Box, { borderWidth: "0.063rem", borderRadius: "md", px: 3, py: 2, bg: colors.background[50], children: [_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, children: [_jsx(BetweenHorizonalStart, {}), _jsx(Text, { fontFamily: "open-sans, sans-serif", fontWeight: 600, fontSize: 14, lineHeight: "100%", letterSpacing: "4%", textTransform: "uppercase", py: 4, children: label })] }), _jsx(Divider, {}), _jsx("br", {}), _jsx(DragDropContext, { onDragEnd: handleDragEnd, children: _jsx(Droppable, { droppableId: "item-list", direction: "horizontal", children: (provided) => (_jsxs(HStack, { ref: provided.innerRef, ...provided.droppableProps, spacing: 4, overflowX: "auto", children: [items.map((item, index) => (_jsx(Draggable, { draggableId: item.id, index: index, children: (provided) => {
|
|
17
17
|
var _a;
|
|
18
|
-
return (_jsxs(Box, { ref: provided.innerRef, ...provided.draggableProps, ...provided.dragHandleProps, position: "relative", border: "0.063rem solid", borderColor: colors.boxborder[
|
|
18
|
+
return (_jsxs(Box, { ref: provided.innerRef, ...provided.draggableProps, ...provided.dragHandleProps, position: "relative", border: "0.063rem solid", borderColor: colors.boxborder[200], borderRadius: "md", overflow: "hidden", children: [_jsx(Image, { src: item.previewUrl, alt: (_a = item.name) !== null && _a !== void 0 ? _a : `item-${index}`, boxSize: "7.5rem", objectFit: "cover" }), _jsx(IconButton, { icon: _jsx(GripVertical, { size: 16, color: colors.textMuted }), "aria-label": "Drag", size: "sm", position: "absolute", top: 1, left: 1, variant: "ghost" }), _jsx(Badge, { position: "absolute", colorScheme: "gray", variant: "solid", bottom: 1, right: 1, children: index + 1 }), showRemoveIcon && (_jsx(IconButton, { icon: _jsx(X, { size: 16, color: colors.semanticText.error }), "aria-label": "Remove", size: "sm", position: "absolute", top: 1, right: 1, variant: "ghost", onClick: () => onRemove === null || onRemove === void 0 ? void 0 : onRemove(item.id) }))] }));
|
|
19
19
|
} }, item.id))), provided.placeholder] })) }) })] }));
|
|
20
20
|
};
|
|
21
21
|
export default ReorderList;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from "@chakra-ui/react";
|
|
3
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
4
|
+
import { scrollbarStyles, } from "../../Theme/tokens/builders/scrollbar.js";
|
|
5
|
+
const ScrollbarBox = ({ children, height, maxHeight, overflowX, overflowY = "auto", variant = "default", scrollContainerRef, }) => {
|
|
6
|
+
const { colors } = useCustomTheme();
|
|
7
|
+
return (_jsx(Box, { ref: scrollContainerRef, height: height, maxHeight: maxHeight, position: "relative", sx: { overflowX, overflowY, ...scrollbarStyles(colors, variant) }, children: children }));
|
|
8
|
+
};
|
|
9
|
+
export default ScrollbarBox;
|
|
@@ -5,6 +5,7 @@ import { Check, ChevronDown, ChevronUp, CircleX, Plus, X } from "lucide-react";
|
|
|
5
5
|
import { TextLabel } from "../Common/FormLabel.js";
|
|
6
6
|
import Tag from "../Tag/Tag.js";
|
|
7
7
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
8
|
+
import { placeholderInk } from "../../Theme/tokens/builders/placeholderInk.js";
|
|
8
9
|
import ErrorMessage from "../Common/ErrorMessage.js";
|
|
9
10
|
import HelperText from "../Common/HelperText.js";
|
|
10
11
|
import ToolTip from "../ToolTip/ToolTip.js";
|
|
@@ -449,7 +450,7 @@ const SearchSelect = ({ id, label, options, onSelect, onSearch, isOptionLoading
|
|
|
449
450
|
var _a, _b, _c, _d, _e;
|
|
450
451
|
const insideLabel = (_a = insideSelect.value) === null || _a === void 0 ? void 0 : _a.label;
|
|
451
452
|
const insidePlaceholder = (_b = insideSelect.placeholder) !== null && _b !== void 0 ? _b : "Select";
|
|
452
|
-
return (_jsxs(Box, { position: "relative", ref: customSelectRef, flexShrink: 0, ml: s.insideSelectMarginLeft, h: "-webkit-fill-available", borderRight: "0.063rem solid", borderColor: theme.colors.boxborder[
|
|
453
|
+
return (_jsxs(Box, { position: "relative", ref: customSelectRef, flexShrink: 0, ml: s.insideSelectMarginLeft, h: "-webkit-fill-available", borderRight: "0.063rem solid", borderColor: theme.colors.boxborder[200], bg: customSelectOpen
|
|
453
454
|
? theme.colors.primary.opacity[8]
|
|
454
455
|
: theme.colors.background[400], borderLeftRadius: "md", borderRightRadius: 0, transition: "background 0.15s ease, box-shadow 0.15s ease", boxShadow: customSelectOpen
|
|
455
456
|
? `inset 0 0 0 0.063rem ${theme.colors.primary[500]}`
|
|
@@ -457,7 +458,7 @@ const SearchSelect = ({ id, label, options, onSelect, onSearch, isOptionLoading
|
|
|
457
458
|
e.stopPropagation();
|
|
458
459
|
setIsOpen(false);
|
|
459
460
|
setCustomSelectOpen((prev) => !prev);
|
|
460
|
-
}, children: [_jsxs(Box, { minW: "4.5rem", cursor: "pointer", display: "flex", justifyContent: "space-between", alignItems: "center", gap: 1, width: insideSelect.width, height: insideSelectBoxHeight, pl: "0.5rem", pr: "0.375rem", children: [insideLabel ? (_jsx(SelectTruncatedLabel, { label: insideLabel, maxWidth: insideSelect.width || "6rem", fontSize: s.fieldFontSize })) : (_jsx(Text, { fontSize: s.fieldFontSize, fontWeight: 500, color: theme.colors
|
|
461
|
+
}, children: [_jsxs(Box, { minW: "4.5rem", cursor: "pointer", display: "flex", justifyContent: "space-between", alignItems: "center", gap: 1, width: insideSelect.width, height: insideSelectBoxHeight, pl: "0.5rem", pr: "0.375rem", children: [insideLabel ? (_jsx(SelectTruncatedLabel, { label: insideLabel, maxWidth: insideSelect.width || "6rem", fontSize: s.fieldFontSize })) : (_jsx(Text, { fontSize: s.fieldFontSize, fontWeight: 500, color: placeholderInk(theme.colors), isTruncated: true, maxW: insideSelect.width || "6rem", children: insidePlaceholder })), _jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, color: customSelectOpen ? theme.colors.accentText : theme.colors.textMuted, transition: "transform 0.2s ease, color 0.15s ease", transform: customSelectOpen ? "rotate(180deg)" : "rotate(0deg)", children: _jsx(ChevronDown, { size: s.chevronSize }) })] }), customSelectOpen && (_jsx(Portal, { children: _jsx(Box, { ref: setInsideSelectMenuRef, id: "custom-select-portal", position: "fixed", top: `${customSelectPos.top}px`, left: `${customSelectPos.left}px`, zIndex: 1510, bg: theme.colors.background[50], border: "0.063rem solid", borderColor: theme.colors.boxborder[200], borderRadius: "lg", boxShadow: (_d = (_c = theme.shadows) === null || _c === void 0 ? void 0 : _c.md) !== null && _d !== void 0 ? _d : "md", minW: `${customSelectPos.width}px`, maxW: "20rem", py: 1, overflow: "hidden", children: (_e = insideSelect.option) === null || _e === void 0 ? void 0 : _e.map((item) => {
|
|
461
462
|
var _a;
|
|
462
463
|
const selected = ((_a = insideSelect.value) === null || _a === void 0 ? void 0 : _a.id) === item.id;
|
|
463
464
|
return (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 2, minH: s.optionRowMinH, py: s.optionRowPy, px: "0.75rem", fontSize: s.dropdownTextFontSize, fontWeight: selected ? 600 : 500, color: selected
|
|
@@ -506,10 +507,10 @@ const SearchSelect = ({ id, label, options, onSelect, onSearch, isOptionLoading
|
|
|
506
507
|
setCustomSelectOpen(false);
|
|
507
508
|
return !prev;
|
|
508
509
|
});
|
|
509
|
-
}, "aria-label": "toggle-dropdown", display: "flex", alignItems: "center", children: isOpen ? (_jsx(ChevronUp, { size: s.chevronSize })) : (_jsx(ChevronDown, { size: s.chevronSize })) }))] })] }) }), isOpen && (_jsx(Portal, { children: _jsxs(Box, { ref: setDropdownMenuRef, id: listboxId, role: "listbox", "aria-multiselectable": isMultiple || undefined, position: "fixed", top: `${dropdownPos.top}px`, left: `${dropdownPos.left}px`, width: `${dropdownPos.width}px`, zIndex: 1500, maxH: "20rem", borderWidth: 1, borderColor: theme.colors.boxborder[200], borderRadius: "sm", bg: theme.colors.background[50], boxShadow: "md", display: "flex", flexDirection: "column", children: [isMultiple && isSelectAll && (_jsxs(Box, { py: s.optionRowPy, px: 3, cursor: "pointer", onClick: handleSelectAll, display: "flex", alignItems: "center", gap: 2, borderBottom: `0.063rem solid ${theme.colors.boxborder[
|
|
510
|
+
}, "aria-label": "toggle-dropdown", display: "flex", alignItems: "center", children: isOpen ? (_jsx(ChevronUp, { size: s.chevronSize })) : (_jsx(ChevronDown, { size: s.chevronSize })) }))] })] }) }), isOpen && (_jsx(Portal, { children: _jsxs(Box, { ref: setDropdownMenuRef, id: listboxId, role: "listbox", "aria-multiselectable": isMultiple || undefined, position: "fixed", top: `${dropdownPos.top}px`, left: `${dropdownPos.left}px`, width: `${dropdownPos.width}px`, zIndex: 1500, maxH: "20rem", borderWidth: 1, borderColor: theme.colors.boxborder[200], borderRadius: "sm", bg: theme.colors.background[50], boxShadow: "md", display: "flex", flexDirection: "column", children: [isMultiple && isSelectAll && (_jsxs(Box, { py: s.optionRowPy, px: 3, cursor: "pointer", onClick: handleSelectAll, display: "flex", alignItems: "center", gap: 2, borderBottom: `0.063rem solid ${theme.colors.boxborder[200]}`, children: [_jsx(Checkbox, { isChecked: allFilteredSelected, sx: { pointerEvents: "none" }, size: s.checkboxSize }), _jsx(Text, { fontSize: s.dropdownTextFontSize, children: allFilteredSelected ? "Unselect All" : "Select All" })] })), _jsx(Box, { flex: "1", overflowY: "auto", onScroll: handleScroll, maxH: "15rem", borderBottom: "0.063rem solid", borderColor: theme.colors.boxborder[200], children: isOptionLoading && filteredOptions.length === 0 ? (_jsxs(Box, { py: s.optionRowPy, px: 3, display: "flex", alignItems: "center", gap: 2, minH: s.optionRowMinH, children: [_jsx(Spinner, { size: s.spinnerSize }), _jsx(Text, { fontSize: s.dropdownTextFontSize, children: loadingText })] })) : !isOptionLoading && filteredOptions.length === 0 ? (_jsx(Text, { p: 3, fontSize: s.dropdownTextFontSize, color: theme.colors.textMuted, children: "No results found" })) : (_jsxs(_Fragment, { children: [filteredOptions.map((option, index) => (_jsxs(Box, { id: getOptionId(index), role: "option", "aria-selected": isSelected(option.id), py: s.optionRowPy, px: 3, minH: s.optionRowMinH, cursor: "pointer", bg: index === activeIndex
|
|
510
511
|
? theme.colors.primary.opacity[8]
|
|
511
512
|
: isSelected(option.id)
|
|
512
513
|
? theme.colors.gray[100]
|
|
513
|
-
: "transparent", _hover: { bg: theme.colors.gray[50] }, onClick: () => handleSelect(option), onMouseEnter: () => setActiveIndex(index), display: "flex", alignItems: "center", gap: 2, borderBottom: `0.063rem solid ${theme.colors.boxborder[
|
|
514
|
+
: "transparent", _hover: { bg: theme.colors.gray[50] }, onClick: () => handleSelect(option), onMouseEnter: () => setActiveIndex(index), display: "flex", alignItems: "center", gap: 2, borderBottom: `0.063rem solid ${theme.colors.boxborder[200]}`, children: [isMultiple && (_jsx(Checkbox, { isChecked: isSelected(option.id), sx: { pointerEvents: "none" }, size: s.checkboxSize })), option.view ? (_jsx(_Fragment, { children: option.view })) : (_jsx(Text, { fontSize: s.dropdownTextFontSize, children: option.label }))] }, option.id))), ((pagination === null || pagination === void 0 ? void 0 : pagination.scrollLoading) || (isOptionLoading && filteredOptions.length > 0)) && (_jsxs(Box, { py: s.optionRowPy, px: 3, display: "flex", alignItems: "center", justifyContent: "center", gap: 2, minH: s.optionRowMinH, children: [_jsx(Spinner, { size: s.spinnerSize }), _jsx(Text, { fontSize: s.dropdownTextFontSize, children: loadingText })] }))] })) }), (addNew === null || addNew === void 0 ? void 0 : addNew.enabled) && (_jsxs(Box, { py: s.optionRowPy, px: 3, borderTop: "0.063rem solid", borderColor: theme.colors.boxborder[200], bg: theme.colors.background[50], display: "flex", alignItems: "center", gap: 2, minH: s.optionRowMinH, cursor: "pointer", onClick: addNew.onClick, _hover: { bg: theme.colors.gray[50] }, children: [addNew.icon || _jsx(Plus, { size: s.addNewIconSize }), _jsx(Text, { fontSize: s.dropdownTextFontSize, children: addNew.text || "Add New" })] }))] }) })), helperText && !error && _jsx(HelperText, { helperText: helperText }), error && _jsx(ErrorMessage, { errorMessage: errorMessage })] }));
|
|
514
515
|
};
|
|
515
516
|
export default SearchSelect;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { placeholderInk } from "../../Theme/tokens/builders/placeholderInk.js";
|
|
1
2
|
export const Select = {
|
|
2
3
|
baseStyle: ({ theme }) => ({
|
|
3
4
|
field: {
|
|
@@ -16,7 +17,7 @@ export const Select = {
|
|
|
16
17
|
width: "100%", // full container width
|
|
17
18
|
maxWidth: "100%",
|
|
18
19
|
_placeholder: {
|
|
19
|
-
|
|
20
|
+
color: placeholderInk(theme.colors),
|
|
20
21
|
whiteSpace: "nowrap",
|
|
21
22
|
overflow: "hidden",
|
|
22
23
|
textOverflow: "ellipsis",
|
|
@@ -60,7 +61,7 @@ export const Select = {
|
|
|
60
61
|
// [800], not [500]/[700]: WCAG 1.4.11 needs >=3.0 for a control boundary, measured
|
|
61
62
|
// against the parent surface — up to `muted` (lightest). [700] fails there (2.41-2.72);
|
|
62
63
|
// [800] clears all named surfaces with margin (3.44-3.90).
|
|
63
|
-
const borderColor = theme.colors.boxborder[
|
|
64
|
+
const borderColor = theme.colors.boxborder[500];
|
|
64
65
|
const shadowPrimary = theme.colors.boxShadow.primary;
|
|
65
66
|
const shadowError = theme.colors.boxShadow.error;
|
|
66
67
|
const primary = theme.colors.primary[500];
|
|
@@ -30,7 +30,7 @@ BottomIcon = false, BottomText, handleBottomClick, BottomTextColor, isColorOptio
|
|
|
30
30
|
const errorBorder = `2px solid ${theme.colors.semanticText.error}`;
|
|
31
31
|
// [800], not [500]: WCAG 1.4.11 needs >=3.0 for a control boundary against any named surface
|
|
32
32
|
// up to `muted` (lightest); [500] fails there, [800] clears all with margin.
|
|
33
|
-
const defaultBorderThin = `1px solid ${theme.colors.boxborder[
|
|
33
|
+
const defaultBorderThin = `1px solid ${theme.colors.boxborder[500]}`;
|
|
34
34
|
const [selectedOptions, setSelectedOptions] = useState(initialSelectedOption ? [initialSelectedOption] : []);
|
|
35
35
|
const [inputValue, setInputValue] = useState(searchQuery);
|
|
36
36
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -246,7 +246,7 @@ BottomIcon = false, BottomText, handleBottomClick, BottomTextColor, isColorOptio
|
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
248
|
setIsOpen(true);
|
|
249
|
-
}, onChange: (e) => handleInputChange(e.target.value), placeholder: placeholder, onKeyDown: handleKeyDown, id: id, name: name, role: "combobox", "aria-autocomplete": "list", "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-controls": listboxId, cursor: "pointer", borderColor: theme.colors.boxborder[
|
|
249
|
+
}, onChange: (e) => handleInputChange(e.target.value), placeholder: placeholder, onKeyDown: handleKeyDown, id: id, name: name, role: "combobox", "aria-autocomplete": "list", "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-controls": listboxId, cursor: "pointer", borderColor: theme.colors.boxborder[500], transition: "border-color 0.2s, box-shadow 0.2s", _hover: {
|
|
250
250
|
borderColor: error
|
|
251
251
|
? theme.colors.semanticText.error
|
|
252
252
|
: theme.colors.primary[500],
|
|
@@ -264,7 +264,7 @@ BottomIcon = false, BottomText, handleBottomClick, BottomTextColor, isColorOptio
|
|
|
264
264
|
fontSize: 15,
|
|
265
265
|
letterSpacing: 0.7,
|
|
266
266
|
border: error ? errorBorder : defaultBorderThin,
|
|
267
|
-
} }), rightIcon && (_jsx(InputRightElement, { pointerEvents: "none", children: rightIcon, style: { ...rightElementStyle } }))] }), isOpen && (_jsxs(Box, { ref: dropdownRef, marginTop: "5px", position: "absolute", top: position === "below" ? "100%" : "auto", bottom: position === "above" ? "100%" : "auto", left: 0, right: 0, border: "1px solid", borderColor: theme.colors.boxborder[
|
|
267
|
+
} }), rightIcon && (_jsx(InputRightElement, { pointerEvents: "none", children: rightIcon, style: { ...rightElementStyle } }))] }), isOpen && (_jsxs(Box, { ref: dropdownRef, marginTop: "5px", position: "absolute", top: position === "below" ? "100%" : "auto", bottom: position === "above" ? "100%" : "auto", left: 0, right: 0, border: "1px solid", borderColor: theme.colors.boxborder[200], borderRadius: "md", bg: theme.colors.background[50], maxHeight: "150px", overflowY: "auto", zIndex: 10, children: [_jsx(Box, { id: listboxId, role: "listbox", "aria-label": label !== null && label !== void 0 ? label : placeholder, onKeyDown: handleListKeyDown, children: _jsx(RenderOptions, { isOptionLoading: isOptionLoading, filteredOptions: filteredOptions, loadingText: loadingText, handleOptionClick: handleOptionClick, isProfile: isProfile, isColorOptions: isColorOptions, isOptionSelected: isOptionSelected, activeIndex: activeIndex, optionRefs: optionRefs }) }), _jsx("hr", {}), isBottomIcon && (_jsxs(Box, { position: "sticky", bottom: 0, background: theme.colors.background[50], display: "flex", alignItems: "center", pl: "1rem", cursor: "pointer", onClick: handleBottomClick, borderColor: theme.colors.boxborder[200], zIndex: 1, borderTop: `1px solid ${theme.colors.boxborder[200]}`, children: [_jsx(Box, { children: BottomIcon ? BottomIcon : _jsx(PlusIcon, { size: "1rem" }) }), _jsx(Box, { fontSize: "0.875rem", color: BottomTextColor
|
|
268
268
|
? BottomTextColor
|
|
269
269
|
: theme.colors.accentText, padding: "8px 8px", children: BottomText || "Add New" })] }))] })), error && _jsx(ErrorMessage, { errorMessage: errorMessage })] }) }) }));
|
|
270
270
|
}
|
|
@@ -3,6 +3,8 @@ import React, { useCallback, useEffect, useId, useMemo, useRef, useState } from
|
|
|
3
3
|
import { Box, Checkbox, FormControl, Input, Popover, PopoverAnchor, PopoverContent, Portal, useDisclosure, } from "@chakra-ui/react";
|
|
4
4
|
import { ChevronDown } from "lucide-react";
|
|
5
5
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
6
|
+
import { placeholderInk } from "../../Theme/tokens/builders/placeholderInk.js";
|
|
7
|
+
import { scrollbarStyles } from "../../Theme/tokens/builders/scrollbar.js";
|
|
6
8
|
import { getFieldStateStyles } from "../Common/fieldStyles.js";
|
|
7
9
|
import { TextLabel } from "../Common/FormLabel.js";
|
|
8
10
|
import ErrorMessage from "../Common/ErrorMessage.js";
|
|
@@ -22,7 +24,7 @@ const OptionRow = React.memo(function OptionRow({ option, index, listboxId, isSe
|
|
|
22
24
|
: theme.colors.text[700], bg: isActive ? theme.colors.primary.opacity[8] : "transparent", transition: "background 0.12s ease, color 0.12s ease", children: [isMulti ? (_jsx(Checkbox, { isChecked: isSelected, isDisabled: option.isDisabled, pointerEvents: "none", tabIndex: -1 })) : null, renderOption ? (_jsx(Box, { flex: 1, minW: 0, children: renderOption(option, { isSelected, isActive }) })) : (_jsxs(_Fragment, { children: [option.icon ? (_jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, children: option.icon })) : null, _jsxs(Box, { flex: 1, minW: 0, isTruncated: true, children: [_jsx(Box, { as: "span", isTruncated: true, children: option.label }), option.description ? (_jsx(Box, { as: "span", display: "block", fontSize: "0.75rem", fontWeight: 400, color: theme.colors.textMuted, isTruncated: true, children: option.description })) : null] })] }))] }));
|
|
23
25
|
});
|
|
24
26
|
export default function SelectV2(props) {
|
|
25
|
-
var _a, _b
|
|
27
|
+
var _a, _b;
|
|
26
28
|
const { options = [], placeholder = "Select Option", label, error = false, errorMessage, helperText, isDisabled = false, isRequired = false, size = "md", isSearchable = true, width, formControlStyle, onBlur, onFocus, renderOption, renderValue, maxMenuHeight = "16rem", defaultOpen = false, "data-testid": dataTestId, "aria-label": ariaLabel, } = props;
|
|
27
29
|
const theme = useCustomTheme();
|
|
28
30
|
const { isOpen, onOpen, onClose } = useDisclosure({ defaultIsOpen: defaultOpen });
|
|
@@ -192,15 +194,7 @@ export default function SelectV2(props) {
|
|
|
192
194
|
const triggerId = `selectv2-trigger-${instanceId}`;
|
|
193
195
|
const activeOption = filteredOptions[activeIndex];
|
|
194
196
|
const activeDescendantId = activeOption ? optionDomId(listboxId, activeOption.id) : undefined;
|
|
195
|
-
const listScrollStyles = useMemo(() => (
|
|
196
|
-
scrollbarWidth: "thin",
|
|
197
|
-
scrollbarColor: `${theme.colors.gray[300]} transparent`,
|
|
198
|
-
"&::-webkit-scrollbar": { width: "6px" },
|
|
199
|
-
"&::-webkit-scrollbar-thumb": {
|
|
200
|
-
background: theme.colors.gray[300],
|
|
201
|
-
borderRadius: "base",
|
|
202
|
-
},
|
|
203
|
-
}), [theme]);
|
|
197
|
+
const listScrollStyles = useMemo(() => scrollbarStyles(theme.colors, "overlay"), [theme]);
|
|
204
198
|
const defaultTriggerContent = () => {
|
|
205
199
|
var _a;
|
|
206
200
|
if (props.isMulti) {
|
|
@@ -215,7 +209,7 @@ export default function SelectV2(props) {
|
|
|
215
209
|
return selectedOptions[0] ? selectedOptions[0].label : placeholder;
|
|
216
210
|
};
|
|
217
211
|
const triggerIcon = !props.isMulti && ((_b = selectedOptions[0]) === null || _b === void 0 ? void 0 : _b.icon) ? selectedOptions[0].icon : null;
|
|
218
|
-
return (_jsxs(FormControl, { isInvalid: error, isDisabled: isDisabled, style: formControlStyle, width: width, children: [label && (_jsx(TextLabel, { label: label, id: triggerId, isRequired: isRequired })), _jsxs(Popover, { isOpen: isOpen, onClose: () => resetAndClose(), placement: "bottom-start", matchWidth: true, autoFocus: false, returnFocusOnClose: false, gutter: 4, children: [_jsx(PopoverAnchor, { children: _jsxs(Box, { as: "button", type: "button", id: triggerId, ref: triggerRef, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-controls": listboxId, "aria-activedescendant": activeDescendantId, "aria-disabled": isDisabled, "aria-label": ariaLabel, disabled: isDisabled, onClick: handleOpen, onKeyDown: handleTriggerKeyDown, display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%", h: s.h, px: s.px, fontSize: s.fontSize, fontWeight: 500, textAlign: "left", cursor: isDisabled ? "not-allowed" : "pointer", opacity: isDisabled ? 0.4 : 1, color: selectedOptions.length ? theme.colors.text[900] : theme.colors
|
|
212
|
+
return (_jsxs(FormControl, { isInvalid: error, isDisabled: isDisabled, style: formControlStyle, width: width, children: [label && (_jsx(TextLabel, { label: label, id: triggerId, isRequired: isRequired })), _jsxs(Popover, { isOpen: isOpen, onClose: () => resetAndClose(), placement: "bottom-start", matchWidth: true, autoFocus: false, returnFocusOnClose: false, gutter: 4, children: [_jsx(PopoverAnchor, { children: _jsxs(Box, { as: "button", type: "button", id: triggerId, ref: triggerRef, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-controls": listboxId, "aria-activedescendant": activeDescendantId, "aria-disabled": isDisabled, "aria-label": ariaLabel, disabled: isDisabled, onClick: handleOpen, onKeyDown: handleTriggerKeyDown, display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%", h: s.h, px: s.px, fontSize: s.fontSize, fontWeight: 500, textAlign: "left", cursor: isDisabled ? "not-allowed" : "pointer", opacity: isDisabled ? 0.4 : 1, color: selectedOptions.length ? theme.colors.text[900] : placeholderInk(theme.colors), "data-testid": dataTestId, ...fieldStyles, children: [_jsxs(Box, { as: "span", display: "inline-flex", alignItems: "center", gap: 1.5, minW: 0, isTruncated: true, children: [triggerIcon ? (_jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, children: triggerIcon })) : null, _jsx(Box, { as: "span", isTruncated: true, children: renderValue ? renderValue(selectedOptions) : defaultTriggerContent() })] }), _jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, ml: 2, transition: "transform 0.2s ease", transform: isOpen ? "rotate(180deg)" : "rotate(0deg)", color: theme.colors.textMuted, children: _jsx(ChevronDown, { size: 16 }) })] }) }), _jsx(Portal, { children: _jsxs(PopoverContent, { width: "100%", borderRadius: "xl", boxShadow: theme.shadows.lg, overflow: "hidden", onKeyDown: handleListKeyDown, children: [isSearchable && (_jsx(Box, { p: 2, borderBottom: `0.063rem solid ${theme.colors.boxborder[200]}`, children: _jsx(Input, { ref: filterInputRef, size: "sm", placeholder: "Type to filter...", value: filterText, onChange: (event) => {
|
|
219
213
|
setFilterText(event.target.value);
|
|
220
214
|
setActiveIndex(0);
|
|
221
215
|
}, "aria-activedescendant": activeDescendantId, "aria-label": "Filter options" }) })), _jsxs(Box, { id: listboxId, ref: listRef, role: "listbox", "aria-multiselectable": props.isMulti || undefined, maxH: maxMenuHeight, overflowY: "auto", py: 1, sx: listScrollStyles, children: [filteredOptions.length === 0 && (_jsx(Box, { px: 3, py: 2, fontSize: "0.8125rem", color: theme.colors.textMuted, children: "No Options" })), filteredOptions.map((option, index) => {
|
|
@@ -31,7 +31,7 @@ const CollapsedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
|
|
|
31
31
|
e.preventDefault();
|
|
32
32
|
if (!item.disabled)
|
|
33
33
|
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item);
|
|
34
|
-
}, bg: isActive ? "whiteAlpha.300" : "transparent", transition: "background 0.12s", children: _jsxs(Box, { position: "relative", display: "flex", alignItems: "center", children: [_jsx(Icon, { as: item.icon, fontSize: "1rem", color: isActive ? activeAccent.icon : "whiteAlpha.600", _groupHover: isActive ? undefined : { color: "whiteAlpha.800" }, transition: "color 0.12s" }), badgeVal != null && (_jsx(Box, { position: "absolute", top: "0", right: "0", w: "0.375rem", h: "0.375rem", borderRadius: "full", bg: theme.colors.red[400] }))] }) }) }), _jsx(Portal, { children: _jsx(PopoverContent, { borderRadius: "lg", bg: theme.colors.sidebar.elevated, boxShadow: "lg", minW: "10rem", maxW: "14rem", py: "0.125rem", ml: "-0.5rem", cursor: item.disabled ? "not-allowed" : "pointer", zIndex: 1500, color:
|
|
34
|
+
}, bg: isActive ? "whiteAlpha.300" : "transparent", transition: "background 0.12s", children: _jsxs(Box, { position: "relative", display: "flex", alignItems: "center", children: [_jsx(Icon, { as: item.icon, fontSize: "1rem", color: isActive ? activeAccent.icon : "whiteAlpha.600", _groupHover: isActive ? undefined : { color: "whiteAlpha.800" }, transition: "color 0.12s" }), badgeVal != null && (_jsx(Box, { position: "absolute", top: "0", right: "0", w: "0.375rem", h: "0.375rem", borderRadius: "full", bg: theme.colors.red[400] }))] }) }) }), _jsx(Portal, { children: _jsx(PopoverContent, { borderRadius: "lg", bg: theme.colors.sidebar.elevated, boxShadow: "lg", minW: "10rem", maxW: "14rem", py: "0.125rem", ml: "-0.5rem", cursor: item.disabled ? "not-allowed" : "pointer", zIndex: 1500, color: theme.colors.white, border: 'none', children: _jsx(PopoverBody, { p: "0.75rem", children: _jsxs(Flex, { align: "center", gap: "0.5rem", justify: "space-between", children: [_jsxs(Flex, { align: "center", gap: "0.5rem", flex: "1", minW: 0, children: [_jsx(Icon, { as: item.icon, fontSize: "1rem", flexShrink: 0 }), _jsx(OverflowTooltipText, { placement: "right", maxWidth: "100%", fontSize: itemFontSize, fontWeight: "medium", as: "p", children: item.title })] }), badgeVal != null && (_jsx(Badge, { colorScheme: colorScheme, fontSize: "0.625rem", variant: variant, borderRadius: radius, children: badgeVal }))] }) }) }) })] }));
|
|
35
35
|
};
|
|
36
36
|
const ExpandedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
|
|
37
37
|
var _a;
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Flex, Skeleton } from "@chakra-ui/react";
|
|
3
3
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
4
|
+
import { scrollbarStyles } from "../../Theme/tokens/builders/scrollbar.js";
|
|
4
5
|
import StageItem from "./StageItem.js";
|
|
5
6
|
import StepperStage from "./StepperStage.js";
|
|
6
|
-
const scrollSxFor = (thumb) => ({
|
|
7
|
-
"&::-webkit-scrollbar": { height: "4px" },
|
|
8
|
-
"&::-webkit-scrollbar-thumb": {
|
|
9
|
-
borderRadius: "full",
|
|
10
|
-
backgroundColor: thumb,
|
|
11
|
-
},
|
|
12
|
-
"&::-webkit-scrollbar-track": { background: "transparent" },
|
|
13
|
-
});
|
|
14
7
|
// Gap between items per variant (chevron interlocks via negative margin).
|
|
15
8
|
const gapFor = {
|
|
16
9
|
chevron: "0",
|
|
@@ -35,7 +28,7 @@ const StageProgress = ({ stages, variant = "chevron", value, onChange, size = "m
|
|
|
35
28
|
const total = stages.length;
|
|
36
29
|
return (_jsx(Box, { display: "flex", alignItems: variant === "stepper" ? "flex-start" : "stretch", gap: gapFor[variant], overflowX: "hidden", p: "0.1rem", sx: {
|
|
37
30
|
"&:hover": { overflowX: "auto" },
|
|
38
|
-
...
|
|
31
|
+
...scrollbarStyles(theme.colors, "overlay"),
|
|
39
32
|
}, children: stages.map((stage, index) => {
|
|
40
33
|
const state = stateFor(index);
|
|
41
34
|
if (variant === "stepper") {
|
|
@@ -4,10 +4,14 @@ import { Box, TableContainer, Flex, Spinner, Popover, PopoverTrigger, PopoverCon
|
|
|
4
4
|
import { Table as ChakraTable, Tbody, Thead, Icon } from "@chakra-ui/react";
|
|
5
5
|
import { motion } from "framer-motion";
|
|
6
6
|
import LeftFilterPane from "./filters/LeftFilterPane.js";
|
|
7
|
+
import { TABLE_VARIANTS } from "./variants/index.js";
|
|
8
|
+
import { TableVariantProvider } from "./variants/TableVariantContext.js";
|
|
9
|
+
import { isDarkCanvas } from "../../Theme/tokens/builders/accentText.js";
|
|
7
10
|
import Pagination from "./components/Pagination.js";
|
|
8
11
|
import TableHeader from "./components/TableHeader.js";
|
|
9
12
|
import TableBody from "./components/TableBody.js";
|
|
10
13
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
14
|
+
import { scrollbarStyles, SCROLLBAR_WIDTH } from "../../Theme/tokens/builders/scrollbar.js";
|
|
11
15
|
import useTable from "./hooks/useTable.js";
|
|
12
16
|
import { searchAndSortData, SortMultiColumnData, groupRows, buildTablePalette, pickTableColor } from "../../Utils/table.js";
|
|
13
17
|
import { useGetPreferences, useSavePreferences, } from "../../Hooks/usePreferences.js";
|
|
@@ -27,11 +31,12 @@ export default function Table({ data, columns, onSelection, isLoading, isCheckbo
|
|
|
27
31
|
name: "",
|
|
28
32
|
page: "",
|
|
29
33
|
orgId: "",
|
|
30
|
-
}, 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", stripe, groupColors, onAddItem, emptyState, onRefresh,
|
|
34
|
+
}, 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, groupColors, onAddItem, emptyState, onRefresh,
|
|
31
35
|
// onColumnFilter
|
|
32
36
|
}) {
|
|
33
37
|
var _a, _b, _c, _d;
|
|
34
38
|
const theme = useCustomTheme();
|
|
39
|
+
const variantTokens = useMemo(() => TABLE_VARIANTS[variant](theme.colors, isDarkCanvas(theme.colors.backgroundColor.main)), [variant, theme.colors]);
|
|
35
40
|
const [columnsSearch, setColumnsSearch] = useState({});
|
|
36
41
|
const tableContainerRef = useRef(null);
|
|
37
42
|
const { isOpen: isFilterModalOpen, onOpen: onFilterModalOpen, onClose: onFilterModalClose } = useDisclosure();
|
|
@@ -350,12 +355,14 @@ export default function Table({ data, columns, onSelection, isLoading, isCheckbo
|
|
|
350
355
|
return acc + (Array.isArray(items) ? items.length : 0);
|
|
351
356
|
}, 0);
|
|
352
357
|
}, [filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.selected]);
|
|
353
|
-
return (_jsxs(
|
|
358
|
+
return (_jsxs(TableVariantProvider, { value: variantTokens, children: [_jsx("style", { children: `
|
|
354
359
|
@keyframes pixelize-table-spin {
|
|
355
360
|
from { transform: rotate(0deg); }
|
|
356
361
|
to { transform: rotate(360deg); }
|
|
357
362
|
}
|
|
358
|
-
` }), _jsxs(Box, { bg: theme.colors.background[50], border: `0.063rem solid ${theme.colors.
|
|
363
|
+
` }), _jsxs(Box, { bg: theme.colors.background[50], border: `0.063rem solid ${theme.colors.boxborder[200]}`, borderRadius: "base",
|
|
364
|
+
// Square children poked past the rounded border, leaving a gap at each corner.
|
|
365
|
+
overflow: "hidden", children: [filterSidebar && filterMode === "modal" && (_jsxs(Modal, { isOpen: isFilterModalOpen, onClose: onFilterModalClose, size: "4xl", scrollBehavior: "inside", children: [_jsx(ModalOverlay, {}), _jsxs(ModalContent, { bg: theme.colors.background[50], my: 0, top: "10%", position: "fixed", left: "auto", right: "auto", children: [_jsx(ModalCloseButton, { size: "sm" }), _jsx(ModalBody, { p: 0, children: _jsx(LeftFilterPane, { theme: theme, sections: (_c = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.sidebarOptions) !== null && _c !== void 0 ? _c : [], selected: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.selected, onApply: (sel) => { var _a; (_a = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onApply) === null || _a === void 0 ? void 0 : _a.call(filterSidebar, sel); onFilterModalClose(); }, onClear: () => { var _a; (_a = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onClearAllHandler) === null || _a === void 0 ? void 0 : _a.call(filterSidebar); }, isApplyLoading: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isApplyLoading, filterMode: filterMode }) })] })] })), _jsxs(Flex, { align: "start", children: [filterMode === "sidebar" && (_jsx(MotionBox, { "data-testid": "filter-sidebar-pane", initial: { width: 0 }, animate: { width: (filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isFilterSidebar) ? 180 : 0 }, transition: { type: "tween", duration: 0.5 }, overflow: "hidden", flexShrink: 0, borderRight: (filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isFilterSidebar) ? "1px solid" : "none", borderColor: theme.colors.boxborder[200], style: { height: controlsHeight + tableMaxH }, minHeight: (filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isFilterSidebar) ? "32rem" : "auto", children: _jsx(LeftFilterPane, { height: controlsHeight + tableMaxH, theme: theme, sections: (_d = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.sidebarOptions) !== null && _d !== void 0 ? _d : [], selected: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.selected, onApply: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onApply, onClear: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onClearAllHandler, isApplyLoading: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isApplyLoading, filterMode: filterMode }) })), _jsxs(Box, { flex: "1", minW: 0, children: [_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", px: 3, py: 0, height: controlsHeight, gap: 3, flexWrap: "nowrap", bg: theme.colors.background[50], borderBottom: `0.063rem solid ${theme.colors.boxborder[200]}`, children: [filterSidebar && (_jsxs(_Fragment, { children: [_jsx(ToolTip, { label: "Filter", placement: "top", children: _jsxs(Box, { position: "relative", display: "inline-block", children: [_jsx(Icon, { as: Filter, transform: "scaleX(-1)", cursor: "pointer", boxSize: 4, color: sidebarActiveCount > 0 ? theme.colors.accentText : theme.colors.text[500], onClick: filterMode === "modal" ? onFilterModalOpen : filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.filterSidebarToggle, _hover: {
|
|
359
366
|
color: theme.colors.accentText,
|
|
360
367
|
} }), sidebarActiveCount > 0 && (_jsx(Box, { position: "absolute", top: "-6px", right: "-10px", bg: theme.colors.primary[500], color: theme.colors.onPrimary, borderRadius: "full", p: "1px", cursor: "pointer", onClick: (e) => {
|
|
361
368
|
var _a;
|
|
@@ -386,29 +393,15 @@ export default function Table({ data, columns, onSelection, isLoading, isCheckbo
|
|
|
386
393
|
}, children: _jsx(RefreshCw, { size: 16 }) }) })] })), headerActions && (_jsxs(_Fragment, { children: [_jsx(VeritcalDivider, {}), _jsx(HeaderActions, { actions: headerActions, selections: selection })] })), _jsx(ActiveFilters, { columns: columnsList, columnsSearch: columnsSearch, setColumnsSearch: setColumnsSearch }), _jsxs(Box, { ml: "auto", display: "flex", alignItems: "center", gap: 2, children: [groupLoadMoreActive && loadMorePosition === "top" && (groupLoadMoreCaption || canGroupLoadMore) && (_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, flex: "0 0 auto", children: [groupLoadMoreCaption && (_jsx(Box, { fontSize: "0.75rem", color: theme.colors.text[500], whiteSpace: "nowrap", children: groupLoadMoreCaption })), canGroupLoadMore && (_jsx(Button, { size: "xs", variant: "outline", colorScheme: "gray", isLoading: isLoadingMore, loadingText: loadMoreText, onClick: handleGroupLoadMore, label: loadMoreText }))] })), (isPagination || isServerPagination) && !isGrouped && !canInfinite && !isCompactHeader && (_jsx("div", { children: _jsx(Pagination, { columns: columns, currentPage: currentPage, setCurrentPage: setCurrentPage, rowsPerPage: rowsPerPage, pages: pages, paginationText: tablePaginationText, handlePageSizeChange: handlePageSizeChange, dataLength: tableData.length, isServerPagination: isServerPagination, paginationSelectOptions: paginationSelectOptions, isVisiblity: true }) })), (isPagination || isServerPagination) && !isGrouped && !canInfinite && isCompactHeader && tableData.length > 0 && (_jsxs(Popover, { isOpen: isPaginationPopoverOpen, onClose: () => setIsPaginationPopoverOpen(false), placement: "bottom-end", children: [_jsx(PopoverTrigger, { children: _jsx(IconButton, { "aria-label": "Pagination", size: "sm", variant: "ghost", icon: _jsx(EllipsisVertical, { size: 18 }), color: theme.colors.text[500], _hover: {
|
|
387
394
|
color: theme.colors.accentText,
|
|
388
395
|
}, onClick: () => setIsPaginationPopoverOpen((open) => !open) }) }), _jsx(Portal, { children: _jsx(PopoverContent, { maxW: "22rem", p: 2, zIndex: 1600, bg: theme.colors.background[50], boxShadow: "lg", children: _jsx(PopoverBody, { p: 0, children: _jsx(Pagination, { columns: columns, currentPage: currentPage, setCurrentPage: setCurrentPage, rowsPerPage: rowsPerPage, pages: pages, paginationText: tablePaginationText, handlePageSizeChange: handlePageSizeChange, dataLength: tableData.length, isServerPagination: isServerPagination, paginationSelectOptions: paginationSelectOptions, isVisiblity: true }) }) }) })] }))] })] }), _jsxs(TableContainer, { ref: tableContainerRef, position: "relative", h: isTableLoading ? tableMaxH : undefined, maxH: !isTableLoading ? tableMaxH : undefined, pb: isTableLoading ? 0 : compactScrollbarPadding, overflowY: isCompactRows ? "hidden" : "auto", overflowX: "auto", sx: {
|
|
396
|
+
...scrollbarStyles(theme.colors),
|
|
397
|
+
// Compact rows hide the horizontal bar until hover to keep the row height.
|
|
389
398
|
'&::-webkit-scrollbar': {
|
|
390
|
-
width:
|
|
391
|
-
height: isCompactRows ? '0px' :
|
|
392
|
-
},
|
|
393
|
-
'&:hover::-webkit-scrollbar': {
|
|
394
|
-
height: '6px',
|
|
395
|
-
},
|
|
396
|
-
'&::-webkit-scrollbar-track': {
|
|
397
|
-
background: theme.colors.gray[100],
|
|
398
|
-
borderRadius: 'base',
|
|
399
|
-
},
|
|
400
|
-
'&::-webkit-scrollbar-thumb': {
|
|
401
|
-
background: theme.colors.gray[400],
|
|
402
|
-
borderRadius: 'base',
|
|
403
|
-
},
|
|
404
|
-
'&::-webkit-scrollbar-thumb:hover': {
|
|
405
|
-
background: theme.colors.gray[500],
|
|
399
|
+
width: SCROLLBAR_WIDTH,
|
|
400
|
+
height: isCompactRows ? '0px' : SCROLLBAR_WIDTH,
|
|
406
401
|
},
|
|
402
|
+
'&:hover::-webkit-scrollbar': { height: SCROLLBAR_WIDTH },
|
|
407
403
|
scrollbarWidth: isCompactRows ? 'none' : 'thin',
|
|
408
|
-
'&:hover': {
|
|
409
|
-
scrollbarWidth: 'thin',
|
|
410
|
-
},
|
|
411
|
-
scrollbarColor: `${theme.colors.gray[400]} ${theme.colors.gray[100]}`,
|
|
404
|
+
'&:hover': { scrollbarWidth: 'thin' },
|
|
412
405
|
}, children: [_jsxs(ChakraTable, { variant: "simple", size: "sm", minW: "100%", role: "grid", "aria-rowcount": isGrouped ? undefined : _filteredData.length + 1, className: "table_wrapper", sx: {
|
|
413
406
|
width: "100%",
|
|
414
407
|
// `separate` (not `collapse`) so sticky header cells paint an opaque
|
|
@@ -426,5 +419,5 @@ export default function Table({ data, columns, onSelection, isLoading, isCheckbo
|
|
|
426
419
|
backgroundColor: "transparent",
|
|
427
420
|
zIndex: 999,
|
|
428
421
|
},
|
|
429
|
-
}, children: [_jsx(Thead, { position: "sticky", top: 0, zIndex: 4, bg:
|
|
422
|
+
}, children: [_jsx(Thead, { position: "sticky", top: 0, zIndex: 4, bg: variantTokens.header.bg, children: _jsx(TableHeader, { columns: columnsList, isCheckbox: isCheckbox, headerBgColor: headerBgColor !== null && headerBgColor !== void 0 ? headerBgColor : theme.colors.backgroundColor.muted, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : theme.colors.text[500], handleSort: handleSort, headerRefs: headerRefs, columnWidths: columnWidths, columnsSort: columnsSort, noBorders: noBorders, handleCheckbox: handleCheckbox, isLoading: isTableLoading, checked: headerChecked, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, setColumnsSearch: setColumnsSearch, columnsSearch: columnsSearch, isSelecting: isSelecting }) }), _jsx(Tbody, { children: _jsx(TableBody, { data: isGrouped ? groupedSource : _filteredData, groups: renderGroups, onAddItem: onAddItem, columns: columnsList, startRow: isGrouped ? 0 : startRow, endRow: endRow, scrollContainerRef: tableContainerRef, isCheckbox: isCheckbox, columnWidths: columnWidths, 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 && (_jsxs(Flex, { justify: "center", align: "center", py: 3, gap: 2, children: [_jsx(Spinner, { size: "sm", color: theme.colors.accentText }), _jsx(Box, { fontSize: "0.75rem", color: theme.colors.text[500], children: "Loading more\u2026" })] }))] }), groupLoadMoreActive && loadMorePosition === "bottom" && (groupLoadMoreCaption || canGroupLoadMore) && (_jsxs(Flex, { justify: "center", align: "center", gap: 3, py: 3, borderTop: `0.063rem solid ${theme.colors.boxborder[200]}`, children: [groupLoadMoreCaption && (_jsx(Box, { fontSize: "0.75rem", color: theme.colors.text[500], children: groupLoadMoreCaption })), canGroupLoadMore && (_jsx(Button, { size: "xs", variant: "outline", colorScheme: "gray", isLoading: isLoadingMore, loadingText: loadMoreText, onClick: handleGroupLoadMore, label: loadMoreText }))] }))] })] })] })] }));
|
|
430
423
|
}
|
|
@@ -37,11 +37,11 @@ const TableActions = React.memo(({ row }) => {
|
|
|
37
37
|
// ✅ if row itself is missing, render nothing
|
|
38
38
|
if (!row)
|
|
39
39
|
return null;
|
|
40
|
-
return (_jsx(Popover, { placement: "bottom-start", isOpen: isOpen, onClose: handleClose, closeOnBlur: false, children: _jsxs("div", { ref: ref, children: [_jsx(PopoverTrigger, { children: _jsx(IconButton, { "aria-label": "Actions", color: theme.colors.text[900], icon: _jsx(EllipsisVertical, { size: 17 }), size: "sm", p: 0, variant: "ghost", _hover: { transform: "scale(1.2)" }, onClick: () => (isOpen ? handleClose() : handleOpen()) }) }), isOpen && (_jsx(Portal, { children: _jsx(PopoverContent, { w: "auto", minW: "100px", boxShadow: "lg", p: 0, zIndex: 999, bg: theme.colors.background[50], children: _jsx(PopoverBody, { p: 0, m: 0, children: _jsxs(VStack, { align: "stretch", spacing: 1, p: 0, m: 0, children: [row.onLink && (_jsxs(Button, { size: "sm", variant: "ghost", justifyContent: "flex-start", borderBottom: `1px solid ${theme.colors.
|
|
40
|
+
return (_jsx(Popover, { placement: "bottom-start", isOpen: isOpen, onClose: handleClose, closeOnBlur: false, children: _jsxs("div", { ref: ref, children: [_jsx(PopoverTrigger, { children: _jsx(IconButton, { "aria-label": "Actions", color: theme.colors.text[900], icon: _jsx(EllipsisVertical, { size: 17 }), size: "sm", p: 0, variant: "ghost", _hover: { transform: "scale(1.2)" }, onClick: () => (isOpen ? handleClose() : handleOpen()) }) }), isOpen && (_jsx(Portal, { children: _jsx(PopoverContent, { w: "auto", minW: "100px", boxShadow: "lg", p: 0, zIndex: 999, bg: theme.colors.background[50], children: _jsx(PopoverBody, { p: 0, m: 0, children: _jsxs(VStack, { align: "stretch", spacing: 1, p: 0, m: 0, children: [row.onLink && (_jsxs(Button, { size: "sm", variant: "ghost", justifyContent: "flex-start", borderBottom: `1px solid ${theme.colors.boxborder[200]}`, borderRadius: 0, gap: 2, onClick: () => {
|
|
41
41
|
var _a;
|
|
42
42
|
(_a = row.onLink) === null || _a === void 0 ? void 0 : _a.call(row, row);
|
|
43
43
|
handleClose();
|
|
44
|
-
}, children: [_jsx(ExternalLink, { size: 17 }), " View"] })), row.onEdit && (_jsxs(Button, { size: "sm", variant: "ghost", justifyContent: "flex-start", gap: 2, borderBottom: `1px solid ${theme.colors.
|
|
44
|
+
}, children: [_jsx(ExternalLink, { size: 17 }), " View"] })), row.onEdit && (_jsxs(Button, { size: "sm", variant: "ghost", justifyContent: "flex-start", gap: 2, borderBottom: `1px solid ${theme.colors.boxborder[200]}`, borderRadius: 0, onClick: () => {
|
|
45
45
|
var _a;
|
|
46
46
|
(_a = row.onEdit) === null || _a === void 0 ? void 0 : _a.call(row, row);
|
|
47
47
|
handleClose();
|
|
@@ -3,13 +3,14 @@ import { Box, IconButton, Spinner, Td, Tr } from "@chakra-ui/react";
|
|
|
3
3
|
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { normalizeTableCellValue, buildTablePalette, pickTableColor } from "../../../Utils/table.js";
|
|
5
5
|
import { useCustomTheme } from "../../../Theme/useCustomTheme.js";
|
|
6
|
-
import { onFilled
|
|
6
|
+
import { onFilled } from "../../../Theme/tokens/builders/accentText.js";
|
|
7
7
|
import { TableBodyLoading } from "./TableLoading.js";
|
|
8
8
|
import TableActions from "./TableActions.js";
|
|
9
|
-
import { getTableRowHoverStyle } from "./tableRowHoverStyle.js";
|
|
10
9
|
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
11
10
|
import CheckBox from "../../Checkbox/Checkbox.js";
|
|
12
11
|
import TableGroupRow from "./TableGroupRow.js";
|
|
12
|
+
import { useTableVariant } from "../variants/TableVariantContext.js";
|
|
13
|
+
import { resolvePillInk } from "../variants/pillInk.js";
|
|
13
14
|
// Density → row height (px) + cell vertical padding. The padding (not just the
|
|
14
15
|
// min-height) is what drives perceived row size, so compact tightens both.
|
|
15
16
|
const DENSITY_CONFIG = {
|
|
@@ -25,6 +26,9 @@ const getRowContent = (row) => typeof row.content === "function"
|
|
|
25
26
|
// the label is centered in whichever of white/black clears AA against that fill —
|
|
26
27
|
// the fill can be a consumer hex we can't know in advance is light or dark.
|
|
27
28
|
const StatusCell = ({ value, onSolid }) => (_jsx(Box, { display: "flex", alignItems: "center", justifyContent: "center", w: "100%", h: "100%", px: "0.5rem", fontSize: "0.75rem", fontWeight: 600, color: onSolid, textAlign: "center", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", children: value }));
|
|
29
|
+
// Studio's status cell: a contained chip on the tone's soft rung. Same tone pair
|
|
30
|
+
// the group header already uses, so an override hex behaves identically in both.
|
|
31
|
+
const StatusPill = ({ value, soft, ink, radius, }) => (_jsx(Box, { display: "inline-flex", alignItems: "center", maxW: "100%", px: "0.5rem", py: "0.125rem", borderRadius: radius, bg: soft, color: ink, fontSize: "0.75rem", fontWeight: 600, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", children: value }));
|
|
28
32
|
const EMPTY_HOVER = {};
|
|
29
33
|
const TableRow = React.memo(({ row, rowIndex, isChecked, isExpanded, isContent, isLink, isCheckbox, isLoading, isActionFreeze, columns, leftOffsets, noBorders, freezedBgColor, freezedTextColor, theme, borderStyle, selectedBg, selectedFrozenBg, hoverStyle, rowHeight, cellPy, palette, accentColor, ariaRowIndex, handleCheckbox, onRowClick, toggleRowExpansion, onMeasure, }) => {
|
|
30
34
|
// Measured-height virtualization: report this row's real height (main + any
|
|
@@ -63,15 +67,38 @@ const TableRow = React.memo(({ row, rowIndex, isChecked, isExpanded, isContent,
|
|
|
63
67
|
onRowClick(row, { label: header.label, id: header.id });
|
|
64
68
|
}
|
|
65
69
|
}, [row, onRowClick]);
|
|
70
|
+
const variant = useTableVariant();
|
|
66
71
|
const firstDataColIndex = columns.findIndex((c) => !c.isHidden);
|
|
67
72
|
const accentSx = accentColor ? `inset 3px 0 0 ${accentColor}` : undefined;
|
|
73
|
+
// A selected row earns the leading bar only where a group accent isn't already
|
|
74
|
+
// claiming that edge — the group's identity is the scarcer signal.
|
|
75
|
+
const leadSx = variant.row.showSelectedBar && isChecked && !accentColor
|
|
76
|
+
? `inset 3px 0 0 ${variant.row.selectedBarColor}`
|
|
77
|
+
: accentSx;
|
|
78
|
+
const restsOnIndex = variant.slot.rest === "index";
|
|
79
|
+
const rowSx = {
|
|
80
|
+
...(variant.row.hoverScope === "row"
|
|
81
|
+
? { "&:hover > td[data-hoverable='true']": { backgroundColor: variant.row.hoverBg } }
|
|
82
|
+
: {}),
|
|
83
|
+
// opacity, not display: a hidden-by-display checkbox leaves the a11y tree and
|
|
84
|
+
// cannot be tabbed to, so `:focus-within` would never fire to bring it back.
|
|
85
|
+
...(restsOnIndex
|
|
86
|
+
? {
|
|
87
|
+
"& .table-slot-box": { opacity: isChecked ? 1 : 0 },
|
|
88
|
+
"& .table-slot-index": { opacity: isChecked ? 0 : 1 },
|
|
89
|
+
"&:hover .table-slot-box, &:focus-within .table-slot-box": { opacity: 1 },
|
|
90
|
+
"&:hover .table-slot-index, &:focus-within .table-slot-index": { opacity: 0 },
|
|
91
|
+
}
|
|
92
|
+
: {}),
|
|
93
|
+
};
|
|
68
94
|
// Pinned/frozen columns get a tinted, opaque background so the frozen pane reads
|
|
69
95
|
// as one piece with its header (and so sticky cells cover scrolling content).
|
|
70
96
|
const frozenCellBg = freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.table.hover[100];
|
|
71
97
|
const cellStyles = row.cellStyle;
|
|
72
98
|
const rowStyle = row.rowStyle;
|
|
99
|
+
const chromeHoverable = rowStyle ? "false" : "true";
|
|
73
100
|
const rowContent = getRowContent(row);
|
|
74
|
-
return (_jsxs(React.Fragment, { children: [_jsxs(Tr, { ref: mainRowRef, "aria-rowindex": ariaRowIndex, opacity: isLoading ? 0.4 : 1, pointerEvents: isLoading ? "none" : "auto", transition: "opacity 0.2s", children: [isContent && (_jsx(Td, { w: "6", p: 0, fontSize: 14, background: isChecked ? selectedFrozenBg : frozenCellBg, color: freezedTextColor, position: "sticky", borderBottom: borderStyle, boxShadow:
|
|
101
|
+
return (_jsxs(React.Fragment, { children: [_jsxs(Tr, { ref: mainRowRef, "aria-rowindex": ariaRowIndex, opacity: isLoading ? 0.4 : 1, pointerEvents: isLoading ? "none" : "auto", transition: "opacity 0.2s", sx: rowSx, children: [isContent && (_jsx(Td, { w: "6", p: 0, fontSize: 14, background: isChecked ? selectedFrozenBg : frozenCellBg, color: freezedTextColor, position: "sticky", borderBottom: borderStyle, boxShadow: leadSx, boxSizing: "border-box", "data-hoverable": chromeHoverable, left: "0px", zIndex: 1, className: "columns sticky-columns", children: !!(row === null || row === void 0 ? void 0 : row.content) && (_jsx(IconButton, { "aria-label": isExpanded ? "Collapse row" : "Expand row", color: theme.colors.textMuted, icon: isExpanded ? (_jsx(ChevronDown, { fontSize: 16 })) : (_jsx(ChevronRight, { fontSize: 16 })), _hover: { transform: "scale(1.1)" }, size: "sm", onClick: () => toggleRowExpansion(rowIndex), variant: "ghost" })) })), isCheckbox && (_jsx(Td, { w: variant.slot.width, minW: variant.slot.width, px: variant.slot.centered ? 0 : undefined, textAlign: variant.slot.centered ? "center" : undefined, fontSize: 14, fontWeight: 600, color: theme.colors.background[50], textTransform: "capitalize", background: isChecked ? selectedFrozenBg : frozenCellBg, position: "sticky", borderBottom: borderStyle, boxShadow: !isContent ? leadSx : undefined, "data-hoverable": chromeHoverable, boxSizing: "border-box", left: "0px", zIndex: 1, className: "columns sticky-columns", children: _jsxs(Box, { display: restsOnIndex ? "grid" : undefined, placeItems: "center", children: [restsOnIndex && (_jsx(Box, { as: "span", className: "table-slot-index", gridArea: "1 / 1", color: variant.slot.indexInk, fontSize: "0.6875rem", fontWeight: 500, transition: "opacity 0.15s ease-in-out", sx: { fontVariantNumeric: "tabular-nums" }, children: rowIndex + 1 })), _jsx(Box, { as: "span", className: restsOnIndex ? "table-slot-box" : undefined, gridArea: restsOnIndex ? "1 / 1" : undefined, display: "flex", alignItems: "center", justifyContent: "center", transition: "opacity 0.15s ease-in-out", children: _jsx(CheckBox, { "aria-label": `Select row ${rowIndex + 1}`, onChange: () => handleCheckbox(getRowId(row)), isChecked: isChecked }) })] }) })), columns.map((header, headerIndex) => {
|
|
75
102
|
var _a, _b, _c;
|
|
76
103
|
if (header.isHidden)
|
|
77
104
|
return null;
|
|
@@ -86,13 +113,15 @@ const TableRow = React.memo(({ row, rowIndex, isChecked, isExpanded, isContent,
|
|
|
86
113
|
const statusOnSolid = statusColor
|
|
87
114
|
? (_c = statusColor.onSolid) !== null && _c !== void 0 ? _c : onFilled(statusColor.solid, theme.colors.white, theme.colors.black)
|
|
88
115
|
: undefined;
|
|
89
|
-
|
|
116
|
+
const isBleed = variant.cells.statusFill === "bleed" && !!statusColor;
|
|
117
|
+
const canHover = !isBleed && !((cellStyles === null || cellStyles === void 0 ? void 0 : cellStyles[header.id]) || rowStyle);
|
|
118
|
+
return (_jsx(Td, { maxWidth: 500, minWidth: 120, height: `${rowHeight}px`, py: isBleed ? 0 : cellPy, px: isBleed ? 0 : undefined, onClick: () => handleCellClick(header), fontSize: 14, fontWeight: 400, position: isFrozen ? "sticky" : undefined, left: isFrozen ? leftOffsets[headerIndex] : undefined, zIndex: isFrozen ? 1 : 0, background: isBleed ? statusColor.solid : isChecked ? (isFrozen ? selectedFrozenBg : selectedBg) : isFrozen ? frozenCellBg : theme.colors.background[50], textOverflow: "ellipsis", boxShadow: isFirstDataCell ? leadSx : undefined, borderBottom: noBorders
|
|
90
119
|
? "none"
|
|
91
|
-
: `0.063rem solid ${
|
|
120
|
+
: `0.063rem solid ${isFrozen || isChecked
|
|
121
|
+
? variant.row.frozenRuleColor
|
|
122
|
+
: variant.row.ruleColor}`, className: `columns ${isFrozen ? "sticky-columns" : "scrollable-columns"}`, boxSizing: "border-box", color: isBleed ? statusOnSolid : variant.cells.ink, "data-hoverable": canHover ? "true" : "false", _hover: variant.row.hoverScope === "row" || !canHover
|
|
92
123
|
? EMPTY_HOVER
|
|
93
|
-
: (
|
|
94
|
-
? EMPTY_HOVER
|
|
95
|
-
: hoverStyle, children: isStatus && statusColor ? (_jsx(StatusCell, { value: normalizeTableCellValue(row[header.id]), onSolid: statusOnSolid })) : (_jsx(Box, { display: "block", overflow: "hidden", whiteSpace: "normal", overflowWrap: "break-word", children: normalizeTableCellValue(header.node ? header.node(row) : row[header.id]) })) }, headerIndex + 1));
|
|
124
|
+
: hoverStyle, children: isBleed ? (_jsx(StatusCell, { value: normalizeTableCellValue(row[header.id]), onSolid: statusOnSolid })) : isStatus && statusColor ? (_jsx(StatusPill, { value: normalizeTableCellValue(row[header.id]), soft: statusColor.soft, ink: resolvePillInk(statusColor.text, statusColor.soft, theme.colors.background[50]), radius: variant.cells.pillRadius })) : (_jsx(Box, { display: "block", overflow: "hidden", whiteSpace: "normal", overflowWrap: "break-word", children: normalizeTableCellValue(header.node ? header.node(row) : row[header.id]) })) }, headerIndex + 1));
|
|
96
125
|
}), isLink && (_jsx(Td, { w: 2, p: 0, fontSize: 14, background: isChecked ? (isActionFreeze ? selectedFrozenBg : selectedBg) : isActionFreeze ? frozenCellBg : theme.colors.background[50], color: freezedTextColor, position: isActionFreeze ? "sticky" : "relative", borderBottom: borderStyle, boxSizing: "border-box", right: 0, zIndex: 1, className: `columns sticky-columns${isActionFreeze ? "-right" : ""}`, children: (row.onLink || row.onEdit || row.onDelete) ? (_jsx(TableActions, { row: row })) : null }))] }), rowContent && isExpanded && (_jsx(Tr, { ref: expandedRowRef, children: _jsx(Td, { colSpan: columns.length +
|
|
97
126
|
(isCheckbox ? 1 : 0) +
|
|
98
127
|
(isContent ? 1 : 0) +
|
|
@@ -101,6 +130,7 @@ const TableRow = React.memo(({ row, rowIndex, isChecked, isExpanded, isContent,
|
|
|
101
130
|
const TableBody = ({ data, isCheckbox, columns, startRow, columnWidths, freezedBgColor, freezedTextColor, noBorders, handleCheckbox, selections, isLoading, onRowClick, isContent, isLink, isActionFreeze, loadingSkeletonRows, scrollContainerRef, density, accentColors, groups, onAddItem, emptyState, }) => {
|
|
102
131
|
var _a, _b, _c;
|
|
103
132
|
const theme = useCustomTheme();
|
|
133
|
+
const variant = useTableVariant();
|
|
104
134
|
const [expandedRows, setExpandedRows] = useState(new Set());
|
|
105
135
|
const [collapsedGroups, setCollapsedGroups] = useState(new Set());
|
|
106
136
|
const toggleGroup = useCallback((value) => {
|
|
@@ -246,17 +276,16 @@ const TableBody = ({ data, isCheckbox, columns, startRow, columnWidths, freezedB
|
|
|
246
276
|
const checkboxOffset = isCheckbox ? 50 : 0;
|
|
247
277
|
return columnWidths.map((_, idx) => columnWidths.slice(0, idx).reduce((sum, w) => sum + w, 0) + checkboxOffset);
|
|
248
278
|
}, [columnWidths, isCheckbox]);
|
|
249
|
-
const borderStyle = useMemo(() => noBorders ? "none" : `0.063rem solid ${
|
|
279
|
+
const borderStyle = useMemo(() => noBorders ? "none" : `0.063rem solid ${variant.row.ruleColor}`, [noBorders, variant.row.ruleColor]);
|
|
250
280
|
// Selected-row tint applied per-cell (NOT a blanket `& td` override) so status
|
|
251
281
|
// cells keep their solid color + white text instead of white-on-tint.
|
|
252
|
-
const selectedBg =
|
|
282
|
+
const selectedBg = variant.row.selectedBg;
|
|
253
283
|
// Sticky/frozen cells overlay scrolling content, so their selected background
|
|
254
284
|
// must be OPAQUE — paint the (translucent) tint over an opaque base.
|
|
255
285
|
const selectedFrozenBg = `linear-gradient(0deg, ${selectedBg}, ${selectedBg}), ${theme.colors.background[50]}`;
|
|
256
286
|
// Dark mode lifts the hover fill to `table.hover[500]`; `[300]` sits ~1.2:1 from the canvas.
|
|
257
287
|
// No ink flip needed — see `tableRowHoverStyle.ts`.
|
|
258
|
-
const
|
|
259
|
-
const hoverStyle = useMemo(() => getTableRowHoverStyle(theme.colors, isDark), [theme.colors, isDark]);
|
|
288
|
+
const hoverStyle = useMemo(() => ({ backgroundColor: variant.row.hoverBg }), [variant.row.hoverBg]);
|
|
260
289
|
// Flatten groups → one sequence of header/row items so it can be windowed.
|
|
261
290
|
// Independent of scrollTop, so scrolling reuses it instead of re-flattening.
|
|
262
291
|
const groupItems = useMemo(() => {
|
|
@@ -285,7 +314,7 @@ const TableBody = ({ data, isCheckbox, columns, startRow, columnWidths, freezedB
|
|
|
285
314
|
return { heights, offsets, totalH: acc };
|
|
286
315
|
}, [groupItems, groupVirtualize, rowHeight, GROUP_HEADER_H]);
|
|
287
316
|
if (isLoading && data.length === 0) {
|
|
288
|
-
return (_jsx(TableBodyLoading, { noOfColumns: totalVisibleColumns, borderColor: theme.colors.boxborder[
|
|
317
|
+
return (_jsx(TableBodyLoading, { noOfColumns: totalVisibleColumns, borderColor: theme.colors.boxborder[200], rowsCount: typeof loadingSkeletonRows === "number" ? loadingSkeletonRows : 4 }));
|
|
289
318
|
}
|
|
290
319
|
if (!isLoading && data.length === 0) {
|
|
291
320
|
const isStructured = emptyState && typeof emptyState === "object" && !React.isValidElement(emptyState);
|
|
@@ -5,6 +5,6 @@ import { useCustomTheme } from "../../../Theme/useCustomTheme.js";
|
|
|
5
5
|
/** Monday-style colored, collapsible group header row. */
|
|
6
6
|
export const TableGroupRow = ({ label, value, count, color, collapsed, colSpan, ariaRowIndex, onToggle, onAddItem, }) => {
|
|
7
7
|
const theme = useCustomTheme();
|
|
8
|
-
return (_jsx(Tr, { "aria-rowindex": ariaRowIndex, children: _jsx(Td, { colSpan: colSpan, p: 0, border: "none", children: _jsxs(Flex, { align: "center", gap: 2, px: 3, py: 2, bg: color.soft, boxShadow: `inset 4px 0 0 ${color.solid}`, borderBottom: `0.063rem solid ${theme.colors.
|
|
8
|
+
return (_jsx(Tr, { "aria-rowindex": ariaRowIndex, children: _jsx(Td, { colSpan: colSpan, p: 0, border: "none", children: _jsxs(Flex, { align: "center", gap: 2, px: 3, py: 2, bg: color.soft, boxShadow: `inset 4px 0 0 ${color.solid}`, borderBottom: `0.063rem solid ${theme.colors.boxborder[200]}`, children: [_jsx(IconButton, { "aria-label": collapsed ? "Expand group" : "Collapse group", size: "xs", variant: "ghost", color: color.text, onClick: onToggle, icon: collapsed ? _jsx(ChevronRight, { size: 16 }) : _jsx(ChevronDown, { size: 16 }) }), _jsx(Text, { fontSize: "0.8125rem", fontWeight: 700, color: color.text, isTruncated: true, maxW: "20rem", children: label }), _jsx(Box, { as: "span", fontSize: "0.6875rem", fontWeight: 600, color: color.text, bg: theme.colors.background[50], borderRadius: "full", px: "0.5rem", py: "0.0625rem", children: count }), onAddItem && (_jsxs(Flex, { as: "button", type: "button", align: "center", gap: 1, ml: "auto", px: 2, py: 1, borderRadius: "md", fontSize: "0.75rem", fontWeight: 500, color: theme.colors.text[500], _hover: { bg: theme.colors.background[50], color: color.text }, onClick: () => onAddItem(value), children: [_jsx(Plus, { size: 14 }), " Add item"] }))] }) }) }));
|
|
9
9
|
};
|
|
10
10
|
export default TableGroupRow;
|