@design-system-rte/angular 0.2.0 → 0.2.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/ng-package.json +10 -0
- package/package.json +4 -17
- package/src/lib/components/button/button.component.html +10 -0
- package/src/lib/components/button/button.component.scss +156 -0
- package/src/lib/components/button/button.component.spec.ts +22 -0
- package/src/lib/components/button/button.component.stories.ts +99 -0
- package/src/lib/components/button/button.component.ts +27 -0
- package/src/lib/components/checkbox/checkbox.component.html +31 -0
- package/src/lib/components/checkbox/checkbox.component.scss +170 -0
- package/src/lib/components/checkbox/checkbox.component.stories.ts +126 -0
- package/src/lib/components/checkbox/checkbox.component.ts +34 -0
- package/src/lib/components/checkbox-group/checkbox-group.component.html +46 -0
- package/src/lib/components/checkbox-group/checkbox-group.component.scss +82 -0
- package/src/lib/components/checkbox-group/checkbox-group.component.stories.ts +121 -0
- package/src/lib/components/checkbox-group/checkbox-group.component.ts +28 -0
- package/src/lib/components/grid/col/col.directive.ts +35 -0
- package/src/lib/components/grid/grid.directive.stories.ts +150 -0
- package/src/lib/components/grid/grid.directive.ts +22 -0
- package/src/lib/components/icon/icon-map.ts +301 -0
- package/src/lib/components/icon/icon.component.html +1 -0
- package/src/lib/components/icon/icon.component.scss +3 -0
- package/src/lib/components/icon/icon.component.ts +58 -0
- package/src/lib/components/icon/icon.service.ts +33 -0
- package/src/lib/components/icon/icon.stories.ts +84 -0
- package/src/lib/components/link/link.component.html +6 -0
- package/src/lib/components/link/link.component.scss +108 -0
- package/src/lib/components/link/link.component.stories.ts +61 -0
- package/src/lib/components/link/link.component.ts +18 -0
- package/src/lib/components/radio-button/radio-button.component.html +24 -0
- package/src/lib/components/radio-button/radio-button.component.scss +135 -0
- package/src/lib/components/radio-button/radio-button.component.stories.ts +76 -0
- package/src/lib/components/radio-button/radio-button.component.ts +22 -0
- package/src/lib/components/radio-button-group/radio-button-group.component.html +45 -0
- package/src/lib/components/radio-button-group/radio-button-group.component.scss +82 -0
- package/src/lib/components/radio-button-group/radio-button-group.component.stories.ts +121 -0
- package/src/lib/components/radio-button-group/radio-button-group.component.ts +28 -0
- package/src/lib/components/tooltip/tooltip.component.html +7 -0
- package/src/lib/components/tooltip/tooltip.component.scss +118 -0
- package/src/lib/components/tooltip/tooltip.component.ts +16 -0
- package/src/lib/components/tooltip/tooltip.directive.stories.ts +218 -0
- package/src/lib/components/tooltip/tooltip.directive.ts +187 -0
- package/src/public-api.ts +9 -0
- package/tsconfig.lib.json +22 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
- package/design-system-rte-angular.d.ts.map +0 -1
- package/esm2022/design-system-rte-angular.mjs +0 -5
- package/esm2022/lib/components/button/button.component.mjs +0 -22
- package/esm2022/lib/components/checkbox/checkbox.component.mjs +0 -34
- package/esm2022/lib/components/checkbox-group/checkbox-group.component.mjs +0 -29
- package/esm2022/lib/components/grid/col/col.directive.mjs +0 -41
- package/esm2022/lib/components/grid/grid.directive.mjs +0 -30
- package/esm2022/lib/components/link/link.component.mjs +0 -19
- package/esm2022/lib/components/radio-button/radio-button.component.mjs +0 -24
- package/esm2022/lib/components/radio-button-group/radio-button-group.component.mjs +0 -29
- package/esm2022/public-api.mjs +0 -12
- package/fesm2022/design-system-rte-angular.mjs +0 -215
- package/fesm2022/design-system-rte-angular.mjs.map +0 -1
- package/index.d.ts +0 -6
- package/lib/components/button/button.component.d.ts +0 -13
- package/lib/components/button/button.component.d.ts.map +0 -1
- package/lib/components/checkbox/checkbox.component.d.ts +0 -19
- package/lib/components/checkbox/checkbox.component.d.ts.map +0 -1
- package/lib/components/checkbox-group/checkbox-group.component.d.ts +0 -19
- package/lib/components/checkbox-group/checkbox-group.component.d.ts.map +0 -1
- package/lib/components/grid/col/col.directive.d.ts +0 -15
- package/lib/components/grid/col/col.directive.d.ts.map +0 -1
- package/lib/components/grid/grid.directive.d.ts +0 -11
- package/lib/components/grid/grid.directive.d.ts.map +0 -1
- package/lib/components/link/link.component.d.ts +0 -10
- package/lib/components/link/link.component.d.ts.map +0 -1
- package/lib/components/radio-button/radio-button.component.d.ts +0 -14
- package/lib/components/radio-button/radio-button.component.d.ts.map +0 -1
- package/lib/components/radio-button-group/radio-button-group.component.d.ts +0 -19
- package/lib/components/radio-button-group/radio-button-group.component.d.ts.map +0 -1
- package/public-api.d.ts +0 -9
- package/public-api.d.ts.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CommonModule } from "@angular/common";
|
|
2
|
+
import { Component, input } from "@angular/core";
|
|
3
|
+
|
|
4
|
+
import { IconComponent } from "../icon/icon.component";
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: "rte-link",
|
|
8
|
+
imports: [CommonModule, IconComponent],
|
|
9
|
+
standalone: true,
|
|
10
|
+
templateUrl: "./link.component.html",
|
|
11
|
+
styleUrl: "./link.component.scss",
|
|
12
|
+
})
|
|
13
|
+
export class LinkComponent {
|
|
14
|
+
readonly label = input("");
|
|
15
|
+
readonly href = input<string>("#");
|
|
16
|
+
readonly subtle = input<boolean>(false);
|
|
17
|
+
readonly externalLink = input<boolean>(false);
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<div *ngIf="isDisplayed()" class="rte-radio-button-container">
|
|
2
|
+
<input
|
|
3
|
+
type="radio"
|
|
4
|
+
class="rte-radio-button"
|
|
5
|
+
[id]="label()"
|
|
6
|
+
[value]="label()"
|
|
7
|
+
[size]="labelSize"
|
|
8
|
+
[name]="groupName()"
|
|
9
|
+
[ngClass]="{'error': error(), 'read-only': readOnly()}"
|
|
10
|
+
[disabled]="disabled()"
|
|
11
|
+
/>
|
|
12
|
+
<label
|
|
13
|
+
*ngIf="showLabel()"
|
|
14
|
+
class="rte-radio-button-label"
|
|
15
|
+
[for]="label()"
|
|
16
|
+
[ngClass]="{
|
|
17
|
+
'error': error(),
|
|
18
|
+
'read-only': readOnly(),
|
|
19
|
+
'disabled': disabled()
|
|
20
|
+
}"
|
|
21
|
+
>
|
|
22
|
+
{{ label() }}
|
|
23
|
+
</label>
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
@use '@design-system-rte/core/tokens/main.scss' as *;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
.rte-radio-button-container {
|
|
5
|
+
display: flex;
|
|
6
|
+
padding-right: $positive-spacing_050;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: $positive-spacing_150;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.rte-radio-button {
|
|
12
|
+
appearance: none;
|
|
13
|
+
display: flex;
|
|
14
|
+
width: 16px;
|
|
15
|
+
height: 16px;
|
|
16
|
+
padding: $positive-spacing_0;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
align-items: center;
|
|
19
|
+
border-radius: $radius-pill;
|
|
20
|
+
border: $width-xs solid var(--content-tertiary);
|
|
21
|
+
background: var(--background-default);
|
|
22
|
+
position: relative;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
transition: box-shadow 0.3s ease-in-out;
|
|
25
|
+
margin: 0;
|
|
26
|
+
|
|
27
|
+
&::before {
|
|
28
|
+
content: '';
|
|
29
|
+
width: 10px;
|
|
30
|
+
height: 10px;
|
|
31
|
+
border-radius: $radius-pill;
|
|
32
|
+
background: var(--content-brand-default);
|
|
33
|
+
opacity: $opacity-0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&::after {
|
|
37
|
+
content: '';
|
|
38
|
+
width: calc(100% + 8px);
|
|
39
|
+
height: calc(100% + 8px);
|
|
40
|
+
border-radius: $radius-s;
|
|
41
|
+
border: $width-xs solid var(--content-primary);
|
|
42
|
+
position: absolute;
|
|
43
|
+
z-index: -1;
|
|
44
|
+
opacity: $opacity-0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.error {
|
|
48
|
+
border: $width-xs solid var(--content-danger);
|
|
49
|
+
transition: box-shadow 0.3s ease-in-out;
|
|
50
|
+
|
|
51
|
+
&:checked {
|
|
52
|
+
border: $width-xs solid var(--content-danger);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&::before {
|
|
56
|
+
background: var(--content-danger);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:hover {
|
|
60
|
+
transition: box-shadow 0.15s ease-in-out;
|
|
61
|
+
@include hover-box-shadow(var(--background-hover-opacity-50));
|
|
62
|
+
|
|
63
|
+
&:checked {
|
|
64
|
+
@include hover-box-shadow(var(--background-danger-hover-opacity-20));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&.read-only {
|
|
70
|
+
pointer-events: none;
|
|
71
|
+
cursor: default;
|
|
72
|
+
|
|
73
|
+
&::before {
|
|
74
|
+
background: var(--content-tertiary);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&:checked {
|
|
78
|
+
border: $width-xs solid var(--content-tertiary);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&.error{
|
|
82
|
+
border: $width-xs solid var(--content-danger);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&:focus-visible {
|
|
87
|
+
outline: none;
|
|
88
|
+
|
|
89
|
+
&::after {
|
|
90
|
+
opacity: $opacity-100;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&:checked {
|
|
95
|
+
border: $width-xs solid var(--content-brand-default);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&:checked::before {
|
|
99
|
+
opacity: $opacity-100;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&:hover {
|
|
103
|
+
@include hover-box-shadow(var(--background-hover-opacity-50));
|
|
104
|
+
|
|
105
|
+
&:checked {
|
|
106
|
+
@include hover-box-shadow(var(--background-brand-hover-opacity-20));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&:disabled {
|
|
111
|
+
pointer-events: none;
|
|
112
|
+
background: var(--background-disabled);
|
|
113
|
+
border: $width-xs solid var(--content-disabled);
|
|
114
|
+
cursor: not-allowed;
|
|
115
|
+
|
|
116
|
+
&::before {
|
|
117
|
+
background: var(--content-disabled);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.rte-radio-button-label {
|
|
123
|
+
@include typography-radio-button-l;
|
|
124
|
+
|
|
125
|
+
&.read-only {
|
|
126
|
+
pointer-events: none;
|
|
127
|
+
cursor: default;
|
|
128
|
+
color: var(--content-tertiary);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&.disabled {
|
|
132
|
+
pointer-events: none;
|
|
133
|
+
color: var(--content-disabled);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/angular";
|
|
2
|
+
import { userEvent, within, expect } from "@storybook/test";
|
|
3
|
+
|
|
4
|
+
import { RadioButtonComponent } from "./radio-button.component";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<RadioButtonComponent> = {
|
|
7
|
+
title: "RadioButton",
|
|
8
|
+
component: RadioButtonComponent,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
argTypes: {
|
|
11
|
+
label: {
|
|
12
|
+
control: "text",
|
|
13
|
+
defaultValue: "Radio Button",
|
|
14
|
+
},
|
|
15
|
+
groupName: {
|
|
16
|
+
control: "text",
|
|
17
|
+
defaultValue: "radio-group",
|
|
18
|
+
},
|
|
19
|
+
showLabel: {
|
|
20
|
+
control: "boolean",
|
|
21
|
+
defaultValue: true,
|
|
22
|
+
},
|
|
23
|
+
disabled: {
|
|
24
|
+
control: "boolean",
|
|
25
|
+
defaultValue: false,
|
|
26
|
+
},
|
|
27
|
+
error: {
|
|
28
|
+
control: "boolean",
|
|
29
|
+
defaultValue: false,
|
|
30
|
+
},
|
|
31
|
+
readOnly: {
|
|
32
|
+
control: "boolean",
|
|
33
|
+
defaultValue: false,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export default meta;
|
|
38
|
+
type Story = StoryObj<RadioButtonComponent>;
|
|
39
|
+
|
|
40
|
+
export const Default: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
label: "Radio Button",
|
|
43
|
+
groupName: "radio-group",
|
|
44
|
+
showLabel: true,
|
|
45
|
+
disabled: false,
|
|
46
|
+
error: false,
|
|
47
|
+
readOnly: false,
|
|
48
|
+
},
|
|
49
|
+
play: async ({ canvasElement }) => {
|
|
50
|
+
const canvas = within(canvasElement);
|
|
51
|
+
const radioButton = canvas.getByRole("radio");
|
|
52
|
+
await userEvent.click(radioButton);
|
|
53
|
+
expect(radioButton).toBeChecked();
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const Disabled: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
...Default.args,
|
|
60
|
+
disabled: true,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const Error: Story = {
|
|
65
|
+
args: {
|
|
66
|
+
...Default.args,
|
|
67
|
+
error: true,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const ReadOnly: Story = {
|
|
72
|
+
args: {
|
|
73
|
+
...Default.args,
|
|
74
|
+
readOnly: true,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CommonModule } from "@angular/common";
|
|
2
|
+
import { Component, computed, input } from "@angular/core";
|
|
3
|
+
import { labelSize } from "@design-system-rte/core/components/radio-button/radio-button.constants";
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: "rte-radio-button",
|
|
7
|
+
imports: [CommonModule],
|
|
8
|
+
standalone: true,
|
|
9
|
+
templateUrl: "./radio-button.component.html",
|
|
10
|
+
styleUrl: "./radio-button.component.scss",
|
|
11
|
+
})
|
|
12
|
+
export class RadioButtonComponent {
|
|
13
|
+
readonly label = input("");
|
|
14
|
+
readonly groupName = input("");
|
|
15
|
+
readonly showLabel = input(true);
|
|
16
|
+
readonly disabled = input(false);
|
|
17
|
+
readonly error = input(false);
|
|
18
|
+
readonly readOnly = input(false);
|
|
19
|
+
labelSize = labelSize;
|
|
20
|
+
|
|
21
|
+
readonly isDisplayed = computed(() => !(this.disabled() && this.error()));
|
|
22
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<div
|
|
2
|
+
*ngIf="isDisplayed()"
|
|
3
|
+
class="radio-button-group-container">
|
|
4
|
+
<div
|
|
5
|
+
class="radio-button-group-header"
|
|
6
|
+
[ngClass]="{
|
|
7
|
+
'disabled': disabled(),
|
|
8
|
+
'error': error(),
|
|
9
|
+
'read-only': readOnly(),
|
|
10
|
+
}">
|
|
11
|
+
<h3
|
|
12
|
+
*ngIf="showGroupTitle()"
|
|
13
|
+
class="group-title"
|
|
14
|
+
>
|
|
15
|
+
{{ groupTitle() }}
|
|
16
|
+
</h3>
|
|
17
|
+
<p
|
|
18
|
+
*ngIf="showHelpText()"
|
|
19
|
+
class="group-help-text"
|
|
20
|
+
>
|
|
21
|
+
{{ groupHelpText() }}
|
|
22
|
+
|
|
23
|
+
</p>
|
|
24
|
+
<p
|
|
25
|
+
*ngIf="error()"
|
|
26
|
+
class="group-error-message"
|
|
27
|
+
>
|
|
28
|
+
{{ errorMessage() }}
|
|
29
|
+
</p>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="radio-button-group"
|
|
32
|
+
[ngClass]="{'horizontal': direction() === 'horizontal', 'vertical': direction() === 'vertical'}">
|
|
33
|
+
<ng-container
|
|
34
|
+
*ngFor="let item of items()">
|
|
35
|
+
<rte-radio-button
|
|
36
|
+
[label]="item"
|
|
37
|
+
[groupName]="groupName()"
|
|
38
|
+
[showLabel]="showItemsLabel()"
|
|
39
|
+
[disabled]="disabled()"
|
|
40
|
+
[error]="error()"
|
|
41
|
+
[readOnly]="readOnly()"
|
|
42
|
+
/>
|
|
43
|
+
</ng-container>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
@use '@design-system-rte/core/tokens/main.scss' as *;
|
|
2
|
+
|
|
3
|
+
.radio-button-group-container {
|
|
4
|
+
display: flex;
|
|
5
|
+
padding: $positive-spacing_0;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
align-items: flex-start;
|
|
9
|
+
gap: $positive-spacing_100;
|
|
10
|
+
|
|
11
|
+
.radio-button-group-header {
|
|
12
|
+
|
|
13
|
+
.group-title {
|
|
14
|
+
@include typography-heading-s;
|
|
15
|
+
align-self: stretch;
|
|
16
|
+
margin: $positive-spacing_0;
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.group-help-text {
|
|
21
|
+
@include typography-text-m;
|
|
22
|
+
color: var(--content-tertiary);
|
|
23
|
+
align-self: stretch;
|
|
24
|
+
margin: $positive-spacing_0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.group-error-message {
|
|
28
|
+
@include typography-text-m-bold;
|
|
29
|
+
color: var(--content-danger);
|
|
30
|
+
align-self: stretch;
|
|
31
|
+
margin: $positive-spacing_0;
|
|
32
|
+
margin-top: $positive-spacing_050;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.error {
|
|
36
|
+
.group-title {
|
|
37
|
+
color: var(--content-danger);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.read-only {
|
|
42
|
+
.group-title {
|
|
43
|
+
color: var(--content-tertiary);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.error{
|
|
47
|
+
.group-title {
|
|
48
|
+
color: var(--content-danger);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.disabled {
|
|
54
|
+
|
|
55
|
+
pointer-events: none;
|
|
56
|
+
|
|
57
|
+
.group-title {
|
|
58
|
+
color: var(--content-disabled);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.group-help-text {
|
|
62
|
+
color: var(--content-disabled);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
.radio-button-group {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: row;
|
|
73
|
+
padding: $positive-spacing_0;
|
|
74
|
+
align-items: flex-start;
|
|
75
|
+
gap: $positive-spacing_300;
|
|
76
|
+
|
|
77
|
+
&.vertical {
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
gap: $positive-spacing_100;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/angular";
|
|
2
|
+
import { userEvent, within, expect } from "@storybook/test";
|
|
3
|
+
|
|
4
|
+
import { RadioButtonGroupComponent } from "./radio-button-group.component";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<RadioButtonGroupComponent> = {
|
|
7
|
+
title: "RadioButtonGroup",
|
|
8
|
+
component: RadioButtonGroupComponent,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
argTypes: {
|
|
11
|
+
groupName: {
|
|
12
|
+
control: "text",
|
|
13
|
+
defaultValue: "group1",
|
|
14
|
+
},
|
|
15
|
+
items: {
|
|
16
|
+
control: "object",
|
|
17
|
+
defaultValue: ["Option 1", "Option 2", "Option 3"],
|
|
18
|
+
},
|
|
19
|
+
direction: {
|
|
20
|
+
control: "select",
|
|
21
|
+
options: ["horizontal", "vertical"],
|
|
22
|
+
defaultValue: "horizontal",
|
|
23
|
+
},
|
|
24
|
+
showItemsLabel: {
|
|
25
|
+
control: "boolean",
|
|
26
|
+
defaultValue: true,
|
|
27
|
+
},
|
|
28
|
+
groupTitle: {
|
|
29
|
+
control: "text",
|
|
30
|
+
defaultValue: "Radio Button Group Title",
|
|
31
|
+
},
|
|
32
|
+
showGroupTitle: {
|
|
33
|
+
control: "boolean",
|
|
34
|
+
defaultValue: true,
|
|
35
|
+
},
|
|
36
|
+
groupHelpText: {
|
|
37
|
+
control: "text",
|
|
38
|
+
defaultValue: "This is a help text for the radio button group.",
|
|
39
|
+
},
|
|
40
|
+
showHelpText: {
|
|
41
|
+
control: "boolean",
|
|
42
|
+
defaultValue: true,
|
|
43
|
+
},
|
|
44
|
+
errorMessage: {
|
|
45
|
+
control: "text",
|
|
46
|
+
defaultValue: "This is an error message. Please select an option.",
|
|
47
|
+
},
|
|
48
|
+
error: {
|
|
49
|
+
control: "boolean",
|
|
50
|
+
defaultValue: false,
|
|
51
|
+
},
|
|
52
|
+
disabled: {
|
|
53
|
+
control: "boolean",
|
|
54
|
+
defaultValue: false,
|
|
55
|
+
},
|
|
56
|
+
readOnly: {
|
|
57
|
+
control: "boolean",
|
|
58
|
+
defaultValue: false,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
export default meta;
|
|
63
|
+
type Story = StoryObj<RadioButtonGroupComponent>;
|
|
64
|
+
|
|
65
|
+
export const Default: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
groupName: "group1",
|
|
68
|
+
items: ["Option 1", "Option 2", "Option 3"],
|
|
69
|
+
direction: "horizontal",
|
|
70
|
+
showItemsLabel: true,
|
|
71
|
+
groupTitle: "Radio Button Group Title",
|
|
72
|
+
showGroupTitle: true,
|
|
73
|
+
groupHelpText: "This is a help text for the radio button group.",
|
|
74
|
+
showHelpText: true,
|
|
75
|
+
errorMessage: "This is an error message. Please select an option.",
|
|
76
|
+
error: false,
|
|
77
|
+
disabled: false,
|
|
78
|
+
readOnly: false,
|
|
79
|
+
},
|
|
80
|
+
play: async ({ canvasElement }) => {
|
|
81
|
+
const canvas = within(canvasElement);
|
|
82
|
+
const radioButton = canvas.getByLabelText("Option 1");
|
|
83
|
+
await userEvent.click(radioButton);
|
|
84
|
+
expect(radioButton).toBeChecked();
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const Disabled: Story = {
|
|
89
|
+
args: {
|
|
90
|
+
...Default.args,
|
|
91
|
+
disabled: true,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const Error: Story = {
|
|
96
|
+
args: {
|
|
97
|
+
...Default.args,
|
|
98
|
+
error: true,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const ReadOnly: Story = {
|
|
103
|
+
args: {
|
|
104
|
+
...Default.args,
|
|
105
|
+
readOnly: true,
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const Vertical: Story = {
|
|
110
|
+
args: {
|
|
111
|
+
...Default.args,
|
|
112
|
+
direction: "vertical",
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export const Horizontal: Story = {
|
|
117
|
+
args: {
|
|
118
|
+
...Default.args,
|
|
119
|
+
direction: "horizontal",
|
|
120
|
+
},
|
|
121
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CommonModule } from "@angular/common";
|
|
2
|
+
import { Component, computed, input } from "@angular/core";
|
|
3
|
+
|
|
4
|
+
import { RadioButtonComponent } from "../radio-button/radio-button.component";
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: "rte-radio-button-group",
|
|
8
|
+
imports: [CommonModule, RadioButtonComponent],
|
|
9
|
+
standalone: true,
|
|
10
|
+
templateUrl: "./radio-button-group.component.html",
|
|
11
|
+
styleUrl: "./radio-button-group.component.scss",
|
|
12
|
+
})
|
|
13
|
+
export class RadioButtonGroupComponent {
|
|
14
|
+
readonly groupName = input("");
|
|
15
|
+
readonly items = input<string[]>([]);
|
|
16
|
+
readonly direction = input("horizontal");
|
|
17
|
+
readonly showItemsLabel = input(true);
|
|
18
|
+
readonly groupTitle = input("");
|
|
19
|
+
readonly showGroupTitle = input(false);
|
|
20
|
+
readonly groupHelpText = input("");
|
|
21
|
+
readonly showHelpText = input(false);
|
|
22
|
+
readonly errorMessage = input("");
|
|
23
|
+
readonly error = input(false);
|
|
24
|
+
readonly disabled = input(false);
|
|
25
|
+
readonly readOnly = input(false);
|
|
26
|
+
|
|
27
|
+
readonly isDisplayed = computed(() => !(this.disabled() && this.error()));
|
|
28
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
@use '@design-system-rte/core/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
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|