@cloudscape-design/components-themeable 3.0.1371 → 3.0.1372

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 (74) hide show
  1. package/lib/__tests__/theming.test.js +14 -0
  2. package/lib/__tests__/theming.test.js.map +1 -1
  3. package/lib/internal/manifest.json +1 -1
  4. package/lib/internal/scss/button-dropdown/category-elements/styles.scss +1 -4
  5. package/lib/internal/scss/button-dropdown/item-element/styles.scss +1 -4
  6. package/lib/internal/scss/dropdown/styles.scss +23 -4
  7. package/lib/internal/scss/internal/components/selectable-item/styles.scss +2 -8
  8. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
  9. package/lib/internal/scss/internal/styles/links.scss +15 -6
  10. package/lib/internal/scss/internal/styles/utils/mixins.scss +7 -0
  11. package/lib/internal/scss/link/styles.scss +35 -16
  12. package/lib/internal/scss/status-indicator/styles.scss +3 -2
  13. package/lib/internal/template/box/interfaces.d.ts +3 -0
  14. package/lib/internal/template/box/interfaces.d.ts.map +1 -1
  15. package/lib/internal/template/box/interfaces.js.map +1 -1
  16. package/lib/internal/template/button/interfaces.d.ts +0 -1
  17. package/lib/internal/template/button/interfaces.d.ts.map +1 -1
  18. package/lib/internal/template/button/interfaces.js.map +1 -1
  19. package/lib/internal/template/button/internal.d.ts.map +1 -1
  20. package/lib/internal/template/button/internal.js +8 -1
  21. package/lib/internal/template/button/internal.js.map +1 -1
  22. package/lib/internal/template/button-dropdown/category-elements/styles.css.js +18 -18
  23. package/lib/internal/template/button-dropdown/category-elements/styles.scoped.css +32 -32
  24. package/lib/internal/template/button-dropdown/category-elements/styles.selectors.js +18 -18
  25. package/lib/internal/template/button-dropdown/item-element/styles.css.js +21 -21
  26. package/lib/internal/template/button-dropdown/item-element/styles.scoped.css +38 -38
  27. package/lib/internal/template/button-dropdown/item-element/styles.selectors.js +21 -21
  28. package/lib/internal/template/copy-to-clipboard/interfaces.d.ts +0 -1
  29. package/lib/internal/template/copy-to-clipboard/interfaces.d.ts.map +1 -1
  30. package/lib/internal/template/copy-to-clipboard/interfaces.js.map +1 -1
  31. package/lib/internal/template/dropdown/index.d.ts.map +1 -1
  32. package/lib/internal/template/dropdown/index.js +1 -1
  33. package/lib/internal/template/dropdown/index.js.map +1 -1
  34. package/lib/internal/template/dropdown/internal.d.ts +5 -1
  35. package/lib/internal/template/dropdown/internal.d.ts.map +1 -1
  36. package/lib/internal/template/dropdown/internal.js +4 -4
  37. package/lib/internal/template/dropdown/internal.js.map +1 -1
  38. package/lib/internal/template/dropdown/styles.css.js +20 -20
  39. package/lib/internal/template/dropdown/styles.scoped.css +69 -48
  40. package/lib/internal/template/dropdown/styles.selectors.js +20 -20
  41. package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
  42. package/lib/internal/template/internal/components/selectable-item/styles.css.js +22 -22
  43. package/lib/internal/template/internal/components/selectable-item/styles.scoped.css +53 -49
  44. package/lib/internal/template/internal/components/selectable-item/styles.selectors.js +22 -22
  45. package/lib/internal/template/internal/environment.js +2 -2
  46. package/lib/internal/template/internal/environment.json +2 -2
  47. package/lib/internal/template/link/index.d.ts.map +1 -1
  48. package/lib/internal/template/link/index.js +1 -1
  49. package/lib/internal/template/link/index.js.map +1 -1
  50. package/lib/internal/template/link/internal.d.ts +4 -0
  51. package/lib/internal/template/link/internal.d.ts.map +1 -1
  52. package/lib/internal/template/link/internal.js +2 -2
  53. package/lib/internal/template/link/internal.js.map +1 -1
  54. package/lib/internal/template/link/styles.css.js +21 -21
  55. package/lib/internal/template/link/styles.scoped.css +121 -104
  56. package/lib/internal/template/link/styles.selectors.js +21 -21
  57. package/lib/internal/template/status-indicator/internal.d.ts +5 -1
  58. package/lib/internal/template/status-indicator/internal.d.ts.map +1 -1
  59. package/lib/internal/template/status-indicator/internal.js +2 -2
  60. package/lib/internal/template/status-indicator/internal.js.map +1 -1
  61. package/lib/internal/template/status-indicator/styles.css.js +26 -25
  62. package/lib/internal/template/status-indicator/styles.scoped.css +47 -47
  63. package/lib/internal/template/status-indicator/styles.selectors.js +26 -25
  64. package/lib/internal/template/steps/internal.js +1 -1
  65. package/lib/internal/template/steps/internal.js.map +1 -1
  66. package/lib/internal/template/theming/index.d.ts +4 -2
  67. package/lib/internal/template/theming/index.d.ts.map +1 -1
  68. package/lib/internal/template/theming/index.js +7 -4
  69. package/lib/internal/template/theming/index.js.map +1 -1
  70. package/lib/theming.d.ts +5 -0
  71. package/lib/theming.d.ts.map +1 -1
  72. package/lib/theming.js +12 -0
  73. package/lib/theming.js.map +1 -1
  74. package/package.json +1 -1
@@ -14,6 +14,7 @@ const preset = {
14
14
  };
15
15
  jest.mock('@cloudscape-design/theming-build', () => ({
16
16
  buildThemedComponents: jest.fn().mockResolvedValue(undefined),
17
+ generateThemeStylesheet: jest.fn().mockReturnValue('.mock-stylesheet {}'),
17
18
  }));
18
19
  jest.mock('../internal/template/internal/generated/theming/index.cjs', () => ({
19
20
  preset,
@@ -44,4 +45,17 @@ describe('buildThemedComponents', () => {
44
45
  }));
45
46
  });
46
47
  });
48
+ describe('generateThemeStylesheet', () => {
49
+ test('passes the arguments through', () => {
50
+ const theme = { tokens: { borderRadiusButton: '8px' } };
51
+ const stylesheet = (0, theming_1.generateThemeStylesheet)({ theme, selector: '.my-theme' });
52
+ expect(stylesheet).toBe('.mock-stylesheet {}');
53
+ expect(theming_build_1.generateThemeStylesheet).toHaveBeenCalledWith({
54
+ override: theme,
55
+ preset,
56
+ selector: '.my-theme',
57
+ baseThemeId: 'visual-refresh',
58
+ });
59
+ });
60
+ });
47
61
  //# sourceMappingURL=theming.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"theming.test.js","sourceRoot":"","sources":["../../../src-themeable/__tests__/theming.test.ts"],"names":[],"mappings":";;;;;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,uEAA4C;AAE5C,MAAM,MAAM,GAAG;IACb,aAAa,EAAE;QACb,kBAAkB,EAAE,+BAA+B;QACnD,8BAA8B,EAAE,6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,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport mapValues from 'lodash/mapValues.js';\n\nconst preset = {\n propertiesMap: {\n borderRadiusButton: '--border-radius-button-aaaaaa',\n colorBorderButtonNormalDefault: '--color-border-button-normal-default-bbbbbb',\n },\n};\n\njest.mock('@cloudscape-design/theming-build', () => ({\n buildThemedComponents: jest.fn().mockResolvedValue(undefined),\n}));\n\njest.mock('../internal/template/internal/generated/theming/index.cjs', () => ({\n preset,\n}));\n\nimport { buildThemedComponents as themingCoreBuild } from '@cloudscape-design/theming-build';\n\nimport { buildThemedComponents } from '../theming';\n\ndescribe('buildThemedComponents', () => {\n test('does not pass website token versions by default', async () => {\n const theme = {} as any;\n\n await buildThemedComponents({ theme, outputDir: '/tmp/output', baseThemeId: 'visual-refresh' });\n\n expect(themingCoreBuild).toHaveBeenCalledWith(\n expect.objectContaining({\n preset,\n })\n );\n });\n\n test('passes stable website token versions when the feature flag is enabled', async () => {\n const theme = {} as any;\n\n await buildThemedComponents({\n theme,\n outputDir: '/tmp/output',\n baseThemeId: 'visual-refresh',\n ...{ __tokenHashSeed: 'website' },\n });\n\n expect(themingCoreBuild).toHaveBeenCalledWith(\n expect.objectContaining({\n preset: {\n ...preset,\n tokenVersions: mapValues(preset.propertiesMap, () => 'website'),\n },\n })\n );\n });\n});\n"]}
1
+ {"version":3,"file":"theming.test.js","sourceRoot":"","sources":["../../../src-themeable/__tests__/theming.test.ts"],"names":[],"mappings":";;;;;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,uEAA4C;AAE5C,MAAM,MAAM,GAAG;IACb,aAAa,EAAE;QACb,kBAAkB,EAAE,+BAA+B;QACnD,8BAA8B,EAAE,6CAA6C;KAC9E;CACF,CAAC;AAEF,IAAI,CAAC,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,CAAC;IACnD,qBAAqB,EAAE,IAAI,CAAC,EAAE,EAAE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IACvC,IAAI,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACxC,MAAM,KAAK,GAAG,EAAE,MAAM,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,EAAS,CAAC;QAE/D,MAAM,UAAU,GAAG,IAAA,iCAAuB,EAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;QAE7E,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC/C,MAAM,CAAC,uCAAkC,CAAC,CAAC,oBAAoB,CAAC;YAC9D,QAAQ,EAAE,KAAK;YACf,MAAM;YACN,QAAQ,EAAE,WAAW;YACrB,WAAW,EAAE,gBAAgB;SAC9B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport mapValues from 'lodash/mapValues.js';\n\nconst preset = {\n propertiesMap: {\n borderRadiusButton: '--border-radius-button-aaaaaa',\n colorBorderButtonNormalDefault: '--color-border-button-normal-default-bbbbbb',\n },\n};\n\njest.mock('@cloudscape-design/theming-build', () => ({\n buildThemedComponents: jest.fn().mockResolvedValue(undefined),\n generateThemeStylesheet: jest.fn().mockReturnValue('.mock-stylesheet {}'),\n}));\n\njest.mock('../internal/template/internal/generated/theming/index.cjs', () => ({\n preset,\n}));\n\nimport {\n buildThemedComponents as themingCoreBuild,\n generateThemeStylesheet as themingCoreGenerateThemeStylesheet,\n} from '@cloudscape-design/theming-build';\n\nimport { buildThemedComponents, generateThemeStylesheet } from '../theming';\n\ndescribe('buildThemedComponents', () => {\n test('does not pass website token versions by default', async () => {\n const theme = {} as any;\n\n await buildThemedComponents({ theme, outputDir: '/tmp/output', baseThemeId: 'visual-refresh' });\n\n expect(themingCoreBuild).toHaveBeenCalledWith(\n expect.objectContaining({\n preset,\n })\n );\n });\n\n test('passes stable website token versions when the feature flag is enabled', async () => {\n const theme = {} as any;\n\n await buildThemedComponents({\n theme,\n outputDir: '/tmp/output',\n baseThemeId: 'visual-refresh',\n ...{ __tokenHashSeed: 'website' },\n });\n\n expect(themingCoreBuild).toHaveBeenCalledWith(\n expect.objectContaining({\n preset: {\n ...preset,\n tokenVersions: mapValues(preset.propertiesMap, () => 'website'),\n },\n })\n );\n });\n});\n\ndescribe('generateThemeStylesheet', () => {\n test('passes the arguments through', () => {\n const theme = { tokens: { borderRadiusButton: '8px' } } as any;\n\n const stylesheet = generateThemeStylesheet({ theme, selector: '.my-theme' });\n\n expect(stylesheet).toBe('.mock-stylesheet {}');\n expect(themingCoreGenerateThemeStylesheet).toHaveBeenCalledWith({\n override: theme,\n preset,\n selector: '.my-theme',\n baseThemeId: 'visual-refresh',\n });\n });\n});\n"]}
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "4b4d1f4b53ecdacdf40c9f49a6ba477d6f6a39aa"
2
+ "commit": "9963282c4a843a90e222d726418b616165cf9898"
3
3
  }
@@ -60,10 +60,7 @@
60
60
  padding-inline: awsui.$space-button-horizontal;
61
61
  border-block: awsui.$border-item-width solid awsui.$color-border-dropdown-item-hover;
62
62
  border-inline: awsui.$border-item-width solid awsui.$color-border-dropdown-item-hover;
63
- border-start-start-radius: awsui.$border-radius-item;
64
- border-start-end-radius: awsui.$border-radius-item;
65
- border-end-start-radius: awsui.$border-radius-item;
66
- border-end-end-radius: awsui.$border-radius-item;
63
+ @include styles.logical-radius(awsui.$border-radius-dropdown);
67
64
  z-index: 2;
68
65
 
69
66
  &.no-content-styling {
@@ -40,10 +40,7 @@
40
40
 
41
41
  background-color: awsui.$color-background-dropdown-item-hover;
42
42
  border-color: awsui.$color-border-dropdown-item-hover;
43
- border-start-start-radius: awsui.$border-radius-item;
44
- border-start-end-radius: awsui.$border-radius-item;
45
- border-end-start-radius: awsui.$border-radius-item;
46
- border-end-end-radius: awsui.$border-radius-item;
43
+ @include styles.logical-radius(awsui.$border-radius-dropdown);
47
44
 
48
45
  &.disabled {
49
46
  color: awsui.$color-text-dropdown-item-dimmed;
@@ -7,6 +7,12 @@
7
7
  @use '../internal/styles/tokens' as awsui;
8
8
  @use './motion';
9
9
  @use '../internal/generated/custom-css-properties/index' as custom-props;
10
+ @use '../internal/styles/style-api' as style-api;
11
+
12
+ $props: (background-color, border-color, border-width, border-radius);
13
+ $tokens: style-api.resolve($props, carrier);
14
+ @include style-api.register($tokens);
15
+ @include style-api.docs('dropdown', $tokens);
10
16
 
11
17
  .root {
12
18
  @include styles.styles-reset;
@@ -41,14 +47,27 @@
41
47
  // Apply styles-reset to ensure font-family and other styles are properly set
42
48
  // when expandToViewport is true (dropdown rendered via portal to document.body)
43
49
  @include styles.styles-reset;
50
+ @include style-api.carriers($tokens);
44
51
  white-space: inherit;
45
52
  position: relative;
46
- background-color: awsui.$color-background-dropdown-item-default;
53
+ background-color: style-api.value($tokens, background-color, awsui.$color-background-dropdown-item-default);
47
54
  outline: none;
48
55
  @include styles.dropdown-shadow(
49
- $border-color: var(#{custom-props.$dropdownContentBorderColor}, #{awsui.$color-border-dropdown-container}),
50
- $border-width: var(#{custom-props.$dropdownContentBorderWidth}, #{awsui.$border-width-popover}),
51
- $border-radius: var(#{custom-props.$dropdownContentBorderRadius}, #{awsui.$border-radius-dropdown})
56
+ $border-color: style-api.value(
57
+ $tokens,
58
+ border-color,
59
+ var(#{custom-props.$dropdownContentBorderColor}, #{awsui.$color-border-dropdown-container})
60
+ ),
61
+ $border-width: style-api.value(
62
+ $tokens,
63
+ border-width,
64
+ var(#{custom-props.$dropdownContentBorderWidth}, #{awsui.$border-width-popover})
65
+ ),
66
+ $border-radius: style-api.value(
67
+ $tokens,
68
+ border-radius,
69
+ var(#{custom-props.$dropdownContentBorderRadius}, #{awsui.$border-radius-dropdown})
70
+ )
52
71
  );
53
72
 
54
73
  // Don't show dropdown border when there's no dropdown content
@@ -15,13 +15,6 @@ $border-offset-double: calc(2 * #{$border-offset});
15
15
  $divider-w: awsui.$border-divider-list-width;
16
16
  $neg-divider-w: calc(-1 * #{$divider-w});
17
17
 
18
- @mixin logical-radius($radius) {
19
- border-start-start-radius: $radius;
20
- border-start-end-radius: $radius;
21
- border-end-start-radius: $radius;
22
- border-end-end-radius: $radius;
23
- }
24
-
25
18
  @function add-offset($value, $offset: $border-offset) {
26
19
  @return calc(#{$value} + #{$offset});
27
20
  }
@@ -133,13 +126,14 @@ $neg-divider-w: calc(-1 * #{$divider-w});
133
126
  &.highlighted,
134
127
  &.selected {
135
128
  color: var(#{custom-props.$optionColorHighlighted}, #{awsui.$color-text-dropdown-item-highlighted});
136
- @include logical-radius(awsui.$border-radius-item);
129
+ @include styles.logical-radius(awsui.$border-radius-item);
137
130
  }
138
131
 
139
132
  &.highlighted {
140
133
  z-index: 3;
141
134
  background-color: var(#{custom-props.$optionBackgroundHighlighted}, #{awsui.$color-background-dropdown-item-hover});
142
135
  @include highlighted-shadow;
136
+ @include styles.logical-radius(awsui.$border-radius-dropdown);
143
137
  &.disabled {
144
138
  box-shadow: inset 0 0 0 $border-offset awsui.$color-border-dropdown-item-dimmed-hover;
145
139
  background-color: awsui.$color-background-dropdown-item-dimmed;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Build environment
3
- $awsui-commit-hash: "4b4d1f4b";
3
+ $awsui-commit-hash: "9963282c";
4
4
  // Manually managed CSS-variables
5
5
  $maxContentWidth: --awsui-max-content-width-66120l;
6
6
  $minContentWidth: --awsui-min-content-width-66120l;
@@ -9,9 +9,18 @@
9
9
  @use '@cloudscape-design/component-toolkit/internal/focus-visible' as focus-visible;
10
10
  @use '../../link/constants.scss' as constants;
11
11
  @use '../generated/custom-css-properties/index.scss' as custom-props;
12
+ @use './style-api' as style-api;
12
13
 
13
- @mixin link-variant-style($variant) {
14
- color: var(#{custom-props.$styleColorDefault}, map.get($variant, 'text-color-default'));
14
+ @function _link-color($tokens, $value) {
15
+ @if not $tokens {
16
+ @return $value;
17
+ }
18
+ @return style-api.value($tokens, color, $value);
19
+ }
20
+
21
+ // $tokens: optional Style API v2 token map from style-api.resolve.
22
+ @mixin link-variant-style($variant, $tokens: null) {
23
+ color: _link-color($tokens, var(#{custom-props.$styleColorDefault}, map.get($variant, 'text-color-default')));
15
24
  font-weight: map.get($variant, 'font-weight');
16
25
  letter-spacing: map.get($variant, 'letter-spacing');
17
26
  text-decoration-line: map.get($variant, 'decoration-line');
@@ -24,7 +33,7 @@
24
33
 
25
34
  &:hover {
26
35
  cursor: pointer;
27
- color: var(#{custom-props.$styleColorHover}, map.get($variant, 'text-color-hover'));
36
+ color: _link-color($tokens, var(#{custom-props.$styleColorHover}, map.get($variant, 'text-color-hover')));
28
37
  }
29
38
 
30
39
  &:focus {
@@ -32,7 +41,7 @@
32
41
  }
33
42
 
34
43
  &:active {
35
- color: var(#{custom-props.$styleColorActive}, map.get($variant, 'text-color-active'));
44
+ color: _link-color($tokens, var(#{custom-props.$styleColorActive}, map.get($variant, 'text-color-active')));
36
45
  }
37
46
 
38
47
  &:active,
@@ -49,9 +58,9 @@
49
58
  text-decoration-style: awsui.$font-decoration-style-link;
50
59
  }
51
60
 
52
- @mixin link-default($font-size: 'inherit') {
61
+ @mixin link-default($font-size: 'inherit', $tokens: null) {
53
62
  @include link-font-size-style(map.get(constants.$link-font-sizes, $font-size));
54
- @include link-variant-style(map.get(constants.$link-variants, 'secondary'));
63
+ @include link-variant-style(map.get(constants.$link-variants, 'secondary'), $tokens);
55
64
  }
56
65
 
57
66
  /* Style used for links in slots/components that are text heavy, to help links stand out among
@@ -42,6 +42,13 @@
42
42
  text-overflow: ellipsis;
43
43
  }
44
44
 
45
+ @mixin logical-radius($radius) {
46
+ border-start-start-radius: $radius;
47
+ border-start-end-radius: $radius;
48
+ border-end-start-radius: $radius;
49
+ border-end-end-radius: $radius;
50
+ }
51
+
45
52
  @mixin base-pseudo-element {
46
53
  content: '';
47
54
  position: absolute;
@@ -11,17 +11,30 @@
11
11
  @use '../internal/generated/custom-css-properties/index.scss' as custom-props;
12
12
  @use '../internal/styles/foundation' as foundation;
13
13
  @use '../internal/styles/utils/theming' as theming;
14
+ @use '../internal/styles/style-api' as style-api;
15
+
16
+ $tokens: style-api.resolve((color, focus-ring-color, focus-ring-width, focus-ring-radius), public);
17
+ @include style-api.register($tokens);
18
+ @include style-api.docs('root', $tokens);
19
+
20
+ @mixin focus-ring-box-shadow($color) {
21
+ #{custom-props.$styleFocusRingBoxShadow}: 0 0 0
22
+ style-api.value(
23
+ $tokens,
24
+ focus-ring-width,
25
+ var(#{custom-props.$styleFocusRingBorderWidth}, awsui.$border-link-focus-ring-shadow-spread)
26
+ )
27
+ style-api.value($tokens, focus-ring-color, var(#{custom-props.$styleFocusRingBorderColor}, $color));
28
+ }
14
29
 
15
30
  .link {
16
31
  @include styles.styles-reset;
17
32
  display: inline;
18
33
  white-space: inherit;
19
34
 
20
- #{custom-props.$styleFocusRingBoxShadow}: 0 0 0
21
- var(#{custom-props.$styleFocusRingBorderWidth}, awsui.$border-link-focus-ring-shadow-spread)
22
- var(#{custom-props.$styleFocusRingBorderColor}, awsui.$color-border-item-focused);
35
+ @include focus-ring-box-shadow(awsui.$color-border-item-focused);
23
36
 
24
- @include styles.link-default;
37
+ @include styles.link-default($tokens: $tokens);
25
38
 
26
39
  @each $variant in map.keys(constants.$link-variants) {
27
40
  &.variant-#{$variant} {
@@ -32,16 +45,16 @@
32
45
  -webkit-font-smoothing: inherit;
33
46
  -moz-osx-font-smoothing: inherit;
34
47
  }
35
- @include styles.link-variant-style(map.get(constants.$link-variants, $variant));
48
+ @include styles.link-variant-style(map.get(constants.$link-variants, $variant), $tokens);
36
49
  }
37
50
  }
38
51
 
39
52
  &.button {
40
53
  @include styles.font-smoothing;
41
- @include styles.link-variant-style(map.get(constants.$link-styles, 'button'));
54
+ @include styles.link-variant-style(map.get(constants.$link-styles, 'button'), $tokens);
42
55
 
43
56
  @include theming.one-theme-only {
44
- @include styles.link-variant-style(map.get(constants.$link-variants, 'primary'));
57
+ @include styles.link-variant-style(map.get(constants.$link-variants, 'primary'), $tokens);
45
58
  & {
46
59
  font-weight: inherit;
47
60
  letter-spacing: normal;
@@ -49,35 +62,41 @@
49
62
  -moz-osx-font-smoothing: auto;
50
63
  }
51
64
  &.color-inverted {
52
- color: awsui.$color-text-link-inverted-default;
65
+ color: style-api.value($tokens, color, awsui.$color-text-link-inverted-default);
53
66
  text-decoration-color: currentColor;
54
67
  &:hover {
55
- color: awsui.$color-text-link-inverted-hover;
68
+ color: style-api.value($tokens, color, awsui.$color-text-link-inverted-hover);
56
69
  }
57
70
  }
58
71
  }
59
72
  }
60
73
 
61
74
  &.color-inverted {
62
- color: awsui.$color-text-link-inverted-default;
75
+ color: style-api.value($tokens, color, awsui.$color-text-link-inverted-default);
63
76
  @include theming.one-theme-only {
64
- #{custom-props.$styleFocusRingBoxShadow}: 0 0 0
65
- var(#{custom-props.$styleFocusRingBorderWidth}, awsui.$border-link-focus-ring-shadow-spread)
66
- var(#{custom-props.$styleFocusRingBorderColor}, currentColor);
77
+ @include focus-ring-box-shadow(currentColor);
67
78
  }
68
79
  &:not(.button) {
69
80
  text-decoration-line: underline;
70
81
  text-decoration-color: currentColor;
71
82
  }
72
83
  &:hover {
73
- color: awsui.$color-text-link-inverted-hover;
84
+ color: style-api.value($tokens, color, awsui.$color-text-link-inverted-hover);
74
85
  }
75
86
  }
76
87
 
77
88
  @include focus-visible.when-visible {
78
89
  @include styles.link-focus(
79
- $border-color: var(#{custom-props.$styleFocusRingBorderColor}, awsui.$color-border-item-focused),
80
- $border-radius: var(#{custom-props.$styleFocusRingBorderRadius}, awsui.$border-radius-control-default-focus-ring),
90
+ $border-color: style-api.value(
91
+ $tokens,
92
+ focus-ring-color,
93
+ var(#{custom-props.$styleFocusRingBorderColor}, awsui.$color-border-item-focused)
94
+ ),
95
+ $border-radius: style-api.value(
96
+ $tokens,
97
+ focus-ring-radius,
98
+ var(#{custom-props.$styleFocusRingBorderRadius}, awsui.$border-radius-control-default-focus-ring)
99
+ ),
81
100
  $box-shadow: var(#{custom-props.$styleFocusRingBoxShadow})
82
101
  );
83
102
  }
@@ -64,13 +64,14 @@ $_background-overrides: (
64
64
  color: #{map.get($_color-overrides, $color)};
65
65
  }
66
66
  }
67
+
67
68
  @each $status in map.keys($_status-backgrounds) {
68
- &.status-#{$status} > .container {
69
+ &.status-#{$status}:not(.embedded) > .container {
69
70
  background: #{map.get($_status-backgrounds, $status)};
70
71
  }
71
72
  }
72
73
  @each $color in map.keys($_background-overrides) {
73
- &.color-override-#{$color} > .container {
74
+ &.color-override-#{$color}:not(.embedded) > .container {
74
75
  background: #{map.get($_background-overrides, $color)};
75
76
  }
76
77
  }
@@ -41,6 +41,9 @@ export interface BoxProps extends BaseComponentProps {
41
41
  * `full` together with `aspectRatio: 'equal'` to render a circle.
42
42
  *
43
43
  * Composes with existing Box props such as `padding` and `margin`.
44
+ *
45
+ * This is a One Theme only feature and must not be used in VR.
46
+ * @awsuiSystem one-theme
44
47
  */
45
48
  visualAccent?: BoxProps.VisualAccent;
46
49
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/box/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,WAAW,QAAS,SAAQ,kBAAkB;IAClD;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC;IAC3B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC;IAC3B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,EAA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AAO,CAAC;IACrC,KAAY,QAAQ,GAChB,QAAQ,GACR,QAAQ,GACR,YAAY,GACZ,WAAW,GACX,WAAW,GACX,WAAW,GACX,YAAY,GACZ,WAAW,GACX,YAAY,CAAC;IACjB,KAAY,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IAC/D,KAAY,KAAK,GACb,SAAS,GACT,YAAY,GACZ,qBAAqB,GACrB,mBAAmB,GACnB,qBAAqB,GACrB,kBAAkB,GAClB,sBAAsB,GACtB,qBAAqB,CAAC;IAC1B,KAAY,WAAW,GAAG,GAAG,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;IAChG,UAAiB,OAAO;QACtB,GAAG,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;QAC3B,KAAK,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;QAC7B,MAAM,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;QAC9B,IAAI,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;QAC5B,UAAU,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;QAClC,QAAQ,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;KACjC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/box/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../types/base-component';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../types/native-attributes';\n\nexport interface BoxProps extends BaseComponentProps {\n /**\n * Defines the style of element to display.\n *\n * - If you set it to `'div'`, `'span'`, `'h1'`, `'h2'`, `'h3'`, `'h4'`, `'h5'`, `'p'`, `'strong'`, `'small'`, `'code'`, `'pre'`, or `'samp'`, the variant is also used as the HTML tag name.\n * - If you set it to `awsui-key-label`, the component will render a `div`,\n * styled for use as a key label in key-value pairs.\n * - If you set it to `awsui-gen-ai-label`, the component will render a `div`,\n * styled for use as a label indicating that content is produced by generative AI.\n * - If you set it to `awsui-value-large`, the component will render a `span`,\n * styled using \"Display large light\" typography.\n * - If you set it to `awsui-inline-code`, the component will render a `code` element,\n * styled with a background and padding for inline code snippets.\n *\n * Override the HTML tag by using property `tagOverride`.\n */\n variant?: BoxProps.Variant;\n /**\n * Renders the box as a visual accent wrapper to emphasize its content.\n *\n * Setting this property activates the accent styling: a coordinated background and content\n * color combination that works in both light and dark modes. A `variant` is not required to\n * activate the accent. The accent styling is applied on top of the element determined by\n * `variant` (or `tagOverride`), so the rendered HTML tag is unaffected.\n *\n * The object accepts the following fields:\n * - `color` (required) — the coordinated background and foreground color pair. The foreground\n * color is applied as the wrapper's CSS `color`, so it only affects content that inherits\n * the current color (for example an `Icon`, or a nested `Box` with `color=\"inherit\"`).\n * Content that sets its own color is not overridden.\n * - `aspectRatio` — `auto` (default) lets the wrapper's width follow its content;\n * `equal` forces equal width and height, suitable for wrapping icons.\n * - `borderRadius` — the corner rounding applied to the wrapper, using a t-shirt size keyword\n * from the Box spacing scale (`xxxs`, `xxs`, `xs`, `s`, `m`, `l`, `xl`, `xxl`, `xxxl`), or\n * `full` for fully rounded corners. When not set, the wrapper has no border radius. Set it to\n * `full` together with `aspectRatio: 'equal'` to render a circle.\n *\n * Composes with existing Box props such as `padding` and `margin`.\n */\n visualAccent?: BoxProps.VisualAccent;\n /**\n * Overrides the default HTML tag provided by the variant.\n */\n tagOverride?: string;\n /**\n * Overrides the display of the element. You can set it to the following values:\n *\n * - `block` - Specifies block display.\n * - `inline` - Specifies inline display.\n * - `inline-block` - Specifies inline-block display.\n * - `none` - Hides the box.\n *\n * Note: If you don't set it, the display depends on the variant.\n */\n display?: BoxProps.Display;\n /**\n * Adds margins to the element. It can be the following:\n *\n * - A single string with a size. This applies the same margin to all sides (that is, top, right, bottom, left).\n * - An object specifying the size of the margin per side. The object has the following format:\n * ```\n * {\n * top: \"size of top margin\",\n * right: \"size of right margin\",\n * bottom: \"size of bottom margin\",\n * left: \"size of left margin\",\n * horizontal: \"size of left and right margin\",\n * vertical: \"size of top and bottom margin\",\n * }\n * ```\n *\n * The size can be `n`, `xxxs`, `xxs`, `xs`, `s`, `m`, `l`, `xl`, `xxl`, `xxxl`, where `n` stands for none.\n * Sizes are automatically scaled down in compact mode.\n *\n * For example, `margin=\"s\"` adds a small margin to all sides.\n * `margin={{ right: \"l\", bottom: \"s\" }}` adds a small margin to the bottom and a large margin to the right.\n */\n margin?: BoxProps.SpacingSize | BoxProps.Spacing;\n /**\n * Adds padding to the element. It can be the following:\n *\n * - A single string with a size. This applies the same padding to all sides (that is, top, right, bottom, left).\n * - An object specifying the size of padding per side. The object has the following format:\n * ```\n * {\n * top: \"size of top padding\",\n * right: \"size of right padding\",\n * bottom: \"size of bottom padding\",\n * left: \"size of left padding\",\n * horizontal: \"size of left and right padding\",\n * vertical: \"size of top and bottom padding\",\n * }\n * ```\n *\n * The size can be `n`, `xxxs`, `xxs`, `xs`, `s`, `m`, `l`, `xl`, `xxl`, `xxxl`, where `n` stands for none.\n * Sizes are automatically scaled down in compact mode.\n *\n * For example, `padding=\"s\"` adds small padding to all sides.\n * `padding={{ right: \"l\", bottom: \"s\" }}` adds small padding to the bottom and large padding to the right.\n */\n padding?: BoxProps.SpacingSize | BoxProps.Spacing;\n /**\n * Defines the text alignment within the element. You can set it to `left`, `center`, or `right`.\n */\n textAlign?: BoxProps.TextAlign;\n /**\n * Defines the floating behavior. You can set it to `left` or `right`.\n */\n float?: BoxProps.Float;\n /**\n * Overrides the font size and line height. If not set, the font size and line height depend on the variant.\n */\n fontSize?: BoxProps.FontSize;\n /**\n * Overrides the font weight. If not set, the value depends on the variant.\n * @visualrefresh 'heavy'\n */\n fontWeight?: BoxProps.FontWeight;\n /**\n * Overrides the text color. You can set it to the following values:\n *\n * - `inherit` - Inherits the color from the parent element. For example, use this to style content\n * in Flashbars and to style the `empty` and `noMatch` slots of the Table and Cards components.\n * - `text-label` - Specifies the text color for non-form labels. For example, use it for the key in key/value pairs.\n * - `text-body-secondary` - Specifies the color for secondary text.\n * - `text-status-error` - Specifies the color for error text and icons.\n * - `text-status-success` - Specifies the color for success text and icons.\n * - `text-status-info` - Specifies the color for info text and icon.\n * - `text-status-inactive` - Specifies the color for inactive and loading text and icons.\n * - `text-status-warning` - Specifies the color for warning text and icons.\n *\n * Note: If you don't set it, the text color depends on the variant.\n */\n color?: BoxProps.Color;\n /**\n * Content of the box.\n * @displayname content\n */\n children?: React.ReactNode;\n\n /**\n * Attributes to add to the native element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLElement>>;\n}\n\nexport namespace BoxProps {\n export type Variant =\n | 'div'\n | 'span'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'p'\n | 'strong'\n | 'small'\n | 'code'\n | 'pre'\n | 'samp'\n | 'awsui-key-label'\n | 'awsui-gen-ai-label'\n | 'awsui-value-large'\n | 'awsui-inline-code';\n\n export interface VisualAccent {\n /**\n * The coordinated background and foreground color pair applied to the accent wrapper.\n * Each color works in both light and dark modes.\n *\n * The background color is applied directly to the wrapper. The foreground color is applied\n * as the wrapper's CSS `color` and is therefore only picked up by content that inherits the\n * current color, such as an `Icon` or a nested `Box` with `color=\"inherit\"`. Content that\n * defines its own color (for example a `Box` with an explicit `color`, or a `Link`) keeps that\n * color and is not recolored by the accent.\n */\n color: BoxProps.VisualAccent.Color;\n /**\n * Controls the aspect ratio of the accent wrapper.\n *\n * - `auto` (default) — the wrapper's width follows its content.\n * - `equal` — the wrapper has equal width and height, suitable for wrapping icons.\n *\n * Combine `aspectRatio: 'equal'` with `borderRadius: 'full'` to render a circle.\n */\n aspectRatio?: BoxProps.VisualAccent.AspectRatio;\n /**\n * The corner rounding applied to the accent wrapper. When not set, the wrapper has no\n * border radius.\n *\n * Use one of the curated t-shirt size keywords, which map to the same spacing scale used by\n * `padding` and `margin`: `xxxs`, `xxs`, `xs`, `s`, `m`, `l`, `xl`, `xxl`, or `xxxl`. Use\n * `full` for fully rounded corners; combine it with `aspectRatio: 'equal'` to render a circle.\n */\n borderRadius?: BoxProps.VisualAccent.BorderRadius;\n }\n\n export namespace VisualAccent {\n export type Color =\n | 'red'\n | 'yellow'\n | 'indigo'\n | 'green'\n | 'orange'\n | 'purple'\n | 'lime'\n | 'grey'\n | 'teal'\n | 'blue'\n | 'violet'\n | 'magenta'\n | 'pink'\n | 'amber';\n export type AspectRatio = 'auto' | 'equal';\n export type BorderRadius = 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl' | 'full';\n }\n\n export type Display = 'block' | 'inline' | 'inline-block' | 'none';\n export type TextAlign = 'left' | 'center' | 'right';\n export type Float = 'left' | 'right';\n export type FontSize =\n | 'body-s'\n | 'body-m'\n | 'heading-xs'\n | 'heading-s'\n | 'heading-m'\n | 'heading-l'\n | 'heading-xl'\n | 'display-l'\n | 'display-xl';\n export type FontWeight = 'light' | 'normal' | 'bold' | 'heavy';\n export type Color =\n | 'inherit'\n | 'text-label'\n | 'text-body-secondary'\n | 'text-status-error'\n | 'text-status-success'\n | 'text-status-info'\n | 'text-status-inactive'\n | 'text-status-warning';\n export type SpacingSize = 'n' | 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl';\n export interface Spacing {\n top?: BoxProps.SpacingSize;\n right?: BoxProps.SpacingSize;\n bottom?: BoxProps.SpacingSize;\n left?: BoxProps.SpacingSize;\n horizontal?: BoxProps.SpacingSize;\n vertical?: BoxProps.SpacingSize;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/box/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../types/base-component';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../types/native-attributes';\n\nexport interface BoxProps extends BaseComponentProps {\n /**\n * Defines the style of element to display.\n *\n * - If you set it to `'div'`, `'span'`, `'h1'`, `'h2'`, `'h3'`, `'h4'`, `'h5'`, `'p'`, `'strong'`, `'small'`, `'code'`, `'pre'`, or `'samp'`, the variant is also used as the HTML tag name.\n * - If you set it to `awsui-key-label`, the component will render a `div`,\n * styled for use as a key label in key-value pairs.\n * - If you set it to `awsui-gen-ai-label`, the component will render a `div`,\n * styled for use as a label indicating that content is produced by generative AI.\n * - If you set it to `awsui-value-large`, the component will render a `span`,\n * styled using \"Display large light\" typography.\n * - If you set it to `awsui-inline-code`, the component will render a `code` element,\n * styled with a background and padding for inline code snippets.\n *\n * Override the HTML tag by using property `tagOverride`.\n */\n variant?: BoxProps.Variant;\n /**\n * Renders the box as a visual accent wrapper to emphasize its content.\n *\n * Setting this property activates the accent styling: a coordinated background and content\n * color combination that works in both light and dark modes. A `variant` is not required to\n * activate the accent. The accent styling is applied on top of the element determined by\n * `variant` (or `tagOverride`), so the rendered HTML tag is unaffected.\n *\n * The object accepts the following fields:\n * - `color` (required) — the coordinated background and foreground color pair. The foreground\n * color is applied as the wrapper's CSS `color`, so it only affects content that inherits\n * the current color (for example an `Icon`, or a nested `Box` with `color=\"inherit\"`).\n * Content that sets its own color is not overridden.\n * - `aspectRatio` — `auto` (default) lets the wrapper's width follow its content;\n * `equal` forces equal width and height, suitable for wrapping icons.\n * - `borderRadius` — the corner rounding applied to the wrapper, using a t-shirt size keyword\n * from the Box spacing scale (`xxxs`, `xxs`, `xs`, `s`, `m`, `l`, `xl`, `xxl`, `xxxl`), or\n * `full` for fully rounded corners. When not set, the wrapper has no border radius. Set it to\n * `full` together with `aspectRatio: 'equal'` to render a circle.\n *\n * Composes with existing Box props such as `padding` and `margin`.\n *\n * This is a One Theme only feature and must not be used in VR.\n * @awsuiSystem one-theme\n */\n visualAccent?: BoxProps.VisualAccent;\n /**\n * Overrides the default HTML tag provided by the variant.\n */\n tagOverride?: string;\n /**\n * Overrides the display of the element. You can set it to the following values:\n *\n * - `block` - Specifies block display.\n * - `inline` - Specifies inline display.\n * - `inline-block` - Specifies inline-block display.\n * - `none` - Hides the box.\n *\n * Note: If you don't set it, the display depends on the variant.\n */\n display?: BoxProps.Display;\n /**\n * Adds margins to the element. It can be the following:\n *\n * - A single string with a size. This applies the same margin to all sides (that is, top, right, bottom, left).\n * - An object specifying the size of the margin per side. The object has the following format:\n * ```\n * {\n * top: \"size of top margin\",\n * right: \"size of right margin\",\n * bottom: \"size of bottom margin\",\n * left: \"size of left margin\",\n * horizontal: \"size of left and right margin\",\n * vertical: \"size of top and bottom margin\",\n * }\n * ```\n *\n * The size can be `n`, `xxxs`, `xxs`, `xs`, `s`, `m`, `l`, `xl`, `xxl`, `xxxl`, where `n` stands for none.\n * Sizes are automatically scaled down in compact mode.\n *\n * For example, `margin=\"s\"` adds a small margin to all sides.\n * `margin={{ right: \"l\", bottom: \"s\" }}` adds a small margin to the bottom and a large margin to the right.\n */\n margin?: BoxProps.SpacingSize | BoxProps.Spacing;\n /**\n * Adds padding to the element. It can be the following:\n *\n * - A single string with a size. This applies the same padding to all sides (that is, top, right, bottom, left).\n * - An object specifying the size of padding per side. The object has the following format:\n * ```\n * {\n * top: \"size of top padding\",\n * right: \"size of right padding\",\n * bottom: \"size of bottom padding\",\n * left: \"size of left padding\",\n * horizontal: \"size of left and right padding\",\n * vertical: \"size of top and bottom padding\",\n * }\n * ```\n *\n * The size can be `n`, `xxxs`, `xxs`, `xs`, `s`, `m`, `l`, `xl`, `xxl`, `xxxl`, where `n` stands for none.\n * Sizes are automatically scaled down in compact mode.\n *\n * For example, `padding=\"s\"` adds small padding to all sides.\n * `padding={{ right: \"l\", bottom: \"s\" }}` adds small padding to the bottom and large padding to the right.\n */\n padding?: BoxProps.SpacingSize | BoxProps.Spacing;\n /**\n * Defines the text alignment within the element. You can set it to `left`, `center`, or `right`.\n */\n textAlign?: BoxProps.TextAlign;\n /**\n * Defines the floating behavior. You can set it to `left` or `right`.\n */\n float?: BoxProps.Float;\n /**\n * Overrides the font size and line height. If not set, the font size and line height depend on the variant.\n */\n fontSize?: BoxProps.FontSize;\n /**\n * Overrides the font weight. If not set, the value depends on the variant.\n * @visualrefresh 'heavy'\n */\n fontWeight?: BoxProps.FontWeight;\n /**\n * Overrides the text color. You can set it to the following values:\n *\n * - `inherit` - Inherits the color from the parent element. For example, use this to style content\n * in Flashbars and to style the `empty` and `noMatch` slots of the Table and Cards components.\n * - `text-label` - Specifies the text color for non-form labels. For example, use it for the key in key/value pairs.\n * - `text-body-secondary` - Specifies the color for secondary text.\n * - `text-status-error` - Specifies the color for error text and icons.\n * - `text-status-success` - Specifies the color for success text and icons.\n * - `text-status-info` - Specifies the color for info text and icon.\n * - `text-status-inactive` - Specifies the color for inactive and loading text and icons.\n * - `text-status-warning` - Specifies the color for warning text and icons.\n *\n * Note: If you don't set it, the text color depends on the variant.\n */\n color?: BoxProps.Color;\n /**\n * Content of the box.\n * @displayname content\n */\n children?: React.ReactNode;\n\n /**\n * Attributes to add to the native element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLElement>>;\n}\n\nexport namespace BoxProps {\n export type Variant =\n | 'div'\n | 'span'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'p'\n | 'strong'\n | 'small'\n | 'code'\n | 'pre'\n | 'samp'\n | 'awsui-key-label'\n | 'awsui-gen-ai-label'\n | 'awsui-value-large'\n | 'awsui-inline-code';\n\n export interface VisualAccent {\n /**\n * The coordinated background and foreground color pair applied to the accent wrapper.\n * Each color works in both light and dark modes.\n *\n * The background color is applied directly to the wrapper. The foreground color is applied\n * as the wrapper's CSS `color` and is therefore only picked up by content that inherits the\n * current color, such as an `Icon` or a nested `Box` with `color=\"inherit\"`. Content that\n * defines its own color (for example a `Box` with an explicit `color`, or a `Link`) keeps that\n * color and is not recolored by the accent.\n */\n color: BoxProps.VisualAccent.Color;\n /**\n * Controls the aspect ratio of the accent wrapper.\n *\n * - `auto` (default) — the wrapper's width follows its content.\n * - `equal` — the wrapper has equal width and height, suitable for wrapping icons.\n *\n * Combine `aspectRatio: 'equal'` with `borderRadius: 'full'` to render a circle.\n */\n aspectRatio?: BoxProps.VisualAccent.AspectRatio;\n /**\n * The corner rounding applied to the accent wrapper. When not set, the wrapper has no\n * border radius.\n *\n * Use one of the curated t-shirt size keywords, which map to the same spacing scale used by\n * `padding` and `margin`: `xxxs`, `xxs`, `xs`, `s`, `m`, `l`, `xl`, `xxl`, or `xxxl`. Use\n * `full` for fully rounded corners; combine it with `aspectRatio: 'equal'` to render a circle.\n */\n borderRadius?: BoxProps.VisualAccent.BorderRadius;\n }\n\n export namespace VisualAccent {\n export type Color =\n | 'red'\n | 'yellow'\n | 'indigo'\n | 'green'\n | 'orange'\n | 'purple'\n | 'lime'\n | 'grey'\n | 'teal'\n | 'blue'\n | 'violet'\n | 'magenta'\n | 'pink'\n | 'amber';\n export type AspectRatio = 'auto' | 'equal';\n export type BorderRadius = 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl' | 'full';\n }\n\n export type Display = 'block' | 'inline' | 'inline-block' | 'none';\n export type TextAlign = 'left' | 'center' | 'right';\n export type Float = 'left' | 'right';\n export type FontSize =\n | 'body-s'\n | 'body-m'\n | 'heading-xs'\n | 'heading-s'\n | 'heading-m'\n | 'heading-l'\n | 'heading-xl'\n | 'display-l'\n | 'display-xl';\n export type FontWeight = 'light' | 'normal' | 'bold' | 'heavy';\n export type Color =\n | 'inherit'\n | 'text-label'\n | 'text-body-secondary'\n | 'text-status-error'\n | 'text-status-success'\n | 'text-status-info'\n | 'text-status-inactive'\n | 'text-status-warning';\n export type SpacingSize = 'n' | 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl';\n export interface Spacing {\n top?: BoxProps.SpacingSize;\n right?: BoxProps.SpacingSize;\n bottom?: BoxProps.SpacingSize;\n left?: BoxProps.SpacingSize;\n horizontal?: BoxProps.SpacingSize;\n vertical?: BoxProps.SpacingSize;\n }\n}\n"]}
@@ -14,7 +14,6 @@ export interface BaseButtonProps {
14
14
  /**
15
15
  * Provides a reason why the button is disabled (only when `disabled` is `true`).
16
16
  * If provided, the button becomes focusable.
17
- * Applicable for all button variants, except link.
18
17
  */
19
18
  disabledReason?: string;
20
19
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/button/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC5G;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS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"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../types/base-component';\nimport { BaseNavigationDetail, CancelableEventHandler, ClickDetail as _ClickDetail } from '../types/events';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../types/native-attributes';\n\nexport interface BaseButtonProps {\n /**\n * Renders the button as disabled and prevents clicks.\n */\n disabled?: boolean;\n /**\n * Provides a reason why the button is disabled (only when `disabled` is `true`).\n * If provided, the button becomes focusable.\n * Applicable for all button variants, except link.\n */\n disabledReason?: string;\n /**\n * Renders the button as being in a loading state. It takes precedence over the `disabled` if both are set to `true`.\n * It prevents users from clicking the button, but it can still be focused.\n */\n loading?: boolean;\n /**\n * Specifies the text that screen reader announces when the button is in a loading state.\n */\n loadingText?: string;\n /**\n * Displays an icon next to the text. You can use the `iconAlign` property to position the icon.\n */\n iconName?: IconProps.Name;\n /**\n * Specifies the URL of a custom icon. Use this property if the icon you want isn't available.\n *\n * If you set both `iconUrl` and `iconSvg`, `iconSvg` will take precedence.\n */\n iconUrl?: string;\n /**\n * Specifies the SVG of a custom icon.\n *\n * Use this property if you want your custom icon to inherit colors dictated by variant or hover states.\n * When this property is set, the component will be decorated with `aria-hidden=\"true\"`. Ensure that the `svg` element:\n * - has attribute `focusable=\"false\"`.\n * - has `viewBox=\"0 0 16 16\"`.\n *\n * If you set the `svg` element as the root node of the slot, the component will automatically\n * - set `stroke=\"currentColor\"`, `fill=\"none\"`, and `vertical-align=\"top\"`.\n * - set the stroke width based on the size of the icon.\n * - set the width and height of the SVG element based on the size of the icon.\n *\n * If you don't want these styles to be automatically set, wrap the `svg` element into a `span`.\n * You can still set the stroke to `currentColor` to inherit the color of the surrounding elements.\n *\n * If you set both `iconUrl` and `iconSvg`, `iconSvg` will take precedence.\n *\n * *Note:* Remember to remove any additional elements (for example: `defs`) and related CSS classes from SVG files exported from design software.\n * In most cases, they aren't needed, as the `svg` element inherits styles from the icon component.\n */\n iconSvg?: React.ReactNode;\n\n /**\n * Adds `aria-label` to the button element. Use this to provide an accessible name for buttons\n * that don't have visible text, and to distinguish between multiple buttons with identical visible text.\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 /**\n * Specifies if the `text` content wraps. If you set it to `false`, it prevents the text from wrapping.\n */\n wrapText?: boolean;\n\n /**\n * Text displayed in the button element.\n * @displayname text\n */\n children?: React.ReactNode;\n\n /**\n * Adds `aria-controls` to the button. Use when the button controls the contents or presence of an element.\n */\n ariaControls?: string;\n\n /**\n * Adds an external icon after the button label text.\n * If an href is provided, it opens the link in a new tab.\n */\n external?: boolean;\n\n /**\n * An object containing all the necessary localized strings required by the component. The object should contain:\n *\n * * `externalIconAriaLabel` - (optional) Specifies the aria-label for the external icon when `external` is set to `true`.\n * @i18n\n */\n i18nStrings?: ButtonProps.I18nStrings;\n\n /**\n * Attributes to add to the native `button` element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeButtonAttributes?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n\n /**\n * Attributes to add to the native `a` element (when `href` is provided).\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeAnchorAttributes?: NativeAttributes<React.AnchorHTMLAttributes<HTMLAnchorElement>>;\n}\n\nexport interface ButtonProps extends BaseComponentProps, BaseButtonProps {\n /**\n * Specifies the alignment of the icon.\n */\n iconAlign?: ButtonProps.IconAlign;\n\n /**\n * The form action that is performed by a button click.\n */\n formAction?: ButtonProps.FormAction;\n\n /**\n * Applies button styling to a link. Use this property if you need a link styled as a button (`variant=link`).\n * For example, if you have a 'help' button that links to a documentation page.\n */\n href?: string;\n\n /**\n * Specifies where to open the linked URL (for example, to open in a new browser window or tab use `_blank`).\n * This property only applies when an `href` is provided.\n */\n target?: string;\n\n /**\n * Adds a `rel` attribute to the link. By default, the component sets the `rel` attribute to \"noopener noreferrer\" when `target` is `\"_blank\"`.\n * If the `rel` property is provided, it overrides the default behavior.\n */\n rel?: string;\n\n /**\n * Specifies whether the linked URL, when selected, will prompt the user to download instead of navigate.\n * You can specify a string value that will be suggested as the name of the downloaded file.\n * This property only applies when an `href` is provided.\n **/\n download?: boolean | string;\n\n /** The id of the <form> element to associate with the button. The value of this attribute must be the id of a <form> in the same document.\n * Use when a button is not the descendant of a form element, such as when used in a modal.\n */\n form?: string;\n\n /**\n * Adds aria-expanded to the button element. Use when the button controls an expandable element.\n */\n ariaExpanded?: boolean;\n\n /**\n * Adds `aria-haspopup` to the button element. Use when the button triggers a popup element such as a menu, listbox, tree, grid, or dialog.\n */\n ariaHaspopup?: boolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';\n\n /**\n * Called when the user clicks on the button and the button is not disabled or in loading state.\n */\n onClick?: CancelableEventHandler<ButtonProps.ClickDetail>;\n\n /**\n * Called when the user clicks on the button with the left mouse button without pressing\n * modifier keys (that is, CTRL, ALT, SHIFT, META), and the button has an `href` set.\n */\n onFollow?: CancelableEventHandler<ButtonProps.FollowDetail>;\n\n /**\n * Sets the button width to be 100% of the parent container width. Button content is centered.\n */\n fullWidth?: boolean;\n\n /** Determines the general styling of the button as follows:\n * * `primary` for primary buttons.\n * * `normal` for secondary buttons.\n * * `link` for tertiary buttons.\n * * `icon` to display an icon only (no text).\n * * `inline-icon` to display an icon-only (no text) button within a text context.\n * * `inline-link` to display a tertiary button with no outer padding.\n */\n variant?: ButtonProps.Variant;\n\n /**\n * Specifies alternate text for a custom icon. We recommend that you provide this for accessibility.\n * This property is ignored if you use a predefined icon or if you set your custom icon using the `iconSvg` slot.\n */\n iconAlt?: string;\n\n /**\n * An object containing CSS properties to customize the button's visual appearance.\n * Refer to the [style](/components/button/?tabId=style) tab for more details.\n * @awsuiSystem core\n */\n style?: ButtonProps.Style;\n}\n\nexport namespace ButtonProps {\n export type Variant = 'normal' | 'primary' | 'link' | 'icon' | 'inline-icon' | 'inline-link';\n export type ClickDetail = _ClickDetail;\n export type FollowDetail = BaseNavigationDetail;\n\n export type FormAction = 'submit' | 'none';\n\n export type IconAlign = 'left' | 'right';\n\n export interface I18nStrings {\n /**\n * Specifies the aria-label for the external icon when `external` is set to `true`.\n */\n externalIconAriaLabel?: string;\n }\n\n export interface Ref {\n /**\n * Focuses the underlying native button.\n */\n focus(options?: FocusOptions): void;\n }\n\n export interface Style {\n root?: {\n background?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n borderColor?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n boxShadow?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n color?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n paddingBlock?: string;\n paddingInline?: string;\n };\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/button/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../types/base-component';\nimport { BaseNavigationDetail, CancelableEventHandler, ClickDetail as _ClickDetail } from '../types/events';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../types/native-attributes';\n\nexport interface BaseButtonProps {\n /**\n * Renders the button as disabled and prevents clicks.\n */\n disabled?: boolean;\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 * Renders the button as being in a loading state. It takes precedence over the `disabled` if both are set to `true`.\n * It prevents users from clicking the button, but it can still be focused.\n */\n loading?: boolean;\n /**\n * Specifies the text that screen reader announces when the button is in a loading state.\n */\n loadingText?: string;\n /**\n * Displays an icon next to the text. You can use the `iconAlign` property to position the icon.\n */\n iconName?: IconProps.Name;\n /**\n * Specifies the URL of a custom icon. Use this property if the icon you want isn't available.\n *\n * If you set both `iconUrl` and `iconSvg`, `iconSvg` will take precedence.\n */\n iconUrl?: string;\n /**\n * Specifies the SVG of a custom icon.\n *\n * Use this property if you want your custom icon to inherit colors dictated by variant or hover states.\n * When this property is set, the component will be decorated with `aria-hidden=\"true\"`. Ensure that the `svg` element:\n * - has attribute `focusable=\"false\"`.\n * - has `viewBox=\"0 0 16 16\"`.\n *\n * If you set the `svg` element as the root node of the slot, the component will automatically\n * - set `stroke=\"currentColor\"`, `fill=\"none\"`, and `vertical-align=\"top\"`.\n * - set the stroke width based on the size of the icon.\n * - set the width and height of the SVG element based on the size of the icon.\n *\n * If you don't want these styles to be automatically set, wrap the `svg` element into a `span`.\n * You can still set the stroke to `currentColor` to inherit the color of the surrounding elements.\n *\n * If you set both `iconUrl` and `iconSvg`, `iconSvg` will take precedence.\n *\n * *Note:* Remember to remove any additional elements (for example: `defs`) and related CSS classes from SVG files exported from design software.\n * In most cases, they aren't needed, as the `svg` element inherits styles from the icon component.\n */\n iconSvg?: React.ReactNode;\n\n /**\n * Adds `aria-label` to the button element. Use this to provide an accessible name for buttons\n * that don't have visible text, and to distinguish between multiple buttons with identical visible text.\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 /**\n * Specifies if the `text` content wraps. If you set it to `false`, it prevents the text from wrapping.\n */\n wrapText?: boolean;\n\n /**\n * Text displayed in the button element.\n * @displayname text\n */\n children?: React.ReactNode;\n\n /**\n * Adds `aria-controls` to the button. Use when the button controls the contents or presence of an element.\n */\n ariaControls?: string;\n\n /**\n * Adds an external icon after the button label text.\n * If an href is provided, it opens the link in a new tab.\n */\n external?: boolean;\n\n /**\n * An object containing all the necessary localized strings required by the component. The object should contain:\n *\n * * `externalIconAriaLabel` - (optional) Specifies the aria-label for the external icon when `external` is set to `true`.\n * @i18n\n */\n i18nStrings?: ButtonProps.I18nStrings;\n\n /**\n * Attributes to add to the native `button` element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeButtonAttributes?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n\n /**\n * Attributes to add to the native `a` element (when `href` is provided).\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeAnchorAttributes?: NativeAttributes<React.AnchorHTMLAttributes<HTMLAnchorElement>>;\n}\n\nexport interface ButtonProps extends BaseComponentProps, BaseButtonProps {\n /**\n * Specifies the alignment of the icon.\n */\n iconAlign?: ButtonProps.IconAlign;\n\n /**\n * The form action that is performed by a button click.\n */\n formAction?: ButtonProps.FormAction;\n\n /**\n * Applies button styling to a link. Use this property if you need a link styled as a button (`variant=link`).\n * For example, if you have a 'help' button that links to a documentation page.\n */\n href?: string;\n\n /**\n * Specifies where to open the linked URL (for example, to open in a new browser window or tab use `_blank`).\n * This property only applies when an `href` is provided.\n */\n target?: string;\n\n /**\n * Adds a `rel` attribute to the link. By default, the component sets the `rel` attribute to \"noopener noreferrer\" when `target` is `\"_blank\"`.\n * If the `rel` property is provided, it overrides the default behavior.\n */\n rel?: string;\n\n /**\n * Specifies whether the linked URL, when selected, will prompt the user to download instead of navigate.\n * You can specify a string value that will be suggested as the name of the downloaded file.\n * This property only applies when an `href` is provided.\n **/\n download?: boolean | string;\n\n /** The id of the <form> element to associate with the button. The value of this attribute must be the id of a <form> in the same document.\n * Use when a button is not the descendant of a form element, such as when used in a modal.\n */\n form?: string;\n\n /**\n * Adds aria-expanded to the button element. Use when the button controls an expandable element.\n */\n ariaExpanded?: boolean;\n\n /**\n * Adds `aria-haspopup` to the button element. Use when the button triggers a popup element such as a menu, listbox, tree, grid, or dialog.\n */\n ariaHaspopup?: boolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';\n\n /**\n * Called when the user clicks on the button and the button is not disabled or in loading state.\n */\n onClick?: CancelableEventHandler<ButtonProps.ClickDetail>;\n\n /**\n * Called when the user clicks on the button with the left mouse button without pressing\n * modifier keys (that is, CTRL, ALT, SHIFT, META), and the button has an `href` set.\n */\n onFollow?: CancelableEventHandler<ButtonProps.FollowDetail>;\n\n /**\n * Sets the button width to be 100% of the parent container width. Button content is centered.\n */\n fullWidth?: boolean;\n\n /** Determines the general styling of the button as follows:\n * * `primary` for primary buttons.\n * * `normal` for secondary buttons.\n * * `link` for tertiary buttons.\n * * `icon` to display an icon only (no text).\n * * `inline-icon` to display an icon-only (no text) button within a text context.\n * * `inline-link` to display a tertiary button with no outer padding.\n */\n variant?: ButtonProps.Variant;\n\n /**\n * Specifies alternate text for a custom icon. We recommend that you provide this for accessibility.\n * This property is ignored if you use a predefined icon or if you set your custom icon using the `iconSvg` slot.\n */\n iconAlt?: string;\n\n /**\n * An object containing CSS properties to customize the button's visual appearance.\n * Refer to the [style](/components/button/?tabId=style) tab for more details.\n * @awsuiSystem core\n */\n style?: ButtonProps.Style;\n}\n\nexport namespace ButtonProps {\n export type Variant = 'normal' | 'primary' | 'link' | 'icon' | 'inline-icon' | 'inline-link';\n export type ClickDetail = _ClickDetail;\n export type FollowDetail = BaseNavigationDetail;\n\n export type FormAction = 'submit' | 'none';\n\n export type IconAlign = 'left' | 'right';\n\n export interface I18nStrings {\n /**\n * Specifies the aria-label for the external icon when `external` is set to `true`.\n */\n externalIconAriaLabel?: string;\n }\n\n export interface Ref {\n /**\n * Focuses the underlying native button.\n */\n focus(options?: FocusOptions): void;\n }\n\n export interface Style {\n root?: {\n background?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n borderColor?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n boxShadow?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n color?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n paddingBlock?: string;\n paddingInline?: string;\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/button/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAW3D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAa/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAUlF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAO3C,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG;IAC/D,OAAO,CAAC,EACJ,WAAW,CAAC,SAAS,CAAC,GACtB,eAAe,GACf,kBAAkB,GAClB,cAAc,GACd,eAAe,GACf,4BAA4B,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,8BAA8B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sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,8BAA8B,CAAC,EAAE,OAAO,CAAC;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,GAAG,0BAA0B,CAAC;AAG/B,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,cAAc;cAxBrB,WAAW,CAAC,SAAS,CAAC,GACtB,eAAe,GACf,kBAAkB,GAClB,cAAc,GACd,eAAe,GACf,4BAA4B;YACxB,OAAO;sBACG,MAAM;kBACV,MAAM;iBACP,SAAS,CAAC,IAAI;kBACb,OAAO;yCACgB,OAAO;cAClC,MAAM;6BACS,OAAO;qCACC,OAAO;gBAC5B,OAAO;sBACD,eAAe;sEAqUlC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -32,7 +32,14 @@ export const InternalButton = React.forwardRef(({ children, iconName, __iconClas
32
32
  const isAnchor = Boolean(href);
33
33
  const target = targetOverride !== null && targetOverride !== void 0 ? targetOverride : (external ? '_blank' : undefined);
34
34
  const isNotInteractive = loading || disabled;
35
- const isDisabledWithReason = (variant === 'normal' || variant === 'primary' || variant === 'icon') && !!disabledReason && disabled;
35
+ const isDisabledWithReason = (variant === 'normal' ||
36
+ variant === 'primary' ||
37
+ variant === 'icon' ||
38
+ variant === 'inline-icon' ||
39
+ variant === 'inline-link' ||
40
+ variant === 'link') &&
41
+ !!disabledReason &&
42
+ disabled;
36
43
  const hasAriaDisabled = (loading && !disabled) || (disabled && __focusable) || isDisabledWithReason;
37
44
  const shouldHaveContent = children &&
38
45
  ['icon', 'inline-icon', 'flashbar-icon', 'modal-dismiss', 'inline-icon-pointer-target'].indexOf(variant) === -1;