@astryxdesign/core 0.7.17 → 0.7.18-canary.g32556bb
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/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +2 -2
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +3 -7
- package/dist/Table/TableRow.d.ts.map +1 -1
- package/dist/Table/TableRow.js +10 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +11 -3
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +203 -51
- 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/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +20 -3
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +3 -3
- package/dist/astryx.css +41 -10
- 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/themeProps.d.ts.map +1 -1
- package/dist/utils/themeProps.js +22 -3
- 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 +63 -6
- package/src/Table/Table.tsx +9 -4
- package/src/Table/TableCell.tsx +5 -2
- package/src/Table/TableHeaderCell.tsx +2 -8
- package/src/Table/TableRow.tsx +10 -1
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +250 -53
- 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/Toolbar/Toolbar.tsx +20 -6
- 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/themeProps.ts +22 -3
- package/src/utils/touchHitArea.ts +3 -2
- package/src/virtualization/useInlineListWindow.ts +102 -11
|
@@ -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)) {
|
package/src/Toast/Toast.doc.mjs
CHANGED
|
@@ -19,7 +19,14 @@ export const docs = {
|
|
|
19
19
|
],
|
|
20
20
|
|
|
21
21
|
playground: {
|
|
22
|
-
|
|
22
|
+
// Keep the card's timer off: the theme editor's preview page passes no
|
|
23
|
+
// onDismiss, so a timer that fires throws. autoHideDuration is the show
|
|
24
|
+
// function's 5000.
|
|
25
|
+
defaults: {
|
|
26
|
+
body: 'Changes saved',
|
|
27
|
+
isAutoHide: false,
|
|
28
|
+
autoHideDuration: 5000,
|
|
29
|
+
},
|
|
23
30
|
},
|
|
24
31
|
|
|
25
32
|
props: [
|
|
@@ -36,21 +43,22 @@ export const docs = {
|
|
|
36
43
|
name: 'type',
|
|
37
44
|
type: "'info' | 'error'",
|
|
38
45
|
description:
|
|
39
|
-
|
|
46
|
+
"Toast type controlling background color. useToast()'s show function sets it when it is not given.",
|
|
40
47
|
default: "'info'",
|
|
41
48
|
},
|
|
42
49
|
{
|
|
43
50
|
name: 'isAutoHide',
|
|
44
51
|
type: 'boolean',
|
|
45
52
|
description:
|
|
46
|
-
|
|
53
|
+
"Whether the toast auto-dismisses. useToast()'s show function sets it by type when it is not given.",
|
|
54
|
+
required: true,
|
|
47
55
|
},
|
|
48
56
|
{
|
|
49
57
|
name: 'autoHideDuration',
|
|
50
58
|
type: 'number',
|
|
51
59
|
description:
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
"Duration in ms before auto-dismiss. Timed content must satisfy WCAG 2.2.1. useToast()'s show function sets it when it is not given.",
|
|
61
|
+
required: true,
|
|
54
62
|
},
|
|
55
63
|
{
|
|
56
64
|
name: 'isExiting',
|
|
@@ -69,23 +77,6 @@ export const docs = {
|
|
|
69
77
|
{__element: 'Badge', props: {label: '3'}},
|
|
70
78
|
],
|
|
71
79
|
},
|
|
72
|
-
{
|
|
73
|
-
name: 'uniqueID',
|
|
74
|
-
type: 'string',
|
|
75
|
-
description: 'Unique identifier for deduplication.',
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: 'collisionBehavior',
|
|
79
|
-
type: "'overwrite' | 'ignore'",
|
|
80
|
-
description:
|
|
81
|
-
'Behavior when a toast with matching uniqueID already exists.',
|
|
82
|
-
default: "'overwrite'",
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: 'onHide',
|
|
86
|
-
type: '(reason: "auto" | "manual") => void',
|
|
87
|
-
description: 'Callback fired when the toast is removed.',
|
|
88
|
-
},
|
|
89
80
|
{
|
|
90
81
|
name: 'onDismiss',
|
|
91
82
|
type: '(reason: "auto" | "manual") => void',
|
|
@@ -156,7 +147,7 @@ export const docs = {
|
|
|
156
147
|
{
|
|
157
148
|
guidance: true,
|
|
158
149
|
description:
|
|
159
|
-
'
|
|
150
|
+
"Pass useToast()'s uniqueID option to deduplicate toasts that fire from repeated actions, like clicking a save button multiple times.",
|
|
160
151
|
},
|
|
161
152
|
{
|
|
162
153
|
guidance: true,
|
|
@@ -212,14 +203,12 @@ export const docs = {
|
|
|
212
203
|
export const docsZh = {
|
|
213
204
|
propDescriptions: {
|
|
214
205
|
body: '主要消息内容。',
|
|
215
|
-
type: 'Toast
|
|
216
|
-
isAutoHide:
|
|
206
|
+
type: 'Toast 类型,控制背景颜色。未传入时,由 useToast() 的 show 函数设置。',
|
|
207
|
+
isAutoHide:
|
|
208
|
+
'是否自动关闭。未传入时,由 useToast() 的 show 函数按类型设置。',
|
|
217
209
|
autoHideDuration:
|
|
218
|
-
'自动关闭前的持续时间(毫秒)。定时内容必须符合 WCAG 2.2.1
|
|
210
|
+
'自动关闭前的持续时间(毫秒)。定时内容必须符合 WCAG 2.2.1。未传入时,由 useToast() 的 show 函数设置。',
|
|
219
211
|
endContent: '尾部渲染的内容(如撤销按钮、链接)。操作标签应保持简短。',
|
|
220
|
-
uniqueID: '用于去重的唯一标识符。',
|
|
221
|
-
collisionBehavior: '当已存在相同 uniqueID 的 toast 时的行为。',
|
|
222
|
-
onHide: '当 toast 被移除时触发的回调。',
|
|
223
212
|
renderContent:
|
|
224
213
|
"用你自己的布局替换该 toast 卡片内部的内容。Astryx 保留卡片本身、astryx-toast 主题目标和自动关闭行为(在 ToastViewport 中由视口播报该 toast;当模态框承载视口时由卡片自行播报),并把消息、endContent、解析后的 toast 设置和 dismiss 回调交给渲染函数。自定义渲染函数完全拥有布局中的控件:请组合所需的控件并通过它调用 dismiss。Astryx 不会向自定义内容注入后备关闭按钮。按 toast 单独设置:应用可通过封装 useToast 并在每次调用时传入来共享同一套布局;而由库代码发起、从不传入该参数的 toast 会渲染为普通的 Astryx toast。传入参数为 {body, endContent, type, isAutoHide, autoHideDuration, dismiss},其中 type 为 'info' | 'error'。",
|
|
225
214
|
},
|
|
@@ -240,7 +229,7 @@ export const docsZh = {
|
|
|
240
229
|
{
|
|
241
230
|
guidance: true,
|
|
242
231
|
description:
|
|
243
|
-
'
|
|
232
|
+
'传入 useToast() 的 uniqueID 选项,去重重复操作触发的 toast,如多次点击保存按钮。',
|
|
244
233
|
},
|
|
245
234
|
{
|
|
246
235
|
guidance: true,
|
|
@@ -303,7 +292,8 @@ export const docsDense = {
|
|
|
303
292
|
},
|
|
304
293
|
{
|
|
305
294
|
guidance: true,
|
|
306
|
-
description:
|
|
295
|
+
description:
|
|
296
|
+
"useToast()'s uniqueID option to dedup repeated action toasts.",
|
|
307
297
|
},
|
|
308
298
|
{
|
|
309
299
|
guidance: true,
|
|
@@ -329,15 +319,12 @@ export const docsDense = {
|
|
|
329
319
|
},
|
|
330
320
|
propDescriptions: {
|
|
331
321
|
body: 'primary message content',
|
|
332
|
-
type: 'toast type; controls bg color;
|
|
333
|
-
isAutoHide: 'auto-dismiss;
|
|
322
|
+
type: 'toast type; controls bg color; set by useToast() show when omitted',
|
|
323
|
+
isAutoHide: 'auto-dismiss; set by type by useToast() show when omitted',
|
|
334
324
|
autoHideDuration:
|
|
335
|
-
'ms before auto-dismiss; timed content must satisfy WCAG 2.2.1',
|
|
325
|
+
'ms before auto-dismiss; timed content must satisfy WCAG 2.2.1; set by useToast() show when omitted',
|
|
336
326
|
endContent:
|
|
337
327
|
'trailing end content (undo btn, link); keep action labels short',
|
|
338
|
-
uniqueID: 'unique id for dedup',
|
|
339
|
-
collisionBehavior: 'behavior when matching uniqueID exists',
|
|
340
|
-
onHide: 'callback when toast removed',
|
|
341
328
|
renderContent:
|
|
342
329
|
'custom inner layout; receives content, resolved settings + dismiss callback; no injected fallback control',
|
|
343
330
|
},
|
package/src/Toast/Toast.tsx
CHANGED
|
@@ -127,6 +127,19 @@ const styles = stylex.create({
|
|
|
127
127
|
variantError: {
|
|
128
128
|
backgroundColor: colorVars['--color-background-error-inverted'],
|
|
129
129
|
},
|
|
130
|
+
// Restate the token as well as the color, so a caller's text follows the
|
|
131
|
+
// side too.
|
|
132
|
+
sideText: {
|
|
133
|
+
display: 'contents',
|
|
134
|
+
},
|
|
135
|
+
sideTextOnDark: {
|
|
136
|
+
'--color-text-primary': colorVars['--color-on-dark'],
|
|
137
|
+
color: colorVars['--color-on-dark'],
|
|
138
|
+
},
|
|
139
|
+
sideTextOnLight: {
|
|
140
|
+
'--color-text-primary': colorVars['--color-on-light'],
|
|
141
|
+
color: colorVars['--color-on-light'],
|
|
142
|
+
},
|
|
130
143
|
content: {
|
|
131
144
|
flex: 1,
|
|
132
145
|
minWidth: 0,
|
|
@@ -416,6 +429,7 @@ export function ToastSurface({
|
|
|
416
429
|
{
|
|
417
430
|
politeness: isError ? 'assertive' : 'polite',
|
|
418
431
|
announce,
|
|
432
|
+
isOncePerOccasion: true,
|
|
419
433
|
exclude:
|
|
420
434
|
renderContent != null
|
|
421
435
|
? TOAST_ANNOUNCEMENT_EXCLUDED_SELECTOR
|
|
@@ -474,6 +488,33 @@ export function ToastSurface({
|
|
|
474
488
|
true,
|
|
475
489
|
pickInvertedSide,
|
|
476
490
|
);
|
|
491
|
+
const mediaMode = measuredMediaMode ?? fallbackMediaMode;
|
|
492
|
+
// On a system-mode page the server does not know the reader's scheme.
|
|
493
|
+
// If the card's two sides differ, keep the ambient text until the client
|
|
494
|
+
// knows it. With no theme, Core's defaults give the two sides.
|
|
495
|
+
const textSides = useMemo(
|
|
496
|
+
() =>
|
|
497
|
+
sides ??
|
|
498
|
+
(isSchemeUnknown
|
|
499
|
+
? {
|
|
500
|
+
light: invertedSideIn(
|
|
501
|
+
resolveThemeTokens(null, {mode: 'light'}),
|
|
502
|
+
surfaceToken,
|
|
503
|
+
),
|
|
504
|
+
dark: invertedSideIn(
|
|
505
|
+
resolveThemeTokens(null, {mode: 'dark'}),
|
|
506
|
+
surfaceToken,
|
|
507
|
+
),
|
|
508
|
+
}
|
|
509
|
+
: null),
|
|
510
|
+
[sides, isSchemeUnknown, surfaceToken],
|
|
511
|
+
);
|
|
512
|
+
const isSideUnknown =
|
|
513
|
+
measuredMediaMode == null &&
|
|
514
|
+
isSchemeUnknown &&
|
|
515
|
+
textSides != null &&
|
|
516
|
+
textSides.light !== textSides.dark;
|
|
517
|
+
const textSide = isSideUnknown ? 'off' : mediaMode;
|
|
477
518
|
|
|
478
519
|
return (
|
|
479
520
|
<div
|
|
@@ -494,37 +535,44 @@ export function ToastSurface({
|
|
|
494
535
|
),
|
|
495
536
|
)}>
|
|
496
537
|
<MediaDarkPage side={measuredMediaMode == null ? darkPageSide : null}>
|
|
497
|
-
<MediaTheme mode={
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
538
|
+
<MediaTheme mode={mediaMode}>
|
|
539
|
+
<div
|
|
540
|
+
{...stylex.props(
|
|
541
|
+
styles.sideText,
|
|
542
|
+
textSide === 'dark' && styles.sideTextOnDark,
|
|
543
|
+
textSide === 'light' && styles.sideTextOnLight,
|
|
544
|
+
)}>
|
|
545
|
+
{renderContent ? (
|
|
546
|
+
renderContent({
|
|
547
|
+
body,
|
|
548
|
+
endContent,
|
|
549
|
+
type,
|
|
550
|
+
isAutoHide,
|
|
551
|
+
autoHideDuration,
|
|
552
|
+
dismiss: handleDismiss,
|
|
553
|
+
})
|
|
554
|
+
) : (
|
|
555
|
+
<div {...stylex.props(styles.inner)}>
|
|
556
|
+
<div ref={bodyRef} {...stylex.props(styles.content)}>
|
|
557
|
+
{body}
|
|
558
|
+
</div>
|
|
512
559
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
560
|
+
<div {...stylex.props(styles.endContent)}>
|
|
561
|
+
{endContent}
|
|
562
|
+
<Button
|
|
563
|
+
variant="ghost"
|
|
564
|
+
size="sm"
|
|
565
|
+
icon={<Icon icon="close" size="sm" color="inherit" />}
|
|
566
|
+
className={themeProps('toast-close').className}
|
|
567
|
+
xstyle={styles.close}
|
|
568
|
+
label={t('@astryx.toast.dismiss')}
|
|
569
|
+
onClick={handleDismiss}
|
|
570
|
+
isIconOnly
|
|
571
|
+
/>
|
|
572
|
+
</div>
|
|
525
573
|
</div>
|
|
526
|
-
|
|
527
|
-
|
|
574
|
+
)}
|
|
575
|
+
</div>
|
|
528
576
|
</MediaTheme>
|
|
529
577
|
</MediaDarkPage>
|
|
530
578
|
</div>
|
|
@@ -403,7 +403,7 @@ function ToastRow({
|
|
|
403
403
|
timerKey={entry.id}
|
|
404
404
|
announce={announce}
|
|
405
405
|
isRenderedBodyAnnouncement={
|
|
406
|
-
o.renderContent == null &&
|
|
406
|
+
o.renderContent == null && !isPlainTextBody(o.body)
|
|
407
407
|
}
|
|
408
408
|
hasEntryStarted={hasEntryStarted}
|
|
409
409
|
/>
|
|
@@ -414,6 +414,19 @@ function ToastRow({
|
|
|
414
414
|
}
|
|
415
415
|
ToastRow.displayName = 'ToastRow';
|
|
416
416
|
|
|
417
|
+
/**
|
|
418
|
+
* Whether the viewport can take a body's words when it dispatches the toast:
|
|
419
|
+
* a string, a number, or a list of them. Any element, a fragment included,
|
|
420
|
+
* can render other words than its children, so the toast reads it after
|
|
421
|
+
* commit.
|
|
422
|
+
*/
|
|
423
|
+
function isPlainTextBody(body: ReactNode): boolean {
|
|
424
|
+
if (typeof body === 'string' || typeof body === 'number') {
|
|
425
|
+
return true;
|
|
426
|
+
}
|
|
427
|
+
return Array.isArray(body) && body.every(isPlainTextBody);
|
|
428
|
+
}
|
|
429
|
+
|
|
417
430
|
/**
|
|
418
431
|
* ToastViewport renders ToastRefSync, which writes through useCommittedRefInto,
|
|
419
432
|
* before its children, so a child's layout cleanup reads the committed list.
|
|
@@ -534,10 +547,10 @@ export function ToastViewport({
|
|
|
534
547
|
|
|
535
548
|
// Announce toasts through the persistent singleton live regions. They are
|
|
536
549
|
// mounted empty and only mutated afterwards, which screen readers announce
|
|
537
|
-
// (see useAnnounce.ts).
|
|
538
|
-
// event-driven dispatch path. ToastSurface reads
|
|
539
|
-
// custom layout after commit
|
|
540
|
-
//
|
|
550
|
+
// (see useAnnounce.ts). A plain-text body is announced in addToast — the
|
|
551
|
+
// event-driven dispatch path. ToastSurface reads any other body, and a
|
|
552
|
+
// custom layout, after commit, because an element can render words that
|
|
553
|
+
// getNodeText cannot see. Both paths use this modal-aware writer.
|
|
541
554
|
// The viewport is each toast's only announcement owner; the card carries no
|
|
542
555
|
// live role. A top-layer viewport's host moves into the latest open native
|
|
543
556
|
// modal, where the page's shared channel is not exposed, so it writes
|
|
@@ -577,8 +590,10 @@ export function ToastViewport({
|
|
|
577
590
|
return;
|
|
578
591
|
}
|
|
579
592
|
// Only text is announced; interactive endContent is reachable via F6.
|
|
580
|
-
const
|
|
581
|
-
|
|
593
|
+
const {body, renderContent} = entry.options;
|
|
594
|
+
const text =
|
|
595
|
+
renderContent == null && isPlainTextBody(body) ? getNodeText(body) : '';
|
|
596
|
+
if (text) {
|
|
582
597
|
// Error toasts map to the assertive region (role="alert"); everything
|
|
583
598
|
// else to the polite region (role="status") — mirrors Toast.tsx.
|
|
584
599
|
announce(text, entry.options.type === 'error' ? 'assertive' : 'polite');
|
|
@@ -856,16 +871,21 @@ export function ToastViewport({
|
|
|
856
871
|
const insetStyle: React.CSSProperties = {
|
|
857
872
|
...layerInsetProperties(layerInset),
|
|
858
873
|
};
|
|
859
|
-
|
|
860
|
-
|
|
874
|
+
// A zero on the stack's own block edge replaces the provider's value. On
|
|
875
|
+
// the opposite edge a zero writes nothing, so it cannot move the stack.
|
|
876
|
+
const isTopStack = position === 'topEnd' || position === 'topStart';
|
|
877
|
+
const insetTop = inset?.top;
|
|
878
|
+
if (insetTop != null && (isTopStack || insetTop !== 0)) {
|
|
879
|
+
insetStyle.top = insetTop;
|
|
861
880
|
}
|
|
862
|
-
|
|
863
|
-
|
|
881
|
+
const insetBottom = inset?.bottom;
|
|
882
|
+
if (insetBottom != null && (!isTopStack || insetBottom !== 0)) {
|
|
883
|
+
insetStyle.bottom = insetBottom;
|
|
864
884
|
}
|
|
865
|
-
if (inset?.start) {
|
|
885
|
+
if (inset?.start != null) {
|
|
866
886
|
insetStyle.insetInlineStart = inset.start;
|
|
867
887
|
}
|
|
868
|
-
if (inset?.end) {
|
|
888
|
+
if (inset?.end != null) {
|
|
869
889
|
insetStyle.insetInlineEnd = inset.end;
|
|
870
890
|
}
|
|
871
891
|
|