@cloudscape-design/components-themeable 3.0.1393 → 3.0.1395

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/internal/components/control-group/styles.scss +29 -0
  3. package/lib/internal/scss/internal/components/control-group/test-classes/styles.scss +4 -0
  4. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
  5. package/lib/internal/scss/internal/styles/utils/mixins.scss +6 -0
  6. package/lib/internal/scss/toggle/motion.scss +46 -20
  7. package/lib/internal/scss/toggle/styles.scss +4 -3
  8. package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
  9. package/lib/internal/template/internal/components/control-group/index.d.ts.map +1 -1
  10. package/lib/internal/template/internal/components/control-group/index.js +41 -14
  11. package/lib/internal/template/internal/components/control-group/index.js.map +1 -1
  12. package/lib/internal/template/internal/components/control-group/interfaces.d.ts +8 -1
  13. package/lib/internal/template/internal/components/control-group/interfaces.d.ts.map +1 -1
  14. package/lib/internal/template/internal/components/control-group/interfaces.js.map +1 -1
  15. package/lib/internal/template/internal/components/control-group/styles.css.js +20 -16
  16. package/lib/internal/template/internal/components/control-group/styles.scoped.css +52 -16
  17. package/lib/internal/template/internal/components/control-group/styles.selectors.js +20 -16
  18. package/lib/internal/template/internal/components/control-group/test-classes/styles.css.js +4 -3
  19. package/lib/internal/template/internal/components/control-group/test-classes/styles.scoped.css +7 -3
  20. package/lib/internal/template/internal/components/control-group/test-classes/styles.selectors.js +4 -3
  21. package/lib/internal/template/internal/environment.js +2 -2
  22. package/lib/internal/template/internal/environment.json +2 -2
  23. package/lib/internal/template/internal/generated/styles/tokens.js +1167 -1167
  24. package/lib/internal/template/internal/generated/theming/index.cjs +1167 -1167
  25. package/lib/internal/template/internal/generated/theming/index.js +1167 -1167
  26. package/lib/internal/template/internal/hooks/use-fits-inline.d.ts +16 -0
  27. package/lib/internal/template/internal/hooks/use-fits-inline.d.ts.map +1 -0
  28. package/lib/internal/template/internal/hooks/use-fits-inline.js +31 -0
  29. package/lib/internal/template/internal/hooks/use-fits-inline.js.map +1 -0
  30. package/lib/internal/template/test-utils/dom/internal/control-group.d.ts +4 -0
  31. package/lib/internal/template/test-utils/dom/internal/control-group.js +6 -0
  32. package/lib/internal/template/test-utils/dom/internal/control-group.js.map +1 -1
  33. package/lib/internal/template/test-utils/selectors/internal/control-group.d.ts +4 -0
  34. package/lib/internal/template/test-utils/selectors/internal/control-group.js +6 -0
  35. package/lib/internal/template/test-utils/selectors/internal/control-group.js.map +1 -1
  36. package/lib/internal/template/toggle/styles.css.js +10 -10
  37. package/lib/internal/template/toggle/styles.scoped.css +30 -17
  38. package/lib/internal/template/toggle/styles.selectors.js +10 -10
  39. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "af861d178cb6c5f52082d837c39d965f1b245d1c"
2
+ "commit": "c38721c200c19553cd5a21546367f5e101e22c02"
3
3
  }
@@ -13,9 +13,17 @@ $margin-overlap: calc(-1 * #{awsui.$border-width-field});
13
13
  @include styles.styles-reset;
14
14
  }
15
15
 
16
+ // Spans the whole row (controls + action) and hosts the measurement scaffolding (sensor + ghost).
17
+ // It must have `position: static` so the sensor resolves against the nearest positioned ancestor
18
+ // outside the component instead of this wrapper.
19
+ .group-layout-wrapper {
20
+ position: static;
21
+ }
22
+
16
23
  .action-slot {
17
24
  display: flex;
18
25
  margin-inline-start: $margin-overlap;
26
+ flex-shrink: 0;
19
27
  }
20
28
 
21
29
  .group-layout {
@@ -42,10 +50,13 @@ $margin-overlap: calc(-1 * #{awsui.$border-width-field});
42
50
  &-horizontal {
43
51
  flex-direction: row;
44
52
  flex-wrap: nowrap;
53
+ min-inline-size: 0;
54
+ flex-shrink: 1;
45
55
  }
46
56
 
47
57
  &-vertical {
48
58
  flex-direction: column;
59
+ flex-grow: 1;
49
60
  }
50
61
  }
51
62
 
@@ -77,6 +88,17 @@ $margin-overlap: calc(-1 * #{awsui.$border-width-field});
77
88
  }
78
89
  }
79
90
 
91
+ // Width sensor
92
+ .sensor {
93
+ @include styles.measurement-ghost;
94
+ inset-inline-end: 0;
95
+ min-inline-size: 0;
96
+ }
97
+
98
+ .ghost-anchor {
99
+ @include styles.measurement-ghost-anchor;
100
+ }
101
+
80
102
  .inline-label {
81
103
  @include forms.inline-label;
82
104
  // A grouped Multiselect always renders inline tokens, whose row sits higher
@@ -98,3 +120,10 @@ $margin-overlap: calc(-1 * #{awsui.$border-width-field});
98
120
  .inline-label-trigger-wrapper {
99
121
  @include forms.inline-label-trigger-wrapper;
100
122
  }
123
+
124
+ // Hidden single-row copy of the layout, laid out at its natural width so its
125
+ // `max-content` size is the true required width including the action button.
126
+ .ghost {
127
+ @include styles.measurement-ghost;
128
+ inline-size: max-content;
129
+ }
@@ -11,6 +11,10 @@
11
11
  /* used in test-utils */
12
12
  }
13
13
 
14
+ .control {
15
+ /* used in test-utils */
16
+ }
17
+
14
18
  .inline-label {
15
19
  /* used in test-utils */
16
20
  }
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Build environment
3
- $awsui-commit-hash: "af861d17";
3
+ $awsui-commit-hash: "c38721c2";
4
4
  // Manually managed CSS-variables
5
5
  $maxContentWidth: --awsui-max-content-width-ka4djm;
6
6
  $minContentWidth: --awsui-min-content-width-ka4djm;
@@ -20,6 +20,12 @@
20
20
  pointer-events: none;
21
21
  }
22
22
 
23
+ // A zero-height relative anchor for the absolutely-positioned measurement ghost.
24
+ @mixin measurement-ghost-anchor {
25
+ position: relative;
26
+ block-size: 0;
27
+ }
28
+
23
29
  @mixin text-wrapping {
24
30
  // When using with Flexbox, a flex item has min-width set to "auto" by default, which
25
31
  // prevents the text wrapping. We need to override the min-width by setting it to "0"
@@ -1,6 +1,8 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ @use 'sass:math';
5
+ @use '../internal/styles' as styles;
4
6
  @use '../internal/styles/tokens' as awsui;
5
7
  @use '../internal/styles/utils/theming' as theming;
6
8
 
@@ -25,51 +27,75 @@ $tail-stretch: 4px;
25
27
  }
26
28
  }
27
29
 
28
- // Include inside the handle rule. `$handle-size` is the handle's resting inline size.
29
- @mixin handle($handle-size) {
30
+ // Include inside the handle rule. `$handle-size` is the handle's resting inline size,
31
+ // `$travel` the distance it moves to the checked position.
32
+ //
33
+ // Travel (`translate`) and tail (`scale`) are transforms so they keep running while a change
34
+ // handler blocks the main thread; layout properties froze mid-stretch and snapped. They use
35
+ // separate properties because one `transform` animation would override the travel transition.
36
+ @mixin handle($handle-size, $travel) {
30
37
  @include toggle-expressive-with-motion {
31
38
  transition:
32
- transform $travel-duration $settle-easing,
39
+ translate $travel-duration $settle-easing,
33
40
  background-color $travel-duration $settle-easing;
34
41
  }
35
42
 
36
- // The tail only plays once the state has changed since mount.
43
+ &.toggle-handle-checked {
44
+ @include toggle-expressive-with-motion {
45
+ transform: none;
46
+ translate: $travel 0;
47
+ }
48
+ @include styles.with-direction('rtl') {
49
+ @include toggle-expressive-with-motion {
50
+ translate: -$travel 0;
51
+ }
52
+ }
53
+ }
54
+
55
+ // The tail only plays once the state has changed since mount. It stretches away from the leading
56
+ // edge: inline-end going on, inline-start going off. `transform-origin` is physical, so RTL swaps.
37
57
  &[data-awsui-motion-ready] {
38
58
  @include toggle-expressive-with-motion {
39
59
  animation: awsui-toggle-tail-off $tail-duration $settle-easing;
60
+ transform-origin: 0 50%;
61
+ }
62
+ @include styles.with-direction('rtl') {
63
+ @include toggle-expressive-with-motion {
64
+ transform-origin: 100% 50%;
65
+ }
40
66
  }
41
67
  &.toggle-handle-checked {
42
68
  @include toggle-expressive-with-motion {
43
69
  animation-name: awsui-toggle-tail-on;
70
+ transform-origin: 100% 50%;
71
+ }
72
+ @include styles.with-direction('rtl') {
73
+ @include toggle-expressive-with-motion {
74
+ transform-origin: 0 50%;
75
+ }
44
76
  }
45
77
  }
46
78
  }
47
79
 
80
+ // Identical keyframes under two names: the animation only restarts when `animation-name` changes.
48
81
  @if theming.has-expressive-motion() {
82
+ $tail-scale: math.div($handle-size + $tail-stretch, $handle-size);
49
83
  @keyframes awsui-toggle-tail-on {
50
- 0% {
51
- inline-size: $handle-size;
52
- margin-inline-start: 0;
84
+ 0%,
85
+ 100% {
86
+ scale: 1;
53
87
  }
54
88
  35% {
55
- inline-size: $handle-size + $tail-stretch;
56
- margin-inline-start: -$tail-stretch;
57
- }
58
- 100% {
59
- inline-size: $handle-size;
60
- margin-inline-start: 0;
89
+ scale: $tail-scale 1;
61
90
  }
62
91
  }
63
- // Going off, the trailing edge is the end edge, so the width alone grows.
64
92
  @keyframes awsui-toggle-tail-off {
65
- 0% {
66
- inline-size: $handle-size;
93
+ 0%,
94
+ 100% {
95
+ scale: 1;
67
96
  }
68
97
  35% {
69
- inline-size: $handle-size + $tail-stretch;
70
- }
71
- 100% {
72
- inline-size: $handle-size;
98
+ scale: $tail-scale 1;
73
99
  }
74
100
  }
75
101
  }
@@ -14,6 +14,7 @@ $toggle-width: 2.4 * styles.$base-size;
14
14
  $toggle-height: 1.6 * styles.$base-size;
15
15
  $handle-size: 1.2 * styles.$base-size;
16
16
  $handle-offset: 0.2 * styles.$base-size;
17
+ $handle-travel: 0.8 * styles.$base-size;
17
18
  $shadow-color: awsui.$color-shadow-toggle-handle;
18
19
 
19
20
  $control-props: style-api.combine((color, background-color), style-api.$focus-ring);
@@ -90,10 +91,10 @@ $description-tokens: style-api.resolve((color), public);
90
91
  }
91
92
 
92
93
  &-checked {
93
- transform: translateX(0.8 * styles.$base-size);
94
+ transform: translateX($handle-travel);
94
95
 
95
96
  @include styles.with-direction('rtl') {
96
- transform: translateX(-0.8 * styles.$base-size);
97
+ transform: translateX(-$handle-travel);
97
98
  }
98
99
  }
99
100
 
@@ -109,5 +110,5 @@ $description-tokens: style-api.resolve((color), public);
109
110
  }
110
111
  }
111
112
 
112
- @include motion.handle($handle-size);
113
+ @include motion.handle($handle-size, $handle-travel);
113
114
  }
@@ -56,5 +56,5 @@
56
56
  }
57
57
  }
58
58
  :root {
59
- --awsui-version-info-af861d17: true;
59
+ --awsui-version-info-c38721c2: true;
60
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/control-group/index.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAKjD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,QAAQ,EACR,SAAwB,EACxB,eAAe,EACf,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,iBAAiB,eAyEnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/control-group/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAKjD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,QAAQ,EACR,SAAkB,EAClB,eAAe,EACf,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,iBAAiB,eA2GnB"}
@@ -5,31 +5,58 @@ import clsx from 'clsx';
5
5
  import { useUniqueId } from '@cloudscape-design/component-toolkit/internal';
6
6
  import { InternalButton } from '../../../button/internal';
7
7
  import { getBaseProps } from '../../base-component';
8
- import { GroupedControlContext } from '../../context/control-group-context';
8
+ import { GroupedControlContext, } from '../../context/control-group-context';
9
+ import { useFitsInline } from '../../hooks/use-fits-inline';
9
10
  import { flattenChildren } from '../../utils/flatten-children';
10
11
  import styles from './styles.css.js';
11
12
  import testUtilStyles from './test-classes/styles.css.js';
12
- export default function ControlGroup({ children, direction = 'horizontal', inlineLabelText, actionButton, ...props }) {
13
+ export default function ControlGroup({ children, direction = 'auto', inlineLabelText, actionButton, ...props }) {
13
14
  const baseProps = getBaseProps(props);
14
15
  const labelId = useUniqueId('control-group-label');
15
16
  const flattenedChildren = flattenChildren(children, 'ControlGroup');
16
17
  const controlCount = flattenedChildren.length;
18
+ const { fits, ghostRef, sensorRef } = useFitsInline();
19
+ const resolvedDirection = direction === 'auto' ? (fits ? 'horizontal' : 'vertical') : direction;
17
20
  const rootClassnames = [styles.root, baseProps.className, testUtilStyles.root];
18
- const controls = (React.createElement("div", { ...(inlineLabelText ? { 'aria-labelledby': labelId } : actionButton ? {} : baseProps), role: "group", className: clsx(styles.controls, styles[`controls-${direction}`], !actionButton && !inlineLabelText && rootClassnames) }, flattenedChildren.map((child, index) => {
19
- const key = child && typeof child === 'object' ? child.key : undefined;
20
- const position = controlCount === 1 ? 'only' : index === 0 ? 'first' : index === controlCount - 1 ? 'last' : 'middle';
21
- return (React.createElement("div", { key: key ? String(key) : index, className: clsx(styles.control, styles[`control-${position}-${direction}`]) },
22
- React.createElement(GroupedControlContext.Provider, { value: { position, direction, hasAction: !!actionButton } }, child)));
23
- })));
24
- const controlsWithAction = actionButton ? (React.createElement("div", { ...(inlineLabelText ? {} : baseProps), className: clsx(styles['group-layout'], styles[`group-layout-${direction}`], !inlineLabelText && rootClassnames) },
25
- controls,
26
- React.createElement("div", { className: styles['action-slot'] },
27
- React.createElement(InternalButton, { className: 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 })))) : (controls);
21
+ const renderControlSlots = (isGhost) => {
22
+ const slotDirection = isGhost
23
+ ? 'horizontal' // The ghost always uses horizontal mode for measuring
24
+ : resolvedDirection;
25
+ return flattenedChildren.map((child, index) => {
26
+ const key = child && typeof child === 'object' ? child.key : undefined;
27
+ const position = controlCount === 1 ? 'only' : index === 0 ? 'first' : index === controlCount - 1 ? 'last' : 'middle';
28
+ return (React.createElement("div", { key: key !== null && key !== undefined ? String(key) : index, className: clsx(
29
+ // Make sure that test utils exclude the ghost
30
+ !isGhost && testUtilStyles.control, styles.control, styles[`control-${position}-${slotDirection}`]) },
31
+ React.createElement(GroupedControlContext.Provider, { value: { position, direction: slotDirection, hasAction: !!actionButton } }, child)));
32
+ });
33
+ };
34
+ const renderActionButton = (isGhost) => actionButton ? (React.createElement("div", { className: styles['action-slot'] },
35
+ React.createElement(InternalButton
36
+ // Make sure that test utils exclude the ghost
37
+ , {
38
+ // Make sure that test utils exclude the ghost
39
+ 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
+ // A single render path for both the real group layout and the ghost copy, so the ghost measures
41
+ // the whole group (controls + action button, including the overlap seam between them) as one unit.
42
+ // The ghost copy carries no role, no aria-labelledby, no base props, and no test-util classes.
43
+ const renderGroupLayout = (isGhost) => {
44
+ const slotDirection = isGhost ? 'horizontal' : resolvedDirection;
45
+ return (React.createElement("div", { className: clsx(styles['group-layout'], styles[`group-layout-${slotDirection}`]) },
46
+ React.createElement("div", { ...(isGhost ? {} : inlineLabelText ? { role: 'group', 'aria-labelledby': labelId } : { role: 'group' }), className: clsx(styles.controls, styles[`controls-${slotDirection}`]) }, renderControlSlots(isGhost)),
47
+ renderActionButton(isGhost)));
48
+ };
49
+ const groupLayoutWrapper = (React.createElement("div", { ...(inlineLabelText ? {} : baseProps), className: clsx(styles['group-layout-wrapper'], !inlineLabelText && rootClassnames) },
50
+ renderGroupLayout(false),
51
+ direction === 'auto' && (React.createElement(React.Fragment, null,
52
+ React.createElement("div", { ref: sensorRef, className: styles.sensor, "aria-hidden": "true" }),
53
+ React.createElement("div", { className: styles['ghost-anchor'] },
54
+ React.createElement("div", { ref: ghostRef, className: styles.ghost, "aria-hidden": "true" }, renderGroupLayout(true)))))));
28
55
  if (inlineLabelText) {
29
56
  return (React.createElement("div", { ...baseProps, className: clsx(...rootClassnames, styles['inline-label-wrapper']) },
30
57
  React.createElement("label", { id: labelId, className: clsx(styles['inline-label'], testUtilStyles['inline-label']) }, inlineLabelText),
31
- React.createElement("div", { className: styles['inline-label-trigger-wrapper'] }, controlsWithAction)));
58
+ React.createElement("div", { className: styles['inline-label-trigger-wrapper'] }, groupLayoutWrapper)));
32
59
  }
33
- return controlsWithAction;
60
+ return groupLayoutWrapper;
34
61
  }
35
62
  //# sourceMappingURL=index.js.map
@@ -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,sBAAsB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAA0B,MAAM,qCAAqC,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAI1D,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,QAAQ,EACR,SAAS,GAAG,YAAY,EACxB,eAAe,EACf,YAAY,EACZ,GAAG,KAAK,EACU;IAClB,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAEnD,MAAM,iBAAiB,GAAG,eAAe,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IACpE,MAAM,YAAY,GAAG,iBAAiB,CAAC,MAAM,CAAC;IA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c. 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 { GroupedControlContext, GroupedControlPosition } from '../../context/control-group-context';\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 = 'horizontal',\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 rootClassnames = [styles.root, baseProps.className, testUtilStyles.root];\n\n const controls = (\n <div\n {...(inlineLabelText ? { 'aria-labelledby': labelId } : actionButton ? {} : baseProps)}\n role=\"group\"\n className={clsx(\n styles.controls,\n styles[`controls-${direction}`],\n !actionButton && !inlineLabelText && rootClassnames\n )}\n >\n {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 ? String(key) : index}\n className={clsx(styles.control, styles[`control-${position}-${direction}`])}\n >\n <GroupedControlContext.Provider value={{ position, direction, hasAction: !!actionButton }}>\n {child}\n </GroupedControlContext.Provider>\n </div>\n );\n })}\n </div>\n );\n\n const controlsWithAction = actionButton ? (\n <div\n {...(inlineLabelText ? {} : baseProps)}\n className={clsx(styles['group-layout'], styles[`group-layout-${direction}`], !inlineLabelText && rootClassnames)}\n >\n {controls}\n <div className={styles['action-slot']}>\n <InternalButton\n className={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 </div>\n ) : (\n controls\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']}>{controlsWithAction}</div>\n </div>\n );\n }\n\n return controlsWithAction;\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,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAI1D,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,QAAQ,EACR,SAAS,GAAG,MAAM,EAClB,eAAe,EACf,YAAY,EACZ,GAAG,KAAK,EACU;IAClB,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAEnD,MAAM,iBAAiB,GAAG,eAAe,CA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,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"]}
@@ -5,7 +5,13 @@ import { GroupedControlDirection } from '../../context/control-group-context';
5
5
  import { CancelableEventHandler } from '../../events';
6
6
  export interface ControlGroupProps extends BaseComponentProps {
7
7
  children?: React.ReactNode;
8
- direction?: GroupedControlDirection;
8
+ /**
9
+ * The axis along which the controls are laid out (`horizontal`, `vertical` or `auto`).
10
+ * When set to `auto` (default), the component decides the direction based on whether it
11
+ * fits in the padding box of its
12
+ * [containing block](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Display/Containing_block).
13
+ */
14
+ direction?: ControlGroupProps.ControlGroupDirection;
9
15
  inlineLabelText?: string;
10
16
  /**
11
17
  * Specifies an action button rendered next to the grouped controls.
@@ -13,6 +19,7 @@ export interface ControlGroupProps extends BaseComponentProps {
13
19
  actionButton?: ControlGroupProps.ActionButton;
14
20
  }
15
21
  export declare namespace ControlGroupProps {
22
+ type ControlGroupDirection = GroupedControlDirection | 'auto';
16
23
  interface ActionButton {
17
24
  /**
18
25
  * Called when the user clicks on the button and the button is not disabled.
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/control-group/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,uBAAuB,CAAC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC;CAC/C;AAED,yBAAiB,iBAAiB,CAAC;IACjC,UAAiB,YAAY;QAC3B;;WAEG;QACH,OAAO,CAAC,EAAE,sBAAsB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAE1D;;WAEG;QACH,QAAQ,CAAC,EAAE,OAAO,CAAC;QAEnB;;;WAGG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;QAExB;;;WAGG;QACH,SAAS,EAAE,MAAM,CAAC;QAElB;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,CAAC;QAEzB,uEAAuE;QACvE,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC;KAC1B;CACF"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/control-group/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAC,qBAAqB,CAAC;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC;CAC/C;AAED,yBAAiB,iBAAiB,CAAC;IAGjC,KAAY,qBAAqB,GAAG,uBAAuB,GAAG,MAAM,CAAC;IAErE,UAAiB,YAAY;QAC3B;;WAEG;QACH,OAAO,CAAC,EAAE,sBAAsB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAE1D;;WAEG;QACH,QAAQ,CAAC,EAAE,OAAO,CAAC;QAEnB;;;WAGG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;QAExB;;;WAGG;QACH,SAAS,EAAE,MAAM,CAAC;QAElB;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,CAAC;QAEzB,uEAAuE;QACvE,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC;KAC1B;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/components/control-group/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from '../../../button/interfaces';\nimport { IconProps } from '../../../icon/interfaces';\nimport { BaseComponentProps } from '../../../types/base-component';\nimport { GroupedControlDirection } from '../../context/control-group-context';\nimport { CancelableEventHandler } from '../../events';\n\nexport interface ControlGroupProps extends BaseComponentProps {\n children?: React.ReactNode;\n direction?: GroupedControlDirection;\n inlineLabelText?: string;\n /**\n * Specifies an action button rendered next to the grouped controls.\n */\n actionButton?: ControlGroupProps.ActionButton;\n}\n\nexport namespace ControlGroupProps {\n export interface ActionButton {\n /**\n * Called when the user clicks on the button and the button is not disabled.\n */\n onClick?: CancelableEventHandler<ButtonProps.ClickDetail>;\n\n /**\n * Renders the button as disabled and prevents clicks.\n */\n disabled?: boolean;\n\n /**\n * Provides a reason why the button is disabled (only when `disabled` is `true`).\n * If provided, the button becomes focusable.\n */\n disabledReason?: string;\n\n /**\n * Adds `aria-label` to the button element.\n * The text will also be added to the `title` attribute of the button.\n */\n ariaLabel: string;\n\n /**\n * Adds `aria-describedby` to the button.\n */\n ariaDescribedby?: string;\n\n /** Specifies the icon to display (for example `remove` or `close`). */\n iconName: IconProps.Name;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/components/control-group/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from '../../../button/interfaces';\nimport { IconProps } from '../../../icon/interfaces';\nimport { BaseComponentProps } from '../../../types/base-component';\nimport { GroupedControlDirection } from '../../context/control-group-context';\nimport { CancelableEventHandler } from '../../events';\n\nexport interface ControlGroupProps extends BaseComponentProps {\n children?: React.ReactNode;\n /**\n * The axis along which the controls are laid out (`horizontal`, `vertical` or `auto`).\n * When set to `auto` (default), the component decides the direction based on whether it\n * fits in the padding box of its\n * [containing block](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Display/Containing_block).\n */\n direction?: ControlGroupProps.ControlGroupDirection;\n inlineLabelText?: string;\n /**\n * Specifies an action button rendered next to the grouped controls.\n */\n actionButton?: ControlGroupProps.ActionButton;\n}\n\nexport namespace ControlGroupProps {\n // `'auto'` exists only for the control group but not for the inner grouped controls,\n // which receive a definite value (`horizontal` or `vertical`).\n export type ControlGroupDirection = GroupedControlDirection | 'auto';\n\n export interface ActionButton {\n /**\n * Called when the user clicks on the button and the button is not disabled.\n */\n onClick?: CancelableEventHandler<ButtonProps.ClickDetail>;\n\n /**\n * Renders the button as disabled and prevents clicks.\n */\n disabled?: boolean;\n\n /**\n * Provides a reason why the button is disabled (only when `disabled` is `true`).\n * If provided, the button becomes focusable.\n */\n disabledReason?: string;\n\n /**\n * Adds `aria-label` to the button element.\n * The text will also be added to the `title` attribute of the button.\n */\n ariaLabel: string;\n\n /**\n * Adds `aria-describedby` to the button.\n */\n ariaDescribedby?: string;\n\n /** Specifies the icon to display (for example `remove` or `close`). */\n iconName: IconProps.Name;\n }\n}\n"]}
@@ -1,21 +1,25 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_o08jm_1h1xd_9",
5
- "action-slot": "awsui_action-slot_o08jm_1h1xd_41",
6
- "group-layout": "awsui_group-layout_o08jm_1h1xd_46",
7
- "group-layout-horizontal": "awsui_group-layout-horizontal_o08jm_1h1xd_50",
8
- "group-layout-vertical": "awsui_group-layout-vertical_o08jm_1h1xd_53",
9
- "controls": "awsui_controls_o08jm_1h1xd_57",
10
- "controls-horizontal": "awsui_controls-horizontal_o08jm_1h1xd_61",
11
- "controls-vertical": "awsui_controls-vertical_o08jm_1h1xd_65",
12
- "control": "awsui_control_o08jm_1h1xd_57",
13
- "control-middle-horizontal": "awsui_control-middle-horizontal_o08jm_1h1xd_73",
14
- "control-last-horizontal": "awsui_control-last-horizontal_o08jm_1h1xd_73",
15
- "control-middle-vertical": "awsui_control-middle-vertical_o08jm_1h1xd_76",
16
- "control-last-vertical": "awsui_control-last-vertical_o08jm_1h1xd_76",
17
- "inline-label": "awsui_inline-label_o08jm_1h1xd_85",
18
- "inline-label-wrapper": "awsui_inline-label-wrapper_o08jm_1h1xd_110",
19
- "inline-label-trigger-wrapper": "awsui_inline-label-trigger-wrapper_o08jm_1h1xd_115"
4
+ "root": "awsui_root_o08jm_17hgw_9",
5
+ "group-layout-wrapper": "awsui_group-layout-wrapper_o08jm_17hgw_41",
6
+ "action-slot": "awsui_action-slot_o08jm_17hgw_45",
7
+ "group-layout": "awsui_group-layout_o08jm_17hgw_41",
8
+ "group-layout-horizontal": "awsui_group-layout-horizontal_o08jm_17hgw_55",
9
+ "group-layout-vertical": "awsui_group-layout-vertical_o08jm_17hgw_58",
10
+ "controls": "awsui_controls_o08jm_17hgw_62",
11
+ "controls-horizontal": "awsui_controls-horizontal_o08jm_17hgw_66",
12
+ "controls-vertical": "awsui_controls-vertical_o08jm_17hgw_72",
13
+ "control": "awsui_control_o08jm_17hgw_62",
14
+ "control-middle-horizontal": "awsui_control-middle-horizontal_o08jm_17hgw_81",
15
+ "control-last-horizontal": "awsui_control-last-horizontal_o08jm_17hgw_81",
16
+ "control-middle-vertical": "awsui_control-middle-vertical_o08jm_17hgw_84",
17
+ "control-last-vertical": "awsui_control-last-vertical_o08jm_17hgw_84",
18
+ "sensor": "awsui_sensor_o08jm_17hgw_93",
19
+ "ghost-anchor": "awsui_ghost-anchor_o08jm_17hgw_105",
20
+ "inline-label": "awsui_inline-label_o08jm_17hgw_110",
21
+ "inline-label-wrapper": "awsui_inline-label-wrapper_o08jm_17hgw_135",
22
+ "inline-label-trigger-wrapper": "awsui_inline-label-trigger-wrapper_o08jm_17hgw_140",
23
+ "ghost": "awsui_ghost_o08jm_17hgw_105"
20
24
  };
21
25
 
@@ -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
- .awsui_root_o08jm_1h1xd_9:not(#\9) {
9
+ .awsui_root_o08jm_17hgw_9:not(#\9) {
10
10
  border-collapse: separate;
11
11
  border-spacing: 0;
12
12
  box-sizing: border-box;
@@ -38,51 +38,76 @@ 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_action-slot_o08jm_1h1xd_41:not(#\9) {
41
+ .awsui_group-layout-wrapper_o08jm_17hgw_41:not(#\9) {
42
+ position: static;
43
+ }
44
+
45
+ .awsui_action-slot_o08jm_17hgw_45:not(#\9) {
42
46
  display: flex;
43
47
  margin-inline-start: calc(-1 * var(--border-width-field-2365x3, 1px));
48
+ flex-shrink: 0;
44
49
  }
45
50
 
46
- .awsui_group-layout_o08jm_1h1xd_46:not(#\9) {
51
+ .awsui_group-layout_o08jm_17hgw_41:not(#\9) {
47
52
  display: flex;
48
53
  flex-direction: row;
49
54
  }
50
- .awsui_group-layout-horizontal_o08jm_1h1xd_50:not(#\9) {
55
+ .awsui_group-layout-horizontal_o08jm_17hgw_55:not(#\9) {
51
56
  align-items: flex-end;
52
57
  }
53
- .awsui_group-layout-vertical_o08jm_1h1xd_53:not(#\9), .awsui_group-layout-vertical_o08jm_1h1xd_53 > .awsui_action-slot_o08jm_1h1xd_41:not(#\9) {
58
+ .awsui_group-layout-vertical_o08jm_17hgw_58:not(#\9), .awsui_group-layout-vertical_o08jm_17hgw_58 > .awsui_action-slot_o08jm_17hgw_45:not(#\9) {
54
59
  align-items: stretch;
55
60
  }
56
61
 
57
- .awsui_controls_o08jm_1h1xd_57:not(#\9) {
62
+ .awsui_controls_o08jm_17hgw_62:not(#\9) {
58
63
  display: flex;
59
64
  align-items: stretch;
60
65
  }
61
- .awsui_controls-horizontal_o08jm_1h1xd_61:not(#\9) {
66
+ .awsui_controls-horizontal_o08jm_17hgw_66:not(#\9) {
62
67
  flex-direction: row;
63
68
  flex-wrap: nowrap;
69
+ min-inline-size: 0;
70
+ flex-shrink: 1;
64
71
  }
65
- .awsui_controls-vertical_o08jm_1h1xd_65:not(#\9) {
72
+ .awsui_controls-vertical_o08jm_17hgw_72:not(#\9) {
66
73
  flex-direction: column;
74
+ flex-grow: 1;
67
75
  }
68
76
 
69
- .awsui_control_o08jm_1h1xd_57:not(#\9) {
77
+ .awsui_control_o08jm_17hgw_62:not(#\9) {
70
78
  min-inline-size: 0;
71
79
  isolation: isolate;
72
80
  }
73
- .awsui_control-middle-horizontal_o08jm_1h1xd_73:not(#\9), .awsui_control-last-horizontal_o08jm_1h1xd_73:not(#\9) {
81
+ .awsui_control-middle-horizontal_o08jm_17hgw_81:not(#\9), .awsui_control-last-horizontal_o08jm_17hgw_81:not(#\9) {
74
82
  margin-inline-start: calc(-1 * var(--border-width-field-2365x3, 1px));
75
83
  }
76
- .awsui_control-middle-vertical_o08jm_1h1xd_76:not(#\9), .awsui_control-last-vertical_o08jm_1h1xd_76:not(#\9) {
84
+ .awsui_control-middle-vertical_o08jm_17hgw_84:not(#\9), .awsui_control-last-vertical_o08jm_17hgw_84:not(#\9) {
77
85
  margin-block-start: calc(-1 * var(--border-width-field-2365x3, 1px));
78
86
  }
79
87
 
80
- .awsui_action-slot_o08jm_1h1xd_41:not(#\9):focus-within,
81
- .awsui_control_o08jm_1h1xd_57:not(#\9):focus-within {
88
+ .awsui_action-slot_o08jm_17hgw_45:not(#\9):focus-within,
89
+ .awsui_control_o08jm_17hgw_62:not(#\9):focus-within {
82
90
  z-index: 1;
83
91
  }
84
92
 
85
- .awsui_inline-label_o08jm_1h1xd_85:not(#\9) {
93
+ .awsui_sensor_o08jm_17hgw_93:not(#\9) {
94
+ position: absolute;
95
+ inset-block-start: 0;
96
+ inset-inline-start: 0;
97
+ block-size: 0;
98
+ overflow: hidden;
99
+ visibility: hidden;
100
+ pointer-events: none;
101
+ inset-inline-end: 0;
102
+ min-inline-size: 0;
103
+ }
104
+
105
+ .awsui_ghost-anchor_o08jm_17hgw_105:not(#\9) {
106
+ position: relative;
107
+ block-size: 0;
108
+ }
109
+
110
+ .awsui_inline-label_o08jm_17hgw_110:not(#\9) {
86
111
  background: linear-gradient(to bottom, var(--awsui-inline-label-background-color-ka4djm, var(--color-background-layout-main-y4565g, #f2f3f3)), var(--color-background-input-default-1u0v1p, #ffffff));
87
112
  border-start-start-radius: 2px;
88
113
  border-start-end-radius: 2px;
@@ -107,11 +132,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
107
132
  z-index: 2;
108
133
  }
109
134
 
110
- .awsui_inline-label-wrapper_o08jm_1h1xd_110:not(#\9) {
135
+ .awsui_inline-label-wrapper_o08jm_17hgw_135:not(#\9) {
111
136
  margin-block-start: calc(var(--space-scaled-xs-pajbd1, 8px) * -1);
112
137
  isolation: isolate;
113
138
  }
114
139
 
115
- .awsui_inline-label-trigger-wrapper_o08jm_1h1xd_115:not(#\9) {
140
+ .awsui_inline-label-trigger-wrapper_o08jm_17hgw_140:not(#\9) {
116
141
  margin-block-start: -7px;
142
+ }
143
+
144
+ .awsui_ghost_o08jm_17hgw_105:not(#\9) {
145
+ position: absolute;
146
+ inset-block-start: 0;
147
+ inset-inline-start: 0;
148
+ block-size: 0;
149
+ overflow: hidden;
150
+ visibility: hidden;
151
+ pointer-events: none;
152
+ inline-size: max-content;
117
153
  }
@@ -2,21 +2,25 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_o08jm_1h1xd_9",
6
- "action-slot": "awsui_action-slot_o08jm_1h1xd_41",
7
- "group-layout": "awsui_group-layout_o08jm_1h1xd_46",
8
- "group-layout-horizontal": "awsui_group-layout-horizontal_o08jm_1h1xd_50",
9
- "group-layout-vertical": "awsui_group-layout-vertical_o08jm_1h1xd_53",
10
- "controls": "awsui_controls_o08jm_1h1xd_57",
11
- "controls-horizontal": "awsui_controls-horizontal_o08jm_1h1xd_61",
12
- "controls-vertical": "awsui_controls-vertical_o08jm_1h1xd_65",
13
- "control": "awsui_control_o08jm_1h1xd_57",
14
- "control-middle-horizontal": "awsui_control-middle-horizontal_o08jm_1h1xd_73",
15
- "control-last-horizontal": "awsui_control-last-horizontal_o08jm_1h1xd_73",
16
- "control-middle-vertical": "awsui_control-middle-vertical_o08jm_1h1xd_76",
17
- "control-last-vertical": "awsui_control-last-vertical_o08jm_1h1xd_76",
18
- "inline-label": "awsui_inline-label_o08jm_1h1xd_85",
19
- "inline-label-wrapper": "awsui_inline-label-wrapper_o08jm_1h1xd_110",
20
- "inline-label-trigger-wrapper": "awsui_inline-label-trigger-wrapper_o08jm_1h1xd_115"
5
+ "root": "awsui_root_o08jm_17hgw_9",
6
+ "group-layout-wrapper": "awsui_group-layout-wrapper_o08jm_17hgw_41",
7
+ "action-slot": "awsui_action-slot_o08jm_17hgw_45",
8
+ "group-layout": "awsui_group-layout_o08jm_17hgw_41",
9
+ "group-layout-horizontal": "awsui_group-layout-horizontal_o08jm_17hgw_55",
10
+ "group-layout-vertical": "awsui_group-layout-vertical_o08jm_17hgw_58",
11
+ "controls": "awsui_controls_o08jm_17hgw_62",
12
+ "controls-horizontal": "awsui_controls-horizontal_o08jm_17hgw_66",
13
+ "controls-vertical": "awsui_controls-vertical_o08jm_17hgw_72",
14
+ "control": "awsui_control_o08jm_17hgw_62",
15
+ "control-middle-horizontal": "awsui_control-middle-horizontal_o08jm_17hgw_81",
16
+ "control-last-horizontal": "awsui_control-last-horizontal_o08jm_17hgw_81",
17
+ "control-middle-vertical": "awsui_control-middle-vertical_o08jm_17hgw_84",
18
+ "control-last-vertical": "awsui_control-last-vertical_o08jm_17hgw_84",
19
+ "sensor": "awsui_sensor_o08jm_17hgw_93",
20
+ "ghost-anchor": "awsui_ghost-anchor_o08jm_17hgw_105",
21
+ "inline-label": "awsui_inline-label_o08jm_17hgw_110",
22
+ "inline-label-wrapper": "awsui_inline-label-wrapper_o08jm_17hgw_135",
23
+ "inline-label-trigger-wrapper": "awsui_inline-label-trigger-wrapper_o08jm_17hgw_140",
24
+ "ghost": "awsui_ghost_o08jm_17hgw_105"
21
25
  };
22
26