@eturnity/eturnity_reusable_components 8.19.8-EPDM-14690.4 → 8.19.8-EPDM-11600.11

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.
@@ -30,61 +30,7 @@
30
30
  />
31
31
  </LabelWrapper>
32
32
  <InputWrapper>
33
- <InputInfoText
34
- v-if="!!inputInfoText"
35
- info-position="bottom"
36
- :text="inputInfoText"
37
- >
38
- <template #trigger>
39
- <InputContainer
40
- v-bind="$attrs"
41
- ref="inputField1"
42
- :align-items="alignItems"
43
- :background-color="
44
- colorMode === 'transparent' ? 'transparent' : backgroundColor
45
- "
46
- :border-color="
47
- colorMode === 'transparent' && !borderColor
48
- ? 'white'
49
- : borderColor
50
- "
51
- :color-mode="colorMode"
52
- :data-id="inputDataId"
53
- :data-qa-id="dataQaId"
54
- :disabled="disabled && !isDisabledStyledOnly"
55
- :font-color="colorMode === 'transparent' ? 'white' : fontColor"
56
- :font-size="fontSize"
57
- :has-label-slot="hasLabelSlot"
58
- :has-slot="hasSlot"
59
- :has-unit="unitName && !!unitName.length"
60
- :input-height="inputHeight"
61
- :is-border-error-only="isBorderErrorOnly"
62
- :is-disabled="disabled"
63
- :is-error="isError"
64
- :is-info-border="isInfoBorder"
65
- :is-interactive="isInteractive"
66
- :min-width="minWidth"
67
- :no-border="noBorder"
68
- :placeholder="displayedPlaceholder"
69
- :read-only="isReadOnly"
70
- :readonly="isReadOnly"
71
- :show-arrow-controls="showArrowControls"
72
- :show-linear-unit-name="showLinearUnitName"
73
- :slot-size="slotSize"
74
- :text-align="textAlign"
75
- :value="formatWithCurrency(value)"
76
- @blur="onInputBlur($event)"
77
- @focus="focusInput()"
78
- @input="onInput($event)"
79
- @keydown.down="decrementValue"
80
- @keydown.up="incrementValue"
81
- @keyup.enter="onEnterPress"
82
- />
83
- </template>
84
- </InputInfoText>
85
-
86
33
  <InputContainer
87
- v-else
88
34
  v-bind="$attrs"
89
35
  ref="inputField1"
90
36
  :align-items="alignItems"
@@ -97,23 +43,19 @@
97
43
  :color-mode="colorMode"
98
44
  :data-id="inputDataId"
99
45
  :data-qa-id="dataQaId"
100
- :disabled="disabled && !isDisabledStyledOnly"
101
46
  :font-color="colorMode === 'transparent' ? 'white' : fontColor"
102
47
  :font-size="fontSize"
103
48
  :has-label-slot="hasLabelSlot"
104
49
  :has-slot="hasSlot"
105
50
  :has-unit="unitName && !!unitName.length"
106
51
  :input-height="inputHeight"
107
- :is-border-error-only="isBorderErrorOnly"
108
52
  :is-disabled="disabled"
109
53
  :is-error="isError"
110
- :is-info-border="isInfoBorder"
111
54
  :is-interactive="isInteractive"
112
55
  :min-width="minWidth"
113
56
  :no-border="noBorder"
114
57
  :placeholder="displayedPlaceholder"
115
58
  :read-only="isReadOnly"
116
- :readonly="isReadOnly"
117
59
  :show-arrow-controls="showArrowControls"
118
60
  :show-linear-unit-name="showLinearUnitName"
119
61
  :slot-size="slotSize"
@@ -126,7 +68,6 @@
126
68
  @keydown.up="incrementValue"
127
69
  @keyup.enter="onEnterPress"
128
70
  />
129
-
130
71
  <SlotContainer v-if="hasSlot" :is-error="isError" :slot-size="slotSize">
131
72
  <slot></slot>
132
73
  </SlotContainer>
@@ -138,7 +79,7 @@
138
79
  >{{ unitName }}</UnitContainer
139
80
  >
140
81
  <IconWrapper
141
- v-if="isError && !showLinearUnitName && !isBorderErrorOnly"
82
+ v-if="isError && !showLinearUnitName"
142
83
  :margin-right="showSelect ? selectWidth : 0"
143
84
  size="16px"
144
85
  >
@@ -192,9 +133,7 @@
192
133
  </ArrowButton>
193
134
  </ArrowControls>
194
135
  </InputWrapper>
195
- <ErrorMessage v-if="isError && errorMessage">{{
196
- errorMessage
197
- }}</ErrorMessage>
136
+ <ErrorMessage v-if="isError && errorMessage">{{ errorMessage }}</ErrorMessage>
198
137
  </Container>
199
138
  </template>
200
139
 
@@ -265,8 +204,6 @@
265
204
  colorMode: String,
266
205
  showArrowControls: Boolean,
267
206
  readOnly: Boolean,
268
- isBorderErrorOnly: Boolean,
269
- isInfoBorder: Boolean,
270
207
  }
271
208
 
272
209
  const Container = styled('div', inputProps)`
@@ -279,9 +216,7 @@
279
216
 
280
217
  const InputContainer = styled('input', inputProps)`
281
218
  border: ${(props) =>
282
- props.isInfoBorder
283
- ? '1px solid ' + props.theme.semanticColors.blue[500]
284
- : props.isError
219
+ props.isError
285
220
  ? '1px solid ' + props.theme.colors.red
286
221
  : props.noBorder
287
222
  ? 'none'
@@ -300,17 +235,16 @@
300
235
  showLinearUnitName,
301
236
  colorMode,
302
237
  showArrowControls,
303
- isBorderErrorOnly,
304
238
  }) =>
305
239
  showArrowControls
306
240
  ? '40px'
307
241
  : colorMode === 'transparent'
308
242
  ? '0'
309
243
  : slotSize
310
- ? isError && !showLinearUnitName && !isBorderErrorOnly
244
+ ? isError && !showLinearUnitName
311
245
  ? 'calc(' + slotSize + ' + 24px)'
312
246
  : 'calc(' + slotSize + ' + 10px)'
313
- : isError && !showLinearUnitName && !isBorderErrorOnly
247
+ : isError && !showLinearUnitName
314
248
  ? '24px'
315
249
  : '5px'};
316
250
  border-radius: ${(props) =>
@@ -522,10 +456,6 @@
522
456
  background-color: ${({ theme }) => theme.colors.grey4};
523
457
  `
524
458
 
525
- const InputInfoText = styled(InfoText)`
526
- width: 100%;
527
- `
528
-
529
459
  export default {
530
460
  name: 'InputNumber',
531
461
  components: {
@@ -549,7 +479,6 @@
549
479
  ArrowControls,
550
480
  ArrowButton,
551
481
  ArrowDivider,
552
- InputInfoText,
553
482
  },
554
483
  inheritAttrs: false,
555
484
  props: {
@@ -728,12 +657,18 @@
728
657
  required: false,
729
658
  default: '',
730
659
  },
660
+ labelDataTestId: {
661
+ type: String,
662
+ required: false,
663
+ default: '',
664
+ },
731
665
  inputDataId: {
732
666
  type: String,
733
667
  required: false,
734
668
  default: '',
735
669
  },
736
670
  dataQaId: {
671
+ type: String,
737
672
  required: false,
738
673
  default: '',
739
674
  },
@@ -769,22 +704,6 @@
769
704
  type: Boolean,
770
705
  default: false,
771
706
  },
772
- isBorderErrorOnly: {
773
- type: Boolean,
774
- default: false,
775
- },
776
- isInfoBorder: {
777
- type: Boolean,
778
- default: false,
779
- },
780
- inputInfoText: {
781
- type: String,
782
- default: '',
783
- },
784
- isDisabledStyledOnly: {
785
- type: Boolean,
786
- default: false,
787
- },
788
707
  },
789
708
  data() {
790
709
  return {
@@ -5,7 +5,8 @@
5
5
  :has-info-text="!!infoText"
6
6
  :margin-bottom="marginBottom"
7
7
  >
8
- <span data-test-id="page_subtitle_text">
8
+ <span v-if="containsHtml" data-test-id="page_subtitle_text" v-html="text"></span>
9
+ <span v-else data-test-id="page_subtitle_text">
9
10
  {{ text }}
10
11
  </span>
11
12
  <InfoText
@@ -58,6 +59,11 @@
58
59
  required: true,
59
60
  type: String,
60
61
  },
62
+ containsHtml: {
63
+ required: false,
64
+ type: Boolean,
65
+ default: false,
66
+ },
61
67
  color: {
62
68
  required: false,
63
69
  type: String,
@@ -46,6 +46,7 @@
46
46
  color: ${(props) => (props.color ? props.color : props.theme.colors.black)};
47
47
  font-weight: 600;
48
48
  font-size: ${(props) => (props.fontSize ? props.fontSize : '20px')};
49
+ text-transform: ${(props) => (props.uppercase ? 'uppercase' : 'none')};
49
50
  `
50
51
 
51
52
  export default {
package/src/DemoChart.vue DELETED
@@ -1,424 +0,0 @@
1
- <template>
2
- <div class="demo-container">
3
- <h1>BarChart Component Examples</h1>
4
-
5
- <h2>1. Basic Bar Chart</h2>
6
- <BarChart
7
- :data="basicData"
8
- :value-formatter="kwhFormatter"
9
- height="300px"
10
- width="800px"
11
- />
12
-
13
- <h2>2. Bar Chart with Custom Bar Width</h2>
14
- <BarChart
15
- :bar-width="80"
16
- :data="basicData"
17
- :value-formatter="kwhFormatter"
18
- height="300px"
19
- width="800px"
20
- />
21
-
22
- <h2>3. Stacked Bar Chart - 3 Series with Legend</h2>
23
- <BarChart
24
- :bar-width="80"
25
- :data="quarterLabels"
26
- :is-legend-shown="true"
27
- :series="threeZoneSeries"
28
- :value-formatter="kwhFormatter"
29
- height="400px"
30
- width="800px"
31
- />
32
-
33
- <h2>4. Stacked Bar Chart - 6 Series with Multi-Row Legend</h2>
34
- <BarChart
35
- :bar-width="60"
36
- :data="monthLabels"
37
- :is-legend-shown="true"
38
- :legends-item-per-row="3"
39
- :series="tariffZones"
40
- :value-formatter="kwhFormatter"
41
- height="400px"
42
- width="800px"
43
- />
44
-
45
- <h2>5. Scrollable Chart with Many Data Points</h2>
46
- <BarChart
47
- :bar-width="40"
48
- :data="dailyData"
49
- :is-scrollable="true"
50
- :value-formatter="kwhFormatter"
51
- height="300px"
52
- width="800px"
53
- />
54
-
55
- <h2>6. Scrollable Chart with Selection</h2>
56
- <BarChart
57
- :bar-width="40"
58
- :data="dailyData"
59
- :is-scrollable="true"
60
- :is-selection-enabled="true"
61
- :selection-size="5"
62
- :value-formatter="kwhFormatter"
63
- height="300px"
64
- width="800px"
65
- @selection-change="handleSelectionChange"
66
- />
67
-
68
- <h2>7. Chart with Top Controls & Time Frame Selector</h2>
69
- <BarChart
70
- :bar-width="70"
71
- :data="quarterLabels"
72
- :is-legend-shown="true"
73
- :selected-split-button="selectedTimeFrame"
74
- :series="threeZoneSeries"
75
- :split-button-options="timeFrameOptions"
76
- :value-formatter="kwhFormatter"
77
- chart-controls-position="top"
78
- height="350px"
79
- width="800px"
80
- @select-split-button="handleTimeFrameSelect"
81
- />
82
-
83
- <h2>8. Chart with Bottom Controls & Time Frame Selector</h2>
84
- <BarChart
85
- :bar-width="70"
86
- :data="quarterLabels"
87
- :is-legend-shown="true"
88
- :selected-split-button="selectedTimeFrame"
89
- :series="threeZoneSeries"
90
- :split-button-options="timeFrameOptions"
91
- :value-formatter="kwhFormatter"
92
- chart-controls-position="bottom"
93
- height="350px"
94
- width="800px"
95
- @select-split-button="handleTimeFrameSelect"
96
- />
97
-
98
- <h2>9. Chart with Custom Tooltip</h2>
99
- <BarChart :bar-width="60" :data="basicData" height="300px" width="800px">
100
- <template #tooltip="{ item }">
101
- <div style="padding: 8px">
102
- <div style="font-weight: bold">{{ item.label }}</div>
103
- <div>Consumption: {{ kwhFormatter(item.segments[0].value) }}</div>
104
- <div>Peak Time: {{ getPeakTime(item.label) }}</div>
105
- <div>Efficiency: {{ getEfficiency(item.segments[0].value) }}</div>
106
- </div>
107
- </template>
108
- </BarChart>
109
-
110
- <h2>10. Chart with Bottom Fields</h2>
111
- <BarChart
112
- :bar-width="60"
113
- :data="basicData"
114
- :is-bottom-fields-shown="true"
115
- :value-formatter="kwhFormatter"
116
- height="300px"
117
- width="800px"
118
- @update-value="handleValueUpdate"
119
- />
120
-
121
- <h2>11. Scrollable Chart with Bottom Fields</h2>
122
- <BarChart
123
- :bar-width="40"
124
- :data="monthlyData"
125
- :is-bottom-fields-shown="true"
126
- :is-scrollable="true"
127
- :value-formatter="kwhFormatter"
128
- height="300px"
129
- width="800px"
130
- />
131
-
132
- <h2>12. Stacked Chart with Bottom Fields</h2>
133
- <BarChart
134
- :bar-width="70"
135
- :data="quarterLabels"
136
- :is-bottom-fields-shown="true"
137
- :is-legend-shown="true"
138
- :series="threeZoneSeries"
139
- :value-formatter="kwhFormatter"
140
- height="400px"
141
- width="800px"
142
- />
143
-
144
- <h2>13. Scrollable Stacked Chart with Bottom Fields</h2>
145
- <BarChart
146
- :bar-width="60"
147
- :data="monthLabels"
148
- :is-bottom-fields-shown="true"
149
- :is-legend-shown="true"
150
- :is-scrollable="true"
151
- :legends-item-per-row="3"
152
- :series="tariffZones"
153
- :value-formatter="kwhFormatter"
154
- height="400px"
155
- width="800px"
156
- />
157
-
158
- <h2>14. Chart with Selection and Bottom Fields</h2>
159
- <BarChart
160
- :bar-width="40"
161
- :data="monthlyData"
162
- :is-bottom-fields-shown="true"
163
- :is-scrollable="true"
164
- :is-selection-enabled="true"
165
- :selection-size="6"
166
- :value-formatter="kwhFormatter"
167
- height="350px"
168
- width="800px"
169
- @selection-change="handleSelectionChange"
170
- />
171
-
172
- <h2>15. Stacked Chart and Bottom Fields</h2>
173
- <BarChart
174
- :bar-width="70"
175
- :data="quarterLabels"
176
- :is-bottom-fields-shown="true"
177
- :is-legend-shown="true"
178
- :series="threeZoneSeries"
179
- :value-formatter="kwhFormatter"
180
- height="400px"
181
- width="800px"
182
- @selection-change="handleSelectionChange"
183
- />
184
- </div>
185
- </template>
186
-
187
- <script setup>
188
- import { ref } from 'vue'
189
- import BarChart from './components/barchart/index.vue'
190
-
191
- // Formatters
192
- const kwhFormatter = (value) => `${value.toLocaleString()} kWh`
193
-
194
- // Basic data
195
- const basicData = [
196
- { label: 'Jan', value: 1200 },
197
- { label: 'Feb', value: 1800 },
198
- { label: 'Mar', value: 2200 },
199
- { label: 'Apr', value: 1600 },
200
- { label: 'May', value: 2400 },
201
- { label: 'Jun', value: 2800 },
202
- { label: 'Jul', value: 2200 },
203
- { label: 'Aug', value: 1600 },
204
- { label: 'Sep', value: 2400 },
205
- { label: 'Oct', value: 2800 },
206
- { label: 'Nov', value: 2200 },
207
- { label: 'Dec', value: 1600 },
208
- ]
209
-
210
- // Minimal data with fewer points
211
- const minimalData = [
212
- { label: 'Q1', value: 3500 },
213
- { label: 'Q2', value: 4200 },
214
- { label: 'Q3', value: 5100 },
215
- { label: 'Q4', value: 4800 },
216
- ]
217
-
218
- // Labels for stacked charts
219
- const quarterLabels = [
220
- { label: 'Q1' },
221
- { label: 'Q2' },
222
- { label: 'Q3' },
223
- { label: 'Q4' },
224
- ]
225
-
226
- const monthLabels = [
227
- { label: 'Jan' },
228
- { label: 'Feb' },
229
- { label: 'Mar' },
230
- { label: 'Apr' },
231
- { label: 'May' },
232
- { label: 'Jun' },
233
- { label: 'Jul' },
234
- { label: 'Aug' },
235
- { label: 'Sep' },
236
- { label: 'Oct' },
237
- { label: 'Nov' },
238
- { label: 'Dec' },
239
- ]
240
-
241
- const monthlyData = [
242
- { label: 'Jan', value: 300 },
243
- { label: 'Feb', value: 600 },
244
- { label: 'Mar', value: 1000 },
245
- { label: 'Apr', value: 1200 },
246
- { label: 'May', value: 1400 },
247
- { label: 'Jun', value: 1810 },
248
- { label: 'Jul', value: 2000 },
249
- { label: 'Aug', value: 2200 },
250
- { label: 'Sep', value: 2400 },
251
- { label: 'Oct', value: 2600 },
252
- { label: 'Nov', value: 2800 },
253
- { label: 'Dec', value: 3000 },
254
- { label: 'Jan 2024', value: 2800 },
255
- { label: 'Feb 2024', value: 2600 },
256
- { label: 'Mar 2024', value: 2900 },
257
- { label: 'Apr 2024', value: 3100 },
258
- { label: 'May 2024', value: 2700 },
259
- { label: 'Jun 2024', value: 2500 },
260
- ]
261
-
262
- // Three zone series data
263
- const threeZoneSeries = [
264
- {
265
- name: 'Peak Hours',
266
- data: [
267
- { label: 'Q1', value: 800 },
268
- { label: 'Q2', value: 1200 },
269
- { label: 'Q3', value: 1600 },
270
- { label: 'Q4', value: 1400 },
271
- ],
272
- },
273
- {
274
- name: 'Mid-Peak',
275
- data: [
276
- { label: 'Q1', value: 600 },
277
- { label: 'Q2', value: 800 },
278
- { label: 'Q3', value: 1000 },
279
- { label: 'Q4', value: 900 },
280
- ],
281
- },
282
- {
283
- name: 'Off-Peak',
284
- data: [
285
- { label: 'Q1', value: 400 },
286
- { label: 'Q2', value: 500 },
287
- { label: 'Q3', value: 600 },
288
- { label: 'Q4', value: 550 },
289
- ],
290
- },
291
- ]
292
-
293
- // Six zone series data
294
- const tariffZones = [
295
- {
296
- name: 'Residential',
297
- data: monthLabels.map(() => ({
298
- label: 'Jan',
299
- value: Math.floor(Math.random() * 300) + 100,
300
- })),
301
- },
302
- {
303
- name: 'Commercial',
304
- data: monthLabels.map(() => ({
305
- label: 'Jan',
306
- value: Math.floor(Math.random() * 400) + 200,
307
- })),
308
- },
309
- {
310
- name: 'Industrial',
311
- data: monthLabels.map(() => ({
312
- label: 'Jan',
313
- value: Math.floor(Math.random() * 500) + 300,
314
- })),
315
- },
316
- {
317
- name: 'Agricultural',
318
- data: monthLabels.map(() => ({
319
- label: 'Jan',
320
- value: Math.floor(Math.random() * 200) + 100,
321
- })),
322
- },
323
- {
324
- name: 'Public',
325
- data: monthLabels.map(() => ({
326
- label: 'Jan',
327
- value: Math.floor(Math.random() * 300) + 150,
328
- })),
329
- },
330
- {
331
- name: 'Special',
332
- data: monthLabels.map(() => ({
333
- label: 'Jan',
334
- value: Math.floor(Math.random() * 250) + 100,
335
- })),
336
- },
337
- ].map((zone) => ({
338
- ...zone,
339
- data: zone.data.map((item, index) => ({
340
- ...item,
341
- label: monthLabels[index].label,
342
- })),
343
- }))
344
-
345
- // Daily data for scrollable example
346
- const dailyData = Array.from({ length: 31 }, (_, i) => ({
347
- label: `Day ${i + 1}`,
348
- value: Math.floor(Math.random() * 200) + 50,
349
- }))
350
-
351
- // Time frame options
352
- const timeFrameOptions = [
353
- { label: 'Daily', value: 'daily' },
354
- { label: 'Weekly', value: 'weekly' },
355
- { label: 'Monthly', value: 'monthly' },
356
- { label: 'Yearly', value: 'yearly' },
357
- ]
358
- const selectedTimeFrame = ref('monthly')
359
-
360
- // View options
361
- const viewOptions = [
362
- { label: 'Chart', value: 'chart' },
363
- { label: 'Table', value: 'table' },
364
- { label: 'Combined', value: 'combined' },
365
- ]
366
- const selectedView = ref('chart')
367
-
368
- // Handlers
369
- const handleTimeFrameSelect = (value) => {
370
- selectedTimeFrame.value = value
371
- console.log(`Time frame changed to: ${value}`)
372
- }
373
-
374
- const handleViewSelect = (value) => {
375
- selectedView.value = value
376
- console.log(`View changed to: ${value}`)
377
- }
378
-
379
- const handleSelectionChange = (selection) => {
380
- console.log('Selection changed:', selection)
381
- }
382
-
383
- const handleValueUpdate = (data) => {
384
- console.log('Value updated:', data)
385
- }
386
-
387
- // Helper for custom tooltip
388
- const getPeakTime = (month) => {
389
- const peakTimes = {
390
- Jan: '6-8 PM',
391
- Feb: '5-7 PM',
392
- Mar: '4-6 PM',
393
- Apr: '3-5 PM',
394
- May: '2-4 PM',
395
- Jun: '1-3 PM',
396
- }
397
- return peakTimes[month] || 'N/A'
398
- }
399
-
400
- const getEfficiency = (value) => {
401
- if (value < 1500) return 'High Efficiency'
402
- if (value < 2500) return 'Medium Efficiency'
403
- return 'Low Efficiency'
404
- }
405
- </script>
406
-
407
- <style scoped>
408
- .demo-container {
409
- padding: 20px;
410
- font-family: 'Figtree', sans-serif;
411
- }
412
-
413
- .demo-container > h2 {
414
- margin: 40px 0 20px;
415
- color: #333;
416
- border-bottom: 1px solid #eee;
417
- padding-bottom: 10px;
418
- }
419
-
420
- h1 {
421
- color: #2c3e50;
422
- margin-bottom: 30px;
423
- }
424
- </style>