@dative-gpi/foundation-shared-components 0.0.8 → 0.0.9

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 (139) hide show
  1. package/{models/FSButtons.ts → aliases/FSButton.ts} +24 -21
  2. package/aliases/index.ts +1 -0
  3. package/components/FSAutocompleteField.vue +207 -0
  4. package/components/FSBadge.vue +38 -0
  5. package/components/FSBreadcrumbs.vue +49 -55
  6. package/components/FSButton.vue +116 -101
  7. package/components/FSCalendar.vue +52 -39
  8. package/components/FSCalendarTwin.vue +120 -102
  9. package/components/FSCard.vue +35 -21
  10. package/components/FSCarousel.vue +63 -0
  11. package/components/FSCheckbox.vue +111 -103
  12. package/components/FSChip.vue +140 -0
  13. package/components/FSClock.vue +149 -15
  14. package/components/FSCol.vue +104 -98
  15. package/components/FSColor.vue +61 -64
  16. package/components/FSColorIcon.vue +67 -0
  17. package/components/FSContainer.vue +64 -0
  18. package/components/FSDateField.vue +211 -0
  19. package/components/FSDateRangeField.vue +225 -0
  20. package/components/FSDateTimeField.vue +257 -0
  21. package/components/FSDateTimeRangeField.vue +286 -0
  22. package/components/FSDialog.vue +103 -0
  23. package/components/FSDivider.vue +39 -0
  24. package/components/FSFadeOut.vue +49 -59
  25. package/components/FSFileButton.vue +245 -0
  26. package/components/FSHeaderButton.vue +17 -0
  27. package/components/FSIcon.vue +23 -23
  28. package/components/FSIconField.vue +232 -0
  29. package/components/FSImage.vue +142 -0
  30. package/components/FSLoadTile.vue +93 -0
  31. package/components/FSNumberField.vue +51 -53
  32. package/components/FSPasswordField.vue +99 -101
  33. package/components/FSRadio.vue +107 -109
  34. package/components/FSRadioGroup.vue +55 -57
  35. package/components/FSRemoveDialog.vue +123 -0
  36. package/components/FSRichTextField.vue +26 -33
  37. package/components/FSRow.vue +110 -104
  38. package/components/FSSearchField.vue +35 -27
  39. package/components/FSSelectField.vue +188 -0
  40. package/components/FSSlideGroup.vue +45 -49
  41. package/components/FSSlider.vue +31 -33
  42. package/components/FSSpan.vue +53 -37
  43. package/components/FSSubmitDialog.vue +165 -0
  44. package/components/FSSwitch.vue +110 -109
  45. package/components/FSTab.vue +61 -61
  46. package/components/FSTabs.vue +53 -55
  47. package/components/FSTag.vue +88 -84
  48. package/components/FSTagField.vue +32 -36
  49. package/components/FSTagGroup.vue +38 -45
  50. package/components/FSText.vue +74 -64
  51. package/components/FSTextArea.vue +187 -185
  52. package/components/FSTextField.vue +18 -20
  53. package/components/FSTile.vue +90 -0
  54. package/components/FSToggleSet.vue +282 -0
  55. package/components/FSTooltip.vue +21 -0
  56. package/components/FSWindow.vue +26 -16
  57. package/components/FSWrapGroup.vue +44 -47
  58. package/components/deviceOrganisations/FSConnectivity.vue +114 -0
  59. package/components/deviceOrganisations/FSStatus.vue +117 -0
  60. package/components/deviceOrganisations/FSStatusesCarousel.vue +105 -0
  61. package/components/deviceOrganisations/FSStatusesRow.vue +66 -0
  62. package/components/deviceOrganisations/FSWorstAlert.vue +165 -0
  63. package/components/lists/FSDataIteratorGroup.vue +7 -0
  64. package/components/lists/FSDataIteratorItem.vue +103 -0
  65. package/components/lists/FSDataTable.vue +964 -0
  66. package/components/lists/FSFilterButton.vue +176 -0
  67. package/components/lists/FSHeaderButton.vue +99 -0
  68. package/components/lists/FSHiddenButton.vue +79 -0
  69. package/components/tiles/FSDeviceOrganisationTileUI.vue +232 -0
  70. package/components/tiles/FSGroupTileUI.vue +192 -0
  71. package/composables/index.ts +1 -1
  72. package/composables/useBreakpoints.ts +23 -4
  73. package/composables/useColors.ts +53 -23
  74. package/composables/useSlots.ts +43 -0
  75. package/index.ts +6 -0
  76. package/models/breadcrumbs.ts +8 -0
  77. package/models/colors.ts +17 -0
  78. package/models/deviceAlerts.ts +10 -0
  79. package/models/deviceConnectivities.ts +11 -0
  80. package/models/deviceStatuses.ts +16 -0
  81. package/models/dispositions.ts +33 -0
  82. package/models/index.ts +9 -0
  83. package/models/modelStatuses.ts +11 -0
  84. package/models/rules.ts +50 -0
  85. package/models/toggleSets.ts +7 -0
  86. package/package.json +5 -4
  87. package/plugins/colorPlugin.ts +2 -2
  88. package/shims-plugin.d.ts +1 -1
  89. package/styles/components/fs_autocomplete_field.scss +123 -0
  90. package/styles/components/fs_button.scss +4 -6
  91. package/styles/components/fs_calendar.scss +24 -1
  92. package/styles/components/fs_card.scss +2 -5
  93. package/styles/components/fs_carousel.scss +4 -0
  94. package/styles/components/fs_chip.scss +33 -0
  95. package/styles/components/fs_clock.scss +43 -0
  96. package/styles/components/fs_col.scss +2 -0
  97. package/styles/components/fs_color_icon.scss +37 -0
  98. package/styles/components/fs_container.scss +16 -0
  99. package/styles/components/fs_data_iterator_item.scss +19 -0
  100. package/styles/components/fs_data_table.scss +97 -0
  101. package/styles/components/fs_date_field.scss +8 -0
  102. package/styles/components/fs_dialog.scss +30 -0
  103. package/styles/components/fs_divider.scss +5 -0
  104. package/styles/components/fs_fade_out.scss +10 -2
  105. package/styles/components/fs_filter_button.scss +12 -0
  106. package/styles/components/fs_header_button.scss +4 -0
  107. package/styles/components/fs_icon.scss +19 -3
  108. package/styles/components/fs_icon_field.scss +12 -0
  109. package/styles/components/fs_image.scss +7 -0
  110. package/styles/components/fs_load_tile.scss +49 -0
  111. package/styles/components/fs_password_field.scss +2 -2
  112. package/styles/components/fs_row.scss +4 -1
  113. package/styles/components/fs_select_field.scss +71 -0
  114. package/styles/components/fs_slide_group.scss +6 -0
  115. package/styles/components/fs_slider.scss +29 -9
  116. package/styles/components/fs_span.scss +8 -0
  117. package/styles/components/fs_submit_dialog.scss +9 -0
  118. package/styles/components/fs_tabs.scss +4 -0
  119. package/styles/components/fs_tag_field.scss +0 -11
  120. package/styles/components/fs_text_field.scss +23 -15
  121. package/styles/components/fs_tile.scss +33 -0
  122. package/styles/components/fs_tooltip.scss +5 -0
  123. package/styles/components/fs_wrap_group.scss +7 -8
  124. package/styles/components/index.scss +21 -1
  125. package/styles/globals/breakpoints.scss +7 -0
  126. package/styles/globals/overrides.scss +20 -7
  127. package/styles/globals/text_fonts.scss +8 -8
  128. package/themes/default.ts +1 -11
  129. package/utils/css.ts +11 -0
  130. package/utils/icons.ts +75416 -0
  131. package/utils/index.ts +5 -1
  132. package/utils/levenshtein.ts +97 -0
  133. package/utils/sort.ts +9 -0
  134. package/components/FSDatePicker.vue +0 -226
  135. package/composables/useDates.ts +0 -39
  136. package/models/FSTags.ts +0 -8
  137. package/models/FSTextFields.ts +0 -23
  138. package/styles/components/fs_date_picker.scss +0 -0
  139. /package/utils/{FSRichTextField.ts → lexical.ts} +0 -0
@@ -0,0 +1,165 @@
1
+ <template>
2
+ <FSDialog
3
+ cardClasses="fs-submit-dialog"
4
+ :width="$props.width"
5
+ :modelValue="$props.modelValue"
6
+ @update:modelValue="$emit('update:modelValue', $event)"
7
+ v-bind="$attrs"
8
+ >
9
+ <template #header>
10
+ <slot name="header">
11
+ <FSCol v-if="$props.title">
12
+ <FSSpan font="text-h2">
13
+ {{ $props.title }}
14
+ </FSSpan>
15
+ <FSSpan v-if="$props.subtitle">
16
+ {{ $props.subtitle }}
17
+ </FSSpan>
18
+ </FSCol>
19
+ </slot>
20
+ </template>
21
+ <template #body>
22
+ <slot name="body" />
23
+ </template>
24
+ <template #footer>
25
+ <slot name="footer">
26
+ <FSRow
27
+ class="fs-submit-dialog-actions"
28
+ align="top-right"
29
+ :wrap="false"
30
+ >
31
+ <FSButton
32
+ :prependIcon="$props.leftButtonPrependIcon"
33
+ :label="cancelButtonLabel"
34
+ :appendIcon="$props.leftButtonAppendIcon"
35
+ :variant="$props.leftButtonVariant"
36
+ :color="$props.leftButtonColor"
37
+ @click="() => $emit('update:modelValue', false)"
38
+ />
39
+ <FSButton
40
+ :prependIcon="$props.rightButtonPrependIcon"
41
+ :label="submitButtonLabel"
42
+ :appendIcon="$props.rightButtonAppendIcon"
43
+ :variant="$props.rightButtonVariant"
44
+ :color="$props.rightButtonColor"
45
+ :editable="$props.editable"
46
+ @click="() => $emit('click:rightButton')"
47
+ />
48
+ </FSRow>
49
+ </slot>
50
+ </template>
51
+ </FSDialog>
52
+ </template>
53
+
54
+ <script lang="ts">
55
+ import { computed, defineComponent, PropType } from "vue";
56
+
57
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
58
+ import { useTranslationsProvider } from "@dative-gpi/foundation-shared-services";
59
+
60
+ import FSDialog from "./FSDialog.vue";
61
+ import FSRow from "./FSRow.vue";
62
+
63
+ export default defineComponent({
64
+ name: "FSSubmitDialog",
65
+ components: {
66
+ FSDialog,
67
+ FSRow
68
+ },
69
+ props: {
70
+ modelValue: {
71
+ type: Boolean,
72
+ required: false,
73
+ default: false
74
+ },
75
+ width: {
76
+ type: [String, Number],
77
+ required: false,
78
+ default: "auto"
79
+ },
80
+ title: {
81
+ type: String,
82
+ required: false,
83
+ default: null
84
+ },
85
+ subtitle: {
86
+ type: String,
87
+ required: false,
88
+ default: null
89
+ },
90
+ leftButtonPrependIcon: {
91
+ type: String,
92
+ required: false,
93
+ default: null
94
+ },
95
+ leftButtonLabel: {
96
+ type: String,
97
+ required: false,
98
+ default: null
99
+ },
100
+ leftButtonAppendIcon: {
101
+ type: String,
102
+ required: false,
103
+ default: null
104
+ },
105
+ leftButtonVariant: {
106
+ type: String as PropType<"standard" | "full" | "icon">,
107
+ required: false,
108
+ default: "standard"
109
+ },
110
+ rightButtonPrependIcon: {
111
+ type: String,
112
+ required: false,
113
+ default: null
114
+ },
115
+ rightButtonLabel: {
116
+ type: String,
117
+ required: false,
118
+ default: null
119
+ },
120
+ rightButtonAppendIcon: {
121
+ type: String,
122
+ required: false,
123
+ default: null
124
+ },
125
+ rightButtonVariant: {
126
+ type: String as PropType<"standard" | "full" | "icon">,
127
+ required: false,
128
+ default: "full"
129
+ },
130
+ leftButtonColor: {
131
+ type: String as PropType<ColorBase>,
132
+ required: false,
133
+ default: ColorEnum.Light
134
+ },
135
+ rightButtonColor: {
136
+ type: String as PropType<ColorBase>,
137
+ required: false,
138
+ default: ColorEnum.Primary
139
+ },
140
+ editable: {
141
+ type: Boolean,
142
+ required: false,
143
+ default: true
144
+ }
145
+ },
146
+ emits: ["update:modelValue"],
147
+ setup(props) {
148
+ const { $tr } = useTranslationsProvider();
149
+
150
+ const cancelButtonLabel = computed(() => {
151
+ return props.leftButtonLabel ?? $tr("ui.button.cancel", "Cancel");
152
+ });
153
+
154
+ const submitButtonLabel = computed(() => {
155
+ return props.rightButtonLabel ?? $tr("ui.button.validate", "Validate");
156
+ });
157
+
158
+ return {
159
+ ColorEnum,
160
+ cancelButtonLabel,
161
+ submitButtonLabel
162
+ };
163
+ }
164
+ });
165
+ </script>
@@ -1,129 +1,130 @@
1
1
  <template>
2
- <FSCol width="hug">
3
- <FSRow width="hug" align="center-left">
4
- <v-switch
5
- class="fs-switch"
6
- hide-details
7
- inset
8
- :style="style"
9
- :ripple="false"
10
- :modelValue="$props.modelValue"
11
- @update:modelValue="onToggle"
12
- v-bind="$attrs"
13
- />
14
- <slot name="default">
15
- <FSSpan
16
- v-if="$props.label"
17
- class="fs-switch-label"
18
- :style="style"
19
- :font="font"
20
- @click="onToggle"
21
- >
22
- {{ $props.label }}
23
- </FSSpan>
24
- </slot>
25
- </FSRow>
26
- <slot name="description">
27
- <FSSpan
28
- v-if="$props.description"
29
- class="fs-switch-description"
30
- font="text-underline"
31
- :style="style"
32
- >
33
- {{ $props.description }}
34
- </FSSpan>
35
- </slot>
36
- </FSCol>
2
+ <FSCol
3
+ width="hug"
4
+ >
5
+ <FSRow
6
+ width="hug"
7
+ align="center-left"
8
+ >
9
+ <v-switch
10
+ class="fs-switch"
11
+ hide-details
12
+ inset
13
+ :style="style"
14
+ :ripple="false"
15
+ :modelValue="$props.modelValue"
16
+ @update:modelValue="onToggle"
17
+ v-bind="$attrs"
18
+ />
19
+ <slot>
20
+ <FSSpan
21
+ v-if="$props.label"
22
+ class="fs-switch-label"
23
+ :style="style"
24
+ :font="font"
25
+ @click.stop="onToggle"
26
+ >
27
+ {{ $props.label }}
28
+ </FSSpan>
29
+ </slot>
30
+ </FSRow>
31
+ <slot name="description">
32
+ <FSSpan
33
+ v-if="$props.description"
34
+ class="fs-switch-description"
35
+ font="text-underline"
36
+ :style="style"
37
+ >
38
+ {{ $props.description }}
39
+ </FSSpan>
40
+ </slot>
41
+ </FSCol>
37
42
  </template>
38
43
 
39
44
  <script lang="ts">
40
- import { computed, defineComponent, PropType, toRefs } from "vue";
45
+ import { computed, defineComponent, PropType } from "vue";
41
46
 
47
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
42
48
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
43
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
44
49
 
45
50
  import FSSpan from "./FSSpan.vue";
46
51
  import FSRow from "./FSRow.vue";
47
52
  import FSCol from "./FSCol.vue";
48
53
 
49
54
  export default defineComponent({
50
- name: "FSSwitch",
51
- components: {
52
- FSSpan,
53
- FSRow,
54
- FSCol
55
+ name: "FSSwitch",
56
+ components: {
57
+ FSSpan,
58
+ FSRow,
59
+ FSCol
60
+ },
61
+ props: {
62
+ label: {
63
+ type: String,
64
+ required: false,
65
+ default: null
55
66
  },
56
- props: {
57
- label: {
58
- type: String,
59
- required: false,
60
- default: null
61
- },
62
- description: {
63
- type: String,
64
- required: false,
65
- default: null
66
- },
67
- modelValue: {
68
- type: Boolean,
69
- required: false,
70
- default: false
71
- },
72
- color: {
73
- type: String as PropType<ColorBase>,
74
- required: false,
75
- default: ColorBase.Primary
76
- },
77
- editable: {
78
- type: Boolean,
79
- required: false,
80
- default: true
81
- }
67
+ description: {
68
+ type: String,
69
+ required: false,
70
+ default: null
82
71
  },
83
- emits: ["update:modelValue"],
84
- setup(props, { emit }) {
85
- const { modelValue, color, editable } = toRefs(props);
86
-
87
- const colors = useColors().getColors(color.value);
88
-
89
- const backgrounds = useColors().getColors(ColorBase.Background);
90
- const lights = useColors().getColors(ColorBase.Light);
91
- const darks = useColors().getColors(ColorBase.Dark);
92
-
93
- const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
94
- if (!editable.value) {
95
- return {
96
- "--fs-switch-translate-x": modelValue.value ? "8px" : "-8px",
97
- "--fs-switch-cursor": "default",
98
- "--fs-switch-track-color": lights.dark,
99
- "--fs-switch-thumb-color": backgrounds.base,
100
- "--fs-switch-color": lights.dark
101
- };
102
- }
103
- return {
104
- "--fs-switch-translate-x": modelValue.value ? "8px" : "-8px",
105
- "--fs-switch-cursor": "pointer",
106
- "--fs-switch-track-color": modelValue.value ? colors.base : darks.base,
107
- "--fs-switch-thumb-color": backgrounds.base,
108
- "--fs-switch-color": darks.base
109
- };
110
- });
111
-
112
- const font = computed((): string => modelValue.value ? "text-button" : "text-body");
113
-
114
- const onToggle = (): void => {
115
- if (!editable.value) {
116
- return;
117
- }
118
- emit("update:modelValue", !modelValue.value);
119
- }
72
+ modelValue: {
73
+ type: Boolean,
74
+ required: false,
75
+ default: false
76
+ },
77
+ color: {
78
+ type: String as PropType<ColorBase>,
79
+ required: false,
80
+ default: ColorEnum.Primary
81
+ },
82
+ editable: {
83
+ type: Boolean,
84
+ required: false,
85
+ default: true
86
+ }
87
+ },
88
+ emits: ["update:modelValue"],
89
+ setup(props, { emit }) {
90
+ const colors = computed(() => useColors().getColors(props.color));
91
+ const backgrounds = useColors().getColors(ColorEnum.Background);
92
+ const lights = useColors().getColors(ColorEnum.Light);
93
+ const darks = useColors().getColors(ColorEnum.Dark);
120
94
 
95
+ const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
96
+ if (!props.editable) {
121
97
  return {
122
- editable,
123
- style,
124
- font,
125
- onToggle
98
+ "--fs-switch-translate-x": props.modelValue ? "8px" : "-8px",
99
+ "--fs-switch-cursor" : "default",
100
+ "--fs-switch-track-color": lights.dark,
101
+ "--fs-switch-thumb-color": backgrounds.base,
102
+ "--fs-switch-color" : lights.dark
126
103
  };
104
+ }
105
+ return {
106
+ "--fs-switch-translate-x": props.modelValue ? "8px" : "-8px",
107
+ "--fs-switch-cursor" : "pointer",
108
+ "--fs-switch-track-color": props.modelValue ? colors.value.base : darks.base,
109
+ "--fs-switch-thumb-color": backgrounds.base,
110
+ "--fs-switch-color" : darks.base
111
+ };
112
+ });
113
+
114
+ const font = computed((): string => props.modelValue ? "text-button" : "text-body");
115
+
116
+ const onToggle = (): void => {
117
+ if (!props.editable) {
118
+ return;
119
+ }
120
+ emit("update:modelValue", !props.modelValue);
127
121
  }
122
+
123
+ return {
124
+ style,
125
+ font,
126
+ onToggle
127
+ };
128
+ }
128
129
  });
129
130
  </script>
@@ -1,79 +1,79 @@
1
1
  <template>
2
- <v-tab
3
- class="fs-tab"
4
- :ripple="false"
5
- v-bind="$attrs"
6
- >
2
+ <v-tab
3
+ class="fs-tab"
4
+ :ripple="false"
5
+ v-bind="$attrs"
6
+ >
7
+ <slot>
8
+ <FSRow align="center-left">
9
+ <slot name="prepend">
10
+ <FSIcon v-if="$props.prependIcon" size="m">
11
+ {{ $props.prependIcon }}
12
+ </FSIcon>
13
+ </slot>
7
14
  <slot>
8
- <FSRow align="center-left">
9
- <slot name="prepend">
10
- <FSIcon v-if="$props.prependIcon" size="m">
11
- {{ $props.prependIcon }}
12
- </FSIcon>
13
- </slot>
14
- <slot name="default">
15
- <FSSpan v-if="$props.label" font="text-button">
16
- {{ $props.label }}
17
- </FSSpan>
18
- </slot>
19
- <v-spacer v-if="$props.tag" />
20
- <slot name="tag">
21
- <FSSpan v-if="$props.tag" class="fs-tab-tag">
22
- {{ $props.tag }}
23
- </FSSpan>
24
- </slot>
25
- <slot name="append">
26
- <FSIcon v-if="$props.appendIcon" size="m">
27
- {{ $props.appendIcon }}
28
- </FSIcon>
29
- </slot>
30
- </FSRow>
15
+ <FSSpan v-if="$props.label" font="text-button">
16
+ {{ $props.label }}
17
+ </FSSpan>
18
+ </slot>
19
+ <v-spacer v-if="$props.tag" />
20
+ <slot name="tag">
21
+ <FSSpan v-if="$props.tag" class="fs-tab-tag">
22
+ {{ $props.tag }}
23
+ </FSSpan>
24
+ </slot>
25
+ <slot name="append">
26
+ <FSIcon v-if="$props.appendIcon" size="m">
27
+ {{ $props.appendIcon }}
28
+ </FSIcon>
31
29
  </slot>
32
- </v-tab>
30
+ </FSRow>
31
+ </slot>
32
+ </v-tab>
33
33
  </template>
34
34
 
35
35
  <script lang="ts">
36
36
  import { defineComponent, PropType } from "vue";
37
37
 
38
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
38
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
39
39
 
40
40
  import FSSpan from "./FSSpan.vue";
41
41
  import FSIcon from "./FSIcon.vue";
42
42
  import FSRow from "./FSRow.vue";
43
43
 
44
44
  export default defineComponent({
45
- name: "FSTab",
46
- components: {
47
- FSSpan,
48
- FSIcon,
49
- FSRow
45
+ name: "FSTab",
46
+ components: {
47
+ FSSpan,
48
+ FSIcon,
49
+ FSRow
50
+ },
51
+ props: {
52
+ prependIcon: {
53
+ type: String,
54
+ required: false,
55
+ default: null
56
+ },
57
+ label: {
58
+ type: String,
59
+ required: false,
60
+ default: null
61
+ },
62
+ tag: {
63
+ type: String,
64
+ required: false,
65
+ default: null
66
+ },
67
+ appendIcon: {
68
+ type: String,
69
+ required: false,
70
+ default: null
50
71
  },
51
- props: {
52
- prependIcon: {
53
- type: String,
54
- required: false,
55
- default: null
56
- },
57
- label: {
58
- type: String,
59
- required: false,
60
- default: null
61
- },
62
- tag: {
63
- type: String,
64
- required: false,
65
- default: null
66
- },
67
- appendIcon: {
68
- type: String,
69
- required: false,
70
- default: null
71
- },
72
- color: {
73
- type: String as PropType<ColorBase>,
74
- required: false,
75
- default: ColorBase.Dark
76
- }
72
+ color: {
73
+ type: String as PropType<ColorBase>,
74
+ required: false,
75
+ default: ColorEnum.Dark
77
76
  }
77
+ }
78
78
  });
79
79
  </script>
@@ -1,69 +1,67 @@
1
1
  <template>
2
- <v-tabs
3
- class="fs-tabs"
4
- selected-class="fs-tab-active"
5
- show-arrows
6
- grow
7
- :style="style"
8
- :modelValue="tab"
9
- :slider-color="colors.base"
10
- @update:modelValue="(v) => emit('update:tab', v)"
11
- v-bind="$attrs"
2
+ <v-tabs
3
+ class="fs-tabs"
4
+ selectedClass="fs-tab-active"
5
+ :grow="true"
6
+ :style="style"
7
+ :showArrows="true"
8
+ :sliderColor="$props.color"
9
+ :modelValue="$props.tab"
10
+ @update:modelValue="(value) => $emit('update:tab', value)"
11
+ v-bind="$attrs"
12
+ >
13
+ <template
14
+ v-for="(component, index) in getChildren()"
15
+ :key="index"
12
16
  >
13
- <template v-for="(component, index) in $slots.default()" :key="index">
14
- <component :is="component" v-bind="{ color, colors, style }" />
15
- </template>
16
- </v-tabs>
17
+ <component :is="component" />
18
+ </template>
19
+ </v-tabs>
17
20
  </template>
18
21
 
19
22
  <script lang="ts">
20
- import { defineComponent, PropType, Ref, ref, toRefs } from "vue";
23
+ import { computed, defineComponent, PropType } from "vue";
21
24
 
22
- import { useColors } from "@dative-gpi/foundation-shared-components/composables";
23
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
25
+ import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
26
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
24
27
 
25
28
  export default defineComponent({
26
- name: "FSTabs",
27
- props: {
28
- tab: {
29
- type: Number,
30
- required: false,
31
- default: 0
32
- },
33
- color: {
34
- type: String as PropType<ColorBase>,
35
- required: false,
36
- default: ColorBase.Primary
37
- }
29
+ name: "FSTabs",
30
+ props: {
31
+ tab: {
32
+ type: Number,
33
+ required: false,
34
+ default: 0
38
35
  },
39
- emits: ["update:tab"],
40
- setup(props, { emit }) {
41
- const { tab, color } = toRefs(props);
42
-
43
- const textColors = useColors().getContrasts(color.value);
44
- const colors = useColors().getColors(color.value);
36
+ color: {
37
+ type: String as PropType<ColorBase>,
38
+ required: false,
39
+ default: ColorEnum.Primary
40
+ }
41
+ },
42
+ setup(props) {
43
+ const { getChildren } = useSlots();
45
44
 
46
- const darks = useColors().getColors(ColorBase.Dark);
45
+ const textColors = computed(() => useColors().getContrasts(props.color));
46
+ const colors = computed(() => useColors().getColors(props.color));
47
+ const darks = useColors().getColors(ColorEnum.Dark);
47
48
 
48
- const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
49
- "--fs-group-color": darks.base,
50
- "--fs-group-hover-background-color": colors.light,
51
- "--fs-group-hover-color": darks.dark,
52
- "--fs-group-disabled-color": darks.light,
53
- "--fs-group-light": colors.light,
54
- "--fs-group-base": colors.base,
55
- "--fs-group-dark": colors.dark,
56
- "--fs-tab-tag-background-color": colors.base,
57
- "--fs-tab-tag-color": textColors.light
58
- });
49
+ const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => ({
50
+ "--fs-group-color" : darks.base,
51
+ "--fs-group-hover-background-color": colors.value.light,
52
+ "--fs-group-hover-color" : darks.dark,
53
+ "--fs-group-disabled-color" : darks.light,
54
+ "--fs-group-light" : colors.value.light,
55
+ "--fs-group-base" : colors.value.base,
56
+ "--fs-group-dark" : colors.value.dark,
57
+ "--fs-tab-tag-background-color" : colors.value.base,
58
+ "--fs-tab-tag-color" : textColors.value.light
59
+ }));
59
60
 
60
- return {
61
- tab,
62
- color,
63
- colors,
64
- style,
65
- emit
66
- };
67
- }
61
+ return {
62
+ style,
63
+ getChildren
64
+ };
65
+ }
68
66
  });
69
67
  </script>