@cloudscape-design/components 3.0.1342 → 3.0.1343

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/expandable-section/expandable-section-header.d.ts +3 -1
  2. package/expandable-section/expandable-section-header.d.ts.map +1 -1
  3. package/expandable-section/expandable-section-header.js +57 -13
  4. package/expandable-section/expandable-section-header.js.map +1 -1
  5. package/expandable-section/interfaces.d.ts +1 -1
  6. package/expandable-section/interfaces.js.map +1 -1
  7. package/expandable-section/internal.d.ts +15 -0
  8. package/expandable-section/internal.d.ts.map +1 -1
  9. package/expandable-section/internal.js +3 -3
  10. package/expandable-section/internal.js.map +1 -1
  11. package/expandable-section/styles.css.js +42 -35
  12. package/expandable-section/styles.scoped.css +177 -69
  13. package/expandable-section/styles.selectors.js +42 -35
  14. package/i18n/messages/all.all.js +1 -1
  15. package/i18n/messages/all.all.json +1 -1
  16. package/i18n/messages/all.ar.js +1 -1
  17. package/i18n/messages/all.ar.json +1 -1
  18. package/i18n/messages/all.de.js +1 -1
  19. package/i18n/messages/all.de.json +1 -1
  20. package/i18n/messages/all.en-GB.js +1 -1
  21. package/i18n/messages/all.en-GB.json +1 -1
  22. package/i18n/messages/all.en.js +1 -1
  23. package/i18n/messages/all.en.json +1 -1
  24. package/i18n/messages/all.es.js +1 -1
  25. package/i18n/messages/all.es.json +1 -1
  26. package/i18n/messages/all.fr.js +1 -1
  27. package/i18n/messages/all.fr.json +1 -1
  28. package/i18n/messages/all.id.js +1 -1
  29. package/i18n/messages/all.id.json +1 -1
  30. package/i18n/messages/all.it.js +1 -1
  31. package/i18n/messages/all.it.json +1 -1
  32. package/i18n/messages/all.ja.js +1 -1
  33. package/i18n/messages/all.ja.json +1 -1
  34. package/i18n/messages/all.ko.js +1 -1
  35. package/i18n/messages/all.ko.json +1 -1
  36. package/i18n/messages/all.pt-BR.js +1 -1
  37. package/i18n/messages/all.pt-BR.json +1 -1
  38. package/i18n/messages/all.tr.js +1 -1
  39. package/i18n/messages/all.tr.json +1 -1
  40. package/i18n/messages/all.zh-CN.js +1 -1
  41. package/i18n/messages/all.zh-CN.json +1 -1
  42. package/i18n/messages/all.zh-TW.js +1 -1
  43. package/i18n/messages/all.zh-TW.json +1 -1
  44. package/i18n/messages-types.d.ts +5 -0
  45. package/i18n/messages-types.d.ts.map +1 -1
  46. package/i18n/messages-types.js.map +1 -1
  47. package/input/styles.css.js +28 -28
  48. package/input/styles.scoped.css +70 -70
  49. package/input/styles.selectors.js +28 -28
  50. package/internal/base-component/styles.scoped.css +6 -1
  51. package/internal/environment.js +2 -2
  52. package/internal/environment.json +2 -2
  53. package/internal/generated/styles/tokens.d.ts +1 -0
  54. package/internal/generated/styles/tokens.js +1 -0
  55. package/internal/generated/theming/index.cjs +31 -0
  56. package/internal/generated/theming/index.js +31 -0
  57. package/internal/manifest.json +1 -1
  58. package/manifest.json +2 -2
  59. package/multiselect/index.d.ts.map +1 -1
  60. package/multiselect/index.js +4 -0
  61. package/multiselect/index.js.map +1 -1
  62. package/multiselect/interfaces.d.ts +8 -1
  63. package/multiselect/interfaces.d.ts.map +1 -1
  64. package/multiselect/interfaces.js.map +1 -1
  65. package/multiselect/internal.d.ts.map +1 -1
  66. package/multiselect/internal.js +22 -2
  67. package/multiselect/internal.js.map +1 -1
  68. package/multiselect/styles.css.js +5 -3
  69. package/multiselect/styles.scoped.css +13 -3
  70. package/multiselect/styles.selectors.js +5 -3
  71. package/multiselect/use-multiselect.d.ts +4 -1
  72. package/multiselect/use-multiselect.d.ts.map +1 -1
  73. package/multiselect/use-multiselect.js +5 -3
  74. package/multiselect/use-multiselect.js.map +1 -1
  75. package/package.json +1 -1
  76. package/pagination/index.d.ts.map +1 -1
  77. package/pagination/index.js +3 -3
  78. package/pagination/index.js.map +1 -1
  79. package/pagination/interfaces.d.ts +19 -3
  80. package/pagination/interfaces.d.ts.map +1 -1
  81. package/pagination/interfaces.js.map +1 -1
  82. package/pagination/internal.d.ts.map +1 -1
  83. package/pagination/internal.js +18 -6
  84. package/pagination/internal.js.map +1 -1
  85. package/pagination/styles.css.js +12 -11
  86. package/pagination/styles.scoped.css +34 -25
  87. package/pagination/styles.selectors.js +12 -11
  88. package/pagination/test-classes/styles.css.js +6 -0
  89. package/pagination/test-classes/styles.scoped.css +7 -0
  90. package/pagination/test-classes/styles.selectors.js +7 -0
  91. package/prompt-input/internal.d.ts.map +1 -1
  92. package/prompt-input/internal.js +14 -2
  93. package/prompt-input/internal.js.map +1 -1
  94. package/select/index.d.ts.map +1 -1
  95. package/select/index.js +4 -0
  96. package/select/index.js.map +1 -1
  97. package/select/interfaces.d.ts +39 -0
  98. package/select/interfaces.d.ts.map +1 -1
  99. package/select/interfaces.js.map +1 -1
  100. package/select/internal.d.ts.map +1 -1
  101. package/select/internal.js +20 -4
  102. package/select/internal.js.map +1 -1
  103. package/select/styles.css.js +3 -1
  104. package/select/styles.scoped.css +11 -1
  105. package/select/styles.selectors.js +3 -1
  106. package/select/utils/dropdown-customization.d.ts +26 -0
  107. package/select/utils/dropdown-customization.d.ts.map +1 -0
  108. package/select/utils/dropdown-customization.js +22 -0
  109. package/select/utils/dropdown-customization.js.map +1 -0
  110. package/select/utils/use-select.d.ts +5 -1
  111. package/select/utils/use-select.d.ts.map +1 -1
  112. package/select/utils/use-select.js +21 -4
  113. package/select/utils/use-select.js.map +1 -1
  114. package/side-navigation/parts.d.ts.map +1 -1
  115. package/side-navigation/parts.js +3 -2
  116. package/side-navigation/parts.js.map +1 -1
  117. package/side-navigation/styles.css.js +50 -48
  118. package/side-navigation/styles.scoped.css +106 -93
  119. package/side-navigation/styles.selectors.js +50 -48
  120. package/test-utils/dom/multiselect/index.d.ts +16 -0
  121. package/test-utils/dom/multiselect/index.js +16 -0
  122. package/test-utils/dom/multiselect/index.js.map +1 -1
  123. package/test-utils/dom/pagination/index.d.ts +5 -1
  124. package/test-utils/dom/pagination/index.js +7 -0
  125. package/test-utils/dom/pagination/index.js.map +1 -1
  126. package/test-utils/dom/select/index.d.ts +16 -0
  127. package/test-utils/dom/select/index.js +16 -0
  128. package/test-utils/dom/select/index.js.map +1 -1
  129. package/test-utils/selectors/multiselect/index.d.ts +16 -0
  130. package/test-utils/selectors/multiselect/index.js +20 -0
  131. package/test-utils/selectors/multiselect/index.js.map +1 -1
  132. package/test-utils/selectors/pagination/index.d.ts +5 -1
  133. package/test-utils/selectors/pagination/index.js +7 -0
  134. package/test-utils/selectors/pagination/index.js.map +1 -1
  135. package/test-utils/selectors/select/index.d.ts +16 -0
  136. package/test-utils/selectors/select/index.js +20 -0
  137. package/test-utils/selectors/select/index.js.map +1 -1
  138. package/textarea/index.d.ts.map +1 -1
  139. package/textarea/index.js +11 -3
  140. package/textarea/index.js.map +1 -1
  141. package/textarea/interfaces.d.ts +12 -0
  142. package/textarea/interfaces.d.ts.map +1 -1
  143. package/textarea/interfaces.js.map +1 -1
  144. package/textarea/styles.css.js +9 -5
  145. package/textarea/styles.scoped.css +26 -14
  146. package/textarea/styles.selectors.js +9 -5
@@ -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,iBAAiB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEvH,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EA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,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,GAAI,CAClF,CAAC,CAAC,CAAC,IAAI,EAEV,gBAAgB,EAAE,gBAAgB;YAClC,qEAAqE;YACrE,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,EACzC,OAAO,EACL,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,YAAY,EAAE,YAAY,EAC1B,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,GAEJ;QACF,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, useResizeObserver, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport Dropdown from '../dropdown/internal';\nimport { useInternalI18n } from '../i18n/context.js';\nimport { getBaseProps } from '../internal/base-component';\nimport { getBreakpointValue } from '../internal/breakpoints';\nimport DropdownFooter from '../internal/components/dropdown-footer';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\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 { getDropdownMinWidth } from '../internal/utils/get-dropdown-min-width';\nimport { joinStrings } from '../internal/utils/strings/join-strings.js';\nimport { OptionGroup } from '../types/option';\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 renderOption,\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 const [triggerWidth, setTriggerWidth] = useState<number | null>(null);\n useResizeObserver(\n () => triggerRef.current,\n entry => entry.borderBoxWidth > 0 && setTriggerWidth(entry.borderBoxWidth)\n );\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 focusActiveRef,\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 renderOption={renderOption}\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: () => {\n handleRecoveryClick();\n focusActiveRef();\n },\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 ariaRequired,\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 const hasOptions = useRef(options.length > 0);\n hasOptions.current = hasOptions.current || options.length > 0;\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.ariaRole ? joinStrings(selectAriaLabelId, controlId) : undefined}\n ariaDescribedby={dropdownProps.ariaRole ? (dropdownStatus.content ? footerId : undefined) : undefined}\n open={isOpen}\n stretchTriggerHeight={!!__inFilteringToken}\n minWidth={getDropdownMinWidth({ expandToViewport, triggerWidth })}\n maxWidth={getBreakpointValue('xxs')} // AWSUI-19898\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 // Forces dropdown position recalculation when new options are loaded\n contentKey={hasOptions.current.toString()}\n content={\n <ListComponent\n listBottom={\n !dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n renderOption={renderOption}\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 }\n />\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,MA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AAE,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,EACzC,OAAO,EACL,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,YAAY,EAAE,YAAY,EAC1B,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,GAEJ;QACF,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, useResizeObserver, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport Dropdown from '../dropdown/internal';\nimport { useInternalI18n } from '../i18n/context.js';\nimport { getBaseProps } from '../internal/base-component';\nimport { getBreakpointValue } from '../internal/breakpoints';\nimport DropdownFooter from '../internal/components/dropdown-footer';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\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 { getDropdownMinWidth } from '../internal/utils/get-dropdown-min-width';\nimport { joinStrings } from '../internal/utils/strings/join-strings.js';\nimport { OptionGroup } from '../types/option';\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 { composeDropdownContent } from './utils/dropdown-customization';\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 renderOption,\n renderDropdownHeader,\n renderDropdownFooter,\n dropdownRole,\n dropdownAriaDescribedby,\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 const [triggerWidth, setTriggerWidth] = useState<number | null>(null);\n useResizeObserver(\n () => triggerRef.current,\n entry => entry.borderBoxWidth > 0 && setTriggerWidth(entry.borderBoxWidth)\n );\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 focusActiveRef,\n closeDropdown,\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 dropdownRole,\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 dropdownContentProps: SelectProps.DropdownContentProps = { filterText: filteringValue, closeDropdown };\n const customDropdownHeader = renderDropdownHeader?.(dropdownContentProps);\n const customDropdownFooter = renderDropdownFooter?.(dropdownContentProps);\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 renderOption={renderOption}\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: () => {\n handleRecoveryClick();\n focusActiveRef();\n },\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const statusFooter = dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null;\n const { header: dropdownHeader, footer: dropdownFooter } = composeDropdownContent({\n filter,\n customDropdownHeader,\n customDropdownFooter,\n statusFooter,\n dropdownHeaderClass: styles['dropdown-header'],\n dropdownFooterClass: styles['dropdown-footer'],\n });\n\n const menuProps = {\n ...getMenuProps(),\n onLoadMore: handleLoadMore,\n ariaLabelledby: joinStrings(selectAriaLabelId, controlId),\n ariaDescribedby: joinStrings(dropdownStatus.content ? footerId : undefined, dropdownAriaDescribedby),\n ariaRequired,\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 const hasOptions = useRef(options.length > 0);\n hasOptions.current = hasOptions.current || options.length > 0;\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.ariaRole ? joinStrings(selectAriaLabelId, controlId) : undefined}\n ariaDescribedby={\n dropdownProps.ariaRole\n ? joinStrings(dropdownStatus.content ? footerId : undefined, dropdownAriaDescribedby)\n : undefined\n }\n open={isOpen}\n stretchTriggerHeight={!!__inFilteringToken}\n minWidth={getDropdownMinWidth({ expandToViewport, triggerWidth })}\n maxWidth={getBreakpointValue('xxs')} // AWSUI-19898\n trigger={trigger}\n header={dropdownHeader}\n onMouseDown={handleMouseDown}\n footer={dropdownFooter}\n expandToViewport={expandToViewport}\n // Forces dropdown position recalculation when new options are loaded\n contentKey={hasOptions.current.toString()}\n content={\n <ListComponent\n listBottom={\n !dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n renderOption={renderOption}\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 }\n />\n <div hidden={true} id={selectAriaLabelId}>\n {ariaLabel || inlineLabelText}\n </div>\n </div>\n );\n }\n);\n\nexport default InternalSelect;\n"]}
@@ -1,6 +1,8 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_r2vco_v2s6g_145"
4
+ "root": "awsui_root_r2vco_f5yst_145",
5
+ "dropdown-header": "awsui_dropdown-header_r2vco_f5yst_177",
6
+ "dropdown-footer": "awsui_dropdown-footer_r2vco_f5yst_183"
5
7
  };
6
8
 
@@ -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_r2vco_v2s6g_145:not(#\9) {
145
+ .awsui_root_r2vco_f5yst_145:not(#\9) {
146
146
  border-collapse: separate;
147
147
  border-spacing: 0;
148
148
  box-sizing: border-box;
@@ -172,4 +172,14 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
172
172
  font-family: var(--font-family-base-gmnpzl, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
173
173
  -webkit-font-smoothing: auto;
174
174
  -moz-osx-font-smoothing: auto;
175
+ }
176
+
177
+ .awsui_dropdown-header_r2vco_f5yst_177:not(#\9) {
178
+ inline-size: 100%;
179
+ position: relative;
180
+ z-index: 4;
181
+ }
182
+
183
+ .awsui_dropdown-footer_r2vco_f5yst_183:not(#\9) {
184
+ inline-size: 100%;
175
185
  }
@@ -2,6 +2,8 @@
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_r2vco_v2s6g_145"
5
+ "root": "awsui_root_r2vco_f5yst_145",
6
+ "dropdown-header": "awsui_dropdown-header_r2vco_f5yst_177",
7
+ "dropdown-footer": "awsui_dropdown-footer_r2vco_f5yst_183"
6
8
  };
7
9
 
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ interface ComposeDropdownContentProps {
3
+ filter: React.ReactNode;
4
+ customDropdownHeader: React.ReactNode;
5
+ customDropdownFooter: React.ReactNode;
6
+ statusFooter: React.ReactNode;
7
+ dropdownHeaderClass: string;
8
+ dropdownFooterClass: string;
9
+ }
10
+ /**
11
+ * Builds the dropdown `header` and `footer` nodes shared by Select and Multiselect. When no custom header or
12
+ * custom footer is provided, the header is just the filter and the footer is the built-in sticky status, so the
13
+ * output is identical to the component's original behavior.
14
+ */
15
+ export declare function composeDropdownContent({
16
+ filter,
17
+ customDropdownHeader,
18
+ customDropdownFooter,
19
+ statusFooter,
20
+ dropdownHeaderClass,
21
+ dropdownFooterClass
22
+ }: ComposeDropdownContentProps): {
23
+ header: React.ReactNode;
24
+ footer: React.ReactNode;
25
+ };
26
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropdown-customization.d.ts","sourceRoot":"","sources":["../../../../src/select/utils/dropdown-customization.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,2BAA2B;IAEnC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,oBAAoB,EAAE,KAAK,CAAC,SAAS,CAAC;IACtC,oBAAoB,EAAE,KAAK,CAAC,SAAS,CAAC;IACtC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,GACpB,EAAE,2BAA2B,GAAG;IAAE,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CA2BpF"}
@@ -0,0 +1,22 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import React from 'react';
4
+ /**
5
+ * Builds the dropdown `header` and `footer` nodes shared by Select and Multiselect. When no custom header or
6
+ * custom footer is provided, the header is just the filter and the footer is the built-in sticky status, so the
7
+ * output is identical to the component's original behavior.
8
+ */
9
+ export function composeDropdownContent({ filter, customDropdownHeader, customDropdownFooter, statusFooter, dropdownHeaderClass, dropdownFooterClass, }) {
10
+ const headerNode = customDropdownHeader !== null && customDropdownHeader !== void 0 ? customDropdownHeader : null;
11
+ const footerNode = customDropdownFooter !== null && customDropdownFooter !== void 0 ? customDropdownFooter : null;
12
+ // Custom header renders at the top of the dropdown, above the filter (and options list).
13
+ const header = headerNode !== null ? (React.createElement(React.Fragment, null,
14
+ React.createElement("div", { className: dropdownHeaderClass }, headerNode),
15
+ filter)) : (filter);
16
+ // Only wrap the footer in a fragment when a custom footer is present; otherwise keep the original sticky-status node.
17
+ const footer = footerNode !== null ? (React.createElement(React.Fragment, null,
18
+ statusFooter,
19
+ React.createElement("div", { className: dropdownFooterClass }, footerNode))) : (statusFooter);
20
+ return { header, footer };
21
+ }
22
+ //# sourceMappingURL=dropdown-customization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropdown-customization.js","sourceRoot":"","sources":["../../../../src/select/utils/dropdown-customization.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,EACrC,MAAM,EACN,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,GACS;IAC5B,MAAM,UAAU,GAAG,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,IAAI,CAAC;IAChD,MAAM,UAAU,GAAG,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,IAAI,CAAC;IAEhD,yFAAyF;IACzF,MAAM,MAAM,GACV,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,CACpB;QACE,6BAAK,SAAS,EAAE,mBAAmB,IAAG,UAAU,CAAO;QACtD,MAAM,CACN,CACJ,CAAC,CAAC,CAAC,CACF,MAAM,CACP,CAAC;IAEJ,sHAAsH;IACtH,MAAM,MAAM,GACV,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,CACpB;QACG,YAAY;QACb,6BAAK,SAAS,EAAE,mBAAmB,IAAG,UAAU,CAAO,CACtD,CACJ,CAAC,CAAC,CAAC,CACF,YAAY,CACb,CAAC;IAEJ,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\ninterface ComposeDropdownContentProps {\n // The filter node (already includes any custom filtering actions, composed by the Filter component).\n filter: React.ReactNode;\n customDropdownHeader: React.ReactNode;\n customDropdownFooter: React.ReactNode;\n statusFooter: React.ReactNode;\n dropdownHeaderClass: string;\n dropdownFooterClass: string;\n}\n\n/**\n * Builds the dropdown `header` and `footer` nodes shared by Select and Multiselect. When no custom header or\n * custom footer is provided, the header is just the filter and the footer is the built-in sticky status, so the\n * output is identical to the component's original behavior.\n */\nexport function composeDropdownContent({\n filter,\n customDropdownHeader,\n customDropdownFooter,\n statusFooter,\n dropdownHeaderClass,\n dropdownFooterClass,\n}: ComposeDropdownContentProps): { header: React.ReactNode; footer: React.ReactNode } {\n const headerNode = customDropdownHeader ?? null;\n const footerNode = customDropdownFooter ?? null;\n\n // Custom header renders at the top of the dropdown, above the filter (and options list).\n const header =\n headerNode !== null ? (\n <>\n <div className={dropdownHeaderClass}>{headerNode}</div>\n {filter}\n </>\n ) : (\n filter\n );\n\n // Only wrap the footer in a fragment when a custom footer is present; otherwise keep the original sticky-status node.\n const footer =\n footerNode !== null ? (\n <>\n {statusFooter}\n <div className={dropdownFooterClass}>{footerNode}</div>\n </>\n ) : (\n statusFooter\n );\n\n return { header, footer };\n}\n"]}
@@ -6,6 +6,7 @@ import { OptionsListProps } from '../../internal/components/options-list';
6
6
  import { DropdownStatusProps } from '../../types/dropdown-status';
7
7
  import { NonCancelableEventHandler } from '../../types/events';
8
8
  import { OptionDefinition } from '../../types/option';
9
+ import { SelectProps } from '../interfaces';
9
10
  import { FilterProps } from '../parts/filter';
10
11
  import { ItemProps } from '../parts/item';
11
12
  export type MenuProps = Omit<OptionsListProps, 'children'> & {
@@ -29,6 +30,7 @@ interface UseSelectProps {
29
30
  isAllSelected?: boolean;
30
31
  isSomeSelected?: boolean;
31
32
  toggleAll?: () => void;
33
+ dropdownRole?: SelectProps.DropdownRole;
32
34
  }
33
35
  export interface SelectTriggerProps extends ButtonTriggerProps {
34
36
  ref: RefObject<HTMLButtonElement>;
@@ -49,7 +51,8 @@ export declare function useSelect({
49
51
  statusType,
50
52
  isAllSelected,
51
53
  isSomeSelected,
52
- toggleAll
54
+ toggleAll,
55
+ dropdownRole
53
56
  }: UseSelectProps): {
54
57
  isOpen: boolean;
55
58
  highlightedOption: DropdownOption | undefined;
@@ -63,6 +66,7 @@ export declare function useSelect({
63
66
  highlightOption: (option: DropdownOption) => void;
64
67
  selectOption: (option?: DropdownOption) => void;
65
68
  announceSelected: boolean;
69
+ closeDropdown: () => void;
66
70
  dialogId: string;
67
71
  focusActiveRef: () => void;
68
72
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-select.d.ts","sourceRoot":"","sources":["../../../../src/select/utils/use-select.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;AAKtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAE7E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,EACpB,OAAO,EACP,aAAa,EACb,MAAM,EACN,OAAO,EACP,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,oBAA4B,EAC5B,UAAU,EACV,aAAa,EACb,cAAc,EACd,SAAS,EACT,YAAY,GACb,EAAE,cAAc;;;;;;4BAgHe,IAAI,CAChC,qBAAqB,EACrB,SAAS,GAAG,QAAQ,GAAG,mBAAmB,GAAG,UAAU,CACxD;;0BA4B0B,OAAO,CAAC,WAAW,CAAC;6BAoEf,cAAc,SAAS,MAAM;;4BApJ9B,cAAc;;;;;EAsQ9C"}
@@ -12,13 +12,15 @@ import { fireNonCancelableEvent } from '../../internal/events';
12
12
  import useForwardFocus from '../../internal/hooks/forward-focus';
13
13
  import { usePrevious } from '../../internal/hooks/use-previous';
14
14
  import { connectOptionsByValue } from './connect-options';
15
- export function useSelect({ selectedOptions, updateSelectedOption, options, filteringType, onBlur, onFocus, externalRef, keepOpen, embedded, fireLoadItems, setFilteringValue, useInteractiveGroups = false, statusType, isAllSelected, isSomeSelected, toggleAll, }) {
15
+ export function useSelect({ selectedOptions, updateSelectedOption, options, filteringType, onBlur, onFocus, externalRef, keepOpen, embedded, fireLoadItems, setFilteringValue, useInteractiveGroups = false, statusType, isAllSelected, isSomeSelected, toggleAll, dropdownRole, }) {
16
16
  const interactivityCheck = useInteractiveGroups ? isGroupInteractive : isInteractive;
17
17
  const isHighlightable = (option) => !!option && (useInteractiveGroups || option.type !== 'parent');
18
18
  const filterRef = useRef(null);
19
19
  const triggerRef = useRef(null);
20
20
  const menuRef = useRef(null);
21
21
  const hasFilter = filteringType !== 'none' && !embedded;
22
+ // Filtering always renders a dialog; `dropdownRole` can additionally force dialog semantics without a filter.
23
+ const isDialog = hasFilter || dropdownRole === 'dialog';
22
24
  const activeRef = hasFilter ? filterRef : menuRef;
23
25
  const __selectedOptions = connectOptionsByValue(options, selectedOptions);
24
26
  const __selectedOptionsSet = new Set(__selectedOptions);
@@ -104,15 +106,15 @@ export function useSelect({ selectedOptions, updateSelectedOption, options, filt
104
106
  onFocus: handleFocus,
105
107
  onBlur: handleBlur,
106
108
  dropdownContentId: dialogId,
107
- ariaRole: hasFilter ? 'dialog' : undefined,
109
+ ariaRole: isDialog ? 'dialog' : undefined,
108
110
  });
109
111
  const getTriggerProps = (disabled = false, autoFocus = false) => {
110
112
  const triggerProps = {
111
113
  ref: triggerRef,
112
114
  onFocus: () => closeDropdown(),
113
115
  autoFocus,
114
- ariaHasPopup: hasFilter ? 'dialog' : 'listbox',
115
- ariaControls: isOpen ? (hasFilter ? dialogId : menuId) : undefined,
116
+ ariaHasPopup: isDialog ? 'dialog' : 'listbox',
117
+ ariaControls: isOpen ? (isDialog ? dialogId : menuId) : undefined,
116
118
  };
117
119
  if (!disabled) {
118
120
  triggerProps.onMouseDown = (event) => {
@@ -270,6 +272,20 @@ export function useSelect({ selectedOptions, updateSelectedOption, options, filt
270
272
  useForwardFocus(externalRef, triggerRef);
271
273
  const highlightedGroupSelected = !!highlightedOption && isGroup(highlightedOption.option) && getGroupState(highlightedOption.option).selected;
272
274
  const announceSelected = !!highlightedOption && (__selectedOptionsSet.has(highlightedOption) || highlightedGroupSelected);
275
+ // Closes the dropdown and returns focus to the trigger, matching the normal close behavior.
276
+ // Exposed to the public dropdown-customization render props via `DropdownContentProps.closeDropdown`.
277
+ // Focusing the trigger fires its onFocus handler, which already closes the dropdown; only close
278
+ // explicitly when the trigger is already focused (re-focusing it does not fire onFocus), so the
279
+ // close side effects run exactly once.
280
+ const closeDropdownAndRefocus = useCallback(() => {
281
+ const trigger = triggerRef.current;
282
+ if (trigger && trigger === document.activeElement) {
283
+ closeDropdown();
284
+ }
285
+ else {
286
+ trigger === null || trigger === void 0 ? void 0 : trigger.focus();
287
+ }
288
+ }, [closeDropdown]);
273
289
  return {
274
290
  isOpen,
275
291
  highlightedOption,
@@ -283,6 +299,7 @@ export function useSelect({ selectedOptions, updateSelectedOption, options, filt
283
299
  highlightOption: highlightOptionWithKeyboard,
284
300
  selectOption,
285
301
  announceSelected,
302
+ closeDropdown: closeDropdownAndRefocus,
286
303
  dialogId,
287
304
  focusActiveRef,
288
305
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-select.js","sourceRoot":"","sources":["../../../../src/select/utils/use-select.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAa,WAAW,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAK5E,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AAEnH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mEAAmE,CAAC;AACzG,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,2DAA2D,CAAC;AAChH,OAAO,EAAE,YAAY,EAAE,MAAM,6DAA6D,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAMhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AA4B1D,MAAM,UAAU,SAAS,CAAC,EACxB,eAAe,EACf,oBAAoB,EACpB,OAAO,EACP,aAAa,EACb,MAAM,EACN,OAAO,EACP,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,oBAAoB,GAAG,KAAK,EAC5B,UAAU,EACV,aAAa,EACb,cAAc,EACd,SAAS,GACM;IACf,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,aAAa,CAAC;IAErF,MAAM,eAAe,GA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AAa,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC;IAC/G,MAAM,gBAAgB,GACpB,CAAC,CAAC,iBAAiB,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,wBAAwB,CAAC,CAAC;IAEnG,OAAO;QACL,MAAM;QACN,iBAAiB;QACjB,gBAAgB;QAChB,aAAa;QACb,eAAe;QACf,gBAAgB;QAChB,YAAY;QACZ,cAAc;QACd,cAAc;QACd,eAAe,EAAE,2BAA2B;QAC5C,YAAY;QACZ,gBAAgB;QAChB,QAAQ;QACR,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { RefObject, useCallback } from 'react';\nimport { useEffect, useRef } from 'react';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport { InternalDropdownProps } from '../../dropdown/internal';\nimport { ButtonTriggerProps } from '../../internal/components/button-trigger';\nimport { DropdownOption } from '../../internal/components/option/interfaces';\nimport { isGroup, isGroupInteractive, isInteractive } from '../../internal/components/option/utils/filter-options';\nimport { OptionsListProps } from '../../internal/components/options-list';\nimport { useHighlightedOption } from '../../internal/components/options-list/utils/use-highlight-option';\nimport { getOptionId } from '../../internal/components/options-list/utils/use-ids';\nimport { useMenuKeyboard, useTriggerKeyboard } from '../../internal/components/options-list/utils/use-keyboard';\nimport { useOpenState } from '../../internal/components/options-list/utils/use-open-state';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport useForwardFocus from '../../internal/hooks/forward-focus';\nimport { usePrevious } from '../../internal/hooks/use-previous';\nimport { DropdownStatusProps } from '../../types/dropdown-status';\nimport { NonCancelableEventHandler } from '../../types/events';\nimport { OptionDefinition, OptionGroup } from '../../types/option';\nimport { FilterProps } from '../parts/filter';\nimport { ItemProps } from '../parts/item';\nimport { connectOptionsByValue } from './connect-options';\n\nexport type MenuProps = Omit<OptionsListProps, 'children'> & { ref: React.RefObject<HTMLDivElement> };\nexport type GetOptionProps = (option: DropdownOption, index: number) => ItemProps;\n\ninterface UseSelectProps {\n selectedOptions: ReadonlyArray<OptionDefinition>;\n updateSelectedOption: (option: OptionDefinition) => void;\n options: ReadonlyArray<DropdownOption>;\n filteringType: string;\n keepOpen?: boolean;\n embedded?: boolean;\n onBlur?: NonCancelableEventHandler;\n onFocus?: NonCancelableEventHandler;\n externalRef: React.Ref<any>;\n fireLoadItems: (filteringText: string) => void;\n setFilteringValue?: (filteringText: string) => void;\n useInteractiveGroups?: boolean;\n statusType: DropdownStatusProps.StatusType;\n isAllSelected?: boolean;\n isSomeSelected?: boolean;\n toggleAll?: () => void;\n}\n\nexport interface SelectTriggerProps extends ButtonTriggerProps {\n ref: RefObject<HTMLButtonElement>;\n}\n\nexport function useSelect({\n selectedOptions,\n updateSelectedOption,\n options,\n filteringType,\n onBlur,\n onFocus,\n externalRef,\n keepOpen,\n embedded,\n fireLoadItems,\n setFilteringValue,\n useInteractiveGroups = false,\n statusType,\n isAllSelected,\n isSomeSelected,\n toggleAll,\n}: UseSelectProps) {\n const interactivityCheck = useInteractiveGroups ? isGroupInteractive : isInteractive;\n\n const isHighlightable = (option?: DropdownOption) => !!option && (useInteractiveGroups || option.type !== 'parent');\n\n const filterRef = useRef<HTMLInputElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const hasFilter = filteringType !== 'none' && !embedded;\n const activeRef = hasFilter ? filterRef : menuRef;\n const __selectedOptions = connectOptionsByValue(options, selectedOptions);\n const __selectedOptionsSet = new Set(__selectedOptions);\n const __selectedValuesSet = selectedOptions.reduce((selectedValuesSet: Set<string>, item: OptionDefinition) => {\n if (item.value) {\n selectedValuesSet.add(item.value);\n }\n return selectedValuesSet;\n }, new Set<string>());\n const [\n { highlightType, highlightedOption, highlightedIndex },\n {\n moveHighlightWithKeyboard,\n resetHighlightWithKeyboard,\n setHighlightedIndexWithMouse,\n highlightOptionWithKeyboard,\n highlightFirstOptionWithMouse,\n goHomeWithKeyboard,\n goEndWithKeyboard,\n },\n ] = useHighlightedOption({ options: options, isHighlightable });\n\n const { isOpen, openDropdown, closeDropdown, toggleDropdown, openedWithKeyboard } = useOpenState({\n defaultOpen: embedded,\n onOpen: () => fireLoadItems(''),\n onClose: () => {\n resetHighlightWithKeyboard();\n setFilteringValue?.('');\n },\n });\n\n const handleFocus = () => {\n fireNonCancelableEvent(onFocus, {});\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, {});\n closeDropdown();\n };\n\n const hasSelectedOption = __selectedOptions.length > 0;\n const menuId = useUniqueId('option-list');\n const dialogId = useUniqueId('dialog');\n const highlightedOptionId = getOptionId(menuId, highlightedIndex);\n\n const closeDropdownIfNecessary = () => {\n if (!keepOpen) {\n triggerRef.current?.focus();\n closeDropdown();\n }\n };\n\n const selectOption = (option?: DropdownOption) => {\n const optionToSelect = option || highlightedOption;\n if (!optionToSelect || !interactivityCheck(optionToSelect)) {\n return;\n }\n if (optionToSelect.type === 'select-all' && toggleAll) {\n toggleAll();\n } else {\n updateSelectedOption(optionToSelect.option);\n }\n closeDropdownIfNecessary();\n };\n\n const activeKeyDownHandler = useMenuKeyboard({\n goUp: () => {\n if (\n (!useInteractiveGroups && highlightedOption?.type === 'child' && highlightedIndex === 1) ||\n highlightedIndex === 0\n ) {\n goEndWithKeyboard();\n return;\n }\n moveHighlightWithKeyboard(-1);\n },\n goDown: () => {\n if (highlightedIndex === options.length - 1) {\n goHomeWithKeyboard();\n return;\n }\n\n moveHighlightWithKeyboard(1);\n },\n selectOption,\n goHome: goHomeWithKeyboard,\n goEnd: goEndWithKeyboard,\n closeDropdown: () => {\n if (!embedded) {\n triggerRef.current?.focus();\n closeDropdown();\n }\n },\n preventNativeSpace: !hasFilter || (highlightedOption && highlightType.type === 'keyboard'),\n });\n\n const triggerKeyDownHandler = useTriggerKeyboard({\n openDropdown: () => openDropdown(true),\n goHome: goHomeWithKeyboard,\n });\n\n const getDropdownProps: () => Pick<\n InternalDropdownProps,\n 'onFocus' | 'onBlur' | 'dropdownContentId' | 'ariaRole'\n > = () => ({\n onFocus: handleFocus,\n onBlur: handleBlur,\n dropdownContentId: dialogId,\n ariaRole: hasFilter ? 'dialog' : undefined,\n });\n\n const getTriggerProps = (disabled = false, autoFocus = false) => {\n const triggerProps: SelectTriggerProps = {\n ref: triggerRef,\n onFocus: () => closeDropdown(),\n autoFocus,\n ariaHasPopup: hasFilter ? 'dialog' : 'listbox',\n ariaControls: isOpen ? (hasFilter ? dialogId : menuId) : undefined,\n };\n if (!disabled) {\n triggerProps.onMouseDown = (event: CustomEvent) => {\n event.preventDefault(); // prevent current focus from blurring as it immediately closes the dropdown\n if (isOpen) {\n triggerRef.current?.focus();\n }\n toggleDropdown();\n };\n triggerProps.onKeyDown = triggerKeyDownHandler;\n }\n return triggerProps;\n };\n\n const getFilterProps = (): Partial<FilterProps> => {\n if (!hasFilter || !setFilteringValue) {\n return {};\n }\n\n return {\n ref: filterRef,\n onKeyDown: activeKeyDownHandler,\n onChange: event => {\n setFilteringValue(event.detail.value);\n resetHighlightWithKeyboard();\n },\n __onDelayedInput: event => {\n fireLoadItems(event.detail.value);\n },\n nativeInputAttributes: {\n 'aria-activedescendant': highlightedOptionId,\n ['aria-owns']: menuId,\n ['aria-controls']: menuId,\n },\n };\n };\n\n const getMenuProps = () => {\n const menuProps: MenuProps = {\n id: menuId,\n ref: menuRef,\n open: isOpen,\n onMouseUp: itemIndex => {\n if (itemIndex > -1) {\n selectOption(options[itemIndex]);\n }\n },\n onMouseMove: itemIndex => {\n if (itemIndex > -1) {\n setHighlightedIndexWithMouse(itemIndex);\n }\n },\n statusType,\n };\n if (!hasFilter) {\n menuProps.onKeyDown = activeKeyDownHandler;\n menuProps.nativeAttributes = {\n 'aria-activedescendant': highlightedOptionId,\n };\n }\n if (embedded) {\n menuProps.onFocus = () => {\n if (!highlightedOption) {\n goHomeWithKeyboard();\n }\n };\n menuProps.onBlur = () => {\n resetHighlightWithKeyboard();\n };\n }\n return menuProps;\n };\n const getGroupState = (option: OptionGroup) => {\n const totalSelected = option.options.filter(item => !!item.value && __selectedValuesSet.has(item.value)).length;\n const hasSelected = totalSelected > 0;\n const allSelected = totalSelected === option.options.length;\n return {\n selected: hasSelected && allSelected && useInteractiveGroups,\n indeterminate: hasSelected && !allSelected,\n };\n };\n\n const getOptionProps = (option: DropdownOption, index: number) => {\n const isSelectAll = option.type === 'select-all';\n const highlighted = option === highlightedOption;\n const groupState = isGroup(option.option) ? getGroupState(option.option) : undefined;\n const selected = isSelectAll ? isAllSelected : __selectedOptionsSet.has(option) || !!groupState?.selected;\n const nextOption = options[index + 1]?.option;\n const isNextSelected =\n !!nextOption && isGroup(nextOption)\n ? getGroupState(nextOption).selected\n : __selectedOptionsSet.has(options[index + 1]);\n const previousOption = options[index - 1]?.option;\n const isPreviousSelected =\n !!previousOption && isGroup(previousOption)\n ? getGroupState(previousOption).selected\n : __selectedOptionsSet.has(options[index - 1]);\n const optionProps: any = {\n key: index,\n option,\n highlighted,\n selected,\n isNextSelected,\n isPreviousSelected,\n indeterminate: !!groupState?.indeterminate || (isSelectAll && !isAllSelected && isSomeSelected),\n ['data-mouse-target']: isHighlightable(option) ? index : -1,\n id: getOptionId(menuId, index),\n };\n\n return optionProps;\n };\n\n const prevOpen = usePrevious<boolean>(isOpen);\n useEffect(() => {\n // highlight the first selected option, when opening the Select component without filter input\n // keep the focus in the filter input when opening, so that screenreader can recognize the combobox\n if (isOpen && !prevOpen && options.length > 0 && !hasFilter) {\n if (openedWithKeyboard) {\n if (__selectedOptions[0]) {\n highlightOptionWithKeyboard(__selectedOptions[0]);\n } else {\n goHomeWithKeyboard();\n }\n } else {\n if (!__selectedOptions[0] || !options.includes(__selectedOptions[0])) {\n highlightFirstOptionWithMouse();\n } else {\n const highlightedIndex = options.indexOf(__selectedOptions[0]);\n setHighlightedIndexWithMouse(highlightedIndex, true);\n }\n }\n }\n }, [\n isOpen,\n __selectedOptions,\n hasSelectedOption,\n setHighlightedIndexWithMouse,\n highlightOptionWithKeyboard,\n highlightFirstOptionWithMouse,\n goHomeWithKeyboard,\n openedWithKeyboard,\n options,\n prevOpen,\n hasFilter,\n ]);\n\n const focusActiveRef = useCallback(() => {\n // dropdown-fit calculations ensure that the dropdown will fit inside the current\n // viewport, so prevent the browser from trying to scroll it into view (e.g. if\n // scroll-padding-top is set on a parent)\n activeRef.current?.focus({ preventScroll: true });\n }, [activeRef]);\n\n useEffect(() => {\n if (isOpen && !embedded) {\n focusActiveRef();\n }\n }, [isOpen, activeRef, embedded, focusActiveRef]);\n\n useForwardFocus(externalRef, triggerRef as React.RefObject<HTMLElement>);\n const highlightedGroupSelected =\n !!highlightedOption && isGroup(highlightedOption.option) && getGroupState(highlightedOption.option).selected;\n const announceSelected =\n !!highlightedOption && (__selectedOptionsSet.has(highlightedOption) || highlightedGroupSelected);\n\n return {\n isOpen,\n highlightedOption,\n highlightedIndex,\n highlightType,\n getTriggerProps,\n getDropdownProps,\n getMenuProps,\n getFilterProps,\n getOptionProps,\n highlightOption: highlightOptionWithKeyboard,\n selectOption,\n announceSelected,\n dialogId,\n focusActiveRef,\n };\n}\n"]}
1
+ {"version":3,"file":"use-select.js","sourceRoot":"","sources":["../../../../src/select/utils/use-select.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAa,WAAW,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAK5E,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AAEnH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mEAAmE,CAAC;AACzG,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACnF,OAAO,EA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OAAO,uBAAP,OAAO,CAAE,KAAK,EAAE,CAAC;QACnB,CAAC;IACH,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO;QACL,MAAM;QACN,iBAAiB;QACjB,gBAAgB;QAChB,aAAa;QACb,eAAe;QACf,gBAAgB;QAChB,YAAY;QACZ,cAAc;QACd,cAAc;QACd,eAAe,EAAE,2BAA2B;QAC5C,YAAY;QACZ,gBAAgB;QAChB,aAAa,EAAE,uBAAuB;QACtC,QAAQ;QACR,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { RefObject, useCallback } from 'react';\nimport { useEffect, useRef } from 'react';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport { InternalDropdownProps } from '../../dropdown/internal';\nimport { ButtonTriggerProps } from '../../internal/components/button-trigger';\nimport { DropdownOption } from '../../internal/components/option/interfaces';\nimport { isGroup, isGroupInteractive, isInteractive } from '../../internal/components/option/utils/filter-options';\nimport { OptionsListProps } from '../../internal/components/options-list';\nimport { useHighlightedOption } from '../../internal/components/options-list/utils/use-highlight-option';\nimport { getOptionId } from '../../internal/components/options-list/utils/use-ids';\nimport { useMenuKeyboard, useTriggerKeyboard } from '../../internal/components/options-list/utils/use-keyboard';\nimport { useOpenState } from '../../internal/components/options-list/utils/use-open-state';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport useForwardFocus from '../../internal/hooks/forward-focus';\nimport { usePrevious } from '../../internal/hooks/use-previous';\nimport { DropdownStatusProps } from '../../types/dropdown-status';\nimport { NonCancelableEventHandler } from '../../types/events';\nimport { OptionDefinition, OptionGroup } from '../../types/option';\nimport { SelectProps } from '../interfaces';\nimport { FilterProps } from '../parts/filter';\nimport { ItemProps } from '../parts/item';\nimport { connectOptionsByValue } from './connect-options';\n\nexport type MenuProps = Omit<OptionsListProps, 'children'> & { ref: React.RefObject<HTMLDivElement> };\nexport type GetOptionProps = (option: DropdownOption, index: number) => ItemProps;\n\ninterface UseSelectProps {\n selectedOptions: ReadonlyArray<OptionDefinition>;\n updateSelectedOption: (option: OptionDefinition) => void;\n options: ReadonlyArray<DropdownOption>;\n filteringType: string;\n keepOpen?: boolean;\n embedded?: boolean;\n onBlur?: NonCancelableEventHandler;\n onFocus?: NonCancelableEventHandler;\n externalRef: React.Ref<any>;\n fireLoadItems: (filteringText: string) => void;\n setFilteringValue?: (filteringText: string) => void;\n useInteractiveGroups?: boolean;\n statusType: DropdownStatusProps.StatusType;\n isAllSelected?: boolean;\n isSomeSelected?: boolean;\n toggleAll?: () => void;\n dropdownRole?: SelectProps.DropdownRole;\n}\n\nexport interface SelectTriggerProps extends ButtonTriggerProps {\n ref: RefObject<HTMLButtonElement>;\n}\n\nexport function useSelect({\n selectedOptions,\n updateSelectedOption,\n options,\n filteringType,\n onBlur,\n onFocus,\n externalRef,\n keepOpen,\n embedded,\n fireLoadItems,\n setFilteringValue,\n useInteractiveGroups = false,\n statusType,\n isAllSelected,\n isSomeSelected,\n toggleAll,\n dropdownRole,\n}: UseSelectProps) {\n const interactivityCheck = useInteractiveGroups ? isGroupInteractive : isInteractive;\n\n const isHighlightable = (option?: DropdownOption) => !!option && (useInteractiveGroups || option.type !== 'parent');\n\n const filterRef = useRef<HTMLInputElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const hasFilter = filteringType !== 'none' && !embedded;\n // Filtering always renders a dialog; `dropdownRole` can additionally force dialog semantics without a filter.\n const isDialog = hasFilter || dropdownRole === 'dialog';\n const activeRef = hasFilter ? filterRef : menuRef;\n const __selectedOptions = connectOptionsByValue(options, selectedOptions);\n const __selectedOptionsSet = new Set(__selectedOptions);\n const __selectedValuesSet = selectedOptions.reduce((selectedValuesSet: Set<string>, item: OptionDefinition) => {\n if (item.value) {\n selectedValuesSet.add(item.value);\n }\n return selectedValuesSet;\n }, new Set<string>());\n const [\n { highlightType, highlightedOption, highlightedIndex },\n {\n moveHighlightWithKeyboard,\n resetHighlightWithKeyboard,\n setHighlightedIndexWithMouse,\n highlightOptionWithKeyboard,\n highlightFirstOptionWithMouse,\n goHomeWithKeyboard,\n goEndWithKeyboard,\n },\n ] = useHighlightedOption({ options: options, isHighlightable });\n\n const { isOpen, openDropdown, closeDropdown, toggleDropdown, openedWithKeyboard } = useOpenState({\n defaultOpen: embedded,\n onOpen: () => fireLoadItems(''),\n onClose: () => {\n resetHighlightWithKeyboard();\n setFilteringValue?.('');\n },\n });\n\n const handleFocus = () => {\n fireNonCancelableEvent(onFocus, {});\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, {});\n closeDropdown();\n };\n\n const hasSelectedOption = __selectedOptions.length > 0;\n const menuId = useUniqueId('option-list');\n const dialogId = useUniqueId('dialog');\n const highlightedOptionId = getOptionId(menuId, highlightedIndex);\n\n const closeDropdownIfNecessary = () => {\n if (!keepOpen) {\n triggerRef.current?.focus();\n closeDropdown();\n }\n };\n\n const selectOption = (option?: DropdownOption) => {\n const optionToSelect = option || highlightedOption;\n if (!optionToSelect || !interactivityCheck(optionToSelect)) {\n return;\n }\n if (optionToSelect.type === 'select-all' && toggleAll) {\n toggleAll();\n } else {\n updateSelectedOption(optionToSelect.option);\n }\n closeDropdownIfNecessary();\n };\n\n const activeKeyDownHandler = useMenuKeyboard({\n goUp: () => {\n if (\n (!useInteractiveGroups && highlightedOption?.type === 'child' && highlightedIndex === 1) ||\n highlightedIndex === 0\n ) {\n goEndWithKeyboard();\n return;\n }\n moveHighlightWithKeyboard(-1);\n },\n goDown: () => {\n if (highlightedIndex === options.length - 1) {\n goHomeWithKeyboard();\n return;\n }\n\n moveHighlightWithKeyboard(1);\n },\n selectOption,\n goHome: goHomeWithKeyboard,\n goEnd: goEndWithKeyboard,\n closeDropdown: () => {\n if (!embedded) {\n triggerRef.current?.focus();\n closeDropdown();\n }\n },\n preventNativeSpace: !hasFilter || (highlightedOption && highlightType.type === 'keyboard'),\n });\n\n const triggerKeyDownHandler = useTriggerKeyboard({\n openDropdown: () => openDropdown(true),\n goHome: goHomeWithKeyboard,\n });\n\n const getDropdownProps: () => Pick<\n InternalDropdownProps,\n 'onFocus' | 'onBlur' | 'dropdownContentId' | 'ariaRole'\n > = () => ({\n onFocus: handleFocus,\n onBlur: handleBlur,\n dropdownContentId: dialogId,\n ariaRole: isDialog ? 'dialog' : undefined,\n });\n\n const getTriggerProps = (disabled = false, autoFocus = false) => {\n const triggerProps: SelectTriggerProps = {\n ref: triggerRef,\n onFocus: () => closeDropdown(),\n autoFocus,\n ariaHasPopup: isDialog ? 'dialog' : 'listbox',\n ariaControls: isOpen ? (isDialog ? dialogId : menuId) : undefined,\n };\n if (!disabled) {\n triggerProps.onMouseDown = (event: CustomEvent) => {\n event.preventDefault(); // prevent current focus from blurring as it immediately closes the dropdown\n if (isOpen) {\n triggerRef.current?.focus();\n }\n toggleDropdown();\n };\n triggerProps.onKeyDown = triggerKeyDownHandler;\n }\n return triggerProps;\n };\n\n const getFilterProps = (): Partial<FilterProps> => {\n if (!hasFilter || !setFilteringValue) {\n return {};\n }\n\n return {\n ref: filterRef,\n onKeyDown: activeKeyDownHandler,\n onChange: event => {\n setFilteringValue(event.detail.value);\n resetHighlightWithKeyboard();\n },\n __onDelayedInput: event => {\n fireLoadItems(event.detail.value);\n },\n nativeInputAttributes: {\n 'aria-activedescendant': highlightedOptionId,\n ['aria-owns']: menuId,\n ['aria-controls']: menuId,\n },\n };\n };\n\n const getMenuProps = () => {\n const menuProps: MenuProps = {\n id: menuId,\n ref: menuRef,\n open: isOpen,\n onMouseUp: itemIndex => {\n if (itemIndex > -1) {\n selectOption(options[itemIndex]);\n }\n },\n onMouseMove: itemIndex => {\n if (itemIndex > -1) {\n setHighlightedIndexWithMouse(itemIndex);\n }\n },\n statusType,\n };\n if (!hasFilter) {\n menuProps.onKeyDown = activeKeyDownHandler;\n menuProps.nativeAttributes = {\n 'aria-activedescendant': highlightedOptionId,\n };\n }\n if (embedded) {\n menuProps.onFocus = () => {\n if (!highlightedOption) {\n goHomeWithKeyboard();\n }\n };\n menuProps.onBlur = () => {\n resetHighlightWithKeyboard();\n };\n }\n return menuProps;\n };\n const getGroupState = (option: OptionGroup) => {\n const totalSelected = option.options.filter(item => !!item.value && __selectedValuesSet.has(item.value)).length;\n const hasSelected = totalSelected > 0;\n const allSelected = totalSelected === option.options.length;\n return {\n selected: hasSelected && allSelected && useInteractiveGroups,\n indeterminate: hasSelected && !allSelected,\n };\n };\n\n const getOptionProps = (option: DropdownOption, index: number) => {\n const isSelectAll = option.type === 'select-all';\n const highlighted = option === highlightedOption;\n const groupState = isGroup(option.option) ? getGroupState(option.option) : undefined;\n const selected = isSelectAll ? isAllSelected : __selectedOptionsSet.has(option) || !!groupState?.selected;\n const nextOption = options[index + 1]?.option;\n const isNextSelected =\n !!nextOption && isGroup(nextOption)\n ? getGroupState(nextOption).selected\n : __selectedOptionsSet.has(options[index + 1]);\n const previousOption = options[index - 1]?.option;\n const isPreviousSelected =\n !!previousOption && isGroup(previousOption)\n ? getGroupState(previousOption).selected\n : __selectedOptionsSet.has(options[index - 1]);\n const optionProps: any = {\n key: index,\n option,\n highlighted,\n selected,\n isNextSelected,\n isPreviousSelected,\n indeterminate: !!groupState?.indeterminate || (isSelectAll && !isAllSelected && isSomeSelected),\n ['data-mouse-target']: isHighlightable(option) ? index : -1,\n id: getOptionId(menuId, index),\n };\n\n return optionProps;\n };\n\n const prevOpen = usePrevious<boolean>(isOpen);\n useEffect(() => {\n // highlight the first selected option, when opening the Select component without filter input\n // keep the focus in the filter input when opening, so that screenreader can recognize the combobox\n if (isOpen && !prevOpen && options.length > 0 && !hasFilter) {\n if (openedWithKeyboard) {\n if (__selectedOptions[0]) {\n highlightOptionWithKeyboard(__selectedOptions[0]);\n } else {\n goHomeWithKeyboard();\n }\n } else {\n if (!__selectedOptions[0] || !options.includes(__selectedOptions[0])) {\n highlightFirstOptionWithMouse();\n } else {\n const highlightedIndex = options.indexOf(__selectedOptions[0]);\n setHighlightedIndexWithMouse(highlightedIndex, true);\n }\n }\n }\n }, [\n isOpen,\n __selectedOptions,\n hasSelectedOption,\n setHighlightedIndexWithMouse,\n highlightOptionWithKeyboard,\n highlightFirstOptionWithMouse,\n goHomeWithKeyboard,\n openedWithKeyboard,\n options,\n prevOpen,\n hasFilter,\n ]);\n\n const focusActiveRef = useCallback(() => {\n // dropdown-fit calculations ensure that the dropdown will fit inside the current\n // viewport, so prevent the browser from trying to scroll it into view (e.g. if\n // scroll-padding-top is set on a parent)\n activeRef.current?.focus({ preventScroll: true });\n }, [activeRef]);\n\n useEffect(() => {\n if (isOpen && !embedded) {\n focusActiveRef();\n }\n }, [isOpen, activeRef, embedded, focusActiveRef]);\n\n useForwardFocus(externalRef, triggerRef as React.RefObject<HTMLElement>);\n const highlightedGroupSelected =\n !!highlightedOption && isGroup(highlightedOption.option) && getGroupState(highlightedOption.option).selected;\n const announceSelected =\n !!highlightedOption && (__selectedOptionsSet.has(highlightedOption) || highlightedGroupSelected);\n\n // Closes the dropdown and returns focus to the trigger, matching the normal close behavior.\n // Exposed to the public dropdown-customization render props via `DropdownContentProps.closeDropdown`.\n // Focusing the trigger fires its onFocus handler, which already closes the dropdown; only close\n // explicitly when the trigger is already focused (re-focusing it does not fire onFocus), so the\n // close side effects run exactly once.\n const closeDropdownAndRefocus = useCallback(() => {\n const trigger = triggerRef.current;\n if (trigger && trigger === document.activeElement) {\n closeDropdown();\n } else {\n trigger?.focus();\n }\n }, [closeDropdown]);\n\n return {\n isOpen,\n highlightedOption,\n highlightedIndex,\n highlightType,\n getTriggerProps,\n getDropdownProps,\n getMenuProps,\n getFilterProps,\n getOptionProps,\n highlightOption: highlightOptionWithKeyboard,\n selectOption,\n announceSelected,\n closeDropdown: closeDropdownAndRefocus,\n dialogId,\n focusActiveRef,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"parts.d.ts","sourceRoot":"","s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AAE,OAAO,CAAC;CACrB;AAQD,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,OAAO,EACP,UAAU,EACV,UAAU,EACV,UAAU,EACV,QAAa,EACb,SAAS,EACT,SAAS,EACT,aAAa,EACb,gBAAgB,GACjB,EAAE,wBAAwB,eAgS1B"}
@@ -176,6 +176,7 @@ export function NavigationItemsList({ items, variant, activeHref, fireChange, fi
176
176
  return (React.createElement("div", { key: `hr-${index}`, className: clsx(styles.list, styles[`list-variant-${variant}`], {
177
177
  [styles['list-variant-root--first']]: list.listVariant === 'root' && index === 0,
178
178
  [styles['list-variant-root--collapsed']]: list.listVariant === 'root' && collapsed,
179
+ [styles['list--with-icons']]: withIcons,
179
180
  }) }, list.element));
180
181
  }
181
182
  else {
@@ -275,7 +276,7 @@ function Section({ definition, activeHref, fireFollow, fireChange, variant, posi
275
276
  return null;
276
277
  }
277
278
  const isInSectionGroup = variant === 'section-group';
278
- return (React.createElement(InternalExpandableSection, { variant: "footer", expanded: expanded, onChange: onExpandedChange, className: clsx(styles.section, isInSectionGroup && styles['section--no-ident'], isVisualRefresh && styles.refresh), headerText: React.createElement("span", { className: styles['section-header'] }, definition.text) },
279
+ return (React.createElement(InternalExpandableSection, { variant: "footer", expanded: expanded, onChange: onExpandedChange, disableContentPaddings: true, className: clsx(styles.section, isInSectionGroup && styles['section--no-ident'], withIcons && styles['section--expand-icon-end'], isVisualRefresh && styles.refresh), headerText: React.createElement("span", { className: styles['section-header'] }, definition.text), __expandIconPosition: withIcons ? 'end' : 'start' },
279
280
  React.createElement(NavigationItemsList, { variant: "section", items: definition.items, fireFollow: fireFollow, fireChange: fireChange, activeHref: activeHref, position: position, withIcons: withIcons })));
280
281
  }
281
282
  function SectionGroup({ definition, activeHref, fireFollow, fireChange, position, collapsed, withIcons, }) {
@@ -336,7 +337,7 @@ function ExpandableLinkGroup({ definition, fireFollow, fireChange, activeHref, v
336
337
  if (collapsed) {
337
338
  return (React.createElement(Link, { definition: { type: 'link', href: definition.href, text: definition.text, icon: definition.icon }, fireFollow: onHeaderFollow, fireChange: fireChange, activeHref: activeHref, position: position, collapsed: collapsed, activeTooltip: activeTooltip, setActiveTooltip: setActiveTooltip }));
338
339
  }
339
- return (React.createElement(InternalExpandableSection, { className: clsx(styles['expandable-link-group'], variant === 'section-group' && styles['expandable-link-group--no-ident'], definition.href === activeHref && styles['expandable-link-group--active']), variant: "navigation", expanded: userExpanded !== null && userExpanded !== void 0 ? userExpanded : expanded, onChange: onExpandedChange, headerText: React.createElement(Link, { definition: { type: 'link', href: definition.href, text: definition.text, icon: definition.icon }, fireFollow: onHeaderFollow, fireChange: fireChange, activeHref: activeHref, position: position }) },
340
+ return (React.createElement(InternalExpandableSection, { className: clsx(styles['expandable-link-group'], variant === 'section-group' && styles['expandable-link-group--no-ident'], withIcons && styles['expandable-link-group--expand-icon-end'], definition.href === activeHref && styles['expandable-link-group--active']), variant: "navigation", expanded: userExpanded !== null && userExpanded !== void 0 ? userExpanded : expanded, onChange: onExpandedChange, disableContentPaddings: true, __disableHeaderPaddings: true, __expandIconPosition: withIcons ? 'end' : 'start', headerText: React.createElement(Link, { definition: { type: 'link', href: definition.href, text: definition.text, icon: definition.icon }, fireFollow: onHeaderFollow, fireChange: fireChange, activeHref: activeHref, position: position }) },
340
341
  React.createElement(NavigationItemsList, { variant: "expandable-link-group", items: definition.items, fireFollow: fireFollow, fireChange: fireChange, activeHref: activeHref, position: position, withIcons: withIcons })));
341
342
  }
342
343
  //# sourceMappingURL=parts.js.map