@dative-gpi/foundation-shared-components 0.0.29 → 0.0.31
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.
- package/components/FSButton.vue +53 -14
- package/components/FSClickable.vue +37 -2
- package/components/FSLoader.vue +35 -24
- package/composables/useBreakpoints.ts +6 -2
- package/package.json +4 -4
- package/styles/components/fs_button.scss +1 -1
- package/styles/components/fs_clickable.scss +34 -1
- package/styles/components/fs_loader.scss +2 -0
package/components/FSButton.vue
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
:height="['40px', '36px']"
|
|
7
7
|
:variant="$props.variant"
|
|
8
8
|
:color="$props.color"
|
|
9
|
+
:load="$props.load"
|
|
9
10
|
:padding="padding"
|
|
10
11
|
:style="style"
|
|
11
12
|
:width="width"
|
|
13
|
+
@click="$emit('click')"
|
|
12
14
|
v-bind="$attrs"
|
|
13
15
|
>
|
|
14
16
|
<FSRow
|
|
@@ -42,24 +44,37 @@
|
|
|
42
44
|
</FSRow>
|
|
43
45
|
</FSClickable>
|
|
44
46
|
<FSRow
|
|
45
|
-
v-else
|
|
47
|
+
v-else
|
|
46
48
|
align="center-center"
|
|
47
49
|
width="hug"
|
|
48
50
|
:class="iconClasses"
|
|
49
51
|
:style="style"
|
|
52
|
+
@click.stop="onClick"
|
|
50
53
|
v-bind="$attrs"
|
|
51
54
|
>
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
>
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
<template v-if="$props.load">
|
|
56
|
+
<v-progress-circular
|
|
57
|
+
class="fs-button-load"
|
|
58
|
+
width="2"
|
|
59
|
+
size="20"
|
|
60
|
+
:indeterminate="true"
|
|
61
|
+
:color="loadColor"
|
|
62
|
+
/>
|
|
63
|
+
</template>
|
|
64
|
+
<template v-else>
|
|
65
|
+
<FSIcon
|
|
66
|
+
v-if="$props.icon"
|
|
67
|
+
size="l"
|
|
68
|
+
>
|
|
69
|
+
{{ $props.icon }}
|
|
70
|
+
</FSIcon>
|
|
71
|
+
<FSSpan
|
|
72
|
+
v-if="$props.label"
|
|
73
|
+
font="text-overline"
|
|
74
|
+
>
|
|
75
|
+
{{ $props.label }}
|
|
76
|
+
</FSSpan>
|
|
77
|
+
</template>
|
|
63
78
|
</FSRow>
|
|
64
79
|
</template>
|
|
65
80
|
|
|
@@ -118,13 +133,19 @@ export default defineComponent({
|
|
|
118
133
|
required: false,
|
|
119
134
|
default: false
|
|
120
135
|
},
|
|
136
|
+
load: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
required: false,
|
|
139
|
+
default: false
|
|
140
|
+
},
|
|
121
141
|
editable: {
|
|
122
142
|
type: Boolean,
|
|
123
143
|
required: false,
|
|
124
144
|
default: true
|
|
125
145
|
}
|
|
126
146
|
},
|
|
127
|
-
|
|
147
|
+
emits: ["click"],
|
|
148
|
+
setup(props, { emit }) {
|
|
128
149
|
const { getColors } = useColors();
|
|
129
150
|
const { slots } = useSlots();
|
|
130
151
|
|
|
@@ -163,6 +184,16 @@ export default defineComponent({
|
|
|
163
184
|
return classNames;
|
|
164
185
|
});
|
|
165
186
|
|
|
187
|
+
const loadColor = computed((): string => {
|
|
188
|
+
switch (props.color) {
|
|
189
|
+
case ColorEnum.Primary:
|
|
190
|
+
case ColorEnum.Success:
|
|
191
|
+
case ColorEnum.Warning:
|
|
192
|
+
case ColorEnum.Error : return ["standard"].includes(props.variant) ? colors.value.dark : colors.value.light;
|
|
193
|
+
default : return ["standard"].includes(props.variant) ? darks.dark : darks.light;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
|
|
166
197
|
const padding = computed((): string | number => {
|
|
167
198
|
switch (props.variant) {
|
|
168
199
|
case "standard":
|
|
@@ -178,12 +209,20 @@ export default defineComponent({
|
|
|
178
209
|
return "fit-content";
|
|
179
210
|
});
|
|
180
211
|
|
|
212
|
+
const onClick = () => {
|
|
213
|
+
if (props.editable && !props.load) {
|
|
214
|
+
emit("click");
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
|
|
181
218
|
return {
|
|
182
219
|
iconClasses,
|
|
220
|
+
loadColor,
|
|
183
221
|
padding,
|
|
184
222
|
colors,
|
|
185
223
|
style,
|
|
186
|
-
width
|
|
224
|
+
width,
|
|
225
|
+
onClick
|
|
187
226
|
};
|
|
188
227
|
}
|
|
189
228
|
});
|
|
@@ -15,6 +15,15 @@
|
|
|
15
15
|
<slot :name="name" v-bind="slotData" />
|
|
16
16
|
</template>
|
|
17
17
|
</FSCard>
|
|
18
|
+
<template v-if="$props.load">
|
|
19
|
+
<v-progress-circular
|
|
20
|
+
class="fs-clickable-load"
|
|
21
|
+
width="2"
|
|
22
|
+
size="24"
|
|
23
|
+
:indeterminate="true"
|
|
24
|
+
:color="loadColor"
|
|
25
|
+
/>
|
|
26
|
+
</template>
|
|
18
27
|
</button>
|
|
19
28
|
<a
|
|
20
29
|
v-else
|
|
@@ -31,6 +40,15 @@
|
|
|
31
40
|
<slot :name="name" v-bind="slotData" />
|
|
32
41
|
</template>
|
|
33
42
|
</FSCard>
|
|
43
|
+
<template v-if="$props.load">
|
|
44
|
+
<v-progress-circular
|
|
45
|
+
class="fs-clickable-load"
|
|
46
|
+
width="2"
|
|
47
|
+
size="24"
|
|
48
|
+
:indeterminate="true"
|
|
49
|
+
:color="loadColor"
|
|
50
|
+
/>
|
|
51
|
+
</template>
|
|
34
52
|
</a>
|
|
35
53
|
</template>
|
|
36
54
|
|
|
@@ -85,6 +103,11 @@ export default defineComponent({
|
|
|
85
103
|
required: false,
|
|
86
104
|
default: false
|
|
87
105
|
},
|
|
106
|
+
load: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
required: false,
|
|
109
|
+
default: false
|
|
110
|
+
},
|
|
88
111
|
editable: {
|
|
89
112
|
type: Boolean,
|
|
90
113
|
required: false,
|
|
@@ -99,6 +122,7 @@ export default defineComponent({
|
|
|
99
122
|
const textColors = computed(() => getContrasts(props.color));
|
|
100
123
|
const colors = computed(() => getColors(props.color));
|
|
101
124
|
const lights = getColors(ColorEnum.Light);
|
|
125
|
+
const darks = getColors(ColorEnum.Dark);
|
|
102
126
|
|
|
103
127
|
const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
|
|
104
128
|
if (!props.editable) {
|
|
@@ -157,7 +181,7 @@ export default defineComponent({
|
|
|
157
181
|
});
|
|
158
182
|
|
|
159
183
|
const href = computed((): string | null => {
|
|
160
|
-
if (!props.to) {
|
|
184
|
+
if (!props.to || !props.editable || props.load) {
|
|
161
185
|
return null;
|
|
162
186
|
}
|
|
163
187
|
if (typeof props.to === "string") {
|
|
@@ -168,14 +192,25 @@ export default defineComponent({
|
|
|
168
192
|
}
|
|
169
193
|
});
|
|
170
194
|
|
|
195
|
+
const loadColor = computed((): string => {
|
|
196
|
+
switch (props.color) {
|
|
197
|
+
case ColorEnum.Primary:
|
|
198
|
+
case ColorEnum.Success:
|
|
199
|
+
case ColorEnum.Warning:
|
|
200
|
+
case ColorEnum.Error : return ["standard"].includes(props.variant) ? colors.value.dark : colors.value.light;
|
|
201
|
+
default : return ["standard"].includes(props.variant) ? darks.dark : darks.light;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
171
205
|
const onClick = () => {
|
|
172
|
-
if (props.editable) {
|
|
206
|
+
if (!props.to && props.editable && !props.load) {
|
|
173
207
|
emit("click");
|
|
174
208
|
}
|
|
175
209
|
};
|
|
176
210
|
|
|
177
211
|
return {
|
|
178
212
|
wrapperClasses,
|
|
213
|
+
loadColor,
|
|
179
214
|
classes,
|
|
180
215
|
style,
|
|
181
216
|
href,
|
package/components/FSLoader.vue
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
<script lang="ts">
|
|
10
10
|
import { computed, defineComponent, PropType } from "vue";
|
|
11
11
|
|
|
12
|
-
import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
|
|
12
|
+
import { useBreakpoints, useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
13
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
13
14
|
import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
|
|
14
15
|
|
|
15
16
|
export default defineComponent({
|
|
@@ -25,6 +26,11 @@ export default defineComponent({
|
|
|
25
26
|
required: false,
|
|
26
27
|
default: null
|
|
27
28
|
},
|
|
29
|
+
padding: {
|
|
30
|
+
type: [String, Number],
|
|
31
|
+
required: false,
|
|
32
|
+
default: "0"
|
|
33
|
+
},
|
|
28
34
|
borderRadius: {
|
|
29
35
|
type: [String, Number],
|
|
30
36
|
required: false,
|
|
@@ -38,29 +44,34 @@ export default defineComponent({
|
|
|
38
44
|
},
|
|
39
45
|
setup(props) {
|
|
40
46
|
const { isMobileSized } = useBreakpoints();
|
|
47
|
+
const { getColors } = useColors();
|
|
48
|
+
|
|
49
|
+
const backgrounds = getColors(ColorEnum.Background);
|
|
41
50
|
|
|
42
51
|
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
43
52
|
return {
|
|
44
|
-
"--fs-loader-
|
|
45
|
-
"--fs-loader-
|
|
46
|
-
"--fs-loader-
|
|
53
|
+
"--fs-loader-background-color": backgrounds.base,
|
|
54
|
+
"--fs-loader-border-radius" : ["chip"].includes(props.variant) ? "50px" : sizeToVar(props.borderRadius),
|
|
55
|
+
"--fs-loader-padding" : sizeToVar(props.padding),
|
|
56
|
+
"--fs-loader-height" : sizeToVar(getHeight.value),
|
|
57
|
+
"--fs-loader-width" : sizeToVar(getWidth.value)
|
|
47
58
|
};
|
|
48
59
|
});
|
|
49
60
|
|
|
50
61
|
const getHeight = computed((): string | number => {
|
|
51
62
|
switch (props.variant) {
|
|
52
|
-
case "standard":
|
|
53
|
-
case "button":
|
|
54
|
-
case "input":
|
|
55
|
-
case "field":
|
|
56
|
-
case "chip":
|
|
57
|
-
case "text-h1":
|
|
58
|
-
case "text-h2":
|
|
59
|
-
case "text-h3":
|
|
60
|
-
case "text-h4":
|
|
61
|
-
case "text-body":
|
|
62
|
-
case "text-button":
|
|
63
|
-
case "text-overline":
|
|
63
|
+
case "standard" : return sizeToVar(props.height);
|
|
64
|
+
case "button" :
|
|
65
|
+
case "input" :
|
|
66
|
+
case "field" : return isMobileSized.value ? "36px" : "40px";
|
|
67
|
+
case "chip" : return isMobileSized.value ? "20px" : "24px";
|
|
68
|
+
case "text-h1" : return isMobileSized.value ? "32px" : "40px";
|
|
69
|
+
case "text-h2" : return isMobileSized.value ? "24px" : "32px";
|
|
70
|
+
case "text-h3" : return isMobileSized.value ? "20px" : "24px";
|
|
71
|
+
case "text-h4" : return isMobileSized.value ? "16px" : "20px";
|
|
72
|
+
case "text-body" :
|
|
73
|
+
case "text-button" : return isMobileSized.value ? "14px" : "16px";
|
|
74
|
+
case "text-overline" :
|
|
64
75
|
case "text-underline": return "16px";
|
|
65
76
|
}
|
|
66
77
|
});
|
|
@@ -68,14 +79,14 @@ export default defineComponent({
|
|
|
68
79
|
const getWidth = computed((): string | number => {
|
|
69
80
|
switch (props.variant) {
|
|
70
81
|
case "standard": return sizeToVar(props.width);
|
|
71
|
-
case "button":
|
|
72
|
-
case "input":
|
|
73
|
-
case "field":
|
|
74
|
-
case "chip":
|
|
75
|
-
case "text-h1":
|
|
76
|
-
case "text-h2":
|
|
77
|
-
case "text-h3":
|
|
78
|
-
default:
|
|
82
|
+
case "button" : return isMobileSized ? "36px" : "40px";
|
|
83
|
+
case "input" : return isMobileSized ? "calc(50% - 124px)" : "calc(50% - 132px)";
|
|
84
|
+
case "field" : return "100%";
|
|
85
|
+
case "chip" : return "8vw";
|
|
86
|
+
case "text-h1" : return "calc(50% - 32px)";
|
|
87
|
+
case "text-h2" : return "calc(60% - 32px)";
|
|
88
|
+
case "text-h3" : return "calc(65% - 32px)";
|
|
89
|
+
default : return "calc(75% - 32px)";
|
|
79
90
|
}
|
|
80
91
|
});
|
|
81
92
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { computed,
|
|
1
|
+
import { computed, ref } from "vue";
|
|
2
2
|
|
|
3
3
|
let initialized = false;
|
|
4
4
|
|
|
5
5
|
export const useBreakpoints = () => {
|
|
6
|
+
const windowHeight = ref(window.innerHeight);
|
|
6
7
|
const windowWidth = ref(window.innerWidth);
|
|
7
8
|
|
|
8
9
|
const onSizeChange = (): void => {
|
|
10
|
+
windowHeight.value = window.innerHeight;
|
|
9
11
|
windowWidth.value = window.innerWidth;
|
|
10
12
|
};
|
|
11
13
|
|
|
@@ -29,6 +31,8 @@ export const useBreakpoints = () => {
|
|
|
29
31
|
return {
|
|
30
32
|
isTouchScreenEnabled,
|
|
31
33
|
isMobileSized,
|
|
32
|
-
isExtraSmall
|
|
34
|
+
isExtraSmall,
|
|
35
|
+
windowHeight,
|
|
36
|
+
windowWidth
|
|
33
37
|
};
|
|
34
38
|
}
|
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.
|
|
4
|
+
"version": "0.0.31",
|
|
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.
|
|
14
|
-
"@dative-gpi/foundation-shared-services": "0.0.
|
|
13
|
+
"@dative-gpi/foundation-shared-domain": "0.0.31",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "0.0.31",
|
|
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": "
|
|
35
|
+
"gitHead": "8bbb2596550d62f527c9f288316335094a788efc"
|
|
36
36
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
transition: color 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
|
3
3
|
color: var(--fs-button-color) !important;
|
|
4
4
|
|
|
5
|
-
&:not(.fs-button-disabled):hover {
|
|
5
|
+
&:not(.fs-button-disabled, :has(.fs-button-load)):hover {
|
|
6
6
|
color: var(--fs-button-hover-color) !important;
|
|
7
7
|
cursor: pointer !important;
|
|
8
8
|
}
|
|
@@ -28,8 +28,41 @@
|
|
|
28
28
|
a:has(.fs-clickable) {
|
|
29
29
|
text-decoration: none;
|
|
30
30
|
padding: 0 !important;
|
|
31
|
+
position: relative !important;
|
|
32
|
+
width: fit-content;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
button:has(.fs-clickable) {
|
|
36
|
+
position: relative !important;
|
|
37
|
+
width: fit-content;
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
.fs-clickable-wrapper-full-width {
|
|
34
|
-
width: 100
|
|
41
|
+
width: 100% !important;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.fs-clickable-load {
|
|
45
|
+
cursor: default;
|
|
46
|
+
position: absolute !important;
|
|
47
|
+
width: 100% !important;
|
|
48
|
+
left: 0;
|
|
49
|
+
top: 0;
|
|
50
|
+
|
|
51
|
+
@include web {
|
|
52
|
+
height: 40px !important;
|
|
53
|
+
padding: 8px 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@include mobile {
|
|
57
|
+
height: 36px !important;
|
|
58
|
+
padding: 6px 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
& > svg {
|
|
62
|
+
height: 24px !important;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
*:has(~ .fs-clickable-load) > * {
|
|
67
|
+
opacity: 0;
|
|
35
68
|
}
|