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
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Flex, Text } from "@chakra-ui/react";
|
|
3
|
+
import { ChevronDown, Search as SearchIcon } from "lucide-react";
|
|
4
|
+
import { useRef } from "react";
|
|
5
|
+
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
6
|
+
import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
|
|
7
|
+
import { raisedRule } from "../../Theme/tokens/builders/surfaceRaised.js";
|
|
8
|
+
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
9
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
10
|
+
import Button from "../Button/Button.js";
|
|
11
|
+
import CopyButton from "../CopyButton/CopyButton.js";
|
|
12
|
+
import { KbdShortcut } from "../Kbd/Kbd.js";
|
|
13
|
+
import { activeRowStyle, activeRowSurface, copyHint, CountBadge, Highlight, HintLabel, useTouchDensity, } from "./launcherParts.js";
|
|
14
|
+
export const QUICK_ACTION_LIMIT = 5;
|
|
15
|
+
const HIDE_ON_TOUCH = { "@media (hover: none)": { display: "none" } };
|
|
16
|
+
const COPIED_ON_TOUCH = (backgroundColor) => ({
|
|
17
|
+
"@media (hover: none)": {
|
|
18
|
+
position: "absolute",
|
|
19
|
+
top: "50%",
|
|
20
|
+
right: "10px",
|
|
21
|
+
transform: "translateY(-50%)",
|
|
22
|
+
padding: "2px 8px",
|
|
23
|
+
borderRadius: "md",
|
|
24
|
+
backgroundColor,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export function QuickActionsRow({ items, label, link, onRun, }) {
|
|
28
|
+
return (_jsx(Flex, { role: "group", "aria-label": label, "data-testid": "launcher-quick-actions", gap: "6px", minW: 0, flexWrap: "wrap", px: "4px", children: items.slice(0, QUICK_ACTION_LIMIT).map((item) => {
|
|
29
|
+
const Icon = item.icon;
|
|
30
|
+
const common = {
|
|
31
|
+
variant: "outline",
|
|
32
|
+
colorScheme: "gray",
|
|
33
|
+
size: "sm",
|
|
34
|
+
borderRadius: "full",
|
|
35
|
+
flexShrink: 0,
|
|
36
|
+
label: item.label,
|
|
37
|
+
leftIcon: Icon ? (_jsx(Icon, { size: 14, strokeWidth: 2, "aria-hidden": true })) : undefined,
|
|
38
|
+
};
|
|
39
|
+
return item.href && !item.run ? (_jsx(Button, { ...common, as: link.linkAs, href: item.href, onClick: link.onPlainClick }, item.id)) : (_jsx(Button, { ...common, onClick: () => onRun(item) }, item.id));
|
|
40
|
+
}) }));
|
|
41
|
+
}
|
|
42
|
+
const useCardSurface = (isActive) => {
|
|
43
|
+
const { colors } = useCustomTheme();
|
|
44
|
+
const { edge, fill } = activeRowStyle(colors);
|
|
45
|
+
return {
|
|
46
|
+
position: "relative",
|
|
47
|
+
borderRadius: "xl",
|
|
48
|
+
borderWidth: "1px",
|
|
49
|
+
borderColor: isActive ? edge : raisedRule(colors),
|
|
50
|
+
bg: isActive ? fill : colors.surfaceRaised,
|
|
51
|
+
transition: transitionFor(["background-color", "border-color"]),
|
|
52
|
+
sx: reducedMotionSx(),
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
function IconChip({ icon, size }) {
|
|
56
|
+
const { colors } = useCustomTheme();
|
|
57
|
+
const Icon = icon !== null && icon !== void 0 ? icon : SearchIcon;
|
|
58
|
+
return (_jsx(Flex, { boxSize: `${size}px`, borderRadius: "10px", bg: colors.primary.opacity[8], color: colors.accentText, align: "center", justify: "center", flexShrink: 0, children: _jsx(Icon, { size: Math.round(size / 2), strokeWidth: 1.8, "aria-hidden": true }) }));
|
|
59
|
+
}
|
|
60
|
+
function CardAnchor({ item, link }) {
|
|
61
|
+
if (!item.href)
|
|
62
|
+
return null;
|
|
63
|
+
return (_jsx(Box, { as: link.linkAs, href: item.href, tabIndex: -1, "aria-hidden": true, onClick: link.onPlainClick, position: "absolute", inset: 0, borderRadius: "xl" }));
|
|
64
|
+
}
|
|
65
|
+
export function TopHitCard({ item, query, isActive, optionId, link, labels, onOpen, onHover, describedBy, }) {
|
|
66
|
+
const { colors } = useCustomTheme();
|
|
67
|
+
const surface = useCardSurface(isActive);
|
|
68
|
+
const meta = [item.context, item.hint].filter(Boolean).join(" · ");
|
|
69
|
+
return (_jsxs(Flex, { role: "presentation", "data-group": true, "data-reveal": isActive, direction: "column", gap: "10px", p: "12px", onMouseMove: onHover, ...surface, children: [_jsxs(Flex, { id: optionId, role: "option", "aria-selected": isActive, "aria-describedby": describedBy, "data-active": isActive, align: "center", gap: "12px", minW: 0, cursor: "pointer", onClick: () => {
|
|
70
|
+
if (!item.href)
|
|
71
|
+
onOpen();
|
|
72
|
+
}, children: [_jsx(IconChip, { icon: item.icon, size: 40 }), _jsxs(Flex, { direction: "column", flex: 1, minW: 0, gap: "2px", children: [_jsx(Text, { fontSize: "md", lineHeight: "22px", fontWeight: 600, color: colors.text[900], noOfLines: 1, children: _jsx(Highlight, { text: item.label, query: query }) }), meta ? (_jsx(Text, { fontSize: "xs-plus", color: colors.textMuted, noOfLines: 1, children: meta })) : null, item.keywordHint ? (_jsxs(Text, { fontSize: "xs", color: colors.textMuted, noOfLines: 1, children: [`${labels.matchedOn} “`, _jsx(Highlight, { text: item.keywordHint, query: query }), "\u201D"] })) : null] }), _jsx(CountBadge, { value: item.badge }), _jsx(Box, { "aria-hidden": true, flexShrink: 0, visibility: isActive ? "visible" : "hidden", sx: HIDE_ON_TOUCH, children: _jsx(KbdShortcut, { shortcut: "enter", size: "sm" }) })] }), _jsx(CardAnchor, { item: item, link: link })] }));
|
|
73
|
+
}
|
|
74
|
+
export function AnswerCard({ item, isActive, isCopied, optionId, link, labels, onOpen, onHover, describedBy, }) {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
const { colors } = useCustomTheme();
|
|
77
|
+
const surface = useCardSurface(isActive);
|
|
78
|
+
const answer = (_a = item.answer) !== null && _a !== void 0 ? _a : {
|
|
79
|
+
label: (_b = item.context) !== null && _b !== void 0 ? _b : "",
|
|
80
|
+
value: item.label,
|
|
81
|
+
};
|
|
82
|
+
const acts = Boolean(item.href || item.run);
|
|
83
|
+
const hint = acts ? labels.hintOpen : labels.hintCopy;
|
|
84
|
+
return (_jsxs(Flex, { role: "presentation", "data-group": true, p: "12px 14px", onMouseMove: onHover, ...surface, children: [_jsxs(Flex, { id: optionId, role: "option", "aria-selected": isActive, "aria-describedby": describedBy, "data-active": isActive, align: "center", gap: "12px", flex: 1, minW: 0, cursor: "pointer", onClick: () => {
|
|
85
|
+
if (!item.href)
|
|
86
|
+
onOpen();
|
|
87
|
+
}, children: [_jsx(IconChip, { icon: item.icon, size: 36 }), _jsxs(Flex, { direction: "column", flex: 1, minW: 0, gap: "1px", children: [answer.label ? (_jsx(Text, { fontSize: "xs-minus", fontWeight: 600, letterSpacing: "0.06em", textTransform: "uppercase", color: colors.textMuted, noOfLines: 1, children: answer.label })) : null, _jsx(Text, { id: `${optionId}-value`, fontSize: "lg", lineHeight: "24px", fontWeight: 600, color: colors.text[900], noOfLines: 2, children: answer.value }), answer.hint ? (_jsx(Text, { fontSize: "xs", color: colors.textMuted, noOfLines: 1, children: answer.hint })) : null] }), _jsxs(Flex, { "aria-hidden": true, align: "center", gap: "6px", flexShrink: 0, fontSize: "xs-minus", color: colors.textMuted, visibility: isActive || isCopied ? "visible" : "hidden", sx: isCopied ? COPIED_ON_TOUCH(surface.bg) : HIDE_ON_TOUCH, children: [_jsx(Box, { display: "contents", sx: HIDE_ON_TOUCH, children: _jsx(KbdShortcut, { shortcut: "enter", size: "xs" }) }), _jsx(HintLabel, { ...copyHint(hint, labels.copied, isCopied) })] })] }), _jsx(CardAnchor, { item: item, link: link })] }));
|
|
88
|
+
}
|
|
89
|
+
export function ShowMoreOption({ count, isActive, optionId, label, onExpand, onHover, }) {
|
|
90
|
+
const { colors } = useCustomTheme();
|
|
91
|
+
const isTouch = useTouchDensity();
|
|
92
|
+
return (_jsxs(Flex, { id: optionId, role: "option", "aria-selected": isActive, "data-active": isActive, align: "center", gap: "6px", minH: isTouch ? "44px" : "30px", px: "8px", mt: "2px", borderRadius: "lg", cursor: "pointer", fontSize: "xs-plus", fontWeight: 500, color: colors.accentText, onClick: onExpand, onMouseMove: onHover, _hover: { bg: listRowBackgrounds(colors).active }, sx: isActive ? activeRowSurface(colors) : undefined, children: [_jsx(ChevronDown, { size: 14, strokeWidth: 2, "aria-hidden": true }), label(count)] }));
|
|
93
|
+
}
|
|
94
|
+
export const describeFacts = (facts) => facts.map((f) => `${f.label}: ${f.value}`).join("; ");
|
|
95
|
+
export function FactList({ facts, labels, layout, onCopied, onCopyBlocked, }) {
|
|
96
|
+
const { colors } = useCustomTheme();
|
|
97
|
+
const values = useRef([]);
|
|
98
|
+
const isPane = layout === "pane";
|
|
99
|
+
return (_jsx(Box, { as: "dl", m: 0, display: "grid", gridTemplateColumns: isPane ? "minmax(0, 1fr)" : "repeat(auto-fill, minmax(11rem, 1fr))", gap: isPane ? "12px" : "6px 16px", children: facts.map((fact, i) => (_jsxs(Box, { minW: 0, children: [_jsx(Text, { as: "dt", fontSize: "xs-minus", lineHeight: "16px", color: colors.textMuted, children: fact.label }), _jsxs(Flex, { as: "dd", m: 0, align: "center", gap: "2px", minW: 0, children: [_jsx(Text, { ref: (node) => {
|
|
100
|
+
values.current[i] = node;
|
|
101
|
+
}, fontSize: isPane ? "13.5px" : "xs-plus", lineHeight: "20px", color: colors.text[900], wordBreak: "break-word", minW: 0, children: fact.value }), fact.copyable ? (_jsx(CopyButton, { value: fact.value, tooltip: labels.copy(fact.label), copiedLabel: labels.copied, size: isPane ? "xs" : "sm", iconSize: 14, onCopy: onCopied, onCopyError: () => onCopyBlocked(values.current[i]) })) : null] })] }, `${fact.label}-${i}`))) }));
|
|
102
|
+
}
|
|
103
|
+
export function PreviewPane({ item, placement, width, enterCopies, isCopied, labels, onCopied, onCopyBlocked, }) {
|
|
104
|
+
var _a, _b, _c, _d, _e;
|
|
105
|
+
const { colors } = useCustomTheme();
|
|
106
|
+
const isDock = placement === "dock";
|
|
107
|
+
return (_jsx(Flex, { as: "aside", "aria-label": labels.preview, "data-testid": "launcher-preview", "data-scroll-region": true, direction: "column", gap: isDock ? "10px" : "16px", w: isDock ? "100%" : width, maxH: isDock ? "min(45vh, 20rem)" : undefined, flexShrink: 0, px: "18px", pt: isDock ? "12px" : "16px", pb: isDock ? "12px" : "16px", bg: colors.backgroundColor.subtle, ...(isDock ? { borderTopWidth: "1px" } : { borderLeftWidth: "1px" }), borderColor: raisedRule(colors), overflowY: "auto", children: item ? (_jsxs(_Fragment, { children: [_jsxs(Flex, { align: "center", gap: "10px", minW: 0, children: [_jsx(IconChip, { icon: item.icon, size: isDock ? 28 : 36 }), _jsxs(Box, { minW: 0, children: [_jsx(Text, { fontSize: isDock ? "14px" : "15px", fontWeight: 600, color: colors.text[900], noOfLines: isDock ? 1 : 2, children: (_b = (_a = item.answer) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : item.label }), item.context || item.answer ? (_jsx(Text, { fontSize: "xs", color: colors.textMuted, noOfLines: 1, children: (_d = (_c = item.answer) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : item.context })) : null] })] }), ((_e = item.facts) === null || _e === void 0 ? void 0 : _e.length) ? (_jsx(FactList, { facts: item.facts, labels: labels, layout: isDock ? "inline" : "pane", onCopied: onCopied, onCopyBlocked: onCopyBlocked }, item.id)) : (_jsxs(Flex, { "aria-hidden": true, align: "center", gap: "6px", fontSize: "xs", color: colors.textMuted, children: [_jsx(KbdShortcut, { shortcut: "enter", size: "xs" }), _jsx(HintLabel, { ...copyHint(enterCopies ? labels.hintCopy : labels.hintOpen, labels.copied, isCopied) })] }))] })) : null }));
|
|
108
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
export const COPIED_FLASH_MS = 1500;
|
|
3
|
+
export function useCopiedFlash() {
|
|
4
|
+
const [copiedId, setCopiedId] = useState(null);
|
|
5
|
+
const timer = useRef();
|
|
6
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
7
|
+
const clear = useCallback(() => {
|
|
8
|
+
clearTimeout(timer.current);
|
|
9
|
+
setCopiedId(null);
|
|
10
|
+
}, []);
|
|
11
|
+
const flash = useCallback((id) => {
|
|
12
|
+
clearTimeout(timer.current);
|
|
13
|
+
setCopiedId(id);
|
|
14
|
+
timer.current = setTimeout(() => setCopiedId(null), COPIED_FLASH_MS);
|
|
15
|
+
}, []);
|
|
16
|
+
return { copiedId, flash, clear };
|
|
17
|
+
}
|
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { Box, Button, Flex, Menu, MenuButton, MenuDivider, MenuItem, MenuList, Stack, Text, } from "@chakra-ui/react";
|
|
3
3
|
import Avatar from "../Avatar/Avatar.js";
|
|
4
4
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
5
|
-
import { raisedRule } from "../../Theme/tokens/builders/surfaceRaised.js";
|
|
6
5
|
import { ruleOn } from "../../Theme/tokens/builders/planeStep.js";
|
|
7
6
|
import { accentTextOnCanvas, isDarkCanvas } from "../../Theme/tokens/builders/accentText.js";
|
|
8
7
|
import { resolveHoverTint } from "../../Theme/tokens/builders/outlineRung.js";
|
|
@@ -11,6 +10,8 @@ import { resolveStatusTone } from "../../Theme/tokens/builders/statusTone.js";
|
|
|
11
10
|
import ToolTip from "../ToolTip/ToolTip.js";
|
|
12
11
|
import PersonChip from "../PersonChip/PersonChip.js";
|
|
13
12
|
import { CircleArrowLeft, LogOut, PanelLeftClose, PanelRightClose, } from "lucide-react";
|
|
13
|
+
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
14
|
+
const BACKGROUND_TRANSITION = transitionFor(["background"]);
|
|
14
15
|
// Roomy enough to hover without aiming: the glyph is only 1.25rem.
|
|
15
16
|
const SIDEBAR_TOGGLE_HIT = "2.5rem";
|
|
16
17
|
export default function NavBar({ userAvathar, userName, userRole, navMenu, moreIcon, handleNavOnClick, handleLogout, logoutText, navigationBarText, sideBarToggole, onSideBarToggole, forceSideBarToggle = false, onSideBarPeek, leading, }) {
|
|
@@ -29,7 +30,7 @@ export default function NavBar({ userAvathar, userName, userRole, navMenu, moreI
|
|
|
29
30
|
cursor: "pointer",
|
|
30
31
|
border: "none",
|
|
31
32
|
bg: "transparent",
|
|
32
|
-
transition:
|
|
33
|
+
transition: BACKGROUND_TRANSITION,
|
|
33
34
|
_hover: { bg: barHoverBg },
|
|
34
35
|
};
|
|
35
36
|
const menuItemStyle = {
|
|
@@ -44,7 +45,7 @@ export default function NavBar({ userAvathar, userName, userRole, navMenu, moreI
|
|
|
44
45
|
fontSize: "xs-plus",
|
|
45
46
|
color: theme.colors.text[900],
|
|
46
47
|
gap: theme.space["2"],
|
|
47
|
-
transition:
|
|
48
|
+
transition: BACKGROUND_TRANSITION,
|
|
48
49
|
_hover: { bg: menuHoverBg },
|
|
49
50
|
_focus: { bg: menuHoverBg },
|
|
50
51
|
_active: { bg: rowBackgrounds.selectedActive },
|
|
@@ -53,10 +54,10 @@ export default function NavBar({ userAvathar, userName, userRole, navMenu, moreI
|
|
|
53
54
|
// Without a cap one long title stretches the whole dropdown; titles truncate instead.
|
|
54
55
|
maxW: "18rem", bg: theme.colors.surfaceRaised,
|
|
55
56
|
// NOTE: Chakra's MenuItem inherits --menu-bg hardcoded to #fff via dead _dark — set it or items stay white.
|
|
56
|
-
sx: { "--menu-bg": theme.colors.backgroundColor.light }, borderRadius: "xl", boxShadow: "lg", color: theme.colors.text[900], overflow: "hidden", children: _jsxs(Box, { display: "flex", flexDirection: "column", maxH: "90vh", children: [_jsx(Box, { pt: 4, pb: 2, px: 4, children: _jsx(PersonChip, { name: userName, imageUrl: userAvathar, secondary: userRole, orientation: "vertical", size: "xl", maxW: "100%" }) }), _jsx(MenuDivider, {
|
|
57
|
+
sx: { "--menu-bg": theme.colors.backgroundColor.light }, borderRadius: "xl", boxShadow: "lg", color: theme.colors.text[900], overflow: "hidden", children: _jsxs(Box, { display: "flex", flexDirection: "column", maxH: "90vh", children: [_jsx(Box, { pt: 4, pb: 2, px: 4, children: _jsx(PersonChip, { name: userName, imageUrl: userAvathar, secondary: userRole, orientation: "vertical", size: "xl", maxW: "100%" }) }), _jsx(MenuDivider, {}), _jsx(Box, { flex: 1, overflowY: "auto", overflowX: "hidden", children: navMenu === null || navMenu === void 0 ? void 0 : navMenu.map((menu, idx) => {
|
|
57
58
|
var _a, _b, _c, _d;
|
|
58
59
|
return (_jsxs(MenuItem, { onClick: () => handleNavOnClick(menu.url), sx: menuItemStyle, children: [menu.icon && (_jsx(Box, { display: "flex", alignItems: "center", flexShrink: 0, sx: { "& svg": { width: "16px", height: "16px" } }, children: menu === null || menu === void 0 ? void 0 : menu.icon })), _jsx(Box, { minW: 0, isTruncated: true, title: String((_a = menu.title) !== null && _a !== void 0 ? _a : ""), children: menu.title })] }, `${String((_d = (_c = (_b = menu.id) !== null && _b !== void 0 ? _b : menu.url) !== null && _c !== void 0 ? _c : menu.title) !== null && _d !== void 0 ? _d : idx)}-${idx}`));
|
|
59
|
-
}) }), _jsx(MenuDivider, {
|
|
60
|
+
}) }), _jsx(MenuDivider, {}), _jsxs(MenuItem, { onClick: handleLogout, sx: {
|
|
60
61
|
...menuItemStyle,
|
|
61
62
|
color: theme.colors.semanticText.error,
|
|
62
63
|
_hover: { bg: dangerTone.bg, color: dangerTone.fg },
|
|
@@ -4,16 +4,13 @@ import { Box, Flex, Text, Input, Textarea, Button, Divider, Spinner, Tooltip, us
|
|
|
4
4
|
import { Paperclip, X, SquarePen, File as FileIcon } from "lucide-react";
|
|
5
5
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
6
6
|
import { placeholderInk } from "../../Theme/tokens/builders/placeholderInk.js";
|
|
7
|
-
import {
|
|
7
|
+
import { AA_NORMAL_TEXT } from "../../Theme/tokens/builders/accentText.js";
|
|
8
|
+
import { liftToContrast, resolveHoverTint } from "../../Theme/tokens/builders/outlineRung.js";
|
|
9
|
+
import { bandOn } from "../../Theme/tokens/builders/planeStep.js";
|
|
8
10
|
import { FIELD_RADIUS } from "../Common/fieldStyles.js";
|
|
11
|
+
import { onActivationKey } from "../Common/activationKey.js";
|
|
9
12
|
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
10
13
|
import { focusVisibleRing, insetFocusRingShadow } from "../../Theme/chakra/focusRing.styles.js";
|
|
11
|
-
const onActivationKey = (activate) => (e) => {
|
|
12
|
-
if (e.key !== "Enter" && e.key !== " ")
|
|
13
|
-
return;
|
|
14
|
-
e.preventDefault();
|
|
15
|
-
activate();
|
|
16
|
-
};
|
|
17
14
|
const countWords = (text = "") => {
|
|
18
15
|
const t = text.trim();
|
|
19
16
|
if (!t)
|
|
@@ -33,13 +30,6 @@ const NoteTextArea = forwardRef(function NoteTextArea({ width = "100%", handleSu
|
|
|
33
30
|
const [titleShow, setTitleShow] = useState(false);
|
|
34
31
|
const [files, setFiles] = useState([]);
|
|
35
32
|
const [fileError, setFileError] = useState("");
|
|
36
|
-
const [isSaveDisabled, setIsSaveDisabled] = useState(false);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
setIsSaveDisabled(countWords(titleValue) > maxNoteWordCount);
|
|
39
|
-
}, [titleValue, maxNoteWordCount]);
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
setIsSaveDisabled(countWords(noteValue) > maxNoteWordCount);
|
|
42
|
-
}, [noteValue, maxNoteWordCount]);
|
|
43
33
|
useEffect(() => {
|
|
44
34
|
if (isEditable) {
|
|
45
35
|
setIsActive(true);
|
|
@@ -129,14 +119,19 @@ const NoteTextArea = forwardRef(function NoteTextArea({ width = "100%", handleSu
|
|
|
129
119
|
};
|
|
130
120
|
const noteWordCount = countWords(noteValue);
|
|
131
121
|
const isOverLimit = noteWordCount > maxNoteWordCount;
|
|
122
|
+
const isSaveDisabled = isOverLimit || countWords(titleValue) > maxNoteWordCount;
|
|
123
|
+
const activeBandBg = bandOn(theme.colors.gray[50], theme.colors.background[50]);
|
|
132
124
|
const collapsedHoverBg = resolveHoverTint(theme.colors.gray[50], theme.colors.background[50]);
|
|
133
|
-
const activeControlHoverBg = resolveHoverTint(theme.colors.gray[100],
|
|
125
|
+
const activeControlHoverBg = resolveHoverTint(theme.colors.gray[100], activeBandBg);
|
|
126
|
+
const chipBg = bandOn(theme.colors.gray[100], activeBandBg);
|
|
127
|
+
const chipInk = liftToContrast(theme.colors.textMuted, chipBg, AA_NORMAL_TEXT);
|
|
128
|
+
const chipRemoveHoverBg = bandOn(theme.colors.gray[200], chipBg);
|
|
134
129
|
// NOTE: drawn inset because the rounded shell clips overflow.
|
|
135
130
|
const placeholderFocusRing = {
|
|
136
131
|
outline: "2px solid transparent",
|
|
137
132
|
boxShadow: insetFocusRingShadow(theme.colors),
|
|
138
133
|
};
|
|
139
|
-
return (_jsxs(Box, { w: width, borderRadius: FIELD_RADIUS, overflow: "hidden", border: "1px solid", borderColor: isActive ? theme.colors.primary[500] : theme.colors.boxborder[500], bg: isActive ?
|
|
134
|
+
return (_jsxs(Box, { w: width, borderRadius: FIELD_RADIUS, overflow: "hidden", border: "1px solid", borderColor: isActive ? theme.colors.primary[500] : theme.colors.boxborder[500], bg: isActive ? activeBandBg : theme.colors.background[50], transition: transitionFor(["border-color"]), children: [!isActive && (_jsxs(Flex, { px: 3, gap: 2, align: "center", cursor: "text", role: "button", tabIndex: 0, onClick: handleTextArea, onKeyDown: onActivationKey(handleTextArea), _focusVisible: placeholderFocusRing, bg: theme.colors.background[50], borderRadius: FIELD_RADIUS, minH: "2.5rem", transition: transitionFor(["background-color"]), _hover: { bg: collapsedHoverBg }, children: [_jsx(SquarePen, { size: 16, color: theme.colors.textMuted }), _jsx(Text, { color: theme.colors.textMuted, fontSize: "sm", children: customPlaceholder })] })), isActive && (_jsxs(_Fragment, { children: [_jsxs(Box, { bg: theme.colors.background[50], children: [titleShow && (_jsxs(_Fragment, { children: [_jsx(Input, { value: titleValue, onChange: (e) => {
|
|
140
135
|
if (e.target.value.length === 0)
|
|
141
136
|
setTitleShow(false);
|
|
142
137
|
setTitleValue(e.target.value);
|
|
@@ -157,7 +152,7 @@ const NoteTextArea = forwardRef(function NoteTextArea({ width = "100%", handleSu
|
|
|
157
152
|
if (validFiles.length > 0) {
|
|
158
153
|
setFiles((prev) => [...prev, ...validFiles]);
|
|
159
154
|
}
|
|
160
|
-
}, multiple: true }), fileError && (_jsx(Text, { color: theme.colors.semanticText.error, mt: 2, fontSize: "xs", children: fileError })), files.length > 0 && (_jsx(Flex, { mt: 3, gap: 2, wrap: "wrap", children: files.map((f, idx) => (_jsxs(Flex, { align: "center", gap: 2, pl: 2.5, pr: 1.5, py: 1, borderRadius: "full", bg:
|
|
155
|
+
}, multiple: true }), fileError && (_jsx(Text, { color: theme.colors.semanticText.error, mt: 2, fontSize: "xs", children: fileError })), files.length > 0 && (_jsx(Flex, { mt: 3, gap: 2, wrap: "wrap", children: files.map((f, idx) => (_jsxs(Flex, { align: "center", gap: 2, pl: 2.5, pr: 1.5, py: 1, borderRadius: "full", bg: chipBg, maxW: "100%", children: [_jsx(FileIcon, { size: 13, color: chipInk }), _jsx(Text, { fontSize: "xs", color: theme.colors.text[700], isTruncated: true, maxW: "160px", children: shortenFileName(f.name) }), _jsx(Text, { fontSize: "xs", color: chipInk, whiteSpace: "nowrap", children: formatBytes(f.size) }), _jsx(Box, { as: "button", type: "button", "aria-label": `Remove ${f.name}`, display: "flex", alignItems: "center", justifyContent: "center", borderRadius: "full", p: 0.5, color: chipInk, transition: transitionFor(["background-color", "color"]), _hover: { bg: chipRemoveHoverBg, color: theme.colors.semanticText.error }, onClick: () => setFiles((prev) => prev.filter((fileItem) => fileItem !== f)), children: _jsx(X, { size: 13 }) })] }, idx))) }))] })] }))] }));
|
|
161
156
|
});
|
|
162
157
|
NoteTextArea.displayName = "NoteTextArea";
|
|
163
158
|
export default NoteTextArea;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from "react";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { Box, VStack, HStack, Text, Icon, Divider, Skeleton, SkeletonCircle, } from "@chakra-ui/react";
|
|
4
4
|
import { Clock, AlertCircle, Calendar, X, User } from "lucide-react";
|
|
5
5
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
@@ -10,8 +10,10 @@ import Avatar from "../Avatar/Avatar.js";
|
|
|
10
10
|
import { focusVisibleRing } from "../../Theme/chakra/focusRing.styles.js";
|
|
11
11
|
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
12
12
|
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
13
|
+
import { onActivationKey } from "../Common/activationKey.js";
|
|
13
14
|
const CARD_TRANSITION = transitionFor(["box-shadow", "background-color", "border-color"], "base");
|
|
14
15
|
const DISMISS_TRANSITION = transitionFor(["background-color", "color", "transform"], "base");
|
|
16
|
+
const TICK_MS = 60000;
|
|
15
17
|
/** Date-driven countdown card ("due in 3 days" / "overdue by 2 hours"). For inbox-style rows use `NotificationItem`, which cannot render a future date. */
|
|
16
18
|
const Notification = ({ notification, onClose, showStatus, onClick, isLoading = false, colors, }) => {
|
|
17
19
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -31,6 +33,15 @@ const Notification = ({ notification, onClose, showStatus, onClick, isLoading =
|
|
|
31
33
|
const startDate = useMemo(() => notification.startDate
|
|
32
34
|
? new Date(notification.startDate)
|
|
33
35
|
: null, [notification.startDate]);
|
|
36
|
+
const hasTarget = Boolean(notification.dueDate || notification.endDate);
|
|
37
|
+
const [now, setNow] = useState(() => Date.now());
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!hasTarget || isLoading)
|
|
40
|
+
return;
|
|
41
|
+
setNow(Date.now());
|
|
42
|
+
const timer = setInterval(() => setNow(Date.now()), TICK_MS);
|
|
43
|
+
return () => clearInterval(timer);
|
|
44
|
+
}, [hasTarget, isLoading, notification.dueDate, notification.endDate]);
|
|
34
45
|
const { timeLabel, diffDays } = useMemo(() => {
|
|
35
46
|
const targetDate = notification.dueDate
|
|
36
47
|
? new Date(notification.dueDate)
|
|
@@ -39,8 +50,7 @@ const Notification = ({ notification, onClose, showStatus, onClick, isLoading =
|
|
|
39
50
|
: null;
|
|
40
51
|
if (!targetDate)
|
|
41
52
|
return { timeLabel: "", diffDays: null };
|
|
42
|
-
const
|
|
43
|
-
const diffMs = targetDate.getTime() - now.getTime();
|
|
53
|
+
const diffMs = targetDate.getTime() - now;
|
|
44
54
|
const diffMinutes = Math.floor(diffMs / (1000 * 60));
|
|
45
55
|
const diffHours = diffMinutes / 60;
|
|
46
56
|
const diffDays = diffHours / 24;
|
|
@@ -54,11 +64,11 @@ const Notification = ({ notification, onClose, showStatus, onClick, isLoading =
|
|
|
54
64
|
if (diffMs < 0) {
|
|
55
65
|
const overdueMinutes = Math.abs(diffMinutes);
|
|
56
66
|
if (overdueMinutes < 60)
|
|
57
|
-
label = `${typeLabel} overdue by ${overdueMinutes} minute${overdueMinutes === 1 ? "" : "s"}
|
|
67
|
+
label = `${typeLabel} overdue by ${overdueMinutes} minute${overdueMinutes === 1 ? "" : "s"}`;
|
|
58
68
|
else if (overdueMinutes < 1440)
|
|
59
|
-
label = `${typeLabel} overdue by ${Math.floor(overdueMinutes / 60)} hour${Math.floor(overdueMinutes / 60) === 1 ? "" : "s"}
|
|
69
|
+
label = `${typeLabel} overdue by ${Math.floor(overdueMinutes / 60)} hour${Math.floor(overdueMinutes / 60) === 1 ? "" : "s"}`;
|
|
60
70
|
else
|
|
61
|
-
label = `${typeLabel} overdue by ${Math.floor(overdueMinutes / 1440)} day${Math.floor(overdueMinutes / 1440) === 1 ? "" : "s"}
|
|
71
|
+
label = `${typeLabel} overdue by ${Math.floor(overdueMinutes / 1440)} day${Math.floor(overdueMinutes / 1440) === 1 ? "" : "s"}`;
|
|
62
72
|
}
|
|
63
73
|
else {
|
|
64
74
|
if (diffMinutes < 60)
|
|
@@ -69,7 +79,7 @@ const Notification = ({ notification, onClose, showStatus, onClick, isLoading =
|
|
|
69
79
|
label = `${typeLabel} due in ${Math.ceil(diffDays)} day${Math.ceil(diffDays) === 1 ? "" : "s"}`;
|
|
70
80
|
}
|
|
71
81
|
return { timeLabel: label, diffDays };
|
|
72
|
-
}, [notification.dueDate, notification.endDate, notification.type]);
|
|
82
|
+
}, [notification.dueDate, notification.endDate, notification.type, now]);
|
|
73
83
|
const getStatusColor = () => {
|
|
74
84
|
if (diffDays === null)
|
|
75
85
|
return theme.colors.textMuted;
|
|
@@ -99,29 +109,17 @@ const Notification = ({ notification, onClose, showStatus, onClick, isLoading =
|
|
|
99
109
|
};
|
|
100
110
|
return startDate.toLocaleString("en-US", options);
|
|
101
111
|
}, [startDate, notification.type]);
|
|
102
|
-
// 🔄 If loading, show skeleton
|
|
103
112
|
if (isLoading) {
|
|
104
113
|
return (_jsx(Box, { bg: bgColor, border: "1px solid", borderColor: borderColor, borderRadius: "xl", p: 4, w: "100%", maxW: "400px", boxShadow: "sm", children: _jsxs(VStack, { align: "start", spacing: 3, w: "100%", children: [_jsxs(HStack, { spacing: 2, children: [_jsx(SkeletonCircle, { size: "4" }), _jsx(Skeleton, { height: "14px", width: "60%" })] }), _jsxs(HStack, { align: "center", spacing: 3, w: "100%", children: [_jsx(SkeletonCircle, { size: "8" }), _jsxs(VStack, { align: "start", spacing: 1, flex: "1", children: [_jsx(Skeleton, { height: "16px", width: "70%" }), _jsx(Skeleton, { height: "12px", width: "50%" })] })] }), _jsx(Divider, { borderColor: borderColor }), _jsxs(HStack, { justify: "space-between", w: "100%", children: [_jsx(Skeleton, { height: "12px", width: "40%" }), _jsx(Skeleton, { height: "12px", width: "30%" })] })] }) }));
|
|
105
114
|
}
|
|
106
|
-
|
|
107
|
-
return (_jsxs(Box, { bg: bgColor, border: "1px solid", borderColor: borderColor, borderRadius: "xl", p: 4, w: "100%", maxW: "400px", boxShadow: "sm", _hover: { boxShadow: "md" }, transition: CARD_TRANSITION, sx: reducedMotionSx(), position: "relative", children: [onClose && (_jsx(Box, { position: "absolute", top: "2", right: "2", cursor: "pointer", onClick: onClose, onKeyDown: (e) => {
|
|
108
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
109
|
-
e.preventDefault();
|
|
110
|
-
onClose();
|
|
111
|
-
}
|
|
112
|
-
}, role: "button", "aria-label": "Dismiss notification", tabIndex: 0, p: 1, borderRadius: "md", _hover: {
|
|
115
|
+
return (_jsxs(Box, { bg: bgColor, border: "1px solid", borderColor: borderColor, borderRadius: "xl", p: 4, w: "100%", maxW: "400px", boxShadow: "sm", _hover: { boxShadow: "md" }, transition: CARD_TRANSITION, sx: reducedMotionSx(), position: "relative", children: [onClose && (_jsx(Box, { position: "absolute", top: "2", right: "2", cursor: "pointer", onClick: onClose, onKeyDown: onActivationKey(() => onClose()), role: "button", "aria-label": "Dismiss notification", tabIndex: 0, p: 1, borderRadius: "md", _hover: {
|
|
113
116
|
bg: closeTone.bg,
|
|
114
117
|
color: closeTone.fg,
|
|
115
118
|
transform: "scale(1.1)",
|
|
116
|
-
}, transition: DISMISS_TRANSITION, sx: reducedMotionSx(), children: _jsx(X, { size: 16 }) })), _jsxs(VStack, { align: "start", spacing: 3, w: "100%", children: [_jsxs(HStack, { spacing: 2, children: [_jsx(Icon, { as: TimeIcon, color: dueLabelColor, boxSize: 4 }), _jsx(Text, { fontSize: "sm", color: dueLabelColor, fontWeight: 600, children: timeLabel })] }), _jsxs(HStack, { align: "center", spacing: 3, w: "100%", children: [_jsx(Avatar, { size: "sm", name: notification.host || notification.title, src: notification.avatarUrl || undefined }), _jsxs(VStack, { align: "start", spacing: 0, flex: "1", children: [_jsx(Text, { fontWeight: 700, fontSize: "md", color: titleColor, cursor: "pointer", _hover: { textColor: theme.colors.accentText }, onClick: () => onClick === null || onClick === void 0 ? void 0 : onClick(notification.id, notification.type), ...(onClick && {
|
|
119
|
+
}, _focusVisible: focusVisibleRing(theme.colors), transition: DISMISS_TRANSITION, sx: reducedMotionSx(), children: _jsx(X, { size: 16 }) })), _jsxs(VStack, { align: "start", spacing: 3, w: "100%", children: [_jsxs(HStack, { spacing: 2, children: [_jsx(Icon, { as: TimeIcon, color: dueLabelColor, boxSize: 4 }), _jsx(Text, { fontSize: "sm", color: dueLabelColor, fontWeight: 600, children: timeLabel })] }), _jsxs(HStack, { align: "center", spacing: 3, w: "100%", children: [_jsx(Avatar, { size: "sm", name: notification.host || notification.title, src: notification.avatarUrl || undefined }), _jsxs(VStack, { align: "start", spacing: 0, flex: "1", children: [_jsx(Text, { fontWeight: 700, fontSize: "md", color: titleColor, cursor: "pointer", _hover: { textColor: theme.colors.accentText }, onClick: () => onClick === null || onClick === void 0 ? void 0 : onClick(notification.id, notification.type), ...(onClick && {
|
|
117
120
|
role: "button",
|
|
118
121
|
tabIndex: 0,
|
|
119
|
-
onKeyDown: (
|
|
120
|
-
if (e.key !== "Enter" && e.key !== " ")
|
|
121
|
-
return;
|
|
122
|
-
e.preventDefault();
|
|
123
|
-
onClick(notification.id, notification.type);
|
|
124
|
-
},
|
|
122
|
+
onKeyDown: onActivationKey(() => onClick(notification.id, notification.type)),
|
|
125
123
|
_focusVisible: focusVisibleRing(theme.colors),
|
|
126
124
|
}), children: notification.title }), notification.description && (_jsx(Text, { fontSize: "sm", color: textColor, children: notification.description }))] })] }), _jsx(Divider, { borderColor: borderColor }), _jsxs(HStack, { justify: "space-between", w: "100%", children: [_jsxs(HStack, { spacing: 2, children: [_jsx(Icon, { as: Calendar, color: metaColor, boxSize: 4 }), _jsx(Text, { fontSize: "sm", color: metaColor, children: formattedStartDateTime })] }), _jsxs(HStack, { spacing: 2, children: [_jsx(Icon, { as: User, color: metaColor, boxSize: 4 }), notification.host && (_jsx(Text, { fontSize: "sm", color: metaColor, children: notification.host }))] }), showStatus && (_jsx(Box, { boxSize: "3", bg: getStatusColor(), borderRadius: "full" }))] })] })] }));
|
|
127
125
|
};
|
|
@@ -72,20 +72,26 @@ const MINUTE = 60;
|
|
|
72
72
|
const HOUR = MINUTE * 60;
|
|
73
73
|
const DAY = HOUR * 24;
|
|
74
74
|
const WEEK = DAY * 7;
|
|
75
|
+
export const DEFAULT_RELATIVE_TIME_LABELS = {
|
|
76
|
+
justNow: "Just now",
|
|
77
|
+
minutesAgo: (count) => `${count}m ago`,
|
|
78
|
+
hoursAgo: (count) => `${count}h ago`,
|
|
79
|
+
daysAgo: (count) => `${count}d ago`,
|
|
80
|
+
};
|
|
75
81
|
/** "Just now" / "5m ago" / "3h ago" / "2d ago"; falls back to a short date past a week. */
|
|
76
|
-
export function formatRelativeTime(value, now = Date.now()) {
|
|
82
|
+
export function formatRelativeTime(value, now = Date.now(), { labels = DEFAULT_RELATIVE_TIME_LABELS, locale = "en-US" } = {}) {
|
|
77
83
|
const then = toDate(value);
|
|
78
84
|
const nowMs = typeof now === "number" ? now : now.getTime();
|
|
79
85
|
const diffSec = Math.max(0, Math.round((nowMs - then.getTime()) / 1000));
|
|
80
86
|
if (diffSec < MINUTE)
|
|
81
|
-
return
|
|
87
|
+
return labels.justNow;
|
|
82
88
|
if (diffSec < HOUR)
|
|
83
|
-
return
|
|
89
|
+
return labels.minutesAgo(Math.floor(diffSec / MINUTE));
|
|
84
90
|
if (diffSec < DAY)
|
|
85
|
-
return
|
|
91
|
+
return labels.hoursAgo(Math.floor(diffSec / HOUR));
|
|
86
92
|
if (diffSec < WEEK)
|
|
87
|
-
return
|
|
88
|
-
return then.toLocaleDateString(
|
|
93
|
+
return labels.daysAgo(Math.floor(diffSec / DAY));
|
|
94
|
+
return then.toLocaleDateString(locale, { day: "2-digit", month: "short" });
|
|
89
95
|
}
|
|
90
96
|
/** The tickets/hrms formula: max(min, viewport bottom edge - panel top - gutter), remeasured on resize. */
|
|
91
97
|
export function useAnchoredPanelHeight(ref, options) {
|
|
@@ -7,6 +7,7 @@ import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
|
7
7
|
import { NUMERIC_TEXT } from "../../Theme/tokens/primitives/typography.js";
|
|
8
8
|
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
9
9
|
import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
|
|
10
|
+
import { tonalHover } from "../CheckoutKit/tonalHover.js";
|
|
10
11
|
const COPIED_MS = 1600;
|
|
11
12
|
const DEFAULT_LABELS = {
|
|
12
13
|
summary: (count, best) => `Offers (${count}) · Best: ${best}`,
|
|
@@ -30,6 +31,7 @@ const writeToClipboard = (code) => {
|
|
|
30
31
|
const OffersList = ({ offers, bestOfferId, isOpen, defaultOpen = false, onOpenChange, onCopy, labels, "data-testid": testId, }) => {
|
|
31
32
|
var _a;
|
|
32
33
|
const { colors } = useCustomTheme();
|
|
34
|
+
const hoverFill = tonalHover(colors);
|
|
33
35
|
const panelId = useId();
|
|
34
36
|
const [innerOpen, setInnerOpen] = useState(defaultOpen);
|
|
35
37
|
const [copiedId, setCopiedId] = useState(null);
|
|
@@ -63,7 +65,7 @@ const OffersList = ({ offers, bestOfferId, isOpen, defaultOpen = false, onOpenCh
|
|
|
63
65
|
}, COPIED_MS);
|
|
64
66
|
onCopy === null || onCopy === void 0 ? void 0 : onCopy(offer);
|
|
65
67
|
};
|
|
66
|
-
return (_jsxs(Box, { bg: colors.background[100], borderRadius: "xl", overflow: "hidden", "data-testid": testId, children: [_jsxs(Flex, { as: "button", type: "button", w: "100%", minH: "3rem", px: 4, py: 3, align: "center", gap: 3, textAlign: "left", borderRadius: "xl", color: colors.header[900], "aria-expanded": open, "aria-controls": panelId, onClick: toggle, transition: transitionFor(["background-color"]), _hover: { bg:
|
|
68
|
+
return (_jsxs(Box, { bg: colors.background[100], borderRadius: "xl", overflow: "hidden", "data-testid": testId, children: [_jsxs(Flex, { as: "button", type: "button", w: "100%", minH: "3rem", px: 4, py: 3, align: "center", gap: 3, textAlign: "left", borderRadius: "xl", color: colors.header[900], "aria-expanded": open, "aria-controls": panelId, onClick: toggle, transition: transitionFor(["background-color"]), _hover: { bg: hoverFill }, sx: { ...focusVisibleStyles(colors), ...reducedMotionSx() }, children: [_jsx(Box, { as: "span", "aria-hidden": true, display: "inline-flex", flexShrink: 0, color: colors.accentText, children: _jsx(Tag, { size: 18 }) }), _jsx(Text, { as: "span", flex: "1", minW: 0, fontSize: "sm", fontWeight: 600, noOfLines: open ? undefined : 1, children: summary }), _jsx(Box, { as: "span", "aria-hidden": true, display: "inline-flex", flexShrink: 0, color: colors.textMuted, transform: open ? "rotate(180deg)" : "rotate(0deg)", transition: transitionFor(["transform"]), sx: reducedMotionSx(), children: _jsx(ChevronDown, { size: 18 }) })] }), _jsx(Box, { id: panelId, hidden: !open, children: _jsx(Box, { as: "ul", listStyleType: "none", m: 0, px: 4, pb: 2, children: offers.map((offer) => {
|
|
67
69
|
const copied = copiedId === offer.id;
|
|
68
70
|
const { code } = offer;
|
|
69
71
|
return (_jsxs(Flex, { as: "li", position: "relative", align: "center", justify: "space-between", gap: 3, py: 3, sx: {
|
|
@@ -76,7 +78,7 @@ const OffersList = ({ offers, bestOfferId, isOpen, defaultOpen = false, onOpenCh
|
|
|
76
78
|
height: "1px",
|
|
77
79
|
background: colors.background[200],
|
|
78
80
|
},
|
|
79
|
-
}, children: [_jsxs(Box, { minW: 0, children: [_jsx(Text, { fontSize: "sm", fontWeight: 600, color: colors.header[900], children: offer.title }), _jsx(Text, { mt: 0.5, fontSize: "sm", lineHeight: 1.45, color: colors.textMuted, children: offer.detail })] }), code ? (_jsxs(Flex, { align: "center", gap: 1, flexShrink: 0, children: [_jsx(Text, { as: "span", px: 2.5, py: 1, borderRadius: "md", bg: colors.background[200], color: colors.header[900], fontSize: "xs", fontWeight: 700, letterSpacing: "0.06em", sx: NUMERIC_TEXT, children: code }), _jsxs(Flex, { as: "button", type: "button", align: "center", gap: 1.5, minH: "2.75rem", px: 3, borderRadius: "lg", fontSize: "sm", fontWeight: 600, color: colors.accentText, "aria-label": copied ? undefined : copy.copyCode(code), onClick: () => copyCode(offer, code), transition: transitionFor(["background-color"]), _hover: { bg:
|
|
81
|
+
}, children: [_jsxs(Box, { minW: 0, children: [_jsx(Text, { fontSize: "sm", fontWeight: 600, color: colors.header[900], children: offer.title }), _jsx(Text, { mt: 0.5, fontSize: "sm", lineHeight: 1.45, color: colors.textMuted, children: offer.detail })] }), code ? (_jsxs(Flex, { align: "center", gap: 1, flexShrink: 0, children: [_jsx(Text, { as: "span", px: 2.5, py: 1, borderRadius: "md", bg: colors.background[200], color: colors.header[900], fontSize: "xs", fontWeight: 700, letterSpacing: "0.06em", sx: NUMERIC_TEXT, children: code }), _jsxs(Flex, { as: "button", type: "button", align: "center", gap: 1.5, minH: "2.75rem", px: 3, borderRadius: "lg", fontSize: "sm", fontWeight: 600, color: colors.accentText, "aria-label": copied ? undefined : copy.copyCode(code), onClick: () => copyCode(offer, code), transition: transitionFor(["background-color"]), _hover: { bg: hoverFill }, sx: { ...focusVisibleStyles(colors), ...reducedMotionSx() }, children: [copied ? _jsx(Check, { size: 16, "aria-hidden": true }) : null, _jsx("span", { children: copied ? copy.copied : copy.copy })] })] })) : null] }, offer.id));
|
|
80
82
|
}) }) }), _jsx(VisuallyHidden, { "aria-live": "polite", children: message })] }));
|
|
81
83
|
};
|
|
82
84
|
export default OffersList;
|
|
@@ -7,6 +7,7 @@ import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
|
7
7
|
import { NUMERIC_TEXT } from "../../Theme/tokens/primitives/typography.js";
|
|
8
8
|
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
9
9
|
import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
|
|
10
|
+
import { BORDER_WIDTHS } from "../../Theme/tokens/primitives/borderWidths.js";
|
|
10
11
|
import { optionInk } from "./optionInk.js";
|
|
11
12
|
const CHIP_HEIGHT = { md: "2.75rem", lg: "3.25rem" };
|
|
12
13
|
const PACK_HEIGHT = { md: "3.5rem", lg: "4rem" };
|
|
@@ -62,7 +63,7 @@ const OptionChip = forwardRef(function OptionChip({ label, selected = false, dis
|
|
|
62
63
|
return (_jsxs(Box, { ...base, display: "inline-flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: "0.25rem", minW: CHIP_HEIGHT[size], minH: CHIP_HEIGHT[size], borderRadius: "xl", bg: "transparent", color: colors.text[800], title: showLabel ? undefined : label, sx: {
|
|
63
64
|
...motion,
|
|
64
65
|
"&:hover:not(:disabled) [data-ring]:not([data-selected])": { borderColor: colors.boxborder[500] },
|
|
65
|
-
}, children: [_jsx(Box, { as: "span", "data-ring": true, "data-selected": selected ? "" : undefined, display: "inline-flex", p: "0.125rem", borderWidth: "2px", borderStyle: "solid", borderRadius: "full", borderColor: selected ? colors.header[900] : invalid ? colors.semanticText.error : "transparent", transition: transitionFor(["border-color"]), sx: reducedMotionSx(), children: _jsx(Box, { as: "span", position: "relative", display: "block", boxSize: dot, borderRadius: "full", backgroundColor: swatch !== null && swatch !== void 0 ? swatch : colors.background[200], boxShadow: `inset 0 0 0
|
|
66
|
+
}, children: [_jsx(Box, { as: "span", "data-ring": true, "data-selected": selected ? "" : undefined, display: "inline-flex", p: "0.125rem", borderWidth: "2px", borderStyle: "solid", borderRadius: "full", borderColor: selected ? colors.header[900] : invalid ? colors.semanticText.error : "transparent", transition: transitionFor(["border-color"]), sx: reducedMotionSx(), children: _jsx(Box, { as: "span", position: "relative", display: "block", boxSize: dot, borderRadius: "full", backgroundColor: swatch !== null && swatch !== void 0 ? swatch : colors.background[200], boxShadow: `inset 0 0 0 ${BORDER_WIDTHS.hairline} ${colors.boxborder[200]}`, sx: unavailable ? { "&::after": { content: '""', ...strikeLayer(strikeBackground) } } : undefined }) }), showLabel ? (_jsx(Text, { as: "span", fontSize: "xs", fontWeight: selected ? 600 : 500, color: selected ? colors.header[900] : rest.ink, lineHeight: "short", children: label })) : null] }));
|
|
66
67
|
}
|
|
67
68
|
if (variant === "image-tile") {
|
|
68
69
|
const tile = TILE[size];
|
|
@@ -91,6 +92,6 @@ const OptionChip = forwardRef(function OptionChip({ label, selected = false, dis
|
|
|
91
92
|
...motion,
|
|
92
93
|
"&:hover:not(:disabled):not([aria-checked=true])": unavailable ? undefined : { backgroundColor: tone.hoverFill },
|
|
93
94
|
...(unavailable ? { "&::after": { content: '""', ...strikeLayer(band("currentColor", "0.5px")) } } : {}),
|
|
94
|
-
}, children: [content, isPack && hint ? (_jsx(Text, { as: "span", mt: "0.125rem", fontSize: "xs-minus", fontWeight: 500, color: tone.hint, sx: NUMERIC_TEXT, children: hint })) : null, !isPack && hint ? (_jsx(Text, { as: "span", position: "absolute", top: "-0.375rem", right: "-0.25rem", px: "0.375rem", py: "px", borderRadius: "full", bg: colors.surfaceRaised, color: colors.text[800], fontSize: "0.625rem", fontWeight: 600, lineHeight: "1rem", boxShadow: `0 0 0
|
|
95
|
+
}, children: [content, isPack && hint ? (_jsx(Text, { as: "span", mt: "0.125rem", fontSize: "xs-minus", fontWeight: 500, color: tone.hint, sx: NUMERIC_TEXT, children: hint })) : null, !isPack && hint ? (_jsx(Text, { as: "span", position: "absolute", top: "-0.375rem", right: "-0.25rem", px: "0.375rem", py: "px", borderRadius: "full", bg: colors.surfaceRaised, color: colors.text[800], fontSize: "0.625rem", fontWeight: 600, lineHeight: "1rem", boxShadow: `0 0 0 ${BORDER_WIDTHS.hairline} ${colors.boxborder[200]}`, pointerEvents: "none", children: hint })) : null] }));
|
|
95
96
|
});
|
|
96
97
|
export default OptionChip;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { mix } from "../../Theme/tokens/builders/color.js";
|
|
2
2
|
import { AA_NORMAL_TEXT, onFilled } from "../../Theme/tokens/builders/accentText.js";
|
|
3
3
|
import { liftToContrast } from "../../Theme/tokens/builders/outlineRung.js";
|
|
4
|
+
import { bandOn } from "../../Theme/tokens/builders/planeStep.js";
|
|
4
5
|
/** Resting and selected fills for an option; selection is the neutral ink fill, never the brand. */
|
|
5
6
|
export const optionInk = (colors) => {
|
|
6
7
|
const selectedFill = colors.header[900];
|
|
8
|
+
const restHover = bandOn(colors.background[400], colors.background[300]);
|
|
7
9
|
const selectedInk = onFilled(selectedFill, colors.white, colors.black);
|
|
8
10
|
const rest = {
|
|
9
11
|
fill: colors.background[300],
|
|
10
|
-
hoverFill:
|
|
12
|
+
hoverFill: restHover,
|
|
11
13
|
ink: colors.text[800],
|
|
12
|
-
hint: liftToContrast(colors.text[700],
|
|
14
|
+
hint: liftToContrast(colors.text[700], restHover, AA_NORMAL_TEXT),
|
|
13
15
|
};
|
|
14
16
|
const selected = {
|
|
15
17
|
fill: selectedFill,
|
|
@@ -6,6 +6,7 @@ import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
|
6
6
|
import { NUMERIC_TEXT } from "../../Theme/tokens/primitives/typography.js";
|
|
7
7
|
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
8
8
|
import { onFilled } from "../../Theme/tokens/builders/accentText.js";
|
|
9
|
+
import { BORDER_WIDTHS } from "../../Theme/tokens/primitives/borderWidths.js";
|
|
9
10
|
const DEFAULT_LABELS = { done: "Completed", current: "In progress", upcoming: "Upcoming" };
|
|
10
11
|
const MARKER = "1.5rem";
|
|
11
12
|
const RULE = "2px";
|
|
@@ -27,7 +28,7 @@ const Marker = ({ state, colors }) => {
|
|
|
27
28
|
return (_jsx(Box, { ...base, bg: ink, color: onFilled(ink, colors.white, colors.black), children: _jsx(Check, { size: 14, strokeWidth: 3 }) }));
|
|
28
29
|
}
|
|
29
30
|
if (state === "current") {
|
|
30
|
-
return (_jsx(Box, { ...base, bg: "transparent", boxShadow: `inset 0 0 0
|
|
31
|
+
return (_jsx(Box, { ...base, bg: "transparent", boxShadow: `inset 0 0 0 ${BORDER_WIDTHS.thick} ${ink}`, children: _jsx(Box, { as: "span", boxSize: "0.5rem", borderRadius: "full", bg: ink }) }));
|
|
31
32
|
}
|
|
32
33
|
return _jsx(Box, { ...base, bg: "transparent", boxShadow: `inset 0 0 0 1.5px ${colors.textMuted}` });
|
|
33
34
|
};
|
|
@@ -3,15 +3,18 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
|
3
3
|
import { Box, Flex, Image, Input, InputGroup, InputLeftElement, Popover, PopoverBody, PopoverContent, PopoverTrigger, Spinner, Text, useDisclosure, } from "@chakra-ui/react";
|
|
4
4
|
import { Building2, Check, ChevronDown, ChevronsUpDown, Search } from "lucide-react";
|
|
5
5
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
6
|
-
import { accentTextOnCanvas, onFilled } from "../../Theme/tokens/builders/accentText.js";
|
|
6
|
+
import { accentTextOnCanvas, isDarkCanvas, onFilled } from "../../Theme/tokens/builders/accentText.js";
|
|
7
7
|
import { chartMode } from "../../Theme/tokens/builders/chartColorsFromTheme.js";
|
|
8
8
|
import { resolveHoverTint } from "../../Theme/tokens/builders/outlineRung.js";
|
|
9
|
+
import { raisedRule } from "../../Theme/tokens/builders/surfaceRaised.js";
|
|
9
10
|
import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
|
|
10
11
|
import { optionRowCursorSx } from "../Select/optionRowInk.js";
|
|
11
12
|
import { useExclusiveOverlay } from "../../Hooks/useExclusiveOverlay.js";
|
|
12
13
|
import { useMatchMedia } from "../../Hooks/useMatchMedia.js";
|
|
13
14
|
import ToolTip from "../ToolTip/ToolTip.js";
|
|
14
15
|
import { avatarColor, orgInitial, } from "./OrgSwitcherProps.js";
|
|
16
|
+
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
17
|
+
const BACKGROUND_TRANSITION = transitionFor(["background"]);
|
|
15
18
|
const sizeMap = {
|
|
16
19
|
sm: { h: "32px", avatarH: "32px", avatar: "22px", font: "0.8rem", sub: "0.65rem", px: 2 },
|
|
17
20
|
md: { h: "40px", avatarH: "36px", avatar: "28px", font: "0.9rem", sub: "0.7rem", px: 3 },
|
|
@@ -24,10 +27,10 @@ const Avatar = ({ org, boxSize, fontSize, }) => {
|
|
|
24
27
|
return (_jsx(Image, { src: org.logoUrl, alt: org.name, boxSize: boxSize, borderRadius: "lg", objectFit: "cover", flexShrink: 0 }));
|
|
25
28
|
}
|
|
26
29
|
const fill = avatarColor(org.name, chartMode(colors));
|
|
27
|
-
return (_jsx(Flex, { align: "center", justify: "center", boxSize: boxSize, borderRadius: "lg", flexShrink: 0, bg: fill, color: onFilled(fill, colors.white, colors.black), fontSize: fontSize, fontWeight: 700
|
|
30
|
+
return (_jsx(Flex, { "aria-hidden": "true", "data-initials": orgInitial(org.name), _before: { content: "attr(data-initials)" }, align: "center", justify: "center", boxSize: boxSize, borderRadius: "lg", flexShrink: 0, bg: fill, color: onFilled(fill, colors.white, colors.black), fontSize: fontSize, fontWeight: 700 }));
|
|
28
31
|
};
|
|
29
32
|
const OrgSwitcher = ({ organizations, value, onChange, isLoading = false, isSearchable, searchThreshold = 6, triggerVariant = "ghost", size = "md", maxWidth = "200px", menuMinWidth = "280px", placeholder = "Select organization", ariaLabel = "Switch organization", showRole = true, display = "full", }) => {
|
|
30
|
-
var _a, _b;
|
|
33
|
+
var _a, _b, _c;
|
|
31
34
|
const theme = useCustomTheme();
|
|
32
35
|
const isMd = useMatchMedia(MD_QUERY, true);
|
|
33
36
|
const avatarOnly = display === "avatar" || (display === "auto" && !isMd);
|
|
@@ -85,6 +88,9 @@ const OrgSwitcher = ({ organizations, value, onChange, isLoading = false, isSear
|
|
|
85
88
|
: { bg: "transparent" };
|
|
86
89
|
// NOTE: hover reads against backgroundColor.light (the navbar shell) — for zinc the two measured near-1.0, invisible.
|
|
87
90
|
const triggerHoverBg = resolveHoverTint(theme.colors.gray[100], theme.colors.backgroundColor.light);
|
|
91
|
+
const searchRule = isDarkCanvas(theme.colors.surfaceRaised)
|
|
92
|
+
? raisedRule(theme.colors)
|
|
93
|
+
: theme.colors.gray[100];
|
|
88
94
|
const handleSelect = (org) => {
|
|
89
95
|
onClose();
|
|
90
96
|
setQuery("");
|
|
@@ -94,13 +100,14 @@ const OrgSwitcher = ({ organizations, value, onChange, isLoading = false, isSear
|
|
|
94
100
|
const avatarNode = selected ? (_jsx(Avatar, { org: selected, boxSize: s.avatar, fontSize: s.sub })) : (_jsx(Flex, { align: "center", justify: "center", boxSize: s.avatar, borderRadius: "lg", bg: theme.colors.gray[100], color: accentTextOnCanvas(theme.colors.gray, theme.colors.gray[100]), flexShrink: 0, children: _jsx(Building2, { size: 14 }) }));
|
|
95
101
|
const labelGap = s.px === 2 ? 8 : 10;
|
|
96
102
|
const squeezedWidth = `calc(${s.px * 8 + labelGap * 2 + 16}px + ${s.avatar})`;
|
|
97
|
-
const
|
|
103
|
+
const shownName = avatarOnly ? selected === null || selected === void 0 ? void 0 : selected.name : ((_a = selected === null || selected === void 0 ? void 0 : selected.name) !== null && _a !== void 0 ? _a : placeholder);
|
|
104
|
+
const trigger = (_jsxs(Flex, { as: "button", type: "button", "aria-label": shownName ? `${ariaLabel}, ${shownName}` : ariaLabel, align: "center", justify: avatarOnly ? "center" : undefined, gap: avatarOnly ? "4px" : `${labelGap}px`, h: avatarOnly ? s.avatarH : s.h, px: avatarOnly ? "6px" : s.px, minW: avatarOnly ? undefined : squeezedWidth, flexShrink: avatarOnly ? 0 : 1, borderRadius: "lg", cursor: isLoading ? "default" : "pointer", opacity: isLoading ? 0.6 : 1, pointerEvents: isLoading ? "none" : "auto", transition: BACKGROUND_TRANSITION, _hover: { bg: triggerVariant === "ghost" ? triggerHoverBg : undefined }, ...triggerStyles, children: [avatarNode, !avatarOnly && (_jsx(Text, { fontSize: s.font, fontWeight: 600, color: theme.colors.gray[700], maxW: maxWidth, minW: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", textAlign: "left", children: (_b = selected === null || selected === void 0 ? void 0 : selected.name) !== null && _b !== void 0 ? _b : placeholder })), isLoading ? (_jsx(Spinner, { size: "xs", thickness: "1.5px", color: theme.colors.accentText, flexShrink: 0 })) : avatarOnly ? (_jsx(Box, { as: ChevronDown, size: 12, color: theme.colors.textMuted, flexShrink: 0, "aria-hidden": "true" })) : (_jsx(Box, { as: ChevronsUpDown, size: 16, color: theme.colors.textMuted, flexShrink: 0 }))] }));
|
|
98
105
|
return (_jsxs(Popover, { isOpen: isOpen, onOpen: handlePopoverOpen, onClose: () => {
|
|
99
106
|
onClose();
|
|
100
107
|
setQuery("");
|
|
101
|
-
}, placement: "bottom-start", initialFocusRef: showSearch ? searchRef : firstOptionRef, isLazy: true, children: [avatarOnly ? (_jsx(ToolTip, { label: (
|
|
108
|
+
}, placement: "bottom-start", initialFocusRef: showSearch ? searchRef : firstOptionRef, isLazy: true, children: [avatarOnly ? (_jsx(ToolTip, { label: (_c = selected === null || selected === void 0 ? void 0 : selected.name) !== null && _c !== void 0 ? _c : placeholder, placement: "bottom", isDisabled: isOpen, children: _jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, children: _jsx(PopoverTrigger, { children: trigger }) }) })) : (_jsx(PopoverTrigger, { children: trigger })), _jsx(PopoverContent, { minW: menuMinWidth, maxW: "calc(100vw - 32px)", w: "auto",
|
|
102
109
|
// NOTE: Chakra's --popper-bg is hardcoded white via dead _dark — without an explicit bg the panel stayed white.
|
|
103
|
-
bg: theme.colors.surfaceRaised, borderRadius: "xl", overflow: "hidden", boxShadow:
|
|
110
|
+
bg: theme.colors.surfaceRaised, borderRadius: "xl", overflow: "hidden", boxShadow: "float", _focus: { outline: "none", boxShadow: "float" }, children: _jsxs(PopoverBody, { p: 0, children: [showSearch && (_jsx(Box, { p: 2, borderBottom: "1px solid", borderColor: searchRule, children: _jsxs(InputGroup, { size: "sm", children: [_jsx(InputLeftElement, { pointerEvents: "none", children: _jsx(Search, { size: 15, color: theme.colors.textMuted }) }), _jsx(Input, { ref: searchRef, placeholder: "Search organizations", value: query, onChange: (e) => setQuery(e.target.value), onKeyDown: (e) => {
|
|
104
111
|
if (e.key === "ArrowDown" && filtered.length > 0) {
|
|
105
112
|
e.preventDefault();
|
|
106
113
|
focusOption(0);
|
|
@@ -111,7 +118,7 @@ const OrgSwitcher = ({ organizations, value, onChange, isLoading = false, isSear
|
|
|
111
118
|
optionRefs.current[idx] = el;
|
|
112
119
|
if (idx === 0)
|
|
113
120
|
firstOptionRef.current = el;
|
|
114
|
-
}, tabIndex: idx === activeIndex ? 0 : -1, align: "center", gap: "10px", w: "100%", textAlign: "left", border: "none", fontFamily: "inherit", px: 3, py: 2, cursor: "pointer", bg: "transparent", transition:
|
|
121
|
+
}, tabIndex: idx === activeIndex ? 0 : -1, align: "center", gap: "10px", w: "100%", textAlign: "left", border: "none", fontFamily: "inherit", px: 3, py: 2, cursor: "pointer", bg: "transparent", transition: BACKGROUND_TRANSITION, ...optionRowCursorSx(rowBackgrounds), onClick: () => handleSelect(org), children: [_jsx(Avatar, { org: org, boxSize: s.avatar, fontSize: s.sub }), _jsxs(Box, { flex: "1", minW: 0, children: [_jsx(Text, { fontSize: s.font, fontWeight: isActive ? 600 : 500, color: theme.colors.text[900], overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: org.name }), showRole && org.role && (_jsx(Text, { fontSize: s.sub, color: theme.colors.text[500], overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: org.role }))] }), isActive && (_jsx(Box, { as: Check, size: 16, color: theme.colors.accentText, flexShrink: 0 }))] }, org.id));
|
|
115
122
|
}), filtered.length === 0 && (_jsx(Text, { fontSize: "sm", color: theme.colors.textMuted, textAlign: "center", py: 6, children: "No organizations found" }))] })] }) })] }));
|
|
116
123
|
};
|
|
117
124
|
export default OrgSwitcher;
|