@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
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* SYNC: When DateRangeInput.tsx changes, update tests to match new behavior
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import {describe, it, expect, vi, beforeEach} from 'vitest';
|
|
12
|
+
import {describe, it, expect, vi, beforeEach, afterEach} from 'vitest';
|
|
13
13
|
import {render, screen, fireEvent, waitFor} from '@testing-library/react';
|
|
14
14
|
import userEvent from '@testing-library/user-event';
|
|
15
15
|
|
|
@@ -712,3 +712,83 @@ describe('DateRangeInput disabled theme state', () => {
|
|
|
712
712
|
expect(root).not.toHaveAttribute('data-disabled');
|
|
713
713
|
});
|
|
714
714
|
});
|
|
715
|
+
|
|
716
|
+
describe('DateRangeInput range-span forwarding', () => {
|
|
717
|
+
// Pin "today" so the popover opens on a known month and the day buttons we
|
|
718
|
+
// query are guaranteed to render.
|
|
719
|
+
beforeEach(() => {
|
|
720
|
+
vi.useFakeTimers();
|
|
721
|
+
vi.setSystemTime(new Date('2026-01-05T12:00:00Z'));
|
|
722
|
+
});
|
|
723
|
+
afterEach(() => {
|
|
724
|
+
vi.useRealTimers();
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
// The calendar renders in the top layer; jsdom keeps day buttons in the DOM
|
|
728
|
+
// but role queries skip them, so reach them by their machine-readable
|
|
729
|
+
// data-date (ISO) attribute — the same approach Calendar's own tests use.
|
|
730
|
+
const dayButton = (iso: string): HTMLButtonElement | null =>
|
|
731
|
+
document.querySelector<HTMLButtonElement>(`button[data-date="${iso}"]`);
|
|
732
|
+
|
|
733
|
+
it('forwards maxRangeSpan so the window caps after a start is picked', () => {
|
|
734
|
+
render(
|
|
735
|
+
<DateRangeInput
|
|
736
|
+
label="Reporting period"
|
|
737
|
+
value={null}
|
|
738
|
+
onChange={() => {}}
|
|
739
|
+
maxRangeSpan={7}
|
|
740
|
+
/>,
|
|
741
|
+
);
|
|
742
|
+
|
|
743
|
+
fireEvent.click(getButton('Open calendar'));
|
|
744
|
+
|
|
745
|
+
// Before a start is picked, a far-off day is selectable.
|
|
746
|
+
expect(dayButton('2026-01-20')).not.toBeDisabled();
|
|
747
|
+
|
|
748
|
+
fireEvent.click(dayButton('2026-01-10') as HTMLButtonElement);
|
|
749
|
+
|
|
750
|
+
// A 7-day window spans start ± 6 days: Jan 16 is the edge, Jan 17 is out.
|
|
751
|
+
expect(dayButton('2026-01-16')).not.toBeDisabled();
|
|
752
|
+
expect(dayButton('2026-01-17')).toBeDisabled();
|
|
753
|
+
});
|
|
754
|
+
|
|
755
|
+
it('disables a preset whose range violates the span cap', () => {
|
|
756
|
+
const presets = [
|
|
757
|
+
{
|
|
758
|
+
label: 'Last 3 days',
|
|
759
|
+
getRange: (): DateRange => ({
|
|
760
|
+
start: '2026-01-08',
|
|
761
|
+
end: '2026-01-10',
|
|
762
|
+
}),
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
label: 'Last 30 days',
|
|
766
|
+
getRange: (): DateRange => ({
|
|
767
|
+
start: '2025-12-12',
|
|
768
|
+
end: '2026-01-10',
|
|
769
|
+
}),
|
|
770
|
+
},
|
|
771
|
+
];
|
|
772
|
+
const handleChange = vi.fn();
|
|
773
|
+
render(
|
|
774
|
+
<DateRangeInput
|
|
775
|
+
label="Reporting period"
|
|
776
|
+
value={null}
|
|
777
|
+
onChange={handleChange}
|
|
778
|
+
maxRangeSpan={7}
|
|
779
|
+
presets={presets}
|
|
780
|
+
/>,
|
|
781
|
+
);
|
|
782
|
+
|
|
783
|
+
fireEvent.click(getButton('Open calendar'));
|
|
784
|
+
|
|
785
|
+
// The 3-day preset fits the 7-day cap; the 30-day preset can't be committed.
|
|
786
|
+
const withinCap = getButton('Last 3 days');
|
|
787
|
+
const overCap = getButton('Last 30 days');
|
|
788
|
+
expect(withinCap).not.toBeDisabled();
|
|
789
|
+
expect(overCap).toBeDisabled();
|
|
790
|
+
|
|
791
|
+
fireEvent.click(overCap);
|
|
792
|
+
expect(handleChange).not.toHaveBeenCalled();
|
|
793
|
+
});
|
|
794
|
+
});
|
|
@@ -16,12 +16,20 @@
|
|
|
16
16
|
* - /packages/cli/assets/templates/blocks/components/DateRangeInput/ (showcase blocks)
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
use,
|
|
21
|
+
useId,
|
|
22
|
+
useCallback,
|
|
23
|
+
useMemo,
|
|
24
|
+
useOptimistic,
|
|
25
|
+
useTransition,
|
|
26
|
+
} from 'react';
|
|
20
27
|
import * as stylex from '@stylexjs/stylex';
|
|
21
28
|
import {
|
|
22
29
|
plainDateFromISO,
|
|
23
30
|
plainDateToday,
|
|
24
31
|
plainDateFormat,
|
|
32
|
+
plainDateDiffDays,
|
|
25
33
|
DATE_FORMAT_SHORT,
|
|
26
34
|
DATE_FORMAT_SHORT_WITH_YEAR,
|
|
27
35
|
} from '../utils/plainDate';
|
|
@@ -60,10 +68,12 @@ import type {BaseProps} from '../BaseProps';
|
|
|
60
68
|
import type {SizeValue} from '../utils/types';
|
|
61
69
|
import {useSize} from '../SizeContext/SizeContext';
|
|
62
70
|
import {useInputStatusIcon} from '../hooks/useInputStatusIcon';
|
|
71
|
+
import {useResolvedRequired} from '../hooks/useResolvedRequired';
|
|
63
72
|
import {themeProps} from '../utils/themeProps';
|
|
64
73
|
import {focusOutlineStyles} from '../utils/focusOutline.stylex';
|
|
65
74
|
import {stableClassName} from '../naming';
|
|
66
|
-
import {useTranslator} from '../i18n';
|
|
75
|
+
import {useTranslator, InternationalizationContext} from '../i18n';
|
|
76
|
+
import type {Locale} from '../i18n/types';
|
|
67
77
|
|
|
68
78
|
export type {DateRange} from '../Calendar';
|
|
69
79
|
|
|
@@ -146,7 +156,7 @@ const styles = stylex.create({
|
|
|
146
156
|
borderRadius: radiusVars['--radius-element'],
|
|
147
157
|
backgroundColor: {
|
|
148
158
|
default: 'transparent',
|
|
149
|
-
':hover': {
|
|
159
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
150
160
|
'@media (hover: hover)': colorVars['--color-overlay-hover'],
|
|
151
161
|
},
|
|
152
162
|
},
|
|
@@ -161,6 +171,11 @@ const styles = stylex.create({
|
|
|
161
171
|
backgroundColor: colorVars['--color-accent-muted'],
|
|
162
172
|
color: colorVars['--color-accent'],
|
|
163
173
|
},
|
|
174
|
+
presetButtonDisabled: {
|
|
175
|
+
color: colorVars['--color-text-disabled'],
|
|
176
|
+
cursor: 'not-allowed',
|
|
177
|
+
backgroundColor: 'transparent',
|
|
178
|
+
},
|
|
164
179
|
});
|
|
165
180
|
|
|
166
181
|
const sizeStyles = stylex.create({
|
|
@@ -178,7 +193,7 @@ const sizeStyles = stylex.create({
|
|
|
178
193
|
},
|
|
179
194
|
});
|
|
180
195
|
|
|
181
|
-
function formatRangeDisplay(range: DateRange | null): string {
|
|
196
|
+
function formatRangeDisplay(range: DateRange | null, locale?: Locale): string {
|
|
182
197
|
if (!range) {
|
|
183
198
|
return '';
|
|
184
199
|
}
|
|
@@ -188,7 +203,7 @@ function formatRangeDisplay(range: DateRange | null): string {
|
|
|
188
203
|
const sameYear = start.year === end.year && start.year === currentYear;
|
|
189
204
|
|
|
190
205
|
const fmt = sameYear ? DATE_FORMAT_SHORT : DATE_FORMAT_SHORT_WITH_YEAR;
|
|
191
|
-
return `${plainDateFormat(start, fmt)} – ${plainDateFormat(end, fmt)}`;
|
|
206
|
+
return `${plainDateFormat(start, fmt, locale)} – ${plainDateFormat(end, fmt, locale)}`;
|
|
192
207
|
}
|
|
193
208
|
|
|
194
209
|
function isRangeEqual(a: DateRange | null, b: DateRange | null): boolean {
|
|
@@ -201,6 +216,34 @@ function isRangeEqual(a: DateRange | null, b: DateRange | null): boolean {
|
|
|
201
216
|
return a.start === b.start && a.end === b.end;
|
|
202
217
|
}
|
|
203
218
|
|
|
219
|
+
// A preset that would land outside the span bounds is disabled rather than
|
|
220
|
+
// allowed to override them: the cap is authoritative, so an out-of-window
|
|
221
|
+
// preset stays visible (discoverable) but non-committable, mirroring how the
|
|
222
|
+
// calendar disables out-of-window days. Spans count both endpoints.
|
|
223
|
+
function isRangeWithinSpan(
|
|
224
|
+
range: DateRange,
|
|
225
|
+
maxRangeSpan: number | undefined,
|
|
226
|
+
minRangeSpan: number | undefined,
|
|
227
|
+
): boolean {
|
|
228
|
+
if (maxRangeSpan == null && minRangeSpan == null) {
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
const span =
|
|
232
|
+
Math.abs(
|
|
233
|
+
plainDateDiffDays(
|
|
234
|
+
plainDateFromISO(range.start),
|
|
235
|
+
plainDateFromISO(range.end),
|
|
236
|
+
),
|
|
237
|
+
) + 1;
|
|
238
|
+
if (maxRangeSpan != null && span > maxRangeSpan) {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
if (minRangeSpan != null && span < minRangeSpan) {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
|
|
204
247
|
export interface DateRangeInputProps extends Omit<
|
|
205
248
|
BaseProps,
|
|
206
249
|
'onChange' | 'defaultValue'
|
|
@@ -303,6 +346,30 @@ export interface DateRangeInputProps extends Omit<
|
|
|
303
346
|
*/
|
|
304
347
|
dateConstraints?: ReadonlyArray<(date: Date) => boolean>;
|
|
305
348
|
|
|
349
|
+
/**
|
|
350
|
+
* Maximum number of days the selected range may span, counting both
|
|
351
|
+
* endpoints — `maxRangeSpan={7}` allows a 7-day window (start + 6 days).
|
|
352
|
+
* Once a start date is picked, days beyond this distance from it are
|
|
353
|
+
* disabled, so the user can't stretch the range past the cap. Use for
|
|
354
|
+
* rolling windows like "at most a week from the chosen day"; for fixed
|
|
355
|
+
* calendar bounds use `min`/`max`.
|
|
356
|
+
*
|
|
357
|
+
* This constrains selection only — it never rewrites a `value` that is
|
|
358
|
+
* already wider than the cap. Surface such a value with `status` if you
|
|
359
|
+
* need to flag it. A `preset` whose range violates the cap is disabled
|
|
360
|
+
* (shown but not committable) rather than allowed to override it.
|
|
361
|
+
*/
|
|
362
|
+
maxRangeSpan?: number;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Minimum number of days the selected range must span, counting both
|
|
366
|
+
* endpoints — `minRangeSpan={2}` forbids a single-day range. Once a start
|
|
367
|
+
* date is picked, days closer than this to it are disabled — except the
|
|
368
|
+
* start itself, which stays selectable as the active anchor. Defaults to 1
|
|
369
|
+
* (a same-day start and end is allowed).
|
|
370
|
+
*/
|
|
371
|
+
minRangeSpan?: number;
|
|
372
|
+
|
|
306
373
|
/**
|
|
307
374
|
* Preset date ranges shown as quick-select options beside the calendar.
|
|
308
375
|
*/
|
|
@@ -396,6 +463,8 @@ export function DateRangeInput({
|
|
|
396
463
|
min,
|
|
397
464
|
max,
|
|
398
465
|
dateConstraints,
|
|
466
|
+
maxRangeSpan,
|
|
467
|
+
minRangeSpan,
|
|
399
468
|
presets,
|
|
400
469
|
hasClear = true,
|
|
401
470
|
placeholder: placeholderFromProps,
|
|
@@ -413,6 +482,8 @@ export function DateRangeInput({
|
|
|
413
482
|
...rest
|
|
414
483
|
}: DateRangeInputProps) {
|
|
415
484
|
const t = useTranslator();
|
|
485
|
+
const isEffectivelyRequired = useResolvedRequired({isRequired, isOptional});
|
|
486
|
+
const {locale} = use(InternationalizationContext);
|
|
416
487
|
const placeholder =
|
|
417
488
|
placeholderFromProps ?? t('@astryx.dateRangeInput.placeholder');
|
|
418
489
|
const size = useSize(sizeProp, 'md');
|
|
@@ -459,8 +530,8 @@ export function DateRangeInput({
|
|
|
459
530
|
.join(' ') || undefined;
|
|
460
531
|
|
|
461
532
|
const displayValue = useMemo(
|
|
462
|
-
() => formatRangeDisplay(optimisticValue),
|
|
463
|
-
[optimisticValue],
|
|
533
|
+
() => formatRangeDisplay(optimisticValue, locale),
|
|
534
|
+
[optimisticValue, locale],
|
|
464
535
|
);
|
|
465
536
|
|
|
466
537
|
const popover = usePopover({
|
|
@@ -609,7 +680,7 @@ export function DateRangeInput({
|
|
|
609
680
|
aria-disabled={showsDisabledMessage ? 'true' : undefined}
|
|
610
681
|
aria-label={triggerAriaLabel}
|
|
611
682
|
aria-describedby={ariaDescribedBy}
|
|
612
|
-
aria-required={
|
|
683
|
+
aria-required={isEffectivelyRequired ? 'true' : undefined}
|
|
613
684
|
aria-invalid={status?.type === 'error' ? 'true' : undefined}
|
|
614
685
|
aria-busy={isBusy || undefined}
|
|
615
686
|
aria-expanded={popover.isOpen}
|
|
@@ -642,6 +713,11 @@ export function DateRangeInput({
|
|
|
642
713
|
{presets.map(preset => {
|
|
643
714
|
const presetRange = preset.getRange();
|
|
644
715
|
const isActive = isRangeEqual(value, presetRange);
|
|
716
|
+
const isPresetDisabled = !isRangeWithinSpan(
|
|
717
|
+
presetRange,
|
|
718
|
+
maxRangeSpan,
|
|
719
|
+
minRangeSpan,
|
|
720
|
+
);
|
|
645
721
|
return (
|
|
646
722
|
<button
|
|
647
723
|
key={preset.label}
|
|
@@ -652,11 +728,13 @@ export function DateRangeInput({
|
|
|
652
728
|
// marked with aria-current (not aria-selected, a listbox
|
|
653
729
|
// concept that contradicted the Tab interaction) (forms-5).
|
|
654
730
|
aria-current={isActive ? 'true' : undefined}
|
|
731
|
+
disabled={isPresetDisabled}
|
|
655
732
|
onClick={() => handlePresetClick(preset)}
|
|
656
733
|
{...stylex.props(
|
|
657
734
|
focusOutlineStyles.focusVisible,
|
|
658
735
|
styles.presetButton,
|
|
659
736
|
isActive && styles.presetButtonActive,
|
|
737
|
+
isPresetDisabled && styles.presetButtonDisabled,
|
|
660
738
|
)}>
|
|
661
739
|
{preset.label}
|
|
662
740
|
</button>
|
|
@@ -671,6 +749,8 @@ export function DateRangeInput({
|
|
|
671
749
|
min={min}
|
|
672
750
|
max={max}
|
|
673
751
|
dateConstraints={dateConstraints}
|
|
752
|
+
maxRangeSpan={maxRangeSpan}
|
|
753
|
+
minRangeSpan={minRangeSpan}
|
|
674
754
|
numberOfMonths={numberOfMonths}
|
|
675
755
|
weekStartsOn={weekStartsOn}
|
|
676
756
|
/>
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import {
|
|
20
|
+
use,
|
|
20
21
|
useId,
|
|
21
22
|
useState,
|
|
22
23
|
useCallback,
|
|
@@ -84,10 +85,11 @@ import {
|
|
|
84
85
|
import type {BaseProps} from '../BaseProps';
|
|
85
86
|
import type {SizeValue} from '../utils/types';
|
|
86
87
|
import {useAnnounce} from '../hooks/useAnnounce';
|
|
88
|
+
import {useResolvedRequired} from '../hooks/useResolvedRequired';
|
|
87
89
|
import {useSize} from '../SizeContext/SizeContext';
|
|
88
90
|
import {themeProps} from '../utils/themeProps';
|
|
89
91
|
import {focusOutlineStyles} from '../utils/focusOutline.stylex';
|
|
90
|
-
import {useTranslator} from '../i18n';
|
|
92
|
+
import {useTranslator, InternationalizationContext} from '../i18n';
|
|
91
93
|
|
|
92
94
|
export type ISODateTimeString = string & {
|
|
93
95
|
readonly __brand: 'ISODateTimeString';
|
|
@@ -448,6 +450,8 @@ export function DateTimeInput({
|
|
|
448
450
|
...rest
|
|
449
451
|
}: DateTimeInputProps) {
|
|
450
452
|
const t = useTranslator();
|
|
453
|
+
const isEffectivelyRequired = useResolvedRequired({isRequired, isOptional});
|
|
454
|
+
const {locale} = use(InternationalizationContext);
|
|
451
455
|
// Speaks arrow-key stepping results through the persistent live regions:
|
|
452
456
|
// stepping programmatically rewrites a plain textbox's value, which screen
|
|
453
457
|
// readers do not announce on their own (WCAG 4.1.2).
|
|
@@ -558,13 +562,17 @@ export function DateTimeInput({
|
|
|
558
562
|
datePendingInput !== null
|
|
559
563
|
? datePendingInput
|
|
560
564
|
: valueParts.date && /^\d{4}-\d{2}-\d{2}$/.test(valueParts.date)
|
|
561
|
-
? plainDateFormat(
|
|
565
|
+
? plainDateFormat(
|
|
566
|
+
plainDateFromISO(valueParts.date),
|
|
567
|
+
DATE_FORMAT_LONG,
|
|
568
|
+
locale,
|
|
569
|
+
)
|
|
562
570
|
: '';
|
|
563
571
|
|
|
564
572
|
const isDateInputValid =
|
|
565
573
|
datePendingInput === null || !datePendingInput.trim()
|
|
566
574
|
? true
|
|
567
|
-
: parseDateInput(datePendingInput) !== null;
|
|
575
|
+
: parseDateInput(datePendingInput, locale) !== null;
|
|
568
576
|
|
|
569
577
|
// --- Time input state ---
|
|
570
578
|
const [timePendingInput, setTimePendingInput] = useState<string | null>(null);
|
|
@@ -692,7 +700,7 @@ export function DateTimeInput({
|
|
|
692
700
|
const text = e.target.value;
|
|
693
701
|
setDatePendingInput(text);
|
|
694
702
|
|
|
695
|
-
const parsed = parseDateInput(text);
|
|
703
|
+
const parsed = parseDateInput(text, locale);
|
|
696
704
|
if (
|
|
697
705
|
parsed &&
|
|
698
706
|
plainDateToISO(parsed) !== valueParts.date &&
|
|
@@ -704,7 +712,13 @@ export function DateTimeInput({
|
|
|
704
712
|
calendarRef.current?.navigateTo(parsedISO);
|
|
705
713
|
}
|
|
706
714
|
},
|
|
707
|
-
[
|
|
715
|
+
[
|
|
716
|
+
valueParts.date,
|
|
717
|
+
isDateDisabled,
|
|
718
|
+
handleDateChange,
|
|
719
|
+
isEffectivelyDisabled,
|
|
720
|
+
locale,
|
|
721
|
+
],
|
|
708
722
|
);
|
|
709
723
|
|
|
710
724
|
const commitDatePendingInput = useCallback(() => {
|
|
@@ -720,7 +734,7 @@ export function DateTimeInput({
|
|
|
720
734
|
return;
|
|
721
735
|
}
|
|
722
736
|
|
|
723
|
-
const parsed = parseDateInput(datePendingInput);
|
|
737
|
+
const parsed = parseDateInput(datePendingInput, locale);
|
|
724
738
|
if (parsed && !isDateDisabled(parsed)) {
|
|
725
739
|
const parsedISO = plainDateToISO(parsed);
|
|
726
740
|
if (parsedISO !== valueParts.date) {
|
|
@@ -735,6 +749,7 @@ export function DateTimeInput({
|
|
|
735
749
|
fireChange,
|
|
736
750
|
isDateDisabled,
|
|
737
751
|
handleDateChange,
|
|
752
|
+
locale,
|
|
738
753
|
]);
|
|
739
754
|
|
|
740
755
|
const handleDateBlur = useCallback(() => {
|
|
@@ -1009,7 +1024,7 @@ export function DateTimeInput({
|
|
|
1009
1024
|
aria-disabled={showsDisabledMessage ? 'true' : undefined}
|
|
1010
1025
|
readOnly={showsDisabledMessage || undefined}
|
|
1011
1026
|
aria-describedby={ariaDescribedBy}
|
|
1012
|
-
aria-required={
|
|
1027
|
+
aria-required={isEffectivelyRequired ? 'true' : undefined}
|
|
1013
1028
|
aria-invalid={
|
|
1014
1029
|
status?.type === 'error' || !isDateInputValid ? 'true' : undefined
|
|
1015
1030
|
}
|
|
@@ -1098,7 +1113,7 @@ export function DateTimeInput({
|
|
|
1098
1113
|
timeLabel ?? t('@astryx.dateTimeInput.timeSuffix', {label})
|
|
1099
1114
|
}
|
|
1100
1115
|
aria-describedby={ariaDescribedBy}
|
|
1101
|
-
aria-required={
|
|
1116
|
+
aria-required={isEffectivelyRequired ? 'true' : undefined}
|
|
1102
1117
|
aria-invalid={
|
|
1103
1118
|
status?.type === 'error' || !isTimeInputValid ? 'true' : undefined
|
|
1104
1119
|
}
|
|
@@ -461,4 +461,28 @@ describe('Dialog', () => {
|
|
|
461
461
|
before.remove();
|
|
462
462
|
});
|
|
463
463
|
});
|
|
464
|
+
|
|
465
|
+
describe('container padding isolation', () => {
|
|
466
|
+
it('resets container padding custom properties on the root dialog element', () => {
|
|
467
|
+
render(
|
|
468
|
+
<Dialog isOpen={true} onOpenChange={() => {}}>
|
|
469
|
+
Content
|
|
470
|
+
</Dialog>,
|
|
471
|
+
);
|
|
472
|
+
const dialog = screen.getByRole('dialog');
|
|
473
|
+
const computed = window.getComputedStyle(dialog);
|
|
474
|
+
expect(
|
|
475
|
+
computed.getPropertyValue('--container-padding-inline-start'),
|
|
476
|
+
).toBe('0px');
|
|
477
|
+
expect(computed.getPropertyValue('--container-padding-inline-end')).toBe(
|
|
478
|
+
'0px',
|
|
479
|
+
);
|
|
480
|
+
expect(computed.getPropertyValue('--container-padding-block-start')).toBe(
|
|
481
|
+
'0px',
|
|
482
|
+
);
|
|
483
|
+
expect(computed.getPropertyValue('--container-padding-block-end')).toBe(
|
|
484
|
+
'0px',
|
|
485
|
+
);
|
|
486
|
+
});
|
|
487
|
+
});
|
|
464
488
|
});
|
package/src/Dialog/Dialog.tsx
CHANGED
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
containerPaddingBlockStartVarStyles,
|
|
45
45
|
containerPaddingBlockEndVarStyles,
|
|
46
46
|
spacingStepToToken,
|
|
47
|
+
overlayPaddingReset,
|
|
47
48
|
} from '../Layout/padding.stylex';
|
|
48
49
|
import type {SpacingStep} from '../utils/types';
|
|
49
50
|
import {mergeProps, mergeRefs} from '../utils';
|
|
@@ -610,6 +611,7 @@ export function Dialog({
|
|
|
610
611
|
themeProps('dialog', {variant}),
|
|
611
612
|
stylex.props(
|
|
612
613
|
styles.inlineWrapper,
|
|
614
|
+
overlayPaddingReset.reset,
|
|
613
615
|
!isFullscreen && dynamicStyles.sizing(width, maxHeight),
|
|
614
616
|
isFullscreen && styles.fullscreen,
|
|
615
617
|
xstyle,
|
|
@@ -636,6 +638,7 @@ export function Dialog({
|
|
|
636
638
|
themeProps('dialog', {variant}),
|
|
637
639
|
focusOutlineProps.focusVisible(
|
|
638
640
|
styles.dialog,
|
|
641
|
+
overlayPaddingReset.reset,
|
|
639
642
|
isOpen && styles.open,
|
|
640
643
|
styles.backdrop,
|
|
641
644
|
!isFullscreen && dynamicStyles.sizing(width, maxHeight),
|
package/src/Field/Field.doc.mjs
CHANGED
|
@@ -34,10 +34,13 @@ export const docs = {
|
|
|
34
34
|
className: 'astryx-input-status-icon',
|
|
35
35
|
visualProps: ['size', 'status'],
|
|
36
36
|
},
|
|
37
|
+
{className: 'astryx-input-clear-button'},
|
|
37
38
|
{className: 'astryx-input-clear-icon'},
|
|
38
39
|
],
|
|
39
40
|
vars: [
|
|
40
41
|
{name: '--_field-radius', description: 'Border radius of input fields', default: 'var(--radius-element)', private: true},
|
|
42
|
+
{name: '--_input-clear-hit-inset', description: 'Outset of the clear (\u2715) button\u2019s invisible hit area, applied to a ::after overlay. 0 on a fine pointer; negative on a coarse one, which grows the 20px button to the 24px touch target without changing what is drawn.', default: '0px', private: true},
|
|
43
|
+
{name: '--_input-clear-hit-content', description: 'Whether the clear (\u2715) button\u2019s invisible hit overlay exists. `none` on a fine pointer, so no ::after is generated and hover still reaches the glyph; `""` on a coarse one, where the overlay provides the 24px touch target.', default: 'none', private: true},
|
|
41
44
|
],
|
|
42
45
|
derived: [
|
|
43
46
|
{property: 'borderRadius', vars: ['--_field-radius']},
|
package/src/Field/FieldLabel.tsx
CHANGED
|
@@ -4,18 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file FieldLabel.tsx
|
|
7
|
-
* @input Uses React, Icon, IconType, useTranslator
|
|
7
|
+
* @input Uses React, Icon, IconType, useTranslator, FormLayoutContext
|
|
8
8
|
* @output Exports FieldLabel component, FieldLabelProps
|
|
9
9
|
* @position Core label implementation; used by Field, CheckboxInput, Switch
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
12
|
* - /packages/core/src/Field/Field.doc.mjs (props table, features, implementation notes)
|
|
13
13
|
* - /packages/core/src/Field/index.ts (exports if types change)
|
|
14
|
+
* - /packages/core/src/FormLayout/FormLayoutContext.ts (defaultOptionality drives the indicator)
|
|
14
15
|
* - /packages/cli/assets/templates/blocks/components/Field/ (showcase blocks)
|
|
15
16
|
* - /packages/core/locales/en.json (@astryx.field.required / @astryx.field.optional)
|
|
16
17
|
*/
|
|
17
18
|
|
|
18
|
-
import {useMemo, useRef, type ReactNode, type RefObject} from 'react';
|
|
19
|
+
import {use, useMemo, useRef, type ReactNode, type RefObject} from 'react';
|
|
19
20
|
import * as stylex from '@stylexjs/stylex';
|
|
20
21
|
import type {BaseProps} from '../BaseProps';
|
|
21
22
|
import {mergeProps} from '../utils';
|
|
@@ -32,6 +33,7 @@ import {Tooltip} from '../Tooltip';
|
|
|
32
33
|
import {useTranslator} from '../i18n';
|
|
33
34
|
import {themeProps} from '../utils/themeProps';
|
|
34
35
|
import {useInputContainer} from '../hooks';
|
|
36
|
+
import {FormLayoutContext} from '../FormLayout/FormLayoutContext';
|
|
35
37
|
|
|
36
38
|
const styles = stylex.create({
|
|
37
39
|
label: {
|
|
@@ -188,9 +190,23 @@ export function FieldLabel({
|
|
|
188
190
|
...rest
|
|
189
191
|
}: FieldLabelProps) {
|
|
190
192
|
const t = useTranslator();
|
|
191
|
-
const
|
|
193
|
+
const {defaultOptionality} = use(FormLayoutContext);
|
|
194
|
+
|
|
195
|
+
// A form-level `defaultOptionality` means "only the exception is marked": a
|
|
196
|
+
// field that merely restates the form's default shows no indicator, and only
|
|
197
|
+
// a deviation from it does. This is the *visible indicator* only; the
|
|
198
|
+
// matching `aria-required` is resolved on each control (see
|
|
199
|
+
// useResolvedRequired) so the unmarked majority is still announced.
|
|
200
|
+
//
|
|
201
|
+
// defaultOptionality isRequired isOptional
|
|
202
|
+
// 'optional' → required indicator → (matches default, hidden)
|
|
203
|
+
// 'required' → (matches, hidden) → optional indicator
|
|
204
|
+
// unset → required indicator → optional indicator
|
|
205
|
+
const showRequired = isRequired && defaultOptionality !== 'required';
|
|
206
|
+
const showOptional = isOptional && defaultOptionality !== 'optional';
|
|
207
|
+
const statusText = showOptional
|
|
192
208
|
? t('@astryx.field.optional')
|
|
193
|
-
:
|
|
209
|
+
: showRequired
|
|
194
210
|
? t('@astryx.field.required')
|
|
195
211
|
: null;
|
|
196
212
|
|