@design-system-rte/angular 0.2.0-rc2 → 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,34 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
@use '@design-system-rte/core/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
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
}
|