@astryxdesign/core 0.4.4 → 0.4.5-canary.013e728
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 +40 -0
- package/dist/AvatarGroup/AvatarGroupOverflow.js +1 -1
- package/dist/BottomSheet/BottomSheet.d.ts +11 -2
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +4 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts +5 -2
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +65 -15
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/BottomSheet/index.d.ts.map +1 -1
- package/dist/BottomSheet/snapOffsets.d.ts +57 -20
- package/dist/BottomSheet/snapOffsets.d.ts.map +1 -1
- package/dist/BottomSheet/snapOffsets.js +106 -30
- package/dist/BottomSheet/useSheetGestures.d.ts +13 -8
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +160 -64
- package/dist/Breadcrumbs/BreadcrumbItem.js +6 -6
- package/dist/Button/Button.js +5 -5
- package/dist/Calendar/Calendar.d.ts +17 -0
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +55 -15
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts +14 -0
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts.map +1 -0
- package/dist/Calendar/getStandaloneShortWeekdayNames.js +26 -0
- package/dist/Calendar/hooks/useCalendarConstraints.d.ts +22 -1
- package/dist/Calendar/hooks/useCalendarConstraints.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarConstraints.js +26 -4
- package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarDays.js +14 -10
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarNavigation.js +8 -4
- package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts +47 -0
- package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts.map +1 -0
- package/dist/Calendar/standaloneShortWeekdayNames.generated.js +40 -0
- package/dist/Calendar/styles.js +3 -3
- 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 +2 -2
- package/dist/Chat/ChatToolCalls.js +1 -1
- 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/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +9 -0
- package/dist/Citation/Citation.js +3 -3
- package/dist/ClickableCard/ClickableCard.js +2 -2
- package/dist/CommandPalette/CommandPaletteItem.js +1 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +8 -3
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +17 -9
- package/dist/DateRangeInput/DateRangeInput.d.ts +23 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +47 -9
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +18 -10
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/Field/FieldLabel.d.ts +2 -1
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +21 -3
- package/dist/Field/InputClearButton.d.ts +2 -1
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +12 -1
- package/dist/Field/inputStyles.stylex.d.ts.map +1 -1
- package/dist/Field/inputStyles.stylex.js +4 -4
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +2 -2
- package/dist/FormLayout/FormLayout.d.ts +24 -2
- package/dist/FormLayout/FormLayout.d.ts.map +1 -1
- package/dist/FormLayout/FormLayout.js +7 -2
- package/dist/FormLayout/FormLayoutContext.d.ts +15 -2
- package/dist/FormLayout/FormLayoutContext.d.ts.map +1 -1
- package/dist/FormLayout/FormLayoutContext.js +19 -4
- package/dist/FormLayout/index.d.ts +1 -1
- package/dist/FormLayout/index.d.ts.map +1 -1
- 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/Item/Item.d.ts +9 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +46 -8
- 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 +2 -1
- package/dist/Link/Link.js +4 -4
- package/dist/Markdown/Markdown.d.ts +8 -0
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +31 -3
- package/dist/Markdown/parser.d.ts +14 -2
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +50 -2
- 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 -3
- package/dist/NavItem/navItemStyles.stylex.d.ts +2 -2
- package/dist/NavItem/navItemStyles.stylex.js +2 -2
- package/dist/NavMenu/NavHeadingMenuItem.js +1 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +38 -5
- package/dist/Outline/Outline.js +2 -2
- package/dist/Outline/parseOutlineFromMarkdown.d.ts +2 -0
- package/dist/Outline/parseOutlineFromMarkdown.d.ts.map +1 -1
- package/dist/Outline/parseOutlineFromMarkdown.js +5 -31
- 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/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +12 -1
- package/dist/RadioList/RadioListItem.d.ts +2 -2
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +68 -38
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +3 -3
- 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 +6 -1
- package/dist/SelectableCard/SelectableCard.js +1 -1
- package/dist/Selector/Selector.d.ts +26 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +95 -17
- 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.js +1 -1
- package/dist/SideNav/SideNavItem.js +1 -1
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +3 -3
- 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/StatusDot/StatusDot.d.ts +43 -3
- package/dist/StatusDot/StatusDot.d.ts.map +1 -1
- package/dist/StatusDot/StatusDot.js +42 -5
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +9 -0
- package/dist/TabList/TabMenu.js +1 -1
- 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/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +7 -2
- 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.js +2 -2
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +6 -1
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +6 -1
- package/dist/Thumbnail/Thumbnail.js +1 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +6 -1
- 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/Token/Token.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.js +2 -2
- package/dist/TopNav/TopNavItem.js +2 -2
- package/dist/TopNav/TopNavMegaMenu.js +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +1 -1
- package/dist/TopNav/TopNavMenu.js +2 -2
- package/dist/TreeList/TreeListItem.js +1 -1
- package/dist/astryx.css +85 -60
- 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/useResolvedRequired.d.ts +19 -0
- package/dist/hooks/useResolvedRequired.d.ts.map +1 -0
- package/dist/hooks/useResolvedRequired.js +40 -0
- 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/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/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/plainDate.d.ts +9 -2
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +16 -4
- package/locales/af-ZA.json +958 -0
- package/locales/ar-SA.json +998 -0
- package/locales/ca-ES.json +974 -0
- package/locales/cs-CZ.json +990 -0
- package/locales/da-DK.json +966 -0
- package/locales/de-DE.json +966 -0
- package/locales/el-GR.json +990 -0
- package/locales/en.json +8 -0
- package/locales/es-ES.json +978 -0
- package/locales/fi-FI.json +990 -0
- package/locales/fr-FR.json +928 -0
- package/locales/he-IL.json +990 -0
- package/locales/hu-HU.json +990 -0
- package/locales/it-IT.json +978 -0
- package/locales/ja-JP.json +998 -0
- package/locales/ko-KR.json +990 -0
- package/locales/nl-NL.json +954 -0
- package/locales/no-NO.json +978 -0
- package/locales/pl-PL.json +982 -0
- package/locales/pseudo.json +6 -0
- package/locales/pt-BR.json +982 -0
- package/locales/pt-PT.json +982 -0
- package/locales/ro-RO.json +982 -0
- package/locales/ru-RU.json +990 -0
- package/locales/sr-SP.json +990 -0
- package/locales/sv-SE.json +986 -0
- package/locales/tr-TR.json +990 -0
- package/locales/uk-UA.json +990 -0
- package/locales/vi-VN.json +986 -0
- package/locales/zh-CN.json +998 -0
- package/locales/zh-TW.json +998 -0
- package/package.json +3 -3
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +1 -1
- package/src/Banner/Banner.doc.mjs +2 -0
- package/src/BottomSheet/BottomSheet.doc.mjs +36 -3
- package/src/BottomSheet/BottomSheet.test.tsx +177 -2
- package/src/BottomSheet/BottomSheet.tsx +16 -2
- package/src/BottomSheet/BottomSheetPanel.test.tsx +41 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +95 -15
- package/src/BottomSheet/index.ts +5 -1
- package/src/BottomSheet/snapOffsets.test.ts +114 -47
- package/src/BottomSheet/snapOffsets.ts +119 -33
- package/src/BottomSheet/useSheetGestures.test.ts +113 -15
- package/src/BottomSheet/useSheetGestures.ts +196 -100
- package/src/Breadcrumbs/BreadcrumbItem.tsx +1 -1
- package/src/Button/Button.tsx +7 -7
- package/src/Calendar/Calendar.doc.mjs +16 -0
- package/src/Calendar/Calendar.test.tsx +137 -0
- package/src/Calendar/Calendar.tsx +80 -11
- package/src/Calendar/getStandaloneShortWeekdayNames.test.ts +54 -0
- package/src/Calendar/getStandaloneShortWeekdayNames.ts +38 -0
- package/src/Calendar/hooks/useCalendarConstraints.ts +54 -3
- package/src/Calendar/hooks/useCalendarDays.ts +13 -10
- package/src/Calendar/hooks/useCalendarNavigation.ts +6 -4
- package/src/Calendar/standaloneShortWeekdayNames.generated.ts +50 -0
- package/src/Calendar/styles.ts +3 -3
- 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 +7 -4
- package/src/Chat/ChatToolCalls.tsx +1 -1
- 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/CheckboxInput/CheckboxInput.tsx +6 -0
- package/src/Citation/Citation.tsx +3 -3
- package/src/ClickableCard/ClickableCard.tsx +2 -2
- package/src/CommandPalette/CommandPaletteItem.tsx +1 -1
- package/src/ComplexSelector/ComplexSelector.doc.mjs +10 -0
- package/src/ComplexSelector/ComplexSelector.tsx +8 -5
- package/src/DateInput/DateInput.test.tsx +17 -1
- package/src/DateInput/DateInput.tsx +13 -9
- package/src/DateRangeInput/DateRangeInput.doc.mjs +16 -0
- package/src/DateRangeInput/DateRangeInput.test.tsx +81 -1
- package/src/DateRangeInput/DateRangeInput.tsx +88 -8
- package/src/DateTimeInput/DateTimeInput.tsx +23 -8
- package/src/Dialog/Dialog.test.tsx +24 -0
- package/src/Dialog/Dialog.tsx +3 -0
- package/src/Field/Field.doc.mjs +3 -0
- package/src/Field/FieldLabel.tsx +20 -4
- package/src/Field/InputClearButton.test.tsx +134 -2
- package/src/Field/InputClearButton.tsx +42 -1
- package/src/Field/inputStyles.stylex.ts +16 -12
- package/src/FileInput/FileInput.tsx +5 -4
- package/src/FormLayout/FormLayout.doc.mjs +13 -0
- package/src/FormLayout/FormLayout.test.tsx +181 -4
- package/src/FormLayout/FormLayout.tsx +33 -2
- package/src/FormLayout/FormLayoutContext.ts +22 -7
- package/src/FormLayout/index.ts +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/Item/Item.doc.mjs +1 -0
- package/src/Item/Item.test.tsx +50 -0
- package/src/Item/Item.tsx +41 -2
- 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 +2 -1
- package/src/Link/Link.tsx +4 -4
- package/src/Markdown/Markdown.doc.mjs +3 -0
- package/src/Markdown/Markdown.test.tsx +78 -0
- package/src/Markdown/Markdown.tsx +41 -1
- package/src/Markdown/parser.ts +60 -2
- 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 +8 -5
- package/src/NavItem/navItemStyles.stylex.ts +2 -2
- package/src/NavMenu/NavHeadingMenuItem.tsx +1 -1
- package/src/NumberInput/NumberInput.doc.mjs +24 -0
- package/src/NumberInput/NumberInput.test.tsx +138 -0
- package/src/NumberInput/NumberInput.tsx +44 -6
- package/src/Outline/Outline.doc.mjs +2 -0
- package/src/Outline/Outline.tsx +1 -1
- package/src/Outline/parseOutlineFromMarkdown.ts +10 -40
- 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/RadioList.tsx +9 -1
- package/src/RadioList/RadioListItem.tsx +83 -51
- package/src/Resizable/ResizeHandle.test.tsx +22 -0
- package/src/Resizable/ResizeHandle.tsx +9 -3
- 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 +11 -2
- package/src/SelectableCard/SelectableCard.tsx +1 -1
- package/src/Selector/Selector.doc.mjs +16 -2
- package/src/Selector/Selector.test.tsx +525 -1
- package/src/Selector/Selector.tsx +166 -21
- 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 +2 -2
- package/src/SideNav/SideNavItem.tsx +1 -1
- package/src/Slider/Slider.tsx +11 -1
- 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/StatusDot/StatusDot.doc.mjs +13 -0
- package/src/StatusDot/StatusDot.test.tsx +115 -8
- package/src/StatusDot/StatusDot.tsx +74 -9
- package/src/Switch/Switch.tsx +6 -0
- package/src/TabList/TabMenu.tsx +1 -1
- package/src/Table/TableRow.tsx +4 -4
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +2 -1
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +2 -1
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +22 -4
- 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 +2 -2
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextArea/TextArea.tsx +3 -1
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/Thumbnail/Thumbnail.tsx +1 -1
- package/src/TimeInput/TimeInput.tsx +3 -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/Token/Token.tsx +1 -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 +1 -1
- package/src/TopNav/TopNavItem.tsx +2 -2
- package/src/TopNav/TopNavMegaMenu.tsx +1 -1
- package/src/TopNav/TopNavMegaMenuItem.tsx +1 -1
- package/src/TopNav/TopNavMenu.tsx +2 -2
- package/src/TreeList/TreeListItem.tsx +1 -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/useResolvedRequired.ts +42 -0
- 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/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/utils/dateParser.test.ts +20 -0
- package/src/utils/dateParser.ts +14 -7
- package/src/utils/plainDate.test.ts +56 -0
- package/src/utils/plainDate.ts +17 -4
|
@@ -112,10 +112,10 @@ function getWallClock(date, timeZone) {
|
|
|
112
112
|
/**
|
|
113
113
|
* Renders one instant in one absolute format.
|
|
114
114
|
*
|
|
115
|
-
* Pure: the same arguments always produce the same string for
|
|
115
|
+
* Pure: the same arguments always produce the same string for the requested
|
|
116
116
|
* locale (and, when no `timeZone` is given, host zone).
|
|
117
117
|
*/
|
|
118
|
-
export function formatInstant(date, format, {
|
|
118
|
+
export function formatInstant(date, format, locale, {
|
|
119
119
|
timeZone,
|
|
120
120
|
isTimezoneShown = false,
|
|
121
121
|
timeZoneNameStyle = 'short'
|
|
@@ -128,34 +128,34 @@ export function formatInstant(date, format, {
|
|
|
128
128
|
} : {};
|
|
129
129
|
switch (format) {
|
|
130
130
|
case 'full':
|
|
131
|
-
return new Intl.DateTimeFormat(
|
|
131
|
+
return new Intl.DateTimeFormat(locale, {
|
|
132
132
|
...FULL_OPTIONS,
|
|
133
133
|
timeZoneName: timeZoneNameStyle,
|
|
134
134
|
...zone
|
|
135
135
|
}).format(date);
|
|
136
136
|
case 'date':
|
|
137
|
-
return new Intl.DateTimeFormat(
|
|
137
|
+
return new Intl.DateTimeFormat(locale, {
|
|
138
138
|
...SHARED_DATE_FORMAT_OPTIONS.date,
|
|
139
139
|
...zone
|
|
140
140
|
}).format(date);
|
|
141
141
|
case 'date_long':
|
|
142
|
-
return new Intl.DateTimeFormat(
|
|
142
|
+
return new Intl.DateTimeFormat(locale, {
|
|
143
143
|
...SHARED_DATE_FORMAT_OPTIONS.date_long,
|
|
144
144
|
...zone
|
|
145
145
|
}).format(date);
|
|
146
146
|
case 'date_weekday':
|
|
147
|
-
return new Intl.DateTimeFormat(
|
|
147
|
+
return new Intl.DateTimeFormat(locale, {
|
|
148
148
|
...SHARED_DATE_FORMAT_OPTIONS.date_weekday,
|
|
149
149
|
...zone
|
|
150
150
|
}).format(date);
|
|
151
151
|
case 'date_time':
|
|
152
|
-
return new Intl.DateTimeFormat(
|
|
152
|
+
return new Intl.DateTimeFormat(locale, {
|
|
153
153
|
...DATE_TIME_OPTIONS,
|
|
154
154
|
...zoneName,
|
|
155
155
|
...zone
|
|
156
156
|
}).format(date);
|
|
157
157
|
case 'time':
|
|
158
|
-
return new Intl.DateTimeFormat(
|
|
158
|
+
return new Intl.DateTimeFormat(locale, {
|
|
159
159
|
...TIME_OPTIONS,
|
|
160
160
|
...zoneName,
|
|
161
161
|
...zone
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { InstantFormat } from './formatInstant';
|
|
2
|
+
import type { Locale } from '../i18n/types';
|
|
2
3
|
/**
|
|
3
4
|
* Formats available to a tooltip line.
|
|
4
5
|
*
|
|
@@ -67,5 +68,5 @@ export interface TimestampTooltipLine {
|
|
|
67
68
|
* Pure: the same `date` and `entries` always produce the same lines for a given
|
|
68
69
|
* host zone and locale.
|
|
69
70
|
*/
|
|
70
|
-
export declare function formatTooltipLines(date: Date, entries: ReadonlyArray<TimestampTooltipEntry
|
|
71
|
+
export declare function formatTooltipLines(date: Date, entries: ReadonlyArray<TimestampTooltipEntry>, locale: Locale): ReadonlyArray<TimestampTooltipLine>;
|
|
71
72
|
//# sourceMappingURL=tooltipEntries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltipEntries.d.ts","sourceRoot":"","sources":["../../src/Timestamp/tooltipEntries.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"tooltipEntries.d.ts","sourceRoot":"","sources":["../../src/Timestamp/tooltipEntries.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAM1C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEnD,yCAAyC;AACzC,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,+BAA+B;AAC/B,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;CACrB;AAuGD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,aAAa,CAAC,qBAAqB,CAAC,EAC7C,MAAM,EAAE,MAAM,GACb,aAAa,CAAC,oBAAoB,CAAC,CAqBrC"}
|
|
@@ -82,7 +82,9 @@ function resolveTimezoneID(timezoneID) {
|
|
|
82
82
|
// degrade to the viewer's zone and say so, mirroring how an unparseable
|
|
83
83
|
// `value` is handled in Timestamp.tsx.
|
|
84
84
|
try {
|
|
85
|
-
|
|
85
|
+
// Locale does not affect time-zone identifier validity; pin one so this
|
|
86
|
+
// validation path stays explicit and deterministic.
|
|
87
|
+
new Intl.DateTimeFormat('en-US', {
|
|
86
88
|
timeZone: timezoneID
|
|
87
89
|
});
|
|
88
90
|
} catch {
|
|
@@ -145,7 +147,7 @@ function shouldShowZoneName(format, hasMultipleZones, isNamedZone) {
|
|
|
145
147
|
* Pure: the same `date` and `entries` always produce the same lines for a given
|
|
146
148
|
* host zone and locale.
|
|
147
149
|
*/
|
|
148
|
-
export function formatTooltipLines(date, entries) {
|
|
150
|
+
export function formatTooltipLines(date, entries, locale) {
|
|
149
151
|
const resolved = entries.map(entry => resolveTimezoneID(entry.timezoneID));
|
|
150
152
|
const hasMultipleZones = new Set(resolved.map(zoneKey)).size > 1;
|
|
151
153
|
return entries.map((entry, index) => {
|
|
@@ -156,7 +158,7 @@ export function formatTooltipLines(date, entries) {
|
|
|
156
158
|
label: entry.label
|
|
157
159
|
}),
|
|
158
160
|
isCopyable: entry.isCopyable ?? false,
|
|
159
|
-
value: formatInstant(date, format, {
|
|
161
|
+
value: formatInstant(date, format, locale, {
|
|
160
162
|
timeZone,
|
|
161
163
|
isTimezoneShown: shouldShowZoneName(format, hasMultipleZones, timeZone !== undefined)
|
|
162
164
|
})
|
package/dist/Token/Token.js
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
* - /packages/cli/assets/templates/blocks/components/Tooltip/ (showcase blocks)
|
|
11
11
|
*/
|
|
12
12
|
import React, { type ReactElement, type ReactNode } from 'react';
|
|
13
|
-
import { type TooltipFocusTrigger } from './useTooltip';
|
|
13
|
+
import { type TooltipFocusTrigger, type TooltipTouchTrigger } from './useTooltip';
|
|
14
14
|
import type { LayerAlignment, LayerPlacement } from '../Layer/useLayer';
|
|
15
|
-
export type { TooltipFocusTrigger } from './useTooltip';
|
|
15
|
+
export type { TooltipFocusTrigger, TooltipTouchTrigger } from './useTooltip';
|
|
16
16
|
export interface TooltipProps {
|
|
17
17
|
/**
|
|
18
18
|
* The trigger element(s). Children refs are preserved.
|
|
@@ -61,6 +61,19 @@ export interface TooltipProps {
|
|
|
61
61
|
* @default 'auto'
|
|
62
62
|
*/
|
|
63
63
|
focusTrigger?: TooltipFocusTrigger;
|
|
64
|
+
/**
|
|
65
|
+
* What a tap does on a touch pointer, where there is no hover:
|
|
66
|
+
* - `auto`: tap opens the tooltip, unless the trigger performs an action of
|
|
67
|
+
* its own (a button, a link, a form control) — that tap belongs to the
|
|
68
|
+
* control, and a hint about a control the user just operated is noise
|
|
69
|
+
* - `tap`: tap always opens the tooltip. This is what an info icon rendered
|
|
70
|
+
* as a button wants: it looks like an action to the DOM, but revealing the
|
|
71
|
+
* tooltip is the only thing it does
|
|
72
|
+
* - `none`: touch never opens the tooltip
|
|
73
|
+
*
|
|
74
|
+
* @default 'auto'
|
|
75
|
+
*/
|
|
76
|
+
touchTrigger?: TooltipTouchTrigger;
|
|
64
77
|
/**
|
|
65
78
|
* Whether the tooltip is enabled.
|
|
66
79
|
* When false, hover/focus triggers are disabled.
|
|
@@ -109,7 +122,7 @@ export interface TooltipProps {
|
|
|
109
122
|
* </Tooltip>
|
|
110
123
|
* ```
|
|
111
124
|
*/
|
|
112
|
-
export declare function Tooltip({ children, anchorRef, content, placement, alignment, delay, hideDelay, focusTrigger, isEnabled, onOpenChange, hasHoverIndication, isOpen, isDefaultOpen, }: TooltipProps): ReactElement;
|
|
125
|
+
export declare function Tooltip({ children, anchorRef, content, placement, alignment, delay, hideDelay, focusTrigger, touchTrigger, isEnabled, onOpenChange, hasHoverIndication, isOpen, isDefaultOpen, }: TooltipProps): ReactElement;
|
|
113
126
|
export declare namespace Tooltip {
|
|
114
127
|
var displayName: string;
|
|
115
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,EAGZ,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,EAGZ,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAGtE,YAAY,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAiB3E,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAEhD;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAEnC;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAEnC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAEzC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEtC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAiBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,SAAS,EACT,OAAO,EACP,SAAmB,EACnB,SAAoB,EACpB,KAAW,EACX,SAAa,EACb,YAAqB,EACrB,YAAqB,EACrB,SAAgB,EAChB,YAAY,EACZ,kBAA2B,EAC3B,MAAM,EACN,aAAa,GACd,EAAE,YAAY,GAAG,YAAY,CAsI7B;yBArJe,OAAO"}
|
package/dist/Tooltip/Tooltip.js
CHANGED
|
@@ -58,6 +58,7 @@ export function Tooltip({
|
|
|
58
58
|
delay = 200,
|
|
59
59
|
hideDelay = 0,
|
|
60
60
|
focusTrigger = 'auto',
|
|
61
|
+
touchTrigger = 'auto',
|
|
61
62
|
isEnabled = true,
|
|
62
63
|
onOpenChange,
|
|
63
64
|
hasHoverIndication = 'auto',
|
|
@@ -83,6 +84,7 @@ export function Tooltip({
|
|
|
83
84
|
delay,
|
|
84
85
|
hideDelay,
|
|
85
86
|
focusTrigger,
|
|
87
|
+
touchTrigger,
|
|
86
88
|
isEnabled,
|
|
87
89
|
isOpen,
|
|
88
90
|
isDefaultOpen,
|
package/dist/Tooltip/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* SYNC: When adding new Tooltip files, update exports here
|
|
8
8
|
*/
|
|
9
9
|
export { useTooltip } from './useTooltip';
|
|
10
|
-
export type { TooltipFocusTrigger, TooltipOptions, TooltipReturn, } from './useTooltip';
|
|
10
|
+
export type { TooltipFocusTrigger, TooltipTouchTrigger, TooltipOptions, TooltipReturn, } from './useTooltip';
|
|
11
11
|
export { Tooltip } from './Tooltip';
|
|
12
12
|
export type { TooltipProps } from './Tooltip';
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Tooltip/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAGH,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,YAAY,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Tooltip/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAGH,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,YAAY,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file useTooltip.tsx
|
|
3
|
-
* @input Uses useLayer, React hooks
|
|
4
|
-
* @output Exports useTooltip hook for hover/focus triggered tooltips
|
|
3
|
+
* @input Uses useLayer, useTouchTrigger, React hooks
|
|
4
|
+
* @output Exports useTooltip hook for hover/focus/tap triggered tooltips
|
|
5
5
|
* @position Layer hook; builds on useLayer for tooltip behavior
|
|
6
6
|
*
|
|
7
7
|
* SYNC: When modified, update:
|
|
@@ -9,10 +9,15 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { type ReactNode, type RefCallback } from 'react';
|
|
11
11
|
import { type ContextRenderProps, type LayerAlignment, type LayerPlacement } from '../Layer/useLayer';
|
|
12
|
+
import { type LayerTouchTrigger } from '../Layer/useTouchTrigger';
|
|
12
13
|
/**
|
|
13
14
|
* Focus trigger behavior for tooltips
|
|
14
15
|
*/
|
|
15
16
|
export type TooltipFocusTrigger = 'auto' | 'always' | 'never';
|
|
17
|
+
/**
|
|
18
|
+
* Touch trigger behavior for tooltips
|
|
19
|
+
*/
|
|
20
|
+
export type TooltipTouchTrigger = LayerTouchTrigger;
|
|
16
21
|
export interface TooltipOptions {
|
|
17
22
|
/**
|
|
18
23
|
* Position placement relative to anchor
|
|
@@ -43,6 +48,19 @@ export interface TooltipOptions {
|
|
|
43
48
|
* @default 'auto'
|
|
44
49
|
*/
|
|
45
50
|
focusTrigger?: TooltipFocusTrigger;
|
|
51
|
+
/**
|
|
52
|
+
* What a tap does on a touch pointer, where there is no hover:
|
|
53
|
+
* - `auto`: tap opens the tooltip, unless the trigger performs an action of
|
|
54
|
+
* its own (a button, a link, a form control) — that tap belongs to the
|
|
55
|
+
* control, and a hint about a control the user just operated is noise
|
|
56
|
+
* - `tap`: tap always opens the tooltip. This is what an info icon rendered
|
|
57
|
+
* as a button wants: it looks like an action to the DOM, but revealing the
|
|
58
|
+
* tooltip is the only thing it does
|
|
59
|
+
* - `none`: touch never opens the tooltip
|
|
60
|
+
*
|
|
61
|
+
* @default 'auto'
|
|
62
|
+
*/
|
|
63
|
+
touchTrigger?: TooltipTouchTrigger;
|
|
46
64
|
/**
|
|
47
65
|
* Whether the tooltip is enabled.
|
|
48
66
|
* When false, hover/focus triggers are disabled.
|
|
@@ -116,6 +134,7 @@ export interface TooltipReturn {
|
|
|
116
134
|
* Builds on useLayer to add:
|
|
117
135
|
* - Hover triggers with configurable delay
|
|
118
136
|
* - Focus triggers with auto-detection for focusable elements
|
|
137
|
+
* - Tap triggers on touch, where there is no hover (see useTouchTrigger)
|
|
119
138
|
* - Inverted color palette for high contrast
|
|
120
139
|
*
|
|
121
140
|
* Unlike HoverCard, tooltips:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip.d.ts","sourceRoot":"","sources":["../../src/Tooltip/useTooltip.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"useTooltip.d.ts","sourceRoot":"","sources":["../../src/Tooltip/useTooltip.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AA2ClC;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAEpD,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAEnC;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAEnC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAE9B;;;OAGG;IACH,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAEtC;;;;OAIG;IACH,cAAc,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAEzC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,aAAa,EAAE,CACb,QAAQ,EAAE,SAAS,EACnB,KAAK,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,aAAa,CAAC,KAC5C,SAAS,CAAC;CAChB;AAyBD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,cAAmB,GAAG,aAAa,CAsUtE"}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useTooltip.tsx
|
|
7
|
-
* @input Uses useLayer, React hooks
|
|
8
|
-
* @output Exports useTooltip hook for hover/focus triggered tooltips
|
|
7
|
+
* @input Uses useLayer, useTouchTrigger, React hooks
|
|
8
|
+
* @output Exports useTooltip hook for hover/focus/tap triggered tooltips
|
|
9
9
|
* @position Layer hook; builds on useLayer for tooltip behavior
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update:
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { useCallback, useEffect, useRef } from 'react';
|
|
15
15
|
import * as stylex from '@stylexjs/stylex';
|
|
16
16
|
import { useLayer } from "../Layer/useLayer.js";
|
|
17
|
+
import { useTouchTrigger } from "../Layer/useTouchTrigger.js";
|
|
17
18
|
import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
|
|
18
19
|
import { themeProps } from "../utils/themeProps.js";
|
|
19
20
|
import { isImeKeyEvent } from "../utils/ime.js";
|
|
@@ -43,6 +44,10 @@ const styles = {
|
|
|
43
44
|
* Focus trigger behavior for tooltips
|
|
44
45
|
*/
|
|
45
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Touch trigger behavior for tooltips
|
|
49
|
+
*/
|
|
50
|
+
|
|
46
51
|
/**
|
|
47
52
|
* Check if an element is naturally focusable
|
|
48
53
|
*/
|
|
@@ -71,6 +76,7 @@ function isFocusable(element) {
|
|
|
71
76
|
* Builds on useLayer to add:
|
|
72
77
|
* - Hover triggers with configurable delay
|
|
73
78
|
* - Focus triggers with auto-detection for focusable elements
|
|
79
|
+
* - Tap triggers on touch, where there is no hover (see useTouchTrigger)
|
|
74
80
|
* - Inverted color palette for high contrast
|
|
75
81
|
*
|
|
76
82
|
* Unlike HoverCard, tooltips:
|
|
@@ -95,6 +101,7 @@ export function useTooltip(options = {}) {
|
|
|
95
101
|
delay = 200,
|
|
96
102
|
hideDelay = 0,
|
|
97
103
|
focusTrigger = 'auto',
|
|
104
|
+
touchTrigger = 'auto',
|
|
98
105
|
isEnabled = true,
|
|
99
106
|
isOpen,
|
|
100
107
|
isDefaultOpen = false,
|
|
@@ -123,6 +130,27 @@ export function useTooltip(options = {}) {
|
|
|
123
130
|
}
|
|
124
131
|
}, []);
|
|
125
132
|
|
|
133
|
+
// Touch resolves immediately: the hover delays exist to filter out a pointer
|
|
134
|
+
// passing across the trigger, and a tap is never that.
|
|
135
|
+
const showNow = useCallback(() => {
|
|
136
|
+
clearTimeouts();
|
|
137
|
+
layer.show();
|
|
138
|
+
}, [clearTimeouts, layer]);
|
|
139
|
+
const hideNow = useCallback(() => {
|
|
140
|
+
clearTimeouts();
|
|
141
|
+
layer.hide();
|
|
142
|
+
}, [clearTimeouts, layer]);
|
|
143
|
+
const touch = useTouchTrigger({
|
|
144
|
+
touchTrigger,
|
|
145
|
+
isEnabled,
|
|
146
|
+
isControlled: isOpen !== undefined,
|
|
147
|
+
isOpen: layer.isOpen,
|
|
148
|
+
layerId: layer.id,
|
|
149
|
+
triggerRef,
|
|
150
|
+
show: showNow,
|
|
151
|
+
hide: hideNow
|
|
152
|
+
});
|
|
153
|
+
|
|
126
154
|
// Schedule show with delay (suppressed when isOpen is false)
|
|
127
155
|
const scheduleShow = useCallback(() => {
|
|
128
156
|
if (!isEnabled || isOpen === false) {
|
|
@@ -159,19 +187,35 @@ export function useTooltip(options = {}) {
|
|
|
159
187
|
|
|
160
188
|
// Event handlers
|
|
161
189
|
const handleMouseEnter = useCallback(() => {
|
|
162
|
-
//
|
|
163
|
-
|
|
190
|
+
// A tap synthesizes mouseenter. On touch the tap path owns the decision,
|
|
191
|
+
// so hover must not also fire — including the tap that just opened the
|
|
192
|
+
// tooltip, which would otherwise be double-handled.
|
|
193
|
+
if (touch.isTouchPointerRef.current) {
|
|
164
194
|
return;
|
|
165
195
|
}
|
|
166
196
|
scheduleShow();
|
|
167
|
-
}, [scheduleShow]);
|
|
197
|
+
}, [touch, scheduleShow]);
|
|
168
198
|
const handleMouseLeave = useCallback(() => {
|
|
199
|
+
// On touch the synthesized mouseleave arrives with the next tap elsewhere,
|
|
200
|
+
// which the outside-tap dismissal already handles — and handling it here
|
|
201
|
+
// too would close the tooltip behind the tap-open bookkeeping's back.
|
|
202
|
+
if (touch.isTouchPointerRef.current) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
169
205
|
scheduleHide();
|
|
170
|
-
}, [scheduleHide]);
|
|
206
|
+
}, [touch, scheduleHide]);
|
|
171
207
|
const handleFocusIn = useCallback(e => {
|
|
172
208
|
if (!isEnabled) {
|
|
173
209
|
return;
|
|
174
210
|
}
|
|
211
|
+
// A tap focuses the trigger it activates, and `:focus-visible` does not
|
|
212
|
+
// filter that out on every element: a tapped `<input>` or contenteditable
|
|
213
|
+
// matches it. Those are exactly the action triggers `auto` just decided
|
|
214
|
+
// to keep shut, so without this the focus reopens what the tap
|
|
215
|
+
// suppressed, over the field the user is trying to type into.
|
|
216
|
+
if (touch.isTouchInteraction()) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
175
219
|
// Only show tooltip for keyboard focus (:focus-visible),
|
|
176
220
|
// not programmatic focus (e.g. dialog auto-focus, touch tap)
|
|
177
221
|
const target = e.target;
|
|
@@ -180,7 +224,7 @@ export function useTooltip(options = {}) {
|
|
|
180
224
|
}
|
|
181
225
|
clearTimeouts();
|
|
182
226
|
layer.show();
|
|
183
|
-
}, [isEnabled, clearTimeouts, layer]);
|
|
227
|
+
}, [isEnabled, touch, clearTimeouts, layer]);
|
|
184
228
|
const handleFocusOut = useCallback(() => {
|
|
185
229
|
scheduleHide();
|
|
186
230
|
}, [scheduleHide]);
|
|
@@ -190,15 +234,24 @@ export function useTooltip(options = {}) {
|
|
|
190
234
|
// just-pressed control reads as stale. Fires on pointerdown so it feels
|
|
191
235
|
// immediate. Uncontrolled tooltips only — a controlled tooltip's visibility
|
|
192
236
|
// is owned by the consumer. `layer.hide()` self-guards when already closed.
|
|
193
|
-
|
|
237
|
+
// A touch press is a different gesture (it may be the only way to open the
|
|
238
|
+
// tooltip at all), so the touch path answers it first.
|
|
239
|
+
const handlePointerDown = useCallback(event => {
|
|
240
|
+
if (touch.handlePointerDown(event)) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
194
243
|
if (isOpen !== undefined) {
|
|
195
244
|
return;
|
|
196
245
|
}
|
|
197
246
|
clearTimeouts();
|
|
198
247
|
layer.hide();
|
|
199
|
-
}, [isOpen, clearTimeouts, layer]);
|
|
248
|
+
}, [touch, isOpen, clearTimeouts, layer]);
|
|
200
249
|
|
|
201
250
|
// Interaction ref that handles event listeners only
|
|
251
|
+
const {
|
|
252
|
+
handlePointerEnter,
|
|
253
|
+
clearTapOpen
|
|
254
|
+
} = touch;
|
|
202
255
|
const interactionRef = useCallback(el => {
|
|
203
256
|
// Cleanup previous element
|
|
204
257
|
if (triggerRef.current) {
|
|
@@ -206,13 +259,17 @@ export function useTooltip(options = {}) {
|
|
|
206
259
|
triggerRef.current.removeEventListener('mouseleave', handleMouseLeave);
|
|
207
260
|
triggerRef.current.removeEventListener('focusin', handleFocusIn);
|
|
208
261
|
triggerRef.current.removeEventListener('focusout', handleFocusOut);
|
|
262
|
+
triggerRef.current.removeEventListener('pointerenter', handlePointerEnter);
|
|
209
263
|
triggerRef.current.removeEventListener('pointerdown', handlePointerDown);
|
|
210
264
|
}
|
|
211
265
|
if (el) {
|
|
212
|
-
// Attach hover listeners
|
|
266
|
+
// Attach hover listeners. `pointerenter` runs before the synthesized
|
|
267
|
+
// `mouseenter` a tap produces, which is what lets the hover path know
|
|
268
|
+
// it is looking at a finger.
|
|
269
|
+
el.addEventListener('pointerenter', handlePointerEnter);
|
|
213
270
|
el.addEventListener('mouseenter', handleMouseEnter);
|
|
214
271
|
el.addEventListener('mouseleave', handleMouseLeave);
|
|
215
|
-
// Press-to-dismiss
|
|
272
|
+
// Press-to-dismiss on a mouse; tap-to-open on a touch pointer.
|
|
216
273
|
el.addEventListener('pointerdown', handlePointerDown);
|
|
217
274
|
|
|
218
275
|
// Attach focus listeners based on focusTrigger option
|
|
@@ -223,7 +280,7 @@ export function useTooltip(options = {}) {
|
|
|
223
280
|
}
|
|
224
281
|
}
|
|
225
282
|
triggerRef.current = el;
|
|
226
|
-
}, [focusTrigger, handleMouseEnter, handleMouseLeave, handleFocusIn, handleFocusOut, handlePointerDown]);
|
|
283
|
+
}, [focusTrigger, handleMouseEnter, handleMouseLeave, handleFocusIn, handleFocusOut, handlePointerEnter, handlePointerDown]);
|
|
227
284
|
|
|
228
285
|
// Combined ref - shorthand for calling both positionRef and interactionRef
|
|
229
286
|
const ref = useCallback(el => {
|
|
@@ -280,13 +337,14 @@ export function useTooltip(options = {}) {
|
|
|
280
337
|
return;
|
|
281
338
|
}
|
|
282
339
|
clearTimeouts();
|
|
340
|
+
clearTapOpen();
|
|
283
341
|
layer.hide();
|
|
284
342
|
};
|
|
285
343
|
document.addEventListener('keydown', handleKeyDown);
|
|
286
344
|
return () => {
|
|
287
345
|
document.removeEventListener('keydown', handleKeyDown);
|
|
288
346
|
};
|
|
289
|
-
}, [isOpen, layer, clearTimeouts]);
|
|
347
|
+
}, [isOpen, layer, clearTimeouts, clearTapOpen]);
|
|
290
348
|
|
|
291
349
|
// Render function that wraps layer.render with tooltip styling
|
|
292
350
|
const renderTooltip = useCallback((children, props) => {
|
|
@@ -330,7 +330,7 @@ export function TopNavHeading({
|
|
|
330
330
|
},
|
|
331
331
|
...popover.triggerProps,
|
|
332
332
|
...{
|
|
333
|
-
className: "x2lah0s x78zum5 x6s0dn4 xl56j7k xy8csz5 ximsjs8 xv9yike x1ypdohk xh6dtrn xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x1sodnla x1yc453h
|
|
333
|
+
className: "x2lah0s x78zum5 x6s0dn4 xl56j7k xy8csz5 ximsjs8 xv9yike x1ypdohk xh6dtrn xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x1sodnla x1yc453h xoevpu5"
|
|
334
334
|
},
|
|
335
335
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
336
336
|
icon: "chevronDown",
|
|
@@ -397,7 +397,7 @@ export function TopNavHeading({
|
|
|
397
397
|
},
|
|
398
398
|
...popover.triggerProps,
|
|
399
399
|
...{
|
|
400
|
-
className: "x2lah0s x78zum5 x6s0dn4 xl56j7k xy8csz5 ximsjs8 xv9yike x1ypdohk xh6dtrn xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x1sodnla x1yc453h
|
|
400
|
+
className: "x2lah0s x78zum5 x6s0dn4 xl56j7k xy8csz5 ximsjs8 xv9yike x1ypdohk xh6dtrn xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x1sodnla x1yc453h xoevpu5"
|
|
401
401
|
},
|
|
402
402
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
403
403
|
icon: "chevronDown",
|
|
@@ -47,13 +47,13 @@ const styles = {
|
|
|
47
47
|
k1ekBW: "xs2xxs2",
|
|
48
48
|
kIyJzY: "xuedmi6",
|
|
49
49
|
kAMwcw: "xlr8y92",
|
|
50
|
-
kWkggS: "xjbqb8w
|
|
50
|
+
kWkggS: "xjbqb8w xoevpu5 xyxi2l3",
|
|
51
51
|
$$css: true
|
|
52
52
|
},
|
|
53
53
|
selected: {
|
|
54
54
|
kMwMTN: "x1tgivj0",
|
|
55
55
|
k63SB2: "x2mo6ok",
|
|
56
|
-
kWkggS: "x17x4s8c
|
|
56
|
+
kWkggS: "x17x4s8c xcu6dpe xjtnuge",
|
|
57
57
|
$$css: true
|
|
58
58
|
},
|
|
59
59
|
iconOnly: {
|
|
@@ -54,7 +54,7 @@ const styles = {
|
|
|
54
54
|
k1ekBW: "xs2xxs2",
|
|
55
55
|
kIyJzY: "xuedmi6",
|
|
56
56
|
kAMwcw: "xlr8y92",
|
|
57
|
-
kWkggS: "xjbqb8w
|
|
57
|
+
kWkggS: "xjbqb8w xoevpu5",
|
|
58
58
|
kMv6JI: "xjb2p0i",
|
|
59
59
|
$$css: true
|
|
60
60
|
},
|
|
@@ -90,7 +90,7 @@ const styles = {
|
|
|
90
90
|
k1ekBW: "x15406qy",
|
|
91
91
|
kIyJzY: "xuedmi6",
|
|
92
92
|
kAMwcw: "xlr8y92",
|
|
93
|
-
kWkggS: "xjbqb8w
|
|
93
|
+
kWkggS: "xjbqb8w xoevpu5",
|
|
94
94
|
$$css: true
|
|
95
95
|
}
|
|
96
96
|
};
|