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,75 @@
|
|
|
1
|
+
// Accents, nukta and joiners fold away; vowel signs and viramas belong to the letter.
|
|
2
|
+
const OPTIONAL_MARKS =
|
|
3
|
+
// eslint-disable-next-line no-misleading-character-class -- each mark is removed on its own
|
|
4
|
+
/[\u0300-\u036f\u0591-\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06ed\u093c\u1ab0-\u1aff\u1dc0-\u1dff\u200c\u200d\u20d0-\u20ff\ufe20-\ufe2f]/g;
|
|
5
|
+
const CHANDRABINDU = /\u0901/g;
|
|
6
|
+
// NOTE: built from code points; minified Indic literals trip consumers' locale-data budget gates.
|
|
7
|
+
const ANUSVARA = String.fromCodePoint(0x0902);
|
|
8
|
+
const MARK = /\p{M}/u;
|
|
9
|
+
const SEPARATOR = /[^\p{L}\p{N}\p{M}]+/u;
|
|
10
|
+
const SPECIAL = {
|
|
11
|
+
ß: "ss",
|
|
12
|
+
æ: "ae",
|
|
13
|
+
œ: "oe",
|
|
14
|
+
ø: "o",
|
|
15
|
+
ł: "l",
|
|
16
|
+
đ: "d",
|
|
17
|
+
ı: "i",
|
|
18
|
+
};
|
|
19
|
+
const SPECIAL_RE = /[ßæœøłđı]/g;
|
|
20
|
+
const DEVANAGARI_VIRAMA = 0x094d;
|
|
21
|
+
/** Case- and accent-insensitive form used for every comparison: "Crème Brûlée" -> "creme brulee". */
|
|
22
|
+
export const foldText = (text) => text
|
|
23
|
+
.normalize("NFKD")
|
|
24
|
+
.replace(OPTIONAL_MARKS, "")
|
|
25
|
+
.replace(CHANDRABINDU, ANUSVARA)
|
|
26
|
+
.toLowerCase()
|
|
27
|
+
.replace(SPECIAL_RE, (ch) => SPECIAL[ch]);
|
|
28
|
+
export const splitWords = (folded) => folded.split(SEPARATOR).filter(Boolean);
|
|
29
|
+
/** Folded, de-duplicated query tokens in typing order. */
|
|
30
|
+
export const tokenize = (query) => Array.from(new Set(splitWords(foldText(query))));
|
|
31
|
+
/** True when folded text carries combining marks, so its written letters span several characters. */
|
|
32
|
+
export const hasMarks = (folded) => MARK.test(folded);
|
|
33
|
+
const isDevanagariConsonant = (code) => (code >= 0x0915 && code <= 0x0939) || (code >= 0x0978 && code <= 0x097f);
|
|
34
|
+
const markCodes = new Map();
|
|
35
|
+
const isMarkCode = (code, char) => {
|
|
36
|
+
if (code < 0x0300)
|
|
37
|
+
return false;
|
|
38
|
+
let known = markCodes.get(code);
|
|
39
|
+
if (known === undefined) {
|
|
40
|
+
known = MARK.test(char);
|
|
41
|
+
markCodes.set(code, known);
|
|
42
|
+
}
|
|
43
|
+
return known;
|
|
44
|
+
};
|
|
45
|
+
/** Written letters: a base with its marks; a Devanagari conjunct counts as one. */
|
|
46
|
+
export const letters = (word) => {
|
|
47
|
+
var _a;
|
|
48
|
+
const out = [];
|
|
49
|
+
let previous = 0;
|
|
50
|
+
for (const char of word) {
|
|
51
|
+
const code = (_a = char.codePointAt(0)) !== null && _a !== void 0 ? _a : 0;
|
|
52
|
+
const joins = isMarkCode(code, char) ||
|
|
53
|
+
(previous === DEVANAGARI_VIRAMA && isDevanagariConsonant(code));
|
|
54
|
+
if (joins && out.length > 0)
|
|
55
|
+
out[out.length - 1] += char;
|
|
56
|
+
else
|
|
57
|
+
out.push(char);
|
|
58
|
+
previous = code;
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
};
|
|
62
|
+
export const foldWithMap = (text) => {
|
|
63
|
+
let folded = "";
|
|
64
|
+
const map = [];
|
|
65
|
+
let at = 0;
|
|
66
|
+
for (const char of text) {
|
|
67
|
+
const piece = foldText(char);
|
|
68
|
+
for (let i = 0; i < piece.length; i += 1)
|
|
69
|
+
map.push(at);
|
|
70
|
+
folded += piece;
|
|
71
|
+
at += char.length;
|
|
72
|
+
}
|
|
73
|
+
map.push(text.length);
|
|
74
|
+
return { folded, map };
|
|
75
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createMatcher, createSearchIndex, editDistance, foldText, highlightRanges, matchesQuery, searchDocuments, searchIndex, tokenize, usageBoosts, } from "./engine.js";
|
|
2
|
+
/** Framework-free ranked search used by NavLauncher; reusable by any list, picker or palette. */
|
|
3
|
+
export const LauncherSearchEngine = Object.freeze({
|
|
4
|
+
createIndex: createSearchIndex,
|
|
5
|
+
search: searchIndex,
|
|
6
|
+
searchDocuments,
|
|
7
|
+
createMatcher,
|
|
8
|
+
matches: matchesQuery,
|
|
9
|
+
highlightRanges,
|
|
10
|
+
usageBoosts,
|
|
11
|
+
foldText,
|
|
12
|
+
tokenize,
|
|
13
|
+
editDistance,
|
|
14
|
+
});
|
|
@@ -3,8 +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";
|
|
7
|
+
import { insetRingShadow } from "../../Theme/chakra/ringShadow.js";
|
|
6
8
|
import { resolveFilledSurface } from "../../Theme/tokens/builders/filledSurface.js";
|
|
7
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";
|
|
8
12
|
import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
|
|
9
13
|
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
10
14
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
@@ -18,6 +22,34 @@ export const ITEM_SELECTOR = "[data-launcher-item]";
|
|
|
18
22
|
const TouchDensityContext = createContext(false);
|
|
19
23
|
export const TouchDensity = TouchDensityContext.Provider;
|
|
20
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
|
+
}
|
|
21
53
|
export const isPlainClick = (event) => event.button === 0 &&
|
|
22
54
|
!event.metaKey &&
|
|
23
55
|
!event.ctrlKey &&
|
|
@@ -41,7 +73,7 @@ export const activeRowSurface = (colors) => {
|
|
|
41
73
|
const { edge, fill } = activeRowStyle(colors);
|
|
42
74
|
return {
|
|
43
75
|
backgroundColor: fill,
|
|
44
|
-
boxShadow:
|
|
76
|
+
boxShadow: insetRingShadow(edge),
|
|
45
77
|
outline: "2px solid transparent",
|
|
46
78
|
outlineOffset: "-2px",
|
|
47
79
|
};
|
|
@@ -102,7 +134,8 @@ export function NewTag({ label }) {
|
|
|
102
134
|
}
|
|
103
135
|
export function SectionHeader({ label, meta, isDecorative = false, isRail = false, hasCount = true, }) {
|
|
104
136
|
const { colors } = useCustomTheme();
|
|
105
|
-
|
|
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] }));
|
|
106
139
|
}
|
|
107
140
|
export function RowIcon({ icon: Icon, size, stroke = 1.75, mt }) {
|
|
108
141
|
const { colors } = useCustomTheme();
|
|
@@ -110,9 +143,12 @@ export function RowIcon({ icon: Icon, size, stroke = 1.75, mt }) {
|
|
|
110
143
|
return null;
|
|
111
144
|
return (_jsx(Box, { as: "span", color: colors.textMuted, display: "inline-flex", flexShrink: 0, mt: mt, transition: transitionFor(["color"]), _groupHover: { color: colors.accentText }, _groupFocusWithin: { color: colors.accentText }, sx: { "[data-reveal=true] &": { color: colors.accentText } }, children: _jsx(Icon, { size: size, strokeWidth: stroke, "aria-hidden": true }) }));
|
|
112
145
|
}
|
|
146
|
+
const HighlightOptionsContext = createContext(undefined);
|
|
147
|
+
export const HighlightOptionsProvider = HighlightOptionsContext.Provider;
|
|
113
148
|
export function Highlight({ text, query }) {
|
|
114
149
|
const { colors } = useCustomTheme();
|
|
115
|
-
|
|
150
|
+
const options = useContext(HighlightOptionsContext);
|
|
151
|
+
return (_jsx(_Fragment, { children: highlightSegments(text, query, options).map((segment, i) => segment.isMatch ? (_jsx(Box, { as: "mark", bg: "transparent", color: "inherit", fontWeight: 650, textDecoration: "underline", textDecorationColor: colors.primary.opacity[48], textDecorationThickness: "1.5px", textUnderlineOffset: "2px", children: segment.text }, i)) : (_jsx(Fragment, { children: segment.text }, i))) }));
|
|
116
152
|
}
|
|
117
153
|
export function RowActions({ children }) {
|
|
118
154
|
const { colors } = useCustomTheme();
|
|
@@ -122,14 +158,14 @@ export function RowActions({ children }) {
|
|
|
122
158
|
[NARROW_ROW]: {
|
|
123
159
|
[revealed]: {
|
|
124
160
|
backgroundColor: activeRowStyle(colors).fill,
|
|
125
|
-
borderRadius: "
|
|
161
|
+
borderRadius: "md",
|
|
126
162
|
},
|
|
127
163
|
},
|
|
128
164
|
}, position: "absolute", top: isTouch ? "12px" : "7px", right: "4px", h: "19px", align: "center", gap: "2px", zIndex: 1, children: children }));
|
|
129
165
|
}
|
|
130
166
|
export function RowTip({ text }) {
|
|
131
167
|
const { colors } = useCustomTheme();
|
|
132
|
-
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 }));
|
|
133
169
|
}
|
|
134
170
|
export function ModuleRow({ module, keyScreens, isPinned, onTogglePin, pinId, labels, link, }) {
|
|
135
171
|
const { colors } = useCustomTheme();
|
|
@@ -139,7 +175,7 @@ export function ModuleRow({ module, keyScreens, isPinned, onTogglePin, pinId, la
|
|
|
139
175
|
const isTouch = useTouchDensity();
|
|
140
176
|
const base = typeof module.badge === "number" || module.badge ? 24 : 0;
|
|
141
177
|
const open = base + (onTogglePin ? 46 : 24);
|
|
142
|
-
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: {
|
|
143
179
|
textDecoration: "underline",
|
|
144
180
|
textUnderlineOffset: "2px",
|
|
145
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] }));
|
|
@@ -150,11 +186,11 @@ export function RailRow({ screen, module, link, isStrong = false, trailing, pinI
|
|
|
150
186
|
const hover = useRowHover();
|
|
151
187
|
const focus = useRowFocus();
|
|
152
188
|
const isTouch = useTouchDensity();
|
|
153
|
-
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 })] }));
|
|
154
190
|
}
|
|
155
191
|
export function PinTextButton({ label, text, onToggle }) {
|
|
156
192
|
const { colors } = useCustomTheme();
|
|
157
|
-
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) => {
|
|
158
194
|
event.preventDefault();
|
|
159
195
|
event.stopPropagation();
|
|
160
196
|
onToggle();
|
|
@@ -166,7 +202,7 @@ export function PinnedTile({ screen, module, link, labels, onTogglePin, }) {
|
|
|
166
202
|
const Icon = (_a = screen.icon) !== null && _a !== void 0 ? _a : module.icon;
|
|
167
203
|
const focus = useRowFocus(true);
|
|
168
204
|
const isTouch = useTouchDensity();
|
|
169
|
-
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] }));
|
|
170
206
|
}
|
|
171
207
|
export function AppsSection({ apps, hues, currentAppId, heading, hideHeading = false, onSelect, }) {
|
|
172
208
|
const { colors } = useCustomTheme();
|
|
@@ -186,7 +222,7 @@ export function AppsSection({ apps, hues, currentAppId, heading, hideHeading = f
|
|
|
186
222
|
}
|
|
187
223
|
: {}), "aria-current": isCurrent ? "true" : undefined, title: app.locked
|
|
188
224
|
? ((_a = app.lockedReason) !== null && _a !== void 0 ? _a : `${app.name} is not available on your plan`)
|
|
189
|
-
: 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: {
|
|
190
226
|
_focusVisible: rowRing,
|
|
191
227
|
[FOCUS_VISIBLE_OVER_STATE]: rowRing,
|
|
192
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,3 +1,4 @@
|
|
|
1
|
+
import { highlightRanges } from "./engine/engine.js";
|
|
1
2
|
const normalize = (text) => text.toLocaleLowerCase().normalize("NFKD");
|
|
2
3
|
function score(label, haystack, tokens) {
|
|
3
4
|
if (!tokens.every((t) => haystack.includes(t)))
|
|
@@ -23,6 +24,12 @@ function rank(rows, text, tokens) {
|
|
|
23
24
|
.sort((a, b) => a.s - b.s || a.index - b.index)
|
|
24
25
|
.map((r) => r.row);
|
|
25
26
|
}
|
|
27
|
+
export function filterItems(items, query) {
|
|
28
|
+
const tokens = normalize(query).split(/\s+/).filter(Boolean);
|
|
29
|
+
if (tokens.length === 0)
|
|
30
|
+
return [];
|
|
31
|
+
return rank([...items], (a) => { var _a, _b; return `${a.label} ${(_a = a.context) !== null && _a !== void 0 ? _a : ""} ${(_b = a.keywords) !== null && _b !== void 0 ? _b : ""}`; }, tokens);
|
|
32
|
+
}
|
|
26
33
|
export function flattenScreens(sections) {
|
|
27
34
|
var _a, _b, _c;
|
|
28
35
|
const seen = new Set();
|
|
@@ -48,6 +55,7 @@ export function flattenScreens(sections) {
|
|
|
48
55
|
}
|
|
49
56
|
return out;
|
|
50
57
|
}
|
|
58
|
+
/** @deprecated Legacy flat search; NavLauncher uses searchLauncherSections (classic) or the spotlight engine. */
|
|
51
59
|
export function searchLauncher(input) {
|
|
52
60
|
var _a, _b;
|
|
53
61
|
const tokens = normalize(input.query).split(/\s+/).filter(Boolean);
|
|
@@ -137,8 +145,23 @@ export function searchLauncherSections(input) {
|
|
|
137
145
|
].filter((g) => g.items.length > 0);
|
|
138
146
|
return { sections, groups };
|
|
139
147
|
}
|
|
148
|
+
const toSegments = (text, ranges) => {
|
|
149
|
+
const out = [];
|
|
150
|
+
let cursor = 0;
|
|
151
|
+
for (const [start, end] of ranges) {
|
|
152
|
+
if (start > cursor)
|
|
153
|
+
out.push({ text: text.slice(cursor, start), isMatch: false });
|
|
154
|
+
out.push({ text: text.slice(start, end), isMatch: true });
|
|
155
|
+
cursor = end;
|
|
156
|
+
}
|
|
157
|
+
if (cursor < text.length)
|
|
158
|
+
out.push({ text: text.slice(cursor), isMatch: false });
|
|
159
|
+
return out.length ? out : [{ text, isMatch: false }];
|
|
160
|
+
};
|
|
140
161
|
/** Splits `text` so every case-insensitive occurrence of a query token is its own matched segment. */
|
|
141
|
-
export function highlightSegments(text, query) {
|
|
162
|
+
export function highlightSegments(text, query, options) {
|
|
163
|
+
if (options === null || options === void 0 ? void 0 : options.fuzzy)
|
|
164
|
+
return toSegments(text, highlightRanges(text, query, { synonyms: options.synonyms }));
|
|
142
165
|
const lower = text.toLocaleLowerCase();
|
|
143
166
|
const tokens = query.toLocaleLowerCase().split(/\s+/).filter(Boolean);
|
|
144
167
|
if (tokens.length === 0 || lower.length !== text.length)
|
|
@@ -158,15 +181,5 @@ export function highlightSegments(text, query) {
|
|
|
158
181
|
else
|
|
159
182
|
merged.push([...range]);
|
|
160
183
|
}
|
|
161
|
-
|
|
162
|
-
let cursor = 0;
|
|
163
|
-
for (const [start, end] of merged) {
|
|
164
|
-
if (start > cursor)
|
|
165
|
-
out.push({ text: text.slice(cursor, start), isMatch: false });
|
|
166
|
-
out.push({ text: text.slice(start, end), isMatch: true });
|
|
167
|
-
cursor = end;
|
|
168
|
-
}
|
|
169
|
-
if (cursor < text.length)
|
|
170
|
-
out.push({ text: text.slice(cursor), isMatch: false });
|
|
171
|
-
return out.length ? out : [{ text, isMatch: false }];
|
|
184
|
+
return toSegments(text, merged);
|
|
172
185
|
}
|
|
@@ -0,0 +1,101 @@
|
|
|
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;
|
|
3
|
+
export const inScope = (groups, scope) => scope === SCOPE_ALL ? groups : groups.filter((g) => g.scope === scope);
|
|
4
|
+
/** A scope's items as passed, unranked, for browsing before typing. */
|
|
5
|
+
export const scopeGroups = (input) => {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
const groups = [];
|
|
8
|
+
if (input.scope === SCOPE_ACTIONS && ((_a = input.actions) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
9
|
+
groups.push({
|
|
10
|
+
id: SCOPE_ACTIONS,
|
|
11
|
+
label: input.actionsLabel,
|
|
12
|
+
scope: SCOPE_ACTIONS,
|
|
13
|
+
isSection: false,
|
|
14
|
+
items: input.actions.map((action) => ({ ...action, id: `action:${action.id}` })),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
for (const group of (_b = input.extraResults) !== null && _b !== void 0 ? _b : []) {
|
|
18
|
+
const scope = (_c = group.scope) !== null && _c !== void 0 ? _c : group.id;
|
|
19
|
+
if (scope !== input.scope || group.items.length === 0)
|
|
20
|
+
continue;
|
|
21
|
+
groups.push({
|
|
22
|
+
id: group.id,
|
|
23
|
+
label: group.label,
|
|
24
|
+
scope,
|
|
25
|
+
isSection: false,
|
|
26
|
+
items: group.items.map((item) => ({ ...item, id: `${group.id}:${item.id}` })),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return groups;
|
|
30
|
+
};
|
|
31
|
+
export const countByScope = (groups, answers) => {
|
|
32
|
+
var _a;
|
|
33
|
+
const counts = new Map();
|
|
34
|
+
let all = answers;
|
|
35
|
+
for (const group of groups) {
|
|
36
|
+
counts.set(group.scope, ((_a = counts.get(group.scope)) !== null && _a !== void 0 ? _a : 0) + group.items.length);
|
|
37
|
+
all += group.items.length;
|
|
38
|
+
}
|
|
39
|
+
counts.set(SCOPE_ALL, all);
|
|
40
|
+
return counts;
|
|
41
|
+
};
|
|
42
|
+
export const takeTopHit = (groups) => {
|
|
43
|
+
let at = -1;
|
|
44
|
+
let index = -1;
|
|
45
|
+
let bestScore = 0;
|
|
46
|
+
for (let g = 0; g < groups.length; g += 1) {
|
|
47
|
+
groups[g].items.forEach((item, i) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
if (((_a = item.score) !== null && _a !== void 0 ? _a : 0) <= bestScore)
|
|
50
|
+
return;
|
|
51
|
+
bestScore = (_b = item.score) !== null && _b !== void 0 ? _b : 0;
|
|
52
|
+
at = g;
|
|
53
|
+
index = i;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (at < 0)
|
|
57
|
+
return { groups };
|
|
58
|
+
return {
|
|
59
|
+
topHit: groups[at].items[index],
|
|
60
|
+
groups: groups
|
|
61
|
+
.map((group, g) => (g === at ? { ...group, items: group.items.filter((_, i) => i !== index) } : group))
|
|
62
|
+
.filter((group) => group.items.length > 0),
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
/** Flat option order for keyboard and ARIA plus per-row group sizes for `moveResult`. */
|
|
66
|
+
export const layoutSearch = (input) => {
|
|
67
|
+
const blocks = [];
|
|
68
|
+
const entries = [];
|
|
69
|
+
const sizes = [];
|
|
70
|
+
if (input.answers.length) {
|
|
71
|
+
blocks.push({ type: "answers", start: 0, items: input.answers });
|
|
72
|
+
for (const item of input.answers) {
|
|
73
|
+
entries.push({ type: "answer", item });
|
|
74
|
+
sizes.push(1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (input.topHit) {
|
|
78
|
+
blocks.push({ type: "top", start: entries.length, item: input.topHit });
|
|
79
|
+
entries.push({ type: "top", item: input.topHit });
|
|
80
|
+
sizes.push(1);
|
|
81
|
+
}
|
|
82
|
+
let total = entries.length;
|
|
83
|
+
for (const group of input.groups) {
|
|
84
|
+
const cap = input.limit !== undefined && !input.expanded.has(group.id) ? Math.max(1, input.limit) : Infinity;
|
|
85
|
+
const visible = group.items.slice(0, cap);
|
|
86
|
+
const hidden = group.items.length - visible.length;
|
|
87
|
+
const start = entries.length;
|
|
88
|
+
for (const item of visible)
|
|
89
|
+
entries.push({ type: "row", item, groupId: group.id });
|
|
90
|
+
sizes.push(visible.length);
|
|
91
|
+
total += group.items.length;
|
|
92
|
+
let more;
|
|
93
|
+
if (hidden > 0) {
|
|
94
|
+
more = { index: entries.length, count: hidden };
|
|
95
|
+
entries.push({ type: "more", groupId: group.id, count: hidden });
|
|
96
|
+
sizes.push(1);
|
|
97
|
+
}
|
|
98
|
+
blocks.push({ type: "group", group, start, visible, more });
|
|
99
|
+
}
|
|
100
|
+
return { blocks, entries, sizes, total };
|
|
101
|
+
};
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { createSearchIndex, searchDocuments, searchIndex, usageBoosts, } from "./engine/engine.js";
|
|
2
|
+
export const SCOPE_ALL = "all";
|
|
3
|
+
export const SCOPE_SCREENS = "screens";
|
|
4
|
+
export const SCOPE_ACTIONS = "actions";
|
|
5
|
+
const SHOWN_FIELDS = new Set(["keyword", "fact", "answer"]);
|
|
6
|
+
const RELATIVE_CUTOFF = 0.25;
|
|
7
|
+
const keywordFields = (keywords) => (typeof keywords === "string" ? keywords.split(/[,;|]/) : (keywords !== null && keywords !== void 0 ? keywords : []))
|
|
8
|
+
.map((k) => k.trim())
|
|
9
|
+
.filter(Boolean)
|
|
10
|
+
.map((text) => ({ name: "keyword", text, weight: 0.75 }));
|
|
11
|
+
const label = (text) => ({
|
|
12
|
+
name: "label",
|
|
13
|
+
text,
|
|
14
|
+
weight: 1,
|
|
15
|
+
});
|
|
16
|
+
export const itemFields = (item) => {
|
|
17
|
+
var _a;
|
|
18
|
+
return [
|
|
19
|
+
label(item.label),
|
|
20
|
+
...keywordFields(item.keywords),
|
|
21
|
+
...(item.context
|
|
22
|
+
? [{ name: "context", text: item.context, weight: 0.45 }]
|
|
23
|
+
: []),
|
|
24
|
+
...((_a = item.facts) !== null && _a !== void 0 ? _a : []).map((f) => ({
|
|
25
|
+
name: "fact",
|
|
26
|
+
text: `${f.label}: ${f.value}`,
|
|
27
|
+
weight: 0.6,
|
|
28
|
+
})),
|
|
29
|
+
...(item.answer
|
|
30
|
+
? [
|
|
31
|
+
{ name: "answer", text: item.answer.label, weight: 0.9 },
|
|
32
|
+
{ name: "answer", text: item.answer.value, weight: 0.5 },
|
|
33
|
+
]
|
|
34
|
+
: []),
|
|
35
|
+
];
|
|
36
|
+
};
|
|
37
|
+
const decorate = (result, hit) => {
|
|
38
|
+
var _a;
|
|
39
|
+
return ({
|
|
40
|
+
...result,
|
|
41
|
+
score: hit.score,
|
|
42
|
+
keywordHint: (_a = hit.matches.find((m) => SHOWN_FIELDS.has(m.field))) === null || _a === void 0 ? void 0 : _a.text,
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
export function createSpotlightIndex(sections, actions, actionsLabel) {
|
|
46
|
+
var _a;
|
|
47
|
+
const documents = [];
|
|
48
|
+
const entries = [];
|
|
49
|
+
const groups = [];
|
|
50
|
+
const seen = new Set();
|
|
51
|
+
const add = (fields, entry) => {
|
|
52
|
+
documents.push({ id: entry.result.id, fields });
|
|
53
|
+
entries.push(entry);
|
|
54
|
+
};
|
|
55
|
+
for (const section of sections) {
|
|
56
|
+
const groupId = `section:${section.id}`;
|
|
57
|
+
groups.push({
|
|
58
|
+
id: groupId,
|
|
59
|
+
label: section.label,
|
|
60
|
+
scope: SCOPE_SCREENS,
|
|
61
|
+
isSection: true,
|
|
62
|
+
});
|
|
63
|
+
for (const module of section.modules) {
|
|
64
|
+
if (module.screens.length === 0)
|
|
65
|
+
continue;
|
|
66
|
+
add([
|
|
67
|
+
label(module.label),
|
|
68
|
+
...keywordFields(module.keywords),
|
|
69
|
+
{ name: "context", text: section.label, weight: 0.35 },
|
|
70
|
+
], {
|
|
71
|
+
groupId,
|
|
72
|
+
usageId: module.screens[0].id,
|
|
73
|
+
result: {
|
|
74
|
+
id: `module:${module.id}`,
|
|
75
|
+
kind: "module",
|
|
76
|
+
label: module.label,
|
|
77
|
+
icon: module.icon,
|
|
78
|
+
badge: module.badge,
|
|
79
|
+
isNew: module.isNew,
|
|
80
|
+
href: module.href,
|
|
81
|
+
screenId: module.screens[0].id,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
for (const screen of module.screens) {
|
|
85
|
+
if (screen.label === module.label || seen.has(screen.id))
|
|
86
|
+
continue;
|
|
87
|
+
seen.add(screen.id);
|
|
88
|
+
add([
|
|
89
|
+
label(screen.label),
|
|
90
|
+
...keywordFields(screen.keywords),
|
|
91
|
+
{ name: "context", text: module.label, weight: 0.5 },
|
|
92
|
+
{ name: "section", text: section.label, weight: 0.3 },
|
|
93
|
+
], {
|
|
94
|
+
groupId,
|
|
95
|
+
usageId: screen.id,
|
|
96
|
+
result: {
|
|
97
|
+
id: `screen:${screen.id}`,
|
|
98
|
+
kind: "screen",
|
|
99
|
+
label: screen.label,
|
|
100
|
+
context: module.label,
|
|
101
|
+
icon: (_a = screen.icon) !== null && _a !== void 0 ? _a : module.icon,
|
|
102
|
+
badge: screen.badge,
|
|
103
|
+
href: screen.href,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (actions === null || actions === void 0 ? void 0 : actions.length) {
|
|
110
|
+
groups.push({
|
|
111
|
+
id: SCOPE_ACTIONS,
|
|
112
|
+
label: actionsLabel,
|
|
113
|
+
scope: SCOPE_ACTIONS,
|
|
114
|
+
isSection: false,
|
|
115
|
+
});
|
|
116
|
+
for (const action of actions) {
|
|
117
|
+
add(itemFields(action), {
|
|
118
|
+
groupId: SCOPE_ACTIONS,
|
|
119
|
+
result: { ...action, id: `action:${action.id}` },
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return { index: createSearchIndex(documents), entries, groups };
|
|
124
|
+
}
|
|
125
|
+
export function spotlightBoosts(spot, usage) {
|
|
126
|
+
const byScreen = usageBoosts(usage);
|
|
127
|
+
const out = {};
|
|
128
|
+
spot.entries.forEach((entry) => {
|
|
129
|
+
const boost = entry.usageId ? byScreen[entry.usageId] : undefined;
|
|
130
|
+
if (boost)
|
|
131
|
+
out[entry.result.id] = boost;
|
|
132
|
+
});
|
|
133
|
+
return out;
|
|
134
|
+
}
|
|
135
|
+
const searchGroup = (group, query, synonyms) => {
|
|
136
|
+
const hits = searchDocuments(group.items.map((item) => ({ id: item.id, fields: itemFields(item) })), query, { synonyms });
|
|
137
|
+
const result = (index) => ({
|
|
138
|
+
...group.items[index],
|
|
139
|
+
id: `${group.id}:${group.items[index].id}`,
|
|
140
|
+
});
|
|
141
|
+
if (group.matchLocally)
|
|
142
|
+
return hits.map((hit) => decorate(result(hit.index), hit));
|
|
143
|
+
const byIndex = new Map(hits.map((hit) => [hit.index, hit]));
|
|
144
|
+
return group.items.map((_, index) => {
|
|
145
|
+
const hit = byIndex.get(index);
|
|
146
|
+
return hit ? decorate(result(index), hit) : { ...result(index), score: 0 };
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
/** Ranked groups; local rows under 25% of the best score are dropped. */
|
|
150
|
+
export function searchSpotlight(spot, input) {
|
|
151
|
+
var _a, _b, _c, _d;
|
|
152
|
+
if (!input.query.trim())
|
|
153
|
+
return [];
|
|
154
|
+
const hits = searchIndex(spot.index, input.query, {
|
|
155
|
+
synonyms: input.synonyms,
|
|
156
|
+
boosts: input.boosts,
|
|
157
|
+
});
|
|
158
|
+
const byGroup = new Map();
|
|
159
|
+
for (const hit of hits) {
|
|
160
|
+
const entry = spot.entries[hit.index];
|
|
161
|
+
const rows = (_a = byGroup.get(entry.groupId)) !== null && _a !== void 0 ? _a : [];
|
|
162
|
+
rows.push(decorate(entry.result, hit));
|
|
163
|
+
byGroup.set(entry.groupId, rows);
|
|
164
|
+
}
|
|
165
|
+
const groups = spot.groups.map((g) => {
|
|
166
|
+
var _a;
|
|
167
|
+
return ({
|
|
168
|
+
...g,
|
|
169
|
+
items: (_a = byGroup.get(g.id)) !== null && _a !== void 0 ? _a : [],
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
for (const group of (_b = input.extraResults) !== null && _b !== void 0 ? _b : []) {
|
|
173
|
+
groups.push({
|
|
174
|
+
id: group.id,
|
|
175
|
+
label: group.label,
|
|
176
|
+
scope: (_c = group.scope) !== null && _c !== void 0 ? _c : group.id,
|
|
177
|
+
isSection: false,
|
|
178
|
+
items: searchGroup(group, input.query, input.synonyms),
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
const remote = new Set((_d = input.extraResults) === null || _d === void 0 ? void 0 : _d.filter((g) => !g.matchLocally).map((g) => g.id));
|
|
182
|
+
const floor = RELATIVE_CUTOFF *
|
|
183
|
+
Math.max(0, ...groups.flatMap((g) => g.items.map((i) => { var _a; return (_a = i.score) !== null && _a !== void 0 ? _a : 0; })));
|
|
184
|
+
return groups
|
|
185
|
+
.map((g) => remote.has(g.id)
|
|
186
|
+
? g
|
|
187
|
+
: { ...g, items: g.items.filter((i) => { var _a; return ((_a = i.score) !== null && _a !== void 0 ? _a : 0) >= floor; }) })
|
|
188
|
+
.filter((g) => g.items.length > 0);
|
|
189
|
+
}
|
|
190
|
+
export function matchAnswers(answers, query, synonyms) {
|
|
191
|
+
if (!(answers === null || answers === void 0 ? void 0 : answers.length))
|
|
192
|
+
return [];
|
|
193
|
+
return searchGroup({ id: "answer", label: "", items: answers, matchLocally: true }, query, synonyms);
|
|
194
|
+
}
|