pixelize-design-library 2.4.2-beta.5 → 2.4.2
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/Button/Button.d.ts +2 -2
- package/dist/Components/Button/Button.js +3 -3
- package/dist/Components/Button/Button.styles.js +29 -3
- package/dist/Components/Button/ButtonProps.d.ts +6 -1
- package/dist/Components/ButtonGroupIcon/ButtonGroupIcon.js +1 -1
- 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/DatePicker/RangeDatePicker.js +1 -1
- package/dist/Components/DatePicker/SingleDatePicker.js +1 -1
- package/dist/Components/FileUpload/FileUpload.js +3 -2
- package/dist/Components/FileUpload/FileUploadProps.d.ts +3 -1
- package/dist/Components/FileUpload/constants.js +1 -0
- package/dist/Components/FilterSidebar/FilterSidebar.js +2 -2
- package/dist/Components/Form/FormWrapper.js +1 -1
- package/dist/Components/Input/TextInput.styles.js +6 -8
- package/dist/Components/InputTextArea/InputTextArea.style.js +5 -4
- package/dist/Components/NavigationBar/NavigationBar.js +3 -3
- package/dist/Components/NoteTextArea/NoteTextArea.js +5 -3
- package/dist/Components/NumberInput/NumberInput.js +3 -1
- package/dist/Components/NumberInput/NumberInput.styles.js +5 -4
- package/dist/Components/Primitives/Primitives.d.ts +6 -0
- package/dist/Components/Primitives/Primitives.js +113 -0
- package/dist/Components/ProfileCard/ProfileCard.js +1 -1
- package/dist/Components/RadioButton/RadioButton.js +1 -1
- package/dist/Components/Search/Search.js +2 -2
- package/dist/Components/SearchSelect/SearchSelect.js +2 -1
- package/dist/Components/Select/Select.d.ts +1 -1
- package/dist/Components/Select/Select.js +4 -2
- package/dist/Components/Select/Select.styles.js +2 -1
- package/dist/Components/Select/SelectProps.d.ts +3 -0
- package/dist/Components/SelectSearch/SelectSearch.js +1 -1
- package/dist/Components/SelectV2/SelectV2.js +3 -2
- package/dist/Components/SideBar/SecondaryBar.js +1 -1
- package/dist/Components/SideBar/SideBar.js +1 -1
- package/dist/Components/Table/Table.d.ts +1 -1
- package/dist/Components/Table/Table.js +10 -4
- package/dist/Components/Table/TableProps.d.ts +4 -0
- package/dist/Components/Table/components/Pagination.js +1 -1
- package/dist/Components/Table/components/TableActions.js +2 -2
- package/dist/Components/Table/components/TableBody.js +40 -11
- 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/settings/ManageColumns.js +1 -1
- package/dist/Components/Table/settings/TableSettings.js +2 -2
- 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/Trail/TrailWorks.js +1 -1
- package/dist/Theme/chakra/Menu.styles.d.ts +2 -0
- package/dist/Theme/chakra/Menu.styles.js +5 -3
- package/dist/Theme/chakra/Popover.styles.d.ts +3 -0
- package/dist/Theme/chakra/Popover.styles.js +5 -1
- package/dist/Theme/chakra/componentStyles.d.ts +5 -0
- package/dist/Theme/provider/ThemeSwitcher.js +5 -2
- package/dist/Theme/tokens/builders/chartColorsFromTheme.js +1 -1
- package/dist/Theme/tokens/builders/index.d.ts +1 -0
- package/dist/Theme/tokens/builders/index.js +1 -0
- package/dist/Theme/tokens/builders/outlineRung.d.ts +27 -3
- package/dist/Theme/tokens/builders/outlineRung.js +55 -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/surfaceRungs.d.ts +5 -2
- package/dist/Theme/tokens/builders/surfaceRungs.js +19 -9
- package/dist/esm/Components/Button/Button.js +4 -4
- package/dist/esm/Components/Button/Button.styles.js +29 -3
- package/dist/esm/Components/ButtonGroupIcon/ButtonGroupIcon.js +1 -1
- 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/DatePicker/RangeDatePicker.js +1 -1
- package/dist/esm/Components/DatePicker/SingleDatePicker.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 +2 -2
- package/dist/esm/Components/Form/FormWrapper.js +1 -1
- package/dist/esm/Components/Input/TextInput.styles.js +6 -8
- package/dist/esm/Components/InputTextArea/InputTextArea.style.js +5 -4
- package/dist/esm/Components/NavigationBar/NavigationBar.js +3 -3
- package/dist/esm/Components/NoteTextArea/NoteTextArea.js +5 -3
- package/dist/esm/Components/NumberInput/NumberInput.js +4 -2
- package/dist/esm/Components/NumberInput/NumberInput.styles.js +5 -4
- package/dist/esm/Components/Primitives/Primitives.js +6 -0
- package/dist/esm/Components/ProfileCard/ProfileCard.js +1 -1
- package/dist/esm/Components/RadioButton/RadioButton.js +1 -1
- package/dist/esm/Components/Search/Search.js +2 -2
- package/dist/esm/Components/SearchSelect/SearchSelect.js +2 -1
- package/dist/esm/Components/Select/Select.js +5 -3
- package/dist/esm/Components/Select/Select.styles.js +2 -1
- package/dist/esm/Components/SelectSearch/SelectSearch.js +1 -1
- package/dist/esm/Components/SelectV2/SelectV2.js +3 -2
- package/dist/esm/Components/SideBar/SecondaryBar.js +1 -1
- package/dist/esm/Components/SideBar/SideBar.js +1 -1
- package/dist/esm/Components/Table/Table.js +10 -4
- package/dist/esm/Components/Table/components/Pagination.js +1 -1
- package/dist/esm/Components/Table/components/TableActions.js +2 -2
- package/dist/esm/Components/Table/components/TableBody.js +41 -12
- 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/settings/ManageColumns.js +1 -1
- package/dist/esm/Components/Table/settings/TableSettings.js +2 -2
- 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/Trail/TrailWorks.js +1 -1
- package/dist/esm/Theme/chakra/Menu.styles.js +5 -3
- package/dist/esm/Theme/chakra/Popover.styles.js +5 -1
- package/dist/esm/Theme/provider/ThemeSwitcher.js +5 -2
- package/dist/esm/Theme/tokens/builders/chartColorsFromTheme.js +1 -1
- package/dist/esm/Theme/tokens/builders/index.js +1 -0
- package/dist/esm/Theme/tokens/builders/outlineRung.js +52 -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/surfaceRungs.js +20 -10
- package/dist/esm/index.js +2 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +9 -1
- package/package.json +4 -2
|
@@ -44,10 +44,11 @@ const useCustomTheme_1 = require("../../../Theme/useCustomTheme");
|
|
|
44
44
|
const accentText_1 = require("../../../Theme/tokens/builders/accentText");
|
|
45
45
|
const TableLoading_1 = require("./TableLoading");
|
|
46
46
|
const TableActions_1 = __importDefault(require("./TableActions"));
|
|
47
|
-
const tableRowHoverStyle_1 = require("./tableRowHoverStyle");
|
|
48
47
|
const lucide_react_1 = require("lucide-react");
|
|
49
48
|
const Checkbox_1 = __importDefault(require("../../Checkbox/Checkbox"));
|
|
50
49
|
const TableGroupRow_1 = __importDefault(require("./TableGroupRow"));
|
|
50
|
+
const TableVariantContext_1 = require("../variants/TableVariantContext");
|
|
51
|
+
const pillInk_1 = require("../variants/pillInk");
|
|
51
52
|
// Density → row height (px) + cell vertical padding. The padding (not just the
|
|
52
53
|
// min-height) is what drives perceived row size, so compact tightens both.
|
|
53
54
|
const DENSITY_CONFIG = {
|
|
@@ -63,6 +64,9 @@ const getRowContent = (row) => typeof row.content === "function"
|
|
|
63
64
|
// the label is centered in whichever of white/black clears AA against that fill —
|
|
64
65
|
// the fill can be a consumer hex we can't know in advance is light or dark.
|
|
65
66
|
const StatusCell = ({ value, onSolid }) => ((0, jsx_runtime_1.jsx)(react_1.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 }));
|
|
67
|
+
// Studio's status cell: a contained chip on the tone's soft rung. Same tone pair
|
|
68
|
+
// the group header already uses, so an override hex behaves identically in both.
|
|
69
|
+
const StatusPill = ({ value, soft, ink, radius, }) => ((0, jsx_runtime_1.jsx)(react_1.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 }));
|
|
66
70
|
const EMPTY_HOVER = {};
|
|
67
71
|
const TableRow = react_2.default.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, }) => {
|
|
68
72
|
// Measured-height virtualization: report this row's real height (main + any
|
|
@@ -101,15 +105,38 @@ const TableRow = react_2.default.memo(({ row, rowIndex, isChecked, isExpanded, i
|
|
|
101
105
|
onRowClick(row, { label: header.label, id: header.id });
|
|
102
106
|
}
|
|
103
107
|
}, [row, onRowClick]);
|
|
108
|
+
const variant = (0, TableVariantContext_1.useTableVariant)();
|
|
104
109
|
const firstDataColIndex = columns.findIndex((c) => !c.isHidden);
|
|
105
110
|
const accentSx = accentColor ? `inset 3px 0 0 ${accentColor}` : undefined;
|
|
111
|
+
// A selected row earns the leading bar only where a group accent isn't already
|
|
112
|
+
// claiming that edge — the group's identity is the scarcer signal.
|
|
113
|
+
const leadSx = variant.row.showSelectedBar && isChecked && !accentColor
|
|
114
|
+
? `inset 3px 0 0 ${variant.row.selectedBarColor}`
|
|
115
|
+
: accentSx;
|
|
116
|
+
const restsOnIndex = variant.slot.rest === "index";
|
|
117
|
+
const rowSx = {
|
|
118
|
+
...(variant.row.hoverScope === "row"
|
|
119
|
+
? { "&:hover > td[data-hoverable='true']": { backgroundColor: variant.row.hoverBg } }
|
|
120
|
+
: {}),
|
|
121
|
+
// opacity, not display: a hidden-by-display checkbox leaves the a11y tree and
|
|
122
|
+
// cannot be tabbed to, so `:focus-within` would never fire to bring it back.
|
|
123
|
+
...(restsOnIndex
|
|
124
|
+
? {
|
|
125
|
+
"& .table-slot-box": { opacity: isChecked ? 1 : 0 },
|
|
126
|
+
"& .table-slot-index": { opacity: isChecked ? 0 : 1 },
|
|
127
|
+
"&:hover .table-slot-box, &:focus-within .table-slot-box": { opacity: 1 },
|
|
128
|
+
"&:hover .table-slot-index, &:focus-within .table-slot-index": { opacity: 0 },
|
|
129
|
+
}
|
|
130
|
+
: {}),
|
|
131
|
+
};
|
|
106
132
|
// Pinned/frozen columns get a tinted, opaque background so the frozen pane reads
|
|
107
133
|
// as one piece with its header (and so sticky cells cover scrolling content).
|
|
108
134
|
const frozenCellBg = freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.table.hover[100];
|
|
109
135
|
const cellStyles = row.cellStyle;
|
|
110
136
|
const rowStyle = row.rowStyle;
|
|
137
|
+
const chromeHoverable = rowStyle ? "false" : "true";
|
|
111
138
|
const rowContent = getRowContent(row);
|
|
112
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.default.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_1.Tr, { ref: mainRowRef, "aria-rowindex": ariaRowIndex, opacity: isLoading ? 0.4 : 1, pointerEvents: isLoading ? "none" : "auto", transition: "opacity 0.2s", children: [isContent && ((0, jsx_runtime_1.jsx)(react_1.Td, { w: "6", p: 0, fontSize: 14, background: isChecked ? selectedFrozenBg : frozenCellBg, color: freezedTextColor, position: "sticky", borderBottom: borderStyle, boxShadow:
|
|
139
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.default.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_1.Tr, { ref: mainRowRef, "aria-rowindex": ariaRowIndex, opacity: isLoading ? 0.4 : 1, pointerEvents: isLoading ? "none" : "auto", transition: "opacity 0.2s", sx: rowSx, children: [isContent && ((0, jsx_runtime_1.jsx)(react_1.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) && ((0, jsx_runtime_1.jsx)(react_1.IconButton, { "aria-label": isExpanded ? "Collapse row" : "Expand row", color: theme.colors.textMuted, icon: isExpanded ? ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { fontSize: 16 })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { fontSize: 16 })), _hover: { transform: "scale(1.1)" }, size: "sm", onClick: () => toggleRowExpansion(rowIndex), variant: "ghost" })) })), isCheckbox && ((0, jsx_runtime_1.jsx)(react_1.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: (0, jsx_runtime_1.jsxs)(react_1.Box, { display: restsOnIndex ? "grid" : undefined, placeItems: "center", children: [restsOnIndex && ((0, jsx_runtime_1.jsx)(react_1.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 })), (0, jsx_runtime_1.jsx)(react_1.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: (0, jsx_runtime_1.jsx)(Checkbox_1.default, { "aria-label": `Select row ${rowIndex + 1}`, onChange: () => handleCheckbox(getRowId(row)), isChecked: isChecked }) })] }) })), columns.map((header, headerIndex) => {
|
|
113
140
|
var _a, _b, _c;
|
|
114
141
|
if (header.isHidden)
|
|
115
142
|
return null;
|
|
@@ -124,13 +151,15 @@ const TableRow = react_2.default.memo(({ row, rowIndex, isChecked, isExpanded, i
|
|
|
124
151
|
const statusOnSolid = statusColor
|
|
125
152
|
? (_c = statusColor.onSolid) !== null && _c !== void 0 ? _c : (0, accentText_1.onFilled)(statusColor.solid, theme.colors.white, theme.colors.black)
|
|
126
153
|
: undefined;
|
|
127
|
-
|
|
154
|
+
const isBleed = variant.cells.statusFill === "bleed" && !!statusColor;
|
|
155
|
+
const canHover = !isBleed && !((cellStyles === null || cellStyles === void 0 ? void 0 : cellStyles[header.id]) || rowStyle);
|
|
156
|
+
return ((0, jsx_runtime_1.jsx)(react_1.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
|
|
128
157
|
? "none"
|
|
129
|
-
: `0.063rem solid ${
|
|
158
|
+
: `0.063rem solid ${isFrozen || isChecked
|
|
159
|
+
? variant.row.frozenRuleColor
|
|
160
|
+
: 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
|
|
130
161
|
? EMPTY_HOVER
|
|
131
|
-
:
|
|
132
|
-
? EMPTY_HOVER
|
|
133
|
-
: hoverStyle, children: isStatus && statusColor ? ((0, jsx_runtime_1.jsx)(StatusCell, { value: (0, table_1.normalizeTableCellValue)(row[header.id]), onSolid: statusOnSolid })) : ((0, jsx_runtime_1.jsx)(react_1.Box, { display: "block", overflow: "hidden", whiteSpace: "normal", overflowWrap: "break-word", children: (0, table_1.normalizeTableCellValue)(header.node ? header.node(row) : row[header.id]) })) }, headerIndex + 1));
|
|
162
|
+
: hoverStyle, children: isBleed ? ((0, jsx_runtime_1.jsx)(StatusCell, { value: (0, table_1.normalizeTableCellValue)(row[header.id]), onSolid: statusOnSolid })) : isStatus && statusColor ? ((0, jsx_runtime_1.jsx)(StatusPill, { value: (0, table_1.normalizeTableCellValue)(row[header.id]), soft: statusColor.soft, ink: (0, pillInk_1.resolvePillInk)(statusColor.text, statusColor.soft, theme.colors.background[50]), radius: variant.cells.pillRadius })) : ((0, jsx_runtime_1.jsx)(react_1.Box, { display: "block", overflow: "hidden", whiteSpace: "normal", overflowWrap: "break-word", children: (0, table_1.normalizeTableCellValue)(header.node ? header.node(row) : row[header.id]) })) }, headerIndex + 1));
|
|
134
163
|
}), isLink && ((0, jsx_runtime_1.jsx)(react_1.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) ? ((0, jsx_runtime_1.jsx)(TableActions_1.default, { row: row })) : null }))] }), rowContent && isExpanded && ((0, jsx_runtime_1.jsx)(react_1.Tr, { ref: expandedRowRef, children: (0, jsx_runtime_1.jsx)(react_1.Td, { colSpan: columns.length +
|
|
135
164
|
(isCheckbox ? 1 : 0) +
|
|
136
165
|
(isContent ? 1 : 0) +
|
|
@@ -139,6 +168,7 @@ const TableRow = react_2.default.memo(({ row, rowIndex, isChecked, isExpanded, i
|
|
|
139
168
|
const TableBody = ({ data, isCheckbox, columns, startRow, columnWidths, freezedBgColor, freezedTextColor, noBorders, handleCheckbox, selections, isLoading, onRowClick, isContent, isLink, isActionFreeze, loadingSkeletonRows, scrollContainerRef, density, accentColors, groups, onAddItem, emptyState, }) => {
|
|
140
169
|
var _a, _b, _c;
|
|
141
170
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
171
|
+
const variant = (0, TableVariantContext_1.useTableVariant)();
|
|
142
172
|
const [expandedRows, setExpandedRows] = (0, react_2.useState)(new Set());
|
|
143
173
|
const [collapsedGroups, setCollapsedGroups] = (0, react_2.useState)(new Set());
|
|
144
174
|
const toggleGroup = (0, react_2.useCallback)((value) => {
|
|
@@ -284,17 +314,16 @@ const TableBody = ({ data, isCheckbox, columns, startRow, columnWidths, freezedB
|
|
|
284
314
|
const checkboxOffset = isCheckbox ? 50 : 0;
|
|
285
315
|
return columnWidths.map((_, idx) => columnWidths.slice(0, idx).reduce((sum, w) => sum + w, 0) + checkboxOffset);
|
|
286
316
|
}, [columnWidths, isCheckbox]);
|
|
287
|
-
const borderStyle = (0, react_2.useMemo)(() => noBorders ? "none" : `0.063rem solid ${
|
|
317
|
+
const borderStyle = (0, react_2.useMemo)(() => noBorders ? "none" : `0.063rem solid ${variant.row.ruleColor}`, [noBorders, variant.row.ruleColor]);
|
|
288
318
|
// Selected-row tint applied per-cell (NOT a blanket `& td` override) so status
|
|
289
319
|
// cells keep their solid color + white text instead of white-on-tint.
|
|
290
|
-
const selectedBg =
|
|
320
|
+
const selectedBg = variant.row.selectedBg;
|
|
291
321
|
// Sticky/frozen cells overlay scrolling content, so their selected background
|
|
292
322
|
// must be OPAQUE — paint the (translucent) tint over an opaque base.
|
|
293
323
|
const selectedFrozenBg = `linear-gradient(0deg, ${selectedBg}, ${selectedBg}), ${theme.colors.background[50]}`;
|
|
294
324
|
// Dark mode lifts the hover fill to `table.hover[500]`; `[300]` sits ~1.2:1 from the canvas.
|
|
295
325
|
// No ink flip needed — see `tableRowHoverStyle.ts`.
|
|
296
|
-
const
|
|
297
|
-
const hoverStyle = (0, react_2.useMemo)(() => (0, tableRowHoverStyle_1.getTableRowHoverStyle)(theme.colors, isDark), [theme.colors, isDark]);
|
|
326
|
+
const hoverStyle = (0, react_2.useMemo)(() => ({ backgroundColor: variant.row.hoverBg }), [variant.row.hoverBg]);
|
|
298
327
|
// Flatten groups → one sequence of header/row items so it can be windowed.
|
|
299
328
|
// Independent of scrollTop, so scrolling reuses it instead of re-flattening.
|
|
300
329
|
const groupItems = (0, react_2.useMemo)(() => {
|
|
@@ -8,7 +8,7 @@ const useCustomTheme_1 = require("../../../Theme/useCustomTheme");
|
|
|
8
8
|
/** Monday-style colored, collapsible group header row. */
|
|
9
9
|
const TableGroupRow = ({ label, value, count, color, collapsed, colSpan, ariaRowIndex, onToggle, onAddItem, }) => {
|
|
10
10
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Tr, { "aria-rowindex": ariaRowIndex, children: (0, jsx_runtime_1.jsx)(react_1.Td, { colSpan: colSpan, p: 0, border: "none", children: (0, jsx_runtime_1.jsxs)(react_1.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.
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Tr, { "aria-rowindex": ariaRowIndex, children: (0, jsx_runtime_1.jsx)(react_1.Td, { colSpan: colSpan, p: 0, border: "none", children: (0, jsx_runtime_1.jsxs)(react_1.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: [(0, jsx_runtime_1.jsx)(react_1.IconButton, { "aria-label": collapsed ? "Expand group" : "Collapse group", size: "xs", variant: "ghost", color: color.text, onClick: onToggle, icon: collapsed ? (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 16 }) : (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { size: 16 }) }), (0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "0.8125rem", fontWeight: 700, color: color.text, isTruncated: true, maxW: "20rem", children: label }), (0, jsx_runtime_1.jsx)(react_1.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 && ((0, jsx_runtime_1.jsxs)(react_1.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: [(0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { size: 14 }), " Add item"] }))] }) }) }));
|
|
12
12
|
};
|
|
13
13
|
exports.TableGroupRow = TableGroupRow;
|
|
14
14
|
exports.default = exports.TableGroupRow;
|
|
@@ -12,6 +12,7 @@ const accentText_1 = require("../../../Theme/tokens/builders/accentText");
|
|
|
12
12
|
const TableFilters_1 = __importDefault(require("../filters/TableFilters"));
|
|
13
13
|
const lucide_react_1 = require("lucide-react");
|
|
14
14
|
const Checkbox_1 = __importDefault(require("../../Checkbox/Checkbox"));
|
|
15
|
+
const TableVariantContext_1 = require("../variants/TableVariantContext");
|
|
15
16
|
const TableHeader = ({ columns, isCheckbox, handleSort, headerRefs, columnWidths, columnsSort, headerBgColor, freezedBgColor, freezedTextColor, noBorders, handleCheckbox, checked, isLoading, isContent, isLink, isActionFreeze, setColumnsSearch, columnsSearch, isSelecting, }) => {
|
|
16
17
|
const [openFilterId, setOpenFilterId] = (0, react_2.useState)(null);
|
|
17
18
|
return ((0, jsx_runtime_1.jsxs)(react_1.Tr, { pr: 0, "aria-rowindex": 1, children: [isContent && (0, jsx_runtime_1.jsx)(ContentSpacerCell, { noBorders: noBorders }), isCheckbox && ((0, jsx_runtime_1.jsx)(SelectAllCell, { freezedTextColor: freezedTextColor, noBorders: noBorders, isSelecting: isSelecting, isLoading: isLoading, checked: checked, handleCheckbox: handleCheckbox })), columns.map((header, index) => {
|
|
@@ -23,30 +24,33 @@ const TableHeader = ({ columns, isCheckbox, handleSort, headerRefs, columnWidths
|
|
|
23
24
|
exports.default = (0, react_2.memo)(TableHeader);
|
|
24
25
|
const SelectAllCell = (0, react_2.memo)(({ freezedTextColor, noBorders, isSelecting, isLoading, checked, handleCheckbox, }) => {
|
|
25
26
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
26
|
-
|
|
27
|
+
const variant = (0, TableVariantContext_1.useTableVariant)();
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Th, { scope: "col", 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: freezedTextColor, textTransform: "capitalize", backgroundColor: variant.header.bg, position: "sticky", className: `columns sticky-columns`, left: "0px", zIndex: 9, borderBottom: noBorders ? "none" : `0.063rem solid ${variant.header.ruleColor}`, children: (0, jsx_runtime_1.jsx)(react_1.Box, { display: "flex", alignItems: "center", justifyContent: variant.slot.centered ? "center" : "flex-start", children: isSelecting ? ((0, jsx_runtime_1.jsx)(react_1.Spinner, { size: "sm", color: theme.colors.accentText })) : ((0, jsx_runtime_1.jsx)(Checkbox_1.default, { "aria-label": "Select all rows", variant: "outline", onChange: () => handleCheckbox(0), isChecked: isLoading ? false : checked === true, isIndeterminate: checked === "indeterminate" })) }) }));
|
|
27
29
|
});
|
|
28
30
|
const ContentSpacerCell = (0, react_2.memo)(({ noBorders }) => {
|
|
29
|
-
const
|
|
30
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Th, { scope: "col", w: 6, minW: "35px", p: 0, backgroundColor:
|
|
31
|
+
const variant = (0, TableVariantContext_1.useTableVariant)();
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Th, { scope: "col", w: 6, minW: "35px", p: 0, backgroundColor: variant.header.bg, borderBottom: noBorders ? "none" : `0.063rem solid ${variant.header.ruleColor}`, position: "sticky", className: `columns sticky-columns`, left: "0px", zIndex: 1 }));
|
|
31
33
|
});
|
|
32
34
|
const ViewSpacerCell = (0, react_2.memo)(({ noBorders, isActionFreeze, }) => {
|
|
33
|
-
const
|
|
34
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Th, { scope: "col", w: 2, p: 0, minW: "2.065rem", backgroundColor:
|
|
35
|
+
const variant = (0, TableVariantContext_1.useTableVariant)();
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Th, { scope: "col", w: 2, p: 0, minW: "2.065rem", backgroundColor: variant.header.bg, borderBottom: noBorders ? "none" : `0.063rem solid ${variant.header.ruleColor}`, position: isActionFreeze ? "sticky" : "relative", className: `columns sticky-columns`, right: "0px", zIndex: 1 }));
|
|
35
37
|
});
|
|
36
38
|
const SortingIcon = (0, react_2.memo)(({ label, sortState, isVisible, handleSortClick, }) => {
|
|
37
39
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
40
|
+
const variant = (0, TableVariantContext_1.useTableVariant)();
|
|
38
41
|
return ((0, jsx_runtime_1.jsxs)(react_1.Box, { as: "button", type: "button", "aria-label": `Sort by ${label}`, display: "inline-flex", alignItems: "center", justifyContent: "center", cursor: "pointer", ml: 2, p: 0, border: "none", bg: "transparent", lineHeight: "1", onClick: handleSortClick, transition: "color 0.2s ease-in-out, opacity 0.2s ease-in-out",
|
|
39
42
|
// Kept out of view until hover/focus so the header looks exactly as it did,
|
|
40
43
|
// while staying in the DOM and reachable by Tab.
|
|
41
44
|
opacity: isVisible ? 1 : 0, _focus: { opacity: 1 }, _focusVisible: { opacity: 1 }, color: theme.colors.textMuted, _hover: {
|
|
42
45
|
opacity: 1,
|
|
43
|
-
color: (0, accentText_1.accentTextOnCanvas)(theme.colors.secondary,
|
|
46
|
+
color: (0, accentText_1.accentTextOnCanvas)(theme.colors.secondary, variant.header.bg),
|
|
44
47
|
}, children: [sortState === "none" && (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { size: 14 }), sortState === "asc" && (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronUp, { size: 14 }), sortState === "desc" && (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { size: 14 })] }));
|
|
45
48
|
});
|
|
46
49
|
const ColumnHeader = (0, react_2.memo)(({ header, index, columnWidths, isCheckbox, noBorders, columnsSort, headerRefs, columnsSearch, setColumnsSearch, handleSort, openFilterId, setOpenFilterId, }) => {
|
|
47
50
|
var _a;
|
|
48
51
|
const [isHovered, setIsHovered] = (0, react_2.useState)(false);
|
|
49
52
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
53
|
+
const variant = (0, TableVariantContext_1.useTableVariant)();
|
|
50
54
|
const isFrozen = header.isFreeze;
|
|
51
55
|
const leftOffset = isFrozen
|
|
52
56
|
? (0, table_1.calculateLeftOffset)(columnWidths, index) + (isCheckbox ? 50 : 0)
|
|
@@ -82,7 +86,16 @@ const ColumnHeader = (0, react_2.memo)(({ header, index, columnWidths, isCheckbo
|
|
|
82
86
|
document.addEventListener("mouseup", onMouseUp);
|
|
83
87
|
};
|
|
84
88
|
const isSortActive = !!(isSorting === null || isSorting === void 0 ? void 0 : isSorting.direction) && isSorting.direction !== "none";
|
|
85
|
-
|
|
89
|
+
// Studio keeps the kebab out of the resting header — nine of them read louder than
|
|
90
|
+
// the labels. A column that is filtering or sorting keeps its control on show.
|
|
91
|
+
const showActions = variant.header.actions === "always" ||
|
|
92
|
+
isHovered ||
|
|
93
|
+
isSortActive ||
|
|
94
|
+
openFilterId === header.id ||
|
|
95
|
+
!!columnsSearch[header.id];
|
|
96
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Th, { scope: "col", ref: (el) => (headerRefs.current[index] = el), "aria-sort": ariaSort, textTransform: variant.header.textTransform, fontSize: variant.header.fontSize, fontWeight: variant.header.fontWeight, letterSpacing: variant.header.letterSpacing, position: isFrozen ? "sticky" : undefined, left: isFrozen ? leftOffset : undefined, minWidth: 120, backgroundColor: variant.header.bg, maxWidth: 500, zIndex: isFrozen ? 2 : 1, py: 2, pr: 0, overflow: "hidden", borderTop: "none", borderBottom: noBorders ? "none" : `0.063rem solid ${variant.header.ruleColor}`, borderRight: noBorders || !variant.header.showColumnRule
|
|
97
|
+
? "none"
|
|
98
|
+
: `0.063rem solid ${variant.header.ruleColor}`, className: `columns ${isFrozen ? "sticky-columns" : "scrollable-columns"}`, height: variant.header.height, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: (0, jsx_runtime_1.jsxs)(react_1.Box, { display: "flex", color: variant.header.ink, lineHeight: "1.25rem", justifyContent: "space-between", alignItems: "center", position: "relative", children: [(0, jsx_runtime_1.jsx)(react_1.Box, { textOverflow: "ellipsis", whiteSpace: "nowrap", display: "inline-block", overflow: "hidden", children: header.label }), (0, jsx_runtime_1.jsxs)(react_1.Box, { display: "inline-flex", alignItems: "center", opacity: showActions ? 1 : 0, transition: "opacity 0.2s ease-in-out", _focusWithin: { opacity: 1 }, children: [header.isSort && ((0, jsx_runtime_1.jsx)(SortingIcon, { label: String(header.label), sortState: (_a = isSorting === null || isSorting === void 0 ? void 0 : isSorting.direction) !== null && _a !== void 0 ? _a : "none", isVisible: isHovered || isSortActive, handleSortClick: () => {
|
|
86
99
|
let direction = "asc";
|
|
87
100
|
if ((isSorting === null || isSorting === void 0 ? void 0 : isSorting.direction) === "asc") {
|
|
88
101
|
direction = "desc";
|
|
@@ -91,7 +104,7 @@ const ColumnHeader = (0, react_2.memo)(({ header, index, columnWidths, isCheckbo
|
|
|
91
104
|
direction = "none";
|
|
92
105
|
}
|
|
93
106
|
handleSort(header.id, direction);
|
|
94
|
-
} })), sortPriority > 0 && ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "span", ml: 1, fontSize: "0.625rem", fontWeight: 700, lineHeight: "1", borderRadius: "full", px: "0.3rem", py: "0.1rem", bg: theme.colors.primary.opacity[16], color: (0, accentText_1.accentTextOnCanvas)(theme.colors.primary,
|
|
107
|
+
} })), sortPriority > 0 && ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "span", ml: 1, fontSize: "0.625rem", fontWeight: 700, lineHeight: "1", borderRadius: "full", px: "0.3rem", py: "0.1rem", bg: theme.colors.primary.opacity[16], color: (0, accentText_1.accentTextOnCanvas)(theme.colors.primary, variant.header.bg), children: sortPriority })), (0, jsx_runtime_1.jsx)(TableFilters_1.default, { header: header, setColumnsSearch: (searchVal) => setColumnsSearch((prev) => ({
|
|
95
108
|
...prev,
|
|
96
109
|
[header.id]: searchVal,
|
|
97
110
|
})), columnsSearch: columnsSearch[header.id] || "", onClose: () => {
|
|
@@ -30,6 +30,6 @@ const TableSearch = ({ onSearch }) => {
|
|
|
30
30
|
setQuery(value);
|
|
31
31
|
handleDebounce(value);
|
|
32
32
|
};
|
|
33
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.Box, { display: "flex", alignItems: "center", gap: "2", children: [!showInput && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: "Search", placement: "top", children: (0, jsx_runtime_1.jsx)(react_2.IconButton, { "aria-label": "Search", icon: (0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.Search, transform: "scaleX(-1)", boxSize: 5 }), variant: "unstyled", minW: "auto", h: "auto", display: "flex", cursor: "pointer", color: colors.text[500], onClick: handleSearchClick, _hover: { color: colors.accentText } }) })), showInput ? ((0, jsx_runtime_1.jsxs)(react_2.InputGroup, { maxW: "12.5rem", transition: "all 0.3s ease", children: [(0, jsx_runtime_1.jsx)(react_2.Input, { placeholder: "Search...", value: query, onChange: handleInputChange, size: "sm", borderRadius: "md", borderColor: colors.
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Box, { display: "flex", alignItems: "center", gap: "2", children: [!showInput && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: "Search", placement: "top", children: (0, jsx_runtime_1.jsx)(react_2.IconButton, { "aria-label": "Search", icon: (0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.Search, transform: "scaleX(-1)", boxSize: 5 }), variant: "unstyled", minW: "auto", h: "auto", display: "flex", cursor: "pointer", color: colors.text[500], onClick: handleSearchClick, _hover: { color: colors.accentText } }) })), showInput ? ((0, jsx_runtime_1.jsxs)(react_2.InputGroup, { maxW: "12.5rem", transition: "all 0.3s ease", children: [(0, jsx_runtime_1.jsx)(react_2.Input, { placeholder: "Search...", value: query, onChange: handleInputChange, size: "sm", borderRadius: "md", borderColor: colors.boxborder[500], _focus: { borderColor: colors.accentText }, autoFocus: true }), (0, jsx_runtime_1.jsx)(react_2.InputRightElement, { display: "flex", alignItems: "center", height: "2rem", children: (0, jsx_runtime_1.jsx)(react_2.IconButton, { "aria-label": "Clear search", icon: (0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.X }), variant: "unstyled", minW: "auto", h: "auto", display: "flex", color: colors.text[500], cursor: "pointer", onClick: handleSearchClick }) })] })) : null] }));
|
|
34
34
|
};
|
|
35
35
|
exports.default = TableSearch;
|
|
@@ -87,7 +87,7 @@ const ManageColumns = ({ columns, items, setItems, childInputMethodsRef, }) => {
|
|
|
87
87
|
? theme.colors.primary[400]
|
|
88
88
|
: "transparent", cursor: "grab", fontSize: "13px", px: 2, py: "3px", mb: "3px", transition: "all 0.15s ease", _hover: {
|
|
89
89
|
bg: theme.colors.gray[50],
|
|
90
|
-
borderColor: theme.colors.
|
|
90
|
+
borderColor: theme.colors.boxborder[200],
|
|
91
91
|
}, _active: { cursor: "grabbing" }, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", "aria-hidden": "true", display: "inline-flex", cursor: "grab", mr: 1, _hover: { color: theme.colors.gray[500] }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.GripVertical, { size: 14 }) }), (0, jsx_runtime_1.jsx)(Checkbox_1.default, { isChecked: !item.isHidden, label: String(item.label), onChange: () => toggleCheckbox(item.id), size: "sm", labelSx: {
|
|
92
92
|
color: item.isHidden ? theme.colors.gray[500] : theme.colors.gray[700],
|
|
93
93
|
} }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "12px", color: theme.colors.gray[500], ml: 'auto', children: index + 1 }), (0, jsx_runtime_1.jsx)(react_2.IconButton, { "aria-label": `Move ${item.label} up`, icon: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronUp, { size: 14 }), variant: "ghost", size: "xs", ml: 1, minW: "auto", h: "auto", p: 0, color: theme.colors.gray[500], isDisabled: realIndex <= 0, onClick: () => moveItem(item.id, -1) }), (0, jsx_runtime_1.jsx)(react_2.IconButton, { "aria-label": `Move ${item.label} down`, icon: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { size: 14 }), variant: "ghost", size: "xs", ml: 1, minW: "auto", h: "auto", p: 0, color: theme.colors.gray[500], isDisabled: realIndex === -1 || realIndex >= items.length - 1, onClick: () => moveItem(item.id, 1) })] }, item.id));
|
|
@@ -53,7 +53,7 @@ const TableSettings = ({ columns, onSave, density = "normal", onDensityChange, g
|
|
|
53
53
|
return ((0, jsx_runtime_1.jsxs)(react_1.Box, { children: [(0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: "Table Settings", placement: "top", children: (0, jsx_runtime_1.jsx)(react_1.IconButton, { "aria-label": "Table settings", icon: (0, jsx_runtime_1.jsx)(lucide_react_1.Settings, { size: "1.25rem" }), onClick: handleOpen, variant: "unstyled", minW: "auto", h: "auto", display: "flex", justifyContent: "flex-end", cursor: "pointer", transition: "all 0.2s ease", color: theme.colors.text[500], _hover: {
|
|
54
54
|
transform: "scale(1.1)",
|
|
55
55
|
color: theme.colors.accentText
|
|
56
|
-
} }) }), (0, jsx_runtime_1.jsxs)(react_1.Modal, { isOpen: settingsOpen, onClose: () => setSettingsOpen(false), size: "md", children: [(0, jsx_runtime_1.jsx)(react_1.ModalOverlay, {}), (0, jsx_runtime_1.jsxs)(MotionModalContent, { mt: "0", top: "0", position: "absolute", borderTopRadius: "none", initial: { y: "-100%", opacity: 0 }, animate: { y: 0, opacity: 1 }, exit: { y: "-100%", opacity: 0 }, transition: { duration: 0.4, ease: "easeOut" }, padding: "0", minW: "620px", minH: "520px", maxH: "90vh", display: "flex", flexDirection: "column", bg: theme.colors.background[50], overflow: "hidden", children: [(0, jsx_runtime_1.jsx)(react_1.ModalCloseButton, { top: 3, right: 3, zIndex: 2 }), (0, jsx_runtime_1.jsxs)(react_1.Tabs, { index: selectedIndex, onChange: setSelectedIndex, variant: "unstyled", display: "flex", flexDirection: "column", flex: "1", minH: 0, children: [(0, jsx_runtime_1.jsxs)(react_1.Box, { pt: 4, px: 4, children: [(0, jsx_runtime_1.jsx)(react_1.Text, { fontWeight: 600, fontSize: "md", mb: 3, children: "Table Settings" }), (0, jsx_runtime_1.jsxs)(react_1.TabList, { gap: 0, borderBottom: "1px solid", borderColor: theme.colors.
|
|
56
|
+
} }) }), (0, jsx_runtime_1.jsxs)(react_1.Modal, { isOpen: settingsOpen, onClose: () => setSettingsOpen(false), size: "md", children: [(0, jsx_runtime_1.jsx)(react_1.ModalOverlay, {}), (0, jsx_runtime_1.jsxs)(MotionModalContent, { mt: "0", top: "0", position: "absolute", borderTopRadius: "none", initial: { y: "-100%", opacity: 0 }, animate: { y: 0, opacity: 1 }, exit: { y: "-100%", opacity: 0 }, transition: { duration: 0.4, ease: "easeOut" }, padding: "0", minW: "620px", minH: "520px", maxH: "90vh", display: "flex", flexDirection: "column", bg: theme.colors.background[50], overflow: "hidden", children: [(0, jsx_runtime_1.jsx)(react_1.ModalCloseButton, { top: 3, right: 3, zIndex: 2 }), (0, jsx_runtime_1.jsxs)(react_1.Tabs, { index: selectedIndex, onChange: setSelectedIndex, variant: "unstyled", display: "flex", flexDirection: "column", flex: "1", minH: 0, children: [(0, jsx_runtime_1.jsxs)(react_1.Box, { pt: 4, px: 4, children: [(0, jsx_runtime_1.jsx)(react_1.Text, { fontWeight: 600, fontSize: "md", mb: 3, children: "Table Settings" }), (0, jsx_runtime_1.jsxs)(react_1.TabList, { gap: 0, borderBottom: "1px solid", borderColor: theme.colors.boxborder[200], children: [(0, jsx_runtime_1.jsx)(react_1.Tab, { ...tabStyle, children: "Density" }), (0, jsx_runtime_1.jsx)(react_1.Tab, { ...tabStyle, children: "Manage Columns" }), (0, jsx_runtime_1.jsx)(react_1.Tab, { ...tabStyle, children: "Group" })] })] }), (0, jsx_runtime_1.jsx)(react_1.ModalBody, { px: 4, py: 3, flex: "1", overflowY: "auto", sx: (0, scrollbar_1.scrollbarStyles)(theme.colors), children: (0, jsx_runtime_1.jsxs)(react_1.TabPanels, { children: [(0, jsx_runtime_1.jsx)(react_1.TabPanel, { px: 0, py: 1, children: (0, jsx_runtime_1.jsx)(react_1.Flex, { direction: "column", gap: 2, children: DENSITY_OPTIONS.map((opt) => {
|
|
57
57
|
const selected = density === opt.value;
|
|
58
58
|
return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "button", type: "button", align: "center", gap: 3, px: 3, py: 2.5, borderRadius: "lg", border: "1px solid", borderColor: selected ? theme.colors.accentText : theme.colors.boxborder[200], bg: selected ? theme.colors.primary.opacity[8] : theme.colors.transparent, transition: "all 0.15s", _hover: { borderColor: theme.colors.accentText }, onClick: () => onDensityChange === null || onDensityChange === void 0 ? void 0 : onDensityChange(opt.value), children: [(0, jsx_runtime_1.jsx)(react_1.Box, { boxSize: "1.1rem", borderRadius: "full", border: "2px solid", borderColor: selected ? theme.colors.accentText : theme.colors.boxborder[500], display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0, children: selected && (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { size: 11, color: theme.colors.accentText, strokeWidth: 3 }) }), (0, jsx_runtime_1.jsxs)(react_1.Box, { textAlign: "left", children: [(0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "13px", fontWeight: 600, color: theme.colors.text[700], children: opt.label }), (0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "11px", color: theme.colors.textMuted, children: opt.desc })] })] }, opt.value));
|
|
59
59
|
}) }) }), (0, jsx_runtime_1.jsx)(react_1.TabPanel, { px: 0, py: 0, children: (0, jsx_runtime_1.jsx)(react_1.Box, { sx: {
|
|
@@ -74,6 +74,6 @@ const TableSettings = ({ columns, onSave, density = "normal", onDensityChange, g
|
|
|
74
74
|
var _a;
|
|
75
75
|
const selected = selectedGroup === opt.id;
|
|
76
76
|
return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "button", type: "button", align: "center", gap: 3, px: 3, py: 2.5, borderRadius: "lg", border: "1px solid", borderColor: selected ? theme.colors.accentText : theme.colors.boxborder[200], bg: selected ? theme.colors.primary.opacity[8] : theme.colors.transparent, transition: "all 0.15s", _hover: { borderColor: theme.colors.accentText }, onClick: () => setSelectedGroup(opt.id), children: [(0, jsx_runtime_1.jsx)(react_1.Box, { boxSize: "1.1rem", borderRadius: "full", border: "2px solid", borderColor: selected ? theme.colors.accentText : theme.colors.boxborder[500], display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0, children: selected && (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { size: 11, color: theme.colors.accentText, strokeWidth: 3 }) }), (0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "13px", fontWeight: 600, color: theme.colors.text[700], textAlign: "left", children: opt.label })] }, String((_a = opt.id) !== null && _a !== void 0 ? _a : "__none__")));
|
|
77
|
-
}) })] })] }) })] }), (0, jsx_runtime_1.jsxs)(react_1.ModalFooter, { gap: "0.5rem", borderTop: "1px solid", borderColor: theme.colors.
|
|
77
|
+
}) })] })] }) })] }), (0, jsx_runtime_1.jsxs)(react_1.ModalFooter, { gap: "0.5rem", borderTop: "1px solid", borderColor: theme.colors.boxborder[200], pt: 3, pb: 3, px: 4, children: [(0, jsx_runtime_1.jsx)(Button_1.default, { label: "Close", size: "sm", onClick: () => setSettingsOpen(false), variant: "outline", colorScheme: "red" }), (0, jsx_runtime_1.jsx)(Button_1.default, { label: "Save", size: "sm", onClick: handleSave })] })] })] })] }));
|
|
78
78
|
};
|
|
79
79
|
exports.default = TableSettings;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TableVariantTokens } from "./tokens";
|
|
2
|
+
export declare const TableVariantProvider: import("react").Provider<TableVariantTokens | null>;
|
|
3
|
+
/** No provider means the table as it always was — the default is a variant, not a gap. */
|
|
4
|
+
export declare function useTableVariant(): TableVariantTokens;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TableVariantProvider = void 0;
|
|
4
|
+
exports.useTableVariant = useTableVariant;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const useCustomTheme_1 = require("../../../Theme/useCustomTheme");
|
|
7
|
+
const accentText_1 = require("../../../Theme/tokens/builders/accentText");
|
|
8
|
+
const classic_1 = require("./classic");
|
|
9
|
+
const TableVariantContext = (0, react_1.createContext)(null);
|
|
10
|
+
exports.TableVariantProvider = TableVariantContext.Provider;
|
|
11
|
+
/** No provider means the table as it always was — the default is a variant, not a gap. */
|
|
12
|
+
function useTableVariant() {
|
|
13
|
+
const provided = (0, react_1.useContext)(TableVariantContext);
|
|
14
|
+
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
15
|
+
const isDark = (0, accentText_1.isDarkCanvas)(theme.colors.backgroundColor.main);
|
|
16
|
+
return (0, react_1.useMemo)(() => provided !== null && provided !== void 0 ? provided : (0, classic_1.classicPreset)(theme.colors, isDark), [provided, theme.colors, isDark]);
|
|
17
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.classicPreset = void 0;
|
|
4
|
+
const accentText_1 = require("../../../Theme/tokens/builders/accentText");
|
|
5
|
+
const tableRowHoverStyle_1 = require("../components/tableRowHoverStyle");
|
|
6
|
+
/**
|
|
7
|
+
* The table as it shipped. Pinned by snapshot: every value here is read off the
|
|
8
|
+
* live component, so adding a variant cannot move it.
|
|
9
|
+
*/
|
|
10
|
+
const classicPreset = (colors, isDark) => {
|
|
11
|
+
const headerBg = colors.table.hover[200];
|
|
12
|
+
return {
|
|
13
|
+
header: {
|
|
14
|
+
bg: headerBg,
|
|
15
|
+
ink: (0, accentText_1.accentTextOnCanvas)(colors.secondary, headerBg),
|
|
16
|
+
fontSize: 13,
|
|
17
|
+
fontWeight: 600,
|
|
18
|
+
textTransform: "capitalize",
|
|
19
|
+
letterSpacing: "normal",
|
|
20
|
+
height: "45px",
|
|
21
|
+
ruleColor: colors.boxborder[200],
|
|
22
|
+
showColumnRule: true,
|
|
23
|
+
actions: "always",
|
|
24
|
+
},
|
|
25
|
+
row: {
|
|
26
|
+
hoverBg: (0, tableRowHoverStyle_1.getTableRowHoverStyle)(colors, isDark).backgroundColor,
|
|
27
|
+
hoverScope: "cell",
|
|
28
|
+
ruleColor: colors.boxborder[200],
|
|
29
|
+
frozenRuleColor: colors.boxborder[300],
|
|
30
|
+
selectedBg: colors.primary.opacity[16],
|
|
31
|
+
selectedBarColor: colors.primary[500],
|
|
32
|
+
showSelectedBar: false,
|
|
33
|
+
},
|
|
34
|
+
slot: {
|
|
35
|
+
width: "6",
|
|
36
|
+
rest: "checkbox",
|
|
37
|
+
indexInk: colors.textMuted,
|
|
38
|
+
centered: false,
|
|
39
|
+
},
|
|
40
|
+
cells: {
|
|
41
|
+
ink: colors.text[500],
|
|
42
|
+
statusFill: "bleed",
|
|
43
|
+
pillRadius: "0",
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
exports.classicPreset = classicPreset;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { classicPreset } from "./classic";
|
|
2
|
+
import { studioPreset } from "./studio";
|
|
3
|
+
import type { TableVariant, TableVariantPreset } from "./tokens";
|
|
4
|
+
/** Adding a variant is one file and one union member — no component changes. */
|
|
5
|
+
export declare const TABLE_VARIANTS: Record<TableVariant, TableVariantPreset>;
|
|
6
|
+
export * from "./tokens";
|
|
7
|
+
export { classicPreset, studioPreset };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.studioPreset = exports.classicPreset = exports.TABLE_VARIANTS = void 0;
|
|
18
|
+
const classic_1 = require("./classic");
|
|
19
|
+
Object.defineProperty(exports, "classicPreset", { enumerable: true, get: function () { return classic_1.classicPreset; } });
|
|
20
|
+
const studio_1 = require("./studio");
|
|
21
|
+
Object.defineProperty(exports, "studioPreset", { enumerable: true, get: function () { return studio_1.studioPreset; } });
|
|
22
|
+
/** Adding a variant is one file and one union member — no component changes. */
|
|
23
|
+
exports.TABLE_VARIANTS = {
|
|
24
|
+
classic: classic_1.classicPreset,
|
|
25
|
+
studio: studio_1.studioPreset,
|
|
26
|
+
};
|
|
27
|
+
__exportStar(require("./tokens"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A consumer `statusColors` hex is a FILL, and `pickTableColor` hands it straight back as ink
|
|
3
|
+
* over a 13%-alpha tint of itself — legible reversed out of a solid cell, ~1.9:1 on a pill.
|
|
4
|
+
* The palette path is already resolved by `resolveStatusTone`; this rescues the override path.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolvePillInk(ink: string, soft: string, surface: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvePillInk = resolvePillInk;
|
|
4
|
+
const accentText_1 = require("../../../Theme/tokens/builders/accentText");
|
|
5
|
+
const color_1 = require("../../../Theme/tokens/builders/color");
|
|
6
|
+
const outlineRung_1 = require("../../../Theme/tokens/builders/outlineRung");
|
|
7
|
+
const cache = new Map();
|
|
8
|
+
/**
|
|
9
|
+
* A consumer `statusColors` hex is a FILL, and `pickTableColor` hands it straight back as ink
|
|
10
|
+
* over a 13%-alpha tint of itself — legible reversed out of a solid cell, ~1.9:1 on a pill.
|
|
11
|
+
* The palette path is already resolved by `resolveStatusTone`; this rescues the override path.
|
|
12
|
+
*/
|
|
13
|
+
function resolvePillInk(ink, soft, surface) {
|
|
14
|
+
const key = `${ink}|${soft}|${surface}`;
|
|
15
|
+
const hit = cache.get(key);
|
|
16
|
+
if (hit !== undefined)
|
|
17
|
+
return hit;
|
|
18
|
+
const resolved = (0, outlineRung_1.liftToContrast)(ink, (0, color_1.compositeOver)(soft, surface), accentText_1.AA_NORMAL_TEXT);
|
|
19
|
+
cache.set(key, resolved);
|
|
20
|
+
return resolved;
|
|
21
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TableVariantPreset } from "./tokens";
|
|
2
|
+
/**
|
|
3
|
+
* Quieter chrome, one rule instead of a grid, and a slot that rests on the row
|
|
4
|
+
* number. Every colour is lifted against the surface it actually sits on.
|
|
5
|
+
*/
|
|
6
|
+
export declare const studioPreset: TableVariantPreset;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.studioPreset = void 0;
|
|
4
|
+
const outlineRung_1 = require("../../../Theme/tokens/builders/outlineRung");
|
|
5
|
+
const tableRowHoverStyle_1 = require("../components/tableRowHoverStyle");
|
|
6
|
+
/**
|
|
7
|
+
* Quieter chrome, one rule instead of a grid, and a slot that rests on the row
|
|
8
|
+
* number. Every colour is lifted against the surface it actually sits on.
|
|
9
|
+
*/
|
|
10
|
+
const studioPreset = (colors, isDark) => {
|
|
11
|
+
const surface = colors.background[50];
|
|
12
|
+
// Studio drops the per-column rule, so the one line left has to be visible on
|
|
13
|
+
// every brand — `boxborder[200]` measures as low as 1.09:1 on some of them.
|
|
14
|
+
const rule = (0, outlineRung_1.liftToContrast)(colors.boxborder[200], surface, outlineRung_1.CHROME_RULE);
|
|
15
|
+
return {
|
|
16
|
+
header: {
|
|
17
|
+
bg: surface,
|
|
18
|
+
ink: colors.text[500],
|
|
19
|
+
fontSize: 11,
|
|
20
|
+
fontWeight: 600,
|
|
21
|
+
textTransform: "uppercase",
|
|
22
|
+
letterSpacing: "0.06em",
|
|
23
|
+
height: "40px",
|
|
24
|
+
ruleColor: rule,
|
|
25
|
+
showColumnRule: false,
|
|
26
|
+
actions: "hover",
|
|
27
|
+
},
|
|
28
|
+
row: {
|
|
29
|
+
hoverBg: (0, tableRowHoverStyle_1.getTableRowHoverStyle)(colors, isDark).backgroundColor,
|
|
30
|
+
hoverScope: "row",
|
|
31
|
+
ruleColor: rule,
|
|
32
|
+
frozenRuleColor: rule,
|
|
33
|
+
selectedBg: (0, outlineRung_1.liftToContrast)(colors.primary[50], surface, outlineRung_1.MIN_PERCEPTIBLE_STEP),
|
|
34
|
+
selectedBarColor: colors.primary[500],
|
|
35
|
+
showSelectedBar: true,
|
|
36
|
+
},
|
|
37
|
+
slot: {
|
|
38
|
+
width: "3.5rem",
|
|
39
|
+
rest: "index",
|
|
40
|
+
indexInk: colors.textMuted,
|
|
41
|
+
centered: true,
|
|
42
|
+
},
|
|
43
|
+
cells: {
|
|
44
|
+
ink: colors.text[500],
|
|
45
|
+
statusFill: "pill",
|
|
46
|
+
pillRadius: "0.375rem",
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
exports.studioPreset = studioPreset;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A variant is a resolved token set, never a branch. Components read named tokens;
|
|
3
|
+
* only `Table.tsx` knows which variant is active.
|
|
4
|
+
*
|
|
5
|
+
* PURITY: presets take a palette and return values — no Chakra, no React, no CSS.
|
|
6
|
+
*/
|
|
7
|
+
import type { PaletteProps } from "../../../Theme/tokens/types";
|
|
8
|
+
export type TableVariant = "classic" | "studio";
|
|
9
|
+
export type TableSlotRest = "checkbox" | "index";
|
|
10
|
+
export type TableStatusFill = "bleed" | "pill";
|
|
11
|
+
export type TableHoverScope = "cell" | "row";
|
|
12
|
+
export type TableChromeReveal = "always" | "hover";
|
|
13
|
+
/** Every field required: a preset that forgets one is a compile error, not a runtime gap. */
|
|
14
|
+
export type TableVariantTokens = {
|
|
15
|
+
header: {
|
|
16
|
+
bg: string;
|
|
17
|
+
ink: string;
|
|
18
|
+
fontSize: number;
|
|
19
|
+
fontWeight: number;
|
|
20
|
+
textTransform: "capitalize" | "uppercase";
|
|
21
|
+
letterSpacing: string;
|
|
22
|
+
height: string;
|
|
23
|
+
ruleColor: string;
|
|
24
|
+
showColumnRule: boolean;
|
|
25
|
+
/** When the per-column filter kebab appears. Active columns always show it. */
|
|
26
|
+
actions: TableChromeReveal;
|
|
27
|
+
};
|
|
28
|
+
row: {
|
|
29
|
+
hoverBg: string;
|
|
30
|
+
hoverScope: TableHoverScope;
|
|
31
|
+
ruleColor: string;
|
|
32
|
+
frozenRuleColor: string;
|
|
33
|
+
selectedBg: string;
|
|
34
|
+
selectedBarColor: string;
|
|
35
|
+
showSelectedBar: boolean;
|
|
36
|
+
};
|
|
37
|
+
slot: {
|
|
38
|
+
width: string;
|
|
39
|
+
rest: TableSlotRest;
|
|
40
|
+
indexInk: string;
|
|
41
|
+
centered: boolean;
|
|
42
|
+
};
|
|
43
|
+
cells: {
|
|
44
|
+
ink: string;
|
|
45
|
+
statusFill: TableStatusFill;
|
|
46
|
+
pillRadius: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export type TableVariantPreset = (colors: PaletteProps, isDark: boolean) => TableVariantTokens;
|
|
@@ -5,7 +5,7 @@ const react_1 = require("@chakra-ui/react");
|
|
|
5
5
|
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
6
6
|
const TrailWorks = () => {
|
|
7
7
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
8
|
-
const cellBorder = colors.
|
|
8
|
+
const cellBorder = colors.boxborder[200];
|
|
9
9
|
const data = [
|
|
10
10
|
{
|
|
11
11
|
contact: "John Doe",
|
|
@@ -31,9 +31,11 @@ const baseStyle = definePartsStyle(({ theme }) => {
|
|
|
31
31
|
[$bg.variable]: colors.backgroundColor.light,
|
|
32
32
|
bg: $bg.reference,
|
|
33
33
|
color: colors.text[900],
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
|
|
34
|
+
// A rule at CHROME_RULE weight, not Chakra's gray.200: that default read as a hard edge,
|
|
35
|
+
// which is why this shipped borderless. At 1.31:1 the edge defines the surface instead.
|
|
36
|
+
borderWidth: "1px",
|
|
37
|
+
borderStyle: "solid",
|
|
38
|
+
borderColor: colors.boxborder[200],
|
|
37
39
|
},
|
|
38
40
|
// Own CSS var (`--menu-item-bg`), NOT the list's `--menu-bg` — Chakra's stock item
|
|
39
41
|
// baseStyle rewrites `--menu-bg` itself on hover/focus, so reusing that same var name
|