pixelize-design-library 2.4.2-beta.66 → 2.4.2-beta.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -4
- package/COMPONENT-GOTCHAS.md +105 -66
- package/DESIGN-GUIDE.md +18 -6
- package/README.md +14 -11
- package/dist/Components/Accordion/AccordionProps.d.ts +10 -0
- package/dist/Components/AddressCard/AddressCardProps.d.ts +15 -0
- package/dist/Components/Apexcharts/ApexAreaChart/ApexAreaChartProps.d.ts +11 -0
- package/dist/Components/Apexcharts/ApexBarChart/ApexBarChartProps.d.ts +17 -1
- package/dist/Components/Apexcharts/ApexLineChart/ApexLineChartProps.d.ts +10 -0
- package/dist/Components/Apexcharts/ApexPieChart/ApexPieChartProps.d.ts +14 -0
- package/dist/Components/Apexcharts/ApexPolarCharts/ApexPolarChartsProps.d.ts +9 -0
- package/dist/Components/Apexcharts/ApexRadialChart/ApexRadialChartProps.d.ts +10 -0
- package/dist/Components/AppSwitcher/AppSwitcher.d.ts +1 -0
- package/dist/Components/AppSwitcher/AppSwitcher.js +1 -0
- package/dist/Components/AppSwitcher/AppSwitcherProps.d.ts +23 -0
- package/dist/Components/AppSwitcher/pixelizeSuite.d.ts +1 -0
- package/dist/Components/AppearanceSettings/AppearanceSettings.d.ts +1 -0
- package/dist/Components/AppearanceSettings/AppearanceSettings.js +1 -0
- package/dist/Components/AppearanceSettings/AppearanceSettingsProps.d.ts +11 -0
- package/dist/Components/AudioRecorder/AudioRecorder.d.ts +1 -0
- package/dist/Components/AudioRecorder/AudioRecorder.js +1 -0
- package/dist/Components/AudioRecorder/AudioRecorderProps.d.ts +6 -0
- package/dist/Components/Avatar/AvatarGroup.d.ts +1 -0
- package/dist/Components/Avatar/AvatarGroup.js +1 -0
- package/dist/Components/Avatar/AvatarGroupProps.d.ts +2 -0
- package/dist/Components/Avatar/AvatarProps.d.ts +2 -2
- package/dist/Components/Avatar/avatarColorway.d.ts +1 -0
- package/dist/Components/BagBar/BagBarProps.d.ts +8 -0
- package/dist/Components/BulkSelectionBar/BulkSelectionBar.d.ts +1 -0
- package/dist/Components/BulkSelectionBar/BulkSelectionBar.js +1 -0
- package/dist/Components/BulkSelectionBar/BulkSelectionBarProps.d.ts +6 -0
- package/dist/Components/Button/Button.js +1 -0
- package/dist/Components/Button/ButtonProps.d.ts +3 -0
- package/dist/Components/ButtonGroupIcon/ButtonGroupIcon.d.ts +1 -0
- package/dist/Components/ButtonGroupIcon/ButtonGroupIcon.js +1 -0
- package/dist/Components/ButtonGroupIcon/ButtonGroupIconProps.d.ts +19 -0
- package/dist/Components/CalendarGrid/CalendarGrid.d.ts +1 -0
- package/dist/Components/CalendarGrid/CalendarGrid.js +1 -0
- package/dist/Components/CalendarGrid/CalendarGridProps.d.ts +11 -0
- package/dist/Components/CalendarGrid/calendarMath.d.ts +13 -0
- package/dist/Components/Card/CardProps.d.ts +4 -0
- package/dist/Components/Card/PaymentCard/PaymentCard.d.ts +1 -0
- package/dist/Components/Card/PaymentCard/PaymentCard.js +1 -0
- package/dist/Components/Card/PaymentCard/PaymentCardProps.d.ts +19 -0
- package/dist/Components/CartItem/CartItemProps.d.ts +10 -0
- package/dist/Components/Checkbox/CheckboxProps.d.ts +1 -0
- package/dist/Components/ChoiceCard/ChoiceCard.d.ts +1 -0
- package/dist/Components/ChoiceCard/ChoiceCard.js +1 -0
- package/dist/Components/ChoiceCard/ChoiceCardGroup.d.ts +1 -0
- package/dist/Components/ChoiceCard/ChoiceCardGroup.js +1 -0
- package/dist/Components/ChoiceCard/ChoiceCardProps.d.ts +3 -0
- package/dist/Components/ConfirmDialog/ConfirmDialog.d.ts +1 -0
- package/dist/Components/ConfirmDialog/ConfirmDialog.js +1 -0
- package/dist/Components/ConfirmDialog/ConfirmDialogProps.d.ts +5 -0
- package/dist/Components/ContactForm/ContactFormProps.d.ts +13 -0
- package/dist/Components/CouponField/CouponFieldProps.d.ts +16 -0
- package/dist/Components/CustomModulesTable/CustomModulesTable.d.ts +1 -0
- package/dist/Components/CustomModulesTable/CustomModulesTable.js +1 -0
- package/dist/Components/CustomModulesTable/CustomModulesTableProps.d.ts +17 -0
- package/dist/Components/CustomModulesTable/DeleteModuleModal.d.ts +1 -0
- package/dist/Components/CustomModulesTable/DeleteModuleModal.js +1 -0
- package/dist/Components/CustomModulesTable/EditModuleModal.d.ts +1 -0
- package/dist/Components/CustomModulesTable/EditModuleModal.js +1 -0
- package/dist/Components/DatePicker/DatePickerProps.d.ts +7 -1
- package/dist/Components/DetailSections/DetailSectionsProps.d.ts +22 -0
- package/dist/Components/Drawer/DrawerProps.d.ts +1 -1
- package/dist/Components/Dropdown/DropdownProps.d.ts +1 -0
- package/dist/Components/Editor/EditorProps.d.ts +33 -0
- package/dist/Components/Editor/editorTokens.d.ts +3 -0
- package/dist/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtpProps.d.ts +8 -0
- package/dist/Components/FilePreview/FilePreviewProps.d.ts +4 -0
- package/dist/Components/FileUploader/FileUploaderProps.d.ts +1 -0
- package/dist/Components/FilterBar/FilterBarProps.d.ts +2 -0
- package/dist/Components/FormDrawer/FormDrawer.d.ts +1 -0
- package/dist/Components/FormDrawer/FormDrawer.js +1 -0
- package/dist/Components/FormDrawer/FormDrawerProps.d.ts +3 -0
- package/dist/Components/FormField/FormField.d.ts +1 -0
- package/dist/Components/FormField/FormField.js +1 -0
- package/dist/Components/FormField/FormFieldProps.d.ts +4 -0
- package/dist/Components/Header/Header.d.ts +1 -0
- package/dist/Components/Header/Header.js +1 -0
- package/dist/Components/Header/HeaderActions.d.ts +16 -0
- package/dist/Components/Header/HeaderActions.js +1 -0
- package/dist/Components/Header/HeaderProps.d.ts +22 -0
- package/dist/Components/Header/components/desktopMenu.d.ts +1 -0
- package/dist/Components/Header/components/desktopMenu.js +1 -0
- package/dist/Components/Header/components/mobileMenu.d.ts +1 -0
- package/dist/Components/Header/components/mobileMenu.js +1 -0
- package/dist/Components/KanbanBoard/KanbanActions/KanbanActions.d.ts +1 -1
- package/dist/Components/KanbanBoard/KanbanActions/KanbanActions.js +1 -1
- package/dist/Components/KanbanBoard/KanbanBoardProps.d.ts +11 -0
- package/dist/Components/Kbd/Kbd.d.ts +1 -0
- package/dist/Components/Kbd/Kbd.js +1 -0
- package/dist/Components/Kbd/KbdProps.d.ts +4 -0
- package/dist/Components/LauncherTrigger/LauncherTrigger.d.ts +1 -0
- package/dist/Components/LauncherTrigger/LauncherTrigger.js +1 -0
- package/dist/Components/LauncherTrigger/LauncherTriggerProps.d.ts +1 -0
- package/dist/Components/LimitReachedModal/LimitReachedModal.d.ts +1 -0
- package/dist/Components/LimitReachedModal/LimitReachedModal.js +1 -0
- package/dist/Components/LimitReachedModal/LimitReachedModalProps.d.ts +7 -0
- package/dist/Components/Loading/LoadingProps.d.ts +2 -0
- package/dist/Components/MediaGallery/MediaGalleryProps.d.ts +7 -1
- package/dist/Components/MediaGallery/MediaLightboxProps.d.ts +5 -0
- package/dist/Components/MediaViewer/components/MediaAudioPlayer.d.ts +1 -0
- package/dist/Components/MediaViewer/components/MediaAudioPlayer.js +1 -0
- package/dist/Components/MediaViewer/components/MediaDocumentStage.d.ts +1 -0
- package/dist/Components/MediaViewer/components/MediaDocumentStage.js +1 -0
- package/dist/Components/MediaViewer/components/MediaImageViewer.d.ts +1 -0
- package/dist/Components/MediaViewer/components/MediaImageViewer.js +1 -0
- package/dist/Components/MediaViewer/components/MediaVideoPlayer.d.ts +1 -0
- package/dist/Components/MediaViewer/components/MediaVideoPlayer.js +1 -0
- package/dist/Components/MediaViewer/components/MediaVideoPlayerProps.d.ts +1 -0
- package/dist/Components/MediaViewer/hooks/useFileViewer.d.ts +1 -0
- package/dist/Components/MediaViewer/mediaItems.d.ts +25 -0
- package/dist/Components/MediaViewer/mediaItems.js +5 -0
- package/dist/Components/Modal/Modal.d.ts +3 -0
- package/dist/Components/Modal/Modal.js +3 -0
- package/dist/Components/Modal/ModalProps.d.ts +6 -1
- package/dist/Components/MoreItems/MoreItemsProps.d.ts +2 -0
- package/dist/Components/MultiSelect/MultiSelect.d.ts +1 -0
- package/dist/Components/MultiSelect/MultiSelect.js +1 -0
- package/dist/Components/MultiSelect/MultiSelectProps.d.ts +13 -0
- package/dist/Components/NavLauncher/NavLauncher.js +3 -0
- package/dist/Components/NavLauncher/NavLauncherProps.d.ts +58 -0
- package/dist/Components/NavLauncher/engine/engine.d.ts +19 -0
- package/dist/Components/NavLauncher/launcherMotion.d.ts +19 -0
- package/dist/Components/NavLauncher/launcherMotion.js +15 -0
- package/dist/Components/NavLauncher/match.d.ts +34 -0
- package/dist/Components/NavigationBar/NavigationBar.d.ts +1 -0
- package/dist/Components/NavigationBar/NavigationBar.js +1 -0
- package/dist/Components/NavigationBar/NavigationBarProps.d.ts +15 -0
- package/dist/Components/NoteTextArea/NoteTextAreaProps.d.ts +2 -1
- package/dist/Components/NotificationBell/NotificationBellProps.d.ts +27 -0
- package/dist/Components/NotificationBell/notificationHelpers.d.ts +13 -0
- package/dist/Components/NumberInput/NumberInputProps.d.ts +1 -1
- package/dist/Components/OffersList/OffersListProps.d.ts +12 -1
- package/dist/Components/OptionChip/OptionChipProps.d.ts +5 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.d.ts +10 -0
- package/dist/Components/OrderSummary/OrderSummaryProps.d.ts +10 -0
- package/dist/Components/OrgSwitcher/OrgSwitcher.d.ts +1 -0
- package/dist/Components/OrgSwitcher/OrgSwitcher.js +11 -3
- package/dist/Components/OrgSwitcher/OrgSwitcherProps.d.ts +1 -0
- package/dist/Components/OrganizationDetails/OrganizationDetailsProps.d.ts +52 -0
- package/dist/Components/PageHeader/PageHeaderProps.d.ts +1 -0
- package/dist/Components/Pagination/PaginationProps.d.ts +4 -0
- package/dist/Components/PaymentOption/PaymentOptionProps.d.ts +9 -0
- package/dist/Components/PincodeChecker/PincodeCheckerProps.d.ts +13 -0
- package/dist/Components/PlanPill/PlanPill.d.ts +1 -0
- package/dist/Components/PlanPill/PlanPill.js +1 -0
- package/dist/Components/PlanPill/PlanPillProps.d.ts +1 -0
- package/dist/Components/PriceBlock/PriceBlockProps.d.ts +6 -0
- package/dist/Components/ProductBadges/ProductBadgesProps.d.ts +3 -0
- package/dist/Components/ProductCard/ProductCardProps.d.ts +10 -0
- package/dist/Components/ProductCard/QuickAddSheetProps.d.ts +8 -0
- package/dist/Components/ProductDetails/ProductDetailsProps.d.ts +25 -1
- package/dist/Components/ProfileCard/ProfileCardProps.d.ts +1 -1
- package/dist/Components/QuantityStepper/QuantityStepperProps.d.ts +9 -0
- package/dist/Components/QueryState/QueryStateProps.d.ts +2 -0
- package/dist/Components/RadioButton/RadioButtonProps.d.ts +1 -1
- package/dist/Components/Rating/RatingProps.d.ts +2 -0
- package/dist/Components/Reorder/ReorderProps.d.ts +6 -0
- package/dist/Components/ReviewList/ReviewListProps.d.ts +21 -0
- package/dist/Components/ReviewSummary/ReviewSummaryProps.d.ts +8 -1
- package/dist/Components/RolesPermission/RolesPermissionProps.d.ts +59 -1
- package/dist/Components/SearchSelect/SearchSelect.js +17 -5
- package/dist/Components/SearchSelect/SearchSelectProps.d.ts +12 -0
- package/dist/Components/SectionRail/SectionRail.d.ts +1 -0
- package/dist/Components/SectionRail/SectionRail.js +1 -0
- package/dist/Components/SectionRail/SectionRailProps.d.ts +4 -0
- package/dist/Components/SegmentedControl/SegmentedControlProps.d.ts +4 -0
- package/dist/Components/Select/Select.styles.js +25 -0
- package/dist/Components/Select/SelectNative.d.ts +10 -0
- package/dist/Components/Select/SelectNative.js +11 -4
- package/dist/Components/Select/SelectPopup.js +45 -14
- package/dist/Components/Select/SelectProps.d.ts +46 -2
- package/dist/Components/Select/selectKeyboardRing.d.ts +2 -0
- package/dist/Components/Select/selectKeyboardRing.js +7 -0
- package/dist/Components/Select/selectRowInk.d.ts +14 -0
- package/dist/Components/Select/selectRowInk.js +41 -0
- package/dist/Components/SelectSearch/SelectSearch.js +8 -2
- package/dist/Components/SelectSearch/SelectSearchProps.d.ts +9 -0
- package/dist/Components/SelectV2/SelectV2Props.d.ts +7 -0
- package/dist/Components/SideBar/SecondaryBar.d.ts +1 -0
- package/dist/Components/SideBar/SecondaryBar.js +1 -0
- package/dist/Components/SideBar/SideBar.d.ts +1 -0
- package/dist/Components/SideBar/SideBar.js +1 -0
- package/dist/Components/SideBar/SideBarProps.d.ts +32 -0
- package/dist/Components/SideBar/sidebarAccentColors.d.ts +2 -0
- package/dist/Components/SignInActivityTable/SignInActivityTable.d.ts +1 -0
- package/dist/Components/SignInActivityTable/SignInActivityTable.js +1 -0
- package/dist/Components/SignInActivityTable/SignInActivityTableProps.d.ts +2 -0
- package/dist/Components/SpecTable/SpecTableProps.d.ts +9 -0
- package/dist/Components/StageProgress/StageProgressProps.d.ts +2 -0
- package/dist/Components/StageProgress/StepperStage.d.ts +1 -0
- package/dist/Components/StageProgress/StepperStage.js +1 -0
- package/dist/Components/StatCard/StatCardProps.d.ts +1 -0
- package/dist/Components/StatusTag/StatusTagProps.d.ts +4 -0
- package/dist/Components/StickyBuyBar/StickyBuyBar.d.ts +1 -0
- package/dist/Components/StickyBuyBar/StickyBuyBar.js +1 -0
- package/dist/Components/StickyBuyBar/StickyBuyBarProps.d.ts +6 -0
- package/dist/Components/StockStatus/StockStatusProps.d.ts +2 -0
- package/dist/Components/Switch/SwitchProps.d.ts +4 -0
- package/dist/Components/Table/TableProps.d.ts +20 -1
- package/dist/Components/Table/components/TableBody.js +10 -1
- package/dist/Components/Table/components/rowFocusRing.d.ts +21 -0
- package/dist/Components/Table/components/rowFocusRing.js +20 -0
- package/dist/Components/Table/variants/tokens.d.ts +4 -0
- package/dist/Components/Tabs/TabsContext.d.ts +14 -0
- package/dist/Components/Tabs/TabsProps.d.ts +18 -0
- package/dist/Components/Tabs/components/CountBadge.d.ts +4 -0
- package/dist/Components/Tabs/components/TabPanels.d.ts +1 -0
- package/dist/Components/Tabs/components/TabPanels.js +1 -0
- package/dist/Components/Tabs/tabStyles.d.ts +4 -0
- package/dist/Components/Tag/TagProps.d.ts +3 -0
- package/dist/Components/TagInput/TagInput.d.ts +1 -0
- package/dist/Components/TagInput/TagInput.js +1 -0
- package/dist/Components/TagInput/TagInputProps.d.ts +2 -0
- package/dist/Components/TimePicker/TimePicker.d.ts +1 -0
- package/dist/Components/TimePicker/TimePicker.js +1 -0
- package/dist/Components/TimePicker/TimePickerProps.d.ts +2 -0
- package/dist/Components/Timeline/TimelineProps.d.ts +7 -1
- package/dist/Components/Toggle/TableToggleProps.d.ts +2 -0
- package/dist/Components/ToggleSwitch/ToggleSwitchProps.d.ts +2 -0
- package/dist/Components/ToolTip/OverflowToolTip.d.ts +1 -0
- package/dist/Components/ToolTip/OverflowToolTip.js +1 -1
- package/dist/Components/ToolTip/ToolTipProps.d.ts +1 -0
- package/dist/Components/TrustBadges/TrustBadgesProps.d.ts +4 -0
- package/dist/Components/UpgradeButton/UpgradeButton.d.ts +1 -0
- package/dist/Components/UpgradeButton/UpgradeButton.js +1 -0
- package/dist/Components/UpgradeButton/UpgradeButtonProps.d.ts +4 -1
- package/dist/Components/UserDetails/UserDetailsProps.d.ts +58 -0
- package/dist/Components/VariantSelector/VariantSelectorProps.d.ts +4 -0
- package/dist/Components/WishlistToggle/WishlistToggleProps.d.ts +4 -0
- package/dist/Components/WizardDialog/WizardDialogProps.d.ts +15 -0
- package/dist/Components/WizardDialog/wizardSteps.d.ts +17 -5
- package/dist/Components/WorkspaceWindow/WorkspaceTrayPreview.d.ts +1 -0
- package/dist/Components/WorkspaceWindow/WorkspaceTrayPreview.js +1 -1
- package/dist/Components/WorkspaceWindow/WorkspaceWindow.d.ts +2 -0
- package/dist/Components/WorkspaceWindow/WorkspaceWindow.js +2 -1
- package/dist/Components/WorkspaceWindow/WorkspaceWindowProps.d.ts +13 -0
- package/dist/Theme/tokens/brands/index.d.ts +1 -1
- package/dist/Theme/tokens/brands/index.js +1 -1
- package/dist/Theme/tokens/builders/rowStates.d.ts +6 -0
- package/dist/Theme/tokens/builders/rowStates.js +19 -1
- package/dist/Theme/tokens/builders/scrollShadow.d.ts +1 -0
- package/dist/Theme/tokens/builders/scrollShadow.js +16 -0
- package/dist/esm/Components/AppSwitcher/AppSwitcher.js +1 -0
- package/dist/esm/Components/AppearanceSettings/AppearanceSettings.js +1 -0
- package/dist/esm/Components/AudioRecorder/AudioRecorder.js +1 -0
- package/dist/esm/Components/Avatar/AvatarGroup.js +1 -0
- package/dist/esm/Components/BulkSelectionBar/BulkSelectionBar.js +1 -0
- package/dist/esm/Components/Button/Button.js +1 -0
- package/dist/esm/Components/ButtonGroupIcon/ButtonGroupIcon.js +1 -0
- package/dist/esm/Components/CalendarGrid/CalendarGrid.js +1 -0
- package/dist/esm/Components/Card/PaymentCard/PaymentCard.js +1 -0
- package/dist/esm/Components/ChoiceCard/ChoiceCard.js +1 -0
- package/dist/esm/Components/ChoiceCard/ChoiceCardGroup.js +1 -0
- package/dist/esm/Components/ConfirmDialog/ConfirmDialog.js +1 -0
- package/dist/esm/Components/CustomModulesTable/CustomModulesTable.js +1 -0
- package/dist/esm/Components/CustomModulesTable/DeleteModuleModal.js +1 -0
- package/dist/esm/Components/CustomModulesTable/EditModuleModal.js +1 -0
- package/dist/esm/Components/FormDrawer/FormDrawer.js +1 -0
- package/dist/esm/Components/FormField/FormField.js +1 -0
- package/dist/esm/Components/Header/Header.js +1 -0
- package/dist/esm/Components/Header/HeaderActions.js +1 -0
- package/dist/esm/Components/Header/components/desktopMenu.js +1 -0
- package/dist/esm/Components/Header/components/mobileMenu.js +1 -0
- package/dist/esm/Components/KanbanBoard/KanbanActions/KanbanActions.js +1 -1
- package/dist/esm/Components/Kbd/Kbd.js +1 -0
- package/dist/esm/Components/LauncherTrigger/LauncherTrigger.js +1 -0
- package/dist/esm/Components/LimitReachedModal/LimitReachedModal.js +1 -0
- package/dist/esm/Components/MediaViewer/components/MediaAudioPlayer.js +1 -0
- package/dist/esm/Components/MediaViewer/components/MediaDocumentStage.js +1 -0
- package/dist/esm/Components/MediaViewer/components/MediaImageViewer.js +1 -0
- package/dist/esm/Components/MediaViewer/components/MediaVideoPlayer.js +1 -0
- package/dist/esm/Components/MediaViewer/mediaItems.js +5 -0
- package/dist/esm/Components/Modal/Modal.js +3 -0
- package/dist/esm/Components/MultiSelect/MultiSelect.js +1 -0
- package/dist/esm/Components/NavLauncher/NavLauncher.js +4 -1
- package/dist/esm/Components/NavLauncher/launcherMotion.js +11 -0
- package/dist/esm/Components/NavigationBar/NavigationBar.js +1 -0
- package/dist/esm/Components/OrgSwitcher/OrgSwitcher.js +13 -5
- package/dist/esm/Components/PlanPill/PlanPill.js +1 -0
- package/dist/esm/Components/SearchSelect/SearchSelect.js +19 -7
- package/dist/esm/Components/SectionRail/SectionRail.js +1 -0
- package/dist/esm/Components/Select/Select.styles.js +26 -1
- package/dist/esm/Components/Select/SelectNative.js +12 -5
- package/dist/esm/Components/Select/SelectPopup.js +47 -16
- package/dist/esm/Components/Select/selectKeyboardRing.js +3 -0
- package/dist/esm/Components/Select/selectRowInk.js +33 -0
- package/dist/esm/Components/SelectSearch/SelectSearch.js +10 -4
- package/dist/esm/Components/SideBar/SecondaryBar.js +1 -0
- package/dist/esm/Components/SideBar/SideBar.js +1 -0
- package/dist/esm/Components/SignInActivityTable/SignInActivityTable.js +1 -0
- package/dist/esm/Components/StageProgress/StepperStage.js +1 -0
- package/dist/esm/Components/StickyBuyBar/StickyBuyBar.js +1 -0
- package/dist/esm/Components/Table/components/TableBody.js +10 -1
- package/dist/esm/Components/Table/components/rowFocusRing.js +16 -0
- package/dist/esm/Components/Tabs/components/TabPanels.js +1 -0
- package/dist/esm/Components/TagInput/TagInput.js +1 -0
- package/dist/esm/Components/TimePicker/TimePicker.js +1 -0
- package/dist/esm/Components/ToolTip/OverflowToolTip.js +1 -1
- package/dist/esm/Components/UpgradeButton/UpgradeButton.js +1 -0
- package/dist/esm/Components/WorkspaceWindow/WorkspaceTrayPreview.js +1 -1
- package/dist/esm/Components/WorkspaceWindow/WorkspaceWindow.js +2 -1
- package/dist/esm/Theme/tokens/brands/index.js +1 -1
- package/dist/esm/Theme/tokens/builders/rowStates.js +18 -1
- package/dist/esm/Theme/tokens/builders/scrollShadow.js +15 -0
- package/package.json +1 -1
|
@@ -45,8 +45,11 @@ const surfaceRaised_1 = require("../../Theme/tokens/builders/surfaceRaised");
|
|
|
45
45
|
const focusRing_styles_1 = require("../../Theme/chakra/focusRing.styles");
|
|
46
46
|
const rowStates_1 = require("../../Theme/tokens/builders/rowStates");
|
|
47
47
|
const optionRowInk_1 = require("./optionRowInk");
|
|
48
|
+
const selectRowInk_1 = require("./selectRowInk");
|
|
49
|
+
const selectKeyboardRing_1 = require("./selectKeyboardRing");
|
|
48
50
|
const optionRowSizes_1 = require("../../Theme/tokens/primitives/optionRowSizes");
|
|
49
51
|
const scrollbar_1 = require("../../Theme/tokens/builders/scrollbar");
|
|
52
|
+
const scrollShadow_1 = require("../../Theme/tokens/builders/scrollShadow");
|
|
50
53
|
const controlSizes_1 = require("../../Theme/tokens/primitives/controlSizes");
|
|
51
54
|
const motion_1 = require("../../Theme/tokens/primitives/motion");
|
|
52
55
|
const borderWidths_1 = require("../../Theme/tokens/primitives/borderWidths");
|
|
@@ -67,11 +70,13 @@ const DEFAULT_MAX_VISIBLE_CHIPS = 6;
|
|
|
67
70
|
const VIRTUAL_OVERSCAN = 4;
|
|
68
71
|
const DECORATIVE_CHECKBOX_SX = { "& input": { visibility: "hidden" } };
|
|
69
72
|
const GROUP_HEADER_ESTIMATE_PX = 29;
|
|
70
|
-
const LIST_PADDING_PX = 4;
|
|
71
73
|
const NO_ROW = -1;
|
|
72
74
|
const SELECT_ALL_ROW = -2;
|
|
73
75
|
const CREATE_ROW = -3;
|
|
74
76
|
const FOOTER_ROW = -4;
|
|
77
|
+
const CHECK_SLOT_MIN_PX = 16;
|
|
78
|
+
const SELECT_ALL_RULE_MARGIN_PX = 4;
|
|
79
|
+
const DISABLED_CONTENT_SX = { "& > *": { opacity: selectRowInk_1.SELECT_ROW_DISABLED_CONTENT_OPACITY } };
|
|
75
80
|
const truncateLabel = (label, max) => max !== undefined && label.length > max ? `${label.slice(0, max)}…` : label;
|
|
76
81
|
const asIdSet = (values) => new Set((values !== null && values !== void 0 ? values : []).map((v) => v.toString()));
|
|
77
82
|
/** Regression-guarded id scheme — tickets e2e (`e2e/tests/helpers/selectV2.ts`) resolves it verbatim. */
|
|
@@ -80,19 +85,26 @@ const parseRemToPx = (value, fallbackPx) => {
|
|
|
80
85
|
const match = /^(\d*\.?\d+)rem$/.exec(value);
|
|
81
86
|
return match ? parseFloat(match[1]) * 16 : fallbackPx;
|
|
82
87
|
};
|
|
83
|
-
const OptionRow = react_1.default.memo(function OptionRow({ option, index, listboxId, isSelected, isActive, isMulti, theme, backgrounds, spec, renderOption, onSelect, onActivate, }) {
|
|
88
|
+
const OptionRow = react_1.default.memo(function OptionRow({ option, index, listboxId, isSelected, isActive, isMulti, theme, backgrounds, ink, showRing, spec, renderOption, renderOptionEnd, optionAction, checkPlacement, onSelect, onActivate, }) {
|
|
84
89
|
const isSingleSelected = isSelected && !isMulti;
|
|
85
|
-
|
|
90
|
+
const solidDisabledInk = option.isDisabled ? ink.disabled : null;
|
|
91
|
+
const checkSlotPx = Math.max(CHECK_SLOT_MIN_PX, spec.iconSize);
|
|
92
|
+
const checkSlot = ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", "aria-hidden": true, display: "inline-flex", justifyContent: "center", flexShrink: 0, width: `${checkSlotPx}px`, children: isSingleSelected ? (0, jsx_runtime_1.jsx)(react_2.Box, { as: lucide_react_1.Check, size: spec.iconSize, color: theme.colors.accentText }) : null }));
|
|
93
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Box, { id: optionDomId(listboxId, option.id), "data-index": index, role: "option", "aria-selected": isSelected, "aria-disabled": option.isDisabled, onMouseEnter: () => onActivate(index), onClick: () => onSelect(option), mx: spec.mx, px: spec.px, py: spec.py, minH: spec.minH, borderRadius: "md", cursor: option.isDisabled ? "not-allowed" : "pointer", display: "flex", alignItems: "center", gap: spec.gap, fontSize: spec.fontSize, fontWeight: (0, optionRowInk_1.optionRowWeight)(isSingleSelected), color: solidDisabledInk !== null && solidDisabledInk !== void 0 ? solidDisabledInk : (isSingleSelected ? ink.selected : ink.rest), bg: (0, selectRowInk_1.selectRowFill)(backgrounds, { isSelected, isActive }), boxShadow: showRing ? (0, selectKeyboardRing_1.keyboardRingShadow)(backgrounds.keyboardRing) : undefined, transition: ROW_TRANSITION, sx: option.isDisabled && !ink.disabled ? { ...(0, motion_2.reducedMotionSx)(), ...DISABLED_CONTENT_SX } : (0, motion_2.reducedMotionSx)(), children: [!isMulti && checkPlacement === "start" ? checkSlot : null, isMulti ? ((0, jsx_runtime_1.jsx)(react_2.Checkbox, { id: `${optionDomId(listboxId, option.id)}-checkbox`, isChecked: isSelected, isDisabled: option.isDisabled, pointerEvents: "none", tabIndex: -1, sx: DECORATIVE_CHECKBOX_SX })) : null, renderOption ? ((0, jsx_runtime_1.jsx)(react_2.Box, { flex: 1, minW: 0, children: renderOption(option, { isSelected, isActive }) })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [option.icon ? ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "inline-flex", flexShrink: 0, children: option.icon })) : null, (0, jsx_runtime_1.jsxs)(react_2.Box, { flex: 1, minW: 0, isTruncated: true, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", isTruncated: true, children: option.label }), option.description ? ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "block", fontSize: spec.descriptionFontSize, color: solidDisabledInk !== null && solidDisabledInk !== void 0 ? solidDisabledInk : ink.description, isTruncated: true, children: option.description })) : null] })] })), renderOptionEnd ? ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "inline-flex", flexShrink: 0, children: renderOptionEnd(option, { isSelected, isActive }) })) : null, optionAction ? ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", "aria-hidden": true, title: optionAction.label, onMouseDown: (event) => event.preventDefault(), onClick: (event) => {
|
|
94
|
+
event.stopPropagation();
|
|
95
|
+
optionAction.onAction(option);
|
|
96
|
+
}, display: "inline-flex", alignItems: "center", justifyContent: "center", flexShrink: 0, cursor: "pointer", color: ink.description, _hover: { color: ink.selected }, children: optionAction.icon })) : null, !isMulti && checkPlacement === "end" ? checkSlot : null] }));
|
|
86
97
|
});
|
|
87
98
|
/** The unified `Select`'s popup mode (`native={false}`) — absorbs SelectV2's behaviour, plus clear/create/groups/virtualization. */
|
|
88
99
|
const SelectPopup = (0, react_1.forwardRef)(function SelectPopup(props, ref) {
|
|
89
100
|
var _a, _b, _c, _d, _e, _f;
|
|
90
|
-
const { options = [], id, name, placeholder = "Select Option", label, error = false, errorMessage, helperText, isDisabled = false, isReadOnly = false, isRequired = false, isInformation = false, informationMessage, size = controlSizes_1.DEFAULT_CONTROL_SIZE, isSearchable = true, width, formControlStyle, onBlur, onFocus, renderOption, renderValue, maxMenuHeight = "16rem", defaultOpen = false, isLoading = false, loadingText = "Loading...", onLoadMore, hasMore, onSearchChange, searchValue, defaultSearchValue, searchDebounceMs = 0, filterOptions, isClearable = false, onClear, noOptionsMessage, onCreate, createLabel, createWhen = "no-options", footerAction, searchFields, filterOption, isFieldLoading = false, rightIcon, virtualizeAfter, "data-testid": dataTestId, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, } = props;
|
|
101
|
+
const { options = [], id, name, placeholder = "Select Option", label, error = false, errorMessage, helperText, isDisabled = false, isReadOnly = false, isRequired = false, isInformation = false, informationMessage, size = controlSizes_1.DEFAULT_CONTROL_SIZE, isSearchable = true, width, formControlStyle, onBlur, onFocus, renderOption, renderOptionEnd, optionAction, checkPlacement = "end", renderValue, maxMenuHeight = "16rem", defaultOpen = false, isLoading = false, loadingText = "Loading...", onLoadMore, hasMore, onSearchChange, searchValue, defaultSearchValue, searchDebounceMs = 0, filterOptions, isClearable = false, onClear, noOptionsMessage, onCreate, createLabel, createWhen = "no-options", footerAction, searchFields, filterOption, isFieldLoading = false, rightIcon, virtualizeAfter, "data-testid": dataTestId, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, } = props;
|
|
91
102
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
92
103
|
const { colors } = theme;
|
|
93
104
|
const { isOpen, onOpen, onClose } = (0, react_2.useDisclosure)({ defaultIsOpen: defaultOpen });
|
|
94
105
|
const requestExclusiveOpen = (0, useExclusiveOverlay_1.useExclusiveOverlay)(isOpen, onClose);
|
|
95
106
|
const [activeIndex, setActiveIndex] = (0, react_1.useState)(-1);
|
|
107
|
+
const [isKeyboardNav, setIsKeyboardNav] = (0, react_1.useState)(false);
|
|
96
108
|
const triggerRef = (0, react_1.useRef)(null);
|
|
97
109
|
const mergedTriggerRef = (0, react_2.useMergeRefs)(triggerRef, ref);
|
|
98
110
|
const filterInputRef = (0, react_1.useRef)(null);
|
|
@@ -154,6 +166,7 @@ const SelectPopup = (0, react_1.forwardRef)(function SelectPopup(props, ref) {
|
|
|
154
166
|
if (!isSearchControlled)
|
|
155
167
|
setUncontrolledSearch("");
|
|
156
168
|
setActiveIndex(-1);
|
|
169
|
+
setIsKeyboardNav(false);
|
|
157
170
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
158
171
|
}, [onClose, onBlur, props.isMulti, isSearchControlled]);
|
|
159
172
|
const handleOpen = () => {
|
|
@@ -256,13 +269,14 @@ const SelectPopup = (0, react_1.forwardRef)(function SelectPopup(props, ref) {
|
|
|
256
269
|
return () => cancelAnimationFrame(frame);
|
|
257
270
|
}, [isOpen, isSearchable]);
|
|
258
271
|
const spec = (0, react_1.useMemo)(() => (0, optionRowSizes_1.optionRowSpec)(size), [size]);
|
|
272
|
+
const listPaddingPx = parseRemToPx(spec.mx, 6);
|
|
259
273
|
const maxMenuHeightPx = (0, react_1.useMemo)(() => parseRemToPx(maxMenuHeight, 256), [maxMenuHeight]);
|
|
260
274
|
const shouldVirtualize = !!virtualizeAfter && filteredOptions.length > virtualizeAfter;
|
|
261
275
|
const [scrollTop, setScrollTop] = (0, react_1.useState)(0);
|
|
262
276
|
// A description, an avatar or a renderOption row outgrows the spec's single-line height.
|
|
263
277
|
const [rowHeightPx, setRowHeightPx] = (0, react_1.useState)(spec.virtualRowHeightPx);
|
|
264
278
|
const [headerHeightPx, setHeaderHeightPx] = (0, react_1.useState)(GROUP_HEADER_ESTIMATE_PX);
|
|
265
|
-
const selectAllLeadPx = showSelectAllRow ? rowHeightPx : 0;
|
|
279
|
+
const selectAllLeadPx = showSelectAllRow ? rowHeightPx + parseInt(borderWidths_1.BORDER_WIDTHS.hairline, 10) + 2 * SELECT_ALL_RULE_MARGIN_PX : 0;
|
|
266
280
|
const windowTop = Math.max(0, scrollTop - selectAllLeadPx);
|
|
267
281
|
const visibleCount = Math.ceil(maxMenuHeightPx / rowHeightPx) + VIRTUAL_OVERSCAN * 2;
|
|
268
282
|
const groupedRows = (0, react_1.useMemo)(() => (hasGroups ? (0, groupedWindow_1.buildGroupedRows)(filteredOptions) : []), [hasGroups, filteredOptions]);
|
|
@@ -330,8 +344,8 @@ const SelectPopup = (0, react_1.forwardRef)(function SelectPopup(props, ref) {
|
|
|
330
344
|
targetTop = groupedLayout.tops[startsGroup ? rowIndex - 1 : rowIndex];
|
|
331
345
|
targetBottom = groupedLayout.tops[rowIndex + 1];
|
|
332
346
|
}
|
|
333
|
-
targetTop += selectAllLeadPx +
|
|
334
|
-
targetBottom += selectAllLeadPx +
|
|
347
|
+
targetTop += selectAllLeadPx + listPaddingPx;
|
|
348
|
+
targetBottom += selectAllLeadPx + listPaddingPx;
|
|
335
349
|
if (targetTop < el.scrollTop) {
|
|
336
350
|
el.scrollTop = targetTop;
|
|
337
351
|
setScrollTop(targetTop);
|
|
@@ -344,7 +358,7 @@ const SelectPopup = (0, react_1.forwardRef)(function SelectPopup(props, ref) {
|
|
|
344
358
|
return;
|
|
345
359
|
}
|
|
346
360
|
(_d = (_c = el.querySelector(`[data-index="${activeIndex}"]`)) === null || _c === void 0 ? void 0 : _c.scrollIntoView) === null || _d === void 0 ? void 0 : _d.call(_c, { block: "nearest" });
|
|
347
|
-
}, [activeIndex, shouldVirtualize, maxMenuHeightPx, rowHeightPx, groupedLayout, groupedRows, selectAllLeadPx, selectAllId, createRowId, footerId]);
|
|
361
|
+
}, [activeIndex, shouldVirtualize, maxMenuHeightPx, rowHeightPx, groupedLayout, groupedRows, selectAllLeadPx, listPaddingPx, selectAllId, createRowId, footerId]);
|
|
348
362
|
const loadMoreInFlightRef = (0, react_1.useRef)(false);
|
|
349
363
|
const prevOptionsLengthRef = (0, react_1.useRef)(options.length);
|
|
350
364
|
const prevIsLoadingRef = (0, react_1.useRef)(isLoading);
|
|
@@ -430,6 +444,8 @@ const SelectPopup = (0, react_1.forwardRef)(function SelectPopup(props, ref) {
|
|
|
430
444
|
const handleListKeyDown = (event) => {
|
|
431
445
|
var _a, _b;
|
|
432
446
|
const isTextInput = ((_a = event.target) === null || _a === void 0 ? void 0 : _a.tagName) === "INPUT";
|
|
447
|
+
if (selectKeyboardRing_1.NAVIGATION_KEYS.has(event.key))
|
|
448
|
+
setIsKeyboardNav(true);
|
|
433
449
|
switch (event.key) {
|
|
434
450
|
case "ArrowDown":
|
|
435
451
|
event.preventDefault();
|
|
@@ -536,8 +552,23 @@ const SelectPopup = (0, react_1.forwardRef)(function SelectPopup(props, ref) {
|
|
|
536
552
|
: showCreateRow && (isCreateImplicit || activeIndex === CREATE_ROW)
|
|
537
553
|
? createRowId
|
|
538
554
|
: undefined;
|
|
539
|
-
const listScrollStyles = (0, react_1.useMemo)(() => (
|
|
540
|
-
|
|
555
|
+
const listScrollStyles = (0, react_1.useMemo)(() => ({
|
|
556
|
+
...(0, scrollbar_1.scrollbarStyles)(colors, "overlay"),
|
|
557
|
+
...(0, scrollShadow_1.scrollShadowStylesVertical)(colors.surfaceRaised),
|
|
558
|
+
}), [colors]);
|
|
559
|
+
const rowBackgrounds = (0, react_1.useMemo)(() => (0, rowStates_1.selectRowBackgrounds)(colors), [colors]);
|
|
560
|
+
const rowInks = (0, react_1.useMemo)(() => ({
|
|
561
|
+
rest: (0, selectRowInk_1.selectRowInk)(colors, false),
|
|
562
|
+
selected: (0, selectRowInk_1.selectRowInk)(colors, true),
|
|
563
|
+
description: (0, selectRowInk_1.selectRowDescriptionInk)(colors),
|
|
564
|
+
disabled: (0, selectRowInk_1.selectRowDisabledInk)(colors),
|
|
565
|
+
}), [colors]);
|
|
566
|
+
const filterPlaceholderInk = (0, react_1.useMemo)(() => (0, selectRowInk_1.selectFilterPlaceholderInk)(colors), [colors]);
|
|
567
|
+
const handlePointerActivate = (0, react_1.useCallback)((index) => {
|
|
568
|
+
setIsKeyboardNav(false);
|
|
569
|
+
setActiveIndex(index);
|
|
570
|
+
}, []);
|
|
571
|
+
const ringShadowFor = (isActive) => isActive && isKeyboardNav ? (0, selectKeyboardRing_1.keyboardRingShadow)(rowBackgrounds.keyboardRing) : undefined;
|
|
541
572
|
const showChips = !!props.isMulti && !renderValue && selectedOptions.length > 0;
|
|
542
573
|
const chipSize = size === "xs" ? "xs" : "sm";
|
|
543
574
|
const maxVisibleChips = props.isMulti ? ((_a = props.maxVisibleChips) !== null && _a !== void 0 ? _a : DEFAULT_MAX_VISIBLE_CHIPS) : 0;
|
|
@@ -580,14 +611,14 @@ const SelectPopup = (0, react_1.forwardRef)(function SelectPopup(props, ref) {
|
|
|
580
611
|
return ((0, jsx_runtime_1.jsxs)(react_2.FormControl, { isInvalid: error, isDisabled: isDisabled, isReadOnly: isReadOnly, style: formControlStyle, width: width, children: [label && ((0, jsx_runtime_1.jsx)(FormLabel_1.TextLabel, { label: label, id: ids.inputId, isRequired: isRequired, isInformation: isInformation, informationMessage: informationMessage })), (0, jsx_runtime_1.jsxs)(react_2.Popover, { isOpen: isOpen, onClose: () => resetAndClose(), placement: "bottom-start", autoFocus: false, returnFocusOnClose: false, gutter: 4, children: [(0, jsx_runtime_1.jsx)(react_2.PopoverAnchor, { children: (0, jsx_runtime_1.jsxs)(react_2.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, "aria-busy": isFieldLoading || 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: [(0, jsx_runtime_1.jsx)(react_2.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 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [visibleChipOptions.map((option) => ((0, jsx_runtime_1.jsx)(Tag_1.default, { label: truncateLabel(String(option.label), chipMaxLength), size: chipSize, variant: "subtle", icon: canRemoveChips ? lucide_react_1.X : undefined, onIconClick: canRemoveChips ? () => handleSelect(option) : undefined }, option.id))), overflowChipCount > 0 && ((0, jsx_runtime_1.jsx)(Tag_1.default, { label: `+${overflowChipCount}`, size: chipSize, variant: "subtle", colorScheme: "gray" }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [triggerIcon ? ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "inline-flex", flexShrink: 0, children: triggerIcon })) : null, (0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", isTruncated: true, children: renderValue ? renderValue(selectedOptions) : defaultTriggerContent() })] })) }), showClear && ((0, jsx_runtime_1.jsx)(react_2.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: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { size: controlSizes_1.CONTROL_SIZES[size].iconSize }) })), isFieldLoading ? ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", "aria-hidden": true, display: "inline-flex", flexShrink: 0, ml: 2, children: (0, jsx_runtime_1.jsx)(react_2.Spinner, { size: "xs", label: "" }) })) : rightIcon ? ("onClick" in rightIcon && isInteractive ? ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "button", type: "button", "aria-label": rightIcon.ariaLabel, onClick: (event) => {
|
|
581
612
|
event.stopPropagation();
|
|
582
613
|
rightIcon.onClick();
|
|
583
|
-
}, onKeyDown: (event) => event.stopPropagation(), display: "inline-flex", alignItems: "center", justifyContent: "center", flexShrink: 0, ml: 2, color: colors.textMuted, _hover: { color: colors.text[700] }, children: rightIcon.icon })) : ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", "aria-hidden": true, display: "inline-flex", flexShrink: 0, ml: 2, color: colors.textMuted, children: rightIcon.icon }))) : ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "inline-flex", flexShrink: 0, ml: 2, transition: CHEVRON_TRANSITION, transform: isOpen ? "rotate(180deg)" : "rotate(0deg)", color: colors.textMuted, sx: (0, motion_2.reducedMotionSx)(), children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { size: controlSizes_1.CONTROL_SIZES[size].iconSize }) }))] }) }), (0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsxs)(react_2.PopoverContent, { "aria-label": (_d = label !== null && label !== void 0 ? label : ariaLabel) !== null && _d !== void 0 ? _d : placeholder, 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: [(0, jsx_runtime_1.jsx)(react_2.Box, { p: spec.mx, borderBottom: `${borderWidths_1.BORDER_WIDTHS.hairline} solid ${(0, surfaceRaised_1.raisedRule)(colors)}`, display: isSearchable ? undefined : "none", children: (0, jsx_runtime_1.jsx)(react_2.Input, { ref: filterInputRef, id: filterInputId, size: size, px: spec.px, placeholder: "Type to filter...", value: currentSearch, onChange: handleFilterChange, "aria-activedescendant": activeDescendantId, "aria-controls": listboxId, "aria-label": "Filter options", tabIndex: isSearchable ? undefined : -1 }) }), (0, jsx_runtime_1.jsxs)(react_2.Box, { id: listboxId, ref: listRef, role: "listbox", "aria-label": (_e = label !== null && label !== void 0 ? label : ariaLabel) !== null && _e !== void 0 ? _e : placeholder, "aria-multiselectable": props.isMulti || undefined, "aria-busy": isLoading || undefined, maxH: maxMenuHeight, overflowY: "auto", py:
|
|
614
|
+
}, onKeyDown: (event) => event.stopPropagation(), display: "inline-flex", alignItems: "center", justifyContent: "center", flexShrink: 0, ml: 2, color: colors.textMuted, _hover: { color: colors.text[700] }, children: rightIcon.icon })) : ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", "aria-hidden": true, display: "inline-flex", flexShrink: 0, ml: 2, color: colors.textMuted, children: rightIcon.icon }))) : ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "inline-flex", flexShrink: 0, ml: 2, transition: CHEVRON_TRANSITION, transform: isOpen ? "rotate(180deg)" : "rotate(0deg)", color: colors.textMuted, sx: (0, motion_2.reducedMotionSx)(), children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { size: controlSizes_1.CONTROL_SIZES[size].iconSize }) }))] }) }), (0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsxs)(react_2.PopoverContent, { "aria-label": (_d = label !== null && label !== void 0 ? label : ariaLabel) !== null && _d !== void 0 ? _d : placeholder, 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: [(0, jsx_runtime_1.jsx)(react_2.Box, { p: spec.mx, borderBottom: `${borderWidths_1.BORDER_WIDTHS.hairline} solid ${(0, surfaceRaised_1.raisedRule)(colors)}`, display: isSearchable ? undefined : "none", children: (0, jsx_runtime_1.jsx)(react_2.Input, { ref: filterInputRef, id: filterInputId, size: size, px: spec.px, placeholder: "Type to filter...", _placeholder: filterPlaceholderInk ? { color: filterPlaceholderInk } : undefined, value: currentSearch, onChange: handleFilterChange, "aria-activedescendant": activeDescendantId, "aria-controls": listboxId, "aria-label": "Filter options", tabIndex: isSearchable ? undefined : -1 }) }), (0, jsx_runtime_1.jsxs)(react_2.Box, { id: listboxId, ref: listRef, role: "listbox", "aria-label": (_e = label !== null && label !== void 0 ? label : ariaLabel) !== null && _e !== void 0 ? _e : placeholder, "aria-multiselectable": props.isMulti || undefined, "aria-busy": isLoading || undefined, maxH: maxMenuHeight, overflowY: "auto", py: spec.mx, sx: listScrollStyles, onScroll: handleListScroll, children: [filteredOptions.length === 0 && !isLoading && !showCreateRow && ((0, jsx_runtime_1.jsx)(react_2.Box, { mx: spec.mx, px: spec.px, py: spec.py, fontSize: spec.fontSize, color: colors.textMuted, children: noOptionsMessage !== null && noOptionsMessage !== void 0 ? noOptionsMessage : "No Options" })), showSelectAllRow && ((0, jsx_runtime_1.jsxs)(react_2.Box, { id: selectAllId, role: "option", "aria-selected": allFilteredSelected, onClick: handleSelectAll, onMouseEnter: () => handlePointerActivate(SELECT_ALL_ROW), mx: spec.mx, px: spec.px, py: spec.py, minH: spec.minH, borderRadius: "md", cursor: "pointer", display: "flex", alignItems: "center", gap: spec.gap, fontSize: spec.fontSize, color: rowInks.rest, bg: (0, selectRowInk_1.selectRowFill)(rowBackgrounds, { isSelected: false, isActive: activeIndex === SELECT_ALL_ROW }), boxShadow: ringShadowFor(activeIndex === SELECT_ALL_ROW), transition: ROW_TRANSITION, sx: (0, motion_2.reducedMotionSx)(), children: [(0, jsx_runtime_1.jsx)(react_2.Checkbox, { isChecked: allFilteredSelected, pointerEvents: "none", tabIndex: -1, sx: DECORATIVE_CHECKBOX_SX }), allFilteredSelected ? "Unselect All" : "Select All"] })), showSelectAllRow && ((0, jsx_runtime_1.jsx)(react_2.Box, { role: "presentation", mx: spec.mx, my: `${SELECT_ALL_RULE_MARGIN_PX}px`, height: borderWidths_1.BORDER_WIDTHS.hairline, bg: (0, surfaceRaised_1.raisedRule)(colors) })), hasGroups
|
|
584
615
|
? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [topPadPx > 0 && (0, jsx_runtime_1.jsx)(react_2.Box, { height: `${topPadPx}px` }), renderedGroupedRows.map((row) => {
|
|
585
616
|
var _a;
|
|
586
|
-
return row.kind === "header" ? ((0, jsx_runtime_1.jsx)(react_2.Box, { "data-group-header": shouldVirtualize ? "" : undefined, mx: spec.mx, px: spec.px, pt: 2, pb: 1, fontSize: "xs-minus", fontWeight: 600, textTransform: "uppercase", letterSpacing: "0.03em", color: colors.textMuted, children: row.group }, row.key)) : ((0, jsx_runtime_1.jsx)(OptionRow, { option: row.option, index: row.index, listboxId: listboxId, isSelected: selectedIds.has(row.option.id.toString()), isActive: row.index === activeIndex, isMulti: (_a = props.isMulti) !== null && _a !== void 0 ? _a : false, theme: theme, backgrounds: rowBackgrounds, spec: spec, renderOption: renderOption, onSelect: handleSelect, onActivate:
|
|
617
|
+
return row.kind === "header" ? ((0, jsx_runtime_1.jsx)(react_2.Box, { "data-group-header": shouldVirtualize ? "" : undefined, mx: spec.mx, px: spec.px, pt: 2, pb: 1, fontSize: "xs-minus", fontWeight: 600, textTransform: "uppercase", letterSpacing: "0.03em", color: colors.textMuted, children: row.group }, row.key)) : ((0, jsx_runtime_1.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, ink: rowInks, showRing: isKeyboardNav && row.index === activeIndex, spec: spec, renderOption: renderOption, renderOptionEnd: renderOptionEnd, optionAction: optionAction, checkPlacement: checkPlacement, onSelect: handleSelect, onActivate: handlePointerActivate }, row.key));
|
|
587
618
|
}), bottomPadPx > 0 && (0, jsx_runtime_1.jsx)(react_2.Box, { height: `${bottomPadPx}px` })] }))
|
|
588
619
|
: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [topPadPx > 0 && (0, jsx_runtime_1.jsx)(react_2.Box, { height: `${topPadPx}px` }), renderedOptions.map((option, i) => {
|
|
589
620
|
var _a;
|
|
590
|
-
return ((0, jsx_runtime_1.jsx)(OptionRow, { option: option, index: startIndex + i, listboxId: listboxId, isSelected: selectedIds.has(option.id.toString()), isActive: startIndex + i === activeIndex, isMulti: (_a = props.isMulti) !== null && _a !== void 0 ? _a : false, theme: theme, backgrounds: rowBackgrounds, spec: spec, renderOption: renderOption, onSelect: handleSelect, onActivate:
|
|
591
|
-
}), bottomPadPx > 0 && (0, jsx_runtime_1.jsx)(react_2.Box, { height: `${bottomPadPx}px` })] })), showCreateRow && ((0, jsx_runtime_1.jsx)(react_2.Box, { id: createRowId, role: "option", "aria-selected": false, "data-index": -1, onClick: handleCreate, mx: spec.mx, px: spec.px, py: spec.py, minH: spec.minH, borderRadius: "md", cursor: "pointer", fontSize: spec.fontSize, fontWeight: 600, color: colors.primary[600], bg: activeDescendantId === createRowId ? rowBackgrounds.active : "transparent", children: createLabel ? createLabel(currentSearch.trim()) : `Create "${currentSearch.trim()}"` })), isLoading && ((0, jsx_runtime_1.jsxs)(react_2.Box, { mx: spec.mx, px: spec.px, py: spec.py, display: "flex", alignItems: "center", gap: spec.gap, fontSize: spec.fontSize, color: colors.textMuted, children: [(0, jsx_runtime_1.jsx)(react_2.Spinner, { size: "xs" }), loadingText] })), footerAction && ((0, jsx_runtime_1.jsx)(react_2.Box, { id: footerId, role: "option", "aria-selected": false, onClick: handleFooterAction, onMouseEnter: () =>
|
|
621
|
+
return ((0, jsx_runtime_1.jsx)(OptionRow, { option: option, index: startIndex + i, listboxId: listboxId, isSelected: selectedIds.has(option.id.toString()), isActive: startIndex + i === activeIndex, isMulti: (_a = props.isMulti) !== null && _a !== void 0 ? _a : false, theme: theme, backgrounds: rowBackgrounds, ink: rowInks, showRing: isKeyboardNav && startIndex + i === activeIndex, spec: spec, renderOption: renderOption, renderOptionEnd: renderOptionEnd, optionAction: optionAction, checkPlacement: checkPlacement, onSelect: handleSelect, onActivate: handlePointerActivate }, option.id));
|
|
622
|
+
}), bottomPadPx > 0 && (0, jsx_runtime_1.jsx)(react_2.Box, { height: `${bottomPadPx}px` })] })), showCreateRow && ((0, jsx_runtime_1.jsx)(react_2.Box, { id: createRowId, role: "option", "aria-selected": false, "data-index": -1, onClick: handleCreate, mx: spec.mx, px: spec.px, py: spec.py, minH: spec.minH, borderRadius: "md", cursor: "pointer", fontSize: spec.fontSize, fontWeight: 600, color: colors.primary[600], bg: activeDescendantId === createRowId ? rowBackgrounds.active : "transparent", boxShadow: ringShadowFor(activeDescendantId === createRowId), children: createLabel ? createLabel(currentSearch.trim()) : `Create "${currentSearch.trim()}"` })), isLoading && ((0, jsx_runtime_1.jsxs)(react_2.Box, { mx: spec.mx, px: spec.px, py: spec.py, display: "flex", alignItems: "center", gap: spec.gap, fontSize: spec.fontSize, color: colors.textMuted, children: [(0, jsx_runtime_1.jsx)(react_2.Spinner, { size: "xs" }), loadingText] })), footerAction && ((0, jsx_runtime_1.jsx)(react_2.Box, { id: footerId, role: "option", "aria-selected": false, onClick: handleFooterAction, onMouseEnter: () => handlePointerActivate(FOOTER_ROW), position: "sticky", bottom: `-${spec.mx}`, pt: 1, bg: colors.surfaceRaised, borderTop: `${borderWidths_1.BORDER_WIDTHS.hairline} solid ${(0, surfaceRaised_1.raisedRule)(colors)}`, children: (0, jsx_runtime_1.jsxs)(react_2.Box, { mx: spec.mx, px: spec.px, py: spec.py, minH: spec.minH, borderRadius: "md", cursor: "pointer", display: "flex", alignItems: "center", gap: spec.gap, fontSize: spec.fontSize, fontWeight: 500, color: colors.accentText, bg: activeIndex === FOOTER_ROW ? rowBackgrounds.active : "transparent", boxShadow: ringShadowFor(activeIndex === FOOTER_ROW), children: [(_f = footerAction.icon) !== null && _f !== void 0 ? _f : (0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { size: spec.iconSize }), footerAction.label] }) }))] })] }) })] }), hiddenValues.map((value) => ((0, jsx_runtime_1.jsx)("input", { type: "hidden", name: name, value: value }, value))), (0, jsx_runtime_1.jsx)(FieldMessage_1.default, { error: error, errorMessage: errorMessage, helperText: helperText, helperId: ids.helperId, errorId: ids.errorId })] }));
|
|
592
623
|
});
|
|
593
624
|
exports.default = SelectPopup;
|
|
@@ -3,7 +3,9 @@ import type { ReactNode } from "react";
|
|
|
3
3
|
import type { ControlSize } from "../../Theme/tokens/primitives/controlSizes";
|
|
4
4
|
/** Select option; icon/description/group/isDisabled are popup-mode extras, all optional and additive. */
|
|
5
5
|
export type OptionProp = {
|
|
6
|
+
/** Unique value of the option: what `value` / `defaultValue` select by and what native mode emits as the `<option>` value. */
|
|
6
7
|
id: string | number;
|
|
8
|
+
/** Text shown in the row and the trigger; the default filter matches against it. */
|
|
7
9
|
label: string | number;
|
|
8
10
|
/** Popup mode only — leading icon/avatar for this option's row (and the trigger, when selected). */
|
|
9
11
|
icon?: ReactNode;
|
|
@@ -15,12 +17,15 @@ export type OptionProp = {
|
|
|
15
17
|
group?: string;
|
|
16
18
|
};
|
|
17
19
|
type SelectCommonProps = {
|
|
20
|
+
/** Choices in display order; options that share a `group` should sit next to each other. */
|
|
18
21
|
options: OptionProp[];
|
|
19
22
|
/** Renders a themed popup instead of a real `<select>` when false. Defaults to true — today's `Select`, unchanged. */
|
|
20
23
|
native?: boolean;
|
|
21
24
|
/** DOM id of the control; auto-generated when omitted, so the label and messages always associate. */
|
|
22
25
|
id?: string;
|
|
26
|
+
/** Native: the `<select>` name. Popup: submits the selection through hidden input(s), one per value when multi. */
|
|
23
27
|
name?: string;
|
|
28
|
+
/** Label above the field; its `for` points at the control. */
|
|
24
29
|
label?: string;
|
|
25
30
|
/** Native: the built-in placeholder `<option>`. Popup: trigger text when nothing is selected. Defaults to "Select Option". */
|
|
26
31
|
placeholder?: string;
|
|
@@ -36,8 +41,11 @@ type SelectCommonProps = {
|
|
|
36
41
|
errorMessage?: string;
|
|
37
42
|
/** Hint under the field; hidden while `error` is true. */
|
|
38
43
|
helperText?: string;
|
|
44
|
+
/** Disables the field; the popup cannot open. */
|
|
39
45
|
isDisabled?: boolean;
|
|
46
|
+
/** Shows the value but ignores changes; the popup never opens. */
|
|
40
47
|
isReadOnly?: boolean;
|
|
48
|
+
/** Label asterisk and `aria-required`; the popup never blocks an empty submit. */
|
|
41
49
|
isRequired?: boolean;
|
|
42
50
|
/** Shows an info icon beside the label; needs `label` and `informationMessage` too. */
|
|
43
51
|
isInformation?: boolean;
|
|
@@ -45,16 +53,25 @@ type SelectCommonProps = {
|
|
|
45
53
|
informationMessage?: string;
|
|
46
54
|
/** Inline style on the wrapping FormControl (label + control + message). */
|
|
47
55
|
formControlStyle?: React.CSSProperties;
|
|
56
|
+
/** Accessible name when there is no `label`; the popup forwards it to the trigger. */
|
|
48
57
|
"aria-label"?: string;
|
|
58
|
+
/** Id of an element that names the field; the popup forwards it to the trigger. */
|
|
49
59
|
"aria-labelledby"?: string;
|
|
50
60
|
/** Popup mode only — forwarded to the trigger, the same node as `role="combobox"`. */
|
|
51
61
|
"data-testid"?: string;
|
|
62
|
+
/** Native mode only — field style: `outline` (default), `filled`, `flushed` or `unstyled`; inert (dev-warned) when `native` is false. */
|
|
52
63
|
variant?: ChakraNativeSelectProps["variant"];
|
|
64
|
+
/** Native mode only — forwarded to Chakra's Select; inert (dev-warned) when `native` is false. */
|
|
53
65
|
colorScheme?: ChakraNativeSelectProps["colorScheme"];
|
|
66
|
+
/** Native mode only — replaces the dropdown arrow; inert (dev-warned) when `native` is false. */
|
|
54
67
|
icon?: ChakraNativeSelectProps["icon"];
|
|
68
|
+
/** Native mode only — background of the `<select>`; inert (dev-warned) when `native` is false. */
|
|
55
69
|
bg?: ChakraNativeSelectProps["bg"];
|
|
70
|
+
/** Native mode only — border colour of the `<select>`; inert (dev-warned) when `native` is false. */
|
|
56
71
|
borderColor?: ChakraNativeSelectProps["borderColor"];
|
|
72
|
+
/** Native mode only — text colour of the `<select>`; inert (dev-warned) when `native` is false. */
|
|
57
73
|
color?: ChakraNativeSelectProps["color"];
|
|
74
|
+
/** Native mode only — border colour while `error`; inert (dev-warned) when `native` is false. */
|
|
58
75
|
errorBorderColor?: ChakraNativeSelectProps["errorBorderColor"];
|
|
59
76
|
/** Native mode only — inline style on the `<select>` element itself. */
|
|
60
77
|
selectStyle?: React.CSSProperties;
|
|
@@ -90,10 +107,14 @@ type SelectCommonProps = {
|
|
|
90
107
|
isFieldLoading?: boolean;
|
|
91
108
|
/** Trailing slot replacing the chevron; with `onClick` it renders a button (so `ariaLabel` is required) that does not toggle the popup. Popup mode only. */
|
|
92
109
|
rightIcon?: {
|
|
110
|
+
/** Node shown in place of the chevron. */
|
|
93
111
|
icon: ReactNode;
|
|
94
112
|
} | {
|
|
113
|
+
/** Node shown in place of the chevron. */
|
|
95
114
|
icon: ReactNode;
|
|
115
|
+
/** Makes the icon a button that calls this without toggling the popup. */
|
|
96
116
|
onClick: () => void;
|
|
117
|
+
/** Accessible name of the icon button. */
|
|
97
118
|
ariaLabel: string;
|
|
98
119
|
};
|
|
99
120
|
/** Empty-list message. Native mode stringifies it (plain `<option>` text); popup mode accepts any node. */
|
|
@@ -107,6 +128,22 @@ type SelectCommonProps = {
|
|
|
107
128
|
isSelected: boolean;
|
|
108
129
|
isActive: boolean;
|
|
109
130
|
}) => ReactNode;
|
|
131
|
+
/** Non-interactive content between the row and its check, e.g. a badge; receives isSelected/isActive. Popup mode only. */
|
|
132
|
+
renderOptionEnd?: (option: OptionProp, state: {
|
|
133
|
+
isSelected: boolean;
|
|
134
|
+
isActive: boolean;
|
|
135
|
+
}) => ReactNode;
|
|
136
|
+
/** One pointer-only row action: aria-hidden, tabIndex -1, and a click never selects the row. Popup mode only. */
|
|
137
|
+
optionAction?: {
|
|
138
|
+
/** Node shown in the action button. */
|
|
139
|
+
icon: ReactNode;
|
|
140
|
+
/** Hover title of the button; the button itself is hidden from assistive tech, so offer the action another way too. */
|
|
141
|
+
label: string;
|
|
142
|
+
/** Called with the row's option when the button is clicked. */
|
|
143
|
+
onAction: (option: OptionProp) => void;
|
|
144
|
+
};
|
|
145
|
+
/** Single-select check position: "end" (default) trails the row, "start" sits in the leading column the multi checkbox uses. Popup mode only. */
|
|
146
|
+
checkPlacement?: "end" | "start";
|
|
110
147
|
/** Custom trigger content once a value is selected. Popup mode only. */
|
|
111
148
|
renderValue?: (selected: OptionProp[]) => ReactNode;
|
|
112
149
|
/** Shows a "Create …" row when the filter matches no option; fires with the trimmed query. Popup mode only. */
|
|
@@ -117,8 +154,11 @@ type SelectCommonProps = {
|
|
|
117
154
|
createWhen?: "no-options" | "no-exact-match";
|
|
118
155
|
/** A persistent last row ("Add new…") shown whatever the filter; `onSelect` gets the trimmed query and the popup closes. Popup mode only. */
|
|
119
156
|
footerAction?: {
|
|
157
|
+
/** Text of the footer row. */
|
|
120
158
|
label: ReactNode;
|
|
159
|
+
/** Called with the trimmed filter text when the row is chosen; the popup then closes. */
|
|
121
160
|
onSelect: (query: string) => void;
|
|
161
|
+
/** Icon before the label; a plus icon when omitted. */
|
|
122
162
|
icon?: ReactNode;
|
|
123
163
|
};
|
|
124
164
|
/** Max popup height before the option list scrolls. Defaults to "16rem". Popup mode only. */
|
|
@@ -130,10 +170,11 @@ type SelectCommonProps = {
|
|
|
130
170
|
};
|
|
131
171
|
/** Single-select arm of `SelectFieldProps`; `isMulti` false/absent discriminates it from the multi variant. */
|
|
132
172
|
export type SelectSingleProps = SelectCommonProps & {
|
|
173
|
+
/** False or absent selects this single-select variant. */
|
|
133
174
|
isMulti?: false;
|
|
134
|
-
/** Controlled selected option id. */
|
|
175
|
+
/** Controlled selected option id; native mode stays uncontrolled until a defined `value` has been passed (`""` shows the placeholder). */
|
|
135
176
|
value?: string | number;
|
|
136
|
-
/** Seeds an uncontrolled selection; ignored once `value` is passed (even `""`). */
|
|
177
|
+
/** Seeds an uncontrolled selection in native and popup mode; ignored once `value` is passed (even `""`). */
|
|
137
178
|
defaultValue?: string | number;
|
|
138
179
|
/** Canonical change callback. Never fires for the native placeholder; gate a reset behind `isClearable`. */
|
|
139
180
|
onChange: (selectedOption: OptionProp | undefined) => void;
|
|
@@ -142,8 +183,11 @@ export type SelectSingleProps = SelectCommonProps & {
|
|
|
142
183
|
export type SelectMultiProps = SelectCommonProps & {
|
|
143
184
|
/** Multi-select requires the popup — rendered even if `native` is left true, with a dev warning. */
|
|
144
185
|
isMulti: true;
|
|
186
|
+
/** Controlled selected option ids. */
|
|
145
187
|
value?: (string | number)[];
|
|
188
|
+
/** Seeds an uncontrolled selection; ignored once `value` is passed. */
|
|
146
189
|
defaultValue?: (string | number)[];
|
|
190
|
+
/** Called with the full selection after each toggle or chip removal. */
|
|
147
191
|
onChange: (selectedOptions: OptionProp[]) => void;
|
|
148
192
|
/** Chips shown before the rest collapse into a "+N" chip. Defaults to 6. */
|
|
149
193
|
maxVisibleChips?: number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keyboardRingShadow = exports.NAVIGATION_KEYS = void 0;
|
|
4
|
+
const borderWidths_1 = require("../../Theme/tokens/primitives/borderWidths");
|
|
5
|
+
exports.NAVIGATION_KEYS = new Set(["ArrowDown", "ArrowUp", "Home", "End", "PageUp", "PageDown"]);
|
|
6
|
+
const keyboardRingShadow = (ring) => `inset 0 0 0 ${borderWidths_1.BORDER_WIDTHS.hairline} ${ring}`;
|
|
7
|
+
exports.keyboardRingShadow = keyboardRingShadow;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type SelectRowBackgrounds } from "../../Theme/tokens/builders/rowStates";
|
|
2
|
+
import type { PaletteProps } from "../../Theme/tokens/types";
|
|
3
|
+
export declare const SELECT_ROW_DISABLED_CONTENT_OPACITY = 0.55;
|
|
4
|
+
export declare const selectRowInk: (colors: PaletteProps, isSingleSelected: boolean) => string;
|
|
5
|
+
export declare const selectRowDescriptionInk: (colors: PaletteProps) => string;
|
|
6
|
+
/** Solid ink for a disabled row's content in light; dark dims content by opacity instead (null). */
|
|
7
|
+
export declare const selectRowDisabledInk: (colors: PaletteProps) => string | null;
|
|
8
|
+
/** Placeholder of the popup's filter input in light; dark keeps the shared placeholder ink (null). */
|
|
9
|
+
export declare const selectFilterPlaceholderInk: (colors: PaletteProps) => string | null;
|
|
10
|
+
/** Cursor and selection each paint a rung; the stacked state paints the third. */
|
|
11
|
+
export declare const selectRowFill: (rows: SelectRowBackgrounds, state: {
|
|
12
|
+
isSelected: boolean;
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
}) => string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.selectRowFill = exports.selectFilterPlaceholderInk = exports.selectRowDisabledInk = exports.selectRowDescriptionInk = exports.selectRowInk = exports.SELECT_ROW_DISABLED_CONTENT_OPACITY = void 0;
|
|
4
|
+
const accentText_1 = require("../../Theme/tokens/builders/accentText");
|
|
5
|
+
const outlineRung_1 = require("../../Theme/tokens/builders/outlineRung");
|
|
6
|
+
const rowStates_1 = require("../../Theme/tokens/builders/rowStates");
|
|
7
|
+
const optionRowInk_1 = require("./optionRowInk");
|
|
8
|
+
exports.SELECT_ROW_DISABLED_CONTENT_OPACITY = 0.55;
|
|
9
|
+
const NEUTRAL_INK_STEPS = {
|
|
10
|
+
label: 12.8,
|
|
11
|
+
selected: 15.4,
|
|
12
|
+
description: 7,
|
|
13
|
+
disabled: 3.6,
|
|
14
|
+
placeholder: 4.6,
|
|
15
|
+
};
|
|
16
|
+
// NOTE: light is a brand-free grey ladder off the panel; dark keeps the shared inks.
|
|
17
|
+
const neutralInk = (colors, role) => (0, outlineRung_1.neutralStep)(colors.surfaceRaised, NEUTRAL_INK_STEPS[role]);
|
|
18
|
+
const isDarkPanel = (colors) => (0, accentText_1.isDarkCanvas)(colors.surfaceRaised);
|
|
19
|
+
const selectRowInk = (colors, isSingleSelected) => {
|
|
20
|
+
if (isDarkPanel(colors))
|
|
21
|
+
return (0, optionRowInk_1.optionRowInk)(colors, isSingleSelected);
|
|
22
|
+
return neutralInk(colors, isSingleSelected ? "selected" : "label");
|
|
23
|
+
};
|
|
24
|
+
exports.selectRowInk = selectRowInk;
|
|
25
|
+
const selectRowDescriptionInk = (colors) => isDarkPanel(colors)
|
|
26
|
+
? (0, outlineRung_1.liftToContrast)(colors.textMuted, (0, rowStates_1.selectRowBackgrounds)(colors).selectedActive, accentText_1.AA_NORMAL_TEXT)
|
|
27
|
+
: neutralInk(colors, "description");
|
|
28
|
+
exports.selectRowDescriptionInk = selectRowDescriptionInk;
|
|
29
|
+
/** Solid ink for a disabled row's content in light; dark dims content by opacity instead (null). */
|
|
30
|
+
const selectRowDisabledInk = (colors) => isDarkPanel(colors) ? null : neutralInk(colors, "disabled");
|
|
31
|
+
exports.selectRowDisabledInk = selectRowDisabledInk;
|
|
32
|
+
/** Placeholder of the popup's filter input in light; dark keeps the shared placeholder ink (null). */
|
|
33
|
+
const selectFilterPlaceholderInk = (colors) => isDarkPanel(colors) ? null : neutralInk(colors, "placeholder");
|
|
34
|
+
exports.selectFilterPlaceholderInk = selectFilterPlaceholderInk;
|
|
35
|
+
/** Cursor and selection each paint a rung; the stacked state paints the third. */
|
|
36
|
+
const selectRowFill = (rows, state) => {
|
|
37
|
+
if (state.isActive)
|
|
38
|
+
return state.isSelected ? rows.selectedActive : rows.active;
|
|
39
|
+
return state.isSelected ? rows.selected : "transparent";
|
|
40
|
+
};
|
|
41
|
+
exports.selectRowFill = selectRowFill;
|
|
@@ -22,6 +22,8 @@ const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
|
22
22
|
const surfaceRaised_1 = require("../../Theme/tokens/builders/surfaceRaised");
|
|
23
23
|
const rowStates_1 = require("../../Theme/tokens/builders/rowStates");
|
|
24
24
|
const optionRowInk_1 = require("../Select/optionRowInk");
|
|
25
|
+
const selectKeyboardRing_1 = require("../Select/selectKeyboardRing");
|
|
26
|
+
const selectRowInk_1 = require("../Select/selectRowInk");
|
|
25
27
|
const useExclusiveOverlay_1 = require("../../Hooks/useExclusiveOverlay");
|
|
26
28
|
const lucide_react_1 = require("lucide-react");
|
|
27
29
|
const activationKey_1 = require("../Common/activationKey");
|
|
@@ -29,8 +31,12 @@ const useOutsideMouseDown_1 = require("../../Hooks/useOutsideMouseDown");
|
|
|
29
31
|
const ROW_TRANSITION = (0, motion_1.transitionFor)(["background-color"]);
|
|
30
32
|
const RenderOptions = ({ isOptionLoading, filteredOptions, loadingText, handleOptionClick, isProfile, isColorOptions, isOptionSelected, activeIndex, optionRefs, size, isMultipleSelect, }) => {
|
|
31
33
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
32
|
-
const rowBackgrounds = (0, react_1.useMemo)(() => (0, rowStates_1.
|
|
34
|
+
const rowBackgrounds = (0, react_1.useMemo)(() => (0, rowStates_1.selectRowBackgrounds)(theme.colors), [theme.colors]);
|
|
33
35
|
const spec = (0, optionRowSizes_1.optionRowSpec)(size);
|
|
36
|
+
const keyboardRing = {
|
|
37
|
+
outline: "2px solid transparent",
|
|
38
|
+
boxShadow: (0, selectKeyboardRing_1.keyboardRingShadow)(rowBackgrounds.keyboardRing),
|
|
39
|
+
};
|
|
34
40
|
if (isOptionLoading) {
|
|
35
41
|
return ((0, jsx_runtime_1.jsxs)(react_2.VStack, { py: 2, children: [(0, jsx_runtime_1.jsx)(react_2.Spinner, { size: "sm", color: theme.colors.accentText }), (0, jsx_runtime_1.jsx)(react_2.Text, { color: theme.colors.accentText, children: loadingText })] }));
|
|
36
42
|
}
|
|
@@ -41,7 +47,7 @@ const RenderOptions = ({ isOptionLoading, filteredOptions, loadingText, handleOp
|
|
|
41
47
|
const isActive = index === activeIndex;
|
|
42
48
|
return ((0, jsx_runtime_1.jsxs)(react_2.Box, { as: "button", type: "button", ref: (el) => {
|
|
43
49
|
optionRefs.current[index] = el;
|
|
44
|
-
}, role: "option", "aria-selected": selected, tabIndex: isActive ? 0 : -1, w: `calc(100% - 2 * ${spec.mx})`, minH: spec.minH, textAlign: "left", border: "none", fontFamily: "inherit", bg: "transparent", mx: spec.mx, px: spec.px, py: spec.py, borderRadius: optionRowSizes_1.OPTION_ROW_RADIUS, fontSize: spec.fontSize, cursor: "pointer", color: (0,
|
|
50
|
+
}, role: "option", "aria-selected": selected, tabIndex: isActive ? 0 : -1, w: `calc(100% - 2 * ${spec.mx})`, minH: spec.minH, textAlign: "left", border: "none", fontFamily: "inherit", bg: selected ? rowBackgrounds.selected : "transparent", mx: spec.mx, px: spec.px, py: spec.py, borderRadius: optionRowSizes_1.OPTION_ROW_RADIUS, fontSize: spec.fontSize, cursor: "pointer", color: (0, selectRowInk_1.selectRowInk)(theme.colors, isSingleSelected), fontWeight: (0, optionRowInk_1.optionRowWeight)(isSingleSelected), transition: ROW_TRANSITION, sx: (0, motion_2.reducedMotionSx)(), _hover: { bg: selected ? rowBackgrounds.selectedActive : rowBackgrounds.active }, _focus: { bg: selected ? rowBackgrounds.selectedActive : rowBackgrounds.active }, _focusVisible: keyboardRing, onClick: () => handleOptionClick(option), onKeyDown: (0, activationKey_1.onActivationKey)(() => handleOptionClick(option)), display: "flex", alignItems: "center", gap: spec.gap, children: [isProfile && ((0, jsx_runtime_1.jsx)(react_2.Box, { children: (0, jsx_runtime_1.jsx)(Avatar_1.default, { size: spec.avatarSize, name: option.label.toLocaleUpperCase(), src: option.profileUrl ? option.profileUrl : undefined }) })), isColorOptions && ((0, jsx_runtime_1.jsx)(react_2.Box, { width: "0.8rem", height: "0.8rem", content: "", backgroundColor: option === null || option === void 0 ? void 0 : option.color, borderRadius: "full" })), (0, jsx_runtime_1.jsxs)(react_2.Box, { flex: 1, minW: 0, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { children: option.label }), option.email && ((0, jsx_runtime_1.jsx)(react_2.Box, { fontSize: spec.descriptionFontSize, color: (0, selectRowInk_1.selectRowDescriptionInk)(theme.colors), children: option.email }))] }), isSingleSelected && ((0, jsx_runtime_1.jsx)(react_2.Box, { as: lucide_react_1.Check, size: spec.iconSize, color: theme.colors.accentText, flexShrink: 0 }))] }, option.id));
|
|
45
51
|
}) }));
|
|
46
52
|
}
|
|
47
53
|
return ((0, jsx_runtime_1.jsx)(react_2.Text, { px: 4, py: 2, color: theme.colors.textMuted, children: "No options found" }));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ControlSize } from "../../Theme/tokens/primitives/controlSizes";
|
|
2
2
|
/** Prefer `Select` with `native={false}` for new work — not a drop-in: its combobox is the text input itself. See COMPONENT-GOTCHAS.md ("Which select component"). */
|
|
3
3
|
export type SelectSearchProps = {
|
|
4
|
+
/** Choices; filtered locally by label as the user types. */
|
|
4
5
|
options: selectOptions[];
|
|
5
6
|
/** @deprecated Never read — the search input always renders. */
|
|
6
7
|
isSearchEnabled?: boolean;
|
|
@@ -12,8 +13,11 @@ export type SelectSearchProps = {
|
|
|
12
13
|
onOptionMultiSelect?: (option: selectOptions[]) => void;
|
|
13
14
|
/** Fires on every keystroke, undebounced; local label filtering runs regardless. */
|
|
14
15
|
inputOnchange: (value: string | number) => void;
|
|
16
|
+
/** Id of the text input; the label's `for` and the message ids derive from it. Auto-generated when omitted. */
|
|
15
17
|
id?: string;
|
|
18
|
+
/** Name attribute of the text input, so a form submits the typed text, not the selection. */
|
|
16
19
|
name?: string;
|
|
20
|
+
/** Label above the input. */
|
|
17
21
|
label?: string;
|
|
18
22
|
/** Inline style on the text input. */
|
|
19
23
|
inputStyle?: React.CSSProperties;
|
|
@@ -66,9 +70,14 @@ export type SelectSearchProps = {
|
|
|
66
70
|
};
|
|
67
71
|
/** Option shape for SelectSearch; `email`/`profileUrl` back `isProfile` rows, `color` backs `isColorOptions` rows. */
|
|
68
72
|
export type selectOptions = {
|
|
73
|
+
/** Unique key of the option. */
|
|
69
74
|
id: string;
|
|
75
|
+
/** Row text; the local filter matches against it, and its initials back the avatar when `profileUrl` is missing. */
|
|
70
76
|
label: string;
|
|
77
|
+
/** Muted second line under the label. */
|
|
71
78
|
email?: string;
|
|
79
|
+
/** Avatar image in `isProfile` rows. */
|
|
72
80
|
profileUrl?: string;
|
|
81
|
+
/** Fill of the dot in `isColorOptions` rows. */
|
|
73
82
|
color?: string;
|
|
74
83
|
};
|
|
@@ -2,7 +2,9 @@ import type { ReactNode } from "react";
|
|
|
2
2
|
import type { ControlSize } from "../../Theme/tokens/primitives/controlSizes";
|
|
3
3
|
/** SelectV2 option shape; adds optional `icon`/`description`/`isDisabled` beyond the plain id/label pair. */
|
|
4
4
|
export type OptionProp = {
|
|
5
|
+
/** Unique value of the option; what `value` selects by. */
|
|
5
6
|
id: string | number;
|
|
7
|
+
/** Text shown in the row and the trigger; the search filter matches against it. */
|
|
6
8
|
label: string | number;
|
|
7
9
|
/** Optional leading icon/avatar for this option's row (and the trigger, when selected). */
|
|
8
10
|
icon?: ReactNode;
|
|
@@ -14,6 +16,7 @@ export type OptionProp = {
|
|
|
14
16
|
/** sm/md/lg subset kept for existing importers; the `size` prop takes the full `ControlSize` scale. */
|
|
15
17
|
export type SelectV2Size = "sm" | "md" | "lg";
|
|
16
18
|
type SelectV2CommonProps = {
|
|
19
|
+
/** Choices in display order. */
|
|
17
20
|
options: OptionProp[];
|
|
18
21
|
/** DOM id of the trigger; the label's `for` and the message ids derive from it. Auto-generated when omitted. */
|
|
19
22
|
id?: string;
|
|
@@ -21,6 +24,7 @@ type SelectV2CommonProps = {
|
|
|
21
24
|
name?: string;
|
|
22
25
|
/** Trigger text when nothing is selected. Defaults to "Select Option". */
|
|
23
26
|
placeholder?: string;
|
|
27
|
+
/** Label above the trigger. */
|
|
24
28
|
label?: string;
|
|
25
29
|
/** Marks the field invalid and swaps `helperText` for `errorMessage`. */
|
|
26
30
|
error?: boolean;
|
|
@@ -28,6 +32,7 @@ type SelectV2CommonProps = {
|
|
|
28
32
|
errorMessage?: string;
|
|
29
33
|
/** Hint under the field; hidden while `error` is true. */
|
|
30
34
|
helperText?: string;
|
|
35
|
+
/** Disables the trigger; the popup cannot open. */
|
|
31
36
|
isDisabled?: boolean;
|
|
32
37
|
/** Shows the value but never opens; exposed as `aria-readonly`. */
|
|
33
38
|
isReadOnly?: boolean;
|
|
@@ -72,6 +77,7 @@ type SelectV2CommonProps = {
|
|
|
72
77
|
/** Single-select arm of `SelectV2Props`; `isMulti` false/absent discriminates it from the multi variant. */
|
|
73
78
|
/** @deprecated Use `SelectSingleProps` (`native={false}`). */
|
|
74
79
|
export type SelectV2SingleProps = SelectV2CommonProps & {
|
|
80
|
+
/** False or absent selects this single-select variant. */
|
|
75
81
|
isMulti?: false;
|
|
76
82
|
/** Selected option `id`; compared as strings, so `1` matches `"1"`. */
|
|
77
83
|
value?: string | number;
|
|
@@ -81,6 +87,7 @@ export type SelectV2SingleProps = SelectV2CommonProps & {
|
|
|
81
87
|
/** Multi-select arm of `SelectV2Props`; `isMulti: true` discriminates it and makes `value` an array. */
|
|
82
88
|
/** @deprecated Use `SelectMultiProps` (`native={false}`). */
|
|
83
89
|
export type SelectV2MultiProps = SelectV2CommonProps & {
|
|
90
|
+
/** True makes `value` an array and `onChange` receive the full selection. */
|
|
84
91
|
isMulti: true;
|
|
85
92
|
/** Selected option ids; ids with no matching option are dropped from the display. */
|
|
86
93
|
value?: (string | number)[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { SecondaryBarProps } from "./SideBarProps";
|
|
3
|
+
/** Secondary flyout panel beside the main rail, listing the active menu's `secondaryItems`; collapses to icons. */
|
|
3
4
|
declare const SecondaryBar: React.FC<SecondaryBarProps>;
|
|
4
5
|
export default SecondaryBar;
|
|
@@ -72,6 +72,7 @@ const ExpandedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
|
|
|
72
72
|
}, borderLeft: "2px solid", borderLeftColor: isActive ? theme.colors.sidebar.activeIcon : "transparent", transition: sidebarMotion_1.SIDEBAR_BG_TRANSITION, sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors), children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 2, flex: "1", minW: 0, overflow: "hidden", children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: item.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, flexShrink: 0, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: sidebarMotion_1.SIDEBAR_INK_TRANSITION }), (0, jsx_runtime_1.jsx)(react_2.Box, { flex: "1", minW: 0, children: (0, jsx_runtime_1.jsx)(OverflowTooltipText_1.default, { 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 }) })] }), item.locked ? ((0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "sm", flexShrink: 0, color: theme.colors.sidebar.mutedIcon })) : (badgeVal != null && ((0, jsx_runtime_1.jsx)(react_2.Badge, { ...softBadge(theme.colors, colorScheme, (0, sidebarAccent_1.sidebarRowPeak)(theme.colors.sidebar.background[500])), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal })))] }));
|
|
73
73
|
return item.locked && item.lockedReason ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: item.lockedReason, placement: "top", children: row })) : (row);
|
|
74
74
|
};
|
|
75
|
+
/** Secondary flyout panel beside the main rail, listing the active menu's `secondaryItems`; collapses to icons. */
|
|
75
76
|
const SecondaryBar = ({ items = [], defaultCollapsed = true, collapsedWidth = "3.5rem", expandedWidth = "10rem", headerFontSize = sidebarScale_1.SIDEBAR_ROW.fontSize, itemFontSize = sidebarScale_1.SIDEBAR_ROW.fontSize, selected, onItemClick, title, icon, }) => {
|
|
76
77
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
77
78
|
const activeAccent = (0, sidebarAccentColors_1.getSidebarActiveAccent)(theme.colors);
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { SidebarProps } from "./SideBarProps";
|
|
2
|
+
/** Left navigation rail: collapsible inline from `lg`, a slide-in overlay below it, with menus, pinned shortcuts, submenus, a secondary flyout and a footer. */
|
|
2
3
|
export default function Sidebar({ menus, activeMenu, handleMenuClick, handleSecondaryNavClick, toggle, changeToggle, logo, companyName, companySubtitle, user, isDisableAddNew, onAddNewClick, selectedSubMenu, selectedSecondaryItem, isLoading, loadingLines, open, otherApps, mobileOpen, onMobileClose, mobileNav, onToggleMobileNav, peekOpen, onPeekEnd, pinnedItems, pinnedLabel, onUnpin, activePinnedId, pinnedLimit, pinnedLabels, collapseTransition, autoCollapse, }: SidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -128,6 +128,7 @@ const FooterControls = ({ toggle, overlay, mobileNav, onToggleCollapse, onToggle
|
|
|
128
128
|
return shell((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ControlCell, { onClick: onToggleCollapse, ariaLabel: toggle ? "Expand sidebar" : undefined, label: toggle ? undefined : "Collapse", children: toggle ? ((0, jsx_runtime_1.jsx)(lucide_react_1.ArrowRightToLine, { size: 14, color: iconColor })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.ArrowLeftToLine, { size: 14, color: iconColor })) }), onToggleMobileNav && ((0, jsx_runtime_1.jsx)(ControlCell, { onClick: onToggleMobileNav, ariaLabel: toggle ? "Show sidebar in overlay mode" : undefined, label: toggle ? undefined : "Hide", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Maximize2, { size: 14, color: iconColor }) }))] }));
|
|
129
129
|
};
|
|
130
130
|
// --- Main Sidebar component ---
|
|
131
|
+
/** Left navigation rail: collapsible inline from `lg`, a slide-in overlay below it, with menus, pinned shortcuts, submenus, a secondary flyout and a footer. */
|
|
131
132
|
function Sidebar({ menus, activeMenu, handleMenuClick, handleSecondaryNavClick, toggle, changeToggle, logo, companyName, companySubtitle, user, isDisableAddNew = false, onAddNewClick, selectedSubMenu, selectedSecondaryItem, isLoading, loadingLines, open = true, otherApps, mobileOpen = false, onMobileClose, mobileNav = false, onToggleMobileNav, peekOpen = false, onPeekEnd, pinnedItems, pinnedLabel, onUnpin, activePinnedId, pinnedLimit, pinnedLabels, collapseTransition = { speed: "base" }, autoCollapse = true, }) {
|
|
132
133
|
var _a, _b;
|
|
133
134
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|