@astryxdesign/core 0.1.4-canary.fd7ab46 → 0.1.4
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 +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +18 -20
- package/dist/AlertDialog/useImperativeAlertDialog.js +3 -3
- package/dist/AppShell/AppShell.d.ts +1 -1
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +53 -55
- package/dist/AspectRatio/AspectRatio.d.ts +10 -48
- package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
- package/dist/AspectRatio/AspectRatio.js +12 -33
- package/dist/AspectRatio/index.d.ts +1 -1
- package/dist/AspectRatio/index.d.ts.map +1 -1
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +25 -27
- package/dist/Avatar/AvatarStatusDot.js +5 -5
- package/dist/AvatarGroup/AvatarGroup.js +5 -5
- package/dist/AvatarGroup/AvatarGroupOverflow.js +5 -5
- package/dist/Badge/Badge.js +3 -3
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +25 -32
- package/dist/Blockquote/Blockquote.js +7 -7
- package/dist/Breadcrumbs/BreadcrumbItem.js +17 -17
- package/dist/Breadcrumbs/Breadcrumbs.js +7 -7
- package/dist/Button/Button.js +19 -19
- package/dist/ButtonGroup/ButtonGroup.js +7 -7
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +48 -68
- package/dist/Calendar/dayCellUtils.d.ts.map +1 -1
- package/dist/Calendar/styles.d.ts +2 -2
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +2 -2
- package/dist/Card/Card.d.ts +2 -4
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +10 -18
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +21 -24
- package/dist/Carousel/carousel.markers.stylex.d.ts +7 -0
- package/dist/Carousel/carousel.markers.stylex.d.ts.map +1 -0
- package/dist/Carousel/carousel.markers.stylex.js +12 -0
- package/dist/Center/Center.js +3 -3
- package/dist/Chat/ChatComposer.js +23 -23
- package/dist/Chat/ChatComposerDrawer.js +14 -14
- package/dist/Chat/ChatComposerInput.d.ts +1 -1
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +15 -27
- package/dist/Chat/ChatDictationButton.d.ts +1 -1
- package/dist/Chat/ChatDictationButton.d.ts.map +1 -1
- package/dist/Chat/ChatDictationButton.js +11 -13
- package/dist/Chat/ChatLayout.js +17 -17
- package/dist/Chat/ChatLayoutScrollButton.d.ts +1 -1
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +10 -12
- package/dist/Chat/ChatMessage.js +12 -12
- package/dist/Chat/ChatMessageBubble.js +7 -7
- package/dist/Chat/ChatMessageList.js +14 -14
- package/dist/Chat/ChatMessageMetadata.d.ts +1 -1
- package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
- package/dist/Chat/ChatMessageMetadata.js +12 -14
- package/dist/Chat/ChatPastedTextToken.js +13 -13
- package/dist/Chat/ChatSendButton.js +3 -3
- package/dist/Chat/ChatSystemMessage.d.ts +1 -1
- package/dist/Chat/ChatSystemMessage.d.ts.map +1 -1
- package/dist/Chat/ChatSystemMessage.js +17 -17
- package/dist/Chat/ChatTokenizedText.d.ts +1 -1
- package/dist/Chat/ChatTokenizedText.d.ts.map +1 -1
- package/dist/Chat/ChatTokenizedText.js +15 -24
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +74 -81
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +15 -15
- package/dist/CheckboxInput/CheckboxInput.d.ts +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +23 -25
- package/dist/CheckboxList/CheckboxList.js +9 -9
- package/dist/CheckboxList/CheckboxListItem.d.ts +1 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +6 -8
- package/dist/Citation/Citation.js +10 -10
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +9 -32
- package/dist/Code/Code.js +3 -3
- package/dist/CodeBlock/CodeBlock.d.ts +1 -10
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +52 -88
- package/dist/Collapsible/Collapsible.d.ts +3 -9
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +22 -110
- package/dist/Collapsible/CollapsibleGroup.d.ts +7 -39
- package/dist/Collapsible/CollapsibleGroup.d.ts.map +1 -1
- package/dist/Collapsible/CollapsibleGroup.js +12 -73
- package/dist/Collapsible/CollapsibleGroupContext.d.ts +0 -31
- package/dist/Collapsible/CollapsibleGroupContext.d.ts.map +1 -1
- package/dist/Collapsible/CollapsibleGroupContext.js +3 -33
- package/dist/Collapsible/index.d.ts +0 -1
- package/dist/Collapsible/index.d.ts.map +1 -1
- package/dist/Collapsible/useCollapsible.d.ts +1 -4
- package/dist/Collapsible/useCollapsible.d.ts.map +1 -1
- package/dist/Collapsible/useCollapsible.js +6 -20
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +34 -36
- package/dist/CommandPalette/CommandPaletteEmpty.js +3 -3
- package/dist/CommandPalette/CommandPaletteFooter.js +16 -16
- package/dist/CommandPalette/CommandPaletteGroup.js +5 -5
- package/dist/CommandPalette/CommandPaletteInput.js +13 -13
- package/dist/CommandPalette/CommandPaletteItem.js +3 -3
- package/dist/CommandPalette/CommandPaletteList.js +3 -3
- package/dist/ContextMenu/ContextMenu.d.ts +2 -7
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +43 -76
- package/dist/DateInput/DateInput.js +18 -18
- package/dist/DateRangeInput/DateRangeInput.js +21 -21
- package/dist/DateTimeInput/DateTimeInput.d.ts +2 -5
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +26 -30
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +9 -9
- package/dist/Dialog/DialogHeader.js +16 -16
- package/dist/Dialog/useImperativeDialog.js +3 -3
- package/dist/Divider/Divider.js +7 -7
- package/dist/DropdownMenu/DropdownMenu.js +10 -10
- package/dist/DropdownMenu/DropdownMenuItem.d.ts +17 -2
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +3 -3
- package/dist/DropdownMenu/renderDropdownItems.js +10 -10
- package/dist/EmptyState/EmptyState.js +9 -9
- package/dist/Field/Field.js +17 -17
- package/dist/Field/FieldLabel.js +15 -15
- package/dist/Field/InputClearButton.js +5 -5
- package/dist/FieldStatus/FieldStatus.js +3 -3
- package/dist/FileInput/FileInput.js +29 -29
- package/dist/FormLayout/FormLayout.js +5 -5
- package/dist/Grid/Grid.d.ts +3 -4
- package/dist/Grid/Grid.d.ts.map +1 -1
- package/dist/Grid/Grid.js +12 -29
- package/dist/Grid/GridSpan.js +3 -3
- package/dist/HStack/HStack.js +3 -3
- package/dist/Heading/Heading.js +10 -10
- package/dist/HoverCard/HoverCard.js +9 -9
- package/dist/HoverCard/useHoverCard.d.ts +1 -5
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +3 -3
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +12 -16
- package/dist/Icon/defaultIcons.js +116 -116
- package/dist/IconButton/IconButton.js +3 -3
- package/dist/InputGroup/InputGroup.js +11 -11
- package/dist/InputGroup/InputGroupText.js +3 -3
- package/dist/Item/Item.js +18 -18
- package/dist/Kbd/Kbd.js +5 -5
- package/dist/Layer/LayerProvider.js +7 -7
- package/dist/Layer/useLayer.d.ts +2 -29
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +31 -44
- package/dist/Layout/Layout.js +21 -21
- package/dist/Layout/LayoutContent.js +3 -3
- package/dist/Layout/LayoutFooter.js +5 -5
- package/dist/Layout/LayoutHeader.js +5 -5
- package/dist/Layout/LayoutPanel.js +3 -3
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +31 -55
- package/dist/Lightbox/useLightbox.js +3 -3
- package/dist/Link/Link.js +15 -15
- package/dist/Link/LinkProvider.js +3 -3
- package/dist/Link/useLinkify.js +3 -3
- package/dist/List/List.js +11 -11
- package/dist/List/ListItem.js +11 -11
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +102 -102
- package/dist/MetadataList/MetadataList.js +10 -10
- package/dist/MetadataList/MetadataListItem.js +15 -15
- package/dist/MobileNav/MobileNav.js +15 -15
- package/dist/MobileNav/MobileNavToggle.js +5 -5
- package/dist/MoreMenu/MoreMenu.js +3 -3
- package/dist/MultiSelector/MultiSelector.js +56 -56
- package/dist/NavIcon/NavIcon.js +3 -3
- package/dist/NavMenu/NavHeadingMenu.js +5 -5
- package/dist/NavMenu/NavHeadingMenuItem.js +8 -8
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +32 -48
- package/dist/Outline/Outline.js +15 -15
- package/dist/OverflowList/OverflowList.js +8 -8
- package/dist/Overlay/Overlay.js +3 -3
- package/dist/Overlay/OverlayScrim.js +5 -5
- package/dist/Overlay/useOverlay.js +3 -3
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +72 -125
- package/dist/Popover/Popover.js +16 -16
- package/dist/Popover/usePopover.js +7 -7
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +92 -110
- package/dist/PowerSearch/PowerSearchEditPopover.js +84 -84
- package/dist/PowerSearch/PowerSearchFilterEditor.js +3 -3
- package/dist/PowerSearch/PowerSearchToken.js +5 -5
- package/dist/PowerSearch/PowerSearchValueEditor.js +54 -54
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +18 -25
- package/dist/RadioList/RadioList.js +7 -7
- package/dist/RadioList/RadioListItem.d.ts +1 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +21 -24
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +10 -28
- package/dist/Section/Section.js +5 -5
- package/dist/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +10 -32
- package/dist/SegmentedControl/SegmentedControlItem.d.ts +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +12 -18
- package/dist/SelectableCard/SelectableCard.js +5 -5
- package/dist/Selector/Selector.js +46 -46
- package/dist/Selector/SelectorOption.js +3 -3
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +34 -38
- package/dist/SideNav/SideNavCollapseButton.d.ts +1 -1
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +6 -8
- package/dist/SideNav/SideNavHeading.js +87 -87
- package/dist/SideNav/SideNavItem.js +42 -42
- package/dist/SideNav/SideNavSection.d.ts +1 -1
- package/dist/SideNav/SideNavSection.d.ts.map +1 -1
- package/dist/SideNav/SideNavSection.js +16 -18
- package/dist/Skeleton/Skeleton.js +3 -3
- package/dist/Slider/Slider.js +23 -23
- package/dist/Spinner/Spinner.js +9 -9
- package/dist/StatusDot/StatusDot.js +5 -5
- package/dist/Switch/Switch.d.ts +4 -8
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +29 -34
- package/dist/TabList/Tab.js +18 -18
- package/dist/TabList/TabList.js +5 -5
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +30 -57
- package/dist/TabList/tab.markers.stylex.d.ts +1 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +39 -50
- package/dist/Table/Table.js +7 -7
- package/dist/Table/TableBody.d.ts +1 -1
- package/dist/Table/TableBody.d.ts.map +1 -1
- package/dist/Table/TableBody.js +5 -9
- package/dist/Table/TableCell.js +3 -3
- package/dist/Table/TableFooter.d.ts +1 -1
- package/dist/Table/TableFooter.d.ts.map +1 -1
- package/dist/Table/TableFooter.js +5 -9
- package/dist/Table/TableHeader.d.ts +1 -1
- package/dist/Table/TableHeader.d.ts.map +1 -1
- package/dist/Table/TableHeader.js +5 -9
- package/dist/Table/TableHeaderCell.js +3 -3
- package/dist/Table/TableRow.js +5 -5
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +11 -14
- package/dist/Table/plugins/filtering/useTableFiltering.js +71 -71
- package/dist/Table/plugins/pagination/paginateData.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/paginateData.js +1 -5
- package/dist/Table/plugins/pagination/useTablePagination.js +7 -7
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +22 -22
- package/dist/Table/plugins/selection/useTableSelection.js +18 -18
- package/dist/Table/plugins/selection/useTableSelectionState.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelectionState.js +1 -11
- package/dist/Table/plugins/sortable/useTableSortable.js +17 -17
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.js +4 -8
- package/dist/Table/tableContextMenu.js +9 -9
- package/dist/Text/Text.js +10 -10
- package/dist/TextArea/TextArea.js +14 -14
- package/dist/TextInput/TextInput.js +15 -15
- package/dist/Thumbnail/Thumbnail.d.ts +2 -3
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +29 -30
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +21 -26
- package/dist/Timestamp/Timestamp.d.ts +1 -1
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +26 -37
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +17 -25
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +11 -23
- package/dist/Toast/useToast.js +4 -4
- package/dist/ToggleButton/ToggleButton.js +12 -12
- package/dist/ToggleButton/ToggleButtonGroup.js +5 -5
- package/dist/Token/Token.js +21 -21
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +34 -36
- package/dist/Toolbar/Toolbar.js +18 -18
- package/dist/Tooltip/Tooltip.js +11 -11
- package/dist/Tooltip/useTooltip.d.ts +1 -5
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +3 -3
- package/dist/TopNav/TopNav.js +32 -32
- package/dist/TopNav/TopNavHeading.js +67 -67
- package/dist/TopNav/TopNavItem.js +5 -5
- package/dist/TopNav/TopNavMegaMenu.js +30 -30
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.d.ts +1 -1
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.js +14 -25
- package/dist/TopNav/TopNavMegaMenuItem.js +16 -16
- package/dist/TopNav/TopNavMenu.js +32 -32
- package/dist/TreeList/TreeList.js +8 -8
- package/dist/TreeList/TreeListBranches.js +11 -11
- package/dist/TreeList/TreeListItem.js +30 -30
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +20 -23
- package/dist/Typeahead/Typeahead.js +12 -12
- package/dist/Typeahead/TypeaheadItem.js +10 -10
- package/dist/VStack/VStack.js +3 -3
- package/dist/astryx.css +0 -7
- package/dist/astryx.umd.js +60 -60
- package/dist/astryx.umd.js.map +4 -4
- package/dist/docs-types.d.ts +2 -8
- package/dist/docs-types.d.ts.map +1 -1
- package/dist/hooks/focusableSelector.d.ts +1 -1
- package/dist/hooks/focusableSelector.d.ts.map +1 -1
- package/dist/hooks/focusableSelector.js +1 -1
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/useFocusTrap.d.ts +0 -3
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +1 -38
- package/dist/hooks/useInteractiveRole.d.ts +2 -6
- package/dist/hooks/useInteractiveRole.d.ts.map +1 -1
- package/dist/hooks/useInteractiveRole.js +2 -6
- package/dist/hooks/useKeyboardHint.js +9 -9
- package/dist/hooks/useStreamingText.d.ts +1 -3
- package/dist/hooks/useStreamingText.d.ts.map +1 -1
- package/dist/hooks/useStreamingText.js +5 -14
- package/dist/theme/MediaTheme.js +3 -3
- package/dist/theme/Theme.js +7 -7
- package/dist/theme/defineTheme.d.ts +1 -1
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/expandColorScale.d.ts.map +1 -1
- package/dist/theme/expandColorScale.js +3 -10
- package/dist/theme/hct.d.ts +15 -0
- package/dist/theme/hct.d.ts.map +1 -1
- package/dist/theme/hct.js +9 -9
- package/dist/theme/syntax/SyntaxTheme.js +5 -5
- package/dist/theme/tokens.d.ts +2 -10
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +4 -220
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -3
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +5 -8
- package/package.json +3 -3
- package/src/AlertDialog/AlertDialog.doc.mjs +0 -4
- package/src/AlertDialog/AlertDialog.tsx +0 -2
- package/src/AppShell/AppShell.tsx +0 -2
- package/src/AspectRatio/AspectRatio.doc.mjs +1 -28
- package/src/AspectRatio/AspectRatio.test.tsx +1 -142
- package/src/AspectRatio/AspectRatio.tsx +10 -70
- package/src/AspectRatio/index.ts +1 -5
- package/src/Avatar/Avatar.doc.mjs +0 -11
- package/src/Avatar/Avatar.test.tsx +1 -32
- package/src/Avatar/Avatar.tsx +20 -12
- package/src/Banner/Banner.doc.mjs +0 -8
- package/src/Banner/Banner.test.tsx +0 -38
- package/src/Banner/Banner.tsx +1 -8
- package/src/Calendar/Calendar.doc.mjs +1 -1
- package/src/Calendar/Calendar.test.tsx +17 -122
- package/src/Calendar/Calendar.tsx +5 -26
- package/src/Calendar/dayCellUtils.ts +1 -3
- package/src/Calendar/styles.ts +2 -12
- package/src/Card/Card.tsx +6 -16
- package/src/Carousel/Carousel.doc.mjs +12 -12
- package/src/Carousel/Carousel.test.tsx +0 -13
- package/src/Carousel/Carousel.tsx +2 -4
- package/src/Carousel/carousel.markers.stylex.ts +10 -0
- package/src/Chat/Chat.doc.mjs +1 -1
- package/src/Chat/ChatComposerInput.test.tsx +1 -27
- package/src/Chat/ChatComposerInput.tsx +15 -20
- package/src/Chat/ChatDictationButton.tsx +4 -4
- package/src/Chat/ChatLayoutScrollButton.tsx +1 -3
- package/src/Chat/ChatMessageMetadata.tsx +6 -4
- package/src/Chat/ChatSystemMessage.test.tsx +11 -26
- package/src/Chat/ChatSystemMessage.tsx +7 -7
- package/src/Chat/ChatTokenizedText.test.tsx +16 -29
- package/src/Chat/ChatTokenizedText.tsx +8 -15
- package/src/Chat/ChatToolCalls.test.tsx +0 -55
- package/src/Chat/ChatToolCalls.tsx +12 -10
- package/src/Chat/index.ts +4 -1
- package/src/Chat/useTriggerMenu.tsx +4 -1
- package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -3
- package/src/CheckboxInput/CheckboxInput.test.tsx +4 -71
- package/src/CheckboxInput/CheckboxInput.tsx +0 -2
- package/src/CheckboxList/CheckboxList.test.tsx +0 -19
- package/src/CheckboxList/CheckboxListItem.tsx +2 -11
- package/src/Citation/Citation.doc.mjs +0 -5
- package/src/ClickableCard/ClickableCard.tsx +2 -45
- package/src/CodeBlock/CodeBlock.doc.mjs +2 -7
- package/src/CodeBlock/CodeBlock.test.tsx +3 -122
- package/src/CodeBlock/CodeBlock.tsx +4 -62
- package/src/Collapsible/Collapsible.doc.mjs +4 -8
- package/src/Collapsible/Collapsible.tsx +10 -86
- package/src/Collapsible/CollapsibleGroup.doc.mjs +3 -27
- package/src/Collapsible/CollapsibleGroup.test.tsx +0 -318
- package/src/Collapsible/CollapsibleGroup.tsx +9 -107
- package/src/Collapsible/CollapsibleGroupContext.tsx +2 -42
- package/src/Collapsible/index.ts +0 -4
- package/src/Collapsible/useCollapsible.ts +6 -20
- package/src/CommandPalette/CommandPalette.doc.mjs +0 -4
- package/src/CommandPalette/CommandPalette.tsx +3 -5
- package/src/CommandPalette/CommandPaletteEmpty.doc.mjs +0 -5
- package/src/CommandPalette/CommandPaletteGroup.doc.mjs +0 -10
- package/src/CommandPalette/CommandPaletteInput.doc.mjs +0 -6
- package/src/CommandPalette/CommandPaletteItem.doc.mjs +0 -6
- package/src/CommandPalette/CommandPaletteList.doc.mjs +0 -9
- package/src/ContextMenu/ContextMenu.doc.mjs +0 -15
- package/src/ContextMenu/ContextMenu.test.tsx +0 -87
- package/src/ContextMenu/ContextMenu.tsx +28 -87
- package/src/ContextMenu/ContextMenuItem.doc.mjs +0 -6
- package/src/DateInput/DateInput.test.tsx +20 -11
- package/src/DateRangeInput/DateRangeInput.test.tsx +44 -31
- package/src/DateTimeInput/DateTimeInput.doc.mjs +2 -3
- package/src/DateTimeInput/DateTimeInput.test.tsx +16 -118
- package/src/DateTimeInput/DateTimeInput.tsx +2 -8
- package/src/DateTimeInput/index.ts +0 -1
- package/src/Dialog/Dialog.doc.mjs +0 -4
- package/src/Dialog/DialogHeader.doc.mjs +0 -45
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -1
- package/src/DropdownMenu/DropdownMenu.test.tsx +2 -22
- package/src/DropdownMenu/DropdownMenuItem.tsx +17 -5
- package/src/Field/Field.test.tsx +4 -1
- package/src/Field/FieldLabel.test.tsx +2 -2
- package/src/FormLayout/__snapshots__/FormLayout.test.tsx.snap +3 -0
- package/src/Grid/Grid.test.tsx +18 -43
- package/src/Grid/Grid.tsx +9 -26
- package/src/HoverCard/HoverCard.doc.mjs +6 -6
- package/src/HoverCard/useHoverCard.doc.mjs +5 -5
- package/src/HoverCard/useHoverCard.tsx +2 -9
- package/src/Icon/Icon.test.tsx +29 -41
- package/src/Icon/Icon.tsx +2 -6
- package/src/InputGroup/InputGroup.tsx +2 -2
- package/src/Item/Item.tsx +1 -1
- package/src/Layer/useLayer.doc.mjs +2 -2
- package/src/Layer/useLayer.test.tsx +2 -221
- package/src/Layer/useLayer.tsx +30 -69
- package/src/Layout/LayoutContent.doc.mjs +0 -12
- package/src/Layout/LayoutPanel.doc.mjs +0 -40
- package/src/Lightbox/Lightbox.doc.mjs +0 -5
- package/src/Lightbox/Lightbox.test.tsx +2 -123
- package/src/Lightbox/Lightbox.tsx +1 -29
- package/src/Markdown/Markdown.tsx +7 -9
- package/src/Markdown/parser.perf.test.ts +12 -34
- package/src/NavMenu/NavMenu.doc.mjs +0 -15
- package/src/NumberInput/NumberInput.test.tsx +3 -48
- package/src/NumberInput/NumberInput.tsx +15 -32
- package/src/Overlay/Overlay.doc.mjs +0 -6
- package/src/Pagination/Pagination.test.tsx +0 -162
- package/src/Pagination/Pagination.tsx +26 -80
- package/src/Popover/Popover.doc.mjs +6 -6
- package/src/Popover/Popover.test.tsx +0 -65
- package/src/Popover/usePopover.doc.mjs +1 -1
- package/src/PowerSearch/PowerSearch.doc.mjs +2 -2
- package/src/PowerSearch/PowerSearch.test.tsx +1 -109
- package/src/PowerSearch/PowerSearch.tsx +16 -37
- package/src/ProgressBar/ProgressBar.test.tsx +0 -30
- package/src/ProgressBar/ProgressBar.tsx +5 -12
- package/src/RadioList/RadioList.test.tsx +0 -19
- package/src/RadioList/RadioListItem.tsx +4 -9
- package/src/Resizable/ResizeHandle.tsx +4 -22
- package/src/SegmentedControl/SegmentedControl.doc.mjs +1 -1
- package/src/SegmentedControl/SegmentedControl.test.tsx +0 -192
- package/src/SegmentedControl/SegmentedControl.tsx +5 -27
- package/src/SegmentedControl/SegmentedControlItem.tsx +4 -9
- package/src/SelectableCard/SelectableCard.doc.mjs +1 -1
- package/src/Selector/Selector.test.tsx +1 -27
- package/src/SideNav/SideNav.doc.mjs +1 -7
- package/src/SideNav/SideNav.test.tsx +0 -66
- package/src/SideNav/SideNav.tsx +2 -6
- package/src/SideNav/SideNavCollapseButton.tsx +3 -4
- package/src/SideNav/SideNavSection.tsx +4 -6
- package/src/Switch/Switch.doc.mjs +7 -7
- package/src/Switch/Switch.test.tsx +3 -102
- package/src/Switch/Switch.tsx +7 -20
- package/src/TabList/TabList.test.tsx +1 -185
- package/src/TabList/TabMenu.tsx +9 -45
- package/src/Table/BaseTable.tsx +2 -13
- package/src/Table/Table.test.tsx +0 -87
- package/src/Table/TableBody.tsx +2 -15
- package/src/Table/TableFooter.tsx +2 -15
- package/src/Table/TableHeader.tsx +2 -15
- package/src/Table/plugins/columnResize/useTableColumnResize.test.tsx +0 -13
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +1 -3
- package/src/Table/plugins/pagination/paginateData.ts +1 -5
- package/src/Table/plugins/pagination/useTablePagination.test.tsx +0 -13
- package/src/Table/plugins/selection/useTableSelectionState.test.tsx +0 -23
- package/src/Table/plugins/selection/useTableSelectionState.tsx +6 -11
- package/src/Table/plugins/sortable/useTableSortableState.test.tsx +1 -35
- package/src/Table/plugins/sortable/useTableSortableState.tsx +4 -8
- package/src/TextArea/TextArea.test.tsx +3 -3
- package/src/TextInput/TextInput.test.tsx +3 -3
- package/src/Thumbnail/Thumbnail.test.tsx +2 -36
- package/src/Thumbnail/Thumbnail.tsx +2 -4
- package/src/TimeInput/TimeInput.test.tsx +0 -37
- package/src/TimeInput/TimeInput.tsx +1 -11
- package/src/Timestamp/Timestamp.doc.mjs +1 -1
- package/src/Timestamp/Timestamp.test.tsx +0 -52
- package/src/Timestamp/Timestamp.tsx +16 -30
- package/src/Toast/Toast.tsx +3 -11
- package/src/Toast/ToastViewport.test.tsx +0 -64
- package/src/Toast/ToastViewport.tsx +0 -12
- package/src/ToggleButton/ToggleButton.doc.mjs +0 -1
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tokenizer/Tokenizer.test.tsx +0 -54
- package/src/Tokenizer/Tokenizer.tsx +4 -5
- package/src/Tooltip/Tooltip.doc.mjs +6 -6
- package/src/Tooltip/useTooltip.doc.mjs +5 -5
- package/src/Tooltip/useTooltip.tsx +2 -12
- package/src/TopNav/TopNav.doc.mjs +1 -1
- package/src/TopNav/TopNav.test.tsx +7 -23
- package/src/TopNav/TopNavMegaMenuFeaturedCard.tsx +2 -9
- package/src/TreeList/TreeList.doc.mjs +2 -2
- package/src/Typeahead/BaseTypeahead.doc.mjs +0 -19
- package/src/Typeahead/BaseTypeahead.tsx +2 -5
- package/src/Typeahead/Typeahead.doc.mjs +1 -1
- package/src/Typeahead/Typeahead.test.tsx +1 -45
- package/src/docs-types.ts +1 -9
- package/src/hooks/focusableSelector.ts +1 -1
- package/src/hooks/index.ts +0 -3
- package/src/hooks/useFocusTrap.doc.mjs +2 -4
- package/src/hooks/useFocusTrap.test.tsx +1 -149
- package/src/hooks/useFocusTrap.ts +1 -50
- package/src/hooks/useInteractiveRole.ts +4 -12
- package/src/hooks/useStreamingText.test.ts +19 -54
- package/src/hooks/useStreamingText.ts +5 -16
- package/src/hooks/useTreeFocus.test.tsx +3 -1
- package/src/reset.css +0 -29
- package/src/theme/SyntaxTheme.doc.mjs +4 -4
- package/src/theme/defineTheme.ts +13 -4
- package/src/theme/derivedVarRegistry.test.ts +2 -2
- package/src/theme/expandColorScale.test.ts +0 -29
- package/src/theme/expandColorScale.ts +6 -11
- package/src/theme/hct.ts +17 -9
- package/src/theme/tokens.test.ts +9 -182
- package/src/theme/tokens.ts +4 -239
- package/src/theme/useTheme.test.tsx +0 -20
- package/src/utils/index.ts +0 -4
- package/src/utils/sharedResizeObserver.test.ts +2 -2
- package/src/utils/timeParser.test.ts +0 -13
- package/src/utils/timeParser.ts +5 -8
- package/dist/hooks/useHotkeys.d.ts +0 -51
- package/dist/hooks/useHotkeys.d.ts.map +0 -1
- package/dist/hooks/useHotkeys.js +0 -160
- package/dist/utils/color.d.ts +0 -42
- package/dist/utils/color.d.ts.map +0 -1
- package/dist/utils/color.js +0 -150
- package/dist/utils/composeEventHandlers.d.ts +0 -30
- package/dist/utils/composeEventHandlers.d.ts.map +0 -1
- package/dist/utils/composeEventHandlers.js +0 -40
- package/src/Chat/ChatDictationButton.test.tsx +0 -43
- package/src/Chat/ChatLayoutScrollButton.test.tsx +0 -33
- package/src/Chat/ChatMessageMetadata.test.tsx +0 -32
- package/src/Collapsible/Collapsible.test.tsx +0 -405
- package/src/FieldStatus/FieldStatus.test.tsx +0 -282
- package/src/InteractiveRoleContext/InteractiveRoleContext.test.tsx +0 -185
- package/src/Layout/Layout.test.tsx +0 -285
- package/src/Layout/LayoutSlots.test.tsx +0 -364
- package/src/Outline/parseOutlineFromMarkdown.test.ts +0 -80
- package/src/OverflowList/OverflowList.test.tsx +0 -416
- package/src/Overlay/Overlay.test.tsx +0 -356
- package/src/Resizable/ResizeHandle.test.tsx +0 -218
- package/src/SizeContext/SizeContext.test.tsx +0 -226
- package/src/__tests__/TestIcon.tsx +0 -26
- package/src/__tests__/fastRoleQueries.ts +0 -66
- package/src/docPropReferences.test.ts +0 -178
- package/src/hooks/useHotkeys.doc.mjs +0 -52
- package/src/hooks/useHotkeys.test.ts +0 -245
- package/src/hooks/useHotkeys.ts +0 -203
- package/src/utils/color.test.ts +0 -133
- package/src/utils/color.ts +0 -148
- package/src/utils/composeEventHandlers.test.ts +0 -71
- package/src/utils/composeEventHandlers.ts +0 -44
- package/src/utils/mergeProps.test.ts +0 -166
|
@@ -57,12 +57,6 @@ export const docs = {
|
|
|
57
57
|
description: 'StyleX styles for layout customization. Must be a stylex.create() value.',
|
|
58
58
|
},
|
|
59
59
|
],
|
|
60
|
-
playground: {
|
|
61
|
-
defaults: {
|
|
62
|
-
placeholder: 'Search commands, files, or actions...',
|
|
63
|
-
hasAutoFocus: false,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
60
|
};
|
|
67
61
|
|
|
68
62
|
export const docsZh = {
|
|
@@ -50,12 +50,6 @@ export const docs = {
|
|
|
50
50
|
description: 'StyleX styles for layout customization. Must be a stylex.create() value.',
|
|
51
51
|
},
|
|
52
52
|
],
|
|
53
|
-
playground: {
|
|
54
|
-
defaults: {
|
|
55
|
-
value: 'go-home',
|
|
56
|
-
children: 'Go to Dashboard',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
53
|
};
|
|
60
54
|
|
|
61
55
|
export const docsZh = {
|
|
@@ -27,15 +27,6 @@ export const docs = {
|
|
|
27
27
|
description: 'StyleX styles for layout customization. Must be a stylex.create() value.',
|
|
28
28
|
},
|
|
29
29
|
],
|
|
30
|
-
playground: {
|
|
31
|
-
defaults: {
|
|
32
|
-
children: [
|
|
33
|
-
{__element: 'CommandPaletteItem', props: {value: 'home', onSelect: undefined}, children: 'Go Home'},
|
|
34
|
-
{__element: 'CommandPaletteItem', props: {value: 'settings', onSelect: undefined}, children: 'Open Settings'},
|
|
35
|
-
{__element: 'CommandPaletteItem', props: {value: 'profile', onSelect: undefined}, children: 'View Profile'},
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
30
|
};
|
|
40
31
|
|
|
41
32
|
export const docsZh = {
|
|
@@ -78,21 +78,6 @@ export const docs = {
|
|
|
78
78
|
{ guidance: false, description: 'Place more than 10–12 items in a single menu without grouping them into sections.' },
|
|
79
79
|
],
|
|
80
80
|
},
|
|
81
|
-
playground: {
|
|
82
|
-
defaults: {
|
|
83
|
-
children: {
|
|
84
|
-
__element: 'Card',
|
|
85
|
-
props: {padding: 6},
|
|
86
|
-
children: {__element: 'Text', props: {color: 'secondary'}, children: 'Right-click this area'},
|
|
87
|
-
},
|
|
88
|
-
items: [
|
|
89
|
-
{label: 'Edit'},
|
|
90
|
-
{label: 'Duplicate'},
|
|
91
|
-
{type: 'divider'},
|
|
92
|
-
{label: 'Delete'},
|
|
93
|
-
],
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
81
|
};
|
|
97
82
|
|
|
98
83
|
/** @type {import('../docs-types').TranslationDoc} */
|
|
@@ -172,21 +172,6 @@ describe('ContextMenu', () => {
|
|
|
172
172
|
expect(preventDefault).toHaveBeenCalled();
|
|
173
173
|
});
|
|
174
174
|
|
|
175
|
-
it('prevents default context menu on the opened menu container', () => {
|
|
176
|
-
render(
|
|
177
|
-
<ContextMenu items={[{label: 'Item 1'}]}>
|
|
178
|
-
<div>Right-click me</div>
|
|
179
|
-
</ContextMenu>,
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
fireEvent.contextMenu(screen.getByText('Right-click me'));
|
|
183
|
-
const menu = screen.getByRole('menu', {hidden: true});
|
|
184
|
-
const event = new MouseEvent('contextmenu', {bubbles: true});
|
|
185
|
-
const preventDefault = vi.spyOn(event, 'preventDefault');
|
|
186
|
-
menu.dispatchEvent(event);
|
|
187
|
-
expect(preventDefault).toHaveBeenCalled();
|
|
188
|
-
});
|
|
189
|
-
|
|
190
175
|
it('does not open when isDisabled is true', () => {
|
|
191
176
|
render(
|
|
192
177
|
<ContextMenu items={[{label: 'Item 1'}]} isDisabled>
|
|
@@ -464,76 +449,4 @@ describe('ContextMenu compound mode', () => {
|
|
|
464
449
|
).toBeInTheDocument();
|
|
465
450
|
expect(screen.getByRole('separator', {hidden: true})).toBeInTheDocument();
|
|
466
451
|
});
|
|
467
|
-
|
|
468
|
-
describe('cursor anchor positioning (#3465)', () => {
|
|
469
|
-
// The menu is anchored to a zero-size element placed at the cursor point
|
|
470
|
-
// *inside the trigger*, so it is positioned relative to the trigger's
|
|
471
|
-
// context (scroll-follow + auto-flip) rather than the viewport.
|
|
472
|
-
function getCursorAnchor(trigger: HTMLElement): HTMLElement {
|
|
473
|
-
const anchor = trigger.querySelector<HTMLElement>('[aria-hidden="true"]');
|
|
474
|
-
if (!anchor) {
|
|
475
|
-
throw new Error('cursor anchor not found');
|
|
476
|
-
}
|
|
477
|
-
return anchor;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
it('renders a zero-size cursor anchor inside the trigger', () => {
|
|
481
|
-
render(
|
|
482
|
-
<ContextMenu items={[{label: 'Item 1'}]} data-testid="ctx">
|
|
483
|
-
<div>Right-click me</div>
|
|
484
|
-
</ContextMenu>,
|
|
485
|
-
);
|
|
486
|
-
const anchor = getCursorAnchor(screen.getByTestId('ctx'));
|
|
487
|
-
expect(anchor.tagName).toBe('SPAN');
|
|
488
|
-
// Carries an anchor-name so the menu can be anchored to it via CSS
|
|
489
|
-
// anchor positioning (context mode), not fixed viewport coordinates.
|
|
490
|
-
expect(anchor.style.anchorName).toMatch(/^--astryx-layer-/);
|
|
491
|
-
});
|
|
492
|
-
|
|
493
|
-
it('places the cursor anchor at the pointer position relative to the trigger', () => {
|
|
494
|
-
render(
|
|
495
|
-
<ContextMenu items={[{label: 'Item 1'}]} data-testid="ctx">
|
|
496
|
-
<div>Right-click me</div>
|
|
497
|
-
</ContextMenu>,
|
|
498
|
-
);
|
|
499
|
-
const trigger = screen.getByTestId('ctx');
|
|
500
|
-
trigger.getBoundingClientRect = () =>
|
|
501
|
-
({
|
|
502
|
-
left: 100,
|
|
503
|
-
top: 50,
|
|
504
|
-
right: 300,
|
|
505
|
-
bottom: 150,
|
|
506
|
-
width: 200,
|
|
507
|
-
height: 100,
|
|
508
|
-
}) as DOMRect;
|
|
509
|
-
// Pointer at viewport (170, 90) -> local trigger offset (70, 40).
|
|
510
|
-
fireEvent.contextMenu(trigger, {clientX: 170, clientY: 90, detail: 1});
|
|
511
|
-
const anchor = getCursorAnchor(trigger);
|
|
512
|
-
expect(anchor.style.left).toBe('70px');
|
|
513
|
-
expect(anchor.style.top).toBe('40px');
|
|
514
|
-
});
|
|
515
|
-
|
|
516
|
-
it('anchors a keyboard-invoked menu to the trigger bottom-left', () => {
|
|
517
|
-
render(
|
|
518
|
-
<ContextMenu items={[{label: 'Item 1'}]} data-testid="ctx">
|
|
519
|
-
<div>Right-click me</div>
|
|
520
|
-
</ContextMenu>,
|
|
521
|
-
);
|
|
522
|
-
const trigger = screen.getByTestId('ctx');
|
|
523
|
-
trigger.getBoundingClientRect = () =>
|
|
524
|
-
({
|
|
525
|
-
left: 40,
|
|
526
|
-
top: 10,
|
|
527
|
-
right: 100,
|
|
528
|
-
bottom: 30,
|
|
529
|
-
width: 60,
|
|
530
|
-
height: 20,
|
|
531
|
-
}) as DOMRect;
|
|
532
|
-
// Keyboard-initiated contextmenu: coords (0,0), detail 0 -> local (0, height).
|
|
533
|
-
fireEvent.contextMenu(trigger, {clientX: 0, clientY: 0, detail: 0});
|
|
534
|
-
const anchor = getCursorAnchor(trigger);
|
|
535
|
-
expect(anchor.style.left).toBe('0px');
|
|
536
|
-
expect(anchor.style.top).toBe('20px');
|
|
537
|
-
});
|
|
538
|
-
});
|
|
539
452
|
});
|
|
@@ -3,16 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @file ContextMenu.tsx
|
|
6
|
-
* @input Uses React, StyleX, useLayer (
|
|
6
|
+
* @input Uses React, StyleX, useLayer (fixed mode), useListFocus
|
|
7
7
|
* @output Exports ContextMenu component
|
|
8
8
|
* @position Core implementation; consumed by index.ts
|
|
9
9
|
*
|
|
10
|
-
* Right-click context menu positioned at
|
|
11
|
-
* captured as an offset *inside the trigger* and materialized as a zero-size
|
|
12
|
-
* anchor element, so the menu is positioned relative to the trigger's context
|
|
13
|
-
* (via CSS anchor positioning) rather than the viewport. It therefore follows
|
|
14
|
-
* the content on scroll and auto-flips at viewport edges, while still appearing
|
|
15
|
-
* under the cursor.
|
|
10
|
+
* Right-click context menu positioned at cursor coordinates.
|
|
16
11
|
* Reuses DropdownMenu item rendering and keyboard navigation.
|
|
17
12
|
*
|
|
18
13
|
* Supports two content modes with a single keyboard/focus path:
|
|
@@ -58,7 +53,7 @@ import {
|
|
|
58
53
|
easeVars,
|
|
59
54
|
shadowVars,
|
|
60
55
|
} from '../theme/tokens.stylex';
|
|
61
|
-
import {mergeProps
|
|
56
|
+
import {mergeProps} from '../utils';
|
|
62
57
|
import type {BaseProps} from '../BaseProps';
|
|
63
58
|
import type {StyleXStyles} from '../theme/types';
|
|
64
59
|
import {themeProps} from '../utils/themeProps';
|
|
@@ -72,23 +67,9 @@ import type {
|
|
|
72
67
|
const styles = stylex.create({
|
|
73
68
|
// Trigger wrapper: suppress the iOS long-press callout/selection so the
|
|
74
69
|
// long-press opens our context menu instead of the native text/callout UI.
|
|
75
|
-
// `position: relative` establishes the containing block for the absolutely
|
|
76
|
-
// positioned cursor anchor below, so the anchor point tracks the trigger
|
|
77
|
-
// (and scrolls with it) instead of the page.
|
|
78
70
|
trigger: {
|
|
79
|
-
position: 'relative',
|
|
80
71
|
WebkitTouchCallout: 'none',
|
|
81
72
|
},
|
|
82
|
-
// Zero-size anchor placed at the cursor point within the trigger. The menu
|
|
83
|
-
// is anchored to this element, so it sits under the cursor yet is positioned
|
|
84
|
-
// relative to the trigger's context — it follows the content on scroll and
|
|
85
|
-
// the browser can auto-flip it against the viewport edges.
|
|
86
|
-
cursorAnchor: {
|
|
87
|
-
position: 'absolute',
|
|
88
|
-
width: 0,
|
|
89
|
-
height: 0,
|
|
90
|
-
pointerEvents: 'none',
|
|
91
|
-
},
|
|
92
73
|
menu: {
|
|
93
74
|
boxSizing: 'border-box',
|
|
94
75
|
display: 'flex',
|
|
@@ -106,7 +87,6 @@ const styles = stylex.create({
|
|
|
106
87
|
transitionProperty: 'opacity',
|
|
107
88
|
transitionDuration: durationVars['--duration-fast'],
|
|
108
89
|
transitionTimingFunction: easeVars['--ease-standard'],
|
|
109
|
-
userSelect: 'none',
|
|
110
90
|
},
|
|
111
91
|
popover: {
|
|
112
92
|
minWidth: '160px',
|
|
@@ -220,13 +200,7 @@ export function ContextMenu({
|
|
|
220
200
|
const menuContent = 'menuContent' in props ? props.menuContent : undefined;
|
|
221
201
|
|
|
222
202
|
const menuId = useId();
|
|
223
|
-
// Cursor point in the trigger's local coordinate space (offset from the
|
|
224
|
-
// trigger's top-left, in-flow). Stored here and written to the zero-size
|
|
225
|
-
// anchor element so the menu is positioned relative to the trigger context
|
|
226
|
-
// — it scrolls with the content instead of sitting at a fixed viewport point.
|
|
227
203
|
const positionRef = useRef({x: 0, y: 0});
|
|
228
|
-
const cursorAnchorRef = useRef<HTMLSpanElement>(null);
|
|
229
|
-
const triggerRef = useRef<HTMLDivElement>(null);
|
|
230
204
|
// Element focused before the menu opened, restored when it closes so focus
|
|
231
205
|
// does not fall to <body> after Escape or outside-click dismissal.
|
|
232
206
|
const triggerFocusRef = useRef<HTMLElement | null>(null);
|
|
@@ -234,7 +208,7 @@ export function ContextMenu({
|
|
|
234
208
|
const [isOpen, setIsOpen] = useState(false);
|
|
235
209
|
|
|
236
210
|
const layer = useLayer({
|
|
237
|
-
mode: '
|
|
211
|
+
mode: 'fixed',
|
|
238
212
|
onHide: useCallback(() => {
|
|
239
213
|
setIsOpen(false);
|
|
240
214
|
onOpenChange?.(false);
|
|
@@ -352,53 +326,34 @@ export function ContextMenu({
|
|
|
352
326
|
[listNavKeyDown, typeahead],
|
|
353
327
|
);
|
|
354
328
|
|
|
355
|
-
// Place the zero-size cursor anchor at a point in the trigger's local
|
|
356
|
-
// coordinate space and open the menu. Positioning the anchor inside the
|
|
357
|
-
// trigger (rather than storing viewport coordinates on the menu itself) is
|
|
358
|
-
// what makes the menu context-relative: it scrolls with the content and the
|
|
359
|
-
// browser auto-flips it against the viewport edges via CSS anchor positioning.
|
|
360
|
-
const openAtLocalPoint = useCallback(
|
|
361
|
-
(localX: number, localY: number, focusEl: HTMLElement | null) => {
|
|
362
|
-
positionRef.current = {x: localX, y: localY};
|
|
363
|
-
const anchorEl = cursorAnchorRef.current;
|
|
364
|
-
if (anchorEl) {
|
|
365
|
-
anchorEl.style.left = `${localX}px`;
|
|
366
|
-
anchorEl.style.top = `${localY}px`;
|
|
367
|
-
}
|
|
368
|
-
// Remember the element focused before opening so we can restore it on
|
|
369
|
-
// close (Escape or outside-click), instead of dropping focus to <body>.
|
|
370
|
-
triggerFocusRef.current =
|
|
371
|
-
document.activeElement instanceof HTMLElement
|
|
372
|
-
? document.activeElement
|
|
373
|
-
: focusEl;
|
|
374
|
-
layer.show();
|
|
375
|
-
requestAnimationFrame(() => focusFirst());
|
|
376
|
-
},
|
|
377
|
-
[layer, focusFirst],
|
|
378
|
-
);
|
|
379
|
-
|
|
380
329
|
const handleContextMenu = useCallback(
|
|
381
330
|
(e: React.MouseEvent) => {
|
|
382
331
|
if (isDisabled) {
|
|
383
332
|
return;
|
|
384
333
|
}
|
|
385
334
|
e.preventDefault();
|
|
386
|
-
const trigger = triggerRef.current;
|
|
387
|
-
const rect = trigger?.getBoundingClientRect();
|
|
388
335
|
// A keyboard-initiated contextmenu (Shift+F10 / the Menu key) fires a
|
|
389
336
|
// `contextmenu` event whose coordinates are (0, 0) in several browsers.
|
|
390
|
-
// Detect that and anchor the menu to the trigger's
|
|
391
|
-
//
|
|
337
|
+
// Detect that and anchor the menu to the trigger's box instead, so the
|
|
338
|
+
// menu is reachable without a pointer (menus-8).
|
|
392
339
|
const isKeyboardInvoked =
|
|
393
340
|
e.clientX === 0 && e.clientY === 0 && e.detail === 0;
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
341
|
+
if (isKeyboardInvoked && e.currentTarget instanceof HTMLElement) {
|
|
342
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
343
|
+
positionRef.current = {x: rect.left, y: rect.bottom};
|
|
344
|
+
} else {
|
|
345
|
+
positionRef.current = {x: e.clientX, y: e.clientY};
|
|
346
|
+
}
|
|
347
|
+
// Remember the element focused before opening so we can restore it on
|
|
348
|
+
// close (Escape or outside-click), instead of dropping focus to <body>.
|
|
349
|
+
triggerFocusRef.current =
|
|
350
|
+
document.activeElement instanceof HTMLElement
|
|
351
|
+
? document.activeElement
|
|
352
|
+
: (e.currentTarget as HTMLElement);
|
|
353
|
+
layer.show();
|
|
354
|
+
requestAnimationFrame(() => focusFirst());
|
|
400
355
|
},
|
|
401
|
-
[isDisabled,
|
|
356
|
+
[isDisabled, layer, focusFirst],
|
|
402
357
|
);
|
|
403
358
|
|
|
404
359
|
// Touch long-press invocation (menus-8). iOS Safari never synthesizes a
|
|
@@ -409,14 +364,11 @@ export function ContextMenu({
|
|
|
409
364
|
disabled: isDisabled,
|
|
410
365
|
onLongPress: useCallback(
|
|
411
366
|
(point: {x: number; y: number}) => {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
rect ? point.y - rect.top : point.y,
|
|
416
|
-
triggerRef.current,
|
|
417
|
-
);
|
|
367
|
+
positionRef.current = {x: point.x, y: point.y};
|
|
368
|
+
layer.show();
|
|
369
|
+
requestAnimationFrame(() => focusFirst());
|
|
418
370
|
},
|
|
419
|
-
[
|
|
371
|
+
[layer, focusFirst],
|
|
420
372
|
),
|
|
421
373
|
});
|
|
422
374
|
|
|
@@ -435,7 +387,7 @@ export function ContextMenu({
|
|
|
435
387
|
return (
|
|
436
388
|
<>
|
|
437
389
|
<div
|
|
438
|
-
ref={
|
|
390
|
+
ref={ref}
|
|
439
391
|
onContextMenu={handleContextMenu}
|
|
440
392
|
{...longPressHandlers}
|
|
441
393
|
data-testid={testId}
|
|
@@ -448,16 +400,6 @@ export function ContextMenu({
|
|
|
448
400
|
: []),
|
|
449
401
|
)}>
|
|
450
402
|
{children}
|
|
451
|
-
<span
|
|
452
|
-
ref={mergeRefs(cursorAnchorRef, layer.ref)}
|
|
453
|
-
aria-hidden="true"
|
|
454
|
-
{...mergeProps(stylex.props(styles.cursorAnchor), {
|
|
455
|
-
style: {
|
|
456
|
-
left: `${positionRef.current.x}px`,
|
|
457
|
-
top: `${positionRef.current.y}px`,
|
|
458
|
-
},
|
|
459
|
-
})}
|
|
460
|
-
/>
|
|
461
403
|
</div>
|
|
462
404
|
|
|
463
405
|
{layer.render(
|
|
@@ -467,7 +409,6 @@ export function ContextMenu({
|
|
|
467
409
|
role="menu"
|
|
468
410
|
aria-label={label}
|
|
469
411
|
onKeyDown={listKeyDown}
|
|
470
|
-
onContextMenu={e => e.preventDefault()}
|
|
471
412
|
{...mergeProps(
|
|
472
413
|
themeProps('context-menu'),
|
|
473
414
|
stylex.props(styles.menu, xstyle),
|
|
@@ -479,8 +420,8 @@ export function ContextMenu({
|
|
|
479
420
|
</DropdownMenuContext>
|
|
480
421
|
</div>,
|
|
481
422
|
{
|
|
482
|
-
|
|
483
|
-
|
|
423
|
+
x: positionRef.current.x,
|
|
424
|
+
y: positionRef.current.y,
|
|
484
425
|
xstyle: [popoverXstyle, layerAnimations.below],
|
|
485
426
|
},
|
|
486
427
|
)}
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
import {describe, it, expect, vi, beforeEach} from 'vitest';
|
|
13
13
|
import {render, screen, fireEvent, waitFor} from '@testing-library/react';
|
|
14
14
|
import userEvent from '@testing-library/user-event';
|
|
15
|
-
import {getButton, queryButton} from '../__tests__/fastRoleQueries';
|
|
16
15
|
import {DateInput} from './DateInput';
|
|
17
16
|
import {InputGroup} from '../InputGroup';
|
|
18
17
|
import {InputGroupText} from '../InputGroup/InputGroupText';
|
|
@@ -93,14 +92,14 @@ describe('DateInput', () => {
|
|
|
93
92
|
|
|
94
93
|
it('calendar button is focusable and clickable', () => {
|
|
95
94
|
render(<DateInput label="Date" onChange={() => {}} />);
|
|
96
|
-
const button =
|
|
95
|
+
const button = screen.getByRole('button', {name: 'Open calendar'});
|
|
97
96
|
expect(button).toBeInTheDocument();
|
|
98
97
|
expect(button).not.toBeDisabled();
|
|
99
98
|
});
|
|
100
99
|
|
|
101
100
|
it('calendar button is disabled when isDisabled is true', () => {
|
|
102
101
|
render(<DateInput label="Date" isDisabled onChange={() => {}} />);
|
|
103
|
-
const button =
|
|
102
|
+
const button = screen.getByRole('button', {name: 'Open calendar'});
|
|
104
103
|
expect(button).toBeDisabled();
|
|
105
104
|
});
|
|
106
105
|
|
|
@@ -283,7 +282,7 @@ describe('DateInput', () => {
|
|
|
283
282
|
it('disables input and button when isLoading is true', () => {
|
|
284
283
|
render(<DateInput label="Date" isLoading onChange={() => {}} />);
|
|
285
284
|
expect(screen.getByRole('combobox')).toBeDisabled();
|
|
286
|
-
expect(
|
|
285
|
+
expect(screen.getByRole('button', {name: 'Open calendar'})).toBeDisabled();
|
|
287
286
|
});
|
|
288
287
|
|
|
289
288
|
it('shows spinner when isLoading is true', () => {
|
|
@@ -476,7 +475,7 @@ describe('DateInput', () => {
|
|
|
476
475
|
|
|
477
476
|
it('does not open popover when clicking calendar button while disabled', () => {
|
|
478
477
|
render(<DateInput label="Date" isDisabled onChange={() => {}} />);
|
|
479
|
-
const button =
|
|
478
|
+
const button = screen.getByRole('button', {name: 'Open calendar'});
|
|
480
479
|
fireEvent.click(button);
|
|
481
480
|
expect(screen.getByRole('combobox')).toHaveAttribute(
|
|
482
481
|
'aria-expanded',
|
|
@@ -514,17 +513,23 @@ describe('DateInput', () => {
|
|
|
514
513
|
hasClear
|
|
515
514
|
/>,
|
|
516
515
|
);
|
|
517
|
-
expect(
|
|
516
|
+
expect(
|
|
517
|
+
screen.getByRole('button', {name: 'Clear Date'}),
|
|
518
|
+
).toBeInTheDocument();
|
|
518
519
|
});
|
|
519
520
|
|
|
520
521
|
it('does not show clear button when value is undefined', () => {
|
|
521
522
|
render(<DateInput label="Date" onChange={() => {}} hasClear />);
|
|
522
|
-
expect(
|
|
523
|
+
expect(
|
|
524
|
+
screen.queryByRole('button', {name: 'Clear Date'}),
|
|
525
|
+
).not.toBeInTheDocument();
|
|
523
526
|
});
|
|
524
527
|
|
|
525
528
|
it('does not show clear button when hasClear is false', () => {
|
|
526
529
|
render(<DateInput label="Date" value="2026-01-15" onChange={() => {}} />);
|
|
527
|
-
expect(
|
|
530
|
+
expect(
|
|
531
|
+
screen.queryByRole('button', {name: 'Clear Date'}),
|
|
532
|
+
).not.toBeInTheDocument();
|
|
528
533
|
});
|
|
529
534
|
|
|
530
535
|
it('does not show clear button when disabled', () => {
|
|
@@ -537,7 +542,9 @@ describe('DateInput', () => {
|
|
|
537
542
|
isDisabled
|
|
538
543
|
/>,
|
|
539
544
|
);
|
|
540
|
-
expect(
|
|
545
|
+
expect(
|
|
546
|
+
screen.queryByRole('button', {name: 'Clear Date'}),
|
|
547
|
+
).not.toBeInTheDocument();
|
|
541
548
|
});
|
|
542
549
|
|
|
543
550
|
it('calls onChange with undefined when clear is clicked', () => {
|
|
@@ -550,7 +557,7 @@ describe('DateInput', () => {
|
|
|
550
557
|
hasClear
|
|
551
558
|
/>,
|
|
552
559
|
);
|
|
553
|
-
fireEvent.click(
|
|
560
|
+
fireEvent.click(screen.getByRole('button', {name: 'Clear Date'}));
|
|
554
561
|
expect(onChange).toHaveBeenCalledWith(undefined);
|
|
555
562
|
});
|
|
556
563
|
});
|
|
@@ -692,7 +699,9 @@ describe('DateInput', () => {
|
|
|
692
699
|
expect(input).toHaveAttribute('aria-disabled', 'true');
|
|
693
700
|
expect(input.getAttribute('aria-describedby')).toContain(tooltip.id);
|
|
694
701
|
expect(tooltip).toHaveTextContent('Scheduling is locked');
|
|
695
|
-
expect(
|
|
702
|
+
expect(
|
|
703
|
+
screen.getByRole('button', {name: 'Open calendar'}),
|
|
704
|
+
).toBeDisabled();
|
|
696
705
|
});
|
|
697
706
|
});
|
|
698
707
|
|