@astryxdesign/core 0.4.7-canary.ecaf779 → 0.4.7-canary.fe95cd5
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 +1 -0
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +3 -2
- package/dist/AspectRatio/AspectRatio.d.ts +24 -0
- package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
- package/dist/AspectRatio/AspectRatio.js +23 -4
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +3 -2
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +3 -2
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +11 -10
- package/dist/ButtonGroup/ButtonGroup.d.ts +5 -1
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +26 -7
- package/dist/Calendar/Calendar.d.ts +3 -1
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +13 -14
- package/dist/Calendar/getInitialFocusDate.d.ts +46 -0
- package/dist/Calendar/getInitialFocusDate.d.ts.map +1 -0
- package/dist/Calendar/getInitialFocusDate.js +62 -0
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +3 -3
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +2 -3
- package/dist/Chat/ChatLayout.d.ts.map +1 -1
- package/dist/Chat/ChatLayout.js +3 -3
- package/dist/Chat/ChatMessageList.d.ts +22 -3
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +6 -3
- package/dist/Chat/useChatComposerTokens.js +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +3 -2
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +3 -3
- package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +3 -2
- package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteItem.js +3 -2
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +4 -3
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +3 -2
- package/dist/DateTimeInput/DateTimeInput.d.ts +21 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +406 -12
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.d.ts.map +1 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +41 -36
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +6 -5
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +3 -2
- package/dist/Heading/Heading.d.ts.map +1 -1
- package/dist/Heading/Heading.js +6 -2
- package/dist/HoverCard/HoverCard.d.ts +6 -0
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.d.ts +5 -0
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +67 -25
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +4 -2
- package/dist/Layer/LayerDepthContext.d.ts +52 -0
- package/dist/Layer/LayerDepthContext.d.ts.map +1 -0
- package/dist/Layer/LayerDepthContext.js +66 -0
- package/dist/Layer/index.d.ts +3 -0
- package/dist/Layer/index.d.ts.map +1 -1
- package/dist/Layer/index.js +4 -0
- package/dist/Layer/layerStack.d.ts +98 -0
- package/dist/Layer/layerStack.d.ts.map +1 -0
- package/dist/Layer/layerStack.js +306 -0
- package/dist/Layer/useLayerDismissal.d.ts +93 -0
- package/dist/Layer/useLayerDismissal.d.ts.map +1 -0
- package/dist/Layer/useLayerDismissal.js +91 -0
- package/dist/Lightbox/Lightbox.d.ts +1 -0
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +103 -81
- package/dist/Markdown/index.d.ts +1 -1
- package/dist/Markdown/index.d.ts.map +1 -1
- package/dist/Markdown/parser.d.ts +38 -1
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +149 -23
- package/dist/MobileNav/MobileNav.d.ts +6 -1
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +61 -36
- package/dist/MultiSelector/MultiSelector.d.ts +15 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +11 -6
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenu.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenu.js +3 -2
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +3 -2
- package/dist/OverflowList/OverflowList.d.ts.map +1 -1
- package/dist/OverflowList/OverflowList.js +3 -2
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +3 -2
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +20 -17
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +4 -5
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +20 -6
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +3 -2
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +3 -2
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +3 -3
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +4 -3
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +4 -3
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +3 -3
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +3 -2
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +3 -3
- package/dist/Table/plugins/pagination/useTablePagination.d.ts +3 -0
- package/dist/Table/plugins/pagination/useTablePagination.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/useTablePagination.js +21 -4
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +7 -2
- package/dist/Table/plugins/rowStatus/useTableRowStatus.d.ts.map +1 -1
- package/dist/Table/plugins/rowStatus/useTableRowStatus.js +10 -3
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +6 -2
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +3 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +3 -2
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +3 -2
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +5 -3
- package/dist/Token/TokenLink.d.ts.map +1 -1
- package/dist/Token/TokenLink.js +2 -2
- package/dist/Tooltip/Tooltip.d.ts +5 -0
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +5 -0
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +39 -24
- package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenu.js +3 -3
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +11 -3
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +3 -2
- package/dist/astryx.css +4 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useFocusTrap.d.ts +7 -4
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +60 -95
- package/dist/hooks/useMergedRefs.d.ts +18 -0
- package/dist/hooks/useMergedRefs.d.ts.map +1 -0
- package/dist/hooks/useMergedRefs.js +25 -0
- package/dist/utils/timeParser.d.ts +1 -1
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +26 -12
- package/locales/en.json +21 -1
- package/locales/pseudo.json +15 -0
- package/package.json +2 -2
- package/src/AppShell/AppShell.tsx +3 -2
- package/src/AspectRatio/AspectRatio.doc.mjs +6 -3
- package/src/AspectRatio/AspectRatio.test.tsx +57 -10
- package/src/AspectRatio/AspectRatio.tsx +40 -1
- package/src/AvatarGroup/AvatarGroup.tsx +3 -2
- package/src/BottomSheet/BottomSheetSwitcher.tsx +3 -2
- package/src/Breadcrumbs/BreadcrumbItem.tsx +9 -5
- package/src/Button/Button.doc.mjs +22 -0
- package/src/ButtonGroup/ButtonGroup.doc.mjs +10 -1
- package/src/ButtonGroup/ButtonGroup.test.tsx +391 -1
- package/src/ButtonGroup/ButtonGroup.tsx +23 -5
- package/src/Calendar/Calendar.doc.mjs +4 -3
- package/src/Calendar/Calendar.test.tsx +52 -0
- package/src/Calendar/Calendar.tsx +18 -15
- package/src/Calendar/getInitialFocusDate.test.ts +94 -0
- package/src/Calendar/getInitialFocusDate.ts +93 -0
- package/src/Carousel/Carousel.tsx +3 -2
- package/src/Chat/ChatComposerInput.tsx +5 -1
- package/src/Chat/ChatLayout.tsx +3 -2
- package/src/Chat/ChatMessageList.doc.mjs +9 -1
- package/src/Chat/ChatMessageList.test.tsx +46 -0
- package/src/Chat/ChatMessageList.tsx +28 -4
- package/src/Chat/useChatComposerTokens.ts +1 -1
- package/src/CheckboxInput/CheckboxInput.tsx +3 -2
- package/src/ClickableCard/ClickableCard.tsx +3 -2
- package/src/CodeBlock/CodeBlock.doc.mjs +6 -0
- package/src/CommandPalette/CommandPaletteInput.tsx +3 -2
- package/src/CommandPalette/CommandPaletteItem.tsx +3 -2
- package/src/ContextMenu/ContextMenu.doc.mjs +5 -0
- package/src/ContextMenu/ContextMenu.tsx +4 -3
- package/src/DateInput/DateInput.tsx +3 -2
- package/src/DateTimeInput/DateTimeInput.doc.mjs +18 -0
- package/src/DateTimeInput/DateTimeInput.test.tsx +1088 -0
- package/src/DateTimeInput/DateTimeInput.tsx +556 -24
- package/src/DateTimeInput/index.ts +1 -0
- package/src/Dialog/Dialog.doc.mjs +5 -0
- package/src/Dialog/Dialog.test.tsx +190 -1
- package/src/Dialog/Dialog.tsx +37 -38
- package/src/DropdownMenu/DropdownMenu.doc.mjs +6 -0
- package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +8 -5
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +8 -11
- package/src/Field/Field.doc.mjs +13 -2
- package/src/FileInput/FileInput.tsx +3 -2
- package/src/Heading/Heading.test.tsx +23 -1
- package/src/Heading/Heading.tsx +6 -2
- package/src/HoverCard/HoverCard.doc.mjs +5 -0
- package/src/HoverCard/HoverCard.tsx +6 -0
- package/src/HoverCard/useHoverCard.tsx +81 -30
- package/src/Item/Item.tsx +5 -4
- package/src/Layer/LayerDepthContext.tsx +62 -0
- package/src/Layer/index.ts +9 -0
- package/src/Layer/layerDismissalFamilies.test.tsx +359 -0
- package/src/Layer/layerDismissalInvariants.test.tsx +417 -0
- package/src/Layer/layerStack.ts +362 -0
- package/src/Layer/useLayerDismissal.test.tsx +469 -0
- package/src/Layer/useLayerDismissal.ts +173 -0
- package/src/Layout/Layout.doc.mjs +2 -2
- package/src/Lightbox/Lightbox.doc.mjs +12 -0
- package/src/Lightbox/Lightbox.tsx +124 -102
- package/src/Link/Link.doc.mjs +39 -0
- package/src/Markdown/Markdown.doc.mjs +5 -0
- package/src/Markdown/index.ts +1 -0
- package/src/Markdown/parser.perf.test.ts +71 -1
- package/src/Markdown/parser.test.ts +145 -2
- package/src/Markdown/parser.ts +208 -22
- package/src/MobileNav/MobileNav.tsx +62 -36
- package/src/MoreMenu/MoreMenu.doc.mjs +7 -1
- package/src/MultiSelector/MultiSelector.doc.mjs +27 -0
- package/src/MultiSelector/MultiSelector.test.tsx +85 -0
- package/src/MultiSelector/MultiSelector.tsx +40 -5
- package/src/MultiSelector/index.ts +1 -0
- package/src/NavMenu/NavHeadingMenu.tsx +3 -2
- package/src/NumberInput/NumberInput.doc.mjs +5 -0
- package/src/Outline/Outline.tsx +3 -2
- package/src/OverflowList/OverflowList.tsx +3 -2
- package/src/Overlay/Overlay.tsx +3 -2
- package/src/Popover/usePopover.tsx +31 -28
- package/src/PowerSearch/PowerSearch.doc.mjs +26 -0
- package/src/PowerSearch/PowerSearch.tsx +11 -3
- package/src/PowerSearch/PowerSearchEditPopover.test.tsx +201 -0
- package/src/PowerSearch/PowerSearchEditPopover.tsx +17 -2
- package/src/Resizable/ResizeHandle.tsx +3 -2
- package/src/SegmentedControl/SegmentedControl.tsx +3 -2
- package/src/SelectableCard/SelectableCard.tsx +3 -2
- package/src/Selector/Selector.doc.mjs +12 -1
- package/src/Selector/Selector.test.tsx +24 -1
- package/src/SideNav/SideNav.doc.mjs +6 -6
- package/src/SideNav/SideNav.tsx +4 -2
- package/src/SideNav/SideNavItem.tsx +4 -2
- package/src/Slider/Slider.tsx +3 -2
- package/src/Switch/Switch.tsx +3 -2
- package/src/TabList/TabList.tsx +3 -2
- package/src/Table/plugins/pagination/useTablePagination.test.tsx +34 -4
- package/src/Table/plugins/pagination/useTablePagination.tsx +35 -3
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +9 -2
- package/src/Table/plugins/rowStatus/useTableRowStatus.test.tsx +13 -7
- package/src/Table/plugins/rowStatus/useTableRowStatus.tsx +12 -3
- package/src/Table/useTablePagination.doc.mjs +7 -0
- package/src/Table/useTableRowStatus.doc.mjs +1 -1
- package/src/Text/Text.test.tsx +23 -1
- package/src/Text/Text.tsx +6 -2
- package/src/TextArea/TextArea.tsx +3 -2
- package/src/TextInput/TextInput.doc.mjs +10 -0
- package/src/TextInput/TextInput.tsx +3 -2
- package/src/Thumbnail/Thumbnail.doc.mjs +1 -1
- package/src/TimeInput/TimeInput.tsx +2 -2
- package/src/Timestamp/Timestamp.tsx +4 -2
- package/src/Toast/Toast.doc.mjs +6 -0
- package/src/Token/TokenLink.tsx +2 -2
- package/src/Tokenizer/Tokenizer.doc.mjs +16 -0
- package/src/Toolbar/Toolbar.doc.mjs +5 -0
- package/src/Tooltip/Tooltip.doc.mjs +5 -0
- package/src/Tooltip/Tooltip.test.tsx +32 -0
- package/src/Tooltip/Tooltip.tsx +5 -0
- package/src/Tooltip/useTooltip.tsx +47 -24
- package/src/TopNav/TopNavMegaMenu.tsx +3 -2
- package/src/Typeahead/BaseTypeahead.tsx +11 -2
- package/src/Typeahead/Typeahead.doc.mjs +5 -0
- package/src/Typeahead/Typeahead.test.tsx +49 -0
- package/src/Typeahead/Typeahead.tsx +3 -2
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useContainerReveal.doc.mjs +2 -2
- package/src/hooks/useFocusTrap.test.tsx +14 -0
- package/src/hooks/useFocusTrap.ts +62 -111
- package/src/hooks/useFocusTrapEscapeShim.test.tsx +165 -0
- package/src/hooks/useMergedRefs.doc.mjs +79 -0
- package/src/hooks/useMergedRefs.test.tsx +62 -0
- package/src/hooks/useMergedRefs.ts +36 -0
- package/src/utils/timeParser.test.ts +6 -1
- package/src/utils/timeParser.ts +35 -13
- package/src/__tests__/inputWidthContract.test.tsx +0 -69
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
**The exit ran on the entrance's curve.** `--ease-standard` is `cubic-bezier(0.24, 1, 0.4, 1)`, a decelerate curve: it spends its speed immediately and coasts. Right for an entrance, wrong for an exit. Measured on device (iPhone, real Safari), a scrim tap put the sheet half off-screen in 59ms of the 410ms transition and 90% off in 163ms, with the dim gone before it — so the close was over before the eye could follow it. The closing state now carries an accelerating curve of its own, `cubic-bezier(0.3, 0, 0.6, 0.6)`: away from rest, gathering speed, quickest as it leaves the screen, and moving within ~50ms so it reads as one departure rather than a hesitation and a snap. Only the curve changes — the exit keeps `--duration-medium`, the entrance's band, which is what keeps it legible under a theme that scales the motion scale down (neutral's medium is 300ms against the base 410ms).
|
|
14
14
|
|
|
15
15
|
The scrim leaves with the sheet: while closing, the dim runs `linear` rather than the decelerate token. A fade covers no distance, so front-loading its progress just ends it early — the reasoning the touch date picker's surface swap already carries. `BottomSheetSwitcher` gets the same treatment when its flow closes; a handoff between two sheets is not a close and is unchanged.
|
|
16
|
+
|
|
16
17
|
- `useListFocus` no longer swallows Escape when no `onEscape` was supplied. The hook called `preventDefault()` on every Escape — a habit inherited from the arrow keys, which share the handler and need it to suppress page scroll — so a list with nothing to dismiss still marked the key handled, and a surrounding layer that defers to `defaultPrevented` (a focus trap, a native popover) never got its turn. Escape is now consumed only when an `onEscape` is passed. Arrow, Home and End handling is unchanged (#5346).
|
|
17
18
|
Behaviour change: `AvatarGroup`, `ButtonGroup`, `Outline`, `Pagination`, `SegmentedControl`, `TabList` and `Toolbar` pass no `onEscape`, so an Escape pressed inside one of them now reaches the surrounding layer and can dismiss it — the point of the fix, but a host that counted on the key stopping there will notice. `NavHeadingMenu` does the same when it renders without a menu close handler. Menus and flyouts that do pass `onEscape` are unaffected. `patch`, not `[breaking]`: the swallowing was never a contract — the hook documented Escape only as "custom callback", and no component advertised consuming the key.
|
|
18
19
|
- TabList: the selected tab now carries `aria-current="true"` — ARIA's generic "current item within a set" — instead of `aria-current="page"`. The strip is a `<nav>` and stays one, but it is used to switch views in place at least as often as it is used to navigate, and on those uses `page` asserted a page change that never happened. Assistive tech announced the selected tab as the _current page_ even when nothing had navigated; it now announces it as the _current item_, which is true either way. A tab given an `href` still renders an anchor and still reads as a link — its current marker is just less specific than it was. No role changes and no new props. (#5347)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../src/AppShell/AppShell.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAmBf,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAO5C,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../src/AppShell/AppShell.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAmBf,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAO5C,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAC;AA+BhD;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAE7D;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,kBAAkB,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAEzC;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;;OAGG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAEhC;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAE1B;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC;IAE7B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEzB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,eAAe,GAAG,SAAS,CAAC;IAEhD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AA2KD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CAAC,EACvB,OAAoB,EACpB,MAAM,EACN,QAAQ,EACR,cAAc,EACd,aAAa,EAAE,UAAU,EACzB,MAAe,EACf,SAAS,EACT,OAAO,EACP,MAAM,EACN,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,aAAa,qBA6Yf;yBA5Ze,QAAQ"}
|
|
@@ -33,12 +33,13 @@ import { SideNavRenderContext } from "../SideNav/SideNavRenderContext.js";
|
|
|
33
33
|
import { TopNavRenderContext } from "../TopNav/TopNavRenderContext.js";
|
|
34
34
|
import { TopNavMobileContentContext } from "../TopNav/TopNavMobileContentContext.js";
|
|
35
35
|
import { AppShellMobileContext } from "./AppShellMobileContext.js";
|
|
36
|
-
import { mergeProps,
|
|
36
|
+
import { mergeProps, isRenderable } from "../utils/index.js";
|
|
37
37
|
import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
38
38
|
import { useMediaQuery } from "../hooks/useMediaQuery.js";
|
|
39
39
|
import { observeResize, unobserveResize } from "../utils/sharedResizeObserver.js";
|
|
40
40
|
import { themeProps } from "../utils/themeProps.js";
|
|
41
41
|
import { useTranslator } from "../i18n/index.js";
|
|
42
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
42
43
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
43
44
|
const HasActivity = typeof React.Activity !== 'undefined';
|
|
44
45
|
const ActivityWrapper = HasActivity ? ({
|
|
@@ -493,7 +494,7 @@ export function AppShell({
|
|
|
493
494
|
value: mobileContextValue,
|
|
494
495
|
children: /*#__PURE__*/_jsxs("div", {
|
|
495
496
|
...rest,
|
|
496
|
-
ref:
|
|
497
|
+
ref: useMergedRefs(ref, shellRef),
|
|
497
498
|
"data-testid": dataTestId,
|
|
498
499
|
...mergeProps(themeProps('app-shell', {
|
|
499
500
|
variant
|
|
@@ -34,6 +34,25 @@ export interface AspectRatioProps extends BaseProps<HTMLDivElement> {
|
|
|
34
34
|
ref?: React.Ref<HTMLDivElement>;
|
|
35
35
|
/**
|
|
36
36
|
* The aspect ratio as width/height (e.g., 16/9 = 1.777..., 4/3 = 1.333..., 1 for square).
|
|
37
|
+
*
|
|
38
|
+
* The ratio is emitted as a class-level declaration — never an inline
|
|
39
|
+
* style — so it can be made responsive:
|
|
40
|
+
* - StyleX consumers pass an `aspect-ratio` rule via `xstyle`, including
|
|
41
|
+
* under `@media`/`@container` conditions.
|
|
42
|
+
* - Plain-CSS/Tailwind consumers override `aspect-ratio` from their own
|
|
43
|
+
* (unlayered) rules: the compiled component styles live in the
|
|
44
|
+
* `astryx-base` cascade layer, and unlayered CSS wins over layered
|
|
45
|
+
* rules regardless of specificity.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```
|
|
49
|
+
* // 3:1 hero that becomes 3:2 when its container stacks
|
|
50
|
+
* <AspectRatio ratio={3 / 1} className="gallery-hero">…</AspectRatio>
|
|
51
|
+
*
|
|
52
|
+
* // CSS: @container gallery (max-width: 720px) {
|
|
53
|
+
* // .gallery-hero { aspect-ratio: 3 / 2; }
|
|
54
|
+
* // }
|
|
55
|
+
* ```
|
|
37
56
|
*/
|
|
38
57
|
ratio: number;
|
|
39
58
|
/**
|
|
@@ -102,6 +121,11 @@ export interface AspectRatioProps extends BaseProps<HTMLDivElement> {
|
|
|
102
121
|
* `ratio={1}` or an oval at other ratios. Both shapes respect the provided
|
|
103
122
|
* `ratio`.
|
|
104
123
|
*
|
|
124
|
+
* The ratio is a class-level declaration (not an inline style), so it can be
|
|
125
|
+
* overridden responsively — via `xstyle` for StyleX consumers, or with a
|
|
126
|
+
* plain unlayered `aspect-ratio` rule for plain-CSS consumers (component
|
|
127
|
+
* styles live in the `astryx-base` cascade layer, which unlayered CSS beats).
|
|
128
|
+
*
|
|
105
129
|
* Sizing: the box takes its width from its container and derives its height
|
|
106
130
|
* from the ratio, so it needs an ancestor with a definite width. Two
|
|
107
131
|
* consequences are worth knowing. Constraining only the height (`height` or
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AspectRatio.d.ts","sourceRoot":"","sources":["../../src/AspectRatio/AspectRatio.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,SAAS,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE5D,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC
|
|
1
|
+
{"version":3,"file":"AspectRatio.d.ts","sourceRoot":"","sources":["../../src/AspectRatio/AspectRatio.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,SAAS,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE5D,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAEzB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,GAAG,CAAC,EAAE,cAAc,CAAC;IAErB;;;;;;;OAOG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAgDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,KAAmB,EACnB,GAAG,EACH,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,gBAAgB,+BA4BlB;yBAtCe,WAAW"}
|
|
@@ -49,6 +49,23 @@ const styles = {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
+
// The ratio compiles to a CSS variable + a class-level declaration
|
|
53
|
+
// (aspect-ratio: var(--x)) instead of a raw inline style, so consumer
|
|
54
|
+
// overrides — `xstyle` rules, including ones inside @media/@container
|
|
55
|
+
// queries — can still win. A raw inline `aspect-ratio` would beat any class
|
|
56
|
+
// (same rationale as Grid's dynamic track values). Non-StyleX consumers
|
|
57
|
+
// don't need a dedicated hook: the compiled declaration sits in the
|
|
58
|
+
// `astryx-base` cascade layer, so any unlayered consumer rule wins
|
|
59
|
+
// regardless of specificity.
|
|
60
|
+
const dynamicStyles = {
|
|
61
|
+
ratio: ratio => [{
|
|
62
|
+
kOBAk4: ratio != null ? "x10y9f9r" : ratio,
|
|
63
|
+
$$css: true
|
|
64
|
+
}, {
|
|
65
|
+
"--x-aspectRatio": ratio != null ? ratio : undefined
|
|
66
|
+
}]
|
|
67
|
+
};
|
|
68
|
+
|
|
52
69
|
/**
|
|
53
70
|
* AspectRatio component for maintaining a specific aspect ratio for its children.
|
|
54
71
|
*
|
|
@@ -64,6 +81,11 @@ const styles = {
|
|
|
64
81
|
* `ratio={1}` or an oval at other ratios. Both shapes respect the provided
|
|
65
82
|
* `ratio`.
|
|
66
83
|
*
|
|
84
|
+
* The ratio is a class-level declaration (not an inline style), so it can be
|
|
85
|
+
* overridden responsively — via `xstyle` for StyleX consumers, or with a
|
|
86
|
+
* plain unlayered `aspect-ratio` rule for plain-CSS consumers (component
|
|
87
|
+
* styles live in the `astryx-base` cascade layer, which unlayered CSS beats).
|
|
88
|
+
*
|
|
67
89
|
* Sizing: the box takes its width from its container and derives its height
|
|
68
90
|
* from the ratio, so it needs an ancestor with a definite width. Two
|
|
69
91
|
* consequences are worth knowing. Constraining only the height (`height` or
|
|
@@ -102,10 +124,7 @@ export function AspectRatio({
|
|
|
102
124
|
ref: ref,
|
|
103
125
|
...mergeProps(themeProps('aspect-ratio', {
|
|
104
126
|
shape
|
|
105
|
-
}), stylex.props(styles.container, shape === 'ellipse' && styles.ellipse, xstyle), className,
|
|
106
|
-
...style,
|
|
107
|
-
aspectRatio: ratio
|
|
108
|
-
}),
|
|
127
|
+
}), stylex.props(styles.container, dynamicStyles.ratio(ratio), shape === 'ellipse' && styles.ellipse, xstyle), className, style),
|
|
109
128
|
...props,
|
|
110
129
|
children: /*#__PURE__*/_jsx("div", {
|
|
111
130
|
"data-astryx-aspect-ratio-override": fit,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarGroup.d.ts","sourceRoot":"","sources":["../../src/AvatarGroup/AvatarGroup.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAA2B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAc,KAAK,UAAU,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"AvatarGroup.d.ts","sourceRoot":"","sources":["../../src/AvatarGroup/AvatarGroup.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAA2B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAc,KAAK,UAAU,EAAC,MAAM,WAAW,CAAC;AAcvD,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjE,yCAAyC;IACzC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AASD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,IAAW,EACX,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,kBAAkB,EAChC,kBAAkB,EAAE,wBAAwB,EAC5C,SAAS,EACT,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,gBAAgB,GAAG,SAAS,CAmE9B;yBAhFe,WAAW"}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import { useId, useMemo, useState } from 'react';
|
|
27
27
|
import { resolveSize } from "../Avatar/index.js";
|
|
28
28
|
import * as stylex from '@stylexjs/stylex';
|
|
29
|
-
import { mergeProps
|
|
29
|
+
import { mergeProps } from "../utils/index.js";
|
|
30
30
|
import { composeEventHandlers } from "../utils/composeEventHandlers.js";
|
|
31
31
|
import { AvatarGroupContext } from "./AvatarGroupContext.js";
|
|
32
32
|
import { themeProps } from "../utils/themeProps.js";
|
|
@@ -34,6 +34,7 @@ import { useTranslator } from "../i18n/index.js";
|
|
|
34
34
|
import { useListFocus } from "../hooks/useListFocus.js";
|
|
35
35
|
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
36
36
|
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
37
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
37
38
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
38
39
|
const OVERLAP_RATIO = 0.25;
|
|
39
40
|
const styles = {
|
|
@@ -118,7 +119,7 @@ export function AvatarGroup({
|
|
|
118
119
|
value: contextValue,
|
|
119
120
|
children: /*#__PURE__*/_jsxs("div", {
|
|
120
121
|
...props,
|
|
121
|
-
ref:
|
|
122
|
+
ref: useMergedRefs(ref, listRef),
|
|
122
123
|
role: "group",
|
|
123
124
|
"aria-label": ariaLabel,
|
|
124
125
|
"aria-describedby": describedBy,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetSwitcher.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetSwitcher.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"BottomSheetSwitcher.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetSwitcher.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAqI5C,MAAM,WAAW,wBAAyB,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC5E,iDAAiD;IACjD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAEnC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAE9D;;;;;OAKG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B,iEAAiE;IACjE,mBAAmB,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAEtD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,0DAA0D;IAC1D,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,mBAAmB,EACnB,QAAe,EACf,QAAQ,EACR,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,QAAQ,EACR,OAAO,EACP,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,+BA+Z1B;yBA5ae,mBAAmB"}
|
|
@@ -34,9 +34,10 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
34
34
|
import "../theme/tokens.stylex.js";
|
|
35
35
|
import { colorVars, durationVars, easeVars } from "../theme/tokens.stylex.js";
|
|
36
36
|
import { hasActiveFocusTrapEscape, isImeKeyEvent, useFocusTrap, useScrollLock } from "../hooks/index.js";
|
|
37
|
-
import { composeEventHandlers, mergeProps
|
|
37
|
+
import { composeEventHandlers, mergeProps } from "../utils/index.js";
|
|
38
38
|
import { BottomSheetEdgeTint } from "./BottomSheetEdgeTint.js";
|
|
39
39
|
import { BottomSheetSwitcherContext } from "./BottomSheetSwitcherContext.js";
|
|
40
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
40
41
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
41
42
|
const styles = {
|
|
42
43
|
dialog: {
|
|
@@ -400,7 +401,7 @@ export function BottomSheetSwitcher({
|
|
|
400
401
|
children: /*#__PURE__*/_jsxs("dialog", {
|
|
401
402
|
...props,
|
|
402
403
|
...dialogPresentationProps,
|
|
403
|
-
ref:
|
|
404
|
+
ref: useMergedRefs(ref, dialogRef, containerRef),
|
|
404
405
|
"aria-label": ariaLabel,
|
|
405
406
|
"aria-modal": isModal ? 'true' : undefined,
|
|
406
407
|
onCancel: composeEventHandlers(onCancel, handleCancel),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbItem.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/BreadcrumbItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BreadcrumbItem.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/BreadcrumbItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,MAAM,OAAO,CAAC;AAWf,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAS5C,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,qCAAqC,CAAC;AAM7C,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,8BAA8B,CAAC;AAOrE,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,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,EAAE,kBAAkB,EAAE,GAAG,SAAS,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B;AAyHD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,EAC7B,GAAG,EACH,EAAE,EACF,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,SAAS,EAAE,aAAa,EACxB,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,IAAI,EACR,EAAE,mBAAmB,qBAsMrB;yBArNe,cAAc"}
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
import React, { use, useCallback, useId, useMemo, useRef, useEffect } from 'react';
|
|
25
25
|
import * as stylex from '@stylexjs/stylex';
|
|
26
26
|
import "../theme/tokens.stylex.js";
|
|
27
|
-
import { colorVars, spacingVars, typeScaleVars, radiusVars } from "../theme/tokens.stylex.js";
|
|
27
|
+
import { colorVars, spacingVars, typeScaleVars, radiusVars, fontWeightVars } from "../theme/tokens.stylex.js";
|
|
28
28
|
import { BreadcrumbContext } from "./Breadcrumbs.js";
|
|
29
29
|
import { useLinkComponent } from "../Link/useLinkComponent.js";
|
|
30
|
-
import { mergeProps
|
|
30
|
+
import { mergeProps } from "../utils/index.js";
|
|
31
31
|
import { themeProps } from "../utils/themeProps.js";
|
|
32
32
|
import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
33
33
|
import { Icon } from "../Icon/index.js";
|
|
@@ -38,7 +38,7 @@ import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
|
|
|
38
38
|
import { renderDropdownItems } from "../DropdownMenu/renderDropdownItems.js";
|
|
39
39
|
import { DropdownMenuContext } from "../DropdownMenu/DropdownMenuContext.js";
|
|
40
40
|
import { MENU_ITEM_ROLES, MENU_ITEM_SELECTOR, MENU_BOUNDARY_SELECTOR } from "../DropdownMenu/menuItemRoles.js";
|
|
41
|
-
|
|
41
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
42
42
|
// =============================================================================
|
|
43
43
|
// Props
|
|
44
44
|
// =============================================================================
|
|
@@ -203,6 +203,7 @@ export function BreadcrumbItem({
|
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
|
+
const mergedItemRef = useMergedRefs(ref, liRef);
|
|
206
207
|
const content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
207
208
|
children: [startIcon && /*#__PURE__*/_jsx("span", {
|
|
208
209
|
...{
|
|
@@ -213,7 +214,7 @@ export function BreadcrumbItem({
|
|
|
213
214
|
});
|
|
214
215
|
if (isCurrent) {
|
|
215
216
|
return /*#__PURE__*/_jsxs("li", {
|
|
216
|
-
ref:
|
|
217
|
+
ref: mergedItemRef,
|
|
217
218
|
...mergeProps(themeProps('breadcrumb-item', {
|
|
218
219
|
variant: ctx.variant
|
|
219
220
|
}), stylex.props(itemStyles.root, isSupporting ? itemStyles.supportingSize : itemStyles.defaultSize, xstyle), className, style),
|
|
@@ -240,10 +241,10 @@ export function BreadcrumbItem({
|
|
|
240
241
|
}) : /*#__PURE__*/_jsx("span", {
|
|
241
242
|
...{
|
|
242
243
|
0: {
|
|
243
|
-
className: "x78zum5 x6s0dn4 xzye2dw
|
|
244
|
+
className: "x78zum5 x6s0dn4 xzye2dw x2mo6ok x1tgivj0"
|
|
244
245
|
},
|
|
245
246
|
1: {
|
|
246
|
-
className: "x78zum5 x6s0dn4 xzye2dw
|
|
247
|
+
className: "x78zum5 x6s0dn4 xzye2dw x2mo6ok xv1l7n4"
|
|
247
248
|
}
|
|
248
249
|
}[!!isSupporting << 0],
|
|
249
250
|
"aria-current": "page",
|
|
@@ -255,7 +256,7 @@ export function BreadcrumbItem({
|
|
|
255
256
|
// Items without isCurrent set render as links (if href) or plain spans.
|
|
256
257
|
// The effect handles adding aria-current for auto-last detection.
|
|
257
258
|
return /*#__PURE__*/_jsxs("li", {
|
|
258
|
-
ref:
|
|
259
|
+
ref: mergedItemRef,
|
|
259
260
|
...mergeProps(themeProps('breadcrumb-item', {
|
|
260
261
|
variant: ctx.variant
|
|
261
262
|
}), stylex.props(itemStyles.root, isSupporting ? itemStyles.supportingSize : itemStyles.defaultSize, xstyle), className, style),
|
|
@@ -290,10 +291,10 @@ export function BreadcrumbItem({
|
|
|
290
291
|
ref: contentRef,
|
|
291
292
|
...{
|
|
292
293
|
0: {
|
|
293
|
-
className: "x78zum5 x6s0dn4 xzye2dw
|
|
294
|
+
className: "x78zum5 x6s0dn4 xzye2dw x2mo6ok x1tgivj0"
|
|
294
295
|
},
|
|
295
296
|
1: {
|
|
296
|
-
className: "x78zum5 x6s0dn4 xzye2dw
|
|
297
|
+
className: "x78zum5 x6s0dn4 xzye2dw x2mo6ok xv1l7n4"
|
|
297
298
|
}
|
|
298
299
|
}[!!isSupporting << 0],
|
|
299
300
|
children: content
|
|
@@ -408,7 +409,7 @@ function BreadcrumbMenuTrigger({
|
|
|
408
409
|
const menuContent = Array.isArray(menu) ? renderDropdownItems(menu) : menu;
|
|
409
410
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
410
411
|
children: [/*#__PURE__*/_jsxs("button", {
|
|
411
|
-
ref:
|
|
412
|
+
ref: useMergedRefs(ref, buttonRef, popover.triggerRef),
|
|
412
413
|
type: "button",
|
|
413
414
|
onClick: handleClick,
|
|
414
415
|
onKeyDown: handleKeyDown,
|
|
@@ -67,6 +67,10 @@ export interface ButtonGroupProps extends BaseProps<HTMLDivElement> {
|
|
|
67
67
|
* Children automatically detect the group via context and apply position-aware
|
|
68
68
|
* styles in pure CSS.
|
|
69
69
|
*
|
|
70
|
+
* The group is a single tab stop: arrow keys move between members along the
|
|
71
|
+
* orientation, Home/End jump to the ends, focus wraps, and disabled members are
|
|
72
|
+
* skipped (the APG roving tabindex technique, via `useListFocus`).
|
|
73
|
+
*
|
|
70
74
|
* Members that render their own layer — a Button with a `tooltip`, or a
|
|
71
75
|
* DropdownMenu — compose correctly, including as the trailing member.
|
|
72
76
|
*
|
|
@@ -90,7 +94,7 @@ export interface ButtonGroupProps extends BaseProps<HTMLDivElement> {
|
|
|
90
94
|
* </ButtonGroup>
|
|
91
95
|
* ```
|
|
92
96
|
*/
|
|
93
|
-
export declare function ButtonGroup({ children, label, orientation, size: sizeProp, isDisabled, elevation, xstyle, className, style, ref, 'data-testid': testId, onKeyDown, ...props }: ButtonGroupProps): ReactNode;
|
|
97
|
+
export declare function ButtonGroup({ children, label, orientation, size: sizeProp, isDisabled, elevation, xstyle, className, style, ref, 'data-testid': testId, onKeyDown, onFocus, ...props }: ButtonGroupProps): ReactNode;
|
|
94
98
|
export declare namespace ButtonGroup {
|
|
95
99
|
var displayName: string;
|
|
96
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../src/ButtonGroup/ButtonGroup.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAE9C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAE1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAI9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../src/ButtonGroup/ButtonGroup.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAE9C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAE1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAI9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,sBAAsB,CAAC;AAQjE,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjE,yCAAyC;IACzC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,WAAW,CAAC,EAAE,sBAAsB,CAAC;IAErC;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAwCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,KAAK,EACL,WAA0B,EAC1B,IAAI,EAAE,QAAQ,EACd,UAAkB,EAClB,SAAkB,EAClB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,EAAE,gBAAgB,GAAG,SAAS,CAoD9B;yBAnEe,WAAW"}
|
|
@@ -26,10 +26,10 @@ import "../theme/tokens.stylex.js";
|
|
|
26
26
|
import { radiusVars, shadowVars } from "../theme/tokens.stylex.js";
|
|
27
27
|
import { SizeProvider, useSize } from "../SizeContext/SizeContext.js";
|
|
28
28
|
import { useListFocus } from "../hooks/useListFocus.js";
|
|
29
|
-
import { mergeProps,
|
|
29
|
+
import { mergeProps, composeEventHandlers } from "../utils/index.js";
|
|
30
30
|
import { ButtonGroupContext } from "./ButtonGroupContext.js";
|
|
31
31
|
import { themeProps } from "../utils/themeProps.js";
|
|
32
|
-
|
|
32
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
33
33
|
// =============================================================================
|
|
34
34
|
// Props
|
|
35
35
|
// =============================================================================
|
|
@@ -87,6 +87,10 @@ const elevationStyles = {
|
|
|
87
87
|
* Children automatically detect the group via context and apply position-aware
|
|
88
88
|
* styles in pure CSS.
|
|
89
89
|
*
|
|
90
|
+
* The group is a single tab stop: arrow keys move between members along the
|
|
91
|
+
* orientation, Home/End jump to the ends, focus wraps, and disabled members are
|
|
92
|
+
* skipped (the APG roving tabindex technique, via `useListFocus`).
|
|
93
|
+
*
|
|
90
94
|
* Members that render their own layer — a Button with a `tooltip`, or a
|
|
91
95
|
* DropdownMenu — compose correctly, including as the trailing member.
|
|
92
96
|
*
|
|
@@ -123,15 +127,28 @@ export function ButtonGroup({
|
|
|
123
127
|
ref,
|
|
124
128
|
'data-testid': testId,
|
|
125
129
|
onKeyDown,
|
|
130
|
+
onFocus,
|
|
126
131
|
...props
|
|
127
132
|
}) {
|
|
128
133
|
const size = useSize(sizeProp, 'md');
|
|
129
134
|
const {
|
|
130
135
|
listRef,
|
|
131
|
-
handleKeyDown
|
|
136
|
+
handleKeyDown,
|
|
137
|
+
handleFocus
|
|
132
138
|
} = useListFocus({
|
|
133
|
-
|
|
134
|
-
|
|
139
|
+
// Roving rewrites `tabindex` on every item, so the selector cannot key off
|
|
140
|
+
// a value: `[tabindex="0"]` would drop each member the moment it is
|
|
141
|
+
// stamped -1. `a[href]` catches a Button rendered with `href`.
|
|
142
|
+
itemSelector: 'button, a[href], [tabindex]',
|
|
143
|
+
// A member's layer renders inline inside the group (useLayer does not
|
|
144
|
+
// portal it), so a key pressed in an open DropdownMenu bubbles here. The
|
|
145
|
+
// boundary is the group's own root or any layer, whichever is nearer to
|
|
146
|
+
// the target. Naming the group's own root is what keeps a group rendered
|
|
147
|
+
// inside a Popover or Toast working: bailing on any [popover] ancestor
|
|
148
|
+
// instead would swallow every arrow key it owns.
|
|
149
|
+
boundarySelector: '[role="group"], [popover]',
|
|
150
|
+
orientation,
|
|
151
|
+
hasRovingTabIndex: true
|
|
135
152
|
});
|
|
136
153
|
const contextValue = useMemo(() => ({
|
|
137
154
|
orientation,
|
|
@@ -142,15 +159,17 @@ export function ButtonGroup({
|
|
|
142
159
|
children: /*#__PURE__*/_jsx(SizeProvider, {
|
|
143
160
|
value: size,
|
|
144
161
|
children: /*#__PURE__*/_jsx("div", {
|
|
145
|
-
ref:
|
|
162
|
+
ref: useMergedRefs(ref, listRef),
|
|
146
163
|
...props,
|
|
147
164
|
...mergeProps(themeProps('button-group', {
|
|
148
165
|
size,
|
|
149
|
-
orientation
|
|
166
|
+
orientation,
|
|
167
|
+
elevation
|
|
150
168
|
}), stylex.props(styles.group, orientation === 'vertical' && styles.vertical, elevationStyles[elevation], xstyle), className, style),
|
|
151
169
|
role: "group",
|
|
152
170
|
"aria-label": label,
|
|
153
171
|
onKeyDown: composeEventHandlers(onKeyDown, handleKeyDown),
|
|
172
|
+
onFocus: composeEventHandlers(onFocus, handleFocus),
|
|
154
173
|
"aria-disabled": isDisabled || undefined,
|
|
155
174
|
"data-testid": testId,
|
|
156
175
|
children: children
|
|
@@ -41,7 +41,9 @@ interface CalendarBaseProps extends Omit<BaseProps<HTMLDivElement>, 'onChange' |
|
|
|
41
41
|
minRangeSpan?: number;
|
|
42
42
|
/**
|
|
43
43
|
* Controlled focus date (which month is visible).
|
|
44
|
-
* If not provided, defaults to selected date
|
|
44
|
+
* If not provided, defaults to the selected date, else today clamped into
|
|
45
|
+
* the `min`/`max` window (so a window that excludes today opens on the
|
|
46
|
+
* bound nearest to it, not on an all-disabled month).
|
|
45
47
|
*/
|
|
46
48
|
focusDate?: ISODateString;
|
|
47
49
|
/** Callback when visible month changes via navigation */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/Calendar/Calendar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/Calendar/Calendar.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAgD5C,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;AAK5B,+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,GAAG,CAAC,EAAE,aAAa,CAAC;IAEpB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,aAAa,CAAC;IAEpB;;;OAGG;IACH,eAAe,CAAC,EAAE,aAAa,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAEzD;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAE1B,yDAAyD;IACzD,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,IAAI,CAAC;IAEvD;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;CAC1C;AAID,UAAU,mBAAoB,SAAQ,iBAAiB;IACrD,qBAAqB;IACrB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAEhB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,aAAa,CAAC;IAEtB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,aAAa,CAAC;IAE7B,qCAAqC;IACrC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,KAAK,IAAI,CAAC;CAC9D;AAED,UAAU,kBAAmB,SAAQ,iBAAiB;IACpD,qBAAqB;IACrB,IAAI,EAAE,OAAO,CAAC;IAEd,0BAA0B;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,SAAS,CAAC;IAEzB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAMrE;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,EAAC,GAAG,EAAE,GAAG,KAAK,EAAC,EAAE,aAAa,+BAsXtD;yBAtXe,QAAQ"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* SYNC: When modified, update these files to stay in sync:
|
|
13
13
|
* - /packages/core/src/Calendar/Calendar.doc.mjs (props table, features, implementation notes)
|
|
14
|
+
* - /packages/core/src/Calendar/getInitialFocusDate.ts (which month the calendar opens on)
|
|
14
15
|
* - /packages/core/src/Calendar/Calendar.test.tsx (tests for new/changed behavior)
|
|
15
16
|
* - /packages/core/src/Calendar/index.ts (exports if types change)
|
|
16
17
|
* - /apps/storybook/stories/Calendar.stories.tsx (storybook stories)
|
|
@@ -26,6 +27,7 @@ import { calendarStyles, monthGridStyles, dayCellStyles, dayCellTheme } from "./
|
|
|
26
27
|
import { plainDateFromISO, plainDateToISO, plainDateToDate, plainDateToday, plainDateSetFirstOfMonth, plainDateAddMonths, plainDateAddDays, plainDateIsBefore, plainDateIsEqual, plainDateGetWeekNumber, plainDateFormat, DATE_FORMAT_WITH_WEEKDAY, DATE_FORMAT_MONTH_YEAR } from "../utils/plainDate.js";
|
|
27
28
|
import { mergeProps, composeEventHandlers, rtlStyles } from "../utils/index.js";
|
|
28
29
|
import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
30
|
+
import { getInitialFocusDate } from "./getInitialFocusDate.js";
|
|
29
31
|
import { computeDayCellState, computeRangeRounding, computePreviewRounding, computeDayNeighborContinuity, isEndpoint } from "./dayCellUtils.js";
|
|
30
32
|
|
|
31
33
|
// =============================================================================
|
|
@@ -114,20 +116,17 @@ export function Calendar({
|
|
|
114
116
|
// Determine effective value
|
|
115
117
|
const effectiveValue = value !== undefined ? value : internalValue;
|
|
116
118
|
|
|
117
|
-
// Focus date state (which month is visible)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
return plainDateToday();
|
|
130
|
-
});
|
|
119
|
+
// Focus date state (which month is visible). Falls back to today, clamped
|
|
120
|
+
// into the min/max window so a window that doesn't contain today doesn't
|
|
121
|
+
// open on an all-disabled month.
|
|
122
|
+
const [internalFocusDate, setInternalFocusDate] = useState(() => getInitialFocusDate({
|
|
123
|
+
focusDate: focusDateProp,
|
|
124
|
+
value: effectiveValue,
|
|
125
|
+
min,
|
|
126
|
+
max,
|
|
127
|
+
numberOfMonths,
|
|
128
|
+
today
|
|
129
|
+
}));
|
|
131
130
|
|
|
132
131
|
// Use controlled focusDate if callback is provided, otherwise use internal state
|
|
133
132
|
const isControlledFocus = focusDateProp !== undefined && onFocusDateChange !== undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file getInitialFocusDate.ts
|
|
3
|
+
* @input PlainDate utilities, min/max bounds, today
|
|
4
|
+
* @output Exports getInitialFocusDate — the month Calendar opens on
|
|
5
|
+
* @position Calendar-specific helper; used by Calendar.tsx
|
|
6
|
+
*
|
|
7
|
+
* SYNC: When modified, update:
|
|
8
|
+
* - /packages/core/src/Calendar/getInitialFocusDate.test.ts
|
|
9
|
+
* - /packages/core/src/Calendar/Calendar.tsx (the only caller)
|
|
10
|
+
*/
|
|
11
|
+
import type { ISODateString, DateRange } from '../utils/dateTypes';
|
|
12
|
+
import { type PlainDate } from '../utils/plainDate';
|
|
13
|
+
export interface InitialFocusDateOptions {
|
|
14
|
+
/** Controlled visible month, if the consumer supplied one. */
|
|
15
|
+
focusDate?: ISODateString;
|
|
16
|
+
/** Selected value (single date or range), controlled or uncontrolled. */
|
|
17
|
+
value?: ISODateString | DateRange;
|
|
18
|
+
/** Earliest selectable date. */
|
|
19
|
+
min?: ISODateString;
|
|
20
|
+
/** Latest selectable date. */
|
|
21
|
+
max?: ISODateString;
|
|
22
|
+
/** How many month panes the calendar renders (1 or 2). */
|
|
23
|
+
numberOfMonths: number;
|
|
24
|
+
/** Today, injected so the caller keeps a single memoized source of "now". */
|
|
25
|
+
today: PlainDate;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Picks the date whose month the calendar opens on.
|
|
29
|
+
*
|
|
30
|
+
* An explicit `focusDate` wins, then the selected value — both are the
|
|
31
|
+
* consumer's own instruction about where to look, so neither is second-guessed
|
|
32
|
+
* against `min`/`max`.
|
|
33
|
+
*
|
|
34
|
+
* Otherwise the calendar opens on today, clamped into the `min`/`max` window.
|
|
35
|
+
* Without the clamp a window that doesn't contain today (a 2019 audit range, a
|
|
36
|
+
* booking window opening next spring) opened on today's month with every day
|
|
37
|
+
* disabled, leaving prev/next clicking as the only way in.
|
|
38
|
+
*
|
|
39
|
+
* When clamping forward to `min`, that month leads: the whole selectable window
|
|
40
|
+
* runs ahead of it. When clamping back to `max`, the last pane lands on `max`'s
|
|
41
|
+
* month instead — with `numberOfMonths={2}` opening on `[max, max + 1]` would
|
|
42
|
+
* spend half the calendar on a month that is entirely out of bounds. That
|
|
43
|
+
* shift never crosses `min`'s month.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getInitialFocusDate(options: InitialFocusDateOptions): PlainDate;
|
|
46
|
+
//# sourceMappingURL=getInitialFocusDate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getInitialFocusDate.d.ts","sourceRoot":"","sources":["../../src/Calendar/getInitialFocusDate.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,oBAAoB,CAAC;AACjE,OAAO,EACL,KAAK,SAAS,EAMf,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,uBAAuB;IACtC,8DAA8D;IAC9D,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,yEAAyE;IACzE,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAClC,gCAAgC;IAChC,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,8BAA8B;IAC9B,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,0DAA0D;IAC1D,cAAc,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,uBAAuB,GAC/B,SAAS,CAkCX"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file getInitialFocusDate.ts
|
|
5
|
+
* @input PlainDate utilities, min/max bounds, today
|
|
6
|
+
* @output Exports getInitialFocusDate — the month Calendar opens on
|
|
7
|
+
* @position Calendar-specific helper; used by Calendar.tsx
|
|
8
|
+
*
|
|
9
|
+
* SYNC: When modified, update:
|
|
10
|
+
* - /packages/core/src/Calendar/getInitialFocusDate.test.ts
|
|
11
|
+
* - /packages/core/src/Calendar/Calendar.tsx (the only caller)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { plainDateFromISO, plainDateSetFirstOfMonth, plainDateAddMonths, plainDateIsBefore, plainDateIsAfter } from "../utils/plainDate.js";
|
|
15
|
+
/**
|
|
16
|
+
* Picks the date whose month the calendar opens on.
|
|
17
|
+
*
|
|
18
|
+
* An explicit `focusDate` wins, then the selected value — both are the
|
|
19
|
+
* consumer's own instruction about where to look, so neither is second-guessed
|
|
20
|
+
* against `min`/`max`.
|
|
21
|
+
*
|
|
22
|
+
* Otherwise the calendar opens on today, clamped into the `min`/`max` window.
|
|
23
|
+
* Without the clamp a window that doesn't contain today (a 2019 audit range, a
|
|
24
|
+
* booking window opening next spring) opened on today's month with every day
|
|
25
|
+
* disabled, leaving prev/next clicking as the only way in.
|
|
26
|
+
*
|
|
27
|
+
* When clamping forward to `min`, that month leads: the whole selectable window
|
|
28
|
+
* runs ahead of it. When clamping back to `max`, the last pane lands on `max`'s
|
|
29
|
+
* month instead — with `numberOfMonths={2}` opening on `[max, max + 1]` would
|
|
30
|
+
* spend half the calendar on a month that is entirely out of bounds. That
|
|
31
|
+
* shift never crosses `min`'s month.
|
|
32
|
+
*/
|
|
33
|
+
export function getInitialFocusDate(options) {
|
|
34
|
+
const {
|
|
35
|
+
focusDate,
|
|
36
|
+
value,
|
|
37
|
+
min,
|
|
38
|
+
max,
|
|
39
|
+
numberOfMonths,
|
|
40
|
+
today
|
|
41
|
+
} = options;
|
|
42
|
+
if (focusDate) {
|
|
43
|
+
return plainDateFromISO(focusDate);
|
|
44
|
+
}
|
|
45
|
+
if (value) {
|
|
46
|
+
return plainDateFromISO(typeof value === 'string' ? value : value.start);
|
|
47
|
+
}
|
|
48
|
+
const minDate = min ? plainDateFromISO(min) : null;
|
|
49
|
+
const maxDate = max ? plainDateFromISO(max) : null;
|
|
50
|
+
if (minDate && plainDateIsBefore(today, minDate)) {
|
|
51
|
+
return minDate;
|
|
52
|
+
}
|
|
53
|
+
if (maxDate && plainDateIsAfter(today, maxDate)) {
|
|
54
|
+
const lastPaneOffset = Math.max(0, numberOfMonths - 1);
|
|
55
|
+
const shifted = plainDateAddMonths(plainDateSetFirstOfMonth(maxDate), -lastPaneOffset);
|
|
56
|
+
if (minDate && plainDateIsBefore(shifted, plainDateSetFirstOfMonth(minDate))) {
|
|
57
|
+
return minDate;
|
|
58
|
+
}
|
|
59
|
+
return shifted;
|
|
60
|
+
}
|
|
61
|
+
return today;
|
|
62
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../src/Carousel/Carousel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,KAAK,SAAS,EAOf,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../src/Carousel/Carousel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,KAAK,SAAS,EAOf,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAKhD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,UAAU,IAAI,IAAI,CAAC;IACnB;;;OAGG;IACH,UAAU,IAAI,IAAI,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;OAIG;IACH,aAAa,IAAI,OAAO,CAAC;IACzB;;;OAGG;IACH,aAAa,IAAI,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC9D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACtC,kEAAkE;IAClE,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AA+JD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,SAAS,EACT,QAAQ,EACR,GAAO,EACP,UAAiB,EACjB,WAAkB,EAClB,OAAe,EACf,OAAe,EACf,OAAO,EACP,YAAY,EAAE,kBAAkB,EAChC,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,SAAS,EACb,EAAE,aAAa,+BAqRf;yBArSe,QAAQ"}
|
|
@@ -30,10 +30,10 @@ import { Icon } from "../Icon/index.js";
|
|
|
30
30
|
import { useLayer } from "../Layer/index.js";
|
|
31
31
|
import { useScrollOverflow } from "../hooks/useScrollOverflow.js";
|
|
32
32
|
import { isRtlElement } from "../hooks/isRtlElement.js";
|
|
33
|
-
import { mergeProps,
|
|
33
|
+
import { mergeProps, rtlStyles } from "../utils/index.js";
|
|
34
34
|
import { themeProps } from "../utils/themeProps.js";
|
|
35
35
|
import { useTranslator } from "../i18n/index.js";
|
|
36
|
-
|
|
36
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
37
37
|
/**
|
|
38
38
|
* Imperative control surface for the Carousel, accessed via the `handleRef`
|
|
39
39
|
* prop. Methods drive the same native-scroll machinery as the built-in
|
|
@@ -369,7 +369,7 @@ export function Carousel({
|
|
|
369
369
|
height: 'anchor-size(height)'
|
|
370
370
|
};
|
|
371
371
|
return /*#__PURE__*/_jsxs("div", {
|
|
372
|
-
ref:
|
|
372
|
+
ref: useMergedRefs(ref, layer.ref),
|
|
373
373
|
"data-testid": testId,
|
|
374
374
|
...htmlProps,
|
|
375
375
|
...mergeProps(themeProps('carousel'), stylex.props(styles.root, xstyle), className, style),
|