@cloudscape-design/components 3.0.698 → 3.0.700
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/button-dropdown/styles.css.js +16 -18
- package/button-dropdown/styles.scoped.css +24 -27
- package/button-dropdown/styles.selectors.js +16 -18
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/split-panel/implementation.d.ts.map +1 -1
- package/split-panel/implementation.js +13 -15
- package/split-panel/implementation.js.map +1 -1
- package/split-panel/index.d.ts +1 -1
- package/split-panel/index.d.ts.map +1 -1
- package/split-panel/index.js +4 -2
- package/split-panel/index.js.map +1 -1
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"button-dropdown": "awsui_button-
|
|
5
|
-
"items-list-container": "awsui_items-list-
|
|
6
|
-
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-
|
|
7
|
-
"rotate-up": "awsui_rotate-
|
|
8
|
-
"rotate-down": "awsui_rotate-
|
|
9
|
-
"header": "
|
|
10
|
-
"title": "
|
|
11
|
-
"description": "
|
|
12
|
-
"split-trigger-wrapper": "awsui_split-trigger-
|
|
13
|
-
"trigger-item": "awsui_trigger-
|
|
14
|
-
"trigger-button": "awsui_trigger-
|
|
15
|
-
"visual-refresh": "awsui_visual-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"dropdown-trigger": "awsui_dropdown-trigger_sne0l_15vbp_200",
|
|
21
|
-
"test-utils-button-trigger": "awsui_test-utils-button-trigger_sne0l_15vbp_204"
|
|
4
|
+
"button-dropdown": "awsui_button-dropdown_sne0l_1175t_97",
|
|
5
|
+
"items-list-container": "awsui_items-list-container_sne0l_1175t_101",
|
|
6
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_sne0l_1175t_1",
|
|
7
|
+
"rotate-up": "awsui_rotate-up_sne0l_1175t_120",
|
|
8
|
+
"rotate-down": "awsui_rotate-down_sne0l_1175t_135",
|
|
9
|
+
"header": "awsui_header_sne0l_1175t_150",
|
|
10
|
+
"title": "awsui_title_sne0l_1175t_161",
|
|
11
|
+
"description": "awsui_description_sne0l_1175t_162",
|
|
12
|
+
"split-trigger-wrapper": "awsui_split-trigger-wrapper_sne0l_1175t_166",
|
|
13
|
+
"trigger-item": "awsui_trigger-item_sne0l_1175t_169",
|
|
14
|
+
"trigger-button": "awsui_trigger-button_sne0l_1175t_169",
|
|
15
|
+
"visual-refresh": "awsui_visual-refresh_sne0l_1175t_183",
|
|
16
|
+
"variant-normal": "awsui_variant-normal_sne0l_1175t_186",
|
|
17
|
+
"split-trigger": "awsui_split-trigger_sne0l_1175t_166",
|
|
18
|
+
"dropdown-trigger": "awsui_dropdown-trigger_sne0l_1175t_197",
|
|
19
|
+
"test-utils-button-trigger": "awsui_test-utils-button-trigger_sne0l_1175t_201"
|
|
22
20
|
};
|
|
23
21
|
|
|
@@ -94,60 +94,60 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
94
94
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
95
95
|
SPDX-License-Identifier: Apache-2.0
|
|
96
96
|
*/
|
|
97
|
-
.awsui_button-
|
|
97
|
+
.awsui_button-dropdown_sne0l_1175t_97:not(#\9) {
|
|
98
98
|
display: inline-block;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
.awsui_items-list-
|
|
101
|
+
.awsui_items-list-container_sne0l_1175t_101:not(#\9) {
|
|
102
102
|
padding-block: 0;
|
|
103
103
|
padding-inline: 0;
|
|
104
104
|
margin-block: 0;
|
|
105
105
|
margin-inline: 0;
|
|
106
|
-
animation: awsui_awsui-motion-fade-in-
|
|
106
|
+
animation: awsui_awsui-motion-fade-in-0_sne0l_1175t_1 500ms var(--motion-easing-show-quick-vc5zgd, ease-out);
|
|
107
107
|
animation-fill-mode: none;
|
|
108
108
|
}
|
|
109
109
|
@media (prefers-reduced-motion: reduce) {
|
|
110
|
-
.awsui_items-list-
|
|
110
|
+
.awsui_items-list-container_sne0l_1175t_101:not(#\9) {
|
|
111
111
|
animation: none;
|
|
112
112
|
transition: none;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
.awsui-motion-disabled .awsui_items-list-
|
|
115
|
+
.awsui-motion-disabled .awsui_items-list-container_sne0l_1175t_101:not(#\9), .awsui-mode-entering .awsui_items-list-container_sne0l_1175t_101:not(#\9) {
|
|
116
116
|
animation: none;
|
|
117
117
|
transition: none;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
.awsui_rotate-
|
|
120
|
+
.awsui_rotate-up_sne0l_1175t_120:not(#\9) {
|
|
121
121
|
transform: rotate(-180deg);
|
|
122
122
|
transition: transform var(--motion-duration-rotate-180-dpvl4m, 135ms) var(--motion-easing-rotate-180-e270ko, cubic-bezier(0.165, 0.84, 0.44, 1));
|
|
123
123
|
}
|
|
124
124
|
@media (prefers-reduced-motion: reduce) {
|
|
125
|
-
.awsui_rotate-
|
|
125
|
+
.awsui_rotate-up_sne0l_1175t_120:not(#\9) {
|
|
126
126
|
animation: none;
|
|
127
127
|
transition: none;
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
.awsui-motion-disabled .awsui_rotate-
|
|
130
|
+
.awsui-motion-disabled .awsui_rotate-up_sne0l_1175t_120:not(#\9), .awsui-mode-entering .awsui_rotate-up_sne0l_1175t_120:not(#\9) {
|
|
131
131
|
animation: none;
|
|
132
132
|
transition: none;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
.awsui_rotate-
|
|
135
|
+
.awsui_rotate-down_sne0l_1175t_135:not(#\9) {
|
|
136
136
|
transform: rotate(0deg);
|
|
137
137
|
transition: transform var(--motion-duration-rotate-180-dpvl4m, 135ms) var(--motion-easing-rotate-180-e270ko, cubic-bezier(0.165, 0.84, 0.44, 1));
|
|
138
138
|
}
|
|
139
139
|
@media (prefers-reduced-motion: reduce) {
|
|
140
|
-
.awsui_rotate-
|
|
140
|
+
.awsui_rotate-down_sne0l_1175t_135:not(#\9) {
|
|
141
141
|
animation: none;
|
|
142
142
|
transition: none;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
.awsui-motion-disabled .awsui_rotate-
|
|
145
|
+
.awsui-motion-disabled .awsui_rotate-down_sne0l_1175t_135:not(#\9), .awsui-mode-entering .awsui_rotate-down_sne0l_1175t_135:not(#\9) {
|
|
146
146
|
animation: none;
|
|
147
147
|
transition: none;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
.
|
|
150
|
+
.awsui_header_sne0l_1175t_150:not(#\9) {
|
|
151
151
|
display: flex;
|
|
152
152
|
flex-direction: column;
|
|
153
153
|
list-style: none;
|
|
@@ -158,49 +158,46 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
158
158
|
border-inline: var(--border-field-width-09w7vk, 2px) solid transparent;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
.
|
|
162
|
-
.
|
|
161
|
+
.awsui_title_sne0l_1175t_161:not(#\9),
|
|
162
|
+
.awsui_description_sne0l_1175t_162:not(#\9) {
|
|
163
163
|
color: var(--color-text-top-navigation-title-v7rgbf, #000716);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
.awsui_split-trigger-
|
|
166
|
+
.awsui_split-trigger-wrapper_sne0l_1175t_166:not(#\9) {
|
|
167
167
|
display: flex;
|
|
168
168
|
}
|
|
169
|
-
.awsui_split-trigger-
|
|
169
|
+
.awsui_split-trigger-wrapper_sne0l_1175t_166 > .awsui_trigger-item_sne0l_1175t_169 > .awsui_trigger-button_sne0l_1175t_169:not(#\9):focus, .awsui_split-trigger-wrapper_sne0l_1175t_166 > .awsui_trigger-item_sne0l_1175t_169 > .awsui_trigger-button_sne0l_1175t_169:not(#\9):hover {
|
|
170
170
|
z-index: 1;
|
|
171
171
|
}
|
|
172
|
-
.awsui_split-trigger-
|
|
172
|
+
.awsui_split-trigger-wrapper_sne0l_1175t_166 > .awsui_trigger-item_sne0l_1175t_169:not(#\9):not(:last-child) > .awsui_trigger-button_sne0l_1175t_169 {
|
|
173
173
|
border-start-end-radius: 0;
|
|
174
174
|
border-end-end-radius: 0;
|
|
175
175
|
padding-inline-end: var(--space-m-udix3p, 16px);
|
|
176
176
|
margin-inline-end: var(--space-xxxs-zbmxqb, 2px);
|
|
177
177
|
}
|
|
178
|
-
.awsui_split-trigger-
|
|
178
|
+
.awsui_split-trigger-wrapper_sne0l_1175t_166 > .awsui_trigger-item_sne0l_1175t_169:not(#\9):not(:first-child) > .awsui_trigger-button_sne0l_1175t_169 {
|
|
179
179
|
border-start-start-radius: 0;
|
|
180
180
|
border-end-start-radius: 0;
|
|
181
181
|
padding-inline: calc(var(--space-xs-zb16t3, 8px) - 2px);
|
|
182
182
|
}
|
|
183
|
-
.awsui_split-trigger-
|
|
183
|
+
.awsui_split-trigger-wrapper_sne0l_1175t_166 > .awsui_trigger-item_sne0l_1175t_169:not(#\9):not(:first-child).awsui_visual-refresh_sne0l_1175t_183 > .awsui_trigger-button_sne0l_1175t_169 {
|
|
184
184
|
padding-inline-end: calc(var(--space-s-34lx8l, 12px) - 2px);
|
|
185
185
|
}
|
|
186
|
-
.awsui_split-trigger-
|
|
187
|
-
z-index: -1;
|
|
188
|
-
}
|
|
189
|
-
.awsui_split-trigger-wrapper_sne0l_15vbp_166 > .awsui_trigger-item_sne0l_15vbp_169.awsui_variant-normal_sne0l_15vbp_189:not(#\9):not(:last-child) > .awsui_trigger-button_sne0l_15vbp_169 {
|
|
186
|
+
.awsui_split-trigger-wrapper_sne0l_1175t_166 > .awsui_trigger-item_sne0l_1175t_169.awsui_variant-normal_sne0l_1175t_186:not(#\9):not(:last-child) > .awsui_trigger-button_sne0l_1175t_169 {
|
|
190
187
|
margin-inline-end: 0;
|
|
191
188
|
}
|
|
192
|
-
.awsui_split-trigger-
|
|
189
|
+
.awsui_split-trigger-wrapper_sne0l_1175t_166 > .awsui_trigger-item_sne0l_1175t_169.awsui_variant-normal_sne0l_1175t_186:not(#\9):not(:first-child) > .awsui_trigger-button_sne0l_1175t_169 {
|
|
193
190
|
margin-inline-start: calc(var(--border-field-width-09w7vk, 2px) * -1);
|
|
194
191
|
}
|
|
195
192
|
|
|
196
|
-
.awsui_split-
|
|
193
|
+
.awsui_split-trigger_sne0l_1175t_166:not(#\9) {
|
|
197
194
|
display: contents;
|
|
198
195
|
}
|
|
199
196
|
|
|
200
|
-
.awsui_dropdown-
|
|
197
|
+
.awsui_dropdown-trigger_sne0l_1175t_197:not(#\9) {
|
|
201
198
|
display: contents;
|
|
202
199
|
}
|
|
203
200
|
|
|
204
|
-
.awsui_test-utils-button-
|
|
201
|
+
.awsui_test-utils-button-trigger_sne0l_1175t_201:not(#\9) {
|
|
205
202
|
/* used in test-utils */
|
|
206
203
|
}
|
|
@@ -2,23 +2,21 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"button-dropdown": "awsui_button-
|
|
6
|
-
"items-list-container": "awsui_items-list-
|
|
7
|
-
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-
|
|
8
|
-
"rotate-up": "awsui_rotate-
|
|
9
|
-
"rotate-down": "awsui_rotate-
|
|
10
|
-
"header": "
|
|
11
|
-
"title": "
|
|
12
|
-
"description": "
|
|
13
|
-
"split-trigger-wrapper": "awsui_split-trigger-
|
|
14
|
-
"trigger-item": "awsui_trigger-
|
|
15
|
-
"trigger-button": "awsui_trigger-
|
|
16
|
-
"visual-refresh": "awsui_visual-
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"dropdown-trigger": "awsui_dropdown-trigger_sne0l_15vbp_200",
|
|
22
|
-
"test-utils-button-trigger": "awsui_test-utils-button-trigger_sne0l_15vbp_204"
|
|
5
|
+
"button-dropdown": "awsui_button-dropdown_sne0l_1175t_97",
|
|
6
|
+
"items-list-container": "awsui_items-list-container_sne0l_1175t_101",
|
|
7
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_sne0l_1175t_1",
|
|
8
|
+
"rotate-up": "awsui_rotate-up_sne0l_1175t_120",
|
|
9
|
+
"rotate-down": "awsui_rotate-down_sne0l_1175t_135",
|
|
10
|
+
"header": "awsui_header_sne0l_1175t_150",
|
|
11
|
+
"title": "awsui_title_sne0l_1175t_161",
|
|
12
|
+
"description": "awsui_description_sne0l_1175t_162",
|
|
13
|
+
"split-trigger-wrapper": "awsui_split-trigger-wrapper_sne0l_1175t_166",
|
|
14
|
+
"trigger-item": "awsui_trigger-item_sne0l_1175t_169",
|
|
15
|
+
"trigger-button": "awsui_trigger-button_sne0l_1175t_169",
|
|
16
|
+
"visual-refresh": "awsui_visual-refresh_sne0l_1175t_183",
|
|
17
|
+
"variant-normal": "awsui_variant-normal_sne0l_1175t_186",
|
|
18
|
+
"split-trigger": "awsui_split-trigger_sne0l_1175t_166",
|
|
19
|
+
"dropdown-trigger": "awsui_dropdown-trigger_sne0l_1175t_197",
|
|
20
|
+
"test-utils-button-trigger": "awsui_test-utils-button-trigger_sne0l_1175t_201"
|
|
23
21
|
};
|
|
24
22
|
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAkB5E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAO/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,eAAO,MAAM,wBAAwB,qFAuOpC,CAAC;AAEF,eAAO,MAAM,0BAA0B,mMAIZ,CAAC"}
|
|
@@ -7,7 +7,6 @@ import { isAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';
|
|
|
7
7
|
import { useKeyboardEvents } from '../app-layout/utils/use-keyboard-events';
|
|
8
8
|
import { usePointerEvents } from '../app-layout/utils/use-pointer-events';
|
|
9
9
|
import { InternalButton } from '../button/internal';
|
|
10
|
-
import { useInternalI18n } from '../i18n/context';
|
|
11
10
|
import { getBaseProps } from '../internal/base-component';
|
|
12
11
|
import PanelResizeHandle from '../internal/components/panel-resize-handle';
|
|
13
12
|
import { Transition } from '../internal/components/transition';
|
|
@@ -23,14 +22,13 @@ import { SplitPanelContentSide } from './side';
|
|
|
23
22
|
import styles from './styles.css.js';
|
|
24
23
|
import testUtilStyles from './test-classes/styles.css.js';
|
|
25
24
|
export const SplitPanelImplementation = React.forwardRef((_a, __internalRootRef) => {
|
|
26
|
-
var { header, children, hidePreferencesButton = false, closeBehavior = 'collapse', i18nStrings } = _a, restProps = __rest(_a, ["header", "children", "hidePreferencesButton", "closeBehavior", "i18nStrings"]);
|
|
25
|
+
var { header, children, hidePreferencesButton = false, closeBehavior = 'collapse', i18nStrings = {} } = _a, restProps = __rest(_a, ["header", "children", "hidePreferencesButton", "closeBehavior", "i18nStrings"]);
|
|
27
26
|
const isRefresh = useVisualRefresh();
|
|
28
27
|
const { position, topOffset, bottomOffset, rightOffset, contentWidthStyles, isOpen, isForcedPosition, onPreferencesChange, onResize, onToggle, size, relativeSize, setSplitPanelToggle, refs, } = useSplitPanelContext();
|
|
29
28
|
const baseProps = getBaseProps(restProps);
|
|
30
|
-
const i18n = useInternalI18n('split-panel');
|
|
31
29
|
const [isPreferencesOpen, setPreferencesOpen] = useState(false);
|
|
32
30
|
const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;
|
|
33
|
-
const openButtonAriaLabel =
|
|
31
|
+
const openButtonAriaLabel = i18nStrings.openButtonAriaLabel;
|
|
34
32
|
useEffect(() => {
|
|
35
33
|
setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel: openButtonAriaLabel });
|
|
36
34
|
}, [setSplitPanelToggle, openButtonAriaLabel, closeBehavior]);
|
|
@@ -52,14 +50,14 @@ export const SplitPanelImplementation = React.forwardRef((_a, __internalRootRef)
|
|
|
52
50
|
React.createElement("h2", { className: clsx(styles['header-text'], testUtilStyles['header-text']), id: panelHeaderId }, header),
|
|
53
51
|
React.createElement("div", { className: styles['header-actions'] },
|
|
54
52
|
!hidePreferencesButton && isOpen && (React.createElement(React.Fragment, null,
|
|
55
|
-
React.createElement(InternalButton, { className: testUtilStyles['preferences-button'], iconName: "settings", variant: "icon", onClick: () => setPreferencesOpen(true), formAction: "none", ariaLabel:
|
|
53
|
+
React.createElement(InternalButton, { className: testUtilStyles['preferences-button'], iconName: "settings", variant: "icon", onClick: () => setPreferencesOpen(true), formAction: "none", ariaLabel: i18nStrings.preferencesTitle, ref: refs.preferences }),
|
|
56
54
|
React.createElement("span", { className: styles.divider }))),
|
|
57
55
|
isOpen ? (React.createElement(InternalButton, { className: testUtilStyles['close-button'], iconName: isRefresh && closeBehavior === 'collapse'
|
|
58
56
|
? position === 'side'
|
|
59
57
|
? 'angle-right'
|
|
60
58
|
: 'angle-down'
|
|
61
|
-
: 'close', variant: "icon", onClick: onToggle, formAction: "none", ariaLabel:
|
|
62
|
-
const resizeHandle = (React.createElement(PanelResizeHandle, { ref: refs.slider, className: testUtilStyles.slider, ariaLabel:
|
|
59
|
+
: 'close', variant: "icon", onClick: onToggle, formAction: "none", ariaLabel: i18nStrings.closeButtonAriaLabel, ariaExpanded: isOpen })) : position === 'side' ? null : (React.createElement(InternalButton, { className: testUtilStyles['open-button'], iconName: "angle-up", variant: "icon", formAction: "none", ariaLabel: i18nStrings.openButtonAriaLabel, ref: refs.toggle, ariaExpanded: isOpen })))));
|
|
60
|
+
const resizeHandle = (React.createElement(PanelResizeHandle, { ref: refs.slider, className: testUtilStyles.slider, ariaLabel: i18nStrings.resizeHandleAriaLabel,
|
|
63
61
|
// Allows us to use the logical left/right keys to move the slider left/right,
|
|
64
62
|
// but match aria keyboard behavior of using left/right to decrease/increase
|
|
65
63
|
// the slider value.
|
|
@@ -98,16 +96,16 @@ export const SplitPanelImplementation = React.forwardRef((_a, __internalRootRef)
|
|
|
98
96
|
return React.createElement(React.Fragment, null);
|
|
99
97
|
}
|
|
100
98
|
return (React.createElement(Transition, { in: isOpen !== null && isOpen !== void 0 ? isOpen : false }, (state, transitioningElementRef) => (React.createElement(React.Fragment, null,
|
|
101
|
-
position === 'side' && (React.createElement(SplitPanelContentSide, { style: contentStyle, resizeHandle: resizeHandle, baseProps: baseProps, isOpen: isOpen, splitPanelRef: mergedRef, cappedSize: size, onToggle: onToggle, openButtonAriaLabel:
|
|
99
|
+
position === 'side' && (React.createElement(SplitPanelContentSide, { style: contentStyle, resizeHandle: resizeHandle, baseProps: baseProps, isOpen: isOpen, splitPanelRef: mergedRef, cappedSize: size, onToggle: onToggle, openButtonAriaLabel: openButtonAriaLabel, toggleRef: refs.toggle, header: wrappedHeader, panelHeaderId: panelHeaderId }, children)),
|
|
102
100
|
position === 'bottom' && (React.createElement(SplitPanelContentBottom, { style: contentStyle, resizeHandle: resizeHandle, baseProps: baseProps, isOpen: isOpen, splitPanelRef: mergedRef, cappedSize: size, onToggle: onToggle, header: wrappedHeader, panelHeaderId: panelHeaderId, state: state, transitioningElementRef: transitioningElementRef, appLayoutMaxWidth: appLayoutMaxWidth }, children)),
|
|
103
101
|
isPreferencesOpen && (React.createElement(PreferencesModal, { visible: true, preferences: { position }, disabledSidePosition: position === 'bottom' && isForcedPosition, isRefresh: isRefresh, i18nStrings: {
|
|
104
|
-
header:
|
|
105
|
-
confirm:
|
|
106
|
-
cancel:
|
|
107
|
-
positionLabel:
|
|
108
|
-
positionDescription:
|
|
109
|
-
positionBottom:
|
|
110
|
-
positionSide:
|
|
102
|
+
header: i18nStrings.preferencesTitle,
|
|
103
|
+
confirm: i18nStrings.preferencesConfirm,
|
|
104
|
+
cancel: i18nStrings.preferencesCancel,
|
|
105
|
+
positionLabel: i18nStrings.preferencesPositionLabel,
|
|
106
|
+
positionDescription: i18nStrings.preferencesPositionDescription,
|
|
107
|
+
positionBottom: i18nStrings.preferencesPositionBottom,
|
|
108
|
+
positionSide: i18nStrings.preferencesPositionSide,
|
|
111
109
|
}, onConfirm: preferences => {
|
|
112
110
|
onPreferencesChange(Object.assign({}, preferences));
|
|
113
111
|
setPreferencesOpen(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,iBAAiB,MAAM,4CAA4C,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,W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gBAAgB,CAAC;gBAC3E,OAAO,EAAE,IAAI,CAAC,gCAAgC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,kBAAkB,CAAC;gBAChF,MAAM,EAAE,IAAI,CAAC,+BAA+B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,iBAAiB,CAAC;gBAC7E,aAAa,EAAE,IAAI,CAAC,sCAAsC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,wBAAwB,CAAC;gBAClG,mBAAmB,EAAE,IAAI,CACvB,4CAA4C,EAC5C,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,8BAA8B,CAC5C;gBACD,cAAc,EAAE,IAAI,CAAC,uCAAuC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,yBAAyB,CAAC;gBACrG,YAAY,EAAE,IAAI,CAAC,qCAAqC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,uBAAuB,CAAC;aAChG,EACD,SAAS,EAAE,WAAW,CAAC,EAAE;gBACvB,mBAAmB,mBAAM,WAAW,EAAG,CAAC;gBACxC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,EACD,SAAS,EAAE,GAAG,EAAE;gBACd,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,GACD,CACH,CACA,CACJ,CACU,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,0BAA0B,CAIlE,wBAAwB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { isAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';\nimport { SizeControlProps } from '../app-layout/utils/interfaces';\nimport { useKeyboardEvents } from '../app-layout/utils/use-keyboard-events';\nimport { usePointerEvents } from '../app-layout/utils/use-pointer-events';\nimport { InternalButton } from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport PanelResizeHandle from '../internal/components/panel-resize-handle';\nimport { Transition } from '../internal/components/transition';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport globalVars from '../internal/styles/global-vars';\nimport { createWidgetizedForwardRef } from '../internal/widgets';\nimport { SplitPanelContentBottom } from './bottom';\nimport { SplitPanelProps } from './interfaces';\nimport PreferencesModal from './preferences-modal';\nimport { SplitPanelContentSide } from './side';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport { SplitPanelProps };\n\nexport const SplitPanelImplementation = React.forwardRef<HTMLElement, SplitPanelProps>(\n (\n { header, children, hidePreferencesButton = false, closeBehavior = 'collapse', i18nStrings, ...restProps },\n __internalRootRef\n ) => {\n const isRefresh = useVisualRefresh();\n\n const {\n position,\n topOffset,\n bottomOffset,\n rightOffset,\n contentWidthStyles,\n isOpen,\n isForcedPosition,\n onPreferencesChange,\n onResize,\n onToggle,\n size,\n relativeSize,\n setSplitPanelToggle,\n refs,\n } = useSplitPanelContext();\n const baseProps = getBaseProps(restProps);\n const i18n = useInternalI18n('split-panel');\n const [isPreferencesOpen, setPreferencesOpen] = useState<boolean>(false);\n\n const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;\n\n const openButtonAriaLabel = i18n('i18nStrings.openButtonAriaLabel', i18nStrings?.openButtonAriaLabel);\n useEffect(() => {\n setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel: openButtonAriaLabel });\n }, [setSplitPanelToggle, openButtonAriaLabel, closeBehavior]);\n\n const splitPanelRefObject = useRef<HTMLDivElement>(null);\n\n const sizeControlProps: SizeControlProps = {\n position,\n panelRef: splitPanelRefObject,\n handleRef: refs.slider,\n onResize,\n };\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const contentStyle = {\n [globalVars.stickyVerticalTopOffset]: topOffset,\n [globalVars.stickyVerticalBottomOffset]: bottomOffset,\n };\n\n const panelHeaderId = useUniqueId('split-panel-header');\n\n const wrappedHeader = (\n <div\n className={clsx(styles.header, isAppLayoutToolbarEnabled() && styles['with-toolbar'])}\n style={appLayoutMaxWidth}\n >\n <h2 className={clsx(styles['header-text'], testUtilStyles['header-text'])} id={panelHeaderId}>\n {header}\n </h2>\n <div className={styles['header-actions']}>\n {!hidePreferencesButton && isOpen && (\n <>\n <InternalButton\n className={testUtilStyles['preferences-button']}\n iconName=\"settings\"\n variant=\"icon\"\n onClick={() => setPreferencesOpen(true)}\n formAction=\"none\"\n ariaLabel={i18n('i18nStrings.preferencesTitle', i18nStrings?.preferencesTitle)}\n ref={refs.preferences}\n />\n <span className={styles.divider} />\n </>\n )}\n\n {isOpen ? (\n <InternalButton\n className={testUtilStyles['close-button']}\n iconName={\n isRefresh && closeBehavior === 'collapse'\n ? position === 'side'\n ? 'angle-right'\n : 'angle-down'\n : 'close'\n }\n variant=\"icon\"\n onClick={onToggle}\n formAction=\"none\"\n ariaLabel={i18n('i18nStrings.closeButtonAriaLabel', i18nStrings?.closeButtonAriaLabel)}\n ariaExpanded={isOpen}\n />\n ) : position === 'side' ? null : (\n <InternalButton\n className={testUtilStyles['open-button']}\n iconName=\"angle-up\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={i18n('i18nStrings.openButtonAriaLabel', i18nStrings?.openButtonAriaLabel)}\n ref={refs.toggle}\n ariaExpanded={isOpen}\n />\n )}\n </div>\n </div>\n );\n\n const resizeHandle = (\n <PanelResizeHandle\n ref={refs.slider}\n className={testUtilStyles.slider}\n ariaLabel={i18n('i18nStrings.resizeHandleAriaLabel', i18nStrings?.resizeHandleAriaLabel)}\n // Allows us to use the logical left/right keys to move the slider left/right,\n // but match aria keyboard behavior of using left/right to decrease/increase\n // the slider value.\n ariaValuenow={position === 'bottom' ? relativeSize : 100 - relativeSize}\n position={position}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n />\n );\n\n /*\n This effect forces the browser to recalculate the layout\n whenever the split panel might have moved.\n\n This is needed as a workaround for a bug in Safari, which does\n not automatically calculate the new position of the split panel\n _content_ when the split panel moves.\n */\n useLayoutEffect(() => {\n const root = splitPanelRefObject.current;\n\n if (root) {\n const property = 'transform';\n const temporaryValue = 'translateZ(0)';\n\n const valueBefore = root.style[property];\n root.style[property] = temporaryValue;\n\n // This line forces the browser to recalculate the layout\n void root.offsetHeight;\n\n root.style[property] = valueBefore;\n }\n }, [rightOffset, __internalRootRef]);\n\n const mergedRef = useMergeRefs(splitPanelRefObject, __internalRootRef);\n\n if (closeBehavior === 'hide' && !isOpen) {\n return <></>;\n }\n\n /**\n * The AppLayout factor moved the circular buttons out of the\n * SplitPanel and into the Tools component. This conditional\n * is still needed for the early return to prevent execution\n * of the following code.\n */\n if (isRefresh && !isOpen && position === 'side') {\n return <></>;\n }\n\n return (\n <Transition in={isOpen ?? false}>\n {(state, transitioningElementRef) => (\n <>\n {position === 'side' && (\n <SplitPanelContentSide\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n openButtonAriaLabel={i18n('i18nStrings.openButtonAriaLabel', i18nStrings?.openButtonAriaLabel)}\n toggleRef={refs.toggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n >\n {children}\n </SplitPanelContentSide>\n )}\n\n {position === 'bottom' && (\n <SplitPanelContentBottom\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n state={state}\n transitioningElementRef={transitioningElementRef}\n appLayoutMaxWidth={appLayoutMaxWidth}\n >\n {children}\n </SplitPanelContentBottom>\n )}\n {isPreferencesOpen && (\n <PreferencesModal\n visible={true}\n preferences={{ position }}\n disabledSidePosition={position === 'bottom' && isForcedPosition}\n isRefresh={isRefresh}\n i18nStrings={{\n header: i18n('i18nStrings.preferencesTitle', i18nStrings?.preferencesTitle),\n confirm: i18n('i18nStrings.preferencesConfirm', i18nStrings?.preferencesConfirm),\n cancel: i18n('i18nStrings.preferencesCancel', i18nStrings?.preferencesCancel),\n positionLabel: i18n('i18nStrings.preferencesPositionLabel', i18nStrings?.preferencesPositionLabel),\n positionDescription: i18n(\n 'i18nStrings.preferencesPositionDescription',\n i18nStrings?.preferencesPositionDescription\n ),\n positionBottom: i18n('i18nStrings.preferencesPositionBottom', i18nStrings?.preferencesPositionBottom),\n positionSide: i18n('i18nStrings.preferencesPositionSide', i18nStrings?.preferencesPositionSide),\n }}\n onConfirm={preferences => {\n onPreferencesChange({ ...preferences });\n setPreferencesOpen(false);\n }}\n onDismiss={() => {\n setPreferencesOpen(false);\n }}\n />\n )}\n </>\n )}\n </Transition>\n );\n }\n);\n\nexport const createWidgetizedSplitPanel = createWidgetizedForwardRef<\n SplitPanelProps,\n HTMLElement,\n typeof SplitPanelImplementation\n>(SplitPanelImplementation);\n"]}
|
|
1
|
+
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,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AW,CAAC,wBAAwB;gBACnD,mBAAmB,EAAE,WAAW,CAAC,8BAA8B;gBAC/D,cAAc,EAAE,WAAW,CAAC,yBAAyB;gBACrD,YAAY,EAAE,WAAW,CAAC,uBAAuB;aAClD,EACD,SAAS,EAAE,WAAW,CAAC,EAAE;gBACvB,mBAAmB,mBAAM,WAAW,EAAG,CAAC;gBACxC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,EACD,SAAS,EAAE,GAAG,EAAE;gBACd,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,GACD,CACH,CACA,CACJ,CACU,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,0BAA0B,CAIlE,wBAAwB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { isAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';\nimport { SizeControlProps } from '../app-layout/utils/interfaces';\nimport { useKeyboardEvents } from '../app-layout/utils/use-keyboard-events';\nimport { usePointerEvents } from '../app-layout/utils/use-pointer-events';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport PanelResizeHandle from '../internal/components/panel-resize-handle';\nimport { Transition } from '../internal/components/transition';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport globalVars from '../internal/styles/global-vars';\nimport { createWidgetizedForwardRef } from '../internal/widgets';\nimport { SplitPanelContentBottom } from './bottom';\nimport { SplitPanelProps } from './interfaces';\nimport PreferencesModal from './preferences-modal';\nimport { SplitPanelContentSide } from './side';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport { SplitPanelProps };\n\nexport const SplitPanelImplementation = React.forwardRef<HTMLElement, SplitPanelProps>(\n (\n { header, children, hidePreferencesButton = false, closeBehavior = 'collapse', i18nStrings = {}, ...restProps },\n __internalRootRef\n ) => {\n const isRefresh = useVisualRefresh();\n\n const {\n position,\n topOffset,\n bottomOffset,\n rightOffset,\n contentWidthStyles,\n isOpen,\n isForcedPosition,\n onPreferencesChange,\n onResize,\n onToggle,\n size,\n relativeSize,\n setSplitPanelToggle,\n refs,\n } = useSplitPanelContext();\n const baseProps = getBaseProps(restProps);\n const [isPreferencesOpen, setPreferencesOpen] = useState<boolean>(false);\n\n const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;\n\n const openButtonAriaLabel = i18nStrings.openButtonAriaLabel;\n useEffect(() => {\n setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel: openButtonAriaLabel });\n }, [setSplitPanelToggle, openButtonAriaLabel, closeBehavior]);\n\n const splitPanelRefObject = useRef<HTMLDivElement>(null);\n\n const sizeControlProps: SizeControlProps = {\n position,\n panelRef: splitPanelRefObject,\n handleRef: refs.slider,\n onResize,\n };\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const contentStyle = {\n [globalVars.stickyVerticalTopOffset]: topOffset,\n [globalVars.stickyVerticalBottomOffset]: bottomOffset,\n };\n\n const panelHeaderId = useUniqueId('split-panel-header');\n\n const wrappedHeader = (\n <div\n className={clsx(styles.header, isAppLayoutToolbarEnabled() && styles['with-toolbar'])}\n style={appLayoutMaxWidth}\n >\n <h2 className={clsx(styles['header-text'], testUtilStyles['header-text'])} id={panelHeaderId}>\n {header}\n </h2>\n <div className={styles['header-actions']}>\n {!hidePreferencesButton && isOpen && (\n <>\n <InternalButton\n className={testUtilStyles['preferences-button']}\n iconName=\"settings\"\n variant=\"icon\"\n onClick={() => setPreferencesOpen(true)}\n formAction=\"none\"\n ariaLabel={i18nStrings.preferencesTitle}\n ref={refs.preferences}\n />\n <span className={styles.divider} />\n </>\n )}\n\n {isOpen ? (\n <InternalButton\n className={testUtilStyles['close-button']}\n iconName={\n isRefresh && closeBehavior === 'collapse'\n ? position === 'side'\n ? 'angle-right'\n : 'angle-down'\n : 'close'\n }\n variant=\"icon\"\n onClick={onToggle}\n formAction=\"none\"\n ariaLabel={i18nStrings.closeButtonAriaLabel}\n ariaExpanded={isOpen}\n />\n ) : position === 'side' ? null : (\n <InternalButton\n className={testUtilStyles['open-button']}\n iconName=\"angle-up\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={i18nStrings.openButtonAriaLabel}\n ref={refs.toggle}\n ariaExpanded={isOpen}\n />\n )}\n </div>\n </div>\n );\n\n const resizeHandle = (\n <PanelResizeHandle\n ref={refs.slider}\n className={testUtilStyles.slider}\n ariaLabel={i18nStrings.resizeHandleAriaLabel}\n // Allows us to use the logical left/right keys to move the slider left/right,\n // but match aria keyboard behavior of using left/right to decrease/increase\n // the slider value.\n ariaValuenow={position === 'bottom' ? relativeSize : 100 - relativeSize}\n position={position}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n />\n );\n\n /*\n This effect forces the browser to recalculate the layout\n whenever the split panel might have moved.\n\n This is needed as a workaround for a bug in Safari, which does\n not automatically calculate the new position of the split panel\n _content_ when the split panel moves.\n */\n useLayoutEffect(() => {\n const root = splitPanelRefObject.current;\n\n if (root) {\n const property = 'transform';\n const temporaryValue = 'translateZ(0)';\n\n const valueBefore = root.style[property];\n root.style[property] = temporaryValue;\n\n // This line forces the browser to recalculate the layout\n void root.offsetHeight;\n\n root.style[property] = valueBefore;\n }\n }, [rightOffset, __internalRootRef]);\n\n const mergedRef = useMergeRefs(splitPanelRefObject, __internalRootRef);\n\n if (closeBehavior === 'hide' && !isOpen) {\n return <></>;\n }\n\n /**\n * The AppLayout factor moved the circular buttons out of the\n * SplitPanel and into the Tools component. This conditional\n * is still needed for the early return to prevent execution\n * of the following code.\n */\n if (isRefresh && !isOpen && position === 'side') {\n return <></>;\n }\n\n return (\n <Transition in={isOpen ?? false}>\n {(state, transitioningElementRef) => (\n <>\n {position === 'side' && (\n <SplitPanelContentSide\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n openButtonAriaLabel={openButtonAriaLabel}\n toggleRef={refs.toggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n >\n {children}\n </SplitPanelContentSide>\n )}\n\n {position === 'bottom' && (\n <SplitPanelContentBottom\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n state={state}\n transitioningElementRef={transitioningElementRef}\n appLayoutMaxWidth={appLayoutMaxWidth}\n >\n {children}\n </SplitPanelContentBottom>\n )}\n {isPreferencesOpen && (\n <PreferencesModal\n visible={true}\n preferences={{ position }}\n disabledSidePosition={position === 'bottom' && isForcedPosition}\n isRefresh={isRefresh}\n i18nStrings={{\n header: i18nStrings.preferencesTitle,\n confirm: i18nStrings.preferencesConfirm,\n cancel: i18nStrings.preferencesCancel,\n positionLabel: i18nStrings.preferencesPositionLabel,\n positionDescription: i18nStrings.preferencesPositionDescription,\n positionBottom: i18nStrings.preferencesPositionBottom,\n positionSide: i18nStrings.preferencesPositionSide,\n }}\n onConfirm={preferences => {\n onPreferencesChange({ ...preferences });\n setPreferencesOpen(false);\n }}\n onDismiss={() => {\n setPreferencesOpen(false);\n }}\n />\n )}\n </>\n )}\n </Transition>\n );\n }\n);\n\nexport const createWidgetizedSplitPanel = createWidgetizedForwardRef<\n SplitPanelProps,\n HTMLElement,\n typeof SplitPanelImplementation\n>(SplitPanelImplementation);\n"]}
|
package/split-panel/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SplitPanelProps } from './interfaces';
|
|
3
3
|
export { SplitPanelProps };
|
|
4
|
-
export default function SplitPanel({ hidePreferencesButton, closeBehavior, ...restProps }: SplitPanelProps): JSX.Element;
|
|
4
|
+
export default function SplitPanel({ hidePreferencesButton, closeBehavior, i18nStrings, ...restProps }: SplitPanelProps): JSX.Element;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/split-panel/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/split-panel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,qBAA6B,EAC7B,aAA0B,EAC1B,WAAgB,EAChB,GAAG,SAAS,EACb,EAAE,eAAe,eAgCjB"}
|
package/split-panel/index.js
CHANGED
|
@@ -2,15 +2,17 @@ import { __rest } from "tslib";
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { useInternalI18n } from '../i18n/context';
|
|
5
6
|
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
7
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
8
|
import { SplitPanelInternal } from './internal';
|
|
8
9
|
export default function SplitPanel(_a) {
|
|
9
|
-
var { hidePreferencesButton = false, closeBehavior = 'collapse' } = _a, restProps = __rest(_a, ["hidePreferencesButton", "closeBehavior"]);
|
|
10
|
+
var { hidePreferencesButton = false, closeBehavior = 'collapse', i18nStrings = {} } = _a, restProps = __rest(_a, ["hidePreferencesButton", "closeBehavior", "i18nStrings"]);
|
|
10
11
|
const { __internalRootRef } = useBaseComponent('SplitPanel', {
|
|
11
12
|
props: { closeBehavior, hidePreferencesButton },
|
|
12
13
|
});
|
|
13
|
-
|
|
14
|
+
const i18n = useInternalI18n('split-panel');
|
|
15
|
+
return (React.createElement(SplitPanelInternal, Object.assign({}, restProps, { ref: __internalRootRef, hidePreferencesButton: hidePreferencesButton, closeBehavior: closeBehavior, i18nStrings: Object.assign(Object.assign({}, i18nStrings), { closeButtonAriaLabel: i18n('i18nStrings.closeButtonAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.closeButtonAriaLabel), openButtonAriaLabel: i18n('i18nStrings.openButtonAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.openButtonAriaLabel), resizeHandleAriaLabel: i18n('i18nStrings.resizeHandleAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.resizeHandleAriaLabel), preferencesTitle: i18n('i18nStrings.preferencesTitle', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesTitle), preferencesConfirm: i18n('i18nStrings.preferencesConfirm', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesConfirm), preferencesCancel: i18n('i18nStrings.preferencesCancel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesCancel), preferencesPositionLabel: i18n('i18nStrings.preferencesPositionLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesPositionLabel), preferencesPositionDescription: i18n('i18nStrings.preferencesPositionDescription', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesPositionDescription), preferencesPositionBottom: i18n('i18nStrings.preferencesPositionBottom', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesPositionBottom), preferencesPositionSide: i18n('i18nStrings.preferencesPositionSide', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesPositionSide) }) })));
|
|
14
16
|
}
|
|
15
17
|
applyDisplayName(SplitPanel, 'SplitPanel');
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
package/split-panel/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/split-panel/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIhD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/split-panel/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIhD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAKjB;QALiB,EACjC,qBAAqB,GAAG,KAAK,EAC7B,aAAa,GAAG,UAAU,EAC1B,WAAW,GAAG,EAAE,OAEA,EADb,SAAS,cAJqB,yDAKlC,CADa;IAEZ,MAAM,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,CAAC,YAAY,EAAE;QAC3D,KAAK,EAAE,EAAE,aAAa,EAAE,qBAAqB,EAAE;KAChD,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;IAC5C,OAAO,CACL,oBAAC,kBAAkB,oBACb,SAAS,IACb,GAAG,EAAE,iBAA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React from 'react';\n\nimport { useInternalI18n } from '../i18n/context';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { SplitPanelProps } from './interfaces';\nimport { SplitPanelInternal } from './internal';\n\nexport { SplitPanelProps };\n\nexport default function SplitPanel({\n hidePreferencesButton = false,\n closeBehavior = 'collapse',\n i18nStrings = {},\n ...restProps\n}: SplitPanelProps) {\n const { __internalRootRef } = useBaseComponent('SplitPanel', {\n props: { closeBehavior, hidePreferencesButton },\n });\n const i18n = useInternalI18n('split-panel');\n return (\n <SplitPanelInternal\n {...restProps}\n ref={__internalRootRef}\n hidePreferencesButton={hidePreferencesButton}\n closeBehavior={closeBehavior}\n i18nStrings={{\n ...i18nStrings,\n closeButtonAriaLabel: i18n('i18nStrings.closeButtonAriaLabel', i18nStrings?.closeButtonAriaLabel),\n openButtonAriaLabel: i18n('i18nStrings.openButtonAriaLabel', i18nStrings?.openButtonAriaLabel),\n resizeHandleAriaLabel: i18n('i18nStrings.resizeHandleAriaLabel', i18nStrings?.resizeHandleAriaLabel),\n preferencesTitle: i18n('i18nStrings.preferencesTitle', i18nStrings?.preferencesTitle),\n preferencesConfirm: i18n('i18nStrings.preferencesConfirm', i18nStrings?.preferencesConfirm),\n preferencesCancel: i18n('i18nStrings.preferencesCancel', i18nStrings?.preferencesCancel),\n preferencesPositionLabel: i18n('i18nStrings.preferencesPositionLabel', i18nStrings?.preferencesPositionLabel),\n preferencesPositionDescription: i18n(\n 'i18nStrings.preferencesPositionDescription',\n i18nStrings?.preferencesPositionDescription\n ),\n preferencesPositionBottom: i18n(\n 'i18nStrings.preferencesPositionBottom',\n i18nStrings?.preferencesPositionBottom\n ),\n preferencesPositionSide: i18n('i18nStrings.preferencesPositionSide', i18nStrings?.preferencesPositionSide),\n }}\n />\n );\n}\n\napplyDisplayName(SplitPanel, 'SplitPanel');\n"]}
|