@dative-gpi/foundation-shared-components 0.0.8 → 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 +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/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 +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/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 +5 -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 +12 -0
  106. package/styles/components/fs_header_button.scss +4 -0
  107. package/styles/components/fs_icon.scss +19 -3
  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_row.scss +4 -1
  113. package/styles/components/fs_select_field.scss +71 -0
  114. package/styles/components/fs_slide_group.scss +6 -0
  115. package/styles/components/fs_slider.scss +29 -9
  116. package/styles/components/fs_span.scss +8 -0
  117. package/styles/components/fs_submit_dialog.scss +9 -0
  118. package/styles/components/fs_tabs.scss +4 -0
  119. package/styles/components/fs_tag_field.scss +0 -11
  120. package/styles/components/fs_text_field.scss +23 -15
  121. package/styles/components/fs_tile.scss +33 -0
  122. package/styles/components/fs_tooltip.scss +5 -0
  123. package/styles/components/fs_wrap_group.scss +7 -8
  124. package/styles/components/index.scss +21 -1
  125. package/styles/globals/breakpoints.scss +7 -0
  126. package/styles/globals/overrides.scss +20 -7
  127. package/styles/globals/text_fonts.scss +8 -8
  128. package/themes/default.ts +1 -11
  129. package/utils/css.ts +11 -0
  130. package/utils/icons.ts +75416 -0
  131. package/utils/index.ts +5 -1
  132. package/utils/levenshtein.ts +97 -0
  133. package/utils/sort.ts +9 -0
  134. package/components/FSDatePicker.vue +0 -226
  135. package/composables/useDates.ts +0 -39
  136. package/models/FSTags.ts +0 -8
  137. package/models/FSTextFields.ts +0 -23
  138. package/styles/components/fs_date_picker.scss +0 -0
  139. /package/utils/{FSRichTextField.ts → lexical.ts} +0 -0
@@ -1,43 +1,49 @@
1
1
  <template>
2
- <FSCol width="hug">
3
- <FSRow width="hug" align="center-left">
4
- <FSIcon
5
- class="fs-checkbox"
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-checkbox-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-checkbox-description"
27
- font="text-underline"
28
- :style="style"
29
- >
30
- {{ $props.description }}
31
- </FSSpan>
32
- </slot>
33
- </FSCol>
2
+ <FSCol
3
+ width="hug"
4
+ >
5
+ <FSRow
6
+ width="hug"
7
+ align="center-left"
8
+ >
9
+ <FSIcon
10
+ class="fs-checkbox"
11
+ size="l"
12
+ :style="style"
13
+ @click.stop="onToggle"
14
+ >
15
+ {{ icon }}
16
+ </FSIcon>
17
+ <slot>
18
+ <FSSpan
19
+ v-if="$props.label"
20
+ class="fs-checkbox-label"
21
+ :style="style"
22
+ :font="font"
23
+ @click.stop="onToggle"
24
+ >
25
+ {{ $props.label }}
26
+ </FSSpan>
27
+ </slot>
28
+ </FSRow>
29
+ <slot name="description">
30
+ <FSSpan
31
+ v-if="$props.description"
32
+ class="fs-checkbox-description"
33
+ font="text-underline"
34
+ :style="style"
35
+ >
36
+ {{ $props.description }}
37
+ </FSSpan>
38
+ </slot>
39
+ </FSCol>
34
40
  </template>
35
41
 
36
42
  <script lang="ts">
37
- import { computed, defineComponent, PropType, toRefs } from "vue";
43
+ import { computed, defineComponent, PropType } from "vue";
38
44
 
45
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
39
46
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
40
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
41
47
 
42
48
  import FSIcon from "./FSIcon.vue";
43
49
  import FSSpan from "./FSSpan.vue";
@@ -45,81 +51,83 @@ import FSRow from "./FSRow.vue";
45
51
  import FSCol from "./FSCol.vue";
46
52
 
47
53
  export default defineComponent({
48
- name: "FSCheckbox",
49
- components: {
50
- FSIcon,
51
- FSSpan,
52
- FSRow,
53
- FSCol
54
+ name: "FSCheckbox",
55
+ components: {
56
+ FSIcon,
57
+ FSSpan,
58
+ FSRow,
59
+ FSCol
60
+ },
61
+ props: {
62
+ label: {
63
+ type: String,
64
+ required: false,
65
+ default: null
54
66
  },
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
- modelValue: {
67
- type: Boolean,
68
- required: false,
69
- default: false
70
- },
71
- color: {
72
- type: String as PropType<ColorBase>,
73
- required: false,
74
- default: ColorBase.Primary
75
- },
76
- editable: {
77
- type: Boolean,
78
- required: false,
79
- default: true
80
- }
67
+ description: {
68
+ type: String,
69
+ required: false,
70
+ default: null
81
71
  },
82
- emits: ["update:modelValue"],
83
- setup(props, { emit }) {
84
- const { modelValue, color, editable } = toRefs(props);
85
-
86
- const colors = useColors().getColors(color.value);
87
-
88
- const lights = useColors().getColors(ColorBase.Light);
89
- const darks = useColors().getColors(ColorBase.Dark);
72
+ modelValue: {
73
+ type: Boolean,
74
+ required: false,
75
+ default: false
76
+ },
77
+ color: {
78
+ type: String as PropType<ColorBase>,
79
+ required: false,
80
+ default: ColorEnum.Primary
81
+ },
82
+ indeterminate: {
83
+ type: Boolean,
84
+ required: false,
85
+ default: false
86
+ },
87
+ editable: {
88
+ type: Boolean,
89
+ required: false,
90
+ default: true
91
+ }
92
+ },
93
+ emits: ["update:modelValue"],
94
+ setup(props, { emit }) {
95
+ const colors = computed(() => useColors().getColors(props.color));
96
+ const lights = useColors().getColors(ColorEnum.Light);
97
+ const darks = useColors().getColors(ColorEnum.Dark);
90
98
 
91
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
92
- if (!editable.value) {
93
- return {
94
- "--fs-checkbox-cursor": "default",
95
- "--fs-checkbox-checkbox-color": lights.dark,
96
- "--fs-checkbox-color": lights.dark
97
- };
98
- }
99
- return {
100
- "--fs-checkbox-cursor": "pointer",
101
- "--fs-checkbox-checkbox-color": modelValue.value ? colors.base : darks.base,
102
- "--fs-checkbox-color": darks.base
103
- }
104
- });
99
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
100
+ if (!props.editable) {
101
+ return {
102
+ "--fs-checkbox-cursor" : "default",
103
+ "--fs-checkbox-checkbox-color": lights.dark,
104
+ "--fs-checkbox-color" : lights.dark
105
+ };
106
+ }
107
+ return {
108
+ "--fs-checkbox-cursor" : "pointer",
109
+ "--fs-checkbox-checkbox-color": (props.modelValue || props.indeterminate) ? colors.value.base : darks.base,
110
+ "--fs-checkbox-color" : darks.base
111
+ }
112
+ });
105
113
 
106
- const icon = computed((): string => modelValue.value ? "mdi-checkbox-marked" : "mdi-checkbox-blank-outline");
114
+ const icon = computed((): string => props.modelValue ? "mdi-checkbox-marked" : props.indeterminate ? "mdi-minus-box" : "mdi-checkbox-blank-outline");
107
115
 
108
- const font = computed((): string => modelValue.value ? "text-button" : "text-body");
116
+ const font = computed((): string => props.modelValue ? "text-button" : "text-body");
109
117
 
110
- const onToggle = (): void => {
111
- if (!editable.value) {
112
- return;
113
- }
114
- emit("update:modelValue", !modelValue.value);
115
- };
118
+ const onToggle = (): void => {
119
+ if (!props.editable) {
120
+ return;
121
+ }
122
+ emit("update:modelValue", !props.modelValue);
123
+ };
116
124
 
117
- return {
118
- style,
119
- icon,
120
- font,
121
- onToggle
122
- };
123
- }
125
+ return {
126
+ style,
127
+ icon,
128
+ font,
129
+ onToggle
130
+ };
131
+ }
124
132
  });
125
133
  </script>
@@ -0,0 +1,140 @@
1
+ <template>
2
+ <FSRow
3
+ width="hug"
4
+ align="center-left"
5
+ :class="classes"
6
+ :style="style"
7
+ :wrap="false"
8
+ v-bind="$attrs"
9
+ >
10
+ <slot name="prepend" v-bind="{ color: $props.color, colors }">
11
+ <FSIcon
12
+ v-if="$props.prependIcon"
13
+ size="s"
14
+ >
15
+ {{ $props.prependIcon }}
16
+ </FSIcon>
17
+ </slot>
18
+ <slot v-bind="{ color: $props.color, colors }">
19
+ <FSSpan
20
+ v-if="$props.label"
21
+ font="text-overline"
22
+ class="fs-chip-label"
23
+ >
24
+ {{ $props.label }}
25
+ </FSSpan>
26
+ </slot>
27
+ <slot name="append" v-bind="{ color: $props.color, colors }">
28
+ <FSIcon
29
+ v-if="$props.appendIcon"
30
+ size="s"
31
+ >
32
+ {{ $props.appendIcon }}
33
+ </FSIcon>
34
+ </slot>
35
+ </FSRow>
36
+ </template>
37
+
38
+ <script lang="ts">
39
+ import { computed, defineComponent, PropType } from "vue";
40
+
41
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
42
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
43
+
44
+ import FSIcon from "./FSIcon.vue";
45
+ import FSSpan from "./FSSpan.vue";
46
+ import FSRow from "./FSRow.vue";
47
+
48
+ export default defineComponent({
49
+ name: "FSChip",
50
+ components: {
51
+ FSIcon,
52
+ FSSpan,
53
+ FSRow
54
+ },
55
+ props: {
56
+ prependIcon: {
57
+ type: String,
58
+ required: false,
59
+ default: null
60
+ },
61
+ label: {
62
+ type: String,
63
+ required: false,
64
+ default: null
65
+ },
66
+ appendIcon: {
67
+ type: String,
68
+ required: false,
69
+ default: null
70
+ },
71
+ variant: {
72
+ type: String as PropType<"standard" | "full">,
73
+ required: false,
74
+ default: "full"
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: false
85
+ }
86
+ },
87
+ setup(props) {
88
+ const colors = computed(() => useColors().getColors(props.color));
89
+ const backgrounds = useColors().getColors(ColorEnum.Background);
90
+
91
+ const textColors = computed(() => {
92
+ switch (props.variant) {
93
+ case "standard": return colors.value;
94
+ case "full": return useColors().getContrasts(props.color);
95
+ }
96
+ });
97
+
98
+ const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
99
+ switch (props.variant) {
100
+ case "standard": return {
101
+ "--fs-chip-background-color" : backgrounds.base,
102
+ "--fs-chip-border-color" : colors.value.base,
103
+ "--fs-chip-color" : textColors.value.base,
104
+ "--fs-chip-hover-background-color" : backgrounds.base,
105
+ "--fs-chip-hover-border-color" : colors.value.base,
106
+ "--fs-chip-hover-color" : textColors.value.base,
107
+ "--fs-chip-active-background-color": backgrounds.base,
108
+ "--fs-chip-active-border-color" : colors.value.dark,
109
+ "--fs-chip-active-color" : textColors.value.dark
110
+ };
111
+ case "full": return {
112
+ "--fs-chip-background-color" : colors.value.base,
113
+ "--fs-chip-border-color" : colors.value.base,
114
+ "--fs-chip-color" : textColors.value.light,
115
+ "--fs-chip-hover-background-color" : colors.value.base,
116
+ "--fs-chip-hover-border-color" : colors.value.base,
117
+ "--fs-chip-hover-color" : textColors.value.light,
118
+ "--fs-chip-active-background-color": colors.value.dark,
119
+ "--fs-chip-active-border-color" : colors.value.dark,
120
+ "--fs-chip-active-color" : textColors.value.light
121
+ };
122
+ }
123
+ });
124
+
125
+ const classes = computed((): string[] => {
126
+ const classNames: string[] = ["fs-chip"];
127
+ if (props.editable) {
128
+ classNames.push("fs-chip-editable");
129
+ }
130
+ return classNames;
131
+ });
132
+
133
+ return {
134
+ colors,
135
+ style,
136
+ classes
137
+ };
138
+ }
139
+ });
140
+ </script>
@@ -1,38 +1,172 @@
1
1
  <template>
2
-
2
+ <FSCol
3
+ width="fill"
4
+ gap="16px"
5
+ >
6
+ <FSRow
7
+ align="center-center"
8
+ >
9
+ <FSTextField
10
+ v-if="$props.reminder"
11
+ :readonly="true"
12
+ :hideHeader="true"
13
+ :modelValue="epochToLongDateFormat($props.date)"
14
+ />
15
+ <v-text-field
16
+ class="fs-clock-field"
17
+ variant="outlined"
18
+ type="number"
19
+ hide-details
20
+ :style="style"
21
+ :readonly="!$props.editable"
22
+ :modelValue="innerHours.toString().padStart(2, '0')"
23
+ @update:modelValue="onChangeHours"
24
+ />
25
+ :
26
+ <v-text-field
27
+ class="fs-clock-field"
28
+ variant="outlined"
29
+ type="number"
30
+ hide-details
31
+ :style="style"
32
+ :readonly="!$props.editable"
33
+ :modelValue="innerMinutes.toString().padStart(2, '0')"
34
+ @update:modelValue="onChangeMinutes"
35
+ />
36
+ </FSRow>
37
+ <FSCol>
38
+ <FSSpan
39
+ font="text-overline"
40
+ >
41
+ {{ $tr("ui.clock.hours", "Hours") }}
42
+ </FSSpan>
43
+ <FSSlider
44
+ :readonly="!$props.editable"
45
+ :color="$props.color"
46
+ :step="1"
47
+ :max="23"
48
+ :min="0"
49
+ v-model="innerHours"
50
+ />
51
+ </FSCol>
52
+ <FSCol>
53
+ <FSSpan
54
+ font="text-overline"
55
+ >
56
+ {{ $tr("ui.clock.minutes", "Minutes") }}
57
+ </FSSpan>
58
+ <FSSlider
59
+ :readonly="!$props.editable"
60
+ :color="$props.color"
61
+ :step="1"
62
+ :max="59"
63
+ :min="0"
64
+ v-model="innerMinutes"
65
+ />
66
+ </FSCol>
67
+ </FSCol>
3
68
  </template>
4
69
 
5
70
  <script lang="ts">
6
- import { defineComponent, PropType } from "vue";
71
+ import { computed, defineComponent, PropType, ref, watch } from "vue";
7
72
 
8
- import { useColors, useDates } from "@dative-gpi/foundation-shared-components/composables";
9
- import { useLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
10
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
73
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
74
+ import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
75
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
11
76
 
77
+ import FSTextField from "./FSTextField.vue";
78
+ import FSSlider from "./FSSlider.vue";
12
79
  import FSCol from "./FSCol.vue";
13
80
  import FSRow from "./FSRow.vue";
14
81
 
15
82
  export default defineComponent({
16
- name: "FSClock",
17
- props: {
83
+ name: "FSClock",
84
+ components: {
85
+ FSTextField,
86
+ FSSlider,
87
+ FSCol,
88
+ FSRow
89
+ },
90
+ props: {
18
91
  modelValue: {
19
- type: Array as PropType<Array<number>>,
92
+ type: Number,
20
93
  required: false,
21
94
  default: null
22
95
  },
23
96
  color: {
24
97
  type: String as PropType<ColorBase>,
25
98
  required: false,
26
- default: ColorBase.Dark
99
+ default: ColorEnum.Primary
27
100
  },
28
- buttonColor: {
29
- type: String as PropType<ColorBase>,
101
+ date: {
102
+ type: Number,
30
103
  required: false,
31
- default: ColorBase.Primary
32
- }
104
+ default: null
33
105
  },
34
- setup(props) {
35
-
106
+ reminder: {
107
+ type: Boolean,
108
+ required: false,
109
+ default: false
110
+ },
111
+ editable: {
112
+ type: Boolean,
113
+ required: false,
114
+ default: true
36
115
  }
116
+ },
117
+ emits: ["update:modelValue"],
118
+ setup(props, { emit }) {
119
+ const { epochToLongDateFormat } = useTimeZone();
120
+
121
+ const colors = computed(() => useColors().getColors(props.color));
122
+ const backgrounds = useColors().getColors(ColorEnum.Background);
123
+ const lights = useColors().getColors(ColorEnum.Light);
124
+ const darks = useColors().getColors(ColorEnum.Dark);
125
+
126
+ const innerHours = ref(props.modelValue ? Math.floor(props.modelValue / (60 * 60 * 1000)) : 0);
127
+ const innerMinutes = ref(props.modelValue ? Math.floor((props.modelValue % (60 * 60 * 1000)) / (60 * 1000)) : 0);
128
+
129
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
130
+ if (!props.editable) {
131
+ return {
132
+ "--fs-clock-field-cursor" : "default",
133
+ "--fs-clock-field-background-color" : backgrounds.base,
134
+ "--fs-clock-field-border-color" : lights.base,
135
+ "--fs-clock-field-color" : lights.dark,
136
+ "--fs-clock-field-active-border-color": lights.base
137
+ };
138
+ }
139
+ return {
140
+ "--fs-clock-field-cursor" : "text",
141
+ "--fs-clock-field-background-color" : colors.value.light,
142
+ "--fs-clock-field-border-color" : colors.value.base,
143
+ "--fs-clock-field-color" : darks.base,
144
+ "--fs-clock-field-active-border-color": colors.value.dark
145
+ };
146
+ });
147
+
148
+ const onChangeHours = (value: number): void => {
149
+ value = Math.min(23, Math.max(0, value));
150
+ innerHours.value = value;
151
+ };
152
+
153
+ const onChangeMinutes = (value: number): void => {
154
+ value = Math.min(59, Math.max(0, value));
155
+ innerMinutes.value = value;
156
+ };
157
+
158
+ watch([innerHours, innerMinutes], () => {
159
+ emit("update:modelValue", (innerHours.value * 60 * 60 * 1000) + (innerMinutes.value * 60 * 1000));
160
+ });
161
+
162
+ return {
163
+ style,
164
+ innerHours,
165
+ innerMinutes,
166
+ onChangeHours,
167
+ onChangeMinutes,
168
+ epochToLongDateFormat
169
+ };
170
+ }
37
171
  });
38
172
  </script>