@teammodlr/ui-kit 1.0.4 → 1.0.5
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/package.json +2 -1
- package/src/__storybook__/argTypes.ts +42 -0
- package/src/__storybook__/createStory.ts +15 -0
- package/src/__storybook__/index.ts +2 -0
- package/src/components/avatar/Avatar.css +69 -0
- package/src/components/avatar/Avatar.vue +102 -0
- package/src/components/avatar/examples/basic.vue +6 -0
- package/src/components/avatar/examples/custom-size.vue +7 -0
- package/src/components/avatar/examples/index.stories.ts +28 -0
- package/src/components/avatar/examples/index.ts +5 -0
- package/src/components/avatar/examples/sizes.vue +33 -0
- package/src/components/avatar/examples/slots.vue +7 -0
- package/src/components/avatar/examples/variants.vue +18 -0
- package/src/components/avatargroup/AvatarGroup.css +8 -0
- package/src/components/avatargroup/AvatarGroup.vue +32 -0
- package/src/components/avatargroup/examples/basic.vue +11 -0
- package/src/components/avatargroup/examples/index.stories.ts +28 -0
- package/src/components/avatargroup/examples/index.ts +1 -0
- package/src/components/breadcrumb/Breadcrumb.css +46 -0
- package/src/components/breadcrumb/Breadcrumb.vue +51 -0
- package/src/components/breadcrumb/examples/basic.vue +9 -0
- package/src/components/breadcrumb/examples/index.stories.ts +20 -0
- package/src/components/breadcrumb/examples/index.ts +1 -0
- package/src/components/breadcrumbitem/BreadcrumbItem.vue +66 -0
- package/src/components/breadcrumbitem/index.ts +1 -0
- package/src/components/button/Button.css +378 -0
- package/src/components/button/Button.vue +108 -0
- package/src/components/button/examples/basic.vue +3 -0
- package/src/components/button/examples/colors-secondary.vue +8 -0
- package/src/components/button/examples/colors.vue +8 -0
- package/src/components/button/examples/disabled.vue +3 -0
- package/src/components/button/examples/icon.vue +10 -0
- package/src/components/button/examples/index.stories.ts +33 -0
- package/src/components/button/examples/index.ts +7 -0
- package/src/components/button/examples/rounded.vue +7 -0
- package/src/components/button/examples/size.vue +7 -0
- package/src/components/buttongroup/ButtonGroup.vue +47 -0
- package/src/components/buttongroup/examples/basic.vue +9 -0
- package/src/components/buttongroup/examples/index.stories.ts +21 -0
- package/src/components/buttongroup/examples/index.ts +1 -0
- package/src/components/checkbox/Checkbox.css +185 -0
- package/src/components/checkbox/Checkbox.vue +140 -0
- package/src/components/checkbox/examples/basic.vue +9 -0
- package/src/components/checkbox/examples/index.stories.ts +21 -0
- package/src/components/checkbox/examples/index.ts +3 -0
- package/src/components/checkbox/examples/slot.vue +11 -0
- package/src/components/dropdown/Dropdown.css +68 -0
- package/src/components/dropdown/Dropdown.vue +237 -0
- package/src/components/dropdown/DropdownItem.vue +118 -0
- package/src/components/dropdown/DropdownList.vue +20 -0
- package/src/components/dropdown/DropdownWrapper.vue +17 -0
- package/src/components/dropdown/examples/basic.vue +73 -0
- package/src/components/dropdown/examples/context.vue +71 -0
- package/src/components/dropdown/examples/index.stories.ts +23 -0
- package/src/components/dropdown/examples/index.ts +2 -0
- package/src/components/dropdown/hooks.ts +30 -0
- package/src/components/form/Form.vue +141 -0
- package/src/components/form/examples/basic.vue +73 -0
- package/src/components/form/examples/index.stories.ts +23 -0
- package/src/components/form/examples/index.ts +1 -0
- package/src/components/image/Image.vue +71 -0
- package/src/components/image/examples/basic.vue +5 -0
- package/src/components/image/examples/index.stories.ts +12 -0
- package/src/components/image/examples/index.ts +1 -0
- package/src/components/index.ts +27 -0
- package/src/components/input/Input.css +173 -0
- package/src/components/input/Input.vue +176 -0
- package/src/components/input/examples/basic.vue +7 -0
- package/src/components/input/examples/index.stories.ts +24 -0
- package/src/components/input/examples/index.ts +4 -0
- package/src/components/input/examples/prefix.vue +7 -0
- package/src/components/input/examples/sizes.vue +9 -0
- package/src/components/input/examples/suffix.vue +7 -0
- package/src/components/link/Link.css +147 -0
- package/src/components/link/Link.vue +54 -0
- package/src/components/link/examples/basic.vue +3 -0
- package/src/components/link/examples/index.stories.ts +20 -0
- package/src/components/link/examples/index.ts +1 -0
- package/src/components/messageprovider/Message.vue +76 -0
- package/src/components/messageprovider/MessageProvider.css +36 -0
- package/src/components/messageprovider/MessageProvider.vue +142 -0
- package/src/components/messageprovider/examples/basic.vue +19 -0
- package/src/components/messageprovider/examples/index.stories.ts +30 -0
- package/src/components/messageprovider/examples/index.ts +1 -0
- package/src/components/messageprovider/examples/wrapper.vue +9 -0
- package/src/components/messageprovider/types.ts +39 -0
- package/src/components/messageprovider/useMessage.ts +12 -0
- package/src/components/select/Select.css +226 -0
- package/src/components/select/Select.vue +474 -0
- package/src/components/select/examples/basic.vue +20 -0
- package/src/components/select/examples/index.stories.ts +22 -0
- package/src/components/select/examples/index.ts +3 -0
- package/src/components/select/examples/multiple.vue +22 -0
- package/src/components/select/examples/searchable.vue +20 -0
- package/src/components/skeleton/Skeleton.css +73 -0
- package/src/components/skeleton/Skeleton.vue +47 -0
- package/src/components/skeleton/examples/basic.vue +3 -0
- package/src/components/skeleton/examples/index.stories.ts +24 -0
- package/src/components/skeleton/examples/index.ts +2 -0
- package/src/components/skeleton/examples/post.vue +8 -0
- package/src/components/tab/Tab.css +113 -0
- package/src/components/tab/Tab.vue +98 -0
- package/src/components/tab/TabGroup.vue +90 -0
- package/src/components/tab/examples/basic.vue +19 -0
- package/src/components/tab/examples/index.stories.ts +25 -0
- package/src/components/tab/examples/index.ts +2 -0
- package/src/components/tab/examples/vertical.vue +19 -0
- package/src/components/table/Table.css +45 -0
- package/src/components/table/Table.vue +108 -0
- package/src/components/table/TableBody.vue +13 -0
- package/src/components/table/TableCell.vue +13 -0
- package/src/components/table/TableHead.vue +22 -0
- package/src/components/table/TableHeadRow.vue +15 -0
- package/src/components/table/TableRow.vue +13 -0
- package/src/components/table/examples/basic.vue +46 -0
- package/src/components/table/examples/index.stories.ts +19 -0
- package/src/components/table/examples/index.ts +1 -0
- package/src/components/table/types/index.ts +5 -0
- package/src/components/tooltip/Tooltip.css +49 -0
- package/src/components/tooltip/Tooltip.vue +85 -0
- package/src/components/tooltip/examples/basic.vue +8 -0
- package/src/components/tooltip/examples/index.stories.ts +21 -0
- package/src/components/tooltip/examples/index.ts +1 -0
- package/src/components/virtualscroll/VirtualScroll.css +13 -0
- package/src/components/virtualscroll/VirtualScroll.vue +61 -0
- package/src/components/virtualscroll/examples/basic.vue +37 -0
- package/src/components/virtualscroll/examples/index.stories.ts +31 -0
- package/src/components/virtualscroll/examples/index.ts +1 -0
- package/src/composables/element.ts +13 -0
- package/src/composables/useCachedUid.ts +48 -0
- package/src/composables/useEventListener.ts +14 -0
- package/src/composables/useInput.ts +134 -0
- package/src/composables/useIsServer.ts +7 -0
- package/src/composables/useMount.ts +43 -0
- package/src/composables/usePopper.ts +194 -0
- package/src/create.ts +34 -0
- package/src/css/components.css +14 -0
- package/src/css/index.css +4 -0
- package/src/css/normalize.css +379 -0
- package/src/css/transitions.css +40 -0
- package/src/css/variables.css +80 -0
- package/src/exports/nuxt.js +33 -0
- package/src/exports/nuxt.plugin.js +8 -0
- package/src/index.ts +5 -0
- package/src/install.ts +8 -0
- package/src/shims-vue.d.ts +6 -0
- package/src/types/props.ts +3 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
.m-button {
|
|
2
|
+
--button-height: 36px;
|
|
3
|
+
--button-padding: 0 15px;
|
|
4
|
+
--button-font-size: 15px;
|
|
5
|
+
--button-border-radius: 4px;
|
|
6
|
+
--button-font-weight: 500;
|
|
7
|
+
--button-border-color: var(--gray-200);
|
|
8
|
+
margin: 0;
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
outline: none;
|
|
11
|
+
border: 1px solid var(--button-border-color);
|
|
12
|
+
background-color: transparent;
|
|
13
|
+
z-index: auto;
|
|
14
|
+
padding: var(--button-padding);
|
|
15
|
+
font-size: var(--button-font-size);
|
|
16
|
+
font-weight: var(--button-font-weight);
|
|
17
|
+
font-family: inherit;
|
|
18
|
+
color: var(--gray-600);
|
|
19
|
+
position: relative;
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
flex-shrink: 0;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
text-align: center;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
height: var(--button-height);
|
|
27
|
+
line-height: 1;
|
|
28
|
+
border-radius: var(--button-border-radius);
|
|
29
|
+
text-decoration: none;
|
|
30
|
+
transition: color .3s cubic-bezier(0.4, 0, 0.2, 1), background-color .3s cubic-bezier(0.4, 0, 0.2, 1), border-color .2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.m-button__content {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
flex-wrap: nowrap;
|
|
37
|
+
min-width: 0px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
.m-button.m-button--strong {
|
|
42
|
+
font-weight: 500;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.m-button--block {
|
|
46
|
+
display: flex;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.m-button.m-button--icon-left .m-button__content {
|
|
50
|
+
padding-left: 8px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.m-button.m-button--icon-right .m-button__content {
|
|
54
|
+
padding-right: 8px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.m-button:not(.m-button--disabled):hover {
|
|
58
|
+
color: var(--blue);
|
|
59
|
+
--button-border-color: var(--blue);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.m-button:not(.m-button--disabled):focus,
|
|
63
|
+
.m-button:not(.m-button--disabled):active {
|
|
64
|
+
color: var(--blue-dark);
|
|
65
|
+
--button-border-color: var(--blue-dark);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.m-button.m-button--secondary {
|
|
69
|
+
color: var(--gray-500);
|
|
70
|
+
--button-border-color: var(--white);
|
|
71
|
+
background-color: var(--white);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.m-button:not(.m-button--disabled).m-button--secondary:hover {
|
|
75
|
+
color: var(--gray-600);
|
|
76
|
+
--button-border-color: var(--gray-150);
|
|
77
|
+
background-color: var(--gray-150);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.m-button:not(.m-button--disabled).m-button--secondary:active,
|
|
81
|
+
.m-button:not(.m-button--disabled).m-button--secondary:focus {
|
|
82
|
+
color: var(--gray-600);
|
|
83
|
+
--button-border-color: var(--gray-200);
|
|
84
|
+
background-color: var(--gray-200);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.m-button.m-button--gray.m-button--secondary {
|
|
88
|
+
color: var(--gray-600);
|
|
89
|
+
--button-border-color: var(--gray-100);
|
|
90
|
+
background-color: var(--gray-100);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.m-button.m-button--gray:not(.m-button--disabled).m-button--secondary:hover {
|
|
94
|
+
color: var(--gray-600);
|
|
95
|
+
--button-border-color: var(--gray-150);
|
|
96
|
+
background-color: var(--gray-150);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.m-button.m-button--gray:not(.m-button--disabled).m-button--secondary:active,
|
|
100
|
+
.m-button.m-button--gray:not(.m-button--disabled).m-button--secondary:focus {
|
|
101
|
+
color: var(--gray-600);
|
|
102
|
+
--button-border-color: var(--gray-200);
|
|
103
|
+
background-color: var(--gray-200);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Info Button
|
|
108
|
+
*/
|
|
109
|
+
.m-button--blue {
|
|
110
|
+
color: var(--white);
|
|
111
|
+
--button-border-color: var(--blue);
|
|
112
|
+
background-color: var(--blue);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.m-button--blue:not(.m-button--disabled):hover {
|
|
116
|
+
color: var(--white);
|
|
117
|
+
--button-border-color: var(--blue-hover);
|
|
118
|
+
background-color: var(--blue-hover);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.m-button--blue:not(.m-button--disabled):active,
|
|
122
|
+
.m-button--blue:not(.m-button--disabled):focus {
|
|
123
|
+
color: var(--white);
|
|
124
|
+
--button-border-color: var(--blue-focus);
|
|
125
|
+
background-color: var(--blue-focus);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.m-button--blue.m-button--secondary {
|
|
129
|
+
color: var(--blue-dark);
|
|
130
|
+
--button-border-color: var(--blue-secondary);
|
|
131
|
+
background-color: var(--blue-secondary);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.m-button--blue.m-button--secondary:not(.m-button--disabled):hover {
|
|
135
|
+
color: var(--blue-darker);
|
|
136
|
+
--button-border-color: var(--blue-secondary-hover);
|
|
137
|
+
background-color: var(--blue-secondary-hover);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.m-button--blue.m-button--secondary:not(.m-button--disabled):active,
|
|
141
|
+
.m-button--blue.m-button--secondary:not(.m-button--disabled):focus {
|
|
142
|
+
color: var(--blue-darker);
|
|
143
|
+
--button-border-color: var(--blue-secondary-focus);
|
|
144
|
+
background-color: var(--blue-secondary-focus);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Success Button
|
|
149
|
+
*/
|
|
150
|
+
.m-button--green {
|
|
151
|
+
color: var(--white);
|
|
152
|
+
--button-border-color: var(--green);
|
|
153
|
+
background-color: var(--green);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.m-button--green:not(.m-button--disabled):hover {
|
|
157
|
+
color: var(--white);
|
|
158
|
+
--button-border-color: var(--green-hover);
|
|
159
|
+
background-color: var(--green-hover);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.m-button--green:not(.m-button--disabled):focus,
|
|
163
|
+
.m-button--green:not(.m-button--disabled):active {
|
|
164
|
+
color: var(--white);
|
|
165
|
+
--button-border-color: var(--green-focus);
|
|
166
|
+
background-color: var(--green-focus);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.m-button--green.m-button--secondary {
|
|
170
|
+
color: var(--green-dark);
|
|
171
|
+
--button-border-color: var(--green-secondary);
|
|
172
|
+
background-color: var(--green-secondary);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.m-button--green.m-button--secondary:not(.m-button--disabled):hover {
|
|
176
|
+
color: var(--green-darker);
|
|
177
|
+
--button-border-color: var(--green-secondary-hover);
|
|
178
|
+
background-color: var(--green-secondary-hover);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.m-button--green.m-button--secondary:not(.m-button--disabled):focus,
|
|
182
|
+
.m-button--green.m-button--secondary:not(.m-button--disabled):active {
|
|
183
|
+
color: var(--green-darker);
|
|
184
|
+
--button-border-color: var(--green-secondary-focus);
|
|
185
|
+
background-color: var(--green-secondary-focus);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Danger Button
|
|
190
|
+
*/
|
|
191
|
+
.m-button--red {
|
|
192
|
+
color: var(--white);
|
|
193
|
+
--button-border-color: var(--red);
|
|
194
|
+
background-color: var(--red);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.m-button--red:not(.m-button--disabled):hover {
|
|
198
|
+
color: var(--white);
|
|
199
|
+
--button-border-color: var(--red-hover);
|
|
200
|
+
background-color: var(--red-hover);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.m-button--red:not(.m-button--disabled):focus,
|
|
204
|
+
.m-button--red:not(.m-button--disabled):active {
|
|
205
|
+
color: var(--white);
|
|
206
|
+
--button-border-color: var(--red-focus);
|
|
207
|
+
background-color: var(--red-focus);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.m-button--red.m-button--secondary {
|
|
211
|
+
color: var(--red-dark);
|
|
212
|
+
--button-border-color: var(--red-secondary);
|
|
213
|
+
background-color: var(--red-secondary);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.m-button--red.m-button--secondary:not(.m-button--disabled):hover {
|
|
217
|
+
color: var(--red-darker);
|
|
218
|
+
--button-border-color: var(--red-secondary-hover);
|
|
219
|
+
background-color: var(--red-secondary-hover);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.m-button--red.m-button--secondary:not(.m-button--disabled):active,
|
|
223
|
+
.m-button--red.m-button--secondary:not(.m-button--disabled):focus {
|
|
224
|
+
color: var(--red-darker);
|
|
225
|
+
--button-border-color: var(--red-secondary-focus);
|
|
226
|
+
background-color: var(--red-secondary-focus);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Yellow Button
|
|
231
|
+
*/
|
|
232
|
+
.m-button--yellow {
|
|
233
|
+
color: var(--white);
|
|
234
|
+
--button-border-color: var(--yellow);
|
|
235
|
+
background-color: var(--yellow);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.m-button--yellow:not(.m-button--disabled):hover {
|
|
239
|
+
color: var(--white);
|
|
240
|
+
--button-border-color: var(--yellow-hover);
|
|
241
|
+
background-color: var(--yellow-hover);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.m-button--yellow:not(.m-button--disabled):focus,
|
|
245
|
+
.m-button--yellow:not(.m-button--disabled):active {
|
|
246
|
+
color: var(--white);
|
|
247
|
+
--button-border-color: var(--yellow-focus);
|
|
248
|
+
background-color: var(--yellow-focus);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.m-button--yellow.m-button--secondary {
|
|
252
|
+
color: var(--yellow-dark);
|
|
253
|
+
--button-border-color: var(--yellow-secondary);
|
|
254
|
+
background-color: var(--yellow-secondary);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.m-button--yellow.m-button--secondary:not(.m-button--disabled):hover {
|
|
258
|
+
color: var(--yellow-darker);
|
|
259
|
+
--button-border-color: var(--yellow-secondary-hover);
|
|
260
|
+
background-color: var(--yellow-secondary-hover);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.m-button--yellow.m-button--secondary:not(.m-button--disabled):active,
|
|
264
|
+
.m-button--yellow.m-button--secondary:not(.m-button--disabled):focus {
|
|
265
|
+
color: var(--yellow-darker);
|
|
266
|
+
--button-border-color: var(--yellow-secondary-focus);
|
|
267
|
+
background-color: var(--yellow-secondary-focus);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.m-button--xs {
|
|
271
|
+
--button-height: 22px;
|
|
272
|
+
--button-padding: 0 6px;
|
|
273
|
+
--button-font-size: 14px;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.m-button--sm {
|
|
277
|
+
--button-height: 28px;
|
|
278
|
+
--button-padding: 0 10px;
|
|
279
|
+
--button-font-size: 14px;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.m-button--lg {
|
|
283
|
+
--button-height: 40px;
|
|
284
|
+
--button-padding: 0 18px;
|
|
285
|
+
--button-font-size: 18px;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.m-button--xl {
|
|
289
|
+
--button-height: 44px;
|
|
290
|
+
--button-padding: 0 22px;
|
|
291
|
+
--button-font-size: 20px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.m-button--rounded {
|
|
295
|
+
border-radius: 34px;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.m-button--rounded.m-button--xs {
|
|
299
|
+
padding: 0 10px;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.m-button--rounded.m-button--sm {
|
|
303
|
+
padding: 0 14px;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.m-button--rounded.m-button--md {
|
|
307
|
+
padding: 0 18px;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.m-button--rounded.m-button--lg {
|
|
311
|
+
padding: 0 22px;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.m-button--rounded.m-button--xl {
|
|
315
|
+
padding: 0 26px;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.m-button--disabled {
|
|
319
|
+
opacity: 0.8;
|
|
320
|
+
cursor: not-allowed;
|
|
321
|
+
user-select: none;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.m-button-group {
|
|
325
|
+
display: inline-flex;
|
|
326
|
+
vertical-align: middle;
|
|
327
|
+
position: relative;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Only round the first and last button
|
|
332
|
+
*/
|
|
333
|
+
|
|
334
|
+
.m-button-group .m-button:first-child {
|
|
335
|
+
border-top-left-radius: var(--button-border-radius);
|
|
336
|
+
border-bottom-left-radius: var(--button-border-radius);
|
|
337
|
+
border-top-right-radius: 0;
|
|
338
|
+
border-bottom-right-radius: 0;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.m-button-group .m-button:last-child {
|
|
342
|
+
border-top-left-radius: 0;
|
|
343
|
+
border-bottom-left-radius: 0;
|
|
344
|
+
border-top-right-radius: var(--button-border-radius);
|
|
345
|
+
border-bottom-right-radius: var(--button-border-radius);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.m-button-group .m-button {
|
|
349
|
+
border-radius: 0;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.m-button-group .m-button:not(:first-child) {
|
|
353
|
+
border-left: none;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
.m-button-group .m-button:not(:first-child)::after {
|
|
358
|
+
content: '';
|
|
359
|
+
position: absolute;
|
|
360
|
+
top: 0;
|
|
361
|
+
left: 0;
|
|
362
|
+
bottom: 0;
|
|
363
|
+
width: 1px;
|
|
364
|
+
background-color: transparent;
|
|
365
|
+
transition: color .3s cubic-bezier(0.4, 0, 0.2, 1), background-color .3s cubic-bezier(0.4, 0, 0.2, 1), border-color .2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.m-button-group .m-button:hover:not(:first-child)::after {
|
|
369
|
+
background-color: var(--button-border-color);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.m-button-group--block > .m-button {
|
|
373
|
+
flex-basis: 100%;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.m-button-group--block {
|
|
377
|
+
display: flex;
|
|
378
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="computedTag" :to="to" :href="href" :type="type" :class="computedClasses" :disabled="disabled">
|
|
3
|
+
<div v-if="hasIconLeft" class="m-button__icon">
|
|
4
|
+
<slot name="icon-left" />
|
|
5
|
+
</div>
|
|
6
|
+
<span class="m-button__content">
|
|
7
|
+
<slot />
|
|
8
|
+
</span>
|
|
9
|
+
<div v-if="hasIconRight" class="m-button__icon">
|
|
10
|
+
<slot name="icon-right" />
|
|
11
|
+
</div>
|
|
12
|
+
</component>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import { computed, defineComponent, inject } from "vue";
|
|
17
|
+
import type { PropType } from 'vue';
|
|
18
|
+
import type { Color, Size } from "@/types/props";
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: "MButton",
|
|
22
|
+
props: {
|
|
23
|
+
type: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: 'button',
|
|
26
|
+
},
|
|
27
|
+
color: {
|
|
28
|
+
type: String as PropType<Color>,
|
|
29
|
+
default: ''
|
|
30
|
+
},
|
|
31
|
+
size: {
|
|
32
|
+
type: String as PropType<Size>,
|
|
33
|
+
default: 'md'
|
|
34
|
+
},
|
|
35
|
+
rounded: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
disabled: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false
|
|
42
|
+
},
|
|
43
|
+
block: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false
|
|
46
|
+
},
|
|
47
|
+
secondary: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
to: {
|
|
52
|
+
type: [String, Object],
|
|
53
|
+
default: ''
|
|
54
|
+
},
|
|
55
|
+
href: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: '',
|
|
58
|
+
},
|
|
59
|
+
icon: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
strong: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
setup(props, { slots }) {
|
|
69
|
+
const group = inject('buttonGroup', {
|
|
70
|
+
groupProps: {},
|
|
71
|
+
isGroup: false
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const hasIconLeft = computed(() => !!(slots['icon-left']));
|
|
75
|
+
const hasIconRight = computed(() => !!(slots['icon-right']));
|
|
76
|
+
|
|
77
|
+
const computedClasses = computed(() => {
|
|
78
|
+
// @ts-ignore
|
|
79
|
+
const size = group.groupProps.size || props.size;
|
|
80
|
+
return [
|
|
81
|
+
'm-button',
|
|
82
|
+
`m-button--${size}`,
|
|
83
|
+
{
|
|
84
|
+
[`m-button--${props.color}`]: props.color,
|
|
85
|
+
'm-button--rounded': props.rounded,
|
|
86
|
+
'm-button--block': props.block,
|
|
87
|
+
'm-button--icon': props.icon,
|
|
88
|
+
'm-button--secondary': props.secondary,
|
|
89
|
+
'm-button--disabled': props.disabled,
|
|
90
|
+
'm-button--strong': props.strong,
|
|
91
|
+
'm-button--icon-left': hasIconLeft.value,
|
|
92
|
+
'm-button--icon-right': hasIconRight.value,
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const computedTag = computed(() => (props.to ? 'router-link' : props.href ? 'a' : 'button'));
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
computedClasses,
|
|
101
|
+
computedTag,
|
|
102
|
+
hasIconLeft,
|
|
103
|
+
hasIconRight
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
</script>
|
|
108
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MButton secondary>Default</MButton><br/><br/>
|
|
3
|
+
<MButton color="gray" secondary>Gray</MButton><br/><br/>
|
|
4
|
+
<MButton color="blue" secondary>Blue</MButton><br/><br/>
|
|
5
|
+
<MButton color="green" secondary>Green</MButton><br/><br/>
|
|
6
|
+
<MButton color="red" secondary>Red</MButton><br/><br/>
|
|
7
|
+
<MButton color="yellow" secondary>Yellow</MButton><br/><br/>
|
|
8
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MButton>Default</MButton><br/><br/>
|
|
3
|
+
<MButton color="gray">Gray</MButton><br/><br/>
|
|
4
|
+
<MButton color="blue">Blue</MButton><br/><br/>
|
|
5
|
+
<MButton color="green">Green</MButton><br/><br/>
|
|
6
|
+
<MButton color="red">Red</MButton><br/><br/>
|
|
7
|
+
<MButton color="yellow">Yellow</MButton><br/><br/>
|
|
8
|
+
</template>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MButton>
|
|
3
|
+
<template #icon-left>
|
|
4
|
+
<svg style="width: 20px; height: 20px;" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
|
5
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M10.5 6h9.75M10.5 6a1.5 1.5 0 11-3 0m3 0a1.5 1.5 0 10-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-9.75 0h9.75" />
|
|
6
|
+
</svg>
|
|
7
|
+
</template>
|
|
8
|
+
Hello World
|
|
9
|
+
</MButton>
|
|
10
|
+
</template>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import MButton from "../Button.vue";
|
|
2
|
+
import {
|
|
3
|
+
MButtonBasic,
|
|
4
|
+
MButtonSize,
|
|
5
|
+
MButtonRounded,
|
|
6
|
+
MButtonColor,
|
|
7
|
+
MButtonColorSecondary,
|
|
8
|
+
MButtonDisabled,
|
|
9
|
+
MButtonIcon
|
|
10
|
+
} from "./index";
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
colorArgType,
|
|
14
|
+
createStory,
|
|
15
|
+
sizeArgType
|
|
16
|
+
} from "@/__storybook__";
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
component: MButton,
|
|
20
|
+
title: 'Components/Buttons/Button',
|
|
21
|
+
argTypes: {
|
|
22
|
+
...colorArgType(),
|
|
23
|
+
...sizeArgType()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Basic = createStory(MButtonBasic);
|
|
28
|
+
export const Size = createStory(MButtonSize);
|
|
29
|
+
export const Rounded = createStory(MButtonRounded);
|
|
30
|
+
export const Colors = createStory(MButtonColor);
|
|
31
|
+
export const ColorsSecondary = createStory(MButtonColorSecondary);
|
|
32
|
+
export const Disabled = createStory(MButtonDisabled);
|
|
33
|
+
export const Icon = createStory(MButtonIcon);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as MButtonBasic } from './basic.vue';
|
|
2
|
+
export { default as MButtonSize } from './size.vue';
|
|
3
|
+
export { default as MButtonRounded } from './rounded.vue';
|
|
4
|
+
export { default as MButtonColor } from './colors.vue';
|
|
5
|
+
export { default as MButtonColorSecondary } from './colors-secondary.vue';
|
|
6
|
+
export { default as MButtonDisabled } from './disabled.vue';
|
|
7
|
+
export { default as MButtonIcon } from './icon.vue';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MButton size="xs" rounded>Extra Small</MButton><br/><br/>
|
|
3
|
+
<MButton size="sm" rounded>Small</MButton><br/><br/>
|
|
4
|
+
<MButton size="md" rounded>Default</MButton><br/><br/>
|
|
5
|
+
<MButton size="lg" rounded>Large</MButton><br/><br/>
|
|
6
|
+
<MButton size="xl" rounded>Extra Large</MButton><br/><br/>
|
|
7
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MButton size="xs">Extra Small</MButton><br/><br/>
|
|
3
|
+
<MButton size="sm">Small</MButton><br/><br/>
|
|
4
|
+
<MButton size="md">Default</MButton><br/><br/>
|
|
5
|
+
<MButton size="lg">Large</MButton><br/><br/>
|
|
6
|
+
<MButton size="xl">Extra Large</MButton><br/><br/>
|
|
7
|
+
</template>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="tag"
|
|
4
|
+
:class="computedClasses"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</component>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import type { Size } from '@/types/props';
|
|
12
|
+
import { defineComponent, provide, type PropType, computed } from 'vue';
|
|
13
|
+
|
|
14
|
+
export default defineComponent({
|
|
15
|
+
name: "MButtonGroup",
|
|
16
|
+
props: {
|
|
17
|
+
tag: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'div'
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
type: String as PropType<Size>,
|
|
23
|
+
default: 'md'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
setup(props) {
|
|
27
|
+
|
|
28
|
+
provide('buttonGroup', {
|
|
29
|
+
groupProps: props,
|
|
30
|
+
isGroup: true
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const computedClasses = computed(() => {
|
|
34
|
+
return [
|
|
35
|
+
'm-button-group',
|
|
36
|
+
{
|
|
37
|
+
[`m-button-group--${props.size}`]: props.size
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
computedClasses
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import MButtonGroup from "../ButtonGroup.vue";
|
|
2
|
+
import MButton from "../../button/Button.vue";
|
|
3
|
+
import {
|
|
4
|
+
MButtonGroupBasic
|
|
5
|
+
} from "./index";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
createStory,
|
|
9
|
+
sizeArgType
|
|
10
|
+
} from "@/__storybook__";
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
component: MButtonGroup,
|
|
14
|
+
subcomponents: { MButton },
|
|
15
|
+
title: 'Components/Buttons/Group',
|
|
16
|
+
argTypes: {
|
|
17
|
+
...sizeArgType()
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Basic = createStory(MButtonGroupBasic);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MButtonGroupBasic } from './basic.vue';
|