@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,286 @@
1
+ <template>
2
+ <FSTextField
3
+ class="fs-date-field"
4
+ :label="$props.label"
5
+ :description="$props.description"
6
+ :color="$props.color"
7
+ :hideHeader="$props.hideHeader"
8
+ :required="$props.required"
9
+ :editable="$props.editable"
10
+ :error="messages.length > 0"
11
+ :readonly="true"
12
+ :modelValue="placeholder"
13
+ @click="onClick"
14
+ @click:clear="onClear"
15
+ >
16
+ <template v-if="!$props.hideHeader" #label>
17
+ <slot name="label">
18
+ <FSRow :wrap="false">
19
+ <FSSpan
20
+ v-if="$props.label"
21
+ class="fs-date-field-label"
22
+ font="text-overline"
23
+ :style="style"
24
+ >
25
+ {{ $props.label }}
26
+ </FSSpan>
27
+ <FSSpan
28
+ v-if="$props.label && $props.required"
29
+ class="fs-date-field-label"
30
+ style="margin-left: -8px;"
31
+ font="text-overline"
32
+ :ellipsis="false"
33
+ :style="style"
34
+ >
35
+ *
36
+ </FSSpan>
37
+ <v-spacer style="min-width: 40px;" />
38
+ <FSSpan
39
+ v-if="messages.length > 0"
40
+ class="fs-date-field-messages"
41
+ font="text-overline"
42
+ :style="style"
43
+ >
44
+ {{ messages.join(", ") }}
45
+ </FSSpan>
46
+ </FSRow>
47
+ </slot>
48
+ </template>
49
+ <template #prepend-inner>
50
+ <slot name="prepend-inner">
51
+ <FSButton
52
+ variant="icon"
53
+ icon="mdi-calendar"
54
+ :editable="$props.editable"
55
+ :color="ColorEnum.Dark"
56
+ />
57
+ </slot>
58
+ </template>
59
+ <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
60
+ <slot :name="name" v-bind="slotData" />
61
+ </template>
62
+ </FSTextField>
63
+ <FSSubmitDialog
64
+ :title="$props.label"
65
+ :rightButtonColor="$props.color"
66
+ @click:rightButton="onSubmit"
67
+ v-model="dialog"
68
+ >
69
+ <template #body>
70
+ <FSCol>
71
+ <FSCalendarTwin
72
+ :color="$props.color"
73
+ v-model="innerDateRange"
74
+ />
75
+ <FSRow>
76
+ <FSClock
77
+ :reminder="true"
78
+ :color="$props.color"
79
+ :date="innerDateLeft"
80
+ v-model="innerTimeLeft"
81
+ />
82
+ <FSClock
83
+ :reminder="true"
84
+ :color="$props.color"
85
+ :date="innerDateRight"
86
+ v-model="innerTimeRight"
87
+ />
88
+ </FSRow>
89
+ </FSCol>
90
+ </template>
91
+ </FSSubmitDialog>
92
+ </template>
93
+
94
+ <script lang="ts">
95
+ import { computed, defineComponent, PropType, ref } from "vue";
96
+
97
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
98
+ import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
99
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
100
+
101
+ import FSSubmitDialog from "./FSSubmitDialog.vue";
102
+ import FSCalendarTwin from "./FSCalendarTwin.vue";
103
+ import FSTextField from "./FSTextField.vue";
104
+ import FSButton from "./FSButton.vue";
105
+ import FSClock from "./FSClock.vue";
106
+ import FSCard from "./FSCard.vue";
107
+ import FSCol from "./FSCol.vue";
108
+
109
+ export default defineComponent({
110
+ name: "FSDateTimeRangeField",
111
+ components: {
112
+ FSSubmitDialog,
113
+ FSCalendarTwin,
114
+ FSTextField,
115
+ FSButton,
116
+ FSClock,
117
+ FSCard,
118
+ FSCol
119
+ },
120
+ props: {
121
+ label: {
122
+ type: String,
123
+ required: false,
124
+ default: null
125
+ },
126
+ description: {
127
+ type: String,
128
+ required: false,
129
+ default: null
130
+ },
131
+ modelValue: {
132
+ type: Array as PropType<number[]>,
133
+ required: false,
134
+ default: null
135
+ },
136
+ color: {
137
+ type: String as PropType<ColorBase>,
138
+ required: false,
139
+ default: ColorEnum.Primary
140
+ },
141
+ hideHeader: {
142
+ type: Boolean,
143
+ required: false,
144
+ default: false
145
+ },
146
+ required: {
147
+ type: Boolean,
148
+ required: false,
149
+ default: false
150
+ },
151
+ rules: {
152
+ type: Array as PropType<Function[]>,
153
+ required: false,
154
+ default: () => []
155
+ },
156
+ editable: {
157
+ type: Boolean,
158
+ required: false,
159
+ default: true
160
+ }
161
+ },
162
+ emits: ["update:modelValue"],
163
+ setup(props, { emit }) {
164
+ const { getUserOffsetMillis, epochToShortTimeFormat } = useTimeZone();
165
+
166
+ const errors = useColors().getColors(ColorEnum.Error);
167
+ const lights = useColors().getColors(ColorEnum.Light);
168
+ const darks = useColors().getColors(ColorEnum.Dark);
169
+
170
+ const dialog = ref(false);
171
+
172
+ // FSClock just gives two numbers without consideration for the time zone
173
+ // We must adjust the time to the user's time zone
174
+ const innerTimeLeft = ref(0);
175
+ const innerTimeRight = ref(0);
176
+ const innerDateRange = ref(null);
177
+ if (props.modelValue && Array.isArray(props.modelValue)) {
178
+ switch (props.modelValue.length) {
179
+ case 0: {
180
+ break;
181
+ }
182
+ case 1: {
183
+ innerTimeLeft.value = Math.floor((props.modelValue[0] + getUserOffsetMillis()) % (24 * 60 * 60 * 1000));
184
+ innerDateRange.value = [props.modelValue[0] - innerTimeLeft.value];
185
+ }
186
+ default: {
187
+ innerTimeLeft.value = Math.floor((props.modelValue[0] + getUserOffsetMillis()) % (24 * 60 * 60 * 1000));
188
+ innerTimeRight.value = Math.floor((props.modelValue[1] + getUserOffsetMillis()) % (24 * 60 * 60 * 1000));
189
+ innerDateRange.value = [props.modelValue[0] - innerTimeLeft.value, props.modelValue[1] - innerTimeRight.value];
190
+ }
191
+ }
192
+ }
193
+
194
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
195
+ if (!props.editable) {
196
+ return {
197
+ "--fs-date-field-color": lights.dark
198
+ };
199
+ }
200
+ return {
201
+ "--fs-date-field-color" : darks.base,
202
+ "--fs-date-field-error-color": errors.base
203
+ };
204
+ });
205
+
206
+ const placeholder = computed((): string => {
207
+ if (!props.modelValue || !Array.isArray(props.modelValue) || !props.modelValue.length) {
208
+ return "";
209
+ }
210
+ return props.modelValue.map((epoch) => epochToShortTimeFormat(epoch)).join(" - ");
211
+ });
212
+
213
+ const messages = computed((): string[] => {
214
+ const messages = [];
215
+ for (const rule of props.rules) {
216
+ if (props.modelValue && Array.isArray(props.modelValue)) {
217
+ for (const value of props.modelValue) {
218
+ const message = rule(value);
219
+ if (typeof(message) === "string") {
220
+ messages.push(message);
221
+ break;
222
+ }
223
+ }
224
+ }
225
+ else {
226
+ const message = rule(null);
227
+ if (typeof(message) === "string") {
228
+ messages.push(message);
229
+ }
230
+ }
231
+ }
232
+ return messages;
233
+ });
234
+
235
+ const innerDateLeft = computed((): number | null => {
236
+ if (innerDateRange.value && Array.isArray(innerDateRange.value) && innerDateRange.value.length) {
237
+ return innerDateRange.value[0];
238
+ }
239
+ return null;
240
+ });
241
+
242
+ const innerDateRight= computed((): number | null => {
243
+ if (innerDateRange.value && Array.isArray(innerDateRange.value) && innerDateRange.value.length > 1) {
244
+ return innerDateRange.value[1];
245
+ }
246
+ return null;
247
+ });
248
+
249
+ const onClick = (): void => {
250
+ if (props.editable) {
251
+ dialog.value = true;
252
+ }
253
+ };
254
+
255
+ const onClear = (): void => {
256
+ emit("update:modelValue", null);
257
+ innerTimeLeft.value = 0;
258
+ innerTimeRight.value = 0;
259
+ innerDateRange.value = null;
260
+ };
261
+
262
+ const onSubmit = (): void => {
263
+ if (innerDateRange.value && Array.isArray(innerDateRange.value) && innerDateRange.value.length > 1) {
264
+ emit("update:modelValue", [innerDateRange.value[0] + innerTimeLeft.value, innerDateRange.value[1] + innerTimeRight.value]);
265
+ }
266
+ dialog.value = false;
267
+ };
268
+
269
+ return {
270
+ ColorEnum,
271
+ messages,
272
+ style,
273
+ dialog,
274
+ placeholder,
275
+ innerDateLeft,
276
+ innerTimeLeft,
277
+ innerDateRight,
278
+ innerTimeRight,
279
+ innerDateRange,
280
+ onClick,
281
+ onClear,
282
+ onSubmit
283
+ };
284
+ }
285
+ });
286
+ </script>
@@ -0,0 +1,103 @@
1
+ <template>
2
+ <v-dialog
3
+ transition="dialog-bottom-transition"
4
+ :width="width"
5
+ :modelValue="$props.modelValue"
6
+ @update:modelValue="$emit('update:modelValue', $event)"
7
+ v-bind="$attrs"
8
+ >
9
+ <FSCard
10
+ padding="24px"
11
+ gap="24px"
12
+ :width="width"
13
+ :class="classes"
14
+ :color="$props.color"
15
+ :border="!isExtraSmall"
16
+ >
17
+ <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
18
+ <slot :name="name" v-bind="slotData" />
19
+ </template>
20
+ </FSCard>
21
+ <FSButton
22
+ class="fs-dialog-close-button"
23
+ variant="icon"
24
+ icon="mdi-close"
25
+ :color="ColorEnum.Dark"
26
+ @click="$emit('update:modelValue', false)"
27
+ />
28
+ </v-dialog>
29
+ </template>
30
+
31
+ <script lang="ts">
32
+ import { computed, defineComponent, PropType } from "vue";
33
+
34
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
35
+ import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
36
+
37
+ import FSButton from "./FSButton.vue";
38
+ import FSCard from "./FSCard.vue";
39
+ import FSCol from "./FSCol.vue";
40
+
41
+ export default defineComponent({
42
+ name: "FSDialog",
43
+ components: {
44
+ FSButton,
45
+ FSCard,
46
+ FSCol
47
+ },
48
+ props: {
49
+ modelValue: {
50
+ type: Boolean,
51
+ required: false,
52
+ default: false
53
+ },
54
+ width: {
55
+ type: [String, Number],
56
+ required: false,
57
+ default: "auto"
58
+ },
59
+ color: {
60
+ type: String as PropType<ColorBase>,
61
+ required: false,
62
+ default: ColorEnum.Dark
63
+ },
64
+ cardClasses: {
65
+ type: [Array, String] as PropType<string[] | string>,
66
+ required: false,
67
+ default: null
68
+ }
69
+ },
70
+ emits: ["update:modelValue"],
71
+ setup(props) {
72
+ const { isExtraSmall } = useBreakpoints();
73
+
74
+ const classes = computed((): string[] => {
75
+ const innerClasses = ["fs-dialog"];
76
+ if (Array.isArray(props.cardClasses)) {
77
+ innerClasses.push(...props.cardClasses);
78
+ }
79
+ else {
80
+ innerClasses.push(props.cardClasses);
81
+ }
82
+ if (isExtraSmall.value) {
83
+ innerClasses.push("fs-dialog-mobile");
84
+ }
85
+ return innerClasses;
86
+ });
87
+
88
+ const width = computed((): string | number => {
89
+ if (isExtraSmall.value) {
90
+ return "100%";
91
+ }
92
+ return props.width;
93
+ });
94
+
95
+ return {
96
+ ColorEnum,
97
+ isExtraSmall,
98
+ classes,
99
+ width
100
+ };
101
+ }
102
+ });
103
+ </script>
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <div
3
+ class="fs-divider"
4
+ :style="style"
5
+ />
6
+ </template>
7
+
8
+ <script lang="ts">
9
+ import { computed, defineComponent } from "vue";
10
+
11
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
12
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
13
+ import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
14
+
15
+ export default defineComponent({
16
+ name: "FSDivider",
17
+ props: {
18
+ width: {
19
+ type: [String, Number],
20
+ required: false,
21
+ default: "100%"
22
+ }
23
+ },
24
+ setup(props) {
25
+ const lights = useColors().getColors(ColorEnum.Light);
26
+
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
+ }
32
+ });
33
+
34
+ return {
35
+ style
36
+ }
37
+ }
38
+ });
39
+ </script>
@@ -1,72 +1,62 @@
1
1
  <template>
2
- <div
3
- class="fs-fade-out"
4
- :style="style"
5
- fluid
6
- @scroll="onScroll"
7
- >
8
- <div class="fs-fade-out-top" />
9
- <FSCol height="fill">
10
- <slot />
11
- </FSCol>
12
- <div class="fs-fade-out-bottom" />
13
- </div>
2
+ <div
3
+ class="fs-fade-out"
4
+ :style="style"
5
+ @scroll="onScroll"
6
+ >
7
+ <div class="fs-fade-out-top" />
8
+ <slot />
9
+ <div class="fs-fade-out-bottom" />
10
+ </div>
14
11
  </template>
15
12
 
16
13
  <script lang="ts">
17
- import { defineComponent, PropType, Ref, ref, toRefs } from "vue";
14
+ import { defineComponent, Ref, ref } from "vue";
18
15
 
19
16
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
20
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
17
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
21
18
 
22
19
  import FSCol from "./FSCol.vue";
23
20
 
24
21
  export default defineComponent({
25
- name: "FSFadeOut",
26
- components: {
27
- FSCol
28
- },
29
- props: {
30
- maskHeight: {
31
- type: Number,
32
- required: false,
33
- default: 64
34
- },
35
- color: {
36
- type: String as PropType<ColorBase>,
37
- required: false,
38
- default: ColorBase.Background
39
- }
40
- },
41
- setup(props) {
42
- const { maskHeight, color } = toRefs(props);
43
-
44
- const colors = useColors().getColors(color.value);
45
-
46
- const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
47
- "--fs-fade-out-mask-color": colors.base,
48
- "--fs-fade-out-top-mask-height": "0px",
49
- "--fs-fade-out-bottom-mask-height": `${maskHeight.value}px`
50
- });
51
-
52
- const onScroll = ({ target }): void => {
53
- if (target.scrollHeight - target.scrollTop - target.clientHeight < 1) {
54
- style.value["--fs-fade-out-bottom-mask-height"] = "0px";
55
- } else {
56
- style.value["--fs-fade-out-bottom-mask-height"] = `${maskHeight.value}px`;
57
- }
58
- if (target.scrollTop === 0) {
59
- style.value["--fs-fade-out-top-mask-height"] = "0px";
60
- }
61
- else {
62
- style.value["--fs-fade-out-top-mask-height"] = `${maskHeight.value}px`;
63
- }
64
- }
65
-
66
- return {
67
- style,
68
- onScroll
69
- };
22
+ name: "FSFadeOut",
23
+ components: {
24
+ FSCol
25
+ },
26
+ props: {
27
+ maskHeight: {
28
+ type: Number,
29
+ required: false,
30
+ default: 64
31
+ }
32
+ },
33
+ setup(props) {
34
+ const backgrounds = useColors().getColors(ColorEnum.Background);
35
+
36
+ const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
37
+ "--fs-fade-out-mask-color" : backgrounds.base,
38
+ "--fs-fade-out-top-mask-height" : "0px",
39
+ "--fs-fade-out-bottom-mask-height": `${props.maskHeight}px`
40
+ });
41
+
42
+ const onScroll = ({ target }): void => {
43
+ if (target.scrollHeight - target.scrollTop - target.clientHeight < 1) {
44
+ style.value["--fs-fade-out-bottom-mask-height"] = "0px";
45
+ } else {
46
+ style.value["--fs-fade-out-bottom-mask-height"] = `${props.maskHeight}px`;
47
+ }
48
+ if (target.scrollTop === 0) {
49
+ style.value["--fs-fade-out-top-mask-height"] = "0px";
50
+ }
51
+ else {
52
+ style.value["--fs-fade-out-top-mask-height"] = `${props.maskHeight}px`;
53
+ }
70
54
  }
55
+
56
+ return {
57
+ style,
58
+ onScroll
59
+ };
60
+ }
71
61
  });
72
62
  </script>