@cloudscape-design/components 3.0.1345 → 3.0.1347
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/app-layout/visual-refresh-toolbar/drawer/styles.css.js +32 -32
- package/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +90 -87
- package/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +32 -32
- package/app-layout/visual-refresh-toolbar/navigation/styles.css.js +6 -6
- package/app-layout/visual-refresh-toolbar/navigation/styles.scoped.css +11 -11
- package/app-layout/visual-refresh-toolbar/navigation/styles.selectors.js +6 -6
- package/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +30 -30
- package/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +60 -60
- package/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +30 -30
- package/app-layout-toolbar/index.d.ts.map +1 -1
- package/app-layout-toolbar/index.js +1 -0
- package/app-layout-toolbar/index.js.map +1 -1
- package/button-dropdown/index.d.ts.map +1 -1
- package/button-dropdown/index.js +5 -1
- package/button-dropdown/index.js.map +1 -1
- package/button-dropdown/interfaces.d.ts +2 -0
- package/button-dropdown/interfaces.d.ts.map +1 -1
- package/button-dropdown/interfaces.js.map +1 -1
- package/expandable-section/expandable-section-container.d.ts +0 -2
- package/expandable-section/expandable-section-container.d.ts.map +1 -1
- package/expandable-section/expandable-section-container.js +2 -2
- package/expandable-section/expandable-section-container.js.map +1 -1
- package/expandable-section/expandable-section-header.d.ts +3 -1
- package/expandable-section/expandable-section-header.d.ts.map +1 -1
- package/expandable-section/expandable-section-header.js +4 -4
- package/expandable-section/expandable-section-header.js.map +1 -1
- package/expandable-section/internal.d.ts +8 -2
- package/expandable-section/internal.d.ts.map +1 -1
- package/expandable-section/internal.js +24 -10
- package/expandable-section/internal.js.map +1 -1
- package/expandable-section/styles.css.js +43 -42
- package/expandable-section/styles.scoped.css +198 -143
- package/expandable-section/styles.selectors.js +43 -42
- package/flashbar/styles.css.js +50 -50
- package/flashbar/styles.scoped.css +153 -153
- package/flashbar/styles.selectors.js +50 -50
- package/help-panel/styles.css.js +6 -6
- package/help-panel/styles.scoped.css +68 -68
- package/help-panel/styles.selectors.js +6 -6
- package/i18n/messages/all.all.js +1 -1
- package/i18n/messages/all.all.json +1 -1
- package/i18n/messages/all.ar.js +1 -1
- package/i18n/messages/all.ar.json +1 -1
- package/i18n/messages/all.de.js +1 -1
- package/i18n/messages/all.de.json +1 -1
- package/i18n/messages/all.en-GB.js +1 -1
- package/i18n/messages/all.en-GB.json +1 -1
- package/i18n/messages/all.en.js +1 -1
- package/i18n/messages/all.en.json +1 -1
- package/i18n/messages/all.es.js +1 -1
- package/i18n/messages/all.es.json +1 -1
- package/i18n/messages/all.fr.js +1 -1
- package/i18n/messages/all.fr.json +1 -1
- package/i18n/messages/all.id.js +1 -1
- package/i18n/messages/all.id.json +1 -1
- package/i18n/messages/all.it.js +1 -1
- package/i18n/messages/all.it.json +1 -1
- package/i18n/messages/all.ja.js +1 -1
- package/i18n/messages/all.ja.json +1 -1
- package/i18n/messages/all.ko.js +1 -1
- package/i18n/messages/all.ko.json +1 -1
- package/i18n/messages/all.pt-BR.js +1 -1
- package/i18n/messages/all.pt-BR.json +1 -1
- package/i18n/messages/all.tr.js +1 -1
- package/i18n/messages/all.tr.json +1 -1
- package/i18n/messages/all.zh-CN.js +1 -1
- package/i18n/messages/all.zh-CN.json +1 -1
- package/i18n/messages/all.zh-TW.js +1 -1
- package/i18n/messages/all.zh-TW.json +1 -1
- package/i18n/messages-types.d.ts +8 -0
- package/i18n/messages-types.d.ts.map +1 -1
- package/i18n/messages-types.js.map +1 -1
- package/internal/base-component/index.d.ts +1 -0
- package/internal/base-component/index.d.ts.map +1 -1
- package/internal/base-component/index.js +1 -0
- package/internal/base-component/index.js.map +1 -1
- package/internal/base-component/styles.scoped.css +1 -2640
- package/internal/base-theme/styles.css.js +4 -0
- package/internal/base-theme/styles.scoped.css +2651 -0
- package/internal/base-theme/styles.selectors.js +5 -0
- package/internal/components/drag-handle/styles.css.js +14 -14
- package/internal/components/drag-handle/styles.scoped.css +28 -19
- package/internal/components/drag-handle/styles.selectors.js +14 -14
- package/internal/components/token-list/styles.css.js +10 -10
- package/internal/components/token-list/styles.scoped.css +24 -24
- package/internal/components/token-list/styles.selectors.js +10 -10
- package/internal/components/transition/index.d.ts +7 -7
- package/internal/components/transition/index.d.ts.map +1 -1
- package/internal/components/transition/index.js +4 -4
- package/internal/components/transition/index.js.map +1 -1
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/generated/styles/tokens.d.ts +11 -0
- package/internal/generated/styles/tokens.js +12 -1
- package/internal/generated/theming/index.cjs +140 -15
- package/internal/generated/theming/index.cjs.d.ts +18 -0
- package/internal/generated/theming/index.d.ts +18 -0
- package/internal/generated/theming/index.js +140 -15
- package/internal/hooks/use-base-component/index.d.ts +2 -5
- package/internal/hooks/use-base-component/index.d.ts.map +1 -1
- package/internal/hooks/use-base-component/index.js +11 -2
- package/internal/hooks/use-base-component/index.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/link/styles.css.js +21 -21
- package/link/styles.scoped.css +86 -86
- package/link/styles.selectors.js +21 -21
- package/manifest.json +2 -2
- package/package.json +2 -1
- package/side-navigation/implementation.d.ts.map +1 -1
- package/side-navigation/implementation.js +6 -3
- package/side-navigation/implementation.js.map +1 -1
- package/side-navigation/parts.d.ts +2 -0
- package/side-navigation/parts.d.ts.map +1 -1
- package/side-navigation/parts.js +86 -76
- package/side-navigation/parts.js.map +1 -1
- package/side-navigation/styles.css.js +64 -50
- package/side-navigation/styles.scoped.css +552 -106
- package/side-navigation/styles.selectors.js +64 -50
- package/side-navigation/util.d.ts +10 -0
- package/side-navigation/util.d.ts.map +1 -1
- package/side-navigation/util.js +48 -0
- package/side-navigation/util.js.map +1 -1
|
@@ -2,35 +2,35 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"has-adaptive-widths-default": "awsui_has-adaptive-widths-
|
|
7
|
-
"has-adaptive-widths-dashboard": "awsui_has-adaptive-widths-
|
|
8
|
-
"drawer-expanded-mode": "awsui_drawer-expanded-
|
|
9
|
-
"ai-drawer-expanded-mode": "awsui_ai-drawer-expanded-
|
|
10
|
-
"bottom-drawer-expanded-mode": "awsui_bottom-drawer-expanded-
|
|
11
|
-
"ai-drawer": "awsui_ai-
|
|
12
|
-
"navigation": "
|
|
13
|
-
"tools": "
|
|
14
|
-
"global-tools": "awsui_global-
|
|
15
|
-
"bottom-tool": "awsui_bottom-
|
|
16
|
-
"navigation-collapsed": "awsui_navigation-
|
|
17
|
-
"tools-open": "awsui_tools-
|
|
18
|
-
"split-panel-side": "awsui_split-panel-
|
|
19
|
-
"split-panel-bottom": "awsui_split-panel-
|
|
20
|
-
"panel-hidden": "awsui_panel-
|
|
21
|
-
"toolbar-container": "awsui_toolbar-
|
|
22
|
-
"pseudo-toolbar": "awsui_pseudo-
|
|
23
|
-
"pseudo-toolbar-content": "awsui_pseudo-toolbar-
|
|
24
|
-
"notifications-container": "awsui_notifications-
|
|
25
|
-
"notifications-background": "awsui_notifications-
|
|
26
|
-
"main-landmark": "awsui_main-
|
|
27
|
-
"main": "
|
|
28
|
-
"main-disable-paddings": "awsui_main-disable-
|
|
29
|
-
"content-header": "awsui_content-
|
|
30
|
-
"content": "
|
|
31
|
-
"unfocusable-mobile": "awsui_unfocusable-
|
|
32
|
-
"hidden": "
|
|
33
|
-
"breadcrumbs-own": "awsui_breadcrumbs-
|
|
34
|
-
"breadcrumbs-discovered": "awsui_breadcrumbs-
|
|
5
|
+
"root": "awsui_root_7nfqu_a41p9_153",
|
|
6
|
+
"has-adaptive-widths-default": "awsui_has-adaptive-widths-default_7nfqu_a41p9_197",
|
|
7
|
+
"has-adaptive-widths-dashboard": "awsui_has-adaptive-widths-dashboard_7nfqu_a41p9_202",
|
|
8
|
+
"drawer-expanded-mode": "awsui_drawer-expanded-mode_7nfqu_a41p9_217",
|
|
9
|
+
"ai-drawer-expanded-mode": "awsui_ai-drawer-expanded-mode_7nfqu_a41p9_220",
|
|
10
|
+
"bottom-drawer-expanded-mode": "awsui_bottom-drawer-expanded-mode_7nfqu_a41p9_223",
|
|
11
|
+
"ai-drawer": "awsui_ai-drawer_7nfqu_a41p9_220",
|
|
12
|
+
"navigation": "awsui_navigation_7nfqu_a41p9_230",
|
|
13
|
+
"tools": "awsui_tools_7nfqu_a41p9_231",
|
|
14
|
+
"global-tools": "awsui_global-tools_7nfqu_a41p9_232",
|
|
15
|
+
"bottom-tool": "awsui_bottom-tool_7nfqu_a41p9_233",
|
|
16
|
+
"navigation-collapsed": "awsui_navigation-collapsed_7nfqu_a41p9_282",
|
|
17
|
+
"tools-open": "awsui_tools-open_7nfqu_a41p9_295",
|
|
18
|
+
"split-panel-side": "awsui_split-panel-side_7nfqu_a41p9_309",
|
|
19
|
+
"split-panel-bottom": "awsui_split-panel-bottom_7nfqu_a41p9_316",
|
|
20
|
+
"panel-hidden": "awsui_panel-hidden_7nfqu_a41p9_329",
|
|
21
|
+
"toolbar-container": "awsui_toolbar-container_7nfqu_a41p9_339",
|
|
22
|
+
"pseudo-toolbar": "awsui_pseudo-toolbar_7nfqu_a41p9_353",
|
|
23
|
+
"pseudo-toolbar-content": "awsui_pseudo-toolbar-content_7nfqu_a41p9_371",
|
|
24
|
+
"notifications-container": "awsui_notifications-container_7nfqu_a41p9_415",
|
|
25
|
+
"notifications-background": "awsui_notifications-background_7nfqu_a41p9_419",
|
|
26
|
+
"main-landmark": "awsui_main-landmark_7nfqu_a41p9_430",
|
|
27
|
+
"main": "awsui_main_7nfqu_a41p9_430",
|
|
28
|
+
"main-disable-paddings": "awsui_main-disable-paddings_7nfqu_a41p9_439",
|
|
29
|
+
"content-header": "awsui_content-header_7nfqu_a41p9_449",
|
|
30
|
+
"content": "awsui_content_7nfqu_a41p9_449",
|
|
31
|
+
"unfocusable-mobile": "awsui_unfocusable-mobile_7nfqu_a41p9_459",
|
|
32
|
+
"hidden": "awsui_hidden_7nfqu_a41p9_464",
|
|
33
|
+
"breadcrumbs-own": "awsui_breadcrumbs-own_7nfqu_a41p9_468",
|
|
34
|
+
"breadcrumbs-discovered": "awsui_breadcrumbs-discovered_7nfqu_a41p9_468"
|
|
35
35
|
};
|
|
36
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app-layout-toolbar/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAY1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,QAAA,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app-layout-toolbar/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAY1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,QAAA,MAAM,gBAAgB,kGAoGrB,CAAC;AAGF,eAAe,gBAAgB,CAAC"}
|
|
@@ -31,6 +31,7 @@ const AppLayoutToolbar = React.forwardRef(({ contentType = 'default', headerSele
|
|
|
31
31
|
disableContentPaddings: rest.disableContentPaddings,
|
|
32
32
|
navigationWidth,
|
|
33
33
|
navigationHide: rest.navigationHide,
|
|
34
|
+
navigationCloseBehavior: rest.navigationCloseBehavior,
|
|
34
35
|
toolsHide: rest.toolsHide,
|
|
35
36
|
toolsWidth,
|
|
36
37
|
maxContentWidth,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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,GAAG,CAAC,KAA4D,EAAE,EAAE;QAC1F,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACrC,4BAA4B,aAA5B,4BAA4B,uBAA5B,4BAA4B,CAAG,KAAK,CAAC,CAAC;IACxC,CAAC,CAAC;IAEF,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,qBAAqB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IAEnF,wDAAwD;IACxD,MAAM,KAAK,GAAG;QACZ,WAAW;QACX,eAAe;QACf,wBAAwB;QACxB,UAAU;QACV,cAAc;QACd,kBAAkB;QAClB,GAAG,YAAY;QACf,GAAG,IAAI;QACP,SAAS;KACV,CAAC;IAEF,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAErC,OAAO,CACL,oBAAC,6BAA6B,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI;QACjD,6BAAK,GAAG,EAAE,YAAY,CAAC,iBAAiB,EAAE,OAAO,CAAC,KAAM,SAAS;YAC/D,oBAAC,wBAAwB,IAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CAC7C,CACiC,CAC1C,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;AACvD,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { applyDefaults } from '../app-layout/defaults';\nimport { AppLayoutProps } from '../app-layout/interfaces';\nimport { useAppLayoutPlacement } from '../app-layout/utils/use-app-layout-placement';\nimport AppLayoutToolbarInternal from '../app-layout/visual-refresh-toolbar';\nimport { AppLayoutToolbarPublicContext } from '../app-layout/visual-refresh-toolbar/contexts';\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { isDevelopment } from '../internal/is-development';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { NonCancelableCustomEvent } from '../types/events';\nimport { AppLayoutToolbarProps } from './interfaces';\n\nexport { AppLayoutToolbarProps };\n\nconst AppLayoutToolbar = React.forwardRef(\n (\n {\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #f',\n navigationWidth = 280,\n navigationCollapsedWidth = 54,\n toolsWidth = 290,\n maxContentWidth,\n minContentWidth,\n navigationOpen: controlledNavigationOpen,\n onNavigationChange: controlledOnNavigationChange,\n analyticsMetadata,\n ...rest\n }: AppLayoutToolbarProps,\n ref: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isRefresh = useVisualRefresh();\n if (!isRefresh) {\n throw new Error(\n `AppLayoutToolbar component is not supported in the Classic theme. Please switch to the Refresh theme. For more details, refer to the documentation.`\n );\n }\n if (isDevelopment) {\n if (rest.toolsOpen && rest.toolsHide) {\n warnOnce(\n 'AppLayoutToolbar',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n const { __internalRootRef } = useBaseComponent(\n 'AppLayoutToolbar',\n {\n props: {\n contentType,\n disableContentPaddings: rest.disableContentPaddings,\n navigationWidth,\n navigationHide: rest.navigationHide,\n toolsHide: rest.toolsHide,\n toolsWidth,\n maxContentWidth,\n minContentWidth,\n stickyNotifications: rest.stickyNotifications,\n disableContentHeaderOverlap: rest.disableContentHeaderOverlap,\n navigationTriggerHide: rest.navigationTriggerHide,\n },\n metadata: {\n drawersCount: rest.drawers?.length ?? null,\n hasContentHeader: !!rest.contentHeader,\n },\n },\n analyticsMetadata\n );\n const isMobile = useMobile();\n\n const { navigationOpen: defaultNavigationOpen, ...restDefaults } = applyDefaults(\n contentType,\n { maxContentWidth, minContentWidth },\n isRefresh\n );\n\n const [navigationOpen = false, setNavigationOpen] = useControllable(\n controlledNavigationOpen,\n controlledOnNavigationChange,\n isMobile ? false : defaultNavigationOpen,\n { componentName: 'AppLayoutToolbar', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n const onNavigationChange = (event: NonCancelableCustomEvent<AppLayoutProps.ChangeDetail>) => {\n setNavigationOpen(event.detail.open);\n controlledOnNavigationChange?.(event);\n };\n\n const [rootRef, placement] = useAppLayoutPlacement(headerSelector, footerSelector);\n\n // This re-builds the props including the default values\n const props = {\n contentType,\n navigationWidth,\n navigationCollapsedWidth,\n toolsWidth,\n navigationOpen,\n onNavigationChange,\n ...restDefaults,\n ...rest,\n placement,\n };\n\n const baseProps = getBaseProps(rest);\n\n return (\n <AppLayoutToolbarPublicContext.Provider value={true}>\n <div ref={useMergeRefs(__internalRootRef, rootRef)} {...baseProps}>\n <AppLayoutToolbarInternal ref={ref} {...props} />\n </div>\n </AppLayoutToolbarPublicContext.Provider>\n );\n }\n);\n\napplyDisplayName(AppLayoutToolbar, 'AppLayoutToolbar');\nexport default AppLayoutToolbar;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app-layout-toolbar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,wBAAwB,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,YAAY,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AY;QACf,GAAG,IAAI;QACP,SAAS;KACV,CAAC;IAEF,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAErC,OAAO,CACL,oBAAC,6BAA6B,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI;QACjD,6BAAK,GAAG,EAAE,YAAY,CAAC,iBAAiB,EAAE,OAAO,CAAC,KAAM,SAAS;YAC/D,oBAAC,wBAAwB,IAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CAC7C,CACiC,CAC1C,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;AACvD,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { applyDefaults } from '../app-layout/defaults';\nimport { AppLayoutProps } from '../app-layout/interfaces';\nimport { useAppLayoutPlacement } from '../app-layout/utils/use-app-layout-placement';\nimport AppLayoutToolbarInternal from '../app-layout/visual-refresh-toolbar';\nimport { AppLayoutToolbarPublicContext } from '../app-layout/visual-refresh-toolbar/contexts';\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { isDevelopment } from '../internal/is-development';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { NonCancelableCustomEvent } from '../types/events';\nimport { AppLayoutToolbarProps } from './interfaces';\n\nexport { AppLayoutToolbarProps };\n\nconst AppLayoutToolbar = React.forwardRef(\n (\n {\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #f',\n navigationWidth = 280,\n navigationCollapsedWidth = 54,\n toolsWidth = 290,\n maxContentWidth,\n minContentWidth,\n navigationOpen: controlledNavigationOpen,\n onNavigationChange: controlledOnNavigationChange,\n analyticsMetadata,\n ...rest\n }: AppLayoutToolbarProps,\n ref: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isRefresh = useVisualRefresh();\n if (!isRefresh) {\n throw new Error(\n `AppLayoutToolbar component is not supported in the Classic theme. Please switch to the Refresh theme. For more details, refer to the documentation.`\n );\n }\n if (isDevelopment) {\n if (rest.toolsOpen && rest.toolsHide) {\n warnOnce(\n 'AppLayoutToolbar',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n const { __internalRootRef } = useBaseComponent(\n 'AppLayoutToolbar',\n {\n props: {\n contentType,\n disableContentPaddings: rest.disableContentPaddings,\n navigationWidth,\n navigationHide: rest.navigationHide,\n navigationCloseBehavior: rest.navigationCloseBehavior,\n toolsHide: rest.toolsHide,\n toolsWidth,\n maxContentWidth,\n minContentWidth,\n stickyNotifications: rest.stickyNotifications,\n disableContentHeaderOverlap: rest.disableContentHeaderOverlap,\n navigationTriggerHide: rest.navigationTriggerHide,\n },\n metadata: {\n drawersCount: rest.drawers?.length ?? null,\n hasContentHeader: !!rest.contentHeader,\n },\n },\n analyticsMetadata\n );\n const isMobile = useMobile();\n\n const { navigationOpen: defaultNavigationOpen, ...restDefaults } = applyDefaults(\n contentType,\n { maxContentWidth, minContentWidth },\n isRefresh\n );\n\n const [navigationOpen = false, setNavigationOpen] = useControllable(\n controlledNavigationOpen,\n controlledOnNavigationChange,\n isMobile ? false : defaultNavigationOpen,\n { componentName: 'AppLayoutToolbar', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n const onNavigationChange = (event: NonCancelableCustomEvent<AppLayoutProps.ChangeDetail>) => {\n setNavigationOpen(event.detail.open);\n controlledOnNavigationChange?.(event);\n };\n\n const [rootRef, placement] = useAppLayoutPlacement(headerSelector, footerSelector);\n\n // This re-builds the props including the default values\n const props = {\n contentType,\n navigationWidth,\n navigationCollapsedWidth,\n toolsWidth,\n navigationOpen,\n onNavigationChange,\n ...restDefaults,\n ...rest,\n placement,\n };\n\n const baseProps = getBaseProps(rest);\n\n return (\n <AppLayoutToolbarPublicContext.Provider value={true}>\n <div ref={useMergeRefs(__internalRootRef, rootRef)} {...baseProps}>\n <AppLayoutToolbarInternal ref={ref} {...props} />\n </div>\n </AppLayoutToolbarPublicContext.Provider>\n );\n }\n);\n\napplyDisplayName(AppLayoutToolbar, 'AppLayoutToolbar');\nexport default AppLayoutToolbar;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMnD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,QAAA,MAAM,cAAc,qGAwGnB,CAAC;AAGF,eAAe,cAAc,CAAC"}
|
package/button-dropdown/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
'use client';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
6
|
+
import { useInternalI18n } from '../i18n/context';
|
|
6
7
|
import { getBaseProps } from '../internal/base-component';
|
|
7
8
|
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
8
9
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
@@ -21,12 +22,15 @@ const ButtonDropdown = React.forwardRef(({ items, variant = 'normal', loading =
|
|
|
21
22
|
},
|
|
22
23
|
});
|
|
23
24
|
const baseProps = getBaseProps(props);
|
|
25
|
+
const i18n = useInternalI18n('button-dropdown');
|
|
24
26
|
const analyticsComponentMetadata = {
|
|
25
27
|
name: 'awsui.ButtonDropdown',
|
|
26
28
|
label: `.${analyticsSelectors['trigger-label']}`,
|
|
27
29
|
properties: { variant, disabled: `${disabled}` },
|
|
28
30
|
};
|
|
29
|
-
return (React.createElement(InternalButtonDropdown, { ...baseProps, ...baseComponentProps, renderItem: renderItem, ref: ref, items: items, variant: variant, loading: loading, loadingText: loadingText, disabled: disabled, disabledReason: disabledReason, expandableGroups: expandableGroups, expandToViewport: expandToViewport, ariaLabel: ariaLabel, iconName: iconName, iconAlt: iconAlt, iconUrl: iconUrl, iconSvg: iconSvg, onItemClick: onItemClick, onItemFollow: onItemFollow, mainAction: mainAction, fullWidth: fullWidth, nativeMainActionAttributes: nativeMainActionAttributes, nativeTriggerAttributes: nativeTriggerAttributes, filteringType: filteringType, filteringPlaceholder: filteringPlaceholder, filteringAriaLabel: filteringAriaLabel, filteringClearAriaLabel: filteringClearAriaLabel, filteringResultsText: filteringResultsText, noMatch: noMatch, i18nStrings:
|
|
31
|
+
return (React.createElement(InternalButtonDropdown, { ...baseProps, ...baseComponentProps, renderItem: renderItem, ref: ref, items: items, variant: variant, loading: loading, loadingText: loadingText, disabled: disabled, disabledReason: disabledReason, expandableGroups: expandableGroups, expandToViewport: expandToViewport, ariaLabel: ariaLabel, iconName: iconName, iconAlt: iconAlt, iconUrl: iconUrl, iconSvg: iconSvg, onItemClick: onItemClick, onItemFollow: onItemFollow, mainAction: mainAction, fullWidth: fullWidth, nativeMainActionAttributes: nativeMainActionAttributes, nativeTriggerAttributes: nativeTriggerAttributes, filteringType: filteringType, filteringPlaceholder: filteringPlaceholder, filteringAriaLabel: filteringAriaLabel, filteringClearAriaLabel: filteringClearAriaLabel, filteringResultsText: i18n('filteringResultsText', filteringResultsText, format => (matchesCount, totalCount) => format({ matchesCount, totalCount })), noMatch: noMatch, i18nStrings: {
|
|
32
|
+
filteringItemAriaDescription: i18n('i18nStrings.filteringItemAriaDescription', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.filteringItemAriaDescription),
|
|
33
|
+
}, ...getAnalyticsMetadataAttribute({
|
|
30
34
|
component: analyticsComponentMetadata,
|
|
31
35
|
}) }, children));
|
|
32
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/button-dropdown/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,sBAAsB,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEzE,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AAIpE,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CACrC,CACE,EACE,KAAK,EACL,OAAO,GAAG,QAAQ,EAClB,OAAO,GAAG,KAAK,EACf,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,cAAc,EACd,gBAAgB,GAAG,KAAK,EACxB,gBAAgB,GAAG,KAAK,EACxB,SAAS,EACT,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,UAAU,EACV,SAAS,EACT,0BAA0B,EAC1B,uBAAuB,EACvB,UAAU,EACV,aAAa,GAAG,MAAM,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,OAAO,EACP,WAAW,EACX,GA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AAO,EAChB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,0BAA0B,EAAE,0BAA0B,EACtD,uBAAuB,EAAE,uBAAuB,EAChD,aAAa,EAAE,aAAa,EAC5B,oBAAoB,EAAE,oBAAoB,EAC1C,kBAAkB,EAAE,kBAAkB,EACtC,uBAAuB,EAAE,uBAAuB,EAChD,oBAAoB,EAAE,IAAI,CACxB,sBAAsB,EACtB,oBAAoB,EACpB,MAAM,CAAC,EAAE,CAAC,CAAC,YAAY,EAAE,UAAU,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,CAC7E,EACD,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE;YACX,4BAA4B,EAAE,IAAI,CAChC,0CAA0C,EAC1C,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,4BAA4B,CAC1C;SACF,KACG,6BAA6B,CAAC;YAChC,SAAS,EAAE,0BAA0B;SACtC,CAAC,IAED,QAAQ,CACc,CAC1B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AACnD,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { GeneratedAnalyticsMetadataButtonDropdownComponent } from './analytics-metadata/interfaces';\nimport { ButtonDropdownProps } from './interfaces';\nimport InternalButtonDropdown from './internal';\nimport { hasCheckboxItems, hasDisabledReasonItems } from './utils/utils';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\n\nexport { ButtonDropdownProps };\n\nconst ButtonDropdown = React.forwardRef(\n (\n {\n items,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n disabledReason,\n expandableGroups = false,\n expandToViewport = false,\n ariaLabel,\n iconName,\n iconAlt,\n iconUrl,\n iconSvg,\n children,\n onItemClick,\n onItemFollow,\n mainAction,\n fullWidth,\n nativeMainActionAttributes,\n nativeTriggerAttributes,\n renderItem,\n filteringType = 'none',\n filteringPlaceholder,\n filteringAriaLabel,\n filteringClearAriaLabel,\n filteringResultsText,\n noMatch,\n i18nStrings,\n ...props\n }: ButtonDropdownProps,\n ref: React.Ref<ButtonDropdownProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('ButtonDropdown', {\n props: { expandToViewport, expandableGroups, variant, iconName, filteringType },\n metadata: {\n mainAction: !!mainAction,\n checkboxItems: hasCheckboxItems(items),\n hasCustomIcon: Boolean(iconUrl || iconSvg || iconName),\n hasDisabledReason: Boolean(disabledReason),\n hasDisabledReasons: hasDisabledReasonItems(items),\n },\n });\n const baseProps = getBaseProps(props);\n\n const i18n = useInternalI18n('button-dropdown');\n\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataButtonDropdownComponent = {\n name: 'awsui.ButtonDropdown',\n label: `.${analyticsSelectors['trigger-label']}`,\n properties: { variant, disabled: `${disabled}` },\n };\n\n return (\n <InternalButtonDropdown\n {...baseProps}\n {...baseComponentProps}\n renderItem={renderItem}\n ref={ref}\n items={items}\n variant={variant}\n loading={loading}\n loadingText={loadingText}\n disabled={disabled}\n disabledReason={disabledReason}\n expandableGroups={expandableGroups}\n expandToViewport={expandToViewport}\n ariaLabel={ariaLabel}\n iconName={iconName}\n iconAlt={iconAlt}\n iconUrl={iconUrl}\n iconSvg={iconSvg}\n onItemClick={onItemClick}\n onItemFollow={onItemFollow}\n mainAction={mainAction}\n fullWidth={fullWidth}\n nativeMainActionAttributes={nativeMainActionAttributes}\n nativeTriggerAttributes={nativeTriggerAttributes}\n filteringType={filteringType}\n filteringPlaceholder={filteringPlaceholder}\n filteringAriaLabel={filteringAriaLabel}\n filteringClearAriaLabel={filteringClearAriaLabel}\n filteringResultsText={i18n(\n 'filteringResultsText',\n filteringResultsText,\n format => (matchesCount, totalCount) => format({ matchesCount, totalCount })\n )}\n noMatch={noMatch}\n i18nStrings={{\n filteringItemAriaDescription: i18n(\n 'i18nStrings.filteringItemAriaDescription',\n i18nStrings?.filteringItemAriaDescription\n ),\n }}\n {...getAnalyticsMetadataAttribute({\n component: analyticsComponentMetadata,\n })}\n >\n {children}\n </InternalButtonDropdown>\n );\n }\n);\n\napplyDisplayName(ButtonDropdown, 'ButtonDropdown');\nexport default ButtonDropdown;\n"]}
|
|
@@ -210,6 +210,7 @@ export interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewpor
|
|
|
210
210
|
filteringClearAriaLabel?: string;
|
|
211
211
|
/**
|
|
212
212
|
* Specifies the text to display with the number of matches at the bottom of the dropdown menu while filtering.
|
|
213
|
+
* @i18n
|
|
213
214
|
*/
|
|
214
215
|
filteringResultsText?: (matchesCount: number, totalCount: number) => string;
|
|
215
216
|
/**
|
|
@@ -218,6 +219,7 @@ export interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewpor
|
|
|
218
219
|
noMatch?: React.ReactNode;
|
|
219
220
|
/**
|
|
220
221
|
* An object containing all the necessary localized strings required by the component.
|
|
222
|
+
* @i18n
|
|
221
223
|
*/
|
|
222
224
|
i18nStrings?: ButtonDropdownProps.I18nStrings;
|
|
223
225
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAA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G,mBAAmB,CAAC,YAAY,EACjE,KAAK,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,aAAa,KAC1C,IAAI,CAAC;AAEV,MAAM,WAAW,QAAS,SAAQ,mBAAmB,CAAC,IAAI;IACxD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;CACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/button-dropdown/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ReactNode } from 'react';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { ExpandToViewport } from '../dropdown/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../types/base-component';\nimport { BaseNavigationDetail, CancelableEventHandler } from '../types/events';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../types/native-attributes';\n\nexport interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewport {\n /**\n * Array of objects with a number of supported types.\n *\n * The following properties are supported across all types:\n *\n * - `type` (string) - The type of the item. Can be `action`, `group`, `checkbox`. Defaults to `action` if `items` undefined and `group` otherwise.\n * - `id` (string) - allows to identify the item that the user clicked on. Mandatory for individual items, optional for categories.\n * - `text` (string) - description shown in the menu for this item. Mandatory for individual items, optional for categories.\n * - `lang` (string) - (Optional) The language of the item, provided as a BCP 47 language tag.\n * - `disabled` (boolean) - whether the item is disabled. Disabled items are not clickable, but they can be highlighted with the keyboard to make them accessible.\n * - `disabledReason` (string) - (Optional) Displays text near the `text` property when item is disabled. Use to provide additional context.\n * - `description` (string) - additional data that will be passed to a `data-description` attribute. **Deprecated**, has no effect.\n * - `ariaLabel` (string) - (Optional) - ARIA label of the item element.\n * - `dataAttributes` (Record<string, string>) - (Optional) Custom data attributes for the item element. Attribute names are automatically prefixed with \"data-\". The \"testid\" key is reserved.\n *\n * ### action\n *\n * - `href` (string) - (Optional) Defines the target URL of the menu item, turning it into a link.\n * - `download` (boolean | string) - (Optional) Indicates that the link should be downloaded when clicked. Only works when `href` is also provided. If set to `true`, the browser will use the filename from the URL. If set to a string, that string will be used as the suggested filename.\n * - `external` (boolean) - Marks a menu item as external by adding an icon after the menu item text. The link will open in a new tab when clicked. Note that this only works when `href` is also provided.\n * - `externalIconAriaLabel` (string) - Adds an `aria-label` to the external icon.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `secondaryText` (string) - (Optional) Further information about the action that appears below the label.\n * - `labelTag` (string) - (Optional) - A label tag that provides additional guidance, shown next to the label.\n *\n * ### checkbox\n *\n * When `type` is set to \"checkbox\", the values set to `href`, `external` and `externalIconAriaLabel` will be ignored.\n *\n * - `checked` (boolean) - Controls the state of the checkbox item.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `secondaryText` (string) - (Optional) Further information about the action that appears below the label.\n * - `labelTag` (string) - (Optional) - A label tag that provides additional guidance, shown next to the label.\n *\n * ### group\n *\n * - `items` (ReadonlyArray<Item>) - an array of item objects. Items will be rendered as nested menu items but only for the first nesting level, multi-nesting is not supported.\n * An item which belongs to nested group has the following properties: `id`, `text`, `disabled`, and `description`.\n *\n */\n items: ReadonlyArray<ButtonDropdownProps.ItemOrGroup>;\n\n /**\n * Specifies a render function to render custom options in the dropdown menu.\n *\n * The item inside the props has a different shape depending on its type:\n *\n *\n * ### action\n *\n * - `type` ('action') - The item type.\n * - `index` (number) - The item's position relative to its parent.\n * - `option` (Item) - The original item configuration.\n * - `highlighted` (boolean) - Whether the item is currently highlighted.\n * - `disabled` (boolean) - Whether the item is disabled.\n * - `parent` (GroupRenderItem | null) - The parent group item, if any.\n * - `filterText` (string) - The current value of the filtering input, when filtering is enabled.\n *\n * ### checkbox\n *\n * - `type` ('checkbox') - The item type.\n * - `index` (number) - The item's position relative to its parent.\n * - `option` (CheckboxItem) - The original item configuration.\n * - `disabled` (boolean) - Whether the item is disabled.\n * - `highlighted` (boolean) - Whether the item is currently highlighted.\n * - `checked` (boolean) - Controls the state of the checkbox item.\n * - `parent` (GroupRenderItem | null) - The parent group item, if any.\n * - `filterText` (string) - The current value of the filtering input, when filtering is enabled.\n *\n * ### group\n *\n * - `type` ('group') - The item type.\n * - `index` (number) - The item's position in the list.\n * - `option` (ItemGroup) - The original item configuration.\n * - `disabled` (boolean) - Whether the item is disabled.\n * - `highlighted` (boolean) - Whether the item is currently highlighted.\n * - `expanded` (boolean) - Whether the group is expanded.\n * - `expandDirection` ('vertical' | 'horizontal') - The direction in which the group expands.\n * - `filterText` (string) - The current value of the filtering input, when filtering is enabled.\n *\n * When providing a custom `renderItem` implementation, it fully replaces the default visual rendering and content for that item.\n * The component still manages focus, keyboard interactions, and selection state, but it no longer applies its default item layout or typography.\n *\n * When returning `null`, the default styling will be applied.\n */\n renderItem?: ButtonDropdownProps.ItemRenderer;\n\n /**\n * Determines whether the button dropdown is disabled. Users cannot interact with the control if it's disabled.\n */\n disabled?: boolean;\n /**\n * Provides a reason why the button dropdown is disabled (only when `disabled` is `true`).\n * If provided, the disabled button becomes focusable.\n */\n disabledReason?: string;\n /**\n * Renders the button as being in a loading state. It takes precedence over the `disabled` if both are set to `true`.\n * It prevents clicks.\n */\n loading?: boolean;\n /**\n * Specifies the text that screen reader announces when the button dropdown is in a loading state.\n */\n loadingText?: string;\n /** Determines the general styling of the button dropdown.\n * * `primary` for primary buttons\n * * `normal` for secondary buttons\n * * `icon` for icon buttons\n * * `inline-icon` for icon buttons with no outer padding\n */\n variant?: ButtonDropdownProps.Variant;\n /**\n * Specifies the name of the icon used in the button dropdown trigger, used with the [icon component](/components/icon/).\n * Defaults to `ellipsis`. Applies to the `icon` and `inline-icon` variants only.\n */\n iconName?: IconProps.Name;\n /**\n * Specifies alternate text for a custom icon, for use with `iconUrl`. Applies to the `icon` and `inline-icon` variants only.\n */\n iconAlt?: string;\n /**\n * Specifies the URL of a custom icon. Applies to the `icon` and `inline-icon` variants only.\n *\n * If you set both `iconUrl` and `iconSvg`, `iconSvg` will take precedence.\n */\n iconUrl?: string;\n /**\n * Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * Applies to the `icon` and `inline-icon` variants only.\n *\n * If you set both `iconUrl` and `iconSvg`, `iconSvg` will take precedence.\n */\n iconSvg?: React.ReactNode;\n /**\n * Controls expandability of the item groups.\n */\n expandableGroups?: boolean;\n /**\n * Adds `aria-label` to the button dropdown trigger.\n * Use this to provide an accessible name for buttons that don't have visible text.\n */\n ariaLabel?: string;\n /**\n * Text displayed in the button dropdown trigger.\n * @displayname text\n */\n children?: React.ReactNode;\n /**\n * Called when the user clicks on an item, and the item is not disabled. The event detail object contains the id of the clicked item.\n */\n onItemClick?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n /**\n * Called when the user clicks on an item with the left mouse button without pressing\n * modifier keys (that is, CTRL, ALT, SHIFT, META), and the item has an `href` set.\n */\n onItemFollow?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n /**\n * A standalone action that is shown prior to the dropdown trigger.\n * Use it with \"primary\" and \"normal\" variant only.\n *\n * Main action properties:\n * * `text` (string) - Specifies the text shown in the main action.\n * * `external` (boolean) - Marks the main action as external by adding an icon after the text. The link will open in a new tab when clicked. Note that this only works when `href` is also provided.\n * * `externalIconAriaLabel` (string) - Adds an ARIA label to the external icon.\n *\n * The main action also supports the following properties of the [button](/components/button/?tabId=api) component:\n * `ariaLabel`, `disabled`, `loading`, `loadingText`, `href`, `target`, `rel`, `download`, `iconAlt`, `iconName`, `iconUrl`, `iconSvg`, `onClick`, `onFollow`.\n */\n mainAction?: ButtonDropdownProps.MainAction;\n\n /**\n * Sets the button width to be 100% of the parent container width. Button content is centered.\n */\n fullWidth?: boolean;\n\n /**\n * Enables filtering of the dropdown items.\n *\n * When set to `auto`, a search input is rendered inside the dropdown and the items are filtered as the user\n * types. Items are matched client-side using a case-insensitive substring match against their `text`,\n * `secondaryText`, and `labelTag`.\n */\n filteringType?: ButtonDropdownProps.FilteringType;\n\n /**\n * Specifies the placeholder to display in the filtering input. Only relevant when filtering is enabled.\n */\n filteringPlaceholder?: string;\n\n /**\n * Adds an `aria-label` to the filtering input. Only relevant when filtering is enabled.\n */\n filteringAriaLabel?: string;\n\n /**\n * Adds an `aria-label` to the clear button inside the filtering input. Only relevant when filtering is enabled.\n * @i18n\n */\n filteringClearAriaLabel?: string;\n\n /**\n * Specifies the text to display with the number of matches at the bottom of the dropdown menu while filtering.\n */\n filteringResultsText?: (matchesCount: number, totalCount: number) => string;\n\n /**\n * Displayed when filtering is enabled and there are no matches for the filtering input.\n */\n noMatch?: React.ReactNode;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings?: ButtonDropdownProps.I18nStrings;\n\n /**\n * Attributes to add to the native `button` element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeTriggerAttributes?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n\n /**\n * Attributes to add to the native element of the `mainAction`.\n *\n * Specify either `button` for a standard main action, or `anchor` if `html` is set.\n *\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeMainActionAttributes?: {\n button?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n anchor?: NativeAttributes<React.AnchorHTMLAttributes<HTMLAnchorElement>>;\n };\n}\n\nexport namespace ButtonDropdownProps {\n export type Variant = 'normal' | 'primary' | 'icon' | 'inline-icon';\n export type ItemType = 'action' | 'group';\n export type FilteringType = 'auto' | 'none';\n\n export interface I18nStrings {\n filteringItemAriaDescription?: string;\n }\n\n export interface ActionRenderItem {\n type: 'action';\n index: number;\n option: Item;\n highlighted: boolean;\n disabled: boolean;\n parent: GroupRenderItem | null;\n }\n export interface CheckboxRenderItem {\n type: 'checkbox';\n index: number;\n option: CheckboxItem;\n disabled: boolean;\n highlighted: boolean;\n checked: boolean;\n parent: GroupRenderItem | null;\n }\n export interface GroupRenderItem {\n type: 'group';\n index: number;\n option: ItemGroup;\n disabled: boolean;\n highlighted: boolean;\n expanded: boolean;\n expandDirection: 'vertical' | 'horizontal';\n }\n\n export type RenderItem = ActionRenderItem | CheckboxRenderItem | GroupRenderItem;\n export type ItemRenderer = (props: { item: ButtonDropdownProps.RenderItem; filterText?: string }) => ReactNode | null;\n\n export interface MainAction {\n text?: string;\n ariaLabel?: string;\n onClick?: CancelableEventHandler<ButtonProps.ClickDetail>;\n onFollow?: CancelableEventHandler<ButtonProps.FollowDetail>;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n href?: string;\n target?: string;\n rel?: string;\n download?: boolean | string;\n external?: boolean;\n externalIconAriaLabel?: string;\n iconAlt?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n }\n\n export interface Item {\n itemType?: ItemType;\n id: string;\n text: string;\n secondaryText?: string;\n ariaLabel?: string;\n lang?: string;\n disabled?: boolean;\n disabledReason?: string;\n /**\n * @deprecated Has no effect.\n */\n description?: string;\n href?: string;\n download?: boolean | string;\n external?: boolean;\n externalIconAriaLabel?: string;\n iconAlt?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n labelTag?: string;\n dataAttributes?: Record<string, string>;\n }\n\n export interface CheckboxItem\n extends Omit<ButtonDropdownProps.Item, 'href' | 'download' | 'external' | 'externalIconAriaLabel' | 'itemType'> {\n itemType: 'checkbox';\n checked: boolean;\n }\n\n export interface ItemGroup extends Omit<Item, 'id' | 'text' | 'itemType' | 'secondaryText' | 'labelTag'> {\n itemType?: 'group';\n id?: string;\n text?: string;\n items: Items;\n }\n\n export type ItemOrGroup = Item | CheckboxItem | ItemGroup;\n\n export type Items = ReadonlyArray<ItemOrGroup>;\n\n export interface ItemClickDetails extends BaseNavigationDetail {\n id: string;\n checked?: boolean;\n }\n\n export interface Ref {\n /**\n * Focuses the underlying native button. If a main action is defined this will focus that button.\n */\n focus(options?: FocusOptions): void;\n /**\n * Focuses the underlying native button for the dropdown.\n */\n focusDropdownTrigger(options?: FocusOptions): void;\n }\n}\n\nexport interface ButtonDropdownSettings {\n // this means whether action is required to make group expand\n hasExpandableGroups: boolean;\n // on smaller screens expandable groups are integrated into parent dropdown\n // this changes keyboard navigation, highlight and activation behavior for parent dropdown\n isInRestrictedView?: boolean;\n}\n\nexport interface HighlightProps {\n targetItem: ButtonDropdownProps.ItemOrGroup | null;\n isHighlighted: (item: ButtonDropdownProps.ItemOrGroup) => boolean;\n isKeyboardHighlight: (item: ButtonDropdownProps.ItemOrGroup) => boolean;\n isExpanded: (group: ButtonDropdownProps.ItemGroup) => boolean;\n highlightItem: (item: ButtonDropdownProps.ItemOrGroup) => void;\n}\n\nexport type GroupToggle = (item: ButtonDropdownProps.ItemGroup, event: React.SyntheticEvent) => void;\nexport type ItemActivate = (\n item: ButtonDropdownProps.Item | ButtonDropdownProps.CheckboxItem,\n event: React.MouseEvent | React.KeyboardEvent\n) => void;\n\nexport interface LinkItem extends ButtonDropdownProps.Item {\n href: string;\n}\n\nexport interface CustomTriggerProps {\n triggerRef: React.Ref<HTMLElement>;\n testUtilsClass: string;\n ariaLabel: string | undefined;\n disabled: boolean;\n disabledReason?: string;\n isOpen: boolean;\n onClick: () => void;\n ariaExpanded: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/button-dropdown/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ReactNode } from 'react';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { ExpandToViewport } from '../dropdown/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../types/base-component';\nimport { BaseNavigationDetail, CancelableEventHandler } from '../types/events';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../types/native-attributes';\n\nexport interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewport {\n /**\n * Array of objects with a number of supported types.\n *\n * The following properties are supported across all types:\n *\n * - `type` (string) - The type of the item. Can be `action`, `group`, `checkbox`. Defaults to `action` if `items` undefined and `group` otherwise.\n * - `id` (string) - allows to identify the item that the user clicked on. Mandatory for individual items, optional for categories.\n * - `text` (string) - description shown in the menu for this item. Mandatory for individual items, optional for categories.\n * - `lang` (string) - (Optional) The language of the item, provided as a BCP 47 language tag.\n * - `disabled` (boolean) - whether the item is disabled. Disabled items are not clickable, but they can be highlighted with the keyboard to make them accessible.\n * - `disabledReason` (string) - (Optional) Displays text near the `text` property when item is disabled. Use to provide additional context.\n * - `description` (string) - additional data that will be passed to a `data-description` attribute. **Deprecated**, has no effect.\n * - `ariaLabel` (string) - (Optional) - ARIA label of the item element.\n * - `dataAttributes` (Record<string, string>) - (Optional) Custom data attributes for the item element. Attribute names are automatically prefixed with \"data-\". The \"testid\" key is reserved.\n *\n * ### action\n *\n * - `href` (string) - (Optional) Defines the target URL of the menu item, turning it into a link.\n * - `download` (boolean | string) - (Optional) Indicates that the link should be downloaded when clicked. Only works when `href` is also provided. If set to `true`, the browser will use the filename from the URL. If set to a string, that string will be used as the suggested filename.\n * - `external` (boolean) - Marks a menu item as external by adding an icon after the menu item text. The link will open in a new tab when clicked. Note that this only works when `href` is also provided.\n * - `externalIconAriaLabel` (string) - Adds an `aria-label` to the external icon.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `secondaryText` (string) - (Optional) Further information about the action that appears below the label.\n * - `labelTag` (string) - (Optional) - A label tag that provides additional guidance, shown next to the label.\n *\n * ### checkbox\n *\n * When `type` is set to \"checkbox\", the values set to `href`, `external` and `externalIconAriaLabel` will be ignored.\n *\n * - `checked` (boolean) - Controls the state of the checkbox item.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `secondaryText` (string) - (Optional) Further information about the action that appears below the label.\n * - `labelTag` (string) - (Optional) - A label tag that provides additional guidance, shown next to the label.\n *\n * ### group\n *\n * - `items` (ReadonlyArray<Item>) - an array of item objects. Items will be rendered as nested menu items but only for the first nesting level, multi-nesting is not supported.\n * An item which belongs to nested group has the following properties: `id`, `text`, `disabled`, and `description`.\n *\n */\n items: ReadonlyArray<ButtonDropdownProps.ItemOrGroup>;\n\n /**\n * Specifies a render function to render custom options in the dropdown menu.\n *\n * The item inside the props has a different shape depending on its type:\n *\n *\n * ### action\n *\n * - `type` ('action') - The item type.\n * - `index` (number) - The item's position relative to its parent.\n * - `option` (Item) - The original item configuration.\n * - `highlighted` (boolean) - Whether the item is currently highlighted.\n * - `disabled` (boolean) - Whether the item is disabled.\n * - `parent` (GroupRenderItem | null) - The parent group item, if any.\n * - `filterText` (string) - The current value of the filtering input, when filtering is enabled.\n *\n * ### checkbox\n *\n * - `type` ('checkbox') - The item type.\n * - `index` (number) - The item's position relative to its parent.\n * - `option` (CheckboxItem) - The original item configuration.\n * - `disabled` (boolean) - Whether the item is disabled.\n * - `highlighted` (boolean) - Whether the item is currently highlighted.\n * - `checked` (boolean) - Controls the state of the checkbox item.\n * - `parent` (GroupRenderItem | null) - The parent group item, if any.\n * - `filterText` (string) - The current value of the filtering input, when filtering is enabled.\n *\n * ### group\n *\n * - `type` ('group') - The item type.\n * - `index` (number) - The item's position in the list.\n * - `option` (ItemGroup) - The original item configuration.\n * - `disabled` (boolean) - Whether the item is disabled.\n * - `highlighted` (boolean) - Whether the item is currently highlighted.\n * - `expanded` (boolean) - Whether the group is expanded.\n * - `expandDirection` ('vertical' | 'horizontal') - The direction in which the group expands.\n * - `filterText` (string) - The current value of the filtering input, when filtering is enabled.\n *\n * When providing a custom `renderItem` implementation, it fully replaces the default visual rendering and content for that item.\n * The component still manages focus, keyboard interactions, and selection state, but it no longer applies its default item layout or typography.\n *\n * When returning `null`, the default styling will be applied.\n */\n renderItem?: ButtonDropdownProps.ItemRenderer;\n\n /**\n * Determines whether the button dropdown is disabled. Users cannot interact with the control if it's disabled.\n */\n disabled?: boolean;\n /**\n * Provides a reason why the button dropdown is disabled (only when `disabled` is `true`).\n * If provided, the disabled button becomes focusable.\n */\n disabledReason?: string;\n /**\n * Renders the button as being in a loading state. It takes precedence over the `disabled` if both are set to `true`.\n * It prevents clicks.\n */\n loading?: boolean;\n /**\n * Specifies the text that screen reader announces when the button dropdown is in a loading state.\n */\n loadingText?: string;\n /** Determines the general styling of the button dropdown.\n * * `primary` for primary buttons\n * * `normal` for secondary buttons\n * * `icon` for icon buttons\n * * `inline-icon` for icon buttons with no outer padding\n */\n variant?: ButtonDropdownProps.Variant;\n /**\n * Specifies the name of the icon used in the button dropdown trigger, used with the [icon component](/components/icon/).\n * Defaults to `ellipsis`. Applies to the `icon` and `inline-icon` variants only.\n */\n iconName?: IconProps.Name;\n /**\n * Specifies alternate text for a custom icon, for use with `iconUrl`. Applies to the `icon` and `inline-icon` variants only.\n */\n iconAlt?: string;\n /**\n * Specifies the URL of a custom icon. Applies to the `icon` and `inline-icon` variants only.\n *\n * If you set both `iconUrl` and `iconSvg`, `iconSvg` will take precedence.\n */\n iconUrl?: string;\n /**\n * Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * Applies to the `icon` and `inline-icon` variants only.\n *\n * If you set both `iconUrl` and `iconSvg`, `iconSvg` will take precedence.\n */\n iconSvg?: React.ReactNode;\n /**\n * Controls expandability of the item groups.\n */\n expandableGroups?: boolean;\n /**\n * Adds `aria-label` to the button dropdown trigger.\n * Use this to provide an accessible name for buttons that don't have visible text.\n */\n ariaLabel?: string;\n /**\n * Text displayed in the button dropdown trigger.\n * @displayname text\n */\n children?: React.ReactNode;\n /**\n * Called when the user clicks on an item, and the item is not disabled. The event detail object contains the id of the clicked item.\n */\n onItemClick?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n /**\n * Called when the user clicks on an item with the left mouse button without pressing\n * modifier keys (that is, CTRL, ALT, SHIFT, META), and the item has an `href` set.\n */\n onItemFollow?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n /**\n * A standalone action that is shown prior to the dropdown trigger.\n * Use it with \"primary\" and \"normal\" variant only.\n *\n * Main action properties:\n * * `text` (string) - Specifies the text shown in the main action.\n * * `external` (boolean) - Marks the main action as external by adding an icon after the text. The link will open in a new tab when clicked. Note that this only works when `href` is also provided.\n * * `externalIconAriaLabel` (string) - Adds an ARIA label to the external icon.\n *\n * The main action also supports the following properties of the [button](/components/button/?tabId=api) component:\n * `ariaLabel`, `disabled`, `loading`, `loadingText`, `href`, `target`, `rel`, `download`, `iconAlt`, `iconName`, `iconUrl`, `iconSvg`, `onClick`, `onFollow`.\n */\n mainAction?: ButtonDropdownProps.MainAction;\n\n /**\n * Sets the button width to be 100% of the parent container width. Button content is centered.\n */\n fullWidth?: boolean;\n\n /**\n * Enables filtering of the dropdown items.\n *\n * When set to `auto`, a search input is rendered inside the dropdown and the items are filtered as the user\n * types. Items are matched client-side using a case-insensitive substring match against their `text`,\n * `secondaryText`, and `labelTag`.\n */\n filteringType?: ButtonDropdownProps.FilteringType;\n\n /**\n * Specifies the placeholder to display in the filtering input. Only relevant when filtering is enabled.\n */\n filteringPlaceholder?: string;\n\n /**\n * Adds an `aria-label` to the filtering input. Only relevant when filtering is enabled.\n */\n filteringAriaLabel?: string;\n\n /**\n * Adds an `aria-label` to the clear button inside the filtering input. Only relevant when filtering is enabled.\n * @i18n\n */\n filteringClearAriaLabel?: string;\n\n /**\n * Specifies the text to display with the number of matches at the bottom of the dropdown menu while filtering.\n * @i18n\n */\n filteringResultsText?: (matchesCount: number, totalCount: number) => string;\n\n /**\n * Displayed when filtering is enabled and there are no matches for the filtering input.\n */\n noMatch?: React.ReactNode;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: ButtonDropdownProps.I18nStrings;\n\n /**\n * Attributes to add to the native `button` element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeTriggerAttributes?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n\n /**\n * Attributes to add to the native element of the `mainAction`.\n *\n * Specify either `button` for a standard main action, or `anchor` if `html` is set.\n *\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeMainActionAttributes?: {\n button?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n anchor?: NativeAttributes<React.AnchorHTMLAttributes<HTMLAnchorElement>>;\n };\n}\n\nexport namespace ButtonDropdownProps {\n export type Variant = 'normal' | 'primary' | 'icon' | 'inline-icon';\n export type ItemType = 'action' | 'group';\n export type FilteringType = 'auto' | 'none';\n\n export interface I18nStrings {\n filteringItemAriaDescription?: string;\n }\n\n export interface ActionRenderItem {\n type: 'action';\n index: number;\n option: Item;\n highlighted: boolean;\n disabled: boolean;\n parent: GroupRenderItem | null;\n }\n export interface CheckboxRenderItem {\n type: 'checkbox';\n index: number;\n option: CheckboxItem;\n disabled: boolean;\n highlighted: boolean;\n checked: boolean;\n parent: GroupRenderItem | null;\n }\n export interface GroupRenderItem {\n type: 'group';\n index: number;\n option: ItemGroup;\n disabled: boolean;\n highlighted: boolean;\n expanded: boolean;\n expandDirection: 'vertical' | 'horizontal';\n }\n\n export type RenderItem = ActionRenderItem | CheckboxRenderItem | GroupRenderItem;\n export type ItemRenderer = (props: { item: ButtonDropdownProps.RenderItem; filterText?: string }) => ReactNode | null;\n\n export interface MainAction {\n text?: string;\n ariaLabel?: string;\n onClick?: CancelableEventHandler<ButtonProps.ClickDetail>;\n onFollow?: CancelableEventHandler<ButtonProps.FollowDetail>;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n href?: string;\n target?: string;\n rel?: string;\n download?: boolean | string;\n external?: boolean;\n externalIconAriaLabel?: string;\n iconAlt?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n }\n\n export interface Item {\n itemType?: ItemType;\n id: string;\n text: string;\n secondaryText?: string;\n ariaLabel?: string;\n lang?: string;\n disabled?: boolean;\n disabledReason?: string;\n /**\n * @deprecated Has no effect.\n */\n description?: string;\n href?: string;\n download?: boolean | string;\n external?: boolean;\n externalIconAriaLabel?: string;\n iconAlt?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n labelTag?: string;\n dataAttributes?: Record<string, string>;\n }\n\n export interface CheckboxItem\n extends Omit<ButtonDropdownProps.Item, 'href' | 'download' | 'external' | 'externalIconAriaLabel' | 'itemType'> {\n itemType: 'checkbox';\n checked: boolean;\n }\n\n export interface ItemGroup extends Omit<Item, 'id' | 'text' | 'itemType' | 'secondaryText' | 'labelTag'> {\n itemType?: 'group';\n id?: string;\n text?: string;\n items: Items;\n }\n\n export type ItemOrGroup = Item | CheckboxItem | ItemGroup;\n\n export type Items = ReadonlyArray<ItemOrGroup>;\n\n export interface ItemClickDetails extends BaseNavigationDetail {\n id: string;\n checked?: boolean;\n }\n\n export interface Ref {\n /**\n * Focuses the underlying native button. If a main action is defined this will focus that button.\n */\n focus(options?: FocusOptions): void;\n /**\n * Focuses the underlying native button for the dropdown.\n */\n focusDropdownTrigger(options?: FocusOptions): void;\n }\n}\n\nexport interface ButtonDropdownSettings {\n // this means whether action is required to make group expand\n hasExpandableGroups: boolean;\n // on smaller screens expandable groups are integrated into parent dropdown\n // this changes keyboard navigation, highlight and activation behavior for parent dropdown\n isInRestrictedView?: boolean;\n}\n\nexport interface HighlightProps {\n targetItem: ButtonDropdownProps.ItemOrGroup | null;\n isHighlighted: (item: ButtonDropdownProps.ItemOrGroup) => boolean;\n isKeyboardHighlight: (item: ButtonDropdownProps.ItemOrGroup) => boolean;\n isExpanded: (group: ButtonDropdownProps.ItemGroup) => boolean;\n highlightItem: (item: ButtonDropdownProps.ItemOrGroup) => void;\n}\n\nexport type GroupToggle = (item: ButtonDropdownProps.ItemGroup, event: React.SyntheticEvent) => void;\nexport type ItemActivate = (\n item: ButtonDropdownProps.Item | ButtonDropdownProps.CheckboxItem,\n event: React.MouseEvent | React.KeyboardEvent\n) => void;\n\nexport interface LinkItem extends ButtonDropdownProps.Item {\n href: string;\n}\n\nexport interface CustomTriggerProps {\n triggerRef: React.Ref<HTMLElement>;\n testUtilsClass: string;\n ariaLabel: string | undefined;\n disabled: boolean;\n disabledReason?: string;\n isOpen: boolean;\n onClick: () => void;\n ariaExpanded: boolean;\n}\n"]}
|
|
@@ -7,7 +7,6 @@ interface ExpandableSectionContainerProps extends InternalBaseComponentProps {
|
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
variant: InternalVariant;
|
|
9
9
|
expanded: boolean | undefined;
|
|
10
|
-
disableContentPaddings: boolean | undefined;
|
|
11
10
|
__injectAnalyticsComponentMetadata?: boolean;
|
|
12
11
|
}
|
|
13
12
|
export declare const ExpandableSectionContainer: ({
|
|
@@ -16,7 +15,6 @@ export declare const ExpandableSectionContainer: ({
|
|
|
16
15
|
header,
|
|
17
16
|
variant,
|
|
18
17
|
expanded,
|
|
19
|
-
disableContentPaddings,
|
|
20
18
|
__internalRootRef,
|
|
21
19
|
__injectAnalyticsComponentMetadata,
|
|
22
20
|
...rest
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandable-section-container.d.ts","sourceRoot":"","sources":["../../../src/expandable-section/expandable-section-container.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,UAAU,+BAAgC,SAAQ,0BAA0B;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,
|
|
1
|
+
{"version":3,"file":"expandable-section-container.d.ts","sourceRoot":"","sources":["../../../src/expandable-section/expandable-section-container.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,UAAU,+BAAgC,SAAQ,0BAA0B;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED,eAAO,MAAM,0BAA0B,GAAI,oHASxC,+BAA+B,gBA+CjC,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { InternalContainerAsSubstep } from '../container/internal';
|
|
|
6
6
|
import { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';
|
|
7
7
|
import { getAnalyticsMetadataProps } from '../internal/base-component';
|
|
8
8
|
import analyticsSelectors from './analytics-metadata/styles.css.js';
|
|
9
|
-
export const ExpandableSectionContainer = ({ className, children, header, variant, expanded,
|
|
9
|
+
export const ExpandableSectionContainer = ({ className, children, header, variant, expanded, __internalRootRef, __injectAnalyticsComponentMetadata, ...rest }) => {
|
|
10
10
|
const analyticsMetadata = getAnalyticsMetadataProps(rest);
|
|
11
11
|
const analyticsComponentMetadata = {
|
|
12
12
|
name: 'awsui.ExpandableSection',
|
|
@@ -18,7 +18,7 @@ export const ExpandableSectionContainer = ({ className, children, header, varian
|
|
|
18
18
|
: {};
|
|
19
19
|
if (variant === 'container' || variant === 'stacked') {
|
|
20
20
|
return (React.createElement(AnalyticsFunnelSubStep, { subStepIdentifier: analyticsMetadata === null || analyticsMetadata === void 0 ? void 0 : analyticsMetadata.instanceIdentifier, subStepErrorContext: analyticsMetadata === null || analyticsMetadata === void 0 ? void 0 : analyticsMetadata.errorContext },
|
|
21
|
-
React.createElement(InternalContainerAsSubstep, { ...rest, className: className, header: header, variant: variant === 'stacked' ? 'stacked' : 'default', disableContentPaddings:
|
|
21
|
+
React.createElement(InternalContainerAsSubstep, { ...rest, className: className, header: header, variant: variant === 'stacked' ? 'stacked' : 'default', disableContentPaddings: true, disableHeaderPaddings: true, __hiddenContent: !expanded, __internalRootRef: __internalRootRef, ...metadataAttribute }, children)));
|
|
22
22
|
}
|
|
23
23
|
return (React.createElement("div", { className: className, ...rest, ref: __internalRootRef, ...metadataAttribute, ...getAnalyticsLabelAttribute(`.${analyticsSelectors['header-label']}`) },
|
|
24
24
|
header,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandable-section-container.js","sourceRoot":"","sources":["../../../src/expandable-section/expandable-section-container.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,kEAAkE,CAAC;AAE1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,EAAkC,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAKvG,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"expandable-section-container.js","sourceRoot":"","sources":["../../../src/expandable-section/expandable-section-container.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,kEAA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AAqB,EAAE,IAAI,EAC3B,eAAe,EAAE,CAAC,QAAQ,EAC1B,iBAAiB,EAAE,iBAAiB,KAChC,iBAAiB,IAEpB,QAAQ,CACkB,CACN,CAC1B,CAAC;IACJ,CAAC;IAED,OAAO,CACL,6BACE,SAAS,EAAE,SAAS,KAChB,IAAI,EACR,GAAG,EAAE,iBAAiB,KAClB,iBAAiB,KACjB,0BAA0B,CAAC,IAAI,kBAAkB,CAAC,cAAc,CAAC,EAAE,CAAC;QAEvE,MAAM;QACN,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport {\n getAnalyticsLabelAttribute,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { InternalContainerAsSubstep } from '../container/internal';\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\nimport { BasePropsWithAnalyticsMetadata, getAnalyticsMetadataProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { GeneratedAnalyticsMetadataExpandableSectionComponent } from './analytics-metadata/interfaces';\nimport { InternalVariant } from './internal-interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\n\ninterface ExpandableSectionContainerProps extends InternalBaseComponentProps {\n className?: string;\n header: React.ReactNode;\n children?: React.ReactNode;\n variant: InternalVariant;\n expanded: boolean | undefined;\n __injectAnalyticsComponentMetadata?: boolean;\n}\n\nexport const ExpandableSectionContainer = ({\n className,\n children,\n header,\n variant,\n expanded,\n __internalRootRef,\n __injectAnalyticsComponentMetadata,\n ...rest\n}: ExpandableSectionContainerProps) => {\n const analyticsMetadata = getAnalyticsMetadataProps(rest as BasePropsWithAnalyticsMetadata);\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataExpandableSectionComponent = {\n name: 'awsui.ExpandableSection',\n label: { root: 'self' },\n properties: { variant, expanded: `${!!expanded}` },\n };\n\n const metadataAttribute = __injectAnalyticsComponentMetadata\n ? getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })\n : {};\n\n if (variant === 'container' || variant === 'stacked') {\n return (\n <AnalyticsFunnelSubStep\n subStepIdentifier={analyticsMetadata?.instanceIdentifier}\n subStepErrorContext={analyticsMetadata?.errorContext}\n >\n <InternalContainerAsSubstep\n {...rest}\n className={className}\n header={header}\n variant={variant === 'stacked' ? 'stacked' : 'default'}\n disableContentPaddings={true}\n disableHeaderPaddings={true}\n __hiddenContent={!expanded}\n __internalRootRef={__internalRootRef}\n {...metadataAttribute}\n >\n {children}\n </InternalContainerAsSubstep>\n </AnalyticsFunnelSubStep>\n );\n }\n\n return (\n <div\n className={className}\n {...rest}\n ref={__internalRootRef}\n {...metadataAttribute}\n {...getAnalyticsLabelAttribute(`.${analyticsSelectors['header-label']}`)}\n >\n {header}\n {children}\n </div>\n );\n};\n"]}
|
|
@@ -25,6 +25,7 @@ interface ExpandableSectionHeaderProps extends Omit<ExpandableDefaultHeaderProps
|
|
|
25
25
|
headerActions?: ReactNode;
|
|
26
26
|
headingTagOverride?: ExpandableSectionProps.HeadingTag;
|
|
27
27
|
ariaLabelledBy?: string;
|
|
28
|
+
hideExpandIcon?: boolean;
|
|
28
29
|
}
|
|
29
30
|
export declare const ExpandableSectionHeader: ({
|
|
30
31
|
id,
|
|
@@ -45,6 +46,7 @@ export declare const ExpandableSectionHeader: ({
|
|
|
45
46
|
onKeyUp,
|
|
46
47
|
onKeyDown,
|
|
47
48
|
onClick,
|
|
48
|
-
expandIconPosition
|
|
49
|
+
expandIconPosition,
|
|
50
|
+
hideExpandIcon
|
|
49
51
|
}: ExpandableSectionHeaderProps) => JSX.Element;
|
|
50
52
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandable-section-header.d.ts","sourceRoot":"","sources":["../../../src/expandable-section/expandable-section-header.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAalF,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAwExD,UAAU,4BAA4B;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,SAAS,EAAE,oBAAoB,CAAC;IAChC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC;IAClB,OAAO,EAAE,eAAe,CAAC;IACzB,kBAAkB,EAAE,OAAO,GAAG,KAAK,CAAC;CACrC;
|
|
1
|
+
{"version":3,"file":"expandable-section-header.d.ts","sourceRoot":"","sources":["../../../src/expandable-section/expandable-section-header.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAalF,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAwExD,UAAU,4BAA4B;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,SAAS,EAAE,oBAAoB,CAAC;IAChC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC;IAClB,OAAO,EAAE,eAAe,CAAC;IACzB,kBAAkB,EAAE,OAAO,GAAG,KAAK,CAAC;CACrC;AAeD,UAAU,4BAA6B,SAAQ,IAAI,CAAC,4BAA4B,EAAE,UAAU,GAAG,MAAM,CAAC;IACpG,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,kBAAkB,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAmQD,eAAO,MAAM,uBAAuB,GAAI,qQAqBrC,4BAA4B,gBA8F9B,CAAC"}
|
|
@@ -46,8 +46,8 @@ const ExpandableDeprecatedHeader = ({ id, className, onClick, ariaLabel, ariaCon
|
|
|
46
46
|
React.createElement("div", { className: clsx(styles['icon-container'], styles[`icon-container-${variant}`]) }, icon),
|
|
47
47
|
children));
|
|
48
48
|
};
|
|
49
|
-
const ExpandableNavigationHeader = ({ id, className, onClick, ariaLabelledBy, ariaLabel, ariaControls, expanded, children, icon, expandIconPosition, }) => {
|
|
50
|
-
const expandButton = (React.createElement(ExpandIconButton, { icon: icon, ariaLabelledBy: ariaLabelledBy, ariaLabel: ariaLabel, ariaControls: ariaControls, expanded: expanded, onClick: onClick, className: expandIconPosition === 'end' ? styles['icon-container-end'] : undefined }));
|
|
49
|
+
const ExpandableNavigationHeader = ({ id, className, onClick, ariaLabelledBy, ariaLabel, ariaControls, expanded, children, icon, expandIconPosition, hideExpandIcon, }) => {
|
|
50
|
+
const expandButton = hideExpandIcon ? null : (React.createElement(ExpandIconButton, { icon: icon, ariaLabelledBy: ariaLabelledBy, ariaLabel: ariaLabel, ariaControls: ariaControls, expanded: expanded, onClick: onClick, className: expandIconPosition === 'end' ? styles['icon-container-end'] : undefined }));
|
|
51
51
|
return (React.createElement("div", { id: id, className: clsx(className, styles['click-target'], analyticsSelectors['header-label'], expandIconPosition === 'end' && styles['header-icon-end']) }, expandIconPosition === 'end' ? (React.createElement(React.Fragment, null,
|
|
52
52
|
children,
|
|
53
53
|
expandButton)) : (React.createElement(React.Fragment, null,
|
|
@@ -98,7 +98,7 @@ const ExpandableHeaderTextWrapper = ({ id, descriptionId, className, onClick, ar
|
|
|
98
98
|
description && React.createElement(HeaderDescription, { variantOverride: "h3" }, description),
|
|
99
99
|
outsideIcon))));
|
|
100
100
|
};
|
|
101
|
-
export const ExpandableSectionHeader = ({ id, descriptionId, className, variant, header, headerText, headerDescription, headerCounter, headerInfo, headerActions, headingTagOverride, expanded, ariaControls, ariaLabel, ariaLabelledBy, onKeyUp, onKeyDown, onClick, expandIconPosition, }) => {
|
|
101
|
+
export const ExpandableSectionHeader = ({ id, descriptionId, className, variant, header, headerText, headerDescription, headerCounter, headerInfo, headerActions, headingTagOverride, expanded, ariaControls, ariaLabel, ariaLabelledBy, onKeyUp, onKeyDown, onClick, expandIconPosition, hideExpandIcon, }) => {
|
|
102
102
|
const alwaysShowDivider = variantRequiresActionsDivider(variant) && headerActions;
|
|
103
103
|
const icon = (React.createElement(InternalIcon, { size: isThemeActive(Theme.OneTheme) ? 'x-small' : variant === 'container' ? 'medium' : 'normal', className: clsx(styles.icon, expanded && styles.expanded), name: isThemeActive(Theme.OneTheme) ? 'angle-down' : 'caret-down-filled' }));
|
|
104
104
|
const defaultHeaderProps = {
|
|
@@ -122,7 +122,7 @@ export const ExpandableSectionHeader = ({ id, descriptionId, className, variant,
|
|
|
122
122
|
}
|
|
123
123
|
const wrapperClassName = clsx(styles.wrapper, styles[`wrapper-${variant}`], (expanded || alwaysShowDivider) && styles['wrapper-expanded']);
|
|
124
124
|
if (variant === 'navigation') {
|
|
125
|
-
return (React.createElement(ExpandableNavigationHeader, { className: clsx(className, wrapperClassName), ariaLabelledBy: ariaLabelledBy, ...defaultHeaderProps },
|
|
125
|
+
return (React.createElement(ExpandableNavigationHeader, { className: clsx(className, wrapperClassName), ariaLabelledBy: ariaLabelledBy, hideExpandIcon: hideExpandIcon, ...defaultHeaderProps },
|
|
126
126
|
React.createElement("span", { className: styles['header-navigation-content'] }, headerText !== null && headerText !== void 0 ? headerText : header)));
|
|
127
127
|
}
|
|
128
128
|
if (headerText || variant === 'inline') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandable-section-header.js","sourceRoot":"","sources":["../../../src/expandable-section/expandable-section-header.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAA6D,MAAM,OAAO,CAAC;AAClF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,cAAc,EAAE,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAO3D,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAa1C;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CAAC,EACxB,IAAI,EACJ,SAAS,EACT,cAAc,EACd,YAA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S,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,EAC3F,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,KAChB,kBAAkB,IAErB,MAAM,CACoB,CAC9B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { KeyboardEventHandler, MouseEventHandler, ReactNode } from 'react';\nimport clsx from 'clsx';\n\nimport { isThemeActive, Theme, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalHeader, { Description as HeaderDescription } from '../header/internal';\nimport InternalIcon from '../icon/internal';\nimport { isDevelopment } from '../internal/is-development';\nimport {\n GeneratedAnalyticsMetadataExpandableSectionCollapse,\n GeneratedAnalyticsMetadataExpandableSectionExpand,\n} from './analytics-metadata/interfaces';\nimport { ExpandableSectionProps } from './interfaces';\nimport { InternalVariant } from './internal-interfaces';\nimport {\n variantRequiresActionsDivider,\n variantSupportsActions,\n variantSupportsDescription,\n variantSupportsInfoLink,\n} from './utils';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst componentName = 'ExpandableSection';\n\ninterface ExpandIconButtonProps {\n icon: JSX.Element;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n ariaControls: string;\n expanded: boolean;\n onClick: MouseEventHandler;\n stopPropagation?: boolean;\n className?: string;\n}\n\n/**\n * Standalone expand/collapse caret button used when the icon renders OUTSIDE\n * the main clickable header area (navigation variant) or outside the headerButton\n * (end-position with actions/container). This is always an independent interactive\n * element with its own ARIA attributes.\n */\nconst ExpandIconButton = ({\n icon,\n ariaLabel,\n ariaLabelledBy,\n ariaControls,\n expanded,\n onClick,\n stopPropagation,\n className,\n}: ExpandIconButtonProps) => {\n const stopKeyPropagation = stopPropagation\n ? (event: React.KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.stopPropagation();\n }\n }\n : undefined;\n return (\n <button\n className={clsx(styles['icon-container'], styles['expand-button'], className)}\n type=\"button\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n onClick={\n stopPropagation\n ? event => {\n event.stopPropagation();\n onClick(event);\n }\n : onClick\n }\n onKeyUp={stopKeyPropagation}\n onKeyDown={stopKeyPropagation}\n {...getExpandActionAnalyticsMetadataAttribute(expanded)}\n >\n {icon}\n </button>\n );\n};\n\ninterface ExpandableDefaultHeaderProps {\n id: string;\n descriptionId?: string;\n className?: string;\n children?: ReactNode;\n expanded: boolean;\n ariaControls: string;\n ariaLabel?: string;\n onKeyUp: KeyboardEventHandler;\n onKeyDown: KeyboardEventHandler;\n onClick: MouseEventHandler;\n icon: JSX.Element;\n variant: InternalVariant;\n expandIconPosition: 'start' | 'end';\n}\n\ninterface ExpandableNavigationHeaderProps extends Omit<ExpandableDefaultHeaderProps, 'onKeyUp' | 'onKeyDown'> {\n ariaLabelledBy?: string;\n}\n\ninterface ExpandableHeaderTextWrapperProps extends ExpandableDefaultHeaderProps {\n headerDescription?: ReactNode;\n headerCounter?: string;\n headerInfo?: ReactNode;\n headerActions?: ReactNode;\n headingTagOverride?: ExpandableSectionProps.HeadingTag;\n}\n\ninterface ExpandableSectionHeaderProps extends Omit<ExpandableDefaultHeaderProps, 'children' | 'icon'> {\n header?: ReactNode;\n headerText?: ReactNode;\n headerDescription?: ReactNode;\n headerCounter?: string;\n headerInfo?: ReactNode;\n headerActions?: ReactNode;\n headingTagOverride?: ExpandableSectionProps.HeadingTag;\n ariaLabelledBy?: string;\n}\n\nconst getExpandActionAnalyticsMetadataAttribute = (expanded: boolean) => {\n const metadata:\n | GeneratedAnalyticsMetadataExpandableSectionExpand\n | GeneratedAnalyticsMetadataExpandableSectionCollapse = {\n action: !expanded ? 'expand' : 'collapse',\n detail: {\n label: { rootSelector: `.${analyticsSelectors.root}` },\n },\n };\n return getAnalyticsMetadataAttribute(metadata);\n};\nconst ExpandableDeprecatedHeader = ({\n id,\n className,\n onClick,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n onKeyUp,\n onKeyDown,\n variant,\n}: ExpandableDefaultHeaderProps) => {\n return (\n <div\n id={id}\n role=\"button\"\n className={clsx(\n className,\n styles['expand-button'],\n styles['click-target'],\n styles['header-deprecated'],\n analyticsSelectors['header-label']\n )}\n tabIndex={0}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n onClick={onClick}\n aria-label={ariaLabel}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n {...getExpandActionAnalyticsMetadataAttribute(expanded)}\n >\n <div className={clsx(styles['icon-container'], styles[`icon-container-${variant}`])}>{icon}</div>\n {children}\n </div>\n );\n};\n\nconst ExpandableNavigationHeader = ({\n id,\n className,\n onClick,\n ariaLabelledBy,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n expandIconPosition,\n}: ExpandableNavigationHeaderProps) => {\n const expandButton = (\n <ExpandIconButton\n icon={icon}\n ariaLabelledBy={ariaLabelledBy}\n ariaLabel={ariaLabel}\n ariaControls={ariaControls}\n expanded={expanded}\n onClick={onClick}\n className={expandIconPosition === 'end' ? styles['icon-container-end'] : undefined}\n />\n );\n return (\n <div\n id={id}\n className={clsx(\n className,\n styles['click-target'],\n analyticsSelectors['header-label'],\n expandIconPosition === 'end' && styles['header-icon-end']\n )}\n >\n {expandIconPosition === 'end' ? (\n <>\n {children}\n {expandButton}\n </>\n ) : (\n <>\n {expandButton}\n {children}\n </>\n )}\n </div>\n );\n};\n\nconst ExpandableHeaderTextWrapper = ({\n id,\n descriptionId,\n className,\n onClick,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n headerDescription,\n headerCounter,\n headerInfo,\n headerActions,\n variant,\n headingTagOverride,\n onKeyUp,\n onKeyDown,\n expandIconPosition,\n}: ExpandableHeaderTextWrapperProps) => {\n const isContainer = variant === 'container';\n const HeadingTag = headingTagOverride || 'div';\n const supportsInteractiveElements = variantSupportsActions(variant);\n const restrictClickableArea = supportsInteractiveElements && (headerInfo || headerActions);\n const actions = supportsInteractiveElements && headerActions;\n const description = variantSupportsDescription(variant) && headerDescription && (\n <span id={descriptionId} className={styles[`description-${variant}`]}>\n {headerDescription}\n </span>\n );\n const listeners = { onClick, onKeyDown, onKeyUp };\n const iconAtEnd = expandIconPosition === 'end';\n // For the variants that allow actions, when end placement is active, the icon is rendered outside the\n // InternalHeader so it appears at the inline-end of the wrapper, past any header actions.\n // Other variants render the icon at the end of the headerButton itself.\n const renderIconOutsideHeader = iconAtEnd && (isContainer || !!actions);\n\n // If interactive elements are present, constrain the clickable area to only the icon and the header text\n // to prevent nesting interactive elements.\n const headerButtonListeners = restrictClickableArea ? listeners : undefined;\n // For the default and footer variants with description,\n // include also the immediate wrapper around it to include the entire row for backwards compatibility,\n // but exclude the description.\n const headingTagListeners = !headerButtonListeners && !isContainer && description ? listeners : undefined;\n // For all other cases, make the entire header clickable for backwards compatibility.\n const wrapperListeners = !headerButtonListeners && !headingTagListeners ? listeners : undefined;\n\n // Standalone caret button — used when the icon is rendered OUTSIDE the headerButton\n // (end-position with container or actions). Must be its own <button> for accessibility.\n const expandButton = (\n <ExpandIconButton\n icon={icon}\n ariaLabel={ariaLabel}\n ariaLabelledBy={!ariaLabel ? id : undefined}\n ariaControls={ariaControls}\n expanded={expanded}\n onClick={onClick}\n stopPropagation={true}\n className={clsx(styles[`icon-container-${variant}`], styles['icon-container-end'])}\n />\n );\n\n // Decorative inline icon — used when the caret is INSIDE the headerButton\n // (which itself is the interactive element). A nested <button> would be illegal.\n const expandIcon = (\n <span\n className={clsx(\n styles['icon-container'],\n styles[`icon-container-${variant}`],\n iconAtEnd && styles['icon-container-end']\n )}\n >\n {icon}\n </span>\n );\n\n const outsideIcon = renderIconOutsideHeader ? expandButton : null;\n\n const textElement = (\n <span id={id} className={clsx(styles['header-text'], analyticsSelectors['header-label'])}>\n {children}\n </span>\n );\n const headerButton = (\n <span\n className={clsx(\n styles['expand-button'],\n isContainer ? styles['header-container-button'] : styles['header-button'],\n iconAtEnd && styles['header-button-icon-end'],\n headerButtonListeners && styles['click-target']\n )}\n role=\"button\"\n tabIndex={0}\n aria-label={ariaLabel}\n aria-labelledby={!ariaLabel && description ? id : undefined}\n aria-describedby={description ? descriptionId : undefined}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n {...headerButtonListeners}\n {...(headerButtonListeners ? getExpandActionAnalyticsMetadataAttribute(expanded) : {})}\n >\n {renderIconOutsideHeader ? (\n textElement\n ) : iconAtEnd ? (\n <>\n {textElement}\n {expandIcon}\n </>\n ) : (\n <>\n {expandIcon}\n {textElement}\n </>\n )}\n </span>\n );\n\n return (\n <div\n className={clsx(className, wrapperListeners && styles['click-target'], iconAtEnd && styles['header-icon-end'])}\n {...wrapperListeners}\n {...(wrapperListeners ? getExpandActionAnalyticsMetadataAttribute(expanded) : {})}\n >\n {isContainer ? (\n <>\n <InternalHeader\n variant=\"h2\"\n description={description}\n counter={headerCounter}\n info={headerInfo}\n actions={actions}\n headingTagOverride={headingTagOverride}\n __inExpandableSection={true}\n >\n {headerButton}\n </InternalHeader>\n {outsideIcon}\n </>\n ) : (\n <>\n <div className={clsx(styles['header-content'], actions && styles['header-actions-wrapper'])}>\n <HeadingTag\n className={clsx(styles['header-wrapper'], headingTagListeners && styles['click-target'])}\n {...headingTagListeners}\n {...(headingTagListeners ? getExpandActionAnalyticsMetadataAttribute(expanded) : {})}\n >\n {headerButton}\n </HeadingTag>\n {actions}\n </div>\n {description && <HeaderDescription variantOverride=\"h3\">{description}</HeaderDescription>}\n {outsideIcon}\n </>\n )}\n </div>\n );\n};\n\nexport const ExpandableSectionHeader = ({\n id,\n descriptionId,\n className,\n variant,\n header,\n headerText,\n headerDescription,\n headerCounter,\n headerInfo,\n headerActions,\n headingTagOverride,\n expanded,\n ariaControls,\n ariaLabel,\n ariaLabelledBy,\n onKeyUp,\n onKeyDown,\n onClick,\n expandIconPosition,\n}: ExpandableSectionHeaderProps) => {\n const alwaysShowDivider = variantRequiresActionsDivider(variant) && headerActions;\n const icon = (\n <InternalIcon\n size={isThemeActive(Theme.OneTheme) ? 'x-small' : variant === 'container' ? 'medium' : 'normal'}\n className={clsx(styles.icon, expanded && styles.expanded)}\n name={isThemeActive(Theme.OneTheme) ? 'angle-down' : 'caret-down-filled'}\n />\n );\n const defaultHeaderProps = {\n id: id,\n icon: icon,\n expanded: expanded,\n ariaControls: ariaControls,\n ariaLabel: ariaLabel,\n onClick: onClick,\n variant,\n expandIconPosition,\n };\n\n if ((headerCounter || headerInfo) && !variantSupportsInfoLink(variant) && isDevelopment) {\n warnOnce(\n componentName,\n 'The `headerCounter` and `headerInfo` props are only supported for the \"container\" variant.'\n );\n }\n\n if (headerActions && !variantSupportsActions(variant) && isDevelopment) {\n warnOnce(componentName, `The \\`headerActions\\` prop is only supported for the \"container\" and \"default\" variants.`);\n }\n\n if (headerDescription && !variantSupportsDescription(variant) && isDevelopment) {\n warnOnce(componentName, `The \\`headerDescription\\` prop is not supported for the ${variant} variant.`);\n }\n\n const wrapperClassName = clsx(\n styles.wrapper,\n styles[`wrapper-${variant}`],\n (expanded || alwaysShowDivider) && styles['wrapper-expanded']\n );\n if (variant === 'navigation') {\n return (\n <ExpandableNavigationHeader\n className={clsx(className, wrapperClassName)}\n ariaLabelledBy={ariaLabelledBy}\n {...defaultHeaderProps}\n >\n <span className={styles['header-navigation-content']}>{headerText ?? header}</span>\n </ExpandableNavigationHeader>\n );\n }\n\n if (headerText || variant === 'inline') {\n if (!headerText && header && variant === 'inline') {\n warnOnce(componentName, 'Only `headerText` instead of `header` is supported for `inline` variant.');\n }\n return (\n <ExpandableHeaderTextWrapper\n className={clsx(\n className,\n wrapperClassName,\n expanded && styles.expanded,\n !expanded && (!headerActions || headerDescription) && styles['wrapper-not-expanded-without-actions']\n )}\n descriptionId={descriptionId}\n headerDescription={headerDescription}\n headerCounter={headerCounter}\n headerInfo={headerInfo}\n headerActions={headerActions}\n headingTagOverride={headingTagOverride}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n {...defaultHeaderProps}\n >\n {headerText}\n </ExpandableHeaderTextWrapper>\n );\n }\n\n if (variant === 'container' && header && isDevelopment) {\n warnOnce(componentName, 'Use `headerText` instead of `header` to provide the button within the heading for a11y.');\n }\n\n return (\n <ExpandableDeprecatedHeader\n className={clsx(className, wrapperClassName, styles.focusable, expanded && styles.expanded)}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n {...defaultHeaderProps}\n >\n {header}\n </ExpandableDeprecatedHeader>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"expandable-section-header.js","sourceRoot":"","sources":["../../../src/expandable-section/expandable-section-header.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAA6D,MAAM,OAAO,CAAC;AAClF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,cAAc,EAAE,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAO3D,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAa1C;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CAAC,EACxB,IAAI,EACJ,SAAS,EACT,cAAc,EACd,YAAY,EACZ,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ACL,oBAAC,0BAA0B,IACzB,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,gBAAgB,EAAE,MAAM,CAAC,SAAS,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,EAC3F,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,KAChB,kBAAkB,IAErB,MAAM,CACoB,CAC9B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { KeyboardEventHandler, MouseEventHandler, ReactNode } from 'react';\nimport clsx from 'clsx';\n\nimport { isThemeActive, Theme, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalHeader, { Description as HeaderDescription } from '../header/internal';\nimport InternalIcon from '../icon/internal';\nimport { isDevelopment } from '../internal/is-development';\nimport {\n GeneratedAnalyticsMetadataExpandableSectionCollapse,\n GeneratedAnalyticsMetadataExpandableSectionExpand,\n} from './analytics-metadata/interfaces';\nimport { ExpandableSectionProps } from './interfaces';\nimport { InternalVariant } from './internal-interfaces';\nimport {\n variantRequiresActionsDivider,\n variantSupportsActions,\n variantSupportsDescription,\n variantSupportsInfoLink,\n} from './utils';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst componentName = 'ExpandableSection';\n\ninterface ExpandIconButtonProps {\n icon: JSX.Element;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n ariaControls: string;\n expanded: boolean;\n onClick: MouseEventHandler;\n stopPropagation?: boolean;\n className?: string;\n}\n\n/**\n * Standalone expand/collapse caret button used when the icon renders OUTSIDE\n * the main clickable header area (navigation variant) or outside the headerButton\n * (end-position with actions/container). This is always an independent interactive\n * element with its own ARIA attributes.\n */\nconst ExpandIconButton = ({\n icon,\n ariaLabel,\n ariaLabelledBy,\n ariaControls,\n expanded,\n onClick,\n stopPropagation,\n className,\n}: ExpandIconButtonProps) => {\n const stopKeyPropagation = stopPropagation\n ? (event: React.KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.stopPropagation();\n }\n }\n : undefined;\n return (\n <button\n className={clsx(styles['icon-container'], styles['expand-button'], className)}\n type=\"button\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n onClick={\n stopPropagation\n ? event => {\n event.stopPropagation();\n onClick(event);\n }\n : onClick\n }\n onKeyUp={stopKeyPropagation}\n onKeyDown={stopKeyPropagation}\n {...getExpandActionAnalyticsMetadataAttribute(expanded)}\n >\n {icon}\n </button>\n );\n};\n\ninterface ExpandableDefaultHeaderProps {\n id: string;\n descriptionId?: string;\n className?: string;\n children?: ReactNode;\n expanded: boolean;\n ariaControls: string;\n ariaLabel?: string;\n onKeyUp: KeyboardEventHandler;\n onKeyDown: KeyboardEventHandler;\n onClick: MouseEventHandler;\n icon: JSX.Element;\n variant: InternalVariant;\n expandIconPosition: 'start' | 'end';\n}\n\ninterface ExpandableNavigationHeaderProps extends Omit<ExpandableDefaultHeaderProps, 'onKeyUp' | 'onKeyDown'> {\n ariaLabelledBy?: string;\n hideExpandIcon?: boolean;\n}\n\ninterface ExpandableHeaderTextWrapperProps extends ExpandableDefaultHeaderProps {\n headerDescription?: ReactNode;\n headerCounter?: string;\n headerInfo?: ReactNode;\n headerActions?: ReactNode;\n headingTagOverride?: ExpandableSectionProps.HeadingTag;\n}\n\ninterface ExpandableSectionHeaderProps extends Omit<ExpandableDefaultHeaderProps, 'children' | 'icon'> {\n header?: ReactNode;\n headerText?: ReactNode;\n headerDescription?: ReactNode;\n headerCounter?: string;\n headerInfo?: ReactNode;\n headerActions?: ReactNode;\n headingTagOverride?: ExpandableSectionProps.HeadingTag;\n ariaLabelledBy?: string;\n hideExpandIcon?: boolean;\n}\n\nconst getExpandActionAnalyticsMetadataAttribute = (expanded: boolean) => {\n const metadata:\n | GeneratedAnalyticsMetadataExpandableSectionExpand\n | GeneratedAnalyticsMetadataExpandableSectionCollapse = {\n action: !expanded ? 'expand' : 'collapse',\n detail: {\n label: { rootSelector: `.${analyticsSelectors.root}` },\n },\n };\n return getAnalyticsMetadataAttribute(metadata);\n};\nconst ExpandableDeprecatedHeader = ({\n id,\n className,\n onClick,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n onKeyUp,\n onKeyDown,\n variant,\n}: ExpandableDefaultHeaderProps) => {\n return (\n <div\n id={id}\n role=\"button\"\n className={clsx(\n className,\n styles['expand-button'],\n styles['click-target'],\n styles['header-deprecated'],\n analyticsSelectors['header-label']\n )}\n tabIndex={0}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n onClick={onClick}\n aria-label={ariaLabel}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n {...getExpandActionAnalyticsMetadataAttribute(expanded)}\n >\n <div className={clsx(styles['icon-container'], styles[`icon-container-${variant}`])}>{icon}</div>\n {children}\n </div>\n );\n};\n\nconst ExpandableNavigationHeader = ({\n id,\n className,\n onClick,\n ariaLabelledBy,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n expandIconPosition,\n hideExpandIcon,\n}: ExpandableNavigationHeaderProps) => {\n const expandButton = hideExpandIcon ? null : (\n <ExpandIconButton\n icon={icon}\n ariaLabelledBy={ariaLabelledBy}\n ariaLabel={ariaLabel}\n ariaControls={ariaControls}\n expanded={expanded}\n onClick={onClick}\n className={expandIconPosition === 'end' ? styles['icon-container-end'] : undefined}\n />\n );\n return (\n <div\n id={id}\n className={clsx(\n className,\n styles['click-target'],\n analyticsSelectors['header-label'],\n expandIconPosition === 'end' && styles['header-icon-end']\n )}\n >\n {expandIconPosition === 'end' ? (\n <>\n {children}\n {expandButton}\n </>\n ) : (\n <>\n {expandButton}\n {children}\n </>\n )}\n </div>\n );\n};\n\nconst ExpandableHeaderTextWrapper = ({\n id,\n descriptionId,\n className,\n onClick,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n headerDescription,\n headerCounter,\n headerInfo,\n headerActions,\n variant,\n headingTagOverride,\n onKeyUp,\n onKeyDown,\n expandIconPosition,\n}: ExpandableHeaderTextWrapperProps) => {\n const isContainer = variant === 'container';\n const HeadingTag = headingTagOverride || 'div';\n const supportsInteractiveElements = variantSupportsActions(variant);\n const restrictClickableArea = supportsInteractiveElements && (headerInfo || headerActions);\n const actions = supportsInteractiveElements && headerActions;\n const description = variantSupportsDescription(variant) && headerDescription && (\n <span id={descriptionId} className={styles[`description-${variant}`]}>\n {headerDescription}\n </span>\n );\n const listeners = { onClick, onKeyDown, onKeyUp };\n const iconAtEnd = expandIconPosition === 'end';\n // For the variants that allow actions, when end placement is active, the icon is rendered outside the\n // InternalHeader so it appears at the inline-end of the wrapper, past any header actions.\n // Other variants render the icon at the end of the headerButton itself.\n const renderIconOutsideHeader = iconAtEnd && (isContainer || !!actions);\n\n // If interactive elements are present, constrain the clickable area to only the icon and the header text\n // to prevent nesting interactive elements.\n const headerButtonListeners = restrictClickableArea ? listeners : undefined;\n // For the default and footer variants with description,\n // include also the immediate wrapper around it to include the entire row for backwards compatibility,\n // but exclude the description.\n const headingTagListeners = !headerButtonListeners && !isContainer && description ? listeners : undefined;\n // For all other cases, make the entire header clickable for backwards compatibility.\n const wrapperListeners = !headerButtonListeners && !headingTagListeners ? listeners : undefined;\n\n // Standalone caret button — used when the icon is rendered OUTSIDE the headerButton\n // (end-position with container or actions). Must be its own <button> for accessibility.\n const expandButton = (\n <ExpandIconButton\n icon={icon}\n ariaLabel={ariaLabel}\n ariaLabelledBy={!ariaLabel ? id : undefined}\n ariaControls={ariaControls}\n expanded={expanded}\n onClick={onClick}\n stopPropagation={true}\n className={clsx(styles[`icon-container-${variant}`], styles['icon-container-end'])}\n />\n );\n\n // Decorative inline icon — used when the caret is INSIDE the headerButton\n // (which itself is the interactive element). A nested <button> would be illegal.\n const expandIcon = (\n <span\n className={clsx(\n styles['icon-container'],\n styles[`icon-container-${variant}`],\n iconAtEnd && styles['icon-container-end']\n )}\n >\n {icon}\n </span>\n );\n\n const outsideIcon = renderIconOutsideHeader ? expandButton : null;\n\n const textElement = (\n <span id={id} className={clsx(styles['header-text'], analyticsSelectors['header-label'])}>\n {children}\n </span>\n );\n const headerButton = (\n <span\n className={clsx(\n styles['expand-button'],\n isContainer ? styles['header-container-button'] : styles['header-button'],\n iconAtEnd && styles['header-button-icon-end'],\n headerButtonListeners && styles['click-target']\n )}\n role=\"button\"\n tabIndex={0}\n aria-label={ariaLabel}\n aria-labelledby={!ariaLabel && description ? id : undefined}\n aria-describedby={description ? descriptionId : undefined}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n {...headerButtonListeners}\n {...(headerButtonListeners ? getExpandActionAnalyticsMetadataAttribute(expanded) : {})}\n >\n {renderIconOutsideHeader ? (\n textElement\n ) : iconAtEnd ? (\n <>\n {textElement}\n {expandIcon}\n </>\n ) : (\n <>\n {expandIcon}\n {textElement}\n </>\n )}\n </span>\n );\n\n return (\n <div\n className={clsx(className, wrapperListeners && styles['click-target'], iconAtEnd && styles['header-icon-end'])}\n {...wrapperListeners}\n {...(wrapperListeners ? getExpandActionAnalyticsMetadataAttribute(expanded) : {})}\n >\n {isContainer ? (\n <>\n <InternalHeader\n variant=\"h2\"\n description={description}\n counter={headerCounter}\n info={headerInfo}\n actions={actions}\n headingTagOverride={headingTagOverride}\n __inExpandableSection={true}\n >\n {headerButton}\n </InternalHeader>\n {outsideIcon}\n </>\n ) : (\n <>\n <div className={clsx(styles['header-content'], actions && styles['header-actions-wrapper'])}>\n <HeadingTag\n className={clsx(styles['header-wrapper'], headingTagListeners && styles['click-target'])}\n {...headingTagListeners}\n {...(headingTagListeners ? getExpandActionAnalyticsMetadataAttribute(expanded) : {})}\n >\n {headerButton}\n </HeadingTag>\n {actions}\n </div>\n {description && <HeaderDescription variantOverride=\"h3\">{description}</HeaderDescription>}\n {outsideIcon}\n </>\n )}\n </div>\n );\n};\n\nexport const ExpandableSectionHeader = ({\n id,\n descriptionId,\n className,\n variant,\n header,\n headerText,\n headerDescription,\n headerCounter,\n headerInfo,\n headerActions,\n headingTagOverride,\n expanded,\n ariaControls,\n ariaLabel,\n ariaLabelledBy,\n onKeyUp,\n onKeyDown,\n onClick,\n expandIconPosition,\n hideExpandIcon,\n}: ExpandableSectionHeaderProps) => {\n const alwaysShowDivider = variantRequiresActionsDivider(variant) && headerActions;\n const icon = (\n <InternalIcon\n size={isThemeActive(Theme.OneTheme) ? 'x-small' : variant === 'container' ? 'medium' : 'normal'}\n className={clsx(styles.icon, expanded && styles.expanded)}\n name={isThemeActive(Theme.OneTheme) ? 'angle-down' : 'caret-down-filled'}\n />\n );\n const defaultHeaderProps = {\n id: id,\n icon: icon,\n expanded: expanded,\n ariaControls: ariaControls,\n ariaLabel: ariaLabel,\n onClick: onClick,\n variant,\n expandIconPosition,\n };\n\n if ((headerCounter || headerInfo) && !variantSupportsInfoLink(variant) && isDevelopment) {\n warnOnce(\n componentName,\n 'The `headerCounter` and `headerInfo` props are only supported for the \"container\" variant.'\n );\n }\n\n if (headerActions && !variantSupportsActions(variant) && isDevelopment) {\n warnOnce(componentName, `The \\`headerActions\\` prop is only supported for the \"container\" and \"default\" variants.`);\n }\n\n if (headerDescription && !variantSupportsDescription(variant) && isDevelopment) {\n warnOnce(componentName, `The \\`headerDescription\\` prop is not supported for the ${variant} variant.`);\n }\n\n const wrapperClassName = clsx(\n styles.wrapper,\n styles[`wrapper-${variant}`],\n (expanded || alwaysShowDivider) && styles['wrapper-expanded']\n );\n if (variant === 'navigation') {\n return (\n <ExpandableNavigationHeader\n className={clsx(className, wrapperClassName)}\n ariaLabelledBy={ariaLabelledBy}\n hideExpandIcon={hideExpandIcon}\n {...defaultHeaderProps}\n >\n <span className={styles['header-navigation-content']}>{headerText ?? header}</span>\n </ExpandableNavigationHeader>\n );\n }\n\n if (headerText || variant === 'inline') {\n if (!headerText && header && variant === 'inline') {\n warnOnce(componentName, 'Only `headerText` instead of `header` is supported for `inline` variant.');\n }\n return (\n <ExpandableHeaderTextWrapper\n className={clsx(\n className,\n wrapperClassName,\n expanded && styles.expanded,\n !expanded && (!headerActions || headerDescription) && styles['wrapper-not-expanded-without-actions']\n )}\n descriptionId={descriptionId}\n headerDescription={headerDescription}\n headerCounter={headerCounter}\n headerInfo={headerInfo}\n headerActions={headerActions}\n headingTagOverride={headingTagOverride}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n {...defaultHeaderProps}\n >\n {headerText}\n </ExpandableHeaderTextWrapper>\n );\n }\n\n if (variant === 'container' && header && isDevelopment) {\n warnOnce(componentName, 'Use `headerText` instead of `header` to provide the button within the heading for a11y.');\n }\n\n return (\n <ExpandableDeprecatedHeader\n className={clsx(className, wrapperClassName, styles.focusable, expanded && styles.expanded)}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n {...defaultHeaderProps}\n >\n {header}\n </ExpandableDeprecatedHeader>\n );\n};\n"]}
|