@cloudscape-design/components 3.0.294 → 3.0.295
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/alert/internal.d.ts.map +1 -1
- package/alert/internal.js +1 -1
- package/alert/internal.js.map +1 -1
- package/area-chart/elements/use-highlight-details.d.ts.map +1 -1
- package/area-chart/elements/use-highlight-details.js +3 -1
- package/area-chart/elements/use-highlight-details.js.map +1 -1
- package/area-chart/interfaces.d.ts +1 -0
- package/area-chart/interfaces.d.ts.map +1 -1
- package/area-chart/interfaces.js.map +1 -1
- package/breadcrumb-group/item/item.d.ts.map +1 -1
- package/breadcrumb-group/item/item.js +9 -6
- package/breadcrumb-group/item/item.js.map +1 -1
- package/button/internal.d.ts.map +1 -1
- package/button/internal.js +6 -1
- package/button/internal.js.map +1 -1
- package/container/index.d.ts.map +1 -1
- package/container/index.js +3 -1
- package/container/index.js.map +1 -1
- package/container/internal.d.ts.map +1 -1
- package/container/internal.js +4 -2
- package/container/internal.js.map +1 -1
- package/form/index.d.ts.map +1 -1
- package/form/index.js +5 -1
- package/form/index.js.map +1 -1
- package/form/internal.d.ts.map +1 -1
- package/form/internal.js +11 -2
- package/form/internal.js.map +1 -1
- package/form-field/internal.d.ts.map +1 -1
- package/form-field/internal.js +28 -2
- package/form-field/internal.js.map +1 -1
- package/header/internal.d.ts.map +1 -1
- package/header/internal.js +1 -1
- package/header/internal.js.map +1 -1
- package/internal/analytics/hooks/use-funnel.d.ts.map +1 -1
- package/internal/analytics/hooks/use-funnel.js +17 -11
- package/internal/analytics/hooks/use-funnel.js.map +1 -1
- package/internal/components/cartesian-chart/bottom-labels.d.ts.map +1 -1
- package/internal/components/cartesian-chart/bottom-labels.js +3 -1
- package/internal/components/cartesian-chart/bottom-labels.js.map +1 -1
- package/internal/components/cartesian-chart/interfaces.d.ts +4 -0
- package/internal/components/cartesian-chart/interfaces.d.ts.map +1 -1
- package/internal/components/cartesian-chart/interfaces.js.map +1 -1
- package/internal/components/cartesian-chart/left-labels.d.ts.map +1 -1
- package/internal/components/cartesian-chart/left-labels.js +3 -1
- package/internal/components/cartesian-chart/left-labels.js.map +1 -1
- package/internal/components/chart-filter/index.d.ts.map +1 -1
- package/internal/components/chart-filter/index.js +4 -2
- package/internal/components/chart-filter/index.js.map +1 -1
- package/internal/components/chart-legend/index.d.ts.map +1 -1
- package/internal/components/chart-legend/index.js +3 -1
- package/internal/components/chart-legend/index.js.map +1 -1
- package/internal/components/chart-plot/index.d.ts.map +1 -1
- package/internal/components/chart-plot/index.js +3 -1
- package/internal/components/chart-plot/index.js.map +1 -1
- package/internal/components/chart-status-container/index.d.ts.map +1 -1
- package/internal/components/chart-status-container/index.js +7 -4
- package/internal/components/chart-status-container/index.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/i18n/testing.d.ts +8 -0
- package/internal/i18n/testing.d.ts.map +1 -0
- package/internal/i18n/testing.js +8 -0
- package/internal/i18n/testing.js.map +1 -0
- package/internal/manifest.json +1 -1
- package/link/internal.d.ts.map +1 -1
- package/link/internal.js +35 -1
- package/link/internal.js.map +1 -1
- package/package.json +1 -1
- package/pie-chart/interfaces.d.ts +4 -0
- package/pie-chart/interfaces.d.ts.map +1 -1
- package/pie-chart/interfaces.js.map +1 -1
- package/pie-chart/pie-chart.d.ts.map +1 -1
- package/pie-chart/pie-chart.js +3 -1
- package/pie-chart/pie-chart.js.map +1 -1
- package/pie-chart/segments.d.ts.map +1 -1
- package/pie-chart/segments.js +3 -1
- package/pie-chart/segments.js.map +1 -1
- package/pie-chart/utils.d.ts +2 -1
- package/pie-chart/utils.d.ts.map +1 -1
- package/pie-chart/utils.js +3 -3
- package/pie-chart/utils.js.map +1 -1
- package/popover/body.d.ts.map +1 -1
- package/popover/body.js +3 -1
- package/popover/body.js.map +1 -1
- package/popover/interfaces.d.ts +1 -0
- package/popover/interfaces.d.ts.map +1 -1
- package/popover/interfaces.js.map +1 -1
- package/table/styles.css.js +34 -33
- package/table/styles.scoped.css +41 -41
- package/table/styles.selectors.js +34 -33
- package/tiles/interfaces.d.ts +4 -0
- package/tiles/interfaces.d.ts.map +1 -1
- package/tiles/interfaces.js.map +1 -1
- package/tiles/internal.d.ts.map +1 -1
- package/tiles/internal.js +2 -2
- package/tiles/internal.js.map +1 -1
- package/top-navigation/interfaces.d.ts +2 -0
- package/top-navigation/interfaces.d.ts.map +1 -1
- package/top-navigation/interfaces.js.map +1 -1
- package/top-navigation/parts/overflow-menu/menu-item.d.ts +1 -0
- package/top-navigation/parts/overflow-menu/menu-item.d.ts.map +1 -1
- package/top-navigation/parts/overflow-menu/menu-item.js +2 -0
- package/top-navigation/parts/overflow-menu/menu-item.js.map +1 -1
- package/top-navigation/parts/overflow-menu/views/submenu.d.ts.map +1 -1
- package/top-navigation/parts/overflow-menu/views/submenu.js +1 -0
- package/top-navigation/parts/overflow-menu/views/submenu.js.map +1 -1
- package/top-navigation/parts/overflow-menu/views/utilities.d.ts.map +1 -1
- package/top-navigation/parts/overflow-menu/views/utilities.js +1 -1
- package/top-navigation/parts/overflow-menu/views/utilities.js.map +1 -1
package/table/styles.scoped.css
CHANGED
|
@@ -94,7 +94,7 @@ 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
|
-
.
|
|
97
|
+
.awsui_root_wih1l_6njvm_97:not(#\9) {
|
|
98
98
|
font-size: var(--font-body-m-size-cqtcam, 14px);
|
|
99
99
|
line-height: var(--font-body-m-line-height-83azrc, 22px);
|
|
100
100
|
color: var(--color-text-body-default-01bwmw, #000716);
|
|
@@ -105,53 +105,53 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
105
105
|
width: 100%;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
.
|
|
108
|
+
.awsui_tools_wih1l_6njvm_108:not(#\9) {
|
|
109
109
|
display: flex;
|
|
110
110
|
align-items: flex-end;
|
|
111
111
|
flex-wrap: wrap;
|
|
112
112
|
padding: var(--space-scaled-xs-u0e7ft, 8px) 0 var(--space-scaled-xxs-ugy2pw, 4px);
|
|
113
113
|
}
|
|
114
|
-
.awsui_tools-
|
|
114
|
+
.awsui_tools-filtering_wih1l_6njvm_114:not(#\9) {
|
|
115
115
|
max-width: 100%;
|
|
116
116
|
margin-right: var(--space-l-ds615y, 20px);
|
|
117
117
|
}
|
|
118
118
|
@supports (flex-basis: fit-content) {
|
|
119
|
-
.awsui_tools-
|
|
119
|
+
.awsui_tools-filtering_wih1l_6njvm_114:not(#\9) {
|
|
120
120
|
flex: 1 1 fit-content;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
@supports not (flex-basis: fit-content) {
|
|
124
|
-
.awsui_tools-
|
|
124
|
+
.awsui_tools-filtering_wih1l_6njvm_114:not(#\9) {
|
|
125
125
|
flex: 1 1 auto;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
.awsui_tools-align-
|
|
128
|
+
.awsui_tools-align-right_wih1l_6njvm_128:not(#\9) {
|
|
129
129
|
display: flex;
|
|
130
130
|
margin-left: auto;
|
|
131
131
|
}
|
|
132
|
-
.awsui_tools-
|
|
132
|
+
.awsui_tools-pagination_wih1l_6njvm_132 + .awsui_tools-preferences_wih1l_6njvm_132:not(#\9) {
|
|
133
133
|
border-left: var(--border-divider-section-width-g0ay3c, 2px) solid var(--color-border-divider-default-4spq70, #e9ebed);
|
|
134
134
|
box-sizing: border-box;
|
|
135
135
|
margin-left: var(--space-xs-inub5w, 8px);
|
|
136
136
|
padding-left: var(--space-xs-inub5w, 8px);
|
|
137
137
|
}
|
|
138
|
-
.awsui_tools-
|
|
138
|
+
.awsui_tools-small_wih1l_6njvm_138 > .awsui_tools-filtering_wih1l_6njvm_114:not(#\9) {
|
|
139
139
|
margin-right: 0;
|
|
140
140
|
margin-bottom: var(--space-scaled-xs-u0e7ft, 8px);
|
|
141
141
|
flex-basis: 100%;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
.
|
|
144
|
+
.awsui_table_wih1l_6njvm_144:not(#\9) {
|
|
145
145
|
width: 100%;
|
|
146
146
|
border-spacing: 0;
|
|
147
147
|
position: relative;
|
|
148
148
|
box-sizing: border-box;
|
|
149
149
|
}
|
|
150
|
-
.awsui_table-layout-
|
|
150
|
+
.awsui_table-layout-fixed_wih1l_6njvm_150:not(#\9) {
|
|
151
151
|
table-layout: fixed;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
.
|
|
154
|
+
.awsui_wrapper_wih1l_6njvm_154:not(#\9) {
|
|
155
155
|
position: relative;
|
|
156
156
|
box-sizing: border-box;
|
|
157
157
|
width: 100%;
|
|
@@ -159,42 +159,42 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
159
159
|
padding-bottom: var(--space-table-content-bottom-5ikgmo, 4px);
|
|
160
160
|
overflow-x: auto;
|
|
161
161
|
}
|
|
162
|
-
.
|
|
162
|
+
.awsui_wrapper_wih1l_6njvm_154.awsui_variant-stacked_wih1l_6njvm_162 > .awsui_table_wih1l_6njvm_144:not(#\9), .awsui_wrapper_wih1l_6njvm_154.awsui_variant-container_wih1l_6njvm_162 > .awsui_table_wih1l_6njvm_144:not(#\9) {
|
|
163
163
|
padding-left: var(--space-table-horizontal-nhrpfz, 20px);
|
|
164
164
|
padding-right: var(--space-table-horizontal-nhrpfz, 20px);
|
|
165
165
|
}
|
|
166
|
-
.
|
|
166
|
+
.awsui_wrapper_wih1l_6njvm_154.awsui_variant-embedded_wih1l_6njvm_166:not(#\9), .awsui_wrapper_wih1l_6njvm_154.awsui_variant-borderless_wih1l_6njvm_166:not(#\9) {
|
|
167
167
|
padding-bottom: var(--space-table-embedded-content-bottom-cw037k, 0px);
|
|
168
168
|
}
|
|
169
|
-
.
|
|
169
|
+
.awsui_wrapper_wih1l_6njvm_154.awsui_has-header_wih1l_6njvm_169:not(#\9) {
|
|
170
170
|
padding-top: 0px;
|
|
171
171
|
}
|
|
172
|
-
.
|
|
172
|
+
.awsui_wrapper_wih1l_6njvm_154.awsui_has-footer_wih1l_6njvm_172:not(#\9) {
|
|
173
173
|
padding-bottom: 0px;
|
|
174
174
|
}
|
|
175
|
-
.
|
|
175
|
+
.awsui_wrapper_wih1l_6njvm_154:not(#\9):not(.awsui_has-header_wih1l_6njvm_169) {
|
|
176
176
|
border-top-right-radius: var(--border-radius-container-b3z48i, 16px);
|
|
177
177
|
border-top-left-radius: var(--border-radius-container-b3z48i, 16px);
|
|
178
178
|
}
|
|
179
|
-
body[data-awsui-focus-visible=true] .
|
|
179
|
+
body[data-awsui-focus-visible=true] .awsui_wrapper_wih1l_6njvm_154:not(#\9):focus {
|
|
180
180
|
outline: 2px dotted transparent;
|
|
181
181
|
outline-offset: 2px;
|
|
182
182
|
border-radius: var(--border-radius-container-b3z48i, 16px);
|
|
183
183
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-nwfxo7, #0972d3);
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
.awsui_cell-
|
|
186
|
+
.awsui_cell-merged_wih1l_6njvm_186:not(#\9) {
|
|
187
187
|
text-align: center;
|
|
188
188
|
padding: 0;
|
|
189
189
|
}
|
|
190
|
-
.awsui_cell-
|
|
190
|
+
.awsui_cell-merged_wih1l_6njvm_186.awsui_has-footer_wih1l_6njvm_172:not(#\9) {
|
|
191
191
|
/*
|
|
192
192
|
Add a bottom border to the body cell of an empty table as a separator between the
|
|
193
193
|
table and the footer
|
|
194
194
|
*/
|
|
195
195
|
border-bottom: var(--border-divider-section-width-g0ay3c, 2px) solid var(--color-border-divider-default-4spq70, #e9ebed);
|
|
196
196
|
}
|
|
197
|
-
.awsui_cell-merged-
|
|
197
|
+
.awsui_cell-merged-content_wih1l_6njvm_197:not(#\9) {
|
|
198
198
|
box-sizing: border-box;
|
|
199
199
|
width: 100%;
|
|
200
200
|
padding: var(--space-scaled-m-9q5ipc, 16px) var(--space-l-ds615y, 20px) var(--space-scaled-l-x5pubp, 20px);
|
|
@@ -202,18 +202,18 @@ body[data-awsui-focus-visible=true] .awsui_wrapper_wih1l_o3ri9_154:not(#\9):focu
|
|
|
202
202
|
/* stylelint-enable plugin/no-unsupported-browser-features */
|
|
203
203
|
}
|
|
204
204
|
@supports (position: sticky) {
|
|
205
|
-
.awsui_cell-merged-
|
|
205
|
+
.awsui_cell-merged-content_wih1l_6njvm_197:not(#\9) {
|
|
206
206
|
position: sticky;
|
|
207
207
|
left: 0;
|
|
208
208
|
margin: 0 calc(-2 * var(--space-table-horizontal-nhrpfz, 20px));
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
.
|
|
212
|
+
.awsui_empty_wih1l_6njvm_212:not(#\9) {
|
|
213
213
|
color: var(--color-text-empty-qnnj2s, #5f6b7a);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
.
|
|
216
|
+
.awsui_loading_wih1l_6njvm_216:not(#\9) {
|
|
217
217
|
/* used in test-utils */
|
|
218
218
|
}
|
|
219
219
|
|
|
@@ -222,19 +222,19 @@ The min/max/width token values in Visual Refresh should align
|
|
|
222
222
|
the table header and body cells selection control with the table
|
|
223
223
|
filter search icon.
|
|
224
224
|
*/
|
|
225
|
-
.awsui_selection-
|
|
225
|
+
.awsui_selection-control_wih1l_6njvm_225:not(#\9) {
|
|
226
226
|
box-sizing: border-box;
|
|
227
227
|
max-width: var(--size-table-selection-horizontal-dshi7g, 40px);
|
|
228
228
|
min-width: var(--size-table-selection-horizontal-dshi7g, 40px);
|
|
229
229
|
position: relative;
|
|
230
230
|
width: var(--size-table-selection-horizontal-dshi7g, 40px);
|
|
231
231
|
}
|
|
232
|
-
.awsui_selection-
|
|
232
|
+
.awsui_selection-control_wih1l_6njvm_225.awsui_selection-control-header_wih1l_6njvm_232:not(#\9) {
|
|
233
233
|
padding: var(--space-scaled-xs-u0e7ft, 8px) var(--space-scaled-l-x5pubp, 20px);
|
|
234
234
|
border-left: var(--border-item-width-4pi0dw, 2px) solid transparent;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
.awsui_sticky-
|
|
237
|
+
.awsui_sticky-scrollbar_wih1l_6njvm_237:not(#\9) {
|
|
238
238
|
height: 15px;
|
|
239
239
|
position: fixed;
|
|
240
240
|
display: none;
|
|
@@ -244,10 +244,10 @@ filter search icon.
|
|
|
244
244
|
bottom: 0;
|
|
245
245
|
width: 100%;
|
|
246
246
|
}
|
|
247
|
-
.awsui_sticky-scrollbar-
|
|
247
|
+
.awsui_sticky-scrollbar-content_wih1l_6njvm_247:not(#\9) {
|
|
248
248
|
height: 15px;
|
|
249
249
|
}
|
|
250
|
-
.awsui_sticky-scrollbar-
|
|
250
|
+
.awsui_sticky-scrollbar-visible_wih1l_6njvm_250:not(#\9) {
|
|
251
251
|
display: block;
|
|
252
252
|
}
|
|
253
253
|
|
|
@@ -255,12 +255,12 @@ filter search icon.
|
|
|
255
255
|
The dynamic height dark header needs a background that will cover
|
|
256
256
|
the default white background of the container component.
|
|
257
257
|
*/
|
|
258
|
-
.awsui_dark-
|
|
258
|
+
.awsui_dark-header_wih1l_6njvm_258:not(#\9) {
|
|
259
259
|
background-color: var(--color-background-layout-main-iz43sl, #ffffff);
|
|
260
260
|
color: var(--color-text-body-default-01bwmw, #000716);
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
.awsui_header-
|
|
263
|
+
.awsui_header-secondary_wih1l_6njvm_263:not(#\9) {
|
|
264
264
|
overflow: auto;
|
|
265
265
|
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
266
266
|
scrollbar-width: none; /* Firefox */
|
|
@@ -269,42 +269,42 @@ the default white background of the container component.
|
|
|
269
269
|
border-radius: 0;
|
|
270
270
|
background: var(--color-background-table-header-shne10, #ffffff);
|
|
271
271
|
}
|
|
272
|
-
.awsui_header-
|
|
272
|
+
.awsui_header-secondary_wih1l_6njvm_263.awsui_variant-stacked_wih1l_6njvm_162 > .awsui_table_wih1l_6njvm_144:not(#\9), .awsui_header-secondary_wih1l_6njvm_263.awsui_variant-container_wih1l_6njvm_162 > .awsui_table_wih1l_6njvm_144:not(#\9) {
|
|
273
273
|
padding-left: var(--space-table-horizontal-nhrpfz, 20px);
|
|
274
274
|
padding-right: var(--space-table-horizontal-nhrpfz, 20px);
|
|
275
275
|
}
|
|
276
|
-
.awsui_header-
|
|
276
|
+
.awsui_header-secondary_wih1l_6njvm_263:not(#\9)::-webkit-scrollbar {
|
|
277
277
|
display: none; /* Safari and Chrome */
|
|
278
278
|
}
|
|
279
|
-
.awsui_header-
|
|
279
|
+
.awsui_header-secondary_wih1l_6njvm_263.awsui_table-has-header_wih1l_6njvm_279:not(#\9) {
|
|
280
280
|
border-top: var(--border-divider-list-width-fsy9j8, 1px) solid var(--color-border-container-divider-qsuvq6, transparent);
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
.awsui_header-
|
|
283
|
+
.awsui_header-controls_wih1l_6njvm_283:not(#\9) {
|
|
284
284
|
padding-top: var(--space-container-header-vertical-gho8eg, 12px);
|
|
285
285
|
padding-bottom: var(--space-container-header-vertical-gho8eg, 12px);
|
|
286
286
|
}
|
|
287
|
-
.awsui_header-
|
|
287
|
+
.awsui_header-controls_wih1l_6njvm_283.awsui_variant-stacked_wih1l_6njvm_162:not(#\9), .awsui_header-controls_wih1l_6njvm_283.awsui_variant-container_wih1l_6njvm_162:not(#\9) {
|
|
288
288
|
padding-left: calc(var(--space-table-horizontal-nhrpfz, 20px) + var(--space-table-header-horizontal-jj2vbh, 0px));
|
|
289
289
|
padding-right: calc(var(--space-table-horizontal-nhrpfz, 20px) + var(--space-table-header-horizontal-jj2vbh, 0px));
|
|
290
290
|
}
|
|
291
|
-
.awsui_header-
|
|
291
|
+
.awsui_header-controls_wih1l_6njvm_283.awsui_variant-embedded_wih1l_6njvm_166:not(#\9), .awsui_header-controls_wih1l_6njvm_283.awsui_variant-borderless_wih1l_6njvm_166:not(#\9) {
|
|
292
292
|
padding-left: var(--space-table-header-horizontal-jj2vbh, 0px);
|
|
293
293
|
padding-right: var(--space-table-header-horizontal-jj2vbh, 0px);
|
|
294
294
|
padding-top: var(--space-table-embedded-header-top-8tml9f, 0px);
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
-
.awsui_footer-
|
|
297
|
+
.awsui_footer-wrapper_wih1l_6njvm_297.awsui_variant-stacked_wih1l_6njvm_162:not(#\9), .awsui_footer-wrapper_wih1l_6njvm_297.awsui_variant-container_wih1l_6njvm_162:not(#\9) {
|
|
298
298
|
padding-left: var(--space-table-horizontal-nhrpfz, 20px);
|
|
299
299
|
padding-right: var(--space-table-horizontal-nhrpfz, 20px);
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
.
|
|
302
|
+
.awsui_footer_wih1l_6njvm_297:not(#\9) {
|
|
303
303
|
padding: var(--space-scaled-s-gczsk7, 12px) var(--space-table-footer-horizontal-ezw6u7, 0px);
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
.awsui_thead-
|
|
307
|
-
.
|
|
308
|
-
.awsui_row-
|
|
306
|
+
.awsui_thead-active_wih1l_6njvm_306:not(#\9),
|
|
307
|
+
.awsui_row_wih1l_6njvm_307:not(#\9),
|
|
308
|
+
.awsui_row-selected_wih1l_6njvm_308:not(#\9) {
|
|
309
309
|
/* used in test-utils */
|
|
310
310
|
}
|
|
@@ -2,38 +2,39 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"tools": "
|
|
7
|
-
"tools-filtering": "awsui_tools-
|
|
8
|
-
"tools-align-right": "awsui_tools-align-
|
|
9
|
-
"tools-pagination": "awsui_tools-
|
|
10
|
-
"tools-preferences": "awsui_tools-
|
|
11
|
-
"tools-small": "awsui_tools-
|
|
12
|
-
"table": "
|
|
13
|
-
"table-layout-fixed": "awsui_table-layout-
|
|
14
|
-
"wrapper": "
|
|
15
|
-
"variant-stacked": "awsui_variant-
|
|
16
|
-
"variant-container": "awsui_variant-
|
|
17
|
-
"variant-embedded": "awsui_variant-
|
|
18
|
-
"
|
|
19
|
-
"has-
|
|
20
|
-
"
|
|
21
|
-
"cell-merged
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"selection-control
|
|
26
|
-
"
|
|
27
|
-
"sticky-scrollbar
|
|
28
|
-
"sticky-scrollbar-
|
|
29
|
-
"
|
|
30
|
-
"header
|
|
31
|
-
"
|
|
32
|
-
"header
|
|
33
|
-
"
|
|
34
|
-
"footer": "
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"row
|
|
5
|
+
"root": "awsui_root_wih1l_6njvm_97",
|
|
6
|
+
"tools": "awsui_tools_wih1l_6njvm_108",
|
|
7
|
+
"tools-filtering": "awsui_tools-filtering_wih1l_6njvm_114",
|
|
8
|
+
"tools-align-right": "awsui_tools-align-right_wih1l_6njvm_128",
|
|
9
|
+
"tools-pagination": "awsui_tools-pagination_wih1l_6njvm_132",
|
|
10
|
+
"tools-preferences": "awsui_tools-preferences_wih1l_6njvm_132",
|
|
11
|
+
"tools-small": "awsui_tools-small_wih1l_6njvm_138",
|
|
12
|
+
"table": "awsui_table_wih1l_6njvm_144",
|
|
13
|
+
"table-layout-fixed": "awsui_table-layout-fixed_wih1l_6njvm_150",
|
|
14
|
+
"wrapper": "awsui_wrapper_wih1l_6njvm_154",
|
|
15
|
+
"variant-stacked": "awsui_variant-stacked_wih1l_6njvm_162",
|
|
16
|
+
"variant-container": "awsui_variant-container_wih1l_6njvm_162",
|
|
17
|
+
"variant-embedded": "awsui_variant-embedded_wih1l_6njvm_166",
|
|
18
|
+
"variant-borderless": "awsui_variant-borderless_wih1l_6njvm_166",
|
|
19
|
+
"has-header": "awsui_has-header_wih1l_6njvm_169",
|
|
20
|
+
"has-footer": "awsui_has-footer_wih1l_6njvm_172",
|
|
21
|
+
"cell-merged": "awsui_cell-merged_wih1l_6njvm_186",
|
|
22
|
+
"cell-merged-content": "awsui_cell-merged-content_wih1l_6njvm_197",
|
|
23
|
+
"empty": "awsui_empty_wih1l_6njvm_212",
|
|
24
|
+
"loading": "awsui_loading_wih1l_6njvm_216",
|
|
25
|
+
"selection-control": "awsui_selection-control_wih1l_6njvm_225",
|
|
26
|
+
"selection-control-header": "awsui_selection-control-header_wih1l_6njvm_232",
|
|
27
|
+
"sticky-scrollbar": "awsui_sticky-scrollbar_wih1l_6njvm_237",
|
|
28
|
+
"sticky-scrollbar-content": "awsui_sticky-scrollbar-content_wih1l_6njvm_247",
|
|
29
|
+
"sticky-scrollbar-visible": "awsui_sticky-scrollbar-visible_wih1l_6njvm_250",
|
|
30
|
+
"dark-header": "awsui_dark-header_wih1l_6njvm_258",
|
|
31
|
+
"header-secondary": "awsui_header-secondary_wih1l_6njvm_263",
|
|
32
|
+
"table-has-header": "awsui_table-has-header_wih1l_6njvm_279",
|
|
33
|
+
"header-controls": "awsui_header-controls_wih1l_6njvm_283",
|
|
34
|
+
"footer-wrapper": "awsui_footer-wrapper_wih1l_6njvm_297",
|
|
35
|
+
"footer": "awsui_footer_wih1l_6njvm_297",
|
|
36
|
+
"thead-active": "awsui_thead-active_wih1l_6njvm_306",
|
|
37
|
+
"row": "awsui_row_wih1l_6njvm_307",
|
|
38
|
+
"row-selected": "awsui_row-selected_wih1l_6njvm_308"
|
|
38
39
|
};
|
|
39
40
|
|
package/tiles/interfaces.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ import { NonCancelableEventHandler } from '../internal/events';
|
|
|
4
4
|
import { FormFieldControlProps } from '../internal/context/form-field-context';
|
|
5
5
|
import { Breakpoint as _Breakpoint } from '../internal/breakpoints';
|
|
6
6
|
export interface TilesProps extends BaseComponentProps, FormFieldControlProps {
|
|
7
|
+
/**
|
|
8
|
+
* Specify a custom name for the native radio buttons. If not provided, the tiles component generates a random name.
|
|
9
|
+
*/
|
|
10
|
+
name?: string;
|
|
7
11
|
/**
|
|
8
12
|
* Specifies the value of the selected tile.
|
|
9
13
|
* If you want to clear the selection, use `null`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["tiles/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEpE,MAAM,WAAW,UAAW,SAAQ,kBAAkB,EAAE,qBAAqB;IAC3E;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAElD;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAE9D;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,yBAAiB,UAAU,CAAC;IAC1B,KAAY,UAAU,GAAG,WAAW,CAAC;IACrC,UAAiB,eAAe;QAC9B,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC9B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,C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CAAC,SAAS,CAAC;QACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC9B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;IAED,UAAiB,YAAY;QAC3B,KAAK,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
|
package/tiles/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["tiles/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { Breakpoint as _Breakpoint } from '../internal/breakpoints';\n\nexport interface TilesProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * Specifies the value of the selected tile.\n * If you want to clear the selection, use `null`.\n */\n value: string | null;\n\n /**\n * List of tile definitions. Each tile has the following properties:\n *\n * - `value` [string] - The value that will be associated with the tile. This is the value the tiles will get when the radio button is selected.\n * - `label` [ReactNode] - A short description for the option the tile represents.\n * - `description` [ReactNode] - (Optional) Further explanatory guidance on the tile option, shown below the `label`.\n * - `image` [ReactNode] - (Optional) Visually distinctive image for the tile option, shown below the `description`.\n * - `disabled` [boolean] - (Optional) Specifies whether the tile is disabled. Users can't select disabled tiles.\n * - `controlId` [string] - (Optional) The ID of the internal input. You can use this to relate a label element's `for` attribute to this control.\n * We recommend that you don't set this property because it's automatically set by the tiles component.\n */\n items?: ReadonlyArray<TilesProps.TilesDefinition>;\n\n /**\n * Adds `aria-label` on the group. Don't set this property if you are using this form element within a form field\n * because the form field component automatically sets the correct labels to make the component accessible.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-required` on the group.\n */\n ariaRequired?: boolean;\n\n /**\n * The number of columns for the tiles to be displayed in. Valid values are integers between 1 and 4.\n * If no value is specified, the number of columns is determined based on the number of items, with a maximum of 3.\n * It is set to 2 if 4 or 8 items are supplied in order to optimize the layout.\n */\n columns?: number;\n\n /**\n * Called when the user selects a different tile.\n */\n onChange?: NonCancelableEventHandler<TilesProps.ChangeDetail>;\n\n /**\n * Adds `aria-controls` attribute to the component.\n * If the component controls any secondary content (for example, another form field), use this to provide an ID referring to the secondary content.\n */\n ariaControls?: string;\n}\n\nexport namespace TilesProps {\n export type Breakpoint = _Breakpoint;\n export interface TilesDefinition {\n value: string;\n label: React.ReactNode;\n description?: React.ReactNode;\n image?: React.ReactNode;\n disabled?: boolean;\n controlId?: string;\n }\n\n export interface ChangeDetail {\n value: string;\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the UI control.\n */\n focus(): void;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["tiles/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { Breakpoint as _Breakpoint } from '../internal/breakpoints';\n\nexport interface TilesProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * Specify a custom name for the native radio buttons. If not provided, the tiles component generates a random name.\n */\n name?: string;\n\n /**\n * Specifies the value of the selected tile.\n * If you want to clear the selection, use `null`.\n */\n value: string | null;\n\n /**\n * List of tile definitions. Each tile has the following properties:\n *\n * - `value` [string] - The value that will be associated with the tile. This is the value the tiles will get when the radio button is selected.\n * - `label` [ReactNode] - A short description for the option the tile represents.\n * - `description` [ReactNode] - (Optional) Further explanatory guidance on the tile option, shown below the `label`.\n * - `image` [ReactNode] - (Optional) Visually distinctive image for the tile option, shown below the `description`.\n * - `disabled` [boolean] - (Optional) Specifies whether the tile is disabled. Users can't select disabled tiles.\n * - `controlId` [string] - (Optional) The ID of the internal input. You can use this to relate a label element's `for` attribute to this control.\n * We recommend that you don't set this property because it's automatically set by the tiles component.\n */\n items?: ReadonlyArray<TilesProps.TilesDefinition>;\n\n /**\n * Adds `aria-label` on the group. Don't set this property if you are using this form element within a form field\n * because the form field component automatically sets the correct labels to make the component accessible.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-required` on the group.\n */\n ariaRequired?: boolean;\n\n /**\n * The number of columns for the tiles to be displayed in. Valid values are integers between 1 and 4.\n * If no value is specified, the number of columns is determined based on the number of items, with a maximum of 3.\n * It is set to 2 if 4 or 8 items are supplied in order to optimize the layout.\n */\n columns?: number;\n\n /**\n * Called when the user selects a different tile.\n */\n onChange?: NonCancelableEventHandler<TilesProps.ChangeDetail>;\n\n /**\n * Adds `aria-controls` attribute to the component.\n * If the component controls any secondary content (for example, another form field), use this to provide an ID referring to the secondary content.\n */\n ariaControls?: string;\n}\n\nexport namespace TilesProps {\n export type Breakpoint = _Breakpoint;\n export interface TilesDefinition {\n value: string;\n label: React.ReactNode;\n description?: React.ReactNode;\n image?: React.ReactNode;\n disabled?: boolean;\n controlId?: string;\n }\n\n export interface ChangeDetail {\n value: string;\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the UI control.\n */\n focus(): void;\n }\n}\n"]}
|
package/tiles/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["tiles/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AASlF,QAAA,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["tiles/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AASlF,QAAA,MAAM,aAAa,gHAuDlB,CAAC;AAqBF,eAAe,aAAa,CAAC"}
|
package/tiles/internal.js
CHANGED
|
@@ -13,7 +13,7 @@ import { Tile } from './tile';
|
|
|
13
13
|
import useRadioGroupForwardFocus from '../internal/hooks/forward-focus/radio-group';
|
|
14
14
|
const COLUMN_TRIGGERS = ['default', 'xxs', 'xs'];
|
|
15
15
|
const InternalTiles = React.forwardRef((_a, ref) => {
|
|
16
|
-
var { value, items, ariaLabel, ariaRequired, ariaControls, columns, onChange, __internalRootRef = null } = _a, rest = __rest(_a, ["value", "items", "ariaLabel", "ariaRequired", "ariaControls", "columns", "onChange", "__internalRootRef"]);
|
|
16
|
+
var { name, value, items, ariaLabel, ariaRequired, ariaControls, columns, onChange, __internalRootRef = null } = _a, rest = __rest(_a, ["name", "value", "items", "ariaLabel", "ariaRequired", "ariaControls", "columns", "onChange", "__internalRootRef"]);
|
|
17
17
|
const baseProps = getBaseProps(rest);
|
|
18
18
|
const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);
|
|
19
19
|
const generatedName = useUniqueId('awsui-tiles-');
|
|
@@ -23,7 +23,7 @@ const InternalTiles = React.forwardRef((_a, ref) => {
|
|
|
23
23
|
const columnCount = getColumnCount(items, columns);
|
|
24
24
|
return (React.createElement("div", Object.assign({ role: "radiogroup", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-required": ariaRequired, "aria-controls": ariaControls }, baseProps, { className: clsx(baseProps.className, styles.root), ref: mergedRef }),
|
|
25
25
|
React.createElement("div", { className: clsx(styles.columns, styles[`column-${columnCount}`]) }, items &&
|
|
26
|
-
items.map((item, index) => (React.createElement(Tile, { ref: index === tileRefIndex ? tileRef : undefined, key: item.value, item: item, selected: item.value === value, name: generatedName, breakpoint: breakpoint, onChange: onChange }))))));
|
|
26
|
+
items.map((item, index) => (React.createElement(Tile, { ref: index === tileRefIndex ? tileRef : undefined, key: item.value, item: item, selected: item.value === value, name: name || generatedName, breakpoint: breakpoint, onChange: onChange }))))));
|
|
27
27
|
});
|
|
28
28
|
function getColumnCount(items, columns) {
|
|
29
29
|
if (columns) {
|
package/tiles/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["tiles/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,yBAAyB,MAAM,6CAA6C,CAAC;AAEpF,MAAM,eAAe,GAA4B,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAI1E,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CACpC,CACE,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["tiles/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAA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e,aAAa,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React from 'react';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { TilesProps } from './interfaces';\nimport styles from './styles.css.js';\n\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { Tile } from './tile';\nimport useRadioGroupForwardFocus from '../internal/hooks/forward-focus/radio-group';\n\nconst COLUMN_TRIGGERS: TilesProps.Breakpoint[] = ['default', 'xxs', 'xs'];\n\ntype InternalTilesProps = TilesProps & InternalBaseComponentProps;\n\nconst InternalTiles = React.forwardRef(\n (\n {\n name,\n value,\n items,\n ariaLabel,\n ariaRequired,\n ariaControls,\n columns,\n onChange,\n __internalRootRef = null,\n ...rest\n }: InternalTilesProps,\n ref: React.Ref<TilesProps.Ref>\n ) => {\n const baseProps = getBaseProps(rest);\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);\n const generatedName = useUniqueId('awsui-tiles-');\n\n const [tileRef, tileRefIndex] = useRadioGroupForwardFocus(ref, items, value);\n const [breakpoint, breakpointRef] = useContainerBreakpoints(COLUMN_TRIGGERS);\n const mergedRef = useMergeRefs(breakpointRef, __internalRootRef);\n\n const columnCount = getColumnCount(items, columns);\n\n return (\n <div\n role=\"radiogroup\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n aria-required={ariaRequired}\n aria-controls={ariaControls}\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n ref={mergedRef}\n >\n <div className={clsx(styles.columns, styles[`column-${columnCount}`])}>\n {items &&\n items.map((item, index) => (\n <Tile\n ref={index === tileRefIndex ? tileRef : undefined}\n key={item.value}\n item={item}\n selected={item.value === value}\n name={name || generatedName}\n breakpoint={breakpoint}\n onChange={onChange}\n />\n ))}\n </div>\n </div>\n );\n }\n);\n\nfunction getColumnCount(\n items: ReadonlyArray<TilesProps.TilesDefinition> | undefined,\n columns: number | undefined\n): number {\n if (columns) {\n return columns;\n }\n\n const nItems = items ? items.length : 0;\n const columnsLookup: Record<number, number> = {\n 0: 1,\n 1: 1,\n 2: 2,\n 4: 2,\n 8: 2,\n };\n return columnsLookup[nItems] || 3;\n}\n\nexport default InternalTiles;\n"]}
|
|
@@ -45,12 +45,14 @@ export interface TopNavigationProps extends BaseComponentProps {
|
|
|
45
45
|
* * `external` (boolean) - Marks the link as external by adding an icon after the text. When clicked, the link opens in a new tab.
|
|
46
46
|
* * `externalIconAriaLabel` (string) - Adds an `aria-label` for the external icon.
|
|
47
47
|
* * `onClick` (() => void) - Specifies the event handler called when the utility is clicked.
|
|
48
|
+
* * `onFollow` (() => void) - Specifies the event handler called when the utility is clicked without pressing modifier keys, and the utility has an `href` set.
|
|
48
49
|
*
|
|
49
50
|
* ### menu-dropdown
|
|
50
51
|
*
|
|
51
52
|
* * `description` (string) - The description displayed inside the dropdown.
|
|
52
53
|
* * `items` (ButtonDropdownProps.Items) - An array of dropdown items. This follows the same structure as the `items` property of the [button dropdown component](/components/button-dropdown).
|
|
53
54
|
* * `onItemClick` (NonCancelableEventHandler<ButtonDropdownProps.ItemClickDetails>) - Specifies the event handler called when a dropdown item is selected.
|
|
55
|
+
* * `onItemFollow` (NonCancelableEventHandler<ButtonDropdownProps.ItemClickDetails>) - Specifies the event handler called when a dropdown item is selected without pressing modifier keys, and the item has an `href` set.
|
|
54
56
|
*/
|
|
55
57
|
utilities?: ReadonlyArray<TopNavigationProps.Utility>;
|
|
56
58
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["top-navigation/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EA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EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,qBAAqB,CAAC,EAAE,MAAM,CAAC;KAChC;IAED,MAAM,MAAM,OAAO,GAAG,mBAAmB,GAAG,aAAa,CAAC;IAE1D,MAAM,WAAW,WAAW;QAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,0BAA0B,CAAC,EAAE,MAAM,CAAC;QACpC,gCAAgC,CAAC,EAAE,MAAM,CAAC;QAC1C,6BAA6B,CAAC,EAAE,MAAM,CAAC;QACvC,uBAAuB,EAAE,MAAM,CAAC;QAChC,qBAAqB,EAAE,MAAM,CAAC;KAC/B;;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["top-navigation/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { CancelableEventHandler } from '../internal/events';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { IconProps } from '../icon/interfaces';\nimport { ButtonDropdownProps } from '../button-dropdown/interfaces';\nimport { ButtonProps } from '../button/interfaces';\n\nexport interface TopNavigationProps extends BaseComponentProps {\n /**\n * Properties describing the product identity. They are as follows:\n *\n * * `title` (string) - Specifies the title text.\n * * `logo` ({ src: string, alt: string }) - Specifies the logo for the product. Use fixed width and height for SVG images to ensure proper rendering.\n * * `href` (string) - Specifies the `href` that the header links to.\n * * `onFollow` (() => void) - Specifies the event handler called when the identity is clicked without any modifier keys.\n */\n identity: TopNavigationProps.Identity;\n\n /**\n * Use with an input or autosuggest control for a global search query.\n */\n search?: React.ReactNode;\n\n /**\n * A list of utility navigation elements.\n * The supported utility types are: `button` and `menu-dropdown`.\n *\n * The following properties are supported across all utility types:\n *\n * * `type` (string) - The type of the utility. Can be `button` or `menu-dropdown`.\n * * `text` (string) - Specifies the text shown in the top navigation or the title inside the dropdown if no explicit `title` property is set.\n * * `title` (string) - The title displayed inside the dropdown.\n * * `iconName` (string) - The name of an existing icon to display next to the utility.\n * * `iconUrl` (string) - Specifies the URL of a custom icon. Use this property if the icon you want isn't available.\n * * `iconAlt` (string) - Specifies alternate text for a custom icon provided using `iconUrl`. We recommend that you provide this for accessibility.\n * * `iconSvg` (string) - Specifies the SVG of a custom icon.\n * * `ariaLabel` (string) - Adds `aria-label` to the button or dropdown trigger. This is recommended for accessibility if a text is not provided.\n * * `badge` (boolean) - Adds a badge to the corner of the icon to indicate a state change. For example: Unread notifications.\n * * `disableTextCollapse` (boolean) - Prevents the utility text from being hidden on smaller screens.\n * * `disableUtilityCollapse` (boolean) - Prevents the utility from being moved to an overflow menu on smaller screens.\n *\n * ### button\n *\n * * `variant` ('primary-button' | 'link') - The visual appearance of the button. The default value is 'link'.\n * * `href` (string) - Specifies the `href` for a link styled as a button.\n * * `target` (string) - Specifies where to open the linked URL (for example, to open in a new browser window or tab use `_blank`). This property only applies when an `href` is provided.\n * * `rel` (string) - Adds a `rel` attribute to the link. By default, the component sets the `rel` attribute to \"noopener noreferrer\" when `target` is `\"_blank\"`. If the `rel` property is provided, it overrides the default behavior.\n * * `external` (boolean) - Marks the link as external by adding an icon after the text. When clicked, the link opens in a new tab.\n * * `externalIconAriaLabel` (string) - Adds an `aria-label` for the external icon.\n * * `onClick` (() => void) - Specifies the event handler called when the utility is clicked.\n *\n * ### menu-dropdown\n *\n * * `description` (string) - The description displayed inside the dropdown.\n * * `items` (ButtonDropdownProps.Items) - An array of dropdown items. This follows the same structure as the `items` property of the [button dropdown component](/components/button-dropdown).\n * * `onItemClick` (NonCancelableEventHandler<ButtonDropdownProps.ItemClickDetails>) - Specifies the event handler called when a dropdown item is selected.\n */\n utilities?: ReadonlyArray<TopNavigationProps.Utility>;\n\n /**\n * An object containing all the localized strings required by the component.\n */\n i18nStrings: TopNavigationProps.I18nStrings;\n}\n\nexport namespace TopNavigationProps {\n export interface Identity {\n title?: string;\n logo?: Logo;\n href: string;\n onFollow?: CancelableEventHandler;\n }\n\n export interface Logo {\n src: string;\n alt?: string;\n }\n\n interface BaseUtility {\n text?: string;\n title?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconAlt?: string;\n iconSvg?: React.ReactNode;\n ariaLabel?: string;\n\n badge?: boolean;\n disableUtilityCollapse?: boolean;\n disableTextCollapse?: boolean;\n }\n\n export interface MenuDropdownUtility extends BaseUtility {\n type: 'menu-dropdown';\n description?: string;\n items: ButtonDropdownProps.Items;\n onItemClick?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n onItemFollow?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n }\n\n export interface ButtonUtility extends BaseUtility {\n type: 'button';\n variant?: 'primary-button' | 'link';\n onClick?: CancelableEventHandler;\n onFollow?: CancelableEventHandler<ButtonProps.FollowDetail>;\n href?: string;\n target?: string;\n rel?: string;\n external?: boolean;\n externalIconAriaLabel?: string;\n }\n\n export type Utility = MenuDropdownUtility | ButtonUtility;\n\n export interface I18nStrings {\n searchIconAriaLabel?: string;\n searchDismissIconAriaLabel?: string;\n overflowMenuDismissIconAriaLabel?: string;\n overflowMenuBackIconAriaLabel?: string;\n overflowMenuTriggerText: string;\n overflowMenuTitleText: string;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["top-navigation/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { CancelableEventHandler } from '../internal/events';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { IconProps } from '../icon/interfaces';\nimport { ButtonDropdownProps } from '../button-dropdown/interfaces';\nimport { ButtonProps } from '../button/interfaces';\n\nexport interface TopNavigationProps extends BaseComponentProps {\n /**\n * Properties describing the product identity. They are as follows:\n *\n * * `title` (string) - Specifies the title text.\n * * `logo` ({ src: string, alt: string }) - Specifies the logo for the product. Use fixed width and height for SVG images to ensure proper rendering.\n * * `href` (string) - Specifies the `href` that the header links to.\n * * `onFollow` (() => void) - Specifies the event handler called when the identity is clicked without any modifier keys.\n */\n identity: TopNavigationProps.Identity;\n\n /**\n * Use with an input or autosuggest control for a global search query.\n */\n search?: React.ReactNode;\n\n /**\n * A list of utility navigation elements.\n * The supported utility types are: `button` and `menu-dropdown`.\n *\n * The following properties are supported across all utility types:\n *\n * * `type` (string) - The type of the utility. Can be `button` or `menu-dropdown`.\n * * `text` (string) - Specifies the text shown in the top navigation or the title inside the dropdown if no explicit `title` property is set.\n * * `title` (string) - The title displayed inside the dropdown.\n * * `iconName` (string) - The name of an existing icon to display next to the utility.\n * * `iconUrl` (string) - Specifies the URL of a custom icon. Use this property if the icon you want isn't available.\n * * `iconAlt` (string) - Specifies alternate text for a custom icon provided using `iconUrl`. We recommend that you provide this for accessibility.\n * * `iconSvg` (string) - Specifies the SVG of a custom icon.\n * * `ariaLabel` (string) - Adds `aria-label` to the button or dropdown trigger. This is recommended for accessibility if a text is not provided.\n * * `badge` (boolean) - Adds a badge to the corner of the icon to indicate a state change. For example: Unread notifications.\n * * `disableTextCollapse` (boolean) - Prevents the utility text from being hidden on smaller screens.\n * * `disableUtilityCollapse` (boolean) - Prevents the utility from being moved to an overflow menu on smaller screens.\n *\n * ### button\n *\n * * `variant` ('primary-button' | 'link') - The visual appearance of the button. The default value is 'link'.\n * * `href` (string) - Specifies the `href` for a link styled as a button.\n * * `target` (string) - Specifies where to open the linked URL (for example, to open in a new browser window or tab use `_blank`). This property only applies when an `href` is provided.\n * * `rel` (string) - Adds a `rel` attribute to the link. By default, the component sets the `rel` attribute to \"noopener noreferrer\" when `target` is `\"_blank\"`. If the `rel` property is provided, it overrides the default behavior.\n * * `external` (boolean) - Marks the link as external by adding an icon after the text. When clicked, the link opens in a new tab.\n * * `externalIconAriaLabel` (string) - Adds an `aria-label` for the external icon.\n * * `onClick` (() => void) - Specifies the event handler called when the utility is clicked.\n * * `onFollow` (() => void) - Specifies the event handler called when the utility is clicked without pressing modifier keys, and the utility has an `href` set.\n *\n * ### menu-dropdown\n *\n * * `description` (string) - The description displayed inside the dropdown.\n * * `items` (ButtonDropdownProps.Items) - An array of dropdown items. This follows the same structure as the `items` property of the [button dropdown component](/components/button-dropdown).\n * * `onItemClick` (NonCancelableEventHandler<ButtonDropdownProps.ItemClickDetails>) - Specifies the event handler called when a dropdown item is selected.\n * * `onItemFollow` (NonCancelableEventHandler<ButtonDropdownProps.ItemClickDetails>) - Specifies the event handler called when a dropdown item is selected without pressing modifier keys, and the item has an `href` set.\n */\n utilities?: ReadonlyArray<TopNavigationProps.Utility>;\n\n /**\n * An object containing all the localized strings required by the component.\n */\n i18nStrings: TopNavigationProps.I18nStrings;\n}\n\nexport namespace TopNavigationProps {\n export interface Identity {\n title?: string;\n logo?: Logo;\n href: string;\n onFollow?: CancelableEventHandler;\n }\n\n export interface Logo {\n src: string;\n alt?: string;\n }\n\n interface BaseUtility {\n text?: string;\n title?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconAlt?: string;\n iconSvg?: React.ReactNode;\n ariaLabel?: string;\n\n badge?: boolean;\n disableUtilityCollapse?: boolean;\n disableTextCollapse?: boolean;\n }\n\n export interface MenuDropdownUtility extends BaseUtility {\n type: 'menu-dropdown';\n description?: string;\n items: ButtonDropdownProps.Items;\n onItemClick?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n onItemFollow?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n }\n\n export interface ButtonUtility extends BaseUtility {\n type: 'button';\n variant?: 'primary-button' | 'link';\n onClick?: CancelableEventHandler;\n onFollow?: CancelableEventHandler<ButtonProps.FollowDetail>;\n href?: string;\n target?: string;\n rel?: string;\n external?: boolean;\n externalIconAriaLabel?: string;\n }\n\n export type Utility = MenuDropdownUtility | ButtonUtility;\n\n export interface I18nStrings {\n searchIconAriaLabel?: string;\n searchDismissIconAriaLabel?: string;\n overflowMenuDismissIconAriaLabel?: string;\n overflowMenuBackIconAriaLabel?: string;\n overflowMenuTriggerText: string;\n overflowMenuTitleText: string;\n }\n}\n"]}
|
|
@@ -3,6 +3,7 @@ import { ButtonDropdownProps } from '../../../button-dropdown/interfaces';
|
|
|
3
3
|
import { TopNavigationProps } from '../../interfaces';
|
|
4
4
|
type UtilityMenuItemProps = TopNavigationProps.Utility & {
|
|
5
5
|
index: number;
|
|
6
|
+
onClose?: () => void;
|
|
6
7
|
};
|
|
7
8
|
export declare const UtilityMenuItem: React.ForwardRefExoticComponent<UtilityMenuItemProps & React.RefAttributes<HTMLAnchorElement & HTMLButtonElement>>;
|
|
8
9
|
type SubmenuItemProps = ButtonDropdownProps.ItemOrGroup & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-item.d.ts","sourceRoot":"lib/default/","sources":["top-navigation/parts/overflow-menu/menu-item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAOpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAI1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"menu-item.d.ts","sourceRoot":"lib/default/","sources":["top-navigation/parts/overflow-menu/menu-item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAOpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAI1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAiRtD,KAAK,oBAAoB,GAAG,kBAAkB,CAAC,OAAO,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAEjG,eAAO,MAAM,eAAe,oHAQ3B,CAAC;AAEF,KAAK,gBAAgB,GAAG,mBAAmB,CAAC,WAAW,GAAG;IACxD,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,mBAAmB,CAAC,IAAI,KAAK,IAAI,CAAC;CAC5E,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,gBAAgB,gBAclD,CAAC"}
|
|
@@ -55,10 +55,12 @@ function utilityComponentFactory(utility, index, ref) {
|
|
|
55
55
|
switch (utility.type) {
|
|
56
56
|
case 'button': {
|
|
57
57
|
const handleClick = (event) => {
|
|
58
|
+
var _a;
|
|
58
59
|
if (Boolean(utility.href) && isPlainLeftClick(event)) {
|
|
59
60
|
fireCancelableEvent(utility.onFollow, { href: utility.href, target: utility.target }, event);
|
|
60
61
|
}
|
|
61
62
|
fireCancelableEvent(utility.onClick, {}, event);
|
|
63
|
+
(_a = utility.onClose) === null || _a === void 0 ? void 0 : _a.call(utility);
|
|
62
64
|
};
|
|
63
65
|
const content = (React.createElement(React.Fragment, null,
|
|
64
66
|
label,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-item.js","sourceRoot":"lib/default/","sources":["top-navigation/parts/overflow-menu/menu-item.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAIpE,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAUzC,MAAM,QAAQ,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAiB,EAAE,EAAE;IACnE,OAAO,CACL;QACG,SAAS,IAAI,8BAAM,SAAS,EAAE,MAAM,CAAC,8BAA8B,CAAC,IA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CAAC,EACzC,UAAU,IAAI,MAAM,CAAC,oCAAoC,CAAC,CAC3D,IAEA,wBAAwB,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CACxD,CACN,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { fireCancelableEvent, isPlainLeftClick } from '../../../internal/events';\nimport { useUniqueId } from '../../../internal/hooks/use-unique-id';\n\nimport { LinkProps } from '../../../link/interfaces';\nimport { ButtonDropdownProps } from '../../../button-dropdown/interfaces';\nimport InternalIcon from '../../../icon/internal';\n\nimport { useNavigate } from './router';\nimport { TopNavigationProps } from '../../interfaces';\nimport styles from '../../styles.css.js';\n\ninterface ListItemProps {\n startIcon?: React.ReactNode;\n endIcon?: React.ReactNode;\n context?: 'dropdown-menu';\n children?: React.ReactNode;\n testId?: string;\n}\n\nconst ListItem = ({ children, startIcon, endIcon }: ListItemProps) => {\n return (\n <>\n {startIcon && <span className={styles['overflow-menu-list-item-icon']}>{startIcon}</span>}\n <span className={styles['overflow-menu-list-item-text']}>{children}</span>\n {endIcon && endIcon}\n </>\n );\n};\n\ninterface LinkItemProps extends ButtonItemProps, Pick<LinkProps, 'href' | 'external' | 'target' | 'rel'> {}\n\nconst LinkItem = forwardRef(\n (\n { children, external, href, target, rel, startIcon, endIcon, onClick, context, testId }: LinkItemProps,\n ref: React.Ref<HTMLAnchorElement & HTMLButtonElement>\n ) => {\n const anchorTarget = target ?? (external ? '_blank' : undefined);\n const anchorRel = rel ?? (anchorTarget === '_blank' ? 'noopener noreferrer' : undefined);\n\n return (\n <a\n ref={ref}\n onClick={onClick}\n className={clsx(\n styles['overflow-menu-control'],\n styles['overflow-menu-control-link'],\n context && styles[`overflow-menu-control-${context}`]\n )}\n href={href}\n target={anchorTarget}\n rel={anchorRel}\n {...(testId ? { 'data-testid': testId } : {})}\n >\n <ListItem startIcon={startIcon} endIcon={endIcon}>\n {children}\n </ListItem>\n </a>\n );\n }\n);\n\ninterface ButtonItemProps extends ListItemProps {\n onClick?: (event: React.MouseEvent) => void;\n}\n\nconst ButtonItem = forwardRef(\n (\n { children, startIcon, endIcon, onClick, testId }: ButtonItemProps & { testId?: string },\n ref: React.Ref<HTMLButtonElement>\n ) => {\n return (\n <button\n ref={ref}\n className={styles['overflow-menu-control']}\n onClick={onClick}\n {...(typeof testId === 'string' ? { 'data-testid': testId } : {})}\n >\n <ListItem startIcon={startIcon} endIcon={endIcon}>\n {children}\n </ListItem>\n </button>\n );\n }\n);\n\nconst NavigationItem = forwardRef(\n (\n {\n startIcon,\n children,\n index,\n testId,\n ...definition\n }: ButtonItemProps & TopNavigationProps.MenuDropdownUtility & { index: number; testId?: string },\n ref: React.Ref<HTMLButtonElement>\n ) => {\n const navigate = useNavigate();\n return (\n <ButtonItem\n ref={ref}\n startIcon={startIcon}\n endIcon={<InternalIcon name=\"angle-right\" />}\n testId={testId}\n onClick={() =>\n navigate('dropdown-menu', {\n definition,\n headerText: definition.text || definition.title,\n headerSecondaryText: definition.description,\n utilityIndex: index,\n })\n }\n >\n {children}\n </ButtonItem>\n );\n }\n);\n\nconst ExpandableItem: React.FC<\n ButtonItemProps &\n ButtonDropdownProps.ItemGroup & { onItemClick: (event: React.MouseEvent, item: ButtonDropdownProps.Item) => void }\n> = ({ children, onItemClick, ...definition }) => {\n const [expanded, setExpanded] = useState(false);\n const headerId = useUniqueId('overflow-menu-item');\n\n return (\n <>\n <button\n className={clsx(styles['overflow-menu-control'], styles['overflow-menu-control-expandable-menu-trigger'])}\n onClick={() => setExpanded(value => !value)}\n aria-expanded={expanded}\n >\n <ListItem\n endIcon={\n <span className={clsx(styles.icon, expanded && styles.expanded)}>\n <InternalIcon name=\"caret-up-filled\" />\n </span>\n }\n >\n <span id={headerId}>{children}</span>\n </ListItem>\n </button>\n {expanded && (\n <ul\n className={clsx(styles['overflow-menu-list'], styles['overflow-menu-list-submenu'])}\n aria-labelledby={headerId}\n >\n {definition.items.map((item, index) => {\n const isGroup = typeof (item as ButtonDropdownProps.ItemGroup).items !== 'undefined';\n\n return (\n <li\n key={index}\n className={clsx(styles[`overflow-menu-list-item`], styles[`overflow-menu-list-item-dropdown-menu`])}\n >\n {dropdownComponentFactory(item, isGroup, onItemClick)}\n </li>\n );\n })}\n </ul>\n )}\n </>\n );\n};\n\nfunction utilityComponentFactory(\n utility: TopNavigationProps.Utility,\n index: number,\n ref?: React.Ref<HTMLAnchorElement & HTMLButtonElement>\n) {\n const label = utility.text || utility.title;\n const hasIcon = !!utility.iconName || !!utility.iconUrl || !!utility.iconAlt || !!utility.iconSvg;\n const startIcon = hasIcon && (\n <InternalIcon name={utility.iconName} url={utility.iconUrl} alt={utility.iconAlt} svg={utility.iconSvg} />\n );\n\n switch (utility.type) {\n case 'button': {\n const handleClick = (event: React.MouseEvent) => {\n if (Boolean(utility.href) && isPlainLeftClick(event)) {\n fireCancelableEvent(utility.onFollow, { href: utility.href, target: utility.target }, event);\n }\n\n fireCancelableEvent(utility.onClick, {}, event);\n };\n\n const content = (\n <>\n {label}\n {utility.external && (\n <>\n {' '}\n <span aria-label={utility.externalIconAriaLabel} role={utility.externalIconAriaLabel ? 'img' : undefined}>\n <InternalIcon name=\"external\" size=\"normal\" />\n </span>\n </>\n )}\n </>\n );\n\n if (!utility.href) {\n return (\n <ButtonItem ref={ref} startIcon={startIcon} onClick={handleClick} testId={`__${index}`}>\n {content}\n </ButtonItem>\n );\n }\n\n return (\n <LinkItem\n ref={ref}\n startIcon={startIcon}\n href={utility.href}\n external={utility.external}\n target={utility.target}\n rel={utility.rel}\n testId={`__${index}`}\n onClick={handleClick}\n >\n {content}\n </LinkItem>\n );\n }\n case 'menu-dropdown': {\n return (\n <NavigationItem\n ref={ref}\n startIcon={startIcon}\n index={index}\n {...(utility as TopNavigationProps.MenuDropdownUtility)}\n testId={`__${index}`}\n >\n {label}\n </NavigationItem>\n );\n }\n }\n}\n\nfunction dropdownComponentFactory(\n item: ButtonDropdownProps.ItemOrGroup,\n expandable: boolean,\n onItemClick: (event: React.MouseEvent, item: ButtonDropdownProps.Item) => void\n) {\n const label = item.text;\n const hasIcon = !!item.iconName || !!item.iconUrl || !!item.iconAlt || !!item.iconSvg;\n const startIcon = hasIcon && (\n <InternalIcon name={item.iconName} url={item.iconUrl} alt={item.iconAlt} svg={item.iconSvg} />\n );\n\n if (expandable) {\n return (\n <ExpandableItem {...(item as ButtonDropdownProps.ItemGroup)} onItemClick={onItemClick}>\n {label}\n </ExpandableItem>\n );\n }\n\n return (\n <LinkItem\n startIcon={startIcon}\n href={item.href}\n external={item.external}\n context=\"dropdown-menu\"\n testId={item.id}\n onClick={event => onItemClick(event, item as ButtonDropdownProps.Item)}\n >\n {label}\n {item.external && (\n <>\n {' '}\n <span aria-label={item.externalIconAriaLabel} role={item.externalIconAriaLabel ? 'img' : undefined}>\n <InternalIcon name=\"external\" size=\"normal\" />\n </span>\n </>\n )}\n </LinkItem>\n );\n}\n\ntype UtilityMenuItemProps = TopNavigationProps.Utility & { index: number };\n\nexport const UtilityMenuItem = forwardRef(\n ({ index, ...props }: UtilityMenuItemProps, ref: React.Ref<HTMLAnchorElement & HTMLButtonElement>) => {\n return (\n <li className={clsx(styles[`overflow-menu-list-item`], styles[`overflow-menu-list-item-utility`])}>\n {utilityComponentFactory(props, index, ref)}\n </li>\n );\n }\n);\n\ntype SubmenuItemProps = ButtonDropdownProps.ItemOrGroup & {\n onClick: (event: React.MouseEvent, item: ButtonDropdownProps.Item) => void;\n};\n\nexport const SubmenuItem = (props: SubmenuItemProps) => {\n const expandable = typeof (props as ButtonDropdownProps.ItemGroup).items !== 'undefined';\n\n return (\n <li\n className={clsx(\n styles[`overflow-menu-list-item`],\n styles[`overflow-menu-list-item-submenu`],\n expandable && styles[`overflow-menu-list-item-expandable`]\n )}\n >\n {dropdownComponentFactory(props, expandable, props.onClick)}\n </li>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,SAAS;gBAChG,oBAAC,YAAY,IAAC,IAAI,EAAC,UAAU,EAAC,IAAI,EAAC,QAAQ,GAAG,CACzC,CACN,CACJ,CACQ,CACZ,CAAC;AACJ,CAAC;AAID,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CACvC,CAAC,EAAyC,EAAE,GAAqD,EAAE,EAAE;QAApG,EAAE,KAAK,OAAkC,EAA7B,KAAK,cAAjB,SAAmB,CAAF;IAChB,OAAO,CACL,4BAAI,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,yBAAyB,CAAC,EAAE,MAAM,CAAC,iCAAiC,CAAC,CAAC,IAC9F,uBAAuB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CACxC,CACN,CAAC;AACJ,CAAC,CACF,CAAC;AAMF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAE,EAAE;IACrD,MAAM,UAAU,GAAG,OAAQ,KAAuC,CAAC,KAAK,KAAK,WAAW,CAAC;IAEzF,OAAO,CACL,4BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,yBAAyB,CAAC,EACjC,MAAM,CAAC,iCAAiC,CAAC,EACzC,UAAU,IAAI,MAAM,CAAC,oCAAoC,CAAC,CAC3D,IAEA,wBAAwB,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CACxD,CACN,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { fireCancelableEvent, isPlainLeftClick } from '../../../internal/events';\nimport { useUniqueId } from '../../../internal/hooks/use-unique-id';\n\nimport { LinkProps } from '../../../link/interfaces';\nimport { ButtonDropdownProps } from '../../../button-dropdown/interfaces';\nimport InternalIcon from '../../../icon/internal';\n\nimport { useNavigate } from './router';\nimport { TopNavigationProps } from '../../interfaces';\nimport styles from '../../styles.css.js';\n\ninterface ListItemProps {\n startIcon?: React.ReactNode;\n endIcon?: React.ReactNode;\n context?: 'dropdown-menu';\n children?: React.ReactNode;\n testId?: string;\n}\n\nconst ListItem = ({ children, startIcon, endIcon }: ListItemProps) => {\n return (\n <>\n {startIcon && <span className={styles['overflow-menu-list-item-icon']}>{startIcon}</span>}\n <span className={styles['overflow-menu-list-item-text']}>{children}</span>\n {endIcon && endIcon}\n </>\n );\n};\n\ninterface LinkItemProps extends ButtonItemProps, Pick<LinkProps, 'href' | 'external' | 'target' | 'rel'> {}\n\nconst LinkItem = forwardRef(\n (\n { children, external, href, target, rel, startIcon, endIcon, onClick, context, testId }: LinkItemProps,\n ref: React.Ref<HTMLAnchorElement & HTMLButtonElement>\n ) => {\n const anchorTarget = target ?? (external ? '_blank' : undefined);\n const anchorRel = rel ?? (anchorTarget === '_blank' ? 'noopener noreferrer' : undefined);\n\n return (\n <a\n ref={ref}\n onClick={onClick}\n className={clsx(\n styles['overflow-menu-control'],\n styles['overflow-menu-control-link'],\n context && styles[`overflow-menu-control-${context}`]\n )}\n href={href}\n target={anchorTarget}\n rel={anchorRel}\n {...(testId ? { 'data-testid': testId } : {})}\n >\n <ListItem startIcon={startIcon} endIcon={endIcon}>\n {children}\n </ListItem>\n </a>\n );\n }\n);\n\ninterface ButtonItemProps extends ListItemProps {\n onClick?: (event: React.MouseEvent) => void;\n}\n\nconst ButtonItem = forwardRef(\n (\n { children, startIcon, endIcon, onClick, testId }: ButtonItemProps & { testId?: string },\n ref: React.Ref<HTMLButtonElement>\n ) => {\n return (\n <button\n ref={ref}\n className={styles['overflow-menu-control']}\n onClick={onClick}\n {...(typeof testId === 'string' ? { 'data-testid': testId } : {})}\n >\n <ListItem startIcon={startIcon} endIcon={endIcon}>\n {children}\n </ListItem>\n </button>\n );\n }\n);\n\nconst NavigationItem = forwardRef(\n (\n {\n startIcon,\n children,\n index,\n testId,\n ...definition\n }: ButtonItemProps & TopNavigationProps.MenuDropdownUtility & { index: number; testId?: string },\n ref: React.Ref<HTMLButtonElement>\n ) => {\n const navigate = useNavigate();\n return (\n <ButtonItem\n ref={ref}\n startIcon={startIcon}\n endIcon={<InternalIcon name=\"angle-right\" />}\n testId={testId}\n onClick={() =>\n navigate('dropdown-menu', {\n definition,\n headerText: definition.text || definition.title,\n headerSecondaryText: definition.description,\n utilityIndex: index,\n })\n }\n >\n {children}\n </ButtonItem>\n );\n }\n);\n\nconst ExpandableItem: React.FC<\n ButtonItemProps &\n ButtonDropdownProps.ItemGroup & { onItemClick: (event: React.MouseEvent, item: ButtonDropdownProps.Item) => void }\n> = ({ children, onItemClick, ...definition }) => {\n const [expanded, setExpanded] = useState(false);\n const headerId = useUniqueId('overflow-menu-item');\n\n return (\n <>\n <button\n className={clsx(styles['overflow-menu-control'], styles['overflow-menu-control-expandable-menu-trigger'])}\n onClick={() => setExpanded(value => !value)}\n aria-expanded={expanded}\n >\n <ListItem\n endIcon={\n <span className={clsx(styles.icon, expanded && styles.expanded)}>\n <InternalIcon name=\"caret-up-filled\" />\n </span>\n }\n >\n <span id={headerId}>{children}</span>\n </ListItem>\n </button>\n {expanded && (\n <ul\n className={clsx(styles['overflow-menu-list'], styles['overflow-menu-list-submenu'])}\n aria-labelledby={headerId}\n >\n {definition.items.map((item, index) => {\n const isGroup = typeof (item as ButtonDropdownProps.ItemGroup).items !== 'undefined';\n\n return (\n <li\n key={index}\n className={clsx(styles[`overflow-menu-list-item`], styles[`overflow-menu-list-item-dropdown-menu`])}\n >\n {dropdownComponentFactory(item, isGroup, onItemClick)}\n </li>\n );\n })}\n </ul>\n )}\n </>\n );\n};\n\nfunction utilityComponentFactory(\n utility: TopNavigationProps.Utility & { onClose?: () => void },\n index: number,\n ref?: React.Ref<HTMLAnchorElement & HTMLButtonElement>\n) {\n const label = utility.text || utility.title;\n const hasIcon = !!utility.iconName || !!utility.iconUrl || !!utility.iconAlt || !!utility.iconSvg;\n const startIcon = hasIcon && (\n <InternalIcon name={utility.iconName} url={utility.iconUrl} alt={utility.iconAlt} svg={utility.iconSvg} />\n );\n\n switch (utility.type) {\n case 'button': {\n const handleClick = (event: React.MouseEvent) => {\n if (Boolean(utility.href) && isPlainLeftClick(event)) {\n fireCancelableEvent(utility.onFollow, { href: utility.href, target: utility.target }, event);\n }\n\n fireCancelableEvent(utility.onClick, {}, event);\n utility.onClose?.();\n };\n\n const content = (\n <>\n {label}\n {utility.external && (\n <>\n {' '}\n <span aria-label={utility.externalIconAriaLabel} role={utility.externalIconAriaLabel ? 'img' : undefined}>\n <InternalIcon name=\"external\" size=\"normal\" />\n </span>\n </>\n )}\n </>\n );\n\n if (!utility.href) {\n return (\n <ButtonItem ref={ref} startIcon={startIcon} onClick={handleClick} testId={`__${index}`}>\n {content}\n </ButtonItem>\n );\n }\n\n return (\n <LinkItem\n ref={ref}\n startIcon={startIcon}\n href={utility.href}\n external={utility.external}\n target={utility.target}\n rel={utility.rel}\n testId={`__${index}`}\n onClick={handleClick}\n >\n {content}\n </LinkItem>\n );\n }\n case 'menu-dropdown': {\n return (\n <NavigationItem\n ref={ref}\n startIcon={startIcon}\n index={index}\n {...(utility as TopNavigationProps.MenuDropdownUtility)}\n testId={`__${index}`}\n >\n {label}\n </NavigationItem>\n );\n }\n }\n}\n\nfunction dropdownComponentFactory(\n item: ButtonDropdownProps.ItemOrGroup,\n expandable: boolean,\n onItemClick: (event: React.MouseEvent, item: ButtonDropdownProps.Item) => void\n) {\n const label = item.text;\n const hasIcon = !!item.iconName || !!item.iconUrl || !!item.iconAlt || !!item.iconSvg;\n const startIcon = hasIcon && (\n <InternalIcon name={item.iconName} url={item.iconUrl} alt={item.iconAlt} svg={item.iconSvg} />\n );\n\n if (expandable) {\n return (\n <ExpandableItem {...(item as ButtonDropdownProps.ItemGroup)} onItemClick={onItemClick}>\n {label}\n </ExpandableItem>\n );\n }\n\n return (\n <LinkItem\n startIcon={startIcon}\n href={item.href}\n external={item.external}\n context=\"dropdown-menu\"\n testId={item.id}\n onClick={event => onItemClick(event, item as ButtonDropdownProps.Item)}\n >\n {label}\n {item.external && (\n <>\n {' '}\n <span aria-label={item.externalIconAriaLabel} role={item.externalIconAriaLabel ? 'img' : undefined}>\n <InternalIcon name=\"external\" size=\"normal\" />\n </span>\n </>\n )}\n </LinkItem>\n );\n}\n\ntype UtilityMenuItemProps = TopNavigationProps.Utility & { index: number; onClose?: () => void };\n\nexport const UtilityMenuItem = forwardRef(\n ({ index, ...props }: UtilityMenuItemProps, ref: React.Ref<HTMLAnchorElement & HTMLButtonElement>) => {\n return (\n <li className={clsx(styles[`overflow-menu-list-item`], styles[`overflow-menu-list-item-utility`])}>\n {utilityComponentFactory(props, index, ref)}\n </li>\n );\n }\n);\n\ntype SubmenuItemProps = ButtonDropdownProps.ItemOrGroup & {\n onClick: (event: React.MouseEvent, item: ButtonDropdownProps.Item) => void;\n};\n\nexport const SubmenuItem = (props: SubmenuItemProps) => {\n const expandable = typeof (props as ButtonDropdownProps.ItemGroup).items !== 'undefined';\n\n return (\n <li\n className={clsx(\n styles[`overflow-menu-list-item`],\n styles[`overflow-menu-list-item-submenu`],\n expandable && styles[`overflow-menu-list-item-expandable`]\n )}\n >\n {dropdownComponentFactory(props, expandable, props.onClick)}\n </li>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submenu.d.ts","sourceRoot":"lib/default/","sources":["top-navigation/parts/overflow-menu/views/submenu.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAI1B,UAAU,gBAAiB,SAAQ,IAAI;IACrC,UAAU,EAAE,kBAAkB,CAAC,mBAAmB,CAAC;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,QAAA,MAAM,WAAW,qHAQd,gBAAgB,
|
|
1
|
+
{"version":3,"file":"submenu.d.ts","sourceRoot":"lib/default/","sources":["top-navigation/parts/overflow-menu/views/submenu.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAI1B,UAAU,gBAAiB,SAAQ,IAAI;IACrC,UAAU,EAAE,kBAAkB,CAAC,mBAAmB,CAAC;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,QAAA,MAAM,WAAW,qHAQd,gBAAgB,gBA4ClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|