@astryxdesign/core 0.7.5-canary.a73f030 → 0.7.5-canary.a8374b5
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/dist/AlertDialog/AlertDialog.js +1 -1
- package/dist/AppShell/AppShell.d.ts +0 -22
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +155 -1
- package/dist/Banner/Banner.d.ts +1 -0
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +2 -0
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +2 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +2 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +31 -3
- package/dist/Chat/ChatPastedTextToken.d.ts.map +1 -1
- package/dist/Chat/ChatPastedTextToken.js +7 -6
- package/dist/Collapsible/Collapsible.d.ts +8 -1
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +84 -2
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +2 -10
- package/dist/DropdownMenu/menuTouchAction.stylex.d.ts +25 -0
- package/dist/DropdownMenu/menuTouchAction.stylex.d.ts.map +1 -0
- package/dist/DropdownMenu/menuTouchAction.stylex.js +29 -0
- package/dist/Field/Field.js +1 -1
- package/dist/Field/FieldLabel.js +1 -1
- package/dist/Field/PanelSearchInput.d.ts +9 -1
- package/dist/Field/PanelSearchInput.d.ts.map +1 -1
- package/dist/Field/PanelSearchInput.js +20 -8
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +19 -9
- package/dist/Icon/Icon.d.ts +31 -2
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +58 -8
- package/dist/Icon/IconSize.stylex.d.ts +16 -11
- package/dist/Icon/IconSize.stylex.d.ts.map +1 -1
- package/dist/Icon/IconSize.stylex.js +27 -11
- package/dist/Icon/globalIconRegistry.d.ts +71 -4
- package/dist/Icon/globalIconRegistry.d.ts.map +1 -1
- package/dist/Icon/globalIconRegistry.js +163 -23
- package/dist/Icon/index.d.ts +26 -2
- package/dist/Icon/index.d.ts.map +1 -1
- package/dist/Icon/index.js +24 -1
- package/dist/Icon/useIcon.d.ts +5 -1
- package/dist/Icon/useIcon.d.ts.map +1 -1
- package/dist/Icon/useIcon.js +5 -1
- package/dist/Kbd/Kbd.d.ts +2 -2
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +18 -11
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +6 -4
- package/dist/Lightbox/LightboxViewport.a11y.browser.spec.d.ts +2 -0
- package/dist/Lightbox/LightboxViewport.a11y.browser.spec.d.ts.map +1 -0
- package/dist/Lightbox/LightboxViewport.a11y.browser.spec.js +65 -0
- package/dist/MultiSelector/MultiSelector.d.ts +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +13 -1
- package/dist/NavMenu/NavHeadingMenu.d.ts +1 -1
- package/dist/NavMenu/NavHeadingMenu.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenu.js +29 -5
- package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.js +51 -7
- package/dist/NavMenu/NavMenuContext.d.ts +9 -0
- package/dist/NavMenu/NavMenuContext.d.ts.map +1 -1
- package/dist/NavMenu/NavMenuContext.js +9 -0
- package/dist/NumberInput/NumberInput.d.ts +1 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +8 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +7 -5
- package/dist/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +6 -2
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +8 -1
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +58 -2
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +45 -3
- package/dist/SideNav/railMotion.d.ts +54 -0
- package/dist/SideNav/railMotion.d.ts.map +1 -0
- package/dist/SideNav/railMotion.js +253 -0
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +7 -3
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +5 -1
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +25 -3
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +5 -1
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +1 -0
- package/dist/Table/TableRow.d.ts.map +1 -1
- package/dist/Table/TableRow.js +3 -0
- package/dist/Table/glidingDivider.d.ts +96 -0
- package/dist/Table/glidingDivider.d.ts.map +1 -0
- package/dist/Table/glidingDivider.js +275 -0
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +11 -2
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +8 -0
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +374 -13
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +244 -6
- package/dist/Table/rowDivider.d.ts +34 -0
- package/dist/Table/rowDivider.d.ts.map +1 -0
- package/dist/Table/rowDivider.js +118 -0
- package/dist/TextInput/TextInput.d.ts +1 -1
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +8 -1
- package/dist/Tokenizer/Tokenizer.d.ts +71 -4
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +418 -32
- package/dist/Tokenizer/TokenizerBottomSheet.d.ts +98 -0
- package/dist/Tokenizer/TokenizerBottomSheet.d.ts.map +1 -0
- package/dist/Tokenizer/TokenizerBottomSheet.js +721 -0
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +26 -0
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +32 -4
- package/dist/TreeList/TreeList.d.ts +8 -23
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +175 -3
- package/dist/TreeList/TreeListItem.d.ts +7 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +3 -1
- package/dist/astryx.css +57 -8
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/menuPressOnItems.d.ts +19 -0
- package/dist/hooks/menuPressOnItems.d.ts.map +1 -0
- package/dist/hooks/menuPressOnItems.js +32 -0
- package/dist/hooks/useAdaptivePresentation.d.ts +8 -0
- package/dist/hooks/useAdaptivePresentation.d.ts.map +1 -1
- package/dist/hooks/useAdaptivePresentation.js +27 -5
- package/dist/hooks/useAnimatedLayout.d.ts +42 -0
- package/dist/hooks/useAnimatedLayout.d.ts.map +1 -0
- package/dist/hooks/useAnimatedLayout.js +46 -0
- package/dist/hooks/useMenuHover.d.ts.map +1 -1
- package/dist/hooks/useMenuHover.js +6 -2
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +33 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +33 -0
- package/dist/internal/tokenizer-presentation.d.ts +21 -0
- package/dist/internal/tokenizer-presentation.d.ts.map +1 -0
- package/dist/internal/tokenizer-presentation.js +21 -0
- package/dist/motion/LayoutChangeSnapshot.d.ts +33 -0
- package/dist/motion/LayoutChangeSnapshot.d.ts.map +1 -0
- package/dist/motion/LayoutChangeSnapshot.js +37 -0
- package/dist/motion/animatedLayout.d.ts +107 -3
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +732 -58
- package/dist/motion/transientCopy.d.ts +33 -0
- package/dist/motion/transientCopy.d.ts.map +1 -0
- package/dist/motion/transientCopy.js +314 -0
- package/dist/theme/defineTheme.d.ts +111 -11
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +97 -7
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +9 -0
- package/locales/af-ZA.json +1 -1
- package/locales/ar-SA.json +1 -1
- package/locales/ca-ES.json +1 -1
- package/locales/cs-CZ.json +1 -1
- package/locales/da-DK.json +1 -1
- package/locales/de-DE.json +1 -1
- package/locales/el-GR.json +1 -1
- package/locales/en.json +132 -0
- package/locales/es-ES.json +1 -1
- package/locales/fi-FI.json +1 -1
- package/locales/fr-FR.json +1 -1
- package/locales/he-IL.json +1 -1
- package/locales/hu-HU.json +1 -1
- package/locales/it-IT.json +1 -1
- package/locales/ja-JP.json +1 -1
- package/locales/ko-KR.json +1 -1
- package/locales/nl-NL.json +1 -1
- package/locales/no-NO.json +1 -1
- package/locales/pl-PL.json +1 -1
- package/locales/pseudo.json +99 -0
- package/locales/pt-BR.json +1 -1
- package/locales/pt-PT.json +1 -1
- package/locales/ro-RO.json +1 -1
- package/locales/ru-RU.json +1 -1
- package/locales/sr-SP.json +1 -1
- package/locales/sv-SE.json +1 -1
- package/locales/tr-TR.json +1 -1
- package/locales/uk-UA.json +1 -1
- package/locales/vi-VN.json +1 -1
- package/locales/zh-CN.json +1 -1
- package/locales/zh-TW.json +1 -1
- package/package.json +8 -3
- package/src/AlertDialog/AlertDialog.spec.md +83 -29
- package/src/AlertDialog/AlertDialog.tsx +1 -1
- package/src/AppShell/AppShell.spec.md +49 -44
- package/src/AppShell/AppShell.tsx +170 -2
- package/src/Banner/Banner.spec.md +4 -2
- package/src/Banner/Banner.test.tsx +36 -17
- package/src/Banner/Banner.tsx +5 -0
- package/src/BottomSheet/BottomSheet.tsx +2 -1
- package/src/BottomSheet/BottomSheetPanel.tsx +2 -1
- package/src/BottomSheet/BottomSheetSwitcher.spec.md +3 -7
- package/src/BottomSheet/BottomSheetSwitcher.tsx +1 -1
- package/src/BottomSheet/__tests__/BottomSheetKeyboard.a11y.browser.spec.ts +3 -1
- package/src/Breadcrumbs/BreadcrumbItem.spec.md +19 -12
- package/src/Breadcrumbs/BreadcrumbItem.tsx +25 -1
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +58 -0
- package/src/Button/Button.spec.md +30 -28
- package/src/ButtonGroup/ButtonGroup.spec.md +4 -2
- package/src/Card/Card.spec.md +205 -0
- package/src/Center/Center.spec.md +104 -124
- package/src/Chat/ChatPastedTextToken.test.tsx +71 -0
- package/src/Chat/ChatPastedTextToken.tsx +8 -7
- package/src/CheckboxInput/CheckboxInput.spec.md +97 -66
- package/src/CheckboxList/CheckboxList.spec.md +92 -78
- package/src/CheckboxList/CheckboxListItem.spec.md +86 -60
- package/src/ClickableCard/ClickableCard.spec.md +124 -128
- package/src/Collapsible/Collapsible.doc.mjs +6 -0
- package/src/Collapsible/Collapsible.spec.md +26 -23
- package/src/Collapsible/Collapsible.tsx +121 -2
- package/src/CommandPalette/CommandPalette.perf.test.ts +8 -4
- package/src/ContextMenu/ContextMenu.spec.md +30 -26
- package/src/Divider/Divider.spec.md +79 -70
- package/src/DropdownMenu/DropdownMenu.ssr.test.tsx +33 -7
- package/src/DropdownMenu/DropdownMenu.tsx +4 -13
- package/src/DropdownMenu/menuTouchAction.stylex.ts +28 -0
- package/src/DropdownMenu/modules/useMenuPress.spec.md +35 -36
- package/src/Field/Field.tsx +1 -1
- package/src/Field/FieldLabel.tsx +1 -1
- package/src/Field/PanelSearchInput.tsx +11 -0
- package/src/FileInput/FileInput.doc.mjs +1 -1
- package/src/FileInput/FileInput.test.tsx +102 -0
- package/src/FileInput/FileInput.tsx +15 -9
- package/src/FormLayout/FormLayout.spec.md +69 -51
- package/src/Grid/Grid.spec.md +72 -69
- package/src/Grid/GridSpan.spec.md +158 -0
- package/src/HoverCard/HoverCard.spec.md +244 -0
- package/src/Icon/Icon.doc.mjs +65 -3
- package/src/Icon/Icon.test.tsx +545 -9
- package/src/Icon/Icon.tsx +73 -12
- package/src/Icon/IconSize.stylex.ts +27 -11
- package/src/Icon/globalIconRegistry.test.tsx +395 -3
- package/src/Icon/globalIconRegistry.tsx +184 -36
- package/src/Icon/index.ts +29 -1
- package/src/Icon/useIcon.ts +5 -1
- package/src/IconButton/IconButton.test.tsx +5 -2
- package/src/InputGroup/InputGroup.spec.md +199 -0
- package/src/InputGroup/InputGroupText.spec.md +139 -0
- package/src/Kbd/Kbd.test.tsx +95 -0
- package/src/Kbd/Kbd.tsx +30 -23
- package/src/Lightbox/Lightbox.test.tsx +15 -0
- package/src/Lightbox/Lightbox.tsx +9 -4
- package/src/Lightbox/LightboxViewport.a11y.browser.spec.ts +70 -0
- package/src/List/List.spec.md +73 -28
- package/src/MultiSelector/MultiSelector.test.tsx +97 -0
- package/src/MultiSelector/MultiSelector.tsx +16 -1
- package/src/NavMenu/NavHeadingMenu.spec.md +19 -17
- package/src/NavMenu/NavHeadingMenu.test.tsx +276 -2
- package/src/NavMenu/NavHeadingMenu.tsx +42 -4
- package/src/NavMenu/NavHeadingMenuItem.tsx +60 -6
- package/src/NavMenu/NavMenuContext.tsx +11 -0
- package/src/NavMenu/__tests__/NavMenusSlideSelection.a11y.chromium.spec.ts +137 -0
- package/src/NumberInput/NumberInput.test.tsx +43 -0
- package/src/NumberInput/NumberInput.tsx +11 -1
- package/src/PowerSearch/PowerSearch.test.tsx +32 -1
- package/src/PowerSearch/PowerSearch.tsx +7 -5
- package/src/RadioList/RadioList.spec.md +227 -0
- package/src/RadioList/RadioListItem.spec.md +223 -0
- package/src/SegmentedControl/SegmentedControl.spec.md +162 -53
- package/src/SegmentedControl/SegmentedControl.test.tsx +46 -0
- package/src/SegmentedControl/SegmentedControl.tsx +7 -3
- package/src/SegmentedControl/SegmentedControlItem.spec.md +206 -0
- package/src/SelectableCard/SelectableCard.spec.md +230 -0
- package/src/Selector/Selector.test.tsx +47 -0
- package/src/Selector/Selector.tsx +11 -1
- package/src/SideNav/SideNav.spec.md +45 -27
- package/src/SideNav/SideNav.test.tsx +135 -0
- package/src/SideNav/SideNav.tsx +85 -1
- package/src/SideNav/SideNavHeading.spec.md +26 -19
- package/src/SideNav/SideNavHeading.tsx +61 -6
- package/src/SideNav/SideNavRailMotion.test.tsx +620 -0
- package/src/SideNav/__tests__/SideNavRailMotion.interaction.browser.spec.ts +417 -0
- package/src/SideNav/railMotion.ts +315 -0
- package/src/Skeleton/Skeleton.spec.md +7 -7
- package/src/Slider/Slider.fr10.test.tsx +34 -0
- package/src/Slider/Slider.tsx +10 -2
- package/src/Spinner/Spinner.spec.md +10 -10
- package/src/Stack/Stack.spec.md +104 -56
- package/src/Stepper/Step.spec.md +206 -0
- package/src/Switch/Switch.spec.md +150 -66
- package/src/TabList/Tab.tsx +7 -1
- package/src/TabList/TabList.test.tsx +27 -0
- package/src/TabList/TabMenu.spec.md +3 -1
- package/src/TabList/TabMenu.tsx +24 -1
- package/src/TabList/__tests__/TabListOverflow.interaction.browser.spec.ts +99 -0
- package/src/Table/TableCell.tsx +9 -0
- package/src/Table/TableHeaderCell.tsx +2 -0
- package/src/Table/TableRow.tsx +3 -0
- package/src/Table/__tests__/TableRowGlide.a11y.browser.spec.ts +382 -0
- package/src/Table/__tests__/TableStickyDividers.a11y.browser.spec.ts +560 -0
- package/src/Table/glidingDivider.ts +336 -0
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +23 -8
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.glide.test.tsx +280 -0
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx +91 -9
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +471 -10
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.test.tsx +51 -1
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +312 -12
- package/src/Table/rowDivider.ts +154 -0
- package/src/Table/useTableRowExpansion.doc.mjs +8 -0
- package/src/TextArea/TextArea.spec.md +164 -64
- package/src/TextInput/TextInput.spec.md +6 -4
- package/src/TextInput/TextInput.test.tsx +43 -0
- package/src/TextInput/TextInput.tsx +11 -1
- package/src/Timestamp/Timestamp.spec.md +252 -0
- package/src/Toast/Toast.spec.md +302 -0
- package/src/ToggleButton/ToggleButtonGroup.spec.md +14 -13
- package/src/Tokenizer/Tokenizer.props-type.test.tsx +126 -0
- package/src/Tokenizer/Tokenizer.spec.md +66 -54
- package/src/Tokenizer/Tokenizer.ssr.test.tsx +196 -0
- package/src/Tokenizer/Tokenizer.tsx +573 -25
- package/src/Tokenizer/TokenizerBottomSheet.test.tsx +2719 -0
- package/src/Tokenizer/TokenizerBottomSheet.tsx +957 -0
- package/src/Toolbar/Toolbar.spec.md +103 -49
- package/src/Tooltip/Tooltip.spec.md +161 -36
- package/src/TopNav/TopNav.test.tsx +89 -0
- package/src/TopNav/TopNavHeading.spec.md +24 -17
- package/src/TopNav/TopNavHeading.tsx +35 -2
- package/src/TopNav/TopNavMenu.spec.md +27 -20
- package/src/TopNav/TopNavMenu.test.tsx +65 -1
- package/src/TopNav/TopNavMenu.tsx +30 -1
- package/src/TreeList/TreeList.doc.mjs +13 -0
- package/src/TreeList/TreeList.spec.md +51 -35
- package/src/TreeList/TreeList.tsx +234 -2
- package/src/TreeList/TreeListItem.tsx +12 -2
- package/src/VisuallyHidden/VisuallyHidden.spec.md +170 -0
- package/src/__tests__/unthemedLength.ts +34 -0
- package/src/hooks/__tests__/menuLinkClicks.ts +71 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/menuPressOnItems.ts +40 -0
- package/src/hooks/useAdaptivePresentation.ts +36 -6
- package/src/hooks/useAnimatedLayout.doc.mjs +101 -0
- package/src/hooks/useAnimatedLayout.ts +61 -0
- package/src/hooks/useAnnounceRenderedText.adopters.test.tsx +22 -0
- package/src/hooks/useMenuHover.ts +6 -2
- package/src/i18n/generated-locales/en.generated.ts +35 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +37 -0
- package/src/internal/tokenizer-presentation.test.ts +29 -0
- package/src/internal/tokenizer-presentation.ts +25 -0
- package/src/motion/LayoutChangeSnapshot.tsx +50 -0
- package/src/motion/__tests__/animatedLayout.interaction.browser.spec.ts +572 -0
- package/src/motion/__tests__/animatedLayoutAdopters.interaction.browser.spec.ts +217 -0
- package/src/motion/animatedLayout.boundary.test.ts +37 -13
- package/src/motion/animatedLayout.swap.test.ts +827 -0
- package/src/motion/animatedLayout.test.ts +479 -2
- package/src/motion/animatedLayout.ts +896 -60
- package/src/motion/animatedLayoutAdopters.test.tsx +500 -0
- package/src/motion/transientCopy.ts +374 -0
- package/src/theme/defineTheme.test.ts +235 -2
- package/src/theme/defineTheme.ts +231 -19
- package/src/theme/derivedVarRegistry.test.ts +25 -0
- package/src/theme/derivedVarRegistry.ts +4 -0
- package/src/theme/extensibleAxes.test.ts +74 -29
|
@@ -28,7 +28,7 @@ import { Button } from "../Button/index.js";
|
|
|
28
28
|
import { mergeProps } from "../utils/index.js";
|
|
29
29
|
import { themeProps } from "../utils/themeProps.js";
|
|
30
30
|
import { useTranslator } from "../i18n/index.js";
|
|
31
|
-
import { useMediaQuery } from "../hooks/
|
|
31
|
+
import { useMediaQuery } from "../hooks/useMediaQuery.js";
|
|
32
32
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
33
33
|
const SMALL_SCREEN_QUERY = '(max-width: 640px)';
|
|
34
34
|
const styles = {
|
|
@@ -176,28 +176,6 @@ export interface AppShellProps extends BaseProps<HTMLDivElement> {
|
|
|
176
176
|
*/
|
|
177
177
|
topNav?: ReactNode;
|
|
178
178
|
}
|
|
179
|
-
/**
|
|
180
|
-
* Page shell for an application. Provides the structural frame for an app:
|
|
181
|
-
* top navigation, side navigation, and main content area.
|
|
182
|
-
*
|
|
183
|
-
* Slot-based API with `topNav`, `sideNav`, `banner`, and `children`.
|
|
184
|
-
* Supports two height modes (`fill` and `auto`), responsive side nav
|
|
185
|
-
* collapse, and mobile overlay with backdrop.
|
|
186
|
-
*
|
|
187
|
-
* @example
|
|
188
|
-
* ```
|
|
189
|
-
* <AppShell
|
|
190
|
-
* topNav={<TopNav label="Navigation" heading={<TopNavHeading heading="My App" />} />}
|
|
191
|
-
* sideNav={<SideNav>{navSections}</SideNav>}
|
|
192
|
-
* mobileNav={
|
|
193
|
-
* <MobileNav isOpen={mobileOpen} onOpenChange={(open) => setMobileOpen(open)} header="My App">
|
|
194
|
-
* {navSections}
|
|
195
|
-
* </MobileNav>
|
|
196
|
-
* }>
|
|
197
|
-
* <Content />
|
|
198
|
-
* </AppShell>
|
|
199
|
-
* ```
|
|
200
|
-
*/
|
|
201
179
|
export declare function AppShell({ variant, banner, children, contentPadding, 'data-testid': dataTestId, height, mobileNav, sideNav, topNav, xstyle, className, style, ref, ...rest }: AppShellProps): React.JSX.Element;
|
|
202
180
|
export declare namespace AppShell {
|
|
203
181
|
var displayName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../src/AppShell/AppShell.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;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,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;AAqND,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,qBAykBf;yBAxlBe,QAAQ"}
|
|
@@ -31,6 +31,9 @@ import { LayoutContent } from "../Layout/LayoutContent.js";
|
|
|
31
31
|
import { MobileNavToggle } from "../MobileNav/MobileNavToggle.js";
|
|
32
32
|
import { MAX_CLOSE_DELAY_MS as MOBILE_NAV_MAX_CLOSE_DELAY_MS } from "../MobileNav/MobileNav.js";
|
|
33
33
|
import { SideNavRenderContext } from "../SideNav/SideNavRenderContext.js";
|
|
34
|
+
import { SideNavShellContext } from "../SideNav/railMotion.js";
|
|
35
|
+
import { useAnimatedLayout } from "../hooks/useAnimatedLayout.js";
|
|
36
|
+
import { holdLayoutSwap, landLayoutGlide, layoutMotionFor, playLayoutFrames, playLayoutSwap, reportLayoutChange } from "../motion/animatedLayout.js";
|
|
34
37
|
import { TopNavRenderContext } from "../TopNav/TopNavRenderContext.js";
|
|
35
38
|
import { TopNavMobileContentContext } from "../TopNav/TopNavMobileContentContext.js";
|
|
36
39
|
import { AppShellMobileContext } from "./AppShellMobileContext.js";
|
|
@@ -229,6 +232,18 @@ const styles = {
|
|
|
229
232
|
* </AppShell>
|
|
230
233
|
* ```
|
|
231
234
|
*/
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* The column beside the rail that holds `main`: its ancestor whose parent
|
|
238
|
+
* also holds the rail. The glide moves it; the rail's edge rides it.
|
|
239
|
+
*/
|
|
240
|
+
function columnOf(main, rail) {
|
|
241
|
+
let column = main;
|
|
242
|
+
while (column.parentElement != null && !column.parentElement.contains(rail)) {
|
|
243
|
+
column = column.parentElement;
|
|
244
|
+
}
|
|
245
|
+
return column;
|
|
246
|
+
}
|
|
232
247
|
export function AppShell({
|
|
233
248
|
variant = 'elevated',
|
|
234
249
|
banner,
|
|
@@ -437,6 +452,139 @@ export function AppShell({
|
|
|
437
452
|
}) : undefined;
|
|
438
453
|
|
|
439
454
|
// =========================================================================
|
|
455
|
+
// While the inline side nav collapses or expands, the content area holds
|
|
456
|
+
// its own animated layout handle (`component:AppShell` FR17): the column
|
|
457
|
+
// beside the rail glides from its old place, and the content swaps its old
|
|
458
|
+
// wrap for its new one in place (`spec:AST-105` FR8), on the rail's clock
|
|
459
|
+
// (`component:SideNav` FR6).
|
|
460
|
+
const railRef = useRef(null);
|
|
461
|
+
const mainRef = useRef(null);
|
|
462
|
+
const backdropRef = useRef(null);
|
|
463
|
+
const contentLayout = useAnimatedLayout({
|
|
464
|
+
containerRef: shellRef
|
|
465
|
+
});
|
|
466
|
+
const pendingContentRef = useRef(null);
|
|
467
|
+
// The running swap: when it started and its wraps' starting opacities, so a
|
|
468
|
+
// change made during it starts its cross-fade from what the content shows.
|
|
469
|
+
const lastSwapRef = useRef(null);
|
|
470
|
+
const sideNavShell = useMemo(() => ({
|
|
471
|
+
animatedLayout: contentLayout,
|
|
472
|
+
rail: () => railRef.current,
|
|
473
|
+
column: () => mainRef.current == null ? null : columnOf(mainRef.current, railRef.current),
|
|
474
|
+
landContent() {
|
|
475
|
+
if (mainRef.current != null) {
|
|
476
|
+
landLayoutGlide(columnOf(mainRef.current, railRef.current));
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
beforeRailChange() {
|
|
480
|
+
const main = mainRef.current;
|
|
481
|
+
if (main == null) {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
const motion = layoutMotionFor(main);
|
|
485
|
+
// Only a spring glides the column; under Reduce Motion the two wraps
|
|
486
|
+
// cross-fade over a steady surface (`design:reduced-motion` DR2).
|
|
487
|
+
let change = null;
|
|
488
|
+
if (motion.kind === 'spring') {
|
|
489
|
+
change = reportLayoutChange(contentLayout, railRef);
|
|
490
|
+
change.measureBefore();
|
|
491
|
+
}
|
|
492
|
+
// At rest the copy (the wrap shown now) starts opaque and the entering
|
|
493
|
+
// wrap unseen; mid-swap the wrap in the DOM is the entering one and
|
|
494
|
+
// the copy's wrap is the one entering next, each at what it shows.
|
|
495
|
+
let held = 1;
|
|
496
|
+
let entering = 0;
|
|
497
|
+
const last = lastSwapRef.current;
|
|
498
|
+
if (last != null && motion.kind === 'spring') {
|
|
499
|
+
const elapsed = Number(main.ownerDocument.timeline?.currentTime ?? 0) - last.startedAt;
|
|
500
|
+
if (elapsed < motion.progress.durationMs) {
|
|
501
|
+
const p = 1 - motion.progress.remaining(elapsed);
|
|
502
|
+
held = last.entering + (1 - last.entering) * p;
|
|
503
|
+
entering = last.held * (1 - p);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
lastSwapRef.current = null;
|
|
507
|
+
pendingContentRef.current = {
|
|
508
|
+
change,
|
|
509
|
+
swap: holdLayoutSwap(contentLayout, main, {
|
|
510
|
+
isVisiblePart: true
|
|
511
|
+
}),
|
|
512
|
+
before: main.getBoundingClientRect(),
|
|
513
|
+
held,
|
|
514
|
+
entering
|
|
515
|
+
};
|
|
516
|
+
},
|
|
517
|
+
afterRailChange() {
|
|
518
|
+
const pending = pendingContentRef.current;
|
|
519
|
+
pendingContentRef.current = null;
|
|
520
|
+
const main = mainRef.current;
|
|
521
|
+
if (pending == null || main == null) {
|
|
522
|
+
return () => {};
|
|
523
|
+
}
|
|
524
|
+
pending.change?.animate();
|
|
525
|
+
// The column beside the rail, which the glide moves: the copy sits
|
|
526
|
+
// beside it, in its parent, and rides its glide.
|
|
527
|
+
const column = columnOf(main, railRef.current);
|
|
528
|
+
const after = main.getBoundingClientRect();
|
|
529
|
+
const isRtl = getComputedStyle(main).direction === 'rtl';
|
|
530
|
+
const travel = isRtl ? pending.before.right - after.right : pending.before.left - after.left;
|
|
531
|
+
// An expand slides the narrower column in from its old start, which
|
|
532
|
+
// opens a gap at its trailing edge: the content surface (the elevated
|
|
533
|
+
// backdrop, or the main element) reaches over it as it closes,
|
|
534
|
+
// whether or not the old wrap is held.
|
|
535
|
+
const cover = [];
|
|
536
|
+
const surface = backdropRef.current ?? main;
|
|
537
|
+
const color = getComputedStyle(surface).backgroundColor;
|
|
538
|
+
const isPainted = !/^rgba\(.*,\s*0\)$|^transparent$/.test(color);
|
|
539
|
+
const glides = layoutMotionFor(main).kind === 'spring';
|
|
540
|
+
if ((isRtl ? travel > 0 : travel < 0) && glides && isPainted) {
|
|
541
|
+
cover.push({
|
|
542
|
+
element: surface,
|
|
543
|
+
frames: p => ({
|
|
544
|
+
boxShadow: `${-travel * (1 - p)}px 0px 0px 0px ${color}`
|
|
545
|
+
})
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
if (pending.swap == null || column.parentElement == null) {
|
|
549
|
+
return playLayoutFrames(contentLayout, cover);
|
|
550
|
+
}
|
|
551
|
+
// Under Reduce Motion nothing glides: the old wrap's copy paints the
|
|
552
|
+
// surface it sat on, so that surface fades out with it where it was
|
|
553
|
+
// (`design:reduced-motion` DR2) instead of leaving a bare strip.
|
|
554
|
+
if (!glides && isPainted) {
|
|
555
|
+
pending.swap.copy.style.backgroundColor = color;
|
|
556
|
+
}
|
|
557
|
+
const {
|
|
558
|
+
held,
|
|
559
|
+
entering
|
|
560
|
+
} = pending;
|
|
561
|
+
lastSwapRef.current = {
|
|
562
|
+
startedAt: Number(main.ownerDocument.timeline?.currentTime ?? 0),
|
|
563
|
+
held,
|
|
564
|
+
entering
|
|
565
|
+
};
|
|
566
|
+
return playLayoutSwap(pending.swap, {
|
|
567
|
+
host: column.parentElement,
|
|
568
|
+
copy: p => ({
|
|
569
|
+
opacity: held * (1 - p)
|
|
570
|
+
}),
|
|
571
|
+
rideWith: {
|
|
572
|
+
element: column,
|
|
573
|
+
travel: {
|
|
574
|
+
x: travel,
|
|
575
|
+
y: 0
|
|
576
|
+
}
|
|
577
|
+
},
|
|
578
|
+
incoming: [...Array.from(main.children, element => ({
|
|
579
|
+
element,
|
|
580
|
+
frames: p => ({
|
|
581
|
+
opacity: entering + (1 - entering) * p
|
|
582
|
+
})
|
|
583
|
+
})), ...cover]
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
}), [contentLayout]);
|
|
587
|
+
|
|
440
588
|
// Build sideNav content
|
|
441
589
|
//
|
|
442
590
|
// In auto mode, the sideNav panel is not internally scrollable (the page
|
|
@@ -445,6 +593,7 @@ export function AppShell({
|
|
|
445
593
|
// the sticky behavior since LayoutPanel doesn't accept style/className.
|
|
446
594
|
// =========================================================================
|
|
447
595
|
const sideNavPanel = showSideNavInline ? /*#__PURE__*/_jsx(LayoutPanel, {
|
|
596
|
+
ref: railRef,
|
|
448
597
|
padding: 0,
|
|
449
598
|
hasDivider: navHasDividers,
|
|
450
599
|
isScrollable: isFill,
|
|
@@ -452,7 +601,10 @@ export function AppShell({
|
|
|
452
601
|
variant
|
|
453
602
|
}),
|
|
454
603
|
xstyle: [navAreaStyle, isAuto && stickyBgStyle, isAuto && styles.panelAutoFill],
|
|
455
|
-
children:
|
|
604
|
+
children: /*#__PURE__*/_jsx(SideNavShellContext, {
|
|
605
|
+
value: sideNavShell,
|
|
606
|
+
children: sideNav
|
|
607
|
+
})
|
|
456
608
|
}) : undefined;
|
|
457
609
|
const sideNavContent = sideNavPanel != null && isAuto ? /*#__PURE__*/_jsx("div", {
|
|
458
610
|
...{
|
|
@@ -466,6 +618,7 @@ export function AppShell({
|
|
|
466
618
|
// =========================================================================
|
|
467
619
|
const shouldElevateWithCorner = isElevated && hasTopNav && showSideNavInline;
|
|
468
620
|
const mainInner = /*#__PURE__*/_jsx(LayoutContent, {
|
|
621
|
+
ref: mainRef,
|
|
469
622
|
padding: contentPadding ?? 0,
|
|
470
623
|
role: "main",
|
|
471
624
|
id: MAIN_CONTENT_ID
|
|
@@ -490,6 +643,7 @@ export function AppShell({
|
|
|
490
643
|
}
|
|
491
644
|
}[!!shouldElevateWithCorner << 0],
|
|
492
645
|
children: [shouldElevateWithCorner && /*#__PURE__*/_jsx("div", {
|
|
646
|
+
ref: backdropRef,
|
|
493
647
|
...{
|
|
494
648
|
className: "x10l6tqk x10a8y8t x10xzikg x183tx6i x47corl"
|
|
495
649
|
}
|
package/dist/Banner/Banner.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* - Banner frame (themeProps 'banner-frame'): owns the resting elevation and,
|
|
9
9
|
* for elevated card banners, the outer radius that shapes that shadow
|
|
10
10
|
* - Header area (themeProps 'banner'): colored status background with icon, title, description, actions, dismiss
|
|
11
|
+
* - End area restores the ordinary text context for consumer `endContent`; built-in controls opt back into the status foreground
|
|
11
12
|
* - Content area (themeProps 'banner-content'): card background for additional content (children)
|
|
12
13
|
* - Status icon (themeProps 'banner-icon'): the target rides on the default
|
|
13
14
|
* <Icon> itself — the element that paints — so 'status:X' overrides reach
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../src/Banner/Banner.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../src/Banner/Banner.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;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,EAAE,SAAS,CAAC;CACtB;AA4QD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,KAAK,EACL,WAAW,EACX,IAAI,EACJ,aAAqB,EACrB,SAAS,EACT,YAAY,EACZ,UAAU,EACV,SAAkB,EAClB,SAAkB,EAClB,WAAkB,EAClB,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,cAAc,EACd,oBAAoB,EACpB,GAAG,IAAI,EACR,EAAE,WAAW,sCAqQb;yBAzRe,MAAM"}
|
package/dist/Banner/Banner.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* - Banner frame (themeProps 'banner-frame'): owns the resting elevation and,
|
|
13
13
|
* for elevated card banners, the outer radius that shapes that shadow
|
|
14
14
|
* - Header area (themeProps 'banner'): colored status background with icon, title, description, actions, dismiss
|
|
15
|
+
* - End area restores the ordinary text context for consumer `endContent`; built-in controls opt back into the status foreground
|
|
15
16
|
* - Content area (themeProps 'banner-content'): card background for additional content (children)
|
|
16
17
|
* - Status icon (themeProps 'banner-icon'): the target rides on the default
|
|
17
18
|
* <Icon> itself — the element that paints — so 'status:X' overrides reach
|
|
@@ -148,6 +149,7 @@ const styles = {
|
|
|
148
149
|
kjj79g: "x13a6bvl",
|
|
149
150
|
kOIVth: "x1txdalj",
|
|
150
151
|
kmuXW: "x2lah0s",
|
|
152
|
+
kMwMTN: "x1tgivj0",
|
|
151
153
|
ks0D6T: "x193iq5w",
|
|
152
154
|
keTefX: "xvc5jky",
|
|
153
155
|
kqGvvJ: "x81ka23",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAEjD;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,UAAU,0BAA2B,SAAQ,sBAAsB;IACjE,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,UAAU,wBAAyB,SAAQ,sBAAsB;IAC/D;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AAED,MAAM,MAAM,gBAAgB,GAC1B,0BAA0B,GAAG,wBAAwB,CAAC;AAm0BxD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BA6BlD;yBA7Be,WAAW"}
|
|
@@ -80,7 +80,8 @@ import { use, useCallback, useEffect, useLayoutEffect, useRef, useState } from '
|
|
|
80
80
|
import * as stylex from '@stylexjs/stylex';
|
|
81
81
|
import "../theme/tokens.stylex.js";
|
|
82
82
|
import { colorVars, durationVars, easeVars, spacingVars } from "../theme/tokens.stylex.js";
|
|
83
|
-
import { useDevWarning
|
|
83
|
+
import { useDevWarning } from "../hooks/useDevWarning.js";
|
|
84
|
+
import { useScrollLock } from "../hooks/useScrollLock.js";
|
|
84
85
|
import { mergeProps } from "../utils/index.js";
|
|
85
86
|
import { LayerDepthProvider } from "../Layer/LayerDepthContext.js";
|
|
86
87
|
import { ModalAnnounceProvider } from "../hooks/ModalAnnounceProvider.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetPanel.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetPanel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"BottomSheetPanel.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetPanel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA8B5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;AAIvB,QAAA,MAAM,cAAc;;;;CAIV,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,cAAc,CAAC;AAC5D,YAAY,EAAC,oBAAoB,EAAC,CAAC;AA+CnC,eAAO,MAAM,2BAA2B,2DACkB,CAAC;AA2M3D,MAAM,MAAM,sBAAsB,GAChC,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEjD,MAAM,MAAM,qBAAqB,GAC7B;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAC,GAChB;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAC,GACjC;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC1C,eAAe,EAAE,MAAM,CAAC;CACzB,GACD;IAAC,IAAI,EAAE,SAAS,CAAA;CAAC,CAAC;AAEtB,UAAU,qBAAsB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC/D,+CAA+C;I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, useMemo, useRef } from 'react';
|
|
26
26
|
import * as stylex from '@stylexjs/stylex';
|
|
27
|
-
import { useDevWarning
|
|
27
|
+
import { useDevWarning } from "../hooks/useDevWarning.js";
|
|
28
|
+
import { useMediaQuery } from "../hooks/useMediaQuery.js";
|
|
28
29
|
import { useScrollableArea } from "../hooks/useScrollableArea.js";
|
|
29
30
|
import "../theme/tokens.stylex.js";
|
|
30
31
|
import { borderVars, colorVars, durationVars, easeVars, focusVars, radiusVars, shadowVars, sizeVars, spacingVars } from "../theme/tokens.stylex.js";
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
*/
|
|
76
76
|
import { use, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
77
77
|
import * as stylex from '@stylexjs/stylex';
|
|
78
|
-
import { useScrollLock } from "../hooks/
|
|
78
|
+
import { useScrollLock } from "../hooks/useScrollLock.js";
|
|
79
79
|
import { useFocusTrapEscapeCompatibilitySignal } from "../hooks/useFocusTrap.js";
|
|
80
80
|
import { dispatchLayerEscapeKeyDown } from "../Layer/layerStack.js";
|
|
81
81
|
import { useLayerDismissal } from "../Layer/useLayerDismissal.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbItem.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/BreadcrumbItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;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;
|
|
1
|
+
{"version":3,"file":"BreadcrumbItem.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/BreadcrumbItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,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 -34,6 +34,10 @@ import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
|
34
34
|
import { Icon } from "../Icon/index.js";
|
|
35
35
|
import { usePopover } from "../Popover/usePopover.js";
|
|
36
36
|
import { useListFocus } from "../hooks/useListFocus.js";
|
|
37
|
+
import { useMenuPress } from "../hooks/useMenuPress.js";
|
|
38
|
+
import { pressOnItemsOnly } from "../hooks/menuPressOnItems.js";
|
|
39
|
+
import { menuTouchActionStyles } from "../DropdownMenu/menuTouchAction.stylex.js";
|
|
40
|
+
import { useMenuOverflow } from "../DropdownMenu/useMenuOverflow.js";
|
|
37
41
|
import { useTypeahead } from "../hooks/useTypeahead.js";
|
|
38
42
|
import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
|
|
39
43
|
import { renderDropdownItems } from "../DropdownMenu/renderDropdownItems.js";
|
|
@@ -119,6 +123,20 @@ function BreadcrumbSeparator({
|
|
|
119
123
|
});
|
|
120
124
|
}
|
|
121
125
|
const menuStyles = {
|
|
126
|
+
menu: {
|
|
127
|
+
kB7OPa: "x9f619",
|
|
128
|
+
k1xSpc: "x78zum5",
|
|
129
|
+
kXwgrk: "xdt5ytf",
|
|
130
|
+
kOIVth: "x1lsbc85",
|
|
131
|
+
kskxy: "xuyqlj2",
|
|
132
|
+
kORKVm: "x1odjw0f",
|
|
133
|
+
"--_dropdown-menu-radius": "x1fcsqxe",
|
|
134
|
+
"--_dropdown-menu-padding": "xgory14",
|
|
135
|
+
kmVPX3: "x9epnlk",
|
|
136
|
+
kaIpWk: "x1n97fys",
|
|
137
|
+
kfSwDN: "x87ps6o",
|
|
138
|
+
$$css: true
|
|
139
|
+
},
|
|
122
140
|
popover: {
|
|
123
141
|
k7Eaqz: "x5w4yej",
|
|
124
142
|
kqGvvJ: "xsq74q5",
|
|
@@ -363,6 +381,15 @@ function BreadcrumbMenuTrigger({
|
|
|
363
381
|
wrap: false,
|
|
364
382
|
onEscape: closeMenu
|
|
365
383
|
});
|
|
384
|
+
|
|
385
|
+
// A press that slides across the menu's items acts on the item it lifts on,
|
|
386
|
+
// the highlight following the pointer, as DropdownMenu's does
|
|
387
|
+
// (`family:action-groups` FR1-FR3, FR5); a mouse released outside closes it.
|
|
388
|
+
const menuPress = useMenuPress({
|
|
389
|
+
menuRef: listRef,
|
|
390
|
+
itemSelector: MENU_ITEM_SELECTOR,
|
|
391
|
+
onDismiss: closeMenu
|
|
392
|
+
});
|
|
366
393
|
const typeahead = useTypeahead({
|
|
367
394
|
getItemLabels: () => getMenuItems().map(el => el.textContent),
|
|
368
395
|
onMatch: focusItem,
|
|
@@ -417,6 +444,7 @@ function BreadcrumbMenuTrigger({
|
|
|
417
444
|
menuSize
|
|
418
445
|
}), [closeMenu, menuSize]);
|
|
419
446
|
const menuContent = Array.isArray(menu) ? renderDropdownItems(menu) : menu;
|
|
447
|
+
const hasOverflow = useMenuOverflow(listRef, menuContent, popover.isOpen);
|
|
420
448
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
421
449
|
children: [/*#__PURE__*/_jsxs("button", {
|
|
422
450
|
ref: useMergedRefs(ref, buttonRef, popover.triggerRef),
|
|
@@ -453,10 +481,10 @@ function BreadcrumbMenuTrigger({
|
|
|
453
481
|
id: menuId,
|
|
454
482
|
role: "menu",
|
|
455
483
|
"aria-labelledby": triggerId,
|
|
484
|
+
...menuPress.menuProps,
|
|
485
|
+
onPointerDown: pressOnItemsOnly(menuPress.menuProps.onPointerDown, MENU_ITEM_SELECTOR),
|
|
456
486
|
onKeyDown: listKeyDown,
|
|
457
|
-
...mergeProps(themeProps('breadcrumb-menu'),
|
|
458
|
-
className: "x9f619 x78zum5 xdt5ytf x1lsbc85 xuyqlj2 x1odjw0f x1fcsqxe xgory14 x9epnlk x1n97fys x87ps6o"
|
|
459
|
-
}),
|
|
487
|
+
...mergeProps(themeProps('breadcrumb-menu'), stylex.props(menuStyles.menu, hasOverflow ? menuTouchActionStyles.scrolls : menuTouchActionStyles.fits)),
|
|
460
488
|
children: /*#__PURE__*/_jsx(DropdownMenuContext, {
|
|
461
489
|
value: contextValue,
|
|
462
490
|
children: /*#__PURE__*/_jsx(DropdownMenuRootOpenContext, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatPastedTextToken.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatPastedTextToken.tsx"],"names":[],"mappings":"AAiCA,MAAM,WAAW,wBAAwB;IACvC,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"ChatPastedTextToken.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatPastedTextToken.tsx"],"names":[],"mappings":"AAiCA,MAAM,WAAW,wBAAwB;IACvC,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAkDD,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,QAAQ,GACT,EAAE,wBAAwB,+BA8B1B;yBAjCe,mBAAmB"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file ChatPastedTextToken.tsx
|
|
7
|
-
* @input Uses React, StyleX, Badge, HoverCard, Button,
|
|
7
|
+
* @input Uses React, StyleX, Badge, HoverCard, Button, provider-bound translator
|
|
8
8
|
* @output Exports ChatPastedTextToken component
|
|
9
9
|
* @position Inline token for pasted text with hover card preview + expand
|
|
10
10
|
*
|
|
@@ -32,10 +32,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; // =============
|
|
|
32
32
|
// Helpers
|
|
33
33
|
// =============================================================================
|
|
34
34
|
|
|
35
|
-
function formatLabel(text) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
function formatLabel(text, t) {
|
|
36
|
+
return t('@astryx.chat.pastedText.label', {
|
|
37
|
+
lines: text.split('\n').length,
|
|
38
|
+
chars: text.length
|
|
39
|
+
});
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
// =============================================================================
|
|
@@ -47,7 +48,7 @@ export function ChatPastedTextToken({
|
|
|
47
48
|
onExpand
|
|
48
49
|
}) {
|
|
49
50
|
const t = useTranslator();
|
|
50
|
-
const label = formatLabel(text);
|
|
51
|
+
const label = formatLabel(text, t);
|
|
51
52
|
const cardContent = /*#__PURE__*/_jsxs("div", {
|
|
52
53
|
...{
|
|
53
54
|
className: "x78zum5 xdt5ytf x1txdalj x17fpy1y"
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
* - /packages/cli/assets/templates/blocks/components/Collapsible/ (showcase blocks)
|
|
24
24
|
*/
|
|
25
25
|
import { type ReactNode } from 'react';
|
|
26
|
+
import { type AnimatedLayout } from '../motion/animatedLayout.js';
|
|
26
27
|
import type { CollapsibleChevronPosition } from './CollapsibleGroupContext.js';
|
|
27
28
|
import type { BaseProps } from '../BaseProps.js';
|
|
28
29
|
export interface CollapsibleProps extends BaseProps {
|
|
@@ -63,6 +64,12 @@ export interface CollapsibleProps extends BaseProps {
|
|
|
63
64
|
* CollapsibleGroup owns grouped state and calls its `onChange` instead.
|
|
64
65
|
*/
|
|
65
66
|
onOpenChange?: (isOpen: boolean) => void;
|
|
67
|
+
/**
|
|
68
|
+
* The handle from `useAnimatedLayout({containerRef})`. With it, opening and
|
|
69
|
+
* closing glides the content after this Collapsible, up to that container,
|
|
70
|
+
* instead of jumping, and the chevron turns on the same timing.
|
|
71
|
+
*/
|
|
72
|
+
animatedLayout?: AnimatedLayout;
|
|
66
73
|
/**
|
|
67
74
|
* Logical position of the disclosure chevron.
|
|
68
75
|
*
|
|
@@ -125,7 +132,7 @@ export interface CollapsibleProps extends BaseProps {
|
|
|
125
132
|
* </CollapsibleGroup>
|
|
126
133
|
* ```
|
|
127
134
|
*/
|
|
128
|
-
export declare function Collapsible({ trigger, children, defaultIsOpen, isOpen: controlledIsOpen, isDisabled, onOpenChange, chevronPosition, value, ref, xstyle, className, style, ...props }: CollapsibleProps): import("react").JSX.Element;
|
|
135
|
+
export declare function Collapsible({ trigger, children, defaultIsOpen, isOpen: controlledIsOpen, isDisabled, onOpenChange, chevronPosition, value, animatedLayout, ref, xstyle, className, style, ...props }: CollapsibleProps): import("react").JSX.Element;
|
|
129
136
|
export declare namespace Collapsible {
|
|
130
137
|
var displayName: string;
|
|
131
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapsible.d.ts","sourceRoot":"","sources":["../../src/Collapsible/Collapsible.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"Collapsible.d.ts","sourceRoot":"","sources":["../../src/Collapsible/Collapsible.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAef,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAC,0BAA0B,EAAC,MAAM,2BAA2B,CAAC;AAG1E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA0J5C,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC;;;;OAIG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,EAAE,0BAA0B,CAAC;IAE7C;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,QAAQ,EACR,aAAa,EACb,MAAM,EAAE,gBAAgB,EACxB,UAAkB,EAClB,YAAY,EACZ,eAAe,EACf,KAAK,EACL,cAAc,EACd,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,gBAAgB,+BAmOlB;yBAlPe,WAAW"}
|
|
@@ -26,11 +26,13 @@
|
|
|
26
26
|
* - /apps/storybook/stories/Collapsible.stories.tsx
|
|
27
27
|
* - /packages/cli/assets/templates/blocks/components/Collapsible/ (showcase blocks)
|
|
28
28
|
*/
|
|
29
|
-
import { use, useId } from 'react';
|
|
29
|
+
import { use, useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
30
30
|
import * as stylex from '@stylexjs/stylex';
|
|
31
31
|
import "../theme/tokens.stylex.js";
|
|
32
32
|
import { borderVars, colorVars, typographyVars, fontWeightVars, spacingVars, typeScaleVars, durationVars, easeVars } from "../theme/tokens.stylex.js";
|
|
33
33
|
import { useCollapsible } from "./useCollapsible.js";
|
|
34
|
+
import { LayoutChangeSnapshot } from "../motion/LayoutChangeSnapshot.js";
|
|
35
|
+
import { applyLayoutChangeTransition, holdLayoutExit, playLayoutChange, releaseLayoutExit, reportLayoutChange } from "../motion/animatedLayout.js";
|
|
34
36
|
import { CollapsibleGroupPresentationContext } from "./CollapsibleGroupContext.js";
|
|
35
37
|
import { Icon } from "../Icon/index.js";
|
|
36
38
|
import { mergeProps } from "../utils/index.js";
|
|
@@ -203,6 +205,7 @@ export function Collapsible({
|
|
|
203
205
|
onOpenChange,
|
|
204
206
|
chevronPosition,
|
|
205
207
|
value,
|
|
208
|
+
animatedLayout,
|
|
206
209
|
ref,
|
|
207
210
|
xstyle,
|
|
208
211
|
className,
|
|
@@ -226,6 +229,80 @@ export function Collapsible({
|
|
|
226
229
|
value
|
|
227
230
|
});
|
|
228
231
|
|
|
232
|
+
// With an `animatedLayout` handle, the content's size change animates: the
|
|
233
|
+
// content after this Collapsible, up to the handle's container, glides, and
|
|
234
|
+
// the revealed content plays its own entrance on the same timing
|
|
235
|
+
// (`architecture:react-component-runtime` INV12). Without one, nothing
|
|
236
|
+
// changes.
|
|
237
|
+
const contentRef = useRef(null);
|
|
238
|
+
const triggerRef = useRef(null);
|
|
239
|
+
const layoutChange = useMemo(() => reportLayoutChange(animatedLayout, contentRef), [animatedLayout]);
|
|
240
|
+
// Every open-state change, whatever caused it (a click, an owner-set
|
|
241
|
+
// `isOpen`, a group's value), is measured before it lands (`spec:AST-105`
|
|
242
|
+
// FR1): LayoutChangeSnapshot calls this in the commit, before the DOM
|
|
243
|
+
// changes. The chevron (the trigger's Icon, its `icon` theming target)
|
|
244
|
+
// turns on the glide's motion too.
|
|
245
|
+
const measureChange = useCallback(() => {
|
|
246
|
+
applyLayoutChangeTransition(animatedLayout, triggerRef.current?.querySelector(':scope > .astryx-icon') ?? null);
|
|
247
|
+
layoutChange.measureBefore();
|
|
248
|
+
}, [animatedLayout, layoutChange]);
|
|
249
|
+
// Without a handle the chevron keeps the theme's own turn: a spring a handle
|
|
250
|
+
// set stays only while it is passed (`spec:AST-105` FR2).
|
|
251
|
+
useLayoutEffect(() => {
|
|
252
|
+
if (animatedLayout == null) {
|
|
253
|
+
applyLayoutChangeTransition(null, triggerRef.current?.querySelector(':scope > .astryx-icon') ?? null);
|
|
254
|
+
}
|
|
255
|
+
}, [animatedLayout]);
|
|
256
|
+
// A close with a handle keeps the content rendered while it plays its exit
|
|
257
|
+
// (the exit makes it inert and gives up its space), then hides it
|
|
258
|
+
// (`spec:AST-105` FR4). Derived from the open state as it changes, during
|
|
259
|
+
// render, so the closing commit already keeps it.
|
|
260
|
+
const [renderedIsOpen, setRenderedIsOpen] = useState(isOpen);
|
|
261
|
+
const [isExiting, setIsExiting] = useState(false);
|
|
262
|
+
if (renderedIsOpen !== isOpen) {
|
|
263
|
+
setRenderedIsOpen(isOpen);
|
|
264
|
+
setIsExiting(!isOpen && animatedLayout != null);
|
|
265
|
+
}
|
|
266
|
+
const endExit = useCallback(() => {
|
|
267
|
+
// eslint-disable-next-line @eslint-react/set-state-in-effect -- holdLayoutExit decides from layout read in the closing commit (the content's place in the area's visible part, Reduce Motion and the pointer, and whether an end margin frees its space); an exit it does not hold hides the content before the frame paints
|
|
268
|
+
setIsExiting(false);
|
|
269
|
+
}, []);
|
|
270
|
+
const wasOpenRef = useRef(isOpen);
|
|
271
|
+
useLayoutEffect(() => {
|
|
272
|
+
if (wasOpenRef.current === isOpen) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
wasOpenRef.current = isOpen;
|
|
276
|
+
const content = contentRef.current;
|
|
277
|
+
if (content == null) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
// A change that was not measured (no handle) lands at once, entrance and
|
|
281
|
+
// exit included, so the content and what follows stay in step.
|
|
282
|
+
const isMeasured = layoutChange.animate();
|
|
283
|
+
if (isOpen) {
|
|
284
|
+
// Opened again mid-exit: the content takes its place in flow.
|
|
285
|
+
releaseLayoutExit(content);
|
|
286
|
+
if (isMeasured) {
|
|
287
|
+
playLayoutChange(animatedLayout, content);
|
|
288
|
+
}
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const isHeld = isExiting && isMeasured && holdLayoutExit(animatedLayout, content, endExit);
|
|
292
|
+
if (isExiting && !isHeld) {
|
|
293
|
+
// An exit holdLayoutExit did not hold (unmeasured, out of view, Reduce
|
|
294
|
+
// Motion with a fine pointer, or no margin frees its space): hide the
|
|
295
|
+
// content before this frame paints.
|
|
296
|
+
endExit();
|
|
297
|
+
}
|
|
298
|
+
}, [isOpen, isExiting, layoutChange, animatedLayout, endExit]);
|
|
299
|
+
useLayoutEffect(() => {
|
|
300
|
+
if (!isOpen && !isExiting && contentRef.current != null) {
|
|
301
|
+
// Hidden again after its exit: drop the exit's inline values.
|
|
302
|
+
releaseLayoutExit(contentRef.current);
|
|
303
|
+
}
|
|
304
|
+
}, [isOpen, isExiting]);
|
|
305
|
+
|
|
229
306
|
// Activation is blocked by this guard rather than the native `disabled`
|
|
230
307
|
// attribute, so the trigger keeps `aria-disabled` semantics and stays
|
|
231
308
|
// discoverable. A native `disabled` button would silently swallow events
|
|
@@ -272,6 +349,7 @@ export function Collapsible({
|
|
|
272
349
|
}), stylex.props(styles.root, isDivided && styles.divided, xstyle), className, style),
|
|
273
350
|
...props,
|
|
274
351
|
children: [/*#__PURE__*/_jsxs("button", {
|
|
352
|
+
ref: triggerRef,
|
|
275
353
|
type: "button",
|
|
276
354
|
onClick: handleToggle,
|
|
277
355
|
"aria-disabled": isDisabled || undefined,
|
|
@@ -301,12 +379,16 @@ export function Collapsible({
|
|
|
301
379
|
},
|
|
302
380
|
children: trigger
|
|
303
381
|
}), !isChevronAtStart && chevron]
|
|
382
|
+
}), animatedLayout != null && /*#__PURE__*/_jsx(LayoutChangeSnapshot, {
|
|
383
|
+
value: isOpen,
|
|
384
|
+
onBeforeChange: measureChange
|
|
304
385
|
}), /*#__PURE__*/_jsx("div", {
|
|
386
|
+
ref: contentRef,
|
|
305
387
|
id: contentId,
|
|
306
388
|
...mergeProps(themeProps('collapsible-content', {
|
|
307
389
|
density: density ?? undefined,
|
|
308
390
|
open: isOpen ? 'open' : null
|
|
309
|
-
}), stylex.props(styles.content, density != null && contentDensity[density], !isOpen && styles.contentHidden)),
|
|
391
|
+
}), stylex.props(styles.content, density != null && contentDensity[density], !isOpen && !isExiting && styles.contentHidden)),
|
|
310
392
|
children: presentation != null ? /*#__PURE__*/_jsx(CollapsibleGroupPresentationContext, {
|
|
311
393
|
value: null,
|
|
312
394
|
children: children
|