@design-system-rte/angular 0.4.4 → 0.4.5
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/esm2022/design-system-rte-angular.mjs +5 -0
- package/esm2022/lib/components/button/button.component.mjs +26 -0
- package/esm2022/lib/components/checkbox/checkbox.component.mjs +35 -0
- package/esm2022/lib/components/checkbox-group/checkbox-group.component.mjs +29 -0
- package/esm2022/lib/components/grid/col/col.directive.mjs +41 -0
- package/esm2022/lib/components/grid/grid.directive.mjs +30 -0
- package/esm2022/lib/components/icon/icon-map.mjs +303 -0
- package/esm2022/lib/components/icon/icon.component.mjs +39 -0
- package/esm2022/lib/components/icon/icon.service.mjs +33 -0
- package/esm2022/lib/components/link/link.component.mjs +20 -0
- package/esm2022/lib/components/radio-button/radio-button.component.mjs +24 -0
- package/esm2022/lib/components/radio-button-group/radio-button-group.component.mjs +29 -0
- package/esm2022/public-api.mjs +10 -0
- package/fesm2022/design-system-rte-angular.mjs +583 -0
- package/fesm2022/design-system-rte-angular.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/button/button.component.d.ts +17 -0
- package/lib/components/checkbox/checkbox.component.d.ts +18 -0
- package/lib/components/checkbox-group/checkbox-group.component.d.ts +18 -0
- package/lib/components/grid/col/col.directive.d.ts +14 -0
- package/lib/components/grid/grid.directive.d.ts +10 -0
- package/lib/components/icon/icon-map.d.ts +301 -0
- package/lib/components/icon/icon.component.d.ts +21 -0
- package/lib/components/icon/icon.service.d.ts +11 -0
- package/lib/components/link/link.component.d.ts +9 -0
- package/lib/components/radio-button/radio-button.component.d.ts +13 -0
- package/lib/components/radio-button-group/radio-button-group.component.d.ts +18 -0
- package/package.json +14 -4
- package/CHANGELOG.md +0 -25
- package/ng-package.json +0 -10
- package/src/lib/components/button/button.component.html +0 -10
- package/src/lib/components/button/button.component.scss +0 -154
- package/src/lib/components/button/button.component.spec.ts +0 -22
- package/src/lib/components/button/button.component.stories.ts +0 -99
- package/src/lib/components/button/button.component.ts +0 -28
- package/src/lib/components/checkbox/checkbox.component.html +0 -31
- package/src/lib/components/checkbox/checkbox.component.scss +0 -176
- package/src/lib/components/checkbox/checkbox.component.stories.ts +0 -126
- package/src/lib/components/checkbox/checkbox.component.ts +0 -34
- package/src/lib/components/checkbox-group/checkbox-group.component.html +0 -46
- package/src/lib/components/checkbox-group/checkbox-group.component.scss +0 -82
- package/src/lib/components/checkbox-group/checkbox-group.component.stories.ts +0 -121
- package/src/lib/components/checkbox-group/checkbox-group.component.ts +0 -28
- package/src/lib/components/grid/col/col.directive.ts +0 -35
- package/src/lib/components/grid/grid.directive.stories.ts +0 -150
- package/src/lib/components/grid/grid.directive.ts +0 -22
- package/src/lib/components/icon/icon-map.ts +0 -305
- package/src/lib/components/icon/icon.component.html +0 -1
- package/src/lib/components/icon/icon.component.scss +0 -3
- package/src/lib/components/icon/icon.component.ts +0 -58
- package/src/lib/components/icon/icon.service.ts +0 -33
- package/src/lib/components/icon/icon.stories.ts +0 -84
- package/src/lib/components/icon-button/icon-button.component.html +0 -16
- package/src/lib/components/icon-button/icon-button.component.scss +0 -165
- package/src/lib/components/icon-button/icon-button.component.ts +0 -40
- package/src/lib/components/icon-button/icon-button.stories.ts +0 -200
- package/src/lib/components/icon-button-toggle/icon-button-toggle.component.html +0 -12
- package/src/lib/components/icon-button-toggle/icon-button-toggle.component.ts +0 -36
- package/src/lib/components/icon-button-toggle/icon-button-toggle.stories.ts +0 -197
- package/src/lib/components/link/link.component.html +0 -6
- package/src/lib/components/link/link.component.scss +0 -108
- package/src/lib/components/link/link.component.stories.ts +0 -61
- package/src/lib/components/link/link.component.ts +0 -18
- package/src/lib/components/radio-button/radio-button.component.html +0 -24
- package/src/lib/components/radio-button/radio-button.component.scss +0 -135
- package/src/lib/components/radio-button/radio-button.component.stories.ts +0 -76
- package/src/lib/components/radio-button/radio-button.component.ts +0 -22
- package/src/lib/components/radio-button-group/radio-button-group.component.html +0 -45
- package/src/lib/components/radio-button-group/radio-button-group.component.scss +0 -82
- package/src/lib/components/radio-button-group/radio-button-group.component.stories.ts +0 -121
- package/src/lib/components/radio-button-group/radio-button-group.component.ts +0 -28
- package/src/lib/components/split-button/split-button.component.html +0 -56
- package/src/lib/components/split-button/split-button.component.scss +0 -288
- package/src/lib/components/split-button/split-button.component.stories.ts +0 -227
- package/src/lib/components/split-button/split-button.component.ts +0 -55
- package/src/lib/components/tooltip/tooltip.component.html +0 -7
- package/src/lib/components/tooltip/tooltip.component.scss +0 -116
- package/src/lib/components/tooltip/tooltip.component.ts +0 -16
- package/src/lib/components/tooltip/tooltip.directive.stories.ts +0 -218
- package/src/lib/components/tooltip/tooltip.directive.ts +0 -187
- package/tsconfig.lib.json +0 -20
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -14
- /package/{src/public-api.ts → public-api.d.ts} +0 -0
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
@use '@design-system-rte/core/design-tokens/main.scss' as *;
|
|
2
|
-
|
|
3
|
-
.split-button-container {
|
|
4
|
-
display: inline-flex;
|
|
5
|
-
padding: $positive-spacing_0;
|
|
6
|
-
align-items: center;
|
|
7
|
-
gap: $positive-spacing_0;
|
|
8
|
-
align-self: stretch;
|
|
9
|
-
|
|
10
|
-
&.size-s {
|
|
11
|
-
height: 24px;
|
|
12
|
-
|
|
13
|
-
&.compact-spacing {
|
|
14
|
-
height: 20px;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&.size-m {
|
|
19
|
-
height: 32px;
|
|
20
|
-
|
|
21
|
-
&.compact-spacing {
|
|
22
|
-
height: 24px;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&.size-l {
|
|
27
|
-
height: 40px;
|
|
28
|
-
|
|
29
|
-
&.compact-spacing {
|
|
30
|
-
height: 28px;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&.secondary {
|
|
35
|
-
.split-button-left {
|
|
36
|
-
border-top: 1px solid var(--border-brand-default);
|
|
37
|
-
border-bottom: 1px solid var(--border-brand-default);
|
|
38
|
-
border-left: 1px solid var(--border-brand-default);
|
|
39
|
-
background-color: var(--background-default);
|
|
40
|
-
color: var(--content-brand-default);
|
|
41
|
-
|
|
42
|
-
&:hover {
|
|
43
|
-
cursor: pointer;
|
|
44
|
-
background-color: var(--background-brand-inverse-hover);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&:active {
|
|
48
|
-
background-color: var(--background-brand-inverse-pressed);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&:disabled {
|
|
52
|
-
background-color: var(--background-disabled);
|
|
53
|
-
color: var(--content-disabled);
|
|
54
|
-
border-top: 1px solid var(--border-disabled);
|
|
55
|
-
border-bottom: 1px solid var(--border-disabled);
|
|
56
|
-
border-left: 1px solid var(--border-disabled);
|
|
57
|
-
cursor: not-allowed;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.split-button-divider {
|
|
62
|
-
background-color: var(--border-brand-default);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.split-button-right-container {
|
|
66
|
-
.split-button-right {
|
|
67
|
-
border-top: 1px solid var(--border-brand-default);
|
|
68
|
-
border-bottom: 1px solid var(--border-brand-default);
|
|
69
|
-
border-right: 1px solid var(--border-brand-default);
|
|
70
|
-
background-color: var(--background-default);
|
|
71
|
-
color: var(--content-brand-default);
|
|
72
|
-
|
|
73
|
-
&:hover {
|
|
74
|
-
cursor: pointer;
|
|
75
|
-
background-color: var(--background-brand-inverse-hover);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
&:active {
|
|
79
|
-
background-color: var(--background-brand-inverse-pressed);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
&:disabled {
|
|
83
|
-
background-color: var(--background-disabled);
|
|
84
|
-
color: var(--content-disabled);
|
|
85
|
-
border-top: 1px solid var(--border-disabled);
|
|
86
|
-
border-bottom: 1px solid var(--border-disabled);
|
|
87
|
-
border-right: 1px solid var(--border-disabled);
|
|
88
|
-
cursor: not-allowed;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.split-button-left {
|
|
95
|
-
display: flex;
|
|
96
|
-
border: none;
|
|
97
|
-
padding: $positive-spacing_0 $positive-spacing_100;
|
|
98
|
-
align-items: center;
|
|
99
|
-
gap: $positive-spacing_0;
|
|
100
|
-
align-self: stretch;
|
|
101
|
-
border-radius: $radius-s $radius-none $radius-none $radius-s;
|
|
102
|
-
border-color: var(--border-brand-default);
|
|
103
|
-
background-color: var(--background-brand-default);
|
|
104
|
-
color: var(--content-primary-inverse);
|
|
105
|
-
|
|
106
|
-
.split-button-label {
|
|
107
|
-
margin: 0;
|
|
108
|
-
|
|
109
|
-
&.size-s {
|
|
110
|
-
@include typography-split-button-s;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
&.size-m {
|
|
114
|
-
@include typography-split-button-m;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
&.size-l {
|
|
118
|
-
@include typography-split-button-l;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
&:hover {
|
|
123
|
-
cursor: pointer;
|
|
124
|
-
background-color: var(--background-brand-hover);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
&:active {
|
|
128
|
-
background-color: var(--background-brand-pressed);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
&:disabled {
|
|
132
|
-
background-color: var(--background-disabled);
|
|
133
|
-
color: var(--content-disabled);
|
|
134
|
-
border-top: 1px solid var(--border-disabled);
|
|
135
|
-
border-bottom: 1px solid var(--border-disabled);
|
|
136
|
-
border-left: 1px solid var(--border-disabled);
|
|
137
|
-
cursor: not-allowed;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
&:focus {
|
|
141
|
-
outline: none;
|
|
142
|
-
position: relative;
|
|
143
|
-
z-index: 1;
|
|
144
|
-
|
|
145
|
-
&::after {
|
|
146
|
-
content: '';
|
|
147
|
-
position: absolute;
|
|
148
|
-
top: -8px;
|
|
149
|
-
left: -8px;
|
|
150
|
-
bottom: -8px;
|
|
151
|
-
right: -1px;
|
|
152
|
-
border: 1px solid var(--border-brand-focused);
|
|
153
|
-
pointer-events: none;
|
|
154
|
-
border-radius: $radius-s;
|
|
155
|
-
z-index: 2;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.split-button-divider {
|
|
161
|
-
width: 1px;
|
|
162
|
-
height: 100%;
|
|
163
|
-
background-color: var(--content-primary-inverse);
|
|
164
|
-
|
|
165
|
-
&.disabled {
|
|
166
|
-
background-color: var(--border-disabled);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.split-button-right-container {
|
|
171
|
-
display: flex;
|
|
172
|
-
position: relative;
|
|
173
|
-
padding: $positive-spacing_0;
|
|
174
|
-
align-items: center;
|
|
175
|
-
justify-content: center;
|
|
176
|
-
gap: $positive-spacing_0;
|
|
177
|
-
align-self: stretch;
|
|
178
|
-
|
|
179
|
-
&.size-s {
|
|
180
|
-
width: 24px;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
&.size-m {
|
|
184
|
-
width: 34px;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
&.size-l {
|
|
188
|
-
width: 44px;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
.split-button-right {
|
|
192
|
-
display: flex;
|
|
193
|
-
border: none;
|
|
194
|
-
padding: $positive-spacing_075 $positive-spacing_200;
|
|
195
|
-
align-items: center;
|
|
196
|
-
justify-content: center;
|
|
197
|
-
align-self: stretch;
|
|
198
|
-
|
|
199
|
-
border-radius: $radius-none $radius-s $radius-s $radius-none;
|
|
200
|
-
border-color: var(--border-brand-default);
|
|
201
|
-
background-color: var(--background-brand-default);
|
|
202
|
-
|
|
203
|
-
color: var(--content-primary-inverse);
|
|
204
|
-
|
|
205
|
-
&:hover {
|
|
206
|
-
cursor: pointer;
|
|
207
|
-
background-color: var(--background-brand-hover);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
&:active {
|
|
211
|
-
background-color: var(--background-brand-pressed);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
&:disabled {
|
|
215
|
-
background-color: var(--background-disabled);
|
|
216
|
-
color: var(--content-disabled);
|
|
217
|
-
border-top: 1px solid var(--border-disabled);
|
|
218
|
-
border-bottom: 1px solid var(--border-disabled);
|
|
219
|
-
border-right: 1px solid var(--border-disabled);
|
|
220
|
-
cursor: not-allowed;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
&:focus {
|
|
224
|
-
outline: none;
|
|
225
|
-
position: relative;
|
|
226
|
-
z-index: 1;
|
|
227
|
-
|
|
228
|
-
&::after {
|
|
229
|
-
content: '';
|
|
230
|
-
position: absolute;
|
|
231
|
-
top: -8px;
|
|
232
|
-
left: -1px;
|
|
233
|
-
bottom: -8px;
|
|
234
|
-
right: -8px;
|
|
235
|
-
border: 1px solid var(--border-brand-focused);
|
|
236
|
-
pointer-events: none;
|
|
237
|
-
border-radius: $radius-s;
|
|
238
|
-
z-index: 2;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.split-button-right-icon-container {
|
|
243
|
-
pointer-events: none;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.split-button-dropdown {
|
|
248
|
-
position: absolute;
|
|
249
|
-
|
|
250
|
-
&.position-bottom-start {
|
|
251
|
-
top: 100%;
|
|
252
|
-
left: 0;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
&.position-bottom-end {
|
|
256
|
-
top: 100%;
|
|
257
|
-
right: 0;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
&.position-top-start {
|
|
261
|
-
bottom: 100%;
|
|
262
|
-
left: 0;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
&.position-top-end {
|
|
266
|
-
bottom: 100%;
|
|
267
|
-
right: 0;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
.animation-slide-from-top {
|
|
274
|
-
animation: slide-from-top 0.2s ease-in-out;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
@keyframes slide-from-top {
|
|
278
|
-
from {
|
|
279
|
-
transform: translateY(-10px);
|
|
280
|
-
pointer-events: none;
|
|
281
|
-
opacity: 0;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
to {
|
|
285
|
-
transform: translateY(0);
|
|
286
|
-
opacity: 1;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { DOWN_KEY } from "@design-system-rte/core/constants/keyboard.constants";
|
|
2
|
-
import { Meta, StoryObj } from "@storybook/angular";
|
|
3
|
-
import { expect, userEvent, waitFor, within } from "@storybook/test";
|
|
4
|
-
|
|
5
|
-
import { SplitButtonComponent } from "./split-button.component";
|
|
6
|
-
|
|
7
|
-
const mockChildren = `
|
|
8
|
-
<div style="display: flex; flex-direction: column; gap: 8px; min-width: 120px">
|
|
9
|
-
<button
|
|
10
|
-
style="
|
|
11
|
-
padding: 8px 16px;
|
|
12
|
-
border: none;
|
|
13
|
-
border-radius: 4px;
|
|
14
|
-
background: #2563eb;
|
|
15
|
-
color: #fff;
|
|
16
|
-
font-weight: 500;
|
|
17
|
-
font-size: 15px;
|
|
18
|
-
cursor: pointer;
|
|
19
|
-
"
|
|
20
|
-
>
|
|
21
|
-
Action 1
|
|
22
|
-
</button>
|
|
23
|
-
<button
|
|
24
|
-
style="
|
|
25
|
-
padding: 8px 16px;
|
|
26
|
-
border: none;
|
|
27
|
-
border-radius: 4px;
|
|
28
|
-
background: #64748b;
|
|
29
|
-
color: #fff;
|
|
30
|
-
font-weight: 500;
|
|
31
|
-
font-size: 15px;
|
|
32
|
-
cursor: pointer;
|
|
33
|
-
"
|
|
34
|
-
>
|
|
35
|
-
Action 2
|
|
36
|
-
</button>
|
|
37
|
-
</div>
|
|
38
|
-
`;
|
|
39
|
-
|
|
40
|
-
function generateSplitButtonElement(props: Record<string, string> = {}): string {
|
|
41
|
-
const defaultProps = {
|
|
42
|
-
appearance: "appearance",
|
|
43
|
-
label: "label",
|
|
44
|
-
position: "position",
|
|
45
|
-
disabled: "disabled",
|
|
46
|
-
ariaLabelRight: "ariaLabelRight",
|
|
47
|
-
...props,
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const attributes = Object.entries(defaultProps)
|
|
51
|
-
.map(([key, value]) => `[${key}]="${value}"`)
|
|
52
|
-
.join("\n");
|
|
53
|
-
|
|
54
|
-
return `
|
|
55
|
-
<rte-split-button
|
|
56
|
-
${attributes}
|
|
57
|
-
>
|
|
58
|
-
${mockChildren}
|
|
59
|
-
</rte-split-button>`;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const meta: Meta<SplitButtonComponent> = {
|
|
63
|
-
title: "SplitButton",
|
|
64
|
-
component: SplitButtonComponent,
|
|
65
|
-
tags: ["autodocs"],
|
|
66
|
-
argTypes: {
|
|
67
|
-
appearance: {
|
|
68
|
-
control: "select",
|
|
69
|
-
options: ["primary", "secondary"],
|
|
70
|
-
},
|
|
71
|
-
size: {
|
|
72
|
-
control: "select",
|
|
73
|
-
options: ["s", "m", "l"],
|
|
74
|
-
},
|
|
75
|
-
compactSpacing: {
|
|
76
|
-
control: "boolean",
|
|
77
|
-
},
|
|
78
|
-
selected: {
|
|
79
|
-
control: "boolean",
|
|
80
|
-
},
|
|
81
|
-
position: {
|
|
82
|
-
control: "select",
|
|
83
|
-
options: ["bottom-start", "bottom-end", "top-start", "top-end"],
|
|
84
|
-
},
|
|
85
|
-
disabled: {
|
|
86
|
-
control: "boolean",
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
export default meta;
|
|
91
|
-
type Story = StoryObj<SplitButtonComponent>;
|
|
92
|
-
|
|
93
|
-
export const Default: Story = {
|
|
94
|
-
args: {
|
|
95
|
-
appearance: "primary",
|
|
96
|
-
label: "Button Label",
|
|
97
|
-
compactSpacing: false,
|
|
98
|
-
position: "bottom-start",
|
|
99
|
-
disabled: false,
|
|
100
|
-
ariaLabelRight: "Open menu",
|
|
101
|
-
},
|
|
102
|
-
render: (args) => ({
|
|
103
|
-
props: args,
|
|
104
|
-
template: `
|
|
105
|
-
${generateSplitButtonElement()}
|
|
106
|
-
`,
|
|
107
|
-
}),
|
|
108
|
-
play: async ({ canvasElement }) => {
|
|
109
|
-
const canvas = within(canvasElement);
|
|
110
|
-
const button = canvas.getByTestId("Main action button");
|
|
111
|
-
await userEvent.click(button);
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export const Appearance: Story = {
|
|
116
|
-
render: (args) => ({
|
|
117
|
-
props: args,
|
|
118
|
-
template: `
|
|
119
|
-
<div style="display: flex; gap: 16px">
|
|
120
|
-
${generateSplitButtonElement({ appearance: "'primary'" })}
|
|
121
|
-
${generateSplitButtonElement({ appearance: "'secondary'" })}
|
|
122
|
-
</div>
|
|
123
|
-
`,
|
|
124
|
-
}),
|
|
125
|
-
args: {
|
|
126
|
-
...Default.args,
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export const Size: Story = {
|
|
131
|
-
render: (args) => ({
|
|
132
|
-
props: args,
|
|
133
|
-
template: `
|
|
134
|
-
<div style="display: flex; gap: 16px">
|
|
135
|
-
${generateSplitButtonElement({ size: "'s'" })}
|
|
136
|
-
${generateSplitButtonElement({ size: "'m'" })}
|
|
137
|
-
${generateSplitButtonElement({ size: "'l'" })}
|
|
138
|
-
</div>
|
|
139
|
-
`,
|
|
140
|
-
}),
|
|
141
|
-
args: {
|
|
142
|
-
...Default.args,
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
export const CompactSpacing: Story = {
|
|
147
|
-
render: (args) => ({
|
|
148
|
-
props: args,
|
|
149
|
-
template: `
|
|
150
|
-
<div style="display: flex; gap: 16px">
|
|
151
|
-
${generateSplitButtonElement({
|
|
152
|
-
size: "'s'",
|
|
153
|
-
compactSpacing: "true",
|
|
154
|
-
icon: "icon",
|
|
155
|
-
})}
|
|
156
|
-
${generateSplitButtonElement({
|
|
157
|
-
size: "'m'",
|
|
158
|
-
compactSpacing: "true",
|
|
159
|
-
icon: "icon",
|
|
160
|
-
})}
|
|
161
|
-
${generateSplitButtonElement({
|
|
162
|
-
size: "'l'",
|
|
163
|
-
compactSpacing: "true",
|
|
164
|
-
icon: "icon",
|
|
165
|
-
})}
|
|
166
|
-
</div>
|
|
167
|
-
`,
|
|
168
|
-
}),
|
|
169
|
-
args: {
|
|
170
|
-
...Default.args,
|
|
171
|
-
},
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
export const Position: Story = {
|
|
175
|
-
render: (args) => ({
|
|
176
|
-
props: args,
|
|
177
|
-
template: `
|
|
178
|
-
<div style="display: flex; justify-content: center; align-items: center; min-height: 600px">
|
|
179
|
-
<div style="display: grid; grid-template-columns: 2fr 2fr; gap: 24px">
|
|
180
|
-
${generateSplitButtonElement({
|
|
181
|
-
position: "'top-end'",
|
|
182
|
-
compactSpacing: "compactSpacing",
|
|
183
|
-
selected: "selected",
|
|
184
|
-
icon: "icon",
|
|
185
|
-
})}
|
|
186
|
-
${generateSplitButtonElement({
|
|
187
|
-
position: "'top-start'",
|
|
188
|
-
compactSpacing: "compactSpacing",
|
|
189
|
-
selected: "selected",
|
|
190
|
-
icon: "icon",
|
|
191
|
-
})}
|
|
192
|
-
${generateSplitButtonElement({
|
|
193
|
-
position: "'bottom-end'",
|
|
194
|
-
compactSpacing: "compactSpacing",
|
|
195
|
-
selected: "selected",
|
|
196
|
-
icon: "icon",
|
|
197
|
-
})}
|
|
198
|
-
${generateSplitButtonElement({
|
|
199
|
-
position: "'bottom-start'",
|
|
200
|
-
compactSpacing: "compactSpacing",
|
|
201
|
-
selected: "selected",
|
|
202
|
-
icon: "icon",
|
|
203
|
-
})}
|
|
204
|
-
</div>
|
|
205
|
-
</div>
|
|
206
|
-
`,
|
|
207
|
-
}),
|
|
208
|
-
args: {
|
|
209
|
-
...Default.args,
|
|
210
|
-
},
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
export const KeyboardInteraction: Story = {
|
|
214
|
-
play: async ({ canvasElement }) => {
|
|
215
|
-
const canvas = within(canvasElement);
|
|
216
|
-
const button = canvas.getByTestId("Menu button");
|
|
217
|
-
const menuContainer = canvas.getByTestId("Menu container");
|
|
218
|
-
await userEvent.tab();
|
|
219
|
-
await userEvent.tab();
|
|
220
|
-
expect(document.activeElement).toBe(button);
|
|
221
|
-
await userEvent.keyboard(DOWN_KEY);
|
|
222
|
-
await waitFor(() => expect(menuContainer).toBeVisible());
|
|
223
|
-
},
|
|
224
|
-
args: {
|
|
225
|
-
...Default.args,
|
|
226
|
-
},
|
|
227
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from "@angular/common";
|
|
2
|
-
import { ChangeDetectionStrategy, Component, computed, input, signal } from "@angular/core";
|
|
3
|
-
import {
|
|
4
|
-
splitButtonLeftIconSize,
|
|
5
|
-
splitButtonRightIconSize,
|
|
6
|
-
} from "@design-system-rte/core/components/split-button/split-button.constants";
|
|
7
|
-
import {
|
|
8
|
-
SplitButtonAppearance,
|
|
9
|
-
SplitButtonPosition,
|
|
10
|
-
SplitButtonSize,
|
|
11
|
-
} from "@design-system-rte/core/components/split-button/split-button.interface";
|
|
12
|
-
|
|
13
|
-
import { IconComponent } from "../icon/icon.component";
|
|
14
|
-
import { RegularIconIdKey, TogglableIconIdKey } from "../icon/icon.service";
|
|
15
|
-
|
|
16
|
-
@Component({
|
|
17
|
-
selector: "rte-split-button",
|
|
18
|
-
imports: [CommonModule, IconComponent],
|
|
19
|
-
standalone: true,
|
|
20
|
-
templateUrl: "./split-button.component.html",
|
|
21
|
-
styleUrl: "./split-button.component.scss",
|
|
22
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
23
|
-
})
|
|
24
|
-
export class SplitButtonComponent {
|
|
25
|
-
readonly appearance = input<SplitButtonAppearance>("primary");
|
|
26
|
-
readonly size = input<SplitButtonSize>("m");
|
|
27
|
-
readonly label = input.required<string>();
|
|
28
|
-
readonly compactSpacing = input(false);
|
|
29
|
-
readonly selected = input(false);
|
|
30
|
-
readonly position = input<SplitButtonPosition>("bottom-start");
|
|
31
|
-
readonly icon = input<RegularIconIdKey | TogglableIconIdKey>();
|
|
32
|
-
readonly disabled = input(false);
|
|
33
|
-
readonly ariaLabelRight = input<string>();
|
|
34
|
-
|
|
35
|
-
readonly splitButtonLeftIconSize = computed(() => splitButtonLeftIconSize[this.size()]);
|
|
36
|
-
readonly splitButtonRightIconSize = computed(() => splitButtonRightIconSize[this.size()]);
|
|
37
|
-
|
|
38
|
-
readonly isOpen = signal(false);
|
|
39
|
-
|
|
40
|
-
handleKeyDownOnRightButton(event: KeyboardEvent): void {
|
|
41
|
-
this.handleKeyDown(event, "ArrowDown", () => this.isOpen.set(true));
|
|
42
|
-
this.handleKeyDown(event, "Escape", () => this.isOpen.set(false));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
handleKeyDownOnMenu(event: KeyboardEvent): void {
|
|
46
|
-
this.handleKeyDown(event, "Escape", () => this.isOpen.set(false));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
private handleKeyDown(event: KeyboardEvent, key: string, callback: () => void): void {
|
|
50
|
-
if (event.key === key) {
|
|
51
|
-
event.preventDefault();
|
|
52
|
-
callback();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
@use '@design-system-rte/core/design-tokens/main.scss' as *;
|
|
2
|
-
|
|
3
|
-
$max-width: 160px;
|
|
4
|
-
$max-height: 40px;
|
|
5
|
-
|
|
6
|
-
:host {
|
|
7
|
-
position: absolute;
|
|
8
|
-
max-width: $max-width;
|
|
9
|
-
max-height: $max-height;
|
|
10
|
-
|
|
11
|
-
transition: opacity 150ms ease-out;
|
|
12
|
-
|
|
13
|
-
&:not(:hover) {
|
|
14
|
-
transition: opacity 100ms ease-in;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.tooltip {
|
|
19
|
-
@include typography-tooltip-label;
|
|
20
|
-
color: var(--content-primary-inverse);
|
|
21
|
-
position: absolute;
|
|
22
|
-
text-align: center;
|
|
23
|
-
z-index: 1;
|
|
24
|
-
max-width: $max-width;
|
|
25
|
-
max-height: $max-height;
|
|
26
|
-
width: fit-content;
|
|
27
|
-
padding-block: $positive-spacing_050;
|
|
28
|
-
padding-inline: $positive-spacing_200;
|
|
29
|
-
border-radius: $radius-s;
|
|
30
|
-
background: var(--background-inverse);
|
|
31
|
-
|
|
32
|
-
&.top {
|
|
33
|
-
transform: translateX(-50%);
|
|
34
|
-
|
|
35
|
-
&::after {
|
|
36
|
-
top: 100%;
|
|
37
|
-
left: 50%;
|
|
38
|
-
margin-left: -5px;
|
|
39
|
-
border-color: var(--background-inverse) transparent transparent transparent;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
&.start::after {
|
|
43
|
-
left: 25%;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&.end::after {
|
|
47
|
-
left: 75%;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&.bottom {
|
|
52
|
-
transform: translateX(-50%);
|
|
53
|
-
|
|
54
|
-
&::after {
|
|
55
|
-
bottom: 100%;
|
|
56
|
-
left: 50%;
|
|
57
|
-
margin-left: -5px;
|
|
58
|
-
border-color: transparent transparent var(--background-inverse) transparent;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
&.start::after {
|
|
62
|
-
left: 25%;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&.end::after {
|
|
66
|
-
left: 75%;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&.left {
|
|
71
|
-
transform: translateY(-50%);
|
|
72
|
-
|
|
73
|
-
&::after {
|
|
74
|
-
top: 50%;
|
|
75
|
-
left: 100%;
|
|
76
|
-
margin-top: -5px;
|
|
77
|
-
border-color: transparent transparent transparent var(--background-inverse);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
&.start::after {
|
|
81
|
-
top: 25%;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
&.end::after {
|
|
85
|
-
top: 75%;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
&.right {
|
|
90
|
-
transform: translateY(-50%);
|
|
91
|
-
|
|
92
|
-
&::after {
|
|
93
|
-
top: 50%;
|
|
94
|
-
right: 100%;
|
|
95
|
-
margin-top: -5px;
|
|
96
|
-
border-color: transparent var(--background-inverse) transparent transparent;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
&.start::after {
|
|
100
|
-
top: 25%;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
&.end::after {
|
|
104
|
-
top: 75%;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
&.arrow {
|
|
109
|
-
&::after {
|
|
110
|
-
content: '';
|
|
111
|
-
position: absolute;
|
|
112
|
-
border-width: 5px;
|
|
113
|
-
border-style: solid;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from "@angular/common";
|
|
2
|
-
import { Component, input } from "@angular/core";
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: "rte-tooltip",
|
|
6
|
-
imports: [CommonModule],
|
|
7
|
-
standalone: true,
|
|
8
|
-
templateUrl: "./tooltip.component.html",
|
|
9
|
-
styleUrl: "./tooltip.component.scss",
|
|
10
|
-
})
|
|
11
|
-
export class TooltipComponent {
|
|
12
|
-
readonly label = input.required<string>();
|
|
13
|
-
readonly position = input<string>("auto");
|
|
14
|
-
readonly alignment = input<string>("center");
|
|
15
|
-
readonly arrow = input<boolean>(true);
|
|
16
|
-
}
|