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

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 (75) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/COMPONENT-GOTCHAS.md +62 -1
  3. package/dist/Components/Common/fieldStyles.d.ts +1 -1
  4. package/dist/Components/Common/fieldStyles.js +4 -4
  5. package/dist/Components/DatePicker/CalendarPanel.js +2 -5
  6. package/dist/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtp.js +2 -4
  7. package/dist/Components/FilterSidebar/FilterSidebar.js +2 -1
  8. package/dist/Components/Header/HeaderActions.d.ts +2 -0
  9. package/dist/Components/Header/HeaderActions.js +2 -2
  10. package/dist/Components/Input/TextInput.styles.js +1 -1
  11. package/dist/Components/KanbanBoard/KanbanActions/KanbanActions.js +1 -1
  12. package/dist/Components/KanbanBoard/KanbanBoardProps.d.ts +2 -0
  13. package/dist/Components/MultiSelect/MultiSelect.d.ts +1 -1
  14. package/dist/Components/MultiSelect/MultiSelect.js +23 -12
  15. package/dist/Components/MultiSelect/MultiSelectProps.d.ts +2 -0
  16. package/dist/Components/NotificationBell/notificationHelpers.d.ts +5 -2
  17. package/dist/Components/NotificationBell/notificationHelpers.js +13 -4
  18. package/dist/Components/PinInput/PinInput.js +2 -4
  19. package/dist/Components/SearchSelect/SearchSelect.js +1 -1
  20. package/dist/Components/SegmentedControl/SegmentedControl.d.ts +1 -1
  21. package/dist/Components/SegmentedControl/SegmentedControl.js +31 -16
  22. package/dist/Components/SegmentedControl/SegmentedControlProps.d.ts +2 -0
  23. package/dist/Components/SegmentedControl/segmentedInk.d.ts +11 -0
  24. package/dist/Components/SegmentedControl/segmentedInk.js +30 -0
  25. package/dist/Components/Select/SelectPopup.js +11 -3
  26. package/dist/Components/SideBar/SecondaryBar.js +5 -4
  27. package/dist/Components/SideBar/SideBar.js +6 -5
  28. package/dist/Components/SideBar/SideBarProps.d.ts +2 -0
  29. package/dist/Components/SideBar/components/MenuItemBox.js +5 -4
  30. package/dist/Components/SideBar/components/MenuItems.js +1 -1
  31. package/dist/Components/SideBar/components/MenuPopoverContent.js +4 -3
  32. package/dist/Components/SideBar/sidebarScale.d.ts +15 -0
  33. package/dist/Components/SideBar/sidebarScale.js +18 -0
  34. package/dist/Components/Switch/Switch.d.ts +2 -2
  35. package/dist/Components/Switch/Switch.js +3 -3
  36. package/dist/Components/Switch/SwitchProps.d.ts +2 -0
  37. package/dist/Components/Table/components/Pagination.d.ts +1 -1
  38. package/dist/Components/Table/components/Pagination.js +12 -4
  39. package/dist/Components/Table/filters/SelectOperationControls.js +9 -1
  40. package/dist/Components/Table/filters/TextOperationControls.js +8 -1
  41. package/dist/Components/Table/hooks/useTable.d.ts +2 -1
  42. package/dist/Components/Table/hooks/useTable.js +5 -3
  43. package/dist/Components/Tabs/components/Tab.js +11 -1
  44. package/dist/Theme/chakra/focusRing.styles.d.ts +17 -1
  45. package/dist/Theme/chakra/focusRing.styles.js +16 -1
  46. package/dist/Theme/provider/ThemeSwitcher.js +15 -8
  47. package/dist/esm/Components/Common/fieldStyles.js +5 -5
  48. package/dist/esm/Components/DatePicker/CalendarPanel.js +2 -5
  49. package/dist/esm/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtp.js +2 -4
  50. package/dist/esm/Components/FilterSidebar/FilterSidebar.js +2 -1
  51. package/dist/esm/Components/Header/HeaderActions.js +2 -2
  52. package/dist/esm/Components/Input/TextInput.styles.js +2 -2
  53. package/dist/esm/Components/KanbanBoard/KanbanActions/KanbanActions.js +1 -1
  54. package/dist/esm/Components/MultiSelect/MultiSelect.js +23 -12
  55. package/dist/esm/Components/NotificationBell/notificationHelpers.js +13 -4
  56. package/dist/esm/Components/PinInput/PinInput.js +2 -4
  57. package/dist/esm/Components/SearchSelect/SearchSelect.js +1 -1
  58. package/dist/esm/Components/SegmentedControl/SegmentedControl.js +30 -15
  59. package/dist/esm/Components/SegmentedControl/segmentedInk.js +23 -0
  60. package/dist/esm/Components/Select/SelectPopup.js +11 -3
  61. package/dist/esm/Components/SideBar/SecondaryBar.js +5 -4
  62. package/dist/esm/Components/SideBar/SideBar.js +6 -5
  63. package/dist/esm/Components/SideBar/components/MenuItemBox.js +5 -4
  64. package/dist/esm/Components/SideBar/components/MenuItems.js +1 -1
  65. package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +4 -3
  66. package/dist/esm/Components/SideBar/sidebarScale.js +15 -0
  67. package/dist/esm/Components/Switch/Switch.js +3 -3
  68. package/dist/esm/Components/Table/components/Pagination.js +13 -5
  69. package/dist/esm/Components/Table/filters/SelectOperationControls.js +8 -3
  70. package/dist/esm/Components/Table/filters/TextOperationControls.js +6 -2
  71. package/dist/esm/Components/Table/hooks/useTable.js +4 -3
  72. package/dist/esm/Components/Tabs/components/Tab.js +12 -2
  73. package/dist/esm/Theme/chakra/focusRing.styles.js +13 -0
  74. package/dist/esm/Theme/provider/ThemeSwitcher.js +16 -9
  75. package/package.json +1 -1
@@ -1,16 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
2
3
  import { Box, Flex } from "@chakra-ui/react";
3
4
  import { useCustomTheme } from "../../Theme/useCustomTheme.js";
4
5
  import { resolveFilledSurface } from "../../Theme/tokens/builders/filledSurface.js";
5
6
  import { CONTROL_SIZES } from "../../Theme/tokens/primitives/controlSizes.js";
6
7
  import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
7
- import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
8
+ import { FOCUS_VISIBLE_OVER_STATE } from "../../Theme/chakra/focusRing.styles.js";
8
9
  import { reducedMotionSx } from "../../Theme/chakra/motion.js";
9
10
  import { AA_NORMAL_TEXT } from "../../Theme/tokens/builders/accentText.js";
10
11
  import { liftToContrast } from "../../Theme/tokens/builders/outlineRung.js";
11
- import { compositeOver } from "../../Theme/tokens/builders/color.js";
12
12
  import Tag from "../Tag/Tag.js";
13
13
  import { useSlidingPill } from "./useSlidingPill.js";
14
+ import { segmentedFocusShadow, segmentedPlateEdge, segmentedRestInk, segmentedTrackSurface, } from "./segmentedInk.js";
14
15
  const TRACK_PADDING = "0.125rem";
15
16
  const UNDERLINE_WIDTH = "0.0625rem";
16
17
  const SLIDE = transitionFor(["transform", "width"], "base");
@@ -18,21 +19,31 @@ const MAX_COUNT = 99;
18
19
  const COUNT_TAG_SIZE = { sm: "xs", md: "sm", lg: "md" };
19
20
  const formatCount = (count) => (count > MAX_COUNT ? `${MAX_COUNT}+` : `${count}`);
20
21
  /** Renders role="radiogroup" of role="radio" buttons with roving tabindex, not a native form radio group; shares variant with Toggle/TableToggle (see MODULE.md). */
21
- export default function SegmentedControl({ options, value, onChange, size = "sm", isFullWidth = false, variant = "default", "aria-label": ariaLabel, }) {
22
- const { colors } = useCustomTheme();
22
+ export default function SegmentedControl({ options, value, onChange, size = "sm", isFullWidth = false, variant = "default", surface, "aria-label": ariaLabel, }) {
23
+ const { colors, radii } = useCustomTheme();
23
24
  const control = CONTROL_SIZES[size];
24
25
  const isBrandSlide = variant === "brandSlide";
25
26
  const isUnderlineSlide = variant === "underlineSlide";
26
27
  const hasIndicator = isBrandSlide || isUnderlineSlide;
27
28
  const brandFill = resolveFilledSurface(colors.primary, colors);
28
- // brandSlide's track is a translucent tint — composite it before measuring contrast.
29
- const trackSurface = isUnderlineSlide
30
- ? colors.backgroundColor.main
31
- : isBrandSlide
32
- ? compositeOver(colors.primary.opacity[8], colors.backgroundColor.main)
33
- : colors.background[600];
34
- const restInk = liftToContrast(colors.text[600], trackSurface, AA_NORMAL_TEXT);
29
+ const trackSurface = segmentedTrackSurface(variant, colors, surface);
30
+ const restInk = segmentedRestInk(colors, trackSurface);
31
+ const selectedInk = liftToContrast(colors.accentText, trackSurface, AA_NORMAL_TEXT);
32
+ const hoverInk = liftToContrast(colors.text[900], trackSurface, AA_NORMAL_TEXT);
35
33
  const segmentH = `calc(${control.height} - ${isUnderlineSlide ? UNDERLINE_WIDTH : `2 * ${TRACK_PADDING}`})`;
34
+ // Concentric: an inset child keeping the parent's radius bulges at the corners.
35
+ const innerRadius = isUnderlineSlide ? "none" : `calc(${radii.lg} - ${TRACK_PADDING})`;
36
+ const focusShadow = segmentedFocusShadow(colors, trackSurface);
37
+ // Inset, never a border: a border consumes the content box and the absolute pill stops centring.
38
+ const plateEdge = isBrandSlide && surface ? `inset 0 0 0 1px ${segmentedPlateEdge(colors, surface)}` : undefined;
39
+ // The transparent outline replaces the UA ring and is what Windows high-contrast repaints.
40
+ const segmentFocus = {
41
+ outline: "2px solid transparent",
42
+ outlineOffset: "2px",
43
+ // underlineSlide has no track chrome to carry the indicator, so there the segment wears it.
44
+ ...(isUnderlineSlide ? { boxShadow: focusShadow } : {}),
45
+ };
46
+ const [showFocus, setShowFocus] = useState(false);
36
47
  const selectedIndex = options.findIndex((o) => o.value === value);
37
48
  const enabled = options.reduce((acc, o, i) => (o.isDisabled ? acc : [...acc, i]), []);
38
49
  // WAI-APG: with nothing selected, the first enabled segment owns the tab stop.
@@ -71,11 +82,11 @@ export default function SegmentedControl({ options, value, onChange, size = "sm"
71
82
  selectAt(enabled[enabled.length - 1]);
72
83
  }
73
84
  };
74
- return (_jsxs(Flex, { ref: trackRef, role: "radiogroup", "aria-label": ariaLabel, onKeyDown: handleKeyDown, position: "relative", display: "inline-flex", align: "center", gap: isUnderlineSlide ? "0" : TRACK_PADDING, p: isUnderlineSlide ? "0" : TRACK_PADDING, h: control.height, boxSizing: "border-box", borderRadius: isUnderlineSlide ? "none" : "lg", borderBottom: isUnderlineSlide ? `${UNDERLINE_WIDTH} solid ${colors.boxborder[200]}` : undefined, bg: isBrandSlide ? colors.primary.opacity[8] : isUnderlineSlide ? "transparent" : colors.background[600], w: isFullWidth ? "100%" : "fit-content", children: [isBrandSlide && pill && (_jsx(Box, { "aria-hidden": "true", position: "absolute", top: TRACK_PADDING, left: 0, h: segmentH, w: `${pill.width}px`, borderRadius: "lg", bg: brandFill.fill, boxShadow: `0 0.125rem 0.5rem ${colors.boxShadow.primary}`, transform: `translateX(${pill.left}px)`, transition: SLIDE, sx: reducedMotionSx() })), isUnderlineSlide && pill && (_jsx(Box, { "aria-hidden": "true", position: "absolute", bottom: "-0.0625rem", left: 0, h: "0.125rem", w: `${pill.width}px`, borderRadius: "full", bg: colors.primary[500], transform: `translateX(${pill.left}px)`, transition: SLIDE, sx: reducedMotionSx() })), options.map((option, index) => {
85
+ return (_jsxs(Flex, { ref: trackRef, role: "radiogroup", "aria-label": ariaLabel, onKeyDown: handleKeyDown, onFocus: (event) => setShowFocus(event.target.matches(":focus-visible")), onBlur: () => setShowFocus(false), boxShadow: showFocus && !isUnderlineSlide ? focusShadow : plateEdge, position: "relative", display: "inline-flex", align: "center", gap: isUnderlineSlide ? "0" : TRACK_PADDING, p: isUnderlineSlide ? "0" : TRACK_PADDING, h: control.height, boxSizing: "border-box", borderRadius: isUnderlineSlide ? "none" : "lg", borderBottom: isUnderlineSlide ? `${UNDERLINE_WIDTH} solid ${colors.boxborder[200]}` : undefined, bg: isBrandSlide ? (surface ? trackSurface : colors.primary.opacity[8]) : isUnderlineSlide ? "transparent" : colors.background[600], w: isFullWidth ? "100%" : "fit-content", minW: "max-content", children: [isBrandSlide && pill && (_jsx(Box, { "aria-hidden": "true", position: "absolute", top: TRACK_PADDING, left: 0, h: segmentH, w: `${pill.width}px`, borderRadius: innerRadius, bg: brandFill.fill, boxShadow: `0 0.125rem 0.5rem ${colors.boxShadow.primary}`, transform: `translateX(${pill.left}px)`, transition: SLIDE, sx: reducedMotionSx() })), isUnderlineSlide && pill && (_jsx(Box, { "aria-hidden": "true", position: "absolute", bottom: "-0.0625rem", left: 0, h: "0.125rem", w: `${pill.width}px`, borderRadius: "full", bg: colors.primary[500], transform: `translateX(${pill.left}px)`, transition: SLIDE, sx: reducedMotionSx() })), options.map((option, index) => {
75
86
  const isSelected = option.value === value;
76
87
  return (_jsxs(Box, { as: "button", type: "button", ref: (node) => {
77
88
  refs.current[index] = node;
78
- }, role: "radio", "aria-checked": isSelected, disabled: option.isDisabled, tabIndex: index === tabIndex ? 0 : -1, onClick: () => onChange(option.value), position: "relative", zIndex: 1, display: "inline-flex", alignItems: "center", justifyContent: "center", gap: "0.375rem", flex: isFullWidth ? "1" : undefined, h: segmentH, px: control.paddingX, borderRadius: isUnderlineSlide ? "none" : "lg", borderWidth: "1px", borderStyle: "solid", borderColor: hasIndicator
89
+ }, role: "radio", "aria-checked": isSelected, disabled: option.isDisabled, tabIndex: index === tabIndex ? 0 : -1, onClick: () => onChange(option.value), position: "relative", zIndex: 1, display: "inline-flex", alignItems: "center", justifyContent: "center", gap: "0.375rem", flex: isFullWidth ? "1" : undefined, h: segmentH, px: control.paddingX, borderRadius: innerRadius, borderWidth: "1px", borderStyle: "solid", borderColor: hasIndicator
79
90
  ? "transparent"
80
91
  : isSelected
81
92
  ? colors.primary.opacity[32]
@@ -84,7 +95,11 @@ export default function SegmentedControl({ options, value, onChange, size = "sm"
84
95
  ? brandFill.color
85
96
  : restInk
86
97
  : isSelected
87
- ? colors.accentText
88
- : restInk, fontSize: control.fontSize, fontWeight: isSelected ? 600 : 500, whiteSpace: "nowrap", opacity: option.isDisabled ? 0.5 : 1, cursor: option.isDisabled ? "not-allowed" : "pointer", transition: transitionFor(["color"]), _hover: option.isDisabled || isSelected ? undefined : { color: colors.text[900] }, sx: { ...focusVisibleStyles(colors), ...reducedMotionSx() }, children: [option.icon, option.label, option.count != null && (_jsx(Tag, { label: formatCount(option.count), size: COUNT_TAG_SIZE[size], variant: "subtle", colorScheme: "gray" }))] }, option.value));
98
+ ? selectedInk
99
+ : restInk, fontSize: control.fontSize, fontWeight: isSelected ? 600 : 500, whiteSpace: "nowrap", opacity: option.isDisabled ? 0.5 : 1, cursor: option.isDisabled ? "not-allowed" : "pointer", transition: transitionFor(["color"]), _hover: option.isDisabled || isSelected ? undefined : { color: hoverInk }, sx: {
100
+ _focusVisible: segmentFocus,
101
+ [FOCUS_VISIBLE_OVER_STATE]: segmentFocus,
102
+ ...reducedMotionSx(),
103
+ }, children: [option.icon, option.label, option.count != null && (_jsx(Tag, { label: formatCount(option.count), size: COUNT_TAG_SIZE[size], variant: "subtle", colorScheme: "gray" }))] }, option.value));
89
104
  })] }));
90
105
  }
@@ -0,0 +1,23 @@
1
+ import { focusGlowShadow } from "../../Theme/chakra/focusRing.styles.js";
2
+ import { compositeOver } from "../../Theme/tokens/builders/color.js";
3
+ import { AA_NON_TEXT, liftToContrast } from "../../Theme/tokens/builders/outlineRung.js";
4
+ import { AA_NORMAL_TEXT } from "../../Theme/tokens/builders/accentText.js";
5
+ /** The surface a segment's label really sits on; brandSlide's track is a translucent tint, so composite it. */
6
+ export const segmentedTrackSurface = (variant, colors, surface) => {
7
+ const canvas = surface !== null && surface !== void 0 ? surface : colors.backgroundColor.main;
8
+ if (variant === "underlineSlide")
9
+ return canvas;
10
+ // An 8% tint reads on the page canvas; on a coloured bar it composites into the bar and the
11
+ // control stops looking like a control, so there the track becomes an opaque plate.
12
+ if (variant === "brandSlide") {
13
+ return surface ? colors.surfaceRaised : compositeOver(colors.primary.opacity[8], canvas);
14
+ }
15
+ return colors.background[600];
16
+ };
17
+ /** Unselected label ink, lifted to AA against the track it is drawn on. */
18
+ export const segmentedRestInk = (colors, trackSurface) => liftToContrast(colors.text[600], trackSurface, AA_NORMAL_TEXT);
19
+ /** A radiogroup is one tab stop, so the group wears the ring: a brand hairline plus the field bloom. */
20
+ export const segmentedFocusShadow = (colors, trackSurface) => `inset 0 0 0 1px ${liftToContrast(colors.primary[500], trackSurface, AA_NON_TEXT)}, ${focusGlowShadow(colors)}`;
21
+ /** On a coloured bar the plate can match the bar's lightness, so its edge carries the boundary.
22
+ * Drawn inset by the caller: a real border consumes the content box and decentres the sliding pill. */
23
+ export const segmentedPlateEdge = (colors, surface) => liftToContrast(colors.boxborder[500], surface, AA_NON_TEXT);
@@ -3,12 +3,12 @@ import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState }
3
3
  import { Box, Checkbox, FormControl, Input, Popover, PopoverAnchor, PopoverContent, Portal, Spinner, useDisclosure, useMergeRefs, } from "@chakra-ui/react";
4
4
  import { ChevronDown, X } from "lucide-react";
5
5
  import { useCustomTheme } from "../../Theme/useCustomTheme.js";
6
+ import { focusGlowShadow } from "../../Theme/chakra/focusRing.styles.js";
6
7
  import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
7
8
  import { scrollbarStyles } from "../../Theme/tokens/builders/scrollbar.js";
8
9
  import { CONTROL_SIZES, DEFAULT_CONTROL_SIZE } from "../../Theme/tokens/primitives/controlSizes.js";
9
10
  import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
10
11
  import { reducedMotionSx } from "../../Theme/chakra/motion.js";
11
- import { focusRingShadow } from "../../Theme/chakra/focusRing.styles.js";
12
12
  import { fieldControlStyles } from "../Common/fieldStyles.js";
13
13
  import { useFieldIds } from "../Common/useFieldIds.js";
14
14
  import FieldMessage from "../Common/FieldMessage.js";
@@ -70,6 +70,7 @@ const SelectPopup = forwardRef(function SelectPopup(props, ref) {
70
70
  const mergedTriggerRef = useMergeRefs(triggerRef, ref);
71
71
  const filterInputRef = useRef(null);
72
72
  const listRef = useRef(null);
73
+ const [triggerWidth, setTriggerWidth] = useState(0);
73
74
  const ids = useFieldIds(id, { error, errorMessage, helperText });
74
75
  const listboxId = `${ids.inputId}-listbox`;
75
76
  const filterInputId = `${listboxId}-filter`;
@@ -162,6 +163,13 @@ const SelectPopup = forwardRef(function SelectPopup(props, ref) {
162
163
  },
163
164
  // eslint-disable-next-line react-hooks/exhaustive-deps
164
165
  [isInteractive, props.isMulti, props.onChange, isValueControlled, onClear]);
166
+ // The panel grows past the trigger to fit long labels, so it cannot inherit the anchor width.
167
+ useEffect(() => {
168
+ const node = triggerRef.current;
169
+ if (!isOpen || !node)
170
+ return;
171
+ setTriggerWidth(node.getBoundingClientRect().width);
172
+ }, [isOpen]);
165
173
  useEffect(() => {
166
174
  if (!isOpen || !isSearchable)
167
175
  return;
@@ -337,7 +345,7 @@ const SelectPopup = forwardRef(function SelectPopup(props, ref) {
337
345
  ...chipTriggerSizeStyles(size, showChips, chipSize),
338
346
  ...(selectedOptions.length ? {} : { color: colors.textMuted }),
339
347
  ...(isOpen
340
- ? { borderColor: error ? colors.semanticText.error : colors.primary[500], boxShadow: focusRingShadow(colors) }
348
+ ? { borderColor: error ? colors.semanticText.error : colors.primary[500], boxShadow: focusGlowShadow(colors) }
341
349
  : {}),
342
350
  ...reducedMotionSx(),
343
351
  }), [colors, size, showChips, chipSize, selectedOptions.length, isOpen, error]);
@@ -364,7 +372,7 @@ const SelectPopup = forwardRef(function SelectPopup(props, ref) {
364
372
  const selectedValueIds = selectedOptions.map((option) => option.id.toString());
365
373
  const hiddenValues = !name ? [] : props.isMulti ? selectedValueIds : [(_c = selectedValueIds[0]) !== null && _c !== void 0 ? _c : ""];
366
374
  const groupedRows = useMemo(() => (hasGroups ? buildGroupedRows(filteredOptions) : []), [hasGroups, filteredOptions]);
367
- 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", matchWidth: true, 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: "100%", 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
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
368
376
  ? groupedRows.map((row) => {
369
377
  var _a;
370
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));
@@ -13,6 +13,7 @@ import { resolveSoftTone } from "../../Theme/tokens/builders/tone.js";
13
13
  import { sidebarRowPeak } from "../../Theme/tokens/builders/sidebarAccent.js";
14
14
  import { scaleFor } from "../../Theme/chakra/paletteFromTheme.js";
15
15
  import { fullViewportHeight } from "../../Theme/tokens/builders/viewportHeight.js";
16
+ import { SIDEBAR_ROW } from "./sidebarScale.js";
16
17
  const softBadge = (colors, colorScheme, surface) => {
17
18
  const tone = resolveSoftTone(colors, scaleFor(colors, colorScheme), surface);
18
19
  return { bg: tone.bg, color: tone.fg };
@@ -41,7 +42,7 @@ const CollapsedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
41
42
  e.preventDefault();
42
43
  if (!menuDisabled(item))
43
44
  onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item);
44
- }, bg: isActive ? "whiteAlpha.300" : "transparent", transition: "background 0.12s", children: _jsxs(Box, { position: "relative", display: "flex", alignItems: "center", children: [_jsx(Icon, { as: item.icon, fontSize: "1rem", color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), badgeVal != null && (_jsx(Box, { position: "absolute", top: "0", right: "0", w: "0.375rem", h: "0.375rem", borderRadius: "full", bg: theme.colors.red[400] }))] }) }) }), _jsx(Portal, { children: _jsx(PopoverContent, { borderRadius: "lg", bg: theme.colors.sidebar.elevated, boxShadow: "lg", minW: "10rem", maxW: "14rem", py: "0.125rem", ml: "-0.5rem", cursor: menuDisabled(item) ? "not-allowed" : "pointer", zIndex: 1500, color: theme.colors.white, border: 'none', children: _jsx(PopoverBody, { p: 3, children: _jsxs(Flex, { align: "center", gap: 2, justify: "space-between", children: [_jsxs(Flex, { align: "center", gap: 2, flex: "1", minW: 0, children: [_jsx(Icon, { as: item.icon, fontSize: "md", flexShrink: 0 }), _jsx(OverflowTooltipText, { placement: "right", maxWidth: "100%", fontSize: itemFontSize, fontWeight: "medium", as: "p", children: item.title })] }), badgeVal != null && (_jsx(Badge, { ...softBadge(theme.colors, colorScheme, sidebarRowPeak(theme.colors.sidebar.elevated)), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal }))] }) }) }) })] }));
45
+ }, bg: isActive ? "whiteAlpha.300" : "transparent", transition: "background 0.12s", children: _jsxs(Box, { position: "relative", display: "flex", alignItems: "center", children: [_jsx(Icon, { as: item.icon, fontSize: SIDEBAR_ROW.iconSize, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), badgeVal != null && (_jsx(Box, { position: "absolute", top: "0", right: "0", w: "0.375rem", h: "0.375rem", borderRadius: "full", bg: theme.colors.red[400] }))] }) }) }), _jsx(Portal, { children: _jsx(PopoverContent, { borderRadius: "lg", bg: theme.colors.sidebar.elevated, boxShadow: "lg", minW: "10rem", maxW: "14rem", py: "0.125rem", ml: "-0.5rem", cursor: menuDisabled(item) ? "not-allowed" : "pointer", zIndex: 1500, color: theme.colors.white, border: 'none', children: _jsx(PopoverBody, { p: 3, children: _jsxs(Flex, { align: "center", gap: 2, justify: "space-between", children: [_jsxs(Flex, { align: "center", gap: 2, flex: "1", minW: 0, children: [_jsx(Icon, { as: item.icon, fontSize: "md", flexShrink: 0 }), _jsx(OverflowTooltipText, { placement: "right", maxWidth: "100%", fontSize: itemFontSize, fontWeight: "medium", as: "p", children: item.title })] }), badgeVal != null && (_jsx(Badge, { ...softBadge(theme.colors, colorScheme, sidebarRowPeak(theme.colors.sidebar.elevated)), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal }))] }) }) }) })] }));
45
46
  };
46
47
  const ExpandedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
47
48
  var _a;
@@ -54,14 +55,14 @@ const ExpandedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
54
55
  e.preventDefault();
55
56
  if (!menuDisabled(item))
56
57
  onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item);
57
- }, borderLeft: "2px solid", borderLeftColor: isActive ? theme.colors.sidebar.activeIcon : "transparent", transition: "background 0.12s", children: [_jsxs(Flex, { align: "center", gap: 2, flex: "1", minW: 0, overflow: "hidden", children: [_jsx(Icon, { as: item.icon, fontSize: "0.95rem", flexShrink: 0, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), _jsx(Box, { flex: "1", minW: 0, children: _jsx(OverflowTooltipText, { placement: "right", maxWidth: "100%", fontSize: itemFontSize, fontWeight: isActive ? 600 : 500, color: isActive ? activeAccent.label : theme.colors.white, _groupHover: isActive ? undefined : { color: theme.colors.white }, as: "p", children: item.title }) })] }), badgeVal != null && (_jsx(Badge, { ...softBadge(theme.colors, colorScheme, sidebarRowPeak(theme.colors.sidebar.background[500])), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal }))] }));
58
+ }, borderLeft: "2px solid", borderLeftColor: isActive ? theme.colors.sidebar.activeIcon : "transparent", transition: "background 0.12s", children: [_jsxs(Flex, { align: "center", gap: 2, flex: "1", minW: 0, overflow: "hidden", children: [_jsx(Icon, { as: item.icon, fontSize: SIDEBAR_ROW.iconSize, flexShrink: 0, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), _jsx(Box, { flex: "1", minW: 0, children: _jsx(OverflowTooltipText, { placement: "right", maxWidth: "100%", fontSize: itemFontSize, fontWeight: isActive ? 600 : 500, color: isActive ? activeAccent.label : theme.colors.white, _groupHover: isActive ? undefined : { color: theme.colors.white }, as: "p", children: item.title }) })] }), badgeVal != null && (_jsx(Badge, { ...softBadge(theme.colors, colorScheme, sidebarRowPeak(theme.colors.sidebar.background[500])), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal }))] }));
58
59
  };
59
- const SecondaryBar = ({ items = [], defaultCollapsed = true, collapsedWidth = "3.5rem", expandedWidth = "10rem", headerFontSize = "0.75rem", itemFontSize = "0.75rem", selected, onItemClick, title, icon, }) => {
60
+ const SecondaryBar = ({ items = [], defaultCollapsed = true, collapsedWidth = "3.5rem", expandedWidth = "10rem", headerFontSize = SIDEBAR_ROW.fontSize, itemFontSize = SIDEBAR_ROW.fontSize, selected, onItemClick, title, icon, }) => {
60
61
  const theme = useCustomTheme();
61
62
  const activeAccent = getSidebarActiveAccent(theme.colors);
62
63
  const [collapsed, setCollapsed] = useState(defaultCollapsed);
63
64
  const width = collapsed ? collapsedWidth : expandedWidth;
64
- return (_jsx(Box, { as: "nav", "aria-label": title ? `${title} navigation` : "Secondary navigation", transition: transitionFor(["width"], "base"), pos: "sticky", top: 0, sx: fullViewportHeight, w: width, bg: theme.colors.sidebar.background[500], borderLeft: "1px solid", borderColor: theme.colors.sidebar.divider, boxShadow: theme.shadows.md, zIndex: 1, children: _jsxs(VStack, { align: "stretch", spacing: 0, h: "100%", children: [_jsxs(Flex, { align: "center", justify: collapsed ? "center" : "space-between", px: collapsed ? 0 : "10px", gap: "7px", h: HEADER_HEIGHT, overflow: "hidden", borderBottom: "1px solid", borderColor: theme.colors.sidebar.divider, flexShrink: 0, children: [!collapsed && (_jsxs(_Fragment, { children: [icon && (_jsx(Icon, { as: icon, fontSize: "0.95rem", color: activeAccent.icon, flexShrink: 0 })), _jsx(Box, { flex: "1", minW: 0, children: _jsx(OverflowTooltipText, { placement: "right", maxWidth: "100%", fontSize: headerFontSize, fontWeight: 600, color: theme.colors.white, as: "p", children: title !== null && title !== void 0 ? title : "" }) })] })), _jsx(Box, { as: "button", type: "button", "aria-label": collapsed ? "Expand navigation panel" : "Collapse navigation panel", "aria-expanded": !collapsed, border: "none", bg: "transparent", w: "24px", h: "24px", borderRadius: "lg", display: "flex", alignItems: "center", justifyContent: "center", cursor: "pointer", flexShrink: 0, onClick: () => setCollapsed((c) => !c), _hover: { bg: "whiteAlpha.100" }, transition: "background 0.15s", children: collapsed ? (_jsx(ToolTip, { label: title !== null && title !== void 0 ? title : "", placement: "right", children: _jsx(ChevronRight, { size: 13, color: theme.colors.sidebar.mutedIcon }) })) : (_jsx(ChevronLeft, { size: 13, color: theme.colors.sidebar.mutedIcon })) })] }), _jsx(Box, { id: "secondary-scroll-container", flex: "1", minH: 0, overflowY: "auto", overflowX: "hidden", py: 2, px: "6px", children: items.map((item) => {
65
+ return (_jsx(Box, { as: "nav", "aria-label": title ? `${title} navigation` : "Secondary navigation", transition: transitionFor(["width"], "base"), pos: "sticky", top: 0, sx: fullViewportHeight, w: width, bg: theme.colors.sidebar.background[500], borderLeft: "1px solid", borderColor: theme.colors.sidebar.divider, boxShadow: theme.shadows.md, zIndex: 1, children: _jsxs(VStack, { align: "stretch", spacing: 0, h: "100%", children: [_jsxs(Flex, { align: "center", justify: collapsed ? "center" : "space-between", px: collapsed ? 0 : "10px", gap: "7px", h: HEADER_HEIGHT, overflow: "hidden", borderBottom: "1px solid", borderColor: theme.colors.sidebar.divider, flexShrink: 0, children: [!collapsed && (_jsxs(_Fragment, { children: [icon && (_jsx(Icon, { as: icon, fontSize: SIDEBAR_ROW.iconSize, color: activeAccent.icon, flexShrink: 0 })), _jsx(Box, { flex: "1", minW: 0, children: _jsx(OverflowTooltipText, { placement: "right", maxWidth: "100%", fontSize: headerFontSize, fontWeight: 600, color: theme.colors.white, as: "p", children: title !== null && title !== void 0 ? title : "" }) })] })), _jsx(Box, { as: "button", type: "button", "aria-label": collapsed ? "Expand navigation panel" : "Collapse navigation panel", "aria-expanded": !collapsed, border: "none", bg: "transparent", w: "24px", h: "24px", borderRadius: "lg", display: "flex", alignItems: "center", justifyContent: "center", cursor: "pointer", flexShrink: 0, onClick: () => setCollapsed((c) => !c), _hover: { bg: "whiteAlpha.100" }, transition: "background 0.15s", children: collapsed ? (_jsx(ToolTip, { label: title !== null && title !== void 0 ? title : "", placement: "right", children: _jsx(ChevronRight, { size: 13, color: theme.colors.sidebar.mutedIcon }) })) : (_jsx(ChevronLeft, { size: 13, color: theme.colors.sidebar.mutedIcon })) })] }), _jsx(Box, { id: "secondary-scroll-container", flex: "1", minH: 0, overflowY: "auto", overflowX: "hidden", py: 2, px: "6px", children: items.map((item) => {
65
66
  var _a;
66
67
  const isActive = String(selected) === String(item.id) ||
67
68
  String(selected) === String(item.title);
@@ -26,6 +26,7 @@ import DefaultLogo from "../../Assets/defaultLogo.js";
26
26
  import OverflowTooltipText from "./components/OverflowTooltipText.js";
27
27
  import SecondaryBar from "./SecondaryBar.js";
28
28
  import OtherApps from "./components/OtherApps.js";
29
+ import { SIDEBAR_CHROME, SIDEBAR_ROW } from "./sidebarScale.js";
29
30
  import { fullViewportHeight } from "../../Theme/tokens/builders/viewportHeight.js";
30
31
  const SidebarHeader = ({ logo, companyName, companySubtitle, toggle, isLoading, onToggle, overlay, onClose, }) => {
31
32
  const theme = useCustomTheme();
@@ -35,7 +36,7 @@ const SidebarHeader = ({ logo, companyName, companySubtitle, toggle, isLoading,
35
36
  const primaryFillRung = solidFillRung(theme.colors.primary, theme.colors.white);
36
37
  const primaryFill = theme.colors.primary[primaryFillRung];
37
38
  const logoNode = logo ? (_jsx(Image, { borderRadius: "lg", boxSize: "1.75rem", src: logo, alt: "Company Logo", flexShrink: 0, cursor: toggle ? "pointer" : undefined, onClick: toggle ? onToggle : undefined })) : (_jsx(Box, { bg: primaryFill, color: labelOnFill(primaryFill, theme.colors.white, theme.colors.black), borderRadius: "lg", boxSize: "1.75rem", display: "flex", alignItems: "center", justifyContent: "center", fontWeight: "bold", flexShrink: 0, cursor: toggle ? "pointer" : undefined, onClick: toggle ? onToggle : undefined, children: _jsx(DefaultLogo, {}) }));
38
- return (_jsxs(Flex, { h: HEADER_HEIGHT, w: "100%", alignItems: "center", justifyContent: toggle ? "center" : "flex-start", gap: 2, px: toggle ? "8px" : "10px", borderBottom: "1px solid", borderColor: theme.colors.sidebar.divider, minW: 0, overflow: "hidden", flexShrink: 0, children: [logoNode, !toggle && (_jsxs(Box, { flex: "1", minW: 0, children: [_jsx(OverflowTooltipText, { placement: "right", fontWeight: 600, fontSize: "12.5px", textAlign: "left", color: theme.colors.white, lineHeight: "1.3", as: "p", width: "100%", children: companyName !== null && companyName !== void 0 ? companyName : "" }), companySubtitle && (_jsx(Text, { fontSize: "10px", color: theme.colors.sidebar.mutedLabel, lineHeight: "1.3", isTruncated: true, children: companySubtitle }))] })), !toggle && (_jsx(Box, { as: "button", type: "button", onClick: overlay ? onClose : onToggle, "aria-label": overlay ? "Close menu" : "Collapse sidebar", w: "22px", h: "22px", borderRadius: "lg", bg: "whiteAlpha.100", display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0, position: "relative", _hover: { bg: "whiteAlpha.300" }, transition: "background 0.15s", sx: {
39
+ return (_jsxs(Flex, { h: HEADER_HEIGHT, w: "100%", alignItems: "center", justifyContent: toggle ? "center" : "flex-start", gap: 2, px: toggle ? "8px" : "10px", borderBottom: "1px solid", borderColor: theme.colors.sidebar.divider, minW: 0, overflow: "hidden", flexShrink: 0, children: [logoNode, !toggle && (_jsxs(Box, { flex: "1", minW: 0, children: [_jsx(OverflowTooltipText, { placement: "right", fontWeight: 600, fontSize: SIDEBAR_CHROME.titleFontSize, textAlign: "left", color: theme.colors.white, lineHeight: "1.3", as: "p", width: "100%", children: companyName !== null && companyName !== void 0 ? companyName : "" }), companySubtitle && (_jsx(Text, { fontSize: SIDEBAR_CHROME.metaFontSize, color: theme.colors.sidebar.mutedLabel, lineHeight: "1.3", isTruncated: true, children: companySubtitle }))] })), !toggle && (_jsx(Box, { as: "button", type: "button", onClick: overlay ? onClose : onToggle, "aria-label": overlay ? "Close menu" : "Collapse sidebar", w: "22px", h: "22px", borderRadius: "lg", bg: "whiteAlpha.100", display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0, position: "relative", _hover: { bg: "whiteAlpha.300" }, transition: "background 0.15s", sx: {
39
40
  "&::after": {
40
41
  content: '""',
41
42
  position: "absolute",
@@ -54,7 +55,7 @@ const SkeletonMenuRow = ({ toggle }) => {
54
55
  const AddNewButton = ({ toggle, onClick, overlay }) => {
55
56
  const theme = useCustomTheme();
56
57
  const activeAccent = getSidebarActiveAccent(theme.colors);
57
- return (_jsxs(Flex, { as: "button", type: "button", "data-group": "", "aria-label": "Add New", alignItems: "center", gap: "9px", px: "10px", py: overlay ? "11px" : "7px", borderRadius: "lg", cursor: "pointer", border: "none", bg: "transparent", w: "100%", mb: "2px", justifyContent: toggle ? "center" : "flex-start", _hover: { backgroundColor: "whiteAlpha.100" }, transition: "background 0.12s", onClick: onClick, children: [_jsx(Box, { w: "18px", h: "18px", display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0, children: _jsx(Plus, { size: 16, color: activeAccent.icon }) }), !toggle && (_jsx(Text, { fontSize: "12.5px", color: theme.colors.white, fontWeight: "medium", children: "Add New" }))] }));
58
+ return (_jsxs(Flex, { as: "button", type: "button", "data-group": "", "aria-label": "Add New", alignItems: "center", gap: "9px", px: "10px", py: overlay ? "11px" : "7px", borderRadius: "lg", cursor: "pointer", border: "none", bg: "transparent", w: "100%", mb: "2px", justifyContent: toggle ? "center" : "flex-start", _hover: { backgroundColor: "whiteAlpha.100" }, transition: "background 0.12s", onClick: onClick, children: [_jsx(Box, { w: "18px", h: "18px", display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0, children: _jsx(Plus, { size: 16, color: activeAccent.icon }) }), !toggle && (_jsx(Text, { fontSize: SIDEBAR_ROW.fontSize, color: theme.colors.white, fontWeight: "medium", children: "Add New" }))] }));
58
59
  };
59
60
  const deriveInitials = (user) => {
60
61
  if (user.initials)
@@ -69,14 +70,14 @@ const deriveInitials = (user) => {
69
70
  const UserFooter = ({ user, toggle, overlay }) => {
70
71
  const theme = useCustomTheme();
71
72
  const activeAccent = getSidebarActiveAccent(theme.colors);
72
- const avatar = user.avatarUrl ? (_jsx(Image, { src: user.avatarUrl, alt: user.name, boxSize: "26px", borderRadius: "full", objectFit: "cover", flexShrink: 0 })) : (_jsx(Box, { boxSize: "26px", borderRadius: "full", bg: theme.colors.primary.opacity[32], color: activeAccent.label, display: "flex", alignItems: "center", justifyContent: "center", fontSize: "10px", fontWeight: 600, flexShrink: 0, children: deriveInitials(user) }));
73
- return (_jsx(Box, { borderTop: "1px solid", borderColor: theme.colors.sidebar.divider, py: 2, px: "6px", flexShrink: 0, children: _jsxs(Flex, { as: "button", type: "button", onClick: user.onClick, align: "center", gap: 2, px: 2, py: overlay ? "10px" : "6px", w: "100%", borderRadius: "lg", cursor: "pointer", bg: "transparent", border: "none", justify: toggle ? "center" : "flex-start", _hover: { bg: "whiteAlpha.100" }, transition: "background 0.12s", children: [avatar, !toggle && (_jsxs(Box, { flex: "1", minW: 0, textAlign: "left", children: [_jsx(Text, { fontSize: "11.5px", fontWeight: 500, color: theme.colors.white, isTruncated: true, children: user.name }), user.role && (_jsx(Text, { fontSize: "10px", color: theme.colors.sidebar.mutedLabel, isTruncated: true, children: user.role }))] })), !toggle && _jsx(MoreVertical, { size: 14, color: theme.colors.sidebar.mutedIcon })] }) }));
73
+ const avatar = user.avatarUrl ? (_jsx(Image, { src: user.avatarUrl, alt: user.name, boxSize: "26px", borderRadius: "full", objectFit: "cover", flexShrink: 0 })) : (_jsx(Box, { boxSize: "26px", borderRadius: "full", bg: theme.colors.primary.opacity[32], color: activeAccent.label, display: "flex", alignItems: "center", justifyContent: "center", fontSize: SIDEBAR_CHROME.metaFontSize, fontWeight: 600, flexShrink: 0, children: deriveInitials(user) }));
74
+ return (_jsx(Box, { borderTop: "1px solid", borderColor: theme.colors.sidebar.divider, py: 2, px: "6px", flexShrink: 0, children: _jsxs(Flex, { as: "button", type: "button", onClick: user.onClick, align: "center", gap: 2, px: 2, py: overlay ? "10px" : "6px", w: "100%", borderRadius: "lg", cursor: "pointer", bg: "transparent", border: "none", justify: toggle ? "center" : "flex-start", _hover: { bg: "whiteAlpha.100" }, transition: "background 0.12s", children: [avatar, !toggle && (_jsxs(Box, { flex: "1", minW: 0, textAlign: "left", children: [_jsx(Text, { fontSize: SIDEBAR_CHROME.labelFontSize, fontWeight: 500, color: theme.colors.white, isTruncated: true, children: user.name }), user.role && (_jsx(Text, { fontSize: SIDEBAR_CHROME.metaFontSize, color: theme.colors.sidebar.mutedLabel, isTruncated: true, children: user.role }))] })), !toggle && _jsx(MoreVertical, { size: 14, color: theme.colors.sidebar.mutedIcon })] }) }));
74
75
  };
75
76
  // Footer "cell" — one segment of the Collapse | Hide/Show control.
76
77
  const ControlCell = ({ onClick, ariaLabel, label, accent, children }) => {
77
78
  const theme = useCustomTheme();
78
79
  const activeAccent = getSidebarActiveAccent(theme.colors);
79
- return (_jsxs(Flex, { as: "button", type: "button", "aria-label": ariaLabel, flex: "1", minW: 0, alignItems: "center", justifyContent: "center", gap: "7px", px: "10px", py: "14px", cursor: "pointer", border: "none", bg: accent ? "whiteAlpha.300" : "transparent", onClick: onClick, _hover: { bg: accent ? "whiteAlpha.400" : "whiteAlpha.200" }, transition: "background 0.15s", children: [children, label && (_jsx(Text, { fontSize: "11.5px", color: accent ? activeAccent.label : theme.colors.sidebar.mutedLabel, fontWeight: "medium", children: label }))] }));
80
+ return (_jsxs(Flex, { as: "button", type: "button", "aria-label": ariaLabel, flex: "1", minW: 0, alignItems: "center", justifyContent: "center", gap: "7px", px: "10px", py: "14px", cursor: "pointer", border: "none", bg: accent ? "whiteAlpha.300" : "transparent", onClick: onClick, _hover: { bg: accent ? "whiteAlpha.400" : "whiteAlpha.200" }, transition: "background 0.15s", children: [children, label && (_jsx(Text, { fontSize: SIDEBAR_CHROME.labelFontSize, color: accent ? activeAccent.label : theme.colors.sidebar.mutedLabel, fontWeight: "medium", children: label }))] }));
80
81
  };
81
82
  // Collapse (mini-rail) sits next to the Hide/Show navbar-mode toggle. In the
82
83
  // desktop mobile-nav overlay only "Show" (return to the docked sidebar) is shown;
@@ -11,6 +11,7 @@ import { sidebarRowPeak } from "../../../Theme/tokens/builders/sidebarAccent.js"
11
11
  import { scaleFor } from "../../../Theme/chakra/paletteFromTheme.js";
12
12
  import TruncatedTextWithTooltip from "./TextTruncation.js";
13
13
  import { sanitizeId } from "../sidebarId.js";
14
+ import { SIDEBAR_ROW } from "../sidebarScale.js";
14
15
  /**
15
16
  * These rows are real `<a href>`s now, so the browser's own gestures have to keep working —
16
17
  * cmd/ctrl-click for a new tab, shift for a window, middle-click. Only a plain left click is
@@ -29,7 +30,7 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
29
30
  const isBlocked = menuDisabled(menu) || locked;
30
31
  const hasSubMenu = !!(subMenu === null || subMenu === void 0 ? void 0 : subMenu.length);
31
32
  const submenuPanelId = `submenu-${reactId}`;
32
- const rowHeight = overlay ? "48px" : "32px";
33
+ const rowHeight = overlay ? SIDEBAR_ROW.overlayHeight : SIDEBAR_ROW.height;
33
34
  // A submenu parent only expands, so it is a button; every other row navigates.
34
35
  // Cast: Chakra narrows `as` unions to their *shared* props, which drops `href`.
35
36
  const rowAs = (hasSubMenu ? "button" : "a");
@@ -89,7 +90,7 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
89
90
  // open={isOpen}
90
91
  , {
91
92
  // open={isOpen}
92
- fontSize: "13px", lineHeight: "1", flex: "1", color: isAnyActive ? activeAccent.label : theme.colors.white, fontWeight: isAnyActive ? 600 : 500, _groupHover: isAnyActive ? undefined : { color: theme.colors.white }, children: title }))] }), !toggle && (_jsxs(Flex, { align: "center", gap: "0.375rem", children: [(() => {
93
+ fontSize: SIDEBAR_ROW.fontSize, lineHeight: "1", flex: "1", color: isAnyActive ? activeAccent.label : theme.colors.white, fontWeight: isAnyActive ? 600 : 500, _groupHover: isAnyActive ? undefined : { color: theme.colors.white }, children: title }))] }), !toggle && (_jsxs(Flex, { align: "center", gap: "0.375rem", children: [(() => {
93
94
  var _a, _b, _c;
94
95
  const value = badgeValue;
95
96
  if (value == null)
@@ -122,13 +123,13 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
122
123
  var _a, _b, _c;
123
124
  const isSubActive = activeMenu === sub.id;
124
125
  const isSubBlocked = menuDisabled(sub) || sub.locked;
125
- return (_jsxs(Box, { as: "a", href: (_a = sub.url) !== null && _a !== void 0 ? _a : "#", "data-group": "", "aria-current": isSubActive ? "page" : undefined, "aria-disabled": isSubBlocked ? true : undefined, textDecoration: "none", h: "20px", pl: "30px", pr: "10px", borderRadius: "lg", fontSize: "11.5px", backgroundColor: "transparent", _hover: { backgroundColor: "whiteAlpha.100" }, opacity: isSubBlocked ? 0.6 : 1, cursor: isSubBlocked ? "not-allowed" : "pointer", pointerEvents: isSubBlocked ? "none" : "auto", onClick: (e) => {
126
+ return (_jsxs(Box, { as: "a", href: (_a = sub.url) !== null && _a !== void 0 ? _a : "#", "data-group": "", "aria-current": isSubActive ? "page" : undefined, "aria-disabled": isSubBlocked ? true : undefined, textDecoration: "none", h: SIDEBAR_ROW.subHeight, pl: "30px", pr: "10px", borderRadius: "lg", fontSize: SIDEBAR_ROW.fontSize, backgroundColor: "transparent", _hover: { backgroundColor: "whiteAlpha.100" }, opacity: isSubBlocked ? 0.6 : 1, cursor: isSubBlocked ? "not-allowed" : "pointer", pointerEvents: isSubBlocked ? "none" : "auto", onClick: (e) => {
126
127
  if (sub.url && isBrowserNavigationGesture(e))
127
128
  return;
128
129
  e.preventDefault();
129
130
  if (!isSubBlocked)
130
131
  handleClick === null || handleClick === void 0 ? void 0 : handleClick(sub);
131
- }, display: "flex", alignItems: "center", justifyContent: "space-between", gap: 2, transition: "background 0.12s", children: [_jsxs(Flex, { align: "center", gap: "9px", overflow: "hidden", flex: "1", children: [sub.icon ? (_jsx(Icon, { as: sub.icon, fontSize: "0.95rem", flexShrink: 0, color: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" })) : (_jsx(Box, { w: "5px", h: "5px", borderRadius: "full", flexShrink: 0, bg: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { bg: theme.colors.white }, transition: "background 0.12s" })), _jsx(TruncatedTextWithTooltip, { fontSize: "xs", fontWeight: isSubActive ? 600 : 500, lineHeight: "1",
132
+ }, display: "flex", alignItems: "center", justifyContent: "space-between", gap: 2, transition: "background 0.12s", children: [_jsxs(Flex, { align: "center", gap: "9px", overflow: "hidden", flex: "1", children: [sub.icon ? (_jsx(Icon, { as: sub.icon, fontSize: SIDEBAR_ROW.iconSize, flexShrink: 0, color: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" })) : (_jsx(Box, { w: "5px", h: "5px", borderRadius: "full", flexShrink: 0, bg: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { bg: theme.colors.white }, transition: "background 0.12s" })), _jsx(TruncatedTextWithTooltip, { fontSize: SIDEBAR_ROW.fontSize, fontWeight: isSubActive ? 600 : 500, lineHeight: "1",
132
133
  // open={isOpen}
133
134
  color: isSubActive ? theme.colors.white : theme.colors.sidebar.mutedLabel, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, children: sub.title })] }), sub.locked ? (_jsx(Icon, { as: LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon })) : (() => {
134
135
  var _a, _b, _c, _d;
@@ -110,7 +110,7 @@ const MenuItems = ({ menus, activeMenu, handleMenuClick, toggle, selectedSubMenu
110
110
  lastGroup = menu.group;
111
111
  groupCount += 1;
112
112
  }
113
- return (_jsxs(React.Fragment, { children: [showGroup && !isFirstGroup && (_jsx(Box, { h: "1px", bg: theme.colors.sidebar.divider, mx: 2, my: "5px" })), showGroup && !toggle && (_jsx(Box, { "aria-hidden": "true", px: "10px", pt: "10px", pb: "3px", fontSize: "9.5px", fontWeight: 600, textTransform: "uppercase", letterSpacing: "0.1em", color: theme.colors.sidebar.mutedLabel, whiteSpace: "nowrap", overflow: "hidden", children: menu.group })), _jsx(MenuItemBox, { menu: menu, activeMenu: activeMenu, toggle: toggle, handleClick: handleMenuClick, selectedSubMenu: selectedSubMenu, isOpen: openMenuId === menu.id, onToggle: handleToggle, overlay: overlay })] }, `${String((_c = (_b = (_a = menu.id) !== null && _a !== void 0 ? _a : menu.url) !== null && _b !== void 0 ? _b : menu.title) !== null && _c !== void 0 ? _c : idx)}-${idx}`));
113
+ return (_jsxs(React.Fragment, { children: [showGroup && !isFirstGroup && (_jsx(Box, { h: "1px", bg: theme.colors.sidebar.divider, mx: 2, my: overlay ? "3px" : "5px" })), showGroup && !toggle && (_jsx(Box, { "aria-hidden": "true", px: "10px", pt: overlay ? "6px" : "10px", pb: "3px", fontSize: "9.5px", fontWeight: 600, textTransform: "uppercase", letterSpacing: "0.1em", color: theme.colors.sidebar.mutedLabel, whiteSpace: "nowrap", overflow: "hidden", children: menu.group })), _jsx(MenuItemBox, { menu: menu, activeMenu: activeMenu, toggle: toggle, handleClick: handleMenuClick, selectedSubMenu: selectedSubMenu, isOpen: openMenuId === menu.id, onToggle: handleToggle, overlay: overlay })] }, `${String((_c = (_b = (_a = menu.id) !== null && _a !== void 0 ? _a : menu.url) !== null && _b !== void 0 ? _b : menu.title) !== null && _c !== void 0 ? _c : idx)}-${idx}`));
114
114
  }) }));
115
115
  };
116
116
  export default MenuItems;
@@ -8,6 +8,7 @@ import { resolveSoftTone } from "../../../Theme/tokens/builders/tone.js";
8
8
  import { sidebarRowPeak } from "../../../Theme/tokens/builders/sidebarAccent.js";
9
9
  import { scaleFor } from "../../../Theme/chakra/paletteFromTheme.js";
10
10
  import TruncatedTextWithTooltip from "./TextTruncation.js";
11
+ import { SIDEBAR_ROW } from "../sidebarScale.js";
11
12
  const MenuPopoverContent = ({ menu, handleMenuClick, activeMenu, }) => {
12
13
  var _a;
13
14
  const theme = useCustomTheme();
@@ -22,7 +23,7 @@ const MenuPopoverContent = ({ menu, handleMenuClick, activeMenu, }) => {
22
23
  if (!isBlocked)
23
24
  handleMenuClick === null || handleMenuClick === void 0 ? void 0 : handleMenuClick(menu);
24
25
  }
25
- }, cursor: !hasSubMenu ? (isBlocked ? "not-allowed" : "pointer") : "default", "aria-disabled": !hasSubMenu && isBlocked ? true : undefined, children: [_jsx(Icon, { as: icon, fontSize: "md", flexShrink: 0, color: !hasSubMenu && isParentActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon }), _jsx(TruncatedTextWithTooltip, { fontWeight: 600, fontSize: "13px", flex: "1", color: theme.colors.white, children: title }), (() => {
26
+ }, cursor: !hasSubMenu ? (isBlocked ? "not-allowed" : "pointer") : "default", "aria-disabled": !hasSubMenu && isBlocked ? true : undefined, children: [_jsx(Icon, { as: icon, fontSize: "md", flexShrink: 0, color: !hasSubMenu && isParentActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon }), _jsx(TruncatedTextWithTooltip, { fontWeight: 600, fontSize: SIDEBAR_ROW.fontSize, flex: "1", color: theme.colors.white, children: title }), (() => {
26
27
  var _a, _b, _c, _d;
27
28
  const cfg = typeof badge === "object" && badge !== null
28
29
  ? badge
@@ -43,10 +44,10 @@ const MenuPopoverContent = ({ menu, handleMenuClick, activeMenu, }) => {
43
44
  e.preventDefault();
44
45
  if (!isSubBlocked)
45
46
  handleMenuClick === null || handleMenuClick === void 0 ? void 0 : handleMenuClick(sub);
46
- }, px: 2, h: "20px", mb: "2px", borderRadius: "lg", align: "center", justify: "space-between", gap: 2, borderLeft: "2px solid", borderLeftColor: isSubActive ? theme.colors.sidebar.activeIcon : "transparent", bg: isSubActive ? "whiteAlpha.300" : "transparent", _hover: {
47
+ }, px: 2, h: SIDEBAR_ROW.subHeight, mb: "2px", borderRadius: "lg", align: "center", justify: "space-between", gap: 2, borderLeft: "2px solid", borderLeftColor: isSubActive ? theme.colors.sidebar.activeIcon : "transparent", bg: isSubActive ? "whiteAlpha.300" : "transparent", _hover: {
47
48
  bg: !isSubBlocked ? "whiteAlpha.100" : "transparent",
48
49
  cursor: !isSubBlocked ? "pointer" : "not-allowed",
49
- }, opacity: isSubBlocked ? 0.5 : 1, pointerEvents: isSubBlocked ? "none" : "auto", transition: "background 0.12s", children: [_jsxs(Flex, { align: "center", gap: "9px", overflow: "hidden", flex: "1", children: [_jsx(Icon, { as: sub.icon, fontSize: "0.95rem", flexShrink: 0, color: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), _jsx(TruncatedTextWithTooltip, { fontSize: "12.5px", fontWeight: isSubActive ? 600 : 500, flex: 1, color: isSubActive ? activeAccent.label : theme.colors.white, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, children: sub.title })] }), sub.locked ? (_jsx(Icon, { as: LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon })) : (() => {
50
+ }, opacity: isSubBlocked ? 0.5 : 1, pointerEvents: isSubBlocked ? "none" : "auto", transition: "background 0.12s", children: [_jsxs(Flex, { align: "center", gap: "9px", overflow: "hidden", flex: "1", children: [_jsx(Icon, { as: sub.icon, fontSize: SIDEBAR_ROW.iconSize, flexShrink: 0, color: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), _jsx(TruncatedTextWithTooltip, { fontSize: SIDEBAR_ROW.fontSize, fontWeight: isSubActive ? 600 : 500, flex: 1, color: isSubActive ? activeAccent.label : theme.colors.white, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, children: sub.title })] }), sub.locked ? (_jsx(Icon, { as: LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon })) : (() => {
50
51
  var _a, _b, _c, _d;
51
52
  const cfg = typeof sub.badge === "object" && sub.badge !== null
52
53
  ? sub.badge
@@ -0,0 +1,15 @@
1
+ /** One type and row scale for the whole sidebar — rail, submenu, flyout, secondary bar and chrome. */
2
+ export const SIDEBAR_ROW = {
3
+ height: "32px",
4
+ /** Rail row in the mobile overlay — the WCAG 2.5.5 touch target. */
5
+ overlayHeight: "44px",
6
+ subHeight: "28px",
7
+ fontSize: "13px",
8
+ iconSize: "1rem",
9
+ };
10
+ /** Header/footer text around the rows; every row itself uses SIDEBAR_ROW.fontSize. */
11
+ export const SIDEBAR_CHROME = {
12
+ titleFontSize: "12.5px",
13
+ labelFontSize: "11.5px",
14
+ metaFontSize: "10px",
15
+ };
@@ -1,11 +1,11 @@
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 now renders it at a fixed 12.5rem width. */
5
- export default function Switch({ leftText, rightText, leftIcon, rightIcon, onSwitchToggle, switchActive, "aria-label": ariaLabel, }) {
4
+ /** @deprecated Use `SegmentedControl` — Switch renders it at 12.5rem, growing when the labels need it. */
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: "12.5rem", children: _jsx(SegmentedControl, { options: options, value: switchActive, onChange: onSwitchToggle, variant: "brandSlide", isFullWidth: true, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : `${leftText} or ${rightText}` }) }));
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}` }) }));
11
11
  }
@@ -1,19 +1,27 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useMemo } from "react";
3
- import { Flex, IconButton, Select, Text } from "@chakra-ui/react";
3
+ import { Flex, IconButton, Text } from "@chakra-ui/react";
4
4
  import { pageSizeCalculation } from "../../../Utils/table.js";
5
+ import Select from "../../Select/Select.js";
6
+ import { DEFAULT_PAGE_SIZE } from "../hooks/useTable.js";
5
7
  import { useCustomTheme } from "../../../Theme/useCustomTheme.js";
6
8
  import ToolTip from "../../ToolTip/ToolTip.js";
7
9
  import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, } from "lucide-react";
8
10
  const Pagination = React.memo(({ paginationText, handlePageSizeChange, rowsPerPage, currentPage, pages, setCurrentPage, dataLength, isServerPagination, paginationSelectOptions, }) => {
9
- const computedOptions = useMemo(() => paginationSelectOptions && paginationSelectOptions.length
10
- ? paginationSelectOptions
11
- : pageSizeCalculation(dataLength), [paginationSelectOptions, dataLength]);
11
+ const computedOptions = useMemo(() => {
12
+ if (paginationSelectOptions && paginationSelectOptions.length) {
13
+ return paginationSelectOptions;
14
+ }
15
+ const sizes = new Set(pageSizeCalculation(dataLength));
16
+ sizes.add(DEFAULT_PAGE_SIZE);
17
+ sizes.add(rowsPerPage);
18
+ return [...sizes].sort((a, b) => a - b);
19
+ }, [paginationSelectOptions, dataLength, rowsPerPage]);
12
20
  const theme = useCustomTheme();
13
21
  // const isLeftDisabled = currentPage === 0;
14
22
  // const isRightDisabled = currentPage >= pages - 1;
15
23
  const isLeftDisabled = dataLength === 0 || currentPage === 0;
16
24
  const isRightDisabled = dataLength === 0 || currentPage >= pages - 1;
17
- return (_jsxs(Flex, { justify: "flex-end", align: "center", flexWrap: "nowrap", children: [(!isServerPagination || paginationSelectOptions) && (_jsxs(Select, { "aria-label": "Rows per page", onChange: handlePageSizeChange, value: rowsPerPage, size: "xs", borderRadius: "lg", width: "auto", minW: "4.5rem", isDisabled: dataLength === 0, children: [!paginationSelectOptions && dataLength < 100 ? _jsx("option", { value: 0 }) : null, computedOptions.map((size, index) => (_jsx("option", { value: String(size), children: String(size) }, index)))] })), dataLength > 0 && (_jsxs(Flex, { w: "100%", children: [_jsx(ToolTip, { label: "First", placement: "top", children: _jsx(IconButton, { "aria-label": "first-page", color: isLeftDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isLeftDisabled ? "plain" : "ghost", onClick: () => setCurrentPage(0), _hover: !isLeftDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronsLeft, {}) }) }), _jsx(ToolTip, { label: "Previous", placement: "top", children: _jsx(IconButton, { "aria-label": "previous-page", color: isLeftDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isLeftDisabled ? "plain" : "ghost", onClick: () => currentPage > 0 && setCurrentPage(currentPage - 1), _hover: !isLeftDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronLeft, {}) }) }), _jsx(Text, { mt: 3, fontSize: 12, whiteSpace: "nowrap", color: theme.colors.text[500], children: paginationText }), _jsx(ToolTip, { label: "Next", placement: "top", children: _jsx(IconButton, { "aria-label": "next-page", color: isRightDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isRightDisabled ? "plain" : "ghost", onClick: () => currentPage < pages - 1 && setCurrentPage(currentPage + 1), _hover: !isRightDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronRight, {}) }) }), _jsx(ToolTip, { label: "Last", placement: "top", children: _jsx(IconButton, { "aria-label": "last-page", color: isRightDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isRightDisabled ? "plain" : "ghost", onClick: () => setCurrentPage(pages - 1), _hover: !isRightDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronsRight, {}) }) })] }))] }));
25
+ return (_jsxs(Flex, { justify: "flex-end", align: "center", flexWrap: "nowrap", children: [(!isServerPagination || paginationSelectOptions) && (_jsx(Select, { native: false, isSearchable: false, "aria-label": "Rows per page", onChange: (option) => option && handlePageSizeChange(Number(option.id)), value: rowsPerPage, size: "xs", width: "4.5rem", isDisabled: dataLength === 0, options: computedOptions.map((size) => ({ id: size, label: String(size) })) })), dataLength > 0 && (_jsxs(Flex, { w: "100%", children: [_jsx(ToolTip, { label: "First", placement: "top", children: _jsx(IconButton, { "aria-label": "first-page", color: isLeftDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isLeftDisabled ? "plain" : "ghost", onClick: () => setCurrentPage(0), _hover: !isLeftDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronsLeft, {}) }) }), _jsx(ToolTip, { label: "Previous", placement: "top", children: _jsx(IconButton, { "aria-label": "previous-page", color: isLeftDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isLeftDisabled ? "plain" : "ghost", onClick: () => currentPage > 0 && setCurrentPage(currentPage - 1), _hover: !isLeftDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronLeft, {}) }) }), _jsx(Text, { mt: 3, fontSize: 12, whiteSpace: "nowrap", color: theme.colors.text[500], children: paginationText }), _jsx(ToolTip, { label: "Next", placement: "top", children: _jsx(IconButton, { "aria-label": "next-page", color: isRightDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isRightDisabled ? "plain" : "ghost", onClick: () => currentPage < pages - 1 && setCurrentPage(currentPage + 1), _hover: !isRightDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronRight, {}) }) }), _jsx(ToolTip, { label: "Last", placement: "top", children: _jsx(IconButton, { "aria-label": "last-page", color: isRightDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isRightDisabled ? "plain" : "ghost", onClick: () => setCurrentPage(pages - 1), _hover: !isRightDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronsRight, {}) }) })] }))] }));
18
26
  });
19
27
  export default Pagination;
@@ -1,5 +1,10 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Select, VStack } from "@chakra-ui/react";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { VStack } from "@chakra-ui/react";
3
+ import Select from "../../Select/Select.js";
4
+ const OPERATOR_OPTIONS = [
5
+ { id: "is", label: "is" },
6
+ { id: "is not", label: "is not" },
7
+ ];
3
8
  export function SelectOperationControls({ operator, onOperatorChange, size = "xs", ml = "1.25rem", mt = 2, }) {
4
- return (_jsx(VStack, { spacing: 2, align: "stretch", mt: mt, ml: ml, children: _jsxs(Select, { size: size, value: operator, onChange: (e) => onOperatorChange(e.target.value), sx: { fontSize: "0.75rem", height: "24px" }, width: "90px", children: [_jsx("option", { value: "is", children: "is" }), _jsx("option", { value: "is not", children: "is not" })] }) }));
9
+ return (_jsx(VStack, { spacing: 2, align: "stretch", mt: mt, ml: ml, children: _jsx(Select, { native: false, isSearchable: false, "aria-label": "Operator", size: size, width: "90px", options: OPERATOR_OPTIONS, value: operator, onChange: (option) => option && onOperatorChange(String(option.id)) }) }));
5
10
  }
@@ -1,5 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Select, Input, VStack } from "@chakra-ui/react";
2
+ import { VStack } from "@chakra-ui/react";
3
+ import { useMemo } from "react";
4
+ import Select from "../../Select/Select.js";
5
+ import TextInput from "../../Input/TextInput.js";
3
6
  export const TEXT_OPERATORS = [
4
7
  "is",
5
8
  "is not",
@@ -12,5 +15,6 @@ export const TEXT_OPERATORS = [
12
15
  ];
13
16
  export const requiresValue = (op) => !(op === "is empty" || op === "is not empty");
14
17
  export function TextOperationControls({ operator, value, onOperatorChange, onValueChange, size = "xs", ml = "1.25rem", mt = 2, }) {
15
- return (_jsxs(VStack, { spacing: 2, align: "stretch", mt: mt, ml: ml, children: [_jsx(Select, { size: size, value: operator, onChange: (e) => onOperatorChange(e.target.value), sx: { fontSize: "0.75rem", height: "24px" }, width: "110px", children: TEXT_OPERATORS.map((op) => (_jsx("option", { value: op, children: op }, op))) }), requiresValue(operator) && (_jsx(Input, { size: size, placeholder: "Type here", value: value, onChange: (e) => onValueChange(e.target.value), sx: { fontSize: "0.75rem", height: "24px" }, width: "100%" }))] }));
18
+ const options = useMemo(() => TEXT_OPERATORS.map((op) => ({ id: op, label: op })), []);
19
+ return (_jsxs(VStack, { spacing: 2, align: "stretch", mt: mt, ml: ml, children: [_jsx(Select, { native: false, isSearchable: false, "aria-label": "Operator", size: size, width: "110px", options: options, value: operator, onChange: (option) => option && onOperatorChange(String(option.id)) }), requiresValue(operator) && (_jsx(TextInput, { size: size, placeholder: "Type here", value: value, onChange: (e) => onValueChange(e.target.value), width: "100%" }))] }));
16
20
  }
@@ -1,6 +1,7 @@
1
1
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
2
  import { SortMultiColumnData } from "../../../Utils/table.js";
3
- const defaultPageSize = 20;
3
+ export const DEFAULT_PAGE_SIZE = 20;
4
+ const defaultPageSize = DEFAULT_PAGE_SIZE;
4
5
  const mergeColumnWithPreference = (pref, originalCol) => {
5
6
  var _a;
6
7
  if (!pref || typeof pref !== "object") {
@@ -100,8 +101,8 @@ const useTable = ({ data, isPagination, selections, onSelection, tablePreference
100
101
  const sortedData = SortMultiColumnData(tableData, columnsSort);
101
102
  return sortedData.slice(startRow, endRow);
102
103
  }, [columnsSort, startRow, endRow, tableData, isServerPagination]);
103
- const handlePageSizeChange = (event) => {
104
- const value = Number(event.target.value);
104
+ const handlePageSizeChange = (size) => {
105
+ const value = Number(size);
105
106
  setRowsPerPage(value !== 0 ? value : defaultPageSize);
106
107
  if (onNoOfRowsPerPageChange) {
107
108
  onNoOfRowsPerPageChange(value !== 0 ? value : defaultPageSize);
@@ -2,7 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useRef } from "react";
3
3
  import { Box } from "@chakra-ui/react";
4
4
  import { useCustomTheme } from "../../../Theme/useCustomTheme.js";
5
- import { focusVisibleStyles } from "../../../Theme/chakra/focusRing.styles.js";
5
+ import { FOCUS_VISIBLE_OVER_STATE } from "../../../Theme/chakra/focusRing.styles.js";
6
+ import { AA_NON_TEXT, liftToContrast } from "../../../Theme/tokens/builders/outlineRung.js";
7
+ import { compositeOver } from "../../../Theme/tokens/builders/color.js";
6
8
  import { transitionFor } from "../../../Theme/tokens/primitives/motion.js";
7
9
  import { reducedMotionSx } from "../../../Theme/chakra/motion.js";
8
10
  import { CONTROL_SIZES } from "../../../Theme/tokens/primitives/controlSizes.js";
@@ -22,6 +24,14 @@ const Tab = ({ value, children, icon, count, isDisabled }) => {
22
24
  const scale = scaleForColorScheme(colors, ctx.colorScheme);
23
25
  const style = resolveTabStyle(colors, scale, canvas, ctx.variant, isSelected);
24
26
  const spec = CONTROL_SIZES[ctx.size];
27
+ // The list scrolls on both axes, so an outer ring is clipped into arcs; a negative offset draws it
28
+ // inside the tab, clear of its own border rather than thickening it.
29
+ const focusRing = {
30
+ outline: `1px solid ${liftToContrast(colors.primary[500],
31
+ // subtle/ghost fills are translucent tints; contrast has no meaning until they are flattened.
32
+ style.bg === "transparent" ? canvas : compositeOver(style.bg, canvas), AA_NON_TEXT)}`,
33
+ outlineOffset: "-2px",
34
+ };
25
35
  const borderProps = ctx.variant === "outline"
26
36
  ? { border: "1px solid", borderColor: (_b = style.border) !== null && _b !== void 0 ? _b : "transparent" }
27
37
  : isLine
@@ -29,6 +39,6 @@ const Tab = ({ value, children, icon, count, isDisabled }) => {
29
39
  ? { borderLeft: "0.125rem solid", borderLeftColor: (_c = style.indicator) !== null && _c !== void 0 ? _c : "transparent" }
30
40
  : { borderBottom: "0.125rem solid", borderBottomColor: (_d = style.indicator) !== null && _d !== void 0 ? _d : "transparent" }
31
41
  : {};
32
- return (_jsxs(Box, { as: "button", type: "button", ref: ref, role: "tab", id: tabId(ctx.baseId, value), "aria-selected": isSelected, "aria-disabled": isDisabled || undefined, "aria-controls": ctx.hasPanels ? panelId(ctx.baseId, value) : undefined, "data-value": value, tabIndex: isDisabled ? -1 : isFocusTarget ? 0 : -1, disabled: isDisabled, onClick: () => !isDisabled && ctx.select(value), onFocus: () => ctx.focusTab(value), display: "flex", alignItems: "center", justifyContent: "center", gap: "0.375rem", flexShrink: 0, flex: ctx.isFitted ? 1 : undefined, w: isVertical ? "100%" : undefined, h: isVertical ? "auto" : spec.height, minH: spec.height, py: isVertical ? "0.5rem" : undefined, px: spec.paddingX, fontSize: spec.fontSize, fontWeight: isSelected ? 600 : 500, whiteSpace: "nowrap", cursor: isDisabled ? "not-allowed" : "pointer", opacity: isDisabled ? 0.5 : 1, borderRadius: isLine ? "none" : "lg", bg: style.bg, color: style.color, ...borderProps, transition: transitionFor(["background-color", "color", "border-color"]), sx: { ...focusVisibleStyles(colors), ...reducedMotionSx() }, _hover: !isDisabled ? { bg: style.hoverBg, color: style.hoverColor } : undefined, children: [icon ? (_jsx(Box, { as: "span", "aria-hidden": true, display: "inline-flex", flexShrink: 0, boxSize: `${spec.iconSize}px`, children: icon })) : null, _jsx(Box, { as: "span", children: children }), count !== undefined ? (_jsx(CountBadge, { count: count, colors: colors, scale: scale, surface: ctx.variant === "solid" && isSelected ? style.bg : canvas, size: ctx.size })) : null] }));
42
+ return (_jsxs(Box, { as: "button", type: "button", ref: ref, role: "tab", id: tabId(ctx.baseId, value), "aria-selected": isSelected, "aria-disabled": isDisabled || undefined, "aria-controls": ctx.hasPanels ? panelId(ctx.baseId, value) : undefined, "data-value": value, tabIndex: isDisabled ? -1 : isFocusTarget ? 0 : -1, disabled: isDisabled, onClick: () => !isDisabled && ctx.select(value), onFocus: () => ctx.focusTab(value), display: "flex", alignItems: "center", justifyContent: "center", gap: "0.375rem", flexShrink: 0, flex: ctx.isFitted ? 1 : undefined, w: isVertical ? "100%" : undefined, h: isVertical ? "auto" : spec.height, minH: spec.height, py: isVertical ? "0.5rem" : undefined, px: spec.paddingX, fontSize: spec.fontSize, fontWeight: isSelected ? 600 : 500, whiteSpace: "nowrap", cursor: isDisabled ? "not-allowed" : "pointer", opacity: isDisabled ? 0.5 : 1, borderRadius: isLine ? "none" : "lg", bg: style.bg, color: style.color, ...borderProps, transition: transitionFor(["background-color", "color", "border-color"]), sx: { _focusVisible: focusRing, [FOCUS_VISIBLE_OVER_STATE]: focusRing, ...reducedMotionSx() }, _hover: !isDisabled ? { bg: style.hoverBg, color: style.hoverColor } : undefined, children: [icon ? (_jsx(Box, { as: "span", "aria-hidden": true, display: "inline-flex", flexShrink: 0, boxSize: `${spec.iconSize}px`, children: icon })) : null, _jsx(Box, { as: "span", children: children }), count !== undefined ? (_jsx(CountBadge, { count: count, colors: colors, scale: scale, surface: ctx.variant === "solid" && isSelected ? style.bg : canvas, size: ctx.size })) : null] }));
33
43
  };
34
44
  export default Tab;