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

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 (140) hide show
  1. package/{models/FSButtons.ts → aliases/FSButton.ts} +24 -21
  2. package/aliases/index.ts +1 -0
  3. package/components/FSAutocompleteField.vue +207 -0
  4. package/components/FSBadge.vue +38 -0
  5. package/components/FSBreadcrumbs.vue +49 -55
  6. package/components/FSButton.vue +116 -101
  7. package/components/FSCalendar.vue +52 -39
  8. package/components/FSCalendarTwin.vue +120 -102
  9. package/components/FSCard.vue +35 -21
  10. package/components/FSCarousel.vue +63 -0
  11. package/components/FSCheckbox.vue +111 -103
  12. package/components/FSChip.vue +140 -0
  13. package/components/FSClock.vue +149 -15
  14. package/components/FSCol.vue +104 -98
  15. package/components/FSColor.vue +61 -64
  16. package/components/FSColorIcon.vue +67 -0
  17. package/components/FSContainer.vue +64 -0
  18. package/components/FSDateField.vue +211 -0
  19. package/components/FSDateRangeField.vue +225 -0
  20. package/components/FSDateTimeField.vue +257 -0
  21. package/components/FSDateTimeRangeField.vue +286 -0
  22. package/components/FSDialog.vue +103 -0
  23. package/components/FSDivider.vue +39 -0
  24. package/components/FSFadeOut.vue +49 -59
  25. package/components/FSFileButton.vue +245 -0
  26. package/components/FSHeaderButton.vue +17 -0
  27. package/components/FSIcon.vue +23 -23
  28. package/components/FSIconField.vue +232 -0
  29. package/components/FSImage.vue +142 -0
  30. package/components/FSLoadTile.vue +93 -0
  31. package/components/FSNumberField.vue +51 -53
  32. package/components/FSPasswordField.vue +99 -101
  33. package/components/FSRadio.vue +107 -109
  34. package/components/FSRadioGroup.vue +55 -57
  35. package/components/FSRemoveDialog.vue +123 -0
  36. package/components/FSRichTextField.vue +26 -33
  37. package/components/FSRow.vue +110 -104
  38. package/components/FSSearchField.vue +35 -27
  39. package/components/FSSelectField.vue +188 -0
  40. package/components/FSSlideGroup.vue +45 -49
  41. package/components/FSSlider.vue +31 -33
  42. package/components/FSSpan.vue +53 -37
  43. package/components/FSSubmitDialog.vue +165 -0
  44. package/components/FSSwitch.vue +110 -109
  45. package/components/FSTab.vue +61 -61
  46. package/components/FSTabs.vue +53 -55
  47. package/components/FSTag.vue +88 -84
  48. package/components/FSTagField.vue +32 -36
  49. package/components/FSTagGroup.vue +38 -45
  50. package/components/FSText.vue +74 -64
  51. package/components/FSTextArea.vue +187 -185
  52. package/components/FSTextField.vue +18 -20
  53. package/components/FSTile.vue +90 -0
  54. package/components/FSToggleSet.vue +282 -0
  55. package/components/FSTooltip.vue +21 -0
  56. package/components/FSWindow.vue +26 -16
  57. package/components/FSWrapGroup.vue +44 -47
  58. package/components/deviceOrganisations/FSConnectivity.vue +114 -0
  59. package/components/deviceOrganisations/FSStatus.vue +117 -0
  60. package/components/deviceOrganisations/FSStatusesCarousel.vue +105 -0
  61. package/components/deviceOrganisations/FSStatusesRow.vue +66 -0
  62. package/components/deviceOrganisations/FSWorstAlert.vue +165 -0
  63. package/components/lists/FSDataIteratorGroup.vue +7 -0
  64. package/components/lists/FSDataIteratorItem.vue +103 -0
  65. package/components/lists/FSDataTableUI.vue +982 -0
  66. package/components/lists/FSFilterButton.vue +177 -0
  67. package/components/lists/FSHeaderButton.vue +99 -0
  68. package/components/lists/FSHiddenButton.vue +81 -0
  69. package/components/tiles/FSDeviceOrganisationTileUI.vue +232 -0
  70. package/components/tiles/FSGroupTileUI.vue +192 -0
  71. package/composables/index.ts +1 -1
  72. package/composables/useBreakpoints.ts +23 -4
  73. package/composables/useColors.ts +53 -23
  74. package/composables/useSlots.ts +43 -0
  75. package/index.ts +6 -0
  76. package/models/breadcrumbs.ts +8 -0
  77. package/models/colors.ts +17 -0
  78. package/models/deviceAlerts.ts +10 -0
  79. package/models/deviceConnectivities.ts +11 -0
  80. package/models/deviceStatuses.ts +16 -0
  81. package/models/index.ts +9 -0
  82. package/models/modelStatuses.ts +11 -0
  83. package/models/rules.ts +50 -0
  84. package/models/tables.ts +33 -0
  85. package/models/toggleSets.ts +7 -0
  86. package/package.json +6 -4
  87. package/plugins/colorPlugin.ts +2 -2
  88. package/shims-plugin.d.ts +1 -1
  89. package/styles/components/fs_autocomplete_field.scss +123 -0
  90. package/styles/components/fs_button.scss +4 -6
  91. package/styles/components/fs_calendar.scss +24 -1
  92. package/styles/components/fs_card.scss +2 -5
  93. package/styles/components/fs_carousel.scss +4 -0
  94. package/styles/components/fs_chip.scss +33 -0
  95. package/styles/components/fs_clock.scss +43 -0
  96. package/styles/components/fs_col.scss +2 -0
  97. package/styles/components/fs_color_icon.scss +37 -0
  98. package/styles/components/fs_container.scss +16 -0
  99. package/styles/components/fs_data_iterator_item.scss +19 -0
  100. package/styles/components/fs_data_table.scss +97 -0
  101. package/styles/components/fs_date_field.scss +8 -0
  102. package/styles/components/fs_dialog.scss +30 -0
  103. package/styles/components/fs_divider.scss +5 -0
  104. package/styles/components/fs_fade_out.scss +10 -2
  105. package/styles/components/fs_filter_button.scss +21 -0
  106. package/styles/components/fs_header_button.scss +4 -0
  107. package/styles/components/fs_hidden_button.scss +12 -0
  108. package/styles/components/fs_icon.scss +19 -3
  109. package/styles/components/fs_icon_field.scss +12 -0
  110. package/styles/components/fs_image.scss +7 -0
  111. package/styles/components/fs_load_tile.scss +49 -0
  112. package/styles/components/fs_password_field.scss +2 -2
  113. package/styles/components/fs_row.scss +4 -1
  114. package/styles/components/fs_select_field.scss +71 -0
  115. package/styles/components/fs_slide_group.scss +6 -0
  116. package/styles/components/fs_slider.scss +29 -9
  117. package/styles/components/fs_span.scss +8 -0
  118. package/styles/components/fs_submit_dialog.scss +9 -0
  119. package/styles/components/fs_tabs.scss +4 -0
  120. package/styles/components/fs_tag_field.scss +0 -11
  121. package/styles/components/fs_text_field.scss +23 -15
  122. package/styles/components/fs_tile.scss +33 -0
  123. package/styles/components/fs_tooltip.scss +5 -0
  124. package/styles/components/fs_wrap_group.scss +7 -8
  125. package/styles/components/index.scss +22 -1
  126. package/styles/globals/breakpoints.scss +7 -0
  127. package/styles/globals/overrides.scss +20 -7
  128. package/styles/globals/text_fonts.scss +8 -8
  129. package/themes/default.ts +1 -11
  130. package/utils/css.ts +11 -0
  131. package/utils/icons.ts +75416 -0
  132. package/utils/index.ts +5 -1
  133. package/utils/levenshtein.ts +97 -0
  134. package/utils/sort.ts +9 -0
  135. package/components/FSDatePicker.vue +0 -226
  136. package/composables/useDates.ts +0 -39
  137. package/models/FSTags.ts +0 -8
  138. package/models/FSTextFields.ts +0 -23
  139. package/styles/components/fs_date_picker.scss +0 -0
  140. /package/utils/{FSRichTextField.ts → lexical.ts} +0 -0
@@ -1,15 +1,19 @@
1
1
  <template>
2
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"
3
+ :label="$props.label"
4
+ :description="$props.description"
5
+ :color="$props.color"
6
+ :hideHeader="$props.hideHeader"
7
+ :required="$props.required"
8
+ :editable="$props.editable"
9
+ @keydown.enter="$emit('update:modelValue', innerValue)"
10
+ v-model="innerValue"
11
+ v-bind="$attrs"
11
12
  >
12
- <template #append>
13
+ <template
14
+ v-if="!$props.instant"
15
+ #append
16
+ >
13
17
  <slot name="append">
14
18
  <FSButton
15
19
  :prependIcon="$props.buttonPrependIcon"
@@ -18,7 +22,7 @@
18
22
  :variant="$props.buttonVariant"
19
23
  :color="$props.buttonColor"
20
24
  :editable="$props.editable"
21
- @click="onUpdate"
25
+ @click="$emit('update:modelValue', innerValue)"
22
26
  />
23
27
  </slot>
24
28
  </template>
@@ -29,20 +33,18 @@
29
33
  </template>
30
34
 
31
35
  <script lang="ts">
32
- import { defineComponent, PropType, Ref, ref, toRefs } from "vue";
36
+ import { defineComponent, PropType, ref, watch } from "vue";
33
37
 
34
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
38
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
35
39
 
36
40
  import FSTextField from "./FSTextField.vue";
37
41
  import FSButton from "./FSButton.vue";
38
- import FSIcon from "./FSIcon.vue";
39
42
 
40
43
  export default defineComponent({
41
44
  name: "FSSearchField",
42
45
  components: {
43
46
  FSTextField,
44
- FSButton,
45
- FSIcon
47
+ FSButton
46
48
  },
47
49
  props: {
48
50
  label: {
@@ -83,12 +85,22 @@ export default defineComponent({
83
85
  color: {
84
86
  type: String as PropType<ColorBase>,
85
87
  required: false,
86
- default: ColorBase.Dark
88
+ default: ColorEnum.Dark
87
89
  },
88
90
  buttonColor: {
89
91
  type: String as PropType<ColorBase>,
90
92
  required: false,
91
- default: ColorBase.Primary
93
+ default: ColorEnum.Primary
94
+ },
95
+ hideHeader: {
96
+ type: Boolean,
97
+ required: false,
98
+ default: false
99
+ },
100
+ instant: {
101
+ type: Boolean,
102
+ required: false,
103
+ default: true
92
104
  },
93
105
  required: {
94
106
  type: Boolean,
@@ -103,20 +115,16 @@ export default defineComponent({
103
115
  },
104
116
  emits: ["update:modelValue"],
105
117
  setup(props, { emit }) {
106
- const { editable } = toRefs(props);
118
+ const innerValue = ref(props.modelValue);
107
119
 
108
- const innerValue: Ref<String> = ref(props.modelValue);
109
-
110
- const onUpdate = (): void => {
111
- if (!editable.value) {
112
- return;
120
+ watch(innerValue, () => {
121
+ if (props.instant) {
122
+ emit("update:modelValue", innerValue.value);
113
123
  }
114
- emit("update:modelValue", innerValue.value);
115
- };
124
+ });
116
125
 
117
126
  return {
118
- innerValue,
119
- onUpdate
127
+ innerValue
120
128
  };
121
129
  }
122
130
  });
@@ -0,0 +1,188 @@
1
+ <template>
2
+ <FSCol>
3
+ <slot v-if="!$props.hideHeader" name="label">
4
+ <FSRow :wrap="false">
5
+ <FSSpan
6
+ v-if="$props.label"
7
+ class="fs-select-field-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-select-field-label"
16
+ style="margin-left: -8px;"
17
+ font="text-overline"
18
+ :ellipsis="false"
19
+ :style="style"
20
+ >
21
+ *
22
+ </FSSpan>
23
+ <v-spacer style="min-width: 40px;" />
24
+ <FSSpan
25
+ v-if="messages.length > 0"
26
+ class="fs-select-field-messages"
27
+ font="text-overline"
28
+ :style="style"
29
+ >
30
+ {{ messages.join(", ") }}
31
+ </FSSpan>
32
+ </FSRow>
33
+ </slot>
34
+ <v-select
35
+ class="fs-select-field"
36
+ menuIcon="mdi-chevron-down"
37
+ clearIcon="mdi-close"
38
+ variant="outlined"
39
+ :hideDetails="true"
40
+ :items="$props.items"
41
+ :itemTitle="$props.itemTitle"
42
+ :itemValue="$props.itemValue"
43
+ :readonly="!$props.editable"
44
+ :clearable="$props.editable && $props.clearable"
45
+ :error="messages.length > 0"
46
+ :style="style"
47
+ :modelValue="$props.modelValue"
48
+ @update:modelValue="(value) => $emit('update:modelValue', value)"
49
+ v-bind="$attrs"
50
+ >
51
+ <template v-for="(_, name) in slots" v-slot:[name]="slotData">
52
+ <slot :name="name" v-bind="slotData" />
53
+ </template>
54
+ </v-select>
55
+ <slot name="description">
56
+ <FSSpan
57
+ v-if="$props.description"
58
+ class="fs-select-field-description"
59
+ font="text-underline"
60
+ :style="style"
61
+ >
62
+ {{ $props.description }}
63
+ </FSSpan>
64
+ </slot>
65
+ </FSCol>
66
+ </template>
67
+
68
+ <script lang="ts">
69
+ import { computed, defineComponent, PropType } from "vue";
70
+
71
+ import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
72
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
73
+
74
+ import FSSpan from "./FSSpan.vue";
75
+ import FSCol from "./FSCol.vue";
76
+ import FSRow from "./FSRow.vue";
77
+
78
+ export default defineComponent({
79
+ name: "FSSelectField",
80
+ components: {
81
+ FSSpan,
82
+ FSCol,
83
+ FSRow
84
+ },
85
+ props: {
86
+ label: {
87
+ type: String,
88
+ required: false,
89
+ default: null
90
+ },
91
+ description: {
92
+ type: String,
93
+ required: false,
94
+ default: null
95
+ },
96
+ items: {
97
+ type: Array as PropType<any[]>,
98
+ required: true
99
+ },
100
+ itemValue: {
101
+ type: String,
102
+ required: false,
103
+ default: "id"
104
+ },
105
+ itemTitle: {
106
+ type: String,
107
+ required: false,
108
+ default: "label"
109
+ },
110
+ modelValue: {
111
+ type: [Array, String, Number] as PropType<(string | number)[] | string | number>,
112
+ required: false,
113
+ default: null
114
+ },
115
+ hideHeader: {
116
+ type: Boolean,
117
+ required: false,
118
+ default: false
119
+ },
120
+ required: {
121
+ type: Boolean,
122
+ required: false,
123
+ default: false
124
+ },
125
+ clearable: {
126
+ type: Boolean,
127
+ required: false,
128
+ default: true
129
+ },
130
+ rules: {
131
+ type: Array as PropType<Function[]>,
132
+ required: false,
133
+ default: () => []
134
+ },
135
+ editable: {
136
+ type: Boolean,
137
+ required: false,
138
+ default: true
139
+ }
140
+ },
141
+ emits: ["update:modelValue"],
142
+ setup(props) {
143
+ const { slots } = useSlots();
144
+ delete slots.label;
145
+ delete slots.description;
146
+
147
+ const errors = useColors().getColors(ColorEnum.Error);
148
+ const lights = useColors().getColors(ColorEnum.Light);
149
+ const darks = useColors().getColors(ColorEnum.Dark);
150
+
151
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
152
+ if (!props.editable) {
153
+ return {
154
+ "--fs-select-field-cursor" : "default",
155
+ "--fs-select-field-border-color" : lights.base,
156
+ "--fs-select-field-color" : lights.dark,
157
+ "--fs-select-field-active-border-color": lights.base
158
+ };
159
+ }
160
+ return {
161
+ "--fs-select-field-cursor" : "pointer",
162
+ "--fs-select-field-border-color" : lights.dark,
163
+ "--fs-select-field-color" : darks.base,
164
+ "--fs-select-field-active-border-color": darks.dark,
165
+ "--fs-select-field-error-color" : errors.base,
166
+ "--fs-select-field-error-border-color" : errors.base
167
+ };
168
+ });
169
+
170
+ const messages = computed((): string[] => {
171
+ const messages = [];
172
+ for (const rule of props.rules) {
173
+ const message = rule(props.modelValue ?? "");
174
+ if (typeof(message) === "string") {
175
+ messages.push(message);
176
+ }
177
+ }
178
+ return messages;
179
+ });
180
+
181
+ return {
182
+ messages,
183
+ slots,
184
+ style
185
+ };
186
+ }
187
+ });
188
+ </script>
@@ -1,61 +1,57 @@
1
1
  <template>
2
- <v-slide-group
3
- class="fs-slide-group"
4
- show-arrows
5
- :style="style"
6
- v-bind="$attrs"
2
+ <v-slide-group
3
+ class="fs-slide-group"
4
+ :showArrows="true"
5
+ :style="style"
6
+ v-bind="$attrs"
7
+ >
8
+ <v-slide-group-item
9
+ v-for="(component, index) in getChildren()"
10
+ :key="index"
7
11
  >
8
- <FSRow>
9
- <v-slide-group-item v-for="(component, index) in $slots.default()" :key="index">
10
- <component :is="component" v-bind="{ color, colors, style }" />
11
- </v-slide-group-item>
12
- </FSRow>
13
- </v-slide-group>
12
+ <component :is="component" />
13
+ </v-slide-group-item>
14
+ </v-slide-group>
14
15
  </template>
15
16
 
16
17
  <script lang="ts">
17
- import { defineComponent, PropType, Ref, ref, toRefs } from "vue";
18
+ import { computed, defineComponent } from "vue";
18
19
 
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";
20
+ import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
21
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
23
22
 
24
23
  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
- }
24
+ name: "FSSlideGroup",
25
+ props: {
26
+ padding: {
27
+ type: [String, Number],
28
+ required: false,
29
+ default: 0
35
30
  },
36
- setup(props) {
37
- const { color } = toRefs(props);
38
-
39
- const textColors = useColors().getContrasts(color.value);
40
- const colors = useColors().getColors(color.value);
41
-
42
- const darks = useColors().getColors(ColorBase.Dark);
43
-
44
- const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
45
- "--fs-group-color": darks.base,
46
- "--fs-group-hover-background-color": colors.light,
47
- "--fs-group-hover-color": darks.dark,
48
- "--fs-group-disabled-color": darks.light,
49
- "--fs-group-light": colors.light,
50
- "--fs-group-base": colors.base,
51
- "--fs-group-dark": colors.dark
52
- });
53
-
54
- return {
55
- color,
56
- colors,
57
- style
58
- };
31
+ gap: {
32
+ type: Number,
33
+ required: false,
34
+ default: 8
59
35
  }
36
+ },
37
+ setup(props) {
38
+ const { getChildren } = useSlots();
39
+
40
+ const darks = useColors().getColors(ColorEnum.Dark);
41
+
42
+ const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
43
+ return {
44
+ "--fs-group-padding" : typeof(props.padding) === "string" ? props.padding : `${props.padding}px`,
45
+ "--fs-group-gap" : `${props.gap}px`,
46
+ "--fs-group-color" : darks.light,
47
+ "--fs-group-hover-color": darks.dark
48
+ }
49
+ });
50
+
51
+ return {
52
+ style,
53
+ getChildren
54
+ };
55
+ }
60
56
  });
61
57
  </script>
@@ -24,13 +24,17 @@
24
24
  </slot>
25
25
  <v-slider
26
26
  class="fs-slider"
27
- :ripple="false"
27
+ hide-details
28
+ :tickSize="4"
28
29
  :style="style"
29
30
  :elevation="0"
30
- no-details
31
+ :ripple="false"
32
+ :disabled="!$props.editable"
33
+ :modelValue="$props.modelValue"
34
+ @update:modelValue="(value) => $emit('update:modelValue', value)"
31
35
  v-bind="$attrs"
32
36
  >
33
- <template v-for="(_, name) in slots" v-slot:[name]="slotData">
37
+ <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
34
38
  <slot :name="name" v-bind="slotData" />
35
39
  </template>
36
40
  </v-slider>
@@ -48,26 +52,26 @@
48
52
  </template>
49
53
 
50
54
  <script lang="ts">
51
- import { computed, defineComponent, PropType, toRefs } from "vue";
55
+ import { computed, defineComponent, PropType } from "vue";
52
56
 
57
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
53
58
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
54
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
55
59
 
56
60
  import FSSpan from "./FSSpan.vue";
57
61
  import FSCol from "./FSCol.vue";
58
62
  import FSRow from "./FSRow.vue";
59
63
 
60
64
  export default defineComponent({
61
- name: "FSSlider",
62
- components: {
65
+ name: "FSSlider",
66
+ components: {
63
67
  FSSpan,
64
68
  FSCol,
65
69
  FSRow
66
- },
67
- props: {
70
+ },
71
+ props: {
68
72
  label: {
69
73
  type: String,
70
- required: true,
74
+ required: false,
71
75
  default: null
72
76
  },
73
77
  description: {
@@ -76,14 +80,14 @@ export default defineComponent({
76
80
  default: null
77
81
  },
78
82
  modelValue: {
79
- type: String,
83
+ type: [String, Number],
80
84
  required: false,
81
85
  default: null
82
86
  },
83
87
  color: {
84
88
  type: String as PropType<ColorBase>,
85
89
  required: false,
86
- default: ColorBase.Dark
90
+ default: ColorEnum.Dark
87
91
  },
88
92
  required: {
89
93
  type: Boolean,
@@ -95,38 +99,32 @@ export default defineComponent({
95
99
  required: false,
96
100
  default: true
97
101
  }
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);
102
+ },
103
+ setup(props) {
104
+ const colors = computed(() => useColors().getColors(props.color));
105
+ const lights = useColors().getColors(ColorEnum.Light);
106
+ const darks = useColors().getColors(ColorEnum.Dark);
107
107
 
108
108
  const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
109
- if (!editable.value) {
109
+ if (!props.editable) {
110
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
111
+ "--fs-slider-cursor" : "default",
112
+ "--fs-slider-track-color": lights.base,
113
+ "--fs-slider-thumb-color": lights.base,
114
+ "--fs-slider-color" : lights.dark
115
115
  };
116
116
  }
117
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
118
+ "--fs-slider-cursor" : "pointer",
119
+ "--fs-slider-track-color": colors.value.light,
120
+ "--fs-slider-thumb-color": colors.value.base,
121
+ "--fs-slider-color" : darks.base
124
122
  };
125
123
  });
126
124
 
127
125
  return {
128
126
  style
129
127
  };
130
- }
128
+ }
131
129
  });
132
130
  </script>
@@ -1,48 +1,64 @@
1
1
  <template>
2
- <span
3
- :class="classes"
4
- v-bind="$attrs"
5
- >
6
- <slot />
7
- </span>
2
+ <span
3
+ :class="classes"
4
+ :style="style"
5
+ v-bind="$attrs"
6
+ >
7
+ <slot />
8
+ </span>
8
9
  </template>
9
10
 
10
11
  <script lang="ts">
11
- import { computed, defineComponent, PropType, toRefs, useSlots } from "vue";
12
+ import { computed, defineComponent, PropType } from "vue";
13
+
14
+ import { useSlots } from "@dative-gpi/foundation-shared-components/composables";
12
15
 
13
16
  export default defineComponent({
14
- name: "FSSpan",
15
- props: {
16
- font: {
17
- type: String as PropType<"text-h1" | "text-h2" | "text-h3" | "text-body" | "text-button" | "text-overline" | "text-underline">,
18
- required: false,
19
- default: "text-body"
20
- },
21
- ellipsis: {
22
- type: Boolean,
23
- required: false,
24
- default: true
25
- }
17
+ name: "FSSpan",
18
+ props: {
19
+ font: {
20
+ type: String as PropType<"text-h1" | "text-h2" | "text-h3" | "text-body" | "text-button" | "text-overline" | "text-underline">,
21
+ required: false,
22
+ default: "text-body"
23
+ },
24
+ lineClamp: {
25
+ type: Number,
26
+ required: false,
27
+ default: 1
26
28
  },
27
- setup(props) {
28
- const { font } = toRefs(props);
29
-
30
- const slots = useSlots();
29
+ ellipsis: {
30
+ type: Boolean,
31
+ required: false,
32
+ default: true
33
+ }
34
+ },
35
+ setup(props) {
36
+ const { slots } = useSlots();
31
37
 
32
- const classes = computed((): string[] => {
33
- const classes = ["fs-span", font.value];
34
- if (props.ellipsis) {
35
- classes.push("fs-span-ellipsis");
36
- }
37
- if (!slots.default) {
38
- classes.push("fs-span-pre-wrap");
39
- }
40
- return classes;
41
- });
38
+ const classes = computed((): string[] => {
39
+ const classNames = ["fs-span", props.font];
40
+ if (!slots.default) {
41
+ classNames.push("fs-span-pre-wrap");
42
+ }
43
+ if (props.lineClamp > 1) {
44
+ classNames.push("fs-span-line-clamp");
45
+ }
46
+ else if (props.ellipsis) {
47
+ classNames.push("fs-span-ellipsis");
48
+ }
49
+ return classNames;
50
+ });
42
51
 
43
- return {
44
- classes
45
- };
46
- }
52
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
53
+ return {
54
+ "--fs-span-line-clamp": props.lineClamp.toString()
55
+ };
56
+ });
57
+
58
+ return {
59
+ classes,
60
+ style
61
+ };
62
+ }
47
63
  });
48
64
  </script>