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

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 (139) 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 +184 -0
  8. package/components/FSCalendarTwin.vue +412 -0
  9. package/components/FSCard.vue +77 -0
  10. package/components/FSCarousel.vue +63 -0
  11. package/components/FSCheckbox.vue +111 -104
  12. package/components/FSChip.vue +140 -0
  13. package/components/FSClock.vue +172 -0
  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 -99
  33. package/components/FSRadio.vue +107 -110
  34. package/components/FSRadioGroup.vue +55 -57
  35. package/components/FSRemoveDialog.vue +123 -0
  36. package/components/FSRichTextField.vue +551 -0
  37. package/components/FSRow.vue +110 -104
  38. package/components/FSSearchField.vue +114 -105
  39. package/components/FSSelectField.vue +188 -0
  40. package/components/FSSlideGroup.vue +45 -49
  41. package/components/FSSlider.vue +130 -0
  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 +183 -128
  49. package/components/FSTagGroup.vue +38 -45
  50. package/components/FSText.vue +74 -64
  51. package/components/FSTextArea.vue +209 -0
  52. package/components/FSTextField.vue +152 -149
  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/FSDataTable.vue +964 -0
  66. package/components/lists/FSFilterButton.vue +176 -0
  67. package/components/lists/FSHeaderButton.vue +99 -0
  68. package/components/lists/FSHiddenButton.vue +79 -0
  69. package/components/tiles/FSDeviceOrganisationTileUI.vue +232 -0
  70. package/components/tiles/FSGroupTileUI.vue +192 -0
  71. package/composables/index.ts +2 -1
  72. package/composables/useBreakpoints.ts +33 -0
  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/dispositions.ts +33 -0
  82. package/models/index.ts +9 -0
  83. package/models/modelStatuses.ts +11 -0
  84. package/models/rules.ts +50 -0
  85. package/models/toggleSets.ts +7 -0
  86. package/package.json +13 -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 -14
  91. package/styles/components/fs_calendar.scss +138 -0
  92. package/styles/components/fs_card.scss +4 -0
  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 +12 -0
  106. package/styles/components/fs_header_button.scss +4 -0
  107. package/styles/components/fs_icon.scss +14 -4
  108. package/styles/components/fs_icon_field.scss +12 -0
  109. package/styles/components/fs_image.scss +7 -0
  110. package/styles/components/fs_load_tile.scss +49 -0
  111. package/styles/components/fs_password_field.scss +2 -2
  112. package/styles/components/fs_rich_text_field.scss +67 -0
  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 +40 -0
  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 +6 -8
  121. package/styles/components/fs_text_area.scss +105 -0
  122. package/styles/components/fs_text_field.scss +23 -15
  123. package/styles/components/fs_tile.scss +33 -0
  124. package/styles/components/fs_tooltip.scss +5 -0
  125. package/styles/components/fs_wrap_group.scss +7 -8
  126. package/styles/components/index.scss +26 -0
  127. package/styles/globals/breakpoints.scss +7 -0
  128. package/styles/globals/overrides.scss +20 -7
  129. package/styles/globals/text_fonts.scss +8 -8
  130. package/themes/default.ts +1 -11
  131. package/utils/css.ts +11 -0
  132. package/utils/icons.ts +75416 -0
  133. package/utils/index.ts +5 -0
  134. package/utils/levenshtein.ts +97 -0
  135. package/utils/lexical.ts +27 -0
  136. package/utils/sort.ts +9 -0
  137. package/composables/useTouch.ts +0 -9
  138. package/models/FSTags.ts +0 -8
  139. package/models/FSTextFields.ts +0 -17
@@ -1,115 +1,121 @@
1
1
  <template>
2
- <div
3
- :style="style"
4
- :class="classes"
5
- v-bind="$attrs"
6
- >
7
- <slot />
8
- </div>
2
+ <div
3
+ :style="style"
4
+ :class="classes"
5
+ v-bind="$attrs"
6
+ >
7
+ <slot />
8
+ </div>
9
9
  </template>
10
10
 
11
11
  <script lang="ts">
12
- import { computed, defineComponent, PropType, toRefs } from "vue";
12
+ import { computed, defineComponent, PropType } from "vue";
13
+
14
+ import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
13
15
 
14
16
  export default defineComponent({
15
- name: "FSRow",
16
- props: {
17
- width: {
18
- type: String as PropType<"hug" | "fill" | string>,
19
- required: false,
20
- default: "fill"
21
- },
22
- height: {
23
- type: String as PropType<"hug" | "fill" | string>,
24
- required: false,
25
- default: "hug"
26
- },
27
- align: {
28
- type: String as PropType<"top-left" | "top-center" | "top-right" | "center-left" | "center-center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right">,
29
- required: false,
30
- default: "top-left"
31
- },
32
- wrap: {
33
- type: Boolean,
34
- required: false,
35
- default: true
36
- },
37
- gap: {
38
- type: Number,
39
- required: false,
40
- default: 8
41
- }
17
+ name: "FSRow",
18
+ props: {
19
+ width: {
20
+ type: String as PropType<"hug" | "fill" | string>,
21
+ required: false,
22
+ default: "fill"
23
+ },
24
+ height: {
25
+ type: String as PropType<"hug" | "fill" | string>,
26
+ required: false,
27
+ default: "hug"
28
+ },
29
+ align: {
30
+ type: String as PropType<"top-left" | "top-center" | "top-right" | "center-left" | "center-center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right">,
31
+ required: false,
32
+ default: "top-left"
33
+ },
34
+ wrap: {
35
+ type: Boolean,
36
+ required: false,
37
+ default: true
42
38
  },
43
- setup(props) {
44
- const { width, height, align, wrap, gap } = toRefs(props);
45
-
46
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => ({
47
- "--fs-row-flex-wrap": wrap.value ? "wrap" : "nowrap",
48
- "--fs-row-gap": `${gap.value}px`,
49
- "--fs-row-width": width.value,
50
- "--fs-row-height": height.value
51
- }));
39
+ padding: {
40
+ type: [String, Number],
41
+ required: false,
42
+ default: "0"
43
+ },
44
+ gap: {
45
+ type: [String, Number],
46
+ required: false,
47
+ default: "8px"
48
+ }
49
+ },
50
+ setup(props) {
51
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => ({
52
+ "--fs-row-flex-wrap": props.wrap ? "wrap" : "nowrap",
53
+ "--fs-row-padding" : sizeToVar(props.padding),
54
+ "--fs-row-gap" : sizeToVar(props.gap),
55
+ "--fs-row-width" : sizeToVar(props.width),
56
+ "--fs-row-height" : sizeToVar(props.height)
57
+ }));
52
58
 
53
- const classes = computed((): string[] => {
54
- const classes = ["fs-row"];
55
- switch (width.value) {
56
- case "hug":
57
- classes.push("fs-row-width-hug");
58
- break;
59
- case "fill":
60
- classes.push("fs-row-width-fill");
61
- break;
62
- default:
63
- classes.push("fs-row-width-fixed");
64
- break;
65
- }
66
- switch (height.value) {
67
- case "hug":
68
- classes.push("fs-row-height-hug");
69
- break;
70
- case "fill":
71
- classes.push("fs-row-height-fill");
72
- break;
73
- default:
74
- classes.push("fs-row-height-fixed");
75
- break;
76
- }
77
- switch (align.value) {
78
- case "top-left":
79
- classes.push("fs-row-top-left");
80
- break;
81
- case "top-center":
82
- classes.push("fs-row-top-center");
83
- break;
84
- case "top-right":
85
- classes.push("fs-row-top-right");
86
- break;
87
- case "center-left":
88
- classes.push("fs-row-center-left");
89
- break;
90
- case "center-center":
91
- classes.push("fs-row-center-center");
92
- break;
93
- case "center-right":
94
- classes.push("fs-row-center-right");
95
- break;
96
- case "bottom-left":
97
- classes.push("fs-row-bottom-left");
98
- break;
99
- case "bottom-center":
100
- classes.push("fs-row-bottom-center");
101
- break;
102
- case "bottom-right":
103
- classes.push("fs-row-bottom-right");
104
- break;
105
- }
106
- return classes;
107
- });
59
+ const classes = computed((): string[] => {
60
+ const classNames = ["fs-row"];
61
+ switch (props.width) {
62
+ case "hug":
63
+ classNames.push("fs-row-width-hug");
64
+ break;
65
+ case "fill":
66
+ classNames.push("fs-row-width-fill");
67
+ break;
68
+ default:
69
+ classNames.push("fs-row-width-fixed");
70
+ break;
71
+ }
72
+ switch (props.height) {
73
+ case "hug":
74
+ classNames.push("fs-row-height-hug");
75
+ break;
76
+ case "fill":
77
+ classNames.push("fs-row-height-fill");
78
+ break;
79
+ default:
80
+ classNames.push("fs-row-height-fixed");
81
+ break;
82
+ }
83
+ switch (props.align) {
84
+ case "top-left":
85
+ classNames.push("fs-row-top-left");
86
+ break;
87
+ case "top-center":
88
+ classNames.push("fs-row-top-center");
89
+ break;
90
+ case "top-right":
91
+ classNames.push("fs-row-top-right");
92
+ break;
93
+ case "center-left":
94
+ classNames.push("fs-row-center-left");
95
+ break;
96
+ case "center-center":
97
+ classNames.push("fs-row-center-center");
98
+ break;
99
+ case "center-right":
100
+ classNames.push("fs-row-center-right");
101
+ break;
102
+ case "bottom-left":
103
+ classNames.push("fs-row-bottom-left");
104
+ break;
105
+ case "bottom-center":
106
+ classNames.push("fs-row-bottom-center");
107
+ break;
108
+ case "bottom-right":
109
+ classNames.push("fs-row-bottom-right");
110
+ break;
111
+ }
112
+ return classNames;
113
+ });
108
114
 
109
- return {
110
- style,
111
- classes
112
- };
113
- }
115
+ return {
116
+ style,
117
+ classes
118
+ };
119
+ }
114
120
  });
115
121
  </script>
@@ -1,122 +1,131 @@
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"
2
+ <FSTextField
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"
12
+ >
13
+ <template
14
+ v-if="!$props.instant"
15
+ #append
12
16
  >
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>
17
+ <slot name="append">
18
+ <FSButton
19
+ :prependIcon="$props.buttonPrependIcon"
20
+ :label="$props.buttonLabel"
21
+ :appendIcon="$props.buttonAppendIcon"
22
+ :variant="$props.buttonVariant"
23
+ :color="$props.buttonColor"
24
+ :editable="$props.editable"
25
+ @click="$emit('update:modelValue', innerValue)"
26
+ />
27
+ </slot>
28
+ </template>
29
+ <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
30
+ <slot :name="name" v-bind="slotData" />
31
+ </template>
32
+ </FSTextField>
28
33
  </template>
29
34
 
30
35
  <script lang="ts">
31
- import { defineComponent, PropType, Ref, ref, toRefs } from "vue";
36
+ import { defineComponent, PropType, ref, watch } from "vue";
32
37
 
33
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
38
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
34
39
 
35
40
  import FSTextField from "./FSTextField.vue";
36
41
  import FSButton from "./FSButton.vue";
37
- import FSIcon from "./FSIcon.vue";
38
42
 
39
43
  export default defineComponent({
40
- name: "FSSearchField",
41
- components: {
42
- FSTextField,
43
- FSButton,
44
- FSIcon
44
+ name: "FSSearchField",
45
+ components: {
46
+ FSTextField,
47
+ FSButton
48
+ },
49
+ props: {
50
+ label: {
51
+ type: String,
52
+ required: false,
53
+ default: null
45
54
  },
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
- }
55
+ description: {
56
+ type: String,
57
+ required: false,
58
+ default: null
102
59
  },
103
- emits: ["update:value"],
104
- setup(props, { emit }) {
105
- const { editable } = toRefs(props);
106
-
107
- const innerValue: Ref<String> = ref(props.value);
60
+ buttonPrependIcon: {
61
+ type: String,
62
+ required: false,
63
+ default: "mdi-magnify"
64
+ },
65
+ buttonLabel: {
66
+ type: String,
67
+ required: false,
68
+ default: null
69
+ },
70
+ buttonAppendIcon: {
71
+ type: String,
72
+ required: false,
73
+ default: null
74
+ },
75
+ buttonVariant: {
76
+ type: String as PropType<"standard" | "full" | "icon">,
77
+ required: false,
78
+ default: "standard"
79
+ },
80
+ modelValue: {
81
+ type: String,
82
+ required: false,
83
+ default: null
84
+ },
85
+ color: {
86
+ type: String as PropType<ColorBase>,
87
+ required: false,
88
+ default: ColorEnum.Dark
89
+ },
90
+ buttonColor: {
91
+ type: String as PropType<ColorBase>,
92
+ required: false,
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
104
+ },
105
+ required: {
106
+ type: Boolean,
107
+ required: false,
108
+ default: false
109
+ },
110
+ editable: {
111
+ type: Boolean,
112
+ required: false,
113
+ default: true
114
+ }
115
+ },
116
+ emits: ["update:modelValue"],
117
+ setup(props, { emit }) {
118
+ const innerValue = ref(props.modelValue);
108
119
 
109
- const onUpdate = (): void => {
110
- if (!editable.value) {
111
- return;
112
- }
113
- emit("update:value", innerValue.value);
114
- };
120
+ watch(innerValue, () => {
121
+ if (props.instant) {
122
+ emit("update:modelValue", innerValue.value);
123
+ }
124
+ });
115
125
 
116
- return {
117
- innerValue,
118
- onUpdate
119
- };
120
- }
126
+ return {
127
+ innerValue
128
+ };
129
+ }
121
130
  });
122
131
  </script>
@@ -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>