@design-system-rte/angular 0.4.4 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/esm2022/design-system-rte-angular.mjs +5 -0
  2. package/esm2022/lib/components/button/button.component.mjs +26 -0
  3. package/esm2022/lib/components/checkbox/checkbox.component.mjs +35 -0
  4. package/esm2022/lib/components/checkbox-group/checkbox-group.component.mjs +29 -0
  5. package/esm2022/lib/components/grid/col/col.directive.mjs +41 -0
  6. package/esm2022/lib/components/grid/grid.directive.mjs +30 -0
  7. package/esm2022/lib/components/icon/icon-map.mjs +303 -0
  8. package/esm2022/lib/components/icon/icon.component.mjs +39 -0
  9. package/esm2022/lib/components/icon/icon.service.mjs +33 -0
  10. package/esm2022/lib/components/link/link.component.mjs +20 -0
  11. package/esm2022/lib/components/radio-button/radio-button.component.mjs +24 -0
  12. package/esm2022/lib/components/radio-button-group/radio-button-group.component.mjs +29 -0
  13. package/esm2022/public-api.mjs +10 -0
  14. package/fesm2022/design-system-rte-angular.mjs +583 -0
  15. package/fesm2022/design-system-rte-angular.mjs.map +1 -0
  16. package/index.d.ts +5 -0
  17. package/lib/components/button/button.component.d.ts +17 -0
  18. package/lib/components/checkbox/checkbox.component.d.ts +18 -0
  19. package/lib/components/checkbox-group/checkbox-group.component.d.ts +18 -0
  20. package/lib/components/grid/col/col.directive.d.ts +14 -0
  21. package/lib/components/grid/grid.directive.d.ts +10 -0
  22. package/lib/components/icon/icon-map.d.ts +301 -0
  23. package/lib/components/icon/icon.component.d.ts +21 -0
  24. package/lib/components/icon/icon.service.d.ts +11 -0
  25. package/lib/components/link/link.component.d.ts +9 -0
  26. package/lib/components/radio-button/radio-button.component.d.ts +13 -0
  27. package/lib/components/radio-button-group/radio-button-group.component.d.ts +18 -0
  28. package/package.json +15 -4
  29. package/CHANGELOG.md +0 -25
  30. package/ng-package.json +0 -10
  31. package/src/lib/components/button/button.component.html +0 -10
  32. package/src/lib/components/button/button.component.scss +0 -154
  33. package/src/lib/components/button/button.component.spec.ts +0 -22
  34. package/src/lib/components/button/button.component.stories.ts +0 -99
  35. package/src/lib/components/button/button.component.ts +0 -28
  36. package/src/lib/components/checkbox/checkbox.component.html +0 -31
  37. package/src/lib/components/checkbox/checkbox.component.scss +0 -176
  38. package/src/lib/components/checkbox/checkbox.component.stories.ts +0 -126
  39. package/src/lib/components/checkbox/checkbox.component.ts +0 -34
  40. package/src/lib/components/checkbox-group/checkbox-group.component.html +0 -46
  41. package/src/lib/components/checkbox-group/checkbox-group.component.scss +0 -82
  42. package/src/lib/components/checkbox-group/checkbox-group.component.stories.ts +0 -121
  43. package/src/lib/components/checkbox-group/checkbox-group.component.ts +0 -28
  44. package/src/lib/components/grid/col/col.directive.ts +0 -35
  45. package/src/lib/components/grid/grid.directive.stories.ts +0 -150
  46. package/src/lib/components/grid/grid.directive.ts +0 -22
  47. package/src/lib/components/icon/icon-map.ts +0 -305
  48. package/src/lib/components/icon/icon.component.html +0 -1
  49. package/src/lib/components/icon/icon.component.scss +0 -3
  50. package/src/lib/components/icon/icon.component.ts +0 -58
  51. package/src/lib/components/icon/icon.service.ts +0 -33
  52. package/src/lib/components/icon/icon.stories.ts +0 -84
  53. package/src/lib/components/icon-button/icon-button.component.html +0 -16
  54. package/src/lib/components/icon-button/icon-button.component.scss +0 -165
  55. package/src/lib/components/icon-button/icon-button.component.ts +0 -40
  56. package/src/lib/components/icon-button/icon-button.stories.ts +0 -200
  57. package/src/lib/components/icon-button-toggle/icon-button-toggle.component.html +0 -12
  58. package/src/lib/components/icon-button-toggle/icon-button-toggle.component.ts +0 -36
  59. package/src/lib/components/icon-button-toggle/icon-button-toggle.stories.ts +0 -197
  60. package/src/lib/components/link/link.component.html +0 -6
  61. package/src/lib/components/link/link.component.scss +0 -108
  62. package/src/lib/components/link/link.component.stories.ts +0 -61
  63. package/src/lib/components/link/link.component.ts +0 -18
  64. package/src/lib/components/radio-button/radio-button.component.html +0 -24
  65. package/src/lib/components/radio-button/radio-button.component.scss +0 -135
  66. package/src/lib/components/radio-button/radio-button.component.stories.ts +0 -76
  67. package/src/lib/components/radio-button/radio-button.component.ts +0 -22
  68. package/src/lib/components/radio-button-group/radio-button-group.component.html +0 -45
  69. package/src/lib/components/radio-button-group/radio-button-group.component.scss +0 -82
  70. package/src/lib/components/radio-button-group/radio-button-group.component.stories.ts +0 -121
  71. package/src/lib/components/radio-button-group/radio-button-group.component.ts +0 -28
  72. package/src/lib/components/split-button/split-button.component.html +0 -56
  73. package/src/lib/components/split-button/split-button.component.scss +0 -288
  74. package/src/lib/components/split-button/split-button.component.stories.ts +0 -227
  75. package/src/lib/components/split-button/split-button.component.ts +0 -55
  76. package/src/lib/components/tooltip/tooltip.component.html +0 -7
  77. package/src/lib/components/tooltip/tooltip.component.scss +0 -116
  78. package/src/lib/components/tooltip/tooltip.component.ts +0 -16
  79. package/src/lib/components/tooltip/tooltip.directive.stories.ts +0 -218
  80. package/src/lib/components/tooltip/tooltip.directive.ts +0 -187
  81. package/tsconfig.lib.json +0 -20
  82. package/tsconfig.lib.prod.json +0 -10
  83. package/tsconfig.spec.json +0 -14
  84. /package/{src/public-api.ts → public-api.d.ts} +0 -0
@@ -1,40 +0,0 @@
1
- import { CommonModule } from "@angular/common";
2
- import { ChangeDetectionStrategy, Component, computed, input, output } from "@angular/core";
3
- import { ButtonType } from "@design-system-rte/core/components/button/button.interface";
4
- import { ButtonSize, ButtonVariant } from "@design-system-rte/core/components/button/common/common-button";
5
- import { buttonIconSize } from "@design-system-rte/core/components/button/common/common-button.constants";
6
-
7
- import { isValidIconName } from "../icon/icon-map";
8
- import { IconComponent } from "../icon/icon.component";
9
- import { RegularIconIdKey, TogglableIconIdKey } from "../icon/icon.service";
10
-
11
- @Component({
12
- selector: "rte-icon-button",
13
- imports: [CommonModule, IconComponent],
14
- standalone: true,
15
- templateUrl: "./icon-button.component.html",
16
- styleUrl: "./icon-button.component.scss",
17
- changeDetection: ChangeDetectionStrategy.OnPush,
18
- })
19
- export class IconButtonComponent {
20
- readonly disabled = input<boolean>(false);
21
- readonly name = input.required<RegularIconIdKey | TogglableIconIdKey>();
22
- readonly size = input<ButtonSize>("m");
23
- readonly variant = input<ButtonVariant>("primary");
24
- readonly type = input<ButtonType>("button");
25
- readonly appearance = input<"outlined" | "filled">("outlined");
26
- readonly compactSpacing = input<boolean>(false);
27
- readonly ariaLabel = input<string | undefined>(undefined);
28
- readonly ariaLabelledBy = input<string | undefined>(undefined);
29
-
30
- readonly buttonIconSize = computed(() => buttonIconSize[this.size()]);
31
-
32
- readonly isValidIconName = computed(() => isValidIconName(this.name()));
33
-
34
- readonly click = output<MouseEvent | KeyboardEvent>();
35
-
36
- onClick(event: MouseEvent | KeyboardEvent): void {
37
- event.stopPropagation();
38
- this.click.emit(event);
39
- }
40
- }
@@ -1,200 +0,0 @@
1
- import { ENTER_KEY, SPACE_KEY, TAB_KEY } from "@design-system-rte/core/constants/keyboard.constants";
2
- import { Meta, StoryObj } from "@storybook/angular";
3
- import { fn, userEvent, within, expect } from "@storybook/test";
4
-
5
- import { regularIcons as RegularIconsList, togglableIcons as TogglableIconsList } from "../icon/icon-map";
6
-
7
- import { IconButtonComponent } from "./icon-button.component";
8
-
9
- const RegularIconIds = Object.keys(RegularIconsList);
10
- const TogglableIconIds = Object.keys(TogglableIconsList);
11
-
12
- const meta = {
13
- title: "IconButton",
14
- component: IconButtonComponent,
15
- tags: ["autodocs"],
16
- argTypes: {
17
- name: {
18
- control: "select",
19
- options: [...RegularIconIds, ...TogglableIconIds].sort((a, b) => a.localeCompare(b)),
20
- description: "Nom de l’icône à afficher",
21
- defaultValue: "check",
22
- },
23
- variant: {
24
- control: "select",
25
- options: ["primary", "secondary", "text", "transparent", "danger"],
26
- },
27
- appearance: {
28
- control: "select",
29
- options: ["outlined", "filled"],
30
- description: "Apparence de l’icône (pour les icônes togglables)",
31
- defaultValue: "outlined",
32
- },
33
- size: {
34
- control: "select",
35
- options: ["s", "m", "l"],
36
- },
37
- compactSpacing: {
38
- control: "boolean",
39
- description: "Utiliser un espacement compact",
40
- },
41
- disabled: {
42
- control: "boolean",
43
- },
44
- },
45
- } satisfies Meta<IconButtonComponent>;
46
-
47
- export default meta;
48
-
49
- type Story = StoryObj<IconButtonComponent>;
50
-
51
- const mockFn = fn();
52
-
53
- export const Default: Story = {
54
- args: {
55
- name: "settings",
56
- size: "m",
57
- appearance: "outlined",
58
- disabled: false,
59
- compactSpacing: false,
60
- variant: "primary",
61
- ariaLabel: "icon button aria label",
62
- click: mockFn,
63
- },
64
-
65
- play: async ({ canvasElement }) => {
66
- const canvas = within(canvasElement);
67
- const iconButton = canvas.getByRole("button");
68
- await userEvent.click(iconButton);
69
- expect(mockFn).toHaveBeenCalled();
70
- iconButton.blur();
71
- },
72
- };
73
-
74
- export const Sizing: Story = {
75
- args: {
76
- ...Default.args,
77
- compactSpacing: false,
78
- },
79
- render: (args) => ({
80
- props: { ...args },
81
- template: `
82
- <div style="display: flex; gap: 8px">
83
- <rte-icon-button
84
- size="s"
85
- name=${args.name}
86
- data-testid="small-icon-button"
87
- [compactSpacing]="${args.compactSpacing}"
88
- [disabled]="${args.disabled}"
89
- [appearance]="${args.appearance}"
90
- [ariaLabel]="'Small Icon Button'"
91
- [type]="'${args.type}'"
92
- [variant]="'${args.variant}'"
93
- />
94
- <rte-icon-button
95
- name=${args.name}
96
- data-testid="medium-icon-button"
97
- [compactSpacing]="${args.compactSpacing}"
98
- [disabled]="${args.disabled}"
99
- [appearance]="${args.appearance}"
100
- [ariaLabel]="'Small Icon Button'"
101
- [type]="'${args.type}'"
102
- [variant]="'${args.variant}'"
103
- />
104
- <rte-icon-button
105
- size="l"
106
- name=${args.name}
107
- data-testid="large-icon-button"
108
- [compactSpacing]="${args.compactSpacing}"
109
- [disabled]="${args.disabled}"
110
- [appearance]="${args.appearance}"
111
- [ariaLabel]="'Small Icon Button'"
112
- [type]="'${args.type}'"
113
- [variant]="'${args.variant}'"
114
- />
115
- </div>
116
- `,
117
- }),
118
- play: async ({ canvasElement }) => {
119
- const canvas = within(canvasElement);
120
- const smallIconButton = canvas.getByTestId("small-icon-button").getElementsByTagName("button")[0];
121
- const mediumIconButton = canvas.getByTestId("medium-icon-button").getElementsByTagName("button")[0];
122
- const largeIconButton = canvas.getByTestId("large-icon-button").getElementsByTagName("button")[0];
123
-
124
- expect(smallIconButton.clientHeight).toBe(24);
125
- expect(mediumIconButton.clientHeight).toBe(32);
126
- expect(largeIconButton.clientHeight).toBe(40);
127
- },
128
- };
129
-
130
- export const CompactSizing: Story = {
131
- args: {
132
- ...Default.args,
133
- compactSpacing: true,
134
- },
135
- render: (args) => ({
136
- props: { ...args },
137
- template: `
138
- <div style="display: flex; gap: 8px">
139
- <rte-icon-button
140
- size="s"
141
- name=${args.name}
142
- data-testid="small-icon-button"
143
- [compactSpacing]="${args.compactSpacing}"
144
- [disabled]="${args.disabled}"
145
- [appearance]="${args.appearance}"
146
- [ariaLabel]="'Small Icon Button'"
147
- [type]="'${args.type}'"
148
- [variant]="'${args.variant}'"
149
- />
150
- <rte-icon-button
151
- name=${args.name}
152
- data-testid="medium-icon-button"
153
- [compactSpacing]="${args.compactSpacing}"
154
- [disabled]="${args.disabled}"
155
- [appearance]="${args.appearance}"
156
- [ariaLabel]="'Small Icon Button'"
157
- [type]="'${args.type}'"
158
- [variant]="'${args.variant}'"
159
- />
160
- <rte-icon-button
161
- size="l"
162
- name=${args.name}
163
- data-testid="large-icon-button"
164
- [compactSpacing]="${args.compactSpacing}"
165
- [disabled]="${args.disabled}"
166
- [appearance]="${args.appearance}"
167
- [ariaLabel]="'Small Icon Button'"
168
- [type]="'${args.type}'"
169
- [variant]="'${args.variant}'"
170
- />
171
- </div>
172
- `,
173
- }),
174
- play: async ({ canvasElement }) => {
175
- const canvas = within(canvasElement);
176
- const smallIconButton = canvas.getByTestId("small-icon-button").getElementsByTagName("button")[0];
177
- const mediumIconButton = canvas.getByTestId("medium-icon-button").getElementsByTagName("button")[0];
178
- const largeIconButton = canvas.getByTestId("large-icon-button").getElementsByTagName("button")[0];
179
-
180
- expect(smallIconButton.clientHeight).toBe(16);
181
- expect(mediumIconButton.clientHeight).toBe(20);
182
- expect(largeIconButton.clientHeight).toBe(24);
183
- },
184
- };
185
-
186
- export const KeyboardInteraction: Story = {
187
- args: {
188
- ...Default.args,
189
- },
190
- play: async ({ canvasElement }) => {
191
- const canvas = within(canvasElement);
192
- const button = canvas.getByRole("button");
193
- await userEvent.keyboard(TAB_KEY);
194
- expect(button).toHaveFocus();
195
- await userEvent.keyboard(ENTER_KEY);
196
- await userEvent.keyboard(SPACE_KEY);
197
- expect(mockFn).toHaveBeenCalledTimes(2);
198
- button.blur();
199
- },
200
- };
@@ -1,12 +0,0 @@
1
- <rte-icon-button
2
- [size]="size()"
3
- [name]="name()"
4
- [compactSpacing]="compactSpacing()"
5
- [disabled]="disabled()"
6
- [ariaLabel]="ariaLabel()"
7
- [ariaLabelledBy]="ariaLabelledBy()"
8
- [type]="type()"
9
- [variant]="variant()"
10
- [appearance]="selected() ? 'filled' : 'outlined'"
11
- (click)="onClick($event)"
12
- />
@@ -1,36 +0,0 @@
1
- import { CommonModule } from "@angular/common";
2
- import { ChangeDetectionStrategy, Component, computed, input, output } from "@angular/core";
3
- import { ButtonType } from "@design-system-rte/core/components/button/button.interface";
4
- import { ButtonSize, ButtonVariant } from "@design-system-rte/core/components/button/common/common-button";
5
- import { buttonIconSize } from "@design-system-rte/core/components/button/common/common-button.constants";
6
-
7
- import { RegularIconIdKey, TogglableIconIdKey } from "../icon/icon.service";
8
- import { IconButtonComponent } from "../icon-button/icon-button.component";
9
-
10
- @Component({
11
- selector: "rte-icon-button-toggle",
12
- imports: [CommonModule, IconButtonComponent],
13
- standalone: true,
14
- templateUrl: "./icon-button-toggle.component.html",
15
- changeDetection: ChangeDetectionStrategy.OnPush,
16
- })
17
- export class IconButtonToggleComponent {
18
- readonly disabled = input<boolean>(false);
19
- readonly name = input.required<RegularIconIdKey | TogglableIconIdKey>();
20
- readonly size = input<ButtonSize>("m");
21
- readonly variant = input<ButtonVariant>("primary");
22
- readonly type = input<ButtonType>("button");
23
- readonly compactSpacing = input<boolean>(false);
24
- readonly ariaLabel = input<string | undefined>(undefined);
25
- readonly ariaLabelledBy = input<string | undefined>(undefined);
26
- readonly selected = input<boolean>(false);
27
-
28
- readonly click = output<void>();
29
-
30
- onClick(event: MouseEvent | KeyboardEvent): void {
31
- event.stopPropagation();
32
- this.click.emit();
33
- }
34
-
35
- readonly buttonIconSize = computed(() => buttonIconSize[this.size()]);
36
- }
@@ -1,197 +0,0 @@
1
- import { ENTER_KEY, SPACE_KEY } from "@design-system-rte/core/constants/keyboard.constants";
2
- import { Meta, StoryObj } from "@storybook/angular";
3
- import { fn, userEvent, within, expect } from "@storybook/test";
4
-
5
- import { togglableIcons as TogglableIconsList } from "../icon/icon-map";
6
-
7
- import { IconButtonToggleComponent } from "./icon-button-toggle.component";
8
-
9
- const TogglableIconIds = Object.keys(TogglableIconsList);
10
-
11
- const meta = {
12
- title: "IconButtonToggle",
13
- component: IconButtonToggleComponent,
14
- tags: ["autodocs"],
15
- argTypes: {
16
- name: {
17
- control: "select",
18
- options: [...TogglableIconIds].sort((a, b) => a.localeCompare(b)),
19
- description: "Nom de l’icône à afficher",
20
- defaultValue: "check",
21
- },
22
- variant: {
23
- control: "select",
24
- options: ["primary", "secondary", "text", "transparent", "danger"],
25
- },
26
- size: {
27
- control: "select",
28
- options: ["s", "m", "l"],
29
- },
30
- compactSpacing: {
31
- control: "boolean",
32
- description: "Utiliser un espacement compact",
33
- },
34
- disabled: {
35
- control: "boolean",
36
- },
37
- selected: {
38
- control: "boolean",
39
- description: "Indique si l'icône est sélectionnée",
40
- },
41
- },
42
- } satisfies Meta<IconButtonToggleComponent>;
43
-
44
- export default meta;
45
-
46
- type Story = StoryObj<IconButtonToggleComponent>;
47
-
48
- const mockFn = fn();
49
-
50
- export const Default: Story = {
51
- args: {
52
- name: "settings",
53
- size: "m",
54
- disabled: false,
55
- compactSpacing: false,
56
- variant: "primary",
57
- ariaLabel: "icon button aria label",
58
- click: mockFn,
59
- selected: false,
60
- },
61
-
62
- play: async ({ canvasElement }) => {
63
- const canvas = within(canvasElement);
64
- const iconButton = canvas.getByRole("button");
65
- await userEvent.click(iconButton);
66
- expect(mockFn).toHaveBeenCalled();
67
- iconButton.blur();
68
- },
69
- };
70
-
71
- export const Sizing: Story = {
72
- args: {
73
- ...Default.args,
74
- compactSpacing: false,
75
- },
76
- render: (args) => ({
77
- props: { ...args },
78
- template: `
79
- <div style="display: flex; gap: 8px">
80
- <rte-icon-button-toggle
81
- size="s"
82
- name=${args.name}
83
- data-testid="small-icon-button"
84
- [compactSpacing]="${args.compactSpacing}"
85
- [disabled]="${args.disabled}"
86
- [selected]="${args.selected}"
87
- [ariaLabel]="'Small Icon Button'"
88
- [type]="'${args.type}'"
89
- [variant]="'${args.variant}'"
90
- />
91
- <rte-icon-button-toggle
92
- name=${args.name}
93
- data-testid="medium-icon-button"
94
- [compactSpacing]="${args.compactSpacing}"
95
- [disabled]="${args.disabled}"
96
- [selected]="${args.selected}"
97
- [ariaLabel]="'Small Icon Button'"
98
- [type]="'${args.type}'"
99
- [variant]="'${args.variant}'"
100
- />
101
- <rte-icon-button-toggle
102
- size="l"
103
- name=${args.name}
104
- data-testid="large-icon-button"
105
- [compactSpacing]="${args.compactSpacing}"
106
- [disabled]="${args.disabled}"
107
- [selected]="${args.selected}"
108
- [ariaLabel]="'Small Icon Button'"
109
- [type]="'${args.type}'"
110
- [variant]="'${args.variant}'"
111
- />
112
- </div>
113
- `,
114
- }),
115
- play: async ({ canvasElement }) => {
116
- const canvas = within(canvasElement);
117
- const smallIconButton = canvas.getByTestId("small-icon-button").getElementsByTagName("button")[0];
118
- const mediumIconButton = canvas.getByTestId("medium-icon-button").getElementsByTagName("button")[0];
119
- const largeIconButton = canvas.getByTestId("large-icon-button").getElementsByTagName("button")[0];
120
-
121
- expect(smallIconButton.clientHeight).toBe(24);
122
- expect(mediumIconButton.clientHeight).toBe(32);
123
- expect(largeIconButton.clientHeight).toBe(40);
124
- },
125
- };
126
-
127
- export const CompactSizing: Story = {
128
- args: {
129
- ...Default.args,
130
- compactSpacing: true,
131
- },
132
- render: (args) => ({
133
- props: { ...args },
134
- template: `
135
- <div style="display: flex; gap: 8px">
136
- <rte-icon-button-toggle
137
- size="s"
138
- name=${args.name}
139
- data-testid="small-icon-button"
140
- [compactSpacing]="${args.compactSpacing}"
141
- [disabled]="${args.disabled}"
142
- [selected]="${args.selected}"
143
- [ariaLabel]="'Small Icon Button'"
144
- [type]="'${args.type}'"
145
- [variant]="'${args.variant}'"
146
- />
147
- <rte-icon-button-toggle
148
- name=${args.name}
149
- data-testid="medium-icon-button"
150
- [compactSpacing]="${args.compactSpacing}"
151
- [disabled]="${args.disabled}"
152
- [selected]="${args.selected}"
153
- [ariaLabel]="'Small Icon Button'"
154
- [type]="'${args.type}'"
155
- [variant]="'${args.variant}'"
156
- />
157
- <rte-icon-button-toggle
158
- size="l"
159
- name=${args.name}
160
- data-testid="large-icon-button"
161
- [compactSpacing]="${args.compactSpacing}"
162
- [disabled]="${args.disabled}"
163
- [selected]="${args.selected}"
164
- [ariaLabel]="'Small Icon Button'"
165
- [type]="'${args.type}'"
166
- [variant]="'${args.variant}'"
167
- />
168
- </div>
169
- `,
170
- }),
171
- play: async ({ canvasElement }) => {
172
- const canvas = within(canvasElement);
173
- const smallIconButton = canvas.getByTestId("small-icon-button").getElementsByTagName("button")[0];
174
- const mediumIconButton = canvas.getByTestId("medium-icon-button").getElementsByTagName("button")[0];
175
- const largeIconButton = canvas.getByTestId("large-icon-button").getElementsByTagName("button")[0];
176
-
177
- expect(smallIconButton.clientHeight).toBe(16);
178
- expect(mediumIconButton.clientHeight).toBe(20);
179
- expect(largeIconButton.clientHeight).toBe(24);
180
- },
181
- };
182
-
183
- export const KeyboardInteraction: Story = {
184
- args: {
185
- ...Default.args,
186
- },
187
- play: async ({ canvasElement }) => {
188
- const canvas = within(canvasElement);
189
- const button = canvas.getByRole("button");
190
- await userEvent.tab();
191
- expect(button).toHaveFocus();
192
- await userEvent.keyboard(ENTER_KEY);
193
- await userEvent.keyboard(SPACE_KEY);
194
- expect(mockFn).toHaveBeenCalledTimes(2);
195
- button.blur();
196
- },
197
- };
@@ -1,6 +0,0 @@
1
- <a href="{{ href() }}" class="rte-link" role="link" [ngClass]="{'subtle': subtle()}">
2
- <span class="rte-link-label">
3
- {{ label() }}
4
- </span>
5
- <rte-icon *ngIf="externalLink()" name="external-link" [size]="12"></rte-icon>
6
- </a>
@@ -1,108 +0,0 @@
1
- @use '@design-system-rte/core/design-tokens/main.scss' as *;
2
-
3
- .rte-link {
4
-
5
- @include typography-link-m;
6
- align-items: center;
7
- cursor: pointer;
8
- display: inline-flex;
9
- justify-content: center;
10
-
11
- &:visited {
12
-
13
- color: var(--content-link-visited);
14
- text-decoration: underline;
15
-
16
- &:hover {
17
- color: var(--content-link-visited-hover);
18
- text-decoration: none;
19
- }
20
-
21
- &:active {
22
- color: var(--content-link-visited-press);
23
- text-decoration: underline;
24
- }
25
-
26
- &:focus-visible {
27
- color: var(--content-link-visited);
28
- text-decoration: underline;
29
- outline: 1px solid var(--border-brand-focused);
30
- outline-offset: $radius-s;
31
- border-radius: $radius-s;
32
- }
33
- }
34
-
35
- &:not(:visited) {
36
-
37
- color: var(--content-link-default);
38
-
39
- &:hover {
40
- color: var(--content-link-hover);
41
- text-decoration: none;
42
- }
43
-
44
- &:active {
45
- color: var(--content-link-press);
46
- text-decoration: underline;
47
- }
48
-
49
- &:focus-visible {
50
- color: var(--content-link-default);
51
- text-decoration: underline;
52
- outline: 1px solid var(--border-brand-focused);
53
- outline-offset: $radius-s;
54
- border-radius: $radius-s;
55
- }
56
- }
57
-
58
- &.subtle {
59
-
60
- &:visited {
61
-
62
- color: var(--content-primary);
63
- text-decoration: none;
64
-
65
- &:hover {
66
- color: var(--content-link-secondary);
67
- text-decoration: underline;
68
- }
69
-
70
- &:active {
71
- color: var(--content-link-primary);
72
- text-decoration: none;
73
- }
74
-
75
- &:focus-visible {
76
- color: var(--content-link-primary);
77
- text-decoration: none;
78
- outline: 1px solid var(--border-brand-focused);
79
- outline-offset: $radius-s;
80
- border-radius: $radius-s;
81
- }
82
- }
83
-
84
- &:not(:visited) {
85
-
86
- color: var(--content-primary);
87
- text-decoration: none;
88
-
89
- &:hover {
90
- color: var(--content-secondary);
91
- text-decoration: underline;
92
- }
93
-
94
- &:active {
95
- color: var(--content-primary);
96
- text-decoration: none;
97
- }
98
-
99
- &:focus-visible {
100
- color: var(--content-primary);
101
- text-decoration: none;
102
- outline: 1px solid var(--border-brand-focused);
103
- outline-offset: $radius-s;
104
- border-radius: $radius-s;
105
- }
106
- }
107
- }
108
- }
@@ -1,61 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/angular";
2
- import { userEvent, within, expect } from "@storybook/test";
3
-
4
- import { LinkComponent } from "./link.component";
5
-
6
- const meta: Meta<LinkComponent> = {
7
- title: "Link",
8
- component: LinkComponent,
9
- tags: ["autodocs"],
10
- argTypes: {
11
- subtle: {
12
- control: "boolean",
13
- },
14
- externalLink: {
15
- control: "boolean",
16
- },
17
- },
18
- };
19
- export default meta;
20
- type Story = StoryObj<LinkComponent>;
21
-
22
- export const Default: Story = {
23
- args: {
24
- label: "Link",
25
- href: "#",
26
- },
27
- };
28
-
29
- export const SubtleLink: Story = {
30
- args: {
31
- ...Default.args,
32
- subtle: true,
33
- },
34
- };
35
-
36
- export const SubtleLinkExternal: Story = {
37
- args: {
38
- ...SubtleLink.args,
39
- externalLink: true,
40
- },
41
- };
42
-
43
- export const ExternalLink: Story = {
44
- args: {
45
- ...Default.args,
46
- externalLink: true,
47
- },
48
- };
49
-
50
- export const KeyboardInteraction: Story = {
51
- args: {
52
- ...Default.args,
53
- href: "#",
54
- },
55
- play: async ({ canvasElement }) => {
56
- const canvas = within(canvasElement);
57
- const link = canvas.getByRole("link");
58
- await userEvent.tab();
59
- expect(link).toHaveFocus();
60
- },
61
- };
@@ -1,18 +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-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
- }