renusify 2.5.2 → 3.0.0

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 (212) hide show
  1. package/components/app/index.vue +74 -22
  2. package/components/app/toast/index.vue +76 -71
  3. package/components/app/toast/toast.vue +62 -44
  4. package/components/avatar/index.vue +208 -84
  5. package/components/button/buttonConfirm.vue +53 -26
  6. package/components/button/buttonGroup.js +0 -2
  7. package/components/button/buttonGroup.vue +310 -62
  8. package/components/button/index.vue +584 -100
  9. package/components/calendar/index.js +0 -2
  10. package/components/calendar/index.vue +326 -262
  11. package/components/calendar/month.vue +64 -55
  12. package/components/calendar/year.vue +30 -25
  13. package/components/card/index.vue +139 -59
  14. package/components/codeEditor/highlightCss.vue +38 -39
  15. package/components/codeEditor/highlightHtml.vue +64 -64
  16. package/components/codeEditor/highlightJs.vue +37 -38
  17. package/components/codeEditor/index.vue +129 -79
  18. package/components/codeEditor/run.vue +225 -39
  19. package/components/codeEditor/useCodeFormatter.js +150 -0
  20. package/components/confirm/index.vue +139 -80
  21. package/components/container/col.vue +5 -4
  22. package/components/container/divider.vue +28 -19
  23. package/components/container/index.vue +34 -15
  24. package/components/container/row.vue +26 -9
  25. package/components/container/spacer.vue +2 -4
  26. package/components/container/style.scss +3 -0
  27. package/components/content/index.vue +49 -32
  28. package/components/cropper/index.vue +401 -244
  29. package/components/float/index.vue +542 -415
  30. package/components/form/addressInput/index.vue +184 -109
  31. package/components/form/camInput/index.vue +370 -244
  32. package/components/form/checkInput/index.vue +138 -71
  33. package/components/form/checkboxInput/index.vue +87 -47
  34. package/components/form/colorInput/Alpha.vue +81 -83
  35. package/components/form/colorInput/Hue.vue +91 -68
  36. package/components/form/colorInput/Preview.vue +43 -47
  37. package/components/form/colorInput/Saturation.vue +101 -86
  38. package/components/form/colorInput/index.vue +71 -39
  39. package/components/form/colorInput/picker.vue +111 -106
  40. package/components/form/colorInput/useColor.js +153 -0
  41. package/components/form/dateInput/index.vue +691 -356
  42. package/components/form/dateInput/month.vue +63 -54
  43. package/components/form/dateInput/year.vue +35 -25
  44. package/components/form/fileInput/index.js +0 -1
  45. package/components/form/fileInput/index.vue +263 -106
  46. package/components/form/fileInput/single.vue +323 -164
  47. package/components/form/groupInput/index.vue +199 -101
  48. package/components/form/index.vue +189 -83
  49. package/components/form/input/index.vue +416 -377
  50. package/components/form/jsonInput/JsonView.vue +54 -56
  51. package/components/form/jsonInput/index.vue +247 -165
  52. package/components/form/maskInput/index.vue +252 -132
  53. package/components/form/numberInput/index.js +0 -1
  54. package/components/form/numberInput/index.vue +226 -117
  55. package/components/form/passwordInput/index.js +2 -1
  56. package/components/form/passwordInput/index.vue +269 -102
  57. package/components/form/radioInput/index.vue +143 -72
  58. package/components/form/rangeInput/index.vue +280 -167
  59. package/components/form/ratingInput/index.vue +57 -57
  60. package/components/form/selectInput/index.js +1 -3
  61. package/components/form/selectInput/index.vue +584 -296
  62. package/components/form/switchInput/index.vue +73 -59
  63. package/components/form/telInput/index.js +0 -1
  64. package/components/form/telInput/index.vue +238 -135
  65. package/components/form/textArea/index.vue +72 -35
  66. package/components/form/textEditor/index.vue +739 -0
  67. package/components/form/{text-editor → textEditor}/style.scss +8 -16
  68. package/components/form/textInput/index.vue +54 -32
  69. package/components/form/timeInput/index.vue +82 -55
  70. package/components/form/timeInput/range.vue +115 -94
  71. package/components/form/timeInput/timepicker.vue +382 -449
  72. package/components/form/uniqueInput/index.vue +105 -48
  73. package/components/form/unitInput/index.vue +139 -84
  74. package/components/formCreator/index.js +0 -1
  75. package/components/formCreator/index.vue +314 -148
  76. package/components/highlight/index.vue +41 -25
  77. package/components/highlight/style.scss +2 -2
  78. package/components/highlight/{mixin.js → useHighlight.js} +181 -160
  79. package/components/icon/index.vue +79 -33
  80. package/components/img/index.vue +249 -147
  81. package/components/img/preview.vue +180 -198
  82. package/components/img/svgImg.vue +42 -39
  83. package/components/index.js +5 -20
  84. package/components/infinite/index.js +1 -2
  85. package/components/infinite/index.vue +248 -66
  86. package/components/map/index.vue +428 -261
  87. package/components/map/route.vue +794 -487
  88. package/components/map/select.vue +118 -58
  89. package/components/menu/index.vue +201 -91
  90. package/components/meta/meta.js +26 -3
  91. package/components/modal/index.vue +382 -156
  92. package/components/notify/index.vue +204 -86
  93. package/components/notify/notification.vue +38 -55
  94. package/components/progress/circle.vue +189 -70
  95. package/components/progress/line.vue +266 -46
  96. package/components/searchBox/index.js +1 -3
  97. package/components/searchBox/index.vue +194 -101
  98. package/components/skeleton/index.vue +45 -20
  99. package/components/slider/index.vue +318 -156
  100. package/components/swiper/index.vue +254 -106
  101. package/components/table/crud/footer.vue +77 -53
  102. package/components/table/crud/header.vue +71 -72
  103. package/components/table/crud/index.vue +629 -399
  104. package/components/table/index.vue +721 -278
  105. package/components/timeAgo/index.vue +145 -96
  106. package/components/tour/index.vue +338 -235
  107. package/components/tree/index.vue +235 -89
  108. package/components/tree/tree-element.vue +106 -106
  109. package/directive/animate/index.js +77 -0
  110. package/directive/clickOutSide/index.js +98 -0
  111. package/directive/drag/index.js +153 -0
  112. package/directive/index.js +11 -13
  113. package/directive/intersect/index.js +263 -0
  114. package/directive/mask/index.js +67 -0
  115. package/directive/parallax/index.js +78 -0
  116. package/directive/ripple/index.js +14 -0
  117. package/directive/scroll/index.js +244 -0
  118. package/directive/sortable/index.js +274 -0
  119. package/directive/title/index.js +75 -0
  120. package/directive/touch/index.js +268 -0
  121. package/index.js +10 -8
  122. package/package.json +5 -2
  123. package/plugins/validation/Validate.js +88 -79
  124. package/scripts/generate-docs.mjs +226 -0
  125. package/scripts/menu.mjs +240 -0
  126. package/scripts/parser.mjs +1086 -0
  127. package/style/_index.scss +7 -0
  128. package/style/app.scss +13 -65
  129. package/style/colors.scss +5 -22
  130. package/style/functions/index.scss +8 -0
  131. package/style/mixins/index.scss +17 -5
  132. package/style/variables/base.scss +154 -175
  133. package/style/variables/color.scss +0 -12
  134. package/style/variables/utilities.scss +0 -180
  135. package/tools/helper.js +0 -8
  136. package/tools/icons.js +6 -1
  137. package/tools/root.js +71 -0
  138. package/components/app/style.scss +0 -41
  139. package/components/app/toast/style.scss +0 -20
  140. package/components/avatar/style.scss +0 -32
  141. package/components/bar/bottomNav.js +0 -1
  142. package/components/bar/bottomNav.vue +0 -28
  143. package/components/bar/bottomNavigationCircle.js +0 -2
  144. package/components/bar/bottomNavigationCircle.vue +0 -99
  145. package/components/bar/scss/bottomNav.scss +0 -67
  146. package/components/bar/scss/toolbar.scss +0 -174
  147. package/components/bar/toolbar/index.js +0 -8
  148. package/components/bar/toolbar/index.vue +0 -35
  149. package/components/bar/toolbar/laptop.vue +0 -33
  150. package/components/bar/toolbar/menuChilds.vue +0 -41
  151. package/components/bar/toolbar/menuLaptop.vue +0 -41
  152. package/components/bar/toolbar/menuMob.vue +0 -39
  153. package/components/bar/toolbar/mixin.js +0 -43
  154. package/components/bar/toolbar/mobile.vue +0 -34
  155. package/components/breadcrumb/bredcrumbItem.vue +0 -39
  156. package/components/breadcrumb/index.js +0 -3
  157. package/components/breadcrumb/index.vue +0 -71
  158. package/components/breadcrumb/style.scss +0 -51
  159. package/components/button/style.scss +0 -411
  160. package/components/card/style.scss +0 -86
  161. package/components/chart/chart.js +0 -1
  162. package/components/chart/chart.vue +0 -69
  163. package/components/chart/worldMap.js +0 -2
  164. package/components/chart/worldMap.vue +0 -1112
  165. package/components/chat/MessageList.vue +0 -163
  166. package/components/chat/chatInput.vue +0 -150
  167. package/components/chat/chatMsg.vue +0 -276
  168. package/components/chat/index.js +0 -11
  169. package/components/chat/index.vue +0 -113
  170. package/components/chip/index.js +0 -3
  171. package/components/chip/index.vue +0 -77
  172. package/components/chip/style.scss +0 -199
  173. package/components/codeEditor/mixin.js +0 -145
  174. package/components/countdown/index.js +0 -1
  175. package/components/countdown/index.vue +0 -105
  176. package/components/form/colorInput/mixin.js +0 -132
  177. package/components/form/fileInput/file.js +0 -148
  178. package/components/form/telInput/assets/flags.png +0 -0
  179. package/components/form/telInput/assets/flags@2x.png +0 -0
  180. package/components/form/text-editor/index.vue +0 -705
  181. package/components/icon/style.scss +0 -17
  182. package/components/infinite/div.js +0 -6
  183. package/components/infinite/div.vue +0 -193
  184. package/components/infinite/page.js +0 -3
  185. package/components/infinite/page.vue +0 -105
  186. package/components/list/index.js +0 -3
  187. package/components/list/index.vue +0 -122
  188. package/components/list/style.scss +0 -66
  189. package/components/message/index.js +0 -4
  190. package/components/message/index.vue +0 -40
  191. package/components/modal/style.scss +0 -146
  192. package/components/nestable/NestableItem.vue +0 -307
  193. package/components/nestable/editable.js +0 -44
  194. package/components/nestable/index.js +0 -1
  195. package/components/nestable/index.vue +0 -226
  196. package/components/nestable/methods.js +0 -416
  197. package/components/progress/style.scss +0 -229
  198. package/components/table/style.scss +0 -338
  199. package/components/tabs/index.js +0 -3
  200. package/components/tabs/index.vue +0 -151
  201. package/components/timeline/index.js +0 -6
  202. package/components/timeline/index.vue +0 -76
  203. package/directive/resize/index.js +0 -30
  204. package/directive/skeleton/index.js +0 -27
  205. package/directive/skeleton/style.scss +0 -37
  206. package/plugins/request/Request.js +0 -68
  207. package/style/animation.scss +0 -94
  208. package/style/style.scss +0 -8
  209. package/tools/rootable.js +0 -75
  210. /package/components/form/{text-editor → textEditor}/index.js +0 -0
  211. /package/components/form/{text-editor → textEditor}/preview.js +0 -0
  212. /package/components/form/{text-editor → textEditor}/preview.vue +0 -0
@@ -1,14 +1,12 @@
1
1
  <template>
2
2
  <r-input :class="`${$r.prefix}range`"
3
3
  :modelValue="modelValue"
4
- active
5
- hide
6
- tile
4
+ active-label
7
5
  >
8
6
 
9
- <div class="range-container" ref="range">
7
+ <div ref="rangeRef" class="range-container">
10
8
  <div
11
- ref='dot'
9
+ ref='dotRef'
12
10
  v-touch="{'end':end,
13
11
  'move':move}"
14
12
  :style="{'transform':'translate3d('+x+'px,0,0)'}"
@@ -23,7 +21,7 @@
23
21
  </div>
24
22
  <div
25
23
  v-if="isRange"
26
- ref='dot2'
24
+ ref='dot2Ref'
27
25
  v-touch="{'end':end2,
28
26
  'move':move2}"
29
27
  :style="{'transform':'translate3d('+x2+'px,0,0)'}"
@@ -47,172 +45,287 @@
47
45
  </div>
48
46
  </r-input>
49
47
  </template>
50
- <script>
51
-
52
- export default {
53
- name: 'r-range',
54
- props: {
55
- modelValue: {
56
- type: [Number, Array]
57
- },
58
- min: {
59
- type: Number,
60
- default: 0
61
- },
62
- max: {
63
- type: Number,
64
- default: 100
65
- },
66
- color: {
67
- type: String,
68
- default: 'color-one'
69
- },
70
- step: {
71
- type: Number,
72
- default: 1
73
- },
74
- tooltipAlways: Boolean,
75
-
76
- disabled: Boolean,
77
- isRange: Boolean
78
48
 
49
+ <script setup>
50
+ import {ref, computed, onMounted, inject, nextTick, watch} from 'vue'
51
+
52
+ const props = defineProps({
53
+ /**
54
+ * The slider's model value
55
+ * @type {Number|Array}
56
+ *
57
+ * For single slider: Number
58
+ * For range slider: Array of two numbers [minValue, maxValue]
59
+ */
60
+ modelValue: {
61
+ type: [Number, Array]
79
62
  },
80
- emits:['update:modelValue'],
81
- data() {
82
- return {
83
- width: 0,
84
- inMove: false,
85
- inMove2: false,
86
- x: 0,
87
- x2: 0,
88
- prePosition: 0,
89
- prePosition2: 0,
90
- preValue: 0,
91
- preValue2: 0,
92
- }
63
+ /**
64
+ * Minimum allowed value
65
+ * @type {Number}
66
+ * @default 0
67
+ */
68
+ min: {
69
+ type: Number,
70
+ default: 0
93
71
  },
94
- mounted() {
95
- this.width = this.$refs.range.getBoundingClientRect().width - 10
96
- this.preValue = this.min
97
- if (this.isRange && !this.modelValue) {
98
- this.$emit('update:modelValue', [])
99
- const r = this.$r.rtl ? -1 : 1
100
- this.x2 = this.width * r
101
- this.prePosition2 = this.width * r
102
- this.preValue2 = this.max
103
- }
104
- if (this.modelValue !== undefined) {
105
- this.preValue = this.isRange ? this.modelValue[0] : this.modelValue
106
- this.preValue2 = this.modelValue[1]
107
- }
108
-
109
- this.set(this.preValue, this.preValue2)
110
-
72
+ /**
73
+ * Maximum allowed value
74
+ * @type {Number}
75
+ * @default 100
76
+ */
77
+ max: {
78
+ type: Number,
79
+ default: 100
111
80
  },
112
- computed: {
113
- padR() {
114
- const r = this.$r.rtl ? -1 : 1
115
- return this.x * r
116
- },
117
- padL() {
118
- const r = this.$r.rtl ? -1 : 1
119
- return this.width - this.x2 * r
120
- }
81
+ /**
82
+ * Color class for the slider track
83
+ * @type {String}
84
+ * @default 'color-one'
85
+ */
86
+ color: {
87
+ type: String,
88
+ default: 'color-one'
121
89
  },
122
- methods: {
123
- emit(value) {
124
- if (this.disabled) {
125
- return
126
- }
127
- const v = Math.round(value / this.step) * this.step
128
- if (v !== this.preValue) {
129
- this.$emit('update:modelValue', this.isRange ? [v, this.preValue2] : v)
130
- this.preValue = v
131
- }
132
- },
133
- set(v, v2) {
134
- const r = this.$r.rtl ? -1 : 1
135
- const x = (v - this.min) / (r * (this.max - this.min) / this.width)
136
- const x2 = (v2 - this.min) / (r * (this.max - this.min) / this.width)
137
- this.x = x
138
- this.x2 = x2
139
- this.end()
140
- this.end2()
141
- },
142
- move(e) {
143
- if (this.disabled) {
144
- return
145
- }
146
- this.inMove = true
147
- const x = this.prePosition + e.goX
148
- const r = this.$r.rtl ? -1 : 1
149
- const value = (r * (this.max - this.min) * x / this.width) + this.min
150
- if (value > this.max || (this.isRange && value > this.preValue2)) {
151
- if (this.isRange) {
152
- this.x = this.x2
153
- } else {
154
- this.x = this.width * r
155
- }
156
- this.$emit('update:modelValue', this.isRange ? [this.preValue2, this.preValue2] : this.max)
157
- return
158
- }
159
- if (value < this.min) {
160
- this.x = 0
161
- this.$emit('update:modelValue', this.isRange ? [this.min, this.preValue2] : this.min)
162
- return
163
- }
164
- this.x = x
165
- this.emit(value)
166
- },
167
- end() {
168
- this.inMove = false
169
- this.prePosition = this.x
170
- },
171
- emit2(value) {
172
- if (this.disabled) {
173
- return
174
- }
175
- const v = Math.round(value / this.step) * this.step
176
- if (v !== this.preValue2) {
177
- this.$emit('update:modelValue', [this.preValue, v])
178
- this.preValue2 = v
90
+ /**
91
+ * Step value for slider increments
92
+ * @type {Number}
93
+ * @default 1
94
+ */
95
+ step: {
96
+ type: Number,
97
+ default: 1
98
+ },
99
+ /**
100
+ * Always show tooltip on slider handle
101
+ * @type {Boolean}
102
+ */
103
+ tooltipAlways: Boolean,
104
+ /**
105
+ * Disable slider interaction
106
+ * @type {Boolean}
107
+ */
108
+ disabled: Boolean,
109
+ /**
110
+ * Enable range slider with two handles
111
+ * @type {Boolean}
112
+ */
113
+ isRange: Boolean
114
+ })
179
115
 
180
- }
181
- },
182
- move2(e) {
183
- if (this.disabled) {
184
- return
185
- }
186
- this.inMove2 = true
187
- const x = this.prePosition2 + e.goX
188
- const r = this.$r.rtl ? -1 : 1
189
- const value = (r * (this.max - this.min) * x / this.width) + this.min
190
- if (value > this.max) {
191
- this.x2 = this.width * r
192
- this.$emit('update:modelValue', [this.preValue, this.max])
193
- return
194
- }
195
- if (value < this.min || value < this.preValue) {
196
- this.x2 = this.x1
197
- this.$emit('update:modelValue', [this.preValue, this.preValue])
198
- return
199
- }
116
+ const emit = defineEmits([
117
+ /**
118
+ * Emitted when slider value changes
119
+ * @param {Number|Array} value - Updated slider value
120
+ *
121
+ * For single slider: Number value
122
+ * For range slider: Array [minValue, maxValue]
123
+ */
124
+ 'update:modelValue'
125
+ ])
126
+
127
+ const {$r} = inject('renusify')
128
+
129
+ // Reactive data
130
+ const width = ref(0)
131
+ const inMove = ref(false)
132
+ const inMove2 = ref(false)
133
+ const x = ref(0)
134
+ const x2 = ref(0)
135
+ const prePosition = ref(0)
136
+ const prePosition2 = ref(0)
137
+ const preValue = ref(0)
138
+ const preValue2 = ref(0)
139
+
140
+ // Template refs
141
+ const rangeRef = ref(null)
142
+ const dotRef = ref(null)
143
+ const dot2Ref = ref(null)
144
+
145
+ // Computed properties
146
+ /**
147
+ * Right padding for RTL support (first handle in range mode)
148
+ * @returns {Number} Right padding value
149
+ */
150
+ const padR = computed(() => {
151
+ const r = $r.rtl ? -1 : 1
152
+ return x.value * r
153
+ })
154
+
155
+ /**
156
+ * Left padding for RTL support (second handle in range mode)
157
+ * @returns {Number} Left padding value
158
+ */
159
+ const padL = computed(() => {
160
+ const r = $r.rtl ? -1 : 1
161
+ return width.value - x2.value * r
162
+ })
163
+
164
+ // Methods - First handle (min value)
165
+ /**
166
+ * Emits updated value for first handle
167
+ * @param {Number} value - Raw value to emit
168
+ */
169
+ const emitValue = (value) => {
170
+ if (props.disabled) {
171
+ return
172
+ }
173
+ const v = Math.round(value / props.step) * props.step
174
+ if (v !== preValue.value) {
175
+ emit('update:modelValue', props.isRange ? [v, preValue2.value] : v)
176
+ preValue.value = v
177
+ }
178
+ }
179
+
180
+ /**
181
+ * Sets slider handle positions based on values
182
+ * @param {Number} v - First handle value
183
+ * @param {Number} v2 - Second handle value
184
+ */
185
+ const set = (v, v2) => {
186
+ const r = $r.rtl ? -1 : 1
187
+ const calcX = (v - props.min) / (r * (props.max - props.min) / width.value)
188
+ const calcX2 = (v2 - props.min) / (r * (props.max - props.min) / width.value)
189
+ x.value = calcX
190
+ x2.value = calcX2
191
+ end()
192
+ end2()
193
+ }
194
+
195
+ /**
196
+ * Handles first handle movement
197
+ * @param {Object} e - Movement event with goX property
198
+ */
199
+ const move = (e) => {
200
+ if (props.disabled) {
201
+ return
202
+ }
203
+ inMove.value = true
204
+ const calcX = prePosition.value + e.goX
205
+ const r = $r.rtl ? -1 : 1
206
+ const value = (r * (props.max - props.min) * calcX / width.value) + props.min
200
207
 
201
- this.x2 = x
202
- this.emit2(value)
203
- },
204
- end2() {
205
- this.inMove2 = false
206
- this.prePosition2 = this.x2
208
+ if (value > props.max || (props.isRange && value > preValue2.value)) {
209
+ if (props.isRange) {
210
+ x.value = x2.value
211
+ } else {
212
+ x.value = width.value * r
207
213
  }
214
+ emit('update:modelValue', props.isRange ? [preValue2.value, preValue2.value] : props.max)
215
+ return
216
+ }
217
+
218
+ if (value < props.min) {
219
+ x.value = 0
220
+ emit('update:modelValue', props.isRange ? [props.min, preValue2.value] : props.min)
221
+ return
222
+ }
223
+
224
+ x.value = calcX
225
+ emitValue(value)
226
+ }
227
+
228
+ /**
229
+ * Ends first handle movement
230
+ */
231
+ const end = () => {
232
+ inMove.value = false
233
+ prePosition.value = x.value
234
+ }
235
+
236
+ // Methods - Second handle (max value, range mode only)
237
+ /**
238
+ * Emits updated value for second handle
239
+ * @param {Number} value - Raw value to emit
240
+ */
241
+ const emitValue2 = (value) => {
242
+ if (props.disabled) {
243
+ return
244
+ }
245
+ const v = Math.round(value / props.step) * props.step
246
+ if (v !== preValue2.value) {
247
+ emit('update:modelValue', [preValue.value, v])
248
+ preValue2.value = v
208
249
  }
209
250
  }
251
+
252
+ /**
253
+ * Handles second handle movement
254
+ * @param {Object} e - Movement event with goX property
255
+ */
256
+ const move2 = (e) => {
257
+ if (props.disabled) {
258
+ return
259
+ }
260
+ inMove2.value = true
261
+ const calcX = prePosition2.value + e.goX
262
+ const r = $r.rtl ? -1 : 1
263
+ const value = (r * (props.max - props.min) * calcX / width.value) + props.min
264
+
265
+ if (value > props.max) {
266
+ x2.value = width.value * r
267
+ emit('update:modelValue', [preValue.value, props.max])
268
+ return
269
+ }
270
+
271
+ if (value < props.min || value < preValue.value) {
272
+ x2.value = x.value
273
+ emit('update:modelValue', [preValue.value, preValue.value])
274
+ return
275
+ }
276
+
277
+ x2.value = calcX
278
+ emitValue2(value)
279
+ }
280
+
281
+ /**
282
+ * Ends second handle movement
283
+ */
284
+ const end2 = () => {
285
+ inMove2.value = false
286
+ prePosition2.value = x2.value
287
+ }
288
+
289
+ /**
290
+ * Initializes slider dimensions and positions
291
+ */
292
+ const init = () => {
293
+ nextTick(() => {
294
+ width.value = rangeRef.value.getBoundingClientRect().width - 10
295
+ preValue.value = props.min
296
+
297
+ if (props.isRange && (!props.modelValue || props.modelValue.length === 0)) {
298
+ emit('update:modelValue', [props.min, props.max])
299
+ const r = $r.rtl ? -1 : 1
300
+ x2.value = width.value * r
301
+ prePosition2.value = width.value * r
302
+ preValue2.value = props.max
303
+ }
304
+
305
+ if (props.modelValue && !(props.isRange && props.modelValue.length === 0)) {
306
+ preValue.value = props.isRange ? props.modelValue[0] : props.modelValue
307
+ preValue2.value = props.isRange ? props.modelValue[1] : props.max
308
+ }
309
+
310
+ set(preValue.value, preValue2.value)
311
+ })
312
+ }
313
+
314
+ onMounted(() => {
315
+ init()
316
+ })
317
+
318
+ watch(() => props.modelValue, () => {
319
+ if (!inMove.value && !inMove2.value) {
320
+ init()
321
+ }
322
+ }, {deep: true})
210
323
  </script>
324
+
211
325
  <style lang="scss">
212
- @use "../../../style/variables/base";
213
- @use "../../../style/mixins";
326
+ @use "../../../style" as *;
214
327
 
215
- .#{base.$prefix}range {
328
+ .#{$prefix}range {
216
329
  height: 30px;
217
330
  position: relative;
218
331
 
@@ -247,10 +360,10 @@ export default {
247
360
  &:hover {
248
361
  width: 16px;
249
362
  height: 16px;
250
- @include mixins.rtl() {
363
+ @include rtl() {
251
364
  transform: translate(2px, -2px);
252
365
  }
253
- @include mixins.ltr() {
366
+ @include ltr() {
254
367
  transform: translate(-2px, -2px);
255
368
  }
256
369
  border: 3px solid var(--color-one) !important;
@@ -275,10 +388,10 @@ export default {
275
388
  width: auto;
276
389
  height: 30px;
277
390
  min-width: 30px;
278
- @include mixins.rtl() {
391
+ @include rtl() {
279
392
  transform: translateX(calc(50% - 5px));
280
393
  }
281
- @include mixins.ltr() {
394
+ @include ltr() {
282
395
  transform: translateX(calc(-50% + 5px));
283
396
  }
284
397
  }
@@ -310,10 +423,10 @@ export default {
310
423
  &:hover {
311
424
  width: 16px;
312
425
  height: 16px;
313
- @include mixins.rtl() {
426
+ @include rtl() {
314
427
  transform: translate(2px, -2px);
315
428
  }
316
- @include mixins.ltr() {
429
+ @include ltr() {
317
430
  transform: translate(-2px, -2px);
318
431
  }
319
432
  border: 3px solid var(--color-one) !important;
@@ -338,10 +451,10 @@ export default {
338
451
  width: auto;
339
452
  height: 30px;
340
453
  min-width: 30px;
341
- @include mixins.rtl() {
454
+ @include rtl() {
342
455
  transform: translateX(calc(50% - 5px));
343
456
  }
344
- @include mixins.ltr() {
457
+ @include ltr() {
345
458
  transform: translateX(calc(-50% + 5px));
346
459
  }
347
460
  }
@@ -1,8 +1,10 @@
1
1
  <template>
2
- <div :class="`${$r.prefix}rating size-${size} ms-n1`">
3
- <r-btn :key="i" :class="`${Math.round(modelValue)>=i?'color-rating':''}`"
2
+ <div :class="`${$r.prefix}rating`">
3
+ <r-btn :key="i"
4
+ :class="`${Math.round(modelValue)>=i?'color-rating':''}`"
4
5
  :readonly="readonly"
5
6
  @click.prevent="select(i)"
7
+ :size="size"
6
8
  icon
7
9
  text
8
10
  v-for="i in count">
@@ -11,74 +13,72 @@
11
13
  </div>
12
14
  </template>
13
15
 
14
- <script>
16
+ <script setup>
15
17
 
16
- export default {
17
- name: 'r-rating',
18
- props: {
19
- count: {
20
- type: Number,
21
- default: 5
22
- },
23
- size: {
24
- type: String,
25
- default: 'default',
26
- validator: function (value) {
27
- return ['x-small', 'small', 'default', 'large', 'x-large'].indexOf(value) !== -1
28
- }
29
- },
30
- modelValue: Number,
31
- readonly: Boolean
18
+ const props = defineProps({
19
+ /**
20
+ * Total number of rating stars to display
21
+ * @type {Number}
22
+ * @default 5
23
+ */
24
+ count: {
25
+ type: Number,
26
+ default: 5
32
27
  },
33
- emits: ['update:modelValue'],
34
- created() {
35
- if (!this.$r.icons.star) {
36
- this.$r.icons.star = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.62L12 2L9.19 8.62L2 9.24l5.45 4.73L5.82 21L12 17.27Z"/></svg>'
37
- }
28
+ /**
29
+ * Size of the rating stars
30
+ * @type {String}
31
+ * @default 'md'
32
+ * @validator ['xs', 'sm', 'md', 'lg', 'xl', 'xxl']
33
+ */
34
+ size: {
35
+ type: String,
36
+ default: 'md',
37
+ validator: (value) => ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].includes(value)
38
38
  },
39
- methods: {
40
- select(n) {
41
- this.$emit('update:modelValue', n)
42
- }
43
- }
39
+ /**
40
+ * Current rating value (0 to count)
41
+ * @type {Number}
42
+ */
43
+ modelValue: Number,
44
+ /**
45
+ * Disable rating interaction
46
+ * @type {Boolean}
47
+ */
48
+ readonly: Boolean
49
+ })
50
+
51
+ const emit = defineEmits([
52
+ /**
53
+ * Emitted when a rating is selected
54
+ * @param {Number} rating - The selected rating value (1 to count)
55
+ */
56
+ 'update:modelValue'
57
+ ])
58
+
59
+ // Methods
60
+ /**
61
+ * Selects a rating value
62
+ * @param {Number} rating - The rating value to select
63
+ */
64
+ const select = (rating) => {
65
+ if (props.readonly) return
66
+ emit('update:modelValue', rating)
44
67
  }
45
68
  </script>
69
+
46
70
  <style lang="scss">
47
- @use "../../../style/variables/base";
71
+ @use "../../../style" as *;
72
+
48
73
 
49
- $btn-sizes: (
50
- 'x-small': 20,
51
- 'small': 25,
52
- 'default': 30,
53
- 'large': 35,
54
- 'x-large': 40
55
- ) !default;
56
- .#{base.$prefix}rating {
74
+ .#{$prefix}rating {
57
75
  max-width: 100%;
58
76
  white-space: nowrap;
59
- transition: 1s base.$primary-transition;
60
-
61
- * {
62
- color: var(--color-on-sheet-low);
63
- }
77
+ transition: all $primary-transition;
64
78
 
65
79
  .color-rating * {
66
80
  color: #fbc02d !important;
67
81
  }
68
-
69
- @each $name, $size in $btn-sizes {
70
- &.size-#{$name} {
71
- .#{base.$prefix}btn {
72
- height: #{$size}px;
73
- width: #{$size}px
74
- }
75
-
76
- .#{base.$prefix}icon {
77
- height: #{$size - 4px};
78
- width: #{$size - 4px}
79
- }
80
- }
81
- }
82
82
  }
83
83
 
84
84
  </style>
@@ -1,8 +1,6 @@
1
1
  export * as rSelectInput from './index.vue'
2
2
  export * as l_Input from '../input/index.js'
3
3
  export * as l_icon from '../../icon/index.js'
4
- export * as l_chip from '../../chip/index.js'
5
4
  export * as l_line from '../../progress/line.js'
6
- export * as l_card from '../../card/index.js'
7
- export * as l_list from '../../list/index.js'
5
+ export * as l_modal from '../../modal/index.js'
8
6
  export * as d_clickOutside from '../../../directive/clickOutSide/index.js'