@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.
Files changed (52) hide show
  1. package/components/FSBreadcrumbs.vue +64 -0
  2. package/components/FSButton.vue +82 -0
  3. package/components/FSCheckbox.vue +111 -0
  4. package/components/FSCol.vue +69 -0
  5. package/components/FSFadeOut.vue +67 -0
  6. package/components/FSIcon.vue +30 -0
  7. package/components/FSRadio.vue +118 -0
  8. package/components/FSRadioGroup.vue +75 -0
  9. package/components/FSRow.vue +75 -0
  10. package/components/FSSlideGroup.vue +57 -0
  11. package/components/FSSpan.vue +24 -0
  12. package/components/FSSwitch.vue +112 -0
  13. package/components/FSTab.vue +65 -0
  14. package/components/FSTabs.vue +60 -0
  15. package/components/FSTag.vue +85 -0
  16. package/components/FSTextField.vue +60 -0
  17. package/components/FSWindow.vue +26 -0
  18. package/components/FSWrapGroup.vue +56 -0
  19. package/composables/index.ts +2 -0
  20. package/composables/useColors.ts +64 -0
  21. package/composables/useTouch.ts +9 -0
  22. package/defaults/FSButtons.ts +63 -0
  23. package/importMap.json +59 -0
  24. package/importsGenerator.py +39 -0
  25. package/package.json +23 -0
  26. package/plugins/colorPlugin.ts +13 -0
  27. package/plugins/index.ts +1 -0
  28. package/shims-plugin.d.ts +9 -0
  29. package/styles/components/fs_breadcrumbs.scss +28 -0
  30. package/styles/components/fs_button.scss +28 -0
  31. package/styles/components/fs_checkbox.scss +15 -0
  32. package/styles/components/fs_col.scss +6 -0
  33. package/styles/components/fs_fade_out.scss +27 -0
  34. package/styles/components/fs_icon.scss +17 -0
  35. package/styles/components/fs_radio.scss +15 -0
  36. package/styles/components/fs_row.scss +6 -0
  37. package/styles/components/fs_span.scss +8 -0
  38. package/styles/components/fs_switch.scss +51 -0
  39. package/styles/components/fs_tabs.scss +63 -0
  40. package/styles/components/fs_tag.scss +45 -0
  41. package/styles/components/fs_text_field.scss +24 -0
  42. package/styles/components/fs_wrap_group.scss +12 -0
  43. package/styles/components/index.scss +14 -0
  44. package/styles/globals/breakpoints.scss +13 -0
  45. package/styles/globals/index.scss +6 -0
  46. package/styles/globals/overrides.scss +41 -0
  47. package/styles/globals/scrollbars.scss +45 -0
  48. package/styles/globals/text_fonts.scss +110 -0
  49. package/styles/globals/touchscreen.scss +11 -0
  50. package/styles/main.scss +3 -0
  51. package/themes/default.ts +24 -0
  52. package/themes/index.ts +1 -0
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <v-slide-group
3
+ class="fs-slide-group"
4
+ show-arrows
5
+ :style="style"
6
+ v-bind="$attrs"
7
+ >
8
+ <FSRow height="hug">
9
+ <v-slide-group-item v-for="(component, index) in $slots.default()" :key="index">
10
+ <component :is="component" v-bind="{ color }" />
11
+ </v-slide-group-item>
12
+ </FSRow>
13
+ </v-slide-group>
14
+ </template>
15
+
16
+ <script lang="ts">
17
+ import { defineComponent, PropType, 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
+ import FSRow from "./FSRow.vue";
23
+
24
+ export default defineComponent({
25
+ name: "FSSlideGroup",
26
+ components: {
27
+ FSRow
28
+ },
29
+ props: {
30
+ color: {
31
+ type: String as PropType<ColorBase>,
32
+ required: false,
33
+ default: ColorBase.Primary
34
+ }
35
+ },
36
+ setup(props) {
37
+ const { color } = toRefs(props);
38
+
39
+ const colors = useColors().getVariants(color.value);
40
+ const dark = useColors().getDark();
41
+
42
+ const style = {
43
+ "--fs-group-light-color" : colors.light,
44
+ "--fs-group-base-color" : colors.base,
45
+ "--fs-group-dark-color" : colors.dark,
46
+ "--fs-group-light-text" : dark.base,
47
+ "--fs-group-base-text" : dark.base,
48
+ "--fs-group-dark-text" : dark.dark
49
+ };
50
+
51
+ return {
52
+ color,
53
+ style
54
+ };
55
+ }
56
+ });
57
+ </script>
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <span
3
+ class="fs-span"
4
+ :class="$props.font"
5
+ v-bind="$attrs"
6
+ >
7
+ <slot />
8
+ </span>
9
+ </template>
10
+
11
+ <script lang="ts">
12
+ import { defineComponent, PropType } from "vue";
13
+
14
+ export default defineComponent({
15
+ name: "FSSpan",
16
+ props: {
17
+ font: {
18
+ type: String as PropType<"text-h1" | "text-h2" | "text-h3" | "text-body" | "text-button" | "text-overline">,
19
+ required: false,
20
+ default: "text-body"
21
+ }
22
+ }
23
+ });
24
+ </script>
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <FSCol width="hug" height="hug">
3
+ <FSRow width="hug" height="hug">
4
+ <v-switch
5
+ class="fs-switch"
6
+ hide-details
7
+ inset
8
+ :style="style"
9
+ :ripple="false"
10
+ :modelValue="$props.value"
11
+ @update:modelValue="onToggle"
12
+ v-bind="$attrs"
13
+ />
14
+ <FSSpan
15
+ v-if="$props.label"
16
+ class="fs-switch-label"
17
+ :style="style"
18
+ :font="font"
19
+ @click="onToggle"
20
+ >
21
+ {{ $props.label }}
22
+ </FSSpan>
23
+ </FSRow>
24
+ <FSSpan
25
+ v-if="$props.description"
26
+ class="fs-switch-description"
27
+ font="text-overline"
28
+ :style="style"
29
+ >
30
+ {{ $props.description }}
31
+ </FSSpan>
32
+ </FSCol>
33
+ </template>
34
+
35
+ <script lang="ts">
36
+ import { computed, defineComponent, PropType, toRefs } from "vue";
37
+
38
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
39
+ import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
40
+
41
+ import FSSpan from "./FSSpan.vue";
42
+ import FSRow from "./FSRow.vue";
43
+ import FSCol from "./FSCol.vue";
44
+
45
+ export default defineComponent({
46
+ name: "FSSwitch",
47
+ components: {
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 background = useColors().getBackground();
85
+ const dark = useColors().getDark();
86
+
87
+ const style = computed(() => ({
88
+ "--fs-switch-cursor" : editable.value ? "pointer" : "default",
89
+ "--fs-switch-translate-x" : value.value ? "8px" : "-8px",
90
+ "--fs-switch-base-color" : value.value ? colors.base : editable.value ? dark.base : dark.light,
91
+ "--fs-switch-base-text" : editable.value ? dark.base : dark.light,
92
+ "--fs-switch-base-background": background.base
93
+ }));
94
+
95
+ const font = computed(() => value.value ? "text-button" : "text-body");
96
+
97
+ const onToggle = () => {
98
+ if (!editable.value) {
99
+ return;
100
+ }
101
+ emit("update:value", !value.value);
102
+ }
103
+
104
+ return {
105
+ editable,
106
+ style,
107
+ font,
108
+ onToggle
109
+ };
110
+ }
111
+ });
112
+ </script>
@@ -0,0 +1,65 @@
1
+ <template>
2
+ <v-tab
3
+ class="fs-tab"
4
+ :ripple="false"
5
+ :slider-color="sliderColor"
6
+ v-bind="$attrs"
7
+ >
8
+ <slot>
9
+ <FSRow>
10
+ <FSSpan v-if="label" class="fs-tab-label" font="text-button">
11
+ {{ label }}
12
+ </FSSpan>
13
+ <v-spacer />
14
+ <FSSpan v-if="tag" class="fs-tab-tag">
15
+ {{ tag }}
16
+ </FSSpan>
17
+ </FSRow>
18
+ </slot>
19
+ </v-tab>
20
+ </template>
21
+
22
+ <script lang="ts">
23
+ import { defineComponent, PropType, toRefs } from "vue";
24
+
25
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
26
+ import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
27
+
28
+ import FSSpan from "./FSSpan.vue";
29
+ import FSRow from "./FSRow.vue";
30
+
31
+ export default defineComponent({
32
+ name: "FSTab",
33
+ components: {
34
+ FSSpan,
35
+ FSRow
36
+ },
37
+ props: {
38
+ label: {
39
+ type: String,
40
+ required: false,
41
+ default: null
42
+ },
43
+ tag: {
44
+ type: String,
45
+ required: false,
46
+ default: null
47
+ },
48
+ color: {
49
+ type: String as PropType<ColorBase>,
50
+ required: false,
51
+ default: ColorBase.Primary
52
+ }
53
+ },
54
+ setup(props) {
55
+ const { label, color } = toRefs(props);
56
+
57
+ const colors = useColors().getVariants(color.value);
58
+
59
+ return {
60
+ label,
61
+ sliderColor: colors.base
62
+ };
63
+ }
64
+ });
65
+ </script>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <v-tabs
3
+ class="fs-tabs"
4
+ selected-class="fs-tab-active"
5
+ show-arrows
6
+ grow
7
+ :style="style"
8
+ :modelValue="tab"
9
+ @update:modelValue="(v) => emit('update:tab', v)"
10
+ v-bind="$attrs"
11
+ >
12
+ <slot v-bind="{ color }" />
13
+ </v-tabs>
14
+ </template>
15
+
16
+ <script lang="ts">
17
+ import { defineComponent, PropType, 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: "FSTabs",
24
+ props: {
25
+ tab: {
26
+ type: Number,
27
+ required: false,
28
+ default: 0
29
+ },
30
+ color: {
31
+ type: String as PropType<ColorBase>,
32
+ required: false,
33
+ default: ColorBase.Primary
34
+ }
35
+ },
36
+ emits: ["update:tab"],
37
+ setup(props, { emit }) {
38
+ const { tab, color } = toRefs(props);
39
+
40
+ const colors = useColors().getVariants(color.value);
41
+ const dark = useColors().getDark();
42
+
43
+ const style = {
44
+ "--fs-group-light-color" : colors.light,
45
+ "--fs-group-base-color" : colors.base,
46
+ "--fs-group-dark-color" : colors.dark,
47
+ "--fs-group-light-text" : dark.base,
48
+ "--fs-group-base-text" : dark.base,
49
+ "--fs-group-dark-text" : dark.dark
50
+ };
51
+
52
+ return {
53
+ tab,
54
+ color,
55
+ style,
56
+ emit
57
+ };
58
+ }
59
+ });
60
+ </script>
@@ -0,0 +1,85 @@
1
+ <template>
2
+ <FSRow
3
+ class="fs-tag"
4
+ width="hug"
5
+ :style="style"
6
+ v-bind="$attrs"
7
+ >
8
+ <FSSpan>
9
+ {{ label }}
10
+ </FSSpan>
11
+ <v-btn
12
+ v-if="editable"
13
+ class="fs-tag-button"
14
+ :ripple="false"
15
+ @click="emit('remove')"
16
+ >
17
+ <FSIcon size="s">
18
+ mdi-close
19
+ </FSIcon>
20
+ </v-btn>
21
+ </FSRow>
22
+ </template>
23
+
24
+ <script lang="ts">
25
+ import { computed, defineComponent, PropType, toRefs } from "vue";
26
+
27
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
28
+ import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
29
+
30
+ import FSIcon from "./FSIcon.vue";
31
+ import FSSpan from "./FSSpan.vue";
32
+ import FSRow from "./FSRow.vue";
33
+
34
+ export default defineComponent({
35
+ name: "FSTag",
36
+ components: {
37
+ FSIcon,
38
+ FSSpan,
39
+ FSRow
40
+ },
41
+ props: {
42
+ label: {
43
+ type: String,
44
+ required: true
45
+ },
46
+ full: {
47
+ type: Boolean,
48
+ required: false,
49
+ default: true
50
+ },
51
+ color: {
52
+ type: String as PropType<ColorBase>,
53
+ required: false,
54
+ default: ColorBase.Primary
55
+ },
56
+ editable: {
57
+ type: Boolean,
58
+ required: false,
59
+ default: true
60
+ }
61
+ },
62
+ emits: ["remove"],
63
+ setup(props, { emit }) {
64
+ const { label, full, color, editable } = toRefs(props);
65
+
66
+ const colors = useColors().getVariants(color.value);
67
+
68
+ const style = computed(() => ({
69
+ "--fs-tag-light-color": full.value ? colors.base : colors.light,
70
+ "--fs-tag-base-color" : colors.base,
71
+ "--fs-tag-dark-color" : colors.dark,
72
+ "--fs-tag-light-text" : full.value ? colors.light : colors.base,
73
+ "--fs-tag-base-text" : colors.light,
74
+ "--fs-tag-dark-text" : colors.light
75
+ }));
76
+
77
+ return {
78
+ label,
79
+ editable,
80
+ style,
81
+ emit
82
+ };
83
+ }
84
+ });
85
+ </script>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <v-text-field
3
+ class="fs-text-field"
4
+ variant="outlined"
5
+ hide-details
6
+ v-bind="$attrs"
7
+ >
8
+ </v-text-field>
9
+ </template>
10
+
11
+ <script lang="ts">
12
+ import { computed, defineComponent, PropType, toRefs } from "vue";
13
+
14
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
15
+ import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
16
+
17
+ import FSSpan from "./FSSpan.vue";
18
+ import FSRow from "./FSRow.vue";
19
+ import FSCol from "./FSCol.vue";
20
+
21
+ export default defineComponent({
22
+ name: "FSTextField",
23
+ components: {
24
+ FSSpan,
25
+ FSRow,
26
+ FSCol
27
+ },
28
+ props: {
29
+ label: {
30
+ type: String,
31
+ required: false,
32
+ default: null
33
+ },
34
+ description: {
35
+ type: String,
36
+ required: false,
37
+ default: null
38
+ },
39
+ value: {
40
+ type: String,
41
+ required: false,
42
+ default: null
43
+ },
44
+ color: {
45
+ type: String as PropType<ColorBase>,
46
+ required: false,
47
+ default: null
48
+ },
49
+ editable: {
50
+ type: Boolean,
51
+ required: false,
52
+ default: true
53
+ }
54
+ },
55
+ setup(props, { emit }) {
56
+ return {
57
+ };
58
+ }
59
+ });
60
+ </script>
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <v-window
3
+ class="fs-window"
4
+ :modelValue="$props.tab"
5
+ v-bind="$attrs"
6
+ >
7
+ <v-window-item v-for="(component, index) in $slots.default()" :key="index">
8
+ <component :is="component" />
9
+ </v-window-item>
10
+ </v-window>
11
+ </template>
12
+
13
+ <script lang="ts">
14
+ import { defineComponent } from "vue";
15
+
16
+ export default defineComponent({
17
+ name: "FSWindow",
18
+ props: {
19
+ tab: {
20
+ type: Number,
21
+ required: false,
22
+ default: 0
23
+ }
24
+ }
25
+ });
26
+ </script>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <v-slide-group
3
+ class="fs-wrap-group"
4
+ :style="style"
5
+ v-bind="$attrs"
6
+ >
7
+ <FSRow height="hug">
8
+ <v-slide-group-item v-for="(component, index) in $slots.default()" :key="index">
9
+ <component :is="component" v-bind="{ color }" />
10
+ </v-slide-group-item>
11
+ </FSRow>
12
+ </v-slide-group>
13
+ </template>
14
+
15
+ <script lang="ts">
16
+ import { defineComponent, PropType, toRefs } from "vue";
17
+
18
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
19
+ import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
20
+
21
+ import FSRow from "./FSRow.vue";
22
+
23
+ export default defineComponent({
24
+ name: "FSWrapGroup",
25
+ components: {
26
+ FSRow
27
+ },
28
+ props: {
29
+ color: {
30
+ type: String as PropType<ColorBase>,
31
+ required: false,
32
+ default: ColorBase.Primary
33
+ }
34
+ },
35
+ setup(props) {
36
+ const { color } = toRefs(props);
37
+
38
+ const colors = useColors().getVariants(color.value);
39
+ const dark = useColors().getDark();
40
+
41
+ const style = {
42
+ "--fs-group-light-color" : colors.light,
43
+ "--fs-group-base-color" : colors.base,
44
+ "--fs-group-dark-color" : colors.dark,
45
+ "--fs-group-light-text" : dark.base,
46
+ "--fs-group-base-text" : dark.base,
47
+ "--fs-group-dark-text" : dark.dark
48
+ };
49
+
50
+ return {
51
+ color,
52
+ style
53
+ };
54
+ }
55
+ });
56
+ </script>
@@ -0,0 +1,2 @@
1
+ export * from "./useColors";
2
+ export * from "./useTouch";
@@ -0,0 +1,64 @@
1
+ import { useTheme } from "vuetify";
2
+
3
+ import Color from "color";
4
+
5
+ import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
6
+
7
+ export const useColors = () => {
8
+ const theme = useTheme().current.value;
9
+
10
+ const lighten = (color: Color): Color => color.saturationv(10).value(100);
11
+
12
+ const darken = (color: Color): Color => color.value(Math.max(color.value() - 30, 0));
13
+
14
+ const getBackground = () => {
15
+ const base = new Color(theme.colors[ColorBase.Background]);
16
+
17
+ return {
18
+ base: base.hex()
19
+ };
20
+ }
21
+
22
+ const getLight = () => {
23
+ const base = new Color(theme.colors[ColorBase.Light]);
24
+ const light = base.value(Math.max(base.value() - 20, 0));
25
+ const dark = darken(base);
26
+
27
+ return {
28
+ light: light.hex(),
29
+ base: base.hex(),
30
+ dark: dark.hex()
31
+ };
32
+ };
33
+
34
+ const getDark = () => {
35
+ const base = new Color(theme.colors[ColorBase.Dark]);
36
+ const light = base.saturationv(Math.max(base.saturationv() - 80, 0)).value(Math.min(base.value() + 40, 100));
37
+ const dark = darken(base);
38
+
39
+ return {
40
+ light: light.hex(),
41
+ base: base.hex(),
42
+ dark: dark.hex()
43
+ };
44
+ };
45
+
46
+ const getVariants = (color: ColorBase) => {
47
+ const base = new Color(theme.colors[color]);
48
+ const light = lighten(base);
49
+ const dark = darken(base);
50
+
51
+ return {
52
+ light: light.hex(),
53
+ base: base.hex(),
54
+ dark: dark.hex()
55
+ };
56
+ };
57
+
58
+ return {
59
+ getBackground,
60
+ getLight,
61
+ getDark,
62
+ getVariants
63
+ };
64
+ }
@@ -0,0 +1,9 @@
1
+ export const useTouch = () => {
2
+ const isEnabled = (): boolean => {
3
+ return navigator.maxTouchPoints > 0;
4
+ };
5
+
6
+ return {
7
+ isEnabled
8
+ };
9
+ }
@@ -0,0 +1,63 @@
1
+ import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
2
+
3
+ import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
4
+
5
+ export const FSButtonsAliases = {
6
+ FSButtonSearch: FSButton,
7
+ FSButtonSearchMini: FSButton,
8
+ FSButtonRemove: FSButton,
9
+ FSButtonRemoveMini: FSButton,
10
+ FSButtonSave: FSButton,
11
+ FSButtonSaveMini: FSButton
12
+ }
13
+
14
+ export const FSButtonsProps = {
15
+ FSButtonSearch: {
16
+ icon: "mdi-magnify",
17
+ label: "Search",
18
+ full: false,
19
+ color: ColorBase.Primary
20
+ },
21
+ FSButtonSearchMini: {
22
+ icon: "mdi-magnify",
23
+ label: undefined,
24
+ full: false,
25
+ color: ColorBase.Primary
26
+ },
27
+ FSButtonRemove: {
28
+ icon: "mdi-delete-outline",
29
+ label: "Remove",
30
+ full: false,
31
+ color: ColorBase.Error
32
+ },
33
+ FSButtonRemoveMini: {
34
+ icon: "mdi-delete-outline",
35
+ label: undefined,
36
+ full: false,
37
+ color: ColorBase.Error
38
+ },
39
+ FSButtonSave: {
40
+ icon: "mdi-content-save-outline",
41
+ label: "Save",
42
+ full: false,
43
+ color: ColorBase.Success
44
+ },
45
+ FSButtonSaveMini: {
46
+ icon: "mdi-content-save-outline",
47
+ label: undefined,
48
+ full: false,
49
+ color: ColorBase.Success
50
+ },
51
+ FSButtonCancel: {
52
+ icon: "mdi-cancel",
53
+ label: "Cancel",
54
+ full: false,
55
+ color: ColorBase.Light
56
+ },
57
+ FSButtonCancelMini: {
58
+ icon: "mdi-cancel",
59
+ label: undefined,
60
+ full: false,
61
+ color: ColorBase.Light
62
+ }
63
+ }