@dative-gpi/foundation-shared-components 1.0.5 → 1.0.7

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.
@@ -128,13 +128,11 @@
128
128
  </template>
129
129
 
130
130
  <script lang="ts">
131
- import type { PropType } from "vue";
132
- import { computed, defineComponent } from "vue";
133
- import type { RouteLocation } from "vue-router";
131
+ import { computed, defineComponent, type PropType } from "vue";
132
+ import { type RouteLocation } from "vue-router";
134
133
 
134
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
135
135
  import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
136
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
137
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
138
136
 
139
137
  import FSClickable from "./FSClickable.vue";
140
138
  import FSSpan from "./FSSpan.vue";
@@ -34,11 +34,9 @@
34
34
  </template>
35
35
 
36
36
  <script lang="ts">
37
- import type { PropType } from "vue";
38
- import { computed, defineComponent } from "vue";
37
+ import { computed, defineComponent, type PropType } from "vue";
39
38
 
40
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
41
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
39
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
42
40
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
43
41
  import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
44
42
 
@@ -73,7 +71,7 @@ export default defineComponent({
73
71
  default: "8px"
74
72
  },
75
73
  variant: {
76
- type: String as PropType<"background" | "standard" | "gradient">,
74
+ type: String as PropType<"background" | "standard" | "full" | "gradient">,
77
75
  required: false,
78
76
  default: "background"
79
77
  },
@@ -119,6 +117,17 @@ export default defineComponent({
119
117
 
120
118
  const style = computed((): { [key: string] : string | null | undefined } => {
121
119
  switch (props.variant) {
120
+ case "background": return {
121
+ "--fs-card-border-size" : props.border ? "1px" : "0",
122
+ "--fs-card-border-style" : props.borderStyle,
123
+ "--fs-card-border-radius" : sizeToVar(props.borderRadius),
124
+ "--fs-card-padding" : sizeToVar(props.padding),
125
+ "--fs-card-height" : sizeToVar(props.height),
126
+ "--fs-card-width" : sizeToVar(props.width),
127
+ "--fs-card-background-color": backgrounds.base,
128
+ "--fs-card-border-color" : lights.dark,
129
+ "--fs-card-color" : darks.base
130
+ }
122
131
  case "standard": return {
123
132
  "--fs-card-border-size" : props.border ? "1px" : "0",
124
133
  "--fs-card-border-style" : props.borderStyle,
@@ -130,16 +139,16 @@ export default defineComponent({
130
139
  "--fs-card-border-color" : colors.value.lightContrast,
131
140
  "--fs-card-color" : colors.value.lightContrast
132
141
  }
133
- case "background": return {
142
+ case "full": return {
134
143
  "--fs-card-border-size" : props.border ? "1px" : "0",
135
144
  "--fs-card-border-style" : props.borderStyle,
136
145
  "--fs-card-border-radius" : sizeToVar(props.borderRadius),
137
146
  "--fs-card-padding" : sizeToVar(props.padding),
138
147
  "--fs-card-height" : sizeToVar(props.height),
139
148
  "--fs-card-width" : sizeToVar(props.width),
140
- "--fs-card-background-color": backgrounds.base,
141
- "--fs-card-border-color" : lights.dark,
142
- "--fs-card-color" : darks.base
149
+ "--fs-card-background-color": colors.value.base,
150
+ "--fs-card-border-color" : colors.value.base,
151
+ "--fs-card-color" : colors.value.baseContrast
143
152
  }
144
153
  case "gradient": return {
145
154
  "--fs-card-border-size" : props.border ? "1px" : "0",
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <FSCard
3
+ :variant="$props.variant"
3
4
  :border="$props.border"
4
- :class="classes"
5
- :style="style"
5
+ :color="$props.color"
6
6
  v-bind="$attrs"
7
7
  >
8
8
  <slot
@@ -12,11 +12,9 @@
12
12
  </template>
13
13
 
14
14
  <script lang="ts">
15
- import type { PropType } from "vue";
16
- import { computed, defineComponent } from "vue";
15
+ import { computed, defineComponent, type PropType } from "vue";
17
16
 
18
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
19
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
17
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
20
18
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
21
19
 
22
20
  import FSCard from "./FSCard.vue";
@@ -27,15 +25,20 @@ export default defineComponent({
27
25
  FSCard
28
26
  },
29
27
  props: {
30
- border: {
31
- type: Boolean,
28
+ variant: {
29
+ type: String as PropType<"standard" | "full">,
32
30
  required: false,
33
- default: true
31
+ default: "standard"
34
32
  },
35
33
  color: {
36
34
  type: String as PropType<ColorBase>,
37
35
  required: false,
38
36
  default: ColorEnum.Primary
37
+ },
38
+ border: {
39
+ type: Boolean,
40
+ required: false,
41
+ default: true
39
42
  }
40
43
  },
41
44
  setup(props) {
@@ -43,29 +46,8 @@ export default defineComponent({
43
46
 
44
47
  const colors = computed(() => getColors(props.color));
45
48
 
46
- const style = computed((): { [key: string] : string | null | undefined } => {
47
- return {
48
- "--fs-color-background-color": colors.value.light,
49
- "--fs-color-border-color" : colors.value.lightContrast,
50
- "--fs-color-color" : colors.value.lightContrast,
51
- "--fs-color-light" : colors.value.light,
52
- "--fs-color-base" : colors.value.base,
53
- "--fs-color-dark" : colors.value.dark
54
- };
55
- });
56
-
57
- const classes = computed((): string[] => {
58
- const classNames = ["fs-color"];
59
- if (props.border) {
60
- classNames.push("fs-color-border");
61
- }
62
- return classNames;
63
- });
64
-
65
49
  return {
66
- classes,
67
- colors,
68
- style
50
+ colors
69
51
  };
70
52
  }
71
53
  });
@@ -31,7 +31,7 @@ export default defineComponent({
31
31
  default: null
32
32
  },
33
33
  variant: {
34
- type: String as PropType<"base" | "baseContrast" | "light" | "lightContrast" | "dark" | "darkContrast">,
34
+ type: String as PropType<"base" | "baseContrast" | "soft" | "softContrast" | "light" | "lightContrast" | "dark" | "darkContrast">,
35
35
  required: false,
36
36
  default: "base"
37
37
  }
@@ -1,18 +1,18 @@
1
1
  <template>
2
2
  <FSCard
3
+ :variant="$props.backgroundVariant"
3
4
  :color="$props.backgroundColor"
5
+ :border="$props.border"
4
6
  :height="$props.size"
5
7
  :width="$props.size"
6
- :variant="variant"
7
- :border="border"
8
8
  >
9
9
  <FSRow
10
10
  align="center-center"
11
11
  >
12
12
  <FSIcon
13
- variant="dark"
14
- :size="$props.iconSize"
13
+ :variant="$props.iconVariant"
15
14
  :color="$props.iconColor"
15
+ :size="$props.iconSize"
16
16
  >
17
17
  {{ $props.icon }}
18
18
  </FSIcon>
@@ -21,7 +21,7 @@
21
21
  </template>
22
22
 
23
23
  <script lang="ts">
24
- import { computed, defineComponent, type PropType } from "vue";
24
+ import { defineComponent, type PropType } from "vue";
25
25
 
26
26
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
27
27
 
@@ -45,6 +45,11 @@ export default defineComponent({
45
45
  required: false,
46
46
  default: null
47
47
  },
48
+ backgroundVariant: {
49
+ type: String as PropType<"background" | "gradient">,
50
+ required: false,
51
+ default: "background"
52
+ },
48
53
  icon: {
49
54
  type: String as PropType<string>,
50
55
  required: false,
@@ -55,31 +60,21 @@ export default defineComponent({
55
60
  required: false,
56
61
  default: ColorEnum.Dark
57
62
  },
63
+ iconVariant: {
64
+ type: String as PropType<"base" | "baseContrast" | "soft" | "softContrast" | "light" | "lightContrast" | "dark" | "darkContrast">,
65
+ required: false,
66
+ default: "base"
67
+ },
58
68
  iconSize: {
59
69
  type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
60
70
  required: false,
61
71
  default: "56px"
72
+ },
73
+ border: {
74
+ type: Boolean,
75
+ required: false,
76
+ default: true
62
77
  }
63
- },
64
- setup(props) {
65
- const variant = computed((): "background" | "gradient" => {
66
- switch (props.backgroundColor) {
67
- case ColorEnum.Background: return "background";
68
- default : return "gradient";
69
- }
70
- });
71
-
72
- const border = computed((): boolean => {
73
- switch (props.backgroundColor) {
74
- case ColorEnum.Background: return true;
75
- default : return false;
76
- }
77
- });
78
-
79
- return {
80
- variant,
81
- border
82
- };
83
78
  }
84
79
  });
85
80
  </script>
@@ -112,7 +112,7 @@ export default defineComponent({
112
112
  default: null
113
113
  },
114
114
  modelValue: {
115
- type: String,
115
+ type: String as PropType<string | null>,
116
116
  required: false,
117
117
  default: "#000000"
118
118
  },
@@ -164,9 +164,9 @@ export default defineComponent({
164
164
 
165
165
  const menu = ref(false);
166
166
 
167
- const innerColor = ref(getColors(props.modelValue).base);
168
- const innerOpacity = ref(getHexFromPercentage(props.opacityValue));
169
- const fullColor = ref(innerColor.value + innerOpacity.value);
167
+ const innerColor = ref("#000000");
168
+ const innerOpacity = ref("00");
169
+ const fullColor = ref("#00000000");
170
170
 
171
171
  const style = computed((): { [key: string]: string | undefined } => {
172
172
  if (!props.editable) {
@@ -185,7 +185,6 @@ export default defineComponent({
185
185
  };
186
186
  });
187
187
 
188
-
189
188
  const onSubmit = (value: string) => {
190
189
  innerColor.value = value.substring(0, 7);
191
190
  innerOpacity.value = value.length === 9 ? value.substring(7, 9) : "FF";
@@ -195,14 +194,21 @@ export default defineComponent({
195
194
  };
196
195
 
197
196
  const reset = (): void => {
198
- innerColor.value = getColors(props.modelValue)['base'];
199
- innerOpacity.value = getHexFromPercentage(props.opacityValue);
200
- fullColor.value = innerColor.value + innerOpacity.value;
197
+ if (props.modelValue) {
198
+ innerColor.value = getColors(props.modelValue)['base'];
199
+ innerOpacity.value = getHexFromPercentage(props.opacityValue);
200
+ fullColor.value = innerColor.value + innerOpacity.value;
201
+ }
202
+ else {
203
+ innerColor.value = "#000000";
204
+ innerOpacity.value = "00";
205
+ fullColor.value = "#00000000";
206
+ }
201
207
  };
202
208
 
203
209
  watch(() => props.modelValue, () => {
204
210
  reset();
205
- });
211
+ }, { immediate: true });
206
212
 
207
213
  return {
208
214
  getPercentageFromHex,
@@ -150,9 +150,9 @@
150
150
  />
151
151
  <FSIcon
152
152
  v-else-if="$props.icon"
153
+ :color="$props.color"
153
154
  :icon="$props.icon"
154
155
  :size="imageSize"
155
- :color="$props.color"
156
156
  />
157
157
  <FSCol
158
158
  align="center-left"
@@ -210,7 +210,7 @@
210
210
  <script lang="ts">
211
211
  import { computed, defineComponent, type PropType } from "vue";
212
212
 
213
- import { type ColorEnum, type FSBreadcrumbItem } from "@dative-gpi/foundation-shared-components/models";
213
+ import { type ColorBase, type FSBreadcrumbItem } from "@dative-gpi/foundation-shared-components/models";
214
214
  import { useBreakpoints, useSlots } from "@dative-gpi/foundation-shared-components/composables";
215
215
 
216
216
  import FSBreadcrumbs from "../FSBreadcrumbs.vue";
@@ -245,8 +245,8 @@ export default defineComponent({
245
245
  required: false,
246
246
  default: null
247
247
  },
248
- color : {
249
- type: Object as PropType<ColorEnum | null>,
248
+ color: {
249
+ type: String as PropType<ColorBase>,
250
250
  required: false,
251
251
  default: null
252
252
  },
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <template
3
+ v-if="isExtraSmall"
4
+ >
5
+ <FSCol
6
+ gap="12px"
7
+ >
8
+ <FSText
9
+ font="text-h3"
10
+ >
11
+ {{ $props.title }}
12
+ </FSText>
13
+ <FSBreadcrumbs
14
+ :items="$props.breadcrumbs"
15
+ />
16
+ </FSCol>
17
+ </template>
18
+ <template
19
+ v-else
20
+ >
21
+ <FSCol
22
+ gap="16px"
23
+ >
24
+ <FSText
25
+ font="text-h2"
26
+ >
27
+ {{ $props.title }}
28
+ </FSText>
29
+ <FSBreadcrumbs
30
+ :items="$props.breadcrumbs"
31
+ />
32
+ <FSSlideGroup
33
+ v-if="$slots['toolbar']"
34
+ style="min-width: 100%;"
35
+ >
36
+ <slot
37
+ name="toolbar"
38
+ />
39
+ </FSSlideGroup>
40
+ </FSCol>
41
+ </template>
42
+ </template>
43
+
44
+ <script lang="ts">
45
+ import { defineComponent, type PropType } from "vue";
46
+
47
+ import { type FSBreadcrumbItem } from "@dative-gpi/foundation-shared-components/models";
48
+ import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
49
+
50
+ import FSBreadcrumbs from "../FSBreadcrumbs.vue";
51
+ import FSSlideGroup from "../FSSlideGroup.vue";
52
+ import FSText from "../FSText.vue";
53
+ import FSCol from "../FSCol.vue";
54
+
55
+ export default defineComponent({
56
+ name: "FSListHeader",
57
+ components: {
58
+ FSBreadcrumbs,
59
+ FSSlideGroup,
60
+ FSText,
61
+ FSCol
62
+ },
63
+ props: {
64
+ title: {
65
+ type: String as PropType<string | null>,
66
+ required: false,
67
+ default: null
68
+ },
69
+ breadcrumbs: {
70
+ type: Array as PropType<Array<FSBreadcrumbItem>>,
71
+ required: false,
72
+ default: () => []
73
+ },
74
+ },
75
+ setup() {
76
+ const { isExtraSmall } = useBreakpoints();
77
+
78
+ return {
79
+ isExtraSmall
80
+ };
81
+ }
82
+ });
83
+ </script>
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <FSSkeletonView>
3
+ <template
4
+ #header
5
+ >
6
+ <FSListHeader
7
+ ref="headerRef"
8
+ :breadcrumbs="$props.breadcrumbs"
9
+ :title="$props.title"
10
+ padding="0 14px 0 0"
11
+ >
12
+ <template
13
+ #toolbar
14
+ >
15
+ <slot
16
+ name="toolbar"
17
+ />
18
+ </template>
19
+ </FSListHeader>
20
+ </template>
21
+ <template
22
+ #default
23
+ >
24
+ <FSFadeOut
25
+ padding="0 8px 0 0"
26
+ :height="height"
27
+ >
28
+ <slot
29
+ name="default"
30
+ />
31
+ </FSFadeOut>
32
+ </template>
33
+ </FSSkeletonView>
34
+ </template>
35
+
36
+ <script lang="ts">
37
+ import { computed, defineComponent, type PropType, ref } from "vue";
38
+
39
+ import { type FSBreadcrumbItem } from "@dative-gpi/foundation-shared-components/models";
40
+ import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
41
+
42
+ import FSSkeletonView from "./FSSkeletonView.vue";
43
+ import FSListHeader from "./FSListHeader.vue";
44
+ import FSFadeOut from "../FSFadeOut.vue";
45
+
46
+ export default defineComponent({
47
+ name: "FSListView",
48
+ components: {
49
+ FSSkeletonView,
50
+ FSListHeader,
51
+ FSFadeOut
52
+ },
53
+ props: {
54
+ title: {
55
+ type: String as PropType<string | null>,
56
+ required: false,
57
+ default: null
58
+ },
59
+ breadcrumbs: {
60
+ type: Array as PropType<FSBreadcrumbItem[]>,
61
+ required: false,
62
+ default: () => []
63
+ }
64
+ },
65
+ setup() {
66
+ const { isExtraSmall, windowHeight } = useBreakpoints();
67
+
68
+ const headerRef = ref<HTMLElement | null>(null);
69
+
70
+ const height = computed((): string => {
71
+ let other = isExtraSmall.value ? 16 + 16 : 24 + 24 // Paddings
72
+ + (headerRef.value?.clientHeight ?? 0); // Header
73
+
74
+ return `${windowHeight.value - other}px`;
75
+ });
76
+
77
+ return {
78
+ headerRef,
79
+ height
80
+ };
81
+ }
82
+ });
83
+ </script>
@@ -56,11 +56,20 @@ export const useColors = () => {
56
56
  return color.lighten(color.value() / 50);
57
57
  }
58
58
 
59
- const getColors = (color: ColorBase): ColorVariations => {
59
+ const parseColor = (color: ColorBase): Color => {
60
60
  const themed = (Object as any).values(ColorEnum).includes(color);
61
+
62
+ try {
63
+ return themed ? new Color(theme.colors[color as ColorEnum]) : new Color(color);
64
+ }
65
+ catch {
66
+ return new Color("#000000");
67
+ }
68
+ }
61
69
 
62
- const base = themed ? new Color(theme.colors[color as ColorEnum]) : new Color(color);
63
-
70
+ const getColors = (color: ColorBase): ColorVariations => {
71
+ const base = parseColor(color);
72
+
64
73
  const light = getLight(base);
65
74
  const soft = getSoft(base);
66
75
  const dark = getDark(base);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-components",
3
3
  "sideEffects": false,
4
- "version": "1.0.5",
4
+ "version": "1.0.7",
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": "1.0.5",
14
- "@dative-gpi/foundation-shared-services": "1.0.5"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.7",
14
+ "@dative-gpi/foundation-shared-services": "1.0.7"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@dative-gpi/bones-ui": "^0.0.75",
@@ -35,5 +35,5 @@
35
35
  "sass": "1.71.1",
36
36
  "sass-loader": "13.3.2"
37
37
  },
38
- "gitHead": "23b56d709ccee80d14efeadd00136e6c5c7f52b8"
38
+ "gitHead": "d0380d86664f9d28f757a4f2c0d06bf5cd9ca5e9"
39
39
  }