@hashicorp/design-system-components 5.2.0-rc-20260108162959 → 5.2.0

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 (42) hide show
  1. package/declarations/components.d.ts +0 -2
  2. package/declarations/services.d.ts +0 -1
  3. package/declarations/template-registry.d.ts +0 -6
  4. package/dist/components.js +0 -2
  5. package/dist/components.js.map +1 -1
  6. package/dist/services.js +1 -1
  7. package/dist/styles/@hashicorp/design-system-components.css +320 -501
  8. package/dist/styles/@hashicorp/design-system-components.scss +62 -4
  9. package/dist/styles/@hashicorp/design-system-components.scss.map +1 -0
  10. package/dist/styles/components/badge-count.scss +76 -26
  11. package/dist/styles/components/badge.scss +131 -26
  12. package/dist/styles/components/button.scss +0 -5
  13. package/dist/styles/components/dropdown.scss +5 -3
  14. package/dist/styles/components/form/file-input.scss +2 -2
  15. package/dist/styles/components/form/key-value-inputs.scss +4 -2
  16. package/dist/styles/mixins/_button.scss +129 -82
  17. package/dist/styles/mixins/_interactive-dark-theme.scss +1 -1
  18. package/package.json +4 -8
  19. package/declarations/components/hds/theme-context/index.d.ts +0 -24
  20. package/declarations/components/hds/theme-context/types.d.ts +0 -19
  21. package/declarations/components/hds/theme-switcher/index.d.ts +0 -43
  22. package/declarations/services/hds-theming.d.ts +0 -57
  23. package/dist/_app_/components/hds/theme-context.js +0 -1
  24. package/dist/_app_/components/hds/theme-switcher.js +0 -1
  25. package/dist/_app_/services/hds-theming.js +0 -1
  26. package/dist/components/hds/theme-context/index.js +0 -45
  27. package/dist/components/hds/theme-context/index.js.map +0 -1
  28. package/dist/components/hds/theme-context/types.js +0 -27
  29. package/dist/components/hds/theme-context/types.js.map +0 -1
  30. package/dist/components/hds/theme-switcher/index.js +0 -100
  31. package/dist/components/hds/theme-switcher/index.js.map +0 -1
  32. package/dist/services/hds-theming.js +0 -214
  33. package/dist/services/hds-theming.js.map +0 -1
  34. package/dist/styles/@hashicorp/design-system-components-common.css +0 -9588
  35. package/dist/styles/@hashicorp/design-system-components-common.css.map +0 -1
  36. package/dist/styles/@hashicorp/design-system-components-common.scss +0 -24
  37. package/dist/styles/@hashicorp/design-system-components.css.map +0 -1
  38. package/dist/styles/@hashicorp/design-system-power-select-overrides.css +0 -229
  39. package/dist/styles/@hashicorp/design-system-power-select-overrides.css.map +0 -1
  40. package/dist/styles/components/index.scss +0 -52
  41. package/dist/styles/components/theme-context.scss +0 -12
  42. package/dist/styles/mixins/_carbonization.scss +0 -31
@@ -3,8 +3,66 @@
3
3
  * SPDX-License-Identifier: MPL-2.0
4
4
  */
5
5
 
6
- // these are the "standard" HDS tokens (the file comes from `packages/tokens/dist/`)
7
- @use "products/css/tokens";
6
+ // these files come from the 'design-system-tokens' package
7
+ @use "tokens";
8
+ @use "helpers/color";
9
+ @use "helpers/elevation";
10
+ @use "helpers/focus-ring";
11
+ @use "helpers/typography";
8
12
 
9
- // these are the styles specific (and only) for the HDS components
10
- @use "./design-system-components-common";
13
+ // Vendor styles
14
+ @use "./design-system-ember-a11y-refocus";
15
+
16
+ // Notice: this list can be automatically edited by the Ember blueprint, please don't remove the start/end comments
17
+ // START COMPONENTS CSS FILES IMPORTS
18
+ @use "../components/accordion";
19
+ @use "../components/advanced-table";
20
+ @use "../components/alert";
21
+ @use "../components/app-footer";
22
+ @use "../components/app-frame";
23
+ @use "../components/app-header";
24
+ @use "../components/app-side-nav";
25
+ @use "../components/application-state";
26
+ @use "../components/badge";
27
+ @use "../components/badge-count";
28
+ @use "../components/breadcrumb";
29
+ @use "../components/button";
30
+ @use "../components/button-set";
31
+ @use "../components/card";
32
+ @use "../components/code-block";
33
+ @use "../components/code-editor";
34
+ @use "../components/copy";
35
+ @use "../components/dialog-primitive";
36
+ @use "../components/disclosure-primitive";
37
+ @use "../components/dismiss-button";
38
+ @use "../components/dropdown";
39
+ @use "../components/flyout";
40
+ @use "../components/form"; // multiple components
41
+ @use "../components/icon";
42
+ @use "../components/icon-tile";
43
+ @use "../components/layout"; // multiple components
44
+ @use "../components/link"; // multiple components
45
+ @use "../components/modal";
46
+ @use "../components/page-header";
47
+ @use "../components/pagination";
48
+ @use "../components/reveal";
49
+ @use "../components/rich-tooltip";
50
+ @use "../components/segmented-group";
51
+ @use "../components/separator";
52
+ @use "../components/side-nav";
53
+ @use "../components/stepper";
54
+ @use "../components/table";
55
+ @use "../components/tabs";
56
+ @use "../components/tag";
57
+ @use "../components/text";
58
+ @use "../components/time";
59
+ @use "../components/toast";
60
+ @use "../components/tooltip";
61
+ // END COMPONENT CSS FILES IMPORTS
62
+
63
+ @use "../mixins/screen-reader-only" as *;
64
+
65
+ // stylelint-disable-next-line selector-class-pattern
66
+ .sr-only {
67
+ @include screen-reader-only();
68
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-system-components.scss","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -7,9 +7,12 @@
7
7
  // BADGE-COUNT COMPONENT
8
8
  //
9
9
 
10
+ @use "sass:math";
11
+ @use "sass:map";
12
+
13
+ $hds-badge-count-types: ("flat", "inverted", "outlined");
10
14
  $hds-badge-count-sizes: ("small", "medium", "large");
11
- $hds-badge-count-colors: ("neutral", "neutral-dark-mode");
12
- $hds-badge-count-types: ("filled", "inverted", "outlined");
15
+ $hds-badge-count-border-width: 1px;
13
16
 
14
17
  .hds-badge-count {
15
18
  display: inline-flex;
@@ -17,40 +20,87 @@ $hds-badge-count-types: ("filled", "inverted", "outlined");
17
20
  max-width: 100%;
18
21
  font-weight: var(--token-typography-font-weight-medium);
19
22
  font-family: var(--token-typography-font-stack-text);
20
- border-style: solid;
21
- border-width: var(--token-badge-border-width);
23
+ border: $hds-badge-count-border-width solid transparent;
22
24
  }
23
25
 
24
26
  // SIZE
25
27
 
28
+ // these values later may come from the design tokens
29
+ $hds-badge-count-size-props: (
30
+ "small": (
31
+ // 13px = 0.8125rem
32
+ "font-size": 0.8125rem,
33
+ "height": 1.25rem,
34
+ // 16px = 1.2308
35
+ "line-height": 1.2308,
36
+ "padding-vertical": 0.125rem,
37
+ "padding-horizontal": 0.5rem,
38
+ ),
39
+ "medium": (
40
+ // 13px = 0.8125rem
41
+ "font-size": 0.8125rem,
42
+ "height": 1.5rem,
43
+ // 16px = 1.2308
44
+ "line-height": 1.2308,
45
+ "padding-vertical": 0.25rem,
46
+ "padding-horizontal": 0.75rem,
47
+ ),
48
+ "large": (
49
+ // 16px = 1rem
50
+ "font-size": 1rem,
51
+ "height": 2rem,
52
+ // 24px = 1.5
53
+ "line-height": 1.5,
54
+ "padding-vertical": 0.25rem,
55
+ "padding-horizontal": 0.875rem,
56
+ ),
57
+ );
58
+
26
59
  @each $size in $hds-badge-count-sizes {
27
60
  .hds-badge-count--size-#{$size} {
28
- min-height: var(--token-badge-height-#{$size});
29
- // note: for the horizontal padding, we're using a specific design token for the `BadgeCount` component
30
- padding: calc(var(--token-badge-padding-vertical-#{$size}) - var(--token-badge-border-width))
31
- calc(var(--token-badge-count-padding-horizontal-#{$size}) - var(--token-badge-border-width));
32
- font-size: var(--token-badge-typography-font-size-#{$size});
33
- line-height: var(--token-badge-typography-line-height-#{$size});
34
- border-radius: calc(var(--token-badge-height-#{$size}) / 2);
61
+ min-height: map.get($hds-badge-count-size-props, $size, "height");
62
+ padding: calc(#{map.get($hds-badge-count-size-props, $size, "padding-vertical")} - #{$hds-badge-count-border-width})
63
+ calc(#{map.get($hds-badge-count-size-props, $size, "padding-horizontal")} - #{$hds-badge-count-border-width});
64
+ font-size: map.get($hds-badge-count-size-props, $size, "font-size");
65
+ line-height: map.get($hds-badge-count-size-props, $size, "line-height");
66
+ border-radius: math.div(map.get($hds-badge-count-size-props, $size, "height"), 2);
35
67
  }
36
68
  }
37
69
 
38
70
  // COLOR + TYPE COMBINATIONS
39
71
 
40
- @each $color in $hds-badge-count-colors {
41
- .hds-badge-count--color-#{$color} {
42
- @each $type in $hds-badge-count-types {
43
- &.hds-badge-count--type-#{$type} {
44
- color: var(--token-badge-foreground-color-#{$color}-#{$type});
45
-
46
- @if $type == "outlined" {
47
- background-color: transparent;
48
- border-color: var(--token-badge-foreground-color-#{$color}-#{$type});
49
- } @else {
50
- background-color: var(--token-badge-surface-color-#{$color}-#{$type});
51
- border-color: transparent;
52
- }
53
- }
54
- }
72
+ .hds-badge-count--color-neutral {
73
+ &.hds-badge-count--type-filled {
74
+ color: var(--token-color-foreground-primary);
75
+ background-color: var(--token-color-palette-neutral-200);
76
+ }
77
+
78
+ &.hds-badge-count--type-inverted {
79
+ color: var(--token-color-foreground-high-contrast);
80
+ background-color: var(--token-color-palette-neutral-500);
81
+ }
82
+
83
+ &.hds-badge-count--type-outlined {
84
+ color: var(--token-color-foreground-primary);
85
+ background-color: transparent;
86
+ border-color: var(--token-color-palette-neutral-500);
87
+ }
88
+ }
89
+
90
+ .hds-badge-count--color-neutral-dark-mode {
91
+ &.hds-badge-count--type-filled {
92
+ color: var(--token-color-foreground-high-contrast);
93
+ background-color: var(--token-color-palette-neutral-500);
94
+ }
95
+
96
+ &.hds-badge-count--type-inverted {
97
+ color: var(--token-color-foreground-primary);
98
+ background-color: var(--token-color-surface-faint);
99
+ }
100
+
101
+ &.hds-badge-count--type-outlined {
102
+ color: var(--token-color-foreground-high-contrast);
103
+ background-color: transparent;
104
+ border-color: var(--token-color-palette-neutral-50);
55
105
  }
56
106
  }
@@ -7,17 +7,48 @@
7
7
  // BADGE COMPONENT
8
8
  //
9
9
 
10
+ @use "sass:map";
11
+
12
+ $hds-badge-types: ("flat", "inverted", "outlined");
13
+ $hds-badge-colors-accents: ("highlight", "success", "warning", "critical");
10
14
  $hds-badge-sizes: ("small", "medium", "large");
11
- $hds-badge-colors: ("neutral", "neutral-dark-mode", "highlight", "success", "warning", "critical");
12
- $hds-badge-types: ("filled", "inverted", "outlined");
15
+ $hds-badge-border-width: 1px;
16
+ $hds-badge-colors-props: (
17
+ "highlight": (
18
+ "inverted-background-color": var(--token-color-palette-purple-200),
19
+ "outlined-border-color": var(--token-color-palette-purple-200),
20
+ ),
21
+ "success": (
22
+ "inverted-background-color": var(--token-color-palette-green-200),
23
+ "outlined-border-color": var(--token-color-palette-green-200),
24
+ ),
25
+ "warning": (
26
+ "inverted-background-color": var(--token-color-palette-amber-200),
27
+ "outlined-border-color": var(--token-color-palette-amber-200),
28
+ ),
29
+ "critical": (
30
+ "inverted-background-color": var(--token-color-palette-red-200),
31
+ "outlined-border-color": var(--token-color-palette-red-200),
32
+ ),
33
+ );
13
34
 
14
35
  .hds-badge {
36
+ // Redefine color values to increase contrast
37
+ --token-color-surface-success: var(--token-color-palette-green-100);
38
+ --token-color-foreground-success-on-surface: var(--token-color-palette-green-400);
39
+ --token-color-surface-warning: var(--token-color-palette-amber-100);
40
+ --token-color-foreground-warning-on-surface: var(--token-color-palette-amber-400);
41
+ --token-color-surface-critical: var(--token-color-palette-red-100);
42
+ --token-color-foreground-critical-on-surface: var(--token-color-palette-red-400);
43
+ --token-color-surface-highlight: var(--token-color-palette-purple-100);
44
+ --token-color-foreground-highlight-on-surface: var(--token-color-palette-purple-400);
45
+
15
46
  display: inline-flex;
16
47
  align-items: center;
17
48
  max-width: 100%;
18
49
  vertical-align: middle;
19
- border-style: solid;
20
- border-width: var(--token-badge-border-width);
50
+ border: $hds-badge-border-width solid transparent;
51
+ border-radius: var(--token-border-radius-small);
21
52
  }
22
53
 
23
54
  .hds-badge__icon {
@@ -33,42 +64,116 @@ $hds-badge-types: ("filled", "inverted", "outlined");
33
64
 
34
65
  // SIZE
35
66
 
67
+ // these values later may come from the design tokens
68
+ $hds-badge-size-props: (
69
+ "small": (
70
+ // 13px = 0.8125rem
71
+ "font-size": 0.8125rem,
72
+ "gap": 0.25rem,
73
+ "height": 1.25rem,
74
+ "icon-size": 0.75rem,
75
+ // 16px = 1.2308
76
+ "line-height": 1.2308,
77
+ "padding-vertical": 0.125rem,
78
+ "padding-horizontal": 0.375rem,
79
+ ),
80
+ "medium": (
81
+ // 13px = 0.8125rem
82
+ "font-size": 0.8125rem,
83
+ "gap": 0.25rem,
84
+ "height": 1.5rem,
85
+ "icon-size": 1rem,
86
+ // 16px = 1.2308
87
+ "line-height": 1.2308,
88
+ "padding-vertical": 0.25rem,
89
+ "padding-horizontal": 0.5rem,
90
+ ),
91
+ "large": (
92
+ // 16px = 1rem
93
+ "font-size": 1rem,
94
+ "gap": 0.375rem,
95
+ "height": 2rem,
96
+ "icon-size": 1rem,
97
+ // 24px = 1.5
98
+ "line-height": 1.5,
99
+ "padding-vertical": 0.25rem,
100
+ "padding-horizontal": 0.5rem,
101
+ ),
102
+ );
103
+
36
104
  @each $size in $hds-badge-sizes {
37
105
  .hds-badge--size-#{$size} {
38
- gap: var(--token-badge-gap-#{$size});
39
- min-height: var(--token-badge-height-#{$size});
40
- padding: calc(var(--token-badge-padding-vertical-#{$size}) - var(--token-badge-border-width))
41
- calc(var(--token-badge-padding-horizontal-#{$size}) - var(--token-badge-border-width));
42
- border-radius: var(--token-badge-border-radius-#{$size});
106
+ gap: map.get($hds-badge-size-props, $size, "gap");
107
+ min-height: map.get($hds-badge-size-props, $size, "height");
108
+ padding: calc(#{map.get($hds-badge-size-props, $size, "padding-vertical")} - #{$hds-badge-border-width})
109
+ calc(#{map.get($hds-badge-size-props, $size, "padding-horizontal")} - #{$hds-badge-border-width});
43
110
 
44
111
  .hds-badge__icon {
45
- width: var(--token-badge-icon-size-#{$size});
46
- height: var(--token-badge-icon-size-#{$size});
112
+ width: map.get($hds-badge-size-props, $size, "icon-size");
113
+ height: map.get($hds-badge-size-props, $size, "icon-size");
47
114
  }
48
115
 
49
116
  .hds-badge__text {
50
- font-size: var(--token-badge-typography-font-size-#{$size});
51
- line-height: var(--token-badge-typography-line-height-#{$size});
117
+ font-size: map.get($hds-badge-size-props, $size, "font-size");
118
+ line-height: map.get($hds-badge-size-props, $size, "line-height");
52
119
  }
53
120
  }
54
121
  }
55
122
 
56
123
  // COLOR + TYPE COMBINATIONS
57
124
 
58
- @each $color in $hds-badge-colors {
125
+ .hds-badge--color-neutral {
126
+ &.hds-badge--type-filled {
127
+ color: var(--token-color-foreground-primary);
128
+ background-color: var(--token-color-palette-neutral-200);
129
+ }
130
+
131
+ &.hds-badge--type-inverted {
132
+ color: var(--token-color-foreground-high-contrast);
133
+ background-color: var(--token-color-palette-neutral-500);
134
+ }
135
+
136
+ &.hds-badge--type-outlined {
137
+ color: var(--token-color-foreground-primary);
138
+ background-color: transparent;
139
+ border-color: var(--token-color-palette-neutral-500);
140
+ }
141
+ }
142
+
143
+ .hds-badge--color-neutral-dark-mode {
144
+ &.hds-badge--type-filled {
145
+ color: var(--token-color-foreground-high-contrast);
146
+ background-color: var(--token-color-palette-neutral-500);
147
+ }
148
+
149
+ &.hds-badge--type-inverted {
150
+ color: var(--token-color-foreground-primary);
151
+ background-color: var(--token-color-surface-faint);
152
+ }
153
+
154
+ &.hds-badge--type-outlined {
155
+ color: var(--token-color-foreground-high-contrast);
156
+ background-color: transparent;
157
+ border-color: var(--token-color-palette-neutral-50);
158
+ }
159
+ }
160
+
161
+ @each $color in $hds-badge-colors-accents {
59
162
  .hds-badge--color-#{$color} {
60
- @each $type in $hds-badge-types {
61
- &.hds-badge--type-#{$type} {
62
- color: var(--token-badge-foreground-color-#{$color}-#{$type});
63
-
64
- @if $type == "outlined" {
65
- background-color: transparent;
66
- border-color: var(--token-badge-foreground-color-#{$color}-#{$type});
67
- } @else {
68
- background-color: var(--token-badge-surface-color-#{$color}-#{$type});
69
- border-color: transparent;
70
- }
71
- }
163
+ &.hds-badge--type-filled {
164
+ color: var(--token-color-foreground-#{$color}-on-surface);
165
+ background-color: var(--token-color-surface-#{$color});
166
+ }
167
+
168
+ &.hds-badge--type-inverted {
169
+ color: var(--token-color-foreground-high-contrast);
170
+ background-color: map.get($hds-badge-colors-props, $color, "inverted-background-color");
171
+ }
172
+
173
+ &.hds-badge--type-outlined {
174
+ color: var(--token-color-foreground-#{$color});
175
+ background-color: transparent;
176
+ border-color: map.get($hds-badge-colors-props, $color, "outlined-border-color");
72
177
  }
73
178
  }
74
179
  }
@@ -10,7 +10,6 @@
10
10
  //
11
11
 
12
12
  @use "../mixins/button" as *;
13
- @use "../mixins/carbonization" as *;
14
13
 
15
14
  .hds-button {
16
15
  @include hds-button();
@@ -52,10 +51,6 @@
52
51
  width: 100%;
53
52
  max-width: 100%;
54
53
 
55
- @include hds-apply-only-if-carbon() {
56
- justify-content: space-between;
57
- }
58
-
59
54
  .hds-button__text {
60
55
  flex: 0 0 auto;
61
56
  }
@@ -12,6 +12,8 @@
12
12
  @use "../mixins/button" as *;
13
13
  @use "../mixins/focus-ring" as *;
14
14
 
15
+ $hds-dropdown-toggle-border-radius: $hds-button-border-radius;
16
+
15
17
  // DROPDOWN
16
18
 
17
19
  .hds-dropdown--is-inline {
@@ -37,7 +39,7 @@
37
39
  color: var(--token-color-foreground-primary);
38
40
  background-color: var(--token-color-surface-faint);
39
41
  border: 1px solid var(--token-color-border-strong);
40
- border-radius: var(--token-button-border-radius);
42
+ border-radius: $hds-dropdown-toggle-border-radius;
41
43
  outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
42
44
  outline-color: transparent; // We need this to be transparent for a11y
43
45
  isolation: isolate; // used to create a new stacking context (needed to have the pseudo element below text/icon but not the parent container)
@@ -79,8 +81,8 @@
79
81
  align-items: center;
80
82
  justify-content: center;
81
83
  border-radius: calc(
82
- var(--token-button-border-radius) - 2px
83
- ); // var(--token-button-border-radius) - (1px padding + 1px border) (= 3px)
84
+ #{$hds-dropdown-toggle-border-radius} - 2px
85
+ ); // $hds-dropdown-toggle-border-radius - (1px padding + 1px border) (= 3px)
84
86
 
85
87
  img {
86
88
  width: 100%;
@@ -37,8 +37,8 @@
37
37
  background-repeat: no-repeat;
38
38
  background-position: 15px 50%;
39
39
  background-size: var(--token-form-text-input-background-image-size);
40
- border: var(--token-button-border-width) solid var(--token-color-border-strong);
41
- border-radius: var(--token-button-border-radius);
40
+ border: $hds-button-border-width solid var(--token-color-border-strong);
41
+ border-radius: $hds-button-border-radius;
42
42
  box-shadow: var(--token-elevation-low-box-shadow);
43
43
  cursor: pointer;
44
44
  }
@@ -12,6 +12,9 @@
12
12
  @use "../../mixins/button" as *;
13
13
  @use "../../mixins/screen-reader-only" as *;
14
14
 
15
+ // this is the width of the icon-only button
16
+ $hds-delete-button-width: map.get($hds-button-size-props, "medium", "min-height");
17
+
15
18
  // notice: this is a <fieldset> element
16
19
  .hds-form-key-value-inputs {
17
20
  display: flex;
@@ -40,8 +43,7 @@
40
43
  @include hds-breakpoint-above("md") {
41
44
  display: grid;
42
45
  flex-grow: 1;
43
- // `var(--token-button-height-medium)` is the width/height of the icon-only button
44
- grid-template-columns: var(--hds-key-value-inputs-columns, 1fr 1fr var(--token-button-height-medium));
46
+ grid-template-columns: var(--hds-key-value-inputs-columns, 1fr 1fr $hds-delete-button-width);
45
47
  align-items: flex-end;
46
48
  column-gap: 8px;
47
49
  row-gap: 0;