@hashicorp/design-system-components 0.12.10 → 0.12.13

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 (42) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/addon/components/hds/disclosure/index.js +8 -7
  3. package/addon/components/hds/form/checkbox/base.hbs +1 -1
  4. package/addon/components/hds/form/checkbox/field.hbs +1 -1
  5. package/addon/components/hds/form/checkbox/group.hbs +8 -3
  6. package/addon/components/hds/form/field/index.hbs +11 -1
  7. package/addon/components/hds/form/field/index.js +18 -0
  8. package/addon/components/hds/form/fieldset/index.hbs +7 -1
  9. package/addon/components/hds/form/fieldset/index.js +18 -0
  10. package/addon/components/hds/form/indicator/index.hbs +6 -0
  11. package/addon/components/hds/form/label/index.hbs +1 -0
  12. package/addon/components/hds/form/legend/index.hbs +1 -0
  13. package/addon/components/hds/form/radio/base.hbs +1 -1
  14. package/addon/components/hds/form/radio/field.hbs +1 -1
  15. package/addon/components/hds/form/radio/group.hbs +10 -3
  16. package/addon/components/hds/form/select/field.hbs +10 -2
  17. package/addon/components/hds/form/text-input/field.hbs +10 -2
  18. package/addon/components/hds/form/textarea/base.hbs +1 -1
  19. package/addon/components/hds/form/textarea/field.hbs +11 -2
  20. package/addon/components/hds/form/toggle/base.js +0 -5
  21. package/addon/components/hds/form/toggle/field.hbs +1 -1
  22. package/addon/components/hds/form/toggle/group.hbs +10 -3
  23. package/app/components/hds/form/indicator/index.js +1 -0
  24. package/app/styles/components/badge-count.scss +1 -0
  25. package/app/styles/components/badge.scss +2 -1
  26. package/app/styles/components/form/_tokens.scss +41 -0
  27. package/app/styles/components/form/checkbox.scss +28 -41
  28. package/app/styles/components/form/error.scss +1 -1
  29. package/app/styles/components/form/group.scss +1 -1
  30. package/app/styles/components/form/helper-text.scss +1 -1
  31. package/app/styles/components/form/index.scss +3 -0
  32. package/app/styles/components/form/indicator.scss +15 -0
  33. package/app/styles/components/form/label.scss +9 -1
  34. package/app/styles/components/form/legend.scss +9 -1
  35. package/app/styles/components/form/radio.scss +25 -42
  36. package/app/styles/components/form/select.scss +24 -12
  37. package/app/styles/components/form/text-input.scss +21 -22
  38. package/app/styles/components/form/textarea.scss +18 -20
  39. package/app/styles/components/form/toggle.scss +21 -36
  40. package/package.json +2 -2
  41. package/addon/components/hds/form/checkbox/base.js +0 -19
  42. package/addon/components/hds/form/radio/base.js +0 -19
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @hashicorp/design-system-components
2
2
 
3
+ ## 0.12.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [#461](https://github.com/hashicorp/design-system/pull/461) [`71465b37`](https://github.com/hashicorp/design-system/commit/71465b377b5ff4f47eca2bcfb096df9f082b23cb) Thanks [@alex-ju](https://github.com/alex-ju)! - Fix computation error on disclosure (take 2)
8
+
9
+ ## 0.12.12
10
+
11
+ ### Patch Changes
12
+
13
+ - [#456](https://github.com/hashicorp/design-system/pull/456) [`d0634a62`](https://github.com/hashicorp/design-system/commit/d0634a622b50c18d713afdc2fdb97a8e7a4df6af) Thanks [@alex-ju](https://github.com/alex-ju)! - Fix computation error on disclosure utility
14
+
15
+ ## 0.12.11
16
+
17
+ ### Patch Changes
18
+
19
+ - [#426](https://github.com/hashicorp/design-system/pull/426) [`ff236b25`](https://github.com/hashicorp/design-system/commit/ff236b2530dae122c011abf88baf2059a7871427) Thanks [@didoo](https://github.com/didoo)! - Updated font-weight to "medium" for "Badge" and "BadgeCount" components
20
+
3
21
  ## 0.12.10
4
22
 
5
23
  ### Patch Changes
@@ -1,11 +1,11 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { tracked } from '@glimmer/tracking';
3
3
  import { action } from '@ember/object';
4
+ import { schedule } from '@ember/runloop';
4
5
 
5
6
  export default class HdsDisclosureComponent extends Component {
6
7
  @tracked isOpen; // notice: if in the future we need to add a "@isOpen" prop to control the status from outside (eg to have the Disclosure opened on render) just add "this.args.isOpen" here to initalize the variable
7
8
  @tracked toggleRef;
8
- @tracked isToggleClicked;
9
9
 
10
10
  @action
11
11
  didInsert(element) {
@@ -43,12 +43,13 @@ export default class HdsDisclosureComponent extends Component {
43
43
 
44
44
  @action
45
45
  close() {
46
- if (this.isOpen) {
46
+ // we schedule this afterRender to avoid an error in tests caused by updating `isOpen` multiple times in the same computation
47
+ schedule('afterRender', () => {
47
48
  this.isOpen = false;
48
- }
49
- // we call the "onClose" callback if it exists (and is a function)
50
- if (this.args.onClose && typeof this.args.onClose === 'function') {
51
- this.args.onClose();
52
- }
49
+ // we call the "onClose" callback if it exists (and is a function)
50
+ if (this.args.onClose && typeof this.args.onClose === 'function') {
51
+ this.args.onClose();
52
+ }
53
+ });
53
54
  }
54
55
  }
@@ -1 +1 @@
1
- <input type="checkbox" class={{this.classNames}} ...attributes value={{@value}} />
1
+ <input type="checkbox" class="hds-form-checkbox" ...attributes value={{@value}} />
@@ -10,10 +10,10 @@
10
10
  <Hds::Form::Checkbox::Base
11
11
  class="hds-form-field__control"
12
12
  @value={{@value}}
13
- @isInvalid={{@isInvalid}}
14
13
  ...attributes
15
14
  id={{F.id}}
16
15
  aria-describedby={{F.ariaDescribedBy}}
16
+ required={{@isRequired}}
17
17
  />
18
18
  </F.Control>
19
19
  </Hds::Form::Field>
@@ -1,9 +1,14 @@
1
- <Hds::Form::Fieldset @layout={{@layout}} ...attributes as |F|>
1
+ <Hds::Form::Fieldset @layout={{@layout}} @isRequired={{@isRequired}} @isOptional={{@isOptional}} ...attributes as |F|>
2
2
  {{! Notice: the order of the elements is not relevant here, because it's controlled at "Hds::Form::Fieldset" component level }}
3
- {{yield (hash Legend=F.Legend HelperText=F.HelperText Error=F.Error)}}
3
+ {{yield (hash Legend=F.Legend isRequired=F.isRequired isOptional=F.isOptional)}}
4
+ {{yield (hash HelperText=F.HelperText Error=F.Error)}}
4
5
  <F.Control>
5
6
  {{yield
6
- (hash Checkbox::Field=(component "hds/form/checkbox/field" contextualClass="hds-form-group__control-field"))
7
+ (hash
8
+ Checkbox::Field=(component
9
+ "hds/form/checkbox/field" contextualClass="hds-form-group__control-field" isRequired=@isRequired
10
+ )
11
+ )
7
12
  }}
8
13
  </F.Control>
9
14
  </Hds::Form::Fieldset>
@@ -1,5 +1,15 @@
1
1
  <div class={{this.classNames}} ...attributes>
2
- {{yield (hash Label=(component "hds/form/label" controlId=this.id contextualClass="hds-form-field__label"))}}
2
+ {{yield
3
+ (hash
4
+ Label=(component
5
+ "hds/form/label"
6
+ controlId=this.id
7
+ isRequired=this.isRequired
8
+ isOptional=this.isOptional
9
+ contextualClass="hds-form-field__label"
10
+ )
11
+ )
12
+ }}
3
13
  {{yield
4
14
  (hash
5
15
  HelperText=(component
@@ -63,4 +63,22 @@ export default class HdsFormFieldIndexComponent extends Component {
63
63
 
64
64
  return classes.join(' ');
65
65
  }
66
+
67
+ /**
68
+ * @param isRequired
69
+ * @type {boolean}
70
+ * @default false
71
+ */
72
+ get isRequired() {
73
+ return this.args.isRequired || false;
74
+ }
75
+
76
+ /**
77
+ * @param isOptional
78
+ * @type {boolean}
79
+ * @default false
80
+ */
81
+ get isOptional() {
82
+ return this.args.isOptional || false;
83
+ }
66
84
  }
@@ -1,5 +1,11 @@
1
1
  <fieldset class={{this.classNames}} id={{this.id}} ...attributes aria-describedby={{this.ariaDescribedBy}}>
2
- {{yield (hash Legend=(component "hds/form/legend" contextualClass="hds-form-group__legend"))}}
2
+ {{yield
3
+ (hash
4
+ Legend=(component
5
+ "hds/form/legend" isRequired=this.isRequired isOptional=this.isOptional contextualClass="hds-form-group__legend"
6
+ )
7
+ )
8
+ }}
3
9
  {{yield
4
10
  (hash
5
11
  HelperText=(component
@@ -46,4 +46,22 @@ export default class HdsFormFieldsetIndexComponent extends Component {
46
46
 
47
47
  return classes.join(' ');
48
48
  }
49
+
50
+ /**
51
+ * @param isRequired
52
+ * @type {boolean}
53
+ * @default false
54
+ */
55
+ get isRequired() {
56
+ return this.args.isRequired || false;
57
+ }
58
+
59
+ /**
60
+ * @param isOptional
61
+ * @type {boolean}
62
+ * @default false
63
+ */
64
+ get isOptional() {
65
+ return this.args.isOptional || false;
66
+ }
49
67
  }
@@ -0,0 +1,6 @@
1
+ {{#if @isOptional}}
2
+ <span class="hds-form-indicator hds-form-indicator--optional">(Optional)</span>
3
+ {{/if}}
4
+ {{#if @isRequired}}
5
+ <Hds::Badge class="hds-form-indicator" @size="small" @color="neutral" @text="Required" />
6
+ {{/if}}
@@ -1,3 +1,4 @@
1
1
  <label class={{this.classNames}} for={{@controlId}} ...attributes>
2
2
  {{yield}}
3
+ <Hds::Form::Indicator @isRequired={{@isRequired}} @isOptional={{@isOptional}} />
3
4
  </label>
@@ -1,3 +1,4 @@
1
1
  <legend class={{this.classNames}} ...attributes>
2
2
  {{yield}}
3
+ <Hds::Form::Indicator @isRequired={{@isRequired}} @isOptional={{@isOptional}} />
3
4
  </legend>
@@ -1 +1 @@
1
- <input type="radio" class={{this.classNames}} ...attributes value={{@value}} />
1
+ <input type="radio" class="hds-form-radio" ...attributes value={{@value}} />
@@ -10,10 +10,10 @@
10
10
  <Hds::Form::Radio::Base
11
11
  class="hds-form-field__control"
12
12
  @value={{@value}}
13
- @isInvalid={{@isInvalid}}
14
13
  ...attributes
15
14
  id={{F.id}}
16
15
  aria-describedby={{F.ariaDescribedBy}}
16
+ required={{@isRequired}}
17
17
  />
18
18
  </F.Control>
19
19
  </Hds::Form::Field>
@@ -1,7 +1,14 @@
1
- <Hds::Form::Fieldset @layout={{@layout}} ...attributes as |F|>
1
+ <Hds::Form::Fieldset @layout={{@layout}} @isRequired={{@isRequired}} @isOptional={{@isOptional}} ...attributes as |F|>
2
2
  {{! Notice: the order of the elements is not relevant here, because it's controlled at "Hds::Form::Fieldset" component level }}
3
- {{yield (hash Legend=F.Legend HelperText=F.HelperText Error=F.Error)}}
3
+ {{yield (hash Legend=F.Legend isRequired=F.isRequired isOptional=F.isOptional)}}
4
+ {{yield (hash HelperText=F.HelperText Error=F.Error)}}
4
5
  <F.Control>
5
- {{yield (hash Radio::Field=(component "hds/form/radio/field" contextualClass="hds-form-group__control-field"))}}
6
+ {{yield
7
+ (hash
8
+ Radio::Field=(component
9
+ "hds/form/radio/field" contextualClass="hds-form-group__control-field" isRequired=@isRequired
10
+ )
11
+ )
12
+ }}
6
13
  </F.Control>
7
14
  </Hds::Form::Fieldset>
@@ -1,6 +1,13 @@
1
- <Hds::Form::Field @layout="vertical" @extraAriaDescribedBy={{@extraAriaDescribedBy}} as |F|>
1
+ <Hds::Form::Field
2
+ @layout="vertical"
3
+ @extraAriaDescribedBy={{@extraAriaDescribedBy}}
4
+ @isRequired={{@isRequired}}
5
+ @isOptional={{@isOptional}}
6
+ as |F|
7
+ >
2
8
  {{! Notice: the order of the elements is not relevant here, because is controlled at "Hds::Form::Field" component level }}
3
- {{yield (hash Label=F.Label HelperText=F.HelperText Error=F.Error)}}
9
+ {{yield (hash Label=F.Label isRequired=F.isRequired isOptional=F.isOptional)}}
10
+ {{yield (hash HelperText=F.HelperText Error=F.Error)}}
4
11
  <F.Control>
5
12
  <Hds::Form::Select::Base
6
13
  class="hds-form-field__control"
@@ -10,6 +17,7 @@
10
17
  ...attributes
11
18
  id={{F.id}}
12
19
  aria-describedby={{F.ariaDescribedBy}}
20
+ required={{@isRequired}}
13
21
  as |S|
14
22
  >
15
23
  {{yield (hash Options=S.Options)}}
@@ -1,6 +1,13 @@
1
- <Hds::Form::Field @layout="vertical" @extraAriaDescribedBy={{@extraAriaDescribedBy}} as |F|>
1
+ <Hds::Form::Field
2
+ @layout="vertical"
3
+ @extraAriaDescribedBy={{@extraAriaDescribedBy}}
4
+ @isRequired={{@isRequired}}
5
+ @isOptional={{@isOptional}}
6
+ as |F|
7
+ >
2
8
  {{! Notice: the order of the elements is not relevant here, because is controlled at "Hds::Form::Field" component level }}
3
- {{yield (hash Label=F.Label HelperText=F.HelperText Error=F.Error)}}
9
+ {{yield (hash Label=F.Label isRequired=F.isRequired isOptional=F.isOptional)}}
10
+ {{yield (hash HelperText=F.HelperText Error=F.Error)}}
4
11
  <F.Control>
5
12
  <Hds::Form::TextInput::Base
6
13
  class="hds-form-field__control"
@@ -11,6 +18,7 @@
11
18
  ...attributes
12
19
  id={{F.id}}
13
20
  aria-describedby={{F.ariaDescribedBy}}
21
+ required={{@isRequired}}
14
22
  />
15
23
  </F.Control>
16
24
  </Hds::Form::Field>
@@ -1,2 +1,2 @@
1
1
  {{! Notice: this is not the native HTML <textarea> but the Ember component <Textarea> }}
2
- <Textarea class={{this.classNames}} {{style width=@width}} ...attributes @value={{@value}} />
2
+ <Textarea class={{this.classNames}} {{style width=@width height=@height}} rows="4" ...attributes @value={{@value}} />
@@ -1,15 +1,24 @@
1
- <Hds::Form::Field @layout="vertical" @extraAriaDescribedBy={{@extraAriaDescribedBy}} as |F|>
1
+ <Hds::Form::Field
2
+ @layout="vertical"
3
+ @extraAriaDescribedBy={{@extraAriaDescribedBy}}
4
+ @isRequired={{@isRequired}}
5
+ @isOptional={{@isOptional}}
6
+ as |F|
7
+ >
2
8
  {{! Notice: the order of the elements is not relevant here, because is controlled at "Hds::Form::Field" component level }}
3
- {{yield (hash Label=F.Label HelperText=F.HelperText Error=F.Error)}}
9
+ {{yield (hash Label=F.Label isRequired=F.isRequired isOptional=F.isOptional)}}
10
+ {{yield (hash HelperText=F.HelperText Error=F.Error)}}
4
11
  <F.Control>
5
12
  <Hds::Form::Textarea::Base
6
13
  class="hds-form-field__control"
7
14
  @value={{@value}}
8
15
  @isInvalid={{@isInvalid}}
9
16
  @width={{@width}}
17
+ @height={{@height}}
10
18
  ...attributes
11
19
  id={{F.id}}
12
20
  aria-describedby={{F.ariaDescribedBy}}
21
+ required={{@isRequired}}
13
22
  />
14
23
  </F.Control>
15
24
  </Hds::Form::Field>
@@ -9,11 +9,6 @@ export default class HdsFormToggleBaseComponent extends Component {
9
9
  get classNames() {
10
10
  let classes = ['hds-form-toggle'];
11
11
 
12
- // add a class based on the @isInvalid argument
13
- if (this.args.isInvalid) {
14
- classes.push(`hds-form-toggle--is-invalid`);
15
- }
16
-
17
12
  // add a class based on the @_wrapperClass argument
18
13
  // we need to use this special argument to pass a class to the wrapping element, because the ...attributes is applied to the control
19
14
  // notice: this will *not* be documented for public use
@@ -11,10 +11,10 @@
11
11
  {{! template-lint-disable no-capital-arguments }}
12
12
  @_wrapperClass="hds-form-field__control"
13
13
  @value={{@value}}
14
- @isInvalid={{@isInvalid}}
15
14
  ...attributes
16
15
  id={{F.id}}
17
16
  aria-describedby={{F.ariaDescribedBy}}
17
+ required={{@isRequired}}
18
18
  />
19
19
  </F.Control>
20
20
  </Hds::Form::Field>
@@ -1,7 +1,14 @@
1
- <Hds::Form::Fieldset @layout={{@layout}} ...attributes as |F|>
1
+ <Hds::Form::Fieldset @layout={{@layout}} @isRequired={{@isRequired}} @isOptional={{@isOptional}} ...attributes as |F|>
2
2
  {{! Notice: the order of the elements is not relevant here, because it's controlled at "Hds::Form::Fieldset" component level }}
3
- {{yield (hash Legend=F.Legend HelperText=F.HelperText Error=F.Error)}}
3
+ {{yield (hash Legend=F.Legend isRequired=F.isRequired isOptional=F.isOptional)}}
4
+ {{yield (hash HelperText=F.HelperText Error=F.Error)}}
4
5
  <F.Control>
5
- {{yield (hash Toggle::Field=(component "hds/form/toggle/field" contextualClass="hds-form-group__control-field"))}}
6
+ {{yield
7
+ (hash
8
+ Toggle::Field=(component
9
+ "hds/form/toggle/field" contextualClass="hds-form-group__control-field" isRequired=@isRequired
10
+ )
11
+ )
12
+ }}
6
13
  </F.Control>
7
14
  </Hds::Form::Fieldset>
@@ -0,0 +1 @@
1
+ export { default } from '@hashicorp/design-system-components/components/hds/form/indicator/index';
@@ -17,6 +17,7 @@ $hds-badge-count-border-width: 1px;
17
17
  border: $hds-badge-count-border-width solid transparent;
18
18
  display: inline-flex;
19
19
  font-family: var(--token-typography-font-stack-text);
20
+ font-weight: var(--token-typography-font-weight-medium);
20
21
  max-width: 100%;
21
22
  }
22
23
 
@@ -29,6 +29,7 @@
29
29
  .hds-badge__text {
30
30
  flex: 1 0 0;
31
31
  font-family: var(--token-typography-font-stack-text);
32
+ font-weight: var(--token-typography-font-weight-medium);
32
33
  }
33
34
 
34
35
 
@@ -143,4 +144,4 @@ $size-props: (
143
144
  color: var(--token-color-foreground-#{$color});
144
145
  }
145
146
  }
146
- }
147
+ }
@@ -0,0 +1,41 @@
1
+ //
2
+ // FORM > TOKENS
3
+ //
4
+ // TODO: this will be removed once we define the correct component-level tokens for the "form controls" component
5
+ //
6
+
7
+ :root {
8
+ // INPUT / DEFAULT
9
+ --token-form-control-foreground-color-default: var(--token-color-foreground-strong);
10
+ --token-form-control-background-color-default: var(--token-color-surface-interactive);
11
+ --token-form-control-background-color-default-hover: var(--token-color-surface-interactive-hover);
12
+ --token-form-control-border-color-default: #8c909c;
13
+ --token-form-control-border-color-default-hover: #656a76;
14
+ // INPUT / CHECKED
15
+ --token-form-control-background-color-checked: #1060FF;
16
+ --token-form-control-background-color-checked-hover: #0C56E9;
17
+ --token-form-control-border-color-checked: #0C56E9;
18
+ --token-form-control-border-color-checked-hover: #0046D1;
19
+ // INPUT / READONLY
20
+ --token-form-control-foreground-color-readonly: var(--token-color-foreground-primary);
21
+ --token-form-control-background-color-readonly: var(--token-color-surface-strong);
22
+ --token-form-control-border-color-readonly: var(--token-color-border-faint);
23
+ // INPUT / DISABLED
24
+ --token-form-control-foreground-color-disabled: var(--token-color-foreground-disabled);
25
+ --token-form-control-background-color-disabled: var(--token-color-surface-interactive-disabled);
26
+ --token-form-control-border-color-disabled: var(--token-color-border-primary);
27
+ // INPUT / INVALID
28
+ --token-form-control-foreground-color-critical: var(--token-color-foreground-critical-on-surface);
29
+ --token-form-control-border-color-critical: #c00005;
30
+ --token-form-control-border-color-critical-hover: #940004;
31
+ // INPUT / PLACEHOLDER
32
+ --token-form-control-placeholder-color: var(--token-color-foreground-faint);
33
+ // INPUT / BORDER SIZING
34
+ --token-form-control-border-radius: 5px;
35
+ // LABEL/HELPER-TEXT
36
+ --token-form-label-foreground-color: var(--token-color-foreground-strong);
37
+ --token-form-helper-text-foreground-color: var(--token-color-foreground-faint);
38
+ // CHECKBOX
39
+ --token-form-checkbox-size: 16px;
40
+ --token-form-checkbox-border-radius: 3px;
41
+ }
@@ -4,8 +4,6 @@
4
4
  // properties within each class are sorted alphabetically
5
5
  //
6
6
 
7
- $hds-form-checkbox-control-size: 16px;
8
- $hds-form-checkbox-control-border-radius: 3px;
9
7
 
10
8
  // "BASE" CONTROL
11
9
 
@@ -13,27 +11,27 @@ $hds-form-checkbox-control-border-radius: 3px;
13
11
  appearance: none;
14
12
  background-position: center center;
15
13
  background-size: 12px 12px;
16
- border-radius: $hds-form-checkbox-control-border-radius;
14
+ border-radius: var(--token-form-checkbox-border-radius);
17
15
  border-style: solid;
18
16
  border-width: 1px;
19
17
  cursor: pointer;
20
- height: $hds-form-checkbox-control-size;
18
+ height: var(--token-form-checkbox-size);
21
19
  margin: 0;
22
20
  padding: 0;
23
- width: $hds-form-checkbox-control-size;
21
+ width: var(--token-form-checkbox-size);
24
22
 
25
23
  // STATUS
26
24
 
27
25
  // base (default)
28
26
 
29
27
  &:not(:checked) {
30
- background-color: var(--token-color-surface-primary);
31
- border-color: var(--token-color-palette-neutral-400);
28
+ background-color: var(--token-form-control-background-color-default);
29
+ border-color: var(--token-form-control-border-color-default);
32
30
  box-shadow: var(--hds-elevation-inset-box-shadow);
33
31
  }
34
32
  &:checked {
35
- background-color: var(--token-color-palette-blue-200);
36
- border-color: var(--token-color-palette-blue-300);
33
+ background-color: var(--token-form-control-background-color-checked);
34
+ border-color: var(--token-form-control-border-color-checked);
37
35
  // notice: the "tick" color is hardcoded here!
38
36
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M9.78033 3.21967C10.0732 3.51256 10.0732 3.98744 9.78033 4.28033L5.28033 8.78033C4.98744 9.07322 4.51256 9.07322 4.21967 8.78033L2.21967 6.78033C1.92678 6.48744 1.92678 6.01256 2.21967 5.71967C2.51256 5.42678 2.98744 5.42678 3.28033 5.71967L4.75 7.18934L8.71967 3.21967C9.01256 2.92678 9.48744 2.92678 9.78033 3.21967Z' fill='%23FFF'/%3e%3c/svg%3e");
39
37
  }
@@ -42,52 +40,41 @@ $hds-form-checkbox-control-border-radius: 3px;
42
40
 
43
41
  &:hover:not(:checked),
44
42
  &.mock-hover:not(:checked) {
45
- border-color: var(--token-color-palette-neutral-500);
43
+ background-color: var(--token-form-control-background-color-default-hover);
44
+ border-color: var(--token-form-control-border-color-default-hover);
46
45
  }
47
46
  &:hover:checked,
48
47
  &.mock-hover:checked {
49
- background-color: var(--token-color-palette-blue-300);
50
- border-color: var(--token-color-palette-blue-400);
48
+ background-color: var(--token-form-control-background-color-checked-hover);
49
+ border-color: var(--token-form-control-border-color-checked-hover);
51
50
  }
52
51
 
53
- // focus (same for all the states)
52
+ // focus
53
+
54
54
  &:focus:not(:checked),
55
- &:focus:checked,
56
- &.mock-focus:checked,
57
55
  &.mock-focus:not(:checked) {
58
- border-color: var(--token-color-palette-blue-400);
56
+ border-color: var(--token-form-control-border-color-default);
59
57
  outline: 3px solid var(--token-color-focus-action-external);
60
58
  outline-offset: 1px;
61
59
  }
62
-
63
- // INVALID
64
-
65
- &.hds-form-checkbox--is-invalid:not(:checked) {
66
- border-color: var(--token-color-palette-red-300);
67
- }
68
- &.hds-form-checkbox--is-invalid:checked {
69
- background-color: var(--token-color-palette-red-200);
70
- border-color: var(--token-color-palette-red-300);
71
- }
72
-
73
- &.hds-form-checkbox--is-invalid:hover:not(:checked),
74
- &.hds-form-checkbox--is-invalid.mock-hover:not(:checked) {
75
- border-color: var(--token-color-palette-red-400);
76
- }
77
- &.hds-form-checkbox--is-invalid:hover:checked,
78
- &.hds-form-checkbox--is-invalid.mock-hover:checked {
79
- background-color: var(--token-color-palette-red-300);
80
- border-color: var(--token-color-palette-red-400);
60
+ &:focus:checked,
61
+ &.mock-focus:checked {
62
+ border-color: var(--token-form-control-border-color-checked);
63
+ outline: 3px solid var(--token-color-focus-action-external);
64
+ outline-offset: 1px;
81
65
  }
82
66
 
83
67
  // DISABLED
84
68
 
85
- &:disabled:not(:checked),
86
- &:disabled:checked,
87
- &.hds-form-checkbox--is-invalid:disabled:not(:checked),
88
- &.hds-form-checkbox--is-invalid:disabled:checked {
89
- background-color: var(--token-color-surface-strong);
90
- border-color: var(--token-color-border-primary);
69
+ &:disabled:not(:checked) {
70
+ background-color: var(--token-form-control-background-color-disabled);
71
+ border-color: var(--token-form-control-border-color-disabled);
72
+ box-shadow: none;
73
+ cursor: not-allowed;
74
+ }
75
+ &:disabled:checked {
76
+ background-color: var(--token-form-control-background-color-disabled);
77
+ border-color: var(--token-form-control-border-color-disabled);
91
78
  box-shadow: none;
92
79
  // notice: the "tick" color is hardcoded here!
93
80
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M9.78033 3.21967C10.0732 3.51256 10.0732 3.98744 9.78033 4.28033L5.28033 8.78033C4.98744 9.07322 4.51256 9.07322 4.21967 8.78033L2.21967 6.78033C1.92678 6.48744 1.92678 6.01256 2.21967 5.71967C2.51256 5.42678 2.98744 5.42678 3.28033 5.71967L4.75 7.18934L8.71967 3.21967C9.01256 2.92678 9.48744 2.92678 9.78033 3.21967Z' fill='%238C909C'/%3e%3c/svg%3e");
@@ -6,7 +6,7 @@
6
6
 
7
7
  .hds-form-error {
8
8
  align-items: flex-start;
9
- color: var(--token-color-foreground-critical-on-surface);
9
+ color: var(--token-form-control-foreground-color-critical);
10
10
  display: flex;
11
11
  }
12
12
 
@@ -27,7 +27,7 @@
27
27
 
28
28
  .hds-form-group--layout-vertical {
29
29
  .hds-form-group__control-field + .hds-form-group__control-field {
30
- margin-top: 16px;
30
+ margin-top: 12px;
31
31
  }
32
32
  }
33
33
 
@@ -5,6 +5,6 @@
5
5
  //
6
6
 
7
7
  .hds-form-helper-text {
8
- color: var(--token-color-foreground-faint);
8
+ color: var(--token-form-helper-text-foreground-color);
9
9
  display: block;
10
10
  }
@@ -2,6 +2,8 @@
2
2
  // FORM > INDEX
3
3
  //
4
4
 
5
+ // TODO/TEMP: this will be replaced with proper tokens later
6
+ @use "./_tokens";
5
7
 
6
8
  @use "./label";
7
9
  @use "./helper-text";
@@ -9,6 +11,7 @@
9
11
  @use "./field";
10
12
  @use "./legend";
11
13
  @use "./group";
14
+ @use "./indicator";
12
15
 
13
16
  @use "./checkbox";
14
17
  @use "./radio";
@@ -0,0 +1,15 @@
1
+ //
2
+ // FORM > INDICATOR
3
+ //
4
+ // properties within each class are sorted alphabetically
5
+ //
6
+
7
+ // Used for the 'optional' indicator
8
+ .hds-form-indicator--optional {
9
+ color: var(--token-color-foreground-faint);
10
+ font-family: var(--token-typography-font-stack-text);
11
+ font-size: var(--token-typography-body-100-font-size);
12
+ font-weight: var(--token-typography-font-weight-regular);
13
+ // notice: here we're using the same line-height as the label/legend text to have the right vertical alignment
14
+ line-height: var(--token-typography-body-200-font-size);
15
+ }
@@ -5,8 +5,16 @@
5
5
  //
6
6
 
7
7
  .hds-form-label {
8
- color: var(--token-color-foreground-strong);
8
+ color: var(--token-form-label-foreground-color);
9
9
  display: block;
10
10
  max-width: 100%;
11
11
  width: max-content; // to avoid it extends the full width of the parent container, leading to invisible interactive area
12
+
13
+ // if a "badge" element (included the 'required' indicator) is child of the label
14
+ // we need to make sure that it correctly aligns with the label text because the
15
+ // "Hds::Badge" component has "vertical-align: middle" applied to it
16
+ // and this mess up the vertical alignment (increasing the container's height too)
17
+ .hds-badge {
18
+ vertical-align: initial;
19
+ }
12
20
  }
@@ -5,6 +5,14 @@
5
5
  //
6
6
 
7
7
  .hds-form-legend {
8
- color: var(--token-color-foreground-strong);
8
+ color: var(--token-form-label-foreground-color); // same color as "label"
9
9
  display: block;
10
+
11
+ // if a "badge" element (included the 'required' indicator) is child of the legend
12
+ // we need to make sure that it correctly aligns with the legend text because the
13
+ // "Hds::Badge" component has "vertical-align: middle" applied to it
14
+ // and this mess up the vertical alignment (increasing the container's height too)
15
+ .hds-badge {
16
+ vertical-align: initial;
17
+ }
10
18
  }
@@ -4,7 +4,6 @@
4
4
  // properties within each class are sorted alphabetically
5
5
  //
6
6
 
7
- $hds-form-radio-control-size: 16px;
8
7
 
9
8
  // "BASE" CONTROL
10
9
 
@@ -16,23 +15,23 @@ $hds-form-radio-control-size: 16px;
16
15
  border-style: solid;
17
16
  border-width: 1px;
18
17
  cursor: pointer;
19
- height: $hds-form-radio-control-size;
18
+ height: var(--token-form-checkbox-size); // same as checkbox
20
19
  margin: 0;
21
20
  padding: 0;
22
- width: $hds-form-radio-control-size;
21
+ width: var(--token-form-checkbox-size);
23
22
 
24
23
  // STATUS
25
24
 
26
25
  // base (default)
27
26
 
28
27
  &:not(:checked) {
29
- background-color: var(--token-color-surface-primary);
30
- border-color: var(--token-color-palette-neutral-400);
28
+ background-color: var(--token-form-control-background-color-default);
29
+ border-color: var(--token-form-control-border-color-default);
31
30
  box-shadow: var(--hds-elevation-inset-box-shadow);
32
31
  }
33
32
  &:checked {
34
- background-color: var(--token-color-palette-blue-200);
35
- border-color: var(--token-color-palette-blue-300);
33
+ background-color: var(--token-form-control-background-color-checked);
34
+ border-color: var(--token-form-control-border-color-checked);
36
35
  // notice: the "dot" color is hardcoded here!
37
36
  background-image: url("data:image/svg+xml,%3csvg width='12' height='12' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='6' cy='6' r='2.5' fill='%23ffffff'/%3e%3c/svg%3e");
38
37
  }
@@ -41,60 +40,44 @@ $hds-form-radio-control-size: 16px;
41
40
 
42
41
  &:hover:not(:checked),
43
42
  &.mock-hover:not(:checked) {
44
- border-color: var(--token-color-palette-neutral-500);
43
+ background-color: var(--token-form-control-background-color-default-hover);
44
+ border-color: var(--token-form-control-border-color-default-hover);
45
45
  }
46
46
  &:hover:checked,
47
47
  &.mock-hover:checked {
48
- background-color: var(--token-color-palette-blue-300);
49
- border-color: var(--token-color-palette-blue-400);
48
+ background-color: var(--token-form-control-background-color-checked-hover);
49
+ border-color: var(--token-form-control-border-color-checked-hover);
50
50
  }
51
51
 
52
- // focus (same for all the states)
52
+ // focus
53
+
53
54
  &:focus:not(:checked),
54
- &:focus:checked,
55
- &.mock-focus:checked,
56
55
  &.mock-focus:not(:checked) {
57
- border-color: var(--token-color-palette-blue-400);
56
+ border-color: var(--token-form-control-border-color-default);;
58
57
  outline: 3px solid var(--token-color-focus-action-external);
59
58
  outline-offset: 1px;
60
59
  }
61
-
62
- // INVALID
63
-
64
- &.hds-form-radio--is-invalid:not(:checked) {
65
- border-color: var(--token-color-palette-red-300);
66
- }
67
- &.hds-form-radio--is-invalid:checked {
68
- background-color: var(--token-color-palette-red-200);
69
- border-color: var(--token-color-palette-red-300);
70
- }
71
-
72
- &.hds-form-radio--is-invalid:hover:not(:checked),
73
- &.hds-form-radio--is-invalid.mock-hover:not(:checked) {
74
- border-color: var(--token-color-palette-red-400);
75
- }
76
- &.hds-form-radio--is-invalid:hover:checked,
77
- &.hds-form-radio--is-invalid.mock-hover:checked {
78
- background-color: var(--token-color-palette-red-300);
79
- border-color: var(--token-color-palette-red-400);
60
+ &:focus:checked,
61
+ &.mock-focus:checked {
62
+ border-color: var(--token-form-control-border-color-checked);
63
+ outline: 3px solid var(--token-color-focus-action-external);
64
+ outline-offset: 1px;
80
65
  }
81
66
 
82
67
  // DISABLED
83
68
 
84
- &:disabled:not(:checked),
85
- &.hds-form-checkbox--is-invalid:disabled:not(:checked) {
86
- background-color: var(--token-color-surface-strong);
87
- border-color: var(--token-color-border-primary);
69
+ &:disabled:not(:checked) {
70
+ background-color: var(--token-form-control-background-color-disabled);
71
+ border-color: var(--token-form-control-border-color-disabled);
88
72
  box-shadow: none;
89
73
  cursor: not-allowed;
90
74
  }
91
- &:disabled:checked,
92
- &.hds-form-checkbox--is-invalid:disabled:checked {
93
- background-color: var(--token-color-surface-strong);
94
- border-color: var(--token-color-border-primary);
75
+ &:disabled:checked {
76
+ background-color: var(--token-form-control-background-color-disabled);
77
+ border-color: var(--token-form-control-border-color-disabled);
95
78
  box-shadow: none;
96
79
  // notice: the "dot" color is hardcoded here!
97
- background-image: url("data:image/svg+xml,%3csvg width='12' height='12' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='6' cy='6' r='2.5' fill='%23656a76'/%3e%3c/svg%3e");
80
+ background-image: url("data:image/svg+xml,%3csvg width='12' height='12' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='6' cy='6' r='2.5' fill='%238C909C'/%3e%3c/svg%3e");
98
81
  cursor: not-allowed;
99
82
  }
100
83
  }
@@ -7,25 +7,34 @@
7
7
  // "BASE" CONTROL
8
8
 
9
9
  .hds-form-select {
10
- border: 1px solid var(--token-color-palette-neutral-400);
11
- border-radius: 5px;
12
- color: var(--token-color-foreground-strong);
13
- padding: 7px; // we have to take into account the border
10
+ appearance: none;
11
+ background-color: var(--token-form-control-background-color-default);
12
+ // notice: the icon color is hardcoded here!
13
+ background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8.55 2.24a.75.75 0 0 0-1.1 0L4.2 5.74a.75.75 0 1 0 1.1 1.02L8 3.852l2.7 2.908a.75.75 0 1 0 1.1-1.02l-3.25-3.5Zm-1.1 11.52a.75.75 0 0 0 1.1 0l3.25-3.5a.75.75 0 1 0-1.1-1.02L8 12.148 5.3 9.24a.75.75 0 0 0-1.1 1.02l3.25 3.5Z' fill='%23656A76'/%3E%3C/svg%3E");
14
+ background-position: right 7px top 9px; // we have to take into account the border
15
+ background-repeat: no-repeat;
16
+ background-size: 16px;
17
+ border: 1px solid var(--token-form-control-border-color-default);
18
+ border-radius: var(--token-form-control-border-radius);
19
+ color: var(--token-form-control-foreground-color-default);
20
+ box-shadow: var(--token-elevation-low-box-shadow);
21
+ padding: 7px 31px 7px 7px; // we have to take into account the border - 32px is to have space for the icon
14
22
  max-width: 100%;
15
23
 
24
+
16
25
  // STATUS
17
26
 
18
27
  &:hover,
19
28
  &.mock-hover {
20
- border-color: var(--token-color-palette-neutral-500);
29
+ border-color: var(--token-form-control-border-color-default-hover);
21
30
  }
22
31
 
23
32
  // focus (same for all the states)
24
- // TODO add handling of focus-visible
33
+
25
34
  &:focus,
26
35
  &.mock-focus {
27
36
  border-color: var(--token-color-focus-action-internal);
28
- // TODO: Safari doesn't apply a rounded border
37
+ // Notice: Safari doesn't apply a rounded border
29
38
  outline: 3px solid var(--token-color-focus-action-external);
30
39
  outline-offset: 0px;
31
40
  }
@@ -33,22 +42,25 @@
33
42
  // DISABLED
34
43
 
35
44
  &:disabled {
36
- background-color: var(--token-color-surface-strong);
37
- border-color: var(--token-color-border-primary);
45
+ // notice: the icon color is hardcoded here!
46
+ background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8.55 2.24a.75.75 0 0 0-1.1 0L4.2 5.74a.75.75 0 1 0 1.1 1.02L8 3.852l2.7 2.908a.75.75 0 1 0 1.1-1.02l-3.25-3.5Zm-1.1 11.52a.75.75 0 0 0 1.1 0l3.25-3.5a.75.75 0 1 0-1.1-1.02L8 12.148 5.3 9.24a.75.75 0 0 0-1.1 1.02l3.25 3.5Z' fill='%238C909C'/%3E%3C/svg%3E");
47
+ background-color: var(--token-form-control-background-color-disabled);
48
+ border-color: var(--token-form-control-border-color-disabled);
49
+ color: var(--token-form-control-foreground-color-disabled);
38
50
  cursor: not-allowed;
51
+ box-shadow: none;
39
52
  }
40
53
 
41
54
  // INVALID
42
55
 
43
56
  &.hds-form-select--is-invalid {
44
- border-color: #C00005; // TODO convert to form-controls design token
57
+ border-color: var(--token-form-control-border-color-critical);
45
58
 
46
59
  &:hover,
47
60
  &.mock-hover {
48
- border-color: #940004; // TODO convert to form-controls design token
61
+ border-color: var(--token-form-control-border-color-critical-hover);
49
62
  }
50
63
 
51
- // TODO add handling of focus-visible
52
64
  &:focus,
53
65
  &.mock-focus {
54
66
  border-color: var(--token-color-focus-critical-internal);
@@ -7,11 +7,11 @@
7
7
  // "BASE" CONTROL
8
8
 
9
9
  .hds-form-text-input {
10
- background-color: var(--token-color-surface-primary);
11
- border: 1px solid var(--token-color-palette-neutral-400);
12
- border-radius: 5px;
10
+ background-color: var(--token-form-control-background-color-default);
11
+ border: 1px solid var(--token-form-control-border-color-default);
12
+ border-radius: var(--token-form-control-border-radius);
13
13
  box-shadow: var(--hds-elevation-inset-box-shadow);
14
- color: var(--token-color-foreground-strong);
14
+ color: var(--token-form-control-foreground-color-default);
15
15
  padding: 7px; // we have to take into account the border
16
16
  width: 100%;
17
17
  max-width: 100%;
@@ -19,57 +19,55 @@
19
19
  // PLACEHOLDER
20
20
 
21
21
  ::placeholder {
22
- color: var(--token-color-foreground-faint);
22
+ color: var(--token-form-control-placeholder-color);
23
23
  }
24
24
 
25
25
  // STATUS
26
26
 
27
27
  &:hover,
28
28
  &.mock-hover {
29
- border-color: var(--token-color-palette-neutral-500);
29
+ border-color: var(--token-form-control-border-color-default-hover);
30
30
  }
31
31
 
32
32
  // focus (same for all the states)
33
- // TODO add handling of focus-visible
33
+
34
34
  &:focus,
35
35
  &.mock-focus {
36
36
  border-color: var(--token-color-focus-action-internal);
37
- // TODO: Safari doesn't apply a rounded border
37
+ // Notice: Safari doesn't apply a rounded border
38
38
  outline: 3px solid var(--token-color-focus-action-external);
39
39
  outline-offset: 0px;
40
40
  }
41
41
 
42
42
  // READONLY
43
43
 
44
- &:read-only,
45
- &[readonly] {
46
- background-color: var(--token-color-surface-strong);
47
- border-color: var(--token-color-palette-neutral-400);
44
+ &:read-only {
45
+ background-color: var(--token-form-control-background-color-readonly);
46
+ border-color: var(--token-form-control-border-color-readonly);
48
47
  box-shadow: none;
49
- color: var(--token-color-foreground-primary);
48
+ color: var(--token-form-control-foreground-color-readonly);
50
49
  }
51
50
 
52
51
  // DISABLED
53
52
 
54
53
  &:disabled {
55
- background-color: var(--token-color-surface-interactive-disabled);
56
- border-color: var(--token-color-border-primary);
54
+ background-color: var(--token-form-control-background-color-disabled);
55
+ border-color: var(--token-form-control-border-color-disabled);
57
56
  box-shadow: none;
58
- color: var(--token-color-foreground-disabled);
57
+ color: var(--token-form-control-foreground-color-disabled);
59
58
  cursor: not-allowed;
60
59
  }
61
60
 
62
61
  // INVALID
63
62
 
64
63
  &.hds-form-text-input--is-invalid {
65
- border-color: #C00005; // TODO convert to form-controls design token
64
+ border-color: var(--token-form-control-border-color-critical);
66
65
 
67
66
  &:hover,
68
67
  &.mock-hover {
69
- border-color: #940004; // TODO convert to form-controls design token
68
+ border-color: var(--token-form-control-border-color-critical-hover);
70
69
  }
71
70
 
72
- // TODO add handling of focus-visible
73
71
  &:focus,
74
72
  &.mock-focus {
75
73
  border-color: var(--token-color-focus-critical-internal);
@@ -94,13 +92,14 @@
94
92
 
95
93
  // show the native icon dimmed if disabled (hidden in Chrome)
96
94
  &:disabled::-webkit-calendar-picker-indicator {
97
- visibility: visible;
98
- opacity: 0.5;
95
+ visibility: visible;
96
+ opacity: 0.5;
99
97
  }
100
98
 
101
99
  // show the icon if readonly
100
+ // notice: don't change the "[readonly]" selector to ":readonly" because it's needed to overwrite the specificity in Chrome
102
101
  &[readonly]::-webkit-calendar-picker-indicator {
103
- visibility: visible;
102
+ visibility: visible;
104
103
  }
105
104
  }
106
105
 
@@ -7,12 +7,12 @@
7
7
  // "BASE" CONTROL
8
8
 
9
9
  .hds-form-textarea {
10
- background-color: var(--token-color-surface-primary);
11
- border: 1px solid var(--token-color-palette-neutral-400);
12
- border-radius: 5px;
10
+ background-color: var(--token-form-control-background-color-default);
11
+ border: 1px solid var(--token-form-control-border-color-default);
12
+ border-radius: var(--token-form-control-border-radius);
13
13
  box-shadow: var(--hds-elevation-inset-box-shadow);
14
- color: var(--token-color-foreground-strong);
15
- padding: 3px 7px; // we have to take into account the border
14
+ color: var(--token-form-control-foreground-color-default);
15
+ padding: 7px; // we have to take into account the border
16
16
  resize: vertical;
17
17
  width: 100%;
18
18
  max-width: 100%;
@@ -20,57 +20,55 @@
20
20
  // PLACEHOLDER
21
21
 
22
22
  ::placeholder {
23
- color: var(--token-color-foreground-faint);
23
+ color: var(--token-form-control-placeholder-color);
24
24
  }
25
25
 
26
26
  // STATUS
27
27
 
28
28
  &:hover,
29
29
  &.mock-hover {
30
- border-color: var(--token-color-palette-neutral-500);
30
+ border-color: var(--token-form-control-border-color-default-hover);
31
31
  }
32
32
 
33
33
  // focus (same for all the states)
34
- // TODO add handling of focus-visible
34
+
35
35
  &:focus,
36
36
  &.mock-focus {
37
37
  border-color: var(--token-color-focus-action-internal);
38
- // TODO: Safari doesn't apply a rounded border
38
+ // Notice: Safari doesn't apply a rounded border
39
39
  outline: 3px solid var(--token-color-focus-action-external);
40
40
  outline-offset: 0px;
41
41
  }
42
42
 
43
43
  // READONLY
44
44
 
45
- &:read-only,
46
- &[readonly] {
47
- background-color: var(--token-color-surface-strong);
48
- border-color: var(--token-color-palette-neutral-400);
45
+ &:read-only {
46
+ background-color: var(--token-form-control-background-color-readonly);
47
+ border-color: var(--token-form-control-border-color-readonly);
49
48
  box-shadow: none;
50
- color: var(--token-color-foreground-primary);
49
+ color: var(--token-form-control-foreground-color-readonly);
51
50
  }
52
51
 
53
52
  // DISABLED
54
53
 
55
54
  &:disabled {
56
- background-color: var(--token-color-surface-interactive-disabled);
57
- border-color: var(--token-color-border-primary);
55
+ background-color: var(--token-form-control-background-color-disabled);
56
+ border-color: var(--token-form-control-border-color-disabled);
58
57
  box-shadow: none;
59
- color: var(--token-color-foreground-disabled);
58
+ color: var(--token-form-control-foreground-color-disabled);
60
59
  cursor: not-allowed;
61
60
  }
62
61
 
63
62
  // INVALID
64
63
 
65
64
  &.hds-form-textarea--is-invalid {
66
- border-color: #C00005; // TODO convert to form-controls design token
65
+ border-color: var(--token-form-control-border-color-critical);
67
66
 
68
67
  &:hover,
69
68
  &.mock-hover {
70
- border-color: #940004; // TODO convert to form-controls design token
69
+ border-color: var(--token-form-control-border-color-critical-hover);
71
70
  }
72
71
 
73
- // TODO add handling of focus-visible
74
72
  &:focus,
75
73
  &.mock-focus {
76
74
  border-color: var(--token-color-focus-critical-internal);
@@ -7,7 +7,7 @@
7
7
  @use "sass:math";
8
8
 
9
9
  $hds-form-toggle-control-width: 32px;
10
- $hds-form-toggle-control-height: 16px;
10
+ $hds-form-toggle-control-height: 16px; // for the other controls we use "--token-form-checkbox-size" but in this case we need a Sass variable to do math operations on it
11
11
  $hds-form-toggle-border-radius: math.div($hds-form-toggle-control-height, 2);
12
12
 
13
13
  // "BASE" CONTROL
@@ -71,7 +71,7 @@ $hds-form-toggle-border-radius: math.div($hds-form-toggle-control-height, 2);
71
71
  left: -1px;
72
72
  position: absolute;
73
73
  transform: translate3d(0, 0, 0);
74
- transition: transform 0.2s cubic-bezier(0.34, 1.61, 0.7, 1), border-color 0.2s ease-in;
74
+ transition: transform 0.2s cubic-bezier(0.68, -0.2, 0.265, 1.15), border-color 0.2s ease-in;
75
75
  top: -1px;
76
76
  }
77
77
 
@@ -96,12 +96,12 @@ $hds-form-toggle-border-radius: math.div($hds-form-toggle-control-height, 2);
96
96
  // base (default)
97
97
 
98
98
  :not(:checked) + & {
99
- --border-color: var(--token-color-palette-neutral-400);
100
- background-color: var(--token-color-surface-primary);
99
+ --border-color: var(--token-form-control-border-color-default);
100
+ background-color: var(--token-color-surface-strong); // not like the other controls!
101
101
  }
102
102
  :checked + & {
103
- --border-color: var(--token-color-palette-blue-300);
104
- background-color: var(--token-color-palette-blue-200);
103
+ --border-color: var(--token-form-control-border-color-checked);
104
+ background-color: var(--token-form-control-background-color-checked);
105
105
  // notice: the "tick" color is hardcoded here!
106
106
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M9.78033 3.21967C10.0732 3.51256 10.0732 3.98744 9.78033 4.28033L5.28033 8.78033C4.98744 9.07322 4.51256 9.07322 4.21967 8.78033L2.21967 6.78033C1.92678 6.48744 1.92678 6.01256 2.21967 5.71967C2.51256 5.42678 2.98744 5.42678 3.28033 5.71967L4.75 7.18934L8.71967 3.21967C9.01256 2.92678 9.48744 2.92678 9.78033 3.21967Z' fill='%23FFF'/%3e%3c/svg%3e");
107
107
 
@@ -115,56 +115,41 @@ $hds-form-toggle-border-radius: math.div($hds-form-toggle-control-height, 2);
115
115
 
116
116
  :hover:not(:checked) + &,
117
117
  .mock-hover:not(:checked) + & {
118
- --border-color: var(--token-color-palette-neutral-500);
118
+ --border-color: var(--token-form-control-border-color-default-hover);
119
119
  }
120
120
  :hover:checked + &,
121
121
  .mock-hover:checked + & {
122
- --border-color: var(--token-color-palette-blue-400);
123
- background-color: var(--token-color-palette-blue-300);
122
+ --border-color: var(--token-form-control-border-color-checked-hover);
123
+ background-color: var(--token-form-control-background-color-checked-hover);
124
124
  }
125
125
 
126
126
  // focus (same for all the states)
127
127
 
128
128
  :focus:not(:checked) + &,
129
- :focus:checked + &,
130
- .mock-focus:not(:checked) + &,
131
- .mock-focus:checked + & {
132
- --border-color: var(--token-color-palette-blue-400);
129
+ .mock-focus:not(:checked) + & {
130
+ --border-color: var(--token-form-control-border-color-default);
133
131
 
134
132
  &::before {
135
133
  border-style: solid;
136
134
  border-color: var( --token-color-focus-action-external);
137
135
  }
138
136
  }
137
+ :focus:checked + &,
138
+ .mock-focus:checked + & {
139
+ --border-color: var(--token-form-control-border-color-checked);
139
140
 
140
- // INVALID
141
-
142
- .hds-form-toggle--is-invalid :not(:checked) + & {
143
- --border-color: var(--token-color-palette-red-300);
144
- }
145
- .hds-form-toggle--is-invalid :checked + & {
146
- background-color: var(--token-color-palette-red-200);
147
- --border-color: var(--token-color-palette-red-300);
148
- }
149
-
150
- .hds-form-toggle--is-invalid :hover:not(:checked) + &,
151
- .hds-form-toggle--is-invalid .mock-hover:not(:checked) + & {
152
- --border-color: var(--token-color-palette-red-400);
153
- }
154
- .hds-form-toggle--is-invalid :hover:checked + &,
155
- .hds-form-toggle--is-invalid .mock-hover:checked + & {
156
- --border-color: var(--token-color-palette-red-300);
157
- background-color: var(--token-color-palette-red-400);
141
+ &::before {
142
+ border-style: solid;
143
+ border-color: var( --token-color-focus-action-external);
144
+ }
158
145
  }
159
146
 
160
147
  // DISABLED
161
148
 
162
149
  :disabled:not(:checked) + &,
163
- :disabled:checked + &,
164
- .hds-form-toggle--is-invalid :disabled:not(:checked) + &,
165
- .hds-form-toggle--is-invalid :disabled:checked + & {
166
- background-color: var(--token-color-surface-strong);
167
- --border-color: var(--token-color-border-primary);
150
+ :disabled:checked + & {
151
+ background-color: var(--token-form-control-background-color-disabled);
152
+ --border-color: var(--token-form-control-border-color-disabled);
168
153
  // notice: the "tick" color is hardcoded here!
169
154
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M9.78033 3.21967C10.0732 3.51256 10.0732 3.98744 9.78033 4.28033L5.28033 8.78033C4.98744 9.07322 4.51256 9.07322 4.21967 8.78033L2.21967 6.78033C1.92678 6.48744 1.92678 6.01256 2.21967 5.71967C2.51256 5.42678 2.98744 5.42678 3.28033 5.71967L4.75 7.18934L8.71967 3.21967C9.01256 2.92678 9.48744 2.92678 9.78033 3.21967Z' fill='%238C909C'/%3e%3c/svg%3e");
170
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashicorp/design-system-components",
3
- "version": "0.12.10",
3
+ "version": "0.12.13",
4
4
  "description": "HashiCorp Design System Components",
5
5
  "keywords": [
6
6
  "hashicorp",
@@ -50,7 +50,7 @@
50
50
  "@embroider/test-setup": "^1.5.0",
51
51
  "@glimmer/component": "^1.0.4",
52
52
  "@glimmer/tracking": "^1.0.4",
53
- "@percy/cli": "^1.5.1",
53
+ "@percy/cli": "^1.6.1",
54
54
  "@percy/ember": "^3.0.0",
55
55
  "babel-eslint": "^10.1.0",
56
56
  "broccoli-asset-rev": "^3.0.0",
@@ -1,19 +0,0 @@
1
- import Component from '@glimmer/component';
2
-
3
- export default class HdsFormCheckboxBaseComponent 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-checkbox'];
11
-
12
- // add a class based on the @isInvalid argument
13
- if (this.args.isInvalid) {
14
- classes.push(`hds-form-checkbox--is-invalid`);
15
- }
16
-
17
- return classes.join(' ');
18
- }
19
- }
@@ -1,19 +0,0 @@
1
- import Component from '@glimmer/component';
2
-
3
- export default class HdsFormRadioBaseComponent 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-radio'];
11
-
12
- // add a class based on the @isInvalid argument
13
- if (this.args.isInvalid) {
14
- classes.push(`hds-form-radio--is-invalid`);
15
- }
16
-
17
- return classes.join(' ');
18
- }
19
- }