@dative-gpi/foundation-shared-components 0.0.70 → 0.0.71

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.
@@ -65,12 +65,12 @@ export default defineComponent({
65
65
  default: "8px"
66
66
  },
67
67
  variant: {
68
- type: String as PropType<"background" | "standard">,
68
+ type: String as PropType<"background" | "standard" | "gradient">,
69
69
  required: false,
70
70
  default: "background"
71
71
  },
72
72
  color: {
73
- type: String as PropType<ColorBase>,
73
+ type: [Array, String] as PropType<ColorBase | ColorBase[]>,
74
74
  required: false,
75
75
  default: ColorEnum.Background
76
76
  },
@@ -91,9 +91,15 @@ export default defineComponent({
91
91
  }
92
92
  },
93
93
  setup(props) {
94
- const { getColors } = useColors();
94
+ const { getColors, getGradients } = useColors();
95
95
 
96
- const colors = computed(() => getColors(props.color));
96
+ const colors = computed(() => {
97
+ if(Array.isArray(props.color)) {
98
+ return getColors(props.color[0]);
99
+ }
100
+ return getColors(props.color);
101
+ });
102
+ const gradients = computed(() => getGradients(props.color, 135));
97
103
  const backgrounds = getColors(ColorEnum.Background);
98
104
  const lights = getColors(ColorEnum.Light);
99
105
  const darks = getColors(ColorEnum.Dark);
@@ -120,11 +126,29 @@ export default defineComponent({
120
126
  "--fs-card-border-color" : lights.dark,
121
127
  "--fs-card-color" : darks.base
122
128
  }
129
+ case "gradient": return {
130
+ "--fs-card-border-size" : props.border ? "1px" : "0",
131
+ "--fs-card-border-radius" : sizeToVar(props.borderRadius),
132
+ "--fs-card-padding" : sizeToVar(props.padding),
133
+ "--fs-card-height" : sizeToVar(props.height),
134
+ "--fs-card-width" : sizeToVar(props.width),
135
+ "--fs-card-background-color": gradients.value.base,
136
+ "--fs-card-border-color" : colors.value.lightContrast,
137
+ "--fs-card-color" : colors.value.lightContrast
138
+ }
123
139
  }
124
140
  });
125
141
 
126
142
  const classes = computed((): string[] => {
127
143
  const classNames = ["fs-card"];
144
+ switch(props.variant) {
145
+ case "gradient":
146
+ classNames.push("fs-card-gradient");
147
+ break;
148
+ default:
149
+ classNames.push("fs-card-background");
150
+ break;
151
+ }
128
152
  if (props.elevation) {
129
153
  classNames.push("fs-card-elevation");
130
154
  }
@@ -1,7 +1,8 @@
1
1
  <template>
2
2
  <v-icon
3
- :class="classes"
3
+ class="fs-icon"
4
4
  :color="color"
5
+ :style="style"
5
6
  v-bind="$attrs"
6
7
  >
7
8
  <slot />
@@ -11,14 +12,15 @@
11
12
  <script lang="ts">
12
13
  import { computed, defineComponent, PropType } from "vue";
13
14
 
14
- import { useColors } from "@dative-gpi/foundation-shared-components/composables";
15
+ import { useBreakpoints, useColors } from "@dative-gpi/foundation-shared-components/composables";
15
16
  import { ColorBase } from "@dative-gpi/foundation-shared-components/models";
17
+ import { sizeToVar } from "../utils";
16
18
 
17
19
  export default defineComponent({
18
20
  name: "FSIcon",
19
21
  props: {
20
22
  size: {
21
- type: String as PropType<"s" | "m" | "l">,
23
+ type: [Array, String, Number] as PropType<"s" | "m" | "l" | string[] | number[] | string | number | null>,
22
24
  required: false,
23
25
  default: "m"
24
26
  },
@@ -34,6 +36,7 @@ export default defineComponent({
34
36
  }
35
37
  },
36
38
  setup(props) {
39
+ const { isMobileSized } = useBreakpoints();
37
40
  const { getColors } = useColors();
38
41
 
39
42
  const color = computed((): string | null => {
@@ -43,13 +46,26 @@ export default defineComponent({
43
46
  return null;
44
47
  });
45
48
 
46
- const classes = computed((): string[] => {
47
- return [`fs-icon-${props.size}`];
49
+ const style = computed((): { [key: string] : string | undefined } => {
50
+ switch(props.size) {
51
+ case "s": return {
52
+ "--fs-icon-font-size": isMobileSized.value ? "14px" : "16px"
53
+ };
54
+ case "m": return {
55
+ "--fs-icon-font-size": isMobileSized.value ? "16px" : "20px"
56
+ };
57
+ case "l": return {
58
+ "--fs-icon-font-size": isMobileSized.value ? "20px" : "24px"
59
+ };
60
+ default: return {
61
+ "--fs-icon-font-size": sizeToVar(props.size)
62
+ };
63
+ }
48
64
  });
49
65
 
50
66
  return {
51
- classes,
52
- color
67
+ color,
68
+ style
53
69
  };
54
70
  }
55
71
  });
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <FSCard
3
+ :variant="$props.backgroundColor == null ? 'background' : 'gradient'"
4
+ :border="$props.backgroundColor == null"
5
+ :color="$props.backgroundColor"
6
+ :height="$props.size"
7
+ :width="$props.size"
8
+ >
9
+ <FSRow
10
+ align="center-center"
11
+ >
12
+ <FSIcon
13
+ variant="dark"
14
+ size="56"
15
+ :color="$props.iconColor"
16
+ >
17
+ {{ $props.icon }}
18
+ </FSIcon>
19
+ </FSRow>
20
+ </FSCard>
21
+ </template>
22
+
23
+ <script lang="ts">
24
+ import { defineComponent, PropType } from "vue";
25
+
26
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
27
+
28
+ import FSCard from "./FSCard.vue";
29
+ import FSIcon from "./FSIcon.vue";
30
+
31
+ export default defineComponent({
32
+ name: "FSIconCard",
33
+ components: {
34
+ FSCard,
35
+ FSIcon
36
+ },
37
+ props: {
38
+ size: {
39
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
40
+ required: false,
41
+ default: null
42
+ },
43
+ backgroundColor: {
44
+ type: [Array, String] as PropType<ColorBase | ColorBase[]>,
45
+ required: false,
46
+ default: null
47
+ },
48
+ icon: {
49
+ type: String as PropType<string>,
50
+ required: false,
51
+ default: "mdi-shape"
52
+ },
53
+ iconColor: {
54
+ type: String as PropType<ColorBase>,
55
+ required: false,
56
+ default: ColorEnum.Dark
57
+ }
58
+ }
59
+ });
60
+ </script>
@@ -0,0 +1,124 @@
1
+ <template>
2
+ <FSTile
3
+ :bottomColor="$props.bottomColor"
4
+ :editable="$props.editable"
5
+ :modelValue="$props.modelValue"
6
+ v-bind="$attrs"
7
+ >
8
+ <FSCol
9
+ align="center-center"
10
+ width="fill"
11
+ >
12
+ <FSRow
13
+ align="center-center"
14
+ gap="24px"
15
+ :height="imageSize"
16
+ :wrap="false"
17
+ >
18
+ <FSCol
19
+ gap="6px"
20
+ >
21
+ <FSText
22
+ font="text-button"
23
+ :lineClamp="2"
24
+ >
25
+ {{ $props.label }}
26
+ </FSText>
27
+ <FSText
28
+ font="text-overline"
29
+ variant="light"
30
+ >
31
+ {{ $props.code }}
32
+ </FSText>
33
+ </FSCol>
34
+ <FSIconCard
35
+ :backgroundColor="$props.iconBackgroundColor"
36
+ :icon="$props.icon"
37
+ :size="imageSize"
38
+ />
39
+ </FSRow>
40
+ </FSCol>
41
+ </FSTile>
42
+ </template>
43
+
44
+ <script lang="ts">
45
+ import { computed, defineComponent, PropType } from "vue";
46
+
47
+ import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
48
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
49
+
50
+ import FSIconCard from "../FSIconCard.vue";
51
+ import FSText from "../FSText.vue";
52
+ import FSTile from "./FSTile.vue";
53
+ import FSCol from "../FSCol.vue";
54
+ import FSRow from "../FSRow.vue";
55
+
56
+ export default defineComponent({
57
+ name: "FSSimpleIconTileUI",
58
+ components: {
59
+ FSIconCard,
60
+ FSText,
61
+ FSTile,
62
+ FSCol,
63
+ FSRow
64
+ },
65
+ props: {
66
+ label: {
67
+ type: String as PropType<string | null>,
68
+ required: false,
69
+ default: null
70
+ },
71
+ modelValue: {
72
+ type: Boolean,
73
+ required: false,
74
+ default: false
75
+ },
76
+ code: {
77
+ type: String as PropType<string | null>,
78
+ required: false,
79
+ default: null
80
+ },
81
+ bottomColor: {
82
+ type: [Array, String] as PropType<ColorBase | ColorBase[]>,
83
+ required: false,
84
+ default: ColorEnum.Light
85
+ },
86
+ iconBackgroundColor: {
87
+ type: [Array, String] as PropType<ColorBase | ColorBase[]>,
88
+ required: false,
89
+ default: null
90
+ },
91
+ icon: {
92
+ type: String as PropType<string>,
93
+ required: false,
94
+ default: "mdi-ab-testing"
95
+ },
96
+ editable: {
97
+ type: Boolean,
98
+ required: false,
99
+ default: true
100
+ }
101
+ },
102
+ setup(props) {
103
+ const { isMobileSized } = useBreakpoints();
104
+
105
+ const imageSize = computed((): number => {
106
+ return isMobileSized.value ? 90 : 100;
107
+ });
108
+
109
+ const infoWidth = computed((): number => {
110
+ let width = isMobileSized.value ? 288 : 304;
111
+ if (props.icon) {
112
+ width -= imageSize.value;
113
+ }
114
+ return width;
115
+ });
116
+
117
+ return {
118
+ ColorEnum,
119
+ imageSize,
120
+ infoWidth
121
+ };
122
+ }
123
+ });
124
+ </script>
@@ -22,23 +22,25 @@
22
22
  font="text-button"
23
23
  :lineClamp="2"
24
24
  >
25
- {{ $props.name }}
25
+ {{ title }}
26
26
  </FSText>
27
27
  <FSRow
28
+ v-if="roleLabel"
28
29
  align="center-left"
29
30
  gap="4px"
30
31
  >
31
32
  <FSIcon
33
+ v-if="roleIcon"
32
34
  variant="light"
33
35
  :color="ColorEnum.Dark"
34
36
  >
35
- {{ $props.roleIcon }}
37
+ {{ roleIcon }}
36
38
  </FSIcon>
37
39
  <FSText
38
40
  font="text-overline"
39
41
  variant="light"
40
42
  >
41
- {{ $props.roleLabel }}
43
+ {{ roleLabel }}
42
44
  </FSText>
43
45
  </FSRow>
44
46
  </FSCol>
@@ -55,8 +57,10 @@
55
57
  <script lang="ts">
56
58
  import { computed, defineComponent, PropType } from "vue";
57
59
 
60
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
58
61
  import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
59
62
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
63
+ import { UserType } from "@dative-gpi/foundation-core-domain/models";
60
64
 
61
65
  import FSImage from "../FSImage.vue";
62
66
  import FSText from "../FSText.vue";
@@ -84,6 +88,16 @@ export default defineComponent({
84
88
  required: false,
85
89
  default: null
86
90
  },
91
+ label: {
92
+ type: String as PropType<string | null>,
93
+ required: false,
94
+ default: null
95
+ },
96
+ userType: {
97
+ type: Number as PropType<UserType>,
98
+ required: false,
99
+ default: UserType.User
100
+ },
87
101
  roleIcon: {
88
102
  type: String as PropType<string | null>,
89
103
  required: false,
@@ -94,6 +108,11 @@ export default defineComponent({
94
108
  required: false,
95
109
  default: null
96
110
  },
111
+ admin: {
112
+ type: Boolean,
113
+ required: false,
114
+ default: false
115
+ },
97
116
  modelValue: {
98
117
  type: Boolean,
99
118
  required: false,
@@ -107,6 +126,28 @@ export default defineComponent({
107
126
  },
108
127
  setup(props) {
109
128
  const { isMobileSized } = useBreakpoints();
129
+ const { $tr } = useTranslationsProvider();
130
+
131
+ const title = computed((): string | null => {
132
+ switch (props.userType) {
133
+ case UserType.ServiceAccount: return props.label;
134
+ default: return props.name;
135
+ }
136
+ });
137
+
138
+ const roleIcon = computed((): string | null => {
139
+ if (props.admin) {
140
+ return "mdi-crown-outline";
141
+ }
142
+ return props.roleIcon;
143
+ });
144
+
145
+ const roleLabel = computed((): string | null => {
146
+ if (props.admin) {
147
+ return $tr("ui.user-organisation.admin", "Administrator");
148
+ }
149
+ return props.roleLabel;
150
+ });
110
151
 
111
152
  const imageSize = computed((): number => {
112
153
  return isMobileSized.value ? 90 : 100;
@@ -123,7 +164,10 @@ export default defineComponent({
123
164
  return {
124
165
  imageSize,
125
166
  infoWidth,
126
- ColorEnum
167
+ ColorEnum,
168
+ roleLabel,
169
+ roleIcon,
170
+ title
127
171
  };
128
172
  }
129
173
  });
@@ -101,17 +101,17 @@ export const useColors = () => {
101
101
  }
102
102
  };
103
103
 
104
- const getGradients = (colors: ColorBase | ColorBase[]): ColorVariations => {
104
+ const getGradients = (colors: ColorBase | ColorBase[], rotation: number = 90): ColorVariations => {
105
105
  const variations = Array.isArray(colors) ? colors.map(getColors) : [getColors(colors)];
106
106
 
107
107
  if (variations.length === 1) {
108
108
  return variations[0];
109
109
  }
110
110
  return {
111
- light: `linear-gradient(90deg, ${variations.map(v => v.light).join(", ")})`,
112
- soft: `linear-gradient(90deg, ${variations.map(v => v.soft).join(", ")})`,
113
- base: `linear-gradient(90deg, ${variations.map(v => v.base).join(", ")})`,
114
- dark: `linear-gradient(90deg, ${variations.map(v => v.dark).join(", ")})`,
111
+ light: `linear-gradient(${rotation}deg, ${variations.map(v => v.light).join(", ")})`,
112
+ soft: `linear-gradient(${rotation}deg, ${variations.map(v => v.soft).join(", ")})`,
113
+ base: `linear-gradient(${rotation}deg, ${variations.map(v => v.base).join(", ")})`,
114
+ dark: `linear-gradient(${rotation}deg, ${variations.map(v => v.dark).join(", ")})`,
115
115
  };
116
116
  }
117
117
 
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.70",
4
+ "version": "0.0.71",
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.70",
14
- "@dative-gpi/foundation-shared-services": "0.0.70",
13
+ "@dative-gpi/foundation-shared-domain": "0.0.71",
14
+ "@dative-gpi/foundation-shared-services": "0.0.71",
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": "e280ffdb9ee5d27727cc01325689b792168febcd"
35
+ "gitHead": "72097470e9163b0da5e7ab5d67496ac5c403f918"
36
36
  }
@@ -6,7 +6,6 @@
6
6
  width: var(--fs-card-width);
7
7
  display: flex;
8
8
 
9
- background-color: var(--fs-card-background-color);
10
9
  border-color: var(--fs-card-border-color);
11
10
  color: var(--fs-card-color);
12
11
 
@@ -15,4 +14,12 @@
15
14
  border-radius: 4px;
16
15
  margin: 4px;
17
16
  }
17
+
18
+ &-background {
19
+ background-color: var(--fs-card-background-color);
20
+ }
21
+
22
+ &-gradient {
23
+ background: var(--fs-card-background-color);
24
+ }
18
25
  }
@@ -1,27 +1,3 @@
1
- .fs-icon-s {
2
- @include web {
3
- font-size: 16px !important;
4
- }
5
- @include mobile {
6
- font-size: 14px !important;
7
- }
8
- }
9
-
10
- .fs-icon-m {
11
- @include web {
12
- font-size: 20px !important;
13
- }
14
- @include mobile {
15
- font-size: 16px !important;
16
- }
17
- }
18
-
19
- .fs-icon-l {
20
- @include web {
21
- font-size: 24px !important;
22
- }
23
-
24
- @include mobile {
25
- font-size: 20px !important;
26
- }
1
+ .fs-icon {
2
+ font-size: var(--fs-icon-font-size) !important;
27
3
  }