@hashicorp/design-system-components 2.7.0 → 2.8.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 +65 -0
- package/HOW-TO-TEST-A-COMPONENT-IN-CLOUD-UI.md +21 -0
- package/NEW-COMPONENT-CHECKLIST.md +1 -0
- package/README.md +1 -1
- package/addon/components/hds/accordion/index.hbs +8 -0
- package/addon/components/hds/accordion/item/button.hbs +11 -0
- package/addon/components/hds/accordion/item/button.js +31 -0
- package/addon/components/hds/accordion/item/index.hbs +25 -0
- package/addon/components/hds/accordion/item/index.js +58 -0
- package/addon/components/hds/alert/description.hbs +1 -1
- package/addon/components/hds/alert/index.hbs +1 -1
- package/addon/components/hds/alert/title.hbs +1 -1
- package/addon/components/hds/card/container.js +2 -2
- package/addon/components/hds/dropdown/list-item/checkmark.hbs +3 -3
- package/addon/components/hds/dropdown/list-item/separator.hbs +6 -1
- package/addon/components/hds/flyout/index.js +8 -1
- package/addon/components/hds/form/masked-input/base.hbs +34 -0
- package/addon/components/hds/form/masked-input/base.js +72 -0
- package/addon/components/hds/form/masked-input/field.hbs +30 -0
- package/addon/components/hds/form/text-input/base.js +6 -1
- package/addon/components/hds/form/text-input/field.hbs +1 -0
- package/addon/components/hds/modal/index.js +13 -2
- package/addon/components/hds/side-nav/list/link.hbs +5 -3
- package/app/components/hds/accordion/index.js +6 -0
- package/app/components/hds/accordion/item/button.js +6 -0
- package/app/components/hds/accordion/item/index.js +6 -0
- package/app/components/hds/form/masked-input/base.js +6 -0
- package/app/components/hds/form/masked-input/field.js +6 -0
- package/app/styles/@hashicorp/design-system-components.scss +1 -0
- package/app/styles/components/accordion.scss +120 -0
- package/app/styles/components/alert.scss +2 -23
- package/app/styles/components/application-state.scss +1 -7
- package/app/styles/components/badge.scss +1 -4
- package/app/styles/components/button-set.scss +1 -4
- package/app/styles/components/button.scss +0 -8
- package/app/styles/components/disclosure-primitive.scss +0 -1
- package/app/styles/components/dropdown.scss +4 -11
- package/app/styles/components/flyout.scss +1 -2
- package/app/styles/components/form/error.scss +2 -1
- package/app/styles/components/form/index.scss +1 -0
- package/app/styles/components/form/masked-input.scss +46 -0
- package/app/styles/components/form/text-input.scss +5 -0
- package/app/styles/components/form/textarea.scss +2 -2
- package/app/styles/components/link/standalone.scss +2 -9
- package/app/styles/components/modal.scss +1 -2
- package/app/styles/components/page-header.scss +3 -0
- package/app/styles/components/pagination.scss +2 -9
- package/app/styles/components/reveal.scss +2 -0
- package/app/styles/components/side-nav/content.scss +1 -7
- package/app/styles/components/side-nav/header.scss +1 -2
- package/app/styles/components/table.scss +4 -4
- package/app/styles/components/tabs.scss +1 -8
- package/app/styles/components/tooltip.scss +1 -0
- package/app/styles/mixins/_button.scss +7 -0
- package/package.json +24 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,70 @@
|
|
|
1
1
|
# @hashicorp/design-system-components
|
|
2
2
|
|
|
3
|
+
## 2.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1492](https://github.com/hashicorp/design-system/pull/1492) [`a17e5b2ac`](https://github.com/hashicorp/design-system/commit/a17e5b2acf66493ccbb68a623a3b7ba2fd5ab5a8) Thanks [@KristinLBradley](https://github.com/KristinLBradley)! - `Card` - Updated default value of `@overflow` argument to `"visible"` to address an area of consumer confusion and better support the most common use cases.
|
|
8
|
+
|
|
9
|
+
Technically, this is a breaking change as it will require consumers relying upon the previous `hidden` default value to now manually set the value. The result of not setting the a `"hidden"` value can cause square edges of some images to "stick out" and overlap the rounded corners of the Card itself. We considered this to be a fairly minor, low-impact issue however which would not affect functionality or usability.
|
|
10
|
+
|
|
11
|
+
- [#1452](https://github.com/hashicorp/design-system/pull/1452) [`c277d0366`](https://github.com/hashicorp/design-system/commit/c277d036673cf572c00ebf5b8b35b424c0b057fd) Thanks [@alex-ju](https://github.com/alex-ju)! - `Form::TextInput` - Add loading state on "search" type
|
|
12
|
+
|
|
13
|
+
- [#1468](https://github.com/hashicorp/design-system/pull/1468) [`b0a766ccf`](https://github.com/hashicorp/design-system/commit/b0a766ccf5357dd6f0e8dfb68d8c1ee823e76b50) Thanks [@alex-ju](https://github.com/alex-ju)! - Added `MaskedInput` component for forms
|
|
14
|
+
|
|
15
|
+
- [#1423](https://github.com/hashicorp/design-system/pull/1423) [`5ac340c8c`](https://github.com/hashicorp/design-system/commit/5ac340c8c3a3adab388704067578cf419e2e2f10) Thanks [@KristinLBradley](https://github.com/KristinLBradley)! - Add new `Accordion` component
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#1466](https://github.com/hashicorp/design-system/pull/1466) [`cdda7ae8e`](https://github.com/hashicorp/design-system/commit/cdda7ae8eaf553bd32ec9e3944edf08fe352caf4) Thanks [@alex-ju](https://github.com/alex-ju)! - `Hds::PageHeader` – Set position to 'relative'
|
|
20
|
+
|
|
21
|
+
- [#1470](https://github.com/hashicorp/design-system/pull/1470) [`0ea2ccfd0`](https://github.com/hashicorp/design-system/commit/0ea2ccfd0303149014de768c715ebb53dffe6c4c) Thanks [@alex-ju](https://github.com/alex-ju)! - `Hds::Textarea` – Fix border and text color for readonly state
|
|
22
|
+
|
|
23
|
+
- [#1456](https://github.com/hashicorp/design-system/pull/1456) [`b4237e73b`](https://github.com/hashicorp/design-system/commit/b4237e73b3701d94e92556ad0108b8a38bef312d) Thanks [@alex-ju](https://github.com/alex-ju)! - `Hds::Modal` – Prevent `onClose` callback function invocation when `isDismissDisabled` is `true`
|
|
24
|
+
|
|
25
|
+
- [#1469](https://github.com/hashicorp/design-system/pull/1469) [`ef98ed4ed`](https://github.com/hashicorp/design-system/commit/ef98ed4ed188520fd69a0090ab93d7d0c44e634c) Thanks [@didoo](https://github.com/didoo)! - Set the `font-weight` of the `button` mixin explicitly to `regular` instead of relying on inheritance (components using this mixin: `Button`, `Dropdown::ToggleButton` and soon `Accordion`) - No visual difference expected
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [[`b2ec25b39`](https://github.com/hashicorp/design-system/commit/b2ec25b399ba9aad5f8ae0b1f18a1bef9a6543e0)]:
|
|
28
|
+
- @hashicorp/design-system-tokens@1.6.0
|
|
29
|
+
- @hashicorp/ember-flight-icons@3.0.7
|
|
30
|
+
|
|
31
|
+
## 2.7.1
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- [#1438](https://github.com/hashicorp/design-system/pull/1438) [`ae852e7f8`](https://github.com/hashicorp/design-system/commit/ae852e7f83da72c62ee7791f89ac5c4a9e6bc7c6) Thanks [@didoo](https://github.com/didoo)! - `TooltipButton` - added `text-align: inherit` to the "button" element
|
|
36
|
+
|
|
37
|
+
- [#1444](https://github.com/hashicorp/design-system/pull/1444) [`5a4d036e1`](https://github.com/hashicorp/design-system/commit/5a4d036e1dd349dfde1b1f8e278d332fac7abe7e) Thanks [@MelSumner](https://github.com/MelSumner)! - Internal accessibility tweaks for dropdown component
|
|
38
|
+
|
|
39
|
+
- [#1395](https://github.com/hashicorp/design-system/pull/1395) [`e6e0c22c5`](https://github.com/hashicorp/design-system/commit/e6e0c22c538e381f4a97428dc35cf1295ce6ae21) Thanks [@alex-ju](https://github.com/alex-ju)! - Upgraded Ember.js to latest stable release 4.12, including upgrades to:
|
|
40
|
+
|
|
41
|
+
- `ember-auto-import` from `2.6.0` to `2.6.3`
|
|
42
|
+
- `ember-cli-htmlbars` from `6.1.0` to `6.2.0`
|
|
43
|
+
|
|
44
|
+
Upgraded the following dependencies:
|
|
45
|
+
|
|
46
|
+
- `ember-focus-trap` from `1.0.1` to `1.0.2`
|
|
47
|
+
- `ember-keyboard` from `8.1.0` to `8.2.0`
|
|
48
|
+
- `ember-truth-helpers` from `3.0.0` to `3.1.1`
|
|
49
|
+
- `sass` from `1.58.3` to `1.62.1`
|
|
50
|
+
|
|
51
|
+
Shifted our supported version of Node.js from `12.* || 14.* || >= 16` to `14.* || 16.* || >= 18`
|
|
52
|
+
|
|
53
|
+
- [#1425](https://github.com/hashicorp/design-system/pull/1425) [`921aa03b9`](https://github.com/hashicorp/design-system/commit/921aa03b95f56da21e794ee62ecc96019f5c4bb7) Thanks [@didoo](https://github.com/didoo)! - `Table` - Set `min-height` instead of `height` for the table head cells + Updated the cells' internal padding to align with the design specs in Figma
|
|
54
|
+
|
|
55
|
+
- [#1433](https://github.com/hashicorp/design-system/pull/1433) [`9aa5291d1`](https://github.com/hashicorp/design-system/commit/9aa5291d187bc867baf7c069c9dd17856cb5f79f) Thanks [@didoo](https://github.com/didoo)! - - Updated CSS code of components to use flex `gap`
|
|
56
|
+
|
|
57
|
+
- Fixed an issue with `Hds::Sidenav::Link` that was generating an empty node
|
|
58
|
+
|
|
59
|
+
This will lead to a minimal visual impact on some edge cases of `Alert/Toast` (multiple description items) and `SideNav` (text + generic content)
|
|
60
|
+
|
|
61
|
+
- [#1426](https://github.com/hashicorp/design-system/pull/1426) [`1f8886a2d`](https://github.com/hashicorp/design-system/commit/1f8886a2d5117d74a0dddd4bca4a09d9fcedc8da) Thanks [@MelSumner](https://github.com/MelSumner)! - Style tweaks to standalone link
|
|
62
|
+
|
|
63
|
+
- [#1434](https://github.com/hashicorp/design-system/pull/1434) [`eadefc4bd`](https://github.com/hashicorp/design-system/commit/eadefc4bdb4e5fd6c110a7be1d7d9aa720695678) Thanks [@alex-ju](https://github.com/alex-ju)! - Fix scroll management on `Modal` and `Flyout` resulting in stray `style` attribute on `<body>` element
|
|
64
|
+
|
|
65
|
+
- Updated dependencies [[`e6e0c22c5`](https://github.com/hashicorp/design-system/commit/e6e0c22c538e381f4a97428dc35cf1295ce6ae21)]:
|
|
66
|
+
- @hashicorp/ember-flight-icons@3.0.6
|
|
67
|
+
|
|
3
68
|
## 2.7.0
|
|
4
69
|
|
|
5
70
|
### Minor Changes
|
|
@@ -77,3 +77,24 @@ You can override every dependency declared in the engines' `package.json` files
|
|
|
77
77
|
Once done run `yarn install` to use the "remote" version of the package, update the `node_modules` and the `yarn.lock` file.
|
|
78
78
|
|
|
79
79
|
**IMPORTANT**: the way in which yarn works in this case is that it resolves in a hash referencing a commit in `yarn.lock`; so if you make changes to the branch, they’re not reflected in the local `node_modules` unless you change the hash manually in the `yarn.lock` to point to another commit, and re-run the `yarn install` command.
|
|
80
|
+
|
|
81
|
+
#### What to do if `yarn start ***` in Cloud UI complains about the different version number
|
|
82
|
+
|
|
83
|
+
There are cases in which the "start" command in Cloud UI will fail with an error similar to this:
|
|
84
|
+
```
|
|
85
|
+
Missing yarn packages:
|
|
86
|
+
Package: @hashicorp/design-system-components
|
|
87
|
+
* Specified: ^2.7.1
|
|
88
|
+
* Installed: 2.6.0
|
|
89
|
+
|
|
90
|
+
Run `yarn` to install missing dependencies.
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Running `yarn install` again will not solve the problem because the issue is with the version of the `@hashicorp/design-system-components` package declared in the `package.json` files in Cloud UI that differs from the one in the overriding package.
|
|
94
|
+
|
|
95
|
+
In this case you have two options:
|
|
96
|
+
|
|
97
|
+
- you can rebase your branch on `main` so that your branch uses the latest version of `@hashicorp/design-system-components` (which is likely the one used in Cloud UI too)
|
|
98
|
+
- if the one in Cloud UI is not the latest, you have to "trick" Cloud UI and replace the existing version with the one used in your branch (use a find & replace in all the `package.json` files)
|
|
99
|
+
|
|
100
|
+
With both options, you will have to re-run the `yarn install` command.
|
|
@@ -108,6 +108,7 @@ The engineering checklist has six parts: creating the feature branch, component
|
|
|
108
108
|
- [ ] try not to repeat tests (i.e., don't have to test all sizes, all colors, etc.)
|
|
109
109
|
- [ ] test all accessibility attributes
|
|
110
110
|
- [ ] test assertions
|
|
111
|
+
- [ ] run the accessibility automation tests (`yarn test:a11y --filter="COMPONENT-NAME"`)
|
|
111
112
|
- [ ] **documentation**
|
|
112
113
|
- create component page `ember generate route components/COMPONENT_NAME --dummy`
|
|
113
114
|
- add link to `templates/index.hbs` page
|
package/README.md
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<button
|
|
2
|
+
class={{this.classNames}}
|
|
3
|
+
type="button"
|
|
4
|
+
{{on "click" @onClickToggle}}
|
|
5
|
+
aria-controls={{@contentId}}
|
|
6
|
+
aria-expanded={{if @isOpen "true" "false"}}
|
|
7
|
+
aria-label={{@ariaLabel}}
|
|
8
|
+
...attributes
|
|
9
|
+
>
|
|
10
|
+
<FlightIcon @name="chevron-down" @size="24" @isInlineBlock={{false}} />
|
|
11
|
+
</button>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import Component from '@glimmer/component';
|
|
7
|
+
|
|
8
|
+
export default class HdsAccordionItemButtonComponent extends Component {
|
|
9
|
+
/**
|
|
10
|
+
* Get the class names to apply to the component.
|
|
11
|
+
* @method ItemButton#classNames
|
|
12
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
13
|
+
*/
|
|
14
|
+
get classNames() {
|
|
15
|
+
let classes = ['hds-accordion-item__button'];
|
|
16
|
+
|
|
17
|
+
// add a class based on the @isOpen argument
|
|
18
|
+
if (this.args.isOpen) {
|
|
19
|
+
classes.push('hds-accordion-item__button--is-open');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (this.args.parentContainsInteractive === false) {
|
|
23
|
+
classes.push(
|
|
24
|
+
'hds-accordion-item__button--parent-does-not-contain-interactive'
|
|
25
|
+
);
|
|
26
|
+
} else {
|
|
27
|
+
classes.push('hds-accordion-item__button--parent-contains-interactive');
|
|
28
|
+
}
|
|
29
|
+
return classes.join(' ');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<Hds::DisclosurePrimitive class={{this.classNames}} @isOpen={{@isOpen}} ...attributes>
|
|
2
|
+
<:toggle as |t|>
|
|
3
|
+
<div class="hds-accordion-item__toggle">
|
|
4
|
+
<Hds::Accordion::Item::Button
|
|
5
|
+
@isOpen={{t.isOpen}}
|
|
6
|
+
@onClickToggle={{t.onClickToggle}}
|
|
7
|
+
@contentId={{this.contentId}}
|
|
8
|
+
@ariaLabel={{this.ariaLabel}}
|
|
9
|
+
@parentContainsInteractive={{this.containsInteractive}}
|
|
10
|
+
/>
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
class="hds-accordion-item__toggle-content hds-typography-display-200 hds-foreground-strong hds-font-weight-semibold"
|
|
14
|
+
>
|
|
15
|
+
{{yield to="toggle"}}
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</:toggle>
|
|
19
|
+
|
|
20
|
+
<:content>
|
|
21
|
+
<div class="hds-accordion-item__content hds-typography-body-200 hds-foreground-primary" id={{this.contentId}}>
|
|
22
|
+
{{yield to="content"}}
|
|
23
|
+
</div>
|
|
24
|
+
</:content>
|
|
25
|
+
</Hds::DisclosurePrimitive>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import Component from '@glimmer/component';
|
|
7
|
+
import { guidFor } from '@ember/object/internals';
|
|
8
|
+
|
|
9
|
+
export default class HdsAccordionItemIndexComponent extends Component {
|
|
10
|
+
/**
|
|
11
|
+
* Generates a unique ID for the Content
|
|
12
|
+
*
|
|
13
|
+
* @param contentId
|
|
14
|
+
*/
|
|
15
|
+
contentId = 'content-' + guidFor(this);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param ariaLabel
|
|
19
|
+
* @type {string}
|
|
20
|
+
* @default 'Toggle display'
|
|
21
|
+
*/
|
|
22
|
+
get ariaLabel() {
|
|
23
|
+
return this.args.ariaLabel ?? 'Toggle display';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param containsInteractive
|
|
28
|
+
* @type {boolean}
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
get containsInteractive() {
|
|
32
|
+
return this.args.containsInteractive ?? false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get the class names to apply to the component.
|
|
37
|
+
* @method classNames
|
|
38
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
39
|
+
*/
|
|
40
|
+
get classNames() {
|
|
41
|
+
let classes = ['hds-accordion-item'];
|
|
42
|
+
|
|
43
|
+
// add a class based on the @isOpen argument
|
|
44
|
+
if (this.args.isOpen) {
|
|
45
|
+
classes.push('hds-accordion-item--is-open');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (this.containsInteractive) {
|
|
49
|
+
// Entire accordion item including the chevron is interactive:
|
|
50
|
+
classes.push('hds-accordion-item--contains-interactive');
|
|
51
|
+
} else {
|
|
52
|
+
// Only chevron is interactive:
|
|
53
|
+
classes.push('hds-accordion-item--does-not-contain-interactive');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return classes.join(' ');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
{{/if}}
|
|
18
18
|
|
|
19
19
|
<div class="hds-alert__content">
|
|
20
|
-
<div class="hds-alert__text">
|
|
20
|
+
<div class="hds-alert__text {{if (eq @type 'compact') 'hds-typography-body-100' 'hds-typography-body-200'}}">
|
|
21
21
|
{{yield (hash Title=(component "hds/alert/title"))}}
|
|
22
22
|
{{yield (hash Description=(component "hds/alert/description"))}}
|
|
23
23
|
</div>
|
|
@@ -8,7 +8,7 @@ import { assert } from '@ember/debug';
|
|
|
8
8
|
|
|
9
9
|
export const DEFAULT_LEVEL = 'base';
|
|
10
10
|
export const DEFAULT_BACKGROUND = 'neutral-primary';
|
|
11
|
-
export const DEFAULT_OVERFLOW = '
|
|
11
|
+
export const DEFAULT_OVERFLOW = 'visible';
|
|
12
12
|
export const LEVELS = ['base', 'mid', 'high'];
|
|
13
13
|
export const BACKGROUNDS = ['neutral-primary', 'neutral-secondary'];
|
|
14
14
|
export const OVERFLOWS = ['hidden', 'visible'];
|
|
@@ -106,7 +106,7 @@ export default class HdsCardContainerComponent extends Component {
|
|
|
106
106
|
*
|
|
107
107
|
* @param overflow
|
|
108
108
|
* @type {string}
|
|
109
|
-
* @default '
|
|
109
|
+
* @default 'visible'
|
|
110
110
|
*/
|
|
111
111
|
get overflow() {
|
|
112
112
|
let { overflow = DEFAULT_OVERFLOW } = this.args;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
SPDX-License-Identifier: MPL-2.0
|
|
4
4
|
}}
|
|
5
5
|
|
|
6
|
-
{{! template-lint-disable require-context-role require-presentational-children }}
|
|
7
|
-
<li class={{this.classNames}}>
|
|
6
|
+
{{! template-lint-disable no-invalid-role require-context-role require-presentational-children }}
|
|
7
|
+
<li class={{this.classNames}} role="none">
|
|
8
8
|
<Hds::Interactive
|
|
9
9
|
@current-when={{@current-when}}
|
|
10
10
|
@models={{hds-link-to-models @model @models}}
|
|
@@ -37,4 +37,4 @@
|
|
|
37
37
|
</span>
|
|
38
38
|
</Hds::Interactive>
|
|
39
39
|
</li>
|
|
40
|
-
{{! template-lint-enable require-context-role require-presentational-children }}
|
|
40
|
+
{{! template-lint-enable no-invalid-role require-context-role require-presentational-children }}
|
|
@@ -2,4 +2,9 @@
|
|
|
2
2
|
Copyright (c) HashiCorp, Inc.
|
|
3
3
|
SPDX-License-Identifier: MPL-2.0
|
|
4
4
|
}}
|
|
5
|
-
<li
|
|
5
|
+
<li
|
|
6
|
+
class="hds-dropdown-list-item hds-dropdown-list-item--variant-separator"
|
|
7
|
+
aria-hidden="true"
|
|
8
|
+
role="separator"
|
|
9
|
+
...attributes
|
|
10
|
+
></li>
|
|
@@ -121,7 +121,14 @@ export default class HdsFlyoutIndexComponent extends Component {
|
|
|
121
121
|
|
|
122
122
|
// Reset page `overflow` property
|
|
123
123
|
if (this.body) {
|
|
124
|
-
this.body.style.
|
|
124
|
+
this.body.style.removeProperty('overflow');
|
|
125
|
+
if (this.bodyInitialOverflowValue === '') {
|
|
126
|
+
if (this.body.style.length === 0) {
|
|
127
|
+
this.body.removeAttribute('style');
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
this.body.style.setProperty('overflow', this.bodyInitialOverflowValue);
|
|
131
|
+
}
|
|
125
132
|
}
|
|
126
133
|
}
|
|
127
134
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{{!
|
|
2
|
+
Copyright (c) HashiCorp, Inc.
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
}}
|
|
5
|
+
<div class={{this.classNames}} {{style width=@width}}>
|
|
6
|
+
{{#if @isMultiline}}
|
|
7
|
+
<Hds::Form::Textarea::Base
|
|
8
|
+
class="hds-form-masked-input__control"
|
|
9
|
+
@value={{@value}}
|
|
10
|
+
@isInvalid={{@isInvalid}}
|
|
11
|
+
@height={{@height}}
|
|
12
|
+
id={{this.id}}
|
|
13
|
+
...attributes
|
|
14
|
+
/>
|
|
15
|
+
{{else}}
|
|
16
|
+
<Hds::Form::TextInput::Base
|
|
17
|
+
class="hds-form-masked-input__control"
|
|
18
|
+
@value={{@value}}
|
|
19
|
+
@isInvalid={{@isInvalid}}
|
|
20
|
+
id={{this.id}}
|
|
21
|
+
...attributes
|
|
22
|
+
/>
|
|
23
|
+
{{/if}}
|
|
24
|
+
<button
|
|
25
|
+
class="hds-form-masked-input__toggle-button"
|
|
26
|
+
type="button"
|
|
27
|
+
aria-label={{this.ariaLabel}}
|
|
28
|
+
aria-controls={{this.id}}
|
|
29
|
+
{{on "click" this.onClickToggle}}
|
|
30
|
+
>
|
|
31
|
+
<FlightIcon @name={{if this.isMasked "eye" "eye-off"}} @size="16" @isInlineBlock={{false}} />
|
|
32
|
+
<span class="sr-only" aria-live="polite">{{this.ariaMessageText}}</span>
|
|
33
|
+
</button>
|
|
34
|
+
</div>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import Component from '@glimmer/component';
|
|
7
|
+
import { tracked } from '@glimmer/tracking';
|
|
8
|
+
import { action } from '@ember/object';
|
|
9
|
+
import { getElementId } from '@hashicorp/design-system-components/utils/hds-get-element-id';
|
|
10
|
+
|
|
11
|
+
export default class HdsFormMaskedInputBaseComponent extends Component {
|
|
12
|
+
@tracked isMasked = this.args.isMasked ?? true;
|
|
13
|
+
|
|
14
|
+
@action
|
|
15
|
+
onClickToggle() {
|
|
16
|
+
this.isMasked = !this.isMasked;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Calculates the unique ID to assign to the form control
|
|
21
|
+
*/
|
|
22
|
+
get id() {
|
|
23
|
+
return getElementId(this);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param ariaLabel
|
|
28
|
+
* @type {string}
|
|
29
|
+
* @default 'Show masked content'
|
|
30
|
+
*/
|
|
31
|
+
get ariaLabel() {
|
|
32
|
+
if (this.args.ariaLabel) {
|
|
33
|
+
return this.args.ariaLabel;
|
|
34
|
+
} else if (this.isMasked) {
|
|
35
|
+
return 'Show masked content';
|
|
36
|
+
} else {
|
|
37
|
+
return 'Hide masked content';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @param ariaMessageText
|
|
43
|
+
* @type {string}
|
|
44
|
+
* @default ''
|
|
45
|
+
*/
|
|
46
|
+
get ariaMessageText() {
|
|
47
|
+
if (this.args.ariaMessageText) {
|
|
48
|
+
return this.args.ariaMessageText;
|
|
49
|
+
} else if (this.isMasked) {
|
|
50
|
+
return 'Input content is now hidden';
|
|
51
|
+
} else {
|
|
52
|
+
return 'Input content is now visible';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get the class names to apply to the component.
|
|
58
|
+
* @method classNames
|
|
59
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
60
|
+
*/
|
|
61
|
+
get classNames() {
|
|
62
|
+
let classes = ['hds-form-masked-input'];
|
|
63
|
+
|
|
64
|
+
if (this.isMasked) {
|
|
65
|
+
classes.push(`hds-form-masked-input--is-masked`);
|
|
66
|
+
} else {
|
|
67
|
+
classes.push(`hds-form-masked-input--is-not-masked`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return classes.join(' ');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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::MaskedInput::Base
|
|
18
|
+
@isMultiline={{@isMultiline}}
|
|
19
|
+
@isMasked={{@isMasked}}
|
|
20
|
+
@value={{@value}}
|
|
21
|
+
@isInvalid={{@isInvalid}}
|
|
22
|
+
@width={{@width}}
|
|
23
|
+
@height={{@height}}
|
|
24
|
+
@id={{F.id}}
|
|
25
|
+
required={{@isRequired}}
|
|
26
|
+
...attributes
|
|
27
|
+
aria-describedby={{F.ariaDescribedBy}}
|
|
28
|
+
/>
|
|
29
|
+
</F.Control>
|
|
30
|
+
</Hds::Form::Field>
|
|
@@ -14,9 +14,9 @@ export const TYPES = [
|
|
|
14
14
|
'email',
|
|
15
15
|
'password',
|
|
16
16
|
'url',
|
|
17
|
-
'search',
|
|
18
17
|
'date',
|
|
19
18
|
'time',
|
|
19
|
+
'search',
|
|
20
20
|
];
|
|
21
21
|
|
|
22
22
|
export default class HdsFormTextInputBaseComponent extends Component {
|
|
@@ -56,6 +56,11 @@ export default class HdsFormTextInputBaseComponent extends Component {
|
|
|
56
56
|
classes.push(`hds-form-text-input--is-invalid`);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
// add a class based on the @isLoading argument
|
|
60
|
+
if (this.args.isLoading) {
|
|
61
|
+
classes.push(`hds-form-text-input--is-loading`);
|
|
62
|
+
}
|
|
63
|
+
|
|
59
64
|
return classes.join(' ');
|
|
60
65
|
}
|
|
61
66
|
}
|
|
@@ -112,7 +112,11 @@ export default class HdsModalIndexComponent extends Component {
|
|
|
112
112
|
|
|
113
113
|
// Register "onClose" callback function to be called when a native 'close' event is dispatched
|
|
114
114
|
this.element.addEventListener('close', () => {
|
|
115
|
-
if (
|
|
115
|
+
if (
|
|
116
|
+
!this.isDismissDisabled &&
|
|
117
|
+
this.args.onClose &&
|
|
118
|
+
typeof this.args.onClose === 'function'
|
|
119
|
+
) {
|
|
116
120
|
this.args.onClose();
|
|
117
121
|
}
|
|
118
122
|
|
|
@@ -158,7 +162,14 @@ export default class HdsModalIndexComponent extends Component {
|
|
|
158
162
|
|
|
159
163
|
// Reset page `overflow` property
|
|
160
164
|
if (this.body) {
|
|
161
|
-
this.body.style.
|
|
165
|
+
this.body.style.removeProperty('overflow');
|
|
166
|
+
if (this.bodyInitialOverflowValue === '') {
|
|
167
|
+
if (this.body.style.length === 0) {
|
|
168
|
+
this.body.removeAttribute('style');
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
this.body.style.setProperty('overflow', this.bodyInitialOverflowValue);
|
|
172
|
+
}
|
|
162
173
|
}
|
|
163
174
|
}
|
|
164
175
|
}
|
|
@@ -20,9 +20,11 @@
|
|
|
20
20
|
<FlightIcon class="hds-side-nav__list-item-icon-leading" @name={{@icon}} />
|
|
21
21
|
{{/if}}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
{{#if @text}}
|
|
24
|
+
<span class="hds-side-nav__list-item-text hds-typography-body-200 hds-font-weight-medium">
|
|
25
|
+
{{@text}}
|
|
26
|
+
</span>
|
|
27
|
+
{{/if}}
|
|
26
28
|
|
|
27
29
|
{{#if @count}}
|
|
28
30
|
<Hds::BadgeCount @text={{@count}} @type="inverted" @size="small" />
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
// Notice: this list can be automatically edited by the Ember blueprint, please don't remove the start/end comments
|
|
14
14
|
// START COMPONENTS CSS FILES IMPORTS
|
|
15
|
+
@use "../components/accordion";
|
|
15
16
|
@use "../components/alert";
|
|
16
17
|
@use "../components/app-frame";
|
|
17
18
|
@use "../components/application-state";
|