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

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.
@@ -27,11 +27,9 @@
27
27
  </template>
28
28
 
29
29
  <script lang="ts">
30
- import type { PropType, Ref} from "vue";
31
- import { defineComponent, ref } from "vue";
30
+ import { defineComponent, type PropType, type Ref, ref } from "vue";
32
31
 
33
- import type { FSBreadcrumbItem } from "@dative-gpi/foundation-shared-components/models";
34
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
32
+ import { ColorEnum, type FSBreadcrumbItem } from "@dative-gpi/foundation-shared-components/models";
35
33
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
36
34
 
37
35
  import FSSpan from "./FSSpan.vue";
@@ -46,7 +44,8 @@ export default defineComponent({
46
44
  props: {
47
45
  items: {
48
46
  type: Array as PropType<FSBreadcrumbItem[]>,
49
- required: true,
47
+ required: false,
48
+ default: () => []
50
49
  }
51
50
  },
52
51
  setup() {
@@ -21,11 +21,9 @@
21
21
  </template>
22
22
 
23
23
  <script lang="ts">
24
- import type { PropType } from "vue";
25
- import { computed, defineComponent } from "vue";
24
+ import { computed, defineComponent, type PropType } from "vue";
26
25
 
27
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
28
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
26
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
29
27
 
30
28
  import FSCard from "./FSCard.vue";
31
29
  import FSIcon from "./FSIcon.vue";
@@ -67,14 +65,14 @@ export default defineComponent({
67
65
  const variant = computed((): "background" | "gradient" => {
68
66
  switch (props.backgroundColor) {
69
67
  case ColorEnum.Background: return "background";
70
- default: return "gradient";
68
+ default : return "gradient";
71
69
  }
72
70
  });
73
71
 
74
72
  const border = computed((): boolean => {
75
73
  switch (props.backgroundColor) {
76
74
  case ColorEnum.Background: return true;
77
- default: return false;
75
+ default : return false;
78
76
  }
79
77
  });
80
78
 
@@ -0,0 +1,319 @@
1
+ <template>
2
+ <template
3
+ v-if="isExtraSmall"
4
+ >
5
+ <FSCol
6
+ class="f-entity-header"
7
+ padding="0 10px 0 0"
8
+ align="center-left"
9
+ gap="12px"
10
+ >
11
+ <FSRow
12
+ align="center-left"
13
+ gap="12px"
14
+ :height="imageSize"
15
+ :wrap="false"
16
+ >
17
+ <FSImage
18
+ v-if="$props.imageId"
19
+ :imageId="$props.imageId"
20
+ :height="imageSize"
21
+ :width="imageSize"
22
+ :cover="imageCover"
23
+ />
24
+ <FSIcon
25
+ v-else-if="$props.icon && $props.color"
26
+ :icon="$props.icon"
27
+ :size="imageSize"
28
+ :color="$props.color"
29
+ />
30
+ <FSIconCard
31
+ v-else-if="$props.icon && $props.iconBackgroundColors && $props.iconBackgroundColors.length > 0"
32
+ :icon="$props.icon"
33
+ :size="imageSize"
34
+ :backgroundColor="$props.iconBackgroundColors"
35
+ />
36
+ <FSCol
37
+ align="center-left"
38
+ :width="`calc(100% - ${rightOverflow})`"
39
+ >
40
+ <template
41
+ v-if="$props.subtitle && $props.description"
42
+ >
43
+ <FSText
44
+ font="text-h3"
45
+ >
46
+ {{ $props.title }}
47
+ </FSText>
48
+ <FSCol
49
+ align="center-left"
50
+ gap="4px"
51
+ >
52
+ <FSText>
53
+ {{ $props.subtitle }}
54
+ </FSText>
55
+ <FSText
56
+ font="text-overline"
57
+ >
58
+ {{ $props.description }}
59
+ </FSText>
60
+ </FSCol>
61
+ </template>
62
+ <template
63
+ v-else-if="$props.subtitle && !$props.description"
64
+ >
65
+ <FSText
66
+ font="text-h3"
67
+ :lineClamp="2"
68
+ >
69
+ {{ $props.title }}
70
+ </FSText>
71
+ <FSText>
72
+ {{ $props.subtitle }}
73
+ </FSText>
74
+ </template>
75
+ <template
76
+ v-else-if="!$props.subtitle && $props.description"
77
+ >
78
+ <FSText
79
+ font="text-h3"
80
+ :lineClamp="2"
81
+ >
82
+ {{ $props.title }}
83
+ </FSText>
84
+ <FSText
85
+ font="text-overline"
86
+ :lineClamp="2"
87
+ >
88
+ {{ $props.description }}
89
+ </FSText>
90
+ </template>
91
+ <template
92
+ v-else
93
+ >
94
+ <FSText
95
+ font="text-h3"
96
+ :lineClamp="2"
97
+ >
98
+ {{ $props.title }}
99
+ </FSText>
100
+ </template>
101
+ </FSCol>
102
+ </FSRow>
103
+ <template
104
+ v-if="!$props.light"
105
+ >
106
+ <FSBreadcrumbs
107
+ :items="$props.breadcrumbs"
108
+ />
109
+ <FSSlideGroup
110
+ v-if="slots['toolbar']"
111
+ >
112
+ <slot
113
+ name="toolbar"
114
+ />
115
+ </FSSlideGroup>
116
+ <slot
117
+ name="title-append"
118
+ />
119
+ </template>
120
+ </FSCol>
121
+ </template>
122
+ <template
123
+ v-else
124
+ >
125
+ <FSCol
126
+ class="f-entity-header"
127
+ padding="0 14px 0 0"
128
+ align="center-left"
129
+ gap="16px"
130
+ >
131
+ <FSRow
132
+ align="center-left"
133
+ gap="16px"
134
+ :height="imageSize"
135
+ :wrap="false"
136
+ >
137
+ <FSImage
138
+ v-if="$props.imageId"
139
+ :imageId="$props.imageId"
140
+ :height="imageSize"
141
+ :width="imageSize"
142
+ :cover="imageCover"
143
+ />
144
+ <FSIconCard
145
+ v-else-if="$props.icon && $props.iconBackgroundColors && $props.iconBackgroundColors.length > 0"
146
+ :icon="$props.icon"
147
+ :size="imageSize"
148
+ iconSize="70px"
149
+ :backgroundColor="$props.iconBackgroundColors"
150
+ />
151
+ <FSIcon
152
+ v-else-if="$props.icon"
153
+ :icon="$props.icon"
154
+ :size="imageSize"
155
+ :color="$props.color"
156
+ />
157
+ <FSCol
158
+ align="center-left"
159
+ >
160
+ <FSText
161
+ :font="$props.light ? 'text-h3' : 'text-h2'"
162
+ >
163
+ {{ $props.title }}
164
+ </FSText>
165
+ <FSCol
166
+ v-if="!$props.light && ($props.subtitle || $props.description)"
167
+ gap="4px"
168
+ >
169
+ <FSText
170
+ v-if="$props.subtitle"
171
+ >
172
+ {{ $props.subtitle }}
173
+ </FSText>
174
+ <FSText
175
+ v-if="$props.description"
176
+ font="text-overline"
177
+ :lineClamp="2"
178
+ >
179
+ {{ $props.description }}
180
+ </FSText>
181
+ </FSCol>
182
+ </FSCol>
183
+ <FSRow
184
+ v-if="!$props.light"
185
+ align="center-right"
186
+ >
187
+ <slot
188
+ name="title-append"
189
+ />
190
+ </FSRow>
191
+ </FSRow>
192
+ <template
193
+ v-if="!$props.light"
194
+ >
195
+ <FSBreadcrumbs
196
+ :items="$props.breadcrumbs"
197
+ />
198
+ <FSSlideGroup
199
+ v-if="slots['toolbar']"
200
+ >
201
+ <slot
202
+ name="toolbar"
203
+ />
204
+ </FSSlideGroup>
205
+ </template>
206
+ </FSCol>
207
+ </template>
208
+ </template>
209
+
210
+ <script lang="ts">
211
+ import { computed, defineComponent, type PropType } from "vue";
212
+
213
+ import { type ColorEnum, type FSBreadcrumbItem } from "@dative-gpi/foundation-shared-components/models";
214
+ import { useBreakpoints, useSlots } from "@dative-gpi/foundation-shared-components/composables";
215
+
216
+ import FSBreadcrumbs from "../FSBreadcrumbs.vue";
217
+ import FSSlideGroup from "../FSSlideGroup.vue";
218
+ import FSIconCard from "../FSIconCard.vue";
219
+ import FSImage from "../FSImage.vue";
220
+ import FSIcon from "../FSIcon.vue";
221
+ import FSText from "../FSText.vue";
222
+ import FSCol from "../FSCol.vue";
223
+ import FSRow from "../FSRow.vue";
224
+
225
+ export default defineComponent({
226
+ name: "FSEntityHeader",
227
+ components: {
228
+ FSBreadcrumbs,
229
+ FSSlideGroup,
230
+ FSIconCard,
231
+ FSImage,
232
+ FSIcon,
233
+ FSText,
234
+ FSCol,
235
+ FSRow
236
+ },
237
+ props: {
238
+ imageId: {
239
+ type: String as PropType<string | null>,
240
+ required: false,
241
+ default: null
242
+ },
243
+ icon: {
244
+ type: String as PropType<string | null>,
245
+ required: false,
246
+ default: null
247
+ },
248
+ color : {
249
+ type: Object as PropType<ColorEnum | null>,
250
+ required: false,
251
+ default: null
252
+ },
253
+ iconBackgroundColors: {
254
+ type: Array as PropType<string[]>,
255
+ required: false,
256
+ default: () => []
257
+ },
258
+ title: {
259
+ type: String as PropType<string | null>,
260
+ required: false,
261
+ default: null
262
+ },
263
+ subtitle: {
264
+ type: String as PropType<string | null>,
265
+ required: false,
266
+ default: null
267
+ },
268
+ description: {
269
+ type: String as PropType<string | null>,
270
+ required: false,
271
+ default: null
272
+ },
273
+ breadcrumbs: {
274
+ type: Array as PropType<Array<FSBreadcrumbItem>>,
275
+ required: false,
276
+ default: () => []
277
+ },
278
+ light: {
279
+ type: Boolean,
280
+ required: false,
281
+ default: false
282
+ },
283
+ imageCover: {
284
+ type: Boolean,
285
+ required: false,
286
+ default: true
287
+ }
288
+ },
289
+ setup(props) {
290
+ const { isExtraSmall, isMobileSized } = useBreakpoints();
291
+ const { slots } = useSlots();
292
+
293
+ const imageSize = computed((): string[] | string => {
294
+ if (props.light) {
295
+ return ["40px", "36px"];
296
+ }
297
+ return ["124px", "96px", "80px"];
298
+ });
299
+
300
+ const rightOverflow = computed(() => {
301
+ let result = imageSize.value[0];
302
+ if (isExtraSmall.value && imageSize.value[2]) {
303
+ result = imageSize.value[2];
304
+ }
305
+ if ((isExtraSmall.value || isMobileSized.value) && imageSize.value[1]) {
306
+ result = imageSize.value[1];
307
+ }
308
+ return result;
309
+ });
310
+
311
+ return {
312
+ rightOverflow,
313
+ isExtraSmall,
314
+ imageSize,
315
+ slots
316
+ };
317
+ }
318
+ });
319
+ </script>
@@ -0,0 +1,148 @@
1
+ <template>
2
+ <FSSkeletonView>
3
+ <template
4
+ #header
5
+ >
6
+ <FSEntityHeader
7
+ ref="headerRef"
8
+ :breadcrumbs="$props.breadcrumbs"
9
+ :description="$props.description"
10
+ :subtitle="$props.subtitle"
11
+ :imageId="$props.imageId"
12
+ :title="$props.title"
13
+ :light="lightHeader"
14
+ :icon="$props.icon"
15
+ :color="$props.color"
16
+ :iconBackgroundColors="$props.iconBackgroundColors"
17
+ :imageCover="$props.imageCover"
18
+ >
19
+ <template
20
+ #title-append
21
+ >
22
+ <slot
23
+ name="title-append"
24
+ />
25
+ </template>
26
+ <template
27
+ #toolbar
28
+ v-if="slots['toolbar']"
29
+ >
30
+ <slot
31
+ name="toolbar"
32
+ />
33
+ </template>
34
+ </FSEntityHeader>
35
+ </template>
36
+ <template
37
+ #default
38
+ >
39
+ <!-- <FSFadeOut
40
+ padding="0 8px 0 0"
41
+ :height="height"
42
+ @scroll="onScroll"
43
+ > -->
44
+ <slot
45
+ name="default"
46
+ />
47
+ <!-- </FSFadeOut> -->
48
+ </template>
49
+ </FSSkeletonView>
50
+ </template>
51
+
52
+ <script lang="ts">
53
+ import { computed, defineComponent, type PropType, ref } from "vue";
54
+
55
+ import { type ColorEnum, type FSBreadcrumbItem } from "@dative-gpi/foundation-shared-components/models";
56
+ import { useBreakpoints, useSlots } from "@dative-gpi/foundation-shared-components/composables";
57
+
58
+ import FSEntityHeader from "./FSEntityHeader.vue";
59
+ import FSSkeletonView from "./FSSkeletonView.vue";
60
+ // import FSFadeOut from "../FSFadeOut.vue";
61
+
62
+ export default defineComponent({
63
+ name: "FSEntityView",
64
+ components: {
65
+ FSEntityHeader,
66
+ FSSkeletonView
67
+ // FSFadeOut
68
+ },
69
+ props: {
70
+ imageId: {
71
+ type: String as PropType<string | null>,
72
+ required: false,
73
+ default: null
74
+ },
75
+ imageCover: {
76
+ type: Boolean,
77
+ required: false,
78
+ default: true
79
+ },
80
+ icon: {
81
+ type: String as PropType<string | null>,
82
+ required: false,
83
+ default: null
84
+ },
85
+ color : {
86
+ type: Object as PropType<ColorEnum | null>,
87
+ required: false,
88
+ default: null
89
+ },
90
+ iconBackgroundColors: {
91
+ type: Array as PropType<string[]>,
92
+ required: false,
93
+ default: () => []
94
+ },
95
+ title: {
96
+ type: String as PropType<string | null>,
97
+ required: false,
98
+ default: null
99
+ },
100
+ subtitle: {
101
+ type: String as PropType<string | null>,
102
+ required: false,
103
+ default: null
104
+ },
105
+ description: {
106
+ type: String as PropType<string | null>,
107
+ required: false,
108
+ default: null
109
+ },
110
+ breadcrumbs: {
111
+ type: Array as PropType<FSBreadcrumbItem[]>,
112
+ required: false,
113
+ default: () => []
114
+ }
115
+ },
116
+ setup() {
117
+ const { isExtraSmall, windowHeight } = useBreakpoints();
118
+ const { slots } = useSlots();
119
+
120
+ const headerRef = ref<HTMLElement | null>(null);
121
+
122
+ const lightHeader = ref(false);
123
+
124
+ const height = computed((): string => {
125
+ let other = isExtraSmall.value ? 16 + 16 : 24 + 24; // Paddings
126
+
127
+ return `${windowHeight.value - other}px`;
128
+ });
129
+
130
+ // const onScroll = (event: any): void => {
131
+ // if (event.onTop) {
132
+ // lightHeader.value = false;
133
+ // }
134
+ // else if (event.target.scrollTop > (headerRef.value as any)?.$el.clientHeight) {
135
+ // lightHeader.value = true;
136
+ // }
137
+ // };
138
+
139
+ return {
140
+ lightHeader,
141
+ headerRef,
142
+ height,
143
+ slots
144
+ // onScroll
145
+ };
146
+ }
147
+ });
148
+ </script>
@@ -0,0 +1,100 @@
1
+ <template>
2
+ <template
3
+ v-if="isExtraSmall"
4
+ >
5
+ <FSCol
6
+ padding="16px 4px 16px 12px"
7
+ height="100vh"
8
+ gap="16px"
9
+ >
10
+ <slot
11
+ name="header"
12
+ >
13
+ <slot
14
+ name="title"
15
+ >
16
+ <FSRow
17
+ gap="12px"
18
+ >
19
+ <slot
20
+ name="title-image"
21
+ />
22
+ <slot
23
+ name="title-texts"
24
+ />
25
+ </FSRow>
26
+ </slot>
27
+ </slot>
28
+ <slot
29
+ name="breadcrumbs"
30
+ />
31
+ <slot
32
+ name="toolbar"
33
+ />
34
+ <slot
35
+ name="title-append"
36
+ />
37
+ <slot
38
+ name="default"
39
+ />
40
+ </FSCol>
41
+ </template>
42
+ <template
43
+ v-else
44
+ >
45
+ <FSCol
46
+ padding="24px 8px 24px 24px"
47
+ height="100vh"
48
+ gap="16px"
49
+ >
50
+ <slot
51
+ name="header"
52
+ >
53
+ <slot
54
+ name="title"
55
+ >
56
+ <FSRow
57
+ gap="32px"
58
+ >
59
+ <slot
60
+ name="title-image"
61
+ />
62
+ <slot
63
+ name="title-texts"
64
+ />
65
+ <v-spacer />
66
+ <slot
67
+ name="title-append"
68
+ />
69
+ </FSRow>
70
+ </slot>
71
+ </slot>
72
+ <slot
73
+ name="breadcrumbs"
74
+ />
75
+ <slot
76
+ name="toolbar"
77
+ />
78
+ <slot
79
+ name="default"
80
+ />
81
+ </FSCol>
82
+ </template>
83
+ </template>
84
+
85
+ <script lang="ts">
86
+ import { defineComponent } from "vue";
87
+
88
+ import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
89
+
90
+ export default defineComponent({
91
+ name: "FSSkeletonView",
92
+ setup() {
93
+ const { isExtraSmall } = useBreakpoints();
94
+
95
+ return {
96
+ isExtraSmall
97
+ };
98
+ }
99
+ });
100
+ </script>
@@ -5,21 +5,7 @@ export const useSlots = () => {
5
5
  const innerSlots = { ...useVueSlots() };
6
6
  const innerName = name ?? "default";
7
7
  if (innerSlots[innerName] != null) {
8
- const slot = innerSlots[innerName]!;
9
- switch (typeof(slot()[0].type)) {
10
- // Directive wrapper (v-for, v-if)
11
- case "symbol":
12
- switch (slot()[0].type) {
13
- case Symbol.for("v-fgt"): return recursiveGetChildren(slot()[0].children);
14
- case Symbol.for("v-cmt"): return slot();
15
- default: return slot();
16
- }
17
- // Custom component
18
- case "object": return slot();
19
- // Pre-existing component
20
- case "string": return slot();
21
- }
22
- return slot();
8
+ return recursiveGetChildren(innerSlots[innerName]!());
23
9
  }
24
10
  return null;
25
11
  };
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.3",
4
+ "version": "1.0.5",
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.3",
14
- "@dative-gpi/foundation-shared-services": "1.0.3"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.5",
14
+ "@dative-gpi/foundation-shared-services": "1.0.5"
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": "f22b676408f33de3f017b51fc1c535a67f194632"
38
+ "gitHead": "23b56d709ccee80d14efeadd00136e6c5c7f52b8"
39
39
  }
@@ -1,6 +1,7 @@
1
1
  .fs-text-area:not(.fs-text-area-auto-grow) {
2
2
  & > .v-input__control > .v-field {
3
3
  border: 1px solid var(--fs-text-area-border-color) !important;
4
+ height: var(--fs-text-area-height);
4
5
 
5
6
  &--error {
6
7
  border-color: var(--fs-text-area-error-border-color) !important;
@@ -24,8 +25,6 @@
24
25
  color: var(--fs-text-area-color);
25
26
  padding: 0;
26
27
  }
27
-
28
- height: var(--fs-text-area-height);
29
28
 
30
29
  @include web {
31
30
  padding: 11px 16px !important;