@cloudscape-design/components 3.0.843 → 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.
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/property-filter/interfaces.d.ts +6 -0
- package/property-filter/interfaces.d.ts.map +1 -1
- package/property-filter/interfaces.js.map +1 -1
- package/property-filter/internal.d.ts.map +1 -1
- package/property-filter/internal.js +13 -2
- package/property-filter/internal.js.map +1 -1
- package/text-filter/interfaces.d.ts +6 -0
- package/text-filter/interfaces.d.ts.map +1 -1
- package/text-filter/interfaces.js.map +1 -1
- package/text-filter/internal.d.ts.map +1 -1
- package/text-filter/internal.js +13 -2
- package/text-filter/internal.js.map +1 -1
- package/text-filter/search-results.d.ts +4 -2
- package/text-filter/search-results.d.ts.map +1 -1
- package/text-filter/search-results.js +13 -6
- package/text-filter/search-results.js.map +1 -1
- package/text-filter/use-debounce-search-result-callback.d.ts +8 -0
- package/text-filter/use-debounce-search-result-callback.d.ts.map +1 -0
- package/text-filter/use-debounce-search-result-callback.js +23 -0
- package/text-filter/use-debounce-search-result-callback.js.map +1 -0
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -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,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB,EAAE,gBAAgB,EAAE,qBAAqB;IACtG;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC;IAC9C
|
|
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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;CACzC;AAED,MAAM,WAAW,aAAa,CAAC,UAAU,GAAG,GAAG;IAC7C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,IAAI,GAAG,yBAAyB,CAAC,UAAU,CAAC,CAAC;IACvD,QAAQ,EAAE,sBAAsB,CAAC;IACjC,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB,CAAC,UAAU,GAAG,GAAG;IAClD,SAAS,EAAE,uBAAuB,CAAC;IACnC,MAAM,EAAE,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;CACjF;AAED,MAAM,MAAM,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;
|
|
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;AAE5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtG,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAiBrD,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACjH,OAAO,yBAA6D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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,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,+BAA+B,MAAM,oDAAoD,CAAC;AAEjG,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtG,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAiBrD,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACjH,OAAO,yBAA6D,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AM,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
|
|
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;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;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,eAAe,CAAC,YAAY,CAAC,CAAC;CAC3E;AAED,yBAAiB,eAAe,CAAC;IAC/B,UAAiB,YAAY;QAC3B,aAAa,EAAE,MAAM,CAAC;KACvB;IAED,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;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;
|
|
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"}
|
package/text-filter/internal.js
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/text-filter/internal.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BAAsB,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
|
-
|
|
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
|
|
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":";
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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;
|
|
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"]}
|