@dative-gpi/foundation-shared-components 1.0.136 → 1.0.137

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.
@@ -0,0 +1,170 @@
1
+ <template>
2
+ <component
3
+ v-if="$props.modelStatus"
4
+ class="fs-status-rich-card"
5
+ variant="standard"
6
+ :is="$attrs.onClick ? FSClickable : FSCard"
7
+ :padding="$props.padding"
8
+ :height="$props.height"
9
+ :width="$props.width"
10
+ :color="color"
11
+ :style="style"
12
+ >
13
+ <FSCol
14
+ align="center-center"
15
+ :gap="$props.gap"
16
+ >
17
+ <FSRow
18
+ align="top-center"
19
+ >
20
+ <FSIcon
21
+ v-if="icon"
22
+ >
23
+ {{ icon }}
24
+ </FSIcon>
25
+ <FSText
26
+ v-if="value"
27
+ font="text-button"
28
+ >
29
+ {{ value }}
30
+ </FSText>
31
+ </FSRow>
32
+ <FSText
33
+ font="text-overline"
34
+ align="center"
35
+ :lineClamp="$props.titleClamp"
36
+ >
37
+ {{ title }}
38
+ </FSText>
39
+ <slot
40
+ name="footer"
41
+ v-bind="{ color }"
42
+ />
43
+ </FSCol>
44
+ <div
45
+ class="fs-status-rich-card-corner"
46
+ >
47
+ <slot
48
+ name="corner"
49
+ v-bind="{ color }"
50
+ />
51
+ </div>
52
+ </component>
53
+ </template>
54
+
55
+ <script lang="ts">
56
+ import { computed, defineComponent, type PropType, type StyleValue } from "vue";
57
+
58
+ import { ColorEnum, type FSDeviceStatusGroup, type FSModelStatus } from "@dative-gpi/foundation-shared-components/models";
59
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
60
+
61
+ import FSClickable from "../FSClickable.vue";
62
+ import FSCard from "../FSCard.vue";
63
+ import FSIcon from "../FSChip.vue";
64
+ import FSText from "../FSText.vue";
65
+ import FSCol from "../FSCol.vue";
66
+
67
+ export default defineComponent({
68
+ name: "FSStatusRichCard",
69
+ components: {
70
+ FSClickable,
71
+ FSCard,
72
+ FSIcon,
73
+ FSText,
74
+ FSCol
75
+ },
76
+ props: {
77
+ height: {
78
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
79
+ required: false,
80
+ default: "100px"
81
+ },
82
+ width: {
83
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
84
+ required: false,
85
+ default: "160px"
86
+ },
87
+ padding: {
88
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
89
+ required: false,
90
+ default: "12px"
91
+ },
92
+ gap: {
93
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
94
+ required: false,
95
+ default: "8px"
96
+ },
97
+ title: {
98
+ type: [String, null] as PropType<string | null>,
99
+ required: false,
100
+ default: null
101
+ },
102
+ titleClamp: {
103
+ type: Number,
104
+ required: false,
105
+ default: 2
106
+ },
107
+ color: {
108
+ type: [String, null] as PropType<string | null>,
109
+ required: false,
110
+ default: null
111
+ },
112
+ fillBackground: {
113
+ type: Boolean,
114
+ required: false,
115
+ default: false
116
+ },
117
+ modelStatus: {
118
+ type: Object as PropType<FSModelStatus | undefined>,
119
+ required: true
120
+ },
121
+ statusGroup: {
122
+ type: Object as PropType<FSDeviceStatusGroup | undefined>,
123
+ required: true
124
+ }
125
+ },
126
+ setup(props) {
127
+ const { getColors } = useColors();
128
+
129
+ const color = computed((): string => {
130
+ return props.color ?? props.statusGroup?.color ?? props.modelStatus?.colorDefault ?? ColorEnum.Primary;
131
+ });
132
+
133
+ const icon = computed((): string | null => {
134
+ return props.statusGroup?.icon ?? props.modelStatus?.iconDefault ?? null;
135
+ });
136
+
137
+ const title = computed((): string => {
138
+ return props.title ?? props.modelStatus?.label;
139
+ });
140
+
141
+ const value = computed((): string | null => {
142
+ if (props.statusGroup?.label) {
143
+ return props.statusGroup.label;
144
+ }
145
+ if (props.statusGroup?.value && !isNaN(parseFloat(props.statusGroup?.value))) {
146
+ return `${parseFloat(props.statusGroup.value).toLocaleString("fullwide", { maximumFractionDigits: 2 })} ${props.statusGroup.unit}`;
147
+ }
148
+ if (props.statusGroup?.value) {
149
+ return `${props.statusGroup?.value} ${props.statusGroup?.unit}`;
150
+ }
151
+ return null;
152
+ });
153
+
154
+ const style = computed((): StyleValue => ({
155
+ "--fs-status-rich-card-background-color": props.fillBackground ? getColors(color.value).light : "transparent",
156
+ "--fs-status-rich-card-border-color": props.fillBackground ? getColors(color.value).base : getColors(ColorEnum.Light).dark
157
+ }));
158
+
159
+ return {
160
+ FSClickable,
161
+ FSCard,
162
+ color,
163
+ style,
164
+ title,
165
+ value,
166
+ icon
167
+ };
168
+ }
169
+ });
170
+ </script>
@@ -97,6 +97,13 @@
97
97
  :imageId="$props.imageId"
98
98
  :width="imageSize"
99
99
  />
100
+ <FSIconCard
101
+ v-else-if="$props.icon"
102
+ backgroundVariant="standard"
103
+ :backgroundColor="ColorEnum.Background"
104
+ :icon="$props.icon"
105
+ :size="imageSize"
106
+ />
100
107
  </FSRow>
101
108
  </FSCol>
102
109
  </FSTile>
@@ -108,6 +115,7 @@ import { computed, defineComponent, type PropType } from "vue";
108
115
  import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
109
116
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
110
117
 
118
+ import FSIconCard from "../FSIconCard.vue";
111
119
  import FSImage from "../FSImage.vue";
112
120
  import FSColor from "../FSColor.vue";
113
121
  import FSSpan from "../FSSpan.vue";
@@ -118,6 +126,7 @@ import FSRow from "../FSRow.vue";
118
126
  export default defineComponent({
119
127
  name: "FSGroupTileUI",
120
128
  components: {
129
+ FSIconCard,
121
130
  FSImage,
122
131
  FSColor,
123
132
  FSSpan,
@@ -131,6 +140,10 @@ export default defineComponent({
131
140
  required: false,
132
141
  default: null
133
142
  },
143
+ icon: {
144
+ type: String,
145
+ required: false
146
+ },
134
147
  label: {
135
148
  type: String as PropType<string | null>,
136
149
  required: false,
@@ -183,7 +196,7 @@ export default defineComponent({
183
196
  });
184
197
 
185
198
  const infoWidth = computed((): string => {
186
- if (!props.imageId) {
199
+ if (!props.imageId && !props.icon) {
187
200
  return "100%";
188
201
  }
189
202
  return `calc(100% - ${imageSize.value}px - 24px)`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-components",
3
3
  "sideEffects": false,
4
- "version": "1.0.136",
4
+ "version": "1.0.137",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,8 +10,8 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-shared-domain": "1.0.136",
14
- "@dative-gpi/foundation-shared-services": "1.0.136"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.137",
14
+ "@dative-gpi/foundation-shared-services": "1.0.137"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@dative-gpi/bones-ui": "^1.0.0",
@@ -35,5 +35,5 @@
35
35
  "sass": "1.71.1",
36
36
  "sass-loader": "13.3.2"
37
37
  },
38
- "gitHead": "df237c4e7f1809136efb6d7bcf19a2ddd3a47e10"
38
+ "gitHead": "676162c4362dd556d5ef714f7b17a047ad7f2bad"
39
39
  }
@@ -0,0 +1,13 @@
1
+ .fs-status-rich-card {
2
+ position: relative;
3
+ flex-grow: 1;
4
+ background-color: var(--fs-status-rich-card-background-color);
5
+ border-color: var(--fs-status-rich-card-border-color);
6
+ }
7
+
8
+ .fs-status-rich-card-corner {
9
+ position: absolute;
10
+ display: flex;
11
+ right: 2px;
12
+ top: 2px;
13
+ }
@@ -55,6 +55,7 @@
55
55
  @import "fs_slide_group.scss";
56
56
  @import "fs_slider.scss";
57
57
  @import "fs_span.scss";
58
+ @import "fs_status_rich_card.scss";
58
59
  @import "fs_switch.scss";
59
60
  @import "fs_tag.scss";
60
61
  @import "fs_tabs.scss";