@astryxdesign/core 0.4.4 → 0.4.5-canary.013e728
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/dist/AvatarGroup/AvatarGroupOverflow.js +1 -1
- package/dist/BottomSheet/BottomSheet.d.ts +11 -2
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +4 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts +5 -2
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +65 -15
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/BottomSheet/index.d.ts.map +1 -1
- package/dist/BottomSheet/snapOffsets.d.ts +57 -20
- package/dist/BottomSheet/snapOffsets.d.ts.map +1 -1
- package/dist/BottomSheet/snapOffsets.js +106 -30
- package/dist/BottomSheet/useSheetGestures.d.ts +13 -8
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +160 -64
- package/dist/Breadcrumbs/BreadcrumbItem.js +6 -6
- package/dist/Button/Button.js +5 -5
- package/dist/Calendar/Calendar.d.ts +17 -0
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +55 -15
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts +14 -0
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts.map +1 -0
- package/dist/Calendar/getStandaloneShortWeekdayNames.js +26 -0
- package/dist/Calendar/hooks/useCalendarConstraints.d.ts +22 -1
- package/dist/Calendar/hooks/useCalendarConstraints.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarConstraints.js +26 -4
- package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarDays.js +14 -10
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarNavigation.js +8 -4
- package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts +47 -0
- package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts.map +1 -0
- package/dist/Calendar/standaloneShortWeekdayNames.generated.js +40 -0
- package/dist/Calendar/styles.js +3 -3
- package/dist/Center/Center.d.ts +23 -1
- package/dist/Center/Center.d.ts.map +1 -1
- package/dist/Center/Center.js +12 -6
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +2 -2
- package/dist/Chat/ChatToolCalls.js +1 -1
- package/dist/Chat/useChatDictation.d.ts +1 -1
- package/dist/Chat/useChatDictation.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.d.ts +1 -1
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +4 -3
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +9 -0
- package/dist/Citation/Citation.js +3 -3
- package/dist/ClickableCard/ClickableCard.js +2 -2
- package/dist/CommandPalette/CommandPaletteItem.js +1 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +8 -3
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +17 -9
- package/dist/DateRangeInput/DateRangeInput.d.ts +23 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +47 -9
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +18 -10
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/Field/FieldLabel.d.ts +2 -1
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +21 -3
- package/dist/Field/InputClearButton.d.ts +2 -1
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +12 -1
- package/dist/Field/inputStyles.stylex.d.ts.map +1 -1
- package/dist/Field/inputStyles.stylex.js +4 -4
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +2 -2
- package/dist/FormLayout/FormLayout.d.ts +24 -2
- package/dist/FormLayout/FormLayout.d.ts.map +1 -1
- package/dist/FormLayout/FormLayout.js +7 -2
- package/dist/FormLayout/FormLayoutContext.d.ts +15 -2
- package/dist/FormLayout/FormLayoutContext.d.ts.map +1 -1
- package/dist/FormLayout/FormLayoutContext.js +19 -4
- package/dist/FormLayout/index.d.ts +1 -1
- package/dist/FormLayout/index.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.d.ts +13 -3
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +2 -0
- package/dist/HoverCard/index.d.ts +1 -1
- package/dist/HoverCard/index.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.d.ts +17 -2
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +78 -9
- package/dist/Item/Item.d.ts +9 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +46 -8
- package/dist/Layer/index.d.ts +4 -2
- package/dist/Layer/index.d.ts.map +1 -1
- package/dist/Layer/index.js +2 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +3 -2
- package/dist/Layer/useTouchTrigger.d.ts +113 -0
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -0
- package/dist/Layer/useTouchTrigger.js +241 -0
- package/dist/Layout/container.stylex.d.ts +4 -2
- package/dist/Layout/container.stylex.d.ts.map +1 -1
- package/dist/Layout/container.stylex.js +19 -11
- package/dist/Layout/index.d.ts +1 -0
- package/dist/Layout/index.d.ts.map +1 -1
- package/dist/Layout/index.js +4 -0
- package/dist/Layout/padding.stylex.d.ts +315 -12
- package/dist/Layout/padding.stylex.d.ts.map +1 -1
- package/dist/Layout/padding.stylex.js +389 -12
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +2 -1
- package/dist/Link/Link.js +4 -4
- package/dist/Markdown/Markdown.d.ts +8 -0
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +31 -3
- package/dist/Markdown/parser.d.ts +14 -2
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +50 -2
- package/dist/MobileNav/MobileNav.d.ts +1 -0
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +24 -6
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +8 -3
- package/dist/NavItem/navItemStyles.stylex.d.ts +2 -2
- package/dist/NavItem/navItemStyles.stylex.js +2 -2
- package/dist/NavMenu/NavHeadingMenuItem.js +1 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +38 -5
- package/dist/Outline/Outline.js +2 -2
- package/dist/Outline/parseOutlineFromMarkdown.d.ts +2 -0
- package/dist/Outline/parseOutlineFromMarkdown.d.ts.map +1 -1
- package/dist/Outline/parseOutlineFromMarkdown.js +5 -31
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +11 -12
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +3 -1
- package/dist/PowerSearch/formatFilterValue.d.ts +11 -2
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +23 -8
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +12 -1
- package/dist/RadioList/RadioListItem.d.ts +2 -2
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +68 -38
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +3 -3
- package/dist/Section/Section.d.ts +36 -1
- package/dist/Section/Section.d.ts.map +1 -1
- package/dist/Section/Section.js +12 -2
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +6 -1
- package/dist/SelectableCard/SelectableCard.js +1 -1
- package/dist/Selector/Selector.d.ts +26 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +95 -17
- package/dist/Selector/SelectorOption.d.ts +14 -1
- package/dist/Selector/SelectorOption.d.ts.map +1 -1
- package/dist/Selector/SelectorOption.js +6 -0
- package/dist/Selector/SelectorRowLayoutContext.d.ts +8 -0
- package/dist/Selector/SelectorRowLayoutContext.d.ts.map +1 -0
- package/dist/Selector/SelectorRowLayoutContext.js +27 -0
- package/dist/Selector/types.d.ts +1 -0
- package/dist/Selector/types.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +1 -1
- package/dist/SideNav/SideNavItem.js +1 -1
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +3 -3
- package/dist/Stack/Stack.d.ts +23 -1
- package/dist/Stack/Stack.d.ts.map +1 -1
- package/dist/Stack/Stack.js +12 -6
- package/dist/StatusDot/StatusDot.d.ts +43 -3
- package/dist/StatusDot/StatusDot.d.ts.map +1 -1
- package/dist/StatusDot/StatusDot.js +42 -5
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +9 -0
- package/dist/TabList/TabMenu.js +1 -1
- package/dist/Table/TableRow.js +4 -4
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +7 -2
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts +5 -3
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.js +12 -9
- package/dist/Table/plugins/tree/useTableTreeData.js +2 -2
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +6 -1
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +6 -1
- package/dist/Thumbnail/Thumbnail.js +1 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +6 -1
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +6 -4
- package/dist/Timestamp/formatInstant.d.ts +3 -2
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +8 -8
- package/dist/Timestamp/tooltipEntries.d.ts +2 -1
- package/dist/Timestamp/tooltipEntries.d.ts.map +1 -1
- package/dist/Timestamp/tooltipEntries.js +5 -3
- package/dist/Token/Token.js +1 -1
- package/dist/Tooltip/Tooltip.d.ts +16 -3
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +2 -0
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +21 -2
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +71 -13
- package/dist/TopNav/TopNavHeading.js +2 -2
- package/dist/TopNav/TopNavItem.js +2 -2
- package/dist/TopNav/TopNavMegaMenu.js +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +1 -1
- package/dist/TopNav/TopNavMenu.js +2 -2
- package/dist/TreeList/TreeListItem.js +1 -1
- package/dist/astryx.css +85 -60
- package/dist/hooks/containerReveal.stylex.d.ts.map +1 -1
- package/dist/hooks/containerReveal.stylex.js +18 -18
- package/dist/hooks/scrollbarGutter.d.ts +28 -0
- package/dist/hooks/scrollbarGutter.d.ts.map +1 -0
- package/dist/hooks/scrollbarGutter.js +103 -0
- package/dist/hooks/useResolvedRequired.d.ts +19 -0
- package/dist/hooks/useResolvedRequired.d.ts.map +1 -0
- package/dist/hooks/useResolvedRequired.js +40 -0
- package/dist/hooks/useScrollLock.d.ts +4 -0
- package/dist/hooks/useScrollLock.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.js +13 -1
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.js +2 -0
- package/dist/i18n/index.d.ts +6 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +6 -0
- package/dist/i18n/useCollator.d.ts +12 -0
- package/dist/i18n/useCollator.d.ts.map +1 -0
- package/dist/i18n/useCollator.js +40 -0
- package/dist/i18n/useLocale.d.ts +3 -0
- package/dist/i18n/useLocale.d.ts.map +1 -0
- package/dist/i18n/useLocale.js +31 -0
- package/dist/theme/defineTheme.d.ts +5 -0
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +5 -0
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +7 -0
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +66 -5
- package/dist/utils/dateParser.d.ts +4 -3
- package/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +8 -8
- package/dist/utils/plainDate.d.ts +9 -2
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +16 -4
- package/locales/af-ZA.json +958 -0
- package/locales/ar-SA.json +998 -0
- package/locales/ca-ES.json +974 -0
- package/locales/cs-CZ.json +990 -0
- package/locales/da-DK.json +966 -0
- package/locales/de-DE.json +966 -0
- package/locales/el-GR.json +990 -0
- package/locales/en.json +8 -0
- package/locales/es-ES.json +978 -0
- package/locales/fi-FI.json +990 -0
- package/locales/fr-FR.json +928 -0
- package/locales/he-IL.json +990 -0
- package/locales/hu-HU.json +990 -0
- package/locales/it-IT.json +978 -0
- package/locales/ja-JP.json +998 -0
- package/locales/ko-KR.json +990 -0
- package/locales/nl-NL.json +954 -0
- package/locales/no-NO.json +978 -0
- package/locales/pl-PL.json +982 -0
- package/locales/pseudo.json +6 -0
- package/locales/pt-BR.json +982 -0
- package/locales/pt-PT.json +982 -0
- package/locales/ro-RO.json +982 -0
- package/locales/ru-RU.json +990 -0
- package/locales/sr-SP.json +990 -0
- package/locales/sv-SE.json +986 -0
- package/locales/tr-TR.json +990 -0
- package/locales/uk-UA.json +990 -0
- package/locales/vi-VN.json +986 -0
- package/locales/zh-CN.json +998 -0
- package/locales/zh-TW.json +998 -0
- package/package.json +3 -3
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +1 -1
- package/src/Banner/Banner.doc.mjs +2 -0
- package/src/BottomSheet/BottomSheet.doc.mjs +36 -3
- package/src/BottomSheet/BottomSheet.test.tsx +177 -2
- package/src/BottomSheet/BottomSheet.tsx +16 -2
- package/src/BottomSheet/BottomSheetPanel.test.tsx +41 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +95 -15
- package/src/BottomSheet/index.ts +5 -1
- package/src/BottomSheet/snapOffsets.test.ts +114 -47
- package/src/BottomSheet/snapOffsets.ts +119 -33
- package/src/BottomSheet/useSheetGestures.test.ts +113 -15
- package/src/BottomSheet/useSheetGestures.ts +196 -100
- package/src/Breadcrumbs/BreadcrumbItem.tsx +1 -1
- package/src/Button/Button.tsx +7 -7
- package/src/Calendar/Calendar.doc.mjs +16 -0
- package/src/Calendar/Calendar.test.tsx +137 -0
- package/src/Calendar/Calendar.tsx +80 -11
- package/src/Calendar/getStandaloneShortWeekdayNames.test.ts +54 -0
- package/src/Calendar/getStandaloneShortWeekdayNames.ts +38 -0
- package/src/Calendar/hooks/useCalendarConstraints.ts +54 -3
- package/src/Calendar/hooks/useCalendarDays.ts +13 -10
- package/src/Calendar/hooks/useCalendarNavigation.ts +6 -4
- package/src/Calendar/standaloneShortWeekdayNames.generated.ts +50 -0
- package/src/Calendar/styles.ts +3 -3
- package/src/Center/Center.doc.mjs +48 -0
- package/src/Center/Center.test.tsx +158 -0
- package/src/Center/Center.tsx +50 -9
- package/src/Chat/ChatComposer.tsx +7 -4
- package/src/Chat/ChatToolCalls.tsx +1 -1
- package/src/Chat/{useChatDictation.test.ts → useChatDictation.test.tsx} +29 -14
- package/src/Chat/useChatDictation.ts +1 -1
- package/src/Chat/useSpeechRecognition.ts +5 -3
- package/src/CheckboxInput/CheckboxInput.tsx +6 -0
- package/src/Citation/Citation.tsx +3 -3
- package/src/ClickableCard/ClickableCard.tsx +2 -2
- package/src/CommandPalette/CommandPaletteItem.tsx +1 -1
- package/src/ComplexSelector/ComplexSelector.doc.mjs +10 -0
- package/src/ComplexSelector/ComplexSelector.tsx +8 -5
- package/src/DateInput/DateInput.test.tsx +17 -1
- package/src/DateInput/DateInput.tsx +13 -9
- package/src/DateRangeInput/DateRangeInput.doc.mjs +16 -0
- package/src/DateRangeInput/DateRangeInput.test.tsx +81 -1
- package/src/DateRangeInput/DateRangeInput.tsx +88 -8
- package/src/DateTimeInput/DateTimeInput.tsx +23 -8
- package/src/Dialog/Dialog.test.tsx +24 -0
- package/src/Dialog/Dialog.tsx +3 -0
- package/src/Field/Field.doc.mjs +3 -0
- package/src/Field/FieldLabel.tsx +20 -4
- package/src/Field/InputClearButton.test.tsx +134 -2
- package/src/Field/InputClearButton.tsx +42 -1
- package/src/Field/inputStyles.stylex.ts +16 -12
- package/src/FileInput/FileInput.tsx +5 -4
- package/src/FormLayout/FormLayout.doc.mjs +13 -0
- package/src/FormLayout/FormLayout.test.tsx +181 -4
- package/src/FormLayout/FormLayout.tsx +33 -2
- package/src/FormLayout/FormLayoutContext.ts +22 -7
- package/src/FormLayout/index.ts +1 -1
- package/src/HoverCard/HoverCard.doc.mjs +18 -0
- package/src/HoverCard/HoverCard.test.tsx +189 -0
- package/src/HoverCard/HoverCard.tsx +22 -2
- package/src/HoverCard/index.ts +1 -0
- package/src/HoverCard/useHoverCard.doc.mjs +2 -0
- package/src/HoverCard/useHoverCard.tsx +103 -7
- package/src/Item/Item.doc.mjs +1 -0
- package/src/Item/Item.test.tsx +50 -0
- package/src/Item/Item.tsx +41 -2
- package/src/Layer/index.ts +10 -0
- package/src/Layer/useLayer.tsx +13 -2
- package/src/Layer/useTouchTrigger.test.ts +70 -0
- package/src/Layer/useTouchTrigger.ts +366 -0
- package/src/Layout/Layout.doc.mjs +18 -0
- package/src/Layout/container.stylex.ts +11 -3
- package/src/Layout/index.ts +4 -0
- package/src/Layout/overlayPaddingReset.test.tsx +222 -0
- package/src/Layout/padding.stylex.ts +192 -12
- package/src/Lightbox/Lightbox.tsx +2 -1
- package/src/Link/Link.tsx +4 -4
- package/src/Markdown/Markdown.doc.mjs +3 -0
- package/src/Markdown/Markdown.test.tsx +78 -0
- package/src/Markdown/Markdown.tsx +41 -1
- package/src/Markdown/parser.ts +60 -2
- package/src/MobileNav/MobileNav.tsx +61 -5
- package/src/MobileNav/MobileNavEntryAnimation.test.tsx +212 -0
- package/src/MobileNav/MobileNavScrollbarGutter.test.tsx +109 -0
- package/src/MultiSelector/MultiSelector.test.tsx +1 -1
- package/src/MultiSelector/MultiSelector.tsx +8 -5
- package/src/NavItem/navItemStyles.stylex.ts +2 -2
- package/src/NavMenu/NavHeadingMenuItem.tsx +1 -1
- package/src/NumberInput/NumberInput.doc.mjs +24 -0
- package/src/NumberInput/NumberInput.test.tsx +138 -0
- package/src/NumberInput/NumberInput.tsx +44 -6
- package/src/Outline/Outline.doc.mjs +2 -0
- package/src/Outline/Outline.tsx +1 -1
- package/src/Outline/parseOutlineFromMarkdown.ts +10 -40
- package/src/PowerSearch/PowerSearch.tsx +17 -8
- package/src/PowerSearch/PowerSearchToken.tsx +3 -0
- package/src/PowerSearch/formatFilterValue.test.ts +22 -2
- package/src/PowerSearch/formatFilterValue.ts +31 -6
- package/src/RadioList/RadioList.doc.mjs +1 -1
- package/src/RadioList/RadioList.test.tsx +170 -2
- package/src/RadioList/RadioList.tsx +9 -1
- package/src/RadioList/RadioListItem.tsx +83 -51
- package/src/Resizable/ResizeHandle.test.tsx +22 -0
- package/src/Resizable/ResizeHandle.tsx +9 -3
- package/src/Section/Section.doc.mjs +55 -0
- package/src/Section/Section.test.tsx +201 -4
- package/src/Section/Section.tsx +69 -0
- package/src/SegmentedControl/SegmentedControl.test.tsx +31 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +11 -2
- package/src/SelectableCard/SelectableCard.tsx +1 -1
- package/src/Selector/Selector.doc.mjs +16 -2
- package/src/Selector/Selector.test.tsx +525 -1
- package/src/Selector/Selector.tsx +166 -21
- package/src/Selector/SelectorOption.doc.mjs +7 -0
- package/src/Selector/SelectorOption.tsx +21 -0
- package/src/Selector/SelectorRowLayoutContext.ts +32 -0
- package/src/Selector/types.ts +4 -4
- package/src/SideNav/SideNavHeading.tsx +2 -2
- package/src/SideNav/SideNavItem.tsx +1 -1
- package/src/Slider/Slider.tsx +11 -1
- package/src/Stack/Stack.doc.mjs +72 -0
- package/src/Stack/Stack.test.tsx +156 -0
- package/src/Stack/Stack.tsx +50 -8
- package/src/StatusDot/StatusDot.doc.mjs +13 -0
- package/src/StatusDot/StatusDot.test.tsx +115 -8
- package/src/StatusDot/StatusDot.tsx +74 -9
- package/src/Switch/Switch.tsx +6 -0
- package/src/TabList/TabMenu.tsx +1 -1
- package/src/Table/TableRow.tsx +4 -4
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +2 -1
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +2 -1
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +22 -4
- package/src/Table/plugins/sortable/useTableSortableState.test.tsx +34 -0
- package/src/Table/plugins/sortable/useTableSortableState.tsx +26 -23
- package/src/Table/plugins/tree/useTableTreeData.tsx +2 -2
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextArea/TextArea.tsx +3 -1
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/Thumbnail/Thumbnail.tsx +1 -1
- package/src/TimeInput/TimeInput.tsx +3 -1
- package/src/Timestamp/Timestamp.test.tsx +27 -7
- package/src/Timestamp/Timestamp.tsx +8 -4
- package/src/Timestamp/formatInstant.ts +9 -7
- package/src/Timestamp/tooltipEntries.test.ts +11 -6
- package/src/Timestamp/tooltipEntries.ts +6 -2
- package/src/Token/Token.tsx +1 -1
- package/src/Tooltip/Tooltip.doc.mjs +18 -0
- package/src/Tooltip/Tooltip.test.tsx +254 -1
- package/src/Tooltip/Tooltip.tsx +22 -2
- package/src/Tooltip/index.ts +1 -0
- package/src/Tooltip/useTooltip.doc.mjs +2 -0
- package/src/Tooltip/useTooltip.tsx +99 -21
- package/src/TopNav/TopNavHeading.tsx +1 -1
- package/src/TopNav/TopNavItem.tsx +2 -2
- package/src/TopNav/TopNavMegaMenu.tsx +1 -1
- package/src/TopNav/TopNavMegaMenuItem.tsx +1 -1
- package/src/TopNav/TopNavMenu.tsx +2 -2
- package/src/TreeList/TreeListItem.tsx +1 -1
- package/src/hooks/containerReveal.stylex.ts +54 -18
- package/src/hooks/scrollbarGutter.test.ts +167 -0
- package/src/hooks/scrollbarGutter.ts +121 -0
- package/src/hooks/useResolvedRequired.ts +42 -0
- package/src/hooks/useScrollLock.doc.mjs +4 -4
- package/src/hooks/useScrollLock.test.ts +73 -0
- package/src/hooks/useScrollLock.ts +14 -0
- package/src/i18n/InternationalizationContext.ts +2 -0
- package/src/i18n/__tests__/e2e-powersearch.test.tsx +37 -1
- package/src/i18n/__tests__/useCollator.test.tsx +115 -0
- package/src/i18n/__tests__/useLocale.test.tsx +52 -0
- package/src/i18n/index.ts +6 -0
- package/src/i18n/useCollator.doc.mjs +84 -0
- package/src/i18n/useCollator.ts +44 -0
- package/src/i18n/useLocale.doc.mjs +70 -0
- package/src/i18n/useLocale.ts +34 -0
- package/src/i18n/useTranslator.doc.mjs +1 -1
- package/src/theme/defineTheme.test.ts +9 -3
- package/src/theme/defineTheme.ts +5 -0
- package/src/theme/derivedVarRegistry.test.ts +19 -5
- package/src/theme/derivedVarRegistry.ts +4 -0
- package/src/theme/generateThemeRules.test.ts +118 -0
- package/src/theme/generateThemeRules.ts +83 -5
- package/src/utils/dateParser.test.ts +20 -0
- package/src/utils/dateParser.ts +14 -7
- package/src/utils/plainDate.test.ts +56 -0
- package/src/utils/plainDate.ts +17 -4
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* - /apps/storybook/stories/DateRangeInput.stories.tsx (storybook stories)
|
|
16
16
|
* - /packages/cli/assets/templates/blocks/components/DateRangeInput/ (showcase blocks)
|
|
17
17
|
*/
|
|
18
|
-
import { useId, useCallback, useMemo, useOptimistic, useTransition } from 'react';
|
|
18
|
+
import { use, useId, useCallback, useMemo, useOptimistic, useTransition } from 'react';
|
|
19
19
|
import * as stylex from '@stylexjs/stylex';
|
|
20
|
-
import { plainDateFromISO, plainDateToday, plainDateFormat, DATE_FORMAT_SHORT, DATE_FORMAT_SHORT_WITH_YEAR } from "../utils/plainDate.js";
|
|
20
|
+
import { plainDateFromISO, plainDateToday, plainDateFormat, plainDateDiffDays, DATE_FORMAT_SHORT, DATE_FORMAT_SHORT_WITH_YEAR } from "../utils/plainDate.js";
|
|
21
21
|
import "../theme/tokens.stylex.js";
|
|
22
22
|
import { colorVars, sizeVars, radiusVars, spacingVars, typographyVars, typeScaleVars, borderVars } from "../theme/tokens.stylex.js";
|
|
23
23
|
import { Field, InputClearButton, inputWrapperStyles, inputStatusBorderStyles, inputStatusHoverShadowStyles, inputStatusFocusWithinStyles } from "../Field/index.js";
|
|
@@ -29,10 +29,11 @@ import { useTooltip } from "../Tooltip/index.js";
|
|
|
29
29
|
import { mergeProps } from "../utils/index.js";
|
|
30
30
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
31
31
|
import { useInputStatusIcon } from "../hooks/useInputStatusIcon.js";
|
|
32
|
+
import { useResolvedRequired } from "../hooks/useResolvedRequired.js";
|
|
32
33
|
import { themeProps } from "../utils/themeProps.js";
|
|
33
34
|
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
34
35
|
import { stableClassName } from "../naming.js";
|
|
35
|
-
import { useTranslator } from "../i18n/index.js";
|
|
36
|
+
import { useTranslator, InternationalizationContext } from "../i18n/index.js";
|
|
36
37
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
37
38
|
const styles = {
|
|
38
39
|
iconButton: {
|
|
@@ -60,7 +61,7 @@ const styles = {
|
|
|
60
61
|
kMzoRj: "xc342km",
|
|
61
62
|
ksu8eU: "xng3xce",
|
|
62
63
|
kaIpWk: "xh6dtrn",
|
|
63
|
-
kWkggS: "xjbqb8w
|
|
64
|
+
kWkggS: "xjbqb8w xoevpu5",
|
|
64
65
|
kMv6JI: "x9ynric",
|
|
65
66
|
kGuDYH: "xcr08ib",
|
|
66
67
|
kLWn49: "x1kq96og",
|
|
@@ -73,6 +74,12 @@ const styles = {
|
|
|
73
74
|
kWkggS: "xgcxg3y",
|
|
74
75
|
kMwMTN: "xqwr325",
|
|
75
76
|
$$css: true
|
|
77
|
+
},
|
|
78
|
+
presetButtonDisabled: {
|
|
79
|
+
kMwMTN: "xnbbluu",
|
|
80
|
+
kkrTdU: "x1h6gzvc",
|
|
81
|
+
kWkggS: "xjbqb8w",
|
|
82
|
+
$$css: true
|
|
76
83
|
}
|
|
77
84
|
};
|
|
78
85
|
const sizeStyles = {
|
|
@@ -92,7 +99,7 @@ const sizeStyles = {
|
|
|
92
99
|
$$css: true
|
|
93
100
|
}
|
|
94
101
|
};
|
|
95
|
-
function formatRangeDisplay(range) {
|
|
102
|
+
function formatRangeDisplay(range, locale) {
|
|
96
103
|
if (!range) {
|
|
97
104
|
return '';
|
|
98
105
|
}
|
|
@@ -101,7 +108,7 @@ function formatRangeDisplay(range) {
|
|
|
101
108
|
const currentYear = plainDateToday().year;
|
|
102
109
|
const sameYear = start.year === end.year && start.year === currentYear;
|
|
103
110
|
const fmt = sameYear ? DATE_FORMAT_SHORT : DATE_FORMAT_SHORT_WITH_YEAR;
|
|
104
|
-
return `${plainDateFormat(start, fmt)} – ${plainDateFormat(end, fmt)}`;
|
|
111
|
+
return `${plainDateFormat(start, fmt, locale)} – ${plainDateFormat(end, fmt, locale)}`;
|
|
105
112
|
}
|
|
106
113
|
function isRangeEqual(a, b) {
|
|
107
114
|
if (a === b) {
|
|
@@ -112,6 +119,24 @@ function isRangeEqual(a, b) {
|
|
|
112
119
|
}
|
|
113
120
|
return a.start === b.start && a.end === b.end;
|
|
114
121
|
}
|
|
122
|
+
|
|
123
|
+
// A preset that would land outside the span bounds is disabled rather than
|
|
124
|
+
// allowed to override them: the cap is authoritative, so an out-of-window
|
|
125
|
+
// preset stays visible (discoverable) but non-committable, mirroring how the
|
|
126
|
+
// calendar disables out-of-window days. Spans count both endpoints.
|
|
127
|
+
function isRangeWithinSpan(range, maxRangeSpan, minRangeSpan) {
|
|
128
|
+
if (maxRangeSpan == null && minRangeSpan == null) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
const span = Math.abs(plainDateDiffDays(plainDateFromISO(range.start), plainDateFromISO(range.end))) + 1;
|
|
132
|
+
if (maxRangeSpan != null && span > maxRangeSpan) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
if (minRangeSpan != null && span < minRangeSpan) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
115
140
|
/**
|
|
116
141
|
* A date range picker with a button trigger that opens a popover
|
|
117
142
|
* containing a dual-month calendar and optional preset ranges.
|
|
@@ -143,6 +168,8 @@ export function DateRangeInput({
|
|
|
143
168
|
min,
|
|
144
169
|
max,
|
|
145
170
|
dateConstraints,
|
|
171
|
+
maxRangeSpan,
|
|
172
|
+
minRangeSpan,
|
|
146
173
|
presets,
|
|
147
174
|
hasClear = true,
|
|
148
175
|
placeholder: placeholderFromProps,
|
|
@@ -160,6 +187,13 @@ export function DateRangeInput({
|
|
|
160
187
|
...rest
|
|
161
188
|
}) {
|
|
162
189
|
const t = useTranslator();
|
|
190
|
+
const isEffectivelyRequired = useResolvedRequired({
|
|
191
|
+
isRequired,
|
|
192
|
+
isOptional
|
|
193
|
+
});
|
|
194
|
+
const {
|
|
195
|
+
locale
|
|
196
|
+
} = use(InternationalizationContext);
|
|
163
197
|
const placeholder = placeholderFromProps ?? t('@astryx.dateRangeInput.placeholder');
|
|
164
198
|
const size = useSize(sizeProp, 'md');
|
|
165
199
|
const id = useId();
|
|
@@ -195,7 +229,7 @@ export function DateRangeInput({
|
|
|
195
229
|
// The tooltip variant renders no message box; describe the input by the
|
|
196
230
|
// tooltip's content instead so the status is still announced.
|
|
197
231
|
statusTooltipDescribedBy, showsDisabledMessage ? disabledMessageTooltip.describedBy : null].filter(Boolean).join(' ') || undefined;
|
|
198
|
-
const displayValue = useMemo(() => formatRangeDisplay(optimisticValue), [optimisticValue]);
|
|
232
|
+
const displayValue = useMemo(() => formatRangeDisplay(optimisticValue, locale), [optimisticValue, locale]);
|
|
199
233
|
const popover = usePopover({
|
|
200
234
|
dialogLabel: t('@astryx.dateRangeInput.dialogLabel'),
|
|
201
235
|
closeButtonLabel: t('@astryx.dateInput.closeCalendar')
|
|
@@ -293,7 +327,7 @@ export function DateRangeInput({
|
|
|
293
327
|
"aria-disabled": showsDisabledMessage ? 'true' : undefined,
|
|
294
328
|
"aria-label": triggerAriaLabel,
|
|
295
329
|
"aria-describedby": ariaDescribedBy,
|
|
296
|
-
"aria-required":
|
|
330
|
+
"aria-required": isEffectivelyRequired ? 'true' : undefined,
|
|
297
331
|
"aria-invalid": status?.type === 'error' ? 'true' : undefined,
|
|
298
332
|
"aria-busy": isBusy || undefined,
|
|
299
333
|
"aria-expanded": popover.isOpen,
|
|
@@ -336,6 +370,7 @@ export function DateRangeInput({
|
|
|
336
370
|
children: presets.map(preset => {
|
|
337
371
|
const presetRange = preset.getRange();
|
|
338
372
|
const isActive = isRangeEqual(value, presetRange);
|
|
373
|
+
const isPresetDisabled = !isRangeWithinSpan(presetRange, maxRangeSpan, minRangeSpan);
|
|
339
374
|
return /*#__PURE__*/_jsx("button", {
|
|
340
375
|
type: "button"
|
|
341
376
|
// These presets are independent action buttons navigated by
|
|
@@ -345,8 +380,9 @@ export function DateRangeInput({
|
|
|
345
380
|
// concept that contradicted the Tab interaction) (forms-5).
|
|
346
381
|
,
|
|
347
382
|
"aria-current": isActive ? 'true' : undefined,
|
|
383
|
+
disabled: isPresetDisabled,
|
|
348
384
|
onClick: () => handlePresetClick(preset),
|
|
349
|
-
...stylex.props(focusOutlineStyles.focusVisible, styles.presetButton, isActive && styles.presetButtonActive),
|
|
385
|
+
...stylex.props(focusOutlineStyles.focusVisible, styles.presetButton, isActive && styles.presetButtonActive, isPresetDisabled && styles.presetButtonDisabled),
|
|
350
386
|
children: preset.label
|
|
351
387
|
}, preset.label);
|
|
352
388
|
})
|
|
@@ -357,6 +393,8 @@ export function DateRangeInput({
|
|
|
357
393
|
min: min,
|
|
358
394
|
max: max,
|
|
359
395
|
dateConstraints: dateConstraints,
|
|
396
|
+
maxRangeSpan: maxRangeSpan,
|
|
397
|
+
minRangeSpan: minRangeSpan,
|
|
360
398
|
numberOfMonths: numberOfMonths,
|
|
361
399
|
weekStartsOn: weekStartsOn
|
|
362
400
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeInput.d.ts","sourceRoot":"","sources":["../../src/DateTimeInput/DateTimeInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DateTimeInput.d.ts","sourceRoot":"","sources":["../../src/DateTimeInput/DateTimeInput.tsx"],"names":[],"mappings":"AAuCA,OAAO,EAGL,KAAK,WAAW,EAKjB,MAAM,UAAU,CAAC;A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UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,aAAiB,EACjB,QAAgB,EAChB,WAAW,EAAE,oBAAoB,EACjC,eAAe,EAAE,wBAAwB,EACzC,SAAS,EACT,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,YAAY,EACZ,cAAkB,EAClB,YAAY,EACZ,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,kBAAkB,+BAisBpB;yBAluBe,aAAa"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* - /apps/storybook/stories/DateTimeInput.stories.tsx (storybook stories)
|
|
16
16
|
* - /packages/cli/assets/templates/blocks/components/DateTimeInput/ (showcase blocks)
|
|
17
17
|
*/
|
|
18
|
-
import { useId, useState, useCallback, useRef, useMemo, useOptimistic, useTransition } from 'react';
|
|
18
|
+
import { use, useId, useState, useCallback, useRef, useMemo, useOptimistic, useTransition } from 'react';
|
|
19
19
|
import * as stylex from '@stylexjs/stylex';
|
|
20
20
|
import "../theme/tokens.stylex.js";
|
|
21
21
|
import { colorVars, sizeVars, radiusVars, spacingVars, typographyVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
@@ -32,10 +32,11 @@ import { useInputStatusIcon } from "../hooks/useInputStatusIcon.js";
|
|
|
32
32
|
import { parseDateInput, parseTimeInput, formatDisplayTime12h, formatDisplayTime24h, formatISOTime, isTimeInRange, adjustTime, isImeKeyEvent, mergeProps, mergeRefs, isFocusDetached } from "../utils/index.js";
|
|
33
33
|
import { plainDateFromISO, plainDateToISO, plainDateFormat, DATE_FORMAT_LONG } from "../utils/plainDate.js";
|
|
34
34
|
import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
35
|
+
import { useResolvedRequired } from "../hooks/useResolvedRequired.js";
|
|
35
36
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
36
37
|
import { themeProps } from "../utils/themeProps.js";
|
|
37
38
|
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
38
|
-
import { useTranslator } from "../i18n/index.js";
|
|
39
|
+
import { useTranslator, InternationalizationContext } from "../i18n/index.js";
|
|
39
40
|
|
|
40
41
|
/** Supported minute increments for arrow-key stepping of the time field. */
|
|
41
42
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -170,6 +171,13 @@ export function DateTimeInput({
|
|
|
170
171
|
...rest
|
|
171
172
|
}) {
|
|
172
173
|
const t = useTranslator();
|
|
174
|
+
const isEffectivelyRequired = useResolvedRequired({
|
|
175
|
+
isRequired,
|
|
176
|
+
isOptional
|
|
177
|
+
});
|
|
178
|
+
const {
|
|
179
|
+
locale
|
|
180
|
+
} = use(InternationalizationContext);
|
|
173
181
|
// Speaks arrow-key stepping results through the persistent live regions:
|
|
174
182
|
// stepping programmatically rewrites a plain textbox's value, which screen
|
|
175
183
|
// readers do not announce on their own (WCAG 4.1.2).
|
|
@@ -262,8 +270,8 @@ export function DateTimeInput({
|
|
|
262
270
|
}
|
|
263
271
|
}
|
|
264
272
|
}
|
|
265
|
-
const dateDisplayValue = datePendingInput !== null ? datePendingInput : valueParts.date && /^\d{4}-\d{2}-\d{2}$/.test(valueParts.date) ? plainDateFormat(plainDateFromISO(valueParts.date), DATE_FORMAT_LONG) : '';
|
|
266
|
-
const isDateInputValid = datePendingInput === null || !datePendingInput.trim() ? true : parseDateInput(datePendingInput) !== null;
|
|
273
|
+
const dateDisplayValue = datePendingInput !== null ? datePendingInput : valueParts.date && /^\d{4}-\d{2}-\d{2}$/.test(valueParts.date) ? plainDateFormat(plainDateFromISO(valueParts.date), DATE_FORMAT_LONG, locale) : '';
|
|
274
|
+
const isDateInputValid = datePendingInput === null || !datePendingInput.trim() ? true : parseDateInput(datePendingInput, locale) !== null;
|
|
267
275
|
|
|
268
276
|
// --- Time input state ---
|
|
269
277
|
const [timePendingInput, setTimePendingInput] = useState(null);
|
|
@@ -371,14 +379,14 @@ export function DateTimeInput({
|
|
|
371
379
|
}
|
|
372
380
|
const text = e.target.value;
|
|
373
381
|
setDatePendingInput(text);
|
|
374
|
-
const parsed = parseDateInput(text);
|
|
382
|
+
const parsed = parseDateInput(text, locale);
|
|
375
383
|
if (parsed && plainDateToISO(parsed) !== valueParts.date && !isDateDisabled(parsed)) {
|
|
376
384
|
const parsedISO = plainDateToISO(parsed);
|
|
377
385
|
lastFiredDateRef.current = parsedISO;
|
|
378
386
|
handleDateChange(parsedISO, 'input');
|
|
379
387
|
calendarRef.current?.navigateTo(parsedISO);
|
|
380
388
|
}
|
|
381
|
-
}, [valueParts.date, isDateDisabled, handleDateChange, isEffectivelyDisabled]);
|
|
389
|
+
}, [valueParts.date, isDateDisabled, handleDateChange, isEffectivelyDisabled, locale]);
|
|
382
390
|
const commitDatePendingInput = useCallback(() => {
|
|
383
391
|
if (datePendingInput === null) {
|
|
384
392
|
return;
|
|
@@ -390,7 +398,7 @@ export function DateTimeInput({
|
|
|
390
398
|
setDatePendingInput(null);
|
|
391
399
|
return;
|
|
392
400
|
}
|
|
393
|
-
const parsed = parseDateInput(datePendingInput);
|
|
401
|
+
const parsed = parseDateInput(datePendingInput, locale);
|
|
394
402
|
if (parsed && !isDateDisabled(parsed)) {
|
|
395
403
|
const parsedISO = plainDateToISO(parsed);
|
|
396
404
|
if (parsedISO !== valueParts.date) {
|
|
@@ -398,7 +406,7 @@ export function DateTimeInput({
|
|
|
398
406
|
}
|
|
399
407
|
}
|
|
400
408
|
setDatePendingInput(null);
|
|
401
|
-
}, [datePendingInput, value, valueParts.date, fireChange, isDateDisabled, handleDateChange]);
|
|
409
|
+
}, [datePendingInput, value, valueParts.date, fireChange, isDateDisabled, handleDateChange, locale]);
|
|
402
410
|
const handleDateBlur = useCallback(() => {
|
|
403
411
|
commitDatePendingInput();
|
|
404
412
|
}, [commitDatePendingInput]);
|
|
@@ -597,7 +605,7 @@ export function DateTimeInput({
|
|
|
597
605
|
"aria-disabled": showsDisabledMessage ? 'true' : undefined,
|
|
598
606
|
readOnly: showsDisabledMessage || undefined,
|
|
599
607
|
"aria-describedby": ariaDescribedBy,
|
|
600
|
-
"aria-required":
|
|
608
|
+
"aria-required": isEffectivelyRequired ? 'true' : undefined,
|
|
601
609
|
"aria-invalid": status?.type === 'error' || !isDateInputValid ? 'true' : undefined,
|
|
602
610
|
"aria-busy": isBusy || undefined,
|
|
603
611
|
"aria-expanded": popover.isOpen,
|
|
@@ -676,7 +684,7 @@ export function DateTimeInput({
|
|
|
676
684
|
label
|
|
677
685
|
}),
|
|
678
686
|
"aria-describedby": ariaDescribedBy,
|
|
679
|
-
"aria-required":
|
|
687
|
+
"aria-required": isEffectivelyRequired ? 'true' : undefined,
|
|
680
688
|
"aria-invalid": status?.type === 'error' || !isTimeInputValid ? 'true' : undefined,
|
|
681
689
|
"aria-busy": isBusy || undefined,
|
|
682
690
|
...{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAsB5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAKhD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAsB9C;;;;;;GAMG;AACH,MAAM,MAAM,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E,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,QAAgB,EAChB,YAAY,EACZ,KAAW,EACX,SAAkB,EAClB,QAAQ,EACR,OAAoB,EACpB,OAAgB,EAChB,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,sCA6Sb;yBA7Te,MAAM"}
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -23,7 +23,7 @@ import { isImeKeyEvent } from "../utils/ime.js";
|
|
|
23
23
|
import "../theme/tokens.stylex.js";
|
|
24
24
|
import { colorVars, radiusVars, durationVars, easeVars, shadowVars } from "../theme/tokens.stylex.js";
|
|
25
25
|
import { container } from "../Layout/container.stylex.js";
|
|
26
|
-
import { paddingStyles, containerPaddingInlineVarStyles, containerPaddingBlockStartVarStyles, containerPaddingBlockEndVarStyles, spacingStepToToken } from "../Layout/padding.stylex.js";
|
|
26
|
+
import { paddingStyles, containerPaddingInlineVarStyles, containerPaddingBlockStartVarStyles, containerPaddingBlockEndVarStyles, spacingStepToToken, overlayPaddingReset } from "../Layout/padding.stylex.js";
|
|
27
27
|
import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
28
28
|
import { devWarn } from "../utils/devWarning.js";
|
|
29
29
|
import { DialogContext } from "./DialogContext.js";
|
|
@@ -435,7 +435,7 @@ export function Dialog({
|
|
|
435
435
|
...safeProps,
|
|
436
436
|
...mergeProps(themeProps('dialog', {
|
|
437
437
|
variant
|
|
438
|
-
}), stylex.props(styles.inlineWrapper, !isFullscreen && dynamicStyles.sizing(width, maxHeight), isFullscreen && styles.fullscreen, xstyle), className, style),
|
|
438
|
+
}), stylex.props(styles.inlineWrapper, overlayPaddingReset.reset, !isFullscreen && dynamicStyles.sizing(width, maxHeight), isFullscreen && styles.fullscreen, xstyle), className, style),
|
|
439
439
|
"data-testid": props['data-testid'],
|
|
440
440
|
children: innerContent
|
|
441
441
|
});
|
|
@@ -448,7 +448,7 @@ export function Dialog({
|
|
|
448
448
|
...safeProps,
|
|
449
449
|
...mergeProps(themeProps('dialog', {
|
|
450
450
|
variant
|
|
451
|
-
}), focusOutlineProps.focusVisible(styles.dialog, isOpen && styles.open, styles.backdrop, !isFullscreen && dynamicStyles.sizing(width, maxHeight), hasPosition && (() => {
|
|
451
|
+
}), focusOutlineProps.focusVisible(styles.dialog, overlayPaddingReset.reset, isOpen && styles.open, styles.backdrop, !isFullscreen && dynamicStyles.sizing(width, maxHeight), hasPosition && (() => {
|
|
452
452
|
const o = resolveDialogPositionOffsets(position);
|
|
453
453
|
return dynamicStyles.position(o.top, o.insetInlineStart, o.insetInlineEnd, o.bottom);
|
|
454
454
|
})(), isFullscreen && styles.fullscreen, xstyle), className, style),
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file FieldLabel.tsx
|
|
3
|
-
* @input Uses React, Icon, IconType, useTranslator
|
|
3
|
+
* @input Uses React, Icon, IconType, useTranslator, FormLayoutContext
|
|
4
4
|
* @output Exports FieldLabel component, FieldLabelProps
|
|
5
5
|
* @position Core label implementation; used by Field, CheckboxInput, Switch
|
|
6
6
|
*
|
|
7
7
|
* SYNC: When modified, update these files to stay in sync:
|
|
8
8
|
* - /packages/core/src/Field/Field.doc.mjs (props table, features, implementation notes)
|
|
9
9
|
* - /packages/core/src/Field/index.ts (exports if types change)
|
|
10
|
+
* - /packages/core/src/FormLayout/FormLayoutContext.ts (defaultOptionality drives the indicator)
|
|
10
11
|
* - /packages/cli/assets/templates/blocks/components/Field/ (showcase blocks)
|
|
11
12
|
* - /packages/core/locales/en.json (@astryx.field.required / @astryx.field.optional)
|
|
12
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldLabel.d.ts","sourceRoot":"","sources":["../../src/Field/FieldLabel.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"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AK,EACL,MAAM,EACN,GAAG,EACH,GAAG,IAAI,EACR,EAAE,eAAe,+BAsHjB;yBAxIe,UAAU"}
|
package/dist/Field/FieldLabel.js
CHANGED
|
@@ -4,17 +4,18 @@
|
|
|
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
|
-
import { useMemo, useRef } from 'react';
|
|
18
|
+
import { use, useMemo, useRef } from 'react';
|
|
18
19
|
import * as stylex from '@stylexjs/stylex';
|
|
19
20
|
import { mergeProps } from "../utils/index.js";
|
|
20
21
|
import "../theme/tokens.stylex.js";
|
|
@@ -24,6 +25,7 @@ import { Tooltip } from "../Tooltip/index.js";
|
|
|
24
25
|
import { useTranslator } from "../i18n/index.js";
|
|
25
26
|
import { themeProps } from "../utils/themeProps.js";
|
|
26
27
|
import { useInputContainer } from "../hooks/index.js";
|
|
28
|
+
import { FormLayoutContext } from "../FormLayout/FormLayoutContext.js";
|
|
27
29
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
28
30
|
const styles = {
|
|
29
31
|
label: {
|
|
@@ -93,7 +95,23 @@ export function FieldLabel({
|
|
|
93
95
|
...rest
|
|
94
96
|
}) {
|
|
95
97
|
const t = useTranslator();
|
|
96
|
-
const
|
|
98
|
+
const {
|
|
99
|
+
defaultOptionality
|
|
100
|
+
} = use(FormLayoutContext);
|
|
101
|
+
|
|
102
|
+
// A form-level `defaultOptionality` means "only the exception is marked": a
|
|
103
|
+
// field that merely restates the form's default shows no indicator, and only
|
|
104
|
+
// a deviation from it does. This is the *visible indicator* only; the
|
|
105
|
+
// matching `aria-required` is resolved on each control (see
|
|
106
|
+
// useResolvedRequired) so the unmarked majority is still announced.
|
|
107
|
+
//
|
|
108
|
+
// defaultOptionality isRequired isOptional
|
|
109
|
+
// 'optional' → required indicator → (matches default, hidden)
|
|
110
|
+
// 'required' → (matches, hidden) → optional indicator
|
|
111
|
+
// unset → required indicator → optional indicator
|
|
112
|
+
const showRequired = isRequired && defaultOptionality !== 'required';
|
|
113
|
+
const showOptional = isOptional && defaultOptionality !== 'optional';
|
|
114
|
+
const statusText = showOptional ? t('@astryx.field.optional') : showRequired ? t('@astryx.field.required') : null;
|
|
97
115
|
|
|
98
116
|
// A group label (e.g. for a radiogroup) must not be a literal `<label>`
|
|
99
117
|
// element: a `<label>` semantically names a single form control and can't be
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* TextInput, NumberInput, TimeInput, DateInput, DateTimeInput,
|
|
8
8
|
* DateRangeInput, Selector, MultiSelector, Typeahead, Tokenizer, FileInput —
|
|
9
9
|
* routes it through here, so the glyph is themed in one place via the
|
|
10
|
-
* `astryx-input-clear-icon` target
|
|
10
|
+
* `astryx-input-clear-icon` target and the button wrapper is themed via the
|
|
11
|
+
* `astryx-input-clear-button` target.
|
|
11
12
|
*/
|
|
12
13
|
import type { ReactNode } from 'react';
|
|
13
14
|
import * as stylex from '@stylexjs/stylex';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputClearButton.d.ts","sourceRoot":"","sources":["../../src/Field/InputClearButton.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"InputClearButton.d.ts","sourceRoot":"","sources":["../../src/Field/InputClearButton.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAkD3C,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC;IAC7B;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,OAAO,EACP,MAAM,EACN,aAAa,GACd,EAAE,qBAAqB,GAAG,SAAS,CA0BnC;yBA/Be,gBAAgB"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* TextInput, NumberInput, TimeInput, DateInput, DateTimeInput,
|
|
12
12
|
* DateRangeInput, Selector, MultiSelector, Typeahead, Tokenizer, FileInput —
|
|
13
13
|
* routes it through here, so the glyph is themed in one place via the
|
|
14
|
-
* `astryx-input-clear-icon` target
|
|
14
|
+
* `astryx-input-clear-icon` target and the button wrapper is themed via the
|
|
15
|
+
* `astryx-input-clear-button` target.
|
|
15
16
|
*/
|
|
16
17
|
import * as stylex from '@stylexjs/stylex';
|
|
17
18
|
import { Button } from "../Button/index.js";
|
|
@@ -22,6 +23,12 @@ const styles = {
|
|
|
22
23
|
button: {
|
|
23
24
|
kZKoxP: "x1qx5ct2",
|
|
24
25
|
kmuXW: "x2lah0s",
|
|
26
|
+
kVAEAm: "x1n2onr6",
|
|
27
|
+
"--_input-clear-hit-inset": "xtoycft x181bpwf",
|
|
28
|
+
"--_input-clear-hit-content": "xqxtgf4 xp8r40j",
|
|
29
|
+
k5JduY: "xh3pasq",
|
|
30
|
+
kwXMNM: "x1j6awrg",
|
|
31
|
+
kv0HGH: "xht581f",
|
|
25
32
|
$$css: true
|
|
26
33
|
}
|
|
27
34
|
};
|
|
@@ -34,10 +41,14 @@ export function InputClearButton({
|
|
|
34
41
|
const {
|
|
35
42
|
className: iconTargetClassName
|
|
36
43
|
} = themeProps('input-clear-icon');
|
|
44
|
+
const {
|
|
45
|
+
className: buttonTargetClassName
|
|
46
|
+
} = themeProps('input-clear-button');
|
|
37
47
|
return /*#__PURE__*/_jsx(Button, {
|
|
38
48
|
variant: "ghost",
|
|
39
49
|
size: "sm",
|
|
40
50
|
label: label,
|
|
51
|
+
className: buttonTargetClassName,
|
|
41
52
|
icon: /*#__PURE__*/_jsx(Icon, {
|
|
42
53
|
icon: "close",
|
|
43
54
|
size: "sm",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputStyles.stylex.d.ts","sourceRoot":"","sources":["../../src/Field/inputStyles.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAW3C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"inputStyles.stylex.d.ts","sourceRoot":"","sources":["../../src/Field/inputStyles.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAW3C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0C7B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;EAUlC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;EA4BvC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;EAmBvC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;EAmBjC,CAAC"}
|
|
@@ -41,7 +41,7 @@ export const inputWrapperStyles = {
|
|
|
41
41
|
k1ekBW: "x12zzom9",
|
|
42
42
|
kIyJzY: "xuedmi6 x12w9bfk",
|
|
43
43
|
kAMwcw: "xlr8y92",
|
|
44
|
-
kGVxlE: "x1gnnqk1
|
|
44
|
+
kGVxlE: "x1gnnqk1 x1xqjsvb xuihb5h",
|
|
45
45
|
kI3sdo: "x1a2a7pz",
|
|
46
46
|
$$css: true
|
|
47
47
|
},
|
|
@@ -79,15 +79,15 @@ export const inputStatusBorderStyles = {
|
|
|
79
79
|
*/
|
|
80
80
|
export const inputStatusHoverShadowStyles = {
|
|
81
81
|
warning: {
|
|
82
|
-
kGVxlE: "x1gnnqk1
|
|
82
|
+
kGVxlE: "x1gnnqk1 x9156jc",
|
|
83
83
|
$$css: true
|
|
84
84
|
},
|
|
85
85
|
error: {
|
|
86
|
-
kGVxlE: "x1gnnqk1
|
|
86
|
+
kGVxlE: "x1gnnqk1 x1bgmis8",
|
|
87
87
|
$$css: true
|
|
88
88
|
},
|
|
89
89
|
success: {
|
|
90
|
-
kGVxlE: "x1gnnqk1
|
|
90
|
+
kGVxlE: "x1gnnqk1 x8wp45d",
|
|
91
91
|
$$css: true
|
|
92
92
|
}
|
|
93
93
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.d.ts","sourceRoot":"","sources":["../../src/FileInput/FileInput.tsx"],"names":[],"mappings":"AAsCA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AASlB,YAAY,EACV,WAAW,IAAI,eAAe,EAC9B,eAAe,IAAI,mBAAmB,GACvC,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC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,CAAC;IACzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAC5B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,aAAqB,EACrB,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,UAAkB,EAClB,OAAO,EACP,QAAQ,EACR,UAAkB,EAClB,eAAe,EACf,UAAkB,EAClB,SAAiB,EACjB,MAAM,EAAE,UAAU,EAClB,aAA0B,EAC1B,WAAW,EACX,WAAW,EACX,IAAc,EACd,UAAkB,EAClB,YAAY,EACZ,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,cAAc,+BA+ZhB;yBA1be,SAAS"}
|
|
@@ -111,7 +111,7 @@ const styles = {
|
|
|
111
111
|
$$css: true
|
|
112
112
|
},
|
|
113
113
|
dropzoneHover: {
|
|
114
|
-
kGVxlE: "
|
|
114
|
+
kGVxlE: "x1v5wwkd",
|
|
115
115
|
$$css: true
|
|
116
116
|
},
|
|
117
117
|
dropzoneActive: {
|
|
@@ -142,7 +142,7 @@ const styles = {
|
|
|
142
142
|
k1ekBW: "x12zzom9",
|
|
143
143
|
kIyJzY: "xuedmi6 x12w9bfk",
|
|
144
144
|
kAMwcw: "xlr8y92",
|
|
145
|
-
kGVxlE: "x1gnnqk1
|
|
145
|
+
kGVxlE: "x1gnnqk1 x1telqz2",
|
|
146
146
|
kkrTdU: "x1ypdohk",
|
|
147
147
|
kZKoxP: "x1ueg155",
|
|
148
148
|
kI3sdo: "x1a2a7pz",
|
|
@@ -6,13 +6,16 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SYNC: When modified, update these files to stay in sync:
|
|
8
8
|
* - /packages/core/src/FormLayout/FormLayout.test.tsx (tests for new/changed behavior)
|
|
9
|
+
* - /packages/core/src/FormLayout/FormLayoutContext.ts (context value shape)
|
|
10
|
+
* - /packages/core/src/FormLayout/FormLayout.doc.mjs (props table)
|
|
9
11
|
* - /packages/core/src/FormLayout/index.ts (exports if types change)
|
|
12
|
+
* - /packages/core/src/Field/FieldLabel.tsx (defaultOptionality indicator resolution)
|
|
10
13
|
* - /apps/storybook/stories/FormLayout.stories.tsx (storybook stories)
|
|
11
14
|
* - /packages/cli/assets/templates/blocks/components/FormLayout/ (showcase blocks)
|
|
12
15
|
*/
|
|
13
16
|
import { type ReactNode } from 'react';
|
|
14
17
|
import type { BaseProps } from '../BaseProps';
|
|
15
|
-
import { type FormLayoutDirection } from './FormLayoutContext';
|
|
18
|
+
import { type FormLayoutDirection, type FormOptionality } from './FormLayoutContext';
|
|
16
19
|
export interface FormLayoutProps extends BaseProps<HTMLDivElement> {
|
|
17
20
|
/** Ref forwarded to the root element */
|
|
18
21
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -33,6 +36,25 @@ export interface FormLayoutProps extends BaseProps<HTMLDivElement> {
|
|
|
33
36
|
* @default 'vertical'
|
|
34
37
|
*/
|
|
35
38
|
direction?: FormLayoutDirection;
|
|
39
|
+
/**
|
|
40
|
+
* Which state the form treats as its default, so only the *exception*
|
|
41
|
+
* carries a visible optional/required indicator. It also resolves each
|
|
42
|
+
* field's `aria-required` so the unmarked majority is still announced
|
|
43
|
+
* correctly — but only `aria-required`, never the native `required`
|
|
44
|
+
* attribute, so a layout default can't switch on browser validation.
|
|
45
|
+
*
|
|
46
|
+
* - `'optional'` — fields read as optional; only a field with `isRequired`
|
|
47
|
+
* shows an indicator (the "required" one).
|
|
48
|
+
* - `'required'` — fields read as required; only a field with `isOptional`
|
|
49
|
+
* shows an indicator (the "optional" one). Fields without `isOptional`
|
|
50
|
+
* expose `aria-required` even though they show no indicator.
|
|
51
|
+
* - unset — today's behavior: `isRequired` and `isOptional` each show their
|
|
52
|
+
* own indicator independently.
|
|
53
|
+
*
|
|
54
|
+
* A field that merely restates the default (e.g. `isOptional` under
|
|
55
|
+
* `'optional'`) shows nothing. An inner `FormLayout` shadows an outer one.
|
|
56
|
+
*/
|
|
57
|
+
defaultOptionality?: FormOptionality;
|
|
36
58
|
}
|
|
37
59
|
/**
|
|
38
60
|
* Spatial layout container for form fields.
|
|
@@ -52,7 +74,7 @@ export interface FormLayoutProps extends BaseProps<HTMLDivElement> {
|
|
|
52
74
|
* </FormLayout>
|
|
53
75
|
* ```
|
|
54
76
|
*/
|
|
55
|
-
export declare function FormLayout({ children, direction, xstyle, className, style, ref, ...props }: FormLayoutProps): import("react").JSX.Element;
|
|
77
|
+
export declare function FormLayout({ children, direction, defaultOptionality, xstyle, className, style, ref, ...props }: FormLayoutProps): import("react").JSX.Element;
|
|
56
78
|
export declare namespace FormLayout {
|
|
57
79
|
var displayName: string;
|
|
58
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormLayout.d.ts","sourceRoot":"","sources":["../../src/FormLayout/FormLayout.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"FormLayout.d.ts","sourceRoot":"","sources":["../../src/FormLayout/FormLayout.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AA0C7B,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAEhC;;;;;;;;;;;;;;;;;OAiBG;IACH,kBAAkB,CAAC,EAAE,eAAe,CAAC;CACtC;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,SAAsB,EACtB,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,eAAe,+BA0BjB;yBAnCe,UAAU"}
|
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
12
|
* - /packages/core/src/FormLayout/FormLayout.test.tsx (tests for new/changed behavior)
|
|
13
|
+
* - /packages/core/src/FormLayout/FormLayoutContext.ts (context value shape)
|
|
14
|
+
* - /packages/core/src/FormLayout/FormLayout.doc.mjs (props table)
|
|
13
15
|
* - /packages/core/src/FormLayout/index.ts (exports if types change)
|
|
16
|
+
* - /packages/core/src/Field/FieldLabel.tsx (defaultOptionality indicator resolution)
|
|
14
17
|
* - /apps/storybook/stories/FormLayout.stories.tsx (storybook stories)
|
|
15
18
|
* - /packages/cli/assets/templates/blocks/components/FormLayout/ (showcase blocks)
|
|
16
19
|
*/
|
|
@@ -86,6 +89,7 @@ const styles = {
|
|
|
86
89
|
export function FormLayout({
|
|
87
90
|
children,
|
|
88
91
|
direction = 'vertical',
|
|
92
|
+
defaultOptionality,
|
|
89
93
|
xstyle,
|
|
90
94
|
className,
|
|
91
95
|
style,
|
|
@@ -93,8 +97,9 @@ export function FormLayout({
|
|
|
93
97
|
...props
|
|
94
98
|
}) {
|
|
95
99
|
const contextValue = useMemo(() => ({
|
|
96
|
-
direction
|
|
97
|
-
|
|
100
|
+
direction,
|
|
101
|
+
defaultOptionality
|
|
102
|
+
}), [direction, defaultOptionality]);
|
|
98
103
|
return /*#__PURE__*/_jsx(FormLayoutContext, {
|
|
99
104
|
value: contextValue,
|
|
100
105
|
children: /*#__PURE__*/_jsx("div", {
|
|
@@ -8,10 +8,23 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export type FormLayoutDirection = 'vertical' | 'horizontal' | 'horizontal-labels';
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Which state a form treats as its default, so only the *exception* carries a
|
|
12
|
+
* visible optional/required indicator.
|
|
13
|
+
*
|
|
14
|
+
* - `'optional'` — fields are optional unless a field opts into `isRequired`;
|
|
15
|
+
* only required fields show an indicator.
|
|
16
|
+
* - `'required'` — fields are required unless a field opts into `isOptional`;
|
|
17
|
+
* only optional fields show an indicator.
|
|
18
|
+
*/
|
|
19
|
+
export type FormOptionality = 'optional' | 'required';
|
|
20
|
+
/**
|
|
21
|
+
* Context for detecting which form layout a component is rendered in. Children
|
|
22
|
+
* can use this to adapt their rendering based on the parent layout — direction
|
|
23
|
+
* for spatial arrangement, and `defaultOptionality` so a field can suppress the
|
|
24
|
+
* indicator that merely restates the form-wide default.
|
|
13
25
|
*/
|
|
14
26
|
export declare const FormLayoutContext: import("react").Context<{
|
|
15
27
|
direction: FormLayoutDirection;
|
|
28
|
+
defaultOptionality?: FormOptionality;
|
|
16
29
|
}>;
|
|
17
30
|
//# sourceMappingURL=FormLayoutContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormLayoutContext.d.ts","sourceRoot":"","sources":["../../src/FormLayout/FormLayoutContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FormLayoutContext.d.ts","sourceRoot":"","sources":["../../src/FormLayout/FormLayoutContext.ts"],"names":[],"mappings":"AAkBA;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAC7B,UAAU,GAAG,YAAY,GAAG,mBAAmB,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,UAAU,CAAC;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;eACjB,mBAAmB;yBACT,eAAe;EACX,CAAC"}
|