@hashicorp/design-system-components 0.12.13 → 1.0.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 +49 -0
- package/NEW-COMPONENT-CHECKLIST.md +6 -6
- package/addon/components/hds/button-set/index.hbs +3 -0
- package/addon/components/hds/form/checkbox/field.hbs +2 -0
- package/addon/components/hds/form/checkbox/group.hbs +13 -2
- package/addon/components/hds/form/field/index.hbs +1 -1
- package/addon/components/hds/form/field/index.js +11 -3
- package/addon/components/hds/form/fieldset/index.hbs +2 -2
- package/addon/components/hds/form/fieldset/index.js +7 -3
- package/addon/components/hds/form/indicator/index.hbs +2 -2
- package/addon/components/hds/form/indicator/index.js +22 -0
- package/addon/components/hds/form/radio/field.hbs +2 -0
- package/addon/components/hds/form/radio/group.hbs +13 -2
- package/addon/components/hds/form/select/field.hbs +1 -0
- package/addon/components/hds/form/text-input/field.hbs +1 -0
- package/addon/components/hds/form/textarea/field.hbs +1 -0
- package/addon/components/hds/form/toggle/field.hbs +1 -0
- package/addon/components/hds/form/toggle/group.hbs +4 -1
- package/addon/components/hds/form/utils/setAriaDescribedBy.js +10 -0
- package/addon/components/hds/stepper/step/indicator.hbs +19 -0
- package/addon/components/hds/stepper/step/indicator.js +54 -0
- package/addon/components/hds/stepper/task/indicator.hbs +3 -0
- package/addon/components/hds/stepper/task/indicator.js +69 -0
- package/addon/components/hds/tag/index.hbs +26 -0
- package/addon/components/hds/tag/index.js +76 -0
- package/app/components/hds/button-set/index.js +1 -0
- package/app/components/hds/stepper/step/indicator.js +1 -0
- package/app/components/hds/stepper/task/indicator.js +1 -0
- package/app/components/hds/tag/index.js +1 -0
- package/app/styles/@hashicorp/design-system-components.scss +3 -0
- package/app/styles/components/button-set.scss +13 -0
- package/app/styles/components/form/checkbox.scss +20 -29
- package/app/styles/components/form/error.scss +3 -3
- package/app/styles/components/form/helper-text.scss +1 -1
- package/app/styles/components/form/index.scss +0 -3
- package/app/styles/components/form/indicator.scss +1 -6
- package/app/styles/components/form/label.scss +1 -1
- package/app/styles/components/form/legend.scss +1 -1
- package/app/styles/components/form/radio.scss +21 -30
- package/app/styles/components/form/select.scss +46 -16
- package/app/styles/components/form/text-input.scss +26 -29
- package/app/styles/components/form/textarea.scss +14 -14
- package/app/styles/components/form/toggle.scss +46 -52
- package/app/styles/components/stepper/index.scss +2 -0
- package/app/styles/components/stepper/step-indicator.scss +180 -0
- package/app/styles/components/stepper/task-indicator.scss +70 -0
- package/app/styles/components/tag.scss +103 -0
- package/package.json +4 -4
- package/addon/components/hds/form/utils/getAriaDescribedBy.js +0 -21
- package/app/styles/components/form/_tokens.scss +0 -41
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @hashicorp/design-system-components
|
|
2
2
|
|
|
3
|
+
## 1.0.0 🎉
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
This release signifies the first major release of the HashiCorp Design System. Moving forward we expect to respect [SemVer](https://semver.org/) as we make additional changes to the design system.
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
#### Stepper component
|
|
12
|
+
|
|
13
|
+
- [#470](https://github.com/hashicorp/design-system/pull/470) [`96d47264`](https://github.com/hashicorp/design-system/commit/96d4726404664f301df0352a1fdbc4b6b6e9cb88) Thanks [@jorytindall](https://github.com/jorytindall)! - Added Stepper component structure and step/task components
|
|
14
|
+
|
|
15
|
+
#### ButtonSet component
|
|
16
|
+
* [#486](https://github.com/hashicorp/design-system/pull/486) [`3ea2ad55`](https://github.com/hashicorp/design-system/commit/3ea2ad55b2ec9c579e2154ac4bb820f06a231e9f) Thanks [@KristinLBradley](https://github.com/KristinLBradley)! - Add new ButtonSet component to standardize button spacing
|
|
17
|
+
|
|
18
|
+
#### Tag component
|
|
19
|
+
- [#443](https://github.com/hashicorp/design-system/pull/443) [`7756c855`](https://github.com/hashicorp/design-system/commit/7756c8554114564eccb2b08872ceabff02351682) Thanks [@alex-ju](https://github.com/alex-ju) & [@agendelHC](https://github.com/agendelHC)! - Add tag component
|
|
20
|
+
|
|
21
|
+
#### Form controls components
|
|
22
|
+
|
|
23
|
+
- [#447](https://github.com/hashicorp/design-system/pull/447) [`0b1e9855`](https://github.com/hashicorp/design-system/commit/0b1e985586b8f531a6208ea5ce25ac74faa77dda) Thanks [@didoo](https://github.com/didoo)!
|
|
24
|
+
|
|
25
|
+
- Added the form **`TextInput`** controls (`Base`, `Field`)
|
|
26
|
+
- Added the form **`Textarea`** controls (`Base`, `Field`)
|
|
27
|
+
- Added the form **`Select`** controls (`Base`, `Field`)
|
|
28
|
+
- Added the form **`Checkbox`** controls (`Base`, `Field`, `Group`)
|
|
29
|
+
- Added the form **`Radio`** controls (`Base`, `Field`, `Group`)
|
|
30
|
+
- Added the form **`Toggle`** controls (`Base`, `Field`, `Group`)
|
|
31
|
+
- Added the form "base" low-level elements: **`Label`**, **`HelperText`**, **`Error`**, **`Legend`**, **`Field`**, **`Fieldset`**
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [[`0b1e9855`](https://github.com/hashicorp/design-system/commit/0b1e985586b8f531a6208ea5ce25ac74faa77dda)]:
|
|
36
|
+
- @hashicorp/design-system-tokens@1.0.0
|
|
37
|
+
|
|
38
|
+
## 0.12.15
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies []:
|
|
43
|
+
- @hashicorp/ember-flight-icons@2.0.10
|
|
44
|
+
|
|
45
|
+
## 0.12.14
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies []:
|
|
50
|
+
- @hashicorp/ember-flight-icons@2.0.9
|
|
51
|
+
|
|
3
52
|
## 0.12.13
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
|
@@ -76,11 +76,10 @@ The engineering checklist has six parts: creating the feature branch, component
|
|
|
76
76
|
### Component Creation
|
|
77
77
|
|
|
78
78
|
- [ ] create new branch from main for the component (`git checkout -b USER/COMPONENT-NAME`)
|
|
79
|
-
- [ ] create new component
|
|
80
|
-
- `ember generate component
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
- tip: if you need to destroy a component and start over again, `ember destroy component hds/COMPONENT-NAME/index` will remove the component and the related files as appropriate.
|
|
79
|
+
- [ ] create new component using a blueprint
|
|
80
|
+
- `ember generate hds-component COMPONENT-NAME`
|
|
81
|
+
- if it's a child component, then `hds/COMPONENT_NAME/CHILD_NAME`
|
|
82
|
+
- (Note: Many of the below mentioned files will be automatically generated.)
|
|
84
83
|
- [ ] **component template**
|
|
85
84
|
- use semantic HTML
|
|
86
85
|
- 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.
|
|
@@ -140,4 +139,5 @@ Pre-review request checks:
|
|
|
140
139
|
When ready for review:
|
|
141
140
|
|
|
142
141
|
- [ ] add situationally appropriate reviewers
|
|
143
|
-
- [ ]
|
|
142
|
+
- [ ] add instructions for reviewers in your PR, letting them know what kind of review you need
|
|
143
|
+
- [ ] add a changelog update via [Changesets](https://github.com/changesets/changesets) if needed using the command `yarn changeset` (in the project root)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
@layout="flag"
|
|
3
3
|
@contextualClass={{@contextualClass}}
|
|
4
4
|
@extraAriaDescribedBy={{@extraAriaDescribedBy}}
|
|
5
|
+
@id={{@id}}
|
|
5
6
|
as |F|
|
|
6
7
|
>
|
|
7
8
|
{{! Notice: the order of the elements is not relevant here, because it's controlled at "Hds::Form::Field" component level }}
|
|
@@ -10,6 +11,7 @@
|
|
|
10
11
|
<Hds::Form::Checkbox::Base
|
|
11
12
|
class="hds-form-field__control"
|
|
12
13
|
@value={{@value}}
|
|
14
|
+
name={{@name}}
|
|
13
15
|
...attributes
|
|
14
16
|
id={{F.id}}
|
|
15
17
|
aria-describedby={{F.ariaDescribedBy}}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
<Hds::Form::Fieldset
|
|
1
|
+
<Hds::Form::Fieldset
|
|
2
|
+
@layout={{@layout}}
|
|
3
|
+
@name={{@name}}
|
|
4
|
+
@isRequired={{@isRequired}}
|
|
5
|
+
@isOptional={{@isOptional}}
|
|
6
|
+
...attributes
|
|
7
|
+
as |F|
|
|
8
|
+
>
|
|
2
9
|
{{! Notice: the order of the elements is not relevant here, because it's controlled at "Hds::Form::Fieldset" component level }}
|
|
3
10
|
{{yield (hash Legend=F.Legend isRequired=F.isRequired isOptional=F.isOptional)}}
|
|
4
11
|
{{yield (hash HelperText=F.HelperText Error=F.Error)}}
|
|
@@ -6,7 +13,11 @@
|
|
|
6
13
|
{{yield
|
|
7
14
|
(hash
|
|
8
15
|
Checkbox::Field=(component
|
|
9
|
-
"hds/form/checkbox/field"
|
|
16
|
+
"hds/form/checkbox/field"
|
|
17
|
+
contextualClass="hds-form-group__control-field"
|
|
18
|
+
isRequired=@isRequired
|
|
19
|
+
name=@name
|
|
20
|
+
extraAriaDescribedBy=F.ariaDescribedBy
|
|
10
21
|
)
|
|
11
22
|
)
|
|
12
23
|
}}
|
|
@@ -3,18 +3,26 @@ import { tracked } from '@glimmer/tracking';
|
|
|
3
3
|
import { assert } from '@ember/debug';
|
|
4
4
|
import { action } from '@ember/object';
|
|
5
5
|
import { getElementId } from '../utils/getElementId';
|
|
6
|
-
import {
|
|
6
|
+
import { setAriaDescribedBy } from '../utils/setAriaDescribedBy';
|
|
7
|
+
import { schedule } from '@ember/runloop';
|
|
7
8
|
|
|
8
9
|
export const LAYOUT_TYPES = ['vertical', 'flag'];
|
|
9
10
|
|
|
10
11
|
export default class HdsFormFieldIndexComponent extends Component {
|
|
11
|
-
@tracked ariaDescribedBy =
|
|
12
|
+
@tracked ariaDescribedBy = this.args.extraAriaDescribedBy;
|
|
12
13
|
@tracked descriptors = [];
|
|
13
14
|
|
|
14
15
|
@action
|
|
15
16
|
appendDescriptor(element) {
|
|
16
17
|
this.descriptors.push(element.id);
|
|
17
|
-
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@action
|
|
21
|
+
setAriaDescribedBy() {
|
|
22
|
+
// we schedule this afterRender to capture all descriptors registered onInsert
|
|
23
|
+
schedule('afterRender', () => {
|
|
24
|
+
setAriaDescribedBy(this);
|
|
25
|
+
});
|
|
18
26
|
}
|
|
19
27
|
|
|
20
28
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<fieldset class={{this.classNames}} id={{this.id}}
|
|
1
|
+
<fieldset class={{this.classNames}} id={{this.id}} {{did-insert this.setAriaDescribedBy}} ...attributes>
|
|
2
2
|
{{yield
|
|
3
3
|
(hash
|
|
4
4
|
Legend=(component
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
)
|
|
18
18
|
}}
|
|
19
19
|
<div class="hds-form-group__control-fields-wrapper">
|
|
20
|
-
{{yield (hash Control=(component "hds/yield"))}}
|
|
20
|
+
{{yield (hash Control=(component "hds/yield") ariaDescribedBy=this.ariaDescribedBy)}}
|
|
21
21
|
</div>
|
|
22
22
|
{{yield
|
|
23
23
|
(hash
|
|
@@ -2,16 +2,20 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import { tracked } from '@glimmer/tracking';
|
|
3
3
|
import { action } from '@ember/object';
|
|
4
4
|
import { getElementId } from '../utils/getElementId';
|
|
5
|
-
import {
|
|
5
|
+
import { setAriaDescribedBy } from '../utils/setAriaDescribedBy';
|
|
6
6
|
|
|
7
7
|
export default class HdsFormFieldsetIndexComponent extends Component {
|
|
8
|
-
@tracked ariaDescribedBy =
|
|
8
|
+
@tracked ariaDescribedBy = this.args.extraAriaDescribedBy;
|
|
9
9
|
@tracked descriptors = [];
|
|
10
10
|
|
|
11
11
|
@action
|
|
12
12
|
appendDescriptor(element) {
|
|
13
13
|
this.descriptors.push(element.id);
|
|
14
|
-
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@action
|
|
17
|
+
setAriaDescribedBy() {
|
|
18
|
+
setAriaDescribedBy(this);
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{{#if @isOptional}}
|
|
2
|
-
<span class=
|
|
2
|
+
<span class={{this.classNames}}>(Optional)</span>
|
|
3
3
|
{{/if}}
|
|
4
4
|
{{#if @isRequired}}
|
|
5
|
-
<Hds::Badge class=
|
|
5
|
+
<Hds::Badge class={{this.classNames}} @size="small" @color="neutral" @text="Required" />
|
|
6
6
|
{{/if}}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
|
|
3
|
+
export default class HdsFormIndicatorIndexComponent extends Component {
|
|
4
|
+
/**
|
|
5
|
+
* Get the class names to apply to the component.
|
|
6
|
+
* @method classNames
|
|
7
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
8
|
+
*/
|
|
9
|
+
get classNames() {
|
|
10
|
+
let classes = ['hds-form-indicator'];
|
|
11
|
+
|
|
12
|
+
if (this.args.isOptional) {
|
|
13
|
+
// add speficic class for "optional" indicator
|
|
14
|
+
classes.push('hds-form-indicator--optional');
|
|
15
|
+
|
|
16
|
+
// add typographic classes
|
|
17
|
+
classes.push('hds-typography-body-100', 'hds-font-weight-regular');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return classes.join(' ');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
@layout="flag"
|
|
3
3
|
@contextualClass={{@contextualClass}}
|
|
4
4
|
@extraAriaDescribedBy={{@extraAriaDescribedBy}}
|
|
5
|
+
@id={{@id}}
|
|
5
6
|
as |F|
|
|
6
7
|
>
|
|
7
8
|
{{! Notice: the order of the elements is not relevant here, because it's controlled at "Hds::Form::Field" component level }}
|
|
@@ -10,6 +11,7 @@
|
|
|
10
11
|
<Hds::Form::Radio::Base
|
|
11
12
|
class="hds-form-field__control"
|
|
12
13
|
@value={{@value}}
|
|
14
|
+
name={{@name}}
|
|
13
15
|
...attributes
|
|
14
16
|
id={{F.id}}
|
|
15
17
|
aria-describedby={{F.ariaDescribedBy}}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
<Hds::Form::Fieldset
|
|
1
|
+
<Hds::Form::Fieldset
|
|
2
|
+
@layout={{@layout}}
|
|
3
|
+
@name={{@name}}
|
|
4
|
+
@isRequired={{@isRequired}}
|
|
5
|
+
@isOptional={{@isOptional}}
|
|
6
|
+
...attributes
|
|
7
|
+
as |F|
|
|
8
|
+
>
|
|
2
9
|
{{! Notice: the order of the elements is not relevant here, because it's controlled at "Hds::Form::Fieldset" component level }}
|
|
3
10
|
{{yield (hash Legend=F.Legend isRequired=F.isRequired isOptional=F.isOptional)}}
|
|
4
11
|
{{yield (hash HelperText=F.HelperText Error=F.Error)}}
|
|
@@ -6,7 +13,11 @@
|
|
|
6
13
|
{{yield
|
|
7
14
|
(hash
|
|
8
15
|
Radio::Field=(component
|
|
9
|
-
"hds/form/radio/field"
|
|
16
|
+
"hds/form/radio/field"
|
|
17
|
+
contextualClass="hds-form-group__control-field"
|
|
18
|
+
isRequired=@isRequired
|
|
19
|
+
name=@name
|
|
20
|
+
extraAriaDescribedBy=F.ariaDescribedBy
|
|
10
21
|
)
|
|
11
22
|
)
|
|
12
23
|
}}
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
{{yield
|
|
7
7
|
(hash
|
|
8
8
|
Toggle::Field=(component
|
|
9
|
-
"hds/form/toggle/field"
|
|
9
|
+
"hds/form/toggle/field"
|
|
10
|
+
contextualClass="hds-form-group__control-field"
|
|
11
|
+
isRequired=@isRequired
|
|
12
|
+
extraAriaDescribedBy=F.ariaDescribedBy
|
|
10
13
|
)
|
|
11
14
|
)
|
|
12
15
|
}}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function setAriaDescribedBy(element) {
|
|
2
|
+
// append @extraAriaDescribedBy arg, if provided
|
|
3
|
+
if (element.args.extraAriaDescribedBy) {
|
|
4
|
+
element.descriptors.push(element.args.extraAriaDescribedBy);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
if (element.descriptors.length) {
|
|
8
|
+
element.ariaDescribedBy = element.descriptors.join(' ');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<div class={{this.classNames}} ...attributes aria-label={{@status}}>
|
|
2
|
+
<div class="hds-stepper-indicator-step__svg-hexagon">
|
|
3
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
4
|
+
<path
|
|
5
|
+
d="m3.664 6.264 6.99-4.42a2.5 2.5 0 0 1 2.67-.002l7.01 4.422A2.5 2.5 0 0 1 21.5 8.38v7.242a2.5 2.5 0 0 1-1.166 2.115l-7.01 4.422a2.5 2.5 0 0 1-2.67-.002l-6.99-4.42A2.5 2.5 0 0 1 2.5 15.623V8.377a2.5 2.5 0 0 1 1.164-2.113Z"
|
|
6
|
+
stroke-width="1"
|
|
7
|
+
></path>
|
|
8
|
+
</svg>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="hds-stepper-indicator-step__status">
|
|
11
|
+
{{#if (eq @status "processing")}}
|
|
12
|
+
<FlightIcon class="hds-stepper-indicator-step__icon" @name="loading" @size="16" />
|
|
13
|
+
{{else if (eq @status "complete")}}
|
|
14
|
+
<FlightIcon class="hds-stepper-indicator-step__icon" @name="check" @size="16" />
|
|
15
|
+
{{else}}
|
|
16
|
+
<span class="hds-stepper-indicator-step__text">{{@text}}</span>
|
|
17
|
+
{{/if}}
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { assert } from '@ember/debug';
|
|
3
|
+
|
|
4
|
+
export const DEFAULT_STATUS = 'incomplete';
|
|
5
|
+
export const STATUSES = ['incomplete', 'progress', 'processing', 'complete'];
|
|
6
|
+
|
|
7
|
+
export default class HdsStepperIndicatorStepIndexComponent extends Component {
|
|
8
|
+
/**
|
|
9
|
+
* @param status
|
|
10
|
+
* @type {string}
|
|
11
|
+
* @default "incomplete"
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
get status() {
|
|
15
|
+
let { status = DEFAULT_STATUS } = this.args;
|
|
16
|
+
|
|
17
|
+
assert(
|
|
18
|
+
`@status for "Hds::Stepper::Step::Indicator" must be one of the following: ${STATUSES.join(
|
|
19
|
+
', '
|
|
20
|
+
)}, received: ${status}`,
|
|
21
|
+
STATUSES.includes(status)
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return status;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @param isInteractive
|
|
29
|
+
* @type {boolean}
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
get isInteractive() {
|
|
34
|
+
return this.args.isInteractive || false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get the class names to apply to the component.
|
|
39
|
+
* @method IndicatorStep#classNames
|
|
40
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
41
|
+
*/
|
|
42
|
+
get classNames() {
|
|
43
|
+
let classes = ['hds-stepper-indicator-step'];
|
|
44
|
+
|
|
45
|
+
// Based on the @status arg
|
|
46
|
+
classes.push(`hds-stepper-indicator-step--status-${this.status}`);
|
|
47
|
+
|
|
48
|
+
if (this.isInteractive) {
|
|
49
|
+
classes.push(`hds-stepper-indicator-step--is-interactive`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return classes.join(' ');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { assert } from '@ember/debug';
|
|
3
|
+
|
|
4
|
+
export const DEFAULT_STATUS = 'incomplete';
|
|
5
|
+
export const STATUSES = ['incomplete', 'progress', 'processing', 'complete'];
|
|
6
|
+
export const MAPPING_STATUS_TO_ICONS = {
|
|
7
|
+
incomplete: 'circle',
|
|
8
|
+
progress: 'circle-half',
|
|
9
|
+
processing: 'loading',
|
|
10
|
+
complete: 'check-circle',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default class HdsStepperIndicatorTaskIndexComponent extends Component {
|
|
14
|
+
/**
|
|
15
|
+
* @param status
|
|
16
|
+
* @type {string}
|
|
17
|
+
* @default "incomplete"
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
get status() {
|
|
21
|
+
let { status = DEFAULT_STATUS } = this.args;
|
|
22
|
+
|
|
23
|
+
assert(
|
|
24
|
+
`@status for "Hds::Stepper::Task::Indicator" must be one of the following: ${STATUSES.join(
|
|
25
|
+
', '
|
|
26
|
+
)}, received: ${status}`,
|
|
27
|
+
STATUSES.includes(status)
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return status;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param isInteractive
|
|
35
|
+
* @type {boolean}
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
get isInteractive() {
|
|
40
|
+
return this.args.isInteractive || false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param iconName
|
|
45
|
+
* @type {string}
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
get iconName() {
|
|
49
|
+
return MAPPING_STATUS_TO_ICONS[this.status];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Get the class names to apply to the component.
|
|
54
|
+
* @method IndicatorTask#classNames
|
|
55
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
56
|
+
*/
|
|
57
|
+
get classNames() {
|
|
58
|
+
let classes = ['hds-stepper-indicator-task'];
|
|
59
|
+
|
|
60
|
+
// Based on the @status arg
|
|
61
|
+
classes.push(`hds-stepper-indicator-task--status-${this.status}`);
|
|
62
|
+
|
|
63
|
+
if (this.isInteractive) {
|
|
64
|
+
classes.push(`hds-stepper-indicator-task--is-interactive`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return classes.join(' ');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<span class={{this.classNames}} ...attributes>
|
|
2
|
+
{{#if this.onDismiss}}
|
|
3
|
+
<button class="hds-tag__dismiss" type="button" aria-label="Dismiss {{this.text}}" {{on "click" this.onDismiss}}>
|
|
4
|
+
<FlightIcon class="hds-tag__dismiss-icon" @name="x" @size="16" @isInlineBlock={{false}} />
|
|
5
|
+
</button>
|
|
6
|
+
{{/if}}
|
|
7
|
+
{{#if (or @href @route)}}
|
|
8
|
+
<Hds::Interactive
|
|
9
|
+
class="hds-tag__link"
|
|
10
|
+
@current-when={{@current-when}}
|
|
11
|
+
@models={{hds-link-to-models @model @models}}
|
|
12
|
+
@query={{hds-link-to-query @query}}
|
|
13
|
+
@replace={{@replace}}
|
|
14
|
+
@route={{@route}}
|
|
15
|
+
@isRouteExternal={{@isRouteExternal}}
|
|
16
|
+
@href={{@href}}
|
|
17
|
+
@isHrefExternal={{@isHrefExternal}}
|
|
18
|
+
>
|
|
19
|
+
{{this.text}}
|
|
20
|
+
</Hds::Interactive>
|
|
21
|
+
{{else}}
|
|
22
|
+
<span class="hds-tag__text">
|
|
23
|
+
{{this.text}}
|
|
24
|
+
</span>
|
|
25
|
+
{{/if}}
|
|
26
|
+
</span>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { assert } from '@ember/debug';
|
|
3
|
+
|
|
4
|
+
export const DEFAULT_COLOR = 'primary';
|
|
5
|
+
export const COLORS = ['primary', 'secondary'];
|
|
6
|
+
|
|
7
|
+
export default class HdsTagIndexComponent extends Component {
|
|
8
|
+
/**
|
|
9
|
+
* @param onDismiss
|
|
10
|
+
* @type {function}
|
|
11
|
+
* @default () => {}
|
|
12
|
+
*/
|
|
13
|
+
get onDismiss() {
|
|
14
|
+
let { onDismiss } = this.args;
|
|
15
|
+
|
|
16
|
+
if (typeof onDismiss === 'function') {
|
|
17
|
+
return onDismiss;
|
|
18
|
+
} else {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param text
|
|
25
|
+
* @type {string}
|
|
26
|
+
* @description The text of the tag. If no text value is defined, an error will be thrown.
|
|
27
|
+
*/
|
|
28
|
+
get text() {
|
|
29
|
+
let { text } = this.args;
|
|
30
|
+
|
|
31
|
+
assert('@text for "Hds::Tag" must have a valid value', text !== undefined);
|
|
32
|
+
|
|
33
|
+
return text;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param color
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @default primary
|
|
40
|
+
* @description Determines the color of link to be used; acceptable values are `primary` and `secondary`
|
|
41
|
+
*/
|
|
42
|
+
get color() {
|
|
43
|
+
if (this.args.href || this.args.route) {
|
|
44
|
+
let { color = DEFAULT_COLOR } = this.args;
|
|
45
|
+
assert(
|
|
46
|
+
`@color for "Hds::Tag" must be one of the following: ${COLORS.join(
|
|
47
|
+
', '
|
|
48
|
+
)}; received: ${color}`,
|
|
49
|
+
COLORS.includes(color)
|
|
50
|
+
);
|
|
51
|
+
return color;
|
|
52
|
+
} else if (this.args.color) {
|
|
53
|
+
assert(
|
|
54
|
+
'@color can only be applied to "Hds::Tag" along with either @href or @route',
|
|
55
|
+
this.args.href || this.args.route
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Get the class names to apply to the component.
|
|
63
|
+
* @method classNames
|
|
64
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
65
|
+
*/
|
|
66
|
+
get classNames() {
|
|
67
|
+
let classes = ['hds-tag'];
|
|
68
|
+
|
|
69
|
+
// add a class based on the @color argument
|
|
70
|
+
if (this.color) {
|
|
71
|
+
classes.push(`hds-tag--color-${this.color}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return classes.join(' ');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/button-set/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/stepper/step/indicator';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/stepper/task/indicator';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/tag/index';
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
@use "../components/badge-count";
|
|
13
13
|
@use "../components/breadcrumb";
|
|
14
14
|
@use "../components/button";
|
|
15
|
+
@use "../components/button-set";
|
|
15
16
|
@use "../components/card";
|
|
16
17
|
@use "../components/disclosure";
|
|
17
18
|
@use "../components/dropdown";
|
|
@@ -19,6 +20,8 @@
|
|
|
19
20
|
@use "../components/icon-tile";
|
|
20
21
|
@use "../components/link/inline";
|
|
21
22
|
@use "../components/link/standalone";
|
|
23
|
+
@use "../components/stepper";
|
|
24
|
+
@use "../components/tag";
|
|
22
25
|
@use "../components/toast";
|
|
23
26
|
// END COMPONENT CSS FILES IMPORTS
|
|
24
27
|
|