@dative-gpi/foundation-shared-components 0.0.27 → 0.0.28

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.
@@ -11,23 +11,28 @@
11
11
  </template>
12
12
 
13
13
  <script lang="ts">
14
- import { defineComponent, Ref, ref } from "vue";
14
+ import { computed, defineComponent, PropType, ref } from "vue";
15
15
 
16
16
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
17
17
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
18
-
19
- import FSCol from "./FSCol.vue";
18
+ import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
20
19
 
21
20
  export default defineComponent({
22
21
  name: "FSFadeOut",
23
- components: {
24
- FSCol
25
- },
26
22
  props: {
23
+ height: {
24
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number>,
25
+ required: true
26
+ },
27
+ padding: {
28
+ type: [String, Number],
29
+ required: false,
30
+ default: "0"
31
+ },
27
32
  maskHeight: {
28
- type: Number,
33
+ type: [String, Number],
29
34
  required: false,
30
- default: 64
35
+ default: "64px"
31
36
  }
32
37
  },
33
38
  setup(props) {
@@ -35,23 +40,59 @@ export default defineComponent({
35
40
 
36
41
  const backgrounds = getColors(ColorEnum.Background);
37
42
 
38
- const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
39
- "--fs-fade-out-mask-color" : backgrounds.base,
40
- "--fs-fade-out-top-mask-height" : "0px",
41
- "--fs-fade-out-bottom-mask-height": `${props.maskHeight}px`
43
+ const topMaskHeight = ref("0px");
44
+ const bottomMaskHeight = ref(sizeToVar(props.maskHeight));
45
+
46
+ const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
47
+ return {
48
+ "--fs-fade-out-height" : sizeToVar(props.height),
49
+ "--fs-fade-out-padding" : sizeToVar(props.padding),
50
+ "--fs-fade-out-mask-color" : backgrounds.base,
51
+ "--fs-fade-out-top-mask-height" : topMaskHeight.value,
52
+ "--fs-fade-out-top-mask-top" : topPadding.value,
53
+ "--fs-fade-out-bottom-mask-height": bottomMaskHeight.value,
54
+ "--fs-fade-out-bottom-mask-bottom": bottomPadding.value
55
+ };
56
+ });
57
+
58
+ const topPadding = computed((): string => {
59
+ switch (typeof props.padding) {
60
+ case "number": return sizeToVar(props.padding);
61
+ default:
62
+ const paddings = props.padding.split(" ");
63
+ switch (paddings.length) {
64
+ case 0 : return "0px";
65
+ default: return "-" + sizeToVar(paddings[0]);
66
+ }
67
+ }
68
+ });
69
+
70
+ const bottomPadding = computed((): string => {
71
+ switch (typeof props.padding) {
72
+ case "number": return sizeToVar(props.padding);
73
+ default:
74
+ const paddings = props.padding.split(" ");
75
+ switch (paddings.length) {
76
+ case 0 : return "0px";
77
+ case 1 :
78
+ case 2 : return "-" + sizeToVar(paddings[0]);
79
+ default: return "-" + sizeToVar(paddings[2]);
80
+ }
81
+ }
42
82
  });
43
83
 
44
84
  const onScroll = ({ target }): void => {
45
85
  if (target.scrollHeight - target.scrollTop - target.clientHeight < 1) {
46
- style.value["--fs-fade-out-bottom-mask-height"] = "0px";
47
- } else {
48
- style.value["--fs-fade-out-bottom-mask-height"] = `${props.maskHeight}px`;
86
+ bottomMaskHeight.value = "0px";
87
+ }
88
+ else {
89
+ bottomMaskHeight.value = sizeToVar(props.maskHeight);
49
90
  }
50
91
  if (target.scrollTop === 0) {
51
- style.value["--fs-fade-out-top-mask-height"] = "0px";
92
+ topMaskHeight.value = "0px";
52
93
  }
53
94
  else {
54
- style.value["--fs-fade-out-top-mask-height"] = `${props.maskHeight}px`;
95
+ topMaskHeight.value = sizeToVar(props.maskHeight);
55
96
  }
56
97
  }
57
98
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-components",
3
3
  "sideEffects": false,
4
- "version": "0.0.27",
4
+ "version": "0.0.28",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,8 +10,8 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-shared-domain": "0.0.27",
14
- "@dative-gpi/foundation-shared-services": "0.0.27",
13
+ "@dative-gpi/foundation-shared-domain": "0.0.28",
14
+ "@dative-gpi/foundation-shared-services": "0.0.28",
15
15
  "@fontsource/montserrat": "^5.0.16",
16
16
  "@lexical/clipboard": "^0.12.5",
17
17
  "@lexical/history": "^0.12.5",
@@ -32,5 +32,5 @@
32
32
  "sass": "^1.69.5",
33
33
  "sass-loader": "^13.3.2"
34
34
  },
35
- "gitHead": "b46c226b198f482eee4ca6e63ef2923522bf6e8c"
35
+ "gitHead": "45b9e0404609c0003f918d847f47b5395152df2a"
36
36
  }
@@ -1,6 +1,8 @@
1
1
  .fs-fade-out {
2
2
  @extend .fs-hide-y-scrollbar;
3
3
 
4
+ padding: var(--fs-fade-out-padding);
5
+ height: var(--fs-fade-out-height);
4
6
  flex-direction: column;
5
7
  position: relative;
6
8
  display: flex;
@@ -14,8 +16,7 @@
14
16
  height: var(--fs-fade-out-top-mask-height);
15
17
  min-height: var(--fs-fade-out-top-mask-height);
16
18
  width: 100%;
17
- top: 0;
18
- left: 0;
19
+ top: var(--fs-fade-out-top-mask-top);
19
20
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
20
21
  background: linear-gradient(to top, transparent 0, var(--fs-fade-out-mask-color) var(--fs-fade-out-top-mask-height));
21
22
  }
@@ -28,8 +29,7 @@
28
29
  height: var(--fs-fade-out-bottom-mask-height);
29
30
  min-height: var(--fs-fade-out-bottom-mask-height);
30
31
  width: 100%;
31
- bottom: 0;
32
- left: 0;
32
+ bottom: var(--fs-fade-out-bottom-mask-bottom);
33
33
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
34
34
  background: linear-gradient(to bottom, transparent 0, var(--fs-fade-out-mask-color) var(--fs-fade-out-bottom-mask-height));
35
35
  }