@dative-gpi/foundation-shared-components 0.0.5 → 0.0.7

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 (46) hide show
  1. package/components/FSBreadcrumbs.vue +16 -14
  2. package/components/FSButton.vue +171 -115
  3. package/components/FSCheckbox.vue +21 -10
  4. package/components/FSCol.vue +17 -17
  5. package/components/FSColor.vue +80 -0
  6. package/components/FSFadeOut.vue +4 -4
  7. package/components/FSIcon.vue +5 -3
  8. package/components/FSNumberField.vue +1 -1
  9. package/components/FSPasswordField.vue +20 -9
  10. package/components/FSRadio.vue +20 -10
  11. package/components/FSRadioGroup.vue +5 -7
  12. package/components/FSRow.vue +17 -17
  13. package/components/FSSearchField.vue +122 -0
  14. package/components/FSSlideGroup.vue +16 -12
  15. package/components/FSSpan.vue +27 -2
  16. package/components/FSSwitch.vue +25 -12
  17. package/components/FSTab.vue +9 -2
  18. package/components/FSTabs.vue +18 -10
  19. package/components/FSTag.vue +31 -17
  20. package/components/FSTagField.vue +152 -0
  21. package/components/FSTagGroup.vue +60 -0
  22. package/components/FSText.vue +78 -0
  23. package/components/FSTextField.vue +74 -18
  24. package/components/FSWrapGroup.vue +15 -12
  25. package/composables/useColors.ts +31 -21
  26. package/{defaults → models}/FSButtons.ts +24 -6
  27. package/models/FSTags.ts +8 -0
  28. package/models/FSTextFields.ts +17 -0
  29. package/package.json +5 -4
  30. package/styles/components/fs_breadcrumbs.scss +10 -5
  31. package/styles/components/fs_button.scss +21 -20
  32. package/styles/components/fs_checkbox.scss +3 -4
  33. package/styles/components/fs_color.scss +5 -0
  34. package/styles/components/fs_password_field.scss +6 -1
  35. package/styles/components/fs_radio.scss +3 -4
  36. package/styles/components/fs_span.scss +7 -2
  37. package/styles/components/fs_switch.scss +4 -4
  38. package/styles/components/fs_tabs.scss +8 -8
  39. package/styles/components/fs_tag.scss +8 -8
  40. package/styles/components/fs_tag_field.scss +10 -0
  41. package/styles/components/fs_text.scss +5 -0
  42. package/styles/components/fs_text_field.scss +25 -14
  43. package/styles/components/index.scss +3 -0
  44. package/styles/globals/overrides.scss +13 -4
  45. package/styles/globals/text_fonts.scss +4 -0
  46. package/themes/default.ts +6 -6
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <v-breadcrumbs v-bind="$attrs" :style="style" :items="$props.items">
3
3
  <template #title="{ item }">
4
- <FSSpan :class="getClass(item)">
4
+ <FSSpan :class="classes(item)">
5
5
  {{ item.title }}
6
6
  </FSSpan>
7
7
  </template>
@@ -14,7 +14,7 @@
14
14
  </template>
15
15
 
16
16
  <script lang="ts">
17
- import { defineComponent, PropType } from "vue";
17
+ import { defineComponent, PropType, Ref, ref } from "vue";
18
18
 
19
19
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
20
20
  import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
@@ -23,9 +23,9 @@ import FSSpan from "./FSSpan.vue";
23
23
  import FSIcon from "./FSIcon.vue";
24
24
 
25
25
  export interface FSBreadcrumbItem {
26
- href: string | undefined
27
- replace: boolean | undefined
28
- to: string | undefined
26
+ href: string | undefined,
27
+ replace: boolean | undefined,
28
+ to: string | undefined,
29
29
  exact: boolean | undefined,
30
30
  title: string,
31
31
  disabled: boolean
@@ -44,23 +44,25 @@ export default defineComponent({
44
44
  }
45
45
  },
46
46
  setup() {
47
- const dark = useColors().getVariants(ColorBase.Dark);
47
+ const darks = useColors().getColors(ColorBase.Dark);
48
48
 
49
- const style = {
50
- "--fs-breadcrumbs-light-text": dark.light,
51
- "--fs-breadcrumbs-base-text" : dark.base
52
- };
49
+ const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
50
+ "--fs-breadcrumbs-color": darks.dark,
51
+ "--fs-breadcrumbs-active-color": darks.base,
52
+ "--fs-breadcrumbs-disabled-color": darks.light
53
+ });
53
54
 
54
- const getClass = (item: FSBreadcrumbItem): string => {
55
+ const classes = (item: FSBreadcrumbItem): string[] => {
56
+ const classes = ["fs-breadcrumbs-label"];
55
57
  if (item.disabled) {
56
- return "fs-breadcrumbs-label fs-breadcrumbs-label--disabled";
58
+ classes.push("fs-breadcrumbs-label--disabled");
57
59
  }
58
- return "fs-breadcrumbs-label";
60
+ return classes;
59
61
  };
60
62
 
61
63
  return {
62
64
  style,
63
- getClass
65
+ classes
64
66
  };
65
67
  }
66
68
  })
@@ -1,40 +1,42 @@
1
1
  <template>
2
- <v-btn
3
- v-if="!['icon'].includes($props.variant)"
4
- :ripple="false"
5
- :style="style"
6
- :class="classes"
7
- v-bind="$attrs"
8
- >
9
- <FSRow>
10
- <slot name="prepend">
11
- <FSIcon v-if="$props.prependIcon" size="m">
12
- {{ $props.prependIcon }}
13
- </FSIcon>
14
- </slot>
15
- <slot name="default">
16
- <FSSpan v-if="$props.label" font="text-button">
17
- {{ $props.label }}
18
- </FSSpan>
19
- </slot>
20
- <slot name="append">
21
- <FSIcon v-if="$props.appendIcon" size="m">
22
- {{ $props.appendIcon }}
23
- </FSIcon>
24
- </slot>
25
- </FSRow>
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 }}
2
+ <v-btn
3
+ v-if="!['icon'].includes($props.variant!)"
4
+ :ripple="false"
5
+ :style="style"
6
+ :class="classes"
7
+ @click="onClick"
8
+ v-bind="$attrs"
9
+ >
10
+ <FSRow :wrap="false">
11
+ <slot name="prepend" v-bind="{ color, colors }">
12
+ <FSIcon v-if="$props.prependIcon" size="m">
13
+ {{ $props.prependIcon }}
36
14
  </FSIcon>
15
+ </slot>
16
+ <slot name="default" v-bind="{ color, colors }">
17
+ <FSSpan v-if="$props.label" font="text-body">
18
+ {{ $props.label }}
19
+ </FSSpan>
20
+ </slot>
21
+ <slot name="append" v-bind="{ color, colors }">
22
+ <FSIcon v-if="$props.appendIcon" size="m">
23
+ {{ $props.appendIcon }}
24
+ </FSIcon>
25
+ </slot>
37
26
  </FSRow>
27
+ </v-btn>
28
+ <FSRow
29
+ v-else-if="$props.icon"
30
+ width="hug"
31
+ :style="style"
32
+ :class="classes"
33
+ @click="onClick"
34
+ v-bind="$attrs"
35
+ >
36
+ <FSIcon size="checkbox">
37
+ {{ $props.icon }}
38
+ </FSIcon>
39
+ </FSRow>
38
40
  </template>
39
41
 
40
42
  <script lang="ts">
@@ -48,93 +50,147 @@ import FSIcon from "./FSIcon.vue";
48
50
  import FSRow from "./FSRow.vue";
49
51
 
50
52
  export default defineComponent({
51
- name: "FSButton",
52
- components: {
53
- FSSpan,
54
- FSIcon,
55
- FSRow
53
+ name: "FSButton",
54
+ components: {
55
+ FSSpan,
56
+ FSIcon,
57
+ FSRow,
58
+ },
59
+ props: {
60
+ prependIcon: {
61
+ type: String,
62
+ required: false,
63
+ default: null,
56
64
  },
57
- props: {
58
- prependIcon: {
59
- type: String,
60
- required: false,
61
- default: null
62
- },
63
- label: {
64
- type: String,
65
- required: false,
66
- default: null
67
- },
68
- appendIcon: {
69
- type: String,
70
- required: false,
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"
82
- },
83
- color: {
84
- type: String as PropType<ColorBase>,
85
- required: false,
86
- default: ColorBase.Primary
87
- }
65
+ label: {
66
+ type: String,
67
+ required: false,
68
+ default: null,
69
+ },
70
+ appendIcon: {
71
+ type: String,
72
+ required: false,
73
+ default: null,
74
+ },
75
+ icon: {
76
+ type: String,
77
+ required: false,
78
+ default: null,
79
+ },
80
+ variant: {
81
+ type: String as PropType<"standard" | "full" | "icon">,
82
+ required: false,
83
+ default: "standard",
88
84
  },
89
- setup(props) {
90
- const { label, variant, color } = toRefs(props);
85
+ color: {
86
+ type: String as PropType<ColorBase>,
87
+ required: false,
88
+ default: ColorBase.Dark,
89
+ },
90
+ editable: {
91
+ type: Boolean,
92
+ required: false,
93
+ default: true,
94
+ },
95
+ },
96
+ emts: ["click"],
97
+ setup(props, { emit }) {
98
+ const { label, variant, color, editable } = toRefs(props);
99
+
100
+ const textColors = useColors().getContrasts(color.value);
101
+ const colors = useColors().getColors(color.value);
102
+ const slots = useSlots();
91
103
 
92
- const colors = useColors().getVariants(color.value);
93
- const slots = useSlots();
104
+ const lights = useColors().getColors(ColorBase.Light);
94
105
 
95
- const isEmpty = computed(() => {
96
- return !slots.default && !label.value;
97
- });
106
+ const isEmpty = computed(() => {
107
+ return !slots.default && !label.value;
108
+ });
98
109
 
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
110
+ const style = computed(
111
+ (): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
112
+ if (!editable.value) {
113
+ switch (variant.value) {
114
+ case "standard":
115
+ case "full":
116
+ return {
117
+ "--fs-button-padding": !isEmpty.value ? "0 16px" : "0",
118
+ "--fs-button-background-color": lights.base,
119
+ "--fs-button-border-color": lights.dark,
120
+ "--fs-button-color": lights.dark,
121
+ };
122
+ case "icon":
123
+ return {
124
+ "--fs-button-color": lights.dark,
125
+ };
126
+ }
127
+ }
128
+ switch (variant.value) {
129
+ case "standard":
130
+ return {
131
+ "--fs-button-padding": !isEmpty.value ? "0 16px" : "0",
132
+ "--fs-button-background-color": colors.light,
133
+ "--fs-button-border-color": colors.base,
134
+ "--fs-button-color": textColors.base,
135
+ "--fs-button-hover-background-color": colors.base,
136
+ "--fs-button-hover-border-color": colors.base,
137
+ "--fs-button-hover-color": textColors.light,
138
+ "--fs-button-active-background-color": colors.dark,
139
+ "--fs-button-active-border-color": colors.dark,
140
+ "--fs-button-active-color": textColors.light,
141
+ };
142
+ case "full":
143
+ return {
144
+ "--fs-button-padding": !isEmpty.value ? "0 16px" : "0",
145
+ "--fs-button-background-color": colors.base,
146
+ "--fs-button-border-color": colors.base,
147
+ "--fs-button-color": textColors.light,
148
+ "--fs-button-hover-background-color": colors.base,
149
+ "--fs-button-hover-border-color": colors.base,
150
+ "--fs-button-hover-color": textColors.light,
151
+ "--fs-button-active-background-color": colors.dark,
152
+ "--fs-button-active-border-color": colors.dark,
153
+ "--fs-button-active-color": textColors.light,
154
+ };
155
+ case "icon":
156
+ return {
157
+ "--fs-button-color": textColors.base,
158
+ "--fs-button-hover-color": textColors.dark,
159
+ };
160
+ }
161
+ }
162
+ );
118
163
 
119
- };
120
- case "icon": return {
121
- "--fs-button-light-text" : colors.base,
122
- "--fs-button-base-text" : colors.dark
123
- };
124
- }
125
- });
164
+ const classes = computed((): string[] => {
165
+ const classes = [];
166
+ if (!editable.value) {
167
+ classes.push("fs-button--disabled");
168
+ }
169
+ switch (variant.value) {
170
+ case "icon":
171
+ classes.push("fs-button-icon");
172
+ break;
173
+ default:
174
+ classes.push("fs-button");
175
+ break;
176
+ }
177
+ return classes;
178
+ });
126
179
 
127
- const classes = computed(() => {
128
- switch (variant.value) {
129
- case "icon": return "fs-button-icon";
130
- default: return "fs-button";
131
- }
132
- });
180
+ const onClick = () => {
181
+ if (!editable.value) {
182
+ return;
183
+ }
184
+ emit("click");
185
+ };
133
186
 
134
- return {
135
- style,
136
- classes
137
- };
138
- }
187
+ return {
188
+ colors,
189
+ color,
190
+ style,
191
+ classes,
192
+ onClick,
193
+ };
194
+ },
139
195
  });
140
- </script>
196
+ </script>
@@ -84,20 +84,31 @@ export default defineComponent({
84
84
  setup(props, { emit }) {
85
85
  const { value, color, editable } = toRefs(props);
86
86
 
87
- const colors = useColors().getVariants(color.value);
88
- const dark = useColors().getVariants(ColorBase.Dark);
87
+ const colors = useColors().getColors(color.value);
89
88
 
90
- const style = computed(() => ({
91
- "--fs-checkbox-cursor" : editable.value ? "pointer" : "default",
92
- "--fs-checkbox-base-color": editable.value ? value.value ? colors.base : dark.base : dark.light,
93
- "--fs-checkbox-base-text" : editable.value ? dark.base : dark.light
94
- }));
89
+ const lights = useColors().getColors(ColorBase.Light);
90
+ const darks = useColors().getColors(ColorBase.Dark);
95
91
 
96
- const icon = computed(() => value.value ? "mdi-checkbox-marked" : "mdi-checkbox-blank-outline");
92
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
93
+ if (!editable.value) {
94
+ return {
95
+ "--fs-checkbox-cursor": "default",
96
+ "--fs-checkbox-checkbox-color": lights.dark,
97
+ "--fs-checkbox-color": lights.dark
98
+ };
99
+ }
100
+ return {
101
+ "--fs-checkbox-cursor": "pointer",
102
+ "--fs-checkbox-checkbox-color": value.value ? colors.base : darks.base,
103
+ "--fs-checkbox-color": darks.base
104
+ }
105
+ });
106
+
107
+ const icon = computed((): string => value.value ? "mdi-checkbox-marked" : "mdi-checkbox-blank-outline");
97
108
 
98
- const font = computed(() => value.value ? "text-button" : "text-body");
109
+ const font = computed((): string => value.value ? "text-button" : "text-body");
99
110
 
100
- const onToggle = () => {
111
+ const onToggle = (): void => {
101
112
  if (!editable.value) {
102
113
  return;
103
114
  }
@@ -44,57 +44,57 @@ export default defineComponent({
44
44
  "--fs-col-height": height.value
45
45
  }));
46
46
 
47
- const classes = computed((): string => {
48
- let classes = "fs-col";
47
+ const classes = computed((): string[] => {
48
+ const classes = ["fs-col"];
49
49
  switch (width.value) {
50
50
  case "hug":
51
- classes += " fs-col-width-hug";
51
+ classes.push("fs-col-width-hug");
52
52
  break;
53
53
  case "fill":
54
- classes += " fs-col-width-fill";
54
+ classes.push("fs-col-width-fill");
55
55
  break;
56
56
  default:
57
- classes += " fs-col-width-fixed";
57
+ classes.push("fs-col-width-fixed");
58
58
  break;
59
59
  }
60
60
  switch (height.value) {
61
61
  case "hug":
62
- classes += " fs-col-height-hug";
62
+ classes.push("fs-col-height-hug");
63
63
  break;
64
64
  case "fill":
65
- classes += " fs-col-height-fill";
65
+ classes.push("fs-col-height-fill");
66
66
  break;
67
67
  default:
68
- classes += " fs-col-height-fixed";
68
+ classes.push("fs-col-height-fixed");
69
69
  break;
70
70
  }
71
71
  switch (align.value) {
72
72
  case "top-left":
73
- classes += " fs-col-top-left";
73
+ classes.push("fs-col-top-left");
74
74
  break;
75
75
  case "top-center":
76
- classes += " fs-col-top-center";
76
+ classes.push("fs-col-top-center");
77
77
  break;
78
78
  case "top-right":
79
- classes += " fs-col-top-right";
79
+ classes.push("fs-col-top-right");
80
80
  break;
81
81
  case "center-left":
82
- classes += " fs-col-center-left";
82
+ classes.push("fs-col-center-left");
83
83
  break;
84
84
  case "center-center":
85
- classes += " fs-col-center-center";
85
+ classes.push("fs-col-center-center");
86
86
  break;
87
87
  case "center-right":
88
- classes += " fs-col-center-right";
88
+ classes.push("fs-col-center-right");
89
89
  break;
90
90
  case "bottom-left":
91
- classes += " fs-col-bottom-left";
91
+ classes.push("fs-col-bottom-left");
92
92
  break;
93
93
  case "bottom-center":
94
- classes += " fs-col-bottom-center";
94
+ classes.push("fs-col-bottom-center");
95
95
  break;
96
96
  case "bottom-right":
97
- classes += " fs-col-bottom-right";
97
+ classes.push("fs-col-bottom-right");
98
98
  break;
99
99
  }
100
100
  return classes;
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <FSRow
3
+ class="fs-color"
4
+ :width="$props.width"
5
+ :height="$props.height"
6
+ :align="$props.align"
7
+ :wrap="$props.wrap"
8
+ :gap="$props.gap"
9
+ :style="style"
10
+ >
11
+ <slot name="default" v-bind="{ color, colors }" />
12
+ </FSRow>
13
+ </template>
14
+
15
+ <script lang="ts">
16
+ import { defineComponent, PropType, ref, Ref, 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: "FSColor",
25
+ components: {
26
+ FSRow
27
+ },
28
+ props: {
29
+ width: {
30
+ type: String as PropType<"hug" | "fill" | string>,
31
+ required: false,
32
+ default: "hug"
33
+ },
34
+ height: {
35
+ type: String as PropType<"hug" | "fill" | string>,
36
+ required: false,
37
+ default: "hug"
38
+ },
39
+ align: {
40
+ type: String as PropType<"top-left" | "top-center" | "top-right" | "center-left" | "center-center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right">,
41
+ required: false,
42
+ default: "center-left"
43
+ },
44
+ wrap: {
45
+ type: Boolean,
46
+ required: false,
47
+ default: true
48
+ },
49
+ gap: {
50
+ type: Number,
51
+ required: false,
52
+ default: 8
53
+ },
54
+ color: {
55
+ type: String as PropType<ColorBase | String>,
56
+ required: false,
57
+ default: ColorBase.Primary
58
+ }
59
+ },
60
+ setup(props) {
61
+ const { color } = toRefs(props);
62
+
63
+ const colors = useColors().getColors(color.value);
64
+
65
+ const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
66
+ "--fs-color-background-color": colors.light,
67
+ "--fs-color-color": colors.base,
68
+ "--fs-color-light": colors.light,
69
+ "--fs-color-base": colors.base,
70
+ "--fs-color-dark": colors.dark
71
+ });
72
+
73
+ return {
74
+ colors,
75
+ color,
76
+ style
77
+ };
78
+ }
79
+ });
80
+ </script>
@@ -14,7 +14,7 @@
14
14
  </template>
15
15
 
16
16
  <script lang="ts">
17
- import { defineComponent, PropType, ref, toRefs } from "vue";
17
+ import { defineComponent, PropType, Ref, ref, toRefs } from "vue";
18
18
 
19
19
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
20
20
  import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
@@ -41,15 +41,15 @@ export default defineComponent({
41
41
  setup(props) {
42
42
  const { maskHeight, color } = toRefs(props);
43
43
 
44
- const colors = useColors().getVariants(color.value);
44
+ const colors = useColors().getColors(color.value);
45
45
 
46
- const style = ref({
46
+ const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
47
47
  "--fs-fade-out-mask-color": colors.base,
48
48
  "--fs-fade-out-top-mask-height": "0px",
49
49
  "--fs-fade-out-bottom-mask-height": `${maskHeight.value}px`
50
50
  });
51
51
 
52
- const onScroll = ({ target }) => {
52
+ const onScroll = ({ target }): void => {
53
53
  if (target.scrollHeight - target.scrollTop - target.clientHeight < 1) {
54
54
  style.value["--fs-fade-out-bottom-mask-height"] = "0px";
55
55
  } else {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <v-icon
3
- :class="size"
3
+ :class="classes"
4
4
  v-bind="$attrs"
5
5
  >
6
6
  <slot />
@@ -8,7 +8,7 @@
8
8
  </template>
9
9
 
10
10
  <script lang="ts">
11
- import { defineComponent, PropType, toRefs } from "vue";
11
+ import { computed, defineComponent, PropType, toRefs } from "vue";
12
12
 
13
13
  export default defineComponent({
14
14
  name: "FSIcon",
@@ -22,8 +22,10 @@ export default defineComponent({
22
22
  setup(props) {
23
23
  const { size } = toRefs(props);
24
24
 
25
+ const classes = computed((): string[] => ["fs-icon", `fs-icon-${size.value}`]);
26
+
25
27
  return {
26
- size: `fs-icon-${size.value}`
28
+ classes
27
29
  };
28
30
  }
29
31
  });
@@ -17,7 +17,7 @@
17
17
  </template>
18
18
 
19
19
  <script lang="ts">
20
- import { defineComponent, PropType, toRefs } from "vue";
20
+ import { defineComponent, PropType } from "vue";
21
21
 
22
22
  import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
23
23