@cloudscape-design/components 3.0.43 → 3.0.46
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/autosuggest/internal.d.ts.map +1 -1
- package/autosuggest/internal.js +45 -78
- package/autosuggest/internal.js.map +1 -1
- package/autosuggest/load-more-controller.d.ts.map +1 -1
- package/autosuggest/load-more-controller.js +1 -1
- package/autosuggest/load-more-controller.js.map +1 -1
- package/autosuggest/options-controller.d.ts.map +1 -1
- package/autosuggest/options-controller.js +0 -1
- package/autosuggest/options-controller.js.map +1 -1
- package/autosuggest/styles.css.js +3 -4
- package/autosuggest/styles.scoped.css +3 -8
- package/autosuggest/styles.selectors.js +3 -4
- package/code-editor/index.d.ts.map +1 -1
- package/code-editor/index.js +13 -14
- package/code-editor/index.js.map +1 -1
- package/code-editor/styles.css.js +32 -33
- package/code-editor/styles.scoped.css +116 -122
- package/code-editor/styles.selectors.js +32 -33
- package/container/internal.d.ts +2 -1
- package/container/internal.d.ts.map +1 -1
- package/container/internal.js +3 -2
- package/container/internal.js.map +1 -1
- package/container/styles.css.js +16 -15
- package/container/styles.scoped.css +29 -24
- package/container/styles.selectors.js +16 -15
- package/date-picker/styles.css.js +24 -24
- package/date-picker/styles.scoped.css +41 -41
- package/date-picker/styles.selectors.js +24 -24
- package/date-range-picker/index.d.ts.map +1 -1
- package/date-range-picker/index.js +4 -9
- package/date-range-picker/index.js.map +1 -1
- package/date-range-picker/styles.css.js +41 -41
- package/date-range-picker/styles.scoped.css +50 -50
- package/date-range-picker/styles.selectors.js +41 -41
- package/expandable-section/expandable-section-container.d.ts.map +1 -1
- package/expandable-section/expandable-section-container.js +1 -1
- package/expandable-section/expandable-section-container.js.map +1 -1
- package/internal/components/autosuggest-input/index.d.ts +28 -0
- package/internal/components/autosuggest-input/index.d.ts.map +1 -0
- package/internal/components/autosuggest-input/index.js +141 -0
- package/internal/components/autosuggest-input/index.js.map +1 -0
- package/internal/components/autosuggest-input/styles.css.js +7 -0
- package/internal/components/autosuggest-input/styles.scoped.css +12 -0
- package/internal/components/autosuggest-input/styles.selectors.js +8 -0
- package/internal/environment.js +1 -1
- package/internal/generated/styles/tokens.d.ts +17 -0
- package/internal/generated/styles/tokens.js +17 -0
- package/internal/generated/theming/index.cjs +35 -1
- package/internal/generated/theming/index.cjs.d.ts +85 -0
- package/internal/generated/theming/index.d.ts +85 -0
- package/internal/generated/theming/index.js +35 -1
- package/internal/utils/date-time/format-date-range.d.ts +2 -0
- package/internal/utils/date-time/format-date-range.d.ts.map +1 -0
- package/internal/utils/date-time/format-date-range.js +11 -0
- package/internal/utils/date-time/format-date-range.js.map +1 -0
- package/internal/utils/date-time/index.d.ts +1 -0
- package/internal/utils/date-time/index.d.ts.map +1 -1
- package/internal/utils/date-time/index.js +1 -0
- package/internal/utils/date-time/index.js.map +1 -1
- package/package.json +1 -1
- package/property-filter/controller.d.ts +15 -29
- package/property-filter/controller.d.ts.map +1 -1
- package/property-filter/controller.js +10 -10
- package/property-filter/controller.js.map +1 -1
- package/property-filter/index.d.ts.map +1 -1
- package/property-filter/index.js +7 -13
- package/property-filter/index.js.map +1 -1
- package/property-filter/interfaces.d.ts +25 -0
- package/property-filter/interfaces.d.ts.map +1 -1
- package/property-filter/interfaces.js.map +1 -1
- package/property-filter/property-filter-autosuggest.d.ts +2 -3
- package/property-filter/property-filter-autosuggest.d.ts.map +1 -1
- package/property-filter/property-filter-autosuggest.js +39 -77
- package/property-filter/property-filter-autosuggest.js.map +1 -1
- package/property-filter/token-editor.d.ts +16 -7
- package/property-filter/token-editor.d.ts.map +1 -1
- package/property-filter/token-editor.js +1 -2
- package/property-filter/token-editor.js.map +1 -1
- package/property-filter/token.d.ts +20 -9
- package/property-filter/token.d.ts.map +1 -1
- package/property-filter/token.js +1 -1
- package/property-filter/token.js.map +1 -1
- package/property-filter/use-load-items.d.ts +1 -2
- package/property-filter/use-load-items.d.ts.map +1 -1
- package/property-filter/use-load-items.js.map +1 -1
- package/property-filter/utils.d.ts +4 -4
- package/property-filter/utils.d.ts.map +1 -1
- package/property-filter/utils.js.map +1 -1
- package/test-utils/dom/internal/autosuggest-input.d.ts +8 -0
- package/test-utils/dom/internal/autosuggest-input.js +41 -0
- package/test-utils/dom/internal/autosuggest-input.js.map +1 -0
- package/test-utils/selectors/internal/autosuggest-input.d.ts +8 -0
- package/test-utils/selectors/internal/autosuggest-input.js +41 -0
- package/test-utils/selectors/internal/autosuggest-input.js.map +1 -0
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/autosuggest/dropdown-controller.d.ts +0 -20
- package/autosuggest/dropdown-controller.d.ts.map +0 -1
- package/autosuggest/dropdown-controller.js +0 -29
- package/autosuggest/dropdown-controller.js.map +0 -1
- package/autosuggest/input-controller.d.ts +0 -12
- package/autosuggest/input-controller.d.ts.map +0 -1
- package/autosuggest/input-controller.js +0 -38
- package/autosuggest/input-controller.js.map +0 -1
|
@@ -90,11 +90,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
90
90
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
91
91
|
SPDX-License-Identifier: Apache-2.0
|
|
92
92
|
*/
|
|
93
|
-
.
|
|
94
|
-
animation: awsui_awsui-motion-fade-in-
|
|
93
|
+
.awsui_calendar_mgja0_z4fdg_93:not(#\9) {
|
|
94
|
+
animation: awsui_awsui-motion-fade-in-0_mgja0_z4fdg_1 var(--motion-duration-show-quick-tyaalm, 135ms) var(--motion-easing-show-quick-1fcgbv, ease-out);
|
|
95
95
|
animation-fill-mode: both;
|
|
96
96
|
}
|
|
97
|
-
@keyframes awsui_awsui-motion-fade-in-
|
|
97
|
+
@keyframes awsui_awsui-motion-fade-in-0_mgja0_z4fdg_1 {
|
|
98
98
|
from {
|
|
99
99
|
opacity: 0;
|
|
100
100
|
}
|
|
@@ -103,12 +103,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
@media (prefers-reduced-motion: reduce) {
|
|
106
|
-
.
|
|
106
|
+
.awsui_calendar_mgja0_z4fdg_93:not(#\9) {
|
|
107
107
|
animation: none;
|
|
108
108
|
transition: none;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
.awsui-motion-disabled .
|
|
111
|
+
.awsui-motion-disabled .awsui_calendar_mgja0_z4fdg_93:not(#\9), .awsui-mode-entering .awsui_calendar_mgja0_z4fdg_93:not(#\9) {
|
|
112
112
|
animation: none;
|
|
113
113
|
transition: none;
|
|
114
114
|
}
|
|
@@ -117,7 +117,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
117
117
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
118
118
|
SPDX-License-Identifier: Apache-2.0
|
|
119
119
|
*/
|
|
120
|
-
.
|
|
120
|
+
.awsui_root_mgja0_z4fdg_120:not(#\9) {
|
|
121
121
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
122
122
|
border-collapse: separate;
|
|
123
123
|
border-spacing: 0;
|
|
@@ -155,28 +155,28 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
155
155
|
max-width: 32em;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
.awsui_trigger-
|
|
158
|
+
.awsui_trigger-wrapper_mgja0_z4fdg_132:not(#\9) {
|
|
159
159
|
min-width: calc(var(--size-calendar-grid-width-lxsx0p, 238px) + 2 * var(--space-l-4vl6xu, 20px));
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
.awsui_trigger-
|
|
162
|
+
.awsui_trigger-flexbox_mgja0_z4fdg_136:not(#\9) {
|
|
163
163
|
display: flex;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
.
|
|
166
|
+
.awsui_calendar_mgja0_z4fdg_93:not(#\9) {
|
|
167
167
|
display: block;
|
|
168
168
|
width: calc(2 * var(--size-calendar-grid-width-lxsx0p, 238px) + var(--space-xs-rsr2qu, 8px));
|
|
169
169
|
}
|
|
170
|
-
.
|
|
170
|
+
.awsui_calendar_mgja0_z4fdg_93.awsui_one-grid_mgja0_z4fdg_144:not(#\9) {
|
|
171
171
|
width: var(--size-calendar-grid-width-lxsx0p, 238px);
|
|
172
172
|
}
|
|
173
|
-
.awsui_calendar-
|
|
173
|
+
.awsui_calendar-header_mgja0_z4fdg_147:not(#\9) {
|
|
174
174
|
display: flex;
|
|
175
175
|
justify-content: space-between;
|
|
176
176
|
align-items: center;
|
|
177
177
|
position: relative;
|
|
178
178
|
}
|
|
179
|
-
.awsui_calendar-header-months-
|
|
179
|
+
.awsui_calendar-header-months-wrapper_mgja0_z4fdg_153:not(#\9) {
|
|
180
180
|
position: absolute;
|
|
181
181
|
right: 0;
|
|
182
182
|
left: 0;
|
|
@@ -188,7 +188,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
188
188
|
flex: 1;
|
|
189
189
|
pointer-events: none;
|
|
190
190
|
}
|
|
191
|
-
.awsui_calendar-header-
|
|
191
|
+
.awsui_calendar-header-month_mgja0_z4fdg_153:not(#\9) {
|
|
192
192
|
font-size: var(--font-body-m-size-sregvd, 14px);
|
|
193
193
|
line-height: var(--font-body-m-line-height-i7xxvv, 22px);
|
|
194
194
|
font-weight: 700;
|
|
@@ -196,17 +196,17 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
196
196
|
display: flex;
|
|
197
197
|
pointer-events: auto;
|
|
198
198
|
}
|
|
199
|
-
.awsui_calendar-next-month-
|
|
199
|
+
.awsui_calendar-next-month-btn_mgja0_z4fdg_173:not(#\9) {
|
|
200
200
|
/* used for identifying element */
|
|
201
201
|
}
|
|
202
|
-
.awsui_calendar-prev-month-
|
|
202
|
+
.awsui_calendar-prev-month-btn_mgja0_z4fdg_176:not(#\9) {
|
|
203
203
|
/* used for identifying element */
|
|
204
204
|
}
|
|
205
|
-
.awsui_calendar-day-
|
|
205
|
+
.awsui_calendar-day-names_mgja0_z4fdg_179:not(#\9) {
|
|
206
206
|
display: flex;
|
|
207
207
|
justify-content: stretch;
|
|
208
208
|
}
|
|
209
|
-
.awsui_calendar-day-
|
|
209
|
+
.awsui_calendar-day-name_mgja0_z4fdg_179:not(#\9) {
|
|
210
210
|
flex: 1 1 0%;
|
|
211
211
|
width: 0;
|
|
212
212
|
word-break: break-word;
|
|
@@ -217,133 +217,133 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
217
217
|
line-height: var(--font-body-s-line-height-kdsbrl, 16px);
|
|
218
218
|
letter-spacing: var(--font-body-s-letter-spacing-cy0oxj, 0.005em);
|
|
219
219
|
}
|
|
220
|
-
.awsui_calendar-
|
|
220
|
+
.awsui_calendar-week_mgja0_z4fdg_194:not(#\9) {
|
|
221
221
|
display: flex;
|
|
222
222
|
justify-content: stretch;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
.awsui_first-
|
|
226
|
-
.awsui_second-
|
|
225
|
+
.awsui_first-grid_mgja0_z4fdg_199:not(#\9),
|
|
226
|
+
.awsui_second-grid_mgja0_z4fdg_200:not(#\9) {
|
|
227
227
|
/* used in test-utils */
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
.
|
|
230
|
+
.awsui_grid_mgja0_z4fdg_204:not(#\9) {
|
|
231
231
|
width: var(--size-calendar-grid-width-lxsx0p, 238px);
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
.awsui_date-and-time-
|
|
234
|
+
.awsui_date-and-time-wrapper_mgja0_z4fdg_208:not(#\9) {
|
|
235
235
|
display: flex;
|
|
236
236
|
width: var(--size-calendar-grid-width-lxsx0p, 238px);
|
|
237
237
|
}
|
|
238
|
-
.awsui_date-and-time-
|
|
238
|
+
.awsui_date-and-time-wrapper__date_mgja0_z4fdg_212:not(#\9) {
|
|
239
239
|
margin-right: var(--space-xs-rsr2qu, 8px);
|
|
240
240
|
}
|
|
241
|
-
.awsui_date-and-time-
|
|
241
|
+
.awsui_date-and-time-wrapper_mgja0_z4fdg_208 > .awsui_date-and-time-wrapper__time_mgja0_z4fdg_215:not(#\9), .awsui_date-and-time-wrapper_mgja0_z4fdg_208 > .awsui_date-and-time-wrapper__date_mgja0_z4fdg_212:not(#\9) {
|
|
242
242
|
flex-grow: 1;
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
.awsui_date-and-time-
|
|
245
|
+
.awsui_date-and-time-constrainttext_mgja0_z4fdg_219:not(#\9) {
|
|
246
246
|
color: var(--color-text-form-secondary-ih9x7l, #5f6b7a);
|
|
247
247
|
font-size: var(--font-body-s-size-ukw2p9, 12px);
|
|
248
248
|
line-height: var(--font-body-s-line-height-kdsbrl, 16px);
|
|
249
249
|
letter-spacing: var(--font-body-s-letter-spacing-cy0oxj, 0.005em);
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
.
|
|
252
|
+
.awsui_footer_mgja0_z4fdg_226:not(#\9) {
|
|
253
253
|
display: flex;
|
|
254
254
|
flex-wrap: wrap;
|
|
255
255
|
justify-content: flex-end;
|
|
256
256
|
border-top: 1px solid var(--color-border-dropdown-item-default-faosd8, #e9ebed);
|
|
257
257
|
padding: 0 var(--space-l-4vl6xu, 20px) var(--space-s-hv8c1d, 12px);
|
|
258
258
|
}
|
|
259
|
-
.
|
|
259
|
+
.awsui_footer_mgja0_z4fdg_226.awsui_has-clear-button_mgja0_z4fdg_233:not(#\9) {
|
|
260
260
|
justify-content: space-between;
|
|
261
261
|
}
|
|
262
|
-
.
|
|
262
|
+
.awsui_footer_mgja0_z4fdg_226.awsui_one-grid_mgja0_z4fdg_144:not(#\9) {
|
|
263
263
|
padding: 0 var(--space-xs-rsr2qu, 8px) var(--space-s-hv8c1d, 12px);
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
.awsui_footer-button-
|
|
266
|
+
.awsui_footer-button-wrapper_mgja0_z4fdg_240:not(#\9) {
|
|
267
267
|
padding-top: var(--space-s-hv8c1d, 12px);
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
.awsui_icon-
|
|
270
|
+
.awsui_icon-wrapper_mgja0_z4fdg_244:not(#\9) {
|
|
271
271
|
color: var(--color-text-interactive-default-eg5fsa, #414d5c);
|
|
272
272
|
margin-right: var(--space-xs-rsr2qu, 8px);
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
.
|
|
275
|
+
.awsui_label_mgja0_z4fdg_249:not(#\9) {
|
|
276
276
|
-webkit-user-select: text;
|
|
277
277
|
user-select: text;
|
|
278
278
|
cursor: default;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
.
|
|
281
|
+
.awsui_label_mgja0_z4fdg_249.awsui_label-enabled_mgja0_z4fdg_254:not(#\9):hover > .awsui_trigger-flexbox_mgja0_z4fdg_136 > .awsui_icon-wrapper_mgja0_z4fdg_244 {
|
|
282
282
|
color: var(--color-text-interactive-hover-v3lasm, #000716);
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
.awsui_label-
|
|
285
|
+
.awsui_label-text_mgja0_z4fdg_258:not(#\9) {
|
|
286
286
|
color: var(--color-text-input-placeholder-j53j3c, #5f6b7a);
|
|
287
287
|
font-style: italic;
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
.awsui_mode-
|
|
290
|
+
.awsui_mode-switch_mgja0_z4fdg_263:not(#\9) {
|
|
291
291
|
/* used in test-utils */
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
.
|
|
294
|
+
.awsui_dropdown_mgja0_z4fdg_267:not(#\9) {
|
|
295
295
|
overflow: auto;
|
|
296
296
|
border-top: 1px solid var(--color-border-container-top-srcvx4, transparent);
|
|
297
297
|
border-bottom: 1px solid var(--color-border-container-top-srcvx4, transparent);
|
|
298
298
|
border-radius: var(--border-radius-dropdown-ujknaf, 8px);
|
|
299
299
|
}
|
|
300
|
-
.
|
|
300
|
+
.awsui_dropdown_mgja0_z4fdg_267:not(#\9):focus {
|
|
301
301
|
outline: none;
|
|
302
302
|
}
|
|
303
|
-
.
|
|
303
|
+
.awsui_dropdown_mgja0_z4fdg_267[data-awsui-focus-visible=true]:not(#\9):focus {
|
|
304
304
|
outline: 2px dotted transparent;
|
|
305
305
|
outline-offset: 2px;
|
|
306
|
-
border-radius: var(--border-radius-
|
|
306
|
+
border-radius: var(--border-radius-dropdown-ujknaf, 8px);
|
|
307
307
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-ap3b6s, #0972d3);
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
.awsui_dropdown-
|
|
310
|
+
.awsui_dropdown-content_mgja0_z4fdg_283:not(#\9) {
|
|
311
311
|
-webkit-user-select: text;
|
|
312
312
|
user-select: text;
|
|
313
313
|
background-color: var(--color-background-container-content-i8i4a0, #ffffff);
|
|
314
314
|
width: calc(2 * var(--size-calendar-grid-width-lxsx0p, 238px) + var(--space-xs-rsr2qu, 8px) + 2 * var(--space-l-4vl6xu, 20px));
|
|
315
315
|
}
|
|
316
|
-
.awsui_dropdown-
|
|
316
|
+
.awsui_dropdown-content_mgja0_z4fdg_283.awsui_one-grid_mgja0_z4fdg_144:not(#\9) {
|
|
317
317
|
width: calc(var(--size-calendar-grid-width-lxsx0p, 238px) + 2 * var(--space-l-4vl6xu, 20px));
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
.awsui_start-date-
|
|
321
|
-
.awsui_start-time-
|
|
322
|
-
.awsui_end-date-
|
|
323
|
-
.awsui_end-time-
|
|
320
|
+
.awsui_start-date-input_mgja0_z4fdg_292:not(#\9),
|
|
321
|
+
.awsui_start-time-input_mgja0_z4fdg_293:not(#\9),
|
|
322
|
+
.awsui_end-date-input_mgja0_z4fdg_294:not(#\9),
|
|
323
|
+
.awsui_end-time-input_mgja0_z4fdg_295:not(#\9) {
|
|
324
324
|
/* used in test-utils */
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
.awsui_validation-
|
|
327
|
+
.awsui_validation-section_mgja0_z4fdg_299:not(#\9) {
|
|
328
328
|
/* used in test-utils */
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
-
.awsui_validation-
|
|
331
|
+
.awsui_validation-error_mgja0_z4fdg_303:not(#\9) {
|
|
332
332
|
/* used in test-utils */
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
-
.awsui_clear-
|
|
335
|
+
.awsui_clear-button_mgja0_z4fdg_307:not(#\9) {
|
|
336
336
|
/* used in test-utils */
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
.awsui_apply-
|
|
339
|
+
.awsui_apply-button_mgja0_z4fdg_311:not(#\9) {
|
|
340
340
|
/* used in test-utils */
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
.awsui_cancel-
|
|
343
|
+
.awsui_cancel-button_mgja0_z4fdg_315:not(#\9) {
|
|
344
344
|
/* used in test-utils */
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
-
.awsui_calendar-aria-
|
|
347
|
+
.awsui_calendar-aria-live_mgja0_z4fdg_319:not(#\9) {
|
|
348
348
|
/* used in test-utils */
|
|
349
349
|
}
|
|
@@ -2,46 +2,46 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"calendar": "
|
|
6
|
-
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-
|
|
7
|
-
"root": "
|
|
8
|
-
"trigger-wrapper": "awsui_trigger-
|
|
9
|
-
"trigger-flexbox": "awsui_trigger-
|
|
10
|
-
"one-grid": "awsui_one-
|
|
11
|
-
"calendar-header": "awsui_calendar-
|
|
12
|
-
"calendar-header-months-wrapper": "awsui_calendar-header-months-
|
|
13
|
-
"calendar-header-month": "awsui_calendar-header-
|
|
14
|
-
"calendar-next-month-btn": "awsui_calendar-next-month-
|
|
15
|
-
"calendar-prev-month-btn": "awsui_calendar-prev-month-
|
|
16
|
-
"calendar-day-names": "awsui_calendar-day-
|
|
17
|
-
"calendar-day-name": "awsui_calendar-day-
|
|
18
|
-
"calendar-week": "awsui_calendar-
|
|
19
|
-
"first-grid": "awsui_first-
|
|
20
|
-
"second-grid": "awsui_second-
|
|
21
|
-
"grid": "
|
|
22
|
-
"date-and-time-wrapper": "awsui_date-and-time-
|
|
23
|
-
"date-and-time-wrapper__date": "awsui_date-and-time-
|
|
24
|
-
"date-and-time-wrapper__time": "awsui_date-and-time-
|
|
25
|
-
"date-and-time-constrainttext": "awsui_date-and-time-
|
|
26
|
-
"footer": "
|
|
27
|
-
"has-clear-button": "awsui_has-clear-
|
|
28
|
-
"footer-button-wrapper": "awsui_footer-button-
|
|
29
|
-
"icon-wrapper": "awsui_icon-
|
|
30
|
-
"label": "
|
|
31
|
-
"label-enabled": "awsui_label-
|
|
32
|
-
"label-text": "awsui_label-
|
|
33
|
-
"mode-switch": "awsui_mode-
|
|
34
|
-
"dropdown": "
|
|
35
|
-
"dropdown-content": "awsui_dropdown-
|
|
36
|
-
"start-date-input": "awsui_start-date-
|
|
37
|
-
"start-time-input": "awsui_start-time-
|
|
38
|
-
"end-date-input": "awsui_end-date-
|
|
39
|
-
"end-time-input": "awsui_end-time-
|
|
40
|
-
"validation-section": "awsui_validation-
|
|
41
|
-
"validation-error": "awsui_validation-
|
|
42
|
-
"clear-button": "awsui_clear-
|
|
43
|
-
"apply-button": "awsui_apply-
|
|
44
|
-
"cancel-button": "awsui_cancel-
|
|
45
|
-
"calendar-aria-live": "awsui_calendar-aria-
|
|
5
|
+
"calendar": "awsui_calendar_mgja0_z4fdg_93",
|
|
6
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_mgja0_z4fdg_1",
|
|
7
|
+
"root": "awsui_root_mgja0_z4fdg_120",
|
|
8
|
+
"trigger-wrapper": "awsui_trigger-wrapper_mgja0_z4fdg_132",
|
|
9
|
+
"trigger-flexbox": "awsui_trigger-flexbox_mgja0_z4fdg_136",
|
|
10
|
+
"one-grid": "awsui_one-grid_mgja0_z4fdg_144",
|
|
11
|
+
"calendar-header": "awsui_calendar-header_mgja0_z4fdg_147",
|
|
12
|
+
"calendar-header-months-wrapper": "awsui_calendar-header-months-wrapper_mgja0_z4fdg_153",
|
|
13
|
+
"calendar-header-month": "awsui_calendar-header-month_mgja0_z4fdg_153",
|
|
14
|
+
"calendar-next-month-btn": "awsui_calendar-next-month-btn_mgja0_z4fdg_173",
|
|
15
|
+
"calendar-prev-month-btn": "awsui_calendar-prev-month-btn_mgja0_z4fdg_176",
|
|
16
|
+
"calendar-day-names": "awsui_calendar-day-names_mgja0_z4fdg_179",
|
|
17
|
+
"calendar-day-name": "awsui_calendar-day-name_mgja0_z4fdg_179",
|
|
18
|
+
"calendar-week": "awsui_calendar-week_mgja0_z4fdg_194",
|
|
19
|
+
"first-grid": "awsui_first-grid_mgja0_z4fdg_199",
|
|
20
|
+
"second-grid": "awsui_second-grid_mgja0_z4fdg_200",
|
|
21
|
+
"grid": "awsui_grid_mgja0_z4fdg_204",
|
|
22
|
+
"date-and-time-wrapper": "awsui_date-and-time-wrapper_mgja0_z4fdg_208",
|
|
23
|
+
"date-and-time-wrapper__date": "awsui_date-and-time-wrapper__date_mgja0_z4fdg_212",
|
|
24
|
+
"date-and-time-wrapper__time": "awsui_date-and-time-wrapper__time_mgja0_z4fdg_215",
|
|
25
|
+
"date-and-time-constrainttext": "awsui_date-and-time-constrainttext_mgja0_z4fdg_219",
|
|
26
|
+
"footer": "awsui_footer_mgja0_z4fdg_226",
|
|
27
|
+
"has-clear-button": "awsui_has-clear-button_mgja0_z4fdg_233",
|
|
28
|
+
"footer-button-wrapper": "awsui_footer-button-wrapper_mgja0_z4fdg_240",
|
|
29
|
+
"icon-wrapper": "awsui_icon-wrapper_mgja0_z4fdg_244",
|
|
30
|
+
"label": "awsui_label_mgja0_z4fdg_249",
|
|
31
|
+
"label-enabled": "awsui_label-enabled_mgja0_z4fdg_254",
|
|
32
|
+
"label-text": "awsui_label-text_mgja0_z4fdg_258",
|
|
33
|
+
"mode-switch": "awsui_mode-switch_mgja0_z4fdg_263",
|
|
34
|
+
"dropdown": "awsui_dropdown_mgja0_z4fdg_267",
|
|
35
|
+
"dropdown-content": "awsui_dropdown-content_mgja0_z4fdg_283",
|
|
36
|
+
"start-date-input": "awsui_start-date-input_mgja0_z4fdg_292",
|
|
37
|
+
"start-time-input": "awsui_start-time-input_mgja0_z4fdg_293",
|
|
38
|
+
"end-date-input": "awsui_end-date-input_mgja0_z4fdg_294",
|
|
39
|
+
"end-time-input": "awsui_end-time-input_mgja0_z4fdg_295",
|
|
40
|
+
"validation-section": "awsui_validation-section_mgja0_z4fdg_299",
|
|
41
|
+
"validation-error": "awsui_validation-error_mgja0_z4fdg_303",
|
|
42
|
+
"clear-button": "awsui_clear-button_mgja0_z4fdg_307",
|
|
43
|
+
"apply-button": "awsui_apply-button_mgja0_z4fdg_311",
|
|
44
|
+
"cancel-button": "awsui_cancel-button_mgja0_z4fdg_315",
|
|
45
|
+
"calendar-aria-live": "awsui_calendar-aria-live_mgja0_z4fdg_319"
|
|
46
46
|
};
|
|
47
47
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandable-section-container.d.ts","sourceRoot":"","sources":["../../../src/expandable-section/expandable-section-container.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,UAAU,+BAAgC,SAAQ,0BAA0B;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC;IACxC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,sBAAsB,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7C;AAED,eAAO,MAAM,0BAA0B,2GASpC,+BAA+B,
|
|
1
|
+
{"version":3,"file":"expandable-section-container.d.ts","sourceRoot":"","sources":["../../../src/expandable-section/expandable-section-container.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,UAAU,+BAAgC,SAAQ,0BAA0B;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC;IACxC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,sBAAsB,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7C;AAED,eAAO,MAAM,0BAA0B,2GASpC,+BAA+B,gBAwBjC,CAAC"}
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
export var ExpandableSectionContainer = function (_a) {
|
|
7
7
|
var className = _a.className, children = _a.children, header = _a.header, variant = _a.variant, expanded = _a.expanded, disableContentPaddings = _a.disableContentPaddings, __internalRootRef = _a.__internalRootRef, rest = __rest(_a, ["className", "children", "header", "variant", "expanded", "disableContentPaddings", "__internalRootRef"]);
|
|
8
8
|
if (variant === 'container') {
|
|
9
|
-
return (React.createElement(InternalContainer, __assign({}, rest, { className: className, header: header, variant: "default", disableContentPaddings: disableContentPaddings || !expanded, disableHeaderPaddings: true, __internalRootRef: __internalRootRef }), children));
|
|
9
|
+
return (React.createElement(InternalContainer, __assign({}, rest, { className: className, header: header, variant: "default", disableContentPaddings: disableContentPaddings || !expanded, disableHeaderPaddings: true, __hiddenContent: !expanded, __internalRootRef: __internalRootRef }), children));
|
|
10
10
|
}
|
|
11
11
|
return (React.createElement("div", __assign({ className: className }, rest, { ref: __internalRootRef }),
|
|
12
12
|
header,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandable-section-container.js","sourceRoot":"","sources":["../../../src/expandable-section/expandable-section-container.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,iBAAiB,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,MAAM,CAAC,IAAM,0BAA0B,GAAG,UAAC,EAST;IARhC,IAAA,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,MAAM,YAAA,EACN,OAAO,aAAA,EACP,QAAQ,cAAA,EACR,sBAAsB,4BAAA,EACtB,iBAAiB,uBAAA,EACd,IAAI,cARkC,yGAS1C,CADQ;IAEP,IAAI,OAAO,KAAK,WAAW,EAAE;QAC3B,OAAO,CACL,oBAAC,iBAAiB,eACZ,IAAI,IACR,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,OAAO,EAAC,SAAS,EACjB,sBAAsB,EAAE,sBAAsB,IAAI,CAAC,QAAQ,EAC3D,qBAAqB,EAAE,IAAI,EAC3B,iBAAiB,EAAE,iBAAiB,KAEnC,QAAQ,CACS,CACrB,CAAC;KACH;IAED,OAAO,CACL,sCAAK,SAAS,EAAE,SAAS,IAAM,IAAI,IAAE,GAAG,EAAE,iBAAiB;QACxD,MAAM;QACN,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport InternalContainer from '../container/internal';\nimport React from 'react';\nimport { ExpandableSectionProps } from './interfaces';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\ninterface ExpandableSectionContainerProps extends InternalBaseComponentProps {\n className?: string;\n header: React.ReactNode;\n children?: React.ReactNode;\n variant: ExpandableSectionProps.Variant;\n expanded: boolean | undefined;\n disableContentPaddings: boolean | undefined;\n}\n\nexport const ExpandableSectionContainer = ({\n className,\n children,\n header,\n variant,\n expanded,\n disableContentPaddings,\n __internalRootRef,\n ...rest\n}: ExpandableSectionContainerProps) => {\n if (variant === 'container') {\n return (\n <InternalContainer\n {...rest}\n className={className}\n header={header}\n variant=\"default\"\n disableContentPaddings={disableContentPaddings || !expanded}\n disableHeaderPaddings={true}\n __internalRootRef={__internalRootRef}\n >\n {children}\n </InternalContainer>\n );\n }\n\n return (\n <div className={className} {...rest} ref={__internalRootRef}>\n {header}\n {children}\n </div>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"expandable-section-container.js","sourceRoot":"","sources":["../../../src/expandable-section/expandable-section-container.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,iBAAiB,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,MAAM,CAAC,IAAM,0BAA0B,GAAG,UAAC,EAST;IARhC,IAAA,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,MAAM,YAAA,EACN,OAAO,aAAA,EACP,QAAQ,cAAA,EACR,sBAAsB,4BAAA,EACtB,iBAAiB,uBAAA,EACd,IAAI,cARkC,yGAS1C,CADQ;IAEP,IAAI,OAAO,KAAK,WAAW,EAAE;QAC3B,OAAO,CACL,oBAAC,iBAAiB,eACZ,IAAI,IACR,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,OAAO,EAAC,SAAS,EACjB,sBAAsB,EAAE,sBAAsB,IAAI,CAAC,QAAQ,EAC3D,qBAAqB,EAAE,IAAI,EAC3B,eAAe,EAAE,CAAC,QAAQ,EAC1B,iBAAiB,EAAE,iBAAiB,KAEnC,QAAQ,CACS,CACrB,CAAC;KACH;IAED,OAAO,CACL,sCAAK,SAAS,EAAE,SAAS,IAAM,IAAI,IAAE,GAAG,EAAE,iBAAiB;QACxD,MAAM;QACN,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport InternalContainer from '../container/internal';\nimport React from 'react';\nimport { ExpandableSectionProps } from './interfaces';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\ninterface ExpandableSectionContainerProps extends InternalBaseComponentProps {\n className?: string;\n header: React.ReactNode;\n children?: React.ReactNode;\n variant: ExpandableSectionProps.Variant;\n expanded: boolean | undefined;\n disableContentPaddings: boolean | undefined;\n}\n\nexport const ExpandableSectionContainer = ({\n className,\n children,\n header,\n variant,\n expanded,\n disableContentPaddings,\n __internalRootRef,\n ...rest\n}: ExpandableSectionContainerProps) => {\n if (variant === 'container') {\n return (\n <InternalContainer\n {...rest}\n className={className}\n header={header}\n variant=\"default\"\n disableContentPaddings={disableContentPaddings || !expanded}\n disableHeaderPaddings={true}\n __hiddenContent={!expanded}\n __internalRootRef={__internalRootRef}\n >\n {children}\n </InternalContainer>\n );\n }\n\n return (\n <div className={className} {...rest} ref={__internalRootRef}>\n {header}\n {children}\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormFieldValidationControlProps } from '../../context/form-field-context';
|
|
3
|
+
import { BaseComponentProps } from '../../base-component';
|
|
4
|
+
import { NonCancelableEventHandler } from '../../events';
|
|
5
|
+
import { BaseChangeDetail, BaseInputProps, InputKeyEvents, InputProps } from '../../../input/interfaces';
|
|
6
|
+
import { ExpandToViewport } from '../dropdown/interfaces';
|
|
7
|
+
import { InternalBaseComponentProps } from '../../hooks/use-base-component';
|
|
8
|
+
export interface AutosuggestInputProps extends BaseComponentProps, BaseInputProps, InputKeyEvents, FormFieldValidationControlProps, ExpandToViewport, InternalBaseComponentProps {
|
|
9
|
+
ariaControls?: string;
|
|
10
|
+
ariaActivedescendant?: string;
|
|
11
|
+
dropdownExpanded?: boolean;
|
|
12
|
+
dropdownContent?: React.ReactNode;
|
|
13
|
+
dropdownFooter?: React.ReactNode;
|
|
14
|
+
dropdownWidth?: number;
|
|
15
|
+
onCloseDropdown?: NonCancelableEventHandler<null>;
|
|
16
|
+
onDelayedInput?: NonCancelableEventHandler<BaseChangeDetail>;
|
|
17
|
+
onPressArrowDown?: () => void;
|
|
18
|
+
onPressArrowUp?: () => void;
|
|
19
|
+
onPressEnter?: () => boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface AutosuggestInputRef extends InputProps.Ref {
|
|
22
|
+
focusNoOpen(): void;
|
|
23
|
+
open(): void;
|
|
24
|
+
close(): void;
|
|
25
|
+
}
|
|
26
|
+
declare const AutosuggestInput: React.ForwardRefExoticComponent<AutosuggestInputProps & React.RefAttributes<AutosuggestInputRef>>;
|
|
27
|
+
export default AutosuggestInput;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/autosuggest-input/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAgE,MAAM,OAAO,CAAC;AAIrF,OAAO,EAAE,+BAA+B,EAAuB,MAAM,kCAAkC,CAAC;AACxG,OAAO,EAAE,kBAAkB,EAAgB,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAKL,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEzG,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAK5E,MAAM,WAAW,qBACf,SAAQ,kBAAkB,EACxB,cAAc,EACd,cAAc,EACd,+BAA+B,EAC/B,gBAAgB,EAChB,0BAA0B;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAClD,cAAc,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,CAAC;IAC7D,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAoB,SAAQ,UAAU,CAAC,GAAG;IACzD,WAAW,IAAI,IAAI,CAAC;IACpB,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;CACf;AAED,QAAA,MAAM,gBAAgB,mGAwNrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { __assign, __rest } from "tslib";
|
|
4
|
+
import React, { useRef, useState, useImperativeHandle, useEffect } from 'react';
|
|
5
|
+
import Dropdown from '../dropdown';
|
|
6
|
+
import { useFormFieldContext } from '../../context/form-field-context';
|
|
7
|
+
import { getBaseProps } from '../../base-component';
|
|
8
|
+
import { useUniqueId } from '../../hooks/use-unique-id';
|
|
9
|
+
import { fireCancelableEvent, fireNonCancelableEvent, getBlurEventRelatedTarget, } from '../../events';
|
|
10
|
+
import InternalInput from '../../../input/internal';
|
|
11
|
+
import { getFocusables } from '../focus-lock/utils';
|
|
12
|
+
import { KeyCode } from '../../keycode';
|
|
13
|
+
import styles from './styles.css.js';
|
|
14
|
+
import clsx from 'clsx';
|
|
15
|
+
var AutosuggestInput = React.forwardRef(function (_a, ref) {
|
|
16
|
+
var value = _a.value, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, onKeyUp = _a.onKeyUp, onKeyDown = _a.onKeyDown, name = _a.name, placeholder = _a.placeholder, disabled = _a.disabled, readOnly = _a.readOnly, autoFocus = _a.autoFocus, ariaLabel = _a.ariaLabel, ariaRequired = _a.ariaRequired, _b = _a.disableBrowserAutocorrect, disableBrowserAutocorrect = _b === void 0 ? false : _b, expandToViewport = _a.expandToViewport, ariaControls = _a.ariaControls, ariaActivedescendant = _a.ariaActivedescendant, dropdownExpanded = _a.dropdownExpanded, _c = _a.dropdownContent, dropdownContent = _c === void 0 ? null : _c, _d = _a.dropdownFooter, dropdownFooter = _d === void 0 ? null : _d, dropdownWidth = _a.dropdownWidth, onCloseDropdown = _a.onCloseDropdown, onDelayedInput = _a.onDelayedInput, onPressArrowDown = _a.onPressArrowDown, onPressArrowUp = _a.onPressArrowUp, onPressEnter = _a.onPressEnter, __internalRootRef = _a.__internalRootRef, restProps = __rest(_a, ["value", "onChange", "onBlur", "onFocus", "onKeyUp", "onKeyDown", "name", "placeholder", "disabled", "readOnly", "autoFocus", "ariaLabel", "ariaRequired", "disableBrowserAutocorrect", "expandToViewport", "ariaControls", "ariaActivedescendant", "dropdownExpanded", "dropdownContent", "dropdownFooter", "dropdownWidth", "onCloseDropdown", "onDelayedInput", "onPressArrowDown", "onPressArrowUp", "onPressEnter", "__internalRootRef"]);
|
|
17
|
+
var baseProps = getBaseProps(restProps);
|
|
18
|
+
var formFieldContext = useFormFieldContext(restProps);
|
|
19
|
+
var dropdownId = useUniqueId('dropdown');
|
|
20
|
+
var inputRef = useRef(null);
|
|
21
|
+
var dropdownContentRef = useRef(null);
|
|
22
|
+
var dropdownFooterRef = useRef(null);
|
|
23
|
+
var preventOpenOnFocusRef = useRef(false);
|
|
24
|
+
var _e = useState(false), open = _e[0], setOpen = _e[1];
|
|
25
|
+
var openDropdown = function () { return !readOnly && setOpen(true); };
|
|
26
|
+
var closeDropdown = function () {
|
|
27
|
+
setOpen(false);
|
|
28
|
+
fireNonCancelableEvent(onCloseDropdown, null);
|
|
29
|
+
};
|
|
30
|
+
useImperativeHandle(ref, function () { return ({
|
|
31
|
+
focus: function () {
|
|
32
|
+
var _a;
|
|
33
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
34
|
+
},
|
|
35
|
+
select: function () {
|
|
36
|
+
var _a;
|
|
37
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.select();
|
|
38
|
+
},
|
|
39
|
+
focusNoOpen: function () {
|
|
40
|
+
var _a;
|
|
41
|
+
preventOpenOnFocusRef.current = true;
|
|
42
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
43
|
+
},
|
|
44
|
+
open: openDropdown,
|
|
45
|
+
close: closeDropdown
|
|
46
|
+
}); });
|
|
47
|
+
var handleBlur = function (event) {
|
|
48
|
+
var _a;
|
|
49
|
+
var relatedTarget = getBlurEventRelatedTarget(event.nativeEvent);
|
|
50
|
+
if (event.currentTarget.contains(relatedTarget) || ((_a = dropdownFooterRef.current) === null || _a === void 0 ? void 0 : _a.contains(relatedTarget))) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
closeDropdown();
|
|
54
|
+
fireNonCancelableEvent(onBlur, null);
|
|
55
|
+
};
|
|
56
|
+
var handleFocus = function () {
|
|
57
|
+
if (!preventOpenOnFocusRef.current) {
|
|
58
|
+
openDropdown();
|
|
59
|
+
fireNonCancelableEvent(onFocus, null);
|
|
60
|
+
}
|
|
61
|
+
preventOpenOnFocusRef.current = false;
|
|
62
|
+
};
|
|
63
|
+
var handleMouseDown = function (event) {
|
|
64
|
+
// Prevent currently focused element from losing focus.
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
};
|
|
67
|
+
var handleKeyDown = function (e) {
|
|
68
|
+
switch (e.detail.keyCode) {
|
|
69
|
+
case KeyCode.down: {
|
|
70
|
+
onPressArrowDown === null || onPressArrowDown === void 0 ? void 0 : onPressArrowDown();
|
|
71
|
+
openDropdown();
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case KeyCode.up: {
|
|
76
|
+
onPressArrowUp === null || onPressArrowUp === void 0 ? void 0 : onPressArrowUp();
|
|
77
|
+
openDropdown();
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
case KeyCode.enter: {
|
|
82
|
+
if (open) {
|
|
83
|
+
if (!(onPressEnter === null || onPressEnter === void 0 ? void 0 : onPressEnter())) {
|
|
84
|
+
closeDropdown();
|
|
85
|
+
}
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
}
|
|
88
|
+
fireCancelableEvent(onKeyDown, e.detail);
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case KeyCode.escape: {
|
|
92
|
+
if (open) {
|
|
93
|
+
closeDropdown();
|
|
94
|
+
}
|
|
95
|
+
else if (value) {
|
|
96
|
+
fireNonCancelableEvent(onChange, { value: '' });
|
|
97
|
+
}
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
fireCancelableEvent(onKeyDown, e.detail);
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
default: {
|
|
103
|
+
fireCancelableEvent(onKeyDown, e.detail);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
var handleChange = function (value) {
|
|
108
|
+
openDropdown();
|
|
109
|
+
fireNonCancelableEvent(onChange, { value: value });
|
|
110
|
+
};
|
|
111
|
+
var handleDelayedInput = function (value) {
|
|
112
|
+
fireNonCancelableEvent(onDelayedInput, { value: value });
|
|
113
|
+
};
|
|
114
|
+
var expanded = open && (dropdownExpanded !== null && dropdownExpanded !== void 0 ? dropdownExpanded : !!dropdownContent);
|
|
115
|
+
var nativeAttributes = {
|
|
116
|
+
name: name,
|
|
117
|
+
placeholder: placeholder,
|
|
118
|
+
autoFocus: autoFocus,
|
|
119
|
+
onClick: openDropdown,
|
|
120
|
+
role: 'combobox',
|
|
121
|
+
'aria-autocomplete': 'list',
|
|
122
|
+
'aria-expanded': expanded,
|
|
123
|
+
'aria-controls': ariaControls,
|
|
124
|
+
// 'aria-owns' needed for safari+vo to announce activedescendant content
|
|
125
|
+
'aria-owns': ariaControls,
|
|
126
|
+
'aria-label': ariaLabel,
|
|
127
|
+
'aria-activedescendant': ariaActivedescendant
|
|
128
|
+
};
|
|
129
|
+
var _f = useState(false), trapDropdownFocus = _f[0], setTrapDropdownFocus = _f[1];
|
|
130
|
+
// Run this effect on every render to determine if necessary to trap focus around input and dropdown.
|
|
131
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
132
|
+
useEffect(function () {
|
|
133
|
+
setTrapDropdownFocus((dropdownFooterRef.current ? getFocusables(dropdownFooterRef.current).length > 0 : false) ||
|
|
134
|
+
(dropdownContentRef.current ? getFocusables(dropdownContentRef.current).length > 0 : false));
|
|
135
|
+
});
|
|
136
|
+
return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: __internalRootRef, onBlur: handleBlur }),
|
|
137
|
+
React.createElement(Dropdown, { minWidth: dropdownWidth, stretchWidth: !dropdownWidth, trigger: React.createElement(InternalInput, __assign({ type: "search", value: value, onChange: function (event) { return handleChange(event.detail.value); }, __onDelayedInput: function (event) { return handleDelayedInput(event.detail.value); }, onFocus: handleFocus, onKeyDown: handleKeyDown, onKeyUp: onKeyUp, disabled: disabled, disableBrowserAutocorrect: disableBrowserAutocorrect, readOnly: readOnly, ariaRequired: ariaRequired, ref: inputRef, autoComplete: false, __nativeAttributes: nativeAttributes }, formFieldContext)), onMouseDown: handleMouseDown, open: open, dropdownId: dropdownId, footer: dropdownFooterRef && (React.createElement("div", { ref: dropdownFooterRef, className: styles['dropdown-footer'] }, dropdownFooter)), expandToViewport: expandToViewport, hasContent: expanded, trapFocus: trapDropdownFocus },
|
|
138
|
+
React.createElement("div", { ref: dropdownContentRef, className: styles['dropdown-content'] }, open && dropdownContent))));
|
|
139
|
+
});
|
|
140
|
+
export default AutosuggestInput;
|
|
141
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/autosuggest-input/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAO,MAAM,EAAE,QAAQ,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErF,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAmC,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACxG,OAAO,EAAsB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAEL,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,GAE1B,MAAM,cAAc,CAAC;AACtB,OAAO,aAAa,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AA4BxB,IAAM,gBAAgB,GAAG,KAAK,CAAC,UAAU,CACvC,UACE,EA6BwB,EACxB,GAA6B;IA7B3B,IAAA,KAAK,WAAA,EACL,QAAQ,cAAA,EACR,MAAM,YAAA,EACN,OAAO,aAAA,EACP,OAAO,aAAA,EACP,SAAS,eAAA,EACT,IAAI,UAAA,EACJ,WAAW,iBAAA,EACX,QAAQ,cAAA,EACR,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,SAAS,eAAA,EACT,YA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AY,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAhC,CAAgC,EACnD,gBAAgB,EAAE,UAAA,KAAK,IAAI,OAAA,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAtC,CAAsC,EACjE,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,yBAAyB,EAAE,yBAAyB,EACpD,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,QAAQ,EACb,YAAY,EAAE,KAAK,EACnB,kBAAkB,EAAE,gBAAgB,IAChC,gBAAgB,EACpB,EAEJ,WAAW,EAAE,eAAe,EAC5B,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,MAAM,EACJ,iBAAiB,IAAI,CACnB,6BAAK,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAC9D,cAAc,CACX,CACP,EAEH,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,iBAAiB;YAE5B,6BAAK,GAAG,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC,IAChE,IAAI,IAAI,eAAe,CACpB,CACG,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useRef, useState, useImperativeHandle, useEffect } from 'react';\n\nimport Dropdown from '../dropdown';\n\nimport { FormFieldValidationControlProps, useFormFieldContext } from '../../context/form-field-context';\nimport { BaseComponentProps, getBaseProps } from '../../base-component';\nimport { useUniqueId } from '../../hooks/use-unique-id';\nimport {\n BaseKeyDetail,\n fireCancelableEvent,\n fireNonCancelableEvent,\n getBlurEventRelatedTarget,\n NonCancelableEventHandler,\n} from '../../events';\nimport InternalInput from '../../../input/internal';\nimport { BaseChangeDetail, BaseInputProps, InputKeyEvents, InputProps } from '../../../input/interfaces';\nimport { getFocusables } from '../focus-lock/utils';\nimport { ExpandToViewport } from '../dropdown/interfaces';\nimport { InternalBaseComponentProps } from '../../hooks/use-base-component';\nimport { KeyCode } from '../../keycode';\nimport styles from './styles.css.js';\nimport clsx from 'clsx';\n\nexport interface AutosuggestInputProps\n extends BaseComponentProps,\n BaseInputProps,\n InputKeyEvents,\n FormFieldValidationControlProps,\n ExpandToViewport,\n InternalBaseComponentProps {\n ariaControls?: string;\n ariaActivedescendant?: string;\n dropdownExpanded?: boolean;\n dropdownContent?: React.ReactNode;\n dropdownFooter?: React.ReactNode;\n dropdownWidth?: number;\n onCloseDropdown?: NonCancelableEventHandler<null>;\n onDelayedInput?: NonCancelableEventHandler<BaseChangeDetail>;\n onPressArrowDown?: () => void;\n onPressArrowUp?: () => void;\n onPressEnter?: () => boolean;\n}\n\nexport interface AutosuggestInputRef extends InputProps.Ref {\n focusNoOpen(): void;\n open(): void;\n close(): void;\n}\n\nconst AutosuggestInput = React.forwardRef(\n (\n {\n value,\n onChange,\n onBlur,\n onFocus,\n onKeyUp,\n onKeyDown,\n name,\n placeholder,\n disabled,\n readOnly,\n autoFocus,\n ariaLabel,\n ariaRequired,\n disableBrowserAutocorrect = false,\n expandToViewport,\n ariaControls,\n ariaActivedescendant,\n dropdownExpanded,\n dropdownContent = null,\n dropdownFooter = null,\n dropdownWidth,\n onCloseDropdown,\n onDelayedInput,\n onPressArrowDown,\n onPressArrowUp,\n onPressEnter,\n __internalRootRef,\n ...restProps\n }: AutosuggestInputProps,\n ref: Ref<AutosuggestInputRef>\n ) => {\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n\n const dropdownId = useUniqueId('dropdown');\n\n const inputRef = useRef<HTMLInputElement>(null);\n const dropdownContentRef = useRef<HTMLDivElement>(null);\n const dropdownFooterRef = useRef<HTMLDivElement>(null);\n const preventOpenOnFocusRef = useRef(false);\n\n const [open, setOpen] = useState(false);\n\n const openDropdown = () => !readOnly && setOpen(true);\n\n const closeDropdown = () => {\n setOpen(false);\n fireNonCancelableEvent(onCloseDropdown, null);\n };\n\n useImperativeHandle(ref, () => ({\n focus() {\n inputRef.current?.focus();\n },\n select() {\n inputRef.current?.select();\n },\n focusNoOpen() {\n preventOpenOnFocusRef.current = true;\n inputRef.current?.focus();\n },\n open: openDropdown,\n close: closeDropdown,\n }));\n\n const handleBlur: React.FocusEventHandler = event => {\n const relatedTarget = getBlurEventRelatedTarget(event.nativeEvent);\n if (event.currentTarget.contains(relatedTarget) || dropdownFooterRef.current?.contains(relatedTarget)) {\n return;\n }\n closeDropdown();\n fireNonCancelableEvent(onBlur, null);\n };\n\n const handleFocus = () => {\n if (!preventOpenOnFocusRef.current) {\n openDropdown();\n fireNonCancelableEvent(onFocus, null);\n }\n preventOpenOnFocusRef.current = false;\n };\n\n const handleMouseDown: React.MouseEventHandler = event => {\n // Prevent currently focused element from losing focus.\n event.preventDefault();\n };\n\n const handleKeyDown = (e: CustomEvent<BaseKeyDetail>) => {\n switch (e.detail.keyCode) {\n case KeyCode.down: {\n onPressArrowDown?.();\n openDropdown();\n e.preventDefault();\n break;\n }\n case KeyCode.up: {\n onPressArrowUp?.();\n openDropdown();\n e.preventDefault();\n break;\n }\n case KeyCode.enter: {\n if (open) {\n if (!onPressEnter?.()) {\n closeDropdown();\n }\n e.preventDefault();\n }\n fireCancelableEvent(onKeyDown, e.detail);\n break;\n }\n case KeyCode.escape: {\n if (open) {\n closeDropdown();\n } else if (value) {\n fireNonCancelableEvent(onChange, { value: '' });\n }\n e.preventDefault();\n fireCancelableEvent(onKeyDown, e.detail);\n break;\n }\n default: {\n fireCancelableEvent(onKeyDown, e.detail);\n }\n }\n };\n\n const handleChange = (value: string) => {\n openDropdown();\n fireNonCancelableEvent(onChange, { value });\n };\n\n const handleDelayedInput = (value: string) => {\n fireNonCancelableEvent(onDelayedInput, { value });\n };\n\n const expanded = open && (dropdownExpanded ?? !!dropdownContent);\n const nativeAttributes = {\n name,\n placeholder,\n autoFocus,\n onClick: openDropdown,\n role: 'combobox',\n 'aria-autocomplete': 'list',\n 'aria-expanded': expanded,\n 'aria-controls': ariaControls,\n // 'aria-owns' needed for safari+vo to announce activedescendant content\n 'aria-owns': ariaControls,\n 'aria-label': ariaLabel,\n 'aria-activedescendant': ariaActivedescendant,\n };\n\n const [trapDropdownFocus, setTrapDropdownFocus] = useState(false);\n\n // Run this effect on every render to determine if necessary to trap focus around input and dropdown.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n setTrapDropdownFocus(\n (dropdownFooterRef.current ? getFocusables(dropdownFooterRef.current).length > 0 : false) ||\n (dropdownContentRef.current ? getFocusables(dropdownContentRef.current).length > 0 : false)\n );\n });\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n ref={__internalRootRef}\n onBlur={handleBlur}\n >\n <Dropdown\n minWidth={dropdownWidth}\n stretchWidth={!dropdownWidth}\n trigger={\n <InternalInput\n type=\"search\"\n value={value}\n onChange={event => handleChange(event.detail.value)}\n __onDelayedInput={event => handleDelayedInput(event.detail.value)}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={onKeyUp}\n disabled={disabled}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n readOnly={readOnly}\n ariaRequired={ariaRequired}\n ref={inputRef}\n autoComplete={false}\n __nativeAttributes={nativeAttributes}\n {...formFieldContext}\n />\n }\n onMouseDown={handleMouseDown}\n open={open}\n dropdownId={dropdownId}\n footer={\n dropdownFooterRef && (\n <div ref={dropdownFooterRef} className={styles['dropdown-footer']}>\n {dropdownFooter}\n </div>\n )\n }\n expandToViewport={expandToViewport}\n hasContent={expanded}\n trapFocus={trapDropdownFocus}\n >\n <div ref={dropdownContentRef} className={styles['dropdown-content']}>\n {open && dropdownContent}\n </div>\n </Dropdown>\n </div>\n );\n }\n);\n\nexport default AutosuggestInput;\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
.awsui_dropdown-footer_vm8qf_jxdvh_5:not(#\9) {
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
flex-shrink: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.awsui_dropdown-content_vm8qf_jxdvh_10:not(#\9) {
|
|
11
|
+
display: contents;
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
// es-module interop with Babel and Typescript
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
module.exports.default = {
|
|
5
|
+
"dropdown-footer": "awsui_dropdown-footer_vm8qf_jxdvh_5",
|
|
6
|
+
"dropdown-content": "awsui_dropdown-content_vm8qf_jxdvh_10"
|
|
7
|
+
};
|
|
8
|
+
|