@dative-gpi/foundation-shared-components 0.0.6 → 0.0.8

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 (37) hide show
  1. package/components/FSButton.vue +170 -164
  2. package/components/FSCalendar.vue +171 -0
  3. package/components/FSCalendarTwin.vue +394 -0
  4. package/components/FSCard.vue +63 -0
  5. package/components/FSCheckbox.vue +7 -8
  6. package/components/FSClock.vue +38 -0
  7. package/components/FSDatePicker.vue +226 -0
  8. package/components/FSIcon.vue +1 -1
  9. package/components/FSNumberField.vue +4 -4
  10. package/components/FSPasswordField.vue +14 -12
  11. package/components/FSRadio.vue +0 -1
  12. package/components/FSRadioGroup.vue +6 -6
  13. package/components/FSRichTextField.vue +558 -0
  14. package/components/FSSearchField.vue +103 -102
  15. package/components/FSSlider.vue +132 -0
  16. package/components/FSSwitch.vue +9 -9
  17. package/components/FSTagField.vue +186 -127
  18. package/components/FSTextArea.vue +207 -0
  19. package/components/FSTextField.vue +151 -146
  20. package/composables/index.ts +2 -1
  21. package/composables/useBreakpoints.ts +14 -0
  22. package/composables/useDates.ts +39 -0
  23. package/models/FSTextFields.ts +12 -6
  24. package/package.json +12 -4
  25. package/styles/components/fs_button.scss +2 -10
  26. package/styles/components/fs_calendar.scss +115 -0
  27. package/styles/components/fs_card.scss +7 -0
  28. package/styles/components/fs_date_picker.scss +0 -0
  29. package/styles/components/fs_icon.scss +3 -9
  30. package/styles/components/fs_rich_text_field.scss +67 -0
  31. package/styles/components/fs_slider.scss +20 -0
  32. package/styles/components/fs_tag_field.scss +9 -0
  33. package/styles/components/fs_text_area.scss +105 -0
  34. package/styles/components/index.scss +6 -0
  35. package/utils/FSRichTextField.ts +27 -0
  36. package/utils/index.ts +1 -0
  37. package/composables/useTouch.ts +0 -9
@@ -1,30 +1,31 @@
1
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="innerValue"
10
- @update:value="(value) => innerValue = value"
11
- v-bind="$attrs"
12
- >
13
- <template #append>
14
- <FSButton
15
- :prependIcon="$props.buttonPrependIcon"
16
- :label="$props.buttonLabel"
17
- :appendIcon="$props.buttonAppendIcon"
18
- :variant="$props.buttonVariant"
19
- :color="$props.buttonColor"
20
- :editable="$props.editable"
21
- @click="onUpdate"
22
- />
23
- </template>
24
- <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
25
- <slot :name="name" v-bind="slotData" />
26
- </template>
27
- </FSTextField>
2
+ <FSTextField
3
+ :label="$props.label"
4
+ :description="$props.description"
5
+ :color="$props.color"
6
+ :required="$props.required"
7
+ :editable="$props.editable"
8
+ :modelValue="innerValue"
9
+ @update:modelValue="(value) => innerValue = value"
10
+ v-bind="$attrs"
11
+ >
12
+ <template #append>
13
+ <slot name="append">
14
+ <FSButton
15
+ :prependIcon="$props.buttonPrependIcon"
16
+ :label="$props.buttonLabel"
17
+ :appendIcon="$props.buttonAppendIcon"
18
+ :variant="$props.buttonVariant"
19
+ :color="$props.buttonColor"
20
+ :editable="$props.editable"
21
+ @click="onUpdate"
22
+ />
23
+ </slot>
24
+ </template>
25
+ <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
26
+ <slot :name="name" v-bind="slotData" />
27
+ </template>
28
+ </FSTextField>
28
29
  </template>
29
30
 
30
31
  <script lang="ts">
@@ -37,86 +38,86 @@ import FSButton from "./FSButton.vue";
37
38
  import FSIcon from "./FSIcon.vue";
38
39
 
39
40
  export default defineComponent({
40
- name: "FSSearchField",
41
- components: {
42
- FSTextField,
43
- FSButton,
44
- FSIcon
41
+ name: "FSSearchField",
42
+ components: {
43
+ FSTextField,
44
+ FSButton,
45
+ FSIcon
46
+ },
47
+ props: {
48
+ label: {
49
+ type: String,
50
+ required: false,
51
+ default: null
45
52
  },
46
- props: {
47
- label: {
48
- type: String,
49
- required: false,
50
- default: null
51
- },
52
- description: {
53
- type: String,
54
- required: false,
55
- default: null
56
- },
57
- buttonPrependIcon: {
58
- type: String,
59
- required: false,
60
- default: "mdi-magnify"
61
- },
62
- buttonLabel: {
63
- type: String,
64
- required: false,
65
- default: null
66
- },
67
- buttonAppendIcon: {
68
- type: String,
69
- required: false,
70
- default: null
71
- },
72
- buttonVariant: {
73
- type: String as PropType<"standard" | "full" | "icon">,
74
- required: false,
75
- default: "standard"
76
- },
77
- value: {
78
- type: String,
79
- required: false,
80
- default: null
81
- },
82
- color: {
83
- type: String as PropType<ColorBase>,
84
- required: false,
85
- default: ColorBase.Dark
86
- },
87
- buttonColor: {
88
- type: String as PropType<ColorBase>,
89
- required: false,
90
- default: ColorBase.Primary
91
- },
92
- required: {
93
- type: Boolean,
94
- required: false,
95
- default: false
96
- },
97
- editable: {
98
- type: Boolean,
99
- required: false,
100
- default: true
101
- }
53
+ description: {
54
+ type: String,
55
+ required: false,
56
+ default: null
102
57
  },
103
- emits: ["update:value"],
104
- setup(props, { emit }) {
105
- const { editable } = toRefs(props);
58
+ buttonPrependIcon: {
59
+ type: String,
60
+ required: false,
61
+ default: "mdi-magnify"
62
+ },
63
+ buttonLabel: {
64
+ type: String,
65
+ required: false,
66
+ default: null
67
+ },
68
+ buttonAppendIcon: {
69
+ type: String,
70
+ required: false,
71
+ default: null
72
+ },
73
+ buttonVariant: {
74
+ type: String as PropType<"standard" | "full" | "icon">,
75
+ required: false,
76
+ default: "standard"
77
+ },
78
+ modelValue: {
79
+ type: String,
80
+ required: false,
81
+ default: null
82
+ },
83
+ color: {
84
+ type: String as PropType<ColorBase>,
85
+ required: false,
86
+ default: ColorBase.Dark
87
+ },
88
+ buttonColor: {
89
+ type: String as PropType<ColorBase>,
90
+ required: false,
91
+ default: ColorBase.Primary
92
+ },
93
+ required: {
94
+ type: Boolean,
95
+ required: false,
96
+ default: false
97
+ },
98
+ editable: {
99
+ type: Boolean,
100
+ required: false,
101
+ default: true
102
+ }
103
+ },
104
+ emits: ["update:modelValue"],
105
+ setup(props, { emit }) {
106
+ const { editable } = toRefs(props);
106
107
 
107
- const innerValue: Ref<String> = ref(props.value);
108
+ const innerValue: Ref<String> = ref(props.modelValue);
108
109
 
109
- const onUpdate = (): void => {
110
- if (!editable.value) {
111
- return;
112
- }
113
- emit("update:value", innerValue.value);
114
- };
110
+ const onUpdate = (): void => {
111
+ if (!editable.value) {
112
+ return;
113
+ }
114
+ emit("update:modelValue", innerValue.value);
115
+ };
115
116
 
116
- return {
117
- innerValue,
118
- onUpdate
119
- };
120
- }
117
+ return {
118
+ innerValue,
119
+ onUpdate
120
+ };
121
+ }
121
122
  });
122
123
  </script>
@@ -0,0 +1,132 @@
1
+ <template>
2
+ <FSCol>
3
+ <slot name="label">
4
+ <FSRow :wrap="false">
5
+ <FSSpan
6
+ v-if="$props.label"
7
+ class="fs-slider-label"
8
+ font="text-overline"
9
+ :style="style"
10
+ >
11
+ {{ $props.label }}
12
+ </FSSpan>
13
+ <FSSpan
14
+ v-if="$props.label && $props.required"
15
+ class="fs-slider-label"
16
+ style="margin-left: -8px;"
17
+ font="text-overline"
18
+ :ellipsis="false"
19
+ :style="style"
20
+ >
21
+ *
22
+ </FSSpan>
23
+ </FSRow>
24
+ </slot>
25
+ <v-slider
26
+ class="fs-slider"
27
+ :ripple="false"
28
+ :style="style"
29
+ :elevation="0"
30
+ no-details
31
+ v-bind="$attrs"
32
+ >
33
+ <template v-for="(_, name) in slots" v-slot:[name]="slotData">
34
+ <slot :name="name" v-bind="slotData" />
35
+ </template>
36
+ </v-slider>
37
+ <slot name="description">
38
+ <FSSpan
39
+ v-if="$props.description"
40
+ class="fs-slider-description"
41
+ font="text-underline"
42
+ :style="style"
43
+ >
44
+ {{ $props.description }}
45
+ </FSSpan>
46
+ </slot>
47
+ </FSCol>
48
+ </template>
49
+
50
+ <script lang="ts">
51
+ import { computed, defineComponent, PropType, toRefs } from "vue";
52
+
53
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
54
+ import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
55
+
56
+ import FSSpan from "./FSSpan.vue";
57
+ import FSCol from "./FSCol.vue";
58
+ import FSRow from "./FSRow.vue";
59
+
60
+ export default defineComponent({
61
+ name: "FSSlider",
62
+ components: {
63
+ FSSpan,
64
+ FSCol,
65
+ FSRow
66
+ },
67
+ props: {
68
+ label: {
69
+ type: String,
70
+ required: true,
71
+ default: null
72
+ },
73
+ description: {
74
+ type: String,
75
+ required: false,
76
+ default: null
77
+ },
78
+ modelValue: {
79
+ type: String,
80
+ required: false,
81
+ default: null
82
+ },
83
+ color: {
84
+ type: String as PropType<ColorBase>,
85
+ required: false,
86
+ default: ColorBase.Dark
87
+ },
88
+ required: {
89
+ type: Boolean,
90
+ required: false,
91
+ default: false
92
+ },
93
+ editable: {
94
+ type: Boolean,
95
+ required: false,
96
+ default: true
97
+ }
98
+ },
99
+ setup(props) {
100
+ const { color, editable } = toRefs(props);
101
+
102
+ const colors = useColors().getColors(color.value);
103
+
104
+ const errors = useColors().getColors(ColorBase.Error);
105
+ const lights = useColors().getColors(ColorBase.Light);
106
+ const darks = useColors().getColors(ColorBase.Dark);
107
+
108
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
109
+ if (!editable.value) {
110
+ return {
111
+ "--fs-text-field-cursor" : "default",
112
+ "--fs-text-field-border-color" : lights.base,
113
+ "--fs-text-field-color" : lights.dark,
114
+ "--fs-text-field-active-border-color": lights.base
115
+ };
116
+ }
117
+ return {
118
+ "--fs-text-field-cursor" : "text",
119
+ "--fs-text-field-border-color" : colors.base,
120
+ "--fs-text-field-color" : darks.base,
121
+ "--fs-text-field-active-border-color": colors.dark,
122
+ "--fs-text-field-error-color" : errors.base,
123
+ "--fs-text-field-error-border-color" : errors.base
124
+ };
125
+ });
126
+
127
+ return {
128
+ style
129
+ };
130
+ }
131
+ });
132
+ </script>
@@ -7,7 +7,7 @@
7
7
  inset
8
8
  :style="style"
9
9
  :ripple="false"
10
- :modelValue="$props.value"
10
+ :modelValue="$props.modelValue"
11
11
  @update:modelValue="onToggle"
12
12
  v-bind="$attrs"
13
13
  />
@@ -64,7 +64,7 @@ export default defineComponent({
64
64
  required: false,
65
65
  default: null
66
66
  },
67
- value: {
67
+ modelValue: {
68
68
  type: Boolean,
69
69
  required: false,
70
70
  default: false
@@ -80,9 +80,9 @@ export default defineComponent({
80
80
  default: true
81
81
  }
82
82
  },
83
- emits: ["update:value"],
83
+ emits: ["update:modelValue"],
84
84
  setup(props, { emit }) {
85
- const { value, color, editable } = toRefs(props);
85
+ const { modelValue, color, editable } = toRefs(props);
86
86
 
87
87
  const colors = useColors().getColors(color.value);
88
88
 
@@ -93,7 +93,7 @@ export default defineComponent({
93
93
  const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
94
94
  if (!editable.value) {
95
95
  return {
96
- "--fs-switch-translate-x": value.value ? "8px" : "-8px",
96
+ "--fs-switch-translate-x": modelValue.value ? "8px" : "-8px",
97
97
  "--fs-switch-cursor": "default",
98
98
  "--fs-switch-track-color": lights.dark,
99
99
  "--fs-switch-thumb-color": backgrounds.base,
@@ -101,21 +101,21 @@ export default defineComponent({
101
101
  };
102
102
  }
103
103
  return {
104
- "--fs-switch-translate-x": value.value ? "8px" : "-8px",
104
+ "--fs-switch-translate-x": modelValue.value ? "8px" : "-8px",
105
105
  "--fs-switch-cursor": "pointer",
106
- "--fs-switch-track-color": value.value ? colors.base : darks.base,
106
+ "--fs-switch-track-color": modelValue.value ? colors.base : darks.base,
107
107
  "--fs-switch-thumb-color": backgrounds.base,
108
108
  "--fs-switch-color": darks.base
109
109
  };
110
110
  });
111
111
 
112
- const font = computed((): string => value.value ? "text-button" : "text-body");
112
+ const font = computed((): string => modelValue.value ? "text-button" : "text-body");
113
113
 
114
114
  const onToggle = (): void => {
115
115
  if (!editable.value) {
116
116
  return;
117
117
  }
118
- emit("update:value", !value.value);
118
+ emit("update:modelValue", !modelValue.value);
119
119
  }
120
120
 
121
121
  return {