@cloudscape-design/components 3.0.597 → 3.0.598

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/button-dropdown/category-elements/styles.css.js +14 -14
  2. package/button-dropdown/category-elements/styles.scoped.css +22 -33
  3. package/button-dropdown/category-elements/styles.selectors.js +14 -14
  4. package/button-dropdown/interfaces.d.ts +0 -2
  5. package/button-dropdown/interfaces.d.ts.map +1 -1
  6. package/button-dropdown/interfaces.js.map +1 -1
  7. package/button-dropdown/item-element/index.d.ts +1 -1
  8. package/button-dropdown/item-element/index.d.ts.map +1 -1
  9. package/button-dropdown/item-element/index.js +1 -3
  10. package/button-dropdown/item-element/index.js.map +1 -1
  11. package/button-dropdown/item-element/styles.css.js +9 -16
  12. package/button-dropdown/item-element/styles.scoped.css +12 -29
  13. package/button-dropdown/item-element/styles.selectors.js +9 -16
  14. package/button-dropdown/items-list.d.ts.map +1 -1
  15. package/button-dropdown/items-list.js +1 -2
  16. package/button-dropdown/items-list.js.map +1 -1
  17. package/internal/components/token-list/index.d.ts +1 -1
  18. package/internal/components/token-list/index.d.ts.map +1 -1
  19. package/internal/components/token-list/index.js +2 -2
  20. package/internal/components/token-list/index.js.map +1 -1
  21. package/internal/components/token-list/interfaces.d.ts +2 -0
  22. package/internal/components/token-list/interfaces.d.ts.map +1 -1
  23. package/internal/components/token-list/interfaces.js.map +1 -1
  24. package/internal/components/token-list/token-limit-toggle.d.ts +3 -1
  25. package/internal/components/token-list/token-limit-toggle.d.ts.map +1 -1
  26. package/internal/components/token-list/token-limit-toggle.js +3 -2
  27. package/internal/components/token-list/token-limit-toggle.js.map +1 -1
  28. package/internal/context/single-tab-stop-navigation-context.d.ts +3 -3
  29. package/internal/context/single-tab-stop-navigation-context.d.ts.map +1 -1
  30. package/internal/context/single-tab-stop-navigation-context.js.map +1 -1
  31. package/internal/environment.js +1 -1
  32. package/internal/environment.json +1 -1
  33. package/internal/manifest.json +1 -1
  34. package/multiselect/interfaces.d.ts +10 -0
  35. package/multiselect/interfaces.d.ts.map +1 -1
  36. package/multiselect/interfaces.js.map +1 -1
  37. package/multiselect/internal.d.ts.map +1 -1
  38. package/multiselect/internal.js +2 -2
  39. package/multiselect/internal.js.map +1 -1
  40. package/package.json +1 -1
  41. package/property-filter/index.d.ts.map +1 -1
  42. package/property-filter/index.js +2 -2
  43. package/property-filter/index.js.map +1 -1
  44. package/property-filter/interfaces.d.ts +10 -0
  45. package/property-filter/interfaces.d.ts.map +1 -1
  46. package/property-filter/interfaces.js.map +1 -1
  47. package/table/table-role/grid-navigation.js +6 -0
  48. package/table/table-role/grid-navigation.js.map +1 -1
  49. package/token-group/interfaces.d.ts +10 -0
  50. package/token-group/interfaces.d.ts.map +1 -1
  51. package/token-group/interfaces.js.map +1 -1
  52. package/token-group/internal.d.ts +1 -1
  53. package/token-group/internal.d.ts.map +1 -1
  54. package/token-group/internal.js +2 -2
  55. package/token-group/internal.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/property-filter/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAe5D,OAAO,EAAE,WAAW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AAU,CAAC,CAAC;4BACxB,oBAAoB,CAAC,UAAU,CAAC,CAAC;wBACnC,CAAC,EACD,QAAQ,EAAE,CAAC,QAAe,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC7D,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,kBAAkB,EACvC,gBAAgB,EAAE,eAAe,EACjC,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,gBAAgB,EACnC,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,GAClC,CACH,EACD,WAAW,EAAE;wBACX,cAAc,EAAE,WAAW,CAAC,mBAAmB;wBAC/C,aAAa,EAAE,WAAW,CAAC,kBAAkB;qBAC9C,EACD,KAAK,EACH,mBAAmB,CAAC,CAAC,CAAC,CACpB,6BAAK,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,IAAG,mBAAmB,CAAO,CAC7E,CAAC,CAAC,CAAC,CACF,oBAAC,cAAc,IACb,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,eAAe,EACxB,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,EAC/B,QAAQ,EAAE,QAAQ,IAEjB,WAAW,CAAC,gBAAgB,CACd,CAClB,EAEH,oBAAoB,EAAE,iBAAiB,GACvC,CACmB,CACnB,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AACnD,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef, useState, useImperativeHandle } from 'react';\n\nimport InternalSpaceBetween from '../space-between/internal';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { KeyCode } from '../internal/keycode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id/index';\nimport { fireNonCancelableEvent } from '../internal/events';\n\nimport {\n PropertyFilterProps,\n ParsedText,\n Ref,\n ComparisonOperator,\n Token,\n InternalFilteringProperty,\n InternalFilteringOption,\n FilteringProperty,\n ExtendedOperator,\n InternalQuery,\n InternalFreeTextFiltering,\n} from './interfaces';\nimport { TokenButton } from './token';\nimport { getQueryActions, parseText, getAutosuggestOptions, getAllowedOperators } from './controller';\nimport { useLoadItems } from './use-load-items';\nimport styles from './styles.css.js';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport PropertyFilterAutosuggest, { PropertyFilterAutosuggestProps } from './property-filter-autosuggest';\nimport { PropertyEditor } from './property-editor';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { matchTokenValue } from './utils';\nimport { PropertyFilterOperator } from '@cloudscape-design/collection-hooks';\nimport { useInternalI18n } from '../i18n/context';\nimport TokenList from '../internal/components/token-list';\nimport { SearchResults } from '../text-filter/search-results';\n\nexport { PropertyFilterProps };\n\nfunction getOperatorI18nString(operator: ComparisonOperator): string {\n switch (operator) {\n case '=':\n return 'equals';\n case '!=':\n return 'not_equals';\n case '>':\n return 'greater_than';\n case '>=':\n return 'greater_than_equal';\n case '<':\n return 'less_than';\n case '<=':\n return 'less_than_equal';\n case ':':\n return 'contains';\n case '!:':\n return 'not_contains';\n case '^':\n return 'starts_with';\n case '!^':\n return 'not_starts_with';\n // The line is ignored from coverage because it is not reachable.\n // The purpose of it is to prevent TS errors if ComparisonOperator type gets extended.\n /* istanbul ignore next */\n default:\n return operator;\n }\n}\n\nconst PropertyFilter = React.forwardRef(\n (\n {\n disabled,\n countText,\n query,\n hideOperations,\n onChange,\n filteringProperties,\n filteringOptions = [],\n customGroupsText = [],\n disableFreeTextFiltering = false,\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 filteringStatusType,\n asyncProperties,\n tokenLimit,\n expandToViewport,\n ...rest\n }: PropertyFilterProps,\n ref: React.Ref<Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('PropertyFilter', {\n props: { asyncProperties, disableFreeTextFiltering, expandToViewport, hideOperations, tokenLimit, virtualScroll },\n });\n const [removedTokenIndex, setRemovedTokenIndex] = useState<null | number>(null);\n\n const inputRef = useRef<AutosuggestInputRef>(null);\n const baseProps = getBaseProps(rest);\n\n const i18n = useInternalI18n('property-filter');\n const i18nStrings: PropertyFilterProps.I18nStrings = {\n ...rest.i18nStrings,\n allPropertiesLabel: i18n('i18nStrings.allPropertiesLabel', rest.i18nStrings?.allPropertiesLabel),\n applyActionText: i18n('i18nStrings.applyActionText', rest.i18nStrings?.applyActionText),\n cancelActionText: i18n('i18nStrings.cancelActionText', rest.i18nStrings?.cancelActionText),\n clearFiltersText: i18n('i18nStrings.clearFiltersText', rest.i18nStrings?.clearFiltersText),\n editTokenHeader: i18n('i18nStrings.editTokenHeader', rest.i18nStrings?.editTokenHeader),\n groupPropertiesText: i18n('i18nStrings.groupPropertiesText', rest.i18nStrings?.groupPropertiesText),\n groupValuesText: i18n('i18nStrings.groupValuesText', rest.i18nStrings?.groupValuesText),\n operationAndText: i18n('i18nStrings.operationAndText', rest.i18nStrings?.operationAndText),\n operationOrText: i18n('i18nStrings.operationOrText', rest.i18nStrings?.operationOrText),\n operatorContainsText: i18n('i18nStrings.operatorContainsText', rest.i18nStrings?.operatorContainsText),\n operatorDoesNotContainText: i18n(\n 'i18nStrings.operatorDoesNotContainText',\n rest.i18nStrings?.operatorDoesNotContainText\n ),\n operatorDoesNotEqualText: i18n(\n 'i18nStrings.operatorDoesNotEqualText',\n rest.i18nStrings?.operatorDoesNotEqualText\n ),\n operatorEqualsText: i18n('i18nStrings.operatorEqualsText', rest.i18nStrings?.operatorEqualsText),\n operatorGreaterOrEqualText: i18n(\n 'i18nStrings.operatorGreaterOrEqualText',\n rest.i18nStrings?.operatorGreaterOrEqualText\n ),\n operatorGreaterText: i18n('i18nStrings.operatorGreaterText', rest.i18nStrings?.operatorGreaterText),\n operatorLessOrEqualText: i18n('i18nStrings.operatorLessOrEqualText', rest.i18nStrings?.operatorLessOrEqualText),\n operatorLessText: i18n('i18nStrings.operatorLessText', rest.i18nStrings?.operatorLessText),\n operatorStartsWithText: i18n('i18nStrings.operatorStartsWithText', rest.i18nStrings?.operatorStartsWithText),\n operatorDoesNotStartWithText: i18n(\n 'i18nStrings.operatorDoesNotStartWithText',\n rest.i18nStrings?.operatorDoesNotStartWithText\n ),\n operatorText: i18n('i18nStrings.operatorText', rest.i18nStrings?.operatorText),\n operatorsText: i18n('i18nStrings.operatorsText', rest.i18nStrings?.operatorsText),\n propertyText: i18n('i18nStrings.propertyText', rest.i18nStrings?.propertyText),\n tokenLimitShowFewer: i18n('i18nStrings.tokenLimitShowFewer', rest.i18nStrings?.tokenLimitShowFewer),\n tokenLimitShowMore: i18n('i18nStrings.tokenLimitShowMore', rest.i18nStrings?.tokenLimitShowMore),\n valueText: i18n('i18nStrings.valueText', rest.i18nStrings?.valueText),\n removeTokenButtonAriaLabel: i18n(\n 'i18nStrings.removeTokenButtonAriaLabel',\n rest.i18nStrings?.removeTokenButtonAriaLabel,\n format => token =>\n format({\n token__operator: getOperatorI18nString(token.operator),\n token__propertyKey: token.propertyKey ?? '',\n token__value: token.value,\n })\n ),\n };\n\n useImperativeHandle(ref, () => ({ focus: () => inputRef.current?.focus() }), []);\n const showResults = !!query.tokens?.length && !disabled && !!countText;\n const { addToken, removeToken, setToken, setOperation, removeAllTokens } = getQueryActions(\n query,\n onChange,\n inputRef\n );\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 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 const internalQuery: InternalQuery = {\n operation: query.operation,\n tokens: query.tokens.map(token => ({\n property: token.propertyKey ? getProperty(token.propertyKey) : null,\n operator: token.operator,\n value: token.value,\n })),\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 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: Token;\n switch (parsedText.step) {\n case 'property': {\n newToken = matchTokenValue(\n {\n property: parsedText.property,\n operator: parsedText.operator,\n value: parsedText.value,\n },\n internalOptions\n );\n break;\n }\n case 'free-text': {\n newToken = {\n operator: parsedText.operator || internalFreeText.defaultOperator,\n value: parsedText.value,\n };\n break;\n }\n case 'operator': {\n newToken = {\n operator: internalFreeText.defaultOperator,\n value: currentText,\n };\n break;\n }\n }\n if (internalFreeText.disabled && !('propertyKey' in newToken)) {\n return;\n }\n addToken(newToken);\n setFilteringText('');\n };\n const ignoreKeyDown = useRef<boolean>(false);\n const handleKeyDown: PropertyFilterAutosuggestProps['onKeyDown'] = event => {\n if (filteringText && !ignoreKeyDown.current && event.detail.keyCode === KeyCode.enter) {\n createToken(filteringText);\n }\n };\n const getLoadMoreDetail = (parsedText: ParsedText, filteringText: string) => {\n const loadMoreDetail: {\n filteringProperty: FilteringProperty | undefined;\n filteringText: string;\n filteringOperator: ComparisonOperator | undefined;\n } = {\n filteringProperty: undefined,\n filteringText,\n filteringOperator: undefined,\n };\n if (parsedText.step === 'property') {\n loadMoreDetail.filteringProperty = parsedText.property.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 // The ignoreKeyDown flag makes sure `createToken` routine runs only once. Autosuggest's `onKeyDown` fires,\n // when an item is selected from the list using \"enter\" key.\n ignoreKeyDown.current = true;\n setTimeout(() => {\n ignoreKeyDown.current = false;\n }, 0);\n const { detail: option } = event;\n const value = option.value || '';\n\n if (!('keepOpenOnSelect' in option)) {\n createToken(value);\n return;\n }\n\n // stop dropdown from closing\n event.preventDefault();\n\n const parsedText = parseText(value, 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 operatorForm =\n parsedText.step === 'property' && parsedText.property.getValueFormRenderer(parsedText.operator);\n\n const searchResultsId = useUniqueId('property-filter-search-results');\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <div className={styles['search-field']}>\n {customControl && <div className={styles['custom-control']}>{customControl}</div>}\n <PropertyFilterAutosuggest\n ref={inputRef}\n virtualScroll={virtualScroll}\n enteredTextLabel={i18nStrings.enteredTextLabel}\n ariaLabel={filteringAriaLabel ?? i18nStrings.filteringAriaLabel}\n placeholder={filteringPlaceholder ?? i18nStrings.filteringPlaceholder}\n ariaLabelledby={rest.ariaLabelledby}\n ariaDescribedby={rest.ariaDescribedby}\n controlId={rest.controlId}\n value={filteringText}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n {...autosuggestOptions}\n onChange={event => setFilteringText(event.detail.value)}\n empty={filteringEmpty}\n {...asyncAutosuggestProps}\n expandToViewport={expandToViewport}\n onOptionClick={handleSelected}\n customForm={\n operatorForm && (\n <PropertyEditor\n property={parsedText.property}\n operator={parsedText.operator}\n filter={parsedText.value}\n operatorForm={operatorForm}\n i18nStrings={i18nStrings}\n onCancel={() => {\n setFilteringText('');\n inputRef.current?.close();\n inputRef.current?.focus({ preventDropdown: true });\n }}\n onSubmit={token => {\n addToken(token);\n setFilteringText('');\n inputRef.current?.focus({ preventDropdown: true });\n inputRef.current?.close();\n }}\n />\n )\n }\n hideEnteredTextOption={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 {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 renderItem={(token, tokenIndex) => (\n <TokenButton\n token={token}\n first={tokenIndex === 0}\n operation={internalQuery.operation}\n removeToken={() => {\n removeToken(tokenIndex);\n setRemovedTokenIndex(tokenIndex);\n }}\n setToken={(newToken: Token) => setToken(tokenIndex, newToken)}\n setOperation={setOperation}\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 />\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 <InternalButton\n formAction=\"none\"\n onClick={removeAllTokens}\n className={styles['remove-all']}\n disabled={disabled}\n >\n {i18nStrings.clearFiltersText}\n </InternalButton>\n )\n }\n moveFocusNextToIndex={removedTokenIndex}\n />\n </InternalSpaceBetween>\n </div>\n )}\n </div>\n );\n }\n);\n\napplyDisplayName(PropertyFilter, 'PropertyFilter');\nexport default PropertyFilter;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/property-filter/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAe5D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACtG,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,yBAA6D,MAAM,+BAA+B,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAI9D,SAAS,qBAAqB,CAAC,QAA4B;IAC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,CACH,EACD,WAAW,EAAE;wBACX,cAAc,EAAE,WAAW,CAAC,mBAAmB;wBAC/C,aAAa,EAAE,WAAW,CAAC,kBAAkB;qBAC9C,EACD,KAAK,EACH,mBAAmB,CAAC,CAAC,CAAC,CACpB,6BAAK,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,IAAG,mBAAmB,CAAO,CAC7E,CAAC,CAAC,CAAC,CACF,oBAAC,cAAc,IACb,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,eAAe,EACxB,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,EAC/B,QAAQ,EAAE,QAAQ,IAEjB,WAAW,CAAC,gBAAgB,CACd,CAClB,EAEH,oBAAoB,EAAE,iBAAiB,GACvC,CACmB,CACnB,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AACnD,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef, useState, useImperativeHandle } from 'react';\n\nimport InternalSpaceBetween from '../space-between/internal';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { KeyCode } from '../internal/keycode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id/index';\nimport { fireNonCancelableEvent } from '../internal/events';\n\nimport {\n PropertyFilterProps,\n ParsedText,\n Ref,\n ComparisonOperator,\n Token,\n InternalFilteringProperty,\n InternalFilteringOption,\n FilteringProperty,\n ExtendedOperator,\n InternalQuery,\n InternalFreeTextFiltering,\n} from './interfaces';\nimport { TokenButton } from './token';\nimport { getQueryActions, parseText, getAutosuggestOptions, getAllowedOperators } from './controller';\nimport { useLoadItems } from './use-load-items';\nimport styles from './styles.css.js';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport PropertyFilterAutosuggest, { PropertyFilterAutosuggestProps } from './property-filter-autosuggest';\nimport { PropertyEditor } from './property-editor';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { matchTokenValue } from './utils';\nimport { PropertyFilterOperator } from '@cloudscape-design/collection-hooks';\nimport { useInternalI18n } from '../i18n/context';\nimport TokenList from '../internal/components/token-list';\nimport { SearchResults } from '../text-filter/search-results';\n\nexport { PropertyFilterProps };\n\nfunction getOperatorI18nString(operator: ComparisonOperator): string {\n switch (operator) {\n case '=':\n return 'equals';\n case '!=':\n return 'not_equals';\n case '>':\n return 'greater_than';\n case '>=':\n return 'greater_than_equal';\n case '<':\n return 'less_than';\n case '<=':\n return 'less_than_equal';\n case ':':\n return 'contains';\n case '!:':\n return 'not_contains';\n case '^':\n return 'starts_with';\n case '!^':\n return 'not_starts_with';\n // The line is ignored from coverage because it is not reachable.\n // The purpose of it is to prevent TS errors if ComparisonOperator type gets extended.\n /* istanbul ignore next */\n default:\n return operator;\n }\n}\n\nconst PropertyFilter = React.forwardRef(\n (\n {\n disabled,\n countText,\n query,\n hideOperations,\n onChange,\n filteringProperties,\n filteringOptions = [],\n customGroupsText = [],\n disableFreeTextFiltering = false,\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 filteringStatusType,\n asyncProperties,\n tokenLimit,\n expandToViewport,\n tokenLimitShowFewerAriaLabel,\n tokenLimitShowMoreAriaLabel,\n ...rest\n }: PropertyFilterProps,\n ref: React.Ref<Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('PropertyFilter', {\n props: { asyncProperties, disableFreeTextFiltering, expandToViewport, hideOperations, tokenLimit, virtualScroll },\n });\n const [removedTokenIndex, setRemovedTokenIndex] = useState<null | number>(null);\n\n const inputRef = useRef<AutosuggestInputRef>(null);\n const baseProps = getBaseProps(rest);\n\n const i18n = useInternalI18n('property-filter');\n const i18nStrings: PropertyFilterProps.I18nStrings = {\n ...rest.i18nStrings,\n allPropertiesLabel: i18n('i18nStrings.allPropertiesLabel', rest.i18nStrings?.allPropertiesLabel),\n applyActionText: i18n('i18nStrings.applyActionText', rest.i18nStrings?.applyActionText),\n cancelActionText: i18n('i18nStrings.cancelActionText', rest.i18nStrings?.cancelActionText),\n clearFiltersText: i18n('i18nStrings.clearFiltersText', rest.i18nStrings?.clearFiltersText),\n editTokenHeader: i18n('i18nStrings.editTokenHeader', rest.i18nStrings?.editTokenHeader),\n groupPropertiesText: i18n('i18nStrings.groupPropertiesText', rest.i18nStrings?.groupPropertiesText),\n groupValuesText: i18n('i18nStrings.groupValuesText', rest.i18nStrings?.groupValuesText),\n operationAndText: i18n('i18nStrings.operationAndText', rest.i18nStrings?.operationAndText),\n operationOrText: i18n('i18nStrings.operationOrText', rest.i18nStrings?.operationOrText),\n operatorContainsText: i18n('i18nStrings.operatorContainsText', rest.i18nStrings?.operatorContainsText),\n operatorDoesNotContainText: i18n(\n 'i18nStrings.operatorDoesNotContainText',\n rest.i18nStrings?.operatorDoesNotContainText\n ),\n operatorDoesNotEqualText: i18n(\n 'i18nStrings.operatorDoesNotEqualText',\n rest.i18nStrings?.operatorDoesNotEqualText\n ),\n operatorEqualsText: i18n('i18nStrings.operatorEqualsText', rest.i18nStrings?.operatorEqualsText),\n operatorGreaterOrEqualText: i18n(\n 'i18nStrings.operatorGreaterOrEqualText',\n rest.i18nStrings?.operatorGreaterOrEqualText\n ),\n operatorGreaterText: i18n('i18nStrings.operatorGreaterText', rest.i18nStrings?.operatorGreaterText),\n operatorLessOrEqualText: i18n('i18nStrings.operatorLessOrEqualText', rest.i18nStrings?.operatorLessOrEqualText),\n operatorLessText: i18n('i18nStrings.operatorLessText', rest.i18nStrings?.operatorLessText),\n operatorStartsWithText: i18n('i18nStrings.operatorStartsWithText', rest.i18nStrings?.operatorStartsWithText),\n operatorDoesNotStartWithText: i18n(\n 'i18nStrings.operatorDoesNotStartWithText',\n rest.i18nStrings?.operatorDoesNotStartWithText\n ),\n operatorText: i18n('i18nStrings.operatorText', rest.i18nStrings?.operatorText),\n operatorsText: i18n('i18nStrings.operatorsText', rest.i18nStrings?.operatorsText),\n propertyText: i18n('i18nStrings.propertyText', rest.i18nStrings?.propertyText),\n tokenLimitShowFewer: i18n('i18nStrings.tokenLimitShowFewer', rest.i18nStrings?.tokenLimitShowFewer),\n tokenLimitShowMore: i18n('i18nStrings.tokenLimitShowMore', rest.i18nStrings?.tokenLimitShowMore),\n valueText: i18n('i18nStrings.valueText', rest.i18nStrings?.valueText),\n removeTokenButtonAriaLabel: i18n(\n 'i18nStrings.removeTokenButtonAriaLabel',\n rest.i18nStrings?.removeTokenButtonAriaLabel,\n format => token =>\n format({\n token__operator: getOperatorI18nString(token.operator),\n token__propertyKey: token.propertyKey ?? '',\n token__value: token.value,\n })\n ),\n };\n\n useImperativeHandle(ref, () => ({ focus: () => inputRef.current?.focus() }), []);\n const showResults = !!query.tokens?.length && !disabled && !!countText;\n const { addToken, removeToken, setToken, setOperation, removeAllTokens } = getQueryActions(\n query,\n onChange,\n inputRef\n );\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 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 const internalQuery: InternalQuery = {\n operation: query.operation,\n tokens: query.tokens.map(token => ({\n property: token.propertyKey ? getProperty(token.propertyKey) : null,\n operator: token.operator,\n value: token.value,\n })),\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 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: Token;\n switch (parsedText.step) {\n case 'property': {\n newToken = matchTokenValue(\n {\n property: parsedText.property,\n operator: parsedText.operator,\n value: parsedText.value,\n },\n internalOptions\n );\n break;\n }\n case 'free-text': {\n newToken = {\n operator: parsedText.operator || internalFreeText.defaultOperator,\n value: parsedText.value,\n };\n break;\n }\n case 'operator': {\n newToken = {\n operator: internalFreeText.defaultOperator,\n value: currentText,\n };\n break;\n }\n }\n if (internalFreeText.disabled && !('propertyKey' in newToken)) {\n return;\n }\n addToken(newToken);\n setFilteringText('');\n };\n const ignoreKeyDown = useRef<boolean>(false);\n const handleKeyDown: PropertyFilterAutosuggestProps['onKeyDown'] = event => {\n if (filteringText && !ignoreKeyDown.current && event.detail.keyCode === KeyCode.enter) {\n createToken(filteringText);\n }\n };\n const getLoadMoreDetail = (parsedText: ParsedText, filteringText: string) => {\n const loadMoreDetail: {\n filteringProperty: FilteringProperty | undefined;\n filteringText: string;\n filteringOperator: ComparisonOperator | undefined;\n } = {\n filteringProperty: undefined,\n filteringText,\n filteringOperator: undefined,\n };\n if (parsedText.step === 'property') {\n loadMoreDetail.filteringProperty = parsedText.property.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 // The ignoreKeyDown flag makes sure `createToken` routine runs only once. Autosuggest's `onKeyDown` fires,\n // when an item is selected from the list using \"enter\" key.\n ignoreKeyDown.current = true;\n setTimeout(() => {\n ignoreKeyDown.current = false;\n }, 0);\n const { detail: option } = event;\n const value = option.value || '';\n\n if (!('keepOpenOnSelect' in option)) {\n createToken(value);\n return;\n }\n\n // stop dropdown from closing\n event.preventDefault();\n\n const parsedText = parseText(value, 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 operatorForm =\n parsedText.step === 'property' && parsedText.property.getValueFormRenderer(parsedText.operator);\n\n const searchResultsId = useUniqueId('property-filter-search-results');\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <div className={styles['search-field']}>\n {customControl && <div className={styles['custom-control']}>{customControl}</div>}\n <PropertyFilterAutosuggest\n ref={inputRef}\n virtualScroll={virtualScroll}\n enteredTextLabel={i18nStrings.enteredTextLabel}\n ariaLabel={filteringAriaLabel ?? i18nStrings.filteringAriaLabel}\n placeholder={filteringPlaceholder ?? i18nStrings.filteringPlaceholder}\n ariaLabelledby={rest.ariaLabelledby}\n ariaDescribedby={rest.ariaDescribedby}\n controlId={rest.controlId}\n value={filteringText}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n {...autosuggestOptions}\n onChange={event => setFilteringText(event.detail.value)}\n empty={filteringEmpty}\n {...asyncAutosuggestProps}\n expandToViewport={expandToViewport}\n onOptionClick={handleSelected}\n customForm={\n operatorForm && (\n <PropertyEditor\n property={parsedText.property}\n operator={parsedText.operator}\n filter={parsedText.value}\n operatorForm={operatorForm}\n i18nStrings={i18nStrings}\n onCancel={() => {\n setFilteringText('');\n inputRef.current?.close();\n inputRef.current?.focus({ preventDropdown: true });\n }}\n onSubmit={token => {\n addToken(token);\n setFilteringText('');\n inputRef.current?.focus({ preventDropdown: true });\n inputRef.current?.close();\n }}\n />\n )\n }\n hideEnteredTextOption={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 {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={(token, tokenIndex) => (\n <TokenButton\n token={token}\n first={tokenIndex === 0}\n operation={internalQuery.operation}\n removeToken={() => {\n removeToken(tokenIndex);\n setRemovedTokenIndex(tokenIndex);\n }}\n setToken={(newToken: Token) => setToken(tokenIndex, newToken)}\n setOperation={setOperation}\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 />\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 <InternalButton\n formAction=\"none\"\n onClick={removeAllTokens}\n className={styles['remove-all']}\n disabled={disabled}\n >\n {i18nStrings.clearFiltersText}\n </InternalButton>\n )\n }\n moveFocusNextToIndex={removedTokenIndex}\n />\n </InternalSpaceBetween>\n </div>\n )}\n </div>\n );\n }\n);\n\napplyDisplayName(PropertyFilter, 'PropertyFilter');\nexport default PropertyFilter;\n"]}
@@ -177,6 +177,16 @@ export interface PropertyFilterProps extends BaseComponentProps, ExpandToViewpor
177
177
  * * `error` - Indicates that an error occurred during fetch. You should use `recoveryText` to enable the user to recover.
178
178
  **/
179
179
  filteringStatusType?: DropdownStatusProps.StatusType;
180
+ /**
181
+ * Adds an aria-label to the "Show fewer" button for the token group control.
182
+ * Use to assign unique labels when there are multiple token groups with the same `tokenLimitShowFewer` label on one page.
183
+ */
184
+ tokenLimitShowFewerAriaLabel?: string;
185
+ /**
186
+ * Adds an aria-label to the "Show more" button for the token group control.
187
+ * Use to assign unique labels when there are multiple token groups with the same `tokenLimitShowMore` label on one page.
188
+ */
189
+ tokenLimitShowMoreAriaLabel?: string;
180
190
  }
181
191
  export declare namespace PropertyFilterProps {
182
192
  type Token = PropertyFilterToken;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,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,EACpB,MAAM,qCAAqC,CAAC;AAE7C,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;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;OAUG;IACH,KAAK,EAAE,mBAAmB,CAAC,KAAK,CAAC;IACjC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,QAA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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';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport {\n PropertyFilterFreeTextFiltering,\n PropertyFilterOperation,\n PropertyFilterOperator,\n PropertyFilterOperatorExtended,\n PropertyFilterOperatorForm,\n PropertyFilterOperatorFormat,\n PropertyFilterOperatorFormProps,\n PropertyFilterOption,\n PropertyFilterProperty,\n PropertyFilterToken,\n} from '@cloudscape-design/collection-hooks';\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. Has two properties: `tokens` and `operation`.\n * `tokens` is an array of objects that will be displayed to the user beneath the filtering input.\n * Each token has the following properties:\n *\n * * value [string]: The string value of the token to be used as a filter.\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 * `operation` has two valid values [and, or] and controls the join operation to be applied between tokens when filtering the items.\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 hideOperations?: 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` asynchronousely. 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 * 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\nexport namespace PropertyFilterProps {\n export type Token = PropertyFilterToken;\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\n export interface Query {\n tokens: ReadonlyArray<PropertyFilterProps.Token>;\n operation: PropertyFilterProps.JoinOperation;\n }\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 tokenLimitShowMore?: string;\n tokenLimitShowFewer?: string;\n clearFiltersText?: string;\n tokenOperatorAriaLabel?: string;\n removeTokenButtonAriaLabel?: (token: PropertyFilterProps.Token) => string;\n enteredTextLabel?: AutosuggestProps.EnteredTextLabel;\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 JoinOperation = PropertyFilterProps.JoinOperation;\nexport type ComparisonOperator = PropertyFilterProps.ComparisonOperator;\nexport type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\nexport type ExtendedOperatorFormProps<TokenValue> = PropertyFilterOperatorFormProps<TokenValue>;\nexport type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\nexport type ExtendedOperatorFormat<TokenValue> = PropertyFilterOperatorFormat<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 FilteringChangeDetail = PropertyFilterProps.FilteringChangeDetail;\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 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 property: null | InternalFilteringProperty<TokenValue>;\n operator: PropertyFilterOperator;\n value: TokenValue;\n}\n\nexport interface InternalQuery {\n operation: PropertyFilterOperation;\n tokens: readonly InternalToken[];\n}\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';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport {\n PropertyFilterFreeTextFiltering,\n PropertyFilterOperation,\n PropertyFilterOperator,\n PropertyFilterOperatorExtended,\n PropertyFilterOperatorForm,\n PropertyFilterOperatorFormat,\n PropertyFilterOperatorFormProps,\n PropertyFilterOption,\n PropertyFilterProperty,\n PropertyFilterToken,\n} from '@cloudscape-design/collection-hooks';\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. Has two properties: `tokens` and `operation`.\n * `tokens` is an array of objects that will be displayed to the user beneath the filtering input.\n * Each token has the following properties:\n *\n * * value [string]: The string value of the token to be used as a filter.\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 * `operation` has two valid values [and, or] and controls the join operation to be applied between tokens when filtering the items.\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 hideOperations?: 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` asynchronousely. 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 * 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 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\n export interface Query {\n tokens: ReadonlyArray<PropertyFilterProps.Token>;\n operation: PropertyFilterProps.JoinOperation;\n }\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 tokenLimitShowMore?: string;\n tokenLimitShowFewer?: string;\n clearFiltersText?: string;\n tokenOperatorAriaLabel?: string;\n removeTokenButtonAriaLabel?: (token: PropertyFilterProps.Token) => string;\n enteredTextLabel?: AutosuggestProps.EnteredTextLabel;\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 JoinOperation = PropertyFilterProps.JoinOperation;\nexport type ComparisonOperator = PropertyFilterProps.ComparisonOperator;\nexport type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\nexport type ExtendedOperatorFormProps<TokenValue> = PropertyFilterOperatorFormProps<TokenValue>;\nexport type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\nexport type ExtendedOperatorFormat<TokenValue> = PropertyFilterOperatorFormat<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 FilteringChangeDetail = PropertyFilterProps.FilteringChangeDetail;\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 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 property: null | InternalFilteringProperty<TokenValue>;\n operator: PropertyFilterOperator;\n value: TokenValue;\n}\n\nexport interface InternalQuery {\n operation: PropertyFilterOperation;\n tokens: readonly InternalToken[];\n}\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"]}
@@ -66,6 +66,12 @@ class GridNavigationProcessor {
66
66
  this.focusablesState.set(focusableElement, newIsFocusable);
67
67
  changeHandler(newIsFocusable);
68
68
  }
69
+ // When newly registered element belongs to the focused cell the focus must transition to it.
70
+ if (this.focusedCell &&
71
+ this.focusedCell.element.tagName === 'TD' &&
72
+ this.focusedCell.element.contains(focusableElement)) {
73
+ focusableElement.focus();
74
+ }
69
75
  return () => this.unregisterFocusable(focusableElement);
70
76
  };
71
77
  this.unregisterFocusable = (focusable) => {
@@ -1 +1 @@
1
- {"version":3,"file":"grid-navigation.js","sourceRoot":"","sources":["../../../../src/table/table-role/grid-navigation.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,8BAA8B,EAC9B,cAAc,EACd,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAEjB,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AO,MAAA,oBAAoB,CAAC,UAAU,CAAC,mCAAI,UAAU,CAAC;IACxD,CAAC;IAEO,kBAAkB;;QACxB,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;QAC9B,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAgC,CAAC;QAExF,wDAAwD;QACxD,qGAAqG;QACrG,IAAI,WAAW,GACb,MAAA,CAAC,cAAc,IAAI,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,mCAAI,cAAc,CAAC;QAElF,oGAAoG;QACpG,IAAI,IAAI,EAAE;YACR,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SAC3D;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,iBAAiB,CAAC,MAAmB;QAC3C,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;IAClG,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport { useEffect, useMemo } from 'react';\nimport {\n defaultIsSuppressed,\n findTableRowByAriaRowIndex,\n findTableRowCellByAriaColIndex,\n getClosestCell,\n isElementDisabled,\n} from './utils';\nimport { FocusedCell, GridNavigationProps } from './interfaces';\nimport { KeyCode } from '../../internal/keycode';\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\nimport { nodeBelongs } from '../../internal/utils/node-belongs';\nimport { getAllFocusables } from '../../internal/components/focus-lock/utils';\nimport {\n SingleTabStopNavigationContext,\n FocusableChangeHandler,\n} from '../../internal/context/single-tab-stop-navigation-context';\n\n/**\n * Makes table navigable with keyboard commands.\n * See grid-navigation.md\n */\nexport function GridNavigationProvider({ keyboardNavigation, pageSize, getTable, children }: GridNavigationProps) {\n const gridNavigation = useMemo(() => new GridNavigationProcessor(), []);\n\n const getTableStable = useStableCallback(getTable);\n\n // Initialize the processor with the table container assuming it is mounted synchronously and only once.\n useEffect(() => {\n if (keyboardNavigation) {\n const table = getTableStable();\n table && gridNavigation.init(table);\n }\n return () => gridNavigation.cleanup();\n }, [keyboardNavigation, gridNavigation, getTableStable]);\n\n // Notify the processor of the props change.\n useEffect(() => {\n gridNavigation.update({ pageSize });\n }, [gridNavigation, pageSize]);\n\n // Notify the processor of the new render.\n useEffect(() => {\n if (keyboardNavigation) {\n gridNavigation.refresh();\n }\n });\n\n return (\n <SingleTabStopNavigationContext.Provider\n value={{\n navigationActive: keyboardNavigation,\n registerFocusable: gridNavigation.registerFocusable,\n }}\n >\n {children}\n </SingleTabStopNavigationContext.Provider>\n );\n}\n\n/**\n * This helper encapsulates the grid navigation behaviors which are:\n * 1. Responding to keyboard commands and moving the focus accordingly;\n * 2. Muting table interactive elements for only one to be user-focusable at a time;\n * 3. Suppressing the above behaviors when focusing an element inside a dialog or when instructed explicitly.\n */\nclass GridNavigationProcessor {\n // Props\n private _pageSize = 0;\n private _table: null | HTMLTableElement = null;\n\n // State\n private focusedCell: null | FocusedCell = null;\n private keepUserIndex = false;\n private focusables = new Set<Element>();\n private focusHandlers = new Map<Element, FocusableChangeHandler>();\n private focusablesState = new WeakMap<Element, boolean>();\n private focusTarget: null | Element = null;\n\n public init(table: HTMLTableElement) {\n this._table = table;\n\n this.table.addEventListener('focusin', this.onFocusin);\n this.table.addEventListener('focusout', this.onFocusout);\n this.table.addEventListener('keydown', this.onKeydown);\n\n this.updateFocusTarget();\n\n this.cleanup = () => {\n this.table.removeEventListener('focusin', this.onFocusin);\n this.table.removeEventListener('focusout', this.onFocusout);\n this.table.removeEventListener('keydown', this.onKeydown);\n this.focusables.forEach(this.unregisterFocusable);\n };\n }\n\n public cleanup() {\n // Do nothing before initialized.\n }\n\n public update({ pageSize }: { pageSize: number }) {\n this._pageSize = pageSize;\n }\n\n public refresh() {\n // Timeout ensures the newly rendered content elements are registered.\n setTimeout(() => {\n if (this._table) {\n // Update focused cell indices in case table rows, columns, or firstIndex change.\n this.updateFocusedCell(this.focusedCell?.element);\n this.updateFocusTarget();\n }\n }, 0);\n }\n\n public registerFocusable = (focusableElement: Element, changeHandler: FocusableChangeHandler) => {\n this.focusables.add(focusableElement);\n this.focusHandlers.set(focusableElement, changeHandler);\n const isFocusable = this.focusablesState.get(focusableElement) ?? false;\n const newIsFocusable = this.focusTarget === focusableElement || this.isSuppressed(focusableElement);\n if (newIsFocusable !== isFocusable) {\n this.focusablesState.set(focusableElement, newIsFocusable);\n changeHandler(newIsFocusable);\n }\n return () => this.unregisterFocusable(focusableElement);\n };\n\n public unregisterFocusable = (focusable: Element) => {\n this.focusables.delete(focusable);\n this.focusHandlers.delete(focusable);\n };\n\n private get pageSize() {\n return this._pageSize;\n }\n\n private get table(): HTMLTableElement {\n if (!this._table) {\n throw new Error('Invariant violation: GridNavigationProcessor is used before initialization.');\n }\n return this._table;\n }\n\n private onFocusin = (event: FocusEvent) => {\n if (!(event.target instanceof HTMLElement)) {\n return;\n }\n\n this.updateFocusedCell(event.target);\n if (!this.focusedCell) {\n return;\n }\n\n this.updateFocusTarget();\n\n // Focusing on cell is not eligible when it contains focusable elements in the content.\n // If content focusables are available - move the focus to the first one.\n const cellElement = getClosestCell(this.focusedCell.element);\n const nextTarget = this.focusedCell.element === cellElement ? this.getFocusablesFrom(cellElement)[0] : null;\n if (nextTarget) {\n nextTarget.focus();\n } else {\n this.keepUserIndex = false;\n }\n };\n\n private onFocusout = () => {\n // When focus leaves the cell and the cell no longer belong to the table it indicates the focused element has been unmounted.\n // In that case the focus needs to be restored on the same coordinates.\n setTimeout(() => {\n if (this.focusedCell && !nodeBelongs(this.table, this.focusedCell.element)) {\n this.moveFocusBy(this.focusedCell, { x: 0, y: 0 });\n }\n }, 0);\n };\n\n private onKeydown = (event: KeyboardEvent) => {\n if (!this.focusedCell) {\n return;\n }\n\n const ctrlKey = event.ctrlKey ? 1 : 0;\n const altKey = event.altKey ? 1 : 0;\n const shiftKey = event.shiftKey ? 1 : 0;\n const metaKey = event.metaKey ? 1 : 0;\n const numModifiersPressed = ctrlKey + altKey + shiftKey + metaKey;\n\n let key = event.keyCode;\n if (numModifiersPressed === 1 && event.ctrlKey) {\n key = -key;\n } else if (numModifiersPressed) {\n return;\n }\n\n const from = this.focusedCell;\n\n if (this.isSuppressed(document.activeElement) || !this.isRegistered(document.activeElement)) {\n return;\n }\n\n switch (key) {\n case KeyCode.up:\n event.preventDefault();\n return this.moveFocusBy(from, { y: -1, x: 0 });\n\n case KeyCode.down:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 1, x: 0 });\n\n case KeyCode.left:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: -1 });\n\n case KeyCode.right:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: 1 });\n\n case KeyCode.pageUp:\n event.preventDefault();\n return this.moveFocusBy(from, { y: -this.pageSize, x: 0 });\n\n case KeyCode.pageDown:\n event.preventDefault();\n return this.moveFocusBy(from, { y: this.pageSize, x: 0 });\n\n case KeyCode.home:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: -Infinity });\n\n case KeyCode.end:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: Infinity });\n\n case -KeyCode.home:\n event.preventDefault();\n return this.moveFocusBy(from, { y: -Infinity, x: -Infinity });\n\n case -KeyCode.end:\n event.preventDefault();\n return this.moveFocusBy(from, { y: Infinity, x: Infinity });\n\n default:\n return;\n }\n };\n\n private moveFocusBy(cell: FocusedCell, delta: { x: number; y: number }) {\n // For vertical moves preserve column- and element indices set by user.\n // It allows keeping indices while moving over disabled actions or cells with colspan > 1.\n if (delta.y !== 0 && delta.x === 0) {\n this.keepUserIndex = true;\n }\n this.getNextFocusable(cell, delta)?.focus();\n }\n\n private updateFocusTarget() {\n this.focusTarget = this.getSingleFocusable();\n for (const focusableElement of this.focusables) {\n const isFocusable = this.focusablesState.get(focusableElement) ?? false;\n const newIsFocusable = this.focusTarget === focusableElement || this.isSuppressed(focusableElement);\n if (newIsFocusable !== isFocusable) {\n this.focusablesState.set(focusableElement, newIsFocusable);\n this.focusHandlers.get(focusableElement)!(newIsFocusable);\n }\n }\n }\n\n private isSuppressed(element: null | Element) {\n // Omit calculation as irrelevant until the table receives focus.\n if (!this.focusedCell) {\n return false;\n }\n return !element || defaultIsSuppressed(element);\n }\n\n private isRegistered(element: null | Element) {\n return !element || this.focusables.has(element);\n }\n\n private updateFocusedCell(focusedElement?: HTMLElement): void {\n if (!focusedElement) {\n return;\n }\n\n const cellElement = getClosestCell(focusedElement);\n const rowElement = cellElement?.closest('tr');\n if (!cellElement || !rowElement) {\n return;\n }\n\n const colIndex = parseInt(cellElement.getAttribute('aria-colindex') ?? '');\n const rowIndex = parseInt(rowElement.getAttribute('aria-rowindex') ?? '');\n if (isNaN(colIndex) || isNaN(rowIndex)) {\n return;\n }\n\n const cellFocusables = this.getFocusablesFrom(cellElement);\n const elementIndex = cellFocusables.indexOf(focusedElement);\n\n const prevColIndex = this.focusedCell?.colIndex ?? -1;\n const prevElementIndex = this.focusedCell?.elementIndex ?? -1;\n this.focusedCell = {\n rowIndex,\n colIndex: this.keepUserIndex && prevColIndex !== -1 ? prevColIndex : colIndex,\n elementIndex: this.keepUserIndex && prevElementIndex !== -1 ? prevElementIndex : elementIndex,\n element: focusedElement,\n };\n }\n\n private getNextFocusable(from: FocusedCell, delta: { y: number; x: number }) {\n // Find next row to move focus into (can be null if the top/bottom is reached).\n const targetAriaRowIndex = from.rowIndex + delta.y;\n const targetRow = findTableRowByAriaRowIndex(this.table, targetAriaRowIndex, delta.y);\n if (!targetRow) {\n return null;\n }\n\n // Return next interactive cell content element if available.\n const cellElement = getClosestCell(from.element);\n const cellFocusables = cellElement ? this.getFocusablesFrom(cellElement) : [];\n const nextElementIndex = from.elementIndex + delta.x;\n const isValidDirection = !!delta.x;\n const isValidIndex = from.elementIndex !== -1 && 0 <= nextElementIndex && nextElementIndex < cellFocusables.length;\n const isTargetDifferent = from.element !== cellFocusables[nextElementIndex];\n if (isValidDirection && isValidIndex && isTargetDifferent) {\n return cellFocusables[nextElementIndex];\n }\n\n // Find next cell to focus or move focus into (can be null if the left/right edge is reached).\n const targetAriaColIndex = from.colIndex + delta.x;\n const targetCell = findTableRowCellByAriaColIndex(targetRow, targetAriaColIndex, delta.x);\n if (!targetCell) {\n return null;\n }\n\n // When target cell matches the current cell it means we reached the left or right boundary.\n if (targetCell === cellElement && delta.x !== 0) {\n return null;\n }\n\n const targetCellFocusables = this.getFocusablesFrom(targetCell);\n\n // When delta.x = 0 keep element index if possible.\n let focusIndex = from.elementIndex;\n // Use first element index when moving to the right or to extreme left.\n if ((isFinite(delta.x) && delta.x > 0) || delta.x === -Infinity) {\n focusIndex = 0;\n }\n // Use last element index when moving to the left or to extreme right.\n if ((isFinite(delta.x) && delta.x < 0) || delta.x === Infinity) {\n focusIndex = targetCellFocusables.length - 1;\n }\n\n return targetCellFocusables[focusIndex] ?? targetCell;\n }\n\n private getSingleFocusable() {\n const cell = this.focusedCell;\n const firstTableCell = this.table.querySelector('td,th') as null | HTMLTableCellElement;\n\n // A single element of the table is made user-focusable.\n // It defaults to the first interactive element of the first cell or the first cell itself otherwise.\n let focusTarget: null | HTMLElement =\n (firstTableCell && this.getFocusablesFrom(firstTableCell)[0]) ?? firstTableCell;\n\n // When a navigation-focused element is present in the table it is used for user-navigation instead.\n if (cell) {\n focusTarget = this.getNextFocusable(cell, { x: 0, y: 0 });\n }\n\n return focusTarget;\n }\n\n private getFocusablesFrom(target: HTMLElement) {\n return getAllFocusables(target).filter(el => this.focusables.has(el) && !isElementDisabled(el));\n }\n}\n"]}
1
+ {"version":3,"file":"grid-navigation.js","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AAG,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;IAClG,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport { useEffect, useMemo } from 'react';\nimport {\n defaultIsSuppressed,\n findTableRowByAriaRowIndex,\n findTableRowCellByAriaColIndex,\n getClosestCell,\n isElementDisabled,\n} from './utils';\nimport { FocusedCell, GridNavigationProps } from './interfaces';\nimport { KeyCode } from '../../internal/keycode';\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\nimport { nodeBelongs } from '../../internal/utils/node-belongs';\nimport { getAllFocusables } from '../../internal/components/focus-lock/utils';\nimport {\n SingleTabStopNavigationContext,\n FocusableChangeHandler,\n} from '../../internal/context/single-tab-stop-navigation-context';\n\n/**\n * Makes table navigable with keyboard commands.\n * See grid-navigation.md\n */\nexport function GridNavigationProvider({ keyboardNavigation, pageSize, getTable, children }: GridNavigationProps) {\n const gridNavigation = useMemo(() => new GridNavigationProcessor(), []);\n\n const getTableStable = useStableCallback(getTable);\n\n // Initialize the processor with the table container assuming it is mounted synchronously and only once.\n useEffect(() => {\n if (keyboardNavigation) {\n const table = getTableStable();\n table && gridNavigation.init(table);\n }\n return () => gridNavigation.cleanup();\n }, [keyboardNavigation, gridNavigation, getTableStable]);\n\n // Notify the processor of the props change.\n useEffect(() => {\n gridNavigation.update({ pageSize });\n }, [gridNavigation, pageSize]);\n\n // Notify the processor of the new render.\n useEffect(() => {\n if (keyboardNavigation) {\n gridNavigation.refresh();\n }\n });\n\n return (\n <SingleTabStopNavigationContext.Provider\n value={{\n navigationActive: keyboardNavigation,\n registerFocusable: gridNavigation.registerFocusable,\n }}\n >\n {children}\n </SingleTabStopNavigationContext.Provider>\n );\n}\n\n/**\n * This helper encapsulates the grid navigation behaviors which are:\n * 1. Responding to keyboard commands and moving the focus accordingly;\n * 2. Muting table interactive elements for only one to be user-focusable at a time;\n * 3. Suppressing the above behaviors when focusing an element inside a dialog or when instructed explicitly.\n */\nclass GridNavigationProcessor {\n // Props\n private _pageSize = 0;\n private _table: null | HTMLTableElement = null;\n\n // State\n private focusedCell: null | FocusedCell = null;\n private keepUserIndex = false;\n private focusables = new Set<Element>();\n private focusHandlers = new Map<Element, FocusableChangeHandler>();\n private focusablesState = new WeakMap<Element, boolean>();\n private focusTarget: null | Element = null;\n\n public init(table: HTMLTableElement) {\n this._table = table;\n\n this.table.addEventListener('focusin', this.onFocusin);\n this.table.addEventListener('focusout', this.onFocusout);\n this.table.addEventListener('keydown', this.onKeydown);\n\n this.updateFocusTarget();\n\n this.cleanup = () => {\n this.table.removeEventListener('focusin', this.onFocusin);\n this.table.removeEventListener('focusout', this.onFocusout);\n this.table.removeEventListener('keydown', this.onKeydown);\n this.focusables.forEach(this.unregisterFocusable);\n };\n }\n\n public cleanup() {\n // Do nothing before initialized.\n }\n\n public update({ pageSize }: { pageSize: number }) {\n this._pageSize = pageSize;\n }\n\n public refresh() {\n // Timeout ensures the newly rendered content elements are registered.\n setTimeout(() => {\n if (this._table) {\n // Update focused cell indices in case table rows, columns, or firstIndex change.\n this.updateFocusedCell(this.focusedCell?.element);\n this.updateFocusTarget();\n }\n }, 0);\n }\n\n public registerFocusable = (focusableElement: HTMLElement, changeHandler: FocusableChangeHandler) => {\n this.focusables.add(focusableElement);\n this.focusHandlers.set(focusableElement, changeHandler);\n const isFocusable = this.focusablesState.get(focusableElement) ?? false;\n const newIsFocusable = this.focusTarget === focusableElement || this.isSuppressed(focusableElement);\n if (newIsFocusable !== isFocusable) {\n this.focusablesState.set(focusableElement, newIsFocusable);\n changeHandler(newIsFocusable);\n }\n // When newly registered element belongs to the focused cell the focus must transition to it.\n if (\n this.focusedCell &&\n this.focusedCell.element.tagName === 'TD' &&\n this.focusedCell.element.contains(focusableElement)\n ) {\n focusableElement.focus();\n }\n return () => this.unregisterFocusable(focusableElement);\n };\n\n public unregisterFocusable = (focusable: Element) => {\n this.focusables.delete(focusable);\n this.focusHandlers.delete(focusable);\n };\n\n private get pageSize() {\n return this._pageSize;\n }\n\n private get table(): HTMLTableElement {\n if (!this._table) {\n throw new Error('Invariant violation: GridNavigationProcessor is used before initialization.');\n }\n return this._table;\n }\n\n private onFocusin = (event: FocusEvent) => {\n if (!(event.target instanceof HTMLElement)) {\n return;\n }\n\n this.updateFocusedCell(event.target);\n if (!this.focusedCell) {\n return;\n }\n\n this.updateFocusTarget();\n\n // Focusing on cell is not eligible when it contains focusable elements in the content.\n // If content focusables are available - move the focus to the first one.\n const cellElement = getClosestCell(this.focusedCell.element);\n const nextTarget = this.focusedCell.element === cellElement ? this.getFocusablesFrom(cellElement)[0] : null;\n if (nextTarget) {\n nextTarget.focus();\n } else {\n this.keepUserIndex = false;\n }\n };\n\n private onFocusout = () => {\n // When focus leaves the cell and the cell no longer belong to the table it indicates the focused element has been unmounted.\n // In that case the focus needs to be restored on the same coordinates.\n setTimeout(() => {\n if (this.focusedCell && !nodeBelongs(this.table, this.focusedCell.element)) {\n this.moveFocusBy(this.focusedCell, { x: 0, y: 0 });\n }\n }, 0);\n };\n\n private onKeydown = (event: KeyboardEvent) => {\n if (!this.focusedCell) {\n return;\n }\n\n const ctrlKey = event.ctrlKey ? 1 : 0;\n const altKey = event.altKey ? 1 : 0;\n const shiftKey = event.shiftKey ? 1 : 0;\n const metaKey = event.metaKey ? 1 : 0;\n const numModifiersPressed = ctrlKey + altKey + shiftKey + metaKey;\n\n let key = event.keyCode;\n if (numModifiersPressed === 1 && event.ctrlKey) {\n key = -key;\n } else if (numModifiersPressed) {\n return;\n }\n\n const from = this.focusedCell;\n\n if (this.isSuppressed(document.activeElement) || !this.isRegistered(document.activeElement)) {\n return;\n }\n\n switch (key) {\n case KeyCode.up:\n event.preventDefault();\n return this.moveFocusBy(from, { y: -1, x: 0 });\n\n case KeyCode.down:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 1, x: 0 });\n\n case KeyCode.left:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: -1 });\n\n case KeyCode.right:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: 1 });\n\n case KeyCode.pageUp:\n event.preventDefault();\n return this.moveFocusBy(from, { y: -this.pageSize, x: 0 });\n\n case KeyCode.pageDown:\n event.preventDefault();\n return this.moveFocusBy(from, { y: this.pageSize, x: 0 });\n\n case KeyCode.home:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: -Infinity });\n\n case KeyCode.end:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: Infinity });\n\n case -KeyCode.home:\n event.preventDefault();\n return this.moveFocusBy(from, { y: -Infinity, x: -Infinity });\n\n case -KeyCode.end:\n event.preventDefault();\n return this.moveFocusBy(from, { y: Infinity, x: Infinity });\n\n default:\n return;\n }\n };\n\n private moveFocusBy(cell: FocusedCell, delta: { x: number; y: number }) {\n // For vertical moves preserve column- and element indices set by user.\n // It allows keeping indices while moving over disabled actions or cells with colspan > 1.\n if (delta.y !== 0 && delta.x === 0) {\n this.keepUserIndex = true;\n }\n this.getNextFocusable(cell, delta)?.focus();\n }\n\n private updateFocusTarget() {\n this.focusTarget = this.getSingleFocusable();\n for (const focusableElement of this.focusables) {\n const isFocusable = this.focusablesState.get(focusableElement) ?? false;\n const newIsFocusable = this.focusTarget === focusableElement || this.isSuppressed(focusableElement);\n if (newIsFocusable !== isFocusable) {\n this.focusablesState.set(focusableElement, newIsFocusable);\n this.focusHandlers.get(focusableElement)!(newIsFocusable);\n }\n }\n }\n\n private isSuppressed(element: null | Element) {\n // Omit calculation as irrelevant until the table receives focus.\n if (!this.focusedCell) {\n return false;\n }\n return !element || defaultIsSuppressed(element);\n }\n\n private isRegistered(element: null | Element) {\n return !element || this.focusables.has(element);\n }\n\n private updateFocusedCell(focusedElement?: HTMLElement): void {\n if (!focusedElement) {\n return;\n }\n\n const cellElement = getClosestCell(focusedElement);\n const rowElement = cellElement?.closest('tr');\n if (!cellElement || !rowElement) {\n return;\n }\n\n const colIndex = parseInt(cellElement.getAttribute('aria-colindex') ?? '');\n const rowIndex = parseInt(rowElement.getAttribute('aria-rowindex') ?? '');\n if (isNaN(colIndex) || isNaN(rowIndex)) {\n return;\n }\n\n const cellFocusables = this.getFocusablesFrom(cellElement);\n const elementIndex = cellFocusables.indexOf(focusedElement);\n\n const prevColIndex = this.focusedCell?.colIndex ?? -1;\n const prevElementIndex = this.focusedCell?.elementIndex ?? -1;\n this.focusedCell = {\n rowIndex,\n colIndex: this.keepUserIndex && prevColIndex !== -1 ? prevColIndex : colIndex,\n elementIndex: this.keepUserIndex && prevElementIndex !== -1 ? prevElementIndex : elementIndex,\n element: focusedElement,\n };\n }\n\n private getNextFocusable(from: FocusedCell, delta: { y: number; x: number }) {\n // Find next row to move focus into (can be null if the top/bottom is reached).\n const targetAriaRowIndex = from.rowIndex + delta.y;\n const targetRow = findTableRowByAriaRowIndex(this.table, targetAriaRowIndex, delta.y);\n if (!targetRow) {\n return null;\n }\n\n // Return next interactive cell content element if available.\n const cellElement = getClosestCell(from.element);\n const cellFocusables = cellElement ? this.getFocusablesFrom(cellElement) : [];\n const nextElementIndex = from.elementIndex + delta.x;\n const isValidDirection = !!delta.x;\n const isValidIndex = from.elementIndex !== -1 && 0 <= nextElementIndex && nextElementIndex < cellFocusables.length;\n const isTargetDifferent = from.element !== cellFocusables[nextElementIndex];\n if (isValidDirection && isValidIndex && isTargetDifferent) {\n return cellFocusables[nextElementIndex];\n }\n\n // Find next cell to focus or move focus into (can be null if the left/right edge is reached).\n const targetAriaColIndex = from.colIndex + delta.x;\n const targetCell = findTableRowCellByAriaColIndex(targetRow, targetAriaColIndex, delta.x);\n if (!targetCell) {\n return null;\n }\n\n // When target cell matches the current cell it means we reached the left or right boundary.\n if (targetCell === cellElement && delta.x !== 0) {\n return null;\n }\n\n const targetCellFocusables = this.getFocusablesFrom(targetCell);\n\n // When delta.x = 0 keep element index if possible.\n let focusIndex = from.elementIndex;\n // Use first element index when moving to the right or to extreme left.\n if ((isFinite(delta.x) && delta.x > 0) || delta.x === -Infinity) {\n focusIndex = 0;\n }\n // Use last element index when moving to the left or to extreme right.\n if ((isFinite(delta.x) && delta.x < 0) || delta.x === Infinity) {\n focusIndex = targetCellFocusables.length - 1;\n }\n\n return targetCellFocusables[focusIndex] ?? targetCell;\n }\n\n private getSingleFocusable() {\n const cell = this.focusedCell;\n const firstTableCell = this.table.querySelector('td,th') as null | HTMLTableCellElement;\n\n // A single element of the table is made user-focusable.\n // It defaults to the first interactive element of the first cell or the first cell itself otherwise.\n let focusTarget: null | HTMLElement =\n (firstTableCell && this.getFocusablesFrom(firstTableCell)[0]) ?? firstTableCell;\n\n // When a navigation-focused element is present in the table it is used for user-navigation instead.\n if (cell) {\n focusTarget = this.getNextFocusable(cell, { x: 0, y: 0 });\n }\n\n return focusTarget;\n }\n\n private getFocusablesFrom(target: HTMLElement) {\n return getAllFocusables(target).filter(el => this.focusables.has(el) && !isElementDisabled(el));\n }\n}\n"]}
@@ -42,6 +42,16 @@ export interface TokenGroupProps extends BaseComponentProps {
42
42
  * Make sure that you add a listener to this event to update your application state.
43
43
  */
44
44
  onDismiss?: NonCancelableEventHandler<TokenGroupProps.DismissDetail>;
45
+ /**
46
+ * Adds an `aria-label` to the "Show fewer" button.
47
+ * Use to assign unique labels when there are multiple token groups with the same `limitShowFewer` label on one page.
48
+ */
49
+ limitShowFewerAriaLabel?: string;
50
+ /**
51
+ * Adds an `aria-label` to the "Show more" button.
52
+ * Use to assign unique labels when there are multiple token groups with the same `limitShowMore` label on one page.
53
+ */
54
+ limitShowMoreAriaLabel?: string;
45
55
  }
46
56
  export declare namespace TokenGroupProps {
47
57
  type Alignment = 'horizontal' | 'vertical';
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/token-group/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,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AK,CAAC,SAAS,CAAC;QAC1B,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB;IAED,UAAiB,aAAa;QAC5B,SAAS,EAAE,MAAM,CAAC;KACnB;IAED,UAAiB,WAAW;QAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/token-group/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { IconProps } from '../icon/interfaces';\n\nexport interface TokenGroupProps extends BaseComponentProps {\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: TokenGroupProps.I18nStrings;\n\n /**\n * Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.\n */\n limit?: number;\n\n /**\n * Specifies the direction in which tokens are aligned (`horizontal | vertical`).\n */\n alignment?: TokenGroupProps.Alignment;\n\n /**\n * Removes any outer padding from the component.\n * We recommend to always enable this property.\n */\n disableOuterPadding?: boolean;\n\n /**\n *\n * An array of objects representing token items. Each token has the following properties:\n *\n * - `label` (string) - Title text of the token.\n * - `description` (string) - (Optional) Further information about the token that appears below the label.\n * - `disabled` [boolean] - (Optional) Determines whether the token is disabled.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the token.\n * - `dismissLabel` (string) - (Optional) Adds an `aria-label` to the dismiss button.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the token.\n * - `iconAlt` (string) - (Optional) Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n */\n items?: ReadonlyArray<TokenGroupProps.Item>;\n /**\n * Called when the user clicks on the dismiss button. The token won't be automatically removed.\n * Make sure that you add a listener to this event to update your application state.\n */\n onDismiss?: NonCancelableEventHandler<TokenGroupProps.DismissDetail>;\n}\n\nexport namespace TokenGroupProps {\n export type Alignment = 'horizontal' | 'vertical';\n export interface Item {\n label?: string;\n disabled?: boolean;\n labelTag?: string;\n description?: string;\n iconAlt?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n tags?: ReadonlyArray<string>;\n dismissLabel?: string;\n }\n\n export interface DismissDetail {\n itemIndex: number;\n }\n\n export interface I18nStrings {\n limitShowFewer?: string;\n limitShowMore?: string;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/token-group/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { IconProps } from '../icon/interfaces';\n\nexport interface TokenGroupProps extends BaseComponentProps {\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: TokenGroupProps.I18nStrings;\n\n /**\n * Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.\n */\n limit?: number;\n\n /**\n * Specifies the direction in which tokens are aligned (`horizontal | vertical`).\n */\n alignment?: TokenGroupProps.Alignment;\n\n /**\n * Removes any outer padding from the component.\n * We recommend to always enable this property.\n */\n disableOuterPadding?: boolean;\n\n /**\n *\n * An array of objects representing token items. Each token has the following properties:\n *\n * - `label` (string) - Title text of the token.\n * - `description` (string) - (Optional) Further information about the token that appears below the label.\n * - `disabled` [boolean] - (Optional) Determines whether the token is disabled.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the token.\n * - `dismissLabel` (string) - (Optional) Adds an `aria-label` to the dismiss button.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the token.\n * - `iconAlt` (string) - (Optional) Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n */\n items?: ReadonlyArray<TokenGroupProps.Item>;\n /**\n * Called when the user clicks on the dismiss button. The token won't be automatically removed.\n * Make sure that you add a listener to this event to update your application state.\n */\n onDismiss?: NonCancelableEventHandler<TokenGroupProps.DismissDetail>;\n /**\n * Adds an `aria-label` to the \"Show fewer\" button.\n * Use to assign unique labels when there are multiple token groups with the same `limitShowFewer` label on one page.\n */\n limitShowFewerAriaLabel?: string;\n /**\n * Adds an `aria-label` to the \"Show more\" button.\n * Use to assign unique labels when there are multiple token groups with the same `limitShowMore` label on one page.\n */\n limitShowMoreAriaLabel?: string;\n}\n\nexport namespace TokenGroupProps {\n export type Alignment = 'horizontal' | 'vertical';\n export interface Item {\n label?: string;\n disabled?: boolean;\n labelTag?: string;\n description?: string;\n iconAlt?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n tags?: ReadonlyArray<string>;\n dismissLabel?: string;\n }\n\n export interface DismissDetail {\n itemIndex: number;\n }\n\n export interface I18nStrings {\n limitShowFewer?: string;\n limitShowMore?: string;\n }\n}\n"]}
@@ -3,6 +3,6 @@ import { InternalBaseComponentProps } from '../internal/hooks/use-base-component
3
3
  import { TokenGroupProps } from './interfaces';
4
4
  import { SomeRequired } from '../internal/types';
5
5
  type InternalTokenGroupProps = SomeRequired<TokenGroupProps, 'items' | 'alignment'> & InternalBaseComponentProps;
6
- export default function InternalTokenGroup({ alignment, items, onDismiss, limit, i18nStrings, disableOuterPadding, __internalRootRef, ...props }: InternalTokenGroupProps): JSX.Element;
6
+ export default function InternalTokenGroup({ alignment, items, onDismiss, limit, i18nStrings, disableOuterPadding, limitShowFewerAriaLabel, limitShowMoreAriaLabel, __internalRootRef, ...props }: InternalTokenGroupProps): JSX.Element;
7
7
  export {};
8
8
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/token-group/internal.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOjD,KAAK,uBAAuB,GAAG,YAAY,CAAC,eAAe,EAAE,OAAO,GAAG,WAAW,CAAC,GAAG,0BAA0B,CAAC;AAEjH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,SAAS,EACT,KAAK,EACL,SAAS,EACT,KAAK,EACL,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,uBAAuB,eA+CzB"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/token-group/internal.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOjD,KAAK,uBAAuB,GAAG,YAAY,CAAC,eAAe,EAAE,OAAO,GAAG,WAAW,CAAC,GAAG,0BAA0B,CAAC;AAEjH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,SAAS,EACT,KAAK,EACL,SAAS,EACT,KAAK,EACL,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,uBAAuB,eAiDzB"}
@@ -11,7 +11,7 @@ import styles from './styles.css.js';
11
11
  import TokenList from '../internal/components/token-list';
12
12
  import { Token } from './token';
13
13
  export default function InternalTokenGroup(_a) {
14
- var { alignment, items, onDismiss, limit, i18nStrings, disableOuterPadding, __internalRootRef } = _a, props = __rest(_a, ["alignment", "items", "onDismiss", "limit", "i18nStrings", "disableOuterPadding", "__internalRootRef"]);
14
+ var { alignment, items, onDismiss, limit, i18nStrings, disableOuterPadding, limitShowFewerAriaLabel, limitShowMoreAriaLabel, __internalRootRef } = _a, props = __rest(_a, ["alignment", "items", "onDismiss", "limit", "i18nStrings", "disableOuterPadding", "limitShowFewerAriaLabel", "limitShowMoreAriaLabel", "__internalRootRef"]);
15
15
  checkControlled('TokenGroup', 'items', items, 'onDismiss', onDismiss);
16
16
  const [removedItemIndex, setRemovedItemIndex] = useState(null);
17
17
  const baseProps = getBaseProps(props);
@@ -21,7 +21,7 @@ export default function InternalTokenGroup(_a) {
21
21
  fireNonCancelableEvent(onDismiss, { itemIndex });
22
22
  setRemovedItemIndex(itemIndex);
23
23
  }, disabled: item.disabled },
24
- React.createElement(Option, { option: item, isGenericGroup: false }))), i18nStrings: i18nStrings, moveFocusNextToIndex: removedItemIndex, onExpandedClick: isExpanded => {
24
+ React.createElement(Option, { option: item, isGenericGroup: false }))), i18nStrings: i18nStrings, limitShowFewerAriaLabel: limitShowFewerAriaLabel, limitShowMoreAriaLabel: limitShowMoreAriaLabel, moveFocusNextToIndex: removedItemIndex, onExpandedClick: isExpanded => {
25
25
  if (isExpanded && limit) {
26
26
  setRemovedItemIndex(limit);
27
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/token-group/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM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,IAAI,CAAC,KAAK,EACrB,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,SAAS,EAAE,GAAG,EAAE;oBACd,sBAAsB,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;oBACjD,mBAAmB,CAAC,SAAS,CAAC,CAAC;gBACjC,CAAC,EACD,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBAEvB,oBAAC,MAAM,IAAC,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,GAAI,CACzC,CACT,EACD,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,gBAAgB,EACtC,eAAe,EAAE,UAAU,CAAC,EAAE;gBAC5B,IAAI,UAAU,IAAI,KAAK,EAAE;oBACvB,mBAAmB,CAAC,KAAK,CAAC,CAAC;iBAC5B;qBAAM;oBACL,mBAAmB,CAAC,IAAI,CAAC,CAAC;iBAC3B;YACH,CAAC,GACD,CACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\n\nimport Option from '../internal/components/option';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nimport { TokenGroupProps } from './interfaces';\nimport { SomeRequired } from '../internal/types';\nimport { getBaseProps } from '../internal/base-component';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport TokenList from '../internal/components/token-list';\nimport { Token } from './token';\n\ntype InternalTokenGroupProps = SomeRequired<TokenGroupProps, 'items' | 'alignment'> & InternalBaseComponentProps;\n\nexport default function InternalTokenGroup({\n alignment,\n items,\n onDismiss,\n limit,\n i18nStrings,\n disableOuterPadding,\n __internalRootRef,\n ...props\n}: InternalTokenGroupProps) {\n checkControlled('TokenGroup', 'items', items, 'onDismiss', onDismiss);\n\n const [removedItemIndex, setRemovedItemIndex] = useState<null | number>(null);\n\n const baseProps = getBaseProps(props);\n const hasItems = items.length > 0;\n return (\n <div\n {...baseProps}\n className={clsx(\n baseProps.className,\n styles.root,\n hasItems && styles['has-items'],\n disableOuterPadding && styles['no-padding']\n )}\n ref={__internalRootRef}\n >\n <TokenList\n alignment={alignment}\n items={items}\n limit={limit}\n renderItem={(item, itemIndex) => (\n <Token\n ariaLabel={item.label}\n dismissLabel={item.dismissLabel}\n onDismiss={() => {\n fireNonCancelableEvent(onDismiss, { itemIndex });\n setRemovedItemIndex(itemIndex);\n }}\n disabled={item.disabled}\n >\n <Option option={item} isGenericGroup={false} />\n </Token>\n )}\n i18nStrings={i18nStrings}\n moveFocusNextToIndex={removedItemIndex}\n onExpandedClick={isExpanded => {\n if (isExpanded && limit) {\n setRemovedItemIndex(limit);\n } else {\n setRemovedItemIndex(null);\n }\n }}\n />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/token-group/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAKjE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIhC,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAWjB;QAXiB,EACzC,SAAS,EACT,KAAK,EACL,SAAS,EACT,KAAK,EACL,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,OAEO,E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AE;oBACvB,mBAAmB,CAAC,KAAK,CAAC,CAAC;iBAC5B;qBAAM;oBACL,mBAAmB,CAAC,IAAI,CAAC,CAAC;iBAC3B;YACH,CAAC,GACD,CACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\n\nimport Option from '../internal/components/option';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nimport { TokenGroupProps } from './interfaces';\nimport { SomeRequired } from '../internal/types';\nimport { getBaseProps } from '../internal/base-component';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport TokenList from '../internal/components/token-list';\nimport { Token } from './token';\n\ntype InternalTokenGroupProps = SomeRequired<TokenGroupProps, 'items' | 'alignment'> & InternalBaseComponentProps;\n\nexport default function InternalTokenGroup({\n alignment,\n items,\n onDismiss,\n limit,\n i18nStrings,\n disableOuterPadding,\n limitShowFewerAriaLabel,\n limitShowMoreAriaLabel,\n __internalRootRef,\n ...props\n}: InternalTokenGroupProps) {\n checkControlled('TokenGroup', 'items', items, 'onDismiss', onDismiss);\n\n const [removedItemIndex, setRemovedItemIndex] = useState<null | number>(null);\n\n const baseProps = getBaseProps(props);\n const hasItems = items.length > 0;\n return (\n <div\n {...baseProps}\n className={clsx(\n baseProps.className,\n styles.root,\n hasItems && styles['has-items'],\n disableOuterPadding && styles['no-padding']\n )}\n ref={__internalRootRef}\n >\n <TokenList\n alignment={alignment}\n items={items}\n limit={limit}\n renderItem={(item, itemIndex) => (\n <Token\n ariaLabel={item.label}\n dismissLabel={item.dismissLabel}\n onDismiss={() => {\n fireNonCancelableEvent(onDismiss, { itemIndex });\n setRemovedItemIndex(itemIndex);\n }}\n disabled={item.disabled}\n >\n <Option option={item} isGenericGroup={false} />\n </Token>\n )}\n i18nStrings={i18nStrings}\n limitShowFewerAriaLabel={limitShowFewerAriaLabel}\n limitShowMoreAriaLabel={limitShowMoreAriaLabel}\n moveFocusNextToIndex={removedItemIndex}\n onExpandedClick={isExpanded => {\n if (isExpanded && limit) {\n setRemovedItemIndex(limit);\n } else {\n setRemovedItemIndex(null);\n }\n }}\n />\n </div>\n );\n}\n"]}