@teammodlr/ui-kit 1.0.4 → 1.0.6

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 (147) hide show
  1. package/package.json +2 -1
  2. package/src/__storybook__/argTypes.ts +42 -0
  3. package/src/__storybook__/createStory.ts +15 -0
  4. package/src/__storybook__/index.ts +2 -0
  5. package/src/components/avatar/Avatar.css +69 -0
  6. package/src/components/avatar/Avatar.vue +102 -0
  7. package/src/components/avatar/examples/basic.vue +6 -0
  8. package/src/components/avatar/examples/custom-size.vue +7 -0
  9. package/src/components/avatar/examples/index.stories.ts +28 -0
  10. package/src/components/avatar/examples/index.ts +5 -0
  11. package/src/components/avatar/examples/sizes.vue +33 -0
  12. package/src/components/avatar/examples/slots.vue +7 -0
  13. package/src/components/avatar/examples/variants.vue +18 -0
  14. package/src/components/avatargroup/AvatarGroup.css +8 -0
  15. package/src/components/avatargroup/AvatarGroup.vue +32 -0
  16. package/src/components/avatargroup/examples/basic.vue +11 -0
  17. package/src/components/avatargroup/examples/index.stories.ts +28 -0
  18. package/src/components/avatargroup/examples/index.ts +1 -0
  19. package/src/components/breadcrumb/Breadcrumb.css +46 -0
  20. package/src/components/breadcrumb/Breadcrumb.vue +51 -0
  21. package/src/components/breadcrumb/examples/basic.vue +9 -0
  22. package/src/components/breadcrumb/examples/index.stories.ts +20 -0
  23. package/src/components/breadcrumb/examples/index.ts +1 -0
  24. package/src/components/breadcrumbitem/BreadcrumbItem.vue +66 -0
  25. package/src/components/breadcrumbitem/index.ts +1 -0
  26. package/src/components/button/Button.css +378 -0
  27. package/src/components/button/Button.vue +108 -0
  28. package/src/components/button/examples/basic.vue +3 -0
  29. package/src/components/button/examples/colors-secondary.vue +8 -0
  30. package/src/components/button/examples/colors.vue +8 -0
  31. package/src/components/button/examples/disabled.vue +3 -0
  32. package/src/components/button/examples/icon.vue +10 -0
  33. package/src/components/button/examples/index.stories.ts +33 -0
  34. package/src/components/button/examples/index.ts +7 -0
  35. package/src/components/button/examples/rounded.vue +7 -0
  36. package/src/components/button/examples/size.vue +7 -0
  37. package/src/components/buttongroup/ButtonGroup.vue +47 -0
  38. package/src/components/buttongroup/examples/basic.vue +9 -0
  39. package/src/components/buttongroup/examples/index.stories.ts +21 -0
  40. package/src/components/buttongroup/examples/index.ts +1 -0
  41. package/src/components/checkbox/Checkbox.css +185 -0
  42. package/src/components/checkbox/Checkbox.vue +140 -0
  43. package/src/components/checkbox/examples/basic.vue +9 -0
  44. package/src/components/checkbox/examples/index.stories.ts +21 -0
  45. package/src/components/checkbox/examples/index.ts +3 -0
  46. package/src/components/checkbox/examples/slot.vue +11 -0
  47. package/src/components/dropdown/Dropdown.css +68 -0
  48. package/src/components/dropdown/Dropdown.vue +237 -0
  49. package/src/components/dropdown/DropdownItem.vue +118 -0
  50. package/src/components/dropdown/DropdownList.vue +20 -0
  51. package/src/components/dropdown/DropdownWrapper.vue +17 -0
  52. package/src/components/dropdown/examples/basic.vue +73 -0
  53. package/src/components/dropdown/examples/context.vue +71 -0
  54. package/src/components/dropdown/examples/index.stories.ts +23 -0
  55. package/src/components/dropdown/examples/index.ts +2 -0
  56. package/src/components/dropdown/hooks.ts +30 -0
  57. package/src/components/form/Form.vue +141 -0
  58. package/src/components/form/examples/basic.vue +73 -0
  59. package/src/components/form/examples/index.stories.ts +23 -0
  60. package/src/components/form/examples/index.ts +1 -0
  61. package/src/components/image/Image.vue +71 -0
  62. package/src/components/image/examples/basic.vue +5 -0
  63. package/src/components/image/examples/index.stories.ts +12 -0
  64. package/src/components/image/examples/index.ts +1 -0
  65. package/src/components/index.ts +27 -0
  66. package/src/components/input/Input.css +173 -0
  67. package/src/components/input/Input.vue +176 -0
  68. package/src/components/input/examples/basic.vue +7 -0
  69. package/src/components/input/examples/index.stories.ts +24 -0
  70. package/src/components/input/examples/index.ts +4 -0
  71. package/src/components/input/examples/prefix.vue +7 -0
  72. package/src/components/input/examples/sizes.vue +9 -0
  73. package/src/components/input/examples/suffix.vue +7 -0
  74. package/src/components/link/Link.css +147 -0
  75. package/src/components/link/Link.vue +54 -0
  76. package/src/components/link/examples/basic.vue +3 -0
  77. package/src/components/link/examples/index.stories.ts +20 -0
  78. package/src/components/link/examples/index.ts +1 -0
  79. package/src/components/messageprovider/Message.vue +76 -0
  80. package/src/components/messageprovider/MessageProvider.css +36 -0
  81. package/src/components/messageprovider/MessageProvider.vue +142 -0
  82. package/src/components/messageprovider/examples/basic.vue +19 -0
  83. package/src/components/messageprovider/examples/index.stories.ts +30 -0
  84. package/src/components/messageprovider/examples/index.ts +1 -0
  85. package/src/components/messageprovider/examples/wrapper.vue +9 -0
  86. package/src/components/messageprovider/types.ts +39 -0
  87. package/src/components/messageprovider/useMessage.ts +12 -0
  88. package/src/components/select/Select.css +226 -0
  89. package/src/components/select/Select.vue +474 -0
  90. package/src/components/select/examples/basic.vue +20 -0
  91. package/src/components/select/examples/index.stories.ts +22 -0
  92. package/src/components/select/examples/index.ts +3 -0
  93. package/src/components/select/examples/multiple.vue +22 -0
  94. package/src/components/select/examples/searchable.vue +20 -0
  95. package/src/components/skeleton/Skeleton.css +73 -0
  96. package/src/components/skeleton/Skeleton.vue +47 -0
  97. package/src/components/skeleton/examples/basic.vue +3 -0
  98. package/src/components/skeleton/examples/index.stories.ts +24 -0
  99. package/src/components/skeleton/examples/index.ts +2 -0
  100. package/src/components/skeleton/examples/post.vue +8 -0
  101. package/src/components/tab/Tab.css +113 -0
  102. package/src/components/tab/Tab.vue +98 -0
  103. package/src/components/tab/TabGroup.vue +90 -0
  104. package/src/components/tab/examples/basic.vue +19 -0
  105. package/src/components/tab/examples/index.stories.ts +25 -0
  106. package/src/components/tab/examples/index.ts +2 -0
  107. package/src/components/tab/examples/vertical.vue +19 -0
  108. package/src/components/table/Table.css +45 -0
  109. package/src/components/table/Table.vue +108 -0
  110. package/src/components/table/TableBody.vue +13 -0
  111. package/src/components/table/TableCell.vue +13 -0
  112. package/src/components/table/TableHead.vue +22 -0
  113. package/src/components/table/TableHeadRow.vue +15 -0
  114. package/src/components/table/TableRow.vue +13 -0
  115. package/src/components/table/examples/basic.vue +46 -0
  116. package/src/components/table/examples/index.stories.ts +19 -0
  117. package/src/components/table/examples/index.ts +1 -0
  118. package/src/components/table/types/index.ts +5 -0
  119. package/src/components/tooltip/Tooltip.css +49 -0
  120. package/src/components/tooltip/Tooltip.vue +85 -0
  121. package/src/components/tooltip/examples/basic.vue +8 -0
  122. package/src/components/tooltip/examples/index.stories.ts +21 -0
  123. package/src/components/tooltip/examples/index.ts +1 -0
  124. package/src/components/virtualscroll/VirtualScroll.css +13 -0
  125. package/src/components/virtualscroll/VirtualScroll.vue +61 -0
  126. package/src/components/virtualscroll/examples/basic.vue +37 -0
  127. package/src/components/virtualscroll/examples/index.stories.ts +31 -0
  128. package/src/components/virtualscroll/examples/index.ts +1 -0
  129. package/src/composables/element.ts +13 -0
  130. package/src/composables/useCachedUid.ts +48 -0
  131. package/src/composables/useEventListener.ts +14 -0
  132. package/src/composables/useInput.ts +134 -0
  133. package/src/composables/useIsServer.ts +7 -0
  134. package/src/composables/useMount.ts +43 -0
  135. package/src/composables/usePopper.ts +194 -0
  136. package/src/create.ts +34 -0
  137. package/src/css/components.css +14 -0
  138. package/src/css/index.css +4 -0
  139. package/src/css/normalize.css +379 -0
  140. package/src/css/transitions.css +40 -0
  141. package/src/css/variables.css +80 -0
  142. package/src/exports/nuxt.js +33 -0
  143. package/src/exports/nuxt.plugin.js +8 -0
  144. package/src/index.ts +5 -0
  145. package/src/install.ts +8 -0
  146. package/src/shims-vue.d.ts +6 -0
  147. package/src/types/props.ts +3 -0
@@ -0,0 +1 @@
1
+ export { default as MImageBasic } from './basic.vue';
@@ -0,0 +1,27 @@
1
+ export { default as MButton } from './button/Button.vue';
2
+ export { default as MButtonGroup } from './buttongroup/ButtonGroup.vue';
3
+ export { default as MForm } from './form/Form.vue';
4
+ export { default as MInput } from './input/Input.vue';
5
+ export { default as MSelect } from './select/Select.vue';
6
+ export { default as MCheckbox } from './checkbox/Checkbox.vue';
7
+ export { default as MBreadcrumb } from './breadcrumb/Breadcrumb.vue';
8
+ export { default as MBreadcrumbItem } from './breadcrumbitem/BreadcrumbItem.vue';
9
+ // export { default as MVirtualScroll } from './virtualscroll/VirtualScroll.vue';
10
+ export { default as MAvatar } from './avatar/Avatar.vue';
11
+ export { default as MAvatarGroup } from './avatargroup/AvatarGroup.vue';
12
+ export { default as MImage } from './image/Image.vue';
13
+ export { default as MSkeleton } from './skeleton/Skeleton.vue';
14
+ export { default as MLink } from './link/Link.vue';
15
+ export { default as MTooltip } from './tooltip/Tooltip.vue';
16
+ export { default as MTabGroup } from './tab/TabGroup.vue';
17
+ export { default as MTab } from './tab/Tab.vue';
18
+ export { default as MTable } from './table/Table.vue';
19
+ export { default as MTableBody } from './table/TableBody.vue';
20
+ export { default as MTableCell } from './table/TableCell.vue';
21
+ export { default as MTableHead } from './table/TableHead.vue';
22
+ export { default as MTableHeadRow } from './table/TableHeadRow.vue';
23
+ export { default as MTableRow } from './table/TableRow.vue';
24
+ export { default as MDropdown } from './dropdown/Dropdown.vue';
25
+ export { default as MDropdownWrapper } from './dropdown/DropdownWrapper.vue';
26
+ export { default as MDropdownList } from './dropdown/DropdownList.vue';
27
+ export { default as MDropdownItem } from './dropdown/DropdownItem.vue';
@@ -0,0 +1,173 @@
1
+ .m-input__container {
2
+ position: relative;
3
+ display: flex;
4
+ flex-direction: column;
5
+ width: 100%;
6
+ }
7
+
8
+ .m-input {
9
+ --input-height: 40px;
10
+ --input-padding: 0 8px;
11
+ --input-font-size: 15px;
12
+ --input-border-radius: 4px;
13
+ --input-clear-size: 1.2rem;
14
+ --input-background-color: var(--white);
15
+ --input-border-color: var(--gray-200);
16
+
17
+ position: relative;
18
+ display: inline-flex;
19
+ align-items: center;
20
+ height: var(--input-height);
21
+ font-size: var(--input-font-size);
22
+ background-color: var(--input-background-color);
23
+ border: 1px solid var(--input-border-color);
24
+ box-shadow: none;
25
+ border-radius: var(--input-border-radius);
26
+ outline: 0;
27
+ cursor: text;
28
+ transition: color .3s cubic-bezier(0.4, 0, 0.2, 1), background-color .3s cubic-bezier(0.4, 0, 0.2, 1), border-color .3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow .3s cubic-bezier(0.4, 0, 0.2, 1);
29
+ }
30
+
31
+ .m-input.m-input--disabled {
32
+ --input-border-color: var(--gray-300);
33
+ --input-background-color: var(--gray-100);
34
+ opacity: 0.6;
35
+ cursor: not-allowed;
36
+ }
37
+
38
+ .m-input.m-input--disabled input {
39
+ cursor: not-allowed;
40
+ }
41
+
42
+ .m-input:not(.m-input--disabled):focus-within {
43
+ --input-border-color: var(--blue);
44
+ box-shadow: 0 0 0 2px var(--blue-outline);
45
+ }
46
+
47
+ .m-input:not(.m-input--disabled):not(:focus-within):hover {
48
+ --input-border-color: var(--gray-400);
49
+ }
50
+
51
+ .m-input input {
52
+ flex: 1 0 0;
53
+ min-width: 0;
54
+ height: 100%;
55
+ padding: var(--input-padding);
56
+ font-size: inherit;
57
+ color: var(--gray-600);
58
+ background-color: transparent;
59
+ border: 0;
60
+ outline: 0;
61
+ border-radius: var(--input-border-radius);
62
+ }
63
+
64
+ .m-input__clearable {
65
+ display: flex;
66
+ align-items: center;
67
+ justify-content: center;
68
+ padding: 0 6px;
69
+ }
70
+
71
+ .m-input .m-input__clearable i.m-icon--close {
72
+ cursor: pointer;
73
+ width: var(--input-clear-size);
74
+ height: var(--input-clear-size);
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: center;
78
+ border-radius: 100%;
79
+ color: var(--gray-500);
80
+ background-color: transparent;
81
+ transition: background-color .125s cubic-bezier(0.4, 0, 0.2, 1);
82
+ }
83
+
84
+ .m-input .m-input__clearable i.m-icon--close:hover {
85
+ color: var(--gray-500);
86
+ background-color: var(--gray-150);
87
+ }
88
+
89
+ .m-input i.m-icon--close::before {
90
+ --close-icon-size: 16px;
91
+ background-color: currentColor;
92
+ content: "";
93
+ width: var(--close-icon-size);
94
+ height: var(--close-icon-size);
95
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor' class='w-5 h-5'%3E%3Cpath d='M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z' /%3E%3C/svg%3E%0A");
96
+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor' class='w-5 h-5'%3E%3Cpath d='M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z' /%3E%3C/svg%3E%0A");
97
+ -webkit-mask-position: center center;
98
+ mask-position: center center;
99
+ -webkit-mask-repeat: no-repeat;
100
+ mask-repeat: no-repeat;
101
+ -webkit-mask-size: var(--close-icon-size) var(--close-icon-size);
102
+ mask-size: var(--close-icon-size) var(--close-icon-size);
103
+ }
104
+
105
+ .m-input--xs {
106
+ --input-height: 32px;
107
+ --input-padding: 0 8px;
108
+ --input-font-size: 13px;
109
+ --input-border-radius: 4px;
110
+ --input-clear-size: 1.2rem;
111
+ }
112
+
113
+ .m-input--sm {
114
+ --input-height: 36px;
115
+ --input-padding: 0 8px;
116
+ --input-font-size: 14px;
117
+ --input-border-radius: 4px;
118
+ --input-clear-size: 1.2rem;
119
+ }
120
+
121
+ .m-input--md {
122
+ --input-height: 40px;
123
+ --input-padding: 0 8px;
124
+ --input-font-size: 15px;
125
+ --input-border-radius: 4px;
126
+ --input-clear-size: 1.2rem;
127
+ }
128
+
129
+ .m-input--lg {
130
+ --input-height: 42px;
131
+ --input-padding: 0 8px;
132
+ --input-font-size: 16px;
133
+ --input-border-radius: 4px;
134
+ --input-clear-size: 1.2rem;
135
+ }
136
+
137
+ .m-input--xl {
138
+ --input-height: 46px;
139
+ --input-padding: 0 8px;
140
+ --input-font-size: 18px;
141
+ --input-border-radius: 6px;
142
+ --input-clear-size: 1.2rem;
143
+ }
144
+
145
+ .m-input__label {
146
+ margin-bottom: 5px;
147
+ color: var(--gray-600);
148
+ font-size: 15px;
149
+ font-weight: 600;
150
+ }
151
+
152
+ .m-input__help {
153
+ margin-top: 4px;
154
+ color: var(--gray-500);
155
+ font-size: 15px;
156
+ font-weight: 400;
157
+ }
158
+
159
+ .m-input__error {
160
+ margin: 4px 0 8px 0;
161
+ color: var(--red);
162
+ font-size: 15px;
163
+ font-weight: 400;
164
+ }
165
+
166
+ .m-form .m-form__input {
167
+ margin-bottom: 16px;
168
+ }
169
+
170
+ .m-form .m-form__input .m-input__error {
171
+ margin: 4px 0 0 0;
172
+ }
173
+
@@ -0,0 +1,176 @@
1
+ <template>
2
+ <div :class="wrapperComputedClasses" ref="container">
3
+ <label v-if="label" :for="id" class="m-input__label" :id="`${id}-label`">
4
+ {{ label }}
5
+ </label>
6
+
7
+ <div :class="inputComputedClasses">
8
+ <div v-if="hasPrefix" class="m-input__prefix">
9
+ <slot name="prefix" />
10
+ </div>
11
+ <input
12
+ ref="input"
13
+ :id="id"
14
+ :type="inputType"
15
+ :placeholder="placeholder"
16
+ :name="name"
17
+ :value="modelValue || ''"
18
+ :readonly="readonly"
19
+ v-on="listeners"
20
+ v-bind="$attrs"
21
+ :disabled="disabled || loading"
22
+ :aria-disabled="disabled ? 'true' : 'false'"
23
+ :aria-labelledby="`${id}-label`"
24
+ />
25
+ <div v-if="hasSuffix" class="m-input__suffix">
26
+ <slot name="suffix" />
27
+ </div>
28
+ </div>
29
+ <p v-if="help && !inputError" class="m-input__help">
30
+ {{ help }}
31
+ </p>
32
+ <p v-else-if="inputError" class="m-input__error">
33
+ {{ inputError }}
34
+ </p>
35
+ </div>
36
+ </template>
37
+
38
+ <script lang="ts">
39
+ import type { PropType } from "vue";
40
+ import type { Size } from "../../types/props";
41
+ import {
42
+ defineComponent,
43
+ ref,
44
+ computed,
45
+ toRef,
46
+ } from "vue";
47
+ import { useInput } from "../../composables/useInput";
48
+ export default defineComponent({
49
+ name: 'MInput',
50
+ emits: useInput.emits(),
51
+ props: {
52
+ ...useInput.props(),
53
+ label: {
54
+ type: String
55
+ },
56
+ size: {
57
+ type: String as PropType<Size>,
58
+ default: 'md',
59
+ },
60
+ type: {
61
+ type: String,
62
+ default: 'text',
63
+ validator: (value: string) => ['text', 'password', 'number'].includes(value)
64
+ },
65
+ placeholder: {
66
+ type: String,
67
+ default: ''
68
+ },
69
+ loading: {
70
+ type: Boolean,
71
+ default: false
72
+ },
73
+ readonly: {
74
+ type: Boolean,
75
+ default: false
76
+ },
77
+ disabled: {
78
+ type: Boolean,
79
+ default: false
80
+ },
81
+ help: {
82
+ type: String,
83
+ default: ''
84
+ }
85
+ },
86
+ setup(props, { slots, emit }) {
87
+ const focus = () => {};
88
+ const {
89
+ id,
90
+ insideForm,
91
+ reset,
92
+ listeners,
93
+ validate,
94
+ setError,
95
+ formError,
96
+ formDisabled,
97
+ formLoading
98
+ } = useInput(props, { focus, emit });
99
+
100
+ const input = ref<HTMLInputElement>();
101
+ const focused = ref(false);
102
+ const showPassword = ref(false);
103
+ const name = toRef(props, 'name');
104
+
105
+ const hasPrefix = computed(() => !!(slots.prefix));
106
+ const hasSuffix = computed(() => !!(slots.suffix));
107
+ const disabled = computed(() => formDisabled || props.disabled);
108
+ const loading = computed(() => formLoading || props.loading);
109
+
110
+ const inputType = computed(() => {
111
+ const type = props.type;
112
+ if (type === 'password') {
113
+ return showPassword.value ? 'text' : 'password';
114
+ }
115
+
116
+ return type;
117
+ });
118
+
119
+ const readonly = computed(() => (props.loading || props.readonly));
120
+
121
+ const wrapperComputedClasses = computed(() => {
122
+ return [
123
+ 'm-input__container',
124
+ {
125
+ 'm-form__input': insideForm
126
+ }
127
+ ]
128
+ });
129
+
130
+ const inputComputedClasses = computed(() => {
131
+ return [
132
+ 'm-input',
133
+ `m-input--${props.size}`,
134
+ {
135
+ 'm-input--disabled': disabled.value || loading.value,
136
+ 'm-input--readonly': readonly.value,
137
+ 'm-input--focused': focused.value,
138
+ 'm-input--error': inputError.value,
139
+ 'm-input--prefix': hasPrefix.value,
140
+ 'm-input--suffix': hasSuffix.value,
141
+ 'm-input--loading': props.loading,
142
+ 'm-input--password': props.type === 'password'
143
+ }
144
+ ]
145
+ });
146
+
147
+ const inputError = computed(() => {
148
+ return formError.value || props.error;
149
+ });
150
+
151
+ const onClear = () => {
152
+ emit('update:modelValue', '');
153
+ };
154
+
155
+ return {
156
+ id,
157
+ inputType,
158
+ disabled,
159
+ loading,
160
+ readonly,
161
+ inputComputedClasses,
162
+ wrapperComputedClasses,
163
+ name,
164
+ hasPrefix,
165
+ hasSuffix,
166
+ inputError,
167
+
168
+ onClear,
169
+ focus,
170
+ validate,
171
+ setError,
172
+ listeners
173
+ }
174
+ }
175
+ })
176
+ </script>
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <MInput
3
+ label="Email"
4
+ name="email"
5
+ placeholder="Email Address"
6
+ />
7
+ </template>
@@ -0,0 +1,24 @@
1
+ import MInput from "../Input.vue";
2
+ import {
3
+ MInputBasic,
4
+ MInputSuffix,
5
+ MInputPrefix,
6
+ MInputSizes
7
+ } from "./index";
8
+
9
+ import {
10
+ createStory, sizeArgType
11
+ } from "@/__storybook__";
12
+
13
+ export default {
14
+ component: MInput,
15
+ title: 'Components/Input',
16
+ argTypes: {
17
+ ...sizeArgType()
18
+ }
19
+ }
20
+
21
+ export const Basic = createStory(MInputBasic);
22
+ export const Suffix = createStory(MInputSuffix);
23
+ export const Prefix = createStory(MInputPrefix);
24
+ export const Sizes = createStory(MInputSizes);
@@ -0,0 +1,4 @@
1
+ export { default as MInputBasic } from './basic.vue';
2
+ export { default as MInputSuffix } from './suffix.vue';
3
+ export { default as MInputPrefix } from './prefix.vue';
4
+ export { default as MInputSizes } from './sizes.vue';
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <MInput placeholder="Brad Veryard" name="name">
3
+ <template #prefix>
4
+ Prefix
5
+ </template>
6
+ </MInput>
7
+ </template>
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <div>
3
+ <MInput clearable name="field_one" size="xs" /><br /><br />
4
+ <MInput clearable name="field_two" size="sm" /><br /><br />
5
+ <MInput clearable name="field_three" /><br /><br />
6
+ <MInput clearable name="field_four" size="lg" /><br /><br />
7
+ <MInput clearable name="field_five" size="xl" /><br /><br />
8
+ </div>
9
+ </template>
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <MInput placeholder="Brad Veryard" name="name">
3
+ <template #suffix>
4
+ Suffix
5
+ </template>
6
+ </MInput>
7
+ </template>
@@ -0,0 +1,147 @@
1
+ .m-link {
2
+ --link-color: var(--blue);
3
+ --link-color-hover: var(--blue-hover);
4
+ --link-color-focus: var(--blue-focus);
5
+ --link-color-visited: var(--blue-focus);
6
+ color: var(--link-color);
7
+ text-decoration: none;
8
+ transition: color .3s cubic-bezier(0.4, 0, 0.2, 1);
9
+ }
10
+
11
+ .m-link--underline {
12
+ text-decoration: underline;
13
+ }
14
+
15
+ .m-link--block {
16
+ display: flex;
17
+ }
18
+
19
+ .m-link:visited {
20
+ color: var(--link-color-visited);
21
+ }
22
+
23
+ .m-link:hover {
24
+ color: var(--link-color-hover);
25
+ text-decoration: underline;
26
+ }
27
+
28
+ .m-link:focus,
29
+ .m-link:active {
30
+ color: var(--link-color-focus);
31
+ }
32
+
33
+ .m-link--blue {
34
+ --link-color: var(--blue);
35
+ --link-color-hover: var(--blue-hover);
36
+ --link-color-focus: var(--blue-focus);
37
+ --link-color-visited: var(--blue-focus);
38
+ }
39
+
40
+ .m-link--blue:visited {
41
+ --link-color: var(--blue);
42
+ --link-color-hover: var(--blue-hover);
43
+ --link-color-focus: var(--blue-focus);
44
+ --link-color-visited: var(--blue-focus);
45
+ }
46
+
47
+ .m-link--blue:hover {
48
+ --link-color: var(--blue-hover);
49
+ --link-color-hover: var(--blue-hover);
50
+ --link-color-focus: var(--blue-focus);
51
+ --link-color-visited: var(--blue-focus);
52
+ }
53
+
54
+ .m-link--blue:focus,
55
+ .m-link--blue:active {
56
+ --link-color: var(--blue-focus);
57
+ --link-color-hover: var(--blue-focus);
58
+ --link-color-focus: var(--blue-focus);
59
+ --link-color-visited: var(--blue-focus);
60
+ }
61
+
62
+ .m-link--green {
63
+ --link-color: var(--green);
64
+ --link-color-hover: var(--green-hover);
65
+ --link-color-focus: var(--green-focus);
66
+ --link-color-visited: var(--green-focus);
67
+ }
68
+
69
+ .m-link--green:visited {
70
+ --link-color: var(--green);
71
+ --link-color-hover: var(--green-hover);
72
+ --link-color-focus: var(--green-focus);
73
+ --link-color-visited: var(--green-focus);
74
+ }
75
+
76
+ .m-link--green:hover {
77
+ --link-color: var(--green-hover);
78
+ --link-color-hover: var(--green-hover);
79
+ --link-color-focus: var(--green-focus);
80
+ --link-color-visited: var(--green-focus);
81
+ }
82
+
83
+ .m-link--green:focus,
84
+ .m-link--green:active {
85
+ --link-color: var(--green-focus);
86
+ --link-color-hover: var(--green-focus);
87
+ --link-color-focus: var(--green-focus);
88
+ --link-color-visited: var(--green-focus);
89
+ }
90
+
91
+ .m-link--red {
92
+ --link-color: var(--red);
93
+ --link-color-hover: var(--red-hover);
94
+ --link-color-focus: var(--red-focus);
95
+ --link-color-visited: var(--red-focus);
96
+ }
97
+
98
+ .m-link--red:visited {
99
+ --link-color: var(--red);
100
+ --link-color-hover: var(--red-hover);
101
+ --link-color-focus: var(--red-focus);
102
+ --link-color-visited: var(--red-focus);
103
+ }
104
+
105
+ .m-link--red:hover {
106
+ --link-color: var(--red-hover);
107
+ --link-color-hover: var(--red-hover);
108
+ --link-color-focus: var(--red-focus);
109
+ --link-color-visited: var(--red-focus);
110
+ }
111
+
112
+ .m-link--red:focus,
113
+ .m-link--red:active {
114
+ --link-color: var(--red-focus);
115
+ --link-color-hover: var(--red-focus);
116
+ --link-color-focus: var(--red-focus);
117
+ --link-color-visited: var(--red-focus);
118
+ }
119
+
120
+ .m-link--yellow {
121
+ --link-color: var(--yellow);
122
+ --link-color-hover: var(--yellow-hover);
123
+ --link-color-focus: var(--yellow-focus);
124
+ --link-color-visited: var(--yellow-focus);
125
+ }
126
+
127
+ .m-link--yellow:visited {
128
+ --link-color: var(--yellow);
129
+ --link-color-hover: var(--yellow-hover);
130
+ --link-color-focus: var(--yellow-focus);
131
+ --link-color-visited: var(--yellow-focus);
132
+ }
133
+
134
+ .m-link--yellow:hover {
135
+ --link-color: var(--yellow-hover);
136
+ --link-color-hover: var(--yellow-hover);
137
+ --link-color-focus: var(--yellow-focus);
138
+ --link-color-visited: var(--yellow-focus);
139
+ }
140
+
141
+ .m-link--yellow:focus,
142
+ .m-link--yellow:active {
143
+ --link-color: var(--yellow-focus);
144
+ --link-color-hover: var(--yellow-focus);
145
+ --link-color-focus: var(--yellow-focus);
146
+ --link-color-visited: var(--yellow-focus);
147
+ }
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <component :is="tag" :to="to" :class="computedClasses" :disabled="disabled">
3
+ <slot />
4
+ </component>
5
+ </template>
6
+
7
+ <script lang="ts">
8
+ import type { Color } from "../../types/props";
9
+ import { computed, defineComponent, type PropType } from "vue";
10
+
11
+ export default defineComponent({
12
+ name: "MLink",
13
+ props: {
14
+ color: {
15
+ type: String as PropType<Color>
16
+ },
17
+ disabled: {
18
+ type: Boolean,
19
+ default: false
20
+ },
21
+ block: {
22
+ type: Boolean,
23
+ default: false
24
+ },
25
+ underline: {
26
+ type: Boolean,
27
+ default: false
28
+ },
29
+ to: [String, Object]
30
+ },
31
+ setup(props) {
32
+ const computedClasses = computed(() => {
33
+ return [
34
+ 'm-link',
35
+ {
36
+ [`m-link--${props.color}`]: props.color,
37
+ 'm-link--underline': props.underline,
38
+ 'm-link--block': props.block,
39
+ 'm-link--disabled': props.disabled,
40
+ 'm-link--external': tag.value === 'a'
41
+ }
42
+ ]
43
+ });
44
+
45
+ const tag = computed(() => (props.to ? 'router-link' : 'a'));
46
+
47
+ return {
48
+ computedClasses,
49
+ tag
50
+ }
51
+ }
52
+ })
53
+ </script>
54
+
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <MLink href="https://www.google.com">Google</MLink>
3
+ </template>
@@ -0,0 +1,20 @@
1
+ import MLink from "../Link.vue";
2
+
3
+ import {
4
+ MLinkBasic
5
+ } from "./index";
6
+
7
+ import {
8
+ createStory,
9
+ colorArgType
10
+ } from "@/__storybook__";
11
+
12
+ export default {
13
+ component: MLink,
14
+ title: 'Components/Link',
15
+ argTypes: {
16
+ ...colorArgType()
17
+ }
18
+ }
19
+
20
+ export const Basic = createStory(MLinkBasic);
@@ -0,0 +1 @@
1
+ export { default as MLinkBasic } from './basic.vue';