@cloudscape-design/components 3.0.738 → 3.0.739
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/options-controller.d.ts.map +1 -1
- package/autosuggest/options-controller.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/property-filter/controller.d.ts +4 -3
- package/property-filter/controller.d.ts.map +1 -1
- package/property-filter/controller.js +27 -11
- package/property-filter/controller.js.map +1 -1
- package/property-filter/i18n-utils.d.ts +4 -24
- package/property-filter/i18n-utils.d.ts.map +1 -1
- package/property-filter/i18n-utils.js +12 -6
- package/property-filter/i18n-utils.js.map +1 -1
- package/property-filter/interfaces.d.ts +25 -8
- package/property-filter/interfaces.d.ts.map +1 -1
- package/property-filter/interfaces.js.map +1 -1
- package/property-filter/internal.d.ts +3 -4
- package/property-filter/internal.d.ts.map +1 -1
- package/property-filter/internal.js +20 -13
- package/property-filter/internal.js.map +1 -1
- package/property-filter/styles.css.js +38 -38
- package/property-filter/styles.scoped.css +46 -38
- package/property-filter/styles.selectors.js +38 -38
- package/property-filter/token-editor.d.ts +4 -3
- package/property-filter/token-editor.d.ts.map +1 -1
- package/property-filter/token-editor.js +15 -13
- package/property-filter/token-editor.js.map +1 -1
- package/property-filter/token.d.ts +3 -3
- package/property-filter/token.d.ts.map +1 -1
- package/property-filter/token.js +46 -19
- package/property-filter/token.js.map +1 -1
- package/property-filter/utils.d.ts +12 -0
- package/property-filter/utils.d.ts.map +1 -1
- package/property-filter/utils.js +22 -0
- package/property-filter/utils.js.map +1 -1
- package/test-utils/dom/property-filter/index.d.ts +17 -15
- package/test-utils/dom/property-filter/index.js +34 -39
- package/test-utils/dom/property-filter/index.js.map +1 -1
- package/test-utils/selectors/property-filter/index.d.ts +17 -15
- package/test-utils/selectors/property-filter/index.js +36 -39
- package/test-utils/selectors/property-filter/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
*/
|
|
139
139
|
/* Style used for links in slots/components that are text heavy, to help links stand out among
|
|
140
140
|
surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
|
|
141
|
-
.
|
|
141
|
+
.awsui_root_1wzqe_13ua9_141:not(#\9) {
|
|
142
142
|
border-collapse: separate;
|
|
143
143
|
border-spacing: 0;
|
|
144
144
|
box-sizing: border-box;
|
|
@@ -174,33 +174,33 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
174
174
|
-moz-osx-font-smoothing: auto;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
.awsui_search-
|
|
177
|
+
.awsui_search-field_1wzqe_13ua9_176:not(#\9) {
|
|
178
178
|
display: flex;
|
|
179
179
|
align-items: flex-end;
|
|
180
180
|
max-inline-size: calc(688px - 2 * var(--space-l-t419sm, 20px));
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
.awsui_input-
|
|
183
|
+
.awsui_input-wrapper_1wzqe_13ua9_182:not(#\9) {
|
|
184
184
|
flex-grow: 1;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
.awsui_add-
|
|
187
|
+
.awsui_add-token_1wzqe_13ua9_186:not(#\9) {
|
|
188
188
|
border-inline-start: 1px solid var(--color-border-divider-default-j74lyz, #b6bec9);
|
|
189
189
|
box-sizing: border-box;
|
|
190
190
|
margin-inline-start: var(--space-m-udix3p, 16px);
|
|
191
191
|
padding-inline-start: var(--space-m-udix3p, 16px);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
.
|
|
194
|
+
.awsui_tokens_1wzqe_13ua9_193:not(#\9) {
|
|
195
195
|
margin-block: var(--space-xs-zb16t3, 8px);
|
|
196
196
|
margin-inline: 0;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
.awsui_token-
|
|
199
|
+
.awsui_token-operator_1wzqe_13ua9_198:not(#\9) {
|
|
200
200
|
font-weight: bold;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
.awsui_property-
|
|
203
|
+
.awsui_property-editor_1wzqe_13ua9_202:not(#\9) {
|
|
204
204
|
-webkit-user-select: text;
|
|
205
205
|
user-select: text;
|
|
206
206
|
margin-block: var(--space-xxs-p8yyaw, 4px);
|
|
@@ -209,32 +209,32 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
209
209
|
padding-inline: var(--space-m-udix3p, 16px);
|
|
210
210
|
overflow-y: auto;
|
|
211
211
|
}
|
|
212
|
-
.awsui_property-editor-
|
|
212
|
+
.awsui_property-editor-form_1wzqe_13ua9_210:not(#\9) {
|
|
213
213
|
margin-block-end: var(--space-scaled-l-0hpmd7, 20px);
|
|
214
214
|
}
|
|
215
|
-
.awsui_property-editor-field-
|
|
215
|
+
.awsui_property-editor-field-property_1wzqe_13ua9_213:not(#\9) {
|
|
216
216
|
/* used in test-utils */
|
|
217
217
|
}
|
|
218
|
-
.awsui_property-editor-field-
|
|
218
|
+
.awsui_property-editor-field-operator_1wzqe_13ua9_216:not(#\9) {
|
|
219
219
|
margin-block-start: var(--space-scaled-l-0hpmd7, 20px);
|
|
220
220
|
}
|
|
221
|
-
.awsui_property-editor-field-
|
|
221
|
+
.awsui_property-editor-field-value_1wzqe_13ua9_219:not(#\9) {
|
|
222
222
|
margin-block-start: var(--space-scaled-l-0hpmd7, 20px);
|
|
223
223
|
}
|
|
224
|
-
.awsui_property-editor-
|
|
224
|
+
.awsui_property-editor-cancel_1wzqe_13ua9_222:not(#\9) {
|
|
225
225
|
margin-inline-end: var(--space-xs-zb16t3, 8px);
|
|
226
226
|
}
|
|
227
|
-
.awsui_property-editor-
|
|
227
|
+
.awsui_property-editor-submit_1wzqe_13ua9_225:not(#\9) {
|
|
228
228
|
/* used in test-utils */
|
|
229
229
|
}
|
|
230
|
-
.awsui_property-editor-
|
|
230
|
+
.awsui_property-editor-actions_1wzqe_13ua9_228:not(#\9) {
|
|
231
231
|
display: flex;
|
|
232
232
|
justify-content: flex-end;
|
|
233
233
|
padding-block-start: var(--space-s-34lx8l, 12px);
|
|
234
234
|
border-block-start: 1px solid var(--color-border-dropdown-item-default-k36ra7, #b6bec9);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
.awsui_token-
|
|
237
|
+
.awsui_token-editor_1wzqe_13ua9_235:not(#\9) {
|
|
238
238
|
display: flex;
|
|
239
239
|
flex-direction: column;
|
|
240
240
|
gap: var(--space-s-34lx8l, 12px);
|
|
@@ -243,25 +243,25 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
243
243
|
margin-block: var(--space-xxs-p8yyaw, 4px);
|
|
244
244
|
margin-inline: var(--space-xxs-p8yyaw, 4px);
|
|
245
245
|
}
|
|
246
|
-
.awsui_token-editor-
|
|
246
|
+
.awsui_token-editor-form_1wzqe_13ua9_243:not(#\9) {
|
|
247
247
|
/* used in test-utils */
|
|
248
248
|
}
|
|
249
|
-
.awsui_token-editor-field-
|
|
249
|
+
.awsui_token-editor-field-property_1wzqe_13ua9_246:not(#\9) {
|
|
250
250
|
flex-grow: 2;
|
|
251
251
|
}
|
|
252
|
-
.awsui_token-editor-field-
|
|
252
|
+
.awsui_token-editor-field-operator_1wzqe_13ua9_249:not(#\9) {
|
|
253
253
|
flex-grow: 1;
|
|
254
254
|
}
|
|
255
|
-
.awsui_token-editor-field-
|
|
255
|
+
.awsui_token-editor-field-value_1wzqe_13ua9_252:not(#\9) {
|
|
256
256
|
flex-grow: 2;
|
|
257
257
|
}
|
|
258
|
-
.awsui_token-editor-
|
|
258
|
+
.awsui_token-editor-cancel_1wzqe_13ua9_255:not(#\9) {
|
|
259
259
|
margin-inline-end: var(--space-xs-zb16t3, 8px);
|
|
260
260
|
}
|
|
261
|
-
.awsui_token-editor-
|
|
261
|
+
.awsui_token-editor-submit_1wzqe_13ua9_258:not(#\9) {
|
|
262
262
|
/* used in test-utils */
|
|
263
263
|
}
|
|
264
|
-
.awsui_token-editor-
|
|
264
|
+
.awsui_token-editor-actions_1wzqe_13ua9_261:not(#\9) {
|
|
265
265
|
display: flex;
|
|
266
266
|
justify-content: flex-end;
|
|
267
267
|
padding-block-start: var(--space-s-34lx8l, 12px);
|
|
@@ -270,7 +270,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
270
270
|
margin-inline: calc(-1 * var(--space-m-udix3p, 16px) + -1 * var(--space-xxs-p8yyaw, 4px));
|
|
271
271
|
margin-block-start: var(--space-s-34lx8l, 12px);
|
|
272
272
|
}
|
|
273
|
-
.awsui_token-editor-
|
|
273
|
+
.awsui_token-editor-grid_1wzqe_13ua9_270:not(#\9) {
|
|
274
274
|
border-collapse: separate;
|
|
275
275
|
border-spacing: 0;
|
|
276
276
|
box-sizing: border-box;
|
|
@@ -308,62 +308,70 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
308
308
|
gap: var(--space-s-34lx8l, 12px);
|
|
309
309
|
grid-template-columns: minmax(min-content, 2fr) minmax(min-content, 120px) minmax(min-content, 3fr) min-content;
|
|
310
310
|
}
|
|
311
|
-
.awsui_token-editor-grid-
|
|
311
|
+
.awsui_token-editor-grid-group_1wzqe_13ua9_307:not(#\9) {
|
|
312
312
|
display: contents;
|
|
313
313
|
}
|
|
314
|
-
.awsui_token-editor-
|
|
314
|
+
.awsui_token-editor-grid_1wzqe_13ua9_270.awsui_token-editor-narrow_1wzqe_13ua9_310:not(#\9) {
|
|
315
315
|
grid-template-columns: minmax(100px, 1fr);
|
|
316
316
|
gap: var(--space-m-udix3p, 16px);
|
|
317
317
|
}
|
|
318
|
-
.awsui_token-editor-
|
|
318
|
+
.awsui_token-editor-grid_1wzqe_13ua9_270.awsui_token-editor-narrow_1wzqe_13ua9_310 > .awsui_token-editor-grid-group_1wzqe_13ua9_307:not(#\9) {
|
|
319
319
|
display: flex;
|
|
320
320
|
flex-direction: column;
|
|
321
321
|
gap: var(--space-s-34lx8l, 12px);
|
|
322
322
|
}
|
|
323
|
-
.awsui_token-editor-grid-
|
|
323
|
+
.awsui_token-editor-grid_1wzqe_13ua9_270.awsui_token-editor-narrow_1wzqe_13ua9_310 > .awsui_token-editor-grid-group_1wzqe_13ua9_307.awsui_token-editor-supports-groups_1wzqe_13ua9_319:not(#\9) {
|
|
324
|
+
padding-block-end: var(--space-m-udix3p, 16px);
|
|
325
|
+
border-block-end: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-divider-default-j74lyz, #b6bec9);
|
|
326
|
+
}
|
|
327
|
+
.awsui_token-editor-grid-header_1wzqe_13ua9_323:not(#\9) {
|
|
324
328
|
color: var(--color-text-column-header-czuvwg, #414d5c);
|
|
325
329
|
font-weight: var(--font-weight-heading-s-cwn6wc, 700);
|
|
326
330
|
padding-block: var(--space-scaled-xxs-7597g1, 4px);
|
|
327
331
|
text-align: start;
|
|
328
332
|
}
|
|
329
|
-
.awsui_token-editor-grid-
|
|
333
|
+
.awsui_token-editor-grid-cell_1wzqe_13ua9_329:not(#\9):not(.awsui_token-editor-narrow_1wzqe_13ua9_310) {
|
|
330
334
|
display: flex;
|
|
331
335
|
align-items: flex-end;
|
|
332
336
|
justify-content: flex-end;
|
|
333
337
|
}
|
|
334
|
-
.awsui_token-editor-
|
|
338
|
+
.awsui_token-editor-grid-cell_1wzqe_13ua9_329.awsui_token-editor-narrow_1wzqe_13ua9_310:not(#\9):nth-child(4) {
|
|
339
|
+
display: flex;
|
|
340
|
+
justify-content: flex-end;
|
|
341
|
+
}
|
|
342
|
+
.awsui_token-editor-add-token_1wzqe_13ua9_338:not(#\9) {
|
|
335
343
|
margin-block-start: var(--space-s-34lx8l, 12px);
|
|
336
344
|
}
|
|
337
345
|
|
|
338
|
-
.awsui_custom-content-
|
|
346
|
+
.awsui_custom-content-wrapper_1wzqe_13ua9_342:not(#\9) {
|
|
339
347
|
display: contents;
|
|
340
348
|
}
|
|
341
349
|
|
|
342
|
-
.awsui_custom-
|
|
350
|
+
.awsui_custom-control_1wzqe_13ua9_346:not(#\9) {
|
|
343
351
|
margin-inline-end: var(--space-s-34lx8l, 12px);
|
|
344
352
|
}
|
|
345
353
|
|
|
346
|
-
.
|
|
354
|
+
.awsui_input_1wzqe_13ua9_182:not(#\9) {
|
|
347
355
|
flex: 1;
|
|
348
356
|
}
|
|
349
357
|
|
|
350
|
-
.
|
|
358
|
+
.awsui_results_1wzqe_13ua9_354:not(#\9) {
|
|
351
359
|
padding-block: calc(var(--space-scaled-xxs-7597g1, 4px) + var(--border-field-width-09w7vk, 2px));
|
|
352
360
|
padding-inline: 0;
|
|
353
361
|
}
|
|
354
362
|
|
|
355
|
-
.awsui_token-
|
|
363
|
+
.awsui_token-trigger_1wzqe_13ua9_359:not(#\9) {
|
|
356
364
|
min-inline-size: 0;
|
|
357
365
|
word-break: break-word;
|
|
358
366
|
}
|
|
359
367
|
|
|
360
|
-
.awsui_remove-
|
|
361
|
-
.awsui_join-
|
|
362
|
-
.awsui_custom-filter-
|
|
368
|
+
.awsui_remove-all_1wzqe_13ua9_364:not(#\9),
|
|
369
|
+
.awsui_join-operation_1wzqe_13ua9_365:not(#\9),
|
|
370
|
+
.awsui_custom-filter-actions_1wzqe_13ua9_366:not(#\9) {
|
|
363
371
|
/* used in test-utils */
|
|
364
372
|
}
|
|
365
373
|
|
|
366
|
-
.
|
|
374
|
+
.awsui_constraint_1wzqe_13ua9_370:not(#\9) {
|
|
367
375
|
padding-block-start: var(--space-xxs-p8yyaw, 4px);
|
|
368
376
|
color: var(--color-text-form-secondary-dxc248, #5f6b7a);
|
|
369
377
|
font-size: var(--font-size-body-s-asqx2i, 12px);
|
|
@@ -2,43 +2,43 @@
|
|
|
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
|
-
"search-field": "awsui_search-
|
|
7
|
-
"input-wrapper": "awsui_input-
|
|
8
|
-
"add-token": "awsui_add-
|
|
9
|
-
"tokens": "
|
|
10
|
-
"token-operator": "awsui_token-
|
|
11
|
-
"property-editor": "awsui_property-
|
|
12
|
-
"property-editor-form": "awsui_property-editor-
|
|
13
|
-
"property-editor-field-property": "awsui_property-editor-field-
|
|
14
|
-
"property-editor-field-operator": "awsui_property-editor-field-
|
|
15
|
-
"property-editor-field-value": "awsui_property-editor-field-
|
|
16
|
-
"property-editor-cancel": "awsui_property-editor-
|
|
17
|
-
"property-editor-submit": "awsui_property-editor-
|
|
18
|
-
"property-editor-actions": "awsui_property-editor-
|
|
19
|
-
"token-editor": "awsui_token-
|
|
20
|
-
"token-editor-form": "awsui_token-editor-
|
|
21
|
-
"token-editor-field-property": "awsui_token-editor-field-
|
|
22
|
-
"token-editor-field-operator": "awsui_token-editor-field-
|
|
23
|
-
"token-editor-field-value": "awsui_token-editor-field-
|
|
24
|
-
"token-editor-cancel": "awsui_token-editor-
|
|
25
|
-
"token-editor-submit": "awsui_token-editor-
|
|
26
|
-
"token-editor-actions": "awsui_token-editor-
|
|
27
|
-
"token-editor-grid": "awsui_token-editor-
|
|
28
|
-
"token-editor-grid-group": "awsui_token-editor-grid-
|
|
29
|
-
"token-editor-narrow": "awsui_token-editor-
|
|
30
|
-
"token-editor-
|
|
31
|
-
"token-editor-grid-header": "awsui_token-editor-grid-
|
|
32
|
-
"token-editor-grid-cell": "awsui_token-editor-grid-
|
|
33
|
-
"token-editor-add-token": "awsui_token-editor-add-
|
|
34
|
-
"custom-content-wrapper": "awsui_custom-content-
|
|
35
|
-
"custom-control": "awsui_custom-
|
|
36
|
-
"input": "
|
|
37
|
-
"results": "
|
|
38
|
-
"token-trigger": "awsui_token-
|
|
39
|
-
"remove-all": "awsui_remove-
|
|
40
|
-
"join-operation": "awsui_join-
|
|
41
|
-
"custom-filter-actions": "awsui_custom-filter-
|
|
42
|
-
"constraint": "
|
|
5
|
+
"root": "awsui_root_1wzqe_13ua9_141",
|
|
6
|
+
"search-field": "awsui_search-field_1wzqe_13ua9_176",
|
|
7
|
+
"input-wrapper": "awsui_input-wrapper_1wzqe_13ua9_182",
|
|
8
|
+
"add-token": "awsui_add-token_1wzqe_13ua9_186",
|
|
9
|
+
"tokens": "awsui_tokens_1wzqe_13ua9_193",
|
|
10
|
+
"token-operator": "awsui_token-operator_1wzqe_13ua9_198",
|
|
11
|
+
"property-editor": "awsui_property-editor_1wzqe_13ua9_202",
|
|
12
|
+
"property-editor-form": "awsui_property-editor-form_1wzqe_13ua9_210",
|
|
13
|
+
"property-editor-field-property": "awsui_property-editor-field-property_1wzqe_13ua9_213",
|
|
14
|
+
"property-editor-field-operator": "awsui_property-editor-field-operator_1wzqe_13ua9_216",
|
|
15
|
+
"property-editor-field-value": "awsui_property-editor-field-value_1wzqe_13ua9_219",
|
|
16
|
+
"property-editor-cancel": "awsui_property-editor-cancel_1wzqe_13ua9_222",
|
|
17
|
+
"property-editor-submit": "awsui_property-editor-submit_1wzqe_13ua9_225",
|
|
18
|
+
"property-editor-actions": "awsui_property-editor-actions_1wzqe_13ua9_228",
|
|
19
|
+
"token-editor": "awsui_token-editor_1wzqe_13ua9_235",
|
|
20
|
+
"token-editor-form": "awsui_token-editor-form_1wzqe_13ua9_243",
|
|
21
|
+
"token-editor-field-property": "awsui_token-editor-field-property_1wzqe_13ua9_246",
|
|
22
|
+
"token-editor-field-operator": "awsui_token-editor-field-operator_1wzqe_13ua9_249",
|
|
23
|
+
"token-editor-field-value": "awsui_token-editor-field-value_1wzqe_13ua9_252",
|
|
24
|
+
"token-editor-cancel": "awsui_token-editor-cancel_1wzqe_13ua9_255",
|
|
25
|
+
"token-editor-submit": "awsui_token-editor-submit_1wzqe_13ua9_258",
|
|
26
|
+
"token-editor-actions": "awsui_token-editor-actions_1wzqe_13ua9_261",
|
|
27
|
+
"token-editor-grid": "awsui_token-editor-grid_1wzqe_13ua9_270",
|
|
28
|
+
"token-editor-grid-group": "awsui_token-editor-grid-group_1wzqe_13ua9_307",
|
|
29
|
+
"token-editor-narrow": "awsui_token-editor-narrow_1wzqe_13ua9_310",
|
|
30
|
+
"token-editor-supports-groups": "awsui_token-editor-supports-groups_1wzqe_13ua9_319",
|
|
31
|
+
"token-editor-grid-header": "awsui_token-editor-grid-header_1wzqe_13ua9_323",
|
|
32
|
+
"token-editor-grid-cell": "awsui_token-editor-grid-cell_1wzqe_13ua9_329",
|
|
33
|
+
"token-editor-add-token": "awsui_token-editor-add-token_1wzqe_13ua9_338",
|
|
34
|
+
"custom-content-wrapper": "awsui_custom-content-wrapper_1wzqe_13ua9_342",
|
|
35
|
+
"custom-control": "awsui_custom-control_1wzqe_13ua9_346",
|
|
36
|
+
"input": "awsui_input_1wzqe_13ua9_182",
|
|
37
|
+
"results": "awsui_results_1wzqe_13ua9_354",
|
|
38
|
+
"token-trigger": "awsui_token-trigger_1wzqe_13ua9_359",
|
|
39
|
+
"remove-all": "awsui_remove-all_1wzqe_13ua9_364",
|
|
40
|
+
"join-operation": "awsui_join-operation_1wzqe_13ua9_365",
|
|
41
|
+
"custom-filter-actions": "awsui_custom-filter-actions_1wzqe_13ua9_366",
|
|
42
|
+
"constraint": "awsui_constraint_1wzqe_13ua9_370"
|
|
43
43
|
};
|
|
44
44
|
|
|
@@ -15,10 +15,11 @@ export interface TokenEditorProps {
|
|
|
15
15
|
onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;
|
|
16
16
|
onSubmit: () => void;
|
|
17
17
|
onDismiss: () => void;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
tokensToCapture: InternalToken[];
|
|
19
|
+
onTokenCapture: (token: InternalToken) => void;
|
|
20
|
+
onTokenRelease: (token: InternalToken) => void;
|
|
20
21
|
tempGroup: InternalToken[];
|
|
21
22
|
onChangeTempGroup: (token: InternalToken[]) => void;
|
|
22
23
|
}
|
|
23
|
-
export declare function TokenEditor({ supportsGroups, asyncProperties, asyncProps, customGroupsText, freeTextFiltering, filteringProperties, filteringOptions, i18nStrings, onLoadItems, onSubmit, onDismiss,
|
|
24
|
+
export declare function TokenEditor({ supportsGroups, asyncProperties, asyncProps, customGroupsText, freeTextFiltering, filteringProperties, filteringOptions, i18nStrings, onLoadItems, onSubmit, onDismiss, tokensToCapture, onTokenCapture, onTokenRelease, tempGroup, onChangeTempGroup, }: TokenEditorProps): JSX.Element;
|
|
24
25
|
//# sourceMappingURL=token-editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-editor.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAE3F,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAKxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAEL,SAAS,EACT,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAMzB,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,mBAAmB,CAAC;IAChC,gBAAgB,EAAE,SAAS,SAAS,EAAE,CAAC;IACvC,iBAAiB,EAAE,yBAAyB,CAAC;IAC7C,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,CAAC;IAC1D,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACrD,WAAW,EAAE,mBAAmB,CAAC;IACjC,WAAW,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,CAAC;IACzD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,
|
|
1
|
+
{"version":3,"file":"token-editor.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"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S,EACT,iBAAiB,GAClB,EAAE,gBAAgB,eAsJlB"}
|
|
@@ -13,7 +13,7 @@ import { getAllowedOperators } from './controller.js';
|
|
|
13
13
|
import { OperatorInput, PropertyInput, ValueInput } from './token-editor-inputs.js';
|
|
14
14
|
import styles from './styles.css.js';
|
|
15
15
|
import testUtilStyles from './test-classes/styles.css.js';
|
|
16
|
-
export function TokenEditor({ supportsGroups, asyncProperties, asyncProps, customGroupsText, freeTextFiltering, filteringProperties, filteringOptions, i18nStrings, onLoadItems, onSubmit, onDismiss,
|
|
16
|
+
export function TokenEditor({ supportsGroups, asyncProperties, asyncProps, customGroupsText, freeTextFiltering, filteringProperties, filteringOptions, i18nStrings, onLoadItems, onSubmit, onDismiss, tokensToCapture, onTokenCapture, onTokenRelease, tempGroup, onChangeTempGroup, }) {
|
|
17
17
|
var _a;
|
|
18
18
|
const [nextFocusIndex, setNextFocusIndex] = useState(null);
|
|
19
19
|
const onFocusMoved = () => setNextFocusIndex(null);
|
|
@@ -56,14 +56,14 @@ export function TokenEditor({ supportsGroups, asyncProperties, asyncProps, custo
|
|
|
56
56
|
onChangeTempGroup(updated);
|
|
57
57
|
setNextFocusIndex(index);
|
|
58
58
|
}, onRemoveFromGroup: index => {
|
|
59
|
-
const
|
|
59
|
+
const releasedToken = tempGroup[index];
|
|
60
60
|
const updated = tempGroup.filter((_, existingIndex) => existingIndex !== index);
|
|
61
61
|
onChangeTempGroup(updated);
|
|
62
|
-
|
|
62
|
+
onTokenRelease(releasedToken);
|
|
63
63
|
setNextFocusIndex(index);
|
|
64
64
|
}, onSubmit: onSubmit, renderProperty: index => (React.createElement(PropertyInput, { property: groups[index].property, onChangePropertyKey: groups[index].onChangePropertyKey, asyncProps: asyncProperties ? asyncProps : null, filteringProperties: filteringProperties, onLoadItems: onLoadItems, customGroupsText: customGroupsText, i18nStrings: i18nStrings, freeTextFiltering: freeTextFiltering })), renderOperator: index => (React.createElement(OperatorInput, { property: groups[index].property, operator: groups[index].operator, onChangeOperator: groups[index].onChangeOperator, i18nStrings: i18nStrings, freeTextFiltering: freeTextFiltering, triggerVariant: supportsGroups ? 'label' : 'option' })), renderValue: index => (React.createElement(ValueInput, { property: groups[index].property, operator: groups[index].operator, value: groups[index].value, onChangeValue: groups[index].onChangeValue, asyncProps: asyncProps, filteringOptions: filteringOptions, onLoadItems: onLoadItems, i18nStrings: i18nStrings })), i18nStrings: i18nStrings }),
|
|
65
65
|
supportsGroups && (React.createElement("div", { className: clsx(styles['token-editor-add-token'], testUtilStyles['token-editor-token-add-actions']) },
|
|
66
|
-
React.createElement(InternalButtonDropdown, { variant: "normal", ariaLabel: i18nStrings.tokenEditorAddTokenActionsAriaLabel, items:
|
|
66
|
+
React.createElement(InternalButtonDropdown, { variant: "normal", ariaLabel: i18nStrings.tokenEditorAddTokenActionsAriaLabel, items: tokensToCapture.map((token, index) => {
|
|
67
67
|
var _a, _b, _c, _d;
|
|
68
68
|
return {
|
|
69
69
|
id: index.toString(),
|
|
@@ -72,15 +72,13 @@ export function TokenEditor({ supportsGroups, asyncProperties, asyncProps, custo
|
|
|
72
72
|
};
|
|
73
73
|
}), onItemClick: ({ detail }) => {
|
|
74
74
|
const index = parseInt(detail.id);
|
|
75
|
-
if (!isNaN(index) &&
|
|
76
|
-
|
|
77
|
-
const updated = standaloneTokens.filter((_, existingIndex) => existingIndex !== index);
|
|
78
|
-
onChangeStandalone(updated);
|
|
79
|
-
onChangeTempGroup([...tempGroup, addedToken]);
|
|
75
|
+
if (!isNaN(index) && tokensToCapture[index]) {
|
|
76
|
+
onChangeTempGroup([...tempGroup, Object.assign({}, tokensToCapture[index])]);
|
|
80
77
|
setNextFocusIndex(groups.length);
|
|
78
|
+
onTokenCapture(tokensToCapture[index]);
|
|
81
79
|
}
|
|
82
|
-
}, disabled:
|
|
83
|
-
text: (_a = i18nStrings
|
|
80
|
+
}, disabled: tokensToCapture.length === 0, mainAction: {
|
|
81
|
+
text: (_a = i18nStrings.tokenEditorAddNewTokenLabel) !== null && _a !== void 0 ? _a : '',
|
|
84
82
|
onClick: () => {
|
|
85
83
|
onChangeTempGroup([...tempGroup, { property: null, operator: ':', value: null }]);
|
|
86
84
|
setNextFocusIndex(groups.length);
|
|
@@ -108,7 +106,7 @@ function TokenEditorFields({ tokens, supportsGroups, onRemove, onRemoveFromGroup
|
|
|
108
106
|
!isNarrow && headers,
|
|
109
107
|
tokens.map((token, index) => {
|
|
110
108
|
var _a, _b, _c, _d, _e, _f;
|
|
111
|
-
return (React.createElement("div", { key: index, role: "group", "aria-label": i18nStrings.formatToken(token).formattedText, className: styles['token-editor-grid-group'] },
|
|
109
|
+
return (React.createElement("div", { key: index, role: "group", "aria-label": i18nStrings.formatToken(token).formattedText, className: clsx(styles['token-editor-grid-group'], supportsGroups && styles['token-editor-supports-groups']) },
|
|
112
110
|
React.createElement("div", { className: clsx(styles['token-editor-grid-cell'], isNarrow && styles['token-editor-narrow']) },
|
|
113
111
|
React.createElement(TokenEditorField, { isNarrow: isNarrow, label: i18nStrings.propertyText, labelId: propertyLabelId, className: clsx(styles['token-editor-field-property'], testUtilStyles['token-editor-field-property']), index: index }, renderProperty(index))),
|
|
114
112
|
React.createElement("div", { className: clsx(styles['token-editor-grid-cell'], isNarrow && styles['token-editor-narrow']) },
|
|
@@ -118,7 +116,11 @@ function TokenEditorFields({ tokens, supportsGroups, onRemove, onRemoveFromGroup
|
|
|
118
116
|
supportsGroups && (React.createElement("div", { className: clsx(styles['token-editor-grid-cell'], isNarrow && styles['token-editor-narrow']) },
|
|
119
117
|
React.createElement("div", { className: styles['token-editor-remove-token'] },
|
|
120
118
|
React.createElement(TokenEditorRemoveActions, { isNarrow: isNarrow, ariaLabel: (_b = (_a = i18nStrings.tokenEditorTokenActionsAriaLabel) === null || _a === void 0 ? void 0 : _a.call(i18nStrings, token)) !== null && _b !== void 0 ? _b : '', mainActionAriaLabel: (_d = (_c = i18nStrings.tokenEditorTokenRemoveAriaLabel) === null || _c === void 0 ? void 0 : _c.call(i18nStrings, token)) !== null && _d !== void 0 ? _d : '', disabled: tokens.length === 1, items: [
|
|
121
|
-
{
|
|
119
|
+
{
|
|
120
|
+
id: 'remove',
|
|
121
|
+
text: (_e = i18nStrings.tokenEditorTokenRemoveLabel) !== null && _e !== void 0 ? _e : '',
|
|
122
|
+
disabled: token.standaloneIndex !== undefined,
|
|
123
|
+
},
|
|
122
124
|
{ id: 'remove-from-group', text: (_f = i18nStrings.tokenEditorTokenRemoveFromGroupLabel) !== null && _f !== void 0 ? _f : '' },
|
|
123
125
|
], onItemClick: itemId => {
|
|
124
126
|
switch (itemId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-editor.js","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,cAAc,MAAM,uBAAuB,CAAC;AAEnD,OAAO,sBAAsB,MAAM,gCAAgC,CAAC;AACpE,OAAO,iBAAiB,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAE7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAWtD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAoB1D,MAAM,UAAU,WAAW,CAAC,EAC1B,cAAc,EACd,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,iBAAiB,E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,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,EACnD,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,cAAc,CAAC,mCAAmC,CAAC,oBAC9C,KAAK,GACrB,CACH,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\n\nimport InternalButton from '../button/internal.js';\nimport { ButtonDropdownProps } from '../button-dropdown/interfaces.js';\nimport InternalButtonDropdown from '../button-dropdown/internal.js';\nimport InternalFormField from '../form-field/internal.js';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces.js';\nimport { FormFieldContext } from '../internal/context/form-field-context.js';\nimport { NonCancelableEventHandler } from '../internal/events/index.js';\nimport { useListFocusController } from '../internal/hooks/use-list-focus-controller.js';\nimport { useMobile } from '../internal/hooks/use-mobile/index.js';\nimport { useUniqueId } from '../internal/hooks/use-unique-id/index.js';\nimport { getAllowedOperators } from './controller.js';\nimport { I18nStringsInternal } from './i18n-utils.js';\nimport {\n ComparisonOperator,\n GroupText,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\n InternalToken,\n LoadItemsDetail,\n} from './interfaces.js';\nimport { OperatorInput, PropertyInput, ValueInput } from './token-editor-inputs.js';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport interface TokenEditorProps {\n supportsGroups: boolean;\n asyncProperties?: boolean;\n asyncProps: DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n freeTextFiltering: InternalFreeTextFiltering;\n filteringProperties: readonly InternalFilteringProperty[];\n filteringOptions: readonly InternalFilteringOption[];\n i18nStrings: I18nStringsInternal;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n onSubmit: () => void;\n onDismiss: () => void;\n standaloneTokens: InternalToken[];\n onChangeStandalone: (newStandalone: InternalToken[]) => void;\n tempGroup: InternalToken[];\n onChangeTempGroup: (token: InternalToken[]) => void;\n}\n\nexport function TokenEditor({\n supportsGroups,\n asyncProperties,\n asyncProps,\n customGroupsText,\n freeTextFiltering,\n filteringProperties,\n filteringOptions,\n i18nStrings,\n onLoadItems,\n onSubmit,\n onDismiss,\n standaloneTokens,\n onChangeStandalone,\n tempGroup,\n onChangeTempGroup,\n}: TokenEditorProps) {\n const [nextFocusIndex, setNextFocusIndex] = useState<null | number>(null);\n const onFocusMoved = () => setNextFocusIndex(null);\n const tokenListRef = useListFocusController({\n nextFocusIndex,\n onFocusMoved,\n listItemSelector: `.${styles['token-editor-field-property']}`,\n outsideSelector: `.${styles['token-editor-add-token']}`,\n });\n\n const groups = tempGroup.map((temporaryToken, index) => {\n const setTemporaryToken = (newToken: InternalToken) => {\n const copy = [...tempGroup];\n copy[index] = newToken;\n onChangeTempGroup(copy);\n };\n const property = temporaryToken.property;\n const onChangePropertyKey = (newPropertyKey: undefined | string) => {\n const filteringProperty = filteringProperties.reduce<InternalFilteringProperty | undefined>(\n (acc, property) => (property.propertyKey === newPropertyKey ? property : acc),\n undefined\n );\n const allowedOperators = filteringProperty ? getAllowedOperators(filteringProperty) : freeTextFiltering.operators;\n const operator =\n temporaryToken.operator && allowedOperators.indexOf(temporaryToken.operator) !== -1\n ? temporaryToken.operator\n : allowedOperators[0];\n const matchedProperty = filteringProperties.find(property => property.propertyKey === newPropertyKey) ?? null;\n setTemporaryToken({ ...temporaryToken, property: matchedProperty, operator, value: null });\n };\n\n const operator = temporaryToken.operator;\n const onChangeOperator = (newOperator: ComparisonOperator) => {\n setTemporaryToken({ ...temporaryToken, operator: newOperator });\n };\n\n const value = temporaryToken.value;\n const onChangeValue = (newValue: unknown) => {\n setTemporaryToken({ ...temporaryToken, value: newValue });\n };\n\n return { token: temporaryToken, property, onChangePropertyKey, operator, onChangeOperator, value, onChangeValue };\n });\n return (\n <div className={styles['token-editor']} ref={tokenListRef}>\n <TokenEditorFields\n supportsGroups={supportsGroups}\n tokens={groups.map(group => group.token)}\n onRemove={index => {\n const updated = tempGroup.filter((_, existingIndex) => existingIndex !== index);\n onChangeTempGroup(updated);\n setNextFocusIndex(index);\n }}\n onRemoveFromGroup={index => {\n const removedToken = tempGroup[index];\n const updated = tempGroup.filter((_, existingIndex) => existingIndex !== index);\n onChangeTempGroup(updated);\n onChangeStandalone([...standaloneTokens, removedToken]);\n setNextFocusIndex(index);\n }}\n onSubmit={onSubmit}\n renderProperty={index => (\n <PropertyInput\n property={groups[index].property}\n onChangePropertyKey={groups[index].onChangePropertyKey}\n asyncProps={asyncProperties ? asyncProps : null}\n filteringProperties={filteringProperties}\n onLoadItems={onLoadItems}\n customGroupsText={customGroupsText}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n />\n )}\n renderOperator={index => (\n <OperatorInput\n property={groups[index].property}\n operator={groups[index].operator}\n onChangeOperator={groups[index].onChangeOperator}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n triggerVariant={supportsGroups ? 'label' : 'option'}\n />\n )}\n renderValue={index => (\n <ValueInput\n property={groups[index].property}\n operator={groups[index].operator}\n value={groups[index].value}\n onChangeValue={groups[index].onChangeValue}\n asyncProps={asyncProps}\n filteringOptions={filteringOptions}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n />\n )}\n i18nStrings={i18nStrings}\n />\n\n {supportsGroups && (\n <div className={clsx(styles['token-editor-add-token'], testUtilStyles['token-editor-token-add-actions'])}>\n <InternalButtonDropdown\n variant=\"normal\"\n ariaLabel={i18nStrings.tokenEditorAddTokenActionsAriaLabel}\n items={standaloneTokens.map((token, index) => {\n return {\n id: index.toString(),\n text: i18nStrings.tokenEditorAddExistingTokenLabel?.(token) ?? '',\n ariaLabel: i18nStrings.tokenEditorAddExistingTokenAriaLabel?.(token) ?? '',\n };\n })}\n onItemClick={({ detail }) => {\n const index = parseInt(detail.id);\n if (!isNaN(index) && standaloneTokens[index]) {\n const addedToken = standaloneTokens[index];\n const updated = standaloneTokens.filter((_, existingIndex) => existingIndex !== index);\n onChangeStandalone(updated);\n onChangeTempGroup([...tempGroup, addedToken]);\n setNextFocusIndex(groups.length);\n }\n }}\n disabled={standaloneTokens.length === 0}\n mainAction={{\n text: i18nStrings?.tokenEditorAddNewTokenLabel ?? '',\n onClick: () => {\n onChangeTempGroup([...tempGroup, { property: null, operator: ':', value: null }]);\n setNextFocusIndex(groups.length);\n },\n }}\n />\n </div>\n )}\n\n <div className={styles['token-editor-actions']}>\n <InternalButton\n formAction=\"none\"\n variant=\"link\"\n className={clsx(styles['token-editor-cancel'], testUtilStyles['token-editor-cancel'])}\n onClick={onDismiss}\n >\n {i18nStrings.cancelActionText}\n </InternalButton>\n <InternalButton\n className={clsx(styles['token-editor-submit'], testUtilStyles['token-editor-submit'])}\n formAction=\"none\"\n onClick={onSubmit}\n >\n {i18nStrings.applyActionText}\n </InternalButton>\n </div>\n </div>\n );\n}\n\ninterface TokenEditorLayout {\n tokens: InternalToken[];\n supportsGroups: boolean;\n onRemove: (index: number) => void;\n onRemoveFromGroup: (index: number) => void;\n onSubmit: () => void;\n renderProperty: (index: number) => React.ReactNode;\n renderOperator: (index: number) => React.ReactNode;\n renderValue: (index: number) => React.ReactNode;\n i18nStrings: I18nStringsInternal;\n}\n\nfunction TokenEditorFields({\n tokens,\n supportsGroups,\n onRemove,\n onRemoveFromGroup,\n onSubmit,\n renderProperty,\n renderOperator,\n renderValue,\n i18nStrings,\n}: TokenEditorLayout) {\n const isMobile = useMobile();\n const isNarrow = isMobile || !supportsGroups;\n\n const propertyLabelId = useUniqueId();\n const operatorLabelId = useUniqueId();\n const valueLabelId = useUniqueId();\n const headers = (\n <div className={styles['token-editor-grid-group']}>\n <div id={propertyLabelId} className={styles['token-editor-grid-header']}>\n {i18nStrings.propertyText}\n </div>\n <div id={operatorLabelId} className={styles['token-editor-grid-header']}>\n {i18nStrings.operatorText}\n </div>\n <div id={valueLabelId} className={styles['token-editor-grid-header']}>\n {i18nStrings.valueText}\n </div>\n <div className={styles['token-editor-grid-header']}></div>\n </div>\n );\n\n return (\n <form\n className={clsx(\n styles['token-editor-grid'],\n isNarrow && styles['token-editor-narrow'],\n styles['token-editor-form']\n )}\n onSubmit={event => {\n event.preventDefault();\n onSubmit();\n }}\n >\n {!isNarrow && headers}\n\n {tokens.map((token, index) => (\n <div\n key={index}\n role=\"group\"\n aria-label={i18nStrings.formatToken(token).formattedText}\n className={styles['token-editor-grid-group']}\n >\n <div className={clsx(styles['token-editor-grid-cell'], isNarrow && styles['token-editor-narrow'])}>\n <TokenEditorField\n isNarrow={isNarrow}\n label={i18nStrings.propertyText}\n labelId={propertyLabelId}\n className={clsx(styles['token-editor-field-property'], testUtilStyles['token-editor-field-property'])}\n index={index}\n >\n {renderProperty(index)}\n </TokenEditorField>\n </div>\n\n <div className={clsx(styles['token-editor-grid-cell'], isNarrow && styles['token-editor-narrow'])}>\n <TokenEditorField\n isNarrow={isNarrow}\n label={i18nStrings.operatorText}\n labelId={operatorLabelId}\n className={clsx(styles['token-editor-field-operator'], testUtilStyles['token-editor-field-operator'])}\n index={index}\n >\n {renderOperator(index)}\n </TokenEditorField>\n </div>\n\n <div className={clsx(styles['token-editor-grid-cell'], isNarrow && styles['token-editor-narrow'])}>\n <TokenEditorField\n isNarrow={isNarrow}\n label={i18nStrings.valueText}\n labelId={valueLabelId}\n className={clsx(styles['token-editor-field-value'], testUtilStyles['token-editor-field-value'])}\n index={index}\n >\n {renderValue(index)}\n </TokenEditorField>\n </div>\n\n {supportsGroups && (\n <div className={clsx(styles['token-editor-grid-cell'], isNarrow && styles['token-editor-narrow'])}>\n <div className={styles['token-editor-remove-token']}>\n <TokenEditorRemoveActions\n isNarrow={isNarrow}\n ariaLabel={i18nStrings.tokenEditorTokenActionsAriaLabel?.(token) ?? ''}\n mainActionAriaLabel={i18nStrings.tokenEditorTokenRemoveAriaLabel?.(token) ?? ''}\n disabled={tokens.length === 1}\n items={[\n { id: 'remove', text: i18nStrings.tokenEditorTokenRemoveLabel ?? '' },\n { id: 'remove-from-group', text: i18nStrings.tokenEditorTokenRemoveFromGroupLabel ?? '' },\n ]}\n onItemClick={itemId => {\n switch (itemId) {\n case 'remove':\n return onRemove(index);\n case 'remove-from-group':\n return onRemoveFromGroup(index);\n }\n }}\n index={index}\n />\n </div>\n </div>\n )}\n </div>\n ))}\n </form>\n );\n}\n\nfunction TokenEditorField({\n isNarrow,\n label,\n labelId,\n children,\n className,\n index,\n}: {\n isNarrow: boolean;\n label: React.ReactNode;\n labelId: string;\n children: React.ReactNode;\n className: string;\n index: number;\n}) {\n return isNarrow ? (\n <InternalFormField label={label} className={className} stretch={true} data-testindex={index}>\n {children}\n </InternalFormField>\n ) : (\n <FormFieldContext.Provider value={{ ariaLabelledby: labelId }}>\n <InternalFormField className={className} data-testindex={index}>\n {children}\n </InternalFormField>\n </FormFieldContext.Provider>\n );\n}\n\nfunction TokenEditorRemoveActions({\n isNarrow,\n ariaLabel,\n mainActionAriaLabel,\n disabled,\n items,\n onItemClick,\n index,\n}: {\n isNarrow: boolean;\n ariaLabel: string;\n mainActionAriaLabel: string;\n disabled: boolean;\n items: ButtonDropdownProps.Item[];\n onItemClick: (itemId: string) => void;\n index: number;\n}) {\n return isNarrow ? (\n <InternalButtonDropdown\n variant=\"normal\"\n ariaLabel={ariaLabel}\n items={items.slice(1)}\n onItemClick={({ detail }) => onItemClick(detail.id)}\n disabled={disabled}\n mainAction={{\n text: items[0].text,\n onClick: () => onItemClick(items[0].id),\n disabled,\n ariaLabel: mainActionAriaLabel,\n }}\n className={testUtilStyles['token-editor-token-remove-actions']}\n data-testindex={index}\n />\n ) : (\n <InternalButtonDropdown\n variant=\"icon\"\n ariaLabel={ariaLabel}\n items={items}\n onItemClick={({ detail }) => onItemClick(detail.id)}\n disabled={disabled}\n className={testUtilStyles['token-editor-token-remove-actions']}\n data-testindex={index}\n />\n );\n}\n"]}
|
|
1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,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,KAAK,EACL,WAAW,EACX,KAAK,GASN;IACC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAChB,oBAAC,sBAAsB,IACrB,OAAO,EAAC,QAAQ,EAChB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EACrB,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,EACnD,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE;YACV,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI;YACnB,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACvC,QAAQ;YACR,SAAS,EAAE,mBAAmB;SAC/B,EACD,SAAS,EAAE,cAAc,CAAC,mCAAmC,CAAC,oBAC9C,KAAK,GACrB,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,sBAAsB,IACrB,OAAO,EAAC,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,EACnD,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,cAAc,CAAC,mCAAmC,CAAC,oBAC9C,KAAK,GACrB,CACH,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\n\nimport InternalButton from '../button/internal.js';\nimport { ButtonDropdownProps } from '../button-dropdown/interfaces.js';\nimport InternalButtonDropdown from '../button-dropdown/internal.js';\nimport InternalFormField from '../form-field/internal.js';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces.js';\nimport { FormFieldContext } from '../internal/context/form-field-context.js';\nimport { NonCancelableEventHandler } from '../internal/events/index.js';\nimport { useListFocusController } from '../internal/hooks/use-list-focus-controller.js';\nimport { useMobile } from '../internal/hooks/use-mobile/index.js';\nimport { useUniqueId } from '../internal/hooks/use-unique-id/index.js';\nimport { getAllowedOperators } from './controller.js';\nimport { I18nStringsInternal } from './i18n-utils.js';\nimport {\n ComparisonOperator,\n GroupText,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\n InternalToken,\n LoadItemsDetail,\n} from './interfaces.js';\nimport { OperatorInput, PropertyInput, ValueInput } from './token-editor-inputs.js';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport interface TokenEditorProps {\n supportsGroups: boolean;\n asyncProperties?: boolean;\n asyncProps: DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n freeTextFiltering: InternalFreeTextFiltering;\n filteringProperties: readonly InternalFilteringProperty[];\n filteringOptions: readonly InternalFilteringOption[];\n i18nStrings: I18nStringsInternal;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n onSubmit: () => void;\n onDismiss: () => void;\n tokensToCapture: InternalToken[];\n onTokenCapture: (token: InternalToken) => void;\n onTokenRelease: (token: InternalToken) => void;\n tempGroup: InternalToken[];\n onChangeTempGroup: (token: InternalToken[]) => void;\n}\n\nexport function TokenEditor({\n supportsGroups,\n asyncProperties,\n asyncProps,\n customGroupsText,\n freeTextFiltering,\n filteringProperties,\n filteringOptions,\n i18nStrings,\n onLoadItems,\n onSubmit,\n onDismiss,\n tokensToCapture,\n onTokenCapture,\n onTokenRelease,\n tempGroup,\n onChangeTempGroup,\n}: TokenEditorProps) {\n const [nextFocusIndex, setNextFocusIndex] = useState<null | number>(null);\n const onFocusMoved = () => setNextFocusIndex(null);\n const tokenListRef = useListFocusController({\n nextFocusIndex,\n onFocusMoved,\n listItemSelector: `.${styles['token-editor-field-property']}`,\n outsideSelector: `.${styles['token-editor-add-token']}`,\n });\n\n const groups = tempGroup.map((temporaryToken, index) => {\n const setTemporaryToken = (newToken: InternalToken) => {\n const copy = [...tempGroup];\n copy[index] = newToken;\n onChangeTempGroup(copy);\n };\n const property = temporaryToken.property;\n const onChangePropertyKey = (newPropertyKey: undefined | string) => {\n const filteringProperty = filteringProperties.reduce<InternalFilteringProperty | undefined>(\n (acc, property) => (property.propertyKey === newPropertyKey ? property : acc),\n undefined\n );\n const allowedOperators = filteringProperty ? getAllowedOperators(filteringProperty) : freeTextFiltering.operators;\n const operator =\n temporaryToken.operator && allowedOperators.indexOf(temporaryToken.operator) !== -1\n ? temporaryToken.operator\n : allowedOperators[0];\n const matchedProperty = filteringProperties.find(property => property.propertyKey === newPropertyKey) ?? null;\n setTemporaryToken({ ...temporaryToken, property: matchedProperty, operator, value: null });\n };\n\n const operator = temporaryToken.operator;\n const onChangeOperator = (newOperator: ComparisonOperator) => {\n setTemporaryToken({ ...temporaryToken, operator: newOperator });\n };\n\n const value = temporaryToken.value;\n const onChangeValue = (newValue: unknown) => {\n setTemporaryToken({ ...temporaryToken, value: newValue });\n };\n\n return { token: temporaryToken, property, onChangePropertyKey, operator, onChangeOperator, value, onChangeValue };\n });\n\n return (\n <div className={styles['token-editor']} ref={tokenListRef}>\n <TokenEditorFields\n supportsGroups={supportsGroups}\n tokens={groups.map(group => group.token)}\n onRemove={index => {\n const updated = tempGroup.filter((_, existingIndex) => existingIndex !== index);\n onChangeTempGroup(updated);\n setNextFocusIndex(index);\n }}\n onRemoveFromGroup={index => {\n const releasedToken = tempGroup[index];\n const updated = tempGroup.filter((_, existingIndex) => existingIndex !== index);\n onChangeTempGroup(updated);\n onTokenRelease(releasedToken);\n setNextFocusIndex(index);\n }}\n onSubmit={onSubmit}\n renderProperty={index => (\n <PropertyInput\n property={groups[index].property}\n onChangePropertyKey={groups[index].onChangePropertyKey}\n asyncProps={asyncProperties ? asyncProps : null}\n filteringProperties={filteringProperties}\n onLoadItems={onLoadItems}\n customGroupsText={customGroupsText}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n />\n )}\n renderOperator={index => (\n <OperatorInput\n property={groups[index].property}\n operator={groups[index].operator}\n onChangeOperator={groups[index].onChangeOperator}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n triggerVariant={supportsGroups ? 'label' : 'option'}\n />\n )}\n renderValue={index => (\n <ValueInput\n property={groups[index].property}\n operator={groups[index].operator}\n value={groups[index].value}\n onChangeValue={groups[index].onChangeValue}\n asyncProps={asyncProps}\n filteringOptions={filteringOptions}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n />\n )}\n i18nStrings={i18nStrings}\n />\n\n {supportsGroups && (\n <div className={clsx(styles['token-editor-add-token'], testUtilStyles['token-editor-token-add-actions'])}>\n <InternalButtonDropdown\n variant=\"normal\"\n ariaLabel={i18nStrings.tokenEditorAddTokenActionsAriaLabel}\n items={tokensToCapture.map((token, index) => {\n return {\n id: index.toString(),\n text: i18nStrings.tokenEditorAddExistingTokenLabel?.(token) ?? '',\n ariaLabel: i18nStrings.tokenEditorAddExistingTokenAriaLabel?.(token) ?? '',\n };\n })}\n onItemClick={({ detail }) => {\n const index = parseInt(detail.id);\n if (!isNaN(index) && tokensToCapture[index]) {\n onChangeTempGroup([...tempGroup, { ...tokensToCapture[index] }]);\n setNextFocusIndex(groups.length);\n onTokenCapture(tokensToCapture[index]);\n }\n }}\n disabled={tokensToCapture.length === 0}\n mainAction={{\n text: i18nStrings.tokenEditorAddNewTokenLabel ?? '',\n onClick: () => {\n onChangeTempGroup([...tempGroup, { property: null, operator: ':', value: null }]);\n setNextFocusIndex(groups.length);\n },\n }}\n />\n </div>\n )}\n\n <div className={styles['token-editor-actions']}>\n <InternalButton\n formAction=\"none\"\n variant=\"link\"\n className={clsx(styles['token-editor-cancel'], testUtilStyles['token-editor-cancel'])}\n onClick={onDismiss}\n >\n {i18nStrings.cancelActionText}\n </InternalButton>\n <InternalButton\n className={clsx(styles['token-editor-submit'], testUtilStyles['token-editor-submit'])}\n formAction=\"none\"\n onClick={onSubmit}\n >\n {i18nStrings.applyActionText}\n </InternalButton>\n </div>\n </div>\n );\n}\n\ninterface TokenEditorLayout {\n tokens: InternalToken[];\n supportsGroups: boolean;\n onRemove: (index: number) => void;\n onRemoveFromGroup: (index: number) => void;\n onSubmit: () => void;\n renderProperty: (index: number) => React.ReactNode;\n renderOperator: (index: number) => React.ReactNode;\n renderValue: (index: number) => React.ReactNode;\n i18nStrings: I18nStringsInternal;\n}\n\nfunction TokenEditorFields({\n tokens,\n supportsGroups,\n onRemove,\n onRemoveFromGroup,\n onSubmit,\n renderProperty,\n renderOperator,\n renderValue,\n i18nStrings,\n}: TokenEditorLayout) {\n const isMobile = useMobile();\n const isNarrow = isMobile || !supportsGroups;\n\n const propertyLabelId = useUniqueId();\n const operatorLabelId = useUniqueId();\n const valueLabelId = useUniqueId();\n const headers = (\n <div className={styles['token-editor-grid-group']}>\n <div id={propertyLabelId} className={styles['token-editor-grid-header']}>\n {i18nStrings.propertyText}\n </div>\n <div id={operatorLabelId} className={styles['token-editor-grid-header']}>\n {i18nStrings.operatorText}\n </div>\n <div id={valueLabelId} className={styles['token-editor-grid-header']}>\n {i18nStrings.valueText}\n </div>\n <div className={styles['token-editor-grid-header']}></div>\n </div>\n );\n\n return (\n <form\n className={clsx(\n styles['token-editor-grid'],\n isNarrow && styles['token-editor-narrow'],\n styles['token-editor-form']\n )}\n onSubmit={event => {\n event.preventDefault();\n onSubmit();\n }}\n >\n {!isNarrow && headers}\n\n {tokens.map((token, index) => (\n <div\n key={index}\n role=\"group\"\n aria-label={i18nStrings.formatToken(token).formattedText}\n className={clsx(styles['token-editor-grid-group'], supportsGroups && styles['token-editor-supports-groups'])}\n >\n <div className={clsx(styles['token-editor-grid-cell'], isNarrow && styles['token-editor-narrow'])}>\n <TokenEditorField\n isNarrow={isNarrow}\n label={i18nStrings.propertyText}\n labelId={propertyLabelId}\n className={clsx(styles['token-editor-field-property'], testUtilStyles['token-editor-field-property'])}\n index={index}\n >\n {renderProperty(index)}\n </TokenEditorField>\n </div>\n\n <div className={clsx(styles['token-editor-grid-cell'], isNarrow && styles['token-editor-narrow'])}>\n <TokenEditorField\n isNarrow={isNarrow}\n label={i18nStrings.operatorText}\n labelId={operatorLabelId}\n className={clsx(styles['token-editor-field-operator'], testUtilStyles['token-editor-field-operator'])}\n index={index}\n >\n {renderOperator(index)}\n </TokenEditorField>\n </div>\n\n <div className={clsx(styles['token-editor-grid-cell'], isNarrow && styles['token-editor-narrow'])}>\n <TokenEditorField\n isNarrow={isNarrow}\n label={i18nStrings.valueText}\n labelId={valueLabelId}\n className={clsx(styles['token-editor-field-value'], testUtilStyles['token-editor-field-value'])}\n index={index}\n >\n {renderValue(index)}\n </TokenEditorField>\n </div>\n\n {supportsGroups && (\n <div className={clsx(styles['token-editor-grid-cell'], isNarrow && styles['token-editor-narrow'])}>\n <div className={styles['token-editor-remove-token']}>\n <TokenEditorRemoveActions\n isNarrow={isNarrow}\n ariaLabel={i18nStrings.tokenEditorTokenActionsAriaLabel?.(token) ?? ''}\n mainActionAriaLabel={i18nStrings.tokenEditorTokenRemoveAriaLabel?.(token) ?? ''}\n disabled={tokens.length === 1}\n items={[\n {\n id: 'remove',\n text: i18nStrings.tokenEditorTokenRemoveLabel ?? '',\n disabled: token.standaloneIndex !== undefined,\n },\n { id: 'remove-from-group', text: i18nStrings.tokenEditorTokenRemoveFromGroupLabel ?? '' },\n ]}\n onItemClick={itemId => {\n switch (itemId) {\n case 'remove':\n return onRemove(index);\n case 'remove-from-group':\n return onRemoveFromGroup(index);\n }\n }}\n index={index}\n />\n </div>\n </div>\n )}\n </div>\n ))}\n </form>\n );\n}\n\nfunction TokenEditorField({\n isNarrow,\n label,\n labelId,\n children,\n className,\n index,\n}: {\n isNarrow: boolean;\n label: React.ReactNode;\n labelId: string;\n children: React.ReactNode;\n className: string;\n index: number;\n}) {\n return isNarrow ? (\n <InternalFormField label={label} className={className} stretch={true} data-testindex={index}>\n {children}\n </InternalFormField>\n ) : (\n <FormFieldContext.Provider value={{ ariaLabelledby: labelId }}>\n <InternalFormField className={className} data-testindex={index}>\n {children}\n </InternalFormField>\n </FormFieldContext.Provider>\n );\n}\n\nfunction TokenEditorRemoveActions({\n isNarrow,\n ariaLabel,\n mainActionAriaLabel,\n disabled,\n items,\n onItemClick,\n index,\n}: {\n isNarrow: boolean;\n ariaLabel: string;\n mainActionAriaLabel: string;\n disabled: boolean;\n items: ButtonDropdownProps.Item[];\n onItemClick: (itemId: string) => void;\n index: number;\n}) {\n return isNarrow ? (\n <InternalButtonDropdown\n variant=\"normal\"\n ariaLabel={ariaLabel}\n items={items.slice(1)}\n onItemClick={({ detail }) => onItemClick(detail.id)}\n disabled={disabled}\n mainAction={{\n text: items[0].text,\n onClick: () => onItemClick(items[0].id),\n disabled,\n ariaLabel: mainActionAriaLabel,\n }}\n className={testUtilStyles['token-editor-token-remove-actions']}\n data-testindex={index}\n />\n ) : (\n <InternalButtonDropdown\n variant=\"icon\"\n ariaLabel={ariaLabel}\n items={items}\n onItemClick={({ detail }) => onItemClick(detail.id)}\n disabled={disabled}\n className={testUtilStyles['token-editor-token-remove-actions']}\n data-testindex={index}\n />\n );\n}\n"]}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';
|
|
3
3
|
import { NonCancelableEventHandler } from '../internal/events';
|
|
4
4
|
import { I18nStringsInternal } from './i18n-utils';
|
|
5
|
-
import { GroupText, InternalFilteringOption, InternalFilteringProperty, InternalFreeTextFiltering, InternalQuery, InternalToken, JoinOperation, LoadItemsDetail } from './interfaces';
|
|
5
|
+
import { GroupText, InternalFilteringOption, InternalFilteringProperty, InternalFreeTextFiltering, InternalQuery, InternalToken, InternalTokenGroup, JoinOperation, LoadItemsDetail } from './interfaces';
|
|
6
6
|
interface TokenProps {
|
|
7
7
|
query: InternalQuery;
|
|
8
8
|
tokenIndex: number;
|
|
9
|
-
onUpdateToken: (
|
|
10
|
-
onUpdateOperation: (
|
|
9
|
+
onUpdateToken: (updatedToken: InternalToken | InternalTokenGroup, releasedTokens: InternalToken[]) => void;
|
|
10
|
+
onUpdateOperation: (updatedOperation: JoinOperation) => void;
|
|
11
11
|
onRemoveToken: () => void;
|
|
12
12
|
asyncProperties?: boolean;
|
|
13
13
|
asyncProps: DropdownStatusProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AACxF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAEL,SAAS,EACT,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EAChB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AACxF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAEL,SAAS,EACT,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,eAAe,EAChB,MAAM,cAAc,CAAC;AAMtB,UAAU,UAAU;IAClB,KAAK,EAAE,aAAa,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,CAAC,YAAY,EAAE,aAAa,GAAG,kBAAkB,EAAE,cAAc,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IAC3G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