@dative-gpi/foundation-shared-components 0.0.18 → 0.0.20

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 (71) hide show
  1. package/components/FSButton.vue +31 -57
  2. package/components/FSCard.vue +4 -4
  3. package/components/FSCarousel.vue +4 -3
  4. package/components/FSClickable.vue +125 -0
  5. package/components/FSDivider.vue +7 -2
  6. package/components/FSLoader.vue +9 -31
  7. package/components/FSSlideGroup.vue +69 -8
  8. package/components/FSToggleSet.vue +20 -1
  9. package/components/FSWrapGroup.vue +22 -2
  10. package/components/buttons/FSButtonCancel.vue +28 -0
  11. package/components/buttons/FSButtonCancelIcon.vue +28 -0
  12. package/components/buttons/FSButtonCancelLabel.vue +27 -0
  13. package/components/buttons/FSButtonCancelMini.vue +27 -0
  14. package/components/buttons/FSButtonDuplicate.vue +28 -0
  15. package/components/buttons/FSButtonDuplicateIcon.vue +28 -0
  16. package/components/buttons/FSButtonDuplicateLabel.vue +27 -0
  17. package/components/buttons/FSButtonDuplicateMini.vue +27 -0
  18. package/components/buttons/FSButtonEdit.vue +28 -0
  19. package/components/buttons/FSButtonEditIcon.vue +28 -0
  20. package/components/buttons/FSButtonEditLabel.vue +27 -0
  21. package/components/buttons/FSButtonEditMini.vue +27 -0
  22. package/components/buttons/FSButtonFile.vue +84 -0
  23. package/components/buttons/FSButtonFileIcon.vue +84 -0
  24. package/components/buttons/FSButtonFileLabel.vue +83 -0
  25. package/components/buttons/FSButtonFileMini.vue +83 -0
  26. package/components/buttons/FSButtonNext.vue +28 -0
  27. package/components/buttons/FSButtonNextIcon.vue +28 -0
  28. package/components/buttons/FSButtonNextLabel.vue +27 -0
  29. package/components/buttons/FSButtonNextMini.vue +27 -0
  30. package/components/buttons/FSButtonPrevious.vue +28 -0
  31. package/components/buttons/FSButtonPreviousIcon.vue +28 -0
  32. package/components/buttons/FSButtonPreviousLabel.vue +27 -0
  33. package/components/buttons/FSButtonPreviousMini.vue +27 -0
  34. package/components/buttons/FSButtonRedo.vue +28 -0
  35. package/components/buttons/FSButtonRedoIcon.vue +28 -0
  36. package/components/buttons/FSButtonRedoLabel.vue +27 -0
  37. package/components/buttons/FSButtonRedoMini.vue +27 -0
  38. package/components/buttons/FSButtonRemove.vue +28 -0
  39. package/components/buttons/FSButtonRemoveIcon.vue +28 -0
  40. package/components/buttons/FSButtonRemoveLabel.vue +27 -0
  41. package/components/buttons/FSButtonRemoveMini.vue +27 -0
  42. package/components/buttons/FSButtonSave.vue +28 -0
  43. package/components/buttons/FSButtonSaveIcon.vue +28 -0
  44. package/components/buttons/FSButtonSaveLabel.vue +27 -0
  45. package/components/buttons/FSButtonSaveMini.vue +27 -0
  46. package/components/buttons/FSButtonSearch.vue +28 -0
  47. package/components/buttons/FSButtonSearchIcon.vue +28 -0
  48. package/components/buttons/FSButtonSearchLabel.vue +27 -0
  49. package/components/buttons/FSButtonSearchMini.vue +27 -0
  50. package/components/buttons/FSButtonUndo.vue +28 -0
  51. package/components/buttons/FSButtonUndoIcon.vue +28 -0
  52. package/components/buttons/FSButtonUndoLabel.vue +27 -0
  53. package/components/buttons/FSButtonUndoMini.vue +27 -0
  54. package/components/buttons/FSButtonUpdate.vue +28 -0
  55. package/components/buttons/FSButtonUpdateIcon.vue +28 -0
  56. package/components/buttons/FSButtonUpdateLabel.vue +27 -0
  57. package/components/buttons/FSButtonUpdateMini.vue +27 -0
  58. package/components/buttons/FSButtonValidate.vue +28 -0
  59. package/components/buttons/FSButtonValidateIcon.vue +28 -0
  60. package/components/buttons/FSButtonValidateLabel.vue +27 -0
  61. package/components/buttons/FSButtonValidateMini.vue +27 -0
  62. package/components/fields/FSIconField.vue +18 -5
  63. package/components/lists/FSDataTableUI.vue +2 -0
  64. package/package.json +4 -4
  65. package/styles/components/fs_button.scss +0 -28
  66. package/styles/components/fs_clickable.scss +26 -0
  67. package/styles/components/fs_data_table.scss +2 -2
  68. package/styles/components/index.scss +1 -0
  69. package/styles/globals/overrides.scss +3 -2
  70. package/utils/css.ts +16 -2
  71. package/components/FSFileButton.vue +0 -246
@@ -1,246 +0,0 @@
1
- <template>
2
- <div>
3
- <v-btn
4
- v-if="!['icon'].includes($props.variant)"
5
- :ripple="false"
6
- :style="style"
7
- :class="classes"
8
- :disabled="!$props.editable"
9
- @click="onClick"
10
- v-bind="$attrs"
11
- >
12
- <FSRow
13
- align="center-center"
14
- :wrap="false"
15
- >
16
- <slot name="prepend" v-bind="{ color: $props.color, colors }">
17
- <FSIcon
18
- v-if="$props.prependIcon"
19
- size="l"
20
- >
21
- {{ $props.prependIcon }}
22
- </FSIcon>
23
- </slot>
24
- <slot v-bind="{ color: $props.color, colors }">
25
- <FSSpan
26
- v-if="$props.label"
27
- font="text-body"
28
- >
29
- {{ $props.label }}
30
- </FSSpan>
31
- </slot>
32
- <slot name="append" v-bind="{ color: $props.color, colors }">
33
- <FSIcon
34
- v-if="$props.appendIcon"
35
- size="l"
36
- >
37
- {{ $props.appendIcon }}
38
- </FSIcon>
39
- </slot>
40
- </FSRow>
41
- </v-btn>
42
- <FSRow
43
- v-else-if="$props.icon"
44
- width="hug"
45
- :style="style"
46
- :class="classes"
47
- v-bind="$attrs"
48
- >
49
- <FSIcon
50
- size="l"
51
- >
52
- {{ $props.icon }}
53
- </FSIcon>
54
- </FSRow>
55
- <form>
56
- <input
57
- v-show="false"
58
- type="file"
59
- ref="input"
60
- :accept="$props.accept"
61
- @input="onInput"
62
- />
63
- </form>
64
- </div>
65
- </template>
66
-
67
- <script lang="ts">
68
- import { computed, defineComponent, PropType, ref } from "vue";
69
-
70
- import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
71
- import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
72
-
73
- import FSSpan from "./FSSpan.vue";
74
- import FSIcon from "./FSIcon.vue";
75
- import FSRow from "./FSRow.vue";
76
-
77
- export default defineComponent({
78
- name: "FSButtonFile",
79
- components: {
80
- FSSpan,
81
- FSIcon,
82
- FSRow
83
- },
84
- props: {
85
- accept: {
86
- type: String,
87
- required: false,
88
- default: "",
89
- },
90
- readFile: {
91
- type: Boolean,
92
- required: false,
93
- default: true,
94
- },
95
- prependIcon: {
96
- type: String,
97
- required: false,
98
- default: null
99
- },
100
- label: {
101
- type: String,
102
- required: false,
103
- default: null
104
- },
105
- appendIcon: {
106
- type: String,
107
- required: false,
108
- default: null
109
- },
110
- icon: {
111
- type: String,
112
- required: false,
113
- default: null
114
- },
115
- variant: {
116
- type: String as PropType<"standard" | "full" | "icon">,
117
- required: false,
118
- default: "standard"
119
- },
120
- color: {
121
- type: String as PropType<ColorBase>,
122
- required: false,
123
- default: ColorEnum.Dark
124
- },
125
- editable: {
126
- type: Boolean,
127
- required: false,
128
- default: true
129
- }
130
- },
131
- emits: ["update:modelValue"],
132
- setup(props, { emit }) {
133
- const { getColors, getContrasts } = useColors();
134
- const { slots } = useSlots();
135
-
136
- const textColors = computed(() => getContrasts(props.color));
137
- const colors = computed(() => getColors(props.color));
138
- const lights = getColors(ColorEnum.Light);
139
-
140
- const input = ref(null);
141
-
142
- const isEmpty = computed(() => {
143
- return !slots.default && !props.label;
144
- });
145
-
146
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
147
- if (!props.editable) {
148
- switch (props.variant) {
149
- case "standard":
150
- case "full": return {
151
- "--fs-button-padding": !isEmpty.value ? "0 16px" : "0",
152
- "--fs-button-background-color": lights.base,
153
- "--fs-button-border-color": lights.dark,
154
- "--fs-button-color": lights.dark
155
- }
156
- case "icon": return {
157
- "--fs-button-color": lights.dark
158
- }
159
- }
160
- }
161
- switch (props.variant) {
162
- case "standard": return {
163
- "--fs-button-padding" : !isEmpty.value ? "0 16px" : "0",
164
- "--fs-button-background-color" : colors.value.light,
165
- "--fs-button-border-color" : colors.value.base,
166
- "--fs-button-color" : textColors.value.base,
167
- "--fs-button-hover-background-color" : colors.value.base,
168
- "--fs-button-hover-border-color" : colors.value.base,
169
- "--fs-button-hover-color" : textColors.value.light,
170
- "--fs-button-active-background-color": colors.value.dark,
171
- "--fs-button-active-border-color" : colors.value.dark,
172
- "--fs-button-active-color" : textColors.value.light
173
- };
174
- case "full": return {
175
- "--fs-button-padding" : !isEmpty.value ? "0 16px" : "0",
176
- "--fs-button-background-color" : colors.value.base,
177
- "--fs-button-border-color" : colors.value.base,
178
- "--fs-button-color" : textColors.value.light,
179
- "--fs-button-hover-background-color" : colors.value.base,
180
- "--fs-button-hover-border-color" : colors.value.base,
181
- "--fs-button-hover-color" : textColors.value.light,
182
- "--fs-button-active-background-color": colors.value.dark,
183
- "--fs-button-active-border-color" : colors.value.dark,
184
- "--fs-button-active-color" : textColors.value.light
185
- };
186
- case "icon": return {
187
- "--fs-button-color" : textColors.value.base,
188
- "--fs-button-hover-color": textColors.value.dark
189
- };
190
- }
191
- });
192
-
193
- const classes = computed((): string[] => {
194
- const classNames = [];
195
- if (!props.editable) {
196
- classNames.push("fs-button--disabled");
197
- }
198
- switch (props.variant) {
199
- case "icon":
200
- classNames.push("fs-button-icon");
201
- break;
202
- default:
203
- classNames.push("fs-button");
204
- break;
205
- }
206
- return classNames;
207
- });
208
-
209
- const clear = () => {
210
- input.value!.form && input.value!.form.reset();
211
- };
212
-
213
- const onClick = () => {
214
- input.value!.click();
215
- }
216
-
217
- const onInput = () => {
218
- const file = input.value!.files && input.value!.files[0];
219
- if (!file) {
220
- return;
221
- }
222
- if (!props.readFile) {
223
- emit("update:modelValue", file);
224
- clear();
225
- }
226
- else {
227
- const reader = new FileReader();
228
- reader.addEventListener("load", (fileEv) => {
229
- emit("update:modelValue", fileEv.target && fileEv.target.result);
230
- clear();
231
- });
232
- reader.readAsDataURL(file);
233
- }
234
- };
235
-
236
- return {
237
- colors,
238
- style,
239
- classes,
240
- input,
241
- onClick,
242
- onInput
243
- };
244
- }
245
- });
246
- </script>