@cloudscape-design/components 3.0.693 → 3.0.694
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/app-layout/visual-refresh-toolbar/drawer/styles.css.js +6 -6
- package/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +7 -7
- package/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +6 -6
- package/app-layout/visual-refresh-toolbar/navigation/styles.css.js +6 -6
- package/app-layout/visual-refresh-toolbar/navigation/styles.scoped.css +15 -11
- package/app-layout/visual-refresh-toolbar/navigation/styles.selectors.js +6 -6
- package/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +16 -16
- package/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +28 -28
- package/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +16 -16
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/styles.css.js +6 -6
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/styles.scoped.css +30 -44
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/styles.selectors.js +6 -6
- package/button-dropdown/analytics-metadata/interfaces.d.ts +26 -0
- package/button-dropdown/analytics-metadata/interfaces.d.ts.map +1 -0
- package/button-dropdown/analytics-metadata/interfaces.js +4 -0
- package/button-dropdown/analytics-metadata/interfaces.js.map +1 -0
- package/button-dropdown/analytics-metadata/styles.css.js +8 -0
- package/button-dropdown/analytics-metadata/styles.scoped.css +9 -0
- package/button-dropdown/analytics-metadata/styles.selectors.js +9 -0
- package/button-dropdown/category-elements/category-element.d.ts +1 -1
- package/button-dropdown/category-elements/category-element.d.ts.map +1 -1
- package/button-dropdown/category-elements/category-element.js +2 -2
- package/button-dropdown/category-elements/category-element.js.map +1 -1
- package/button-dropdown/category-elements/expandable-category-element.d.ts +1 -1
- package/button-dropdown/category-elements/expandable-category-element.d.ts.map +1 -1
- package/button-dropdown/category-elements/expandable-category-element.js +14 -3
- package/button-dropdown/category-elements/expandable-category-element.js.map +1 -1
- package/button-dropdown/category-elements/mobile-expandable-category-element.d.ts +1 -1
- package/button-dropdown/category-elements/mobile-expandable-category-element.d.ts.map +1 -1
- package/button-dropdown/category-elements/mobile-expandable-category-element.js +14 -3
- package/button-dropdown/category-elements/mobile-expandable-category-element.js.map +1 -1
- package/button-dropdown/index.d.ts.map +1 -1
- package/button-dropdown/index.js +10 -1
- package/button-dropdown/index.js.map +1 -1
- package/button-dropdown/interfaces.d.ts +3 -0
- package/button-dropdown/interfaces.d.ts.map +1 -1
- package/button-dropdown/interfaces.js.map +1 -1
- package/button-dropdown/internal.d.ts.map +1 -1
- package/button-dropdown/internal.js +22 -6
- package/button-dropdown/internal.js.map +1 -1
- package/button-dropdown/item-element/index.d.ts +1 -1
- package/button-dropdown/item-element/index.d.ts.map +1 -1
- package/button-dropdown/item-element/index.js +15 -4
- package/button-dropdown/item-element/index.js.map +1 -1
- package/button-dropdown/items-list.d.ts +1 -1
- package/button-dropdown/items-list.d.ts.map +1 -1
- package/button-dropdown/items-list.js +4 -4
- package/button-dropdown/items-list.js.map +1 -1
- package/button-dropdown/styles.css.js +18 -15
- package/button-dropdown/styles.scoped.css +31 -22
- package/button-dropdown/styles.selectors.js +18 -15
- package/container/analytics-metadata/interfaces.d.ts +5 -0
- package/container/analytics-metadata/interfaces.d.ts.map +1 -0
- package/container/analytics-metadata/interfaces.js +4 -0
- package/container/analytics-metadata/interfaces.js.map +1 -0
- package/container/analytics-metadata/styles.css.js +6 -0
- package/container/analytics-metadata/styles.scoped.css +7 -0
- package/container/analytics-metadata/styles.selectors.js +7 -0
- package/container/index.d.ts.map +1 -1
- package/container/index.js +6 -1
- package/container/index.js.map +1 -1
- package/container/internal.d.ts.map +1 -1
- package/container/internal.js +4 -2
- package/container/internal.js.map +1 -1
- package/drawer/implementation.d.ts.map +1 -1
- package/drawer/implementation.js +3 -1
- package/drawer/implementation.js.map +1 -1
- package/drawer/styles.css.js +4 -3
- package/drawer/styles.scoped.css +16 -8
- package/drawer/styles.selectors.js +4 -3
- package/form/analytics-metadata/interfaces.d.ts +13 -0
- package/form/analytics-metadata/interfaces.d.ts.map +1 -0
- package/form/analytics-metadata/interfaces.js +4 -0
- package/form/analytics-metadata/interfaces.js.map +1 -0
- package/form/analytics-metadata/styles.css.js +6 -0
- package/form/analytics-metadata/styles.scoped.css +7 -0
- package/form/analytics-metadata/styles.selectors.js +7 -0
- package/form/index.d.ts.map +1 -1
- package/form/index.js +1 -1
- package/form/index.js.map +1 -1
- package/form/internal.d.ts +4 -2
- package/form/internal.d.ts.map +1 -1
- package/form/internal.js +13 -3
- package/form/internal.js.map +1 -1
- package/header/analytics-metadata/styles.css.js +6 -0
- package/header/analytics-metadata/styles.scoped.css +7 -0
- package/header/analytics-metadata/styles.selectors.js +7 -0
- package/header/internal.d.ts.map +1 -1
- package/header/internal.js +4 -2
- package/header/internal.js.map +1 -1
- package/help-panel/implementation.d.ts.map +1 -1
- package/help-panel/implementation.js +4 -2
- package/help-panel/implementation.js.map +1 -1
- package/help-panel/styles.css.js +5 -4
- package/help-panel/styles.scoped.css +74 -65
- package/help-panel/styles.selectors.js +5 -4
- package/internal/components/button-trigger/styles.css.js +11 -11
- package/internal/components/button-trigger/styles.scoped.css +52 -49
- package/internal/components/button-trigger/styles.selectors.js +11 -11
- package/internal/components/token-list/index.d.ts +1 -0
- package/internal/components/token-list/index.d.ts.map +1 -1
- package/internal/components/token-list/index.js.map +1 -1
- package/internal/components/tooltip/index.d.ts.map +1 -1
- package/internal/components/tooltip/index.js +1 -1
- package/internal/components/tooltip/index.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/popover/internal.d.ts +2 -1
- package/popover/internal.d.ts.map +1 -1
- package/popover/internal.js +1 -1
- package/popover/internal.js.map +1 -1
- package/popover/styles.css.js +52 -50
- package/popover/styles.scoped.css +75 -67
- package/popover/styles.selectors.js +52 -50
- package/property-filter/filtering-token/index.d.ts +25 -8
- package/property-filter/filtering-token/index.d.ts.map +1 -1
- package/property-filter/filtering-token/index.js +51 -11
- package/property-filter/filtering-token/index.js.map +1 -1
- package/property-filter/filtering-token/styles.css.js +18 -7
- package/property-filter/filtering-token/styles.scoped.css +100 -17
- package/property-filter/filtering-token/styles.selectors.js +18 -7
- package/property-filter/styles.css.js +31 -32
- package/property-filter/styles.scoped.css +33 -34
- package/property-filter/styles.selectors.js +31 -32
- package/property-filter/test-classes/styles.css.js +14 -9
- package/property-filter/test-classes/styles.scoped.css +29 -9
- package/property-filter/test-classes/styles.selectors.js +14 -9
- package/property-filter/token-editor.d.ts +5 -5
- package/property-filter/token-editor.d.ts.map +1 -1
- package/property-filter/token-editor.js +19 -25
- package/property-filter/token-editor.js.map +1 -1
- package/property-filter/token.d.ts.map +1 -1
- package/property-filter/token.js +15 -5
- package/property-filter/token.js.map +1 -1
- package/side-navigation/implementation.d.ts.map +1 -1
- package/side-navigation/implementation.js +3 -1
- package/side-navigation/implementation.js.map +1 -1
- package/side-navigation/styles.css.js +29 -28
- package/side-navigation/styles.scoped.css +47 -38
- package/side-navigation/styles.selectors.js +29 -28
- package/split-panel/implementation.d.ts.map +1 -1
- package/split-panel/implementation.js +3 -1
- package/split-panel/implementation.js.map +1 -1
- package/split-panel/side.d.ts.map +1 -1
- package/split-panel/side.js +4 -1
- package/split-panel/side.js.map +1 -1
- package/split-panel/styles.css.js +27 -27
- package/split-panel/styles.scoped.css +62 -44
- package/split-panel/styles.selectors.js +27 -27
- package/test-utils/dom/property-filter/index.d.ts +10 -0
- package/test-utils/dom/property-filter/index.js +25 -1
- package/test-utils/dom/property-filter/index.js.map +1 -1
- package/test-utils/selectors/property-filter/index.d.ts +10 -0
- package/test-utils/selectors/property-filter/index.js +25 -1
- package/test-utils/selectors/property-filter/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
|
@@ -2,37 +2,36 @@
|
|
|
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
|
-
"token-editor": "awsui_token-
|
|
13
|
-
"property-editor-form": "awsui_property-editor-
|
|
14
|
-
"token-editor-form": "awsui_token-editor-
|
|
15
|
-
"property-editor-field-property": "awsui_property-editor-field-
|
|
16
|
-
"token-editor-field-property": "awsui_token-editor-field-
|
|
17
|
-
"property-editor-field-operator": "awsui_property-editor-field-
|
|
18
|
-
"token-editor-field-operator": "awsui_token-editor-field-
|
|
19
|
-
"property-editor-field-value": "awsui_property-editor-field-
|
|
20
|
-
"token-editor-field-value": "awsui_token-editor-field-
|
|
21
|
-
"property-editor-cancel": "awsui_property-editor-
|
|
22
|
-
"token-editor-cancel": "awsui_token-editor-
|
|
23
|
-
"property-editor-submit": "awsui_property-editor-
|
|
24
|
-
"token-editor-submit": "awsui_token-editor-
|
|
25
|
-
"property-editor-actions": "awsui_property-editor-
|
|
26
|
-
"token-editor-actions": "awsui_token-editor-
|
|
27
|
-
"custom-content-wrapper": "awsui_custom-content-
|
|
28
|
-
"custom-control": "awsui_custom-
|
|
29
|
-
"input": "
|
|
30
|
-
"results": "
|
|
31
|
-
"token-trigger": "awsui_token-
|
|
32
|
-
"remove-all": "awsui_remove-
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"constraint": "awsui_constraint_1wzqe_1ktx1_236"
|
|
5
|
+
"root": "awsui_root_1wzqe_1phcq_97",
|
|
6
|
+
"search-field": "awsui_search-field_1wzqe_1phcq_132",
|
|
7
|
+
"input-wrapper": "awsui_input-wrapper_1wzqe_1phcq_138",
|
|
8
|
+
"add-token": "awsui_add-token_1wzqe_1phcq_142",
|
|
9
|
+
"tokens": "awsui_tokens_1wzqe_1phcq_149",
|
|
10
|
+
"token-operator": "awsui_token-operator_1wzqe_1phcq_154",
|
|
11
|
+
"property-editor": "awsui_property-editor_1wzqe_1phcq_158",
|
|
12
|
+
"token-editor": "awsui_token-editor_1wzqe_1phcq_159",
|
|
13
|
+
"property-editor-form": "awsui_property-editor-form_1wzqe_1phcq_164",
|
|
14
|
+
"token-editor-form": "awsui_token-editor-form_1wzqe_1phcq_165",
|
|
15
|
+
"property-editor-field-property": "awsui_property-editor-field-property_1wzqe_1phcq_168",
|
|
16
|
+
"token-editor-field-property": "awsui_token-editor-field-property_1wzqe_1phcq_169",
|
|
17
|
+
"property-editor-field-operator": "awsui_property-editor-field-operator_1wzqe_1phcq_172",
|
|
18
|
+
"token-editor-field-operator": "awsui_token-editor-field-operator_1wzqe_1phcq_173",
|
|
19
|
+
"property-editor-field-value": "awsui_property-editor-field-value_1wzqe_1phcq_176",
|
|
20
|
+
"token-editor-field-value": "awsui_token-editor-field-value_1wzqe_1phcq_177",
|
|
21
|
+
"property-editor-cancel": "awsui_property-editor-cancel_1wzqe_1phcq_180",
|
|
22
|
+
"token-editor-cancel": "awsui_token-editor-cancel_1wzqe_1phcq_181",
|
|
23
|
+
"property-editor-submit": "awsui_property-editor-submit_1wzqe_1phcq_184",
|
|
24
|
+
"token-editor-submit": "awsui_token-editor-submit_1wzqe_1phcq_185",
|
|
25
|
+
"property-editor-actions": "awsui_property-editor-actions_1wzqe_1phcq_188",
|
|
26
|
+
"token-editor-actions": "awsui_token-editor-actions_1wzqe_1phcq_189",
|
|
27
|
+
"custom-content-wrapper": "awsui_custom-content-wrapper_1wzqe_1phcq_207",
|
|
28
|
+
"custom-control": "awsui_custom-control_1wzqe_1phcq_211",
|
|
29
|
+
"input": "awsui_input_1wzqe_1phcq_138",
|
|
30
|
+
"results": "awsui_results_1wzqe_1phcq_219",
|
|
31
|
+
"token-trigger": "awsui_token-trigger_1wzqe_1phcq_224",
|
|
32
|
+
"remove-all": "awsui_remove-all_1wzqe_1phcq_229",
|
|
33
|
+
"join-operation": "awsui_join-operation_1wzqe_1phcq_230",
|
|
34
|
+
"custom-filter-actions": "awsui_custom-filter-actions_1wzqe_1phcq_231",
|
|
35
|
+
"constraint": "awsui_constraint_1wzqe_1phcq_235"
|
|
37
36
|
};
|
|
38
37
|
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"filtering-token": "awsui_filtering-
|
|
5
|
-
"filtering-token-dismiss-button": "awsui_filtering-token-dismiss-
|
|
6
|
-
"filtering-token-select": "awsui_filtering-token-
|
|
7
|
-
"filtering-token-content": "awsui_filtering-token-
|
|
8
|
-
"token-
|
|
9
|
-
"token-
|
|
10
|
-
"token-
|
|
11
|
-
"token-
|
|
12
|
-
"token-
|
|
4
|
+
"filtering-token": "awsui_filtering-token_1heb1_1doww_5",
|
|
5
|
+
"filtering-token-dismiss-button": "awsui_filtering-token-dismiss-button_1heb1_1doww_9",
|
|
6
|
+
"filtering-token-select": "awsui_filtering-token-select_1heb1_1doww_13",
|
|
7
|
+
"filtering-token-content": "awsui_filtering-token-content_1heb1_1doww_17",
|
|
8
|
+
"filtering-token-inner": "awsui_filtering-token-inner_1heb1_1doww_21",
|
|
9
|
+
"filtering-token-inner-dismiss-button": "awsui_filtering-token-inner-dismiss-button_1heb1_1doww_25",
|
|
10
|
+
"filtering-token-inner-select": "awsui_filtering-token-inner-select_1heb1_1doww_29",
|
|
11
|
+
"filtering-token-inner-content": "awsui_filtering-token-inner-content_1heb1_1doww_33",
|
|
12
|
+
"filtering-token-edit-button": "awsui_filtering-token-edit-button_1heb1_1doww_37",
|
|
13
|
+
"token-editor-field-property": "awsui_token-editor-field-property_1heb1_1doww_41",
|
|
14
|
+
"token-editor-field-operator": "awsui_token-editor-field-operator_1heb1_1doww_45",
|
|
15
|
+
"token-editor-field-value": "awsui_token-editor-field-value_1heb1_1doww_49",
|
|
16
|
+
"token-editor-cancel": "awsui_token-editor-cancel_1heb1_1doww_53",
|
|
17
|
+
"token-editor-submit": "awsui_token-editor-submit_1heb1_1doww_57"
|
|
13
18
|
};
|
|
14
19
|
|
|
@@ -2,38 +2,58 @@
|
|
|
2
2
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
.awsui_filtering-
|
|
5
|
+
.awsui_filtering-token_1heb1_1doww_5:not(#\9) {
|
|
6
6
|
/* used in test-utils */
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
.awsui_filtering-token-dismiss-
|
|
9
|
+
.awsui_filtering-token-dismiss-button_1heb1_1doww_9:not(#\9) {
|
|
10
10
|
/* used in test-utils */
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.awsui_filtering-token-
|
|
13
|
+
.awsui_filtering-token-select_1heb1_1doww_13:not(#\9) {
|
|
14
14
|
/* used in test-utils */
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.awsui_filtering-token-
|
|
17
|
+
.awsui_filtering-token-content_1heb1_1doww_17:not(#\9) {
|
|
18
18
|
/* used in test-utils */
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
.
|
|
21
|
+
.awsui_filtering-token-inner_1heb1_1doww_21:not(#\9) {
|
|
22
22
|
/* used in test-utils */
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
.
|
|
25
|
+
.awsui_filtering-token-inner-dismiss-button_1heb1_1doww_25:not(#\9) {
|
|
26
26
|
/* used in test-utils */
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
.
|
|
29
|
+
.awsui_filtering-token-inner-select_1heb1_1doww_29:not(#\9) {
|
|
30
30
|
/* used in test-utils */
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
.
|
|
33
|
+
.awsui_filtering-token-inner-content_1heb1_1doww_33:not(#\9) {
|
|
34
34
|
/* used in test-utils */
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
.
|
|
37
|
+
.awsui_filtering-token-edit-button_1heb1_1doww_37:not(#\9) {
|
|
38
|
+
/* used in test-utils */
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.awsui_token-editor-field-property_1heb1_1doww_41:not(#\9) {
|
|
42
|
+
/* used in test-utils */
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.awsui_token-editor-field-operator_1heb1_1doww_45:not(#\9) {
|
|
46
|
+
/* used in test-utils */
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.awsui_token-editor-field-value_1heb1_1doww_49:not(#\9) {
|
|
50
|
+
/* used in test-utils */
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.awsui_token-editor-cancel_1heb1_1doww_53:not(#\9) {
|
|
54
|
+
/* used in test-utils */
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.awsui_token-editor-submit_1heb1_1doww_57:not(#\9) {
|
|
38
58
|
/* used in test-utils */
|
|
39
59
|
}
|
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"filtering-token": "awsui_filtering-
|
|
6
|
-
"filtering-token-dismiss-button": "awsui_filtering-token-dismiss-
|
|
7
|
-
"filtering-token-select": "awsui_filtering-token-
|
|
8
|
-
"filtering-token-content": "awsui_filtering-token-
|
|
9
|
-
"token-
|
|
10
|
-
"token-
|
|
11
|
-
"token-
|
|
12
|
-
"token-
|
|
13
|
-
"token-
|
|
5
|
+
"filtering-token": "awsui_filtering-token_1heb1_1doww_5",
|
|
6
|
+
"filtering-token-dismiss-button": "awsui_filtering-token-dismiss-button_1heb1_1doww_9",
|
|
7
|
+
"filtering-token-select": "awsui_filtering-token-select_1heb1_1doww_13",
|
|
8
|
+
"filtering-token-content": "awsui_filtering-token-content_1heb1_1doww_17",
|
|
9
|
+
"filtering-token-inner": "awsui_filtering-token-inner_1heb1_1doww_21",
|
|
10
|
+
"filtering-token-inner-dismiss-button": "awsui_filtering-token-inner-dismiss-button_1heb1_1doww_25",
|
|
11
|
+
"filtering-token-inner-select": "awsui_filtering-token-inner-select_1heb1_1doww_29",
|
|
12
|
+
"filtering-token-inner-content": "awsui_filtering-token-inner-content_1heb1_1doww_33",
|
|
13
|
+
"filtering-token-edit-button": "awsui_filtering-token-edit-button_1heb1_1doww_37",
|
|
14
|
+
"token-editor-field-property": "awsui_token-editor-field-property_1heb1_1doww_41",
|
|
15
|
+
"token-editor-field-operator": "awsui_token-editor-field-operator_1heb1_1doww_45",
|
|
16
|
+
"token-editor-field-value": "awsui_token-editor-field-value_1heb1_1doww_49",
|
|
17
|
+
"token-editor-cancel": "awsui_token-editor-cancel_1heb1_1doww_53",
|
|
18
|
+
"token-editor-submit": "awsui_token-editor-submit_1heb1_1doww_57"
|
|
14
19
|
};
|
|
15
20
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';
|
|
3
3
|
import { NonCancelableEventHandler } from '../internal/events';
|
|
4
4
|
import { GroupText, I18nStrings, InternalFilteringOption, InternalFilteringProperty, InternalFreeTextFiltering, InternalToken, LoadItemsDetail, Token } from './interfaces';
|
|
@@ -8,15 +8,15 @@ interface TokenEditorProps {
|
|
|
8
8
|
customGroupsText: readonly GroupText[];
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
freeTextFiltering: InternalFreeTextFiltering;
|
|
11
|
-
expandToViewport?: boolean;
|
|
12
11
|
filteringProperties: readonly InternalFilteringProperty[];
|
|
13
12
|
filteringOptions: readonly InternalFilteringOption[];
|
|
14
13
|
i18nStrings: I18nStrings;
|
|
15
14
|
onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;
|
|
16
15
|
setToken: (newToken: Token) => void;
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
onDismiss: () => void;
|
|
17
|
+
temporaryToken: InternalToken;
|
|
18
|
+
onChangeTemporaryToken: (token: InternalToken) => void;
|
|
19
19
|
}
|
|
20
|
-
export declare function TokenEditor({ asyncProperties, asyncProps, customGroupsText, freeTextFiltering,
|
|
20
|
+
export declare function TokenEditor({ asyncProperties, asyncProps, customGroupsText, freeTextFiltering, filteringProperties, filteringOptions, i18nStrings, onLoadItems, setToken, onDismiss, temporaryToken, onChangeTemporaryToken, }: TokenEditorProps): JSX.Element;
|
|
21
21
|
export {};
|
|
22
22
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"token-editor.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AACxF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAI/D,OAAO,EAEL,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,eAAe,EACf,KAAK,EACN,MAAM,cAAc,CAAC;AAoJtB,UAAU,gBAAgB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,mBAAmB,CAAC;IAChC,gBAAgB,EAAE,SAAS,SAAS,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,yBAAyB,CAAC;IAC7C,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,CAAC;IAC1D,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACrD,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,CAAC;IACzD,QAAQ,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;IACpC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,cAAc,EAAE,aAAa,CAAC;IAC9B,sBAAsB,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;CACxD;AAED,wBAAgB,WAAW,CAAC,EAC1B,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,cAAc,EACd,sBAAsB,GACvB,EAAE,gBAAgB,eAiGlB"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import React
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import InternalAutosuggest from '../autosuggest/internal';
|
|
6
6
|
import InternalButton from '../button/internal';
|
|
7
7
|
import InternalFormField from '../form-field/internal';
|
|
8
|
-
import InternalPopover from '../popover/internal';
|
|
9
8
|
import InternalSelect from '../select/internal';
|
|
10
9
|
import { getAllowedOperators, getPropertySuggestions, operatorToDescription } from './controller';
|
|
11
10
|
import { useLoadItems } from './use-load-items';
|
|
@@ -63,12 +62,7 @@ function ValueInput({ property, operator, value, onChangeValue, asyncProps, filt
|
|
|
63
62
|
const OperatorForm = (property === null || property === void 0 ? void 0 : property.propertyKey) && operator && (property === null || property === void 0 ? void 0 : property.getValueFormRenderer(operator));
|
|
64
63
|
return OperatorForm ? (React.createElement(OperatorForm, { value: value, onChange: onChangeValue, operator: operator })) : (React.createElement(InternalAutosuggest, Object.assign({ enteredTextLabel: (_a = i18nStrings.enteredTextLabel) !== null && _a !== void 0 ? _a : (value => value), value: (_c = (_b = matchedOption === null || matchedOption === void 0 ? void 0 : matchedOption.label) !== null && _b !== void 0 ? _b : value) !== null && _c !== void 0 ? _c : '', clearAriaLabel: i18nStrings.clearAriaLabel, onChange: e => onChangeValue(e.detail.value), disabled: !operator, options: valueOptions }, asyncValueAutosuggestProps, { virtualScroll: true })));
|
|
65
64
|
}
|
|
66
|
-
export function TokenEditor({ asyncProperties, asyncProps, customGroupsText, freeTextFiltering,
|
|
67
|
-
const [temporaryToken, setTemporaryToken] = useState(token);
|
|
68
|
-
const popoverRef = useRef(null);
|
|
69
|
-
const closePopover = () => {
|
|
70
|
-
popoverRef.current && popoverRef.current.dismissPopover();
|
|
71
|
-
};
|
|
65
|
+
export function TokenEditor({ asyncProperties, asyncProps, customGroupsText, freeTextFiltering, filteringProperties, filteringOptions, i18nStrings, onLoadItems, setToken, onDismiss, temporaryToken, onChangeTemporaryToken, }) {
|
|
72
66
|
const property = temporaryToken.property;
|
|
73
67
|
const onChangePropertyKey = (newPropertyKey) => {
|
|
74
68
|
var _a;
|
|
@@ -78,29 +72,29 @@ export function TokenEditor({ asyncProperties, asyncProps, customGroupsText, fre
|
|
|
78
72
|
? temporaryToken.operator
|
|
79
73
|
: allowedOperators[0];
|
|
80
74
|
const matchedProperty = (_a = filteringProperties.find(property => property.propertyKey === newPropertyKey)) !== null && _a !== void 0 ? _a : null;
|
|
81
|
-
|
|
75
|
+
onChangeTemporaryToken(Object.assign(Object.assign({}, temporaryToken), { property: matchedProperty, operator, value: null }));
|
|
82
76
|
};
|
|
83
77
|
const operator = temporaryToken.operator;
|
|
84
78
|
const onChangeOperator = (newOperator) => {
|
|
85
|
-
|
|
79
|
+
onChangeTemporaryToken(Object.assign(Object.assign({}, temporaryToken), { operator: newOperator }));
|
|
86
80
|
};
|
|
87
81
|
const value = temporaryToken.value;
|
|
88
82
|
const onChangeValue = (newValue) => {
|
|
89
|
-
|
|
83
|
+
onChangeTemporaryToken(Object.assign(Object.assign({}, temporaryToken), { value: newValue }));
|
|
90
84
|
};
|
|
91
|
-
return (React.createElement(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
85
|
+
return (React.createElement("div", { className: styles['token-editor'] },
|
|
86
|
+
React.createElement("div", { className: styles['token-editor-form'] },
|
|
87
|
+
React.createElement(InternalFormField, { label: i18nStrings.propertyText, className: clsx(styles['token-editor-field-property'], testUtilStyles['token-editor-field-property']) },
|
|
88
|
+
React.createElement(PropertyInput, { property: property, onChangePropertyKey: onChangePropertyKey, asyncProps: asyncProperties ? asyncProps : null, filteringProperties: filteringProperties, onLoadItems: onLoadItems, customGroupsText: customGroupsText, i18nStrings: i18nStrings, freeTextFiltering: freeTextFiltering })),
|
|
89
|
+
React.createElement(InternalFormField, { label: i18nStrings.operatorText, className: clsx(styles['token-editor-field-operator'], testUtilStyles['token-editor-field-operator']) },
|
|
90
|
+
React.createElement(OperatorInput, { property: property, operator: operator, onChangeOperator: onChangeOperator, i18nStrings: i18nStrings, freeTextFiltering: freeTextFiltering })),
|
|
91
|
+
React.createElement(InternalFormField, { label: i18nStrings.valueText, className: clsx(styles['token-editor-field-value'], testUtilStyles['token-editor-field-value']) },
|
|
92
|
+
React.createElement(ValueInput, { property: property, operator: operator, value: value, onChangeValue: onChangeValue, asyncProps: asyncProps, filteringOptions: filteringOptions, onLoadItems: onLoadItems, i18nStrings: i18nStrings }))),
|
|
93
|
+
React.createElement("div", { className: styles['token-editor-actions'] },
|
|
94
|
+
React.createElement(InternalButton, { formAction: "none", variant: "link", className: clsx(styles['token-editor-cancel'], testUtilStyles['token-editor-cancel']), onClick: onDismiss }, i18nStrings.cancelActionText),
|
|
95
|
+
React.createElement(InternalButton, { className: clsx(styles['token-editor-submit'], testUtilStyles['token-editor-submit']), formAction: "none", onClick: () => {
|
|
96
|
+
setToken(matchTokenValue(temporaryToken, filteringOptions));
|
|
97
|
+
onDismiss();
|
|
98
|
+
} }, i18nStrings.applyActionText))));
|
|
105
99
|
}
|
|
106
100
|
//# sourceMappingURL=token-editor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-editor.js","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,mBAAmB,MAAM,yBAAyB,CAAC;AAC1D,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAGvD,OAAO,eAAuC,MAAM,qBAAqB,CAAC;AAE1E,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAYlG,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAa1D,SAAS,aAAa,CAAC,EACrB,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,iBAAiB,GACE;;IACnB,MAAM,sBAAsB,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,wBAAwB,GAAG,UAAU,CAAC,CAAC,iCAAM,UAAU,GAAK,sBAAsB,EAAG,CAAC,CAAC,EAAE,CAAC;IAChG,MAAM,eAAe,GAAqD,sBAAsB,CAC9F,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;QACnC,KAAK,EAAE,WAAW;QAClB,KA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,KAAK,EAAE,WAAW,CAAC,SAAS,EAC5B,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,EAAE,cAAc,CAAC,0BAA0B,CAAC,CAAC;oBAE/F,oBAAC,UAAU,IACT,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,GACxB,CACgB,CAChB;YAEN,6BAAK,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC;gBAC5C,oBAAC,cAAc,IACb,UAAU,EAAC,MAAM,EACjB,OAAO,EAAC,MAAM,EACd,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAC,EACrF,OAAO,EAAE,YAAY,IAEpB,WAAW,CAAC,gBAAgB,CACd;gBACjB,oBAAC,cAAc,IACb,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAC,EACrF,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,GAAG,EAAE;wBACZ,QAAQ,CAAC,eAAe,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC,CAAC;wBAC5D,YAAY,EAAE,CAAC;oBACjB,CAAC,IAEA,WAAW,CAAC,eAAe,CACb,CACb,CACF,IAGP,gBAAgB,CACD,CACnB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport InternalAutosuggest from '../autosuggest/internal';\nimport InternalButton from '../button/internal';\nimport InternalFormField from '../form-field/internal';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport InternalPopover, { InternalPopoverRef } from '../popover/internal';\nimport { SelectProps } from '../select/interfaces';\nimport InternalSelect from '../select/internal';\nimport { getAllowedOperators, getPropertySuggestions, operatorToDescription } from './controller';\nimport {\n ComparisonOperator,\n GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\n InternalToken,\n LoadItemsDetail,\n Token,\n} from './interfaces';\nimport { useLoadItems } from './use-load-items';\nimport { matchTokenValue } from './utils';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\ninterface PropertyInputProps {\n asyncProps: null | DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n freeTextFiltering: InternalFreeTextFiltering;\n filteringProperties: readonly InternalFilteringProperty[];\n i18nStrings: I18nStrings;\n onChangePropertyKey: (propertyKey: undefined | string) => void;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n property: null | InternalFilteringProperty;\n}\n\nfunction PropertyInput({\n property,\n onChangePropertyKey,\n asyncProps,\n filteringProperties,\n onLoadItems,\n customGroupsText,\n i18nStrings,\n freeTextFiltering,\n}: PropertyInputProps) {\n const propertySelectHandlers = useLoadItems(onLoadItems);\n const asyncPropertySelectProps = asyncProps ? { ...asyncProps, ...propertySelectHandlers } : {};\n const propertyOptions: (SelectProps.Option | SelectProps.OptionGroup)[] = getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n ({ propertyKey, propertyLabel }) => ({\n value: propertyKey,\n label: propertyLabel,\n dontCloseOnSelect: true,\n })\n );\n\n const allPropertiesOption = {\n label: i18nStrings.allPropertiesLabel,\n value: undefined,\n };\n if (!freeTextFiltering.disabled) {\n propertyOptions.unshift(allPropertiesOption);\n }\n return (\n <InternalSelect\n options={propertyOptions}\n selectedOption={\n property\n ? {\n value: property.propertyKey ?? undefined,\n label: property.propertyLabel,\n }\n : allPropertiesOption\n }\n onChange={e => onChangePropertyKey(e.detail.selectedOption.value)}\n {...asyncPropertySelectProps}\n />\n );\n}\n\ninterface OperatorInputProps {\n i18nStrings: I18nStrings;\n onChangeOperator: (operator: ComparisonOperator) => void;\n operator: undefined | ComparisonOperator;\n property: null | InternalFilteringProperty;\n freeTextFiltering: InternalFreeTextFiltering;\n}\n\nfunction OperatorInput({ property, operator, onChangeOperator, i18nStrings, freeTextFiltering }: OperatorInputProps) {\n const operatorOptions = (property ? getAllowedOperators(property) : freeTextFiltering.operators).map(operator => ({\n value: operator,\n label: operator,\n description: operatorToDescription(operator, i18nStrings),\n }));\n return (\n <InternalSelect\n options={operatorOptions}\n triggerVariant=\"option\"\n selectedOption={\n operator\n ? {\n value: operator,\n label: operator,\n description: operatorToDescription(operator, i18nStrings),\n }\n : null\n }\n onChange={e => onChangeOperator(e.detail.selectedOption.value as ComparisonOperator)}\n />\n );\n}\n\ninterface ValueInputProps {\n asyncProps: DropdownStatusProps;\n filteringOptions: readonly InternalFilteringOption[];\n i18nStrings: I18nStrings;\n onChangeValue: (value: string) => void;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n operator: undefined | ComparisonOperator;\n property: null | InternalFilteringProperty;\n value: undefined | string;\n}\n\nfunction ValueInput({\n property,\n operator,\n value,\n onChangeValue,\n asyncProps,\n filteringOptions,\n onLoadItems,\n i18nStrings,\n}: ValueInputProps) {\n const valueOptions = property\n ? filteringOptions\n .filter(option => option.property?.propertyKey === property.propertyKey)\n .map(({ label, value }) => ({ label, value }))\n : [];\n\n const valueAutosuggestHandlers = useLoadItems(onLoadItems, '', property?.externalProperty);\n const asyncValueAutosuggestProps = property?.propertyKey\n ? { ...valueAutosuggestHandlers, ...asyncProps }\n : { empty: asyncProps.empty };\n const [matchedOption] = valueOptions.filter(option => option.value === value);\n\n const OperatorForm = property?.propertyKey && operator && property?.getValueFormRenderer(operator);\n\n return OperatorForm ? (\n <OperatorForm value={value} onChange={onChangeValue} operator={operator} />\n ) : (\n <InternalAutosuggest\n enteredTextLabel={i18nStrings.enteredTextLabel ?? (value => value)}\n value={matchedOption?.label ?? value ?? ''}\n clearAriaLabel={i18nStrings.clearAriaLabel}\n onChange={e => onChangeValue(e.detail.value)}\n disabled={!operator}\n options={valueOptions}\n {...asyncValueAutosuggestProps}\n virtualScroll={true}\n />\n );\n}\n\ninterface TokenEditorProps {\n asyncProperties?: boolean;\n asyncProps: DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n disabled?: boolean;\n freeTextFiltering: InternalFreeTextFiltering;\n expandToViewport?: boolean;\n filteringProperties: readonly InternalFilteringProperty[];\n filteringOptions: readonly InternalFilteringOption[];\n i18nStrings: I18nStrings;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n setToken: (newToken: Token) => void;\n token: InternalToken;\n triggerComponent?: React.ReactNode;\n}\n\nexport function TokenEditor({\n asyncProperties,\n asyncProps,\n customGroupsText,\n freeTextFiltering,\n expandToViewport,\n filteringProperties,\n filteringOptions,\n i18nStrings,\n onLoadItems,\n setToken,\n token,\n triggerComponent,\n}: TokenEditorProps) {\n const [temporaryToken, setTemporaryToken] = useState<InternalToken>(token);\n const popoverRef = useRef<InternalPopoverRef>(null);\n const closePopover = () => {\n popoverRef.current && popoverRef.current.dismissPopover();\n };\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: string) => {\n setTemporaryToken({ ...temporaryToken, value: newValue });\n };\n\n return (\n <InternalPopover\n ref={popoverRef}\n className={styles['token-label']}\n triggerType=\"text\"\n header={i18nStrings.editTokenHeader}\n size=\"large\"\n position=\"right\"\n dismissAriaLabel={i18nStrings.dismissAriaLabel}\n __onOpen={() => setTemporaryToken(token)}\n renderWithPortal={expandToViewport}\n content={\n <div className={styles['token-editor']}>\n <div className={styles['token-editor-form']}>\n <InternalFormField\n label={i18nStrings.propertyText}\n className={clsx(styles['token-editor-field-property'], testUtilStyles['token-editor-field-property'])}\n >\n <PropertyInput\n property={property}\n onChangePropertyKey={onChangePropertyKey}\n asyncProps={asyncProperties ? asyncProps : null}\n filteringProperties={filteringProperties}\n onLoadItems={onLoadItems}\n customGroupsText={customGroupsText}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n />\n </InternalFormField>\n\n <InternalFormField\n label={i18nStrings.operatorText}\n className={clsx(styles['token-editor-field-operator'], testUtilStyles['token-editor-field-operator'])}\n >\n <OperatorInput\n property={property}\n operator={operator}\n onChangeOperator={onChangeOperator}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n />\n </InternalFormField>\n\n <InternalFormField\n label={i18nStrings.valueText}\n className={clsx(styles['token-editor-field-value'], testUtilStyles['token-editor-field-value'])}\n >\n <ValueInput\n property={property}\n operator={operator}\n value={value}\n onChangeValue={onChangeValue}\n asyncProps={asyncProps}\n filteringOptions={filteringOptions}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n />\n </InternalFormField>\n </div>\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={closePopover}\n >\n {i18nStrings.cancelActionText}\n </InternalButton>\n <InternalButton\n className={clsx(styles['token-editor-submit'], testUtilStyles['token-editor-submit'])}\n formAction=\"none\"\n onClick={() => {\n setToken(matchTokenValue(temporaryToken, filteringOptions));\n closePopover();\n }}\n >\n {i18nStrings.applyActionText}\n </InternalButton>\n </div>\n </div>\n }\n >\n {triggerComponent}\n </InternalPopover>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"token-editor.js","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,mBAAmB,MAAM,yBAAyB,CAAC;AAC1D,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAIvD,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAYlG,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAa1D,SAAS,aAAa,CAAC,EACrB,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,iBAAiB,GACE;;IACnB,MAAM,sBAAsB,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,wBAAwB,GAAG,UAAU,CAAC,CAAC,iCAAM,UAAU,GAAK,sBAAsB,EAAG,CAAC,CAAC,EAAE,CAAC;IAChG,MAAM,eAAe,GAAqD,sBAAsB,CAC9F,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;QACnC,KAAK,EA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AE,SAAS,IAEjB,WAAW,CAAC,gBAAgB,CACd;YACjB,oBAAC,cAAc,IACb,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAC,EACrF,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,GAAG,EAAE;oBACZ,QAAQ,CAAC,eAAe,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC,CAAC;oBAC5D,SAAS,EAAE,CAAC;gBACd,CAAC,IAEA,WAAW,CAAC,eAAe,CACb,CACb,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport InternalAutosuggest from '../autosuggest/internal';\nimport InternalButton from '../button/internal';\nimport InternalFormField from '../form-field/internal';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { SelectProps } from '../select/interfaces';\nimport InternalSelect from '../select/internal';\nimport { getAllowedOperators, getPropertySuggestions, operatorToDescription } from './controller';\nimport {\n ComparisonOperator,\n GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\n InternalToken,\n LoadItemsDetail,\n Token,\n} from './interfaces';\nimport { useLoadItems } from './use-load-items';\nimport { matchTokenValue } from './utils';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\ninterface PropertyInputProps {\n asyncProps: null | DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n freeTextFiltering: InternalFreeTextFiltering;\n filteringProperties: readonly InternalFilteringProperty[];\n i18nStrings: I18nStrings;\n onChangePropertyKey: (propertyKey: undefined | string) => void;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n property: null | InternalFilteringProperty;\n}\n\nfunction PropertyInput({\n property,\n onChangePropertyKey,\n asyncProps,\n filteringProperties,\n onLoadItems,\n customGroupsText,\n i18nStrings,\n freeTextFiltering,\n}: PropertyInputProps) {\n const propertySelectHandlers = useLoadItems(onLoadItems);\n const asyncPropertySelectProps = asyncProps ? { ...asyncProps, ...propertySelectHandlers } : {};\n const propertyOptions: (SelectProps.Option | SelectProps.OptionGroup)[] = getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n ({ propertyKey, propertyLabel }) => ({\n value: propertyKey,\n label: propertyLabel,\n dontCloseOnSelect: true,\n })\n );\n\n const allPropertiesOption = {\n label: i18nStrings.allPropertiesLabel,\n value: undefined,\n };\n if (!freeTextFiltering.disabled) {\n propertyOptions.unshift(allPropertiesOption);\n }\n return (\n <InternalSelect\n options={propertyOptions}\n selectedOption={\n property\n ? {\n value: property.propertyKey ?? undefined,\n label: property.propertyLabel,\n }\n : allPropertiesOption\n }\n onChange={e => onChangePropertyKey(e.detail.selectedOption.value)}\n {...asyncPropertySelectProps}\n />\n );\n}\n\ninterface OperatorInputProps {\n i18nStrings: I18nStrings;\n onChangeOperator: (operator: ComparisonOperator) => void;\n operator: undefined | ComparisonOperator;\n property: null | InternalFilteringProperty;\n freeTextFiltering: InternalFreeTextFiltering;\n}\n\nfunction OperatorInput({ property, operator, onChangeOperator, i18nStrings, freeTextFiltering }: OperatorInputProps) {\n const operatorOptions = (property ? getAllowedOperators(property) : freeTextFiltering.operators).map(operator => ({\n value: operator,\n label: operator,\n description: operatorToDescription(operator, i18nStrings),\n }));\n return (\n <InternalSelect\n options={operatorOptions}\n triggerVariant=\"option\"\n selectedOption={\n operator\n ? {\n value: operator,\n label: operator,\n description: operatorToDescription(operator, i18nStrings),\n }\n : null\n }\n onChange={e => onChangeOperator(e.detail.selectedOption.value as ComparisonOperator)}\n />\n );\n}\n\ninterface ValueInputProps {\n asyncProps: DropdownStatusProps;\n filteringOptions: readonly InternalFilteringOption[];\n i18nStrings: I18nStrings;\n onChangeValue: (value: string) => void;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n operator: undefined | ComparisonOperator;\n property: null | InternalFilteringProperty;\n value: undefined | string;\n}\n\nfunction ValueInput({\n property,\n operator,\n value,\n onChangeValue,\n asyncProps,\n filteringOptions,\n onLoadItems,\n i18nStrings,\n}: ValueInputProps) {\n const valueOptions = property\n ? filteringOptions\n .filter(option => option.property?.propertyKey === property.propertyKey)\n .map(({ label, value }) => ({ label, value }))\n : [];\n\n const valueAutosuggestHandlers = useLoadItems(onLoadItems, '', property?.externalProperty);\n const asyncValueAutosuggestProps = property?.propertyKey\n ? { ...valueAutosuggestHandlers, ...asyncProps }\n : { empty: asyncProps.empty };\n const [matchedOption] = valueOptions.filter(option => option.value === value);\n\n const OperatorForm = property?.propertyKey && operator && property?.getValueFormRenderer(operator);\n\n return OperatorForm ? (\n <OperatorForm value={value} onChange={onChangeValue} operator={operator} />\n ) : (\n <InternalAutosuggest\n enteredTextLabel={i18nStrings.enteredTextLabel ?? (value => value)}\n value={matchedOption?.label ?? value ?? ''}\n clearAriaLabel={i18nStrings.clearAriaLabel}\n onChange={e => onChangeValue(e.detail.value)}\n disabled={!operator}\n options={valueOptions}\n {...asyncValueAutosuggestProps}\n virtualScroll={true}\n />\n );\n}\n\ninterface TokenEditorProps {\n asyncProperties?: boolean;\n asyncProps: DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n disabled?: boolean;\n freeTextFiltering: InternalFreeTextFiltering;\n filteringProperties: readonly InternalFilteringProperty[];\n filteringOptions: readonly InternalFilteringOption[];\n i18nStrings: I18nStrings;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n setToken: (newToken: Token) => void;\n onDismiss: () => void;\n temporaryToken: InternalToken;\n onChangeTemporaryToken: (token: InternalToken) => void;\n}\n\nexport function TokenEditor({\n asyncProperties,\n asyncProps,\n customGroupsText,\n freeTextFiltering,\n filteringProperties,\n filteringOptions,\n i18nStrings,\n onLoadItems,\n setToken,\n onDismiss,\n temporaryToken,\n onChangeTemporaryToken,\n}: TokenEditorProps) {\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 onChangeTemporaryToken({ ...temporaryToken, property: matchedProperty, operator, value: null });\n };\n\n const operator = temporaryToken.operator;\n const onChangeOperator = (newOperator: ComparisonOperator) => {\n onChangeTemporaryToken({ ...temporaryToken, operator: newOperator });\n };\n\n const value = temporaryToken.value;\n const onChangeValue = (newValue: string) => {\n onChangeTemporaryToken({ ...temporaryToken, value: newValue });\n };\n\n return (\n <div className={styles['token-editor']}>\n <div className={styles['token-editor-form']}>\n <InternalFormField\n label={i18nStrings.propertyText}\n className={clsx(styles['token-editor-field-property'], testUtilStyles['token-editor-field-property'])}\n >\n <PropertyInput\n property={property}\n onChangePropertyKey={onChangePropertyKey}\n asyncProps={asyncProperties ? asyncProps : null}\n filteringProperties={filteringProperties}\n onLoadItems={onLoadItems}\n customGroupsText={customGroupsText}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n />\n </InternalFormField>\n\n <InternalFormField\n label={i18nStrings.operatorText}\n className={clsx(styles['token-editor-field-operator'], testUtilStyles['token-editor-field-operator'])}\n >\n <OperatorInput\n property={property}\n operator={operator}\n onChangeOperator={onChangeOperator}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n />\n </InternalFormField>\n\n <InternalFormField\n label={i18nStrings.valueText}\n className={clsx(styles['token-editor-field-value'], testUtilStyles['token-editor-field-value'])}\n >\n <ValueInput\n property={property}\n operator={operator}\n value={value}\n onChangeValue={onChangeValue}\n asyncProps={asyncProps}\n filteringOptions={filteringOptions}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n />\n </InternalFormField>\n </div>\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={() => {\n setToken(matchTokenValue(temporaryToken, filteringOptions));\n onDismiss();\n }}\n >\n {i18nStrings.applyActionText}\n </InternalButton>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token.tsx"],"names":[],"mappings":";
|
|
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,EAEL,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,aAAa,EACb,eAAe,EACf,KAAK,EACN,MAAM,cAAc,CAAC;AAMtB,UAAU,UAAU;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,mBAAmB,CAAC;IAChC,gBAAgB,EAAE,SAAS,SAAS,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,yBAAyB,CAAC;IAC7C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,CAAC;IAC1D,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACrD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,CAAC;IACzD,SAAS,EAAE,aAAa,CAAC;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,YAAY,EAAE,CAAC,YAAY,EAAE,aAAa,KAAK,IAAI,CAAC;IACpD,QAAQ,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;IACpC,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,eAAO,MAAM,WAAW,qPAkBrB,UAAU,gBAyDZ,CAAC"}
|
package/property-filter/token.js
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useRef, useState } from 'react';
|
|
4
4
|
import FilteringToken from './filtering-token';
|
|
5
5
|
import { TokenEditor } from './token-editor';
|
|
6
6
|
import { getFormattedToken } from './utils';
|
|
7
7
|
import styles from './styles.css.js';
|
|
8
8
|
export const TokenButton = ({ token, operation = 'and', first, removeToken, setToken, setOperation, filteringProperties, filteringOptions, asyncProps, onLoadItems, i18nStrings, asyncProperties, hideOperations, customGroupsText, disabled, freeTextFiltering, expandToViewport, }) => {
|
|
9
|
-
var _a, _b, _c, _d;
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
10
|
+
const tokenRef = useRef(null);
|
|
10
11
|
const externalToken = Object.assign(Object.assign({}, token), { propertyKey: (_a = token.property) === null || _a === void 0 ? void 0 : _a.propertyKey });
|
|
11
12
|
const formattedToken = getFormattedToken(token);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const [temporaryToken, setTemporaryToken] = useState(token);
|
|
14
|
+
return (React.createElement(FilteringToken, { ref: tokenRef, tokens: [
|
|
15
|
+
{
|
|
16
|
+
content: (React.createElement("span", { className: styles['token-trigger'] },
|
|
17
|
+
React.createElement(TokenTrigger, { property: formattedToken.property, operator: token.operator, value: formattedToken.value }))),
|
|
18
|
+
ariaLabel: formattedToken.label,
|
|
19
|
+
dismissAriaLabel: (_c = (_b = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.removeTokenButtonAriaLabel) === null || _b === void 0 ? void 0 : _b.call(i18nStrings, externalToken)) !== null && _c !== void 0 ? _c : '',
|
|
20
|
+
},
|
|
21
|
+
], showOperation: !first && !hideOperations, operation: operation, andText: (_d = i18nStrings.operationAndText) !== null && _d !== void 0 ? _d : '', orText: (_e = i18nStrings.operationOrText) !== null && _e !== void 0 ? _e : '', operationAriaLabel: (_f = i18nStrings.tokenOperatorAriaLabel) !== null && _f !== void 0 ? _f : '', onChangeOperation: setOperation, onDismissToken: removeToken, disabled: disabled, editorContent: React.createElement(TokenEditor, { setToken: setToken, filteringProperties: filteringProperties, filteringOptions: filteringOptions, temporaryToken: temporaryToken, onChangeTemporaryToken: setTemporaryToken, asyncProps: asyncProps, onLoadItems: onLoadItems, i18nStrings: i18nStrings, asyncProperties: asyncProperties, customGroupsText: customGroupsText, freeTextFiltering: freeTextFiltering, onDismiss: () => { var _a; return (_a = tokenRef.current) === null || _a === void 0 ? void 0 : _a.closeEditor(); } }), editorHeader: (_g = i18nStrings.editTokenHeader) !== null && _g !== void 0 ? _g : '', editorDismissAriaLabel: (_h = i18nStrings.dismissAriaLabel) !== null && _h !== void 0 ? _h : '', editorExpandToViewport: !!expandToViewport, onEditorOpen: () => setTemporaryToken(token),
|
|
22
|
+
// The properties below are only relevant for grouped tokens that are not supported
|
|
23
|
+
// by the property filter component yet.
|
|
24
|
+
groupOperation: operation, groupAriaLabel: '', groupEditAriaLabel: '', onChangeGroupOperation: () => { }, hasGroups: false }));
|
|
15
25
|
};
|
|
16
26
|
const TokenTrigger = ({ property, operator, value, }) => {
|
|
17
27
|
if (property) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/property-filter/token.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/property-filter/token.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIhD,OAAO,cAAqC,MAAM,mBAAmB,CAAC;AAatE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAsBrC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,KAAK,EACL,SAAS,GAAG,KAAK,EACjB,KAAK,EACL,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,WAAW,EACX,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,GACL,EAAE,EAAE;;IACf,MAAM,QAAQ,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IACjD,MAAM,aAAa,mCAAQ,KAAK,KAAE,WAAW,EAAE,MAAA,KAAK,CAAC,QAAQ,0CAAE,WAAW,GAAE,CAAC;IAC7E,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAgB,KAAK,CAAC,CAAC;IAE3E,OAAO,CACL,oBAAC,cAAc,IACb,GAAG,EAAE,QAAQ,EACb,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,CACP,8BAAM,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC;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AY,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC;QAC5C,mFAAmF;QACnF,wCAAwC;QACxC,cAAc,EAAE,SAAS,EACzB,cAAc,EAAE,EAAE,EAClB,kBAAkB,EAAE,EAAE,EACtB,sBAAsB,EAAE,GAAG,EAAE,GAAE,CAAC,EAChC,SAAS,EAAE,KAAK,GAChB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,EACpB,QAAQ,EACR,QAAQ,EACR,KAAK,GAKN,EAAE,EAAE;IACH,IAAI,QAAQ,EAAE;QACZ,QAAQ,IAAI,GAAG,CAAC;KACjB;IACD,MAAM,qBAAqB,GAAG,QAAQ,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC5D,MAAM,YAAY,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC;IACjE,OAAO,CACL;QACG,QAAQ;QACT,8BAAM,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,IAAG,YAAY,CAAQ;QAC/D,KAAK,CACL,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useRef, useState } from 'react';\n\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport FilteringToken, { FilteringTokenRef } from './filtering-token';\nimport {\n ComparisonOperator,\n GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\n InternalToken,\n JoinOperation,\n LoadItemsDetail,\n Token,\n} from './interfaces';\nimport { TokenEditor } from './token-editor';\nimport { getFormattedToken } from './utils';\n\nimport styles from './styles.css.js';\n\ninterface TokenProps {\n asyncProperties?: boolean;\n asyncProps: DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n disabled?: boolean;\n freeTextFiltering: InternalFreeTextFiltering;\n expandToViewport?: boolean;\n filteringProperties: readonly InternalFilteringProperty[];\n filteringOptions: readonly InternalFilteringOption[];\n first?: boolean;\n hideOperations?: boolean;\n i18nStrings: I18nStrings;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n operation: JoinOperation;\n removeToken: () => void;\n setOperation: (newOperation: JoinOperation) => void;\n setToken: (newToken: Token) => void;\n token: InternalToken;\n}\n\nexport const TokenButton = ({\n token,\n operation = 'and',\n first,\n removeToken,\n setToken,\n setOperation,\n filteringProperties,\n filteringOptions,\n asyncProps,\n onLoadItems,\n i18nStrings,\n asyncProperties,\n hideOperations,\n customGroupsText,\n disabled,\n freeTextFiltering,\n expandToViewport,\n}: TokenProps) => {\n const tokenRef = useRef<FilteringTokenRef>(null);\n const externalToken = { ...token, propertyKey: token.property?.propertyKey };\n const formattedToken = getFormattedToken(token);\n const [temporaryToken, setTemporaryToken] = useState<InternalToken>(token);\n\n return (\n <FilteringToken\n ref={tokenRef}\n tokens={[\n {\n content: (\n <span className={styles['token-trigger']}>\n <TokenTrigger property={formattedToken.property} operator={token.operator} value={formattedToken.value} />\n </span>\n ),\n ariaLabel: formattedToken.label,\n dismissAriaLabel: i18nStrings?.removeTokenButtonAriaLabel?.(externalToken) ?? '',\n },\n ]}\n showOperation={!first && !hideOperations}\n operation={operation}\n andText={i18nStrings.operationAndText ?? ''}\n orText={i18nStrings.operationOrText ?? ''}\n operationAriaLabel={i18nStrings.tokenOperatorAriaLabel ?? ''}\n onChangeOperation={setOperation}\n onDismissToken={removeToken}\n disabled={disabled}\n editorContent={\n <TokenEditor\n setToken={setToken}\n filteringProperties={filteringProperties}\n filteringOptions={filteringOptions}\n temporaryToken={temporaryToken}\n onChangeTemporaryToken={setTemporaryToken}\n asyncProps={asyncProps}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n asyncProperties={asyncProperties}\n customGroupsText={customGroupsText}\n freeTextFiltering={freeTextFiltering}\n onDismiss={() => tokenRef.current?.closeEditor()}\n />\n }\n editorHeader={i18nStrings.editTokenHeader ?? ''}\n editorDismissAriaLabel={i18nStrings.dismissAriaLabel ?? ''}\n editorExpandToViewport={!!expandToViewport}\n onEditorOpen={() => setTemporaryToken(token)}\n // The properties below are only relevant for grouped tokens that are not supported\n // by the property filter component yet.\n groupOperation={operation}\n groupAriaLabel={''}\n groupEditAriaLabel={''}\n onChangeGroupOperation={() => {}}\n hasGroups={false}\n />\n );\n};\n\nconst TokenTrigger = ({\n property,\n operator,\n value,\n}: {\n property?: string;\n operator?: ComparisonOperator;\n value: string;\n}) => {\n if (property) {\n property += ' ';\n }\n const freeTextContainsToken = operator === ':' && !property;\n const operatorText = freeTextContainsToken ? '' : operator + ' ';\n return (\n <>\n {property}\n <span className={styles['token-operator']}>{operatorText}</span>\n {value}\n </>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/side-navigation/implementation.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/side-navigation/implementation.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMnD,MAAM,MAAM,2BAA2B,GAAG,mBAAmB,GAAG,0BAA0B,CAAC;AAE3F,wBAAgB,4BAA4B,CAAC,EAC3C,MAAM,EACN,UAAU,EACV,KAAU,EACV,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,2BAA2B,eAwD7B;AAED,eAAO,MAAM,8BAA8B,mGAA0D,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { __rest } from "tslib";
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
+
import { getGlobalFlag } from '@cloudscape-design/component-toolkit/internal';
|
|
6
7
|
import { getBaseProps } from '../internal/base-component';
|
|
7
8
|
import { fireCancelableEvent, fireNonCancelableEvent } from '../internal/events';
|
|
8
9
|
import { isDevelopment } from '../internal/is-development';
|
|
@@ -14,6 +15,7 @@ export function SideNavigationImplementation(_a) {
|
|
|
14
15
|
var { header, activeHref, items = [], onFollow, onChange, __internalRootRef } = _a, props = __rest(_a, ["header", "activeHref", "items", "onFollow", "onChange", "__internalRootRef"]);
|
|
15
16
|
const baseProps = getBaseProps(props);
|
|
16
17
|
const parentMap = useMemo(() => generateExpandableItemsMapping(items), [items]);
|
|
18
|
+
const hasToolbar = getGlobalFlag('appLayoutWidget');
|
|
17
19
|
if (isDevelopment) {
|
|
18
20
|
// This code should be wiped in production anyway.
|
|
19
21
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -27,7 +29,7 @@ export function SideNavigationImplementation(_a) {
|
|
|
27
29
|
const onFollowHandler = useCallback((item, sourceEvent) => {
|
|
28
30
|
fireCancelableEvent(onFollow, item, sourceEvent);
|
|
29
31
|
}, [onFollow]);
|
|
30
|
-
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(styles.root, baseProps.className), ref: __internalRootRef }),
|
|
32
|
+
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(styles.root, baseProps.className, hasToolbar && styles['with-toolbar']), ref: __internalRootRef }),
|
|
31
33
|
header && (React.createElement(Header, { definition: header, activeHref: activeHref, fireChange: onChangeHandler, fireFollow: onFollowHandler })),
|
|
32
34
|
items && (React.createElement("div", { className: styles['list-container'] },
|
|
33
35
|
React.createElement(NavigationItemsList, { variant: "root", items: items, fireFollow: onFollowHandler, fireChange: onChangeHandler, activeHref: activeHref })))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/side-navigation/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;A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C3C,WAAyC,EACzC,EAAE;QACF,mBAAmB,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACnD,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,6CACM,SAAS,IACb,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,EAAE,UAAU,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC,EACvF,GAAG,EAAE,iBAAiB;QAErB,MAAM,IAAI,CACT,oBAAC,MAAM,IAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,GAAI,CACjH;QACA,KAAK,IAAI,CACR,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC;YACtC,oBAAC,mBAAmB,IAClB,OAAO,EAAC,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,eAAe,EAC3B,UAAU,EAAE,eAAe,EAC3B,UAAU,EAAE,UAAU,GACtB,CACE,CACP,CACG,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,8BAA8B,GAAG,yBAAyB,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport clsx from 'clsx';\n\nimport { getGlobalFlag } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { fireCancelableEvent, fireNonCancelableEvent } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { isDevelopment } from '../internal/is-development';\nimport { createWidgetizedComponent } from '../internal/widgets';\nimport { SideNavigationProps } from './interfaces';\nimport { Header, NavigationItemsList } from './parts';\nimport { checkDuplicateHrefs, generateExpandableItemsMapping } from './util';\n\nimport styles from './styles.css.js';\n\nexport type SideNavigationInternalProps = SideNavigationProps & InternalBaseComponentProps;\n\nexport function SideNavigationImplementation({\n header,\n activeHref,\n items = [],\n onFollow,\n onChange,\n __internalRootRef,\n ...props\n}: SideNavigationInternalProps) {\n const baseProps = getBaseProps(props);\n const parentMap = useMemo(() => generateExpandableItemsMapping(items), [items]);\n const hasToolbar = getGlobalFlag('appLayoutWidget');\n\n if (isDevelopment) {\n // This code should be wiped in production anyway.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => checkDuplicateHrefs(items), [items]);\n }\n\n const onChangeHandler = useCallback(\n (item: SideNavigationProps.Section | SideNavigationProps.ExpandableLinkGroup, expanded: boolean) => {\n // generateExpandableItemsMapping walks through the entire tree, so we're certain about getting a value.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n fireNonCancelableEvent(onChange, { item, expanded: expanded, expandableParents: parentMap.get(item)! });\n },\n [onChange, parentMap]\n );\n\n const onFollowHandler = useCallback(\n (\n item:\n | SideNavigationProps.Link\n | SideNavigationProps.Header\n | SideNavigationProps.LinkGroup\n | SideNavigationProps.ExpandableLinkGroup,\n sourceEvent: React.SyntheticEvent | Event\n ) => {\n fireCancelableEvent(onFollow, item, sourceEvent);\n },\n [onFollow]\n );\n\n return (\n <div\n {...baseProps}\n className={clsx(styles.root, baseProps.className, hasToolbar && styles['with-toolbar'])}\n ref={__internalRootRef}\n >\n {header && (\n <Header definition={header} activeHref={activeHref} fireChange={onChangeHandler} fireFollow={onFollowHandler} />\n )}\n {items && (\n <div className={styles['list-container']}>\n <NavigationItemsList\n variant=\"root\"\n items={items}\n fireFollow={onFollowHandler}\n fireChange={onChangeHandler}\n activeHref={activeHref}\n />\n </div>\n )}\n </div>\n );\n}\n\nexport const createWidgetizedSideNavigation = createWidgetizedComponent(SideNavigationImplementation);\n"]}
|