@astryxdesign/core 0.1.5 → 0.1.6-canary.02f2602
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +2 -0
- package/dist/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +21 -18
- package/dist/AlertDialog/useImperativeAlertDialog.d.ts +0 -2
- package/dist/AlertDialog/useImperativeAlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/useImperativeAlertDialog.js +3 -5
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +55 -53
- package/dist/AspectRatio/AspectRatio.js +5 -5
- package/dist/Avatar/Avatar.js +19 -19
- package/dist/Avatar/AvatarStatusDot.js +5 -5
- package/dist/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +9 -6
- package/dist/AvatarGroup/AvatarGroupOverflow.js +5 -5
- package/dist/Badge/Badge.js +3 -3
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +32 -30
- package/dist/Blockquote/Blockquote.js +7 -7
- package/dist/Breadcrumbs/BreadcrumbItem.js +17 -17
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +11 -8
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +53 -23
- package/dist/ButtonGroup/ButtonGroup.d.ts +20 -5
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +34 -18
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +51 -48
- package/dist/Card/Card.js +3 -3
- package/dist/Carousel/Carousel.d.ts +1 -1
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +27 -24
- package/dist/Center/Center.js +3 -3
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +27 -24
- package/dist/Chat/ChatComposerDrawer.d.ts +1 -1
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +23 -16
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +20 -16
- package/dist/Chat/ChatDictationButton.js +10 -10
- package/dist/Chat/ChatLayout.d.ts +1 -11
- package/dist/Chat/ChatLayout.d.ts.map +1 -1
- package/dist/Chat/ChatLayout.js +23 -21
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +13 -11
- package/dist/Chat/ChatMessage.d.ts +1 -1
- package/dist/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/Chat/ChatMessage.js +20 -14
- package/dist/Chat/ChatMessageBubble.d.ts +1 -1
- package/dist/Chat/ChatMessageBubble.d.ts.map +1 -1
- package/dist/Chat/ChatMessageBubble.js +10 -8
- package/dist/Chat/ChatMessageList.d.ts +1 -1
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +17 -15
- package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
- package/dist/Chat/ChatMessageMetadata.js +24 -19
- package/dist/Chat/ChatPastedTextToken.d.ts.map +1 -1
- package/dist/Chat/ChatPastedTextToken.js +16 -14
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.js +6 -4
- package/dist/Chat/ChatSystemMessage.js +11 -11
- package/dist/Chat/ChatTokenizedText.js +8 -8
- package/dist/Chat/ChatToolCalls.js +73 -73
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +4 -2
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +19 -17
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +26 -24
- package/dist/CheckboxList/CheckboxList.d.ts +1 -1
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +12 -10
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +8 -6
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +20 -12
- package/dist/ClickableCard/ClickableCard.js +6 -6
- package/dist/Code/Code.js +3 -3
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +114 -96
- package/dist/Collapsible/Collapsible.js +11 -11
- package/dist/Collapsible/CollapsibleGroup.js +7 -7
- package/dist/CommandPalette/CommandPalette.d.ts +1 -1
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +39 -34
- package/dist/CommandPalette/CommandPaletteEmpty.js +3 -3
- package/dist/CommandPalette/CommandPaletteFooter.js +16 -16
- package/dist/CommandPalette/CommandPaletteGroup.js +5 -5
- package/dist/CommandPalette/CommandPaletteInput.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +17 -14
- package/dist/CommandPalette/CommandPaletteItem.js +3 -3
- package/dist/CommandPalette/CommandPaletteList.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteList.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteList.js +7 -4
- package/dist/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +14 -11
- package/dist/DateInput/DateInput.d.ts +1 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +28 -23
- package/dist/DateRangeInput/DateRangeInput.d.ts +1 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +32 -27
- package/dist/DateTimeInput/DateTimeInput.d.ts +1 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +41 -33
- package/dist/Dialog/Dialog.js +9 -9
- package/dist/Dialog/DialogHeader.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.js +20 -18
- package/dist/Dialog/useImperativeDialog.js +3 -3
- package/dist/Divider/Divider.js +7 -7
- package/dist/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +21 -15
- package/dist/DropdownMenu/DropdownMenuItem.js +3 -3
- package/dist/DropdownMenu/renderDropdownItems.js +10 -10
- package/dist/EmptyState/EmptyState.d.ts +4 -1
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/EmptyState/EmptyState.js +9 -9
- package/dist/Field/Field.js +17 -17
- package/dist/Field/FieldLabel.js +15 -15
- package/dist/Field/InputClearButton.js +5 -5
- package/dist/FieldStatus/FieldStatus.js +3 -3
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +34 -30
- package/dist/FormLayout/FormLayout.js +5 -5
- package/dist/Grid/Grid.js +3 -3
- package/dist/Grid/GridSpan.js +3 -3
- package/dist/HStack/HStack.js +3 -3
- package/dist/Heading/Heading.js +10 -10
- package/dist/HoverCard/HoverCard.js +9 -9
- package/dist/HoverCard/useHoverCard.js +3 -3
- package/dist/Icon/Icon.js +11 -11
- package/dist/Icon/defaultIcons.js +116 -116
- package/dist/IconButton/IconButton.js +3 -3
- package/dist/InputGroup/InputGroup.js +9 -9
- package/dist/InputGroup/InputGroupText.js +3 -3
- package/dist/Item/Item.js +17 -17
- package/dist/Kbd/Kbd.js +5 -5
- package/dist/Layer/LayerProvider.js +7 -7
- package/dist/Layer/useLayer.js +5 -5
- package/dist/Layout/Layout.js +21 -21
- package/dist/Layout/LayoutContent.js +3 -3
- package/dist/Layout/LayoutFooter.js +5 -5
- package/dist/Layout/LayoutHeader.js +5 -5
- package/dist/Layout/LayoutPanel.js +3 -3
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +35 -33
- package/dist/Lightbox/useLightbox.d.ts +0 -1
- package/dist/Lightbox/useLightbox.d.ts.map +1 -1
- package/dist/Lightbox/useLightbox.js +3 -4
- package/dist/Link/Link.d.ts +5 -3
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +47 -18
- package/dist/Link/LinkProvider.js +3 -3
- package/dist/Link/useLinkify.js +3 -3
- package/dist/List/List.js +11 -11
- package/dist/List/ListItem.js +11 -11
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +111 -109
- package/dist/MetadataList/MetadataList.js +10 -10
- package/dist/MetadataList/MetadataListItem.js +15 -15
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +19 -17
- package/dist/MobileNav/MobileNavToggle.d.ts +1 -1
- package/dist/MobileNav/MobileNavToggle.d.ts.map +1 -1
- package/dist/MobileNav/MobileNavToggle.js +9 -6
- package/dist/MoreMenu/MoreMenu.d.ts +1 -1
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +7 -4
- package/dist/MultiSelector/MultiSelector.d.ts +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +69 -62
- package/dist/NavIcon/NavIcon.js +3 -3
- package/dist/NavMenu/NavHeadingMenu.js +5 -5
- package/dist/NavMenu/NavHeadingMenuItem.js +8 -8
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +21 -17
- package/dist/Outline/Outline.d.ts +1 -1
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +19 -16
- package/dist/OverflowList/OverflowList.js +8 -8
- package/dist/Overlay/Overlay.js +3 -3
- package/dist/Overlay/OverlayScrim.js +5 -5
- package/dist/Overlay/useOverlay.d.ts +0 -3
- package/dist/Overlay/useOverlay.d.ts.map +1 -1
- package/dist/Overlay/useOverlay.js +3 -6
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +73 -46
- package/dist/Popover/Popover.js +16 -16
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +11 -8
- package/dist/PowerSearch/PowerSearch.d.ts +1 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +95 -85
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +109 -103
- package/dist/PowerSearch/PowerSearchFilterEditor.js +3 -3
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +12 -8
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +88 -75
- package/dist/PowerSearch/formatFilterValue.d.ts +2 -1
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +19 -9
- package/dist/PowerSearch/index.d.ts +2 -1
- package/dist/PowerSearch/index.d.ts.map +1 -1
- package/dist/PowerSearch/index.js +1 -0
- package/dist/PowerSearch/resolveOperatorLabel.d.ts +23 -0
- package/dist/PowerSearch/resolveOperatorLabel.d.ts.map +1 -0
- package/dist/PowerSearch/resolveOperatorLabel.js +28 -0
- package/dist/PowerSearch/types.d.ts +28 -2
- package/dist/PowerSearch/types.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchConfig.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchConfig.js +27 -27
- package/dist/PowerSearch/usePowerSearchSource.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchSource.js +15 -8
- package/dist/ProgressBar/ProgressBar.js +13 -13
- package/dist/RadioList/RadioList.js +7 -7
- package/dist/RadioList/RadioListItem.js +18 -18
- package/dist/Resizable/ResizeHandle.d.ts +1 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +10 -7
- package/dist/Section/Section.js +5 -5
- package/dist/SegmentedControl/SegmentedControl.js +5 -5
- package/dist/SegmentedControl/SegmentedControlItem.js +7 -7
- package/dist/SelectableCard/SelectableCard.js +5 -5
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +57 -51
- package/dist/Selector/SelectorOption.js +3 -3
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +38 -36
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +8 -6
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +92 -90
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +49 -43
- package/dist/SideNav/SideNavSection.js +14 -14
- package/dist/Skeleton/Skeleton.js +3 -3
- package/dist/Slider/Slider.js +23 -23
- package/dist/Spinner/Spinner.js +9 -9
- package/dist/StatusDot/StatusDot.js +5 -5
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +29 -27
- package/dist/TabList/Tab.js +18 -18
- package/dist/TabList/TabList.d.ts +1 -1
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +9 -6
- package/dist/TabList/TabMenu.js +23 -23
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +39 -37
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +10 -8
- package/dist/Table/TableBody.js +3 -3
- package/dist/Table/TableCell.js +3 -3
- package/dist/Table/TableFooter.js +3 -3
- package/dist/Table/TableHeader.js +3 -3
- package/dist/Table/TableHeaderCell.js +3 -3
- package/dist/Table/TableRow.js +5 -5
- package/dist/Table/index.d.ts +4 -0
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +2 -0
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +9 -9
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +127 -90
- package/dist/Table/plugins/groupedRows/index.d.ts +3 -0
- package/dist/Table/plugins/groupedRows/index.d.ts.map +1 -0
- package/dist/Table/plugins/groupedRows/index.js +3 -0
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts +78 -0
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -0
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +257 -0
- package/dist/Table/plugins/pagination/useTablePagination.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/useTablePagination.js +12 -9
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +30 -28
- package/dist/Table/plugins/rowIndex/index.d.ts +3 -0
- package/dist/Table/plugins/rowIndex/index.d.ts.map +1 -0
- package/dist/Table/plugins/rowIndex/index.js +3 -0
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts +50 -0
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts.map +1 -0
- package/dist/Table/plugins/rowIndex/useTableRowIndex.js +91 -0
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +23 -20
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +23 -21
- package/dist/Table/tableContextMenu.js +9 -9
- package/dist/Text/Text.js +10 -10
- package/dist/TextArea/TextArea.js +14 -14
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +20 -16
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +37 -31
- package/dist/TimeInput/TimeInput.d.ts +1 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +28 -23
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +29 -14
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +17 -15
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +14 -12
- package/dist/Toast/useToast.js +4 -4
- package/dist/ToggleButton/ToggleButton.js +12 -12
- package/dist/ToggleButton/ToggleButtonGroup.js +5 -5
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +29 -23
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +33 -31
- package/dist/Toolbar/Toolbar.js +18 -18
- package/dist/Tooltip/Tooltip.js +11 -11
- package/dist/Tooltip/useTooltip.js +3 -3
- package/dist/TopNav/TopNav.d.ts +2 -1
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +36 -33
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +72 -70
- package/dist/TopNav/TopNavItem.js +5 -5
- package/dist/TopNav/TopNavMegaMenu.js +30 -30
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.js +10 -10
- package/dist/TopNav/TopNavMegaMenuItem.js +16 -16
- package/dist/TopNav/TopNavMenu.js +32 -32
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +13 -9
- package/dist/TreeList/TreeListBranches.js +11 -11
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +37 -31
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +26 -22
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +15 -13
- package/dist/Typeahead/TypeaheadItem.js +10 -10
- package/dist/VStack/VStack.js +3 -3
- package/dist/VisuallyHidden/VisuallyHidden.d.ts +1 -3
- package/dist/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js +1 -3
- package/dist/astryx.css +20 -2
- package/dist/astryx.umd.js +66 -64
- package/dist/astryx.umd.js.map +4 -4
- package/dist/authoring/doc.d.ts +145 -0
- package/dist/authoring/doc.d.ts.map +1 -0
- package/dist/authoring/doc.js +100 -0
- package/dist/authoring/index.d.ts +29 -0
- package/dist/authoring/index.d.ts.map +1 -0
- package/dist/authoring/index.js +28 -0
- package/dist/authoring/integration.d.ts +35 -0
- package/dist/authoring/integration.d.ts.map +1 -0
- package/dist/authoring/integration.js +30 -0
- package/dist/authoring/template.d.ts +66 -0
- package/dist/authoring/template.d.ts.map +1 -0
- package/dist/authoring/template.js +55 -0
- package/dist/config.d.ts +80 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +40 -0
- package/dist/hooks/useKeyboardHint.js +9 -9
- package/dist/i18n/InternationalizationContext.d.ts +12 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -0
- package/dist/i18n/InternationalizationContext.js +29 -0
- package/dist/i18n/InternationalizationProvider.d.ts +62 -0
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -0
- package/dist/i18n/InternationalizationProvider.js +44 -0
- package/dist/i18n/index.d.ts +24 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +21 -0
- package/dist/i18n/resolve.d.ts +22 -0
- package/dist/i18n/resolve.d.ts.map +1 -0
- package/dist/i18n/resolve.js +141 -0
- package/dist/i18n/translator.d.ts +25 -0
- package/dist/i18n/translator.d.ts.map +1 -0
- package/dist/i18n/translator.js +1 -0
- package/dist/i18n/types.d.ts +47 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +1 -0
- package/dist/i18n/useTranslator.d.ts +15 -0
- package/dist/i18n/useTranslator.d.ts.map +1 -0
- package/dist/i18n/useTranslator.js +39 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/theme/MediaTheme.js +3 -3
- package/dist/theme/Theme.js +7 -7
- package/dist/theme/syntax/SyntaxTheme.js +5 -5
- package/locales/en.json +746 -0
- package/locales/pseudo.json +560 -0
- package/package.json +24 -3
- package/src/AlertDialog/AlertDialog.doc.mjs +5 -0
- package/src/AlertDialog/AlertDialog.tsx +4 -1
- package/src/AlertDialog/useImperativeAlertDialog.tsx +0 -2
- package/src/AppShell/AppShell.doc.mjs +8 -2
- package/src/AppShell/AppShell.tsx +3 -1
- package/src/AvatarGroup/AvatarGroup.tsx +4 -1
- package/src/Banner/Banner.tsx +10 -5
- package/src/Breadcrumbs/Breadcrumbs.tsx +4 -1
- package/src/Button/Button.tsx +34 -4
- package/src/ButtonGroup/ButtonGroup.test.tsx +386 -2
- package/src/ButtonGroup/ButtonGroup.tsx +27 -11
- package/src/Calendar/Calendar.tsx +8 -5
- package/src/Card/Card.doc.mjs +3 -3
- package/src/Carousel/Carousel.tsx +10 -7
- package/src/Chat/ChatComposer.tsx +5 -1
- package/src/Chat/ChatComposerDrawer.tsx +9 -2
- package/src/Chat/ChatComposerInput.tsx +10 -4
- package/src/Chat/ChatLayout.tsx +5 -12
- package/src/Chat/ChatLayoutScrollButton.tsx +4 -2
- package/src/Chat/ChatMessage.tsx +5 -1
- package/src/Chat/ChatMessageBubble.tsx +2 -0
- package/src/Chat/ChatMessageList.doc.mjs +1 -1
- package/src/Chat/ChatMessageList.tsx +2 -0
- package/src/Chat/ChatMessageMetadata.tsx +15 -9
- package/src/Chat/ChatPastedTextToken.tsx +3 -1
- package/src/Chat/ChatSendButton.tsx +3 -1
- package/src/Chat/ChatToolCalls.doc.mjs +1 -1
- package/src/Chat/useSpeechRecognition.ts +11 -2
- package/src/Chat/useTriggerMenu.tsx +4 -2
- package/src/CheckboxInput/CheckboxInput.test.tsx +16 -0
- package/src/CheckboxInput/CheckboxInput.tsx +4 -2
- package/src/CheckboxList/CheckboxList.doc.mjs +6 -1
- package/src/CheckboxList/CheckboxList.tsx +2 -0
- package/src/CheckboxList/CheckboxListItem.tsx +7 -1
- package/src/Citation/Citation.tsx +4 -2
- package/src/ClickableCard/ClickableCard.doc.mjs +1 -1
- package/src/CodeBlock/CodeBlock.tsx +91 -40
- package/src/Collapsible/Collapsible.doc.mjs +3 -3
- package/src/CommandPalette/CommandPalette.tsx +10 -3
- package/src/CommandPalette/CommandPaletteInput.test.tsx +1 -1
- package/src/CommandPalette/CommandPaletteInput.tsx +5 -1
- package/src/CommandPalette/CommandPaletteList.tsx +4 -1
- package/src/ContextMenu/ContextMenu.tsx +4 -1
- package/src/DateInput/DateInput.doc.mjs +2 -2
- package/src/DateInput/DateInput.tsx +13 -5
- package/src/DateRangeInput/DateRangeInput.doc.mjs +7 -7
- package/src/DateRangeInput/DateRangeInput.tsx +14 -6
- package/src/DateTimeInput/DateTimeInput.doc.mjs +2 -2
- package/src/DateTimeInput/DateTimeInput.tsx +17 -7
- package/src/Dialog/DialogHeader.tsx +4 -2
- package/src/DropdownMenu/DropdownMenu.tsx +12 -8
- package/src/EmptyState/EmptyState.doc.mjs +3 -3
- package/src/EmptyState/EmptyState.tsx +4 -1
- package/src/Field/Field.doc.mjs +2 -2
- package/src/FileInput/FileInput.tsx +3 -1
- package/src/Grid/Grid.doc.mjs +5 -5
- package/src/InputGroup/InputGroup.doc.mjs +1 -1
- package/src/Layer/useLayer.doc.mjs +2 -2
- package/src/Lightbox/Lightbox.doc.mjs +7 -2
- package/src/Lightbox/Lightbox.tsx +6 -4
- package/src/Lightbox/useLightbox.tsx +0 -1
- package/src/Link/Link.test.tsx +74 -2
- package/src/Link/Link.tsx +48 -3
- package/src/Markdown/Markdown.tsx +12 -4
- package/src/MobileNav/MobileNav.tsx +4 -2
- package/src/MobileNav/MobileNavToggle.tsx +5 -3
- package/src/MoreMenu/MoreMenu.tsx +4 -1
- package/src/MultiSelector/MultiSelector.tsx +14 -5
- package/src/NumberInput/NumberInput.tsx +3 -1
- package/src/Outline/Outline.tsx +4 -1
- package/src/OverflowList/OverflowList.doc.mjs +2 -2
- package/src/Overlay/useOverlay.tsx +0 -3
- package/src/Pagination/Pagination.tsx +35 -12
- package/src/Popover/usePopover.tsx +6 -1
- package/src/PowerSearch/PowerSearch.doc.mjs +9 -4
- package/src/PowerSearch/PowerSearch.tsx +22 -10
- package/src/PowerSearch/PowerSearchEditPopover.tsx +27 -20
- package/src/PowerSearch/PowerSearchToken.tsx +17 -6
- package/src/PowerSearch/PowerSearchValueEditor.tsx +34 -21
- package/src/PowerSearch/formatFilterValue.test.ts +282 -0
- package/src/PowerSearch/formatFilterValue.ts +21 -8
- package/src/PowerSearch/index.ts +5 -0
- package/src/PowerSearch/resolveOperatorLabel.ts +34 -0
- package/src/PowerSearch/types.ts +33 -9
- package/src/PowerSearch/usePowerSearchConfig.ts +59 -27
- package/src/PowerSearch/usePowerSearchSource.ts +17 -8
- package/src/RadioList/RadioList.doc.mjs +1 -1
- package/src/Resizable/ResizeHandle.tsx +4 -1
- package/src/Section/Section.doc.mjs +4 -4
- package/src/SelectableCard/SelectableCard.doc.mjs +1 -1
- package/src/Selector/Selector.tsx +11 -6
- package/src/SideNav/SideNav.tsx +4 -2
- package/src/SideNav/SideNavCollapseButton.tsx +3 -1
- package/src/SideNav/SideNavHeading.tsx +5 -3
- package/src/SideNav/SideNavItem.tsx +3 -1
- package/src/Slider/Slider.doc.mjs +2 -2
- package/src/Stack/Stack.doc.mjs +10 -10
- package/src/Switch/Switch.doc.mjs +2 -2
- package/src/Switch/Switch.test.tsx +16 -0
- package/src/Switch/Switch.tsx +4 -2
- package/src/TabList/TabList.tsx +4 -1
- package/src/Table/BaseTable.tsx +8 -1
- package/src/Table/Table.doc.mjs +1 -1
- package/src/Table/Table.tsx +3 -1
- package/src/Table/index.ts +7 -0
- package/src/Table/plugins/filtering/useTableFiltering.tsx +31 -30
- package/src/Table/plugins/groupedRows/index.ts +7 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows.test.tsx +231 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +351 -0
- package/src/Table/plugins/pagination/useTablePagination.tsx +4 -1
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +8 -4
- package/src/Table/plugins/rowIndex/index.ts +4 -0
- package/src/Table/plugins/rowIndex/useTableRowIndex.test.tsx +132 -0
- package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +114 -0
- package/src/Table/plugins/selection/useTableSelection.tsx +6 -7
- package/src/Table/plugins/sortable/useTableSortable.tsx +8 -5
- package/src/Table/useTableFiltering.doc.mjs +2 -2
- package/src/Table/useTableGroupedRows.doc.mjs +71 -0
- package/src/Table/useTableRowIndex.doc.mjs +50 -0
- package/src/Table/useTableSortable.doc.mjs +11 -11
- package/src/Text/Text.doc.mjs +2 -2
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/Thumbnail/Thumbnail.tsx +4 -2
- package/src/TimeInput/TimeInput.doc.mjs +2 -2
- package/src/TimeInput/TimeInput.tsx +6 -2
- package/src/Timestamp/Timestamp.doc.mjs +4 -4
- package/src/Timestamp/Timestamp.test.tsx +120 -7
- package/src/Timestamp/Timestamp.tsx +21 -1
- package/src/Toast/Toast.tsx +3 -1
- package/src/Toast/ToastViewport.tsx +3 -1
- package/src/Token/Token.tsx +4 -2
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tokenizer/Tokenizer.tsx +4 -4
- package/src/Toolbar/Toolbar.doc.mjs +1 -1
- package/src/TopNav/TopNav.doc.mjs +1 -0
- package/src/TopNav/TopNav.test.tsx +30 -0
- package/src/TopNav/TopNav.tsx +6 -4
- package/src/TopNav/TopNavHeading.tsx +5 -3
- package/src/TreeList/TreeList.tsx +5 -1
- package/src/TreeList/TreeListItem.tsx +6 -1
- package/src/Typeahead/BaseTypeahead.tsx +11 -4
- package/src/Typeahead/Typeahead.doc.mjs +1 -1
- package/src/Typeahead/Typeahead.tsx +3 -1
- package/src/VisuallyHidden/VisuallyHidden.tsx +1 -3
- package/src/authoring/doc.ts +166 -0
- package/src/authoring/index.test.ts +52 -0
- package/src/authoring/index.ts +50 -0
- package/src/authoring/integration.ts +42 -0
- package/src/authoring/template.ts +74 -0
- package/src/config.test.ts +16 -0
- package/src/config.ts +92 -0
- package/src/docPropLiterals.test.ts +902 -0
- package/src/hooks/useHotkeys.doc.mjs +5 -5
- package/src/i18n/InternationalizationContext.ts +39 -0
- package/src/i18n/InternationalizationProvider.doc.mjs +72 -0
- package/src/i18n/InternationalizationProvider.tsx +83 -0
- package/src/i18n/__tests__/e2e-pagination.test.tsx +172 -0
- package/src/i18n/__tests__/e2e-powersearch.test.tsx +130 -0
- package/src/i18n/__tests__/resolve.test.ts +284 -0
- package/src/i18n/index.ts +32 -0
- package/src/i18n/resolve.ts +165 -0
- package/src/i18n/translator.ts +31 -0
- package/src/i18n/types.ts +53 -0
- package/src/i18n/useTranslator.doc.mjs +46 -0
- package/src/i18n/useTranslator.ts +50 -0
- package/src/index.ts +3 -0
- package/dist/NavItem/index.d.ts +0 -9
- package/dist/NavItem/index.d.ts.map +0 -1
- package/dist/NavItem/index.js +0 -10
- package/src/NavItem/index.ts +0 -11
|
@@ -25,7 +25,7 @@ import { useLayer } from "../Layer/useLayer.js";
|
|
|
25
25
|
// ---------------------------------------------------------------------------
|
|
26
26
|
// Types
|
|
27
27
|
// ---------------------------------------------------------------------------
|
|
28
|
-
import {
|
|
28
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
29
|
// ---------------------------------------------------------------------------
|
|
30
30
|
// Styles
|
|
31
31
|
// ---------------------------------------------------------------------------
|
|
@@ -187,23 +187,23 @@ export function useKeyboardHint(options = {}) {
|
|
|
187
187
|
|
|
188
188
|
// --- Render the hint element ---
|
|
189
189
|
|
|
190
|
-
const arrowContent = /*#__PURE__*/
|
|
190
|
+
const arrowContent = /*#__PURE__*/_jsx("span", {
|
|
191
191
|
...{
|
|
192
192
|
className: "x3nfvp2 x6s0dn4 xzye2dw"
|
|
193
193
|
},
|
|
194
|
-
children: ARROW_HINT_KEYS[orientation].map(key => /*#__PURE__*/
|
|
194
|
+
children: ARROW_HINT_KEYS[orientation].map(key => /*#__PURE__*/_jsx(Kbd, {
|
|
195
195
|
keys: key
|
|
196
|
-
}, key
|
|
197
|
-
}
|
|
198
|
-
const hintElement = layer.render(/*#__PURE__*/
|
|
196
|
+
}, key))
|
|
197
|
+
});
|
|
198
|
+
const hintElement = layer.render(/*#__PURE__*/_jsxs("span", {
|
|
199
199
|
"aria-hidden": "true",
|
|
200
|
-
children: [arrowContent, /*#__PURE__*/
|
|
200
|
+
children: [arrowContent, /*#__PURE__*/_jsx("span", {
|
|
201
201
|
...{
|
|
202
202
|
className: "x11g1kdw"
|
|
203
203
|
},
|
|
204
204
|
children: "to navigate"
|
|
205
|
-
}
|
|
206
|
-
}
|
|
205
|
+
})]
|
|
206
|
+
}), {
|
|
207
207
|
placement: 'below',
|
|
208
208
|
alignment: 'start',
|
|
209
209
|
xstyle: styles.hint,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Locale, MessagesByLocale, Overrides } from './types';
|
|
2
|
+
export interface InternationalizationContextValue {
|
|
3
|
+
locale: Locale;
|
|
4
|
+
messages: MessagesByLocale;
|
|
5
|
+
overrides?: Overrides;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Default value falls through to the shipped en catalog in resolve().
|
|
9
|
+
* A consumer that doesn't render a provider still gets English defaults.
|
|
10
|
+
*/
|
|
11
|
+
export declare const InternationalizationContext: import("react").Context<InternationalizationContextValue>;
|
|
12
|
+
//# sourceMappingURL=InternationalizationContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InternationalizationContext.d.ts","sourceRoot":"","sources":["../../src/i18n/InternationalizationContext.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AAEjE,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,2DAIpC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file InternationalizationContext.ts
|
|
7
|
+
* @input React createContext, i18n types
|
|
8
|
+
* @output Exports InternationalizationContext and InternationalizationContextValue
|
|
9
|
+
* @position Context definition for client-side locale + messages
|
|
10
|
+
*
|
|
11
|
+
* Separated from InternationalizationProvider.tsx so components can consume
|
|
12
|
+
* the context without pulling in the full provider implementation.
|
|
13
|
+
* Follows the LinkContext.ts / ThemeContext.ts pattern.
|
|
14
|
+
*
|
|
15
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
16
|
+
* - /packages/core/src/i18n/InternationalizationProvider.tsx
|
|
17
|
+
* - /packages/core/src/i18n/t.client.ts
|
|
18
|
+
* - /packages/core/src/i18n/index.ts
|
|
19
|
+
*/
|
|
20
|
+
import { createContext } from 'react';
|
|
21
|
+
/**
|
|
22
|
+
* Default value falls through to the shipped en catalog in resolve().
|
|
23
|
+
* A consumer that doesn't render a provider still gets English defaults.
|
|
24
|
+
*/
|
|
25
|
+
export const InternationalizationContext = /*#__PURE__*/createContext({
|
|
26
|
+
locale: 'en',
|
|
27
|
+
messages: {}
|
|
28
|
+
});
|
|
29
|
+
InternationalizationContext.displayName = 'InternationalizationContext';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file InternationalizationProvider.tsx
|
|
3
|
+
* @input React, InternationalizationContext, i18n types
|
|
4
|
+
* @output Exports InternationalizationProvider component and props type
|
|
5
|
+
* @position Provider component for astryx i18n locale + messages
|
|
6
|
+
*
|
|
7
|
+
* Wraps a subtree with a locale and (optional) additional message catalogs +
|
|
8
|
+
* overrides. Astryx components inside the subtree resolve their strings via
|
|
9
|
+
* this context. If a consumer never renders a provider, astryx components
|
|
10
|
+
* still work — they use the shipped en catalog directly.
|
|
11
|
+
*
|
|
12
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
13
|
+
* - /packages/core/src/i18n/InternationalizationContext.ts
|
|
14
|
+
* - /packages/core/src/i18n/index.ts
|
|
15
|
+
* - /packages/core/src/i18n/InternationalizationProvider.doc.mjs
|
|
16
|
+
*/
|
|
17
|
+
import { type ReactNode } from 'react';
|
|
18
|
+
import type { Locale, MessagesByLocale, Overrides } from './types';
|
|
19
|
+
export interface InternationalizationProviderProps {
|
|
20
|
+
/**
|
|
21
|
+
* BCP 47 language tag. Examples: `'en'`, `'pt'`, `'pt-BR'`, `'zh-Hans'`.
|
|
22
|
+
*
|
|
23
|
+
* Regional tags are respected — resolving a message walks the tag from
|
|
24
|
+
* most-specific to least-specific (`pt-BR` → `pt`), then falls back to
|
|
25
|
+
* the shipped `en` catalog.
|
|
26
|
+
*/
|
|
27
|
+
locale: Locale;
|
|
28
|
+
/**
|
|
29
|
+
* Additional shipped catalogs to make available for the selected locale.
|
|
30
|
+
* `en` is bundled with astryx and never needs to be listed here.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```
|
|
34
|
+
* import {fr} from '@astryxdesign/core/locales/fr.json';
|
|
35
|
+
* <InternationalizationProvider locale="fr" messages={{fr}}>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
messages?: MessagesByLocale;
|
|
39
|
+
/**
|
|
40
|
+
* Sparse per-locale overrides applied on top of shipped defaults.
|
|
41
|
+
* Only the keys you want to override need to be listed.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```
|
|
45
|
+
* <InternationalizationProvider
|
|
46
|
+
* locale="fr"
|
|
47
|
+
* overrides={{fr: {'@astryx.pagination.next': 'Suivant'}}}
|
|
48
|
+
* >
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
overrides?: Overrides;
|
|
52
|
+
children: ReactNode;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Provides locale + additional messages + overrides to all astryx
|
|
56
|
+
* components in the subtree.
|
|
57
|
+
*/
|
|
58
|
+
export declare function InternationalizationProvider({ locale, messages, overrides, children, }: InternationalizationProviderProps): import("react").JSX.Element;
|
|
59
|
+
export declare namespace InternationalizationProvider {
|
|
60
|
+
var displayName: string;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=InternationalizationProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InternationalizationProvider.d.ts","sourceRoot":"","sources":["../../src/i18n/InternationalizationProvider.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAE9C,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AAEjE,MAAM,WAAW,iCAAiC;IAChD;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,MAAM,EACN,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,EAAE,iCAAiC,+BAUnC;yBAfe,4BAA4B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file InternationalizationProvider.tsx
|
|
7
|
+
* @input React, InternationalizationContext, i18n types
|
|
8
|
+
* @output Exports InternationalizationProvider component and props type
|
|
9
|
+
* @position Provider component for astryx i18n locale + messages
|
|
10
|
+
*
|
|
11
|
+
* Wraps a subtree with a locale and (optional) additional message catalogs +
|
|
12
|
+
* overrides. Astryx components inside the subtree resolve their strings via
|
|
13
|
+
* this context. If a consumer never renders a provider, astryx components
|
|
14
|
+
* still work — they use the shipped en catalog directly.
|
|
15
|
+
*
|
|
16
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
17
|
+
* - /packages/core/src/i18n/InternationalizationContext.ts
|
|
18
|
+
* - /packages/core/src/i18n/index.ts
|
|
19
|
+
* - /packages/core/src/i18n/InternationalizationProvider.doc.mjs
|
|
20
|
+
*/
|
|
21
|
+
import { useMemo } from 'react';
|
|
22
|
+
import { InternationalizationContext } from "./InternationalizationContext.js";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
/**
|
|
25
|
+
* Provides locale + additional messages + overrides to all astryx
|
|
26
|
+
* components in the subtree.
|
|
27
|
+
*/
|
|
28
|
+
export function InternationalizationProvider({
|
|
29
|
+
locale,
|
|
30
|
+
messages,
|
|
31
|
+
overrides,
|
|
32
|
+
children
|
|
33
|
+
}) {
|
|
34
|
+
const value = useMemo(() => ({
|
|
35
|
+
locale,
|
|
36
|
+
messages: messages ?? {},
|
|
37
|
+
overrides
|
|
38
|
+
}), [locale, messages, overrides]);
|
|
39
|
+
return /*#__PURE__*/_jsx(InternationalizationContext, {
|
|
40
|
+
value: value,
|
|
41
|
+
children: children
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
InternationalizationProvider.displayName = 'InternationalizationProvider';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts
|
|
3
|
+
* @input Imports from InternationalizationProvider, InternationalizationContext,
|
|
4
|
+
* useTranslator, translator, types
|
|
5
|
+
* @output Public surface for the i18n subpackage
|
|
6
|
+
* @position Component entry point; re-exported by /packages/core/src/index.ts
|
|
7
|
+
*
|
|
8
|
+
* The public API is deliberately small:
|
|
9
|
+
* - InternationalizationProvider — provider component
|
|
10
|
+
* - useTranslator — hook returning a translator function
|
|
11
|
+
* - Translator — interface for consumer-injected runtimes
|
|
12
|
+
*
|
|
13
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
14
|
+
* - /packages/core/src/index.ts
|
|
15
|
+
*/
|
|
16
|
+
export { InternationalizationProvider } from './InternationalizationProvider';
|
|
17
|
+
export type { InternationalizationProviderProps } from './InternationalizationProvider';
|
|
18
|
+
export { InternationalizationContext } from './InternationalizationContext';
|
|
19
|
+
export type { InternationalizationContextValue } from './InternationalizationContext';
|
|
20
|
+
export { useTranslator } from './useTranslator';
|
|
21
|
+
export type { TranslatorFn } from './useTranslator';
|
|
22
|
+
export type { Translator } from './translator';
|
|
23
|
+
export type { Locale, Catalog, MessageEntry, MessagesByLocale, Overrides, } from './types';
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,4BAA4B,EAAC,MAAM,gCAAgC,CAAC;AAC5E,YAAY,EAAC,iCAAiC,EAAC,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAC,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAC1E,YAAY,EAAC,gCAAgC,EAAC,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAC7C,YAAY,EACV,MAAM,EACN,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,SAAS,GACV,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file index.ts
|
|
5
|
+
* @input Imports from InternationalizationProvider, InternationalizationContext,
|
|
6
|
+
* useTranslator, translator, types
|
|
7
|
+
* @output Public surface for the i18n subpackage
|
|
8
|
+
* @position Component entry point; re-exported by /packages/core/src/index.ts
|
|
9
|
+
*
|
|
10
|
+
* The public API is deliberately small:
|
|
11
|
+
* - InternationalizationProvider — provider component
|
|
12
|
+
* - useTranslator — hook returning a translator function
|
|
13
|
+
* - Translator — interface for consumer-injected runtimes
|
|
14
|
+
*
|
|
15
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
16
|
+
* - /packages/core/src/index.ts
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export { InternationalizationProvider } from "./InternationalizationProvider.js";
|
|
20
|
+
export { InternationalizationContext } from "./InternationalizationContext.js";
|
|
21
|
+
export { useTranslator } from "./useTranslator.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Locale, MessagesByLocale, Overrides } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Walk a BCP 47 tag from most-specific to least-specific.
|
|
4
|
+
* Input is canonicalized via `Intl.Locale.baseName` so `pt-br` and `PT-BR`
|
|
5
|
+
* both produce `['pt-BR', 'pt']`.
|
|
6
|
+
*
|
|
7
|
+
* Examples:
|
|
8
|
+
* 'pt-BR' → ['pt-BR', 'pt']
|
|
9
|
+
* 'zh-Hans-CN' → ['zh-Hans-CN', 'zh-Hans', 'zh']
|
|
10
|
+
* 'en' → ['en']
|
|
11
|
+
*
|
|
12
|
+
* `en` is intentionally NOT appended here — the caller falls back to the
|
|
13
|
+
* shipped en catalog separately as the final source-of-truth.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveLocaleChain(locale: Locale): Locale[];
|
|
16
|
+
export declare function resolve(key: string, values: Record<string, unknown> | undefined, locale: Locale, messages: MessagesByLocale, overrides: Overrides | undefined): string;
|
|
17
|
+
/**
|
|
18
|
+
* Reset internal caches. Test-only.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare function __resetForTests(): void;
|
|
22
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/i18n/resolve.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAU,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AAuB1E;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAc3D;AAuDD,wBAAgB,OAAO,CACrB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,SAAS,GAAG,SAAS,GAC/B,MAAM,CAsBR;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAGtC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file resolve.ts
|
|
5
|
+
* @input Key + values + locale + catalog + overrides
|
|
6
|
+
* @output Formatted message string
|
|
7
|
+
* @position Shared lookup + ICU formatting core, used by useTranslator().
|
|
8
|
+
*
|
|
9
|
+
* Lookup order:
|
|
10
|
+
* 1. Per-locale override for the exact locale
|
|
11
|
+
* 2. Per-locale override for a parent locale (pt-BR → pt)
|
|
12
|
+
* 3. Shipped catalog entry for the exact locale
|
|
13
|
+
* 4. Shipped catalog entry for a parent locale (pt-BR → pt)
|
|
14
|
+
* 5. Shipped en catalog (the source of truth, always present)
|
|
15
|
+
* 6. The key itself (dev-visible fallback, warns once)
|
|
16
|
+
*
|
|
17
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
18
|
+
* - /packages/core/src/i18n/useTranslator.ts
|
|
19
|
+
* - /packages/core/src/i18n/__tests__/resolve.test.ts
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import IntlMessageFormat from 'intl-messageformat';
|
|
23
|
+
import enSource from '../../locales/en.json' with { type: 'json' };
|
|
24
|
+
const EN_CATALOG = enSource;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Cache of parsed ICU MessageFormat objects keyed by `${locale}::${message}`.
|
|
28
|
+
* IntlMessageFormat parsing is non-trivial; caching avoids reparsing on every
|
|
29
|
+
* render. The cache is unbounded in principle but bounded in practice by the
|
|
30
|
+
* static set of astryx keys.
|
|
31
|
+
*/
|
|
32
|
+
const formatterCache = new Map();
|
|
33
|
+
function getFormatter(message, locale) {
|
|
34
|
+
const cacheKey = `${locale}::${message}`;
|
|
35
|
+
let f = formatterCache.get(cacheKey);
|
|
36
|
+
if (f === undefined) {
|
|
37
|
+
f = new IntlMessageFormat(message, locale);
|
|
38
|
+
formatterCache.set(cacheKey, f);
|
|
39
|
+
}
|
|
40
|
+
return f;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Walk a BCP 47 tag from most-specific to least-specific.
|
|
45
|
+
* Input is canonicalized via `Intl.Locale.baseName` so `pt-br` and `PT-BR`
|
|
46
|
+
* both produce `['pt-BR', 'pt']`.
|
|
47
|
+
*
|
|
48
|
+
* Examples:
|
|
49
|
+
* 'pt-BR' → ['pt-BR', 'pt']
|
|
50
|
+
* 'zh-Hans-CN' → ['zh-Hans-CN', 'zh-Hans', 'zh']
|
|
51
|
+
* 'en' → ['en']
|
|
52
|
+
*
|
|
53
|
+
* `en` is intentionally NOT appended here — the caller falls back to the
|
|
54
|
+
* shipped en catalog separately as the final source-of-truth.
|
|
55
|
+
*/
|
|
56
|
+
export function resolveLocaleChain(locale) {
|
|
57
|
+
let canonical;
|
|
58
|
+
try {
|
|
59
|
+
canonical = new Intl.Locale(locale).baseName;
|
|
60
|
+
} catch {
|
|
61
|
+
// Malformed input — fall back to the raw string so callers still get a chain.
|
|
62
|
+
canonical = locale;
|
|
63
|
+
}
|
|
64
|
+
const parts = canonical.split('-');
|
|
65
|
+
const chain = [];
|
|
66
|
+
for (let i = parts.length; i > 0; i--) {
|
|
67
|
+
chain.push(parts.slice(0, i).join('-'));
|
|
68
|
+
}
|
|
69
|
+
return chain;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Missing-key warn-once tracking. Fires ONLY when a key is missing from
|
|
74
|
+
* every source including the shipped `en` catalog — that's a real bug
|
|
75
|
+
* (typo, stale catalog, deleted key). Fallback to `en` from a non-en
|
|
76
|
+
* locale is expected and silent, matching the FormatJS / i18next default
|
|
77
|
+
* of not spamming the console when a translation simply hasn't been
|
|
78
|
+
* written yet.
|
|
79
|
+
*/
|
|
80
|
+
const warnedMissing = new Set();
|
|
81
|
+
function warnOnce(bucket, key, message) {
|
|
82
|
+
if (!bucket.has(key)) {
|
|
83
|
+
bucket.add(key);
|
|
84
|
+
console.warn(message);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function lookup(key, locale, messages, overrides) {
|
|
88
|
+
const chain = resolveLocaleChain(locale);
|
|
89
|
+
|
|
90
|
+
// 1 + 2. Overrides (most specific to least specific in the chain)
|
|
91
|
+
if (overrides !== undefined) {
|
|
92
|
+
for (const tag of chain) {
|
|
93
|
+
const value = overrides[tag]?.[key];
|
|
94
|
+
if (value !== undefined) {
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// 3 + 4. Shipped catalogs (most specific to least specific)
|
|
101
|
+
for (const tag of chain) {
|
|
102
|
+
const entry = messages[tag]?.[key];
|
|
103
|
+
if (entry !== undefined) {
|
|
104
|
+
return entry.defaultMessage;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// 5. Shipped en catalog — always present
|
|
109
|
+
const enEntry = EN_CATALOG[key];
|
|
110
|
+
if (enEntry !== undefined) {
|
|
111
|
+
return enEntry.defaultMessage;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// 6. Nothing found
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
export function resolve(key, values, locale, messages, overrides) {
|
|
118
|
+
const result = lookup(key, locale, messages, overrides);
|
|
119
|
+
if (result === null) {
|
|
120
|
+
warnOnce(warnedMissing, `${locale}::${key}`, `[astryx-i18n] missing key: ${key} (locale: ${locale})`);
|
|
121
|
+
return key;
|
|
122
|
+
}
|
|
123
|
+
if (values === undefined) {
|
|
124
|
+
// Static string — skip the parser entirely for the common case
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
const formatted = getFormatter(result, locale).format(values);
|
|
128
|
+
// IntlMessageFormat.format returns string | (string | React elements) — we
|
|
129
|
+
// only ever pass string values so it will be a string; assert for the type
|
|
130
|
+
// system.
|
|
131
|
+
return formatted;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Reset internal caches. Test-only.
|
|
136
|
+
* @internal
|
|
137
|
+
*/
|
|
138
|
+
export function __resetForTests() {
|
|
139
|
+
formatterCache.clear();
|
|
140
|
+
warnedMissing.clear();
|
|
141
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file translator.ts
|
|
3
|
+
* @input Translator interface for consumer i18n runtime injection
|
|
4
|
+
* @output Type surface for pluggable translators
|
|
5
|
+
* @position Public API for i18n adapter integration
|
|
6
|
+
*
|
|
7
|
+
* Consumers who already run an i18n runtime (react-intl, Lingui, i18next, etc.)
|
|
8
|
+
* can inject their own Translator instead of using the default provider. The
|
|
9
|
+
* interface is deliberately small so any real i18n library can satisfy it in a
|
|
10
|
+
* few lines.
|
|
11
|
+
*
|
|
12
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
13
|
+
* - /packages/core/src/i18n/index.ts
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* A Translator formats ICU MessageFormat strings for a given locale.
|
|
17
|
+
* Consumers can supply their own to reuse their existing i18n runtime.
|
|
18
|
+
*/
|
|
19
|
+
export interface Translator {
|
|
20
|
+
/**
|
|
21
|
+
* Format an ICU MessageFormat message with values in the given locale.
|
|
22
|
+
*/
|
|
23
|
+
format(message: string, values?: Record<string, unknown>, locale?: string): string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=translator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translator.d.ts","sourceRoot":"","sources":["../../src/i18n/translator.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,MAAM,CACJ,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CAAC;CACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file types.ts
|
|
3
|
+
* @input None
|
|
4
|
+
* @output Shared types for the i18n subpackage
|
|
5
|
+
* @position Type-only module; used across client + server t() implementations
|
|
6
|
+
*
|
|
7
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
8
|
+
* - /packages/core/src/i18n/InternationalizationContext.ts
|
|
9
|
+
* - /packages/core/src/i18n/InternationalizationProvider.tsx
|
|
10
|
+
* - /packages/core/src/i18n/serverStore.ts
|
|
11
|
+
* - /packages/core/src/i18n/resolve.ts
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* A BCP 47 language tag. Examples: `'en'`, `'pt'`, `'pt-BR'`, `'zh-Hans'`.
|
|
15
|
+
*
|
|
16
|
+
* Regional tags are meaningful — `pt-BR` and `pt` are different catalogs.
|
|
17
|
+
* When resolving a message, the runtime walks the tag from most-specific
|
|
18
|
+
* to least-specific and falls back to `en` if nothing matches
|
|
19
|
+
* (see `resolveLocaleChain` in `resolve.ts`).
|
|
20
|
+
*/
|
|
21
|
+
export type Locale = string;
|
|
22
|
+
/**
|
|
23
|
+
* A single entry in a translation catalog. The `defaultMessage` is an ICU
|
|
24
|
+
* MessageFormat string; `description` is optional context for translators
|
|
25
|
+
* (surfaced by Crowdin's `react_intl` file type parser).
|
|
26
|
+
*/
|
|
27
|
+
export interface MessageEntry {
|
|
28
|
+
defaultMessage: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A translation catalog — a map of stable message keys to entries.
|
|
33
|
+
* Astryx's own keys are namespaced under `@astryx.<component>.<name>`.
|
|
34
|
+
*/
|
|
35
|
+
export type Catalog = Record<string, MessageEntry>;
|
|
36
|
+
/**
|
|
37
|
+
* A map of BCP 47 tags to catalogs. Passed as `messages` on
|
|
38
|
+
* `<InternationalizationProvider>`.
|
|
39
|
+
*/
|
|
40
|
+
export type MessagesByLocale = Record<Locale, Catalog>;
|
|
41
|
+
/**
|
|
42
|
+
* Sparse per-locale overrides applied on top of the shipped defaults.
|
|
43
|
+
* Only the keys the consumer cares to override need to be listed.
|
|
44
|
+
* Overrides are locale-keyed so a runtime locale swap picks up the right ones.
|
|
45
|
+
*/
|
|
46
|
+
export type Overrides = Partial<Record<Locale, Record<string, string>>>;
|
|
47
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/i18n/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type TranslatorFn = (key: string, values?: Record<string, unknown>) => string;
|
|
2
|
+
/**
|
|
3
|
+
* Returns a translator function bound to the current provider's locale.
|
|
4
|
+
* Safe to call from event handlers and effects.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```
|
|
8
|
+
* function MyComponent() {
|
|
9
|
+
* const translate = useTranslator();
|
|
10
|
+
* const onClick = () => announce(translate('@astryx.pagination.pageAnnounce', {current: 1}));
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function useTranslator(): TranslatorFn;
|
|
15
|
+
//# sourceMappingURL=useTranslator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTranslator.d.ts","sourceRoot":"","sources":["../../src/i18n/useTranslator.ts"],"names":[],"mappings":"AAyBA,MAAM,MAAM,YAAY,GAAG,CACzB,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC7B,MAAM,CAAC;AAEZ;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,IAAI,YAAY,CAO5C"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file useTranslator.ts
|
|
7
|
+
* @input InternationalizationContext (via use())
|
|
8
|
+
* @output Exports useTranslator hook returning a stable translator function
|
|
9
|
+
* @position Client-side hook for translating outside of render (event handlers,
|
|
10
|
+
* effects, non-component code) while still resolving against the current
|
|
11
|
+
* provider's locale.
|
|
12
|
+
*
|
|
13
|
+
* Prefer `t()` for translations at the callsite during render. When you need
|
|
14
|
+
* to translate inside an event handler or effect, capture a translator during
|
|
15
|
+
* render via useTranslator() and call it later.
|
|
16
|
+
*
|
|
17
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
18
|
+
* - /packages/core/src/i18n/index.ts
|
|
19
|
+
* - /packages/core/src/i18n/t.client.ts
|
|
20
|
+
*/
|
|
21
|
+
import { use, useCallback } from 'react';
|
|
22
|
+
import { InternationalizationContext } from "./InternationalizationContext.js";
|
|
23
|
+
import { resolve } from "./resolve.js";
|
|
24
|
+
/**
|
|
25
|
+
* Returns a translator function bound to the current provider's locale.
|
|
26
|
+
* Safe to call from event handlers and effects.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```
|
|
30
|
+
* function MyComponent() {
|
|
31
|
+
* const translate = useTranslator();
|
|
32
|
+
* const onClick = () => announce(translate('@astryx.pagination.pageAnnounce', {current: 1}));
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function useTranslator() {
|
|
37
|
+
const ctx = use(InternationalizationContext);
|
|
38
|
+
return useCallback((key, values) => resolve(key, values, ctx.locale, ctx.messages, ctx.overrides), [ctx.locale, ctx.messages, ctx.overrides]);
|
|
39
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -108,5 +108,6 @@ export * from './OverflowList';
|
|
|
108
108
|
export * from './hooks';
|
|
109
109
|
export * from './utils';
|
|
110
110
|
export * from './theme';
|
|
111
|
+
export * from './i18n';
|
|
111
112
|
export type { ComponentDoc, SingleComponentDoc, MultiComponentDoc, PropDoc, ComponentEntry, ThemingTarget, ComponentVar, DerivedVar, TranslationDoc, GroupDoc, ReferenceDoc, ReferenceSection, ContentBlock, TokenPreviewType, } from './docs-types';
|
|
112
113
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAGH,YAAY,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAG3C,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC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AC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACjC,YAAY,EACV,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AACtC,YAAY,EAAC,kBAAkB,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAGlE,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AACxC,YAAY,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACb,sBAAsB,EACtB,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,WAAW,GACZ,MAAM,SAAS,CAAC;AAGjB,cAAc,WAAW,CAAC;AAG1B,cAAc,aAAa,CAAC;AAG5B,cAAc,WAAW,CAAC;AAG1B,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,WAAW,CAAC;AAG1B,cAAc,aAAa,CAAC;AAG5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAG1B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,QAAQ,CAAC;AAGvB,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,OAAO,EACP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,UAAU,EACV,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,GACjB,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/theme/MediaTheme.js
CHANGED
|
@@ -37,7 +37,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
37
37
|
import "./tokens.stylex.js";
|
|
38
38
|
import { colorVars } from "./tokens.stylex.js";
|
|
39
39
|
import { dataAttr } from "../naming.js";
|
|
40
|
-
import {
|
|
40
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
41
41
|
/**
|
|
42
42
|
* Inverted surface theming context.
|
|
43
43
|
*
|
|
@@ -49,12 +49,12 @@ export function MediaTheme({
|
|
|
49
49
|
mode,
|
|
50
50
|
children
|
|
51
51
|
}) {
|
|
52
|
-
return /*#__PURE__*/
|
|
52
|
+
return /*#__PURE__*/_jsx("div", {
|
|
53
53
|
[dataAttr('media')]: mode,
|
|
54
54
|
...{
|
|
55
55
|
className: "xjp7ctv x1tgivj0"
|
|
56
56
|
},
|
|
57
57
|
children: children
|
|
58
|
-
}
|
|
58
|
+
});
|
|
59
59
|
}
|
|
60
60
|
MediaTheme.displayName = 'MediaTheme';
|