pixelize-design-library 2.4.2-beta.45 → 2.4.2-beta.47

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +34 -4
  2. package/COMPONENT-GOTCHAS.md +47 -15
  3. package/dist/Components/Dropdown/DropDown.js +10 -8
  4. package/dist/Components/SearchSelect/SearchSelect.js +20 -15
  5. package/dist/Components/SearchSelect/searchSelectSize.d.ts +0 -5
  6. package/dist/Components/SearchSelect/searchSelectSize.js +0 -12
  7. package/dist/Components/SegmentedControl/SegmentedControl.js +4 -2
  8. package/dist/Components/SegmentedControl/SegmentedControlProps.d.ts +1 -1
  9. package/dist/Components/SegmentedControl/segmentedInk.d.ts +3 -3
  10. package/dist/Components/SegmentedControl/segmentedInk.js +8 -11
  11. package/dist/Components/Select/SelectPopup.js +16 -15
  12. package/dist/Components/Select/optionRowInk.d.ts +7 -0
  13. package/dist/Components/Select/optionRowInk.js +17 -0
  14. package/dist/Components/SelectSearch/SelectSearch.js +8 -4
  15. package/dist/Components/Switch/Switch.d.ts +1 -1
  16. package/dist/Components/Switch/Switch.js +4 -2
  17. package/dist/Components/Switch/SwitchProps.d.ts +1 -1
  18. package/dist/Components/Table/filters/CompactSelect.js +6 -3
  19. package/dist/Theme/chakra/Menu.styles.d.ts +6 -0
  20. package/dist/Theme/chakra/Menu.styles.js +8 -0
  21. package/dist/Theme/chakra/componentStyles.d.ts +6 -0
  22. package/dist/Theme/tokens/builders/outlineRung.d.ts +2 -0
  23. package/dist/Theme/tokens/builders/outlineRung.js +14 -1
  24. package/dist/Theme/tokens/builders/rowStates.js +3 -4
  25. package/dist/Theme/tokens/primitives/optionRowSizes.d.ts +20 -0
  26. package/dist/Theme/tokens/primitives/optionRowSizes.js +29 -0
  27. package/dist/esm/Components/Dropdown/DropDown.js +10 -8
  28. package/dist/esm/Components/SearchSelect/SearchSelect.js +20 -15
  29. package/dist/esm/Components/SearchSelect/searchSelectSize.js +0 -12
  30. package/dist/esm/Components/SegmentedControl/SegmentedControl.js +4 -2
  31. package/dist/esm/Components/SegmentedControl/segmentedInk.js +8 -11
  32. package/dist/esm/Components/Select/SelectPopup.js +17 -16
  33. package/dist/esm/Components/Select/optionRowInk.js +11 -0
  34. package/dist/esm/Components/SelectSearch/SelectSearch.js +9 -5
  35. package/dist/esm/Components/Switch/Switch.js +4 -2
  36. package/dist/esm/Components/Table/filters/CompactSelect.js +7 -4
  37. package/dist/esm/Theme/chakra/Menu.styles.js +8 -0
  38. package/dist/esm/Theme/tokens/builders/outlineRung.js +12 -0
  39. package/dist/esm/Theme/tokens/builders/rowStates.js +4 -5
  40. package/dist/esm/Theme/tokens/primitives/optionRowSizes.js +25 -0
  41. package/dist/esm/index.js +2 -0
  42. package/dist/index.d.ts +1 -0
  43. package/dist/index.js +9 -4
  44. package/package.json +1 -1
@@ -1,10 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
3
3
  import { Box, Checkbox, FormControl, Input, Popover, PopoverAnchor, PopoverContent, Portal, Spinner, useDisclosure, useMergeRefs, } from "@chakra-ui/react";
4
- import { ChevronDown, X } from "lucide-react";
4
+ import { Check, ChevronDown, X } from "lucide-react";
5
5
  import { useCustomTheme } from "../../Theme/useCustomTheme.js";
6
6
  import { focusGlowShadow } from "../../Theme/chakra/focusRing.styles.js";
7
7
  import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
8
+ import { optionRowDescriptionInk, optionRowInk, optionRowWeight } from "./optionRowInk.js";
9
+ import { optionRowSpec } from "../../Theme/tokens/primitives/optionRowSizes.js";
8
10
  import { scrollbarStyles } from "../../Theme/tokens/builders/scrollbar.js";
9
11
  import { CONTROL_SIZES, DEFAULT_CONTROL_SIZE } from "../../Theme/tokens/primitives/controlSizes.js";
10
12
  import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
@@ -20,8 +22,6 @@ const CHEVRON_TRANSITION = transitionFor(["transform"], "base");
20
22
  const PAGE_STEP = 8;
21
23
  const LOAD_MORE_THRESHOLD_PX = 8;
22
24
  const DEFAULT_MAX_VISIBLE_CHIPS = 6;
23
- // NOTE: approximate single-row height (px 2.5 + ~13px text); used only to window `virtualizeAfter`, never for layout.
24
- const VIRTUAL_ROW_HEIGHT_PX = 34;
25
25
  const VIRTUAL_OVERSCAN = 4;
26
26
  const CHIP_TAG_HEIGHT_PX = { xs: 20, sm: 24 };
27
27
  const controlHeightPx = (size) => parseFloat(CONTROL_SIZES[size].height) * 16;
@@ -38,11 +38,11 @@ const parseRemToPx = (value, fallbackPx) => {
38
38
  const match = /^(\d*\.?\d+)rem$/.exec(value);
39
39
  return match ? parseFloat(match[1]) * 16 : fallbackPx;
40
40
  };
41
- const OptionRow = React.memo(function OptionRow({ option, index, listboxId, isSelected, isActive, isMulti, theme, backgrounds, renderOption, onSelect, onActivate, }) {
41
+ const OptionRow = React.memo(function OptionRow({ option, index, listboxId, isSelected, isActive, isMulti, theme, backgrounds, spec, renderOption, onSelect, onActivate, }) {
42
42
  const isSingleSelected = isSelected && !isMulti;
43
43
  const selectedBg = isActive ? backgrounds.selectedActive : backgrounds.selected;
44
44
  const restBg = isActive ? backgrounds.active : "transparent";
45
- 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: 1.5, px: 2.5, py: 1.5, borderRadius: "md", cursor: option.isDisabled ? "not-allowed" : "pointer", opacity: option.isDisabled ? 0.4 : 1, display: "flex", alignItems: "center", gap: 2, fontSize: "0.8125rem", fontWeight: isSingleSelected ? 600 : 400, color: isSingleSelected ? theme.colors.accentText : theme.colors.text[700], 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 })) : null, renderOption ? (_jsx(Box, { flex: 1, minW: 0, children: renderOption(option, { isSelected, isActive }) })) : (_jsxs(_Fragment, { children: [option.icon ? (_jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, children: option.icon })) : null, _jsxs(Box, { flex: 1, minW: 0, isTruncated: true, children: [_jsx(Box, { as: "span", isTruncated: true, children: option.label }), option.description ? (_jsx(Box, { as: "span", display: "block", fontSize: "0.75rem", color: theme.colors.textMuted, isTruncated: true, children: option.description })) : null] })] }))] }));
45
+ 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 })) : 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] }));
46
46
  });
47
47
  const buildGroupedRows = (options) => {
48
48
  const rows = [];
@@ -176,27 +176,28 @@ const SelectPopup = forwardRef(function SelectPopup(props, ref) {
176
176
  const frame = requestAnimationFrame(() => { var _a; return (_a = filterInputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
177
177
  return () => cancelAnimationFrame(frame);
178
178
  }, [isOpen, isSearchable]);
179
+ const spec = useMemo(() => optionRowSpec(size), [size]);
179
180
  const maxMenuHeightPx = useMemo(() => parseRemToPx(maxMenuHeight, 256), [maxMenuHeight]);
180
181
  const shouldVirtualize = !!virtualizeAfter && !hasGroups && filteredOptions.length > virtualizeAfter;
181
182
  const [scrollTop, setScrollTop] = useState(0);
182
- const visibleCount = Math.ceil(maxMenuHeightPx / VIRTUAL_ROW_HEIGHT_PX) + VIRTUAL_OVERSCAN * 2;
183
+ const visibleCount = Math.ceil(maxMenuHeightPx / spec.virtualRowHeightPx) + VIRTUAL_OVERSCAN * 2;
183
184
  const startIndex = shouldVirtualize
184
- ? Math.max(0, Math.floor(scrollTop / VIRTUAL_ROW_HEIGHT_PX) - VIRTUAL_OVERSCAN)
185
+ ? Math.max(0, Math.floor(scrollTop / spec.virtualRowHeightPx) - VIRTUAL_OVERSCAN)
185
186
  : 0;
186
187
  const endIndex = shouldVirtualize
187
188
  ? Math.min(filteredOptions.length, startIndex + visibleCount)
188
189
  : filteredOptions.length;
189
190
  const renderedOptions = shouldVirtualize ? filteredOptions.slice(startIndex, endIndex) : filteredOptions;
190
- const topPadPx = shouldVirtualize ? startIndex * VIRTUAL_ROW_HEIGHT_PX : 0;
191
- const bottomPadPx = shouldVirtualize ? (filteredOptions.length - endIndex) * VIRTUAL_ROW_HEIGHT_PX : 0;
191
+ const topPadPx = shouldVirtualize ? startIndex * spec.virtualRowHeightPx : 0;
192
+ const bottomPadPx = shouldVirtualize ? (filteredOptions.length - endIndex) * spec.virtualRowHeightPx : 0;
192
193
  useEffect(() => {
193
194
  var _a, _b;
194
195
  if (activeIndex < 0 || !listRef.current)
195
196
  return;
196
197
  const el = listRef.current;
197
198
  if (shouldVirtualize) {
198
- const targetTop = activeIndex * VIRTUAL_ROW_HEIGHT_PX;
199
- const targetBottom = targetTop + VIRTUAL_ROW_HEIGHT_PX;
199
+ const targetTop = activeIndex * spec.virtualRowHeightPx;
200
+ const targetBottom = targetTop + spec.virtualRowHeightPx;
200
201
  if (targetTop < el.scrollTop) {
201
202
  el.scrollTop = targetTop;
202
203
  setScrollTop(targetTop);
@@ -209,7 +210,7 @@ const SelectPopup = forwardRef(function SelectPopup(props, ref) {
209
210
  return;
210
211
  }
211
212
  (_b = (_a = el.querySelector(`[data-index="${activeIndex}"]`)) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a, { block: "nearest" });
212
- }, [activeIndex, shouldVirtualize, maxMenuHeightPx]);
213
+ }, [activeIndex, shouldVirtualize, maxMenuHeightPx, spec.virtualRowHeightPx]);
213
214
  const moveActive = (delta) => {
214
215
  if (!filteredOptions.length)
215
216
  return;
@@ -372,14 +373,14 @@ const SelectPopup = forwardRef(function SelectPopup(props, ref) {
372
373
  const selectedValueIds = selectedOptions.map((option) => option.id.toString());
373
374
  const hiddenValues = !name ? [] : props.isMulti ? selectedValueIds : [(_c = selectedValueIds[0]) !== null && _c !== void 0 ? _c : ""];
374
375
  const groupedRows = useMemo(() => (hasGroups ? buildGroupedRows(filteredOptions) : []), [hasGroups, filteredOptions]);
375
- return (_jsxs(FormControl, { isInvalid: error, isDisabled: isDisabled, isReadOnly: isReadOnly, style: formControlStyle, width: width, children: [label && (_jsx(TextLabel, { label: label, id: ids.inputId, isRequired: isRequired, isInformation: isInformation, informationMessage: informationMessage })), _jsxs(Popover, { isOpen: isOpen, onClose: () => resetAndClose(), placement: "bottom-start", autoFocus: false, returnFocusOnClose: false, gutter: 4, children: [_jsx(PopoverAnchor, { children: _jsxs(Box, { as: "div", ref: mergedTriggerRef, ...ids.controlProps, role: "combobox", tabIndex: isDisabled ? -1 : 0, "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-controls": listboxId, "aria-owns": `${listboxId} ${filterInputId}`, "aria-activedescendant": activeDescendantId, "aria-disabled": isDisabled || undefined, "data-readonly": isReadOnly || undefined, "aria-required": isRequired || undefined, "aria-label": triggerAriaLabel(), "aria-labelledby": ariaLabelledBy, onClick: handleOpen, onKeyDown: handleTriggerKeyDown, display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%", textAlign: "left", cursor: isDisabled ? "not-allowed" : isReadOnly ? "default" : "pointer", "data-testid": dataTestId, sx: triggerSx, children: [_jsx(Box, { as: "span", display: "inline-flex", flexWrap: showChips ? "wrap" : "nowrap", alignItems: "center", gap: showChips ? 1 : 1.5, minW: 0, flex: 1, isTruncated: !showChips, children: showChips ? (_jsxs(_Fragment, { children: [visibleChipOptions.map((option) => (_jsx(Tag, { label: String(option.label), size: chipSize, variant: "subtle", icon: isInteractive ? X : undefined, onIconClick: isInteractive ? () => handleSelect(option) : undefined }, option.id))), overflowChipCount > 0 && (_jsx(Tag, { label: `+${overflowChipCount}`, size: chipSize, variant: "subtle", colorScheme: "gray" }))] })) : (_jsxs(_Fragment, { children: [triggerIcon ? (_jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, children: triggerIcon })) : null, _jsx(Box, { as: "span", isTruncated: true, children: renderValue ? renderValue(selectedOptions) : defaultTriggerContent() })] })) }), showClear && (_jsx(Box, { as: "button", type: "button", "aria-label": "Clear selection", onClick: handleClear, display: "inline-flex", alignItems: "center", justifyContent: "center", flexShrink: 0, ml: 2, color: colors.textMuted, _hover: { color: colors.text[700] }, children: _jsx(X, { size: CONTROL_SIZES[size].iconSize }) })), _jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, ml: 2, transition: CHEVRON_TRANSITION, transform: isOpen ? "rotate(180deg)" : "rotate(0deg)", color: colors.textMuted, sx: reducedMotionSx(), children: _jsx(ChevronDown, { size: CONTROL_SIZES[size].iconSize }) })] }) }), _jsx(Portal, { children: _jsxs(PopoverContent, { width: "max-content", minWidth: triggerWidth ? `${triggerWidth}px` : undefined, maxWidth: "min(24rem, calc(100vw - 2rem))", borderRadius: "xl", boxShadow: theme.shadows.lg, overflow: "hidden", onKeyDown: handleListKeyDown, children: [_jsx(Box, { p: 2, borderBottom: `0.063rem solid ${colors.boxborder[200]}`, display: isSearchable ? undefined : "none", children: _jsx(Input, { ref: filterInputRef, id: filterInputId, size: "sm", placeholder: "Type to filter...", value: currentSearch, onChange: handleFilterChange, "aria-activedescendant": activeDescendantId, "aria-controls": listboxId, "aria-label": "Filter options", tabIndex: isSearchable ? undefined : -1 }) }), _jsxs(Box, { id: listboxId, ref: listRef, role: "listbox", "aria-label": (_d = label !== null && label !== void 0 ? label : ariaLabel) !== null && _d !== void 0 ? _d : placeholder, "aria-multiselectable": props.isMulti || undefined, "aria-busy": isLoading || undefined, maxH: maxMenuHeight, overflowY: "auto", py: 1, sx: listScrollStyles, onScroll: handleListScroll, children: [filteredOptions.length === 0 && !isLoading && !showCreateRow && (_jsx(Box, { px: 3, py: 2, fontSize: "0.8125rem", color: colors.textMuted, children: noOptionsMessage !== null && noOptionsMessage !== void 0 ? noOptionsMessage : "No Options" })), showCreateRow && (_jsx(Box, { id: createRowId, role: "option", "aria-selected": false, "data-index": -1, onClick: handleCreate, mx: 1.5, px: 2.5, py: 1.5, borderRadius: "md", cursor: "pointer", fontSize: "0.8125rem", fontWeight: 600, color: colors.primary[600], bg: activeDescendantId === createRowId ? rowBackgrounds.active : "transparent", children: createLabel ? createLabel(currentSearch.trim()) : `Create "${currentSearch.trim()}"` })), hasGroups
376
+ return (_jsxs(FormControl, { isInvalid: error, isDisabled: isDisabled, isReadOnly: isReadOnly, style: formControlStyle, width: width, children: [label && (_jsx(TextLabel, { label: label, id: ids.inputId, isRequired: isRequired, isInformation: isInformation, informationMessage: informationMessage })), _jsxs(Popover, { isOpen: isOpen, onClose: () => resetAndClose(), placement: "bottom-start", autoFocus: false, returnFocusOnClose: false, gutter: 4, children: [_jsx(PopoverAnchor, { children: _jsxs(Box, { as: "div", ref: mergedTriggerRef, ...ids.controlProps, role: "combobox", tabIndex: isDisabled ? -1 : 0, "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-controls": listboxId, "aria-owns": `${listboxId} ${filterInputId}`, "aria-activedescendant": activeDescendantId, "aria-disabled": isDisabled || undefined, "data-readonly": isReadOnly || undefined, "aria-required": isRequired || undefined, "aria-label": triggerAriaLabel(), "aria-labelledby": ariaLabelledBy, onClick: handleOpen, onKeyDown: handleTriggerKeyDown, display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%", textAlign: "left", cursor: isDisabled ? "not-allowed" : isReadOnly ? "default" : "pointer", "data-testid": dataTestId, sx: triggerSx, children: [_jsx(Box, { as: "span", display: "inline-flex", flexWrap: showChips ? "wrap" : "nowrap", alignItems: "center", gap: showChips ? 1 : 1.5, minW: 0, flex: 1, isTruncated: !showChips, children: showChips ? (_jsxs(_Fragment, { children: [visibleChipOptions.map((option) => (_jsx(Tag, { label: String(option.label), size: chipSize, variant: "subtle", icon: isInteractive ? X : undefined, onIconClick: isInteractive ? () => handleSelect(option) : undefined }, option.id))), overflowChipCount > 0 && (_jsx(Tag, { label: `+${overflowChipCount}`, size: chipSize, variant: "subtle", colorScheme: "gray" }))] })) : (_jsxs(_Fragment, { children: [triggerIcon ? (_jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, children: triggerIcon })) : null, _jsx(Box, { as: "span", isTruncated: true, children: renderValue ? renderValue(selectedOptions) : defaultTriggerContent() })] })) }), showClear && (_jsx(Box, { as: "button", type: "button", "aria-label": "Clear selection", onClick: handleClear, display: "inline-flex", alignItems: "center", justifyContent: "center", flexShrink: 0, ml: 2, color: colors.textMuted, _hover: { color: colors.text[700] }, children: _jsx(X, { size: CONTROL_SIZES[size].iconSize }) })), _jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, ml: 2, transition: CHEVRON_TRANSITION, transform: isOpen ? "rotate(180deg)" : "rotate(0deg)", color: colors.textMuted, sx: reducedMotionSx(), children: _jsx(ChevronDown, { size: CONTROL_SIZES[size].iconSize }) })] }) }), _jsx(Portal, { children: _jsxs(PopoverContent, { width: "max-content", minWidth: triggerWidth ? `${triggerWidth}px` : undefined, maxWidth: "min(24rem, calc(100vw - 2rem))", borderRadius: "xl", boxShadow: theme.shadows.lg, overflow: "hidden", onKeyDown: handleListKeyDown, children: [_jsx(Box, { p: 2, borderBottom: `0.063rem solid ${colors.boxborder[200]}`, display: isSearchable ? undefined : "none", children: _jsx(Input, { ref: filterInputRef, id: filterInputId, size: "sm", placeholder: "Type to filter...", value: currentSearch, onChange: handleFilterChange, "aria-activedescendant": activeDescendantId, "aria-controls": listboxId, "aria-label": "Filter options", tabIndex: isSearchable ? undefined : -1 }) }), _jsxs(Box, { id: listboxId, ref: listRef, role: "listbox", "aria-label": (_d = label !== null && label !== void 0 ? label : ariaLabel) !== null && _d !== void 0 ? _d : placeholder, "aria-multiselectable": props.isMulti || undefined, "aria-busy": isLoading || undefined, maxH: maxMenuHeight, overflowY: "auto", py: 1, sx: listScrollStyles, onScroll: handleListScroll, children: [filteredOptions.length === 0 && !isLoading && !showCreateRow && (_jsx(Box, { mx: spec.mx, px: spec.px, py: spec.py, fontSize: spec.fontSize, color: colors.textMuted, children: noOptionsMessage !== null && noOptionsMessage !== void 0 ? noOptionsMessage : "No Options" })), showCreateRow && (_jsx(Box, { id: createRowId, role: "option", "aria-selected": false, "data-index": -1, onClick: handleCreate, mx: spec.mx, px: spec.px, py: spec.py, minH: spec.minH, borderRadius: "md", cursor: "pointer", fontSize: spec.fontSize, fontWeight: 600, color: colors.primary[600], bg: activeDescendantId === createRowId ? rowBackgrounds.active : "transparent", children: createLabel ? createLabel(currentSearch.trim()) : `Create "${currentSearch.trim()}"` })), hasGroups
376
377
  ? groupedRows.map((row) => {
377
378
  var _a;
378
- return row.kind === "header" ? (_jsx(Box, { px: 3, pt: 2, pb: 1, fontSize: "0.6875rem", fontWeight: 600, textTransform: "uppercase", letterSpacing: "0.03em", color: colors.textMuted, children: row.group }, row.key)) : (_jsx(OptionRow, { option: row.option, index: row.index, listboxId: listboxId, isSelected: selectedIds.has(row.option.id.toString()), isActive: row.index === activeIndex, isMulti: (_a = props.isMulti) !== null && _a !== void 0 ? _a : false, theme: theme, backgrounds: rowBackgrounds, renderOption: renderOption, onSelect: handleSelect, onActivate: setActiveIndex }, row.key));
379
+ return row.kind === "header" ? (_jsx(Box, { mx: spec.mx, px: spec.px, pt: 2, pb: 1, fontSize: "0.6875rem", fontWeight: 600, textTransform: "uppercase", letterSpacing: "0.03em", color: colors.textMuted, children: row.group }, row.key)) : (_jsx(OptionRow, { option: row.option, index: row.index, listboxId: listboxId, isSelected: selectedIds.has(row.option.id.toString()), isActive: row.index === activeIndex, isMulti: (_a = props.isMulti) !== null && _a !== void 0 ? _a : false, theme: theme, backgrounds: rowBackgrounds, spec: spec, renderOption: renderOption, onSelect: handleSelect, onActivate: setActiveIndex }, row.key));
379
380
  })
380
381
  : (_jsxs(_Fragment, { children: [topPadPx > 0 && _jsx(Box, { height: `${topPadPx}px` }), renderedOptions.map((option, i) => {
381
382
  var _a;
382
- return (_jsx(OptionRow, { option: option, index: startIndex + i, listboxId: listboxId, isSelected: selectedIds.has(option.id.toString()), isActive: startIndex + i === activeIndex, isMulti: (_a = props.isMulti) !== null && _a !== void 0 ? _a : false, theme: theme, backgrounds: rowBackgrounds, renderOption: renderOption, onSelect: handleSelect, onActivate: setActiveIndex }, option.id));
383
- }), bottomPadPx > 0 && _jsx(Box, { height: `${bottomPadPx}px` })] })), isLoading && (_jsxs(Box, { px: 3, py: 2, display: "flex", alignItems: "center", gap: 2, fontSize: "0.8125rem", color: colors.textMuted, children: [_jsx(Spinner, { size: "xs" }), loadingText] }))] })] }) })] }), hiddenValues.map((value) => (_jsx("input", { type: "hidden", name: name, value: value }, value))), _jsx(FieldMessage, { error: error, errorMessage: errorMessage, helperText: helperText, helperId: ids.helperId, errorId: ids.errorId })] }));
383
+ return (_jsx(OptionRow, { option: option, index: startIndex + i, listboxId: listboxId, isSelected: selectedIds.has(option.id.toString()), isActive: startIndex + i === activeIndex, isMulti: (_a = props.isMulti) !== null && _a !== void 0 ? _a : false, theme: theme, backgrounds: rowBackgrounds, spec: spec, renderOption: renderOption, onSelect: handleSelect, onActivate: setActiveIndex }, option.id));
384
+ }), bottomPadPx > 0 && _jsx(Box, { height: `${bottomPadPx}px` })] })), isLoading && (_jsxs(Box, { mx: spec.mx, px: spec.px, py: spec.py, display: "flex", alignItems: "center", gap: spec.gap, fontSize: spec.fontSize, color: colors.textMuted, children: [_jsx(Spinner, { size: "xs" }), loadingText] }))] })] }) })] }), hiddenValues.map((value) => (_jsx("input", { type: "hidden", name: name, value: value }, value))), _jsx(FieldMessage, { error: error, errorMessage: errorMessage, helperText: helperText, helperId: ids.helperId, errorId: ids.errorId })] }));
384
385
  });
385
386
  export default SelectPopup;
@@ -0,0 +1,11 @@
1
+ import { AA_NORMAL_TEXT } from "../../Theme/tokens/builders/accentText.js";
2
+ import { liftToContrast } from "../../Theme/tokens/builders/outlineRung.js";
3
+ import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
4
+ /** Selection is carried by weight and a trailing brand check, so the label itself stays neutral. */
5
+ export const optionRowInk = (colors, isSingleSelected) => isSingleSelected ? colors.text[900] : colors.text[700];
6
+ // A 12px sub-line reached only 4.00:1 on the hovered selected row in dark.
7
+ export const optionRowDescriptionInk = (colors) => liftToContrast(colors.textMuted, listRowBackgrounds(colors).selectedActive, AA_NORMAL_TEXT);
8
+ export const OPTION_ROW_REST_WEIGHT = 400;
9
+ // NOTE: 600 beside a tinted fill and a check read as three signals for one state.
10
+ export const OPTION_ROW_SELECTED_WEIGHT = 500;
11
+ export const optionRowWeight = (isSingleSelected) => isSingleSelected ? OPTION_ROW_SELECTED_WEIGHT : OPTION_ROW_REST_WEIGHT;
@@ -8,21 +8,25 @@ import { useFieldIds } from "../Common/useFieldIds.js";
8
8
  import FieldMessage from "../Common/FieldMessage.js";
9
9
  import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
10
10
  import { DEFAULT_CONTROL_SIZE } from "../../Theme/tokens/primitives/controlSizes.js";
11
+ import { optionRowSpec, OPTION_ROW_RADIUS } from "../../Theme/tokens/primitives/optionRowSizes.js";
11
12
  import { reducedMotionSx } from "../../Theme/chakra/motion.js";
12
13
  import { useCustomTheme } from "../../Theme/useCustomTheme.js";
13
14
  import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
15
+ import { optionRowDescriptionInk, optionRowInk, optionRowWeight } from "../Select/optionRowInk.js";
14
16
  import { useExclusiveOverlay } from "../../Hooks/useExclusiveOverlay.js";
15
- import { PlusIcon } from "lucide-react";
17
+ import { PlusIcon, Check } from "lucide-react";
16
18
  const ROW_TRANSITION = transitionFor(["background-color"]);
17
- const RenderOptions = ({ isOptionLoading, filteredOptions, loadingText, handleOptionClick, isProfile, isColorOptions, isOptionSelected, activeIndex, optionRefs, }) => {
19
+ const RenderOptions = ({ isOptionLoading, filteredOptions, loadingText, handleOptionClick, isProfile, isColorOptions, isOptionSelected, activeIndex, optionRefs, size, isMultipleSelect, }) => {
18
20
  const theme = useCustomTheme();
19
21
  const rowBackgrounds = useMemo(() => listRowBackgrounds(theme.colors), [theme.colors]);
22
+ const spec = optionRowSpec(size);
20
23
  if (isOptionLoading) {
21
24
  return (_jsxs(VStack, { py: 2, children: [_jsx(Spinner, { size: "sm", color: theme.colors.accentText }), _jsx(Text, { color: theme.colors.accentText, children: loadingText })] }));
22
25
  }
23
26
  if (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) {
24
27
  return (_jsx(_Fragment, { children: filteredOptions.map((option, index) => {
25
28
  const selected = isOptionSelected(option);
29
+ const isSingleSelected = selected && !isMultipleSelect;
26
30
  const isActive = index === activeIndex;
27
31
  const rowBg = selected
28
32
  ? isActive
@@ -33,14 +37,14 @@ const RenderOptions = ({ isOptionLoading, filteredOptions, loadingText, handleOp
33
37
  : "transparent";
34
38
  return (_jsxs(Box, { as: "button", type: "button", ref: (el) => {
35
39
  optionRefs.current[index] = el;
36
- }, role: "option", "aria-selected": selected, tabIndex: isActive ? 0 : -1, w: "100%", textAlign: "left", border: "none", fontFamily: "inherit", bg: rowBg, px: 4, py: 1.5, fontSize: "0.8125rem", cursor: "pointer", color: theme.colors.text[700], fontWeight: selected ? 600 : 400, transition: ROW_TRANSITION, sx: reducedMotionSx(), _hover: {
40
+ }, 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: rowBg, 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(), _hover: {
37
41
  bg: selected ? rowBackgrounds.selectedActive : rowBackgrounds.active,
38
42
  }, onClick: () => handleOptionClick(option), onKeyDown: (e) => {
39
43
  if (e.key === "Enter" || e.key === " ") {
40
44
  e.preventDefault();
41
45
  handleOptionClick(option);
42
46
  }
43
- }, display: "flex", alignItems: "center", gap: "0.5rem", children: [isProfile && (_jsx(Box, { children: _jsx(Avatar, { size: "sm", name: option.label.toLocaleUpperCase(), src: option.profileUrl ? option.profileUrl : undefined }) })), isColorOptions && (_jsx(Box, { width: "0.8rem", height: "0.8rem", content: "", backgroundColor: option === null || option === void 0 ? void 0 : option.color, borderRadius: "50%" })), _jsxs(Box, { children: [_jsx(Box, { children: option.label }), option.email && (_jsx(Box, { fontSize: "0.75rem", color: theme.colors.textMuted, children: option.email }))] })] }, option.id));
47
+ }, display: "flex", alignItems: "center", gap: spec.gap, children: [isProfile && (_jsx(Box, { children: _jsx(Avatar, { size: spec.avatarSize, name: option.label.toLocaleUpperCase(), src: option.profileUrl ? option.profileUrl : undefined }) })), isColorOptions && (_jsx(Box, { width: "0.8rem", height: "0.8rem", content: "", backgroundColor: option === null || option === void 0 ? void 0 : option.color, borderRadius: "50%" })), _jsxs(Box, { flex: 1, minW: 0, children: [_jsx(Box, { children: option.label }), option.email && (_jsx(Box, { fontSize: spec.descriptionFontSize, color: optionRowDescriptionInk(theme.colors), children: option.email }))] }), isSingleSelected && (_jsx(Box, { as: Check, size: spec.iconSize, color: theme.colors.accentText, flexShrink: 0 }))] }, option.id));
44
48
  }) }));
45
49
  }
46
50
  return (_jsx(Text, { px: 4, py: 2, color: theme.colors.textMuted, children: "No options found" }));
@@ -224,7 +228,7 @@ export default function SelectSearch({ options, initialSelectedOption, onOptionS
224
228
  return;
225
229
  }
226
230
  openDropdown();
227
- }, onChange: (e) => handleInputChange(e.target.value), placeholder: placeholder, onKeyDown: handleKeyDown, name: name, role: "combobox", "aria-autocomplete": "list", "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-controls": listboxId, "aria-required": isRequired || undefined, cursor: "pointer", sx: { ...fieldControlStyles(theme.colors), ...controlSizeStyles(size), ...reducedMotionSx() }, style: inputStyle }), rightIcon && (_jsx(InputRightElement, { pointerEvents: "none", children: rightIcon, style: { ...rightElementStyle } }))] }), isOpen && (_jsxs(Box, { ref: dropdownRef, marginTop: "0.313rem", position: "absolute", top: position === "below" ? "100%" : "auto", bottom: position === "above" ? "100%" : "auto", left: 0, right: 0, border: "0.063rem solid", borderColor: theme.colors.boxborder[200], borderRadius: "xl", boxShadow: theme.shadows.lg, bg: theme.colors.surfaceRaised, maxHeight: "9.375rem", overflowY: "auto", zIndex: 10, children: [_jsx(Box, { id: listboxId, role: "listbox", "aria-label": label !== null && label !== void 0 ? label : placeholder, onKeyDown: handleListKeyDown, children: _jsx(RenderOptions, { isOptionLoading: isOptionLoading, filteredOptions: filteredOptions, loadingText: loadingText, handleOptionClick: handleOptionClick, isProfile: isProfile, isColorOptions: isColorOptions, isOptionSelected: isOptionSelected, activeIndex: activeIndex, optionRefs: optionRefs }) }), _jsx("hr", {}), isBottomIcon && (_jsxs(Box, { position: "sticky", bottom: 0, background: theme.colors.surfaceRaised, display: "flex", alignItems: "center", pl: "1rem", cursor: "pointer", onClick: handleBottomClick, borderColor: theme.colors.boxborder[200], zIndex: 1, borderTop: `1px solid ${theme.colors.boxborder[200]}`, children: [_jsx(Box, { children: BottomIcon ? BottomIcon : _jsx(PlusIcon, { size: "1rem" }) }), _jsx(Box, { fontSize: "0.875rem", color: BottomTextColor
231
+ }, onChange: (e) => handleInputChange(e.target.value), placeholder: placeholder, onKeyDown: handleKeyDown, name: name, role: "combobox", "aria-autocomplete": "list", "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-controls": listboxId, "aria-required": isRequired || undefined, cursor: "pointer", sx: { ...fieldControlStyles(theme.colors), ...controlSizeStyles(size), ...reducedMotionSx() }, style: inputStyle }), rightIcon && (_jsx(InputRightElement, { pointerEvents: "none", children: rightIcon, style: { ...rightElementStyle } }))] }), isOpen && (_jsxs(Box, { ref: dropdownRef, marginTop: "0.313rem", position: "absolute", top: position === "below" ? "100%" : "auto", bottom: position === "above" ? "100%" : "auto", left: 0, right: 0, border: "0.063rem solid", borderColor: theme.colors.boxborder[200], borderRadius: "xl", boxShadow: theme.shadows.lg, bg: theme.colors.surfaceRaised, maxHeight: "9.375rem", overflowY: "auto", zIndex: 10, children: [_jsx(Box, { id: listboxId, role: "listbox", "aria-label": label !== null && label !== void 0 ? label : placeholder, onKeyDown: handleListKeyDown, children: _jsx(RenderOptions, { isOptionLoading: isOptionLoading, filteredOptions: filteredOptions, loadingText: loadingText, handleOptionClick: handleOptionClick, isProfile: isProfile, isColorOptions: isColorOptions, isOptionSelected: isOptionSelected, activeIndex: activeIndex, optionRefs: optionRefs, size: size, isMultipleSelect: isMultipleSelect }) }), _jsx("hr", {}), isBottomIcon && (_jsxs(Box, { position: "sticky", bottom: 0, background: theme.colors.surfaceRaised, display: "flex", alignItems: "center", pl: "1rem", cursor: "pointer", onClick: handleBottomClick, borderColor: theme.colors.boxborder[200], zIndex: 1, borderTop: `1px solid ${theme.colors.boxborder[200]}`, children: [_jsx(Box, { children: BottomIcon ? BottomIcon : _jsx(PlusIcon, { size: "1rem" }) }), _jsx(Box, { fontSize: "0.875rem", color: BottomTextColor
228
232
  ? BottomTextColor
229
233
  : theme.colors.accentText, padding: "8px 8px", children: BottomText || "Add New" })] }))] })), _jsx(FieldMessage, { error: error, errorMessage: errorMessage, helperText: helperText, helperId: ids.helperId, errorId: ids.errorId })] }) }) }));
230
234
  }
@@ -1,11 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Box } from "@chakra-ui/react";
3
3
  import SegmentedControl from "../SegmentedControl/SegmentedControl.js";
4
- /** @deprecated Use `SegmentedControl` — Switch renders it at 12.5rem, growing when the labels need it. */
4
+ /** @deprecated Two labelled choices; for a single on/off field use `ToggleSwitch`. Renders `SegmentedControl` at 12.5rem when labelled. */
5
5
  export default function Switch({ leftText, rightText, leftIcon, rightIcon, onSwitchToggle, switchActive, surface, "aria-label": ariaLabel, }) {
6
6
  const options = [
7
7
  { value: "left", label: leftText, icon: leftIcon },
8
8
  { value: "right", label: rightText, icon: rightIcon },
9
9
  ];
10
- return (_jsx(Box, { w: "fit-content", minW: "12.5rem", children: _jsx(SegmentedControl, { options: options, value: switchActive, onChange: onSwitchToggle, variant: "brandSlide", surface: surface, isFullWidth: true, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : `${leftText} or ${rightText}` }) }));
10
+ // Unlabelled segments have nothing to size to, so the 12.5rem floor only overflowed its cell.
11
+ const hasLabels = Boolean(leftText || rightText);
12
+ return (_jsx(Box, { w: "fit-content", maxW: "100%", minW: hasLabels ? "12.5rem" : undefined, children: _jsx(SegmentedControl, { options: options, value: switchActive, onChange: onSwitchToggle, variant: "brandSlide", surface: surface, isFullWidth: true, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : `${leftText} or ${rightText}` }) }));
11
13
  }
@@ -1,13 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
3
3
  import { Box, Text, Input, Popover, PopoverTrigger, PopoverContent, PopoverBody, VStack, Portal } from "@chakra-ui/react";
4
- import { ChevronDown, ChevronUp } from "lucide-react";
4
+ import { ChevronDown, ChevronUp, Check } from "lucide-react";
5
5
  import { useCustomTheme } from "../../../Theme/useCustomTheme.js";
6
6
  import { listRowBackgrounds } from "../../../Theme/tokens/builders/rowStates.js";
7
+ import { optionRowSpec, OPTION_ROW_RADIUS } from "../../../Theme/tokens/primitives/optionRowSizes.js";
8
+ import { optionRowInk, optionRowWeight } from "../../Select/optionRowInk.js";
7
9
  import { useExclusiveOverlay } from "../../../Hooks/useExclusiveOverlay.js";
8
10
  const CompactSelect = ({ options, value, placeholder = "Select", height = "22px", onSelect, size = "xs" }) => {
9
11
  const theme = useCustomTheme();
10
12
  const rowBackgrounds = useMemo(() => listRowBackgrounds(theme.colors), [theme.colors]);
13
+ const spec = optionRowSpec("xs");
11
14
  const [isOpen, setIsOpen] = useState(false);
12
15
  const requestExclusiveOpen = useExclusiveOverlay(isOpen, () => setIsOpen(false));
13
16
  const openDropdown = () => {
@@ -61,15 +64,15 @@ const CompactSelect = ({ options, value, placeholder = "Select", height = "22px"
61
64
  : isActive
62
65
  ? rowBackgrounds.active
63
66
  : theme.colors.transparent;
64
- return (_jsx(Box, { as: "button", type: "button", role: "option", "aria-selected": selected, tabIndex: isActive ? 0 : -1, ref: (el) => {
67
+ return (_jsxs(Box, { as: "button", type: "button", role: "option", "aria-selected": selected, tabIndex: isActive ? 0 : -1, ref: (el) => {
65
68
  optionRefs.current[i] = el;
66
- }, w: "100%", textAlign: "left", border: "none", fontFamily: "inherit", px: 2, py: 1, cursor: "pointer", color: theme.colors.text[700], _hover: {
69
+ }, w: `calc(100% - 2 * ${spec.mx})`, minH: spec.minH, textAlign: "left", border: "none", fontFamily: "inherit", display: "flex", alignItems: "center", gap: spec.gap, mx: spec.mx, px: spec.px, py: spec.py, borderRadius: OPTION_ROW_RADIUS, cursor: "pointer", color: optionRowInk(theme.colors, selected), fontSize: spec.fontSize, fontWeight: optionRowWeight(selected), _hover: {
67
70
  bg: selected ? rowBackgrounds.selectedActive : rowBackgrounds.active,
68
71
  }, bg: rowBg, onClick: () => {
69
72
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(opt);
70
73
  setIsOpen(false);
71
74
  setQuery("");
72
- }, children: _jsx(Text, { fontSize: "0.75rem", children: opt.label }) }, opt.id));
75
+ }, children: [_jsx(Text, { flex: 1, minW: 0, isTruncated: true, children: opt.label }), selected && (_jsx(Box, { as: Check, size: spec.iconSize, color: theme.colors.accentText, flexShrink: 0 }))] }, opt.id));
73
76
  }), filtered.length === 0 && (_jsx(Box, { px: 2, py: 2, children: _jsx(Text, { fontSize: "0.75rem", color: theme.colors.textMuted, children: "No results" }) }))] })] }) }) }) })] }));
74
77
  };
75
78
  export default CompactSelect;
@@ -1,7 +1,9 @@
1
1
  import { createMultiStyleConfigHelpers, cssVar } from "@chakra-ui/react";
2
2
  import { menuAnatomy } from "@chakra-ui/anatomy";
3
3
  import { listRowBackgrounds } from "../tokens/builders/rowStates.js";
4
+ import { OPTION_ROW_SIZES, OPTION_ROW_RADIUS } from "../tokens/primitives/optionRowSizes.js";
4
5
  import { paletteOf } from "./paletteFromTheme.js";
6
+ const itemRowSpec = OPTION_ROW_SIZES.sm;
5
7
  const { defineMultiStyleConfig, definePartsStyle } = createMultiStyleConfigHelpers(menuAnatomy.keys);
6
8
  const $bg = cssVar("menu-bg");
7
9
  // NOTE: fixes Chakra's MenuList/MenuItem both hardcoding --menu-bg to white via dead _dark — item needs its own var too, or hover snaps back to white.
@@ -21,6 +23,12 @@ const baseStyle = definePartsStyle(({ theme }) => {
21
23
  borderColor: colors.boxborder[200],
22
24
  },
23
25
  item: {
26
+ minH: itemRowSpec.minH,
27
+ px: itemRowSpec.px,
28
+ py: itemRowSpec.py,
29
+ mx: itemRowSpec.mx,
30
+ fontSize: itemRowSpec.fontSize,
31
+ borderRadius: OPTION_ROW_RADIUS,
24
32
  bg: "transparent",
25
33
  _focus: { [$itemBg.variable]: hoverBg, bg: $itemBg.reference },
26
34
  _hover: { [$itemBg.variable]: hoverBg, bg: $itemBg.reference },
@@ -10,6 +10,18 @@ export function ruleInk(hex, surfaces, target) {
10
10
  ? softenToContrast(hex, loudest, target)
11
11
  : hex;
12
12
  }
13
+ export const STACKED_STATE_STEP = 1.08;
14
+ // NOTE: walks out from the backdrop, so it settles a too-loud seed down as readily as it lifts a faint one.
15
+ export function tintStep(seed, backdrop, target) {
16
+ const { s } = hexToHsl(seed);
17
+ const away = relativeLuminance(backdrop) < 0.5 ? 1 : -1;
18
+ for (let l = hexToHsl(backdrop).l; l >= 0 && l <= 100; l += away) {
19
+ const next = withLightness(seed, l, s);
20
+ if (contrastRatio(next, backdrop) >= target)
21
+ return next;
22
+ }
23
+ return withLightness(seed, away > 0 ? 100 : 0, s);
24
+ }
13
25
  export function liftToContrast(hex, backdrop, target = AA_NON_TEXT) {
14
26
  if (contrastRatio(hex, backdrop) >= target)
15
27
  return hex;
@@ -1,11 +1,10 @@
1
- import { liftToContrast, MIN_PERCEPTIBLE_STEP, resolveHoverTint } from "./outlineRung.js";
2
- // NOTE: rungs stay neutral/pale — seeding from primary[500] instead once painted SelectV2's hover solid brand fill.
1
+ import { MIN_PERCEPTIBLE_STEP, resolveHoverTint, STACKED_STATE_STEP, tintStep, } from "./outlineRung.js";
3
2
  export const listRowBackgrounds = (colors) => {
4
- // Dark aliases backgroundColor.tertiary to the panel, leaving the selected row at 1.025:1.
5
- const selected = liftToContrast(colors.backgroundColor.tertiary, colors.surfaceRaised, MIN_PERCEPTIBLE_STEP);
3
+ // Raw tertiary reaches 1.29:1 and reads as pressed; dark aliases it to the panel at 1.025:1.
4
+ const selected = tintStep(colors.backgroundColor.tertiary, colors.surfaceRaised, MIN_PERCEPTIBLE_STEP);
6
5
  return {
7
6
  active: resolveHoverTint(colors.gray[50], colors.surfaceRaised),
8
7
  selected,
9
- selectedActive: resolveHoverTint(selected, selected),
8
+ selectedActive: tintStep(selected, selected, STACKED_STATE_STEP),
10
9
  };
11
10
  };
@@ -0,0 +1,25 @@
1
+ /** One density for every option row — Select, SearchSelect, SelectSearch, table filters and Chakra's MenuItem. */
2
+ export const OPTION_ROW_SIZES = {
3
+ xs: {
4
+ minH: "1.5rem", px: "0.5rem", py: "0.125rem", gap: "0.375rem", mx: "0.25rem",
5
+ fontSize: "0.75rem", descriptionFontSize: "0.6875rem", iconSize: 12,
6
+ avatarSize: "2xs", virtualRowHeightPx: 24,
7
+ },
8
+ sm: {
9
+ minH: "1.875rem", px: "0.625rem", py: "0.25rem", gap: "0.5rem", mx: "0.375rem",
10
+ fontSize: "0.8125rem", descriptionFontSize: "0.75rem", iconSize: 14,
11
+ avatarSize: "xs", virtualRowHeightPx: 30,
12
+ },
13
+ md: {
14
+ minH: "2.125rem", px: "0.75rem", py: "0.3125rem", gap: "0.5rem", mx: "0.375rem",
15
+ fontSize: "0.875rem", descriptionFontSize: "0.75rem", iconSize: 16,
16
+ avatarSize: "xs", virtualRowHeightPx: 34,
17
+ },
18
+ lg: {
19
+ minH: "2.5rem", px: "0.875rem", py: "0.375rem", gap: "0.625rem", mx: "0.5rem",
20
+ fontSize: "1rem", descriptionFontSize: "0.8125rem", iconSize: 18,
21
+ avatarSize: "sm", virtualRowHeightPx: 40,
22
+ },
23
+ };
24
+ export const OPTION_ROW_RADIUS = "md";
25
+ export const optionRowSpec = (size) => OPTION_ROW_SIZES[size];
package/dist/esm/index.js CHANGED
@@ -152,6 +152,8 @@ export { isDarkCanvas, onFilled, onGradient, accentTextOnCanvas, pickAccentText,
152
152
  // Filled-surface helpers — use whenever you paint a `bg` from a ColorScale (buttons, badges,
153
153
  // chips, alerts). Never pair `scale[500]` with `onFilled` or `colors.white` by hand.
154
154
  export { solidFillRung, darkerFillRung, labelOnFill, resolveFilledSurface, } from "./Theme/tokens/builders/filledSurface.js";
155
+ // Ink for a custom option row (a `SearchSelect` `option.view` or `Select` `renderOption` node).
156
+ export { optionRowInk, optionRowWeight, optionRowDescriptionInk, } from "./Components/Select/optionRowInk.js";
155
157
  // Pure color math backing the helpers above (and `buildDarkPalette`) — no Chakra/React/DOM
156
158
  // dependency, safe for the mobile port. `relativeLuminance`/`contrastRatio` are the WCAG 2.1
157
159
  // primitives; `compositeOver` flattens a translucent color onto a backdrop first (an alpha
package/dist/index.d.ts CHANGED
@@ -132,6 +132,7 @@ export { statusGradient, inkSafeGradient, chipFill, chipBorder, ACCENT_GRADIENT,
132
132
  export { isDarkCanvas, onFilled, onGradient, accentTextOnCanvas, pickAccentText, AA_NORMAL_TEXT, DARK_CANVAS_LUMINANCE, } from "./Theme/tokens/builders/accentText";
133
133
  export { solidFillRung, darkerFillRung, labelOnFill, resolveFilledSurface, } from "./Theme/tokens/builders/filledSurface";
134
134
  export type { FilledSurface } from "./Theme/tokens/builders/filledSurface";
135
+ export { optionRowInk, optionRowWeight, optionRowDescriptionInk, } from "./Components/Select/optionRowInk";
135
136
  export { hexToRgb, hexToRgba, compositeOver, rgbToHex, rgbToHsl, hslToRgb, hexToHsl, hslToHex, withLightness, mix, relativeLuminance, contrastRatio, } from "./Theme/tokens/builders/color";
136
137
  export type { Rgb, Hsl } from "./Theme/tokens/builders/color";
137
138
  export type { SelectV2Props, SelectV2Size, OptionProp as SelectV2Option } from "./Components/SelectV2/SelectV2Props";
package/dist/index.js CHANGED
@@ -43,10 +43,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
43
43
  exports.splitMonthsAndDays = exports.resolvePlanBadge = exports.formatPlanRemaining = exports.formatPlanExpiry = exports.formatPlanElapsed = exports.PlanBadge = exports.PlanPill = exports.UpgradeButton = exports.LimitReachedModal = exports.AppSwitcher = exports.OrgSwitcher = exports.StageItem = exports.StageProgress = exports.CopyButton = exports.ScrollToTop = exports.PdfViewer = exports.MoreItems = exports.LazyWrapper = exports.FormWrapper = exports.FilterSidebar = exports.FileUploader = exports.FileUpload = exports.FilePreviewTrigger = exports.FilePreview = exports.FieldSelectModal = exports.WorkspaceTrayPreview = exports.WorkspaceTray = exports.WorkspaceWindow = exports.EmptyState = exports.Editor = exports.Dropdown = exports.DrawerFooter = exports.DrawerBody = exports.DrawerHeader = exports.Drawer = exports.DatePicker = exports.ContactForm = exports.Checkbox = exports.Card = exports.ButtonGroupIcon = exports.Button = exports.Breadcrumbs = exports.ApexRadialChart = exports.ApexAreaChart = exports.ApexLineChart = exports.ApexPolarChart = exports.ApexPieChart = exports.ApexBarChart = exports.AlertDialog = exports.Accordion = void 0;
44
44
  exports.Tag = exports.TableToggle = exports.Table = exports.SegmentedControl = exports.ToggleSwitch = exports.Switch = exports.Skeletons = exports.ScrollbarBox = exports.Slider = exports.SideBar = exports.SelectSearch = exports.SearchSelect = exports.SelectV2 = exports.Select = exports.Search = exports.Reorder = exports.RadioButtonGroup = exports.RadioButton = exports.ProgressBar = exports.ProfilePhotoViewer = exports.ProfileCardFooter = exports.ProfileCardBody = exports.ProfileCardHeader = exports.ProfileCard = exports.ProductDetails = exports.ProductCard = exports.PinInput = exports.PhoneNumberInput = exports.PaymentCard = exports.NumberInput = exports.MultiSelect = exports.NoteTextArea = exports.Notification = exports.NavigationBar = exports.ModalFooter = exports.ModalBody = exports.ModalHeader = exports.Modal = exports.Loading = exports.KanbanActions = exports.KanbanBoard = exports.InputSwitch = exports.InputTextArea = exports.HeaderActions = exports.Header = exports.OrganizationDetails = exports.SignInActivityTable = exports.CustomModulesTable = exports.RolesPermission = exports.UserDetails = void 0;
45
45
  exports.setRef = exports.mergeRefs = exports.resolveStatusTone = exports.resolveAvatarFill = exports.meetsBodyText = exports.avatarFillFor = exports.AVATAR_SEEDS = exports.FOCUS_RING_WIDTH = exports.FOCUS_HALO_WIDTH = exports.FOCUS_VISIBLE_OVER_STATE = exports.focusVisibleStyles = exports.focusVisibleRing = exports.focusRingShadow = exports.withFocusRing = exports.settleBetween = exports.buildFocusRing = exports.listRowBackgrounds = exports.withOutlineRung = exports.liftToContrast = exports.AA_NON_TEXT = exports.buildDarkPalette = exports.themeNames = exports.palettes = exports.darkPalettes = exports.lightPalettes = exports.brandThemes = exports.AppearanceSettings = exports.useFontSizeSync = exports.resolveFontSize = exports.isFontSize = exports.FONT_SIZE_OPTIONS = exports.DEFAULT_FONT_SIZE = exports.ThemeSwitcher = exports.useThemeMode = exports.PixelizeThemeProvider = exports.createAccountHandoff = exports.resolveReturnUrl = exports.isAllowedReturnUrl = exports.debounce = exports.ThemesList = exports.useCustomTheme = exports.useIsTruncated = exports.useSidebarPrefs = exports.VerifyEmailOtp = exports.useToaster = exports.OverflowToolTip = exports.ToolTip = exports.Toaster = exports.Timeline = exports.TextInput = void 0;
46
- exports.buildSuiteApps = exports.formatShortcut = exports.matchesShortcut = exports.filterApps = exports.appInitials = exports.describeDayStates = exports.resolveDayStateVisual = exports.isDayStateKey = exports.CALENDAR_DAY_CLASS = exports.DAY_STATE_KEYS = exports.contrastRatio = exports.relativeLuminance = exports.mix = exports.withLightness = exports.hslToHex = exports.hexToHsl = exports.hslToRgb = exports.rgbToHsl = exports.rgbToHex = exports.compositeOver = exports.hexToRgba = exports.hexToRgb = exports.resolveFilledSurface = exports.labelOnFill = exports.darkerFillRung = exports.solidFillRung = exports.DARK_CANVAS_LUMINANCE = exports.AA_NORMAL_TEXT = exports.pickAccentText = exports.accentTextOnCanvas = exports.onGradient = exports.onFilled = exports.isDarkCanvas = exports.STATUS_INK = exports.ACCENT_GRADIENT = exports.chipBorder = exports.chipFill = exports.inkSafeGradient = exports.statusGradient = exports.labelOnSeries = exports.getDefaultSeriesColors = exports.getCategoricalSeriesColors = exports.chartMode = exports.chartInk = exports.chartAxisLabelColor = exports.CATEGORICAL_SERIES = exports.useDebouncedValue = exports.useDebouncedCallback = exports.toWords = exports.rafThrottle = void 0;
47
- exports.SettingRow = exports.FilterBar = exports.DescriptionList = exports.Spinner = exports.Backdrop = exports.QueryStateBoundary = exports.ErrorState = exports.StatCard = exports.PageHeader = exports.fieldMessageStyles = exports.fieldLabelStyles = exports.controlSizeStyles = exports.fieldControlStyles = exports.FieldMessage = exports.useFieldIds = exports.REDUCED_MOTION_QUERY = exports.reducedMotionSx = exports.usePrefersReducedMotion = exports.OVERLAY_BLUR = exports.overlayScrimStyles = exports.RAISED_OVERLAY = exports.raisedRule = exports.buildSurfaceRaised = exports.tooltipSurface = exports.SCRIM_OPACITY = exports.overlayScrim = exports.resolveSoftTone = exports.toneInk = exports.toneScale = exports.toneToSemantic = exports.toneToColorScheme = exports.isTone = exports.TONES = exports.transitionFor = exports.MOTION_EASE = exports.MOTION_MS = exports.isControlSize = exports.DEFAULT_CONTROL_SIZE = exports.CONTROL_SIZE_NAMES = exports.CONTROL_SIZES = exports.inkSafeGradientToken = exports.gradientCss = exports.resolveGradient = exports.fieldSurfaces = exports.placeholderInkOn = exports.placeholderInk = exports.SCROLLBAR_WIDTH = exports.globalScrollbarStyles = exports.scrollbarStyles = exports.useAppSwitcherShortcut = void 0;
48
- exports.defaultMediaImageViewerLabels = exports.MediaImageViewer = exports.useFileViewer = exports.MediaViewer = exports.RangeSlider = exports.getApiErrorStatus = exports.getApiErrorMessage = exports.defaultValidationMessages = exports.validateYoutubeUrl = exports.validateVideoFile = exports.validateVideoFileType = exports.validateFile = exports.validateFileSize = exports.validateFileType = exports.validatePositiveNumber = exports.validateRequired = exports.validatePassword = exports.validateEmail = exports.EMAIL_REGEX = exports.createEnumLabelResolver = exports.humanize = exports.clearChunkReloadGuard = exports.isChunkLoadError = exports.installPreloadErrorReload = exports.lazyWithRetry = exports.useAnchoredPanelHeight = exports.formatRelativeTime = exports.formatCount = exports.groupConsecutive = exports.sectionizeByDay = exports.NotificationItem = exports.NotificationList = exports.NotificationPanel = exports.NotificationBell = exports.ConfirmDialog = exports.TabPanel = exports.TabPanels = exports.Tab = exports.TabList = exports.Tabs = exports.Accordian = exports.SaveBar = exports.FeedbackForm = exports.PersonChip = exports.initialsFor = exports.avatarScaleKeyFor = exports.resolveAvatarColorway = exports.AvatarGroup = exports.Avatar = exports.SettingsSection = void 0;
49
- exports.SEEK_STEP_SECONDS = exports.PLAYBACK_SPEEDS = exports.ZOOM_STEP = exports.MAX_ZOOM = exports.MIN_ZOOM = exports.resolveMediaUrl = exports.fileKind = exports.countMedia = exports.planPreview = exports.buildFileItems = exports.buildMediaItems = exports.MediaStatusPanel = exports.MediaScrubber = exports.defaultMediaAudioPlayerLabels = exports.MediaAudioPlayer = exports.defaultMediaViewerLabels = exports.defaultMediaDocumentStageLabels = exports.MediaDocumentStage = exports.defaultMediaVideoPlayerLabels = exports.MediaVideoPlayer = void 0;
46
+ exports.filterApps = exports.appInitials = exports.describeDayStates = exports.resolveDayStateVisual = exports.isDayStateKey = exports.CALENDAR_DAY_CLASS = exports.DAY_STATE_KEYS = exports.contrastRatio = exports.relativeLuminance = exports.mix = exports.withLightness = exports.hslToHex = exports.hexToHsl = exports.hslToRgb = exports.rgbToHsl = exports.rgbToHex = exports.compositeOver = exports.hexToRgba = exports.hexToRgb = exports.optionRowDescriptionInk = exports.optionRowWeight = exports.optionRowInk = exports.resolveFilledSurface = exports.labelOnFill = exports.darkerFillRung = exports.solidFillRung = exports.DARK_CANVAS_LUMINANCE = exports.AA_NORMAL_TEXT = exports.pickAccentText = exports.accentTextOnCanvas = exports.onGradient = exports.onFilled = exports.isDarkCanvas = exports.STATUS_INK = exports.ACCENT_GRADIENT = exports.chipBorder = exports.chipFill = exports.inkSafeGradient = exports.statusGradient = exports.labelOnSeries = exports.getDefaultSeriesColors = exports.getCategoricalSeriesColors = exports.chartMode = exports.chartInk = exports.chartAxisLabelColor = exports.CATEGORICAL_SERIES = exports.useDebouncedValue = exports.useDebouncedCallback = exports.toWords = exports.rafThrottle = void 0;
47
+ exports.Spinner = exports.Backdrop = exports.QueryStateBoundary = exports.ErrorState = exports.StatCard = exports.PageHeader = exports.fieldMessageStyles = exports.fieldLabelStyles = exports.controlSizeStyles = exports.fieldControlStyles = exports.FieldMessage = exports.useFieldIds = exports.REDUCED_MOTION_QUERY = exports.reducedMotionSx = exports.usePrefersReducedMotion = exports.OVERLAY_BLUR = exports.overlayScrimStyles = exports.RAISED_OVERLAY = exports.raisedRule = exports.buildSurfaceRaised = exports.tooltipSurface = exports.SCRIM_OPACITY = exports.overlayScrim = exports.resolveSoftTone = exports.toneInk = exports.toneScale = exports.toneToSemantic = exports.toneToColorScheme = exports.isTone = exports.TONES = exports.transitionFor = exports.MOTION_EASE = exports.MOTION_MS = exports.isControlSize = exports.DEFAULT_CONTROL_SIZE = exports.CONTROL_SIZE_NAMES = exports.CONTROL_SIZES = exports.inkSafeGradientToken = exports.gradientCss = exports.resolveGradient = exports.fieldSurfaces = exports.placeholderInkOn = exports.placeholderInk = exports.SCROLLBAR_WIDTH = exports.globalScrollbarStyles = exports.scrollbarStyles = exports.useAppSwitcherShortcut = exports.buildSuiteApps = exports.formatShortcut = exports.matchesShortcut = void 0;
48
+ exports.MediaViewer = exports.RangeSlider = exports.getApiErrorStatus = exports.getApiErrorMessage = exports.defaultValidationMessages = exports.validateYoutubeUrl = exports.validateVideoFile = exports.validateVideoFileType = exports.validateFile = exports.validateFileSize = exports.validateFileType = exports.validatePositiveNumber = exports.validateRequired = exports.validatePassword = exports.validateEmail = exports.EMAIL_REGEX = exports.createEnumLabelResolver = exports.humanize = exports.clearChunkReloadGuard = exports.isChunkLoadError = exports.installPreloadErrorReload = exports.lazyWithRetry = exports.useAnchoredPanelHeight = exports.formatRelativeTime = exports.formatCount = exports.groupConsecutive = exports.sectionizeByDay = exports.NotificationItem = exports.NotificationList = exports.NotificationPanel = exports.NotificationBell = exports.ConfirmDialog = exports.TabPanel = exports.TabPanels = exports.Tab = exports.TabList = exports.Tabs = exports.Accordian = exports.SaveBar = exports.FeedbackForm = exports.PersonChip = exports.initialsFor = exports.avatarScaleKeyFor = exports.resolveAvatarColorway = exports.AvatarGroup = exports.Avatar = exports.SettingsSection = exports.SettingRow = exports.FilterBar = exports.DescriptionList = void 0;
49
+ exports.SEEK_STEP_SECONDS = exports.PLAYBACK_SPEEDS = exports.ZOOM_STEP = exports.MAX_ZOOM = exports.MIN_ZOOM = exports.resolveMediaUrl = exports.fileKind = exports.countMedia = exports.planPreview = exports.buildFileItems = exports.buildMediaItems = exports.MediaStatusPanel = exports.MediaScrubber = exports.defaultMediaAudioPlayerLabels = exports.MediaAudioPlayer = exports.defaultMediaViewerLabels = exports.defaultMediaDocumentStageLabels = exports.MediaDocumentStage = exports.defaultMediaVideoPlayerLabels = exports.MediaVideoPlayer = exports.defaultMediaImageViewerLabels = exports.MediaImageViewer = exports.useFileViewer = void 0;
50
50
  const Accordion_1 = __importDefault(require("./Components/Accordion/Accordion"));
51
51
  exports.Accordion = Accordion_1.default;
52
52
  const AlertDialog_1 = __importDefault(require("./Components/AlertDialog/AlertDialog"));
@@ -367,6 +367,11 @@ Object.defineProperty(exports, "solidFillRung", { enumerable: true, get: functio
367
367
  Object.defineProperty(exports, "darkerFillRung", { enumerable: true, get: function () { return filledSurface_1.darkerFillRung; } });
368
368
  Object.defineProperty(exports, "labelOnFill", { enumerable: true, get: function () { return filledSurface_1.labelOnFill; } });
369
369
  Object.defineProperty(exports, "resolveFilledSurface", { enumerable: true, get: function () { return filledSurface_1.resolveFilledSurface; } });
370
+ // Ink for a custom option row (a `SearchSelect` `option.view` or `Select` `renderOption` node).
371
+ var optionRowInk_1 = require("./Components/Select/optionRowInk");
372
+ Object.defineProperty(exports, "optionRowInk", { enumerable: true, get: function () { return optionRowInk_1.optionRowInk; } });
373
+ Object.defineProperty(exports, "optionRowWeight", { enumerable: true, get: function () { return optionRowInk_1.optionRowWeight; } });
374
+ Object.defineProperty(exports, "optionRowDescriptionInk", { enumerable: true, get: function () { return optionRowInk_1.optionRowDescriptionInk; } });
370
375
  // Pure color math backing the helpers above (and `buildDarkPalette`) — no Chakra/React/DOM
371
376
  // dependency, safe for the mobile port. `relativeLuminance`/`contrastRatio` are the WCAG 2.1
372
377
  // primitives; `compositeOver` flattens a translucent color onto a backdrop first (an alpha
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelize-design-library",
3
- "version": "2.4.2-beta.45",
3
+ "version": "2.4.2-beta.47",
4
4
  "description": "React component library for Pixelize apps: themeable Chakra-based components, design tokens and light/dark brand theming.",
5
5
  "keywords": [
6
6
  "react",