@teammodlr/ui-kit 2.1.65 → 2.1.68
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/lib/components/colorpicker/ColorPicker.vue.d.ts +10 -0
- package/lib/components/dialog/Dialog.vue.d.ts +36 -22
- package/lib/components/dialog/style/Dialog.css.d.ts +1 -0
- package/lib/components/slider/Slider.vue.d.ts +4 -6
- package/lib/index.cjs.js +6 -6
- package/lib/index.es.js +2630 -2548
- package/lib/style.css +1 -1
- package/package.json +76 -75
- package/src/components/colorpicker/ColorPicker.vue +72 -45
- package/src/components/colorpicker/examples/basic.vue +20 -9
- package/src/components/dialog/Dialog.vue +180 -118
- package/src/components/dialog/examples/basic.vue +8 -1
- package/src/components/dialog/style/Dialog.css.ts +60 -22
- package/src/components/slider/Slider.vue +111 -76
|
@@ -35,9 +35,13 @@ export const wrapper = style({
|
|
|
35
35
|
bottom: 0,
|
|
36
36
|
outline: 0,
|
|
37
37
|
overflow: 'auto',
|
|
38
|
-
boxSizing: 'border-box'
|
|
38
|
+
boxSizing: 'border-box',
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
+
export const notModal = style({
|
|
42
|
+
pointerEvents: 'none'
|
|
43
|
+
})
|
|
44
|
+
|
|
41
45
|
export const dialog = style({
|
|
42
46
|
boxSizing: 'border-box',
|
|
43
47
|
margin: '0 auto',
|
|
@@ -53,17 +57,21 @@ export const content = style({
|
|
|
53
57
|
position: 'relative',
|
|
54
58
|
backgroundColor: '#FFF',
|
|
55
59
|
backgroundClip: 'padding-box',
|
|
56
|
-
border:
|
|
57
|
-
borderRadius: themeVars.rounded.
|
|
60
|
+
border: `1px solid ${themeVars.color.gray[300]}`,
|
|
61
|
+
borderRadius: themeVars.rounded.medium,
|
|
58
62
|
pointerEvents: 'auto',
|
|
59
|
-
|
|
60
|
-
boxShadow: `0 6px 16px 0 rgba(0,0,0,.08), 0 3px 6px -4px rgba(0,0,0,.12), 0 9px 28px 8px rgba(0,0,0,.05)`
|
|
63
|
+
boxShadow: `2px 2px 8px rgba(128, 128, 128, 0.1), 0 9px 28px 8px rgba(0,0,0,.05)`
|
|
61
64
|
});
|
|
62
65
|
|
|
63
66
|
export const header = style({
|
|
64
67
|
color: themeVars.color.font.default,
|
|
65
68
|
backgroundColor: '#FFF',
|
|
66
|
-
marginBottom: themeVars.space[2]
|
|
69
|
+
marginBottom: themeVars.space[2],
|
|
70
|
+
borderBottom: `1px solid ${themeVars.color.gray[300]}`,
|
|
71
|
+
height: `35px`,
|
|
72
|
+
display: `flex`,
|
|
73
|
+
alignItems: `center`,
|
|
74
|
+
padding: `0px ${themeVars.space[2]}`
|
|
67
75
|
});
|
|
68
76
|
|
|
69
77
|
export const footer = style({
|
|
@@ -80,21 +88,51 @@ export const title = style({
|
|
|
80
88
|
wordWrap: 'break-word'
|
|
81
89
|
});
|
|
82
90
|
|
|
83
|
-
export const close = style(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
'
|
|
97
|
-
|
|
91
|
+
export const close = style([
|
|
92
|
+
{
|
|
93
|
+
outline: `none ${themeVars.color.gray[300]}`,
|
|
94
|
+
display: 'inline-block',
|
|
95
|
+
position: 'absolute',
|
|
96
|
+
top: themeVars.space[1.5],
|
|
97
|
+
right: themeVars.space[1.5],
|
|
98
|
+
width: '1.5rem',
|
|
99
|
+
height: '1.5rem',
|
|
100
|
+
backgroundColor: 'transparent',
|
|
101
|
+
border: 'none',
|
|
102
|
+
padding: 0,
|
|
103
|
+
cursor: 'pointer',
|
|
104
|
+
transition: 'all 0.2s',
|
|
105
|
+
borderRadius: themeVars.rounded.full,
|
|
106
|
+
marginLeft: themeVars.space[2],
|
|
107
|
+
':hover': {
|
|
108
|
+
backgroundColor: themeVars.color.gray[150]
|
|
109
|
+
},
|
|
110
|
+
':focus': {
|
|
111
|
+
backgroundColor: themeVars.color.gray[150]
|
|
112
|
+
},
|
|
113
|
+
'::before': {
|
|
114
|
+
content: '""',
|
|
115
|
+
position: 'absolute',
|
|
116
|
+
top: '50%',
|
|
117
|
+
left: '50%',
|
|
118
|
+
transform: 'translate(-50%, -50%) rotate(45deg)',
|
|
119
|
+
width: '0.8rem',
|
|
120
|
+
height: '2px',
|
|
121
|
+
backgroundColor: themeVars.color.gray[500],
|
|
122
|
+
transformOrigin: 'center',
|
|
123
|
+
transition: 'all 0.2s'
|
|
124
|
+
},
|
|
125
|
+
'::after': {
|
|
126
|
+
content: '""',
|
|
127
|
+
position: 'absolute',
|
|
128
|
+
top: '50%',
|
|
129
|
+
left: '50%',
|
|
130
|
+
transform: 'translate(-50%, -50%) rotate(-45deg)',
|
|
131
|
+
width: '0.8rem',
|
|
132
|
+
height: '2px',
|
|
133
|
+
backgroundColor: themeVars.color.gray[500],
|
|
134
|
+
transformOrigin: 'center',
|
|
135
|
+
transition: 'all 0.2s'
|
|
98
136
|
}
|
|
99
137
|
}
|
|
100
|
-
|
|
138
|
+
]);
|
|
@@ -1,76 +1,111 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="style.slider">
|
|
3
|
-
<div :class="style.sliderTransparent">
|
|
4
|
-
<div ref="slider"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
export default defineComponent({
|
|
21
|
-
name:
|
|
22
|
-
props: {
|
|
23
|
-
modelValue: {
|
|
24
|
-
type: Number,
|
|
25
|
-
required: true
|
|
26
|
-
},
|
|
27
|
-
background: {
|
|
28
|
-
type: String,
|
|
29
|
-
default:
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
dragging.value
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="style.slider">
|
|
3
|
+
<div :class="style.sliderTransparent">
|
|
4
|
+
<div ref="slider" :class="style.sliderBar" :style="{ background: background }" @mousedown="handleMouseDown"
|
|
5
|
+
@touchstart.prevent="handleMouseDown">
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div style="position: absolute; inset: 0px 9px;" @mousedown="handleMouseDown"
|
|
10
|
+
@touchstart.prevent="handleMouseDown">
|
|
11
|
+
<div :class="style.hueSliderThumb" :style="{ left: `${modelValue}%` }"></div>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import { defineComponent, ref, onMounted, onUnmounted } from 'vue';
|
|
18
|
+
import * as style from './style';
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: 'MSlider',
|
|
22
|
+
props: {
|
|
23
|
+
modelValue: {
|
|
24
|
+
type: Number,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
background: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: '',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
emits: ['update:modelValue', 'change'],
|
|
33
|
+
setup(props, { emit }) {
|
|
34
|
+
const slider = ref<HTMLElement | null>(null);
|
|
35
|
+
const dragging = ref(false);
|
|
36
|
+
|
|
37
|
+
const handleMouseDown = (event: MouseEvent | TouchEvent) => {
|
|
38
|
+
dragging.value = true;
|
|
39
|
+
setThumbPosition(event);
|
|
40
|
+
|
|
41
|
+
document.addEventListener('mousemove', onMouseMove);
|
|
42
|
+
document.addEventListener('mouseup', onMouseUp);
|
|
43
|
+
document.addEventListener('touchmove', onTouchMove);
|
|
44
|
+
document.addEventListener('touchend', onTouchEnd);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const onMouseMove = (event: MouseEvent) => {
|
|
48
|
+
if (dragging.value) {
|
|
49
|
+
setThumbPosition(event);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const onMouseUp = () => {
|
|
54
|
+
if (dragging.value) {
|
|
55
|
+
dragging.value = false;
|
|
56
|
+
removeEventListeners();
|
|
57
|
+
emit('change', props.modelValue);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const onTouchMove = (event: TouchEvent) => {
|
|
62
|
+
if (dragging.value) {
|
|
63
|
+
setThumbPosition(event);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const onTouchEnd = () => {
|
|
68
|
+
if (dragging.value) {
|
|
69
|
+
dragging.value = false;
|
|
70
|
+
removeEventListeners();
|
|
71
|
+
emit('change', props.modelValue);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const setThumbPosition = (event: MouseEvent | TouchEvent) => {
|
|
76
|
+
const rect = slider.value?.getBoundingClientRect();
|
|
77
|
+
if (!rect) return;
|
|
78
|
+
|
|
79
|
+
let clientX;
|
|
80
|
+
if (event instanceof MouseEvent) {
|
|
81
|
+
clientX = event.clientX;
|
|
82
|
+
} else if (event instanceof TouchEvent) {
|
|
83
|
+
clientX = event.touches[0].clientX;
|
|
84
|
+
} else {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const position = Math.min(Math.max(clientX - rect.left, 0), rect.width);
|
|
89
|
+
const value = (position / rect.width) * 100;
|
|
90
|
+
emit('update:modelValue', value);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const removeEventListeners = () => {
|
|
94
|
+
document.removeEventListener('mousemove', onMouseMove);
|
|
95
|
+
document.removeEventListener('mouseup', onMouseUp);
|
|
96
|
+
document.removeEventListener('touchmove', onTouchMove);
|
|
97
|
+
document.removeEventListener('touchend', onTouchEnd);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
onUnmounted(() => {
|
|
101
|
+
removeEventListeners();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
handleMouseDown,
|
|
106
|
+
slider,
|
|
107
|
+
style,
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
</script>
|