@dative-gpi/foundation-shared-components 0.0.119 → 0.1.120

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.
@@ -55,7 +55,7 @@ export default defineComponent({
55
55
  const style: Ref<{ [key: string] : string }> = ref({
56
56
  "--fs-breadcrumbs-color": darks.dark,
57
57
  "--fs-breadcrumbs-active-color": darks.base,
58
- "--fs-breadcrumbs-disabled-color": darks.light
58
+ "--fs-breadcrumbs-disabled-color": darks.soft
59
59
  });
60
60
 
61
61
  const classes = (item: FSBreadcrumbItem): string[] => {
@@ -251,7 +251,7 @@ export default defineComponent({
251
251
  case ColorEnum.Success:
252
252
  case ColorEnum.Warning:
253
253
  case ColorEnum.Error : return ["standard"].includes(props.variant) ? colors.value.dark : colors.value.light;
254
- default : return ["standard"].includes(props.variant) ? darks.dark : darks.light;
254
+ default : return ["standard"].includes(props.variant) ? darks.dark : darks.soft;
255
255
  }
256
256
  });
257
257
 
@@ -122,7 +122,7 @@ export default defineComponent({
122
122
  case "full": return {
123
123
  "--fs-chip-height" : sizeToVar(props.height),
124
124
  "--fs-chip-background-color" : colors.value.base,
125
- "--fs-chip-border-color" : colors.value.baseContrast,
125
+ "--fs-chip-border-color" : colors.value.base,
126
126
  "--fs-chip-color" : colors.value.baseContrast,
127
127
  "--fs-chip-hover-background-color" : colors.value.base,
128
128
  "--fs-chip-hover-border-color" : colors.value.base,
@@ -254,7 +254,7 @@ export default defineComponent({
254
254
  "--fs-clickable-border-color" : colors.value.lightContrast,
255
255
  "--fs-clickable-color" : colors.value.lightContrast,
256
256
  "--fs-clickable-hover-background-color" : colors.value.base,
257
- "--fs-clickable-hover-border-color" : colors.value.baseContrast,
257
+ "--fs-clickable-hover-border-color" : colors.value.base,
258
258
  "--fs-clickable-hover-color" : colors.value.baseContrast,
259
259
  "--fs-clickable-active-background-color": colors.value.dark,
260
260
  "--fs-clickable-active-border-color" : colors.value.darkContrast,
@@ -326,7 +326,7 @@ export default defineComponent({
326
326
  case ColorEnum.Success:
327
327
  case ColorEnum.Warning:
328
328
  case ColorEnum.Error : return ["full"].includes(props.variant) ? colors.value.light : colors.value.dark;
329
- default : return ["full"].includes(props.variant) ? darks.light : darks.dark;
329
+ default : return ["full"].includes(props.variant) ? darks.soft : darks.dark;
330
330
  }
331
331
  });
332
332
 
@@ -19,7 +19,7 @@
19
19
  :style="style"
20
20
  />
21
21
  <FSText
22
- variant="light"
22
+ variant="soft"
23
23
  :font="$props.font"
24
24
  >
25
25
  <slot>
@@ -91,7 +91,7 @@ export default defineComponent({
91
91
  const style = computed((): { [key: string] : string | null | undefined } => ({
92
92
  "--fs-group-padding" : sizeToVar(props.padding),
93
93
  "--fs-group-gap" : sizeToVar(props.gap),
94
- "--fs-group-color" : darks.light,
94
+ "--fs-group-color" : darks.soft,
95
95
  "--fs-group-hover-color" : darks.dark
96
96
  }));
97
97
 
@@ -50,7 +50,7 @@ export default defineComponent({
50
50
  const darks = getColors(ColorEnum.Dark);
51
51
 
52
52
  const style = computed((): { [key: string] : string | null | undefined } => ({
53
- "--fs-group-color" : darks.light,
53
+ "--fs-group-color" : darks.soft,
54
54
  "--fs-group-hover-color" : darks.dark,
55
55
  "--fs-tab-border-color" : lights.dark,
56
56
  "--fs-tab-hover-border-color" : darks.dark,
@@ -45,7 +45,7 @@ export default defineComponent({
45
45
  default: ColorEnum.Dark
46
46
  },
47
47
  variant: {
48
- type: String as PropType<"base" | "baseContrast" | "light" | "lightContrast" | "dark" | "darkContrast">,
48
+ type: String as PropType<"base" | "baseContrast" | "light" | "lightContrast" | "dark" | "darkContrast" | "soft" | "softContrast">,
49
49
  required: false,
50
50
  default: "base"
51
51
  }
@@ -54,7 +54,7 @@ export default defineComponent({
54
54
  const style = computed((): { [key: string] : string | null | undefined } => ({
55
55
  "--fs-group-padding" : sizeToVar(props.padding),
56
56
  "--fs-group-gap" : sizeToVar(props.gap),
57
- "--fs-group-color" : darks.light,
57
+ "--fs-group-color" : darks.soft,
58
58
  "--fs-group-hover-color": darks.dark
59
59
  }));
60
60
 
@@ -30,7 +30,7 @@
30
30
  </FSText>
31
31
  <FSText
32
32
  font="text-overline"
33
- variant="light"
33
+ variant="soft"
34
34
  >
35
35
  {{ $props.code }}
36
36
  </FSText>
@@ -29,7 +29,7 @@
29
29
  </FSText>
30
30
  <FSText
31
31
  font="text-overline"
32
- variant="light"
32
+ variant="soft"
33
33
  >
34
34
  {{ $props.code }}
35
35
  </FSText>
@@ -26,7 +26,7 @@
26
26
  </FSText>
27
27
  <FSText
28
28
  font="text-overline"
29
- variant="light"
29
+ variant="soft"
30
30
  >
31
31
  {{ $props.code }}
32
32
  </FSText>
@@ -31,14 +31,14 @@
31
31
  >
32
32
  <FSIcon
33
33
  v-if="roleIcon"
34
- variant="light"
34
+ variant="soft"
35
35
  :color="ColorEnum.Dark"
36
36
  >
37
37
  {{ roleIcon }}
38
38
  </FSIcon>
39
39
  <FSText
40
40
  font="text-overline"
41
- variant="light"
41
+ variant="soft"
42
42
  >
43
43
  {{ roleLabel }}
44
44
  </FSText>
@@ -6,7 +6,7 @@ import { ColorBase, ColorEnum, ColorVariations } from "@dative-gpi/foundation-sh
6
6
 
7
7
  export const useColors = () => {
8
8
  const theme = useTheme().current.value;
9
- const baseMinSaturation = 55;
9
+ const baseMinSaturation = 0;
10
10
  const baseFixedBrightness = 90;
11
11
 
12
12
  const isGrayScale = (color: Color): boolean => {
@@ -24,7 +24,8 @@ export const useColors = () => {
24
24
 
25
25
  const getLight = (base: Color): Color => {
26
26
  if (isGrayScale(base)) {
27
- return base.value(Math.min(base.value() + 10, 100));
27
+ return base
28
+ .value(Math.max(base.value(), 95));
28
29
  }
29
30
  return base.saturationv(10).value(100);
30
31
  };
@@ -34,27 +35,28 @@ export const useColors = () => {
34
35
  };
35
36
 
36
37
  const getBase = (base: Color): Color => {
37
- if (isGrayScale(base)) {
38
- return base.saturationv(1);
39
- }
40
- const saturation = base.saturationv() > baseMinSaturation ? base.saturationv() : baseMinSaturation;
41
- return base.saturationv(saturation).value(baseFixedBrightness);
38
+ return base;
42
39
  };
43
40
 
44
41
  const getDark = (base: Color): Color => {
45
42
  return base.value(Math.max(base.value() - 15, 0));
46
43
  };
47
44
 
48
- const getContrast = (color: Color, fallback: Color): Color => {
49
- if (isGrayScale(color)) {
50
- if (color.value() > 50) {
51
- return color.value(Math.max(0, color.value() - 75));
52
- }
53
- else {
54
- return color.value(Math.min(100, color.value() + 75));
55
- }
45
+ const getContrast = (color: Color): Color => {
46
+ if(isGrayScale(color)){
47
+ const coeff = 4
48
+ return color
49
+ .value(color.value() < 70 ? 100 : Math.max(color.value() / coeff, 0));
50
+ }
51
+
52
+ if(isPastel(color)){
53
+ return color.darken(0.6);
54
+ }
55
+
56
+ if(color.darken(0.15).isLight()){
57
+ return color.darken(0.6);
56
58
  }
57
- return fallback;
59
+ return color.lighten(color.value() / 50);
58
60
  }
59
61
 
60
62
  const getColors = (color: ColorBase): ColorVariations => {
@@ -67,41 +69,29 @@ export const useColors = () => {
67
69
  const soft = getSoft(base);
68
70
  const dark = getDark(base);
69
71
 
70
- if (isPastel(seed)) {
72
+ if (color === ColorEnum.Background) {
71
73
  return {
72
- light: getLight(seed).hex(),
73
- lightContrast: getContrast(light, dark).hex(),
74
- soft: getSoft(seed).hex(),
75
- softContrast: getContrast(seed, dark).hex(),
76
- base: seed.hex(),
77
- baseContrast: getContrast(seed, dark).hex(),
78
- dark: dark.hex(),
79
- darkContrast: getContrast(dark, light).hex()
80
- };
81
- }
82
-
83
- switch (color) {
84
- case ColorEnum.Background: return {
85
- light: base.hex(),
86
- lightContrast: getContrast(base, base).hex(),
87
- soft: base.hex(),
88
- softContrast: getContrast(base, base).hex(),
89
- base: base.hex(),
90
- baseContrast: getContrast(base, base).hex(),
91
- dark: dark.hex(),
92
- darkContrast: getContrast(dark, base).hex()
93
- };
94
- default: return {
95
- light: light.hex(),
96
- lightContrast: getContrast(light, dark).hex(),
97
- soft: soft.hex(),
98
- softContrast: getContrast(soft, light).hex(),
74
+ get light(): string { throw new Error("Don't use it !") },
75
+ get lightContrast(): string { throw new Error("Don't use it !") },
76
+ get soft(): string { throw new Error("Don't use it !") },
77
+ get softContrast(): string { throw new Error("Don't use it !") },
99
78
  base: base.hex(),
100
- baseContrast: getContrast(base, light).hex(),
101
- dark: dark.hex(),
102
- darkContrast: getContrast(dark, light).hex()
79
+ get baseContrast(): string { throw new Error("Don't use it !") },
80
+ get dark(): string { throw new Error("Don't use it !") },
81
+ get darkContrast(): string { throw new Error("Don't use it !") }
103
82
  };
104
83
  }
84
+
85
+ return {
86
+ light: light.hex(),
87
+ lightContrast: getContrast(light).hex(),
88
+ soft: soft.hex(),
89
+ softContrast: getContrast(soft).hex(),
90
+ base: seed.hex(),
91
+ baseContrast: getContrast(seed).hex(),
92
+ dark: dark.hex(),
93
+ darkContrast: getContrast(dark).hex()
94
+ };
105
95
  };
106
96
 
107
97
  const getGradients = (colors: ColorBase | ColorBase[], rotation: number = 90): ColorVariations => {
@@ -119,7 +109,7 @@ export const useColors = () => {
119
109
  }
120
110
 
121
111
  const getBasePaletteColors = (): string[][] => {
122
- const columnCount = 5
112
+ const columnCount = 8
123
113
  const colors: string[][] = [];
124
114
  for (let saturation = baseMinSaturation; saturation <= 100; saturation += (100 - baseMinSaturation) / (columnCount - 1)) {
125
115
  let colorsRow = [];
@@ -130,7 +120,7 @@ export const useColors = () => {
130
120
  colors.push(colorsRow)
131
121
  }
132
122
  let i = 0;
133
- for (let brightness = 5; brightness <= 95; brightness += (90 / (columnCount - 1))) {
123
+ for (let brightness = 0; brightness <= 100; brightness += (100 / (columnCount - 1))) {
134
124
  const color = new Color({ h: 0, s: 1, v: 100 - brightness });
135
125
  colors[i].unshift(color.hex());
136
126
  i++;
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.119",
4
+ "version": "0.1.120",
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.119",
14
- "@dative-gpi/foundation-shared-services": "0.0.119",
13
+ "@dative-gpi/foundation-shared-domain": "0.1.120",
14
+ "@dative-gpi/foundation-shared-services": "0.1.120",
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": "f23ab1e0c8f72006dbf52bb826add56337f4da9b"
35
+ "gitHead": "ea777a3a70e01d2b96981b2cb2e3da7b3af5f59c"
36
36
  }