@teammodlr/ui-kit 2.1.7 → 2.1.9
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/radiobuttongroup/symbol.d.ts +2 -2
- package/lib/components/tooltip/Tooltip.vue.d.ts +1 -1
- package/lib/components/tree/TreeNode.vue.d.ts +2 -0
- package/lib/components/tree/TreeNodeToggle.vue.d.ts +7 -1
- package/lib/components/tree/props.d.ts +4 -4
- package/lib/components/tree/style/Tree.css.d.ts +7 -0
- package/lib/components/tree/style/index.d.ts +1 -0
- package/lib/components/tree/types.d.ts +11 -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 +2522 -2490
- 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/examples/index.stories.ts +5 -10
- package/src/components/modal/style/Modal.css.ts +76 -73
- 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/Tree.vue +110 -109
- package/src/components/tree/TreeNode.vue +29 -23
- package/src/components/tree/TreeNodeToggle.vue +37 -25
- package/src/components/tree/examples/basic.vue +1 -1
- 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 +75 -0
- package/src/components/tree/style/index.ts +1 -0
- package/src/components/tree/types.ts +60 -61
- 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,12 +1,12 @@
|
|
|
1
|
-
import {createVar, style, styleVariants} from
|
|
2
|
-
import {themeVars} from
|
|
1
|
+
import { createVar, style, styleVariants } from '@vanilla-extract/css';
|
|
2
|
+
import { themeVars } from '../../../styles/theme.css';
|
|
3
3
|
|
|
4
4
|
const sizes = {
|
|
5
5
|
xs: '26px',
|
|
6
6
|
sm: '30px',
|
|
7
7
|
md: '38px',
|
|
8
8
|
lg: '42px',
|
|
9
|
-
xl: '48px'
|
|
9
|
+
xl: '48px'
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
const borderRadiuses = {
|
|
@@ -14,7 +14,7 @@ const borderRadiuses = {
|
|
|
14
14
|
sm: '3px',
|
|
15
15
|
md: '4px',
|
|
16
16
|
lg: '6px',
|
|
17
|
-
xl: '8px'
|
|
17
|
+
xl: '8px'
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export const vars = {
|
|
@@ -25,8 +25,8 @@ export const vars = {
|
|
|
25
25
|
borderColor: createVar(),
|
|
26
26
|
backgroundColor: createVar(),
|
|
27
27
|
color: createVar(),
|
|
28
|
-
cursor: createVar()
|
|
29
|
-
}
|
|
28
|
+
cursor: createVar()
|
|
29
|
+
};
|
|
30
30
|
|
|
31
31
|
export const wrapper = style({
|
|
32
32
|
position: 'relative'
|
|
@@ -41,7 +41,7 @@ export const base = style({
|
|
|
41
41
|
[vars.borderColor]: themeVars.color.gray[300],
|
|
42
42
|
[vars.color]: themeVars.color.font.text,
|
|
43
43
|
[vars.backgroundColor]: '#FFFFFF',
|
|
44
|
-
[vars.cursor]: 'text'
|
|
44
|
+
[vars.cursor]: 'text'
|
|
45
45
|
},
|
|
46
46
|
height: vars.height,
|
|
47
47
|
minHeight: vars.height,
|
|
@@ -67,15 +67,15 @@ export const base = style({
|
|
|
67
67
|
border-color .3s ${themeVars.transition.default}`,
|
|
68
68
|
':hover': {
|
|
69
69
|
vars: {
|
|
70
|
-
[vars.borderColor]: themeVars.color.blue[400]
|
|
70
|
+
[vars.borderColor]: themeVars.color.blue[400]
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
':focus-within': {
|
|
74
74
|
vars: {
|
|
75
|
-
[vars.borderColor]: themeVars.color.blue[500]
|
|
75
|
+
[vars.borderColor]: themeVars.color.blue[500]
|
|
76
76
|
},
|
|
77
77
|
outline: 'none',
|
|
78
|
-
boxShadow: `0 0 0 2px ${themeVars.color.blue[200]}
|
|
78
|
+
boxShadow: `0 0 0 2px ${themeVars.color.blue[200]}`
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
|
|
@@ -105,44 +105,44 @@ export const size = styleVariants({
|
|
|
105
105
|
vars: {
|
|
106
106
|
[vars.height]: sizes.xs,
|
|
107
107
|
[vars.radius]: borderRadiuses.xs,
|
|
108
|
-
[vars.paddingX]: themeVars.space[1]
|
|
108
|
+
[vars.paddingX]: themeVars.space[1]
|
|
109
109
|
},
|
|
110
|
-
fontSize: themeVars.fontSize.small
|
|
110
|
+
fontSize: themeVars.fontSize.small
|
|
111
111
|
},
|
|
112
112
|
sm: {
|
|
113
113
|
vars: {
|
|
114
114
|
[vars.height]: sizes.sm,
|
|
115
115
|
[vars.radius]: borderRadiuses.sm,
|
|
116
|
-
[vars.paddingX]: themeVars.space[1.5]
|
|
116
|
+
[vars.paddingX]: themeVars.space[1.5]
|
|
117
117
|
},
|
|
118
|
-
fontSize: themeVars.fontSize.small
|
|
118
|
+
fontSize: themeVars.fontSize.small
|
|
119
119
|
},
|
|
120
120
|
md: {
|
|
121
121
|
vars: {
|
|
122
122
|
[vars.height]: sizes.md,
|
|
123
123
|
[vars.radius]: borderRadiuses.md
|
|
124
|
-
}
|
|
124
|
+
}
|
|
125
125
|
},
|
|
126
126
|
lg: {
|
|
127
127
|
vars: {
|
|
128
128
|
[vars.height]: sizes.lg,
|
|
129
129
|
[vars.radius]: borderRadiuses.lg,
|
|
130
|
-
[vars.paddingX]: themeVars.space[2.5]
|
|
130
|
+
[vars.paddingX]: themeVars.space[2.5]
|
|
131
131
|
},
|
|
132
|
-
fontSize: themeVars.fontSize.large
|
|
132
|
+
fontSize: themeVars.fontSize.large
|
|
133
133
|
},
|
|
134
134
|
xl: {
|
|
135
135
|
vars: {
|
|
136
136
|
[vars.height]: sizes.xl,
|
|
137
137
|
[vars.radius]: borderRadiuses.xl,
|
|
138
|
-
[vars.paddingX]: themeVars.space[3]
|
|
138
|
+
[vars.paddingX]: themeVars.space[3]
|
|
139
139
|
},
|
|
140
|
-
fontSize: themeVars.fontSize.large
|
|
141
|
-
}
|
|
140
|
+
fontSize: themeVars.fontSize.large
|
|
141
|
+
}
|
|
142
142
|
});
|
|
143
143
|
|
|
144
144
|
export const block = style({
|
|
145
|
-
width: '100%'
|
|
145
|
+
width: '100%'
|
|
146
146
|
});
|
|
147
147
|
|
|
148
148
|
export const disabled = style({
|
|
@@ -150,18 +150,18 @@ export const disabled = style({
|
|
|
150
150
|
[vars.borderColor]: themeVars.color.gray[200],
|
|
151
151
|
[vars.color]: themeVars.color.gray[500],
|
|
152
152
|
[vars.backgroundColor]: themeVars.color.gray[50],
|
|
153
|
-
[vars.cursor]: 'not-allowed'
|
|
153
|
+
[vars.cursor]: 'not-allowed'
|
|
154
154
|
},
|
|
155
155
|
':focus': {
|
|
156
|
-
boxShadow: 'none'
|
|
156
|
+
boxShadow: 'none'
|
|
157
157
|
},
|
|
158
158
|
':hover': {
|
|
159
|
-
cursor: 'not-allowed'
|
|
159
|
+
cursor: 'not-allowed'
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
162
|
|
|
163
163
|
export const label = style({
|
|
164
|
-
fontWeight:
|
|
164
|
+
fontWeight: '500',
|
|
165
165
|
display: 'inline-block',
|
|
166
166
|
fontSize: themeVars.fontSize.base,
|
|
167
167
|
wordBreak: 'break-word',
|
|
@@ -177,7 +177,7 @@ export const description = style({
|
|
|
177
177
|
color: themeVars.color.gray[600],
|
|
178
178
|
lineHeight: themeVars.fontSize.large,
|
|
179
179
|
wordBreak: 'break-word',
|
|
180
|
-
marginBottom: themeVars.space[1.5]
|
|
180
|
+
marginBottom: themeVars.space[1.5]
|
|
181
181
|
});
|
|
182
182
|
|
|
183
183
|
export const errorMessage = style({
|
|
@@ -186,7 +186,7 @@ export const errorMessage = style({
|
|
|
186
186
|
fontSize: themeVars.fontSize.base,
|
|
187
187
|
color: themeVars.color.red[600],
|
|
188
188
|
wordBreak: 'break-word',
|
|
189
|
-
marginTop: themeVars.space[1.5]
|
|
189
|
+
marginTop: themeVars.space[1.5]
|
|
190
190
|
});
|
|
191
191
|
|
|
192
192
|
export const helpMessage = style({
|
|
@@ -195,24 +195,24 @@ export const helpMessage = style({
|
|
|
195
195
|
fontSize: themeVars.fontSize.base,
|
|
196
196
|
color: themeVars.color.gray[600],
|
|
197
197
|
wordBreak: 'break-word',
|
|
198
|
-
marginTop: themeVars.space[1.5]
|
|
198
|
+
marginTop: themeVars.space[1.5]
|
|
199
199
|
});
|
|
200
200
|
|
|
201
201
|
export const error = style({
|
|
202
202
|
vars: {
|
|
203
|
-
[vars.borderColor]: themeVars.color.red[500]
|
|
203
|
+
[vars.borderColor]: themeVars.color.red[500]
|
|
204
204
|
},
|
|
205
205
|
':hover': {
|
|
206
206
|
vars: {
|
|
207
|
-
[vars.borderColor]: themeVars.color.red[500]
|
|
207
|
+
[vars.borderColor]: themeVars.color.red[500]
|
|
208
208
|
}
|
|
209
209
|
},
|
|
210
210
|
':focus-within': {
|
|
211
211
|
boxShadow: `0 0 0 2px ${themeVars.color.red[200]}`,
|
|
212
212
|
vars: {
|
|
213
|
-
[vars.borderColor]: themeVars.color.red[500]
|
|
213
|
+
[vars.borderColor]: themeVars.color.red[500]
|
|
214
214
|
}
|
|
215
|
-
}
|
|
215
|
+
}
|
|
216
216
|
});
|
|
217
217
|
|
|
218
218
|
export const leftIcon = style({
|
|
@@ -225,12 +225,12 @@ export const leftIcon = style({
|
|
|
225
225
|
display: 'flex',
|
|
226
226
|
alignItems: 'center',
|
|
227
227
|
justifyContent: 'center',
|
|
228
|
-
width:
|
|
229
|
-
color: themeVars.color.gray[400]
|
|
228
|
+
width: '2.25rem',
|
|
229
|
+
color: themeVars.color.gray[400]
|
|
230
230
|
});
|
|
231
231
|
|
|
232
232
|
export const hasLeftIcon = style({
|
|
233
|
-
paddingLeft:
|
|
233
|
+
paddingLeft: '2.25rem'
|
|
234
234
|
});
|
|
235
235
|
|
|
236
236
|
export const rightIcon = style({
|
|
@@ -243,17 +243,14 @@ export const rightIcon = style({
|
|
|
243
243
|
display: 'flex',
|
|
244
244
|
alignItems: 'center',
|
|
245
245
|
justifyContent: 'center',
|
|
246
|
-
width:
|
|
247
|
-
color: themeVars.color.gray[400]
|
|
246
|
+
width: '2.25rem',
|
|
247
|
+
color: themeVars.color.gray[400]
|
|
248
248
|
});
|
|
249
249
|
|
|
250
250
|
export const hasRightIcon = style({
|
|
251
|
-
paddingRight:
|
|
251
|
+
paddingRight: '2.25rem'
|
|
252
252
|
});
|
|
253
253
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
254
|
export const prefix = style({
|
|
258
255
|
pointerEvents: 'none',
|
|
259
256
|
marginRight: themeVars.space[3],
|
|
@@ -270,7 +267,7 @@ export const prefix = style({
|
|
|
270
267
|
transform: 'translateY(-50%)',
|
|
271
268
|
width: '1px',
|
|
272
269
|
height: '16px',
|
|
273
|
-
backgroundColor: themeVars.color.gray[300]
|
|
270
|
+
backgroundColor: themeVars.color.gray[300]
|
|
274
271
|
}
|
|
275
272
|
});
|
|
276
273
|
|
|
@@ -290,6 +287,6 @@ export const suffix = style({
|
|
|
290
287
|
transform: 'translateY(-50%)',
|
|
291
288
|
width: '1px',
|
|
292
289
|
height: '16px',
|
|
293
|
-
backgroundColor: themeVars.color.gray[300]
|
|
290
|
+
backgroundColor: themeVars.color.gray[300]
|
|
294
291
|
}
|
|
295
292
|
});
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import MLink from
|
|
1
|
+
import MLink from '../Link.vue';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
MLinkBasic
|
|
5
|
-
} from "./index";
|
|
3
|
+
import { MLinkBasic } from './index';
|
|
6
4
|
|
|
7
|
-
import {
|
|
8
|
-
createStory,
|
|
9
|
-
colorArgType
|
|
10
|
-
} from "../../../__storybook__";
|
|
5
|
+
import { createStory, colorArgType } from '../../../__storybook__';
|
|
11
6
|
|
|
12
7
|
export default {
|
|
13
8
|
component: MLink,
|
|
@@ -15,6 +10,6 @@ export default {
|
|
|
15
10
|
argTypes: {
|
|
16
11
|
...colorArgType()
|
|
17
12
|
}
|
|
18
|
-
}
|
|
13
|
+
};
|
|
19
14
|
|
|
20
15
|
export const Basic = createStory(MLinkBasic);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import MMessageProvider from
|
|
2
|
-
import {
|
|
3
|
-
MMessageProviderBasic,
|
|
4
|
-
} from "./index";
|
|
1
|
+
import MMessageProvider from '../MessageProvider.vue';
|
|
2
|
+
import { MMessageProviderBasic } from './index';
|
|
5
3
|
|
|
6
4
|
const Template = (args: any) => ({
|
|
7
5
|
components: {
|
|
@@ -9,9 +7,8 @@ const Template = (args: any) => ({
|
|
|
9
7
|
MMessageProviderBasic
|
|
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
|
<MMessageProviderBasic />
|
|
20
17
|
</m-message-provider>
|
|
21
18
|
`
|
|
22
|
-
})
|
|
19
|
+
});
|
|
23
20
|
|
|
24
21
|
export default {
|
|
25
22
|
component: MMessageProvider,
|
|
26
23
|
title: 'Components/MessageProvider'
|
|
27
|
-
}
|
|
24
|
+
};
|
|
28
25
|
|
|
29
26
|
export const Primary = Template.bind({});
|
|
@@ -1,64 +1,65 @@
|
|
|
1
|
-
import { createVar, style, styleVariants } from
|
|
2
|
-
import { themeVars } from
|
|
1
|
+
import { createVar, style, styleVariants } from '@vanilla-extract/css';
|
|
2
|
+
import { themeVars } from '../../../styles/theme.css';
|
|
3
3
|
|
|
4
4
|
export const vars = {
|
|
5
5
|
top: createVar(),
|
|
6
6
|
left: createVar(),
|
|
7
7
|
right: createVar(),
|
|
8
|
-
iconColor: createVar()
|
|
9
|
-
}
|
|
8
|
+
iconColor: createVar()
|
|
9
|
+
};
|
|
10
10
|
|
|
11
11
|
export const wrapper = style({
|
|
12
|
-
position:
|
|
12
|
+
position: 'fixed',
|
|
13
13
|
zIndex: 5000,
|
|
14
14
|
height: 0,
|
|
15
|
-
display:
|
|
16
|
-
flexDirection:
|
|
17
|
-
alignItems:
|
|
15
|
+
display: 'flex',
|
|
16
|
+
flexDirection: 'column',
|
|
17
|
+
alignItems: 'center',
|
|
18
18
|
gap: themeVars.space['2.5'],
|
|
19
19
|
top: vars.top,
|
|
20
20
|
left: vars.left,
|
|
21
21
|
right: vars.right,
|
|
22
|
-
transformOrigin: 'top center'
|
|
22
|
+
transformOrigin: 'top center'
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
export const base = style({
|
|
26
|
-
position:
|
|
27
|
-
display:
|
|
26
|
+
position: 'relative',
|
|
27
|
+
display: 'flex',
|
|
28
28
|
gap: themeVars.space['2'],
|
|
29
|
-
background:
|
|
29
|
+
background: '#FFF',
|
|
30
30
|
boxShadow: themeVars.shadow.sm,
|
|
31
31
|
border: `1px solid ${themeVars.color.gray[300]}`,
|
|
32
|
-
borderRadius:
|
|
33
|
-
padding:
|
|
34
|
-
pointerEvents:
|
|
32
|
+
borderRadius: '6px',
|
|
33
|
+
padding: '9px 12px',
|
|
34
|
+
pointerEvents: 'all',
|
|
35
35
|
fontSize: themeVars.fontSize.base,
|
|
36
36
|
color: themeVars.color.font.text,
|
|
37
|
-
alignItems:
|
|
38
|
-
willChange:
|
|
39
|
-
transition:
|
|
40
|
-
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
willChange: 'top, bottom, width',
|
|
39
|
+
transition:
|
|
40
|
+
'top 0.3s ease-out 0.5s, bottom 0.3s ease-out 0.5s, width 0.3s ease-out 0.5s'
|
|
41
|
+
});
|
|
41
42
|
|
|
42
43
|
export const placement = styleVariants({
|
|
43
44
|
top: {
|
|
44
45
|
vars: {
|
|
45
46
|
[vars.top]: '12px',
|
|
46
47
|
[vars.left]: '0',
|
|
47
|
-
[vars.right]: '0'
|
|
48
|
+
[vars.right]: '0'
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
51
|
['top-left']: {
|
|
51
52
|
vars: {
|
|
52
53
|
[vars.top]: '12px',
|
|
53
54
|
[vars.left]: '12px',
|
|
54
|
-
[vars.right]: 'unset'
|
|
55
|
+
[vars.right]: 'unset'
|
|
55
56
|
}
|
|
56
57
|
},
|
|
57
58
|
['top-right']: {
|
|
58
59
|
vars: {
|
|
59
60
|
[vars.top]: '12px',
|
|
60
61
|
[vars.left]: 'unset',
|
|
61
|
-
[vars.right]: '12px'
|
|
62
|
+
[vars.right]: '12px'
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
});
|
|
@@ -68,44 +69,43 @@ export const icon = style({
|
|
|
68
69
|
gridArea: '1 / 1 / 3',
|
|
69
70
|
width: '22px',
|
|
70
71
|
height: '22px',
|
|
71
|
-
color: vars.iconColor
|
|
72
|
+
color: vars.iconColor
|
|
72
73
|
});
|
|
73
74
|
|
|
74
75
|
export const message = style({
|
|
75
76
|
alignSelf: 'center',
|
|
76
|
-
gridArea: '1 / 2 / 3'
|
|
77
|
+
gridArea: '1 / 2 / 3'
|
|
77
78
|
});
|
|
78
79
|
|
|
79
|
-
|
|
80
80
|
export const variant = styleVariants({
|
|
81
81
|
info: {
|
|
82
82
|
vars: {
|
|
83
|
-
[vars.iconColor]: themeVars.color.blue[500]
|
|
83
|
+
[vars.iconColor]: themeVars.color.blue[500]
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
success: {
|
|
87
87
|
vars: {
|
|
88
|
-
[vars.iconColor]: themeVars.color.green[500]
|
|
88
|
+
[vars.iconColor]: themeVars.color.green[500]
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
warning: {
|
|
92
92
|
vars: {
|
|
93
|
-
[vars.iconColor]: themeVars.color.amber[500]
|
|
93
|
+
[vars.iconColor]: themeVars.color.amber[500]
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
error: {
|
|
97
97
|
vars: {
|
|
98
|
-
[vars.iconColor]: themeVars.color.red[500]
|
|
98
|
+
[vars.iconColor]: themeVars.color.red[500]
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
101
|
default: {
|
|
102
102
|
vars: {
|
|
103
|
-
[vars.iconColor]: themeVars.color.gray[500]
|
|
103
|
+
[vars.iconColor]: themeVars.color.gray[500]
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
loading: {
|
|
107
107
|
vars: {
|
|
108
|
-
[vars.iconColor]: themeVars.color.gray[500]
|
|
108
|
+
[vars.iconColor]: themeVars.color.gray[500]
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './Message.css';
|
|
@@ -7,41 +7,50 @@ export type MessageType =
|
|
|
7
7
|
| 'warning'
|
|
8
8
|
| 'error'
|
|
9
9
|
| 'default'
|
|
10
|
-
| 'loading'
|
|
10
|
+
| 'loading';
|
|
11
11
|
|
|
12
|
-
export type MessagePlacement =
|
|
12
|
+
export type MessagePlacement =
|
|
13
13
|
| 'top'
|
|
14
14
|
| 'top-left'
|
|
15
15
|
| 'top-right'
|
|
16
16
|
| 'bottom'
|
|
17
17
|
| 'bottom-left'
|
|
18
|
-
| 'bottom-right'
|
|
18
|
+
| 'bottom-right';
|
|
19
19
|
|
|
20
|
-
export type MessageRenderMessage = (props: any) => VNodeChild
|
|
20
|
+
export type MessageRenderMessage = (props: any) => VNodeChild;
|
|
21
21
|
|
|
22
22
|
export interface MessageOptions {
|
|
23
|
-
type?: MessageType
|
|
24
|
-
render?: MessageRenderMessage
|
|
25
|
-
timeout?: number
|
|
26
|
-
closable?: boolean
|
|
27
|
-
onClose?: () => void
|
|
23
|
+
type?: MessageType;
|
|
24
|
+
render?: MessageRenderMessage;
|
|
25
|
+
timeout?: number;
|
|
26
|
+
closable?: boolean;
|
|
27
|
+
onClose?: () => void;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export interface MessageReactive {
|
|
31
|
-
content: ContentType
|
|
32
|
-
timeout?: number
|
|
33
|
-
closable?: boolean
|
|
34
|
-
type: MessageType
|
|
35
|
-
onClose?: () => void
|
|
36
|
-
destroy: () => void
|
|
31
|
+
content: ContentType;
|
|
32
|
+
timeout?: number;
|
|
33
|
+
closable?: boolean;
|
|
34
|
+
type: MessageType;
|
|
35
|
+
onClose?: () => void;
|
|
36
|
+
destroy: () => void;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export interface MessageApiInjection {
|
|
40
|
-
create: (content: ContentType, options?: MessageOptions) => MessageReactive
|
|
41
|
-
info: (content: ContentType, options?: MessageOptions) => MessageReactive
|
|
42
|
-
success: (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
create: (content: ContentType, options?: MessageOptions) => MessageReactive;
|
|
41
|
+
info: (content: ContentType, options?: MessageOptions) => MessageReactive;
|
|
42
|
+
success: (
|
|
43
|
+
content: ContentType,
|
|
44
|
+
options?: MessageOptions
|
|
45
|
+
) => MessageReactive;
|
|
46
|
+
warning: (
|
|
47
|
+
content: ContentType,
|
|
48
|
+
options?: MessageOptions
|
|
49
|
+
) => MessageReactive;
|
|
50
|
+
error: (content: ContentType, options?: MessageOptions) => MessageReactive;
|
|
51
|
+
loading: (
|
|
52
|
+
content: ContentType,
|
|
53
|
+
options?: MessageOptions
|
|
54
|
+
) => MessageReactive;
|
|
55
|
+
destroyAll: () => void;
|
|
47
56
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { inject } from 'vue'
|
|
2
|
-
import type { MessageApiInjection } from './types'
|
|
1
|
+
import { inject } from 'vue';
|
|
2
|
+
import type { MessageApiInjection } from './types';
|
|
3
3
|
|
|
4
4
|
export function useMessage(): MessageApiInjection {
|
|
5
5
|
const api = inject('m-message', null);
|
|
6
6
|
|
|
7
|
-
if(api === null) {
|
|
8
|
-
throw new Error(
|
|
7
|
+
if (api === null) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
'm-message api is not provided, ensure the component is wrapped in <m-message-provider />.'
|
|
10
|
+
);
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
return api;
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import MModal from
|
|
2
|
-
import {
|
|
3
|
-
MModalBasic,
|
|
4
|
-
MModalForm
|
|
5
|
-
} from "./index";
|
|
1
|
+
import MModal from '../Modal.vue';
|
|
2
|
+
import { MModalBasic, MModalForm } from './index';
|
|
6
3
|
|
|
7
|
-
import {
|
|
8
|
-
createStory, sizeArgType
|
|
9
|
-
} from "../../../__storybook__";
|
|
4
|
+
import { createStory, sizeArgType } from '../../../__storybook__';
|
|
10
5
|
|
|
11
6
|
export default {
|
|
12
7
|
component: MModal,
|
|
13
8
|
title: 'Components/Modal',
|
|
14
9
|
argTypes: {
|
|
15
|
-
...sizeArgType()
|
|
10
|
+
...sizeArgType()
|
|
16
11
|
}
|
|
17
|
-
}
|
|
12
|
+
};
|
|
18
13
|
|
|
19
14
|
export const Basic = createStory(MModalBasic);
|
|
20
15
|
export const ModalForm = createStory(MModalForm);
|