@cloudscape-design/components 3.0.86 → 3.0.88

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.
Files changed (83) hide show
  1. package/checkbox/internal.d.ts +0 -1
  2. package/checkbox/internal.d.ts.map +1 -1
  3. package/checkbox/internal.js +9 -11
  4. package/checkbox/internal.js.map +1 -1
  5. package/date-picker/index.js +1 -1
  6. package/date-picker/index.js.map +1 -1
  7. package/date-picker/styles.css.js +7 -6
  8. package/date-picker/styles.scoped.css +14 -7
  9. package/date-picker/styles.selectors.js +7 -6
  10. package/date-range-picker/dropdown.d.ts.map +1 -1
  11. package/date-range-picker/dropdown.js +7 -10
  12. package/date-range-picker/dropdown.js.map +1 -1
  13. package/date-range-picker/index.js +1 -1
  14. package/date-range-picker/index.js.map +1 -1
  15. package/date-range-picker/styles.css.js +37 -36
  16. package/date-range-picker/styles.scoped.css +48 -44
  17. package/date-range-picker/styles.selectors.js +37 -36
  18. package/date-range-picker/utils.d.ts +18 -0
  19. package/date-range-picker/utils.d.ts.map +1 -0
  20. package/date-range-picker/utils.js +40 -0
  21. package/date-range-picker/utils.js.map +1 -0
  22. package/hotspot/index.d.ts.map +1 -1
  23. package/hotspot/index.js +2 -2
  24. package/hotspot/index.js.map +1 -1
  25. package/internal/components/abstract-switch/index.d.ts +2 -2
  26. package/internal/components/abstract-switch/index.d.ts.map +1 -1
  27. package/internal/components/abstract-switch/index.js +2 -9
  28. package/internal/components/abstract-switch/index.js.map +1 -1
  29. package/internal/components/abstract-switch/styles.css.js +12 -12
  30. package/internal/components/abstract-switch/styles.scoped.css +20 -19
  31. package/internal/components/abstract-switch/styles.selectors.js +12 -12
  32. package/internal/components/focus-lock/index.d.ts +2 -1
  33. package/internal/components/focus-lock/index.d.ts.map +1 -1
  34. package/internal/components/focus-lock/index.js +2 -2
  35. package/internal/components/focus-lock/index.js.map +1 -1
  36. package/internal/components/screenreader-only/index.js +1 -1
  37. package/internal/components/screenreader-only/index.js.map +1 -1
  38. package/internal/environment.js +1 -1
  39. package/package.json +1 -1
  40. package/property-filter/controller.d.ts +4 -7
  41. package/property-filter/controller.d.ts.map +1 -1
  42. package/property-filter/controller.js +3 -2
  43. package/property-filter/controller.js.map +1 -1
  44. package/property-filter/filter-options.d.ts +3 -0
  45. package/property-filter/filter-options.d.ts.map +1 -0
  46. package/property-filter/filter-options.js +31 -0
  47. package/property-filter/filter-options.js.map +1 -0
  48. package/property-filter/index.d.ts.map +1 -1
  49. package/property-filter/index.js +0 -5
  50. package/property-filter/index.js.map +1 -1
  51. package/property-filter/property-filter-autosuggest.d.ts.map +1 -1
  52. package/property-filter/property-filter-autosuggest.js +9 -7
  53. package/property-filter/property-filter-autosuggest.js.map +1 -1
  54. package/property-filter/styles.css.js +33 -32
  55. package/property-filter/styles.scoped.css +38 -34
  56. package/property-filter/styles.selectors.js +33 -32
  57. package/radio-group/radio-button.d.ts +3 -3
  58. package/radio-group/radio-button.d.ts.map +1 -1
  59. package/radio-group/radio-button.js +18 -6
  60. package/radio-group/radio-button.js.map +1 -1
  61. package/select/parts/trigger.d.ts.map +1 -1
  62. package/select/parts/trigger.js +8 -2
  63. package/select/parts/trigger.js.map +1 -1
  64. package/table/selection-control/index.js +1 -1
  65. package/table/selection-control/index.js.map +1 -1
  66. package/tiles/internal.d.ts.map +1 -1
  67. package/tiles/internal.js +2 -9
  68. package/tiles/internal.js.map +1 -1
  69. package/tiles/tile.d.ts +12 -0
  70. package/tiles/tile.d.ts.map +1 -0
  71. package/tiles/tile.js +27 -0
  72. package/tiles/tile.js.map +1 -0
  73. package/toggle/internal.d.ts.map +1 -1
  74. package/toggle/internal.js +7 -1
  75. package/toggle/internal.js.map +1 -1
  76. package/date-range-picker/embedded.d.ts +0 -7
  77. package/date-range-picker/embedded.d.ts.map +0 -1
  78. package/date-range-picker/embedded.js +0 -47
  79. package/date-range-picker/embedded.js.map +0 -1
  80. package/date-range-picker/use-date-range-picker.d.ts +0 -32
  81. package/date-range-picker/use-date-range-picker.d.ts.map +0 -1
  82. package/date-range-picker/use-date-range-picker.js +0 -58
  83. package/date-range-picker/use-date-range-picker.js.map +0 -1
@@ -90,76 +90,77 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
90
90
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
91
91
  SPDX-License-Identifier: Apache-2.0
92
92
  */
93
- .awsui_content_1wepg_1cu7d_93:not(#\9),
94
- .awsui_description_1wepg_1cu7d_94:not(#\9),
95
- .awsui_label_1wepg_1cu7d_95:not(#\9) {
93
+ .awsui_content_1wepg_3hhd4_93:not(#\9),
94
+ .awsui_description_1wepg_3hhd4_94:not(#\9),
95
+ .awsui_label_1wepg_3hhd4_95:not(#\9) {
96
96
  display: block;
97
97
  }
98
98
 
99
- .awsui_outline_1wepg_1cu7d_99:not(#\9) {
99
+ .awsui_outline_1wepg_3hhd4_99:not(#\9) {
100
100
  display: none;
101
101
  }
102
102
 
103
- .awsui_native-input_1wepg_1cu7d_103[data-awsui-focus-visible=true]:not(#\9):focus {
103
+ .awsui_native-input_1wepg_3hhd4_103[data-awsui-focus-visible=true]:not(#\9):focus {
104
104
  /* stylelint-disable-next-line selector-max-type, @cloudscape-design/no-implicit-descendant */
105
105
  }
106
- .awsui_native-input_1wepg_1cu7d_103[data-awsui-focus-visible=true]:not(#\9):focus + .awsui_outline_1wepg_1cu7d_99 {
106
+ .awsui_native-input_1wepg_3hhd4_103[data-awsui-focus-visible=true]:not(#\9):focus + .awsui_outline_1wepg_3hhd4_99 {
107
107
  display: block;
108
108
  }
109
109
 
110
- .awsui_wrapper_1wepg_1cu7d_110:not(#\9) {
110
+ .awsui_wrapper_1wepg_3hhd4_110:not(#\9) {
111
111
  min-width: 0;
112
112
  -ms-word-break: break-all;
113
113
  word-break: break-word;
114
114
  display: flex;
115
115
  }
116
116
 
117
- .awsui_label-wrapper_1wepg_1cu7d_117:not(#\9) {
117
+ .awsui_label-wrapper_1wepg_3hhd4_117:not(#\9) {
118
118
  position: relative;
119
119
  display: flex;
120
+ cursor: default;
120
121
  }
121
122
 
122
- .awsui_content_1wepg_1cu7d_93:not(#\9) {
123
+ .awsui_content_1wepg_3hhd4_93:not(#\9) {
123
124
  min-width: 0;
124
125
  -ms-word-break: break-all;
125
126
  word-break: break-word;
126
127
  }
127
128
 
128
- .awsui_empty-content_1wepg_1cu7d_128:not(#\9) {
129
+ .awsui_empty-content_1wepg_3hhd4_129:not(#\9) {
129
130
  width: 0px;
130
131
  }
131
132
 
132
- .awsui_description_1wepg_1cu7d_94:not(#\9) {
133
+ .awsui_description_1wepg_3hhd4_94:not(#\9) {
133
134
  color: var(--color-text-form-secondary-ih9x7l, #5f6b7a);
134
135
  font-size: var(--font-body-s-size-ukw2p9, 12px);
135
136
  line-height: var(--font-body-s-line-height-kdsbrl, 16px);
136
137
  letter-spacing: var(--font-body-s-letter-spacing-cy0oxj, 0.005em);
137
138
  }
138
- .awsui_description-bottom-padding_1wepg_1cu7d_138:not(#\9) {
139
+ .awsui_description-bottom-padding_1wepg_3hhd4_139:not(#\9) {
139
140
  padding-bottom: var(--space-scaled-xxs-95dhkm, 4px);
140
141
  }
141
142
 
142
- .awsui_label_1wepg_1cu7d_95:not(#\9),
143
- .awsui_description_1wepg_1cu7d_94:not(#\9) {
143
+ .awsui_label_1wepg_3hhd4_95:not(#\9),
144
+ .awsui_description_1wepg_3hhd4_94:not(#\9) {
144
145
  padding-left: var(--space-xs-rsr2qu, 8px);
145
146
  }
146
- .awsui_label-disabled_1wepg_1cu7d_146:not(#\9),
147
- .awsui_description-disabled_1wepg_1cu7d_147:not(#\9) {
147
+ .awsui_label-disabled_1wepg_3hhd4_147:not(#\9),
148
+ .awsui_description-disabled_1wepg_3hhd4_148:not(#\9) {
148
149
  color: var(--color-text-control-disabled-3z3eul, #9ba7b6);
149
150
  }
150
151
 
151
152
  /* stylelint-disable selector-max-type */
152
- .awsui_control_1wepg_1cu7d_152:not(#\9) {
153
+ .awsui_control_1wepg_3hhd4_153:not(#\9) {
153
154
  position: relative;
154
155
  }
155
- .awsui_control_1wepg_1cu7d_152 > input:not(#\9), .awsui_control_1wepg_1cu7d_152 > svg:not(#\9), .awsui_control_1wepg_1cu7d_152 > .awsui_outline_1wepg_1cu7d_99:not(#\9) {
156
+ .awsui_control_1wepg_3hhd4_153 > input:not(#\9), .awsui_control_1wepg_3hhd4_153 > svg:not(#\9), .awsui_control_1wepg_3hhd4_153 > .awsui_outline_1wepg_3hhd4_99:not(#\9) {
156
157
  position: absolute;
157
158
  width: 100%;
158
159
  height: 100%;
159
160
  top: 0;
160
161
  left: 0;
161
162
  }
162
- .awsui_control_1wepg_1cu7d_152 > input:not(#\9) {
163
+ .awsui_control_1wepg_3hhd4_153 > input:not(#\9) {
163
164
  opacity: 0;
164
165
  z-index: 1;
165
166
  -webkit-user-select: none;
@@ -2,17 +2,17 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "content": "awsui_content_1wepg_1cu7d_93",
6
- "description": "awsui_description_1wepg_1cu7d_94",
7
- "label": "awsui_label_1wepg_1cu7d_95",
8
- "outline": "awsui_outline_1wepg_1cu7d_99",
9
- "native-input": "awsui_native-input_1wepg_1cu7d_103",
10
- "wrapper": "awsui_wrapper_1wepg_1cu7d_110",
11
- "label-wrapper": "awsui_label-wrapper_1wepg_1cu7d_117",
12
- "empty-content": "awsui_empty-content_1wepg_1cu7d_128",
13
- "description-bottom-padding": "awsui_description-bottom-padding_1wepg_1cu7d_138",
14
- "label-disabled": "awsui_label-disabled_1wepg_1cu7d_146",
15
- "description-disabled": "awsui_description-disabled_1wepg_1cu7d_147",
16
- "control": "awsui_control_1wepg_1cu7d_152"
5
+ "content": "awsui_content_1wepg_3hhd4_93",
6
+ "description": "awsui_description_1wepg_3hhd4_94",
7
+ "label": "awsui_label_1wepg_3hhd4_95",
8
+ "outline": "awsui_outline_1wepg_3hhd4_99",
9
+ "native-input": "awsui_native-input_1wepg_3hhd4_103",
10
+ "wrapper": "awsui_wrapper_1wepg_3hhd4_110",
11
+ "label-wrapper": "awsui_label-wrapper_1wepg_3hhd4_117",
12
+ "empty-content": "awsui_empty-content_1wepg_3hhd4_129",
13
+ "description-bottom-padding": "awsui_description-bottom-padding_1wepg_3hhd4_139",
14
+ "label-disabled": "awsui_label-disabled_1wepg_3hhd4_147",
15
+ "description-disabled": "awsui_description-disabled_1wepg_3hhd4_148",
16
+ "control": "awsui_control_1wepg_3hhd4_153"
17
17
  };
18
18
 
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  export interface FocusLockProps {
3
+ className?: string;
3
4
  disabled?: boolean;
4
5
  autoFocus?: boolean;
5
6
  children: React.ReactNode;
6
7
  }
7
- export default function FocusLock({ disabled, autoFocus, children }: FocusLockProps): JSX.Element;
8
+ export default function FocusLock({ className, disabled, autoFocus, children }: FocusLockProps): JSX.Element;
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/focus-lock/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAIjD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,cAAc,eA4BlF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/focus-lock/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAIjD,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,cAAc,eA8B7F"}
@@ -4,7 +4,7 @@ import React, { useEffect, useRef } from 'react';
4
4
  import TabTrap from '../tab-trap/index';
5
5
  import { getFirstFocusable, getLastFocusable } from './utils';
6
6
  export default function FocusLock(_a) {
7
- var disabled = _a.disabled, autoFocus = _a.autoFocus, children = _a.children;
7
+ var className = _a.className, disabled = _a.disabled, autoFocus = _a.autoFocus, children = _a.children;
8
8
  var containerRef = useRef(null);
9
9
  var focusFirst = function () {
10
10
  var _a;
@@ -25,7 +25,7 @@ export default function FocusLock(_a) {
25
25
  }, [autoFocus]);
26
26
  return (React.createElement(React.Fragment, null,
27
27
  React.createElement(TabTrap, { disabled: disabled, focusNextCallback: focusLast }),
28
- React.createElement("div", { ref: containerRef }, children),
28
+ React.createElement("div", { className: className, ref: containerRef }, children),
29
29
  React.createElement(TabTrap, { disabled: disabled, focusNextCallback: focusFirst })));
30
30
  }
31
31
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/focus-lock/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAQ9D,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAiD;QAA/C,QAAQ,cAAA,EAAE,SAAS,eAAA,EAAE,QAAQ,cAAA;IAC/D,IAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAElD,IAAM,UAAU,GAAG;;QACjB,IAAI,YAAY,CAAC,OAAO,EAAE;YACxB,MAAA,iBAAiB,CAAC,YAAY,CAAC,OAAO,CAAC,0CAAE,KAAK,EAAE,CAAC;SAClD;IACH,CAAC,CAAC;IAEF,IAAM,SAAS,GAAG;;QAChB,IAAI,YAAY,CAAC,OAAO,EAAE;YACxB,MAAA,gBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,0CAAE,KAAK,EAAE,CAAC;SACjD;IACH,CAAC,CAAC;IAEF,SAAS,CAAC;QACR,IAAI,SAAS,EAAE;YACb,UAAU,EAAE,CAAC;SACd;IACH,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,CACL;QACE,oBAAC,OAAO,IAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,SAAS,GAAI;QAC7D,6BAAK,GAAG,EAAE,YAAY,IAAG,QAAQ,CAAO;QACxC,oBAAC,OAAO,IAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,GAAI,CAC7D,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport TabTrap from '../tab-trap/index';\nimport { getFirstFocusable, getLastFocusable } from './utils';\n\nexport interface FocusLockProps {\n disabled?: boolean;\n autoFocus?: boolean;\n children: React.ReactNode;\n}\n\nexport default function FocusLock({ disabled, autoFocus, children }: FocusLockProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n\n const focusFirst = () => {\n if (containerRef.current) {\n getFirstFocusable(containerRef.current)?.focus();\n }\n };\n\n const focusLast = () => {\n if (containerRef.current) {\n getLastFocusable(containerRef.current)?.focus();\n }\n };\n\n useEffect(() => {\n if (autoFocus) {\n focusFirst();\n }\n }, [autoFocus]);\n\n return (\n <>\n <TabTrap disabled={disabled} focusNextCallback={focusLast} />\n <div ref={containerRef}>{children}</div>\n <TabTrap disabled={disabled} focusNextCallback={focusFirst} />\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/focus-lock/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAS9D,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAA4D;QAA1D,SAAS,eAAA,EAAE,QAAQ,cAAA,EAAE,SAAS,eAAA,EAAE,QAAQ,cAAA;IAC1E,IAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAElD,IAAM,UAAU,GAAG;;QACjB,IAAI,YAAY,CAAC,OAAO,EAAE;YACxB,MAAA,iBAAiB,CAAC,YAAY,CAAC,OAAO,CAAC,0CAAE,KAAK,EAAE,CAAC;SAClD;IACH,CAAC,CAAC;IAEF,IAAM,SAAS,GAAG;;QAChB,IAAI,YAAY,CAAC,OAAO,EAAE;YACxB,MAAA,gBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,0CAAE,KAAK,EAAE,CAAC;SACjD;IACH,CAAC,CAAC;IAEF,SAAS,CAAC;QACR,IAAI,SAAS,EAAE;YACb,UAAU,EAAE,CAAC;SACd;IACH,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,CACL;QACE,oBAAC,OAAO,IAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,SAAS,GAAI;QAC7D,6BAAK,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,YAAY,IACzC,QAAQ,CACL;QACN,oBAAC,OAAO,IAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,GAAI,CAC7D,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport TabTrap from '../tab-trap/index';\nimport { getFirstFocusable, getLastFocusable } from './utils';\n\nexport interface FocusLockProps {\n className?: string;\n disabled?: boolean;\n autoFocus?: boolean;\n children: React.ReactNode;\n}\n\nexport default function FocusLock({ className, disabled, autoFocus, children }: FocusLockProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n\n const focusFirst = () => {\n if (containerRef.current) {\n getFirstFocusable(containerRef.current)?.focus();\n }\n };\n\n const focusLast = () => {\n if (containerRef.current) {\n getLastFocusable(containerRef.current)?.focus();\n }\n };\n\n useEffect(() => {\n if (autoFocus) {\n focusFirst();\n }\n }, [autoFocus]);\n\n return (\n <>\n <TabTrap disabled={disabled} focusNextCallback={focusLast} />\n <div className={className} ref={containerRef}>\n {children}\n </div>\n <TabTrap disabled={disabled} focusNextCallback={focusFirst} />\n </>\n );\n}\n"]}
@@ -19,6 +19,6 @@ import styles from './styles.css.js';
19
19
  * ```
20
20
  */
21
21
  export default function ScreenreaderOnly(props) {
22
- return React.createElement("div", __assign({}, props, { className: clsx(styles.root, props.className) }));
22
+ return React.createElement("span", __assign({}, props, { className: clsx(styles.root, props.className) }));
23
23
  }
24
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/screenreader-only/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAQrC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAA4B;IACnE,OAAO,wCAAS,KAAK,IAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;AAC3E,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport clsx from 'clsx';\nimport React from 'react';\nimport styles from './styles.css.js';\n\nexport interface ScreenreaderOnlyProps {\n id?: string;\n className?: string;\n children: React.ReactNode;\n}\n\n/**\n * Makes content now shown on a screen but still announced by screen-reader users.\n * The component is suitable when the aria-label cannot be used, e.g. to avoid elemnts being announced as \"blank\".\n *\n * To exclude screenreader-only content use `:not(.${screenreaderOnlyStyles.root})` selector, for example:\n *\n * ```\n * import screenreaderOnlyStyles from '~internal/components/screenreader-only/styles.css.js'\n *\n * let visibleContent = wrapper.find(`${styles.label}`).find(`:not(.${screenreaderOnlyStyles.root})`).getElement().textContent\n *\n * let screenreaderContent = wrapper.find(`${styles.label}`).find(`.${screenreaderOnlyStyles.root}`).getElement().textContent\n * ```\n */\nexport default function ScreenreaderOnly(props: ScreenreaderOnlyProps) {\n return <div {...props} className={clsx(styles.root, props.className)} />;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/screenreader-only/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAQrC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAA4B;IACnE,OAAO,yCAAU,KAAK,IAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;AAC5E,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport clsx from 'clsx';\nimport React from 'react';\nimport styles from './styles.css.js';\n\nexport interface ScreenreaderOnlyProps {\n id?: string;\n className?: string;\n children: React.ReactNode;\n}\n\n/**\n * Makes content now shown on a screen but still announced by screen-reader users.\n * The component is suitable when the aria-label cannot be used, e.g. to avoid elemnts being announced as \"blank\".\n *\n * To exclude screenreader-only content use `:not(.${screenreaderOnlyStyles.root})` selector, for example:\n *\n * ```\n * import screenreaderOnlyStyles from '~internal/components/screenreader-only/styles.css.js'\n *\n * let visibleContent = wrapper.find(`${styles.label}`).find(`:not(.${screenreaderOnlyStyles.root})`).getElement().textContent\n *\n * let screenreaderContent = wrapper.find(`${styles.label}`).find(`.${screenreaderOnlyStyles.root}`).getElement().textContent\n * ```\n */\nexport default function ScreenreaderOnly(props: ScreenreaderOnlyProps) {\n return <span {...props} className={clsx(styles.root, props.className)} />;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
 
2
- export var PACKAGE_VERSION = '3.0.0 (f2cf79e)';
2
+ export var PACKAGE_VERSION = '3.0.0 (395ce43)';
3
3
  export var THEME = 'open-source-visual-refresh';
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
5
5
 
package/package.json CHANGED
@@ -113,6 +113,6 @@
113
113
  "./internal/base-component/index.js",
114
114
  "./internal/base-component/styles.css.js"
115
115
  ],
116
- "version": "3.0.86",
116
+ "version": "3.0.88",
117
117
  "license": "Apache-2.0"
118
118
  }
@@ -1,6 +1,5 @@
1
1
  import { ComparisonOperator, FilteringOption, FilteringProperty, GroupText, I18nStrings, JoinOperation, ParsedText, Query, Token } from './interfaces';
2
2
  import { NonCancelableEventHandler } from '../internal/events';
3
- import { AutosuggestProps } from '../autosuggest/interfaces';
4
3
  import { AutosuggestInputRef } from '../internal/components/autosuggest-input';
5
4
  export declare const getQueryActions: (query: Query, onChange: NonCancelableEventHandler<Query>, inputRef: React.RefObject<AutosuggestInputRef>) => {
6
5
  setToken: (index: number, newToken: Token) => void;
@@ -16,10 +15,7 @@ interface OptionGroup<T> {
16
15
  label: string;
17
16
  options: T[];
18
17
  }
19
- interface ExtendedAutosuggestOption extends AutosuggestProps.Option {
20
- tokenValue: string;
21
- }
22
- export declare const getAllValueSuggestions: (filteringOptions: readonly FilteringOption[], filteringProperties: readonly FilteringProperty[], operator: ComparisonOperator | undefined, i18nStrings: I18nStrings, customGroupsText: readonly GroupText[]) => OptionGroup<ExtendedAutosuggestOption>[];
18
+ export declare const getAllValueSuggestions: (filteringOptions: readonly FilteringOption[], filteringProperties: readonly FilteringProperty[], operator: ComparisonOperator | undefined, i18nStrings: I18nStrings, customGroupsText: readonly GroupText[]) => OptionGroup<import("../internal/components/option/interfaces").OptionDefinition>[];
23
19
  export declare const getPropertyByKey: (filteringProperties: readonly FilteringProperty[], key: string) => import("./interfaces").PropertyFilterProps.FilteringProperty | undefined;
24
20
  export declare function getExtendedOperator(filteringProperties: readonly FilteringProperty[], property: string, operator: ComparisonOperator): import("@cloudscape-design/collection-hooks").PropertyFilterOperatorExtended<any> | null;
25
21
  export declare function createPropertiesCompatibilityMap(filteringProperties: readonly FilteringProperty[]): (propertyA: string, propertyB: string) => boolean;
@@ -28,7 +24,7 @@ export declare const getAutosuggestOptions: (parsedText: ParsedText, filteringOp
28
24
  filterText: string;
29
25
  options: {
30
26
  options: {
31
- tokenValue: string;
27
+ value: string;
32
28
  label: string;
33
29
  __labelPrefix: string;
34
30
  }[];
@@ -36,8 +32,9 @@ export declare const getAutosuggestOptions: (parsedText: ParsedText, filteringOp
36
32
  }[];
37
33
  } | {
38
34
  filterText: string;
39
- options: (OptionGroup<ExtendedAutosuggestOption> | OptionGroup<{
35
+ options: (OptionGroup<import("../internal/components/option/interfaces").OptionDefinition> | OptionGroup<{
40
36
  value: string;
37
+ label: string;
41
38
  keepOpenOnSelect: boolean;
42
39
  }>)[];
43
40
  };
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/property-filter/controller.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kBAAkB,EAElB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BACV,iBAAiB,oBAClB,SAAS,eAAe,EAAE,yEAG7C,CAAC;AAEF,UAAU,WAAW,CAAC,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,EAAE,CAAC;CACd;AAED,eAAO,MAAM,sBAAsB,qBACf,SAAS,eAAe,EAAE,uBACvB,SAAS,iBAAiB,EAAE,YACvC,kBAAkB,GAAG,SAAS,eAC3B,WAAW,oBACN,SAAS,SAAS,EAAE,uFAmCvC,CAAC;AAEF,eAAO,MAAM,gBAAgB,wBAAyB,SAAS,iBAAiB,EAAE,OAAO,MAAM,6EAM9F,CAAC;AAEF,wBAAgB,mBAAmB,CACjC,mBAAmB,EAAE,SAAS,iBAAiB,EAAE,EACjD,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,kBAAkB,4FAS7B;AAED,wBAAgB,gCAAgC,CAC9C,mBAAmB,EAAE,SAAS,iBAAiB,EAAE,GAChD,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CA6BnD;AAQD,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,mBAAmB,EAAE,SAAS,iBAAiB,EAAE,EACjD,gBAAgB,EAAE,SAAS,SAAS,EAAE,EACtC,WAAW,EAAE,WAAW,EACxB,yBAAyB,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,KAAK,CAAC,oBA0BvE;AAED,eAAO,MAAM,qBAAqB,eACpB,UAAU,oBACJ,SAAS,eAAe,EAAE,uBACvB,SAAS,iBAAiB,EAAE,oBAC/B,SAAS,SAAS,EAAE,eACzB,WAAW;;;;;;;;;;;;;;;;;CAqEzB,CAAC;AAEF,eAAO,MAAM,qBAAqB,aAAc,kBAAkB,eAAe,WAAW,WAY3F,CAAC"}
@@ -128,7 +128,7 @@ export var getAllValueSuggestions = function (filteringOptions, filteringPropert
128
128
  }
129
129
  var propertyGroup = property.group ? customGroups[property.group] : defaultGroup;
130
130
  propertyGroup.options.push({
131
- tokenValue: property.propertyLabel + (operator || '=') + filteringOption.value,
131
+ value: property.propertyLabel + ' ' + (operator || '=') + ' ' + filteringOption.value,
132
132
  label: filteringOption.value,
133
133
  __labelPrefix: property.propertyLabel + ' ' + (operator || '=')
134
134
  });
@@ -181,6 +181,7 @@ export function createPropertiesCompatibilityMap(filteringProperties) {
181
181
  }
182
182
  var filteringPropertyToAutosuggestOption = function (filteringProperty) { return ({
183
183
  value: filteringProperty.propertyLabel,
184
+ label: filteringProperty.propertyLabel,
184
185
  keepOpenOnSelect: true
185
186
  }); };
186
187
  export function getPropertySuggestions(filteringProperties, customGroupsText, i18nStrings, filteringPropertyToOption) {
@@ -217,7 +218,7 @@ export var getAutosuggestOptions = function (parsedText, filteringOptions, filte
217
218
  options: options.map(function (_a) {
218
219
  var value = _a.value;
219
220
  return ({
220
- tokenValue: propertyLabel_1 + parsedText.operator + value,
221
+ value: propertyLabel_1 + ' ' + parsedText.operator + ' ' + value,
221
222
  label: value,
222
223
  __labelPrefix: propertyLabel_1 + ' ' + parsedText.operator
223
224
  });
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/property-filter/controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AActC,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB,CAAC;AAEvF,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGhH,MAAM,CAAC,IAAM,eAAe,GAAG,UAC7B,KAAY,EACZ,QAA0C,EAC1C,QAA8C;IAEtC,IAAA,MAAM,GAAgB,KAAK,OAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;IACpC,IAAM,YAAY,GAAG,UAAC,MAAwB,EAAE,SAAwB;QACtE,OAAA,sBAAsB,CAAC,QAAQ,EAAE,EAAE,MAAM,QAAA,EAAE,SAAS,WAAA,EAAE,CAAC;IAAvD,CAAuD,CAAC;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oBAAoB;QACvC,GAAC,IAAI,IAAG,WAAW,CAAC,0BAA0B;QAC9C,GAAC,GAAG,IAAG,WAAW,CAAC,kBAAkB;QACrC,GAAC,IAAI,IAAG,WAAW,CAAC,wBAAwB;WAC7C,CAAC;IACF,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ComparisonOperator,\n ExtendedOperatorForm,\n FilteringOption,\n FilteringProperty,\n GroupText,\n I18nStrings,\n JoinOperation,\n ParsedText,\n Query,\n Token,\n} from './interfaces';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { matchFilteringProperty, matchOperator, matchOperatorPrefix, trimFirstSpace, trimStart } from './utils';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\n\nexport const getQueryActions = (\n query: Query,\n onChange: NonCancelableEventHandler<Query>,\n inputRef: React.RefObject<AutosuggestInputRef>\n) => {\n const { tokens, operation } = query;\n const fireOnChange = (tokens: readonly Token[], operation: JoinOperation) =>\n fireNonCancelableEvent(onChange, { tokens, operation });\n const setToken = (index: number, newToken: Token) => {\n const newTokens = [...tokens];\n if (newTokens && index < newTokens.length) {\n newTokens[index] = newToken;\n }\n fireOnChange(newTokens, operation);\n };\n const removeToken = (index: number) => {\n const newTokens = tokens.filter((_, i) => i !== index);\n fireOnChange(newTokens, operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const removeAllTokens = () => {\n fireOnChange([], operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const addToken = (newToken: Token) => {\n const newTokens = [...tokens];\n newTokens.push(newToken);\n fireOnChange(newTokens, operation);\n };\n const setOperation = (newOperation: JoinOperation) => {\n fireOnChange(tokens, newOperation);\n };\n return {\n setToken,\n removeToken,\n removeAllTokens,\n addToken,\n setOperation,\n };\n};\n\nexport const getAllowedOperators = (property: FilteringProperty): ComparisonOperator[] => {\n const { operators = [], defaultOperator } = property;\n const operatorOrder = ['=', '!=', ':', '!:', '>=', '<=', '<', '>'] as const;\n const operatorSet = new Set([\n defaultOperator ?? '=',\n ...operators.map(op => (typeof op === 'string' ? op : op.operator)),\n ]);\n return operatorOrder.filter(op => operatorSet.has(op));\n};\n\n/*\n * parses the value of the filtering input to figure out the current step of entering the token:\n * - \"property\": means that a filter on a particular column is being added, with operator already finalized\n * - \"operator\": means that a filter on a particular column is being added, with operator not yet finalized\n * - \"free-text\": means that a \"free text\" token is being added\n */\nexport const parseText = (\n filteringText: string,\n filteringProperties: readonly FilteringProperty[] = [],\n disableFreeTextFiltering: boolean\n): ParsedText => {\n const negatedGlobalQuery = /^(!:|!)(.*)/.exec(filteringText);\n if (!disableFreeTextFiltering && negatedGlobalQuery) {\n return {\n step: 'free-text',\n operator: '!:',\n value: negatedGlobalQuery[2],\n };\n }\n\n const property = matchFilteringProperty(filteringProperties, filteringText);\n if (!property) {\n return {\n step: 'free-text',\n value: filteringText,\n };\n }\n\n const allowedOps = getAllowedOperators(property);\n const textWithoutProperty = filteringText.substring(property.propertyLabel.length);\n const operator = matchOperator(allowedOps, trimStart(textWithoutProperty));\n if (operator) {\n const operatorLastIndex = textWithoutProperty.indexOf(operator) + operator.length;\n const textWithoutPropertyAndOperator = textWithoutProperty.slice(operatorLastIndex);\n return {\n step: 'property',\n property,\n operator,\n // We need to remove the first leading space in case the user presses space\n // after the operator, for example: Owner: admin, will result in value of ` admin`\n // and we need to remove the first space, if the user added any more spaces only the\n // first one will be removed.\n value: trimFirstSpace(textWithoutPropertyAndOperator),\n };\n }\n\n const operatorPrefix = matchOperatorPrefix(allowedOps, trimStart(textWithoutProperty));\n if (operatorPrefix !== null) {\n return { step: 'operator', property, operatorPrefix };\n }\n\n return {\n step: 'free-text',\n value: filteringText,\n };\n};\n\nexport const getPropertyOptions = (\n filteringProperty: FilteringProperty,\n filteringOptions: readonly FilteringOption[]\n) => {\n return filteringOptions.filter(option => option.propertyKey === filteringProperty.key);\n};\n\ninterface OptionGroup<T> {\n label: string;\n options: T[];\n}\n\ninterface ExtendedAutosuggestOption extends AutosuggestProps.Option {\n tokenValue: string;\n}\n\nexport const getAllValueSuggestions = (\n filteringOptions: readonly FilteringOption[],\n filteringProperties: readonly FilteringProperty[],\n operator: ComparisonOperator | undefined = '=',\n i18nStrings: I18nStrings,\n customGroupsText: readonly GroupText[]\n) => {\n const defaultGroup: OptionGroup<ExtendedAutosuggestOption> = {\n label: i18nStrings.groupValuesText,\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<ExtendedAutosuggestOption> } = {};\n filteringOptions.forEach(filteringOption => {\n const property = getPropertyByKey(filteringProperties, filteringOption.propertyKey);\n // given option refers to a non-existent filtering property\n if (!property) {\n return;\n }\n // this option's filtering property does not support current operator\n if (getAllowedOperators(property).indexOf(operator) === -1) {\n return;\n }\n if (property.group && !customGroups[property.group]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === property.group ? customGroup.values : acc),\n ''\n );\n customGroups[property.group] = {\n label,\n options: [],\n };\n }\n const propertyGroup = property.group ? customGroups[property.group] : defaultGroup;\n propertyGroup.options.push({\n tokenValue: property.propertyLabel + (operator || '=') + filteringOption.value,\n label: filteringOption.value,\n __labelPrefix: property.propertyLabel + ' ' + (operator || '='),\n });\n });\n return [defaultGroup, ...Object.keys(customGroups).map(group => customGroups[group])];\n};\n\nexport const getPropertyByKey = (filteringProperties: readonly FilteringProperty[], key: string) => {\n const propertyMap = filteringProperties.reduce<{ [K: string]: FilteringProperty }>((acc, property) => {\n acc[property.key] = property;\n return acc;\n }, {});\n return propertyMap[key] as FilteringProperty | undefined;\n};\n\nexport function getExtendedOperator(\n filteringProperties: readonly FilteringProperty[],\n property: string,\n operator: ComparisonOperator\n) {\n const matchedProperty = getPropertyByKey(filteringProperties, property);\n for (const matchedOperator of matchedProperty?.operators || []) {\n if (typeof matchedOperator === 'object' && matchedOperator.operator === operator) {\n return matchedOperator;\n }\n }\n return null;\n}\n\nexport function createPropertiesCompatibilityMap(\n filteringProperties: readonly FilteringProperty[]\n): (propertyA: string, propertyB: string) => boolean {\n const lookup: {\n [propertyKey: string]: { operator: string; form: ExtendedOperatorForm<any> | undefined }[];\n } = {};\n\n for (const property of filteringProperties) {\n lookup[property.key] = (property.operators || [])\n .map(operator =>\n typeof operator === 'object'\n ? { operator: operator.operator, form: operator.form }\n : { operator, form: undefined }\n )\n .sort((a, b) => a.operator.localeCompare(b.operator));\n }\n\n return (propertyA: string, propertyB: string) => {\n if (lookup[propertyA].length !== lookup[propertyB].length) {\n return false;\n }\n for (let i = 0; i < lookup[propertyA].length; i++) {\n if (lookup[propertyA][i].operator !== lookup[propertyB][i].operator) {\n return false;\n }\n if (lookup[propertyA][i].form !== lookup[propertyB][i].form) {\n return false;\n }\n }\n return true;\n };\n}\n\nconst filteringPropertyToAutosuggestOption = (filteringProperty: FilteringProperty) => ({\n value: filteringProperty.propertyLabel,\n keepOpenOnSelect: true,\n});\n\nexport function getPropertySuggestions<T>(\n filteringProperties: readonly FilteringProperty[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings,\n filteringPropertyToOption: (filteringProperty: FilteringProperty) => T\n) {\n const defaultGroup: OptionGroup<T> = {\n label: i18nStrings.groupPropertiesText,\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<T> } = {};\n\n filteringProperties.forEach(filteringProperty => {\n const { group } = filteringProperty;\n let optionsGroup = defaultGroup;\n if (group) {\n if (!customGroups[group]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === group ? customGroup.properties : acc),\n ''\n );\n customGroups[group] = { options: [], label };\n }\n optionsGroup = customGroups[group];\n }\n optionsGroup.options.push(filteringPropertyToOption(filteringProperty));\n });\n const defaultGroupArray = defaultGroup.options.length ? [defaultGroup] : [];\n const customGroupsArray = Object.keys(customGroups).map(groupKey => customGroups[groupKey]);\n return [...defaultGroupArray, ...customGroupsArray];\n}\n\nexport const getAutosuggestOptions = (\n parsedText: ParsedText,\n filteringOptions: readonly FilteringOption[],\n filteringProperties: readonly FilteringProperty[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings\n) => {\n switch (parsedText.step) {\n case 'property': {\n const { propertyLabel, groupValuesLabel } = parsedText.property;\n const options = getPropertyOptions(parsedText.property, filteringOptions);\n return {\n filterText: parsedText.value,\n options: [\n {\n options: options.map(({ value }) => ({\n tokenValue: propertyLabel + parsedText.operator + value,\n label: value,\n __labelPrefix: propertyLabel + ' ' + parsedText.operator,\n })),\n label: groupValuesLabel,\n },\n ],\n };\n }\n case 'operator': {\n return {\n filterText: parsedText.property.propertyLabel + ' ' + parsedText.operatorPrefix,\n options: [\n ...getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n ),\n {\n options: getAllowedOperators(parsedText.property).map(value => ({\n value: parsedText.property.propertyLabel + ' ' + value + ' ',\n label: parsedText.property.propertyLabel + ' ' + value,\n description: operatorToDescription(value, i18nStrings),\n keepOpenOnSelect: true,\n })),\n label: i18nStrings.operatorsText,\n },\n ],\n };\n }\n case 'free-text': {\n const needsValueSuggestions = !!parsedText.value;\n const needsPropertySuggestions = !(parsedText.step === 'free-text' && parsedText.operator === '!:');\n return {\n filterText: parsedText.value,\n options: [\n ...(needsPropertySuggestions\n ? getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n )\n : []),\n ...(needsValueSuggestions\n ? getAllValueSuggestions(\n filteringOptions,\n filteringProperties,\n parsedText.operator,\n i18nStrings,\n customGroupsText\n )\n : []),\n ],\n };\n }\n }\n};\n\nexport const operatorToDescription = (operator: ComparisonOperator, i18nStrings: I18nStrings) => {\n const mapping: { [K in ComparisonOperator]: string } = {\n ['<']: i18nStrings.operatorLessText,\n ['<=']: i18nStrings.operatorLessOrEqualText,\n ['>']: i18nStrings.operatorGreaterText,\n ['>=']: i18nStrings.operatorGreaterOrEqualText,\n [':']: i18nStrings.operatorContainsText,\n ['!:']: i18nStrings.operatorDoesNotContainText,\n ['=']: i18nStrings.operatorEqualsText,\n ['!=']: i18nStrings.operatorDoesNotEqualText,\n };\n return mapping[operator];\n};\n"]}
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/property-filter/controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AActC,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB,CAAC;AAEvF,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGhH,MAAM,CAAC,IAAM,eAAe,GAAG,UAC7B,KAAY,EACZ,QAA0C,EAC1C,QAA8C;IAEtC,IAAA,MAAM,GAAgB,KAAK,OAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;IACpC,IAAM,YAAY,GAAG,UAAC,MAAwB,EAAE,SAAwB;QACtE,OAAA,sBAAsB,CAAC,QAAQ,EAAE,EAAE,MAAM,QAAA,EAAE,SAAS,WAAA,EAAE,CAAC;IAAvD,CAAuD,CAAC;IAC1D,IAAM,QAAQ,GAAG,UAAC,KAAa,EAAE,QAAe;QAC9C,IAAM,SAAS,qBAAO,MAAM,OAAC,CAAC;QAC9B,IAAI,SAAS,IAAI,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE;YACzC,SAAS,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;SAC7B;QACD,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACrC,CAAC,CAAC;IACF,IAAM,WAAW,GAAG,UAAC,KAAa;;QAChC,IAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAAC,KAAK,KAAK,EAAX,CAAW,CAAC,CAAC;QACvD,YAAY,CAAC,SAAS,EAAE,S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,CAAC,KAAK,CAAC;YACjD,IAAM,wBAAwB,GAAG,CAAC,CAAC,UAAU,CAAC,IAAI,KAAK,WAAW,IAAI,UAAU,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;YACpG,OAAO;gBACL,UAAU,EAAE,UAAU,CAAC,KAAK;gBAC5B,OAAO,kCACF,CAAC,wBAAwB;oBAC1B,CAAC,CAAC,sBAAsB,CACpB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,oCAAoC,CACrC;oBACH,CAAC,CAAC,EAAE,CAAC,SACJ,CAAC,qBAAqB;oBACvB,CAAC,CAAC,sBAAsB,CACpB,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,CAAC,QAAQ,EACnB,WAAW,EACX,gBAAgB,CACjB;oBACH,CAAC,CAAC,EAAE,CAAC,OACR;aACF,CAAC;SACH;KACF;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,qBAAqB,GAAG,UAAC,QAA4B,EAAE,WAAwB;;IAC1F,IAAM,OAAO;QACX,GAAC,GAAG,IAAG,WAAW,CAAC,gBAAgB;QACnC,GAAC,IAAI,IAAG,WAAW,CAAC,uBAAuB;QAC3C,GAAC,GAAG,IAAG,WAAW,CAAC,mBAAmB;QACtC,GAAC,IAAI,IAAG,WAAW,CAAC,0BAA0B;QAC9C,GAAC,GAAG,IAAG,WAAW,CAAC,oBAAoB;QACvC,GAAC,IAAI,IAAG,WAAW,CAAC,0BAA0B;QAC9C,GAAC,GAAG,IAAG,WAAW,CAAC,kBAAkB;QACrC,GAAC,IAAI,IAAG,WAAW,CAAC,wBAAwB;WAC7C,CAAC;IACF,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ComparisonOperator,\n ExtendedOperatorForm,\n FilteringOption,\n FilteringProperty,\n GroupText,\n I18nStrings,\n JoinOperation,\n ParsedText,\n Query,\n Token,\n} from './interfaces';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { matchFilteringProperty, matchOperator, matchOperatorPrefix, trimFirstSpace, trimStart } from './utils';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\n\nexport const getQueryActions = (\n query: Query,\n onChange: NonCancelableEventHandler<Query>,\n inputRef: React.RefObject<AutosuggestInputRef>\n) => {\n const { tokens, operation } = query;\n const fireOnChange = (tokens: readonly Token[], operation: JoinOperation) =>\n fireNonCancelableEvent(onChange, { tokens, operation });\n const setToken = (index: number, newToken: Token) => {\n const newTokens = [...tokens];\n if (newTokens && index < newTokens.length) {\n newTokens[index] = newToken;\n }\n fireOnChange(newTokens, operation);\n };\n const removeToken = (index: number) => {\n const newTokens = tokens.filter((_, i) => i !== index);\n fireOnChange(newTokens, operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const removeAllTokens = () => {\n fireOnChange([], operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const addToken = (newToken: Token) => {\n const newTokens = [...tokens];\n newTokens.push(newToken);\n fireOnChange(newTokens, operation);\n };\n const setOperation = (newOperation: JoinOperation) => {\n fireOnChange(tokens, newOperation);\n };\n return {\n setToken,\n removeToken,\n removeAllTokens,\n addToken,\n setOperation,\n };\n};\n\nexport const getAllowedOperators = (property: FilteringProperty): ComparisonOperator[] => {\n const { operators = [], defaultOperator } = property;\n const operatorOrder = ['=', '!=', ':', '!:', '>=', '<=', '<', '>'] as const;\n const operatorSet = new Set([\n defaultOperator ?? '=',\n ...operators.map(op => (typeof op === 'string' ? op : op.operator)),\n ]);\n return operatorOrder.filter(op => operatorSet.has(op));\n};\n\n/*\n * parses the value of the filtering input to figure out the current step of entering the token:\n * - \"property\": means that a filter on a particular column is being added, with operator already finalized\n * - \"operator\": means that a filter on a particular column is being added, with operator not yet finalized\n * - \"free-text\": means that a \"free text\" token is being added\n */\nexport const parseText = (\n filteringText: string,\n filteringProperties: readonly FilteringProperty[] = [],\n disableFreeTextFiltering: boolean\n): ParsedText => {\n const negatedGlobalQuery = /^(!:|!)(.*)/.exec(filteringText);\n if (!disableFreeTextFiltering && negatedGlobalQuery) {\n return {\n step: 'free-text',\n operator: '!:',\n value: negatedGlobalQuery[2],\n };\n }\n\n const property = matchFilteringProperty(filteringProperties, filteringText);\n if (!property) {\n return {\n step: 'free-text',\n value: filteringText,\n };\n }\n\n const allowedOps = getAllowedOperators(property);\n const textWithoutProperty = filteringText.substring(property.propertyLabel.length);\n const operator = matchOperator(allowedOps, trimStart(textWithoutProperty));\n if (operator) {\n const operatorLastIndex = textWithoutProperty.indexOf(operator) + operator.length;\n const textWithoutPropertyAndOperator = textWithoutProperty.slice(operatorLastIndex);\n return {\n step: 'property',\n property,\n operator,\n // We need to remove the first leading space in case the user presses space\n // after the operator, for example: Owner: admin, will result in value of ` admin`\n // and we need to remove the first space, if the user added any more spaces only the\n // first one will be removed.\n value: trimFirstSpace(textWithoutPropertyAndOperator),\n };\n }\n\n const operatorPrefix = matchOperatorPrefix(allowedOps, trimStart(textWithoutProperty));\n if (operatorPrefix !== null) {\n return { step: 'operator', property, operatorPrefix };\n }\n\n return {\n step: 'free-text',\n value: filteringText,\n };\n};\n\nexport const getPropertyOptions = (\n filteringProperty: FilteringProperty,\n filteringOptions: readonly FilteringOption[]\n) => {\n return filteringOptions.filter(option => option.propertyKey === filteringProperty.key);\n};\n\ninterface OptionGroup<T> {\n label: string;\n options: T[];\n}\n\nexport const getAllValueSuggestions = (\n filteringOptions: readonly FilteringOption[],\n filteringProperties: readonly FilteringProperty[],\n operator: ComparisonOperator | undefined = '=',\n i18nStrings: I18nStrings,\n customGroupsText: readonly GroupText[]\n) => {\n const defaultGroup: OptionGroup<AutosuggestProps.Option> = {\n label: i18nStrings.groupValuesText,\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<AutosuggestProps.Option> } = {};\n filteringOptions.forEach(filteringOption => {\n const property = getPropertyByKey(filteringProperties, filteringOption.propertyKey);\n // given option refers to a non-existent filtering property\n if (!property) {\n return;\n }\n // this option's filtering property does not support current operator\n if (getAllowedOperators(property).indexOf(operator) === -1) {\n return;\n }\n if (property.group && !customGroups[property.group]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === property.group ? customGroup.values : acc),\n ''\n );\n customGroups[property.group] = {\n label,\n options: [],\n };\n }\n const propertyGroup = property.group ? customGroups[property.group] : defaultGroup;\n propertyGroup.options.push({\n value: property.propertyLabel + ' ' + (operator || '=') + ' ' + filteringOption.value,\n label: filteringOption.value,\n __labelPrefix: property.propertyLabel + ' ' + (operator || '='),\n });\n });\n return [defaultGroup, ...Object.keys(customGroups).map(group => customGroups[group])];\n};\n\nexport const getPropertyByKey = (filteringProperties: readonly FilteringProperty[], key: string) => {\n const propertyMap = filteringProperties.reduce<{ [K: string]: FilteringProperty }>((acc, property) => {\n acc[property.key] = property;\n return acc;\n }, {});\n return propertyMap[key] as FilteringProperty | undefined;\n};\n\nexport function getExtendedOperator(\n filteringProperties: readonly FilteringProperty[],\n property: string,\n operator: ComparisonOperator\n) {\n const matchedProperty = getPropertyByKey(filteringProperties, property);\n for (const matchedOperator of matchedProperty?.operators || []) {\n if (typeof matchedOperator === 'object' && matchedOperator.operator === operator) {\n return matchedOperator;\n }\n }\n return null;\n}\n\nexport function createPropertiesCompatibilityMap(\n filteringProperties: readonly FilteringProperty[]\n): (propertyA: string, propertyB: string) => boolean {\n const lookup: {\n [propertyKey: string]: { operator: string; form: ExtendedOperatorForm<any> | undefined }[];\n } = {};\n\n for (const property of filteringProperties) {\n lookup[property.key] = (property.operators || [])\n .map(operator =>\n typeof operator === 'object'\n ? { operator: operator.operator, form: operator.form }\n : { operator, form: undefined }\n )\n .sort((a, b) => a.operator.localeCompare(b.operator));\n }\n\n return (propertyA: string, propertyB: string) => {\n if (lookup[propertyA].length !== lookup[propertyB].length) {\n return false;\n }\n for (let i = 0; i < lookup[propertyA].length; i++) {\n if (lookup[propertyA][i].operator !== lookup[propertyB][i].operator) {\n return false;\n }\n if (lookup[propertyA][i].form !== lookup[propertyB][i].form) {\n return false;\n }\n }\n return true;\n };\n}\n\nconst filteringPropertyToAutosuggestOption = (filteringProperty: FilteringProperty) => ({\n value: filteringProperty.propertyLabel,\n label: filteringProperty.propertyLabel,\n keepOpenOnSelect: true,\n});\n\nexport function getPropertySuggestions<T>(\n filteringProperties: readonly FilteringProperty[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings,\n filteringPropertyToOption: (filteringProperty: FilteringProperty) => T\n) {\n const defaultGroup: OptionGroup<T> = {\n label: i18nStrings.groupPropertiesText,\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<T> } = {};\n\n filteringProperties.forEach(filteringProperty => {\n const { group } = filteringProperty;\n let optionsGroup = defaultGroup;\n if (group) {\n if (!customGroups[group]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === group ? customGroup.properties : acc),\n ''\n );\n customGroups[group] = { options: [], label };\n }\n optionsGroup = customGroups[group];\n }\n optionsGroup.options.push(filteringPropertyToOption(filteringProperty));\n });\n const defaultGroupArray = defaultGroup.options.length ? [defaultGroup] : [];\n const customGroupsArray = Object.keys(customGroups).map(groupKey => customGroups[groupKey]);\n return [...defaultGroupArray, ...customGroupsArray];\n}\n\nexport const getAutosuggestOptions = (\n parsedText: ParsedText,\n filteringOptions: readonly FilteringOption[],\n filteringProperties: readonly FilteringProperty[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings\n) => {\n switch (parsedText.step) {\n case 'property': {\n const { propertyLabel, groupValuesLabel } = parsedText.property;\n const options = getPropertyOptions(parsedText.property, filteringOptions);\n return {\n filterText: parsedText.value,\n options: [\n {\n options: options.map(({ value }) => ({\n value: propertyLabel + ' ' + parsedText.operator + ' ' + value,\n label: value,\n __labelPrefix: propertyLabel + ' ' + parsedText.operator,\n })),\n label: groupValuesLabel,\n },\n ],\n };\n }\n case 'operator': {\n return {\n filterText: parsedText.property.propertyLabel + ' ' + parsedText.operatorPrefix,\n options: [\n ...getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n ),\n {\n options: getAllowedOperators(parsedText.property).map(value => ({\n value: parsedText.property.propertyLabel + ' ' + value + ' ',\n label: parsedText.property.propertyLabel + ' ' + value,\n description: operatorToDescription(value, i18nStrings),\n keepOpenOnSelect: true,\n })),\n label: i18nStrings.operatorsText,\n },\n ],\n };\n }\n case 'free-text': {\n const needsValueSuggestions = !!parsedText.value;\n const needsPropertySuggestions = !(parsedText.step === 'free-text' && parsedText.operator === '!:');\n return {\n filterText: parsedText.value,\n options: [\n ...(needsPropertySuggestions\n ? getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n )\n : []),\n ...(needsValueSuggestions\n ? getAllValueSuggestions(\n filteringOptions,\n filteringProperties,\n parsedText.operator,\n i18nStrings,\n customGroupsText\n )\n : []),\n ],\n };\n }\n }\n};\n\nexport const operatorToDescription = (operator: ComparisonOperator, i18nStrings: I18nStrings) => {\n const mapping: { [K in ComparisonOperator]: string } = {\n ['<']: i18nStrings.operatorLessText,\n ['<=']: i18nStrings.operatorLessOrEqualText,\n ['>']: i18nStrings.operatorGreaterText,\n ['>=']: i18nStrings.operatorGreaterOrEqualText,\n [':']: i18nStrings.operatorContainsText,\n ['!:']: i18nStrings.operatorDoesNotContainText,\n ['=']: i18nStrings.operatorEqualsText,\n ['!=']: i18nStrings.operatorDoesNotEqualText,\n };\n return mapping[operator];\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import { AutosuggestProps } from '../autosuggest/interfaces';
2
+ export declare function filterOptions(options: readonly (AutosuggestProps.Option | AutosuggestProps.OptionGroup)[], searchText?: string): readonly (AutosuggestProps.Option | AutosuggestProps.OptionGroup)[];
3
+ //# sourceMappingURL=filter-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-options.d.ts","sourceRoot":"","sources":["../../../src/property-filter/filter-options.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG7D,wBAAgB,aAAa,CAC3B,OAAO,EAAE,SAAS,CAAC,gBAAgB,CAAC,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,EAAE,EAC5E,UAAU,SAAK,GACd,SAAS,CAAC,gBAAgB,CAAC,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAiBrE"}
@@ -0,0 +1,31 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { __assign } from "tslib";
4
+ export function filterOptions(options, searchText) {
5
+ if (searchText === void 0) { searchText = ''; }
6
+ if (!searchText) {
7
+ return options;
8
+ }
9
+ var filtered = [];
10
+ for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
11
+ var option = options_1[_i];
12
+ if (isGroup(option)) {
13
+ var childOptions = filterOptions(option.options, searchText);
14
+ if (childOptions.length > 0) {
15
+ filtered.push(__assign(__assign({}, option), { options: childOptions }));
16
+ }
17
+ }
18
+ else if (matchSingleOption(option, searchText)) {
19
+ filtered.push(option);
20
+ }
21
+ }
22
+ return filtered;
23
+ }
24
+ function isGroup(optionOrGroup) {
25
+ return 'options' in optionOrGroup;
26
+ }
27
+ function matchSingleOption(option, searchText) {
28
+ var _a;
29
+ return ((_a = option.label) !== null && _a !== void 0 ? _a : '').toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
30
+ }
31
+ //# sourceMappingURL=filter-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-options.js","sourceRoot":"","sources":["../../../src/property-filter/filter-options.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAKtC,MAAM,UAAU,aAAa,CAC3B,OAA4E,EAC5E,UAAe;IAAf,2BAAA,EAAA,eAAe;IAEf,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,OAAO,CAAC;KAChB;IAED,IAAM,QAAQ,GAA+D,EAAE,CAAC;IAChF,KAAqB,UAAO,EAAP,mBAAO,EAAP,qBAAO,EAAP,IAAO,EAAE;QAAzB,IAAM,MAAM,gBAAA;QACf,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;YACnB,IAAM,YAAY,GAAG,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YAC/D,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC3B,QAAQ,CAAC,IAAI,uBAAM,MAAM,KAAE,OAAO,EAAE,YAAY,IAAG,CAAC;aACrD;SACF;aAAM,IAAI,iBAAiB,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE;YAChD,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACvB;KACF;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,OAAO,CAAC,aAAsC;IACrD,OAAO,SAAS,IAAI,aAAa,CAAC;AACpC,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAwB,EAAE,UAAkB;;IACrE,OAAO,CAAC,MAAA,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACrF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { OptionDefinition } from '../internal/components/option/interfaces';\n\nexport function filterOptions(\n options: readonly (AutosuggestProps.Option | AutosuggestProps.OptionGroup)[],\n searchText = ''\n): readonly (AutosuggestProps.Option | AutosuggestProps.OptionGroup)[] {\n if (!searchText) {\n return options;\n }\n\n const filtered: (AutosuggestProps.Option | AutosuggestProps.OptionGroup)[] = [];\n for (const option of options) {\n if (isGroup(option)) {\n const childOptions = filterOptions(option.options, searchText);\n if (childOptions.length > 0) {\n filtered.push({ ...option, options: childOptions });\n }\n } else if (matchSingleOption(option, searchText)) {\n filtered.push(option);\n }\n }\n return filtered;\n}\n\nfunction isGroup(optionOrGroup: AutosuggestProps.Option): optionOrGroup is AutosuggestProps.OptionGroup {\n return 'options' in optionOrGroup;\n}\n\nfunction matchSingleOption(option: OptionDefinition, searchText: string): boolean {\n return (option.label ?? '').toLowerCase().indexOf(searchText.toLowerCase()) !== -1;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/property-filter/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAW9E,OAAO,EAAE,mBAAmB,EAAiE,MAAM,cAAc,CAAC;AAgBlH,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,QAAA,MAAM,cAAc,qGAsRnB,CAAC;AAGF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/property-filter/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAW9E,OAAO,EAAE,mBAAmB,EAAiE,MAAM,cAAc,CAAC;AAgBlH,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,QAAA,MAAM,cAAc,qGAkRnB,CAAC;AAGF,eAAe,cAAc,CAAC"}
@@ -104,11 +104,6 @@ var PropertyFilter = React.forwardRef(function (_a, ref) {
104
104
  }, 0);
105
105
  var option = event.detail;
106
106
  var value = option.value || '';
107
- if ('tokenValue' in option) {
108
- createToken(option.tokenValue);
109
- return;
110
- }
111
- // create a token from the 'use' option
112
107
  if (!('keepOpenOnSelect' in option)) {
113
108
  createToken(value);
114
109
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/property-filter/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;A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OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,QAAQ,IAC1F,WAAW,CAAC,gBAAgB,CACd,CACI,CACnB,CACP,CACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AACnD,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef, useState, useMemo, useImperativeHandle } from 'react';\n\nimport InternalSpaceBetween from '../space-between/internal';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { KeyCode } from '../internal/keycode';\nimport SelectToggle from '../token-group/toggle';\nimport { generateUniqueId } from '../internal/hooks/use-unique-id/index';\nimport { fireNonCancelableEvent } from '../internal/events';\n\nimport { PropertyFilterProps, ParsedText, Ref, FilteringProperty, ComparisonOperator, Token } from './interfaces';\nimport { TokenButton } from './token';\nimport {\n getQueryActions,\n parseText,\n getAutosuggestOptions,\n getAllowedOperators,\n getExtendedOperator,\n} from './controller';\nimport { useLoadItems } from './use-load-items';\nimport styles from './styles.css.js';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport PropertyFilterAutosuggest, { PropertyFilterAutosuggestProps } from './property-filter-autosuggest';\nimport { PropertyEditor } from './property-editor';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\n\nexport { PropertyFilterProps };\n\nconst PropertyFilter = React.forwardRef(\n (\n {\n disabled,\n i18nStrings,\n countText,\n query,\n hideOperations,\n onChange,\n filteringProperties,\n filteringOptions = [],\n customGroupsText = [],\n disableFreeTextFiltering = false,\n onLoadItems,\n virtualScroll,\n customControl,\n filteringEmpty,\n filteringLoadingText,\n filteringFinishedText,\n filteringErrorText,\n filteringRecoveryText,\n filteringStatusType,\n asyncProperties,\n tokenLimit,\n expandToViewport,\n ...rest\n }: PropertyFilterProps,\n ref: React.Ref<Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('PropertyFilter');\n const inputRef = useRef<AutosuggestInputRef>(null);\n const baseProps = getBaseProps(rest);\n useImperativeHandle(ref, () => ({ focus: () => inputRef.current?.focus() }), []);\n const { tokens, operation } = query;\n const showResults = tokens?.length && !disabled;\n const { addToken, removeToken, setToken, setOperation, removeAllTokens } = getQueryActions(\n query,\n onChange,\n inputRef\n );\n const [filteringText, setFilteringText] = useState<string>('');\n const parsedText = parseText(filteringText, filteringProperties, disableFreeTextFiltering);\n const autosuggestOptions = getAutosuggestOptions(\n parsedText,\n filteringOptions,\n filteringProperties,\n customGroupsText,\n i18nStrings\n );\n\n const createToken = (currentText: string) => {\n const parsedText = parseText(currentText, filteringProperties, disableFreeTextFiltering);\n let newToken: Token;\n switch (parsedText.step) {\n case 'property': {\n newToken = {\n propertyKey: parsedText.property.key,\n operator: parsedText.operator,\n value: parsedText.value,\n };\n break;\n }\n case 'free-text': {\n newToken = {\n operator: parsedText.operator || ':',\n value: parsedText.value,\n };\n break;\n }\n case 'operator': {\n newToken = {\n operator: ':',\n value: currentText,\n };\n break;\n }\n }\n if (disableFreeTextFiltering && !('propertyKey' in newToken)) {\n return;\n }\n addToken(newToken);\n setFilteringText('');\n };\n const ignoreKeyDown = useRef<boolean>(false);\n const handleKeyDown: PropertyFilterAutosuggestProps['onKeyDown'] = event => {\n if (filteringText && !ignoreKeyDown.current && event.detail.keyCode === KeyCode.enter) {\n createToken(filteringText);\n }\n };\n const getLoadMoreDetail = (parsedText: ParsedText, filteringText: string) => {\n const loadMoreDetail: {\n filteringProperty: FilteringProperty | undefined;\n filteringText: string;\n filteringOperator: ComparisonOperator | undefined;\n } = {\n filteringProperty: undefined,\n filteringText,\n filteringOperator: undefined,\n };\n if (parsedText.step === 'property') {\n loadMoreDetail.filteringProperty = parsedText.property;\n loadMoreDetail.filteringText = parsedText.value;\n loadMoreDetail.filteringOperator = parsedText.operator;\n }\n return loadMoreDetail;\n };\n const loadMoreDetail = getLoadMoreDetail(parsedText, filteringText);\n const inputLoadItemsHandlers = useLoadItems(\n onLoadItems,\n loadMoreDetail.filteringText,\n loadMoreDetail.filteringProperty,\n loadMoreDetail.filteringText,\n loadMoreDetail.filteringOperator\n );\n const asyncProps = {\n empty: filteringEmpty,\n loadingText: filteringLoadingText,\n finishedText: filteringFinishedText,\n errorText: filteringErrorText,\n recoveryText: filteringRecoveryText,\n statusType: filteringStatusType,\n };\n const asyncAutosuggestProps =\n !!filteringText.length || asyncProperties\n ? {\n ...inputLoadItemsHandlers,\n ...asyncProps,\n }\n : {};\n const handleSelected: PropertyFilterAutosuggestProps['onOptionClick'] = event => {\n // The ignoreKeyDown flag makes sure `createToken` routine runs only once. Autosuggest's `onKeyDown` fires,\n // when an item is selected from the list using \"enter\" key.\n ignoreKeyDown.current = true;\n setTimeout(() => {\n ignoreKeyDown.current = false;\n }, 0);\n const { detail: option } = event;\n const value = option.value || '';\n if ('tokenValue' in option) {\n createToken((option as { tokenValue: string }).tokenValue);\n return;\n }\n // create a token from the 'use' option\n if (!('keepOpenOnSelect' in option)) {\n createToken(value);\n return;\n }\n\n // stop dropdown from closing\n event.preventDefault();\n\n const parsedText = parseText(value, filteringProperties, disableFreeTextFiltering);\n const loadMoreDetail = getLoadMoreDetail(parsedText, value);\n\n // Insert operator automatically if only one operator is defined for the given property.\n if (parsedText.step === 'operator') {\n const operators = getAllowedOperators(parsedText.property);\n if (value.trim() === parsedText.property.propertyLabel && operators.length === 1) {\n loadMoreDetail.filteringProperty = parsedText.property;\n loadMoreDetail.filteringOperator = operators[0];\n loadMoreDetail.filteringText = '';\n setFilteringText(parsedText.property.propertyLabel + ' ' + operators[0] + ' ');\n }\n }\n\n fireNonCancelableEvent(onLoadItems, { ...loadMoreDetail, firstPage: true, samePage: false });\n };\n const [tokensExpanded, setTokensExpanded] = useState(false);\n const toggleExpandedTokens = () => setTokensExpanded(!tokensExpanded);\n const hasHiddenOptions = tokenLimit !== undefined && tokens.length > tokenLimit;\n const slicedTokens = hasHiddenOptions && !tokensExpanded ? tokens.slice(0, tokenLimit) : tokens;\n const controlId = useMemo(() => generateUniqueId(), []);\n\n const operatorForm =\n parsedText.step === 'property' &&\n getExtendedOperator(filteringProperties, parsedText.property.key, parsedText.operator)?.form;\n\n return (\n <span {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <div className={styles['search-field']}>\n {customControl && <div className={styles['custom-control']}>{customControl}</div>}\n <PropertyFilterAutosuggest\n ref={inputRef}\n virtualScroll={virtualScroll}\n enteredTextLabel={i18nStrings.enteredTextLabel}\n ariaLabel={i18nStrings.filteringAriaLabel}\n placeholder={i18nStrings.filteringPlaceholder}\n value={filteringText}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n {...autosuggestOptions}\n onChange={event => setFilteringText(event.detail.value)}\n empty={filteringEmpty}\n {...asyncAutosuggestProps}\n expandToViewport={expandToViewport}\n onOptionClick={handleSelected}\n customForm={\n operatorForm && (\n <PropertyEditor\n property={parsedText.property}\n operator={parsedText.operator}\n filter={parsedText.value}\n operatorForm={operatorForm}\n i18nStrings={i18nStrings}\n onCancel={() => {\n setFilteringText('');\n inputRef.current?.close();\n inputRef.current?.focus({ preventDropdown: true });\n }}\n onSubmit={token => {\n addToken(token);\n setFilteringText('');\n inputRef.current?.focus({ preventDropdown: true });\n inputRef.current?.close();\n }}\n />\n )\n }\n hideEnteredTextOption={disableFreeTextFiltering && parsedText.step !== 'property'}\n />\n <span\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className={clsx(styles.results, showResults && styles['results-visible'])}\n >\n {showResults ? countText : ''}\n </span>\n </div>\n {tokens && tokens.length > 0 && (\n <div className={styles.tokens}>\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\" id={controlId}>\n {slicedTokens.map((token, index) => (\n <TokenButton\n token={token}\n first={index === 0}\n operation={operation}\n key={index}\n removeToken={() => removeToken(index)}\n setToken={(newToken: Token) => setToken(index, newToken)}\n setOperation={setOperation}\n filteringOptions={filteringOptions}\n filteringProperties={filteringProperties}\n asyncProps={asyncProps}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n asyncProperties={asyncProperties}\n hideOperations={hideOperations}\n customGroupsText={customGroupsText}\n disableFreeTextFiltering={disableFreeTextFiltering}\n disabled={disabled}\n expandToViewport={expandToViewport}\n />\n ))}\n {hasHiddenOptions && (\n <div className={styles['toggle-collapsed']}>\n <SelectToggle\n controlId={controlId}\n allHidden={tokenLimit === 0}\n expanded={tokensExpanded}\n numberOfHiddenOptions={tokens.length - slicedTokens.length}\n i18nStrings={{\n limitShowFewer: i18nStrings.tokenLimitShowFewer,\n limitShowMore: i18nStrings.tokenLimitShowMore,\n }}\n onClick={toggleExpandedTokens}\n />\n </div>\n )}\n <div className={styles.separator} />\n <InternalButton onClick={removeAllTokens} className={styles['remove-all']} disabled={disabled}>\n {i18nStrings.clearFiltersText}\n </InternalButton>\n </InternalSpaceBetween>\n </div>\n )}\n </span>\n );\n }\n);\n\napplyDisplayName(PropertyFilter, 'PropertyFilter');\nexport default PropertyFilter;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/property-filter/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,O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U,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,wBAAwB,EAAE,wBAAwB,EAClD,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,GAClC,CACH,EArBmC,CAqBnC,CAAC;gBACD,gBAAgB,IAAI,CACnB,6BAAK,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC;oBACxC,oBAAC,YAAY,IACX,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,UAAU,KAAK,CAAC,EAC3B,QAAQ,EAAE,cAAc,EACxB,qBAAqB,EAAE,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,EAC1D,WAAW,EAAE;4BACX,cAAc,EAAE,WAAW,CAAC,mBAAmB;4BAC/C,aAAa,EAAE,WAAW,CAAC,kBAAkB;yBAC9C,EACD,OAAO,EAAE,oBAAoB,GAC7B,CACE,CACP;gBACD,6BAAK,SAAS,EAAE,MAAM,CAAC,SAAS,GAAI;gBACpC,oBAAC,cAAc,IAAC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,QAAQ,IAC1F,WAAW,CAAC,gBAAgB,CACd,CACI,CACnB,CACP,CACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AACnD,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef, useState, useMemo, useImperativeHandle } from 'react';\n\nimport InternalSpaceBetween from '../space-between/internal';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { KeyCode } from '../internal/keycode';\nimport SelectToggle from '../token-group/toggle';\nimport { generateUniqueId } from '../internal/hooks/use-unique-id/index';\nimport { fireNonCancelableEvent } from '../internal/events';\n\nimport { PropertyFilterProps, ParsedText, Ref, FilteringProperty, ComparisonOperator, Token } from './interfaces';\nimport { TokenButton } from './token';\nimport {\n getQueryActions,\n parseText,\n getAutosuggestOptions,\n getAllowedOperators,\n getExtendedOperator,\n} from './controller';\nimport { useLoadItems } from './use-load-items';\nimport styles from './styles.css.js';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport PropertyFilterAutosuggest, { PropertyFilterAutosuggestProps } from './property-filter-autosuggest';\nimport { PropertyEditor } from './property-editor';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\n\nexport { PropertyFilterProps };\n\nconst PropertyFilter = React.forwardRef(\n (\n {\n disabled,\n i18nStrings,\n countText,\n query,\n hideOperations,\n onChange,\n filteringProperties,\n filteringOptions = [],\n customGroupsText = [],\n disableFreeTextFiltering = false,\n onLoadItems,\n virtualScroll,\n customControl,\n filteringEmpty,\n filteringLoadingText,\n filteringFinishedText,\n filteringErrorText,\n filteringRecoveryText,\n filteringStatusType,\n asyncProperties,\n tokenLimit,\n expandToViewport,\n ...rest\n }: PropertyFilterProps,\n ref: React.Ref<Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('PropertyFilter');\n const inputRef = useRef<AutosuggestInputRef>(null);\n const baseProps = getBaseProps(rest);\n useImperativeHandle(ref, () => ({ focus: () => inputRef.current?.focus() }), []);\n const { tokens, operation } = query;\n const showResults = tokens?.length && !disabled;\n const { addToken, removeToken, setToken, setOperation, removeAllTokens } = getQueryActions(\n query,\n onChange,\n inputRef\n );\n const [filteringText, setFilteringText] = useState<string>('');\n const parsedText = parseText(filteringText, filteringProperties, disableFreeTextFiltering);\n const autosuggestOptions = getAutosuggestOptions(\n parsedText,\n filteringOptions,\n filteringProperties,\n customGroupsText,\n i18nStrings\n );\n\n const createToken = (currentText: string) => {\n const parsedText = parseText(currentText, filteringProperties, disableFreeTextFiltering);\n let newToken: Token;\n switch (parsedText.step) {\n case 'property': {\n newToken = {\n propertyKey: parsedText.property.key,\n operator: parsedText.operator,\n value: parsedText.value,\n };\n break;\n }\n case 'free-text': {\n newToken = {\n operator: parsedText.operator || ':',\n value: parsedText.value,\n };\n break;\n }\n case 'operator': {\n newToken = {\n operator: ':',\n value: currentText,\n };\n break;\n }\n }\n if (disableFreeTextFiltering && !('propertyKey' in newToken)) {\n return;\n }\n addToken(newToken);\n setFilteringText('');\n };\n const ignoreKeyDown = useRef<boolean>(false);\n const handleKeyDown: PropertyFilterAutosuggestProps['onKeyDown'] = event => {\n if (filteringText && !ignoreKeyDown.current && event.detail.keyCode === KeyCode.enter) {\n createToken(filteringText);\n }\n };\n const getLoadMoreDetail = (parsedText: ParsedText, filteringText: string) => {\n const loadMoreDetail: {\n filteringProperty: FilteringProperty | undefined;\n filteringText: string;\n filteringOperator: ComparisonOperator | undefined;\n } = {\n filteringProperty: undefined,\n filteringText,\n filteringOperator: undefined,\n };\n if (parsedText.step === 'property') {\n loadMoreDetail.filteringProperty = parsedText.property;\n loadMoreDetail.filteringText = parsedText.value;\n loadMoreDetail.filteringOperator = parsedText.operator;\n }\n return loadMoreDetail;\n };\n const loadMoreDetail = getLoadMoreDetail(parsedText, filteringText);\n const inputLoadItemsHandlers = useLoadItems(\n onLoadItems,\n loadMoreDetail.filteringText,\n loadMoreDetail.filteringProperty,\n loadMoreDetail.filteringText,\n loadMoreDetail.filteringOperator\n );\n const asyncProps = {\n empty: filteringEmpty,\n loadingText: filteringLoadingText,\n finishedText: filteringFinishedText,\n errorText: filteringErrorText,\n recoveryText: filteringRecoveryText,\n statusType: filteringStatusType,\n };\n const asyncAutosuggestProps =\n !!filteringText.length || asyncProperties\n ? {\n ...inputLoadItemsHandlers,\n ...asyncProps,\n }\n : {};\n const handleSelected: PropertyFilterAutosuggestProps['onOptionClick'] = event => {\n // The ignoreKeyDown flag makes sure `createToken` routine runs only once. Autosuggest's `onKeyDown` fires,\n // when an item is selected from the list using \"enter\" key.\n ignoreKeyDown.current = true;\n setTimeout(() => {\n ignoreKeyDown.current = false;\n }, 0);\n const { detail: option } = event;\n const value = option.value || '';\n\n if (!('keepOpenOnSelect' in option)) {\n createToken(value);\n return;\n }\n\n // stop dropdown from closing\n event.preventDefault();\n\n const parsedText = parseText(value, filteringProperties, disableFreeTextFiltering);\n const loadMoreDetail = getLoadMoreDetail(parsedText, value);\n\n // Insert operator automatically if only one operator is defined for the given property.\n if (parsedText.step === 'operator') {\n const operators = getAllowedOperators(parsedText.property);\n if (value.trim() === parsedText.property.propertyLabel && operators.length === 1) {\n loadMoreDetail.filteringProperty = parsedText.property;\n loadMoreDetail.filteringOperator = operators[0];\n loadMoreDetail.filteringText = '';\n setFilteringText(parsedText.property.propertyLabel + ' ' + operators[0] + ' ');\n }\n }\n\n fireNonCancelableEvent(onLoadItems, { ...loadMoreDetail, firstPage: true, samePage: false });\n };\n const [tokensExpanded, setTokensExpanded] = useState(false);\n const toggleExpandedTokens = () => setTokensExpanded(!tokensExpanded);\n const hasHiddenOptions = tokenLimit !== undefined && tokens.length > tokenLimit;\n const slicedTokens = hasHiddenOptions && !tokensExpanded ? tokens.slice(0, tokenLimit) : tokens;\n const controlId = useMemo(() => generateUniqueId(), []);\n\n const operatorForm =\n parsedText.step === 'property' &&\n getExtendedOperator(filteringProperties, parsedText.property.key, parsedText.operator)?.form;\n\n return (\n <span {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <div className={styles['search-field']}>\n {customControl && <div className={styles['custom-control']}>{customControl}</div>}\n <PropertyFilterAutosuggest\n ref={inputRef}\n virtualScroll={virtualScroll}\n enteredTextLabel={i18nStrings.enteredTextLabel}\n ariaLabel={i18nStrings.filteringAriaLabel}\n placeholder={i18nStrings.filteringPlaceholder}\n value={filteringText}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n {...autosuggestOptions}\n onChange={event => setFilteringText(event.detail.value)}\n empty={filteringEmpty}\n {...asyncAutosuggestProps}\n expandToViewport={expandToViewport}\n onOptionClick={handleSelected}\n customForm={\n operatorForm && (\n <PropertyEditor\n property={parsedText.property}\n operator={parsedText.operator}\n filter={parsedText.value}\n operatorForm={operatorForm}\n i18nStrings={i18nStrings}\n onCancel={() => {\n setFilteringText('');\n inputRef.current?.close();\n inputRef.current?.focus({ preventDropdown: true });\n }}\n onSubmit={token => {\n addToken(token);\n setFilteringText('');\n inputRef.current?.focus({ preventDropdown: true });\n inputRef.current?.close();\n }}\n />\n )\n }\n hideEnteredTextOption={disableFreeTextFiltering && parsedText.step !== 'property'}\n />\n <span\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className={clsx(styles.results, showResults && styles['results-visible'])}\n >\n {showResults ? countText : ''}\n </span>\n </div>\n {tokens && tokens.length > 0 && (\n <div className={styles.tokens}>\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\" id={controlId}>\n {slicedTokens.map((token, index) => (\n <TokenButton\n token={token}\n first={index === 0}\n operation={operation}\n key={index}\n removeToken={() => removeToken(index)}\n setToken={(newToken: Token) => setToken(index, newToken)}\n setOperation={setOperation}\n filteringOptions={filteringOptions}\n filteringProperties={filteringProperties}\n asyncProps={asyncProps}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n asyncProperties={asyncProperties}\n hideOperations={hideOperations}\n customGroupsText={customGroupsText}\n disableFreeTextFiltering={disableFreeTextFiltering}\n disabled={disabled}\n expandToViewport={expandToViewport}\n />\n ))}\n {hasHiddenOptions && (\n <div className={styles['toggle-collapsed']}>\n <SelectToggle\n controlId={controlId}\n allHidden={tokenLimit === 0}\n expanded={tokensExpanded}\n numberOfHiddenOptions={tokens.length - slicedTokens.length}\n i18nStrings={{\n limitShowFewer: i18nStrings.tokenLimitShowFewer,\n limitShowMore: i18nStrings.tokenLimitShowMore,\n }}\n onClick={toggleExpandedTokens}\n />\n </div>\n )}\n <div className={styles.separator} />\n <InternalButton onClick={removeAllTokens} className={styles['remove-all']} disabled={disabled}>\n {i18nStrings.clearFiltersText}\n </InternalButton>\n </InternalSpaceBetween>\n </div>\n )}\n </span>\n );\n }\n);\n\napplyDisplayName(PropertyFilter, 'PropertyFilter');\nexport default PropertyFilter;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"property-filter-autosuggest.d.ts","sourceRoot":"","sources":["../../../src/property-filter/property-filter-autosuggest.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAG3C,OAAO,EAAmB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAM9E,OAAO,EAEL,sBAAsB,EAGvB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAyB,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAQjG,MAAM,WAAW,8BAA+B,SAAQ,gBAAgB,EAAE,0BAA0B;IAClG,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChE,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,QAAA,MAAM,yBAAyB,4GAoK9B,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"property-filter-autosuggest.d.ts","sourceRoot":"","sources":["../../../src/property-filter/property-filter-autosuggest.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAGpD,OAAO,EAAmB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAM9E,OAAO,EAEL,sBAAsB,EAGvB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAyB,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AASjG,MAAM,WAAW,8BA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