@onereach/ui-components 8.19.5 → 8.20.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.
- package/dist/bundled/v2/components/OrRangeSliderV3/OrRangeSlider.js +146 -25
- package/dist/bundled/v2/components/OrRangeSliderV3/OrRangeSlider.vue.d.ts +43 -25
- package/dist/bundled/v2/components/OrRangeSliderV3/styles.js +40 -0
- package/dist/bundled/v2/components/OrSliderV3/OrSlider.js +68 -13
- package/dist/bundled/v2/components/OrSliderV3/OrSlider.vue.d.ts +31 -21
- package/dist/bundled/v2/components/OrSliderV3/props.d.ts +3 -1
- package/dist/bundled/v2/components/OrSliderV3/props.js +2 -0
- package/dist/bundled/v2/components/OrSliderV3/styles.js +34 -0
- package/dist/bundled/v3/components/OrRangeSliderV3/OrRangeSlider.js +1 -1
- package/dist/bundled/v3/components/OrRangeSliderV3/OrRangeSlider.vue.d.ts +27 -18
- package/dist/bundled/v3/components/OrRangeSliderV3/index.js +2 -2
- package/dist/bundled/v3/components/OrRangeSliderV3/props.js +1 -1
- package/dist/bundled/v3/components/OrRangeSliderV3/styles.js +2 -2
- package/dist/bundled/v3/components/{OrRangeSliderV3-f8024c15.js → OrRangeSliderV3-fac9697f.js} +187 -27
- package/dist/bundled/v3/components/OrSliderV3/OrSlider.js +1 -1
- package/dist/bundled/v3/components/OrSliderV3/OrSlider.vue.d.ts +21 -16
- package/dist/bundled/v3/components/OrSliderV3/index.js +1 -1
- package/dist/bundled/v3/components/OrSliderV3/props.d.ts +3 -1
- package/dist/bundled/v3/components/OrSliderV3/props.js +1 -1
- package/dist/bundled/v3/components/OrSliderV3/styles.js +1 -1
- package/dist/bundled/v3/components/{OrSliderV3-b69331d1.js → OrSliderV3-6d75304d.js} +104 -14
- package/dist/bundled/v3/components/index.js +2 -2
- package/dist/bundled/v3/index.js +2 -2
- package/dist/esm/v2/{OrRangeSlider-2fba4c60.js → OrRangeSlider-7a377862.js} +187 -26
- package/dist/esm/v2/{OrSlider-dd60a4a1.js → OrSlider-dd967591.js} +3 -4
- package/dist/esm/v2/{OrSlider.vue_rollup-plugin-vue_script-eadc5fc6.js → OrSlider.vue_rollup-plugin-vue_script-79f356ca.js} +102 -10
- package/dist/esm/v2/components/index.js +3 -3
- package/dist/esm/v2/components/or-range-slider-v3/OrRangeSlider.vue.d.ts +43 -25
- package/dist/esm/v2/components/or-range-slider-v3/index.js +2 -2
- package/dist/esm/v2/components/or-slider-v3/OrSlider.vue.d.ts +31 -21
- package/dist/esm/v2/components/or-slider-v3/index.js +2 -2
- package/dist/esm/v2/components/or-slider-v3/props.d.ts +3 -1
- package/dist/esm/v2/index.js +3 -3
- package/dist/esm/v3/{OrRangeSlider-1c6ff524.js → OrRangeSlider-cd72332c.js} +187 -27
- package/dist/esm/v3/{OrSlider-654bd19f.js → OrSlider-ba7aff7c.js} +104 -14
- package/dist/esm/v3/components/index.js +2 -2
- package/dist/esm/v3/components/or-range-slider-v3/OrRangeSlider.vue.d.ts +27 -18
- package/dist/esm/v3/components/or-range-slider-v3/index.js +2 -2
- package/dist/esm/v3/components/or-slider-v3/OrSlider.vue.d.ts +21 -16
- package/dist/esm/v3/components/or-slider-v3/index.js +1 -1
- package/dist/esm/v3/components/or-slider-v3/props.d.ts +3 -1
- package/dist/esm/v3/index.js +2 -2
- package/package.json +2 -2
- package/src/components/or-range-slider-v3/OrRangeSlider.vue +154 -28
- package/src/components/or-range-slider-v3/styles.ts +68 -0
- package/src/components/or-slider-v3/OrSlider.vue +66 -14
- package/src/components/or-slider-v3/props.ts +2 -0
- package/src/components/or-slider-v3/styles.ts +58 -0
|
@@ -14,6 +14,14 @@ export const RangeSliderOrientations: Record<RangeSliderOrientation, string[]> =
|
|
|
14
14
|
'w-full',
|
|
15
15
|
],
|
|
16
16
|
|
|
17
|
+
[RangeSliderOrientation.HorizontalReversed]: [
|
|
18
|
+
// Layout
|
|
19
|
+
'layout-column',
|
|
20
|
+
|
|
21
|
+
// Box
|
|
22
|
+
'w-full',
|
|
23
|
+
],
|
|
24
|
+
|
|
17
25
|
[RangeSliderOrientation.Vertical]: [
|
|
18
26
|
// Layout
|
|
19
27
|
'layout-row',
|
|
@@ -21,6 +29,14 @@ export const RangeSliderOrientations: Record<RangeSliderOrientation, string[]> =
|
|
|
21
29
|
// Box
|
|
22
30
|
'h-full',
|
|
23
31
|
],
|
|
32
|
+
|
|
33
|
+
[RangeSliderOrientation.VerticalReversed]: [
|
|
34
|
+
// Layout
|
|
35
|
+
'layout-row',
|
|
36
|
+
|
|
37
|
+
// Box
|
|
38
|
+
'h-full',
|
|
39
|
+
],
|
|
24
40
|
};
|
|
25
41
|
|
|
26
42
|
export const RangeSliderRail: string[] = [
|
|
@@ -52,6 +68,19 @@ export const RangeSliderRailOrientations: Record<RangeSliderOrientation, string[
|
|
|
52
68
|
'my-md+',
|
|
53
69
|
],
|
|
54
70
|
|
|
71
|
+
[RangeSliderOrientation.HorizontalReversed]: [
|
|
72
|
+
// Layout
|
|
73
|
+
'layout-row-reverse',
|
|
74
|
+
|
|
75
|
+
// Box
|
|
76
|
+
'w-full',
|
|
77
|
+
'h-xs',
|
|
78
|
+
|
|
79
|
+
// Spacing
|
|
80
|
+
'mx-0',
|
|
81
|
+
'my-md+',
|
|
82
|
+
],
|
|
83
|
+
|
|
55
84
|
[RangeSliderOrientation.Vertical]: [
|
|
56
85
|
// Layout
|
|
57
86
|
'layout-column-reverse items-center',
|
|
@@ -64,6 +93,19 @@ export const RangeSliderRailOrientations: Record<RangeSliderOrientation, string[
|
|
|
64
93
|
'mx-md+',
|
|
65
94
|
'my-0',
|
|
66
95
|
],
|
|
96
|
+
|
|
97
|
+
[RangeSliderOrientation.VerticalReversed]: [
|
|
98
|
+
// Layout
|
|
99
|
+
'layout-column items-center',
|
|
100
|
+
|
|
101
|
+
// Box
|
|
102
|
+
'w-xs',
|
|
103
|
+
'h-full',
|
|
104
|
+
|
|
105
|
+
// Spacing
|
|
106
|
+
'mx-md+',
|
|
107
|
+
'my-0',
|
|
108
|
+
],
|
|
67
109
|
};
|
|
68
110
|
|
|
69
111
|
export const RangeSliderOffset: string[] = [];
|
|
@@ -74,10 +116,20 @@ export const RangeSliderOffsetOrientations: Record<RangeSliderOrientation, strin
|
|
|
74
116
|
'h-full',
|
|
75
117
|
],
|
|
76
118
|
|
|
119
|
+
[RangeSliderOrientation.HorizontalReversed]: [
|
|
120
|
+
// Box
|
|
121
|
+
'h-full',
|
|
122
|
+
],
|
|
123
|
+
|
|
77
124
|
[RangeSliderOrientation.Vertical]: [
|
|
78
125
|
// Box
|
|
79
126
|
'w-full',
|
|
80
127
|
],
|
|
128
|
+
|
|
129
|
+
[RangeSliderOrientation.VerticalReversed]: [
|
|
130
|
+
// Box
|
|
131
|
+
'w-full',
|
|
132
|
+
],
|
|
81
133
|
};
|
|
82
134
|
|
|
83
135
|
export const RangeSliderTrack: string[] = [
|
|
@@ -216,6 +268,14 @@ export const RangeSliderLabelOrientations: Record<RangeSliderOrientation, string
|
|
|
216
268
|
'w-full',
|
|
217
269
|
],
|
|
218
270
|
|
|
271
|
+
[RangeSliderOrientation.HorizontalReversed]: [
|
|
272
|
+
// Layout
|
|
273
|
+
'layout-row-reverse',
|
|
274
|
+
|
|
275
|
+
// Box
|
|
276
|
+
'w-full',
|
|
277
|
+
],
|
|
278
|
+
|
|
219
279
|
[RangeSliderOrientation.Vertical]: [
|
|
220
280
|
// Layout
|
|
221
281
|
'layout-column-reverse items-center',
|
|
@@ -223,6 +283,14 @@ export const RangeSliderLabelOrientations: Record<RangeSliderOrientation, string
|
|
|
223
283
|
// Box
|
|
224
284
|
'h-full',
|
|
225
285
|
],
|
|
286
|
+
|
|
287
|
+
[RangeSliderOrientation.VerticalReversed]: [
|
|
288
|
+
// Layout
|
|
289
|
+
'layout-column items-center',
|
|
290
|
+
|
|
291
|
+
// Box
|
|
292
|
+
'h-full',
|
|
293
|
+
],
|
|
226
294
|
};
|
|
227
295
|
|
|
228
296
|
export const RangeSliderLabelMark: string[] = [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
:class="['relative', 'z-10']"
|
|
20
20
|
:is-open="isHovering || isDragging"
|
|
21
21
|
:content="String(proxyModelValue)"
|
|
22
|
-
:placement="
|
|
22
|
+
:placement="tooltipPlacement"
|
|
23
23
|
:offset="24"
|
|
24
24
|
:external-control="true"
|
|
25
25
|
>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
v-for="breakpoint of breakpoints"
|
|
35
35
|
:key="breakpoint"
|
|
36
36
|
:class="breakpointMarkStyles"
|
|
37
|
-
:style="
|
|
37
|
+
:style="getBreakpointMarkComputedStyles(breakpoint)"
|
|
38
38
|
:activated="breakpoint <= proxyModelValue"
|
|
39
39
|
:disabled="disabled"
|
|
40
40
|
/>
|
|
@@ -75,22 +75,22 @@ export default defineComponent({
|
|
|
75
75
|
props: {
|
|
76
76
|
modelValue: {
|
|
77
77
|
type: Number,
|
|
78
|
-
default: undefined,
|
|
78
|
+
default: () => undefined,
|
|
79
79
|
},
|
|
80
80
|
|
|
81
81
|
minValue: {
|
|
82
82
|
type: Number,
|
|
83
|
-
default: 0,
|
|
83
|
+
default: () => 0,
|
|
84
84
|
},
|
|
85
85
|
|
|
86
86
|
maxValue: {
|
|
87
87
|
type: Number,
|
|
88
|
-
default: 100,
|
|
88
|
+
default: () => 100,
|
|
89
89
|
},
|
|
90
90
|
|
|
91
91
|
step: {
|
|
92
92
|
type: Number,
|
|
93
|
-
default: 1,
|
|
93
|
+
default: () => 1,
|
|
94
94
|
},
|
|
95
95
|
|
|
96
96
|
breakpoints: {
|
|
@@ -110,7 +110,7 @@ export default defineComponent({
|
|
|
110
110
|
|
|
111
111
|
disabled: {
|
|
112
112
|
type: Boolean,
|
|
113
|
-
default: false,
|
|
113
|
+
default: () => false,
|
|
114
114
|
},
|
|
115
115
|
},
|
|
116
116
|
|
|
@@ -146,9 +146,17 @@ export default defineComponent({
|
|
|
146
146
|
...SliderTrackColors[props.color],
|
|
147
147
|
]);
|
|
148
148
|
|
|
149
|
-
const trackComputedStyles = computed(() =>
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
const trackComputedStyles = computed(() => {
|
|
150
|
+
switch (props.orientation) {
|
|
151
|
+
case SliderOrientation.Horizontal:
|
|
152
|
+
case SliderOrientation.HorizontalReversed:
|
|
153
|
+
return { width: `${internalModelValue.value * 100}%` };
|
|
154
|
+
|
|
155
|
+
case SliderOrientation.Vertical:
|
|
156
|
+
case SliderOrientation.VerticalReversed:
|
|
157
|
+
return { height: `${internalModelValue.value * 100}%` };
|
|
158
|
+
}
|
|
159
|
+
});
|
|
152
160
|
|
|
153
161
|
const thumbStyles = computed(() => [
|
|
154
162
|
'or-slider-thumb-v3',
|
|
@@ -203,6 +211,18 @@ export default defineComponent({
|
|
|
203
211
|
|
|
204
212
|
const railBoundingBox = useElementBounding(rail);
|
|
205
213
|
|
|
214
|
+
const tooltipPlacement = computed(() => {
|
|
215
|
+
switch (props.orientation) {
|
|
216
|
+
case SliderOrientation.Horizontal:
|
|
217
|
+
case SliderOrientation.HorizontalReversed:
|
|
218
|
+
return 'top';
|
|
219
|
+
|
|
220
|
+
case SliderOrientation.Vertical:
|
|
221
|
+
case SliderOrientation.VerticalReversed:
|
|
222
|
+
return 'right';
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
206
226
|
// Handlers
|
|
207
227
|
function onDrag(position: Position, event: MouseEvent | PointerEvent): void {
|
|
208
228
|
if (props.disabled) {
|
|
@@ -212,12 +232,43 @@ export default defineComponent({
|
|
|
212
232
|
const totalWidth = railBoundingBox.width.value;
|
|
213
233
|
const totalHeight = railBoundingBox.height.value;
|
|
214
234
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
235
|
+
switch (props.orientation) {
|
|
236
|
+
case SliderOrientation.Horizontal:
|
|
237
|
+
internalModelValue.value = clamp(event.clientX - railBoundingBox.left.value, 0, totalWidth) / totalWidth;
|
|
238
|
+
break;
|
|
239
|
+
|
|
240
|
+
case SliderOrientation.HorizontalReversed:
|
|
241
|
+
internalModelValue.value = clamp(railBoundingBox.right.value - event.clientX, 0, totalWidth) / totalWidth;
|
|
242
|
+
break;
|
|
243
|
+
|
|
244
|
+
case SliderOrientation.Vertical:
|
|
245
|
+
internalModelValue.value = clamp(totalHeight - (event.clientY - railBoundingBox.top.value), 0, totalHeight) / totalHeight;
|
|
246
|
+
break;
|
|
247
|
+
|
|
248
|
+
case SliderOrientation.VerticalReversed:
|
|
249
|
+
internalModelValue.value = clamp(totalHeight - (railBoundingBox.bottom.value - event.clientY), 0, totalHeight) / totalHeight;
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
218
252
|
}
|
|
219
253
|
|
|
220
254
|
// Methods
|
|
255
|
+
function getBreakpointMarkComputedStyles(breakpoint: number): Partial<CSSStyleDeclaration> | undefined {
|
|
256
|
+
switch (props.orientation) {
|
|
257
|
+
case SliderOrientation.Horizontal:
|
|
258
|
+
return { left: `${getBreakpointOffset(breakpoint) * 100}%` };
|
|
259
|
+
|
|
260
|
+
case SliderOrientation.HorizontalReversed:
|
|
261
|
+
return { right: `${getBreakpointOffset(breakpoint) * 100}%` };
|
|
262
|
+
|
|
263
|
+
case SliderOrientation.Vertical:
|
|
264
|
+
return { bottom: `${getBreakpointOffset(breakpoint) * 100}%` };
|
|
265
|
+
|
|
266
|
+
case SliderOrientation.VerticalReversed:
|
|
267
|
+
return { top: `${getBreakpointOffset(breakpoint) * 100}%` };
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Helpers
|
|
221
272
|
function getBreakpointOffset(breakpoint: number): number {
|
|
222
273
|
return (breakpoint - props.minValue) / (props.maxValue - props.minValue);
|
|
223
274
|
}
|
|
@@ -258,8 +309,9 @@ export default defineComponent({
|
|
|
258
309
|
labelMarkStyles,
|
|
259
310
|
|
|
260
311
|
proxyModelValue,
|
|
312
|
+
tooltipPlacement,
|
|
261
313
|
|
|
262
|
-
|
|
314
|
+
getBreakpointMarkComputedStyles,
|
|
263
315
|
|
|
264
316
|
isHovering,
|
|
265
317
|
isDragging,
|
|
@@ -14,6 +14,14 @@ export const SliderOrientations: Record<SliderOrientation, string[]> = {
|
|
|
14
14
|
'w-full',
|
|
15
15
|
],
|
|
16
16
|
|
|
17
|
+
[SliderOrientation.HorizontalReversed]: [
|
|
18
|
+
// Layout
|
|
19
|
+
'layout-column',
|
|
20
|
+
|
|
21
|
+
// Box
|
|
22
|
+
'w-full',
|
|
23
|
+
],
|
|
24
|
+
|
|
17
25
|
[SliderOrientation.Vertical]: [
|
|
18
26
|
// Layout
|
|
19
27
|
'layout-row',
|
|
@@ -21,6 +29,14 @@ export const SliderOrientations: Record<SliderOrientation, string[]> = {
|
|
|
21
29
|
// Box
|
|
22
30
|
'h-full',
|
|
23
31
|
],
|
|
32
|
+
|
|
33
|
+
[SliderOrientation.VerticalReversed]: [
|
|
34
|
+
// Layout
|
|
35
|
+
'layout-row',
|
|
36
|
+
|
|
37
|
+
// Box
|
|
38
|
+
'h-full',
|
|
39
|
+
],
|
|
24
40
|
};
|
|
25
41
|
|
|
26
42
|
export const SliderRail: string[] = [
|
|
@@ -52,6 +68,19 @@ export const SliderRailOrientations: Record<SliderOrientation, string[]> = {
|
|
|
52
68
|
'my-md+',
|
|
53
69
|
],
|
|
54
70
|
|
|
71
|
+
[SliderOrientation.HorizontalReversed]: [
|
|
72
|
+
// Layout
|
|
73
|
+
'layout-row-reverse',
|
|
74
|
+
|
|
75
|
+
// Box
|
|
76
|
+
'w-full',
|
|
77
|
+
'h-xs',
|
|
78
|
+
|
|
79
|
+
// Spacing
|
|
80
|
+
'mx-0',
|
|
81
|
+
'my-md+',
|
|
82
|
+
],
|
|
83
|
+
|
|
55
84
|
[SliderOrientation.Vertical]: [
|
|
56
85
|
// Layout
|
|
57
86
|
'layout-column-reverse items-center',
|
|
@@ -64,6 +93,19 @@ export const SliderRailOrientations: Record<SliderOrientation, string[]> = {
|
|
|
64
93
|
'mx-md+',
|
|
65
94
|
'my-0',
|
|
66
95
|
],
|
|
96
|
+
|
|
97
|
+
[SliderOrientation.VerticalReversed]: [
|
|
98
|
+
// Layout
|
|
99
|
+
'layout-column items-center',
|
|
100
|
+
|
|
101
|
+
// Box
|
|
102
|
+
'w-xs',
|
|
103
|
+
'h-full',
|
|
104
|
+
|
|
105
|
+
// Spacing
|
|
106
|
+
'mx-md+',
|
|
107
|
+
'my-0',
|
|
108
|
+
],
|
|
67
109
|
};
|
|
68
110
|
|
|
69
111
|
export const SliderTrack: string[] = [
|
|
@@ -202,6 +244,14 @@ export const SliderLabelOrientations: Record<SliderOrientation, string[]> = {
|
|
|
202
244
|
'w-full',
|
|
203
245
|
],
|
|
204
246
|
|
|
247
|
+
[SliderOrientation.HorizontalReversed]: [
|
|
248
|
+
// Layout
|
|
249
|
+
'layout-row-reverse',
|
|
250
|
+
|
|
251
|
+
// Box
|
|
252
|
+
'w-full',
|
|
253
|
+
],
|
|
254
|
+
|
|
205
255
|
[SliderOrientation.Vertical]: [
|
|
206
256
|
// Layout
|
|
207
257
|
'layout-column-reverse items-center',
|
|
@@ -209,6 +259,14 @@ export const SliderLabelOrientations: Record<SliderOrientation, string[]> = {
|
|
|
209
259
|
// Box
|
|
210
260
|
'h-full',
|
|
211
261
|
],
|
|
262
|
+
|
|
263
|
+
[SliderOrientation.VerticalReversed]: [
|
|
264
|
+
// Layout
|
|
265
|
+
'layout-column items-center',
|
|
266
|
+
|
|
267
|
+
// Box
|
|
268
|
+
'h-full',
|
|
269
|
+
],
|
|
212
270
|
};
|
|
213
271
|
|
|
214
272
|
export const SliderLabelMark: string[] = [
|