@cloudscape-design/components 3.0.366 → 3.0.367
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app-layout/drawer/drawers-helpers.d.ts +7 -0
- package/app-layout/drawer/drawers-helpers.d.ts.map +1 -0
- package/app-layout/drawer/drawers-helpers.js +24 -0
- package/app-layout/drawer/drawers-helpers.js.map +1 -0
- package/app-layout/drawer/index.d.ts +1 -1
- package/app-layout/drawer/index.d.ts.map +1 -1
- package/app-layout/drawer/index.js +38 -9
- package/app-layout/drawer/index.js.map +1 -1
- package/app-layout/drawer/interfaces.d.ts +3 -2
- package/app-layout/drawer/interfaces.d.ts.map +1 -1
- package/app-layout/drawer/interfaces.js.map +1 -1
- package/app-layout/drawer/overflow-menu.d.ts +13 -0
- package/app-layout/drawer/overflow-menu.d.ts.map +1 -0
- package/app-layout/drawer/overflow-menu.js +17 -0
- package/app-layout/drawer/overflow-menu.js.map +1 -0
- package/app-layout/index.js +3 -1
- package/app-layout/index.js.map +1 -1
- package/app-layout/mobile-toolbar/index.d.ts +1 -0
- package/app-layout/mobile-toolbar/index.d.ts.map +1 -1
- package/app-layout/mobile-toolbar/index.js +15 -5
- package/app-layout/mobile-toolbar/index.js.map +1 -1
- package/app-layout/toggles/index.js +2 -2
- package/app-layout/toggles/index.js.map +1 -1
- package/app-layout/toggles/interfaces.d.ts +1 -0
- package/app-layout/toggles/interfaces.d.ts.map +1 -1
- package/app-layout/toggles/interfaces.js.map +1 -1
- package/app-layout/utils/use-drawers.d.ts +1 -0
- package/app-layout/utils/use-drawers.d.ts.map +1 -1
- package/app-layout/utils/use-drawers.js +1 -0
- package/app-layout/utils/use-drawers.js.map +1 -1
- package/app-layout/visual-refresh/context.d.ts +1 -0
- package/app-layout/visual-refresh/context.d.ts.map +1 -1
- package/app-layout/visual-refresh/context.js +1 -1
- package/app-layout/visual-refresh/context.js.map +1 -1
- package/app-layout/visual-refresh/drawers.d.ts.map +1 -1
- package/app-layout/visual-refresh/drawers.js +49 -17
- package/app-layout/visual-refresh/drawers.js.map +1 -1
- package/app-layout/visual-refresh/styles.css.js +74 -69
- package/app-layout/visual-refresh/styles.scoped.css +196 -167
- package/app-layout/visual-refresh/styles.selectors.js +74 -69
- package/app-layout/visual-refresh/trigger-button.d.ts +1 -0
- package/app-layout/visual-refresh/trigger-button.d.ts.map +1 -1
- package/app-layout/visual-refresh/trigger-button.js +8 -5
- package/app-layout/visual-refresh/trigger-button.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/popover/interfaces.d.ts +4 -0
- package/popover/interfaces.d.ts.map +1 -1
- package/popover/interfaces.js.map +1 -1
- package/popover/internal.js +2 -2
- package/popover/internal.js.map +1 -1
|
@@ -2,74 +2,79 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"background": "
|
|
6
|
-
"scrolling-background": "awsui_scrolling-
|
|
7
|
-
"sticky-background": "awsui_sticky-
|
|
8
|
-
"has-sticky-notifications": "awsui_has-sticky-
|
|
9
|
-
"breadcrumbs": "
|
|
10
|
-
"has-sticky-background": "awsui_has-sticky-
|
|
11
|
-
"drawers-container": "awsui_drawers-
|
|
12
|
-
"has-open-drawer": "awsui_has-open-
|
|
13
|
-
"disable-body-scroll": "awsui_disable-body-
|
|
14
|
-
"drawers-desktop-triggers-container": "awsui_drawers-desktop-triggers-
|
|
15
|
-
"has-multiple-triggers": "awsui_has-multiple-
|
|
16
|
-
"drawers-
|
|
17
|
-
"drawers-trigger": "awsui_drawers-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"drawer
|
|
21
|
-
"drawer-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"content-
|
|
31
|
-
"has-
|
|
32
|
-
"content-first-child-
|
|
33
|
-
"has-
|
|
34
|
-
"content-first-child-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"is-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"mobile-toolbar
|
|
48
|
-
"mobile-toolbar-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
5
|
+
"background": "awsui_background_hyvsj_jgnob_93",
|
|
6
|
+
"scrolling-background": "awsui_scrolling-background_hyvsj_jgnob_96",
|
|
7
|
+
"sticky-background": "awsui_sticky-background_hyvsj_jgnob_102",
|
|
8
|
+
"has-sticky-notifications": "awsui_has-sticky-notifications_hyvsj_jgnob_110",
|
|
9
|
+
"breadcrumbs": "awsui_breadcrumbs_hyvsj_jgnob_123",
|
|
10
|
+
"has-sticky-background": "awsui_has-sticky-background_hyvsj_jgnob_133",
|
|
11
|
+
"drawers-container": "awsui_drawers-container_hyvsj_jgnob_145",
|
|
12
|
+
"has-open-drawer": "awsui_has-open-drawer_hyvsj_jgnob_157",
|
|
13
|
+
"disable-body-scroll": "awsui_disable-body-scroll_hyvsj_jgnob_191",
|
|
14
|
+
"drawers-desktop-triggers-container": "awsui_drawers-desktop-triggers-container_hyvsj_jgnob_196",
|
|
15
|
+
"has-multiple-triggers": "awsui_has-multiple-triggers_hyvsj_jgnob_215",
|
|
16
|
+
"drawers-mobile-triggers-container": "awsui_drawers-mobile-triggers-container_hyvsj_jgnob_247",
|
|
17
|
+
"drawers-trigger-content": "awsui_drawers-trigger-content_hyvsj_jgnob_251",
|
|
18
|
+
"drawers-trigger-overflow": "awsui_drawers-trigger-overflow_hyvsj_jgnob_277",
|
|
19
|
+
"drawers-trigger": "awsui_drawers-trigger_hyvsj_jgnob_251",
|
|
20
|
+
"drawer": "awsui_drawer_hyvsj_jgnob_145",
|
|
21
|
+
"drawer-close-button": "awsui_drawer-close-button_hyvsj_jgnob_308",
|
|
22
|
+
"drawer-content": "awsui_drawer-content_hyvsj_jgnob_313",
|
|
23
|
+
"drawer-slider": "awsui_drawer-slider_hyvsj_jgnob_318",
|
|
24
|
+
"is-drawer-open": "awsui_is-drawer-open_hyvsj_jgnob_325",
|
|
25
|
+
"content": "awsui_content_hyvsj_jgnob_350",
|
|
26
|
+
"layout": "awsui_layout_hyvsj_jgnob_371",
|
|
27
|
+
"has-max-content-width": "awsui_has-max-content-width_hyvsj_jgnob_454",
|
|
28
|
+
"content-type-dashboard": "awsui_content-type-dashboard_hyvsj_jgnob_469",
|
|
29
|
+
"is-overlap-disabled": "awsui_is-overlap-disabled_hyvsj_jgnob_486",
|
|
30
|
+
"has-content-gap-left": "awsui_has-content-gap-left_hyvsj_jgnob_518",
|
|
31
|
+
"has-content-gap-right": "awsui_has-content-gap-right_hyvsj_jgnob_521",
|
|
32
|
+
"content-first-child-notifications": "awsui_content-first-child-notifications_hyvsj_jgnob_531",
|
|
33
|
+
"has-breadcrumbs": "awsui_has-breadcrumbs_hyvsj_jgnob_534",
|
|
34
|
+
"content-first-child-header": "awsui_content-first-child-header_hyvsj_jgnob_537",
|
|
35
|
+
"has-header": "awsui_has-header_hyvsj_jgnob_537",
|
|
36
|
+
"content-first-child-main": "awsui_content-first-child-main_hyvsj_jgnob_558",
|
|
37
|
+
"disable-content-paddings": "awsui_disable-content-paddings_hyvsj_jgnob_558",
|
|
38
|
+
"has-split-panel": "awsui_has-split-panel_hyvsj_jgnob_601",
|
|
39
|
+
"split-panel-position-bottom": "awsui_split-panel-position-bottom_hyvsj_jgnob_601",
|
|
40
|
+
"block-body-scroll": "awsui_block-body-scroll_hyvsj_jgnob_617",
|
|
41
|
+
"unfocusable": "awsui_unfocusable_hyvsj_jgnob_622",
|
|
42
|
+
"container": "awsui_container_hyvsj_jgnob_632",
|
|
43
|
+
"is-navigation-open": "awsui_is-navigation-open_hyvsj_jgnob_657",
|
|
44
|
+
"is-tools-open": "awsui_is-tools-open_hyvsj_jgnob_660",
|
|
45
|
+
"is-split-panel-open": "awsui_is-split-panel-open_hyvsj_jgnob_660",
|
|
46
|
+
"split-panel-position-side": "awsui_split-panel-position-side_hyvsj_jgnob_660",
|
|
47
|
+
"mobile-toolbar": "awsui_mobile-toolbar_hyvsj_jgnob_669",
|
|
48
|
+
"mobile-toolbar-nav": "awsui_mobile-toolbar-nav_hyvsj_jgnob_685",
|
|
49
|
+
"mobile-toolbar-breadcrumbs": "awsui_mobile-toolbar-breadcrumbs_hyvsj_jgnob_689",
|
|
50
|
+
"mobile-toolbar-tools": "awsui_mobile-toolbar-tools_hyvsj_jgnob_693",
|
|
51
|
+
"navigation-container": "awsui_navigation-container_hyvsj_jgnob_702",
|
|
52
|
+
"show-navigation": "awsui_show-navigation_hyvsj_jgnob_746",
|
|
53
|
+
"animating": "awsui_animating_hyvsj_jgnob_768",
|
|
54
|
+
"showButtons": "awsui_showButtons_hyvsj_jgnob_1",
|
|
55
|
+
"navigation": "awsui_navigation_hyvsj_jgnob_702",
|
|
56
|
+
"openNavigation": "awsui_openNavigation_hyvsj_jgnob_1",
|
|
57
|
+
"animated-content": "awsui_animated-content_hyvsj_jgnob_830",
|
|
58
|
+
"hide-navigation": "awsui_hide-navigation_hyvsj_jgnob_839",
|
|
59
|
+
"notifications": "awsui_notifications_hyvsj_jgnob_849",
|
|
60
|
+
"sticky-notifications": "awsui_sticky-notifications_hyvsj_jgnob_855",
|
|
61
|
+
"split-panel-bottom": "awsui_split-panel-bottom_hyvsj_jgnob_872",
|
|
62
|
+
"position-bottom": "awsui_position-bottom_hyvsj_jgnob_919",
|
|
63
|
+
"openSplitPanelBottom": "awsui_openSplitPanelBottom_hyvsj_jgnob_1",
|
|
64
|
+
"split-panel-side": "awsui_split-panel-side_hyvsj_jgnob_948",
|
|
65
|
+
"position-side": "awsui_position-side_hyvsj_jgnob_976",
|
|
66
|
+
"openSplitPanelSide": "awsui_openSplitPanelSide_hyvsj_jgnob_1",
|
|
67
|
+
"tools-container": "awsui_tools-container_hyvsj_jgnob_1013",
|
|
68
|
+
"tools": "awsui_tools_hyvsj_jgnob_1013",
|
|
69
|
+
"openTools": "awsui_openTools_hyvsj_jgnob_1",
|
|
70
|
+
"has-tools-form-persistence": "awsui_has-tools-form-persistence_hyvsj_jgnob_1108",
|
|
71
|
+
"hide-tools": "awsui_hide-tools_hyvsj_jgnob_1118",
|
|
72
|
+
"show-tools": "awsui_show-tools_hyvsj_jgnob_1130",
|
|
73
|
+
"has-tools-form": "awsui_has-tools-form_hyvsj_jgnob_1108",
|
|
74
|
+
"trigger": "awsui_trigger_hyvsj_jgnob_1195",
|
|
75
|
+
"selected": "awsui_selected_hyvsj_jgnob_1235",
|
|
76
|
+
"badge": "awsui_badge_hyvsj_jgnob_1245",
|
|
77
|
+
"trigger-wrapper": "awsui_trigger-wrapper_hyvsj_jgnob_1249",
|
|
78
|
+
"dot": "awsui_dot_hyvsj_jgnob_1253"
|
|
74
79
|
};
|
|
75
80
|
|
|
@@ -9,6 +9,7 @@ export interface TriggerButtonProps {
|
|
|
9
9
|
testId?: string;
|
|
10
10
|
onClick: React.MouseEventHandler<HTMLButtonElement>;
|
|
11
11
|
selected?: boolean;
|
|
12
|
+
badge?: boolean;
|
|
12
13
|
}
|
|
13
14
|
declare const _default: React.ForwardRefExoticComponent<TriggerButtonProps & React.RefAttributes<ButtonProps.Ref>>;
|
|
14
15
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger-button.d.ts","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/trigger-button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"trigger-button.d.ts","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/trigger-button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;;AAgCD,wBAA+C"}
|
|
@@ -4,11 +4,14 @@ import React from 'react';
|
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import Icon from '../../icon/internal';
|
|
6
6
|
import styles from './styles.css.js';
|
|
7
|
-
function TriggerButton({ ariaLabel, className, iconName, iconSvg, onClick, testId, selected = false }, ref) {
|
|
8
|
-
return (React.createElement("
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
function TriggerButton({ ariaLabel, className, iconName, iconSvg, onClick, testId, badge, selected = false }, ref) {
|
|
8
|
+
return (React.createElement("div", { className: clsx(styles['trigger-wrapper']) },
|
|
9
|
+
React.createElement("button", { "aria-expanded": false, "aria-haspopup": true, "aria-label": ariaLabel, className: clsx(styles.trigger, {
|
|
10
|
+
[styles.selected]: selected,
|
|
11
|
+
[styles.badge]: badge,
|
|
12
|
+
}, className), onClick: onClick, ref: ref, type: "button", "data-testid": testId },
|
|
13
|
+
React.createElement(Icon, { name: iconName, svg: iconSvg })),
|
|
14
|
+
badge && React.createElement("div", { className: clsx(styles.dot) })));
|
|
12
15
|
}
|
|
13
16
|
export default React.forwardRef(TriggerButton);
|
|
14
17
|
//# sourceMappingURL=trigger-button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger-button.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/trigger-button.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,qBAAqB,CAAC;AACvC,OAAO,MAAM,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"trigger-button.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/trigger-button.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,qBAAqB,CAAC;AACvC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAerC,SAAS,aAAa,CACpB,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,KAAK,EAAsB,EACzG,GAA+B;IAE/B,OAAO,CACL,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAC7C,iDACiB,KAAK,mBACL,IAAI,gBACP,SAAS,EACrB,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,OAAO,EACd;gBACE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ;gBAC3B,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK;aACtB,EACD,SAAS,CACV,EACD,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAmC,EACxC,IAAI,EAAC,QAAQ,iBACA,MAAM;YAEnB,oBAAC,IAAI,IAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,GAAI,CAC/B;QACR,KAAK,IAAI,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAI,CAC1C,CACP,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport Icon from '../../icon/internal';\nimport styles from './styles.css.js';\nimport { ButtonProps } from '../../button/interfaces';\nimport { IconProps } from '../../icon/interfaces';\n\nexport interface TriggerButtonProps {\n ariaLabel?: string;\n className?: string;\n iconName?: IconProps.Name;\n iconSvg?: React.ReactNode;\n testId?: string;\n onClick: React.MouseEventHandler<HTMLButtonElement>;\n selected?: boolean;\n badge?: boolean;\n}\n\nfunction TriggerButton(\n { ariaLabel, className, iconName, iconSvg, onClick, testId, badge, selected = false }: TriggerButtonProps,\n ref: React.Ref<ButtonProps.Ref>\n) {\n return (\n <div className={clsx(styles['trigger-wrapper'])}>\n <button\n aria-expanded={false}\n aria-haspopup={true}\n aria-label={ariaLabel}\n className={clsx(\n styles.trigger,\n {\n [styles.selected]: selected,\n [styles.badge]: badge,\n },\n className\n )}\n onClick={onClick}\n ref={ref as React.Ref<HTMLButtonElement>}\n type=\"button\"\n data-testid={testId}\n >\n <Icon name={iconName} svg={iconSvg} />\n </button>\n {badge && <div className={clsx(styles.dot)} />}\n </div>\n );\n}\n\nexport default React.forwardRef(TriggerButton);\n"]}
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
package/popover/interfaces.d.ts
CHANGED
|
@@ -22,6 +22,10 @@ export interface PopoverProps extends BaseComponentProps {
|
|
|
22
22
|
* - `custom` - Use for the [button](/components/button/) component.
|
|
23
23
|
*/
|
|
24
24
|
triggerType?: PopoverProps.TriggerType;
|
|
25
|
+
/**
|
|
26
|
+
* Adds an aria-label to the text trigger button.
|
|
27
|
+
*/
|
|
28
|
+
triggerAriaLabel?: string;
|
|
25
29
|
/**
|
|
26
30
|
* Element that triggers the popover when selected by the user.
|
|
27
31
|
* @displayname trigger
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["popover/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,YAAa,SAAQ,kBAAkB;IACtD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC;IAEjC;;OAEG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;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,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["popover/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface PopoverProps extends BaseComponentProps {\n /**\n * Determines where the popover is displayed when opened, relative to the trigger.\n * If the popover doesn't have enough space to open in this direction, it\n * automatically chooses a better direction based on available space.\n */\n position?: PopoverProps.Position;\n\n /**\n * Determines the maximum width for the popover.\n */\n size?: PopoverProps.Size;\n\n /**\n * Expands the popover body to its maximum width regardless of content.\n * For example, use it when you need to place a column layout in the popover content.\n */\n fixedWidth?: boolean;\n\n /**\n * Specifies the type of content inside the trigger region. The following types are available:\n * - `text` - Use for inline text triggers.\n * - `custom` - Use for the [button](/components/button/) component.\n */\n triggerType?: PopoverProps.TriggerType;\n\n /**\n * Element that triggers the popover when selected by the user.\n * @displayname trigger\n */\n children?: React.ReactNode;\n\n /**\n * Specifies optional header text for the popover.\n */\n header?: string;\n\n /**\n * Content of the popover.\n */\n content?: React.ReactNode;\n\n /**\n * Determines whether the dismiss button is shown in the popover body.\n */\n dismissButton?: boolean;\n\n /**\n * Adds an `aria-label` to the dismiss button for accessibility.\n * @i18n\n */\n dismissAriaLabel?: string;\n\n /**\n * By default, the popover is constrained to fit inside its parent\n * [stacking context](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context).\n * Enabling this property will allow the popover to be rendered in the root stack context using\n * [React Portals](https://reactjs.org/docs/portals.html).\n * Enable this setting if you need the popover to ignore its parent stacking context, such as in side navigation.\n *\n * Note: Using popover rendered with portal within a Modal is not supported.\n */\n renderWithPortal?: boolean;\n}\n\n/**\n * The position the popover is actually in, given space constraints.\n */\nexport type InternalPosition =\n | 'right-top'\n | 'right-bottom'\n | 'left-top'\n | 'left-bottom'\n | 'top-center'\n | 'top-right'\n | 'top-left'\n | 'bottom-center'\n | 'bottom-right'\n | 'bottom-left';\n\nexport interface Offset {\n left: number;\n top: number;\n}\n\nexport interface BoundingBox {\n width: number;\n height: number;\n}\n\nexport type BoundingOffset = BoundingBox & Offset;\n\nexport namespace PopoverProps {\n export type Position = 'top' | 'right' | 'bottom' | 'left';\n export type Size = 'small' | 'medium' | 'large';\n export type TriggerType = 'text' | 'custom';\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["popover/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface PopoverProps extends BaseComponentProps {\n /**\n * Determines where the popover is displayed when opened, relative to the trigger.\n * If the popover doesn't have enough space to open in this direction, it\n * automatically chooses a better direction based on available space.\n */\n position?: PopoverProps.Position;\n\n /**\n * Determines the maximum width for the popover.\n */\n size?: PopoverProps.Size;\n\n /**\n * Expands the popover body to its maximum width regardless of content.\n * For example, use it when you need to place a column layout in the popover content.\n */\n fixedWidth?: boolean;\n\n /**\n * Specifies the type of content inside the trigger region. The following types are available:\n * - `text` - Use for inline text triggers.\n * - `custom` - Use for the [button](/components/button/) component.\n */\n triggerType?: PopoverProps.TriggerType;\n\n /**\n * Adds an aria-label to the text trigger button.\n */\n triggerAriaLabel?: string;\n\n /**\n * Element that triggers the popover when selected by the user.\n * @displayname trigger\n */\n children?: React.ReactNode;\n\n /**\n * Specifies optional header text for the popover.\n */\n header?: string;\n\n /**\n * Content of the popover.\n */\n content?: React.ReactNode;\n\n /**\n * Determines whether the dismiss button is shown in the popover body.\n */\n dismissButton?: boolean;\n\n /**\n * Adds an `aria-label` to the dismiss button for accessibility.\n * @i18n\n */\n dismissAriaLabel?: string;\n\n /**\n * By default, the popover is constrained to fit inside its parent\n * [stacking context](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context).\n * Enabling this property will allow the popover to be rendered in the root stack context using\n * [React Portals](https://reactjs.org/docs/portals.html).\n * Enable this setting if you need the popover to ignore its parent stacking context, such as in side navigation.\n *\n * Note: Using popover rendered with portal within a Modal is not supported.\n */\n renderWithPortal?: boolean;\n}\n\n/**\n * The position the popover is actually in, given space constraints.\n */\nexport type InternalPosition =\n | 'right-top'\n | 'right-bottom'\n | 'left-top'\n | 'left-bottom'\n | 'top-center'\n | 'top-right'\n | 'top-left'\n | 'bottom-center'\n | 'bottom-right'\n | 'bottom-left';\n\nexport interface Offset {\n left: number;\n top: number;\n}\n\nexport interface BoundingBox {\n width: number;\n height: number;\n}\n\nexport type BoundingOffset = BoundingBox & Offset;\n\nexport namespace PopoverProps {\n export type Position = 'top' | 'right' | 'bottom' | 'left';\n export type Size = 'small' | 'medium' | 'large';\n export type TriggerType = 'text' | 'custom';\n}\n"]}
|
package/popover/internal.js
CHANGED
|
@@ -20,7 +20,7 @@ import { getFirstFocusable } from '../internal/components/focus-lock/utils';
|
|
|
20
20
|
import { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';
|
|
21
21
|
export default React.forwardRef(InternalPopover);
|
|
22
22
|
function InternalPopover(_a, ref) {
|
|
23
|
-
var { position = 'right', size = 'medium', fixedWidth = false, triggerType = 'text', dismissButton = true, children, header, content, renderWithPortal = false, __onOpen, __internalRootRef = null } = _a, restProps = __rest(_a, ["position", "size", "fixedWidth", "triggerType", "dismissButton", "children", "header", "content", "renderWithPortal", "__onOpen", "__internalRootRef"]);
|
|
23
|
+
var { position = 'right', size = 'medium', fixedWidth = false, triggerType = 'text', dismissButton = true, children, header, content, triggerAriaLabel, renderWithPortal = false, __onOpen, __internalRootRef = null } = _a, restProps = __rest(_a, ["position", "size", "fixedWidth", "triggerType", "dismissButton", "children", "header", "content", "triggerAriaLabel", "renderWithPortal", "__onOpen", "__internalRootRef"]);
|
|
24
24
|
const baseProps = getBaseProps(restProps);
|
|
25
25
|
const triggerRef = useRef(null);
|
|
26
26
|
const popoverRef = useRef(null);
|
|
@@ -91,7 +91,7 @@ function InternalPopover(_a, ref) {
|
|
|
91
91
|
clickFrameId.current = null;
|
|
92
92
|
});
|
|
93
93
|
} }),
|
|
94
|
-
triggerType === 'text' ? (React.createElement("button", Object.assign({}, triggerProps, { type: "button", "aria-haspopup": "dialog", id: referrerId }),
|
|
94
|
+
triggerType === 'text' ? (React.createElement("button", Object.assign({}, triggerProps, { type: "button", "aria-haspopup": "dialog", id: referrerId, "aria-label": triggerAriaLabel }),
|
|
95
95
|
React.createElement("span", { className: styles['trigger-inner-text'] }, children))) : (React.createElement("span", Object.assign({}, triggerProps, { id: referrerId }), children)),
|
|
96
96
|
React.createElement(FormFieldContext.Provider, { value: {} }, renderWithPortal ? React.createElement(Portal, null, popoverContent) : popoverContent)));
|
|
97
97
|
}
|
package/popover/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["popover/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,MAAM,MAAM,+BAA+B,CAAC;AAEnD,OAAO,gBAAgB,MAAM,aAAa,CAAC;AAC3C,OAAO,WAAW,MAAM,QAAQ,CAAC;AAEjC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAA6B,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAE7F,OAAO,EAAE,YA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Aa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,eAAe,EAAC,MAAM,IAErB,OAAO,CACI,CACqB,CACpB,CACpB,CACG,CACP,CAAC;IAEF,MAAM,SAAS,GAAG,YAAY,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;IAE9D,OAAO,CACL,8CACM,SAAS,IACb,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,EACjD,GAAG,EAAE,SAAS,EACd,WAAW,EAAE,GAAG,EAAE;YAChB,gFAAgF;YAChF,YAAY,CAAC,OAAO,GAAG,qBAAqB,CAAC,GAAG,EAAE;gBAChD,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;YAC9B,CAAC,CAAC,CAAC;QACL,CAAC;QAEA,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC,CACxB,gDAAY,YAAY,IAAE,IAAI,EAAC,QAAQ,mBAAe,QAAQ,EAAC,EAAE,EAAE,UAAU;YAC3E,8BAAM,SAAS,EAAE,MAAM,CAAC,oBAAoB,CAAC,IAAG,QAAQ,CAAQ,CACzD,CACV,CAAC,CAAC,CAAC,CACF,8CAAU,YAAY,IAAE,EAAE,EAAE,UAAU,KACnC,QAAQ,CACJ,CACR;QACD,oBAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,IACjC,gBAAgB,CAAC,CAAC,CAAC,oBAAC,MAAM,QAAE,cAAc,CAAU,CAAC,CAAC,CAAC,cAAc,CAC5C,CACvB,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useRef, useState, useImperativeHandle } from 'react';\nimport clsx from 'clsx';\n\nimport { KeyCode } from '../internal/keycode';\nimport { getBaseProps } from '../internal/base-component';\nimport { FormFieldContext } from '../internal/context/form-field-context';\n\nimport Arrow from './arrow';\nimport Portal from '../internal/components/portal';\nimport { PopoverProps } from './interfaces';\nimport PopoverContainer from './container';\nimport PopoverBody from './body';\n\nimport styles from './styles.css.js';\nimport { NonCancelableEventHandler, fireNonCancelableEvent } from '../internal/events/index';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes';\nimport { useInternalI18n } from '../i18n/context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { getFirstFocusable } from '../internal/components/focus-lock/utils';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\n\nexport interface InternalPopoverProps extends PopoverProps, InternalBaseComponentProps {\n __onOpen?: NonCancelableEventHandler<null>;\n}\n\nexport interface InternalPopoverRef {\n dismissPopover: () => void;\n}\n\nexport default React.forwardRef(InternalPopover);\n\nfunction InternalPopover(\n {\n position = 'right',\n size = 'medium',\n fixedWidth = false,\n triggerType = 'text',\n dismissButton = true,\n\n children,\n header,\n content,\n\n renderWithPortal = false,\n\n __onOpen,\n __internalRootRef = null,\n ...restProps\n }: InternalPopoverProps,\n ref: React.Ref<InternalPopoverRef>\n) {\n const baseProps = getBaseProps(restProps);\n const triggerRef = useRef<HTMLElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const clickFrameId = useRef<number | null>(null);\n\n const i18n = useInternalI18n('popover');\n const dismissAriaLabel = i18n('dismissAriaLabel', restProps.dismissAriaLabel);\n\n const [visible, setVisible] = useState(false);\n\n const focusTrigger = useCallback(() => {\n if (triggerType === 'text') {\n triggerRef.current?.focus();\n } else {\n triggerRef.current && getFirstFocusable(triggerRef.current)?.focus();\n }\n }, [triggerType]);\n\n const onTriggerClick = useCallback(() => {\n fireNonCancelableEvent(__onOpen);\n setVisible(true);\n }, [__onOpen]);\n\n const onDismiss = useCallback(() => {\n setVisible(false);\n focusTrigger();\n }, [focusTrigger]);\n\n const onTriggerKeyDown = useCallback((event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.tab || event.keyCode === KeyCode.escape) {\n setVisible(false);\n }\n }, []);\n\n useImperativeHandle(ref, () => ({\n dismissPopover: onDismiss,\n }));\n\n useEffect(() => {\n if (!triggerRef.current) {\n return;\n }\n const document = triggerRef.current.ownerDocument;\n\n const onDocumentClick = () => {\n // Dismiss popover unless there was a click inside within the last animation frame.\n if (clickFrameId.current === null) {\n setVisible(false);\n }\n };\n\n // useCapture=false makes sure this listener is called after the one attached to the element.\n // the options.capture notation is unsupported by IE.\n document.addEventListener('mousedown', onDocumentClick, false);\n\n return () => {\n document.removeEventListener('mousedown', onDocumentClick, false);\n };\n }, []);\n\n const popoverClasses = usePortalModeClasses(triggerRef);\n\n const triggerProps = {\n // https://github.com/microsoft/TypeScript/issues/36659\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: triggerRef as any,\n onClick: onTriggerClick,\n onKeyDown: onTriggerKeyDown,\n className: clsx(styles.trigger, styles[`trigger-type-${triggerType}`]),\n };\n\n const referrerId = useUniqueId();\n const popoverContent = (\n <div\n aria-live={dismissButton ? undefined : 'polite'}\n aria-atomic={dismissButton ? undefined : true}\n className={clsx(popoverClasses, styles['popover-content'])}\n data-awsui-referrer-id={referrerId}\n >\n {visible && (\n <PopoverContainer\n size={size}\n fixedWidth={fixedWidth}\n position={position}\n trackRef={triggerRef}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={renderWithPortal}\n zIndex={renderWithPortal ? 7000 : undefined}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <PopoverBody\n dismissButton={dismissButton}\n dismissAriaLabel={dismissAriaLabel}\n header={header}\n onDismiss={onDismiss}\n overflowVisible=\"both\"\n >\n {content}\n </PopoverBody>\n </LinkDefaultVariantContext.Provider>\n </PopoverContainer>\n )}\n </div>\n );\n\n const mergedRef = useMergeRefs(popoverRef, __internalRootRef);\n\n return (\n <span\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n ref={mergedRef}\n onMouseDown={() => {\n // Indicate there was a click inside popover recently, including nested portals.\n clickFrameId.current = requestAnimationFrame(() => {\n clickFrameId.current = null;\n });\n }}\n >\n {triggerType === 'text' ? (\n <button {...triggerProps} type=\"button\" aria-haspopup=\"dialog\" id={referrerId}>\n <span className={styles['trigger-inner-text']}>{children}</span>\n </button>\n ) : (\n <span {...triggerProps} id={referrerId}>\n {children}\n </span>\n )}\n <FormFieldContext.Provider value={{}}>\n {renderWithPortal ? <Portal>{popoverContent}</Portal> : popoverContent}\n </FormFieldContext.Provider>\n </span>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["popover/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,MAAM,MAAM,+BAA+B,CAAC;AAEnD,OAAO,gBAAgB,MAAM,aAAa,CAAC;AAC3C,OAAO,WAAW,MAAM,QAAQ,CAAC;AAEjC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAA6B,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAE7F,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA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B,OAAO,CACI,CACqB,CACpB,CACpB,CACG,CACP,CAAC;IAEF,MAAM,SAAS,GAAG,YAAY,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;IAE9D,OAAO,CACL,8CACM,SAAS,IACb,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,EACjD,GAAG,EAAE,SAAS,EACd,WAAW,EAAE,GAAG,EAAE;YAChB,gFAAgF;YAChF,YAAY,CAAC,OAAO,GAAG,qBAAqB,CAAC,GAAG,EAAE;gBAChD,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;YAC9B,CAAC,CAAC,CAAC;QACL,CAAC;QAEA,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC,CACxB,gDAAY,YAAY,IAAE,IAAI,EAAC,QAAQ,mBAAe,QAAQ,EAAC,EAAE,EAAE,UAAU,gBAAc,gBAAgB;YACzG,8BAAM,SAAS,EAAE,MAAM,CAAC,oBAAoB,CAAC,IAAG,QAAQ,CAAQ,CACzD,CACV,CAAC,CAAC,CAAC,CACF,8CAAU,YAAY,IAAE,EAAE,EAAE,UAAU,KACnC,QAAQ,CACJ,CACR;QACD,oBAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,IACjC,gBAAgB,CAAC,CAAC,CAAC,oBAAC,MAAM,QAAE,cAAc,CAAU,CAAC,CAAC,CAAC,cAAc,CAC5C,CACvB,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useRef, useState, useImperativeHandle } from 'react';\nimport clsx from 'clsx';\n\nimport { KeyCode } from '../internal/keycode';\nimport { getBaseProps } from '../internal/base-component';\nimport { FormFieldContext } from '../internal/context/form-field-context';\n\nimport Arrow from './arrow';\nimport Portal from '../internal/components/portal';\nimport { PopoverProps } from './interfaces';\nimport PopoverContainer from './container';\nimport PopoverBody from './body';\n\nimport styles from './styles.css.js';\nimport { NonCancelableEventHandler, fireNonCancelableEvent } from '../internal/events/index';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes';\nimport { useInternalI18n } from '../i18n/context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { getFirstFocusable } from '../internal/components/focus-lock/utils';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\n\nexport interface InternalPopoverProps extends PopoverProps, InternalBaseComponentProps {\n __onOpen?: NonCancelableEventHandler<null>;\n}\n\nexport interface InternalPopoverRef {\n dismissPopover: () => void;\n}\n\nexport default React.forwardRef(InternalPopover);\n\nfunction InternalPopover(\n {\n position = 'right',\n size = 'medium',\n fixedWidth = false,\n triggerType = 'text',\n dismissButton = true,\n\n children,\n header,\n content,\n triggerAriaLabel,\n\n renderWithPortal = false,\n\n __onOpen,\n __internalRootRef = null,\n ...restProps\n }: InternalPopoverProps,\n ref: React.Ref<InternalPopoverRef>\n) {\n const baseProps = getBaseProps(restProps);\n const triggerRef = useRef<HTMLElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const clickFrameId = useRef<number | null>(null);\n\n const i18n = useInternalI18n('popover');\n const dismissAriaLabel = i18n('dismissAriaLabel', restProps.dismissAriaLabel);\n\n const [visible, setVisible] = useState(false);\n\n const focusTrigger = useCallback(() => {\n if (triggerType === 'text') {\n triggerRef.current?.focus();\n } else {\n triggerRef.current && getFirstFocusable(triggerRef.current)?.focus();\n }\n }, [triggerType]);\n\n const onTriggerClick = useCallback(() => {\n fireNonCancelableEvent(__onOpen);\n setVisible(true);\n }, [__onOpen]);\n\n const onDismiss = useCallback(() => {\n setVisible(false);\n focusTrigger();\n }, [focusTrigger]);\n\n const onTriggerKeyDown = useCallback((event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.tab || event.keyCode === KeyCode.escape) {\n setVisible(false);\n }\n }, []);\n\n useImperativeHandle(ref, () => ({\n dismissPopover: onDismiss,\n }));\n\n useEffect(() => {\n if (!triggerRef.current) {\n return;\n }\n const document = triggerRef.current.ownerDocument;\n\n const onDocumentClick = () => {\n // Dismiss popover unless there was a click inside within the last animation frame.\n if (clickFrameId.current === null) {\n setVisible(false);\n }\n };\n\n // useCapture=false makes sure this listener is called after the one attached to the element.\n // the options.capture notation is unsupported by IE.\n document.addEventListener('mousedown', onDocumentClick, false);\n\n return () => {\n document.removeEventListener('mousedown', onDocumentClick, false);\n };\n }, []);\n\n const popoverClasses = usePortalModeClasses(triggerRef);\n\n const triggerProps = {\n // https://github.com/microsoft/TypeScript/issues/36659\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: triggerRef as any,\n onClick: onTriggerClick,\n onKeyDown: onTriggerKeyDown,\n className: clsx(styles.trigger, styles[`trigger-type-${triggerType}`]),\n };\n\n const referrerId = useUniqueId();\n const popoverContent = (\n <div\n aria-live={dismissButton ? undefined : 'polite'}\n aria-atomic={dismissButton ? undefined : true}\n className={clsx(popoverClasses, styles['popover-content'])}\n data-awsui-referrer-id={referrerId}\n >\n {visible && (\n <PopoverContainer\n size={size}\n fixedWidth={fixedWidth}\n position={position}\n trackRef={triggerRef}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={renderWithPortal}\n zIndex={renderWithPortal ? 7000 : undefined}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <PopoverBody\n dismissButton={dismissButton}\n dismissAriaLabel={dismissAriaLabel}\n header={header}\n onDismiss={onDismiss}\n overflowVisible=\"both\"\n >\n {content}\n </PopoverBody>\n </LinkDefaultVariantContext.Provider>\n </PopoverContainer>\n )}\n </div>\n );\n\n const mergedRef = useMergeRefs(popoverRef, __internalRootRef);\n\n return (\n <span\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n ref={mergedRef}\n onMouseDown={() => {\n // Indicate there was a click inside popover recently, including nested portals.\n clickFrameId.current = requestAnimationFrame(() => {\n clickFrameId.current = null;\n });\n }}\n >\n {triggerType === 'text' ? (\n <button {...triggerProps} type=\"button\" aria-haspopup=\"dialog\" id={referrerId} aria-label={triggerAriaLabel}>\n <span className={styles['trigger-inner-text']}>{children}</span>\n </button>\n ) : (\n <span {...triggerProps} id={referrerId}>\n {children}\n </span>\n )}\n <FormFieldContext.Provider value={{}}>\n {renderWithPortal ? <Portal>{popoverContent}</Portal> : popoverContent}\n </FormFieldContext.Provider>\n </span>\n );\n}\n"]}
|