@cloudscape-design/components 3.0.842 → 3.0.844

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 (37) hide show
  1. package/autosuggest/load-more-controller.d.ts.map +1 -1
  2. package/autosuggest/load-more-controller.js +1 -1
  3. package/autosuggest/load-more-controller.js.map +1 -1
  4. package/internal/environment.js +1 -1
  5. package/internal/environment.json +1 -1
  6. package/internal/manifest.json +1 -1
  7. package/key-value-pairs/index.d.ts +1 -1
  8. package/key-value-pairs/index.d.ts.map +1 -1
  9. package/key-value-pairs/index.js +2 -2
  10. package/key-value-pairs/index.js.map +1 -1
  11. package/key-value-pairs/interfaces.d.ts +8 -0
  12. package/key-value-pairs/interfaces.d.ts.map +1 -1
  13. package/key-value-pairs/interfaces.js.map +1 -1
  14. package/key-value-pairs/internal.d.ts.map +1 -1
  15. package/key-value-pairs/internal.js +2 -2
  16. package/key-value-pairs/internal.js.map +1 -1
  17. package/package.json +1 -1
  18. package/property-filter/interfaces.d.ts +6 -0
  19. package/property-filter/interfaces.d.ts.map +1 -1
  20. package/property-filter/interfaces.js.map +1 -1
  21. package/property-filter/internal.d.ts.map +1 -1
  22. package/property-filter/internal.js +13 -2
  23. package/property-filter/internal.js.map +1 -1
  24. package/text-filter/interfaces.d.ts +6 -0
  25. package/text-filter/interfaces.d.ts.map +1 -1
  26. package/text-filter/interfaces.js.map +1 -1
  27. package/text-filter/internal.d.ts.map +1 -1
  28. package/text-filter/internal.js +13 -2
  29. package/text-filter/internal.js.map +1 -1
  30. package/text-filter/search-results.d.ts +4 -2
  31. package/text-filter/search-results.d.ts.map +1 -1
  32. package/text-filter/search-results.js +13 -6
  33. package/text-filter/search-results.js.map +1 -1
  34. package/text-filter/use-debounce-search-result-callback.d.ts +8 -0
  35. package/text-filter/use-debounce-search-result-callback.d.ts.map +1 -0
  36. package/text-filter/use-debounce-search-result-callback.js +23 -0
  37. package/text-filter/use-debounce-search-result-callback.js.map +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"load-more-controller.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/load-more-controller.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,UAAU,2BAA2B;IACnC,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC;IACnC,UAAU,EAAE,mBAAmB,CAAC,UAAU,CAAC;IAC3C,WAAW,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;CACvD;AAED,UAAU,2BAA2B;IACnC,oBAAoB,IAAI,IAAI,CAAC;IAC7B,2BAA2B,IAAI,IAAI,CAAC;IACpC,wBAAwB,IAAI,IAAI,CAAC;IACjC,yBAAyB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CACxD;AAED,eAAO,MAAM,sBAAsB,0CAIhC,2BAA2B,KAAG,2BAgChC,CAAC"}
1
+ {"version":3,"file":"load-more-controller.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/load-more-controller.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,UAAU,2BAA2B;IACnC,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC;IACnC,UAAU,EAAE,mBAAmB,CAAC,UAAU,CAAC;IAC3C,WAAW,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;CACvD;AAED,UAAU,2BAA2B;IACnC,oBAAoB,IAAI,IAAI,CAAC;IAC7B,2BAA2B,IAAI,IAAI,CAAC;IACpC,wBAAwB,IAAI,IAAI,CAAC;IACjC,yBAAyB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CACxD;AAED,eAAO,MAAM,sBAAsB,0CAIhC,2BAA2B,KAAG,2BAiChC,CAAC"}
@@ -16,7 +16,7 @@ export const useAutosuggestLoadMore = ({ options = [], statusType, onLoadItems,
16
16
  options.length > 0 && statusType === 'pending' && fireLoadMore({ firstPage: false, samePage: false });
17
17
  };
18
18
  const fireLoadMoreOnRecoveryClick = () => fireLoadMore({ firstPage: false, samePage: true });
19
- const fireLoadMoreOnInputFocus = () => fireLoadMore({ firstPage: true, samePage: false, filteringText: '' });
19
+ const fireLoadMoreOnInputFocus = () => { var _a; return fireLoadMore({ firstPage: true, samePage: false, filteringText: (_a = lastFilteringText.current) !== null && _a !== void 0 ? _a : '' }); };
20
20
  const fireLoadMoreOnInputChange = (filteringText) => fireLoadMore({ firstPage: true, samePage: false, filteringText });
21
21
  return { fireLoadMoreOnScroll, fireLoadMoreOnRecoveryClick, fireLoadMoreOnInputFocus, fireLoadMoreOnInputChange };
22
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"load-more-controller.js","sourceRoot":"","sources":["../../../src/autosuggest/load-more-controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAmB/B,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,OAAO,GAAG,EAAE,EACZ,UAAU,EACV,WAAW,GACiB,EAA+B,EAAE;IAC7D,MAAM,iBAAiB,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IAEtD,MAAM,YAAY,GAAG,CAAC,EACpB,SAAS,EACT,QAAQ,EACR,aAAa,GAKd,EAAE,EAAE;;QACH,IAAI,aAAa,KAAK,SAAS,IAAI,iBAAiB,CAAC,OAAO,KAAK,aAAa,EAAE;YAC9E,IAAI,aAAa,KAAK,SAAS,EAAE;gBAC/B,iBAAiB,CAAC,OAAO,GAAG,aAAa,CAAC;aAC3C;YACD,WAAW,CAAC,EAAE,aAAa,EAAE,MAAA,iBAAiB,CAAC,OAAO,mCAAI,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;SACtF;IACH,CAAC,CAAC;IAEF,MAAM,oBAAoB,GAAG,GAAG,EAAE;QAChC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,KAAK,SAAS,IAAI,YAAY,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IACxG,CAAC,CAAC;IAEF,MAAM,2BAA2B,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAE7F,MAAM,wBAAwB,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;IAE7G,MAAM,yBAAyB,GAAG,CAAC,aAAqB,EAAE,EAAE,CAC1D,YAAY,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAAC;IAEpE,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,CAAC;AACpH,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useRef } from 'react';\n\nimport { OptionsLoadItemsDetail } from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\nimport { AutosuggestProps } from './interfaces';\n\ninterface UseAutosuggestLoadMoreProps {\n options?: AutosuggestProps.Options;\n statusType: DropdownStatusProps.StatusType;\n onLoadItems: (detail: OptionsLoadItemsDetail) => void;\n}\n\ninterface AutosuggestLoadMoreHandlers {\n fireLoadMoreOnScroll(): void;\n fireLoadMoreOnRecoveryClick(): void;\n fireLoadMoreOnInputFocus(): void;\n fireLoadMoreOnInputChange(filteringText: string): void;\n}\n\nexport const useAutosuggestLoadMore = ({\n options = [],\n statusType,\n onLoadItems,\n}: UseAutosuggestLoadMoreProps): AutosuggestLoadMoreHandlers => {\n const lastFilteringText = useRef<string | null>(null);\n\n const fireLoadMore = ({\n firstPage,\n samePage,\n filteringText,\n }: {\n firstPage: boolean;\n samePage: boolean;\n filteringText?: string;\n }) => {\n if (filteringText === undefined || lastFilteringText.current !== filteringText) {\n if (filteringText !== undefined) {\n lastFilteringText.current = filteringText;\n }\n onLoadItems({ filteringText: lastFilteringText.current ?? '', firstPage, samePage });\n }\n };\n\n const fireLoadMoreOnScroll = () => {\n options.length > 0 && statusType === 'pending' && fireLoadMore({ firstPage: false, samePage: false });\n };\n\n const fireLoadMoreOnRecoveryClick = () => fireLoadMore({ firstPage: false, samePage: true });\n\n const fireLoadMoreOnInputFocus = () => fireLoadMore({ firstPage: true, samePage: false, filteringText: '' });\n\n const fireLoadMoreOnInputChange = (filteringText: string) =>\n fireLoadMore({ firstPage: true, samePage: false, filteringText });\n\n return { fireLoadMoreOnScroll, fireLoadMoreOnRecoveryClick, fireLoadMoreOnInputFocus, fireLoadMoreOnInputChange };\n};\n"]}
1
+ {"version":3,"file":"load-more-controller.js","sourceRoot":"","sources":["../../../src/autosuggest/load-more-controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAmB/B,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,OAAO,GAAG,EAAE,EACZ,UAAU,EACV,WAAW,GACiB,EAA+B,EAAE;IAC7D,MAAM,iBAAiB,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IAEtD,MAAM,YAAY,GAAG,CAAC,EACpB,SAAS,EACT,QAAQ,EACR,aAAa,GAKd,EAAE,EAAE;;QACH,IAAI,aAAa,KAAK,SAAS,IAAI,iBAAiB,CAAC,OAAO,KAAK,aAAa,EAAE;YAC9E,IAAI,aAAa,KAAK,SAAS,EAAE;gBAC/B,iBAAiB,CAAC,OAAO,GAAG,aAAa,CAAC;aAC3C;YACD,WAAW,CAAC,EAAE,aAAa,EAAE,MAAA,iBAAiB,CAAC,OAAO,mCAAI,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;SACtF;IACH,CAAC,CAAC;IAEF,MAAM,oBAAoB,GAAG,GAAG,EAAE;QAChC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,KAAK,SAAS,IAAI,YAAY,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IACxG,CAAC,CAAC;IAEF,MAAM,2BAA2B,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAE7F,MAAM,wBAAwB,GAAG,GAAG,EAAE,WACpC,OAAA,YAAY,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,MAAA,iBAAiB,CAAC,OAAO,mCAAI,EAAE,EAAE,CAAC,CAAA,EAAA,CAAC;IAErG,MAAM,yBAAyB,GAAG,CAAC,aAAqB,EAAE,EAAE,CAC1D,YAAY,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAAC;IAEpE,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,CAAC;AACpH,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useRef } from 'react';\n\nimport { OptionsLoadItemsDetail } from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\nimport { AutosuggestProps } from './interfaces';\n\ninterface UseAutosuggestLoadMoreProps {\n options?: AutosuggestProps.Options;\n statusType: DropdownStatusProps.StatusType;\n onLoadItems: (detail: OptionsLoadItemsDetail) => void;\n}\n\ninterface AutosuggestLoadMoreHandlers {\n fireLoadMoreOnScroll(): void;\n fireLoadMoreOnRecoveryClick(): void;\n fireLoadMoreOnInputFocus(): void;\n fireLoadMoreOnInputChange(filteringText: string): void;\n}\n\nexport const useAutosuggestLoadMore = ({\n options = [],\n statusType,\n onLoadItems,\n}: UseAutosuggestLoadMoreProps): AutosuggestLoadMoreHandlers => {\n const lastFilteringText = useRef<string | null>(null);\n\n const fireLoadMore = ({\n firstPage,\n samePage,\n filteringText,\n }: {\n firstPage: boolean;\n samePage: boolean;\n filteringText?: string;\n }) => {\n if (filteringText === undefined || lastFilteringText.current !== filteringText) {\n if (filteringText !== undefined) {\n lastFilteringText.current = filteringText;\n }\n onLoadItems({ filteringText: lastFilteringText.current ?? '', firstPage, samePage });\n }\n };\n\n const fireLoadMoreOnScroll = () => {\n options.length > 0 && statusType === 'pending' && fireLoadMore({ firstPage: false, samePage: false });\n };\n\n const fireLoadMoreOnRecoveryClick = () => fireLoadMore({ firstPage: false, samePage: true });\n\n const fireLoadMoreOnInputFocus = () =>\n fireLoadMore({ firstPage: true, samePage: false, filteringText: lastFilteringText.current ?? '' });\n\n const fireLoadMoreOnInputChange = (filteringText: string) =>\n fireLoadMore({ firstPage: true, samePage: false, filteringText });\n\n return { fireLoadMoreOnScroll, fireLoadMoreOnRecoveryClick, fireLoadMoreOnInputFocus, fireLoadMoreOnInputChange };\n};\n"]}
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (4db7ed62)";
2
+ export var PACKAGE_VERSION = "3.0.0 (c3fcf071)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (4db7ed62)",
3
+ "PACKAGE_VERSION": "3.0.0 (c3fcf071)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "4db7ed625314f046467721cdec2ab28548344d0f"
2
+ "commit": "c3fcf0717ba17e7f5bf9b327c3833603e4a0a73f"
3
3
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { KeyValuePairsProps } from './interfaces';
3
3
  export { KeyValuePairsProps };
4
- export default function KeyValuePairs({ columns, items, ariaLabel, ariaLabelledby, ...rest }: KeyValuePairsProps): JSX.Element;
4
+ export default function KeyValuePairs({ columns, items, ariaLabel, ariaLabelledby, minColumnWidth, ...rest }: KeyValuePairsProps): JSX.Element;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/key-value-pairs/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,OAAW,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,EAAE,kBAAkB,eAgBnH"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/key-value-pairs/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,OAAW,EACX,KAAK,EACL,SAAS,EACT,cAAc,EACd,cAAoB,EACpB,GAAG,IAAI,EACR,EAAE,kBAAkB,eAiBpB"}
@@ -7,12 +7,12 @@ import useBaseComponent from '../internal/hooks/use-base-component';
7
7
  import { applyDisplayName } from '../internal/utils/apply-display-name';
8
8
  import InternalKeyValuePairs from './internal';
9
9
  export default function KeyValuePairs(_a) {
10
- var { columns = 1, items, ariaLabel, ariaLabelledby } = _a, rest = __rest(_a, ["columns", "items", "ariaLabel", "ariaLabelledby"]);
10
+ var { columns = 1, items, ariaLabel, ariaLabelledby, minColumnWidth = 150 } = _a, rest = __rest(_a, ["columns", "items", "ariaLabel", "ariaLabelledby", "minColumnWidth"]);
11
11
  const { __internalRootRef } = useBaseComponent('KeyValuePairs', {
12
12
  props: { columns },
13
13
  });
14
14
  const baseProps = getBaseProps(rest);
15
- return (React.createElement(InternalKeyValuePairs, Object.assign({ columns: columns, items: items, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby }, baseProps, { ref: __internalRootRef })));
15
+ return (React.createElement(InternalKeyValuePairs, Object.assign({ columns: columns, items: items, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, minColumnWidth: minColumnWidth }, baseProps, { ref: __internalRootRef })));
16
16
  }
17
17
  applyDisplayName(KeyValuePairs, 'KeyValuePairs');
18
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/key-value-pairs/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,qBAAqB,MAAM,YAAY,CAAC;AAI/C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAA8E;QAA9E,EAAE,OAAO,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,OAA+B,EAA1B,IAAI,cAAxD,mDAA0D,CAAF;IAC5F,MAAM,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,CAAC,eAAe,EAAE;QAC9D,KAAK,EAAE,EAAE,OAAO,EAAE;KACnB,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAErC,OAAO,CACL,oBAAC,qBAAqB,kBACpB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,IAC1B,SAAS,IACb,GAAG,EAAE,iBAAiB,IACtB,CACH,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { KeyValuePairsProps } from './interfaces';\nimport InternalKeyValuePairs from './internal';\n\nexport { KeyValuePairsProps };\n\nexport default function KeyValuePairs({ columns = 1, items, ariaLabel, ariaLabelledby, ...rest }: KeyValuePairsProps) {\n const { __internalRootRef } = useBaseComponent('KeyValuePairs', {\n props: { columns },\n });\n const baseProps = getBaseProps(rest);\n\n return (\n <InternalKeyValuePairs\n columns={columns}\n items={items}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n {...baseProps}\n ref={__internalRootRef}\n />\n );\n}\n\napplyDisplayName(KeyValuePairs, 'KeyValuePairs');\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/key-value-pairs/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,qBAAqB,MAAM,YAAY,CAAC;AAI/C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAOjB;QAPiB,EACpC,OAAO,GAAG,CAAC,EACX,KAAK,EACL,SAAS,EACT,cAAc,EACd,cAAc,GAAG,GAAG,OAED,EADhB,IAAI,cAN6B,qEAOrC,CADQ;IAEP,MAAM,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,CAAC,eAAe,EAAE;QAC9D,KAAK,EAAE,EAAE,OAAO,EAAE;KACnB,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAErC,OAAO,CACL,oBAAC,qBAAqB,kBACpB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,IAC1B,SAAS,IACb,GAAG,EAAE,iBAAiB,IACtB,CACH,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { KeyValuePairsProps } from './interfaces';\nimport InternalKeyValuePairs from './internal';\n\nexport { KeyValuePairsProps };\n\nexport default function KeyValuePairs({\n columns = 1,\n items,\n ariaLabel,\n ariaLabelledby,\n minColumnWidth = 150,\n ...rest\n}: KeyValuePairsProps) {\n const { __internalRootRef } = useBaseComponent('KeyValuePairs', {\n props: { columns },\n });\n const baseProps = getBaseProps(rest);\n\n return (\n <InternalKeyValuePairs\n columns={columns}\n items={items}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n minColumnWidth={minColumnWidth}\n {...baseProps}\n ref={__internalRootRef}\n />\n );\n}\n\napplyDisplayName(KeyValuePairs, 'KeyValuePairs');\n"]}
@@ -35,6 +35,14 @@ export interface KeyValuePairsProps extends BaseComponentProps {
35
35
  * Don't use `ariaLabel` and `ariaLabelledby` at the same time.
36
36
  */
37
37
  ariaLabelledby?: string;
38
+ /**
39
+ * Use to specify the desired minimum width for each column in pixels.
40
+ *
41
+ * The number of columns is determined by the value of this property, the available space,
42
+ * and the maximum number of columns as defined by the `columns` property.
43
+ * If not set, defaults to 150.
44
+ */
45
+ minColumnWidth?: number;
38
46
  }
39
47
  export declare namespace KeyValuePairsProps {
40
48
  type Item = Group | Pair;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/key-value-pairs/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,EAAE,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC9C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,yBAAiB,kBAAkB,CAAC;IAClC,KAAY,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC;IAEhC,UAAiB,KAAK;QACpB,IAAI,EAAE,OAAO,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;KAC5B;IAED,UAAiB,IAAK,SAAQ,kBAAkB;QAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;KACxB;CACF"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/key-value-pairs/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,EAAE,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC9C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,yBAAiB,kBAAkB,CAAC;IAClC,KAAY,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC;IAEhC,UAAiB,KAAK;QACpB,IAAI,EAAE,OAAO,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;KAC5B;IAED,UAAiB,IAAK,SAAQ,kBAAkB;QAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;KACxB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/key-value-pairs/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface KeyValuePairsProps extends BaseComponentProps {\n /**\n * Specifies the number of columns in each grid row.\n * Valid values are any integer between 1 and 4. It defaults to 1.\n */\n columns?: number;\n /**\n * An array of either key-value pairs individual items or groups.\n * They could be combined.\n * Each item has `type` prop, which might be either `group` or `pair`. Defaults to `pair` if not specified.\n *\n * Each key-value pair definition has the following properties:\n * * `type` (string) - (Optional) Item type (pair).\n * * `label` (string) - The key label.\n * * `info` (React.ReactNode) - (Optional) Area next to the key to display an info link.\n * * `value` (React.ReactNode) - The corresponding value for the key.\n *\n * Each group definition has the following properties:\n * * `type` (string) - Item type (group).\n * * `title` (string) - (Optional) An optional title for this column.\n * * `items` (ReadonlyArray<KeyValuePairProps.KeyValuePair>) - An array of\n * key-value pair items.\n */\n items: ReadonlyArray<KeyValuePairsProps.Item>;\n /**\n * Provides an `aria-label` to the Key-value pairs container.\n * Don't use `ariaLabel` and `ariaLabelledby` at the same time.\n */\n ariaLabel?: string;\n /**\n * Sets the `aria-labelledby` property on the Key-value pairs container.\n * If there's a visible label element that you can reference, use this instead of `ariaLabel`.\n * Don't use `ariaLabel` and `ariaLabelledby` at the same time.\n */\n ariaLabelledby?: string;\n}\n\nexport namespace KeyValuePairsProps {\n export type Item = Group | Pair;\n\n export interface Group {\n type: 'group';\n title?: string;\n items: ReadonlyArray<Pair>;\n }\n\n export interface Pair extends BaseComponentProps {\n type?: 'pair';\n label: string;\n value: React.ReactNode;\n info?: React.ReactNode;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/key-value-pairs/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface KeyValuePairsProps extends BaseComponentProps {\n /**\n * Specifies the number of columns in each grid row.\n * Valid values are any integer between 1 and 4. It defaults to 1.\n */\n columns?: number;\n /**\n * An array of either key-value pairs individual items or groups.\n * They could be combined.\n * Each item has `type` prop, which might be either `group` or `pair`. Defaults to `pair` if not specified.\n *\n * Each key-value pair definition has the following properties:\n * * `type` (string) - (Optional) Item type (pair).\n * * `label` (string) - The key label.\n * * `info` (React.ReactNode) - (Optional) Area next to the key to display an info link.\n * * `value` (React.ReactNode) - The corresponding value for the key.\n *\n * Each group definition has the following properties:\n * * `type` (string) - Item type (group).\n * * `title` (string) - (Optional) An optional title for this column.\n * * `items` (ReadonlyArray<KeyValuePairProps.KeyValuePair>) - An array of\n * key-value pair items.\n */\n items: ReadonlyArray<KeyValuePairsProps.Item>;\n /**\n * Provides an `aria-label` to the Key-value pairs container.\n * Don't use `ariaLabel` and `ariaLabelledby` at the same time.\n */\n ariaLabel?: string;\n /**\n * Sets the `aria-labelledby` property on the Key-value pairs container.\n * If there's a visible label element that you can reference, use this instead of `ariaLabel`.\n * Don't use `ariaLabel` and `ariaLabelledby` at the same time.\n */\n ariaLabelledby?: string;\n\n /**\n * Use to specify the desired minimum width for each column in pixels.\n *\n * The number of columns is determined by the value of this property, the available space,\n * and the maximum number of columns as defined by the `columns` property.\n * If not set, defaults to 150.\n */\n minColumnWidth?: number;\n}\n\nexport namespace KeyValuePairsProps {\n export type Item = Group | Pair;\n\n export interface Group {\n type: 'group';\n title?: string;\n items: ReadonlyArray<Pair>;\n }\n\n export interface Pair extends BaseComponentProps {\n type?: 'pair';\n label: string;\n value: React.ReactNode;\n info?: React.ReactNode;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/key-value-pairs/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AA6BlD,QAAA,MAAM,qBAAqB,2IA8D1B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/key-value-pairs/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AA6BlD,QAAA,MAAM,qBAAqB,2IAoE1B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -21,10 +21,10 @@ const InternalKeyValuePairGroup = ({ label, value }) => (React.createElement(Rea
21
21
  label && React.createElement("dt", { className: styles['group-title'] }, label),
22
22
  React.createElement("dd", { className: styles.detail }, value)));
23
23
  const InternalKeyValuePairs = React.forwardRef((_a, ref) => {
24
- var { columns, items, className, ariaLabel, ariaLabelledby } = _a, rest = __rest(_a, ["columns", "items", "className", "ariaLabel", "ariaLabelledby"]);
24
+ var { columns, items, className, ariaLabel, ariaLabelledby, minColumnWidth } = _a, rest = __rest(_a, ["columns", "items", "className", "ariaLabel", "ariaLabelledby", "minColumnWidth"]);
25
25
  return (React.createElement(LinkDefaultVariantContext.Provider, { value: { defaultVariant: 'primary' } },
26
26
  React.createElement("div", Object.assign({}, rest, { className: clsx(styles['key-value-pairs'], className), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ref: ref }),
27
- React.createElement(ColumnLayout, { __tagOverride: "dl", columns: Math.min(columns, 4), variant: "text-grid", minColumnWidth: 150 }, items.map((pair, index) => {
27
+ React.createElement(ColumnLayout, { __tagOverride: "dl", columns: Math.min(columns, 4), variant: "text-grid", minColumnWidth: minColumnWidth }, items.map((pair, index) => {
28
28
  if (pair.type === 'group') {
29
29
  return (
30
30
  /* InternalKeyValuePairGroup tells react to treat the dt-dd pair as an individual layout item.
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/key-value-pairs/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,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,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,qBAAqB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport Box from '../box/internal';\nimport ColumnLayout from '../column-layout/internal';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { KeyValuePairsProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nconst InternalKeyValuePair = ({ label, info, value, id }: KeyValuePairsProps.Pair) => {\n const kvPairId = useUniqueId('kv-pair-');\n\n return (\n <>\n <dt className={styles.term}>\n <label className={styles['key-label']} id={id || kvPairId}>\n {label}\n </label>\n <InfoLinkLabelContext.Provider value={id || kvPairId}>\n {info && <span className={styles.info}>{info}</span>}\n </InfoLinkLabelContext.Provider>\n </dt>\n <dd className={styles.detail}>{value}</dd>\n </>\n );\n};\n\nconst InternalKeyValuePairGroup = ({ label, value }: { label?: React.ReactNode; value: React.ReactNode }) => (\n <>\n {label && <dt className={styles['group-title']}>{label}</dt>}\n <dd className={styles.detail}>{value}</dd>\n </>\n);\n\nconst InternalKeyValuePairs = React.forwardRef(\n (\n {\n columns,\n items,\n className,\n ariaLabel,\n ariaLabelledby,\n ...rest\n }: KeyValuePairsProps & Required<Pick<KeyValuePairsProps, 'columns'>>,\n ref: React.Ref<HTMLDivElement>\n ) => {\n return (\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <div\n {...rest}\n className={clsx(styles['key-value-pairs'], className)}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n ref={ref}\n >\n {/*\n minColumnWidth={150} is set to use FlexibleColumnLayout which has only 1 nested div wrapper for column items,\n otherwise GridColumnLayout will be used, which has 2 nested div, therefore it is not a11y compatible for dl -> dt/dd relationship\n */}\n <ColumnLayout __tagOverride=\"dl\" columns={Math.min(columns, 4)} variant=\"text-grid\" minColumnWidth={150}>\n {items.map((pair, index) => {\n if (pair.type === 'group') {\n return (\n /* InternalKeyValuePairGroup tells react to treat the dt-dd pair as an individual layout item.\n * Otherwise, without this component, they will be rendered as a list, which ruins the html structure.\n * InternalKeyValuePairGroup is not wrapped by div tag, because it ruins a11y compatibility for dl -> dt/dd\n * */\n <InternalKeyValuePairGroup\n key={index}\n label={\n pair.title && (\n <Box variant=\"h3\" padding=\"n\">\n {pair.title}\n </Box>\n )\n }\n value={\n <dl className={styles['group-list']}>\n {pair.items.map((item, itemIndex) => (\n <div key={itemIndex} className={styles['group-list-item']}>\n <InternalKeyValuePair {...item} />\n </div>\n ))}\n </dl>\n }\n />\n );\n }\n\n return <InternalKeyValuePair key={index} {...pair} />;\n })}\n </ColumnLayout>\n </div>\n </LinkDefaultVariantContext.Provider>\n );\n }\n);\n\nexport default InternalKeyValuePairs;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/key-value-pairs/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAClC,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,oBAAoB,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAA2B,EAAE,EAAE;IACnF,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;IAEzC,OAAO,CACL;QACE,4B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Ac,IAE7B,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;gBACzB,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;oBACzB,OAAO;oBACL;;;0BAGM;oBACN,oBAAC,yBAAyB,IACxB,GAAG,EAAE,KAAK,EACV,KAAK,EACH,IAAI,CAAC,KAAK,IAAI,CACZ,oBAAC,GAAG,IAAC,OAAO,EAAC,IAAI,EAAC,OAAO,EAAC,GAAG,IAC1B,IAAI,CAAC,KAAK,CACP,CACP,EAEH,KAAK,EACH,4BAAI,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,IAChC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CACnC,6BAAK,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC;4BACvD,oBAAC,oBAAoB,oBAAK,IAAI,EAAI,CAC9B,CACP,CAAC,CACC,GAEP,CACH,CAAC;iBACH;gBAED,OAAO,oBAAC,oBAAoB,kBAAC,GAAG,EAAE,KAAK,IAAM,IAAI,EAAI,CAAC;YACxD,CAAC,CAAC,CACW,CACX,CAC6B,CACtC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,qBAAqB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport Box from '../box/internal';\nimport ColumnLayout from '../column-layout/internal';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { KeyValuePairsProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nconst InternalKeyValuePair = ({ label, info, value, id }: KeyValuePairsProps.Pair) => {\n const kvPairId = useUniqueId('kv-pair-');\n\n return (\n <>\n <dt className={styles.term}>\n <label className={styles['key-label']} id={id || kvPairId}>\n {label}\n </label>\n <InfoLinkLabelContext.Provider value={id || kvPairId}>\n {info && <span className={styles.info}>{info}</span>}\n </InfoLinkLabelContext.Provider>\n </dt>\n <dd className={styles.detail}>{value}</dd>\n </>\n );\n};\n\nconst InternalKeyValuePairGroup = ({ label, value }: { label?: React.ReactNode; value: React.ReactNode }) => (\n <>\n {label && <dt className={styles['group-title']}>{label}</dt>}\n <dd className={styles.detail}>{value}</dd>\n </>\n);\n\nconst InternalKeyValuePairs = React.forwardRef(\n (\n {\n columns,\n items,\n className,\n ariaLabel,\n ariaLabelledby,\n minColumnWidth,\n ...rest\n }: KeyValuePairsProps & Required<Pick<KeyValuePairsProps, 'columns'>>,\n ref: React.Ref<HTMLDivElement>\n ) => {\n return (\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <div\n {...rest}\n className={clsx(styles['key-value-pairs'], className)}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n ref={ref}\n >\n {/*\n minColumnWidth={150} is set to use FlexibleColumnLayout which has only 1 nested div wrapper for column items,\n otherwise GridColumnLayout will be used, which has 2 nested div, therefore it is not a11y compatible for dl -> dt/dd relationship\n */}\n <ColumnLayout\n __tagOverride=\"dl\"\n columns={Math.min(columns, 4)}\n variant=\"text-grid\"\n minColumnWidth={minColumnWidth}\n >\n {items.map((pair, index) => {\n if (pair.type === 'group') {\n return (\n /* InternalKeyValuePairGroup tells react to treat the dt-dd pair as an individual layout item.\n * Otherwise, without this component, they will be rendered as a list, which ruins the html structure.\n * InternalKeyValuePairGroup is not wrapped by div tag, because it ruins a11y compatibility for dl -> dt/dd\n * */\n <InternalKeyValuePairGroup\n key={index}\n label={\n pair.title && (\n <Box variant=\"h3\" padding=\"n\">\n {pair.title}\n </Box>\n )\n }\n value={\n <dl className={styles['group-list']}>\n {pair.items.map((item, itemIndex) => (\n <div key={itemIndex} className={styles['group-list-item']}>\n <InternalKeyValuePair {...item} />\n </div>\n ))}\n </dl>\n }\n />\n );\n }\n\n return <InternalKeyValuePair key={index} {...pair} />;\n })}\n </ColumnLayout>\n </div>\n </LinkDefaultVariantContext.Provider>\n );\n }\n);\n\nexport default InternalKeyValuePairs;\n"]}
package/package.json CHANGED
@@ -131,7 +131,7 @@
131
131
  "./internal/base-component/index.js",
132
132
  "./internal/base-component/styles.css.js"
133
133
  ],
134
- "version": "3.0.842",
134
+ "version": "3.0.844",
135
135
  "repository": {
136
136
  "type": "git",
137
137
  "url": "https://github.com/cloudscape-design/components.git"
@@ -24,8 +24,14 @@ export interface PropertyFilterProps extends BaseComponentProps, ExpandToViewpor
24
24
  * the number listed. For example, "25+ matches."
25
25
  *
26
26
  * The count text is only displayed when `query.tokens` isn't empty.
27
+ * When the `countText` or `query` changes, it will be announced to assistive technologies.
27
28
  */
28
29
  countText?: string;
30
+ /**
31
+ * Set to `true` while the related collection is loading (e.g. during an async filtering action).
32
+ * If set to `true`, the live announcement of countText by assistive technologies will be paused until it changes back to `false`.
33
+ */
34
+ loading?: boolean;
29
35
  /**
30
36
  * An object representing the current query displayed in the property filter, which has three properties: `operation`, `tokens`, and `tokenGroups`.
31
37
  * The `operation` property has two valid values: "and", "or", and controls the join operation to be applied between tokens when filtering the items.
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,+BAA+B,EAC/B,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,EAC9B,0BAA0B,EAC1B,4BAA4B,EAC5B,+BAA+B,EAC/B,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAA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AM,aAAa,GAAG,kBAAkB,CAAC;AAE/C,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,yBAAyB,CAAC;IAAC,QAAQ,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACtG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,yBAAyB,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GACjF;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\n\nimport {\n PropertyFilterFreeTextFiltering,\n PropertyFilterOperation,\n PropertyFilterOperator,\n PropertyFilterOperatorExtended,\n PropertyFilterOperatorForm,\n PropertyFilterOperatorFormat,\n PropertyFilterOperatorFormProps,\n PropertyFilterOption,\n PropertyFilterProperty,\n PropertyFilterQuery,\n PropertyFilterToken,\n PropertyFilterTokenGroup,\n PropertyFilterTokenType,\n} from '@cloudscape-design/collection-hooks';\n\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface PropertyFilterProps extends BaseComponentProps, ExpandToViewport, FormFieldControlProps {\n /**\n * If set to `true`, the filtering input will be disabled.\n * Use it, for example, if you are fetching new items upon filtering change\n * in order to prevent the user from changing the filtering query.\n */\n disabled?: boolean;\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: PropertyFilterProps.I18nStrings;\n /**\n * Accepts a human-readable, localized string that indicates the number of results. For example, \"1 match\" or \"165 matches.\"\n * If the total number of results is unknown, also include an indication that there may be more results than\n * the number listed. For example, \"25+ matches.\"\n *\n * The count text is only displayed when `query.tokens` isn't empty.\n */\n countText?: string;\n /**\n * An object representing the current query displayed in the property filter, which has three properties: `operation`, `tokens`, and `tokenGroups`.\n * The `operation` property has two valid values: \"and\", \"or\", and controls the join operation to be applied between tokens when filtering the items.\n * The `tokens` property is an array of objects that will be displayed to the user beneath the filtering input. When `enableTokenGroups=true`, the\n * `tokenGroups` property is used instead, which supports nested tokens.\n *\n * Each token has the following properties:\n * * value [unknown]: The value of the token to be used as a filter. Can be null or string for default tokens, string[] for enum tokens, and anything for tokens with custom forms.\n * * propertyKey [string]: The key of the corresponding property in filteringProperties.\n * * operator ['<' | '<=' | '>' | '>=' | ':' | '!:' | '=' | '!=' | '^' | '!^']: The operator which indicates how to filter the dataset using this token.\n */\n query: PropertyFilterProps.Query;\n /**\n * If hideOperations it set, the indicator of the operation (that is, `and` or `or`) and the selection of operations\n * (applied to the property and value token) are hidden from the user. Only use when you have a custom\n * filtering logic which combines tokens in different way than the default one. When used, ensure that\n * operations are communicated to the user in another way.\n *\n * This property cannot be set when `enableTokenGroups=true`.\n */\n hideOperations?: boolean;\n /**\n * Activates token grouping mechanism to support token nesting (up to one level).\n * When `true`, the `query.tokens` property is ignored and `query.tokenGroups` is used instead.\n */\n enableTokenGroups?: boolean;\n /**\n * Fired when the `query` gets changed. Filter the dataset in response to this event using the values in the `detail` object.\n */\n onChange: NonCancelableEventHandler<PropertyFilterProps.Query>;\n /**\n * An array of properties by which the data set can be filtered. Each element has the following properties:\n *\n * * groupValuesLabel [string]: Localized string to display for the 'Values' group label for a specific property.\n * * key [string]: The identifier of this property.\n * * propertyLabel [string]: A human-readable string for the property.\n * * operators [Array]: A list of all operators supported by this property. If you omit the equals operator because your API does not support it, make sure to set `defaultOperator` to a supported operator from this list.\n * * group [string]: Optional identifier of a custom group that this filtering option is assigned to. Use to create additional groups below the default one. Make sure to also define labels for the group in the customGroupsText property. Notice that only one level of options nesting is supported.\n * * defaultOperator [ComparisonOperator]: Optional parameter that changes the default operator used with this filtering property. Use it only if your API does not support \"equals\" filtering terms with this property.\n */\n filteringProperties: ReadonlyArray<PropertyFilterProps.FilteringProperty>;\n /**\n * An array of possible values of the individual `filteringProperties`. Each element has the following properties:\n *\n * * `propertyKey` [string]: The key of the corresponding filtering property in the `filteringProperties` array.\n * * `value` [string]: The value that will be used as a suggestion when creating or modifying a filtering token.\n * * `label` [string]: Optional suggestion label to be matched instead of the value.\n *\n * Filtering options that require labels can only use `=` and `!=` operators. The token value must be labelled separately, for example:\n * ```\n * const filteringProperty = {\n * key: 'state',\n * propertyLabel: 'State',\n * operators: ['=', '!='].map(operator => ({ operator, format: getStateLabel }))\n * }\n * const filteringOptions = [\n * { propertyKey: 'state', value: 'STOPPED', label: getStateLabel('STOPPED') },\n * { propertyKey: 'state', value: 'STOPPING', label: getStateLabel('STOPPING') },\n * { propertyKey: 'state', value: 'RUNNING', label: getStateLabel('RUNNING') },\n * ]\n * ```\n */\n filteringOptions?: ReadonlyArray<PropertyFilterProps.FilteringOption>;\n /**\n * An array of objects that contain localized, human-readable strings for the labels of custom groups within the filtering dropdown. Use group property to associate the strings with your custom group of options. Define the following values for each group:\n *\n * * properties [string]: The group label in the filtering dropdown that contains the list of properties from this group. For example: Tags.\n * * values [string]: The group label in the filtering dropdown that contains the list of values from this group. For example: Tags values.\n * * group [string]: The identifier of a custom group.\n */\n customGroupsText?: PropertyFilterProps.GroupText[];\n /**\n * Set `disableFreeTextFiltering` only if you can’t filter the dataset using a filter that is applied to every column,\n * instead of a specific property. This would stop the user from creating such tokens.\n */\n disableFreeTextFiltering?: boolean;\n /**\n * An object configuring the operators for free text filtering, which has the following properties:\n *\n * * operators [Array]: A list of all operators supported for free text filtering. If you omit the contains operator because your API does not support it, make sure to set `defaultOperator` to a supported operator from this list.\n * * defaultOperator [ComparisonOperator]: An optional parameter that changes the default operator used for free text filtering. Use this parameter only if your API does not support \"contains\" free test filtering terms.\n */\n freeTextFiltering?: PropertyFilterProps.FreeTextFiltering;\n /**\n * Use this event to asynchronously load filteringOptions, component currently needs. The detail object contains following properties:\n *\n * * `filteringProperty` - The property for which you need to fetch the options.\n * * `filteringOperator` - The operator for which you need to fetch the options.\n * * `filteringText` - The value that you need to use to fetch options.\n * * `firstPage` - Indicates that you should fetch the first page of options for a `filteringProperty` that match the `filteringText`.\n * * `samePage` - Indicates that you should fetch the same page that you have previously fetched (for example, when the user clicks on the recovery button).\n */\n onLoadItems?: NonCancelableEventHandler<PropertyFilterProps.LoadItemsDetail>;\n /**\n * If you have more than 500 `filteringOptions`, enable this flag to apply a performance optimization that makes\n * the filtering experience smoother. We don't recommend enabling the feature if you have less than 500 options,\n * because the improvements to performance are offset by a visible scrolling lag. When you set this flag to true,\n * it removes options that are not currently in view from the DOM.\n */\n virtualScroll?: boolean;\n /**\n * A slot located before the filtering input. Use it if for a Select component if your dataset supports property\n * filter queries only after an initial filter is applied.\n */\n customControl?: React.ReactNode;\n /**\n * A slot that replaces the standard \"Clear filter\" button.\n * When using this slot, make sure to still provide a mechanism to clear all filters.\n */\n customFilterActions?: React.ReactNode;\n /**\n * Set `asyncProperties` if you need to load `filteringProperties` asynchronously. This would cause extra `onLoadMore`\n * events to fire calling for more properties.\n */\n asyncProperties?: boolean;\n /**\n * Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.\n */\n tokenLimit?: number;\n /**\n * The label that will be passed down to the Autosuggest `ariaLabel` property.\n * See the [Autosuggest API](/components/autosuggest/?tabId=api) page for more details.\n */\n filteringAriaLabel?: string;\n /**\n * Placeholder for the filtering input.\n */\n filteringPlaceholder?: string;\n /**\n * Displayed when there are no options to display.\n * This is only shown when `statusType` is set to `finished` or not set at all.\n */\n filteringEmpty?: React.ReactNode;\n /**\n * Specifies the text to display when in the loading state.\n **/\n filteringLoadingText?: string;\n /**\n * Specifies the text to display at the bottom of the dropdown menu after pagination has reached the end.\n **/\n filteringFinishedText?: string;\n /**\n * Specifies the text to display when a data fetching error occurs. Make sure that you provide `recoveryText`.\n **/\n filteringErrorText?: string;\n /**\n * Specifies the text for the recovery button. The text is displayed next to the error text.\n * Use the `onLoadItems` event to perform a recovery action (for example, retrying the request).\n **/\n filteringRecoveryText?: string;\n /**\n * Constraint text that's displayed below the filtering input.\n * Use this to provide additional information about supported filters.\n */\n filteringConstraintText?: React.ReactNode;\n /**\n * Specifies the current status of loading more options.\n * * `pending` - Indicates that no request in progress, but more options may be loaded.\n * * `loading` - Indicates that data fetching is in progress.\n * * `finished` - Indicates that pagination has finished and no more requests are expected.\n * * `error` - Indicates that an error occurred during fetch. You should use `recoveryText` to enable the user to recover.\n **/\n filteringStatusType?: DropdownStatusProps.StatusType;\n\n /**\n * Adds an aria-label to the \"Show fewer\" button for the token group control.\n * Use to assign unique labels when there are multiple token groups with the same `tokenLimitShowFewer` label on one page.\n */\n tokenLimitShowFewerAriaLabel?: string;\n /**\n * Adds an aria-label to the \"Show more\" button for the token group control.\n * Use to assign unique labels when there are multiple token groups with the same `tokenLimitShowMore` label on one page.\n */\n tokenLimitShowMoreAriaLabel?: string;\n}\n\nexport namespace PropertyFilterProps {\n export type Token = PropertyFilterToken;\n export type TokenGroup = PropertyFilterTokenGroup;\n export type JoinOperation = PropertyFilterOperation;\n export type ComparisonOperator = PropertyFilterOperator;\n export type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\n export type ExtendedOperatorFormProps<TokenValue> = PropertyFilterOperatorFormProps<TokenValue>;\n export type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\n export type ExtendedOperatorFormat<TokenValue> = PropertyFilterOperatorFormat<TokenValue>;\n export type FilteringOption = PropertyFilterOption;\n export type FilteringProperty = PropertyFilterProperty;\n export type FreeTextFiltering = PropertyFilterFreeTextFiltering;\n export type Query = PropertyFilterQuery;\n\n export interface LoadItemsDetail {\n filteringProperty?: FilteringProperty;\n filteringOperator?: ComparisonOperator;\n filteringText: string;\n firstPage: boolean;\n samePage: boolean;\n }\n\n export interface I18nStrings {\n /**\n * @deprecated Use `filteringAriaLabel` on the component instead.\n */\n filteringAriaLabel?: string;\n\n /**\n * @deprecated Use `filteringPlaceholder` on the component instead.\n */\n filteringPlaceholder?: string;\n\n dismissAriaLabel?: string;\n clearAriaLabel?: string;\n groupValuesText?: string;\n groupPropertiesText?: string;\n operatorsText?: string;\n\n operationAndText?: string;\n operationOrText?: string;\n\n operatorLessText?: string;\n operatorLessOrEqualText?: string;\n operatorGreaterText?: string;\n operatorGreaterOrEqualText?: string;\n operatorContainsText?: string;\n operatorDoesNotContainText?: string;\n operatorEqualsText?: string;\n operatorDoesNotEqualText?: string;\n operatorStartsWithText?: string;\n operatorDoesNotStartWithText?: string;\n\n editTokenHeader?: string;\n propertyText?: string;\n operatorText?: string;\n valueText?: string;\n cancelActionText?: string;\n applyActionText?: string;\n allPropertiesLabel?: string;\n\n formatToken?: (token: FormattedToken) => string;\n\n tokenLimitShowMore?: string;\n tokenLimitShowFewer?: string;\n clearFiltersText?: string;\n tokenOperatorAriaLabel?: string;\n removeTokenButtonAriaLabel?: (token: FormattedToken) => string;\n enteredTextLabel?: AutosuggestProps.EnteredTextLabel;\n\n groupEditAriaLabel?: (group: FormattedTokenGroup) => string;\n tokenEditorTokenActionsAriaLabel?: (token: FormattedToken) => string;\n tokenEditorTokenRemoveAriaLabel?: (token: FormattedToken) => string;\n tokenEditorTokenRemoveLabel?: string;\n tokenEditorTokenRemoveFromGroupLabel?: string;\n tokenEditorAddNewTokenLabel?: string;\n tokenEditorAddTokenActionsAriaLabel?: string;\n tokenEditorAddExistingTokenAriaLabel?: (token: FormattedToken) => string;\n tokenEditorAddExistingTokenLabel?: (token: FormattedToken) => string;\n }\n\n export interface FormattedToken {\n propertyKey?: string;\n propertyLabel: string;\n operator: ComparisonOperator;\n value: string;\n }\n\n export interface FormattedTokenGroup {\n tokens: FormattedToken[];\n operation: string;\n operationLabel: string;\n }\n\n export interface GroupText {\n properties: string;\n values: string;\n group: string;\n }\n\n export interface FilteringChangeDetail {\n filteringText: string;\n filteringProperty?: FilteringProperty;\n }\n\n export interface Ref {\n /**\n * Sets focus on the underlying input control.\n */\n focus(): void;\n }\n}\n\n// Re-exported namespace interfaces to use module-style imports internally\n\nexport type Token = PropertyFilterProps.Token;\nexport type TokenGroup = PropertyFilterProps.TokenGroup;\nexport type JoinOperation = PropertyFilterProps.JoinOperation;\nexport type ComparisonOperator = PropertyFilterProps.ComparisonOperator;\nexport type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\nexport type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\nexport type FilteringOption = PropertyFilterProps.FilteringOption;\nexport type FilteringProperty = PropertyFilterProps.FilteringProperty;\nexport type Query = PropertyFilterProps.Query;\nexport type LoadItemsDetail = PropertyFilterProps.LoadItemsDetail;\nexport type I18nStrings = PropertyFilterProps.I18nStrings;\nexport type GroupText = PropertyFilterProps.GroupText;\nexport type FormattedToken = PropertyFilterProps.FormattedToken;\nexport type Ref = PropertyFilterProps.Ref;\n\n// Utility types\n\nexport interface InternalFilteringProperty<TokenValue = any> {\n propertyKey: string;\n propertyLabel: string;\n groupValuesLabel: string;\n propertyGroup?: string;\n operators: readonly PropertyFilterOperator[];\n defaultOperator: PropertyFilterOperator;\n getTokenType: (operator?: PropertyFilterOperator) => PropertyFilterTokenType;\n getValueFormatter: (operator?: PropertyFilterOperator) => null | ((value: any) => string);\n getValueFormRenderer: (operator?: PropertyFilterOperator) => null | PropertyFilterOperatorForm<TokenValue>;\n // Original property used in callbacks.\n externalProperty: PropertyFilterProperty;\n}\n\nexport interface InternalFilteringOption {\n property: null | InternalFilteringProperty;\n value: string;\n label: string;\n}\n\nexport interface InternalFreeTextFiltering {\n disabled: boolean;\n operators: readonly PropertyFilterOperator[];\n defaultOperator: PropertyFilterOperator;\n}\n\nexport interface InternalToken<TokenValue = any> {\n standaloneIndex?: number;\n property: null | InternalFilteringProperty<TokenValue>;\n operator: PropertyFilterOperator;\n value: TokenValue;\n}\n\nexport interface InternalTokenGroup<TokenValue = any> {\n operation: PropertyFilterOperation;\n tokens: readonly (InternalToken<TokenValue> | InternalTokenGroup<TokenValue>)[];\n}\n\nexport type InternalQuery = InternalTokenGroup;\n\nexport type ParsedText =\n | { step: 'property'; property: InternalFilteringProperty; operator: ComparisonOperator; value: string }\n | { step: 'operator'; property: InternalFilteringProperty; operatorPrefix: string }\n | { step: 'free-text'; operator?: ComparisonOperator; value: string };\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\n\nimport {\n PropertyFilterFreeTextFiltering,\n PropertyFilterOperation,\n PropertyFilterOperator,\n PropertyFilterOperatorExtended,\n PropertyFilterOperatorForm,\n PropertyFilterOperatorFormat,\n PropertyFilterOperatorFormProps,\n PropertyFilterOption,\n PropertyFilterProperty,\n PropertyFilterQuery,\n PropertyFilterToken,\n PropertyFilterTokenGroup,\n PropertyFilterTokenType,\n} from '@cloudscape-design/collection-hooks';\n\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface PropertyFilterProps extends BaseComponentProps, ExpandToViewport, FormFieldControlProps {\n /**\n * If set to `true`, the filtering input will be disabled.\n * Use it, for example, if you are fetching new items upon filtering change\n * in order to prevent the user from changing the filtering query.\n */\n disabled?: boolean;\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: PropertyFilterProps.I18nStrings;\n /**\n * Accepts a human-readable, localized string that indicates the number of results. For example, \"1 match\" or \"165 matches.\"\n * If the total number of results is unknown, also include an indication that there may be more results than\n * the number listed. For example, \"25+ matches.\"\n *\n * The count text is only displayed when `query.tokens` isn't empty.\n * When the `countText` or `query` changes, it will be announced to assistive technologies.\n */\n countText?: string;\n\n /**\n * Set to `true` while the related collection is loading (e.g. during an async filtering action).\n * If set to `true`, the live announcement of countText by assistive technologies will be paused until it changes back to `false`.\n */\n loading?: boolean;\n\n /**\n * An object representing the current query displayed in the property filter, which has three properties: `operation`, `tokens`, and `tokenGroups`.\n * The `operation` property has two valid values: \"and\", \"or\", and controls the join operation to be applied between tokens when filtering the items.\n * The `tokens` property is an array of objects that will be displayed to the user beneath the filtering input. When `enableTokenGroups=true`, the\n * `tokenGroups` property is used instead, which supports nested tokens.\n *\n * Each token has the following properties:\n * * value [unknown]: The value of the token to be used as a filter. Can be null or string for default tokens, string[] for enum tokens, and anything for tokens with custom forms.\n * * propertyKey [string]: The key of the corresponding property in filteringProperties.\n * * operator ['<' | '<=' | '>' | '>=' | ':' | '!:' | '=' | '!=' | '^' | '!^']: The operator which indicates how to filter the dataset using this token.\n */\n query: PropertyFilterProps.Query;\n /**\n * If hideOperations it set, the indicator of the operation (that is, `and` or `or`) and the selection of operations\n * (applied to the property and value token) are hidden from the user. Only use when you have a custom\n * filtering logic which combines tokens in different way than the default one. When used, ensure that\n * operations are communicated to the user in another way.\n *\n * This property cannot be set when `enableTokenGroups=true`.\n */\n hideOperations?: boolean;\n /**\n * Activates token grouping mechanism to support token nesting (up to one level).\n * When `true`, the `query.tokens` property is ignored and `query.tokenGroups` is used instead.\n */\n enableTokenGroups?: boolean;\n /**\n * Fired when the `query` gets changed. Filter the dataset in response to this event using the values in the `detail` object.\n */\n onChange: NonCancelableEventHandler<PropertyFilterProps.Query>;\n /**\n * An array of properties by which the data set can be filtered. Each element has the following properties:\n *\n * * groupValuesLabel [string]: Localized string to display for the 'Values' group label for a specific property.\n * * key [string]: The identifier of this property.\n * * propertyLabel [string]: A human-readable string for the property.\n * * operators [Array]: A list of all operators supported by this property. If you omit the equals operator because your API does not support it, make sure to set `defaultOperator` to a supported operator from this list.\n * * group [string]: Optional identifier of a custom group that this filtering option is assigned to. Use to create additional groups below the default one. Make sure to also define labels for the group in the customGroupsText property. Notice that only one level of options nesting is supported.\n * * defaultOperator [ComparisonOperator]: Optional parameter that changes the default operator used with this filtering property. Use it only if your API does not support \"equals\" filtering terms with this property.\n */\n filteringProperties: ReadonlyArray<PropertyFilterProps.FilteringProperty>;\n /**\n * An array of possible values of the individual `filteringProperties`. Each element has the following properties:\n *\n * * `propertyKey` [string]: The key of the corresponding filtering property in the `filteringProperties` array.\n * * `value` [string]: The value that will be used as a suggestion when creating or modifying a filtering token.\n * * `label` [string]: Optional suggestion label to be matched instead of the value.\n *\n * Filtering options that require labels can only use `=` and `!=` operators. The token value must be labelled separately, for example:\n * ```\n * const filteringProperty = {\n * key: 'state',\n * propertyLabel: 'State',\n * operators: ['=', '!='].map(operator => ({ operator, format: getStateLabel }))\n * }\n * const filteringOptions = [\n * { propertyKey: 'state', value: 'STOPPED', label: getStateLabel('STOPPED') },\n * { propertyKey: 'state', value: 'STOPPING', label: getStateLabel('STOPPING') },\n * { propertyKey: 'state', value: 'RUNNING', label: getStateLabel('RUNNING') },\n * ]\n * ```\n */\n filteringOptions?: ReadonlyArray<PropertyFilterProps.FilteringOption>;\n /**\n * An array of objects that contain localized, human-readable strings for the labels of custom groups within the filtering dropdown. Use group property to associate the strings with your custom group of options. Define the following values for each group:\n *\n * * properties [string]: The group label in the filtering dropdown that contains the list of properties from this group. For example: Tags.\n * * values [string]: The group label in the filtering dropdown that contains the list of values from this group. For example: Tags values.\n * * group [string]: The identifier of a custom group.\n */\n customGroupsText?: PropertyFilterProps.GroupText[];\n /**\n * Set `disableFreeTextFiltering` only if you can’t filter the dataset using a filter that is applied to every column,\n * instead of a specific property. This would stop the user from creating such tokens.\n */\n disableFreeTextFiltering?: boolean;\n /**\n * An object configuring the operators for free text filtering, which has the following properties:\n *\n * * operators [Array]: A list of all operators supported for free text filtering. If you omit the contains operator because your API does not support it, make sure to set `defaultOperator` to a supported operator from this list.\n * * defaultOperator [ComparisonOperator]: An optional parameter that changes the default operator used for free text filtering. Use this parameter only if your API does not support \"contains\" free test filtering terms.\n */\n freeTextFiltering?: PropertyFilterProps.FreeTextFiltering;\n /**\n * Use this event to asynchronously load filteringOptions, component currently needs. The detail object contains following properties:\n *\n * * `filteringProperty` - The property for which you need to fetch the options.\n * * `filteringOperator` - The operator for which you need to fetch the options.\n * * `filteringText` - The value that you need to use to fetch options.\n * * `firstPage` - Indicates that you should fetch the first page of options for a `filteringProperty` that match the `filteringText`.\n * * `samePage` - Indicates that you should fetch the same page that you have previously fetched (for example, when the user clicks on the recovery button).\n */\n onLoadItems?: NonCancelableEventHandler<PropertyFilterProps.LoadItemsDetail>;\n /**\n * If you have more than 500 `filteringOptions`, enable this flag to apply a performance optimization that makes\n * the filtering experience smoother. We don't recommend enabling the feature if you have less than 500 options,\n * because the improvements to performance are offset by a visible scrolling lag. When you set this flag to true,\n * it removes options that are not currently in view from the DOM.\n */\n virtualScroll?: boolean;\n /**\n * A slot located before the filtering input. Use it if for a Select component if your dataset supports property\n * filter queries only after an initial filter is applied.\n */\n customControl?: React.ReactNode;\n /**\n * A slot that replaces the standard \"Clear filter\" button.\n * When using this slot, make sure to still provide a mechanism to clear all filters.\n */\n customFilterActions?: React.ReactNode;\n /**\n * Set `asyncProperties` if you need to load `filteringProperties` asynchronously. This would cause extra `onLoadMore`\n * events to fire calling for more properties.\n */\n asyncProperties?: boolean;\n /**\n * Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.\n */\n tokenLimit?: number;\n /**\n * The label that will be passed down to the Autosuggest `ariaLabel` property.\n * See the [Autosuggest API](/components/autosuggest/?tabId=api) page for more details.\n */\n filteringAriaLabel?: string;\n /**\n * Placeholder for the filtering input.\n */\n filteringPlaceholder?: string;\n /**\n * Displayed when there are no options to display.\n * This is only shown when `statusType` is set to `finished` or not set at all.\n */\n filteringEmpty?: React.ReactNode;\n /**\n * Specifies the text to display when in the loading state.\n **/\n filteringLoadingText?: string;\n /**\n * Specifies the text to display at the bottom of the dropdown menu after pagination has reached the end.\n **/\n filteringFinishedText?: string;\n /**\n * Specifies the text to display when a data fetching error occurs. Make sure that you provide `recoveryText`.\n **/\n filteringErrorText?: string;\n /**\n * Specifies the text for the recovery button. The text is displayed next to the error text.\n * Use the `onLoadItems` event to perform a recovery action (for example, retrying the request).\n **/\n filteringRecoveryText?: string;\n /**\n * Constraint text that's displayed below the filtering input.\n * Use this to provide additional information about supported filters.\n */\n filteringConstraintText?: React.ReactNode;\n /**\n * Specifies the current status of loading more options.\n * * `pending` - Indicates that no request in progress, but more options may be loaded.\n * * `loading` - Indicates that data fetching is in progress.\n * * `finished` - Indicates that pagination has finished and no more requests are expected.\n * * `error` - Indicates that an error occurred during fetch. You should use `recoveryText` to enable the user to recover.\n **/\n filteringStatusType?: DropdownStatusProps.StatusType;\n\n /**\n * Adds an aria-label to the \"Show fewer\" button for the token group control.\n * Use to assign unique labels when there are multiple token groups with the same `tokenLimitShowFewer` label on one page.\n */\n tokenLimitShowFewerAriaLabel?: string;\n /**\n * Adds an aria-label to the \"Show more\" button for the token group control.\n * Use to assign unique labels when there are multiple token groups with the same `tokenLimitShowMore` label on one page.\n */\n tokenLimitShowMoreAriaLabel?: string;\n}\n\nexport namespace PropertyFilterProps {\n export type Token = PropertyFilterToken;\n export type TokenGroup = PropertyFilterTokenGroup;\n export type JoinOperation = PropertyFilterOperation;\n export type ComparisonOperator = PropertyFilterOperator;\n export type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\n export type ExtendedOperatorFormProps<TokenValue> = PropertyFilterOperatorFormProps<TokenValue>;\n export type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\n export type ExtendedOperatorFormat<TokenValue> = PropertyFilterOperatorFormat<TokenValue>;\n export type FilteringOption = PropertyFilterOption;\n export type FilteringProperty = PropertyFilterProperty;\n export type FreeTextFiltering = PropertyFilterFreeTextFiltering;\n export type Query = PropertyFilterQuery;\n\n export interface LoadItemsDetail {\n filteringProperty?: FilteringProperty;\n filteringOperator?: ComparisonOperator;\n filteringText: string;\n firstPage: boolean;\n samePage: boolean;\n }\n\n export interface I18nStrings {\n /**\n * @deprecated Use `filteringAriaLabel` on the component instead.\n */\n filteringAriaLabel?: string;\n\n /**\n * @deprecated Use `filteringPlaceholder` on the component instead.\n */\n filteringPlaceholder?: string;\n\n dismissAriaLabel?: string;\n clearAriaLabel?: string;\n groupValuesText?: string;\n groupPropertiesText?: string;\n operatorsText?: string;\n\n operationAndText?: string;\n operationOrText?: string;\n\n operatorLessText?: string;\n operatorLessOrEqualText?: string;\n operatorGreaterText?: string;\n operatorGreaterOrEqualText?: string;\n operatorContainsText?: string;\n operatorDoesNotContainText?: string;\n operatorEqualsText?: string;\n operatorDoesNotEqualText?: string;\n operatorStartsWithText?: string;\n operatorDoesNotStartWithText?: string;\n\n editTokenHeader?: string;\n propertyText?: string;\n operatorText?: string;\n valueText?: string;\n cancelActionText?: string;\n applyActionText?: string;\n allPropertiesLabel?: string;\n\n formatToken?: (token: FormattedToken) => string;\n\n tokenLimitShowMore?: string;\n tokenLimitShowFewer?: string;\n clearFiltersText?: string;\n tokenOperatorAriaLabel?: string;\n removeTokenButtonAriaLabel?: (token: FormattedToken) => string;\n enteredTextLabel?: AutosuggestProps.EnteredTextLabel;\n\n groupEditAriaLabel?: (group: FormattedTokenGroup) => string;\n tokenEditorTokenActionsAriaLabel?: (token: FormattedToken) => string;\n tokenEditorTokenRemoveAriaLabel?: (token: FormattedToken) => string;\n tokenEditorTokenRemoveLabel?: string;\n tokenEditorTokenRemoveFromGroupLabel?: string;\n tokenEditorAddNewTokenLabel?: string;\n tokenEditorAddTokenActionsAriaLabel?: string;\n tokenEditorAddExistingTokenAriaLabel?: (token: FormattedToken) => string;\n tokenEditorAddExistingTokenLabel?: (token: FormattedToken) => string;\n }\n\n export interface FormattedToken {\n propertyKey?: string;\n propertyLabel: string;\n operator: ComparisonOperator;\n value: string;\n }\n\n export interface FormattedTokenGroup {\n tokens: FormattedToken[];\n operation: string;\n operationLabel: string;\n }\n\n export interface GroupText {\n properties: string;\n values: string;\n group: string;\n }\n\n export interface FilteringChangeDetail {\n filteringText: string;\n filteringProperty?: FilteringProperty;\n }\n\n export interface Ref {\n /**\n * Sets focus on the underlying input control.\n */\n focus(): void;\n }\n}\n\n// Re-exported namespace interfaces to use module-style imports internally\n\nexport type Token = PropertyFilterProps.Token;\nexport type TokenGroup = PropertyFilterProps.TokenGroup;\nexport type JoinOperation = PropertyFilterProps.JoinOperation;\nexport type ComparisonOperator = PropertyFilterProps.ComparisonOperator;\nexport type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\nexport type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\nexport type FilteringOption = PropertyFilterProps.FilteringOption;\nexport type FilteringProperty = PropertyFilterProps.FilteringProperty;\nexport type Query = PropertyFilterProps.Query;\nexport type LoadItemsDetail = PropertyFilterProps.LoadItemsDetail;\nexport type I18nStrings = PropertyFilterProps.I18nStrings;\nexport type GroupText = PropertyFilterProps.GroupText;\nexport type FormattedToken = PropertyFilterProps.FormattedToken;\nexport type Ref = PropertyFilterProps.Ref;\n\n// Utility types\n\nexport interface InternalFilteringProperty<TokenValue = any> {\n propertyKey: string;\n propertyLabel: string;\n groupValuesLabel: string;\n propertyGroup?: string;\n operators: readonly PropertyFilterOperator[];\n defaultOperator: PropertyFilterOperator;\n getTokenType: (operator?: PropertyFilterOperator) => PropertyFilterTokenType;\n getValueFormatter: (operator?: PropertyFilterOperator) => null | ((value: any) => string);\n getValueFormRenderer: (operator?: PropertyFilterOperator) => null | PropertyFilterOperatorForm<TokenValue>;\n // Original property used in callbacks.\n externalProperty: PropertyFilterProperty;\n}\n\nexport interface InternalFilteringOption {\n property: null | InternalFilteringProperty;\n value: string;\n label: string;\n}\n\nexport interface InternalFreeTextFiltering {\n disabled: boolean;\n operators: readonly PropertyFilterOperator[];\n defaultOperator: PropertyFilterOperator;\n}\n\nexport interface InternalToken<TokenValue = any> {\n standaloneIndex?: number;\n property: null | InternalFilteringProperty<TokenValue>;\n operator: PropertyFilterOperator;\n value: TokenValue;\n}\n\nexport interface InternalTokenGroup<TokenValue = any> {\n operation: PropertyFilterOperation;\n tokens: readonly (InternalToken<TokenValue> | InternalTokenGroup<TokenValue>)[];\n}\n\nexport type InternalQuery = InternalTokenGroup;\n\nexport type ParsedText =\n | { step: 'property'; property: InternalFilteringProperty; operator: ComparisonOperator; value: string }\n | { step: 'operator'; property: InternalFilteringProperty; operatorPrefix: string }\n | { step: 'free-text'; operator?: ComparisonOperator; value: string };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/property-filter/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAgD,MAAM,OAAO,CAAC;AAWrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAWlF,OAAO,EAWL,mBAAmB,EAIpB,MAAM,cAAc,CAAC;AAgBtB,QAAA,MAAM,sBAAsB;;;;;;mFAia3B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/property-filter/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAgD,MAAM,OAAO,CAAC;AAWrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAalF,OAAO,EAWL,mBAAmB,EAIpB,MAAM,cAAc,CAAC;AAgBtB,QAAA,MAAM,sBAAsB;;;;;;mFA8a3B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -14,6 +14,7 @@ import { useUniqueId } from '../internal/hooks/use-unique-id/index';
14
14
  import { joinStrings } from '../internal/utils/strings';
15
15
  import InternalSpaceBetween from '../space-between/internal';
16
16
  import { SearchResults } from '../text-filter/search-results';
17
+ import useDebounceSearchResultCallback from '../text-filter/use-debounce-search-result-callback';
17
18
  import { getAllowedOperators, getAutosuggestOptions, getQueryActions, parseText } from './controller';
18
19
  import { usePropertyFilterI18n } from './i18n-utils';
19
20
  import { PropertyEditorContentCustom, PropertyEditorContentEnum, PropertyEditorFooter } from './property-editor';
@@ -25,7 +26,7 @@ import analyticsSelectors from './analytics-metadata/styles.css.js';
25
26
  import styles from './styles.css.js';
26
27
  const PropertyFilterInternal = React.forwardRef((_a, ref) => {
27
28
  var _b;
28
- var { disabled, countText, query, hideOperations, onChange, filteringProperties, filteringOptions, customGroupsText, disableFreeTextFiltering, freeTextFiltering, onLoadItems, virtualScroll, customControl, customFilterActions, filteringPlaceholder, filteringAriaLabel, filteringEmpty, filteringLoadingText, filteringFinishedText, filteringErrorText, filteringRecoveryText, filteringConstraintText, filteringStatusType, asyncProperties, tokenLimit, expandToViewport, tokenLimitShowFewerAriaLabel, tokenLimitShowMoreAriaLabel, enableTokenGroups, __internalRootRef } = _a, rest = __rest(_a, ["disabled", "countText", "query", "hideOperations", "onChange", "filteringProperties", "filteringOptions", "customGroupsText", "disableFreeTextFiltering", "freeTextFiltering", "onLoadItems", "virtualScroll", "customControl", "customFilterActions", "filteringPlaceholder", "filteringAriaLabel", "filteringEmpty", "filteringLoadingText", "filteringFinishedText", "filteringErrorText", "filteringRecoveryText", "filteringConstraintText", "filteringStatusType", "asyncProperties", "tokenLimit", "expandToViewport", "tokenLimitShowFewerAriaLabel", "tokenLimitShowMoreAriaLabel", "enableTokenGroups", "__internalRootRef"]);
29
+ var { disabled, countText, query, hideOperations, onChange, filteringProperties, filteringOptions, customGroupsText, disableFreeTextFiltering, freeTextFiltering, onLoadItems, virtualScroll, customControl, customFilterActions, filteringPlaceholder, filteringAriaLabel, filteringEmpty, filteringLoadingText, filteringFinishedText, filteringErrorText, filteringRecoveryText, filteringConstraintText, filteringStatusType, asyncProperties, tokenLimit, expandToViewport, tokenLimitShowFewerAriaLabel, tokenLimitShowMoreAriaLabel, enableTokenGroups, loading = false, __internalRootRef } = _a, rest = __rest(_a, ["disabled", "countText", "query", "hideOperations", "onChange", "filteringProperties", "filteringOptions", "customGroupsText", "disableFreeTextFiltering", "freeTextFiltering", "onLoadItems", "virtualScroll", "customControl", "customFilterActions", "filteringPlaceholder", "filteringAriaLabel", "filteringEmpty", "filteringLoadingText", "filteringFinishedText", "filteringErrorText", "filteringRecoveryText", "filteringConstraintText", "filteringStatusType", "asyncProperties", "tokenLimit", "expandToViewport", "tokenLimitShowFewerAriaLabel", "tokenLimitShowMoreAriaLabel", "enableTokenGroups", "loading", "__internalRootRef"]);
29
30
  const [nextFocusIndex, setNextFocusIndex] = useState(null);
30
31
  const tokenListRef = useListFocusController({
31
32
  nextFocusIndex,
@@ -45,6 +46,7 @@ const PropertyFilterInternal = React.forwardRef((_a, ref) => {
45
46
  });
46
47
  const mergedRef = useMergeRefs(tokenListRef, __internalRootRef);
47
48
  const inputRef = useRef(null);
49
+ const searchResultsRef = useRef(null);
48
50
  const baseProps = getBaseProps(rest);
49
51
  const i18nStrings = usePropertyFilterI18n(rest.i18nStrings);
50
52
  useImperativeHandle(ref, () => ({ focus: () => { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } }), []);
@@ -196,6 +198,15 @@ const PropertyFilterInternal = React.forwardRef((_a, ref) => {
196
198
  }
197
199
  fireNonCancelableEvent(onLoadItems, Object.assign(Object.assign({}, loadMoreDetail), { firstPage: true, samePage: false }));
198
200
  };
201
+ useDebounceSearchResultCallback({
202
+ searchQuery: query,
203
+ countText,
204
+ loading,
205
+ announceCallback: () => {
206
+ var _a;
207
+ (_a = searchResultsRef.current) === null || _a === void 0 ? void 0 : _a.reannounce();
208
+ },
209
+ });
199
210
  const propertyStep = parsedText.step === 'property' ? parsedText : null;
200
211
  const customValueKey = propertyStep ? propertyStep.property.propertyKey + ':' + propertyStep.operator : '';
201
212
  const [customFormValueRecord, setCustomFormValueRecord] = useState({});
@@ -231,7 +242,7 @@ const PropertyFilterInternal = React.forwardRef((_a, ref) => {
231
242
  }
232
243
  : undefined, onCloseDropdown: () => setCustomFormValueRecord({}), hideEnteredTextOption: internalFreeText.disabled && parsedText.step !== 'property', clearAriaLabel: i18nStrings.clearAriaLabel, searchResultsId: showResults ? searchResultsId : undefined })),
233
244
  showResults ? (React.createElement("div", { className: styles.results },
234
- React.createElement(SearchResults, { id: searchResultsId }, countText))) : null)),
245
+ React.createElement(SearchResults, { id: searchResultsId, renderLiveRegion: !loading, ref: searchResultsRef }, countText))) : null)),
235
246
  filteringConstraintText && (React.createElement("div", { id: constraintTextId, className: styles.constraint }, filteringConstraintText)),
236
247
  internalQuery.tokens && internalQuery.tokens.length > 0 && (React.createElement("div", { className: styles.tokens },
237
248
  React.createElement(InternalSpaceBetween, { size: "xs", direction: "horizontal" },
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/property-filter/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;A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AgB,EAClC,iBAAiB,EAAE,iBAAiB,GACpC,CACH,EACD,WAAW,EAAE;wBACX,cAAc,EAAE,WAAW,CAAC,mBAAmB;wBAC/C,aAAa,EAAE,WAAW,CAAC,kBAAkB;qBAC9C,EACD,KAAK,EACH,mBAAmB,CAAC,CAAC,CAAC,CACpB,6BAAK,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,IAAG,mBAAmB,CAAO,CAC7E,CAAC,CAAC,CAAC,CACF,8CACM,6BAA6B,CAAC;wBAChC,MAAM,EAAE,cAAc;qBAC0C,CAAC;wBAEnE,oBAAC,cAAc,IACb,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,GAAG,EAAE;;gCACZ,eAAe,EAAE,CAAC;gCAClB,MAAA,QAAQ,CAAC,OAAO,0CAAE,KAAK,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;4BACrD,CAAC,EACD,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,EAC/B,QAAQ,EAAE,QAAQ,IAEjB,WAAW,CAAC,gBAAgB,CACd,CACZ,CACR,GAEH,CACmB,CACnB,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useImperativeHandle, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { PropertyFilterOperator } from '@cloudscape-design/collection-hooks';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport TokenList from '../internal/components/token-list';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useListFocusController } from '../internal/hooks/use-list-focus-controller';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id/index';\nimport { SomeRequired } from '../internal/types';\nimport { joinStrings } from '../internal/utils/strings';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { SearchResults } from '../text-filter/search-results';\nimport { GeneratedAnalyticsMetadataPropertyFilterClearFilters } from './analytics-metadata/interfaces';\nimport { getAllowedOperators, getAutosuggestOptions, getQueryActions, parseText } from './controller';\nimport { usePropertyFilterI18n } from './i18n-utils';\nimport {\n ComparisonOperator,\n ExtendedOperator,\n FilteringProperty,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\n InternalQuery,\n InternalToken,\n InternalTokenGroup,\n ParsedText,\n PropertyFilterProps,\n Ref,\n Token,\n TokenGroup,\n} from './interfaces';\nimport { PropertyEditorContentCustom, PropertyEditorContentEnum, PropertyEditorFooter } from './property-editor';\nimport PropertyFilterAutosuggest, { PropertyFilterAutosuggestProps } from './property-filter-autosuggest';\nimport { TokenButton } from './token';\nimport { useLoadItems } from './use-load-items';\n\nimport tokenListStyles from '../internal/components/token-list/styles.css.js';\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\ntype PropertyFilterInternalProps = SomeRequired<\n PropertyFilterProps,\n 'filteringOptions' | 'customGroupsText' | 'enableTokenGroups' | 'disableFreeTextFiltering' | 'hideOperations'\n> &\n InternalBaseComponentProps;\n\nconst PropertyFilterInternal = React.forwardRef(\n (\n {\n disabled,\n countText,\n query,\n hideOperations,\n onChange,\n filteringProperties,\n filteringOptions,\n customGroupsText,\n disableFreeTextFiltering,\n freeTextFiltering,\n onLoadItems,\n virtualScroll,\n customControl,\n customFilterActions,\n filteringPlaceholder,\n filteringAriaLabel,\n filteringEmpty,\n filteringLoadingText,\n filteringFinishedText,\n filteringErrorText,\n filteringRecoveryText,\n filteringConstraintText,\n filteringStatusType,\n asyncProperties,\n tokenLimit,\n expandToViewport,\n tokenLimitShowFewerAriaLabel,\n tokenLimitShowMoreAriaLabel,\n enableTokenGroups,\n __internalRootRef,\n ...rest\n }: PropertyFilterInternalProps,\n ref: React.Ref<Ref>\n ) => {\n const [nextFocusIndex, setNextFocusIndex] = useState<null | number>(null);\n const tokenListRef = useListFocusController({\n nextFocusIndex,\n onFocusMoved: (target, targetType) => {\n if (targetType === 'fallback') {\n inputRef.current?.focus({ preventDropdown: true });\n } else {\n target.focus();\n }\n setNextFocusIndex(null);\n },\n listItemSelector: `.${tokenListStyles['list-item']}`,\n showMoreSelector: `.${tokenListStyles.toggle}`,\n fallbackSelector: `.${styles.input}`,\n });\n\n const mergedRef = useMergeRefs(tokenListRef, __internalRootRef);\n const inputRef = useRef<AutosuggestInputRef>(null);\n const baseProps = getBaseProps(rest);\n\n const i18nStrings = usePropertyFilterI18n(rest.i18nStrings);\n\n useImperativeHandle(ref, () => ({ focus: () => inputRef.current?.focus() }), []);\n const [filteringText, setFilteringText] = useState<string>('');\n\n const { internalProperties, internalOptions, internalQuery, internalFreeText } = (() => {\n const propertyByKey = filteringProperties.reduce((acc, property) => {\n const extendedOperators = (property?.operators ?? []).reduce(\n (acc, operator) => (typeof operator === 'object' ? acc.set(operator.operator, operator) : acc),\n new Map<PropertyFilterOperator, null | ExtendedOperator<any>>()\n );\n acc.set(property.key, {\n propertyKey: property.key,\n propertyLabel: property?.propertyLabel ?? '',\n groupValuesLabel: property?.groupValuesLabel ?? '',\n propertyGroup: property?.group,\n operators: (property?.operators ?? []).map(op => (typeof op === 'string' ? op : op.operator)),\n defaultOperator: property?.defaultOperator ?? '=',\n getTokenType: operator => (operator ? extendedOperators.get(operator)?.tokenType ?? 'value' : 'value'),\n getValueFormatter: operator => (operator ? extendedOperators.get(operator)?.format ?? null : null),\n getValueFormRenderer: operator => (operator ? extendedOperators.get(operator)?.form ?? null : null),\n externalProperty: property,\n });\n return acc;\n }, new Map<string, InternalFilteringProperty>());\n const getProperty = (propertyKey: string): null | InternalFilteringProperty =>\n propertyByKey.get(propertyKey) ?? null;\n\n const internalOptions: readonly InternalFilteringOption[] = filteringOptions.map(option => ({\n property: getProperty(option.propertyKey),\n value: option.value,\n label: option.label ?? option.value ?? '',\n }));\n\n function transformToken(\n tokenOrGroup: Token | TokenGroup,\n standaloneIndex?: number\n ): InternalToken | InternalTokenGroup {\n return 'operation' in tokenOrGroup\n ? {\n operation: tokenOrGroup.operation,\n tokens: tokenOrGroup.tokens.map(token => transformToken(token)),\n }\n : {\n standaloneIndex,\n property: tokenOrGroup.propertyKey ? getProperty(tokenOrGroup.propertyKey) : null,\n operator: tokenOrGroup.operator,\n value: tokenOrGroup.value,\n };\n }\n\n const internalQuery: InternalQuery = {\n operation: query.operation,\n tokens: (enableTokenGroups && query.tokenGroups ? query.tokenGroups : query.tokens).map(transformToken),\n };\n\n const internalFreeText: InternalFreeTextFiltering = {\n disabled: disableFreeTextFiltering,\n operators: freeTextFiltering?.operators ?? [':', '!:'],\n defaultOperator: freeTextFiltering?.defaultOperator ?? ':',\n };\n\n return { internalProperties: [...propertyByKey.values()], internalOptions, internalQuery, internalFreeText };\n })();\n\n const { addToken, updateToken, updateOperation, removeToken, removeAllTokens } = getQueryActions({\n query: internalQuery,\n filteringOptions: internalOptions,\n onChange,\n enableTokenGroups,\n });\n\n const parsedText = parseText(filteringText, internalProperties, internalFreeText);\n const autosuggestOptions = getAutosuggestOptions(\n parsedText,\n internalProperties,\n internalOptions,\n customGroupsText,\n i18nStrings\n );\n\n const createToken = (currentText: string) => {\n const parsedText = parseText(currentText, internalProperties, internalFreeText);\n let newToken: InternalToken;\n switch (parsedText.step) {\n case 'property': {\n newToken = {\n property: parsedText.property,\n operator: parsedText.operator,\n value: parsedText.value,\n };\n break;\n }\n case 'free-text': {\n newToken = {\n property: null,\n operator: parsedText.operator || internalFreeText.defaultOperator,\n value: parsedText.value,\n };\n break;\n }\n case 'operator': {\n newToken = {\n property: null,\n operator: internalFreeText.defaultOperator,\n value: currentText,\n };\n break;\n }\n }\n if (internalFreeText.disabled && !newToken.property) {\n return;\n }\n addToken(newToken);\n setFilteringText('');\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.externalProperty;\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 const { detail: option } = event;\n const value = option.value || '';\n if (!value) {\n return;\n }\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, internalProperties, internalFreeText);\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.externalProperty ?? undefined;\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\n const propertyStep = parsedText.step === 'property' ? parsedText : null;\n const customValueKey = propertyStep ? propertyStep.property.propertyKey + ':' + propertyStep.operator : '';\n const [customFormValueRecord, setCustomFormValueRecord] = useState<Record<string, any>>({});\n const customFormValue = customValueKey in customFormValueRecord ? customFormValueRecord[customValueKey] : null;\n const setCustomFormValue = (value: null | any) => setCustomFormValueRecord({ [customValueKey]: value });\n const operatorForm = propertyStep && propertyStep.property.getValueFormRenderer(propertyStep.operator);\n const isEnumValue = propertyStep?.property.getTokenType(propertyStep.operator) === 'enum';\n\n const searchResultsId = useUniqueId('property-filter-search-results');\n const constraintTextId = useUniqueId('property-filter-constraint');\n const textboxAriaDescribedBy = filteringConstraintText\n ? joinStrings(rest.ariaDescribedby, constraintTextId)\n : rest.ariaDescribedby;\n\n const showResults = !!internalQuery.tokens?.length && !disabled && !!countText;\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef}>\n <div className={clsx(styles['search-field'], analyticsSelectors['search-field'])}>\n {customControl && <div className={styles['custom-control']}>{customControl}</div>}\n <div className={styles['input-wrapper']}>\n <PropertyFilterAutosuggest\n ref={inputRef}\n virtualScroll={virtualScroll}\n enteredTextLabel={i18nStrings.enteredTextLabel}\n ariaLabel={filteringAriaLabel ?? i18nStrings.filteringAriaLabel}\n placeholder={filteringPlaceholder ?? i18nStrings.filteringPlaceholder}\n ariaLabelledby={rest.ariaLabelledby}\n ariaDescribedby={textboxAriaDescribedBy}\n controlId={rest.controlId}\n value={filteringText}\n disabled={disabled}\n {...autosuggestOptions}\n onChange={event => setFilteringText(event.detail.value)}\n empty={filteringEmpty}\n {...asyncAutosuggestProps}\n expandToViewport={expandToViewport}\n onOptionClick={handleSelected}\n customForm={\n operatorForm || isEnumValue\n ? {\n content: operatorForm ? (\n <PropertyEditorContentCustom\n key={customValueKey}\n property={propertyStep.property}\n operator={propertyStep.operator}\n filter={propertyStep.value}\n operatorForm={operatorForm}\n value={customFormValue}\n onChange={setCustomFormValue}\n />\n ) : (\n <PropertyEditorContentEnum\n key={customValueKey}\n property={propertyStep.property}\n filter={propertyStep.value}\n value={customFormValue}\n onChange={setCustomFormValue}\n asyncProps={asyncProps}\n filteringOptions={internalOptions}\n onLoadItems={inputLoadItemsHandlers.onLoadItems}\n />\n ),\n footer: (\n <PropertyEditorFooter\n key={customValueKey}\n property={propertyStep.property}\n operator={propertyStep.operator}\n value={customFormValue}\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 : undefined\n }\n onCloseDropdown={() => setCustomFormValueRecord({})}\n hideEnteredTextOption={internalFreeText.disabled && parsedText.step !== 'property'}\n clearAriaLabel={i18nStrings.clearAriaLabel}\n searchResultsId={showResults ? searchResultsId : undefined}\n />\n {showResults ? (\n <div className={styles.results}>\n <SearchResults id={searchResultsId}>{countText}</SearchResults>\n </div>\n ) : null}\n </div>\n </div>\n {filteringConstraintText && (\n <div id={constraintTextId} className={styles.constraint}>\n {filteringConstraintText}\n </div>\n )}\n {internalQuery.tokens && internalQuery.tokens.length > 0 && (\n <div className={styles.tokens}>\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\">\n <TokenList\n alignment=\"inline\"\n limit={tokenLimit}\n items={internalQuery.tokens}\n limitShowFewerAriaLabel={tokenLimitShowFewerAriaLabel}\n limitShowMoreAriaLabel={tokenLimitShowMoreAriaLabel}\n renderItem={(_, tokenIndex) => (\n <TokenButton\n query={internalQuery}\n tokenIndex={tokenIndex}\n onUpdateToken={(token, releasedTokens) => {\n updateToken(tokenIndex, token, releasedTokens);\n }}\n onUpdateOperation={updateOperation}\n onRemoveToken={() => {\n removeToken(tokenIndex);\n setNextFocusIndex(tokenIndex);\n }}\n filteringProperties={internalProperties}\n filteringOptions={internalOptions}\n asyncProps={asyncProps}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n asyncProperties={asyncProperties}\n hideOperations={hideOperations}\n customGroupsText={customGroupsText}\n freeTextFiltering={internalFreeText}\n disabled={disabled}\n expandToViewport={expandToViewport}\n enableTokenGroups={enableTokenGroups}\n />\n )}\n i18nStrings={{\n limitShowFewer: i18nStrings.tokenLimitShowFewer,\n limitShowMore: i18nStrings.tokenLimitShowMore,\n }}\n after={\n customFilterActions ? (\n <div className={styles['custom-filter-actions']}>{customFilterActions}</div>\n ) : (\n <span\n {...getAnalyticsMetadataAttribute({\n action: 'clearFilters',\n } as Partial<GeneratedAnalyticsMetadataPropertyFilterClearFilters>)}\n >\n <InternalButton\n formAction=\"none\"\n onClick={() => {\n removeAllTokens();\n inputRef.current?.focus({ preventDropdown: true });\n }}\n className={styles['remove-all']}\n disabled={disabled}\n >\n {i18nStrings.clearFiltersText}\n </InternalButton>\n </span>\n )\n }\n />\n </InternalSpaceBetween>\n </div>\n )}\n </div>\n );\n }\n);\n\nexport default PropertyFilterInternal;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/property-filter/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAA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,UAAU,CAAC,CAAC;wBAChC,CAAC,EACD,mBAAmB,EAAE,kBAAkB,EACvC,gBAAgB,EAAE,eAAe,EACjC,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,gBAAgB,EACnC,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,iBAAiB,GACpC,CACH,EACD,WAAW,EAAE;wBACX,cAAc,EAAE,WAAW,CAAC,mBAAmB;wBAC/C,aAAa,EAAE,WAAW,CAAC,kBAAkB;qBAC9C,EACD,KAAK,EACH,mBAAmB,CAAC,CAAC,CAAC,CACpB,6BAAK,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,IAAG,mBAAmB,CAAO,CAC7E,CAAC,CAAC,CAAC,CACF,8CACM,6BAA6B,CAAC;wBAChC,MAAM,EAAE,cAAc;qBAC0C,CAAC;wBAEnE,oBAAC,cAAc,IACb,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,GAAG,EAAE;;gCACZ,eAAe,EAAE,CAAC;gCAClB,MAAA,QAAQ,CAAC,OAAO,0CAAE,KAAK,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;4BACrD,CAAC,EACD,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,EAC/B,QAAQ,EAAE,QAAQ,IAEjB,WAAW,CAAC,gBAAgB,CACd,CACZ,CACR,GAEH,CACmB,CACnB,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useImperativeHandle, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { PropertyFilterOperator } from '@cloudscape-design/collection-hooks';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport TokenList from '../internal/components/token-list';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useListFocusController } from '../internal/hooks/use-list-focus-controller';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id/index';\nimport { SomeRequired } from '../internal/types';\nimport { joinStrings } from '../internal/utils/strings';\nimport { InternalLiveRegionRef } from '../live-region/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { SearchResults } from '../text-filter/search-results';\nimport useDebounceSearchResultCallback from '../text-filter/use-debounce-search-result-callback';\nimport { GeneratedAnalyticsMetadataPropertyFilterClearFilters } from './analytics-metadata/interfaces';\nimport { getAllowedOperators, getAutosuggestOptions, getQueryActions, parseText } from './controller';\nimport { usePropertyFilterI18n } from './i18n-utils';\nimport {\n ComparisonOperator,\n ExtendedOperator,\n FilteringProperty,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\n InternalQuery,\n InternalToken,\n InternalTokenGroup,\n ParsedText,\n PropertyFilterProps,\n Ref,\n Token,\n TokenGroup,\n} from './interfaces';\nimport { PropertyEditorContentCustom, PropertyEditorContentEnum, PropertyEditorFooter } from './property-editor';\nimport PropertyFilterAutosuggest, { PropertyFilterAutosuggestProps } from './property-filter-autosuggest';\nimport { TokenButton } from './token';\nimport { useLoadItems } from './use-load-items';\n\nimport tokenListStyles from '../internal/components/token-list/styles.css.js';\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\ntype PropertyFilterInternalProps = SomeRequired<\n PropertyFilterProps,\n 'filteringOptions' | 'customGroupsText' | 'enableTokenGroups' | 'disableFreeTextFiltering' | 'hideOperations'\n> &\n InternalBaseComponentProps;\n\nconst PropertyFilterInternal = React.forwardRef(\n (\n {\n disabled,\n countText,\n query,\n hideOperations,\n onChange,\n filteringProperties,\n filteringOptions,\n customGroupsText,\n disableFreeTextFiltering,\n freeTextFiltering,\n onLoadItems,\n virtualScroll,\n customControl,\n customFilterActions,\n filteringPlaceholder,\n filteringAriaLabel,\n filteringEmpty,\n filteringLoadingText,\n filteringFinishedText,\n filteringErrorText,\n filteringRecoveryText,\n filteringConstraintText,\n filteringStatusType,\n asyncProperties,\n tokenLimit,\n expandToViewport,\n tokenLimitShowFewerAriaLabel,\n tokenLimitShowMoreAriaLabel,\n enableTokenGroups,\n loading = false,\n __internalRootRef,\n ...rest\n }: PropertyFilterInternalProps,\n ref: React.Ref<Ref>\n ) => {\n const [nextFocusIndex, setNextFocusIndex] = useState<null | number>(null);\n const tokenListRef = useListFocusController({\n nextFocusIndex,\n onFocusMoved: (target, targetType) => {\n if (targetType === 'fallback') {\n inputRef.current?.focus({ preventDropdown: true });\n } else {\n target.focus();\n }\n setNextFocusIndex(null);\n },\n listItemSelector: `.${tokenListStyles['list-item']}`,\n showMoreSelector: `.${tokenListStyles.toggle}`,\n fallbackSelector: `.${styles.input}`,\n });\n\n const mergedRef = useMergeRefs(tokenListRef, __internalRootRef);\n const inputRef = useRef<AutosuggestInputRef>(null);\n const searchResultsRef = useRef<InternalLiveRegionRef>(null);\n const baseProps = getBaseProps(rest);\n\n const i18nStrings = usePropertyFilterI18n(rest.i18nStrings);\n\n useImperativeHandle(ref, () => ({ focus: () => inputRef.current?.focus() }), []);\n const [filteringText, setFilteringText] = useState<string>('');\n\n const { internalProperties, internalOptions, internalQuery, internalFreeText } = (() => {\n const propertyByKey = filteringProperties.reduce((acc, property) => {\n const extendedOperators = (property?.operators ?? []).reduce(\n (acc, operator) => (typeof operator === 'object' ? acc.set(operator.operator, operator) : acc),\n new Map<PropertyFilterOperator, null | ExtendedOperator<any>>()\n );\n acc.set(property.key, {\n propertyKey: property.key,\n propertyLabel: property?.propertyLabel ?? '',\n groupValuesLabel: property?.groupValuesLabel ?? '',\n propertyGroup: property?.group,\n operators: (property?.operators ?? []).map(op => (typeof op === 'string' ? op : op.operator)),\n defaultOperator: property?.defaultOperator ?? '=',\n getTokenType: operator => (operator ? extendedOperators.get(operator)?.tokenType ?? 'value' : 'value'),\n getValueFormatter: operator => (operator ? extendedOperators.get(operator)?.format ?? null : null),\n getValueFormRenderer: operator => (operator ? extendedOperators.get(operator)?.form ?? null : null),\n externalProperty: property,\n });\n return acc;\n }, new Map<string, InternalFilteringProperty>());\n const getProperty = (propertyKey: string): null | InternalFilteringProperty =>\n propertyByKey.get(propertyKey) ?? null;\n\n const internalOptions: readonly InternalFilteringOption[] = filteringOptions.map(option => ({\n property: getProperty(option.propertyKey),\n value: option.value,\n label: option.label ?? option.value ?? '',\n }));\n\n function transformToken(\n tokenOrGroup: Token | TokenGroup,\n standaloneIndex?: number\n ): InternalToken | InternalTokenGroup {\n return 'operation' in tokenOrGroup\n ? {\n operation: tokenOrGroup.operation,\n tokens: tokenOrGroup.tokens.map(token => transformToken(token)),\n }\n : {\n standaloneIndex,\n property: tokenOrGroup.propertyKey ? getProperty(tokenOrGroup.propertyKey) : null,\n operator: tokenOrGroup.operator,\n value: tokenOrGroup.value,\n };\n }\n\n const internalQuery: InternalQuery = {\n operation: query.operation,\n tokens: (enableTokenGroups && query.tokenGroups ? query.tokenGroups : query.tokens).map(transformToken),\n };\n\n const internalFreeText: InternalFreeTextFiltering = {\n disabled: disableFreeTextFiltering,\n operators: freeTextFiltering?.operators ?? [':', '!:'],\n defaultOperator: freeTextFiltering?.defaultOperator ?? ':',\n };\n\n return { internalProperties: [...propertyByKey.values()], internalOptions, internalQuery, internalFreeText };\n })();\n\n const { addToken, updateToken, updateOperation, removeToken, removeAllTokens } = getQueryActions({\n query: internalQuery,\n filteringOptions: internalOptions,\n onChange,\n enableTokenGroups,\n });\n\n const parsedText = parseText(filteringText, internalProperties, internalFreeText);\n const autosuggestOptions = getAutosuggestOptions(\n parsedText,\n internalProperties,\n internalOptions,\n customGroupsText,\n i18nStrings\n );\n\n const createToken = (currentText: string) => {\n const parsedText = parseText(currentText, internalProperties, internalFreeText);\n let newToken: InternalToken;\n switch (parsedText.step) {\n case 'property': {\n newToken = {\n property: parsedText.property,\n operator: parsedText.operator,\n value: parsedText.value,\n };\n break;\n }\n case 'free-text': {\n newToken = {\n property: null,\n operator: parsedText.operator || internalFreeText.defaultOperator,\n value: parsedText.value,\n };\n break;\n }\n case 'operator': {\n newToken = {\n property: null,\n operator: internalFreeText.defaultOperator,\n value: currentText,\n };\n break;\n }\n }\n if (internalFreeText.disabled && !newToken.property) {\n return;\n }\n addToken(newToken);\n setFilteringText('');\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.externalProperty;\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 const { detail: option } = event;\n const value = option.value || '';\n if (!value) {\n return;\n }\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, internalProperties, internalFreeText);\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.externalProperty ?? undefined;\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\n useDebounceSearchResultCallback({\n searchQuery: query,\n countText,\n loading,\n announceCallback: () => {\n searchResultsRef.current?.reannounce();\n },\n });\n\n const propertyStep = parsedText.step === 'property' ? parsedText : null;\n const customValueKey = propertyStep ? propertyStep.property.propertyKey + ':' + propertyStep.operator : '';\n const [customFormValueRecord, setCustomFormValueRecord] = useState<Record<string, any>>({});\n const customFormValue = customValueKey in customFormValueRecord ? customFormValueRecord[customValueKey] : null;\n const setCustomFormValue = (value: null | any) => setCustomFormValueRecord({ [customValueKey]: value });\n const operatorForm = propertyStep && propertyStep.property.getValueFormRenderer(propertyStep.operator);\n const isEnumValue = propertyStep?.property.getTokenType(propertyStep.operator) === 'enum';\n\n const searchResultsId = useUniqueId('property-filter-search-results');\n const constraintTextId = useUniqueId('property-filter-constraint');\n const textboxAriaDescribedBy = filteringConstraintText\n ? joinStrings(rest.ariaDescribedby, constraintTextId)\n : rest.ariaDescribedby;\n\n const showResults = !!internalQuery.tokens?.length && !disabled && !!countText;\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef}>\n <div className={clsx(styles['search-field'], analyticsSelectors['search-field'])}>\n {customControl && <div className={styles['custom-control']}>{customControl}</div>}\n <div className={styles['input-wrapper']}>\n <PropertyFilterAutosuggest\n ref={inputRef}\n virtualScroll={virtualScroll}\n enteredTextLabel={i18nStrings.enteredTextLabel}\n ariaLabel={filteringAriaLabel ?? i18nStrings.filteringAriaLabel}\n placeholder={filteringPlaceholder ?? i18nStrings.filteringPlaceholder}\n ariaLabelledby={rest.ariaLabelledby}\n ariaDescribedby={textboxAriaDescribedBy}\n controlId={rest.controlId}\n value={filteringText}\n disabled={disabled}\n {...autosuggestOptions}\n onChange={event => setFilteringText(event.detail.value)}\n empty={filteringEmpty}\n {...asyncAutosuggestProps}\n expandToViewport={expandToViewport}\n onOptionClick={handleSelected}\n customForm={\n operatorForm || isEnumValue\n ? {\n content: operatorForm ? (\n <PropertyEditorContentCustom\n key={customValueKey}\n property={propertyStep.property}\n operator={propertyStep.operator}\n filter={propertyStep.value}\n operatorForm={operatorForm}\n value={customFormValue}\n onChange={setCustomFormValue}\n />\n ) : (\n <PropertyEditorContentEnum\n key={customValueKey}\n property={propertyStep.property}\n filter={propertyStep.value}\n value={customFormValue}\n onChange={setCustomFormValue}\n asyncProps={asyncProps}\n filteringOptions={internalOptions}\n onLoadItems={inputLoadItemsHandlers.onLoadItems}\n />\n ),\n footer: (\n <PropertyEditorFooter\n key={customValueKey}\n property={propertyStep.property}\n operator={propertyStep.operator}\n value={customFormValue}\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 : undefined\n }\n onCloseDropdown={() => setCustomFormValueRecord({})}\n hideEnteredTextOption={internalFreeText.disabled && parsedText.step !== 'property'}\n clearAriaLabel={i18nStrings.clearAriaLabel}\n searchResultsId={showResults ? searchResultsId : undefined}\n />\n {showResults ? (\n <div className={styles.results}>\n <SearchResults id={searchResultsId} renderLiveRegion={!loading} ref={searchResultsRef}>\n {countText}\n </SearchResults>\n </div>\n ) : null}\n </div>\n </div>\n {filteringConstraintText && (\n <div id={constraintTextId} className={styles.constraint}>\n {filteringConstraintText}\n </div>\n )}\n {internalQuery.tokens && internalQuery.tokens.length > 0 && (\n <div className={styles.tokens}>\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\">\n <TokenList\n alignment=\"inline\"\n limit={tokenLimit}\n items={internalQuery.tokens}\n limitShowFewerAriaLabel={tokenLimitShowFewerAriaLabel}\n limitShowMoreAriaLabel={tokenLimitShowMoreAriaLabel}\n renderItem={(_, tokenIndex) => (\n <TokenButton\n query={internalQuery}\n tokenIndex={tokenIndex}\n onUpdateToken={(token, releasedTokens) => {\n updateToken(tokenIndex, token, releasedTokens);\n }}\n onUpdateOperation={updateOperation}\n onRemoveToken={() => {\n removeToken(tokenIndex);\n setNextFocusIndex(tokenIndex);\n }}\n filteringProperties={internalProperties}\n filteringOptions={internalOptions}\n asyncProps={asyncProps}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n asyncProperties={asyncProperties}\n hideOperations={hideOperations}\n customGroupsText={customGroupsText}\n freeTextFiltering={internalFreeText}\n disabled={disabled}\n expandToViewport={expandToViewport}\n enableTokenGroups={enableTokenGroups}\n />\n )}\n i18nStrings={{\n limitShowFewer: i18nStrings.tokenLimitShowFewer,\n limitShowMore: i18nStrings.tokenLimitShowMore,\n }}\n after={\n customFilterActions ? (\n <div className={styles['custom-filter-actions']}>{customFilterActions}</div>\n ) : (\n <span\n {...getAnalyticsMetadataAttribute({\n action: 'clearFilters',\n } as Partial<GeneratedAnalyticsMetadataPropertyFilterClearFilters>)}\n >\n <InternalButton\n formAction=\"none\"\n onClick={() => {\n removeAllTokens();\n inputRef.current?.focus({ preventDropdown: true });\n }}\n className={styles['remove-all']}\n disabled={disabled}\n >\n {i18nStrings.clearFiltersText}\n </InternalButton>\n </span>\n )\n }\n />\n </InternalSpaceBetween>\n </div>\n )}\n </div>\n );\n }\n);\n\nexport default PropertyFilterInternal;\n"]}
@@ -21,8 +21,14 @@ export interface TextFilterProps extends BaseComponentProps, FormFieldControlPro
21
21
  * the number listed. For example, "25+ matches."
22
22
  *
23
23
  * The count text is only displayed when `filteringText` isn't empty.
24
+ * When the `countText` or `filteringText` changes, it will be announced to assistive technologies.
24
25
  */
25
26
  countText?: string;
27
+ /**
28
+ * Set to `true` while the related collection is loading (e.g. during an async filtering action).
29
+ * If set to `true`, the live announcement of countText by assistive technologies will be paused until it changes back to `false`.
30
+ */
31
+ loading?: boolean;
26
32
  /**
27
33
  * Specifies if the filtering input is disabled.
28
34
  * For example, you can use it if you are fetching new items upon filtering change
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/text-filter/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,eAAgB,SAAQ,kBAAkB,EAAE,qBAAqB,EAAE,gBAAgB;IAClG;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAEjC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IAEnE;;;OAGG;IACH,eAAe,CAAC,EAAE,yBAAyB,CAAC,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;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/text-filter/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { InputAutoCorrect } from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface TextFilterProps extends BaseComponentProps, FormFieldControlProps, InputAutoCorrect {\n /**\n * The current value of the filtering input.\n */\n filteringText: string;\n\n /**\n * Placeholder for the filtering input.\n */\n filteringPlaceholder?: string;\n\n /**\n * Label for the filtering input clear button.\n */\n filteringClearAriaLabel?: string;\n\n /**\n * Accepts a human-readable, localized string that indicates the number of results. For example, \"1 match\" or \"165 matches.\"\n * If the total number of results is unknown, also include an indication that there may be more results than\n * the number listed. For example, \"25+ matches.\"\n *\n * The count text is only displayed when `filteringText` isn't empty.\n */\n countText?: string;\n\n /**\n * Specifies if the filtering input is disabled.\n * For example, you can use it if you are fetching new items upon filtering change\n * in order to prevent the user from changing the filtering text.\n */\n disabled?: boolean;\n\n /**\n * Adds an `aria-label` on the filtering input.\n */\n filteringAriaLabel?: string;\n\n /**\n * Called when a change in filtering is caused by a user interaction. The event `detail` contains the current `filteringText`.\n */\n onChange?: NonCancelableEventHandler<TextFilterProps.ChangeDetail>;\n\n /**\n * Called after the user changes the value of the filtering input field and stops typing for a certain\n * period of time. If you want a delayed handler to invoke a filtering API call, you can use this event in addition to `onChange`.\n */\n onDelayedChange?: NonCancelableEventHandler<TextFilterProps.ChangeDetail>;\n}\n\nexport namespace TextFilterProps {\n export interface ChangeDetail {\n filteringText: string;\n }\n\n export interface Ref {\n /**\n * Sets focus on the underlying input control.\n */\n focus(): void;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/text-filter/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { InputAutoCorrect } from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface TextFilterProps extends BaseComponentProps, FormFieldControlProps, InputAutoCorrect {\n /**\n * The current value of the filtering input.\n */\n filteringText: string;\n\n /**\n * Placeholder for the filtering input.\n */\n filteringPlaceholder?: string;\n\n /**\n * Label for the filtering input clear button.\n */\n filteringClearAriaLabel?: string;\n\n /**\n * Accepts a human-readable, localized string that indicates the number of results. For example, \"1 match\" or \"165 matches.\"\n * If the total number of results is unknown, also include an indication that there may be more results than\n * the number listed. For example, \"25+ matches.\"\n *\n * The count text is only displayed when `filteringText` isn't empty.\n * When the `countText` or `filteringText` changes, it will be announced to assistive technologies.\n */\n countText?: string;\n\n /**\n * Set to `true` while the related collection is loading (e.g. during an async filtering action).\n * If set to `true`, the live announcement of countText by assistive technologies will be paused until it changes back to `false`.\n */\n loading?: boolean;\n\n /**\n * Specifies if the filtering input is disabled.\n * For example, you can use it if you are fetching new items upon filtering change\n * in order to prevent the user from changing the filtering text.\n */\n disabled?: boolean;\n\n /**\n * Adds an `aria-label` on the filtering input.\n */\n filteringAriaLabel?: string;\n\n /**\n * Called when a change in filtering is caused by a user interaction. The event `detail` contains the current `filteringText`.\n */\n onChange?: NonCancelableEventHandler<TextFilterProps.ChangeDetail>;\n\n /**\n * Called after the user changes the value of the filtering input field and stops typing for a certain\n * period of time. If you want a delayed handler to invoke a filtering API call, you can use this event in addition to `onChange`.\n */\n onDelayedChange?: NonCancelableEventHandler<TextFilterProps.ChangeDetail>;\n}\n\nexport namespace TextFilterProps {\n export interface ChangeDetail {\n filteringText: string;\n }\n\n export interface Ref {\n /**\n * Sets focus on the underlying input control.\n */\n focus(): void;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/text-filter/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAQtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAO/C,QAAA,MAAM,kBAAkB,+HAuDvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/text-filter/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAQtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAQ/C,QAAA,MAAM,kBAAkB,+HAsEvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -11,12 +11,14 @@ import useForwardFocus from '../internal/hooks/forward-focus';
11
11
  import { useUniqueId } from '../internal/hooks/use-unique-id';
12
12
  import { joinStrings } from '../internal/utils/strings';
13
13
  import { SearchResults } from './search-results';
14
+ import useDebounceSearchResultCallback from './use-debounce-search-result-callback';
14
15
  import styles from './styles.css.js';
15
16
  const InternalTextFilter = React.forwardRef((_a, ref) => {
16
17
  var _b;
17
- var { filteringText, filteringAriaLabel, filteringPlaceholder, filteringClearAriaLabel, controlId, ariaLabelledby, ariaDescribedby, disabled, countText, disableBrowserAutocorrect, onChange, onDelayedChange, __internalRootRef } = _a, rest = __rest(_a, ["filteringText", "filteringAriaLabel", "filteringPlaceholder", "filteringClearAriaLabel", "controlId", "ariaLabelledby", "ariaDescribedby", "disabled", "countText", "disableBrowserAutocorrect", "onChange", "onDelayedChange", "__internalRootRef"]);
18
+ var { filteringText, filteringAriaLabel, filteringPlaceholder, filteringClearAriaLabel, controlId, ariaLabelledby, ariaDescribedby, disabled, countText, disableBrowserAutocorrect, onChange, onDelayedChange, loading = false, __internalRootRef } = _a, rest = __rest(_a, ["filteringText", "filteringAriaLabel", "filteringPlaceholder", "filteringClearAriaLabel", "controlId", "ariaLabelledby", "ariaDescribedby", "disabled", "countText", "disableBrowserAutocorrect", "onChange", "onDelayedChange", "loading", "__internalRootRef"]);
18
19
  const baseProps = getBaseProps(rest);
19
20
  const inputRef = useRef(null);
21
+ const searchResultsRef = useRef(null);
20
22
  useForwardFocus(ref, inputRef);
21
23
  const searchResultsId = useUniqueId('text-filter-search-results');
22
24
  const showResults = filteringText && countText && !disabled;
@@ -24,9 +26,18 @@ const InternalTextFilter = React.forwardRef((_a, ref) => {
24
26
  if ((_b = tableComponentContext === null || tableComponentContext === void 0 ? void 0 : tableComponentContext.filterRef) === null || _b === void 0 ? void 0 : _b.current) {
25
27
  tableComponentContext.filterRef.current.filterText = filteringText;
26
28
  }
29
+ useDebounceSearchResultCallback({
30
+ searchQuery: filteringText,
31
+ countText,
32
+ loading,
33
+ announceCallback: () => {
34
+ var _a;
35
+ (_a = searchResultsRef.current) === null || _a === void 0 ? void 0 : _a.reannounce();
36
+ },
37
+ });
27
38
  return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: __internalRootRef }),
28
39
  React.createElement(InternalInput, { __inheritFormFieldProps: true, disableBrowserAutocorrect: disableBrowserAutocorrect, ref: inputRef, className: styles.input, type: "search", ariaLabel: filteringAriaLabel, placeholder: filteringPlaceholder, value: filteringText, disabled: disabled, controlId: controlId, ariaLabelledby: ariaLabelledby, ariaDescribedby: joinStrings(showResults ? searchResultsId : undefined, ariaDescribedby), autoComplete: false, clearAriaLabel: filteringClearAriaLabel, onChange: event => fireNonCancelableEvent(onChange, { filteringText: event.detail.value }), __onDelayedInput: event => fireNonCancelableEvent(onDelayedChange, { filteringText: event.detail.value }) }),
29
- showResults ? React.createElement(SearchResults, { id: searchResultsId }, countText) : null));
40
+ showResults ? (React.createElement(SearchResults, { renderLiveRegion: !loading, id: searchResultsId, ref: searchResultsRef }, countText)) : null));
30
41
  });
31
42
  export default InternalTextFilter;
32
43
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/text-filter/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,kBAAkB,GAAG,KAAK,CAAC,UAAU,CACzC,CACE,EAe0B,EAC1B,GAAmC,EACnC,EAAE;;QAjBF,EACE,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,SAAS,EACT,cAAc,EACd,eAAe,EACf,QAAQ,EACR,SAAS,EACT,yBAAyB,EACzB,QAAQ,EACR,eAAe,EACf,iBAAiB,OAEO,EADrB,IAAI,cAdT,sPAeC,CADQ;IAIT,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAChD,eAAe,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAE/B,MAAM,eAAe,GAAG,WAAW,CAAC,4BAA4B,CAAC,CAAC;I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iB,CAAC,CAAC,CAAC,IAAI,CACjF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport InternalInput from '../input/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { useTableComponentsContext } from '../internal/context/table-component-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { joinStrings } from '../internal/utils/strings';\nimport { TextFilterProps } from './interfaces';\nimport { SearchResults } from './search-results';\n\nimport styles from './styles.css.js';\n\ntype InternalTextFilterProps = TextFilterProps & InternalBaseComponentProps;\n\nconst InternalTextFilter = React.forwardRef(\n (\n {\n filteringText,\n filteringAriaLabel,\n filteringPlaceholder,\n filteringClearAriaLabel,\n controlId,\n ariaLabelledby,\n ariaDescribedby,\n disabled,\n countText,\n disableBrowserAutocorrect,\n onChange,\n onDelayedChange,\n __internalRootRef,\n ...rest\n }: InternalTextFilterProps,\n ref: React.Ref<TextFilterProps.Ref>\n ) => {\n const baseProps = getBaseProps(rest);\n const inputRef = useRef<HTMLInputElement>(null);\n useForwardFocus(ref, inputRef);\n\n const searchResultsId = useUniqueId('text-filter-search-results');\n const showResults = filteringText && countText && !disabled;\n const tableComponentContext = useTableComponentsContext();\n if (tableComponentContext?.filterRef?.current) {\n tableComponentContext.filterRef.current.filterText = filteringText;\n }\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <InternalInput\n __inheritFormFieldProps={true}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n ref={inputRef}\n className={styles.input}\n type=\"search\"\n ariaLabel={filteringAriaLabel}\n placeholder={filteringPlaceholder}\n value={filteringText}\n disabled={disabled}\n controlId={controlId}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={joinStrings(showResults ? searchResultsId : undefined, ariaDescribedby)}\n autoComplete={false}\n clearAriaLabel={filteringClearAriaLabel}\n onChange={event => fireNonCancelableEvent(onChange, { filteringText: event.detail.value })}\n __onDelayedInput={event => fireNonCancelableEvent(onDelayedChange, { filteringText: event.detail.value })}\n />\n {showResults ? <SearchResults id={searchResultsId}>{countText}</SearchResults> : null}\n </div>\n );\n }\n);\n\nexport default InternalTextFilter;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/text-filter/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,+BAA+B,MAAM,uCAAuC,CAAC;AAEpF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,kBAAkB,GAAG,KAAK,CAAC,UAAU,CACzC,CACE,EAgB0B,EAC1B,GAAmC,EACnC,EAAE;;QAlBF,EACE,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,SAAS,EACT,cAAc,EACd,eAAe,EACf,QAAQ,EACR,SAAS,EACT,yBAAyB,EAC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E,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,EAAE,eAAe,CAAC,EACxF,YAAY,EAAE,KAAK,EACnB,cAAc,EAAE,uBAAuB,EACvC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAAC,QAAQ,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAC1F,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAAC,eAAe,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,GACzG;QACD,WAAW,CAAC,CAAC,CAAC,CACb,oBAAC,aAAa,IAAC,gBAAgB,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,eAAe,EAAE,GAAG,EAAE,gBAAgB,IAClF,SAAS,CACI,CACjB,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport InternalInput from '../input/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { useTableComponentsContext } from '../internal/context/table-component-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { joinStrings } from '../internal/utils/strings';\nimport { InternalLiveRegionRef } from '../live-region/internal';\nimport { TextFilterProps } from './interfaces';\nimport { SearchResults } from './search-results';\nimport useDebounceSearchResultCallback from './use-debounce-search-result-callback';\n\nimport styles from './styles.css.js';\n\ntype InternalTextFilterProps = TextFilterProps & InternalBaseComponentProps;\n\nconst InternalTextFilter = React.forwardRef(\n (\n {\n filteringText,\n filteringAriaLabel,\n filteringPlaceholder,\n filteringClearAriaLabel,\n controlId,\n ariaLabelledby,\n ariaDescribedby,\n disabled,\n countText,\n disableBrowserAutocorrect,\n onChange,\n onDelayedChange,\n loading = false,\n __internalRootRef,\n ...rest\n }: InternalTextFilterProps,\n ref: React.Ref<TextFilterProps.Ref>\n ) => {\n const baseProps = getBaseProps(rest);\n const inputRef = useRef<HTMLInputElement>(null);\n const searchResultsRef = useRef<InternalLiveRegionRef>(null);\n useForwardFocus(ref, inputRef);\n\n const searchResultsId = useUniqueId('text-filter-search-results');\n const showResults = filteringText && countText && !disabled;\n const tableComponentContext = useTableComponentsContext();\n if (tableComponentContext?.filterRef?.current) {\n tableComponentContext.filterRef.current.filterText = filteringText;\n }\n\n useDebounceSearchResultCallback({\n searchQuery: filteringText,\n countText,\n loading,\n announceCallback: () => {\n searchResultsRef.current?.reannounce();\n },\n });\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <InternalInput\n __inheritFormFieldProps={true}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n ref={inputRef}\n className={styles.input}\n type=\"search\"\n ariaLabel={filteringAriaLabel}\n placeholder={filteringPlaceholder}\n value={filteringText}\n disabled={disabled}\n controlId={controlId}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={joinStrings(showResults ? searchResultsId : undefined, ariaDescribedby)}\n autoComplete={false}\n clearAriaLabel={filteringClearAriaLabel}\n onChange={event => fireNonCancelableEvent(onChange, { filteringText: event.detail.value })}\n __onDelayedInput={event => fireNonCancelableEvent(onDelayedChange, { filteringText: event.detail.value })}\n />\n {showResults ? (\n <SearchResults renderLiveRegion={!loading} id={searchResultsId} ref={searchResultsRef}>\n {countText}\n </SearchResults>\n ) : null}\n </div>\n );\n }\n);\n\nexport default InternalTextFilter;\n"]}
@@ -1,8 +1,10 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
+ import { InternalLiveRegionRef } from '../live-region/internal';
2
3
  interface SearchResultsProps {
3
4
  id: string;
4
5
  children: string;
6
+ renderLiveRegion: boolean;
5
7
  }
6
- export declare function SearchResults({ id, children }: SearchResultsProps): JSX.Element;
8
+ export declare const SearchResults: React.ForwardRefExoticComponent<SearchResultsProps & React.RefAttributes<InternalLiveRegionRef>>;
7
9
  export {};
8
10
  //# sourceMappingURL=search-results.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"search-results.d.ts","sourceRoot":"","sources":["../../../src/text-filter/search-results.tsx"],"names":[],"mappings":";AAYA,UAAU,kBAAkB;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,kBAAkB,eAQjE"}
1
+ {"version":3,"file":"search-results.d.ts","sourceRoot":"","sources":["../../../src/text-filter/search-results.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAA2B,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAOpF,UAAU,kBAAkB;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,kGA2BzB,CAAC"}
@@ -1,13 +1,20 @@
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, { useImperativeHandle, useRef } from 'react';
4
4
  import InternalLiveRegion from '../live-region/internal';
5
5
  import styles from './styles.css.js';
6
6
  // Debounce delay for live region (based on testing with VoiceOver)
7
7
  const LIVE_REGION_DELAY = 2000;
8
- export function SearchResults({ id, children }) {
9
- return (React.createElement("span", { className: styles.results },
10
- React.createElement(InternalLiveRegion, { delay: LIVE_REGION_DELAY, tagName: "span" },
11
- React.createElement("span", { id: id }, children))));
12
- }
8
+ export const SearchResults = React.forwardRef(({ id, renderLiveRegion, children }, ref) => {
9
+ const liveRegionRef = useRef(null);
10
+ useImperativeHandle(ref, () => ({
11
+ reannounce: () => {
12
+ var _a;
13
+ (_a = liveRegionRef.current) === null || _a === void 0 ? void 0 : _a.reannounce();
14
+ },
15
+ }), []);
16
+ return (React.createElement(React.Fragment, null,
17
+ React.createElement("span", { className: styles.results, id: id }, children),
18
+ renderLiveRegion && (React.createElement(InternalLiveRegion, { delay: LIVE_REGION_DELAY, tagName: "span", hidden: true, ref: liveRegionRef }, children))));
19
+ });
13
20
  //# sourceMappingURL=search-results.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"search-results.js","sourceRoot":"","sources":["../../../src/text-filter/search-results.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AAEzD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,mEAAmE;AACnE,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAO/B,MAAM,UAAU,aAAa,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAsB;IAChE,OAAO,CACL,8BAAM,SAAS,EAAE,MAAM,CAAC,OAAO;QAC7B,oBAAC,kBAAkB,IAAC,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAC,MAAM;YAC1D,8BAAM,EAAE,EAAE,EAAE,IAAG,QAAQ,CAAQ,CACZ,CAChB,CACR,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';\n\nimport InternalLiveRegion from '../live-region/internal';\n\nimport styles from './styles.css.js';\n\n// Debounce delay for live region (based on testing with VoiceOver)\nconst LIVE_REGION_DELAY = 2000;\n\ninterface SearchResultsProps {\n id: string;\n children: string;\n}\n\nexport function SearchResults({ id, children }: SearchResultsProps) {\n return (\n <span className={styles.results}>\n <InternalLiveRegion delay={LIVE_REGION_DELAY} tagName=\"span\">\n <span id={id}>{children}</span>\n </InternalLiveRegion>\n </span>\n );\n}\n"]}
1
+ {"version":3,"file":"search-results.js","sourceRoot":"","sources":["../../../src/text-filter/search-results.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,kBAA6C,MAAM,yBAAyB,CAAC;AAEpF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,mEAAmE;AACnE,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAQ/B,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAC3C,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,QAAQ,EAAsB,EAAE,GAAsC,EAAE,EAAE;IACjG,MAAM,aAAa,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IAE1D,mBAAmB,CACjB,GAAG,EACH,GAAG,EAAE,CAAC,CAAC;QACL,UAAU,EAAE,GAAG,EAAE;;YACf,MAAA,aAAa,CAAC,OAAO,0CAAE,UAAU,EAAE,CAAC;QACtC,CAAC;KACF,CAAC,EACF,EAAE,CACH,CAAC;IAEF,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,IACpC,QAAQ,CACJ;QACN,gBAAgB,IAAI,CACnB,oBAAC,kBAAkB,IAAC,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAC,MAAM,EAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,aAAa,IAC1F,QAAQ,CACU,CACtB,CACA,CACJ,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useImperativeHandle, useRef } from 'react';\n\nimport InternalLiveRegion, { InternalLiveRegionRef } from '../live-region/internal';\n\nimport styles from './styles.css.js';\n\n// Debounce delay for live region (based on testing with VoiceOver)\nconst LIVE_REGION_DELAY = 2000;\n\ninterface SearchResultsProps {\n id: string;\n children: string;\n renderLiveRegion: boolean;\n}\n\nexport const SearchResults = React.forwardRef(\n ({ id, renderLiveRegion, children }: SearchResultsProps, ref?: React.Ref<InternalLiveRegionRef>) => {\n const liveRegionRef = useRef<InternalLiveRegionRef>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n reannounce: () => {\n liveRegionRef.current?.reannounce();\n },\n }),\n []\n );\n\n return (\n <>\n <span className={styles.results} id={id}>\n {children}\n </span>\n {renderLiveRegion && (\n <InternalLiveRegion delay={LIVE_REGION_DELAY} tagName=\"span\" hidden={true} ref={liveRegionRef}>\n {children}\n </InternalLiveRegion>\n )}\n </>\n );\n }\n);\n"]}
@@ -0,0 +1,8 @@
1
+ export interface DebouncedLiveAnnouncementProps {
2
+ searchQuery: any;
3
+ countText: string | undefined;
4
+ loading: boolean;
5
+ announceCallback: () => void;
6
+ }
7
+ export default function useDebounceSearchResultCallback({ searchQuery, countText, loading, announceCallback, }: DebouncedLiveAnnouncementProps): void;
8
+ //# sourceMappingURL=use-debounce-search-result-callback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-debounce-search-result-callback.d.ts","sourceRoot":"","sources":["../../../src/text-filter/use-debounce-search-result-callback.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,8BAA8B;IAC7C,WAAW,EAAE,GAAG,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B;AAKD,MAAM,CAAC,OAAO,UAAU,+BAA+B,CAAC,EACtD,WAAW,EACX,SAAS,EACT,OAAO,EACP,gBAAgB,GACjB,EAAE,8BAA8B,QAiBhC"}
@@ -0,0 +1,23 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { useEffect, useRef } from 'react';
4
+ import { useDebounceCallback } from '../internal/hooks/use-debounce-callback';
5
+ // Debounce delay for live region (based on testing with VoiceOver)
6
+ const LIVE_REGION_DELAY = 2000;
7
+ export default function useDebounceSearchResultCallback({ searchQuery, countText, loading, announceCallback, }) {
8
+ const loadingRef = useRef(loading);
9
+ // announceCallback is called when:
10
+ // - For sync filters: on searchQuery/countText changes.
11
+ // - For async filters: on searchQuery/countText when loading completed and countText exists.
12
+ const debounceLiveAnnouncement = useDebounceCallback(() => {
13
+ if (!countText || loadingRef.current) {
14
+ return;
15
+ }
16
+ announceCallback();
17
+ }, LIVE_REGION_DELAY);
18
+ useEffect(() => {
19
+ loadingRef.current = loading;
20
+ debounceLiveAnnouncement();
21
+ }, [searchQuery, countText, loading, debounceLiveAnnouncement]);
22
+ }
23
+ //# sourceMappingURL=use-debounce-search-result-callback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-debounce-search-result-callback.js","sourceRoot":"","sources":["../../../src/text-filter/use-debounce-search-result-callback.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAS9E,mEAAmE;AACnE,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,+BAA+B,CAAC,EACtD,WAAW,EACX,SAAS,EACT,OAAO,EACP,gBAAgB,GACe;IAC/B,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAEnC,mCAAmC;IACnC,wDAAwD;IACxD,6FAA6F;IAC7F,MAAM,wBAAwB,GAAG,mBAAmB,CAAC,GAAG,EAAE;QACxD,IAAI,CAAC,SAAS,IAAI,UAAU,CAAC,OAAO,EAAE;YACpC,OAAO;SACR;QACD,gBAAgB,EAAE,CAAC;IACrB,CAAC,EAAE,iBAAiB,CAAC,CAAC;IAEtB,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;QAC7B,wBAAwB,EAAE,CAAC;IAC7B,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useEffect, useRef } from 'react';\n\nimport { useDebounceCallback } from '../internal/hooks/use-debounce-callback';\n\nexport interface DebouncedLiveAnnouncementProps {\n searchQuery: any;\n countText: string | undefined;\n loading: boolean;\n announceCallback: () => void;\n}\n\n// Debounce delay for live region (based on testing with VoiceOver)\nconst LIVE_REGION_DELAY = 2000;\n\nexport default function useDebounceSearchResultCallback({\n searchQuery,\n countText,\n loading,\n announceCallback,\n}: DebouncedLiveAnnouncementProps) {\n const loadingRef = useRef(loading);\n\n // announceCallback is called when:\n // - For sync filters: on searchQuery/countText changes.\n // - For async filters: on searchQuery/countText when loading completed and countText exists.\n const debounceLiveAnnouncement = useDebounceCallback(() => {\n if (!countText || loadingRef.current) {\n return;\n }\n announceCallback();\n }, LIVE_REGION_DELAY);\n\n useEffect(() => {\n loadingRef.current = loading;\n debounceLiveAnnouncement();\n }, [searchQuery, countText, loading, debounceLiveAnnouncement]);\n}\n"]}