@astryxdesign/core 0.7.17 → 0.7.18-canary.g170df15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +7 -0
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +5 -3
- package/dist/AppShell/observeMainOverflow.d.ts +5 -0
- package/dist/AppShell/observeMainOverflow.d.ts.map +1 -1
- package/dist/AppShell/observeMainOverflow.js +39 -9
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +8 -0
- package/dist/BottomSheet/useSheetGestures.d.ts +8 -0
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +16 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +3 -16
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +5 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +2 -2
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +7 -2
- package/dist/DateInput/DateInput.d.ts +0 -3
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +3 -5
- package/dist/DateInput/NativeDateField.d.ts.map +1 -1
- package/dist/DateInput/NativeDateField.js +3 -5
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +2 -4
- package/dist/DateInput/useTypedDate.d.ts.map +1 -1
- package/dist/DateInput/useTypedDate.js +9 -6
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +13 -9
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +3 -15
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +2 -14
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +7 -1
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +7 -0
- package/dist/Field/Field.d.ts.map +1 -1
- package/dist/Field/Field.js +2 -1
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +9 -2
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +23 -0
- package/dist/Field/inputStyles.stylex.d.ts +22 -6
- package/dist/Field/inputStyles.stylex.d.ts.map +1 -1
- package/dist/Field/inputStyles.stylex.js +32 -0
- package/dist/FieldStatus/FieldStatus.d.ts.map +1 -1
- package/dist/FieldStatus/FieldStatus.js +7 -2
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +4 -4
- package/dist/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/InputGroup/InputGroup.js +6 -16
- package/dist/InputGroup/InputGroupText.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupText.js +2 -8
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +8 -2
- package/dist/Kbd/Kbd.d.ts +3 -2
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +3 -2
- package/dist/Layer/gestureCounter.d.ts +5 -0
- package/dist/Layer/gestureCounter.d.ts.map +1 -1
- package/dist/Layer/gestureCounter.js +40 -4
- package/dist/Layer/inputHold.d.ts +13 -0
- package/dist/Layer/inputHold.d.ts.map +1 -1
- package/dist/Layer/inputHold.js +203 -14
- package/dist/Layer/layerHost.d.ts +3 -2
- package/dist/Layer/layerHost.d.ts.map +1 -1
- package/dist/Layer/layerHost.js +3 -2
- package/dist/Layer/outsidePanClaim.d.ts +17 -0
- package/dist/Layer/outsidePanClaim.d.ts.map +1 -1
- package/dist/Layer/outsidePanClaim.js +36 -8
- package/dist/Layer/outsidePress.d.ts +7 -1
- package/dist/Layer/outsidePress.d.ts.map +1 -1
- package/dist/Layer/outsidePress.js +9 -2
- package/dist/Layer/useLayer.d.ts +21 -5
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +63 -40
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +7 -0
- package/dist/MetadataList/MetadataList.d.ts +1 -1
- package/dist/MetadataList/MetadataList.d.ts.map +1 -1
- package/dist/MetadataList/MetadataList.js +8 -0
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +37 -17
- package/dist/NavIcon/NavIcon.d.ts +2 -2
- package/dist/NavIcon/NavIcon.d.ts.map +1 -1
- package/dist/NavIcon/NavIcon.js +2 -2
- package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.js +4 -3
- package/dist/NumberInput/NumberInput.d.ts +13 -5
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +6 -17
- package/dist/NumberInput/numberParser.d.ts +9 -2
- package/dist/NumberInput/numberParser.d.ts.map +1 -1
- package/dist/NumberInput/numberParser.js +15 -2
- package/dist/Overlay/OverlayScrim.d.ts.map +1 -1
- package/dist/Overlay/OverlayScrim.js +13 -4
- package/dist/Overlay/useOverlay.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts +3 -2
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +9 -2
- package/dist/Popover/usePopover.d.ts +37 -6
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +103 -20
- package/dist/PowerSearch/PowerSearch.d.ts +4 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +3 -4
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +1 -2
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.js +173 -185
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +0 -12
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +1 -51
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +6 -8
- package/dist/PowerSearch/formatTokenValue.d.ts +5 -10
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatTokenValue.js +21 -38
- package/dist/PowerSearch/relativeDateOptions.d.ts +30 -0
- package/dist/PowerSearch/relativeDateOptions.d.ts.map +1 -0
- package/dist/PowerSearch/relativeDateOptions.js +74 -0
- package/dist/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +20 -14
- package/dist/Resizable/createResizable.d.ts.map +1 -1
- package/dist/Resizable/createResizable.js +38 -4
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +5 -3
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +6 -2
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +2 -1
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +1 -1
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +53 -8
- package/dist/Stepper/Step.d.ts.map +1 -1
- package/dist/Stepper/Step.js +2 -2
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +2 -0
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +2 -0
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +30 -8
- package/dist/Table/Table.d.ts +9 -4
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +9 -4
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +3 -7
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts.map +1 -1
- package/dist/Table/plugins/rowIndex/useTableRowIndex.js +4 -1
- package/dist/Table/plugins/rowStatus/useTableRowStatus.d.ts.map +1 -1
- package/dist/Table/plugins/rowStatus/useTableRowStatus.js +2 -0
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +18 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +34 -24
- package/dist/Table/tableColumnAdmission.d.ts +7 -0
- package/dist/Table/tableColumnAdmission.d.ts.map +1 -1
- package/dist/Table/tableColumnAdmission.js +15 -0
- package/dist/Table/types.d.ts +5 -5
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +13 -8
- package/dist/Text/TruncationTooltip.d.ts +7 -39
- package/dist/Text/TruncationTooltip.d.ts.map +1 -1
- package/dist/Text/TruncationTooltip.js +47 -128
- package/dist/Text/cutText.d.ts +22 -0
- package/dist/Text/cutText.d.ts.map +1 -0
- package/dist/Text/cutText.js +92 -0
- package/dist/Text/cutTextOnKeyboardFocus.d.ts +41 -0
- package/dist/Text/cutTextOnKeyboardFocus.d.ts.map +1 -0
- package/dist/Text/cutTextOnKeyboardFocus.js +112 -0
- package/dist/Text/textClampContext.d.ts +1 -0
- package/dist/Text/textClampContext.d.ts.map +1 -1
- package/dist/Text/textClampContext.js +10 -5
- package/dist/Text/useTruncation.d.ts +23 -1
- package/dist/Text/useTruncation.d.ts.map +1 -1
- package/dist/Text/useTruncation.js +74 -28
- package/dist/TextInput/TextInput.d.ts +6 -6
- package/dist/Thumbnail/Thumbnail.js +4 -1
- package/dist/TimeInput/TimeInput.d.ts +0 -3
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +3 -5
- package/dist/TimeInput/TouchTimeField.d.ts.map +1 -1
- package/dist/TimeInput/TouchTimeField.js +3 -5
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +22 -16
- package/dist/Timestamp/TimestampHoverCard.d.ts +6 -3
- package/dist/Timestamp/TimestampHoverCard.d.ts.map +1 -1
- package/dist/Timestamp/TimestampHoverCard.js +30 -19
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +3 -3
- package/dist/Timestamp/tooltipEntries.d.ts.map +1 -1
- package/dist/Timestamp/tooltipEntries.js +4 -2
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +62 -31
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +35 -13
- package/dist/Toast/useToast.d.ts.map +1 -1
- package/dist/Toast/useToast.js +35 -14
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +3 -3
- package/dist/astryx.css +38 -8
- package/dist/hooks/useAnnounceRenderedText.d.ts +10 -3
- package/dist/hooks/useAnnounceRenderedText.d.ts.map +1 -1
- package/dist/hooks/useAnnounceRenderedText.js +11 -3
- package/dist/hooks/useFocusTrap.d.ts +12 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +13 -6
- package/dist/hooks/useHotkeys.d.ts +9 -1
- package/dist/hooks/useHotkeys.d.ts.map +1 -1
- package/dist/hooks/useHotkeys.js +52 -2
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +2 -1
- package/dist/hooks/useKeyboardHint.d.ts.map +1 -1
- package/dist/hooks/useKeyboardHint.js +4 -3
- package/dist/i18n/generated-english/DateRangeInput/DateRangeInput.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateRangeInput/DateRangeInput.generated.js +2 -0
- package/dist/i18n/generated-english/MultiSelector/MultiSelector.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/MultiSelector/MultiSelector.generated.js +1 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.js +0 -6
- package/dist/i18n/generated-english/PowerSearch/relativeDateOptions.generated.d.ts +8 -0
- package/dist/i18n/generated-english/PowerSearch/relativeDateOptions.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/PowerSearch/relativeDateOptions.generated.js +17 -0
- package/dist/i18n/generated-english/Slider/Slider.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Slider/Slider.generated.js +1 -0
- package/dist/i18n/generated-english/Thumbnail/Thumbnail.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Thumbnail/Thumbnail.generated.js +1 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +5 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +5 -0
- package/dist/i18n/getLocaleDirection.d.ts +0 -16
- package/dist/i18n/getLocaleDirection.d.ts.map +1 -1
- package/dist/i18n/getLocaleDirection.js +16 -6
- package/dist/i18n/listFormat.d.ts +34 -0
- package/dist/i18n/listFormat.d.ts.map +1 -0
- package/dist/i18n/listFormat.js +45 -0
- package/dist/i18n/useListFormatter.d.ts +7 -3
- package/dist/i18n/useListFormatter.d.ts.map +1 -1
- package/dist/i18n/useListFormatter.js +16 -13
- package/dist/internal/module-loader.d.ts +15 -0
- package/dist/internal/module-loader.d.ts.map +1 -0
- package/dist/internal/module-loader.js +15 -0
- package/dist/motion/animatedLayout.d.ts +6 -0
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +201 -27
- package/dist/palette/color.d.ts +16 -0
- package/dist/palette/color.d.ts.map +1 -1
- package/dist/palette/color.js +37 -1
- package/dist/palette/derive-look.d.ts +235 -0
- package/dist/palette/derive-look.d.ts.map +1 -0
- package/dist/palette/derive-look.js +879 -0
- package/dist/palette/editor-look.d.ts +41 -0
- package/dist/palette/editor-look.d.ts.map +1 -0
- package/dist/palette/editor-look.js +401 -0
- package/dist/palette/mapping.d.ts +99 -6
- package/dist/palette/mapping.d.ts.map +1 -1
- package/dist/palette/mapping.js +68 -11
- package/dist/theme/tokens.d.ts +1 -1
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +1 -1
- package/dist/utils/characters.d.ts.map +1 -1
- package/dist/utils/characters.js +7 -0
- package/dist/utils/devWarning.d.ts +18 -0
- package/dist/utils/devWarning.d.ts.map +1 -1
- package/dist/utils/devWarning.js +30 -0
- package/dist/utils/focusReturn.d.ts +2 -0
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +3 -8
- package/dist/utils/hitArea.d.ts +4 -1
- package/dist/utils/hitArea.d.ts.map +1 -1
- package/dist/utils/hitArea.js +72 -9
- package/dist/utils/mergeProps.d.ts.map +1 -1
- package/dist/utils/mergeProps.js +53 -38
- package/dist/utils/scrollView.d.ts +2 -2
- package/dist/utils/scrollView.d.ts.map +1 -1
- package/dist/utils/scrollView.js +3 -3
- package/dist/utils/textDirection.d.ts +29 -5
- package/dist/utils/textDirection.d.ts.map +1 -1
- package/dist/utils/textDirection.js +56 -4
- package/dist/utils/touchHitArea.d.ts.map +1 -1
- package/dist/utils/touchHitArea.js +4 -2
- package/dist/virtualization/useInlineListWindow.d.ts.map +1 -1
- package/dist/virtualization/useInlineListWindow.js +63 -4
- package/locales/en.json +26 -6
- package/locales/pseudo.json +15 -0
- package/package.json +10 -5
- package/src/AlertDialog/AlertDialog.tsx +15 -0
- package/src/AlertDialog/useImperativeAlertDialog.doc.mjs +7 -4
- package/src/AppShell/AppShell.tsx +6 -3
- package/src/AppShell/observeMainOverflow.ts +39 -9
- package/src/Badge/Badge.doc.mjs +3 -3
- package/src/BottomSheet/BottomSheet.tsx +15 -0
- package/src/BottomSheet/useSheetGestures.ts +26 -1
- package/src/Button/Button.tsx +3 -23
- package/src/Card/Card.doc.mjs +3 -3
- package/src/Card/Card.tsx +11 -6
- package/src/Chat/ChatSendButton.doc.mjs +6 -6
- package/src/Chat/ChatToolCalls.doc.mjs +1 -1
- package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -3
- package/src/Citation/Citation.tsx +8 -2
- package/src/ClickableCard/ClickableCard.tsx +9 -2
- package/src/ComplexSelector/ComplexSelector.doc.mjs +3 -3
- package/src/ContextMenu/ContextMenuItem.doc.mjs +3 -3
- package/src/DateInput/DateInput.tsx +2 -4
- package/src/DateInput/NativeDateField.tsx +5 -4
- package/src/DateInput/TouchDateField.tsx +2 -3
- package/src/DateInput/useTypedDate.ts +13 -6
- package/src/DateRangeInput/DateRangeInput.tsx +14 -10
- package/src/DateTimeInput/DateTimeInput.tsx +2 -12
- package/src/DateTimeInput/TouchDateTimeField.tsx +2 -11
- package/src/Dialog/Dialog.tsx +15 -1
- package/src/Dialog/useImperativeDialog.doc.mjs +7 -4
- package/src/Drawer/Drawer.tsx +15 -0
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -1
- package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +3 -3
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +3 -3
- package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +3 -3
- package/src/DropdownMenu/DropdownMenuSubMenu.doc.mjs +2 -2
- package/src/Field/Field.doc.mjs +1 -1
- package/src/Field/Field.tsx +2 -1
- package/src/Field/FieldLabel.doc.mjs +3 -3
- package/src/Field/FieldLabel.tsx +11 -3
- package/src/Field/InputClearButton.tsx +27 -0
- package/src/Field/inputStyles.stylex.ts +53 -6
- package/src/FieldStatus/FieldStatus.tsx +7 -2
- package/src/FileInput/FileInput.tsx +12 -2
- package/src/Icon/Icon.doc.mjs +17 -14
- package/src/Icon/useIcon.doc.mjs +6 -6
- package/src/IconButton/IconButton.doc.mjs +2 -2
- package/src/InfoTip/InfoTip.doc.mjs +1 -1
- package/src/InputGroup/InputGroup.tsx +5 -12
- package/src/InputGroup/InputGroupText.tsx +2 -3
- package/src/Item/Item.tsx +10 -1
- package/src/Kbd/Kbd.doc.mjs +5 -5
- package/src/Kbd/Kbd.tsx +3 -2
- package/src/Layer/gestureCounter.ts +39 -3
- package/src/Layer/inputHold.ts +241 -18
- package/src/Layer/layerHost.ts +3 -2
- package/src/Layer/outsidePanClaim.ts +50 -8
- package/src/Layer/outsidePress.ts +18 -4
- package/src/Layer/useLayer.tsx +128 -76
- package/src/Lightbox/Lightbox.tsx +15 -0
- package/src/MetadataList/MetadataList.tsx +8 -0
- package/src/MoreMenu/MoreMenu.doc.mjs +1 -1
- package/src/MultiSelector/MultiSelector.doc.mjs +2 -2
- package/src/MultiSelector/MultiSelector.tsx +45 -15
- package/src/NavIcon/NavIcon.doc.mjs +19 -10
- package/src/NavIcon/NavIcon.tsx +3 -2
- package/src/NavMenu/NavHeadingMenuItem.tsx +9 -3
- package/src/NumberInput/NumberInput.doc.mjs +12 -12
- package/src/NumberInput/NumberInput.tsx +12 -15
- package/src/NumberInput/numberParser.ts +15 -2
- package/src/Overlay/Overlay.doc.mjs +13 -1
- package/src/Overlay/OverlayScrim.tsx +45 -15
- package/src/Overlay/useOverlay.doc.mjs +7 -7
- package/src/Overlay/useOverlay.tsx +1 -1
- package/src/Pagination/Pagination.doc.mjs +9 -6
- package/src/Pagination/Pagination.tsx +15 -3
- package/src/Popover/usePopover.doc.mjs +14 -4
- package/src/Popover/usePopover.tsx +180 -23
- package/src/PowerSearch/PowerSearch.doc.mjs +165 -15
- package/src/PowerSearch/PowerSearch.tsx +6 -8
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +182 -223
- package/src/PowerSearch/PowerSearchValueEditor.tsx +1 -51
- package/src/PowerSearch/formatFilterValue.ts +8 -9
- package/src/PowerSearch/formatTokenValue.ts +24 -42
- package/src/PowerSearch/relativeDateOptions.ts +84 -0
- package/src/ProgressBar/ProgressBar.doc.mjs +24 -5
- package/src/ProgressBar/ProgressBar.tsx +28 -18
- package/src/Resizable/createResizable.ts +46 -5
- package/src/SegmentedControl/SegmentedControlItem.tsx +4 -3
- package/src/SelectableCard/SelectableCard.tsx +8 -2
- package/src/Selector/Selector.doc.mjs +3 -3
- package/src/Selector/Selector.tsx +3 -1
- package/src/Selector/SelectorOption.doc.mjs +3 -3
- package/src/SideNav/SideNavItem.doc.mjs +6 -6
- package/src/SideNav/SideNavItem.tsx +3 -0
- package/src/Slider/Slider.tsx +48 -6
- package/src/Stepper/Step.tsx +7 -1
- package/src/Switch/Switch.doc.mjs +3 -3
- package/src/TabList/Tab.tsx +4 -0
- package/src/TabList/TabMenu.tsx +4 -0
- package/src/Table/BaseTable.tsx +35 -7
- package/src/Table/Table.doc.mjs +56 -6
- package/src/Table/Table.tsx +9 -4
- package/src/Table/TableHeaderCell.tsx +2 -8
- package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +10 -1
- package/src/Table/plugins/rowStatus/useTableRowStatus.tsx +5 -0
- package/src/Table/plugins/sortable/useTableSortable.tsx +41 -2
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +49 -20
- package/src/Table/tableColumnAdmission.ts +23 -0
- package/src/Table/types.ts +5 -5
- package/src/Table/useTableRowsVirtualization.doc.mjs +2 -2
- package/src/Text/Text.tsx +21 -7
- package/src/Text/TruncationTooltip.tsx +51 -184
- package/src/Text/cutText.tsx +126 -0
- package/src/Text/cutTextOnKeyboardFocus.tsx +158 -0
- package/src/Text/textClampContext.ts +14 -4
- package/src/Text/useTruncation.ts +85 -27
- package/src/TextArea/TextArea.doc.mjs +4 -4
- package/src/TextInput/TextInput.doc.mjs +3 -3
- package/src/Thumbnail/Thumbnail.tsx +1 -1
- package/src/TimeInput/TimeInput.tsx +3 -9
- package/src/TimeInput/TouchTimeField.tsx +6 -4
- package/src/Timestamp/Timestamp.tsx +29 -21
- package/src/Timestamp/TimestampHoverCard.tsx +44 -31
- package/src/Timestamp/formatInstant.ts +7 -3
- package/src/Timestamp/tooltipEntries.ts +4 -2
- package/src/Toast/Toast.doc.mjs +24 -37
- package/src/Toast/Toast.tsx +77 -29
- package/src/Toast/ToastViewport.tsx +33 -13
- package/src/Toast/useToast.tsx +42 -15
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tooltip/useTooltip.tsx +2 -1
- package/src/TopNav/TopNavMegaMenu.doc.mjs +13 -0
- package/src/TopNav/TopNavMenu.doc.mjs +2 -0
- package/src/Typeahead/Typeahead.doc.mjs +2 -2
- package/src/hooks/useAnnounceRenderedText.ts +15 -2
- package/src/hooks/useFocusTrap.ts +27 -4
- package/src/hooks/useHotkeys.doc.mjs +54 -11
- package/src/hooks/useHotkeys.ts +72 -3
- package/src/hooks/useInputStatusIcon.tsx +2 -1
- package/src/hooks/useKeyboardHint.tsx +3 -2
- package/src/i18n/generated-english/DateRangeInput/DateRangeInput.generated.ts +2 -0
- package/src/i18n/generated-english/MultiSelector/MultiSelector.generated.ts +1 -0
- package/src/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.ts +0 -6
- package/src/i18n/generated-english/PowerSearch/relativeDateOptions.generated.ts +18 -0
- package/src/i18n/generated-english/Slider/Slider.generated.ts +1 -0
- package/src/i18n/generated-english/Thumbnail/Thumbnail.generated.ts +1 -0
- package/src/i18n/generated-locales/en.generated.ts +5 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +5 -0
- package/src/i18n/getLocaleDirection.ts +57 -7
- package/src/i18n/listFormat.ts +55 -0
- package/src/i18n/useListFormatter.ts +22 -13
- package/src/internal/module-loader.ts +15 -0
- package/src/motion/animatedLayout.ts +215 -28
- package/src/palette/color.ts +41 -1
- package/src/palette/derive-look.ts +1186 -0
- package/src/palette/editor-look.ts +480 -0
- package/src/palette/mapping.ts +129 -15
- package/src/theme/SyntaxTheme.doc.mjs +1 -1
- package/src/theme/tokens.ts +2 -1
- package/src/theme/useThemeName.doc.mjs +1 -1
- package/src/utils/characters.ts +11 -0
- package/src/utils/devWarning.ts +35 -0
- package/src/utils/focusReturn.ts +3 -11
- package/src/utils/hitArea.ts +87 -18
- package/src/utils/mergeProps.ts +57 -34
- package/src/utils/scrollView.ts +3 -2
- package/src/utils/textDirection.ts +65 -5
- package/src/utils/touchHitArea.ts +3 -2
- package/src/virtualization/useInlineListWindow.ts +102 -11
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useTruncation.ts
|
|
7
7
|
* @input Uses React hooks, sharedResizeObserver, sharedMutationObserver
|
|
8
|
-
* @output Exports useTruncation hook for detecting text overflow
|
|
8
|
+
* @output Exports useTruncation hook for detecting text overflow, and
|
|
9
|
+
* useTruncationMeasure, its internal form with Core's measure-on-interest
|
|
10
|
+
* mode
|
|
9
11
|
* @position Hook; consumed by Text.tsx, Heading.tsx and Lightbox.tsx
|
|
10
12
|
*
|
|
11
13
|
* SYNC: When modified, update:
|
|
@@ -47,6 +49,28 @@ export interface UseTruncationReturn {
|
|
|
47
49
|
fullText: string;
|
|
48
50
|
}
|
|
49
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Whether an element's text overflows its line clamp. Single-line text
|
|
54
|
+
* overflows horizontally. Multi-line text compares the content's real
|
|
55
|
+
* height: with -webkit-line-clamp, browsers may report the clamped size as
|
|
56
|
+
* scrollHeight, so Range.getBoundingClientRect() measures the content.
|
|
57
|
+
*/
|
|
58
|
+
function measureTruncation(element: HTMLElement, maxLines: number): boolean {
|
|
59
|
+
if (maxLines === 1) {
|
|
60
|
+
return element.scrollWidth > element.offsetWidth;
|
|
61
|
+
}
|
|
62
|
+
let contentHeight = element.scrollHeight;
|
|
63
|
+
try {
|
|
64
|
+
const range = document.createRange();
|
|
65
|
+
range.selectNodeContents(element);
|
|
66
|
+
contentHeight = range.getBoundingClientRect().height;
|
|
67
|
+
range.detach();
|
|
68
|
+
} catch {
|
|
69
|
+
// Fallback to scrollHeight (e.g. jsdom in tests)
|
|
70
|
+
}
|
|
71
|
+
return contentHeight > element.offsetHeight;
|
|
72
|
+
}
|
|
73
|
+
|
|
50
74
|
/**
|
|
51
75
|
* Hook for detecting text overflow/truncation.
|
|
52
76
|
*
|
|
@@ -75,7 +99,35 @@ export interface UseTruncationReturn {
|
|
|
75
99
|
export function useTruncation(
|
|
76
100
|
options: UseTruncationOptions,
|
|
77
101
|
): UseTruncationReturn {
|
|
78
|
-
const {
|
|
102
|
+
const {ref, isTruncated, fullText} = useTruncationMeasure(options);
|
|
103
|
+
return {ref, isTruncated, fullText};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** @internal */
|
|
107
|
+
export interface TruncationMeasureOptions extends UseTruncationOptions {
|
|
108
|
+
/**
|
|
109
|
+
* Measures at each hover, tap or focus (`measure`), not at mount, for
|
|
110
|
+
* text that mounts many times at once, such as a Table's default cells.
|
|
111
|
+
* After the first measurement, a content change measures again.
|
|
112
|
+
*/
|
|
113
|
+
measuresOnInterest?: boolean;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** @internal */
|
|
117
|
+
export interface TruncationMeasureReturn extends UseTruncationReturn {
|
|
118
|
+
/** With `measuresOnInterest`: measures now and returns the answer. */
|
|
119
|
+
measure: (() => boolean) | undefined;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* useTruncation with Core's internal modes. Text calls this; the public hook
|
|
124
|
+
* calls it without them.
|
|
125
|
+
* @internal
|
|
126
|
+
*/
|
|
127
|
+
export function useTruncationMeasure(
|
|
128
|
+
options: TruncationMeasureOptions,
|
|
129
|
+
): TruncationMeasureReturn {
|
|
130
|
+
const {maxLines, isExpanded = false, measuresOnInterest = false} = options;
|
|
79
131
|
const [isTruncated, setTruncatedState] = useState(false);
|
|
80
132
|
const [fullText, setFullTextState] = useState('');
|
|
81
133
|
// The values last set as state. A measurement that finds the same values
|
|
@@ -113,30 +165,8 @@ export function useTruncation(
|
|
|
113
165
|
answerRef.current.fullText = element.textContent ?? '';
|
|
114
166
|
setFullText(answerRef.current.fullText);
|
|
115
167
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// Single-line: check horizontal overflow
|
|
119
|
-
answerRef.current.isTruncated =
|
|
120
|
-
element.scrollWidth > element.offsetWidth;
|
|
121
|
-
setIsTruncated(answerRef.current.isTruncated);
|
|
122
|
-
} else {
|
|
123
|
-
// Multi-line: use Range to measure actual content height.
|
|
124
|
-
// When -webkit-line-clamp is active, browsers may report
|
|
125
|
-
// scrollHeight === offsetHeight (the clamped size), so the
|
|
126
|
-
// naive scrollHeight check fails. Range.getBoundingClientRect()
|
|
127
|
-
// measures the real text content regardless of clamping.
|
|
128
|
-
let contentHeight = element.scrollHeight;
|
|
129
|
-
try {
|
|
130
|
-
const range = document.createRange();
|
|
131
|
-
range.selectNodeContents(element);
|
|
132
|
-
contentHeight = range.getBoundingClientRect().height;
|
|
133
|
-
range.detach();
|
|
134
|
-
} catch {
|
|
135
|
-
// Fallback to scrollHeight (e.g. jsdom in tests)
|
|
136
|
-
}
|
|
137
|
-
answerRef.current.isTruncated = contentHeight > element.offsetHeight;
|
|
138
|
-
setIsTruncated(answerRef.current.isTruncated);
|
|
139
|
-
}
|
|
168
|
+
answerRef.current.isTruncated = measureTruncation(element, maxLines);
|
|
169
|
+
setIsTruncated(answerRef.current.isTruncated);
|
|
140
170
|
},
|
|
141
171
|
[maxLines, setIsTruncated, setFullText],
|
|
142
172
|
);
|
|
@@ -174,6 +204,12 @@ export function useTruncation(
|
|
|
174
204
|
setFullText('');
|
|
175
205
|
}
|
|
176
206
|
|
|
207
|
+
// Text that measures on interest waits for its first hover, tap or
|
|
208
|
+
// focus: it measures and observes nothing at mount.
|
|
209
|
+
if (element && maxLines > 0 && measuresOnInterest) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
177
213
|
if (element && maxLines > 0) {
|
|
178
214
|
// Observe via the shared singleton, if available. The observer's
|
|
179
215
|
// first notification measures a new element. The browser sends it
|
|
@@ -197,12 +233,34 @@ export function useTruncation(
|
|
|
197
233
|
setFullText('');
|
|
198
234
|
}
|
|
199
235
|
},
|
|
200
|
-
[
|
|
236
|
+
[
|
|
237
|
+
maxLines,
|
|
238
|
+
isExpanded,
|
|
239
|
+
measuresOnInterest,
|
|
240
|
+
checkTruncation,
|
|
241
|
+
setIsTruncated,
|
|
242
|
+
setFullText,
|
|
243
|
+
],
|
|
201
244
|
);
|
|
202
245
|
|
|
246
|
+
// Measures the attached text at a hover, tap or focus. The first call also
|
|
247
|
+
// follows content changes from then on, so an open tooltip follows the text.
|
|
248
|
+
const measureNow = useCallback((): boolean => {
|
|
249
|
+
const element = elementRef.current;
|
|
250
|
+
if (element == null || maxLines === 0) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
checkTruncation(element);
|
|
254
|
+
unobserveContentRef.current ??= observeContent(element, () => {
|
|
255
|
+
checkTruncation(element);
|
|
256
|
+
});
|
|
257
|
+
return answerRef.current.isTruncated;
|
|
258
|
+
}, [maxLines, checkTruncation]);
|
|
259
|
+
|
|
203
260
|
return {
|
|
204
261
|
ref,
|
|
205
262
|
isTruncated,
|
|
206
263
|
fullText,
|
|
264
|
+
measure: measuresOnInterest ? measureNow : undefined,
|
|
207
265
|
};
|
|
208
266
|
}
|
|
@@ -31,7 +31,7 @@ const anatomy = [
|
|
|
31
31
|
name: 'Start icon',
|
|
32
32
|
required: false,
|
|
33
33
|
description:
|
|
34
|
-
'Astryx Icon rendered at the start when startIcon is a
|
|
34
|
+
'Astryx Icon rendered at the start when startIcon is a built-in meaning or icon component.',
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
name: 'Custom start content',
|
|
@@ -216,7 +216,7 @@ export const docs = {
|
|
|
216
216
|
name: 'startIcon',
|
|
217
217
|
type: 'ReactNode | IconType',
|
|
218
218
|
description:
|
|
219
|
-
'Icon rendered inside the leading edge of the textarea wrapper; pass a
|
|
219
|
+
'Icon rendered inside the leading edge of the textarea wrapper; pass a built-in meaning such as \'search\' (see `astryx docs icons`), an icon component, or an icon element.',
|
|
220
220
|
},
|
|
221
221
|
{
|
|
222
222
|
name: 'hasSpellCheck',
|
|
@@ -535,7 +535,7 @@ export const docsZh = {
|
|
|
535
535
|
{
|
|
536
536
|
name: 'startIcon',
|
|
537
537
|
type: 'ReactNode | IconType',
|
|
538
|
-
description: '
|
|
538
|
+
description: '在文本域包装器前端内部渲染的图标;可传内置含义(如 \'search\',见 `astryx docs icons`)、图标组件或图标元素。',
|
|
539
539
|
},
|
|
540
540
|
{
|
|
541
541
|
name: 'hasSpellCheck',
|
|
@@ -802,7 +802,7 @@ export const docsDense = {
|
|
|
802
802
|
statusVariant:
|
|
803
803
|
'How status message is placed: attached overlaps below input; detached floats below w/ spacing; tooltip hides the box and shows it on the status icon.',
|
|
804
804
|
labelTooltip: 'Tooltip in info icon at label end.',
|
|
805
|
-
startIcon: 'Icon inside leading edge of textarea wrapper;
|
|
805
|
+
startIcon: 'Icon inside leading edge of textarea wrapper; built-in meaning OK, e.g. \'search\' (`astryx docs icons`), or icon component/element.',
|
|
806
806
|
hasSpellCheck: 'Enables/disables browser spell checking.',
|
|
807
807
|
hasAutoFocus: 'Auto-focus textarea on mount.',
|
|
808
808
|
size: 'Textarea size; affects internal padding. Height controlled by rows.',
|
|
@@ -127,7 +127,7 @@ export const docs = {
|
|
|
127
127
|
name: 'startIcon',
|
|
128
128
|
type: 'ReactNode | IconType',
|
|
129
129
|
description:
|
|
130
|
-
'Icon displayed at the start of the input; pass a
|
|
130
|
+
'Icon displayed at the start of the input; pass a built-in meaning such as \'search\' (see `astryx docs icons`), an icon component, or an icon element.',
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
133
|
name: 'status',
|
|
@@ -377,7 +377,7 @@ export const docsZh = {
|
|
|
377
377
|
name: 'startIcon',
|
|
378
378
|
type: 'ReactNode | IconType',
|
|
379
379
|
description:
|
|
380
|
-
'
|
|
380
|
+
'显示在输入框起始位置的图标;可传内置含义(如 \'search\',见 `astryx docs icons`)、图标组件或图标元素。',
|
|
381
381
|
},
|
|
382
382
|
{
|
|
383
383
|
name: 'status',
|
|
@@ -562,7 +562,7 @@ export const docsDense = {
|
|
|
562
562
|
isLoading: 'Loading state w/ spinner+aria-busy.',
|
|
563
563
|
placeholder: 'Placeholder when input empty.',
|
|
564
564
|
labelTooltip: 'Tooltip in info icon at label end.',
|
|
565
|
-
startIcon: 'Icon at input start;
|
|
565
|
+
startIcon: 'Icon at input start; built-in meaning OK, e.g. \'search\' (`astryx docs icons`), or icon component/element.',
|
|
566
566
|
status: 'Validation status; colored border+icon. Message floats below. Error sets aria-invalid.',
|
|
567
567
|
statusVariant: 'How status message is placed: attached overlaps below input; detached floats below w/ spacing; tooltip hides the box and shows it on the status icon.',
|
|
568
568
|
hasClear: 'Shows clear button when input has value. Clears value on click.',
|
|
@@ -413,7 +413,7 @@ export function Thumbnail({
|
|
|
413
413
|
});
|
|
414
414
|
const accessibleName =
|
|
415
415
|
label && alt
|
|
416
|
-
?
|
|
416
|
+
? t('@astryx.thumbnail.nameWithAlt', {label, alt})
|
|
417
417
|
: (label ?? alt ?? t('@astryx.thumbnail.fallbackName'));
|
|
418
418
|
|
|
419
419
|
// Without `alt`, the image is explicitly decorative rather than silently
|
|
@@ -32,15 +32,11 @@ import {
|
|
|
32
32
|
type FocusEvent,
|
|
33
33
|
} from 'react';
|
|
34
34
|
import * as stylex from '@stylexjs/stylex';
|
|
35
|
+
import {inputRowSizeStyles} from '../Field/inputStyles.stylex';
|
|
35
36
|
import {inputDisabledFocusStyles} from '../Field/inputDisabledFocus';
|
|
36
37
|
import {useEntryErrorBehavior} from '../Field/useEntryErrorBehavior';
|
|
37
38
|
import type {EntryErrorBehavior} from '../FormLayout/FormLayoutContext';
|
|
38
|
-
import {
|
|
39
|
-
colorVars,
|
|
40
|
-
sizeVars,
|
|
41
|
-
typographyVars,
|
|
42
|
-
typeScaleVars,
|
|
43
|
-
} from '../theme/tokens.stylex';
|
|
39
|
+
import {colorVars, typographyVars, typeScaleVars} from '../theme/tokens.stylex';
|
|
44
40
|
import {
|
|
45
41
|
Field,
|
|
46
42
|
InputClearButton,
|
|
@@ -147,15 +143,12 @@ const styles = stylex.create({
|
|
|
147
143
|
|
|
148
144
|
const sizeStyles = stylex.create({
|
|
149
145
|
sm: {
|
|
150
|
-
height: sizeVars['--size-element-sm'],
|
|
151
146
|
minWidth: 120,
|
|
152
147
|
},
|
|
153
148
|
md: {
|
|
154
|
-
height: sizeVars['--size-element-md'],
|
|
155
149
|
minWidth: 120,
|
|
156
150
|
},
|
|
157
151
|
lg: {
|
|
158
|
-
height: sizeVars['--size-element-lg'],
|
|
159
152
|
minWidth: 120,
|
|
160
153
|
},
|
|
161
154
|
});
|
|
@@ -835,6 +828,7 @@ function TimeField({
|
|
|
835
828
|
inputWrapperStyles.base,
|
|
836
829
|
inputWrapperStyles.textField,
|
|
837
830
|
sizeStyles[size],
|
|
831
|
+
inputRowSizeStyles[size],
|
|
838
832
|
isDisabled && inputWrapperStyles.disabled,
|
|
839
833
|
isDisabled && inputDisabledFocusStyles.withinRing,
|
|
840
834
|
fieldStatus && inputStatusBorderStyles[fieldStatus.type],
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
type KeyboardEvent,
|
|
28
28
|
} from 'react';
|
|
29
29
|
import * as stylex from '@stylexjs/stylex';
|
|
30
|
+
import {inputRowSizeStyles} from '../Field/inputStyles.stylex';
|
|
30
31
|
import {inputDisabledFocusStyles} from '../Field/inputDisabledFocus';
|
|
31
32
|
import {BottomSheet} from '../BottomSheet';
|
|
32
33
|
import {Button} from '../Button';
|
|
@@ -49,7 +50,7 @@ import {useResolvedRequired} from '../hooks/useResolvedRequired';
|
|
|
49
50
|
import {Icon} from '../Icon';
|
|
50
51
|
import {useLocale} from '../i18n';
|
|
51
52
|
import {formatLocaleTime} from '../utils/timeFormat';
|
|
52
|
-
import {
|
|
53
|
+
import {spacingVars} from '../theme/tokens.stylex';
|
|
53
54
|
import {useSize} from '../SizeContext/SizeContext';
|
|
54
55
|
import {Spinner} from '../Spinner';
|
|
55
56
|
import {useTooltip} from '../Tooltip';
|
|
@@ -88,9 +89,9 @@ import english from '../i18n/generated-english/TimeInput/TouchTimeField.generate
|
|
|
88
89
|
registerEnglishFallback(english);
|
|
89
90
|
|
|
90
91
|
const sizeStyles = stylex.create({
|
|
91
|
-
sm: {
|
|
92
|
-
md: {
|
|
93
|
-
lg: {
|
|
92
|
+
sm: {minWidth: 120},
|
|
93
|
+
md: {minWidth: 120},
|
|
94
|
+
lg: {minWidth: 120},
|
|
94
95
|
});
|
|
95
96
|
|
|
96
97
|
const styles = stylex.create({
|
|
@@ -384,6 +385,7 @@ export function TouchTimeField({
|
|
|
384
385
|
inputWrapperStyles.base,
|
|
385
386
|
inputWrapperStyles.textField,
|
|
386
387
|
sizeStyles[size],
|
|
388
|
+
inputRowSizeStyles[size],
|
|
387
389
|
isDisabled && inputWrapperStyles.disabled,
|
|
388
390
|
isDisabled && inputDisabledFocusStyles.withinRing,
|
|
389
391
|
status && inputStatusBorderStyles[status.type],
|
|
@@ -414,21 +414,18 @@ export function Timestamp({
|
|
|
414
414
|
)
|
|
415
415
|
: '';
|
|
416
416
|
|
|
417
|
-
//
|
|
418
|
-
//
|
|
419
|
-
//
|
|
420
|
-
//
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
calendar,
|
|
430
|
-
})
|
|
431
|
-
: '';
|
|
417
|
+
// The AT-facing aria-label of a relative timestamp spells the timezone out
|
|
418
|
+
// in full. Abbreviations like "PST" or "GMT+2" are unexpanded abbreviations
|
|
419
|
+
// to a screen-reader user (WCAG 3.1.4). It stays in the viewer's zone. Only
|
|
420
|
+
// a relative timestamp carries the name, so no other format builds it.
|
|
421
|
+
const fullAbsoluteSpokenText =
|
|
422
|
+
isValidDate && isRelativeFormat(effectiveFormat)
|
|
423
|
+
? formatInstant(date, 'full', locale, {
|
|
424
|
+
timeZone: undefined,
|
|
425
|
+
timeZoneNameStyle: 'long',
|
|
426
|
+
calendar,
|
|
427
|
+
})
|
|
428
|
+
: '';
|
|
432
429
|
// A relative name starts with the words the timestamp shows, then the full
|
|
433
430
|
// date. A control named from its content then keeps its visible words in its
|
|
434
431
|
// name, so voice control can find it (WCAG 2.5.3).
|
|
@@ -519,16 +516,27 @@ export function Timestamp({
|
|
|
519
516
|
return null;
|
|
520
517
|
}
|
|
521
518
|
|
|
519
|
+
// An unknown zone in an entry warns as the timestamp renders, before its
|
|
520
|
+
// card shows.
|
|
521
|
+
for (const entry of entries ?? []) {
|
|
522
|
+
resolveTimezoneID(entry.timezoneID);
|
|
523
|
+
}
|
|
524
|
+
|
|
522
525
|
// The rows the hover card renders: the configured entries, or the single
|
|
523
526
|
// default absolute line shown when none are set. Either way the surface is
|
|
524
|
-
// the same copyable card
|
|
525
|
-
//
|
|
526
|
-
|
|
527
|
+
// the same copyable card. The default line is a one-row card with the full
|
|
528
|
+
// absolute time in the viewer's zone and its compact abbreviation. It is
|
|
529
|
+
// copyable, just like a configured entry. The card reads them only while it
|
|
530
|
+
// shows, so a closed card formats nothing.
|
|
531
|
+
const getLines = (): ReadonlyArray<TimestampTooltipLine> =>
|
|
527
532
|
entries === undefined
|
|
528
533
|
? [
|
|
529
534
|
{
|
|
530
|
-
value:
|
|
531
|
-
|
|
535
|
+
value: formatInstant(date, 'full', locale, {
|
|
536
|
+
timeZone: undefined,
|
|
537
|
+
calendar,
|
|
538
|
+
}),
|
|
539
|
+
zoneName: formatZoneName(date, locale),
|
|
532
540
|
isCopyable: true,
|
|
533
541
|
},
|
|
534
542
|
]
|
|
@@ -588,7 +596,7 @@ export function Timestamp({
|
|
|
588
596
|
{showTooltip && (
|
|
589
597
|
<Suspense fallback={null}>
|
|
590
598
|
<LazyTimestampHoverCard
|
|
591
|
-
|
|
599
|
+
getLines={getLines}
|
|
592
600
|
label={t('@astryx.timestamp.detailsLabel')}
|
|
593
601
|
triggerRef={timeRef}
|
|
594
602
|
onCardOpenChange={setOpenCardId}
|
|
@@ -234,8 +234,11 @@ function EntryRow({
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
export interface TimestampHoverCardProps {
|
|
237
|
-
/**
|
|
238
|
-
|
|
237
|
+
/**
|
|
238
|
+
* The rows to render, each a labelled instant, optionally copyable. The card
|
|
239
|
+
* reads them only while it shows, so a closed card formats nothing.
|
|
240
|
+
*/
|
|
241
|
+
getLines: () => ReadonlyArray<TimestampTooltipLine>;
|
|
239
242
|
/** Accessible name for the card. */
|
|
240
243
|
label: string;
|
|
241
244
|
/** Persistent anchor, rendered outside the lazy boundary. */
|
|
@@ -263,6 +266,43 @@ function gridTemplateFor(
|
|
|
263
266
|
return gridTemplates.value;
|
|
264
267
|
}
|
|
265
268
|
|
|
269
|
+
/**
|
|
270
|
+
* The card's rows, as a semantic `<dl>` grid. The layer renders it only while
|
|
271
|
+
* the card shows, so the rows are formatted then.
|
|
272
|
+
*/
|
|
273
|
+
function CardLines({
|
|
274
|
+
getLines,
|
|
275
|
+
}: {
|
|
276
|
+
getLines: () => ReadonlyArray<TimestampTooltipLine>;
|
|
277
|
+
}): ReactNode {
|
|
278
|
+
const lines = getLines();
|
|
279
|
+
// A label column is only reserved when some row is labelled; otherwise the
|
|
280
|
+
// value sits flush at the card's leading edge. An action column is only
|
|
281
|
+
// reserved when some row is copyable (option B), so a fully read-only card
|
|
282
|
+
// has no trailing gutter.
|
|
283
|
+
const hasLabelColumn = lines.some(
|
|
284
|
+
line => line.label != null && line.label !== '',
|
|
285
|
+
);
|
|
286
|
+
const hasActionColumn = lines.some(line => line.isCopyable);
|
|
287
|
+
return (
|
|
288
|
+
<dl
|
|
289
|
+
{...stylex.props(
|
|
290
|
+
styles.dl,
|
|
291
|
+
gridTemplateFor(hasLabelColumn, hasActionColumn),
|
|
292
|
+
)}>
|
|
293
|
+
{lines.map((line, index) => (
|
|
294
|
+
<EntryRow
|
|
295
|
+
// eslint-disable-next-line @eslint-react/no-array-index-key -- rows are fixed positional slots and two entries may legitimately be identical
|
|
296
|
+
key={index}
|
|
297
|
+
line={line}
|
|
298
|
+
hasLabelColumn={hasLabelColumn}
|
|
299
|
+
hasActionColumn={hasActionColumn}
|
|
300
|
+
/>
|
|
301
|
+
))}
|
|
302
|
+
</dl>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
266
306
|
/**
|
|
267
307
|
* The copyable hover card for Timestamp. Renders a semantic `<dl>` as a grid:
|
|
268
308
|
* an optional label column, the value, and — when any row is copyable — a
|
|
@@ -273,7 +313,7 @@ function gridTemplateFor(
|
|
|
273
313
|
* interactive.
|
|
274
314
|
*/
|
|
275
315
|
export default function TimestampHoverCard({
|
|
276
|
-
|
|
316
|
+
getLines,
|
|
277
317
|
label,
|
|
278
318
|
triggerRef,
|
|
279
319
|
onCardOpenChange,
|
|
@@ -320,34 +360,7 @@ export default function TimestampHoverCard({
|
|
|
320
360
|
};
|
|
321
361
|
}, [triggerRef, positionRef, interactionRef, show, id]);
|
|
322
362
|
|
|
323
|
-
|
|
324
|
-
// value sits flush at the card's leading edge. An action column is only
|
|
325
|
-
// reserved when some row is copyable (option B), so a fully read-only card
|
|
326
|
-
// has no trailing gutter.
|
|
327
|
-
const hasLabelColumn = lines.some(
|
|
328
|
-
line => line.label != null && line.label !== '',
|
|
329
|
-
);
|
|
330
|
-
const hasActionColumn = lines.some(line => line.isCopyable);
|
|
331
|
-
|
|
332
|
-
const cardContent = (
|
|
333
|
-
<dl
|
|
334
|
-
{...stylex.props(
|
|
335
|
-
styles.dl,
|
|
336
|
-
gridTemplateFor(hasLabelColumn, hasActionColumn),
|
|
337
|
-
)}>
|
|
338
|
-
{lines.map((line, index) => (
|
|
339
|
-
<EntryRow
|
|
340
|
-
// eslint-disable-next-line @eslint-react/no-array-index-key -- rows are fixed positional slots and two entries may legitimately be identical
|
|
341
|
-
key={index}
|
|
342
|
-
line={line}
|
|
343
|
-
hasLabelColumn={hasLabelColumn}
|
|
344
|
-
hasActionColumn={hasActionColumn}
|
|
345
|
-
/>
|
|
346
|
-
))}
|
|
347
|
-
</dl>
|
|
348
|
-
);
|
|
349
|
-
|
|
350
|
-
return renderHoverCard(cardContent);
|
|
363
|
+
return renderHoverCard(<CardLines getLines={getLines} />);
|
|
351
364
|
}
|
|
352
365
|
|
|
353
366
|
TimestampHoverCard.displayName = 'TimestampHoverCard';
|
|
@@ -29,7 +29,11 @@
|
|
|
29
29
|
* - /packages/core/src/Timestamp/Timestamp.test.tsx
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
SHARED_DATE_FORMAT_OPTIONS,
|
|
34
|
+
dateTimeFormatAtCall,
|
|
35
|
+
getWallClock,
|
|
36
|
+
} from '../utils/plainDate';
|
|
33
37
|
import {
|
|
34
38
|
formatCalendarInstant,
|
|
35
39
|
type CalendarSystem,
|
|
@@ -147,7 +151,7 @@ export function formatZoneName(
|
|
|
147
151
|
timeZone?: string,
|
|
148
152
|
): string {
|
|
149
153
|
return (
|
|
150
|
-
|
|
154
|
+
dateTimeFormatAtCall(locale, {
|
|
151
155
|
timeZoneName: 'long',
|
|
152
156
|
...(timeZone === undefined ? {} : {timeZone}),
|
|
153
157
|
})
|
|
@@ -223,7 +227,7 @@ export function formatInstant(
|
|
|
223
227
|
);
|
|
224
228
|
|
|
225
229
|
case 'time':
|
|
226
|
-
return
|
|
230
|
+
return dateTimeFormatAtCall(locale, {
|
|
227
231
|
...TIME_OPTIONS,
|
|
228
232
|
...zoneName,
|
|
229
233
|
...zone,
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import {devWarn} from '../utils/devWarning';
|
|
25
|
+
import {dateTimeFormatFor} from '../utils/plainDate';
|
|
25
26
|
import {formatInstant, formatZoneName} from './formatInstant';
|
|
26
27
|
import type {InstantFormat} from './formatInstant';
|
|
27
28
|
import type {Locale} from '../i18n/types';
|
|
@@ -139,8 +140,9 @@ export function resolveTimezoneID(
|
|
|
139
140
|
// `value` is handled in Timestamp.tsx.
|
|
140
141
|
try {
|
|
141
142
|
// Locale does not affect time-zone identifier validity; pin one so this
|
|
142
|
-
// validation path stays explicit and deterministic.
|
|
143
|
-
|
|
143
|
+
// validation path stays explicit and deterministic. A valid zone's
|
|
144
|
+
// formatter is kept, so a later render checks it without building one.
|
|
145
|
+
dateTimeFormatFor('en-US', {timeZone: timezoneID});
|
|
144
146
|
} catch {
|
|
145
147
|
const report = `${context}: ${timezoneID}`;
|
|
146
148
|
if (!warnedTimezoneIDs.has(report)) {
|