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

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.
@@ -1,8 +1,7 @@
1
1
  <template>
2
- <FSContainer
2
+ <div
3
3
  class="fs-card"
4
4
  :style="style"
5
- v-bind="$attrs"
6
5
  >
7
6
  <slot>
8
7
  <FSCol
@@ -25,26 +24,56 @@
25
24
  </FSRow>
26
25
  </FSCol>
27
26
  </slot>
28
- </FSContainer>
27
+ </div>
29
28
  </template>
30
29
 
31
30
  <script lang="ts">
32
31
  import { computed, defineComponent, PropType } from "vue";
33
32
 
33
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
34
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
34
35
  import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
35
36
 
36
- import FSContainer from "./FSContainer.vue";
37
37
  import FSCol from "./FSCol.vue";
38
38
  import FSRow from "./FSRow.vue";
39
39
 
40
40
  export default defineComponent({
41
41
  name: "FSCard",
42
42
  components: {
43
- FSContainer,
44
43
  FSCol,
45
44
  FSRow
46
45
  },
47
46
  props: {
47
+ padding: {
48
+ type: [String, Number],
49
+ required: false,
50
+ default: "0"
51
+ },
52
+ border: {
53
+ type: Boolean,
54
+ required: false,
55
+ default: true
56
+ },
57
+ borderRadius: {
58
+ type: [String, Number],
59
+ required: false,
60
+ default: "4px"
61
+ },
62
+ elevation: {
63
+ type: Boolean,
64
+ required: false,
65
+ default: false
66
+ },
67
+ variant: {
68
+ type: String as PropType<"background" | "standard">,
69
+ required: false,
70
+ default: "background"
71
+ },
72
+ color: {
73
+ type: String as PropType<ColorBase>,
74
+ required: false,
75
+ default: ColorEnum.Background
76
+ },
48
77
  width: {
49
78
  type: [Array, String, Number] as PropType<string[] | number[] | string | number>,
50
79
  required: false,
@@ -62,11 +91,36 @@ export default defineComponent({
62
91
  }
63
92
  },
64
93
  setup(props) {
94
+ const { getColors } = useColors();
95
+
96
+ const colors = computed(() => getColors(props.color));
97
+ const backgrounds = getColors(ColorEnum.Background);
98
+ const lights = getColors(ColorEnum.Light);
99
+ const darks = getColors(ColorEnum.Dark);
100
+
65
101
  const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
66
- return {
67
- "--fs-card-width" : sizeToVar(props.width),
68
- "--fs-card-height": sizeToVar(props.height)
69
- };
102
+ switch (props.variant) {
103
+ case "standard": return {
104
+ "--fs-card-border-size" : props.border ? "1px" : "0",
105
+ "--fs-card-border-radius" : sizeToVar(props.borderRadius),
106
+ "--fs-card-padding" : sizeToVar(props.padding),
107
+ "--fs-card-height" : sizeToVar(props.height),
108
+ "--fs-card-width" : sizeToVar(props.width),
109
+ "--fs-card-background-color": colors.value.light,
110
+ "--fs-card-border-color" : colors.value.lightContrast,
111
+ "--fs-card-color" : colors.value.lightContrast
112
+ }
113
+ case "background": return {
114
+ "--fs-card-border-size" : props.border ? "1px" : "0",
115
+ "--fs-card-border-radius" : sizeToVar(props.borderRadius),
116
+ "--fs-card-padding" : sizeToVar(props.padding),
117
+ "--fs-card-height" : sizeToVar(props.height),
118
+ "--fs-card-width" : sizeToVar(props.width),
119
+ "--fs-card-background-color": backgrounds.base,
120
+ "--fs-card-border-color" : lights.dark,
121
+ "--fs-card-color" : darks.base
122
+ }
123
+ }
70
124
  });
71
125
 
72
126
  return {
@@ -6,7 +6,6 @@
6
6
  @click.stop="onClick"
7
7
  >
8
8
  <FSCard
9
- :border="$props.border"
10
9
  :class="classes"
11
10
  :style="style"
12
11
  v-bind="$attrs"
@@ -31,7 +30,6 @@
31
30
  :to="href"
32
31
  >
33
32
  <FSCard
34
- :border="$props.border"
35
33
  :class="classes"
36
34
  :style="style"
37
35
  v-bind="$attrs"
@@ -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"],
@@ -35,7 +35,7 @@
35
35
  </FSRow>
36
36
  <slot name="item.bottom" v-bind="{ item: $props.item }" />
37
37
  </FSCol>
38
- <FSContainer
38
+ <FSCard
39
39
  v-if="$props.showSelect"
40
40
  class="fs-data-iterator-item-checkbox"
41
41
  :border="false"
@@ -45,7 +45,7 @@
45
45
  :modelValue="$props.modelValue"
46
46
  @update:modelValue="() => $emit('update:modelValue', $props.item)"
47
47
  />
48
- </FSContainer>
48
+ </FSCard>
49
49
  </FSCard>
50
50
  </template>
51
51
 
@@ -54,16 +54,14 @@ import { defineComponent, PropType } from "vue";
54
54
 
55
55
  import { ColorEnum, FSDataTableColumn } from "@dative-gpi/foundation-shared-components/models";
56
56
 
57
- import FSContainer from "../FSContainer.vue";
58
57
  import FSCheckbox from "../FSCheckbox.vue";
59
58
  import FSCard from "../FSCard.vue";
60
59
  import FSText from "../FSText.vue";
61
60
  import FSRow from "../FSRow.vue";
62
61
 
63
62
  export default defineComponent({
64
- name: "FSIteratorCard",
63
+ name: "FSDataIteratorItem",
65
64
  components: {
66
- FSContainer,
67
65
  FSCheckbox,
68
66
  FSCard,
69
67
  FSText,
@@ -319,8 +319,8 @@
319
319
  >
320
320
  <template #default="{ items }">
321
321
  <FSCol
322
- width="fill"
323
322
  class="fs-data-iterator-container"
323
+ width="fill"
324
324
  >
325
325
  <FSDraggable
326
326
  v-for="(item, index) in items"
@@ -1,10 +1,19 @@
1
1
  <template>
2
2
  <FSSelectField
3
+ itemTitle="id"
3
4
  :items="entities"
4
5
  :modelValue="$props.modelValue"
5
6
  @update:modelValue="$emit('update:modelValue', $event)"
6
7
  v-bind="$attrs"
7
- />
8
+ >
9
+ <template #selection>
10
+ <FSRow>
11
+ <FSSpan font="text-underline" :style="style">
12
+ {{ entities.find((entity) => entity.id === $props.modelValue)?.id }}
13
+ </FSSpan>
14
+ </FSRow>
15
+ </template>
16
+ </FSSelectField>
8
17
  </template>
9
18
 
10
19
  <script lang="ts">
@@ -39,7 +39,7 @@
39
39
  :width="widths.image"
40
40
  />
41
41
  </FSRow>
42
- <FSContainer
42
+ <FSCard
43
43
  v-if="$props.editable"
44
44
  class="fs-tile-checkbox"
45
45
  :border="false"
@@ -48,7 +48,7 @@
48
48
  :modelValue="$props.modelValue"
49
49
  @update:modelValue="() => $emit('update:modelValue', !$props.modelValue)"
50
50
  />
51
- </FSContainer>
51
+ </FSCard>
52
52
  </FSCard>
53
53
  </template>
54
54
 
@@ -58,7 +58,6 @@ import { computed, defineComponent } from "vue";
58
58
  import { useBreakpoints, useColors } from "@dative-gpi/foundation-shared-components/composables";
59
59
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
60
60
 
61
- import FSContainer from "../FSContainer.vue";
62
61
  import FSCheckbox from "../FSCheckbox.vue";
63
62
  import FSLoader from "../FSLoader.vue";
64
63
  import FSCard from "../FSCard.vue";
@@ -66,9 +65,8 @@ import FSCol from "../FSCol.vue";
66
65
  import FSRow from "../FSRow.vue";
67
66
 
68
67
  export default defineComponent({
69
- name: "FSTile",
68
+ name: "FSLoadTile",
70
69
  components: {
71
- FSContainer,
72
70
  FSCheckbox,
73
71
  FSLoader,
74
72
  FSCard,
@@ -7,7 +7,7 @@
7
7
  :height="height"
8
8
  >
9
9
  <slot />
10
- <FSContainer
10
+ <FSCard
11
11
  v-if="$props.editable"
12
12
  class="fs-tile-checkbox"
13
13
  :border="false"
@@ -17,11 +17,11 @@
17
17
  :modelValue="$props.modelValue"
18
18
  @update:modelValue="() => $emit('update:modelValue', !$props.modelValue)"
19
19
  />
20
- </FSContainer>
21
- <div
22
- class="fs-tile-bottom"
23
- :style="style"
24
- />
20
+ </FSCard>
21
+ <div
22
+ class="fs-tile-bottom"
23
+ :style="style"
24
+ />
25
25
  </FSCard>
26
26
  </template>
27
27
 
@@ -31,14 +31,12 @@ import { computed, defineComponent, PropType } from "vue";
31
31
  import { useBreakpoints, useColors } from "@dative-gpi/foundation-shared-components/composables";
32
32
  import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
33
33
 
34
- import FSContainer from "../FSContainer.vue";
35
34
  import FSCheckbox from "../FSCheckbox.vue";
36
35
  import FSCard from "../FSCard.vue";
37
36
 
38
37
  export default defineComponent({
39
38
  name: "FSTile",
40
39
  components: {
41
- FSContainer,
42
40
  FSCheckbox,
43
41
  FSCard
44
42
  },
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/models/rules.ts CHANGED
@@ -7,59 +7,59 @@ const { epochToLongDateFormat } = useTimeZone()!;
7
7
  const { $tr } = useTranslationsProvider();
8
8
 
9
9
  export const TextRules = {
10
- required: (message: string) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
11
- copy: (original: string, message: string) => (value: string) => value === original || (message ?? $tr("ui.rules.copy", "Different from original")),
12
- min: (min: number, message: string) => (value: string) => value.length >= min || (message ?? $tr("ui.rules.text-min", "Must be at least {0} characters", min.toString())),
13
- max: (max: number, message: string) => (value: string) => value.length <= max || (message ?? $tr("ui.rules.text-max", "Must be at most {0} characters", max.toString())),
14
- email: (message: string) => (value: string) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value) || (message ?? $tr("ui.rules.text-email", "Must be a valid email")),
15
- phone: (message: string) => (value: string) => /^[\+]?([0-9]+[ -]?)+$/.test(value) || (message ?? $tr("ui.rules.text-phone", "Must be a valid phone number")),
16
- digit: (message: string) => (value: string) => /(?=.*\d)/.test(value) || (message ?? $tr("ui.rules.text-digit", "Must contain a digit")),
17
- uppercase: (message: string) => (value: string) => /(?=.*[A-Z])/.test(value) || (message ?? $tr("ui.rules.text-uppercase", "Must contain an uppercase letter")),
18
- lowercase: (message: string) => (value: string) => /(?=.*[a-z])/.test(value) || (message ?? $tr("ui.rules.text-lowercase", "Must contain a lowercase letter")),
19
- special: (message: string) => (value: string) => /(?=.*[!@#$%^&*])/.test(value) || (message ?? $tr("ui.rules.text-special-character", "Must contain a special character"))
10
+ required: (message: string | null) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
11
+ copy: (original: string, message: string | null) => (value: string) => value === original || (message ?? $tr("ui.rules.copy", "Different from original")),
12
+ min: (min: number, message: string | null) => (value: string) => value.length >= min || (message ?? $tr("ui.rules.text-min", "Must be at least {0} characters", min.toString())),
13
+ max: (max: number, message: string | null) => (value: string) => value.length <= max || (message ?? $tr("ui.rules.text-max", "Must be at most {0} characters", max.toString())),
14
+ email: (message: string | null) => (value: string) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value) || (message ?? $tr("ui.rules.text-email", "Must be a valid email")),
15
+ phone: (message: string | null) => (value: string) => /^[\+]?([0-9]+[ -]?)+$/.test(value) || (message ?? $tr("ui.rules.text-phone", "Must be a valid phone number")),
16
+ digit: (message: string | null) => (value: string) => /(?=.*\d)/.test(value) || (message ?? $tr("ui.rules.text-digit", "Must contain a digit")),
17
+ uppercase: (message: string | null) => (value: string) => /(?=.*[A-Z])/.test(value) || (message ?? $tr("ui.rules.text-uppercase", "Must contain an uppercase letter")),
18
+ lowercase: (message: string | null) => (value: string) => /(?=.*[a-z])/.test(value) || (message ?? $tr("ui.rules.text-lowercase", "Must contain a lowercase letter")),
19
+ special: (message: string | null) => (value: string) => /(?=.*[!@#$%^&*])/.test(value) || (message ?? $tr("ui.rules.text-special-character", "Must contain a special character"))
20
20
  };
21
21
 
22
22
  export const TagRules = {
23
- required: (message: string) => (value: string[]) => value.length > 0 || (message ?? $tr("ui.rules.required", "Required")),
24
- min: (min: number, message: string) => (value: string[]) => value.length >= min || (message ?? $tr("ui.rules.tag-min", "Must be at least {0} elements", min.toString())),
25
- max: (max: number, message: string) => (value: string[]) => value.length <= max || (message ?? $tr("ui.rules.tag-max", "Must be at most {0} elements", max.toString()))
23
+ required: (message: string | null) => (value: string[]) => value.length > 0 || (message ?? $tr("ui.rules.required", "Required")),
24
+ min: (min: number, message: string | null) => (value: string[]) => value.length >= min || (message ?? $tr("ui.rules.tag-min", "Must be at least {0} elements", min.toString())),
25
+ max: (max: number, message: string | null) => (value: string[]) => value.length <= max || (message ?? $tr("ui.rules.tag-max", "Must be at most {0} elements", max.toString()))
26
26
  };
27
27
 
28
28
  export const NumberRules = {
29
- required: (message: string) => (value: string) => (!!value && !isNaN(parseFloat(value))) || (message ?? $tr("ui.rules.required", "Required")),
30
- min: (min: number, message: string) => (value: string) => (!!value && !isNaN(parseFloat(value)) && parseFloat(value) >= min) || (message ?? $tr("ui.rules.number-min", "Must be at least {0}", min.toString())),
31
- max: (max: number, message: string) => (value: string) => (!!value && !isNaN(parseFloat(value)) && parseFloat(value) <= max) || (message ?? $tr("ui.rules.number-max", "Must be at most {0}", max.toString())),
32
- integer: (message: string) => (value: string) => (!!value && !isNaN(parseFloat(value)) && Number.isInteger(parseFloat(value))) || (message ?? $tr("ui.rules.number-integer", "Must be an integer"))
29
+ required: (message: string | null) => (value: string) => (!!value && !isNaN(parseFloat(value))) || (message ?? $tr("ui.rules.required", "Required")),
30
+ min: (min: number, message: string | null) => (value: string) => (!!value && !isNaN(parseFloat(value)) && parseFloat(value) >= min) || (message ?? $tr("ui.rules.number-min", "Must be at least {0}", min.toString())),
31
+ max: (max: number, message: string | null) => (value: string) => (!!value && !isNaN(parseFloat(value)) && parseFloat(value) <= max) || (message ?? $tr("ui.rules.number-max", "Must be at most {0}", max.toString())),
32
+ integer: (message: string | null) => (value: string) => (!!value && !isNaN(parseFloat(value)) && Number.isInteger(parseFloat(value))) || (message ?? $tr("ui.rules.number-integer", "Must be an integer"))
33
33
  };
34
34
 
35
35
  export const IconRules = {
36
- required: (message: string) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
36
+ required: (message: string | null) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
37
37
  };
38
38
 
39
39
  export const DateRules = {
40
- required: (message: string) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
41
- min: (min: number, message: string) => (value: number) => (!value || value >= min) || (message ?? $tr("ui.rules.date-min", "Must be after {0}", epochToLongDateFormat(min))),
42
- max: (max: number, message: string) => (value: number) => (!value || value <= max) || (message ?? $tr("ui.rules.date-max", "Must be before {0}", epochToLongDateFormat(max)))
40
+ required: (message: string | null) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
41
+ min: (min: number, message: string | null) => (value: number) => (!value || value >= min) || (message ?? $tr("ui.rules.date-min", "Must be after {0}", epochToLongDateFormat(min))),
42
+ max: (max: number, message: string | null) => (value: number) => (!value || value <= max) || (message ?? $tr("ui.rules.date-max", "Must be before {0}", epochToLongDateFormat(max)))
43
43
  };
44
44
 
45
45
  export const SelectRules = {
46
- required: (message: string) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
47
- min: (min: number, message: string) => (value: string[]) => (Array.isArray(value) && value.length >= min) || (message ?? $tr("ui.rules.select-min", "Must select at least {0} elements", min.toString())),
48
- max: (max: number, message: string) => (value: string[]) => (Array.isArray(value) && value.length <= max) || (message ?? $tr("ui.rules.select-max", "Must select at most {0} elements", max.toString()))
46
+ required: (message: string | null) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
47
+ min: (min: number, message: string | null) => (value: string[]) => (Array.isArray(value) && value.length >= min) || (message ?? $tr("ui.rules.select-min", "Must select at least {0} elements", min.toString())),
48
+ max: (max: number, message: string | null) => (value: string[]) => (Array.isArray(value) && value.length <= max) || (message ?? $tr("ui.rules.select-max", "Must select at most {0} elements", max.toString()))
49
49
  };
50
50
 
51
51
  export const AutocompleteRules = {
52
- required: (message: string) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
53
- min: (min: number, message: string) => (value: string[]) => (Array.isArray(value) && value.length >= min) || (message ?? $tr("ui.rules.autocomplete-min", "Must select at least {0} elements", min.toString())),
54
- max: (max: number, message: string) => (value: string[]) => (Array.isArray(value) && value.length <= max) || (message ?? $tr("ui.rules.autocomplete-max", "Must select at most {0} elements", max.toString()))
52
+ required: (message: string | null) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
53
+ min: (min: number, message: string | null) => (value: string[]) => (Array.isArray(value) && value.length >= min) || (message ?? $tr("ui.rules.autocomplete-min", "Must select at least {0} elements", min.toString())),
54
+ max: (max: number, message: string | null) => (value: string[]) => (Array.isArray(value) && value.length <= max) || (message ?? $tr("ui.rules.autocomplete-max", "Must select at most {0} elements", max.toString()))
55
55
  };
56
56
 
57
57
  export const TimeRules = {
58
- required: (message: string) => (value: number) => !!value || (message ?? $tr("ui.rules.required", "Required")),
59
- min: (min: number, message: string) => (value: number) => value >= min || (message ?? $tr("ui.rules.time-min", "Must be more than {0}", getTimeBestString(min))),
60
- max: (max: number, message: string) => (value: number) => value <= max || (message ?? $tr("ui.rules.time-max", "Must be less than {0}", getTimeBestString(max)))
58
+ required: (message: string | null) => (value: number) => !!value || (message ?? $tr("ui.rules.required", "Required")),
59
+ min: (min: number, message: string | null) => (value: number) => value >= min || (message ?? $tr("ui.rules.time-min", "Must be more than {0}", getTimeBestString(min))),
60
+ max: (max: number, message: string | null) => (value: number) => value <= max || (message ?? $tr("ui.rules.time-max", "Must be less than {0}", getTimeBestString(max)))
61
61
  };
62
62
 
63
63
  export const ToggleRules = {
64
- required: (message: string) => (value: boolean) => value || (message ?? $tr("ui.rules.required", "Required"))
64
+ required: (message: string | null) => (value: boolean) => value || (message ?? $tr("ui.rules.required", "Required"))
65
65
  }
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.48",
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.48",
14
+ "@dative-gpi/foundation-shared-services": "0.0.48",
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": "0029f53ff50ea72e704647e64d3419266ae680fa"
36
36
  }
@@ -1,4 +1,18 @@
1
1
  .fs-card {
2
- width: var(--fs-card-width);
2
+ border-radius: var(--fs-card-border-radius);
3
+ border: var(--fs-card-border-size) solid;
4
+ padding: var(--fs-card-padding);
3
5
  height: var(--fs-card-height);
6
+ width: var(--fs-card-width);
7
+ display: flex;
8
+
9
+ background-color: var(--fs-card-background-color);
10
+ border-color: var(--fs-card-border-color);
11
+ color: var(--fs-card-color);
12
+
13
+ &-elevation {
14
+ box-shadow: 0px 1px 8px 0px #00000029;
15
+ border-radius: 4px;
16
+ margin: 4px;
17
+ }
4
18
  }
@@ -1,6 +1,7 @@
1
1
  .fs-data-iterator-item {
2
2
  position: relative;
3
3
  min-height: 36px;
4
+ flex: 1 0 0;
4
5
 
5
6
  & > .fs-col > .fs-row:first-of-type > :last-child {
6
7
  padding-right: 22px;
@@ -13,7 +13,6 @@
13
13
  @import "fs_color_field.scss";
14
14
  @import "fs_color.scss";
15
15
  @import "fs_color_icon.scss";
16
- @import "fs_container.scss";
17
16
  @import "fs_data_table.scss";
18
17
  @import "fs_data_iterator_item.scss";
19
18
  @import "fs_date_field.scss";
@@ -29,8 +29,21 @@
29
29
  // Applies to all inputs
30
30
  .v-input {
31
31
  padding: 0px !important;
32
- min-width: 200px;
33
- width: 100%;
32
+
33
+ &:not(.v-checkbox) {
34
+ min-width: 200px;
35
+ width: 100%;
36
+ }
37
+
38
+ &.v-checkbox {
39
+ @include web {
40
+ min-width: 24px;
41
+ }
42
+
43
+ @include mobile {
44
+ min-width: 20px;
45
+ }
46
+ }
34
47
 
35
48
  & .v-input__prepend {
36
49
  margin-inline-end: 8px !important;
@@ -1,67 +0,0 @@
1
- <template>
2
- <div
3
- :class="classes"
4
- :style="style"
5
- >
6
- <slot />
7
- </div>
8
- </template>
9
-
10
- <script lang="ts">
11
- import { computed, defineComponent } from "vue";
12
-
13
- import { useColors } from "@dative-gpi/foundation-shared-components/composables";
14
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
15
- import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
16
-
17
- export default defineComponent({
18
- name: "FSContainer",
19
- props: {
20
- padding: {
21
- type: [String, Number],
22
- required: false,
23
- default: "8px"
24
- },
25
- border: {
26
- type: Boolean,
27
- required: false,
28
- default: true
29
- },
30
- elevation: {
31
- type: Boolean,
32
- required: false,
33
- default: false
34
- }
35
- },
36
- setup(props) {
37
- const { getColors } = useColors();
38
-
39
- const backgrounds = getColors(ColorEnum.Background);
40
- const lights = getColors(ColorEnum.Light);
41
-
42
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
43
- return {
44
- "--fs-container-padding" : sizeToVar(props.padding),
45
- "--fs-container-background-color": backgrounds.base,
46
- "--fs-container-border-color" : lights.dark
47
- };
48
- });
49
-
50
- const classes = computed((): string[] => {
51
- const classNames = ["fs-container"];
52
- if (props.border) {
53
- classNames.push("fs-container-border");
54
- }
55
- if (props.elevation) {
56
- classNames.push("fs-container-elevation");
57
- }
58
- return classNames;
59
- });
60
-
61
- return {
62
- style,
63
- classes
64
- };
65
- }
66
- })
67
- </script>
@@ -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>
@@ -1,16 +0,0 @@
1
- .fs-container {
2
- background-color: var(--fs-container-background-color);
3
- padding: var(--fs-container-padding);
4
- display: flex;
5
-
6
- &-border {
7
- border: 1px solid var(--fs-container-border-color);
8
- border-radius: 4px;
9
- }
10
-
11
- &-elevation {
12
- box-shadow: 0px 1px 8px 0px #00000029;
13
- border-radius: 4px;
14
- margin: 4px;
15
- }
16
- }