@cloudscape-design/components 3.0.1396 → 3.0.1397
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/area-chart/model/utils.d.ts.map +1 -1
- package/area-chart/model/utils.js +4 -0
- package/area-chart/model/utils.js.map +1 -1
- package/autosuggest/internal.d.ts.map +1 -1
- package/autosuggest/internal.js +7 -1
- package/autosuggest/internal.js.map +1 -1
- package/autosuggest/virtual-list.d.ts.map +1 -1
- package/autosuggest/virtual-list.js +16 -5
- package/autosuggest/virtual-list.js.map +1 -1
- package/internal/base-component/styles.scoped.css +1 -1
- package/internal/components/control-group/index.d.ts +2 -0
- package/internal/components/control-group/index.d.ts.map +1 -1
- package/internal/components/control-group/index.js +12 -3
- package/internal/components/control-group/index.js.map +1 -1
- package/internal/components/control-group/styles.css.js +11 -8
- package/internal/components/control-group/styles.scoped.css +41 -7
- package/internal/components/control-group/styles.selectors.js +11 -8
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/manifest.json +1 -1
- package/manifest.json +2 -2
- package/multiselect/internal.d.ts.map +1 -1
- package/multiselect/internal.js +7 -2
- package/multiselect/internal.js.map +1 -1
- package/package.json +1 -1
- package/segmented-control/styles.css.js +26 -26
- package/segmented-control/styles.scoped.css +48 -47
- package/segmented-control/styles.selectors.js +26 -26
- package/select/internal.d.ts.map +1 -1
- package/select/internal.js +5 -1
- package/select/internal.js.map +1 -1
- package/test-utils/dom/internal/control-group.d.ts +8 -0
- package/test-utils/dom/internal/control-group.js +17 -0
- package/test-utils/dom/internal/control-group.js.map +1 -0
- package/test-utils/selectors/internal/control-group.d.ts +8 -0
- package/test-utils/selectors/internal/control-group.js +17 -0
- package/test-utils/selectors/internal/control-group.js.map +1 -0
- package/token/interfaces.d.ts +1 -1
- package/token/interfaces.js.map +1 -1
package/multiselect/internal.js
CHANGED
|
@@ -27,10 +27,15 @@ const InternalMultiselect = React.forwardRef(({ options, filteringType, filterin
|
|
|
27
27
|
const formFieldContext = useFormFieldContext(restProps);
|
|
28
28
|
const groupedControlProps = useGroupedControlContext();
|
|
29
29
|
const i18n = useInternalI18n('multiselect');
|
|
30
|
+
const isGrouped = !!groupedControlProps.position;
|
|
30
31
|
// When rendered inside a control group, tokens are always shown inline in the
|
|
31
32
|
// trigger regardless of the `inlineTokens` prop, since there is no room to
|
|
32
33
|
// display tokens below the control within a group.
|
|
33
|
-
const showTokensInline = inlineTokens ||
|
|
34
|
+
const showTokensInline = inlineTokens || isGrouped;
|
|
35
|
+
// When grouped, the dropdown is portaled regardless of the public
|
|
36
|
+
// `expandToViewport` prop so it escapes the control slot's stacking context
|
|
37
|
+
// and paints over the group's inline label (which the focus ring stays under).
|
|
38
|
+
const effectiveExpandToViewport = expandToViewport || isGrouped;
|
|
34
39
|
const selfControlId = useUniqueId('trigger');
|
|
35
40
|
const controlId = (_a = formFieldContext.controlId) !== null && _a !== void 0 ? _a : selfControlId;
|
|
36
41
|
const ariaLabelId = useUniqueId('multiselect-ariaLabel-');
|
|
@@ -102,7 +107,7 @@ const InternalMultiselect = React.forwardRef(({ options, filteringType, filterin
|
|
|
102
107
|
React.createElement("div", { ...baseProps, ref: __internalRootRef, className: clsx(styles.root, baseProps.className), ...multiselectProps.getWrapperProps() },
|
|
103
108
|
React.createElement(Dropdown, { ...dropdownProps, ariaLabelledby: dropdownProps.ariaRole ? joinStrings(ariaLabelId, controlId) : undefined, ariaDescribedby: dropdownProps.ariaRole
|
|
104
109
|
? joinStrings(dropdownStatus.content ? footerId : undefined, dropdownAriaDescribedby)
|
|
105
|
-
: undefined, open: multiselectProps.isOpen, minWidth: getDropdownMinWidth({ expandToViewport, triggerWidth }), maxWidth: getBreakpointValue('xxs'), trigger: trigger, header: dropdownHeader, footer: dropdownFooter, expandToViewport:
|
|
110
|
+
: undefined, open: multiselectProps.isOpen, minWidth: getDropdownMinWidth({ expandToViewport: effectiveExpandToViewport, triggerWidth }), maxWidth: getBreakpointValue('xxs'), trigger: trigger, header: dropdownHeader, footer: dropdownFooter, expandToViewport: effectiveExpandToViewport,
|
|
106
111
|
// Forces dropdown position recalculation when new options are loaded
|
|
107
112
|
contentKey: hasOptions.current.toString(), content: React.createElement(ListComponent, { renderOption: renderOption, listBottom: !dropdownStatus.isSticky ? (React.createElement(DropdownFooter, { content: multiselectProps.isOpen ? dropdownStatus.content : null, id: footerId })) : null, menuProps: { ...multiselectProps.getMenuProps(), ariaRequired }, getOptionProps: multiselectProps.getOptionProps, filteredOptions: multiselectProps.filteredOptions, filteringValue: filteringValue, ref: multiselectProps.scrollToIndex, hasDropdownStatus: dropdownStatus.content !== null, checkboxes: true, useInteractiveGroups: true, screenReaderContent: multiselectProps.announcement, highlightType: multiselectProps.highlightType, firstOptionSticky: hasFilteredOptions && enableSelectAll, isMultiSelect: true }) }),
|
|
108
113
|
showTokens && (React.createElement(InternalTokenGroup, { ...multiselectProps.getTokenProps(), className: styles.tokens, alignment: "horizontal", limit: tokenLimit, items: tokens, i18nStrings: tokenGroupI18nStrings, limitShowMoreAriaLabel: tokenLimitShowMoreAriaLabel, limitShowFewerAriaLabel: tokenLimitShowFewerAriaLabel, disableOuterPadding: true, readOnly: readOnly, isItemReadOnly: item => item._readOnly })),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE/F,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,kBA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;YAED,oBAAC,gBAAgB,IAAC,EAAE,EAAE,WAAW,IAAG,SAAS,IAAI,eAAe,CAAoB,CAChF,CACqB,CAC9B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport Dropdown from '../dropdown/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { getBreakpointValue } from '../internal/breakpoints';\nimport DropdownFooter from '../internal/components/dropdown-footer/index.js';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { ResetGroupedControlContext, useGroupedControlContext } from '../internal/context/control-group-context';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { SomeRequired } from '../internal/types';\nimport { getDropdownMinWidth } from '../internal/utils/get-dropdown-min-width';\nimport { joinStrings } from '../internal/utils/strings';\nimport Filter from '../select/parts/filter';\nimport PlainList from '../select/parts/plain-list';\nimport Trigger from '../select/parts/trigger';\nimport VirtualList from '../select/parts/virtual-list';\nimport { composeDropdownContent } from '../select/utils/dropdown-customization';\nimport { TokenGroupProps } from '../token-group/interfaces';\nimport InternalTokenGroup from '../token-group/internal';\nimport { MultiselectProps } from './interfaces';\nimport { useMultiselect } from './use-multiselect';\n\nimport styles from './styles.css.js';\n\ntype InternalMultiselectProps = SomeRequired<\n MultiselectProps,\n 'options' | 'selectedOptions' | 'filteringType' | 'statusType' | 'keepOpen' | 'hideTokens'\n> &\n InternalBaseComponentProps;\n\ntype ExtendedToken = TokenGroupProps.Item & { _readOnly: boolean };\n\nconst InternalMultiselect = React.forwardRef(\n (\n {\n options,\n filteringType,\n filteringPlaceholder,\n filteringAriaLabel,\n filteringClearAriaLabel,\n ariaRequired,\n placeholder,\n disabled,\n readOnly,\n ariaLabel,\n inlineLabelText,\n selectedOptions,\n deselectAriaLabel,\n tokenLimit,\n i18nStrings,\n virtualScroll,\n inlineTokens = false,\n hideTokens,\n expandToViewport,\n tokenLimitShowFewerAriaLabel,\n tokenLimitShowMoreAriaLabel,\n __internalRootRef,\n autoFocus,\n enableSelectAll,\n renderOption,\n renderDropdownHeader,\n renderDropdownFooter,\n dropdownRole,\n dropdownAriaDescribedby,\n ...restProps\n }: InternalMultiselectProps,\n externalRef: React.Ref<MultiselectProps.Ref>\n ) => {\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n const groupedControlProps = useGroupedControlContext();\n const i18n = useInternalI18n('multiselect');\n\n // When rendered inside a control group, tokens are always shown inline in the\n // trigger regardless of the `inlineTokens` prop, since there is no room to\n // display tokens below the control within a group.\n const showTokensInline = inlineTokens || !!groupedControlProps.position;\n\n const selfControlId = useUniqueId('trigger');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const ariaLabelId = useUniqueId('multiselect-ariaLabel-');\n const footerId = useUniqueId('multiselect-footer-');\n\n const [filteringValue, setFilteringValue] = useState('');\n const multiselectProps = useMultiselect({\n options,\n selectedOptions,\n filteringType,\n disabled,\n deselectAriaLabel,\n controlId,\n ariaLabelId,\n footerId,\n filteringValue,\n setFilteringValue,\n externalRef,\n enableSelectAll,\n i18nStrings,\n dropdownRole,\n dropdownAriaDescribedby,\n ...restProps,\n });\n\n const dropdownContentProps: MultiselectProps.DropdownContentProps = {\n filterText: filteringValue,\n closeDropdown: multiselectProps.closeDropdown,\n };\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 {...multiselectProps.getFilterProps()}\n />\n );\n\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 trigger = (\n <Trigger\n ref={triggerRef}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n triggerProps={multiselectProps.getTriggerProps(disabled, autoFocus)}\n selectedOption={null}\n selectedOptions={selectedOptions}\n triggerVariant={showTokensInline ? 'tokens' : 'placeholder'}\n isOpen={multiselectProps.isOpen}\n groupedControlProps={groupedControlProps}\n inlineLabelText={inlineLabelText}\n {...formFieldContext}\n controlId={controlId}\n ariaLabelledby={joinStrings(formFieldContext.ariaLabelledby, ariaLabelId)}\n />\n );\n\n const tokens: Array<ExtendedToken> = selectedOptions.map(option => ({\n label: option.label,\n 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 _readOnly: !!option.disabled,\n }));\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const showTokens = !hideTokens && !showTokensInline && tokens.length > 0;\n\n const tokenGroupI18nStrings: TokenGroupProps.I18nStrings = {\n limitShowFewer: i18nStrings?.tokenLimitShowFewer,\n limitShowMore: i18nStrings?.tokenLimitShowMore,\n };\n\n const dropdownStatus = multiselectProps.dropdownStatus;\n const dropdownProps = multiselectProps.getDropdownProps();\n const hasFilteredOptions = multiselectProps.filteredOptions.length > 0;\n\n const statusFooter = dropdownStatus.isSticky ? (\n <DropdownFooter content={multiselectProps.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 hasOptions = useRef(options.length > 0);\n hasOptions.current = hasOptions.current || options.length > 0;\n\n return (\n <ResetGroupedControlContext>\n <div\n {...baseProps}\n ref={__internalRootRef}\n className={clsx(styles.root, baseProps.className)}\n {...multiselectProps.getWrapperProps()}\n >\n <Dropdown\n {...dropdownProps}\n ariaLabelledby={dropdownProps.ariaRole ? joinStrings(ariaLabelId, controlId) : undefined}\n ariaDescribedby={\n dropdownProps.ariaRole\n ? joinStrings(dropdownStatus.content ? footerId : undefined, dropdownAriaDescribedby)\n : undefined\n }\n open={multiselectProps.isOpen}\n minWidth={getDropdownMinWidth({ expandToViewport, triggerWidth })}\n maxWidth={getBreakpointValue('xxs')} // AWSUI-19898\n trigger={trigger}\n header={dropdownHeader}\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 renderOption={renderOption}\n listBottom={\n !dropdownStatus.isSticky ? (\n <DropdownFooter content={multiselectProps.isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n menuProps={{ ...multiselectProps.getMenuProps(), ariaRequired }}\n getOptionProps={multiselectProps.getOptionProps}\n filteredOptions={multiselectProps.filteredOptions}\n filteringValue={filteringValue}\n ref={multiselectProps.scrollToIndex}\n hasDropdownStatus={dropdownStatus.content !== null}\n checkboxes={true}\n useInteractiveGroups={true}\n screenReaderContent={multiselectProps.announcement}\n highlightType={multiselectProps.highlightType}\n firstOptionSticky={hasFilteredOptions && enableSelectAll}\n isMultiSelect={true}\n />\n }\n />\n\n {showTokens && (\n <InternalTokenGroup\n {...multiselectProps.getTokenProps()}\n className={styles.tokens}\n alignment=\"horizontal\"\n limit={tokenLimit}\n items={tokens}\n i18nStrings={tokenGroupI18nStrings}\n limitShowMoreAriaLabel={tokenLimitShowMoreAriaLabel}\n limitShowFewerAriaLabel={tokenLimitShowFewerAriaLabel}\n disableOuterPadding={true}\n readOnly={readOnly}\n isItemReadOnly={item => (item as ExtendedToken)._readOnly}\n />\n )}\n\n <ScreenreaderOnly id={ariaLabelId}>{ariaLabel || inlineLabelText}</ScreenreaderOnly>\n </div>\n </ResetGroupedControlContext>\n );\n }\n);\n\nexport default InternalMultiselect;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE/F,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,cAAc,MAAM,iDAAiD,CAAC;AAC7E,OAAO,gBAAgB,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACjH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAG7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAC5C,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAC9C,OAAO,WAAW,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,C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AAE,GAAG,gBAAgB,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,EAC/D,cAAc,EAAE,gBAAgB,CAAC,cAAc,EAC/C,eAAe,EAAE,gBAAgB,CAAC,eAAe,EACjD,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,gBAAgB,CAAC,aAAa,EACnC,iBAAiB,EAAE,cAAc,CAAC,OAAO,KAAK,IAAI,EAClD,UAAU,EAAE,IAAI,EAChB,oBAAoB,EAAE,IAAI,EAC1B,mBAAmB,EAAE,gBAAgB,CAAC,YAAY,EAClD,aAAa,EAAE,gBAAgB,CAAC,aAAa,EAC7C,iBAAiB,EAAE,kBAAkB,IAAI,eAAe,EACxD,aAAa,EAAE,IAAI,GACnB,GAEJ;YAED,UAAU,IAAI,CACb,oBAAC,kBAAkB,OACb,gBAAgB,CAAC,aAAa,EAAE,EACpC,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,SAAS,EAAC,YAAY,EACtB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,qBAAqB,EAClC,sBAAsB,EAAE,2BAA2B,EACnD,uBAAuB,EAAE,4BAA4B,EACrD,mBAAmB,EAAE,IAAI,EACzB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,IAAI,CAAC,EAAE,CAAE,IAAsB,CAAC,SAAS,GACzD,CACH;YAED,oBAAC,gBAAgB,IAAC,EAAE,EAAE,WAAW,IAAG,SAAS,IAAI,eAAe,CAAoB,CAChF,CACqB,CAC9B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport Dropdown from '../dropdown/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { getBreakpointValue } from '../internal/breakpoints';\nimport DropdownFooter from '../internal/components/dropdown-footer/index.js';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { ResetGroupedControlContext, useGroupedControlContext } from '../internal/context/control-group-context';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { SomeRequired } from '../internal/types';\nimport { getDropdownMinWidth } from '../internal/utils/get-dropdown-min-width';\nimport { joinStrings } from '../internal/utils/strings';\nimport Filter from '../select/parts/filter';\nimport PlainList from '../select/parts/plain-list';\nimport Trigger from '../select/parts/trigger';\nimport VirtualList from '../select/parts/virtual-list';\nimport { composeDropdownContent } from '../select/utils/dropdown-customization';\nimport { TokenGroupProps } from '../token-group/interfaces';\nimport InternalTokenGroup from '../token-group/internal';\nimport { MultiselectProps } from './interfaces';\nimport { useMultiselect } from './use-multiselect';\n\nimport styles from './styles.css.js';\n\ntype InternalMultiselectProps = SomeRequired<\n MultiselectProps,\n 'options' | 'selectedOptions' | 'filteringType' | 'statusType' | 'keepOpen' | 'hideTokens'\n> &\n InternalBaseComponentProps;\n\ntype ExtendedToken = TokenGroupProps.Item & { _readOnly: boolean };\n\nconst InternalMultiselect = React.forwardRef(\n (\n {\n options,\n filteringType,\n filteringPlaceholder,\n filteringAriaLabel,\n filteringClearAriaLabel,\n ariaRequired,\n placeholder,\n disabled,\n readOnly,\n ariaLabel,\n inlineLabelText,\n selectedOptions,\n deselectAriaLabel,\n tokenLimit,\n i18nStrings,\n virtualScroll,\n inlineTokens = false,\n hideTokens,\n expandToViewport,\n tokenLimitShowFewerAriaLabel,\n tokenLimitShowMoreAriaLabel,\n __internalRootRef,\n autoFocus,\n enableSelectAll,\n renderOption,\n renderDropdownHeader,\n renderDropdownFooter,\n dropdownRole,\n dropdownAriaDescribedby,\n ...restProps\n }: InternalMultiselectProps,\n externalRef: React.Ref<MultiselectProps.Ref>\n ) => {\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n const groupedControlProps = useGroupedControlContext();\n const i18n = useInternalI18n('multiselect');\n\n const isGrouped = !!groupedControlProps.position;\n\n // When rendered inside a control group, tokens are always shown inline in the\n // trigger regardless of the `inlineTokens` prop, since there is no room to\n // display tokens below the control within a group.\n const showTokensInline = inlineTokens || isGrouped;\n\n // When grouped, the dropdown is portaled regardless of the public\n // `expandToViewport` prop so it escapes the control slot's stacking context\n // and paints over the group's inline label (which the focus ring stays under).\n const effectiveExpandToViewport = expandToViewport || isGrouped;\n\n const selfControlId = useUniqueId('trigger');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const ariaLabelId = useUniqueId('multiselect-ariaLabel-');\n const footerId = useUniqueId('multiselect-footer-');\n\n const [filteringValue, setFilteringValue] = useState('');\n const multiselectProps = useMultiselect({\n options,\n selectedOptions,\n filteringType,\n disabled,\n deselectAriaLabel,\n controlId,\n ariaLabelId,\n footerId,\n filteringValue,\n setFilteringValue,\n externalRef,\n enableSelectAll,\n i18nStrings,\n dropdownRole,\n dropdownAriaDescribedby,\n ...restProps,\n });\n\n const dropdownContentProps: MultiselectProps.DropdownContentProps = {\n filterText: filteringValue,\n closeDropdown: multiselectProps.closeDropdown,\n };\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 {...multiselectProps.getFilterProps()}\n />\n );\n\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 trigger = (\n <Trigger\n ref={triggerRef}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n triggerProps={multiselectProps.getTriggerProps(disabled, autoFocus)}\n selectedOption={null}\n selectedOptions={selectedOptions}\n triggerVariant={showTokensInline ? 'tokens' : 'placeholder'}\n isOpen={multiselectProps.isOpen}\n groupedControlProps={groupedControlProps}\n inlineLabelText={inlineLabelText}\n {...formFieldContext}\n controlId={controlId}\n ariaLabelledby={joinStrings(formFieldContext.ariaLabelledby, ariaLabelId)}\n />\n );\n\n const tokens: Array<ExtendedToken> = selectedOptions.map(option => ({\n label: option.label,\n 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 _readOnly: !!option.disabled,\n }));\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const showTokens = !hideTokens && !showTokensInline && tokens.length > 0;\n\n const tokenGroupI18nStrings: TokenGroupProps.I18nStrings = {\n limitShowFewer: i18nStrings?.tokenLimitShowFewer,\n limitShowMore: i18nStrings?.tokenLimitShowMore,\n };\n\n const dropdownStatus = multiselectProps.dropdownStatus;\n const dropdownProps = multiselectProps.getDropdownProps();\n const hasFilteredOptions = multiselectProps.filteredOptions.length > 0;\n\n const statusFooter = dropdownStatus.isSticky ? (\n <DropdownFooter content={multiselectProps.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 hasOptions = useRef(options.length > 0);\n hasOptions.current = hasOptions.current || options.length > 0;\n\n return (\n <ResetGroupedControlContext>\n <div\n {...baseProps}\n ref={__internalRootRef}\n className={clsx(styles.root, baseProps.className)}\n {...multiselectProps.getWrapperProps()}\n >\n <Dropdown\n {...dropdownProps}\n ariaLabelledby={dropdownProps.ariaRole ? joinStrings(ariaLabelId, controlId) : undefined}\n ariaDescribedby={\n dropdownProps.ariaRole\n ? joinStrings(dropdownStatus.content ? footerId : undefined, dropdownAriaDescribedby)\n : undefined\n }\n open={multiselectProps.isOpen}\n minWidth={getDropdownMinWidth({ expandToViewport: effectiveExpandToViewport, triggerWidth })}\n maxWidth={getBreakpointValue('xxs')} // AWSUI-19898\n trigger={trigger}\n header={dropdownHeader}\n footer={dropdownFooter}\n expandToViewport={effectiveExpandToViewport}\n // Forces dropdown position recalculation when new options are loaded\n contentKey={hasOptions.current.toString()}\n content={\n <ListComponent\n renderOption={renderOption}\n listBottom={\n !dropdownStatus.isSticky ? (\n <DropdownFooter content={multiselectProps.isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n menuProps={{ ...multiselectProps.getMenuProps(), ariaRequired }}\n getOptionProps={multiselectProps.getOptionProps}\n filteredOptions={multiselectProps.filteredOptions}\n filteringValue={filteringValue}\n ref={multiselectProps.scrollToIndex}\n hasDropdownStatus={dropdownStatus.content !== null}\n checkboxes={true}\n useInteractiveGroups={true}\n screenReaderContent={multiselectProps.announcement}\n highlightType={multiselectProps.highlightType}\n firstOptionSticky={hasFilteredOptions && enableSelectAll}\n isMultiSelect={true}\n />\n }\n />\n\n {showTokens && (\n <InternalTokenGroup\n {...multiselectProps.getTokenProps()}\n className={styles.tokens}\n alignment=\"horizontal\"\n limit={tokenLimit}\n items={tokens}\n i18nStrings={tokenGroupI18nStrings}\n limitShowMoreAriaLabel={tokenLimitShowMoreAriaLabel}\n limitShowFewerAriaLabel={tokenLimitShowFewerAriaLabel}\n disableOuterPadding={true}\n readOnly={readOnly}\n isItemReadOnly={item => (item as ExtendedToken)._readOnly}\n />\n )}\n\n <ScreenreaderOnly id={ariaLabelId}>{ariaLabel || inlineLabelText}</ScreenreaderOnly>\n </div>\n </ResetGroupedControlContext>\n );\n }\n);\n\nexport default InternalMultiselect;\n"]}
|
package/package.json
CHANGED
|
@@ -377,7 +377,7 @@
|
|
|
377
377
|
"./internal/base-theme/styles.css.js",
|
|
378
378
|
"./internal/base-component/styles.css.js"
|
|
379
379
|
],
|
|
380
|
-
"version": "3.0.
|
|
380
|
+
"version": "3.0.1397",
|
|
381
381
|
"repository": {
|
|
382
382
|
"type": "git",
|
|
383
383
|
"url": "https://github.com/cloudscape-design/components.git"
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"segment": "
|
|
5
|
-
"full-width": "awsui_full-
|
|
6
|
-
"refresh": "
|
|
7
|
-
"disabled": "
|
|
8
|
-
"selected": "
|
|
9
|
-
"icon": "
|
|
10
|
-
"with-text": "awsui_with-
|
|
11
|
-
"with-no-text": "awsui_with-no-
|
|
12
|
-
"root": "
|
|
13
|
-
"segment-part": "awsui_segment-
|
|
14
|
-
"grouped": "
|
|
15
|
-
"grouped-only": "awsui_grouped-
|
|
16
|
-
"grouped-vertical": "awsui_grouped-
|
|
17
|
-
"grouped-horizontal-first": "awsui_grouped-horizontal-
|
|
18
|
-
"grouped-horizontal-middle": "awsui_grouped-horizontal-
|
|
19
|
-
"grouped-horizontal-last": "awsui_grouped-horizontal-
|
|
20
|
-
"grouped-vertical-first": "awsui_grouped-vertical-
|
|
21
|
-
"grouped-vertical-middle": "awsui_grouped-vertical-
|
|
22
|
-
"grouped-vertical-last": "awsui_grouped-vertical-
|
|
23
|
-
"select": "
|
|
24
|
-
"segment-count-2": "awsui_segment-count-
|
|
25
|
-
"segment-count-3": "awsui_segment-count-
|
|
26
|
-
"segment-count-4": "awsui_segment-count-
|
|
27
|
-
"segment-count-5": "awsui_segment-count-
|
|
28
|
-
"segment-count-6": "awsui_segment-count-
|
|
29
|
-
"disabled-reason-tooltip": "awsui_disabled-reason-
|
|
4
|
+
"segment": "awsui_segment_8cbea_hhwib_17",
|
|
5
|
+
"full-width": "awsui_full-width_8cbea_hhwib_44",
|
|
6
|
+
"refresh": "awsui_refresh_8cbea_hhwib_47",
|
|
7
|
+
"disabled": "awsui_disabled_8cbea_hhwib_53",
|
|
8
|
+
"selected": "awsui_selected_8cbea_hhwib_110",
|
|
9
|
+
"icon": "awsui_icon_8cbea_hhwib_121",
|
|
10
|
+
"with-text": "awsui_with-text_8cbea_hhwib_125",
|
|
11
|
+
"with-no-text": "awsui_with-no-text_8cbea_hhwib_131",
|
|
12
|
+
"root": "awsui_root_8cbea_hhwib_136",
|
|
13
|
+
"segment-part": "awsui_segment-part_8cbea_hhwib_168",
|
|
14
|
+
"grouped": "awsui_grouped_8cbea_hhwib_189",
|
|
15
|
+
"grouped-only": "awsui_grouped-only_8cbea_hhwib_189",
|
|
16
|
+
"grouped-vertical": "awsui_grouped-vertical_8cbea_hhwib_193",
|
|
17
|
+
"grouped-horizontal-first": "awsui_grouped-horizontal-first_8cbea_hhwib_204",
|
|
18
|
+
"grouped-horizontal-middle": "awsui_grouped-horizontal-middle_8cbea_hhwib_208",
|
|
19
|
+
"grouped-horizontal-last": "awsui_grouped-horizontal-last_8cbea_hhwib_214",
|
|
20
|
+
"grouped-vertical-first": "awsui_grouped-vertical-first_8cbea_hhwib_218",
|
|
21
|
+
"grouped-vertical-middle": "awsui_grouped-vertical-middle_8cbea_hhwib_222",
|
|
22
|
+
"grouped-vertical-last": "awsui_grouped-vertical-last_8cbea_hhwib_228",
|
|
23
|
+
"select": "awsui_select_8cbea_hhwib_110",
|
|
24
|
+
"segment-count-2": "awsui_segment-count-2_8cbea_hhwib_245",
|
|
25
|
+
"segment-count-3": "awsui_segment-count-3_8cbea_hhwib_252",
|
|
26
|
+
"segment-count-4": "awsui_segment-count-4_8cbea_hhwib_259",
|
|
27
|
+
"segment-count-5": "awsui_segment-count-5_8cbea_hhwib_266",
|
|
28
|
+
"segment-count-6": "awsui_segment-count-6_8cbea_hhwib_273",
|
|
29
|
+
"disabled-reason-tooltip": "awsui_disabled-reason-tooltip_8cbea_hhwib_280"
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -14,7 +14,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
14
14
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
15
15
|
SPDX-License-Identifier: Apache-2.0
|
|
16
16
|
*/
|
|
17
|
-
.
|
|
17
|
+
.awsui_segment_8cbea_hhwib_17:not(#\9) {
|
|
18
18
|
font-size: var(--font-size-body-m-tq5a14, 14px);
|
|
19
19
|
line-height: var(--line-height-body-m-5xw6xo, 20px);
|
|
20
20
|
word-wrap: break-word;
|
|
@@ -41,27 +41,27 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
41
41
|
border-block: none;
|
|
42
42
|
--awsui-style-focus-ring-box-shadow-ka4djm: 0 0 0 var(--awsui-style-focus-ring-border-width-ka4djm, 2px) var(--awsui-style-focus-ring-border-color-ka4djm, var(--color-border-item-focused-sewkzn, #006ce0));
|
|
43
43
|
}
|
|
44
|
-
.
|
|
44
|
+
.awsui_segment_8cbea_hhwib_17.awsui_full-width_8cbea_hhwib_44:not(#\9) {
|
|
45
45
|
justify-content: center;
|
|
46
46
|
}
|
|
47
|
-
.
|
|
47
|
+
.awsui_segment_8cbea_hhwib_17:not(#\9):not(.awsui_refresh_8cbea_hhwib_47) {
|
|
48
48
|
block-size: calc(100% - var(--space-static-xxs-vzto3j, 4px) - 2 * var(--border-width-field-2365x3, 1px));
|
|
49
49
|
}
|
|
50
|
-
.
|
|
50
|
+
.awsui_segment_8cbea_hhwib_17:not(#\9):focus {
|
|
51
51
|
outline: none;
|
|
52
52
|
}
|
|
53
|
-
.
|
|
53
|
+
.awsui_segment_8cbea_hhwib_17.awsui_disabled_8cbea_hhwib_53:not(#\9) {
|
|
54
54
|
background: var(--awsui-style-background-disabled-ka4djm, var(--color-background-segment-disabled-mjubn7, #ffffff));
|
|
55
55
|
color: var(--awsui-style-color-disabled-ka4djm, var(--color-text-interactive-disabled-tuxgxq, #b4b4bb));
|
|
56
56
|
}
|
|
57
|
-
body[data-awsui-focus-visible=true] .
|
|
57
|
+
body[data-awsui-focus-visible=true] .awsui_segment_8cbea_hhwib_17:not(#\9):focus {
|
|
58
58
|
position: relative;
|
|
59
59
|
}
|
|
60
|
-
body[data-awsui-focus-visible=true] .
|
|
60
|
+
body[data-awsui-focus-visible=true] .awsui_segment_8cbea_hhwib_17:not(#\9):focus {
|
|
61
61
|
outline: 2px dotted transparent;
|
|
62
62
|
outline-offset: calc(var(--space-segmented-control-focus-outline-gutter-sz9jgo, 6px) - 1px);
|
|
63
63
|
}
|
|
64
|
-
body[data-awsui-focus-visible=true] .
|
|
64
|
+
body[data-awsui-focus-visible=true] .awsui_segment_8cbea_hhwib_17:not(#\9):focus::before {
|
|
65
65
|
content: " ";
|
|
66
66
|
display: block;
|
|
67
67
|
position: absolute;
|
|
@@ -76,7 +76,7 @@ body[data-awsui-focus-visible=true] .awsui_segment_8cbea_qppsy_17:not(#\9):focus
|
|
|
76
76
|
box-shadow: var(--awsui-style-focus-ring-box-shadow-ka4djm);
|
|
77
77
|
z-index: 1;
|
|
78
78
|
}
|
|
79
|
-
.
|
|
79
|
+
.awsui_segment_8cbea_hhwib_17:not(#\9):not(:last-child)::after {
|
|
80
80
|
content: "";
|
|
81
81
|
position: absolute;
|
|
82
82
|
inset-inline-end: calc(-1 * (var(--space-static-xxs-vzto3j, 4px) + 1px));
|
|
@@ -86,53 +86,54 @@ body[data-awsui-focus-visible=true] .awsui_segment_8cbea_qppsy_17:not(#\9):focus
|
|
|
86
86
|
background: var(--color-border-segment-divider-mq01bu, #8c8c94);
|
|
87
87
|
z-index: 1;
|
|
88
88
|
}
|
|
89
|
-
.
|
|
89
|
+
.awsui_segment_8cbea_hhwib_17:not(#\9):not(.awsui_refresh_8cbea_hhwib_47):not(:last-child)::after {
|
|
90
90
|
inset-inline-end: calc(-1 * var(--space-static-xxs-vzto3j, 4px));
|
|
91
91
|
}
|
|
92
|
-
.
|
|
92
|
+
.awsui_segment_8cbea_hhwib_17:not(#\9):nth-child(1) {
|
|
93
93
|
grid-column: 1;
|
|
94
94
|
}
|
|
95
|
-
.
|
|
95
|
+
.awsui_segment_8cbea_hhwib_17:not(#\9):nth-child(2) {
|
|
96
96
|
grid-column: 2;
|
|
97
97
|
}
|
|
98
|
-
.
|
|
98
|
+
.awsui_segment_8cbea_hhwib_17:not(#\9):nth-child(3) {
|
|
99
99
|
grid-column: 3;
|
|
100
100
|
}
|
|
101
|
-
.
|
|
101
|
+
.awsui_segment_8cbea_hhwib_17:not(#\9):nth-child(4) {
|
|
102
102
|
grid-column: 4;
|
|
103
103
|
}
|
|
104
|
-
.
|
|
104
|
+
.awsui_segment_8cbea_hhwib_17:not(#\9):nth-child(5) {
|
|
105
105
|
grid-column: 5;
|
|
106
106
|
}
|
|
107
|
-
.
|
|
107
|
+
.awsui_segment_8cbea_hhwib_17:not(#\9):nth-child(6) {
|
|
108
108
|
grid-column: 6;
|
|
109
109
|
}
|
|
110
|
-
.
|
|
110
|
+
.awsui_segment_8cbea_hhwib_17.awsui_selected_8cbea_hhwib_110:not(#\9) {
|
|
111
111
|
background: var(--awsui-style-background-active-ka4djm, var(--color-background-segment-active-ns5rt6, #006ce0));
|
|
112
112
|
color: var(--awsui-style-color-active-ka4djm, var(--color-text-segment-active-hbbf1h, #ffffff));
|
|
113
|
+
box-shadow: inset 0 0 0 var(--awsui-internal-style-segment-selected-border-width, 0) var(--color-border-segment-active-y8x5lr, #424650);
|
|
113
114
|
}
|
|
114
|
-
.
|
|
115
|
+
.awsui_segment_8cbea_hhwib_17:not(#\9):hover:not(.awsui_selected_8cbea_hhwib_110):not(.awsui_disabled_8cbea_hhwib_53):not(:focus) {
|
|
115
116
|
background: var(--awsui-style-background-hover-ka4djm, var(--color-background-segment-hover-el4hte, #f0fbff));
|
|
116
117
|
color: var(--awsui-style-color-hover-ka4djm, var(--color-text-segment-hover-qq2b2e, #002b66));
|
|
117
118
|
cursor: pointer;
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
.
|
|
121
|
+
.awsui_icon_8cbea_hhwib_121:not(#\9) {
|
|
121
122
|
/* used in test-utils */
|
|
122
123
|
}
|
|
123
124
|
|
|
124
|
-
.awsui_with-
|
|
125
|
+
.awsui_with-text_8cbea_hhwib_125:not(#\9) {
|
|
125
126
|
position: relative;
|
|
126
127
|
inset-inline-start: calc(-1 * var(--space-xxs-3o1yoq, 4px));
|
|
127
128
|
margin-inline-end: var(--space-xxs-3o1yoq, 4px);
|
|
128
129
|
}
|
|
129
130
|
|
|
130
|
-
.awsui_with-no-
|
|
131
|
+
.awsui_with-no-text_8cbea_hhwib_131:not(#\9) {
|
|
131
132
|
margin-inline: auto;
|
|
132
133
|
inset-inline: 0;
|
|
133
134
|
}
|
|
134
135
|
|
|
135
|
-
.
|
|
136
|
+
.awsui_root_8cbea_hhwib_136:not(#\9) {
|
|
136
137
|
border-collapse: separate;
|
|
137
138
|
border-spacing: 0;
|
|
138
139
|
box-sizing: border-box;
|
|
@@ -164,7 +165,7 @@ body[data-awsui-focus-visible=true] .awsui_segment_8cbea_qppsy_17:not(#\9):focus
|
|
|
164
165
|
-moz-osx-font-smoothing: auto;
|
|
165
166
|
}
|
|
166
167
|
|
|
167
|
-
.awsui_segment-
|
|
168
|
+
.awsui_segment-part_8cbea_hhwib_168:not(#\9) {
|
|
168
169
|
display: inline-grid;
|
|
169
170
|
border-inline: solid var(--border-width-field-2365x3, 1px) var(--color-border-segment-wrapper-ofstpm, #8c8c94);
|
|
170
171
|
border-block: solid var(--border-width-field-2365x3, 1px) var(--color-border-segment-wrapper-ofstpm, #8c8c94);
|
|
@@ -179,103 +180,103 @@ body[data-awsui-focus-visible=true] .awsui_segment_8cbea_qppsy_17:not(#\9):focus
|
|
|
179
180
|
padding-inline: calc(var(--space-static-xxs-vzto3j, 4px) - var(--border-width-field-2365x3, 1px));
|
|
180
181
|
gap: calc(var(--space-static-xxs-vzto3j, 4px) * 2 + 1px);
|
|
181
182
|
}
|
|
182
|
-
.awsui_segment-
|
|
183
|
+
.awsui_segment-part_8cbea_hhwib_168:not(#\9):not(.awsui_refresh_8cbea_hhwib_47) {
|
|
183
184
|
padding-inline: calc(var(--space-static-xxxs-opeihl, 2px) + var(--border-width-field-2365x3, 1px));
|
|
184
185
|
padding-block: 0;
|
|
185
186
|
gap: calc(var(--space-static-xxs-vzto3j, 4px) * 2 - 1px);
|
|
186
187
|
}
|
|
187
188
|
@media (max-width: 688px) {
|
|
188
|
-
.awsui_segment-
|
|
189
|
+
.awsui_segment-part_8cbea_hhwib_168:not(#\9):not(.awsui_grouped_8cbea_hhwib_189), .awsui_segment-part_8cbea_hhwib_168.awsui_grouped-only_8cbea_hhwib_189:not(#\9) {
|
|
189
190
|
display: none;
|
|
190
191
|
}
|
|
191
192
|
}
|
|
192
|
-
.awsui_segment-
|
|
193
|
+
.awsui_segment-part_8cbea_hhwib_168.awsui_grouped_8cbea_hhwib_189.awsui_grouped-vertical_8cbea_hhwib_193:not(#\9) {
|
|
193
194
|
inline-size: 100%;
|
|
194
195
|
box-sizing: border-box;
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
.
|
|
198
|
+
.awsui_grouped_8cbea_hhwib_189:not(#\9) {
|
|
198
199
|
border-start-start-radius: var(--border-radius-input-k1q34z, 8px);
|
|
199
200
|
border-start-end-radius: var(--border-radius-input-k1q34z, 8px);
|
|
200
201
|
border-end-start-radius: var(--border-radius-input-k1q34z, 8px);
|
|
201
202
|
border-end-end-radius: var(--border-radius-input-k1q34z, 8px);
|
|
202
203
|
}
|
|
203
|
-
.awsui_grouped-horizontal-
|
|
204
|
+
.awsui_grouped-horizontal-first_8cbea_hhwib_204:not(#\9) {
|
|
204
205
|
border-start-end-radius: 0;
|
|
205
206
|
border-end-end-radius: 0;
|
|
206
207
|
}
|
|
207
|
-
.awsui_grouped-horizontal-
|
|
208
|
+
.awsui_grouped-horizontal-middle_8cbea_hhwib_208:not(#\9) {
|
|
208
209
|
border-start-start-radius: 0;
|
|
209
210
|
border-start-end-radius: 0;
|
|
210
211
|
border-end-start-radius: 0;
|
|
211
212
|
border-end-end-radius: 0;
|
|
212
213
|
}
|
|
213
|
-
.awsui_grouped-horizontal-
|
|
214
|
+
.awsui_grouped-horizontal-last_8cbea_hhwib_214:not(#\9) {
|
|
214
215
|
border-start-start-radius: 0;
|
|
215
216
|
border-end-start-radius: 0;
|
|
216
217
|
}
|
|
217
|
-
.awsui_grouped-vertical-
|
|
218
|
+
.awsui_grouped-vertical-first_8cbea_hhwib_218:not(#\9) {
|
|
218
219
|
border-end-start-radius: 0;
|
|
219
220
|
border-end-end-radius: 0;
|
|
220
221
|
}
|
|
221
|
-
.awsui_grouped-vertical-
|
|
222
|
+
.awsui_grouped-vertical-middle_8cbea_hhwib_222:not(#\9) {
|
|
222
223
|
border-start-start-radius: 0;
|
|
223
224
|
border-start-end-radius: 0;
|
|
224
225
|
border-end-start-radius: 0;
|
|
225
226
|
border-end-end-radius: 0;
|
|
226
227
|
}
|
|
227
|
-
.awsui_grouped-vertical-
|
|
228
|
+
.awsui_grouped-vertical-last_8cbea_hhwib_228:not(#\9) {
|
|
228
229
|
border-start-start-radius: 0;
|
|
229
230
|
border-start-end-radius: 0;
|
|
230
231
|
}
|
|
231
|
-
.
|
|
232
|
+
.awsui_grouped_8cbea_hhwib_189.awsui_grouped-horizontal-middle_8cbea_hhwib_208:not(#\9), .awsui_grouped_8cbea_hhwib_189.awsui_grouped-horizontal-last_8cbea_hhwib_214:not(#\9) {
|
|
232
233
|
border-inline-start: none;
|
|
233
234
|
}
|
|
234
235
|
|
|
235
|
-
.
|
|
236
|
+
.awsui_select_8cbea_hhwib_110:not(#\9) {
|
|
236
237
|
display: none;
|
|
237
238
|
}
|
|
238
239
|
@media (max-width: 688px) {
|
|
239
|
-
.
|
|
240
|
+
.awsui_select_8cbea_hhwib_110:not(#\9):not(.awsui_grouped_8cbea_hhwib_189), .awsui_select_8cbea_hhwib_110.awsui_grouped-only_8cbea_hhwib_189:not(#\9) {
|
|
240
241
|
display: block;
|
|
241
242
|
}
|
|
242
243
|
}
|
|
243
244
|
|
|
244
|
-
.awsui_segment-count-
|
|
245
|
+
.awsui_segment-count-2_8cbea_hhwib_245:not(#\9) {
|
|
245
246
|
grid-template-columns: repeat(2, auto);
|
|
246
247
|
}
|
|
247
|
-
.awsui_segment-count-
|
|
248
|
+
.awsui_segment-count-2_8cbea_hhwib_245.awsui_grouped_8cbea_hhwib_189.awsui_grouped-vertical_8cbea_hhwib_193:not(#\9) {
|
|
248
249
|
grid-template-columns: repeat(2, 1fr);
|
|
249
250
|
}
|
|
250
251
|
|
|
251
|
-
.awsui_segment-count-
|
|
252
|
+
.awsui_segment-count-3_8cbea_hhwib_252:not(#\9) {
|
|
252
253
|
grid-template-columns: repeat(3, auto);
|
|
253
254
|
}
|
|
254
|
-
.awsui_segment-count-
|
|
255
|
+
.awsui_segment-count-3_8cbea_hhwib_252.awsui_grouped_8cbea_hhwib_189.awsui_grouped-vertical_8cbea_hhwib_193:not(#\9) {
|
|
255
256
|
grid-template-columns: repeat(3, 1fr);
|
|
256
257
|
}
|
|
257
258
|
|
|
258
|
-
.awsui_segment-count-
|
|
259
|
+
.awsui_segment-count-4_8cbea_hhwib_259:not(#\9) {
|
|
259
260
|
grid-template-columns: repeat(4, auto);
|
|
260
261
|
}
|
|
261
|
-
.awsui_segment-count-
|
|
262
|
+
.awsui_segment-count-4_8cbea_hhwib_259.awsui_grouped_8cbea_hhwib_189.awsui_grouped-vertical_8cbea_hhwib_193:not(#\9) {
|
|
262
263
|
grid-template-columns: repeat(4, 1fr);
|
|
263
264
|
}
|
|
264
265
|
|
|
265
|
-
.awsui_segment-count-
|
|
266
|
+
.awsui_segment-count-5_8cbea_hhwib_266:not(#\9) {
|
|
266
267
|
grid-template-columns: repeat(5, auto);
|
|
267
268
|
}
|
|
268
|
-
.awsui_segment-count-
|
|
269
|
+
.awsui_segment-count-5_8cbea_hhwib_266.awsui_grouped_8cbea_hhwib_189.awsui_grouped-vertical_8cbea_hhwib_193:not(#\9) {
|
|
269
270
|
grid-template-columns: repeat(5, 1fr);
|
|
270
271
|
}
|
|
271
272
|
|
|
272
|
-
.awsui_segment-count-
|
|
273
|
+
.awsui_segment-count-6_8cbea_hhwib_273:not(#\9) {
|
|
273
274
|
grid-template-columns: repeat(6, auto);
|
|
274
275
|
}
|
|
275
|
-
.awsui_segment-count-
|
|
276
|
+
.awsui_segment-count-6_8cbea_hhwib_273.awsui_grouped_8cbea_hhwib_189.awsui_grouped-vertical_8cbea_hhwib_193:not(#\9) {
|
|
276
277
|
grid-template-columns: repeat(6, 1fr);
|
|
277
278
|
}
|
|
278
279
|
|
|
279
|
-
.awsui_disabled-reason-
|
|
280
|
+
.awsui_disabled-reason-tooltip_8cbea_hhwib_280:not(#\9) {
|
|
280
281
|
/* used in test-utils or tests */
|
|
281
282
|
}
|
|
@@ -2,31 +2,31 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"segment": "
|
|
6
|
-
"full-width": "awsui_full-
|
|
7
|
-
"refresh": "
|
|
8
|
-
"disabled": "
|
|
9
|
-
"selected": "
|
|
10
|
-
"icon": "
|
|
11
|
-
"with-text": "awsui_with-
|
|
12
|
-
"with-no-text": "awsui_with-no-
|
|
13
|
-
"root": "
|
|
14
|
-
"segment-part": "awsui_segment-
|
|
15
|
-
"grouped": "
|
|
16
|
-
"grouped-only": "awsui_grouped-
|
|
17
|
-
"grouped-vertical": "awsui_grouped-
|
|
18
|
-
"grouped-horizontal-first": "awsui_grouped-horizontal-
|
|
19
|
-
"grouped-horizontal-middle": "awsui_grouped-horizontal-
|
|
20
|
-
"grouped-horizontal-last": "awsui_grouped-horizontal-
|
|
21
|
-
"grouped-vertical-first": "awsui_grouped-vertical-
|
|
22
|
-
"grouped-vertical-middle": "awsui_grouped-vertical-
|
|
23
|
-
"grouped-vertical-last": "awsui_grouped-vertical-
|
|
24
|
-
"select": "
|
|
25
|
-
"segment-count-2": "awsui_segment-count-
|
|
26
|
-
"segment-count-3": "awsui_segment-count-
|
|
27
|
-
"segment-count-4": "awsui_segment-count-
|
|
28
|
-
"segment-count-5": "awsui_segment-count-
|
|
29
|
-
"segment-count-6": "awsui_segment-count-
|
|
30
|
-
"disabled-reason-tooltip": "awsui_disabled-reason-
|
|
5
|
+
"segment": "awsui_segment_8cbea_hhwib_17",
|
|
6
|
+
"full-width": "awsui_full-width_8cbea_hhwib_44",
|
|
7
|
+
"refresh": "awsui_refresh_8cbea_hhwib_47",
|
|
8
|
+
"disabled": "awsui_disabled_8cbea_hhwib_53",
|
|
9
|
+
"selected": "awsui_selected_8cbea_hhwib_110",
|
|
10
|
+
"icon": "awsui_icon_8cbea_hhwib_121",
|
|
11
|
+
"with-text": "awsui_with-text_8cbea_hhwib_125",
|
|
12
|
+
"with-no-text": "awsui_with-no-text_8cbea_hhwib_131",
|
|
13
|
+
"root": "awsui_root_8cbea_hhwib_136",
|
|
14
|
+
"segment-part": "awsui_segment-part_8cbea_hhwib_168",
|
|
15
|
+
"grouped": "awsui_grouped_8cbea_hhwib_189",
|
|
16
|
+
"grouped-only": "awsui_grouped-only_8cbea_hhwib_189",
|
|
17
|
+
"grouped-vertical": "awsui_grouped-vertical_8cbea_hhwib_193",
|
|
18
|
+
"grouped-horizontal-first": "awsui_grouped-horizontal-first_8cbea_hhwib_204",
|
|
19
|
+
"grouped-horizontal-middle": "awsui_grouped-horizontal-middle_8cbea_hhwib_208",
|
|
20
|
+
"grouped-horizontal-last": "awsui_grouped-horizontal-last_8cbea_hhwib_214",
|
|
21
|
+
"grouped-vertical-first": "awsui_grouped-vertical-first_8cbea_hhwib_218",
|
|
22
|
+
"grouped-vertical-middle": "awsui_grouped-vertical-middle_8cbea_hhwib_222",
|
|
23
|
+
"grouped-vertical-last": "awsui_grouped-vertical-last_8cbea_hhwib_228",
|
|
24
|
+
"select": "awsui_select_8cbea_hhwib_110",
|
|
25
|
+
"segment-count-2": "awsui_segment-count-2_8cbea_hhwib_245",
|
|
26
|
+
"segment-count-3": "awsui_segment-count-3_8cbea_hhwib_252",
|
|
27
|
+
"segment-count-4": "awsui_segment-count-4_8cbea_hhwib_259",
|
|
28
|
+
"segment-count-5": "awsui_segment-count-5_8cbea_hhwib_266",
|
|
29
|
+
"segment-count-6": "awsui_segment-count-6_8cbea_hhwib_273",
|
|
30
|
+
"disabled-reason-tooltip": "awsui_disabled-reason-tooltip_8cbea_hhwib_280"
|
|
31
31
|
};
|
|
32
32
|
|
package/select/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/select/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAgB3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAc3C,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,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/select/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAgB3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAc3C,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,6FAqSnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/select/internal.js
CHANGED
|
@@ -32,6 +32,10 @@ const InternalSelect = React.forwardRef(({ options, filteringType = 'none', filt
|
|
|
32
32
|
const baseProps = getBaseProps(restProps);
|
|
33
33
|
const formFieldContext = useFormFieldContext(restProps);
|
|
34
34
|
const groupedControlProps = useGroupedControlContext();
|
|
35
|
+
// When grouped, the dropdown is portaled regardless of the public
|
|
36
|
+
// `expandToViewport` prop so it escapes the control slot's stacking context
|
|
37
|
+
// and paints over the group's inline label (which the focus ring stays under).
|
|
38
|
+
const effectiveExpandToViewport = expandToViewport || !!groupedControlProps.position;
|
|
35
39
|
const i18n = useInternalI18n('select');
|
|
36
40
|
const errorIconAriaLabel = i18n('errorIconAriaLabel', restProps.errorIconAriaLabel);
|
|
37
41
|
const selectedAriaLabel = i18n('selectedAriaLabel', restProps.selectedAriaLabel);
|
|
@@ -146,7 +150,7 @@ const InternalSelect = React.forwardRef(({ options, filteringType = 'none', filt
|
|
|
146
150
|
React.createElement("div", { ...baseProps, ref: mergedRef, className: clsx(styles.root, baseProps.className), onKeyDown: handleNativeSearch },
|
|
147
151
|
React.createElement(Dropdown, { ...dropdownProps, ariaLabelledby: dropdownProps.ariaRole ? joinStrings(selectAriaLabelId, controlId) : undefined, ariaDescribedby: dropdownProps.ariaRole
|
|
148
152
|
? joinStrings(dropdownStatus.content ? footerId : undefined, dropdownAriaDescribedby)
|
|
149
|
-
: undefined, open: isOpen, stretchTriggerHeight: !!__inFilteringToken, minWidth: getDropdownMinWidth({ expandToViewport, triggerWidth }), maxWidth: getBreakpointValue('xxs'), trigger: trigger, header: dropdownHeader, onMouseDown: handleMouseDown, footer: dropdownFooter, expandToViewport:
|
|
153
|
+
: undefined, open: isOpen, stretchTriggerHeight: !!__inFilteringToken, minWidth: getDropdownMinWidth({ expandToViewport: effectiveExpandToViewport, triggerWidth }), maxWidth: getBreakpointValue('xxs'), trigger: trigger, header: dropdownHeader, onMouseDown: handleMouseDown, footer: dropdownFooter, expandToViewport: effectiveExpandToViewport,
|
|
150
154
|
// Forces dropdown position recalculation when new options are loaded
|
|
151
155
|
contentKey: hasOptions.current.toString(), content: React.createElement(ListComponent, { listBottom: !dropdownStatus.isSticky ? (React.createElement(DropdownFooter, { content: isOpen ? dropdownStatus.content : null, id: footerId })) : null, renderOption: renderOption, menuProps: menuProps, getOptionProps: getOptionProps, filteredOptions: filteredOptions, filteringValue: filteringValue, ref: scrollToIndex, hasDropdownStatus: dropdownStatus.content !== null, screenReaderContent: announcement, highlightType: highlightType }) }),
|
|
152
156
|
React.createElement("div", { hidden: true, id: selectAriaLabelId }, ariaLabel || inlineLabelText))));
|