@astryxdesign/core 0.7.17 → 0.7.18-canary.g6dfc0b6
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/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +7 -0
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +5 -3
- package/dist/AppShell/observeMainOverflow.d.ts +5 -0
- package/dist/AppShell/observeMainOverflow.d.ts.map +1 -1
- package/dist/AppShell/observeMainOverflow.js +39 -9
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +8 -0
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +3 -16
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +5 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +2 -2
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +7 -2
- package/dist/DateInput/DateInput.d.ts +0 -3
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +3 -5
- package/dist/DateInput/NativeDateField.d.ts.map +1 -1
- package/dist/DateInput/NativeDateField.js +3 -5
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +2 -4
- package/dist/DateInput/useTypedDate.d.ts.map +1 -1
- package/dist/DateInput/useTypedDate.js +9 -6
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +13 -9
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +3 -15
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +2 -14
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +7 -1
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +7 -0
- package/dist/Field/Field.d.ts.map +1 -1
- package/dist/Field/Field.js +2 -1
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +9 -2
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +23 -0
- package/dist/Field/inputStyles.stylex.d.ts +22 -6
- package/dist/Field/inputStyles.stylex.d.ts.map +1 -1
- package/dist/Field/inputStyles.stylex.js +32 -0
- package/dist/FieldStatus/FieldStatus.d.ts.map +1 -1
- package/dist/FieldStatus/FieldStatus.js +7 -2
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +4 -4
- package/dist/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/InputGroup/InputGroup.js +6 -16
- package/dist/InputGroup/InputGroupText.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupText.js +2 -8
- package/dist/Kbd/Kbd.d.ts +3 -2
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +3 -2
- package/dist/Layer/gestureCounter.d.ts +5 -0
- package/dist/Layer/gestureCounter.d.ts.map +1 -1
- package/dist/Layer/gestureCounter.js +40 -4
- package/dist/Layer/layerHost.d.ts +3 -2
- package/dist/Layer/layerHost.d.ts.map +1 -1
- package/dist/Layer/layerHost.js +3 -2
- package/dist/Layer/outsidePanClaim.d.ts +17 -0
- package/dist/Layer/outsidePanClaim.d.ts.map +1 -1
- package/dist/Layer/outsidePanClaim.js +36 -8
- package/dist/Layer/outsidePress.d.ts +7 -1
- package/dist/Layer/outsidePress.d.ts.map +1 -1
- package/dist/Layer/outsidePress.js +9 -2
- package/dist/Layer/useLayer.d.ts +21 -5
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +63 -40
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +7 -0
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +22 -16
- package/dist/NavIcon/NavIcon.d.ts +2 -2
- package/dist/NavIcon/NavIcon.d.ts.map +1 -1
- package/dist/NavIcon/NavIcon.js +2 -2
- package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.js +4 -3
- package/dist/NumberInput/NumberInput.d.ts +13 -5
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +6 -17
- package/dist/NumberInput/numberParser.d.ts +9 -2
- package/dist/NumberInput/numberParser.d.ts.map +1 -1
- package/dist/NumberInput/numberParser.js +15 -2
- package/dist/Overlay/OverlayScrim.d.ts.map +1 -1
- package/dist/Overlay/OverlayScrim.js +13 -4
- package/dist/Overlay/useOverlay.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts +3 -2
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +9 -2
- package/dist/Popover/usePopover.d.ts +37 -6
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +103 -20
- package/dist/PowerSearch/PowerSearch.d.ts +4 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +3 -4
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +1 -2
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.js +3 -12
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +0 -12
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +1 -51
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +6 -8
- package/dist/PowerSearch/formatTokenValue.d.ts +5 -10
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatTokenValue.js +21 -38
- package/dist/PowerSearch/relativeDateOptions.d.ts +30 -0
- package/dist/PowerSearch/relativeDateOptions.d.ts.map +1 -0
- package/dist/PowerSearch/relativeDateOptions.js +74 -0
- package/dist/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +7 -7
- package/dist/Resizable/createResizable.d.ts.map +1 -1
- package/dist/Resizable/createResizable.js +38 -4
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +5 -3
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +6 -2
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +2 -1
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +4 -1
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +2 -0
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +2 -0
- package/dist/Table/Table.d.ts +9 -4
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +9 -4
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +3 -7
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +18 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +34 -24
- package/dist/Table/types.d.ts +5 -5
- package/dist/Text/TruncationTooltip.d.ts +1 -35
- package/dist/Text/TruncationTooltip.d.ts.map +1 -1
- package/dist/Text/TruncationTooltip.js +0 -115
- package/dist/Text/cutText.d.ts +22 -0
- package/dist/Text/cutText.d.ts.map +1 -0
- package/dist/Text/cutText.js +92 -0
- package/dist/Text/cutTextOnKeyboardFocus.d.ts +41 -0
- package/dist/Text/cutTextOnKeyboardFocus.d.ts.map +1 -0
- package/dist/Text/cutTextOnKeyboardFocus.js +101 -0
- package/dist/TextInput/TextInput.d.ts +6 -6
- package/dist/Thumbnail/Thumbnail.js +4 -1
- package/dist/TimeInput/TimeInput.d.ts +0 -3
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +3 -5
- package/dist/TimeInput/TouchTimeField.d.ts.map +1 -1
- package/dist/TimeInput/TouchTimeField.js +3 -5
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +22 -16
- package/dist/Timestamp/TimestampHoverCard.d.ts +6 -3
- package/dist/Timestamp/TimestampHoverCard.d.ts.map +1 -1
- package/dist/Timestamp/TimestampHoverCard.js +30 -19
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +3 -3
- package/dist/Timestamp/tooltipEntries.d.ts.map +1 -1
- package/dist/Timestamp/tooltipEntries.js +4 -2
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +62 -31
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +35 -13
- package/dist/Toast/useToast.d.ts.map +1 -1
- package/dist/Toast/useToast.js +35 -14
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +3 -3
- package/dist/astryx.css +33 -6
- package/dist/hooks/useAnnounceRenderedText.d.ts +10 -3
- package/dist/hooks/useAnnounceRenderedText.d.ts.map +1 -1
- package/dist/hooks/useAnnounceRenderedText.js +11 -3
- package/dist/hooks/useFocusTrap.d.ts +12 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +13 -6
- package/dist/hooks/useHotkeys.d.ts +9 -1
- package/dist/hooks/useHotkeys.d.ts.map +1 -1
- package/dist/hooks/useHotkeys.js +52 -2
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +2 -1
- package/dist/hooks/useKeyboardHint.d.ts.map +1 -1
- package/dist/hooks/useKeyboardHint.js +4 -3
- package/dist/i18n/generated-english/DateRangeInput/DateRangeInput.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateRangeInput/DateRangeInput.generated.js +2 -0
- package/dist/i18n/generated-english/MultiSelector/MultiSelector.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/MultiSelector/MultiSelector.generated.js +1 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.js +0 -6
- package/dist/i18n/generated-english/PowerSearch/relativeDateOptions.generated.d.ts +8 -0
- package/dist/i18n/generated-english/PowerSearch/relativeDateOptions.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/PowerSearch/relativeDateOptions.generated.js +17 -0
- package/dist/i18n/generated-english/Slider/Slider.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Slider/Slider.generated.js +1 -0
- package/dist/i18n/generated-english/Thumbnail/Thumbnail.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Thumbnail/Thumbnail.generated.js +1 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +5 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +5 -0
- package/dist/i18n/getLocaleDirection.d.ts +0 -16
- package/dist/i18n/getLocaleDirection.d.ts.map +1 -1
- package/dist/i18n/getLocaleDirection.js +16 -6
- package/dist/i18n/listFormat.d.ts +22 -0
- package/dist/i18n/listFormat.d.ts.map +1 -0
- package/dist/i18n/listFormat.js +29 -0
- package/dist/i18n/useListFormatter.d.ts +1 -3
- package/dist/i18n/useListFormatter.d.ts.map +1 -1
- package/dist/i18n/useListFormatter.js +5 -12
- package/dist/internal/module-loader.d.ts +15 -0
- package/dist/internal/module-loader.d.ts.map +1 -0
- package/dist/internal/module-loader.js +15 -0
- package/dist/motion/animatedLayout.d.ts +6 -0
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +201 -27
- package/dist/palette/color.d.ts +16 -0
- package/dist/palette/color.d.ts.map +1 -1
- package/dist/palette/color.js +37 -1
- package/dist/palette/derive-look.d.ts +235 -0
- package/dist/palette/derive-look.d.ts.map +1 -0
- package/dist/palette/derive-look.js +879 -0
- package/dist/palette/editor-look.d.ts +41 -0
- package/dist/palette/editor-look.d.ts.map +1 -0
- package/dist/palette/editor-look.js +401 -0
- package/dist/palette/mapping.d.ts +99 -6
- package/dist/palette/mapping.d.ts.map +1 -1
- package/dist/palette/mapping.js +68 -11
- package/dist/theme/tokens.d.ts +1 -1
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +1 -1
- package/dist/utils/devWarning.d.ts +18 -0
- package/dist/utils/devWarning.d.ts.map +1 -1
- package/dist/utils/devWarning.js +30 -0
- package/dist/utils/focusReturn.d.ts +2 -0
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +3 -8
- package/dist/utils/hitArea.d.ts +4 -1
- package/dist/utils/hitArea.d.ts.map +1 -1
- package/dist/utils/hitArea.js +72 -9
- package/dist/utils/textDirection.d.ts +15 -5
- package/dist/utils/textDirection.d.ts.map +1 -1
- package/dist/utils/textDirection.js +33 -4
- package/dist/utils/touchHitArea.d.ts.map +1 -1
- package/dist/utils/touchHitArea.js +4 -2
- package/dist/virtualization/useInlineListWindow.d.ts.map +1 -1
- package/dist/virtualization/useInlineListWindow.js +63 -4
- package/locales/en.json +26 -6
- package/locales/pseudo.json +15 -0
- package/package.json +10 -5
- package/src/AlertDialog/AlertDialog.tsx +15 -0
- package/src/AlertDialog/useImperativeAlertDialog.doc.mjs +7 -4
- package/src/AppShell/AppShell.tsx +6 -3
- package/src/AppShell/observeMainOverflow.ts +39 -9
- package/src/Badge/Badge.doc.mjs +3 -3
- package/src/BottomSheet/BottomSheet.tsx +15 -0
- package/src/Button/Button.tsx +3 -23
- package/src/Card/Card.doc.mjs +3 -3
- package/src/Card/Card.tsx +11 -6
- package/src/Chat/ChatSendButton.doc.mjs +6 -6
- package/src/Chat/ChatToolCalls.doc.mjs +1 -1
- package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -3
- package/src/Citation/Citation.tsx +8 -2
- package/src/ClickableCard/ClickableCard.tsx +9 -2
- package/src/ComplexSelector/ComplexSelector.doc.mjs +3 -3
- package/src/ContextMenu/ContextMenuItem.doc.mjs +3 -3
- package/src/DateInput/DateInput.tsx +2 -4
- package/src/DateInput/NativeDateField.tsx +5 -4
- package/src/DateInput/TouchDateField.tsx +2 -3
- package/src/DateInput/useTypedDate.ts +13 -6
- package/src/DateRangeInput/DateRangeInput.tsx +14 -10
- package/src/DateTimeInput/DateTimeInput.tsx +2 -12
- package/src/DateTimeInput/TouchDateTimeField.tsx +2 -11
- package/src/Dialog/Dialog.tsx +15 -1
- package/src/Dialog/useImperativeDialog.doc.mjs +7 -4
- package/src/Drawer/Drawer.tsx +15 -0
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -1
- package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +3 -3
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +3 -3
- package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +3 -3
- package/src/DropdownMenu/DropdownMenuSubMenu.doc.mjs +2 -2
- package/src/Field/Field.doc.mjs +1 -1
- package/src/Field/Field.tsx +2 -1
- package/src/Field/FieldLabel.doc.mjs +3 -3
- package/src/Field/FieldLabel.tsx +11 -3
- package/src/Field/InputClearButton.tsx +27 -0
- package/src/Field/inputStyles.stylex.ts +53 -6
- package/src/FieldStatus/FieldStatus.tsx +7 -2
- package/src/FileInput/FileInput.tsx +12 -2
- package/src/Icon/Icon.doc.mjs +7 -7
- package/src/Icon/useIcon.doc.mjs +6 -6
- package/src/IconButton/IconButton.doc.mjs +2 -2
- package/src/InfoTip/InfoTip.doc.mjs +1 -1
- package/src/InputGroup/InputGroup.tsx +5 -12
- package/src/InputGroup/InputGroupText.tsx +2 -3
- package/src/Kbd/Kbd.doc.mjs +5 -5
- package/src/Kbd/Kbd.tsx +3 -2
- package/src/Layer/gestureCounter.ts +39 -3
- package/src/Layer/layerHost.ts +3 -2
- package/src/Layer/outsidePanClaim.ts +50 -8
- package/src/Layer/outsidePress.ts +18 -4
- package/src/Layer/useLayer.tsx +128 -76
- package/src/Lightbox/Lightbox.tsx +15 -0
- package/src/MoreMenu/MoreMenu.doc.mjs +1 -1
- package/src/MultiSelector/MultiSelector.doc.mjs +2 -2
- package/src/MultiSelector/MultiSelector.tsx +24 -14
- package/src/NavIcon/NavIcon.doc.mjs +19 -10
- package/src/NavIcon/NavIcon.tsx +3 -2
- package/src/NavMenu/NavHeadingMenuItem.tsx +9 -3
- package/src/NumberInput/NumberInput.doc.mjs +12 -12
- package/src/NumberInput/NumberInput.tsx +12 -15
- package/src/NumberInput/numberParser.ts +15 -2
- package/src/Overlay/Overlay.doc.mjs +13 -1
- package/src/Overlay/OverlayScrim.tsx +45 -15
- package/src/Overlay/useOverlay.doc.mjs +7 -7
- package/src/Overlay/useOverlay.tsx +1 -1
- package/src/Pagination/Pagination.doc.mjs +9 -6
- package/src/Pagination/Pagination.tsx +15 -3
- package/src/Popover/usePopover.doc.mjs +14 -4
- package/src/Popover/usePopover.tsx +180 -23
- package/src/PowerSearch/PowerSearch.doc.mjs +165 -15
- package/src/PowerSearch/PowerSearch.tsx +6 -8
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +13 -46
- package/src/PowerSearch/PowerSearchValueEditor.tsx +1 -51
- package/src/PowerSearch/formatFilterValue.ts +8 -9
- package/src/PowerSearch/formatTokenValue.ts +24 -42
- package/src/PowerSearch/relativeDateOptions.ts +84 -0
- package/src/ProgressBar/ProgressBar.tsx +10 -9
- package/src/Resizable/createResizable.ts +46 -5
- package/src/SegmentedControl/SegmentedControlItem.tsx +4 -3
- package/src/SelectableCard/SelectableCard.tsx +8 -2
- package/src/Selector/Selector.doc.mjs +3 -3
- package/src/Selector/Selector.tsx +3 -1
- package/src/Selector/SelectorOption.doc.mjs +3 -3
- package/src/SideNav/SideNavItem.doc.mjs +6 -6
- package/src/Slider/Slider.tsx +4 -1
- package/src/Switch/Switch.doc.mjs +3 -3
- package/src/TabList/Tab.tsx +4 -0
- package/src/TabList/TabMenu.tsx +4 -0
- package/src/Table/Table.doc.mjs +56 -6
- package/src/Table/Table.tsx +9 -4
- package/src/Table/TableHeaderCell.tsx +2 -8
- package/src/Table/plugins/sortable/useTableSortable.tsx +41 -2
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +49 -20
- package/src/Table/types.ts +5 -5
- package/src/Text/TruncationTooltip.tsx +1 -168
- package/src/Text/cutText.tsx +126 -0
- package/src/Text/cutTextOnKeyboardFocus.tsx +148 -0
- package/src/TextArea/TextArea.doc.mjs +4 -4
- package/src/TextInput/TextInput.doc.mjs +3 -3
- package/src/Thumbnail/Thumbnail.tsx +1 -1
- package/src/TimeInput/TimeInput.tsx +3 -9
- package/src/TimeInput/TouchTimeField.tsx +6 -4
- package/src/Timestamp/Timestamp.tsx +29 -21
- package/src/Timestamp/TimestampHoverCard.tsx +44 -31
- package/src/Timestamp/formatInstant.ts +7 -3
- package/src/Timestamp/tooltipEntries.ts +4 -2
- package/src/Toast/Toast.tsx +77 -29
- package/src/Toast/ToastViewport.tsx +33 -13
- package/src/Toast/useToast.tsx +42 -15
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tooltip/useTooltip.tsx +2 -1
- package/src/TopNav/TopNavMegaMenu.doc.mjs +13 -0
- package/src/TopNav/TopNavMenu.doc.mjs +2 -0
- package/src/Typeahead/Typeahead.doc.mjs +2 -2
- package/src/hooks/useAnnounceRenderedText.ts +15 -2
- package/src/hooks/useFocusTrap.ts +27 -4
- package/src/hooks/useHotkeys.doc.mjs +54 -11
- package/src/hooks/useHotkeys.ts +72 -3
- package/src/hooks/useInputStatusIcon.tsx +2 -1
- package/src/hooks/useKeyboardHint.tsx +3 -2
- package/src/i18n/generated-english/DateRangeInput/DateRangeInput.generated.ts +2 -0
- package/src/i18n/generated-english/MultiSelector/MultiSelector.generated.ts +1 -0
- package/src/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.ts +0 -6
- package/src/i18n/generated-english/PowerSearch/relativeDateOptions.generated.ts +18 -0
- package/src/i18n/generated-english/Slider/Slider.generated.ts +1 -0
- package/src/i18n/generated-english/Thumbnail/Thumbnail.generated.ts +1 -0
- package/src/i18n/generated-locales/en.generated.ts +5 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +5 -0
- package/src/i18n/getLocaleDirection.ts +57 -7
- package/src/i18n/listFormat.ts +33 -0
- package/src/i18n/useListFormatter.ts +5 -12
- package/src/internal/module-loader.ts +15 -0
- package/src/motion/animatedLayout.ts +215 -28
- package/src/palette/color.ts +41 -1
- package/src/palette/derive-look.ts +1186 -0
- package/src/palette/editor-look.ts +480 -0
- package/src/palette/mapping.ts +129 -15
- package/src/theme/SyntaxTheme.doc.mjs +1 -1
- package/src/theme/tokens.ts +2 -1
- package/src/theme/useThemeName.doc.mjs +1 -1
- package/src/utils/devWarning.ts +35 -0
- package/src/utils/focusReturn.ts +3 -11
- package/src/utils/hitArea.ts +87 -18
- package/src/utils/textDirection.ts +33 -5
- package/src/utils/touchHitArea.ts +3 -2
- package/src/virtualization/useInlineListWindow.ts +102 -11
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file numberParser.ts
|
|
3
3
|
* @input Text a person typed or pasted, plus the resolved BCP 47 locale
|
|
4
|
-
* @output Exports parseLocaleNumber and
|
|
5
|
-
* @position Internal
|
|
4
|
+
* @output Exports parseLocaleNumber, formatEditableNumber and formatPercent
|
|
5
|
+
* @position Internal number reading and writing for NumberInput, and the
|
|
6
|
+
* percentage ProgressBar writes; not part of the public surface
|
|
6
7
|
*
|
|
7
8
|
* People paste numbers out of spreadsheets, and a spreadsheet writes them
|
|
8
9
|
* grouped, signed, and decorated. This reads those back. Everything locale
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
* - /packages/core/src/NumberInput/NumberInput.tsx
|
|
35
36
|
* - /packages/core/src/NumberInput/numberParser.test.ts
|
|
36
37
|
* - /packages/core/src/NumberInput/numberParser.docblock.test.ts
|
|
38
|
+
* - /packages/core/src/ProgressBar/ProgressBar.tsx
|
|
37
39
|
*/
|
|
38
40
|
import type { Locale } from '../i18n/index.js';
|
|
39
41
|
/**
|
|
@@ -64,4 +66,9 @@ export declare function parseLocaleNumber(text: string, locale?: Locale): number
|
|
|
64
66
|
* parser reads back on blur.
|
|
65
67
|
*/
|
|
66
68
|
export declare function formatEditableNumber(value: number, locale?: Locale): string;
|
|
69
|
+
/**
|
|
70
|
+
* A whole percentage (0 to 100) as the locale writes it: `45%` in English,
|
|
71
|
+
* `%45` in Turkish, `45 %` in German.
|
|
72
|
+
*/
|
|
73
|
+
export declare function formatPercent(percent: number, locale: Locale): string;
|
|
67
74
|
//# sourceMappingURL=numberParser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numberParser.d.ts","sourceRoot":"","sources":["../../src/NumberInput/numberParser.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"numberParser.d.ts","sourceRoot":"","sources":["../../src/NumberInput/numberParser.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,SAAS,CAAC;AAwMpC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CA8Ef;AAaD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAI3E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAKrE"}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file numberParser.ts
|
|
5
5
|
* @input Text a person typed or pasted, plus the resolved BCP 47 locale
|
|
6
|
-
* @output Exports parseLocaleNumber and
|
|
7
|
-
* @position Internal
|
|
6
|
+
* @output Exports parseLocaleNumber, formatEditableNumber and formatPercent
|
|
7
|
+
* @position Internal number reading and writing for NumberInput, and the
|
|
8
|
+
* percentage ProgressBar writes; not part of the public surface
|
|
8
9
|
*
|
|
9
10
|
* People paste numbers out of spreadsheets, and a spreadsheet writes them
|
|
10
11
|
* grouped, signed, and decorated. This reads those back. Everything locale
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
* - /packages/core/src/NumberInput/NumberInput.tsx
|
|
37
38
|
* - /packages/core/src/NumberInput/numberParser.test.ts
|
|
38
39
|
* - /packages/core/src/NumberInput/numberParser.docblock.test.ts
|
|
40
|
+
* - /packages/core/src/ProgressBar/ProgressBar.tsx
|
|
39
41
|
*/
|
|
40
42
|
|
|
41
43
|
import { INVISIBLE_CHARS, toAsciiDigits } from "../utils/unicodeDigits.js";
|
|
@@ -310,4 +312,15 @@ export function formatEditableNumber(value, locale) {
|
|
|
310
312
|
} = getLocaleNumberSymbols(locale);
|
|
311
313
|
const raw = String(value);
|
|
312
314
|
return decimal === '.' ? raw : raw.replace('.', decimal);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* A whole percentage (0 to 100) as the locale writes it: `45%` in English,
|
|
319
|
+
* `%45` in Turkish, `45 %` in German.
|
|
320
|
+
*/
|
|
321
|
+
export function formatPercent(percent, locale) {
|
|
322
|
+
return new Intl.NumberFormat(locale, {
|
|
323
|
+
style: 'percent',
|
|
324
|
+
maximumFractionDigits: 0
|
|
325
|
+
}).format(percent / 100);
|
|
313
326
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayScrim.d.ts","sourceRoot":"","sources":["../../src/Overlay/OverlayScrim.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAiBrC,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AACxD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AACxD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AACtD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,gBAAgB,CAAC;AAE5E,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,gBAAgB,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,SAAS,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"OverlayScrim.d.ts","sourceRoot":"","sources":["../../src/Overlay/OverlayScrim.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAiBrC,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AACxD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AACxD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AACtD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,gBAAgB,CAAC;AAE5E,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,gBAAgB,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,SAAS,CAAC;CACrB;AA+OD,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,GACT,EAAE,iBAAiB,+BAmCnB"}
|
|
@@ -28,6 +28,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
28
28
|
// Styles
|
|
29
29
|
// =============================================================================
|
|
30
30
|
|
|
31
|
+
const FADE = durationVars['--duration-fast'];
|
|
32
|
+
// On hide, the clip path applies when the fade ends. On a hover reveal, it
|
|
33
|
+
// lifts one frame after the fade starts. The first paint and the first click
|
|
34
|
+
// then happen on the same frame, at any fade length.
|
|
35
|
+
const CLIP_DELAY_ON_HIDE = '0s, 0s, 0s, ' + FADE;
|
|
36
|
+
const CLIP_DELAY_ON_HOVER = '0s, 0s, 0s, 1ms';
|
|
31
37
|
const styles = {
|
|
32
38
|
base: {
|
|
33
39
|
kVAEAm: "x10l6tqk",
|
|
@@ -36,8 +42,9 @@ const styles = {
|
|
|
36
42
|
kOIVth: "x1txdalj",
|
|
37
43
|
kmVPX3: "x1b2ylru",
|
|
38
44
|
kfzvcC: "x47corl",
|
|
39
|
-
k1ekBW: "
|
|
40
|
-
kIyJzY: "
|
|
45
|
+
k1ekBW: "xt95kvu",
|
|
46
|
+
kIyJzY: "x1sfilga x12w9bfk",
|
|
47
|
+
kzIqYQ: "xd00j3c",
|
|
41
48
|
kAMwcw: "xlr8y92",
|
|
42
49
|
$$css: true
|
|
43
50
|
},
|
|
@@ -110,8 +117,9 @@ const styles = {
|
|
|
110
117
|
$$css: true
|
|
111
118
|
},
|
|
112
119
|
hoverReveal: {
|
|
120
|
+
kz4h6p: "x1hyvwdk xzjyyds xsc2oq",
|
|
121
|
+
kIr0Dl: "x3nr48a xvof21y xq2dzve xn7oa7n xhj7x8a",
|
|
113
122
|
kSiTet: "xg01cxk xcwhr9z x1v2claj",
|
|
114
|
-
k33iCy: "xlshs6z xneequu x7v6acp",
|
|
115
123
|
kfzvcC: "x47corl x8ydxbz x3730vf",
|
|
116
124
|
$$css: true
|
|
117
125
|
},
|
|
@@ -124,8 +132,9 @@ const styles = {
|
|
|
124
132
|
$$css: true
|
|
125
133
|
},
|
|
126
134
|
focusReveal: {
|
|
135
|
+
kz4h6p: "x1hyvwdk xsc2oq",
|
|
136
|
+
kIr0Dl: "x3nr48a xn7oa7n xhj7x8a",
|
|
127
137
|
kSiTet: "xg01cxk x1v2claj",
|
|
128
|
-
k33iCy: "xlshs6z x7v6acp",
|
|
129
138
|
kfzvcC: "x47corl x3730vf",
|
|
130
139
|
$$css: true
|
|
131
140
|
},
|
|
@@ -19,7 +19,7 @@ export interface UseOverlayOptions {
|
|
|
19
19
|
/**
|
|
20
20
|
* CSS-driven visibility trigger.
|
|
21
21
|
* - `"always"` — always visible
|
|
22
|
-
* - `"hover"` — hover + focus (accessible default). Touch:
|
|
22
|
+
* - `"hover"` — hover + focus (accessible default). Touch (`hover: none`): a tap on the container toggles it.
|
|
23
23
|
* - `"focus"` — focus-within only
|
|
24
24
|
* - `"hover-or-focus"` — alias for "hover"
|
|
25
25
|
* @default "always"
|
|
@@ -42,12 +42,13 @@ export interface PaginationProps extends Omit<BaseProps<HTMLElement>, 'onChange'
|
|
|
42
42
|
*/
|
|
43
43
|
as?: LinkComponentType;
|
|
44
44
|
/**
|
|
45
|
-
* Total number of items. Used to calculate page count
|
|
46
|
-
*
|
|
45
|
+
* Total number of items. Used to calculate the page count when totalPages
|
|
46
|
+
* is not given.
|
|
47
47
|
*/
|
|
48
48
|
totalItems?: number;
|
|
49
49
|
/**
|
|
50
50
|
* Total number of pages. Use when you know page count but not item count.
|
|
51
|
+
* Takes precedence over totalItems if both are given.
|
|
51
52
|
*/
|
|
52
53
|
totalPages?: number;
|
|
53
54
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/Pagination/Pagination.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/Pagination/Pagination.tsx"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAGrD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAC;AAalD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,oBAAoB,CAAC;AAE3D,uCAAuC;AACvC,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzC,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,SAAS,CAAC,WAAW,CAAC,EACtB,UAAU,CACX;IACC,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE7B,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC1D;;;OA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e,EACf,gBAAgB,EAChB,OAAiB,EACjB,SAAS,EACT,YAAY,EAAE,gBAAgB,EAC9B,IAAI,EAAE,QAAY,EAClB,YAAgB,EAChB,IAAW,EACX,UAAkB,EAClB,KAAK,EAAE,cAAc,EACrB,aAAa,EAAE,MAAM,EACrB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,eAAe,sCAojBjB;yBA9kBe,UAAU"}
|
|
@@ -29,8 +29,10 @@ import { Text } from "../Text/index.js";
|
|
|
29
29
|
import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
30
30
|
import { useListFocus } from "../hooks/useListFocus.js";
|
|
31
31
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
32
|
+
import { touchHitAreaStyles } from "../internal/touchHitArea.stylex.js";
|
|
32
33
|
import { focusForLastInput } from "../utils/focusReturn.js";
|
|
33
34
|
import { useFocusAcrossSwap } from "../utils/useFocusAcrossSwap.js";
|
|
35
|
+
import { useTouchHitArea } from "../utils/touchHitArea.js";
|
|
34
36
|
import { useInteractionModalityTracking } from "../utils/interactionModality.js";
|
|
35
37
|
import { mergeProps, rtlStyles } from "../utils/index.js";
|
|
36
38
|
import { themeProps } from "../utils/themeProps.js";
|
|
@@ -74,6 +76,7 @@ const styles = {
|
|
|
74
76
|
$$css: true
|
|
75
77
|
},
|
|
76
78
|
dot: {
|
|
79
|
+
kVAEAm: "x1n2onr6",
|
|
77
80
|
kzqmXN: "x1f0dxl5",
|
|
78
81
|
kZKoxP: "xoqw5ej",
|
|
79
82
|
kMzoRj: "xc342km",
|
|
@@ -83,7 +86,7 @@ const styles = {
|
|
|
83
86
|
kWkggS: "x17x4s8c",
|
|
84
87
|
kkrTdU: "x1ypdohk x16khyan",
|
|
85
88
|
k1ekBW: "x15406qy",
|
|
86
|
-
kIyJzY: "xuedmi6",
|
|
89
|
+
kIyJzY: "xuedmi6 x12w9bfk",
|
|
87
90
|
kAMwcw: "xlr8y92",
|
|
88
91
|
$$css: true
|
|
89
92
|
},
|
|
@@ -327,6 +330,9 @@ export function Pagination({
|
|
|
327
330
|
ref: modalityRef
|
|
328
331
|
} = useInteractionModalityTracking();
|
|
329
332
|
const dotsRef = useMergedRefs(dotsListRef, modalityRef);
|
|
333
|
+
// Under a coarse pointer each dot's target grows toward 44 px, clamped to
|
|
334
|
+
// half the gap to its neighbours. One ref watches every dot.
|
|
335
|
+
const dotHitAreaRef = useTouchHitArea(variant === 'dots' && !isDisabled);
|
|
330
336
|
const computedTotalPages = totalPagesProp ?? (totalItems != null ? Math.ceil(totalItems / pageSize) : undefined);
|
|
331
337
|
const hasPrevious = optimisticPage > 1;
|
|
332
338
|
const hasNext = computedTotalPages != null ? optimisticPage < computedTotalPages : hasMore ?? false;
|
|
@@ -549,6 +555,7 @@ export function Pagination({
|
|
|
549
555
|
}, (_, i) => {
|
|
550
556
|
const isActive = i + 1 === optimisticPage;
|
|
551
557
|
return /*#__PURE__*/_jsx("button", {
|
|
558
|
+
ref: dotHitAreaRef,
|
|
552
559
|
type: "button",
|
|
553
560
|
role: "radio",
|
|
554
561
|
"data-page": i + 1,
|
|
@@ -578,7 +585,7 @@ export function Pagination({
|
|
|
578
585
|
...mergeProps(themeProps('pagination-dot', {
|
|
579
586
|
active: isActive ? 'active' : null,
|
|
580
587
|
size
|
|
581
|
-
}), focusOutlineProps.focusVisible(styles.dot, isSm && styles.dotSm, isActive && styles.dotActive, isDisabled && styles.dotDisabled))
|
|
588
|
+
}), focusOutlineProps.focusVisible(styles.dot, !isDisabled && touchHitAreaStyles.layer, isSm && styles.dotSm, isActive && styles.dotActive, isDisabled && styles.dotDisabled))
|
|
582
589
|
}, i + 1);
|
|
583
590
|
})
|
|
584
591
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file usePopover.tsx
|
|
3
|
-
* @input Uses useLayer, useFocusTrap, React hooks, and Layer's
|
|
3
|
+
* @input Uses useLayer, useFocusTrap, useAnnounce, React hooks, and Layer's
|
|
4
|
+
* outside watches (outsidePanClaim)
|
|
4
5
|
* @output Exports the public usePopover hook with derived focus, guarded opening
|
|
5
6
|
* and an optional anchor apart from the trigger.
|
|
6
7
|
* For Popover.tsx (internal), exports usePopoverInternal and
|
|
@@ -80,7 +81,9 @@ export interface UsePopoverOptions {
|
|
|
80
81
|
* on, the native popover uses `popover="auto"`, whose browser-level light
|
|
81
82
|
* dismiss also closes on Escape, so Escape handling stays registered to
|
|
82
83
|
* keep topmost-only dismissal intact. Set both to `false` for
|
|
83
|
-
* explicit-dismiss-only surfaces like onboarding coachmarks.
|
|
84
|
+
* explicit-dismiss-only surfaces like onboarding coachmarks. A popover
|
|
85
|
+
* with `tabBehavior: 'pageOrder'` is not an auto popover, so `false` turns
|
|
86
|
+
* its Escape off whatever `hasLightDismiss` says.
|
|
84
87
|
*
|
|
85
88
|
* @default true
|
|
86
89
|
*/
|
|
@@ -123,12 +126,36 @@ export interface UsePopoverOptions {
|
|
|
123
126
|
role?: 'dialog' | 'none';
|
|
124
127
|
/**
|
|
125
128
|
* Whether the dialog is modal (`aria-modal`). Only applies when `role` is
|
|
126
|
-
* `'dialog'`. Set to `false` for
|
|
127
|
-
*
|
|
129
|
+
* `'dialog'`. Set to `false` for a dialog that leaves the rest of the page
|
|
130
|
+
* usable. Tab stays inside the popover either way: `tabBehavior` decides
|
|
131
|
+
* that. A popover with `tabBehavior: 'pageOrder'` is never modal.
|
|
128
132
|
*
|
|
129
133
|
* @default true
|
|
130
134
|
*/
|
|
131
135
|
isModal?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Where Tab and Shift+Tab go while the popover is open.
|
|
138
|
+
*
|
|
139
|
+
* - `'contain'`: they cycle inside the popover.
|
|
140
|
+
* - `'pageOrder'`: the popover holds nothing. Tab moves in the page's
|
|
141
|
+
* order. Where the browser supports popover invokers, the popover takes
|
|
142
|
+
* its place after its trigger, or after an anchor that can take focus
|
|
143
|
+
* when there is no trigger. When another layer opened from the same
|
|
144
|
+
* trigger or anchor closes (a menu, a hover card), the popover leaves
|
|
145
|
+
* the Tab order until it opens again. Escape closes it only while focus
|
|
146
|
+
* is inside
|
|
147
|
+
* it, or on or inside its anchor or trigger, and it never carries
|
|
148
|
+
* `aria-modal`.
|
|
149
|
+
* Use it for a coachmark or a tour step, whose reader must reach the
|
|
150
|
+
* control it describes.
|
|
151
|
+
*
|
|
152
|
+
* A Tab pressed outside the popover is never pulled into it. Set
|
|
153
|
+
* `tabBehavior` before the popover opens: a change while it is open is not
|
|
154
|
+
* supported.
|
|
155
|
+
*
|
|
156
|
+
* @default 'contain'
|
|
157
|
+
*/
|
|
158
|
+
tabBehavior?: 'contain' | 'pageOrder';
|
|
132
159
|
/**
|
|
133
160
|
* Whether to apply the default popover surface (background, border-radius,
|
|
134
161
|
* box-shadow) to the content wrapper.
|
|
@@ -271,7 +298,7 @@ export interface InternalPopoverOptions extends UsePopoverOptions {
|
|
|
271
298
|
/**
|
|
272
299
|
* The owner decides what a touch outside that pans does to the popover.
|
|
273
300
|
* Otherwise a light-dismiss popover keeps such a pan from dismissing it
|
|
274
|
-
* (useLayer's `
|
|
301
|
+
* (useLayer's `watchesOutside`).
|
|
275
302
|
*/
|
|
276
303
|
ownsOutsidePan?: boolean;
|
|
277
304
|
/**
|
|
@@ -282,7 +309,11 @@ export interface InternalPopoverOptions extends UsePopoverOptions {
|
|
|
282
309
|
/** Called after a scroll stop places the popover afresh (`useLayerInternal`'s `onPlacedAfresh`). */
|
|
283
310
|
onPlacedAfresh?: () => void;
|
|
284
311
|
}
|
|
285
|
-
export declare function usePopover(options?: UsePopoverOptions
|
|
312
|
+
export declare function usePopover<TabBehavior extends UsePopoverOptions['tabBehavior'] = UsePopoverOptions['tabBehavior']>(options?: UsePopoverOptions & {
|
|
313
|
+
tabBehavior?: TabBehavior;
|
|
314
|
+
/** A popover that Tab passes through is never modal. */
|
|
315
|
+
isModal?: [TabBehavior] extends ['pageOrder'] ? false : boolean;
|
|
316
|
+
}): UsePopoverReturn;
|
|
286
317
|
/**
|
|
287
318
|
* @internal For Popover; not exported from the package barrel.
|
|
288
319
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePopover.d.ts","sourceRoot":"","sources":["../../src/Popover/usePopover.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"usePopover.d.ts","sourceRoot":"","sources":["../../src/Popover/usePopover.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAmB,KAAK,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAY5E,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAoBnD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAchD;;;GAGG;AACH,eAAO,MAAM,uBAAuB,yCAAyC,CAAC;AAoG9E;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAE5C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAE5B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,cAAc,CAAC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
+
* @input Uses useLayer, useFocusTrap, useAnnounce, React hooks, and Layer's
|
|
8
|
+
* outside watches (outsidePanClaim)
|
|
8
9
|
* @output Exports the public usePopover hook with derived focus, guarded opening
|
|
9
10
|
* and an optional anchor apart from the trigger.
|
|
10
11
|
* For Popover.tsx (internal), exports usePopoverInternal and
|
|
@@ -20,13 +21,16 @@
|
|
|
20
21
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
21
22
|
import * as stylex from '@stylexjs/stylex';
|
|
22
23
|
import { useLayerInternal } from "../Layer/useLayer.js";
|
|
23
|
-
import { watchOutsidePans } from "../Layer/outsidePanClaim.js";
|
|
24
|
+
import { watchOutsidePans, watchOutsidePresses } from "../Layer/outsidePanClaim.js";
|
|
25
|
+
import { currentInputTarget } from "../Layer/gestureCounter.js";
|
|
24
26
|
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
25
27
|
import { resolvePopoverAnchor } from "./popoverAnchor.js";
|
|
28
|
+
import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
29
|
+
import { containsAlongFlatTree, deepActiveElement } from "../utils/flatTree.js";
|
|
26
30
|
import { useFocusTrapInternal } from "../hooks/useFocusTrap.js";
|
|
27
31
|
import { useCommittedRef, useCommittedRefInto } from "../hooks/useCommittedRef.js";
|
|
28
|
-
import { isHTMLElement } from "../utils/nodeType.js";
|
|
29
|
-
import { takesFocusAsIs } from "../utils/focusReturn.js";
|
|
32
|
+
import { isElement, isHTMLElement } from "../utils/nodeType.js";
|
|
33
|
+
import { focusableWithin, takesFocusAsIs } from "../utils/focusReturn.js";
|
|
30
34
|
import { LayerDepthProvider } from "../Layer/LayerDepthContext.js";
|
|
31
35
|
import "../theme/tokens.stylex.js";
|
|
32
36
|
import { colorVars, spacingVars, radiusVars, shadowVars } from "../theme/tokens.stylex.js";
|
|
@@ -45,6 +49,9 @@ import english from "../i18n/generated-english/Popover/usePopover.generated.js";
|
|
|
45
49
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
46
50
|
registerEnglishFallback(english);
|
|
47
51
|
|
|
52
|
+
// Bundlers replace this value at build time. The declaration lets a product
|
|
53
|
+
// without Node's types type-check this file.
|
|
54
|
+
|
|
48
55
|
/**
|
|
49
56
|
* The fallback close button's wrapper (anchored layer) or button (sheet,
|
|
50
57
|
* Popover.tsx); initial focus skips it.
|
|
@@ -176,13 +183,19 @@ function usePopoverImplementation(options = {}) {
|
|
|
176
183
|
closeButtonLabel: closeButtonLabelFromProps,
|
|
177
184
|
dialogLabel,
|
|
178
185
|
role = 'dialog',
|
|
179
|
-
isModal
|
|
186
|
+
isModal: isModalOption,
|
|
187
|
+
tabBehavior = 'contain',
|
|
180
188
|
getRestoreFallback,
|
|
181
189
|
restoreFocusTo,
|
|
182
190
|
getOpener,
|
|
183
191
|
ownsOutsidePan = false,
|
|
184
192
|
onOpenPendingChange
|
|
185
193
|
} = options;
|
|
194
|
+
|
|
195
|
+
// A popover that Tab passes through is never modal.
|
|
196
|
+
const passesTab = tabBehavior === 'pageOrder';
|
|
197
|
+
const isModal = !passesTab && (isModalOption ?? true);
|
|
198
|
+
useDevWarning('usePopover', process.env.NODE_ENV === 'production' ? '' : "`isModal: true` is ignored with `tabBehavior: 'pageOrder'`.", passesTab && isModalOption === true);
|
|
186
199
|
const t = useComponentTranslator();
|
|
187
200
|
const closeButtonLabel = closeButtonLabelFromProps ?? t('@astryx.popover.close');
|
|
188
201
|
|
|
@@ -214,14 +227,26 @@ function usePopoverImplementation(options = {}) {
|
|
|
214
227
|
focusOnShow?.();
|
|
215
228
|
}, [onShow]);
|
|
216
229
|
|
|
217
|
-
// Core layer for popover positioning
|
|
218
230
|
// Filled in once the content ref exists; runs when the surface hides because
|
|
219
231
|
// its anchor is missing.
|
|
220
232
|
const anchorMissingRef = useRef(null);
|
|
221
|
-
//
|
|
222
|
-
|
|
233
|
+
// Read at press time: with light dismiss off, no press closes the popover.
|
|
234
|
+
const hasLightDismissRef = useCommittedRef(hasLightDismiss);
|
|
235
|
+
// Closes a `'pageOrder'` popover for a press outside it.
|
|
236
|
+
const watchPresses = useCallback((layerElement, dismiss) => watchOutsidePresses(layerElement, triggerElementRef, hasLightDismissRef, dismiss), [hasLightDismissRef]);
|
|
237
|
+
// A `'pageOrder'` popover takes Escape only while it holds focus: inside
|
|
238
|
+
// it, or on the anchor or trigger it belongs to. Read at press time.
|
|
239
|
+
const isFocusInScope = useCallback(surface => {
|
|
240
|
+
// The focused element may be inside a shadow root, or the surface may
|
|
241
|
+
// be in one and its trigger outside.
|
|
242
|
+
const active = deepActiveElement(surface?.ownerDocument ?? document);
|
|
243
|
+
return active != null && [surface, boundAnchorRef.current, triggerElementRef.current].some(scope => scope != null && containsAlongFlatTree(scope, active));
|
|
244
|
+
}, []);
|
|
245
|
+
|
|
246
|
+
// Focus returns as the popover starts to close, while it still holds focus.
|
|
247
|
+
// The browser restores focus only for an auto popover whose opener is still
|
|
223
248
|
// there, and then with a focus ring whatever the last input was. The trap
|
|
224
|
-
// below supplies the return
|
|
249
|
+
// below supplies the return. It is read through a ref because the layer
|
|
225
250
|
// exists first.
|
|
226
251
|
const returnFocusRef = useRef(() => {});
|
|
227
252
|
const onCloseStartRef = useCommittedRef(onCloseStart);
|
|
@@ -229,22 +254,40 @@ function usePopoverImplementation(options = {}) {
|
|
|
229
254
|
returnFocusRef.current();
|
|
230
255
|
onCloseStartRef.current?.();
|
|
231
256
|
}, [onCloseStartRef]);
|
|
257
|
+
// A `'pageOrder'` popover follows its trigger in the focus order. With no
|
|
258
|
+
// trigger it follows an anchor that takes focus. Otherwise it keeps its DOM
|
|
259
|
+
// place. A trigger that wraps its control passes the control: browsers
|
|
260
|
+
// place the popover before a control inside the invoker.
|
|
261
|
+
const getInvoker = useCallback(() => {
|
|
262
|
+
const trigger = triggerElementRef.current;
|
|
263
|
+
if (trigger != null) {
|
|
264
|
+
return focusableWithin(trigger) ?? trigger;
|
|
265
|
+
}
|
|
266
|
+
const anchor = boundAnchorRef.current;
|
|
267
|
+
return isHTMLElement(anchor) && anchor.tabIndex >= 0 ? anchor : null;
|
|
268
|
+
}, []);
|
|
269
|
+
const announcesOpenRef = useRef(false);
|
|
232
270
|
const layer = useLayerInternal({
|
|
233
271
|
mode: 'context',
|
|
234
|
-
|
|
272
|
+
// A `'pageOrder'` popover takes Escape only within its scope, and the
|
|
273
|
+
// browser's auto light dismiss closes on any Escape. So it is a manual
|
|
274
|
+
// popover, and a watch closes it for a press outside.
|
|
275
|
+
lightDismiss: hasLightDismiss && !passesTab,
|
|
235
276
|
onShow: handleLayerShow,
|
|
236
277
|
onHide,
|
|
237
278
|
onCloseStart: handleCloseStart,
|
|
238
|
-
|
|
279
|
+
watchesOutside: passesTab ? watchPresses : hasLightDismiss && !ownsOutsidePan ? watchOutsidePans : undefined,
|
|
239
280
|
writesEntranceSide,
|
|
240
281
|
onPlacedAfresh,
|
|
241
282
|
onOpenPendingChange,
|
|
242
|
-
waitsForAnchor: anchorRef != null
|
|
283
|
+
waitsForAnchor: anchorRef != null,
|
|
284
|
+
getInvoker: passesTab ? getInvoker : undefined
|
|
243
285
|
});
|
|
244
286
|
|
|
245
|
-
// Focus trap for the popover content.
|
|
246
|
-
// dismiss is on
|
|
247
|
-
// host Dialog
|
|
287
|
+
// Focus trap for the popover content. A `'contain'` popover keeps Escape
|
|
288
|
+
// registered while light dismiss is on, because native popover="auto"
|
|
289
|
+
// closes on Escape regardless. A host Dialog then defers to this trap and
|
|
290
|
+
// does not dismiss too.
|
|
248
291
|
// The element focused when `show` ran: initial focus may move inside before
|
|
249
292
|
// the trap activates, so the trap restores focus here instead.
|
|
250
293
|
const openerRef = useRef(null);
|
|
@@ -258,13 +301,15 @@ function usePopoverImplementation(options = {}) {
|
|
|
258
301
|
moveFocusOut
|
|
259
302
|
} = useFocusTrapInternal({
|
|
260
303
|
isActive: layer.isOpen,
|
|
261
|
-
onEscape: hasEscapeDismiss || hasLightDismiss ? layer.hide : undefined,
|
|
304
|
+
onEscape: hasEscapeDismiss || hasLightDismiss && !passesTab ? layer.hide : undefined,
|
|
262
305
|
getRestoreTarget,
|
|
263
306
|
getRestoreFallback,
|
|
264
307
|
restoreFocusTo,
|
|
265
308
|
getTrigger: () => triggerElementRef.current,
|
|
266
309
|
getAnchor: () => boundAnchorRef.current ?? null,
|
|
267
|
-
layerId: layer.id
|
|
310
|
+
layerId: layer.id,
|
|
311
|
+
isContaining: !passesTab,
|
|
312
|
+
isEscapeInScope: passesTab ? isFocusInScope : undefined
|
|
268
313
|
});
|
|
269
314
|
useCommittedRefInto(returnFocusRef, returnFocus);
|
|
270
315
|
const focusInitialTarget = useCallback(() => {
|
|
@@ -289,6 +334,37 @@ function usePopoverImplementation(options = {}) {
|
|
|
289
334
|
focusFirst();
|
|
290
335
|
}, [contentRef, focusFirst, role]);
|
|
291
336
|
|
|
337
|
+
// A dialog popover that opens from code and takes no focus announces
|
|
338
|
+
// its name, so a screen reader user learns it appeared. It reads focus
|
|
339
|
+
// after initial focus has had its frame.
|
|
340
|
+
const isOpenForAnnouncement = layer.isOpen;
|
|
341
|
+
// Both are read when the announcement is made. The announcer changes
|
|
342
|
+
// identity with the modal that holds this popover, and a caller may rename
|
|
343
|
+
// the popover. Neither restarts the wait.
|
|
344
|
+
const announceRef = useCommittedRef(useAnnounce());
|
|
345
|
+
const dialogLabelRef = useCommittedRef(dialogLabel);
|
|
346
|
+
const roleRef = useCommittedRef(role);
|
|
347
|
+
useEffect(() => {
|
|
348
|
+
if (!isOpenForAnnouncement || !announcesOpenRef.current) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
announcesOpenRef.current = false;
|
|
352
|
+
const container = contentRef.current;
|
|
353
|
+
const view = container?.ownerDocument.defaultView ?? window;
|
|
354
|
+
// Initial focus for content that mounts on open lands in the next frame,
|
|
355
|
+
// so focus is read one frame after that.
|
|
356
|
+
let frame = view.requestAnimationFrame(() => {
|
|
357
|
+
frame = view.requestAnimationFrame(() => {
|
|
358
|
+
const active = deepActiveElement(container?.ownerDocument);
|
|
359
|
+
const name = dialogLabelRef.current;
|
|
360
|
+
if (name != null && container != null && (active == null || !containsAlongFlatTree(container, active))) {
|
|
361
|
+
announceRef.current(name, 'polite');
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
return () => view.cancelAnimationFrame(frame);
|
|
366
|
+
}, [isOpenForAnnouncement, contentRef, dialogLabelRef, announceRef]);
|
|
367
|
+
|
|
292
368
|
// Auto-focus first element when popover opens (unless skipped)
|
|
293
369
|
useEffect(() => {
|
|
294
370
|
// Reset the per-open focus preference after the popover closes.
|
|
@@ -411,10 +487,17 @@ function usePopoverImplementation(options = {}) {
|
|
|
411
487
|
// that renders on open (and the dialog-surface fallback) waits for the
|
|
412
488
|
// effect's frame.
|
|
413
489
|
focusOnShowRef.current = focusWithinEvent;
|
|
490
|
+
const trigger = triggerElementRef.current;
|
|
491
|
+
// An open is the person's while a press, key or click on the trigger
|
|
492
|
+
// is being handled, or while the pointer is on the trigger. Any other
|
|
493
|
+
// open is from code.
|
|
494
|
+
const inputTarget = currentInputTarget();
|
|
495
|
+
const isFromTrigger = trigger != null && (isElement(inputTarget) && containsAlongFlatTree(trigger, inputTarget) || trigger.matches(':hover'));
|
|
496
|
+
announcesOpenRef.current = roleRef.current === 'dialog' && dialogLabelRef.current != null && !isFromTrigger;
|
|
414
497
|
// The first frame is anchored: the anchor is read as the popover opens.
|
|
415
498
|
bindAnchor();
|
|
416
499
|
layer.show();
|
|
417
|
-
}, [layer, hasAutoFocus, contentRef, bindAnchor]);
|
|
500
|
+
}, [layer, hasAutoFocus, contentRef, bindAnchor, roleRef, dialogLabelRef]);
|
|
418
501
|
|
|
419
502
|
// Toggle function. Opening delegates to show so every route inherits the
|
|
420
503
|
// same-gesture reopen guard owned by Layer.
|
|
@@ -485,8 +568,8 @@ function usePopoverImplementation(options = {}) {
|
|
|
485
568
|
triggerProps
|
|
486
569
|
};
|
|
487
570
|
}
|
|
488
|
-
export function usePopover(options
|
|
489
|
-
return usePopoverImplementation(options);
|
|
571
|
+
export function usePopover(options) {
|
|
572
|
+
return usePopoverImplementation(options ?? {});
|
|
490
573
|
}
|
|
491
574
|
|
|
492
575
|
/**
|
|
@@ -71,7 +71,10 @@ export interface PowerSearchProps extends Omit<BaseProps<HTMLElement>, 'onChange
|
|
|
71
71
|
* @default 'attached'
|
|
72
72
|
*/
|
|
73
73
|
statusVariant?: FieldStatusPlacement;
|
|
74
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Width in pixels of the main field/search menu. It never shrinks below the
|
|
76
|
+
* input width. It does not affect the field value editors.
|
|
77
|
+
*/
|
|
75
78
|
menuWidth?: number;
|
|
76
79
|
/** Max display length for filter token values. @default 40 */
|
|
77
80
|
maxTokenLength?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PowerSearch.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAUZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEtC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAY1C,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"PowerSearch.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAUZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C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AuB,GAAG,oBAAoB,CAAC;AAoC3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EAAE,UAAU,EAClB,OAAO,EACP,QAAQ,EACR,KAAK,EAAE,cAAc,EACrB,aAAoB,EACpB,WAAW,EAAE,oBAAoB,EACjC,YAAoB,EACpB,QAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,SAAS,EACT,OAAO,EACP,MAAM,EACN,MAAM,EACN,aAA0B,EAC1B,SAAS,EACT,cAAmB,EACnB,oBAAoB,EACpB,gBAA6C,EAC7C,sBAAsB,EAAE,+BAA+B,EACvD,UAAU,EACV,qBAAqB,EACrB,UAAU,EACV,WAAW,EACX,GAAG,EACH,SAAS,EACT,IAAI,EAAE,QAAQ,EACd,aAAa,EAAE,MAAM,EACrB,MAAM,EACN,SAAS,EACT,KAAK,EACL,UAAU,EAAE,kBAAkB,EAC9B,YAAyB,EACzB,GAAG,IAAI,EACR,EAAE,gBAAgB,qBAymClB;yBA7oCe,WAAW"}
|
|
@@ -46,7 +46,7 @@ import { useInternalConfig } from "./useInternalConfig.js";
|
|
|
46
46
|
import { usePowerSearchSource } from "./usePowerSearchSource.js";
|
|
47
47
|
import { formatFilterValue } from "./formatFilterValue.js";
|
|
48
48
|
import { NestedEditor, PowerSearchEditPopover } from "./PowerSearchEditPopover.js";
|
|
49
|
-
import {
|
|
49
|
+
import { PowerSearchValueEditor } from "./PowerSearchValueEditor.js";
|
|
50
50
|
import { resolveOperatorLabel } from "./resolveOperatorLabel.js";
|
|
51
51
|
import { pickDataAttributes, themeProps } from "../utils/themeProps.js";
|
|
52
52
|
import { useLocale } from "../i18n/useLocale.js";
|
|
@@ -150,8 +150,7 @@ const LazyPowerSearchBottomSheet = /*#__PURE__*/lazy(async () => loadPowerSearch
|
|
|
150
150
|
// module already loads; see PowerSearchSheetEditors.
|
|
151
151
|
const SHEET_EDITORS = {
|
|
152
152
|
NestedEditor,
|
|
153
|
-
PowerSearchValueEditor
|
|
154
|
-
buildRelativeDateOptions
|
|
153
|
+
PowerSearchValueEditor
|
|
155
154
|
};
|
|
156
155
|
|
|
157
156
|
/**
|
|
@@ -416,7 +415,7 @@ export function PowerSearch({
|
|
|
416
415
|
const fieldLabel = field?.label ?? filter.field;
|
|
417
416
|
const operatorLabel = operator ? resolveOperatorLabel(operator, t) : '';
|
|
418
417
|
const label = formatTokenLabel(t, fieldLabel, operatorLabel);
|
|
419
|
-
const value = operator ? formatTokenValueText(operator.value, filter.value, Math.max(maxTokenLength - fieldLabel.length - operatorLabel.length, 10), locale, calendar,
|
|
418
|
+
const value = operator ? formatTokenValueText(operator.value, filter.value, Math.max(maxTokenLength - fieldLabel.length - operatorLabel.length, 10), locale, calendar, t, timezoneID) : null;
|
|
420
419
|
return {
|
|
421
420
|
label,
|
|
422
421
|
value,
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
*/
|
|
38
38
|
import React, { type RefObject } from 'react';
|
|
39
39
|
import type { SearchSource } from '../Typeahead/types.js';
|
|
40
|
-
import type {
|
|
40
|
+
import type { PowerSearchValueEditor } from './PowerSearchValueEditor.js';
|
|
41
41
|
import type { NestedEditor } from './PowerSearchEditPopover.js';
|
|
42
42
|
import type { InternalConfig } from './useInternalConfig.js';
|
|
43
43
|
import type { PowerSearchChangeType, PowerSearchComponents, PowerSearchConfig, PowerSearchFilter, PowerSearchItem } from './types.js';
|
|
@@ -51,7 +51,6 @@ import type { PowerSearchChangeType, PowerSearchComponents, PowerSearchConfig, P
|
|
|
51
51
|
export interface PowerSearchSheetEditors {
|
|
52
52
|
NestedEditor: typeof NestedEditor;
|
|
53
53
|
PowerSearchValueEditor: typeof PowerSearchValueEditor;
|
|
54
|
-
buildRelativeDateOptions: typeof buildRelativeDateOptions;
|
|
55
54
|
}
|
|
56
55
|
export interface PowerSearchBottomSheetProps {
|
|
57
56
|
/** Whether the flow is open; the trigger in PowerSearch.tsx owns it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PowerSearchBottomSheet.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearchBottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,EASZ,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAmBf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"PowerSearchBottomSheet.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearchBottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,EASZ,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAmBf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAoBrD,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAErE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAe3D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAIV,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EAEjB,iBAAiB,EACjB,eAAe,EAEhB,MAAM,SAAS,CAAC;AAajB;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,sBAAsB,EAAE,OAAO,sBAAsB,CAAC;CACvD;AAED,MAAM,WAAW,2BAA2B;IAC1C,wEAAwE;IACxE,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC;;;OAGG;IACH,aAAa,EAAE,SAAS,CAAC,WAAW,G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