@hashicorp/design-system-components 0.0.12 → 0.0.16

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 (29) hide show
  1. package/.github/ISSUE_TEMPLATE/new-component-quest-issue-engineering-checklist.md +78 -0
  2. package/.husky/pre-commit +14 -0
  3. package/README.md +1 -1
  4. package/addon/components/hds/badge/index.hbs +2 -4
  5. package/addon/components/hds/badge/index.js +20 -27
  6. package/addon/components/hds/badge-count/index.hbs +1 -1
  7. package/addon/components/hds/badge-count/index.js +16 -23
  8. package/addon/components/hds/button/index.hbs +6 -6
  9. package/addon/components/hds/button/index.js +26 -34
  10. package/addon/components/hds/card/container.hbs +1 -1
  11. package/addon/components/hds/card/container.js +18 -32
  12. package/addon/components/hds/icon-tile/index.hbs +4 -47
  13. package/addon/components/hds/icon-tile/index.js +30 -28
  14. package/addon/components/hds/link/standalone.hbs +20 -0
  15. package/addon/components/hds/link/standalone.js +135 -0
  16. package/addon/components/hds/link-to/standalone.hbs +25 -0
  17. package/addon/components/hds/link-to/standalone.js +161 -0
  18. package/addon/helpers/hds-link-to-models.js +30 -0
  19. package/app/components/hds/link/standalone.js +1 -0
  20. package/app/components/hds/link-to/standalone.js +1 -0
  21. package/app/helpers/hds-link-to-models.js +1 -0
  22. package/app/styles/@hashicorp/design-system-components.scss +3 -0
  23. package/app/styles/components/badge-count.scss +1 -1
  24. package/app/styles/components/badge.scss +1 -1
  25. package/app/styles/components/button.scss +63 -59
  26. package/app/styles/components/card/container.scss +0 -62
  27. package/app/styles/components/icon-tile.scss +25 -25
  28. package/app/styles/components/link/standalone.scss +167 -0
  29. package/package.json +28 -18
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: New Component Quest Issue/Engineering Checklist
3
+ about: 'DS Team: Engineering Checklist for New Components'
4
+ title: "[Quest] New Component: Component Name"
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ This is the quest issue/engineering checklist for the COMPONENT_NAME Component. All new components will have their own feature branch, and any PR that adds an item from the checklist should target the feature branch, and not `main`.
11
+
12
+ ## Pre-Flight Checklist
13
+ Update this list and these links as appropriate.
14
+
15
+ - [Component Doc](url_here): This file should exist before any code is written.
16
+ - [FIGMA Design](url_here): Since we are trying to align the component API naming with the same terms used in the Figma file, it is likely useful to have a fairly stable Figma design before we create a component; it should definitely be finalized before the component ships, however.
17
+ - [Design System Website](https://design-system-website.vercel.app/?path=/story/example-introduction--page) (storybook of storybooks): use for reference, to consider existing features that we might need to replicate in the component.
18
+
19
+ ## Engineering Checklist
20
+ The engineering checklist has six parts: creating the feature branch, component template, component backing class, component style, tests, and documentation.
21
+
22
+ ### Component Creation
23
+
24
+ - [ ] create new branch from main for the component.
25
+ - [ ] create new component
26
+ - `ember generate component hds/COMPONENT_NAME/index --gc` (the component won't need to be invoked with index, it's just to put all the files in the correct place)
27
+ - if it's a variation on a component, then `hds/COMPONENT_NAME/VARIATION` instead of `index`
28
+ - [ ] **component template**
29
+ - use semantic HTML
30
+ - the component should have a css class that is the same as the component (e.g. `hds/button` should have a class name of `hds-button` on the component, and additional CSS classes should start with this same class name.
31
+ - add `...attributes` unless doing so would be detrimental (e.g., a parent component and child component that both have ...attributes)
32
+ - [ ] **component class**
33
+ - use getters (vs template conditionals or constructors, if possible)
34
+ - write API comments in the JS doc way (copy from an existing DS component)
35
+ - use the same naming as the Figma file for the components API unless it conflicts with a pre-existing HTML attribute. If that is the case, document the difference in the comment.
36
+ - ensure that all existing functionality (from a Structure component) is accounted for in some way. If we are not providing existing functionality at all, it should be documented (along with the reason why). If we are providing temporary functionality, explain that it's temporary and why.
37
+ - check the [design system website](https://design-system-website.vercel.app/?path=/story/example-introduction--page) to see what kind of component functionality is being used across all products
38
+ - booleans should start with a verb (is/has/etc)
39
+ - assertion text should match the content style of the other components.
40
+ - goal is a terse invocation
41
+ - [ ] **component style**
42
+ - create `component/COMPONENT_NAME.scss` in `app/styles`
43
+ - add `@use` to `app/styles/@hashicorp/design-system-components.scss` (see existing code for precise syntax)
44
+ - use design tokens wherever possible, comment where they are not
45
+ - sizes should be in relative units
46
+ - line heights should be unitless
47
+ - [ ] **testing**
48
+ - [ ] test basic functionality
49
+ - [ ] test defaults
50
+ - [ ] try not to repeat tests (i.e., don't have to test all sizes, all colors, etc.)
51
+ - [ ] test all accessibility attributes
52
+ - [ ] **documentation**
53
+ - create component page `ember generate route components/COMPONENT_NAME --dummy`
54
+ - add link to `templates/index.hbs` page
55
+ - [ ] API docs
56
+ - [ ] Usage
57
+ - [ ] Showcase
58
+
59
+ ### Component Review
60
+
61
+ Pre-review request checks:
62
+
63
+ - [ ] make sure all tests pass (`ember s` then visit /tests; or `ember t -s`)
64
+ - [ ] check for basic a11y on docs page:
65
+ - keyboard navigation
66
+ - logical DOM order
67
+ - zoom up to 400%
68
+ - color contrast
69
+ - (the axe-core browser plugin can run some basic tests and give immediate feedback)
70
+ - [ ] check page on browsers
71
+ - Chrome
72
+ - Firefox
73
+ - Safari
74
+ - Edge (once available)
75
+
76
+ When ready for review:
77
+ - [ ] add situationally appropriate reviewers
78
+ - [ ] added instructions for reviewers in your PR, letting them know what kind of review you need
@@ -0,0 +1,14 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ export NVM_DIR="$HOME/.nvm/nvm.sh"
5
+ . "$(dirname $NVM_DIR)/nvm.sh"
6
+
7
+ export NVM_DIR="$HOME/.nvm"
8
+ a=$(nvm ls | grep 'node')
9
+ b=${a#*(-> }
10
+ v=${b%%[)| ]*}
11
+
12
+ export PATH="$NVM_DIR/versions/node/$v/bin:$PATH"
13
+
14
+ npx lint-staged
package/README.md CHANGED
@@ -11,7 +11,7 @@ Compatibility
11
11
 
12
12
  * Ember.js v3.20 or above
13
13
  * Ember CLI v3.20 or above
14
- * Node.js v10 or above
14
+ * Node.js v12 or above
15
15
 
16
16
 
17
17
  Installation
@@ -1,6 +1,4 @@
1
- <div
2
- class="hds-badge {{this.sizeClass}} {{this.typeClass}} {{this.colorClass}}"
3
- ...attributes>
1
+ <div class={{this.classNames}} ...attributes>
4
2
  {{#if @icon}}
5
3
  <div class="hds-badge__icon">
6
4
  <FlightIcon @name={{this.icon}} @size="16" @stretched="true" />
@@ -11,6 +9,6 @@
11
9
  {{else}}
12
10
  <div class="hds-badge__text">
13
11
  {{this.text}}
14
- </div>
12
+ </div>
15
13
  {{/if}}
16
14
  </div>
@@ -37,15 +37,6 @@ export default class HdsBadgeIndexComponent extends Component {
37
37
  return size;
38
38
  }
39
39
 
40
- /**
41
- * Get a class to apply to the component based on the size argument.
42
- * @method Badge#sizeClass
43
- * @return {string} The css class to apply to the component.
44
- */
45
- get sizeClass() {
46
- return `hds-badge--size-${this.size}`;
47
- }
48
-
49
40
  /**
50
41
  * Sets the type of the component
51
42
  * Accepted values: filled, inverted, outlined
@@ -67,15 +58,6 @@ export default class HdsBadgeIndexComponent extends Component {
67
58
  return type;
68
59
  }
69
60
 
70
- /**
71
- * Get a class to apply to the component based on the type argument.
72
- * @method Badge#typeClass
73
- * @return {string} The css class to apply to the component.
74
- */
75
- get typeClass() {
76
- return `hds-badge--type-${this.type}`;
77
- }
78
-
79
61
  /**
80
62
  * Sets the color scheme for the component
81
63
  * Accepted values: neutral, neutral-dark-mode, highlight, success, warning, critical
@@ -97,15 +79,6 @@ export default class HdsBadgeIndexComponent extends Component {
97
79
  return color;
98
80
  }
99
81
 
100
- /**
101
- * Get a class to apply to the component based on the color argument.
102
- * @method Badge#colorClass
103
- * @return {string} The css class to apply to the component.
104
- */
105
- get colorClass() {
106
- return `hds-badge--color-${this.color}`;
107
- }
108
-
109
82
  /**
110
83
  * @param text
111
84
  * @type {string}
@@ -145,4 +118,24 @@ export default class HdsBadgeIndexComponent extends Component {
145
118
  }
146
119
  return false;
147
120
  }
121
+
122
+ /**
123
+ * Get the class names to apply to the component.
124
+ * @method Badge#classNames
125
+ * @return {string} The "class" attribute to apply to the component.
126
+ */
127
+ get classNames() {
128
+ let classes = ['hds-badge'];
129
+
130
+ // add a class based on the @size argument
131
+ classes.push(`hds-badge--size-${this.size}`);
132
+
133
+ // add a class based on the @type argument
134
+ classes.push(`hds-badge--type-${this.type}`);
135
+
136
+ // add a class based on the @color argument
137
+ classes.push(`hds-badge--color-${this.color}`);
138
+
139
+ return classes.join(' ');
140
+ }
148
141
  }
@@ -1,3 +1,3 @@
1
- <div class="hds-badge-count {{this.sizeClass}} {{this.typeClass}} {{this.colorClass}}" ...attributes >
1
+ <div class={{this.classNames}} ...attributes>
2
2
  {{@text}}
3
3
  </div>
@@ -30,15 +30,6 @@ export default class HdsBadgeCountIndexComponent extends Component {
30
30
  return size;
31
31
  }
32
32
 
33
- /**
34
- * Get a class to apply to the component based on the size argument.
35
- * @method BadgeCount#sizeClass
36
- * @return {string} The css class to apply to the component.
37
- */
38
- get sizeClass() {
39
- return `hds-badge-count--size-${this.size}`;
40
- }
41
-
42
33
  /**
43
34
  * Sets the type of the component
44
35
  * Accepted values: filled, inverted, outlined
@@ -60,15 +51,6 @@ export default class HdsBadgeCountIndexComponent extends Component {
60
51
  return type;
61
52
  }
62
53
 
63
- /**
64
- * Get a class to apply to the component based on the type argument.
65
- * @method BadgeCount#typeClass
66
- * @return {string} The css class to apply to the component.
67
- */
68
- get typeClass() {
69
- return `hds-badge-count--type-${this.type}`;
70
- }
71
-
72
54
  /**
73
55
  * Sets the color scheme for the component
74
56
  * Accepted colors: neutral, neutral-dark-mode
@@ -91,11 +73,22 @@ export default class HdsBadgeCountIndexComponent extends Component {
91
73
  }
92
74
 
93
75
  /**
94
- * Get a class to apply to the component based on the color argument.
95
- * @method BadgeCount#colorClass
96
- * @return {string} The css class to apply to the component.
76
+ * Get the class names to apply to the component.
77
+ * @method BadgeCount#classNames
78
+ * @return {string} The "class" attribute to apply to the component.
97
79
  */
98
- get colorClass() {
99
- return `hds-badge-count--color-${this.color}`;
80
+ get classNames() {
81
+ let classes = ['hds-badge-count'];
82
+
83
+ // add a class based on the @size argument
84
+ classes.push(`hds-badge-count--size-${this.size}`);
85
+
86
+ // add a class based on the @type argument
87
+ classes.push(`hds-badge-count--type-${this.type}`);
88
+
89
+ // add a class based on the @color argument
90
+ classes.push(`hds-badge-count--color-${this.color}`);
91
+
92
+ return classes.join(' ');
100
93
  }
101
94
  }
@@ -1,7 +1,7 @@
1
- <button
2
- class="hds-button {{this.sizeClass}} {{this.colorClass}} {{this.widthClass}}"
1
+ <button
2
+ class={{this.classNames}}
3
3
  ...attributes
4
- aria-label={{if this.isIconOnly this.text null}}
4
+ aria-label={{if this.isIconOnly this.text null}}
5
5
  type={{this.type}}
6
6
  disabled={{if this.isDisabled "disabled" null}}
7
7
  >
@@ -17,7 +17,7 @@
17
17
  </div>
18
18
  <div class="hds-button__text">
19
19
  {{this.text}}
20
- </div>
20
+ </div>
21
21
  {{else}}
22
22
  <div class="hds-button__text">
23
23
  {{this.text}}
@@ -28,8 +28,8 @@
28
28
  {{/if}}
29
29
  {{else}}
30
30
  <div class="hds-button__text">
31
- {{this.text}}
31
+ {{this.text}}
32
32
  </div>
33
33
  {{/if}}
34
34
  {{/if}}
35
- </button>
35
+ </button>
@@ -46,16 +46,6 @@ export default class HdsButtonIndexComponent extends Component {
46
46
  return size;
47
47
  }
48
48
 
49
- /**
50
- * @param sizeClass
51
- * @type {string}
52
- * @default hds-button--size-medium
53
- * @description Determines the CSS class that the button should have, based on the size value; automatically set.
54
- */
55
- get sizeClass() {
56
- return `hds-button--size-${this.size}`;
57
- }
58
-
59
49
  /**
60
50
  * @param color
61
51
  * @type {string}
@@ -75,16 +65,6 @@ export default class HdsButtonIndexComponent extends Component {
75
65
  return color;
76
66
  }
77
67
 
78
- /**
79
- * @param colorClass
80
- * @type {string}
81
- * @default hds-button--color-primary
82
- * @description Determines the CSS class that the button should have, based on the color value; automatically set
83
- */
84
- get colorClass() {
85
- return `hds-button--color-${this.color}`;
86
- }
87
-
88
68
  /**
89
69
  * @param icon
90
70
  * @type {string}
@@ -170,20 +150,6 @@ export default class HdsButtonIndexComponent extends Component {
170
150
  return this.args.isFullWidth ?? false;
171
151
  }
172
152
 
173
- /**
174
- * @param widthClass
175
- * @type {string|null}
176
- * @default null
177
- * @description Determines if the full-width class should be applied to the component. This is set automatically based on the value of `isFullWidth`.
178
- */
179
- get widthClass() {
180
- if (this.isFullWidth === true) {
181
- return 'hds-button--width-full';
182
- } else {
183
- return null;
184
- }
185
- }
186
-
187
153
  /**
188
154
  * @param isDisabled
189
155
  * @type {boolean}
@@ -193,4 +159,30 @@ export default class HdsButtonIndexComponent extends Component {
193
159
  get isDisabled() {
194
160
  return this.args.isDisabled ?? null;
195
161
  }
162
+
163
+ /**
164
+ * Get the class names to apply to the component.
165
+ * @method Badge#classNames
166
+ * @return {string} The "class" attribute to apply to the component.
167
+ */
168
+ // "hds-button {{this.sizeClass}} {{this.colorClass}} {{this.widthClass}}"
169
+ get classNames() {
170
+ let classes = ['hds-button'];
171
+
172
+ // add a class based on the @size argument
173
+ classes.push(`hds-button--size-${this.size}`);
174
+
175
+ // add a class based on the @color argument
176
+ classes.push(`hds-button--color-${this.color}`);
177
+
178
+ // add a class based on the @isFullWidth argument
179
+ if (this.isFullWidth) {
180
+ classes.push('hds-button--width-full');
181
+ }
182
+
183
+ // the button has a "low" elevation effect applied to it
184
+ classes.push('hds-elevation-low');
185
+
186
+ return classes.join(' ');
187
+ }
196
188
  }
@@ -1,3 +1,3 @@
1
- <div class="hds-card__container {{this.levelClass}} {{this.borderClass}} {{this.backgroundClass}} {{this.overflowClass}}" ...attributes>
1
+ <div class={{this.classNames}} ...attributes>
2
2
  {{yield}}
3
3
  </div>
@@ -30,15 +30,6 @@ export default class HdsCardContainerComponent extends Component {
30
30
  return level;
31
31
  }
32
32
 
33
- /**
34
- * Get a class to apply to the component based on the level argument.
35
- * @method Card#levelClass
36
- * @return {string} The css class to apply to the component.
37
- */
38
- get levelClass() {
39
- return `hds-card__container--level-${this.level}`;
40
- }
41
-
42
33
  /**
43
34
  * Sets the background for the component
44
35
  * Accepted values: neutral-primary, neutral-secondary
@@ -60,24 +51,6 @@ export default class HdsCardContainerComponent extends Component {
60
51
  return background;
61
52
  }
62
53
 
63
- /**
64
- * Get a class to apply to the component based on the background argument.
65
- * @method Card#backgroundClass
66
- * @return {string} The css class to apply to the component.
67
- */
68
- get backgroundClass() {
69
- return `hds-card__container--background-${this.background}`;
70
- }
71
-
72
- /**
73
- * Get a class to apply to the component based on the hasBorder argument.
74
- * @method Card#hasBorderClass
75
- * @return {string} The css class to apply to the component.
76
- */
77
- get borderClass() {
78
- return this.args.hasBorder ? `hds-card__container--has-border` : undefined;
79
- }
80
-
81
54
  /**
82
55
  * Sets the level for the card
83
56
  * Accepted values: visible, hidden
@@ -100,11 +73,24 @@ export default class HdsCardContainerComponent extends Component {
100
73
  }
101
74
 
102
75
  /**
103
- * Get a class to apply to the component based on the overflow argument.
104
- * @method Card#overflowClass
105
- * @return {string} The css class to apply to the component.
76
+ * Get the class names to apply to the component.
77
+ * @method Card#classNames
78
+ * @return {string} The "class" attribute to apply to the component.
106
79
  */
107
- get overflowClass() {
108
- return `hds-card__container--overflow-${this.overflow}`;
80
+ get classNames() {
81
+ let classes = ['hds-card__container'];
82
+
83
+ // add an "elevation" class helper based on the @level and @hasBorder arguments
84
+ classes.push(
85
+ `hds-${this.args.hasBorder ? 'surface' : 'elevation'}-${this.level}`
86
+ );
87
+
88
+ // add a class based on the @background argument
89
+ classes.push(`hds-card__container--background-${this.background}`);
90
+
91
+ // add a class based on the @overflow argument
92
+ classes.push(`hds-card__container--overflow-${this.overflow}`);
93
+
94
+ return classes.join(' ');
109
95
  }
110
96
  }
@@ -1,56 +1,13 @@
1
- <div class="hds-icon-tile {{this.entityClass}} {{this.sizeClass}} {{this.colorClass}}" aria-hidden="true" ...attributes>
1
+ <div class={{this.classNames}} aria-hidden="true" ...attributes>
2
2
  {{#if @icon}}
3
3
  <div class="hds-icon-tile__icon">
4
4
  <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched="true" />
5
5
  </div>
6
6
  {{/if}}
7
7
  {{#if @logo}}
8
- <div class="hds-icon-tile__logo">
9
- {{!-- TODO! this will be replaced later with something else (TBD how we deliver these logos as design system) --}}
10
- <svg width="100%" height="100%" viewBox="0 0 144 144" fill="none" xmlns="http://www.w3.org/2000/svg">
11
- {{#if (eq this.logo 'boundary')}}
12
- <path d="M44.83 125.83V117.56H62.01V112.45H53.68V104.13H93.01L74.74 72.49L93.01 40.84H52.7V84.73H31V19.15H105.67L118.13 40.73L99.8 72.49L118.5 104.89L106.41 125.83H44.83Z" fill="currentColor"/>
13
- <path d="M48.1696 104.13H39.8496V112.45H48.1696V104.13Z" fill="currentColor"/>
14
- <path d="M39.32 117.5H31V125.82H39.32V117.5Z" fill="currentColor"/>
15
- {{/if}}
16
- {{#if (eq this.logo 'consul')}}
17
- <path d="M72.5298 126.56C63.6148 126.568 54.8328 124.399 46.946 120.243C39.0592 116.087 32.306 110.068 27.2724 102.71C22.2389 95.3524 19.0771 86.8772 18.0616 78.0203C17.0462 69.1634 18.2076 60.1924 21.4452 51.8862C24.6828 43.5799 29.8987 36.1893 36.6401 30.3559C43.3815 24.5225 51.4448 20.4225 60.13 18.4118C68.8153 16.4012 77.86 16.5406 86.4791 18.818C95.0982 21.0954 103.031 25.4419 109.59 31.4803V31.4803L96.5898 45.0804C91.4215 40.412 85.0101 37.343 78.1326 36.2453C71.2551 35.1476 64.2069 36.0684 57.8422 38.8961C51.4776 41.7238 46.0698 46.3369 42.2743 52.1764C38.4789 58.0158 36.4587 64.8308 36.4587 71.7953C36.4587 78.7599 38.4789 85.5749 42.2743 91.4143C46.0698 97.2538 51.4776 101.867 57.8422 104.695C64.2069 107.522 71.2551 108.443 78.1326 107.345C85.0101 106.248 91.4215 103.179 96.5898 98.5104L109.59 112.11C99.4912 121.413 86.26 126.572 72.5298 126.56V126.56Z" fill="currentColor"/>
18
- <path d="M116.61 99.1604C115.722 99.1604 114.854 98.897 114.116 98.4037C113.377 97.9103 112.802 97.2091 112.462 96.3886C112.122 95.5682 112.033 94.6654 112.206 93.7944C112.38 92.9234 112.807 92.1234 113.435 91.4955C114.063 90.8675 114.863 90.4399 115.734 90.2666C116.605 90.0934 117.508 90.1823 118.328 90.5221C119.149 90.862 119.85 91.4375 120.343 92.1759C120.837 92.9142 121.1 93.7823 121.1 94.6704C121.097 95.8604 120.624 97.0009 119.782 97.8424C118.941 98.6838 117.8 99.1577 116.61 99.1604Z" fill="currentColor"/>
19
- <path d="M72.1798 83.6504C69.8296 83.6603 67.5293 82.9723 65.5705 81.6736C63.6117 80.3749 62.0826 78.5239 61.1768 76.3553C60.271 74.1866 60.0294 71.7979 60.4825 69.4918C60.9357 67.1857 62.0632 65.066 63.7222 63.4013C65.3813 61.7366 67.4972 60.6019 69.8017 60.141C72.1063 59.6801 74.4958 59.9136 76.6675 60.8121C78.8392 61.7105 80.6953 63.2335 82.0007 65.1879C83.306 67.1423 84.0017 69.4401 83.9998 71.7904C83.9945 74.9273 82.7488 77.9348 80.5344 80.1567C78.32 82.3786 75.3167 83.6345 72.1798 83.6504Z" fill="currentColor"/>
20
- <path d="M121.76 83.8604C120.871 83.8604 120.003 83.597 119.265 83.1037C118.527 82.6103 117.951 81.9091 117.611 81.0886C117.271 80.2682 117.183 79.3654 117.356 78.4944C117.529 77.6234 117.957 76.8234 118.585 76.1955C119.213 75.5675 120.013 75.1399 120.884 74.9666C121.755 74.7934 122.657 74.8823 123.478 75.2221C124.298 75.562 124.999 76.1375 125.493 76.8759C125.986 77.6142 126.25 78.4823 126.25 79.3704C126.247 80.5604 125.773 81.7009 124.932 82.5424C124.09 83.3838 122.95 83.8577 121.76 83.8604Z" fill="currentColor"/>
21
- <path d="M108.41 83.3004C107.519 83.3003 106.649 83.0357 105.91 82.5401C105.171 82.0444 104.595 81.3402 104.257 80.5169C103.919 79.6935 103.833 78.7882 104.01 77.9159C104.187 77.0435 104.62 76.2436 105.253 75.6177C105.886 74.9918 106.69 74.5682 107.565 74.4006C108.439 74.2331 109.343 74.3292 110.163 74.6767C110.982 75.0242 111.68 75.6075 112.167 76.3524C112.655 77.0973 112.91 77.9703 112.9 78.8604C112.886 80.0425 112.408 81.1718 111.567 82.003C110.726 82.8343 109.592 83.3004 108.41 83.3004Z" fill="currentColor"/>
22
- <path d="M121.76 68.7304C120.871 68.7304 120.003 68.467 119.265 67.9737C118.527 67.4803 117.951 66.7791 117.611 65.9586C117.271 65.1382 117.183 64.2354 117.356 63.3644C117.529 62.4934 117.957 61.6934 118.585 61.0655C119.213 60.4375 120.013 60.0099 120.884 59.8366C121.755 59.6634 122.657 59.7523 123.478 60.0922C124.298 60.432 124.999 61.0075 125.493 61.7459C125.986 62.4842 126.25 63.3523 126.25 64.2404C126.247 65.4304 125.773 66.5709 124.932 67.4124C124.09 68.2538 122.95 68.7277 121.76 68.7304Z" fill="currentColor"/>
23
- <path d="M108.41 69.2404C107.522 69.2404 106.654 68.977 105.915 68.4837C105.177 67.9903 104.602 67.2891 104.262 66.4686C103.922 65.6482 103.833 64.7454 104.006 63.8744C104.179 63.0034 104.607 62.2034 105.235 61.5755C105.863 60.9475 106.663 60.5199 107.534 60.3467C108.405 60.1734 109.308 60.2623 110.128 60.6022C110.949 60.942 111.65 61.5175 112.143 62.2559C112.637 62.9942 112.9 63.8623 112.9 64.7504C112.9 65.9412 112.427 67.0832 111.585 67.9253C110.743 68.7673 109.601 69.2404 108.41 69.2404Z" fill="currentColor"/>
24
- <path d="M116.87 53.6304C115.982 53.6324 115.113 53.3707 114.373 52.8785C113.633 52.3864 113.056 51.6858 112.715 50.8656C112.373 50.0453 112.283 49.1422 112.455 48.2706C112.627 47.3989 113.054 46.598 113.682 45.969C114.309 45.3401 115.109 44.9115 115.98 44.7374C116.852 44.5633 117.755 44.6517 118.576 44.9912C119.397 45.3308 120.099 45.9062 120.593 46.6448C121.087 47.3834 121.35 48.2519 121.35 49.1404C121.35 50.3295 120.878 51.47 120.039 52.3118C119.199 53.1535 118.059 53.6277 116.87 53.6304Z" fill="currentColor"/>
25
- {{/if}}
26
- {{#if (eq this.logo 'nomad')}}
27
- <path d="M71.9995 14L21.7695 43V101L71.9995 130L122.23 101V43L71.9995 14ZM94.3795 77.78L80.9995 85.51L64.8295 76.71V95.19L49.6295 104.83V66.19L61.6895 58.81L78.4195 67.63V48.76L94.4195 39.17L94.3795 77.78Z" fill="currentColor"/>
28
- {{/if}}
29
- {{#if (eq this.logo 'packer')}}
30
- <path fill-rule="evenodd" clip-rule="evenodd" d="M35.0898 26.38L74.2198 49V132.38L35.0898 109.76V26.38Z" fill="currentColor"/>
31
- <path d="M93.5996 36.13L51.0596 11.62V28.62L79.9996 45.34V96.39L93.6096 104.21C102.03 109.07 108.92 106.21 108.92 97.74V60.28C108.91 51.86 102 41 93.5996 36.13Z" fill="currentColor"/>
32
- {{/if}}
33
- {{#if (eq this.logo 'terraform')}}
34
- <path fill-rule="evenodd" clip-rule="evenodd" d="M55.52 32.97L88.48 51.99V90.05L55.52 71.02V32.97Z" fill="currentColor"/>
35
- <path fill-rule="evenodd" clip-rule="evenodd" d="M92.0898 51.99V90.05L125.04 71.02V32.97L92.0898 51.99Z" fill="currentColor"/>
36
- <path fill-rule="evenodd" clip-rule="evenodd" d="M18.96 11.73V49.78L51.91 68.81V30.76L18.96 11.73Z" fill="currentColor"/>
37
- <path fill-rule="evenodd" clip-rule="evenodd" d="M55.52 113.24L88.47 132.27V94.47V94.22L55.52 75.19V113.24Z" fill="currentColor"/>
38
- {{/if}}
39
- {{#if (eq this.logo 'vagrant')}}
40
- {{!-- notice: this is the only one that has specific/fixed fill colors; at the moment we have to treat it as an exception --}}
41
- <path d="M110.77 17.5498L86.6801 31.4598V39.9998L72.0001 74.5198L57.3201 39.9998V31.4598L33.2301 17.5498L18.5801 26.0198V35.8498L51.2101 115.77L72.0001 127.77L92.7901 115.77L125.42 35.8498V26.0198L110.77 17.5498Z" fill="#1868F2"/>
42
- <path d="M125.42 26.0195L101.33 39.9195V48.4695L81.77 92.1895L72 97.8295V127.77L92.79 115.77L125.42 35.8495V26.0195Z" fill="#0850C5"/>
43
- <path d="M57.3202 40V31.46L42.6602 39.92V48.47L62.2302 92.19L72.0002 86.55V74.52L57.3202 40Z" fill="#0850C5"/>
44
- {{/if}}
45
- {{#if (eq this.logo 'vault')}}
46
- <path d="M16.8809 21.15L71.8009 131.4L127.121 21.15H16.8809ZM78.3409 43.27H84.7309V49.67H78.3409V43.27ZM65.6109 68.84H59.2209V62.45H65.6109V68.84ZM65.6109 59.25H59.2209V52.86H65.6109V59.25ZM65.6109 49.67H59.2209V43.27H65.6109V49.67ZM75.2009 78.43H68.8009V72H75.2009V78.43ZM75.2009 68.84H68.8009V62.45H75.2009V68.84ZM75.2009 59.25H68.8009V52.86H75.2009V59.25ZM75.2009 49.67H68.8009V43.27H75.2009V49.67ZM78.3409 52.86H84.7309V59.25H78.3409V52.86ZM78.3409 68.86V62.45H84.7309V68.84L78.3409 68.86Z" fill="currentColor"/>
47
- {{/if}}
48
- {{#if (eq this.logo 'waypoint')}}
49
- <path d="M143.23 27.66L125.44 58.47L107.65 27.66H143.23Z" fill="currentColor"/>
50
- <path d="M48.2595 48.23H36.3895L66.0595 99.63L54.1895 120.19L0.769531 27.66H60.1295L89.8095 79.07L95.7395 68.79L71.9995 27.66H95.7395L107.62 48.23L119.49 68.79L89.8095 120.19L48.2595 48.23Z" fill="currentColor"/>
51
- {{/if}}
52
- </svg>
53
- </div>
8
+ <div class="hds-icon-tile__logo">
9
+ <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched="true" />
10
+ </div>
54
11
  {{/if}}
55
12
  {{#if this.iconSecondary}}
56
13
  <div class="hds-icon-tile__extra">
@@ -7,6 +7,7 @@ export const SIZES = ['small', 'medium', 'large'];
7
7
  export const PRODUCTS = [
8
8
  'boundary',
9
9
  'consul',
10
+ 'hcp',
10
11
  'nomad',
11
12
  'packer',
12
13
  'terraform',
@@ -38,15 +39,6 @@ export default class HdsIconTileIndexComponent extends Component {
38
39
  return size;
39
40
  }
40
41
 
41
- /**
42
- * Get a class to apply to the component based on the size argument.
43
- * @method IconTile#sizeClass
44
- * @return {string} The css class to apply to the component.
45
- */
46
- get sizeClass() {
47
- return `hds-icon-tile--size-${this.size}`;
48
- }
49
-
50
42
  /**
51
43
  * Sets the color scheme for the component
52
44
  * Accepted values: see THE COLORS LIST
@@ -74,15 +66,6 @@ export default class HdsIconTileIndexComponent extends Component {
74
66
  return color;
75
67
  }
76
68
 
77
- /**
78
- * Get a class to apply to the component based on the color argument.
79
- * @method IconTile#colorClass
80
- * @return {string} The css class to apply to the component.
81
- */
82
- get colorClass() {
83
- return `hds-icon-tile--color-${this.color}`;
84
- }
85
-
86
69
  /**
87
70
  * Sets the icon name (one of the FlightIcons)
88
71
  *
@@ -91,7 +74,14 @@ export default class HdsIconTileIndexComponent extends Component {
91
74
  * @default null
92
75
  */
93
76
  get icon() {
94
- return this.args.icon ?? null;
77
+ if (this.args.logo) {
78
+ // for the logo version we use the colored versions directly
79
+ return `${this.args.logo}-color`;
80
+ } else if (this.args.icon) {
81
+ return this.args.icon;
82
+ } else {
83
+ return null;
84
+ }
95
85
  }
96
86
 
97
87
  /**
@@ -159,15 +149,6 @@ export default class HdsIconTileIndexComponent extends Component {
159
149
  return entity;
160
150
  }
161
151
 
162
- /**
163
- * Get a class to apply to the component based on the its entity.
164
- * @method IconTile#entityClass
165
- * @return {string} The css class to apply to the component.
166
- */
167
- get entityClass() {
168
- return `hds-icon-tile--${this.entity}`;
169
- }
170
-
171
152
  /**
172
153
  * Sets the "secondary" icon name (one of the FlightIcons)
173
154
  *
@@ -178,4 +159,25 @@ export default class HdsIconTileIndexComponent extends Component {
178
159
  get iconSecondary() {
179
160
  return this.args.iconSecondary ?? null;
180
161
  }
162
+
163
+ /**
164
+ * Get the class names to apply to the component.
165
+ * @method IconTile#classNames
166
+ * @return {string} The "class" attribute to apply to the component.
167
+ */
168
+ // hds-icon-tile {{this.entityClass}} {{this.sizeClass}} {{this.colorClass}}"
169
+ get classNames() {
170
+ let classes = ['hds-icon-tile'];
171
+
172
+ // add a class based on its entity argument
173
+ classes.push(`hds-icon-tile--${this.entity}`);
174
+
175
+ // add a class based on the @size argument
176
+ classes.push(`hds-icon-tile--size-${this.size}`);
177
+
178
+ // add a class based on the @color argument
179
+ classes.push(`hds-icon-tile--color-${this.color}`);
180
+
181
+ return classes.join(' ');
182
+ }
181
183
  }
@@ -0,0 +1,20 @@
1
+ {{! template-lint-disable link-href-attributes }}
2
+ {{! we can disable this linting rule because the developer will add the html attribute themselves }}
3
+ <a class={{this.classNames}} target="_blank" rel="noopener noreferrer" ...attributes>
4
+ {{#if (eq this.iconPosition "leading")}}
5
+ <div class="hds-link-standalone__icon">
6
+ <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />
7
+ </div>
8
+ <div class="hds-link-standalone__text">
9
+ {{this.text}}
10
+ </div>
11
+ {{else}}
12
+ <div class="hds-link-standalone__text">
13
+ {{this.text}}
14
+ </div>
15
+ <div class="hds-link-standalone__icon">
16
+ <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />
17
+ </div>
18
+ {{/if}}
19
+ </a>
20
+ {{! template-lint-enable link-href-attributes }}