@dative-gpi/foundation-shared-components 0.0.46 → 0.0.47

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.
@@ -0,0 +1,132 @@
1
+ <template>
2
+ <FSCol
3
+ gap="0"
4
+ >
5
+ <FSRow
6
+ v-for="(item, index) in $props.items"
7
+ align="center-center"
8
+ class="fs-grid-item"
9
+ padding="0 8px"
10
+ height="hug"
11
+ :style="style"
12
+ :key="index"
13
+ >
14
+ <FSCol
15
+ gap="2px"
16
+ >
17
+ <template v-if="headerSlot(item.code)">
18
+ <component
19
+ :is="headerSlot(item.code)"
20
+ v-bind="{ item }"
21
+ />
22
+ </template>
23
+ <template v-else>
24
+ <FSText
25
+ :font="item.hideDefault ? 'text-body' : 'text-overline'"
26
+ >
27
+ {{ item.label }}
28
+ </FSText>
29
+ </template>
30
+ <template v-if="!item.hideDefault">
31
+ <template v-if="itemSlot(item.code)">
32
+ <component
33
+ :is="itemSlot(item.code)"
34
+ v-bind="{ item }"
35
+ />
36
+ </template>
37
+ <template v-else>
38
+ <FSText>
39
+ {{ item.value }}
40
+ </FSText>
41
+ </template>
42
+ </template>
43
+ </FSCol>
44
+ <v-spacer />
45
+ <FSRow
46
+ v-if="itemEndSlot(item.code)"
47
+ align="center-right"
48
+ >
49
+ <component
50
+ :is="itemEndSlot(item.code)"
51
+ v-bind="{ item }"
52
+ />
53
+ </FSRow>
54
+ </FSRow>
55
+ </FSCol>
56
+ </template>
57
+
58
+ <script lang="ts">
59
+ import { computed, defineComponent, PropType } from "vue";
60
+
61
+ import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
62
+ import { ColorEnum, GridItem } from "@dative-gpi/foundation-shared-components/models";
63
+
64
+ import FSText from "./FSText.vue";
65
+ import FSCol from "./FSCol.vue";
66
+ import FSRow from "./FSRow.vue";
67
+
68
+ export default defineComponent({
69
+ name: "FSGrid",
70
+ components: {
71
+ FSText,
72
+ FSCol,
73
+ FSRow
74
+ },
75
+ props: {
76
+ items: {
77
+ type: Array as PropType<GridItem[]>,
78
+ default: [],
79
+ required: false
80
+ }
81
+ },
82
+ setup() {
83
+ const { getColors } = useColors();
84
+ const { slots } = useSlots();
85
+
86
+ const lights = getColors(ColorEnum.Light);
87
+
88
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
89
+ return {
90
+ "--fs-grid-border-color": lights.dark
91
+ };
92
+ });
93
+
94
+ const headerSlot = (code: string) => {
95
+ if (slots[`header.${code}`]) {
96
+ return slots[`header.${code}`];
97
+ }
98
+ else if (slots[`header`]) {
99
+ return slots[`header`];
100
+ }
101
+ return null;
102
+ };
103
+
104
+ const itemSlot = (code: string) => {
105
+ if (slots[`item.${code}`]) {
106
+ return slots[`item.${code}`];
107
+ }
108
+ else if (slots[`item`]) {
109
+ return slots[`item`];
110
+ }
111
+ return null;
112
+ };
113
+
114
+ const itemEndSlot = (code: string) => {
115
+ if (slots[`item-end.${code}`]) {
116
+ return slots[`item-end.${code}`];
117
+ }
118
+ else if (slots[`item-end`]) {
119
+ return slots[`item-end`];
120
+ }
121
+ return null;
122
+ };
123
+
124
+ return {
125
+ style,
126
+ itemSlot,
127
+ headerSlot,
128
+ itemEndSlot
129
+ };
130
+ }
131
+ });
132
+ </script>
@@ -0,0 +1,67 @@
1
+ <template>
2
+ <FSRow
3
+ gap="32px"
4
+ >
5
+ <FSRow
6
+ v-for="(item, index) in items"
7
+ :width="width"
8
+ :key="index"
9
+ >
10
+ <FSCol
11
+ gap="16px"
12
+ >
13
+ <FSText
14
+ font="text-h3"
15
+ >
16
+ {{ item.categoryLabel }}
17
+ </FSText>
18
+ <FSGrid
19
+ :items="item.items"
20
+ />
21
+ </FSCol>
22
+ </FSRow>
23
+ </FSRow>
24
+ </template>
25
+
26
+ <script lang="ts">
27
+ import { computed, defineComponent, PropType } from "vue";
28
+
29
+ import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
30
+ import { GridMosaic } from "@dative-gpi/foundation-shared-components/models";
31
+
32
+ import FSGrid from "./FSGrid.vue";
33
+ import FSCol from "./FSCol.vue";
34
+ import FSRow from "./FSRow.vue";
35
+
36
+ export default defineComponent({
37
+ name: "FSGridMosaic",
38
+ components: {
39
+ FSGrid,
40
+ FSCol,
41
+ FSRow
42
+ },
43
+ props: {
44
+ items: {
45
+ type: Array as PropType<GridMosaic[]>,
46
+ default: [],
47
+ required: false
48
+ },
49
+ cols: {
50
+ type: Number as PropType<1 | 2>,
51
+ required: false,
52
+ default: 1
53
+ }
54
+ },
55
+ setup(props) {
56
+ const { isExtraSmall } = useBreakpoints();
57
+
58
+ const width = computed(() => {
59
+ return props.cols == 2 && !isExtraSmall.value ? "calc(50% - 16px)" : "100%";
60
+ });
61
+
62
+ return {
63
+ width
64
+ };
65
+ }
66
+ });
67
+ </script>
@@ -21,6 +21,7 @@
21
21
 
22
22
  <script lang="ts">
23
23
  import { defineComponent, ref } from "vue";
24
+
24
25
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
25
26
 
26
27
  import FSButton from "../FSButton.vue";
@@ -34,12 +35,12 @@ export default defineComponent({
34
35
  accept: {
35
36
  type: String,
36
37
  required: false,
37
- default: "",
38
+ default: ""
38
39
  },
39
40
  readFile: {
40
41
  type: Boolean,
41
42
  required: false,
42
- default: true,
43
+ default: true
43
44
  }
44
45
  },
45
46
  emits: ["update:modelValue"],
@@ -21,6 +21,7 @@
21
21
 
22
22
  <script lang="ts">
23
23
  import { defineComponent, ref } from "vue";
24
+
24
25
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
25
26
 
26
27
  import FSButton from "../FSButton.vue";
@@ -34,12 +35,12 @@ export default defineComponent({
34
35
  accept: {
35
36
  type: String,
36
37
  required: false,
37
- default: "",
38
+ default: ""
38
39
  },
39
40
  readFile: {
40
41
  type: Boolean,
41
42
  required: false,
42
- default: true,
43
+ default: true
43
44
  }
44
45
  },
45
46
  emits: ["update:modelValue"],
@@ -20,6 +20,7 @@
20
20
 
21
21
  <script lang="ts">
22
22
  import { defineComponent, ref } from "vue";
23
+
23
24
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
24
25
 
25
26
  import FSButton from "../FSButton.vue";
@@ -33,12 +34,12 @@ export default defineComponent({
33
34
  accept: {
34
35
  type: String,
35
36
  required: false,
36
- default: "",
37
+ default: ""
37
38
  },
38
39
  readFile: {
39
40
  type: Boolean,
40
41
  required: false,
41
- default: true,
42
+ default: true
42
43
  }
43
44
  },
44
45
  emits: ["update:modelValue"],
@@ -20,6 +20,7 @@
20
20
 
21
21
  <script lang="ts">
22
22
  import { defineComponent, ref } from "vue";
23
+
23
24
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
24
25
 
25
26
  import FSButton from "../FSButton.vue";
@@ -33,12 +34,12 @@ export default defineComponent({
33
34
  accept: {
34
35
  type: String,
35
36
  required: false,
36
- default: "",
37
+ default: ""
37
38
  },
38
39
  readFile: {
39
40
  type: Boolean,
40
41
  required: false,
41
- default: true,
42
+ default: true
42
43
  }
43
44
  },
44
45
  emits: ["update:modelValue"],
package/models/grids.ts CHANGED
@@ -1,10 +1,10 @@
1
- export interface GridItem {
1
+ export interface GridMosaic {
2
2
  categoryLabel: string;
3
3
  categoryCode: string;
4
- items: Item[];
4
+ items: GridItem[];
5
5
  }
6
6
 
7
- export interface Item {
7
+ export interface GridItem {
8
8
  label: string;
9
9
  code: string;
10
10
  value: string;
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.46",
4
+ "version": "0.0.47",
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.46",
14
- "@dative-gpi/foundation-shared-services": "0.0.46",
13
+ "@dative-gpi/foundation-shared-domain": "0.0.47",
14
+ "@dative-gpi/foundation-shared-services": "0.0.47",
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": "a1963363ed2f74aa24319fae34baeaa4d54e5e97"
35
+ "gitHead": "4fe5299cdc8c81c71d98ab53e944e1ebacaf9e24"
36
36
  }
@@ -1,131 +0,0 @@
1
- <template>
2
- <FSRow
3
- gap="32px"
4
- >
5
- <FSRow
6
- v-for="(gridItem, index) in gridItems"
7
- :width="width"
8
- :style="style"
9
- :key="index"
10
- >
11
- <FSCol
12
- gap="16px"
13
- >
14
- <FSText
15
- font="text-h3"
16
- >
17
- {{ gridItem.categoryLabel }}
18
- </FSText>
19
- <FSCol
20
- gap="0"
21
- >
22
- <FSRow
23
- v-for="(item, index) in gridItem.items"
24
- padding="0 8px"
25
- align="center-center"
26
- class="fs-grid-item"
27
- height="hug"
28
- :key="index"
29
- >
30
- <FSCol
31
- gap="2px"
32
- >
33
- <slot :name="`item-header.${gridItem.categoryCode}-${item.code}`" v-bind="{ item }">
34
- <FSText
35
- :font="item.hideDefault ? 'text-body' : 'text-overline'"
36
- >
37
- {{ item.label }}
38
- </FSText>
39
- </slot>
40
- <FSRow
41
- v-if="!item.hideDefault"
42
- >
43
- <slot
44
- :name="`item-value-left.${gridItem.categoryCode}-${item.code}`"
45
- v-bind="{ item }"
46
- >
47
- <FSText>
48
- {{ item.value }}
49
- </FSText>
50
- </slot>
51
- </FSRow>
52
- </FSCol>
53
- <v-spacer />
54
- <FSRow
55
- v-if="useSlot(`item-value-right.${gridItem.categoryCode}-${item.code}`)"
56
- align="center-right"
57
- >
58
- <slot
59
- :name="`item-value-right.${gridItem.categoryCode}-${item.code}`"
60
- v-bind="{ item }"
61
- >
62
- <FSText
63
- font="text-body"
64
- >
65
- {{ item.value }}
66
- </FSText>
67
- </slot>
68
- </FSRow>
69
- </FSRow>
70
- </FSCol>
71
- </FSCol>
72
- </FSRow>
73
- </FSRow>
74
- </template>
75
-
76
- <script lang="ts">
77
- import { computed, defineComponent, PropType } from "vue";
78
-
79
- import { useBreakpoints, useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
80
- import { ColorEnum, GridItem } from "@dative-gpi/foundation-shared-components/models";
81
-
82
- import FSDivider from "../FSDivider.vue";
83
- import FSText from "../FSText.vue";
84
-
85
- export default defineComponent({
86
- name: "FSGrid",
87
- components: {
88
- FSDivider,
89
- FSText
90
- },
91
- props: {
92
- gridItems: {
93
- type: Array as PropType<GridItem[]>,
94
- default: [],
95
- required: false
96
- },
97
- cols: {
98
- type: Number as PropType<1 | 2>,
99
- required: false,
100
- default: 1
101
- }
102
- },
103
- setup(props) {
104
- const { isExtraSmall } = useBreakpoints();
105
- const { getColors } = useColors();
106
- const { slots } = useSlots();
107
-
108
- const lights = getColors(ColorEnum.Light);
109
-
110
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
111
- return {
112
- "--fs-grid-border-color": lights.dark
113
- };
114
- });
115
-
116
- const width = computed(() => {
117
- return props.cols == 2 && !isExtraSmall.value ? "calc(50% - 16px)" : "100%";
118
- });
119
-
120
- const useSlot = (name: string): boolean => {
121
- return !!slots[name];
122
- };
123
-
124
- return {
125
- width,
126
- style,
127
- useSlot
128
- }
129
- }
130
- })
131
- </script>