pixelize-design-library 2.4.2-beta.34 → 2.4.2-beta.36

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 (93) hide show
  1. package/dist/Components/AppSwitcher/AppSwitcher.js +12 -49
  2. package/dist/Components/ButtonGroupIcon/ButtonGroupIcon.js +1 -3
  3. package/dist/Components/Common/fieldStyles.js +1 -1
  4. package/dist/Components/CopyButton/CopyButton.js +7 -6
  5. package/dist/Components/DatePicker/CalendarPanel.js +8 -5
  6. package/dist/Components/DatePicker/RangeDatePicker.js +27 -3
  7. package/dist/Components/DatePicker/SingleDatePicker.js +48 -14
  8. package/dist/Components/DatePicker/TimeOnlyPicker.js +7 -1
  9. package/dist/Components/DatePicker/TimePicker.js +3 -3
  10. package/dist/Components/DatePicker/TimePickerInput.js +1 -1
  11. package/dist/Components/Dropdown/DropDown.js +19 -6
  12. package/dist/Components/EmptyState/EmptyState.js +1 -1
  13. package/dist/Components/FileUpload/FileUpload.js +2 -2
  14. package/dist/Components/FilterSidebar/FilterSidebar.js +5 -5
  15. package/dist/Components/FilterSidebar/filterHoverStyle.d.ts +2 -1
  16. package/dist/Components/FilterSidebar/filterHoverStyle.js +3 -4
  17. package/dist/Components/Input/TextInput.styles.js +2 -2
  18. package/dist/Components/InputTextArea/InputTextArea.style.js +2 -2
  19. package/dist/Components/MoreItems/MoreItems.js +3 -1
  20. package/dist/Components/MultiSelect/MultiSelect.js +2 -2
  21. package/dist/Components/NavigationBar/NavigationBar.js +6 -7
  22. package/dist/Components/NumberInput/NumberInput.styles.js +2 -2
  23. package/dist/Components/OrgSwitcher/OrgSwitcher.js +14 -10
  24. package/dist/Components/PdfViewer/PdfViewer.js +4 -4
  25. package/dist/Components/RolesPermission/RolesPermission.js +4 -3
  26. package/dist/Components/SearchSelect/SearchSelect.js +46 -41
  27. package/dist/Components/SegmentedControl/SegmentedControl.d.ts +1 -1
  28. package/dist/Components/SegmentedControl/SegmentedControl.js +40 -10
  29. package/dist/Components/SegmentedControl/SegmentedControlProps.d.ts +3 -0
  30. package/dist/Components/Select/Select.styles.js +1 -1
  31. package/dist/Components/SelectSearch/SelectSearch.js +35 -17
  32. package/dist/Components/SelectV2/SelectV2.js +3 -0
  33. package/dist/Components/Table/TableProps.d.ts +2 -0
  34. package/dist/Components/Table/components/TableBody.js +7 -10
  35. package/dist/Components/Table/filters/CompactSelect.js +29 -8
  36. package/dist/Components/Table/settings/ManageColumns.js +5 -3
  37. package/dist/Components/Table/settings/TableSettings.js +4 -2
  38. package/dist/Components/Toggle/TableToggle.js +68 -18
  39. package/dist/Components/Toggle/TableToggleProps.d.ts +3 -0
  40. package/dist/Components/ToggleSwitch/ToggleSwitch.js +1 -1
  41. package/dist/Components/Trail/EditableCell.js +1 -1
  42. package/dist/Components/UserDetails/DeactivateConfirmModal.js +1 -1
  43. package/dist/Components/UserDetails/UserDetails.js +5 -3
  44. package/dist/Hooks/exclusiveOverlay.d.ts +4 -0
  45. package/dist/Hooks/exclusiveOverlay.js +22 -0
  46. package/dist/Hooks/useExclusiveOverlay.d.ts +5 -0
  47. package/dist/Hooks/useExclusiveOverlay.js +24 -0
  48. package/dist/Theme/chakra/Menu.styles.js +4 -2
  49. package/dist/Utils/table.d.ts +3 -0
  50. package/dist/Utils/table.js +44 -1
  51. package/dist/esm/Components/AppSwitcher/AppSwitcher.js +13 -50
  52. package/dist/esm/Components/ButtonGroupIcon/ButtonGroupIcon.js +1 -3
  53. package/dist/esm/Components/Common/fieldStyles.js +1 -1
  54. package/dist/esm/Components/CopyButton/CopyButton.js +7 -6
  55. package/dist/esm/Components/DatePicker/CalendarPanel.js +9 -6
  56. package/dist/esm/Components/DatePicker/RangeDatePicker.js +28 -4
  57. package/dist/esm/Components/DatePicker/SingleDatePicker.js +49 -15
  58. package/dist/esm/Components/DatePicker/TimeOnlyPicker.js +7 -1
  59. package/dist/esm/Components/DatePicker/TimePicker.js +3 -3
  60. package/dist/esm/Components/DatePicker/TimePickerInput.js +1 -1
  61. package/dist/esm/Components/Dropdown/DropDown.js +20 -7
  62. package/dist/esm/Components/EmptyState/EmptyState.js +1 -1
  63. package/dist/esm/Components/FileUpload/FileUpload.js +2 -2
  64. package/dist/esm/Components/FilterSidebar/FilterSidebar.js +5 -5
  65. package/dist/esm/Components/FilterSidebar/filterHoverStyle.js +3 -4
  66. package/dist/esm/Components/Input/TextInput.styles.js +2 -2
  67. package/dist/esm/Components/InputTextArea/InputTextArea.style.js +2 -2
  68. package/dist/esm/Components/MoreItems/MoreItems.js +3 -1
  69. package/dist/esm/Components/MultiSelect/MultiSelect.js +2 -2
  70. package/dist/esm/Components/NavigationBar/NavigationBar.js +6 -7
  71. package/dist/esm/Components/NumberInput/NumberInput.styles.js +2 -2
  72. package/dist/esm/Components/OrgSwitcher/OrgSwitcher.js +14 -10
  73. package/dist/esm/Components/PdfViewer/PdfViewer.js +4 -4
  74. package/dist/esm/Components/RolesPermission/RolesPermission.js +4 -3
  75. package/dist/esm/Components/SearchSelect/SearchSelect.js +46 -41
  76. package/dist/esm/Components/SegmentedControl/SegmentedControl.js +42 -12
  77. package/dist/esm/Components/Select/Select.styles.js +1 -1
  78. package/dist/esm/Components/SelectSearch/SelectSearch.js +35 -17
  79. package/dist/esm/Components/SelectV2/SelectV2.js +3 -0
  80. package/dist/esm/Components/Table/components/TableBody.js +7 -10
  81. package/dist/esm/Components/Table/filters/CompactSelect.js +29 -8
  82. package/dist/esm/Components/Table/settings/ManageColumns.js +5 -3
  83. package/dist/esm/Components/Table/settings/TableSettings.js +5 -3
  84. package/dist/esm/Components/Toggle/TableToggle.js +67 -17
  85. package/dist/esm/Components/ToggleSwitch/ToggleSwitch.js +1 -1
  86. package/dist/esm/Components/Trail/EditableCell.js +1 -1
  87. package/dist/esm/Components/UserDetails/DeactivateConfirmModal.js +1 -1
  88. package/dist/esm/Components/UserDetails/UserDetails.js +5 -3
  89. package/dist/esm/Hooks/exclusiveOverlay.js +16 -0
  90. package/dist/esm/Hooks/useExclusiveOverlay.js +20 -0
  91. package/dist/esm/Theme/chakra/Menu.styles.js +4 -2
  92. package/dist/esm/Utils/table.js +45 -3
  93. package/package.json +1 -1
@@ -27,7 +27,7 @@ const EmptyState = ({ title = "No data found", description, icon: IconComp = luc
27
27
  const accentSoft = palette[50];
28
28
  const accent = (0, accentText_1.accentTextOnCanvas)(palette, accentSoft);
29
29
  const containerStyles = variant === "subtle"
30
- ? { bg: theme.colors.gray[50], borderRadius: "2xl" }
30
+ ? { bg: theme.colors.background[50], borderRadius: "2xl" }
31
31
  : variant === "dashed"
32
32
  ? {
33
33
  border: "2px dashed",
@@ -49,7 +49,7 @@ const FileUpload = ({ onFilesUploaded, uploadedFiles, onRemoveFile, acceptTypes
49
49
  const [previewUrl, setPreviewUrl] = react_1.default.useState(null);
50
50
  const [previewTitle, setPreviewTitle] = react_1.default.useState(null);
51
51
  const [errors, setErrors] = react_1.default.useState([]);
52
- const bg = colors.gray[50];
52
+ const bg = colors.background[50];
53
53
  const border = colors.boxborder[500];
54
54
  const mappedAccept = acceptTypes.reduce((acc, ext) => {
55
55
  const mime = constants_1.mimeMap[ext];
@@ -89,7 +89,7 @@ const FileUpload = ({ onFilesUploaded, uploadedFiles, onRemoveFile, acceptTypes
89
89
  setErrors(messages);
90
90
  },
91
91
  });
92
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.VStack, { spacing: 4, align: "stretch", children: [(0, jsx_runtime_1.jsxs)(react_2.Box, { ...getRootProps(), border: "2px dashed", borderColor: border, borderRadius: "md", p: compact ? 3 : 10, textAlign: "center", bg: bg, cursor: "pointer", transition: "all 0.2s", _hover: { bg: colors.gray[100] }, position: "relative", children: [(0, jsx_runtime_1.jsx)("input", { ...getInputProps({ "aria-label": inputAriaLabel }) }), (0, jsx_runtime_1.jsxs)(react_2.Stack, { direction: compact ? "row" : "column", spacing: compact ? 3 : 2, align: "center", justify: "center", children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.Upload, boxSize: compact ? 4 : 6 }), (0, jsx_runtime_1.jsxs)(react_2.Stack, { spacing: 0, align: compact ? "start" : "center", children: [(0, jsx_runtime_1.jsx)(react_2.Text, { fontWeight: "medium", fontSize: compact ? "sm" : "md", color: colors.textMuted, children: "Drag and drop files here" }), (0, jsx_runtime_1.jsxs)(react_2.Text, { fontSize: compact ? "xs" : "sm", color: colors.textMuted, children: [acceptTypes.join(", "), " up to ", (0, constants_1.toMB)(maxSizeKB), " ", maxFiles ? `- ${maxFiles} file(s) max` : ""] })] })] })] }), errors.length > 0 && ((0, jsx_runtime_1.jsx)(react_2.Box, { children: errors.map((err, idx) => ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "sm", color: colors.semanticText.error, children: err }, idx))) })), uploadedFiles.length > 0 && ((0, jsx_runtime_1.jsxs)(react_2.Box, { children: [(0, jsx_runtime_1.jsx)(react_2.Box, { display: "flex", alignItems: "center", gap: 2, children: (0, jsx_runtime_1.jsx)(react_2.Text, { fontFamily: "open-sans, sans-serif", fontWeight: 600, fontSize: 14, lineHeight: "100%", letterSpacing: "4%", textTransform: "uppercase", py: 4, children: "Uploaded Files" }) }), (0, jsx_runtime_1.jsx)(react_2.List, { spacing: 2, children: uploadedFiles.map((file, index) => ((0, jsx_runtime_1.jsxs)(react_2.Box, { borderWidth: "0.063rem", borderRadius: "md", px: 3, py: 2, bg: colors.background[50], children: [(0, jsx_runtime_1.jsxs)(react_2.ListItem, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(react_2.HStack, { spacing: 3, flex: "1", children: [file.type.startsWith("image/") ? ((0, jsx_runtime_1.jsxs)(react_2.Box, { boxSize: "2.5rem", cursor: "pointer", position: "relative", _hover: {
92
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.VStack, { spacing: 4, align: "stretch", children: [(0, jsx_runtime_1.jsxs)(react_2.Box, { ...getRootProps(), border: "2px dashed", borderColor: border, borderRadius: "md", p: compact ? 3 : 10, textAlign: "center", bg: bg, cursor: "pointer", transition: "all 0.2s", _hover: { bg: colors.background[100] }, position: "relative", children: [(0, jsx_runtime_1.jsx)("input", { ...getInputProps({ "aria-label": inputAriaLabel }) }), (0, jsx_runtime_1.jsxs)(react_2.Stack, { direction: compact ? "row" : "column", spacing: compact ? 3 : 2, align: "center", justify: "center", children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.Upload, boxSize: compact ? 4 : 6 }), (0, jsx_runtime_1.jsxs)(react_2.Stack, { spacing: 0, align: compact ? "start" : "center", children: [(0, jsx_runtime_1.jsx)(react_2.Text, { fontWeight: "medium", fontSize: compact ? "sm" : "md", color: colors.textMuted, children: "Drag and drop files here" }), (0, jsx_runtime_1.jsxs)(react_2.Text, { fontSize: compact ? "xs" : "sm", color: colors.textMuted, children: [acceptTypes.join(", "), " up to ", (0, constants_1.toMB)(maxSizeKB), " ", maxFiles ? `- ${maxFiles} file(s) max` : ""] })] })] })] }), errors.length > 0 && ((0, jsx_runtime_1.jsx)(react_2.Box, { children: errors.map((err, idx) => ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "sm", color: colors.semanticText.error, children: err }, idx))) })), uploadedFiles.length > 0 && ((0, jsx_runtime_1.jsxs)(react_2.Box, { children: [(0, jsx_runtime_1.jsx)(react_2.Box, { display: "flex", alignItems: "center", gap: 2, children: (0, jsx_runtime_1.jsx)(react_2.Text, { fontFamily: "open-sans, sans-serif", fontWeight: 600, fontSize: 14, lineHeight: "100%", letterSpacing: "4%", textTransform: "uppercase", py: 4, children: "Uploaded Files" }) }), (0, jsx_runtime_1.jsx)(react_2.List, { spacing: 2, children: uploadedFiles.map((file, index) => ((0, jsx_runtime_1.jsxs)(react_2.Box, { borderWidth: "0.063rem", borderRadius: "md", px: 3, py: 2, bg: colors.background[50], children: [(0, jsx_runtime_1.jsxs)(react_2.ListItem, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(react_2.HStack, { spacing: 3, flex: "1", children: [file.type.startsWith("image/") ? ((0, jsx_runtime_1.jsxs)(react_2.Box, { boxSize: "2.5rem", cursor: "pointer", position: "relative", _hover: {
93
93
  ".hover-icon": {
94
94
  opacity: 1,
95
95
  bg: "blackAlpha.500",
@@ -149,13 +149,13 @@ panelPadding = 3, clearAllButton = true, onClearAllHandler,
149
149
  pointerEvents: 'none', // Allow clicks to pass through track
150
150
  zIndex: 3,
151
151
  margin: 0,
152
- } })] }), (0, jsx_runtime_1.jsxs)(react_2.SimpleGrid, { columns: 2, spacing: 2, pt: 2, w: "full", children: [(0, jsx_runtime_1.jsxs)(react_2.Popover, { isOpen: openPrice.id === section.id && openPrice.target === "min", onClose: () => setOpenPrice({}), placement: "bottom-start", closeOnBlur: true, children: [(0, jsx_runtime_1.jsx)(react_2.PopoverTrigger, { children: (0, jsx_runtime_1.jsx)(react_2.Flex, { borderWidth: "0", borderRadius: "md", alignItems: "center", px: 3, py: 2, bg: theme.colors.gray[50], borderColor: theme.colors.boxborder[500], cursor: "pointer", onClick: () => setOpenPrice({ id: section.id, target: "min" }), gap: 2, overflow: "hidden", children: (0, jsx_runtime_1.jsx)(react_2.Box, { ml: "auto", children: (0, jsx_runtime_1.jsxs)(react_2.Text, { fontSize: "12px", color: theme.colors.text[500], whiteSpace: "nowrap", children: [currentMin, range.unit ? ` ${range.unit}` : ""] }) }) }) }), (0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsx)(react_2.PopoverContent, { width: "6rem", p: 0, zIndex: 1600, bg: theme.colors.background[50], children: (0, jsx_runtime_1.jsx)(react_2.PopoverBody, { p: 0, children: (0, jsx_runtime_1.jsx)(react_2.VStack, { align: "stretch", spacing: 0, maxH: "12rem", overflowY: "auto", children: values.map((v) => ((0, jsx_runtime_1.jsxs)(react_2.Flex, { px: 2, py: 1, align: "center", justify: "space-between", cursor: "pointer", bg: currentMin === v ? theme.colors.red[50] : theme.colors.background[50], borderLeftWidth: currentMin === v ? 3 : 0, borderLeftStyle: "solid", borderLeftColor: currentMin === v ? theme.colors.red[400] : "transparent", _hover: { bg: hoverBg }, onClick: () => {
152
+ } })] }), (0, jsx_runtime_1.jsxs)(react_2.SimpleGrid, { columns: 2, spacing: 2, pt: 2, w: "full", children: [(0, jsx_runtime_1.jsxs)(react_2.Popover, { isOpen: openPrice.id === section.id && openPrice.target === "min", onClose: () => setOpenPrice({}), placement: "bottom-start", closeOnBlur: true, children: [(0, jsx_runtime_1.jsx)(react_2.PopoverTrigger, { children: (0, jsx_runtime_1.jsx)(react_2.Flex, { borderWidth: "0", borderRadius: "md", alignItems: "center", px: 3, py: 2, bg: theme.colors.background[50], borderColor: theme.colors.boxborder[500], cursor: "pointer", onClick: () => setOpenPrice({ id: section.id, target: "min" }), gap: 2, overflow: "hidden", children: (0, jsx_runtime_1.jsx)(react_2.Box, { ml: "auto", children: (0, jsx_runtime_1.jsxs)(react_2.Text, { fontSize: "12px", color: theme.colors.text[500], whiteSpace: "nowrap", children: [currentMin, range.unit ? ` ${range.unit}` : ""] }) }) }) }), (0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsx)(react_2.PopoverContent, { width: "6rem", p: 0, zIndex: 1600, bg: theme.colors.background[50], children: (0, jsx_runtime_1.jsx)(react_2.PopoverBody, { p: 0, children: (0, jsx_runtime_1.jsx)(react_2.VStack, { align: "stretch", spacing: 0, maxH: "12rem", overflowY: "auto", children: values.map((v) => ((0, jsx_runtime_1.jsxs)(react_2.Flex, { px: 2, py: 1, align: "center", justify: "space-between", cursor: "pointer", bg: currentMin === v ? theme.colors.red[50] : theme.colors.background[50], borderLeftWidth: currentMin === v ? 3 : 0, borderLeftStyle: "solid", borderLeftColor: currentMin === v ? theme.colors.red[400] : "transparent", _hover: { bg: hoverBg }, onClick: () => {
153
153
  const min = v;
154
154
  const max = currentMax;
155
155
  const nextVal = [Math.min(min, max), Math.max(min, max)];
156
156
  setInternalSelected((prev) => { const next = { ...prev, [section.id]: nextVal }; onChange === null || onChange === void 0 ? void 0 : onChange(next); return next; });
157
157
  setOpenPrice({});
158
- }, children: [(0, jsx_runtime_1.jsxs)(react_2.Text, { fontSize: "sm", color: theme.colors.gray[800], children: [v, range.unit ? ` ${range.unit}` : ""] }), currentMin === v ? ((0, jsx_runtime_1.jsx)(react_2.Box, { bg: theme.colors.red[100], borderRadius: "full", p: 1, display: "flex", alignItems: "center", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { size: 9, color: (0, accentText_1.onFilled)(theme.colors.red[100], theme.colors.white, theme.colors.black) }) })) : null] }, `min-${v}`))) }) }) }) })] }), (0, jsx_runtime_1.jsxs)(react_2.Popover, { isOpen: openPrice.id === section.id && openPrice.target === "max", onClose: () => setOpenPrice({}), placement: "bottom-start", closeOnBlur: true, children: [(0, jsx_runtime_1.jsx)(react_2.PopoverTrigger, { children: (0, jsx_runtime_1.jsx)(react_2.Flex, { borderWidth: "0", borderRadius: "md", alignItems: "center", px: 3, py: 2, bg: theme.colors.gray[50], borderColor: theme.colors.boxborder[500], cursor: "pointer", onClick: () => setOpenPrice({ id: section.id, target: "max" }), gap: 2, overflow: "hidden", children: (0, jsx_runtime_1.jsx)(react_2.Box, { ml: "auto", children: (0, jsx_runtime_1.jsxs)(react_2.Text, { fontSize: "12px", color: theme.colors.text[500], whiteSpace: "nowrap", children: [currentMax, range.unit ? ` ${range.unit}` : ""] }) }) }) }), (0, jsx_runtime_1.jsx)(react_2.PopoverContent, { width: "6rem", p: 0, bg: theme.colors.background[50], children: (0, jsx_runtime_1.jsx)(react_2.PopoverBody, { p: 0, children: (0, jsx_runtime_1.jsx)(react_2.VStack, { align: "stretch", spacing: 0, maxH: "12rem", overflowY: "auto", children: values.map((v) => ((0, jsx_runtime_1.jsxs)(react_2.Flex, { px: 2, py: 1, align: "center", justify: "space-between", cursor: "pointer", bg: currentMax === v ? theme.colors.red[50] : theme.colors.background[50], borderLeftWidth: currentMax === v ? 3 : 0, borderLeftStyle: "solid", borderLeftColor: currentMax === v ? theme.colors.red[400] : "transparent", _hover: { bg: hoverBg }, onClick: () => {
158
+ }, children: [(0, jsx_runtime_1.jsxs)(react_2.Text, { fontSize: "sm", color: theme.colors.gray[800], children: [v, range.unit ? ` ${range.unit}` : ""] }), currentMin === v ? ((0, jsx_runtime_1.jsx)(react_2.Box, { bg: theme.colors.red[100], borderRadius: "full", p: 1, display: "flex", alignItems: "center", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { size: 9, color: (0, accentText_1.onFilled)(theme.colors.red[100], theme.colors.white, theme.colors.black) }) })) : null] }, `min-${v}`))) }) }) }) })] }), (0, jsx_runtime_1.jsxs)(react_2.Popover, { isOpen: openPrice.id === section.id && openPrice.target === "max", onClose: () => setOpenPrice({}), placement: "bottom-start", closeOnBlur: true, children: [(0, jsx_runtime_1.jsx)(react_2.PopoverTrigger, { children: (0, jsx_runtime_1.jsx)(react_2.Flex, { borderWidth: "0", borderRadius: "md", alignItems: "center", px: 3, py: 2, bg: theme.colors.background[50], borderColor: theme.colors.boxborder[500], cursor: "pointer", onClick: () => setOpenPrice({ id: section.id, target: "max" }), gap: 2, overflow: "hidden", children: (0, jsx_runtime_1.jsx)(react_2.Box, { ml: "auto", children: (0, jsx_runtime_1.jsxs)(react_2.Text, { fontSize: "12px", color: theme.colors.text[500], whiteSpace: "nowrap", children: [currentMax, range.unit ? ` ${range.unit}` : ""] }) }) }) }), (0, jsx_runtime_1.jsx)(react_2.PopoverContent, { width: "6rem", p: 0, bg: theme.colors.background[50], children: (0, jsx_runtime_1.jsx)(react_2.PopoverBody, { p: 0, children: (0, jsx_runtime_1.jsx)(react_2.VStack, { align: "stretch", spacing: 0, maxH: "12rem", overflowY: "auto", children: values.map((v) => ((0, jsx_runtime_1.jsxs)(react_2.Flex, { px: 2, py: 1, align: "center", justify: "space-between", cursor: "pointer", bg: currentMax === v ? theme.colors.red[50] : theme.colors.background[50], borderLeftWidth: currentMax === v ? 3 : 0, borderLeftStyle: "solid", borderLeftColor: currentMax === v ? theme.colors.red[400] : "transparent", _hover: { bg: hoverBg }, onClick: () => {
159
159
  const max = v;
160
160
  const min = currentMin;
161
161
  const nextVal = [Math.min(min, max), Math.max(min, max)];
@@ -174,7 +174,7 @@ panelPadding = 3, clearAllButton = true, onClearAllHandler,
174
174
  const isRowSelected = String(internalSelected[section.id] || "") === String(r);
175
175
  const starColor = (0, accentText_1.accentTextOnCanvas)(theme.colors.orange, isRowSelected ? theme.colors.red[50] : theme.colors.background[50]);
176
176
  return Array.from({ length: 5 }, (_, i) => ((0, jsx_runtime_1.jsx)(react_2.Box, { children: (0, jsx_runtime_1.jsx)(lucide_react_1.Star, { size: 16, color: starColor, fill: i < r ? starColor : "none" }) }, `star-${r}-${i}`)));
177
- })() }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "sm", color: theme.colors.text[500], children: "& Up" })] }) }, `rating-${r}`))) })) : null, section.searchable && ((0, jsx_runtime_1.jsx)(react_2.Input, { size: "xs", h: "26px", fontSize: "xs", placeholder: `Search ${section.label}...`, borderRadius: "md", bg: theme.colors.gray[50], border: "1px solid",
177
+ })() }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "sm", color: theme.colors.text[500], children: "& Up" })] }) }, `rating-${r}`))) })) : null, section.searchable && ((0, jsx_runtime_1.jsx)(react_2.Input, { size: "xs", h: "26px", fontSize: "xs", placeholder: `Search ${section.label}...`, borderRadius: "md", bg: theme.colors.background[50], border: "1px solid",
178
178
  // boxborder[500], not raw gray[200]: WCAG 1.4.11 needs >=3.0 for a control
179
179
  // boundary against any named surface up to `muted` (lightest); gray[200] fails
180
180
  // there in dark mode.
@@ -233,7 +233,7 @@ panelPadding = 3, clearAllButton = true, onClearAllHandler,
233
233
  : {
234
234
  justifyContent: "space-between",
235
235
  padding: 0,
236
- background: theme.colors.gray[50],
236
+ background: theme.colors.background[50],
237
237
  borderRadius: theme.radii.lg,
238
238
  border: `1px solid ${theme.colors.gray[200]}`,
239
239
  marginBottom: 6,
@@ -254,6 +254,6 @@ panelPadding = 3, clearAllButton = true, onClearAllHandler,
254
254
  },
255
255
  },
256
256
  }));
257
- return ((0, jsx_runtime_1.jsxs)(react_2.Box, { w: width, bg: variant === "minimal" ? theme.colors.background[50] : theme.colors.gray[50], p: containerPadding !== undefined ? containerPadding : (variant === "minimal" ? 3 : 2), borderRadius: variant === "minimal" ? "lg" : "none", boxShadow: variant === "minimal" ? "sm" : "none", border: variant === "minimal" ? `1px solid ${theme.colors.gray[200]}` : "none", h: "fit-content", maxH: containerHeight !== undefined ? containerHeight : undefined, overflowY: containerHeight !== undefined ? "auto" : "visible", children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { className: "filters-header", align: "center", justify: "space-between", mb: 2, borderBottom: "2px solid", borderColor: theme.colors.gray[100], children: [(0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "lg", fontWeight: "bold", color: theme.colors.text[500], children: "Filters" }), activeCount > 0 && clearAllButton && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(react_2.Button, { size: "xs", variant: "outline", leftIcon: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { size: 12 }), onClick: clearAll, "aria-label": "Clear All", className: "clear-all-btn", colorScheme: "red", children: "Clear All" }) }))] }), (0, jsx_runtime_1.jsx)(Accordion_1.default, { allowMultiple: true, defaultIndex: sidebarOptions.map((_, i) => i), items: items })] }));
257
+ return ((0, jsx_runtime_1.jsxs)(react_2.Box, { w: width, bg: theme.colors.background[50], p: containerPadding !== undefined ? containerPadding : (variant === "minimal" ? 3 : 2), borderRadius: variant === "minimal" ? "lg" : "none", boxShadow: variant === "minimal" ? "sm" : "none", border: variant === "minimal" ? `1px solid ${theme.colors.gray[200]}` : "none", h: "fit-content", maxH: containerHeight !== undefined ? containerHeight : undefined, overflowY: containerHeight !== undefined ? "auto" : "visible", children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { className: "filters-header", align: "center", justify: "space-between", mb: 2, borderBottom: "2px solid", borderColor: theme.colors.gray[100], children: [(0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "lg", fontWeight: "bold", color: theme.colors.text[500], children: "Filters" }), activeCount > 0 && clearAllButton && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(react_2.Button, { size: "xs", variant: "outline", leftIcon: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { size: 12 }), onClick: clearAll, "aria-label": "Clear All", className: "clear-all-btn", colorScheme: "red", children: "Clear All" }) }))] }), (0, jsx_runtime_1.jsx)(Accordion_1.default, { allowMultiple: true, defaultIndex: sidebarOptions.map((_, i) => i), items: items })] }));
258
258
  };
259
259
  exports.default = FilterSidebar;
@@ -1,2 +1,3 @@
1
1
  import type { PaletteProps } from "../../Theme/tokens/types";
2
- export declare const getFilterHoverBg: (colors: PaletteProps, isDark: boolean) => string;
2
+ /** Shared with every selectable list row — never seed from `primary[500]` or `primary.opacity[8]`. */
3
+ export declare const getFilterHoverBg: (colors: PaletteProps, _isDark: boolean) => string;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFilterHoverBg = void 0;
4
- const outlineRung_1 = require("../../Theme/tokens/builders/outlineRung");
5
- const accentText_1 = require("../../Theme/tokens/builders/accentText");
6
- // The fill itself must clear AA against `text[500]`, the only ink these rows ever use.
7
- const getFilterHoverBg = (colors, isDark) => isDark ? (0, outlineRung_1.liftToContrast)(colors.gray[300], colors.text[500], accentText_1.AA_NORMAL_TEXT) : colors.gray[50];
4
+ const rowStates_1 = require("../../Theme/tokens/builders/rowStates");
5
+ /** Shared with every selectable list row — never seed from `primary[500]` or `primary.opacity[8]`. */
6
+ const getFilterHoverBg = (colors, _isDark) => (0, rowStates_1.listRowBackgrounds)(colors).active;
8
7
  exports.getFilterHoverBg = getFilterHoverBg;
@@ -50,7 +50,7 @@ exports.Input = {
50
50
  const primary = theme.colors.primary[500];
51
51
  return {
52
52
  field: {
53
- bg: theme.colors.gray[50],
53
+ bg: theme.colors.background[50],
54
54
  border: "0.063rem solid",
55
55
  borderColor,
56
56
  _placeholder: {
@@ -84,7 +84,7 @@ exports.Input = {
84
84
  boxShadow: 'inherit',
85
85
  },
86
86
  _disabled: {
87
- bg: theme.colors.gray[100],
87
+ bg: theme.colors.background[100],
88
88
  opacity: 1,
89
89
  cursor: "not-allowed",
90
90
  _hover: {
@@ -32,7 +32,7 @@ exports.Textarea = {
32
32
  return {
33
33
  border: "0.063rem solid",
34
34
  borderColor,
35
- bg: theme.colors.gray[50],
35
+ bg: theme.colors.background[50],
36
36
  _placeholder: {
37
37
  color: (0, placeholderInk_1.placeholderInk)(theme.colors),
38
38
  },
@@ -62,7 +62,7 @@ exports.Textarea = {
62
62
  boxShadow: 'inherit',
63
63
  },
64
64
  _disabled: {
65
- bg: theme.colors.gray[100],
65
+ bg: theme.colors.background[100],
66
66
  opacity: 1,
67
67
  cursor: "not-allowed",
68
68
  _hover: {
@@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const jsx_runtime_1 = require("react/jsx-runtime");
4
4
  const react_1 = require("@chakra-ui/react");
5
5
  const useCustomTheme_1 = require("../../Theme/useCustomTheme");
6
+ const rowStates_1 = require("../../Theme/tokens/builders/rowStates");
6
7
  const MoreItems = ({ items, moreCount, triggerText, colorResolver, hideDots = false, columns = 2, minWidth = "260px", triggerMaxWidth = "250px", trigger = "hover", placement = "bottom-start", }) => {
7
8
  const theme = (0, useCustomTheme_1.useCustomTheme)();
9
+ const countBadgeBg = (0, rowStates_1.listRowBackgrounds)(theme.colors).selected;
8
10
  const count = moreCount !== null && moreCount !== void 0 ? moreCount : items.length;
9
11
  if (count <= 0)
10
12
  return triggerText ? (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: triggerText }) : null;
11
- return ((0, jsx_runtime_1.jsxs)(react_1.Popover, { trigger: trigger, placement: placement, isLazy: true, children: [(0, jsx_runtime_1.jsx)(react_1.PopoverTrigger, { children: (0, jsx_runtime_1.jsxs)(react_1.Box, { display: "inline-flex", alignItems: "center", maxW: triggerMaxWidth, cursor: "pointer", children: [triggerText !== undefined && ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "span", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: triggerText })), (0, jsx_runtime_1.jsxs)(react_1.Box, { as: "span", ml: "6px", px: "8px", py: "1px", fontSize: "12px", fontWeight: 600, lineHeight: "1.4", borderRadius: "full", color: theme.colors.accentText, bg: theme.colors.primary[50], transition: "all 0.15s ease", _hover: { bg: theme.colors.primary[100] }, children: ["+", count, " more"] })] }) }), (0, jsx_runtime_1.jsxs)(react_1.PopoverContent, { width: "auto", minWidth: minWidth, maxH: "280px", overflowY: "auto", borderRadius: "xl",
13
+ return ((0, jsx_runtime_1.jsxs)(react_1.Popover, { trigger: trigger, placement: placement, isLazy: true, children: [(0, jsx_runtime_1.jsx)(react_1.PopoverTrigger, { children: (0, jsx_runtime_1.jsxs)(react_1.Box, { display: "inline-flex", alignItems: "center", maxW: triggerMaxWidth, cursor: "pointer", children: [triggerText !== undefined && ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "span", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: triggerText })), (0, jsx_runtime_1.jsxs)(react_1.Box, { as: "span", ml: "6px", px: "8px", py: "1px", fontSize: "12px", fontWeight: 600, lineHeight: "1.4", borderRadius: "full", color: theme.colors.accentText, bg: countBadgeBg, transition: "all 0.15s ease", _hover: { bg: (0, rowStates_1.listRowBackgrounds)(theme.colors).selectedActive }, children: ["+", count, " more"] })] }) }), (0, jsx_runtime_1.jsxs)(react_1.PopoverContent, { width: "auto", minWidth: minWidth, maxH: "280px", overflowY: "auto", borderRadius: "xl",
12
14
  // Chakra defaults this surface to `colors.gray.700` in dark, which against the
13
15
  // swapped (dark-inverted) palette is a *light* grey — wrong for a popover bg. Pin it.
14
16
  bg: theme.colors.background[50], boxShadow: "lg", _focus: { outline: "none", boxShadow: "lg" }, children: [(0, jsx_runtime_1.jsx)(react_1.PopoverArrow, { bg: theme.colors.background[50] }), (0, jsx_runtime_1.jsx)(react_1.PopoverBody, { p: 3, children: (0, jsx_runtime_1.jsx)(react_1.SimpleGrid, { columns: columns, spacingX: 4, spacingY: 2, children: items === null || items === void 0 ? void 0 : items.map((item, index) => {
@@ -61,14 +61,14 @@ function MultiSelect({ value, onValueChange, width = "100%", label = "label", is
61
61
  // surface up to `muted` (lightest); [500] fails there, [800] clears all with margin.
62
62
  borderColor: error || localError
63
63
  ? theme.colors.semanticText.error
64
- : theme.colors.boxborder[500], borderRadius: "lg", bg: theme.colors.gray[50], minH: s.minH, transition: "border-color 0.2s, box-shadow 0.2s", _focusWithin: {
64
+ : theme.colors.boxborder[500], borderRadius: "lg", bg: theme.colors.background[50], minH: s.minH, transition: "border-color 0.2s, box-shadow 0.2s", _focusWithin: {
65
65
  borderColor: error || localError
66
66
  ? theme.colors.semanticText.error
67
67
  : theme.colors.primary[500],
68
68
  boxShadow: `0 0 0 0.125rem ${error || localError
69
69
  ? theme.colors.boxShadow.error
70
70
  : theme.colors.boxShadow.primary}`,
71
- }, children: [options.map((option) => ((0, jsx_runtime_1.jsx)(Tag_1.default, { size: s.tagSize, colorScheme: "primary", label: option.label, onIconClick: () => handleRemove(option), icon: lucide_react_1.X }, option.id))), (0, jsx_runtime_1.jsx)(react_2.Input, { ref: inputRef, type: "text", value: inputValue, isDisabled: isDisabled, isReadOnly: isReadOnly, id: id, name: name, size: size, variant: "unstyled", h: s.fieldHeight, minH: s.fieldHeight, fontSize: s.fieldFontSize, fontWeight: "500", color: theme.colors.gray[700], letterSpacing: "0.02em", flex: "1", minW: 0, style: {
71
+ }, children: [options.map((option) => ((0, jsx_runtime_1.jsx)(Tag_1.default, { size: s.tagSize, colorScheme: "primary", label: option.label, onIconClick: () => handleRemove(option), icon: lucide_react_1.X }, option.id))), (0, jsx_runtime_1.jsx)(react_2.Input, { ref: inputRef, type: "text", value: inputValue, isDisabled: isDisabled, isReadOnly: isReadOnly, id: id, name: name, size: size, variant: "unstyled", h: s.fieldHeight, minH: s.fieldHeight, fontSize: s.fieldFontSize, fontWeight: "500", color: theme.colors.text[700], letterSpacing: "0.02em", flex: "1", minW: 0, style: {
72
72
  backgroundColor: "transparent",
73
73
  ...inputStyle,
74
74
  }, onChange: handleInputChange, onKeyDown: handleKeyDown, placeholder: options.length === 0 ? placeholderText : "" })] }), (error || localError) && ((0, jsx_runtime_1.jsx)(ErrorMessage_1.default, { errorMessage: localError || errorMessage })), helperText && !error && (0, jsx_runtime_1.jsx)(HelperText_1.default, { helperText: helperText })] }));
@@ -6,17 +6,16 @@ const react_1 = require("@chakra-ui/react");
6
6
  const useCustomTheme_1 = require("../../Theme/useCustomTheme");
7
7
  const accentText_1 = require("../../Theme/tokens/builders/accentText");
8
8
  const outlineRung_1 = require("../../Theme/tokens/builders/outlineRung");
9
+ const rowStates_1 = require("../../Theme/tokens/builders/rowStates");
9
10
  const statusTone_1 = require("../../Theme/tokens/builders/statusTone");
10
11
  const lucide_react_1 = require("lucide-react");
11
12
  // Roomy enough to hover without aiming: the glyph is only 1.25rem.
12
13
  const SIDEBAR_TOGGLE_HIT = "2.5rem";
13
14
  function NavBar({ userAvathar, userName, userRole, navMenu, moreIcon, handleNavOnClick, handleLogout, logoutText, navigationBarText, sideBarToggole, onSideBarToggole, forceSideBarToggle = false, onSideBarPeek, }) {
14
15
  const theme = (0, useCustomTheme_1.useCustomTheme)();
15
- // For a near-neutral brand (e.g. zinc), `primary[50]` is itself a pale near-white tint — on
16
- // the menu's own near-white surface that measured as low as ~1.02:1, an invisible hover.
17
- const menuHoverBg = (0, outlineRung_1.resolveHoverTint)(theme.colors.primary[50], theme.colors.backgroundColor.light);
16
+ const rowBackgrounds = (0, rowStates_1.listRowBackgrounds)(theme.colors);
17
+ const menuHoverBg = rowBackgrounds.active;
18
18
  const barHoverBg = (0, outlineRung_1.resolveHoverTint)(theme.colors.gray[100], theme.colors.backgroundColor.light);
19
- const menuHoverInk = (0, accentText_1.accentTextOnCanvas)(theme.colors.primary, menuHoverBg);
20
19
  const dangerTone = (0, statusTone_1.resolveStatusTone)(theme.colors.semantic.error, (0, accentText_1.isDarkCanvas)(theme.colors.backgroundColor.main) ? "dark" : "light");
21
20
  // Shared rounded pill affordance for the bar's icon controls.
22
21
  const iconButtonStyle = {
@@ -44,9 +43,9 @@ function NavBar({ userAvathar, userName, userRole, navMenu, moreIcon, handleNavO
44
43
  color: theme.colors.text[900],
45
44
  gap: theme.space["2"],
46
45
  transition: "background 0.12s",
47
- _hover: { bg: menuHoverBg, color: menuHoverInk },
48
- _focus: { bg: menuHoverBg, color: menuHoverInk },
49
- _active: { bg: menuHoverBg, color: menuHoverInk },
46
+ _hover: { bg: menuHoverBg },
47
+ _focus: { bg: menuHoverBg },
48
+ _active: { bg: rowBackgrounds.selectedActive },
50
49
  };
51
50
  return ((0, jsx_runtime_1.jsx)(react_1.Box, { bg: theme.colors.backgroundColor.light, px: 4, borderBottom: "1px solid", borderColor: theme.colors.boxborder[200], children: (0, jsx_runtime_1.jsxs)(react_1.Flex, { h: 16, alignItems: "center", justifyContent: "space-between", children: [(0, jsx_runtime_1.jsxs)(react_1.Box, { display: "flex", gap: 1.5, alignItems: "center", children: [(0, jsx_runtime_1.jsx)(react_1.Box, { as: "button", type: "button", onClick: () => onSideBarToggole === null || onSideBarToggole === void 0 ? void 0 : onSideBarToggole(), onMouseEnter: onSideBarPeek, onFocus: onSideBarPeek, "aria-label": sideBarToggole ? "Close navigation menu" : "Open navigation menu", "aria-expanded": !!sideBarToggole, ...iconButtonStyle, display: forceSideBarToggle ? "flex" : { base: "flex", lg: "none" }, w: SIDEBAR_TOGGLE_HIT, h: SIDEBAR_TOGGLE_HIT, children: sideBarToggole ? ((0, jsx_runtime_1.jsx)(lucide_react_1.PanelLeftClose, { size: "1.25rem" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.PanelRightClose, { size: "1.25rem" })) }), (navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.onIconClick) && ((0, jsx_runtime_1.jsx)(react_1.Box, { ...iconButtonStyle, as: "button", type: "button", "aria-label": "Go back", display: "flex", onClick: () => { var _a; return (_a = navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.onIconClick) === null || _a === void 0 ? void 0 : _a.call(navigationBarText); }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.CircleArrowLeft, { size: "1.25rem", color: theme.colors.text[500] }) })), (navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.text) && ((0, jsx_runtime_1.jsx)(react_1.Text, { color: (0, accentText_1.accentTextOnCanvas)(theme.colors.secondary, theme.colors.backgroundColor.light), fontSize: "1.25rem", fontWeight: 600, fontFamily: "open-sans, sans-serif", letterSpacing: "-0.013rem", children: navigationBarText === null || navigationBarText === void 0 ? void 0 : navigationBarText.text }))] }), (0, jsx_runtime_1.jsx)(react_1.Flex, { minW: 0, flexShrink: 1, children: (0, jsx_runtime_1.jsxs)(react_1.Stack, { direction: "row", alignItems: "center", spacing: 4, minW: 0, children: [moreIcon && ((0, jsx_runtime_1.jsx)(react_1.Box, { display: "flex", alignItems: "center", minW: 0, children: moreIcon })), (0, jsx_runtime_1.jsxs)(react_1.Menu, { children: [(0, jsx_runtime_1.jsx)(react_1.MenuButton, { as: react_1.Button, rounded: "full", variant: "link", cursor: "pointer", minW: 0, flexShrink: 0, children: (0, jsx_runtime_1.jsx)(react_1.Avatar, { size: "sm", name: userName, src: userAvathar }) }), (0, jsx_runtime_1.jsx)(react_1.MenuList, { alignItems: "center", zIndex: 5, p: 0, py: "0.375rem",
52
51
  // Without a cap one long title stretches the whole dropdown; titles truncate instead.
@@ -35,7 +35,7 @@ exports.NumberInput = {
35
35
  const primary = theme.colors.primary[500];
36
36
  return {
37
37
  field: {
38
- bg: theme.colors.gray[50],
38
+ bg: theme.colors.background[50],
39
39
  border: "0.063rem solid",
40
40
  borderColor,
41
41
  _placeholder: {
@@ -69,7 +69,7 @@ exports.NumberInput = {
69
69
  boxShadow: 'inherit',
70
70
  },
71
71
  _disabled: {
72
- bg: theme.colors.gray[100],
72
+ bg: theme.colors.background[100],
73
73
  opacity: 1,
74
74
  cursor: "not-allowed",
75
75
  _hover: {
@@ -8,6 +8,8 @@ const useCustomTheme_1 = require("../../Theme/useCustomTheme");
8
8
  const accentText_1 = require("../../Theme/tokens/builders/accentText");
9
9
  const chartColorsFromTheme_1 = require("../../Theme/tokens/builders/chartColorsFromTheme");
10
10
  const outlineRung_1 = require("../../Theme/tokens/builders/outlineRung");
11
+ const rowStates_1 = require("../../Theme/tokens/builders/rowStates");
12
+ const useExclusiveOverlay_1 = require("../../Hooks/useExclusiveOverlay");
11
13
  const OrgSwitcherProps_1 = require("./OrgSwitcherProps");
12
14
  const sizeMap = {
13
15
  sm: { h: "32px", avatar: "22px", font: "0.8rem", sub: "0.65rem", px: 2 },
@@ -25,8 +27,14 @@ const Avatar = ({ org, boxSize, fontSize, }) => {
25
27
  const OrgSwitcher = ({ organizations, value, onChange, isLoading = false, isSearchable, searchThreshold = 6, triggerVariant = "ghost", size = "md", maxWidth = "200px", menuMinWidth = "280px", placeholder = "Select organization", ariaLabel = "Switch organization", showRole = true, }) => {
26
28
  var _a;
27
29
  const theme = (0, useCustomTheme_1.useCustomTheme)();
30
+ const rowBackgrounds = (0, react_1.useMemo)(() => (0, rowStates_1.listRowBackgrounds)(theme.colors), [theme.colors]);
28
31
  const s = sizeMap[size];
29
32
  const { isOpen, onOpen, onClose } = (0, react_2.useDisclosure)();
33
+ const requestExclusiveOpen = (0, useExclusiveOverlay_1.useExclusiveOverlay)(isOpen, onClose);
34
+ const handlePopoverOpen = () => {
35
+ requestExclusiveOpen();
36
+ onOpen();
37
+ };
30
38
  const [query, setQuery] = (0, react_1.useState)("");
31
39
  const searchRef = (0, react_1.useRef)(null);
32
40
  const [activeIndex, setActiveIndex] = (0, react_1.useState)(0);
@@ -71,7 +79,7 @@ const OrgSwitcher = ({ organizations, value, onChange, isLoading = false, isSear
71
79
  const triggerStyles = triggerVariant === "outline"
72
80
  ? { border: "1px solid", borderColor: theme.colors.boxborder[500], bg: theme.colors.background[50] }
73
81
  : triggerVariant === "subtle"
74
- ? { bg: theme.colors.gray[50] }
82
+ ? { bg: theme.colors.background[50] }
75
83
  : { bg: "transparent" };
76
84
  // `gray[100]` hover on a "transparent" trigger reads against whatever's actually behind it —
77
85
  // this control lives in a navbar-like shell, so `backgroundColor.light` is that surface. For a
@@ -84,7 +92,7 @@ const OrgSwitcher = ({ organizations, value, onChange, isLoading = false, isSear
84
92
  if (org.id !== value)
85
93
  onChange(org.id, org);
86
94
  };
87
- return ((0, jsx_runtime_1.jsxs)(react_2.Popover, { isOpen: isOpen, onOpen: onOpen, onClose: () => {
95
+ return ((0, jsx_runtime_1.jsxs)(react_2.Popover, { isOpen: isOpen, onOpen: handlePopoverOpen, onClose: () => {
88
96
  onClose();
89
97
  setQuery("");
90
98
  }, placement: "bottom-start", initialFocusRef: showSearch ? searchRef : firstOptionRef, isLazy: true, children: [(0, jsx_runtime_1.jsx)(react_2.PopoverTrigger, { children: (0, jsx_runtime_1.jsxs)(react_2.Flex, { as: "button", type: "button", "aria-label": ariaLabel, align: "center", gap: s.px === 2 ? "8px" : "10px", h: s.h, px: s.px, borderRadius: "lg", cursor: isLoading ? "default" : "pointer", opacity: isLoading ? 0.6 : 1, pointerEvents: isLoading ? "none" : "auto", transition: "background 0.15s ease", _hover: { bg: triggerVariant === "ghost" ? triggerHoverBg : undefined }, ...triggerStyles, children: [selected ? ((0, jsx_runtime_1.jsx)(Avatar, { org: selected, boxSize: s.avatar, fontSize: s.sub })) : ((0, jsx_runtime_1.jsx)(react_2.Flex, { align: "center", justify: "center", boxSize: s.avatar, borderRadius: "lg", bg: theme.colors.gray[100], color: (0, accentText_1.accentTextOnCanvas)(theme.colors.gray, theme.colors.gray[100]), flexShrink: 0, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Building2, { size: 14 }) })), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.font, fontWeight: 600, color: theme.colors.gray[700], maxW: maxWidth, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", textAlign: "left", children: (_a = selected === null || selected === void 0 ? void 0 : selected.name) !== null && _a !== void 0 ? _a : placeholder }), isLoading ? ((0, jsx_runtime_1.jsx)(react_2.Spinner, { size: "xs", thickness: "1.5px", color: theme.colors.accentText, flexShrink: 0 })) : ((0, jsx_runtime_1.jsx)(react_2.Box, { as: lucide_react_1.ChevronsUpDown, size: 16, color: theme.colors.textMuted, flexShrink: 0 }))] }) }), (0, jsx_runtime_1.jsx)(react_2.PopoverContent, { minW: menuMinWidth, w: "auto",
@@ -99,18 +107,14 @@ const OrgSwitcher = ({ organizations, value, onChange, isLoading = false, isSear
99
107
  }
100
108
  }, borderRadius: "lg" })] }) })), (0, jsx_runtime_1.jsxs)(react_2.Box, { role: "listbox", "aria-label": "Organizations", maxH: "320px", overflowY: "auto", py: 1, onKeyDown: handleListKeyDown, children: [filtered.map((org, idx) => {
101
109
  const isActive = org.id === value;
102
- // Active row's hover repeated its own resting `primary[50]` fill — a zero-delta
103
- // hover, invisible by construction. `resolveHoverTint` walks a fill away from a
104
- // backdrop until distinguishable, so handing it its own resting bg as the backdrop
105
- // is enough to make hover read as a real state change on both active and inactive rows.
106
110
  const rowHoverBg = isActive
107
- ? (0, outlineRung_1.resolveHoverTint)(theme.colors.primary[50], theme.colors.primary[50])
108
- : (0, outlineRung_1.resolveHoverTint)(theme.colors.gray[50], theme.colors.backgroundColor.light);
111
+ ? rowBackgrounds.selectedActive
112
+ : rowBackgrounds.active;
109
113
  return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { as: "button", type: "button", role: "option", "aria-selected": isActive, ref: (el) => {
110
114
  optionRefs.current[idx] = el;
111
115
  if (idx === 0)
112
116
  firstOptionRef.current = el;
113
- }, tabIndex: idx === activeIndex ? 0 : -1, align: "center", gap: "10px", w: "100%", textAlign: "left", border: "none", fontFamily: "inherit", px: 3, py: 2, cursor: "pointer", bg: isActive ? theme.colors.primary[50] : "transparent", transition: "background 0.12s ease", _hover: { bg: rowHoverBg }, onClick: () => handleSelect(org), children: [(0, jsx_runtime_1.jsx)(Avatar, { org: org, boxSize: s.avatar, fontSize: s.sub }), (0, jsx_runtime_1.jsxs)(react_2.Box, { flex: "1", minW: 0, children: [(0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.font, fontWeight: isActive ? 600 : 500, color: theme.colors.text[900], overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: org.name }), showRole && org.role && ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.sub, color: theme.colors.text[500], overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: org.role }))] }), isActive && ((0, jsx_runtime_1.jsx)(react_2.Box, { as: lucide_react_1.Check, size: 16, color: (0, accentText_1.accentTextOnCanvas)(theme.colors.primary, theme.colors.primary[50]), flexShrink: 0 }))] }, org.id));
114
- }), filtered.length === 0 && ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "sm", color: theme.colors.gray[500], textAlign: "center", py: 6, children: "No organizations found" }))] })] }) })] }));
117
+ }, tabIndex: idx === activeIndex ? 0 : -1, align: "center", gap: "10px", w: "100%", textAlign: "left", border: "none", fontFamily: "inherit", px: 3, py: 2, cursor: "pointer", bg: isActive ? rowBackgrounds.selected : "transparent", transition: "background 0.12s ease", _hover: { bg: rowHoverBg }, onClick: () => handleSelect(org), children: [(0, jsx_runtime_1.jsx)(Avatar, { org: org, boxSize: s.avatar, fontSize: s.sub }), (0, jsx_runtime_1.jsxs)(react_2.Box, { flex: "1", minW: 0, children: [(0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.font, fontWeight: isActive ? 600 : 500, color: theme.colors.text[900], overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: org.name }), showRole && org.role && ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.sub, color: theme.colors.text[500], overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: org.role }))] }), isActive && ((0, jsx_runtime_1.jsx)(react_2.Box, { as: lucide_react_1.Check, size: 16, color: theme.colors.accentText, flexShrink: 0 }))] }, org.id));
118
+ }), filtered.length === 0 && ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "sm", color: theme.colors.textMuted, textAlign: "center", py: 6, children: "No organizations found" }))] })] }) })] }));
115
119
  };
116
120
  exports.default = OrgSwitcher;
@@ -8,13 +8,13 @@ const react_1 = require("@chakra-ui/react");
8
8
  const lucide_react_1 = require("lucide-react");
9
9
  const useCustomTheme_1 = require("../../Theme/useCustomTheme");
10
10
  const accentText_1 = require("../../Theme/tokens/builders/accentText");
11
- const outlineRung_1 = require("../../Theme/tokens/builders/outlineRung");
11
+ const rowStates_1 = require("../../Theme/tokens/builders/rowStates");
12
12
  const ToolTip_1 = __importDefault(require("../ToolTip/ToolTip"));
13
13
  const PdfViewer = ({ pdfUrl, fileName = "Document.pdf", height = "480px", showToolbar = true, borderRadius = "xl", }) => {
14
14
  const theme = (0, useCustomTheme_1.useCustomTheme)();
15
- const toolbarSurface = theme.colors.gray[50];
15
+ const toolbarSurface = theme.colors.background[50];
16
16
  const iconHoverInk = (0, accentText_1.accentTextOnCanvas)(theme.colors.primary, toolbarSurface);
17
- const iconHoverBg = (0, outlineRung_1.resolveHoverTint)(theme.colors.primary[50], toolbarSurface);
18
- return ((0, jsx_runtime_1.jsxs)(react_1.Box, { border: "1px solid", borderColor: theme.colors.gray[200], borderRadius: borderRadius, overflow: "hidden", bg: theme.colors.background[50], children: [showToolbar && ((0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", justify: "space-between", px: 4, py: 2.5, borderBottom: "1px solid", borderColor: theme.colors.gray[100], bg: theme.colors.gray[50], children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: 2, minW: 0, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.FileText, { size: 18, color: theme.colors.accentText }), (0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "sm", fontWeight: 500, color: theme.colors.gray[700], overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: fileName })] }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: 1, children: [(0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: "Open in new tab", placement: "top", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: "a", href: pdfUrl, target: "_blank", rel: "noopener noreferrer", p: 2, borderRadius: "lg", color: theme.colors.gray[600], _hover: { bg: iconHoverBg, color: iconHoverInk }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { size: 16 }) }) }), (0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: "Download", placement: "top", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: "a", href: pdfUrl, download: fileName, p: 2, borderRadius: "lg", color: theme.colors.gray[600], _hover: { bg: iconHoverBg, color: iconHoverInk }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Download, { size: 16 }) }) })] })] })), (0, jsx_runtime_1.jsx)(react_1.Box, { as: "embed", src: pdfUrl, type: "application/pdf", width: "100%", height: height, display: "block" })] }));
17
+ const iconHoverBg = (0, rowStates_1.listRowBackgrounds)(theme.colors).active;
18
+ return ((0, jsx_runtime_1.jsxs)(react_1.Box, { border: "1px solid", borderColor: theme.colors.gray[200], borderRadius: borderRadius, overflow: "hidden", bg: theme.colors.background[50], children: [showToolbar && ((0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", justify: "space-between", px: 4, py: 2.5, borderBottom: "1px solid", borderColor: theme.colors.gray[100], bg: theme.colors.background[50], children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: 2, minW: 0, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.FileText, { size: 18, color: theme.colors.accentText }), (0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "sm", fontWeight: 500, color: theme.colors.gray[700], overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: fileName })] }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: 1, children: [(0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: "Open in new tab", placement: "top", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: "a", href: pdfUrl, target: "_blank", rel: "noopener noreferrer", p: 2, borderRadius: "lg", color: theme.colors.gray[600], _hover: { bg: iconHoverBg, color: iconHoverInk }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { size: 16 }) }) }), (0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: "Download", placement: "top", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: "a", href: pdfUrl, download: fileName, p: 2, borderRadius: "lg", color: theme.colors.gray[600], _hover: { bg: iconHoverBg, color: iconHoverInk }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Download, { size: 16 }) }) })] })] })), (0, jsx_runtime_1.jsx)(react_1.Box, { as: "embed", src: pdfUrl, type: "application/pdf", width: "100%", height: height, display: "block" })] }));
19
19
  };
20
20
  exports.default = PdfViewer;
@@ -8,7 +8,7 @@ const react_1 = require("react");
8
8
  const react_2 = require("@chakra-ui/react");
9
9
  const lucide_react_1 = require("lucide-react");
10
10
  const useCustomTheme_1 = require("../../Theme/useCustomTheme");
11
- const outlineRung_1 = require("../../Theme/tokens/builders/outlineRung");
11
+ const rowStates_1 = require("../../Theme/tokens/builders/rowStates");
12
12
  const Button_1 = __importDefault(require("../Button/Button"));
13
13
  const TextInput_1 = __importDefault(require("../Input/TextInput"));
14
14
  const EmptyState_1 = __importDefault(require("../EmptyState/EmptyState"));
@@ -64,8 +64,9 @@ const RolesPermission = ({ view, mode = "create", roles, isRolesLoading = false,
64
64
  const surface = colors.background[50];
65
65
  const muted = colors.textMuted;
66
66
  const heading = colors.text[900];
67
- const headBg = colors.gray[50];
68
- const rowHover = (0, outlineRung_1.resolveHoverTint)(colors.gray[50], surface);
67
+ const rowBackgrounds = (0, rowStates_1.listRowBackgrounds)(colors);
68
+ const headBg = colors.background[100];
69
+ const rowHover = rowBackgrounds.active;
69
70
  const isViewMode = mode === "view";
70
71
  const columnLabels = {
71
72
  read: labels.read,
@@ -44,7 +44,8 @@ const FormLabel_1 = require("../Common/FormLabel");
44
44
  const Tag_1 = __importDefault(require("../Tag/Tag"));
45
45
  const useCustomTheme_1 = require("../../Theme/useCustomTheme");
46
46
  const placeholderInk_1 = require("../../Theme/tokens/builders/placeholderInk");
47
- const outlineRung_1 = require("../../Theme/tokens/builders/outlineRung");
47
+ const rowStates_1 = require("../../Theme/tokens/builders/rowStates");
48
+ const useExclusiveOverlay_1 = require("../../Hooks/useExclusiveOverlay");
48
49
  const ErrorMessage_1 = __importDefault(require("../Common/ErrorMessage"));
49
50
  const HelperText_1 = __importDefault(require("../Common/HelperText"));
50
51
  const ToolTip_1 = __importDefault(require("../ToolTip/ToolTip"));
@@ -89,15 +90,11 @@ const SearchSelect = ({ id, label, options, onSelect, onSearch, isOptionLoading
89
90
  width: 0,
90
91
  });
91
92
  const theme = (0, useCustomTheme_1.useCustomTheme)();
92
- const customSelectActiveTint = (0, react_1.useMemo)(() => (0, outlineRung_1.resolveHoverTint)(theme.colors.primary[500], theme.colors.background[400]), [theme.colors.primary, theme.colors.background]);
93
- const dropdownActiveTint = (0, react_1.useMemo)(() => (0, outlineRung_1.resolveHoverTint)(theme.colors.primary[500], theme.colors.background[50]), [theme.colors.primary, theme.colors.background]);
94
- const dropdownHoverTint = (0, react_1.useMemo)(() => (0, outlineRung_1.resolveHoverTint)(theme.colors.gray[50], theme.colors.background[50]), [theme.colors.gray, theme.colors.background]);
95
- // `searchselect-dropdown-portal` is also the DOM id an existing outside-click check and
96
- // several tests look up directly — kept as a literal constant, not derived from `baseId`,
97
- // so those keep working unchanged.
93
+ const rowBackgrounds = (0, react_1.useMemo)(() => (0, rowStates_1.listRowBackgrounds)(theme.colors), [theme.colors]);
98
94
  const generatedId = (0, react_1.useId)();
99
95
  const baseId = id || generatedId;
100
- const listboxId = "searchselect-dropdown-portal";
96
+ const listboxId = `${baseId}-listbox`;
97
+ const insideSelectPortalId = `${baseId}-inside-select`;
101
98
  const getOptionId = (index) => `${baseId}-option-${index}`;
102
99
  const [activeIndex, setActiveIndex] = (0, react_1.useState)(-1);
103
100
  const pendingFocusRestoreRef = (0, react_1.useRef)(false);
@@ -107,12 +104,15 @@ const SearchSelect = ({ id, label, options, onSelect, onSearch, isOptionLoading
107
104
  // just "Input is mounted now": falling back to render-condition guessing there would put
108
105
  // aria-activedescendant on an unfocused Input while the still-focused toggle button gets none.
109
106
  const [focusedTrigger, setFocusedTrigger] = (0, react_1.useState)(null);
107
+ const closeMenus = (0, react_1.useCallback)(() => {
108
+ setIsOpen(false);
109
+ setCustomSelectOpen(false);
110
+ }, []);
111
+ const requestExclusiveOpen = (0, useExclusiveOverlay_1.useExclusiveOverlay)(isOpen || customSelectOpen, closeMenus);
110
112
  (0, react_2.useOutsideClick)({
111
113
  ref: containerRef,
112
114
  handler: (e) => {
113
- // The options dropdown is portaled to <body>, so a click on it is "outside"
114
- // the container — ignore those so selecting an option doesn't close first.
115
- const dropdown = document.getElementById(listboxId);
115
+ const dropdown = dropdownMenuRef.current;
116
116
  if (dropdown && dropdown.contains(e.target))
117
117
  return;
118
118
  setIsOpen(false);
@@ -219,6 +219,7 @@ const SearchSelect = ({ id, label, options, onSelect, onSearch, isOptionLoading
219
219
  // Opens only — matches SelectV2's convention of a first ArrowDown/Enter/Space that opens with
220
220
  // nothing highlighted yet, and a second keypress that moves onto the first/last option.
221
221
  const openMenu = () => {
222
+ requestExclusiveOpen();
222
223
  setCustomSelectOpen(false);
223
224
  setIsOpen(true);
224
225
  };
@@ -363,7 +364,7 @@ const SearchSelect = ({ id, label, options, onSelect, onSearch, isOptionLoading
363
364
  (0, react_2.useOutsideClick)({
364
365
  ref: customSelectRef,
365
366
  handler: (e) => {
366
- const dropdown = document.getElementById("custom-select-portal");
367
+ const dropdown = insideSelectMenuRef.current;
367
368
  if (dropdown && dropdown.contains(e.target))
368
369
  return;
369
370
  setCustomSelectOpen(false);
@@ -479,38 +480,39 @@ const SearchSelect = ({ id, label, options, onSelect, onSearch, isOptionLoading
479
480
  ? theme.colors.semanticText.error
480
481
  : focused
481
482
  ? theme.colors.primary[500]
482
- : theme.colors.boxborder[500], borderRadius: "lg", bg: theme.colors.gray[50], boxShadow: focused
483
+ : theme.colors.boxborder[500], borderRadius: "lg", bg: theme.colors.background[50], boxShadow: focused
483
484
  ? error
484
485
  ? `0 0 0 0.125rem ${theme.colors.boxShadow.error}`
485
486
  : `0 0 0 0.125rem ${theme.colors.boxShadow.primary}`
486
487
  : error
487
488
  ? `0 0 0 0.125rem ${theme.colors.boxShadow.error}`
488
- : "none", transition: "box-shadow 0.2s, border-color 0.2s", onKeyDown: handleControlKeyDown, onFocus: () => setFocused(true), onBlur: () => setFocused(false), onClick: () => {
489
- setCustomSelectOpen(false);
490
- setIsOpen(true);
491
- }, children: [insideSelect && (() => {
489
+ : "none", transition: "box-shadow 0.2s, border-color 0.2s", onKeyDown: handleControlKeyDown, onFocus: () => setFocused(true), onBlur: () => setFocused(false), onClick: () => openMenu(), children: [insideSelect && (() => {
492
490
  var _a, _b, _c, _d, _e;
493
491
  const insideLabel = (_a = insideSelect.value) === null || _a === void 0 ? void 0 : _a.label;
494
492
  const insidePlaceholder = (_b = insideSelect.placeholder) !== null && _b !== void 0 ? _b : "Select";
495
493
  return ((0, jsx_runtime_1.jsxs)(react_2.Box, { position: "relative", ref: customSelectRef, flexShrink: 0, ml: s.insideSelectMarginLeft, h: "-webkit-fill-available", borderRight: "0.063rem solid", borderColor: theme.colors.boxborder[200], bg: customSelectOpen
496
- ? customSelectActiveTint
494
+ ? rowBackgrounds.active
497
495
  : theme.colors.background[400], borderLeftRadius: "md", borderRightRadius: 0, transition: "background 0.15s ease, box-shadow 0.15s ease", boxShadow: customSelectOpen
498
496
  ? `inset 0 0 0 0.063rem ${theme.colors.primary[500]}`
499
497
  : "none", onClick: (e) => {
500
498
  e.stopPropagation();
501
499
  setIsOpen(false);
502
- setCustomSelectOpen((prev) => !prev);
503
- }, children: [(0, jsx_runtime_1.jsxs)(react_2.Box, { minW: "4.5rem", cursor: "pointer", display: "flex", justifyContent: "space-between", alignItems: "center", gap: 1, width: insideSelect.width, height: insideSelectBoxHeight, pl: "0.5rem", pr: "0.375rem", children: [insideLabel ? ((0, jsx_runtime_1.jsx)(SelectTruncatedLabel_1.default, { label: insideLabel, maxWidth: insideSelect.width || "6rem", fontSize: s.fieldFontSize })) : ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.fieldFontSize, fontWeight: 500, color: (0, placeholderInk_1.placeholderInk)(theme.colors), isTruncated: true, maxW: insideSelect.width || "6rem", children: insidePlaceholder })), (0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "inline-flex", flexShrink: 0, color: customSelectOpen ? theme.colors.accentText : theme.colors.textMuted, transition: "transform 0.2s ease, color 0.15s ease", transform: customSelectOpen ? "rotate(180deg)" : "rotate(0deg)", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { size: s.chevronSize }) })] }), customSelectOpen && ((0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsx)(react_2.Box, { ref: setInsideSelectMenuRef, id: "custom-select-portal", position: "fixed", top: `${customSelectPos.top}px`, left: `${customSelectPos.left}px`, zIndex: 1510, bg: theme.colors.background[50], border: "0.063rem solid", borderColor: theme.colors.boxborder[200], borderRadius: "lg", boxShadow: (_d = (_c = theme.shadows) === null || _c === void 0 ? void 0 : _c.md) !== null && _d !== void 0 ? _d : "md", minW: `${customSelectPos.width}px`, maxW: "20rem", py: 1, overflow: "hidden", children: (_e = insideSelect.option) === null || _e === void 0 ? void 0 : _e.map((item) => {
500
+ if (customSelectOpen) {
501
+ setCustomSelectOpen(false);
502
+ }
503
+ else {
504
+ requestExclusiveOpen();
505
+ setCustomSelectOpen(true);
506
+ }
507
+ }, children: [(0, jsx_runtime_1.jsxs)(react_2.Box, { minW: "4.5rem", cursor: "pointer", display: "flex", justifyContent: "space-between", alignItems: "center", gap: 1, width: insideSelect.width, height: insideSelectBoxHeight, pl: "0.5rem", pr: "0.375rem", children: [insideLabel ? ((0, jsx_runtime_1.jsx)(SelectTruncatedLabel_1.default, { label: insideLabel, maxWidth: insideSelect.width || "6rem", fontSize: s.fieldFontSize })) : ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.fieldFontSize, fontWeight: 500, color: (0, placeholderInk_1.placeholderInk)(theme.colors), isTruncated: true, maxW: insideSelect.width || "6rem", children: insidePlaceholder })), (0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "inline-flex", flexShrink: 0, color: customSelectOpen ? theme.colors.accentText : theme.colors.textMuted, transition: "transform 0.2s ease, color 0.15s ease", transform: customSelectOpen ? "rotate(180deg)" : "rotate(0deg)", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { size: s.chevronSize }) })] }), customSelectOpen && ((0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsx)(react_2.Box, { ref: setInsideSelectMenuRef, id: insideSelectPortalId, position: "fixed", top: `${customSelectPos.top}px`, left: `${customSelectPos.left}px`, zIndex: 1510, bg: theme.colors.background[50], border: "0.063rem solid", borderColor: theme.colors.boxborder[200], borderRadius: "lg", boxShadow: (_d = (_c = theme.shadows) === null || _c === void 0 ? void 0 : _c.md) !== null && _d !== void 0 ? _d : "md", minW: `${customSelectPos.width}px`, maxW: "20rem", py: 1, overflow: "hidden", children: (_e = insideSelect.option) === null || _e === void 0 ? void 0 : _e.map((item) => {
504
508
  var _a;
505
509
  const selected = ((_a = insideSelect.value) === null || _a === void 0 ? void 0 : _a.id) === item.id;
506
510
  return ((0, jsx_runtime_1.jsxs)(react_2.Box, { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 2, minH: s.optionRowMinH, py: s.optionRowPy, px: "0.75rem", fontSize: s.dropdownTextFontSize, fontWeight: selected ? 600 : 500, color: selected
507
511
  ? theme.colors.accentText
508
- : theme.colors.text[700], bg: selected
509
- ? dropdownActiveTint
510
- : "transparent", _hover: {
512
+ : theme.colors.text[700], bg: selected ? rowBackgrounds.selected : "transparent", _hover: {
511
513
  bg: selected
512
- ? dropdownActiveTint
513
- : dropdownHoverTint,
514
+ ? rowBackgrounds.selectedActive
515
+ : rowBackgrounds.active,
514
516
  }, cursor: "pointer", onClick: (e) => {
515
517
  e.stopPropagation();
516
518
  handleCustomSelect(item);
@@ -523,16 +525,12 @@ const SearchSelect = ({ id, label, options, onSelect, onSearch, isOptionLoading
523
525
  ? item.label.slice(0, chip.maxText) + "…"
524
526
  : item.label, onIconClick: (chip === null || chip === void 0 ? void 0 : chip.onClick) ? () => handleRemove(item === null || item === void 0 ? void 0 : item.id) : undefined, icon: (chip === null || chip === void 0 ? void 0 : chip.onClick) ? lucide_react_1.CircleX : undefined, colorScheme: "gray", size: s.tagSize }, item.id)))
525
527
  : selectedValues.length === 1 &&
526
- !isOpen && ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "button", type: "button", ref: triggerButtonRef, id: primaryTarget === "button" ? baseId : undefined, ...comboboxA11yProps("button"), "aria-label": !label ? String((_b = (_a = selectedValues[0]) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : "") : undefined, onFocus: () => setFocusedTrigger("button"), onBlur: () => setFocusedTrigger((prev) => (prev === "button" ? null : prev)), onClick: () => {
527
- setCustomSelectOpen(false);
528
- setIsOpen(true);
529
- }, fontSize: s.fieldFontSize, color: theme.colors.gray[800], background: "transparent", border: "none", cursor: "pointer", p: 0, display: "flex", alignItems: "center", flex: "1", minW: 0, children: (0, jsx_runtime_1.jsx)(SelectTruncatedLabel_1.default, { label: String(selectedValues[0].label), maxWidth: "calc(100% - 2rem)", fontSize: s.fieldFontSize }) })), (chip === null || chip === void 0 ? void 0 : chip.maxChips) && isMultiple && selectedValues.length > chip.maxChips && ((0, jsx_runtime_1.jsx)(Tag_1.default, { label: `+ ${selectedValues.length - chip.maxChips}`, colorScheme: "gray", size: s.tagSize }, "extra-count")), (isOpen || inputValue || !selectedValues.length) && ((0, jsx_runtime_1.jsx)(react_2.Input, { ref: inputRef, id: primaryTarget === "input" ? baseId : undefined, "aria-autocomplete": "list", ...comboboxA11yProps("input"), variant: "unstyled", size: size, h: s.fieldHeight, minH: s.fieldHeight, fontSize: s.fieldFontSize, flex: "1",
528
+ !isOpen && ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "button", type: "button", ref: triggerButtonRef, id: primaryTarget === "button" ? baseId : undefined, ...comboboxA11yProps("button"), "aria-label": !label ? String((_b = (_a = selectedValues[0]) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : "") : undefined, onFocus: () => setFocusedTrigger("button"), onBlur: () => setFocusedTrigger((prev) => (prev === "button" ? null : prev)), onClick: () => openMenu(), fontSize: s.fieldFontSize, color: theme.colors.gray[800], background: "transparent", border: "none", cursor: "pointer", p: 0, display: "flex", alignItems: "center", flex: "1", minW: 0, children: (0, jsx_runtime_1.jsx)(SelectTruncatedLabel_1.default, { label: String(selectedValues[0].label), maxWidth: "calc(100% - 2rem)", fontSize: s.fieldFontSize }) })), (chip === null || chip === void 0 ? void 0 : chip.maxChips) && isMultiple && selectedValues.length > chip.maxChips && ((0, jsx_runtime_1.jsx)(Tag_1.default, { label: `+ ${selectedValues.length - chip.maxChips}`, colorScheme: "gray", size: s.tagSize }, "extra-count")), (isOpen || inputValue || !selectedValues.length) && ((0, jsx_runtime_1.jsx)(react_2.Input, { ref: inputRef, id: primaryTarget === "input" ? baseId : undefined, "aria-autocomplete": "list", ...comboboxA11yProps("input"), variant: "unstyled", size: size, h: s.fieldHeight, minH: s.fieldHeight, fontSize: s.fieldFontSize, flex: "1",
530
529
  // minW="5rem"
531
530
  minW: "0", value: inputValue, onChange: (e) => setInputValue(e.target.value), onFocus: () => {
532
531
  setFocused(true);
533
532
  setFocusedTrigger("input");
534
- setCustomSelectOpen(false);
535
- setIsOpen(true);
533
+ openMenu();
536
534
  }, onBlur: () => {
537
535
  setFocused(false);
538
536
  setFocusedTrigger((prev) => (prev === "input" ? null : prev));
@@ -544,15 +542,22 @@ const SearchSelect = ({ id, label, options, onSelect, onSearch, isOptionLoading
544
542
  } }) })), isLoading ? ((0, jsx_runtime_1.jsx)(react_2.Spinner, { size: s.spinnerSize })) : isValidIcon(rightIcon === null || rightIcon === void 0 ? void 0 : rightIcon.icon) ? ((0, jsx_runtime_1.jsx)(react_2.IconButton, { icon: rightIcon === null || rightIcon === void 0 ? void 0 : rightIcon.icon, "aria-label": "right-icon", variant: "ghost", size: s.iconButtonSize, onClick: rightIcon === null || rightIcon === void 0 ? void 0 : rightIcon.onClick })) : ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "button", type: "button", ref: toggleButtonRef, id: primaryTarget === "toggle" ? baseId : undefined, ...comboboxA11yProps("toggle"), onFocus: () => setFocusedTrigger("toggle"), onBlur: () => setFocusedTrigger((prev) => (prev === "toggle" ? null : prev)), onClick: (e) => {
545
543
  e.preventDefault();
546
544
  e.stopPropagation();
547
- setIsOpen((prev) => {
548
- if (!prev)
549
- setCustomSelectOpen(false);
550
- return !prev;
551
- });
552
- }, "aria-label": "toggle-dropdown", display: "flex", alignItems: "center", children: isOpen ? ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronUp, { size: s.chevronSize })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { size: s.chevronSize })) }))] })] }) }), isOpen && ((0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsxs)(react_2.Box, { ref: setDropdownMenuRef, id: listboxId, role: "listbox", "aria-multiselectable": isMultiple || undefined, position: "fixed", top: `${dropdownPos.top}px`, left: `${dropdownPos.left}px`, width: `${dropdownPos.width}px`, zIndex: 1500, maxH: "20rem", borderWidth: 1, borderColor: theme.colors.boxborder[200], borderRadius: "sm", bg: theme.colors.background[50], boxShadow: "md", display: "flex", flexDirection: "column", children: [isMultiple && isSelectAll && ((0, jsx_runtime_1.jsxs)(react_2.Box, { py: s.optionRowPy, px: 3, cursor: "pointer", onClick: handleSelectAll, display: "flex", alignItems: "center", gap: 2, borderBottom: `0.063rem solid ${theme.colors.boxborder[200]}`, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.default, { isChecked: allFilteredSelected, sx: { pointerEvents: "none" }, size: s.checkboxSize }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.dropdownTextFontSize, children: allFilteredSelected ? "Unselect All" : "Select All" })] })), (0, jsx_runtime_1.jsx)(react_2.Box, { flex: "1", overflowY: "auto", onScroll: handleScroll, maxH: "15rem", borderBottom: "0.063rem solid", borderColor: theme.colors.boxborder[200], children: isOptionLoading && filteredOptions.length === 0 ? ((0, jsx_runtime_1.jsxs)(react_2.Box, { py: s.optionRowPy, px: 3, display: "flex", alignItems: "center", gap: 2, minH: s.optionRowMinH, children: [(0, jsx_runtime_1.jsx)(react_2.Spinner, { size: s.spinnerSize }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.dropdownTextFontSize, children: loadingText })] })) : !isOptionLoading && filteredOptions.length === 0 ? ((0, jsx_runtime_1.jsx)(react_2.Text, { p: 3, fontSize: s.dropdownTextFontSize, color: theme.colors.textMuted, children: "No results found" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [filteredOptions.map((option, index) => ((0, jsx_runtime_1.jsxs)(react_2.Box, { id: getOptionId(index), role: "option", "aria-selected": isSelected(option.id), py: s.optionRowPy, px: 3, minH: s.optionRowMinH, cursor: "pointer", bg: index === activeIndex
553
- ? dropdownActiveTint
554
- : isSelected(option.id)
555
- ? theme.colors.gray[100]
556
- : "transparent", _hover: { bg: dropdownHoverTint }, onClick: () => handleSelect(option), onMouseEnter: () => setActiveIndex(index), display: "flex", alignItems: "center", gap: 2, borderBottom: `0.063rem solid ${theme.colors.boxborder[200]}`, children: [isMultiple && ((0, jsx_runtime_1.jsx)(Checkbox_1.default, { isChecked: isSelected(option.id), sx: { pointerEvents: "none" }, size: s.checkboxSize })), option.view ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: option.view })) : ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.dropdownTextFontSize, children: option.label }))] }, option.id))), ((pagination === null || pagination === void 0 ? void 0 : pagination.scrollLoading) || (isOptionLoading && filteredOptions.length > 0)) && ((0, jsx_runtime_1.jsxs)(react_2.Box, { py: s.optionRowPy, px: 3, display: "flex", alignItems: "center", justifyContent: "center", gap: 2, minH: s.optionRowMinH, children: [(0, jsx_runtime_1.jsx)(react_2.Spinner, { size: s.spinnerSize }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.dropdownTextFontSize, children: loadingText })] }))] })) }), (addNew === null || addNew === void 0 ? void 0 : addNew.enabled) && ((0, jsx_runtime_1.jsxs)(react_2.Box, { py: s.optionRowPy, px: 3, borderTop: "0.063rem solid", borderColor: theme.colors.boxborder[200], bg: theme.colors.background[50], display: "flex", alignItems: "center", gap: 2, minH: s.optionRowMinH, cursor: "pointer", onClick: addNew.onClick, _hover: { bg: dropdownHoverTint }, children: [addNew.icon || (0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { size: s.addNewIconSize }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.dropdownTextFontSize, children: addNew.text || "Add New" })] }))] }) })), helperText && !error && (0, jsx_runtime_1.jsx)(HelperText_1.default, { helperText: helperText }), error && (0, jsx_runtime_1.jsx)(ErrorMessage_1.default, { errorMessage: errorMessage })] }));
545
+ if (isOpen) {
546
+ closeMenus();
547
+ }
548
+ else {
549
+ openMenu();
550
+ }
551
+ }, "aria-label": "toggle-dropdown", display: "flex", alignItems: "center", children: isOpen ? ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronUp, { size: s.chevronSize })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { size: s.chevronSize })) }))] })] }) }), isOpen && ((0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsxs)(react_2.Box, { ref: setDropdownMenuRef, id: listboxId, role: "listbox", "aria-multiselectable": isMultiple || undefined, position: "fixed", top: `${dropdownPos.top}px`, left: `${dropdownPos.left}px`, width: `${dropdownPos.width}px`, zIndex: 1500, maxH: "20rem", borderWidth: 1, borderColor: theme.colors.boxborder[200], borderRadius: "sm", bg: theme.colors.background[50], boxShadow: "md", display: "flex", flexDirection: "column", children: [isMultiple && isSelectAll && ((0, jsx_runtime_1.jsxs)(react_2.Box, { py: s.optionRowPy, px: 3, cursor: "pointer", onClick: handleSelectAll, display: "flex", alignItems: "center", gap: 2, borderBottom: `0.063rem solid ${theme.colors.boxborder[200]}`, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.default, { isChecked: allFilteredSelected, sx: { pointerEvents: "none" }, size: s.checkboxSize }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.dropdownTextFontSize, children: allFilteredSelected ? "Unselect All" : "Select All" })] })), (0, jsx_runtime_1.jsx)(react_2.Box, { flex: "1", overflowY: "auto", onScroll: handleScroll, maxH: "15rem", borderBottom: "0.063rem solid", borderColor: theme.colors.boxborder[200], children: isOptionLoading && filteredOptions.length === 0 ? ((0, jsx_runtime_1.jsxs)(react_2.Box, { py: s.optionRowPy, px: 3, display: "flex", alignItems: "center", gap: 2, minH: s.optionRowMinH, children: [(0, jsx_runtime_1.jsx)(react_2.Spinner, { size: s.spinnerSize }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.dropdownTextFontSize, children: loadingText })] })) : !isOptionLoading && filteredOptions.length === 0 ? ((0, jsx_runtime_1.jsx)(react_2.Text, { p: 3, fontSize: s.dropdownTextFontSize, color: theme.colors.textMuted, children: "No results found" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [filteredOptions.map((option, index) => ((0, jsx_runtime_1.jsxs)(react_2.Box, { id: getOptionId(index), role: "option", "aria-selected": isSelected(option.id), py: s.optionRowPy, px: 3, minH: s.optionRowMinH, cursor: "pointer", bg: isSelected(option.id)
552
+ ? index === activeIndex
553
+ ? rowBackgrounds.selectedActive
554
+ : rowBackgrounds.selected
555
+ : index === activeIndex
556
+ ? rowBackgrounds.active
557
+ : "transparent", _hover: {
558
+ bg: isSelected(option.id)
559
+ ? rowBackgrounds.selectedActive
560
+ : rowBackgrounds.active,
561
+ }, onClick: () => handleSelect(option), onMouseEnter: () => setActiveIndex(index), display: "flex", alignItems: "center", gap: 2, borderBottom: `0.063rem solid ${theme.colors.boxborder[200]}`, children: [isMultiple && ((0, jsx_runtime_1.jsx)(Checkbox_1.default, { isChecked: isSelected(option.id), sx: { pointerEvents: "none" }, size: s.checkboxSize })), option.view ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: option.view })) : ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.dropdownTextFontSize, children: option.label }))] }, option.id))), ((pagination === null || pagination === void 0 ? void 0 : pagination.scrollLoading) || (isOptionLoading && filteredOptions.length > 0)) && ((0, jsx_runtime_1.jsxs)(react_2.Box, { py: s.optionRowPy, px: 3, display: "flex", alignItems: "center", justifyContent: "center", gap: 2, minH: s.optionRowMinH, children: [(0, jsx_runtime_1.jsx)(react_2.Spinner, { size: s.spinnerSize }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.dropdownTextFontSize, children: loadingText })] }))] })) }), (addNew === null || addNew === void 0 ? void 0 : addNew.enabled) && ((0, jsx_runtime_1.jsxs)(react_2.Box, { py: s.optionRowPy, px: 3, borderTop: "0.063rem solid", borderColor: theme.colors.boxborder[200], bg: theme.colors.background[50], display: "flex", alignItems: "center", gap: 2, minH: s.optionRowMinH, cursor: "pointer", onClick: addNew.onClick, _hover: { bg: rowBackgrounds.active }, children: [addNew.icon || (0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { size: s.addNewIconSize }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: s.dropdownTextFontSize, children: addNew.text || "Add New" })] }))] }) })), helperText && !error && (0, jsx_runtime_1.jsx)(HelperText_1.default, { helperText: helperText }), error && (0, jsx_runtime_1.jsx)(ErrorMessage_1.default, { errorMessage: errorMessage })] }));
557
562
  };
558
563
  exports.default = SearchSelect;