@hashicorp/design-system-components 2.12.2 → 2.14.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 +29 -0
- package/addon/components/hds/app-footer/copyright.hbs +9 -0
- package/addon/components/hds/app-footer/copyright.js +18 -0
- package/addon/components/hds/app-footer/index.hbs +20 -0
- package/addon/components/hds/app-footer/index.js +41 -0
- package/addon/components/hds/app-footer/item.hbs +8 -0
- package/addon/components/hds/app-footer/legal-links.hbs +14 -0
- package/addon/components/hds/app-footer/legal-links.js +66 -0
- package/addon/components/hds/app-footer/link.hbs +22 -0
- package/addon/components/hds/app-footer/status-link.hbs +20 -0
- package/addon/components/hds/app-footer/status-link.js +133 -0
- package/addon/components/hds/pagination/compact/index.hbs +9 -0
- package/addon/components/hds/pagination/compact/index.js +23 -0
- package/addon/components/hds/side-nav/index.hbs +5 -8
- package/addon/components/hds/side-nav/index.js +22 -11
- package/addon/components/hds/side-nav/toggle-button.hbs +7 -0
- package/addon/components/hds/tabs/index.hbs +7 -2
- package/addon/components/hds/tabs/index.js +101 -46
- package/addon/components/hds/tabs/panel.hbs +3 -3
- package/addon/components/hds/tabs/panel.js +18 -11
- package/addon/components/hds/tabs/tab.hbs +2 -2
- package/addon/components/hds/tabs/tab.js +23 -25
- package/app/components/hds/app-footer/copyright.js +6 -0
- package/app/components/hds/app-footer/index.js +6 -0
- package/app/components/hds/app-footer/item.js +6 -0
- package/app/components/hds/app-footer/legal-links.js +6 -0
- package/app/components/hds/app-footer/link.js +6 -0
- package/app/components/hds/app-footer/status-link.js +6 -0
- package/app/components/hds/side-nav/toggle-button.js +6 -0
- package/app/styles/@hashicorp/design-system-components.scss +1 -0
- package/app/styles/components/app-footer.scss +154 -0
- package/app/styles/components/link/standalone.scss +3 -1
- package/app/styles/components/side-nav/header.scss +10 -0
- package/app/styles/components/side-nav/index.scss +1 -0
- package/app/styles/components/side-nav/main.scss +21 -72
- package/app/styles/components/side-nav/toggle-button.scss +106 -0
- package/app/styles/components/side-nav/vars.scss +2 -4
- package/app/styles/components/tag.scss +1 -1
- package/blueprints/hds-component-test/files/tests/acceptance/components/hds/__name__.js +21 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @hashicorp/design-system-components
|
|
2
2
|
|
|
3
|
+
## 2.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1700](https://github.com/hashicorp/design-system/pull/1700) [`33d760fb8`](https://github.com/hashicorp/design-system/commit/33d760fb88d3945be8b50302a9bb7dce3ae221fe) Thanks [@didoo](https://github.com/didoo)! - `Pagination::Compact` - Added option to show "SizeSelector" element
|
|
8
|
+
|
|
9
|
+
- [#1688](https://github.com/hashicorp/design-system/pull/1688) [`c842b6eb7`](https://github.com/hashicorp/design-system/commit/c842b6eb731d82146b0e1ad8b9f55930b58aba18) Thanks [@didoo](https://github.com/didoo)! - `Tabs` - Refactored logic for `Tabs` component + `Tab/Panel` sub-components to support more complex use cases:
|
|
10
|
+
|
|
11
|
+
- introduced `@selectedTabIndex` argument to control the "selected" tab from the consuming application, e.g. via query params (effort spearheaded by @MiniHeyd)
|
|
12
|
+
- fixed issue with nested tabs not initializing the "selected" indicator correctly
|
|
13
|
+
- fixed issue with dynamic tab content not updating the "selected" indicator correctly
|
|
14
|
+
|
|
15
|
+
## 2.13.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#1623](https://github.com/hashicorp/design-system/pull/1623) [`2111a5439`](https://github.com/hashicorp/design-system/commit/2111a5439abea2951f12517354db662edd7c9cb9) Thanks [@KristinLBradley](https://github.com/KristinLBradley)! - `AppFooter` - Added new component
|
|
20
|
+
|
|
21
|
+
- [#1630](https://github.com/hashicorp/design-system/pull/1630) [`04da95443`](https://github.com/hashicorp/design-system/commit/04da95443290ee2d03d9bef23787a4ef10577247) Thanks [@alex-ju](https://github.com/alex-ju)! - `SideNav` - add `@isCollapsible` (to control if users can collapse the sidenav on 'desktop' viewports) and `@isMinimized` (to control the default state on 'desktop' viewports) arguments
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [#1696](https://github.com/hashicorp/design-system/pull/1696) [`f3f3fb103`](https://github.com/hashicorp/design-system/commit/f3f3fb103a5aa1c6489d011b6820560df4c2ed88) Thanks [@MelSumner](https://github.com/MelSumner)! - `Tag` - Updated padding for dismiss button for WCAG conformance
|
|
26
|
+
|
|
27
|
+
- [#1678](https://github.com/hashicorp/design-system/pull/1678) [`a51976ded`](https://github.com/hashicorp/design-system/commit/a51976ded4f7939fe140a1abade0f98832ccc2d0) Thanks [@alex-ju](https://github.com/alex-ju)! - `Link::Standalone` – increase target size
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [[`04da95443`](https://github.com/hashicorp/design-system/commit/04da95443290ee2d03d9bef23787a4ef10577247)]:
|
|
30
|
+
- @hashicorp/design-system-tokens@1.9.0
|
|
31
|
+
|
|
3
32
|
## 2.12.2
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{{!
|
|
2
|
+
Copyright (c) HashiCorp, Inc.
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
}}
|
|
5
|
+
|
|
6
|
+
<div class="hds-app-footer__copyright" ...attributes>
|
|
7
|
+
<FlightIcon @name="hashicorp" />
|
|
8
|
+
<Hds::Text::Body @tag="span" @size="100">© {{this.year}} HashiCorp</Hds::Text::Body>
|
|
9
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
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 HdsAppFooterCopyrightComponent extends Component {
|
|
9
|
+
/**
|
|
10
|
+
* @param year
|
|
11
|
+
* @type {string}
|
|
12
|
+
* @description The copyright year
|
|
13
|
+
* @default The current year (calculated via `Date()`)
|
|
14
|
+
*/
|
|
15
|
+
get year() {
|
|
16
|
+
return this.args.year ?? new Date().getFullYear();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{{!
|
|
2
|
+
Copyright (c) HashiCorp, Inc.
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
}}
|
|
5
|
+
|
|
6
|
+
<div class={{this.classNames}} ...attributes>
|
|
7
|
+
{{yield (hash ExtraBefore=(component "hds/yield"))}}
|
|
8
|
+
<ul class="hds-app-footer__list" aria-label={{this.ariaLabel}}>
|
|
9
|
+
{{yield (hash StatusLink=(component "hds/app-footer/status-link"))}}
|
|
10
|
+
{{yield
|
|
11
|
+
(hash
|
|
12
|
+
Link=(component "hds/app-footer/link")
|
|
13
|
+
LegalLinks=(component "hds/app-footer/legal-links")
|
|
14
|
+
Item=(component "hds/app-footer/item")
|
|
15
|
+
)
|
|
16
|
+
}}
|
|
17
|
+
</ul>
|
|
18
|
+
{{yield (hash ExtraAfter=(component "hds/yield"))}}
|
|
19
|
+
<Hds::AppFooter::Copyright @year={{@copyrightYear}} />
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,41 @@
|
|
|
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 HdsAppFooterIndexComponent extends Component {
|
|
9
|
+
/**
|
|
10
|
+
* @param ariaLabel
|
|
11
|
+
* @type {string}
|
|
12
|
+
* @default 'Footer items'
|
|
13
|
+
*/
|
|
14
|
+
get ariaLabel() {
|
|
15
|
+
return this.args.ariaLabel ?? 'Footer items';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param theme
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @description The component theme
|
|
22
|
+
* @default 'light'
|
|
23
|
+
*/
|
|
24
|
+
get theme() {
|
|
25
|
+
return this.args.theme ?? 'light';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get the class names to apply to the component.
|
|
30
|
+
* @method classNames
|
|
31
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
32
|
+
*/
|
|
33
|
+
get classNames() {
|
|
34
|
+
let classes = ['hds-app-footer'];
|
|
35
|
+
|
|
36
|
+
// add a class based on the @theme argument
|
|
37
|
+
classes.push(`hds-app-footer--theme-${this.theme}`);
|
|
38
|
+
|
|
39
|
+
return classes.join(' ');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{{!
|
|
2
|
+
Copyright (c) HashiCorp, Inc.
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
}}
|
|
5
|
+
|
|
6
|
+
<Hds::AppFooter::Item>
|
|
7
|
+
<ul class="hds-app-footer__legal-links" aria-label={{this.ariaLabel}} ...attributes>
|
|
8
|
+
<Hds::AppFooter::Link @href={{this.hrefForSupport}}>Support</Hds::AppFooter::Link>
|
|
9
|
+
<Hds::AppFooter::Link @href={{this.hrefForTerms}}>Terms</Hds::AppFooter::Link>
|
|
10
|
+
<Hds::AppFooter::Link @href={{this.hrefForPrivacy}}>Privacy</Hds::AppFooter::Link>
|
|
11
|
+
<Hds::AppFooter::Link @href={{this.hrefForSecurity}}>Security</Hds::AppFooter::Link>
|
|
12
|
+
<Hds::AppFooter::Link @href={{this.hrefForAccessibility}}>Accessibility</Hds::AppFooter::Link>
|
|
13
|
+
</ul>
|
|
14
|
+
</Hds::AppFooter::Item>
|
|
@@ -0,0 +1,66 @@
|
|
|
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 HdsAppFooterLegalLinksComponent extends Component {
|
|
9
|
+
/**
|
|
10
|
+
* @param ariaLabel
|
|
11
|
+
* @type {string}
|
|
12
|
+
* @default 'Legal links'
|
|
13
|
+
*/
|
|
14
|
+
get ariaLabel() {
|
|
15
|
+
return this.args.ariaLabel ?? 'Legal links';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param hrefForSupport
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @description The href value of the "Support" link
|
|
22
|
+
*/
|
|
23
|
+
get hrefForSupport() {
|
|
24
|
+
return this.args.hrefForSupport ?? 'https://www.hashicorp.com/support';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @param hrefForTerms
|
|
29
|
+
* @type {string}
|
|
30
|
+
* @description The href value of the "Terms" link
|
|
31
|
+
*/
|
|
32
|
+
get hrefForTerms() {
|
|
33
|
+
return (
|
|
34
|
+
this.args.hrefForTerms ?? 'https://www.hashicorp.com/terms-of-service'
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param hrefForPrivacy
|
|
40
|
+
* @type {string}
|
|
41
|
+
* @description The href value of the "Privacy" link
|
|
42
|
+
*/
|
|
43
|
+
get hrefForPrivacy() {
|
|
44
|
+
return this.args.hrefForPrivacy ?? 'https://www.hashicorp.com/privacy';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param hrefForSecurity
|
|
49
|
+
* @type {string}
|
|
50
|
+
* @description The href value of the "Security" link
|
|
51
|
+
*/
|
|
52
|
+
get hrefForSecurity() {
|
|
53
|
+
return this.args.hrefForSecurity ?? 'https://www.hashicorp.com/security';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @param hrefForAccessibility
|
|
58
|
+
* @type {string}
|
|
59
|
+
* @description The href value of the "Accessibility" link
|
|
60
|
+
*/
|
|
61
|
+
get hrefForAccessibility() {
|
|
62
|
+
return (
|
|
63
|
+
this.args.hrefForAccessibility ?? 'mailto:accessibility@hashicorp.com'
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{{!
|
|
2
|
+
Copyright (c) HashiCorp, Inc.
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
}}
|
|
5
|
+
|
|
6
|
+
<Hds::AppFooter::Item>
|
|
7
|
+
<Hds::Link::Inline
|
|
8
|
+
class="hds-app-footer__link"
|
|
9
|
+
@color="secondary"
|
|
10
|
+
@current-when={{@current-when}}
|
|
11
|
+
@models={{hds-link-to-models @model @models}}
|
|
12
|
+
@query={{hds-link-to-query @query}}
|
|
13
|
+
@replace={{@replace}}
|
|
14
|
+
@route={{@route}}
|
|
15
|
+
@isRouteExternal={{@isRouteExternal}}
|
|
16
|
+
@href={{@href}}
|
|
17
|
+
@isHrefExternal={{@isHrefExternal}}
|
|
18
|
+
@icon={{@icon}}
|
|
19
|
+
@iconPosition={{@iconPosition}}
|
|
20
|
+
...attributes
|
|
21
|
+
><Hds::Text::Body @tag="span" @size="100">{{yield}}</Hds::Text::Body></Hds::Link::Inline>
|
|
22
|
+
</Hds::AppFooter::Item>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{{!
|
|
2
|
+
Copyright (c) HashiCorp, Inc.
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
}}
|
|
5
|
+
|
|
6
|
+
<Hds::AppFooter::Link
|
|
7
|
+
class={{this.classNames}}
|
|
8
|
+
style={{this.itemStyle}}
|
|
9
|
+
@current-when={{@current-when}}
|
|
10
|
+
@models={{hds-link-to-models @model @models}}
|
|
11
|
+
@query={{hds-link-to-query @query}}
|
|
12
|
+
@replace={{@replace}}
|
|
13
|
+
@route={{@route}}
|
|
14
|
+
@isRouteExternal={{@isRouteExternal}}
|
|
15
|
+
@href={{this.href}}
|
|
16
|
+
@isHrefExternal={{@isHrefExternal}}
|
|
17
|
+
@icon={{this.statusIcon}}
|
|
18
|
+
@iconPosition="leading"
|
|
19
|
+
...attributes
|
|
20
|
+
>{{this.text}}</Hds::AppFooter::Link>
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import Component from '@glimmer/component';
|
|
7
|
+
import { htmlSafe } from '@ember/template';
|
|
8
|
+
import { assert } from '@ember/debug';
|
|
9
|
+
|
|
10
|
+
export const STATUSES = {
|
|
11
|
+
operational: {
|
|
12
|
+
text: 'System operational',
|
|
13
|
+
iconName: 'check-circle',
|
|
14
|
+
},
|
|
15
|
+
degraded: {
|
|
16
|
+
text: 'System degraded',
|
|
17
|
+
iconName: 'alert-triangle',
|
|
18
|
+
},
|
|
19
|
+
maintenance: {
|
|
20
|
+
text: 'System maintenance',
|
|
21
|
+
iconName: 'alert-triangle',
|
|
22
|
+
},
|
|
23
|
+
critical: {
|
|
24
|
+
text: 'System critical',
|
|
25
|
+
iconName: 'x-circle',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default class HdsAppFooterStatusLinkComponent extends Component {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
|
|
33
|
+
assert(
|
|
34
|
+
'Either @status or @text for "Hds::AppFooter::StatusLink" must have a valid value',
|
|
35
|
+
this.args.text !== undefined || this.args.status
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param status
|
|
41
|
+
* @type {string}
|
|
42
|
+
* @description The name of the status which the StatusLink is being set to
|
|
43
|
+
*/
|
|
44
|
+
get status() {
|
|
45
|
+
let status;
|
|
46
|
+
if (this.args.status) {
|
|
47
|
+
status = this.args.status.toLowerCase();
|
|
48
|
+
assert(
|
|
49
|
+
`@status for "Hds::AppFooter" must be one of the following: ${Object.keys(
|
|
50
|
+
STATUSES
|
|
51
|
+
).join(', ')} received: ${this.args.status}`,
|
|
52
|
+
Object.keys(STATUSES).includes(status)
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return status;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @param statusIcon
|
|
60
|
+
* @type {string}
|
|
61
|
+
* @description The name for the StatusLink icon
|
|
62
|
+
*/
|
|
63
|
+
get statusIcon() {
|
|
64
|
+
if (this.status && !this.args.statusIcon) {
|
|
65
|
+
return STATUSES[this.status].iconName;
|
|
66
|
+
}
|
|
67
|
+
return this.args.statusIcon;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param statusIconColor
|
|
72
|
+
* @type {string}
|
|
73
|
+
* @description The color for the StatusLink icon
|
|
74
|
+
*/
|
|
75
|
+
get statusIconColor() {
|
|
76
|
+
if (this.status && !this.args.statusIconColor) {
|
|
77
|
+
return STATUSES[this.status].iconColor;
|
|
78
|
+
}
|
|
79
|
+
return this.args.statusIconColor;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Get the inline style to apply to the item.
|
|
84
|
+
* @method StatusLink#itemStyle
|
|
85
|
+
* @return {string} The "style" attribute to apply to the item.
|
|
86
|
+
*/
|
|
87
|
+
get itemStyle() {
|
|
88
|
+
if (this.args.statusIconColor) {
|
|
89
|
+
return htmlSafe(
|
|
90
|
+
`--hds-app-footer-status-icon-color: ${this.args.statusIconColor}`
|
|
91
|
+
);
|
|
92
|
+
} else {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @param text
|
|
99
|
+
* @type {string}
|
|
100
|
+
* @description The text content of the StatusLink
|
|
101
|
+
*/
|
|
102
|
+
get text() {
|
|
103
|
+
if (!this.args.text) {
|
|
104
|
+
return STATUSES[this.status].text;
|
|
105
|
+
}
|
|
106
|
+
return this.args.text;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @param href
|
|
111
|
+
* @type {string}
|
|
112
|
+
* @description The href value of the StatusLink
|
|
113
|
+
*/
|
|
114
|
+
get href() {
|
|
115
|
+
return this.args.href ?? 'https://status.hashicorp.com';
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Get the class names to apply to the component.
|
|
120
|
+
* @method classNames
|
|
121
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
122
|
+
*/
|
|
123
|
+
get classNames() {
|
|
124
|
+
let classes = ['hds-app-footer__status-link'];
|
|
125
|
+
|
|
126
|
+
// add a class based on the @status argument
|
|
127
|
+
if (this.args.status) {
|
|
128
|
+
classes.push(`hds-app-footer__status-link--${this.status}`);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return classes.join(' ');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -27,4 +27,13 @@
|
|
|
27
27
|
@disabled={{@isDisabledNext}}
|
|
28
28
|
/>
|
|
29
29
|
</nav>
|
|
30
|
+
|
|
31
|
+
{{#if this.showSizeSelector}}
|
|
32
|
+
<Hds::Pagination::SizeSelector
|
|
33
|
+
@pageSizes={{this.pageSizes}}
|
|
34
|
+
@label={{@sizeSelectorLabel}}
|
|
35
|
+
@selectedSize={{this.currentPageSize}}
|
|
36
|
+
@onChange={{this.onPageSizeChange}}
|
|
37
|
+
/>
|
|
38
|
+
{{/if}}
|
|
30
39
|
</div>
|
|
@@ -8,9 +8,15 @@ import { action } from '@ember/object';
|
|
|
8
8
|
import { assert } from '@ember/debug';
|
|
9
9
|
import { inject as service } from '@ember/service';
|
|
10
10
|
|
|
11
|
+
// for context about the decision to use these values, see:
|
|
12
|
+
// https://hashicorp.slack.com/archives/C03A0N1QK8S/p1673546329082759
|
|
13
|
+
export const DEFAULT_PAGE_SIZES = [10, 30, 50];
|
|
14
|
+
|
|
11
15
|
export default class HdsPaginationCompactIndexComponent extends Component {
|
|
12
16
|
@service router;
|
|
13
17
|
|
|
18
|
+
showSizeSelector = this.args.showSizeSelector ?? false; // if the "size selector" block is visible
|
|
19
|
+
|
|
14
20
|
constructor() {
|
|
15
21
|
super(...arguments);
|
|
16
22
|
|
|
@@ -56,6 +62,23 @@ export default class HdsPaginationCompactIndexComponent extends Component {
|
|
|
56
62
|
return this.args.ariaLabel ?? 'Pagination';
|
|
57
63
|
}
|
|
58
64
|
|
|
65
|
+
/**
|
|
66
|
+
* @param pageSizes
|
|
67
|
+
* @type {array of numbers}
|
|
68
|
+
* @description Set the page sizes users can select from.
|
|
69
|
+
* @default [10, 30, 50]
|
|
70
|
+
*/
|
|
71
|
+
get pageSizes() {
|
|
72
|
+
let { pageSizes = DEFAULT_PAGE_SIZES } = this.args;
|
|
73
|
+
|
|
74
|
+
assert(
|
|
75
|
+
`pageSizes argument must be an array. Received: ${pageSizes}`,
|
|
76
|
+
Array.isArray(pageSizes) === true
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
return pageSizes;
|
|
80
|
+
}
|
|
81
|
+
|
|
59
82
|
get routeQueryParams() {
|
|
60
83
|
return this.router.currentRoute?.queryParams || {};
|
|
61
84
|
}
|
|
@@ -19,18 +19,15 @@
|
|
|
19
19
|
@navigationText={{@a11yRefocusNavigationText}}
|
|
20
20
|
/>
|
|
21
21
|
{{/if}}
|
|
22
|
-
{{#if this.
|
|
22
|
+
{{#if this.showToggleButton}}
|
|
23
23
|
{{! template-lint-disable no-invalid-interactive}}
|
|
24
24
|
<div class="hds-side-nav__overlay" {{on "click" this.toggleMinimizedStatus}} />
|
|
25
25
|
{{! template-lint-enable no-invalid-interactive}}
|
|
26
|
-
<
|
|
27
|
-
class="hds-side-nav__menu-toggle-button"
|
|
28
|
-
type="button"
|
|
29
|
-
{{on "click" this.toggleMinimizedStatus}}
|
|
26
|
+
<Hds::SideNav::ToggleButton
|
|
30
27
|
aria-label={{this.ariaLabel}}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
@icon={{if this.isMinimized "chevrons-right" "chevrons-left"}}
|
|
29
|
+
{{on "click" this.toggleMinimizedStatus}}
|
|
30
|
+
/>
|
|
34
31
|
{{/if}}
|
|
35
32
|
</:root>
|
|
36
33
|
<:header as |Header|>
|
|
@@ -10,8 +10,9 @@ import { assert } from '@ember/debug';
|
|
|
10
10
|
import { registerDestructor } from '@ember/destroyable';
|
|
11
11
|
|
|
12
12
|
export default class HdsSideNavComponent extends Component {
|
|
13
|
-
@tracked isResponsive = this.args.isResponsive ?? true;
|
|
14
|
-
@tracked isMinimized = this.
|
|
13
|
+
@tracked isResponsive = this.args.isResponsive ?? true; // controls if the component reacts to viewport changes
|
|
14
|
+
@tracked isMinimized = this.args.isMinimized ?? false; // sets the default state on 'desktop' viewports
|
|
15
|
+
@tracked isCollapsible = this.args.isCollapsible ?? false; // controls if users can collapse the sidenav on 'desktop' viewports
|
|
15
16
|
@tracked isAnimating = false;
|
|
16
17
|
@tracked isDesktop = true;
|
|
17
18
|
hasA11yRefocus = this.args.hasA11yRefocus ?? true;
|
|
@@ -39,8 +40,11 @@ export default class HdsSideNavComponent extends Component {
|
|
|
39
40
|
addEventListeners() {
|
|
40
41
|
document.addEventListener('keydown', this.escapePress, true);
|
|
41
42
|
this.desktopMQ.addEventListener('change', this.updateDesktopVariable, true);
|
|
42
|
-
//
|
|
43
|
-
|
|
43
|
+
// if not instantiated as minimized via arguments
|
|
44
|
+
if (!this.args.isMinimized) {
|
|
45
|
+
// set initial state based on viewport
|
|
46
|
+
this.updateDesktopVariable({ matches: this.desktopMQ.matches });
|
|
47
|
+
}
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
removeEventListeners() {
|
|
@@ -56,6 +60,10 @@ export default class HdsSideNavComponent extends Component {
|
|
|
56
60
|
return this.isResponsive && !this.isDesktop && !this.isMinimized;
|
|
57
61
|
}
|
|
58
62
|
|
|
63
|
+
get showToggleButton() {
|
|
64
|
+
return (this.isResponsive && !this.isDesktop) || this.isCollapsible;
|
|
65
|
+
}
|
|
66
|
+
|
|
59
67
|
/**
|
|
60
68
|
* @param ariaLabel
|
|
61
69
|
* @type {string}
|
|
@@ -72,15 +80,15 @@ export default class HdsSideNavComponent extends Component {
|
|
|
72
80
|
let classes = []; // `hds-side-nav` is already set by the "Hds::SideNav::Base" component
|
|
73
81
|
|
|
74
82
|
// add specific class names for the different possible states
|
|
75
|
-
if (this.isDesktop) {
|
|
76
|
-
classes.push('hds-side-nav--is-desktop');
|
|
77
|
-
} else {
|
|
78
|
-
classes.push('hds-side-nav--is-mobile');
|
|
79
|
-
}
|
|
80
83
|
if (this.isResponsive) {
|
|
81
84
|
classes.push('hds-side-nav--is-responsive');
|
|
82
85
|
}
|
|
83
|
-
if (this.
|
|
86
|
+
if (!this.isDesktop && this.isResponsive) {
|
|
87
|
+
classes.push('hds-side-nav--is-mobile');
|
|
88
|
+
} else {
|
|
89
|
+
classes.push('hds-side-nav--is-desktop');
|
|
90
|
+
}
|
|
91
|
+
if (this.isMinimized && this.isResponsive) {
|
|
84
92
|
classes.push('hds-side-nav--is-minimized');
|
|
85
93
|
} else {
|
|
86
94
|
classes.push('hds-side-nav--is-not-minimized');
|
|
@@ -94,7 +102,7 @@ export default class HdsSideNavComponent extends Component {
|
|
|
94
102
|
|
|
95
103
|
@action
|
|
96
104
|
escapePress(event) {
|
|
97
|
-
if (event.key === 'Escape' && !this.isMinimized) {
|
|
105
|
+
if (event.key === 'Escape' && !this.isMinimized && !this.isDesktop) {
|
|
98
106
|
this.isMinimized = true;
|
|
99
107
|
}
|
|
100
108
|
}
|
|
@@ -127,6 +135,9 @@ export default class HdsSideNavComponent extends Component {
|
|
|
127
135
|
updateDesktopVariable(event) {
|
|
128
136
|
this.isDesktop = event.matches;
|
|
129
137
|
|
|
138
|
+
// automatically minimize on narrow viewports (when not in desktop mode)
|
|
139
|
+
this.isMinimized = !this.isDesktop;
|
|
140
|
+
|
|
130
141
|
let { onDesktopViewportChange } = this.args;
|
|
131
142
|
|
|
132
143
|
if (typeof onDesktopViewportChange === 'function') {
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
SPDX-License-Identifier: MPL-2.0
|
|
4
4
|
}}
|
|
5
5
|
{{! template-lint-disable no-invalid-role }}
|
|
6
|
-
<div
|
|
6
|
+
<div
|
|
7
|
+
class="hds-tabs"
|
|
8
|
+
{{did-insert this.didInsert}}
|
|
9
|
+
{{did-update this.updateTabIndicator this.selectedTabIndex @isParentVisible}}
|
|
10
|
+
...attributes
|
|
11
|
+
>
|
|
7
12
|
<div class="hds-tabs__tablist-wrapper">
|
|
8
13
|
<ul class="hds-tabs__tablist" role="tablist">
|
|
9
14
|
{{yield
|
|
@@ -11,9 +16,9 @@
|
|
|
11
16
|
Tab=(component
|
|
12
17
|
"hds/tabs/tab"
|
|
13
18
|
didInsertNode=this.didInsertTab
|
|
19
|
+
didUpdateNode=this.didUpdateTab
|
|
14
20
|
willDestroyNode=this.willDestroyTab
|
|
15
21
|
tabIds=this.tabIds
|
|
16
|
-
panelIds=this.panelIds
|
|
17
22
|
selectedTabIndex=this.selectedTabIndex
|
|
18
23
|
onClick=this.onClick
|
|
19
24
|
onKeyUp=this.onKeyUp
|