@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,126 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/angular";
|
|
2
|
-
import { userEvent, within, expect } from "@storybook/test";
|
|
3
|
-
|
|
4
|
-
import { CheckboxComponent } from "./checkbox.component";
|
|
5
|
-
|
|
6
|
-
const meta: Meta<CheckboxComponent> = {
|
|
7
|
-
title: "Checkbox",
|
|
8
|
-
component: CheckboxComponent,
|
|
9
|
-
tags: ["autodocs"],
|
|
10
|
-
argTypes: {
|
|
11
|
-
label: {
|
|
12
|
-
control: "text",
|
|
13
|
-
defaultValue: "Label",
|
|
14
|
-
},
|
|
15
|
-
description: {
|
|
16
|
-
control: "text",
|
|
17
|
-
defaultValue: "Description",
|
|
18
|
-
},
|
|
19
|
-
showLabel: {
|
|
20
|
-
control: "boolean",
|
|
21
|
-
defaultValue: true,
|
|
22
|
-
},
|
|
23
|
-
disabled: {
|
|
24
|
-
control: "boolean",
|
|
25
|
-
defaultValue: false,
|
|
26
|
-
},
|
|
27
|
-
indeterminate: {
|
|
28
|
-
control: "boolean",
|
|
29
|
-
defaultValue: false,
|
|
30
|
-
},
|
|
31
|
-
errorMessage: {
|
|
32
|
-
control: "text",
|
|
33
|
-
defaultValue: "",
|
|
34
|
-
},
|
|
35
|
-
readOnly: {
|
|
36
|
-
control: "boolean",
|
|
37
|
-
defaultValue: false,
|
|
38
|
-
},
|
|
39
|
-
checked: {
|
|
40
|
-
control: "boolean",
|
|
41
|
-
defaultValue: false,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
export default meta;
|
|
46
|
-
type Story = StoryObj<CheckboxComponent>;
|
|
47
|
-
|
|
48
|
-
export const Default: Story = {
|
|
49
|
-
args: {
|
|
50
|
-
id: "my-checkbox",
|
|
51
|
-
label: "Label",
|
|
52
|
-
description: "Description",
|
|
53
|
-
disabled: false,
|
|
54
|
-
readOnly: false,
|
|
55
|
-
showLabel: true,
|
|
56
|
-
indeterminate: false,
|
|
57
|
-
errorMessage: "",
|
|
58
|
-
},
|
|
59
|
-
play: async ({ canvasElement }) => {
|
|
60
|
-
const canvas = within(canvasElement);
|
|
61
|
-
const checkbox = canvas.getByRole("checkbox");
|
|
62
|
-
await userEvent.click(checkbox);
|
|
63
|
-
expect(checkbox).toBeChecked();
|
|
64
|
-
checkbox.blur();
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const Disabled: Story = {
|
|
69
|
-
args: {
|
|
70
|
-
...Default.args,
|
|
71
|
-
disabled: true,
|
|
72
|
-
},
|
|
73
|
-
play: async ({ canvasElement }) => {
|
|
74
|
-
const canvas = within(canvasElement);
|
|
75
|
-
const checkbox = canvas.getByRole("checkbox");
|
|
76
|
-
expect(checkbox).toBeDisabled();
|
|
77
|
-
await userEvent.click(checkbox);
|
|
78
|
-
expect(checkbox).not.toBeChecked();
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const Indeterminated: Story = {
|
|
83
|
-
args: {
|
|
84
|
-
...Default.args,
|
|
85
|
-
indeterminate: true,
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export const ReadOnly: Story = {
|
|
90
|
-
args: {
|
|
91
|
-
...Default.args,
|
|
92
|
-
readOnly: true,
|
|
93
|
-
checked: true,
|
|
94
|
-
},
|
|
95
|
-
play: async ({ canvasElement }) => {
|
|
96
|
-
const canvas = within(canvasElement);
|
|
97
|
-
const checkbox = canvas.getByRole("checkbox");
|
|
98
|
-
await userEvent.keyboard(`{Tab}`);
|
|
99
|
-
expect(checkbox).toHaveFocus();
|
|
100
|
-
await userEvent.keyboard(`{ }`);
|
|
101
|
-
expect(checkbox).toBeChecked();
|
|
102
|
-
checkbox.blur();
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export const Error: Story = {
|
|
107
|
-
args: {
|
|
108
|
-
...Default.args,
|
|
109
|
-
errorMessage: "Error message",
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export const KeyboardInteractions: Story = {
|
|
114
|
-
args: {
|
|
115
|
-
...Default.args,
|
|
116
|
-
},
|
|
117
|
-
play: async ({ canvasElement }) => {
|
|
118
|
-
const canvas = within(canvasElement);
|
|
119
|
-
const checkbox = canvas.getByRole("checkbox");
|
|
120
|
-
await userEvent.keyboard(`{Tab}`);
|
|
121
|
-
expect(checkbox).toHaveFocus();
|
|
122
|
-
await userEvent.keyboard(`{ }`);
|
|
123
|
-
expect(checkbox).toBeChecked();
|
|
124
|
-
checkbox.blur();
|
|
125
|
-
},
|
|
126
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
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-checkbox",
|
|
8
|
-
imports: [CommonModule, IconComponent],
|
|
9
|
-
standalone: true,
|
|
10
|
-
templateUrl: "./checkbox.component.html",
|
|
11
|
-
styleUrl: "./checkbox.component.scss",
|
|
12
|
-
})
|
|
13
|
-
export class CheckboxComponent {
|
|
14
|
-
readonly id = input.required<string>();
|
|
15
|
-
readonly label = input.required<string>();
|
|
16
|
-
readonly value = input("");
|
|
17
|
-
readonly indeterminate = input(false);
|
|
18
|
-
readonly description = input("");
|
|
19
|
-
readonly showLabel = input(true);
|
|
20
|
-
readonly disabled = input(false);
|
|
21
|
-
readonly error = input(false);
|
|
22
|
-
readonly errorMessage = input("");
|
|
23
|
-
readonly readOnly = input(false);
|
|
24
|
-
readonly checked = input(false);
|
|
25
|
-
readonly groupName = input("");
|
|
26
|
-
|
|
27
|
-
onKeydown(event: KeyboardEvent) {
|
|
28
|
-
if (event.code === "Space") {
|
|
29
|
-
if (this.readOnly()) {
|
|
30
|
-
event.preventDefault();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<div
|
|
2
|
-
*ngIf="isDisplayed()"
|
|
3
|
-
class="checkbox-group-container">
|
|
4
|
-
<div
|
|
5
|
-
class="checkbox-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="checkbox-group"
|
|
32
|
-
[ngClass]="{'horizontal': direction() === 'horizontal', 'vertical': direction() === 'vertical'}">
|
|
33
|
-
<ng-container
|
|
34
|
-
*ngFor="let item of items(); let i = index">
|
|
35
|
-
<rte-checkbox
|
|
36
|
-
[id]="item + '-' + i"
|
|
37
|
-
[label]="item"
|
|
38
|
-
[groupName]="groupName()"
|
|
39
|
-
[showLabel]="showItemsLabel()"
|
|
40
|
-
[disabled]="disabled()"
|
|
41
|
-
[error]="error()"
|
|
42
|
-
[readOnly]="readOnly()"
|
|
43
|
-
/>
|
|
44
|
-
</ng-container>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
@use '@design-system-rte/core/design-tokens/main.scss' as *;
|
|
2
|
-
|
|
3
|
-
.checkbox-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
|
-
.checkbox-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
|
-
.checkbox-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
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/angular";
|
|
2
|
-
import { userEvent, within, expect } from "@storybook/test";
|
|
3
|
-
|
|
4
|
-
import { CheckboxGroupComponent } from "./checkbox-group.component";
|
|
5
|
-
|
|
6
|
-
const meta: Meta<CheckboxGroupComponent> = {
|
|
7
|
-
title: "CheckboxGroup",
|
|
8
|
-
component: CheckboxGroupComponent,
|
|
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: "Checkbox 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 checkbox 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<CheckboxGroupComponent>;
|
|
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: "Checkbox Title",
|
|
72
|
-
showGroupTitle: true,
|
|
73
|
-
groupHelpText: "This is a help text for the checkbox 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
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from "@angular/common";
|
|
2
|
-
import { Component, computed, input } from "@angular/core";
|
|
3
|
-
|
|
4
|
-
import { CheckboxComponent } from "../checkbox/checkbox.component";
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: "rte-checkbox-group",
|
|
8
|
-
imports: [CommonModule, CheckboxComponent],
|
|
9
|
-
standalone: true,
|
|
10
|
-
templateUrl: "./checkbox-group.component.html",
|
|
11
|
-
styleUrl: "./checkbox-group.component.scss",
|
|
12
|
-
})
|
|
13
|
-
export class CheckboxGroupComponent {
|
|
14
|
-
readonly groupName = input.required<string>();
|
|
15
|
-
readonly items = input.required<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
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Directive, HostBinding, input } from "@angular/core";
|
|
2
|
-
|
|
3
|
-
@Directive({
|
|
4
|
-
selector: "[dsCol]",
|
|
5
|
-
standalone: true,
|
|
6
|
-
})
|
|
7
|
-
export class ColDirective {
|
|
8
|
-
readonly xxs = input<number>();
|
|
9
|
-
readonly xs = input<number>();
|
|
10
|
-
readonly s = input<number>();
|
|
11
|
-
readonly m = input<number>();
|
|
12
|
-
readonly l = input<number>();
|
|
13
|
-
readonly xl = input<number>();
|
|
14
|
-
|
|
15
|
-
@HostBinding("class")
|
|
16
|
-
get colClasses(): string {
|
|
17
|
-
return [
|
|
18
|
-
"col",
|
|
19
|
-
this.generateColumnClass("col-xxs", this.xxs()),
|
|
20
|
-
this.generateColumnClass("col-xs", this.xs()),
|
|
21
|
-
this.generateColumnClass("col-s", this.s()),
|
|
22
|
-
this.generateColumnClass("col-m", this.m()),
|
|
23
|
-
this.generateColumnClass("col-l", this.l()),
|
|
24
|
-
this.generateColumnClass("col-xl", this.xl()),
|
|
25
|
-
]
|
|
26
|
-
.filter(Boolean)
|
|
27
|
-
.join(" ");
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
constructor() {}
|
|
31
|
-
|
|
32
|
-
private generateColumnClass(prefix: string, size?: number): string {
|
|
33
|
-
return size ? `${prefix}-${size}` : "";
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from "@angular/common";
|
|
2
|
-
import { GridType } from "@design-system-rte/core/components/grid/grid.interface";
|
|
3
|
-
import { componentWrapperDecorator, moduleMetadata, type Meta, type StoryObj } from "@storybook/angular";
|
|
4
|
-
|
|
5
|
-
import { ColDirective } from "./col/col.directive";
|
|
6
|
-
import { GridDirective } from "./grid.directive";
|
|
7
|
-
|
|
8
|
-
type GridStoriesArgs = GridDirective;
|
|
9
|
-
|
|
10
|
-
const COLUMN_NUMBER = 12;
|
|
11
|
-
|
|
12
|
-
const meta: Meta<GridStoriesArgs> = {
|
|
13
|
-
title: "Grid",
|
|
14
|
-
component: GridDirective,
|
|
15
|
-
tags: ["autodocs"],
|
|
16
|
-
argTypes: {
|
|
17
|
-
gridType: {
|
|
18
|
-
control: "select",
|
|
19
|
-
defaultValue: (args: GridStoriesArgs) => args.gridType,
|
|
20
|
-
options: ["fluid", "fixed-narrow", "fixed-wide"],
|
|
21
|
-
description: "The type of grid to use",
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
decorators: [
|
|
25
|
-
moduleMetadata({
|
|
26
|
-
imports: [CommonModule, ColDirective],
|
|
27
|
-
}),
|
|
28
|
-
componentWrapperDecorator((story) => `<div class="sb-css-grid-container">${story}</div>`),
|
|
29
|
-
],
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default meta;
|
|
33
|
-
type Story = StoryObj<GridStoriesArgs>;
|
|
34
|
-
|
|
35
|
-
const defaultTemplate = (gridType: GridType) => {
|
|
36
|
-
return `
|
|
37
|
-
<div rte-grid
|
|
38
|
-
[gridType]="'${gridType}'"
|
|
39
|
-
data-testid="grid"
|
|
40
|
-
>
|
|
41
|
-
<ng-container *ngFor="let item of items">
|
|
42
|
-
<div
|
|
43
|
-
dsCol
|
|
44
|
-
></div>
|
|
45
|
-
</ng-container>
|
|
46
|
-
</div>
|
|
47
|
-
`;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const Fluid: Story = {
|
|
51
|
-
args: {
|
|
52
|
-
gridType: "fluid",
|
|
53
|
-
},
|
|
54
|
-
render: (args) => ({
|
|
55
|
-
props: {
|
|
56
|
-
...args,
|
|
57
|
-
items: Array.from(Array(COLUMN_NUMBER)).map((_, i) => i + 1),
|
|
58
|
-
},
|
|
59
|
-
template: defaultTemplate(args.gridType),
|
|
60
|
-
}),
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const FixedWide: Story = {
|
|
64
|
-
args: {
|
|
65
|
-
gridType: "fixed-wide",
|
|
66
|
-
},
|
|
67
|
-
render: (args) => ({
|
|
68
|
-
props: {
|
|
69
|
-
...args,
|
|
70
|
-
items: Array.from(Array(COLUMN_NUMBER)).map((_, i) => i + 1),
|
|
71
|
-
},
|
|
72
|
-
template: defaultTemplate(args.gridType),
|
|
73
|
-
}),
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const FixedNarrow: Story = {
|
|
77
|
-
args: {
|
|
78
|
-
gridType: "fixed-narrow",
|
|
79
|
-
},
|
|
80
|
-
render: (args) => ({
|
|
81
|
-
props: {
|
|
82
|
-
...args,
|
|
83
|
-
items: Array.from(Array(COLUMN_NUMBER)).map((_, i) => i + 1),
|
|
84
|
-
},
|
|
85
|
-
template: defaultTemplate(args.gridType),
|
|
86
|
-
}),
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export const ResponsiveColumns: Story = {
|
|
90
|
-
args: {
|
|
91
|
-
gridType: "fluid",
|
|
92
|
-
},
|
|
93
|
-
render: (args) => ({
|
|
94
|
-
template: `
|
|
95
|
-
<div rte-grid
|
|
96
|
-
[gridType]="'${args.gridType}'"
|
|
97
|
-
data-testid="grid"
|
|
98
|
-
>
|
|
99
|
-
<div dsCol [xxs]=1 [xs]=1 [s]=3 [m]=4 [l]=4 [xl]=12>
|
|
100
|
-
<div>
|
|
101
|
-
<p>xxs : Span 1 de 2</p>
|
|
102
|
-
<p>xs : Span 1 de 6</p>
|
|
103
|
-
<p>s : Span 3 de 6</p>
|
|
104
|
-
</div>
|
|
105
|
-
<div>
|
|
106
|
-
<p>m : Span 4 de 12</p>
|
|
107
|
-
<p>l : Span 4 de 12</p>
|
|
108
|
-
<p>xl : Span 12 de 12</p>
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
<div dsCol [xxs]=1 [xs]=3 [s]=3 [m]=4 [l]=8 [xl]=12>
|
|
112
|
-
<div>
|
|
113
|
-
<p>xxs : Span 1 de 2</p>
|
|
114
|
-
<p>xs : Span 3 de 6</p>
|
|
115
|
-
<p>s : Span 3 de 6</p>
|
|
116
|
-
</div>
|
|
117
|
-
<div>
|
|
118
|
-
<p>m : Span 4 de 12</p>
|
|
119
|
-
<p>l : Span 8 de 12</p>
|
|
120
|
-
<p>xl : Span 12 de 12</p>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
<div dsCol [xxs]=2 [xs]=2 [s]=3 [m]=4 [l]=10 [xl]=12>
|
|
124
|
-
<div>
|
|
125
|
-
<p>xxs : Span 2 de 2</p>
|
|
126
|
-
<p>xs : Span 2 de 6</p>
|
|
127
|
-
<p>s : Span 3 de 6</p>
|
|
128
|
-
</div>
|
|
129
|
-
<div>
|
|
130
|
-
<p>m : Span 4 de 12</p>
|
|
131
|
-
<p>l : Span 10 de 12</p>
|
|
132
|
-
<p>xl : Span 12 de 12</p>
|
|
133
|
-
</div>
|
|
134
|
-
</div>
|
|
135
|
-
<div dsCol [xxs]=2 [xs]=6 [s]=6 [m]=4 [l]=12 [xl]=12>
|
|
136
|
-
<div>
|
|
137
|
-
<p>xxs : Span 2 de 2</p>
|
|
138
|
-
<p>xs : Span 6 de 6</p>
|
|
139
|
-
<p>s : Span 6 de 6</p>
|
|
140
|
-
</div>
|
|
141
|
-
<div>
|
|
142
|
-
<p>m : Span 4 de 12</p>
|
|
143
|
-
<p>l : Span 12 de 12</p>
|
|
144
|
-
<p>xl : Span 12 de 12</p>
|
|
145
|
-
</div>
|
|
146
|
-
</div>
|
|
147
|
-
</div>
|
|
148
|
-
`,
|
|
149
|
-
}),
|
|
150
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Directive, HostBinding, input } from "@angular/core";
|
|
2
|
-
import { GridType } from "@design-system-rte/core/components/grid/grid.interface";
|
|
3
|
-
|
|
4
|
-
@Directive({
|
|
5
|
-
selector: "[rte-grid]",
|
|
6
|
-
standalone: true,
|
|
7
|
-
})
|
|
8
|
-
export class GridDirective {
|
|
9
|
-
readonly gridType = input<GridType>("fluid");
|
|
10
|
-
|
|
11
|
-
@HostBinding("class")
|
|
12
|
-
get hostClasses(): string {
|
|
13
|
-
return "grid";
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@HostBinding("attr.data-gridtype")
|
|
17
|
-
get hostDataClasses(): string {
|
|
18
|
-
const variation = this.gridType();
|
|
19
|
-
return `${variation}`;
|
|
20
|
-
}
|
|
21
|
-
constructor() {}
|
|
22
|
-
}
|