@dative-gpi/foundation-shared-components 0.0.4 → 0.0.5
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/FSBreadcrumbs.vue +10 -7
- package/components/FSButton.vue +85 -27
- package/components/FSCheckbox.vue +21 -17
- package/components/FSCol.vue +56 -16
- package/components/FSFadeOut.vue +7 -2
- package/components/FSNumberField.vue +65 -0
- package/components/FSPasswordField.vue +108 -0
- package/components/FSRadio.vue +21 -17
- package/components/FSRadioGroup.vue +1 -1
- package/components/FSRow.vue +57 -17
- package/components/FSSlideGroup.vue +2 -2
- package/components/FSSpan.vue +2 -3
- package/components/FSSwitch.vue +22 -18
- package/components/FSTab.vue +32 -25
- package/components/FSTabs.vue +6 -5
- package/components/FSTag.vue +21 -18
- package/components/FSTextField.vue +64 -11
- package/components/FSWrapGroup.vue +2 -2
- package/composables/useColors.ts +7 -25
- package/defaults/FSButtons.ts +45 -15
- package/package.json +4 -4
- package/styles/components/fs_breadcrumbs.scss +23 -10
- package/styles/components/fs_button.scss +26 -0
- package/styles/components/fs_col.scss +87 -2
- package/styles/components/fs_icon.scss +4 -4
- package/styles/components/fs_password_field.scss +5 -0
- package/styles/components/fs_row.scss +86 -1
- package/styles/components/fs_span.scss +1 -1
- package/styles/components/fs_tabs.scss +0 -1
- package/styles/components/fs_text_field.scss +34 -16
- package/styles/components/index.scss +15 -14
- package/styles/globals/fixes.scss +5 -0
- package/styles/globals/index.scss +4 -1
- package/styles/globals/overrides.scss +13 -0
- package/styles/globals/text_fonts.scss +44 -24
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
{{ item.title }}
|
|
6
6
|
</FSSpan>
|
|
7
7
|
</template>
|
|
8
|
+
<template #divider>
|
|
9
|
+
<FSIcon class="fs-breadcrumbs-divider" size="m">
|
|
10
|
+
mdi-chevron-right
|
|
11
|
+
</FSIcon>
|
|
12
|
+
</template>
|
|
8
13
|
</v-breadcrumbs>
|
|
9
14
|
</template>
|
|
10
15
|
|
|
@@ -12,10 +17,10 @@
|
|
|
12
17
|
import { defineComponent, PropType } from "vue";
|
|
13
18
|
|
|
14
19
|
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
20
|
+
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
15
21
|
|
|
16
22
|
import FSSpan from "./FSSpan.vue";
|
|
17
23
|
import FSIcon from "./FSIcon.vue";
|
|
18
|
-
import FSRow from "./FSRow.vue";
|
|
19
24
|
|
|
20
25
|
export interface FSBreadcrumbItem {
|
|
21
26
|
href: string | undefined
|
|
@@ -30,8 +35,7 @@ export default defineComponent({
|
|
|
30
35
|
name: "FSBreadcrumbs",
|
|
31
36
|
components: {
|
|
32
37
|
FSSpan,
|
|
33
|
-
FSIcon
|
|
34
|
-
FSRow
|
|
38
|
+
FSIcon
|
|
35
39
|
},
|
|
36
40
|
props: {
|
|
37
41
|
items: {
|
|
@@ -40,17 +44,16 @@ export default defineComponent({
|
|
|
40
44
|
}
|
|
41
45
|
},
|
|
42
46
|
setup() {
|
|
43
|
-
const dark = useColors().
|
|
47
|
+
const dark = useColors().getVariants(ColorBase.Dark);
|
|
44
48
|
|
|
45
49
|
const style = {
|
|
46
50
|
"--fs-breadcrumbs-light-text": dark.light,
|
|
47
|
-
"--fs-breadcrumbs-base-text" : dark.base
|
|
48
|
-
"--fs-breadcrumbs-dark-text" : dark.dark
|
|
51
|
+
"--fs-breadcrumbs-base-text" : dark.base
|
|
49
52
|
};
|
|
50
53
|
|
|
51
54
|
const getClass = (item: FSBreadcrumbItem): string => {
|
|
52
55
|
if (item.disabled) {
|
|
53
|
-
return "fs-breadcrumbs-label--disabled";
|
|
56
|
+
return "fs-breadcrumbs-label fs-breadcrumbs-label--disabled";
|
|
54
57
|
}
|
|
55
58
|
return "fs-breadcrumbs-label";
|
|
56
59
|
};
|
package/components/FSButton.vue
CHANGED
|
@@ -1,25 +1,44 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-btn
|
|
3
|
-
|
|
3
|
+
v-if="!['icon'].includes($props.variant)"
|
|
4
4
|
:ripple="false"
|
|
5
5
|
:style="style"
|
|
6
|
+
:class="classes"
|
|
6
7
|
v-bind="$attrs"
|
|
7
8
|
>
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
<FSIcon v-if="
|
|
11
|
-
{{
|
|
9
|
+
<FSRow>
|
|
10
|
+
<slot name="prepend">
|
|
11
|
+
<FSIcon v-if="$props.prependIcon" size="m">
|
|
12
|
+
{{ $props.prependIcon }}
|
|
12
13
|
</FSIcon>
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
</slot>
|
|
15
|
+
<slot name="default">
|
|
16
|
+
<FSSpan v-if="$props.label" font="text-button">
|
|
17
|
+
{{ $props.label }}
|
|
15
18
|
</FSSpan>
|
|
16
|
-
</
|
|
17
|
-
|
|
19
|
+
</slot>
|
|
20
|
+
<slot name="append">
|
|
21
|
+
<FSIcon v-if="$props.appendIcon" size="m">
|
|
22
|
+
{{ $props.appendIcon }}
|
|
23
|
+
</FSIcon>
|
|
24
|
+
</slot>
|
|
25
|
+
</FSRow>
|
|
18
26
|
</v-btn>
|
|
27
|
+
<FSRow
|
|
28
|
+
v-else-if="$props.icon"
|
|
29
|
+
width="hug"
|
|
30
|
+
:style="style"
|
|
31
|
+
:class="classes"
|
|
32
|
+
v-bind="$attrs"
|
|
33
|
+
>
|
|
34
|
+
<FSIcon size="checkbox">
|
|
35
|
+
{{ $props.icon }}
|
|
36
|
+
</FSIcon>
|
|
37
|
+
</FSRow>
|
|
19
38
|
</template>
|
|
20
39
|
|
|
21
40
|
<script lang="ts">
|
|
22
|
-
import { computed, defineComponent, PropType, toRefs } from "vue";
|
|
41
|
+
import { computed, defineComponent, PropType, toRefs, useSlots } from "vue";
|
|
23
42
|
|
|
24
43
|
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
25
44
|
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
@@ -36,7 +55,7 @@ export default defineComponent({
|
|
|
36
55
|
FSRow
|
|
37
56
|
},
|
|
38
57
|
props: {
|
|
39
|
-
|
|
58
|
+
prependIcon: {
|
|
40
59
|
type: String,
|
|
41
60
|
required: false,
|
|
42
61
|
default: null
|
|
@@ -46,10 +65,20 @@ export default defineComponent({
|
|
|
46
65
|
required: false,
|
|
47
66
|
default: null
|
|
48
67
|
},
|
|
49
|
-
|
|
50
|
-
type:
|
|
68
|
+
appendIcon: {
|
|
69
|
+
type: String,
|
|
51
70
|
required: false,
|
|
52
|
-
default:
|
|
71
|
+
default: null
|
|
72
|
+
},
|
|
73
|
+
icon: {
|
|
74
|
+
type: String,
|
|
75
|
+
required: false,
|
|
76
|
+
default: null
|
|
77
|
+
},
|
|
78
|
+
variant: {
|
|
79
|
+
type: String as PropType<"standard" | "full" | "icon">,
|
|
80
|
+
required: false,
|
|
81
|
+
default: "standard"
|
|
53
82
|
},
|
|
54
83
|
color: {
|
|
55
84
|
type: String as PropType<ColorBase>,
|
|
@@ -58,24 +87,53 @@ export default defineComponent({
|
|
|
58
87
|
}
|
|
59
88
|
},
|
|
60
89
|
setup(props) {
|
|
61
|
-
const { label,
|
|
90
|
+
const { label, variant, color } = toRefs(props);
|
|
62
91
|
|
|
63
92
|
const colors = useColors().getVariants(color.value);
|
|
93
|
+
const slots = useSlots();
|
|
94
|
+
|
|
95
|
+
const isEmpty = computed(() => {
|
|
96
|
+
return !slots.default && !label.value;
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const style = computed(() => {
|
|
100
|
+
switch (variant.value) {
|
|
101
|
+
case "standard": return {
|
|
102
|
+
"--fs-button-padding" : !isEmpty.value ? "0 16px" : "0",
|
|
103
|
+
"--fs-button-light-color": colors.light,
|
|
104
|
+
"--fs-button-base-color" : colors.base,
|
|
105
|
+
"--fs-button-dark-color" : colors.dark,
|
|
106
|
+
"--fs-button-light-text" : colors.base,
|
|
107
|
+
"--fs-button-base-text" : colors.light,
|
|
108
|
+
"--fs-button-dark-text" : colors.light
|
|
109
|
+
};
|
|
110
|
+
case "full": return {
|
|
111
|
+
"--fs-button-padding" : !isEmpty.value ? "0 16px" : "0",
|
|
112
|
+
"--fs-button-light-color": colors.base,
|
|
113
|
+
"--fs-button-base-color" : colors.base,
|
|
114
|
+
"--fs-button-dark-color" : colors.dark,
|
|
115
|
+
"--fs-button-light-text" : colors.light,
|
|
116
|
+
"--fs-button-base-text" : colors.light,
|
|
117
|
+
"--fs-button-dark-text" : colors.light
|
|
118
|
+
|
|
119
|
+
};
|
|
120
|
+
case "icon": return {
|
|
121
|
+
"--fs-button-light-text" : colors.base,
|
|
122
|
+
"--fs-button-base-text" : colors.dark
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
});
|
|
64
126
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"--fs-button-base-text" : colors.light,
|
|
72
|
-
"--fs-button-dark-text" : colors.light
|
|
73
|
-
}));
|
|
127
|
+
const classes = computed(() => {
|
|
128
|
+
switch (variant.value) {
|
|
129
|
+
case "icon": return "fs-button-icon";
|
|
130
|
+
default: return "fs-button";
|
|
131
|
+
}
|
|
132
|
+
});
|
|
74
133
|
|
|
75
134
|
return {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
style
|
|
135
|
+
style,
|
|
136
|
+
classes
|
|
79
137
|
};
|
|
80
138
|
}
|
|
81
139
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FSCol width="hug"
|
|
3
|
-
<FSRow width="hug"
|
|
2
|
+
<FSCol width="hug">
|
|
3
|
+
<FSRow width="hug" align="center-left">
|
|
4
4
|
<FSIcon
|
|
5
5
|
class="fs-checkbox"
|
|
6
6
|
size="checkbox"
|
|
@@ -9,24 +9,28 @@
|
|
|
9
9
|
>
|
|
10
10
|
{{ icon }}
|
|
11
11
|
</FSIcon>
|
|
12
|
+
<slot name="default">
|
|
13
|
+
<FSSpan
|
|
14
|
+
v-if="$props.label"
|
|
15
|
+
class="fs-checkbox-label"
|
|
16
|
+
:style="style"
|
|
17
|
+
:font="font"
|
|
18
|
+
@click="onToggle"
|
|
19
|
+
>
|
|
20
|
+
{{ $props.label }}
|
|
21
|
+
</FSSpan>
|
|
22
|
+
</slot>
|
|
23
|
+
</FSRow>
|
|
24
|
+
<slot name="description">
|
|
12
25
|
<FSSpan
|
|
13
|
-
v-if="$props.
|
|
14
|
-
class="fs-checkbox-
|
|
26
|
+
v-if="$props.description"
|
|
27
|
+
class="fs-checkbox-description"
|
|
28
|
+
font="text-underline"
|
|
15
29
|
:style="style"
|
|
16
|
-
:font="font"
|
|
17
|
-
@click="onToggle"
|
|
18
30
|
>
|
|
19
|
-
{{ $props.
|
|
31
|
+
{{ $props.description }}
|
|
20
32
|
</FSSpan>
|
|
21
|
-
</
|
|
22
|
-
<FSSpan
|
|
23
|
-
v-if="$props.description"
|
|
24
|
-
class="fs-checkbox-description"
|
|
25
|
-
font="text-overline"
|
|
26
|
-
:style="style"
|
|
27
|
-
>
|
|
28
|
-
{{ $props.description }}
|
|
29
|
-
</FSSpan>
|
|
33
|
+
</slot>
|
|
30
34
|
</FSCol>
|
|
31
35
|
</template>
|
|
32
36
|
|
|
@@ -81,7 +85,7 @@ export default defineComponent({
|
|
|
81
85
|
const { value, color, editable } = toRefs(props);
|
|
82
86
|
|
|
83
87
|
const colors = useColors().getVariants(color.value);
|
|
84
|
-
const dark = useColors().
|
|
88
|
+
const dark = useColors().getVariants(ColorBase.Dark);
|
|
85
89
|
|
|
86
90
|
const style = computed(() => ({
|
|
87
91
|
"--fs-checkbox-cursor" : editable.value ? "pointer" : "default",
|
package/components/FSCol.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="fs-col"
|
|
4
3
|
:style="style"
|
|
4
|
+
:class="classes"
|
|
5
5
|
v-bind="$attrs"
|
|
6
6
|
>
|
|
7
7
|
<slot />
|
|
@@ -22,7 +22,12 @@ export default defineComponent({
|
|
|
22
22
|
height: {
|
|
23
23
|
type: String as PropType<"hug" | "fill" | string>,
|
|
24
24
|
required: false,
|
|
25
|
-
default: "
|
|
25
|
+
default: "hug"
|
|
26
|
+
},
|
|
27
|
+
align: {
|
|
28
|
+
type: String as PropType<"top-left" | "top-center" | "top-right" | "center-left" | "center-center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right">,
|
|
29
|
+
required: false,
|
|
30
|
+
default: "top-left"
|
|
26
31
|
},
|
|
27
32
|
gap: {
|
|
28
33
|
type: Number,
|
|
@@ -31,38 +36,73 @@ export default defineComponent({
|
|
|
31
36
|
}
|
|
32
37
|
},
|
|
33
38
|
setup(props) {
|
|
34
|
-
const { width, height, gap } = toRefs(props);
|
|
39
|
+
const { width, height, align, gap } = toRefs(props);
|
|
40
|
+
|
|
41
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => ({
|
|
42
|
+
"--fs-col-gap": `${gap.value}px`,
|
|
43
|
+
"--fs-col-width": width.value,
|
|
44
|
+
"--fs-col-height": height.value
|
|
45
|
+
}));
|
|
35
46
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
"--fs-col-gap": `${gap.value}px`
|
|
39
|
-
};
|
|
47
|
+
const classes = computed((): string => {
|
|
48
|
+
let classes = "fs-col";
|
|
40
49
|
switch (width.value) {
|
|
41
50
|
case "hug":
|
|
51
|
+
classes += " fs-col-width-hug";
|
|
42
52
|
break;
|
|
43
53
|
case "fill":
|
|
44
|
-
|
|
54
|
+
classes += " fs-col-width-fill";
|
|
45
55
|
break;
|
|
46
|
-
default:
|
|
47
|
-
|
|
56
|
+
default:
|
|
57
|
+
classes += " fs-col-width-fixed";
|
|
48
58
|
break;
|
|
49
59
|
}
|
|
50
60
|
switch (height.value) {
|
|
51
61
|
case "hug":
|
|
62
|
+
classes += " fs-col-height-hug";
|
|
52
63
|
break;
|
|
53
64
|
case "fill":
|
|
54
|
-
|
|
65
|
+
classes += " fs-col-height-fill";
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
classes += " fs-col-height-fixed";
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
switch (align.value) {
|
|
72
|
+
case "top-left":
|
|
73
|
+
classes += " fs-col-top-left";
|
|
74
|
+
break;
|
|
75
|
+
case "top-center":
|
|
76
|
+
classes += " fs-col-top-center";
|
|
77
|
+
break;
|
|
78
|
+
case "top-right":
|
|
79
|
+
classes += " fs-col-top-right";
|
|
80
|
+
break;
|
|
81
|
+
case "center-left":
|
|
82
|
+
classes += " fs-col-center-left";
|
|
83
|
+
break;
|
|
84
|
+
case "center-center":
|
|
85
|
+
classes += " fs-col-center-center";
|
|
86
|
+
break;
|
|
87
|
+
case "center-right":
|
|
88
|
+
classes += " fs-col-center-right";
|
|
89
|
+
break;
|
|
90
|
+
case "bottom-left":
|
|
91
|
+
classes += " fs-col-bottom-left";
|
|
92
|
+
break;
|
|
93
|
+
case "bottom-center":
|
|
94
|
+
classes += " fs-col-bottom-center";
|
|
55
95
|
break;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
style.flexShrink = "0";
|
|
96
|
+
case "bottom-right":
|
|
97
|
+
classes += " fs-col-bottom-right";
|
|
59
98
|
break;
|
|
60
99
|
}
|
|
61
|
-
return
|
|
100
|
+
return classes;
|
|
62
101
|
});
|
|
63
102
|
|
|
64
103
|
return {
|
|
65
|
-
style
|
|
104
|
+
style,
|
|
105
|
+
classes
|
|
66
106
|
};
|
|
67
107
|
}
|
|
68
108
|
});
|
package/components/FSFadeOut.vue
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
@scroll="onScroll"
|
|
7
7
|
>
|
|
8
8
|
<div class="fs-fade-out-top" />
|
|
9
|
-
<
|
|
9
|
+
<FSCol height="fill">
|
|
10
10
|
<slot />
|
|
11
|
-
</
|
|
11
|
+
</FSCol>
|
|
12
12
|
<div class="fs-fade-out-bottom" />
|
|
13
13
|
</div>
|
|
14
14
|
</template>
|
|
@@ -19,8 +19,13 @@ import { defineComponent, PropType, ref, toRefs } from "vue";
|
|
|
19
19
|
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
20
20
|
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
21
21
|
|
|
22
|
+
import FSCol from "./FSCol.vue";
|
|
23
|
+
|
|
22
24
|
export default defineComponent({
|
|
23
25
|
name: "FSFadeOut",
|
|
26
|
+
components: {
|
|
27
|
+
FSCol
|
|
28
|
+
},
|
|
24
29
|
props: {
|
|
25
30
|
maskHeight: {
|
|
26
31
|
type: Number,
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSTextField
|
|
3
|
+
type="number"
|
|
4
|
+
:label="$props.label"
|
|
5
|
+
:description="$props.description"
|
|
6
|
+
:color="$props.color"
|
|
7
|
+
:required="$props.required"
|
|
8
|
+
:editable="$props.editable"
|
|
9
|
+
:value="$props.value?.toString()"
|
|
10
|
+
@update:value="(value) => $emit('update:value', isNaN(parseFloat(value)) ? 0 : parseFloat(value))"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
>
|
|
13
|
+
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
14
|
+
<slot :name="name" v-bind="slotData" />
|
|
15
|
+
</template>
|
|
16
|
+
</FSTextField>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
import { defineComponent, PropType, toRefs } from "vue";
|
|
21
|
+
|
|
22
|
+
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
23
|
+
|
|
24
|
+
import FSTextField from "./FSTextField.vue";
|
|
25
|
+
|
|
26
|
+
export default defineComponent({
|
|
27
|
+
name: "FSNumberField",
|
|
28
|
+
components: {
|
|
29
|
+
FSTextField
|
|
30
|
+
},
|
|
31
|
+
props: {
|
|
32
|
+
label: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: false,
|
|
35
|
+
default: null
|
|
36
|
+
},
|
|
37
|
+
description: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: false,
|
|
40
|
+
default: null
|
|
41
|
+
},
|
|
42
|
+
value: {
|
|
43
|
+
type: Number,
|
|
44
|
+
required: false,
|
|
45
|
+
default: null
|
|
46
|
+
},
|
|
47
|
+
color: {
|
|
48
|
+
type: String as PropType<ColorBase>,
|
|
49
|
+
required: false,
|
|
50
|
+
default: ColorBase.Dark
|
|
51
|
+
},
|
|
52
|
+
required: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
required: false,
|
|
55
|
+
default: false
|
|
56
|
+
},
|
|
57
|
+
editable: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
required: false,
|
|
60
|
+
default: true
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
emits: ["update:value"]
|
|
64
|
+
});
|
|
65
|
+
</script>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSTextField
|
|
3
|
+
:label="$props.label"
|
|
4
|
+
:description="$props.description"
|
|
5
|
+
:type="type"
|
|
6
|
+
:color="$props.color"
|
|
7
|
+
:required="$props.required"
|
|
8
|
+
:editable="$props.editable"
|
|
9
|
+
:value="$props.value"
|
|
10
|
+
@update:value="(value) => $emit('update:value', value)"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
>
|
|
13
|
+
<template #append>
|
|
14
|
+
<FSIcon
|
|
15
|
+
class="fs-password-field-icon"
|
|
16
|
+
size="m"
|
|
17
|
+
:style="style"
|
|
18
|
+
@click="onToggle"
|
|
19
|
+
>
|
|
20
|
+
{{ icon }}
|
|
21
|
+
</FSIcon>
|
|
22
|
+
</template>
|
|
23
|
+
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
24
|
+
<slot :name="name" v-bind="slotData" />
|
|
25
|
+
</template>
|
|
26
|
+
</FSTextField>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
import { computed, defineComponent, PropType, ref, toRefs } from "vue";
|
|
31
|
+
|
|
32
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
33
|
+
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
34
|
+
|
|
35
|
+
import FSTextField from "./FSTextField.vue";
|
|
36
|
+
import FSIcon from "./FSIcon.vue";
|
|
37
|
+
|
|
38
|
+
export default defineComponent({
|
|
39
|
+
name: "FSPasswordField",
|
|
40
|
+
components: {
|
|
41
|
+
FSTextField,
|
|
42
|
+
FSIcon
|
|
43
|
+
},
|
|
44
|
+
props: {
|
|
45
|
+
label: {
|
|
46
|
+
type: String,
|
|
47
|
+
required: false,
|
|
48
|
+
default: null
|
|
49
|
+
},
|
|
50
|
+
description: {
|
|
51
|
+
type: String,
|
|
52
|
+
required: false,
|
|
53
|
+
default: null
|
|
54
|
+
},
|
|
55
|
+
value: {
|
|
56
|
+
type: String,
|
|
57
|
+
required: false,
|
|
58
|
+
default: null
|
|
59
|
+
},
|
|
60
|
+
color: {
|
|
61
|
+
type: String as PropType<ColorBase>,
|
|
62
|
+
required: false,
|
|
63
|
+
default: ColorBase.Dark
|
|
64
|
+
},
|
|
65
|
+
required: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
required: false,
|
|
68
|
+
default: false
|
|
69
|
+
},
|
|
70
|
+
editable: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
required: false,
|
|
73
|
+
default: true
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
emits: ["update:value"],
|
|
77
|
+
setup(props) {
|
|
78
|
+
const { editable } = toRefs(props);
|
|
79
|
+
|
|
80
|
+
const stars = ref(true);
|
|
81
|
+
|
|
82
|
+
const type = computed(() => stars.value ? "password" : "text");
|
|
83
|
+
|
|
84
|
+
const icon = computed(() => stars.value ? "mdi-eye-off-outline" : "mdi-eye-outline");
|
|
85
|
+
|
|
86
|
+
const dark = useColors().getVariants(ColorBase.Dark);
|
|
87
|
+
|
|
88
|
+
const style = computed(() => ({
|
|
89
|
+
"--fs-password-field-cursor" : editable.value ? "pointer" : "default",
|
|
90
|
+
"--fs-password-field-base-text": editable.value ? dark.base : dark.light
|
|
91
|
+
}));
|
|
92
|
+
|
|
93
|
+
const onToggle = () => {
|
|
94
|
+
if (!editable.value) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
stars.value = !stars.value;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
type,
|
|
102
|
+
icon,
|
|
103
|
+
style,
|
|
104
|
+
onToggle
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
</script>
|
package/components/FSRadio.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FSCol width="hug"
|
|
3
|
-
<FSRow width="hug"
|
|
2
|
+
<FSCol width="hug">
|
|
3
|
+
<FSRow width="hug" align="center-left">
|
|
4
4
|
<FSIcon
|
|
5
5
|
class="fs-radio"
|
|
6
6
|
size="checkbox"
|
|
@@ -9,24 +9,28 @@
|
|
|
9
9
|
>
|
|
10
10
|
{{ icon }}
|
|
11
11
|
</FSIcon>
|
|
12
|
+
<slot name="default">
|
|
13
|
+
<FSSpan
|
|
14
|
+
v-if="$props.label"
|
|
15
|
+
class="fs-radio-label"
|
|
16
|
+
:style="style"
|
|
17
|
+
:font="font"
|
|
18
|
+
@click="onToggle"
|
|
19
|
+
>
|
|
20
|
+
{{ $props.label }}
|
|
21
|
+
</FSSpan>
|
|
22
|
+
</slot>
|
|
23
|
+
</FSRow>
|
|
24
|
+
<slot name="description">
|
|
12
25
|
<FSSpan
|
|
13
|
-
v-if="$props.
|
|
14
|
-
class="fs-radio-
|
|
26
|
+
v-if="$props.description"
|
|
27
|
+
class="fs-radio-description"
|
|
28
|
+
font="text-underline"
|
|
15
29
|
:style="style"
|
|
16
|
-
:font="font"
|
|
17
|
-
@click="onToggle"
|
|
18
30
|
>
|
|
19
|
-
{{ $props.
|
|
31
|
+
{{ $props.description }}
|
|
20
32
|
</FSSpan>
|
|
21
|
-
</
|
|
22
|
-
<FSSpan
|
|
23
|
-
v-if="$props.description"
|
|
24
|
-
class="fs-radio-description"
|
|
25
|
-
font="text-overline"
|
|
26
|
-
:style="style"
|
|
27
|
-
>
|
|
28
|
-
{{ $props.description }}
|
|
29
|
-
</FSSpan>
|
|
33
|
+
</slot>
|
|
30
34
|
</FSCol>
|
|
31
35
|
</template>
|
|
32
36
|
|
|
@@ -85,7 +89,7 @@ export default defineComponent({
|
|
|
85
89
|
const { value, selected, color, editable } = toRefs(props);
|
|
86
90
|
|
|
87
91
|
const colors = useColors().getVariants(color.value);
|
|
88
|
-
const dark = useColors().
|
|
92
|
+
const dark = useColors().getVariants(ColorBase.Dark);
|
|
89
93
|
|
|
90
94
|
const style = computed(() => ({
|
|
91
95
|
"--fs-radio-cursor": (editable.value && !selected.value) ? "pointer" : "default",
|