@dative-gpi/foundation-shared-components 1.1.19 → 1.1.20-progress-bar

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.
@@ -3,16 +3,70 @@
3
3
  align="center-center"
4
4
  :style="style"
5
5
  >
6
- <div
7
- class="fs-progress-bar-gradient"
6
+ <template
7
+ v-if="isCentered"
8
8
  >
9
- <div></div>
10
- </div>
9
+ <div
10
+ class="fs-progress-bar-centered-wrapper"
11
+ >
12
+ <div
13
+ class="fs-progress-bar-centered"
14
+ >
15
+ <template
16
+ v-if="$props.cursor"
17
+ >
18
+ <div
19
+ class="fs-progress-bar-centered-cursor"
20
+ ></div>
21
+ </template>
22
+ <template
23
+ v-else
24
+ >
25
+ <div
26
+ class="fs-progress-bar-centered-fill"
27
+ ></div>
28
+ <div
29
+ class="fs-progress-bar-centered-marker"
30
+ ></div>
31
+ </template>
32
+ </div>
33
+ <div
34
+ v-if="$props.showLabels"
35
+ class="fs-progress-bar-centered-labels"
36
+ >
37
+ <FSText
38
+ font="text-overline"
39
+ >
40
+ {{ $props.min }}
41
+ </FSText>
42
+ <FSText
43
+ font="text-overline"
44
+ class="fs-progress-bar-centered-label-middle"
45
+ >
46
+ 0
47
+ </FSText>
48
+ <FSText
49
+ font="text-overline"
50
+ >
51
+ {{ $props.max }}
52
+ </FSText>
53
+ </div>
54
+ </div>
55
+ </template>
56
+ <template
57
+ v-else
58
+ >
59
+ <div
60
+ class="fs-progress-bar-gradient"
61
+ >
62
+ <div></div>
63
+ </div>
64
+ </template>
11
65
  <FSText
12
66
  v-if="$props.showValue"
13
67
  font="text-button"
14
68
  >
15
- {{ fixedRate }}%
69
+ {{ displayValue }}
16
70
  </FSText>
17
71
  </FSRow>
18
72
  </template>
@@ -50,6 +104,26 @@ export default defineComponent({
50
104
  type: Boolean,
51
105
  required: false,
52
106
  default: true
107
+ },
108
+ min: {
109
+ type: Number,
110
+ required: false,
111
+ default: undefined
112
+ },
113
+ max: {
114
+ type: Number,
115
+ required: false,
116
+ default: undefined
117
+ },
118
+ showLabels: {
119
+ type: Boolean,
120
+ required: false,
121
+ default: true
122
+ },
123
+ cursor: {
124
+ type: Boolean,
125
+ required: false,
126
+ default: false
53
127
  }
54
128
  },
55
129
  setup(props) {
@@ -58,7 +132,7 @@ export default defineComponent({
58
132
  const lightColors = getColors(ColorEnum.Light);
59
133
  const successColors = getColors(ColorEnum.Success);
60
134
  const errorColors = getColors(ColorEnum.Error);
61
-
135
+
62
136
  const fixedRate = computed(() => {
63
137
  return (props.modelValue * 100).toFixed(0);
64
138
  });
@@ -66,7 +140,7 @@ export default defineComponent({
66
140
  const relativeWidth = computed(() => {
67
141
  return props.modelValue ? 100 / props.modelValue : 0;
68
142
  });
69
-
143
+
70
144
  const startColor = computed(() => {
71
145
  return props.startColor ?? errorColors.base;
72
146
  });
@@ -75,7 +149,50 @@ export default defineComponent({
75
149
  return props.endColor ?? successColors.base;
76
150
  });
77
151
 
152
+ const isCentered = computed(() => {
153
+ return props.min !== undefined && props.max !== undefined;
154
+ });
155
+
156
+ const effectiveMin = computed(() => props.min ?? -1);
157
+ const effectiveMax = computed(() => props.max ?? 1);
158
+
159
+ const centerPercent = computed(() => {
160
+ return ((0 - effectiveMin.value) / (effectiveMax.value - effectiveMin.value)) * 100;
161
+ });
162
+
163
+ const valuePercent = computed(() => {
164
+ const clamped = Math.min(Math.max(props.modelValue, effectiveMin.value), effectiveMax.value);
165
+ return ((clamped - effectiveMin.value) / (effectiveMax.value - effectiveMin.value)) * 100;
166
+ });
167
+
168
+ const fillLeft = computed(() => {
169
+ return Math.min(centerPercent.value, valuePercent.value);
170
+ });
171
+
172
+ const fillWidth = computed(() => {
173
+ return Math.abs(valuePercent.value - centerPercent.value);
174
+ });
175
+
176
+ const displayValue = computed(() => {
177
+ return isCentered.value
178
+ ? props.modelValue.toFixed(2)
179
+ : `${fixedRate.value}%`;
180
+ });
181
+
78
182
  const style = computed((): StyleValue => {
183
+ if (isCentered.value) {
184
+ const fillColor = props.modelValue >= 0
185
+ ? (props.endColor ?? successColors.dark)
186
+ : (props.startColor ?? errorColors.dark);
187
+ return {
188
+ '--progress-bar-background-color': lightColors.dark,
189
+ '--progress-bar-fill-color': fillColor,
190
+ '--progress-bar-fill-left': `${fillLeft.value}%`,
191
+ '--progress-bar-fill-width': `${fillWidth.value}%`,
192
+ '--progress-bar-center-position': `${centerPercent.value}%`,
193
+ '--progress-bar-value-position': `${valuePercent.value}%`
194
+ };
195
+ }
79
196
  return {
80
197
  '--progress-bar-background-color': lightColors.dark,
81
198
  '--progress-bar-gradient-start-color': startColor.value,
@@ -86,8 +203,9 @@ export default defineComponent({
86
203
  });
87
204
 
88
205
  return {
206
+ isCentered,
89
207
  style,
90
- fixedRate
208
+ displayValue
91
209
  }
92
210
  },
93
211
  });
@@ -389,7 +389,7 @@ export default defineComponent({
389
389
  if(!map.value || !props.bounds) {
390
390
  return;
391
391
  }
392
- fitBounds(props.bounds, { maxZoom: 14 });
392
+ fitBounds(props.bounds, { maxZoom: props.zoom });
393
393
  });
394
394
 
395
395
  watch(() => props.enableScrollWheelZoom, (newValue) => {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "url": "https://github.com/Dative-GPI/foundation-shared-ui.git"
5
5
  },
6
6
  "sideEffects": false,
7
- "version": "1.1.19",
7
+ "version": "1.1.20-progress-bar",
8
8
  "description": "",
9
9
  "publishConfig": {
10
10
  "access": "public"
@@ -13,8 +13,8 @@
13
13
  "author": "",
14
14
  "license": "ISC",
15
15
  "dependencies": {
16
- "@dative-gpi/foundation-shared-domain": "1.1.19",
17
- "@dative-gpi/foundation-shared-services": "1.1.19"
16
+ "@dative-gpi/foundation-shared-domain": "1.1.20-progress-bar",
17
+ "@dative-gpi/foundation-shared-services": "1.1.20-progress-bar"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@dative-gpi/bones-ui": "^1.0.0",
@@ -38,5 +38,5 @@
38
38
  "sass": "1.71.1",
39
39
  "sass-loader": "13.3.2"
40
40
  },
41
- "gitHead": "ac4763dd165ca723d5518dd2965e4fbc8ba092e4"
41
+ "gitHead": "0b4a2295745dff49b26c5c3934a04af92560c8b1"
42
42
  }
@@ -11,4 +11,62 @@
11
11
  width: var(--progress-bar-gradient-width);
12
12
  border-radius: 4px;
13
13
  }
14
+ }
15
+
16
+ .fs-progress-bar-centered-wrapper {
17
+ flex: 1;
18
+ display: flex;
19
+ flex-direction: column;
20
+ gap: 2px;
21
+ }
22
+
23
+ .fs-progress-bar-centered {
24
+ position: relative;
25
+ background-color: var(--progress-bar-background-color);
26
+ height: 8px;
27
+ border-radius: 4px;
28
+
29
+ .fs-progress-bar-centered-fill {
30
+ position: absolute;
31
+ height: 100%;
32
+ background-color: var(--progress-bar-fill-color);
33
+ left: var(--progress-bar-fill-left);
34
+ width: var(--progress-bar-fill-width);
35
+ border-radius: 4px;
36
+ transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
37
+ }
38
+
39
+ .fs-progress-bar-centered-marker {
40
+ position: absolute;
41
+ top: 0;
42
+ height: 100%;
43
+ width: 2px;
44
+ background-color: var(--progress-bar-background-color);
45
+ left: var(--progress-bar-center-position);
46
+ transform: translateX(-50%);
47
+ }
48
+
49
+ .fs-progress-bar-centered-cursor {
50
+ position: absolute;
51
+ top: 0;
52
+ height: 100%;
53
+ width: 12px;
54
+ border-radius: 4px;
55
+ background-color: var(--progress-bar-fill-color);
56
+ left: var(--progress-bar-value-position);
57
+ transform: translateX(-50%);
58
+ transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
59
+ }
60
+ }
61
+
62
+ .fs-progress-bar-centered-labels {
63
+ position: relative;
64
+ display: flex;
65
+ justify-content: space-between;
66
+
67
+ .fs-progress-bar-centered-label-middle {
68
+ position: absolute;
69
+ left: var(--progress-bar-center-position);
70
+ transform: translateX(-50%);
71
+ }
14
72
  }