@teammodlr/ui-kit 2.1.8 → 2.1.10
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/avatargroup/symbol.d.ts +2 -2
- package/lib/components/breadcrumb/style/index.d.ts +1 -1
- package/lib/components/breadcrumb/symbol.d.ts +1 -1
- package/lib/components/buttongroup/symbol.d.ts +2 -2
- package/lib/components/colorpicker/ColorPicker.vue.d.ts +1 -1
- package/lib/components/dropdown/Dropdown.vue.d.ts +1 -1
- package/lib/components/dropdown/symbol.d.ts +1 -1
- package/lib/components/form/symbol.d.ts +1 -1
- package/lib/components/messageprovider/style/index.d.ts +1 -1
- package/lib/components/modal/Modal.vue.d.ts +6 -3
- package/lib/components/modal/style/Modal.css.d.ts +3 -0
- package/lib/components/radiobuttongroup/symbol.d.ts +2 -2
- package/lib/components/tooltip/Tooltip.vue.d.ts +1 -1
- package/lib/components/tree/props.d.ts +4 -4
- package/lib/components/tree/types.d.ts +10 -10
- package/lib/composables/element.d.ts +1 -1
- package/lib/composables/useInteractive.d.ts +1 -1
- package/lib/composables/useMount.d.ts +1 -1
- package/lib/composables/usePopper.d.ts +2 -2
- package/lib/composables/useZIndex.d.ts +1 -1
- package/lib/index.cjs.js +9 -9
- package/lib/index.es.js +2256 -2213
- package/lib/install.d.ts +1 -1
- package/lib/nuxt.js +17 -15
- package/lib/nuxt.plugin.js +6 -6
- package/lib/style.css +1 -1
- package/package.json +89 -79
- package/src/__storybook__/argTypes.ts +5 -13
- package/src/__storybook__/createStory.ts +10 -10
- package/src/call.ts +14 -14
- package/src/components/avatar/Avatar.vue +1 -1
- package/src/components/avatar/examples/index.stories.ts +4 -7
- package/src/components/avatar/style/Avatar.css.ts +17 -17
- package/src/components/avatargroup/examples/index.stories.ts +5 -10
- package/src/components/avatargroup/style/AvatarGroup.css.ts +9 -4
- package/src/components/avatargroup/symbol.ts +5 -5
- package/src/components/badge/examples/index.stories.ts +4 -6
- package/src/components/badge/style/Badge.css.ts +36 -36
- package/src/components/breadcrumb/examples/index.stories.ts +6 -10
- package/src/components/breadcrumb/style/Breadcrumb.css.ts +17 -17
- package/src/components/breadcrumb/style/index.ts +1 -1
- package/src/components/breadcrumb/symbol.ts +4 -3
- package/src/components/button/examples/index.stories.ts +4 -4
- package/src/components/button/style/Button.css.ts +143 -133
- package/src/components/buttongroup/examples/index.stories.ts +6 -12
- package/src/components/buttongroup/style/ButtonGroup.css.ts +13 -11
- package/src/components/buttongroup/symbol.ts +5 -4
- package/src/components/checkbox/Checkbox.vue +8 -8
- package/src/components/checkbox/examples/index.stories.ts +4 -9
- package/src/components/checkbox/examples/index.ts +0 -1
- package/src/components/checkbox/style/Checkbox.css.ts +31 -27
- package/src/components/checkbox/style/index.ts +1 -1
- package/src/components/colorpicker/examples/index.stories.ts +5 -10
- package/src/components/colorpicker/examples/index.ts +1 -1
- package/src/components/colorpicker/style/ColorPicker.css.ts +22 -14
- package/src/components/colorpicker/utils.ts +46 -28
- package/src/components/confirm/examples/index.stories.ts +5 -8
- package/src/components/confirm/props.ts +2 -2
- package/src/components/confirm/providerProps.ts +1 -2
- package/src/components/confirm/types.ts +15 -16
- package/src/components/confirm/useConfirm.ts +3 -1
- package/src/components/dialog/examples/index.stories.ts +5 -9
- package/src/components/dialog/style/Dialog.css.ts +38 -37
- package/src/components/dropdown/examples/index.stories.ts +3 -7
- package/src/components/dropdown/hooks.ts +20 -20
- package/src/components/dropdown/style/Dropdown.css.ts +24 -24
- package/src/components/dropdown/symbol.ts +3 -2
- package/src/components/form/Form.vue +1 -1
- package/src/components/form/examples/index.stories.ts +2 -4
- package/src/components/form/style/Form.css.ts +13 -8
- package/src/components/form/style/index.ts +2 -2
- package/src/components/form/symbol.ts +10 -5
- package/src/components/image/examples/index.stories.ts +5 -7
- package/src/components/input/Input.vue +8 -9
- package/src/components/input/examples/index.stories.ts +5 -7
- package/src/components/input/style/Input.css.ts +40 -43
- package/src/components/link/examples/index.stories.ts +4 -9
- package/src/components/messageprovider/examples/index.stories.ts +5 -8
- package/src/components/messageprovider/style/Message.css.ts +31 -31
- package/src/components/messageprovider/style/index.ts +1 -1
- package/src/components/messageprovider/types.ts +31 -22
- package/src/components/messageprovider/useMessage.ts +6 -4
- package/src/components/modal/Modal.vue +72 -54
- package/src/components/modal/examples/index.stories.ts +6 -10
- package/src/components/modal/examples/index.ts +1 -0
- package/src/components/modal/examples/sidebar.vue +75 -0
- package/src/components/modal/style/Modal.css.ts +91 -72
- package/src/components/pagination/examples/index.stories.ts +5 -9
- package/src/components/pagination/examples/index.ts +1 -1
- package/src/components/pagination/style/Pagination.css.ts +41 -37
- package/src/components/radio/Radio.vue +7 -7
- package/src/components/radio/examples/index.stories.ts +4 -9
- package/src/components/radio/examples/index.ts +0 -1
- package/src/components/radio/style/Checkbox.css.ts +30 -31
- package/src/components/radio/style/index.ts +1 -1
- package/src/components/radiobutton/RadioButton.vue +3 -3
- package/src/components/radiobutton/style/RadioButton.css.ts +41 -36
- package/src/components/radiobuttongroup/examples/index.stories.ts +6 -10
- package/src/components/radiobuttongroup/examples/index.ts +0 -1
- package/src/components/radiobuttongroup/style/RadioButtonGroup.css.ts +14 -14
- package/src/components/radiobuttongroup/style/index.ts +1 -1
- package/src/components/radiobuttongroup/symbol.ts +8 -7
- package/src/components/renderer/examlpes/index.stories.ts +4 -8
- package/src/components/renderer/props.ts +2 -3
- package/src/components/renderer/renderer.ts +3 -3
- package/src/components/select/Select.vue +3 -4
- package/src/components/select/examples/index.stories.ts +4 -10
- package/src/components/select/style/Select.css.ts +62 -61
- package/src/components/skeleton/examples/index.stories.ts +5 -9
- package/src/components/skeleton/style/Skeleton.css.ts +16 -16
- package/src/components/skeleton/style/index.ts +2 -2
- package/src/components/slider/style/Slider.css.ts +12 -5
- package/src/components/switch/Switch.vue +4 -4
- package/src/components/switch/examples/index.stories.ts +4 -9
- package/src/components/switch/examples/index.ts +0 -1
- package/src/components/switch/style/Switch.css.ts +56 -57
- package/src/components/switch/style/index.ts +1 -1
- package/src/components/tab/examples/index.stories.ts +5 -11
- package/src/components/table/examples/index.stories.ts +6 -12
- package/src/components/table/style/Table.css.ts +22 -17
- package/src/components/table/style/index.ts +1 -1
- package/src/components/table/types/index.ts +1 -1
- package/src/components/tag/examples/index.stories.ts +4 -10
- package/src/components/tag/style/Tag.css.ts +14 -9
- package/src/components/textarea/Textarea.vue +7 -8
- package/src/components/textarea/examples/index.stories.ts +4 -8
- package/src/components/textarea/style/Textarea.css.ts +33 -33
- package/src/components/tooltip/examples/index.stories.ts +5 -10
- package/src/components/tooltip/examples/index.ts +2 -2
- package/src/components/tooltip/style/Tooltip.css.ts +24 -25
- package/src/components/transfer/examples/index.stories.ts +5 -9
- package/src/components/transfer/style/Transfer.css.ts +41 -40
- package/src/components/tree/examples/index.stories.ts +6 -10
- package/src/components/tree/props.ts +20 -18
- package/src/components/tree/style/Tree.css.ts +36 -31
- package/src/components/tree/types.ts +60 -62
- package/src/components/virtualscroll/examples/index.stories.ts +4 -8
- package/src/components/virtualscroll/style/VirtualScroll.css.ts +1 -2
- package/src/composables/element.ts +4 -4
- package/src/composables/useCachedUid.ts +7 -6
- package/src/composables/useEventListener.ts +11 -6
- package/src/composables/useInput.ts +63 -41
- package/src/composables/useInteractive.ts +10 -11
- package/src/composables/useMergedState.ts +7 -7
- package/src/composables/useMount.ts +11 -11
- package/src/composables/usePopper.ts +57 -36
- package/src/composables/useZIndex.ts +5 -5
- package/src/create.ts +10 -6
- package/src/examples/cards/cards.stories.ts +3 -3
- package/src/examples/modal/modal.stories.ts +3 -3
- package/src/exports/nuxt.js +17 -15
- package/src/exports/nuxt.plugin.js +6 -6
- package/src/index.ts +0 -2
- package/src/install.ts +5 -5
- package/src/shims-vue.d.ts +3 -3
- package/src/styles/theme.css.ts +51 -43
- package/src/styles/transitions.css.ts +26 -28
- package/src/types/props.ts +16 -2
- package/src/utils/injection.ts +3 -3
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import MButtonGroup from
|
|
2
|
-
import MButton from
|
|
3
|
-
import {
|
|
4
|
-
MButtonGroupBasic,
|
|
5
|
-
MButtonGroupIconGroup
|
|
6
|
-
} from "./index";
|
|
1
|
+
import MButtonGroup from '../ButtonGroup.vue';
|
|
2
|
+
import MButton from '../../button/Button.vue';
|
|
3
|
+
import { MButtonGroupBasic, MButtonGroupIconGroup } from './index';
|
|
7
4
|
|
|
8
|
-
import {
|
|
9
|
-
createStory,
|
|
10
|
-
sizeArgType
|
|
11
|
-
} from "../../../__storybook__";
|
|
5
|
+
import { createStory, sizeArgType } from '../../../__storybook__';
|
|
12
6
|
|
|
13
7
|
export default {
|
|
14
8
|
component: MButtonGroup,
|
|
@@ -17,7 +11,7 @@ export default {
|
|
|
17
11
|
argTypes: {
|
|
18
12
|
...sizeArgType()
|
|
19
13
|
}
|
|
20
|
-
}
|
|
14
|
+
};
|
|
21
15
|
|
|
22
16
|
export const Basic = createStory(MButtonGroupBasic);
|
|
23
|
-
export const IconGroup = createStory(MButtonGroupIconGroup);
|
|
17
|
+
export const IconGroup = createStory(MButtonGroupIconGroup);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {globalStyle, style} from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { globalStyle, style } from '@vanilla-extract/css';
|
|
2
|
+
import {
|
|
3
|
+
base as button,
|
|
4
|
+
border as buttonBorder,
|
|
5
|
+
borderState
|
|
6
|
+
} from '../../button/style/Button.css';
|
|
5
7
|
|
|
6
8
|
export const base = style({
|
|
7
|
-
display:
|
|
8
|
-
position:
|
|
9
|
-
flexWrap:
|
|
9
|
+
display: 'inline-flex',
|
|
10
|
+
position: 'relative',
|
|
11
|
+
flexWrap: 'nowrap'
|
|
10
12
|
});
|
|
11
13
|
|
|
12
14
|
globalStyle(`${base} > ${button}:first-child:not(:last-child)`, {
|
|
@@ -18,11 +20,11 @@ globalStyle(`${base} > ${button}:first-child:not(:last-child)`, {
|
|
|
18
20
|
globalStyle(`${base} > ${button}:not(:first-child):not(:last-child)`, {
|
|
19
21
|
marginLeft: 0,
|
|
20
22
|
borderRadius: 0,
|
|
21
|
-
marginRight: 0
|
|
23
|
+
marginRight: 0
|
|
22
24
|
});
|
|
23
25
|
|
|
24
26
|
globalStyle(`${base} > ${button}:not(:first-child) ${buttonBorder}`, {
|
|
25
|
-
borderLeftWidth: 0
|
|
27
|
+
borderLeftWidth: 0
|
|
26
28
|
});
|
|
27
29
|
|
|
28
30
|
globalStyle(`${base} > ${button}:last-child:not(:first-child)`, {
|
|
@@ -36,5 +38,5 @@ globalStyle(`${base} > ${button}:not(:first-child) ${borderState}`, {
|
|
|
36
38
|
});
|
|
37
39
|
|
|
38
40
|
export const vertical = style({
|
|
39
|
-
flexDirection:
|
|
40
|
-
});
|
|
41
|
+
flexDirection: 'column'
|
|
42
|
+
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {InjectionKey} from
|
|
2
|
-
import type {Size} from
|
|
1
|
+
import type { InjectionKey } from 'vue';
|
|
2
|
+
import type { Size } from '../../types/props';
|
|
3
3
|
|
|
4
4
|
export interface ButtonGroupState {
|
|
5
|
-
size: Size
|
|
5
|
+
size: Size;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export const BUTTON_GROUP_STATE: InjectionKey<ButtonGroupState> =
|
|
8
|
+
export const BUTTON_GROUP_STATE: InjectionKey<ButtonGroupState> =
|
|
9
|
+
Symbol('BUTTON_GROUP_STATE');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<label :class="style.base">
|
|
3
|
-
<input
|
|
3
|
+
<input
|
|
4
4
|
:id="name"
|
|
5
5
|
v-model="toggle"
|
|
6
6
|
:name="name"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</template>
|
|
42
42
|
|
|
43
43
|
<script lang="ts">
|
|
44
|
-
import {computed, defineComponent,
|
|
44
|
+
import {computed, defineComponent, type PropType, ref, toRef, watch} from 'vue';
|
|
45
45
|
import {useInput} from '../../composables/useInput';
|
|
46
46
|
import {useInteractive} from "../../composables/useInteractive";
|
|
47
47
|
import type {Size} from '../../types/props';
|
|
@@ -80,7 +80,7 @@ export default defineComponent({
|
|
|
80
80
|
// type: [String, Number, Boolean, Object, Array]
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
|
-
setup(props, {slots, emit}) {
|
|
83
|
+
setup(props, {slots, emit, expose}) {
|
|
84
84
|
const checkboxRef = ref<HTMLElement | null>(null);
|
|
85
85
|
|
|
86
86
|
const {focus, blur} = useInteractive(checkboxRef);
|
|
@@ -125,15 +125,15 @@ export default defineComponent({
|
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
127
|
|
|
128
|
-
defineExpose({
|
|
129
|
-
focus,
|
|
130
|
-
blur,
|
|
131
|
-
})
|
|
132
|
-
|
|
133
128
|
const onChange = (event: Event) => {
|
|
134
129
|
emit('change', event);
|
|
135
130
|
};
|
|
136
131
|
|
|
132
|
+
expose({
|
|
133
|
+
focus,
|
|
134
|
+
blur
|
|
135
|
+
})
|
|
136
|
+
|
|
137
137
|
return {
|
|
138
138
|
id,
|
|
139
139
|
formError,
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import MCheckbox from
|
|
2
|
-
import {
|
|
3
|
-
MCheckboxBasic,
|
|
4
|
-
MCheckboxSlot
|
|
5
|
-
} from "./index";
|
|
1
|
+
import MCheckbox from '../Checkbox.vue';
|
|
2
|
+
import { MCheckboxBasic, MCheckboxSlot } from './index';
|
|
6
3
|
|
|
7
|
-
import {
|
|
8
|
-
createStory, sizeArgType, colorArgType
|
|
9
|
-
} from "../../../__storybook__";
|
|
4
|
+
import { createStory, sizeArgType, colorArgType } from '../../../__storybook__';
|
|
10
5
|
|
|
11
6
|
export default {
|
|
12
7
|
component: MCheckbox,
|
|
@@ -15,7 +10,7 @@ export default {
|
|
|
15
10
|
...sizeArgType(),
|
|
16
11
|
...colorArgType()
|
|
17
12
|
}
|
|
18
|
-
}
|
|
13
|
+
};
|
|
19
14
|
|
|
20
15
|
export const Basic = createStory(MCheckboxBasic);
|
|
21
16
|
export const Slot = createStory(MCheckboxSlot);
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
createVar,
|
|
3
|
+
globalStyle,
|
|
4
|
+
style,
|
|
5
|
+
styleVariants
|
|
6
|
+
} from '@vanilla-extract/css';
|
|
7
|
+
import { themeVars } from '../../../styles/theme.css';
|
|
3
8
|
|
|
4
9
|
const sizes = {
|
|
5
10
|
xs: '16px',
|
|
6
11
|
sm: '18px',
|
|
7
12
|
md: '20px',
|
|
8
13
|
lg: '22px',
|
|
9
|
-
xl: '24px'
|
|
14
|
+
xl: '24px'
|
|
10
15
|
};
|
|
11
16
|
|
|
12
17
|
export const vars = {
|
|
@@ -15,14 +20,14 @@ export const vars = {
|
|
|
15
20
|
backgroundColor: createVar(),
|
|
16
21
|
borderColor: createVar(),
|
|
17
22
|
color: createVar()
|
|
18
|
-
}
|
|
23
|
+
};
|
|
19
24
|
|
|
20
25
|
export const base = style({
|
|
21
|
-
position:
|
|
22
|
-
display:
|
|
23
|
-
alignItems:
|
|
24
|
-
cursor:
|
|
25
|
-
gap: themeVars.space['1.5']
|
|
26
|
+
position: 'relative',
|
|
27
|
+
display: 'inline-flex',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
cursor: 'pointer',
|
|
30
|
+
gap: themeVars.space['1.5']
|
|
26
31
|
});
|
|
27
32
|
|
|
28
33
|
export const checkbox = style({
|
|
@@ -33,7 +38,7 @@ export const checkbox = style({
|
|
|
33
38
|
[vars.borderColor]: themeVars.color.gray[300],
|
|
34
39
|
[vars.color]: 'white'
|
|
35
40
|
},
|
|
36
|
-
position:
|
|
41
|
+
position: 'relative',
|
|
37
42
|
width: vars.height,
|
|
38
43
|
height: vars.height,
|
|
39
44
|
borderRadius: vars.radius,
|
|
@@ -49,13 +54,13 @@ export const checkbox = style({
|
|
|
49
54
|
flexShrink: 0,
|
|
50
55
|
userSelect: 'none',
|
|
51
56
|
outline: 'none',
|
|
52
|
-
|
|
57
|
+
|
|
53
58
|
selectors: {
|
|
54
59
|
['&:focus']: {
|
|
55
60
|
vars: {
|
|
56
|
-
[vars.borderColor]: themeVars.color.blue[500]
|
|
61
|
+
[vars.borderColor]: themeVars.color.blue[500]
|
|
57
62
|
},
|
|
58
|
-
boxShadow: `0 0 0 2px ${themeVars.color.blue[200]}
|
|
63
|
+
boxShadow: `0 0 0 2px ${themeVars.color.blue[200]}`
|
|
59
64
|
},
|
|
60
65
|
['&:checked']: {
|
|
61
66
|
backgroundColor: 'currentcolor',
|
|
@@ -67,7 +72,7 @@ export const checkbox = style({
|
|
|
67
72
|
backgroundImage: `url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 16 16'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E")`
|
|
68
73
|
},
|
|
69
74
|
['&:checked:focus']: {
|
|
70
|
-
color: themeVars.color.blue[500]
|
|
75
|
+
color: themeVars.color.blue[500]
|
|
71
76
|
},
|
|
72
77
|
['&:indeterminate']: {
|
|
73
78
|
backgroundColor: 'currentcolor',
|
|
@@ -80,33 +85,32 @@ export const checkbox = style({
|
|
|
80
85
|
},
|
|
81
86
|
['&:hover']: {
|
|
82
87
|
vars: {
|
|
83
|
-
[vars.borderColor]: themeVars.color.gray[400]
|
|
88
|
+
[vars.borderColor]: themeVars.color.gray[400]
|
|
84
89
|
}
|
|
85
90
|
}
|
|
86
91
|
}
|
|
87
92
|
});
|
|
88
93
|
|
|
89
|
-
|
|
90
94
|
export const disabled = style({
|
|
91
95
|
opacity: 0.5,
|
|
92
|
-
cursor: 'not-allowed'
|
|
96
|
+
cursor: 'not-allowed'
|
|
93
97
|
});
|
|
94
98
|
|
|
95
99
|
export const indeterminate = style({
|
|
96
100
|
vars: {
|
|
97
101
|
[vars.borderColor]: themeVars.color.blue[500],
|
|
98
|
-
[vars.backgroundColor]: themeVars.color.blue[500]
|
|
102
|
+
[vars.backgroundColor]: themeVars.color.blue[500]
|
|
99
103
|
}
|
|
100
104
|
});
|
|
101
105
|
|
|
102
106
|
export const label = style({
|
|
103
107
|
marginLeft: themeVars.space['0.5'],
|
|
104
|
-
fontWeight:
|
|
108
|
+
fontWeight: '500',
|
|
105
109
|
display: 'inline-block',
|
|
106
110
|
fontSize: themeVars.fontSize.base,
|
|
107
111
|
wordBreak: 'break-word',
|
|
108
|
-
cursor: 'pointer'
|
|
109
|
-
})
|
|
112
|
+
cursor: 'pointer'
|
|
113
|
+
});
|
|
110
114
|
|
|
111
115
|
export const size = styleVariants({
|
|
112
116
|
xs: {
|
|
@@ -122,16 +126,16 @@ export const size = styleVariants({
|
|
|
122
126
|
md: {
|
|
123
127
|
vars: {
|
|
124
128
|
[vars.height]: sizes.md
|
|
125
|
-
}
|
|
129
|
+
}
|
|
126
130
|
},
|
|
127
131
|
lg: {
|
|
128
132
|
vars: {
|
|
129
|
-
[vars.height]: sizes.lg
|
|
130
|
-
}
|
|
133
|
+
[vars.height]: sizes.lg
|
|
134
|
+
}
|
|
131
135
|
},
|
|
132
136
|
xl: {
|
|
133
137
|
vars: {
|
|
134
|
-
[vars.height]: sizes.xl
|
|
135
|
-
}
|
|
136
|
-
}
|
|
138
|
+
[vars.height]: sizes.xl
|
|
139
|
+
}
|
|
140
|
+
}
|
|
137
141
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './Checkbox.css'
|
|
1
|
+
export * from './Checkbox.css';
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import MColorPicker from
|
|
2
|
-
import {
|
|
3
|
-
MColorBasic,
|
|
4
|
-
} from "./index";
|
|
1
|
+
import MColorPicker from '../ColorPicker.vue';
|
|
2
|
+
import { MColorBasic } from './index';
|
|
5
3
|
|
|
6
|
-
import {
|
|
7
|
-
createStory
|
|
8
|
-
} from "../../../__storybook__";
|
|
4
|
+
import { createStory } from '../../../__storybook__';
|
|
9
5
|
|
|
10
6
|
export default {
|
|
11
7
|
component: MColorPicker,
|
|
12
8
|
title: 'Components/Color Picker',
|
|
13
|
-
argTypes: {
|
|
14
|
-
|
|
15
|
-
}
|
|
9
|
+
argTypes: {}
|
|
10
|
+
};
|
|
16
11
|
|
|
17
12
|
export const Basic = createStory(MColorBasic);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as MColorBasic } from './basic.vue';
|
|
1
|
+
export { default as MColorBasic } from './basic.vue';
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
createVar,
|
|
3
|
+
globalKeyframes,
|
|
4
|
+
globalStyle,
|
|
5
|
+
style,
|
|
6
|
+
styleVariants
|
|
7
|
+
} from '@vanilla-extract/css';
|
|
8
|
+
import { themeVars } from '../../../styles/theme.css';
|
|
3
9
|
|
|
4
10
|
export const container = style({
|
|
5
|
-
display:
|
|
6
|
-
flexDirection:
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'column',
|
|
7
13
|
width: '280px',
|
|
8
14
|
alignItems: 'center',
|
|
9
15
|
gap: '10px',
|
|
10
16
|
userSelect: 'none',
|
|
11
17
|
zIndex: 100,
|
|
12
18
|
backgroundColor: '#FFF',
|
|
13
|
-
borderRadius:
|
|
19
|
+
borderRadius: '5px',
|
|
14
20
|
padding: themeVars.space[3],
|
|
15
21
|
border: `1px solid ${themeVars.color.gray[200]}`,
|
|
16
22
|
boxShadow: themeVars.shadow.md
|
|
@@ -25,12 +31,12 @@ export const sliderThumb = style({
|
|
|
25
31
|
border: '2px solid white',
|
|
26
32
|
boxShadow: themeVars.shadow.sm,
|
|
27
33
|
cursor: 'crosshair',
|
|
28
|
-
userSelect: 'none'
|
|
34
|
+
userSelect: 'none'
|
|
29
35
|
});
|
|
30
36
|
|
|
31
37
|
export const eyeDrop = style({
|
|
32
|
-
backgroundColor:
|
|
33
|
-
outline:
|
|
38
|
+
backgroundColor: 'transparent',
|
|
39
|
+
outline: 'none',
|
|
34
40
|
border: 0,
|
|
35
41
|
color: themeVars.color.gray[600],
|
|
36
42
|
width: '32px',
|
|
@@ -47,10 +53,11 @@ export const eyeDrop = style({
|
|
|
47
53
|
color: themeVars.color.gray[700]
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
|
-
})
|
|
56
|
+
});
|
|
51
57
|
|
|
52
58
|
export const preview = style({
|
|
53
|
-
backgroundImage:
|
|
59
|
+
backgroundImage:
|
|
60
|
+
'linear-gradient(45deg, #bebebe 25%, transparent 25%), linear-gradient(-45deg, #bebebe 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #bebebe 75%), linear-gradient(-45deg, transparent 75%, #bebebe 75%)',
|
|
54
61
|
backgroundSize: '12px 12px',
|
|
55
62
|
backgroundPosition: '0 0, 0 6px, 6px -6px, -6px 0px',
|
|
56
63
|
overflow: 'hidden',
|
|
@@ -70,7 +77,8 @@ export const colours = style({
|
|
|
70
77
|
});
|
|
71
78
|
|
|
72
79
|
export const reference = style({
|
|
73
|
-
backgroundImage:
|
|
80
|
+
backgroundImage:
|
|
81
|
+
'linear-gradient(45deg, #bebebe 25%, transparent 25%), linear-gradient(-45deg, #bebebe 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #bebebe 75%), linear-gradient(-45deg, transparent 75%, #bebebe 75%)',
|
|
74
82
|
backgroundSize: '12px 12px',
|
|
75
83
|
backgroundPosition: '0 0, 0 6px, 6px -6px, -6px 0px',
|
|
76
84
|
overflow: 'hidden',
|
|
@@ -79,9 +87,9 @@ export const reference = style({
|
|
|
79
87
|
width: '28px',
|
|
80
88
|
height: '28px',
|
|
81
89
|
borderRadius: themeVars.rounded.default,
|
|
82
|
-
position:
|
|
83
|
-
cursor:
|
|
84
|
-
userSelect:
|
|
90
|
+
position: 'relative',
|
|
91
|
+
cursor: 'pointer',
|
|
92
|
+
userSelect: 'none'
|
|
85
93
|
});
|
|
86
94
|
|
|
87
95
|
export const referenceColor = style({
|
|
@@ -11,17 +11,30 @@ export interface HSV {
|
|
|
11
11
|
v: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export const RGBAToHex = (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
export const RGBAToHex = (
|
|
15
|
+
r: number,
|
|
16
|
+
g: number,
|
|
17
|
+
b: number,
|
|
18
|
+
a: number
|
|
19
|
+
): string => {
|
|
20
|
+
const hexR: string = r.toString(16).padStart(2, '0');
|
|
21
|
+
const hexG: string = g.toString(16).padStart(2, '0');
|
|
22
|
+
const hexB: string = b.toString(16).padStart(2, '0');
|
|
23
|
+
const hexA: string = Math.round(a * 255)
|
|
24
|
+
.toString(16)
|
|
25
|
+
.padStart(2, '0');
|
|
19
26
|
|
|
20
27
|
return `#${hexR}${hexG}${hexB}${a >= 1 ? '' : hexA}`;
|
|
21
28
|
};
|
|
22
29
|
|
|
23
|
-
export const hexToRGB = (
|
|
24
|
-
hexColor
|
|
30
|
+
export const hexToRGB = (
|
|
31
|
+
hexColor: string,
|
|
32
|
+
defaultR = 0,
|
|
33
|
+
defaultG = 0,
|
|
34
|
+
defaultB = 0,
|
|
35
|
+
defaultA = 0
|
|
36
|
+
): Color => {
|
|
37
|
+
hexColor = hexColor.replace('#', '');
|
|
25
38
|
|
|
26
39
|
let r = defaultR;
|
|
27
40
|
let g = defaultG;
|
|
@@ -58,25 +71,25 @@ export const hexToRGB = (hexColor: string, defaultR: number = 0, defaultG: numbe
|
|
|
58
71
|
}
|
|
59
72
|
|
|
60
73
|
return {
|
|
61
|
-
r
|
|
62
|
-
g
|
|
63
|
-
b
|
|
64
|
-
a
|
|
74
|
+
r,
|
|
75
|
+
g,
|
|
76
|
+
b,
|
|
77
|
+
a
|
|
65
78
|
};
|
|
66
79
|
};
|
|
67
80
|
|
|
68
81
|
export const RGBToHSV = (r: number, g: number, b: number): HSV => {
|
|
69
|
-
|
|
70
|
-
|
|
82
|
+
const max = Math.max(r, g, b);
|
|
83
|
+
const min = Math.min(r, g, b);
|
|
71
84
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
const delta = max - min;
|
|
86
|
+
const brightness = max;
|
|
87
|
+
let saturation = 0;
|
|
75
88
|
if (max !== 0) {
|
|
76
89
|
saturation = delta / max;
|
|
77
90
|
}
|
|
78
91
|
|
|
79
|
-
|
|
92
|
+
let hue = 0;
|
|
80
93
|
if (delta !== 0) {
|
|
81
94
|
if (max === r) {
|
|
82
95
|
hue = ((g - b) / delta) % 6;
|
|
@@ -96,14 +109,19 @@ export const RGBToHSV = (r: number, g: number, b: number): HSV => {
|
|
|
96
109
|
h: hue,
|
|
97
110
|
s: saturation,
|
|
98
111
|
v: brightness / 255
|
|
99
|
-
}
|
|
100
|
-
}
|
|
112
|
+
};
|
|
113
|
+
};
|
|
101
114
|
|
|
102
|
-
export const HSVToRGBA = (
|
|
115
|
+
export const HSVToRGBA = (
|
|
116
|
+
hue: number,
|
|
117
|
+
brightness: number,
|
|
118
|
+
saturation: number,
|
|
119
|
+
alpha: number
|
|
120
|
+
): Color => {
|
|
103
121
|
const hueInDegrees = hue;
|
|
104
122
|
const chroma = brightness * saturation;
|
|
105
123
|
const hue1 = hueInDegrees / 60;
|
|
106
|
-
const x = chroma * (1 - Math.abs(hue1 % 2 - 1));
|
|
124
|
+
const x = chroma * (1 - Math.abs((hue1 % 2) - 1));
|
|
107
125
|
let r1 = 0;
|
|
108
126
|
let g1 = 0;
|
|
109
127
|
let b1 = 0;
|
|
@@ -132,15 +150,15 @@ export const HSVToRGBA = (hue: number, brightness: number, saturation: number, a
|
|
|
132
150
|
const b = Math.round((b1 + m) * 255);
|
|
133
151
|
|
|
134
152
|
return {
|
|
135
|
-
r
|
|
136
|
-
g
|
|
137
|
-
b
|
|
153
|
+
r,
|
|
154
|
+
g,
|
|
155
|
+
b,
|
|
138
156
|
a: alpha
|
|
139
157
|
};
|
|
140
|
-
}
|
|
158
|
+
};
|
|
141
159
|
|
|
142
160
|
export const HueToRGBA = (hue: number, alpha: number): Color => {
|
|
143
|
-
const chroma =
|
|
161
|
+
const chroma = 1 - Math.abs(2 * 0.5 - 1);
|
|
144
162
|
const huePrime = (hue / 360) * 6;
|
|
145
163
|
const intermediateValue = chroma * (1 - Math.abs((huePrime % 2) - 1));
|
|
146
164
|
let red = 0;
|
|
@@ -183,6 +201,6 @@ export const HueToRGBA = (hue: number, alpha: number): Color => {
|
|
|
183
201
|
r: finalRed,
|
|
184
202
|
g: finalGreen,
|
|
185
203
|
b: finalBlue,
|
|
186
|
-
a: alpha
|
|
204
|
+
a: alpha
|
|
187
205
|
};
|
|
188
|
-
}
|
|
206
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import MConfirmProvider from
|
|
2
|
-
import {
|
|
3
|
-
MConfirmProviderBasic,
|
|
4
|
-
} from "./index";
|
|
1
|
+
import MConfirmProvider from '../ConfirmProvider.vue';
|
|
2
|
+
import { MConfirmProviderBasic } from './index';
|
|
5
3
|
|
|
6
4
|
const Template = (args: any) => ({
|
|
7
5
|
components: {
|
|
@@ -9,9 +7,8 @@ const Template = (args: any) => ({
|
|
|
9
7
|
MConfirmProviderBasic
|
|
10
8
|
},
|
|
11
9
|
setup() {
|
|
12
|
-
|
|
13
10
|
return {
|
|
14
|
-
args
|
|
11
|
+
args
|
|
15
12
|
};
|
|
16
13
|
},
|
|
17
14
|
template: `
|
|
@@ -19,11 +16,11 @@ const Template = (args: any) => ({
|
|
|
19
16
|
<MConfirmProviderBasic />
|
|
20
17
|
</m-confirm-provider>
|
|
21
18
|
`
|
|
22
|
-
})
|
|
19
|
+
});
|
|
23
20
|
|
|
24
21
|
export default {
|
|
25
22
|
component: MConfirmProvider,
|
|
26
23
|
title: 'Components/Confirm'
|
|
27
|
-
}
|
|
24
|
+
};
|
|
28
25
|
|
|
29
26
|
export const Primary = Template.bind({});
|
|
@@ -18,7 +18,7 @@ export const confirmProps = {
|
|
|
18
18
|
okVariant: {
|
|
19
19
|
type: String as PropType<Variant>,
|
|
20
20
|
default: 'primary'
|
|
21
|
-
}
|
|
21
|
+
}
|
|
22
22
|
} as const;
|
|
23
23
|
|
|
24
|
-
export type ConfirmProps = ExtractPropTypes<typeof confirmProps
|
|
24
|
+
export type ConfirmProps = ExtractPropTypes<typeof confirmProps>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
export const providerProps = {
|
|
5
4
|
teleportTo: {
|
|
6
5
|
type: String,
|
|
@@ -8,4 +7,4 @@ export const providerProps = {
|
|
|
8
7
|
}
|
|
9
8
|
};
|
|
10
9
|
|
|
11
|
-
export type ProviderProps = ExtractPropTypes<typeof providerProps
|
|
10
|
+
export type ProviderProps = ExtractPropTypes<typeof providerProps>;
|
|
@@ -6,29 +6,28 @@ export type ConfirmContentType = string;
|
|
|
6
6
|
export type ConfirmContentRender = (props: any) => VNodeChild;
|
|
7
7
|
|
|
8
8
|
export interface ConfirmOptions {
|
|
9
|
-
title?: string
|
|
10
|
-
render?: ConfirmContentRender
|
|
11
|
-
content: ConfirmContentType
|
|
12
|
-
onClose?: () => void
|
|
13
|
-
onOpen?: () => void
|
|
14
|
-
onOk?: () => void
|
|
15
|
-
onCancel?: () => void
|
|
16
|
-
okVariant?: Variant
|
|
17
|
-
okText?: ConfirmContentType
|
|
18
|
-
cancelText?: ConfirmContentType
|
|
9
|
+
title?: string;
|
|
10
|
+
render?: ConfirmContentRender;
|
|
11
|
+
content: ConfirmContentType;
|
|
12
|
+
onClose?: () => void;
|
|
13
|
+
onOpen?: () => void;
|
|
14
|
+
onOk?: () => void;
|
|
15
|
+
onCancel?: () => void;
|
|
16
|
+
okVariant?: Variant;
|
|
17
|
+
okText?: ConfirmContentType;
|
|
18
|
+
cancelText?: ConfirmContentType;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface ConfirmResponse {
|
|
22
|
-
result: boolean
|
|
23
|
-
data: any
|
|
22
|
+
result: boolean;
|
|
23
|
+
data: any;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export interface ConfirmApiInjection {
|
|
27
|
-
create: (options: ConfirmOptions) => Confirm
|
|
28
|
-
destroyAll: () => void
|
|
27
|
+
create: (options: ConfirmOptions) => Confirm;
|
|
28
|
+
destroyAll: () => void;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
32
31
|
export interface Confirm extends ConfirmOptions {
|
|
33
|
-
destroy: () => void
|
|
32
|
+
destroy: () => void;
|
|
34
33
|
}
|
|
@@ -5,7 +5,9 @@ export function useConfirm(): ConfirmApiInjection {
|
|
|
5
5
|
const api = inject('m-confirm', null);
|
|
6
6
|
|
|
7
7
|
if (api === null) {
|
|
8
|
-
throw new Error(
|
|
8
|
+
throw new Error(
|
|
9
|
+
'm-confirm api is not provided, ensure the component is wrapped in <m-confirm-provider />.'
|
|
10
|
+
);
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
return api;
|