@cloudscape-design/components 3.0.1108 → 3.0.1110

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.
@@ -65,6 +65,9 @@ export interface AutosuggestProps extends BaseComponentProps, BaseInputProps, In
65
65
  enteredTextLabel?: AutosuggestProps.EnteredTextLabel;
66
66
  /**
67
67
  * Specifies the text to display with the number of matches at the bottom of the dropdown menu while filtering.
68
+ *
69
+ * Note that the `matchesCount` includes the `enteredTextLabel` ("Use ${value}") item, so in most cases you
70
+ * should subtract 1 from `matchesCount`. If using manual filtering, you should provide your own value for `totalCount`.
68
71
  */
69
72
  filteringResultsText?: (matchesCount: number, totalCount: number) => string;
70
73
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACpH,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,gBACf,SAAQ,kBAAkB,EACxB,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,+BAA+B,EAC/B,mBAAmB;IACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA+BI;IACJ,OAA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,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;KAC/C;IAED,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;QAEd;;WAEG;QACH,MAAM,IAAI,IAAI,CAAC;KAChB;CACF;AAGD,MAAM,MAAM,eAAe,GAAG,CAAC,gBAAgB,CAAC,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,GAAG;IACvF,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,aAAa,CAAC;IAC1C,MAAM,EAAE,gBAAgB,GAAG,WAAW,CAAC;CACxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/autosuggest/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseInputProps, InputAutoCorrect, InputClearLabel, InputKeyEvents, InputProps } from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport {\n BaseDropdownHostProps,\n OptionsFilteringType,\n OptionsLoadItemsDetail,\n} from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface AutosuggestProps\n extends BaseComponentProps,\n BaseInputProps,\n InputAutoCorrect,\n BaseDropdownHostProps,\n InputKeyEvents,\n InputClearLabel,\n FormFieldValidationControlProps,\n DropdownStatusProps {\n /**\n * Specifies an array of options that are displayed to the user as a dropdown list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n * - `label` (string) - (Optional) Option text displayed to the user.\n * - `lang` (string) - (Optional) The language of the option, provided as a BCP 47 language tag.\n * - `description` (string) - (Optional) Further information about the option that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option 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 option.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option.\n * - `iconAriaLabel` (string) - (Optional) Specifies alternate text for the icon. We recommend that you provide this for accessibility.\n * - `iconAlt` (string) - (Optional) **Deprecated**, replaced by \\`iconAriaLabel\\`. 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 * #### OptionGroup\n * - `label` (string) - Option group text displayed to the user.\n * - `disabled` (boolean) - (Optional) Determines whether the option group is disabled.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n **/\n options?: AutosuggestProps.Options;\n /**\n * Determines how filtering is applied to the list of `options`:\n *\n * * `auto` - The component will automatically filter options based on user input.\n * * `manual` - You will set up `onChange` or `onLoadItems` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value`, `label`, `description` or `labelTag` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the dropdown list. In that case make sure that you use the `onChange` or `onLoadItems` events in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: OptionsFilteringType;\n\n /**\n * Specifies a function that generates the custom value indicator (for example, `Use \"${value}\"`).\n * @i18n\n */\n enteredTextLabel?: AutosuggestProps.EnteredTextLabel;\n\n /**\n * Specifies the text to display with the number of matches at the bottom of the dropdown menu while filtering.\n */\n filteringResultsText?: (matchesCount: number, totalCount: number) => string;\n\n /**\n * Specifies the text that's displayed when there aren't any suggestions to display.\n * This is displayed when `statusType` is set to `finished` or it's not set at all.\n */\n empty?: React.ReactNode;\n\n /**\n * Called whenever a user selects an option in the dropdown. Don't use this event as the only way to handle user input.\n * Instead, use `onSelect` in combination with the `onChange` handler only as an optional convenience for the user.\n */\n onSelect?: NonCancelableEventHandler<AutosuggestProps.SelectDetail>;\n\n /**\n * Specifies the localized string that describes an option as being selected.\n * This is required to provide a good screen reader experience. For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n * @i18n\n */\n selectedAriaLabel?: string;\n /**\n * Overrides the element that is announced to screen readers\n * when the highlighted option changes. By default, this announces\n * the option's name and properties, and its selected state if\n * the `selectedLabel` property is defined.\n * The highlighted option is provided, and its group (if groups\n * are used and it differs from the group of the previously highlighted option).\n *\n * For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n */\n renderHighlightedAriaLive?: AutosuggestProps.ContainingOptionAndGroupString;\n}\n\nexport namespace AutosuggestProps {\n export type ChangeDetail = InputProps.ChangeDetail;\n export type KeyDetail = InputProps.KeyDetail;\n export type FilteringType = OptionsFilteringType;\n export type Option = OptionDefinition;\n export type Options = ReadonlyArray<Option | OptionGroup>;\n export type EnteredTextLabel = (value: string) => string;\n export interface OptionGroup extends Option {\n label?: string;\n options: ReadonlyArray<Option>;\n }\n export type LoadItemsDetail = OptionsLoadItemsDetail;\n export type StatusType = DropdownStatusProps.StatusType;\n export interface SelectDetail {\n value: string;\n selectedOption?: Option;\n }\n\n export interface ContainingOptionAndGroupString {\n (option: Option, group?: OptionGroup): string;\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the UI control.\n */\n focus(): void;\n\n /**\n * Selects all text in the input control.\n */\n select(): void;\n }\n}\n\n// TODO: use DropdownOption type same as in select and multiselect\nexport type AutosuggestItem = (AutosuggestProps.Option | AutosuggestProps.OptionGroup) & {\n type?: 'parent' | 'child' | 'use-entered';\n option: OptionDefinition | OptionGroup;\n};\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/autosuggest/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseInputProps, InputAutoCorrect, InputClearLabel, InputKeyEvents, InputProps } from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport {\n BaseDropdownHostProps,\n OptionsFilteringType,\n OptionsLoadItemsDetail,\n} from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface AutosuggestProps\n extends BaseComponentProps,\n BaseInputProps,\n InputAutoCorrect,\n BaseDropdownHostProps,\n InputKeyEvents,\n InputClearLabel,\n FormFieldValidationControlProps,\n DropdownStatusProps {\n /**\n * Specifies an array of options that are displayed to the user as a dropdown list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n * - `label` (string) - (Optional) Option text displayed to the user.\n * - `lang` (string) - (Optional) The language of the option, provided as a BCP 47 language tag.\n * - `description` (string) - (Optional) Further information about the option that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option 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 option.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option.\n * - `iconAriaLabel` (string) - (Optional) Specifies alternate text for the icon. We recommend that you provide this for accessibility.\n * - `iconAlt` (string) - (Optional) **Deprecated**, replaced by \\`iconAriaLabel\\`. 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 * #### OptionGroup\n * - `label` (string) - Option group text displayed to the user.\n * - `disabled` (boolean) - (Optional) Determines whether the option group is disabled.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n **/\n options?: AutosuggestProps.Options;\n /**\n * Determines how filtering is applied to the list of `options`:\n *\n * * `auto` - The component will automatically filter options based on user input.\n * * `manual` - You will set up `onChange` or `onLoadItems` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value`, `label`, `description` or `labelTag` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the dropdown list. In that case make sure that you use the `onChange` or `onLoadItems` events in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: OptionsFilteringType;\n\n /**\n * Specifies a function that generates the custom value indicator (for example, `Use \"${value}\"`).\n * @i18n\n */\n enteredTextLabel?: AutosuggestProps.EnteredTextLabel;\n\n /**\n * Specifies the text to display with the number of matches at the bottom of the dropdown menu while filtering.\n *\n * Note that the `matchesCount` includes the `enteredTextLabel` (\"Use ${value}\") item, so in most cases you\n * should subtract 1 from `matchesCount`. If using manual filtering, you should provide your own value for `totalCount`.\n */\n filteringResultsText?: (matchesCount: number, totalCount: number) => string;\n\n /**\n * Specifies the text that's displayed when there aren't any suggestions to display.\n * This is displayed when `statusType` is set to `finished` or it's not set at all.\n */\n empty?: React.ReactNode;\n\n /**\n * Called whenever a user selects an option in the dropdown. Don't use this event as the only way to handle user input.\n * Instead, use `onSelect` in combination with the `onChange` handler only as an optional convenience for the user.\n */\n onSelect?: NonCancelableEventHandler<AutosuggestProps.SelectDetail>;\n\n /**\n * Specifies the localized string that describes an option as being selected.\n * This is required to provide a good screen reader experience. For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n * @i18n\n */\n selectedAriaLabel?: string;\n /**\n * Overrides the element that is announced to screen readers\n * when the highlighted option changes. By default, this announces\n * the option's name and properties, and its selected state if\n * the `selectedLabel` property is defined.\n * The highlighted option is provided, and its group (if groups\n * are used and it differs from the group of the previously highlighted option).\n *\n * For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n */\n renderHighlightedAriaLive?: AutosuggestProps.ContainingOptionAndGroupString;\n}\n\nexport namespace AutosuggestProps {\n export type ChangeDetail = InputProps.ChangeDetail;\n export type KeyDetail = InputProps.KeyDetail;\n export type FilteringType = OptionsFilteringType;\n export type Option = OptionDefinition;\n export type Options = ReadonlyArray<Option | OptionGroup>;\n export type EnteredTextLabel = (value: string) => string;\n export interface OptionGroup extends Option {\n label?: string;\n options: ReadonlyArray<Option>;\n }\n export type LoadItemsDetail = OptionsLoadItemsDetail;\n export type StatusType = DropdownStatusProps.StatusType;\n export interface SelectDetail {\n value: string;\n selectedOption?: Option;\n }\n\n export interface ContainingOptionAndGroupString {\n (option: Option, group?: OptionGroup): string;\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the UI control.\n */\n focus(): void;\n\n /**\n * Selects all text in the input control.\n */\n select(): void;\n }\n}\n\n// TODO: use DropdownOption type same as in select and multiselect\nexport type AutosuggestItem = (AutosuggestProps.Option | AutosuggestProps.OptionGroup) & {\n type?: 'parent' | 'child' | 'use-entered';\n option: OptionDefinition | OptionGroup;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAmBhE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAmB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOjE,UAAU,wBAAyB,SAAQ,gBAAgB,EAAE,0BAA0B;CAAG;AAE1F,QAAA,MAAM,mBAAmB,uGAsOvB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAmBhE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAmB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOjE,UAAU,wBAAyB,SAAQ,gBAAgB,EAAE,0BAA0B;CAAG;AAE1F,QAAA,MAAM,mBAAmB,uGAqOvB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
@@ -113,12 +113,11 @@ const InternalAutosuggest = React.forwardRef((props, ref) => {
113
113
  const highlightedOptionIdSource = useUniqueId();
114
114
  const highlightedOptionId = autosuggestItemsState.highlightedOption ? highlightedOptionIdSource : undefined;
115
115
  const isEmpty = !value && !autosuggestItemsState.items.length;
116
- const isFiltered = !!value && value.length !== 0;
116
+ const isFiltered = !!value && value.length !== 0 && !(filteringType === 'auto' && autosuggestItemsState.showAll);
117
117
  const filteredText = isFiltered
118
118
  ? filteringResultsText === null || filteringResultsText === void 0 ? void 0 : filteringResultsText(autosuggestItemsState.items.length, (_b = options === null || options === void 0 ? void 0 : options.length) !== null && _b !== void 0 ? _b : 0)
119
119
  : undefined;
120
120
  const dropdownStatus = useDropdownStatus(Object.assign(Object.assign({}, props), { isEmpty,
121
- isFiltered,
122
121
  recoveryText,
123
122
  errorIconAriaLabel, onRecoveryClick: handleRecoveryClick, filteringResultsText: filteredText, hasRecoveryCallback: !!onLoadItems }));
124
123
  const shouldRenderDropdownContent = !isEmpty || !!dropdownStatus.content;
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAO,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,gBAAyC,MAAM,0CAA0C,CAAC;AAEjG,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAEL,mBAAmB,EACnB,sBAAsB,GAEvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAEjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,sBAAsB,MAAM,gBAAgB,CAAC;AAEpD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAA+B,EAAE,GAA8B,EAAE,EAAE;;IAC/G,MAAM,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,OAAO,EACP,OAAO,EACP,WAAW,EACX,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,iBAAiB,EAAE,iBAAiB,EACpC,yBAAyB,EAAE,yBAAyB,EACpD,UAAU,EACR,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAC,cAAc,IAAC,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,EAAE,EAAE,eAAe,GAAI,CAAC,CAAC,CAAC,IAAI,EAE5G,eAAe,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,GACrE,CACH,EAEH,cAAc,EACZ,cAAc,CAAC,QAAQ,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAClD,oBAAC,cAAc,IACb,EAAE,EAAE,eAAe,EACnB,OAAO,EAAE,cAAc,CAAC,OAAO,EAC/B,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,GACjD,CACH,CAAC,CAAC,CAAC,IAAI,EAEV,SAAS,EAAE,cAAc,CAAC,iBAAiB,EAC3C,eAAe,EAAE,mBAAmB,EACpC,cAAc,EAAE,kBAAkB,EAClC,gBAAgB,EAAE,oBAAoB,EACtC,cAAc,EAAE,kBAAkB,EAClC,YAAY,EAAE,gBAAgB,IAC9B,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useFormFieldContext } from '../contexts/form-field';\nimport { useInternalI18n } from '../i18n/context';\nimport { BaseChangeDetail } from '../input/interfaces';\nimport AutosuggestInput, { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { OptionsLoadItemsDetail } from '../internal/components/dropdown/interfaces';\nimport DropdownFooter from '../internal/components/dropdown-footer';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport {\n BaseKeyDetail,\n fireCancelableEvent,\n fireNonCancelableEvent,\n NonCancelableCustomEvent,\n} from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\nimport { useAutosuggestLoadMore } from './load-more-controller';\nimport { useAutosuggestItems } from './options-controller';\nimport AutosuggestOptionsList from './options-list';\n\nimport styles from './styles.css.js';\n\ninterface InternalAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {}\n\nconst InternalAutosuggest = React.forwardRef((props: InternalAutosuggestProps, ref: Ref<AutosuggestProps.Ref>) => {\n const {\n value,\n onChange,\n onBlur,\n onFocus,\n onKeyUp,\n onLoadItems,\n options,\n filteringType = 'auto',\n statusType = 'finished',\n placeholder,\n clearAriaLabel,\n name,\n disabled,\n disableBrowserAutocorrect = false,\n autoFocus,\n readOnly,\n ariaLabel,\n ariaRequired,\n enteredTextLabel,\n filteringResultsText,\n onKeyDown,\n virtualScroll,\n expandToViewport,\n onSelect,\n renderHighlightedAriaLive,\n __internalRootRef,\n ...restProps\n } = props;\n\n checkControlled('Autosuggest', 'value', value, 'onChange', onChange);\n checkOptionValueField('Autosuggest', 'options', options);\n\n const autosuggestInputRef = useRef<AutosuggestInputRef>(null);\n useImperativeHandle(\n ref,\n () => ({\n focus: () => autosuggestInputRef.current?.focus(),\n select: () => autosuggestInputRef.current?.select(),\n }),\n []\n );\n\n const i18n = useInternalI18n('autosuggest');\n const errorIconAriaLabel = i18n('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18n('selectedAriaLabel', restProps.selectedAriaLabel);\n const recoveryText = i18n('recoveryText', restProps.recoveryText);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Autosuggest', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const [autosuggestItemsState, autosuggestItemsHandlers] = useAutosuggestItems({\n options: options || [],\n filterValue: value,\n filterText: value,\n filteringType,\n enteredTextLabel,\n hideEnteredTextLabel: false,\n onSelectItem: (option: AutosuggestItem) => {\n const value = option.value || '';\n fireNonCancelableEvent(onChange, { value });\n fireNonCancelableEvent(onSelect, {\n value,\n selectedOption: option.type !== 'use-entered' ? option.option : undefined,\n });\n autosuggestInputRef.current?.close();\n },\n });\n\n const autosuggestLoadMoreHandlers = useAutosuggestLoadMore({\n options,\n statusType,\n onLoadItems: (detail: OptionsLoadItemsDetail) => fireNonCancelableEvent(onLoadItems, detail),\n });\n\n const handleChange = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestItemsHandlers.setShowAll(false);\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n fireNonCancelableEvent(onChange, event.detail);\n };\n\n const handleDelayedInput = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputChange(event.detail.value);\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, null);\n };\n\n const handleFocus = () => {\n autosuggestItemsHandlers.setShowAll(true);\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputFocus();\n fireNonCancelableEvent(onFocus, null);\n };\n\n const handleKeyUp = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyUp, event.detail, event);\n };\n\n const handleKeyDown = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyDown, event.detail, event);\n };\n\n const handlePressArrowDown = () => {\n if (autosuggestItemsState.items.length - 1 === autosuggestItemsState.highlightedIndex) {\n autosuggestItemsHandlers.goHomeWithKeyboard();\n return;\n }\n\n autosuggestItemsHandlers.moveHighlightWithKeyboard(1);\n };\n\n const handlePressArrowUp = () => {\n if (\n (autosuggestItemsState.highlightedOption?.type === 'child' && autosuggestItemsState.highlightedIndex === 1) ||\n autosuggestItemsState.highlightedIndex === 0\n ) {\n autosuggestItemsHandlers.goEndWithKeyboard();\n return;\n }\n\n autosuggestItemsHandlers.moveHighlightWithKeyboard(-1);\n };\n\n const handlePressEnter = () => {\n return autosuggestItemsHandlers.selectHighlightedOptionWithKeyboard();\n };\n\n const handleCloseDropdown = () => {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n };\n\n const handleRecoveryClick = () => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnRecoveryClick();\n autosuggestInputRef.current?.focus();\n };\n\n const formFieldContext = useFormFieldContext(restProps);\n const selfControlId = useUniqueId('input');\n const footerControlId = useUniqueId('footer');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const listId = useUniqueId('list');\n const highlightedOptionIdSource = useUniqueId();\n const highlightedOptionId = autosuggestItemsState.highlightedOption ? highlightedOptionIdSource : undefined;\n\n const isEmpty = !value && !autosuggestItemsState.items.length;\n const isFiltered = !!value && value.length !== 0;\n const filteredText = isFiltered\n ? filteringResultsText?.(autosuggestItemsState.items.length, options?.length ?? 0)\n : undefined;\n const dropdownStatus = useDropdownStatus({\n ...props,\n isEmpty,\n isFiltered,\n recoveryText,\n errorIconAriaLabel,\n onRecoveryClick: handleRecoveryClick,\n filteringResultsText: filteredText,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const shouldRenderDropdownContent = !isEmpty || !!dropdownStatus.content;\n\n return (\n <AutosuggestInput\n {...restProps}\n className={clsx(styles.root, restProps.className)}\n ref={autosuggestInputRef}\n __internalRootRef={__internalRootRef}\n value={value}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n onKeyDown={handleKeyDown}\n name={name}\n controlId={controlId}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n autoFocus={autoFocus}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n clearAriaLabel={clearAriaLabel}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n expandToViewport={expandToViewport}\n ariaControls={listId}\n ariaActivedescendant={highlightedOptionId}\n dropdownExpanded={shouldRenderDropdownContent}\n dropdownContent={\n shouldRenderDropdownContent && (\n <AutosuggestOptionsList\n statusType={statusType}\n autosuggestItemsState={autosuggestItemsState}\n autosuggestItemsHandlers={autosuggestItemsHandlers}\n highlightedOptionId={highlightedOptionId}\n highlightText={value}\n listId={listId}\n controlId={controlId}\n handleLoadMore={autosuggestLoadMoreHandlers.fireLoadMoreOnScroll}\n hasDropdownStatus={dropdownStatus.content !== null}\n virtualScroll={virtualScroll}\n selectedAriaLabel={selectedAriaLabel}\n renderHighlightedAriaLive={renderHighlightedAriaLive}\n listBottom={\n !dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} id={footerControlId} /> : null\n }\n ariaDescribedby={dropdownStatus.content ? footerControlId : undefined}\n />\n )\n }\n dropdownFooter={\n dropdownStatus.isSticky && dropdownStatus.content ? (\n <DropdownFooter\n id={footerControlId}\n content={dropdownStatus.content}\n hasItems={autosuggestItemsState.items.length >= 1}\n />\n ) : null\n }\n loopFocus={dropdownStatus.hasRecoveryButton}\n onCloseDropdown={handleCloseDropdown}\n onDelayedInput={handleDelayedInput}\n onPressArrowDown={handlePressArrowDown}\n onPressArrowUp={handlePressArrowUp}\n onPressEnter={handlePressEnter}\n />\n );\n});\n\nexport default InternalAutosuggest;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAO,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,gBAAyC,MAAM,0CAA0C,CAAC;AAEjG,OAA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,IAAI,EAEV,SAAS,EAAE,cAAc,CAAC,iBAAiB,EAC3C,eAAe,EAAE,mBAAmB,EACpC,cAAc,EAAE,kBAAkB,EAClC,gBAAgB,EAAE,oBAAoB,EACtC,cAAc,EAAE,kBAAkB,EAClC,YAAY,EAAE,gBAAgB,IAC9B,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useFormFieldContext } from '../contexts/form-field';\nimport { useInternalI18n } from '../i18n/context';\nimport { BaseChangeDetail } from '../input/interfaces';\nimport AutosuggestInput, { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { OptionsLoadItemsDetail } from '../internal/components/dropdown/interfaces';\nimport DropdownFooter from '../internal/components/dropdown-footer';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport {\n BaseKeyDetail,\n fireCancelableEvent,\n fireNonCancelableEvent,\n NonCancelableCustomEvent,\n} from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\nimport { useAutosuggestLoadMore } from './load-more-controller';\nimport { useAutosuggestItems } from './options-controller';\nimport AutosuggestOptionsList from './options-list';\n\nimport styles from './styles.css.js';\n\ninterface InternalAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {}\n\nconst InternalAutosuggest = React.forwardRef((props: InternalAutosuggestProps, ref: Ref<AutosuggestProps.Ref>) => {\n const {\n value,\n onChange,\n onBlur,\n onFocus,\n onKeyUp,\n onLoadItems,\n options,\n filteringType = 'auto',\n statusType = 'finished',\n placeholder,\n clearAriaLabel,\n name,\n disabled,\n disableBrowserAutocorrect = false,\n autoFocus,\n readOnly,\n ariaLabel,\n ariaRequired,\n enteredTextLabel,\n filteringResultsText,\n onKeyDown,\n virtualScroll,\n expandToViewport,\n onSelect,\n renderHighlightedAriaLive,\n __internalRootRef,\n ...restProps\n } = props;\n\n checkControlled('Autosuggest', 'value', value, 'onChange', onChange);\n checkOptionValueField('Autosuggest', 'options', options);\n\n const autosuggestInputRef = useRef<AutosuggestInputRef>(null);\n useImperativeHandle(\n ref,\n () => ({\n focus: () => autosuggestInputRef.current?.focus(),\n select: () => autosuggestInputRef.current?.select(),\n }),\n []\n );\n\n const i18n = useInternalI18n('autosuggest');\n const errorIconAriaLabel = i18n('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18n('selectedAriaLabel', restProps.selectedAriaLabel);\n const recoveryText = i18n('recoveryText', restProps.recoveryText);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Autosuggest', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const [autosuggestItemsState, autosuggestItemsHandlers] = useAutosuggestItems({\n options: options || [],\n filterValue: value,\n filterText: value,\n filteringType,\n enteredTextLabel,\n hideEnteredTextLabel: false,\n onSelectItem: (option: AutosuggestItem) => {\n const value = option.value || '';\n fireNonCancelableEvent(onChange, { value });\n fireNonCancelableEvent(onSelect, {\n value,\n selectedOption: option.type !== 'use-entered' ? option.option : undefined,\n });\n autosuggestInputRef.current?.close();\n },\n });\n\n const autosuggestLoadMoreHandlers = useAutosuggestLoadMore({\n options,\n statusType,\n onLoadItems: (detail: OptionsLoadItemsDetail) => fireNonCancelableEvent(onLoadItems, detail),\n });\n\n const handleChange = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestItemsHandlers.setShowAll(false);\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n fireNonCancelableEvent(onChange, event.detail);\n };\n\n const handleDelayedInput = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputChange(event.detail.value);\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, null);\n };\n\n const handleFocus = () => {\n autosuggestItemsHandlers.setShowAll(true);\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputFocus();\n fireNonCancelableEvent(onFocus, null);\n };\n\n const handleKeyUp = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyUp, event.detail, event);\n };\n\n const handleKeyDown = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyDown, event.detail, event);\n };\n\n const handlePressArrowDown = () => {\n if (autosuggestItemsState.items.length - 1 === autosuggestItemsState.highlightedIndex) {\n autosuggestItemsHandlers.goHomeWithKeyboard();\n return;\n }\n\n autosuggestItemsHandlers.moveHighlightWithKeyboard(1);\n };\n\n const handlePressArrowUp = () => {\n if (\n (autosuggestItemsState.highlightedOption?.type === 'child' && autosuggestItemsState.highlightedIndex === 1) ||\n autosuggestItemsState.highlightedIndex === 0\n ) {\n autosuggestItemsHandlers.goEndWithKeyboard();\n return;\n }\n\n autosuggestItemsHandlers.moveHighlightWithKeyboard(-1);\n };\n\n const handlePressEnter = () => {\n return autosuggestItemsHandlers.selectHighlightedOptionWithKeyboard();\n };\n\n const handleCloseDropdown = () => {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n };\n\n const handleRecoveryClick = () => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnRecoveryClick();\n autosuggestInputRef.current?.focus();\n };\n\n const formFieldContext = useFormFieldContext(restProps);\n const selfControlId = useUniqueId('input');\n const footerControlId = useUniqueId('footer');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const listId = useUniqueId('list');\n const highlightedOptionIdSource = useUniqueId();\n const highlightedOptionId = autosuggestItemsState.highlightedOption ? highlightedOptionIdSource : undefined;\n\n const isEmpty = !value && !autosuggestItemsState.items.length;\n const isFiltered = !!value && value.length !== 0 && !(filteringType === 'auto' && autosuggestItemsState.showAll);\n const filteredText = isFiltered\n ? filteringResultsText?.(autosuggestItemsState.items.length, options?.length ?? 0)\n : undefined;\n const dropdownStatus = useDropdownStatus({\n ...props,\n isEmpty,\n recoveryText,\n errorIconAriaLabel,\n onRecoveryClick: handleRecoveryClick,\n filteringResultsText: filteredText,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const shouldRenderDropdownContent = !isEmpty || !!dropdownStatus.content;\n\n return (\n <AutosuggestInput\n {...restProps}\n className={clsx(styles.root, restProps.className)}\n ref={autosuggestInputRef}\n __internalRootRef={__internalRootRef}\n value={value}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n onKeyDown={handleKeyDown}\n name={name}\n controlId={controlId}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n autoFocus={autoFocus}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n clearAriaLabel={clearAriaLabel}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n expandToViewport={expandToViewport}\n ariaControls={listId}\n ariaActivedescendant={highlightedOptionId}\n dropdownExpanded={shouldRenderDropdownContent}\n dropdownContent={\n shouldRenderDropdownContent && (\n <AutosuggestOptionsList\n statusType={statusType}\n autosuggestItemsState={autosuggestItemsState}\n autosuggestItemsHandlers={autosuggestItemsHandlers}\n highlightedOptionId={highlightedOptionId}\n highlightText={value}\n listId={listId}\n controlId={controlId}\n handleLoadMore={autosuggestLoadMoreHandlers.fireLoadMoreOnScroll}\n hasDropdownStatus={dropdownStatus.content !== null}\n virtualScroll={virtualScroll}\n selectedAriaLabel={selectedAriaLabel}\n renderHighlightedAriaLive={renderHighlightedAriaLive}\n listBottom={\n !dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} id={footerControlId} /> : null\n }\n ariaDescribedby={dropdownStatus.content ? footerControlId : undefined}\n />\n )\n }\n dropdownFooter={\n dropdownStatus.isSticky && dropdownStatus.content ? (\n <DropdownFooter\n id={footerControlId}\n content={dropdownStatus.content}\n hasItems={autosuggestItemsState.items.length >= 1}\n />\n ) : null\n }\n loopFocus={dropdownStatus.hasRecoveryButton}\n onCloseDropdown={handleCloseDropdown}\n onDelayedInput={handleDelayedInput}\n onPressArrowDown={handlePressArrowDown}\n onPressArrowUp={handlePressArrowUp}\n onPressEnter={handlePressEnter}\n />\n );\n});\n\nexport default InternalAutosuggest;\n"]}
@@ -2043,5 +2043,5 @@
2043
2043
  }
2044
2044
  }
2045
2045
  :root {
2046
- --awsui-version-info-fa86a716: true;
2046
+ --awsui-version-info-917de812: true;
2047
2047
  }
@@ -5,7 +5,6 @@ export { DropdownStatusProps };
5
5
  export interface DropdownStatusPropsExtended extends DropdownStatusProps {
6
6
  isEmpty?: boolean;
7
7
  isNoMatch?: boolean;
8
- isFiltered?: boolean;
9
8
  noMatch?: React.ReactNode;
10
9
  filteringResultsText?: string;
11
10
  /**
@@ -36,7 +35,6 @@ type UseDropdownStatus = ({
36
35
  recoveryText,
37
36
  isEmpty,
38
37
  isNoMatch,
39
- isFiltered,
40
38
  noMatch,
41
39
  hasRecoveryCallback,
42
40
  onRecoveryClick
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown-status/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAA0B,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAInD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,yBAAyB,CAAC;IAC5C;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,iBAAS,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,eAElE;AAED,KAAK,iBAAiB,GAAG,CAAC,EACxB,UAAU,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACT,YAAY,EACZ,OAAO,EACP,SAAS,EACT,UAAU,EACV,OAAO,EACP,mBAAmB,EACnB,eAAe,GAChB,EAAE,2BAA2B,KAAK,oBAAoB,CAAC;AAExD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;IAChC,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,iBAAiB,EAAE,iBAwD/B,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown-status/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAA0B,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAInD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,yBAAyB,CAAC;IAC5C;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,iBAAS,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,eAElE;AAED,KAAK,iBAAiB,GAAG,CAAC,EACxB,UAAU,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACT,YAAY,EACZ,OAAO,EACP,SAAS,EACT,OAAO,EACP,mBAAmB,EACnB,eAAe,GAChB,EAAE,2BAA2B,KAAK,oBAAoB,CAAC;AAExD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;IAChC,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,iBAAiB,EAAE,iBAuD/B,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -9,7 +9,7 @@ import styles from './styles.css.js';
9
9
  function DropdownStatus({ children }) {
10
10
  return React.createElement("div", { className: styles.root }, children);
11
11
  }
12
- export const useDropdownStatus = ({ statusType, empty, loadingText, finishedText, filteringResultsText, errorText, recoveryText, isEmpty, isNoMatch, isFiltered, noMatch, onRecoveryClick, hasRecoveryCallback = false, errorIconAriaLabel, }) => {
12
+ export const useDropdownStatus = ({ statusType, empty, loadingText, finishedText, filteringResultsText, errorText, recoveryText, isEmpty, isNoMatch, noMatch, onRecoveryClick, hasRecoveryCallback = false, errorIconAriaLabel, }) => {
13
13
  const previousStatusType = usePrevious(statusType);
14
14
  const statusResult = { isSticky: true, content: null, hasRecoveryButton: false };
15
15
  if (statusType === 'loading') {
@@ -28,7 +28,7 @@ export const useDropdownStatus = ({ statusType, empty, loadingText, finishedText
28
28
  else if (isNoMatch && noMatch) {
29
29
  statusResult.content = noMatch;
30
30
  }
31
- else if (isFiltered && filteringResultsText) {
31
+ else if (filteringResultsText) {
32
32
  statusResult.content = filteringResultsText;
33
33
  }
34
34
  else if (statusType === 'finished' && finishedText) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown-status/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAA6B,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAwBrC,SAAS,cAAc,CAAC,EAAE,QAAQ,EAAiC;IACjE,OAAO,6BAAK,SAAS,EAAE,MAAM,CAAC,IAAI,IAAG,QAAQ,CAAO,CAAC;AACvD,CAAC;AAwBD,MAAM,CAAC,MAAM,iBAAiB,GAAsB,CAAC,EACnD,UAAU,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACT,YAAY,EACZ,OAAO,EACP,SAAS,EACT,UAAU,EACV,OAAO,EACP,eAAe,EACf,mBAAmB,GAAG,KAAK,EAC3B,kBAAkB,GACnB,EAAwB,EAAE;IACzB,MAAM,kBAAkB,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;IACnD,MAAM,YAAY,GAAyB,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC;IAEvG,IAAI,UAAU,KAAK,SAAS,EAAE;QAC5B,YAAY,CAAC,OAAO,GAAG,oBAAC,uBAAuB,IAAC,IAAI,EAAE,SAAS,IAAG,WAAW,CAA2B,CAAC;KAC1G;SAAM,IAAI,UAAU,KAAK,OAAO,EAAE;QACjC,YAAY,CAAC,iBAAiB,GAAG,CAAC,CAAC,YAAY,IAAI,mBAAmB,CAAC;QACvE,YAAY,CAAC,OAAO,GAAG,CACrB;YACE,oBAAC,uBAAuB,IACtB,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,QAAQ,EAClB,SAAS,EAAE,kBAAkB,KAAK,OAAO,EACzC,aAAa,EAAE,kBAAkB,IAEhC,SAAS,CACc;YAAC,GAAG;YAC7B,YAAY,CAAC,iBAAiB,IAAI,CACjC,oBAAC,YAAY,IACX,QAAQ,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,eAAe,CAAC,EACvD,OAAO,EAAC,UAAU,EAClB,SAAS,EAAE,MAAM,CAAC,QAAQ,IAEzB,YAAY,CACA,CAChB,CACI,CACR,CAAC;KACH;SAAM,IAAI,OAAO,IAAI,KAAK,EAAE;QAC3B,YAAY,CAAC,OAAO,GAAG,KAAK,CAAC;KAC9B;SAAM,IAAI,SAAS,IAAI,OAAO,EAAE;QAC/B,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC;KAChC;SAAM,IAAI,UAAU,IAAI,oBAAoB,EAAE;QAC7C,YAAY,CAAC,OAAO,GAAG,oBAAoB,CAAC;KAC7C;SAAM,IAAI,UAAU,KAAK,UAAU,IAAI,YAAY,EAAE;QACpD,YAAY,CAAC,OAAO,GAAG,YAAY,CAAC;QACpC,YAAY,CAAC,QAAQ,GAAG,KAAK,CAAC;KAC/B;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport InternalLink from '../../../link/internal';\nimport InternalStatusIndicator from '../../../status-indicator/internal';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../../events';\nimport { usePrevious } from '../../hooks/use-previous';\nimport { DropdownStatusProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport { DropdownStatusProps };\n\nexport interface DropdownStatusPropsExtended extends DropdownStatusProps {\n isEmpty?: boolean;\n isNoMatch?: boolean;\n isFiltered?: boolean;\n noMatch?: React.ReactNode;\n filteringResultsText?: string;\n /**\n * Called when the user clicks the recovery button placed at the\n * bottom of the dropdown list in the error state. Use this to\n * retry a failed request or provide another option for the user\n * to recover from the error.\n */\n onRecoveryClick?: NonCancelableEventHandler;\n /**\n * Determines if retry button should be rendered\n * in case recoveryText was automatically provided by i18n.\n */\n hasRecoveryCallback?: boolean;\n}\n\nfunction DropdownStatus({ children }: { children: React.ReactNode }) {\n return <div className={styles.root}>{children}</div>;\n}\n\ntype UseDropdownStatus = ({\n statusType,\n empty,\n loadingText,\n finishedText,\n filteringResultsText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n isFiltered,\n noMatch,\n hasRecoveryCallback,\n onRecoveryClick,\n}: DropdownStatusPropsExtended) => DropdownStatusResult;\n\nexport interface DropdownStatusResult {\n isSticky: boolean;\n content: React.ReactNode | null;\n hasRecoveryButton: boolean;\n}\n\nexport const useDropdownStatus: UseDropdownStatus = ({\n statusType,\n empty,\n loadingText,\n finishedText,\n filteringResultsText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n isFiltered,\n noMatch,\n onRecoveryClick,\n hasRecoveryCallback = false,\n errorIconAriaLabel,\n}): DropdownStatusResult => {\n const previousStatusType = usePrevious(statusType);\n const statusResult: DropdownStatusResult = { isSticky: true, content: null, hasRecoveryButton: false };\n\n if (statusType === 'loading') {\n statusResult.content = <InternalStatusIndicator type={'loading'}>{loadingText}</InternalStatusIndicator>;\n } else if (statusType === 'error') {\n statusResult.hasRecoveryButton = !!recoveryText && hasRecoveryCallback;\n statusResult.content = (\n <span>\n <InternalStatusIndicator\n type=\"error\"\n __display=\"inline\"\n __animate={previousStatusType !== 'error'}\n iconAriaLabel={errorIconAriaLabel}\n >\n {errorText}\n </InternalStatusIndicator>{' '}\n {statusResult.hasRecoveryButton && (\n <InternalLink\n onFollow={() => fireNonCancelableEvent(onRecoveryClick)}\n variant=\"recovery\"\n className={styles.recovery}\n >\n {recoveryText}\n </InternalLink>\n )}\n </span>\n );\n } else if (isEmpty && empty) {\n statusResult.content = empty;\n } else if (isNoMatch && noMatch) {\n statusResult.content = noMatch;\n } else if (isFiltered && filteringResultsText) {\n statusResult.content = filteringResultsText;\n } else if (statusType === 'finished' && finishedText) {\n statusResult.content = finishedText;\n statusResult.isSticky = false;\n }\n\n return statusResult;\n};\n\nexport default DropdownStatus;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/dropdown-status/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAA6B,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAuBrC,SAAS,cAAc,CAAC,EAAE,QAAQ,EAAiC;IACjE,OAAO,6BAAK,SAAS,EAAE,MAAM,CAAC,IAAI,IAAG,QAAQ,CAAO,CAAC;AACvD,CAAC;AAuBD,MAAM,CAAC,MAAM,iBAAiB,GAAsB,CAAC,EACnD,UAAU,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACT,YAAY,EACZ,OAAO,EACP,SAAS,EACT,OAAO,EACP,eAAe,EACf,mBAAmB,GAAG,KAAK,EAC3B,kBAAkB,GACnB,EAAwB,EAAE;IACzB,MAAM,kBAAkB,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;IACnD,MAAM,YAAY,GAAyB,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC;IAEvG,IAAI,UAAU,KAAK,SAAS,EAAE;QAC5B,YAAY,CAAC,OAAO,GAAG,oBAAC,uBAAuB,IAAC,IAAI,EAAE,SAAS,IAAG,WAAW,CAA2B,CAAC;KAC1G;SAAM,IAAI,UAAU,KAAK,OAAO,EAAE;QACjC,YAAY,CAAC,iBAAiB,GAAG,CAAC,CAAC,YAAY,IAAI,mBAAmB,CAAC;QACvE,YAAY,CAAC,OAAO,GAAG,CACrB;YACE,oBAAC,uBAAuB,IACtB,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,QAAQ,EAClB,SAAS,EAAE,kBAAkB,KAAK,OAAO,EACzC,aAAa,EAAE,kBAAkB,IAEhC,SAAS,CACc;YAAC,GAAG;YAC7B,YAAY,CAAC,iBAAiB,IAAI,CACjC,oBAAC,YAAY,IACX,QAAQ,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,eAAe,CAAC,EACvD,OAAO,EAAC,UAAU,EAClB,SAAS,EAAE,MAAM,CAAC,QAAQ,IAEzB,YAAY,CACA,CAChB,CACI,CACR,CAAC;KACH;SAAM,IAAI,OAAO,IAAI,KAAK,EAAE;QAC3B,YAAY,CAAC,OAAO,GAAG,KAAK,CAAC;KAC9B;SAAM,IAAI,SAAS,IAAI,OAAO,EAAE;QAC/B,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC;KAChC;SAAM,IAAI,oBAAoB,EAAE;QAC/B,YAAY,CAAC,OAAO,GAAG,oBAAoB,CAAC;KAC7C;SAAM,IAAI,UAAU,KAAK,UAAU,IAAI,YAAY,EAAE;QACpD,YAAY,CAAC,OAAO,GAAG,YAAY,CAAC;QACpC,YAAY,CAAC,QAAQ,GAAG,KAAK,CAAC;KAC/B;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport InternalLink from '../../../link/internal';\nimport InternalStatusIndicator from '../../../status-indicator/internal';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../../events';\nimport { usePrevious } from '../../hooks/use-previous';\nimport { DropdownStatusProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport { DropdownStatusProps };\n\nexport interface DropdownStatusPropsExtended extends DropdownStatusProps {\n isEmpty?: boolean;\n isNoMatch?: boolean;\n noMatch?: React.ReactNode;\n filteringResultsText?: string;\n /**\n * Called when the user clicks the recovery button placed at the\n * bottom of the dropdown list in the error state. Use this to\n * retry a failed request or provide another option for the user\n * to recover from the error.\n */\n onRecoveryClick?: NonCancelableEventHandler;\n /**\n * Determines if retry button should be rendered\n * in case recoveryText was automatically provided by i18n.\n */\n hasRecoveryCallback?: boolean;\n}\n\nfunction DropdownStatus({ children }: { children: React.ReactNode }) {\n return <div className={styles.root}>{children}</div>;\n}\n\ntype UseDropdownStatus = ({\n statusType,\n empty,\n loadingText,\n finishedText,\n filteringResultsText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n hasRecoveryCallback,\n onRecoveryClick,\n}: DropdownStatusPropsExtended) => DropdownStatusResult;\n\nexport interface DropdownStatusResult {\n isSticky: boolean;\n content: React.ReactNode | null;\n hasRecoveryButton: boolean;\n}\n\nexport const useDropdownStatus: UseDropdownStatus = ({\n statusType,\n empty,\n loadingText,\n finishedText,\n filteringResultsText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n onRecoveryClick,\n hasRecoveryCallback = false,\n errorIconAriaLabel,\n}): DropdownStatusResult => {\n const previousStatusType = usePrevious(statusType);\n const statusResult: DropdownStatusResult = { isSticky: true, content: null, hasRecoveryButton: false };\n\n if (statusType === 'loading') {\n statusResult.content = <InternalStatusIndicator type={'loading'}>{loadingText}</InternalStatusIndicator>;\n } else if (statusType === 'error') {\n statusResult.hasRecoveryButton = !!recoveryText && hasRecoveryCallback;\n statusResult.content = (\n <span>\n <InternalStatusIndicator\n type=\"error\"\n __display=\"inline\"\n __animate={previousStatusType !== 'error'}\n iconAriaLabel={errorIconAriaLabel}\n >\n {errorText}\n </InternalStatusIndicator>{' '}\n {statusResult.hasRecoveryButton && (\n <InternalLink\n onFollow={() => fireNonCancelableEvent(onRecoveryClick)}\n variant=\"recovery\"\n className={styles.recovery}\n >\n {recoveryText}\n </InternalLink>\n )}\n </span>\n );\n } else if (isEmpty && empty) {\n statusResult.content = empty;\n } else if (isNoMatch && noMatch) {\n statusResult.content = noMatch;\n } else if (filteringResultsText) {\n statusResult.content = filteringResultsText;\n } else if (statusType === 'finished' && finishedText) {\n statusResult.content = finishedText;\n statusResult.isSticky = false;\n }\n\n return statusResult;\n};\n\nexport default DropdownStatus;\n"]}
@@ -1,12 +1,12 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_1ifko_cskao_145",
5
- "disable-paddings": "awsui_disable-paddings_1ifko_cskao_183",
6
- "main": "awsui_main_1ifko_cskao_187",
7
- "content-wrap": "awsui_content-wrap_1ifko_cskao_193",
8
- "wrap-actions": "awsui_wrap-actions_1ifko_cskao_203",
9
- "content": "awsui_content_1ifko_cskao_193",
10
- "actions": "awsui_actions_1ifko_cskao_211"
4
+ "root": "awsui_root_1ifko_1wryl_145",
5
+ "disable-paddings": "awsui_disable-paddings_1ifko_1wryl_183",
6
+ "main": "awsui_main_1ifko_1wryl_187",
7
+ "content-wrap": "awsui_content-wrap_1ifko_1wryl_194",
8
+ "wrap-actions": "awsui_wrap-actions_1ifko_1wryl_204",
9
+ "content": "awsui_content_1ifko_1wryl_194",
10
+ "actions": "awsui_actions_1ifko_1wryl_213"
11
11
  };
12
12
 
@@ -142,7 +142,7 @@
142
142
  */
143
143
  /* Style used for links in slots/components that are text heavy, to help links stand out among
144
144
  surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
145
- .awsui_root_1ifko_cskao_145:not(#\9) {
145
+ .awsui_root_1ifko_1wryl_145:not(#\9) {
146
146
  border-collapse: separate;
147
147
  border-spacing: 0;
148
148
  box-sizing: border-box;
@@ -180,35 +180,37 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
180
180
  align-items: baseline;
181
181
  column-gap: var(--space-xs-ymlm0b, 8px);
182
182
  }
183
- .awsui_root_1ifko_cskao_145.awsui_disable-paddings_1ifko_cskao_183:not(#\9) {
183
+ .awsui_root_1ifko_1wryl_145.awsui_disable-paddings_1ifko_1wryl_183:not(#\9) {
184
184
  column-gap: 0;
185
185
  }
186
186
 
187
- .awsui_main_1ifko_cskao_187:not(#\9) {
187
+ .awsui_main_1ifko_1wryl_187:not(#\9) {
188
188
  flex-grow: 1;
189
189
  display: flex;
190
190
  flex-direction: column;
191
+ min-inline-size: 0;
191
192
  }
192
193
 
193
- .awsui_content-wrap_1ifko_cskao_193:not(#\9) {
194
+ .awsui_content-wrap_1ifko_1wryl_194:not(#\9) {
194
195
  flex-grow: 1;
195
196
  display: flex;
196
197
  align-items: baseline;
197
198
  flex-direction: row;
198
199
  column-gap: var(--space-xs-ymlm0b, 8px);
199
200
  }
200
- .awsui_disable-paddings_1ifko_cskao_183 > .awsui_main_1ifko_cskao_187 > .awsui_content-wrap_1ifko_cskao_193:not(#\9) {
201
+ .awsui_disable-paddings_1ifko_1wryl_183 > .awsui_main_1ifko_1wryl_187 > .awsui_content-wrap_1ifko_1wryl_194:not(#\9) {
201
202
  column-gap: 0;
202
203
  }
203
- .awsui_content-wrap_1ifko_cskao_193.awsui_wrap-actions_1ifko_cskao_203:not(#\9) {
204
+ .awsui_content-wrap_1ifko_1wryl_194.awsui_wrap-actions_1ifko_1wryl_204:not(#\9) {
204
205
  flex-wrap: wrap;
205
206
  }
206
207
 
207
- .awsui_content_1ifko_cskao_193:not(#\9) {
208
+ .awsui_content_1ifko_1wryl_194:not(#\9) {
208
209
  flex-grow: 1;
210
+ min-inline-size: 0;
209
211
  }
210
212
 
211
- .awsui_actions_1ifko_cskao_211:not(#\9) {
213
+ .awsui_actions_1ifko_1wryl_213:not(#\9) {
212
214
  flex-shrink: 0;
213
215
  margin-inline-start: auto;
214
216
  }
@@ -2,12 +2,12 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_1ifko_cskao_145",
6
- "disable-paddings": "awsui_disable-paddings_1ifko_cskao_183",
7
- "main": "awsui_main_1ifko_cskao_187",
8
- "content-wrap": "awsui_content-wrap_1ifko_cskao_193",
9
- "wrap-actions": "awsui_wrap-actions_1ifko_cskao_203",
10
- "content": "awsui_content_1ifko_cskao_193",
11
- "actions": "awsui_actions_1ifko_cskao_211"
5
+ "root": "awsui_root_1ifko_1wryl_145",
6
+ "disable-paddings": "awsui_disable-paddings_1ifko_1wryl_183",
7
+ "main": "awsui_main_1ifko_1wryl_187",
8
+ "content-wrap": "awsui_content-wrap_1ifko_1wryl_194",
9
+ "wrap-actions": "awsui_wrap-actions_1ifko_1wryl_204",
10
+ "content": "awsui_content_1ifko_1wryl_194",
11
+ "actions": "awsui_actions_1ifko_1wryl_213"
12
12
  };
13
13
 
@@ -1,6 +1,6 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (fa86a716)";
3
- export var GIT_SHA = "fa86a716";
2
+ export var PACKAGE_VERSION = "3.0.0 (917de812)";
3
+ export var GIT_SHA = "917de812";
4
4
  export var THEME = "open-source-visual-refresh";
5
5
  export var SYSTEM = "console";
6
6
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (fa86a716)",
4
- "GIT_SHA": "fa86a716",
3
+ "PACKAGE_VERSION": "3.0.0 (917de812)",
4
+ "GIT_SHA": "917de812",
5
5
  "THEME": "open-source-visual-refresh",
6
6
  "SYSTEM": "console",
7
7
  "ALWAYS_VISUAL_REFRESH": true
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "fa86a716953a6963e3afa627d3844f8fa81b8a59"
2
+ "commit": "917de81204a28eb9231022693f19cd151863759f"
3
3
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-multiselect.d.ts","sourceRoot":"","sources":["../../../src/multiselect/use-multiselect.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,wCAAwC,CAAC;AAChG,OAAO,EAAE,cAAc,EAAiC,MAAM,0CAA0C,CAAC;AAIzG,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAO7D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,KAAK,qBAAqB,GAAG,YAAY,CACvC,IAAI,CACF,gBAAgB,EACd,SAAS,GACT,iBAAiB,GACjB,eAAe,GACf,sBAAsB,GACtB,UAAU,GACV,SAAS,GACT,2BAA2B,GAC3B,mBAAmB,GACnB,UAAU,GACV,QAAQ,GACR,SAAS,GACT,aAAa,GACb,UAAU,GACV,mBAAmB,GACnB,iBAAiB,GACjB,aAAa,CAChB,GACC,mBAAmB,GAAG;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;CAC9C,EACH,SAAS,GAAG,iBAAiB,GAAG,eAAe,GAAG,YAAY,GAAG,UAAU,CAC5E,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3B,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,aAAa,EACb,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,SAAS,EACT,OAAO,EACP,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,OAAO,EACP,WAAW,EACX,QAAQ,EACR,SAAS,EACT,WAAW,EACX,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,eAAe,EACf,WAAW,EACX,GAAG,SAAS,EACb,EAAE,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAuLc,gBAAgB;;;;;;;;;;EA0CrD"}
1
+ {"version":3,"file":"use-multiselect.d.ts","sourceRoot":"","sources":["../../../src/multiselect/use-multiselect.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,wCAAwC,CAAC;AAChG,OAAO,EAAE,cAAc,EAAiC,MAAM,0CAA0C,CAAC;AAIzG,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAO7D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,KAAK,qBAAqB,GAAG,YAAY,CACvC,IAAI,CACF,gBAAgB,EACd,SAAS,GACT,iBAAiB,GACjB,eAAe,GACf,sBAAsB,GACtB,UAAU,GACV,SAAS,GACT,2BAA2B,GAC3B,mBAAmB,GACnB,UAAU,GACV,QAAQ,GACR,SAAS,GACT,aAAa,GACb,UAAU,GACV,mBAAmB,GACnB,iBAAiB,GACjB,aAAa,CAChB,GACC,mBAAmB,GAAG;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;CAC9C,EACH,SAAS,GAAG,iBAAiB,GAAG,eAAe,GAAG,YAAY,GAAG,UAAU,CAC5E,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3B,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,aAAa,EACb,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,SAAS,EACT,OAAO,EACP,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,OAAO,EACP,WAAW,EACX,QAAQ,EACR,SAAS,EACT,WAAW,EACX,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,eAAe,EACf,WAAW,EACX,GAAG,SAAS,EACb,EAAE,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAsLc,gBAAgB;;;;;;;;;;EA0CrD"}
@@ -122,7 +122,6 @@ export function useMultiselect(_a) {
122
122
  isEmpty,
123
123
  isNoMatch,
124
124
  noMatch,
125
- isFiltered,
126
125
  filteringResultsText: filteredText,
127
126
  onRecoveryClick: handleRecoveryClick,
128
127
  errorIconAriaLabel: errorIconAriaLabel,
@@ -1 +1 @@
1
- {"version":3,"file":"use-multiselect.js","sourceRoot":"","sources":["../../../src/multiselect/use-multiselect.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,iB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;QACd,cAAc;QACd,eAAe,EAAE,cAAc;QAC/B,aAAa;QACb,aAAa;QACb,cAAc;QACd,eAAe;QACf,YAAY,EAAE,GAAG,EAAE,CAAC,iCACf,YAAY,EAAE,KACjB,UAAU,EAAE,cAAc,EAC1B,cAAc,EAAE,WAAW,CAAC,WAAW,EAAE,SAAS,CAAC,EACnD,eAAe,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAC9D,QAAQ,IACR;QACF,cAAc;QACd,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;QACpD,gBAAgB,EAAE,GAAG,EAAE,CAAC,iCAAM,gBAAgB,EAAE,KAAE,WAAW,EAAE,mBAAmB,IAAG;QACrF,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;QACxD,gBAAgB;KACjB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { DropdownStatusProps, useDropdownStatus } from '../internal/components/dropdown-status';\nimport { DropdownOption, OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport { isGroup } from '../internal/components/option/utils/filter-options';\nimport { prepareOptions } from '../internal/components/option/utils/prepare-options';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { SomeRequired } from '../internal/types';\nimport { joinStrings } from '../internal/utils/strings';\nimport { SelectListProps } from '../select/parts/plain-list';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field.js';\nimport { findOptionIndex } from '../select/utils/connect-options';\nimport { useAnnouncement } from '../select/utils/use-announcement';\nimport { useLoadItems } from '../select/utils/use-load-items';\nimport { useNativeSearch } from '../select/utils/use-native-search';\nimport { useSelect } from '../select/utils/use-select';\nimport { TokenGroupProps } from '../token-group/interfaces';\nimport { MultiselectProps } from './interfaces';\n\ntype UseMultiselectOptions = SomeRequired<\n Pick<\n MultiselectProps,\n | 'options'\n | 'selectedOptions'\n | 'filteringType'\n | 'filteringResultsText'\n | 'disabled'\n | 'noMatch'\n | 'renderHighlightedAriaLive'\n | 'deselectAriaLabel'\n | 'keepOpen'\n | 'onBlur'\n | 'onFocus'\n | 'onLoadItems'\n | 'onChange'\n | 'selectedAriaLabel'\n | 'enableSelectAll'\n | 'i18nStrings'\n > &\n DropdownStatusProps & {\n controlId?: string;\n ariaLabelId: string;\n footerId: string;\n filteringValue: string;\n setFilteringValue?: (value: string) => void;\n externalRef: React.Ref<MultiselectProps.Ref>;\n },\n 'options' | 'selectedOptions' | 'filteringType' | 'statusType' | 'keepOpen'\n> & { embedded?: boolean };\n\nexport function useMultiselect({\n options,\n filteringType,\n filteringResultsText,\n disabled,\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n noMatch,\n renderHighlightedAriaLive,\n selectedOptions,\n deselectAriaLabel,\n keepOpen,\n onBlur,\n onFocus,\n onLoadItems,\n onChange,\n controlId,\n ariaLabelId,\n footerId,\n filteringValue,\n setFilteringValue,\n externalRef,\n embedded,\n enableSelectAll,\n i18nStrings,\n ...restProps\n}: UseMultiselectOptions) {\n checkOptionValueField('Multiselect', 'options', options);\n\n const i18n = useInternalI18n('multiselect');\n const i18nCommon = useInternalI18n('select');\n const recoveryText = i18nCommon('recoveryText', restProps.recoveryText);\n const errorIconAriaLabel = i18nCommon('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18nCommon('selectedAriaLabel', restProps.selectedAriaLabel);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Multiselect', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const { handleLoadMore, handleRecoveryClick, fireLoadItems } = useLoadItems({\n onLoadItems,\n options,\n statusType,\n });\n const useInteractiveGroups = true;\n const { flatOptions, filteredOptions, parentMap, totalCount, matchesCount } = prepareOptions(\n options,\n filteringType,\n filteringValue\n );\n\n const selectAllOption: DropdownOption = {\n type: 'select-all',\n afterHeader: filteringType !== 'none',\n option: { label: i18n('i18nStrings.selectAllText', i18nStrings?.selectAllText) },\n };\n\n const visibleOptions =\n enableSelectAll && filteredOptions.length ? [selectAllOption, ...filteredOptions] : filteredOptions;\n\n // Includes visible and non-visible (filtered out) options\n const allNonParentOptions = flatOptions.filter(item => item.type !== 'parent').map(option => option.option);\n\n const filteredNonParentOptions = filteredOptions.filter(item => item.type !== 'parent').map(item => item.option);\n\n const selectedValues = useMemo(() => new Set(selectedOptions.map(option => option.value)), [selectedOptions]);\n\n const isSomeSelected = selectedOptions.length > 0;\n const isAllVisibleSelectableSelected =\n isSomeSelected && filteredNonParentOptions.every(option => option.disabled || selectedValues.has(option.value));\n const isAllSelected = allNonParentOptions.every(option => selectedValues.has(option.value));\n\n const toggleAll = () => {\n const filteredNonParentOptionValues = new Set(filteredNonParentOptions.map(option => option.value));\n fireNonCancelableEvent(onChange, {\n selectedOptions: isAllVisibleSelectableSelected\n ? selectedOptions.filter(option => !filteredNonParentOptionValues.has(option.value))\n : allNonParentOptions.filter(\n ({ disabled, value }) =>\n selectedValues.has(value) || (!disabled && filteredNonParentOptionValues.has(value))\n ),\n });\n };\n\n const updateSelectedOption = useCallback(\n (option: OptionDefinition | OptionGroup) => {\n // switch between selection and deselection behavior, ignores disabled options to prevent\n // getting stuck on one behavior when an option is disabled and its state cannot be changed\n const isAllChildrenSelected = (optionsArray: OptionDefinition[]) =>\n optionsArray.every(item => findOptionIndex(selectedOptions, item) > -1 || item.disabled);\n const intersection = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) > -1 && !item.disabled);\n const union = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) === -1).concat(options);\n const select = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return union(selectedOptions, options);\n };\n const unselect = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return selectedOptions.filter(option => findOptionIndex(options, option) === -1);\n };\n let newSelectedOptions = [...selectedOptions];\n\n if (isGroup(option)) {\n const visibleOptions = intersection([...option.options], filteredNonParentOptions);\n newSelectedOptions = isAllChildrenSelected(visibleOptions)\n ? unselect(visibleOptions, newSelectedOptions)\n : select(visibleOptions, newSelectedOptions);\n } else {\n newSelectedOptions = isAllChildrenSelected([option])\n ? unselect([option], newSelectedOptions)\n : select([option], newSelectedOptions);\n }\n\n fireNonCancelableEvent(onChange, {\n selectedOptions: newSelectedOptions,\n });\n },\n [selectedOptions, onChange, filteredNonParentOptions]\n );\n\n const scrollToIndex = useRef<SelectListProps.SelectListRef>(null);\n const {\n isOpen,\n highlightType,\n highlightedOption,\n highlightedIndex,\n getTriggerProps,\n getDropdownProps,\n getFilterProps,\n getMenuProps,\n getOptionProps,\n highlightOption,\n announceSelected,\n } = useSelect({\n selectedOptions,\n updateSelectedOption,\n options: visibleOptions,\n filteringType,\n onFocus,\n onBlur,\n externalRef,\n keepOpen,\n fireLoadItems,\n setFilteringValue,\n useInteractiveGroups,\n statusType,\n embedded,\n isAllSelected,\n isSomeSelected,\n toggleAll,\n });\n\n const wrapperOnKeyDown = useNativeSearch({\n isEnabled: filteringType === 'none' && isOpen,\n options: visibleOptions,\n highlightOption: highlightOption,\n highlightedOption: highlightedOption?.option,\n useInteractiveGroups,\n });\n\n const isEmpty = !options || options.length === 0;\n const isNoMatch = filteredOptions && filteredOptions.length === 0;\n const isFiltered =\n filteringType !== 'none' && filteringValue.length > 0 && filteredOptions && filteredOptions.length > 0;\n const filteredText = isFiltered ? filteringResultsText?.(matchesCount, totalCount) : undefined;\n const dropdownStatus = useDropdownStatus({\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n isFiltered,\n filteringResultsText: filteredText,\n onRecoveryClick: handleRecoveryClick,\n errorIconAriaLabel: errorIconAriaLabel,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const announcement = useAnnouncement({\n announceSelected,\n highlightedOption,\n getParent: option => parentMap.get(option)?.option as undefined | OptionGroup,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n });\n\n const tokens: TokenGroupProps['items'] = selectedOptions.map(option => ({\n label: option.label,\n disabled: disabled || option.disabled,\n labelTag: option.labelTag,\n description: option.description,\n iconAlt: option.iconAlt,\n iconName: option.iconName,\n iconUrl: option.iconUrl,\n iconSvg: option.iconSvg,\n tags: option.tags,\n dismissLabel: i18n('deselectAriaLabel', deselectAriaLabel?.(option), format =>\n format({ option__label: option.label ?? '' })\n ),\n }));\n\n useEffect(() => {\n scrollToIndex.current?.(highlightedIndex);\n }, [highlightedIndex]);\n\n const dropdownOnMouseDown = (event: React.MouseEvent) => {\n const target = event.target as HTMLElement;\n\n if (target !== document.activeElement) {\n // prevent currently focused element from losing it\n event.preventDefault();\n }\n };\n\n const tokenOnDismiss: TokenGroupProps['onDismiss'] = ({ detail }) => {\n const optionToDeselect = selectedOptions[detail.itemIndex];\n updateSelectedOption(optionToDeselect);\n const targetRef = getTriggerProps().ref;\n if (targetRef.current) {\n targetRef.current.focus();\n }\n };\n\n return {\n isOpen,\n tokens,\n announcement,\n dropdownStatus,\n filteringValue,\n filteredOptions: visibleOptions,\n highlightType,\n scrollToIndex,\n getFilterProps,\n getTriggerProps,\n getMenuProps: () => ({\n ...getMenuProps(),\n onLoadMore: handleLoadMore,\n ariaLabelledby: joinStrings(ariaLabelId, controlId),\n ariaDescribedby: dropdownStatus.content ? footerId : undefined,\n embedded,\n }),\n getOptionProps,\n getTokenProps: () => ({ onDismiss: tokenOnDismiss }),\n getDropdownProps: () => ({ ...getDropdownProps(), onMouseDown: dropdownOnMouseDown }),\n getWrapperProps: () => ({ onKeyDown: wrapperOnKeyDown }),\n highlightedIndex,\n };\n}\n"]}
1
+ {"version":3,"file":"use-multiselect.js","sourceRoot":"","sources":["../../../src/multiselect/use-multiselect.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAuB,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,oDAAoD,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAmCvD,MAAM,UAAU,cAAc,CAAC,EA6BP;QA7BO,EAC7B,OAAO,EACP,aAAa,EACb,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,SAAS,EACT,OAAO,EACP,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,OAAO,EACP,WAAW,EACX,QAAQ,EACR,SAAS,EACT,WAAW,EACX,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,QAAQ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AAe,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC3D,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;QACvC,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC,GAAG,CAAC;QACxC,IAAI,SAAS,CAAC,OAAO,EAAE;YACrB,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;SAC3B;IACH,CAAC,CAAC;IAEF,OAAO;QACL,MAAM;QACN,MAAM;QACN,YAAY;QACZ,cAAc;QACd,cAAc;QACd,eAAe,EAAE,cAAc;QAC/B,aAAa;QACb,aAAa;QACb,cAAc;QACd,eAAe;QACf,YAAY,EAAE,GAAG,EAAE,CAAC,iCACf,YAAY,EAAE,KACjB,UAAU,EAAE,cAAc,EAC1B,cAAc,EAAE,WAAW,CAAC,WAAW,EAAE,SAAS,CAAC,EACnD,eAAe,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAC9D,QAAQ,IACR;QACF,cAAc;QACd,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;QACpD,gBAAgB,EAAE,GAAG,EAAE,CAAC,iCAAM,gBAAgB,EAAE,KAAE,WAAW,EAAE,mBAAmB,IAAG;QACrF,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;QACxD,gBAAgB;KACjB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { DropdownStatusProps, useDropdownStatus } from '../internal/components/dropdown-status';\nimport { DropdownOption, OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport { isGroup } from '../internal/components/option/utils/filter-options';\nimport { prepareOptions } from '../internal/components/option/utils/prepare-options';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { SomeRequired } from '../internal/types';\nimport { joinStrings } from '../internal/utils/strings';\nimport { SelectListProps } from '../select/parts/plain-list';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field.js';\nimport { findOptionIndex } from '../select/utils/connect-options';\nimport { useAnnouncement } from '../select/utils/use-announcement';\nimport { useLoadItems } from '../select/utils/use-load-items';\nimport { useNativeSearch } from '../select/utils/use-native-search';\nimport { useSelect } from '../select/utils/use-select';\nimport { TokenGroupProps } from '../token-group/interfaces';\nimport { MultiselectProps } from './interfaces';\n\ntype UseMultiselectOptions = SomeRequired<\n Pick<\n MultiselectProps,\n | 'options'\n | 'selectedOptions'\n | 'filteringType'\n | 'filteringResultsText'\n | 'disabled'\n | 'noMatch'\n | 'renderHighlightedAriaLive'\n | 'deselectAriaLabel'\n | 'keepOpen'\n | 'onBlur'\n | 'onFocus'\n | 'onLoadItems'\n | 'onChange'\n | 'selectedAriaLabel'\n | 'enableSelectAll'\n | 'i18nStrings'\n > &\n DropdownStatusProps & {\n controlId?: string;\n ariaLabelId: string;\n footerId: string;\n filteringValue: string;\n setFilteringValue?: (value: string) => void;\n externalRef: React.Ref<MultiselectProps.Ref>;\n },\n 'options' | 'selectedOptions' | 'filteringType' | 'statusType' | 'keepOpen'\n> & { embedded?: boolean };\n\nexport function useMultiselect({\n options,\n filteringType,\n filteringResultsText,\n disabled,\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n noMatch,\n renderHighlightedAriaLive,\n selectedOptions,\n deselectAriaLabel,\n keepOpen,\n onBlur,\n onFocus,\n onLoadItems,\n onChange,\n controlId,\n ariaLabelId,\n footerId,\n filteringValue,\n setFilteringValue,\n externalRef,\n embedded,\n enableSelectAll,\n i18nStrings,\n ...restProps\n}: UseMultiselectOptions) {\n checkOptionValueField('Multiselect', 'options', options);\n\n const i18n = useInternalI18n('multiselect');\n const i18nCommon = useInternalI18n('select');\n const recoveryText = i18nCommon('recoveryText', restProps.recoveryText);\n const errorIconAriaLabel = i18nCommon('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18nCommon('selectedAriaLabel', restProps.selectedAriaLabel);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Multiselect', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const { handleLoadMore, handleRecoveryClick, fireLoadItems } = useLoadItems({\n onLoadItems,\n options,\n statusType,\n });\n const useInteractiveGroups = true;\n const { flatOptions, filteredOptions, parentMap, totalCount, matchesCount } = prepareOptions(\n options,\n filteringType,\n filteringValue\n );\n\n const selectAllOption: DropdownOption = {\n type: 'select-all',\n afterHeader: filteringType !== 'none',\n option: { label: i18n('i18nStrings.selectAllText', i18nStrings?.selectAllText) },\n };\n\n const visibleOptions =\n enableSelectAll && filteredOptions.length ? [selectAllOption, ...filteredOptions] : filteredOptions;\n\n // Includes visible and non-visible (filtered out) options\n const allNonParentOptions = flatOptions.filter(item => item.type !== 'parent').map(option => option.option);\n\n const filteredNonParentOptions = filteredOptions.filter(item => item.type !== 'parent').map(item => item.option);\n\n const selectedValues = useMemo(() => new Set(selectedOptions.map(option => option.value)), [selectedOptions]);\n\n const isSomeSelected = selectedOptions.length > 0;\n const isAllVisibleSelectableSelected =\n isSomeSelected && filteredNonParentOptions.every(option => option.disabled || selectedValues.has(option.value));\n const isAllSelected = allNonParentOptions.every(option => selectedValues.has(option.value));\n\n const toggleAll = () => {\n const filteredNonParentOptionValues = new Set(filteredNonParentOptions.map(option => option.value));\n fireNonCancelableEvent(onChange, {\n selectedOptions: isAllVisibleSelectableSelected\n ? selectedOptions.filter(option => !filteredNonParentOptionValues.has(option.value))\n : allNonParentOptions.filter(\n ({ disabled, value }) =>\n selectedValues.has(value) || (!disabled && filteredNonParentOptionValues.has(value))\n ),\n });\n };\n\n const updateSelectedOption = useCallback(\n (option: OptionDefinition | OptionGroup) => {\n // switch between selection and deselection behavior, ignores disabled options to prevent\n // getting stuck on one behavior when an option is disabled and its state cannot be changed\n const isAllChildrenSelected = (optionsArray: OptionDefinition[]) =>\n optionsArray.every(item => findOptionIndex(selectedOptions, item) > -1 || item.disabled);\n const intersection = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) > -1 && !item.disabled);\n const union = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) === -1).concat(options);\n const select = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return union(selectedOptions, options);\n };\n const unselect = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return selectedOptions.filter(option => findOptionIndex(options, option) === -1);\n };\n let newSelectedOptions = [...selectedOptions];\n\n if (isGroup(option)) {\n const visibleOptions = intersection([...option.options], filteredNonParentOptions);\n newSelectedOptions = isAllChildrenSelected(visibleOptions)\n ? unselect(visibleOptions, newSelectedOptions)\n : select(visibleOptions, newSelectedOptions);\n } else {\n newSelectedOptions = isAllChildrenSelected([option])\n ? unselect([option], newSelectedOptions)\n : select([option], newSelectedOptions);\n }\n\n fireNonCancelableEvent(onChange, {\n selectedOptions: newSelectedOptions,\n });\n },\n [selectedOptions, onChange, filteredNonParentOptions]\n );\n\n const scrollToIndex = useRef<SelectListProps.SelectListRef>(null);\n const {\n isOpen,\n highlightType,\n highlightedOption,\n highlightedIndex,\n getTriggerProps,\n getDropdownProps,\n getFilterProps,\n getMenuProps,\n getOptionProps,\n highlightOption,\n announceSelected,\n } = useSelect({\n selectedOptions,\n updateSelectedOption,\n options: visibleOptions,\n filteringType,\n onFocus,\n onBlur,\n externalRef,\n keepOpen,\n fireLoadItems,\n setFilteringValue,\n useInteractiveGroups,\n statusType,\n embedded,\n isAllSelected,\n isSomeSelected,\n toggleAll,\n });\n\n const wrapperOnKeyDown = useNativeSearch({\n isEnabled: filteringType === 'none' && isOpen,\n options: visibleOptions,\n highlightOption: highlightOption,\n highlightedOption: highlightedOption?.option,\n useInteractiveGroups,\n });\n\n const isEmpty = !options || options.length === 0;\n const isNoMatch = filteredOptions && filteredOptions.length === 0;\n const isFiltered =\n filteringType !== 'none' && filteringValue.length > 0 && filteredOptions && filteredOptions.length > 0;\n const filteredText = isFiltered ? filteringResultsText?.(matchesCount, totalCount) : undefined;\n const dropdownStatus = useDropdownStatus({\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n filteringResultsText: filteredText,\n onRecoveryClick: handleRecoveryClick,\n errorIconAriaLabel: errorIconAriaLabel,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const announcement = useAnnouncement({\n announceSelected,\n highlightedOption,\n getParent: option => parentMap.get(option)?.option as undefined | OptionGroup,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n });\n\n const tokens: TokenGroupProps['items'] = selectedOptions.map(option => ({\n label: option.label,\n disabled: disabled || option.disabled,\n labelTag: option.labelTag,\n description: option.description,\n iconAlt: option.iconAlt,\n iconName: option.iconName,\n iconUrl: option.iconUrl,\n iconSvg: option.iconSvg,\n tags: option.tags,\n dismissLabel: i18n('deselectAriaLabel', deselectAriaLabel?.(option), format =>\n format({ option__label: option.label ?? '' })\n ),\n }));\n\n useEffect(() => {\n scrollToIndex.current?.(highlightedIndex);\n }, [highlightedIndex]);\n\n const dropdownOnMouseDown = (event: React.MouseEvent) => {\n const target = event.target as HTMLElement;\n\n if (target !== document.activeElement) {\n // prevent currently focused element from losing it\n event.preventDefault();\n }\n };\n\n const tokenOnDismiss: TokenGroupProps['onDismiss'] = ({ detail }) => {\n const optionToDeselect = selectedOptions[detail.itemIndex];\n updateSelectedOption(optionToDeselect);\n const targetRef = getTriggerProps().ref;\n if (targetRef.current) {\n targetRef.current.focus();\n }\n };\n\n return {\n isOpen,\n tokens,\n announcement,\n dropdownStatus,\n filteringValue,\n filteredOptions: visibleOptions,\n highlightType,\n scrollToIndex,\n getFilterProps,\n getTriggerProps,\n getMenuProps: () => ({\n ...getMenuProps(),\n onLoadMore: handleLoadMore,\n ariaLabelledby: joinStrings(ariaLabelId, controlId),\n ariaDescribedby: dropdownStatus.content ? footerId : undefined,\n embedded,\n }),\n getOptionProps,\n getTokenProps: () => ({ onDismiss: tokenOnDismiss }),\n getDropdownProps: () => ({ ...getDropdownProps(), onMouseDown: dropdownOnMouseDown }),\n getWrapperProps: () => ({ onKeyDown: wrapperOnKeyDown }),\n highlightedIndex,\n };\n}\n"]}
package/package.json CHANGED
@@ -151,7 +151,7 @@
151
151
  "./internal/base-component/index.js",
152
152
  "./internal/base-component/styles.css.js"
153
153
  ],
154
- "version": "3.0.1108",
154
+ "version": "3.0.1110",
155
155
  "repository": {
156
156
  "type": "git",
157
157
  "url": "https://github.com/cloudscape-design/components.git"
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/select/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAe3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAa3C,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,0BAA0B;IAC3G,kBAAkB,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CACxC;AAED,QAAA,MAAM,cAAc,6FAqPnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/select/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAe3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAa3C,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,0BAA0B;IAC3G,kBAAkB,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CACxC;AAED,QAAA,MAAM,cAAc,6FAoPnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -90,7 +90,6 @@ const InternalSelect = React.forwardRef((_a, externalRef) => {
90
90
  isEmpty,
91
91
  isNoMatch,
92
92
  noMatch,
93
- isFiltered,
94
93
  filteringResultsText: filteredText,
95
94
  errorIconAriaLabel,
96
95
  onRecoveryClick: handleRecoveryClick,
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/select/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEpG,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAGjE,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAExE,OAAO,MAAM,MAAM,g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AAkB,EAC1C,yBAAyB,EAAE,IAAI,EAC/B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,eAAe,EAC5B,MAAM,EACJ,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CACxB,oBAAC,cAAc,IAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,GAAI,CAClF,CAAC,CAAC,CAAC,IAAI,EAEV,gBAAgB,EAAE,gBAAgB;YAElC,oBAAC,aAAa,IACZ,UAAU,EACR,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CACzB,oBAAC,cAAc,IAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,GAAI,CAClF,CAAC,CAAC,CAAC,IAAI,EAEV,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,aAAa,EAClB,iBAAiB,EAAE,cAAc,CAAC,OAAO,KAAK,IAAI,EAClD,mBAAmB,EAAE,YAAY,EACjC,aAAa,EAAE,aAAa,GAC5B,CACO;QACX,6BAAK,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,iBAAiB,IACrC,SAAS,IAAI,eAAe,CACzB,CACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context.js';\nimport { getBaseProps } from '../internal/base-component';\nimport Dropdown from '../internal/components/dropdown';\nimport DropdownFooter from '../internal/components/dropdown-footer';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport { OptionGroup } from '../internal/components/option/interfaces.js';\nimport { prepareOptions } from '../internal/components/option/utils/prepare-options.js';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { SomeRequired } from '../internal/types';\nimport { joinStrings } from '../internal/utils/strings/join-strings.js';\nimport { SelectProps } from './interfaces';\nimport Filter from './parts/filter';\nimport PlainList, { SelectListProps } from './parts/plain-list';\nimport Trigger from './parts/trigger';\nimport VirtualList from './parts/virtual-list';\nimport { checkOptionValueField } from './utils/check-option-value-field';\nimport { useAnnouncement } from './utils/use-announcement';\nimport { useLoadItems } from './utils/use-load-items';\nimport { useNativeSearch } from './utils/use-native-search';\nimport { useSelect } from './utils/use-select';\n\nimport styles from './styles.css.js';\n\nexport interface InternalSelectProps extends SomeRequired<SelectProps, 'options'>, InternalBaseComponentProps {\n __inFilteringToken?: 'root' | 'nested';\n}\n\nconst InternalSelect = React.forwardRef(\n (\n {\n options,\n filteringType = 'none',\n filteringPlaceholder,\n filteringAriaLabel,\n filteringClearAriaLabel,\n filteringResultsText,\n inlineLabelText,\n ariaRequired,\n placeholder,\n disabled,\n readOnly,\n ariaLabel,\n statusType = 'finished',\n empty,\n loadingText,\n finishedText,\n errorText,\n noMatch,\n triggerVariant = 'label',\n renderHighlightedAriaLive,\n selectedOption,\n onBlur,\n onFocus,\n onLoadItems,\n onChange,\n virtualScroll,\n expandToViewport,\n autoFocus,\n __inFilteringToken,\n __internalRootRef,\n ...restProps\n }: InternalSelectProps,\n externalRef: React.Ref<SelectProps.Ref>\n ) => {\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n\n const i18n = useInternalI18n('select');\n const errorIconAriaLabel = i18n('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18n('selectedAriaLabel', restProps.selectedAriaLabel);\n const recoveryText = i18n('recoveryText', restProps.recoveryText);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Select', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const { handleLoadMore, handleRecoveryClick, fireLoadItems } = useLoadItems({\n onLoadItems,\n options,\n statusType,\n });\n\n checkControlled('Select', 'selectedOption', selectedOption, 'onChange', onChange);\n\n checkOptionValueField('Select', 'options', options);\n\n const [filteringValue, setFilteringValue] = useState('');\n\n const { filteredOptions, parentMap, totalCount, matchesCount } = prepareOptions(\n options,\n filteringType,\n filteringValue\n );\n\n const rootRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n\n const selfControlId = useUniqueId('trigger');\n const controlId = formFieldContext.controlId ?? selfControlId;\n\n const scrollToIndex = useRef<SelectListProps.SelectListRef>(null);\n const {\n isOpen,\n highlightType,\n highlightedOption,\n highlightedIndex,\n getTriggerProps,\n getDropdownProps,\n getFilterProps,\n getMenuProps,\n getOptionProps,\n highlightOption,\n selectOption,\n announceSelected,\n } = useSelect({\n selectedOptions: selectedOption ? [selectedOption] : [],\n updateSelectedOption: option => fireNonCancelableEvent(onChange, { selectedOption: option }),\n options: filteredOptions,\n filteringType,\n onBlur,\n onFocus,\n externalRef,\n fireLoadItems,\n setFilteringValue,\n statusType,\n });\n\n const handleNativeSearch = useNativeSearch({\n isEnabled: filteringType === 'none' && !readOnly,\n options: filteredOptions,\n highlightOption: !isOpen ? selectOption : highlightOption,\n highlightedOption: !isOpen ? selectedOption : highlightedOption?.option,\n });\n\n const selectAriaLabelId = useUniqueId('select-arialabel-');\n const footerId = useUniqueId('footer');\n\n useEffect(() => {\n scrollToIndex.current?.(highlightedIndex);\n }, [highlightedIndex]);\n\n const filter = (\n <Filter\n clearAriaLabel={filteringClearAriaLabel}\n filteringType={filteringType}\n placeholder={filteringPlaceholder}\n ariaLabel={filteringAriaLabel}\n ariaRequired={ariaRequired}\n value={filteringValue}\n {...getFilterProps()}\n />\n );\n\n const trigger = (\n <Trigger\n ref={triggerRef}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n triggerVariant={triggerVariant}\n triggerProps={getTriggerProps(disabled, autoFocus)}\n selectedOption={selectedOption}\n isOpen={isOpen}\n inFilteringToken={__inFilteringToken}\n inlineLabelText={inlineLabelText}\n {...formFieldContext}\n controlId={controlId}\n ariaLabelledby={joinStrings(formFieldContext.ariaLabelledby, selectAriaLabelId)}\n />\n );\n\n const isEmpty = !options || options.length === 0;\n const isNoMatch = filteredOptions && filteredOptions.length === 0;\n const isFiltered =\n filteringType !== 'none' && filteringValue.length > 0 && filteredOptions && filteredOptions.length > 0;\n const filteredText = isFiltered ? filteringResultsText?.(matchesCount, totalCount) : undefined;\n\n const dropdownStatus = useDropdownStatus({\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n isFiltered,\n filteringResultsText: filteredText,\n errorIconAriaLabel,\n onRecoveryClick: handleRecoveryClick,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const menuProps = {\n ...getMenuProps(),\n onLoadMore: handleLoadMore,\n ariaLabelledby: joinStrings(selectAriaLabelId, controlId),\n ariaDescribedby: dropdownStatus.content ? footerId : undefined,\n };\n\n const announcement = useAnnouncement({\n announceSelected,\n highlightedOption,\n getParent: option => parentMap.get(option)?.option as undefined | OptionGroup,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n });\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const handleMouseDown = (event: React.MouseEvent) => {\n const target = event.target as HTMLElement;\n\n if (target !== document.activeElement) {\n // prevent currently focused element from losing it\n event.preventDefault();\n }\n };\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n const dropdownProps = getDropdownProps();\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(styles.root, baseProps.className)}\n onKeyDown={handleNativeSearch}\n >\n <Dropdown\n {...dropdownProps}\n ariaLabelledby={dropdownProps.dropdownContentRole ? joinStrings(selectAriaLabelId, controlId) : undefined}\n ariaDescribedby={\n dropdownProps.dropdownContentRole ? (dropdownStatus.content ? footerId : undefined) : undefined\n }\n open={isOpen}\n stretchTriggerHeight={!!__inFilteringToken}\n stretchBeyondTriggerWidth={true}\n trigger={trigger}\n header={filter}\n onMouseDown={handleMouseDown}\n footer={\n dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n expandToViewport={expandToViewport}\n >\n <ListComponent\n listBottom={\n !dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n menuProps={menuProps}\n getOptionProps={getOptionProps}\n filteredOptions={filteredOptions}\n filteringValue={filteringValue}\n ref={scrollToIndex}\n hasDropdownStatus={dropdownStatus.content !== null}\n screenReaderContent={announcement}\n highlightType={highlightType}\n />\n </Dropdown>\n <div hidden={true} id={selectAriaLabelId}>\n {ariaLabel || inlineLabelText}\n </div>\n </div>\n );\n }\n);\n\nexport default InternalSelect;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/select/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEpG,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,cAAc,MAAM,wCAAwC,C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,eAAe,CACzB,CACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context.js';\nimport { getBaseProps } from '../internal/base-component';\nimport Dropdown from '../internal/components/dropdown';\nimport DropdownFooter from '../internal/components/dropdown-footer';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport { OptionGroup } from '../internal/components/option/interfaces.js';\nimport { prepareOptions } from '../internal/components/option/utils/prepare-options.js';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { SomeRequired } from '../internal/types';\nimport { joinStrings } from '../internal/utils/strings/join-strings.js';\nimport { SelectProps } from './interfaces';\nimport Filter from './parts/filter';\nimport PlainList, { SelectListProps } from './parts/plain-list';\nimport Trigger from './parts/trigger';\nimport VirtualList from './parts/virtual-list';\nimport { checkOptionValueField } from './utils/check-option-value-field';\nimport { useAnnouncement } from './utils/use-announcement';\nimport { useLoadItems } from './utils/use-load-items';\nimport { useNativeSearch } from './utils/use-native-search';\nimport { useSelect } from './utils/use-select';\n\nimport styles from './styles.css.js';\n\nexport interface InternalSelectProps extends SomeRequired<SelectProps, 'options'>, InternalBaseComponentProps {\n __inFilteringToken?: 'root' | 'nested';\n}\n\nconst InternalSelect = React.forwardRef(\n (\n {\n options,\n filteringType = 'none',\n filteringPlaceholder,\n filteringAriaLabel,\n filteringClearAriaLabel,\n filteringResultsText,\n inlineLabelText,\n ariaRequired,\n placeholder,\n disabled,\n readOnly,\n ariaLabel,\n statusType = 'finished',\n empty,\n loadingText,\n finishedText,\n errorText,\n noMatch,\n triggerVariant = 'label',\n renderHighlightedAriaLive,\n selectedOption,\n onBlur,\n onFocus,\n onLoadItems,\n onChange,\n virtualScroll,\n expandToViewport,\n autoFocus,\n __inFilteringToken,\n __internalRootRef,\n ...restProps\n }: InternalSelectProps,\n externalRef: React.Ref<SelectProps.Ref>\n ) => {\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n\n const i18n = useInternalI18n('select');\n const errorIconAriaLabel = i18n('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18n('selectedAriaLabel', restProps.selectedAriaLabel);\n const recoveryText = i18n('recoveryText', restProps.recoveryText);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Select', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const { handleLoadMore, handleRecoveryClick, fireLoadItems } = useLoadItems({\n onLoadItems,\n options,\n statusType,\n });\n\n checkControlled('Select', 'selectedOption', selectedOption, 'onChange', onChange);\n\n checkOptionValueField('Select', 'options', options);\n\n const [filteringValue, setFilteringValue] = useState('');\n\n const { filteredOptions, parentMap, totalCount, matchesCount } = prepareOptions(\n options,\n filteringType,\n filteringValue\n );\n\n const rootRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n\n const selfControlId = useUniqueId('trigger');\n const controlId = formFieldContext.controlId ?? selfControlId;\n\n const scrollToIndex = useRef<SelectListProps.SelectListRef>(null);\n const {\n isOpen,\n highlightType,\n highlightedOption,\n highlightedIndex,\n getTriggerProps,\n getDropdownProps,\n getFilterProps,\n getMenuProps,\n getOptionProps,\n highlightOption,\n selectOption,\n announceSelected,\n } = useSelect({\n selectedOptions: selectedOption ? [selectedOption] : [],\n updateSelectedOption: option => fireNonCancelableEvent(onChange, { selectedOption: option }),\n options: filteredOptions,\n filteringType,\n onBlur,\n onFocus,\n externalRef,\n fireLoadItems,\n setFilteringValue,\n statusType,\n });\n\n const handleNativeSearch = useNativeSearch({\n isEnabled: filteringType === 'none' && !readOnly,\n options: filteredOptions,\n highlightOption: !isOpen ? selectOption : highlightOption,\n highlightedOption: !isOpen ? selectedOption : highlightedOption?.option,\n });\n\n const selectAriaLabelId = useUniqueId('select-arialabel-');\n const footerId = useUniqueId('footer');\n\n useEffect(() => {\n scrollToIndex.current?.(highlightedIndex);\n }, [highlightedIndex]);\n\n const filter = (\n <Filter\n clearAriaLabel={filteringClearAriaLabel}\n filteringType={filteringType}\n placeholder={filteringPlaceholder}\n ariaLabel={filteringAriaLabel}\n ariaRequired={ariaRequired}\n value={filteringValue}\n {...getFilterProps()}\n />\n );\n\n const trigger = (\n <Trigger\n ref={triggerRef}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n triggerVariant={triggerVariant}\n triggerProps={getTriggerProps(disabled, autoFocus)}\n selectedOption={selectedOption}\n isOpen={isOpen}\n inFilteringToken={__inFilteringToken}\n inlineLabelText={inlineLabelText}\n {...formFieldContext}\n controlId={controlId}\n ariaLabelledby={joinStrings(formFieldContext.ariaLabelledby, selectAriaLabelId)}\n />\n );\n\n const isEmpty = !options || options.length === 0;\n const isNoMatch = filteredOptions && filteredOptions.length === 0;\n const isFiltered =\n filteringType !== 'none' && filteringValue.length > 0 && filteredOptions && filteredOptions.length > 0;\n const filteredText = isFiltered ? filteringResultsText?.(matchesCount, totalCount) : undefined;\n\n const dropdownStatus = useDropdownStatus({\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n filteringResultsText: filteredText,\n errorIconAriaLabel,\n onRecoveryClick: handleRecoveryClick,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const menuProps = {\n ...getMenuProps(),\n onLoadMore: handleLoadMore,\n ariaLabelledby: joinStrings(selectAriaLabelId, controlId),\n ariaDescribedby: dropdownStatus.content ? footerId : undefined,\n };\n\n const announcement = useAnnouncement({\n announceSelected,\n highlightedOption,\n getParent: option => parentMap.get(option)?.option as undefined | OptionGroup,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n });\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const handleMouseDown = (event: React.MouseEvent) => {\n const target = event.target as HTMLElement;\n\n if (target !== document.activeElement) {\n // prevent currently focused element from losing it\n event.preventDefault();\n }\n };\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n const dropdownProps = getDropdownProps();\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(styles.root, baseProps.className)}\n onKeyDown={handleNativeSearch}\n >\n <Dropdown\n {...dropdownProps}\n ariaLabelledby={dropdownProps.dropdownContentRole ? joinStrings(selectAriaLabelId, controlId) : undefined}\n ariaDescribedby={\n dropdownProps.dropdownContentRole ? (dropdownStatus.content ? footerId : undefined) : undefined\n }\n open={isOpen}\n stretchTriggerHeight={!!__inFilteringToken}\n stretchBeyondTriggerWidth={true}\n trigger={trigger}\n header={filter}\n onMouseDown={handleMouseDown}\n footer={\n dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n expandToViewport={expandToViewport}\n >\n <ListComponent\n listBottom={\n !dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n menuProps={menuProps}\n getOptionProps={getOptionProps}\n filteredOptions={filteredOptions}\n filteringValue={filteringValue}\n ref={scrollToIndex}\n hasDropdownStatus={dropdownStatus.content !== null}\n screenReaderContent={announcement}\n highlightType={highlightType}\n />\n </Dropdown>\n <div hidden={true} id={selectAriaLabelId}>\n {ariaLabel || inlineLabelText}\n </div>\n </div>\n );\n }\n);\n\nexport default InternalSelect;\n"]}