@astryxdesign/core 0.4.4 → 0.4.5-canary.013e728
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/dist/AvatarGroup/AvatarGroupOverflow.js +1 -1
- package/dist/BottomSheet/BottomSheet.d.ts +11 -2
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +4 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts +5 -2
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +65 -15
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/BottomSheet/index.d.ts.map +1 -1
- package/dist/BottomSheet/snapOffsets.d.ts +57 -20
- package/dist/BottomSheet/snapOffsets.d.ts.map +1 -1
- package/dist/BottomSheet/snapOffsets.js +106 -30
- package/dist/BottomSheet/useSheetGestures.d.ts +13 -8
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +160 -64
- package/dist/Breadcrumbs/BreadcrumbItem.js +6 -6
- package/dist/Button/Button.js +5 -5
- package/dist/Calendar/Calendar.d.ts +17 -0
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +55 -15
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts +14 -0
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts.map +1 -0
- package/dist/Calendar/getStandaloneShortWeekdayNames.js +26 -0
- package/dist/Calendar/hooks/useCalendarConstraints.d.ts +22 -1
- package/dist/Calendar/hooks/useCalendarConstraints.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarConstraints.js +26 -4
- package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarDays.js +14 -10
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarNavigation.js +8 -4
- package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts +47 -0
- package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts.map +1 -0
- package/dist/Calendar/standaloneShortWeekdayNames.generated.js +40 -0
- package/dist/Calendar/styles.js +3 -3
- package/dist/Center/Center.d.ts +23 -1
- package/dist/Center/Center.d.ts.map +1 -1
- package/dist/Center/Center.js +12 -6
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +2 -2
- package/dist/Chat/ChatToolCalls.js +1 -1
- package/dist/Chat/useChatDictation.d.ts +1 -1
- package/dist/Chat/useChatDictation.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.d.ts +1 -1
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +4 -3
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +9 -0
- package/dist/Citation/Citation.js +3 -3
- package/dist/ClickableCard/ClickableCard.js +2 -2
- package/dist/CommandPalette/CommandPaletteItem.js +1 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +8 -3
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +17 -9
- package/dist/DateRangeInput/DateRangeInput.d.ts +23 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +47 -9
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +18 -10
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/Field/FieldLabel.d.ts +2 -1
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +21 -3
- package/dist/Field/InputClearButton.d.ts +2 -1
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +12 -1
- package/dist/Field/inputStyles.stylex.d.ts.map +1 -1
- package/dist/Field/inputStyles.stylex.js +4 -4
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +2 -2
- package/dist/FormLayout/FormLayout.d.ts +24 -2
- package/dist/FormLayout/FormLayout.d.ts.map +1 -1
- package/dist/FormLayout/FormLayout.js +7 -2
- package/dist/FormLayout/FormLayoutContext.d.ts +15 -2
- package/dist/FormLayout/FormLayoutContext.d.ts.map +1 -1
- package/dist/FormLayout/FormLayoutContext.js +19 -4
- package/dist/FormLayout/index.d.ts +1 -1
- package/dist/FormLayout/index.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.d.ts +13 -3
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +2 -0
- package/dist/HoverCard/index.d.ts +1 -1
- package/dist/HoverCard/index.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.d.ts +17 -2
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +78 -9
- package/dist/Item/Item.d.ts +9 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +46 -8
- package/dist/Layer/index.d.ts +4 -2
- package/dist/Layer/index.d.ts.map +1 -1
- package/dist/Layer/index.js +2 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +3 -2
- package/dist/Layer/useTouchTrigger.d.ts +113 -0
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -0
- package/dist/Layer/useTouchTrigger.js +241 -0
- package/dist/Layout/container.stylex.d.ts +4 -2
- package/dist/Layout/container.stylex.d.ts.map +1 -1
- package/dist/Layout/container.stylex.js +19 -11
- package/dist/Layout/index.d.ts +1 -0
- package/dist/Layout/index.d.ts.map +1 -1
- package/dist/Layout/index.js +4 -0
- package/dist/Layout/padding.stylex.d.ts +315 -12
- package/dist/Layout/padding.stylex.d.ts.map +1 -1
- package/dist/Layout/padding.stylex.js +389 -12
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +2 -1
- package/dist/Link/Link.js +4 -4
- package/dist/Markdown/Markdown.d.ts +8 -0
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +31 -3
- package/dist/Markdown/parser.d.ts +14 -2
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +50 -2
- package/dist/MobileNav/MobileNav.d.ts +1 -0
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +24 -6
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +8 -3
- package/dist/NavItem/navItemStyles.stylex.d.ts +2 -2
- package/dist/NavItem/navItemStyles.stylex.js +2 -2
- package/dist/NavMenu/NavHeadingMenuItem.js +1 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +38 -5
- package/dist/Outline/Outline.js +2 -2
- package/dist/Outline/parseOutlineFromMarkdown.d.ts +2 -0
- package/dist/Outline/parseOutlineFromMarkdown.d.ts.map +1 -1
- package/dist/Outline/parseOutlineFromMarkdown.js +5 -31
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +11 -12
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +3 -1
- package/dist/PowerSearch/formatFilterValue.d.ts +11 -2
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +23 -8
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +12 -1
- package/dist/RadioList/RadioListItem.d.ts +2 -2
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +68 -38
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +3 -3
- package/dist/Section/Section.d.ts +36 -1
- package/dist/Section/Section.d.ts.map +1 -1
- package/dist/Section/Section.js +12 -2
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +6 -1
- package/dist/SelectableCard/SelectableCard.js +1 -1
- package/dist/Selector/Selector.d.ts +26 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +95 -17
- package/dist/Selector/SelectorOption.d.ts +14 -1
- package/dist/Selector/SelectorOption.d.ts.map +1 -1
- package/dist/Selector/SelectorOption.js +6 -0
- package/dist/Selector/SelectorRowLayoutContext.d.ts +8 -0
- package/dist/Selector/SelectorRowLayoutContext.d.ts.map +1 -0
- package/dist/Selector/SelectorRowLayoutContext.js +27 -0
- package/dist/Selector/types.d.ts +1 -0
- package/dist/Selector/types.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +1 -1
- package/dist/SideNav/SideNavItem.js +1 -1
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +3 -3
- package/dist/Stack/Stack.d.ts +23 -1
- package/dist/Stack/Stack.d.ts.map +1 -1
- package/dist/Stack/Stack.js +12 -6
- package/dist/StatusDot/StatusDot.d.ts +43 -3
- package/dist/StatusDot/StatusDot.d.ts.map +1 -1
- package/dist/StatusDot/StatusDot.js +42 -5
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +9 -0
- package/dist/TabList/TabMenu.js +1 -1
- package/dist/Table/TableRow.js +4 -4
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +7 -2
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts +5 -3
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.js +12 -9
- package/dist/Table/plugins/tree/useTableTreeData.js +2 -2
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +6 -1
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +6 -1
- package/dist/Thumbnail/Thumbnail.js +1 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +6 -1
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +6 -4
- package/dist/Timestamp/formatInstant.d.ts +3 -2
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +8 -8
- package/dist/Timestamp/tooltipEntries.d.ts +2 -1
- package/dist/Timestamp/tooltipEntries.d.ts.map +1 -1
- package/dist/Timestamp/tooltipEntries.js +5 -3
- package/dist/Token/Token.js +1 -1
- package/dist/Tooltip/Tooltip.d.ts +16 -3
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +2 -0
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +21 -2
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +71 -13
- package/dist/TopNav/TopNavHeading.js +2 -2
- package/dist/TopNav/TopNavItem.js +2 -2
- package/dist/TopNav/TopNavMegaMenu.js +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +1 -1
- package/dist/TopNav/TopNavMenu.js +2 -2
- package/dist/TreeList/TreeListItem.js +1 -1
- package/dist/astryx.css +85 -60
- package/dist/hooks/containerReveal.stylex.d.ts.map +1 -1
- package/dist/hooks/containerReveal.stylex.js +18 -18
- package/dist/hooks/scrollbarGutter.d.ts +28 -0
- package/dist/hooks/scrollbarGutter.d.ts.map +1 -0
- package/dist/hooks/scrollbarGutter.js +103 -0
- package/dist/hooks/useResolvedRequired.d.ts +19 -0
- package/dist/hooks/useResolvedRequired.d.ts.map +1 -0
- package/dist/hooks/useResolvedRequired.js +40 -0
- package/dist/hooks/useScrollLock.d.ts +4 -0
- package/dist/hooks/useScrollLock.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.js +13 -1
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.js +2 -0
- package/dist/i18n/index.d.ts +6 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +6 -0
- package/dist/i18n/useCollator.d.ts +12 -0
- package/dist/i18n/useCollator.d.ts.map +1 -0
- package/dist/i18n/useCollator.js +40 -0
- package/dist/i18n/useLocale.d.ts +3 -0
- package/dist/i18n/useLocale.d.ts.map +1 -0
- package/dist/i18n/useLocale.js +31 -0
- package/dist/theme/defineTheme.d.ts +5 -0
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +5 -0
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +7 -0
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +66 -5
- package/dist/utils/dateParser.d.ts +4 -3
- package/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +8 -8
- package/dist/utils/plainDate.d.ts +9 -2
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +16 -4
- package/locales/af-ZA.json +958 -0
- package/locales/ar-SA.json +998 -0
- package/locales/ca-ES.json +974 -0
- package/locales/cs-CZ.json +990 -0
- package/locales/da-DK.json +966 -0
- package/locales/de-DE.json +966 -0
- package/locales/el-GR.json +990 -0
- package/locales/en.json +8 -0
- package/locales/es-ES.json +978 -0
- package/locales/fi-FI.json +990 -0
- package/locales/fr-FR.json +928 -0
- package/locales/he-IL.json +990 -0
- package/locales/hu-HU.json +990 -0
- package/locales/it-IT.json +978 -0
- package/locales/ja-JP.json +998 -0
- package/locales/ko-KR.json +990 -0
- package/locales/nl-NL.json +954 -0
- package/locales/no-NO.json +978 -0
- package/locales/pl-PL.json +982 -0
- package/locales/pseudo.json +6 -0
- package/locales/pt-BR.json +982 -0
- package/locales/pt-PT.json +982 -0
- package/locales/ro-RO.json +982 -0
- package/locales/ru-RU.json +990 -0
- package/locales/sr-SP.json +990 -0
- package/locales/sv-SE.json +986 -0
- package/locales/tr-TR.json +990 -0
- package/locales/uk-UA.json +990 -0
- package/locales/vi-VN.json +986 -0
- package/locales/zh-CN.json +998 -0
- package/locales/zh-TW.json +998 -0
- package/package.json +3 -3
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +1 -1
- package/src/Banner/Banner.doc.mjs +2 -0
- package/src/BottomSheet/BottomSheet.doc.mjs +36 -3
- package/src/BottomSheet/BottomSheet.test.tsx +177 -2
- package/src/BottomSheet/BottomSheet.tsx +16 -2
- package/src/BottomSheet/BottomSheetPanel.test.tsx +41 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +95 -15
- package/src/BottomSheet/index.ts +5 -1
- package/src/BottomSheet/snapOffsets.test.ts +114 -47
- package/src/BottomSheet/snapOffsets.ts +119 -33
- package/src/BottomSheet/useSheetGestures.test.ts +113 -15
- package/src/BottomSheet/useSheetGestures.ts +196 -100
- package/src/Breadcrumbs/BreadcrumbItem.tsx +1 -1
- package/src/Button/Button.tsx +7 -7
- package/src/Calendar/Calendar.doc.mjs +16 -0
- package/src/Calendar/Calendar.test.tsx +137 -0
- package/src/Calendar/Calendar.tsx +80 -11
- package/src/Calendar/getStandaloneShortWeekdayNames.test.ts +54 -0
- package/src/Calendar/getStandaloneShortWeekdayNames.ts +38 -0
- package/src/Calendar/hooks/useCalendarConstraints.ts +54 -3
- package/src/Calendar/hooks/useCalendarDays.ts +13 -10
- package/src/Calendar/hooks/useCalendarNavigation.ts +6 -4
- package/src/Calendar/standaloneShortWeekdayNames.generated.ts +50 -0
- package/src/Calendar/styles.ts +3 -3
- package/src/Center/Center.doc.mjs +48 -0
- package/src/Center/Center.test.tsx +158 -0
- package/src/Center/Center.tsx +50 -9
- package/src/Chat/ChatComposer.tsx +7 -4
- package/src/Chat/ChatToolCalls.tsx +1 -1
- package/src/Chat/{useChatDictation.test.ts → useChatDictation.test.tsx} +29 -14
- package/src/Chat/useChatDictation.ts +1 -1
- package/src/Chat/useSpeechRecognition.ts +5 -3
- package/src/CheckboxInput/CheckboxInput.tsx +6 -0
- package/src/Citation/Citation.tsx +3 -3
- package/src/ClickableCard/ClickableCard.tsx +2 -2
- package/src/CommandPalette/CommandPaletteItem.tsx +1 -1
- package/src/ComplexSelector/ComplexSelector.doc.mjs +10 -0
- package/src/ComplexSelector/ComplexSelector.tsx +8 -5
- package/src/DateInput/DateInput.test.tsx +17 -1
- package/src/DateInput/DateInput.tsx +13 -9
- package/src/DateRangeInput/DateRangeInput.doc.mjs +16 -0
- package/src/DateRangeInput/DateRangeInput.test.tsx +81 -1
- package/src/DateRangeInput/DateRangeInput.tsx +88 -8
- package/src/DateTimeInput/DateTimeInput.tsx +23 -8
- package/src/Dialog/Dialog.test.tsx +24 -0
- package/src/Dialog/Dialog.tsx +3 -0
- package/src/Field/Field.doc.mjs +3 -0
- package/src/Field/FieldLabel.tsx +20 -4
- package/src/Field/InputClearButton.test.tsx +134 -2
- package/src/Field/InputClearButton.tsx +42 -1
- package/src/Field/inputStyles.stylex.ts +16 -12
- package/src/FileInput/FileInput.tsx +5 -4
- package/src/FormLayout/FormLayout.doc.mjs +13 -0
- package/src/FormLayout/FormLayout.test.tsx +181 -4
- package/src/FormLayout/FormLayout.tsx +33 -2
- package/src/FormLayout/FormLayoutContext.ts +22 -7
- package/src/FormLayout/index.ts +1 -1
- package/src/HoverCard/HoverCard.doc.mjs +18 -0
- package/src/HoverCard/HoverCard.test.tsx +189 -0
- package/src/HoverCard/HoverCard.tsx +22 -2
- package/src/HoverCard/index.ts +1 -0
- package/src/HoverCard/useHoverCard.doc.mjs +2 -0
- package/src/HoverCard/useHoverCard.tsx +103 -7
- package/src/Item/Item.doc.mjs +1 -0
- package/src/Item/Item.test.tsx +50 -0
- package/src/Item/Item.tsx +41 -2
- package/src/Layer/index.ts +10 -0
- package/src/Layer/useLayer.tsx +13 -2
- package/src/Layer/useTouchTrigger.test.ts +70 -0
- package/src/Layer/useTouchTrigger.ts +366 -0
- package/src/Layout/Layout.doc.mjs +18 -0
- package/src/Layout/container.stylex.ts +11 -3
- package/src/Layout/index.ts +4 -0
- package/src/Layout/overlayPaddingReset.test.tsx +222 -0
- package/src/Layout/padding.stylex.ts +192 -12
- package/src/Lightbox/Lightbox.tsx +2 -1
- package/src/Link/Link.tsx +4 -4
- package/src/Markdown/Markdown.doc.mjs +3 -0
- package/src/Markdown/Markdown.test.tsx +78 -0
- package/src/Markdown/Markdown.tsx +41 -1
- package/src/Markdown/parser.ts +60 -2
- package/src/MobileNav/MobileNav.tsx +61 -5
- package/src/MobileNav/MobileNavEntryAnimation.test.tsx +212 -0
- package/src/MobileNav/MobileNavScrollbarGutter.test.tsx +109 -0
- package/src/MultiSelector/MultiSelector.test.tsx +1 -1
- package/src/MultiSelector/MultiSelector.tsx +8 -5
- package/src/NavItem/navItemStyles.stylex.ts +2 -2
- package/src/NavMenu/NavHeadingMenuItem.tsx +1 -1
- package/src/NumberInput/NumberInput.doc.mjs +24 -0
- package/src/NumberInput/NumberInput.test.tsx +138 -0
- package/src/NumberInput/NumberInput.tsx +44 -6
- package/src/Outline/Outline.doc.mjs +2 -0
- package/src/Outline/Outline.tsx +1 -1
- package/src/Outline/parseOutlineFromMarkdown.ts +10 -40
- package/src/PowerSearch/PowerSearch.tsx +17 -8
- package/src/PowerSearch/PowerSearchToken.tsx +3 -0
- package/src/PowerSearch/formatFilterValue.test.ts +22 -2
- package/src/PowerSearch/formatFilterValue.ts +31 -6
- package/src/RadioList/RadioList.doc.mjs +1 -1
- package/src/RadioList/RadioList.test.tsx +170 -2
- package/src/RadioList/RadioList.tsx +9 -1
- package/src/RadioList/RadioListItem.tsx +83 -51
- package/src/Resizable/ResizeHandle.test.tsx +22 -0
- package/src/Resizable/ResizeHandle.tsx +9 -3
- package/src/Section/Section.doc.mjs +55 -0
- package/src/Section/Section.test.tsx +201 -4
- package/src/Section/Section.tsx +69 -0
- package/src/SegmentedControl/SegmentedControl.test.tsx +31 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +11 -2
- package/src/SelectableCard/SelectableCard.tsx +1 -1
- package/src/Selector/Selector.doc.mjs +16 -2
- package/src/Selector/Selector.test.tsx +525 -1
- package/src/Selector/Selector.tsx +166 -21
- package/src/Selector/SelectorOption.doc.mjs +7 -0
- package/src/Selector/SelectorOption.tsx +21 -0
- package/src/Selector/SelectorRowLayoutContext.ts +32 -0
- package/src/Selector/types.ts +4 -4
- package/src/SideNav/SideNavHeading.tsx +2 -2
- package/src/SideNav/SideNavItem.tsx +1 -1
- package/src/Slider/Slider.tsx +11 -1
- package/src/Stack/Stack.doc.mjs +72 -0
- package/src/Stack/Stack.test.tsx +156 -0
- package/src/Stack/Stack.tsx +50 -8
- package/src/StatusDot/StatusDot.doc.mjs +13 -0
- package/src/StatusDot/StatusDot.test.tsx +115 -8
- package/src/StatusDot/StatusDot.tsx +74 -9
- package/src/Switch/Switch.tsx +6 -0
- package/src/TabList/TabMenu.tsx +1 -1
- package/src/Table/TableRow.tsx +4 -4
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +2 -1
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +2 -1
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +22 -4
- package/src/Table/plugins/sortable/useTableSortableState.test.tsx +34 -0
- package/src/Table/plugins/sortable/useTableSortableState.tsx +26 -23
- package/src/Table/plugins/tree/useTableTreeData.tsx +2 -2
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextArea/TextArea.tsx +3 -1
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/Thumbnail/Thumbnail.tsx +1 -1
- package/src/TimeInput/TimeInput.tsx +3 -1
- package/src/Timestamp/Timestamp.test.tsx +27 -7
- package/src/Timestamp/Timestamp.tsx +8 -4
- package/src/Timestamp/formatInstant.ts +9 -7
- package/src/Timestamp/tooltipEntries.test.ts +11 -6
- package/src/Timestamp/tooltipEntries.ts +6 -2
- package/src/Token/Token.tsx +1 -1
- package/src/Tooltip/Tooltip.doc.mjs +18 -0
- package/src/Tooltip/Tooltip.test.tsx +254 -1
- package/src/Tooltip/Tooltip.tsx +22 -2
- package/src/Tooltip/index.ts +1 -0
- package/src/Tooltip/useTooltip.doc.mjs +2 -0
- package/src/Tooltip/useTooltip.tsx +99 -21
- package/src/TopNav/TopNavHeading.tsx +1 -1
- package/src/TopNav/TopNavItem.tsx +2 -2
- package/src/TopNav/TopNavMegaMenu.tsx +1 -1
- package/src/TopNav/TopNavMegaMenuItem.tsx +1 -1
- package/src/TopNav/TopNavMenu.tsx +2 -2
- package/src/TreeList/TreeListItem.tsx +1 -1
- package/src/hooks/containerReveal.stylex.ts +54 -18
- package/src/hooks/scrollbarGutter.test.ts +167 -0
- package/src/hooks/scrollbarGutter.ts +121 -0
- package/src/hooks/useResolvedRequired.ts +42 -0
- package/src/hooks/useScrollLock.doc.mjs +4 -4
- package/src/hooks/useScrollLock.test.ts +73 -0
- package/src/hooks/useScrollLock.ts +14 -0
- package/src/i18n/InternationalizationContext.ts +2 -0
- package/src/i18n/__tests__/e2e-powersearch.test.tsx +37 -1
- package/src/i18n/__tests__/useCollator.test.tsx +115 -0
- package/src/i18n/__tests__/useLocale.test.tsx +52 -0
- package/src/i18n/index.ts +6 -0
- package/src/i18n/useCollator.doc.mjs +84 -0
- package/src/i18n/useCollator.ts +44 -0
- package/src/i18n/useLocale.doc.mjs +70 -0
- package/src/i18n/useLocale.ts +34 -0
- package/src/i18n/useTranslator.doc.mjs +1 -1
- package/src/theme/defineTheme.test.ts +9 -3
- package/src/theme/defineTheme.ts +5 -0
- package/src/theme/derivedVarRegistry.test.ts +19 -5
- package/src/theme/derivedVarRegistry.ts +4 -0
- package/src/theme/generateThemeRules.test.ts +118 -0
- package/src/theme/generateThemeRules.ts +83 -5
- package/src/utils/dateParser.test.ts +20 -0
- package/src/utils/dateParser.ts +14 -7
- package/src/utils/plainDate.test.ts +56 -0
- package/src/utils/plainDate.ts +17 -4
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file useResolvedRequired.ts
|
|
7
|
+
* @input Uses React, FormLayoutContext
|
|
8
|
+
* @output Exports useResolvedRequired
|
|
9
|
+
* @position Resolves a field's effective aria-required against the form default
|
|
10
|
+
*
|
|
11
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
12
|
+
* - /packages/core/src/FormLayout/FormLayoutContext.ts (defaultOptionality source)
|
|
13
|
+
* - /packages/core/src/FormLayout/FormLayout.tsx (prop doc: aria-required behavior)
|
|
14
|
+
*/
|
|
15
|
+
import { use } from 'react';
|
|
16
|
+
import { FormLayoutContext } from "../FormLayout/FormLayoutContext.js";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Resolve a field's effective *required* state for `aria-required`, honoring a
|
|
20
|
+
* surrounding `FormLayout`'s `defaultOptionality`.
|
|
21
|
+
*
|
|
22
|
+
* Under `defaultOptionality="required"` a field is required unless it opts out
|
|
23
|
+
* with `isOptional`. The visible indicator is suppressed for the unmarked
|
|
24
|
+
* majority, so those fields must still expose `aria-required` — otherwise a
|
|
25
|
+
* sighted user reads them as required (form-wide default, no indicator) while a
|
|
26
|
+
* screen reader hears "not required". This closes that mismatch.
|
|
27
|
+
*
|
|
28
|
+
* Semantics only: this drives `aria-required`, never the native `required`
|
|
29
|
+
* attribute, so a layout-level default can't silently switch on browser
|
|
30
|
+
* validation bubbles. `isOptional` takes precedence, matching `FieldLabel`.
|
|
31
|
+
*/
|
|
32
|
+
export function useResolvedRequired({
|
|
33
|
+
isRequired = false,
|
|
34
|
+
isOptional = false
|
|
35
|
+
}) {
|
|
36
|
+
const {
|
|
37
|
+
defaultOptionality
|
|
38
|
+
} = use(FormLayoutContext);
|
|
39
|
+
return !isOptional && (isRequired || defaultOptionality === 'required');
|
|
40
|
+
}
|
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
* does not prevent body scroll behind modals. Restores scroll position
|
|
7
7
|
* on unlock.
|
|
8
8
|
*
|
|
9
|
+
* Pinning also hides the document's scrollbar, so the gutter that scrollbar
|
|
10
|
+
* occupied is held open for the duration of the lock — without it the page
|
|
11
|
+
* reflows sideways by ~15px the moment an overlay opens.
|
|
12
|
+
*
|
|
9
13
|
* @example
|
|
10
14
|
* ```
|
|
11
15
|
* useScrollLock(isOpen);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollLock.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollLock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useScrollLock.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollLock.ts"],"names":[],"mappings":"AAmCA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAwDrD"}
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SYNC: When modified, update:
|
|
15
15
|
* - /packages/core/src/hooks/index.ts
|
|
16
|
+
* - /packages/core/src/hooks/scrollbarGutter.ts
|
|
16
17
|
*/
|
|
17
18
|
import { useEffect } from 'react';
|
|
19
|
+
import { holdScrollbarGutter } from "./scrollbarGutter.js";
|
|
18
20
|
let lockCount = 0;
|
|
19
21
|
let originalBodyState = null;
|
|
20
22
|
|
|
@@ -26,6 +28,10 @@ let originalBodyState = null;
|
|
|
26
28
|
* does not prevent body scroll behind modals. Restores scroll position
|
|
27
29
|
* on unlock.
|
|
28
30
|
*
|
|
31
|
+
* Pinning also hides the document's scrollbar, so the gutter that scrollbar
|
|
32
|
+
* occupied is held open for the duration of the lock — without it the page
|
|
33
|
+
* reflows sideways by ~15px the moment an overlay opens.
|
|
34
|
+
*
|
|
29
35
|
* @example
|
|
30
36
|
* ```
|
|
31
37
|
* useScrollLock(isOpen);
|
|
@@ -42,6 +48,9 @@ export function useScrollLock(isLocked) {
|
|
|
42
48
|
if (lockCount === 0) {
|
|
43
49
|
const scrollX = window.scrollX;
|
|
44
50
|
const scrollY = window.scrollY;
|
|
51
|
+
|
|
52
|
+
// Taken before the pinning styles below hide the scrollbar.
|
|
53
|
+
const gutter = holdScrollbarGutter(body);
|
|
45
54
|
originalBodyState = {
|
|
46
55
|
scrollX,
|
|
47
56
|
scrollY,
|
|
@@ -49,13 +58,15 @@ export function useScrollLock(isLocked) {
|
|
|
49
58
|
position: body.style.position,
|
|
50
59
|
top: body.style.top,
|
|
51
60
|
left: body.style.left,
|
|
52
|
-
right: body.style.right
|
|
61
|
+
right: body.style.right,
|
|
62
|
+
gutter
|
|
53
63
|
};
|
|
54
64
|
body.style.overflow = 'hidden';
|
|
55
65
|
body.style.position = 'fixed';
|
|
56
66
|
body.style.top = `-${scrollY}px`;
|
|
57
67
|
body.style.left = '0';
|
|
58
68
|
body.style.right = '0';
|
|
69
|
+
gutter.settle();
|
|
59
70
|
}
|
|
60
71
|
lockCount += 1;
|
|
61
72
|
return () => {
|
|
@@ -70,6 +81,7 @@ export function useScrollLock(isLocked) {
|
|
|
70
81
|
body.style.top = state.top;
|
|
71
82
|
body.style.left = state.left;
|
|
72
83
|
body.style.right = state.right;
|
|
84
|
+
state.gutter.release();
|
|
73
85
|
window.scrollTo(state.scrollX, state.scrollY);
|
|
74
86
|
};
|
|
75
87
|
}, [isLocked]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternationalizationContext.d.ts","sourceRoot":"","sources":["../../src/i18n/InternationalizationContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InternationalizationContext.d.ts","sourceRoot":"","sources":["../../src/i18n/InternationalizationContext.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AAEjE,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;IACzB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,2DAKpC,CAAC"}
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
* - /packages/core/src/i18n/InternationalizationProvider.tsx
|
|
17
17
|
* - /packages/core/src/i18n/t.client.ts
|
|
18
18
|
* - /packages/core/src/i18n/useDirection.ts
|
|
19
|
+
* - /packages/core/src/i18n/useLocale.ts
|
|
20
|
+
* - /packages/core/src/i18n/useCollator.ts
|
|
19
21
|
* - /packages/core/src/i18n/getLocaleDirection.ts
|
|
20
22
|
* - /packages/core/src/i18n/index.ts
|
|
21
23
|
*/
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -8,12 +8,16 @@
|
|
|
8
8
|
* The public API is deliberately small:
|
|
9
9
|
* - InternationalizationProvider — provider component
|
|
10
10
|
* - useTranslator — hook returning a translator function
|
|
11
|
+
* - useLocale — hook returning the provider locale
|
|
12
|
+
* - useCollator — provider-bound locale-aware comparison
|
|
11
13
|
* - useDirection — hook returning the ambient text direction
|
|
12
14
|
* - getLocaleDirection — server-safe locale → direction helper
|
|
13
15
|
* - Translator — interface for consumer-injected runtimes
|
|
14
16
|
*
|
|
15
17
|
* SYNC: When modified, update these files to stay in sync:
|
|
16
18
|
* - /packages/core/src/index.ts
|
|
19
|
+
* - /packages/core/src/i18n/useLocale.ts
|
|
20
|
+
* - /packages/core/src/i18n/useCollator.ts
|
|
17
21
|
* - /packages/core/src/i18n/useDirection.ts
|
|
18
22
|
* - /packages/core/src/i18n/getLocaleDirection.ts
|
|
19
23
|
*/
|
|
@@ -23,6 +27,8 @@ export { InternationalizationContext } from './InternationalizationContext';
|
|
|
23
27
|
export type { InternationalizationContextValue } from './InternationalizationContext';
|
|
24
28
|
export { useTranslator } from './useTranslator';
|
|
25
29
|
export type { TranslatorFn } from './useTranslator';
|
|
30
|
+
export { useLocale } from './useLocale';
|
|
31
|
+
export { useCollator } from './useCollator';
|
|
26
32
|
export { useDirection } from './useDirection';
|
|
27
33
|
export { getLocaleDirection } from './getLocaleDirection';
|
|
28
34
|
export type { Translator } from './translator';
|
package/dist/i18n/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;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,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,YAAY,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAC7C,YAAY,EACV,MAAM,EACN,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,SAAS,GACV,MAAM,SAAS,CAAC"}
|
package/dist/i18n/index.js
CHANGED
|
@@ -10,12 +10,16 @@
|
|
|
10
10
|
* The public API is deliberately small:
|
|
11
11
|
* - InternationalizationProvider — provider component
|
|
12
12
|
* - useTranslator — hook returning a translator function
|
|
13
|
+
* - useLocale — hook returning the provider locale
|
|
14
|
+
* - useCollator — provider-bound locale-aware comparison
|
|
13
15
|
* - useDirection — hook returning the ambient text direction
|
|
14
16
|
* - getLocaleDirection — server-safe locale → direction helper
|
|
15
17
|
* - Translator — interface for consumer-injected runtimes
|
|
16
18
|
*
|
|
17
19
|
* SYNC: When modified, update these files to stay in sync:
|
|
18
20
|
* - /packages/core/src/index.ts
|
|
21
|
+
* - /packages/core/src/i18n/useLocale.ts
|
|
22
|
+
* - /packages/core/src/i18n/useCollator.ts
|
|
19
23
|
* - /packages/core/src/i18n/useDirection.ts
|
|
20
24
|
* - /packages/core/src/i18n/getLocaleDirection.ts
|
|
21
25
|
*/
|
|
@@ -23,5 +27,7 @@
|
|
|
23
27
|
export { InternationalizationProvider } from "./InternationalizationProvider.js";
|
|
24
28
|
export { InternationalizationContext } from "./InternationalizationContext.js";
|
|
25
29
|
export { useTranslator } from "./useTranslator.js";
|
|
30
|
+
export { useLocale } from "./useLocale.js";
|
|
31
|
+
export { useCollator } from "./useCollator.js";
|
|
26
32
|
export { useDirection } from "./useDirection.js";
|
|
27
33
|
export { getLocaleDirection } from "./getLocaleDirection.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns an `Intl.Collator` for the active provider locale, memoized across
|
|
3
|
+
* renders where the locale and options object are unchanged.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```
|
|
7
|
+
* const collator = useCollator({numeric: true});
|
|
8
|
+
* const sorted = [...items].sort((a, b) => collator.compare(a.name, b.name));
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function useCollator(options?: Intl.CollatorOptions): Intl.Collator;
|
|
12
|
+
//# sourceMappingURL=useCollator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCollator.d.ts","sourceRoot":"","sources":["../../src/i18n/useCollator.ts"],"names":[],"mappings":"AA2BA;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,QAAQ,CAMzE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file useCollator.ts
|
|
7
|
+
* @input InternationalizationContext (via use()), optional Intl.CollatorOptions
|
|
8
|
+
* @output A memoized Intl.Collator bound to the active locale
|
|
9
|
+
* @position Public provider-aware string-comparison hook. Exported from the
|
|
10
|
+
* i18n barrel for components, sibling packages, and consumers that need
|
|
11
|
+
* locale-correct sorting without constructing a raw Intl.Collator. Raw
|
|
12
|
+
* collator construction stays centralized in this hook.
|
|
13
|
+
*
|
|
14
|
+
* Falls back to `'en'` when called outside a provider, matching the
|
|
15
|
+
* useTranslator/useDirection/useLocale fallback.
|
|
16
|
+
*
|
|
17
|
+
* SYNC: When modified, update:
|
|
18
|
+
* - /packages/core/src/i18n/InternationalizationContext.ts
|
|
19
|
+
* - /packages/core/src/i18n/useLocale.ts
|
|
20
|
+
* - /packages/core/src/i18n/useCollator.doc.mjs
|
|
21
|
+
* - /packages/core/src/i18n/index.ts
|
|
22
|
+
* - /packages/core/src/i18n/__tests__/useCollator.test.tsx
|
|
23
|
+
*/
|
|
24
|
+
import { use, useMemo } from 'react';
|
|
25
|
+
import { InternationalizationContext } from "./InternationalizationContext.js";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Returns an `Intl.Collator` for the active provider locale, memoized across
|
|
29
|
+
* renders where the locale and options object are unchanged.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```
|
|
33
|
+
* const collator = useCollator({numeric: true});
|
|
34
|
+
* const sorted = [...items].sort((a, b) => collator.compare(a.name, b.name));
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export function useCollator(options) {
|
|
38
|
+
const ctx = use(InternationalizationContext);
|
|
39
|
+
return useMemo(() => new Intl.Collator(ctx.locale, options), [ctx.locale, options]);
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../src/i18n/useLocale.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,SAAS,CAAC;AAEpC,wBAAgB,SAAS,IAAI,MAAM,CAGlC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file useLocale.ts
|
|
7
|
+
* @input InternationalizationContext (via use())
|
|
8
|
+
* @output The active BCP 47 locale tag
|
|
9
|
+
* @position Public provider-aware locale accessor. Exported from the i18n
|
|
10
|
+
* barrel for components, sibling packages, and consumers that must thread
|
|
11
|
+
* the provider locale into pure formatting helpers. Returns `'en'` when
|
|
12
|
+
* called outside a provider, matching useTranslator/useDirection.
|
|
13
|
+
*
|
|
14
|
+
* This is the approved way to read the locale that feeds a formatting helper
|
|
15
|
+
* (`plainDateFormat`, `formatInstant`, chart formatters, …) or `useCollator()`.
|
|
16
|
+
* Reading `InternationalizationContext` directly for just its `locale` field,
|
|
17
|
+
* or reaching for `navigator.language`/a hardcoded literal, bypasses that
|
|
18
|
+
* provider-backed contract.
|
|
19
|
+
*
|
|
20
|
+
* SYNC: When modified, update:
|
|
21
|
+
* - /packages/core/src/i18n/InternationalizationContext.ts
|
|
22
|
+
* - /packages/core/src/i18n/useLocale.doc.mjs
|
|
23
|
+
* - /packages/core/src/i18n/index.ts
|
|
24
|
+
* - /packages/core/src/i18n/__tests__/useLocale.test.tsx
|
|
25
|
+
*/
|
|
26
|
+
import { use } from 'react';
|
|
27
|
+
import { InternationalizationContext } from "./InternationalizationContext.js";
|
|
28
|
+
export function useLocale() {
|
|
29
|
+
const ctx = use(InternationalizationContext);
|
|
30
|
+
return ctx.locale;
|
|
31
|
+
}
|
|
@@ -62,6 +62,11 @@ export type TokenValue = string | [light: string, dark: string];
|
|
|
62
62
|
* to the component selector. Supported pseudo-classes include `:hover`,
|
|
63
63
|
* `:focus-visible`, `:active`, `:checked`, `:disabled`, etc.
|
|
64
64
|
*
|
|
65
|
+
* A `:hover` override describes the ENABLED control: it is emitted with a
|
|
66
|
+
* guard that keeps it off disabled and `aria-disabled` elements, which
|
|
67
|
+
* `:hover` would otherwise still match. Style the disabled state through
|
|
68
|
+
* `:disabled` instead.
|
|
69
|
+
*
|
|
65
70
|
* @example
|
|
66
71
|
* ```ts
|
|
67
72
|
* {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineTheme.d.ts","sourceRoot":"","sources":["../../src/theme/defineTheme.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAC,gBAAgB,EAAa,MAAM,SAAS,CAAC;AAC1D,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAC;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;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC3B,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,gCAAgC;IAChC,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,oBAAoB;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9B,sEAAsE;IACtE,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,kEAAkE;IAClE,OAAO,CAAC,EAAE,IAAI,CAAC;IACf;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACpD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;;OAGG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B;AAMD,qFAAqF;AACrF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAehD,CAAC;AAoEF;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CAyLjE;AAMD,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,sBAAsB,CAAC;AAM9B,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAQpE"}
|
|
@@ -69,6 +69,11 @@ import { deepMergeComponents } from "./mergeComponents.js";
|
|
|
69
69
|
* to the component selector. Supported pseudo-classes include `:hover`,
|
|
70
70
|
* `:focus-visible`, `:active`, `:checked`, `:disabled`, etc.
|
|
71
71
|
*
|
|
72
|
+
* A `:hover` override describes the ENABLED control: it is emitted with a
|
|
73
|
+
* guard that keeps it off disabled and `aria-disabled` elements, which
|
|
74
|
+
* `:hover` would otherwise still match. Style the disabled state through
|
|
75
|
+
* `:disabled` instead.
|
|
76
|
+
*
|
|
72
77
|
* @example
|
|
73
78
|
* ```ts
|
|
74
79
|
* {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derivedVarRegistry.d.ts","sourceRoot":"","sources":["../../src/theme/derivedVarRegistry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,iFAAiF;IACjF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"derivedVarRegistry.d.ts","sourceRoot":"","sources":["../../src/theme/derivedVarRegistry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,iFAAiF;IACjF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CA8ChE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,eAAe,EAAE,CAMnB"}
|
|
@@ -77,6 +77,13 @@ export const derivedVarRegistry = {
|
|
|
77
77
|
property: 'borderRadius',
|
|
78
78
|
vars: ['--_hovercard-radius']
|
|
79
79
|
}],
|
|
80
|
+
'number-input': [{
|
|
81
|
+
property: 'padding',
|
|
82
|
+
expand: 'container'
|
|
83
|
+
}, {
|
|
84
|
+
property: 'borderRadius',
|
|
85
|
+
vars: ['--_field-radius']
|
|
86
|
+
}],
|
|
80
87
|
popover: [{
|
|
81
88
|
property: 'borderRadius',
|
|
82
89
|
vars: ['--_popover-radius']
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateThemeRules.d.ts","sourceRoot":"","sources":["../../src/theme/generateThemeRules.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"generateThemeRules.d.ts","sourceRoot":"","sources":["../../src/theme/generateThemeRules.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAgGhD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,kFAAkF;IAClF,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AA8LD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,EAAE,CAoChE;AAkRD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,eAAe,CAe5E;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CA4E9D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,cAAc,CA2BpE"}
|
|
@@ -45,12 +45,30 @@ function componentClassSelector(component, suffix) {
|
|
|
45
45
|
return `.${classPrefix}-${component}${suffix}`;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Guard appended to a themed `:hover` rule so it cannot match a disabled
|
|
50
|
+
* element.
|
|
51
|
+
*
|
|
52
|
+
* A theme authoring `':hover': {backgroundColor: …}` is describing the
|
|
53
|
+
* enabled control; `:hover` on its own would paint that background on a
|
|
54
|
+
* disabled one too, because browsers suppress a disabled control's events,
|
|
55
|
+
* not its hover styling. `:where()` contributes no specificity, so a themed
|
|
56
|
+
* hover rule still weighs exactly what it weighed before.
|
|
57
|
+
*
|
|
58
|
+
* Mirrors the `@astryx/no-hover-on-disabled` lint rule, which enforces the
|
|
59
|
+
* same guard on the components' own StyleX styles.
|
|
60
|
+
*/
|
|
61
|
+
const HOVER_DISABLED_GUARD = ':where(:not(:disabled,[aria-disabled="true"]))';
|
|
62
|
+
|
|
48
63
|
/**
|
|
49
64
|
* Append a pseudo-class to every selector in a comma-separated selector list.
|
|
50
65
|
*
|
|
51
66
|
* Selector helpers may emit comma-separated lists. CSS does not distribute a
|
|
52
67
|
* trailing pseudo over selector lists, so `${list}:hover` would only target the
|
|
53
68
|
* final selector. Rewrite each item so the pseudo applies to all of them.
|
|
69
|
+
*
|
|
70
|
+
* A `:hover` pseudo also picks up the disabled guard. A pseudo-ELEMENT has to
|
|
71
|
+
* end the selector, so the guard is spliced in before it.
|
|
54
72
|
*/
|
|
55
73
|
function appendPseudoToSelectorList(selector, pseudo) {
|
|
56
74
|
const parts = [];
|
|
@@ -68,7 +86,17 @@ function appendPseudoToSelectorList(selector, pseudo) {
|
|
|
68
86
|
}
|
|
69
87
|
}
|
|
70
88
|
parts.push(selector.slice(start).trim());
|
|
71
|
-
|
|
89
|
+
const guarded = guardHoverPseudo(pseudo);
|
|
90
|
+
return parts.map(part => `${part}${guarded}`).join(', ');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Insert the disabled guard into a `:hover` pseudo, keeping any pseudo-element last. */
|
|
94
|
+
function guardHoverPseudo(pseudo) {
|
|
95
|
+
if (!/^:hover(?![-\w])/.test(pseudo) || pseudo.includes('[aria-disabled')) {
|
|
96
|
+
return pseudo;
|
|
97
|
+
}
|
|
98
|
+
const pseudoElement = pseudo.indexOf('::');
|
|
99
|
+
return pseudoElement === -1 ? pseudo + HOVER_DISABLED_GUARD : pseudo.slice(0, pseudoElement) + HOVER_DISABLED_GUARD + pseudo.slice(pseudoElement);
|
|
72
100
|
}
|
|
73
101
|
|
|
74
102
|
// =============================================================================
|
|
@@ -96,13 +124,40 @@ function toKebabCase(str) {
|
|
|
96
124
|
|
|
97
125
|
/** Padding properties that trigger container token mapping */
|
|
98
126
|
const PADDING_PROPS = new Set(['padding', 'paddingBlock', 'paddingInline', 'paddingBlockStart', 'paddingBlockEnd', 'paddingInlineStart', 'paddingInlineEnd']);
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Physical block-axis longhands, and the logical longhand each one *is* in
|
|
130
|
+
* every horizontal writing mode. Normalizing them costs no direction
|
|
131
|
+
* assumption, which is why they can join the container expansion.
|
|
132
|
+
*
|
|
133
|
+
* `paddingLeft`/`paddingRight` are deliberately absent. They are
|
|
134
|
+
* direction-relative — left is inline-start in LTR and inline-end in RTL — and
|
|
135
|
+
* the expansion's tokens are consumed by logical properties, so mapping them
|
|
136
|
+
* would put the padding on the opposite edge in RTL. They keep their physical
|
|
137
|
+
* meaning and land on the element as `padding-left`/`padding-right`; the cost
|
|
138
|
+
* is that a component's internals cannot see them.
|
|
139
|
+
*/
|
|
140
|
+
const PHYSICAL_BLOCK_PADDING_PROPS = {
|
|
141
|
+
paddingTop: 'paddingBlockStart',
|
|
142
|
+
paddingBottom: 'paddingBlockEnd'
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Every padding spelling the container expansion consumes. Kept separate from
|
|
147
|
+
* PADDING_PROPS, which also routes longhands to `vars`-style derived entries —
|
|
148
|
+
* those carry one value for the whole box, so a single physical edge must not
|
|
149
|
+
* reach them.
|
|
150
|
+
*/
|
|
151
|
+
const CONTAINER_PADDING_PROPS = new Set([...PADDING_PROPS, ...Object.keys(PHYSICAL_BLOCK_PADDING_PROPS)]);
|
|
99
152
|
/**
|
|
100
153
|
* Parse CSS padding shorthand/longhand into block/inline values.
|
|
101
|
-
* Supports 1-3 value shorthands and
|
|
154
|
+
* Supports 1-3 value shorthands, logical properties, and the physical block
|
|
155
|
+
* longhands normalized by PHYSICAL_BLOCK_PADDING_PROPS.
|
|
102
156
|
*/
|
|
103
157
|
function parsePadding(props) {
|
|
104
158
|
const result = {};
|
|
105
|
-
for (const [
|
|
159
|
+
for (const [rawProp, value] of props) {
|
|
160
|
+
const prop = PHYSICAL_BLOCK_PADDING_PROPS[rawProp] ?? rawProp;
|
|
106
161
|
switch (prop) {
|
|
107
162
|
case 'padding':
|
|
108
163
|
{
|
|
@@ -311,13 +366,19 @@ function generateComponentRules(components, parts) {
|
|
|
311
366
|
}
|
|
312
367
|
}
|
|
313
368
|
}
|
|
369
|
+
// A physical block longhand reaches the container expansion only. It
|
|
370
|
+
// names one edge, so it must not feed a `vars` entry above, which
|
|
371
|
+
// carries the padding for the whole box.
|
|
372
|
+
if (prop in PHYSICAL_BLOCK_PADDING_PROPS && getDerivedVars(component, 'padding').some(e => e.expand === 'container')) {
|
|
373
|
+
containerExpanded = true;
|
|
374
|
+
}
|
|
314
375
|
}
|
|
315
376
|
|
|
316
377
|
// Container padding expansion: replace padding props with
|
|
317
378
|
// component-scoped container tokens for layout integration.
|
|
318
379
|
if (containerExpanded) {
|
|
319
|
-
const paddingProps = props.filter(([p]) =>
|
|
320
|
-
const nonPaddingProps = props.filter(([p]) => !
|
|
380
|
+
const paddingProps = props.filter(([p]) => CONTAINER_PADDING_PROPS.has(p));
|
|
381
|
+
const nonPaddingProps = props.filter(([p]) => !CONTAINER_PADDING_PROPS.has(p));
|
|
321
382
|
const parsed = parsePadding(paddingProps);
|
|
322
383
|
const containerTokens = expandContainerPadding(component, parsed);
|
|
323
384
|
finalProps = [...nonPaddingProps, ...containerTokens];
|
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
* - /packages/core/src/utils/index.ts
|
|
10
10
|
*/
|
|
11
11
|
import { type PlainDate } from './plainDate';
|
|
12
|
+
import type { Locale } from '../i18n/types';
|
|
12
13
|
export { plainDateFromISO as parseISO, plainDateToISO as dateToISO, } from './plainDate';
|
|
13
14
|
/**
|
|
14
|
-
* Detects if the
|
|
15
|
+
* Detects if the locale uses day-first date format (DD/MM/YYYY).
|
|
15
16
|
* US and a few others use month-first (MM/DD/YYYY).
|
|
16
17
|
*/
|
|
17
|
-
export declare function isLocaleDayFirst(): boolean;
|
|
18
|
+
export declare function isLocaleDayFirst(locale?: Locale): boolean;
|
|
18
19
|
/**
|
|
19
20
|
* Parses user input into a PlainDate.
|
|
20
21
|
*
|
|
@@ -29,5 +30,5 @@ export declare function isLocaleDayFirst(): boolean;
|
|
|
29
30
|
*
|
|
30
31
|
* @returns PlainDate if valid, null if unparseable
|
|
31
32
|
*/
|
|
32
|
-
export declare function parseDateInput(input: string): PlainDate | null;
|
|
33
|
+
export declare function parseDateInput(input: string, locale?: Locale): PlainDate | null;
|
|
33
34
|
//# sourceMappingURL=dateParser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateParser.d.ts","sourceRoot":"","sources":["../../src/utils/dateParser.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAqC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"dateParser.d.ts","sourceRoot":"","sources":["../../src/utils/dateParser.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAqC,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAE1C,OAAO,EACL,gBAAgB,IAAI,QAAQ,EAC5B,cAAc,IAAI,SAAS,GAC5B,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAOzD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,GACd,SAAS,GAAG,IAAI,CAsGlB"}
|
package/dist/utils/dateParser.js
CHANGED
|
@@ -15,11 +15,11 @@ import { plainDateCreate, plainDateFromDate } from "./plainDate.js";
|
|
|
15
15
|
export { plainDateFromISO as parseISO, plainDateToISO as dateToISO } from "./plainDate.js";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Detects if the
|
|
18
|
+
* Detects if the locale uses day-first date format (DD/MM/YYYY).
|
|
19
19
|
* US and a few others use month-first (MM/DD/YYYY).
|
|
20
20
|
*/
|
|
21
|
-
export function isLocaleDayFirst() {
|
|
22
|
-
const parts = new Intl.DateTimeFormat().formatToParts(new Date(2000, 0, 15));
|
|
21
|
+
export function isLocaleDayFirst(locale) {
|
|
22
|
+
const parts = new Intl.DateTimeFormat(locale).formatToParts(new Date(2000, 0, 15));
|
|
23
23
|
const dayIndex = parts.findIndex(p => p.type === 'day');
|
|
24
24
|
const monthIndex = parts.findIndex(p => p.type === 'month');
|
|
25
25
|
return dayIndex < monthIndex;
|
|
@@ -39,7 +39,7 @@ export function isLocaleDayFirst() {
|
|
|
39
39
|
*
|
|
40
40
|
* @returns PlainDate if valid, null if unparseable
|
|
41
41
|
*/
|
|
42
|
-
export function parseDateInput(input) {
|
|
42
|
+
export function parseDateInput(input, locale) {
|
|
43
43
|
const trimmed = input.trim();
|
|
44
44
|
if (!trimmed) {
|
|
45
45
|
return null;
|
|
@@ -102,14 +102,14 @@ export function parseDateInput(input) {
|
|
|
102
102
|
if (sep1 !== sep2) {
|
|
103
103
|
return null;
|
|
104
104
|
}
|
|
105
|
-
return parseNumericDate(+first, +second, +year);
|
|
105
|
+
return parseNumericDate(+first, +second, +year, locale);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
// 5. Try numeric formats WITHOUT year (defaults to current year)
|
|
109
109
|
const numericNoYearMatch = trimmed.match(/^(\d{1,2})[-/.](\d{1,2})$/);
|
|
110
110
|
if (numericNoYearMatch) {
|
|
111
111
|
const [, first, second] = numericNoYearMatch;
|
|
112
|
-
return parseNumericDate(+first, +second, currentYear);
|
|
112
|
+
return parseNumericDate(+first, +second, currentYear, locale);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
// 6. Fall back to native Date parsing for other formats.
|
|
@@ -132,7 +132,7 @@ export function parseDateInput(input) {
|
|
|
132
132
|
}
|
|
133
133
|
return null;
|
|
134
134
|
}
|
|
135
|
-
function parseNumericDate(first, second, year) {
|
|
135
|
+
function parseNumericDate(first, second, year, locale) {
|
|
136
136
|
let day;
|
|
137
137
|
let month;
|
|
138
138
|
if (first > 12 && second <= 12) {
|
|
@@ -144,7 +144,7 @@ function parseNumericDate(first, second, year) {
|
|
|
144
144
|
} else if (first > 12 && second > 12) {
|
|
145
145
|
return null;
|
|
146
146
|
} else {
|
|
147
|
-
if (isLocaleDayFirst()) {
|
|
147
|
+
if (isLocaleDayFirst(locale)) {
|
|
148
148
|
day = first;
|
|
149
149
|
month = second;
|
|
150
150
|
} else {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @position Shared utility; replaces scattered Date usage across Calendar hooks
|
|
6
6
|
*/
|
|
7
7
|
import type { ISODateString, PlainDate } from './dateTypes';
|
|
8
|
+
import type { Locale } from '../i18n/types';
|
|
8
9
|
export type { PlainDate } from './dateTypes';
|
|
9
10
|
export declare function plainDateCreate(year: number, month: number, day: number): PlainDate;
|
|
10
11
|
export declare function plainDateFromISO(str: ISODateString): PlainDate;
|
|
@@ -16,6 +17,12 @@ export declare function getDaysInMonth(year: number, month: number): number;
|
|
|
16
17
|
export declare function plainDateDayOfWeek(pd: PlainDate): number;
|
|
17
18
|
export declare function plainDateAddMonths(pd: PlainDate, n: number): PlainDate;
|
|
18
19
|
export declare function plainDateAddDays(pd: PlainDate, n: number): PlainDate;
|
|
20
|
+
/**
|
|
21
|
+
* Whole calendar days from `a` to `b`, ignoring time of day. Positive when
|
|
22
|
+
* `b` is after `a`, negative when before. Uses UTC midnight so DST shifts
|
|
23
|
+
* never add or drop a day.
|
|
24
|
+
*/
|
|
25
|
+
export declare function plainDateDiffDays(a: PlainDate, b: PlainDate): number;
|
|
19
26
|
/**
|
|
20
27
|
* The wall-clock fields an instant reads as in a given zone.
|
|
21
28
|
*
|
|
@@ -51,7 +58,7 @@ export declare const DATE_FORMAT_LONG: Intl.DateTimeFormatOptions;
|
|
|
51
58
|
export declare const DATE_FORMAT_MONTH_YEAR: Intl.DateTimeFormatOptions;
|
|
52
59
|
export declare const DATE_FORMAT_SHORT: Intl.DateTimeFormatOptions;
|
|
53
60
|
export declare const DATE_FORMAT_SHORT_WITH_YEAR: Intl.DateTimeFormatOptions;
|
|
54
|
-
export declare function plainDateFormat(pd: PlainDate, options: Intl.DateTimeFormatOptions): string;
|
|
61
|
+
export declare function plainDateFormat(pd: PlainDate, options: Intl.DateTimeFormatOptions, locale?: Locale): string;
|
|
55
62
|
/**
|
|
56
63
|
* The date-only members of Timestamp's `format` vocabulary that a
|
|
57
64
|
* calendar-date field (no time-of-day) can render. Both Timestamp and
|
|
@@ -80,5 +87,5 @@ export declare const SHARED_DATE_FORMAT_OPTIONS: Record<Exclude<SharedDateFormat
|
|
|
80
87
|
* Timestamp maps the same members onto {@link SHARED_DATE_FORMAT_OPTIONS} in
|
|
81
88
|
* its own `formatTimestamp` switch (its input is a `Date`, not a `PlainDate`).
|
|
82
89
|
*/
|
|
83
|
-
export declare function formatSharedDate(pd: PlainDate, format: SharedDateFormat): string;
|
|
90
|
+
export declare function formatSharedDate(pd: PlainDate, format: SharedDateFormat, locale?: Locale): string;
|
|
84
91
|
//# sourceMappingURL=plainDate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plainDate.d.ts","sourceRoot":"","sources":["../../src/utils/plainDate.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"plainDate.d.ts","sourceRoot":"","sources":["../../src/utils/plainDate.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAE1C,YAAY,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAE3C,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,SAAS,CAcX;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,GAAG,SAAS,CAG9D;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,SAAS,GAAG,aAAa,CAK3D;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,CAEnD;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,GAAG,SAAS,CAMpD;AAED,wBAAgB,cAAc,IAAI,SAAS,CAE1C;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlE;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,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