@hashicorp/design-system-components 0.11.0 → 0.12.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 +45 -0
- package/addon/components/hds/alert/description.hbs +1 -0
- package/addon/components/hds/alert/index.hbs +3 -9
- package/addon/components/hds/alert/title.hbs +1 -0
- package/addon/components/hds/breadcrumb/truncation.hbs +1 -0
- package/addon/components/hds/button/index.hbs +14 -2
- package/addon/components/hds/button/index.js +0 -21
- package/addon/components/hds/disclosure/index.hbs +12 -12
- package/addon/components/hds/disclosure/index.js +31 -24
- package/addon/components/hds/dropdown/index.hbs +2 -2
- package/addon/components/hds/dropdown/list-item/copy-item.hbs +1 -5
- package/addon/components/hds/dropdown/list-item/interactive.hbs +19 -41
- package/addon/components/hds/dropdown/toggle/button.hbs +1 -0
- package/addon/components/hds/dropdown/toggle/icon.hbs +8 -1
- package/addon/components/hds/interactive/index.hbs +33 -0
- package/addon/components/hds/interactive/index.js +33 -0
- package/addon/components/hds/link/inline.hbs +23 -0
- package/addon/components/hds/link/inline.js +71 -0
- package/addon/components/hds/link/standalone.hbs +15 -5
- package/addon/components/hds/link/standalone.js +7 -0
- package/addon/components/hds/toast/index.hbs +1 -3
- package/app/components/hds/{link-to/standalone.js → alert/description.js} +1 -1
- package/app/components/hds/{link-to/cta.js → alert/title.js} +1 -1
- package/app/components/hds/interactive/index.js +1 -0
- package/app/components/hds/link/{cta.js → inline.js} +1 -1
- package/app/styles/@hashicorp/design-system-components.scss +4 -1
- package/app/styles/components/alert.scss +17 -4
- package/app/styles/components/button.scss +44 -19
- package/app/styles/components/dropdown.scss +10 -10
- package/app/styles/components/link/inline.scss +66 -0
- package/app/styles/components/link/standalone.scss +4 -4
- package/app/styles/mixins/_focus-ring.scss +8 -4
- package/blueprints/hds-component/files/addon/components/hds/__name__/index.hbs +4 -0
- package/blueprints/hds-component/files/addon/components/hds/__name__/index.js +23 -0
- package/blueprints/hds-component/files/app/components/hds/__name__/index.js +1 -0
- package/blueprints/hds-component/files/app/styles/components/__name__.scss +6 -0
- package/blueprints/hds-component/index.js +60 -0
- package/blueprints/hds-component-test/files/tests/dummy/app/routes/components/__name__.js +3 -0
- package/blueprints/hds-component-test/files/tests/dummy/app/styles/pages/__dummyCSSFileName__.scss +1 -0
- package/blueprints/hds-component-test/files/tests/dummy/app/templates/components/__name__.hbs +65 -0
- package/blueprints/hds-component-test/files/tests/integration/components/hds/__name__/index-test.js +17 -0
- package/blueprints/hds-component-test/index.js +126 -0
- package/package.json +4 -4
- package/addon/components/hds/link/cta.hbs +0 -50
- package/addon/components/hds/link/cta.js +0 -150
- package/addon/components/hds/link-to/cta.hbs +0 -51
- package/addon/components/hds/link-to/cta.js +0 -165
- package/addon/components/hds/link-to/standalone.hbs +0 -25
- package/addon/components/hds/link-to/standalone.js +0 -151
- package/app/styles/components/link/cta.scss +0 -28
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { assert } from '@ember/debug';
|
|
3
|
-
|
|
4
|
-
export const DEFAULT_ICONPOSITION = 'leading';
|
|
5
|
-
export const DEFAULT_COLOR = 'primary';
|
|
6
|
-
export const DEFAULT_SIZE = 'medium';
|
|
7
|
-
export const ICONPOSITIONS = ['leading', 'trailing'];
|
|
8
|
-
export const COLORS = ['primary', 'secondary'];
|
|
9
|
-
export const SIZES = ['small', 'medium', 'large'];
|
|
10
|
-
|
|
11
|
-
export default class HdsLinkToStandaloneComponent extends Component {
|
|
12
|
-
/**
|
|
13
|
-
* @param text
|
|
14
|
-
* @type {string}
|
|
15
|
-
* @description The text of the link. If no text value is defined an error will be thrown.
|
|
16
|
-
*/
|
|
17
|
-
get text() {
|
|
18
|
-
let { text } = this.args;
|
|
19
|
-
|
|
20
|
-
assert(
|
|
21
|
-
'@text for "Hds::LinkTo::Standalone" must have a valid value',
|
|
22
|
-
text !== undefined
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return text;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @param route
|
|
30
|
-
* @type {string|null}
|
|
31
|
-
* @description Checks to make sure route is defined.
|
|
32
|
-
*/
|
|
33
|
-
get route() {
|
|
34
|
-
let { route } = this.args;
|
|
35
|
-
assert(
|
|
36
|
-
'@route must be defined for "Hds::LinkTo::Standalone"',
|
|
37
|
-
route !== undefined
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
return route;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @param color
|
|
45
|
-
* @type {string}
|
|
46
|
-
* @default primary
|
|
47
|
-
* @description Determines the color of link to be used; acceptable values are `primary` and `secondary`
|
|
48
|
-
*/
|
|
49
|
-
get color() {
|
|
50
|
-
let { color = DEFAULT_COLOR } = this.args;
|
|
51
|
-
|
|
52
|
-
assert(
|
|
53
|
-
`@color for "Hds::LinkTo::Standalone" must be one of the following: ${COLORS.join(
|
|
54
|
-
', '
|
|
55
|
-
)}; received: ${color}`,
|
|
56
|
-
COLORS.includes(color)
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
return color;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @param icon
|
|
64
|
-
* @type {string|null}
|
|
65
|
-
* @default null
|
|
66
|
-
* @description The name of the icon to be used. An icon name must be defined.
|
|
67
|
-
*/
|
|
68
|
-
get icon() {
|
|
69
|
-
let { icon } = this.args;
|
|
70
|
-
|
|
71
|
-
assert(
|
|
72
|
-
'@icon for "Hds::LinkTo::Standalone" must have a valid value',
|
|
73
|
-
icon !== undefined
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
return icon;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* @param iconPosition
|
|
81
|
-
* @type {string}
|
|
82
|
-
* @default leading
|
|
83
|
-
* @description Positions the icon before or after the text; allowed values are `leading` or `trailing`
|
|
84
|
-
*/
|
|
85
|
-
get iconPosition() {
|
|
86
|
-
let { iconPosition = DEFAULT_ICONPOSITION } = this.args;
|
|
87
|
-
|
|
88
|
-
assert(
|
|
89
|
-
`@iconPosition for "Hds::LinkTo::Standalone" must be one of the following: ${ICONPOSITIONS.join(
|
|
90
|
-
', '
|
|
91
|
-
)}; received: ${iconPosition}`,
|
|
92
|
-
ICONPOSITIONS.includes(iconPosition)
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
return iconPosition;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* @param size
|
|
100
|
-
* @type {string}
|
|
101
|
-
* @default medium
|
|
102
|
-
* @description The size of the standalone link; acceptable values are `small`, `medium`, and `large`
|
|
103
|
-
*/
|
|
104
|
-
get size() {
|
|
105
|
-
let { size = DEFAULT_SIZE } = this.args;
|
|
106
|
-
|
|
107
|
-
assert(
|
|
108
|
-
`@size for "Hds::LinkTo::Standalone" must be one of the following: ${SIZES.join(
|
|
109
|
-
', '
|
|
110
|
-
)}; received: ${size}`,
|
|
111
|
-
SIZES.includes(size)
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
return size;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* @param iconSize
|
|
119
|
-
* @type {string}
|
|
120
|
-
* @default 16
|
|
121
|
-
* @description ensures that the correct icon size is used. Automatically calculated.
|
|
122
|
-
*/
|
|
123
|
-
get iconSize() {
|
|
124
|
-
if (this.args.size === 'large') {
|
|
125
|
-
return '24';
|
|
126
|
-
} else {
|
|
127
|
-
return '16';
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Get the class names to apply to the component.
|
|
133
|
-
* @method LinkToStandalone#classNames
|
|
134
|
-
* @return {string} The "class" attribute to apply to the component.
|
|
135
|
-
*/
|
|
136
|
-
get classNames() {
|
|
137
|
-
// Notice: we've left this class name the same as the hds::link::standalone (we didn't add the "-to") so we didn't have to replicate the CSS
|
|
138
|
-
let classes = ['hds-link-standalone'];
|
|
139
|
-
|
|
140
|
-
// add a class based on the @size argument
|
|
141
|
-
classes.push(`hds-link-standalone--size-${this.size}`);
|
|
142
|
-
|
|
143
|
-
// add a class based on the @color argument
|
|
144
|
-
classes.push(`hds-link-standalone--color-${this.color}`);
|
|
145
|
-
|
|
146
|
-
// add a class based on the @iconPosition argument
|
|
147
|
-
classes.push(`hds-link-standalone--icon-position-${this.iconPosition}`);
|
|
148
|
-
|
|
149
|
-
return classes.join(' ');
|
|
150
|
-
}
|
|
151
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// ██ ██ █████ ██████ ███ ██ ██ ███ ██ ██████
|
|
2
|
-
// ██ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██ ██
|
|
3
|
-
// ██ █ ██ ███████ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ███
|
|
4
|
-
// ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
5
|
-
// ███ ███ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██████
|
|
6
|
-
//
|
|
7
|
-
// Notice: in this component we're using directly the styles from the `Hds::Button` component
|
|
8
|
-
// using the `hds-button` class names (and adding a specialized class for the "cta", see below)
|
|
9
|
-
// If you need to change the styling of the `Button` component, remember that this will impact also
|
|
10
|
-
// this component too.
|
|
11
|
-
// If instead you need to change only the styling of the `CTA` component, you can do it here using
|
|
12
|
-
// the specialized class declared below.
|
|
13
|
-
// This is NOT a standard approach that we use in the HDS design system implementation, but it's been
|
|
14
|
-
// the least worst option we could find to solve the problem of sharing the exact same style of the
|
|
15
|
-
// `Button (primary)` with other components.
|
|
16
|
-
|
|
17
|
-
//
|
|
18
|
-
// LINK > CTA COMPONENT
|
|
19
|
-
//
|
|
20
|
-
// properties within each class are sorted alphabetically
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
.hds-link-cta--inherit-button-styles {
|
|
25
|
-
isolation: isolate;
|
|
26
|
-
text-decoration: none;
|
|
27
|
-
width: fit-content;
|
|
28
|
-
}
|