@astryxdesign/core 0.7.2-canary.c68f5e8 → 0.7.2-canary.caec7ca
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/CheckboxList/CheckboxListItem.d.ts +9 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +4 -2
- package/dist/Drawer/Drawer.d.ts +191 -0
- package/dist/Drawer/Drawer.d.ts.map +1 -0
- package/dist/Drawer/Drawer.js +382 -0
- package/dist/Drawer/DrawerHeader.d.ts +85 -0
- package/dist/Drawer/DrawerHeader.d.ts.map +1 -0
- package/dist/Drawer/DrawerHeader.js +134 -0
- package/dist/Drawer/index.d.ts +11 -0
- package/dist/Drawer/index.d.ts.map +1 -0
- package/dist/Drawer/index.js +11 -0
- package/dist/Drawer/useDrawerDialogPresence.d.ts +42 -0
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -0
- package/dist/Drawer/useDrawerDialogPresence.js +236 -0
- package/dist/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/DropdownMenu/DropdownMenuDivider.d.ts +5 -3
- package/dist/DropdownMenu/DropdownMenuDivider.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuDivider.js +7 -3
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +4 -4
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +10 -2
- package/dist/Item/Item.d.ts +6 -2
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +19 -4
- package/dist/Layer/layerViewportInset.stylex.d.ts +6 -2
- package/dist/Layer/layerViewportInset.stylex.d.ts.map +1 -1
- package/dist/Layer/layerViewportInset.stylex.js +6 -2
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +13 -7
- package/dist/Layer/useLayerDismissal.d.ts +1 -1
- package/dist/Layer/useLayerDismissal.js +1 -1
- package/dist/Layout/container.stylex.d.ts +5 -5
- package/dist/Layout/container.stylex.js +4 -4
- package/dist/List/ListItem.d.ts +9 -2
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListItem.js +2 -0
- package/dist/Markdown/plugins/frontmatter.d.ts.map +1 -1
- package/dist/Markdown/plugins/frontmatter.js +7 -3
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +22 -8
- package/dist/MultiSelector/OptionActions.a11y.chromium.spec.js +100 -2
- package/dist/MultiSelector/hooks.d.ts.map +1 -1
- package/dist/MultiSelector/hooks.js +3 -1
- package/dist/Popover/Popover.js +2 -2
- package/dist/PowerSearch/PowerSearch.js +1 -1
- package/dist/RadioList/RadioListItem.d.ts +9 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +2 -0
- package/dist/Selector/hooks.d.ts.map +1 -1
- package/dist/Selector/hooks.js +6 -2
- package/dist/Switch/Switch.d.ts +1 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +7 -1
- package/dist/TabList/TabMenu.d.ts +2 -2
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +6 -3
- package/dist/Text/useTruncation.d.ts +7 -5
- package/dist/Text/useTruncation.d.ts.map +1 -1
- package/dist/Text/useTruncation.js +16 -5
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +11 -0
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +26 -0
- package/dist/astryx.css +25 -10
- package/dist/hooks/useEntryAnimation.d.ts +2 -1
- package/dist/hooks/useEntryAnimation.d.ts.map +1 -1
- package/dist/hooks/useEntryAnimation.js +14 -12
- package/dist/hooks/useIsHydrating.d.ts +6 -0
- package/dist/hooks/useIsHydrating.d.ts.map +1 -0
- package/dist/hooks/useIsHydrating.js +30 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +93 -1
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +93 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +0 -3
- package/dist/utils/focusOutline.stylex.d.ts +4 -0
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
- package/dist/utils/focusOutline.stylex.js +4 -0
- package/dist/utils/sharedMutationObserver.d.ts +21 -0
- package/dist/utils/sharedMutationObserver.d.ts.map +1 -0
- package/dist/utils/sharedMutationObserver.js +69 -0
- package/locales/en.json +368 -0
- package/locales/pseudo.json +276 -0
- package/package.json +8 -3
- package/src/CheckboxList/CheckboxList.test.tsx +22 -0
- package/src/CheckboxList/CheckboxListItem.doc.mjs +16 -0
- package/src/CheckboxList/CheckboxListItem.tsx +10 -0
- package/src/Drawer/Drawer.doc.mjs +472 -0
- package/src/Drawer/Drawer.spec.md +357 -0
- package/src/Drawer/Drawer.test.tsx +1300 -0
- package/src/Drawer/Drawer.tsx +613 -0
- package/src/Drawer/DrawerDirection.test.tsx +127 -0
- package/src/Drawer/DrawerHeader.doc.mjs +293 -0
- package/src/Drawer/DrawerHeader.test.tsx +102 -0
- package/src/Drawer/DrawerHeader.tsx +235 -0
- package/src/Drawer/__tests__/DrawerAudit.a11y.chromium.spec.ts +401 -0
- package/src/Drawer/__tests__/DrawerHeaderAudit.a11y.chromium.spec.ts +297 -0
- package/src/Drawer/index.ts +13 -0
- package/src/Drawer/useDrawerDialogPresence.ts +284 -0
- package/src/DropdownMenu/DropdownMenu.test.tsx +21 -12
- package/src/DropdownMenu/DropdownMenu.tsx +2 -2
- package/src/DropdownMenu/DropdownMenuDivider.doc.mjs +2 -2
- package/src/DropdownMenu/DropdownMenuDivider.tsx +9 -5
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +2 -2
- package/src/DropdownMenu/__tests__/Menu.a11y.chromium.spec.ts +145 -0
- package/src/DropdownMenu/__tests__/Menu.a11y.known-failures.ts +26 -0
- package/src/DropdownMenu/__tests__/Menu.a11y.renders.tsx +65 -0
- package/src/DropdownMenu/__tests__/Menu.a11y.states.ts +138 -0
- package/src/DropdownMenu/__tests__/Menu.a11y.test.tsx +136 -0
- package/src/HoverCard/HoverCard.test.tsx +58 -0
- package/src/HoverCard/useHoverCard.tsx +10 -2
- package/src/Item/Item.doc.mjs +11 -7
- package/src/Item/Item.spec.md +226 -0
- package/src/Item/Item.test.tsx +61 -0
- package/src/Item/Item.tsx +39 -3
- package/src/Layer/layerViewportInset.source-build.test.mjs +90 -0
- package/src/Layer/layerViewportInset.stylex.ts +6 -2
- package/src/Layer/layerViewportInset.test.ts +1 -0
- package/src/Layer/useLayer.tsx +24 -13
- package/src/Layer/useLayerDismissal.ts +1 -1
- package/src/Layout/container.stylex.ts +6 -6
- package/src/List/List.test.tsx +19 -0
- package/src/List/ListItem.doc.mjs +24 -5
- package/src/List/ListItem.tsx +10 -1
- package/src/Markdown/plugins/frontmatter.test.tsx +25 -0
- package/src/Markdown/plugins/frontmatter.ts +7 -3
- package/src/MultiSelector/MultiSelector.test.tsx +159 -0
- package/src/MultiSelector/MultiSelector.tsx +40 -7
- package/src/MultiSelector/OptionActions.a11y.chromium.spec.ts +112 -2
- package/src/MultiSelector/hooks.ts +3 -1
- package/src/MultiSelector/useMultiCombobox.doc.mjs +267 -0
- package/src/Popover/Popover.test.tsx +2 -2
- package/src/Popover/Popover.tsx +4 -4
- package/src/PowerSearch/PowerSearch.test.tsx +85 -0
- package/src/PowerSearch/PowerSearch.tsx +2 -2
- package/src/RadioList/RadioList.test.tsx +22 -0
- package/src/RadioList/RadioListItem.doc.mjs +16 -0
- package/src/RadioList/RadioListItem.tsx +10 -1
- package/src/Selector/hooks.ts +6 -2
- package/src/Selector/useCombobox.doc.mjs +237 -0
- package/src/Switch/Switch.test.tsx +21 -0
- package/src/Switch/Switch.tsx +5 -0
- package/src/TabList/TabList.test.tsx +67 -0
- package/src/TabList/TabMenu.doc.mjs +4 -3
- package/src/TabList/TabMenu.tsx +7 -4
- package/src/Text/useTruncation.test.tsx +69 -0
- package/src/Text/useTruncation.ts +16 -5
- package/src/Tokenizer/Tokenizer.test.tsx +54 -1
- package/src/Tooltip/Tooltip.test.tsx +31 -0
- package/src/Tooltip/useTooltip.test.tsx +13 -0
- package/src/Tooltip/useTooltip.tsx +11 -0
- package/src/TreeList/TreeList.spec.md +29 -17
- package/src/Typeahead/BaseTypeahead.tsx +26 -0
- package/src/Typeahead/Typeahead.test.tsx +260 -2
- package/src/hooks/useEntryAnimation.doc.mjs +4 -4
- package/src/hooks/useEntryAnimation.ssr.test.tsx +143 -0
- package/src/hooks/useEntryAnimation.ts +15 -16
- package/src/hooks/useIsHydrating.test.tsx +70 -0
- package/src/hooks/useIsHydrating.ts +31 -0
- package/src/i18n/generated-locales/en.generated.ts +100 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +100 -0
- package/src/index.ts +1 -0
- package/src/theme/derivedVarRegistry.test.ts +0 -3
- package/src/theme/derivedVarRegistry.ts +0 -3
- package/src/utils/focusOutline.stylex.ts +4 -0
- package/src/utils/sharedMutationObserver.test.ts +53 -0
- package/src/utils/sharedMutationObserver.ts +78 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file DrawerHeader.tsx
|
|
3
|
+
* @input Uses React, StyleX, LayoutHeader, Button, Icon, Heading, Text, i18n, BaseProps, isRenderable, mergeProps, themeProps
|
|
4
|
+
* @output Exports DrawerHeader component and DrawerHeaderProps
|
|
5
|
+
* @position Drawer header; composed in a Layout header slot inside Drawer, tested by DrawerHeader.test.tsx
|
|
6
|
+
*
|
|
7
|
+
* Mirrors DialogHeader's API: a title, an optional subtitle, start/end content
|
|
8
|
+
* slots, and a close button that renders only when `onOpenChange` is passed.
|
|
9
|
+
* Two differences follow from Drawer's contract:
|
|
10
|
+
* - It does not move focus on mount. Drawer owns focus entry through
|
|
11
|
+
* `data-autofocus` once its native host is presented.
|
|
12
|
+
* - It does not name the drawer. Drawer's required `label` does.
|
|
13
|
+
*
|
|
14
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
15
|
+
* - /packages/core/src/Drawer/DrawerHeader.doc.mjs (props, anatomy, theming)
|
|
16
|
+
* - /packages/core/src/Drawer/DrawerHeader.test.tsx (tests for new/changed behavior)
|
|
17
|
+
* - /packages/core/src/Drawer/index.ts (exports if types change)
|
|
18
|
+
* - /packages/cli/assets/templates/blocks/components/Drawer/ (showcase blocks)
|
|
19
|
+
* - /packages/cli/assets/templates/blocks/components/DrawerHeader/ (showcase blocks)
|
|
20
|
+
* - /apps/storybook/stories/Drawer.stories.tsx (examples and visual coverage)
|
|
21
|
+
* - /apps/storybook/stories/DrawerHeader.stories.tsx (component audit fixture)
|
|
22
|
+
*/
|
|
23
|
+
import type { ReactNode } from 'react';
|
|
24
|
+
import type { BaseProps } from '../BaseProps';
|
|
25
|
+
export interface DrawerHeaderProps extends BaseProps<HTMLDivElement> {
|
|
26
|
+
/** Ref forwarded to the root element */
|
|
27
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
28
|
+
/**
|
|
29
|
+
* The title of the drawer, rendered as an h2. Keep it inline and
|
|
30
|
+
* non-interactive. It does not name the drawer; Drawer's `label` does.
|
|
31
|
+
*/
|
|
32
|
+
title: ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Optional subtitle displayed below the title in smaller, secondary text.
|
|
35
|
+
* Accepts inline content such as a Link; it renders inside a span, so
|
|
36
|
+
* avoid block elements. Nothing renders for `null`, `undefined`, booleans,
|
|
37
|
+
* or an empty string.
|
|
38
|
+
*/
|
|
39
|
+
subtitle?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Called with `false` when the close button is clicked. Pass the Drawer's
|
|
42
|
+
* own `onOpenChange`. If not provided, no close button is rendered.
|
|
43
|
+
*/
|
|
44
|
+
onOpenChange?: (isOpen: boolean) => unknown;
|
|
45
|
+
/**
|
|
46
|
+
* Content to render before the title (e.g., a back button).
|
|
47
|
+
*/
|
|
48
|
+
startContent?: ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Content to render after the title, before the close button (e.g., action
|
|
51
|
+
* buttons).
|
|
52
|
+
*/
|
|
53
|
+
endContent?: ReactNode;
|
|
54
|
+
/**
|
|
55
|
+
* Overrides automatic end-slot compensation. When omitted, rendering the
|
|
56
|
+
* close action applies block and logical inline-end compensation. Use
|
|
57
|
+
* `inline`, `block`, or `all` to select the axes explicitly.
|
|
58
|
+
*/
|
|
59
|
+
endContentEdgeCompensation?: 'inline' | 'block' | 'all';
|
|
60
|
+
/**
|
|
61
|
+
* Adds a themed border at the bottom edge.
|
|
62
|
+
* When false, spacing collapse is applied automatically for seamless visual flow.
|
|
63
|
+
* Defaults to the parent Layout's `defaultHasDividers` context value.
|
|
64
|
+
*/
|
|
65
|
+
hasDivider?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Header for a Drawer: a title, optional subtitle and start/end content, and a
|
|
69
|
+
* close button when `onOpenChange` is passed. Same API as DialogHeader.
|
|
70
|
+
*
|
|
71
|
+
* Uses LayoutHeader internally for consistent styling with other layout headers.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```
|
|
75
|
+
* <Drawer isOpen={isOpen} onOpenChange={setIsOpen} label="Details">
|
|
76
|
+
* <DrawerHeader title="Details" onOpenChange={setIsOpen} />
|
|
77
|
+
* <Section padding={4}>Content</Section>
|
|
78
|
+
* </Drawer>
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export declare function DrawerHeader({ title, subtitle, onOpenChange, startContent, endContent, endContentEdgeCompensation, hasDivider, xstyle, className, style, ref, ...rest }: DrawerHeaderProps): import("react").JSX.Element;
|
|
82
|
+
export declare namespace DrawerHeader {
|
|
83
|
+
var displayName: string;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=DrawerHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DrawerHeader.d.ts","sourceRoot":"","sources":["../../src/Drawer/DrawerHeader.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA0C5C,MAAM,WAAW,iBAAkB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAClE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;;OAGG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC;IAE5C;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IAEvB;;;;OAIG;IACH,0BAA0B,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;IAExD;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,0BAA0B,EAC1B,UAAU,EACV,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,iBAAiB,+BAoFnB;yBAjGe,YAAY"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file DrawerHeader.tsx
|
|
7
|
+
* @input Uses React, StyleX, LayoutHeader, Button, Icon, Heading, Text, i18n, BaseProps, isRenderable, mergeProps, themeProps
|
|
8
|
+
* @output Exports DrawerHeader component and DrawerHeaderProps
|
|
9
|
+
* @position Drawer header; composed in a Layout header slot inside Drawer, tested by DrawerHeader.test.tsx
|
|
10
|
+
*
|
|
11
|
+
* Mirrors DialogHeader's API: a title, an optional subtitle, start/end content
|
|
12
|
+
* slots, and a close button that renders only when `onOpenChange` is passed.
|
|
13
|
+
* Two differences follow from Drawer's contract:
|
|
14
|
+
* - It does not move focus on mount. Drawer owns focus entry through
|
|
15
|
+
* `data-autofocus` once its native host is presented.
|
|
16
|
+
* - It does not name the drawer. Drawer's required `label` does.
|
|
17
|
+
*
|
|
18
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
19
|
+
* - /packages/core/src/Drawer/DrawerHeader.doc.mjs (props, anatomy, theming)
|
|
20
|
+
* - /packages/core/src/Drawer/DrawerHeader.test.tsx (tests for new/changed behavior)
|
|
21
|
+
* - /packages/core/src/Drawer/index.ts (exports if types change)
|
|
22
|
+
* - /packages/cli/assets/templates/blocks/components/Drawer/ (showcase blocks)
|
|
23
|
+
* - /packages/cli/assets/templates/blocks/components/DrawerHeader/ (showcase blocks)
|
|
24
|
+
* - /apps/storybook/stories/Drawer.stories.tsx (examples and visual coverage)
|
|
25
|
+
* - /apps/storybook/stories/DrawerHeader.stories.tsx (component audit fixture)
|
|
26
|
+
*/
|
|
27
|
+
import * as stylex from '@stylexjs/stylex';
|
|
28
|
+
import "../theme/tokens.stylex.js";
|
|
29
|
+
import { sizeVars, spacingVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
30
|
+
import { Button } from "../Button/index.js";
|
|
31
|
+
import { Heading } from "../Heading/index.js";
|
|
32
|
+
import { Icon } from "../Icon/index.js";
|
|
33
|
+
import { LayoutHeader } from "../Layout/index.js";
|
|
34
|
+
import { Text } from "../Text/index.js";
|
|
35
|
+
import { useTranslator } from "../i18n/index.js";
|
|
36
|
+
import { isRenderable, mergeProps, themeProps } from "../utils/index.js";
|
|
37
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
38
|
+
/**
|
|
39
|
+
* Header for a Drawer: a title, optional subtitle and start/end content, and a
|
|
40
|
+
* close button when `onOpenChange` is passed. Same API as DialogHeader.
|
|
41
|
+
*
|
|
42
|
+
* Uses LayoutHeader internally for consistent styling with other layout headers.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```
|
|
46
|
+
* <Drawer isOpen={isOpen} onOpenChange={setIsOpen} label="Details">
|
|
47
|
+
* <DrawerHeader title="Details" onOpenChange={setIsOpen} />
|
|
48
|
+
* <Section padding={4}>Content</Section>
|
|
49
|
+
* </Drawer>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export function DrawerHeader({
|
|
53
|
+
title,
|
|
54
|
+
subtitle,
|
|
55
|
+
onOpenChange,
|
|
56
|
+
startContent,
|
|
57
|
+
endContent,
|
|
58
|
+
endContentEdgeCompensation,
|
|
59
|
+
hasDivider,
|
|
60
|
+
xstyle,
|
|
61
|
+
className,
|
|
62
|
+
style,
|
|
63
|
+
ref,
|
|
64
|
+
...rest
|
|
65
|
+
}) {
|
|
66
|
+
const t = useTranslator();
|
|
67
|
+
const hasSubtitle = isRenderable(subtitle);
|
|
68
|
+
const hasStartContent = isRenderable(startContent);
|
|
69
|
+
const hasEndContent = isRenderable(endContent);
|
|
70
|
+
const shouldCompensateEndBlock = endContentEdgeCompensation == null ? onOpenChange != null : endContentEdgeCompensation === 'block' || endContentEdgeCompensation === 'all';
|
|
71
|
+
const shouldCompensateEndInline = endContentEdgeCompensation == null ? onOpenChange != null : endContentEdgeCompensation === 'inline' || endContentEdgeCompensation === 'all';
|
|
72
|
+
return /*#__PURE__*/_jsx(LayoutHeader, {
|
|
73
|
+
ref: ref,
|
|
74
|
+
hasDivider: hasDivider,
|
|
75
|
+
xstyle: xstyle,
|
|
76
|
+
className: className,
|
|
77
|
+
style: style,
|
|
78
|
+
...rest,
|
|
79
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
80
|
+
...mergeProps(themeProps('drawer-header'), {
|
|
81
|
+
className: "x78zum5 x1cy8zhl x1qughib xjcht0a"
|
|
82
|
+
}),
|
|
83
|
+
children: [hasStartContent && /*#__PURE__*/_jsx("div", {
|
|
84
|
+
...mergeProps(themeProps('drawer-header-start-content'), {
|
|
85
|
+
className: "x78zum5 x6s0dn4 x1txdalj x2lah0s"
|
|
86
|
+
}),
|
|
87
|
+
children: startContent
|
|
88
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
89
|
+
...mergeProps(themeProps('drawer-header-title-block'), {
|
|
90
|
+
className: "x78zum5 xdt5ytf xsn7fz1 x98rzlu xeuugli xqixskq"
|
|
91
|
+
}),
|
|
92
|
+
children: [/*#__PURE__*/_jsx(Heading, {
|
|
93
|
+
level: 2,
|
|
94
|
+
children: title
|
|
95
|
+
}), hasSubtitle && /*#__PURE__*/_jsx(Text, {
|
|
96
|
+
type: "body",
|
|
97
|
+
size: "sm",
|
|
98
|
+
color: "secondary",
|
|
99
|
+
children: subtitle
|
|
100
|
+
})]
|
|
101
|
+
}), (hasEndContent || onOpenChange != null) && /*#__PURE__*/_jsxs("div", {
|
|
102
|
+
...mergeProps(themeProps('drawer-header-end-content'), {
|
|
103
|
+
0: {
|
|
104
|
+
className: "x78zum5 x6s0dn4 x1txdalj x2lah0s"
|
|
105
|
+
},
|
|
106
|
+
2: {
|
|
107
|
+
className: "x78zum5 x6s0dn4 x1txdalj x2lah0s xhzvc8f"
|
|
108
|
+
},
|
|
109
|
+
1: {
|
|
110
|
+
className: "x78zum5 x6s0dn4 x1txdalj x2lah0s x3kzqx6"
|
|
111
|
+
},
|
|
112
|
+
3: {
|
|
113
|
+
className: "x78zum5 x6s0dn4 x1txdalj x2lah0s xhzvc8f x3kzqx6"
|
|
114
|
+
}
|
|
115
|
+
}[!!shouldCompensateEndBlock << 1 | !!shouldCompensateEndInline << 0]),
|
|
116
|
+
children: [endContent, onOpenChange && /*#__PURE__*/_jsx(Button, {
|
|
117
|
+
variant: "ghost",
|
|
118
|
+
label: t('@astryx.dialog.close'),
|
|
119
|
+
tooltip: t('@astryx.dialog.close'),
|
|
120
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
121
|
+
icon: "close",
|
|
122
|
+
color: "inherit",
|
|
123
|
+
...themeProps('drawer-header-close-icon')
|
|
124
|
+
}),
|
|
125
|
+
onClick: () => {
|
|
126
|
+
onOpenChange(false);
|
|
127
|
+
},
|
|
128
|
+
isIconOnly: true
|
|
129
|
+
})]
|
|
130
|
+
})]
|
|
131
|
+
})
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
DrawerHeader.displayName = 'DrawerHeader';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts
|
|
3
|
+
* @input Drawer.tsx, DrawerHeader.tsx
|
|
4
|
+
* @output Re-exports Drawer and DrawerHeader components and their prop types
|
|
5
|
+
* @position Core entry point for the Drawer directory (`@astryxdesign/core/Drawer`)
|
|
6
|
+
*/
|
|
7
|
+
export { Drawer } from './Drawer';
|
|
8
|
+
export type { DrawerProps } from './Drawer';
|
|
9
|
+
export { DrawerHeader } from './DrawerHeader';
|
|
10
|
+
export type { DrawerHeaderProps } from './DrawerHeader';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Drawer/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,YAAY,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,YAAY,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file index.ts
|
|
5
|
+
* @input Drawer.tsx, DrawerHeader.tsx
|
|
6
|
+
* @output Re-exports Drawer and DrawerHeader components and their prop types
|
|
7
|
+
* @position Core entry point for the Drawer directory (`@astryxdesign/core/Drawer`)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { Drawer } from "./Drawer.js";
|
|
11
|
+
export { DrawerHeader } from "./DrawerHeader.js";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file useDrawerDialogPresence.ts
|
|
3
|
+
* @input Controlled open state, modal mode, dialog ref, and rendered-state setter
|
|
4
|
+
* @output Coordinates native top-layer presence, exit timing, focus restoration, and unmount cleanup
|
|
5
|
+
* @position Drawer-internal hook; consumed only by Drawer.tsx
|
|
6
|
+
*
|
|
7
|
+
* The drawer has two independent notions of presence:
|
|
8
|
+
* - React's rendered state keeps the panel visible for its CSS exit.
|
|
9
|
+
* - Native `showModal()` or `showPopover()` state keeps it in the browser top
|
|
10
|
+
* layer.
|
|
11
|
+
*
|
|
12
|
+
* Their close ordering is a browser-visible invariant: the panel must finish
|
|
13
|
+
* its exit, then leave the active native host and hide in the same task. If the
|
|
14
|
+
* hide lands a frame later, a transformed ancestor becomes the containing block
|
|
15
|
+
* for the now-non-top-layer `position: fixed` panel and it paints back inside
|
|
16
|
+
* the page for one frame.
|
|
17
|
+
*
|
|
18
|
+
* SYNC: When modified, update:
|
|
19
|
+
* - /packages/core/src/Drawer/Drawer.test.tsx
|
|
20
|
+
* - /.github/scripts/modal-close-visibility.js
|
|
21
|
+
*/
|
|
22
|
+
import { type Dispatch, type RefObject, type SetStateAction } from 'react';
|
|
23
|
+
type UseDrawerDialogPresenceOptions = {
|
|
24
|
+
dialogRef: RefObject<HTMLDialogElement | null>;
|
|
25
|
+
isOpen: boolean;
|
|
26
|
+
isModal: boolean;
|
|
27
|
+
setIsRendered: Dispatch<SetStateAction<boolean>>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Coordinates the native dialog and React-rendered presence for Drawer.
|
|
31
|
+
*
|
|
32
|
+
* Opening captures the trigger, enters the modal-dialog or manual-popover host,
|
|
33
|
+
* and honours the component's `data-autofocus` contract. Closing waits for the
|
|
34
|
+
* actual transform transition (with a computed-duration backstop), then leaves
|
|
35
|
+
* the native host and synchronously hides the panel before the browser can paint
|
|
36
|
+
* it outside the top layer, restores focus to the captured trigger, and only
|
|
37
|
+
* then dispatches the popover host's synthetic `close`. Unmount cleanup closes
|
|
38
|
+
* a host left open by React Activity or a removed subtree.
|
|
39
|
+
*/
|
|
40
|
+
export declare function useDrawerDialogPresence({ dialogRef, isOpen, isModal, setIsRendered, }: UseDrawerDialogPresenceOptions): void;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=useDrawerDialogPresence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDrawerDialogPresence.d.ts","sourceRoot":"","sources":["../../src/Drawer/useDrawerDialogPresence.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAaf,KAAK,8BAA8B,GAAG;IACpC,SAAS,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CAClD,CAAC;AAuDF;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,MAAM,EACN,OAAO,EACP,aAAa,GACd,EAAE,8BAA8B,GAAG,IAAI,CAoEvC"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file useDrawerDialogPresence.ts
|
|
7
|
+
* @input Controlled open state, modal mode, dialog ref, and rendered-state setter
|
|
8
|
+
* @output Coordinates native top-layer presence, exit timing, focus restoration, and unmount cleanup
|
|
9
|
+
* @position Drawer-internal hook; consumed only by Drawer.tsx
|
|
10
|
+
*
|
|
11
|
+
* The drawer has two independent notions of presence:
|
|
12
|
+
* - React's rendered state keeps the panel visible for its CSS exit.
|
|
13
|
+
* - Native `showModal()` or `showPopover()` state keeps it in the browser top
|
|
14
|
+
* layer.
|
|
15
|
+
*
|
|
16
|
+
* Their close ordering is a browser-visible invariant: the panel must finish
|
|
17
|
+
* its exit, then leave the active native host and hide in the same task. If the
|
|
18
|
+
* hide lands a frame later, a transformed ancestor becomes the containing block
|
|
19
|
+
* for the now-non-top-layer `position: fixed` panel and it paints back inside
|
|
20
|
+
* the page for one frame.
|
|
21
|
+
*
|
|
22
|
+
* SYNC: When modified, update:
|
|
23
|
+
* - /packages/core/src/Drawer/Drawer.test.tsx
|
|
24
|
+
* - /.github/scripts/modal-close-visibility.js
|
|
25
|
+
*/
|
|
26
|
+
import { useEffect, useRef } from 'react';
|
|
27
|
+
import { flushSync } from 'react-dom';
|
|
28
|
+
|
|
29
|
+
/** Slack past the computed transition before the backstop gives up waiting. */
|
|
30
|
+
const EXIT_BACKSTOP_BUFFER_MS = 50;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Hold used when the transition duration cannot be read — an unresolved
|
|
34
|
+
* `var()` outside a real browser. Picking a fixed number would otherwise make
|
|
35
|
+
* an assumption about the consumer's theme.
|
|
36
|
+
*/
|
|
37
|
+
const EXIT_FALLBACK_MS = 250;
|
|
38
|
+
function isPopoverOpen(dialog) {
|
|
39
|
+
try {
|
|
40
|
+
return dialog.matches(':popover-open');
|
|
41
|
+
} catch {
|
|
42
|
+
// jsdom and pre-Popover browsers do not recognize :popover-open.
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function isDrawerHostOpen(dialog, isModal) {
|
|
47
|
+
return isModal ? dialog.open : isPopoverOpen(dialog) || dialog.open;
|
|
48
|
+
}
|
|
49
|
+
function showDrawerHost(dialog, isModal) {
|
|
50
|
+
if (isModal) {
|
|
51
|
+
dialog.showModal();
|
|
52
|
+
} else if (typeof dialog.showPopover === 'function') {
|
|
53
|
+
dialog.showPopover();
|
|
54
|
+
} else {
|
|
55
|
+
// Reduced fallback for browsers below the Popover API support floor.
|
|
56
|
+
dialog.show();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function dispatchDialogClose(dialog) {
|
|
60
|
+
const EventConstructor = dialog.ownerDocument.defaultView?.Event ?? Event;
|
|
61
|
+
dialog.dispatchEvent(new EventConstructor('close'));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Leaves the active native host. Returns whether the caller owes a synthetic
|
|
66
|
+
* `close` dispatch: `dialog.close()` used to power the non-modal path, and
|
|
67
|
+
* consumers observe its native `close` event through refs/onClose. Popover
|
|
68
|
+
* dismissal has no equivalent event, so that public DOM contract is preserved
|
|
69
|
+
* explicitly — but by the caller, not here. Native `close` is queued as a
|
|
70
|
+
* task, so a consumer's listener always ran after this hook's own focus
|
|
71
|
+
* restore; the synthetic event must keep that ordering (and fire exactly once
|
|
72
|
+
* per exit, including the unmount path).
|
|
73
|
+
*/
|
|
74
|
+
function hideDrawerHost(dialog, isModal) {
|
|
75
|
+
if (!isModal && typeof dialog.hidePopover === 'function') {
|
|
76
|
+
dialog.hidePopover();
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
if (dialog.open) {
|
|
80
|
+
dialog.close();
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Coordinates the native dialog and React-rendered presence for Drawer.
|
|
87
|
+
*
|
|
88
|
+
* Opening captures the trigger, enters the modal-dialog or manual-popover host,
|
|
89
|
+
* and honours the component's `data-autofocus` contract. Closing waits for the
|
|
90
|
+
* actual transform transition (with a computed-duration backstop), then leaves
|
|
91
|
+
* the native host and synchronously hides the panel before the browser can paint
|
|
92
|
+
* it outside the top layer, restores focus to the captured trigger, and only
|
|
93
|
+
* then dispatches the popover host's synthetic `close`. Unmount cleanup closes
|
|
94
|
+
* a host left open by React Activity or a removed subtree.
|
|
95
|
+
*/
|
|
96
|
+
export function useDrawerDialogPresence({
|
|
97
|
+
dialogRef,
|
|
98
|
+
isOpen,
|
|
99
|
+
isModal,
|
|
100
|
+
setIsRendered
|
|
101
|
+
}) {
|
|
102
|
+
// Element focused when the drawer opened — restored on close.
|
|
103
|
+
const triggerElementRef = useRef(null);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
const dialog = dialogRef.current;
|
|
106
|
+
if (!dialog) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (isOpen) {
|
|
110
|
+
if (!isDrawerHostOpen(dialog, isModal)) {
|
|
111
|
+
triggerElementRef.current = document.activeElement;
|
|
112
|
+
showDrawerHost(dialog, isModal);
|
|
113
|
+
// React's autoFocus calls .focus() during commit, before the native host
|
|
114
|
+
// is visible, so it silently fails — honour data-autofocus instead (same
|
|
115
|
+
// contract as Dialog).
|
|
116
|
+
dialog.querySelector('[data-autofocus]')?.focus();
|
|
117
|
+
}
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (!isDrawerHostOpen(dialog, isModal)) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
return waitForDrawerExit(dialog, () => {
|
|
124
|
+
const owesCloseEvent = hideDrawerHost(dialog, isModal);
|
|
125
|
+
// flushSync, not a plain setState: React's default scheduling can land
|
|
126
|
+
// the commit after the next paint, and that one frame is exactly the
|
|
127
|
+
// bug — the panel paints outside the top layer. Both happen in this
|
|
128
|
+
// task, so the browser never gets to paint between them.
|
|
129
|
+
// eslint-disable-next-line @eslint-react/dom-no-flush-sync -- the panel must stop painting in the task the native host closes
|
|
130
|
+
flushSync(() => {
|
|
131
|
+
setIsRendered(false);
|
|
132
|
+
});
|
|
133
|
+
// Return focus after leaving the native host: a modal dialog makes the
|
|
134
|
+
// rest of the document inert, so focusing earlier silently fails.
|
|
135
|
+
triggerElementRef.current?.focus();
|
|
136
|
+
triggerElementRef.current = null;
|
|
137
|
+
// The synthetic popover close fires after the focus restore above,
|
|
138
|
+
// mirroring the task-queued native event: a consumer close listener
|
|
139
|
+
// that retargets focus (master-detail row switching) gets the last word.
|
|
140
|
+
if (owesCloseEvent) {
|
|
141
|
+
dispatchDialogClose(dialog);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}, [dialogRef, isModal, isOpen, setIsRendered]);
|
|
145
|
+
|
|
146
|
+
// Leave the active native host on unmount. When the drawer is mounted inside
|
|
147
|
+
// an <Activity> that flips to mode="hidden", React runs effect cleanups (with
|
|
148
|
+
// stale isOpen) instead of re-running the effect with isOpen=false. Leaving
|
|
149
|
+
// the host active would strand the top-layer surface and skip the next open.
|
|
150
|
+
// This is deliberately separate from the open/close effect: putting it in
|
|
151
|
+
// that cleanup would cut off every delayed slide-out.
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
const dialog = dialogRef.current;
|
|
154
|
+
return () => {
|
|
155
|
+
if (dialog && isDrawerHostOpen(dialog, isModal)) {
|
|
156
|
+
if (hideDrawerHost(dialog, isModal)) {
|
|
157
|
+
// No focus restore on this path — the drawer is being torn down, so
|
|
158
|
+
// the owed synthetic close fires immediately (still exactly once).
|
|
159
|
+
dispatchDialogClose(dialog);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}, [dialogRef, isModal]);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Wait for the panel's transform transition, with a computed-duration
|
|
168
|
+
* backstop. Mirrors BottomSheetPanel.waitForTransition: the native event is
|
|
169
|
+
* authoritative, and the timeout only prevents a lost event from stranding an
|
|
170
|
+
* open dialog.
|
|
171
|
+
*/
|
|
172
|
+
function waitForDrawerExit(element, complete) {
|
|
173
|
+
let done = false;
|
|
174
|
+
let timer = null;
|
|
175
|
+
const finish = () => {
|
|
176
|
+
if (done) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
done = true;
|
|
180
|
+
if (timer != null) {
|
|
181
|
+
clearTimeout(timer);
|
|
182
|
+
}
|
|
183
|
+
element.removeEventListener('transitionend', handleTransitionEnd);
|
|
184
|
+
element.removeEventListener('transitioncancel', handleTransitionEnd);
|
|
185
|
+
complete();
|
|
186
|
+
};
|
|
187
|
+
const handleTransitionEnd = event => {
|
|
188
|
+
if (event.target === element && event.propertyName === 'transform') {
|
|
189
|
+
finish();
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
element.addEventListener('transitionend', handleTransitionEnd);
|
|
193
|
+
element.addEventListener('transitioncancel', handleTransitionEnd);
|
|
194
|
+
const transitionMs = readTransformTransitionMs(element);
|
|
195
|
+
timer = setTimeout(finish, (transitionMs ?? EXIT_FALLBACK_MS) + EXIT_BACKSTOP_BUFFER_MS);
|
|
196
|
+
return () => {
|
|
197
|
+
done = true;
|
|
198
|
+
if (timer != null) {
|
|
199
|
+
clearTimeout(timer);
|
|
200
|
+
}
|
|
201
|
+
element.removeEventListener('transitionend', handleTransitionEnd);
|
|
202
|
+
element.removeEventListener('transitioncancel', handleTransitionEnd);
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Read the transform transition's duration + delay from computed CSS. */
|
|
207
|
+
function readTransformTransitionMs(element) {
|
|
208
|
+
const computed = window.getComputedStyle(element);
|
|
209
|
+
const properties = computed.transitionProperty.split(',').map(value => value.trim());
|
|
210
|
+
const durations = parseTimes(computed.transitionDuration);
|
|
211
|
+
const delays = parseTimes(computed.transitionDelay);
|
|
212
|
+
if (properties.length === 0 || durations.length === 0 || delays.length === 0 || durations.includes(null) || delays.includes(null)) {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
return properties.reduce((longest, property, index) => {
|
|
216
|
+
if (property !== 'transform' && property !== 'all') {
|
|
217
|
+
return longest;
|
|
218
|
+
}
|
|
219
|
+
const duration = durations[index % durations.length];
|
|
220
|
+
const delay = delays[index % delays.length];
|
|
221
|
+
return Math.max(longest, (duration ?? 0) + (delay ?? 0));
|
|
222
|
+
}, 0);
|
|
223
|
+
}
|
|
224
|
+
function parseTimes(value) {
|
|
225
|
+
return value.split(',').map(part => {
|
|
226
|
+
const trimmed = part.trim();
|
|
227
|
+
const time = Number.parseFloat(trimmed);
|
|
228
|
+
if (!Number.isFinite(time)) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
if (trimmed.endsWith('ms')) {
|
|
232
|
+
return time;
|
|
233
|
+
}
|
|
234
|
+
return trimmed.endsWith('s') ? time * 1000 : null;
|
|
235
|
+
});
|
|
236
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseProps } from '../BaseProps';
|
|
2
|
-
export interface DropdownMenuDividerProps extends
|
|
2
|
+
export interface DropdownMenuDividerProps extends Omit<BaseProps<HTMLDivElement>, 'role' | 'aria-orientation'> {
|
|
3
3
|
/** Ref forwarded to the separator element. */
|
|
4
4
|
ref?: React.Ref<HTMLDivElement>;
|
|
5
5
|
}
|
|
@@ -7,7 +7,9 @@ export interface DropdownMenuDividerProps extends Pick<BaseProps, 'xstyle' | 'cl
|
|
|
7
7
|
* A horizontal rule separating groups of menu rows.
|
|
8
8
|
*
|
|
9
9
|
* Renders `role="separator"`, so it is never a stop in the menu's arrow-key
|
|
10
|
-
* order. Equivalent to `{type: 'divider'}` in the `items` data API.
|
|
10
|
+
* order. Equivalent to `{type: 'divider'}` in the `items` data API. Host
|
|
11
|
+
* attributes (`id`, `data-*`, `aria-*`) and DOM handlers reach the separator;
|
|
12
|
+
* its role and orientation stay component-owned.
|
|
11
13
|
*
|
|
12
14
|
* @example
|
|
13
15
|
* ```
|
|
@@ -18,7 +20,7 @@ export interface DropdownMenuDividerProps extends Pick<BaseProps, 'xstyle' | 'cl
|
|
|
18
20
|
* </DropdownMenu>
|
|
19
21
|
* ```
|
|
20
22
|
*/
|
|
21
|
-
export declare function DropdownMenuDivider({ xstyle, className, style, ref, }: DropdownMenuDividerProps): import("react").JSX.Element;
|
|
23
|
+
export declare function DropdownMenuDivider({ xstyle, className, style, ref, ...rest }: DropdownMenuDividerProps): import("react").JSX.Element;
|
|
22
24
|
export declare namespace DropdownMenuDivider {
|
|
23
25
|
var displayName: string;
|
|
24
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenuDivider.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuDivider.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAW5C,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CACpD,SAAS,
|
|
1
|
+
{"version":3,"file":"DropdownMenuDivider.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuDivider.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAW5C,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CACpD,SAAS,CAAC,cAAc,CAAC,EACzB,MAAM,GAAG,kBAAkB,CAC5B;IACC,8CAA8C;IAC9C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,wBAAwB,+BAY1B;yBAlBe,mBAAmB"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file DropdownMenuDivider.tsx
|
|
7
|
-
* @input Uses Divider, spacing tokens, themeProps
|
|
7
|
+
* @input Uses Divider, spacing tokens, themeProps; forwards host props to Divider
|
|
8
8
|
* @output Exports DropdownMenuDivider component and DropdownMenuDividerProps
|
|
9
9
|
* @position Sub-component; used inside DropdownMenu
|
|
10
10
|
*
|
|
@@ -39,7 +39,9 @@ const THEME_CLASS_NAME = themeProps('dropdown-menu-divider').className;
|
|
|
39
39
|
* A horizontal rule separating groups of menu rows.
|
|
40
40
|
*
|
|
41
41
|
* Renders `role="separator"`, so it is never a stop in the menu's arrow-key
|
|
42
|
-
* order. Equivalent to `{type: 'divider'}` in the `items` data API.
|
|
42
|
+
* order. Equivalent to `{type: 'divider'}` in the `items` data API. Host
|
|
43
|
+
* attributes (`id`, `data-*`, `aria-*`) and DOM handlers reach the separator;
|
|
44
|
+
* its role and orientation stay component-owned.
|
|
43
45
|
*
|
|
44
46
|
* @example
|
|
45
47
|
* ```
|
|
@@ -54,9 +56,11 @@ export function DropdownMenuDivider({
|
|
|
54
56
|
xstyle,
|
|
55
57
|
className,
|
|
56
58
|
style,
|
|
57
|
-
ref
|
|
59
|
+
ref,
|
|
60
|
+
...rest
|
|
58
61
|
}) {
|
|
59
62
|
return /*#__PURE__*/_jsx(Divider, {
|
|
63
|
+
...rest,
|
|
60
64
|
ref: ref,
|
|
61
65
|
xstyle: [styles.divider, xstyle],
|
|
62
66
|
className: className ? `${THEME_CLASS_NAME} ${className}` : THEME_CLASS_NAME,
|
|
@@ -659,16 +659,16 @@ export function DropdownMenuSubMenu(props) {
|
|
|
659
659
|
...menuPress.menuProps,
|
|
660
660
|
...mergeProps(themeProps('dropdown-menu'), {
|
|
661
661
|
0: {
|
|
662
|
-
className: "x9f619 x78zum5 xdt5ytf x1lsbc85
|
|
662
|
+
className: "x9f619 x78zum5 xdt5ytf x1lsbc85 xc0b1yq x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o x1j4r261"
|
|
663
663
|
},
|
|
664
664
|
2: {
|
|
665
|
-
className: "x9f619 x78zum5 xdt5ytf x1lsbc85
|
|
665
|
+
className: "x9f619 x78zum5 xdt5ytf x1lsbc85 xc0b1yq x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o xge0x1e xish69e"
|
|
666
666
|
},
|
|
667
667
|
1: {
|
|
668
|
-
className: "x9f619 x78zum5 xdt5ytf x1lsbc85
|
|
668
|
+
className: "x9f619 x78zum5 xdt5ytf x1lsbc85 xc0b1yq x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o x1j4r261 x1odjw0f x6ikm8r xish69e"
|
|
669
669
|
},
|
|
670
670
|
3: {
|
|
671
|
-
className: "x9f619 x78zum5 xdt5ytf x1lsbc85
|
|
671
|
+
className: "x9f619 x78zum5 xdt5ytf x1lsbc85 xc0b1yq x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o xge0x1e x1odjw0f x6ikm8r xish69e"
|
|
672
672
|
}
|
|
673
673
|
}[!!hasOverflow << 1 | !!hasOverflow << 0]),
|
|
674
674
|
children: nestedContent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHoverCard.d.ts","sourceRoot":"","sources":["../../src/HoverCard/useHoverCard.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAIL,KAA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