@teammodlr/ui-kit 1.0.2

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.
Files changed (129) hide show
  1. package/env.d.ts +1 -0
  2. package/lib/__storybook__/argTypes.d.ts +31 -0
  3. package/lib/__storybook__/createStory.d.ts +8 -0
  4. package/lib/__storybook__/index.d.ts +2 -0
  5. package/lib/components/avatar/Avatar.vue.d.ts +70 -0
  6. package/lib/components/avatargroup/AvatarGroup.vue.d.ts +34 -0
  7. package/lib/components/breadcrumb/Breadcrumb.vue.d.ts +25 -0
  8. package/lib/components/breadcrumbitem/BreadcrumbItem.vue.d.ts +18 -0
  9. package/lib/components/breadcrumbitem/index.d.ts +1 -0
  10. package/lib/components/button/Button.vue.d.ts +121 -0
  11. package/lib/components/buttongroup/ButtonGroup.vue.d.ts +29 -0
  12. package/lib/components/checkbox/Checkbox.vue.d.ts +97 -0
  13. package/lib/components/dropdown/Dropdown.vue.d.ts +114 -0
  14. package/lib/components/dropdown/DropdownItem.vue.d.ts +61 -0
  15. package/lib/components/dropdown/DropdownList.vue.d.ts +2 -0
  16. package/lib/components/dropdown/DropdownWrapper.vue.d.ts +2 -0
  17. package/lib/components/dropdown/hooks.d.ts +2 -0
  18. package/lib/components/form/Form.vue.d.ts +67 -0
  19. package/lib/components/image/Image.vue.d.ts +50 -0
  20. package/lib/components/index.d.ts +26 -0
  21. package/lib/components/input/Input.vue.d.ts +126 -0
  22. package/lib/components/link/Link.vue.d.ts +51 -0
  23. package/lib/components/messageprovider/Message.vue.d.ts +61 -0
  24. package/lib/components/messageprovider/MessageProvider.vue.d.ts +51 -0
  25. package/lib/components/messageprovider/types.d.ts +28 -0
  26. package/lib/components/messageprovider/useMessage.d.ts +2 -0
  27. package/lib/components/select/Select.vue.d.ts +180 -0
  28. package/lib/components/skeleton/Skeleton.vue.d.ts +39 -0
  29. package/lib/components/tab/Tab.vue.d.ts +41 -0
  30. package/lib/components/tab/TabGroup.vue.d.ts +43 -0
  31. package/lib/components/table/Table.vue.d.ts +63 -0
  32. package/lib/components/table/TableBody.vue.d.ts +2 -0
  33. package/lib/components/table/TableCell.vue.d.ts +2 -0
  34. package/lib/components/table/TableHead.vue.d.ts +20 -0
  35. package/lib/components/table/TableHeadRow.vue.d.ts +2 -0
  36. package/lib/components/table/TableRow.vue.d.ts +2 -0
  37. package/lib/components/table/types/index.d.ts +5 -0
  38. package/lib/components/tooltip/Tooltip.vue.d.ts +54 -0
  39. package/lib/components/virtualscroll/VirtualScroll.vue.d.ts +43 -0
  40. package/lib/composables/element.d.ts +2 -0
  41. package/lib/composables/useCachedUid.d.ts +13 -0
  42. package/lib/composables/useEventListener.d.ts +1 -0
  43. package/lib/composables/useInput.d.ts +36 -0
  44. package/lib/composables/useIsServer.d.ts +1 -0
  45. package/lib/composables/useMount.d.ts +13 -0
  46. package/lib/composables/usePopper.d.ts +31 -0
  47. package/lib/create.d.ts +9 -0
  48. package/lib/index.cjs.js +5 -0
  49. package/lib/index.d.ts +4 -0
  50. package/lib/index.es.js +3164 -0
  51. package/lib/install.d.ts +4 -0
  52. package/lib/nuxt.js +33 -0
  53. package/lib/nuxt.plugin.js +8 -0
  54. package/lib/style.css +1 -0
  55. package/lib/types/props.d.ts +2 -0
  56. package/package.json +75 -0
  57. package/src/__storybook__/argTypes.ts +42 -0
  58. package/src/__storybook__/createStory.ts +15 -0
  59. package/src/__storybook__/index.ts +2 -0
  60. package/src/components/avatar/Avatar.css +69 -0
  61. package/src/components/avatar/Avatar.vue +102 -0
  62. package/src/components/avatargroup/AvatarGroup.css +8 -0
  63. package/src/components/avatargroup/AvatarGroup.vue +32 -0
  64. package/src/components/breadcrumb/Breadcrumb.css +46 -0
  65. package/src/components/breadcrumb/Breadcrumb.vue +51 -0
  66. package/src/components/breadcrumbitem/BreadcrumbItem.vue +66 -0
  67. package/src/components/breadcrumbitem/index.ts +1 -0
  68. package/src/components/button/Button.css +378 -0
  69. package/src/components/button/Button.vue +108 -0
  70. package/src/components/buttongroup/ButtonGroup.vue +47 -0
  71. package/src/components/checkbox/Checkbox.css +185 -0
  72. package/src/components/checkbox/Checkbox.vue +140 -0
  73. package/src/components/dropdown/Dropdown.css +68 -0
  74. package/src/components/dropdown/Dropdown.vue +237 -0
  75. package/src/components/dropdown/DropdownItem.vue +118 -0
  76. package/src/components/dropdown/DropdownList.vue +20 -0
  77. package/src/components/dropdown/DropdownWrapper.vue +17 -0
  78. package/src/components/dropdown/hooks.ts +30 -0
  79. package/src/components/form/Form.vue +141 -0
  80. package/src/components/image/Image.vue +71 -0
  81. package/src/components/index.ts +27 -0
  82. package/src/components/input/Input.css +173 -0
  83. package/src/components/input/Input.vue +176 -0
  84. package/src/components/link/Link.css +147 -0
  85. package/src/components/link/Link.vue +54 -0
  86. package/src/components/messageprovider/Message.vue +76 -0
  87. package/src/components/messageprovider/MessageProvider.css +36 -0
  88. package/src/components/messageprovider/MessageProvider.vue +142 -0
  89. package/src/components/messageprovider/types.ts +39 -0
  90. package/src/components/messageprovider/useMessage.ts +12 -0
  91. package/src/components/select/Select.css +226 -0
  92. package/src/components/select/Select.vue +474 -0
  93. package/src/components/skeleton/Skeleton.css +73 -0
  94. package/src/components/skeleton/Skeleton.vue +47 -0
  95. package/src/components/tab/Tab.css +113 -0
  96. package/src/components/tab/Tab.vue +98 -0
  97. package/src/components/tab/TabGroup.vue +90 -0
  98. package/src/components/table/Table.css +45 -0
  99. package/src/components/table/Table.vue +108 -0
  100. package/src/components/table/TableBody.vue +13 -0
  101. package/src/components/table/TableCell.vue +13 -0
  102. package/src/components/table/TableHead.vue +22 -0
  103. package/src/components/table/TableHeadRow.vue +15 -0
  104. package/src/components/table/TableRow.vue +13 -0
  105. package/src/components/table/types/index.ts +5 -0
  106. package/src/components/tooltip/Tooltip.css +49 -0
  107. package/src/components/tooltip/Tooltip.vue +85 -0
  108. package/src/components/virtualscroll/VirtualScroll.css +13 -0
  109. package/src/components/virtualscroll/VirtualScroll.vue +61 -0
  110. package/src/composables/element.ts +13 -0
  111. package/src/composables/useCachedUid.ts +48 -0
  112. package/src/composables/useEventListener.ts +14 -0
  113. package/src/composables/useInput.ts +134 -0
  114. package/src/composables/useIsServer.ts +7 -0
  115. package/src/composables/useMount.ts +43 -0
  116. package/src/composables/usePopper.ts +194 -0
  117. package/src/create.ts +34 -0
  118. package/src/css/components.css +14 -0
  119. package/src/css/index.css +4 -0
  120. package/src/css/normalize.css +379 -0
  121. package/src/css/transitions.css +40 -0
  122. package/src/css/variables.css +80 -0
  123. package/src/exports/nuxt.js +33 -0
  124. package/src/exports/nuxt.plugin.js +8 -0
  125. package/src/index.ts +5 -0
  126. package/src/install.ts +8 -0
  127. package/src/shims-vue.d.ts +6 -0
  128. package/src/types/props.ts +3 -0
  129. package/volar.d.ts +16 -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,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,185 @@
1
+ .m-checkbox {
2
+ --checkbox-width: 22px;
3
+ --checkbox-height: 22px;
4
+ --checkbox-border-radius: 6px;
5
+ --checkbox-border-width: 1px;
6
+ --checkbox-background-color: var(--white);
7
+ --checkbox-border-color: var(--gray-300);
8
+ --checkbox-gap: 6px;
9
+
10
+ --checkbox-tick-width: 4px;
11
+ --checkbox-tick-height: 10px;
12
+ --checkbox-tick-height-negative: -10px;
13
+
14
+ --checkbox-tick-top: 8px;
15
+ --checkbox-tick-left: 3px;
16
+ --checkbox-tick-border-width: 3px;
17
+
18
+ display: flex;
19
+ align-items: center;
20
+ position: relative;
21
+ font-weight: bold;
22
+ cursor: pointer;
23
+ gap: var(--checkbox-gap);
24
+ }
25
+
26
+ .m-checkbox.m-checkbox--xs {
27
+ --checkbox-width: 16px;
28
+ --checkbox-height: 16px;
29
+ --checkbox-border-radius: 4px;
30
+ --checkbox-border-width: 1px;
31
+ --checkbox-tick-top: 6px;
32
+ --checkbox-tick-left: 1px;
33
+
34
+ --checkbox-tick-width: 3px;
35
+ --checkbox-tick-height: 8px;
36
+ --checkbox-tick-height-negative: -8px;
37
+ }
38
+
39
+ .m-checkbox.m-checkbox--sm {
40
+ --checkbox-width: 20px;
41
+ --checkbox-height: 20px;
42
+ --checkbox-border-radius: 4px;
43
+ --checkbox-border-width: 1px;
44
+ --checkbox-tick-top: 7px;
45
+ --checkbox-tick-left: 2px;
46
+ }
47
+
48
+ .m-checkbox.m-checkbox--lg {
49
+ --checkbox-width: 26px;
50
+ --checkbox-height: 26px;
51
+ --checkbox-border-radius: 8px;
52
+ --checkbox-border-width: 1px;
53
+
54
+ --checkbox-tick-top: 10px;
55
+ --checkbox-tick-left: 3px;
56
+
57
+ --checkbox-tick-border-width: 4px;
58
+ --checkbox-tick-width: 4px;
59
+ --checkbox-tick-height: 14px;
60
+ --checkbox-tick-height-negative: -14px;
61
+ }
62
+
63
+ .m-checkbox.m-checkbox--xl {
64
+ --checkbox-width: 32px;
65
+ --checkbox-height: 32px;
66
+ --checkbox-border-radius: 8px;
67
+ --checkbox-border-width: 1px;
68
+
69
+ --checkbox-tick-top: 14px;
70
+ --checkbox-tick-left: 5px;
71
+
72
+ --checkbox-tick-border-width: 4px;
73
+ --checkbox-tick-width: 5px;
74
+ --checkbox-tick-height: 16px;
75
+ --checkbox-tick-height-negative: -16px;
76
+ }
77
+
78
+ .m-checkbox.m-checkbox--blue.m-checkbox--checked {
79
+ --checkbox-background-color: var(--blue);
80
+ --checkbox-border-color: var(--blue);
81
+ }
82
+
83
+ .m-checkbox.m-checkbox--green.m-checkbox--checked {
84
+ --checkbox-background-color: var(--green);
85
+ --checkbox-border-color: var(--green);
86
+ }
87
+
88
+ .m-checkbox.m-checkbox--red.m-checkbox--checked {
89
+ --checkbox-background-color: var(--red);
90
+ --checkbox-border-color: var(--red);
91
+ }
92
+
93
+ .m-checkbox.m-checkbox--yellow.m-checkbox--checked {
94
+ --checkbox-background-color: var(--yellow);
95
+ --checkbox-border-color: var(--yellow);
96
+ }
97
+
98
+ .m-checkbox input {
99
+ position: absolute;
100
+ opacity: 0;
101
+ cursor: pointer;
102
+ height: 0;
103
+ width: 0;
104
+ display: none;
105
+ }
106
+
107
+ .m-checkbox span {
108
+ display: flex;
109
+ height: var(--checkbox-height);
110
+ width: var(--checkbox-width);
111
+ border-radius: var(--checkbox-border-radius);
112
+ border: var(--checkbox-border-width) solid var(--checkbox-border-color);
113
+ background-color: var(--checkbox-background-color);
114
+ transition: all 125ms cubic-bezier(0.4, 0, 0.2, 1);
115
+ position: relative;
116
+ }
117
+
118
+ .m-checkbox:hover:not(.m-checkbox--checked):not(.m-checkbox--disabled) span {
119
+ --checkbox-border-color: var(--gray-400);
120
+ --checkbox-background-color: var(--gray-100);
121
+ }
122
+
123
+ .m-checkbox.m-checkbox--disabled span,
124
+ .m-checkbox.m-checkbox--disabled .m-checkbox__label {
125
+ cursor: not-allowed;
126
+ }
127
+
128
+ .m-checkbox.m-checkbox--disabled span {
129
+ opacity: 0.6;
130
+ }
131
+
132
+ .m-checkbox:not(.m-checkbox--checked).m-checkbox--disabled span {
133
+ --checkbox-border-color: var(--gray-300);
134
+ --checkbox-background-color: var(--gray-100);
135
+ }
136
+
137
+ .m-checkbox.m-checkbox--checked span {
138
+ background-color: var(--checkbox-background-color);
139
+ border-color: var(--checkbox-background-color);
140
+ }
141
+
142
+ .m-checkbox.m-checkbox--checked span::before {
143
+ content: "";
144
+ position: absolute;
145
+ transform: rotate(45deg);
146
+ border-right: var(--checkbox-tick-border-width) solid transparent;
147
+ border-bottom: var(--checkbox-tick-border-width) solid transparent;
148
+ top: var(--checkbox-tick-top);
149
+ left: var(--checkbox-tick-left);
150
+ color: #FFFFFF;
151
+ transform-origin: 0% 100%;
152
+ animation: draw-tick 125ms 170ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
153
+ }
154
+
155
+ .m-checkbox .m-checkbox__label {
156
+ display: inline-block;
157
+ vertical-align: middle;
158
+ font-size: 14px;
159
+ line-height: 24px;
160
+ color: #000000;
161
+ font-weight: 400;
162
+ user-select: none;
163
+ }
164
+
165
+ @keyframes draw-tick {
166
+ 0% {
167
+ height: 0px;
168
+ width: 0px;
169
+ border-color: #FFF;
170
+ transform: translate3d(0, 0, 0) rotate(45deg);
171
+ }
172
+
173
+ 25% {
174
+ height: 0px;
175
+ width: var(--checkbox-tick-width);
176
+ transform: translate3d(0, 0, 0) rotate(45deg);
177
+ }
178
+
179
+ 100% {
180
+ border-color: #FFF;
181
+ height: var(--checkbox-tick-height);
182
+ width: var(--checkbox-tick-width);
183
+ transform: translate3d(0, var(--checkbox-tick-height-negative), 0) rotate(45deg);
184
+ }
185
+ }