@dative-gpi/foundation-shared-components 0.0.2
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 +64 -0
- package/components/FSButton.vue +82 -0
- package/components/FSCheckbox.vue +111 -0
- package/components/FSCol.vue +69 -0
- package/components/FSFadeOut.vue +67 -0
- package/components/FSIcon.vue +30 -0
- package/components/FSRadio.vue +118 -0
- package/components/FSRadioGroup.vue +75 -0
- package/components/FSRow.vue +75 -0
- package/components/FSSlideGroup.vue +57 -0
- package/components/FSSpan.vue +24 -0
- package/components/FSSwitch.vue +112 -0
- package/components/FSTab.vue +65 -0
- package/components/FSTabs.vue +60 -0
- package/components/FSTag.vue +85 -0
- package/components/FSTextField.vue +60 -0
- package/components/FSWindow.vue +26 -0
- package/components/FSWrapGroup.vue +56 -0
- package/composables/index.ts +2 -0
- package/composables/useColors.ts +64 -0
- package/composables/useTouch.ts +9 -0
- package/defaults/FSButtons.ts +63 -0
- package/importMap.json +59 -0
- package/importsGenerator.py +39 -0
- package/package.json +23 -0
- package/plugins/colorPlugin.ts +13 -0
- package/plugins/index.ts +1 -0
- package/shims-plugin.d.ts +9 -0
- package/styles/components/fs_breadcrumbs.scss +28 -0
- package/styles/components/fs_button.scss +28 -0
- package/styles/components/fs_checkbox.scss +15 -0
- package/styles/components/fs_col.scss +6 -0
- package/styles/components/fs_fade_out.scss +27 -0
- package/styles/components/fs_icon.scss +17 -0
- package/styles/components/fs_radio.scss +15 -0
- package/styles/components/fs_row.scss +6 -0
- package/styles/components/fs_span.scss +8 -0
- package/styles/components/fs_switch.scss +51 -0
- package/styles/components/fs_tabs.scss +63 -0
- package/styles/components/fs_tag.scss +45 -0
- package/styles/components/fs_text_field.scss +24 -0
- package/styles/components/fs_wrap_group.scss +12 -0
- package/styles/components/index.scss +14 -0
- package/styles/globals/breakpoints.scss +13 -0
- package/styles/globals/index.scss +6 -0
- package/styles/globals/overrides.scss +41 -0
- package/styles/globals/scrollbars.scss +45 -0
- package/styles/globals/text_fonts.scss +110 -0
- package/styles/globals/touchscreen.scss +11 -0
- package/styles/main.scss +3 -0
- package/themes/default.ts +24 -0
- package/themes/index.ts +1 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-breadcrumbs v-bind="$attrs" :style="style" :items="$props.items">
|
|
3
|
+
<template #title="{ item }">
|
|
4
|
+
<FSSpan :class="getClass(item)">
|
|
5
|
+
{{ item.title }}
|
|
6
|
+
</FSSpan>
|
|
7
|
+
</template>
|
|
8
|
+
</v-breadcrumbs>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { defineComponent, PropType } from "vue";
|
|
13
|
+
|
|
14
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
15
|
+
|
|
16
|
+
import FSSpan from "./FSSpan.vue";
|
|
17
|
+
import FSIcon from "./FSIcon.vue";
|
|
18
|
+
import FSRow from "./FSRow.vue";
|
|
19
|
+
|
|
20
|
+
export interface FSBreadcrumbItem {
|
|
21
|
+
href: string | undefined
|
|
22
|
+
replace: boolean | undefined
|
|
23
|
+
to: string | undefined
|
|
24
|
+
exact: boolean | undefined,
|
|
25
|
+
title: string,
|
|
26
|
+
disabled: boolean
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default defineComponent({
|
|
30
|
+
name: "FSBreadcrumbs",
|
|
31
|
+
components: {
|
|
32
|
+
FSSpan,
|
|
33
|
+
FSIcon,
|
|
34
|
+
FSRow
|
|
35
|
+
},
|
|
36
|
+
props: {
|
|
37
|
+
items: {
|
|
38
|
+
type: Array as PropType<Array<FSBreadcrumbItem>>,
|
|
39
|
+
required: true,
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
setup() {
|
|
43
|
+
const dark = useColors().getDark();
|
|
44
|
+
|
|
45
|
+
const style = {
|
|
46
|
+
"--fs-breadcrumbs-light-text": dark.light,
|
|
47
|
+
"--fs-breadcrumbs-base-text" : dark.base,
|
|
48
|
+
"--fs-breadcrumbs-dark-text" : dark.dark
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const getClass = (item: FSBreadcrumbItem): string => {
|
|
52
|
+
if (item.disabled) {
|
|
53
|
+
return "fs-breadcrumbs-label--disabled";
|
|
54
|
+
}
|
|
55
|
+
return "fs-breadcrumbs-label";
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
style,
|
|
60
|
+
getClass
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
</script>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-btn
|
|
3
|
+
class="fs-button"
|
|
4
|
+
:ripple="false"
|
|
5
|
+
:style="style"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
>
|
|
8
|
+
<slot>
|
|
9
|
+
<FSRow width="hug">
|
|
10
|
+
<FSIcon v-if="icon" size="m">
|
|
11
|
+
{{ icon }}
|
|
12
|
+
</FSIcon>
|
|
13
|
+
<FSSpan v-if="label" font="text-button">
|
|
14
|
+
{{ label }}
|
|
15
|
+
</FSSpan>
|
|
16
|
+
</FSRow>
|
|
17
|
+
</slot>
|
|
18
|
+
</v-btn>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import { computed, defineComponent, PropType, toRefs } from "vue";
|
|
23
|
+
|
|
24
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
25
|
+
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
26
|
+
|
|
27
|
+
import FSSpan from "./FSSpan.vue";
|
|
28
|
+
import FSIcon from "./FSIcon.vue";
|
|
29
|
+
import FSRow from "./FSRow.vue";
|
|
30
|
+
|
|
31
|
+
export default defineComponent({
|
|
32
|
+
name: "FSButton",
|
|
33
|
+
components: {
|
|
34
|
+
FSSpan,
|
|
35
|
+
FSIcon,
|
|
36
|
+
FSRow
|
|
37
|
+
},
|
|
38
|
+
props: {
|
|
39
|
+
icon: {
|
|
40
|
+
type: String,
|
|
41
|
+
required: false,
|
|
42
|
+
default: null
|
|
43
|
+
},
|
|
44
|
+
label: {
|
|
45
|
+
type: String,
|
|
46
|
+
required: false,
|
|
47
|
+
default: null
|
|
48
|
+
},
|
|
49
|
+
full: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
required: false,
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
54
|
+
color: {
|
|
55
|
+
type: String as PropType<ColorBase>,
|
|
56
|
+
required: false,
|
|
57
|
+
default: ColorBase.Primary
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
setup(props) {
|
|
61
|
+
const { label, full, color } = toRefs(props);
|
|
62
|
+
|
|
63
|
+
const colors = useColors().getVariants(color.value);
|
|
64
|
+
|
|
65
|
+
const style = computed(() => ({
|
|
66
|
+
"--fs-button-padding" : label.value ? "0 16px" : "0",
|
|
67
|
+
"--fs-button-light-color": full.value ? colors.base : colors.light,
|
|
68
|
+
"--fs-button-base-color" : colors.base,
|
|
69
|
+
"--fs-button-dark-color" : colors.dark,
|
|
70
|
+
"--fs-button-light-text" : full.value ? colors.light : colors.base,
|
|
71
|
+
"--fs-button-base-text" : colors.light,
|
|
72
|
+
"--fs-button-dark-text" : colors.light
|
|
73
|
+
}));
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
icon: props.icon,
|
|
77
|
+
label,
|
|
78
|
+
style
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
</script>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCol width="hug" height="hug">
|
|
3
|
+
<FSRow width="hug" height="hug">
|
|
4
|
+
<FSIcon
|
|
5
|
+
class="fs-checkbox"
|
|
6
|
+
size="checkbox"
|
|
7
|
+
:style="style"
|
|
8
|
+
@click="onToggle"
|
|
9
|
+
>
|
|
10
|
+
{{ icon }}
|
|
11
|
+
</FSIcon>
|
|
12
|
+
<FSSpan
|
|
13
|
+
v-if="$props.label"
|
|
14
|
+
class="fs-checkbox-label"
|
|
15
|
+
:style="style"
|
|
16
|
+
:font="font"
|
|
17
|
+
@click="onToggle"
|
|
18
|
+
>
|
|
19
|
+
{{ $props.label }}
|
|
20
|
+
</FSSpan>
|
|
21
|
+
</FSRow>
|
|
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>
|
|
30
|
+
</FSCol>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script lang="ts">
|
|
34
|
+
import { computed, defineComponent, PropType, toRefs } from "vue";
|
|
35
|
+
|
|
36
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
37
|
+
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
38
|
+
|
|
39
|
+
import FSIcon from "./FSIcon.vue";
|
|
40
|
+
import FSSpan from "./FSSpan.vue";
|
|
41
|
+
import FSRow from "./FSRow.vue";
|
|
42
|
+
import FSCol from "./FSCol.vue";
|
|
43
|
+
|
|
44
|
+
export default defineComponent({
|
|
45
|
+
name: "FSCheckbox",
|
|
46
|
+
components: {
|
|
47
|
+
FSIcon,
|
|
48
|
+
FSSpan,
|
|
49
|
+
FSRow,
|
|
50
|
+
FSCol
|
|
51
|
+
},
|
|
52
|
+
props: {
|
|
53
|
+
label: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: false,
|
|
56
|
+
default: null
|
|
57
|
+
},
|
|
58
|
+
description: {
|
|
59
|
+
type: String,
|
|
60
|
+
required: false,
|
|
61
|
+
default: null
|
|
62
|
+
},
|
|
63
|
+
value: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
required: false,
|
|
66
|
+
default: false
|
|
67
|
+
},
|
|
68
|
+
color: {
|
|
69
|
+
type: String as PropType<ColorBase>,
|
|
70
|
+
required: false,
|
|
71
|
+
default: ColorBase.Primary
|
|
72
|
+
},
|
|
73
|
+
editable: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
required: false,
|
|
76
|
+
default: true
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
emits: ["update:value"],
|
|
80
|
+
setup(props, { emit }) {
|
|
81
|
+
const { value, color, editable } = toRefs(props);
|
|
82
|
+
|
|
83
|
+
const colors = useColors().getVariants(color.value);
|
|
84
|
+
const dark = useColors().getDark();
|
|
85
|
+
|
|
86
|
+
const style = computed(() => ({
|
|
87
|
+
"--fs-checkbox-cursor" : editable.value ? "pointer" : "default",
|
|
88
|
+
"--fs-checkbox-base-color": editable.value ? value.value ? colors.base : dark.base : dark.light,
|
|
89
|
+
"--fs-checkbox-base-text" : editable.value ? dark.base : dark.light
|
|
90
|
+
}));
|
|
91
|
+
|
|
92
|
+
const icon = computed(() => value.value ? "mdi-checkbox-marked" : "mdi-checkbox-blank-outline");
|
|
93
|
+
|
|
94
|
+
const font = computed(() => value.value ? "text-button" : "text-body");
|
|
95
|
+
|
|
96
|
+
const onToggle = () => {
|
|
97
|
+
if (!editable.value) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
emit("update:value", !value.value);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
style,
|
|
105
|
+
icon,
|
|
106
|
+
font,
|
|
107
|
+
onToggle
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
</script>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="fs-col"
|
|
4
|
+
:style="style"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
>
|
|
7
|
+
<slot />
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { computed, defineComponent, PropType, toRefs } from "vue";
|
|
13
|
+
|
|
14
|
+
export default defineComponent({
|
|
15
|
+
name: "FSCol",
|
|
16
|
+
props: {
|
|
17
|
+
width: {
|
|
18
|
+
type: String as PropType<"hug" | "fill" | string>,
|
|
19
|
+
required: false,
|
|
20
|
+
default: "fill"
|
|
21
|
+
},
|
|
22
|
+
height: {
|
|
23
|
+
type: String as PropType<"hug" | "fill" | string>,
|
|
24
|
+
required: false,
|
|
25
|
+
default: "fill"
|
|
26
|
+
},
|
|
27
|
+
gap: {
|
|
28
|
+
type: Number,
|
|
29
|
+
required: false,
|
|
30
|
+
default: 8
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
setup(props) {
|
|
34
|
+
const { width, height, gap } = toRefs(props);
|
|
35
|
+
|
|
36
|
+
const style = computed(() => {
|
|
37
|
+
const style = {
|
|
38
|
+
"--fs-col-gap": `${gap.value}px`
|
|
39
|
+
};
|
|
40
|
+
switch (width.value) {
|
|
41
|
+
case "hug":
|
|
42
|
+
break;
|
|
43
|
+
case "fill":
|
|
44
|
+
style["align-self"] = "stretch";
|
|
45
|
+
break;
|
|
46
|
+
default:
|
|
47
|
+
style["width"] = width.value;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
switch (height.value) {
|
|
51
|
+
case "hug":
|
|
52
|
+
break;
|
|
53
|
+
case "fill":
|
|
54
|
+
style["flex"] = "1 0 0";
|
|
55
|
+
break;
|
|
56
|
+
default:
|
|
57
|
+
style["height"] = height.value;
|
|
58
|
+
style["flex-shrink"] = "0";
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
return style;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
style
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
</script>
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
<div class="fs-fade-out-inner">
|
|
10
|
+
<slot />
|
|
11
|
+
</div>
|
|
12
|
+
<div class="fs-fade-out-bottom" />
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import { defineComponent, PropType, ref, toRefs } from "vue";
|
|
18
|
+
|
|
19
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
20
|
+
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
21
|
+
|
|
22
|
+
export default defineComponent({
|
|
23
|
+
name: "FSFadeOut",
|
|
24
|
+
props: {
|
|
25
|
+
maskHeight: {
|
|
26
|
+
type: Number,
|
|
27
|
+
required: false,
|
|
28
|
+
default: 64
|
|
29
|
+
},
|
|
30
|
+
color: {
|
|
31
|
+
type: String as PropType<ColorBase>,
|
|
32
|
+
required: false,
|
|
33
|
+
default: ColorBase.Background
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
setup(props) {
|
|
37
|
+
const { maskHeight, color } = toRefs(props);
|
|
38
|
+
|
|
39
|
+
const colors = useColors().getVariants(color.value);
|
|
40
|
+
|
|
41
|
+
const style = ref({
|
|
42
|
+
"--fs-fade-out-mask-color": colors.base,
|
|
43
|
+
"--fs-fade-out-top-mask-height": "0px",
|
|
44
|
+
"--fs-fade-out-bottom-mask-height": `${maskHeight.value}px`
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const onScroll = ({ target }) => {
|
|
48
|
+
if (target.scrollHeight - target.scrollTop - target.clientHeight < 1) {
|
|
49
|
+
style.value["--fs-fade-out-bottom-mask-height"] = "0px";
|
|
50
|
+
} else {
|
|
51
|
+
style.value["--fs-fade-out-bottom-mask-height"] = `${maskHeight.value}px`;
|
|
52
|
+
}
|
|
53
|
+
if (target.scrollTop === 0) {
|
|
54
|
+
style.value["--fs-fade-out-top-mask-height"] = "0px";
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
style.value["--fs-fade-out-top-mask-height"] = `${maskHeight.value}px`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
style,
|
|
63
|
+
onScroll
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-icon
|
|
3
|
+
:class="size"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</v-icon>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { defineComponent, PropType, toRefs } from "vue";
|
|
12
|
+
|
|
13
|
+
export default defineComponent({
|
|
14
|
+
name: "FSIcon",
|
|
15
|
+
props: {
|
|
16
|
+
size: {
|
|
17
|
+
type: String as PropType<"s" | "m" | "checkbox">,
|
|
18
|
+
required: false,
|
|
19
|
+
default: "m"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
setup(props) {
|
|
23
|
+
const { size } = toRefs(props);
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
size: `fs-icon-${size.value}`
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
</script>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCol width="hug" height="hug">
|
|
3
|
+
<FSRow width="hug" height="hug">
|
|
4
|
+
<FSIcon
|
|
5
|
+
class="fs-radio"
|
|
6
|
+
size="checkbox"
|
|
7
|
+
:style="style"
|
|
8
|
+
@click="onToggle"
|
|
9
|
+
>
|
|
10
|
+
{{ icon }}
|
|
11
|
+
</FSIcon>
|
|
12
|
+
<FSSpan
|
|
13
|
+
v-if="$props.label"
|
|
14
|
+
class="fs-radio-label"
|
|
15
|
+
:style="style"
|
|
16
|
+
:font="font"
|
|
17
|
+
@click="onToggle"
|
|
18
|
+
>
|
|
19
|
+
{{ $props.label }}
|
|
20
|
+
</FSSpan>
|
|
21
|
+
</FSRow>
|
|
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>
|
|
30
|
+
</FSCol>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script lang="ts">
|
|
34
|
+
import { computed, defineComponent, PropType, toRefs } from "vue";
|
|
35
|
+
|
|
36
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
37
|
+
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
38
|
+
|
|
39
|
+
import FSIcon from "./FSIcon.vue";
|
|
40
|
+
import FSSpan from "./FSSpan.vue";
|
|
41
|
+
import FSRow from "./FSRow.vue";
|
|
42
|
+
import FSCol from "./FSCol.vue";
|
|
43
|
+
|
|
44
|
+
export default defineComponent({
|
|
45
|
+
name: "FSRadio",
|
|
46
|
+
components: {
|
|
47
|
+
FSIcon,
|
|
48
|
+
FSSpan,
|
|
49
|
+
FSRow,
|
|
50
|
+
FSCol
|
|
51
|
+
},
|
|
52
|
+
props: {
|
|
53
|
+
label: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: false,
|
|
56
|
+
default: null
|
|
57
|
+
},
|
|
58
|
+
description: {
|
|
59
|
+
type: String,
|
|
60
|
+
required: false,
|
|
61
|
+
default: null
|
|
62
|
+
},
|
|
63
|
+
value: {
|
|
64
|
+
type: [String, Boolean, Number],
|
|
65
|
+
required: true
|
|
66
|
+
},
|
|
67
|
+
selected: {
|
|
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
|
+
}
|
|
82
|
+
},
|
|
83
|
+
emits: ["update:value"],
|
|
84
|
+
setup(props, { emit }) {
|
|
85
|
+
const { value, selected, color, editable } = toRefs(props);
|
|
86
|
+
|
|
87
|
+
const colors = useColors().getVariants(color.value);
|
|
88
|
+
const dark = useColors().getDark();
|
|
89
|
+
|
|
90
|
+
const style = computed(() => ({
|
|
91
|
+
"--fs-radio-cursor": (editable.value && !selected.value) ? "pointer" : "default",
|
|
92
|
+
"--fs-radio-base-color": editable.value ? selected.value ? colors.base : dark.base : dark.light,
|
|
93
|
+
"--fs-radio-base-text" : editable.value ? dark.base : dark.light
|
|
94
|
+
|
|
95
|
+
}));
|
|
96
|
+
|
|
97
|
+
const icon = computed(() => selected.value ? "mdi-radiobox-marked" : "mdi-radiobox-blank");
|
|
98
|
+
|
|
99
|
+
const font = computed(() => selected.value ? "text-button" : "text-body");
|
|
100
|
+
|
|
101
|
+
const onToggle = () => {
|
|
102
|
+
if (!editable.value) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (!selected.value) {
|
|
106
|
+
emit("update:value", value.value);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
style,
|
|
112
|
+
icon,
|
|
113
|
+
font,
|
|
114
|
+
onToggle
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
</script>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCol width="hug" height="hug">
|
|
3
|
+
<FSRadio
|
|
4
|
+
v-for="item in $props.values"
|
|
5
|
+
:key="item.value"
|
|
6
|
+
:label="item.label"
|
|
7
|
+
:description="item.description"
|
|
8
|
+
:value="item.value"
|
|
9
|
+
:selected="isSelected(item.value)"
|
|
10
|
+
:color="color"
|
|
11
|
+
:editable="editable"
|
|
12
|
+
@update:value="onToggle"
|
|
13
|
+
/>
|
|
14
|
+
</FSCol>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
import { defineComponent, PropType, toRefs } from "vue";
|
|
19
|
+
|
|
20
|
+
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
21
|
+
|
|
22
|
+
import FSRadio from "./FSRadio.vue";
|
|
23
|
+
import FSCol from "./FSCol.vue";
|
|
24
|
+
|
|
25
|
+
export default defineComponent({
|
|
26
|
+
name: "FSRadioGroup",
|
|
27
|
+
components: {
|
|
28
|
+
FSRadio,
|
|
29
|
+
FSCol
|
|
30
|
+
},
|
|
31
|
+
props: {
|
|
32
|
+
values: {
|
|
33
|
+
type: Array as PropType<Array<{ value: String | Boolean | Number, label?: String, description?: string }>>,
|
|
34
|
+
required: true,
|
|
35
|
+
default: false
|
|
36
|
+
},
|
|
37
|
+
value: {
|
|
38
|
+
type: [String, Boolean, Number],
|
|
39
|
+
required: false,
|
|
40
|
+
default: 0
|
|
41
|
+
},
|
|
42
|
+
color: {
|
|
43
|
+
type: String as PropType<ColorBase>,
|
|
44
|
+
required: false,
|
|
45
|
+
default: ColorBase.Primary
|
|
46
|
+
},
|
|
47
|
+
editable: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
required: false,
|
|
50
|
+
default: true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
emits: ["update:value"],
|
|
54
|
+
setup(props, { emit }) {
|
|
55
|
+
const { value, color, editable } = toRefs(props);
|
|
56
|
+
|
|
57
|
+
const isSelected = (item: String | Boolean | Number) => {
|
|
58
|
+
return item == value.value;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const onToggle = (item: String | Boolean | Number) => {
|
|
62
|
+
if (item != value.value) {
|
|
63
|
+
emit("update:value", item);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
color,
|
|
69
|
+
editable,
|
|
70
|
+
isSelected,
|
|
71
|
+
onToggle
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
</script>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="fs-row"
|
|
4
|
+
:style="style"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
>
|
|
7
|
+
<slot />
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { computed, defineComponent, PropType, toRefs } from "vue";
|
|
13
|
+
|
|
14
|
+
export default defineComponent({
|
|
15
|
+
name: "FSRow",
|
|
16
|
+
props: {
|
|
17
|
+
width: {
|
|
18
|
+
type: String as PropType<"hug" | "fill" | string>,
|
|
19
|
+
required: false,
|
|
20
|
+
default: "fill"
|
|
21
|
+
},
|
|
22
|
+
height: {
|
|
23
|
+
type: String as PropType<"hug" | "fill" | string>,
|
|
24
|
+
required: false,
|
|
25
|
+
default: "fill"
|
|
26
|
+
},
|
|
27
|
+
wrap: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
required: false,
|
|
30
|
+
default: true
|
|
31
|
+
},
|
|
32
|
+
gap: {
|
|
33
|
+
type: Number,
|
|
34
|
+
required: false,
|
|
35
|
+
default: 8
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
setup(props) {
|
|
39
|
+
const { width, height, wrap, gap } = toRefs(props);
|
|
40
|
+
|
|
41
|
+
const style = computed(() => {
|
|
42
|
+
const style = {
|
|
43
|
+
"--fs-row-flex-wrap": wrap.value ? "wrap" : "nowrap",
|
|
44
|
+
"--fs-row-gap": `${gap.value}px`
|
|
45
|
+
};
|
|
46
|
+
switch (width.value) {
|
|
47
|
+
case "hug":
|
|
48
|
+
break;
|
|
49
|
+
case "fill":
|
|
50
|
+
style["flex"] = "1 0 0";
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
style["width"] = width.value;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
switch (height.value) {
|
|
57
|
+
case "hug":
|
|
58
|
+
break;
|
|
59
|
+
case "fill":
|
|
60
|
+
style["align-self"] = "stretch";
|
|
61
|
+
break;
|
|
62
|
+
default:
|
|
63
|
+
style["height"] = height.value;
|
|
64
|
+
style["flex-shrink"] = "0";
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
return style;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
style
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
</script>
|