@hashicorp/design-system-components 3.4.0 → 3.4.1
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 +44 -21
- package/addon/components/hds/code-block/index.hbs +3 -6
- package/addon/components/hds/code-block/index.js +24 -20
- package/addon/components/hds/flyout/index.hbs +1 -0
- package/addon/components/hds/flyout/index.js +20 -7
- package/addon/components/hds/modal/index.hbs +1 -0
- package/addon/components/hds/modal/index.js +35 -22
- package/app/styles/components/code-block/index.scss +1 -1
- package/app/styles/components/segmented-group.scss +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @hashicorp/design-system-components
|
|
2
2
|
|
|
3
|
+
## 3.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
`Modal` - Removed `close` event listener on destroy
|
|
8
|
+
`Flyout` - Removed `close` event listener on destroy
|
|
9
|
+
|
|
10
|
+
<small class="doc-whats-new-changelog-metadata">[#1887](https://github.com/hashicorp/design-system/pull/1887)</small>
|
|
11
|
+
|
|
12
|
+
<div class="doc-whats-new-changelog-separator"></div>
|
|
13
|
+
|
|
14
|
+
`CodeBlock` - Fixed issues with dynamic content, compile warning, and line number alignment
|
|
15
|
+
|
|
16
|
+
<small class="doc-whats-new-changelog-metadata">[#1853](https://github.com/hashicorp/design-system/pull/1853)</small>
|
|
17
|
+
|
|
18
|
+
<div class="doc-whats-new-changelog-separator"></div>
|
|
19
|
+
|
|
20
|
+
`SegmentedGroup` - Fixed issue with border-radius of single child element being overridden
|
|
21
|
+
|
|
22
|
+
<small class="doc-whats-new-changelog-metadata">[#1892](https://github.com/hashicorp/design-system/pull/1892)</small>
|
|
23
|
+
|
|
24
|
+
<div class="doc-whats-new-changelog-separator"></div>
|
|
25
|
+
|
|
3
26
|
## 3.4.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
|
@@ -18,7 +41,7 @@
|
|
|
18
41
|
|
|
19
42
|
### Patch Changes
|
|
20
43
|
|
|
21
|
-
`
|
|
44
|
+
`AppFooter` - Changed visual alignment from right-aligned to centered.
|
|
22
45
|
|
|
23
46
|
<small class="doc-whats-new-changelog-metadata">[#1867](https://github.com/hashicorp/design-system/pull/1867)</small>
|
|
24
47
|
|
|
@@ -56,11 +79,11 @@
|
|
|
56
79
|
|
|
57
80
|
### Minor Changes
|
|
58
81
|
|
|
59
|
-
`
|
|
60
|
-
`
|
|
61
|
-
`
|
|
62
|
-
`
|
|
63
|
-
`
|
|
82
|
+
`Form::CharacterCount` - Added new component
|
|
83
|
+
`Form::Field` - Added `CharacterCount` contextual component
|
|
84
|
+
`Form::MaskedInput::Field` - Added `CharacterCount` contextual component
|
|
85
|
+
`Form::TextInput::Field` - Added `CharacterCount` contextual component
|
|
86
|
+
`Form::Textarea::Field` - Added `CharacterCount` contextual component
|
|
64
87
|
|
|
65
88
|
<small class="doc-whats-new-changelog-metadata">[#1802](https://github.com/hashicorp/design-system/pull/1802)</small>
|
|
66
89
|
|
|
@@ -68,11 +91,11 @@
|
|
|
68
91
|
|
|
69
92
|
### Patch Changes
|
|
70
93
|
|
|
71
|
-
`Button` -
|
|
94
|
+
`Button` - Updated DOM structure to contain only `span` elements
|
|
72
95
|
|
|
73
|
-
`Dropdown` -
|
|
96
|
+
`Dropdown` - Updated button elements DOM structure to contain only `span` elements
|
|
74
97
|
|
|
75
|
-
`Link::Standalone` -
|
|
98
|
+
`Link::Standalone` - Updated DOM structure to contain only `span` elements
|
|
76
99
|
|
|
77
100
|
<small class="doc-whats-new-changelog-metadata">[#1840](https://github.com/hashicorp/design-system/pull/1840)</small>
|
|
78
101
|
|
|
@@ -88,9 +111,9 @@
|
|
|
88
111
|
|
|
89
112
|
<div class="doc-whats-new-changelog-separator"></div>
|
|
90
113
|
|
|
91
|
-
`
|
|
114
|
+
`Table` - Updated `@columns` object to support `isVisuallyHidden` argument
|
|
92
115
|
|
|
93
|
-
- `
|
|
116
|
+
- `Table::Th` - Updated to support `isVisuallyHidden` argument
|
|
94
117
|
|
|
95
118
|
<small class="doc-whats-new-changelog-metadata">[#1819](https://github.com/hashicorp/design-system/pull/1819)</small>
|
|
96
119
|
|
|
@@ -199,7 +222,7 @@ Upgraded the following dependencies:
|
|
|
199
222
|
|
|
200
223
|
### Patch Changes
|
|
201
224
|
|
|
202
|
-
|
|
225
|
+
Explicitly added `ember-element-helper` as dependency for the `components` package
|
|
203
226
|
|
|
204
227
|
<small class="doc-whats-new-changelog-metadata">[#1751](https://github.com/hashicorp/design-system/pull/1751)</small>
|
|
205
228
|
|
|
@@ -217,33 +240,33 @@ explicitly added `ember-element-helper` as dependency for the `components` packa
|
|
|
217
240
|
|
|
218
241
|
### Major Changes
|
|
219
242
|
|
|
220
|
-
|
|
243
|
+
Dropped support for Node 14
|
|
221
244
|
|
|
222
245
|
<small class="doc-whats-new-changelog-metadata">[#1634](https://github.com/hashicorp/design-system/pull/1634)</small>
|
|
223
246
|
|
|
224
247
|
<div class="doc-whats-new-changelog-separator"></div>
|
|
225
248
|
|
|
226
|
-
`
|
|
249
|
+
`Form::VisibilityToggle` - Added component as a form base element
|
|
227
250
|
|
|
228
|
-
`
|
|
251
|
+
`Form::TextInput::Field` - Added `Form::VisibilityToggle` to password inputs (controlled via `@hasVisibilityToggle` - Notice that this is set to be visible by default now)
|
|
229
252
|
|
|
230
|
-
`
|
|
253
|
+
`Form::MaskedInput` - Refactored to use `Form::VisibilityToggle`
|
|
231
254
|
|
|
232
|
-
`
|
|
255
|
+
`Form::MaskedInput` - Renamed `@isMasked` to `@isContentMasked`
|
|
233
256
|
|
|
234
257
|
To migrate:
|
|
235
258
|
|
|
236
|
-
- in `
|
|
259
|
+
- in `Form::MaskedInput` instances replace `@isMasked` arguments with `@isContentMasked`
|
|
237
260
|
|
|
238
261
|
<small class="doc-whats-new-changelog-metadata">[#1634](https://github.com/hashicorp/design-system/pull/1634)</small>
|
|
239
262
|
|
|
240
263
|
<div class="doc-whats-new-changelog-separator"></div>
|
|
241
264
|
|
|
242
|
-
`
|
|
265
|
+
`Dropdown` – Removed `@listPosition` `left` and `right` (use `bottom-left` and `bottom-right`, respectively).
|
|
243
266
|
|
|
244
267
|
To migrate:
|
|
245
268
|
|
|
246
|
-
- in `
|
|
269
|
+
- in `Dropdown` instances:
|
|
247
270
|
- replace `@listPosition="left"` with `@listPosition="bottom-left"`
|
|
248
271
|
- replace `@listPosition="right"` with `@listPosition="bottom-right"`
|
|
249
272
|
|
|
@@ -255,7 +278,7 @@ To migrate:
|
|
|
255
278
|
|
|
256
279
|
To migrate:
|
|
257
280
|
|
|
258
|
-
- rename all the `extraBefore/After` instances yielded within the
|
|
281
|
+
- rename all the `extraBefore/After` instances yielded within the `SideNav` component to `ExtraBefore/After`
|
|
259
282
|
|
|
260
283
|
<small class="doc-whats-new-changelog-metadata">[#1634](https://github.com/hashicorp/design-system/pull/1634)</small>
|
|
261
284
|
|
|
@@ -9,19 +9,16 @@
|
|
|
9
9
|
{{~yield (hash Description=(component "hds/code-block/description"))~}}
|
|
10
10
|
</div>
|
|
11
11
|
<div class="hds-code-block__body">
|
|
12
|
+
{{! content within pre tag is whitespace-sensitive; do not add new lines! }}
|
|
12
13
|
<pre
|
|
13
14
|
class="hds-code-block__code"
|
|
14
15
|
{{style maxHeight=@maxHeight}}
|
|
15
16
|
data-line={{@highlightLines}}
|
|
16
17
|
id={{this.preCodeId}}
|
|
17
18
|
tabindex="0"
|
|
18
|
-
>
|
|
19
|
-
{{~! ~}}
|
|
20
|
-
<code {{did-insert this.setPrismCode}} {{did-update this.setPrismCode this.code @language}}>
|
|
19
|
+
><code {{did-insert this.setPrismCode}} {{did-update this.setPrismCode this.code @language}}>
|
|
21
20
|
{{~this.prismCode~}}
|
|
22
|
-
</code>
|
|
23
|
-
{{~! ~}}
|
|
24
|
-
</pre>
|
|
21
|
+
</code></pre>
|
|
25
22
|
|
|
26
23
|
{{#if @hasCopyButton}}
|
|
27
24
|
<Hds::CodeBlock::CopyButton @targetToCopy="#{{this.preCodeId}}" aria-describedby={{this.preCodeId}} />
|
|
@@ -7,6 +7,7 @@ import Component from '@glimmer/component';
|
|
|
7
7
|
import { action } from '@ember/object';
|
|
8
8
|
import { tracked } from '@glimmer/tracking';
|
|
9
9
|
import { assert } from '@ember/debug';
|
|
10
|
+
import { next, schedule } from '@ember/runloop';
|
|
10
11
|
import { htmlSafe } from '@ember/template';
|
|
11
12
|
import { guidFor } from '@ember/object/internals';
|
|
12
13
|
|
|
@@ -107,27 +108,30 @@ export default class HdsCodeBlockIndexComponent extends Component {
|
|
|
107
108
|
const grammar = Prism.languages[language];
|
|
108
109
|
|
|
109
110
|
if (code) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
next(() => {
|
|
112
|
+
if (language && grammar) {
|
|
113
|
+
this.prismCode = htmlSafe(Prism.highlight(code, grammar, language));
|
|
114
|
+
} else {
|
|
115
|
+
this.prismCode = htmlSafe(Prism.util.encode(code));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Force prism-line-numbers plugin initialization, required for Prism.highlight usage
|
|
119
|
+
// See https://github.com/PrismJS/prism/issues/1234
|
|
120
|
+
Prism.hooks.run('complete', {
|
|
121
|
+
code,
|
|
122
|
+
element,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Force prism-line-highlight plugin initialization
|
|
126
|
+
// Context: https://github.com/hashicorp/design-system/pull/1749#discussion_r1374288785
|
|
127
|
+
if (this.args.highlightLines) {
|
|
128
|
+
// we need to delay re-evaluating the context for prism-line-highlight for as much as possible, and `afterRender` is the 'latest' we can use in the component lifecycle
|
|
129
|
+
schedule('afterRender', () => {
|
|
130
|
+
// we piggy-back on the plugin's `resize` event listener to trigger a new call of the `highlightLines` function: https://github.com/PrismJS/prism/blob/master/plugins/line-highlight/prism-line-highlight.js#L337
|
|
131
|
+
if (window) window.dispatchEvent(new Event('resize'));
|
|
132
|
+
});
|
|
133
|
+
}
|
|
121
134
|
});
|
|
122
|
-
|
|
123
|
-
// Force prism-line-highlight plugin initialization
|
|
124
|
-
// Context: https://github.com/hashicorp/design-system/pull/1749#discussion_r1374288785
|
|
125
|
-
if (this.args.highlightLines) {
|
|
126
|
-
setTimeout(() => {
|
|
127
|
-
// we piggy-back on the plugin's `resize` event listener to trigger a new call of the `highlightLines` function: https://github.com/PrismJS/prism/blob/master/plugins/line-highlight/prism-line-highlight.js#L337
|
|
128
|
-
if (window) window.dispatchEvent(new Event('resize'));
|
|
129
|
-
}, 100);
|
|
130
|
-
}
|
|
131
135
|
}
|
|
132
136
|
}
|
|
133
137
|
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
...attributes
|
|
8
8
|
aria-labelledby={{this.id}}
|
|
9
9
|
{{did-insert this.didInsert}}
|
|
10
|
+
{{will-destroy this.willDestroyNode}}
|
|
10
11
|
{{focus-trap isActive=this.isOpen focusTrapOptions=(hash onDeactivate=this.onDismiss clickOutsideDeactivates=true)}}
|
|
11
12
|
>
|
|
12
13
|
{{yield (hash Header=(component "hds/flyout/header" id=this.id onDismiss=this.onDismiss))}}
|
|
@@ -67,6 +67,14 @@ export default class HdsFlyoutIndexComponent extends Component {
|
|
|
67
67
|
return classes.join(' ');
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
@action registerOnCloseCallback() {
|
|
71
|
+
if (this.args.onClose && typeof this.args.onClose === 'function') {
|
|
72
|
+
this.args.onClose();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
this.isOpen = false;
|
|
76
|
+
}
|
|
77
|
+
|
|
70
78
|
@action
|
|
71
79
|
didInsert(element) {
|
|
72
80
|
// Store references of `<dialog>` and `<body>` elements
|
|
@@ -94,13 +102,7 @@ export default class HdsFlyoutIndexComponent extends Component {
|
|
|
94
102
|
}
|
|
95
103
|
|
|
96
104
|
// Register "onClose" callback function to be called when a native 'close' event is dispatched
|
|
97
|
-
this.element.addEventListener('close',
|
|
98
|
-
if (this.args.onClose && typeof this.args.onClose === 'function') {
|
|
99
|
-
this.args.onClose();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
this.isOpen = false;
|
|
103
|
-
});
|
|
105
|
+
this.element.addEventListener('close', this.registerOnCloseCallback, true);
|
|
104
106
|
|
|
105
107
|
// If the flyout dialog is not already open
|
|
106
108
|
if (!this.element.open) {
|
|
@@ -108,6 +110,17 @@ export default class HdsFlyoutIndexComponent extends Component {
|
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
|
|
113
|
+
@action
|
|
114
|
+
willDestroyNode() {
|
|
115
|
+
if (this.element) {
|
|
116
|
+
this.element.removeEventListener(
|
|
117
|
+
'close',
|
|
118
|
+
this.registerOnCloseCallback,
|
|
119
|
+
true
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
111
124
|
@action
|
|
112
125
|
open() {
|
|
113
126
|
// Make flyout dialog visible using the native `showModal` method
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
...attributes
|
|
8
8
|
aria-labelledby={{this.id}}
|
|
9
9
|
{{did-insert this.didInsert}}
|
|
10
|
+
{{will-destroy this.willDestroyNode}}
|
|
10
11
|
{{focus-trap isActive=this.isOpen focusTrapOptions=(hash onDeactivate=this.onDismiss clickOutsideDeactivates=true)}}
|
|
11
12
|
>
|
|
12
13
|
{{yield (hash Header=(component "hds/modal/header" id=this.id onDismiss=this.onDismiss))}}
|
|
@@ -93,6 +93,29 @@ export default class HdsModalIndexComponent extends Component {
|
|
|
93
93
|
return classes.join(' ');
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
@action registerOnCloseCallback() {
|
|
97
|
+
if (
|
|
98
|
+
!this.isDismissDisabled &&
|
|
99
|
+
this.args.onClose &&
|
|
100
|
+
typeof this.args.onClose === 'function'
|
|
101
|
+
) {
|
|
102
|
+
this.args.onClose();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// If the dismissal of the modal is disabled, we keep the modal open/visible otherwise we mark it as closed
|
|
106
|
+
if (this.isDismissDisabled) {
|
|
107
|
+
// If, in a chain of events, the element is not attached to the DOM, the `showModal` would fail
|
|
108
|
+
// so we add this safeguard condition that checks for the `<dialog>` to have a parent
|
|
109
|
+
if (this.element.parentElement) {
|
|
110
|
+
// As there is no way to `preventDefault` on `close` events, we call the `showModal` function
|
|
111
|
+
// preserving the state of the modal dialog
|
|
112
|
+
this.element.showModal();
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
this.isOpen = false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
96
119
|
@action
|
|
97
120
|
didInsert(element) {
|
|
98
121
|
// Store references of `<dialog>` and `<body>` elements
|
|
@@ -120,28 +143,7 @@ export default class HdsModalIndexComponent extends Component {
|
|
|
120
143
|
}
|
|
121
144
|
|
|
122
145
|
// Register "onClose" callback function to be called when a native 'close' event is dispatched
|
|
123
|
-
this.element.addEventListener('close',
|
|
124
|
-
if (
|
|
125
|
-
!this.isDismissDisabled &&
|
|
126
|
-
this.args.onClose &&
|
|
127
|
-
typeof this.args.onClose === 'function'
|
|
128
|
-
) {
|
|
129
|
-
this.args.onClose();
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// If the dismissal of the modal is disabled, we keep the modal open/visible otherwise we mark it as closed
|
|
133
|
-
if (this.isDismissDisabled) {
|
|
134
|
-
// If, in a chain of events, the element is not attached to the DOM, the `showModal` would fail
|
|
135
|
-
// so we add this safeguard condition that checks for the `<dialog>` to have a parent
|
|
136
|
-
if (this.element.parentElement) {
|
|
137
|
-
// As there is no way to `preventDefault` on `close` events, we call the `showModal` function
|
|
138
|
-
// preserving the state of the modal dialog
|
|
139
|
-
this.element.showModal();
|
|
140
|
-
}
|
|
141
|
-
} else {
|
|
142
|
-
this.isOpen = false;
|
|
143
|
-
}
|
|
144
|
-
});
|
|
146
|
+
this.element.addEventListener('close', this.registerOnCloseCallback, true);
|
|
145
147
|
|
|
146
148
|
// If the modal dialog is not already open
|
|
147
149
|
if (!this.element.open) {
|
|
@@ -149,6 +151,17 @@ export default class HdsModalIndexComponent extends Component {
|
|
|
149
151
|
}
|
|
150
152
|
}
|
|
151
153
|
|
|
154
|
+
@action
|
|
155
|
+
willDestroyNode() {
|
|
156
|
+
if (this.element) {
|
|
157
|
+
this.element.removeEventListener(
|
|
158
|
+
'close',
|
|
159
|
+
this.registerOnCloseCallback,
|
|
160
|
+
true
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
152
165
|
@action
|
|
153
166
|
open() {
|
|
154
167
|
// Make modal dialog visible using the native `showModal` method
|
|
@@ -131,7 +131,7 @@ $code-block-code-padding: 16px;
|
|
|
131
131
|
padding: $code-block-code-padding;
|
|
132
132
|
overflow: auto;
|
|
133
133
|
font-size: 0.8125rem;
|
|
134
|
-
font-family: var(--
|
|
134
|
+
font-family: var(--token-typography-code-200-font-family);
|
|
135
135
|
border-radius: inherit;
|
|
136
136
|
|
|
137
137
|
::selection {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
> .hds-dropdown,
|
|
15
15
|
> .hds-form-select,
|
|
16
16
|
> .hds-form-text-input {
|
|
17
|
-
&:first-child {
|
|
17
|
+
&:first-child:not(:only-child) {
|
|
18
18
|
border-top-right-radius: 0;
|
|
19
19
|
border-bottom-right-radius: 0;
|
|
20
20
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
&:last-child {
|
|
29
|
+
&:last-child:not(:only-child) {
|
|
30
30
|
margin-left: -1px;
|
|
31
31
|
border-top-left-radius: 0;
|
|
32
32
|
border-bottom-left-radius: 0;
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
&:not(:first-child, :last-child) {
|
|
42
|
+
&:not(:first-child, :last-child, :only-child) {
|
|
43
43
|
margin-left: -1px;
|
|
44
44
|
border-radius: 0;
|
|
45
45
|
|