@hashicorp/design-system-components 1.1.0 → 1.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 +14 -0
- package/addon/components/hds/form/radio-card/description.hbs +1 -0
- package/addon/components/hds/form/radio-card/group.hbs +26 -0
- package/addon/components/hds/form/radio-card/index.hbs +20 -0
- package/addon/components/hds/form/radio-card/index.js +90 -0
- package/addon/components/hds/form/radio-card/label.hbs +1 -0
- package/app/components/hds/form/radio-card/description.js +1 -0
- package/app/components/hds/form/radio-card/group.js +1 -0
- package/app/components/hds/form/radio-card/index.js +1 -0
- package/app/components/hds/form/radio-card/label.js +1 -0
- package/app/styles/components/form/index.scss +1 -0
- package/app/styles/components/form/radio-card.scss +146 -0
- package/package.json +5 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @hashicorp/design-system-components
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#576](https://github.com/hashicorp/design-system/pull/576) [`ab821911`](https://github.com/hashicorp/design-system/commit/ab821911e8d7f99b2b70e41e06f3fe8f681f9c8f) Thanks [@alex-ju](https://github.com/alex-ju)! - Add `RadioCard` component
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#586](https://github.com/hashicorp/design-system/pull/586) [`55ec4246`](https://github.com/hashicorp/design-system/commit/55ec424615505733159ac420284c47758f0667a3) Thanks [@Dhaulagiri](https://github.com/Dhaulagiri)! - make ember-truth-helpers a dependency
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`55f38cb3`](https://github.com/hashicorp/design-system/commit/55f38cb3a30a6edf8854e53ce3642270fe00efdc), [`258c06d9`](https://github.com/hashicorp/design-system/commit/258c06d952d41696bb8c5b4bab19eb46e4612cdc)]:
|
|
14
|
+
- @hashicorp/ember-flight-icons@3.0.0
|
|
15
|
+
- @hashicorp/design-system-tokens@1.1.0
|
|
16
|
+
|
|
3
17
|
## 1.1.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<span class="hds-form-radio-card__description hds-typography-body-100" ...attributes>{{yield}}</span>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<Hds::Form::Fieldset
|
|
2
|
+
class="hds-form-group--radio-cards"
|
|
3
|
+
@layout="horizontal"
|
|
4
|
+
@name={{@name}}
|
|
5
|
+
@isRequired={{@isRequired}}
|
|
6
|
+
@isOptional={{@isOptional}}
|
|
7
|
+
...attributes
|
|
8
|
+
as |F|
|
|
9
|
+
>
|
|
10
|
+
{{! Notice: the order of the elements is not relevant here, because it's controlled at "Hds::Form::Fieldset" component level }}
|
|
11
|
+
{{yield (hash Legend=F.Legend isRequired=F.isRequired isOptional=F.isOptional)}}
|
|
12
|
+
{{yield (hash HelperText=F.HelperText Error=F.Error)}}
|
|
13
|
+
<F.Control>
|
|
14
|
+
{{yield
|
|
15
|
+
(hash
|
|
16
|
+
RadioCard=(component
|
|
17
|
+
"hds/form/radio-card"
|
|
18
|
+
name=@name
|
|
19
|
+
alignment=@alignment
|
|
20
|
+
controlPosition=@controlPosition
|
|
21
|
+
extraAriaDescribedBy=F.ariaDescribedBy
|
|
22
|
+
)
|
|
23
|
+
)
|
|
24
|
+
}}
|
|
25
|
+
</F.Control>
|
|
26
|
+
</Hds::Form::Fieldset>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<label class={{this.classNames}} {{did-insert this.setAriaDescribedBy}} {{style maxWidth=@maxWidth}}>
|
|
2
|
+
<span class="hds-form-radio-card__content">
|
|
3
|
+
{{yield (hash Icon=(component "flight-icon" size="24" isInlineBlock=false))}}
|
|
4
|
+
{{yield (hash Label=(component "hds/form/radio-card/label"))}}
|
|
5
|
+
{{yield (hash Badge=(component "hds/badge"))}}
|
|
6
|
+
{{yield (hash Description=(component "hds/form/radio-card/description"))}}
|
|
7
|
+
{{yield (hash Generic=(component "hds/yield"))}}
|
|
8
|
+
</span>
|
|
9
|
+
<span class="hds-form-radio-card__control-wrapper">
|
|
10
|
+
<Hds::Form::Radio::Base
|
|
11
|
+
class="hds-form-radio-card__control"
|
|
12
|
+
@value={{@value}}
|
|
13
|
+
name={{@name}}
|
|
14
|
+
checked={{@checked}}
|
|
15
|
+
disabled={{@disabled}}
|
|
16
|
+
aria-describedby={{this.ariaDescribedBy}}
|
|
17
|
+
...attributes
|
|
18
|
+
/>
|
|
19
|
+
</span>
|
|
20
|
+
</label>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { action } from '@ember/object';
|
|
4
|
+
import { assert } from '@ember/debug';
|
|
5
|
+
import { setAriaDescribedBy } from '../utils/setAriaDescribedBy';
|
|
6
|
+
import { schedule } from '@ember/runloop';
|
|
7
|
+
|
|
8
|
+
export const DEFAULT_CONTROL_POSITION = 'bottom';
|
|
9
|
+
export const DEFAULT_ALIGNMENT = 'left';
|
|
10
|
+
export const CONTROL_POSITIONS = ['bottom', 'left'];
|
|
11
|
+
export const ALIGNMENTS = ['left', 'center'];
|
|
12
|
+
|
|
13
|
+
export default class HdsFormRadioCardIndexComponent extends Component {
|
|
14
|
+
@tracked ariaDescribedBy = this.args.extraAriaDescribedBy;
|
|
15
|
+
@tracked descriptors = [];
|
|
16
|
+
|
|
17
|
+
@action
|
|
18
|
+
setAriaDescribedBy() {
|
|
19
|
+
// we schedule this afterRender to capture all descriptors registered onInsert
|
|
20
|
+
schedule('afterRender', () => {
|
|
21
|
+
setAriaDescribedBy(this);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Sets the position of the control
|
|
27
|
+
* Accepted values: buttom, left
|
|
28
|
+
*
|
|
29
|
+
* @param type
|
|
30
|
+
* @type {string}
|
|
31
|
+
* @default 'bottom'
|
|
32
|
+
*/
|
|
33
|
+
get controlPosition() {
|
|
34
|
+
let { controlPosition = DEFAULT_CONTROL_POSITION } = this.args;
|
|
35
|
+
|
|
36
|
+
assert(
|
|
37
|
+
`@controlPosition for "Hds::Form::RadioCard" must be one of the following: ${CONTROL_POSITIONS.join(
|
|
38
|
+
', '
|
|
39
|
+
)}; received: ${controlPosition}`,
|
|
40
|
+
CONTROL_POSITIONS.includes(controlPosition)
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return controlPosition;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Sets the alignment of the content
|
|
48
|
+
* Accepted values: left, center
|
|
49
|
+
*
|
|
50
|
+
* @param alignnment
|
|
51
|
+
* @type {string}
|
|
52
|
+
* @default 'left'
|
|
53
|
+
*/
|
|
54
|
+
get alignment() {
|
|
55
|
+
let { alignment = DEFAULT_ALIGNMENT } = this.args;
|
|
56
|
+
|
|
57
|
+
assert(
|
|
58
|
+
`@alignment for "Hds::Form::RadioCard" must be one of the following: ${ALIGNMENTS.join(
|
|
59
|
+
', '
|
|
60
|
+
)}; received: ${alignment}`,
|
|
61
|
+
ALIGNMENTS.includes(alignment)
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
return alignment;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Get the class names to apply to the component.
|
|
69
|
+
* @method classNames
|
|
70
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
71
|
+
*/
|
|
72
|
+
get classNames() {
|
|
73
|
+
let classes = ['hds-form-radio-card'];
|
|
74
|
+
|
|
75
|
+
if (this.args.checked) {
|
|
76
|
+
classes.push('hds-form-radio-card--checked');
|
|
77
|
+
}
|
|
78
|
+
if (this.args.disabled) {
|
|
79
|
+
classes.push('hds-form-radio-card--disabled');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// add a class based on the @controlPosition argument
|
|
83
|
+
classes.push(`hds-form-radio-card--control-${this.controlPosition}`);
|
|
84
|
+
|
|
85
|
+
// add a class based on the @alignment argument
|
|
86
|
+
classes.push(`hds-form-radio-card--align-${this.alignment}`);
|
|
87
|
+
|
|
88
|
+
return classes.join(' ');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<span class="hds-form-radio-card__label hds-typography-display-300 hds-font-weight-bold" ...attributes>{{yield}}</span>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/form/radio-card/description';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/form/radio-card/group';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/form/radio-card/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@hashicorp/design-system-components/components/hds/form/radio-card/label';
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// FORM > RADIO-CARD
|
|
2
|
+
|
|
3
|
+
// RadioCard Group
|
|
4
|
+
|
|
5
|
+
.hds-form-group--radio-cards {
|
|
6
|
+
.hds-form-group__control-fields-wrapper {
|
|
7
|
+
margin: calc(-1 * var(--token-form-radiocard-group-gap) / 2);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.hds-form-group__legend {
|
|
11
|
+
margin-bottom: 12px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.hds-form-radio-card {
|
|
15
|
+
flex: 1;
|
|
16
|
+
margin: calc(var(--token-form-radiocard-group-gap) / 2);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// RadioCard
|
|
21
|
+
|
|
22
|
+
.hds-form-radio-card {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
background-color: var(--token-color-surface-primary);
|
|
26
|
+
border: var(--token-form-radiocard-border-width) solid var(--token-color-border-primary);
|
|
27
|
+
border-radius: var(--token-form-radiocard-border-radius);
|
|
28
|
+
box-shadow: var(--token-elevation-mid-box-shadow);
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
|
|
31
|
+
// prevent focus on the form control as it is handled at the card level
|
|
32
|
+
.hds-form-radio-card__control {
|
|
33
|
+
outline-color: transparent;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// STATES
|
|
37
|
+
|
|
38
|
+
&:hover,
|
|
39
|
+
&.mock-hover {
|
|
40
|
+
box-shadow: var(--token-elevation-high-box-shadow);
|
|
41
|
+
transition: var(--token-form-radiocard-transition-duration);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:focus-within,
|
|
45
|
+
&.mock-focus {
|
|
46
|
+
border-color: var(--token-color-focus-action-internal);
|
|
47
|
+
box-shadow: 0 0 0 3px var(--token-color-focus-action-external);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&--checked,
|
|
51
|
+
&.mock-checked {
|
|
52
|
+
border-color: var(--token-color-focus-action-internal);
|
|
53
|
+
|
|
54
|
+
.hds-form-radio-card__control-wrapper {
|
|
55
|
+
background-color: var(--token-color-surface-action);
|
|
56
|
+
border-color: var(--token-color-border-action);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&--disabled,
|
|
61
|
+
&.mock-disabled {
|
|
62
|
+
background-color: var(--token-color-surface-interactive-disabled);
|
|
63
|
+
border-color: var(--token-color-border-primary);
|
|
64
|
+
box-shadow: none;
|
|
65
|
+
cursor: not-allowed;
|
|
66
|
+
|
|
67
|
+
.hds-form-radio-card__control-wrapper {
|
|
68
|
+
background-color: var(--token-color-surface-interactive-disabled);
|
|
69
|
+
border-color: var(--token-color-border-primary);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ALIGNMENT
|
|
75
|
+
|
|
76
|
+
.hds-form-radio-card--align-left {
|
|
77
|
+
text-align: left;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.hds-form-radio-card--align-center {
|
|
81
|
+
text-align: center;
|
|
82
|
+
|
|
83
|
+
// stylelint-disable-next-line selector-class-pattern
|
|
84
|
+
.flight-icon {
|
|
85
|
+
margin: auto;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// CONTROL POSITION
|
|
90
|
+
|
|
91
|
+
.hds-form-radio-card--control-bottom {
|
|
92
|
+
.hds-form-radio-card__control-wrapper {
|
|
93
|
+
border-top-width: var(--token-form-radiocard-border-width);
|
|
94
|
+
border-top-style: solid;
|
|
95
|
+
border-bottom-right-radius: inherit;
|
|
96
|
+
border-bottom-left-radius: inherit;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.hds-form-radio-card--control-left {
|
|
101
|
+
flex-direction: row-reverse;
|
|
102
|
+
|
|
103
|
+
.hds-form-radio-card__control-wrapper {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
border-right-width: var(--token-form-radiocard-border-width);
|
|
107
|
+
border-right-style: solid;
|
|
108
|
+
border-top-left-radius: inherit;
|
|
109
|
+
border-bottom-left-radius: inherit;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.hds-form-radio-card__content {
|
|
114
|
+
flex: 1;
|
|
115
|
+
padding: var(--token-form-radiocard-content-padding);
|
|
116
|
+
|
|
117
|
+
.hds-badge {
|
|
118
|
+
margin-bottom: 12px;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.hds-form-radio-card__label {
|
|
123
|
+
display: block;
|
|
124
|
+
margin: 8px 0;
|
|
125
|
+
color: var(--token-form-label-color);
|
|
126
|
+
|
|
127
|
+
&:first-child {
|
|
128
|
+
margin-top: 0;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.hds-form-radio-card__description {
|
|
133
|
+
display: block;
|
|
134
|
+
color: var(--token-color-foreground-primary);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.hds-form-radio-card__control-wrapper {
|
|
138
|
+
padding: var(--token-form-radiocard-control-padding);
|
|
139
|
+
background-color: var(--token-color-surface-faint);
|
|
140
|
+
border-color: var(--token-color-border-primary);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.hds-form-radio-card__control {
|
|
144
|
+
display: block;
|
|
145
|
+
margin: auto;
|
|
146
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashicorp/design-system-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "HashiCorp Design System Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hashicorp",
|
|
@@ -36,14 +36,15 @@
|
|
|
36
36
|
"test:ember:percy": "percy exec ember test"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@hashicorp/design-system-tokens": "^1.0
|
|
40
|
-
"@hashicorp/ember-flight-icons": "^
|
|
39
|
+
"@hashicorp/design-system-tokens": "^1.1.0",
|
|
40
|
+
"@hashicorp/ember-flight-icons": "^3.0.0",
|
|
41
41
|
"ember-auto-import": "^2.4.1",
|
|
42
42
|
"ember-cli-babel": "^7.26.11",
|
|
43
43
|
"ember-cli-htmlbars": "^6.0.1",
|
|
44
44
|
"ember-cli-sass": "^10.0.1",
|
|
45
45
|
"ember-keyboard": "^8.1.0",
|
|
46
46
|
"ember-named-blocks-polyfill": "^0.2.5",
|
|
47
|
+
"ember-truth-helpers": "^3.0.0",
|
|
47
48
|
"sass": "^1.43.4"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
"@embroider/test-setup": "^1.5.0",
|
|
53
54
|
"@glimmer/component": "^1.0.4",
|
|
54
55
|
"@glimmer/tracking": "^1.0.4",
|
|
55
|
-
"@percy/cli": "^1.10.
|
|
56
|
+
"@percy/cli": "^1.10.4",
|
|
56
57
|
"@percy/ember": "^4.0.0",
|
|
57
58
|
"babel-eslint": "^10.1.0",
|
|
58
59
|
"broccoli-asset-rev": "^3.0.0",
|
|
@@ -63,7 +64,6 @@
|
|
|
63
64
|
"ember-cli-dependency-checker": "^3.3.0",
|
|
64
65
|
"ember-cli-deprecation-workflow": "^2.1.0",
|
|
65
66
|
"ember-cli-inject-live-reload": "^2.1.0",
|
|
66
|
-
"ember-cli-markdown-it-templates": "^0.0.3",
|
|
67
67
|
"ember-cli-sri": "^2.1.1",
|
|
68
68
|
"ember-cli-string-helpers": "^6.1.0",
|
|
69
69
|
"ember-cli-terser": "^4.0.2",
|
|
@@ -81,7 +81,6 @@
|
|
|
81
81
|
"ember-style-modifier": "^0.8.0",
|
|
82
82
|
"ember-template-lint": "^4.3.0",
|
|
83
83
|
"ember-template-lint-plugin-prettier": "^4.0.0",
|
|
84
|
-
"ember-truth-helpers": "^3.0.0",
|
|
85
84
|
"ember-try": "^2.0.0",
|
|
86
85
|
"eslint": "^7.32.0",
|
|
87
86
|
"eslint-config-prettier": "^8.5.0",
|
|
@@ -99,7 +98,6 @@
|
|
|
99
98
|
"stylelint-config-rational-order": "^0.1.2",
|
|
100
99
|
"stylelint-config-standard-scss": "^5.0.0",
|
|
101
100
|
"stylelint-prettier": "^2.0.0",
|
|
102
|
-
"version-bump-prompt": "^6.1.0",
|
|
103
101
|
"webpack": "^5.70.0"
|
|
104
102
|
},
|
|
105
103
|
"engines": {
|