@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,7 +1,10 @@
1
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
1
+ import { useTranslationsProvider } from "@dative-gpi/foundation-shared-services";
2
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
2
3
 
3
4
  import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
4
5
 
6
+ const { $tr } = useTranslationsProvider();
7
+
5
8
  export const FSButtonsAliases = {
6
9
  FSButtonSearch: FSButton,
7
10
  FSButtonSearchMini: FSButton,
@@ -20,92 +23,92 @@ export const FSButtonsAliases = {
20
23
  export const FSButtonsProps = {
21
24
  FSButtonSearch: {
22
25
  prependIcon: "mdi-magnify",
23
- label: "Search",
26
+ label: $tr("ui.button.search", "Search"),
24
27
  variant: "standard",
25
- color: ColorBase.Primary
28
+ color: ColorEnum.Primary
26
29
  },
27
30
  FSButtonSearchMini: {
28
31
  prependIcon: "mdi-magnify",
29
32
  label: undefined,
30
33
  variant: "standard",
31
- color: ColorBase.Primary
34
+ color: ColorEnum.Primary
32
35
  },
33
36
  FSButtonSearchIcon: {
34
37
  icon: "mdi-magnify",
35
38
  label: undefined,
36
39
  variant: "icon",
37
- color: ColorBase.Primary
40
+ color: ColorEnum.Primary
38
41
  },
39
42
  FSButtonRemove: {
40
43
  prependIcon: "mdi-delete-outline",
41
- label: "Remove",
44
+ label: $tr("ui.button.remove", "Remove"),
42
45
  variant: "standard",
43
- color: ColorBase.Error
46
+ color: ColorEnum.Error
44
47
  },
45
48
  FSButtonRemoveMini: {
46
49
  prependIcon: "mdi-delete-outline",
47
50
  label: undefined,
48
51
  variant: "standard",
49
- color: ColorBase.Error
52
+ color: ColorEnum.Error
50
53
  },
51
54
  FSButtonRemoveIcon: {
52
55
  icon: "mdi-delete-outline",
53
56
  label: undefined,
54
57
  variant: "icon",
55
- color: ColorBase.Error
58
+ color: ColorEnum.Error
56
59
  },
57
60
  FSButtonSave: {
58
61
  prependIcon: "mdi-content-save-outline",
59
- label: "Save",
62
+ label: $tr("ui.button.save", "Save"),
60
63
  variant: "standard",
61
- color: ColorBase.Primary
64
+ color: ColorEnum.Primary
62
65
  },
63
66
  FSButtonSaveMini: {
64
67
  prependIcon: "mdi-content-save-outline",
65
68
  label: undefined,
66
69
  variant: "standard",
67
- color: ColorBase.Primary
70
+ color: ColorEnum.Primary
68
71
  },
69
72
  FSButtonSaveIcon: {
70
73
  icon: "mdi-content-save-outline",
71
74
  label: undefined,
72
75
  variant: "icon",
73
- color: ColorBase.Primary
76
+ color: ColorEnum.Primary
74
77
  },
75
78
  FSButtonCancel: {
76
79
  prependIcon: "mdi-cancel",
77
- label: "Cancel",
80
+ label: $tr("ui.button.cancel", "Cancel"),
78
81
  variant: "standard",
79
- color: ColorBase.Light
82
+ color: ColorEnum.Light
80
83
  },
81
84
  FSButtonCancelMini: {
82
85
  prependIcon: "mdi-cancel",
83
86
  label: undefined,
84
87
  variant: "standard",
85
- color: ColorBase.Light
88
+ color: ColorEnum.Light
86
89
  },
87
90
  FSButtonCancelIcon: {
88
91
  icon: "mdi-cancel",
89
92
  label: undefined,
90
93
  variant: "icon",
91
- color: ColorBase.Light
94
+ color: ColorEnum.Light
92
95
  },
93
96
  FSButtonDocumentation: {
94
97
  prependIcon: "mdi-file-document-outline",
95
- label: "Documentation",
98
+ label: $tr("ui.button.documentation", "Documentation"),
96
99
  variant: "standard",
97
- color: ColorBase.Light
100
+ color: ColorEnum.Light
98
101
  },
99
102
  FSButtonDocumentationMini: {
100
103
  prependIcon: "mdi-file-document-outline",
101
104
  label: undefined,
102
105
  variant: "standard",
103
- color: ColorBase.Light
106
+ color: ColorEnum.Light
104
107
  },
105
108
  FSButtonDocumentationIcon: {
106
109
  icon: "mdi-file-document-outline",
107
110
  label: undefined,
108
111
  variant: "icon",
109
- color: ColorBase.Light
112
+ color: ColorEnum.Light
110
113
  }
111
114
  }
@@ -0,0 +1 @@
1
+ export * from "./FSButton";
@@ -0,0 +1,207 @@
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-autocomplete-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-autocomplete-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-autocomplete-field-messages"
27
+ font="text-overline"
28
+ :style="style"
29
+ >
30
+ {{ messages.join(", ") }}
31
+ </FSSpan>
32
+ </FSRow>
33
+ </slot>
34
+ <v-autocomplete
35
+ menuIcon="mdi-chevron-down"
36
+ clearIcon="mdi-close"
37
+ variant="outlined"
38
+ :style="style"
39
+ :class="classes"
40
+ :hideDetails="true"
41
+ :items="$props.items"
42
+ :autoSelectFirst="true"
43
+ :multiple="$props.multiple"
44
+ :error="messages.length > 0"
45
+ :itemTitle="$props.itemTitle"
46
+ :itemValue="$props.itemValue"
47
+ :readonly="!$props.editable"
48
+ :clearable="$props.editable"
49
+ :modelValue="$props.modelValue"
50
+ @update:modelValue="(value) => $emit('update:modelValue', value)"
51
+ v-model:search="innerSearch"
52
+ v-bind="$attrs"
53
+ >
54
+ <template v-for="(_, name) in slots" v-slot:[name]="slotData">
55
+ <slot :name="name" v-bind="slotData" />
56
+ </template>
57
+ </v-autocomplete>
58
+ <slot name="description">
59
+ <FSSpan
60
+ v-if="$props.description"
61
+ class="fs-autocomplete-field-description"
62
+ font="text-underline"
63
+ :style="style"
64
+ >
65
+ {{ $props.description }}
66
+ </FSSpan>
67
+ </slot>
68
+ </FSCol>
69
+ </template>
70
+
71
+ <script lang="ts">
72
+ import { computed, defineComponent, PropType, ref, watch } from "vue";
73
+
74
+ import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
75
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
76
+
77
+ import FSSpan from "./FSSpan.vue";
78
+ import FSCol from "./FSCol.vue";
79
+ import FSRow from "./FSRow.vue";
80
+
81
+ export default defineComponent({
82
+ name: "FSAutocompleteField",
83
+ components: {
84
+ FSSpan,
85
+ FSCol,
86
+ FSRow
87
+ },
88
+ props: {
89
+ label: {
90
+ type: String,
91
+ required: false,
92
+ default: null
93
+ },
94
+ description: {
95
+ type: String,
96
+ required: false,
97
+ default: null
98
+ },
99
+ items: {
100
+ type: Array as PropType<any[]>,
101
+ required: true
102
+ },
103
+ itemValue: {
104
+ type: String,
105
+ required: false,
106
+ default: "id"
107
+ },
108
+ itemTitle: {
109
+ type: String,
110
+ required: false,
111
+ default: "label"
112
+ },
113
+ modelValue: {
114
+ type: [Array, String] as PropType<string[] | string>,
115
+ required: false,
116
+ default: null
117
+ },
118
+ multiple: {
119
+ type: Boolean,
120
+ required: false,
121
+ default: false
122
+ },
123
+ hideHeader: {
124
+ type: Boolean,
125
+ required: false,
126
+ default: false
127
+ },
128
+ required: {
129
+ type: Boolean,
130
+ required: false,
131
+ default: false
132
+ },
133
+ rules: {
134
+ type: Array as PropType<Function[]>,
135
+ required: false,
136
+ default: () => []
137
+ },
138
+ editable: {
139
+ type: Boolean,
140
+ required: false,
141
+ default: true
142
+ }
143
+ },
144
+ emits: ["update:modelValue", "update:search"],
145
+ setup: (props, { emit }) => {
146
+ const { slots } = useSlots();
147
+ delete slots.label;
148
+ delete slots.description;
149
+
150
+ const innerSearch = ref("");
151
+
152
+ const errors = useColors().getColors(ColorEnum.Error);
153
+ const lights = useColors().getColors(ColorEnum.Light);
154
+ const darks = useColors().getColors(ColorEnum.Dark);
155
+
156
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
157
+ if (!props.editable) {
158
+ return {
159
+ "--fs-autocomplete-field-cursor" : "default",
160
+ "--fs-autocomplete-field-border-color" : lights.base,
161
+ "--fs-autocomplete-field-color" : lights.dark,
162
+ "--fs-autocomplete-field-active-border-color": lights.base
163
+ };
164
+ }
165
+ return {
166
+ "--fs-autocomplete-field-cursor" : "text",
167
+ "--fs-autocomplete-field-border-color" : lights.dark,
168
+ "--fs-autocomplete-field-color" : darks.base,
169
+ "--fs-autocomplete-field-active-border-color": darks.dark,
170
+ "--fs-autocomplete-field-error-color" : errors.base,
171
+ "--fs-autocomplete-field-error-border-color" : errors.base
172
+ };
173
+ });
174
+
175
+ const messages = computed((): string[] => {
176
+ const messages = [];
177
+ for (const rule of props.rules) {
178
+ const message = rule(props.modelValue ?? "");
179
+ if (typeof(message) === "string") {
180
+ messages.push(message);
181
+ }
182
+ }
183
+ return messages;
184
+ });
185
+
186
+ const classes = computed((): string[] => {
187
+ const classNames = ["fs-autocomplete-field"];
188
+ if (props.multiple) {
189
+ classNames.push("fs-autocomplete-multiple-field");
190
+ }
191
+ return classNames;
192
+ });
193
+
194
+ watch(innerSearch, () => {
195
+ emit("update:search", innerSearch.value);
196
+ });
197
+
198
+ return {
199
+ messages,
200
+ slots,
201
+ style,
202
+ classes,
203
+ innerSearch
204
+ };
205
+ }
206
+ });
207
+ </script>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <v-badge
3
+ v-if="$props.content"
4
+ :content="$props.content"
5
+ :color="$props.color"
6
+ :bordered="true"
7
+ >
8
+ <template v-slot:default>
9
+ <slot />
10
+ </template>
11
+ </v-badge>
12
+ <slot
13
+ v-else
14
+ name="default"
15
+ />
16
+ </template>
17
+
18
+ <script lang="ts">
19
+ import { defineComponent, PropType } from "vue";
20
+
21
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
22
+
23
+ export default defineComponent({
24
+ name: "FSBadge",
25
+ props: {
26
+ content: {
27
+ type: String,
28
+ required: false,
29
+ default: null
30
+ },
31
+ color: {
32
+ type: String as PropType<ColorBase>,
33
+ required: false,
34
+ default: ColorEnum.Primary
35
+ }
36
+ }
37
+ });
38
+ </script>
@@ -1,69 +1,63 @@
1
1
  <template>
2
- <v-breadcrumbs v-bind="$attrs" :style="style" :items="$props.items">
3
- <template #title="{ item }">
4
- <FSSpan :class="classes(item)">
5
- {{ item.title }}
6
- </FSSpan>
7
- </template>
8
- <template #divider>
9
- <FSIcon class="fs-breadcrumbs-divider" size="m">
10
- mdi-chevron-right
11
- </FSIcon>
12
- </template>
13
- </v-breadcrumbs>
2
+ <v-breadcrumbs v-bind="$attrs" :style="style" :items="$props.items">
3
+ <template #title="{ item }">
4
+ <FSSpan :class="classes(item)">
5
+ {{ item.title }}
6
+ </FSSpan>
7
+ </template>
8
+ <template #divider>
9
+ <FSIcon
10
+ class="fs-breadcrumbs-divider"
11
+ size="m"
12
+ >
13
+ mdi-chevron-right
14
+ </FSIcon>
15
+ </template>
16
+ </v-breadcrumbs>
14
17
  </template>
15
18
 
16
19
  <script lang="ts">
17
20
  import { defineComponent, PropType, Ref, ref } from "vue";
18
21
 
22
+ import { ColorEnum, FSBreadcrumbItem } from "@dative-gpi/foundation-shared-components/models";
19
23
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
20
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
21
24
 
22
25
  import FSSpan from "./FSSpan.vue";
23
26
  import FSIcon from "./FSIcon.vue";
24
27
 
25
- export interface FSBreadcrumbItem {
26
- href: string | undefined,
27
- replace: boolean | undefined,
28
- to: string | undefined,
29
- exact: boolean | undefined,
30
- title: string,
31
- disabled: boolean
32
- }
33
-
34
28
  export default defineComponent({
35
- name: "FSBreadcrumbs",
36
- components: {
37
- FSSpan,
38
- FSIcon
39
- },
40
- props: {
41
- items: {
42
- type: Array as PropType<Array<FSBreadcrumbItem>>,
43
- required: true,
44
- }
45
- },
46
- setup() {
47
- const darks = useColors().getColors(ColorBase.Dark);
48
-
49
- const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
50
- "--fs-breadcrumbs-color": darks.dark,
51
- "--fs-breadcrumbs-active-color": darks.base,
52
- "--fs-breadcrumbs-disabled-color": darks.light
53
- });
54
-
55
- const classes = (item: FSBreadcrumbItem): string[] => {
56
- const classes = ["fs-breadcrumbs-label"];
57
- if (item.disabled) {
58
- classes.push("fs-breadcrumbs-label--disabled");
59
- }
60
- return classes;
61
- };
62
-
63
- return {
64
- style,
65
- classes
66
- };
29
+ name: "FSBreadcrumbs",
30
+ components: {
31
+ FSSpan,
32
+ FSIcon
33
+ },
34
+ props: {
35
+ items: {
36
+ type: Array as PropType<FSBreadcrumbItem[]>,
37
+ required: true,
67
38
  }
68
- })
39
+ },
40
+ setup() {
41
+ const darks = useColors().getColors(ColorEnum.Dark);
42
+
43
+ const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
44
+ "--fs-breadcrumbs-color": darks.dark,
45
+ "--fs-breadcrumbs-active-color": darks.base,
46
+ "--fs-breadcrumbs-disabled-color": darks.light
47
+ });
48
+
49
+ const classes = (item: FSBreadcrumbItem): string[] => {
50
+ const classNames = ["fs-breadcrumbs-label"];
51
+ if (item.disabled) {
52
+ classNames.push("fs-breadcrumbs-label--disabled");
53
+ }
54
+ return classNames;
55
+ };
56
+
57
+ return {
58
+ style,
59
+ classes
60
+ };
61
+ }
62
+ });
69
63
  </script>