@astryxdesign/core 0.4.5 → 0.4.6-canary.cea9ecd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +134 -0
- package/dist/Avatar/Avatar.d.ts +10 -5
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +139 -30
- package/dist/Avatar/AvatarStatusDot.d.ts +2 -1
- package/dist/Avatar/AvatarStatusDot.d.ts.map +1 -1
- package/dist/Avatar/AvatarStatusDot.js +30 -4
- package/dist/Avatar/AvatarStatusLabelContext.d.ts +39 -0
- package/dist/Avatar/AvatarStatusLabelContext.d.ts.map +1 -0
- package/dist/Avatar/AvatarStatusLabelContext.js +41 -0
- package/dist/AvatarGroup/AvatarGroup.d.ts +3 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +15 -9
- package/dist/Blockquote/Blockquote.d.ts +4 -3
- package/dist/Blockquote/Blockquote.d.ts.map +1 -1
- package/dist/Blockquote/Blockquote.js +9 -10
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +21 -5
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +47 -34
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +7 -7
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +21 -12
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarNavigation.js +8 -4
- package/dist/Calendar/styles.d.ts +2 -2
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +5 -5
- package/dist/Center/Center.d.ts +23 -1
- package/dist/Center/Center.d.ts.map +1 -1
- package/dist/Center/Center.js +12 -6
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +3 -3
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +2 -2
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +2 -2
- package/dist/Chat/useChatDictation.d.ts +1 -1
- package/dist/Chat/useChatDictation.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.d.ts +1 -1
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +4 -3
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +2 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +2 -2
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +5 -5
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +4 -4
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +1 -1
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +2 -2
- package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteItem.js +3 -3
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +6 -6
- package/dist/DateInput/DateInput.d.ts +31 -2
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +90 -22
- package/dist/DateInput/MonthScroller.d.ts +35 -0
- package/dist/DateInput/MonthScroller.d.ts.map +1 -0
- package/dist/DateInput/MonthScroller.js +658 -0
- package/dist/DateInput/MonthYearWheels.d.ts +24 -0
- package/dist/DateInput/MonthYearWheels.d.ts.map +1 -0
- package/dist/DateInput/MonthYearWheels.js +114 -0
- package/dist/DateInput/TouchDateField.d.ts +10 -0
- package/dist/DateInput/TouchDateField.d.ts.map +1 -0
- package/dist/DateInput/TouchDateField.js +810 -0
- package/dist/DateInput/Wheel.d.ts +41 -0
- package/dist/DateInput/Wheel.d.ts.map +1 -0
- package/dist/DateInput/Wheel.js +315 -0
- package/dist/DateInput/monthGeometry.d.ts +65 -0
- package/dist/DateInput/monthGeometry.d.ts.map +1 -0
- package/dist/DateInput/monthGeometry.js +98 -0
- package/dist/DateInput/tokens.stylex.d.ts +63 -0
- package/dist/DateInput/tokens.stylex.d.ts.map +1 -0
- package/dist/DateInput/tokens.stylex.js +74 -0
- package/dist/DateInput/useOwnScrollGesture.d.ts +41 -0
- package/dist/DateInput/useOwnScrollGesture.d.ts.map +1 -0
- package/dist/DateInput/useOwnScrollGesture.js +202 -0
- package/dist/DateInput/usePointerDragScroll.d.ts +15 -0
- package/dist/DateInput/usePointerDragScroll.d.ts.map +1 -0
- package/dist/DateInput/usePointerDragScroll.js +216 -0
- package/dist/DateInput/useScrollSettle.d.ts +26 -0
- package/dist/DateInput/useScrollSettle.d.ts.map +1 -0
- package/dist/DateInput/useScrollSettle.js +149 -0
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +17 -14
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +17 -14
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +2 -2
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +2 -2
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +2 -2
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +2 -2
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +4 -4
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +6 -0
- package/dist/Field/inputStyles.stylex.d.ts +1 -1
- package/dist/Field/inputStyles.stylex.d.ts.map +1 -1
- package/dist/Field/inputStyles.stylex.js +5 -5
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +6 -6
- package/dist/HoverCard/HoverCard.d.ts +13 -3
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +2 -0
- package/dist/HoverCard/index.d.ts +1 -1
- package/dist/HoverCard/index.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.d.ts +17 -2
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +78 -9
- package/dist/InputGroup/InputGroup.js +1 -1
- package/dist/Item/Item.d.ts +9 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +52 -14
- package/dist/Layer/index.d.ts +4 -2
- package/dist/Layer/index.d.ts.map +1 -1
- package/dist/Layer/index.js +2 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +3 -2
- package/dist/Layer/useTouchTrigger.d.ts +113 -0
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -0
- package/dist/Layer/useTouchTrigger.js +241 -0
- package/dist/Layout/container.stylex.d.ts +4 -2
- package/dist/Layout/container.stylex.d.ts.map +1 -1
- package/dist/Layout/container.stylex.js +19 -11
- package/dist/Layout/index.d.ts +1 -0
- package/dist/Layout/index.d.ts.map +1 -1
- package/dist/Layout/index.js +4 -0
- package/dist/Layout/padding.stylex.d.ts +315 -12
- package/dist/Layout/padding.stylex.d.ts.map +1 -1
- package/dist/Layout/padding.stylex.js +389 -12
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +5 -4
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +6 -6
- package/dist/MetadataList/MetadataList.d.ts.map +1 -1
- package/dist/MetadataList/MetadataList.js +1 -1
- package/dist/MobileNav/MobileNav.d.ts +1 -0
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +24 -6
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +8 -8
- package/dist/NavItem/navItemStyles.stylex.d.ts +4 -4
- package/dist/NavItem/navItemStyles.stylex.d.ts.map +1 -1
- package/dist/NavItem/navItemStyles.stylex.js +4 -4
- package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.js +3 -3
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +36 -8
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +3 -3
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +2 -2
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +11 -12
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +3 -1
- package/dist/PowerSearch/formatFilterValue.d.ts +11 -2
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +23 -8
- package/dist/RadioList/RadioListItem.d.ts +2 -2
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +70 -40
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +7 -7
- package/dist/Section/Section.d.ts +36 -1
- package/dist/Section/Section.d.ts.map +1 -1
- package/dist/Section/Section.js +12 -2
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +7 -2
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +3 -3
- package/dist/Selector/Selector.d.ts +26 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +93 -20
- package/dist/Selector/SelectorOption.d.ts +14 -1
- package/dist/Selector/SelectorOption.d.ts.map +1 -1
- package/dist/Selector/SelectorOption.js +6 -0
- package/dist/Selector/SelectorRowLayoutContext.d.ts +8 -0
- package/dist/Selector/SelectorRowLayoutContext.d.ts.map +1 -0
- package/dist/Selector/SelectorRowLayoutContext.js +27 -0
- package/dist/Selector/types.d.ts +1 -0
- package/dist/Selector/types.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +4 -4
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +3 -3
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +7 -7
- package/dist/Stack/Stack.d.ts +23 -1
- package/dist/Stack/Stack.d.ts.map +1 -1
- package/dist/Stack/Stack.js +12 -6
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +2 -2
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +1 -1
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +3 -3
- package/dist/Table/TableRow.js +4 -4
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +2 -2
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +2 -2
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +2 -2
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts +5 -3
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.js +12 -9
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +3 -3
- package/dist/TextArea/TextArea.js +1 -1
- package/dist/TextInput/TextInput.js +1 -1
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +3 -3
- package/dist/TimeInput/TimeInput.js +2 -2
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +6 -4
- package/dist/Timestamp/formatInstant.d.ts +3 -2
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +8 -8
- package/dist/Timestamp/tooltipEntries.d.ts +2 -1
- package/dist/Timestamp/tooltipEntries.d.ts.map +1 -1
- package/dist/Timestamp/tooltipEntries.js +5 -3
- package/dist/Toast/Toast.d.ts +4 -3
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +10 -7
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +6 -6
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +1 -1
- package/dist/Tooltip/Tooltip.d.ts +16 -3
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +2 -0
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +21 -2
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +71 -13
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +4 -4
- package/dist/TopNav/TopNavItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavItem.js +3 -3
- package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenu.js +2 -2
- package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +2 -2
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +4 -4
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +7 -7
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +2 -2
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +1 -1
- package/dist/astryx.css +124 -62
- package/dist/hooks/containerReveal.stylex.d.ts.map +1 -1
- package/dist/hooks/containerReveal.stylex.js +18 -18
- package/dist/hooks/scrollbarGutter.d.ts +28 -0
- package/dist/hooks/scrollbarGutter.d.ts.map +1 -0
- package/dist/hooks/scrollbarGutter.js +103 -0
- package/dist/hooks/useAutoMediaMode.d.ts +31 -0
- package/dist/hooks/useAutoMediaMode.d.ts.map +1 -0
- package/dist/hooks/useAutoMediaMode.js +201 -0
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +1 -1
- package/dist/hooks/useListFocus.d.ts +5 -2
- package/dist/hooks/useListFocus.d.ts.map +1 -1
- package/dist/hooks/useListFocus.js +12 -6
- package/dist/hooks/useScrollLock.d.ts +4 -0
- package/dist/hooks/useScrollLock.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.js +13 -1
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.js +2 -0
- package/dist/i18n/index.d.ts +6 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +6 -0
- package/dist/i18n/useCollator.d.ts +12 -0
- package/dist/i18n/useCollator.d.ts.map +1 -0
- package/dist/i18n/useCollator.js +40 -0
- package/dist/i18n/useLocale.d.ts +3 -0
- package/dist/i18n/useLocale.d.ts.map +1 -0
- package/dist/i18n/useLocale.js +31 -0
- package/dist/theme/MediaTheme.d.ts +25 -5
- package/dist/theme/MediaTheme.d.ts.map +1 -1
- package/dist/theme/MediaTheme.js +31 -6
- package/dist/theme/defineTheme.d.ts +5 -0
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +5 -0
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +7 -0
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +66 -5
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/syntax/index.d.ts +6 -0
- package/dist/theme/syntax/index.d.ts.map +1 -1
- package/dist/theme/syntax/index.js +7 -2
- package/dist/utils/dateParser.d.ts +4 -3
- package/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +8 -8
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/plainDate.d.ts +5 -2
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +20 -4
- package/locales/en.json +28 -0
- package/locales/pseudo.json +21 -0
- package/package.json +3 -3
- package/src/Avatar/Avatar.doc.mjs +10 -6
- package/src/Avatar/Avatar.test.tsx +219 -1
- package/src/Avatar/Avatar.tsx +179 -37
- package/src/Avatar/AvatarStatusDot.tsx +30 -4
- package/src/Avatar/AvatarStatusLabelContext.ts +47 -0
- package/src/AvatarGroup/AvatarGroup.doc.mjs +10 -6
- package/src/AvatarGroup/AvatarGroup.test.tsx +62 -0
- package/src/AvatarGroup/AvatarGroup.tsx +3 -1
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +31 -8
- package/src/Banner/Banner.doc.mjs +2 -0
- package/src/Blockquote/Blockquote.doc.mjs +30 -7
- package/src/Blockquote/Blockquote.test.tsx +34 -3
- package/src/Blockquote/Blockquote.tsx +11 -9
- package/src/BottomSheet/BottomSheet.doc.mjs +3 -3
- package/src/BottomSheet/BottomSheet.test.tsx +24 -0
- package/src/BottomSheet/BottomSheetPanel.test.tsx +91 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +58 -3
- package/src/Breadcrumbs/BreadcrumbItem.tsx +36 -23
- package/src/Breadcrumbs/Breadcrumbs.doc.mjs +26 -2
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +31 -0
- package/src/Button/Button.tsx +12 -9
- package/src/Calendar/Calendar.tsx +15 -9
- package/src/Calendar/hooks/useCalendarNavigation.ts +6 -4
- package/src/Calendar/styles.ts +8 -5
- package/src/Center/Center.doc.mjs +48 -0
- package/src/Center/Center.test.tsx +158 -0
- package/src/Center/Center.tsx +50 -9
- package/src/Chat/ChatComposer.tsx +11 -5
- package/src/Chat/ChatComposerDrawer.tsx +4 -1
- package/src/Chat/ChatToolCalls.tsx +13 -4
- package/src/Chat/{useChatDictation.test.ts → useChatDictation.test.tsx} +29 -14
- package/src/Chat/useChatDictation.ts +1 -1
- package/src/Chat/useSpeechRecognition.ts +5 -3
- package/src/Chat/useTriggerMenu.tsx +4 -1
- package/src/CheckboxInput/CheckboxInput.tsx +5 -2
- package/src/Citation/Citation.test.tsx +6 -1
- package/src/Citation/Citation.tsx +11 -5
- package/src/ClickableCard/ClickableCard.tsx +7 -4
- package/src/CodeBlock/CodeBlock.tsx +4 -1
- package/src/Collapsible/Collapsible.tsx +5 -2
- package/src/CommandPalette/CommandPaletteItem.tsx +6 -3
- package/src/ComplexSelector/ComplexSelector.doc.mjs +10 -0
- package/src/ComplexSelector/ComplexSelector.tsx +14 -7
- package/src/DateInput/DateInput.test.tsx +17 -1
- package/src/DateInput/DateInput.tsx +93 -21
- package/src/DateInput/DateInputTouch.test.tsx +2582 -0
- package/src/DateInput/MonthScroller.tsx +878 -0
- package/src/DateInput/MonthYearWheels.tsx +147 -0
- package/src/DateInput/TouchDateField.tsx +1223 -0
- package/src/DateInput/Wheel.tsx +473 -0
- package/src/DateInput/monthGeometry.ts +118 -0
- package/src/DateInput/tokens.stylex.ts +99 -0
- package/src/DateInput/useOwnScrollGesture.ts +227 -0
- package/src/DateInput/usePointerDragScroll.ts +220 -0
- package/src/DateInput/useScrollSettle.ts +164 -0
- package/src/DateRangeInput/DateRangeInput.doc.mjs +1 -1
- package/src/DateRangeInput/DateRangeInput.tsx +31 -13
- package/src/DateTimeInput/DateTimeInput.tsx +25 -9
- package/src/Dialog/Dialog.test.tsx +24 -0
- package/src/Dialog/Dialog.tsx +3 -0
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +5 -2
- package/src/DropdownMenu/DropdownMenuItem.tsx +5 -2
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +5 -2
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +5 -2
- package/src/Field/Field.doc.mjs +2 -0
- package/src/Field/FieldLabel.tsx +9 -3
- package/src/Field/InputClearButton.test.tsx +110 -3
- package/src/Field/InputClearButton.tsx +38 -0
- package/src/Field/inputStyles.stylex.ts +17 -13
- package/src/FileInput/FileInput.tsx +15 -8
- package/src/FormLayout/FormLayout.doc.mjs +1 -1
- package/src/HoverCard/HoverCard.doc.mjs +18 -0
- package/src/HoverCard/HoverCard.test.tsx +189 -0
- package/src/HoverCard/HoverCard.tsx +22 -2
- package/src/HoverCard/index.ts +1 -0
- package/src/HoverCard/useHoverCard.doc.mjs +2 -0
- package/src/HoverCard/useHoverCard.tsx +103 -7
- package/src/InputGroup/InputGroup.tsx +1 -1
- package/src/Item/Item.doc.mjs +1 -0
- package/src/Item/Item.test.tsx +50 -0
- package/src/Item/Item.tsx +54 -6
- package/src/Layer/index.ts +10 -0
- package/src/Layer/useLayer.tsx +13 -2
- package/src/Layer/useTouchTrigger.test.ts +70 -0
- package/src/Layer/useTouchTrigger.ts +366 -0
- package/src/Layout/Layout.doc.mjs +18 -0
- package/src/Layout/container.stylex.ts +11 -3
- package/src/Layout/index.ts +4 -0
- package/src/Layout/overlayPaddingReset.test.tsx +222 -0
- package/src/Layout/padding.stylex.ts +192 -12
- package/src/Lightbox/Lightbox.tsx +11 -3
- package/src/Link/Link.tsx +9 -6
- package/src/MetadataList/MetadataList.tsx +4 -1
- package/src/MobileNav/MobileNav.tsx +61 -5
- package/src/MobileNav/MobileNavEntryAnimation.test.tsx +212 -0
- package/src/MobileNav/MobileNavScrollbarGutter.test.tsx +109 -0
- package/src/MultiSelector/MultiSelector.test.tsx +1 -1
- package/src/MultiSelector/MultiSelector.tsx +26 -10
- package/src/NavItem/navItemStyles.stylex.ts +7 -4
- package/src/NavMenu/NavHeadingMenuItem.tsx +6 -3
- package/src/NumberInput/NumberInput.doc.mjs +24 -0
- package/src/NumberInput/NumberInput.test.tsx +138 -0
- package/src/NumberInput/NumberInput.tsx +47 -8
- package/src/Outline/Outline.tsx +5 -2
- package/src/Pagination/Pagination.tsx +5 -2
- package/src/Popover/Popover.test.tsx +27 -1
- package/src/PowerSearch/PowerSearch.tsx +17 -8
- package/src/PowerSearch/PowerSearchToken.tsx +3 -0
- package/src/PowerSearch/formatFilterValue.test.ts +22 -2
- package/src/PowerSearch/formatFilterValue.ts +31 -6
- package/src/RadioList/RadioList.doc.mjs +1 -1
- package/src/RadioList/RadioList.test.tsx +170 -2
- package/src/RadioList/RadioListItem.tsx +88 -53
- package/src/Resizable/ResizeHandle.test.tsx +22 -0
- package/src/Resizable/ResizeHandle.tsx +25 -7
- package/src/Section/Section.doc.mjs +55 -0
- package/src/Section/Section.test.tsx +201 -4
- package/src/Section/Section.tsx +69 -0
- package/src/SegmentedControl/SegmentedControl.test.tsx +31 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +15 -3
- package/src/SelectableCard/SelectableCard.tsx +6 -3
- package/src/Selector/Selector.doc.mjs +16 -2
- package/src/Selector/Selector.test.tsx +525 -1
- package/src/Selector/Selector.tsx +180 -25
- package/src/Selector/SelectorOption.doc.mjs +7 -0
- package/src/Selector/SelectorOption.tsx +21 -0
- package/src/Selector/SelectorRowLayoutContext.ts +32 -0
- package/src/Selector/types.ts +4 -4
- package/src/SideNav/SideNavHeading.tsx +14 -5
- package/src/SideNav/SideNavItem.tsx +9 -3
- package/src/Slider/Slider.tsx +25 -6
- package/src/Stack/Stack.doc.mjs +72 -0
- package/src/Stack/Stack.test.tsx +156 -0
- package/src/Stack/Stack.tsx +50 -8
- package/src/Switch/Switch.tsx +5 -2
- package/src/TabList/Tab.tsx +4 -1
- package/src/TabList/TabMenu.tsx +9 -3
- package/src/Table/TableRow.tsx +4 -4
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +6 -2
- package/src/Table/plugins/filtering/useTableFiltering.tsx +4 -1
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +10 -3
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +6 -3
- package/src/Table/plugins/sortable/useTableSortable.tsx +4 -1
- package/src/Table/plugins/sortable/useTableSortableState.test.tsx +34 -0
- package/src/Table/plugins/sortable/useTableSortableState.tsx +26 -23
- package/src/Table/plugins/tree/useTableTreeData.tsx +10 -4
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextArea/TextArea.tsx +1 -1
- package/src/TextInput/TextInput.tsx +1 -1
- package/src/Thumbnail/Thumbnail.tsx +9 -3
- package/src/TimeInput/TimeInput.tsx +1 -1
- package/src/Timestamp/Timestamp.test.tsx +27 -7
- package/src/Timestamp/Timestamp.tsx +8 -4
- package/src/Timestamp/formatInstant.ts +9 -7
- package/src/Timestamp/tooltipEntries.test.ts +11 -6
- package/src/Timestamp/tooltipEntries.ts +6 -2
- package/src/Toast/Toast.tsx +9 -7
- package/src/Token/Token.tsx +14 -5
- package/src/Tokenizer/Tokenizer.tsx +4 -1
- package/src/Tooltip/Tooltip.doc.mjs +18 -0
- package/src/Tooltip/Tooltip.test.tsx +254 -1
- package/src/Tooltip/Tooltip.tsx +22 -2
- package/src/Tooltip/index.ts +1 -0
- package/src/Tooltip/useTooltip.doc.mjs +2 -0
- package/src/Tooltip/useTooltip.tsx +99 -21
- package/src/TopNav/TopNavHeading.tsx +13 -4
- package/src/TopNav/TopNavItem.tsx +6 -3
- package/src/TopNav/TopNavMegaMenu.tsx +5 -2
- package/src/TopNav/TopNavMegaMenuItem.tsx +5 -2
- package/src/TopNav/TopNavMenu.tsx +10 -4
- package/src/TreeList/TreeListItem.tsx +22 -7
- package/src/Typeahead/BaseTypeahead.tsx +5 -2
- package/src/Typeahead/Typeahead.tsx +4 -1
- package/src/hooks/containerReveal.stylex.ts +54 -18
- package/src/hooks/scrollbarGutter.test.ts +167 -0
- package/src/hooks/scrollbarGutter.ts +121 -0
- package/src/hooks/useAutoMediaMode.test.ts +109 -0
- package/src/hooks/useAutoMediaMode.ts +233 -0
- package/src/hooks/useInputStatusIcon.tsx +4 -1
- package/src/hooks/useListFocus.doc.mjs +2 -2
- package/src/hooks/useListFocus.test.tsx +65 -3
- package/src/hooks/useListFocus.ts +15 -7
- package/src/hooks/useScrollLock.doc.mjs +4 -4
- package/src/hooks/useScrollLock.test.ts +73 -0
- package/src/hooks/useScrollLock.ts +14 -0
- package/src/i18n/InternationalizationContext.ts +2 -0
- package/src/i18n/__tests__/e2e-powersearch.test.tsx +37 -1
- package/src/i18n/__tests__/useCollator.test.tsx +115 -0
- package/src/i18n/__tests__/useLocale.test.tsx +52 -0
- package/src/i18n/index.ts +6 -0
- package/src/i18n/useCollator.doc.mjs +84 -0
- package/src/i18n/useCollator.ts +44 -0
- package/src/i18n/useLocale.doc.mjs +70 -0
- package/src/i18n/useLocale.ts +34 -0
- package/src/i18n/useTranslator.doc.mjs +1 -1
- package/src/reset.css +9 -2
- package/src/reset.test.ts +22 -0
- package/src/theme/MediaTheme.doc.mjs +23 -4
- package/src/theme/MediaTheme.dom.test.tsx +97 -0
- package/src/theme/MediaTheme.tsx +42 -7
- package/src/theme/defineTheme.test.ts +9 -3
- package/src/theme/defineTheme.ts +5 -0
- package/src/theme/derivedVarRegistry.test.ts +19 -5
- package/src/theme/derivedVarRegistry.ts +4 -0
- package/src/theme/generateThemeRules.test.ts +118 -0
- package/src/theme/generateThemeRules.ts +83 -5
- package/src/theme/index.ts +1 -1
- package/src/theme/syntax/index.ts +6 -2
- package/src/theme/syntax/serverSafeSyntax.test.ts +68 -0
- package/src/utils/dateParser.test.ts +20 -0
- package/src/utils/dateParser.ts +14 -7
- package/src/utils/index.ts +2 -0
- package/src/utils/plainDate.test.ts +6 -0
- package/src/utils/plainDate.ts +21 -4
package/src/Item/Item.test.tsx
CHANGED
|
@@ -508,4 +508,54 @@ describe('Item', () => {
|
|
|
508
508
|
expect(screen.getByText('Alice')).toBeInTheDocument();
|
|
509
509
|
expect(screen.getByText(/commented/)).toBeInTheDocument();
|
|
510
510
|
});
|
|
511
|
+
it('puts the label and description in one row when layout is inline', () => {
|
|
512
|
+
const stacked = render(
|
|
513
|
+
<Item label="Private" description="Only members can access" />,
|
|
514
|
+
);
|
|
515
|
+
const stackedRow = screen.getByText('Private').parentElement;
|
|
516
|
+
stacked.unmount();
|
|
517
|
+
|
|
518
|
+
render(
|
|
519
|
+
<Item
|
|
520
|
+
label="Private"
|
|
521
|
+
description="Only members can access"
|
|
522
|
+
layout="inline"
|
|
523
|
+
/>,
|
|
524
|
+
);
|
|
525
|
+
const inlineRow = screen.getByText('Private').parentElement;
|
|
526
|
+
|
|
527
|
+
// Same container, different styling: the shared content box switches from
|
|
528
|
+
// a column to a row, so its class list must differ from the stacked one.
|
|
529
|
+
expect(inlineRow?.className).not.toBe(stackedRow?.className);
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
it('ellipsizes a ReactNode description when layout is inline', () => {
|
|
533
|
+
// A stacked ReactNode description is left alone (it may wrap); an inline
|
|
534
|
+
// one is one line by definition, so it truncates like a string does.
|
|
535
|
+
const stacked = render(
|
|
536
|
+
<Item
|
|
537
|
+
label="Private"
|
|
538
|
+
description={<span>Only members can access</span>}
|
|
539
|
+
/>,
|
|
540
|
+
);
|
|
541
|
+
const stackedDescription = screen.getByText('Only members can access')
|
|
542
|
+
.parentElement?.className;
|
|
543
|
+
stacked.unmount();
|
|
544
|
+
|
|
545
|
+
render(
|
|
546
|
+
<Item
|
|
547
|
+
label="Private"
|
|
548
|
+
description={<span>Only members can access</span>}
|
|
549
|
+
layout="inline"
|
|
550
|
+
/>,
|
|
551
|
+
);
|
|
552
|
+
expect(
|
|
553
|
+
screen.getByText('Only members can access').parentElement?.className,
|
|
554
|
+
).not.toBe(stackedDescription);
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
it('ignores inline layout when there is no description', () => {
|
|
558
|
+
render(<Item label="Private" layout="inline" />);
|
|
559
|
+
expect(screen.getByText('Private')).toBeInTheDocument();
|
|
560
|
+
});
|
|
511
561
|
});
|
package/src/Item/Item.tsx
CHANGED
|
@@ -106,6 +106,15 @@ export interface ItemProps extends BaseProps<HTMLElement> {
|
|
|
106
106
|
*/
|
|
107
107
|
descriptionLines?: number;
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* How the label and description sit together. `stacked` puts the description
|
|
111
|
+
* on its own line below the label; `inline` keeps both on one line, with the
|
|
112
|
+
* description ellipsizing first, so the row fits a fixed-height host.
|
|
113
|
+
*
|
|
114
|
+
* @default 'stacked'
|
|
115
|
+
*/
|
|
116
|
+
layout?: 'stacked' | 'inline';
|
|
117
|
+
|
|
109
118
|
/**
|
|
110
119
|
* Click handler. Makes the item clickable with button semantics.
|
|
111
120
|
*/
|
|
@@ -207,13 +216,16 @@ const styles = stylex.create({
|
|
|
207
216
|
alignItems: 'flex-start',
|
|
208
217
|
},
|
|
209
218
|
interactive: {
|
|
210
|
-
cursor:
|
|
219
|
+
cursor: {
|
|
220
|
+
default: 'pointer',
|
|
221
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
222
|
+
},
|
|
211
223
|
transitionProperty: 'background-color',
|
|
212
224
|
transitionDuration: durationVars['--duration-fast-min'],
|
|
213
225
|
transitionTimingFunction: easeVars['--ease-standard'],
|
|
214
226
|
backgroundColor: {
|
|
215
227
|
default: 'transparent',
|
|
216
|
-
':hover': {
|
|
228
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
217
229
|
'@media (hover: hover)': colorVars['--color-overlay-hover'],
|
|
218
230
|
},
|
|
219
231
|
':active': colorVars['--color-overlay-pressed'],
|
|
@@ -226,7 +238,7 @@ const styles = stylex.create({
|
|
|
226
238
|
backgroundColor: colorVars['--color-accent-muted'],
|
|
227
239
|
},
|
|
228
240
|
disabled: {
|
|
229
|
-
cursor: '
|
|
241
|
+
cursor: 'default',
|
|
230
242
|
pointerEvents: 'none' as const,
|
|
231
243
|
},
|
|
232
244
|
disabledContent: {
|
|
@@ -234,7 +246,10 @@ const styles = stylex.create({
|
|
|
234
246
|
},
|
|
235
247
|
invisibleButton: {
|
|
236
248
|
all: 'unset',
|
|
237
|
-
cursor:
|
|
249
|
+
cursor: {
|
|
250
|
+
default: 'inherit',
|
|
251
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
252
|
+
},
|
|
238
253
|
font: 'inherit',
|
|
239
254
|
color: 'inherit',
|
|
240
255
|
display: 'flex',
|
|
@@ -246,7 +261,10 @@ const styles = stylex.create({
|
|
|
246
261
|
},
|
|
247
262
|
invisibleAnchor: {
|
|
248
263
|
all: 'unset',
|
|
249
|
-
cursor:
|
|
264
|
+
cursor: {
|
|
265
|
+
default: 'inherit',
|
|
266
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
267
|
+
},
|
|
250
268
|
font: 'inherit',
|
|
251
269
|
color: 'inherit',
|
|
252
270
|
display: 'flex',
|
|
@@ -264,6 +282,25 @@ const styles = stylex.create({
|
|
|
264
282
|
minWidth: 0,
|
|
265
283
|
textAlign: 'start',
|
|
266
284
|
},
|
|
285
|
+
// `layout="inline"`: label and description share one line, so the row fits a
|
|
286
|
+
// fixed-height host such as a Selector trigger inside an InputGroup.
|
|
287
|
+
inlineContent: {
|
|
288
|
+
flexDirection: 'row',
|
|
289
|
+
// Centered, not baseline-aligned: two different font sizes on a shared
|
|
290
|
+
// baseline make a line box taller than either line, which would push a
|
|
291
|
+
// fixed-height host (a Selector trigger) a pixel off its size token.
|
|
292
|
+
alignItems: 'center',
|
|
293
|
+
columnGap: spacingVars['--spacing-1'],
|
|
294
|
+
},
|
|
295
|
+
inlineLabel: {
|
|
296
|
+
flexShrink: 0,
|
|
297
|
+
},
|
|
298
|
+
// The description yields width first, so the label — the part that identifies
|
|
299
|
+
// the item — is the last thing to ellipsize.
|
|
300
|
+
inlineDescription: {
|
|
301
|
+
flexShrink: 1,
|
|
302
|
+
minWidth: 0,
|
|
303
|
+
},
|
|
267
304
|
label: {
|
|
268
305
|
// Falls back to the primary text token; a parent (e.g. a destructive menu
|
|
269
306
|
// item) can recolor the label by setting --_item-label-color.
|
|
@@ -358,6 +395,7 @@ export function Item({
|
|
|
358
395
|
density = 'balanced',
|
|
359
396
|
labelLines,
|
|
360
397
|
descriptionLines,
|
|
398
|
+
layout = 'stacked',
|
|
361
399
|
onClick,
|
|
362
400
|
interactiveRef,
|
|
363
401
|
href,
|
|
@@ -420,12 +458,16 @@ export function Item({
|
|
|
420
458
|
? styles.labelSingleTruncate
|
|
421
459
|
: null;
|
|
422
460
|
|
|
461
|
+
// Inline rows are one line by definition, so the description always
|
|
462
|
+
// ellipsizes there — a ReactNode description cannot wrap the row open.
|
|
463
|
+
const isInline = layout === 'inline' && description != null;
|
|
464
|
+
|
|
423
465
|
const descriptionTruncateStyle =
|
|
424
466
|
descriptionLines != null
|
|
425
467
|
? descriptionLines === 1
|
|
426
468
|
? styles.descriptionSingleTruncate
|
|
427
469
|
: styles.descriptionMultiTruncate
|
|
428
|
-
: isStringDescription
|
|
470
|
+
: isStringDescription || isInline
|
|
429
471
|
? styles.descriptionSingleTruncate
|
|
430
472
|
: null;
|
|
431
473
|
|
|
@@ -434,6 +476,7 @@ export function Item({
|
|
|
434
476
|
<span
|
|
435
477
|
{...stylex.props(
|
|
436
478
|
styles.label,
|
|
479
|
+
isInline && styles.inlineLabel,
|
|
437
480
|
labelTruncateStyle,
|
|
438
481
|
labelLines != null &&
|
|
439
482
|
labelLines > 1 &&
|
|
@@ -445,6 +488,7 @@ export function Item({
|
|
|
445
488
|
<span
|
|
446
489
|
{...stylex.props(
|
|
447
490
|
styles.description,
|
|
491
|
+
isInline && styles.inlineDescription,
|
|
448
492
|
descriptionTruncateStyle,
|
|
449
493
|
descriptionLines != null &&
|
|
450
494
|
descriptionLines > 1 &&
|
|
@@ -481,6 +525,7 @@ export function Item({
|
|
|
481
525
|
<span
|
|
482
526
|
{...stylex.props(
|
|
483
527
|
styles.content,
|
|
528
|
+
isInline && styles.inlineContent,
|
|
484
529
|
isDisabled && styles.disabledContent,
|
|
485
530
|
)}>
|
|
486
531
|
{labelAndDescription}
|
|
@@ -494,6 +539,7 @@ export function Item({
|
|
|
494
539
|
tabIndex={isDisabled ? -1 : undefined}
|
|
495
540
|
{...stylex.props(
|
|
496
541
|
styles.invisibleAnchor,
|
|
542
|
+
isInline && styles.inlineContent,
|
|
497
543
|
isDisabled && styles.disabledContent,
|
|
498
544
|
)}>
|
|
499
545
|
{labelAndDescription}
|
|
@@ -505,6 +551,7 @@ export function Item({
|
|
|
505
551
|
disabled={isDisabled}
|
|
506
552
|
{...stylex.props(
|
|
507
553
|
styles.invisibleButton,
|
|
554
|
+
isInline && styles.inlineContent,
|
|
508
555
|
isDisabled && styles.disabledContent,
|
|
509
556
|
)}>
|
|
510
557
|
{labelAndDescription}
|
|
@@ -513,6 +560,7 @@ export function Item({
|
|
|
513
560
|
<span
|
|
514
561
|
{...stylex.props(
|
|
515
562
|
styles.content,
|
|
563
|
+
isInline && styles.inlineContent,
|
|
516
564
|
isDisabled && styles.disabledContent,
|
|
517
565
|
)}>
|
|
518
566
|
{labelAndDescription}
|
package/src/Layer/index.ts
CHANGED
|
@@ -29,6 +29,14 @@ export type {
|
|
|
29
29
|
FixedLayerReturn,
|
|
30
30
|
} from './useLayer';
|
|
31
31
|
|
|
32
|
+
// Shared touch behavior for the hover layers
|
|
33
|
+
export {useTouchTrigger, isActionTrigger} from './useTouchTrigger';
|
|
34
|
+
export type {
|
|
35
|
+
LayerTouchTrigger,
|
|
36
|
+
UseTouchTriggerOptions,
|
|
37
|
+
UseTouchTriggerReturn,
|
|
38
|
+
} from './useTouchTrigger';
|
|
39
|
+
|
|
32
40
|
// Layer provider
|
|
33
41
|
export {LayerProvider} from './LayerProvider';
|
|
34
42
|
export type {LayerProviderProps} from './LayerProvider';
|
|
@@ -50,6 +58,7 @@ export type {
|
|
|
50
58
|
export {useHoverCard, HoverCard} from '../HoverCard';
|
|
51
59
|
export type {
|
|
52
60
|
HoverCardFocusTrigger,
|
|
61
|
+
HoverCardTouchTrigger,
|
|
53
62
|
HoverCardOptions,
|
|
54
63
|
HoverCardReturn,
|
|
55
64
|
HoverCardProps,
|
|
@@ -59,6 +68,7 @@ export type {
|
|
|
59
68
|
export {useTooltip, Tooltip} from '../Tooltip';
|
|
60
69
|
export type {
|
|
61
70
|
TooltipFocusTrigger,
|
|
71
|
+
TooltipTouchTrigger,
|
|
62
72
|
TooltipOptions,
|
|
63
73
|
TooltipReturn,
|
|
64
74
|
TooltipProps,
|
package/src/Layer/useLayer.tsx
CHANGED
|
@@ -29,6 +29,7 @@ import {createPortal} from 'react-dom';
|
|
|
29
29
|
import {addAnchorName, removeAnchorName} from './anchorName';
|
|
30
30
|
import {resolveLayerPortalTarget} from './layerHost';
|
|
31
31
|
import {typeScaleVars, typographyVars} from '../theme/tokens.stylex';
|
|
32
|
+
import {overlayPaddingReset} from '../Layout/padding.stylex';
|
|
32
33
|
|
|
33
34
|
const styles = stylex.create({
|
|
34
35
|
// Base reset for all layers
|
|
@@ -771,7 +772,12 @@ export function useLayer(
|
|
|
771
772
|
: styles.offsetInline(toCssLength(offset))
|
|
772
773
|
: null;
|
|
773
774
|
|
|
774
|
-
const stylexResult = stylex.props(
|
|
775
|
+
const stylexResult = stylex.props(
|
|
776
|
+
styles.base,
|
|
777
|
+
overlayPaddingReset.reset,
|
|
778
|
+
offsetStyle,
|
|
779
|
+
xstyle,
|
|
780
|
+
);
|
|
775
781
|
const combinedClassName = extraClassName
|
|
776
782
|
? `${extraClassName} ${stylexResult.className ?? ''}`
|
|
777
783
|
: stylexResult.className;
|
|
@@ -835,7 +841,12 @@ export function useLayer(
|
|
|
835
841
|
left: x,
|
|
836
842
|
};
|
|
837
843
|
|
|
838
|
-
const stylexResult = stylex.props(
|
|
844
|
+
const stylexResult = stylex.props(
|
|
845
|
+
styles.base,
|
|
846
|
+
overlayPaddingReset.reset,
|
|
847
|
+
styles.fixed,
|
|
848
|
+
xstyle,
|
|
849
|
+
);
|
|
839
850
|
const combinedClassName = extraClassName
|
|
840
851
|
? `${extraClassName} ${stylexResult.className ?? ''}`
|
|
841
852
|
: stylexResult.className;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file useTouchTrigger.test.ts
|
|
5
|
+
* @input Uses vitest, isActionTrigger
|
|
6
|
+
* @output Unit tests for the action-trigger rule behind touchTrigger="auto"
|
|
7
|
+
* @position Testing; validates useTouchTrigger.ts implementation
|
|
8
|
+
*
|
|
9
|
+
* SYNC: When useTouchTrigger.ts changes, update tests to match new behavior
|
|
10
|
+
*
|
|
11
|
+
* The tap-versus-suppress decision rests entirely on this predicate, and it is
|
|
12
|
+
* the part a new element type silently falls through. The per-component tests
|
|
13
|
+
* (Tooltip.test.tsx, HoverCard.test.tsx) cover the gestures it feeds.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import {describe, it, expect} from 'vitest';
|
|
17
|
+
import {isActionTrigger} from './useTouchTrigger';
|
|
18
|
+
|
|
19
|
+
function element(html: string): HTMLElement {
|
|
20
|
+
const host = document.createElement('div');
|
|
21
|
+
host.innerHTML = html;
|
|
22
|
+
return host.firstElementChild as HTMLElement;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
describe('isActionTrigger', () => {
|
|
26
|
+
it.each([
|
|
27
|
+
['<button type="button">Save</button>'],
|
|
28
|
+
['<input type="text" />'],
|
|
29
|
+
['<select></select>'],
|
|
30
|
+
['<textarea></textarea>'],
|
|
31
|
+
['<summary>More</summary>'],
|
|
32
|
+
['<label>Name</label>'],
|
|
33
|
+
['<a href="/somewhere">Link</a>'],
|
|
34
|
+
])('treats %s as an action', html => {
|
|
35
|
+
expect(isActionTrigger(element(html))).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it.each([
|
|
39
|
+
['<span>Plain text</span>'],
|
|
40
|
+
['<svg></svg>'],
|
|
41
|
+
['<abbr title="what">WCAG</abbr>'],
|
|
42
|
+
// An anchor without href is a link that goes nowhere.
|
|
43
|
+
['<a>Not a link</a>'],
|
|
44
|
+
])('treats %s as inert', html => {
|
|
45
|
+
expect(isActionTrigger(element(html))).toBe(false);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('reads an explicit role over the tag it sits on', () => {
|
|
49
|
+
expect(isActionTrigger(element('<span role="button">Go</span>'))).toBe(
|
|
50
|
+
true,
|
|
51
|
+
);
|
|
52
|
+
// Scenery: the role says this button is not the control it looks like.
|
|
53
|
+
expect(
|
|
54
|
+
isActionTrigger(element('<button role="presentation">x</button>')),
|
|
55
|
+
).toBe(false);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('does not treat mere focusability as an action', () => {
|
|
59
|
+
// The wrapper a text-only Tooltip renders: reachable by keyboard so the
|
|
60
|
+
// hint is not mouse-only, and it still does nothing when activated.
|
|
61
|
+
expect(isActionTrigger(element('<span tabindex="0">Term</span>'))).toBe(
|
|
62
|
+
false,
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('treats a contenteditable surface as an action', () => {
|
|
67
|
+
const editable = element('<div contenteditable="true"></div>');
|
|
68
|
+
expect(isActionTrigger(editable)).toBe(true);
|
|
69
|
+
});
|
|
70
|
+
});
|