@hashicorp/design-system-components 2.9.0 → 2.10.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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # @hashicorp/design-system-components
2
2
 
3
+ ## 2.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1535](https://github.com/hashicorp/design-system/pull/1535) [`2daa95479`](https://github.com/hashicorp/design-system/commit/2daa95479307fea0b94b2af413126d09525462c8) Thanks [@KristinLBradley](https://github.com/KristinLBradley)! - Add new `FileInput` component
8
+
9
+ ### Patch Changes
10
+
11
+ - [#1570](https://github.com/hashicorp/design-system/pull/1570) [`7bf297996`](https://github.com/hashicorp/design-system/commit/7bf297996e06a15cb2506bfb23f43d71ecc9b492) Thanks [@Dhaulagiri](https://github.com/Dhaulagiri)! - Remove unnecessary export of `hds/copy/index.js`
12
+
13
+ - [#1575](https://github.com/hashicorp/design-system/pull/1575) [`0362019ca`](https://github.com/hashicorp/design-system/commit/0362019ca043ef955364f18b23dbcd36f0bfb2bf) Thanks [@alex-ju](https://github.com/alex-ju)! - `Hds::Tabs` - Fix missing tab indicator when used in Modal or Flyout
14
+
15
+ - [#1567](https://github.com/hashicorp/design-system/pull/1567) [`384faeec2`](https://github.com/hashicorp/design-system/commit/384faeec244011f8090f3bcce0def89da1563164) Thanks [@MelSumner](https://github.com/MelSumner)! - Add support for container in Copy::Snippet and update API docs
16
+
17
+ - [#1571](https://github.com/hashicorp/design-system/pull/1571) [`8ad8a5908`](https://github.com/hashicorp/design-system/commit/8ad8a59080d0c0c855f2f746f0a10ddf4440e461) Thanks [@alex-ju](https://github.com/alex-ju)! - `Hds::Tabs` - Fix tabs and panels misbehaving on route change
18
+
19
+ - [#1568](https://github.com/hashicorp/design-system/pull/1568) [`dbe2e437d`](https://github.com/hashicorp/design-system/commit/dbe2e437d7d465cda3b69c7a28b01cbfb2849b79) Thanks [@MelSumner](https://github.com/MelSumner)! - Update error icon for copy components
20
+
21
+ - [#1555](https://github.com/hashicorp/design-system/pull/1555) [`90a615161`](https://github.com/hashicorp/design-system/commit/90a61516156ea58898febaa5bd66b31386256151) Thanks [@alex-ju](https://github.com/alex-ju)! - `Hds::SegmentedGroup` - prevent `border-radius` from interfering with underlying elements
22
+
23
+ - [#1565](https://github.com/hashicorp/design-system/pull/1565) [`60154db1a`](https://github.com/hashicorp/design-system/commit/60154db1a00f877b2c3bc4a9c4069556e8af809b) Thanks [@MelSumner](https://github.com/MelSumner)! - Resolved issue where ThSort was not supporting right-aligned text properly
24
+
25
+ - Updated dependencies [[`8b8d6bcfa`](https://github.com/hashicorp/design-system/commit/8b8d6bcfa67efa5de1a2cc419167a962e747a8c9)]:
26
+ - @hashicorp/ember-flight-icons@3.1.0
27
+
3
28
  ## 2.9.0
4
29
 
5
30
  ### Minor Changes
@@ -12,7 +12,7 @@ export const DEFAULT_SIZE = 'medium';
12
12
  export const SIZES = ['small', 'medium'];
13
13
  export const DEFAULT_ICON = 'clipboard-copy';
14
14
  export const SUCCESS_ICON = 'clipboard-checked';
15
- export const ERROR_ICON = 'clipboard';
15
+ export const ERROR_ICON = 'clipboard-x';
16
16
  export const DEFAULT_STATUS = 'idle';
17
17
 
18
18
  export default class HdsCopyButtonComponent extends Component {
@@ -5,7 +5,7 @@
5
5
  <button
6
6
  type="button"
7
7
  class={{this.classNames}}
8
- {{clipboard text=@textToCopy onError=this.onError onSuccess=this.onSuccess}}
8
+ {{clipboard text=@textToCopy container=@container onError=this.onError onSuccess=this.onSuccess}}
9
9
  ...attributes
10
10
  >
11
11
  <span class="hds-copy-snippet__text hds-typography-code-100 {{if @isTruncated 'hds-copy-snippet__text--truncated'}}">
@@ -12,7 +12,7 @@ export const DEFAULT_COLOR = 'primary';
12
12
  export const COLORS = ['primary', 'secondary'];
13
13
  export const DEFAULT_ICON = 'clipboard-copy';
14
14
  export const SUCCESS_ICON = 'clipboard-checked';
15
- export const ERROR_ICON = 'clipboard';
15
+ export const ERROR_ICON = 'clipboard-x';
16
16
  export const DEFAULT_STATUS = 'idle';
17
17
 
18
18
  export default class HdsCopySnippetIndexComponent extends Component {
@@ -0,0 +1,6 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+
6
+ <input class="hds-form-file-input hds-typography-body-200" ...attributes type="file" />
@@ -0,0 +1,24 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
5
+ <Hds::Form::Field
6
+ @layout="vertical"
7
+ @extraAriaDescribedBy={{@extraAriaDescribedBy}}
8
+ @isRequired={{@isRequired}}
9
+ @isOptional={{@isOptional}}
10
+ @id={{@id}}
11
+ as |F|
12
+ >
13
+ {{! Notice: the order of the elements is not relevant here, because is controlled at "Hds::Form::Field" component level }}
14
+ {{yield (hash Label=F.Label isRequired=F.isRequired isOptional=F.isOptional)}}
15
+ {{yield (hash HelperText=F.HelperText Error=F.Error)}}
16
+ <F.Control>
17
+ <Hds::Form::FileInput::Base
18
+ required={{@isRequired}}
19
+ ...attributes
20
+ id={{F.id}}
21
+ aria-describedby={{F.ariaDescribedBy}}
22
+ />
23
+ </F.Control>
24
+ </Hds::Form::Field>
@@ -133,7 +133,6 @@ export default class HdsIconTileIndexComponent extends Component {
133
133
  get entity() {
134
134
  let entity;
135
135
 
136
- // TODO: discuss if we want these kind of tests
137
136
  assert(
138
137
  `you can't pass both @logo and @icon properties to the "Hds::IconTile" component`,
139
138
  !(this.args.logo && this.args.icon)
@@ -11,6 +11,7 @@
11
11
  Tab=(component
12
12
  "hds/tabs/tab"
13
13
  didInsertNode=this.didInsertTab
14
+ willDestroyNode=this.willDestroyTab
14
15
  tabIds=this.tabIds
15
16
  panelIds=this.panelIds
16
17
  selectedTabIndex=this.selectedTabIndex
@@ -28,6 +29,7 @@
28
29
  Panel=(component
29
30
  "hds/tabs/panel"
30
31
  didInsertNode=this.didInsertPanel
32
+ willDestroyNode=this.willDestroyPanel
31
33
  tabIds=this.tabIds
32
34
  panelIds=this.panelIds
33
35
  selectedTabIndex=this.selectedTabIndex
@@ -7,6 +7,7 @@ import Component from '@glimmer/component';
7
7
  import { tracked } from '@glimmer/tracking';
8
8
  import { action } from '@ember/object';
9
9
  import { assert } from '@ember/debug';
10
+ import { schedule } from '@ember/runloop';
10
11
 
11
12
  export default class HdsTabsIndexComponent extends Component {
12
13
  @tracked tabNodes = [];
@@ -28,7 +29,10 @@ export default class HdsTabsIndexComponent extends Component {
28
29
  }
29
30
  });
30
31
  this.selectedTabIndex = initialTabIndex;
31
- this.setTabIndicator(initialTabIndex);
32
+
33
+ schedule('afterRender', () => {
34
+ this.setTabIndicator(initialTabIndex);
35
+ });
32
36
 
33
37
  assert('Only one tab may use isSelected argument', selectedCount <= 1);
34
38
 
@@ -44,12 +48,24 @@ export default class HdsTabsIndexComponent extends Component {
44
48
  this.tabIds = [...this.tabIds, element.id];
45
49
  }
46
50
 
51
+ @action
52
+ willDestroyTab(element) {
53
+ this.tabNodes = this.tabNodes.filter((node) => node.id !== element.id);
54
+ this.tabIds = this.tabIds.filter((tabId) => tabId !== element.id);
55
+ }
56
+
47
57
  @action
48
58
  didInsertPanel(panelId, element) {
49
59
  this.panelNodes = [...this.panelNodes, element];
50
60
  this.panelIds = [...this.panelIds, panelId];
51
61
  }
52
62
 
63
+ @action
64
+ willDestroyPanel(element) {
65
+ this.panelNodes = this.panelNodes.filter((node) => node.id !== element.id);
66
+ this.panelIds = this.panelIds.filter((panelId) => panelId !== element.id);
67
+ }
68
+
53
69
  @action
54
70
  onClick(tabIndex, event) {
55
71
  this.selectedTabIndex = tabIndex;
@@ -10,6 +10,7 @@
10
10
  id={{this.panelId}}
11
11
  hidden={{not this.isSelected}}
12
12
  {{did-insert this.didInsertNode}}
13
+ {{will-destroy this.willDestroyNode}}
13
14
  >
14
15
  {{yield}}
15
16
  </section>
@@ -42,4 +42,13 @@ export default class HdsTabsIndexComponent extends Component {
42
42
  didInsertNode(this.elementId, ...arguments);
43
43
  }
44
44
  }
45
+
46
+ @action
47
+ willDestroyNode() {
48
+ let { willDestroyNode } = this.args;
49
+
50
+ if (typeof willDestroyNode === 'function') {
51
+ willDestroyNode(...arguments);
52
+ }
53
+ }
45
54
  }
@@ -13,6 +13,7 @@
13
13
  tabindex={{unless this.isSelected "-1"}}
14
14
  data-is-selected={{this.isInitialTab}}
15
15
  {{did-insert this.didInsertNode}}
16
+ {{will-destroy this.willDestroyNode}}
16
17
  {{on "click" this.onClick}}
17
18
  {{on "keyup" this.onKeyUp}}
18
19
  >
@@ -54,6 +54,15 @@ export default class HdsTabsIndexComponent extends Component {
54
54
  }
55
55
  }
56
56
 
57
+ @action
58
+ willDestroyNode() {
59
+ let { willDestroyNode } = this.args;
60
+
61
+ if (typeof willDestroyNode === 'function') {
62
+ willDestroyNode(...arguments);
63
+ }
64
+ }
65
+
57
66
  @action
58
67
  onClick() {
59
68
  let { onClick } = this.args;
@@ -3,4 +3,4 @@
3
3
  * SPDX-License-Identifier: MPL-2.0
4
4
  */
5
5
 
6
- export { default } from '@hashicorp/design-system-components/components/hds/copy/index';
6
+ export { default } from '@hashicorp/design-system-components/components/hds/form/file-input/base';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ export { default } from '@hashicorp/design-system-components/components/hds/form/file-input/field';
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ //
7
+ // FORM > FILE-INPUT
8
+ //
9
+
10
+ @use "../../mixins/button" as *;
11
+
12
+ .hds-form-file-input {
13
+ margin: -4px 0 -4px -4px; // offset shadow padding + default 1px spacing
14
+ padding: 3px 0 3px 3px; // add padding so button shadow is visible
15
+ color: var(--token-color-foreground-primary);
16
+
17
+ &:focus,
18
+ &:focus-visible {
19
+ outline: none;
20
+ }
21
+ }
22
+
23
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/::file-selector-button
24
+ // https://caniuse.com/?search=file-selector-button
25
+
26
+ // Button
27
+ .hds-form-file-input::file-selector-button {
28
+ min-height: 36px;
29
+ margin-right: 16px;
30
+ padding: 7px 16px 7px 37px; // padding in code altered to match Figma visual design
31
+ color: var(--token-color-foreground-primary);
32
+ font: inherit;
33
+ background-color: var(--token-color-surface-faint);
34
+ // upload icon
35
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3E%3Cg fill='%233b3d45'%3E%3Cpath d='M4.24 5.8a.75.75 0 001.06-.04l1.95-2.1v6.59a.75.75 0 001.5 0V3.66l1.95 2.1a.75.75 0 101.1-1.02l-3.25-3.5a.75.75 0 00-1.101.001L4.2 4.74a.75.75 0 00.04 1.06z'/%3E%3Cpath d='M1.75 9a.75.75 0 01.75.75v3c0 .414.336.75.75.75h9.5a.75.75 0 00.75-.75v-3a.75.75 0 011.5 0v3A2.25 2.25 0 0112.75 15h-9.5A2.25 2.25 0 011 12.75v-3A.75.75 0 011.75 9z'/%3E%3C/g%3E%3C/svg%3E");
36
+ background-repeat: no-repeat;
37
+ background-position: 15px 50%;
38
+ background-size: var(--token-form-text-input-background-image-size);
39
+ border: $hds-button-border-width solid var(--token-color-border-strong);
40
+ border-radius: $hds-button-border-radius;
41
+ box-shadow: var(--token-elevation-low-box-shadow);
42
+ cursor: pointer;
43
+ }
44
+
45
+ // Button states
46
+ .hds-form-file-input::file-selector-button:hover,
47
+ .hds-form-file-input.mock-hover::file-selector-button {
48
+ color: var(--token-color-foreground-primary);
49
+ background-color: var(--token-color-surface-primary);
50
+ border-color: var(--token-color-border-strong);
51
+ }
52
+
53
+ .hds-form-file-input:focus-within::file-selector-button,
54
+ .hds-form-file-input.mock-focus::file-selector-button {
55
+ color: var(--token-color-foreground-primary);
56
+ background-color: var(--token-color-surface-faint);
57
+ border-color: var(--token-color-focus-action-internal);
58
+ outline: 3px solid var(--token-color-focus-action-external);
59
+ }
60
+
61
+ // Fix issue with button focus style which was displaying after button was activated
62
+ .hds-form-file-input:not(:focus, .mock-focus) {
63
+ &::file-selector-button {
64
+ border-color: var(--token-color-border-strong);
65
+ outline: 0;
66
+ }
67
+ }
68
+
69
+ .hds-form-file-input::file-selector-button:active,
70
+ .hds-form-file-input.mock-active::file-selector-button {
71
+ color: var(--token-color-foreground-primary);
72
+ background-color: var(--token-color-surface-interactive-active);
73
+ border-color: var(--token-color-border-strong);
74
+ box-shadow: none;
75
+ }
76
+
77
+ .hds-form-file-input {
78
+ &:disabled,
79
+ &[disabled],
80
+ &.mock-disabled,
81
+ &:disabled:focus,
82
+ &[disabled]:focus,
83
+ &.mock-disabled:focus,
84
+ &:disabled:hover,
85
+ &[disabled]:hover,
86
+ &.mock-disabled:hover {
87
+ color: var(--token-color-foreground-disabled);
88
+
89
+ &::file-selector-button {
90
+ @include hds-button-state-disabled();
91
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3E%3Cg fill='%238c909c'%3E%3Cpath d='M4.24 5.8a.75.75 0 001.06-.04l1.95-2.1v6.59a.75.75 0 001.5 0V3.66l1.95 2.1a.75.75 0 101.1-1.02l-3.25-3.5a.75.75 0 00-1.101.001L4.2 4.74a.75.75 0 00.04 1.06z'/%3E%3Cpath d='M1.75 9a.75.75 0 01.75.75v3c0 .414.336.75.75.75h9.5a.75.75 0 00.75-.75v-3a.75.75 0 011.5 0v3A2.25 2.25 0 0112.75 15h-9.5A2.25 2.25 0 011 12.75v-3A.75.75 0 011.75 9z'/%3E%3C/g%3E%3C/svg%3E");
92
+ }
93
+ }
94
+ }
@@ -11,6 +11,7 @@
11
11
  @use "./helper-text";
12
12
  @use "./error";
13
13
  @use "./field";
14
+ @use "./file-input";
14
15
  @use "./legend";
15
16
  @use "./group";
16
17
  @use "./indicator";
@@ -10,10 +10,10 @@
10
10
  .hds-segmented-group {
11
11
  display: inline-flex;
12
12
 
13
- .hds-button,
14
- .hds-dropdown,
15
- .hds-form-select,
16
- .hds-form-text-input {
13
+ > .hds-button,
14
+ > .hds-dropdown,
15
+ > .hds-form-select,
16
+ > .hds-form-text-input {
17
17
  &:first-child {
18
18
  border-top-right-radius: 0;
19
19
  border-bottom-right-radius: 0;
@@ -159,6 +159,10 @@ $hds-table-cell-padding-tall: 22px 16px 21px 16px; // the 1px difference is to a
159
159
  text-align: right;
160
160
  }
161
161
 
162
+ .hds-table__th-sort--text-right .hds-table__th-sort--button-content {
163
+ justify-content: flex-end;
164
+ }
165
+
162
166
  .hds-table__th-sort--text-center,
163
167
  .hds-table__th--text-center,
164
168
  .hds-table__td--text-center {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashicorp/design-system-components",
3
- "version": "2.9.0",
3
+ "version": "2.10.0",
4
4
  "description": "Helios Design System Components",
5
5
  "keywords": [
6
6
  "hashicorp",
@@ -42,7 +42,7 @@
42
42
  "@ember/render-modifiers": "^2.0.5",
43
43
  "@ember/test-waiters": "^3.0.2",
44
44
  "@hashicorp/design-system-tokens": "^1.7.0",
45
- "@hashicorp/ember-flight-icons": "^3.0.9",
45
+ "@hashicorp/ember-flight-icons": "^3.1.0",
46
46
  "dialog-polyfill": "^0.5.6",
47
47
  "ember-a11y-refocus": "^3.0.2",
48
48
  "ember-auto-import": "^2.6.3",