@cloudscape-design/components-themeable 3.0.877 → 3.0.879
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/collection-preferences/content-display/content-display-option.scss +4 -0
- package/lib/internal/scss/internal/components/drag-handle/styles.scss +51 -18
- package/lib/internal/scss/internal/components/panel-resize-handle/styles.scss +3 -42
- package/lib/internal/scss/tabs/tab-header-bar.scss +1 -0
- package/lib/internal/template/app-layout/drawer/resizable-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/drawer/resizable-drawer.js +3 -2
- package/lib/internal/template/app-layout/drawer/resizable-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/utils/use-focus-control.d.ts +2 -1
- package/lib/internal/template/app-layout/utils/use-focus-control.d.ts.map +1 -1
- package/lib/internal/template/app-layout/utils/use-focus-control.js +2 -0
- package/lib/internal/template/app-layout/utils/use-focus-control.js.map +1 -1
- package/lib/internal/template/app-layout/utils/use-resize.d.ts.map +1 -1
- package/lib/internal/template/app-layout/utils/use-resize.js +3 -2
- package/lib/internal/template/app-layout/utils/use-resize.js.map +1 -1
- package/lib/internal/template/app-layout/utils/use-split-panel-focus-control.d.ts +2 -1
- package/lib/internal/template/app-layout/utils/use-split-panel-focus-control.d.ts.map +1 -1
- package/lib/internal/template/app-layout/utils/use-split-panel-focus-control.js +1 -0
- package/lib/internal/template/app-layout/utils/use-split-panel-focus-control.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +3 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.js +3 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.js.map +1 -1
- package/lib/internal/template/attribute-editor/interfaces.d.ts +7 -0
- package/lib/internal/template/attribute-editor/interfaces.d.ts.map +1 -1
- package/lib/internal/template/attribute-editor/interfaces.js.map +1 -1
- package/lib/internal/template/attribute-editor/internal.d.ts.map +1 -1
- package/lib/internal/template/attribute-editor/internal.js +2 -2
- package/lib/internal/template/attribute-editor/internal.js.map +1 -1
- package/lib/internal/template/button/internal.js +1 -1
- package/lib/internal/template/button/internal.js.map +1 -1
- package/lib/internal/template/collection-preferences/content-display/content-display-option.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/content-display/content-display-option.js +2 -1
- package/lib/internal/template/collection-preferences/content-display/content-display-option.js.map +1 -1
- package/lib/internal/template/collection-preferences/content-display/styles.css.js +11 -10
- package/lib/internal/template/collection-preferences/content-display/styles.scoped.css +14 -10
- package/lib/internal/template/collection-preferences/content-display/styles.selectors.js +11 -10
- package/lib/internal/template/collection-preferences/index.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/index.js +1 -1
- package/lib/internal/template/collection-preferences/index.js.map +1 -1
- package/lib/internal/template/collection-preferences/styles.css.js +38 -37
- package/lib/internal/template/collection-preferences/styles.scoped.css +42 -38
- package/lib/internal/template/collection-preferences/styles.selectors.js +38 -37
- package/lib/internal/template/internal/components/drag-handle/index.d.ts +4 -8
- package/lib/internal/template/internal/components/drag-handle/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/index.js +23 -5
- package/lib/internal/template/internal/components/drag-handle/index.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts +25 -0
- package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts.map +1 -0
- package/lib/internal/template/internal/components/drag-handle/interfaces.js +4 -0
- package/lib/internal/template/internal/components/drag-handle/interfaces.js.map +1 -0
- package/lib/internal/template/internal/components/drag-handle/resize-icon.d.ts +7 -0
- package/lib/internal/template/internal/components/drag-handle/resize-icon.d.ts.map +1 -0
- package/lib/internal/template/internal/components/{panel-resize-handle/icon.js → drag-handle/resize-icon.js} +5 -3
- package/lib/internal/template/internal/components/drag-handle/resize-icon.js.map +1 -0
- package/lib/internal/template/internal/components/drag-handle/styles.css.js +12 -3
- package/lib/internal/template/internal/components/drag-handle/styles.scoped.css +50 -20
- package/lib/internal/template/internal/components/drag-handle/styles.selectors.js +12 -3
- package/lib/internal/template/internal/components/options-list/index.js +1 -1
- package/lib/internal/template/internal/components/options-list/index.js.map +1 -1
- package/lib/internal/template/internal/components/panel-resize-handle/index.d.ts +4 -2
- package/lib/internal/template/internal/components/panel-resize-handle/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/panel-resize-handle/index.js +8 -5
- package/lib/internal/template/internal/components/panel-resize-handle/index.js.map +1 -1
- package/lib/internal/template/internal/components/panel-resize-handle/styles.css.js +2 -5
- package/lib/internal/template/internal/components/panel-resize-handle/styles.scoped.css +3 -191
- package/lib/internal/template/internal/components/panel-resize-handle/styles.selectors.js +2 -5
- package/lib/internal/template/internal/components/portal/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/portal/index.js.map +1 -1
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/environment.json +1 -1
- package/lib/internal/template/internal/events/index.d.ts +1 -1
- package/lib/internal/template/internal/events/index.d.ts.map +1 -1
- package/lib/internal/template/internal/events/index.js.map +1 -1
- package/lib/internal/template/internal/hooks/use-performance-marks/index.d.ts +1 -1
- package/lib/internal/template/internal/hooks/use-performance-marks/index.d.ts.map +1 -1
- package/lib/internal/template/internal/hooks/use-performance-marks/index.js +2 -2
- package/lib/internal/template/internal/hooks/use-performance-marks/index.js.map +1 -1
- package/lib/internal/template/popover/internal.js +5 -4
- package/lib/internal/template/popover/internal.js.map +1 -1
- package/lib/internal/template/prompt-input/internal.d.ts.map +1 -1
- package/lib/internal/template/prompt-input/internal.js +1 -3
- package/lib/internal/template/prompt-input/internal.js.map +1 -1
- package/lib/internal/template/split-panel/implementation.d.ts.map +1 -1
- package/lib/internal/template/split-panel/implementation.js +7 -6
- package/lib/internal/template/split-panel/implementation.js.map +1 -1
- package/lib/internal/template/table/internal.js +1 -1
- package/lib/internal/template/table/internal.js.map +1 -1
- package/lib/internal/template/tabs/styles.css.js +28 -28
- package/lib/internal/template/tabs/styles.scoped.css +50 -49
- package/lib/internal/template/tabs/styles.selectors.js +28 -28
- package/package.json +1 -1
- package/lib/internal/template/internal/components/panel-resize-handle/icon.d.ts +0 -5
- package/lib/internal/template/internal/components/panel-resize-handle/icon.d.ts.map +0 -1
- package/lib/internal/template/internal/components/panel-resize-handle/icon.js.map +0 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface ResizeHandleProps {
|
|
3
|
-
className?: string;
|
|
4
3
|
ariaLabel: string | undefined;
|
|
5
4
|
position: 'side' | 'bottom';
|
|
6
5
|
ariaValuenow: number;
|
|
7
6
|
onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
|
|
8
7
|
onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;
|
|
8
|
+
className?: string;
|
|
9
9
|
}
|
|
10
|
-
declare const _default: React.ForwardRefExoticComponent<ResizeHandleProps & React.RefAttributes<
|
|
10
|
+
declare const _default: React.ForwardRefExoticComponent<ResizeHandleProps & React.RefAttributes<{
|
|
11
|
+
focus: () => void;
|
|
12
|
+
}>>;
|
|
11
13
|
export default _default;
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/panel-resize-handle/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/panel-resize-handle/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,iBAAiB;IACzB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC7D,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;;WAIyB,MAAM,IAAI;;AAFpC,wBAsBG"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import
|
|
5
|
-
import ResizeHandleIcon from './icon';
|
|
4
|
+
import DragHandle from '../drag-handle';
|
|
6
5
|
import styles from './styles.css.js';
|
|
7
|
-
export default React.forwardRef(function PanelResizeHandle({
|
|
8
|
-
return (React.createElement("div", {
|
|
9
|
-
React.createElement(
|
|
6
|
+
export default React.forwardRef(function PanelResizeHandle({ ariaLabel, ariaValuenow, position, onKeyDown, onPointerDown, className }, ref) {
|
|
7
|
+
return (React.createElement("div", { className: styles[`handle-wrapper-${position}`] },
|
|
8
|
+
React.createElement(DragHandle, { variant: position === 'bottom' ? 'resize-vertical' : 'resize-horizontal', size: "small", ref: ref, ariaLabel: ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : '', ariaValue: {
|
|
9
|
+
valueMin: 0,
|
|
10
|
+
valueMax: 100,
|
|
11
|
+
valueNow: ariaValuenow,
|
|
12
|
+
}, onPointerDown: onPointerDown, onKeyDown: onKeyDown, className: className })));
|
|
10
13
|
});
|
|
11
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/panel-resize-handle/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/panel-resize-handle/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,UAAU,MAAM,gBAAgB,CAAC;AAExC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAWrC,eAAe,KAAK,CAAC,UAAU,CAAC,SAAS,iBAAiB,CACxD,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAqB,EAC7F,GAAqC;IAErC,OAAO,CACL,6BAAK,SAAS,EAAE,MAAM,CAAC,kBAAkB,QAAQ,EAAE,CAAC;QAClD,oBAAC,UAAU,IACT,OAAO,EAAE,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,mBAAmB,EACxE,IAAI,EAAC,OAAO,EACZ,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,EAC1B,SAAS,EAAE;gBACT,QAAQ,EAAE,CAAC;gBACX,QAAQ,EAAE,GAAG;gBACb,QAAQ,EAAE,YAAY;aACvB,EACD,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,GACpB,CACE,CACP,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\n\nimport DragHandle from '../drag-handle';\n\nimport styles from './styles.css.js';\n\ninterface ResizeHandleProps {\n ariaLabel: string | undefined;\n position: 'side' | 'bottom';\n ariaValuenow: number;\n onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;\n onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;\n className?: string;\n}\n\nexport default React.forwardRef(function PanelResizeHandle(\n { ariaLabel, ariaValuenow, position, onKeyDown, onPointerDown, className }: ResizeHandleProps,\n ref: React.Ref<{ focus: () => void }>\n) {\n return (\n <div className={styles[`handle-wrapper-${position}`]}>\n <DragHandle\n variant={position === 'bottom' ? 'resize-vertical' : 'resize-horizontal'}\n size=\"small\"\n ref={ref}\n ariaLabel={ariaLabel ?? ''}\n ariaValue={{\n valueMin: 0,\n valueMax: 100,\n valueNow: ariaValuenow,\n }}\n onPointerDown={onPointerDown}\n onKeyDown={onKeyDown}\n className={className}\n />\n </div>\n );\n});\n"]}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"slider-icon": "awsui_slider-icon_cqzlk_vw9m6_187",
|
|
7
|
-
"slider-icon-bottom": "awsui_slider-icon-bottom_cqzlk_vw9m6_193",
|
|
8
|
-
"slider-icon-side": "awsui_slider-icon-side_cqzlk_vw9m6_197"
|
|
4
|
+
"handle-wrapper-side": "awsui_handle-wrapper-side_cqzlk_1qkms_5",
|
|
5
|
+
"handle-wrapper-bottom": "awsui_handle-wrapper-bottom_cqzlk_1qkms_9"
|
|
9
6
|
};
|
|
10
7
|
|
|
@@ -2,198 +2,10 @@
|
|
|
2
2
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
|
-
SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
|
9
|
-
/*
|
|
10
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
11
|
-
SPDX-License-Identifier: Apache-2.0
|
|
12
|
-
*/
|
|
13
|
-
/*
|
|
14
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
15
|
-
SPDX-License-Identifier: Apache-2.0
|
|
16
|
-
*/
|
|
17
|
-
/*
|
|
18
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
19
|
-
SPDX-License-Identifier: Apache-2.0
|
|
20
|
-
*/
|
|
21
|
-
/*
|
|
22
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
23
|
-
SPDX-License-Identifier: Apache-2.0
|
|
24
|
-
*/
|
|
25
|
-
/*
|
|
26
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
27
|
-
SPDX-License-Identifier: Apache-2.0
|
|
28
|
-
*/
|
|
29
|
-
/*
|
|
30
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
31
|
-
SPDX-License-Identifier: Apache-2.0
|
|
32
|
-
*/
|
|
33
|
-
/*
|
|
34
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
35
|
-
SPDX-License-Identifier: Apache-2.0
|
|
36
|
-
*/
|
|
37
|
-
/*
|
|
38
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
39
|
-
SPDX-License-Identifier: Apache-2.0
|
|
40
|
-
*/
|
|
41
|
-
/*
|
|
42
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
43
|
-
SPDX-License-Identifier: Apache-2.0
|
|
44
|
-
*/
|
|
45
|
-
/*
|
|
46
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
47
|
-
SPDX-License-Identifier: Apache-2.0
|
|
48
|
-
*/
|
|
49
|
-
/*
|
|
50
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
51
|
-
SPDX-License-Identifier: Apache-2.0
|
|
52
|
-
*/
|
|
53
|
-
/*
|
|
54
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
55
|
-
SPDX-License-Identifier: Apache-2.0
|
|
56
|
-
*/
|
|
57
|
-
/*
|
|
58
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
59
|
-
SPDX-License-Identifier: Apache-2.0
|
|
60
|
-
*/
|
|
61
|
-
/*
|
|
62
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
63
|
-
SPDX-License-Identifier: Apache-2.0
|
|
64
|
-
*/
|
|
65
|
-
/*
|
|
66
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
67
|
-
SPDX-License-Identifier: Apache-2.0
|
|
68
|
-
*/
|
|
69
|
-
/*
|
|
70
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
71
|
-
SPDX-License-Identifier: Apache-2.0
|
|
72
|
-
*/
|
|
73
|
-
/*
|
|
74
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
75
|
-
SPDX-License-Identifier: Apache-2.0
|
|
76
|
-
*/
|
|
77
|
-
/*
|
|
78
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
79
|
-
SPDX-License-Identifier: Apache-2.0
|
|
80
|
-
*/
|
|
81
|
-
/*
|
|
82
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
83
|
-
SPDX-License-Identifier: Apache-2.0
|
|
84
|
-
*/
|
|
85
|
-
/*
|
|
86
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
87
|
-
SPDX-License-Identifier: Apache-2.0
|
|
88
|
-
*/
|
|
89
|
-
/*
|
|
90
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
91
|
-
SPDX-License-Identifier: Apache-2.0
|
|
92
|
-
*/
|
|
93
|
-
/*
|
|
94
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
95
|
-
SPDX-License-Identifier: Apache-2.0
|
|
96
|
-
*/
|
|
97
|
-
/*
|
|
98
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
99
|
-
SPDX-License-Identifier: Apache-2.0
|
|
100
|
-
*/
|
|
101
|
-
/*
|
|
102
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
103
|
-
SPDX-License-Identifier: Apache-2.0
|
|
104
|
-
*/
|
|
105
|
-
/*
|
|
106
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
107
|
-
SPDX-License-Identifier: Apache-2.0
|
|
108
|
-
*/
|
|
109
|
-
/*
|
|
110
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
111
|
-
SPDX-License-Identifier: Apache-2.0
|
|
112
|
-
*/
|
|
113
|
-
/* stylelint-disable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
|
|
114
|
-
/* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
|
|
115
|
-
/*
|
|
116
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
117
|
-
SPDX-License-Identifier: Apache-2.0
|
|
118
|
-
*/
|
|
119
|
-
/*
|
|
120
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
121
|
-
SPDX-License-Identifier: Apache-2.0
|
|
122
|
-
*/
|
|
123
|
-
/*
|
|
124
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
125
|
-
SPDX-License-Identifier: Apache-2.0
|
|
126
|
-
*/
|
|
127
|
-
/*
|
|
128
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
129
|
-
SPDX-License-Identifier: Apache-2.0
|
|
130
|
-
*/
|
|
131
|
-
/*
|
|
132
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
133
|
-
SPDX-License-Identifier: Apache-2.0
|
|
134
|
-
*/
|
|
135
|
-
/*
|
|
136
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
137
|
-
SPDX-License-Identifier: Apache-2.0
|
|
138
|
-
*/
|
|
139
|
-
/*
|
|
140
|
-
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
141
|
-
SPDX-License-Identifier: Apache-2.0
|
|
142
|
-
*/
|
|
143
|
-
/* Style used for links in slots/components that are text heavy, to help links stand out among
|
|
144
|
-
surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
|
|
145
|
-
.awsui_slider_cqzlk_vw9m6_145:not(#\9) {
|
|
146
|
-
padding-block: 0;
|
|
147
|
-
padding-inline: 0;
|
|
148
|
-
cursor: ns-resize;
|
|
149
|
-
margin-block-start: 2px;
|
|
150
|
-
margin-block-end: 0;
|
|
151
|
-
margin-inline: 0;
|
|
152
|
-
block-size: 16px;
|
|
153
|
-
touch-action: none;
|
|
154
|
-
}
|
|
155
|
-
.awsui_slider_cqzlk_vw9m6_145:not(#\9):focus {
|
|
156
|
-
outline: none;
|
|
157
|
-
}
|
|
158
|
-
body[data-awsui-focus-visible=true] .awsui_slider_cqzlk_vw9m6_145:not(#\9):focus {
|
|
159
|
-
position: relative;
|
|
160
|
-
}
|
|
161
|
-
body[data-awsui-focus-visible=true] .awsui_slider_cqzlk_vw9m6_145:not(#\9):focus {
|
|
162
|
-
outline: 2px dotted transparent;
|
|
163
|
-
outline-offset: calc(0px - 1px);
|
|
164
|
-
}
|
|
165
|
-
body[data-awsui-focus-visible=true] .awsui_slider_cqzlk_vw9m6_145:not(#\9):focus::before {
|
|
166
|
-
content: " ";
|
|
167
|
-
display: block;
|
|
168
|
-
position: absolute;
|
|
169
|
-
inset-inline-start: calc(-1 * 0px);
|
|
170
|
-
inset-block-start: calc(-1 * 0px);
|
|
171
|
-
inline-size: calc(100% + 0px + 0px);
|
|
172
|
-
block-size: calc(100% + 0px + 0px);
|
|
173
|
-
border-start-start-radius: var(--border-radius-control-default-focus-ring-vy2hlh, 2px);
|
|
174
|
-
border-start-end-radius: var(--border-radius-control-default-focus-ring-vy2hlh, 2px);
|
|
175
|
-
border-end-start-radius: var(--border-radius-control-default-focus-ring-vy2hlh, 2px);
|
|
176
|
-
border-end-end-radius: var(--border-radius-control-default-focus-ring-vy2hlh, 2px);
|
|
177
|
-
box-shadow: 0 0 0 2px var(--color-border-item-focused-q68bgg, #0073bb);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.awsui_slider-side_cqzlk_vw9m6_180:not(#\9) {
|
|
181
|
-
cursor: ew-resize;
|
|
182
|
-
margin-block: 0;
|
|
5
|
+
.awsui_handle-wrapper-side_cqzlk_1qkms_5:not(#\9) {
|
|
183
6
|
margin-inline-start: 2px;
|
|
184
|
-
margin-inline-end: 0;
|
|
185
7
|
}
|
|
186
8
|
|
|
187
|
-
.
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
.awsui_slider-icon_cqzlk_vw9m6_187:not(#\9):hover {
|
|
191
|
-
stroke: var(--color-text-interactive-hover-kxltdh, #16191f);
|
|
192
|
-
}
|
|
193
|
-
.awsui_slider-icon-bottom_cqzlk_vw9m6_193:not(#\9) {
|
|
194
|
-
margin-block: auto;
|
|
195
|
-
margin-inline: auto;
|
|
196
|
-
}
|
|
197
|
-
.awsui_slider-icon-side_cqzlk_vw9m6_197:not(#\9) {
|
|
198
|
-
transform: rotate(90deg);
|
|
9
|
+
.awsui_handle-wrapper-bottom_cqzlk_1qkms_9:not(#\9) {
|
|
10
|
+
margin-block-start: 2px;
|
|
199
11
|
}
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"slider-icon": "awsui_slider-icon_cqzlk_vw9m6_187",
|
|
8
|
-
"slider-icon-bottom": "awsui_slider-icon-bottom_cqzlk_vw9m6_193",
|
|
9
|
-
"slider-icon-side": "awsui_slider-icon-side_cqzlk_vw9m6_197"
|
|
5
|
+
"handle-wrapper-side": "awsui_handle-wrapper-side_cqzlk_1qkms_5",
|
|
6
|
+
"handle-wrapper-bottom": "awsui_handle-wrapper-bottom_cqzlk_1qkms_9"
|
|
10
7
|
};
|
|
11
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/portal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAOzD,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1C,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,CAAC;IACnD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AA+BD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/portal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAOzD,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1C,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,CAAC;IACnD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AA+BD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,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outEffect, useState } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { isDevelopment } from '../../is-development';\n\nexport interface PortalProps {\n container?: null | Element;\n getContainer?: () => Promise<HTMLElement>;\n removeContainer?: (container: HTMLElement) => void;\n children: React.ReactNode;\n}\n\nfunction manageDefaultContainer(setState: React.Dispatch<React.SetStateAction<Element | null>>) {\n const newContainer = document.createElement('div');\n document.body.appendChild(newContainer);\n setState(newContainer);\n return () => {\n document.body.removeChild(newContainer);\n };\n}\n\nfunction manageAsyncContainer(\n getContainer: () => Promise<HTMLElement>,\n removeContainer: (container: HTMLElement) => void,\n setState: React.Dispatch<React.SetStateAction<Element | null>>\n) {\n let newContainer: HTMLElement;\n getContainer().then(\n container => {\n newContainer = container;\n setState(container);\n },\n error => {\n console.warn('[AwsUi] [portal]: failed to load portal root', error);\n }\n );\n return () => {\n removeContainer(newContainer);\n };\n}\n\n/**\n * A safe react portal component that renders to a provided node.\n * If a node isn't provided, it creates one under document.body.\n */\nexport default function Portal({ container, getContainer, removeContainer, children }: PortalProps) {\n const [activeContainer, setActiveContainer] = useState<Element | null>(container ?? null);\n\n useLayoutEffect(() => {\n if (container) {\n setActiveContainer(container);\n return;\n }\n if (isDevelopment) {\n if (getContainer && !removeContainer) {\n warnOnce('portal', '`removeContainer` is required when `getContainer` is provided');\n }\n if (!getContainer && removeContainer) {\n warnOnce('portal', '`getContainer` is required when `removeContainer` is provided');\n }\n }\n if (getContainer && removeContainer) {\n return manageAsyncContainer(getContainer, removeContainer, setActiveContainer);\n }\n return manageDefaultContainer(setActiveContainer);\n }, [container, getContainer, removeContainer]);\n\n return activeContainer && createPortal(children, activeContainer);\n}\n"]}
|
|
@@ -26,7 +26,7 @@ export interface BaseNavigationDetail {
|
|
|
26
26
|
export declare function createCustomEvent<T>({ cancelable, detail }: CustomEventInit<T>): CustomEvent<T>;
|
|
27
27
|
export declare function fireNonCancelableEvent<T = null>(handler: NonCancelableEventHandler<T> | undefined, detail?: T): void;
|
|
28
28
|
export declare function fireCancelableEvent<T>(handler: CancelableEventHandler<T> | undefined, detail: T, sourceEvent?: React.SyntheticEvent | Event): boolean;
|
|
29
|
-
export declare function fireKeyboardEvent(handler: CancelableEventHandler<BaseKeyDetail
|
|
29
|
+
export declare function fireKeyboardEvent(handler: CancelableEventHandler<BaseKeyDetail> | undefined, reactEvent: React.KeyboardEvent): boolean;
|
|
30
30
|
export declare function hasModifierKeys(event: React.MouseEvent | React.KeyboardEvent): boolean;
|
|
31
31
|
export declare function isPlainLeftClick(event: React.MouseEvent | React.KeyboardEvent): boolean;
|
|
32
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/internal/events/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,yBAAyB,CAAC,MAAM,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,wBAAwB,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;AAEvG,MAAM,MAAM,sBAAsB,CAAC,MAAM,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;AAEvF,MAAM,MAAM,wBAAwB,CAAC,UAAU,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,gBAAgB,CAAC,CAAC;AAmBnG,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,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AAK,CAAC,gBAAgB,IAAI,WAAW,EAAE;QACzC,WAAW,CAAC,cAAc,EAAE,CAAC;KAC9B;IACD,IAAI,KAAK,CAAC,YAAY,IAAI,WAAW,EAAE;QACrC,WAAW,CAAC,eAAe,EAAE,CAAC;KAC/B;IACD,OAAO,KAAK,CAAC,gBAAgB,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,OAA0D,EAC1D,UAA+B;IAE/B,OAAO,mBAAmB,CACxB,OAAO,EACP;QACE,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,GAAG,EAAE,UAAU,CAAC,GAAG;QACnB,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC,WAAW;KAChD,EACD,UAAU,CACX,CAAC;AACJ,CAAC;AAED,MAAM,YAAY,GAAG,CAAC,CAAyC,EAAyB,EAAE;IACxF,OAAQ,CAAsB,CAAC,MAAM,KAAK,SAAS,CAAC;AACtD,CAAC,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,KAA6C;IAC3E,OAAO,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAA6C;IAC5E,OAAO,KAAK,IAAI,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\n// This is a part of our public types API. We cannot change this in the current major version\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type NonCancelableEventHandler<Detail = {}> = (event: NonCancelableCustomEvent<Detail>) => void;\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type CancelableEventHandler<Detail = {}> = (event: CustomEvent<Detail>) => void;\n\nexport type NonCancelableCustomEvent<DetailType> = Omit<CustomEvent<DetailType>, 'preventDefault'>;\n\nclass CustomEventStub<T> {\n defaultPrevented = false;\n cancelBubble = false;\n constructor(\n public cancelable: boolean = false,\n public detail: T | null = null\n ) {}\n\n preventDefault() {\n this.defaultPrevented = true;\n }\n\n stopPropagation() {\n this.cancelBubble = true;\n }\n}\n\nexport interface BaseKeyDetail {\n keyCode: number;\n key: string;\n ctrlKey: boolean;\n shiftKey: boolean;\n altKey: boolean;\n metaKey: boolean;\n isComposing: boolean;\n}\n\nexport interface ClickDetail {\n button: number;\n ctrlKey: boolean;\n shiftKey: boolean;\n altKey: boolean;\n metaKey: boolean;\n}\n\nexport interface BaseNavigationDetail {\n href: string | undefined;\n external?: boolean;\n target?: string;\n}\n\nexport function createCustomEvent<T>({ cancelable, detail }: CustomEventInit<T>): CustomEvent<T> {\n return new CustomEventStub(cancelable, detail) as CustomEvent;\n}\n\nexport function fireNonCancelableEvent<T = null>(handler: NonCancelableEventHandler<T> | undefined, detail?: T) {\n if (!handler) {\n return;\n }\n const event = createCustomEvent({ cancelable: false, detail });\n handler(event);\n}\n\nexport function fireCancelableEvent<T>(\n handler: CancelableEventHandler<T> | undefined,\n detail: T,\n sourceEvent?: React.SyntheticEvent | Event\n) {\n if (!handler) {\n return false;\n }\n const event = createCustomEvent({ cancelable: true, detail });\n handler(event);\n if (event.defaultPrevented && sourceEvent) {\n sourceEvent.preventDefault();\n }\n if (event.cancelBubble && sourceEvent) {\n sourceEvent.stopPropagation();\n }\n return event.defaultPrevented;\n}\n\nexport function fireKeyboardEvent(\n handler: CancelableEventHandler<BaseKeyDetail> | undefined,\n reactEvent: React.KeyboardEvent\n) {\n return fireCancelableEvent(\n handler,\n {\n keyCode: reactEvent.keyCode,\n key: reactEvent.key,\n ctrlKey: reactEvent.ctrlKey,\n shiftKey: reactEvent.shiftKey,\n altKey: reactEvent.altKey,\n metaKey: reactEvent.metaKey,\n isComposing: reactEvent.nativeEvent.isComposing,\n },\n reactEvent\n );\n}\n\nconst isMouseEvent = (e: React.MouseEvent | React.KeyboardEvent): e is React.MouseEvent => {\n return (e as React.MouseEvent).button !== undefined;\n};\n\nexport function hasModifierKeys(event: React.MouseEvent | React.KeyboardEvent) {\n return event.ctrlKey || event.altKey || event.shiftKey || event.metaKey;\n}\n\nexport function isPlainLeftClick(event: React.MouseEvent | React.KeyboardEvent) {\n return event && (!isMouseEvent(event) || event.button === 0) && !hasModifierKeys(event);\n}\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* element as the `elementRef`, so that the data attribute is applied
|
|
5
5
|
* correctly.
|
|
6
6
|
*/
|
|
7
|
-
export declare function usePerformanceMarks(name: string, enabled: boolean, elementRef: React.RefObject<HTMLElement>, getDetails: () => Record<string, string | boolean | number | undefined>, dependencies: React.DependencyList): {
|
|
7
|
+
export declare function usePerformanceMarks(name: string, enabled: () => boolean, elementRef: React.RefObject<HTMLElement>, getDetails: () => Record<string, string | boolean | number | undefined>, dependencies: React.DependencyList): {
|
|
8
8
|
[x: string]: string | undefined;
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-performance-marks/index.ts"],"names":[],"mappings":";AAoCA;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-performance-marks/index.ts"],"names":[],"mappings":";AAoCA;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,OAAO,EACtB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,EACxC,UAAU,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,EACvE,YAAY,EAAE,KAAK,CAAC,cAAc;;EAsDnC"}
|
|
@@ -36,7 +36,7 @@ export function usePerformanceMarks(name, enabled, elementRef, getDetails, depen
|
|
|
36
36
|
const attributes = useDOMAttribute(elementRef, 'data-analytics-performance-mark', id);
|
|
37
37
|
const evaluateComponentVisibility = useEvaluateComponentVisibility();
|
|
38
38
|
useEffect(() => {
|
|
39
|
-
if (!enabled || !elementRef.current || isInModal) {
|
|
39
|
+
if (!enabled() || !elementRef.current || isInModal) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
const elementVisible = elementRef.current.offsetWidth > 0 &&
|
|
@@ -52,7 +52,7 @@ export function usePerformanceMarks(name, enabled, elementRef, getDetails, depen
|
|
|
52
52
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
53
|
}, []);
|
|
54
54
|
useEffectOnUpdate(() => {
|
|
55
|
-
if (!enabled || !elementRef.current || isInModal) {
|
|
55
|
+
if (!enabled() || !elementRef.current || isInModal) {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
const elementVisible = elementRef.current.offsetWidth > 0 &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-performance-marks/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAy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IAAI,CAAC,gBAAgB,EAAE;YACjC,MAAM,kBACJ,MAAM,EAAE,OAAO,EACf,kBAAkB,EAAE,EAAE,IACnB,UAAU,EAAE,CAChB;SACF,CAAC,CAAC;QACH,uDAAuD;IACzD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,iBAAiB,CAAC,GAAG,EAAE;QACrB,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,SAAS,EAAE;YAClD,OAAO;SACR;QACD,MAAM,cAAc,GAClB,UAAU,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC;YAClC,UAAU,CAAC,OAAO,CAAC,YAAY,GAAG,CAAC;YACnC,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC;QAE/D,IAAI,CAAC,cAAc,EAAE;YACnB,OAAO;SACR;QACD,MAAM,eAAe,GAAG,GAAG,IAAI,SAAS,CAAC;QACzC,WAAW,CAAC,IAAI,CAAC,eAAe,EAAE;YAChC,MAAM,kBACJ,MAAM,EAAE,OAAO,EACf,kBAAkB,EAAE,EAAE,IACnB,UAAU,EAAE,CAChB;SACF,CAAC,CAAC;QACH,uDAAuD;IACzD,CAAC,EAAE,CAAC,2BAA2B,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;IAEnD,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useEffect, useState } from 'react';\n\nimport { useModalContext } from '../../context/modal-context';\nimport { useDOMAttribute } from '../use-dom-attribute';\nimport { useEffectOnUpdate } from '../use-effect-on-update';\nimport { useRandomId } from '../use-unique-id';\n\nconst EVALUATE_COMPONENT_VISIBILITY_EVENT = 'awsui-evaluate-component-visibility';\n\n/**\n * This hook manages a boolean state (`evaluateComponentVisibility`) that toggles\n * whenever a custom DOM event (`EVALUATE_COMPONENT_VISIBILITY_EVENT`) is triggered.\n *\n * @returns\n */\nconst useEvaluateComponentVisibility = () => {\n const [evaluateComponentVisibility, setEvaluateComponentVisibility] = useState(false);\n\n useEffect(() => {\n const handleEvaluateComponentVisibility = () => {\n setEvaluateComponentVisibility(prev => !prev);\n };\n\n document.addEventListener(EVALUATE_COMPONENT_VISIBILITY_EVENT, handleEvaluateComponentVisibility);\n\n return () => {\n document.removeEventListener(EVALUATE_COMPONENT_VISIBILITY_EVENT, handleEvaluateComponentVisibility);\n };\n }, []);\n\n return evaluateComponentVisibility;\n};\n\n/**\n * This function returns an object that needs to be spread onto the same\n * element as the `elementRef`, so that the data attribute is applied\n * correctly.\n */\nexport function usePerformanceMarks(\n name: string,\n enabled: () => boolean,\n elementRef: React.RefObject<HTMLElement>,\n getDetails: () => Record<string, string | boolean | number | undefined>,\n dependencies: React.DependencyList\n) {\n const id = useRandomId();\n const { isInModal } = useModalContext();\n const attributes = useDOMAttribute(elementRef, 'data-analytics-performance-mark', id);\n const evaluateComponentVisibility = useEvaluateComponentVisibility();\n useEffect(() => {\n if (!enabled() || !elementRef.current || isInModal) {\n return;\n }\n const elementVisible =\n elementRef.current.offsetWidth > 0 &&\n elementRef.current.offsetHeight > 0 &&\n getComputedStyle(elementRef.current).visibility !== 'hidden';\n\n if (!elementVisible) {\n return;\n }\n\n const renderedMarkName = `${name}Rendered`;\n performance.mark(renderedMarkName, {\n detail: {\n source: 'awsui',\n instanceIdentifier: id,\n ...getDetails(),\n },\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffectOnUpdate(() => {\n if (!enabled() || !elementRef.current || isInModal) {\n return;\n }\n const elementVisible =\n elementRef.current.offsetWidth > 0 &&\n elementRef.current.offsetHeight > 0 &&\n getComputedStyle(elementRef.current).visibility !== 'hidden';\n\n if (!elementVisible) {\n return;\n }\n const updatedMarkName = `${name}Updated`;\n performance.mark(updatedMarkName, {\n detail: {\n source: 'awsui',\n instanceIdentifier: id,\n ...getDetails(),\n },\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [evaluateComponentVisibility, ...dependencies]);\n\n return attributes;\n}\n"]}
|
|
@@ -90,9 +90,10 @@ function InternalPopover(_a, ref) {
|
|
|
90
90
|
};
|
|
91
91
|
const { tabIndex: triggerTabIndex } = useSingleTabStopNavigation(triggerRef);
|
|
92
92
|
const referrerId = useUniqueId();
|
|
93
|
-
const popoverContent = (React.createElement("div", { "aria-live": dismissButton ? undefined : 'polite', "aria-atomic": dismissButton ? undefined : true, className: clsx(popoverClasses, !renderWithPortal && styles['popover-inline-content']), "data-awsui-referrer-id": referrerId },
|
|
94
|
-
React.createElement(
|
|
95
|
-
React.createElement(
|
|
93
|
+
const popoverContent = (React.createElement("div", { "aria-live": dismissButton ? undefined : 'polite', "aria-atomic": dismissButton ? undefined : true, className: clsx(popoverClasses, !renderWithPortal && styles['popover-inline-content']), "data-awsui-referrer-id": referrerId },
|
|
94
|
+
React.createElement(PopoverContainer, { size: size, fixedWidth: fixedWidth, position: position, trackRef: triggerRef, arrow: position => React.createElement(Arrow, { position: position }), renderWithPortal: renderWithPortal, zIndex: renderWithPortal ? 7000 : undefined },
|
|
95
|
+
React.createElement(LinkDefaultVariantContext.Provider, { value: { defaultVariant: 'primary' } },
|
|
96
|
+
React.createElement(PopoverBody, { dismissButton: dismissButton, dismissAriaLabel: dismissAriaLabel, header: header, onDismiss: onDismiss, overflowVisible: "both", closeAnalyticsAction: __closeAnalyticsAction }, content)))));
|
|
96
97
|
const mergedRef = useMergeRefs(popoverRef, __internalRootRef);
|
|
97
98
|
return (React.createElement("span", Object.assign({}, baseProps, { className: clsx(styles.root, baseProps.className, triggerType === 'filtering-token' && styles['root-filtering-token'], isInline && styles['no-wrap']), ref: mergedRef, onMouseDown: () => {
|
|
98
99
|
// Indicate there was a click inside popover recently, including nested portals.
|
|
@@ -101,6 +102,6 @@ function InternalPopover(_a, ref) {
|
|
|
101
102
|
});
|
|
102
103
|
} }),
|
|
103
104
|
triggerType === 'text' ? (React.createElement("button", Object.assign({}, triggerProps, { className: clsx(triggerProps.className, wrapTriggerText === false && styles['overflow-ellipsis']), tabIndex: triggerTabIndex, type: "button", "aria-haspopup": "dialog", id: referrerId, "aria-label": triggerAriaLabel }), children)) : (React.createElement("span", Object.assign({}, triggerProps, { id: referrerId }), children)),
|
|
104
|
-
React.createElement(ResetContextsForModal, null, renderWithPortal ? React.createElement(Portal, null, popoverContent) : popoverContent)));
|
|
105
|
+
visible && (React.createElement(ResetContextsForModal, null, renderWithPortal ? React.createElement(Portal, null, popoverContent) : popoverContent))));
|
|
105
106
|
}
|
|
106
107
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/popover/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,qBAAqB,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAA6B,MAAM,0BAA0B,CAAC;AAE7F,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D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U,gBACF,gBAAgB,KAE3B,QAAQ,CACF,CACV,CAAC,CAAC,CAAC,CACF,8CAAU,YAAY,IAAE,EAAE,EAAE,UAAU,KACnC,QAAQ,CACJ,CACR;QACD,oBAAC,qBAAqB,QACnB,gBAAgB,CAAC,CAAC,CAAC,oBAAC,MAAM,QAAE,cAAc,CAAU,CAAC,CAAC,CAAC,cAAc,CAChD,CACnB,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, useImperativeHandle, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { getFirstFocusable } from '../internal/components/focus-lock/utils';\nimport Portal from '../internal/components/portal';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } 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 { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { KeyCode } from '../internal/keycode';\nimport Arrow from './arrow';\nimport PopoverBody from './body';\nimport PopoverContainer from './container';\nimport { PopoverProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport interface InternalPopoverProps extends Omit<PopoverProps, 'triggerType' | 'size'>, InternalBaseComponentProps {\n __onOpen?: NonCancelableEventHandler<null>;\n triggerType?: PopoverProps.TriggerType | 'filtering-token';\n size: PopoverProps.Size | 'content';\n __closeAnalyticsAction?: string;\n isInline?: boolean;\n}\n\nexport interface InternalPopoverRef {\n dismissPopover: () => void;\n focus: HTMLElement['focus'];\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 wrapTriggerText = true,\n isInline = false,\n renderWithPortal = false,\n\n __onOpen,\n __internalRootRef = null,\n __closeAnalyticsAction,\n\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(\n (event: React.KeyboardEvent) => {\n const isEscapeKey = event.keyCode === KeyCode.escape;\n const isTabKey = event.keyCode === KeyCode.tab;\n if (isEscapeKey && visible) {\n event.stopPropagation();\n }\n if (isTabKey || isEscapeKey) {\n setVisible(false);\n }\n },\n [visible]\n );\n\n useImperativeHandle(ref, () => ({\n dismissPopover: onDismiss,\n focus: () => {\n setVisible(false);\n focusTrigger();\n },\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 document.addEventListener('mousedown', onDocumentClick);\n\n return () => {\n document.removeEventListener('mousedown', onDocumentClick);\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 const { tabIndex: triggerTabIndex } = useSingleTabStopNavigation(triggerRef);\n\n const referrerId = useUniqueId();\n\n const popoverContent = (\n <div\n aria-live={dismissButton ? undefined : 'polite'}\n aria-atomic={dismissButton ? undefined : true}\n className={clsx(popoverClasses, !renderWithPortal && styles['popover-inline-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 closeAnalyticsAction={__closeAnalyticsAction}\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(\n styles.root,\n baseProps.className,\n triggerType === 'filtering-token' && styles['root-filtering-token'],\n isInline && styles['no-wrap']\n )}\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\n {...triggerProps}\n className={clsx(triggerProps.className, wrapTriggerText === false && styles['overflow-ellipsis'])}\n tabIndex={triggerTabIndex}\n type=\"button\"\n aria-haspopup=\"dialog\"\n id={referrerId}\n aria-label={triggerAriaLabel}\n >\n {children}\n </button>\n ) : (\n <span {...triggerProps} id={referrerId}>\n {children}\n </span>\n )}\n <ResetContextsForModal>\n {renderWithPortal ? <Portal>{popoverContent}</Portal> : popoverContent}\n </ResetContextsForModal>\n </span>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/popover/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,qBAAqB,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAA6B,MAAM,0BAA0B,CAAC;AAE7F,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,WAAW,MAAM,QAAQ,CAAC;AACjC,OAAO,gBAAgB,MAAM,aAAa,CAAC;AAG3C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAerC,eAAe,KAAK,CAAC,UAAU,C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D,CACzB,CACI,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, useImperativeHandle, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { getFirstFocusable } from '../internal/components/focus-lock/utils';\nimport Portal from '../internal/components/portal';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } 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 { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { KeyCode } from '../internal/keycode';\nimport Arrow from './arrow';\nimport PopoverBody from './body';\nimport PopoverContainer from './container';\nimport { PopoverProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport interface InternalPopoverProps extends Omit<PopoverProps, 'triggerType' | 'size'>, InternalBaseComponentProps {\n __onOpen?: NonCancelableEventHandler<null>;\n triggerType?: PopoverProps.TriggerType | 'filtering-token';\n size: PopoverProps.Size | 'content';\n __closeAnalyticsAction?: string;\n isInline?: boolean;\n}\n\nexport interface InternalPopoverRef {\n dismissPopover: () => void;\n focus: HTMLElement['focus'];\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 wrapTriggerText = true,\n isInline = false,\n renderWithPortal = false,\n\n __onOpen,\n __internalRootRef = null,\n __closeAnalyticsAction,\n\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(\n (event: React.KeyboardEvent) => {\n const isEscapeKey = event.keyCode === KeyCode.escape;\n const isTabKey = event.keyCode === KeyCode.tab;\n if (isEscapeKey && visible) {\n event.stopPropagation();\n }\n if (isTabKey || isEscapeKey) {\n setVisible(false);\n }\n },\n [visible]\n );\n\n useImperativeHandle(ref, () => ({\n dismissPopover: onDismiss,\n focus: () => {\n setVisible(false);\n focusTrigger();\n },\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 document.addEventListener('mousedown', onDocumentClick);\n\n return () => {\n document.removeEventListener('mousedown', onDocumentClick);\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 const { tabIndex: triggerTabIndex } = useSingleTabStopNavigation(triggerRef);\n\n const referrerId = useUniqueId();\n\n const popoverContent = (\n <div\n aria-live={dismissButton ? undefined : 'polite'}\n aria-atomic={dismissButton ? undefined : true}\n className={clsx(popoverClasses, !renderWithPortal && styles['popover-inline-content'])}\n data-awsui-referrer-id={referrerId}\n >\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 closeAnalyticsAction={__closeAnalyticsAction}\n >\n {content}\n </PopoverBody>\n </LinkDefaultVariantContext.Provider>\n </PopoverContainer>\n </div>\n );\n\n const mergedRef = useMergeRefs(popoverRef, __internalRootRef);\n\n return (\n <span\n {...baseProps}\n className={clsx(\n styles.root,\n baseProps.className,\n triggerType === 'filtering-token' && styles['root-filtering-token'],\n isInline && styles['no-wrap']\n )}\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\n {...triggerProps}\n className={clsx(triggerProps.className, wrapTriggerText === false && styles['overflow-ellipsis'])}\n tabIndex={triggerTabIndex}\n type=\"button\"\n aria-haspopup=\"dialog\"\n id={referrerId}\n aria-label={triggerAriaLabel}\n >\n {children}\n </button>\n ) : (\n <span {...triggerProps} id={referrerId}>\n {children}\n </span>\n )}\n {visible && (\n <ResetContextsForModal>\n {renderWithPortal ? <Portal>{popoverContent}</Portal> : popoverContent}\n </ResetContextsForModal>\n )}\n </span>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAWxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,UAAU,wBAAyB,SAAQ,gBAAgB,EAAE,0BAA0B;CAAG;AAE1F,QAAA,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAWxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,UAAU,wBAAyB,SAAQ,gBAAgB,EAAE,0BAA0B;CAAG;AAE1F,QAAA,MAAM,mBAAmB,uGAsMxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -33,9 +33,7 @@ const InternalPromptInput = React.forwardRef((_a, ref) => {
|
|
|
33
33
|
},
|
|
34
34
|
}), [textareaRef]);
|
|
35
35
|
const handleKeyDown = (event) => {
|
|
36
|
-
|
|
37
|
-
fireKeyboardEvent(onKeyDown, event);
|
|
38
|
-
}
|
|
36
|
+
fireKeyboardEvent(onKeyDown, event);
|
|
39
37
|
if (event.key === 'Enter' && !event.shiftKey) {
|
|
40
38
|
if ('form' in event.target && event.target.form !== null && !event.isDefaultPrevented()) {
|
|
41
39
|
event.target.form.requestSubmit();
|