@dative-gpi/foundation-shared-components 0.0.18 → 0.0.20

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 (71) hide show
  1. package/components/FSButton.vue +31 -57
  2. package/components/FSCard.vue +4 -4
  3. package/components/FSCarousel.vue +4 -3
  4. package/components/FSClickable.vue +125 -0
  5. package/components/FSDivider.vue +7 -2
  6. package/components/FSLoader.vue +9 -31
  7. package/components/FSSlideGroup.vue +69 -8
  8. package/components/FSToggleSet.vue +20 -1
  9. package/components/FSWrapGroup.vue +22 -2
  10. package/components/buttons/FSButtonCancel.vue +28 -0
  11. package/components/buttons/FSButtonCancelIcon.vue +28 -0
  12. package/components/buttons/FSButtonCancelLabel.vue +27 -0
  13. package/components/buttons/FSButtonCancelMini.vue +27 -0
  14. package/components/buttons/FSButtonDuplicate.vue +28 -0
  15. package/components/buttons/FSButtonDuplicateIcon.vue +28 -0
  16. package/components/buttons/FSButtonDuplicateLabel.vue +27 -0
  17. package/components/buttons/FSButtonDuplicateMini.vue +27 -0
  18. package/components/buttons/FSButtonEdit.vue +28 -0
  19. package/components/buttons/FSButtonEditIcon.vue +28 -0
  20. package/components/buttons/FSButtonEditLabel.vue +27 -0
  21. package/components/buttons/FSButtonEditMini.vue +27 -0
  22. package/components/buttons/FSButtonFile.vue +84 -0
  23. package/components/buttons/FSButtonFileIcon.vue +84 -0
  24. package/components/buttons/FSButtonFileLabel.vue +83 -0
  25. package/components/buttons/FSButtonFileMini.vue +83 -0
  26. package/components/buttons/FSButtonNext.vue +28 -0
  27. package/components/buttons/FSButtonNextIcon.vue +28 -0
  28. package/components/buttons/FSButtonNextLabel.vue +27 -0
  29. package/components/buttons/FSButtonNextMini.vue +27 -0
  30. package/components/buttons/FSButtonPrevious.vue +28 -0
  31. package/components/buttons/FSButtonPreviousIcon.vue +28 -0
  32. package/components/buttons/FSButtonPreviousLabel.vue +27 -0
  33. package/components/buttons/FSButtonPreviousMini.vue +27 -0
  34. package/components/buttons/FSButtonRedo.vue +28 -0
  35. package/components/buttons/FSButtonRedoIcon.vue +28 -0
  36. package/components/buttons/FSButtonRedoLabel.vue +27 -0
  37. package/components/buttons/FSButtonRedoMini.vue +27 -0
  38. package/components/buttons/FSButtonRemove.vue +28 -0
  39. package/components/buttons/FSButtonRemoveIcon.vue +28 -0
  40. package/components/buttons/FSButtonRemoveLabel.vue +27 -0
  41. package/components/buttons/FSButtonRemoveMini.vue +27 -0
  42. package/components/buttons/FSButtonSave.vue +28 -0
  43. package/components/buttons/FSButtonSaveIcon.vue +28 -0
  44. package/components/buttons/FSButtonSaveLabel.vue +27 -0
  45. package/components/buttons/FSButtonSaveMini.vue +27 -0
  46. package/components/buttons/FSButtonSearch.vue +28 -0
  47. package/components/buttons/FSButtonSearchIcon.vue +28 -0
  48. package/components/buttons/FSButtonSearchLabel.vue +27 -0
  49. package/components/buttons/FSButtonSearchMini.vue +27 -0
  50. package/components/buttons/FSButtonUndo.vue +28 -0
  51. package/components/buttons/FSButtonUndoIcon.vue +28 -0
  52. package/components/buttons/FSButtonUndoLabel.vue +27 -0
  53. package/components/buttons/FSButtonUndoMini.vue +27 -0
  54. package/components/buttons/FSButtonUpdate.vue +28 -0
  55. package/components/buttons/FSButtonUpdateIcon.vue +28 -0
  56. package/components/buttons/FSButtonUpdateLabel.vue +27 -0
  57. package/components/buttons/FSButtonUpdateMini.vue +27 -0
  58. package/components/buttons/FSButtonValidate.vue +28 -0
  59. package/components/buttons/FSButtonValidateIcon.vue +28 -0
  60. package/components/buttons/FSButtonValidateLabel.vue +27 -0
  61. package/components/buttons/FSButtonValidateMini.vue +27 -0
  62. package/components/fields/FSIconField.vue +18 -5
  63. package/components/lists/FSDataTableUI.vue +2 -0
  64. package/package.json +4 -4
  65. package/styles/components/fs_button.scss +0 -28
  66. package/styles/components/fs_clickable.scss +26 -0
  67. package/styles/components/fs_data_table.scss +2 -2
  68. package/styles/components/index.scss +1 -0
  69. package/styles/globals/overrides.scss +3 -2
  70. package/utils/css.ts +16 -2
  71. package/components/FSFileButton.vue +0 -246
@@ -1,10 +1,11 @@
1
1
  <template>
2
- <v-btn
3
- v-if="!['icon'].includes(props.variant)"
4
- :ripple="false"
5
- :style="style"
2
+ <FSClickable
3
+ v-if="!['icon'].includes($props.variant)"
4
+ :height="['40px', '36px']"
5
+ :editable="$props.editable"
6
+ :color="$props.color"
6
7
  :class="classes"
7
- :disabled="!props.editable"
8
+ :style="style"
8
9
  v-bind="$attrs"
9
10
  >
10
11
  <FSRow
@@ -12,60 +13,60 @@
12
13
  width="hug"
13
14
  :wrap="false"
14
15
  >
15
- <slot name="prepend" v-bind="{ color: props.color, colors }">
16
+ <slot name="prepend" v-bind="{ color: $props.color, colors }">
16
17
  <FSIcon
17
- v-if="props.prependIcon"
18
+ v-if="$props.prependIcon || $props.icon"
18
19
  size="l"
19
20
  >
20
- {{ props.prependIcon }}
21
+ {{ $props.prependIcon ?? $props.icon }}
21
22
  </FSIcon>
22
23
  </slot>
23
- <slot v-bind="{ color: props.color, colors }">
24
+ <slot v-bind="{ color: $props.color, colors }">
24
25
  <FSSpan
25
- v-if="props.label"
26
+ v-if="$props.label"
26
27
  >
27
- {{ props.label }}
28
+ {{ $props.label }}
28
29
  </FSSpan>
29
30
  </slot>
30
- <slot name="append" v-bind="{ color: props.color, colors }">
31
+ <slot name="append" v-bind="{ color: $props.color, colors }">
31
32
  <FSIcon
32
- v-if="props.appendIcon"
33
+ v-if="$props.appendIcon"
33
34
  size="l"
34
35
  >
35
- {{ props.appendIcon }}
36
+ {{ $props.appendIcon }}
36
37
  </FSIcon>
37
38
  </slot>
38
39
  </FSRow>
39
- </v-btn>
40
+ </FSClickable>
40
41
  <FSRow
41
- v-else-if="props.icon"
42
+ v-else-if="$props.icon"
42
43
  align="center-center"
43
44
  width="hug"
44
- :style="style"
45
45
  :class="classes"
46
+ :style="style"
46
47
  v-bind="$attrs"
47
48
  >
48
49
  <FSIcon
49
50
  size="l"
50
51
  >
51
- {{ props.icon }}
52
+ {{ $props.icon }}
52
53
  </FSIcon>
53
54
  <FSSpan
54
- v-if="props.label"
55
+ v-if="$props.label"
55
56
  font="text-overline"
56
57
  >
57
- {{ props.label }}
58
+ {{ $props.label }}
58
59
  </FSSpan>
59
60
  </FSRow>
60
61
  </template>
61
62
 
62
63
  <script lang="ts">
63
- import { computed, defineComponent, getCurrentInstance, PropType } from "vue";
64
- import { useDefaults } from "vuetify";
64
+ import { computed, defineComponent, PropType } from "vue";
65
65
 
66
66
  import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
67
67
  import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
68
68
 
69
+ import FSClickable from "./FSClickable.vue";
69
70
  import FSSpan from "./FSSpan.vue";
70
71
  import FSIcon from "./FSIcon.vue";
71
72
  import FSRow from "./FSRow.vue";
@@ -73,6 +74,7 @@ import FSRow from "./FSRow.vue";
73
74
  export default defineComponent({
74
75
  name: "FSButton",
75
76
  components: {
77
+ FSClickable,
76
78
  FSSpan,
77
79
  FSIcon,
78
80
  FSRow
@@ -120,17 +122,14 @@ export default defineComponent({
120
122
  }
121
123
  },
122
124
  setup(props) {
123
- props = useDefaults(props, getCurrentInstance()?.type?.name ?? "FSButton");
124
-
125
- const { getColors, getContrasts } = useColors();
125
+ const { getColors } = useColors();
126
126
  const { slots } = useSlots();
127
127
 
128
- const textColors = computed(() => getContrasts(props.color));
129
128
  const colors = computed(() => getColors(props.color));
130
129
  const lights = getColors(ColorEnum.Light);
131
130
  const darks = getColors(ColorEnum.Dark);
132
131
 
133
- const isEmpty = computed(() => {
132
+ const hasNoText = computed(() => {
134
133
  return !slots.default && !props.label;
135
134
  });
136
135
 
@@ -139,10 +138,7 @@ export default defineComponent({
139
138
  switch (props.variant) {
140
139
  case "standard":
141
140
  case "full": return {
142
- "--fs-button-padding" : !isEmpty.value ? "0 16px" : "0",
143
- "--fs-button-background-color": lights.base,
144
- "--fs-button-border-color" : lights.dark,
145
- "--fs-button-color" : lights.dark,
141
+ "--fs-button-padding": !hasNoText.value ? "0 16px" : "0 7px"
146
142
  };
147
143
  case "icon": return {
148
144
  "--fs-button-color": lights.dark,
@@ -151,28 +147,10 @@ export default defineComponent({
151
147
  }
152
148
  switch (props.variant) {
153
149
  case "standard": return {
154
- "--fs-button-padding" : !isEmpty.value ? "0 16px" : "0",
155
- "--fs-button-background-color" : colors.value.light,
156
- "--fs-button-border-color" : colors.value.base,
157
- "--fs-button-color" : textColors.value.base,
158
- "--fs-button-hover-background-color" : colors.value.base,
159
- "--fs-button-hover-border-color" : colors.value.base,
160
- "--fs-button-hover-color" : textColors.value.light,
161
- "--fs-button-active-background-color": colors.value.dark,
162
- "--fs-button-active-border-color" : colors.value.dark,
163
- "--fs-button-active-color" : textColors.value.light,
150
+ "--fs-button-padding": !hasNoText.value ? "0 16px" : "0 7px"
164
151
  };
165
152
  case "full": return {
166
- "--fs-button-padding" : !isEmpty.value ? "0 16px" : "0",
167
- "--fs-button-background-color" : colors.value.base,
168
- "--fs-button-border-color" : colors.value.base,
169
- "--fs-button-color" : textColors.value.light,
170
- "--fs-button-hover-background-color" : colors.value.base,
171
- "--fs-button-hover-border-color" : colors.value.base,
172
- "--fs-button-hover-color" : textColors.value.light,
173
- "--fs-button-active-background-color": colors.value.dark,
174
- "--fs-button-active-border-color" : colors.value.dark,
175
- "--fs-button-active-color" : textColors.value.light,
153
+ "--fs-button-padding": !hasNoText.value ? "0 16px" : "0 7px"
176
154
  };
177
155
  case "icon": switch (props.color) {
178
156
  case ColorEnum.Dark:
@@ -190,9 +168,6 @@ export default defineComponent({
190
168
 
191
169
  const classes = computed((): string[] => {
192
170
  const classNames: string[] = [];
193
- if (!props.editable) {
194
- classNames.push("fs-button--disabled");
195
- }
196
171
  if (props.fullWidth) {
197
172
  classNames.push("fs-button-full-width");
198
173
  }
@@ -208,10 +183,9 @@ export default defineComponent({
208
183
  });
209
184
 
210
185
  return {
211
- props,
186
+ classes,
212
187
  colors,
213
- style,
214
- classes
188
+ style
215
189
  };
216
190
  }
217
191
  });
@@ -29,7 +29,7 @@
29
29
  </template>
30
30
 
31
31
  <script lang="ts">
32
- import { computed, defineComponent } from "vue";
32
+ import { computed, defineComponent, PropType } from "vue";
33
33
 
34
34
  import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
35
35
 
@@ -46,19 +46,19 @@ export default defineComponent({
46
46
  },
47
47
  props: {
48
48
  width: {
49
- type: [String, Number],
49
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number>,
50
50
  required: false,
51
51
  default: null
52
52
  },
53
53
  height: {
54
- type: [String, Number],
54
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number>,
55
55
  required: false,
56
56
  default: null
57
57
  },
58
58
  gap: {
59
59
  type: [String, Number],
60
60
  required: false,
61
- default: 8
61
+ default: "8px"
62
62
  }
63
63
  },
64
64
  setup(props) {
@@ -21,16 +21,17 @@
21
21
  </template>
22
22
 
23
23
  <script lang="ts">
24
- import { computed, defineComponent, VNode } from "vue";
24
+ import { computed, defineComponent, PropType, VNode } from "vue";
25
25
 
26
26
  import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
27
27
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
28
+ import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
28
29
 
29
30
  export default defineComponent({
30
31
  name: "FSCarousel",
31
32
  props: {
32
33
  height: {
33
- type: [String, Number],
34
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number>,
34
35
  required: false,
35
36
  default: "100%"
36
37
  }
@@ -45,7 +46,7 @@ export default defineComponent({
45
46
 
46
47
  const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
47
48
  return {
48
- "--fs-carousel-height" : typeof(props.height) === "string" ? props.height : `${props.height}px`,
49
+ "--fs-carousel-height" : sizeToVar(props.height),
49
50
  "--fs-carousel-background-color": backgrounds.base
50
51
  };
51
52
  });
@@ -0,0 +1,125 @@
1
+ <template>
2
+ <FSCard
3
+ :border="$props.border"
4
+ :class="classes"
5
+ :style="style"
6
+ @click.stop="onClick"
7
+ v-bind="$attrs"
8
+ >
9
+ <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
10
+ <slot :name="name" v-bind="slotData" />
11
+ </template>
12
+ </FSCard>
13
+ </template>
14
+
15
+ <script lang="ts">
16
+ import { computed, defineComponent, PropType } from "vue";
17
+
18
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
19
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
20
+ import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
21
+
22
+ import FSCard from "./FSCard.vue";
23
+
24
+ export default defineComponent({
25
+ name: "FSClickable",
26
+ components: {
27
+ FSCard
28
+ },
29
+ props: {
30
+ border: {
31
+ type: Boolean,
32
+ required: false,
33
+ default: true
34
+ },
35
+ borderRadius: {
36
+ type: [String, Number],
37
+ required: false,
38
+ default: "4px"
39
+ },
40
+ variant: {
41
+ type: String as PropType<"standard" | "full">,
42
+ required: false,
43
+ default: "standard"
44
+ },
45
+ color: {
46
+ type: String as PropType<ColorBase>,
47
+ required: false,
48
+ default: ColorEnum.Primary
49
+ },
50
+ editable: {
51
+ type: Boolean,
52
+ required: false,
53
+ default: true
54
+ }
55
+ },
56
+ emits: ["click"],
57
+ setup(props, { emit }) {
58
+ const { getColors, getContrasts } = useColors();
59
+
60
+ const textColors = computed(() => getContrasts(props.color));
61
+ const colors = computed(() => getColors(props.color));
62
+ const lights = getColors(ColorEnum.Light);
63
+
64
+ const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
65
+ if (!props.editable) {
66
+ return {
67
+ "--fs-clickable-border-size" : props.border ? "1px" : "0",
68
+ "--fs-clickable-border-radius" : sizeToVar(props.borderRadius),
69
+ "--fs-clickable-background-color": lights.base,
70
+ "--fs-clickable-border-color" : lights.dark,
71
+ "--fs-clickable-color" : lights.dark,
72
+ };
73
+ }
74
+ switch (props.variant) {
75
+ case "standard": return {
76
+ "--fs-clickable-border-size" : props.border ? "1px" : "0",
77
+ "--fs-clickable-border-radius" : sizeToVar(props.borderRadius),
78
+ "--fs-clickable-background-color" : colors.value.light,
79
+ "--fs-clickable-border-color" : colors.value.base,
80
+ "--fs-clickable-color" : textColors.value.base,
81
+ "--fs-clickable-hover-background-color" : colors.value.base,
82
+ "--fs-clickable-hover-border-color" : colors.value.base,
83
+ "--fs-clickable-hover-color" : textColors.value.light,
84
+ "--fs-clickable-active-background-color": colors.value.dark,
85
+ "--fs-clickable-active-border-color" : colors.value.dark,
86
+ "--fs-clickable-active-color" : textColors.value.light,
87
+ };
88
+ case "full": return {
89
+ "--fs-clickable-border-size" : props.border ? "1px" : "0",
90
+ "--fs-clickable-border-radius" : sizeToVar(props.borderRadius),
91
+ "--fs-clickable-background-color" : colors.value.base,
92
+ "--fs-clickable-border-color" : colors.value.base,
93
+ "--fs-clickable-color" : textColors.value.light,
94
+ "--fs-clickable-hover-background-color" : colors.value.base,
95
+ "--fs-clickable-hover-border-color" : colors.value.base,
96
+ "--fs-clickable-hover-color" : textColors.value.light,
97
+ "--fs-clickable-active-background-color": colors.value.dark,
98
+ "--fs-clickable-active-border-color" : colors.value.dark,
99
+ "--fs-clickable-active-color" : textColors.value.light,
100
+ };
101
+ }
102
+ });
103
+
104
+ const classes = computed((): string[] => {
105
+ const classNames: string[] = ["fs-clickable"];
106
+ if (!props.editable) {
107
+ classNames.push("fs-clickable-disabled");
108
+ }
109
+ return classNames;
110
+ });
111
+
112
+ const onClick = () => {
113
+ if (props.editable) {
114
+ emit("click");
115
+ }
116
+ };
117
+
118
+ return {
119
+ classes,
120
+ style,
121
+ onClick
122
+ };
123
+ }
124
+ });
125
+ </script>
@@ -15,7 +15,7 @@
15
15
  />
16
16
  <FSText
17
17
  variant="light"
18
- font="text-h4"
18
+ :font="$props.font"
19
19
  >
20
20
  <slot>
21
21
  {{ $props.label }}
@@ -29,7 +29,7 @@
29
29
  </template>
30
30
 
31
31
  <script lang="ts">
32
- import { computed, defineComponent } from "vue";
32
+ import { computed, defineComponent, PropType } from "vue";
33
33
 
34
34
  import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
35
35
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
@@ -52,6 +52,11 @@ export default defineComponent({
52
52
  type: String,
53
53
  required: false,
54
54
  default: null
55
+ },
56
+ font: {
57
+ type: String as PropType<"text-h1" | "text-h2" | "text-h3" | "text-h4" | "text-body" | "text-button" | "text-overline" | "text-underline">,
58
+ required: false,
59
+ default: "text-body"
55
60
  }
56
61
  },
57
62
  setup(props) {
@@ -49,18 +49,7 @@ export default defineComponent({
49
49
 
50
50
  const getHeight = computed((): string | number => {
51
51
  switch (props.variant) {
52
- case "standard": {
53
- if (Array.isArray(props.height)) {
54
- if (isExtraSmall.value) {
55
- return props.height[2] ?? props.height[1] ?? props.height[0];
56
- }
57
- if (isMobileSized.value) {
58
- return props.height[1] ?? props.height[0];
59
- }
60
- return props.height[0];
61
- }
62
- return props.height;
63
- }
52
+ case "standard": return sizeToVar(props.height);
64
53
  case "button":
65
54
  case "input": return isMobileSized.value ? "36px" : "40px";
66
55
  case "chip": return isMobileSized.value ? "20px" : "24px";
@@ -77,25 +66,14 @@ export default defineComponent({
77
66
 
78
67
  const getWidth = computed((): string | number => {
79
68
  switch (props.variant) {
80
- case "standard": {
81
- if (Array.isArray(props.width)) {
82
- if (isExtraSmall.value) {
83
- return props.width[2] ?? props.width[1] ?? props.width[0];
84
- }
85
- if (isMobileSized.value) {
86
- return props.width[1] ?? props.width[0];
87
- }
88
- return props.width[0];
89
- }
90
- return props.width;
91
- }
92
- case "button": return isMobileSized ? "36px" : "40px";
93
- case "input": return isMobileSized ? "calc(50% - 124px)" : "calc(50% - 132px)";
94
- case "chip": return "8vw";
95
- case "text-h1": return "calc(50% - 32px)";
96
- case "text-h2": return "calc(60% - 32px)";
97
- case "text-h3": return "calc(65% - 32px)";
98
- default: return "calc(75% - 32px)";
69
+ case "standard": return sizeToVar(props.width);
70
+ case "button": return isMobileSized ? "36px" : "40px";
71
+ case "input": return isMobileSized ? "calc(50% - 124px)" : "calc(50% - 132px)";
72
+ case "chip": return "8vw";
73
+ case "text-h1": return "calc(50% - 32px)";
74
+ case "text-h2": return "calc(60% - 32px)";
75
+ case "text-h3": return "calc(65% - 32px)";
76
+ default: return "calc(75% - 32px)";
99
77
  }
100
78
  });
101
79
 
@@ -1,28 +1,62 @@
1
1
  <template>
2
2
  <v-slide-group
3
3
  class="fs-slide-group"
4
+ ref="slideGroupRef"
4
5
  :showArrows="true"
5
6
  :style="style"
6
7
  v-bind="$attrs"
7
8
  >
8
- <v-slide-group-item
9
- v-for="(component, index) in getChildren()"
10
- :key="index"
11
- >
12
- <component :is="component" />
13
- </v-slide-group-item>
9
+ <template #prev>
10
+ <FSButton
11
+ v-if="$props.dash"
12
+ icon="mdi-chevron-double-left"
13
+ variant="icon"
14
+ @click="goToStart"
15
+ />
16
+ <FSButtonPreviousIcon
17
+ :color="ColorEnum.Dark"
18
+ />
19
+ </template>
20
+ <template #default>
21
+ <v-slide-group-item
22
+ v-for="(component, index) in getChildren()"
23
+ :key="index"
24
+ >
25
+ <component :is="component" />
26
+ </v-slide-group-item>
27
+ </template>
28
+ <template #next>
29
+ <FSButtonNextIcon
30
+ :color="ColorEnum.Dark"
31
+ />
32
+ <FSButton
33
+ v-if="$props.dash"
34
+ icon="mdi-chevron-double-right"
35
+ variant="icon"
36
+ @click="goToEnd"
37
+ />
38
+ </template>
14
39
  </v-slide-group>
15
40
  </template>
16
41
 
17
42
  <script lang="ts">
18
- import { computed, defineComponent } from "vue";
43
+ import { computed, defineComponent, ref } from "vue";
19
44
 
20
45
  import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
21
46
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
22
47
  import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
23
48
 
49
+ import FSButtonPreviousIcon from "./buttons/FSButtonPreviousIcon.vue";
50
+ import FSButtonNextIcon from "./buttons/FSButtonNextIcon.vue";
51
+ import FSButton from "./FSButton.vue";
52
+
24
53
  export default defineComponent({
25
54
  name: "FSSlideGroup",
55
+ components: {
56
+ FSButtonPreviousIcon,
57
+ FSButtonNextIcon,
58
+ FSButton
59
+ },
26
60
  props: {
27
61
  padding: {
28
62
  type: [String, Number],
@@ -33,6 +67,11 @@ export default defineComponent({
33
67
  type: [String, Number],
34
68
  required: false,
35
69
  default: "8px"
70
+ },
71
+ dash: {
72
+ type: Boolean,
73
+ required: false,
74
+ default: true
36
75
  }
37
76
  },
38
77
  setup(props) {
@@ -41,16 +80,38 @@ export default defineComponent({
41
80
 
42
81
  const darks = getColors(ColorEnum.Dark);
43
82
 
83
+ const slideGroupRef = ref(null);
84
+
44
85
  const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => ({
86
+ "--fs-group-arrows-width": props.dash ? "52px" : "32px",
45
87
  "--fs-group-padding" : sizeToVar(props.padding),
46
88
  "--fs-group-gap" : sizeToVar(props.gap),
47
89
  "--fs-group-color" : darks.light,
48
90
  "--fs-group-hover-color": darks.dark
49
91
  }));
50
92
 
93
+ const goToStart = () => {
94
+ if (slideGroupRef.value) {
95
+ slideGroupRef.value.scrollOffset = 0;
96
+ }
97
+ };
98
+
99
+ const goToEnd = () => {
100
+ if (slideGroupRef.value) {
101
+ const contentSize = slideGroupRef.value.$el.children[1].children[0].clientWidth;
102
+ const containerSize = slideGroupRef.value.$el.clientWidth;
103
+ const arrowsOffset = props.dash ? 104 : 64;
104
+ slideGroupRef.value.scrollOffset = (contentSize - containerSize + arrowsOffset);
105
+ }
106
+ };
107
+
51
108
  return {
109
+ slideGroupRef,
110
+ ColorEnum,
52
111
  style,
53
- getChildren
112
+ getChildren,
113
+ goToStart,
114
+ goToEnd
54
115
  };
55
116
  }
56
117
  });
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <FSWrapGroup
3
3
  v-if="['wrap'].includes($props.variant)"
4
+ ref="toggleSetRef"
4
5
  :padding="$props.padding"
5
6
  :gap="$props.gap"
6
7
  >
@@ -40,6 +41,7 @@
40
41
  </FSWrapGroup>
41
42
  <FSSlideGroup
42
43
  v-else
44
+ ref="toggleSetRef"
43
45
  :padding="$props.padding"
44
46
  :gap="$props.gap"
45
47
  >
@@ -80,7 +82,7 @@
80
82
  </template>
81
83
 
82
84
  <script lang="ts">
83
- import { defineComponent, PropType } from "vue";
85
+ import { defineComponent, PropType, ref } from "vue";
84
86
 
85
87
  import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
86
88
  import { useSlots } from "@dative-gpi/foundation-shared-components/composables";
@@ -175,6 +177,8 @@ export default defineComponent({
175
177
 
176
178
  const firstChild = getFirstChild("item");
177
179
 
180
+ const toggleSetRef = ref(null);
181
+
178
182
  const getFromFirstChild = (prop: string, value: FSToggle): any => {
179
183
  switch (prop) {
180
184
  case "prependIcon":
@@ -269,12 +273,27 @@ export default defineComponent({
269
273
  }
270
274
  };
271
275
 
276
+ const goToStart = () => {
277
+ if (toggleSetRef.value) {
278
+ toggleSetRef.value.goToStart();
279
+ }
280
+ };
281
+
282
+ const goToEnd = () => {
283
+ if (toggleSetRef.value) {
284
+ toggleSetRef.value.goToEnd();
285
+ }
286
+ };
287
+
272
288
  return {
289
+ toggleSetRef,
273
290
  firstChild,
274
291
  getFromFirstChild,
275
292
  getVariant,
293
+ goToStart,
276
294
  getColor,
277
295
  getClass,
296
+ goToEnd,
278
297
  toggle
279
298
  };
280
299
  }