pixelize-design-library 2.4.2-beta.63 → 2.4.2-beta.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/COMPONENT-GOTCHAS.md +26 -3
- package/DESIGN-GUIDE.md +1 -0
- package/dist/Components/Button/Button.styles.js +7 -2
- package/dist/Components/Dropdown/DropDown.js +2 -9
- package/dist/Components/FilePreview/FilePreview.js +2 -1
- package/dist/Components/FileUploader/FileUploader.js +4 -0
- package/dist/Components/FileUploader/FileUploaderProps.d.ts +1 -1
- package/dist/Components/Input/TextInput.styles.js +10 -6
- package/dist/Components/KanbanBoard/KanbanBoard.js +6 -5
- package/dist/Components/NavigationBar/NavigationBar.js +2 -1
- package/dist/Components/OrgSwitcher/OrgSwitcher.js +2 -4
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +6 -5
- package/dist/Components/ScrollToTop/ScrollToTop.js +4 -3
- package/dist/Components/SearchSelect/SearchSelect.js +4 -16
- package/dist/Components/Select/SelectPopup.js +1 -3
- package/dist/Components/Select/optionRowInk.d.ts +12 -0
- package/dist/Components/Select/optionRowInk.js +10 -1
- package/dist/Components/SelectSearch/SelectSearch.js +1 -10
- package/dist/Components/Table/Table.js +3 -2
- package/dist/Components/Table/TableProps.d.ts +1 -1
- package/dist/Components/Table/components/TableBody.js +9 -1
- package/dist/Components/Table/components/TableHeader.js +7 -2
- package/dist/Components/Table/components/TableLoading.d.ts +4 -1
- package/dist/Components/Table/components/TableLoading.js +6 -5
- package/dist/Components/Table/filters/CompactSelect.js +1 -10
- package/dist/Components/Table/variants/TableVariantContext.d.ts +1 -1
- package/dist/Components/Table/variants/TableVariantContext.js +3 -3
- package/dist/Components/WorkspaceWindow/WorkspaceTrayPreview.js +4 -0
- package/dist/Components/WorkspaceWindow/WorkspaceWindow.d.ts +2 -2
- package/dist/Components/WorkspaceWindow/WorkspaceWindow.js +25 -18
- package/dist/Components/WorkspaceWindow/WorkspaceWindowProps.d.ts +38 -2
- package/dist/Theme/chakra/Menu.styles.d.ts +8 -0
- package/dist/Theme/chakra/Menu.styles.js +7 -0
- package/dist/Theme/chakra/componentStyles.d.ts +8 -0
- package/dist/Theme/chakra/componentStyles.js +2 -2
- package/dist/Theme/tokens/builders/accentText.d.ts +2 -0
- package/dist/Theme/tokens/builders/accentText.js +7 -1
- package/dist/Theme/tokens/builders/filledSurface.d.ts +5 -1
- package/dist/Theme/tokens/builders/filledSurface.js +17 -4
- package/dist/Theme/tokens/builders/planeStep.d.ts +1 -0
- package/dist/Theme/tokens/builders/planeStep.js +5 -4
- package/dist/Utils/table.js +2 -2
- package/dist/esm/Components/Button/Button.styles.js +8 -3
- package/dist/esm/Components/Dropdown/DropDown.js +2 -9
- package/dist/esm/Components/FilePreview/FilePreview.js +3 -2
- package/dist/esm/Components/FileUploader/FileUploader.js +4 -0
- package/dist/esm/Components/Input/TextInput.styles.js +10 -6
- package/dist/esm/Components/KanbanBoard/KanbanBoard.js +6 -5
- package/dist/esm/Components/NavigationBar/NavigationBar.js +2 -1
- package/dist/esm/Components/OrgSwitcher/OrgSwitcher.js +2 -4
- package/dist/esm/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +7 -6
- package/dist/esm/Components/ScrollToTop/ScrollToTop.js +5 -4
- package/dist/esm/Components/SearchSelect/SearchSelect.js +6 -18
- package/dist/esm/Components/Select/SelectPopup.js +2 -4
- package/dist/esm/Components/Select/optionRowInk.js +7 -0
- package/dist/esm/Components/SelectSearch/SelectSearch.js +2 -11
- package/dist/esm/Components/Table/Table.js +4 -3
- package/dist/esm/Components/Table/components/TableBody.js +10 -2
- package/dist/esm/Components/Table/components/TableHeader.js +9 -4
- package/dist/esm/Components/Table/components/TableLoading.js +5 -4
- package/dist/esm/Components/Table/filters/CompactSelect.js +2 -11
- package/dist/esm/Components/Table/variants/TableVariantContext.js +3 -3
- package/dist/esm/Components/WorkspaceWindow/WorkspaceTrayPreview.js +4 -0
- package/dist/esm/Components/WorkspaceWindow/WorkspaceWindow.js +26 -19
- package/dist/esm/Theme/chakra/Menu.styles.js +7 -0
- package/dist/esm/Theme/chakra/componentStyles.js +2 -2
- package/dist/esm/Theme/tokens/builders/accentText.js +5 -0
- package/dist/esm/Theme/tokens/builders/filledSurface.js +18 -5
- package/dist/esm/Theme/tokens/builders/planeStep.js +3 -3
- package/dist/esm/Utils/table.js +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/index.d.ts +5 -5
- package/dist/index.js +11 -6
- package/package.json +1 -1
|
@@ -44,15 +44,28 @@ const steppedRung = (base, canvas, step) => {
|
|
|
44
44
|
const dir = (0, accentText_1.isDarkCanvas)(canvas) ? -100 : 100;
|
|
45
45
|
return Math.min(900, Math.max(50, base + dir * step));
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
const steppedTowardBase = (from, base) => RUNGS[RUNGS.indexOf(from) + (from > base ? -1 : 1)];
|
|
48
|
+
/**
|
|
49
|
+
* Hover (step 0) or active (step 1) fill rung, one step darker than `solidFillRung`. A step may not
|
|
50
|
+
* flip the label's side of AA (zinc dark: near-white fill, black ink) or fall below `CHROME_BORDER`
|
|
51
|
+
* against the canvas (a pressed warning solid used to reach 1.00:1 on the card).
|
|
52
|
+
*/
|
|
48
53
|
const darkerFillRung = (scale, canvas, white, step) => {
|
|
49
54
|
const base = (0, exports.solidFillRung)(scale, white, canvas);
|
|
55
|
+
const wantsWhite = (0, color_1.contrastRatio)(white, scale[base]) >= accentText_1.AA_NORMAL_TEXT;
|
|
56
|
+
const holds = (rung) => (0, color_1.contrastRatio)(scale[rung], canvas) >= outlineRung_1.CHROME_BORDER &&
|
|
57
|
+
((0, color_1.contrastRatio)(white, scale[rung]) >= accentText_1.AA_NORMAL_TEXT) === wantsWhite;
|
|
58
|
+
let rung;
|
|
50
59
|
if (base === 500) {
|
|
51
60
|
const mode = (0, accentText_1.isDarkCanvas)(canvas) ? "dark" : "light";
|
|
52
|
-
|
|
61
|
+
rung = FILL_STEP_RUNGS[mode][step];
|
|
53
62
|
}
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
else {
|
|
64
|
+
rung = steppedRung(base, canvas, step === 0 ? 1 : 2);
|
|
65
|
+
}
|
|
66
|
+
while (rung !== base && !holds(rung))
|
|
67
|
+
rung = steppedTowardBase(rung, base);
|
|
68
|
+
return rung;
|
|
56
69
|
};
|
|
57
70
|
exports.darkerFillRung = darkerFillRung;
|
|
58
71
|
/** Label ink for a specific fill swatch — always `onFilled`, exported for style configs. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PaletteProps } from "../types";
|
|
2
2
|
export declare const bandOn: (fill: string, plane: string) => string;
|
|
3
3
|
export declare const recessOn: (fill: string, plane: string) => string;
|
|
4
|
+
export declare const ruleOn: (colors: Pick<PaletteProps, "boxborder">, plane: string) => string;
|
|
4
5
|
export declare const cardRule: (colors: Pick<PaletteProps, "boxborder" | "background">) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cardRule = exports.recessOn = exports.bandOn = void 0;
|
|
3
|
+
exports.cardRule = exports.ruleOn = exports.recessOn = exports.bandOn = void 0;
|
|
4
4
|
const accentText_1 = require("./accentText");
|
|
5
5
|
const color_1 = require("./color");
|
|
6
6
|
const outlineRung_1 = require("./outlineRung");
|
|
@@ -12,9 +12,10 @@ const recessOn = (fill, plane) => holds(fill, plane, outlineRung_1.MIN_PERCEPTIB
|
|
|
12
12
|
? fill
|
|
13
13
|
: (0, planes_1.lift)(accentText_1.DEFAULT_BLACK, plane, outlineRung_1.MIN_PERCEPTIBLE_STEP);
|
|
14
14
|
exports.recessOn = recessOn;
|
|
15
|
-
const
|
|
15
|
+
const ruleOn = (colors, plane) => {
|
|
16
16
|
const rule = colors.boxborder[200];
|
|
17
|
-
|
|
18
|
-
return holds(rule, card, outlineRung_1.CHROME_RULE) ? rule : (0, outlineRung_1.liftToContrast)(rule, card, outlineRung_1.CHROME_RULE);
|
|
17
|
+
return holds(rule, plane, outlineRung_1.CHROME_RULE) ? rule : (0, outlineRung_1.liftToContrast)(rule, plane, outlineRung_1.CHROME_RULE);
|
|
19
18
|
};
|
|
19
|
+
exports.ruleOn = ruleOn;
|
|
20
|
+
const cardRule = (colors) => (0, exports.ruleOn)(colors, colors.background[50]);
|
|
20
21
|
exports.cardRule = cardRule;
|
package/dist/Utils/table.js
CHANGED
|
@@ -81,7 +81,7 @@ function buildSemanticStatusPalette(toneByValue, theme) {
|
|
|
81
81
|
return Object.fromEntries(Object.entries(toneByValue).map(([value, key]) => {
|
|
82
82
|
const scale = scales[key];
|
|
83
83
|
const tone = (0, tone_1.resolveSoftTone)(c, scale);
|
|
84
|
-
const solidRung = (0, filledSurface_1.solidFillRung)(scale, c.white);
|
|
84
|
+
const solidRung = (0, filledSurface_1.solidFillRung)(scale, c.white, c.backgroundColor.main);
|
|
85
85
|
const solid = scale[solidRung];
|
|
86
86
|
return [
|
|
87
87
|
value,
|
|
@@ -123,7 +123,7 @@ function buildTablePalette(theme) {
|
|
|
123
123
|
];
|
|
124
124
|
return scales.map((scale) => {
|
|
125
125
|
const tone = (0, tone_1.resolveSoftTone)(c, scale);
|
|
126
|
-
const solidRung = (0, filledSurface_1.solidFillRung)(scale, c.white);
|
|
126
|
+
const solidRung = (0, filledSurface_1.solidFillRung)(scale, c.white, c.backgroundColor.main);
|
|
127
127
|
const solid = scale[solidRung];
|
|
128
128
|
return {
|
|
129
129
|
solid,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { accentTextOnPlanes } from "../../Theme/tokens/builders/accentText.js";
|
|
2
2
|
import { darkerFillRung, labelOnFill, resolveFilledSurface, solidFillRung, } from "../../Theme/tokens/builders/filledSurface.js";
|
|
3
3
|
import { resolveGradient, gradientCss } from "../../Theme/tokens/builders/gradientInk.js";
|
|
4
4
|
import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
|
|
@@ -21,7 +21,12 @@ const controlSize = (size) => {
|
|
|
21
21
|
return { h: height, minW: height, fontSize, px: paddingX };
|
|
22
22
|
};
|
|
23
23
|
// NOTE: [500] alone measures ~4.2 on a dark canvas — resolved per-mode so outline/ghost/link text stays readable.
|
|
24
|
-
|
|
24
|
+
// NOTE: a bare button sits on the canvas, a card or an overlay; dark overlays are the hardest plane.
|
|
25
|
+
const onCanvasText = (theme, colorScheme) => accentTextOnPlanes(theme.colors[colorScheme], [
|
|
26
|
+
theme.colors.backgroundColor.main,
|
|
27
|
+
theme.colors.background[50],
|
|
28
|
+
theme.colors.surfaceRaised,
|
|
29
|
+
]);
|
|
25
30
|
// NOTE: [50] alone measured ~1.04 (invisible) in both modes — gray borrows the row-state steps.
|
|
26
31
|
const onCanvasHoverBg = (theme, colorScheme, step) => {
|
|
27
32
|
const scale = theme.colors[colorScheme];
|
|
@@ -33,7 +38,7 @@ const onCanvasHoverBg = (theme, colorScheme, step) => {
|
|
|
33
38
|
return step === 16 ? rows.active : rows.selectedActive;
|
|
34
39
|
};
|
|
35
40
|
const swatch = (theme, colorScheme) => theme.colors[colorScheme];
|
|
36
|
-
const buttonSolidRung = (theme, colorScheme) => solidFillRung(swatch(theme, colorScheme), theme.colors.white);
|
|
41
|
+
const buttonSolidRung = (theme, colorScheme) => solidFillRung(swatch(theme, colorScheme), theme.colors.white, theme.colors.backgroundColor.main);
|
|
37
42
|
const darkerFill = (theme, colorScheme, step) => {
|
|
38
43
|
const scale = swatch(theme, colorScheme);
|
|
39
44
|
const rung = darkerFillRung(scale, theme.colors.backgroundColor.main, theme.colors.white, step);
|
|
@@ -6,6 +6,7 @@ import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
|
6
6
|
import { raisedRule } from "../../Theme/tokens/builders/surfaceRaised.js";
|
|
7
7
|
import { scrollbarStyles } from "../../Theme/tokens/builders/scrollbar.js";
|
|
8
8
|
import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
|
|
9
|
+
import { optionRowInk } from "../Select/optionRowInk.js";
|
|
9
10
|
import { useExclusiveOverlay } from "../../Hooks/useExclusiveOverlay.js";
|
|
10
11
|
import { ChevronDown } from "lucide-react";
|
|
11
12
|
import { rafThrottle } from "../../Utils/rafThrottle.js";
|
|
@@ -246,16 +247,8 @@ const Dropdown = forwardRef(({ dropDownButtonStyle, ButtonText, options, handleO
|
|
|
246
247
|
}, role: "menuitem", tabIndex: index === activeIndex ? 0 : -1, onClick: () => {
|
|
247
248
|
handleListItemClick(option.id, option.label);
|
|
248
249
|
focusTrigger();
|
|
249
|
-
}, onKeyDown: (e) => handleItemKeyDown(e, option.id, option.label), mx: rowSpec.mx, px: rowSpec.px, py: rowSpec.py, minH: rowSpec.minH, borderRadius: OPTION_ROW_RADIUS, display: "flex", alignItems: "center", gap: rowSpec.gap, fontSize: rowSpec.fontSize, cursor: "pointer", color: theme.colors
|
|
250
|
+
}, onKeyDown: (e) => handleItemKeyDown(e, option.id, option.label), mx: rowSpec.mx, px: rowSpec.px, py: rowSpec.py, minH: rowSpec.minH, borderRadius: OPTION_ROW_RADIUS, display: "flex", alignItems: "center", gap: rowSpec.gap, fontSize: rowSpec.fontSize, cursor: "pointer", color: optionRowInk(theme.colors, false), transition: ROW_TRANSITION, _hover: { bg: hoverTint }, _focus: { bg: hoverTint, outline: "none" }, _focusVisible: {
|
|
250
251
|
bg: hoverTint,
|
|
251
|
-
color: theme.colors.accentText,
|
|
252
|
-
}, _focus: {
|
|
253
|
-
bg: hoverTint,
|
|
254
|
-
color: theme.colors.accentText,
|
|
255
|
-
outline: "none",
|
|
256
|
-
}, _focusVisible: {
|
|
257
|
-
bg: hoverTint,
|
|
258
|
-
color: theme.colors.accentText,
|
|
259
252
|
boxShadow: `inset 0 0 0 2px ${theme.colors.focusRing.ring}`,
|
|
260
253
|
}, borderBottom: divider
|
|
261
254
|
? `${BORDER_WIDTHS.hairline} solid ${raisedRule(theme.colors)}`
|
|
@@ -4,7 +4,7 @@ import { Box, Flex, IconButton, Image, Modal, ModalBody, ModalCloseButton, Modal
|
|
|
4
4
|
import { motion } from "framer-motion";
|
|
5
5
|
import { Download, Eye, FileQuestion, Minus, Plus, RotateCw, } from "lucide-react";
|
|
6
6
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
7
|
-
import {
|
|
7
|
+
import { resolveFilledSurface } from "../../Theme/tokens/builders/filledSurface.js";
|
|
8
8
|
import { hexToRgb } from "../../Theme/tokens/builders/color.js";
|
|
9
9
|
import { overlayScrimStyles } from "../../Theme/chakra/overlay.styles.js";
|
|
10
10
|
import ToolTip from "../ToolTip/ToolTip.js";
|
|
@@ -43,6 +43,7 @@ const downloadFile = async (fileUrl, fileName) => {
|
|
|
43
43
|
/** Modal previewer inferring image/pdf/video/other from the extension — for an always-inline PDF-only panel use PdfViewer. */
|
|
44
44
|
export const FilePreview = ({ isOpen, onClose, fileUrl, fileName, fileType, hideDownload = false, size = "xl", }) => {
|
|
45
45
|
const theme = useCustomTheme();
|
|
46
|
+
const downloadFill = resolveFilledSurface(theme.colors.primary, theme.colors);
|
|
46
47
|
const [zoom, setZoom] = useState(1);
|
|
47
48
|
const [rotation, setRotation] = useState(0);
|
|
48
49
|
const kind = fileType || inferKind(fileUrl, fileName);
|
|
@@ -64,7 +65,7 @@ export const FilePreview = ({ isOpen, onClose, fileUrl, fileName, fileType, hide
|
|
|
64
65
|
if (kind === "video") {
|
|
65
66
|
return (_jsx(Box, { as: "video", src: fileUrl, controls: true, width: "100%", borderRadius: "lg" }));
|
|
66
67
|
}
|
|
67
|
-
return (_jsxs(Flex, { direction: "column", align: "center", justify: "center", py: 12, gap: 3, children: [_jsx(FileQuestion, { size: 48, color: theme.colors.textMuted }), _jsx(Text, { color: theme.colors.textMuted, fontSize: "sm", children: "Preview isn't available for this file type." }), !hideDownload && (_jsxs(Flex, { as: "button", align: "center", gap: 2, px: 4, py: 2, borderRadius: "lg", bg:
|
|
68
|
+
return (_jsxs(Flex, { direction: "column", align: "center", justify: "center", py: 12, gap: 3, children: [_jsx(FileQuestion, { size: 48, color: theme.colors.textMuted }), _jsx(Text, { color: theme.colors.textMuted, fontSize: "sm", children: "Preview isn't available for this file type." }), !hideDownload && (_jsxs(Flex, { as: "button", align: "center", gap: 2, px: 4, py: 2, borderRadius: "lg", bg: downloadFill.fill, color: downloadFill.color, fontSize: "sm", fontWeight: 500, onClick: () => downloadFile(fileUrl, fileName), children: [_jsx(Download, { size: 16 }), " Download file"] }))] }));
|
|
68
69
|
};
|
|
69
70
|
return (_jsxs(Modal, { isOpen: isOpen, onClose: handleClose, size: size, isCentered: true, children: [_jsx(ModalOverlay, { ...overlayScrimStyles(theme.colors) }), _jsxs(MotionContent, { bg: theme.colors.surfaceRaised, borderRadius: "xl", overflow: "hidden", initial: { opacity: 0, scale: 0.96, y: 8 }, animate: { opacity: 1, scale: 1, y: 0 }, transition: { duration: 0.2, ease: "easeOut" }, children: [_jsxs(Flex, { align: "center", justify: "space-between", px: 4, py: 3, borderBottom: "1px solid", borderColor: theme.colors.boxborder[200], children: [_jsx(ToolTip, { label: fileName || "File", placement: "bottom", children: _jsx(Text, { fontSize: "sm", fontWeight: 600, maxW: "60%", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: fileName || "Preview" }) }), _jsxs(Flex, { align: "center", gap: 1, children: [kind === "image" && (_jsxs(_Fragment, { children: [_jsx(ToolTip, { label: "Zoom out", placement: "bottom", children: _jsx(IconButton, { "aria-label": "Zoom out", size: "sm", variant: "ghost", icon: _jsx(Minus, { size: 16 }), onClick: () => setZoom((z) => Math.max(0.25, z - 0.25)) }) }), _jsx(ToolTip, { label: "Zoom in", placement: "bottom", children: _jsx(IconButton, { "aria-label": "Zoom in", size: "sm", variant: "ghost", icon: _jsx(Plus, { size: 16 }), onClick: () => setZoom((z) => Math.min(4, z + 0.25)) }) }), _jsx(ToolTip, { label: "Rotate", placement: "bottom", children: _jsx(IconButton, { "aria-label": "Rotate", size: "sm", variant: "ghost", icon: _jsx(RotateCw, { size: 16 }), onClick: () => setRotation((r) => (r + 90) % 360) }) })] })), !hideDownload && (_jsx(ToolTip, { label: "Download", placement: "bottom", children: _jsx(IconButton, { "aria-label": "Download", size: "sm", variant: "ghost", color: theme.colors.semanticText.success, icon: _jsx(Download, { size: 18 }), onClick: () => downloadFile(fileUrl, fileName) }) })), _jsx(ModalCloseButton, { position: "static" })] })] }), _jsx(ModalBody, { p: 5, children: renderBody() })] })] }));
|
|
70
71
|
};
|
|
@@ -8,6 +8,7 @@ import { accentTextOnCanvas } from "../../Theme/tokens/builders/accentText.js";
|
|
|
8
8
|
import { FIELD_RADIUS } from "../Common/fieldStyles.js";
|
|
9
9
|
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
10
10
|
import { focusVisibleRing } from "../../Theme/chakra/focusRing.styles.js";
|
|
11
|
+
const revokePreviews = (files) => files.forEach((f) => f.previewUrl && URL.revokeObjectURL(f.previewUrl));
|
|
11
12
|
/** Self-contained widget; onFilesChange returns {id,name,size,previewUrl} metadata, never real File objects — cannot be used to upload bytes. */
|
|
12
13
|
const FileUploader = ({ maxFiles = 10, maxTotalSize = 20, onFilesChange, acceptTypes = ["jpeg", "jpg", "png"], }) => {
|
|
13
14
|
const { showToast } = useToaster();
|
|
@@ -36,7 +37,9 @@ const FileUploader = ({ maxFiles = 10, maxTotalSize = 20, onFilesChange, acceptT
|
|
|
36
37
|
}));
|
|
37
38
|
const combinedFiles = [...uploadedFiles, ...newFiles].slice(0, maxFiles);
|
|
38
39
|
const totalSizeBytes = combinedFiles.reduce((acc, f) => acc + f.size, 0);
|
|
40
|
+
revokePreviews(newFiles.filter((f) => !combinedFiles.includes(f)));
|
|
39
41
|
if (totalSizeBytes > maxTotalBytes) {
|
|
42
|
+
revokePreviews(newFiles);
|
|
40
43
|
showToast({
|
|
41
44
|
title: `Total file size exceeds ${maxTotalSize} MB limit.`,
|
|
42
45
|
duration: 3000,
|
|
@@ -66,6 +69,7 @@ const FileUploader = ({ maxFiles = 10, maxTotalSize = 20, onFilesChange, acceptT
|
|
|
66
69
|
const handleDragLeave = () => setIsDragOver(false);
|
|
67
70
|
const removeFile = (id) => {
|
|
68
71
|
const filtered = uploadedFiles.filter((f) => f.id !== id);
|
|
72
|
+
revokePreviews(uploadedFiles.filter((f) => f.id === id));
|
|
69
73
|
setUploadedFiles(filtered);
|
|
70
74
|
onFilesChange === null || onFilesChange === void 0 ? void 0 : onFilesChange(filtered);
|
|
71
75
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { controlSizeStyles, fieldControlStyles, FIELD_BORDER_WIDTH } from "../Common/fieldStyles.js";
|
|
2
2
|
import { CONTROL_SIZE_NAMES, DEFAULT_CONTROL_SIZE } from "../../Theme/tokens/primitives/controlSizes.js";
|
|
3
3
|
import { fieldFocusVisible } from "../../Theme/chakra/focusRing.styles.js";
|
|
4
|
+
import { bandOn } from "../../Theme/tokens/builders/planeStep.js";
|
|
4
5
|
/** Field look shared by Input, Textarea and NumberInput; `_invalid` also clears Chakra's stock invalid shadow. */
|
|
5
6
|
export const fieldPartStyles = (colors) => {
|
|
6
7
|
const error = colors.semanticText.error;
|
|
@@ -14,12 +15,15 @@ export const fieldPartStyles = (colors) => {
|
|
|
14
15
|
},
|
|
15
16
|
};
|
|
16
17
|
};
|
|
17
|
-
export const fieldFilledStyles = (colors) =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
export const fieldFilledStyles = (colors) => {
|
|
19
|
+
const filledBand = bandOn(colors.background[100], colors.background[50]);
|
|
20
|
+
return {
|
|
21
|
+
...fieldPartStyles(colors),
|
|
22
|
+
bg: filledBand,
|
|
23
|
+
borderColor: "transparent",
|
|
24
|
+
_hover: { bg: filledBand, borderColor: "transparent" },
|
|
25
|
+
};
|
|
26
|
+
};
|
|
23
27
|
export const fieldFlushedStyles = (colors) => ({
|
|
24
28
|
...fieldPartStyles(colors),
|
|
25
29
|
bg: "transparent",
|
|
@@ -12,6 +12,7 @@ import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
|
12
12
|
import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
|
|
13
13
|
import { useGetPreferences, useSavePreferences, } from "../../Hooks/usePreferences.js";
|
|
14
14
|
import AccountCard from "./AccountCard.js";
|
|
15
|
+
import { cardRule, ruleOn } from "../../Theme/tokens/builders/planeStep.js";
|
|
15
16
|
import HeaderActions from "../Header/HeaderActions.js";
|
|
16
17
|
import MeasuredItem from "./MeasuredItem.js";
|
|
17
18
|
import OverflowTooltipText from "../SideBar/components/OverflowTooltipText.js";
|
|
@@ -35,7 +36,7 @@ const MIN_LIST_HEIGHT = 120;
|
|
|
35
36
|
const KANBAN_VIRTUALIZE_THRESHOLD = 30;
|
|
36
37
|
const COLUMN_TRANSITION = `${transitionFor(["background-color", "border-color"])}, ${transitionFor(["width"], "base")}`;
|
|
37
38
|
const SKELETON_ROWS = [3, 4, 3];
|
|
38
|
-
const CardSkeleton = ({ colors, rows }) => (_jsx(Box, { "data-testid": "kanban-card-skeleton", borderRadius: "lg", bg: colors.background[50], border: `${BORDER_WIDTHS.hairline} solid ${colors
|
|
39
|
+
const CardSkeleton = ({ colors, rows }) => (_jsx(Box, { "data-testid": "kanban-card-skeleton", borderRadius: "lg", bg: colors.background[50], border: `${BORDER_WIDTHS.hairline} solid ${cardRule(colors)}`, p: 3, minH: "5rem", children: _jsx(Flex, { direction: "column", gap: 2.5, children: Array.from({ length: rows }).map((_, i) => (_jsxs(Flex, { gap: 2, align: "center", children: [_jsx(Skeleton, { h: 2.5, w: "30%", borderRadius: "sm" }), _jsx(Skeleton, { h: 2.5, flex: "1", maxW: i % 2 ? "40%" : "55%", borderRadius: "sm" })] }, i))) }) }));
|
|
39
40
|
// Top buffer above the first card so its border + hover lift aren't clipped by the
|
|
40
41
|
// scroll/virtualized list's top edge.
|
|
41
42
|
const KANBAN_LIST_TOP_PAD = 6;
|
|
@@ -405,14 +406,14 @@ const KanbanBoard = ({ data, customColumns, customizeColumn, onDrag, onDelete, o
|
|
|
405
406
|
return (_jsxs(Box, { ref: provided.innerRef, ...provided.droppableProps, width: isColCollapsed ? COLLAPSED_KANBAN_COLUMN_WIDTH : columnWidth, borderRadius: "xl", background: snapshot.isDraggingOver
|
|
406
407
|
? colors.primary[50]
|
|
407
408
|
: colors.background[100], border: `${BORDER_WIDTHS.hairline} ${snapshot.isDraggingOver ? "dashed" : "solid"} ${snapshot.isDraggingOver
|
|
408
|
-
? colors.
|
|
409
|
-
: colors.
|
|
409
|
+
? colors.focusRing.ring
|
|
410
|
+
: ruleOn(colors, colors.background[100])}`, transition: COLUMN_TRANSITION, display: "flex", flexDirection: "column", flexShrink: 0, overflow: isColCollapsed ? "visible" : "hidden", height: COLUMN_HEIGHT, sx: reducedMotionSx(), onMouseEnter: () => hoveredColumn.set(colId), onMouseLeave: () => hoveredColumn.set(null), onFocus: () => hoveredColumn.set(colId), onBlur: (e) => {
|
|
410
411
|
if (!e.currentTarget.contains(e.relatedTarget))
|
|
411
412
|
hoveredColumn.set(null);
|
|
412
413
|
}, children: [isColCollapsed ? (_jsxs(Flex, { direction: "column", align: "stretch", flex: "1", width: "100%", minH: 0, overflow: "visible", position: "relative", children: [_jsxs(Flex, { as: "header", direction: "column", align: "center", flexShrink: 0, width: "100%", py: 3, px: 1, gap: 3, borderTop: "0.25rem solid", borderTopColor: (_a = column.color) !== null && _a !== void 0 ? _a : colors.primary[500], bg: colors.background[100], position: "relative", zIndex: 1, children: [enableColumnReorder && columnDragHandleProps ? (_jsx(Flex, { align: "center", justify: "center", flexShrink: 0, cursor: "grab", ...columnDragHandleProps, "aria-label": `Reorder ${column.title} column`, children: _jsx(Box, { as: GripVertical, size: 14, color: colors.textMuted }) })) : null, enableColumnCollapse && (_jsx(Flex, { flexShrink: 0, w: "100%", justify: "center", bg: colors.background[100], position: "relative", zIndex: 3, children: _jsx(IconButton, { "aria-label": "Expand column", icon: _jsx(ChevronRight, { size: 14 }), variant: "ghost", size: "xs", minW: "1.5rem", h: "1.75rem", onClick: () => toggleColumnCollapsed(colId) }) })), _jsx(Text, { as: "span", fontWeight: "700", fontSize: "xs", color: colors.text[700], sx: {
|
|
413
414
|
writingMode: "vertical-rl",
|
|
414
415
|
textOrientation: "mixed",
|
|
415
|
-
}, maxH: `${Math.max(120, containerHeight - 200)}px`, overflow: "hidden", lineHeight: "1.2", title: column.title, children: column.title }), _jsx(Badge, { minW: 5, h: 5, borderRadius: "full", border: `${BORDER_WIDTHS.hairline} solid`, borderColor: colors.
|
|
416
|
+
}, maxH: `${Math.max(120, containerHeight - 200)}px`, overflow: "hidden", lineHeight: "1.2", title: column.title, children: column.title }), _jsx(Badge, { minW: 5, h: 5, borderRadius: "full", border: `${BORDER_WIDTHS.hairline} solid`, borderColor: ruleOn(colors, colors.background[100]), display: "flex", backgroundColor: colors.background[100], alignItems: "center", justifyContent: "center", color: colors.text[900], fontWeight: 600, fontSize: "xs", children: (_b = column === null || column === void 0 ? void 0 : column.items) === null || _b === void 0 ? void 0 : _b.length })] }), column.customNode ? (_jsx(Box, { flexShrink: 0, minH: COLLAPSED_CUSTOM_NODE_TOP_RESERVE, w: "100%", bg: colors.background[100], "aria-hidden": true })) : null, column.customNode ? (_jsx(Box, { as: "section", "aria-label": "Column summary", flex: "1", minH: 0, w: "100%", overflow: "visible", py: 2, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "flex-start", bg: colors.background[100], position: "relative", zIndex: 2, children: _jsx(Box, { position: "relative", transform: "rotate(90deg)", transformOrigin: "center center", marginTop: '1rem', children: _jsx(VStack, { align: "stretch", spacing: 1, minW: "max-content", fontSize: "xs", color: colors.text[600], children: column.customNode() }) }) })) : (_jsx(Box, { flex: "1", minH: 0 }))] })) : (_jsxs(Flex, { width: "100%", h: !isColCollapsed && !!((_c = column.customNode) === null || _c === void 0 ? void 0 : _c.call(column)) ? "auto" : "2.75rem", align: !isColCollapsed && !!((_d = column.customNode) === null || _d === void 0 ? void 0 : _d.call(column)) ? "flex-start" : "center", px: 3, py: 2, flexShrink: 0, justifyContent: "space-between", position: "relative", gap: 2, borderBottom: `${BORDER_WIDTHS.hairline} solid ${ruleOn(colors, colors.background[100])}`, children: [_jsxs(Flex, { direction: "column", gap: 1, minW: 0, flex: "1", children: [_jsxs(Flex, { align: "center", gap: 2, minW: 0, children: [_jsx(Box, { boxSize: 2.5, borderRadius: "full", bg: (_e = column.color) !== null && _e !== void 0 ? _e : colors.primary[500], flexShrink: 0 }), enableColumnReorder && columnDragHandleProps ? (_jsx(Flex, { align: "center", justify: "center", flexShrink: 0, cursor: "grab", ...columnDragHandleProps, "aria-label": `Reorder ${column.title} column`, children: _jsx(Box, { as: GripVertical, size: 14, color: colors.textMuted }) })) : null, _jsx(Text, { as: "span", fontWeight: "600", fontSize: "sm", color: colors.text[700], noOfLines: 1, minW: 0, children: _jsx(OverflowTooltipText, { placement: "top", children: column.title }) })] }), column.customNode ? (_jsx(Box, { as: "section", "aria-label": "Column summary", width: "100%", flexShrink: 0, fontSize: "xs", color: colors.text[600], children: (_f = column.customNode) === null || _f === void 0 ? void 0 : _f.call(column) })) : null] }), _jsxs(Box, { display: "flex", alignItems: "center", gap: 2, children: [_jsx(Badge, { minW: 6, h: 6, px: 2, borderRadius: "full", backgroundColor: colors.backgroundColor.subtle, display: "flex", alignItems: "center", justifyContent: "center", color: colors.text[500], fontWeight: 600, fontSize: "xs", children: (_g = column === null || column === void 0 ? void 0 : column.items) === null || _g === void 0 ? void 0 : _g.length }), enableColumnCollapse && (_jsx(IconButton, { "aria-label": "Collapse column", icon: _jsx(ChevronLeft, { size: 14 }), variant: "ghost", size: "xs", minW: "1.5rem", h: "1.75rem", flexShrink: 0, onClick: () => toggleColumnCollapsed(colId) })), canDelete && column.items.length > 0 ? (_jsx(ColumnDeleteAll, { colId: colId, title: column.title, hoveredColumn: hoveredColumn, colors: colors, onDelete: handleColumnDelete })) : (_jsx(Box, { boxSize: 4, flexShrink: 0 }))] })] })), !isColCollapsed && (_jsxs(Box, { px: 2, flex: "1", overflowY: "auto", width: "100%", sx: {
|
|
416
417
|
...scrollbarStyles(colors),
|
|
417
418
|
overflowY: "auto",
|
|
418
419
|
overflowX: "hidden",
|
|
@@ -454,7 +455,7 @@ const KanbanBoard = ({ data, customColumns, customizeColumn, onDrag, onDelete, o
|
|
|
454
455
|
}
|
|
455
456
|
return renderColumnDroppable(colId, column, null, isColCollapsed);
|
|
456
457
|
});
|
|
457
|
-
const loadingSkeletonRow = Array.from({ length: 4 }).map((_, idx) => (_jsxs(Box, { "aria-hidden": true, width: columnWidth, borderRadius: "xl", bg: colors.background[100], border: `${BORDER_WIDTHS.hairline} solid ${colors.
|
|
458
|
+
const loadingSkeletonRow = Array.from({ length: 4 }).map((_, idx) => (_jsxs(Box, { "aria-hidden": true, width: columnWidth, borderRadius: "xl", bg: colors.background[100], border: `${BORDER_WIDTHS.hairline} solid ${ruleOn(colors, colors.background[100])}`, flexShrink: 0, alignSelf: "flex-start", overflow: "hidden", children: [_jsxs(Flex, { h: "2.75rem", align: "center", gap: 2, px: 3, borderBottom: `${BORDER_WIDTHS.hairline} solid ${ruleOn(colors, colors.background[100])}`, children: [_jsx(SkeletonCircle, { size: "2.5" }), _jsx(Skeleton, { h: 3, w: "40%", borderRadius: "sm" }), _jsx(Skeleton, { h: 6, w: 6, ml: "auto", borderRadius: "full" })] }), _jsx(Flex, { direction: "column", gap: 3, px: 2, pt: 1.5, pb: 3, children: SKELETON_ROWS.slice(0, 3 - (idx % 2)).map((rows, i) => (_jsx(CardSkeleton, { colors: colors, rows: rows }, i))) })] }, idx)));
|
|
458
459
|
return (_jsxs(_Fragment, { children: [_jsx(HeaderActions, { select: kanbanSelect, edit: canDrag ? kanbanEdit : undefined, create: canCreate ? kanbanCreate : undefined }), _jsx(DragDropContext, { onDragEnd: onDragEnd, children: _jsxs(Box, { ref: containerRef, "data-testid": "kanban-board", "aria-busy": isBoardLoading || undefined, bg: colors.backgroundColor.main, h: height !== null && height !== void 0 ? height : `${viewportHeight}px`, maxH: maxH, position: "relative", overflow: "hidden", mt: 2, children: [showAddColumn && !isBoardLoading && !hasAnyColumns && (_jsx(Flex, { position: "absolute", inset: 0, align: "center", justify: "center", pointerEvents: "none", zIndex: 1, children: _jsxs(Flex, { direction: "column", align: "center", justify: "center", gap: 2, pointerEvents: "auto", cursor: "pointer", px: 6, py: 5, borderRadius: "lg", bg: colors.background[100], border: `0.125rem dashed ${colors.boxborder[500]}`, _hover: { borderColor: colors.primary[500] }, ...addColumnKeyboard, children: [_jsx(Box, { as: Plus, size: 20, color: colors.text[700] }), _jsx(Text, { fontSize: "sm", color: colors.text[600], children: (customizeColumn === null || customizeColumn === void 0 ? void 0 : customizeColumn.buttonText) || "Add column" })] }) })), isBoardLoading ? (_jsx(Flex, { role: "status", "aria-label": "Loading board", gap: 4, p: 4, pb: 6, overflowX: "auto", overflowY: "hidden", height: "100%", sx: flexScrollSx, children: loadingSkeletonRow })) : enableColumnReorder ? (_jsx(Droppable, { droppableId: "COLUMN_REORDER", direction: "horizontal", type: "COLUMN", children: (colReorderProvided) => (_jsxs(Flex, { ref: colReorderProvided.innerRef, ...colReorderProvided.droppableProps, gap: 4, p: 4, pb: 6, overflowX: "auto", overflowY: "hidden", height: "100%", sx: flexScrollSx, children: [columnsList, colReorderProvided.placeholder, addColumnBox] })) })) : (_jsxs(Flex, { gap: 4, p: 4, pb: 6, overflowX: "auto", overflowY: "hidden", height: "100%", sx: flexScrollSx, children: [columnsList, addColumnBox] }))] }) })] }));
|
|
459
460
|
};
|
|
460
461
|
export default KanbanBoard;
|
|
@@ -3,6 +3,7 @@ import { Box, Button, Flex, Menu, MenuButton, MenuDivider, MenuItem, MenuList, S
|
|
|
3
3
|
import Avatar from "../Avatar/Avatar.js";
|
|
4
4
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
5
5
|
import { raisedRule } from "../../Theme/tokens/builders/surfaceRaised.js";
|
|
6
|
+
import { ruleOn } from "../../Theme/tokens/builders/planeStep.js";
|
|
6
7
|
import { accentTextOnCanvas, isDarkCanvas } from "../../Theme/tokens/builders/accentText.js";
|
|
7
8
|
import { resolveHoverTint } from "../../Theme/tokens/builders/outlineRung.js";
|
|
8
9
|
import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
|
|
@@ -48,7 +49,7 @@ export default function NavBar({ userAvathar, userName, userRole, navMenu, moreI
|
|
|
48
49
|
_focus: { bg: menuHoverBg },
|
|
49
50
|
_active: { bg: rowBackgrounds.selectedActive },
|
|
50
51
|
};
|
|
51
|
-
return (_jsx(Box, { bg: theme.colors.backgroundColor.light, px: 4, borderBottom: "1px solid", borderColor: theme.colors.
|
|
52
|
+
return (_jsx(Box, { bg: theme.colors.backgroundColor.light, px: 4, borderBottom: "1px solid", borderColor: ruleOn(theme.colors, theme.colors.backgroundColor.light), children: _jsxs(Flex, { h: 16, alignItems: "center", justifyContent: "space-between", gap: 2, children: [_jsxs(Box, { display: "flex", gap: 1.5, alignItems: "center", flex: "1 1 0%", children: [_jsx(Box, { as: "button", type: "button", onClick: () => onSideBarToggole === null || onSideBarToggole === void 0 ? void 0 : onSideBarToggole(), onMouseEnter: onSideBarPeek, onFocus: onSideBarPeek, "aria-label": sideBarToggole ? "Close navigation menu" : "Open navigation menu", "aria-expanded": !!sideBarToggole, ...iconButtonStyle, flexShrink: 0, display: forceSideBarToggle ? "flex" : { base: "flex", lg: "none" }, w: SIDEBAR_TOGGLE_HIT, h: SIDEBAR_TOGGLE_HIT, children: sideBarToggole ? (_jsx(PanelLeftClose, { size: "1.25rem" })) : (_jsx(PanelRightClose, { size: "1.25rem" })) }), (navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.onIconClick) && (_jsx(Box, { ...iconButtonStyle, as: "button", type: "button", "aria-label": "Go back", display: "flex", flexShrink: 0, onClick: () => { var _a; return (_a = navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.onIconClick) === null || _a === void 0 ? void 0 : _a.call(navigationBarText); }, children: _jsx(CircleArrowLeft, { size: "1.25rem", color: theme.colors.text[500] }) })), leading && (_jsxs(_Fragment, { children: [leading, _jsx(Box, { as: "span", "aria-hidden": "true", mx: 2, w: "1px", h: "1.625rem", flexShrink: 0, bg: ruleOn(theme.colors, theme.colors.backgroundColor.light) })] })), (navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.text) && (_jsx(ToolTip, { label: typeof navigationBarText.text === "string" ? navigationBarText.text : "", overflowOnly: true, placement: "bottom", children: _jsx(Text, { flex: "1 1 0%", w: 0, minW: 0, isTruncated: true, color: accentTextOnCanvas(theme.colors.secondary, theme.colors.backgroundColor.light), fontSize: "xl", fontWeight: 600, fontFamily: "open-sans, sans-serif", letterSpacing: "-0.013rem", children: navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.text }) }))] }), _jsx(Flex, { minW: 0, flexShrink: 1, children: _jsxs(Stack, { direction: "row", alignItems: "center", spacing: 4, minW: 0, children: [moreIcon && (_jsx(Box, { display: "flex", alignItems: "center", minW: 0, sx: { "& > *": { minW: 0 } }, children: moreIcon })), _jsxs(Menu, { children: [_jsx(MenuButton, { as: Button, rounded: "full", variant: "link", cursor: "pointer", minW: 0, flexShrink: 0, children: _jsx(Avatar, { size: "sm", name: userName, src: userAvathar }) }), _jsx(MenuList, { alignItems: "center", zIndex: 5, p: 0, py: "0.375rem",
|
|
52
53
|
// Without a cap one long title stretches the whole dropdown; titles truncate instead.
|
|
53
54
|
maxW: "18rem", bg: theme.colors.surfaceRaised,
|
|
54
55
|
// NOTE: Chakra's MenuItem inherits --menu-bg hardcoded to #fff via dead _dark — set it or items stay white.
|
|
@@ -7,6 +7,7 @@ import { accentTextOnCanvas, onFilled } from "../../Theme/tokens/builders/accent
|
|
|
7
7
|
import { chartMode } from "../../Theme/tokens/builders/chartColorsFromTheme.js";
|
|
8
8
|
import { resolveHoverTint } from "../../Theme/tokens/builders/outlineRung.js";
|
|
9
9
|
import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
|
|
10
|
+
import { optionRowCursorSx } from "../Select/optionRowInk.js";
|
|
10
11
|
import { useExclusiveOverlay } from "../../Hooks/useExclusiveOverlay.js";
|
|
11
12
|
import { useMatchMedia } from "../../Hooks/useMatchMedia.js";
|
|
12
13
|
import ToolTip from "../ToolTip/ToolTip.js";
|
|
@@ -106,14 +107,11 @@ const OrgSwitcher = ({ organizations, value, onChange, isLoading = false, isSear
|
|
|
106
107
|
}
|
|
107
108
|
}, borderRadius: "lg" })] }) })), _jsxs(Box, { role: "listbox", "aria-label": "Organizations", maxH: "320px", overflowY: "auto", py: 1, onKeyDown: handleListKeyDown, children: [filtered.map((org, idx) => {
|
|
108
109
|
const isActive = org.id === value;
|
|
109
|
-
const rowHoverBg = isActive
|
|
110
|
-
? rowBackgrounds.selectedActive
|
|
111
|
-
: rowBackgrounds.active;
|
|
112
110
|
return (_jsxs(Flex, { as: "button", type: "button", role: "option", "aria-selected": isActive, ref: (el) => {
|
|
113
111
|
optionRefs.current[idx] = el;
|
|
114
112
|
if (idx === 0)
|
|
115
113
|
firstOptionRef.current = el;
|
|
116
|
-
}, tabIndex: idx === activeIndex ? 0 : -1, align: "center", gap: "10px", w: "100%", textAlign: "left", border: "none", fontFamily: "inherit", px: 3, py: 2, cursor: "pointer", bg:
|
|
114
|
+
}, tabIndex: idx === activeIndex ? 0 : -1, align: "center", gap: "10px", w: "100%", textAlign: "left", border: "none", fontFamily: "inherit", px: 3, py: 2, cursor: "pointer", bg: "transparent", transition: "background 0.12s ease", ...optionRowCursorSx(rowBackgrounds), onClick: () => handleSelect(org), children: [_jsx(Avatar, { org: org, boxSize: s.avatar, fontSize: s.sub }), _jsxs(Box, { flex: "1", minW: 0, children: [_jsx(Text, { fontSize: s.font, fontWeight: isActive ? 600 : 500, color: theme.colors.text[900], overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: org.name }), showRole && org.role && (_jsx(Text, { fontSize: s.sub, color: theme.colors.text[500], overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: org.role }))] }), isActive && (_jsx(Box, { as: Check, size: 16, color: theme.colors.accentText, flexShrink: 0 }))] }, org.id));
|
|
117
115
|
}), filtered.length === 0 && (_jsx(Text, { fontSize: "sm", color: theme.colors.textMuted, textAlign: "center", py: 6, children: "No organizations found" }))] })] }) })] }));
|
|
118
116
|
};
|
|
119
117
|
export default OrgSwitcher;
|
|
@@ -6,7 +6,7 @@ import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
|
6
6
|
import { BORDER_WIDTHS } from "../../Theme/tokens/primitives/borderWidths.js";
|
|
7
7
|
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
8
8
|
import { accentTextOnCanvas } from "../../Theme/tokens/builders/accentText.js";
|
|
9
|
-
import {
|
|
9
|
+
import { resolveFilledSurface } from "../../Theme/tokens/builders/filledSurface.js";
|
|
10
10
|
import { hexToRgb } from "../../Theme/tokens/builders/color.js";
|
|
11
11
|
const RING_TRANSITION = transitionFor(["box-shadow"], "base");
|
|
12
12
|
const FADE_TRANSITION = transitionFor(["opacity"], "base");
|
|
@@ -23,6 +23,7 @@ export default function ProfilePhotoViewer({ photoUrl, onPhotoChange, imageWidth
|
|
|
23
23
|
const fileInputRef = useRef(null);
|
|
24
24
|
const theme = useCustomTheme();
|
|
25
25
|
const c = theme.colors;
|
|
26
|
+
const editFill = resolveFilledSurface(c.primary, c);
|
|
26
27
|
const handlePhotoChange = (event) => {
|
|
27
28
|
var _a;
|
|
28
29
|
if (!isEditable)
|
|
@@ -72,14 +73,14 @@ export default function ProfilePhotoViewer({ photoUrl, onPhotoChange, imageWidth
|
|
|
72
73
|
"&:hover .ppv-media": {
|
|
73
74
|
boxShadow: `0 0 0 0.1875rem ${c.primary.opacity[24]}`,
|
|
74
75
|
},
|
|
75
|
-
}, children: [_jsx(Box, { className: "ppv-media", borderRadius: imageBorderRadius, transition: RING_TRANSITION, children: renderMedia() }), hasActions && (_jsxs(_Fragment, { children: [_jsx(Box, { className: "ppv-overlay", position: "absolute", inset: 0, borderRadius: imageBorderRadius, bg: hoverScrim(0.3), opacity: 0, transition: FADE_TRANSITION, pointerEvents: "none" }), _jsxs(HStack, { className: "ppv-actions", position: "absolute", right: editIconPositionRight, bottom: editIconPositionBottom, transform: "translate(-15%, -15%)", spacing: 1.5, opacity: revealOnHover ? 0 : 1, transition: FADE_TRANSITION, children: [isEditable && (_jsx(Tooltip, { label: "Edit", "aria-label": "Edit", hasArrow: true, children: _jsx(IconButton, { icon: _jsx(SquarePen, { size: 14 }), isRound: isRound, size: editIconSize, onClick: handleClick, "aria-label": "Edit photo", bg:
|
|
76
|
-
bg:
|
|
77
|
-
color:
|
|
76
|
+
}, children: [_jsx(Box, { className: "ppv-media", borderRadius: imageBorderRadius, transition: RING_TRANSITION, children: renderMedia() }), hasActions && (_jsxs(_Fragment, { children: [_jsx(Box, { className: "ppv-overlay", position: "absolute", inset: 0, borderRadius: imageBorderRadius, bg: hoverScrim(0.3), opacity: 0, transition: FADE_TRANSITION, pointerEvents: "none" }), _jsxs(HStack, { className: "ppv-actions", position: "absolute", right: editIconPositionRight, bottom: editIconPositionBottom, transform: "translate(-15%, -15%)", spacing: 1.5, opacity: revealOnHover ? 0 : 1, transition: FADE_TRANSITION, children: [isEditable && (_jsx(Tooltip, { label: "Edit", "aria-label": "Edit", hasArrow: true, children: _jsx(IconButton, { icon: _jsx(SquarePen, { size: 14 }), isRound: isRound, size: editIconSize, onClick: handleClick, "aria-label": "Edit photo", bg: editFill.fill, color: editFill.color, border: `0.125rem solid ${c.background[50]}`, boxShadow: (_b = theme.shadows) === null || _b === void 0 ? void 0 : _b.md, style: style, transition: ACTION_TRANSITION, _hover: {
|
|
77
|
+
bg: editFill.hoverFill,
|
|
78
|
+
color: editFill.hoverColor,
|
|
78
79
|
transform: "scale(1.1)",
|
|
79
80
|
boxShadow: (_c = theme.shadows) === null || _c === void 0 ? void 0 : _c.lg,
|
|
80
81
|
}, _active: {
|
|
81
|
-
bg:
|
|
82
|
-
color:
|
|
82
|
+
bg: editFill.activeFill,
|
|
83
|
+
color: editFill.activeColor,
|
|
83
84
|
} }) })), isView && (_jsx(Tooltip, { label: "View", "aria-label": "View", hasArrow: true, children: _jsx(IconButton, { icon: _jsx(Eye, { size: 14 }), isRound: isRound, size: editIconSize, onClick: handleIsView, "aria-label": "View photo", bg: c.background[50], color: c.text[700], border: `${BORDER_WIDTHS.hairline} solid ${border}`, boxShadow: (_d = theme.shadows) === null || _d === void 0 ? void 0 : _d.md, style: style, transition: ACTION_TRANSITION, _hover: {
|
|
84
85
|
bg: c.gray[50],
|
|
85
86
|
color: accentTextOnCanvas(c.primary, c.gray[50]),
|
|
@@ -5,7 +5,7 @@ import { ChevronUp } from "lucide-react";
|
|
|
5
5
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
6
6
|
import ToolTip from "../ToolTip/ToolTip.js";
|
|
7
7
|
import { rafThrottle } from "../../Utils/rafThrottle.js";
|
|
8
|
-
import {
|
|
8
|
+
import { resolveFilledSurface } from "../../Theme/tokens/builders/filledSurface.js";
|
|
9
9
|
import { transitionFor } from "../../Theme/tokens/primitives/index.js";
|
|
10
10
|
import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
|
|
11
11
|
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
@@ -14,6 +14,7 @@ const ScrollToTop = ({ children, tooltipLabel = "Scroll to top", threshold = 300
|
|
|
14
14
|
const [visible, setVisible] = useState(false);
|
|
15
15
|
const anchorRef = useRef(null);
|
|
16
16
|
const theme = useCustomTheme();
|
|
17
|
+
const fill = resolveFilledSurface(theme.colors.primary, theme.colors);
|
|
17
18
|
const getScroller = () => {
|
|
18
19
|
var _a, _b;
|
|
19
20
|
if (useWindow)
|
|
@@ -62,9 +63,9 @@ const ScrollToTop = ({ children, tooltipLabel = "Scroll to top", threshold = 300
|
|
|
62
63
|
};
|
|
63
64
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
64
65
|
}, [useWindow, threshold]);
|
|
65
|
-
return (_jsxs(Box, { ref: anchorRef, position: "relative", children: [children, _jsx(ToolTip, { label: tooltipLabel, placement: "left", children: _jsx(Box, { as: "button", type: "button", onClick: scrollToTop, "aria-label": tooltipLabel, border: "none", position: "fixed", bottom: bottom, right: right, zIndex: 1000, display: "flex", alignItems: "center", justifyContent: "center", boxSize: "44px", borderRadius: "full", cursor: "pointer", bg:
|
|
66
|
-
bg:
|
|
67
|
-
color:
|
|
66
|
+
return (_jsxs(Box, { ref: anchorRef, position: "relative", children: [children, _jsx(ToolTip, { label: tooltipLabel, placement: "left", children: _jsx(Box, { as: "button", type: "button", onClick: scrollToTop, "aria-label": tooltipLabel, border: "none", position: "fixed", bottom: bottom, right: right, zIndex: 1000, display: "flex", alignItems: "center", justifyContent: "center", boxSize: "44px", borderRadius: "full", cursor: "pointer", bg: fill.fill, color: fill.color, boxShadow: "md", opacity: visible ? 1 : 0, transform: visible ? "translateY(0) scale(1)" : "translateY(16px) scale(0.85)", pointerEvents: visible ? "auto" : "none", transition: transitionFor(["opacity", "transform", "box-shadow", "background-color", "color"], "base"), _hover: {
|
|
67
|
+
bg: fill.hoverFill,
|
|
68
|
+
color: fill.hoverColor,
|
|
68
69
|
transform: "translateY(-2px) scale(1.05)",
|
|
69
70
|
boxShadow: "lg",
|
|
70
71
|
}, _active: { transform: "scale(0.95)" }, sx: { ...focusVisibleStyles(theme.colors), ...reducedMotionSx({ transform: "none" }) }, children: _jsx(ChevronUp, { size: 24, strokeWidth: 2.5 }) }) })] }));
|
|
@@ -7,8 +7,8 @@ import Tag from "../Tag/Tag.js";
|
|
|
7
7
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
8
8
|
import { raisedRule } from "../../Theme/tokens/builders/surfaceRaised.js";
|
|
9
9
|
import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
|
|
10
|
-
import { optionRowSpec } from "../../Theme/tokens/primitives/optionRowSizes.js";
|
|
11
|
-
import { optionRowInk, optionRowWeight } from "../Select/optionRowInk.js";
|
|
10
|
+
import { OPTION_ROW_RADIUS, optionRowSpec } from "../../Theme/tokens/primitives/optionRowSizes.js";
|
|
11
|
+
import { optionRowCursorSx, optionRowFill, optionRowInk, optionRowWeight } from "../Select/optionRowInk.js";
|
|
12
12
|
import { useExclusiveOverlay } from "../../Hooks/useExclusiveOverlay.js";
|
|
13
13
|
import FieldMessage from "../Common/FieldMessage.js";
|
|
14
14
|
import { useFieldIds } from "../Common/useFieldIds.js";
|
|
@@ -41,17 +41,9 @@ const normalizeMultiValue = (val) => {
|
|
|
41
41
|
const DECORATIVE_CHECKBOX_SX = { pointerEvents: "none", "& input": { visibility: "hidden" } };
|
|
42
42
|
const OptionRow = React.memo(function OptionRow({ option, index, optionId, isSelected, isActive, isMultiple, spec, colors, rowBackgrounds, checkboxSize, onSelect, onActivate, }) {
|
|
43
43
|
const singleSelected = isSelected && !isMultiple;
|
|
44
|
-
return (_jsxs(Box, { id: optionId, "data-index": index, role: "option", "aria-selected": isSelected, py: spec.py, px: spec.px, minH: spec.minH, cursor: "pointer", bg:
|
|
45
|
-
? isActive
|
|
46
|
-
? rowBackgrounds.selectedActive
|
|
47
|
-
: rowBackgrounds.selected
|
|
48
|
-
: isActive
|
|
49
|
-
? rowBackgrounds.active
|
|
50
|
-
: "transparent", _hover: {
|
|
51
|
-
bg: isSelected ? rowBackgrounds.selectedActive : rowBackgrounds.active,
|
|
52
|
-
}, onClick: () => onSelect(option), onMouseEnter: () => onActivate(index), display: "flex", alignItems: "center", gap: spec.gap, color: optionRowInk(colors, singleSelected),
|
|
44
|
+
return (_jsxs(Box, { id: optionId, "data-index": index, role: "option", "aria-selected": isSelected, mx: spec.mx, py: spec.py, px: spec.px, minH: spec.minH, borderRadius: OPTION_ROW_RADIUS, cursor: "pointer", bg: optionRowFill(rowBackgrounds, isActive), onClick: () => onSelect(option), onMouseEnter: () => onActivate(index), display: "flex", alignItems: "center", gap: spec.gap, color: optionRowInk(colors, singleSelected),
|
|
53
45
|
// `view` is consumer JSX with no size of its own; it inherited the 16px body font.
|
|
54
|
-
fontSize: spec.fontSize, fontWeight: optionRowWeight(singleSelected),
|
|
46
|
+
fontSize: spec.fontSize, fontWeight: optionRowWeight(singleSelected), children: [isMultiple && (_jsx(Checkbox, { isChecked: isSelected, sx: DECORATIVE_CHECKBOX_SX, size: checkboxSize })), option.view ? (_jsx(_Fragment, { children: option.view })) : (_jsx(Text, { flex: 1, minW: 0, isTruncated: true, children: option.label })), singleSelected && (_jsx(Box, { as: Check, size: spec.iconSize, color: colors.accentText, flexShrink: 0 }))] }));
|
|
55
47
|
});
|
|
56
48
|
/** Full-featured combobox: search, chips, select-all, paginated infinite scroll — not DOM-virtualized despite the `virtualization` prop. */
|
|
57
49
|
/** Prefer `Select` with `native={false}` for new work — not yet a drop-in; see select-absorption-spec.md. */
|
|
@@ -618,11 +610,7 @@ const SearchSelect = ({ id, label, options, onChange, onSelect, onSearch, isOpti
|
|
|
618
610
|
}, 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.textMuted, 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: CHEVRON_TRANSITION, transform: customSelectOpen ? "rotate(180deg)" : "rotate(0deg)", children: _jsx(ChevronDown, { size: s.chevronSize }) })] }), customSelectOpen && (_jsx(Portal, { children: _jsx(Box, { ref: setInsideSelectMenuRef, id: insideSelectPortalId, role: "listbox", "aria-label": insidePlaceholder, onKeyDown: handleInsideMenuKeyDown, onFocus: stopFocusBubbling, onBlur: stopFocusBubbling, position: "fixed", style: { top: `${customSelectPos.top}px`, left: `${customSelectPos.left}px` }, zIndex: zIndices.popoverNested, bg: theme.colors.surfaceRaised, border: `${BORDER_WIDTHS.hairline} solid`, borderColor: theme.colors.boxborder[200], borderRadius: "xl", boxShadow: theme.shadows.lg, minW: `${customSelectPos.width}px`, maxW: "20rem", py: 1, overflow: "hidden", children: (_c = insideSelect.option) === null || _c === void 0 ? void 0 : _c.map((item) => {
|
|
619
611
|
var _a;
|
|
620
612
|
const selected = ((_a = insideSelect.value) === null || _a === void 0 ? void 0 : _a.id) === item.id;
|
|
621
|
-
return (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", gap: spec.gap, minH: spec.minH, py: spec.py, px: spec.px, fontSize: spec.fontSize, fontWeight: optionRowWeight(selected), color: optionRowInk(theme.colors, selected), bg:
|
|
622
|
-
bg: selected
|
|
623
|
-
? rowBackgrounds.selectedActive
|
|
624
|
-
: rowBackgrounds.active,
|
|
625
|
-
}, cursor: "pointer", role: "option", "aria-selected": selected, tabIndex: -1, _focusVisible: insideFocusRing, onClick: (e) => {
|
|
613
|
+
return (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", gap: spec.gap, minH: spec.minH, py: spec.py, px: spec.px, fontSize: spec.fontSize, fontWeight: optionRowWeight(selected), color: optionRowInk(theme.colors, selected), bg: "transparent", ...optionRowCursorSx(rowBackgrounds), cursor: "pointer", role: "option", "aria-selected": selected, tabIndex: -1, _focusVisible: insideFocusRing, onClick: (e) => {
|
|
626
614
|
e.stopPropagation();
|
|
627
615
|
handleCustomSelect(item);
|
|
628
616
|
}, children: [_jsx(Text, { isTruncated: true, children: item.label }), selected && (_jsx(Check, { size: spec.iconSize, color: theme.colors.accentText }))] }, item.id));
|
|
@@ -661,6 +649,6 @@ const SearchSelect = ({ id, label, options, onChange, onSelect, onSearch, isOpti
|
|
|
661
649
|
top: `${dropdownPos.top}px`,
|
|
662
650
|
left: `${dropdownPos.left}px`,
|
|
663
651
|
width: `${dropdownPos.width}px`,
|
|
664
|
-
}, zIndex: zIndices.popover, maxH: "20rem", borderWidth: 1, borderColor: theme.colors.boxborder[200], borderRadius: "xl", overflow: "hidden", bg: theme.colors.surfaceRaised, boxShadow: theme.shadows.lg, display: "flex", flexDirection: "column", children: [hasSelectAllRow && (_jsxs(Box, { id: selectAllId, role: "option", "aria-selected": allFilteredSelected, bg: activeIndex === SELECT_ALL_ROW ? rowBackgrounds.active : undefined, py: spec.py, px: spec.px, minH: spec.minH, cursor: "pointer", onClick: handleSelectAll, display: "flex", alignItems: "center", gap: spec.gap, color: theme.colors.text[700], borderBottom: `${BORDER_WIDTHS.hairline} solid ${raisedRule(theme.colors)}`, children: [_jsx(Checkbox, { isChecked: allFilteredSelected, sx: DECORATIVE_CHECKBOX_SX, size: s.checkboxSize }), _jsx(Text, { fontSize: spec.fontSize, children: allFilteredSelected ? "Unselect All" : "Select All" })] })), _jsx(Box, { ref: optionsListRef, flex: "1", overflowY: "auto", onScroll: handleScroll, maxH: "15rem", borderBottom: `${BORDER_WIDTHS.hairline} solid`, borderColor: raisedRule(theme.colors), children: isOptionLoading && filteredOptions.length === 0 ? (_jsxs(Box, { py: spec.py, px: spec.px, display: "flex", alignItems: "center", gap: spec.gap, minH: spec.minH, color: theme.colors.textMuted, children: [_jsx(Spinner, { size: s.spinnerSize }), _jsx(Text, { fontSize: spec.fontSize, children: loadingText })] })) : !isOptionLoading && filteredOptions.length === 0 ? (_jsx(Text, { p: 3, fontSize: spec.fontSize, color: theme.colors.textMuted, children: "No results found" })) : (_jsxs(_Fragment, { children: [filteredOptions.map((option, index) => (_jsx(OptionRow, { option: option, index: index, optionId: getOptionId(index), isSelected: isSelected(option.id), isActive: index === activeIndex, isMultiple: isMultiple, spec: spec, colors: theme.colors, rowBackgrounds: rowBackgrounds, checkboxSize: s.checkboxSize, onSelect: selectOption, onActivate: setActiveIndex }, option.id))), ((pagination === null || pagination === void 0 ? void 0 : pagination.scrollLoading) || (isOptionLoading && filteredOptions.length > 0)) && (_jsxs(Box, { py: spec.py, px: spec.px, display: "flex", alignItems: "center", justifyContent: "center", gap: spec.gap, minH: spec.minH, color: theme.colors.textMuted, children: [_jsx(Spinner, { size: s.spinnerSize }), _jsx(Text, { fontSize: spec.fontSize, children: loadingText })] }))] })) }), (addNew === null || addNew === void 0 ? void 0 : addNew.enabled) && (_jsxs(Box, { id: addNewId, role: "option", "aria-selected": false, py: spec.py, px: spec.px, borderTop: `${BORDER_WIDTHS.hairline} solid`, borderColor: raisedRule(theme.colors), bg: activeIndex === ADD_NEW_ROW ? rowBackgrounds.active : theme.colors.surfaceRaised, display: "flex", alignItems: "center", gap: spec.gap, color: theme.colors.accentText, fontWeight: 500, minH: spec.minH, cursor: "pointer", onClick: addNew.onClick, _hover: { bg: rowBackgrounds.active }, children: [addNew.icon || _jsx(Plus, { size: s.addNewIconSize }), _jsx(Text, { fontSize: spec.fontSize, children: addNew.text || "Add New" })] }))] }) })), _jsx(FieldMessage, { error: error, errorMessage: errorMessage, helperText: helperText, helperId: ids.helperId, errorId: ids.errorId })] }));
|
|
652
|
+
}, zIndex: zIndices.popover, maxH: "20rem", borderWidth: 1, borderColor: theme.colors.boxborder[200], borderRadius: "xl", overflow: "hidden", bg: theme.colors.surfaceRaised, boxShadow: theme.shadows.lg, display: "flex", flexDirection: "column", children: [hasSelectAllRow && (_jsxs(Box, { id: selectAllId, role: "option", "aria-selected": allFilteredSelected, bg: activeIndex === SELECT_ALL_ROW ? rowBackgrounds.active : undefined, py: spec.py, px: spec.px, minH: spec.minH, cursor: "pointer", onClick: handleSelectAll, display: "flex", alignItems: "center", gap: spec.gap, color: theme.colors.text[700], borderBottom: `${BORDER_WIDTHS.hairline} solid ${raisedRule(theme.colors)}`, children: [_jsx(Checkbox, { isChecked: allFilteredSelected, sx: DECORATIVE_CHECKBOX_SX, size: s.checkboxSize }), _jsx(Text, { fontSize: spec.fontSize, children: allFilteredSelected ? "Unselect All" : "Select All" })] })), _jsx(Box, { ref: optionsListRef, flex: "1", overflowY: "auto", onScroll: handleScroll, maxH: "15rem", py: 1, borderBottom: `${BORDER_WIDTHS.hairline} solid`, borderColor: raisedRule(theme.colors), children: isOptionLoading && filteredOptions.length === 0 ? (_jsxs(Box, { py: spec.py, px: spec.px, display: "flex", alignItems: "center", gap: spec.gap, minH: spec.minH, color: theme.colors.textMuted, children: [_jsx(Spinner, { size: s.spinnerSize }), _jsx(Text, { fontSize: spec.fontSize, children: loadingText })] })) : !isOptionLoading && filteredOptions.length === 0 ? (_jsx(Text, { p: 3, fontSize: spec.fontSize, color: theme.colors.textMuted, children: "No results found" })) : (_jsxs(_Fragment, { children: [filteredOptions.map((option, index) => (_jsx(OptionRow, { option: option, index: index, optionId: getOptionId(index), isSelected: isSelected(option.id), isActive: index === activeIndex, isMultiple: isMultiple, spec: spec, colors: theme.colors, rowBackgrounds: rowBackgrounds, checkboxSize: s.checkboxSize, onSelect: selectOption, onActivate: setActiveIndex }, option.id))), ((pagination === null || pagination === void 0 ? void 0 : pagination.scrollLoading) || (isOptionLoading && filteredOptions.length > 0)) && (_jsxs(Box, { py: spec.py, px: spec.px, display: "flex", alignItems: "center", justifyContent: "center", gap: spec.gap, minH: spec.minH, color: theme.colors.textMuted, children: [_jsx(Spinner, { size: s.spinnerSize }), _jsx(Text, { fontSize: spec.fontSize, children: loadingText })] }))] })) }), (addNew === null || addNew === void 0 ? void 0 : addNew.enabled) && (_jsxs(Box, { id: addNewId, role: "option", "aria-selected": false, py: spec.py, px: spec.px, borderTop: `${BORDER_WIDTHS.hairline} solid`, borderColor: raisedRule(theme.colors), bg: activeIndex === ADD_NEW_ROW ? rowBackgrounds.active : theme.colors.surfaceRaised, display: "flex", alignItems: "center", gap: spec.gap, color: theme.colors.accentText, fontWeight: 500, minH: spec.minH, cursor: "pointer", onClick: addNew.onClick, _hover: { bg: rowBackgrounds.active }, children: [addNew.icon || _jsx(Plus, { size: s.addNewIconSize }), _jsx(Text, { fontSize: spec.fontSize, children: addNew.text || "Add New" })] }))] }) })), _jsx(FieldMessage, { error: error, errorMessage: errorMessage, helperText: helperText, helperId: ids.helperId, errorId: ids.errorId })] }));
|
|
665
653
|
};
|
|
666
654
|
export default SearchSelect;
|
|
@@ -6,7 +6,7 @@ import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
|
6
6
|
import { raisedRule } from "../../Theme/tokens/builders/surfaceRaised.js";
|
|
7
7
|
import { focusGlowShadow } from "../../Theme/chakra/focusRing.styles.js";
|
|
8
8
|
import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
|
|
9
|
-
import { optionRowDescriptionInk, optionRowInk, optionRowWeight } from "./optionRowInk.js";
|
|
9
|
+
import { optionRowDescriptionInk, optionRowFill, optionRowInk, optionRowWeight } from "./optionRowInk.js";
|
|
10
10
|
import { optionRowSpec } from "../../Theme/tokens/primitives/optionRowSizes.js";
|
|
11
11
|
import { scrollbarStyles } from "../../Theme/tokens/builders/scrollbar.js";
|
|
12
12
|
import { CONTROL_SIZES, DEFAULT_CONTROL_SIZE } from "../../Theme/tokens/primitives/controlSizes.js";
|
|
@@ -36,9 +36,7 @@ const parseRemToPx = (value, fallbackPx) => {
|
|
|
36
36
|
};
|
|
37
37
|
const OptionRow = React.memo(function OptionRow({ option, index, listboxId, isSelected, isActive, isMulti, theme, backgrounds, spec, renderOption, onSelect, onActivate, }) {
|
|
38
38
|
const isSingleSelected = isSelected && !isMulti;
|
|
39
|
-
|
|
40
|
-
const restBg = isActive ? backgrounds.active : "transparent";
|
|
41
|
-
return (_jsxs(Box, { id: optionDomId(listboxId, option.id), "data-index": index, role: "option", "aria-selected": isSelected, "aria-disabled": option.isDisabled, onMouseEnter: () => onActivate(index), onClick: () => onSelect(option), mx: spec.mx, px: spec.px, py: spec.py, minH: spec.minH, borderRadius: "md", cursor: option.isDisabled ? "not-allowed" : "pointer", opacity: option.isDisabled ? 0.4 : 1, display: "flex", alignItems: "center", gap: spec.gap, fontSize: spec.fontSize, fontWeight: optionRowWeight(isSingleSelected), color: optionRowInk(theme.colors, isSingleSelected), bg: isSingleSelected ? selectedBg : restBg, transition: ROW_TRANSITION, sx: reducedMotionSx(), children: [isMulti ? (_jsx(Checkbox, { id: `${optionDomId(listboxId, option.id)}-checkbox`, isChecked: isSelected, isDisabled: option.isDisabled, pointerEvents: "none", tabIndex: -1, sx: DECORATIVE_CHECKBOX_SX })) : 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: spec.descriptionFontSize, color: optionRowDescriptionInk(theme.colors), isTruncated: true, children: option.description })) : null] })] })), isSingleSelected ? (_jsx(Box, { as: Check, size: spec.iconSize, color: theme.colors.accentText, flexShrink: 0 })) : null] }));
|
|
39
|
+
return (_jsxs(Box, { id: optionDomId(listboxId, option.id), "data-index": index, role: "option", "aria-selected": isSelected, "aria-disabled": option.isDisabled, onMouseEnter: () => onActivate(index), onClick: () => onSelect(option), mx: spec.mx, px: spec.px, py: spec.py, minH: spec.minH, borderRadius: "md", cursor: option.isDisabled ? "not-allowed" : "pointer", opacity: option.isDisabled ? 0.4 : 1, display: "flex", alignItems: "center", gap: spec.gap, fontSize: spec.fontSize, fontWeight: optionRowWeight(isSingleSelected), color: optionRowInk(theme.colors, isSingleSelected), bg: optionRowFill(backgrounds, isActive), transition: ROW_TRANSITION, sx: reducedMotionSx(), children: [isMulti ? (_jsx(Checkbox, { id: `${optionDomId(listboxId, option.id)}-checkbox`, isChecked: isSelected, isDisabled: option.isDisabled, pointerEvents: "none", tabIndex: -1, sx: DECORATIVE_CHECKBOX_SX })) : 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: spec.descriptionFontSize, color: optionRowDescriptionInk(theme.colors), isTruncated: true, children: option.description })) : null] })] })), isSingleSelected ? (_jsx(Box, { as: Check, size: spec.iconSize, color: theme.colors.accentText, flexShrink: 0 })) : null] }));
|
|
42
40
|
});
|
|
43
41
|
const buildGroupedRows = (options) => {
|
|
44
42
|
const rows = [];
|
|
@@ -5,6 +5,13 @@ import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
|
|
|
5
5
|
export const optionRowInk = (colors, isSingleSelected) => isSingleSelected ? colors.text[900] : colors.text[700];
|
|
6
6
|
// A 12px sub-line reached only 4.00:1 on the hovered selected row in dark.
|
|
7
7
|
export const optionRowDescriptionInk = (colors) => liftToContrast(colors.textMuted, listRowBackgrounds(colors).selectedActive, AA_NORMAL_TEXT);
|
|
8
|
+
/** The one fill an option row paints: the cursor's (hover or keyboard). Selection never fills a row. */
|
|
9
|
+
export const optionRowFill = (rows, isActive) => isActive ? rows.active : "transparent";
|
|
10
|
+
/** Fill for rows that take real DOM focus (roving tabindex) — `:hover` and `:focus` are the cursor. */
|
|
11
|
+
export const optionRowCursorSx = (rows) => ({
|
|
12
|
+
_hover: { bg: rows.active },
|
|
13
|
+
_focus: { bg: rows.active },
|
|
14
|
+
});
|
|
8
15
|
export const OPTION_ROW_REST_WEIGHT = 400;
|
|
9
16
|
// NOTE: 600 beside a tinted fill and a check read as three signals for one state.
|
|
10
17
|
export const OPTION_ROW_SELECTED_WEIGHT = 500;
|
|
@@ -14,7 +14,7 @@ import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
|
14
14
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
15
15
|
import { raisedRule } from "../../Theme/tokens/builders/surfaceRaised.js";
|
|
16
16
|
import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
|
|
17
|
-
import { optionRowDescriptionInk, optionRowInk, optionRowWeight } from "../Select/optionRowInk.js";
|
|
17
|
+
import { optionRowCursorSx, optionRowDescriptionInk, optionRowInk, optionRowWeight } from "../Select/optionRowInk.js";
|
|
18
18
|
import { useExclusiveOverlay } from "../../Hooks/useExclusiveOverlay.js";
|
|
19
19
|
import { PlusIcon, Check } from "lucide-react";
|
|
20
20
|
const ROW_TRANSITION = transitionFor(["background-color"]);
|
|
@@ -30,18 +30,9 @@ const RenderOptions = ({ isOptionLoading, filteredOptions, loadingText, handleOp
|
|
|
30
30
|
const selected = isOptionSelected(option);
|
|
31
31
|
const isSingleSelected = selected && !isMultipleSelect;
|
|
32
32
|
const isActive = index === activeIndex;
|
|
33
|
-
const rowBg = selected
|
|
34
|
-
? isActive
|
|
35
|
-
? rowBackgrounds.selectedActive
|
|
36
|
-
: rowBackgrounds.selected
|
|
37
|
-
: isActive
|
|
38
|
-
? rowBackgrounds.active
|
|
39
|
-
: "transparent";
|
|
40
33
|
return (_jsxs(Box, { as: "button", type: "button", ref: (el) => {
|
|
41
34
|
optionRefs.current[index] = el;
|
|
42
|
-
}, role: "option", "aria-selected": selected, tabIndex: isActive ? 0 : -1, w: `calc(100% - 2 * ${spec.mx})`, minH: spec.minH, textAlign: "left", border: "none", fontFamily: "inherit", bg:
|
|
43
|
-
bg: selected ? rowBackgrounds.selectedActive : rowBackgrounds.active,
|
|
44
|
-
}, onClick: () => handleOptionClick(option), onKeyDown: (e) => {
|
|
35
|
+
}, role: "option", "aria-selected": selected, tabIndex: isActive ? 0 : -1, w: `calc(100% - 2 * ${spec.mx})`, minH: spec.minH, textAlign: "left", border: "none", fontFamily: "inherit", bg: "transparent", mx: spec.mx, px: spec.px, py: spec.py, borderRadius: OPTION_ROW_RADIUS, fontSize: spec.fontSize, cursor: "pointer", color: optionRowInk(theme.colors, isSingleSelected), fontWeight: optionRowWeight(isSingleSelected), transition: ROW_TRANSITION, sx: reducedMotionSx(), ...optionRowCursorSx(rowBackgrounds), onClick: () => handleOptionClick(option), onKeyDown: (e) => {
|
|
45
36
|
if (e.key === "Enter" || e.key === " ") {
|
|
46
37
|
e.preventDefault();
|
|
47
38
|
handleOptionClick(option);
|