pixelize-design-library 2.4.2-beta.64 → 2.4.2-beta.66
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 +520 -21
- package/COMPONENT-GOTCHAS.md +187 -95
- package/DESIGN-GUIDE.md +54 -10
- package/README.md +37 -3
- package/dist/Components/Accordion/Accordion.js +11 -8
- package/dist/Components/Accordion/AccordionProps.d.ts +4 -0
- package/dist/Components/Accordion/accordionColors.js +1 -2
- package/dist/Components/Apexcharts/ApexLineChart/ApexLineChart.js +1 -0
- package/dist/Components/Apexcharts/ApexLineChart/ApexLineChartProps.d.ts +2 -2
- package/dist/Components/Apexcharts/ApexPieChart/ApexPieChart.d.ts +1 -1
- package/dist/Components/Apexcharts/ApexPieChart/ApexPieChart.js +6 -5
- package/dist/Components/Apexcharts/ApexPieChart/ApexPieChartProps.d.ts +3 -1
- package/dist/Components/Apexcharts/ApexPieChart/pieImageTexture.d.ts +2 -0
- package/dist/Components/Apexcharts/ApexPieChart/pieImageTexture.js +13 -0
- package/dist/Components/AppSwitcher/AppSwitcher.js +6 -3
- package/dist/Components/AppSwitcher/AppSwitcherProps.d.ts +3 -1
- package/dist/Components/AppSwitcher/AppSwitcherProps.js +18 -11
- package/dist/Components/AppSwitcher/pixelizeSuite.d.ts +24 -0
- package/dist/Components/AppSwitcher/pixelizeSuite.js +71 -0
- package/dist/Components/AppearanceSettings/AppearanceSettings.js +3 -3
- package/dist/Components/AppearanceSettings/AppearanceSettingsProps.d.ts +2 -2
- package/dist/Components/Avatar/avatarColorway.d.ts +2 -2
- package/dist/Components/Avatar/avatarColorway.js +7 -6
- package/dist/Components/Breadcrumbs/BreadcrumbsProps.d.ts +1 -1
- package/dist/Components/Button/Button.styles.js +5 -2
- package/dist/Components/Button/ButtonProps.d.ts +2 -4
- package/dist/Components/ButtonGroupIcon/ButtonGroupIcon.js +3 -1
- package/dist/Components/CalendarGrid/CalendarGrid.js +5 -3
- package/dist/Components/CalendarGrid/CalendarGridProps.d.ts +1 -1
- package/dist/Components/Card/Card.d.ts +1 -0
- package/dist/Components/Card/Card.js +1 -0
- package/dist/Components/Checkbox/Checkbox.styles.js +3 -1
- package/dist/Components/CheckoutKit/selectable.d.ts +3 -1
- package/dist/Components/CheckoutKit/selectable.js +10 -7
- package/dist/Components/CheckoutKit/tonalHover.d.ts +2 -0
- package/dist/Components/CheckoutKit/tonalHover.js +6 -0
- package/dist/Components/ChoiceCard/ChoiceCard.d.ts +1 -1
- package/dist/Components/ChoiceCard/ChoiceCard.js +2 -1
- package/dist/Components/ChoiceCard/ChoiceCardProps.d.ts +6 -0
- package/dist/Components/Common/FieldMessage.d.ts +1 -0
- package/dist/Components/Common/FormLabel.d.ts +1 -1
- package/dist/Components/Common/FormLabel.js +4 -3
- package/dist/Components/Common/HelperText.d.ts +2 -2
- package/dist/Components/Common/HelperText.js +1 -2
- package/dist/Components/Common/activationKey.d.ts +5 -0
- package/dist/Components/Common/activationKey.js +12 -0
- package/dist/Components/Common/dataAttributes.d.ts +4 -0
- package/dist/Components/Common/fieldMessageStyles.js +2 -1
- package/dist/Components/Common/findSlot.d.ts +2 -0
- package/dist/Components/Common/findSlot.js +24 -0
- package/dist/Components/Common/surfaceFocusRing.d.ts +1 -0
- package/dist/Components/Common/surfaceFocusRing.js +7 -0
- package/dist/Components/ConfirmDialog/ConfirmDialog.js +17 -5
- package/dist/Components/ConfirmDialog/ConfirmDialogProps.d.ts +38 -10
- package/dist/Components/CopyButton/CopyButton.d.ts +4 -1
- package/dist/Components/CopyButton/CopyButton.js +5 -8
- package/dist/Components/CouponField/CouponField.js +5 -2
- package/dist/Components/CustomModulesTable/CustomModulesTable.js +3 -1
- package/dist/Components/DatePicker/CalendarPanel.d.ts +1 -0
- package/dist/Components/DatePicker/CalendarPanel.js +3 -1
- package/dist/Components/DatePicker/DatePicker.js +24 -26
- package/dist/Components/DatePicker/DatePickerProps.d.ts +8 -0
- package/dist/Components/DatePicker/PickerPortal.js +1 -1
- package/dist/Components/DatePicker/RangeDatePicker.d.ts +7 -0
- package/dist/Components/DatePicker/RangeDatePicker.js +10 -29
- package/dist/Components/DatePicker/SingleDatePicker.js +5 -21
- package/dist/Components/DatePicker/TimeOnlyPicker.js +2 -20
- package/dist/Components/DescriptionList/DescriptionList.js +1 -1
- package/dist/Components/DetailSections/DetailSections.js +2 -1
- package/dist/Components/Divider/Divider.d.ts +3 -3
- package/dist/Components/Divider/Divider.js +3 -3
- package/dist/Components/Drawer/Drawer.d.ts +3 -1
- package/dist/Components/Drawer/Drawer.js +28 -26
- package/dist/Components/Drawer/DrawerProps.d.ts +4 -0
- package/dist/Components/Dropdown/DropDown.js +6 -21
- package/dist/Components/Editor/Editor.js +6 -2
- package/dist/Components/Editor/EditorProps.d.ts +17 -1
- package/dist/Components/Editor/editorLabels.js +1 -0
- package/dist/Components/Editor/editorTokenStyles.d.ts +8 -0
- package/dist/Components/Editor/editorTokenStyles.js +9 -1
- package/dist/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtp.d.ts +1 -1
- package/dist/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtp.js +9 -2
- package/dist/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtpProps.d.ts +15 -1
- package/dist/Components/EmptyState/EmptyStateProps.d.ts +21 -0
- package/dist/Components/EmptyState/FilteredEmptyState.d.ts +5 -0
- package/dist/Components/EmptyState/FilteredEmptyState.js +23 -0
- package/dist/Components/FieldSelectModal/FieldSelectModal.d.ts +1 -0
- package/dist/Components/FilePreview/FilePreview.js +7 -3
- package/dist/Components/FilePreview/FilePreviewProps.d.ts +2 -1
- package/dist/Components/FileUpload/FileUpload.js +8 -9
- package/dist/Components/FileUpload/FileUploadProps.d.ts +2 -2
- package/dist/Components/FileUploader/FileUploader.js +5 -6
- package/dist/Components/FilterSidebar/FilterSidebar.d.ts +7 -9
- package/dist/Components/FilterSidebar/FilterSidebar.js +90 -233
- package/dist/Components/FilterSidebar/OptionsSection.d.ts +14 -0
- package/dist/Components/FilterSidebar/OptionsSection.js +46 -0
- package/dist/Components/FilterSidebar/RangeSection.d.ts +17 -0
- package/dist/Components/FilterSidebar/RangeSection.js +80 -0
- package/dist/Components/FilterSidebar/SectionHeader.d.ts +13 -0
- package/dist/Components/FilterSidebar/SectionHeader.js +29 -0
- package/dist/Components/FilterSidebar/useStableCallback.d.ts +1 -0
- package/dist/Components/FilterSidebar/useStableCallback.js +12 -0
- package/dist/Components/Form/FormWrapper.d.ts +7 -7
- package/dist/Components/Form/FormWrapper.js +5 -3
- package/dist/Components/FormDrawer/FormDrawer.d.ts +1 -1
- package/dist/Components/FormDrawer/FormDrawer.js +3 -3
- package/dist/Components/FormDrawer/FormDrawerProps.d.ts +2 -0
- package/dist/Components/FormField/FormField.js +1 -1
- package/dist/Components/Header/Header.js +1 -1
- package/dist/Components/Header/HeaderActions.js +4 -2
- package/dist/Components/IconButton/IconButtonProps.d.ts +2 -1
- package/dist/Components/Input/TextInput.js +2 -2
- package/dist/Components/Input/TextInputProps.d.ts +3 -1
- package/dist/Components/KanbanBoard/AccountCard.js +1 -1
- package/dist/Components/KanbanBoard/KanbanBoard.d.ts +1 -1
- package/dist/Components/KanbanBoard/KanbanBoard.js +11 -7
- package/dist/Components/LauncherTrigger/LauncherTrigger.js +1 -1
- package/dist/Components/LazyWrapper/LazyWrapper.d.ts +2 -1
- package/dist/Components/LazyWrapper/LazyWrapper.js +1 -1
- package/dist/Components/MediaViewer/MediaViewer.js +4 -3
- package/dist/Components/MediaViewer/components/MediaAudioPlayer.js +5 -1
- package/dist/Components/MediaViewer/components/MediaImageViewer.js +19 -8
- package/dist/Components/MediaViewer/components/MediaScrubber.js +7 -2
- package/dist/Components/MediaViewer/components/MediaVideoPlayer.js +3 -1
- package/dist/Components/MediaViewer/components/ViewerIconButton.js +3 -1
- package/dist/Components/MediaViewer/hooks/useFileViewer.d.ts +1 -0
- package/dist/Components/MediaViewer/mediaItems.d.ts +1 -0
- package/dist/Components/MediaViewer/mediaItems.js +5 -0
- package/dist/Components/Modal/Modal.d.ts +1 -0
- package/dist/Components/Modal/Modal.js +7 -25
- package/dist/Components/Modal/dialogNaming.d.ts +8 -0
- package/dist/Components/Modal/dialogNaming.js +21 -0
- package/dist/Components/Modal/warnDroppedSlotChildren.d.ts +1 -1
- package/dist/Components/Modal/warnDroppedSlotChildren.js +7 -3
- package/dist/Components/NavLauncher/LauncherTabs.js +4 -3
- package/dist/Components/NavLauncher/NavLauncher.d.ts +1 -1
- package/dist/Components/NavLauncher/NavLauncher.js +288 -56
- package/dist/Components/NavLauncher/NavLauncherProps.d.ts +83 -5
- package/dist/Components/NavLauncher/ScopeBar.d.ts +14 -0
- package/dist/Components/NavLauncher/ScopeBar.js +139 -0
- package/dist/Components/NavLauncher/engine/distance.d.ts +4 -0
- package/dist/Components/NavLauncher/engine/distance.js +41 -0
- package/dist/Components/NavLauncher/engine/engine.d.ts +84 -0
- package/dist/Components/NavLauncher/engine/engine.js +472 -0
- package/dist/Components/NavLauncher/engine/fold.d.ts +15 -0
- package/dist/Components/NavLauncher/engine/fold.js +84 -0
- package/dist/Components/NavLauncher/engine/index.d.ts +21 -0
- package/dist/Components/NavLauncher/engine/index.js +17 -0
- package/dist/Components/NavLauncher/launcherParts.d.ts +14 -0
- package/dist/Components/NavLauncher/launcherParts.js +51 -13
- package/dist/Components/NavLauncher/match.d.ts +13 -2
- package/dist/Components/NavLauncher/match.js +26 -12
- package/dist/Components/NavLauncher/searchLayout.d.ts +61 -0
- package/dist/Components/NavLauncher/searchLayout.js +110 -0
- package/dist/Components/NavLauncher/spotlight.d.ts +39 -0
- package/dist/Components/NavLauncher/spotlight.js +202 -0
- package/dist/Components/NavLauncher/spotlightParts.d.ts +53 -0
- package/dist/Components/NavLauncher/spotlightParts.js +121 -0
- package/dist/Components/NavLauncher/useCopiedFlash.d.ts +6 -0
- package/dist/Components/NavLauncher/useCopiedFlash.js +21 -0
- package/dist/Components/NavigationBar/NavigationBar.js +6 -5
- package/dist/Components/NoteTextArea/NoteTextArea.js +12 -17
- package/dist/Components/NoteTextArea/NoteTextAreaProps.d.ts +5 -3
- package/dist/Components/Notification/Notification.js +19 -21
- package/dist/Components/Notification/NotificationProps.d.ts +1 -1
- package/dist/Components/NotificationBell/notificationHelpers.d.ts +16 -1
- package/dist/Components/NotificationBell/notificationHelpers.js +13 -7
- package/dist/Components/OffersList/OffersList.js +4 -2
- package/dist/Components/OptionChip/OptionChip.js +3 -2
- package/dist/Components/OptionChip/optionInk.js +4 -2
- package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.js +2 -1
- package/dist/Components/OrgSwitcher/OrgSwitcher.js +13 -6
- package/dist/Components/OrgSwitcher/OrgSwitcherProps.d.ts +1 -1
- package/dist/Components/OrganizationDetails/OrganizationDetails.js +4 -7
- package/dist/Components/OrganizationDetails/OrganizationDetailsProps.d.ts +4 -2
- package/dist/Components/PdfViewer/PdfViewer.d.ts +1 -0
- package/dist/Components/PlanBadge/PlanBadgeProps.d.ts +1 -1
- package/dist/Components/PlanPill/PlanPill.js +4 -2
- package/dist/Components/PlanPill/PlanPillProps.d.ts +1 -1
- package/dist/Components/ProductCard/ProductCardAction.js +2 -1
- package/dist/Components/ProductCard/ProductCardSwatches.js +2 -1
- package/dist/Components/ProductDetails/ProductDetails.js +2 -1
- package/dist/Components/ProfileCard/ProfileCard.d.ts +1 -0
- package/dist/Components/ProfileCard/ProfileCard.js +12 -26
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +4 -2
- package/dist/Components/ProgressBar/ProgressBar.js +2 -1
- package/dist/Components/QuantityStepper/QuantityStepper.js +5 -2
- package/dist/Components/QueryState/QueryStateBoundary.d.ts +1 -1
- package/dist/Components/QueryState/QueryStateBoundary.js +5 -1
- package/dist/Components/QueryState/QueryStateProps.d.ts +6 -2
- package/dist/Components/RadioButton/RadioButton.js +2 -3
- package/dist/Components/RolesPermission/RolesPermission.js +12 -8
- package/dist/Components/ScrollToTop/ScrollToTop.d.ts +1 -0
- package/dist/Components/ScrollbarBox/ScrollbarBox.d.ts +4 -1
- package/dist/Components/ScrollbarBox/ScrollbarBox.js +10 -4
- package/dist/Components/SearchSelect/SearchSelect.d.ts +1 -1
- package/dist/Components/SearchSelect/SearchSelect.js +8 -5
- package/dist/Components/SearchSelect/SearchSelectProps.d.ts +3 -3
- package/dist/Components/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/Components/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/Components/Select/Select.js +6 -0
- package/dist/Components/Select/SelectNative.d.ts +16 -0
- package/dist/Components/Select/SelectPopup.js +170 -63
- package/dist/Components/Select/SelectProps.d.ts +30 -2
- package/dist/Components/Select/groupedWindow.d.ts +21 -0
- package/dist/Components/Select/groupedWindow.js +50 -0
- package/dist/Components/SelectSearch/SelectSearch.d.ts +1 -1
- package/dist/Components/SelectSearch/SelectSearch.js +48 -38
- package/dist/Components/SelectSearch/SelectSearchProps.d.ts +3 -3
- package/dist/Components/SelectV2/SelectV2.d.ts +1 -1
- package/dist/Components/SelectV2/SelectV2.js +1 -1
- package/dist/Components/SelectV2/SelectV2Props.d.ts +3 -3
- package/dist/Components/SideBar/SecondaryBar.js +3 -2
- package/dist/Components/SideBar/components/MenuItemBox.js +3 -2
- package/dist/Components/SideBar/components/MenuItems.js +1 -1
- package/dist/Components/SideBar/components/OtherApps.js +2 -2
- package/dist/Components/SideBar/components/PinnedSection.js +1 -1
- package/dist/Components/SideBar/sidebarScale.d.ts +2 -2
- package/dist/Components/SideBar/sidebarScale.js +2 -2
- package/dist/Components/SignInActivityTable/SignInActivityTable.js +7 -2
- package/dist/Components/SignInActivityTable/SignInActivityTableProps.d.ts +1 -1
- package/dist/Components/SignInActivityTable/scrollRegionRing.d.ts +10 -0
- package/dist/Components/SignInActivityTable/scrollRegionRing.js +14 -0
- package/dist/Components/Skeletons/SkeletonProps.d.ts +5 -1
- package/dist/Components/Slider/Slider.d.ts +2 -0
- package/dist/Components/Slider/Slider.js +5 -4
- package/dist/Components/StageProgress/StageItem.js +2 -1
- package/dist/Components/StageProgress/StageProgress.js +8 -2
- package/dist/Components/StageProgress/StageProgressProps.d.ts +2 -0
- package/dist/Components/StageProgress/StepperStage.js +2 -1
- package/dist/Components/StickyBuyBar/StickyBuyBar.js +2 -1
- package/dist/Components/Table/Table.js +5 -3
- package/dist/Components/Table/components/HeaderActions.js +5 -3
- package/dist/Components/Table/components/TableBody.js +13 -8
- package/dist/Components/Table/components/TableGroupRow.js +2 -1
- package/dist/Components/Table/components/TableHeader.js +17 -21
- package/dist/Components/Table/components/TableLoading.js +8 -2
- package/dist/Components/Table/components/rowDetail.js +3 -2
- package/dist/Components/Table/filters/ActiveFilters.js +6 -3
- package/dist/Components/Table/filters/CompactSelect.js +2 -1
- package/dist/Components/Table/filters/FilterDatePicker.d.ts +6 -0
- package/dist/Components/Table/filters/FilterDatePicker.js +61 -0
- package/dist/Components/Table/filters/LeftFilterPane.d.ts +1 -0
- package/dist/Components/Table/filters/LeftFilterPane.js +14 -6
- package/dist/Components/Table/hooks/useTable.js +11 -7
- package/dist/Components/Table/settings/ManageColumns.js +4 -3
- package/dist/Components/Table/settings/TableSettings.js +4 -4
- package/dist/Components/Tabs/Tabs.d.ts +1 -0
- package/dist/Components/Tabs/Tabs.js +1 -0
- package/dist/Components/Tabs/components/CountBadge.d.ts +1 -0
- package/dist/Components/Tabs/components/TabList.d.ts +1 -0
- package/dist/Components/Tabs/components/TabList.js +1 -0
- package/dist/Components/Tabs/components/TabPanel.d.ts +1 -0
- package/dist/Components/Tabs/components/TabPanel.js +1 -0
- package/dist/Components/Tabs/tabStyles.js +4 -2
- package/dist/Components/Tag/Tag.js +5 -4
- package/dist/Components/Tag/Tag.styles.js +5 -4
- package/dist/Components/Tag/TagProps.d.ts +4 -1
- package/dist/Components/Tag/tagDot.js +10 -3
- package/dist/Components/TagInput/TagInput.js +6 -5
- package/dist/Components/TagInput/TagInputProps.d.ts +15 -0
- package/dist/Components/TagInput/tagEntries.d.ts +7 -1
- package/dist/Components/TagInput/tagEntries.js +18 -5
- package/dist/Components/TimePicker/TimePicker.js +7 -3
- package/dist/Components/TimePicker/TimePickerProps.d.ts +2 -0
- package/dist/Components/Timeline/Timeline.js +13 -9
- package/dist/Components/Toaster/Toaster.js +2 -1
- package/dist/Components/Toggle/TableToggle.d.ts +1 -1
- package/dist/Components/Toggle/TableToggle.js +1 -1
- package/dist/Components/UpgradeButton/UpgradeButton.js +3 -2
- package/dist/Components/UpgradeButton/UpgradeButtonProps.d.ts +1 -1
- package/dist/Components/UserDetails/UserDetails.js +5 -7
- package/dist/Components/WishlistToggle/WishlistToggle.js +2 -1
- package/dist/Components/WizardDialog/WizardDialog.d.ts +1 -1
- package/dist/Components/WizardDialog/WizardDialog.js +15 -3
- package/dist/Components/WizardDialog/WizardDialogProps.d.ts +5 -3
- package/dist/Components/WorkspaceWindow/WorkspaceTrayPreview.js +11 -1
- package/dist/Components/WorkspaceWindow/WorkspaceWindow.js +6 -3
- package/dist/Components/WorkspaceWindow/WorkspaceWindowProps.d.ts +16 -15
- package/dist/Hooks/useOutsideMouseDown.d.ts +11 -0
- package/dist/Hooks/useOutsideMouseDown.js +30 -0
- package/dist/Hooks/usePreferences.js +30 -12
- package/dist/Hooks/useScrollableRegion.d.ts +17 -0
- package/dist/Hooks/useScrollableRegion.js +36 -0
- package/dist/Hooks/useSidebarPrefs.d.ts +1 -0
- package/dist/Theme/chakra/Menu.styles.d.ts +4 -0
- package/dist/Theme/chakra/Menu.styles.js +6 -0
- package/dist/Theme/chakra/componentStyles.d.ts +4 -0
- package/dist/Theme/chakra/componentStyles.js +1 -1
- package/dist/Theme/chakra/createBrandTheme.d.ts +1 -0
- package/dist/Theme/chakra/focusRing.styles.d.ts +1 -1
- package/dist/Theme/chakra/focusRing.styles.js +3 -3
- package/dist/Theme/chakra/paletteFromTheme.d.ts +2 -1
- package/dist/Theme/chakra/paletteFromTheme.js +18 -4
- package/dist/Theme/chakra/ringShadow.d.ts +3 -0
- package/dist/Theme/chakra/ringShadow.js +7 -0
- package/dist/Theme/provider/PixelizeThemeProvider.d.ts +1 -0
- package/dist/Theme/provider/ThemeSwitcher.d.ts +1 -0
- package/dist/Theme/provider/ThemeSwitcher.js +1 -1
- package/dist/Theme/testing/testPalette.d.ts +1 -0
- package/dist/Theme/tokens/builders/buildDarkPalette.d.ts +2 -1
- package/dist/Theme/tokens/builders/buildDarkPalette.js +5 -5
- package/dist/Theme/tokens/builders/filledSurface.js +3 -2
- package/dist/Theme/tokens/builders/focusRing.js +4 -1
- package/dist/Theme/tokens/builders/paletteScale.d.ts +2 -0
- package/dist/Theme/tokens/builders/paletteScale.js +10 -0
- package/dist/Theme/tokens/types.d.ts +1 -0
- package/dist/Utils/accountHandoff.d.ts +3 -0
- package/dist/Utils/price.d.ts +1 -0
- package/dist/Utils/tabular.d.ts +30 -0
- package/dist/Utils/tabular.js +61 -0
- package/dist/esm/Components/Accordion/Accordion.js +11 -8
- package/dist/esm/Components/Accordion/accordionColors.js +2 -3
- package/dist/esm/Components/Apexcharts/ApexLineChart/ApexLineChart.js +2 -1
- package/dist/esm/Components/Apexcharts/ApexPieChart/ApexPieChart.js +6 -5
- package/dist/esm/Components/Apexcharts/ApexPieChart/pieImageTexture.js +10 -0
- package/dist/esm/Components/AppSwitcher/AppSwitcher.js +6 -3
- package/dist/esm/Components/AppSwitcher/AppSwitcherProps.js +18 -11
- package/dist/esm/Components/AppSwitcher/pixelizeSuite.js +67 -0
- package/dist/esm/Components/AppearanceSettings/AppearanceSettings.js +3 -3
- package/dist/esm/Components/Avatar/avatarColorway.js +4 -4
- package/dist/esm/Components/Button/Button.styles.js +5 -2
- package/dist/esm/Components/ButtonGroupIcon/ButtonGroupIcon.js +3 -1
- package/dist/esm/Components/CalendarGrid/CalendarGrid.js +5 -3
- package/dist/esm/Components/Card/Card.js +1 -0
- package/dist/esm/Components/Checkbox/Checkbox.styles.js +3 -1
- package/dist/esm/Components/CheckoutKit/selectable.js +10 -7
- package/dist/esm/Components/CheckoutKit/tonalHover.js +2 -0
- package/dist/esm/Components/ChoiceCard/ChoiceCard.js +2 -1
- package/dist/esm/Components/Common/FormLabel.js +4 -3
- package/dist/esm/Components/Common/HelperText.js +1 -2
- package/dist/esm/Components/Common/activationKey.js +7 -0
- package/dist/esm/Components/Common/fieldMessageStyles.js +2 -1
- package/dist/esm/Components/Common/findSlot.js +17 -0
- package/dist/esm/Components/Common/surfaceFocusRing.js +3 -0
- package/dist/esm/Components/ConfirmDialog/ConfirmDialog.js +18 -6
- package/dist/esm/Components/CopyButton/CopyButton.js +5 -8
- package/dist/esm/Components/CouponField/CouponField.js +5 -2
- package/dist/esm/Components/CustomModulesTable/CustomModulesTable.js +3 -1
- package/dist/esm/Components/DatePicker/CalendarPanel.js +3 -1
- package/dist/esm/Components/DatePicker/DatePicker.js +25 -27
- package/dist/esm/Components/DatePicker/PickerPortal.js +2 -2
- package/dist/esm/Components/DatePicker/RangeDatePicker.js +10 -29
- package/dist/esm/Components/DatePicker/SingleDatePicker.js +5 -21
- package/dist/esm/Components/DatePicker/TimeOnlyPicker.js +2 -20
- package/dist/esm/Components/DescriptionList/DescriptionList.js +1 -1
- package/dist/esm/Components/DetailSections/DetailSections.js +2 -1
- package/dist/esm/Components/Divider/Divider.js +3 -3
- package/dist/esm/Components/Drawer/Drawer.js +24 -19
- package/dist/esm/Components/Dropdown/DropDown.js +7 -22
- package/dist/esm/Components/Editor/Editor.js +7 -3
- package/dist/esm/Components/Editor/editorLabels.js +1 -0
- package/dist/esm/Components/Editor/editorTokenStyles.js +7 -0
- package/dist/esm/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtp.js +8 -4
- package/dist/esm/Components/EmptyState/FilteredEmptyState.js +18 -0
- package/dist/esm/Components/FilePreview/FilePreview.js +8 -4
- package/dist/esm/Components/FileUpload/FileUpload.js +8 -9
- package/dist/esm/Components/FileUploader/FileUploader.js +6 -7
- package/dist/esm/Components/FilterSidebar/FilterSidebar.js +94 -237
- package/dist/esm/Components/FilterSidebar/OptionsSection.js +41 -0
- package/dist/esm/Components/FilterSidebar/RangeSection.js +78 -0
- package/dist/esm/Components/FilterSidebar/SectionHeader.js +23 -0
- package/dist/esm/Components/FilterSidebar/useStableCallback.js +8 -0
- package/dist/esm/Components/Form/FormWrapper.js +5 -3
- package/dist/esm/Components/FormDrawer/FormDrawer.js +3 -3
- package/dist/esm/Components/FormField/FormField.js +1 -1
- package/dist/esm/Components/Header/Header.js +1 -1
- package/dist/esm/Components/Header/HeaderActions.js +6 -4
- package/dist/esm/Components/Input/TextInput.js +2 -2
- package/dist/esm/Components/KanbanBoard/AccountCard.js +1 -1
- package/dist/esm/Components/KanbanBoard/KanbanActions/KanbanActions.js +2 -2
- package/dist/esm/Components/KanbanBoard/KanbanBoard.js +11 -7
- package/dist/esm/Components/LauncherTrigger/LauncherTrigger.js +1 -1
- package/dist/esm/Components/LazyWrapper/LazyWrapper.js +1 -1
- package/dist/esm/Components/MediaViewer/MediaViewer.js +5 -4
- package/dist/esm/Components/MediaViewer/components/MediaAudioPlayer.js +5 -1
- package/dist/esm/Components/MediaViewer/components/MediaImageViewer.js +19 -8
- package/dist/esm/Components/MediaViewer/components/MediaScrubber.js +7 -2
- package/dist/esm/Components/MediaViewer/components/MediaVideoPlayer.js +3 -1
- package/dist/esm/Components/MediaViewer/components/ViewerIconButton.js +3 -1
- package/dist/esm/Components/MediaViewer/mediaItems.js +4 -0
- package/dist/esm/Components/Modal/Modal.js +2 -17
- package/dist/esm/Components/Modal/dialogNaming.js +18 -0
- package/dist/esm/Components/Modal/warnDroppedSlotChildren.js +7 -3
- package/dist/esm/Components/NavLauncher/LauncherTabs.js +4 -3
- package/dist/esm/Components/NavLauncher/NavLauncher.js +291 -59
- package/dist/esm/Components/NavLauncher/ScopeBar.js +136 -0
- package/dist/esm/Components/NavLauncher/engine/distance.js +37 -0
- package/dist/esm/Components/NavLauncher/engine/engine.js +459 -0
- package/dist/esm/Components/NavLauncher/engine/fold.js +75 -0
- package/dist/esm/Components/NavLauncher/engine/index.js +14 -0
- package/dist/esm/Components/NavLauncher/launcherParts.js +46 -10
- package/dist/esm/Components/NavLauncher/match.js +25 -12
- package/dist/esm/Components/NavLauncher/searchLayout.js +101 -0
- package/dist/esm/Components/NavLauncher/spotlight.js +194 -0
- package/dist/esm/Components/NavLauncher/spotlightParts.js +108 -0
- package/dist/esm/Components/NavLauncher/useCopiedFlash.js +17 -0
- package/dist/esm/Components/NavigationBar/NavigationBar.js +6 -5
- package/dist/esm/Components/NoteTextArea/NoteTextArea.js +12 -17
- package/dist/esm/Components/Notification/Notification.js +20 -22
- package/dist/esm/Components/NotificationBell/notificationHelpers.js +12 -6
- package/dist/esm/Components/OffersList/OffersList.js +4 -2
- package/dist/esm/Components/OptionChip/OptionChip.js +3 -2
- package/dist/esm/Components/OptionChip/optionInk.js +4 -2
- package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimeline.js +2 -1
- package/dist/esm/Components/OrgSwitcher/OrgSwitcher.js +14 -7
- package/dist/esm/Components/OrganizationDetails/OrganizationDetails.js +5 -8
- package/dist/esm/Components/PlanPill/PlanPill.js +4 -2
- package/dist/esm/Components/ProductCard/ProductCardAction.js +2 -1
- package/dist/esm/Components/ProductCard/ProductCardSwatches.js +2 -1
- package/dist/esm/Components/ProductDetails/ProductDetails.js +2 -1
- package/dist/esm/Components/ProfileCard/ProfileCard.js +6 -17
- package/dist/esm/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +4 -2
- package/dist/esm/Components/ProgressBar/ProgressBar.js +2 -1
- package/dist/esm/Components/QuantityStepper/QuantityStepper.js +5 -2
- package/dist/esm/Components/QueryState/QueryStateBoundary.js +5 -1
- package/dist/esm/Components/RadioButton/RadioButton.js +2 -3
- package/dist/esm/Components/RolesPermission/RolesPermission.js +12 -8
- package/dist/esm/Components/ScrollbarBox/ScrollbarBox.js +9 -3
- package/dist/esm/Components/SearchSelect/SearchSelect.js +8 -5
- package/dist/esm/Components/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/esm/Components/Select/Select.js +6 -0
- package/dist/esm/Components/Select/SelectPopup.js +171 -64
- package/dist/esm/Components/Select/groupedWindow.js +44 -0
- package/dist/esm/Components/SelectSearch/SelectSearch.js +49 -39
- package/dist/esm/Components/SelectV2/SelectV2.js +1 -1
- package/dist/esm/Components/SideBar/SecondaryBar.js +3 -2
- package/dist/esm/Components/SideBar/components/MenuItemBox.js +3 -2
- package/dist/esm/Components/SideBar/components/MenuItems.js +1 -1
- package/dist/esm/Components/SideBar/components/OtherApps.js +2 -2
- package/dist/esm/Components/SideBar/components/PinnedSection.js +1 -1
- package/dist/esm/Components/SideBar/sidebarScale.js +2 -2
- package/dist/esm/Components/SignInActivityTable/SignInActivityTable.js +8 -3
- package/dist/esm/Components/SignInActivityTable/scrollRegionRing.js +9 -0
- package/dist/esm/Components/Slider/Slider.js +6 -5
- package/dist/esm/Components/StageProgress/StageItem.js +2 -1
- package/dist/esm/Components/StageProgress/StageProgress.js +8 -2
- package/dist/esm/Components/StageProgress/StepperStage.js +2 -1
- package/dist/esm/Components/StickyBuyBar/StickyBuyBar.js +2 -1
- package/dist/esm/Components/Table/Table.js +8 -6
- package/dist/esm/Components/Table/components/HeaderActions.js +7 -5
- package/dist/esm/Components/Table/components/TableBody.js +13 -8
- package/dist/esm/Components/Table/components/TableGroupRow.js +2 -1
- package/dist/esm/Components/Table/components/TableHeader.js +19 -23
- package/dist/esm/Components/Table/components/TableLoading.js +6 -3
- package/dist/esm/Components/Table/components/rowDetail.js +3 -2
- package/dist/esm/Components/Table/filters/ActiveFilters.js +8 -5
- package/dist/esm/Components/Table/filters/CompactSelect.js +2 -1
- package/dist/esm/Components/Table/filters/FilterDatePicker.js +20 -0
- package/dist/esm/Components/Table/filters/LeftFilterPane.js +14 -6
- package/dist/esm/Components/Table/hooks/useTable.js +11 -7
- package/dist/esm/Components/Table/settings/ManageColumns.js +4 -3
- package/dist/esm/Components/Table/settings/TableSettings.js +4 -4
- package/dist/esm/Components/Tabs/Tabs.js +1 -0
- package/dist/esm/Components/Tabs/components/TabList.js +1 -0
- package/dist/esm/Components/Tabs/components/TabPanel.js +1 -0
- package/dist/esm/Components/Tabs/tabStyles.js +5 -3
- package/dist/esm/Components/Tag/Tag.js +5 -4
- package/dist/esm/Components/Tag/Tag.styles.js +5 -4
- package/dist/esm/Components/Tag/tagDot.js +10 -3
- package/dist/esm/Components/TagInput/TagInput.js +8 -7
- package/dist/esm/Components/TagInput/tagEntries.js +16 -4
- package/dist/esm/Components/TimePicker/TimePicker.js +7 -3
- package/dist/esm/Components/Timeline/Timeline.js +14 -10
- package/dist/esm/Components/Toaster/Toaster.js +2 -1
- package/dist/esm/Components/Toggle/TableToggle.js +1 -1
- package/dist/esm/Components/UpgradeButton/UpgradeButton.js +3 -2
- package/dist/esm/Components/UserDetails/UserDetails.js +5 -7
- package/dist/esm/Components/WishlistToggle/WishlistToggle.js +2 -1
- package/dist/esm/Components/WizardDialog/WizardDialog.js +15 -3
- package/dist/esm/Components/WorkspaceWindow/WorkspaceTrayPreview.js +12 -2
- package/dist/esm/Components/WorkspaceWindow/WorkspaceWindow.js +7 -4
- package/dist/esm/Hooks/useOutsideMouseDown.js +26 -0
- package/dist/esm/Hooks/usePreferences.js +30 -12
- package/dist/esm/Hooks/useScrollableRegion.js +33 -0
- package/dist/esm/Theme/chakra/Menu.styles.js +6 -0
- package/dist/esm/Theme/chakra/componentStyles.js +1 -1
- package/dist/esm/Theme/chakra/focusRing.styles.js +3 -3
- package/dist/esm/Theme/chakra/paletteFromTheme.js +16 -3
- package/dist/esm/Theme/chakra/ringShadow.js +3 -0
- package/dist/esm/Theme/provider/ThemeSwitcher.js +1 -1
- package/dist/esm/Theme/tokens/builders/buildDarkPalette.js +5 -5
- package/dist/esm/Theme/tokens/builders/filledSurface.js +3 -2
- package/dist/esm/Theme/tokens/builders/focusRing.js +4 -1
- package/dist/esm/Theme/tokens/builders/paletteScale.js +6 -0
- package/dist/esm/Utils/tabular.js +56 -0
- package/dist/esm/index.js +18 -25
- package/dist/index.d.ts +59 -5
- package/dist/index.js +36 -29
- package/package.json +3 -1
- package/dist/Components/Buttons/Buttons.d.ts +0 -3
- package/dist/Components/Buttons/Buttons.js +0 -9
- package/dist/Components/Buttons/ButtonsProps.d.ts +0 -12
- package/dist/Components/Common/ErrorComponent.d.ts +0 -7
- package/dist/Components/Common/ErrorComponent.js +0 -16
- package/dist/Components/Common/FormattedDescription.d.ts +0 -7
- package/dist/Components/Common/FormattedDescription.js +0 -62
- package/dist/Components/Common/Label.d.ts +0 -9
- package/dist/Components/Common/Label.js +0 -12
- package/dist/Components/Input/Input/Input.d.ts +0 -4
- package/dist/Components/Input/Input/Input.js +0 -75
- package/dist/Components/Input/Input/InputProps.d.ts +0 -24
- package/dist/Components/Input/Input/InputProps.js +0 -2
- package/dist/Components/ProductCard/productCardFixtures.d.ts +0 -7
- package/dist/Components/ProductCard/productCardFixtures.js +0 -61
- package/dist/esm/Components/Buttons/Buttons.js +0 -4
- package/dist/esm/Components/Common/ErrorComponent.js +0 -14
- package/dist/esm/Components/Common/FormattedDescription.js +0 -60
- package/dist/esm/Components/Common/Label.js +0 -10
- package/dist/esm/Components/Input/Input/Input.js +0 -37
- package/dist/esm/Components/Input/Input/InputProps.js +0 -1
- package/dist/esm/Components/ProductCard/productCardFixtures.js +0 -58
- package/dist/esm/services/feedback.js +0 -15
- package/dist/services/feedback.d.ts +0 -12
- package/dist/services/feedback.js +0 -18
- /package/dist/Components/{Buttons/ButtonsProps.js → Common/dataAttributes.js} +0 -0
- /package/dist/esm/Components/{Buttons/ButtonsProps.js → Common/dataAttributes.js} +0 -0
|
@@ -1,256 +1,113 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState } from "react";
|
|
3
|
-
import { Box, Flex, Text, VStack,
|
|
4
|
-
import {
|
|
3
|
+
import { Box, Flex, Text, VStack, Button } from "@chakra-ui/react";
|
|
4
|
+
import { X } from "lucide-react";
|
|
5
5
|
import Accordion from "../Accordion/Accordion.js";
|
|
6
|
-
import CheckBox from "../Checkbox/Checkbox.js";
|
|
7
|
-
import ToolTip from "../ToolTip/ToolTip.js";
|
|
8
6
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
9
|
-
import {
|
|
10
|
-
import { bandOn } from "../../Theme/tokens/builders/planeStep.js";
|
|
7
|
+
import { cardRule } from "../../Theme/tokens/builders/planeStep.js";
|
|
11
8
|
import { getFilterHoverBg } from "./filterHoverStyle.js";
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}) => {
|
|
9
|
+
import RangeSection from "./RangeSection.js";
|
|
10
|
+
import OptionsSection from "./OptionsSection.js";
|
|
11
|
+
import { SectionHeader, SectionClear } from "./SectionHeader.js";
|
|
12
|
+
import { useStableCallback } from "./useStableCallback.js";
|
|
13
|
+
const CLEAR_RIGHT = "2.25rem";
|
|
14
|
+
const FilterSidebar = ({ sidebarOptions, selected, onChange, maxVisible = 10, width = 280, variant = "minimal", containerPadding, containerHeight, panelPadding = 3, clearAllButton = true, onClearAllHandler, }) => {
|
|
18
15
|
const theme = useCustomTheme();
|
|
19
16
|
const hoverBg = useMemo(() => getFilterHoverBg(theme.colors), [theme.colors]);
|
|
20
|
-
const
|
|
21
|
-
const ratingPick = useMemo(() => bandOn(theme.colors.primary[50], theme.colors.background[50]), [theme.colors]);
|
|
22
|
-
const [openPrice, setOpenPrice] = useState({});
|
|
23
|
-
// Determine if the component is controlled (prop provided) or uncontrolled (internal state)
|
|
17
|
+
const rule = useMemo(() => cardRule(theme.colors), [theme.colors]);
|
|
24
18
|
const isControlled = selected !== undefined;
|
|
25
|
-
// Local state for uncontrolled mode
|
|
26
19
|
const [localSelected, setLocalSelected] = useState(() => ({ ...(selected || {}) }));
|
|
27
|
-
|
|
28
|
-
const internalSelected = (selected !== undefined ? selected : localSelected);
|
|
29
|
-
// Wrapper for state updates to handle both modes
|
|
30
|
-
const setInternalSelected = (updater) => {
|
|
31
|
-
const next = typeof updater === 'function' ? (updater)(internalSelected) : updater;
|
|
32
|
-
// In the existing code, the updater function often handles calling onChange.
|
|
33
|
-
// However, for safety in uncontrolled mode, we update local state.
|
|
34
|
-
if (!isControlled) {
|
|
35
|
-
setLocalSelected(next);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
20
|
+
const internalSelected = selected !== undefined ? selected : localSelected;
|
|
38
21
|
const [expanded, setExpanded] = useState(() => {
|
|
39
22
|
const initial = {};
|
|
40
23
|
sidebarOptions.forEach((s) => (initial[s.id] = !!s.initiallyExpanded));
|
|
41
24
|
return initial;
|
|
42
25
|
});
|
|
43
26
|
const [searchTerms, setSearchTerms] = useState({});
|
|
44
|
-
const activeCount = useMemo(() =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(next);
|
|
71
|
-
return next;
|
|
72
|
-
});
|
|
73
|
-
};
|
|
27
|
+
const activeCount = useMemo(() => Object.values(internalSelected).reduce((acc, v) => acc + (Array.isArray(v) ? v.length : 0), 0), [internalSelected]);
|
|
28
|
+
const commit = useStableCallback((next) => {
|
|
29
|
+
if (!isControlled)
|
|
30
|
+
setLocalSelected(next);
|
|
31
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(next);
|
|
32
|
+
});
|
|
33
|
+
const setValue = useStableCallback((sectionId, value) => {
|
|
34
|
+
commit({ ...internalSelected, [sectionId]: value });
|
|
35
|
+
});
|
|
36
|
+
const toggleOption = useStableCallback((sectionId, optionId, checked) => {
|
|
37
|
+
const raw = internalSelected[sectionId];
|
|
38
|
+
const current = new Set(Array.isArray(raw) ? raw : []);
|
|
39
|
+
if (checked)
|
|
40
|
+
current.add(optionId);
|
|
41
|
+
else
|
|
42
|
+
current.delete(optionId);
|
|
43
|
+
setValue(sectionId, Array.from(current));
|
|
44
|
+
});
|
|
45
|
+
const clearSection = useStableCallback((sectionId, control) => {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
(_b = (_a = control.closest("h2")) === null || _a === void 0 ? void 0 : _a.querySelector("button")) === null || _b === void 0 ? void 0 : _b.focus();
|
|
48
|
+
const next = { ...internalSelected };
|
|
49
|
+
delete next[sectionId];
|
|
50
|
+
commit(next);
|
|
51
|
+
});
|
|
74
52
|
const clearAll = () => {
|
|
75
53
|
onClearAllHandler === null || onClearAllHandler === void 0 ? void 0 : onClearAllHandler();
|
|
76
|
-
|
|
77
|
-
const next = {};
|
|
78
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(next);
|
|
79
|
-
return next;
|
|
80
|
-
});
|
|
54
|
+
commit({});
|
|
81
55
|
};
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
margin: 0,
|
|
139
|
-
} }), _jsx("input", { type: "range", "aria-label": `${section.label}: maximum`, min: range.min, max: range.max, step: step, value: currentMax, className: "custom-range-slider", onChange: (e) => {
|
|
140
|
-
const max = Math.max(Number(e.target.value), currentMin + (step || 1));
|
|
141
|
-
const nextVal = [currentMin, max];
|
|
142
|
-
setInternalSelected((prev) => { const next = { ...prev, [section.id]: nextVal }; onChange === null || onChange === void 0 ? void 0 : onChange(next); return next; });
|
|
143
|
-
}, style: {
|
|
144
|
-
position: 'absolute',
|
|
145
|
-
width: '100%',
|
|
146
|
-
height: '100%',
|
|
147
|
-
opacity: 0,
|
|
148
|
-
appearance: 'none',
|
|
149
|
-
pointerEvents: 'none', // Allow clicks to pass through track
|
|
150
|
-
zIndex: 3,
|
|
151
|
-
margin: 0,
|
|
152
|
-
} })] }), _jsxs(SimpleGrid, { columns: 2, spacing: 2, pt: 2, w: "full", children: [_jsxs(Popover, { isOpen: openPrice.id === section.id && openPrice.target === "min", onClose: () => setOpenPrice({}), placement: "bottom-start", closeOnBlur: true, children: [_jsx(PopoverTrigger, { children: _jsx(Flex, { borderWidth: "0", borderRadius: "md", alignItems: "center", px: 3, py: 2, bg: theme.colors.background[50], borderColor: theme.colors.boxborder[500], cursor: "pointer", "data-testid": `range-trigger-min-${section.id}`, onClick: () => setOpenPrice({ id: section.id, target: "min" }), gap: 2, overflow: "hidden", children: _jsx(Box, { ml: "auto", children: _jsxs(Text, { fontSize: "xs", color: theme.colors.text[500], whiteSpace: "nowrap", children: [currentMin, range.unit ? ` ${range.unit}` : ""] }) }) }) }), _jsx(Portal, { children: _jsx(PopoverContent, { width: "6rem", p: 0, zIndex: 1600, bg: theme.colors.surfaceRaised, children: _jsx(PopoverBody, { p: 0, children: _jsx(VStack, { align: "stretch", spacing: 0, maxH: "12rem", overflowY: "auto", children: values.map((v) => (_jsxs(Flex, { px: 2, py: 1, align: "center", justify: "space-between", cursor: "pointer", bg: currentMin === v ? rangePick : theme.colors.surfaceRaised, borderLeftWidth: currentMin === v ? 3 : 0, borderLeftStyle: "solid", borderLeftColor: currentMin === v ? theme.colors.primary[400] : "transparent", _hover: { bg: hoverBg }, "data-testid": `range-option-min-${section.id}-${v}`, onClick: () => {
|
|
153
|
-
const min = v;
|
|
154
|
-
const max = currentMax;
|
|
155
|
-
const nextVal = [Math.min(min, max), Math.max(min, max)];
|
|
156
|
-
setInternalSelected((prev) => { const next = { ...prev, [section.id]: nextVal }; onChange === null || onChange === void 0 ? void 0 : onChange(next); return next; });
|
|
157
|
-
setOpenPrice({});
|
|
158
|
-
}, children: [_jsxs(Text, { fontSize: "sm", color: theme.colors.text[500], children: [v, range.unit ? ` ${range.unit}` : ""] }), currentMin === v ? (_jsx(Box, { bg: theme.colors.primary[100], borderRadius: "full", p: 1, display: "flex", alignItems: "center", children: _jsx(Check, { size: 9, color: onFilled(theme.colors.primary[100], theme.colors.white, theme.colors.black) }) })) : null] }, `min-${v}`))) }) }) }) })] }), _jsxs(Popover, { isOpen: openPrice.id === section.id && openPrice.target === "max", onClose: () => setOpenPrice({}), placement: "bottom-start", closeOnBlur: true, children: [_jsx(PopoverTrigger, { children: _jsx(Flex, { borderWidth: "0", borderRadius: "md", alignItems: "center", px: 3, py: 2, bg: theme.colors.background[50], borderColor: theme.colors.boxborder[500], cursor: "pointer", "data-testid": `range-trigger-max-${section.id}`, onClick: () => setOpenPrice({ id: section.id, target: "max" }), gap: 2, overflow: "hidden", children: _jsx(Box, { ml: "auto", children: _jsxs(Text, { fontSize: "xs", color: theme.colors.text[500], whiteSpace: "nowrap", children: [currentMax, range.unit ? ` ${range.unit}` : ""] }) }) }) }), _jsx(PopoverContent, { width: "6rem", p: 0, bg: theme.colors.surfaceRaised, children: _jsx(PopoverBody, { p: 0, children: _jsx(VStack, { align: "stretch", spacing: 0, maxH: "12rem", overflowY: "auto", children: values.map((v) => (_jsxs(Flex, { px: 2, py: 1, align: "center", justify: "space-between", cursor: "pointer", bg: currentMax === v ? rangePick : theme.colors.surfaceRaised, borderLeftWidth: currentMax === v ? 3 : 0, borderLeftStyle: "solid", borderLeftColor: currentMax === v ? theme.colors.primary[400] : "transparent", _hover: { bg: hoverBg }, "data-testid": `range-option-max-${section.id}-${v}`, onClick: () => {
|
|
159
|
-
const max = v;
|
|
160
|
-
const min = currentMin;
|
|
161
|
-
const nextVal = [Math.min(min, max), Math.max(min, max)];
|
|
162
|
-
setInternalSelected((prev) => { const next = { ...prev, [section.id]: nextVal }; onChange === null || onChange === void 0 ? void 0 : onChange(next); return next; });
|
|
163
|
-
setOpenPrice({});
|
|
164
|
-
}, children: [_jsxs(Text, { fontSize: "sm", color: theme.colors.text[500], children: [v, range.unit ? ` ${range.unit}` : ""] }), currentMax === v ? (_jsx(Box, { bg: theme.colors.primary[100], borderRadius: "full", p: 1, display: "flex", alignItems: "center", children: _jsx(Check, { size: 9, color: onFilled(theme.colors.primary[100], theme.colors.white, theme.colors.black) }) })) : null] }, `max-${v}`))) }) }) })] })] })] }));
|
|
165
|
-
})()) : (_jsxs(_Fragment, { children: [section.id === "rating" ? (_jsx(VStack, { align: "start", spacing: 1, w: "full", children: [4, 3, 2, 1].map((r) => (_jsx(Flex, { align: "center", justify: "space-between", w: "full", p: 1, borderRadius: "md", cursor: "pointer", bg: String(internalSelected[section.id] || "") === String(r) ? ratingPick : "transparent", border: String(internalSelected[section.id] || "") === String(r) ? `1px solid ${theme.colors.primary[200]}` : "none", _hover: { bg: hoverBg }, onClick: () => {
|
|
166
|
-
setInternalSelected((prev) => {
|
|
167
|
-
const next = { ...prev, [section.id]: String(r) };
|
|
168
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(next);
|
|
169
|
-
return next;
|
|
170
|
-
});
|
|
171
|
-
}, children: _jsxs(HStack, { spacing: 2, align: "center", children: [_jsx(HStack, { spacing: 1, children: (() => {
|
|
172
|
-
// orange[500] on background[50] ~2.2:1, fails the 3:1 icon bar — walk the scale like
|
|
173
|
-
// Notification's clock icon. Canvas mirrors this row's own bg ternary (red[50] when selected).
|
|
174
|
-
const isRowSelected = String(internalSelected[section.id] || "") === String(r);
|
|
175
|
-
const starColor = accentTextOnCanvas(theme.colors.orange, isRowSelected ? ratingPick : theme.colors.background[50]);
|
|
176
|
-
return Array.from({ length: 5 }, (_, i) => (_jsx(Box, { children: _jsx(Star, { size: 16, color: starColor, fill: i < r ? starColor : "none" }) }, `star-${r}-${i}`)));
|
|
177
|
-
})() }), _jsx(Text, { fontSize: "sm", color: theme.colors.text[500], children: "& Up" })] }) }, `rating-${r}`))) })) : null, section.searchable && (_jsx(Input, { size: "xs", h: "26px", fontSize: "xs", "aria-label": `Search ${section.label}`, placeholder: `Search ${section.label}...`, borderRadius: "md", bg: theme.colors.background[50], border: "1px solid",
|
|
178
|
-
// NOTE: boxborder[500] not gray[200] — WCAG 1.4.11 needs >=3:1 for a control boundary; gray[200] fails in dark.
|
|
179
|
-
borderColor: theme.colors.boxborder[500], _focus: { borderColor: theme.colors.primary[500], ...fieldFocusVisible(theme.colors) }, value: searchTerms[section.id] || "", onChange: (e) => {
|
|
180
|
-
const v = e.target.value;
|
|
181
|
-
setSearchTerms((prev) => ({ ...prev, [section.id]: v }));
|
|
182
|
-
if (v)
|
|
183
|
-
setExpanded((prev) => ({ ...prev, [section.id]: true }));
|
|
184
|
-
} })), section.id !== "rating" && (() => {
|
|
185
|
-
const filteredOptions = (expanded[section.id] ? (section.options || []) : (section.options || []).slice(0, maxVisible))
|
|
186
|
-
.filter((opt) => !section.searchable || !(searchTerms[section.id]) || opt.label.toLowerCase().includes((searchTerms[section.id] || "").toLowerCase()));
|
|
187
|
-
if (filteredOptions.length === 0 && searchTerms[section.id]) {
|
|
188
|
-
return (_jsx(Box, { p: 2, w: "full", textAlign: "center", children: _jsx(Text, { fontSize: "xs", color: theme.colors.textMuted, children: "No Data Found" }) }));
|
|
189
|
-
}
|
|
190
|
-
return ((section.type === "radio") || section.radio) ? (_jsx(RadioGroup, { w: "full", value: internalSelected[section.id] || "", onChange: (val) => {
|
|
191
|
-
setInternalSelected((prev) => {
|
|
192
|
-
const next = { ...prev, [section.id]: val };
|
|
193
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(next);
|
|
194
|
-
return next;
|
|
195
|
-
});
|
|
196
|
-
}, children: _jsx(VStack, { align: "start", spacing: 1, w: "full", children: filteredOptions.map((opt) => (_jsx(Radio, { value: opt.id, size: "sm", children: _jsx(Text, { fontSize: "xs", color: theme.colors.text[500], children: opt.label }) }, opt.id))) }) })) : (filteredOptions.map((opt) => {
|
|
197
|
-
const selectedForSection = internalSelected[section.id];
|
|
198
|
-
const selectedIds = Array.isArray(selectedForSection)
|
|
199
|
-
? selectedForSection
|
|
200
|
-
: [];
|
|
201
|
-
return (_jsxs(Flex, { align: "center", justify: "space-between", w: "full", _hover: { bg: hoverBg, borderRadius: "md" }, p: 0, children: [_jsxs(Flex, { align: "center", gap: 1, children: [_jsx(CheckBox, { "aria-label": `${section.label}: ${opt.label}`, isChecked: selectedIds.includes(opt.id), onChange: (e) => {
|
|
202
|
-
toggleOption(section.id, opt.id, e.target.checked);
|
|
203
|
-
}, size: "sm" }), _jsx(Text, { fontSize: "xs", color: theme.colors.text[500], cursor: "pointer", onClick: () => {
|
|
204
|
-
const isChecked = selectedIds.includes(opt.id);
|
|
205
|
-
toggleOption(section.id, opt.id, !isChecked);
|
|
206
|
-
}, children: opt.label })] }), typeof opt.count === "number" && (_jsx(Badge, { fontSize: "xs", colorScheme: "gray", borderRadius: "full", px: 2, children: opt.count }))] }, opt.id));
|
|
207
|
-
}));
|
|
208
|
-
})(), (section.options && section.options.length > maxVisible) && (_jsx(Text, { as: "span", role: "button", tabIndex: 0, fontSize: "sm", fontWeight: 500, color: theme.colors.accentText, cursor: "pointer", _hover: { textDecoration: "underline" }, onClick: () => setExpanded((prev) => ({ ...prev, [section.id]: !prev[section.id] })), onKeyDown: (e) => {
|
|
209
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
210
|
-
e.preventDefault();
|
|
211
|
-
setExpanded((prev) => ({ ...prev, [section.id]: !prev[section.id] }));
|
|
212
|
-
}
|
|
213
|
-
}, children: expanded[section.id] ? "Show less" : `+ ${(section.options.length - maxVisible)} more` }))] })) })),
|
|
214
|
-
itemProps: {
|
|
215
|
-
borderTop: "none",
|
|
216
|
-
borderBottom: `1px solid ${theme.colors.boxborder[200]}`,
|
|
217
|
-
_last: { borderBottom: "none" }
|
|
218
|
-
},
|
|
219
|
-
buttonProps: {
|
|
220
|
-
_hover: { bg: hoverBg }
|
|
221
|
-
},
|
|
222
|
-
panelProps: {},
|
|
223
|
-
customStyles: {
|
|
224
|
-
buttonStyle: variant === "minimal"
|
|
225
|
-
? {
|
|
226
|
-
justifyContent: "space-between",
|
|
227
|
-
padding: 0,
|
|
228
|
-
background: "transparent",
|
|
229
|
-
}
|
|
230
|
-
: {
|
|
231
|
-
justifyContent: "space-between",
|
|
232
|
-
padding: 0,
|
|
233
|
-
background: theme.colors.background[50],
|
|
234
|
-
borderRadius: theme.radii.lg,
|
|
235
|
-
border: `1px solid ${theme.colors.boxborder[200]}`,
|
|
236
|
-
marginBottom: 6,
|
|
237
|
-
},
|
|
238
|
-
// Reasserts the same hover fill via the `sx` path (belt-and-suspenders alongside
|
|
239
|
-
// `buttonProps._hover` above) so the header hover doesn't depend on a single merge path.
|
|
240
|
-
hoverbuttonStyle: { background: hoverBg },
|
|
241
|
-
panelStyle: variant === "minimal"
|
|
242
|
-
? {
|
|
243
|
-
padding: "10px 0 12px 0",
|
|
244
|
-
overflow: "visible",
|
|
245
|
-
}
|
|
246
|
-
: {
|
|
247
|
-
padding: panelPadding,
|
|
248
|
-
background: theme.colors.background[50],
|
|
249
|
-
borderRadius: theme.radii.lg,
|
|
250
|
-
overflow: "visible",
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
}));
|
|
254
|
-
return (_jsxs(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.boxborder[200]}` : "none", h: "fit-content", maxH: containerHeight !== undefined ? containerHeight : undefined, overflowY: containerHeight !== undefined ? "auto" : "visible", children: [_jsxs(Flex, { className: "filters-header", align: "center", justify: "space-between", mb: 2, borderBottom: "2px solid", borderColor: theme.colors.boxborder[200], children: [_jsx(Text, { fontSize: "lg", fontWeight: 700, color: theme.colors.text[500], children: "Filters" }), activeCount > 0 && clearAllButton && (_jsx(_Fragment, { children: _jsx(Button, { size: "xs", variant: "outline", leftIcon: _jsx(X, { size: 12 }), onClick: clearAll, "aria-label": "Clear All", className: "clear-all-btn", colorScheme: "red", children: "Clear All" }) }))] }), _jsx(Accordion, { allowMultiple: true, defaultIndex: sidebarOptions.map((_, i) => i), items: items })] }));
|
|
56
|
+
const setSearchTerm = useStableCallback((sectionId, term) => {
|
|
57
|
+
setSearchTerms((prev) => ({ ...prev, [sectionId]: term }));
|
|
58
|
+
if (term)
|
|
59
|
+
setExpanded((prev) => ({ ...prev, [sectionId]: true }));
|
|
60
|
+
});
|
|
61
|
+
const toggleExpanded = useStableCallback((sectionId) => {
|
|
62
|
+
setExpanded((prev) => ({ ...prev, [sectionId]: !prev[sectionId] }));
|
|
63
|
+
});
|
|
64
|
+
const items = sidebarOptions.map((section) => {
|
|
65
|
+
const sel = internalSelected[section.id];
|
|
66
|
+
const hasValue = Array.isArray(sel) ? sel.length > 0 : !!sel;
|
|
67
|
+
return {
|
|
68
|
+
header: (_jsx(SectionHeader, { label: section.label, hasValue: hasValue })),
|
|
69
|
+
headerAction: hasValue ? (_jsx(SectionClear, { sectionId: section.id, label: section.label, onClear: clearSection })) : undefined,
|
|
70
|
+
content: (_jsx(VStack, { align: "start", spacing: 1, py: 0, children: section.range ? (_jsx(RangeSection, { sectionId: section.id, label: section.label, range: section.range, value: sel, onChange: setValue })) : (_jsx(OptionsSection, { section: section, value: sel, searchTerm: searchTerms[section.id] || "", isExpanded: !!expanded[section.id], maxVisible: maxVisible, onToggle: toggleOption, onValue: setValue, onSearch: setSearchTerm, onToggleExpanded: toggleExpanded })) })),
|
|
71
|
+
itemProps: {
|
|
72
|
+
borderTop: "none",
|
|
73
|
+
borderBottom: `1px solid ${rule}`,
|
|
74
|
+
_last: { borderBottom: "none" },
|
|
75
|
+
},
|
|
76
|
+
buttonProps: {
|
|
77
|
+
_hover: { bg: hoverBg },
|
|
78
|
+
},
|
|
79
|
+
panelProps: {},
|
|
80
|
+
customStyles: {
|
|
81
|
+
buttonStyle: variant === "minimal"
|
|
82
|
+
? {
|
|
83
|
+
justifyContent: "space-between",
|
|
84
|
+
padding: 0,
|
|
85
|
+
background: "transparent",
|
|
86
|
+
}
|
|
87
|
+
: {
|
|
88
|
+
justifyContent: "space-between",
|
|
89
|
+
padding: 0,
|
|
90
|
+
background: theme.colors.background[50],
|
|
91
|
+
borderRadius: theme.radii.lg,
|
|
92
|
+
border: `1px solid ${rule}`,
|
|
93
|
+
marginBottom: 6,
|
|
94
|
+
},
|
|
95
|
+
hoverbuttonStyle: { background: hoverBg },
|
|
96
|
+
headerActionStyle: { right: CLEAR_RIGHT },
|
|
97
|
+
panelStyle: variant === "minimal"
|
|
98
|
+
? {
|
|
99
|
+
padding: "10px 0 12px 0",
|
|
100
|
+
overflow: "visible",
|
|
101
|
+
}
|
|
102
|
+
: {
|
|
103
|
+
padding: panelPadding,
|
|
104
|
+
background: theme.colors.background[50],
|
|
105
|
+
borderRadius: theme.radii.lg,
|
|
106
|
+
overflow: "visible",
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
return (_jsxs(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.boxborder[200]}` : "none", h: "fit-content", maxH: containerHeight !== undefined ? containerHeight : undefined, overflowY: containerHeight !== undefined ? "auto" : "visible", children: [_jsxs(Flex, { className: "filters-header", align: "center", justify: "space-between", mb: 2, borderBottom: "2px solid", borderColor: rule, children: [_jsx(Text, { fontSize: "lg", fontWeight: 700, color: theme.colors.text[500], children: "Filters" }), activeCount > 0 && clearAllButton && (_jsx(_Fragment, { children: _jsx(Button, { size: "xs", variant: "outline", leftIcon: _jsx(X, { size: 12 }), onClick: clearAll, "aria-label": "Clear All", className: "clear-all-btn", colorScheme: "red", children: "Clear All" }) }))] }), _jsx(Accordion, { allowMultiple: true, defaultIndex: sidebarOptions.map((_, i) => i), items: items })] }));
|
|
255
112
|
};
|
|
256
113
|
export default FilterSidebar;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { Box, Flex, Text, VStack, HStack, Badge, Input, Radio, RadioGroup } from "@chakra-ui/react";
|
|
4
|
+
import { Star } from "lucide-react";
|
|
5
|
+
import CheckBox from "../Checkbox/Checkbox.js";
|
|
6
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
7
|
+
import { accentTextOnCanvas } from "../../Theme/tokens/builders/accentText.js";
|
|
8
|
+
import { bandOn } from "../../Theme/tokens/builders/planeStep.js";
|
|
9
|
+
import { getFilterHoverBg } from "./filterHoverStyle.js";
|
|
10
|
+
import { fieldFocusVisible, insetFocusRingShadow } from "../../Theme/chakra/focusRing.styles.js";
|
|
11
|
+
import { onActivationKey } from "../Common/activationKey.js";
|
|
12
|
+
const RATINGS = [4, 3, 2, 1];
|
|
13
|
+
const STARS = [0, 1, 2, 3, 4];
|
|
14
|
+
const OptionsSection = memo(({ section, value, searchTerm, isExpanded, maxVisible, onToggle, onValue, onSearch, onToggleExpanded, }) => {
|
|
15
|
+
const theme = useCustomTheme();
|
|
16
|
+
const hoverBg = useMemo(() => getFilterHoverBg(theme.colors), [theme.colors]);
|
|
17
|
+
const ratingPick = useMemo(() => bandOn(theme.colors.primary[50], theme.colors.background[50]), [theme.colors]);
|
|
18
|
+
const insetFocusRing = useMemo(() => ({ outline: "2px solid transparent", boxShadow: insetFocusRingShadow(theme.colors) }), [theme.colors]);
|
|
19
|
+
const options = section.options || [];
|
|
20
|
+
const selectedIds = Array.isArray(value) ? value : [];
|
|
21
|
+
const isRadio = section.type === "radio" || section.radio;
|
|
22
|
+
const visible = (isExpanded ? options : options.slice(0, maxVisible)).filter((opt) => !section.searchable || !searchTerm || opt.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
23
|
+
const renderList = () => {
|
|
24
|
+
if (visible.length === 0 && searchTerm) {
|
|
25
|
+
return (_jsx(Box, { p: 2, w: "full", textAlign: "center", children: _jsx(Text, { fontSize: "xs", color: theme.colors.textMuted, children: "No Data Found" }) }));
|
|
26
|
+
}
|
|
27
|
+
if (isRadio) {
|
|
28
|
+
return (_jsx(RadioGroup, { w: "full", value: value || "", onChange: (val) => onValue(section.id, val), children: _jsx(VStack, { align: "start", spacing: 1, w: "full", children: visible.map((opt) => (_jsx(Radio, { value: opt.id, size: "sm", children: _jsx(Text, { fontSize: "xs", color: theme.colors.text[500], children: opt.label }) }, opt.id))) }) }));
|
|
29
|
+
}
|
|
30
|
+
return visible.map((opt) => (_jsxs(Flex, { align: "center", justify: "space-between", w: "full", _hover: { bg: hoverBg, borderRadius: "md" }, p: 0, children: [_jsxs(Flex, { align: "center", gap: 1, children: [_jsx(CheckBox, { "aria-label": `${section.label}: ${opt.label}`, isChecked: selectedIds.includes(opt.id), onChange: (e) => onToggle(section.id, opt.id, e.target.checked), size: "sm" }), _jsx(Text, { fontSize: "xs", color: theme.colors.text[500], cursor: "pointer", onClick: () => onToggle(section.id, opt.id, !selectedIds.includes(opt.id)), children: opt.label })] }), typeof opt.count === "number" && (_jsx(Badge, { fontSize: "xs", colorScheme: "gray", borderRadius: "full", px: 2, children: opt.count }))] }, opt.id)));
|
|
31
|
+
};
|
|
32
|
+
return (_jsxs(_Fragment, { children: [section.id === "rating" ? (_jsx(VStack, { align: "start", spacing: 1, w: "full", children: RATINGS.map((r) => {
|
|
33
|
+
const isRowSelected = String(value || "") === String(r);
|
|
34
|
+
// NOTE: orange[500] is ~2.2:1 on background[50]; walk the scale for 3:1.
|
|
35
|
+
const starColor = accentTextOnCanvas(theme.colors.orange, isRowSelected ? ratingPick : theme.colors.background[50]);
|
|
36
|
+
return (_jsx(Flex, { as: "button", type: "button", "aria-pressed": isRowSelected, "aria-label": `${section.label}: ${r} stars & up`, align: "center", justify: "space-between", w: "full", p: 1, borderRadius: "md", cursor: "pointer", bg: isRowSelected ? ratingPick : "transparent", border: isRowSelected ? `1px solid ${theme.colors.primary[200]}` : "none", _hover: { bg: hoverBg }, _focusVisible: insetFocusRing, onClick: () => onValue(section.id, String(r)), children: _jsxs(HStack, { spacing: 2, align: "center", children: [_jsx(HStack, { spacing: 1, children: STARS.map((i) => (_jsx(Box, { children: _jsx(Star, { size: 16, color: starColor, fill: i < r ? starColor : "none" }) }, `star-${r}-${i}`))) }), _jsx(Text, { fontSize: "sm", color: theme.colors.text[500], children: "& Up" })] }) }, `rating-${r}`));
|
|
37
|
+
}) })) : null, section.searchable && (_jsx(Input, { size: "xs", h: "26px", fontSize: "xs", "aria-label": `Search ${section.label}`, placeholder: `Search ${section.label}...`, borderRadius: "md", bg: theme.colors.background[50], border: "1px solid",
|
|
38
|
+
// NOTE: boxborder[500] not gray[200]; WCAG 1.4.11 needs 3:1 for a control boundary.
|
|
39
|
+
borderColor: theme.colors.boxborder[500], _focus: { borderColor: theme.colors.primary[500], ...fieldFocusVisible(theme.colors) }, value: searchTerm, onChange: (e) => onSearch(section.id, e.target.value) })), section.id !== "rating" && renderList(), options.length > maxVisible && (_jsx(Text, { as: "span", role: "button", tabIndex: 0, fontSize: "sm", fontWeight: 500, color: theme.colors.accentText, cursor: "pointer", _hover: { textDecoration: "underline" }, onClick: () => onToggleExpanded(section.id), onKeyDown: onActivationKey(() => onToggleExpanded(section.id)), children: isExpanded ? "Show less" : `+ ${options.length - maxVisible} more` }))] }));
|
|
40
|
+
});
|
|
41
|
+
export default OptionsSection;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo, useState } from "react";
|
|
3
|
+
import { Box, Flex, Text, VStack, SimpleGrid, Popover, PopoverTrigger, PopoverContent, PopoverBody, Portal } from "@chakra-ui/react";
|
|
4
|
+
import { Check } from "lucide-react";
|
|
5
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
6
|
+
import { onFilled } from "../../Theme/tokens/builders/accentText.js";
|
|
7
|
+
import { bandOn, cardRule } from "../../Theme/tokens/builders/planeStep.js";
|
|
8
|
+
import { getFilterHoverBg } from "./filterHoverStyle.js";
|
|
9
|
+
import { focusVisibleRing, insetFocusRingShadow } from "../../Theme/chakra/focusRing.styles.js";
|
|
10
|
+
const SLIDER_CSS = `
|
|
11
|
+
.custom-range-slider::-webkit-slider-thumb {
|
|
12
|
+
pointer-events: auto;
|
|
13
|
+
width: 24px;
|
|
14
|
+
height: 24px;
|
|
15
|
+
-webkit-appearance: none;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
.custom-range-slider::-moz-range-thumb {
|
|
19
|
+
pointer-events: auto;
|
|
20
|
+
width: 24px;
|
|
21
|
+
height: 24px;
|
|
22
|
+
border: none;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
const NATIVE_INPUT_STYLE = {
|
|
27
|
+
position: "absolute",
|
|
28
|
+
width: "100%",
|
|
29
|
+
height: "100%",
|
|
30
|
+
opacity: 0,
|
|
31
|
+
appearance: "none",
|
|
32
|
+
pointerEvents: "none",
|
|
33
|
+
zIndex: 3,
|
|
34
|
+
margin: 0,
|
|
35
|
+
};
|
|
36
|
+
const TICKS = [0, 25, 50, 75, 100];
|
|
37
|
+
const BoundPicker = ({ bound, sectionId, label, values, current, unit, isOpen, onOpen, onClose, onPick }) => {
|
|
38
|
+
const theme = useCustomTheme();
|
|
39
|
+
const hoverBg = useMemo(() => getFilterHoverBg(theme.colors), [theme.colors]);
|
|
40
|
+
const pickFill = useMemo(() => bandOn(theme.colors.primary[50], theme.colors.surfaceRaised), [theme.colors]);
|
|
41
|
+
const focusRing = useMemo(() => focusVisibleRing(theme.colors), [theme.colors]);
|
|
42
|
+
const insetFocusRing = useMemo(() => ({ outline: "2px solid transparent", boxShadow: insetFocusRingShadow(theme.colors) }), [theme.colors]);
|
|
43
|
+
const unitSuffix = unit ? ` ${unit}` : "";
|
|
44
|
+
const boundName = bound === "min" ? "minimum" : "maximum";
|
|
45
|
+
// NOTE: raw scale ink can miss 3:1 on its own fill; onFilled matches it.
|
|
46
|
+
const checkInk = onFilled(theme.colors.primary[100], theme.colors.white, theme.colors.black);
|
|
47
|
+
return (_jsxs(Popover, { isOpen: isOpen, onClose: onClose, placement: "bottom-start", closeOnBlur: true, children: [_jsx(PopoverTrigger, { children: _jsx(Flex, { as: "button", type: "button", "aria-label": `${label} ${boundName}: ${current}${unitSuffix}`, borderWidth: "0", borderRadius: "md", alignItems: "center", px: 3, py: 2, bg: theme.colors.background[50], borderColor: theme.colors.boxborder[500], cursor: "pointer", _focusVisible: focusRing, "data-testid": `range-trigger-${bound}-${sectionId}`, onClick: onOpen, gap: 2, overflow: "hidden", children: _jsx(Box, { ml: "auto", children: _jsxs(Text, { fontSize: "xs", color: theme.colors.text[500], whiteSpace: "nowrap", children: [current, unitSuffix] }) }) }) }), _jsx(Portal, { children: _jsx(PopoverContent, { width: "6rem", p: 0, zIndex: 1600, bg: theme.colors.surfaceRaised, "aria-label": `${label} ${boundName}`, children: _jsx(PopoverBody, { p: 0, children: _jsx(VStack, { align: "stretch", spacing: 0, maxH: "12rem", overflowY: "auto", children: values.map((v) => (_jsxs(Flex, { as: "button", type: "button", "aria-pressed": current === v, px: 2, py: 1, align: "center", justify: "space-between", cursor: "pointer", bg: current === v ? pickFill : theme.colors.surfaceRaised, borderLeftWidth: current === v ? 3 : 0, borderLeftStyle: "solid", borderLeftColor: current === v ? theme.colors.primary[400] : "transparent", _hover: { bg: hoverBg }, _focusVisible: insetFocusRing, "data-testid": `range-option-${bound}-${sectionId}-${v}`, onClick: () => onPick(v), children: [_jsxs(Text, { fontSize: "sm", color: theme.colors.text[500], children: [v, unitSuffix] }), current === v ? (_jsx(Box, { bg: theme.colors.primary[100], borderRadius: "full", p: 1, display: "flex", alignItems: "center", children: _jsx(Check, { size: 9, color: checkInk }) })) : null] }, `${bound}-${v}`))) }) }) }) })] }));
|
|
48
|
+
};
|
|
49
|
+
const RangeSection = memo(({ sectionId, label, range, value, onChange }) => {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
const theme = useCustomTheme();
|
|
52
|
+
const [openBound, setOpenBound] = useState(null);
|
|
53
|
+
const step = range.step || 1;
|
|
54
|
+
const rangeArr = Array.isArray(value) ? value : [];
|
|
55
|
+
const currentMin = (_a = rangeArr[0]) !== null && _a !== void 0 ? _a : range.min;
|
|
56
|
+
const currentMax = (_b = rangeArr[1]) !== null && _b !== void 0 ? _b : range.max;
|
|
57
|
+
const values = useMemo(() => range.values || Array.from({ length: Math.floor((range.max - range.min) / step) + 1 }, (_, i) => range.min + i * step), [range.values, range.min, range.max, step]);
|
|
58
|
+
const unitSuffix = range.unit ? ` ${range.unit}` : "";
|
|
59
|
+
const minPercent = ((currentMin - range.min) / (range.max - range.min)) * 100;
|
|
60
|
+
const maxPercent = ((currentMax - range.min) / (range.max - range.min)) * 100;
|
|
61
|
+
const primaryColor = theme.colors.primary[300];
|
|
62
|
+
const secondaryColor = theme.colors.primary[600];
|
|
63
|
+
const trackColor = cardRule(theme.colors);
|
|
64
|
+
const chipBorder = `1px solid ${trackColor}`;
|
|
65
|
+
const thumbSize = { base: "16px", md: "20px" };
|
|
66
|
+
const chipTop = { base: "-18px", md: "-22px" };
|
|
67
|
+
const pick = (bound, v) => {
|
|
68
|
+
const other = bound === "min" ? currentMax : currentMin;
|
|
69
|
+
onChange(sectionId, [Math.min(v, other), Math.max(v, other)]);
|
|
70
|
+
setOpenBound(null);
|
|
71
|
+
};
|
|
72
|
+
return (_jsxs(Box, { w: "full", px: 3, children: [_jsx("style", { children: SLIDER_CSS }), _jsxs(Box, { w: "full", position: "relative", h: { base: "24px", md: "30px" }, display: "flex", alignItems: "center", children: [_jsx(Box, { position: "absolute", left: "0", right: "0", height: "6px", bg: trackColor, borderRadius: "full" }), _jsx(Box, { position: "absolute", height: "6px", style: {
|
|
73
|
+
left: `${minPercent}%`,
|
|
74
|
+
width: `${maxPercent - minPercent}%`,
|
|
75
|
+
background: `linear-gradient(to right, ${primaryColor}, ${secondaryColor})`,
|
|
76
|
+
}, borderRadius: "full", boxShadow: `0 0 8px ${theme.colors.primary.opacity[32]}` }), [[minPercent, primaryColor], [maxPercent, secondaryColor]].map(([percent, color], i) => (_jsx(Box, { position: "absolute", style: { left: `${percent}%` }, transform: "translate(-50%, 0)", w: thumbSize, h: thumbSize, borderRadius: "full", bg: theme.colors.background[50], border: "3px solid", borderColor: color, boxShadow: theme.shadows.md, zIndex: 2 }, i))), [[minPercent, currentMin], [maxPercent, currentMax]].map(([percent, current], i) => (_jsxs(Box, { position: "absolute", style: { left: `${percent}%` }, top: chipTop, transform: "translate(-50%, -100%)", px: 2, py: 1, bg: theme.colors.background[50], border: chipBorder, borderRadius: "lg", fontSize: "xs-minus", color: theme.colors.text[500], boxShadow: "sm", zIndex: 3, children: [current, unitSuffix] }, i))), TICKS.map((p) => (_jsx(Box, { position: "absolute", left: `${p}%`, bottom: "-8px", transform: "translateX(-50%)", w: "1px", h: "8px", bg: theme.colors.boxborder[500] }, `tick-${p}`))), _jsx("input", { type: "range", "aria-label": `${label}: minimum`, min: range.min, max: range.max, step: step, value: currentMin, className: "custom-range-slider", onChange: (e) => onChange(sectionId, [Math.min(Number(e.target.value), currentMax - step), currentMax]), style: NATIVE_INPUT_STYLE }), _jsx("input", { type: "range", "aria-label": `${label}: maximum`, min: range.min, max: range.max, step: step, value: currentMax, className: "custom-range-slider", onChange: (e) => onChange(sectionId, [currentMin, Math.max(Number(e.target.value), currentMin + step)]), style: NATIVE_INPUT_STYLE })] }), _jsx(SimpleGrid, { columns: 2, spacing: 2, pt: 2, w: "full", children: ["min", "max"].map((bound) => (_jsx(BoundPicker, { bound: bound, sectionId: sectionId, label: label, values: values, current: bound === "min" ? currentMin : currentMax, unit: range.unit, isOpen: openBound === bound, onOpen: () => setOpenBound(bound), onClose: () => setOpenBound(null), onPick: (v) => pick(bound, v) }, bound))) })] }));
|
|
77
|
+
});
|
|
78
|
+
export default RangeSection;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { Badge, Flex, Text } from "@chakra-ui/react";
|
|
4
|
+
import { ChevronDownIcon } from "lucide-react";
|
|
5
|
+
import ToolTip from "../ToolTip/ToolTip.js";
|
|
6
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
7
|
+
import { focusVisibleRing } from "../../Theme/chakra/focusRing.styles.js";
|
|
8
|
+
import { onActivationKey } from "../Common/activationKey.js";
|
|
9
|
+
const CLEAR_BADGE = {
|
|
10
|
+
colorScheme: "red",
|
|
11
|
+
variant: "solid",
|
|
12
|
+
fontSize: "xs",
|
|
13
|
+
borderRadius: "full",
|
|
14
|
+
px: 2,
|
|
15
|
+
};
|
|
16
|
+
export const SectionHeader = memo(({ label, hasValue }) => {
|
|
17
|
+
const theme = useCustomTheme();
|
|
18
|
+
return (_jsxs(Flex, { justify: "space-between", align: "center", w: "full", py: 1, children: [_jsx(ToolTip, { label: label, hasArrow: true, placement: "top", fontSize: "xs", children: _jsx(Text, { fontWeight: 700, fontSize: "md", color: theme.colors.text[500], textAlign: "left", isTruncated: true, flex: "1", minW: 0, children: label }) }), hasValue ? (_jsx(Badge, { ...CLEAR_BADGE, "aria-hidden": true, visibility: "hidden", _after: { content: '"Clear"' } })) : (_jsx(ChevronDownIcon, { size: 10 }))] }));
|
|
19
|
+
});
|
|
20
|
+
export const SectionClear = memo(({ sectionId, label, onClear }) => {
|
|
21
|
+
const theme = useCustomTheme();
|
|
22
|
+
return (_jsx(Badge, { ...CLEAR_BADGE, cursor: "pointer", role: "button", tabIndex: 0, "aria-label": `Clear ${label}`, _focusVisible: focusVisibleRing(theme.colors), onClick: (e) => onClear(sectionId, e.currentTarget), onKeyDown: onActivationKey((e) => onClear(sectionId, e.currentTarget)), children: "Clear" }));
|
|
23
|
+
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Icon } from "@chakra-ui/react";
|
|
3
|
+
import { isValidElement } from "react";
|
|
3
4
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
const isElement = (icon) => isValidElement(icon);
|
|
6
|
+
/** Renders an icon+label header above a bordered card — not an HTML form; no submit/validation, just a section wrapper. id, data-* and aria-* land on the outer wrapper. */
|
|
7
|
+
const FormWrapper = ({ icon, text, children, ...rest }) => {
|
|
6
8
|
const { colors } = useCustomTheme();
|
|
7
|
-
return (_jsxs(Box, { children: [_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, mb: 2, children: [icon && _jsx(Icon, { as: icon, boxSize: "1rem", color: colors.header[500] }), text && (_jsx(Box, { fontWeight: 600, fontSize: "xs", lineHeight: "1", textTransform: "uppercase", color: colors.header[500], children: text }))] }), _jsx(Box, { borderRadius: "xl", bg: colors.background[50], borderWidth: "1px", borderStyle: "solid", borderColor: colors.boxborder[200], p: "1.5rem", children: children })] }));
|
|
9
|
+
return (_jsxs(Box, { ...rest, children: [_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, mb: 2, children: [isElement(icon) ? (_jsx(Box, { display: "inline-flex", boxSize: "1rem", color: colors.header[500], sx: { "& > svg": { width: "100%", height: "100%" } }, children: icon })) : (icon && _jsx(Icon, { as: icon, boxSize: "1rem", color: colors.header[500] })), text && (_jsx(Box, { fontWeight: 600, fontSize: "xs", lineHeight: "1", textTransform: "uppercase", color: colors.header[500], children: text }))] }), _jsx(Box, { borderRadius: "xl", bg: colors.background[50], borderWidth: "1px", borderStyle: "solid", borderColor: colors.boxborder[200], p: "1.5rem", children: children })] }));
|
|
8
10
|
};
|
|
9
11
|
export default FormWrapper;
|
|
@@ -12,7 +12,7 @@ const DEFAULT_LABELS = {
|
|
|
12
12
|
discard: "Discard",
|
|
13
13
|
keepEditing: "Keep editing",
|
|
14
14
|
};
|
|
15
|
-
export default function FormDrawer({ isOpen, onClose, title, description, sections, errors = [], isDirty, onSubmit, isSubmitting = false, submitLabel = "Save", cancelLabel = "Cancel", secondaryAction, size = "md", labels, "data-testid": testId = "form-drawer", }) {
|
|
15
|
+
export default function FormDrawer({ isOpen, onClose, title, description, sections, errors = [], isDirty, onSubmit, isSubmitting = false, isSubmitDisabled = false, submitLabel = "Save", cancelLabel = "Cancel", secondaryAction, size = "md", labels, "data-testid": testId = "form-drawer", }) {
|
|
16
16
|
const { colors } = useCustomTheme();
|
|
17
17
|
const uid = useId();
|
|
18
18
|
const formId = `${uid}-form`;
|
|
@@ -45,7 +45,7 @@ export default function FormDrawer({ isOpen, onClose, title, description, sectio
|
|
|
45
45
|
};
|
|
46
46
|
const submit = (event) => {
|
|
47
47
|
event.preventDefault();
|
|
48
|
-
if (isSubmitting)
|
|
48
|
+
if (isSubmitting || isSubmitDisabled)
|
|
49
49
|
return;
|
|
50
50
|
focusPending.current = true;
|
|
51
51
|
setAttempt((n) => n + 1);
|
|
@@ -54,5 +54,5 @@ export default function FormDrawer({ isOpen, onClose, title, description, sectio
|
|
|
54
54
|
return (_jsxs(Drawer, { isOpen: isOpen, onClose: requestClose, size: size, closeOnEsc: !isSubmitting, closeOnOverlayClick: !isSubmitting, portalChildren: _jsx(AlertDialog, { isOpen: confirmDiscard, onClose: () => setConfirmDiscard(false), leastDestructiveRef: keepEditingRef, isCentered: true, tone: "danger", title: text.discardTitle, content: _jsx(Text, { fontSize: "sm", color: colors.text[800], children: text.discardBody }), cancelButtonText: text.keepEditing, confirmButtonText: text.discard, onConfirm: () => {
|
|
55
55
|
setConfirmDiscard(false);
|
|
56
56
|
onClose();
|
|
57
|
-
} }), children: [_jsxs(DrawerHeader, { children: [_jsx(Heading, { id: titleId, as: "h2", fontSize: "md", fontWeight: 600, color: colors.header[900], children: title }), description ? (_jsx(Text, { mt: 0.5, fontSize: "sm", fontWeight: 400, color: colors.textMuted, children: description })) : null] }), _jsx(DrawerBody, { children: _jsx(Box, { as: "form", id: formId, "aria-labelledby": titleId, onSubmit: submit, noValidate: true, "data-testid": testId, children: _jsxs(Flex, { direction: "column", gap: 5, pt: 2, children: [errors.length ? (_jsxs(Alert, { ref: summaryRef, tabIndex: -1, status: "error", variant: "subtle", borderRadius: "md", alignItems: "flex-start", "data-testid": `${testId}-errors`, children: [_jsx(AlertIcon, {}), _jsxs(Box, { children: [_jsx(AlertTitle, { fontSize: "sm", children: text.fixErrors }), _jsx(AlertDescription, { fontSize: "sm", children: _jsx(UnorderedList, { mt: 1, children: errors.map((message) => (_jsx(ListItem, { children: message }, message))) }) })] })] })) : null, sections.map((section, index) => (_jsxs(Fragment, { children: [index > 0 ? _jsx(Divider, { borderColor: colors.boxborder[200] }) : null, _jsxs(Flex, { as: "section", direction: "column", gap: 4, "aria-label": section.title, children: [section.title ? (_jsxs(Box, { children: [_jsx(Heading, { as: "h3", fontSize: "sm", fontWeight: 600, color: colors.header[900], children: section.title }), section.description ? (_jsx(Text, { mt: 0.5, fontSize: "xs", color: colors.textMuted, children: section.description })) : null] })) : null, section.content] })] }, section.id)))] }) }) }), _jsx(DrawerFooter, { children: _jsxs(Flex, { gap: 2, w: "100%", justify: "flex-end", wrap: "wrap", children: [secondaryAction, _jsx(Button, { variant: "ghost", colorScheme: "gray", onClick: requestClose, isDisabled: isSubmitting, label: cancelLabel }), _jsx(Button, { variant: "solid", colorScheme: "primary", type: "submit", form: formId, isLoading: isSubmitting, loadingText: submitLabel, label: submitLabel, "data-testid": `${testId}-submit` })] }) })] }));
|
|
57
|
+
} }), children: [_jsxs(DrawerHeader, { children: [_jsx(Heading, { id: titleId, as: "h2", fontSize: "md", fontWeight: 600, color: colors.header[900], children: title }), description ? (_jsx(Text, { mt: 0.5, fontSize: "sm", fontWeight: 400, color: colors.textMuted, children: description })) : null] }), _jsx(DrawerBody, { children: _jsx(Box, { as: "form", id: formId, "aria-labelledby": titleId, onSubmit: submit, noValidate: true, "data-testid": testId, children: _jsxs(Flex, { direction: "column", gap: 5, pt: 2, children: [errors.length ? (_jsxs(Alert, { ref: summaryRef, tabIndex: -1, status: "error", variant: "subtle", borderRadius: "md", alignItems: "flex-start", "data-testid": `${testId}-errors`, children: [_jsx(AlertIcon, {}), _jsxs(Box, { children: [_jsx(AlertTitle, { fontSize: "sm", children: text.fixErrors }), _jsx(AlertDescription, { fontSize: "sm", children: _jsx(UnorderedList, { mt: 1, children: errors.map((message) => (_jsx(ListItem, { children: message }, message))) }) })] })] })) : null, sections.map((section, index) => (_jsxs(Fragment, { children: [index > 0 ? _jsx(Divider, { borderColor: colors.boxborder[200] }) : null, _jsxs(Flex, { as: "section", direction: "column", gap: 4, "aria-label": section.title, children: [section.title ? (_jsxs(Box, { children: [_jsx(Heading, { as: "h3", fontSize: "sm", fontWeight: 600, color: colors.header[900], children: section.title }), section.description ? (_jsx(Text, { mt: 0.5, fontSize: "xs", color: colors.textMuted, children: section.description })) : null] })) : null, section.content] })] }, section.id)))] }) }) }), _jsx(DrawerFooter, { children: _jsxs(Flex, { gap: 2, w: "100%", justify: "flex-end", wrap: "wrap", children: [secondaryAction, _jsx(Button, { variant: "ghost", colorScheme: "gray", onClick: requestClose, isDisabled: isSubmitting, label: cancelLabel }), _jsx(Button, { variant: "solid", colorScheme: "primary", type: "submit", form: formId, isLoading: isSubmitting, isDisabled: isSubmitDisabled, loadingText: submitLabel, label: submitLabel, "data-testid": `${testId}-submit` })] }) })] }));
|
|
58
58
|
}
|