@policystudio/policy-studio-ui-vue 1.1.90-beta.2 → 1.1.90-beta.21

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 (146) hide show
  1. package/.eslintrc.js +13 -8
  2. package/.github/workflows/deploy-storybook.yml +4 -4
  3. package/.nvmrc +1 -0
  4. package/dist/css/psui_styles_output.css +6986 -0
  5. package/dist/index.d.ts +50 -0
  6. package/dist/index.js +104 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/util/GeneralFunctions.d.ts +3 -0
  9. package/dist/util/GeneralFunctions.js +29 -0
  10. package/dist/util/GeneralFunctions.js.map +1 -0
  11. package/dist/util/directives.d.ts +1 -0
  12. package/dist/util/directives.js +22 -0
  13. package/dist/util/directives.js.map +1 -0
  14. package/dist/util/imageLoader.d.ts +6 -0
  15. package/dist/util/imageLoader.js +52 -0
  16. package/dist/util/imageLoader.js.map +1 -0
  17. package/package.json +24 -37
  18. package/src/App.vue +30 -0
  19. package/src/assets/scss/components/PsDataTable.scss +1 -1
  20. package/src/components/accordion/PsAccordionItem.vue +75 -75
  21. package/src/components/badges-and-tags/PsBadgeWithIcon.vue +31 -33
  22. package/src/components/badges-and-tags/PsCardInfos.vue +39 -41
  23. package/src/components/badges-and-tags/PsChartLegend.vue +46 -51
  24. package/src/components/badges-and-tags/PsClimateZoneBadge.vue +13 -19
  25. package/src/components/badges-and-tags/PsCostEffectBar.vue +24 -56
  26. package/src/components/badges-and-tags/PsDateCardInfo.vue +17 -18
  27. package/src/components/badges-and-tags/PsHighlightRippleDot.vue +3 -2
  28. package/src/components/badges-and-tags/PsMiniTag.vue +39 -41
  29. package/src/components/badges-and-tags/PsProgressBar.vue +72 -68
  30. package/src/components/badges-and-tags/PsTagScope.vue +17 -22
  31. package/src/components/badges-and-tags/PsTestimonialCard.vue +19 -26
  32. package/src/components/buttons/PsButton.vue +88 -111
  33. package/src/components/chips/PsChips.vue +98 -101
  34. package/src/components/controls/PsCheckbox.vue +84 -84
  35. package/src/components/controls/PsCheckboxSimple.vue +95 -95
  36. package/src/components/controls/PsDraggable.vue +53 -55
  37. package/src/components/controls/PsInlineSelector.vue +98 -99
  38. package/src/components/controls/PsRadioButton.vue +59 -58
  39. package/src/components/controls/PsRadioButtonSimple.vue +79 -75
  40. package/src/components/controls/PsSlider.vue +185 -176
  41. package/src/components/controls/PsSwitch.vue +51 -52
  42. package/src/components/controls/PsToggle.vue +52 -50
  43. package/src/components/data-graphics/PsBarChart.vue +18 -21
  44. package/src/components/datatable/PsDataTable.vue +56 -60
  45. package/src/components/datatable/PsDataTableItem.vue +13 -28
  46. package/src/components/forms/PsDropdown.vue +164 -162
  47. package/src/components/forms/PsDropdownList.vue +133 -130
  48. package/src/components/forms/PsInput.vue +154 -153
  49. package/src/components/forms/PsInputSelect.vue +91 -92
  50. package/src/components/forms/PsInputTextArea.vue +71 -71
  51. package/src/components/navigations/PsBreadcrumb.vue +25 -34
  52. package/src/components/notifications/PsDialog.vue +57 -56
  53. package/src/components/notifications/PsSimpleAlert.vue +27 -29
  54. package/src/components/notifications/PsToast.vue +40 -39
  55. package/src/components/table-results/PsTableResults.vue +449 -458
  56. package/src/components/table-results/PsTableResultsBody.vue +66 -67
  57. package/src/components/table-results/PsTableResultsHead.vue +62 -56
  58. package/src/components/table-results/PsTableResultsHeadComparison.vue +62 -56
  59. package/src/components/table-results/PsTableResultsHeadFlexible.vue +63 -56
  60. package/src/components/table-results/PsTableResultsRow.vue +55 -56
  61. package/src/components/tabs/PsTabHeader.vue +106 -100
  62. package/src/components/tooltip/PsDialogTooltip.vue +96 -101
  63. package/src/components/tooltip/PsRichTooltip.vue +41 -45
  64. package/src/components/tooltip/PsTooltip.vue +111 -116
  65. package/src/components/ui/PsDotLoader.vue +1 -5
  66. package/src/components/ui/PsIcon.vue +126 -129
  67. package/src/index.ts +156 -0
  68. package/src/tsconfig.json +12 -0
  69. package/src/types/index.d.ts +6 -0
  70. package/src/util/GeneralFunctions.js +4 -6
  71. package/src/util/directives.ts +24 -0
  72. package/src/util/imageLoader.js +14 -7
  73. package/tailwind.config.js +1 -1
  74. package/tsconfig.json +47 -0
  75. package/.storybook/PolicyStudio.js +0 -10
  76. package/.storybook/eventBus.js +0 -26
  77. package/.storybook/main.js +0 -21
  78. package/.storybook/manager.js +0 -6
  79. package/.storybook/preview.js +0 -17
  80. package/babel.config.js +0 -17
  81. package/dist/css/psui_styles.css +0 -4647
  82. package/postcss.config.js +0 -8
  83. package/src/assets/images/multifamily-units.svg +0 -10
  84. package/src/assets/images/policy-studio.svg +0 -15
  85. package/src/components/playground/PsScrollBar.vue +0 -320
  86. package/src/contents/ComparisonData.js +0 -378
  87. package/src/contents/FlexibleData.js +0 -502
  88. package/src/contents/ResultsData.js +0 -531
  89. package/src/index.js +0 -166
  90. package/src/stories/Accordion.stories.js +0 -59
  91. package/src/stories/BadgeWithIcon.stories.js +0 -31
  92. package/src/stories/BarChart.stories.js +0 -17
  93. package/src/stories/Breadcrumb.stories.js +0 -25
  94. package/src/stories/Button.stories.js +0 -48
  95. package/src/stories/Button.vue +0 -59
  96. package/src/stories/CardInfos.stories.js +0 -16
  97. package/src/stories/ChartLegend.stories.js +0 -16
  98. package/src/stories/Checkbox.stories.js +0 -45
  99. package/src/stories/CheckboxSimple.stories.js +0 -49
  100. package/src/stories/Chips.stories.js +0 -31
  101. package/src/stories/ClimateZoneBadge.stories.js +0 -17
  102. package/src/stories/Colors.mdx +0 -70
  103. package/src/stories/CostEffectBar.stories.js +0 -23
  104. package/src/stories/Datatable.stories.js +0 -50
  105. package/src/stories/DateCardInfo.stories.js +0 -24
  106. package/src/stories/Dialog.stories.js +0 -131
  107. package/src/stories/Draggable.stories.js +0 -22
  108. package/src/stories/Dropdown.stories.js +0 -99
  109. package/src/stories/DropdownList.stories.js +0 -211
  110. package/src/stories/ElevationSystem.mdx +0 -41
  111. package/src/stories/Header.stories.js +0 -41
  112. package/src/stories/Header.vue +0 -77
  113. package/src/stories/HighlightRippleDot.stories.js +0 -15
  114. package/src/stories/Icon.stories.js +0 -21
  115. package/src/stories/InlineSelector.stories.js +0 -18
  116. package/src/stories/Input.stories.js +0 -240
  117. package/src/stories/InputSelect.stories.js +0 -30
  118. package/src/stories/InputTextArea.stories.js +0 -25
  119. package/src/stories/Introduction.mdx +0 -211
  120. package/src/stories/MiniTag.stories.js +0 -52
  121. package/src/stories/Playground.stories.js +0 -16
  122. package/src/stories/ProgressBar.stories.js +0 -23
  123. package/src/stories/RadioButton.stories.js +0 -40
  124. package/src/stories/RadioButtonSimple.stories.js +0 -43
  125. package/src/stories/SimpleAlert.stories.js +0 -21
  126. package/src/stories/Slider.stories.js +0 -75
  127. package/src/stories/Switch.stories.js +0 -39
  128. package/src/stories/TabHeader.stories.js +0 -52
  129. package/src/stories/TableResults.stories.js +0 -724
  130. package/src/stories/TagScope.stories.js +0 -17
  131. package/src/stories/TestimonialCard.stories.js +0 -27
  132. package/src/stories/Toast.stories.js +0 -52
  133. package/src/stories/Toggle.stories.js +0 -45
  134. package/src/stories/Tooltip.stories.js +0 -114
  135. package/src/stories/Typography.mdx +0 -212
  136. package/src/stories/assets/code-brackets.svg +0 -1
  137. package/src/stories/assets/colors.svg +0 -1
  138. package/src/stories/assets/comments.svg +0 -1
  139. package/src/stories/assets/direction.svg +0 -1
  140. package/src/stories/assets/flow.svg +0 -1
  141. package/src/stories/assets/plugin.svg +0 -1
  142. package/src/stories/assets/repo.svg +0 -1
  143. package/src/stories/assets/stackalt.svg +0 -1
  144. package/src/stories/button.css +0 -30
  145. package/src/stories/header.css +0 -32
  146. package/webpack.config.js +0 -22
@@ -1,97 +1,101 @@
1
1
  <template>
2
- <div
3
- class="psui-el-radio"
4
- :class="[getComponentClass, {'disabled':disabled}]"
2
+ <div
3
+ class="psui-el-radio"
4
+ :class="[getComponentClass, { disabled: disabled }]"
5
5
  v-bind="getComponentAttrs"
6
6
  >
7
- <input
8
- type="radio"
9
- :checked="checked"
7
+ <input
8
+ type="radio"
9
+ :checked="checked"
10
10
  :disabled="disabled"
11
11
  :label="label"
12
12
  :name="name"
13
13
  :id="getInputId"
14
14
  v-bind="inputAttrs"
15
- @change="$emit('change')"
15
+ @change="emit('change')"
16
16
  >
17
- <label
17
+ <label
18
18
  :for="getInputId"
19
19
  class="psui-el-checkmark"
20
20
  >
21
21
  <slot name="content">
22
22
  <span>{{ label }}</span>
23
23
  </slot>
24
- </label>
24
+ </label>
25
25
  </div>
26
26
  </template>
27
27
 
28
- <script>
29
- import { randomString } from '../../util/GeneralFunctions'
28
+ <script setup>
29
+ import { randomString } from '../../util/GeneralFunctions.js'
30
+ import { computed, useAttrs } from 'vue'
30
31
 
31
- export default {
32
- name: 'PsRadioButtonSimple',
33
- props: {
34
- /**
35
- * It sets the label of the checkbox input.
36
- */
37
- label: {
38
- type: String,
39
- },
40
- name:{
41
- type: String,
42
- },
43
- /**
44
- * It disables the checkbox input.
45
- */
46
- disabled: {
47
- type: Boolean,
48
- default: false,
49
- },
50
- /**
51
- * Sets the input as checked
52
- */
53
- checked: {
54
- type: Boolean,
55
- default: false
56
- },
57
- /**
58
- * Add html attributes to the element input
59
- */
60
- inputAttrs: {
61
- type: Object,
62
- default: () => ({})
63
- },
64
- /**
65
- * It set the of the checkbox input. eg: big and small.
66
- */
67
- size: {
68
- type: String,
69
- default: 'big',
70
- validator: (value)=> ['big', 'small'].includes(value)
71
- },
72
- /**
73
- * It set the layout of the checkbox input. eg: default and mixed.
74
- */
32
+ const emit = defineEmits(['change'])
33
+
34
+ const props = defineProps({
35
+ /**
36
+ * It sets the label of the checkbox input.
37
+ */
38
+ label: {
39
+ type: String,
40
+ default: '',
41
+ },
42
+ name: {
43
+ type: String,
44
+ default: '',
45
+ },
46
+ /**
47
+ * It disables the checkbox input.
48
+ */
49
+ disabled: {
50
+ type: Boolean,
51
+ default: false,
52
+ },
53
+ /**
54
+ * Sets the input as checked
55
+ */
56
+ checked: {
57
+ type: Boolean,
58
+ default: false,
59
+ },
60
+ /**
61
+ * Add html attributes to the element input
62
+ */
63
+ inputAttrs: {
64
+ type: Object,
65
+ default: () => ({}),
75
66
  },
76
- inheritAttrs: false,
77
- computed:{
78
- getComponentClass(){
79
- return `size-${this.size}`
80
- },
81
- getInputId() {
82
- if (this?.inputAttrs?.id) {
83
- return this.inputAttrs.id
84
- } else if (this?.$attrs?.id) {
85
- return this.$attrs.id
86
- } else {
87
- return randomString(16)
88
- }
89
- },
90
- getComponentAttrs() {
91
- let componentAttrs = { ... this.$attrs }
92
- delete componentAttrs.id
93
- return componentAttrs
94
- }
67
+ /**
68
+ * It set the of the checkbox input. eg: big and small.
69
+ */
70
+ size: {
71
+ type: String,
72
+ default: 'big',
73
+ validator: (value) => ['big', 'small'].includes(value),
95
74
  },
96
- }
75
+ /**
76
+ * It set the layout of the checkbox input. eg: default and mixed.
77
+ */
78
+ })
79
+
80
+ const attrs = useAttrs()
81
+
82
+ const getComponentClass = computed(() => {
83
+ return `size-${props.size}`
84
+ })
85
+
86
+ const getInputId = computed(() => {
87
+ if (props?.inputAttrs?.id) {
88
+ return props.inputAttrs.id
89
+ } else if (attrs?.id) {
90
+ return attrs.id
91
+ } else {
92
+ return randomString(16)
93
+ }
94
+ })
95
+
96
+ const getComponentAttrs = computed(() => {
97
+ let componentAttrs = { ...attrs }
98
+ delete componentAttrs.id
99
+ return componentAttrs
100
+ })
97
101
  </script>
@@ -1,18 +1,18 @@
1
1
  <template>
2
- <div
2
+ <div
3
3
  class="psui-el-slider"
4
4
  :class="`layout-${layout}`"
5
5
  >
6
- <div
7
- v-if="label"
6
+ <div
7
+ v-if="label"
8
8
  class="psui-el-slider-label"
9
9
  >
10
- <span>{{ label }}</span>
10
+ <span>{{ label }}</span>
11
11
  </div>
12
12
 
13
- <div
13
+ <div
14
14
  class="psui-el-slider-wrapper"
15
- :class="{ 'psui-flex psui-items-center' : !label && !bubble }"
15
+ :class="{ 'psui-flex psui-items-center': !label && !bubble }"
16
16
  >
17
17
  <div class="psui-el-slider-wrapper-input">
18
18
  <div
@@ -23,25 +23,25 @@
23
23
  {{ sliderValue }}
24
24
  </div>
25
25
 
26
- <div
27
- class="slider-bar"
26
+ <div
27
+ class="slider-bar"
28
28
  :style="{ width: progressWidth }"
29
29
  />
30
30
 
31
- <div
31
+ <div
32
32
  v-for="(barStyle, index) in bgBarStyles"
33
33
  :key="index"
34
34
  class="slider-bar-bg"
35
35
  :style="bgBarStyles[index]"
36
36
  />
37
37
 
38
- <div
38
+ <div
39
39
  v-for="(bar, index) in barStyles"
40
40
  :key="index"
41
41
  class="slider-bar-dynamic"
42
42
  :style="barStyles[index]"
43
43
  />
44
-
44
+
45
45
  <input
46
46
  ref="slider"
47
47
  type="range"
@@ -54,11 +54,11 @@
54
54
  >
55
55
  </div>
56
56
 
57
- <div
57
+ <div
58
58
  v-if="dividers"
59
59
  class="psui-el-slider-grid"
60
60
  >
61
- <div
61
+ <div
62
62
  v-for="(grid, index) in gridData"
63
63
  :key="index"
64
64
  class="line"
@@ -69,8 +69,8 @@
69
69
  <span class="info info-max">{{ max }}</span>
70
70
  </div>
71
71
 
72
- <span
73
- v-if="!label && !bubble"
72
+ <span
73
+ v-if="!label && !bubble"
74
74
  class="psui-el-slider-bubble"
75
75
  >
76
76
  {{ sliderValue }}
@@ -79,177 +79,186 @@
79
79
  </div>
80
80
  </template>
81
81
 
82
- <script>
83
- export const sliderLayout = ['default', 'rich']
84
-
85
- export default {
86
- name: 'PsSlider',
87
- props: {
88
- layout: {
89
- type: String,
90
- default: 'default',
91
- validator: (value) => {
92
- return sliderLayout.indexOf(value) !== -1
93
- }
94
- },
95
- min: {
96
- type: Number,
97
- default: 0,
98
- },
99
- max: {
100
- type: Number,
101
- default: 100,
102
- required: true,
103
- },
104
- maxValue: {
105
- type: Number,
106
- default: 100,
107
- required: true,
108
- },
109
- label: {
110
- type: String,
111
- },
112
- value: {
113
- type: [Number, String],
114
- default: 0,
115
- },
116
- baseValue: {
117
- type: [Number, Boolean]
118
- },
119
- labelPosition: {
120
- type: String
121
- },
122
- step: {
123
- type: Number,
124
- default: 1
125
- },
126
- bubble: {
127
- type: Boolean
128
- },
129
- dividers: {
130
- type: Boolean,
131
- default: false
132
- },
133
- modelValue: {
134
- type: Number,
135
- default: 50,
136
- },
137
- gridData: {
138
- type: Array,
139
- default() {
140
- return [0, 30, 55, 80, 100]
141
- }
142
- },
143
- sliderColors: {
144
- type: Array,
145
- default() {
146
- return [
147
- { start: 140, end: 170, bgColor: '#FF906D' },
148
- { start: 170, end: 200, bgColor: '#D65C5A' },
149
- ]
150
- }
82
+ <script setup>
83
+ import { computed, ref, watch, onUnmounted, onMounted } from 'vue'
84
+
85
+ const props = defineProps({
86
+ layout: {
87
+ type: String,
88
+ default: 'default',
89
+ validator: (value) => {
90
+ return ['default', 'rich'].indexOf(value) !== -1
151
91
  },
152
- bgColors: {
153
- type: Array,
154
- default() {
155
- return [
156
- { start: 0, end: 170, bgColor: '#D6DDE5' },
157
- { start: 170, end: 200, bgColor: '#A2ACB7' },
158
- ]
159
- }
160
- }
161
92
  },
162
- data: () => ({
163
- isMounted: false,
164
- sliderWidth: 0,
165
- sliderValue: 0,
166
- progress: 0,
167
- barStyles: [],
168
- bgBarStyles: []
169
- }),
170
- computed: {
171
- positionBubble() {
172
- const val = this.sliderValue
173
- const width = this.sliderWidth - 24
174
- const percent = (val - this.min) / (this.max - this.min)
175
- const offset = -2
176
- const position = width * percent + offset
177
-
178
- return `${position}px`
179
- },
180
- progressWidth() {
181
- if (this.sliderValue > this.maxValue) {
182
- return '100%'
183
- }
184
- return ((this.sliderValue - this.min) / (this.max - this.min)) * 100 + '%'
185
- },
93
+ min: {
94
+ type: Number,
95
+ default: 0,
186
96
  },
187
- watch: {
188
- sliderValue(newValue) {
189
- this.updateProgress()
190
- this.$emit('input', newValue)
191
- this.updateBarStyles()
192
- },
193
- value(newValue) {
194
- this.sliderValue = newValue
195
- },
196
- sliderColors: {
197
- immediate: true,
198
- handler() {
199
- this.updateBarStyles()
200
- },
201
- },
97
+ max: {
98
+ type: Number,
99
+ default: 100,
100
+ required: true,
202
101
  },
203
- created() {
204
- window.addEventListener('resize', this.resizeHandler)
102
+ maxValue: {
103
+ type: Number,
104
+ default: 100,
105
+ required: true,
205
106
  },
206
- unmounted() {
207
- window.removeEventListener('resize', this.resizeHandler)
107
+ label: {
108
+ type: String,
109
+ default: '',
208
110
  },
209
- mounted() {
210
- this.isMounted = true
211
- this.updateProgress()
212
- this.updateBarStyles()
111
+ value: {
112
+ type: [Number, String],
113
+ default: 0,
213
114
  },
214
- methods: {
215
- updateProgress() {
216
- this.progress = Math.round(
217
- ((this.sliderValue - this.min) / (this.max - this.min)) * 100
218
- )
219
- },
220
- updateSlider(event) {
221
- this.sliderValue = Math.min(event.target.value, this.maxValue)
115
+ baseValue: {
116
+ type: [Number, Boolean],
117
+ default: false,
118
+ },
119
+ labelPosition: {
120
+ type: String,
121
+ default: '',
122
+ },
123
+ step: {
124
+ type: Number,
125
+ default: 1,
126
+ },
127
+ bubble: {
128
+ type: Boolean,
129
+ },
130
+ dividers: {
131
+ type: Boolean,
132
+ default: false,
133
+ },
134
+ modelValue: {
135
+ type: Number,
136
+ default: 50,
137
+ },
138
+ gridData: {
139
+ type: Array,
140
+ default() {
141
+ return [0, 30, 55, 80, 100]
222
142
  },
223
- updateBarStyles() {
224
- this.barStyles = this.sliderColors.map((bar) => this.getBarStyle(bar))
225
- this.bgBarStyles = this.bgColors.map((bar) => this.getBarStyle(bar, false))
143
+ },
144
+ sliderColors: {
145
+ type: Array,
146
+ default() {
147
+ return [
148
+ { start: 140, end: 170, bgColor: '#FF906D' },
149
+ { start: 170, end: 200, bgColor: '#D65C5A' },
150
+ ]
226
151
  },
227
- resizeHandler() {
228
- this.sliderWidth = this.$refs.slider.clientWidth
152
+ },
153
+ bgColors: {
154
+ type: Array,
155
+ default() {
156
+ return [
157
+ { start: 0, end: 170, bgColor: '#D6DDE5' },
158
+ { start: 170, end: 200, bgColor: '#A2ACB7' },
159
+ ]
229
160
  },
230
- getBarStyle(bar, normalizeByProgress = true) {
231
- const start = (bar.start / this.max) * 100
232
- const end = (bar.end / this.max) * 100
233
- const progress = parseFloat(this.progressWidth)
234
- let barWidth = end - start
235
- let barLeft = start
236
-
237
- if (normalizeByProgress) {
238
- if (progress < start) {
239
- barWidth = 0
240
- } else if (progress < end) {
241
- barWidth = progress - start
242
- }
243
- }
244
-
245
- return {
246
- left: `${barLeft}%`,
247
- backgroundColor: bar.bgColor,
248
- width: `${barWidth}%`
249
- }
250
- }
251
161
  },
252
-
162
+ })
163
+
164
+ const isMounted = ref(false)
165
+ const sliderWidth = ref(0)
166
+ const sliderValue = ref(0)
167
+ const progress = ref(0)
168
+ const barStyles = ref([])
169
+ const bgBarStyles = ref([])
170
+ const slider = ref(null)
171
+ const emit = defineEmits(['input'])
172
+
173
+
174
+ const positionBubble = computed(() => {
175
+ const val = sliderValue.value
176
+ const width = sliderWidth.value - 24
177
+ const percent = (val - props.min) / (props.max - props.min)
178
+ const offset = -2
179
+ const position = width * percent + offset
180
+ return `${position}px`
181
+ })
182
+
183
+ const progressWidth = computed(() => {
184
+ if (sliderValue.value > props.maxValue) {
185
+ return '100%'
186
+ }
187
+ return ((sliderValue.value - props.min) / (props.max - props.min)) * 100 + '%'
188
+ })
189
+
190
+ const updateProgress = () => {
191
+ progress.value = Math.round(((sliderValue.value - props.min) / (props.max - props.min)) * 100)
192
+ }
193
+
194
+ const updateSlider = (event) => {
195
+ sliderValue.value = Math.min(event.target.value, props.maxValue)
253
196
  }
197
+
198
+ const updateBarStyles = () => {
199
+ barStyles.value = props.sliderColors.map((bar) => getBarStyle(bar))
200
+ bgBarStyles.value = props.bgColors.map((bar) => getBarStyle(bar, false))
201
+ }
202
+
203
+ const resizeHandler = () => {
204
+ sliderWidth.value = slider.value.clientWidth
205
+ }
206
+
207
+ const getBarStyle = (bar, normalizeByProgress = true) => {
208
+ const start = (bar.start / props.max) * 100
209
+ const end = (bar.end / props.max) * 100
210
+ const progress = parseFloat(progressWidth.value)
211
+ let barWidth = end - start
212
+ let barLeft = start
213
+ if (normalizeByProgress) {
214
+ if (progress < start) {
215
+ barWidth = 0
216
+ } else if (progress < end) {
217
+ barWidth = progress - start
218
+ }
219
+
220
+ return {
221
+ left: `${barLeft}%`,
222
+ backgroundColor: bar.bgColor,
223
+ width: `${barWidth}%`,
224
+ }
225
+ }
226
+ }
227
+
228
+ watch(sliderValue, (newValue) => {
229
+ updateProgress()
230
+ emit('input', newValue)
231
+ updateBarStyles()
232
+ })
233
+
234
+ watch(
235
+ () => props.value,
236
+ (newValue) => {
237
+ sliderValue.value = newValue
238
+ }
239
+ )
240
+
241
+ watch(
242
+ () => props.sliderColors,
243
+ () => {
244
+ updateBarStyles()
245
+ },
246
+ { immediate: true }
247
+ )
248
+
249
+ window.addEventListener('resize', resizeHandler)
250
+
251
+ onUnmounted(() => {
252
+ window.removeEventListener('resize', resizeHandler)
253
+ })
254
+
255
+ onMounted(() => {
256
+ isMounted.value = true
257
+ updateProgress()
258
+ updateBarStyles()
259
+ })
254
260
  </script>
255
- <style> /* Please, use the file src/assets/scss/components/PsSlider.scss */ </style>
261
+
262
+ <style>
263
+ /* Please, use the file src/assets/scss/components/PsSlider.scss */
264
+ </style>