@design-system-rte/core 0.10.0 → 0.13.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.
- package/CHANGELOG.md +51 -0
- package/components/badge/badge.interface.d.ts +10 -0
- package/components/badge/badge.utils.ts +56 -0
- package/components/button/icon-button/icon-button.interface.d.ts +1 -0
- package/components/chip/chip.constants.ts +5 -0
- package/components/chip/chip.interface.d.ts +12 -0
- package/components/tag/tag.interface.d.ts +34 -0
- package/components/text-input/text-input.interface.d.ts +1 -0
- package/components/textarea/textarea.constants.ts +9 -0
- package/components/textarea/textarea.interface.d.ts +20 -0
- package/constants/keyboard/keyboard-test.constants.ts +7 -0
- package/constants/keyboard/keyboard.constants.ts +6 -0
- package/design-tokens/tokens/_mixins.scss +27 -0
- package/package.json +1 -1
- package/constants/keyboard.constants.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @design-system-rte/core
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 89289e7: ## Changes
|
|
8
|
+
|
|
9
|
+
- (textarea) simplify required and optional appearence
|
|
10
|
+
- (textarea) set better props handling + handle resizing logic on angular comp
|
|
11
|
+
- (textarea) add auto scroll to top on blur event
|
|
12
|
+
- add angular textarea component
|
|
13
|
+
- extract constants in core
|
|
14
|
+
- add react textarea component
|
|
15
|
+
|
|
16
|
+
- f6bb90d: ## Changes
|
|
17
|
+
|
|
18
|
+
- update Tag component to use computed properties for icon name and validation
|
|
19
|
+
- correct casing of compactSpacing property in Tag component and stories
|
|
20
|
+
- improve formatting and consistency in Tag component and interface
|
|
21
|
+
- add Tag component with status and decorative types, including styles and stories
|
|
22
|
+
|
|
23
|
+
## 0.12.0
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- b824254: ## Changes
|
|
28
|
+
|
|
29
|
+
- enhance Badge component with improved class bindings and styling options
|
|
30
|
+
- implement Badge component in Angular
|
|
31
|
+
- add Badge interface
|
|
32
|
+
|
|
33
|
+
## 0.11.0
|
|
34
|
+
|
|
35
|
+
### Minor Changes
|
|
36
|
+
|
|
37
|
+
- ae703ee: ## Changes
|
|
38
|
+
|
|
39
|
+
- add keyboard test constants file
|
|
40
|
+
- add type to aria role mapping constant
|
|
41
|
+
- add keyboard event handling for backspace and delete keys
|
|
42
|
+
- add id property to text input component to get better accessibility
|
|
43
|
+
- update keyboard event handling in stories to use correct syntax
|
|
44
|
+
- extract chip props in interface
|
|
45
|
+
|
|
46
|
+
## 0.10.1
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- 9fcc804: ## Changes
|
|
51
|
+
|
|
52
|
+
- add correct behaviour on click
|
|
53
|
+
|
|
3
54
|
## 0.10.0
|
|
4
55
|
|
|
5
56
|
### Minor Changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type BadgeType = "brand" | "neutral" | "indicator";
|
|
2
|
+
export type BadgeSize = "xs" | "s" | "m" | "l";
|
|
3
|
+
export type BadgeAppearance = "text" | "icon" | "empty";
|
|
4
|
+
|
|
5
|
+
export interface BadgeProps {
|
|
6
|
+
badgeType?: BadgeType;
|
|
7
|
+
size?: BadgeSize;
|
|
8
|
+
appearance?: BadgeAppearance;
|
|
9
|
+
count?: number;
|
|
10
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { BadgeAppearance, BadgeSize } from "./badge.interface";
|
|
2
|
+
|
|
3
|
+
const COUNT_THRESHOLD = 100;
|
|
4
|
+
const COUNT_THRESHOLD_LABEL = "99+";
|
|
5
|
+
|
|
6
|
+
interface ShowIconProps {
|
|
7
|
+
size: BadgeSize;
|
|
8
|
+
appearance: BadgeAppearance;
|
|
9
|
+
iconSize?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface ShowTextProps {
|
|
13
|
+
size: BadgeSize;
|
|
14
|
+
appearance: BadgeAppearance;
|
|
15
|
+
count?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type ShowBadgeProps = ShowIconProps & ShowTextProps;
|
|
19
|
+
|
|
20
|
+
const badgeIconSize: Record<BadgeSize, number | null> = {
|
|
21
|
+
xs: null,
|
|
22
|
+
s: null,
|
|
23
|
+
m: 12,
|
|
24
|
+
l: 20,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export function getBadgeIconSize(size: BadgeSize): number | undefined {
|
|
28
|
+
return badgeIconSize[size] ?? undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function getShowIcon({ size, appearance, iconSize }: ShowIconProps): boolean {
|
|
32
|
+
return !["xs", "s"].includes(size) && appearance === "icon" && !!iconSize;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function getShowText({ size, appearance, count }: ShowTextProps): boolean {
|
|
36
|
+
return !["xs", "s"].includes(size) && appearance === "text" && typeof count === "number" && count > 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function getShowBadge({ size, appearance, count, iconSize }: ShowBadgeProps): boolean {
|
|
40
|
+
switch (appearance) {
|
|
41
|
+
case "icon":
|
|
42
|
+
return getShowIcon({ size, appearance, iconSize });
|
|
43
|
+
case "text":
|
|
44
|
+
return getShowText({ size, appearance, count });
|
|
45
|
+
default:
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function getDisplayCount(count?: number): string {
|
|
51
|
+
if (typeof count !== "number") {
|
|
52
|
+
return "";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return count < COUNT_THRESHOLD ? count.toString() : COUNT_THRESHOLD_LABEL;
|
|
56
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type ChipType = "single" | "multi" | "input";
|
|
2
|
+
|
|
3
|
+
export interface ChipProps {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
selected?: boolean;
|
|
7
|
+
onClick?: (event: MouseEvent | KeyboardEvent) => void;
|
|
8
|
+
onClose?: (event: MouseEvent | KeyboardEvent) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
type?: ChipType;
|
|
11
|
+
compactSpacing?: boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type TagType = "status" | "decorative";
|
|
2
|
+
export type TagStatus = "success" | "information" | "warning" | "alert";
|
|
3
|
+
export type TagColor =
|
|
4
|
+
| "brand"
|
|
5
|
+
| "neutral"
|
|
6
|
+
| "azur"
|
|
7
|
+
| "jade"
|
|
8
|
+
| "lavande"
|
|
9
|
+
| "ciel"
|
|
10
|
+
| "nuage"
|
|
11
|
+
| "givre"
|
|
12
|
+
| "brume"
|
|
13
|
+
| "glacier"
|
|
14
|
+
| "turquoise"
|
|
15
|
+
| "anis"
|
|
16
|
+
| "menthe"
|
|
17
|
+
| "citronnelle"
|
|
18
|
+
| "sable"
|
|
19
|
+
| "abricot"
|
|
20
|
+
| "coral"
|
|
21
|
+
| "rose"
|
|
22
|
+
| "petale"
|
|
23
|
+
| "quartz"
|
|
24
|
+
| "cendre";
|
|
25
|
+
|
|
26
|
+
export interface TagProps {
|
|
27
|
+
tagType?: TagType;
|
|
28
|
+
status?: TagStatus;
|
|
29
|
+
color?: TagColor;
|
|
30
|
+
compactSpacing?: boolean;
|
|
31
|
+
label?: string;
|
|
32
|
+
showLeftIcon?: boolean;
|
|
33
|
+
iconName?: string;
|
|
34
|
+
}
|
|
@@ -4,6 +4,7 @@ export type RightIconName = "close" | "visibility-show" | "visibility-hide";
|
|
|
4
4
|
export type AssistiveAppearance = "description" | "error" | "success" | "link";
|
|
5
5
|
|
|
6
6
|
export interface TextInputProps {
|
|
7
|
+
id: string;
|
|
7
8
|
label?: string;
|
|
8
9
|
labelPosition?: LabelPosition;
|
|
9
10
|
showCounter?: boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TextareaRequirementIndicator } from "./textarea.interface";
|
|
2
|
+
|
|
3
|
+
export const TEXTAREA_ICON_SIZE = 16;
|
|
4
|
+
|
|
5
|
+
export const TEXTAREA_REQUIREMENT_INDICATOR_VALUE: Record<TextareaRequirementIndicator, string> = {
|
|
6
|
+
required: "(obligatoire)",
|
|
7
|
+
requiredIcon: "*",
|
|
8
|
+
optional: "(facultatif)",
|
|
9
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type TextareaLabelPosition = "top" | "side";
|
|
2
|
+
export type TextareaAssistiveTextAppearance = "description" | "error" | "success" | "link";
|
|
3
|
+
export type TextareaRequirementIndicator = "required" | "requiredIcon" | "optional";
|
|
4
|
+
|
|
5
|
+
export interface TextareaProps {
|
|
6
|
+
label?: string;
|
|
7
|
+
labelId?: string;
|
|
8
|
+
labelPosition?: TextareaLabelPosition;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
showLabelRequirement?: boolean;
|
|
11
|
+
resizeable?: boolean;
|
|
12
|
+
showCounter?: boolean;
|
|
13
|
+
value?: string;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
assistiveTextLabel?: string;
|
|
16
|
+
assistiveTextAppearance?: TextareaAssistiveTextAppearance;
|
|
17
|
+
assistiveTextLink?: string;
|
|
18
|
+
showHandleIcon?: boolean;
|
|
19
|
+
showScrollBar?: boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SPACE_KEY, ENTER_KEY, DOWN_KEY, BACKSPACE_KEY, DELETE_KEY } from "./keyboard.constants";
|
|
2
|
+
|
|
3
|
+
export const TESTING_SPACE_KEY = `{${SPACE_KEY}}`;
|
|
4
|
+
export const TESTING_ENTER_KEY = `{${ENTER_KEY}}`;
|
|
5
|
+
export const TESTING_DOWN_KEY = `{${DOWN_KEY}}`;
|
|
6
|
+
export const TESTING_BACKSPACE_KEY = `{${BACKSPACE_KEY}}`;
|
|
7
|
+
export const TESTING_DELETE_KEY = `{${DELETE_KEY}}`;
|
|
@@ -92,6 +92,24 @@
|
|
|
92
92
|
letter-spacing: $text-s-regular-letter-spacing;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
@mixin typography-text-s-bold {
|
|
96
|
+
@include typography-text;
|
|
97
|
+
font-family: $text-s-bold-font-family;
|
|
98
|
+
font-weight: $text-s-bold-font-weight;
|
|
99
|
+
font-size: $text-s-bold-font-size;
|
|
100
|
+
line-height: $text-s-bold-line-height;
|
|
101
|
+
letter-spacing: $text-s-bold-letter-spacing;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@mixin typography-text-m {
|
|
105
|
+
@include typography-text;
|
|
106
|
+
font-family: $text-m-regular-font-family;
|
|
107
|
+
font-weight: $text-m-regular-font-weight;
|
|
108
|
+
font-size: $text-m-regular-font-size;
|
|
109
|
+
line-height: $text-m-regular-line-height;
|
|
110
|
+
letter-spacing: $text-m-regular-letter-spacing;
|
|
111
|
+
}
|
|
112
|
+
|
|
95
113
|
@mixin typography-text-l {
|
|
96
114
|
@include typography-text;
|
|
97
115
|
font-family: $text-l-regular-font-family;
|
|
@@ -101,6 +119,15 @@
|
|
|
101
119
|
letter-spacing: $text-l-regular-letter-spacing;
|
|
102
120
|
}
|
|
103
121
|
|
|
122
|
+
@mixin typography-text-l-bold {
|
|
123
|
+
@include typography-text;
|
|
124
|
+
font-family: $text-l-bold-font-family;
|
|
125
|
+
font-weight: $text-l-bold-font-weight;
|
|
126
|
+
font-size: $text-l-bold-font-size;
|
|
127
|
+
line-height: $text-l-bold-line-height;
|
|
128
|
+
letter-spacing: $text-l-bold-letter-spacing;
|
|
129
|
+
}
|
|
130
|
+
|
|
104
131
|
@mixin typography-link {
|
|
105
132
|
font-feature-settings: 'liga' off, 'clig' off;
|
|
106
133
|
font-style: normal;
|
package/package.json
CHANGED