@astryxdesign/core 0.4.4 → 0.4.5-canary.0472ec1
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/Blockquote/Blockquote.d.ts +4 -3
- package/dist/Blockquote/Blockquote.d.ts.map +1 -1
- package/dist/Blockquote/Blockquote.js +9 -10
- 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 +77 -18
- 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 +31 -2
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +92 -19
- package/dist/DateInput/MonthScroller.d.ts +35 -0
- package/dist/DateInput/MonthScroller.d.ts.map +1 -0
- package/dist/DateInput/MonthScroller.js +573 -0
- package/dist/DateInput/MonthYearWheels.d.ts +24 -0
- package/dist/DateInput/MonthYearWheels.d.ts.map +1 -0
- package/dist/DateInput/MonthYearWheels.js +114 -0
- package/dist/DateInput/TouchDateField.d.ts +10 -0
- package/dist/DateInput/TouchDateField.d.ts.map +1 -0
- package/dist/DateInput/TouchDateField.js +810 -0
- package/dist/DateInput/Wheel.d.ts +41 -0
- package/dist/DateInput/Wheel.d.ts.map +1 -0
- package/dist/DateInput/Wheel.js +315 -0
- package/dist/DateInput/monthGeometry.d.ts +65 -0
- package/dist/DateInput/monthGeometry.d.ts.map +1 -0
- package/dist/DateInput/monthGeometry.js +98 -0
- package/dist/DateInput/tokens.stylex.d.ts +63 -0
- package/dist/DateInput/tokens.stylex.d.ts.map +1 -0
- package/dist/DateInput/tokens.stylex.js +74 -0
- package/dist/DateInput/useOwnScrollGesture.d.ts +41 -0
- package/dist/DateInput/useOwnScrollGesture.d.ts.map +1 -0
- package/dist/DateInput/useOwnScrollGesture.js +202 -0
- package/dist/DateInput/usePointerDragScroll.d.ts +15 -0
- package/dist/DateInput/usePointerDragScroll.d.ts.map +1 -0
- package/dist/DateInput/usePointerDragScroll.js +216 -0
- package/dist/DateInput/useScrollSettle.d.ts +26 -0
- package/dist/DateInput/useScrollSettle.d.ts.map +1 -0
- package/dist/DateInput/useScrollSettle.js +149 -0
- 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 +123 -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/theme/syntax/index.d.ts +6 -0
- package/dist/theme/syntax/index.d.ts.map +1 -1
- package/dist/theme/syntax/index.js +7 -2
- 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/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/plainDate.d.ts +11 -2
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +32 -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 +32 -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 +24 -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/Blockquote/Blockquote.doc.mjs +30 -7
- package/src/Blockquote/Blockquote.test.tsx +34 -3
- package/src/Blockquote/Blockquote.tsx +11 -9
- 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 +91 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +121 -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 +90 -19
- package/src/DateInput/DateInputTouch.test.tsx +2393 -0
- package/src/DateInput/MonthScroller.tsx +784 -0
- package/src/DateInput/MonthYearWheels.tsx +147 -0
- package/src/DateInput/TouchDateField.tsx +1214 -0
- package/src/DateInput/Wheel.tsx +470 -0
- package/src/DateInput/monthGeometry.ts +118 -0
- package/src/DateInput/tokens.stylex.ts +99 -0
- package/src/DateInput/useOwnScrollGesture.ts +227 -0
- package/src/DateInput/usePointerDragScroll.ts +220 -0
- package/src/DateInput/useScrollSettle.ts +164 -0
- 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/theme/syntax/index.ts +6 -2
- package/src/theme/syntax/serverSafeSyntax.test.ts +68 -0
- package/src/utils/dateParser.test.ts +20 -0
- package/src/utils/dateParser.ts +14 -7
- package/src/utils/index.ts +2 -0
- package/src/utils/plainDate.test.ts +56 -0
- package/src/utils/plainDate.ts +33 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('@astryxdesign/cli/authoring').HookDoc} */
|
|
4
|
+
export const docs = {
|
|
5
|
+
name: 'useCollator',
|
|
6
|
+
displayName: 'useCollator',
|
|
7
|
+
category: 'utilities',
|
|
8
|
+
keywords: [
|
|
9
|
+
'i18n',
|
|
10
|
+
'internationalization',
|
|
11
|
+
'locale',
|
|
12
|
+
'collation',
|
|
13
|
+
'compare',
|
|
14
|
+
'sort',
|
|
15
|
+
'table',
|
|
16
|
+
'hook',
|
|
17
|
+
],
|
|
18
|
+
params: [
|
|
19
|
+
{
|
|
20
|
+
name: 'options',
|
|
21
|
+
type: 'Intl.CollatorOptions',
|
|
22
|
+
description:
|
|
23
|
+
'Optional collation behavior such as numeric ordering, sensitivity, punctuation handling, and case order.',
|
|
24
|
+
required: false,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
returns: [
|
|
28
|
+
{
|
|
29
|
+
name: 'collator',
|
|
30
|
+
type: 'Intl.Collator',
|
|
31
|
+
description:
|
|
32
|
+
'A memoized collator bound to the active InternationalizationProvider locale.',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
usage: {
|
|
36
|
+
description:
|
|
37
|
+
'Returns the sanctioned locale-aware comparator for custom sorting. The collator is recreated when the provider locale or an option changes.',
|
|
38
|
+
bestPractices: [
|
|
39
|
+
{
|
|
40
|
+
guidance: true,
|
|
41
|
+
description:
|
|
42
|
+
'Reuse collator.compare in custom Table comparators and other user-visible string ordering.',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
guidance: false,
|
|
46
|
+
description:
|
|
47
|
+
'Construct Intl.Collator directly or call localeCompare; those bypass the provider-backed locale contract.',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
relatedComponents: ['InternationalizationProvider', 'Table'],
|
|
52
|
+
relatedHooks: ['useLocale'],
|
|
53
|
+
importPath: '@astryxdesign/core',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** @type {import('@astryxdesign/cli/authoring').HookTranslationDoc} */
|
|
57
|
+
export const docsDense = {
|
|
58
|
+
description:
|
|
59
|
+
'Returns a memoized Intl.Collator bound to the active InternationalizationProvider locale.',
|
|
60
|
+
paramDescriptions: {
|
|
61
|
+
options:
|
|
62
|
+
'optional Intl.CollatorOptions: numeric ordering, sensitivity, punctuation, case order, etc.',
|
|
63
|
+
},
|
|
64
|
+
returnDescriptions: {
|
|
65
|
+
collator:
|
|
66
|
+
'memoized provider-bound collator for locale-aware comparison and sorting.',
|
|
67
|
+
},
|
|
68
|
+
usage: {
|
|
69
|
+
description:
|
|
70
|
+
'Use collator.compare for custom user-visible string ordering instead of raw Intl.Collator or localeCompare.',
|
|
71
|
+
bestPractices: [
|
|
72
|
+
{
|
|
73
|
+
guidance: true,
|
|
74
|
+
description:
|
|
75
|
+
'Reuse collator.compare in custom Table comparators and string sorting.',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
guidance: false,
|
|
79
|
+
description:
|
|
80
|
+
'Construct raw Intl.Collator or call localeCompare directly.',
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
|
|
25
|
+
import {use, useMemo} from 'react';
|
|
26
|
+
import {InternationalizationContext} from './InternationalizationContext';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns an `Intl.Collator` for the active provider locale, memoized across
|
|
30
|
+
* renders where the locale and options object are unchanged.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```
|
|
34
|
+
* const collator = useCollator({numeric: true});
|
|
35
|
+
* const sorted = [...items].sort((a, b) => collator.compare(a.name, b.name));
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export function useCollator(options?: Intl.CollatorOptions): Intl.Collator {
|
|
39
|
+
const ctx = use(InternationalizationContext);
|
|
40
|
+
return useMemo(
|
|
41
|
+
() => new Intl.Collator(ctx.locale, options),
|
|
42
|
+
[ctx.locale, options],
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('@astryxdesign/cli/authoring').HookDoc} */
|
|
4
|
+
export const docs = {
|
|
5
|
+
name: 'useLocale',
|
|
6
|
+
displayName: 'useLocale',
|
|
7
|
+
category: 'utilities',
|
|
8
|
+
keywords: [
|
|
9
|
+
'i18n',
|
|
10
|
+
'internationalization',
|
|
11
|
+
'localization',
|
|
12
|
+
'locale',
|
|
13
|
+
'language',
|
|
14
|
+
'provider',
|
|
15
|
+
'hook',
|
|
16
|
+
],
|
|
17
|
+
params: [],
|
|
18
|
+
returns: [
|
|
19
|
+
{
|
|
20
|
+
name: 'locale',
|
|
21
|
+
type: 'Locale',
|
|
22
|
+
description:
|
|
23
|
+
"The active InternationalizationProvider BCP 47 locale. Falls back to 'en' when no provider is present.",
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
usage: {
|
|
27
|
+
description:
|
|
28
|
+
'Reads the authoritative Astryx locale. Use it to thread the provider locale into pure formatting helpers and sibling-package APIs; do not derive a second locale from navigator.language or a hardcoded literal.',
|
|
29
|
+
bestPractices: [
|
|
30
|
+
{
|
|
31
|
+
guidance: true,
|
|
32
|
+
description:
|
|
33
|
+
'Pass the returned locale to pure Astryx helpers or package APIs that require an explicit locale.',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
guidance: false,
|
|
37
|
+
description:
|
|
38
|
+
'Use navigator.language or a hardcoded display locale as a fallback; InternationalizationProvider is the locale source.',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
relatedComponents: ['InternationalizationProvider'],
|
|
43
|
+
relatedHooks: ['useCollator', 'useTranslator', 'useDirection'],
|
|
44
|
+
importPath: '@astryxdesign/core',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** @type {import('@astryxdesign/cli/authoring').HookTranslationDoc} */
|
|
48
|
+
export const docsDense = {
|
|
49
|
+
description:
|
|
50
|
+
"Returns the active InternationalizationProvider locale, falling back to 'en' without a provider.",
|
|
51
|
+
usage: {
|
|
52
|
+
description:
|
|
53
|
+
'Use as the sole locale source for pure formatting helpers and sibling-package APIs.',
|
|
54
|
+
bestPractices: [
|
|
55
|
+
{
|
|
56
|
+
guidance: true,
|
|
57
|
+
description:
|
|
58
|
+
'Thread this locale into pure helpers requiring an explicit locale.',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
guidance: false,
|
|
62
|
+
description:
|
|
63
|
+
'Fall back to navigator.language or a hardcoded display locale.',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
returnDescriptions: {
|
|
68
|
+
locale: "active provider BCP 47 locale; 'en' without a provider.",
|
|
69
|
+
},
|
|
70
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
|
|
27
|
+
import {use} from 'react';
|
|
28
|
+
import {InternationalizationContext} from './InternationalizationContext';
|
|
29
|
+
import type {Locale} from './types';
|
|
30
|
+
|
|
31
|
+
export function useLocale(): Locale {
|
|
32
|
+
const ctx = use(InternationalizationContext);
|
|
33
|
+
return ctx.locale;
|
|
34
|
+
}
|
|
@@ -738,7 +738,9 @@ describe('pseudo-class overrides in components', () => {
|
|
|
738
738
|
expect(css).toContain('.astryx-radio {');
|
|
739
739
|
expect(css).toContain('border-color: #8F9296');
|
|
740
740
|
// Pseudo rule — separate selector
|
|
741
|
-
expect(css).toContain(
|
|
741
|
+
expect(css).toContain(
|
|
742
|
+
'.astryx-radio:hover:where(:not(:disabled,[aria-disabled="true"])) {',
|
|
743
|
+
);
|
|
742
744
|
expect(css).toContain(
|
|
743
745
|
'border-color: color-mix(in srgb, #8F9296, black 20%)',
|
|
744
746
|
);
|
|
@@ -764,7 +766,9 @@ describe('pseudo-class overrides in components', () => {
|
|
|
764
766
|
const css = generateThemeTestCSS(theme);
|
|
765
767
|
expect(css).toContain('.astryx-button.primary-muted {');
|
|
766
768
|
expect(css).toContain('background-color: #ECF5FF');
|
|
767
|
-
expect(css).toContain(
|
|
769
|
+
expect(css).toContain(
|
|
770
|
+
'.astryx-button.primary-muted:hover:where(:not(:disabled,[aria-disabled="true"])) {',
|
|
771
|
+
);
|
|
768
772
|
expect(css).toContain('background-color: #D6EBFF');
|
|
769
773
|
expect(css).toContain('.astryx-button.primary-muted:focus-visible {');
|
|
770
774
|
expect(css).toContain('outline: 2px solid var(--color-accent)');
|
|
@@ -787,7 +791,9 @@ describe('pseudo-class overrides in components', () => {
|
|
|
787
791
|
// Should NOT emit an empty base rule
|
|
788
792
|
expect(css).not.toMatch(/\.astryx-switch\s*\{\s*\}/);
|
|
789
793
|
// Should emit the pseudo rule
|
|
790
|
-
expect(css).toContain(
|
|
794
|
+
expect(css).toContain(
|
|
795
|
+
'.astryx-switch:hover:where(:not(:disabled,[aria-disabled="true"])) {',
|
|
796
|
+
);
|
|
791
797
|
});
|
|
792
798
|
|
|
793
799
|
it('keeps non-pseudo string values as regular properties', () => {
|
package/src/theme/defineTheme.ts
CHANGED
|
@@ -113,6 +113,11 @@ export type TokenValue = string | [light: string, dark: string];
|
|
|
113
113
|
* to the component selector. Supported pseudo-classes include `:hover`,
|
|
114
114
|
* `:focus-visible`, `:active`, `:checked`, `:disabled`, etc.
|
|
115
115
|
*
|
|
116
|
+
* A `:hover` override describes the ENABLED control: it is emitted with a
|
|
117
|
+
* guard that keeps it off disabled and `aria-disabled` elements, which
|
|
118
|
+
* `:hover` would otherwise still match. Style the disabled state through
|
|
119
|
+
* `:disabled` instead.
|
|
120
|
+
*
|
|
116
121
|
* @example
|
|
117
122
|
* ```ts
|
|
118
123
|
* {
|
|
@@ -85,6 +85,9 @@ const STRUCTURAL_VARS = new Set([
|
|
|
85
85
|
'--table-row-overlay',
|
|
86
86
|
'--separator-display',
|
|
87
87
|
'--astryx-section-padding',
|
|
88
|
+
// Private counterpart of the public token above: one ancestor Section's
|
|
89
|
+
// padding, propagated down the tree. Structural, never authored by a theme.
|
|
90
|
+
'--_section-padding-propagated',
|
|
88
91
|
]);
|
|
89
92
|
|
|
90
93
|
/**
|
|
@@ -164,9 +167,6 @@ function discoverComponents(): ComponentInfo[] {
|
|
|
164
167
|
allVars.add(v);
|
|
165
168
|
}
|
|
166
169
|
}
|
|
167
|
-
if (allVars.size === 0) {
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
170
|
|
|
171
171
|
// Only check component directories (those with a doc file named after the
|
|
172
172
|
// directory). Match against the on-disk listing rather than existsSync so
|
|
@@ -188,6 +188,16 @@ function discoverComponents(): ComponentInfo[] {
|
|
|
188
188
|
/* skip */
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
+
// A directory earns a check by declaring a var OR by documenting a
|
|
192
|
+
// derived[] entry. Bailing on the var count alone (as this did) hid every
|
|
193
|
+
// component that is themeable purely through an expansion strategy —
|
|
194
|
+
// `{property: 'padding', expand: 'container'}` names no var, so such a
|
|
195
|
+
// component declares nothing and its registry↔doc consistency check
|
|
196
|
+
// silently never ran.
|
|
197
|
+
if (allVars.size === 0 && docDerived.length === 0) {
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
|
|
191
201
|
results.push({
|
|
192
202
|
dir,
|
|
193
203
|
sourceVars: [...allVars],
|
|
@@ -212,6 +222,7 @@ const DIR_TO_REGISTRY_KEY: Record<string, string> = {
|
|
|
212
222
|
DropdownMenu: 'dropdown-menu',
|
|
213
223
|
Field: 'field',
|
|
214
224
|
HoverCard: 'hovercard',
|
|
225
|
+
NumberInput: 'number-input',
|
|
215
226
|
Popover: 'popover',
|
|
216
227
|
ProgressBar: 'progressbar-mark',
|
|
217
228
|
Section: 'section',
|
|
@@ -262,9 +273,12 @@ const VARS_WITHOUT_DERIVED_MAPPING = new Set([
|
|
|
262
273
|
'--_avatar-group-overlap',
|
|
263
274
|
'--_codeblock-gutter-width',
|
|
264
275
|
'--_tab-indicator-bottom',
|
|
265
|
-
// Hit-area outset on a ::after overlay
|
|
266
|
-
//
|
|
276
|
+
// Hit-area outset on a ::after overlay, and whether that overlay is
|
|
277
|
+
// generated at all — `inset` and `content` on a pseudo-element are not
|
|
278
|
+
// properties a theme author sets on the component.
|
|
267
279
|
'--_thumbnail-hit-inset',
|
|
280
|
+
'--_input-clear-hit-inset',
|
|
281
|
+
'--_input-clear-hit-content',
|
|
268
282
|
// Indentation and row-spacing metrics: --tree-list-indent is the authorable
|
|
269
283
|
// step, --_tree-indent the per-row distance TreeListItem computes from it.
|
|
270
284
|
// --tree-list-row-gap is applied as half a padding-block on each row wrapper,
|
|
@@ -67,6 +67,10 @@ export const derivedVarRegistry: Record<string, DerivedVarEntry[]> = {
|
|
|
67
67
|
],
|
|
68
68
|
field: [{property: 'borderRadius', vars: ['--_field-radius']}],
|
|
69
69
|
hovercard: [{property: 'borderRadius', vars: ['--_hovercard-radius']}],
|
|
70
|
+
'number-input': [
|
|
71
|
+
{property: 'padding', expand: 'container'},
|
|
72
|
+
{property: 'borderRadius', vars: ['--_field-radius']},
|
|
73
|
+
],
|
|
70
74
|
popover: [{property: 'borderRadius', vars: ['--_popover-radius']}],
|
|
71
75
|
'progressbar-mark': [
|
|
72
76
|
{property: 'width', vars: ['--_progressbar-mark-width'], replaces: true},
|
|
@@ -160,6 +160,45 @@ describe('generateThemeRules', () => {
|
|
|
160
160
|
).toBe(true);
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
+
// A theme authoring `:hover` is describing the ENABLED control. Without a
|
|
164
|
+
// guard the rule paints a disabled one too, because browsers suppress a
|
|
165
|
+
// disabled control's events, not its hover styling — and a theme override
|
|
166
|
+
// would then reintroduce, on every component at once, the defect the
|
|
167
|
+
// components' own styles were fixed for.
|
|
168
|
+
it('keeps a themed :hover off disabled elements', () => {
|
|
169
|
+
const hoverTheme = defineTheme({
|
|
170
|
+
name: 'hover-guard',
|
|
171
|
+
components: {
|
|
172
|
+
button: {
|
|
173
|
+
base: {
|
|
174
|
+
':hover': {color: 'red'},
|
|
175
|
+
':focus-visible': {outline: '2px solid blue'},
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
const hoverRules = generateThemeRules(hoverTheme);
|
|
181
|
+
const hoverRule = hoverRules.find(rule => rule.includes(':hover'));
|
|
182
|
+
expect(hoverRule).toBeDefined();
|
|
183
|
+
expect(hoverRule).toContain(
|
|
184
|
+
'.astryx-button:hover:where(:not(:disabled,[aria-disabled="true"]))',
|
|
185
|
+
);
|
|
186
|
+
// Every selector in a comma-separated list carries its own guard —
|
|
187
|
+
// a trailing pseudo does not distribute over a selector list. (Counted,
|
|
188
|
+
// not split: the guard contains a comma of its own.)
|
|
189
|
+
const selectorText = String(hoverRule).split('{')[0];
|
|
190
|
+
const hovers = selectorText.match(/:hover/g) || [];
|
|
191
|
+
const guards = selectorText.match(/:where\(:not\(:disabled/g) || [];
|
|
192
|
+
expect(hovers.length).toBeGreaterThan(0);
|
|
193
|
+
expect(guards.length).toBe(hovers.length);
|
|
194
|
+
// Other pseudo-classes are untouched: a disabled control can still be
|
|
195
|
+
// focused (that is the point of aria-disabled), and :focus-visible on it
|
|
196
|
+
// is correct.
|
|
197
|
+
const focusRule = hoverRules.find(rule => rule.includes(':focus-visible'));
|
|
198
|
+
expect(focusRule).toContain('.astryx-button:focus-visible {');
|
|
199
|
+
expect(focusRule).not.toContain('aria-disabled');
|
|
200
|
+
});
|
|
201
|
+
|
|
163
202
|
// --- Prose rules ---
|
|
164
203
|
|
|
165
204
|
it('includes prose heading rules with computed values', () => {
|
|
@@ -584,3 +623,82 @@ describe('brutalist-style derived expansion', () => {
|
|
|
584
623
|
expect(rule).toContain('--_dropdown-menu-padding: 4px');
|
|
585
624
|
});
|
|
586
625
|
});
|
|
626
|
+
|
|
627
|
+
describe('physical padding longhands', () => {
|
|
628
|
+
const ruleFor = (
|
|
629
|
+
component: string,
|
|
630
|
+
base: Record<string, string>,
|
|
631
|
+
name = 'test-physical-padding',
|
|
632
|
+
) =>
|
|
633
|
+
generateThemeRules(
|
|
634
|
+
defineTheme({name, components: {[component]: {base}}}),
|
|
635
|
+
).find(r => r.includes(`.astryx-${component}`));
|
|
636
|
+
|
|
637
|
+
// `padding-top`/`padding-bottom` ARE the block edges in every horizontal
|
|
638
|
+
// writing mode, so the expansion can normalize them with no direction
|
|
639
|
+
// assumption. Without that, the padding lands raw on the element and the
|
|
640
|
+
// component's internals — the NumberInput stepper column, container bleed —
|
|
641
|
+
// read the default instead of what the theme set.
|
|
642
|
+
it.each([
|
|
643
|
+
['paddingTop', {paddingTop: '14px'}, 'block-start'],
|
|
644
|
+
['paddingBottom', {paddingBottom: '14px'}, 'block-end'],
|
|
645
|
+
])('routes %s through the container expansion', (_label, base, edge) => {
|
|
646
|
+
const rule = ruleFor('card', base);
|
|
647
|
+
expect(rule).toContain(`--astryx-card-padding-${edge}: 14px`);
|
|
648
|
+
expect(rule).not.toMatch(/[{;]\s*padding-(top|bottom):/);
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
it('normalizes both block edges together, asymmetrically', () => {
|
|
652
|
+
const rule = ruleFor('number-input', {
|
|
653
|
+
paddingTop: '14px',
|
|
654
|
+
paddingBottom: '6px',
|
|
655
|
+
});
|
|
656
|
+
expect(rule).toContain('--astryx-number-input-padding-block-start: 14px');
|
|
657
|
+
expect(rule).toContain('--astryx-number-input-padding-block-end: 6px');
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
it.each(['card', 'dialog', 'section', 'number-input'])(
|
|
661
|
+
'reaches %s, which expands its padding',
|
|
662
|
+
component => {
|
|
663
|
+
expect(ruleFor(component, {paddingTop: '14px'})).toContain(
|
|
664
|
+
`--astryx-${component}-padding-block-start: 14px`,
|
|
665
|
+
);
|
|
666
|
+
},
|
|
667
|
+
);
|
|
668
|
+
|
|
669
|
+
// THE RTL GUARD. `paddingLeft` is inline-start in LTR and inline-end in RTL,
|
|
670
|
+
// and the tokens are consumed by logical properties, so mapping it would
|
|
671
|
+
// silently move the padding to the other edge in RTL. It stays physical —
|
|
672
|
+
// which is what the author wrote — and does not reach the tokens.
|
|
673
|
+
it('leaves the direction-relative inline pair physical', () => {
|
|
674
|
+
const rule = ruleFor('card', {paddingLeft: '20px', paddingRight: '8px'});
|
|
675
|
+
expect(rule).toContain('padding-left: 20px');
|
|
676
|
+
expect(rule).toContain('padding-right: 8px');
|
|
677
|
+
expect(rule).not.toContain('--astryx-card-padding-inline');
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
it('expands the block edges while leaving left physical', () => {
|
|
681
|
+
const rule = ruleFor('card', {paddingTop: '14px', paddingLeft: '20px'});
|
|
682
|
+
expect(rule).toContain('--astryx-card-padding-block-start: 14px');
|
|
683
|
+
expect(rule).toContain('padding-left: 20px');
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
// The shorthand-plus-override case was the worst one: the tokens carried
|
|
687
|
+
// 10px while the element painted 14px on top, so every internal compensated
|
|
688
|
+
// by the wrong amount.
|
|
689
|
+
it('lets a physical longhand override the shorthand per edge', () => {
|
|
690
|
+
const rule = ruleFor('card', {padding: '10px', paddingTop: '14px'});
|
|
691
|
+
expect(rule).toContain('--astryx-card-padding-block-start: 14px');
|
|
692
|
+
expect(rule).toContain('--astryx-card-padding-block-end: 10px');
|
|
693
|
+
expect(rule).toContain('--astryx-card-padding-inline: 10px');
|
|
694
|
+
expect(rule).not.toMatch(/[{;]\s*padding(-top)?:/);
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
// A `vars` entry carries one value for the whole box, so a single physical
|
|
698
|
+
// edge must not feed it — only the container expansion takes these.
|
|
699
|
+
it('does not feed a single edge to a whole-box derived var', () => {
|
|
700
|
+
const rule = ruleFor('dropdown-menu', {paddingTop: '14px'});
|
|
701
|
+
expect(rule).toContain('padding-top: 14px');
|
|
702
|
+
expect(rule).not.toContain('--_dropdown-menu-padding');
|
|
703
|
+
});
|
|
704
|
+
});
|
|
@@ -46,12 +46,30 @@ function componentClassSelector(component: string, suffix: string): string {
|
|
|
46
46
|
return `.${classPrefix}-${component}${suffix}`;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Guard appended to a themed `:hover` rule so it cannot match a disabled
|
|
51
|
+
* element.
|
|
52
|
+
*
|
|
53
|
+
* A theme authoring `':hover': {backgroundColor: …}` is describing the
|
|
54
|
+
* enabled control; `:hover` on its own would paint that background on a
|
|
55
|
+
* disabled one too, because browsers suppress a disabled control's events,
|
|
56
|
+
* not its hover styling. `:where()` contributes no specificity, so a themed
|
|
57
|
+
* hover rule still weighs exactly what it weighed before.
|
|
58
|
+
*
|
|
59
|
+
* Mirrors the `@astryx/no-hover-on-disabled` lint rule, which enforces the
|
|
60
|
+
* same guard on the components' own StyleX styles.
|
|
61
|
+
*/
|
|
62
|
+
const HOVER_DISABLED_GUARD = ':where(:not(:disabled,[aria-disabled="true"]))';
|
|
63
|
+
|
|
49
64
|
/**
|
|
50
65
|
* Append a pseudo-class to every selector in a comma-separated selector list.
|
|
51
66
|
*
|
|
52
67
|
* Selector helpers may emit comma-separated lists. CSS does not distribute a
|
|
53
68
|
* trailing pseudo over selector lists, so `${list}:hover` would only target the
|
|
54
69
|
* final selector. Rewrite each item so the pseudo applies to all of them.
|
|
70
|
+
*
|
|
71
|
+
* A `:hover` pseudo also picks up the disabled guard. A pseudo-ELEMENT has to
|
|
72
|
+
* end the selector, so the guard is spliced in before it.
|
|
55
73
|
*/
|
|
56
74
|
function appendPseudoToSelectorList(selector: string, pseudo: string): string {
|
|
57
75
|
const parts: string[] = [];
|
|
@@ -71,7 +89,22 @@ function appendPseudoToSelectorList(selector: string, pseudo: string): string {
|
|
|
71
89
|
}
|
|
72
90
|
parts.push(selector.slice(start).trim());
|
|
73
91
|
|
|
74
|
-
|
|
92
|
+
const guarded = guardHoverPseudo(pseudo);
|
|
93
|
+
|
|
94
|
+
return parts.map(part => `${part}${guarded}`).join(', ');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Insert the disabled guard into a `:hover` pseudo, keeping any pseudo-element last. */
|
|
98
|
+
function guardHoverPseudo(pseudo: string): string {
|
|
99
|
+
if (!/^:hover(?![-\w])/.test(pseudo) || pseudo.includes('[aria-disabled')) {
|
|
100
|
+
return pseudo;
|
|
101
|
+
}
|
|
102
|
+
const pseudoElement = pseudo.indexOf('::');
|
|
103
|
+
return pseudoElement === -1
|
|
104
|
+
? pseudo + HOVER_DISABLED_GUARD
|
|
105
|
+
: pseudo.slice(0, pseudoElement) +
|
|
106
|
+
HOVER_DISABLED_GUARD +
|
|
107
|
+
pseudo.slice(pseudoElement);
|
|
75
108
|
}
|
|
76
109
|
|
|
77
110
|
// =============================================================================
|
|
@@ -128,6 +161,34 @@ const PADDING_PROPS = new Set([
|
|
|
128
161
|
'paddingInlineEnd',
|
|
129
162
|
]);
|
|
130
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Physical block-axis longhands, and the logical longhand each one *is* in
|
|
166
|
+
* every horizontal writing mode. Normalizing them costs no direction
|
|
167
|
+
* assumption, which is why they can join the container expansion.
|
|
168
|
+
*
|
|
169
|
+
* `paddingLeft`/`paddingRight` are deliberately absent. They are
|
|
170
|
+
* direction-relative — left is inline-start in LTR and inline-end in RTL — and
|
|
171
|
+
* the expansion's tokens are consumed by logical properties, so mapping them
|
|
172
|
+
* would put the padding on the opposite edge in RTL. They keep their physical
|
|
173
|
+
* meaning and land on the element as `padding-left`/`padding-right`; the cost
|
|
174
|
+
* is that a component's internals cannot see them.
|
|
175
|
+
*/
|
|
176
|
+
const PHYSICAL_BLOCK_PADDING_PROPS: Record<string, string> = {
|
|
177
|
+
paddingTop: 'paddingBlockStart',
|
|
178
|
+
paddingBottom: 'paddingBlockEnd',
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Every padding spelling the container expansion consumes. Kept separate from
|
|
183
|
+
* PADDING_PROPS, which also routes longhands to `vars`-style derived entries —
|
|
184
|
+
* those carry one value for the whole box, so a single physical edge must not
|
|
185
|
+
* reach them.
|
|
186
|
+
*/
|
|
187
|
+
const CONTAINER_PADDING_PROPS = new Set([
|
|
188
|
+
...PADDING_PROPS,
|
|
189
|
+
...Object.keys(PHYSICAL_BLOCK_PADDING_PROPS),
|
|
190
|
+
]);
|
|
191
|
+
|
|
131
192
|
interface ParsedPadding {
|
|
132
193
|
blockStart?: string;
|
|
133
194
|
blockEnd?: string;
|
|
@@ -138,12 +199,14 @@ interface ParsedPadding {
|
|
|
138
199
|
|
|
139
200
|
/**
|
|
140
201
|
* Parse CSS padding shorthand/longhand into block/inline values.
|
|
141
|
-
* Supports 1-3 value shorthands and
|
|
202
|
+
* Supports 1-3 value shorthands, logical properties, and the physical block
|
|
203
|
+
* longhands normalized by PHYSICAL_BLOCK_PADDING_PROPS.
|
|
142
204
|
*/
|
|
143
205
|
function parsePadding(props: [string, string][]): ParsedPadding {
|
|
144
206
|
const result: ParsedPadding = {};
|
|
145
207
|
|
|
146
|
-
for (const [
|
|
208
|
+
for (const [rawProp, value] of props) {
|
|
209
|
+
const prop = PHYSICAL_BLOCK_PADDING_PROPS[rawProp] ?? rawProp;
|
|
147
210
|
switch (prop) {
|
|
148
211
|
case 'padding': {
|
|
149
212
|
const parts = value.trim().split(/\s+/);
|
|
@@ -377,13 +440,28 @@ function generateComponentRules(
|
|
|
377
440
|
}
|
|
378
441
|
}
|
|
379
442
|
}
|
|
443
|
+
// A physical block longhand reaches the container expansion only. It
|
|
444
|
+
// names one edge, so it must not feed a `vars` entry above, which
|
|
445
|
+
// carries the padding for the whole box.
|
|
446
|
+
if (
|
|
447
|
+
prop in PHYSICAL_BLOCK_PADDING_PROPS &&
|
|
448
|
+
getDerivedVars(component, 'padding').some(
|
|
449
|
+
e => e.expand === 'container',
|
|
450
|
+
)
|
|
451
|
+
) {
|
|
452
|
+
containerExpanded = true;
|
|
453
|
+
}
|
|
380
454
|
}
|
|
381
455
|
|
|
382
456
|
// Container padding expansion: replace padding props with
|
|
383
457
|
// component-scoped container tokens for layout integration.
|
|
384
458
|
if (containerExpanded) {
|
|
385
|
-
const paddingProps = props.filter(([p]) =>
|
|
386
|
-
|
|
459
|
+
const paddingProps = props.filter(([p]) =>
|
|
460
|
+
CONTAINER_PADDING_PROPS.has(p),
|
|
461
|
+
);
|
|
462
|
+
const nonPaddingProps = props.filter(
|
|
463
|
+
([p]) => !CONTAINER_PADDING_PROPS.has(p),
|
|
464
|
+
);
|
|
387
465
|
const parsed = parsePadding(paddingProps);
|
|
388
466
|
const containerTokens = expandContainerPadding(component, parsed);
|
|
389
467
|
finalProps = [...nonPaddingProps, ...containerTokens];
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* @file syntax/index.ts
|
|
7
5
|
* @position Re-exports for the syntax theme subsystem
|
|
6
|
+
*
|
|
7
|
+
* No `'use client'` here on purpose. Most of what this barrel exports is data
|
|
8
|
+
* (presets, token defaults) or pure functions, and a directive on the barrel
|
|
9
|
+
* turns every export into a client reference for a server importer — so
|
|
10
|
+
* `dracula.tokens` reads back `undefined` instead of colors. `SyntaxTheme.tsx`
|
|
11
|
+
* carries its own directive, which is what the provider actually needs.
|
|
8
12
|
*/
|
|
9
13
|
|
|
10
14
|
export {syntaxTokenDefaults} from './tokens';
|