@astryxdesign/core 0.1.2-canary.fc6ce12 → 0.1.2-canary.fe84edc
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/README.md +12 -12
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +5 -11
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +5 -24
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +4 -2
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +42 -76
- package/dist/Calendar/hooks/index.d.ts +2 -0
- package/dist/Calendar/hooks/index.d.ts.map +1 -1
- package/dist/Calendar/hooks/index.js +2 -1
- package/dist/Calendar/hooks/useCalendarRovingTabindex.d.ts +57 -0
- package/dist/Calendar/hooks/useCalendarRovingTabindex.d.ts.map +1 -0
- package/dist/Calendar/hooks/useCalendarRovingTabindex.js +96 -0
- package/dist/Calendar/index.d.ts +2 -2
- package/dist/Calendar/index.d.ts.map +1 -1
- package/dist/Calendar/index.js +1 -1
- package/dist/Calendar/styles.d.ts +9 -3
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +11 -3
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +3 -17
- package/dist/Chat/ChatMessageList.d.ts +1 -14
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +0 -2
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +1 -4
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +2 -4
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +4 -12
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +37 -49
- package/dist/ContextMenu/ContextMenu.d.ts +5 -4
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +11 -93
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +2 -17
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +4 -9
- package/dist/DateTimeInput/DateTimeInput.d.ts +1 -7
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +3 -15
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +0 -12
- package/dist/DropdownMenu/DropdownMenu.d.ts +8 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +14 -42
- package/dist/Field/Field.d.ts +2 -19
- package/dist/Field/Field.d.ts.map +1 -1
- package/dist/Field/Field.js +0 -4
- package/dist/Field/FieldLabel.d.ts +2 -21
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +22 -37
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +6 -27
- package/dist/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/InputGroup/InputGroup.js +1 -4
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +1 -33
- package/dist/Layer/layerAnimations.stylex.d.ts +0 -4
- package/dist/Layer/layerAnimations.stylex.d.ts.map +1 -1
- package/dist/Layer/layerAnimations.stylex.js +4 -8
- package/dist/Layer/useLayer.d.ts +0 -10
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +6 -41
- package/dist/Layout/padding.stylex.d.ts +0 -51
- package/dist/Layout/padding.stylex.d.ts.map +1 -1
- package/dist/Layout/padding.stylex.js +0 -63
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +2 -4
- package/dist/Link/Link.d.ts +1 -7
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +4 -10
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +0 -5
- package/dist/MoreMenu/MoreMenu.d.ts +7 -1
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +2 -0
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +15 -72
- package/dist/MultiSelector/hooks.d.ts +1 -12
- package/dist/MultiSelector/hooks.d.ts.map +1 -1
- package/dist/MultiSelector/hooks.js +1 -14
- package/dist/NavMenu/NavHeadingMenu.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenu.js +2 -17
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +1 -7
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +0 -8
- package/dist/Popover/usePopover.d.ts +2 -25
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +6 -18
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +1 -4
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +5 -3
- package/dist/RadioList/RadioList.d.ts +1 -1
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +3 -76
- package/dist/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +35 -36
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +2 -6
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +16 -53
- package/dist/Selector/hooks.d.ts +1 -8
- package/dist/Selector/hooks.d.ts.map +1 -1
- package/dist/Selector/hooks.js +1 -14
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +1 -1
- package/dist/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/Skeleton/Skeleton.js +2 -8
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +1 -1
- package/dist/Stack/Stack.d.ts +1 -28
- package/dist/Stack/Stack.d.ts.map +1 -1
- package/dist/Stack/Stack.js +1 -17
- package/dist/Stack/StackItem.d.ts +1 -12
- package/dist/Stack/StackItem.d.ts.map +1 -1
- package/dist/Stack/StackItem.js +1 -8
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +4 -2
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +0 -6
- package/dist/TabList/TabList.d.ts +4 -15
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +4 -41
- package/dist/TabList/TabListContext.d.ts +0 -5
- package/dist/TabList/TabListContext.d.ts.map +1 -1
- package/dist/TabList/TabListContext.js +0 -5
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +1 -6
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +1 -7
- package/dist/Table/tableContextMenu.d.ts.map +1 -1
- package/dist/Table/tableContextMenu.js +3 -0
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +4 -2
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +0 -14
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +3 -132
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +3 -7
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +9 -56
- package/dist/TreeList/TreeList.d.ts +1 -1
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +2 -72
- package/dist/TreeList/TreeListItem.d.ts +1 -11
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +12 -51
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +4 -58
- package/dist/astryx.css +0 -10
- package/dist/astryx.umd.js +48 -48
- package/dist/astryx.umd.js.map +4 -4
- package/dist/hooks/index.d.ts +2 -12
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -7
- package/dist/hooks/useClickableContainer.d.ts +1 -16
- package/dist/hooks/useClickableContainer.d.ts.map +1 -1
- package/dist/hooks/useClickableContainer.js +4 -16
- package/dist/hooks/useEntryAnimation.d.ts.map +1 -1
- package/dist/hooks/useEntryAnimation.js +4 -4
- package/dist/hooks/useFocusTrap.d.ts +0 -18
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +3 -87
- package/dist/hooks/useGridFocus.d.ts +1 -88
- package/dist/hooks/useGridFocus.d.ts.map +1 -1
- package/dist/hooks/useGridFocus.js +62 -261
- package/dist/hooks/useListFocus.d.ts +7 -78
- package/dist/hooks/useListFocus.d.ts.map +1 -1
- package/dist/hooks/useListFocus.js +52 -305
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/package.json +1 -6
- package/src/Avatar/Avatar.tsx +5 -10
- package/src/Breadcrumbs/BreadcrumbItem.tsx +7 -25
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +10 -31
- package/src/Button/Button.tsx +16 -3
- package/src/Calendar/Calendar.doc.mjs +1 -1
- package/src/Calendar/Calendar.test.tsx +4 -147
- package/src/Calendar/Calendar.tsx +61 -100
- package/src/Calendar/hooks/index.ts +6 -0
- package/src/Calendar/hooks/useCalendarRovingTabindex.ts +118 -0
- package/src/Calendar/index.ts +3 -0
- package/src/Calendar/styles.ts +9 -4
- package/src/Carousel/Carousel.test.tsx +0 -20
- package/src/Carousel/Carousel.tsx +1 -16
- package/src/Chat/ChatMessageList.doc.mjs +0 -8
- package/src/Chat/ChatMessageList.test.tsx +0 -18
- package/src/Chat/ChatMessageList.tsx +0 -16
- package/src/Chat/useTriggerMenu.tsx +0 -3
- package/src/CheckboxInput/CheckboxInput.test.tsx +25 -14
- package/src/CheckboxInput/CheckboxInput.tsx +2 -4
- package/src/CheckboxList/CheckboxList.test.tsx +14 -30
- package/src/CheckboxList/CheckboxList.tsx +3 -18
- package/src/CodeBlock/CodeBlock.tsx +33 -61
- package/src/ContextMenu/ContextMenu.doc.mjs +4 -4
- package/src/ContextMenu/ContextMenu.test.tsx +1 -155
- package/src/ContextMenu/ContextMenu.tsx +16 -113
- package/src/DateInput/DateInput.test.tsx +0 -59
- package/src/DateInput/DateInput.tsx +7 -24
- package/src/DateRangeInput/DateRangeInput.test.tsx +18 -69
- package/src/DateRangeInput/DateRangeInput.tsx +3 -7
- package/src/DateTimeInput/DateTimeInput.doc.mjs +0 -7
- package/src/DateTimeInput/DateTimeInput.test.tsx +6 -99
- package/src/DateTimeInput/DateTimeInput.tsx +3 -32
- package/src/Dialog/Dialog.tsx +0 -12
- package/src/DropdownMenu/DropdownMenu.doc.mjs +8 -1
- package/src/DropdownMenu/DropdownMenu.test.tsx +42 -56
- package/src/DropdownMenu/DropdownMenu.tsx +18 -52
- package/src/Field/Field.test.tsx +0 -32
- package/src/Field/Field.tsx +5 -23
- package/src/Field/FieldLabel.tsx +17 -53
- package/src/FileInput/FileInput.test.tsx +49 -104
- package/src/FileInput/FileInput.tsx +3 -27
- package/src/InputGroup/InputGroup.test.tsx +63 -21
- package/src/InputGroup/InputGroup.tsx +1 -4
- package/src/Kbd/Kbd.test.tsx +4 -22
- package/src/Kbd/Kbd.tsx +3 -35
- package/src/Layer/layerAnimations.stylex.ts +4 -20
- package/src/Layer/useLayer.tsx +6 -67
- package/src/Layout/padding.stylex.ts +0 -52
- package/src/Lightbox/Lightbox.test.tsx +5 -53
- package/src/Lightbox/Lightbox.tsx +4 -9
- package/src/Link/Link.doc.mjs +0 -14
- package/src/Link/Link.test.tsx +0 -32
- package/src/Link/Link.tsx +1 -12
- package/src/Markdown/Markdown.test.tsx +0 -11
- package/src/Markdown/Markdown.tsx +0 -5
- package/src/MoreMenu/MoreMenu.doc.mjs +17 -2
- package/src/MoreMenu/MoreMenu.tsx +9 -0
- package/src/MultiSelector/MultiSelector.test.tsx +8 -166
- package/src/MultiSelector/MultiSelector.tsx +17 -90
- package/src/MultiSelector/hooks.ts +0 -27
- package/src/NavMenu/NavHeadingMenu.test.tsx +1 -32
- package/src/NavMenu/NavHeadingMenu.tsx +2 -30
- package/src/NumberInput/NumberInput.test.tsx +38 -72
- package/src/NumberInput/NumberInput.tsx +1 -12
- package/src/Pagination/Pagination.test.tsx +5 -58
- package/src/Pagination/Pagination.tsx +0 -12
- package/src/Popover/usePopover.doc.mjs +3 -7
- package/src/Popover/usePopover.tsx +6 -49
- package/src/PowerSearch/PowerSearch.tsx +0 -3
- package/src/ProgressBar/ProgressBar.test.tsx +26 -34
- package/src/ProgressBar/ProgressBar.tsx +4 -3
- package/src/RadioList/RadioList.test.tsx +14 -129
- package/src/RadioList/RadioList.tsx +8 -103
- package/src/SegmentedControl/SegmentedControl.test.tsx +40 -84
- package/src/SegmentedControl/SegmentedControl.tsx +50 -33
- package/src/SegmentedControl/SegmentedControlItem.tsx +1 -4
- package/src/Selector/Selector.test.tsx +17 -146
- package/src/Selector/Selector.tsx +36 -73
- package/src/Selector/hooks.ts +0 -23
- package/src/SideNav/SideNav.test.tsx +0 -16
- package/src/SideNav/SideNavItem.tsx +4 -2
- package/src/Skeleton/Skeleton.tsx +1 -11
- package/src/Spinner/Spinner.tsx +1 -7
- package/src/Stack/Stack.doc.mjs +0 -57
- package/src/Stack/Stack.test.tsx +5 -55
- package/src/Stack/Stack.tsx +1 -53
- package/src/Stack/StackItem.test.tsx +0 -23
- package/src/Stack/StackItem.tsx +0 -20
- package/src/Switch/Switch.tsx +16 -2
- package/src/TabList/Tab.tsx +0 -6
- package/src/TabList/TabList.doc.mjs +0 -6
- package/src/TabList/TabList.test.tsx +0 -167
- package/src/TabList/TabList.tsx +9 -48
- package/src/TabList/TabListContext.ts +3 -7
- package/src/TabList/TabMenu.tsx +3 -6
- package/src/Table/Table.test.tsx +0 -10
- package/src/Table/Table.tsx +0 -5
- package/src/Table/tableContextMenu.tsx +5 -1
- package/src/TextArea/TextArea.tsx +13 -3
- package/src/Toast/Toast.tsx +0 -14
- package/src/Toast/ToastViewport.tsx +21 -167
- package/src/Toolbar/Toolbar.test.tsx +0 -45
- package/src/Toolbar/Toolbar.tsx +2 -5
- package/src/Tooltip/Tooltip.test.tsx +0 -68
- package/src/Tooltip/useTooltip.tsx +8 -55
- package/src/TreeList/TreeList.test.tsx +6 -295
- package/src/TreeList/TreeList.tsx +1 -73
- package/src/TreeList/TreeListItem.tsx +5 -51
- package/src/Typeahead/BaseTypeahead.tsx +8 -69
- package/src/Typeahead/Typeahead.test.tsx +0 -160
- package/src/hooks/index.ts +2 -28
- package/src/hooks/useClickableContainer.ts +4 -16
- package/src/hooks/useEntryAnimation.ts +4 -16
- package/src/hooks/useFocusTrap.ts +4 -98
- package/src/hooks/useGridFocus.doc.mjs +2 -40
- package/src/hooks/useGridFocus.ts +67 -343
- package/src/hooks/useListFocus.doc.mjs +10 -49
- package/src/hooks/useListFocus.ts +57 -395
- package/src/index.ts +0 -1
- package/dist/TreeList/treeListItem.markers.stylex.d.ts +0 -16
- package/dist/TreeList/treeListItem.markers.stylex.d.ts.map +0 -1
- package/dist/TreeList/treeListItem.markers.stylex.js +0 -22
- package/dist/VisuallyHidden/VisuallyHidden.d.ts +0 -61
- package/dist/VisuallyHidden/VisuallyHidden.d.ts.map +0 -1
- package/dist/VisuallyHidden/VisuallyHidden.js +0 -65
- package/dist/VisuallyHidden/index.d.ts +0 -11
- package/dist/VisuallyHidden/index.d.ts.map +0 -1
- package/dist/VisuallyHidden/index.js +0 -13
- package/dist/hooks/focusableSelector.d.ts +0 -22
- package/dist/hooks/focusableSelector.d.ts.map +0 -1
- package/dist/hooks/focusableSelector.js +0 -24
- package/dist/hooks/useAnnounce.d.ts +0 -40
- package/dist/hooks/useAnnounce.d.ts.map +0 -1
- package/dist/hooks/useAnnounce.js +0 -142
- package/dist/hooks/useKeyboardHint.d.ts +0 -79
- package/dist/hooks/useKeyboardHint.d.ts.map +0 -1
- package/dist/hooks/useKeyboardHint.js +0 -263
- package/dist/hooks/useLongPress.d.ts +0 -21
- package/dist/hooks/useLongPress.d.ts.map +0 -1
- package/dist/hooks/useLongPress.js +0 -89
- package/dist/hooks/useTreeFocus.d.ts +0 -157
- package/dist/hooks/useTreeFocus.d.ts.map +0 -1
- package/dist/hooks/useTreeFocus.js +0 -337
- package/dist/hooks/useTypeahead.d.ts +0 -63
- package/dist/hooks/useTypeahead.d.ts.map +0 -1
- package/dist/hooks/useTypeahead.js +0 -117
- package/src/Avatar/Avatar.test.tsx +0 -37
- package/src/CodeBlock/CodeBlock.test.tsx +0 -115
- package/src/Skeleton/Skeleton.test.tsx +0 -25
- package/src/Toast/ToastViewport.test.tsx +0 -204
- package/src/TreeList/treeListItem.markers.stylex.ts +0 -20
- package/src/VisuallyHidden/VisuallyHidden.doc.mjs +0 -80
- package/src/VisuallyHidden/VisuallyHidden.test.tsx +0 -76
- package/src/VisuallyHidden/VisuallyHidden.tsx +0 -113
- package/src/VisuallyHidden/index.ts +0 -15
- package/src/hooks/focusableSelector.ts +0 -25
- package/src/hooks/useAnnounce.test.tsx +0 -101
- package/src/hooks/useAnnounce.ts +0 -168
- package/src/hooks/useFocusTrap.test.tsx +0 -132
- package/src/hooks/useGridFocus.test.tsx +0 -132
- package/src/hooks/useKeyboardHint.tsx +0 -373
- package/src/hooks/useListFocus.test.tsx +0 -375
- package/src/hooks/useLongPress.test.tsx +0 -134
- package/src/hooks/useLongPress.ts +0 -119
- package/src/hooks/useTreeFocus.doc.mjs +0 -140
- package/src/hooks/useTreeFocus.test.tsx +0 -214
- package/src/hooks/useTreeFocus.ts +0 -559
- package/src/hooks/useTypeahead.test.tsx +0 -109
- package/src/hooks/useTypeahead.ts +0 -183
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @astryxdesign/core
|
|
2
2
|
|
|
3
|
-
Core UI components, theme system, and utilities for the
|
|
3
|
+
Core UI components, theme system, and utilities for the XDS design system. For project setup, see [Quick Start](#quick-start) below.
|
|
4
4
|
|
|
5
5
|
## Component Docs
|
|
6
6
|
|
|
@@ -15,9 +15,9 @@ node node_modules/@astryxdesign/core/docs.mjs --list --brief # brief summaries
|
|
|
15
15
|
## Page Layouts
|
|
16
16
|
|
|
17
17
|
Building a full page? Start with a template rather than composing from scratch.
|
|
18
|
-
Templates are content-only; they compose `
|
|
18
|
+
Templates are content-only; they compose `XDSLayout` with header, content, and
|
|
19
19
|
panel slots into common page patterns (dashboards, settings, forms, detail pages).
|
|
20
|
-
Wrap them in your own app chrome (`
|
|
20
|
+
Wrap them in your own app chrome (`XDSAppShell`, `XDSTopNav`, `XDSSideNav`) to add
|
|
21
21
|
global navigation.
|
|
22
22
|
|
|
23
23
|
Requires `@astryxdesign/cli` (`npm install -D @astryxdesign/cli`):
|
|
@@ -28,7 +28,7 @@ npx astryx template dashboard # emit full page source
|
|
|
28
28
|
npx astryx template settings --skeleton # layout skeleton with spatial annotations
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## XDS CLI
|
|
32
32
|
|
|
33
33
|
The CLI (`@astryxdesign/cli`) provides additional tooling:
|
|
34
34
|
|
|
@@ -38,11 +38,11 @@ npx astryx component Button # full docs + related block templates
|
|
|
38
38
|
npx astryx docs # reference docs (principles, tokens, theming, styling)
|
|
39
39
|
npx astryx docs theme # theming guide (Theme, defineTheme, light/dark)
|
|
40
40
|
npx astryx docs tokens # spacing, color, radius, typography token reference
|
|
41
|
-
npx astryx init # initialize
|
|
41
|
+
npx astryx init # initialize XDS in your project
|
|
42
42
|
npx astryx theme build # build theme CSS for production
|
|
43
43
|
npx astryx swizzle Button # eject component source for customization
|
|
44
44
|
npx astryx upgrade --apply # run codemods to migrate between versions
|
|
45
|
-
npx astryx discover # discover external
|
|
45
|
+
npx astryx discover # discover external XDS packages
|
|
46
46
|
npx astryx gap-report # report a missing capability
|
|
47
47
|
```
|
|
48
48
|
|
|
@@ -62,7 +62,7 @@ npx astryx gap-report # report a missing capability
|
|
|
62
62
|
|
|
63
63
|
## Quick Start
|
|
64
64
|
|
|
65
|
-
Install
|
|
65
|
+
Install XDS and a theme:
|
|
66
66
|
|
|
67
67
|
```bash
|
|
68
68
|
npm install @astryxdesign/core @astryxdesign/theme-neutral
|
|
@@ -122,7 +122,7 @@ export default function RootLayout({children}: {children: React.ReactNode}) {
|
|
|
122
122
|
|
|
123
123
|
### Next.js + Tailwind
|
|
124
124
|
|
|
125
|
-
No build plugins needed;
|
|
125
|
+
No build plugins needed; XDS ships pre-built CSS that works alongside Tailwind.
|
|
126
126
|
|
|
127
127
|
**`src/app/globals.css`**
|
|
128
128
|
|
|
@@ -150,7 +150,7 @@ The `tailwind-theme.css` import maps system tokens to Tailwind utilities via `@t
|
|
|
150
150
|
|
|
151
151
|
Some useful mappings:
|
|
152
152
|
|
|
153
|
-
| Tailwind class |
|
|
153
|
+
| Tailwind class | XDS token |
|
|
154
154
|
| --------------------------------------------------------- | ------------------------------------------------- |
|
|
155
155
|
| `text-primary` / `text-secondary` | `--color-text-primary` / `--color-text-secondary` |
|
|
156
156
|
| `bg-surface` / `bg-card` / `bg-body` | `--color-background-surface` / `card` / `body` |
|
|
@@ -160,7 +160,7 @@ Some useful mappings:
|
|
|
160
160
|
| `rounded-sm` / `rounded-md` / `rounded-lg` | `--radius-inner` / `element` / `container` |
|
|
161
161
|
| `shadow-sm` / `shadow-md` / `shadow-lg` | `--shadow-low` / `med` / `high` |
|
|
162
162
|
|
|
163
|
-
Spacing references `var(--spacing-1)` as the base unit, so `p-4` = 16px, matching
|
|
163
|
+
Spacing references `var(--spacing-1)` as the base unit, so `p-4` = 16px, matching XDS's `--spacing-4`. Arbitrary values still work as an escape hatch: `bg-[var(--color-background-surface)]`.
|
|
164
164
|
|
|
165
165
|
**`src/app/providers.tsx`**
|
|
166
166
|
|
|
@@ -204,7 +204,7 @@ That's it. Start using components:
|
|
|
204
204
|
import {Button} from '@astryxdesign/core/Button';
|
|
205
205
|
|
|
206
206
|
export default function Page() {
|
|
207
|
-
return <Button label="Hello
|
|
207
|
+
return <Button label="Hello XDS" variant="primary" />;
|
|
208
208
|
}
|
|
209
209
|
```
|
|
210
210
|
|
|
@@ -232,7 +232,7 @@ Providers and layout are the same as the Tailwind example (use `@astryxdesign/th
|
|
|
232
232
|
npm install @astryxdesign/core @astryxdesign/theme-neutral
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
-
Same CSS imports and providers as above. No build plugins needed;
|
|
235
|
+
Same CSS imports and providers as above. No build plugins needed; XDS ships pre-built.
|
|
236
236
|
|
|
237
237
|
### No build step (CDN)
|
|
238
238
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/Avatar/Avatar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAoB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAsC5C;;GAEG;AACH,KAAK,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAExE;;GAEG;AACH,KAAK,iBAAiB,GAClB,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAA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AAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAExE;;GAEG;AACH,KAAK,iBAAiB,GAClB,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,GAAG,GACH,GAAG,GACH,GAAG,CAAC;AAER;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,iBAAiB,CAAC;AAE7D;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAgBpD;AAqFD,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC5D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAsCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,EACrB,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,WAAW,EACX,IAAI,EACJ,IAAc,EACd,GAAG,EACH,MAAM,EACN,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,+BA8Eb;yBA3Fe,MAAM"}
|
package/dist/Avatar/Avatar.js
CHANGED
|
@@ -247,12 +247,7 @@ export function Avatar({
|
|
|
247
247
|
const showFallbackImage = !showImage && fallbackSrc && !fallbackError;
|
|
248
248
|
const showInitials = !showImage && !showFallbackImage && name;
|
|
249
249
|
const showIcon = !showImage && !showFallbackImage && !name;
|
|
250
|
-
|
|
251
|
-
// A meaningful accessible name comes from `alt` or `name`. With neither, the
|
|
252
|
-
// avatar is decorative — expose it as `presentation`/`aria-hidden` rather than
|
|
253
|
-
// announcing a meaningless generic "Avatar" (obs-9).
|
|
254
|
-
const accessibleName = alt || name;
|
|
255
|
-
const isDecorative = !accessibleName;
|
|
250
|
+
const accessibleName = alt || name || 'Avatar';
|
|
256
251
|
const avatarGroup = useAvatarGroup();
|
|
257
252
|
const resolvedSize = avatarGroup?.size ?? size;
|
|
258
253
|
const numericSize = useMemo(() => resolveSize(resolvedSize), [resolvedSize]);
|
|
@@ -260,9 +255,8 @@ export function Avatar({
|
|
|
260
255
|
value: numericSize,
|
|
261
256
|
children: /*#__PURE__*/_jsxs("div", {
|
|
262
257
|
ref: ref,
|
|
263
|
-
role:
|
|
264
|
-
"aria-label":
|
|
265
|
-
"aria-hidden": isDecorative || undefined,
|
|
258
|
+
role: "img",
|
|
259
|
+
"aria-label": accessibleName,
|
|
266
260
|
"data-testid": testId,
|
|
267
261
|
...mergeProps(themeProps('avatar', {
|
|
268
262
|
size: resolvedSize
|
|
@@ -272,14 +266,14 @@ export function Avatar({
|
|
|
272
266
|
...stylex.props(styles.content, dynamicStyles.size(numericSize)),
|
|
273
267
|
children: [showImage && /*#__PURE__*/_jsx("img", {
|
|
274
268
|
src: src,
|
|
275
|
-
alt:
|
|
269
|
+
alt: accessibleName,
|
|
276
270
|
onError: () => setImageError(true),
|
|
277
271
|
...{
|
|
278
272
|
className: "xh8yej3 x5yr21d xl1xv1r"
|
|
279
273
|
}
|
|
280
274
|
}), showFallbackImage && /*#__PURE__*/_jsx("img", {
|
|
281
275
|
src: fallbackSrc,
|
|
282
|
-
alt:
|
|
276
|
+
alt: accessibleName,
|
|
283
277
|
onError: () => setFallbackError(true),
|
|
284
278
|
...{
|
|
285
279
|
className: "xh8yej3 x5yr21d xl1xv1r"
|
|
@@ -59,7 +59,7 @@ export interface BreadcrumbItemProps extends Omit<BaseProps<HTMLLIElement>, 'onC
|
|
|
59
59
|
* <BreadcrumbItem isCurrent>My Project</BreadcrumbItem>
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
|
-
export declare function BreadcrumbItem({ ref, as, children, href, onClick, isCurrent: isCurrentProp, startIcon, xstyle, className, style, 'data-testid': testId,
|
|
62
|
+
export declare function BreadcrumbItem({ ref, as, children, href, onClick, isCurrent: isCurrentProp, startIcon, xstyle, className, style, 'data-testid': testId, }: BreadcrumbItemProps): React.JSX.Element;
|
|
63
63
|
export declare namespace BreadcrumbItem {
|
|
64
64
|
var displayName: string;
|
|
65
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbItem.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/BreadcrumbItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAIZ,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAO5C,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAC/C,SAAS,CAAC,aAAa,CAAC,EACxB,SAAS,CACV;IACC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC/B;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC/C;;;;OAIG;IACH,SAAS,CAA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aAAa,EACxB,SAAS,EACT,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,GACtB,EAAE,mBAAmB,qBAsIrB;yBAlJe,cAAc"}
|
|
@@ -82,27 +82,18 @@ export function BreadcrumbItem({
|
|
|
82
82
|
xstyle,
|
|
83
83
|
className,
|
|
84
84
|
style,
|
|
85
|
-
'data-testid': testId
|
|
86
|
-
...rest
|
|
85
|
+
'data-testid': testId
|
|
87
86
|
}) {
|
|
88
87
|
const ctx = use(BreadcrumbContext);
|
|
89
88
|
const LinkComponent = useLinkComponent(as);
|
|
90
89
|
const isSupporting = ctx.variant === 'supporting';
|
|
91
90
|
const liRef = useRef(null);
|
|
92
|
-
// Points at the element we render to hold the item's content (the
|
|
93
|
-
// link/button/span in the auto-candidate path). Auto-current detection sets
|
|
94
|
-
// aria-current on this instead of guessing the <li>'s last child.
|
|
95
|
-
const contentRef = useRef(null);
|
|
96
91
|
const isCurrent = isCurrentProp === true;
|
|
97
92
|
const isAutoCandidate = isCurrentProp == null;
|
|
98
93
|
|
|
99
94
|
// Auto-detect: if no sibling has aria-current="page" and this is the last
|
|
100
95
|
// non-separator item, set aria-current on our content element.
|
|
101
96
|
// Runs as useEffect (not layout) — only sets an aria attribute, no visual change.
|
|
102
|
-
// Placed on the item's content element (the link/button/span after the
|
|
103
|
-
// separator), matching where the explicit `isCurrent` path sets it, so
|
|
104
|
-
// aria-current lands on the actual interactive element — including when the
|
|
105
|
-
// last item is a link — rather than on the outer <li> (navigation-11).
|
|
106
97
|
useEffect(() => {
|
|
107
98
|
if (!isAutoCandidate) {
|
|
108
99
|
return;
|
|
@@ -121,16 +112,11 @@ export function BreadcrumbItem({
|
|
|
121
112
|
const isLast = items.length > 0 && items[items.length - 1] === li;
|
|
122
113
|
const hasExplicit = ol.querySelector('[aria-current="page"]');
|
|
123
114
|
if (isLast && !hasExplicit) {
|
|
124
|
-
|
|
125
|
-
// render path below), so set aria-current on that ref rather than
|
|
126
|
-
// assuming a positional last child. Fall back to the <li> only if the
|
|
127
|
-
// ref is somehow unresolved.
|
|
128
|
-
const target = contentRef.current ?? li;
|
|
129
|
-
target.setAttribute('aria-current', 'page');
|
|
130
|
-
return () => {
|
|
131
|
-
target.removeAttribute('aria-current');
|
|
132
|
-
};
|
|
115
|
+
li.setAttribute('aria-current', 'page');
|
|
133
116
|
}
|
|
117
|
+
return () => {
|
|
118
|
+
li.removeAttribute('aria-current');
|
|
119
|
+
};
|
|
134
120
|
});
|
|
135
121
|
const content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
136
122
|
children: [startIcon && /*#__PURE__*/_jsx("span", {
|
|
@@ -145,7 +131,6 @@ export function BreadcrumbItem({
|
|
|
145
131
|
ref: mergeRefs(ref, liRef),
|
|
146
132
|
...mergeProps(themeProps('breadcrumb-item'), stylex.props(itemStyles.root, isSupporting ? itemStyles.supportingSize : itemStyles.defaultSize, xstyle), className, style),
|
|
147
133
|
"data-testid": testId,
|
|
148
|
-
...rest,
|
|
149
134
|
children: [/*#__PURE__*/_jsx("span", {
|
|
150
135
|
"aria-hidden": "true",
|
|
151
136
|
...{
|
|
@@ -173,7 +158,6 @@ export function BreadcrumbItem({
|
|
|
173
158
|
ref: mergeRefs(ref, liRef),
|
|
174
159
|
...mergeProps(themeProps('breadcrumb-item'), stylex.props(itemStyles.root, isSupporting ? itemStyles.supportingSize : itemStyles.defaultSize, xstyle), className, style),
|
|
175
160
|
"data-testid": testId,
|
|
176
|
-
...rest,
|
|
177
161
|
children: [/*#__PURE__*/_jsx("span", {
|
|
178
162
|
"aria-hidden": "true",
|
|
179
163
|
...{
|
|
@@ -181,7 +165,6 @@ export function BreadcrumbItem({
|
|
|
181
165
|
},
|
|
182
166
|
children: ctx.separator
|
|
183
167
|
}), href != null ? /*#__PURE__*/_jsx(LinkComponent, {
|
|
184
|
-
ref: contentRef,
|
|
185
168
|
href: href,
|
|
186
169
|
onClick: onClick,
|
|
187
170
|
...{
|
|
@@ -194,7 +177,6 @@ export function BreadcrumbItem({
|
|
|
194
177
|
}[!!isSupporting << 0],
|
|
195
178
|
children: content
|
|
196
179
|
}) : onClick != null ? /*#__PURE__*/_jsx("button", {
|
|
197
|
-
ref: contentRef,
|
|
198
180
|
type: "button",
|
|
199
181
|
onClick: onClick,
|
|
200
182
|
...{
|
|
@@ -207,7 +189,6 @@ export function BreadcrumbItem({
|
|
|
207
189
|
}[!!isSupporting << 0],
|
|
208
190
|
children: content
|
|
209
191
|
}) : /*#__PURE__*/_jsx("span", {
|
|
210
|
-
ref: contentRef,
|
|
211
192
|
...{
|
|
212
193
|
0: {
|
|
213
194
|
className: "x78zum5 x6s0dn4 xzye2dw x1pd3egz x1tgivj0"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAwB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAwB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAoB3C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAoGrD,QAAA,MAAM,UAAU;;;;;;;;;;EAUd,CAAC;AAsGH;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,IAAI,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,IAAI,CAAC;IACZ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AE,SAAS,CAAC;IACrB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAuHD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,OAAqB,EACrB,IAAI,EAAE,QAAQ,EACd,IAAe,EACf,UAAkB,EAClB,SAAiB,EACjB,eAAuB,EACvB,WAAW,EACX,IAAI,EACJ,UAAkB,EAClB,QAAQ,EACR,UAAU,EACV,OAAO,EACP,IAAI,EACJ,EAAE,EACF,MAAM,EACN,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,GAAG,SAAS,CAuMzB;yBA9Ne,MAAM"}
|
package/dist/Button/Button.js
CHANGED
|
@@ -23,7 +23,6 @@ import "../theme/tokens.stylex.js";
|
|
|
23
23
|
import { colorVars, sizeVars, spacingVars, radiusVars, borderVars, durationVars, easeVars, fontWeightVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
24
24
|
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
25
25
|
import { Spinner } from "../Spinner/index.js";
|
|
26
|
-
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
27
26
|
import { EDGE_COMP_ATTR } from "../Layout/edgeCompensation.stylex.js";
|
|
28
27
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
29
28
|
import { useButtonGroup } from "../ButtonGroup/ButtonGroupContext.js";
|
|
@@ -414,7 +413,10 @@ export function Button({
|
|
|
414
413
|
},
|
|
415
414
|
children: endContent
|
|
416
415
|
})]
|
|
417
|
-
}), /*#__PURE__*/_jsx(
|
|
416
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
417
|
+
...{
|
|
418
|
+
className: "x10l6tqk x1i1rx1s xjm9jq1 x1717udv xkdpibf xb3r6kr xzpqnlu xuxw1ft xc342km"
|
|
419
|
+
},
|
|
418
420
|
role: "status",
|
|
419
421
|
"aria-live": "polite",
|
|
420
422
|
children: isLoadingState ? 'Loading' : ''
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/Calendar/Calendar.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/Calendar/Calendar.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA8C5C,YAAY,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACb,SAAS,GACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACb,SAAS,EACV,MAAM,oBAAoB,CAAC;AAI5B,+CAA+C;AAE/C,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,UAAU,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;CAC3C;AAID,UAAU,iBAAkB,SAAQ,IAAI,CACtC,SAAS,CAAC,cAAc,CAAC,EACzB,UAAU,GAAG,cAAc,CAC5B;IACC,kDAAkD;IAClD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,qDAAqD;IACrD,SAAS,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACtC,+CAA+C;IAC/C,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAEvB,4CAA4C;IAC5C,GA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G,EAAE,GAAG,KAAK,EAAC,EAAE,aAAa,+BA4RtD;yBA5Re,QAAQ"}
|
|
@@ -21,9 +21,9 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
21
21
|
import { Button } from "../Button/index.js";
|
|
22
22
|
import { Icon } from "../Icon/index.js";
|
|
23
23
|
import { useGridFocus } from "../hooks/index.js";
|
|
24
|
-
import { useCalendarDays, useCalendarConstraints } from "./hooks/index.js";
|
|
24
|
+
import { useCalendarDays, useCalendarConstraints, useCalendarRovingTabindex } from "./hooks/index.js";
|
|
25
25
|
import { calendarStyles, monthGridStyles, dayCellStyles, dayCellTheme } from "./styles.js";
|
|
26
|
-
import { plainDateFromISO, plainDateToISO, plainDateToDate, plainDateToday, plainDateSetFirstOfMonth, plainDateAddMonths, plainDateAddDays, plainDateIsBefore, plainDateIsEqual, plainDateGetWeekNumber, plainDateFormat, DATE_FORMAT_WITH_WEEKDAY, DATE_FORMAT_MONTH_YEAR } from "../utils/plainDate.js";
|
|
26
|
+
import { plainDateFromISO, plainDateToISO, plainDateToDate, plainDateFromDate, plainDateToday, plainDateSetFirstOfMonth, plainDateAddMonths, plainDateAddDays, plainDateIsBefore, plainDateIsEqual, plainDateGetWeekNumber, plainDateFormat, DATE_FORMAT_WITH_WEEKDAY, DATE_FORMAT_MONTH_YEAR } from "../utils/plainDate.js";
|
|
27
27
|
import { mergeProps } from "../utils/index.js";
|
|
28
28
|
import { computeDayCellState, computeRangeRounding, computePreviewRounding, isEndpoint } from "./dayCellUtils.js";
|
|
29
29
|
|
|
@@ -350,46 +350,32 @@ function MonthGrid({
|
|
|
350
350
|
}
|
|
351
351
|
return null;
|
|
352
352
|
}, [mode, value]);
|
|
353
|
+
const {
|
|
354
|
+
isTabbable
|
|
355
|
+
} = useCalendarRovingTabindex({
|
|
356
|
+
days,
|
|
357
|
+
today,
|
|
358
|
+
year,
|
|
359
|
+
month: month.month,
|
|
360
|
+
isDateDisabled,
|
|
361
|
+
selectedDate: selectedDateForTabindex
|
|
362
|
+
});
|
|
353
363
|
|
|
354
|
-
//
|
|
355
|
-
// live tab stop (see `hasRovingTabIndex` below) — it honors an existing
|
|
356
|
-
// `tabindex="0"` and repairs/moves it thereafter — so this only decides
|
|
357
|
-
// which day button starts tabbable. Priority: selected date (if visible and
|
|
358
|
-
// enabled) > today (if visible and enabled) > first enabled in-month day.
|
|
359
|
-
const seedTabbableIso = useMemo(() => {
|
|
360
|
-
if (selectedDateForTabindex) {
|
|
361
|
-
const isSelectedInMonth = selectedDateForTabindex.year === year && selectedDateForTabindex.month === month.month;
|
|
362
|
-
if (isSelectedInMonth && !isDateDisabled(selectedDateForTabindex)) {
|
|
363
|
-
return plainDateToISO(selectedDateForTabindex);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
const isTodayInMonth = today.year === year && today.month === month.month;
|
|
367
|
-
if (isTodayInMonth && !isDateDisabled(today)) {
|
|
368
|
-
return plainDateToISO(today);
|
|
369
|
-
}
|
|
370
|
-
for (const day of days) {
|
|
371
|
-
if (!day.isOutside && !isDateDisabled(day.date)) {
|
|
372
|
-
return day.iso;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
return null;
|
|
376
|
-
}, [days, today, year, month.month, isDateDisabled, selectedDateForTabindex]);
|
|
377
|
-
|
|
378
|
-
// Helper to get the focused date from the currently focused element.
|
|
379
|
-
// Reads the machine-readable `data-date` (ISO) attribute rather than parsing
|
|
380
|
-
// the human-readable `aria-label` with `new Date()`, which is locale/format
|
|
381
|
-
// dependent and returns Invalid Date in non-English locales (e.g. fr-FR,
|
|
382
|
-
// ja-JP), silently swallowing month-boundary arrow navigation (complex-4).
|
|
364
|
+
// Helper to get the focused date from the currently focused element
|
|
383
365
|
const getFocusedDate = useCallback(() => {
|
|
384
366
|
const activeElement = document.activeElement;
|
|
385
367
|
if (!activeElement) {
|
|
386
368
|
return null;
|
|
387
369
|
}
|
|
388
|
-
const
|
|
389
|
-
if (!
|
|
370
|
+
const ariaLabel = activeElement.getAttribute('aria-label');
|
|
371
|
+
if (!ariaLabel) {
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
374
|
+
const parsed = new Date(ariaLabel);
|
|
375
|
+
if (isNaN(parsed.getTime())) {
|
|
390
376
|
return null;
|
|
391
377
|
}
|
|
392
|
-
return
|
|
378
|
+
return plainDateToISO(plainDateFromDate(parsed));
|
|
393
379
|
}, []);
|
|
394
380
|
|
|
395
381
|
// Handle navigation to previous month
|
|
@@ -422,25 +408,13 @@ function MonthGrid({
|
|
|
422
408
|
}
|
|
423
409
|
}, [getFocusedDate, onNavigateNext]);
|
|
424
410
|
|
|
425
|
-
// Grid focus navigation
|
|
426
|
-
//
|
|
427
|
-
// The hook enumerates ALL grid cells (every `role="gridcell"`, including
|
|
428
|
-
// disabled days and empty placeholder cells) so the true 7-column geometry is
|
|
429
|
-
// preserved. `isCellFocusable` / `getFocusTarget` tell the hook which cells
|
|
430
|
-
// can take focus (those containing an enabled day button) and where to send
|
|
431
|
-
// focus (the day button inside the cell). Arrow keys move to the target
|
|
432
|
-
// row/column and, if that cell is disabled, continue in the same direction to
|
|
433
|
-
// the next enabled cell.
|
|
411
|
+
// Grid focus navigation
|
|
434
412
|
const {
|
|
435
413
|
gridRef,
|
|
436
|
-
handleKeyDown: handleGridKeyDown
|
|
437
|
-
handleFocus: handleGridFocus
|
|
414
|
+
handleKeyDown: handleGridKeyDown
|
|
438
415
|
} = useGridFocus({
|
|
439
416
|
columns: 7,
|
|
440
|
-
cellSelector: '[
|
|
441
|
-
isCellFocusable: cell => cell.querySelector('button:not([disabled])') !== null,
|
|
442
|
-
getFocusTarget: cell => cell.querySelector('button'),
|
|
443
|
-
hasRovingTabIndex: true,
|
|
417
|
+
cellSelector: 'button:not([disabled])',
|
|
444
418
|
onNavigateBefore: handleNavigatePrevious,
|
|
445
419
|
onNavigateAfter: handleNavigateNext,
|
|
446
420
|
onPageUp: handlePageUp,
|
|
@@ -454,10 +428,10 @@ function MonthGrid({
|
|
|
454
428
|
}
|
|
455
429
|
const buttons = gridRef.current.querySelectorAll('button:not([disabled])');
|
|
456
430
|
const targetPd = plainDateFromISO(pendingFocus);
|
|
457
|
-
const
|
|
431
|
+
const targetLabel = plainDateFormat(targetPd, DATE_FORMAT_WITH_WEEKDAY);
|
|
458
432
|
let targetButton = null;
|
|
459
433
|
for (const button of buttons) {
|
|
460
|
-
if (button.getAttribute('
|
|
434
|
+
if (button.getAttribute('aria-label') === targetLabel) {
|
|
461
435
|
targetButton = button;
|
|
462
436
|
break;
|
|
463
437
|
}
|
|
@@ -508,33 +482,30 @@ function MonthGrid({
|
|
|
508
482
|
const monthLabel = useMemo(() => {
|
|
509
483
|
return plainDateFormat(month, DATE_FORMAT_MONTH_YEAR);
|
|
510
484
|
}, [month]);
|
|
511
|
-
return /*#__PURE__*/
|
|
485
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
512
486
|
...stylex.props(monthGridStyles.monthGrid),
|
|
513
|
-
children: /*#__PURE__*/_jsxs("div", {
|
|
487
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
488
|
+
...stylex.props(monthGridStyles.weekHeader, hasWeekNumbers && monthGridStyles.weekHeaderWithNumbers),
|
|
489
|
+
children: [hasWeekNumbers && /*#__PURE__*/_jsx("div", {
|
|
490
|
+
...stylex.props(monthGridStyles.dayName, monthGridStyles.weekNumberHeader)
|
|
491
|
+
}), dayNames.map(name => /*#__PURE__*/_jsx("div", {
|
|
492
|
+
role: "columnheader",
|
|
493
|
+
...stylex.props(monthGridStyles.dayName),
|
|
494
|
+
children: name
|
|
495
|
+
}, name))]
|
|
496
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
514
497
|
ref: gridRef,
|
|
515
498
|
role: "grid",
|
|
516
499
|
"aria-label": monthLabel,
|
|
517
500
|
onKeyDown: handleGridKeyDown,
|
|
518
|
-
onFocus: handleGridFocus,
|
|
519
501
|
...stylex.props(monthGridStyles.daysGrid, hasWeekNumbers && monthGridStyles.daysGridWithNumbers),
|
|
520
|
-
children:
|
|
521
|
-
role: "row",
|
|
522
|
-
...stylex.props(monthGridStyles.weekRow),
|
|
523
|
-
children: [hasWeekNumbers && /*#__PURE__*/_jsx("div", {
|
|
524
|
-
...stylex.props(monthGridStyles.dayName, monthGridStyles.weekNumberHeader)
|
|
525
|
-
}), dayNames.map(name => /*#__PURE__*/_jsx("div", {
|
|
526
|
-
role: "columnheader",
|
|
527
|
-
...stylex.props(monthGridStyles.dayName),
|
|
528
|
-
children: name
|
|
529
|
-
}, name))]
|
|
530
|
-
}), weeks.map(week => {
|
|
502
|
+
children: weeks.map(week => {
|
|
531
503
|
const weekDate = week.find(d => !d.isOutside)?.date || week[0].date;
|
|
532
504
|
const weekNum = plainDateGetWeekNumber(weekDate);
|
|
533
505
|
return /*#__PURE__*/_jsxs("div", {
|
|
534
506
|
role: "row",
|
|
535
507
|
...stylex.props(monthGridStyles.weekRow),
|
|
536
508
|
children: [hasWeekNumbers && /*#__PURE__*/_jsx("div", {
|
|
537
|
-
role: "rowheader",
|
|
538
509
|
...stylex.props(monthGridStyles.weekNumber),
|
|
539
510
|
children: weekNum
|
|
540
511
|
}), week.map((day, dayIndex) => /*#__PURE__*/_jsx(DayCell, {
|
|
@@ -549,13 +520,13 @@ function MonthGrid({
|
|
|
549
520
|
today: today,
|
|
550
521
|
hasOutsideDays: hasOutsideDays,
|
|
551
522
|
isDisabled: isDateDisabled(day.date),
|
|
552
|
-
isTabbable: day.iso
|
|
523
|
+
isTabbable: isTabbable(day.iso),
|
|
553
524
|
onDayClick: onDayClick,
|
|
554
525
|
onDayHover: onDayHover
|
|
555
526
|
}, day.iso))]
|
|
556
527
|
}, plainDateToISO(weekDate));
|
|
557
|
-
})
|
|
558
|
-
})
|
|
528
|
+
})
|
|
529
|
+
})]
|
|
559
530
|
});
|
|
560
531
|
}
|
|
561
532
|
|
|
@@ -585,10 +556,7 @@ function DayCell({
|
|
|
585
556
|
dayNumber
|
|
586
557
|
} = day;
|
|
587
558
|
if (isOutside && !hasOutsideDays) {
|
|
588
|
-
// Empty placeholder cell — still a gridcell so the grid geometry stays a
|
|
589
|
-
// clean 7-per-row set for keyboard navigation.
|
|
590
559
|
return /*#__PURE__*/_jsx("div", {
|
|
591
|
-
role: "gridcell",
|
|
592
560
|
...stylex.props(dayCellStyles.cell)
|
|
593
561
|
});
|
|
594
562
|
}
|
|
@@ -609,7 +577,6 @@ function DayCell({
|
|
|
609
577
|
const rangeRounding = computeRangeRounding(state);
|
|
610
578
|
const previewRounding = computePreviewRounding(state);
|
|
611
579
|
return /*#__PURE__*/_jsxs("div", {
|
|
612
|
-
role: "gridcell",
|
|
613
580
|
...stylex.props(dayCellStyles.cell),
|
|
614
581
|
children: [state.isInRange && /*#__PURE__*/_jsx("div", {
|
|
615
582
|
...stylex.props(dayCellStyles.rangeBg, dayCellTheme.rangeBg, rangeRounding.roundLeft && dayCellStyles.rangeBgRadiusLeft, rangeRounding.roundRight && dayCellStyles.rangeBgRadiusRight, state.isRangeStart && dayCellStyles.rangeInsetLeft, state.isRangeStart && rangeRounding.roundRight && dayCellStyles.rangeInsetRight, state.isRangeEnd && dayCellStyles.rangeInsetRight, state.isRangeStart && rangeRounding.roundLeft && dayCellStyles.rangeInsetLeft)
|
|
@@ -617,13 +584,12 @@ function DayCell({
|
|
|
617
584
|
...stylex.props(dayCellStyles.previewBg, dayCellTheme.previewBg, previewRounding.roundLeft && dayCellStyles.previewBgRadiusLeft, previewRounding.roundRight && dayCellStyles.previewBgRadiusRight, state.isPreviewStart && dayCellStyles.previewStart, state.isPreviewEnd && dayCellStyles.previewEnd)
|
|
618
585
|
}), /*#__PURE__*/_jsx("button", {
|
|
619
586
|
type: "button",
|
|
587
|
+
role: "gridcell",
|
|
620
588
|
"data-date": day.iso,
|
|
621
589
|
"aria-label": plainDateFormat(date, DATE_FORMAT_WITH_WEEKDAY),
|
|
622
590
|
"aria-selected": state.isSelected || state.isInRange || undefined,
|
|
623
591
|
"aria-disabled": state.effectivelyDisabled || undefined,
|
|
624
|
-
disabled: isDisabled
|
|
625
|
-
// Initial roving tab-stop seed; useGridFocus owns it after mount.
|
|
626
|
-
,
|
|
592
|
+
disabled: isDisabled,
|
|
627
593
|
tabIndex: isTabbableDay ? 0 : -1,
|
|
628
594
|
onClick: () => !state.effectivelyDisabled && onDayClick(date),
|
|
629
595
|
onMouseEnter: () => !state.effectivelyDisabled && onDayHover(date),
|
|
@@ -12,4 +12,6 @@ export { useCalendarConstraints } from './useCalendarConstraints';
|
|
|
12
12
|
export type { UseCalendarConstraintsOptions, UseCalendarConstraintsReturn, } from './useCalendarConstraints';
|
|
13
13
|
export { useCalendarNavigation } from './useCalendarNavigation';
|
|
14
14
|
export type { UseCalendarNavigationOptions, UseCalendarNavigationReturn, } from './useCalendarNavigation';
|
|
15
|
+
export { useCalendarRovingTabindex } from './useCalendarRovingTabindex';
|
|
16
|
+
export type { UseCalendarRovingTabindexOptions, UseCalendarRovingTabindexReturn, } from './useCalendarRovingTabindex';
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Calendar/hooks/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,YAAY,EACV,WAAW,EACX,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAChE,YAAY,EACV,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EACV,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Calendar/hooks/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,YAAY,EACV,WAAW,EACX,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAChE,YAAY,EACV,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EACV,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAC;AACtE,YAAY,EACV,gCAAgC,EAChC,+BAA+B,GAChC,MAAM,6BAA6B,CAAC"}
|
|
@@ -11,4 +11,5 @@
|
|
|
11
11
|
|
|
12
12
|
export { useCalendarDays } from "./useCalendarDays.js";
|
|
13
13
|
export { useCalendarConstraints } from "./useCalendarConstraints.js";
|
|
14
|
-
export { useCalendarNavigation } from "./useCalendarNavigation.js";
|
|
14
|
+
export { useCalendarNavigation } from "./useCalendarNavigation.js";
|
|
15
|
+
export { useCalendarRovingTabindex } from "./useCalendarRovingTabindex.js";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ISODateString } from '../../utils/dateTypes';
|
|
2
|
+
import { type PlainDate } from '../../utils/plainDate';
|
|
3
|
+
import type { CalendarDay } from './useCalendarDays';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for calendar roving tabindex
|
|
6
|
+
*/
|
|
7
|
+
export interface UseCalendarRovingTabindexOptions {
|
|
8
|
+
/** All days in the grid */
|
|
9
|
+
days: CalendarDay[];
|
|
10
|
+
/** Today's date as a PlainDate */
|
|
11
|
+
today: PlainDate;
|
|
12
|
+
/** The year being displayed */
|
|
13
|
+
year: number;
|
|
14
|
+
/** The month being displayed (1-based: 1 = January, 12 = December) */
|
|
15
|
+
month: number;
|
|
16
|
+
/** Function to check if a date is disabled */
|
|
17
|
+
isDateDisabled: (date: PlainDate) => boolean;
|
|
18
|
+
/** Currently selected date (if any) */
|
|
19
|
+
selectedDate?: PlainDate | null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Return type for useCalendarRovingTabindex hook
|
|
23
|
+
*/
|
|
24
|
+
export interface UseCalendarRovingTabindexReturn {
|
|
25
|
+
/** The ISO date string of the tabbable element, or null */
|
|
26
|
+
tabbableDate: ISODateString | null;
|
|
27
|
+
/** Check if a specific date is the tabbable one */
|
|
28
|
+
isTabbable: (iso: ISODateString) => boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Hook for managing roving tabindex in calendar grids.
|
|
32
|
+
*
|
|
33
|
+
* Implements the WAI-ARIA roving tabindex pattern where only one element
|
|
34
|
+
* in a group has tabindex="0" while others have tabindex="-1".
|
|
35
|
+
*
|
|
36
|
+
* Priority for tabbable element:
|
|
37
|
+
* 1. Today if visible in the current month and enabled
|
|
38
|
+
* 2. First enabled day in the month
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```
|
|
42
|
+
* const {tabbableDate, isTabbable} = useCalendarRovingTabindex({
|
|
43
|
+
* days,
|
|
44
|
+
* today: {year: 2026, month: 1, day: 20},
|
|
45
|
+
* year: 2026,
|
|
46
|
+
* month: 1, // January (1-based)
|
|
47
|
+
* isDateDisabled,
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* // In day rendering:
|
|
51
|
+
* <button tabIndex={isTabbable(day.iso) ? 0 : -1}>
|
|
52
|
+
* {day.dayNumber}
|
|
53
|
+
* </button>
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function useCalendarRovingTabindex(options: UseCalendarRovingTabindexOptions): UseCalendarRovingTabindexReturn;
|
|
57
|
+
//# sourceMappingURL=useCalendarRovingTabindex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCalendarRovingTabindex.d.ts","sourceRoot":"","sources":["../../../src/Calendar/hooks/useCalendarRovingTabindex.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAC,KAAK,SAAS,EAAiB,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,2BAA2B;IAC3B,IAAI,EAAE,WAAW,EAAE,CAAC;IACpB,kCAAkC;IAClC,KAAK,EAAE,SAAS,CAAC;IACjB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,cAAc,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;IAC7C,uCAAuC;IACvC,YAAY,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,2DAA2D;IAC3D,YAAY,EAAE,aAAa,GAAG,IAAI,CAAC;IACnC,mDAAmD;IACnD,UAAU,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,gCAAgC,GACxC,+BAA+B,CA0CjC"}
|