@hashicorp/design-system-components 0.1.2 → 0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @hashicorp/design-system-components
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#76](https://github.com/hashicorp/design-system/pull/76) [`48a82d54`](https://github.com/hashicorp/design-system/commit/48a82d545817c280d022cf95b2f3a691dc3c46a3) Thanks [@didoo](https://github.com/didoo)! - Added the "tertiary" color variant to the "Button" component
8
+
9
+ * [#77](https://github.com/hashicorp/design-system/pull/77) [`c08711e4`](https://github.com/hashicorp/design-system/commit/c08711e4fa3fac0cd3418b8afa1a0c4c254e8fac) Thanks [@didoo](https://github.com/didoo)! - Fixed the "elevation" treatment for the "Button" component
10
+
3
11
  ## 0.1.2
4
12
 
5
13
  ### Patch Changes
@@ -6,7 +6,7 @@ export const DEFAULT_COLOR = 'primary';
6
6
  export const DEFAULT_TYPE = 'button';
7
7
  export const DEFAULT_ICONPOSITION = 'leading';
8
8
  export const SIZES = ['small', 'medium', 'large'];
9
- export const COLORS = ['primary', 'secondary', 'critical'];
9
+ export const COLORS = ['primary', 'secondary', 'tertiary', 'critical'];
10
10
  export const TYPES = ['button', 'submit', 'reset'];
11
11
  export const ICONPOSITIONS = ['leading', 'trailing'];
12
12
 
@@ -72,6 +72,11 @@ export default class HdsButtonIndexComponent extends Component {
72
72
  * @description The name of the icon to be used.
73
73
  */
74
74
  get icon() {
75
+ assert(
76
+ `when the "Hds::Button" @color is "tertiary" an @icon is required`,
77
+ !(this.color === 'tertiary' && !this.args.icon)
78
+ );
79
+
75
80
  return this.args.icon ?? null;
76
81
  }
77
82
 
@@ -180,9 +185,6 @@ export default class HdsButtonIndexComponent extends Component {
180
185
  classes.push('hds-button--width-full');
181
186
  }
182
187
 
183
- // the button has a "low" elevation effect applied to it
184
- classes.push('hds-elevation-low');
185
-
186
188
  return classes.join(' ');
187
189
  }
188
190
  }
@@ -59,6 +59,8 @@ $hds-button-focus-border-width: 3px;
59
59
 
60
60
  &:focus,
61
61
  &.is-focus {
62
+ box-shadow: none;
63
+
62
64
  &::before {
63
65
  // the position absolute of an element is computed from the inside of the border of the container
64
66
  // so we have to take in account the border width of the pseudo-element container itself
@@ -141,6 +143,7 @@ $size-props: (
141
143
  .hds-button--color-primary {
142
144
  background-color: var(--token-color-palette-blue-200);
143
145
  border-color: var(--token-color-palette-blue-300);
146
+ box-shadow: var(--token-elevation-low-box-shadow);
144
147
  color: var(--token-color-foreground-high-contrast);
145
148
 
146
149
  &:focus,
@@ -183,6 +186,7 @@ $size-props: (
183
186
  .hds-button--color-secondary {
184
187
  background-color: var(--token-color-surface-faint);
185
188
  border-color: var(--token-color-border-strong);
189
+ box-shadow: var(--token-elevation-low-box-shadow);
186
190
  color: var(--token-color-foreground-primary);
187
191
 
188
192
  &:focus,
@@ -213,9 +217,59 @@ $size-props: (
213
217
  }
214
218
  }
215
219
 
220
+ .hds-button--color-tertiary {
221
+ background-color: transparent;
222
+ border-color: transparent;
223
+ color: var(--token-color-foreground-action);
224
+
225
+ &:focus,
226
+ &.is-focus {
227
+ border-color: var(--token-color-focus-action-internal);
228
+ color: var(--token-color-foreground-action);
229
+ &::before {
230
+ border-color: var(--token-color-focus-action-external);
231
+ }
232
+ }
233
+ &:hover,
234
+ &.is-hover {
235
+ background-color: var(--token-color-surface-primary);
236
+ border-color: var(--token-color-border-strong);
237
+ color: var(--token-color-foreground-action-hover);
238
+ cursor: pointer;
239
+ }
240
+ &:active,
241
+ &.is-active {
242
+ background-color: var(--token-color-surface-interactive-active);
243
+ border-color: var(--token-color-border-strong);
244
+ box-shadow: none;
245
+ color: var(--token-color-foreground-action-active);
246
+ &::before {
247
+ border-color: transparent;
248
+ }
249
+ }
250
+
251
+ &:disabled,
252
+ &[disabled],
253
+ &.is-disabled,
254
+ &:disabled:focus,
255
+ &[disabled]:focus,
256
+ &.is-disabled:focus,
257
+ &:disabled:hover,
258
+ &[disabled]:hover,
259
+ &.is-disabled:hover {
260
+ background-color: transparent;
261
+ border-color: transparent;
262
+
263
+ &::before {
264
+ border-color: transparent;
265
+ }
266
+ }
267
+ }
268
+
216
269
  .hds-button--color-critical {
217
270
  background-color: var(--token-color-surface-critical);
218
271
  border-color: var(--token-color-foreground-critical-on-surface);
272
+ box-shadow: var(--token-elevation-low-box-shadow);
219
273
  color: var(--token-color-foreground-critical-on-surface);
220
274
 
221
275
  &:focus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashicorp/design-system-components",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "HashiCorp Design System Components",
5
5
  "keywords": [
6
6
  "hashicorp",