@hashicorp/design-system-components 1.8.1 → 2.1.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 (57) hide show
  1. package/CHANGELOG.md +86 -17
  2. package/addon/components/hds/application-state/body.hbs +13 -0
  3. package/addon/components/hds/application-state/footer.hbs +7 -0
  4. package/addon/components/hds/application-state/footer.js +30 -0
  5. package/addon/components/hds/application-state/header.hbs +20 -0
  6. package/addon/components/hds/application-state/index.hbs +13 -0
  7. package/addon/components/hds/dropdown/footer.hbs +8 -0
  8. package/addon/components/hds/dropdown/header.hbs +8 -0
  9. package/addon/components/hds/dropdown/index.hbs +20 -13
  10. package/addon/components/hds/dropdown/index.js +27 -10
  11. package/addon/components/hds/dropdown/list-item/checkbox.hbs +19 -0
  12. package/addon/components/hds/dropdown/list-item/checkbox.js +16 -0
  13. package/addon/components/hds/dropdown/list-item/checkmark.hbs +39 -0
  14. package/addon/components/hds/dropdown/list-item/checkmark.js +28 -0
  15. package/addon/components/hds/dropdown/list-item/copy-item.js +1 -1
  16. package/addon/components/hds/dropdown/list-item/description.js +1 -1
  17. package/addon/components/hds/dropdown/list-item/generic.hbs +1 -1
  18. package/addon/components/hds/dropdown/list-item/interactive.js +1 -1
  19. package/addon/components/hds/dropdown/list-item/radio.hbs +17 -0
  20. package/addon/components/hds/dropdown/list-item/radio.js +16 -0
  21. package/addon/components/hds/dropdown/list-item/separator.hbs +1 -1
  22. package/addon/components/hds/dropdown/list-item/title.js +4 -1
  23. package/addon/components/hds/dropdown/toggle/button.hbs +30 -21
  24. package/addon/components/hds/dropdown/toggle/button.js +52 -0
  25. package/addon/components/hds/dropdown/toggle/chevron.hbs +8 -0
  26. package/addon/components/hds/dropdown/toggle/icon.hbs +2 -2
  27. package/addon/components/hds/dropdown/toggle/icon.js +40 -0
  28. package/addon/components/hds/side-nav/icon-button.hbs +1 -1
  29. package/app/components/hds/{empty-state/footer.js → application-state/body.js} +1 -1
  30. package/app/components/hds/application-state/footer.js +6 -0
  31. package/app/components/hds/application-state/header.js +6 -0
  32. package/app/components/hds/{empty-state/header.js → application-state/index.js} +1 -1
  33. package/app/components/hds/{empty-state/body.js → dropdown/footer.js} +1 -1
  34. package/app/components/hds/{empty-state/index.js → dropdown/header.js} +1 -1
  35. package/app/components/hds/dropdown/list-item/checkbox.js +6 -0
  36. package/app/components/hds/dropdown/list-item/checkmark.js +6 -0
  37. package/app/components/hds/dropdown/list-item/radio.js +6 -0
  38. package/app/components/hds/dropdown/toggle/chevron.js +6 -0
  39. package/app/styles/@hashicorp/design-system-components.scss +1 -1
  40. package/app/styles/@hashicorp/design-system-power-select-overrides.scss +1 -1
  41. package/app/styles/components/application-state.scss +55 -0
  42. package/app/styles/components/button.scss +9 -254
  43. package/app/styles/components/dropdown.scss +260 -65
  44. package/app/styles/components/form/checkbox.scss +1 -1
  45. package/app/styles/components/form/radio.scss +1 -1
  46. package/app/styles/components/form/text-input.scss +1 -1
  47. package/app/styles/components/form/textarea.scss +1 -1
  48. package/app/styles/mixins/_button.scss +280 -0
  49. package/blueprints/hds-component-test/files/tests/integration/components/hds/__name__/index-test.js +14 -11
  50. package/blueprints/hds-component-test/index.js +4 -2
  51. package/package.json +2 -2
  52. package/addon/components/hds/empty-state/body.hbs +0 -7
  53. package/addon/components/hds/empty-state/footer.hbs +0 -7
  54. package/addon/components/hds/empty-state/header.hbs +0 -7
  55. package/addon/components/hds/empty-state/index.hbs +0 -13
  56. package/app/styles/components/empty-state.scss +0 -37
  57. /package/blueprints/hds-component-test/files/tests/dummy/app/styles/{pages → showcase-pages}/__dummyCSSFileName__.scss +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,70 @@
1
1
  # @hashicorp/design-system-components
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1258](https://github.com/hashicorp/design-system/pull/1258) [`3466d2279`](https://github.com/hashicorp/design-system/commit/3466d2279191504442029976a4e18d3ca99015bf) Thanks [@MelSumner](https://github.com/MelSumner)! - Adds Hds::ApplicationState component
8
+
9
+ ### Patch Changes
10
+
11
+ - [#1291](https://github.com/hashicorp/design-system/pull/1291) [`b2c21a86e`](https://github.com/hashicorp/design-system/commit/b2c21a86ee681d53e728fa5c52192b9003762ea9) Thanks [@didoo](https://github.com/didoo)! - Fixed missing inset shadow for `TextInput`, `Textarea`, `Checkbox`, `Radio`, `PowerSelect` overrides
12
+
13
+ ## 2.0.0
14
+
15
+ ### Major Changes
16
+
17
+ - [#1185](https://github.com/hashicorp/design-system/pull/1185) [`a883e7fd7`](https://github.com/hashicorp/design-system/commit/a883e7fd763ae7a93ecc5ef3d49ed0230b48ea11) Thanks [@alex-ju](https://github.com/alex-ju)! - Add `Checkmark`, `Checkbox` and `Radio` as `Hds::Dropdown::ListItem`s
18
+
19
+ Rename `Hds::Dropdown::ListItem` internal CSS classes as follows:
20
+
21
+ - `hds-dropdown-list-item--copy-item` → `hds-dropdown-list-item--variant-copy-item`
22
+ - `hds-dropdown-list-item--description` → `hds-dropdown-list-item--variant-description`
23
+ - `hds-dropdown-list-item--generic` → `hds-dropdown-list-item--variant-generic`
24
+ - `hds-dropdown-list-item--interactive` → `hds-dropdown-list-item--variant-interactive`
25
+ - `hds-dropdown-list-item--separator` → `hds-dropdown-list-item--variant-separator`
26
+ - `hds-dropdown-list-item--title` → `hds-dropdown-list-item--variant-title`
27
+
28
+ **Note:** If test assertions are relying on these class names, tests will fail. If extensions/overrides have been applied to these classes, they will suffer visual changes.
29
+
30
+ - [#1212](https://github.com/hashicorp/design-system/pull/1212) [`6e79216a8`](https://github.com/hashicorp/design-system/commit/6e79216a880ae140cce15f1dc6494f0aeca8e0b8) Thanks [@alex-ju](https://github.com/alex-ju)! - Add `Hds::Dropdown::Header` and `Hds::Dropdown::Footer` as generic blocks to `Hds::Dropdown`
31
+
32
+ Rename `Hds::Dropdown` internal CSS class `hds-dropdown-list` → `hds-dropdown__list`
33
+
34
+ The `hds-dropdown__list` element is now wrapped in a `hds-dropdown__content` element to accommodate the new header and footer elements. As a result, the following modifiers will be applied to the wrapper element.
35
+
36
+ - `hds-dropdown-list--fixed-width` → `hds-dropdown__content--fixed-width`
37
+ - `hds-dropdown-list--position-left` → `hds-dropdown__content--position-left`
38
+ - `hds-dropdown-list--position-right` → `hds-dropdown__content--position-right`
39
+
40
+ **Note:** If test assertions are relying on these class names, tests will fail. If extensions/overrides have been applied to these classes, they will suffer visual changes.
41
+
42
+ - [#1266](https://github.com/hashicorp/design-system/pull/1266) [`082842b59`](https://github.com/hashicorp/design-system/commit/082842b59321f843c4955e4cdaf2ce2674a8913d) Thanks [@alex-ju](https://github.com/alex-ju)! - Add `@icon`, `@count`, `@badge` and `@badgeCount` to `Dropdown::Toggle::Button`
43
+
44
+ `Hds::Dropdown::Toggle::Button` and `Hds::Dropdown::Toggle::Icon` now share the chevron element. As a result, we renamed internal CSS classes as follows:
45
+
46
+ - `hds-button__text` → `hds-dropdown-toggle-button__text`
47
+ - `hds-button__icon` → `hds-dropdown-toggle-chevron`
48
+
49
+ The icon element within `Hds::Dropdown::Toggle::Icon` no longer has the `hds-dropdown-toggle-icon__chevron` class and it's currently wrapped in the `hds-dropdown-toggle-chevron` container, similar to `Hds::Dropdown::Toggle::Button`.
50
+
51
+ The `Hds::Dropdown::Toggle::Icon` now has a solid border, for consistency with `Hds::Dropdown::Toggle::Button` and the secondary style of `Hds::Button`.
52
+
53
+ **Note:** If test assertions are relying on these class names, tests will fail. If extensions/overrides have been applied to these classes, they will suffer visual changes.
54
+
55
+ ### Minor Changes
56
+
57
+ - [#1276](https://github.com/hashicorp/design-system/pull/1276) [`5ad29412d`](https://github.com/hashicorp/design-system/commit/5ad29412d2edc0cc4265d3c0bbbf388e821f1cc7) Thanks [@alex-ju](https://github.com/alex-ju)! - Allow small `@size` on `Dropdown::Toggle::Icon`
58
+
59
+ - [#1262](https://github.com/hashicorp/design-system/pull/1262) [`3eb78b8de`](https://github.com/hashicorp/design-system/commit/3eb78b8de7c678cff977c9d3a677c47a3216caad) Thanks [@alex-ju](https://github.com/alex-ju)! - Add new `@listPositions` for `Dropdown` as follows:
60
+
61
+ - `bottom-left`
62
+ - `bottom-right` (default)
63
+ - `top-left`
64
+ - `top-right`
65
+
66
+ **Note:** `left` and `right` are now deprecated and will be removed in a future major release
67
+
3
68
  ## 1.8.1
4
69
 
5
70
  ### Patch Changes
@@ -382,32 +447,34 @@ This release signifies the first major release of the HashiCorp Design System. M
382
447
 
383
448
  ### Minor Changes (Some Breaking)
384
449
 
385
- - [#217](https://github.com/hashicorp/design-system/pull/217) [`210edd17`](https://github.com/hashicorp/design-system/commit/210edd17431e6e3097260aed0df5a8902f93b7f7) Thanks [@didoo](https://github.com/didoo)! - # Interactive
450
+ - [#217](https://github.com/hashicorp/design-system/pull/217) [`210edd17`](https://github.com/hashicorp/design-system/commit/210edd17431e6e3097260aed0df5a8902f93b7f7) Thanks [@didoo](https://github.com/didoo)!
451
+
452
+ #### Interactive
386
453
 
387
- - Introduced `<Hds::Interactive>` (a generic, "utility" component used internally by all the interactive elements like buttons and links)
454
+ - Introduced `<Hds::Interactive>` (a generic, "utility" component used internally by all the interactive elements like buttons and links)
388
455
 
389
- # Button
456
+ #### Button
390
457
 
391
- - updated the button API to handle also links as `<a>`/`<LinkTo/LinkToExternal>`
392
- - it can be used in place of the `<Hds::Link/LinkTo::CTA>` component (see below)
393
- - when the button is a link - the text is underlined for differentiation with a normal button - ⚠️ **Visual change!** - the button responds to `space` key event
394
- - removed the `@type` argument from the API in favour of the `type` native attribute - 🚨 **Breaking change!**
458
+ - updated the button API to handle also links as `<a>`/`<LinkTo/LinkToExternal>`
459
+ - it can be used in place of the `<Hds::Link/LinkTo::CTA>` component (see below)
460
+ - when the button is a link - the text is underlined for differentiation with a normal button - ⚠️ **Visual change!** - the button responds to `space` key event
461
+ - removed the `@type` argument from the API in favour of the `type` native attribute - 🚨 **Breaking change!**
395
462
 
396
- # Link/LinkTo::CTA
463
+ #### Link/LinkTo::CTA
397
464
 
398
- - removed the `<Hds::Link/LinkTo::CTA>` component, in favour of `<Hds::Button>` component (see above) - 🚨 **Breaking change!**
465
+ - removed the `<Hds::Link/LinkTo::CTA>` component, in favour of `<Hds::Button>` component (see above) - 🚨 **Breaking change!**
399
466
 
400
- # Link::Inline
467
+ #### Link::Inline
401
468
 
402
- - added the `<Hds::Link::Inline>` component (with API very similar to the `<Hds::Link::Standalone>`)
469
+ - added the `<Hds::Link::Inline>` component (with API very similar to the `<Hds::Link::Standalone>`)
403
470
 
404
- # Dropdown
471
+ #### Dropdown
405
472
 
406
- - Updated the `Dropdown::ListItem::Interactive` to use the new `<Hds::Interactive>` component
473
+ - Updated the `Dropdown::ListItem::Interactive` to use the new `<Hds::Interactive>` component
407
474
 
408
- # Alert/Toast components
475
+ #### Alert/Toast components
409
476
 
410
- - Removed the `<LinkTo::Standalone>` action (now you can use directly `<Link::Standalone>`)
477
+ - Removed the `<LinkTo::Standalone>` action (now you can use directly `<Link::Standalone>`)
411
478
 
412
479
  ## 0.11.2
413
480
 
@@ -427,9 +494,11 @@ This release signifies the first major release of the HashiCorp Design System. M
427
494
 
428
495
  ### Minor Changes (Some Breaking)
429
496
 
430
- - [#245](https://github.com/hashicorp/design-system/pull/245) [`c6de1018`](https://github.com/hashicorp/design-system/commit/c6de101880ec1c21971e3775e1a21b6cb9e69757) Thanks [@didoo](https://github.com/didoo)! - - Added `Alert` component
497
+ - [#245](https://github.com/hashicorp/design-system/pull/245) [`c6de1018`](https://github.com/hashicorp/design-system/commit/c6de101880ec1c21971e3775e1a21b6cb9e69757) Thanks [@didoo](https://github.com/didoo)!
498
+ - Added `Alert` component
431
499
  - Added `Toast` component
432
- - [#259](https://github.com/hashicorp/design-system/pull/259) [`478b3069`](https://github.com/hashicorp/design-system/commit/478b3069e800cf2ccefba9b5475c72b024e25d16) Thanks [@didoo](https://github.com/didoo)! - - removed autofocus on first item for `Disclosure` component (and as a result also for `Breadcrumb` and `Dropdown` components) (🚨 Breaking)
500
+ - [#259](https://github.com/hashicorp/design-system/pull/259) [`478b3069`](https://github.com/hashicorp/design-system/commit/478b3069e800cf2ccefba9b5475c72b024e25d16) Thanks [@didoo](https://github.com/didoo)!
501
+ - removed autofocus on first item for `Disclosure` component (and as a result also for `Breadcrumb` and `Dropdown` components) (🚨 Breaking)
433
502
  - updated focus state treatment for `Dropdown` component (🚨 Breaking)
434
503
 
435
504
  ### Patch Changes
@@ -0,0 +1,13 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+ <div class="hds-application-state__body" ...attributes>
6
+ {{#if (has-block)}}
7
+ {{yield}}
8
+ {{else}}
9
+ <p class="hds-application-state__body-text hds-typography-body-300">
10
+ {{@text}}
11
+ </p>
12
+ {{/if}}
13
+ </div>
@@ -0,0 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+ <div class={{this.classNames}} ...attributes>
6
+ {{yield (hash Link::Standalone=(component "hds/link/standalone"))}}
7
+ </div>
@@ -0,0 +1,30 @@
1
+ import Component from '@glimmer/component';
2
+
3
+ export default class HdsApplicationStateFooterComponent extends Component {
4
+ /**
5
+ * Indicate if the footer should have a top border or not.
6
+ *
7
+ * @param hasDivider
8
+ * @type {boolean}
9
+ * @default false
10
+ */
11
+ get hasDivider() {
12
+ return this.args.hasDivider || false;
13
+ }
14
+
15
+ /**
16
+ * Get the class names to apply to the component.
17
+ * @method classNames
18
+ * @return {string} The "class" attribute to apply to the component.
19
+ */
20
+ get classNames() {
21
+ let classes = ['hds-application-state__footer'];
22
+
23
+ // add a class based on the existence of @hasDivider argument
24
+ if (this.hasDivider) {
25
+ classes.push(`hds-application-state__footer--has-divider`);
26
+ }
27
+
28
+ return classes.join(' ');
29
+ }
30
+ }
@@ -0,0 +1,20 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+ <div class="hds-application-state__header" ...attributes>
6
+ {{#if @icon}}
7
+ <div class="hds-application-state__icon">
8
+ <FlightIcon @name={{@icon}} @size="24" />
9
+ </div>
10
+ {{/if}}
11
+ <div class="hds-application-state__title hds-typography-display-400 hds-font-weight-semibold">
12
+ {{@title}}
13
+ </div>
14
+ {{#if @errorCode}}
15
+ <div class="hds-application-state__error-code hds-typography-body-100 hds-font-weight-medium">
16
+ Error
17
+ {{@errorCode}}
18
+ </div>
19
+ {{/if}}
20
+ </div>
@@ -0,0 +1,13 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+ <div class="hds-application-state" ...attributes>
6
+ {{yield
7
+ (hash
8
+ Header=(component "hds/application-state/header")
9
+ Body=(component "hds/application-state/body")
10
+ Footer=(component "hds/application-state/footer")
11
+ )
12
+ }}
13
+ </div>
@@ -0,0 +1,8 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+
6
+ <div class="hds-dropdown__footer {{if @hasDivider 'hds-dropdown__footer--with-divider'}}" ...attributes>
7
+ {{yield}}
8
+ </div>
@@ -0,0 +1,8 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+
6
+ <div class="hds-dropdown__header {{if @hasDivider 'hds-dropdown__header--with-divider'}}" ...attributes>
7
+ {{yield}}
8
+ </div>
@@ -12,18 +12,25 @@
12
12
  }}
13
13
  </:toggle>
14
14
  <:content as |c|>
15
- <ul class={{this.listClassNames}} {{style width=@width}}>
16
- {{yield
17
- (hash
18
- close=c.close
19
- CopyItem=(component "hds/dropdown/list-item/copy-item")
20
- Description=(component "hds/dropdown/list-item/description")
21
- Generic=(component "hds/dropdown/list-item/generic")
22
- Interactive=(component "hds/dropdown/list-item/interactive")
23
- Separator=(component "hds/dropdown/list-item/separator")
24
- Title=(component "hds/dropdown/list-item/title")
25
- )
26
- }}
27
- </ul>
15
+ <div class={{this.classNames}} {{style width=@width height=@height}}>
16
+ {{yield (hash Header=(component "hds/dropdown/header"))}}
17
+ <ul class="hds-dropdown__list" {{did-insert this.didInsertList}}>
18
+ {{yield
19
+ (hash
20
+ close=c.close
21
+ Checkbox=(component "hds/dropdown/list-item/checkbox")
22
+ Checkmark=(component "hds/dropdown/list-item/checkmark")
23
+ CopyItem=(component "hds/dropdown/list-item/copy-item")
24
+ Description=(component "hds/dropdown/list-item/description")
25
+ Generic=(component "hds/dropdown/list-item/generic")
26
+ Interactive=(component "hds/dropdown/list-item/interactive")
27
+ Radio=(component "hds/dropdown/list-item/radio")
28
+ Separator=(component "hds/dropdown/list-item/separator")
29
+ Title=(component "hds/dropdown/list-item/title")
30
+ )
31
+ }}
32
+ </ul>
33
+ {{yield (hash close=c.close Footer=(component "hds/dropdown/footer"))}}
34
+ </div>
28
35
  </:content>
29
36
  </Hds::Disclosure>
@@ -4,16 +4,25 @@
4
4
  */
5
5
 
6
6
  import Component from '@glimmer/component';
7
+ import { action } from '@ember/object';
7
8
  import { assert } from '@ember/debug';
8
9
 
9
- export const DEFAULT_POSITION = 'right';
10
- export const POSITIONS = ['right', 'left'];
10
+ export const DEFAULT_POSITION = 'bottom-right';
11
+ // TODO: retire 'right' and 'left' in favor of `bottom-right` and `bottom-left` https://github.com/hashicorp/design-system/pull/1262
12
+ export const POSITIONS = [
13
+ 'right',
14
+ 'left',
15
+ 'bottom-left',
16
+ 'bottom-right',
17
+ 'top-left',
18
+ 'top-right',
19
+ ];
11
20
 
12
21
  export default class HdsDropdownIndexComponent extends Component {
13
22
  /**
14
23
  * @param listPosition
15
24
  * @type {string}
16
- * @default primary
25
+ * @default bottom-right
17
26
  * @description Determines the position of the "list"
18
27
  */
19
28
  get listPosition() {
@@ -30,21 +39,29 @@ export default class HdsDropdownIndexComponent extends Component {
30
39
  }
31
40
 
32
41
  /**
33
- * Get the class names to apply to the "list"
34
- * @method DropdownIndex#listClassNames
35
- * @return {string} The "class" attribute to apply to the "list" element
42
+ * Get the class names to apply to the content
43
+ * @method classNames
44
+ * @return {string} The "class" attribute to apply to the disclosed content
36
45
  */
37
- get listClassNames() {
38
- let classes = ['hds-dropdown-list'];
46
+ get classNames() {
47
+ let classes = ['hds-dropdown__content'];
39
48
 
40
49
  // add a class based on the @listPosition argument
41
- classes.push(`hds-dropdown-list--position-${this.listPosition}`);
50
+ classes.push(`hds-dropdown__content--position-${this.listPosition}`);
42
51
 
43
52
  // add a class based on the @width argument
44
53
  if (this.args.width) {
45
- classes.push('hds-dropdown-list--fixed-width');
54
+ classes.push('hds-dropdown__content--fixed-width');
46
55
  }
47
56
 
48
57
  return classes.join(' ');
49
58
  }
59
+
60
+ @action
61
+ didInsertList(element) {
62
+ let checkmarkItems = element.querySelectorAll(`[role="option"]`);
63
+ if (checkmarkItems.length) {
64
+ element.setAttribute('role', 'listbox');
65
+ }
66
+ }
50
67
  }
@@ -0,0 +1,19 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+
6
+ <li class="hds-dropdown-list-item hds-dropdown-list-item--variant-checkbox">
7
+ <Hds::Form::Checkbox::Base class="hds-dropdown-list-item__control" id={{this.id}} @value={{@value}} ...attributes />
8
+ {{#if @icon}}
9
+ <div class="hds-dropdown-list-item__icon">
10
+ <FlightIcon @name={{@icon}} @isInlineBlock={{false}} />
11
+ </div>
12
+ {{/if}}
13
+ <label class="hds-dropdown-list-item__label hds-typography-body-200" for={{this.id}}>
14
+ {{yield}}
15
+ </label>
16
+ {{#if @count}}
17
+ <span class="hds-dropdown-list-item__count hds-typography-body-100 hds-font-weight-medium">{{@count}}</span>
18
+ {{/if}}
19
+ </li>
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ import Component from '@glimmer/component';
7
+ import { getElementId } from '../../form/utils/getElementId';
8
+
9
+ export default class HdsDropdownListItemCheckboxComponent extends Component {
10
+ /**
11
+ * Determines the unique ID to assign to the checkbox control
12
+ */
13
+ get id() {
14
+ return getElementId(this);
15
+ }
16
+ }
@@ -0,0 +1,39 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+
6
+ {{! template-lint-disable require-context-role require-presentational-children }}
7
+ <li class={{this.classNames}}>
8
+ <Hds::Interactive
9
+ @current-when={{@current-when}}
10
+ @models={{hds-link-to-models @model @models}}
11
+ @query={{hds-link-to-query @query}}
12
+ @replace={{@replace}}
13
+ @route={{@route}}
14
+ @isRouteExternal={{@isRouteExternal}}
15
+ @href={{@href}}
16
+ @isHrefExternal={{@isHrefExternal}}
17
+ class="hds-dropdown-list-item__interactive"
18
+ ...attributes
19
+ role="option"
20
+ aria-selected={{if @selected "true" "false"}}
21
+ >
22
+ {{#if @icon}}
23
+ <div class="hds-dropdown-list-item__interactive-icon">
24
+ <FlightIcon @name={{@icon}} @isInlineBlock={{false}} />
25
+ </div>
26
+ {{/if}}
27
+ <div class="hds-dropdown-list-item__interactive-text hds-typography-body-200 hds-font-weight-medium">
28
+ {{yield}}
29
+ </div>
30
+ {{#if @count}}
31
+ <span class="hds-dropdown-list-item__count hds-typography-body-100 hds-font-weight-medium">{{@count}}</span>
32
+ {{/if}}
33
+ <span class="hds-dropdown-list-item__checkmark">
34
+ {{#if @selected}}
35
+ <FlightIcon class="hds-dropdown-list-item__checkmark-icon" @name="check" @isInlineBlock={{false}} />
36
+ {{/if}}
37
+ </span>
38
+ </Hds::Interactive>
39
+ </li>
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ import Component from '@glimmer/component';
7
+
8
+ export default class HdsDropdownListItemCheckmarkComponent extends Component {
9
+ /**
10
+ * Get the class names to apply to the component.
11
+ * @method classNames
12
+ * @return {string} The "class" attribute to apply to the component.
13
+ */
14
+ get classNames() {
15
+ let classes = [
16
+ 'hds-dropdown-list-item',
17
+ 'hds-dropdown-list-item--color-action',
18
+ 'hds-dropdown-list-item--variant-checkmark',
19
+ ];
20
+
21
+ // add a class based on the @selected argument
22
+ if (this.args.selected) {
23
+ classes.push('hds-dropdown-list-item--variant-checkmark-selected');
24
+ }
25
+
26
+ return classes.join(' ');
27
+ }
28
+ }
@@ -35,7 +35,7 @@ export default class HdsDropdownListItemCopyItemComponent extends Component {
35
35
  get classNames() {
36
36
  let classes = [
37
37
  'hds-dropdown-list-item',
38
- 'hds-dropdown-list-item--copy-item',
38
+ 'hds-dropdown-list-item--variant-copy-item',
39
39
  ];
40
40
 
41
41
  return classes.join(' ');
@@ -31,7 +31,7 @@ export default class HdsDropdownListItemDescriptionComponent extends Component {
31
31
  get classNames() {
32
32
  let classes = [
33
33
  'hds-dropdown-list-item',
34
- 'hds-dropdown-list-item--description',
34
+ 'hds-dropdown-list-item--variant-description',
35
35
  ];
36
36
 
37
37
  // add classes for the typographic style
@@ -2,6 +2,6 @@
2
2
  Copyright (c) HashiCorp, Inc.
3
3
  SPDX-License-Identifier: MPL-2.0
4
4
  }}
5
- <li class="hds-dropdown-list-item hds-dropdown-list-item--generic" ...attributes>
5
+ <li class="hds-dropdown-list-item hds-dropdown-list-item--variant-generic" ...attributes>
6
6
  {{yield}}
7
7
  </li>
@@ -53,7 +53,7 @@ export default class HdsDropdownListItemInteractiveComponent extends Component {
53
53
  get classNames() {
54
54
  let classes = [
55
55
  'hds-dropdown-list-item',
56
- 'hds-dropdown-list-item--interactive',
56
+ 'hds-dropdown-list-item--variant-interactive',
57
57
  ];
58
58
 
59
59
  // add a class based on the @color argument
@@ -0,0 +1,17 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+
6
+ <li class="hds-dropdown-list-item hds-dropdown-list-item--variant-radio">
7
+ <Hds::Form::Radio::Base class="hds-dropdown-list-item__control" id={{this.id}} @value={{@value}} ...attributes />
8
+ {{#if @icon}}
9
+ <div class="hds-dropdown-list-item__icon">
10
+ <FlightIcon @name={{@icon}} @isInlineBlock={{false}} />
11
+ </div>
12
+ {{/if}}
13
+ <label class="hds-dropdown-list-item__label hds-typography-body-200" for={{this.id}}>{{yield}}</label>
14
+ {{#if @count}}
15
+ <span class="hds-dropdown-list-item__count hds-typography-body-100 hds-font-weight-medium">{{@count}}</span>
16
+ {{/if}}
17
+ </li>
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ import Component from '@glimmer/component';
7
+ import { getElementId } from '../../form/utils/getElementId';
8
+
9
+ export default class HdsDropdownListItemRadioComponent extends Component {
10
+ /**
11
+ * Determines the unique ID to assign to the radio control
12
+ */
13
+ get id() {
14
+ return getElementId(this);
15
+ }
16
+ }
@@ -2,4 +2,4 @@
2
2
  Copyright (c) HashiCorp, Inc.
3
3
  SPDX-License-Identifier: MPL-2.0
4
4
  }}
5
- <li class="hds-dropdown-list-item hds-dropdown-list-item--separator" role="separator" ...attributes></li>
5
+ <li class="hds-dropdown-list-item hds-dropdown-list-item--variant-separator" role="separator" ...attributes></li>
@@ -29,7 +29,10 @@ export default class HdsDropdownListItemTitleComponent extends Component {
29
29
  * @return {string} The "class" attribute to apply to the component.
30
30
  */
31
31
  get classNames() {
32
- let classes = ['hds-dropdown-list-item', 'hds-dropdown-list-item--title'];
32
+ let classes = [
33
+ 'hds-dropdown-list-item',
34
+ 'hds-dropdown-list-item--variant-title',
35
+ ];
33
36
 
34
37
  // add classes for the typographic style
35
38
  classes.push('hds-typography-body-100');
@@ -2,28 +2,37 @@
2
2
  Copyright (c) HashiCorp, Inc.
3
3
  SPDX-License-Identifier: MPL-2.0
4
4
  }}
5
- {{!
6
- // >>>>>>>>>>> WARNING <<<<<<<<<<
7
- //
8
- // Notice: in this component we're directly using the `Hds::Button` component
9
- // (and adding a specialized class for the "toggle-button" variant, see below)
10
- // If you need to change the styling of the `Button` component, remember that this will impact also
11
- // this component too.
12
- // If instead you need to change only the styling of the `toggle-button` component, you can do it
13
- // in the CSS file using the specialized class declared there.
14
- // This is NOT a standard approach that we use in the HDS design system implementation, but it's been
15
- // the least worst option we could find to solve the problem of sharing the exact same style of the
16
- // `Button (primary)` with other components.
17
- }}
18
-
19
- <Hds::Button
5
+ <button
20
6
  class={{this.classNames}}
21
- @text={{this.text}}
22
- @icon="chevron-down"
23
- @iconPosition="trailing"
24
- @color={{this.color}}
25
- @size={{@size}}
26
7
  ...attributes
8
+ type="button"
27
9
  aria-expanded={{if @isOpen "true" "false"}}
28
10
  {{on "click" this.onClick}}
29
- />
11
+ >
12
+ {{#if @icon}}
13
+ <div class="hds-dropdown-toggle-button__icon">
14
+ <FlightIcon @name={{@icon}} @stretched={{true}} />
15
+ </div>
16
+ {{/if}}
17
+ <div class="hds-dropdown-toggle-button__text">
18
+ {{this.text}}
19
+ </div>
20
+ {{#if @count}}
21
+ <Hds::BadgeCount
22
+ @text={{@count}}
23
+ @size="small"
24
+ @type={{this.badgeType}}
25
+ class="hds-dropdown-toggle-button__count"
26
+ />
27
+ {{/if}}
28
+ {{#if @badge}}
29
+ <Hds::Badge
30
+ @text={{@badge}}
31
+ @icon={{@badgeIcon}}
32
+ @size="small"
33
+ @type={{this.badgeType}}
34
+ class="hds-dropdown-toggle-button__badge"
35
+ />
36
+ {{/if}}
37
+ <Hds::Dropdown::Toggle::Chevron />
38
+ </button>