@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
@@ -0,0 +1,93 @@
1
+ <template>
2
+ <FSCard
3
+ class="fs-load-tile"
4
+ padding="11px"
5
+ :style="style"
6
+ :width="width"
7
+ :height="height"
8
+ >
9
+ <FSRow
10
+ align="center-center"
11
+ height="fill"
12
+ gap="24px"
13
+ >
14
+ <v-skeleton-loader
15
+ type="article"
16
+ />
17
+ <v-skeleton-loader
18
+ type="image"
19
+ />
20
+ </FSRow>
21
+ <FSContainer
22
+ v-if="$props.editable"
23
+ class="fs-tile-checkbox"
24
+ :border="false"
25
+ >
26
+ <FSCheckbox
27
+ :modelValue="$props.modelValue"
28
+ @update:modelValue="() => $emit('update:modelValue', !$props.modelValue)"
29
+ />
30
+ </FSContainer>
31
+ </FSCard>
32
+ </template>
33
+
34
+ <script lang="ts">
35
+ import { computed, defineComponent } from "vue";
36
+
37
+ import { useBreakpoints, useColors } from "@dative-gpi/foundation-shared-components/composables";
38
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
39
+
40
+ import FSContainer from "./FSContainer.vue";
41
+ import FSCheckbox from "./FSCheckbox.vue";
42
+ import FSCard from "./FSCard.vue";
43
+ import FSCol from "./FSCol.vue";
44
+ import FSRow from "./FSRow.vue";
45
+
46
+ export default defineComponent({
47
+ name: "FSTile",
48
+ components: {
49
+ FSContainer,
50
+ FSCheckbox,
51
+ FSCard,
52
+ FSCol,
53
+ FSRow
54
+ },
55
+ props: {
56
+ modelValue: {
57
+ type: Boolean,
58
+ required: false,
59
+ default: false
60
+ },
61
+ editable: {
62
+ type: Boolean,
63
+ required: false,
64
+ default: false
65
+ }
66
+ },
67
+ setup() {
68
+ const { isMobileSized } = useBreakpoints();
69
+
70
+ const backgroundColors = useColors().getColors(ColorEnum.Background);
71
+
72
+ const width = computed(() => {
73
+ return isMobileSized.value ? 336 : 352;
74
+ });
75
+
76
+ const height = computed(() => {
77
+ return isMobileSized.value ? 156 : 170;
78
+ });
79
+
80
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
81
+ return {
82
+ "--fs-load-tile-background-color": backgroundColors.base
83
+ };
84
+ });
85
+
86
+ return {
87
+ width,
88
+ height,
89
+ style
90
+ };
91
+ }
92
+ });
93
+ </script>
@@ -1,65 +1,63 @@
1
1
  <template>
2
- <FSTextField
3
- type="number"
4
- :label="$props.label"
5
- :description="$props.description"
6
- :color="$props.color"
7
- :required="$props.required"
8
- :editable="$props.editable"
9
- :modelValue="$props.modelValue?.toString()"
10
- @update:modelValue="(value) => $emit('update:modelValue', isNaN(parseFloat(value)) ? 0 : parseFloat(value))"
11
- v-bind="$attrs"
12
- >
13
- <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
14
- <slot :name="name" v-bind="slotData" />
15
- </template>
16
- </FSTextField>
2
+ <FSTextField
3
+ type="number"
4
+ :label="$props.label"
5
+ :description="$props.description"
6
+ :hideHeader="$props.hideHeader"
7
+ :required="$props.required"
8
+ :editable="$props.editable"
9
+ :modelValue="$props.modelValue?.toString()"
10
+ @update:modelValue="(value) => $emit('update:modelValue', isNaN(parseFloat(value)) ? 0 : parseFloat(value))"
11
+ v-bind="$attrs"
12
+ >
13
+ <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
14
+ <slot :name="name" v-bind="slotData" />
15
+ </template>
16
+ </FSTextField>
17
17
  </template>
18
18
 
19
19
  <script lang="ts">
20
- import { defineComponent, PropType } from "vue";
21
-
22
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
20
+ import { defineComponent } from "vue";
23
21
 
24
22
  import FSTextField from "./FSTextField.vue";
25
23
 
26
24
  export default defineComponent({
27
- name: "FSNumberField",
28
- components: {
29
- FSTextField
25
+ name: "FSNumberField",
26
+ components: {
27
+ FSTextField
28
+ },
29
+ props: {
30
+ label: {
31
+ type: String,
32
+ required: false,
33
+ default: null
34
+ },
35
+ description: {
36
+ type: String,
37
+ required: false,
38
+ default: null
39
+ },
40
+ modelValue: {
41
+ type: Number,
42
+ required: false,
43
+ default: null
44
+ },
45
+ hideHeader: {
46
+ type: Boolean,
47
+ required: false,
48
+ default: false
30
49
  },
31
- props: {
32
- label: {
33
- type: String,
34
- required: false,
35
- default: null
36
- },
37
- description: {
38
- type: String,
39
- required: false,
40
- default: null
41
- },
42
- modelValue: {
43
- type: Number,
44
- required: false,
45
- default: null
46
- },
47
- color: {
48
- type: String as PropType<ColorBase>,
49
- required: false,
50
- default: ColorBase.Dark
51
- },
52
- required: {
53
- type: Boolean,
54
- required: false,
55
- default: false
56
- },
57
- editable: {
58
- type: Boolean,
59
- required: false,
60
- default: true
61
- }
50
+ required: {
51
+ type: Boolean,
52
+ required: false,
53
+ default: false
62
54
  },
63
- emits: ["update:modelValue"]
55
+ editable: {
56
+ type: Boolean,
57
+ required: false,
58
+ default: true
59
+ }
60
+ },
61
+ emits: ["update:modelValue"]
64
62
  });
65
63
  </script>
@@ -1,121 +1,119 @@
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
- :modelValue="$props.modelValue"
10
- @update:modelValue="(value) => $emit('update:modelValue', value)"
11
- v-bind="$attrs"
12
- >
13
- <template #append-inner>
14
- <slot name="append-inner">
15
- <FSIcon
16
- class="fs-password-field-icon"
17
- size="m"
18
- :style="style"
19
- @click="onToggle"
20
- >
21
- {{ icon }}
22
- </FSIcon>
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>
2
+ <FSTextField
3
+ :label="$props.label"
4
+ :description="$props.description"
5
+ :type="type"
6
+ :hideHeader="$props.hideHeader"
7
+ :required="$props.required"
8
+ :editable="$props.editable"
9
+ :modelValue="$props.modelValue"
10
+ @update:modelValue="(value) => $emit('update:modelValue', value)"
11
+ v-bind="$attrs"
12
+ >
13
+ <template #append-inner>
14
+ <slot name="append-inner">
15
+ <FSButton
16
+ variant="icon"
17
+ :icon="icon"
18
+ :editable="$props.editable"
19
+ :color="ColorEnum.Dark"
20
+ @click="onToggle"
21
+ />
22
+ </slot>
23
+ </template>
24
+ <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
25
+ <slot :name="name" v-bind="slotData" />
26
+ </template>
27
+ </FSTextField>
29
28
  </template>
30
29
 
31
30
  <script lang="ts">
32
- import { computed, defineComponent, PropType, ref, toRefs } from "vue";
31
+ import { computed, defineComponent, ref } from "vue";
33
32
 
34
33
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
35
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
34
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
36
35
 
37
36
  import FSTextField from "./FSTextField.vue";
38
- import FSIcon from "./FSIcon.vue";
37
+ import FSButton from "./FSButton.vue";
39
38
 
40
39
  export default defineComponent({
41
- name: "FSPasswordField",
42
- components: {
43
- FSTextField,
44
- FSIcon
40
+ name: "FSPasswordField",
41
+ components: {
42
+ FSTextField,
43
+ FSButton
44
+ },
45
+ props: {
46
+ label: {
47
+ type: String,
48
+ required: false,
49
+ default: null
45
50
  },
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
- modelValue: {
58
- type: String,
59
- required: false,
60
- default: null
61
- },
62
- color: {
63
- type: String as PropType<ColorBase>,
64
- required: false,
65
- default: ColorBase.Dark
66
- },
67
- required: {
68
- type: Boolean,
69
- required: false,
70
- default: false
71
- },
72
- editable: {
73
- type: Boolean,
74
- required: false,
75
- default: true
76
- }
51
+ description: {
52
+ type: String,
53
+ required: false,
54
+ default: null
77
55
  },
78
- emits: ["update:modelValue"],
79
- setup(props) {
80
- const { editable } = toRefs(props);
81
-
82
- const stars = ref(true);
56
+ modelValue: {
57
+ type: String,
58
+ required: false,
59
+ default: null
60
+ },
61
+ hideHeader: {
62
+ type: Boolean,
63
+ required: false,
64
+ default: false
65
+ },
66
+ required: {
67
+ type: Boolean,
68
+ required: false,
69
+ default: false
70
+ },
71
+ editable: {
72
+ type: Boolean,
73
+ required: false,
74
+ default: true
75
+ }
76
+ },
77
+ emits: ["update:modelValue"],
78
+ setup(props) {
79
+ const lights = useColors().getColors(ColorEnum.Light);
80
+ const darks = useColors().getColors(ColorEnum.Dark);
83
81
 
84
- const lights = useColors().getColors(ColorBase.Light);
85
- const darks = useColors().getColors(ColorBase.Dark);
82
+ const stars = ref(true);
86
83
 
87
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
88
- if (!editable.value) {
89
- return {
90
- "--fs-password-field-cursor" : "default",
91
- "--fs-password-field-base-text": lights.dark,
92
- "--fs-password-field-dark-text": lights.dark
93
- };
94
- }
95
- return {
96
- "--fs-password-field-cursor" : "pointer",
97
- "--fs-password-field-base-text": darks.base,
98
- "--fs-password-field-dark-text": darks.dark
99
- };
100
- });
84
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
85
+ if (!props.editable) {
86
+ return {
87
+ "--fs-password-field-cursor" : "default",
88
+ "--fs-password-field-color": lights.dark,
89
+ "--fs-password-field-hover-color": lights.dark
90
+ };
91
+ }
92
+ return {
93
+ "--fs-password-field-cursor" : "pointer",
94
+ "--fs-password-field-color": darks.base,
95
+ "--fs-password-field-hover-color": darks.dark
96
+ };
97
+ });
101
98
 
102
- const type = computed((): string => stars.value ? "password" : "text");
99
+ const type = computed((): string => stars.value ? "password" : "text");
103
100
 
104
- const icon = computed((): string => stars.value ? "mdi-eye-off-outline" : "mdi-eye-outline");
101
+ const icon = computed((): string => stars.value ? "mdi-eye-off-outline" : "mdi-eye-outline");
105
102
 
106
- const onToggle = (): void => {
107
- if (!editable.value) {
108
- return;
109
- }
110
- stars.value = !stars.value;
111
- };
103
+ const onToggle = (): void => {
104
+ if (!props.editable) {
105
+ return;
106
+ }
107
+ stars.value = !stars.value;
108
+ };
112
109
 
113
- return {
114
- type,
115
- icon,
116
- style,
117
- onToggle
118
- };
119
- }
110
+ return {
111
+ ColorEnum,
112
+ type,
113
+ icon,
114
+ style,
115
+ onToggle
116
+ };
117
+ }
120
118
  });
121
119
  </script>
@@ -1,43 +1,44 @@
1
1
  <template>
2
- <FSCol width="hug">
3
- <FSRow width="hug" align="center-left">
4
- <FSIcon
5
- class="fs-radio"
6
- :style="style"
7
- @click="onToggle"
8
- >
9
- {{ icon }}
10
- </FSIcon>
11
- <slot name="default">
12
- <FSSpan
13
- v-if="$props.label"
14
- class="fs-radio-label"
15
- :style="style"
16
- :font="font"
17
- @click="onToggle"
18
- >
19
- {{ $props.label }}
20
- </FSSpan>
21
- </slot>
22
- </FSRow>
23
- <slot name="description">
24
- <FSSpan
25
- v-if="$props.description"
26
- class="fs-radio-description"
27
- font="text-underline"
28
- :style="style"
29
- >
30
- {{ $props.description }}
31
- </FSSpan>
32
- </slot>
33
- </FSCol>
2
+ <FSCol width="hug">
3
+ <FSRow width="hug" align="center-left">
4
+ <FSIcon
5
+ class="fs-radio"
6
+ size="l"
7
+ :style="style"
8
+ @click.stop="onToggle"
9
+ >
10
+ {{ icon }}
11
+ </FSIcon>
12
+ <slot>
13
+ <FSSpan
14
+ v-if="$props.label"
15
+ class="fs-radio-label"
16
+ :style="style"
17
+ :font="font"
18
+ @click.stop="onToggle"
19
+ >
20
+ {{ $props.label }}
21
+ </FSSpan>
22
+ </slot>
23
+ </FSRow>
24
+ <slot name="description">
25
+ <FSSpan
26
+ v-if="$props.description"
27
+ class="fs-radio-description"
28
+ font="text-underline"
29
+ :style="style"
30
+ >
31
+ {{ $props.description }}
32
+ </FSSpan>
33
+ </slot>
34
+ </FSCol>
34
35
  </template>
35
36
 
36
37
  <script lang="ts">
37
- import { computed, defineComponent, PropType, toRefs } from "vue";
38
+ import { computed, defineComponent, PropType } from "vue";
38
39
 
40
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
39
41
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
40
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
41
42
 
42
43
  import FSIcon from "./FSIcon.vue";
43
44
  import FSSpan from "./FSSpan.vue";
@@ -45,87 +46,84 @@ import FSRow from "./FSRow.vue";
45
46
  import FSCol from "./FSCol.vue";
46
47
 
47
48
  export default defineComponent({
48
- name: "FSRadio",
49
- components: {
50
- FSIcon,
51
- FSSpan,
52
- FSRow,
53
- FSCol
49
+ name: "FSRadio",
50
+ components: {
51
+ FSIcon,
52
+ FSSpan,
53
+ FSRow,
54
+ FSCol
55
+ },
56
+ props: {
57
+ label: {
58
+ type: String,
59
+ required: false,
60
+ default: null
54
61
  },
55
- props: {
56
- label: {
57
- type: String,
58
- required: false,
59
- default: null
60
- },
61
- description: {
62
- type: String,
63
- required: false,
64
- default: null
65
- },
66
- value: {
67
- type: [String, Boolean, Number],
68
- required: true
69
- },
70
- selected: {
71
- type: Boolean,
72
- required: false,
73
- default: false
74
- },
75
- color: {
76
- type: String as PropType<ColorBase>,
77
- required: false,
78
- default: ColorBase.Primary
79
- },
80
- editable: {
81
- type: Boolean,
82
- required: false,
83
- default: true
84
- }
62
+ description: {
63
+ type: String,
64
+ required: false,
65
+ default: null
85
66
  },
86
- emits: ["update:value"],
87
- setup(props, { emit }) {
88
- const { value, selected, color, editable } = toRefs(props);
89
-
90
- const colors = useColors().getColors(color.value);
91
-
92
- const lights = useColors().getColors(ColorBase.Light);
93
- const darks = useColors().getColors(ColorBase.Dark);
67
+ modelValue: {
68
+ type: [String, Boolean, Number],
69
+ required: true
70
+ },
71
+ selected: {
72
+ type: Boolean,
73
+ required: false,
74
+ default: false
75
+ },
76
+ color: {
77
+ type: String as PropType<ColorBase>,
78
+ required: false,
79
+ default: ColorEnum.Primary
80
+ },
81
+ editable: {
82
+ type: Boolean,
83
+ required: false,
84
+ default: true
85
+ }
86
+ },
87
+ emits: ["update:modelValue"],
88
+ setup(props, { emit }) {
89
+ const colors = computed(() => useColors().getColors(props.color));
90
+ const lights = useColors().getColors(ColorEnum.Light);
91
+ const darks = useColors().getColors(ColorEnum.Dark);
94
92
 
95
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
96
- if (!editable.value) {
97
- return {
98
- "--fs-radio-cursor": "default",
99
- "--fs-radio-radio-color": lights.dark,
100
- "--fs-radio-color": lights.dark
101
- };
102
- }
103
- return {
104
- "--fs-radio-cursor": selected.value ? "default" : "pointer",
105
- "--fs-radio-radio-color": selected.value ? colors.base : darks.base,
106
- "--fs-radio-color" : darks.base
107
- };
108
- });
93
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
94
+ if (!props.editable) {
95
+ return {
96
+ "--fs-radio-cursor" : "default",
97
+ "--fs-radio-radio-color": lights.dark,
98
+ "--fs-radio-color" : lights.dark
99
+ };
100
+ }
101
+ return {
102
+ "--fs-radio-cursor" : props.selected ? "default" : "pointer",
103
+ "--fs-radio-radio-color": props.selected ? colors.value.base : darks.base,
104
+ "--fs-radio-color" : darks.base
105
+ };
106
+ });
109
107
 
110
- const icon = computed((): string => selected.value ? "mdi-radiobox-marked" : "mdi-radiobox-blank");
108
+ const icon = computed((): string => props.selected ? "mdi-radiobox-marked" : "mdi-radiobox-blank");
111
109
 
112
- const font = computed((): string => selected.value ? "text-button" : "text-body");
110
+ const font = computed((): string => props.selected ? "text-button" : "text-body");
113
111
 
114
- const onToggle = (): void => {
115
- if (!editable.value) {
116
- return;
117
- }
118
- if (!selected.value) {
119
- emit("update:value", value.value);
120
- }
121
- };
112
+ const onToggle = (): void => {
113
+ if (!props.editable) {
114
+ return;
115
+ }
116
+ if (!props.selected) {
117
+ emit("update:modelValue", props.modelValue);
118
+ }
119
+ };
122
120
 
123
- return {
124
- style,
125
- icon,
126
- font,
127
- onToggle
128
- };
129
- }
121
+ return {
122
+ style,
123
+ icon,
124
+ font,
125
+ onToggle
126
+ };
127
+ }
130
128
  });
131
129
  </script>