pixelize-design-library 2.4.2-beta.65 โ 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 +437 -13
- package/COMPONENT-GOTCHAS.md +150 -91
- package/DESIGN-GUIDE.md +47 -7
- 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 +1 -0
- package/dist/Components/CopyButton/CopyButton.js +3 -6
- 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 +2 -0
- package/dist/Components/Drawer/Drawer.js +23 -25
- 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/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/warnDroppedSlotChildren.d.ts +1 -1
- package/dist/Components/Modal/warnDroppedSlotChildren.js +7 -3
- package/dist/Components/NavLauncher/LauncherTabs.js +2 -1
- package/dist/Components/NavLauncher/NavLauncher.js +44 -22
- package/dist/Components/NavLauncher/NavLauncherProps.d.ts +6 -4
- package/dist/Components/NavLauncher/ScopeBar.js +4 -2
- package/dist/Components/NavLauncher/engine/engine.js +2 -1
- package/dist/Components/NavLauncher/engine/fold.js +2 -1
- package/dist/Components/NavLauncher/launcherParts.d.ts +12 -0
- package/dist/Components/NavLauncher/launcherParts.js +45 -11
- package/dist/Components/NavLauncher/searchLayout.d.ts +1 -0
- package/dist/Components/NavLauncher/searchLayout.js +3 -1
- package/dist/Components/NavLauncher/spotlightParts.d.ts +6 -2
- package/dist/Components/NavLauncher/spotlightParts.js +22 -9
- 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 +14 -20
- 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/WorkspaceWindow/WorkspaceTrayPreview.js +11 -1
- package/dist/Components/WorkspaceWindow/WorkspaceWindow.js +3 -1
- package/dist/Components/WorkspaceWindow/WorkspaceWindowProps.d.ts +14 -7
- 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/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 +1 -0
- 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 +3 -6
- 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 +19 -18
- 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/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/warnDroppedSlotChildren.js +7 -3
- package/dist/esm/Components/NavLauncher/LauncherTabs.js +2 -1
- package/dist/esm/Components/NavLauncher/NavLauncher.js +47 -25
- package/dist/esm/Components/NavLauncher/ScopeBar.js +4 -2
- package/dist/esm/Components/NavLauncher/engine/engine.js +2 -1
- package/dist/esm/Components/NavLauncher/engine/fold.js +2 -1
- package/dist/esm/Components/NavLauncher/launcherParts.js +40 -8
- package/dist/esm/Components/NavLauncher/searchLayout.js +1 -0
- package/dist/esm/Components/NavLauncher/spotlightParts.js +23 -10
- 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 +15 -21
- 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/WorkspaceWindow/WorkspaceTrayPreview.js +12 -2
- package/dist/esm/Components/WorkspaceWindow/WorkspaceWindow.js +3 -1
- 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/provider/ThemeSwitcher.js +1 -1
- 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 +16 -24
- package/dist/index.d.ts +54 -2
- package/dist/index.js +33 -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
|
@@ -3,9 +3,12 @@ import { Box, Flex, Heading, Text } from "@chakra-ui/react";
|
|
|
3
3
|
import { Lock, Star } from "lucide-react";
|
|
4
4
|
import { createContext, Fragment, useContext, } from "react";
|
|
5
5
|
import { FOCUS_VISIBLE_OVER_STATE, focusVisibleStyles, } from "../../Theme/chakra/focusRing.styles.js";
|
|
6
|
+
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
6
7
|
import { insetRingShadow } from "../../Theme/chakra/ringShadow.js";
|
|
7
8
|
import { resolveFilledSurface } from "../../Theme/tokens/builders/filledSurface.js";
|
|
8
9
|
import { AA_NON_TEXT, liftToContrast, } from "../../Theme/tokens/builders/outlineRung.js";
|
|
10
|
+
import { ruleOn } from "../../Theme/tokens/builders/planeStep.js";
|
|
11
|
+
import { raisedRule } from "../../Theme/tokens/builders/surfaceRaised.js";
|
|
9
12
|
import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
|
|
10
13
|
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
11
14
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
@@ -19,6 +22,34 @@ export const ITEM_SELECTOR = "[data-launcher-item]";
|
|
|
19
22
|
const TouchDensityContext = createContext(false);
|
|
20
23
|
export const TouchDensity = TouchDensityContext.Provider;
|
|
21
24
|
export const useTouchDensity = () => useContext(TouchDensityContext);
|
|
25
|
+
const RulePlaneContext = createContext("raised");
|
|
26
|
+
export const RulePlaneProvider = RulePlaneContext.Provider;
|
|
27
|
+
const useSectionRule = () => {
|
|
28
|
+
const { colors } = useCustomTheme();
|
|
29
|
+
const plane = useContext(RulePlaneContext);
|
|
30
|
+
return plane === "recess"
|
|
31
|
+
? ruleOn(colors, colors.backgroundColor.subtle)
|
|
32
|
+
: raisedRule(colors);
|
|
33
|
+
};
|
|
34
|
+
export const copyHint = (base, copied, isCopied) => ({
|
|
35
|
+
text: isCopied ? copied : base,
|
|
36
|
+
reserve: isCopied ? base : copied,
|
|
37
|
+
isAccent: isCopied,
|
|
38
|
+
});
|
|
39
|
+
export function HintLabel({ text, reserve, isAccent = false, }) {
|
|
40
|
+
const { colors } = useCustomTheme();
|
|
41
|
+
return (_jsx(Box, { as: "span", "data-testid": "launcher-hint-label", "data-accent": isAccent || undefined, "data-reserve": reserve, display: "inline-flex", flexDirection: "column", color: isAccent ? colors.accentText : undefined, transition: transitionFor(["color"]), sx: {
|
|
42
|
+
// NOTE: ::after reserves the widest label (one per line), so swapping text never shifts the row.
|
|
43
|
+
"&::after": {
|
|
44
|
+
content: "attr(data-reserve)",
|
|
45
|
+
whiteSpace: "pre",
|
|
46
|
+
height: "0px",
|
|
47
|
+
overflow: "hidden",
|
|
48
|
+
visibility: "hidden",
|
|
49
|
+
},
|
|
50
|
+
...reducedMotionSx(),
|
|
51
|
+
}, children: text }));
|
|
52
|
+
}
|
|
22
53
|
export const isPlainClick = (event) => event.button === 0 &&
|
|
23
54
|
!event.metaKey &&
|
|
24
55
|
!event.ctrlKey &&
|
|
@@ -103,7 +134,8 @@ export function NewTag({ label }) {
|
|
|
103
134
|
}
|
|
104
135
|
export function SectionHeader({ label, meta, isDecorative = false, isRail = false, hasCount = true, }) {
|
|
105
136
|
const { colors } = useCustomTheme();
|
|
106
|
-
|
|
137
|
+
const rule = useSectionRule();
|
|
138
|
+
return (_jsxs(Flex, { align: "baseline", gap: "6px", px: isRail ? "4px" : "8px", pb: "5px", mb: hasCount ? 0 : "2px", borderBottomWidth: "1px", borderColor: rule, "aria-hidden": isDecorative || undefined, children: [_jsx(Heading, { as: isDecorative ? "div" : "h2", m: 0, fontSize: "xs-plus", fontWeight: 600, letterSpacing: "-0.003em", color: colors.text[900], children: label }), meta ? (_jsx(Text, { as: "span", fontSize: "xs-minus", color: colors.textMuted, sx: { fontVariantNumeric: "tabular-nums" }, children: meta })) : null] }));
|
|
107
139
|
}
|
|
108
140
|
export function RowIcon({ icon: Icon, size, stroke = 1.75, mt }) {
|
|
109
141
|
const { colors } = useCustomTheme();
|
|
@@ -126,14 +158,14 @@ export function RowActions({ children }) {
|
|
|
126
158
|
[NARROW_ROW]: {
|
|
127
159
|
[revealed]: {
|
|
128
160
|
backgroundColor: activeRowStyle(colors).fill,
|
|
129
|
-
borderRadius: "
|
|
161
|
+
borderRadius: "md",
|
|
130
162
|
},
|
|
131
163
|
},
|
|
132
164
|
}, position: "absolute", top: isTouch ? "12px" : "7px", right: "4px", h: "19px", align: "center", gap: "2px", zIndex: 1, children: children }));
|
|
133
165
|
}
|
|
134
166
|
export function RowTip({ text }) {
|
|
135
167
|
const { colors } = useCustomTheme();
|
|
136
|
-
return (_jsx(Box, { role: "tooltip", position: "absolute", right: "20px", top: "-26px", zIndex: 2, px: "8px", py: "3px", borderRadius: "
|
|
168
|
+
return (_jsx(Box, { role: "tooltip", position: "absolute", right: "20px", top: "-26px", zIndex: 2, px: "8px", py: "3px", borderRadius: "md", fontSize: "xs-minus", fontWeight: 600, whiteSpace: "nowrap", bg: colors.text[900], color: colors.surfaceRaised, visibility: "hidden", pointerEvents: "none", _groupHover: { visibility: "visible" }, children: text }));
|
|
137
169
|
}
|
|
138
170
|
export function ModuleRow({ module, keyScreens, isPinned, onTogglePin, pinId, labels, link, }) {
|
|
139
171
|
const { colors } = useCustomTheme();
|
|
@@ -143,7 +175,7 @@ export function ModuleRow({ module, keyScreens, isPinned, onTogglePin, pinId, la
|
|
|
143
175
|
const isTouch = useTouchDensity();
|
|
144
176
|
const base = typeof module.badge === "number" || module.badge ? 24 : 0;
|
|
145
177
|
const open = base + (onTogglePin ? 46 : 24);
|
|
146
|
-
return (_jsxs(Flex, { "data-group": true, "data-nav-cell": true, position: "relative", align: "flex-start", gap: "10px", minH: isTouch ? "44px" : "34px", pl: "8px", pr: "4px", pt: isTouch ? "12px" : "7px", pb: isTouch ? "8px" : "5px", borderRadius: "
|
|
178
|
+
return (_jsxs(Flex, { "data-group": true, "data-nav-cell": true, position: "relative", align: "flex-start", gap: "10px", minH: isTouch ? "44px" : "34px", pl: "8px", pr: "4px", pt: isTouch ? "12px" : "7px", pb: isTouch ? "8px" : "5px", borderRadius: "lg", transition: transitionFor(["background-color"]), _hover: hover._hover, _focusWithin: hover._focusWithin, sx: { ...focus.sx, ...ROW_CONTAINER }, children: [_jsx(RowIcon, { icon: module.icon, size: 16, mt: "2px" }), _jsxs(Flex, { direction: "column", flex: 1, minW: 0, children: [_jsxs(Flex, { align: "center", gap: "6px", h: "19px", minW: 0, sx: titleInset(base, open), children: [_jsx(OverflowToolTip, { label: module.label, placement: "top-start", children: _jsx(Box, { as: link.linkAs, href: module.href, "data-launcher-item": true, ...focus.primary, "data-pin-id": onTogglePin ? pinId : undefined, onClick: link.onPlainClick, minW: 0, fontSize: "13.5px", fontWeight: 500, color: colors.text[900], noOfLines: 1, borderRadius: "sm", sx: stretchedLink("lg"), children: module.label }) }), module.isNew ? _jsx(NewTag, { label: labels.newBadge }) : null] }), keyScreens.length ? (_jsx(OverflowToolTip, { label: keyScreens.map((screen) => screen.label).join(" ยท "), placement: "bottom-start", children: _jsx(Box, { role: "group", "aria-label": `${module.label} ${labels.screens}`, position: "relative", zIndex: 1, w: "fit-content", maxW: "100%", fontSize: "xs-minus", lineHeight: "15px", color: colors.textMuted, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", children: keyScreens.map((screen, i) => (_jsxs(Fragment, { children: [i > 0 ? (_jsx(Box, { as: "span", "aria-hidden": true, mx: "5px", opacity: 0.7, children: "\u00B7" })) : null, _jsx(Box, { as: link.linkAs, href: screen.href, "data-launcher-item": true, onClick: link.onPlainClick, color: "inherit", borderRadius: "sm", position: "relative", zIndex: 1, _hover: {
|
|
147
179
|
textDecoration: "underline",
|
|
148
180
|
textUnderlineOffset: "2px",
|
|
149
181
|
}, sx: ring, children: screen.label })] }, screen.id))) }) })) : null] }), _jsxs(RowActions, { children: [_jsx(CountBadge, { value: module.badge }), onTogglePin ? (_jsx(PinToggle, { isPinned: isPinned, label: isPinned ? labels.unpin(module.label) : labels.pin(module.label), title: "", onToggle: onTogglePin })) : null, _jsx(NewTabLink, { href: module.href, label: labels.openInNewTab(module.label), tip: labels.newTabTip, linkAs: link.linkAs })] }), onTogglePin ? (_jsx(RowTip, { text: isPinned ? labels.unpinTip : labels.pinTip })) : null] }));
|
|
@@ -154,11 +186,11 @@ export function RailRow({ screen, module, link, isStrong = false, trailing, pinI
|
|
|
154
186
|
const hover = useRowHover();
|
|
155
187
|
const focus = useRowFocus();
|
|
156
188
|
const isTouch = useTouchDensity();
|
|
157
|
-
return (_jsxs(Flex, { "data-group": true, position: "relative", align: "center", gap: "10px", h: isTouch ? "44px" : "32px", pl: "8px", pr: "4px", borderRadius: "
|
|
189
|
+
return (_jsxs(Flex, { "data-group": true, position: "relative", align: "center", gap: "10px", h: isTouch ? "44px" : "32px", pl: "8px", pr: "4px", borderRadius: "lg", transition: transitionFor(["background-color"]), _hover: hover._hover, _focusWithin: hover._focusWithin, sx: focus.sx, children: [_jsx(RowIcon, { icon: (_a = screen.icon) !== null && _a !== void 0 ? _a : module.icon, size: 15 }), _jsx(OverflowToolTip, { label: screen.label, placement: "top-start", children: _jsx(Box, { as: link.linkAs, href: screen.href, "data-launcher-item": true, ...focus.primary, "data-pin-id": pinId, onClick: link.onPlainClick, flex: 1, minW: 0, fontSize: "xs-plus", fontWeight: isStrong ? 500 : 400, color: colors.text[900], noOfLines: 1, borderRadius: "sm", sx: stretchedLink("lg"), children: screen.label }) }), _jsx(Flex, { position: "relative", zIndex: 1, align: "center", gap: "2px", children: trailing })] }));
|
|
158
190
|
}
|
|
159
191
|
export function PinTextButton({ label, text, onToggle }) {
|
|
160
192
|
const { colors } = useCustomTheme();
|
|
161
|
-
return (_jsxs(Box, { as: "button", type: "button", "aria-label": label, flexShrink: 0, h: "22px", px: "7px", display: "inline-flex", alignItems: "center", gap: "4px", borderRadius: "
|
|
193
|
+
return (_jsxs(Box, { as: "button", type: "button", "aria-label": label, flexShrink: 0, h: "22px", px: "7px", display: "inline-flex", alignItems: "center", gap: "4px", borderRadius: "md", borderWidth: "1px", borderColor: raisedRule(colors), bg: colors.surfaceRaised, color: colors.text[700], fontSize: "xs-minus", fontWeight: 600, cursor: "pointer", opacity: 0, transition: transitionFor(["opacity", "background-color"]), sx: { ...revealStyles(colors), "@media (hover: none)": { opacity: 1 } }, onClick: (event) => {
|
|
162
194
|
event.preventDefault();
|
|
163
195
|
event.stopPropagation();
|
|
164
196
|
onToggle();
|
|
@@ -170,7 +202,7 @@ export function PinnedTile({ screen, module, link, labels, onTogglePin, }) {
|
|
|
170
202
|
const Icon = (_a = screen.icon) !== null && _a !== void 0 ? _a : module.icon;
|
|
171
203
|
const focus = useRowFocus(true);
|
|
172
204
|
const isTouch = useTouchDensity();
|
|
173
|
-
return (_jsxs(Flex, { "data-group": true, "data-nav-cell": true, position: "relative", align: "center", gap: "8px", h: isTouch ? "44px" : "36px", pl: "9px", pr: "4px", borderRadius: "9px", borderWidth: "1px", borderColor: colors
|
|
205
|
+
return (_jsxs(Flex, { "data-group": true, "data-nav-cell": true, position: "relative", align: "center", gap: "8px", h: isTouch ? "44px" : "36px", pl: "9px", pr: "4px", borderRadius: "9px", borderWidth: "1px", borderColor: raisedRule(colors), bg: colors.surfaceRaised, transition: transitionFor(["border-color", "background-color"]), _hover: { borderColor: colors.gray[300] }, sx: focus.sx, children: [Icon ? (_jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, color: colors.accentText, children: _jsx(Icon, { size: 15, strokeWidth: 1.8, "aria-hidden": true }) })) : null, _jsx(OverflowToolTip, { label: screen.label, placement: "top-start", children: _jsx(Box, { as: link.linkAs, href: screen.href, "data-launcher-item": true, ...focus.primary, "data-pin-id": onTogglePin ? screen.id : undefined, onClick: link.onPlainClick, flex: 1, minW: 0, fontSize: "xs-plus", fontWeight: 500, color: colors.text[900], noOfLines: 1, borderRadius: "sm", sx: stretchedLink("9px"), children: screen.label }) }), _jsx(CountBadge, { value: screen.badge, size: "tile" }), onTogglePin ? (_jsx(Box, { position: "relative", zIndex: 1, flexShrink: 0, w: "0", overflow: "hidden", transition: transitionFor(["width"]), _groupHover: { w: "22px" }, _groupFocusWithin: { w: "22px" }, children: _jsx(PinToggle, { isPinned: true, size: 12, label: labels.unpin(screen.label), title: labels.unpinTip, onToggle: onTogglePin }) })) : null] }));
|
|
174
206
|
}
|
|
175
207
|
export function AppsSection({ apps, hues, currentAppId, heading, hideHeading = false, onSelect, }) {
|
|
176
208
|
const { colors } = useCustomTheme();
|
|
@@ -190,7 +222,7 @@ export function AppsSection({ apps, hues, currentAppId, heading, hideHeading = f
|
|
|
190
222
|
}
|
|
191
223
|
: {}), "aria-current": isCurrent ? "true" : undefined, title: app.locked
|
|
192
224
|
? ((_a = app.lockedReason) !== null && _a !== void 0 ? _a : `${app.name} is not available on your plan`)
|
|
193
|
-
: undefined, "data-app-locked": app.locked ? "true" : undefined, "aria-disabled": app.locked ? "true" : undefined, align: "center", gap: 3, minH: "44px", px: 2, py: 1, borderRadius: "
|
|
225
|
+
: undefined, "data-app-locked": app.locked ? "true" : undefined, "aria-disabled": app.locked ? "true" : undefined, align: "center", gap: 3, minH: "44px", px: 2, py: 1, borderRadius: "lg", textDecoration: "none", cursor: interactive ? "pointer" : "default", bg: isCurrent ? rows.selected : "transparent", transition: transitionFor(["background-color"]), _hover: interactive ? { bg: rows.active } : undefined, sx: {
|
|
194
226
|
_focusVisible: rowRing,
|
|
195
227
|
[FOCUS_VISIBLE_OVER_STATE]: rowRing,
|
|
196
228
|
}, children: [_jsx(AppMark, { app: app, hue: hues[index], boxSize: "28px", iconSize: 15, muted: app.locked }), _jsx(OverflowToolTip, { label: app.name, placement: "top-start", children: _jsx(Text, { flex: 1, minW: 0, fontSize: "sm", fontWeight: "medium", noOfLines: 1, color: app.locked ? colors.textMuted : colors.text[900], children: app.name }) }), app.locked ? (_jsx(Box, { as: Lock, size: 14, color: colors.textMuted, flexShrink: 0, "aria-hidden": true })) : null] }) }, app.id || app.name));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SCOPE_ACTIONS, SCOPE_ALL } from "./spotlight.js";
|
|
2
|
+
export const copiesOnEnter = (entry) => (entry === null || entry === void 0 ? void 0 : entry.type) === "answer" && !entry.item.run && !entry.item.href;
|
|
2
3
|
export const inScope = (groups, scope) => scope === SCOPE_ALL ? groups : groups.filter((g) => g.scope === scope);
|
|
3
4
|
/** A scope's items as passed, unranked, for browsing before typing. */
|
|
4
5
|
export const scopeGroups = (input) => {
|
|
@@ -4,14 +4,26 @@ import { ChevronDown, Search as SearchIcon } from "lucide-react";
|
|
|
4
4
|
import { useRef } from "react";
|
|
5
5
|
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
6
6
|
import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
|
|
7
|
+
import { raisedRule } from "../../Theme/tokens/builders/surfaceRaised.js";
|
|
7
8
|
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
8
9
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
9
10
|
import Button from "../Button/Button.js";
|
|
10
11
|
import CopyButton from "../CopyButton/CopyButton.js";
|
|
11
12
|
import { KbdShortcut } from "../Kbd/Kbd.js";
|
|
12
|
-
import { activeRowStyle, activeRowSurface, CountBadge, Highlight, useTouchDensity, } from "./launcherParts.js";
|
|
13
|
+
import { activeRowStyle, activeRowSurface, copyHint, CountBadge, Highlight, HintLabel, useTouchDensity, } from "./launcherParts.js";
|
|
13
14
|
export const QUICK_ACTION_LIMIT = 5;
|
|
14
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
|
+
});
|
|
15
27
|
export function QuickActionsRow({ items, label, link, onRun, }) {
|
|
16
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) => {
|
|
17
29
|
const Icon = item.icon;
|
|
@@ -34,7 +46,7 @@ const useCardSurface = (isActive) => {
|
|
|
34
46
|
position: "relative",
|
|
35
47
|
borderRadius: "xl",
|
|
36
48
|
borderWidth: "1px",
|
|
37
|
-
borderColor: isActive ? edge : colors
|
|
49
|
+
borderColor: isActive ? edge : raisedRule(colors),
|
|
38
50
|
bg: isActive ? fill : colors.surfaceRaised,
|
|
39
51
|
transition: transitionFor(["background-color", "border-color"]),
|
|
40
52
|
sx: reducedMotionSx(),
|
|
@@ -57,9 +69,9 @@ export function TopHitCard({ item, query, isActive, optionId, link, labels, onOp
|
|
|
57
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: () => {
|
|
58
70
|
if (!item.href)
|
|
59
71
|
onOpen();
|
|
60
|
-
}, 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: "
|
|
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 })] }));
|
|
61
73
|
}
|
|
62
|
-
export function AnswerCard({ item, isActive, optionId, link, labels, onOpen, onHover, describedBy, }) {
|
|
74
|
+
export function AnswerCard({ item, isActive, isCopied, optionId, link, labels, onOpen, onHover, describedBy, }) {
|
|
63
75
|
var _a, _b;
|
|
64
76
|
const { colors } = useCustomTheme();
|
|
65
77
|
const surface = useCardSurface(isActive);
|
|
@@ -68,28 +80,29 @@ export function AnswerCard({ item, isActive, optionId, link, labels, onOpen, onH
|
|
|
68
80
|
value: item.label,
|
|
69
81
|
};
|
|
70
82
|
const acts = Boolean(item.href || item.run);
|
|
83
|
+
const hint = acts ? labels.hintOpen : labels.hintCopy;
|
|
71
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: () => {
|
|
72
85
|
if (!item.href)
|
|
73
86
|
onOpen();
|
|
74
|
-
}, 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: "
|
|
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 })] }));
|
|
75
88
|
}
|
|
76
89
|
export function ShowMoreOption({ count, isActive, optionId, label, onExpand, onHover, }) {
|
|
77
90
|
const { colors } = useCustomTheme();
|
|
78
91
|
const isTouch = useTouchDensity();
|
|
79
|
-
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: "
|
|
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)] }));
|
|
80
93
|
}
|
|
81
94
|
export const describeFacts = (facts) => facts.map((f) => `${f.label}: ${f.value}`).join("; ");
|
|
82
95
|
export function FactList({ facts, labels, layout, onCopied, onCopyBlocked, }) {
|
|
83
96
|
const { colors } = useCustomTheme();
|
|
84
97
|
const values = useRef([]);
|
|
85
98
|
const isPane = layout === "pane";
|
|
86
|
-
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: "
|
|
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) => {
|
|
87
100
|
values.current[i] = node;
|
|
88
|
-
}, fontSize: isPane ? "13.5px" : "
|
|
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}`))) }));
|
|
89
102
|
}
|
|
90
|
-
export function PreviewPane({ item, placement, width, labels, onCopied, onCopyBlocked, }) {
|
|
103
|
+
export function PreviewPane({ item, placement, width, enterCopies, isCopied, labels, onCopied, onCopyBlocked, }) {
|
|
91
104
|
var _a, _b, _c, _d, _e;
|
|
92
105
|
const { colors } = useCustomTheme();
|
|
93
106
|
const isDock = placement === "dock";
|
|
94
|
-
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: colors
|
|
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 }));
|
|
95
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;
|