@dative-gpi/foundation-shared-components 0.0.37 → 0.0.39
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/components/FSAccordionPanel.vue +10 -3
- package/components/FSButton.vue +1 -17
- package/components/FSChip.vue +10 -17
- package/components/FSClickable.vue +11 -12
- package/components/FSColor.vue +2 -2
- package/components/FSDivider.vue +30 -10
- package/components/FSErrorToast.vue +67 -0
- package/components/FSFadeOut.vue +23 -5
- package/components/FSOptionGroup.vue +311 -0
- package/components/FSOptionItem.vue +132 -0
- package/components/FSSlideGroup.vue +25 -1
- package/components/FSTabs.vue +3 -4
- package/components/FSTag.vue +7 -8
- package/components/FSToggleSet.vue +2 -0
- package/components/FSWrapGroup.vue +1 -17
- package/components/fields/FSIconField.vue +1 -1
- package/composables/useColors.ts +66 -37
- package/composables/useRules.ts +3 -0
- package/models/colors.ts +4 -0
- package/models/errors.ts +36 -0
- package/models/index.ts +1 -0
- package/package.json +4 -4
- package/styles/components/fs_color.scss +1 -1
- package/styles/components/fs_container.scss +5 -5
- package/styles/components/fs_error_toast.scss +5 -0
- package/styles/components/fs_option_group.scss +7 -0
- package/styles/components/fs_span.scss +1 -1
- package/styles/components/index.scss +2 -0
- package/utils/error.ts +5 -0
- package/utils/index.ts +1 -0
package/composables/useColors.ts
CHANGED
|
@@ -16,59 +16,89 @@ export const useColors = () => {
|
|
|
16
16
|
return maxDiff < 10;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const
|
|
19
|
+
const isPastel = (color: Color): boolean => {
|
|
20
|
+
return color.saturationv() <= 15 && color.value() >= 85;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const getLight = (base: Color): Color => {
|
|
20
24
|
if (isGrayScale(base)) {
|
|
21
25
|
return base.value(Math.min(base.value() + 10, 100));
|
|
22
26
|
}
|
|
23
27
|
return base.saturationv(10).value(100);
|
|
24
28
|
};
|
|
25
29
|
|
|
26
|
-
const
|
|
30
|
+
const getSoft = (base: Color): Color => {
|
|
27
31
|
return base.value(Math.min(base.value() + 10, 100));
|
|
28
32
|
};
|
|
29
33
|
|
|
30
|
-
const
|
|
31
|
-
|
|
34
|
+
const getBase = (base: Color): Color => {
|
|
35
|
+
if (isGrayScale(base)) {
|
|
36
|
+
return base.saturationv(1);
|
|
37
|
+
}
|
|
38
|
+
return base.saturationv(((base.saturationv() * 30) / 100) + 70).value(90);
|
|
32
39
|
};
|
|
33
40
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const base = themed ? new Color(theme.colors[color as ColorEnum]) : new Color(color);
|
|
38
|
-
const light = lighten(base);
|
|
39
|
-
const soft = soften(base);
|
|
40
|
-
const dark = darken(base);
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
light: light.hex(),
|
|
44
|
-
soft: soft.hex(),
|
|
45
|
-
base: base.hex(),
|
|
46
|
-
dark: dark.hex()
|
|
47
|
-
};
|
|
41
|
+
const getDark = (base: Color): Color => {
|
|
42
|
+
return base.value(Math.max(base.value() - 15, 0));
|
|
48
43
|
};
|
|
49
44
|
|
|
50
|
-
const
|
|
45
|
+
const getContrast = (color: Color, fallback: Color): Color => {
|
|
46
|
+
if (isGrayScale(color)) {
|
|
47
|
+
if (color.value() > 50) {
|
|
48
|
+
return color.value(Math.max(0, color.value() - 75));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return color.value(Math.min(100, color.value() + 75));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return fallback;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const getColors = (color: ColorBase): ColorVariations => {
|
|
51
58
|
const themed = (Object as any).values(ColorEnum).includes(color);
|
|
52
59
|
|
|
53
|
-
|
|
60
|
+
const seed = themed ? new Color(theme.colors[color as ColorEnum]) : new Color(color);
|
|
61
|
+
|
|
62
|
+
const base = getBase(seed);
|
|
63
|
+
const light = getLight(base);
|
|
64
|
+
const soft = getSoft(base);
|
|
65
|
+
const dark = getDark(base);
|
|
66
|
+
|
|
67
|
+
if (isPastel(seed)) {
|
|
68
|
+
return {
|
|
69
|
+
light: getLight(seed).hex(),
|
|
70
|
+
lightContrast: getContrast(light, dark).hex(),
|
|
71
|
+
soft: getSoft(seed).hex(),
|
|
72
|
+
softContrast: getContrast(seed, dark).hex(),
|
|
73
|
+
base: seed.hex(),
|
|
74
|
+
baseContrast: getContrast(seed, base).hex(),
|
|
75
|
+
dark: dark.hex(),
|
|
76
|
+
darkContrast: getContrast(dark, light).hex()
|
|
77
|
+
};
|
|
78
|
+
}
|
|
54
79
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
80
|
+
switch (color) {
|
|
81
|
+
case ColorEnum.Background: return {
|
|
82
|
+
light: base.hex(),
|
|
83
|
+
lightContrast: getContrast(base, base).hex(),
|
|
84
|
+
soft: base.hex(),
|
|
85
|
+
softContrast: getContrast(base, base).hex(),
|
|
86
|
+
base: base.hex(),
|
|
87
|
+
baseContrast: getContrast(base, base).hex(),
|
|
88
|
+
dark: dark.hex(),
|
|
89
|
+
darkContrast: getContrast(dark, base).hex()
|
|
90
|
+
};
|
|
91
|
+
default: return {
|
|
92
|
+
light: light.hex(),
|
|
93
|
+
lightContrast: getContrast(light, dark).hex(),
|
|
94
|
+
soft: soft.hex(),
|
|
95
|
+
softContrast: getContrast(soft, light).hex(),
|
|
96
|
+
base: base.hex(),
|
|
97
|
+
baseContrast: getContrast(base, light).hex(),
|
|
98
|
+
dark: dark.hex(),
|
|
99
|
+
darkContrast: getContrast(dark, light).hex()
|
|
100
|
+
};
|
|
70
101
|
}
|
|
71
|
-
return getColors(base.hex());
|
|
72
102
|
};
|
|
73
103
|
|
|
74
104
|
const getGradients = (colors: ColorBase | ColorBase[]): ColorVariations => {
|
|
@@ -87,7 +117,6 @@ export const useColors = () => {
|
|
|
87
117
|
|
|
88
118
|
return {
|
|
89
119
|
getColors,
|
|
90
|
-
getContrasts,
|
|
91
120
|
getGradients
|
|
92
121
|
};
|
|
93
122
|
}
|
package/composables/useRules.ts
CHANGED
package/models/colors.ts
CHANGED
|
@@ -10,9 +10,13 @@ export enum ColorEnum {
|
|
|
10
10
|
|
|
11
11
|
export interface ColorVariations {
|
|
12
12
|
light: string;
|
|
13
|
+
lightContrast?: string;
|
|
13
14
|
soft: string;
|
|
15
|
+
softContrast?: string;
|
|
14
16
|
base: string;
|
|
17
|
+
baseContrast?: string;
|
|
15
18
|
dark: string;
|
|
19
|
+
darkContrast?: string;
|
|
16
20
|
};
|
|
17
21
|
|
|
18
22
|
export type ColorBase = (String | ColorEnum);
|
package/models/errors.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const Errors = [
|
|
2
|
+
{ code: "errors.missingorganisation", default: "Missing organisation header", status: 400 },
|
|
3
|
+
{ code: "errors.missinglanguage", default: "Missing language header", status: 400 },
|
|
4
|
+
{ code: "errors.invalidchart", default: "Invalid chart configuration", status: 400 },
|
|
5
|
+
{ code: "errors.invalidscenario", default: "Invalid scenario configuration", status: 400 },
|
|
6
|
+
{ code: "errors.passwordtooshort", default: "Password too short", status: 400 },
|
|
7
|
+
{ code: "errors.passwordtoolong", default: "Password too long", status: 400 },
|
|
8
|
+
{ code: "errors.passwordlowercase", default: "Lowercase character required", status: 400 },
|
|
9
|
+
{ code: "errors.passworduppercase", default: "Uppercase character required", status: 400 },
|
|
10
|
+
{ code: "errors.passwordnumber", default: "Number required", status: 400 },
|
|
11
|
+
{ code: "errors.passwordspecial", default: "Special character required", status: 400 },
|
|
12
|
+
{ code: "errors.authenticationfailed", default: "Authentication failed", status: 401 },
|
|
13
|
+
{ code: "errors.noregistereduser", default: "No registered user", status: 401 },
|
|
14
|
+
{ code: "errors.badcredentials", default: "Bad credentials", status: 401 },
|
|
15
|
+
{ code: "errors.unauthorizedorganisation", default: "Unauthorized organisation", status: 403 },
|
|
16
|
+
{ code: "errors.unauthorizedextension", default: "Unauthorized extension", status: 403 },
|
|
17
|
+
{ code: "errors.unauthorizeduser", default: "Unauthorized user", status: 403 },
|
|
18
|
+
{ code: "errors.usernotinorganisation", default: "User not in organisation", status: 403 },
|
|
19
|
+
{ code: "errors.noadminprivilege", default: "No admin privilege", status: 403 },
|
|
20
|
+
{ code: "errors.dashboardLocked", default: "Dashboard locked", status: 403 },
|
|
21
|
+
{ code: "errors.entitynotfound", default: "Entity not found", status: 404 },
|
|
22
|
+
{ code: "errors.imagenotfound", default: "Image not found", status: 404 },
|
|
23
|
+
{ code: "errors.tokennotfound", default: "Token not found", status: 404 },
|
|
24
|
+
{ code: "errors.alreadyregistereduser", default: "Already registered user", status: 409 },
|
|
25
|
+
{ code: "errors.devicealreadyinorganisation", default: "Device already in organisation", status: 409 },
|
|
26
|
+
{ code: "errors.devicealreadywatched", default: "Device already watched", status: 409 },
|
|
27
|
+
{ code: "errors.useralreadyinorganisation", default: "User already in organisation", status: 409 },
|
|
28
|
+
{ code: "errors.emailfailure", default: "Email failure", status: 422 },
|
|
29
|
+
{ code: "errors.requirevalidation", default: "Require validation", status: 422 },
|
|
30
|
+
{ code: "errors.databaseerror", default: "Database error", status: 449 },
|
|
31
|
+
{ code: "errors.graphsettingserror", default: "Microsoft graph settings error", status: 500 },
|
|
32
|
+
{ code: "errors.graphusererror", default: "Microsoft graph user error", status: 500 },
|
|
33
|
+
{ code: "errors.nomappableproperty", default: "No mappable property", status: 500 },
|
|
34
|
+
{ code: "errors.unvalidextensioncookie", default: "Unvalid extension cookie", status: 500 },
|
|
35
|
+
{ code: "errors.unexpectederror", default: "Unexpected error", status: 500 }
|
|
36
|
+
];
|
package/models/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-components",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.39",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dative-gpi/foundation-shared-domain": "0.0.
|
|
14
|
-
"@dative-gpi/foundation-shared-services": "0.0.
|
|
13
|
+
"@dative-gpi/foundation-shared-domain": "0.0.39",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "0.0.39",
|
|
15
15
|
"@fontsource/montserrat": "^5.0.16",
|
|
16
16
|
"@lexical/clipboard": "^0.12.5",
|
|
17
17
|
"@lexical/history": "^0.12.5",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"sass": "^1.69.5",
|
|
33
33
|
"sass-loader": "^13.3.2"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "f4259f72e37e80ea5276d61fa030956976738397"
|
|
36
36
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
.fs-container {
|
|
2
|
-
display: flex;
|
|
3
|
-
padding: var(--fs-container-padding);
|
|
4
2
|
background-color: var(--fs-container-background-color);
|
|
3
|
+
padding: var(--fs-container-padding);
|
|
4
|
+
display: flex;
|
|
5
5
|
|
|
6
6
|
&-border {
|
|
7
|
-
border-radius: 4px;
|
|
8
7
|
border: 1px solid var(--fs-container-border-color);
|
|
8
|
+
border-radius: 4px;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
&-elevation {
|
|
12
|
-
margin: 4px;
|
|
13
|
-
border-radius: 4px;
|
|
14
12
|
box-shadow: 0px 1px 8px 0px #00000029;
|
|
13
|
+
border-radius: 4px;
|
|
14
|
+
margin: 4px;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
@import "fs_date_field.scss";
|
|
20
20
|
@import "fs_dialog.scss";
|
|
21
21
|
@import "fs_divider.scss";
|
|
22
|
+
@import "fs_error_toast.scss";
|
|
22
23
|
@import "fs_fade_out.scss";
|
|
23
24
|
@import "fs_filter_button.scss";
|
|
24
25
|
@import "fs_form.scss";
|
|
@@ -32,6 +33,7 @@
|
|
|
32
33
|
@import "fs_load_data_table.scss";
|
|
33
34
|
@import "fs_load_tile.scss";
|
|
34
35
|
@import "fs_loader.scss";
|
|
36
|
+
@import "fs_option_group.scss";
|
|
35
37
|
@import "fs_pagination.scss";
|
|
36
38
|
@import "fs_password_field.scss";
|
|
37
39
|
@import "fs_radio.scss";
|
package/utils/error.ts
ADDED