@dative-gpi/foundation-shared-components 0.0.11 → 0.0.13

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.
Files changed (98) hide show
  1. package/aliases/FSButton.ts +8 -6
  2. package/components/FSBreadcrumbs.vue +3 -1
  3. package/components/FSButton.vue +13 -10
  4. package/components/FSCalendar.vue +4 -3
  5. package/components/FSCalendarTwin.vue +4 -3
  6. package/components/FSCarousel.vue +3 -1
  7. package/components/FSCheckbox.vue +8 -6
  8. package/components/FSChip.vue +5 -3
  9. package/components/FSClock.vue +50 -34
  10. package/components/FSColor.vue +3 -1
  11. package/components/FSColorIcon.vue +3 -1
  12. package/components/FSContainer.vue +4 -2
  13. package/components/FSDivider.vue +49 -8
  14. package/components/FSFadeOut.vue +3 -1
  15. package/components/FSFileButton.vue +4 -3
  16. package/components/FSForm.vue +52 -0
  17. package/components/FSImage.vue +42 -33
  18. package/components/FSLabel.vue +105 -0
  19. package/components/FSLink.vue +95 -0
  20. package/components/FSPagination.vue +96 -0
  21. package/components/FSPermissions.vue +0 -0
  22. package/components/FSRadio.vue +8 -6
  23. package/components/FSRemoveDialog.vue +1 -1
  24. package/components/FSSlideGroup.vue +2 -1
  25. package/components/FSSlider.vue +5 -3
  26. package/components/FSSubmitDialog.vue +2 -2
  27. package/components/FSSwitch.vue +9 -7
  28. package/components/FSTabs.vue +4 -3
  29. package/components/FSTag.vue +4 -2
  30. package/components/FSText.vue +3 -2
  31. package/components/FSWrapGroup.vue +2 -1
  32. package/components/deviceOrganisations/FSConnectivity.vue +2 -1
  33. package/components/deviceOrganisations/FSWorstAlert.vue +2 -1
  34. package/components/{FSAutocompleteField.vue → fields/FSAutocompleteField.vue} +25 -22
  35. package/components/fields/FSColorField.vue +194 -0
  36. package/components/{FSDateField.vue → fields/FSDateField.vue} +18 -52
  37. package/components/{FSDateRangeField.vue → fields/FSDateRangeField.vue} +22 -67
  38. package/components/{FSDateTimeField.vue → fields/FSDateTimeField.vue} +20 -54
  39. package/components/{FSDateTimeRangeField.vue → fields/FSDateTimeRangeField.vue} +27 -70
  40. package/components/{FSIconField.vue → fields/FSIconField.vue} +20 -53
  41. package/components/{FSNumberField.vue → fields/FSNumberField.vue} +0 -24
  42. package/components/{FSPasswordField.vue → fields/FSPasswordField.vue} +9 -31
  43. package/components/{FSRichTextField.vue → fields/FSRichTextField.vue} +10 -9
  44. package/components/{FSSearchField.vue → fields/FSSearchField.vue} +47 -14
  45. package/components/{FSSelectField.vue → fields/FSSelectField.vue} +22 -24
  46. package/components/{FSTagField.vue → fields/FSTagField.vue} +19 -53
  47. package/components/{FSTextArea.vue → fields/FSTextArea.vue} +28 -27
  48. package/components/{FSTextField.vue → fields/FSTextField.vue} +23 -21
  49. package/components/fields/FSTimeField.vue +104 -0
  50. package/components/fields/FSTimeSlotField.vue +263 -0
  51. package/components/lists/FSDataTableUI.vue +7 -6
  52. package/components/lists/FSFilterButton.vue +25 -17
  53. package/components/lists/FSHiddenButton.vue +1 -0
  54. package/components/lists/FSLoadDataTable.vue +88 -0
  55. package/components/tiles/FSDeviceOrganisationTileUI.vue +5 -10
  56. package/components/tiles/FSGroupTileUI.vue +5 -10
  57. package/components/{FSLoadTile.vue → tiles/FSLoadTile.vue} +9 -7
  58. package/components/{FSTile.vue → tiles/FSTile.vue} +5 -4
  59. package/composables/index.ts +2 -0
  60. package/composables/useBreakpoints.ts +7 -5
  61. package/composables/useDebounce.ts +22 -0
  62. package/composables/useRules.ts +72 -0
  63. package/elements/FSFormElement.ts +17 -0
  64. package/icons/flags/France.vue +9 -0
  65. package/icons/flags/Germany.vue +7 -0
  66. package/icons/flags/GreatBritain.vue +9 -0
  67. package/icons/flags/Italy.vue +9 -0
  68. package/icons/flags/Portugal.vue +59 -0
  69. package/icons/flags/Spain.vue +546 -0
  70. package/icons/flags/UnitedStates.vue +12 -0
  71. package/icons/sets.ts +17 -0
  72. package/models/rules.ts +10 -1
  73. package/package.json +6 -4
  74. package/pages/FSExternalIdentityButton.vue +64 -0
  75. package/pages/FSLanguageSetter.vue +140 -0
  76. package/pages/FSLoginPage.vue +253 -0
  77. package/styles/components/fs_clock.scss +4 -0
  78. package/styles/components/fs_color_field.scss +17 -0
  79. package/styles/components/fs_divider.scss +5 -0
  80. package/styles/components/fs_image.scss +12 -1
  81. package/styles/components/fs_label.scss +86 -0
  82. package/styles/components/fs_link.scss +6 -0
  83. package/styles/components/fs_load_data_table.scss +77 -0
  84. package/styles/components/fs_pagination.scss +11 -0
  85. package/styles/components/fs_time_field.scss +3 -0
  86. package/styles/components/fs_timeslot_field.scss +75 -0
  87. package/styles/components/index.scss +7 -0
  88. package/styles/globals/text_fonts.scss +18 -0
  89. package/styles/main.scss +3 -1
  90. package/styles/pages/fs_language_setter.scss +55 -0
  91. package/styles/pages/index.scss +1 -0
  92. package/utils/color.ts +7 -0
  93. package/utils/css.ts +2 -1
  94. package/utils/index.ts +3 -1
  95. package/utils/time.ts +29 -0
  96. package/components/FSHeaderButton.vue +0 -17
  97. package/components/lists/FSDataIteratorGroup.vue +0 -7
  98. package/index.ts +0 -6
@@ -1,10 +1,12 @@
1
- import { useTranslationsProvider } from "@dative-gpi/foundation-shared-services";
1
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
2
2
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
3
3
 
4
4
  import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
5
5
 
6
6
  const { $tr } = useTranslationsProvider();
7
7
 
8
+ import { computed } from "vue";
9
+
8
10
  export const FSButtonsAliases = {
9
11
  FSButtonSearch: FSButton,
10
12
  FSButtonSearchMini: FSButton,
@@ -23,7 +25,7 @@ export const FSButtonsAliases = {
23
25
  export const FSButtonsProps = {
24
26
  FSButtonSearch: {
25
27
  prependIcon: "mdi-magnify",
26
- label: $tr("ui.button.search", "Search"),
28
+ get label() { return $tr("ui.button.search", "Search") },
27
29
  variant: "standard",
28
30
  color: ColorEnum.Primary
29
31
  },
@@ -41,7 +43,7 @@ export const FSButtonsProps = {
41
43
  },
42
44
  FSButtonRemove: {
43
45
  prependIcon: "mdi-delete-outline",
44
- label: $tr("ui.button.remove", "Remove"),
46
+ get label() { return $tr("ui.button.remove", "Remove") },
45
47
  variant: "standard",
46
48
  color: ColorEnum.Error
47
49
  },
@@ -59,7 +61,7 @@ export const FSButtonsProps = {
59
61
  },
60
62
  FSButtonSave: {
61
63
  prependIcon: "mdi-content-save-outline",
62
- label: $tr("ui.button.save", "Save"),
64
+ get label() { return $tr("ui.button.save", "Save") },
63
65
  variant: "standard",
64
66
  color: ColorEnum.Primary
65
67
  },
@@ -77,7 +79,7 @@ export const FSButtonsProps = {
77
79
  },
78
80
  FSButtonCancel: {
79
81
  prependIcon: "mdi-cancel",
80
- label: $tr("ui.button.cancel", "Cancel"),
82
+ get label() { return $tr("ui.button.cancel", "Cancel") },
81
83
  variant: "standard",
82
84
  color: ColorEnum.Light
83
85
  },
@@ -95,7 +97,7 @@ export const FSButtonsProps = {
95
97
  },
96
98
  FSButtonDocumentation: {
97
99
  prependIcon: "mdi-file-document-outline",
98
- label: $tr("ui.button.documentation", "Documentation"),
100
+ get label() { return $tr("ui.button.documentation", "Documentation") },
99
101
  variant: "standard",
100
102
  color: ColorEnum.Light
101
103
  },
@@ -38,7 +38,9 @@ export default defineComponent({
38
38
  }
39
39
  },
40
40
  setup() {
41
- const darks = useColors().getColors(ColorEnum.Dark);
41
+ const { getColors } = useColors();
42
+
43
+ const darks = getColors(ColorEnum.Dark);
42
44
 
43
45
  const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
44
46
  "--fs-breadcrumbs-color": darks.dark,
@@ -84,7 +84,7 @@ export default defineComponent({
84
84
  default: null
85
85
  },
86
86
  label: {
87
- type: String,
87
+ type: [String, Function],
88
88
  required: false,
89
89
  default: null
90
90
  },
@@ -106,7 +106,7 @@ export default defineComponent({
106
106
  color: {
107
107
  type: String as PropType<ColorBase>,
108
108
  required: false,
109
- default: ColorEnum.Primary
109
+ default: ColorEnum.Light
110
110
  },
111
111
  fullWidth: {
112
112
  type: Boolean,
@@ -120,14 +120,16 @@ export default defineComponent({
120
120
  }
121
121
  },
122
122
  setup(props) {
123
- props = useDefaults(props, getCurrentInstance().type.name)
124
-
125
- const textColors = computed(() => useColors().getContrasts(props.color));
126
- const colors = computed(() => useColors().getColors(props.color));
127
- const lights = useColors().getColors(ColorEnum.Light);
123
+ props = useDefaults(props, getCurrentInstance()?.type?.name ?? "FSButton");
128
124
 
125
+ const { getColors, getContrasts } = useColors();
129
126
  const { slots } = useSlots();
130
127
 
128
+ const textColors = computed(() => getContrasts(props.color));
129
+ const colors = computed(() => getColors(props.color));
130
+ const lights = getColors(ColorEnum.Light);
131
+ const darks = getColors(ColorEnum.Dark);
132
+
131
133
  const isEmpty = computed(() => {
132
134
  return !slots.default && !props.label;
133
135
  });
@@ -173,9 +175,10 @@ export default defineComponent({
173
175
  "--fs-button-active-color" : textColors.value.light,
174
176
  };
175
177
  case "icon": switch (props.color) {
176
- case ColorEnum.Dark: return {
177
- "--fs-button-color" : colors.value.light,
178
- "--fs-button-hover-color": colors.value.dark,
178
+ case ColorEnum.Dark:
179
+ case ColorEnum.Light: return {
180
+ "--fs-button-color" : darks.base,
181
+ "--fs-button-hover-color": darks.dark,
179
182
  };
180
183
  default: return {
181
184
  "--fs-button-color" : colors.value.base,
@@ -105,10 +105,11 @@ export default defineComponent({
105
105
  setup(props) {
106
106
  const { epochToPicker, pickerToEpoch, todayToEpoch } = useTimeZone();
107
107
  const { languageCode } = useLanguageCode();
108
+ const { getColors } = useColors();
108
109
 
109
- const colors = computed(() => useColors().getColors(props.color));
110
- const backgrounds = useColors().getColors(ColorEnum.Background);
111
- const darks = useColors().getColors(ColorEnum.Dark);
110
+ const colors = computed(() => getColors(props.color));
111
+ const backgrounds = getColors(ColorEnum.Background);
112
+ const darks = getColors(ColorEnum.Dark);
112
113
 
113
114
  const innerMonth = ref(props.modelValue ? epochToPicker(props.modelValue).getMonth() : new Date().getMonth());
114
115
  const innerYear = ref(props.modelValue ? epochToPicker(props.modelValue).getFullYear() : new Date().getFullYear());
@@ -143,10 +143,11 @@ export default defineComponent({
143
143
  setup(props, { emit }) {
144
144
  const { epochToPicker, epochToPickerHeader, pickerToEpoch, todayToEpoch } = useTimeZone();
145
145
  const { languageCode } = useLanguageCode();
146
+ const { getColors } = useColors();
146
147
 
147
- const colors = computed(() => useColors().getColors(props.color));
148
- const backgrounds = useColors().getColors(ColorEnum.Background);
149
- const darks = useColors().getColors(ColorEnum.Dark);
148
+ const colors = computed(() => getColors(props.color));
149
+ const backgrounds = getColors(ColorEnum.Background);
150
+ const darks = getColors(ColorEnum.Dark);
150
151
 
151
152
  const innerLeftMonth = ref(new Date().getMonth());
152
153
  const innerLeftYear = ref(new Date().getFullYear());
@@ -37,9 +37,11 @@ export default defineComponent({
37
37
  },
38
38
  setup(props) {
39
39
  const { slots, getChildren } = useSlots();
40
+ const { getColors } = useColors();
41
+
40
42
  delete slots.default;
41
43
 
42
- const backgrounds = useColors().getColors(ColorEnum.Background);
44
+ const backgrounds = getColors(ColorEnum.Background);
43
45
 
44
46
  const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
45
47
  return {
@@ -47,16 +47,16 @@ import { useColors } from "@dative-gpi/foundation-shared-components/composables"
47
47
 
48
48
  import FSIcon from "./FSIcon.vue";
49
49
  import FSSpan from "./FSSpan.vue";
50
- import FSRow from "./FSRow.vue";
51
50
  import FSCol from "./FSCol.vue";
51
+ import FSRow from "./FSRow.vue";
52
52
 
53
53
  export default defineComponent({
54
54
  name: "FSCheckbox",
55
55
  components: {
56
56
  FSIcon,
57
57
  FSSpan,
58
- FSRow,
59
- FSCol
58
+ FSCol,
59
+ FSRow
60
60
  },
61
61
  props: {
62
62
  label: {
@@ -92,9 +92,11 @@ export default defineComponent({
92
92
  },
93
93
  emits: ["update:modelValue"],
94
94
  setup(props, { emit }) {
95
- const colors = computed(() => useColors().getColors(props.color));
96
- const lights = useColors().getColors(ColorEnum.Light);
97
- const darks = useColors().getColors(ColorEnum.Dark);
95
+ const { getColors } = useColors();
96
+
97
+ const colors = computed(() => getColors(props.color));
98
+ const lights = getColors(ColorEnum.Light);
99
+ const darks = getColors(ColorEnum.Dark);
98
100
 
99
101
  const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
100
102
  if (!props.editable) {
@@ -85,13 +85,15 @@ export default defineComponent({
85
85
  }
86
86
  },
87
87
  setup(props) {
88
- const colors = computed(() => useColors().getColors(props.color));
89
- const backgrounds = useColors().getColors(ColorEnum.Background);
88
+ const { getColors, getContrasts } = useColors();
89
+
90
+ const colors = computed(() => getColors(props.color));
91
+ const backgrounds = getColors(ColorEnum.Background);
90
92
 
91
93
  const textColors = computed(() => {
92
94
  switch (props.variant) {
93
95
  case "standard": return colors.value;
94
- case "full": return useColors().getContrasts(props.color);
96
+ case "full": return getContrasts(props.color);
95
97
  }
96
98
  });
97
99
 
@@ -5,36 +5,44 @@
5
5
  >
6
6
  <FSRow
7
7
  align="center-center"
8
+ padding="0 16px"
8
9
  >
9
- <FSTextField
10
+ <FSSpan
10
11
  v-if="$props.reminder"
11
- :readonly="true"
12
- :hideHeader="true"
13
- :modelValue="epochToLongDateFormat($props.date)"
14
- />
15
- <v-text-field
16
- class="fs-clock-field"
17
- variant="outlined"
18
- type="number"
19
- hide-details
20
- :style="style"
21
- :readonly="!$props.editable"
22
- :modelValue="innerHours.toString().padStart(2, '0')"
23
- @update:modelValue="onChangeHours"
24
- />
25
- :
26
- <v-text-field
27
- class="fs-clock-field"
28
- variant="outlined"
29
- type="number"
30
- hide-details
31
- :style="style"
32
- :readonly="!$props.editable"
33
- :modelValue="innerMinutes.toString().padStart(2, '0')"
34
- @update:modelValue="onChangeMinutes"
35
- />
12
+ >
13
+ {{ epochToLongDateFormat($props.date) }}
14
+ </FSSpan>
15
+ <v-spacer v-if="$props.reminder" />
16
+ <FSRow
17
+ align="center-center"
18
+ :wrap="false"
19
+ >
20
+ <v-text-field
21
+ class="fs-clock-field"
22
+ variant="outlined"
23
+ type="number"
24
+ hide-details
25
+ :style="style"
26
+ :readonly="!$props.editable"
27
+ :modelValue="innerHours.toString().padStart(2, '0')"
28
+ @update:modelValue="onChangeHours"
29
+ />
30
+ :
31
+ <v-text-field
32
+ class="fs-clock-field"
33
+ variant="outlined"
34
+ type="number"
35
+ hide-details
36
+ :style="style"
37
+ :readonly="!$props.editable"
38
+ :modelValue="innerMinutes.toString().padStart(2, '0')"
39
+ @update:modelValue="onChangeMinutes"
40
+ />
41
+ </FSRow>
36
42
  </FSRow>
37
- <FSCol>
43
+ <FSCol
44
+ v-if="$props.slider"
45
+ >
38
46
  <FSSpan
39
47
  font="text-overline"
40
48
  >
@@ -49,7 +57,9 @@
49
57
  v-model="innerHours"
50
58
  />
51
59
  </FSCol>
52
- <FSCol>
60
+ <FSCol
61
+ v-if="$props.slider"
62
+ >
53
63
  <FSSpan
54
64
  font="text-overline"
55
65
  >
@@ -74,16 +84,16 @@ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/m
74
84
  import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
75
85
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
76
86
 
77
- import FSTextField from "./FSTextField.vue";
78
87
  import FSSlider from "./FSSlider.vue";
88
+ import FSSpan from "./FSSpan.vue";
79
89
  import FSCol from "./FSCol.vue";
80
90
  import FSRow from "./FSRow.vue";
81
91
 
82
92
  export default defineComponent({
83
93
  name: "FSClock",
84
94
  components: {
85
- FSTextField,
86
95
  FSSlider,
96
+ FSSpan,
87
97
  FSCol,
88
98
  FSRow
89
99
  },
@@ -112,16 +122,22 @@ export default defineComponent({
112
122
  type: Boolean,
113
123
  required: false,
114
124
  default: true
125
+ },
126
+ slider: {
127
+ type: Boolean,
128
+ required: false,
129
+ default: true
115
130
  }
116
131
  },
117
132
  emits: ["update:modelValue"],
118
133
  setup(props, { emit }) {
119
134
  const { epochToLongDateFormat } = useTimeZone();
135
+ const { getColors } = useColors();
120
136
 
121
- const colors = computed(() => useColors().getColors(props.color));
122
- const backgrounds = useColors().getColors(ColorEnum.Background);
123
- const lights = useColors().getColors(ColorEnum.Light);
124
- const darks = useColors().getColors(ColorEnum.Dark);
137
+ const colors = computed(() => getColors(props.color));
138
+ const backgrounds = getColors(ColorEnum.Background);
139
+ const lights = getColors(ColorEnum.Light);
140
+ const darks = getColors(ColorEnum.Dark);
125
141
 
126
142
  const innerHours = ref(props.modelValue ? Math.floor(props.modelValue / (60 * 60 * 1000)) : 0);
127
143
  const innerMinutes = ref(props.modelValue ? Math.floor((props.modelValue % (60 * 60 * 1000)) / (60 * 1000)) : 0);
@@ -58,7 +58,9 @@ export default defineComponent({
58
58
  }
59
59
  },
60
60
  setup(props) {
61
- const colors = computed(() => useColors().getColors(props.color));
61
+ const { getColors } = useColors();
62
+
63
+ const colors = computed(() => getColors(props.color));
62
64
 
63
65
  const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
64
66
  "--fs-color-background-color": colors.value.light,
@@ -35,7 +35,9 @@ export default defineComponent({
35
35
  }
36
36
  },
37
37
  setup(props) {
38
- const colors = computed(() => useColors().getColors(props.color));
38
+ const { getColors } = useColors();
39
+
40
+ const colors = computed(() => getColors(props.color));
39
41
 
40
42
  const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
41
43
  switch (props.variant) {
@@ -33,8 +33,10 @@ export default defineComponent({
33
33
  }
34
34
  },
35
35
  setup(props) {
36
- const backgrounds = useColors().getColors(ColorEnum.Background);
37
- const lights = useColors().getColors(ColorEnum.Light);
36
+ const { getColors } = useColors();
37
+
38
+ const backgrounds = getColors(ColorEnum.Background);
39
+ const lights = getColors(ColorEnum.Light);
38
40
 
39
41
  const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
40
42
  return {
@@ -1,38 +1,79 @@
1
1
  <template>
2
2
  <div
3
+ v-if="isEmpty"
3
4
  class="fs-divider"
4
5
  :style="style"
5
6
  />
7
+ <FSRow
8
+ v-else
9
+ align="center-center"
10
+ gap="24px"
11
+ >
12
+ <FSCol
13
+ class="fs-divider-around"
14
+ :style="style"
15
+ />
16
+ <FSText
17
+ variant="light"
18
+ font="text-h4"
19
+ >
20
+ <slot>
21
+ {{ $props.label }}
22
+ </slot>
23
+ </FSText>
24
+ <FSCol
25
+ class="fs-divider-around"
26
+ :style="style"
27
+ />
28
+ </FSRow>
6
29
  </template>
7
30
 
8
31
  <script lang="ts">
9
32
  import { computed, defineComponent } from "vue";
10
33
 
11
- import { useColors } from "@dative-gpi/foundation-shared-components/composables";
34
+ import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
12
35
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
13
36
  import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
14
37
 
38
+ import FSText from "./FSText.vue";
39
+
15
40
  export default defineComponent({
16
41
  name: "FSDivider",
42
+ components: {
43
+ FSText
44
+ },
17
45
  props: {
18
46
  width: {
19
47
  type: [String, Number],
20
48
  required: false,
21
49
  default: "100%"
50
+ },
51
+ label: {
52
+ type: String,
53
+ required: false,
54
+ default: null
22
55
  }
23
56
  },
24
57
  setup(props) {
25
- const lights = useColors().getColors(ColorEnum.Light);
58
+ const { getColors } = useColors();
59
+ const { slots } = useSlots();
60
+
61
+ const lights = getColors(ColorEnum.Light);
62
+
63
+ const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
64
+ return {
65
+ "--fs-divider-width": sizeToVar(props.width),
66
+ "--fs-divider-color": lights.dark
67
+ }
68
+ });
26
69
 
27
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
28
- return {
29
- "--fs-divider-width": sizeToVar(props.width),
30
- "--fs-divider-color": lights.dark
31
- }
70
+ const isEmpty = computed(() => {
71
+ return !slots.default && !props.label;
32
72
  });
33
73
 
34
74
  return {
35
- style
75
+ style,
76
+ isEmpty
36
77
  }
37
78
  }
38
79
  });
@@ -31,7 +31,9 @@ export default defineComponent({
31
31
  }
32
32
  },
33
33
  setup(props) {
34
- const backgrounds = useColors().getColors(ColorEnum.Background);
34
+ const { getColors } = useColors();
35
+
36
+ const backgrounds = getColors(ColorEnum.Background);
35
37
 
36
38
  const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
37
39
  "--fs-fade-out-mask-color" : backgrounds.base,
@@ -130,11 +130,12 @@ export default defineComponent({
130
130
  },
131
131
  emits: ["update:modelValue"],
132
132
  setup(props, { emit }) {
133
+ const { getColors, getContrasts } = useColors();
133
134
  const { slots } = useSlots();
134
135
 
135
- const textColors = computed(() => useColors().getContrasts(props.color));
136
- const colors = computed(() => useColors().getColors(props.color));
137
- const lights = useColors().getColors(ColorEnum.Light);
136
+ const textColors = computed(() => getContrasts(props.color));
137
+ const colors = computed(() => getColors(props.color));
138
+ const lights = getColors(ColorEnum.Light);
138
139
 
139
140
  const input = ref(null);
140
141
 
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <v-form
3
+ ref="formRef"
4
+ :validateOn="validateOn"
5
+ @submit="submitted = true"
6
+ @update:modelValue="$emit('update:modelValue', $event)"
7
+ >
8
+ <slot />
9
+ </v-form>
10
+ </template>
11
+
12
+ <script lang="ts">
13
+ import { computed, defineComponent, PropType, provide, ref } from "vue";
14
+
15
+ export default defineComponent({
16
+ name: "FSForm",
17
+ props: {
18
+ modelValue: {
19
+ type: Boolean,
20
+ required: false,
21
+ default: null
22
+ },
23
+ variant: {
24
+ type: String as PropType<"standard" | "lazy" | "submit">,
25
+ required: false,
26
+ default: "standard"
27
+ }
28
+ },
29
+ emits: ["update:modelValue"],
30
+ setup(props) {
31
+ const formRef = ref<HTMLFormElement | null>(null);
32
+ const submitted = ref(false);
33
+
34
+ const validateOn = computed((): "submit" | "blur" | "input" => {
35
+ switch (props.variant) {
36
+ case "standard": return "input";
37
+ case "lazy": return "blur";
38
+ case "submit": return "submit";
39
+ }
40
+ });
41
+
42
+ provide("validateOn", validateOn.value);
43
+ provide("submitted", submitted.value);
44
+
45
+ return {
46
+ formRef,
47
+ validateOn,
48
+ submitted
49
+ };
50
+ }
51
+ });
52
+ </script>