@cloudscape-design/components 3.0.1405 → 3.0.1406
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/alert/styles.css.js +27 -27
- package/alert/styles.scoped.css +67 -116
- package/alert/styles.selectors.js +27 -27
- package/app-layout/visual-refresh-toolbar/skeleton/skeleton-parts.js +6 -6
- package/app-layout/visual-refresh-toolbar/skeleton/skeleton-parts.js.map +1 -1
- package/autosuggest/internal.d.ts.map +1 -1
- package/autosuggest/internal.js +1 -1
- package/autosuggest/internal.js.map +1 -1
- package/autosuggest/options-list.js +1 -1
- package/autosuggest/options-list.js.map +1 -1
- package/badge/styles.css.js +10 -10
- package/badge/styles.scoped.css +55 -83
- package/badge/styles.selectors.js +10 -10
- package/button/styles.css.js +24 -24
- package/button/styles.scoped.css +356 -405
- package/button/styles.selectors.js +24 -24
- package/button-dropdown/filter.d.ts +1 -1
- package/button-dropdown/filter.d.ts.map +1 -1
- package/checkbox/internal.d.ts +0 -2
- package/checkbox/internal.d.ts.map +1 -1
- package/checkbox/internal.js +1 -1
- package/checkbox/internal.js.map +1 -1
- package/checkbox/styles.css.js +3 -3
- package/checkbox/styles.scoped.css +16 -28
- package/checkbox/styles.selectors.js +3 -3
- package/dropdown/styles.css.js +20 -20
- package/dropdown/styles.scoped.css +55 -63
- package/dropdown/styles.selectors.js +20 -20
- package/expandable-section/expandable-section-header.d.ts +3 -1
- package/expandable-section/expandable-section-header.d.ts.map +1 -1
- package/expandable-section/expandable-section-header.js +11 -9
- package/expandable-section/expandable-section-header.js.map +1 -1
- package/expandable-section/internal.d.ts +7 -0
- package/expandable-section/internal.d.ts.map +1 -1
- package/expandable-section/internal.js +2 -2
- package/expandable-section/internal.js.map +1 -1
- package/expandable-section/styles.css.js +46 -44
- package/expandable-section/styles.scoped.css +98 -89
- package/expandable-section/styles.selectors.js +46 -44
- package/input/index.d.ts.map +1 -1
- package/input/index.js +2 -1
- package/input/index.js.map +1 -1
- package/input/internal.d.ts +8 -1
- package/input/internal.d.ts.map +1 -1
- package/input/internal.js +7 -7
- package/input/internal.js.map +1 -1
- package/input/styles.css.js +44 -37
- package/input/styles.scoped.css +203 -86
- package/input/styles.selectors.js +44 -37
- package/internal/base-component/styles.scoped.css +1 -1
- package/internal/base-theme/styles.scoped.css +5 -0
- package/internal/components/abstract-switch/index.d.ts +0 -4
- package/internal/components/abstract-switch/index.d.ts.map +1 -1
- package/internal/components/abstract-switch/index.js +3 -3
- package/internal/components/abstract-switch/index.js.map +1 -1
- package/internal/components/abstract-switch/styles.css.js +13 -13
- package/internal/components/abstract-switch/styles.scoped.css +23 -23
- package/internal/components/abstract-switch/styles.selectors.js +13 -13
- package/internal/components/autosuggest-input/index.js +1 -1
- package/internal/components/autosuggest-input/index.js.map +1 -1
- package/internal/components/autosuggest-input/styles.css.js +33 -27
- package/internal/components/autosuggest-input/styles.scoped.css +129 -34
- package/internal/components/autosuggest-input/styles.selectors.js +33 -27
- package/internal/components/button-trigger/index.js +1 -1
- package/internal/components/button-trigger/index.js.map +1 -1
- package/internal/components/button-trigger/styles.css.js +29 -23
- package/internal/components/button-trigger/styles.scoped.css +139 -44
- package/internal/components/button-trigger/styles.selectors.js +29 -23
- package/internal/components/checkbox-icon/styles.css.js +9 -9
- package/internal/components/checkbox-icon/styles.scoped.css +15 -15
- package/internal/components/checkbox-icon/styles.selectors.js +9 -9
- package/internal/components/control-group/grouped-control-styles.d.ts +5 -4
- package/internal/components/control-group/grouped-control-styles.d.ts.map +1 -1
- package/internal/components/control-group/grouped-control-styles.js +8 -6
- package/internal/components/control-group/grouped-control-styles.js.map +1 -1
- package/internal/components/control-group/index.d.ts.map +1 -1
- package/internal/components/control-group/index.js +28 -4
- package/internal/components/control-group/index.js.map +1 -1
- package/internal/components/control-group/styles.css.js +27 -20
- package/internal/components/control-group/styles.scoped.css +51 -20
- package/internal/components/control-group/styles.selectors.js +27 -20
- package/internal/components/listbox/parts/common.d.ts.map +1 -0
- package/internal/components/listbox/parts/common.js.map +1 -0
- package/{select/utils → internal/components/listbox/parts}/get-item-props.d.ts +1 -1
- package/internal/components/listbox/parts/get-item-props.d.ts.map +1 -0
- package/{select/utils → internal/components/listbox/parts}/get-item-props.js +1 -1
- package/internal/components/listbox/parts/get-item-props.js.map +1 -0
- package/internal/components/listbox/parts/option-group.d.ts.map +1 -0
- package/{select → internal/components/listbox}/parts/option-group.js +1 -1
- package/internal/components/listbox/parts/option-group.js.map +1 -0
- package/{select/utils → internal/components/listbox/parts}/render-options.d.ts +5 -5
- package/internal/components/listbox/parts/render-options.d.ts.map +1 -0
- package/{select/utils → internal/components/listbox/parts}/render-options.js +4 -4
- package/internal/components/listbox/parts/render-options.js.map +1 -0
- package/internal/components/listbox/parts/scroll-to-index.d.ts.map +1 -0
- package/internal/components/listbox/parts/scroll-to-index.js.map +1 -0
- package/{select/utils → internal/components/listbox}/use-announcement.d.ts +2 -2
- package/internal/components/listbox/use-announcement.d.ts.map +1 -0
- package/{select/utils → internal/components/listbox}/use-announcement.js +1 -1
- package/internal/components/listbox/use-announcement.js.map +1 -0
- package/internal/components/listbox/utils/check-option-value-field.d.ts.map +1 -0
- package/{select → internal/components/listbox}/utils/check-option-value-field.js +1 -1
- package/internal/components/listbox/utils/check-option-value-field.js.map +1 -0
- package/{select → internal/components/listbox}/utils/connect-options.d.ts +2 -2
- package/internal/components/listbox/utils/connect-options.d.ts.map +1 -0
- package/internal/components/listbox/utils/connect-options.js.map +1 -0
- package/internal/components/option/index.d.ts +2 -0
- package/internal/components/option/index.d.ts.map +1 -1
- package/internal/components/option/index.js +4 -4
- package/internal/components/option/index.js.map +1 -1
- package/internal/components/option/interfaces.d.ts +2 -0
- package/internal/components/option/interfaces.d.ts.map +1 -1
- package/internal/components/option/interfaces.js.map +1 -1
- package/internal/components/option/option-parts.d.ts +3 -1
- package/internal/components/option/option-parts.d.ts.map +1 -1
- package/internal/components/option/option-parts.js +1 -1
- package/internal/components/option/option-parts.js.map +1 -1
- package/internal/components/option/styles.css.js +18 -17
- package/internal/components/option/styles.scoped.css +52 -29
- package/internal/components/option/styles.selectors.js +18 -17
- package/internal/components/radio-button/styles.css.js +7 -7
- package/internal/components/radio-button/styles.scoped.css +27 -29
- package/internal/components/radio-button/styles.selectors.js +7 -7
- package/internal/context/control-group-context.d.ts +7 -0
- package/internal/context/control-group-context.d.ts.map +1 -1
- package/internal/context/control-group-context.js +4 -1
- package/internal/context/control-group-context.js.map +1 -1
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/generated/styles/tokens.d.ts +1 -0
- package/internal/generated/styles/tokens.js +1 -0
- package/internal/generated/theming/index.cjs +31 -0
- package/internal/generated/theming/index.js +31 -0
- package/internal/manifest.json +1 -1
- package/link/styles.css.js +21 -21
- package/link/styles.scoped.css +133 -145
- package/link/styles.selectors.js +21 -21
- package/manifest.json +2 -2
- package/multiselect/use-multiselect.d.ts.map +1 -1
- package/multiselect/use-multiselect.js +3 -3
- package/multiselect/use-multiselect.js.map +1 -1
- package/package.json +1 -1
- package/prompt-input/components/menu-dropdown.js +1 -1
- package/prompt-input/components/menu-dropdown.js.map +1 -1
- package/radio-button/styles.css.js +1 -1
- package/radio-button/styles.scoped.css +5 -13
- package/radio-button/styles.selectors.js +1 -1
- package/segmented-control/internal-segmented-control.js +2 -2
- package/segmented-control/internal-segmented-control.js.map +1 -1
- package/segmented-control/internal.js +1 -1
- package/segmented-control/internal.js.map +1 -1
- package/segmented-control/styles.css.js +31 -27
- package/segmented-control/styles.scoped.css +136 -49
- package/segmented-control/styles.selectors.js +31 -27
- package/select/internal.d.ts.map +1 -1
- package/select/internal.js +2 -2
- package/select/internal.js.map +1 -1
- package/select/parts/filter.d.ts +1 -1
- package/select/parts/filter.d.ts.map +1 -1
- package/select/parts/plain-list.d.ts.map +1 -1
- package/select/parts/plain-list.js +3 -3
- package/select/parts/plain-list.js.map +1 -1
- package/select/parts/virtual-list.js +3 -3
- package/select/parts/virtual-list.js.map +1 -1
- package/select/utils/use-select.d.ts.map +1 -1
- package/select/utils/use-select.js +1 -1
- package/select/utils/use-select.js.map +1 -1
- package/side-navigation/interfaces.d.ts +6 -0
- package/side-navigation/interfaces.d.ts.map +1 -1
- package/side-navigation/interfaces.js.map +1 -1
- package/side-navigation/parts.js +14 -4
- package/side-navigation/parts.js.map +1 -1
- package/side-navigation/styles.css.js +65 -64
- package/side-navigation/styles.scoped.css +119 -111
- package/side-navigation/styles.selectors.js +65 -64
- package/styling/alert.scss +68 -0
- package/styling/badge.scss +55 -0
- package/styling/button.scss +59 -0
- package/styling/checkbox.scss +23 -0
- package/styling/dropdown.scss +31 -0
- package/styling/input.scss +106 -0
- package/styling/link.scss +29 -0
- package/styling/radio-button.scss +23 -0
- package/styling/toggle.scss +21 -0
- package/toggle/internal.d.ts +0 -2
- package/toggle/internal.d.ts.map +1 -1
- package/toggle/internal.js +1 -1
- package/toggle/internal.js.map +1 -1
- package/toggle/styles.css.js +10 -10
- package/toggle/styles.scoped.css +38 -50
- package/toggle/styles.selectors.js +10 -10
- package/token/interfaces.d.ts +9 -6
- package/token/interfaces.d.ts.map +1 -1
- package/token/interfaces.js.map +1 -1
- package/token/internal.d.ts.map +1 -1
- package/token/internal.js +22 -17
- package/token/internal.js.map +1 -1
- package/token/styles.css.js +14 -14
- package/token/styles.scoped.css +28 -27
- package/token/styles.selectors.js +14 -14
- package/select/parts/common.d.ts.map +0 -1
- package/select/parts/common.js.map +0 -1
- package/select/parts/option-group.d.ts.map +0 -1
- package/select/parts/option-group.js.map +0 -1
- package/select/utils/check-option-value-field.d.ts.map +0 -1
- package/select/utils/check-option-value-field.js.map +0 -1
- package/select/utils/connect-options.d.ts.map +0 -1
- package/select/utils/connect-options.js.map +0 -1
- package/select/utils/get-item-props.d.ts.map +0 -1
- package/select/utils/get-item-props.js.map +0 -1
- package/select/utils/render-options.d.ts.map +0 -1
- package/select/utils/render-options.js.map +0 -1
- package/select/utils/scroll-to-index.d.ts.map +0 -1
- package/select/utils/scroll-to-index.js.map +0 -1
- package/select/utils/use-announcement.d.ts.map +0 -1
- package/select/utils/use-announcement.js.map +0 -1
- /package/{select → internal/components/listbox}/parts/common.d.ts +0 -0
- /package/{select → internal/components/listbox}/parts/common.js +0 -0
- /package/{select → internal/components/listbox}/parts/option-group.d.ts +0 -0
- /package/{select/utils → internal/components/listbox/parts}/scroll-to-index.d.ts +0 -0
- /package/{select/utils → internal/components/listbox/parts}/scroll-to-index.js +0 -0
- /package/{select → internal/components/listbox}/utils/check-option-value-field.d.ts +0 -0
- /package/{select → internal/components/listbox}/utils/connect-options.js +0 -0
|
@@ -6,13 +6,23 @@ import { useUniqueId } from '@cloudscape-design/component-toolkit/internal';
|
|
|
6
6
|
import { InternalButton } from '../../../button/internal';
|
|
7
7
|
import { getBaseProps } from '../../base-component';
|
|
8
8
|
import { GroupedControlContext, } from '../../context/control-group-context';
|
|
9
|
+
import { FormFieldContext, useFormFieldContext } from '../../context/form-field-context';
|
|
9
10
|
import { useFitsInline } from '../../hooks/use-fits-inline';
|
|
10
11
|
import { flattenChildren } from '../../utils/flatten-children';
|
|
12
|
+
import { joinStrings } from '../../utils/strings/join-strings';
|
|
11
13
|
import styles from './styles.css.js';
|
|
12
14
|
import testUtilStyles from './test-classes/styles.css.js';
|
|
13
15
|
export default function ControlGroup({ children, direction = 'auto', inlineLabelText, actionButton, ...props }) {
|
|
14
16
|
const baseProps = getBaseProps(props);
|
|
15
17
|
const labelId = useUniqueId('control-group-label');
|
|
18
|
+
const formFieldContext = useFormFieldContext({});
|
|
19
|
+
const isInvalid = !!formFieldContext.invalid;
|
|
20
|
+
const isWarning = !!formFieldContext.warning && !isInvalid;
|
|
21
|
+
// The parent FormField's validation (describedby/invalid) and label associate with the group as a
|
|
22
|
+
// unit, not the inner controls (whose FormField context is reset below).
|
|
23
|
+
// Merge FormField's label id (first) with the internal inline label when present.
|
|
24
|
+
const groupAriaLabelledby = joinStrings(formFieldContext.ariaLabelledby, inlineLabelText ? labelId : undefined);
|
|
25
|
+
const groupAriaDescribedby = joinStrings(formFieldContext.ariaDescribedby);
|
|
16
26
|
const flattenedChildren = flattenChildren(children, 'ControlGroup');
|
|
17
27
|
const controlCount = flattenedChildren.length;
|
|
18
28
|
const { fits, ghostRef, sensorRef } = useFitsInline();
|
|
@@ -25,10 +35,17 @@ export default function ControlGroup({ children, direction = 'auto', inlineLabel
|
|
|
25
35
|
return flattenedChildren.map((child, index) => {
|
|
26
36
|
const key = child && typeof child === 'object' ? child.key : undefined;
|
|
27
37
|
const position = controlCount === 1 ? 'only' : index === 0 ? 'first' : index === controlCount - 1 ? 'last' : 'middle';
|
|
38
|
+
const isLeading = slotDirection === 'vertical' || position === 'first' || position === 'only';
|
|
28
39
|
return (React.createElement("div", { key: key !== null && key !== undefined ? String(key) : index, className: clsx(
|
|
29
40
|
// Make sure that test utils exclude the ghost
|
|
30
|
-
!isGhost && testUtilStyles.control, styles.control, styles[`control-${position}-${slotDirection}`]) },
|
|
31
|
-
React.createElement(GroupedControlContext.Provider, { value: {
|
|
41
|
+
!isGhost && testUtilStyles.control, styles.control, styles[`control-${position}-${slotDirection}`], isLeading && (isInvalid || isWarning) && styles['control-validation'], isLeading && isInvalid && styles['control-in-error'], isLeading && isWarning && styles['control-in-warning']) },
|
|
42
|
+
React.createElement(GroupedControlContext.Provider, { value: {
|
|
43
|
+
position,
|
|
44
|
+
direction: slotDirection,
|
|
45
|
+
hasAction: !!actionButton,
|
|
46
|
+
validation: isInvalid ? 'error' : isWarning ? 'warning' : null,
|
|
47
|
+
} },
|
|
48
|
+
React.createElement(FormFieldContext.Provider, { value: {} }, child))));
|
|
32
49
|
});
|
|
33
50
|
};
|
|
34
51
|
const renderActionButton = (isGhost) => actionButton ? (React.createElement("div", { className: styles['action-slot'] },
|
|
@@ -39,11 +56,18 @@ export default function ControlGroup({ children, direction = 'auto', inlineLabel
|
|
|
39
56
|
className: isGhost ? undefined : testUtilStyles['action-button'], variant: "control-group-action", formAction: "none", iconName: actionButton.iconName, ariaLabel: actionButton.ariaLabel, disabled: actionButton.disabled, disabledReason: actionButton.disabledReason, ariaDescribedby: actionButton.ariaDescribedby, onClick: actionButton.onClick }))) : null;
|
|
40
57
|
// A single render path for both the real group layout and the ghost copy, so the ghost measures
|
|
41
58
|
// the whole group (controls + action button, including the overlap seam between them) as one unit.
|
|
42
|
-
// The ghost copy carries no role, no aria
|
|
59
|
+
// The ghost copy carries no role, no aria wiring, no base props, and no test-util classes.
|
|
43
60
|
const renderGroupLayout = (isGhost) => {
|
|
44
61
|
const slotDirection = isGhost ? 'horizontal' : resolvedDirection;
|
|
45
62
|
return (React.createElement("div", { className: clsx(styles['group-layout'], styles[`group-layout-${slotDirection}`]) },
|
|
46
|
-
React.createElement("div", { ...(isGhost
|
|
63
|
+
React.createElement("div", { ...(isGhost
|
|
64
|
+
? {}
|
|
65
|
+
: {
|
|
66
|
+
role: 'group',
|
|
67
|
+
'aria-labelledby': groupAriaLabelledby,
|
|
68
|
+
'aria-describedby': groupAriaDescribedby,
|
|
69
|
+
'aria-invalid': isInvalid ? 'true' : undefined,
|
|
70
|
+
}), className: clsx(styles.controls, styles[`controls-${slotDirection}`]) }, renderControlSlots(isGhost)),
|
|
47
71
|
renderActionButton(isGhost)));
|
|
48
72
|
};
|
|
49
73
|
const groupLayoutWrapper = (React.createElement("div", { ...(inlineLabelText ? {} : baseProps), className: clsx(styles['group-layout-wrapper'], !inlineLabelText && rootClassnames) },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/control-group/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,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AM,CAAC,MAAM,iBAAc,MAAM,GAAG;YACpE,6BAAK,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC;gBACpC,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,KAAK,iBAAc,MAAM,IAC5D,iBAAiB,CAAC,IAAI,CAAC,CACpB,CACF,CACL,CACJ,CACG,CACP,CAAC;IAEF,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,CACL,gCAAS,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,cAAc,EAAE,MAAM,CAAC,sBAAsB,CAAC,CAAC;YACpF,+BAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC,IACxF,eAAe,CACV;YACR,6BAAK,SAAS,EAAE,MAAM,CAAC,8BAA8B,CAAC,IAAG,kBAAkB,CAAO,CAC9E,CACP,CAAC;IACJ,CAAC;IAED,OAAO,kBAAkB,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';\nimport clsx from 'clsx';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport { InternalButton } from '../../../button/internal';\nimport { getBaseProps } from '../../base-component';\nimport {\n GroupedControlContext,\n GroupedControlDirection,\n GroupedControlPosition,\n} from '../../context/control-group-context';\nimport { useFitsInline } from '../../hooks/use-fits-inline';\nimport { flattenChildren } from '../../utils/flatten-children';\nimport { ControlGroupProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport { ControlGroupProps };\n\nexport default function ControlGroup({\n children,\n direction = 'auto',\n inlineLabelText,\n actionButton,\n ...props\n}: ControlGroupProps) {\n const baseProps = getBaseProps(props);\n const labelId = useUniqueId('control-group-label');\n\n const flattenedChildren = flattenChildren(children, 'ControlGroup');\n const controlCount = flattenedChildren.length;\n\n const { fits, ghostRef, sensorRef } = useFitsInline<HTMLDivElement>();\n const resolvedDirection: GroupedControlDirection =\n direction === 'auto' ? (fits ? 'horizontal' : 'vertical') : direction;\n\n const rootClassnames = [styles.root, baseProps.className, testUtilStyles.root];\n\n const renderControlSlots = (isGhost: boolean) => {\n const slotDirection: GroupedControlDirection = isGhost\n ? 'horizontal' // The ghost always uses horizontal mode for measuring\n : resolvedDirection;\n return flattenedChildren.map((child, index) => {\n const key = child && typeof child === 'object' ? (child as Record<'key', unknown>).key : undefined;\n const position: GroupedControlPosition =\n controlCount === 1 ? 'only' : index === 0 ? 'first' : index === controlCount - 1 ? 'last' : 'middle';\n return (\n <div\n key={key !== null && key !== undefined ? String(key) : index}\n className={clsx(\n // Make sure that test utils exclude the ghost\n !isGhost && testUtilStyles.control,\n styles.control,\n styles[`control-${position}-${slotDirection}`]\n )}\n >\n <GroupedControlContext.Provider value={{ position, direction: slotDirection, hasAction: !!actionButton }}>\n {child}\n </GroupedControlContext.Provider>\n </div>\n );\n });\n };\n\n const renderActionButton = (isGhost: boolean) =>\n actionButton ? (\n <div className={styles['action-slot']}>\n <InternalButton\n // Make sure that test utils exclude the ghost\n className={isGhost ? undefined : testUtilStyles['action-button']}\n variant=\"control-group-action\"\n formAction=\"none\"\n iconName={actionButton.iconName}\n ariaLabel={actionButton.ariaLabel}\n disabled={actionButton.disabled}\n disabledReason={actionButton.disabledReason}\n ariaDescribedby={actionButton.ariaDescribedby}\n onClick={actionButton.onClick}\n />\n </div>\n ) : null;\n\n // A single render path for both the real group layout and the ghost copy, so the ghost measures\n // the whole group (controls + action button, including the overlap seam between them) as one unit.\n // The ghost copy carries no role, no aria-labelledby, no base props, and no test-util classes.\n const renderGroupLayout = (isGhost: boolean) => {\n const slotDirection: GroupedControlDirection = isGhost ? 'horizontal' : resolvedDirection;\n return (\n <div className={clsx(styles['group-layout'], styles[`group-layout-${slotDirection}`])}>\n <div\n {...(isGhost ? {} : inlineLabelText ? { role: 'group', 'aria-labelledby': labelId } : { role: 'group' })}\n className={clsx(styles.controls, styles[`controls-${slotDirection}`])}\n >\n {renderControlSlots(isGhost)}\n </div>\n {renderActionButton(isGhost)}\n </div>\n );\n };\n\n const groupLayoutWrapper = (\n <div\n {...(inlineLabelText ? {} : baseProps)}\n className={clsx(styles['group-layout-wrapper'], !inlineLabelText && rootClassnames)}\n >\n {renderGroupLayout(false)}\n\n {direction === 'auto' && (\n <>\n <div ref={sensorRef} className={styles.sensor} aria-hidden=\"true\" />\n <div className={styles['ghost-anchor']}>\n <div ref={ghostRef} className={styles.ghost} aria-hidden=\"true\">\n {renderGroupLayout(true)}\n </div>\n </div>\n </>\n )}\n </div>\n );\n\n if (inlineLabelText) {\n return (\n <div {...baseProps} className={clsx(...rootClassnames, styles['inline-label-wrapper'])}>\n <label id={labelId} className={clsx(styles['inline-label'], testUtilStyles['inline-label'])}>\n {inlineLabelText}\n </label>\n <div className={styles['inline-label-trigger-wrapper']}>{groupLayoutWrapper}</div>\n </div>\n );\n }\n\n return groupLayoutWrapper;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/control-group/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EACL,qBAAqB,GAGtB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MA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sBAAsB,CAAC,CAAC;YACpF,+BAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC,IACxF,eAAe,CACV;YACR,6BAAK,SAAS,EAAE,MAAM,CAAC,8BAA8B,CAAC,IAAG,kBAAkB,CAAO,CAC9E,CACP,CAAC;IACJ,CAAC;IAED,OAAO,kBAAkB,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';\nimport clsx from 'clsx';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport { InternalButton } from '../../../button/internal';\nimport { getBaseProps } from '../../base-component';\nimport {\n GroupedControlContext,\n GroupedControlDirection,\n GroupedControlPosition,\n} from '../../context/control-group-context';\nimport { FormFieldContext, useFormFieldContext } from '../../context/form-field-context';\nimport { useFitsInline } from '../../hooks/use-fits-inline';\nimport { flattenChildren } from '../../utils/flatten-children';\nimport { joinStrings } from '../../utils/strings/join-strings';\nimport { ControlGroupProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport { ControlGroupProps };\n\nexport default function ControlGroup({\n children,\n direction = 'auto',\n inlineLabelText,\n actionButton,\n ...props\n}: ControlGroupProps) {\n const baseProps = getBaseProps(props);\n const labelId = useUniqueId('control-group-label');\n\n const formFieldContext = useFormFieldContext({});\n const isInvalid = !!formFieldContext.invalid;\n const isWarning = !!formFieldContext.warning && !isInvalid;\n\n // The parent FormField's validation (describedby/invalid) and label associate with the group as a\n // unit, not the inner controls (whose FormField context is reset below).\n // Merge FormField's label id (first) with the internal inline label when present.\n const groupAriaLabelledby = joinStrings(formFieldContext.ariaLabelledby, inlineLabelText ? labelId : undefined);\n const groupAriaDescribedby = joinStrings(formFieldContext.ariaDescribedby);\n\n const flattenedChildren = flattenChildren(children, 'ControlGroup');\n const controlCount = flattenedChildren.length;\n\n const { fits, ghostRef, sensorRef } = useFitsInline<HTMLDivElement>();\n const resolvedDirection: GroupedControlDirection =\n direction === 'auto' ? (fits ? 'horizontal' : 'vertical') : direction;\n\n const rootClassnames = [styles.root, baseProps.className, testUtilStyles.root];\n\n const renderControlSlots = (isGhost: boolean) => {\n const slotDirection: GroupedControlDirection = isGhost\n ? 'horizontal' // The ghost always uses horizontal mode for measuring\n : resolvedDirection;\n return flattenedChildren.map((child, index) => {\n const key = child && typeof child === 'object' ? (child as Record<'key', unknown>).key : undefined;\n const position: GroupedControlPosition =\n controlCount === 1 ? 'only' : index === 0 ? 'first' : index === controlCount - 1 ? 'last' : 'middle';\n const isLeading = slotDirection === 'vertical' || position === 'first' || position === 'only';\n return (\n <div\n key={key !== null && key !== undefined ? String(key) : index}\n className={clsx(\n // Make sure that test utils exclude the ghost\n !isGhost && testUtilStyles.control,\n styles.control,\n styles[`control-${position}-${slotDirection}`],\n isLeading && (isInvalid || isWarning) && styles['control-validation'],\n isLeading && isInvalid && styles['control-in-error'],\n isLeading && isWarning && styles['control-in-warning']\n )}\n >\n <GroupedControlContext.Provider\n value={{\n position,\n direction: slotDirection,\n hasAction: !!actionButton,\n validation: isInvalid ? 'error' : isWarning ? 'warning' : null,\n }}\n >\n <FormFieldContext.Provider value={{}}>{child}</FormFieldContext.Provider>\n </GroupedControlContext.Provider>\n </div>\n );\n });\n };\n\n const renderActionButton = (isGhost: boolean) =>\n actionButton ? (\n <div className={styles['action-slot']}>\n <InternalButton\n // Make sure that test utils exclude the ghost\n className={isGhost ? undefined : testUtilStyles['action-button']}\n variant=\"control-group-action\"\n formAction=\"none\"\n iconName={actionButton.iconName}\n ariaLabel={actionButton.ariaLabel}\n disabled={actionButton.disabled}\n disabledReason={actionButton.disabledReason}\n ariaDescribedby={actionButton.ariaDescribedby}\n onClick={actionButton.onClick}\n />\n </div>\n ) : null;\n\n // A single render path for both the real group layout and the ghost copy, so the ghost measures\n // the whole group (controls + action button, including the overlap seam between them) as one unit.\n // The ghost copy carries no role, no aria wiring, no base props, and no test-util classes.\n const renderGroupLayout = (isGhost: boolean) => {\n const slotDirection: GroupedControlDirection = isGhost ? 'horizontal' : resolvedDirection;\n return (\n <div className={clsx(styles['group-layout'], styles[`group-layout-${slotDirection}`])}>\n <div\n {...(isGhost\n ? {}\n : {\n role: 'group',\n 'aria-labelledby': groupAriaLabelledby,\n 'aria-describedby': groupAriaDescribedby,\n 'aria-invalid': isInvalid ? 'true' : undefined,\n })}\n className={clsx(styles.controls, styles[`controls-${slotDirection}`])}\n >\n {renderControlSlots(isGhost)}\n </div>\n {renderActionButton(isGhost)}\n </div>\n );\n };\n\n const groupLayoutWrapper = (\n <div\n {...(inlineLabelText ? {} : baseProps)}\n className={clsx(styles['group-layout-wrapper'], !inlineLabelText && rootClassnames)}\n >\n {renderGroupLayout(false)}\n\n {direction === 'auto' && (\n <>\n <div ref={sensorRef} className={styles.sensor} aria-hidden=\"true\" />\n <div className={styles['ghost-anchor']}>\n <div ref={ghostRef} className={styles.ghost} aria-hidden=\"true\">\n {renderGroupLayout(true)}\n </div>\n </div>\n </>\n )}\n </div>\n );\n\n if (inlineLabelText) {\n return (\n <div {...baseProps} className={clsx(...rootClassnames, styles['inline-label-wrapper'])}>\n <label id={labelId} className={clsx(styles['inline-label'], testUtilStyles['inline-label'])}>\n {inlineLabelText}\n </label>\n <div className={styles['inline-label-trigger-wrapper']}>{groupLayoutWrapper}</div>\n </div>\n );\n }\n\n return groupLayoutWrapper;\n}\n"]}
|
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"group-layout-wrapper": "awsui_group-layout-
|
|
6
|
-
"action-slot": "awsui_action-
|
|
7
|
-
"group-layout": "awsui_group-
|
|
8
|
-
"group-layout-horizontal": "awsui_group-layout-
|
|
9
|
-
"group-layout-vertical": "awsui_group-layout-
|
|
10
|
-
"controls": "
|
|
11
|
-
"controls-horizontal": "awsui_controls-
|
|
12
|
-
"controls-vertical": "awsui_controls-
|
|
13
|
-
"control": "
|
|
14
|
-
"control-middle-horizontal": "awsui_control-middle-
|
|
15
|
-
"control-last-horizontal": "awsui_control-last-
|
|
16
|
-
"control-middle-vertical": "awsui_control-middle-
|
|
17
|
-
"control-last-vertical": "awsui_control-last-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
4
|
+
"root": "awsui_root_o08jm_15663_9",
|
|
5
|
+
"group-layout-wrapper": "awsui_group-layout-wrapper_o08jm_15663_41",
|
|
6
|
+
"action-slot": "awsui_action-slot_o08jm_15663_45",
|
|
7
|
+
"group-layout": "awsui_group-layout_o08jm_15663_41",
|
|
8
|
+
"group-layout-horizontal": "awsui_group-layout-horizontal_o08jm_15663_55",
|
|
9
|
+
"group-layout-vertical": "awsui_group-layout-vertical_o08jm_15663_58",
|
|
10
|
+
"controls": "awsui_controls_o08jm_15663_62",
|
|
11
|
+
"controls-horizontal": "awsui_controls-horizontal_o08jm_15663_67",
|
|
12
|
+
"controls-vertical": "awsui_controls-vertical_o08jm_15663_73",
|
|
13
|
+
"control": "awsui_control_o08jm_15663_62",
|
|
14
|
+
"control-middle-horizontal": "awsui_control-middle-horizontal_o08jm_15663_82",
|
|
15
|
+
"control-last-horizontal": "awsui_control-last-horizontal_o08jm_15663_82",
|
|
16
|
+
"control-middle-vertical": "awsui_control-middle-vertical_o08jm_15663_85",
|
|
17
|
+
"control-last-vertical": "awsui_control-last-vertical_o08jm_15663_85",
|
|
18
|
+
"control-validation": "awsui_control-validation_o08jm_15663_88",
|
|
19
|
+
"control-in-error": "awsui_control-in-error_o08jm_15663_102",
|
|
20
|
+
"control-in-warning": "awsui_control-in-warning_o08jm_15663_105",
|
|
21
|
+
"control-first-horizontal": "awsui_control-first-horizontal_o08jm_15663_108",
|
|
22
|
+
"control-only-horizontal": "awsui_control-only-horizontal_o08jm_15663_108",
|
|
23
|
+
"control-only-vertical": "awsui_control-only-vertical_o08jm_15663_108",
|
|
24
|
+
"control-first-vertical": "awsui_control-first-vertical_o08jm_15663_112",
|
|
25
|
+
"sensor": "awsui_sensor_o08jm_15663_124",
|
|
26
|
+
"ghost-anchor": "awsui_ghost-anchor_o08jm_15663_136",
|
|
27
|
+
"inline-label": "awsui_inline-label_o08jm_15663_141",
|
|
28
|
+
"inline-label-wrapper": "awsui_inline-label-wrapper_o08jm_15663_166",
|
|
29
|
+
"inline-label-trigger-wrapper": "awsui_inline-label-trigger-wrapper_o08jm_15663_171",
|
|
30
|
+
"ghost": "awsui_ghost_o08jm_15663_136"
|
|
24
31
|
};
|
|
25
32
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
|
|
7
7
|
/* Style used for links in slots/components that are text heavy, to help links stand out among
|
|
8
8
|
surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
|
|
9
|
-
.
|
|
9
|
+
.awsui_root_o08jm_15663_9:not(#\9) {
|
|
10
10
|
border-collapse: separate;
|
|
11
11
|
border-spacing: 0;
|
|
12
12
|
box-sizing: border-box;
|
|
@@ -38,59 +38,90 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
38
38
|
-moz-osx-font-smoothing: auto;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
.awsui_group-layout-
|
|
41
|
+
.awsui_group-layout-wrapper_o08jm_15663_41:not(#\9) {
|
|
42
42
|
position: static;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
.awsui_action-
|
|
45
|
+
.awsui_action-slot_o08jm_15663_45:not(#\9) {
|
|
46
46
|
display: flex;
|
|
47
47
|
margin-inline-start: calc(-1 * var(--border-width-field-f7slp9, 1px));
|
|
48
48
|
flex-shrink: 0;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
.awsui_group-
|
|
51
|
+
.awsui_group-layout_o08jm_15663_41:not(#\9) {
|
|
52
52
|
display: flex;
|
|
53
53
|
flex-direction: row;
|
|
54
54
|
}
|
|
55
|
-
.awsui_group-layout-
|
|
55
|
+
.awsui_group-layout-horizontal_o08jm_15663_55:not(#\9) {
|
|
56
56
|
align-items: flex-end;
|
|
57
57
|
}
|
|
58
|
-
.awsui_group-layout-
|
|
58
|
+
.awsui_group-layout-vertical_o08jm_15663_58:not(#\9), .awsui_group-layout-vertical_o08jm_15663_58 > .awsui_action-slot_o08jm_15663_45:not(#\9) {
|
|
59
59
|
align-items: stretch;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
.
|
|
62
|
+
.awsui_controls_o08jm_15663_62:not(#\9) {
|
|
63
63
|
display: flex;
|
|
64
64
|
align-items: stretch;
|
|
65
|
+
z-index: 1;
|
|
65
66
|
}
|
|
66
|
-
.awsui_controls-
|
|
67
|
+
.awsui_controls-horizontal_o08jm_15663_67:not(#\9) {
|
|
67
68
|
flex-direction: row;
|
|
68
69
|
flex-wrap: nowrap;
|
|
69
70
|
min-inline-size: 0;
|
|
70
71
|
flex-shrink: 1;
|
|
71
72
|
}
|
|
72
|
-
.awsui_controls-
|
|
73
|
+
.awsui_controls-vertical_o08jm_15663_73:not(#\9) {
|
|
73
74
|
flex-direction: column;
|
|
74
75
|
flex-grow: 1;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
.
|
|
78
|
+
.awsui_control_o08jm_15663_62:not(#\9) {
|
|
78
79
|
min-inline-size: 0;
|
|
79
80
|
isolation: isolate;
|
|
80
81
|
}
|
|
81
|
-
.awsui_control-middle-
|
|
82
|
+
.awsui_control-middle-horizontal_o08jm_15663_82:not(#\9), .awsui_control-last-horizontal_o08jm_15663_82:not(#\9) {
|
|
82
83
|
margin-inline-start: calc(-1 * var(--border-width-field-f7slp9, 1px));
|
|
83
84
|
}
|
|
84
|
-
.awsui_control-middle-
|
|
85
|
+
.awsui_control-middle-vertical_o08jm_15663_85:not(#\9), .awsui_control-last-vertical_o08jm_15663_85:not(#\9) {
|
|
85
86
|
margin-block-start: calc(-1 * var(--border-width-field-f7slp9, 1px));
|
|
86
87
|
}
|
|
88
|
+
.awsui_control-validation_o08jm_15663_88:not(#\9) {
|
|
89
|
+
position: relative;
|
|
90
|
+
}
|
|
91
|
+
.awsui_control-validation_o08jm_15663_88:not(#\9)::before {
|
|
92
|
+
content: "";
|
|
93
|
+
position: absolute;
|
|
94
|
+
inset-block: 0;
|
|
95
|
+
inset-inline-start: 0;
|
|
96
|
+
box-sizing: border-box;
|
|
97
|
+
border-inline-start-style: solid;
|
|
98
|
+
border-inline-start-width: var(--border-invalid-width-gifxpw, 8px);
|
|
99
|
+
z-index: 1;
|
|
100
|
+
pointer-events: none;
|
|
101
|
+
}
|
|
102
|
+
.awsui_control-validation_o08jm_15663_88.awsui_control-in-error_o08jm_15663_102:not(#\9)::before {
|
|
103
|
+
border-inline-start-color: var(--color-text-status-error-5dgk9e, #db0000);
|
|
104
|
+
}
|
|
105
|
+
.awsui_control-validation_o08jm_15663_88.awsui_control-in-warning_o08jm_15663_105:not(#\9)::before {
|
|
106
|
+
border-inline-start-color: var(--color-text-status-warning-r365u3, #855900);
|
|
107
|
+
}
|
|
108
|
+
.awsui_control-validation_o08jm_15663_88.awsui_control-first-horizontal_o08jm_15663_108:not(#\9)::before, .awsui_control-validation_o08jm_15663_88.awsui_control-only-horizontal_o08jm_15663_108:not(#\9)::before, .awsui_control-validation_o08jm_15663_88.awsui_control-only-vertical_o08jm_15663_108:not(#\9)::before {
|
|
109
|
+
border-start-start-radius: var(--border-radius-input-kb6rx2, 8px);
|
|
110
|
+
border-end-start-radius: var(--border-radius-input-kb6rx2, 8px);
|
|
111
|
+
}
|
|
112
|
+
.awsui_control-validation_o08jm_15663_88.awsui_control-first-vertical_o08jm_15663_112:not(#\9)::before {
|
|
113
|
+
border-start-start-radius: var(--border-radius-input-kb6rx2, 8px);
|
|
114
|
+
}
|
|
115
|
+
.awsui_control-validation_o08jm_15663_88.awsui_control-last-vertical_o08jm_15663_85:not(#\9)::before {
|
|
116
|
+
border-end-start-radius: var(--border-radius-input-kb6rx2, 8px);
|
|
117
|
+
}
|
|
87
118
|
|
|
88
|
-
.awsui_action-
|
|
89
|
-
.
|
|
119
|
+
.awsui_action-slot_o08jm_15663_45:not(#\9):focus-within,
|
|
120
|
+
.awsui_control_o08jm_15663_62:not(#\9):focus-within {
|
|
90
121
|
z-index: 1;
|
|
91
122
|
}
|
|
92
123
|
|
|
93
|
-
.
|
|
124
|
+
.awsui_sensor_o08jm_15663_124:not(#\9) {
|
|
94
125
|
position: absolute;
|
|
95
126
|
inset-block-start: 0;
|
|
96
127
|
inset-inline-start: 0;
|
|
@@ -102,12 +133,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
102
133
|
min-inline-size: 0;
|
|
103
134
|
}
|
|
104
135
|
|
|
105
|
-
.awsui_ghost-
|
|
136
|
+
.awsui_ghost-anchor_o08jm_15663_136:not(#\9) {
|
|
106
137
|
position: relative;
|
|
107
138
|
block-size: 0;
|
|
108
139
|
}
|
|
109
140
|
|
|
110
|
-
.awsui_inline-
|
|
141
|
+
.awsui_inline-label_o08jm_15663_141:not(#\9) {
|
|
111
142
|
background: linear-gradient(to bottom, var(--awsui-inline-label-background-color-ka4djm, var(--color-background-layout-main-lursna, #ffffff)), var(--color-background-input-default-dfjnbd, #ffffff));
|
|
112
143
|
border-start-start-radius: 2px;
|
|
113
144
|
border-start-end-radius: 2px;
|
|
@@ -132,16 +163,16 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
132
163
|
z-index: 2;
|
|
133
164
|
}
|
|
134
165
|
|
|
135
|
-
.awsui_inline-label-
|
|
166
|
+
.awsui_inline-label-wrapper_o08jm_15663_166:not(#\9) {
|
|
136
167
|
margin-block-start: calc(var(--space-scaled-xs-65ylh6, 8px) * -1);
|
|
137
168
|
isolation: isolate;
|
|
138
169
|
}
|
|
139
170
|
|
|
140
|
-
.awsui_inline-label-trigger-
|
|
171
|
+
.awsui_inline-label-trigger-wrapper_o08jm_15663_171:not(#\9) {
|
|
141
172
|
margin-block-start: -7px;
|
|
142
173
|
}
|
|
143
174
|
|
|
144
|
-
.
|
|
175
|
+
.awsui_ghost_o08jm_15663_136:not(#\9) {
|
|
145
176
|
position: absolute;
|
|
146
177
|
inset-block-start: 0;
|
|
147
178
|
inset-inline-start: 0;
|
|
@@ -2,25 +2,32 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"group-layout-wrapper": "awsui_group-layout-
|
|
7
|
-
"action-slot": "awsui_action-
|
|
8
|
-
"group-layout": "awsui_group-
|
|
9
|
-
"group-layout-horizontal": "awsui_group-layout-
|
|
10
|
-
"group-layout-vertical": "awsui_group-layout-
|
|
11
|
-
"controls": "
|
|
12
|
-
"controls-horizontal": "awsui_controls-
|
|
13
|
-
"controls-vertical": "awsui_controls-
|
|
14
|
-
"control": "
|
|
15
|
-
"control-middle-horizontal": "awsui_control-middle-
|
|
16
|
-
"control-last-horizontal": "awsui_control-last-
|
|
17
|
-
"control-middle-vertical": "awsui_control-middle-
|
|
18
|
-
"control-last-vertical": "awsui_control-last-
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
5
|
+
"root": "awsui_root_o08jm_15663_9",
|
|
6
|
+
"group-layout-wrapper": "awsui_group-layout-wrapper_o08jm_15663_41",
|
|
7
|
+
"action-slot": "awsui_action-slot_o08jm_15663_45",
|
|
8
|
+
"group-layout": "awsui_group-layout_o08jm_15663_41",
|
|
9
|
+
"group-layout-horizontal": "awsui_group-layout-horizontal_o08jm_15663_55",
|
|
10
|
+
"group-layout-vertical": "awsui_group-layout-vertical_o08jm_15663_58",
|
|
11
|
+
"controls": "awsui_controls_o08jm_15663_62",
|
|
12
|
+
"controls-horizontal": "awsui_controls-horizontal_o08jm_15663_67",
|
|
13
|
+
"controls-vertical": "awsui_controls-vertical_o08jm_15663_73",
|
|
14
|
+
"control": "awsui_control_o08jm_15663_62",
|
|
15
|
+
"control-middle-horizontal": "awsui_control-middle-horizontal_o08jm_15663_82",
|
|
16
|
+
"control-last-horizontal": "awsui_control-last-horizontal_o08jm_15663_82",
|
|
17
|
+
"control-middle-vertical": "awsui_control-middle-vertical_o08jm_15663_85",
|
|
18
|
+
"control-last-vertical": "awsui_control-last-vertical_o08jm_15663_85",
|
|
19
|
+
"control-validation": "awsui_control-validation_o08jm_15663_88",
|
|
20
|
+
"control-in-error": "awsui_control-in-error_o08jm_15663_102",
|
|
21
|
+
"control-in-warning": "awsui_control-in-warning_o08jm_15663_105",
|
|
22
|
+
"control-first-horizontal": "awsui_control-first-horizontal_o08jm_15663_108",
|
|
23
|
+
"control-only-horizontal": "awsui_control-only-horizontal_o08jm_15663_108",
|
|
24
|
+
"control-only-vertical": "awsui_control-only-vertical_o08jm_15663_108",
|
|
25
|
+
"control-first-vertical": "awsui_control-first-vertical_o08jm_15663_112",
|
|
26
|
+
"sensor": "awsui_sensor_o08jm_15663_124",
|
|
27
|
+
"ghost-anchor": "awsui_ghost-anchor_o08jm_15663_136",
|
|
28
|
+
"inline-label": "awsui_inline-label_o08jm_15663_141",
|
|
29
|
+
"inline-label-wrapper": "awsui_inline-label-wrapper_o08jm_15663_166",
|
|
30
|
+
"inline-label-trigger-wrapper": "awsui_inline-label-trigger-wrapper_o08jm_15663_171",
|
|
31
|
+
"ghost": "awsui_ghost_o08jm_15663_136"
|
|
25
32
|
};
|
|
26
33
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/listbox/parts/common.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../../src/internal/components/listbox/parts/common.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport const fallbackItemHeight = 31;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-item-props.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/listbox/parts/get-item-props.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,UAAU,SAAS;IACjB,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,GAAG,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,GAAI,+DAAuE,SAAS,QAW5G,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getTestOptionIndexes } from '../../
|
|
1
|
+
import { getTestOptionIndexes } from '../../options-list/utils/test-indexes';
|
|
2
2
|
export const getItemProps = ({ option, index, getOptionProps, filteringValue, checkboxes = false }) => {
|
|
3
3
|
const optionProps = getOptionProps(option, index);
|
|
4
4
|
optionProps.filteringValue = filteringValue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-item-props.js","sourceRoot":"","sources":["../../../../../../src/internal/components/listbox/parts/get-item-props.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAU7E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,GAAG,KAAK,EAAa,EAAE,EAAE;IAC/G,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAClD,WAAW,CAAC,cAAc,GAAG,cAAc,CAAC;IAC5C,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,oBAAoB,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACtF,OAAO;QACL,GAAG,WAAW;QACd,WAAW,EAAE,UAAU;QACvB,CAAC,kBAAkB,CAAC,EAAE,UAAU;QAChC,CAAC,kBAAkB,CAAC,EAAE,YAAY;QAClC,CAAC,iBAAiB,CAAC,EAAE,YAAY;KAClC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DropdownOption } from '../../option/interfaces';\nimport { getTestOptionIndexes } from '../../options-list/utils/test-indexes';\n\ninterface ItemProps {\n option: DropdownOption;\n index: number;\n getOptionProps: any;\n filteringValue: string;\n checkboxes: boolean;\n}\n\nexport const getItemProps = ({ option, index, getOptionProps, filteringValue, checkboxes = false }: ItemProps) => {\n const optionProps = getOptionProps(option, index);\n optionProps.filteringValue = filteringValue;\n const { inGroupIndex, groupIndex, throughIndex } = getTestOptionIndexes(option) || {};\n return {\n ...optionProps,\n hasCheckbox: checkboxes,\n ['data-group-index']: groupIndex,\n ['data-child-index']: inGroupIndex,\n ['data-test-index']: throughIndex,\n };\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-group.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/listbox/parts/option-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,gBAAgB;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,EAAE,gBAAgB,eAWxG"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import styles from '
|
|
5
|
+
import styles from '../../../../select/parts/styles.css.js';
|
|
6
6
|
export default function OptionGroup({ children, virtual, ariaLabelledby, ariaDisabled }) {
|
|
7
7
|
return (React.createElement("div", { role: "group", className: clsx(styles['option-group'], virtual && styles.virtual), "aria-labelledby": ariaLabelledby, "aria-disabled": ariaDisabled }, children));
|
|
8
8
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-group.js","sourceRoot":"","sources":["../../../../../../src/internal/components/listbox/parts/option-group.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,MAAM,MAAM,wCAAwC,CAAC;AAS5D,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAoB;IACvG,OAAO,CACL,6BACE,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,qBACjD,cAAc,mBAChB,YAAY,IAE1B,QAAQ,CACL,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport styles from '../../../../select/parts/styles.css.js';\n\ninterface OptionGroupProps {\n children: React.ReactNode;\n virtual: boolean;\n ariaLabelledby: string;\n ariaDisabled?: boolean;\n}\n\nexport default function OptionGroup({ children, virtual, ariaLabelledby, ariaDisabled }: OptionGroupProps) {\n return (\n <div\n role=\"group\"\n className={clsx(styles['option-group'], virtual && styles.virtual)}\n aria-labelledby={ariaLabelledby}\n aria-disabled={ariaDisabled}\n >\n {children}\n </div>\n );\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { VirtualItem } from '
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { MultiselectProps } from '../../../../multiselect/interfaces';
|
|
3
|
+
import { SelectProps } from '../../../../select/interfaces';
|
|
4
|
+
import { VirtualItem } from '../../../vendor/react-virtual';
|
|
5
|
+
import { DropdownOption } from '../../option/interfaces';
|
|
6
|
+
import { HighlightType } from '../../options-list/utils/use-highlight-option';
|
|
7
7
|
interface RenderOptionProps {
|
|
8
8
|
options: ReadonlyArray<DropdownOption>;
|
|
9
9
|
getOptionProps: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-options.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/listbox/parts/render-options.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAI9E,UAAU,iBAAiB;IACzB,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IACvC,cAAc,EAAE,GAAG,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC5C,YAAY,CAAC,EAAE,WAAW,CAAC,wBAAwB,GAAG,gBAAgB,CAAC,6BAA6B,CAAC;CACtG;AAED,eAAO,MAAM,aAAa,GAAI,6OAgB3B,iBAAiB,kBA8EnB,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import OptionGroup from '../parts/option-group';
|
|
4
|
+
import Item from '../../../../select/parts/item';
|
|
5
|
+
import MultiselectItem from '../../../../select/parts/multiselect-item';
|
|
6
|
+
import { unflattenOptions } from '../../option/utils/unflatten-options';
|
|
8
7
|
import { getItemProps } from './get-item-props';
|
|
8
|
+
import OptionGroup from './option-group';
|
|
9
9
|
export const renderOptions = ({ options, getOptionProps, filteringValue, highlightType, idPrefix, checkboxes = false, hasDropdownStatus, virtualItems, useInteractiveGroups, screenReaderContent, ariaSetsize, withScrollbar, firstOptionSticky, stickyOptionRef, renderOption, }) => {
|
|
10
10
|
const getNestedItemProps = ({ index, option }) => {
|
|
11
11
|
const virtualItem = virtualItems && virtualItems[index];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-options.js","sourceRoot":"","sources":["../../../../../../src/internal/components/listbox/parts/render-options.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,IAAyB,MAAM,+BAA+B,CAAC;AACtE,OAAO,eAA+C,MAAM,2CAA2C,CAAC;AAGxG,OAAO,EAAwB,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE9F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAoBzC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC5B,OAAO,EACP,cAAc,EACd,cAAc,EACd,aAAa,EACb,QAAQ,EACR,UAAU,GAAG,KAAK,EAClB,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,GACM,EAAE,EAAE;IACtB,MAAM,kBAAkB,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAwB,EAAE,EAAE;QACrE,MAAM,WAAW,GAAG,YAAY,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;QACxD,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QAC5D,OAAO,YAAY,CAAC;YAClB,MAAM;YACN,KAAK,EAAE,WAAW;YAClB,cAAc;YACd,cAAc,EAAE,MAAM,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc;YAClE,UAAU;SACX,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,CAAC,KAAU,EAA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AClB,CAAA;iBAAA,CAAC,CACU,CACf,CAAC;QACJ,CAAC;QAED,OAAO,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { MultiselectProps } from '../../../../multiselect/interfaces';\nimport { SelectProps } from '../../../../select/interfaces';\nimport Item, { ItemParentProps } from '../../../../select/parts/item';\nimport MultiselectItem, { MultiselectItemParentProps } from '../../../../select/parts/multiselect-item';\nimport { VirtualItem } from '../../../vendor/react-virtual';\nimport { DropdownOption } from '../../option/interfaces';\nimport { NestedDropdownOption, unflattenOptions } from '../../option/utils/unflatten-options';\nimport { HighlightType } from '../../options-list/utils/use-highlight-option';\nimport { getItemProps } from './get-item-props';\nimport OptionGroup from './option-group';\n\ninterface RenderOptionProps {\n options: ReadonlyArray<DropdownOption>;\n getOptionProps: any;\n filteringValue: string;\n highlightType: HighlightType;\n idPrefix: string;\n checkboxes?: boolean;\n hasDropdownStatus?: boolean;\n virtualItems?: VirtualItem[];\n useInteractiveGroups?: boolean;\n screenReaderContent?: string;\n ariaSetsize?: number;\n withScrollbar: boolean;\n firstOptionSticky?: boolean;\n stickyOptionRef?: React.Ref<HTMLDivElement>;\n renderOption?: SelectProps.SelectOptionItemRenderer | MultiselectProps.MultiselectOptionItemRenderer;\n}\n\nexport const renderOptions = ({\n options,\n getOptionProps,\n filteringValue,\n highlightType,\n idPrefix,\n checkboxes = false,\n hasDropdownStatus,\n virtualItems,\n useInteractiveGroups,\n screenReaderContent,\n ariaSetsize,\n withScrollbar,\n firstOptionSticky,\n stickyOptionRef,\n renderOption,\n}: RenderOptionProps) => {\n const getNestedItemProps = ({ index, option }: NestedDropdownOption) => {\n const virtualItem = virtualItems && virtualItems[index];\n const globalIndex = virtualItem ? virtualItem.index : index;\n return getItemProps({\n option,\n index: globalIndex,\n getOptionProps,\n filteringValue: option.type === 'select-all' ? '' : filteringValue,\n checkboxes,\n });\n };\n\n const renderListItem = (props: any, index: number, parentProps?: ItemParentProps | MultiselectItemParentProps) => {\n const virtualItem = virtualItems && virtualItems[index];\n const globalIndex = virtualItem ? virtualItem.index : index;\n\n const isLastItem = index === options.length - 1;\n const padBottom = !hasDropdownStatus && isLastItem;\n const ListItem = useInteractiveGroups ? MultiselectItem : Item;\n const isSticky = firstOptionSticky && globalIndex === 0;\n\n return (\n <ListItem\n index={index}\n virtualIndex={virtualItem ? virtualItem.index : undefined}\n key={globalIndex}\n {...props}\n virtualPosition={virtualItem?.start}\n ref={isSticky && stickyOptionRef ? stickyOptionRef : virtualItem && virtualItem.measureRef}\n padBottom={padBottom}\n screenReaderContent={screenReaderContent}\n ariaPosinset={globalIndex + 1}\n ariaSetsize={ariaSetsize}\n highlightType={highlightType.type}\n withScrollbar={withScrollbar}\n sticky={isSticky}\n renderOption={renderOption}\n parentProps={parentProps}\n />\n );\n };\n\n const unflattenedOptions = unflattenOptions(options);\n return unflattenedOptions.map(nestedDropdownOption => {\n const index = nestedDropdownOption.index;\n const props = getNestedItemProps(nestedDropdownOption);\n\n if (nestedDropdownOption.type === 'parent') {\n const { children } = nestedDropdownOption;\n const optionId = props.id ?? `${idPrefix}-option-${index}`;\n return (\n <OptionGroup\n key={`group-${index}`}\n virtual={virtualItems?.[index] !== undefined}\n ariaLabelledby={optionId}\n ariaDisabled={props['aria-disabled']}\n >\n {renderListItem(props, index)}\n {children.map(child => (\n <React.Fragment key={child.index}>\n {renderListItem(getNestedItemProps(child), child.index, {\n option: nestedDropdownOption.option,\n disabled: nestedDropdownOption.option.disabled ?? false,\n index: index,\n virtualIndex: virtualItems?.[index]?.index ?? undefined,\n highlighted: props.highlighted ?? false,\n selected: props.selected ?? false,\n indeterminate: props.indeterminate ?? false,\n })}\n </React.Fragment>\n ))}\n </OptionGroup>\n );\n }\n\n return renderListItem(props, index);\n });\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-to-index.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/listbox/parts/scroll-to-index.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,QAmBjF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-to-index.js","sourceRoot":"","sources":["../../../../../../src/internal/components/listbox/parts/scroll-to-index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,CAAC,OAAO,WAAW,EAAE,KAAK,EAAE,MAAM,EAA0C;IAChF,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa,CAAc,uBAAuB,KAAK,IAAI,CAAC,CAAC;IAEjF,IAAI,IAAI,EAAE,CAAC;QACT,uFAAuF;QACvF,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,IAAI,MAAM,CAAC,YAAY,GAAG,EAAE,EAAE,CAAC;YAClE,wFAAwF;YACxF,iGAAiG;YACjG,oEAAoE;YACpE,MAAM,QAAQ,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;YAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC9C,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;YACnE,IAAI,QAAQ,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,GAAG,MAAM,IAAI,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;gBACvF,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,GAAG,MAAM,EAAE,CAAC,CAAC;YACjE,CAAC;iBAAM,IAAI,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAC7C,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YAC9D,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport default function ({ index, menuEl }: { index: number; menuEl: HTMLElement }) {\n const item = menuEl.querySelector<HTMLElement>(`[data-mouse-target=\"${index}\"]`);\n\n if (item) {\n // In edge case dropdown can be very small, scrolling can cause side effect AWSUI-60318\n if (menuEl.clientHeight !== undefined && menuEl.clientHeight > 15) {\n // We only want the menu element to scroll, as scrolling any further parent elements can\n // cause the screen to jump, resulting in a select item being \"clicked\" while opening the select.\n // Therefore, we scroll manually rather than using `scrollIntoView`.\n const menuRect = menuEl.getBoundingClientRect();\n const itemRect = item.getBoundingClientRect();\n const offset = parseInt(menuEl.style.scrollPaddingBlockStart) || 0;\n if (itemRect.top < menuRect.top + offset || itemRect.height > menuRect.height - offset) {\n menuEl.scrollBy({ top: itemRect.top - menuRect.top - offset });\n } else if (itemRect.bottom > menuRect.bottom) {\n menuEl.scrollBy({ top: itemRect.bottom - menuRect.bottom });\n }\n }\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { SelectProps } from '../../../select/interfaces';
|
|
2
|
+
import { OptionDefinition, OptionGroup } from '../../../types/option';
|
|
3
3
|
interface OptionHolder {
|
|
4
4
|
option?: OptionDefinition | OptionGroup;
|
|
5
5
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-announcement.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/listbox/use-announcement.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGtE,UAAU,YAAY;IACpB,MAAM,CAAC,EAAE,gBAAgB,GAAG,WAAW,CAAC;CACzC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,SAAS,YAAY,EAAE,EAC3D,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,yBAAyB,GAC1B,EAAE;IACD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,SAAS,GAAG,WAAW,CAAC;IACvD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,yBAAyB,CAAC,EAAE,WAAW,CAAC,8BAA8B,CAAC;CACxE,UAuCA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { useEffect, useRef } from 'react';
|
|
4
|
-
import defaultOptionDescription from '
|
|
4
|
+
import defaultOptionDescription from '../option/option-announcer';
|
|
5
5
|
/**
|
|
6
6
|
* The hook produces the live region string to be announced when an option is highlighted.
|
|
7
7
|
* This is a workaround to account for the issues with assistive technologies.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-announcement.js","sourceRoot":"","sources":["../../../../../src/internal/components/listbox/use-announcement.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAMlE;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAA8B,EAC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E,CAAC,CAAC;IACnG,OAAO,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useEffect, useRef } from 'react';\n\nimport { SelectProps } from '../../../select/interfaces';\nimport { OptionDefinition, OptionGroup } from '../../../types/option';\nimport defaultOptionDescription from '../option/option-announcer';\n\ninterface OptionHolder {\n option?: OptionDefinition | OptionGroup;\n}\n\n/**\n * The hook produces the live region string to be announced when an option is highlighted.\n * This is a workaround to account for the issues with assistive technologies.\n *\n * If the testing reveals no issues with the native announcements the live-region can be removed.\n */\nexport function useAnnouncement<Option extends OptionHolder>({\n highlightText,\n announceSelected,\n highlightedOption,\n getParent,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n}: {\n highlightText?: string;\n announceSelected: boolean;\n highlightedOption?: Option;\n getParent: (option: Option) => undefined | OptionGroup;\n selectedAriaLabel?: string;\n renderHighlightedAriaLive?: SelectProps.ContainingOptionAndGroupString;\n}) {\n const prevAnnouncedGroup = useRef<OptionGroup | undefined>(undefined);\n\n // Record previously announced group with a delay to account for possible re-renders of the hook.\n useEffect(() => {\n if (highlightedOption) {\n const frameId = requestAnimationFrame(() => {\n prevAnnouncedGroup.current = getParent(highlightedOption);\n });\n return () => cancelAnimationFrame(frameId);\n }\n });\n\n if (!highlightedOption) {\n return '';\n }\n\n const option = highlightedOption.option as OptionDefinition;\n const parent = getParent(highlightedOption);\n // Only announce parent group if it wasn't announced with previous option.\n const group = parent && parent !== prevAnnouncedGroup.current ? parent : undefined;\n\n // Use custom renderer if provided.\n if (renderHighlightedAriaLive) {\n return renderHighlightedAriaLive(option, group);\n }\n\n // Use default renderer with selected ARIA label if defined and relevant.\n // Note: We intentionally keep selectedAriaLabel in the live region announcement even though\n // we now use proper ARIA attributes (aria-selected, aria-checked, aria-multiselectable).\n // This is because NVDA and older versions of JAWS (e.g., 2022, still commonly used) have bugs\n // where they don't properly announce the selected state from ARIA attributes alone.\n // For newer screen readers (modern JAWS, VoiceOver), this results in redundant \"Selected\"\n // announcements, but this is preferable to the alternative where users hear \"Selected\"\n // followed by \"Not Selected\" due to missing ARIA attribute support.\n // See AWSUI-61639 for details.\n const selectedAnnouncement = announceSelected && selectedAriaLabel ? selectedAriaLabel : '';\n const defaultDescription = defaultOptionDescription({ option, parentGroup: group, highlightText });\n return [selectedAnnouncement, defaultDescription].filter(Boolean).join(' ');\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-option-value-field.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/listbox/utils/check-option-value-field.ts"],"names":[],"mappings":"AAMA,wBAAgB,qBAAqB,CAAC,SAAS,SAAS,aAAa,CAAC,GAAG,CAAC,EACxE,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,SAAS,GAAG,SAAS,QAqBrC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
4
|
-
import { isDevelopment } from '
|
|
4
|
+
import { isDevelopment } from '../../../is-development';
|
|
5
5
|
export function checkOptionValueField(componentName, propertyName, propertyValue) {
|
|
6
6
|
if (isDevelopment) {
|
|
7
7
|
if (!propertyValue) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-option-value-field.js","sourceRoot":"","sources":["../../../../../../src/internal/components/listbox/utils/check-option-value-field.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,UAAU,qBAAqB,CACnC,aAAqB,EACrB,YAAoB,EACpB,aAAoC;IAEpC,IAAI,aAAa,EAAE,CAAC;QAClB,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,4FAA4F;QAC5F,2FAA2F;QAC3F,MAAM,oBAAoB,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;YAC1D,oHAAoH;YACpH,OAAO,SAAS,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,CAAC;QACpD,CAAC,CAAC,CAAC;QAEH,IAAI,oBAAoB,EAAE,CAAC;YACzB,QAAQ,CACN,aAAa,EACb,qBAAqB,YAAY,8IAA8I,CAChL,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { isDevelopment } from '../../../is-development';\n\nexport function checkOptionValueField<ValueType extends ReadonlyArray<any>>(\n componentName: string,\n propertyName: string,\n propertyValue: ValueType | undefined\n) {\n if (isDevelopment) {\n if (!propertyValue) {\n return;\n }\n\n // The `in` checks below are intentional: `element` is `any` (loosely-typed external input),\n // so compile-time `keyof` validation is not possible. These checks validate runtime shape.\n const valuePropertyMissing = !propertyValue.every(element => {\n // eslint-disable-next-line no-restricted-syntax -- Runtime shape validation on loosely-typed external input (`any`)\n return 'options' in element || 'value' in element;\n });\n\n if (valuePropertyMissing) {\n warnOnce(\n componentName,\n `You provided an \\`${propertyName}\\` prop where at least one non-group array element is missing the \\`value\\` field. This field is required for all options without sub-items.`\n );\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { OptionDefinition } from '../../../../types/option';
|
|
2
|
+
import { DropdownOption } from '../../option/interfaces';
|
|
3
3
|
export declare const connectOptionsByValue: (options: ReadonlyArray<DropdownOption>, selectedOptions: ReadonlyArray<OptionDefinition>) => ReadonlyArray<DropdownOption>;
|
|
4
4
|
export declare const findOptionIndex: (options: ReadonlyArray<OptionDefinition>, option: OptionDefinition) => number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-options.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/listbox/utils/connect-options.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,eAAO,MAAM,qBAAqB,GAChC,SAAS,aAAa,CAAC,cAAc,CAAC,EACtC,iBAAiB,aAAa,CAAC,gBAAgB,CAAC,KAC/C,aAAa,CAAC,cAAc,CAc9B,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,SAAS,aAAa,CAAC,gBAAgB,CAAC,EAAE,QAAQ,gBAAgB,WAQjG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-options.js","sourceRoot":"","sources":["../../../../../../src/internal/components/listbox/utils/connect-options.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,OAAsC,EACtC,eAAgD,EACjB,EAAE;IACjC,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrD,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,aAAa,GAAG,IAAI,GAAG,EAA6C,CAAC;IAC3E,KAAK,MAAM,cAAc,IAAI,OAAO,EAAE,CAAC;QACrC,IAAI,cAAc,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACrC,MAAM,KAAK,GAAI,cAAc,CAAC,MAA2B,CAAC,KAAK,CAAC;YAChE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9B,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,eAAe,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,WAAC,OAAA,MAAA,aAAa,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,mCAAI,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA,EAAA,CAAC,CAAC;AACtH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAwC,EAAE,MAAwB,EAAE,EAAE;IACpG,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACpD,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,QAAQ,KAAK,MAAM,IAAI,QAAQ,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC;YAC3D,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { OptionDefinition } from '../../../../types/option';\nimport { DropdownOption } from '../../option/interfaces';\n\nexport const connectOptionsByValue = (\n options: ReadonlyArray<DropdownOption>,\n selectedOptions: ReadonlyArray<OptionDefinition>\n): ReadonlyArray<DropdownOption> => {\n if (!selectedOptions || selectedOptions.length === 0) {\n return [];\n }\n const optionByValue = new Map<OptionDefinition['value'], DropdownOption>();\n for (const dropdownOption of options) {\n if (dropdownOption.type !== 'parent') {\n const value = (dropdownOption.option as OptionDefinition).value;\n if (!optionByValue.has(value)) {\n optionByValue.set(value, dropdownOption);\n }\n }\n }\n return selectedOptions.map(selectedOption => optionByValue.get(selectedOption.value) ?? { option: selectedOption });\n};\n\nexport const findOptionIndex = (options: ReadonlyArray<OptionDefinition>, option: OptionDefinition) => {\n for (let index = 0; index < options.length; index++) {\n const __option = options[index];\n if (__option === option || __option.value === option.value) {\n return index;\n }\n }\n return -1;\n};\n"]}
|