@cloudscape-design/components-themeable 3.0.1190 → 3.0.1192
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/button-dropdown/category-elements/styles.scss +14 -0
- package/lib/internal/scss/button-dropdown/item-element/styles.scss +15 -0
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/template/button-dropdown/category-elements/category-element.d.ts +1 -1
- package/lib/internal/template/button-dropdown/category-elements/category-element.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/category-elements/category-element.js +21 -7
- package/lib/internal/template/button-dropdown/category-elements/category-element.js.map +1 -1
- package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.d.ts +1 -1
- package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.js +16 -4
- package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.js.map +1 -1
- package/lib/internal/template/button-dropdown/category-elements/mobile-expandable-category-element.d.ts +1 -1
- package/lib/internal/template/button-dropdown/category-elements/mobile-expandable-category-element.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/category-elements/mobile-expandable-category-element.js +16 -4
- package/lib/internal/template/button-dropdown/category-elements/mobile-expandable-category-element.js.map +1 -1
- package/lib/internal/template/button-dropdown/category-elements/styles.css.js +18 -17
- package/lib/internal/template/button-dropdown/category-elements/styles.scoped.css +37 -26
- package/lib/internal/template/button-dropdown/category-elements/styles.selectors.js +18 -17
- package/lib/internal/template/button-dropdown/index.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/index.js +2 -2
- package/lib/internal/template/button-dropdown/index.js.map +1 -1
- package/lib/internal/template/button-dropdown/interfaces.d.ts +81 -1
- package/lib/internal/template/button-dropdown/interfaces.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/interfaces.js.map +1 -1
- package/lib/internal/template/button-dropdown/internal.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/internal.js +2 -2
- package/lib/internal/template/button-dropdown/internal.js.map +1 -1
- package/lib/internal/template/button-dropdown/item-element/index.d.ts +1 -1
- package/lib/internal/template/button-dropdown/item-element/index.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/item-element/index.js +33 -7
- package/lib/internal/template/button-dropdown/item-element/index.js.map +1 -1
- package/lib/internal/template/button-dropdown/item-element/styles.css.js +21 -20
- package/lib/internal/template/button-dropdown/item-element/styles.scoped.css +44 -31
- package/lib/internal/template/button-dropdown/item-element/styles.selectors.js +21 -20
- package/lib/internal/template/button-dropdown/items-list.d.ts +1 -1
- package/lib/internal/template/button-dropdown/items-list.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/items-list.js +4 -4
- package/lib/internal/template/button-dropdown/items-list.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/package.json +1 -1
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"header": "
|
|
6
|
-
"disabled": "
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"expand-icon
|
|
17
|
-
"expand-icon-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
5
|
+
"header": "awsui_header_16mm3_1qp0c_145",
|
|
6
|
+
"disabled": "awsui_disabled_16mm3_1qp0c_161",
|
|
7
|
+
"no-content-styling": "awsui_no-content-styling_16mm3_1qp0c_165",
|
|
8
|
+
"expandable-header": "awsui_expandable-header_16mm3_1qp0c_171",
|
|
9
|
+
"rolled-down": "awsui_rolled-down_16mm3_1qp0c_182",
|
|
10
|
+
"highlighted": "awsui_highlighted_16mm3_1qp0c_185",
|
|
11
|
+
"is-focused": "awsui_is-focused_16mm3_1qp0c_208",
|
|
12
|
+
"visual-refresh": "awsui_visual-refresh_16mm3_1qp0c_211",
|
|
13
|
+
"category": "awsui_category_16mm3_1qp0c_215",
|
|
14
|
+
"expandable": "awsui_expandable_16mm3_1qp0c_171",
|
|
15
|
+
"variant-navigation": "awsui_variant-navigation_16mm3_1qp0c_230",
|
|
16
|
+
"expand-icon": "awsui_expand-icon_16mm3_1qp0c_237",
|
|
17
|
+
"expand-icon-up": "awsui_expand-icon-up_16mm3_1qp0c_255",
|
|
18
|
+
"expand-icon-right": "awsui_expand-icon-right_16mm3_1qp0c_258",
|
|
19
|
+
"items-list-container": "awsui_items-list-container_16mm3_1qp0c_266",
|
|
20
|
+
"in-dropdown": "awsui_in-dropdown_16mm3_1qp0c_275",
|
|
21
|
+
"icon-wrapper": "awsui_icon-wrapper_16mm3_1qp0c_279",
|
|
22
|
+
"header-content": "awsui_header-content_16mm3_1qp0c_283"
|
|
22
23
|
};
|
|
23
24
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMnD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,QAAA,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMnD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,QAAA,MAAM,cAAc,qGAsEnB,CAAC;AAGF,eAAe,cAAc,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
|
9
9
|
import InternalButtonDropdown from './internal';
|
|
10
10
|
import { hasCheckboxItems, hasDisabledReasonItems } from './utils/utils';
|
|
11
11
|
import analyticsSelectors from './analytics-metadata/styles.css.js';
|
|
12
|
-
const ButtonDropdown = React.forwardRef(({ items, variant = 'normal', loading = false, loadingText, disabled = false, disabledReason, expandableGroups = false, expandToViewport = false, ariaLabel, children, onItemClick, onItemFollow, mainAction, fullWidth, nativeMainActionAttributes, nativeTriggerAttributes, ...props }, ref) => {
|
|
12
|
+
const ButtonDropdown = React.forwardRef(({ items, variant = 'normal', loading = false, loadingText, disabled = false, disabledReason, expandableGroups = false, expandToViewport = false, ariaLabel, children, onItemClick, onItemFollow, mainAction, fullWidth, nativeMainActionAttributes, nativeTriggerAttributes, renderItem, ...props }, ref) => {
|
|
13
13
|
const baseComponentProps = useBaseComponent('ButtonDropdown', {
|
|
14
14
|
props: { expandToViewport, expandableGroups, variant },
|
|
15
15
|
metadata: {
|
|
@@ -25,7 +25,7 @@ const ButtonDropdown = React.forwardRef(({ items, variant = 'normal', loading =
|
|
|
25
25
|
label: `.${analyticsSelectors['trigger-label']}`,
|
|
26
26
|
properties: { variant, disabled: `${disabled}` },
|
|
27
27
|
};
|
|
28
|
-
return (React.createElement(InternalButtonDropdown, { ...baseProps, ...baseComponentProps, ref: ref, items: items, variant: variant, loading: loading, loadingText: loadingText, disabled: disabled, disabledReason: disabledReason, expandableGroups: expandableGroups, expandToViewport: expandToViewport, ariaLabel: ariaLabel, onItemClick: onItemClick, onItemFollow: onItemFollow, mainAction: mainAction, fullWidth: fullWidth, nativeMainActionAttributes: nativeMainActionAttributes, nativeTriggerAttributes: nativeTriggerAttributes, ...getAnalyticsMetadataAttribute({
|
|
28
|
+
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, onItemClick: onItemClick, onItemFollow: onItemFollow, mainAction: mainAction, fullWidth: fullWidth, nativeMainActionAttributes: nativeMainActionAttributes, nativeTriggerAttributes: nativeTriggerAttributes, ...getAnalyticsMetadataAttribute({
|
|
29
29
|
component: analyticsComponentMetadata,
|
|
30
30
|
}) }, children));
|
|
31
31
|
});
|
|
@@ -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,WAAW,EACX,YAAY,EACZ,UAAU,EACV,SAAS,EACT,0BAA0B,EAC1B,uBAAuB,EACvB,GAAG,KAAK,EACY,EACtB,GAAuC,EACvC,EAAE;IACF,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,gBA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iliates. 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 { 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 children,\n onItemClick,\n onItemFollow,\n mainAction,\n fullWidth,\n nativeMainActionAttributes,\n nativeTriggerAttributes,\n ...props\n }: ButtonDropdownProps,\n ref: React.Ref<ButtonDropdownProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('ButtonDropdown', {\n props: { expandToViewport, expandableGroups, variant },\n metadata: {\n mainAction: !!mainAction,\n checkboxItems: hasCheckboxItems(items),\n hasDisabledReason: Boolean(disabledReason),\n hasDisabledReasons: hasDisabledReasonItems(items),\n },\n });\n const baseProps = getBaseProps(props);\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 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 onItemClick={onItemClick}\n onItemFollow={onItemFollow}\n mainAction={mainAction}\n fullWidth={fullWidth}\n nativeMainActionAttributes={nativeMainActionAttributes}\n nativeTriggerAttributes={nativeTriggerAttributes}\n {...getAnalyticsMetadataAttribute({\n component: analyticsComponentMetadata,\n })}\n >\n {children}\n </InternalButtonDropdown>\n );\n }\n);\n\napplyDisplayName(ButtonDropdown, 'ButtonDropdown');\nexport default ButtonDropdown;\n"]}
|
|
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,WAAW,EACX,YAAY,EACZ,UAAU,EACV,SAAS,EACT,0BAA0B,EAC1B,uBAAuB,EACvB,UAAU,EACV,GAAG,KAAK,EACY,EACtB,GAAuC,EACvC,EAAE;IACF,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,gBAAgB,EAAE;QAC5D,KAAK,EAAE,EAAE,gBAAgB,EAAE,gBAA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ier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\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 children,\n onItemClick,\n onItemFollow,\n mainAction,\n fullWidth,\n nativeMainActionAttributes,\n nativeTriggerAttributes,\n renderItem,\n ...props\n }: ButtonDropdownProps,\n ref: React.Ref<ButtonDropdownProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('ButtonDropdown', {\n props: { expandToViewport, expandableGroups, variant },\n metadata: {\n mainAction: !!mainAction,\n checkboxItems: hasCheckboxItems(items),\n hasDisabledReason: Boolean(disabledReason),\n hasDisabledReasons: hasDisabledReasonItems(items),\n },\n });\n const baseProps = getBaseProps(props);\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 onItemClick={onItemClick}\n onItemFollow={onItemFollow}\n mainAction={mainAction}\n fullWidth={fullWidth}\n nativeMainActionAttributes={nativeMainActionAttributes}\n nativeTriggerAttributes={nativeTriggerAttributes}\n {...getAnalyticsMetadataAttribute({\n component: analyticsComponentMetadata,\n })}\n >\n {children}\n </InternalButtonDropdown>\n );\n }\n);\n\napplyDisplayName(ButtonDropdown, 'ButtonDropdown');\nexport default ButtonDropdown;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { GeneratedAnalyticsMetadataFragment } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
3
3
|
import { ButtonProps } from '../button/interfaces';
|
|
4
4
|
import { IconProps } from '../icon/interfaces';
|
|
@@ -57,6 +57,49 @@ export interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewpor
|
|
|
57
57
|
*
|
|
58
58
|
*/
|
|
59
59
|
items: ReadonlyArray<ButtonDropdownProps.ItemOrGroup>;
|
|
60
|
+
/**
|
|
61
|
+
* Specifies a render function to render custom options in the dropdown menu.
|
|
62
|
+
*
|
|
63
|
+
* The item inside the props has a different shape depending on its type:
|
|
64
|
+
*
|
|
65
|
+
*
|
|
66
|
+
* ### action
|
|
67
|
+
*
|
|
68
|
+
* - `type` ('action') - The item type.
|
|
69
|
+
* - `index` (number) - The item's position relative to its parent.
|
|
70
|
+
* - `option` (Item) - The original item configuration.
|
|
71
|
+
* - `highlighted` (boolean) - Whether the item is currently highlighted.
|
|
72
|
+
* - `disabled` (boolean) - Whether the item is disabled.
|
|
73
|
+
* - `parent` (GroupRenderItem | null) - The parent group item, if any.
|
|
74
|
+
*
|
|
75
|
+
* ### checkbox
|
|
76
|
+
*
|
|
77
|
+
* - `type` ('checkbox') - The item type.
|
|
78
|
+
* - `index` (number) - The item's position relative to its parent.
|
|
79
|
+
* - `option` (CheckboxItem) - The original item configuration.
|
|
80
|
+
* - `disabled` (boolean) - Whether the item is disabled.
|
|
81
|
+
* - `highlighted` (boolean) - Whether the item is currently highlighted.
|
|
82
|
+
* - `checked` (boolean) - Controls the state of the checkbox item.
|
|
83
|
+
* - `parent` (GroupRenderItem | null) - The parent group item, if any.
|
|
84
|
+
*
|
|
85
|
+
* ### group
|
|
86
|
+
*
|
|
87
|
+
* - `type` ('group') - The item type.
|
|
88
|
+
* - `index` (number) - The item's position in the list.
|
|
89
|
+
* - `option` (ItemGroup) - The original item configuration.
|
|
90
|
+
* - `disabled` (boolean) - Whether the item is disabled.
|
|
91
|
+
* - `highlighted` (boolean) - Whether the item is currently highlighted.
|
|
92
|
+
* - `expanded` (boolean) - Whether the group is expanded.
|
|
93
|
+
* - `expandDirection` ('vertical' | 'horizontal') - The direction in which the group expands.
|
|
94
|
+
*
|
|
95
|
+
* When providing a custom `renderItem` implementation, it fully replaces the default visual rendering and content for that item.
|
|
96
|
+
* The component still manages focus, keyboard interactions, and selection state, but it no longer applies its default item layout or typography.
|
|
97
|
+
*
|
|
98
|
+
* When returning `null`, the default styling will be applied.
|
|
99
|
+
*
|
|
100
|
+
* @awsuiSystem core
|
|
101
|
+
*/
|
|
102
|
+
renderItem?: ButtonDropdownProps.ItemRenderer;
|
|
60
103
|
/**
|
|
61
104
|
* Determines whether the button dropdown is disabled. Users cannot interact with the control if it's disabled.
|
|
62
105
|
*/
|
|
@@ -154,6 +197,36 @@ export interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewpor
|
|
|
154
197
|
export declare namespace ButtonDropdownProps {
|
|
155
198
|
type Variant = 'normal' | 'primary' | 'icon' | 'inline-icon';
|
|
156
199
|
type ItemType = 'action' | 'group';
|
|
200
|
+
interface ActionRenderItem {
|
|
201
|
+
type: 'action';
|
|
202
|
+
index: number;
|
|
203
|
+
option: Item;
|
|
204
|
+
highlighted: boolean;
|
|
205
|
+
disabled: boolean;
|
|
206
|
+
parent: GroupRenderItem | null;
|
|
207
|
+
}
|
|
208
|
+
interface CheckboxRenderItem {
|
|
209
|
+
type: 'checkbox';
|
|
210
|
+
index: number;
|
|
211
|
+
option: CheckboxItem;
|
|
212
|
+
disabled: boolean;
|
|
213
|
+
highlighted: boolean;
|
|
214
|
+
checked: boolean;
|
|
215
|
+
parent: GroupRenderItem | null;
|
|
216
|
+
}
|
|
217
|
+
interface GroupRenderItem {
|
|
218
|
+
type: 'group';
|
|
219
|
+
index: number;
|
|
220
|
+
option: ItemGroup;
|
|
221
|
+
disabled: boolean;
|
|
222
|
+
highlighted: boolean;
|
|
223
|
+
expanded: boolean;
|
|
224
|
+
expandDirection: 'vertical' | 'horizontal';
|
|
225
|
+
}
|
|
226
|
+
type RenderItem = ActionRenderItem | CheckboxRenderItem | GroupRenderItem;
|
|
227
|
+
type ItemRenderer = (props: {
|
|
228
|
+
item: ButtonDropdownProps.RenderItem;
|
|
229
|
+
}) => ReactNode | null;
|
|
157
230
|
interface MainAction {
|
|
158
231
|
text?: string;
|
|
159
232
|
ariaLabel?: string;
|
|
@@ -238,6 +311,7 @@ export interface HighlightProps {
|
|
|
238
311
|
export type GroupToggle = (item: ButtonDropdownProps.ItemGroup, event: React.SyntheticEvent) => void;
|
|
239
312
|
export type ItemActivate = (item: ButtonDropdownProps.Item | ButtonDropdownProps.CheckboxItem, event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
240
313
|
export interface CategoryProps extends HighlightProps {
|
|
314
|
+
index?: number;
|
|
241
315
|
item: ButtonDropdownProps.ItemGroup;
|
|
242
316
|
onGroupToggle: GroupToggle;
|
|
243
317
|
onItemActivate: ItemActivate;
|
|
@@ -246,6 +320,7 @@ export interface CategoryProps extends HighlightProps {
|
|
|
246
320
|
expandToViewport?: boolean;
|
|
247
321
|
variant?: ItemListProps['variant'];
|
|
248
322
|
position?: string;
|
|
323
|
+
renderItem?: ButtonDropdownProps.ItemRenderer;
|
|
249
324
|
}
|
|
250
325
|
export interface ItemListProps extends HighlightProps {
|
|
251
326
|
items: ButtonDropdownProps.Items;
|
|
@@ -260,11 +335,14 @@ export interface ItemListProps extends HighlightProps {
|
|
|
260
335
|
position?: string;
|
|
261
336
|
analyticsMetadataTransformer?: InternalButtonDropdownProps['analyticsMetadataTransformer'];
|
|
262
337
|
linkStyle?: boolean;
|
|
338
|
+
renderItem?: ButtonDropdownProps.ItemRenderer;
|
|
339
|
+
parentProps?: ButtonDropdownProps.GroupRenderItem;
|
|
263
340
|
}
|
|
264
341
|
export interface LinkItem extends ButtonDropdownProps.Item {
|
|
265
342
|
href: string;
|
|
266
343
|
}
|
|
267
344
|
export interface ItemProps {
|
|
345
|
+
index?: number;
|
|
268
346
|
item: ButtonDropdownProps.Item | ButtonDropdownProps.CheckboxItem | LinkItem;
|
|
269
347
|
disabled: boolean;
|
|
270
348
|
highlighted: boolean;
|
|
@@ -277,6 +355,8 @@ export interface ItemProps {
|
|
|
277
355
|
position?: string;
|
|
278
356
|
analyticsMetadataTransformer?: InternalButtonDropdownProps['analyticsMetadataTransformer'];
|
|
279
357
|
linkStyle?: boolean;
|
|
358
|
+
renderItem?: ButtonDropdownProps.ItemRenderer;
|
|
359
|
+
parentProps?: ButtonDropdownProps.GroupRenderItem;
|
|
280
360
|
}
|
|
281
361
|
export interface InternalItem extends ButtonDropdownProps.Item {
|
|
282
362
|
badge?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
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,kCAAkC,EAAE,MAAM,kEAAkE,CAAC;AAEtH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EA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OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,4BAA4B,CAAC,EAAE,CAAC,KAAK,EAAE,kCAAkC,KAAK,kCAAkC,CAAC;IAEjH;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;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 from 'react';\n\nimport { GeneratedAnalyticsMetadataFragment } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { BaseNavigationDetail, CancelableEventHandler } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-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 *\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 * 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 * 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 * 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\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 }\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 CategoryProps extends HighlightProps {\n item: ButtonDropdownProps.ItemGroup;\n onGroupToggle: GroupToggle;\n onItemActivate: ItemActivate;\n disabled: boolean;\n lastInDropdown: boolean;\n expandToViewport?: boolean;\n variant?: ItemListProps['variant'];\n position?: string;\n}\n\nexport interface ItemListProps extends HighlightProps {\n items: ButtonDropdownProps.Items;\n onGroupToggle: GroupToggle;\n onItemActivate: ItemActivate;\n categoryDisabled?: boolean;\n hasExpandableGroups?: boolean;\n hasCategoryHeader?: boolean;\n lastInDropdown: boolean;\n expandToViewport?: boolean;\n variant?: InternalButtonDropdownProps['variant'];\n position?: string;\n analyticsMetadataTransformer?: InternalButtonDropdownProps['analyticsMetadataTransformer'];\n linkStyle?: boolean;\n}\n\nexport interface LinkItem extends ButtonDropdownProps.Item {\n href: string;\n}\n\nexport interface ItemProps {\n item: ButtonDropdownProps.Item | ButtonDropdownProps.CheckboxItem | LinkItem;\n disabled: boolean;\n highlighted: boolean;\n onItemActivate: ItemActivate;\n highlightItem: (item: ButtonDropdownProps.ItemOrGroup) => void;\n showDivider: boolean;\n hasCategoryHeader: boolean;\n isKeyboardHighlighted?: boolean;\n variant?: ItemListProps['variant'];\n position?: string;\n analyticsMetadataTransformer?: InternalButtonDropdownProps['analyticsMetadataTransformer'];\n linkStyle?: boolean;\n}\n\nexport interface InternalItem extends ButtonDropdownProps.Item {\n badge?: boolean;\n /**\n * Used in breadcrumb-group: indicates that this breadcrumb item is the current page\n */\n isCurrentBreadcrumb?: boolean;\n}\n\nexport interface InternalCheckboxItem extends ButtonDropdownProps.CheckboxItem {\n badge?: boolean;\n}\n\ninterface InternalItemGroup extends Omit<ButtonDropdownProps.ItemGroup, 'items'> {\n items: InternalItems;\n}\n\ntype InternalItems = ReadonlyArray<InternalItemOrGroup>;\n\nexport type InternalItemOrGroup = InternalItem | InternalCheckboxItem | InternalItemGroup;\n\nexport interface InternalButtonDropdownProps\n extends Omit<ButtonDropdownProps, 'variant' | 'items'>,\n InternalBaseComponentProps {\n customTriggerBuilder?: (props: CustomTriggerProps) => React.ReactNode;\n variant?: ButtonDropdownProps['variant'] | 'navigation';\n items: ReadonlyArray<InternalItemOrGroup>;\n\n /**\n * Optional text that is displayed as the title at the top of the dropdown.\n */\n title?: string;\n\n /**\n * Optional text that is displayed underneath the title at the top of the dropdown.\n */\n description?: string;\n\n /**\n * Only show main action button as a regular, non-split button.\n * That is needed so that button dropdown test utils wrapper can still be used.\n */\n showMainActionOnly?: boolean;\n\n /**\n * Determines that the dropdown should preferably be aligned to the center of the trigger\n * instead of dropping left or right.\n */\n preferCenter?: boolean;\n\n /**\n * Determines whether simple items should be displayed with the link styles.\n * Used in Breadcrumb group component for collapsed breadcrumbs\n */\n linkStyle?: boolean;\n\n /**\n * Determines whether the dropdown should take up the full available width.\n * Used in Breadcrumb group component for collapsed breadcrumbs\n */\n fullWidth?: boolean;\n\n analyticsMetadataTransformer?: (input: GeneratedAnalyticsMetadataFragment) => GeneratedAnalyticsMetadataFragment;\n\n /**\n * Position of the button dropdown inside a list of elements, for example a button group\n */\n position?: 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 { GeneratedAnalyticsMetadataFragment } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { BaseNavigationDetail, CancelableEventHandler } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-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 *\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 *\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 *\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 *\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 * @awsuiSystem core\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 * 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 * 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\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 }) => 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 }\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 CategoryProps extends HighlightProps {\n index?: number;\n item: ButtonDropdownProps.ItemGroup;\n onGroupToggle: GroupToggle;\n onItemActivate: ItemActivate;\n disabled: boolean;\n lastInDropdown: boolean;\n expandToViewport?: boolean;\n variant?: ItemListProps['variant'];\n position?: string;\n renderItem?: ButtonDropdownProps.ItemRenderer;\n}\n\nexport interface ItemListProps extends HighlightProps {\n items: ButtonDropdownProps.Items;\n onGroupToggle: GroupToggle;\n onItemActivate: ItemActivate;\n categoryDisabled?: boolean;\n hasExpandableGroups?: boolean;\n hasCategoryHeader?: boolean;\n lastInDropdown: boolean;\n expandToViewport?: boolean;\n variant?: InternalButtonDropdownProps['variant'];\n position?: string;\n analyticsMetadataTransformer?: InternalButtonDropdownProps['analyticsMetadataTransformer'];\n linkStyle?: boolean;\n renderItem?: ButtonDropdownProps.ItemRenderer;\n parentProps?: ButtonDropdownProps.GroupRenderItem;\n}\n\nexport interface LinkItem extends ButtonDropdownProps.Item {\n href: string;\n}\n\nexport interface ItemProps {\n index?: number;\n item: ButtonDropdownProps.Item | ButtonDropdownProps.CheckboxItem | LinkItem;\n disabled: boolean;\n highlighted: boolean;\n onItemActivate: ItemActivate;\n highlightItem: (item: ButtonDropdownProps.ItemOrGroup) => void;\n showDivider: boolean;\n hasCategoryHeader: boolean;\n isKeyboardHighlighted?: boolean;\n variant?: ItemListProps['variant'];\n position?: string;\n analyticsMetadataTransformer?: InternalButtonDropdownProps['analyticsMetadataTransformer'];\n linkStyle?: boolean;\n renderItem?: ButtonDropdownProps.ItemRenderer;\n parentProps?: ButtonDropdownProps.GroupRenderItem;\n}\n\nexport interface InternalItem extends ButtonDropdownProps.Item {\n badge?: boolean;\n /**\n * Used in breadcrumb-group: indicates that this breadcrumb item is the current page\n */\n isCurrentBreadcrumb?: boolean;\n}\n\nexport interface InternalCheckboxItem extends ButtonDropdownProps.CheckboxItem {\n badge?: boolean;\n}\n\ninterface InternalItemGroup extends Omit<ButtonDropdownProps.ItemGroup, 'items'> {\n items: InternalItems;\n}\n\ntype InternalItems = ReadonlyArray<InternalItemOrGroup>;\n\nexport type InternalItemOrGroup = InternalItem | InternalCheckboxItem | InternalItemGroup;\n\nexport interface InternalButtonDropdownProps\n extends Omit<ButtonDropdownProps, 'variant' | 'items'>,\n InternalBaseComponentProps {\n customTriggerBuilder?: (props: CustomTriggerProps) => React.ReactNode;\n variant?: ButtonDropdownProps['variant'] | 'navigation';\n items: ReadonlyArray<InternalItemOrGroup>;\n\n /**\n * Optional text that is displayed as the title at the top of the dropdown.\n */\n title?: string;\n\n /**\n * Optional text that is displayed underneath the title at the top of the dropdown.\n */\n description?: string;\n\n /**\n * Only show main action button as a regular, non-split button.\n * That is needed so that button dropdown test utils wrapper can still be used.\n */\n showMainActionOnly?: boolean;\n\n /**\n * Determines that the dropdown should preferably be aligned to the center of the trigger\n * instead of dropping left or right.\n */\n preferCenter?: boolean;\n\n /**\n * Determines whether simple items should be displayed with the link styles.\n * Used in Breadcrumb group component for collapsed breadcrumbs\n */\n linkStyle?: boolean;\n\n /**\n * Determines whether the dropdown should take up the full available width.\n * Used in Breadcrumb group component for collapsed breadcrumbs\n */\n fullWidth?: boolean;\n\n analyticsMetadataTransformer?: (input: GeneratedAnalyticsMetadataFragment) => GeneratedAnalyticsMetadataFragment;\n\n /**\n * Position of the button dropdown inside a list of elements, for example a button group\n */\n position?: 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAsBtE,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAQhF,QAAA,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAsBtE,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAQhF,QAAA,MAAM,sBAAsB,6GAwY3B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -20,7 +20,7 @@ import { useButtonDropdown } from './utils/use-button-dropdown';
|
|
|
20
20
|
import { isLinkItem } from './utils/utils.js';
|
|
21
21
|
import analyticsSelectors from './analytics-metadata/styles.css.js';
|
|
22
22
|
import styles from './styles.css.js';
|
|
23
|
-
const InternalButtonDropdown = React.forwardRef(({ items, variant = 'normal', loading = false, loadingText, disabled = false, disabledReason, expandableGroups = false, children, onItemClick, onItemFollow, customTriggerBuilder, expandToViewport, ariaLabel, title, description, preferCenter, mainAction, showMainActionOnly, __internalRootRef, analyticsMetadataTransformer, linkStyle, fullWidth, position, nativeMainActionAttributes, nativeTriggerAttributes, ...props }, ref) => {
|
|
23
|
+
const InternalButtonDropdown = React.forwardRef(({ items, variant = 'normal', loading = false, loadingText, disabled = false, disabledReason, expandableGroups = false, children, onItemClick, onItemFollow, customTriggerBuilder, expandToViewport, ariaLabel, title, description, preferCenter, mainAction, showMainActionOnly, __internalRootRef, analyticsMetadataTransformer, linkStyle, fullWidth, position, nativeMainActionAttributes, nativeTriggerAttributes, renderItem, ...props }, ref) => {
|
|
24
24
|
var _a;
|
|
25
25
|
const isInRestrictedView = useMobile();
|
|
26
26
|
const dropdownId = useUniqueId('dropdown');
|
|
@@ -193,7 +193,7 @@ const InternalButtonDropdown = React.forwardRef(({ items, variant = 'normal', lo
|
|
|
193
193
|
description && (React.createElement(InternalBox, { fontSize: "body-s" },
|
|
194
194
|
React.createElement("span", { className: styles.description }, description))))),
|
|
195
195
|
React.createElement(OptionsList, { open: canBeOpened && isOpen, position: "static", role: "menu", tagOverride: "ul", decreaseBlockMargin: true, ariaLabel: ariaLabel, ariaLabelledby: hasHeader ? headerId : shouldLabelWithTrigger ? triggerId : undefined, statusType: "finished" },
|
|
196
|
-
React.createElement(ItemsList, { items: items, onItemActivate: onItemActivate, onGroupToggle: onGroupToggle, hasExpandableGroups: expandableGroups, targetItem: targetItem, isHighlighted: isHighlighted, isKeyboardHighlight: isKeyboardHighlight, isExpanded: isExpanded, lastInDropdown: true, highlightItem: highlightItem, expandToViewport: expandToViewport, variant: variant, analyticsMetadataTransformer: analyticsMetadataTransformer, linkStyle: linkStyle, position: position })))));
|
|
196
|
+
React.createElement(ItemsList, { items: items, onItemActivate: onItemActivate, onGroupToggle: onGroupToggle, hasExpandableGroups: expandableGroups, targetItem: targetItem, isHighlighted: isHighlighted, isKeyboardHighlight: isKeyboardHighlight, isExpanded: isExpanded, lastInDropdown: true, highlightItem: highlightItem, expandToViewport: expandToViewport, variant: variant, analyticsMetadataTransformer: analyticsMetadataTransformer, linkStyle: linkStyle, position: position, renderItem: renderItem })))));
|
|
197
197
|
});
|
|
198
198
|
export default InternalButtonDropdown;
|
|
199
199
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/button-dropdown/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAuB,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAMhE,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,iB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AQ,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EACrF,UAAU,EAAC,UAAU;gBAErB,oBAAC,SAAS,IACR,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,mBAAmB,EAAE,gBAAgB,EACrC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAC5B,mBAAmB,EAAE,mBAAmB,EACxC,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,IAAI,EACpB,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,OAAO,EAChB,4BAA4B,EAAE,4BAA4B,EAC1D,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,GAClB,CACU,CACL,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton, InternalButtonProps } from '../button/internal';\nimport { useFunnel } from '../internal/analytics/hooks/use-funnel.js';\nimport { getBaseProps } from '../internal/base-component';\nimport Dropdown from '../internal/components/dropdown';\nimport OptionsList from '../internal/components/options-list';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode/index.js';\nimport { isDevelopment } from '../internal/is-development';\nimport { spinWhenOpen } from '../internal/styles/motion/utils';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport {\n GeneratedAnalyticsMetadataButtonDropdownCollapse,\n GeneratedAnalyticsMetadataButtonDropdownExpand,\n} from './analytics-metadata/interfaces.js';\nimport { ButtonDropdownProps, InternalButtonDropdownProps } from './interfaces';\nimport ItemsList from './items-list';\nimport { useButtonDropdown } from './utils/use-button-dropdown';\nimport { isLinkItem } from './utils/utils.js';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst InternalButtonDropdown = React.forwardRef(\n (\n {\n items,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n disabledReason,\n expandableGroups = false,\n children,\n onItemClick,\n onItemFollow,\n customTriggerBuilder,\n expandToViewport,\n ariaLabel,\n title,\n description,\n preferCenter,\n mainAction,\n showMainActionOnly,\n __internalRootRef,\n analyticsMetadataTransformer,\n linkStyle,\n fullWidth,\n position,\n nativeMainActionAttributes,\n nativeTriggerAttributes,\n ...props\n }: InternalButtonDropdownProps,\n ref: React.Ref<ButtonDropdownProps.Ref>\n ) => {\n const isInRestrictedView = useMobile();\n const dropdownId = useUniqueId('dropdown');\n for (const item of items) {\n if (isLinkItem(item)) {\n checkSafeUrl('ButtonDropdown', item.href);\n }\n }\n if (mainAction) {\n checkSafeUrl('ButtonDropdown', mainAction.href);\n }\n\n if (isDevelopment) {\n if (mainAction && variant !== 'primary' && variant !== 'normal') {\n warnOnce('ButtonDropdown', 'Main action is only supported for \"primary\" and \"normal\" component variant.');\n }\n }\n const hasMainAction = mainAction && (variant === 'primary' || variant === 'normal');\n const isVisualRefresh = useVisualRefresh();\n\n const {\n isOpen,\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n highlightItem,\n onKeyDown,\n onKeyUp,\n onItemActivate,\n onGroupToggle,\n toggleDropdown,\n closeDropdown,\n setIsUsingMouse,\n } = useButtonDropdown({\n items,\n onItemClick,\n onItemFollow,\n // Scroll is unnecessary when moving focus back to the dropdown trigger.\n onReturnFocus: () => triggerRef.current?.focus({ preventScroll: true }),\n expandToViewport,\n hasExpandableGroups: expandableGroups,\n isInRestrictedView,\n });\n\n const handleMouseEvent = () => {\n setIsUsingMouse(true);\n };\n\n const baseProps = getBaseProps(props);\n\n const mainActionRef = useRef<HTMLElement>(null);\n const triggerRef = useRef<HTMLElement>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args) {\n (hasMainAction ? mainActionRef : triggerRef).current?.focus(...args);\n },\n focusDropdownTrigger(...args) {\n triggerRef.current?.focus(...args);\n },\n }),\n [mainActionRef, triggerRef, hasMainAction]\n );\n\n const clickHandler = () => {\n if (!loading && !disabled) {\n // Prevent moving highlight on mobiles to avoid disabled state reason popup if defined.\n toggleDropdown({ moveHighlightOnOpen: !isInRestrictedView });\n }\n };\n\n const canBeOpened = !loading && !disabled;\n\n const canBeFullWidth = !!fullWidth && (variant === 'primary' || variant === 'normal');\n\n const triggerVariant = variant === 'navigation' ? undefined : variant === 'inline-icon' ? 'inline-icon' : variant;\n const iconProps: Partial<ButtonProps & { __iconClass?: string }> =\n variant === 'icon' || variant === 'inline-icon'\n ? {\n iconName: 'ellipsis',\n }\n : {\n iconName: 'caret-down-filled',\n iconAlign: 'right',\n __iconClass: spinWhenOpen(styles, 'rotate', canBeOpened && isOpen),\n };\n\n const baseTriggerProps: InternalButtonProps = {\n className: clsx(\n styles['trigger-button'],\n styles['test-utils-button-trigger'],\n analyticsSelectors['trigger-label']\n ),\n ...iconProps,\n variant: triggerVariant,\n loading,\n loadingText,\n disabled,\n disabledReason,\n onClick: (event: Event) => {\n event.preventDefault();\n clickHandler();\n },\n ariaLabel,\n ariaExpanded: canBeOpened && isOpen,\n formAction: 'none',\n nativeButtonAttributes: {\n 'aria-haspopup': true,\n ...nativeTriggerAttributes,\n },\n };\n\n const triggerId = useUniqueId('awsui-button-dropdown__trigger');\n\n const triggerHasBadge = () => {\n const flatItems = items.flatMap(item => {\n if ('items' in item) {\n return item.items;\n }\n return item;\n });\n\n return (\n variant === 'icon' &&\n !!flatItems?.find(item => {\n if ('badge' in item) {\n return item.badge;\n }\n })\n );\n };\n\n let trigger: React.ReactNode = null;\n\n const analyticsMetadata:\n | GeneratedAnalyticsMetadataButtonDropdownExpand\n | GeneratedAnalyticsMetadataButtonDropdownCollapse\n | Record<string, never> = disabled\n ? {}\n : {\n action: !isOpen ? 'expand' : 'collapse',\n detail: {\n label: `.${analyticsSelectors['trigger-label']}`,\n },\n };\n\n if (customTriggerBuilder) {\n trigger = (\n <div className={styles['dropdown-trigger']} {...getAnalyticsMetadataAttribute(analyticsMetadata)}>\n {customTriggerBuilder({\n testUtilsClass: styles['test-utils-button-trigger'],\n ariaExpanded: canBeOpened && isOpen,\n onClick: clickHandler,\n triggerRef,\n ariaLabel,\n disabled,\n disabledReason,\n isOpen,\n })}\n </div>\n );\n } else if (hasMainAction) {\n const { text, iconName, iconAlt, iconSvg, iconUrl, external, externalIconAriaLabel, ...mainActionProps } =\n mainAction;\n const mainActionIconProps = external\n ? ({ iconName: 'external', iconAlign: 'right', target: '_blank', rel: 'noopener noreferrer' } as const)\n : ({ iconName, iconAlt, iconSvg, iconUrl } as const);\n const mainActionAriaLabel = externalIconAriaLabel\n ? `${mainAction.ariaLabel ?? mainAction.text} ${mainAction.externalIconAriaLabel}`\n : mainAction.ariaLabel;\n const hasNoText = !text;\n const mainActionButton = (\n <InternalButton\n ref={mainActionRef}\n {...mainActionProps}\n {...mainActionIconProps}\n fullWidth={canBeFullWidth}\n className={clsx(\n styles['trigger-button'],\n hasNoText && styles['has-no-text'],\n isVisualRefresh && styles['visual-refresh'],\n canBeFullWidth && styles['main-action-full-width']\n )}\n variant={variant}\n ariaLabel={mainActionAriaLabel}\n formAction=\"none\"\n nativeAnchorAttributes={nativeMainActionAttributes?.anchor}\n nativeButtonAttributes={nativeMainActionAttributes?.button}\n >\n {text}\n </InternalButton>\n );\n trigger = (\n <div role=\"group\" aria-label={ariaLabel} className={styles['split-trigger-wrapper']}>\n <div\n className={clsx(\n styles['trigger-item'],\n styles['split-trigger'],\n styles[`variant-${variant}`],\n mainActionProps.loading && styles.loading\n )}\n // Close dropdown upon main action click unless event is cancelled.\n onClick={closeDropdown}\n // Prevent keyboard events from propagation to the button dropdown handler.\n onKeyDown={e => e.stopPropagation()}\n onKeyUp={e => e.stopPropagation()}\n {...getAnalyticsMetadataAttribute({\n action: 'click',\n detail: {\n label: `.${analyticsSelectors['main-action-label']}`,\n },\n })}\n >\n {mainActionButton}\n </div>\n {!showMainActionOnly && (\n <div\n className={clsx(\n styles['trigger-item'],\n styles['dropdown-trigger'],\n isVisualRefresh && styles['visual-refresh'],\n styles[`variant-${variant}`],\n baseTriggerProps.loading && styles.loading\n )}\n {...getAnalyticsMetadataAttribute(analyticsMetadata)}\n >\n <InternalButton\n ref={triggerRef}\n {...baseTriggerProps}\n className={clsx(baseTriggerProps.className, {\n [styles['main-action-trigger-full-width']]: canBeFullWidth,\n })}\n __emitPerformanceMarks={false}\n >\n {children}\n </InternalButton>\n </div>\n )}\n </div>\n );\n } else {\n trigger = (\n <div className={styles['dropdown-trigger']} {...getAnalyticsMetadataAttribute(analyticsMetadata)}>\n <InternalButton\n ref={triggerRef}\n id={triggerId}\n {...baseTriggerProps}\n className={clsx(baseTriggerProps.className, {\n [styles['full-width']]: canBeFullWidth,\n [styles.loading]: canBeFullWidth && !!loading,\n })}\n badge={triggerHasBadge()}\n fullWidth={fullWidth}\n >\n {children}\n </InternalButton>\n </div>\n );\n }\n\n const hasHeader = title || description;\n const headerId = useUniqueId('awsui-button-dropdown__header');\n\n const shouldLabelWithTrigger = !ariaLabel && !mainAction && variant !== 'icon' && variant !== 'inline-icon';\n\n const { loadingButtonCount } = useFunnel();\n useEffect(() => {\n if (loading) {\n loadingButtonCount.current++;\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n loadingButtonCount.current--;\n };\n }\n }, [loading, loadingButtonCount]);\n\n return (\n <div\n {...baseProps}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n onMouseDown={handleMouseEvent}\n onMouseMove={handleMouseEvent}\n className={clsx(\n styles['button-dropdown'],\n styles[`variant-${variant}`],\n canBeFullWidth && styles['full-width'],\n baseProps.className\n )}\n aria-owns={expandToViewport && isOpen ? dropdownId : undefined}\n ref={__internalRootRef}\n >\n <Dropdown\n open={canBeOpened && isOpen}\n stretchWidth={false}\n stretchTriggerHeight={variant === 'navigation'}\n expandToViewport={expandToViewport}\n preferCenter={preferCenter}\n onDropdownClose={() => toggleDropdown()}\n trigger={trigger}\n dropdownId={dropdownId}\n >\n {hasHeader && (\n <div className={styles.header} id={headerId}>\n {title && (\n <div className={styles.title}>\n <InternalBox\n fontSize=\"heading-s\"\n fontWeight=\"bold\"\n color=\"inherit\"\n tagOverride=\"h2\"\n margin={{ vertical: 'n', horizontal: 'n' }}\n >\n {title}\n </InternalBox>\n </div>\n )}\n {description && (\n <InternalBox fontSize=\"body-s\">\n <span className={styles.description}>{description}</span>\n </InternalBox>\n )}\n </div>\n )}\n <OptionsList\n open={canBeOpened && isOpen}\n position=\"static\"\n role=\"menu\"\n tagOverride=\"ul\"\n decreaseBlockMargin={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={hasHeader ? headerId : shouldLabelWithTrigger ? triggerId : undefined}\n statusType=\"finished\"\n >\n <ItemsList\n items={items}\n onItemActivate={onItemActivate}\n onGroupToggle={onGroupToggle}\n hasExpandableGroups={expandableGroups}\n targetItem={targetItem}\n isHighlighted={isHighlighted}\n isKeyboardHighlight={isKeyboardHighlight}\n isExpanded={isExpanded}\n lastInDropdown={true}\n highlightItem={highlightItem}\n expandToViewport={expandToViewport}\n variant={variant}\n analyticsMetadataTransformer={analyticsMetadataTransformer}\n linkStyle={linkStyle}\n position={position}\n />\n </OptionsList>\n </Dropdown>\n </div>\n );\n }\n);\n\nexport default InternalButtonDropdown;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/button-dropdown/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE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AAO,EAAE,OAAO,EAChB,4BAA4B,EAAE,4BAA4B,EAC1D,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,GACtB,CACU,CACL,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton, InternalButtonProps } from '../button/internal';\nimport { useFunnel } from '../internal/analytics/hooks/use-funnel.js';\nimport { getBaseProps } from '../internal/base-component';\nimport Dropdown from '../internal/components/dropdown';\nimport OptionsList from '../internal/components/options-list';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode/index.js';\nimport { isDevelopment } from '../internal/is-development';\nimport { spinWhenOpen } from '../internal/styles/motion/utils';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport {\n GeneratedAnalyticsMetadataButtonDropdownCollapse,\n GeneratedAnalyticsMetadataButtonDropdownExpand,\n} from './analytics-metadata/interfaces.js';\nimport { ButtonDropdownProps, InternalButtonDropdownProps } from './interfaces';\nimport ItemsList from './items-list';\nimport { useButtonDropdown } from './utils/use-button-dropdown';\nimport { isLinkItem } from './utils/utils.js';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst InternalButtonDropdown = React.forwardRef(\n (\n {\n items,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n disabledReason,\n expandableGroups = false,\n children,\n onItemClick,\n onItemFollow,\n customTriggerBuilder,\n expandToViewport,\n ariaLabel,\n title,\n description,\n preferCenter,\n mainAction,\n showMainActionOnly,\n __internalRootRef,\n analyticsMetadataTransformer,\n linkStyle,\n fullWidth,\n position,\n nativeMainActionAttributes,\n nativeTriggerAttributes,\n renderItem,\n ...props\n }: InternalButtonDropdownProps,\n ref: React.Ref<ButtonDropdownProps.Ref>\n ) => {\n const isInRestrictedView = useMobile();\n const dropdownId = useUniqueId('dropdown');\n for (const item of items) {\n if (isLinkItem(item)) {\n checkSafeUrl('ButtonDropdown', item.href);\n }\n }\n if (mainAction) {\n checkSafeUrl('ButtonDropdown', mainAction.href);\n }\n\n if (isDevelopment) {\n if (mainAction && variant !== 'primary' && variant !== 'normal') {\n warnOnce('ButtonDropdown', 'Main action is only supported for \"primary\" and \"normal\" component variant.');\n }\n }\n const hasMainAction = mainAction && (variant === 'primary' || variant === 'normal');\n const isVisualRefresh = useVisualRefresh();\n\n const {\n isOpen,\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n highlightItem,\n onKeyDown,\n onKeyUp,\n onItemActivate,\n onGroupToggle,\n toggleDropdown,\n closeDropdown,\n setIsUsingMouse,\n } = useButtonDropdown({\n items,\n onItemClick,\n onItemFollow,\n // Scroll is unnecessary when moving focus back to the dropdown trigger.\n onReturnFocus: () => triggerRef.current?.focus({ preventScroll: true }),\n expandToViewport,\n hasExpandableGroups: expandableGroups,\n isInRestrictedView,\n });\n\n const handleMouseEvent = () => {\n setIsUsingMouse(true);\n };\n\n const baseProps = getBaseProps(props);\n\n const mainActionRef = useRef<HTMLElement>(null);\n const triggerRef = useRef<HTMLElement>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args) {\n (hasMainAction ? mainActionRef : triggerRef).current?.focus(...args);\n },\n focusDropdownTrigger(...args) {\n triggerRef.current?.focus(...args);\n },\n }),\n [mainActionRef, triggerRef, hasMainAction]\n );\n\n const clickHandler = () => {\n if (!loading && !disabled) {\n // Prevent moving highlight on mobiles to avoid disabled state reason popup if defined.\n toggleDropdown({ moveHighlightOnOpen: !isInRestrictedView });\n }\n };\n\n const canBeOpened = !loading && !disabled;\n\n const canBeFullWidth = !!fullWidth && (variant === 'primary' || variant === 'normal');\n\n const triggerVariant = variant === 'navigation' ? undefined : variant === 'inline-icon' ? 'inline-icon' : variant;\n const iconProps: Partial<ButtonProps & { __iconClass?: string }> =\n variant === 'icon' || variant === 'inline-icon'\n ? {\n iconName: 'ellipsis',\n }\n : {\n iconName: 'caret-down-filled',\n iconAlign: 'right',\n __iconClass: spinWhenOpen(styles, 'rotate', canBeOpened && isOpen),\n };\n\n const baseTriggerProps: InternalButtonProps = {\n className: clsx(\n styles['trigger-button'],\n styles['test-utils-button-trigger'],\n analyticsSelectors['trigger-label']\n ),\n ...iconProps,\n variant: triggerVariant,\n loading,\n loadingText,\n disabled,\n disabledReason,\n onClick: (event: Event) => {\n event.preventDefault();\n clickHandler();\n },\n ariaLabel,\n ariaExpanded: canBeOpened && isOpen,\n formAction: 'none',\n nativeButtonAttributes: {\n 'aria-haspopup': true,\n ...nativeTriggerAttributes,\n },\n };\n\n const triggerId = useUniqueId('awsui-button-dropdown__trigger');\n\n const triggerHasBadge = () => {\n const flatItems = items.flatMap(item => {\n if ('items' in item) {\n return item.items;\n }\n return item;\n });\n\n return (\n variant === 'icon' &&\n !!flatItems?.find(item => {\n if ('badge' in item) {\n return item.badge;\n }\n })\n );\n };\n\n let trigger: React.ReactNode = null;\n\n const analyticsMetadata:\n | GeneratedAnalyticsMetadataButtonDropdownExpand\n | GeneratedAnalyticsMetadataButtonDropdownCollapse\n | Record<string, never> = disabled\n ? {}\n : {\n action: !isOpen ? 'expand' : 'collapse',\n detail: {\n label: `.${analyticsSelectors['trigger-label']}`,\n },\n };\n\n if (customTriggerBuilder) {\n trigger = (\n <div className={styles['dropdown-trigger']} {...getAnalyticsMetadataAttribute(analyticsMetadata)}>\n {customTriggerBuilder({\n testUtilsClass: styles['test-utils-button-trigger'],\n ariaExpanded: canBeOpened && isOpen,\n onClick: clickHandler,\n triggerRef,\n ariaLabel,\n disabled,\n disabledReason,\n isOpen,\n })}\n </div>\n );\n } else if (hasMainAction) {\n const { text, iconName, iconAlt, iconSvg, iconUrl, external, externalIconAriaLabel, ...mainActionProps } =\n mainAction;\n const mainActionIconProps = external\n ? ({ iconName: 'external', iconAlign: 'right', target: '_blank', rel: 'noopener noreferrer' } as const)\n : ({ iconName, iconAlt, iconSvg, iconUrl } as const);\n const mainActionAriaLabel = externalIconAriaLabel\n ? `${mainAction.ariaLabel ?? mainAction.text} ${mainAction.externalIconAriaLabel}`\n : mainAction.ariaLabel;\n const hasNoText = !text;\n const mainActionButton = (\n <InternalButton\n ref={mainActionRef}\n {...mainActionProps}\n {...mainActionIconProps}\n fullWidth={canBeFullWidth}\n className={clsx(\n styles['trigger-button'],\n hasNoText && styles['has-no-text'],\n isVisualRefresh && styles['visual-refresh'],\n canBeFullWidth && styles['main-action-full-width']\n )}\n variant={variant}\n ariaLabel={mainActionAriaLabel}\n formAction=\"none\"\n nativeAnchorAttributes={nativeMainActionAttributes?.anchor}\n nativeButtonAttributes={nativeMainActionAttributes?.button}\n >\n {text}\n </InternalButton>\n );\n trigger = (\n <div role=\"group\" aria-label={ariaLabel} className={styles['split-trigger-wrapper']}>\n <div\n className={clsx(\n styles['trigger-item'],\n styles['split-trigger'],\n styles[`variant-${variant}`],\n mainActionProps.loading && styles.loading\n )}\n // Close dropdown upon main action click unless event is cancelled.\n onClick={closeDropdown}\n // Prevent keyboard events from propagation to the button dropdown handler.\n onKeyDown={e => e.stopPropagation()}\n onKeyUp={e => e.stopPropagation()}\n {...getAnalyticsMetadataAttribute({\n action: 'click',\n detail: {\n label: `.${analyticsSelectors['main-action-label']}`,\n },\n })}\n >\n {mainActionButton}\n </div>\n {!showMainActionOnly && (\n <div\n className={clsx(\n styles['trigger-item'],\n styles['dropdown-trigger'],\n isVisualRefresh && styles['visual-refresh'],\n styles[`variant-${variant}`],\n baseTriggerProps.loading && styles.loading\n )}\n {...getAnalyticsMetadataAttribute(analyticsMetadata)}\n >\n <InternalButton\n ref={triggerRef}\n {...baseTriggerProps}\n className={clsx(baseTriggerProps.className, {\n [styles['main-action-trigger-full-width']]: canBeFullWidth,\n })}\n __emitPerformanceMarks={false}\n >\n {children}\n </InternalButton>\n </div>\n )}\n </div>\n );\n } else {\n trigger = (\n <div className={styles['dropdown-trigger']} {...getAnalyticsMetadataAttribute(analyticsMetadata)}>\n <InternalButton\n ref={triggerRef}\n id={triggerId}\n {...baseTriggerProps}\n className={clsx(baseTriggerProps.className, {\n [styles['full-width']]: canBeFullWidth,\n [styles.loading]: canBeFullWidth && !!loading,\n })}\n badge={triggerHasBadge()}\n fullWidth={fullWidth}\n >\n {children}\n </InternalButton>\n </div>\n );\n }\n\n const hasHeader = title || description;\n const headerId = useUniqueId('awsui-button-dropdown__header');\n\n const shouldLabelWithTrigger = !ariaLabel && !mainAction && variant !== 'icon' && variant !== 'inline-icon';\n\n const { loadingButtonCount } = useFunnel();\n useEffect(() => {\n if (loading) {\n loadingButtonCount.current++;\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n loadingButtonCount.current--;\n };\n }\n }, [loading, loadingButtonCount]);\n\n return (\n <div\n {...baseProps}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n onMouseDown={handleMouseEvent}\n onMouseMove={handleMouseEvent}\n className={clsx(\n styles['button-dropdown'],\n styles[`variant-${variant}`],\n canBeFullWidth && styles['full-width'],\n baseProps.className\n )}\n aria-owns={expandToViewport && isOpen ? dropdownId : undefined}\n ref={__internalRootRef}\n >\n <Dropdown\n open={canBeOpened && isOpen}\n stretchWidth={false}\n stretchTriggerHeight={variant === 'navigation'}\n expandToViewport={expandToViewport}\n preferCenter={preferCenter}\n onDropdownClose={() => toggleDropdown()}\n trigger={trigger}\n dropdownId={dropdownId}\n >\n {hasHeader && (\n <div className={styles.header} id={headerId}>\n {title && (\n <div className={styles.title}>\n <InternalBox\n fontSize=\"heading-s\"\n fontWeight=\"bold\"\n color=\"inherit\"\n tagOverride=\"h2\"\n margin={{ vertical: 'n', horizontal: 'n' }}\n >\n {title}\n </InternalBox>\n </div>\n )}\n {description && (\n <InternalBox fontSize=\"body-s\">\n <span className={styles.description}>{description}</span>\n </InternalBox>\n )}\n </div>\n )}\n <OptionsList\n open={canBeOpened && isOpen}\n position=\"static\"\n role=\"menu\"\n tagOverride=\"ul\"\n decreaseBlockMargin={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={hasHeader ? headerId : shouldLabelWithTrigger ? triggerId : undefined}\n statusType=\"finished\"\n >\n <ItemsList\n items={items}\n onItemActivate={onItemActivate}\n onGroupToggle={onGroupToggle}\n hasExpandableGroups={expandableGroups}\n targetItem={targetItem}\n isHighlighted={isHighlighted}\n isKeyboardHighlight={isKeyboardHighlight}\n isExpanded={isExpanded}\n lastInDropdown={true}\n highlightItem={highlightItem}\n expandToViewport={expandToViewport}\n variant={variant}\n analyticsMetadataTransformer={analyticsMetadataTransformer}\n linkStyle={linkStyle}\n position={position}\n renderItem={renderItem}\n />\n </OptionsList>\n </Dropdown>\n </div>\n );\n }\n);\n\nexport default InternalButtonDropdown;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ItemProps } from '../interfaces';
|
|
2
|
-
declare const ItemElement: ({ position, item, disabled, onItemActivate, highlighted, highlightItem, showDivider, hasCategoryHeader, isKeyboardHighlighted, analyticsMetadataTransformer, variant, linkStyle, }: ItemProps) => JSX.Element;
|
|
2
|
+
declare const ItemElement: ({ position, index, item, disabled, onItemActivate, highlighted, highlightItem, showDivider, hasCategoryHeader, isKeyboardHighlighted, analyticsMetadataTransformer, variant, linkStyle, renderItem, parentProps, }: ItemProps) => JSX.Element;
|
|
3
3
|
export default ItemElement;
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/button-dropdown/item-element/index.tsx"],"names":[],"mappings":"AAeA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/button-dropdown/item-element/index.tsx"],"names":[],"mappings":"AAeA,OAAO,EAA2D,SAAS,EAAY,MAAM,eAAe,CAAC;AAS7G,QAAA,MAAM,WAAW,GAAI,oNAgBlB,SAAS,gBA+DX,CAAC;AAoLF,eAAe,WAAW,CAAC"}
|
|
@@ -13,7 +13,7 @@ import { isCheckboxItem, isLinkItem } from '../utils/utils';
|
|
|
13
13
|
import { getItemTarget } from '../utils/utils';
|
|
14
14
|
import analyticsLabels from '../analytics-metadata/styles.css.js';
|
|
15
15
|
import styles from './styles.css.js';
|
|
16
|
-
const ItemElement = ({ position = '1', item, disabled, onItemActivate, highlighted, highlightItem, showDivider, hasCategoryHeader, isKeyboardHighlighted = false, analyticsMetadataTransformer = (metadata) => metadata, variant = 'normal', linkStyle, }) => {
|
|
16
|
+
const ItemElement = ({ position = '1', index, item, disabled, onItemActivate, highlighted, highlightItem, showDivider, hasCategoryHeader, isKeyboardHighlighted = false, analyticsMetadataTransformer = (metadata) => metadata, variant = 'normal', linkStyle, renderItem, parentProps, }) => {
|
|
17
17
|
const isLink = isLinkItem(item);
|
|
18
18
|
const isCheckbox = isCheckboxItem(item);
|
|
19
19
|
const onClick = (event) => {
|
|
@@ -50,9 +50,10 @@ const ItemElement = ({ position = '1', item, disabled, onItemActivate, highlight
|
|
|
50
50
|
href: item.href || '',
|
|
51
51
|
},
|
|
52
52
|
})) },
|
|
53
|
-
React.createElement(MenuItem, { item: item, disabled: disabled, highlighted: highlighted, linkStyle: linkStyle })));
|
|
53
|
+
React.createElement(MenuItem, { index: index, item: item, disabled: disabled, highlighted: highlighted, linkStyle: linkStyle, renderItem: renderItem, parentProps: parentProps })));
|
|
54
54
|
};
|
|
55
|
-
function MenuItem({ item, disabled, highlighted, linkStyle }) {
|
|
55
|
+
function MenuItem({ index, item, disabled, highlighted, linkStyle, renderItem, parentProps }) {
|
|
56
|
+
var _a;
|
|
56
57
|
const menuItemRef = useRef(null);
|
|
57
58
|
const isCheckbox = isCheckboxItem(item);
|
|
58
59
|
const isCurrentBreadcrumb = !isCheckbox && item.isCurrentBreadcrumb;
|
|
@@ -61,11 +62,38 @@ function MenuItem({ item, disabled, highlighted, linkStyle }) {
|
|
|
61
62
|
menuItemRef.current.focus();
|
|
62
63
|
}
|
|
63
64
|
}, [highlighted]);
|
|
65
|
+
let itemProps;
|
|
66
|
+
if (isCheckbox) {
|
|
67
|
+
itemProps = {
|
|
68
|
+
item: {
|
|
69
|
+
index: index !== null && index !== void 0 ? index : 0,
|
|
70
|
+
type: 'checkbox',
|
|
71
|
+
option: item,
|
|
72
|
+
disabled: disabled,
|
|
73
|
+
highlighted: highlighted,
|
|
74
|
+
checked: item.checked,
|
|
75
|
+
parent: parentProps !== null && parentProps !== void 0 ? parentProps : null,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
itemProps = {
|
|
81
|
+
item: {
|
|
82
|
+
index: index !== null && index !== void 0 ? index : 0,
|
|
83
|
+
type: 'action',
|
|
84
|
+
option: item,
|
|
85
|
+
disabled: disabled,
|
|
86
|
+
highlighted: highlighted,
|
|
87
|
+
parent: parentProps !== null && parentProps !== void 0 ? parentProps : null,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const renderResult = (_a = renderItem === null || renderItem === void 0 ? void 0 : renderItem(itemProps)) !== null && _a !== void 0 ? _a : null;
|
|
64
92
|
const isDisabledWithReason = disabled && item.disabledReason;
|
|
65
93
|
const { targetProps, descriptionEl } = useHiddenDescription(item.disabledReason);
|
|
66
94
|
const menuItemProps = {
|
|
67
95
|
'aria-label': item.ariaLabel,
|
|
68
|
-
className: clsx(styles['menu-item'], analyticsLabels['menu-item'], linkStyle && styles['link-style'], linkStyle && highlighted && styles['link-style-highlighted'], isCurrentBreadcrumb && styles['current-breadcrumb']),
|
|
96
|
+
className: clsx(styles['menu-item'], !!renderResult && styles['no-content-styling'], analyticsLabels['menu-item'], linkStyle && styles['link-style'], linkStyle && highlighted && styles['link-style-highlighted'], isCurrentBreadcrumb && styles['current-breadcrumb']),
|
|
69
97
|
'aria-current': isCurrentBreadcrumb,
|
|
70
98
|
lang: item.lang,
|
|
71
99
|
ref: menuItemRef,
|
|
@@ -76,9 +104,7 @@ function MenuItem({ item, disabled, highlighted, linkStyle }) {
|
|
|
76
104
|
...(isCheckbox ? getMenuItemCheckboxProps({ disabled, checked: item.checked }) : getMenuItemProps({ disabled })),
|
|
77
105
|
...(isDisabledWithReason ? targetProps : {}),
|
|
78
106
|
};
|
|
79
|
-
const menuItem = isLinkItem(item) ? (React.createElement("a", { ...menuItemProps, href: !disabled ? item.href : undefined, download: !disabled && item.download ? item.download : undefined, target: getItemTarget(item), rel: item.external ? 'noopener noreferrer' : undefined },
|
|
80
|
-
React.createElement(MenuItemContent, { item: item, disabled: disabled, highlighted: highlighted }))) : (React.createElement("span", { ...menuItemProps },
|
|
81
|
-
React.createElement(MenuItemContent, { item: item, disabled: disabled, highlighted: highlighted })));
|
|
107
|
+
const menuItem = isLinkItem(item) ? (React.createElement("a", { ...menuItemProps, href: !disabled ? item.href : undefined, download: !disabled && item.download ? item.download : undefined, target: getItemTarget(item), rel: item.external ? 'noopener noreferrer' : undefined }, renderResult ? renderResult : React.createElement(MenuItemContent, { item: item, disabled: disabled, highlighted: highlighted }))) : (React.createElement("span", { ...menuItemProps }, renderResult ? renderResult : React.createElement(MenuItemContent, { item: item, disabled: disabled, highlighted: highlighted })));
|
|
82
108
|
const { position } = useDropdownContext();
|
|
83
109
|
const tooltipPosition = position === 'bottom-left' || position === 'top-left' ? 'left' : 'right';
|
|
84
110
|
return isDisabledWithReason ? (React.createElement(Tooltip, { content: item.disabledReason, position: tooltipPosition, className: styles['item-tooltip-wrapper'] },
|