@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,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,76 @@
1
+ <template>
2
+ <div
3
+ v-if="show"
4
+ class="m-message__wrapper"
5
+ >
6
+ <div class="m-message">
7
+ {{ content }}
8
+ </div>
9
+ </div>
10
+ </template>
11
+
12
+ <script lang="ts">
13
+ import { defineComponent, onMounted, ref } from 'vue';
14
+ import type { PropType } from 'vue';
15
+
16
+ export default defineComponent({
17
+ name: 'MMessage',
18
+ props: {
19
+ onInternalAfterLeave: Function as PropType<(key: string) => void>,
20
+ internalKey: {
21
+ type: String,
22
+ required: true
23
+ },
24
+ content: {
25
+ type: [String]
26
+ },
27
+ type: {
28
+ type: String,
29
+ default: 'default'
30
+ },
31
+ timeout: {
32
+ type: Number,
33
+ default: 10000
34
+ },
35
+ showClose: {
36
+ type: Boolean,
37
+ default: true
38
+ },
39
+ onClose: {
40
+ type: Function,
41
+ default: () => { }
42
+ }
43
+ },
44
+ setup(props) {
45
+ let timerId: number | null = null;
46
+ const showRef = ref<boolean>(true);
47
+
48
+ onMounted(() => {
49
+ setHideTimeout();
50
+ });
51
+
52
+ function setHideTimeout(): void {
53
+ const { timeout } = props;
54
+ if (timeout) {
55
+ timerId = window.setTimeout(hide, timeout);
56
+ }
57
+ }
58
+
59
+ function hide(): void {
60
+ showRef.value = false
61
+ if (timerId) {
62
+ window.clearTimeout(timerId)
63
+ timerId = null
64
+ if (props.onInternalAfterLeave) {
65
+ props.onInternalAfterLeave(props.internalKey)
66
+ }
67
+ }
68
+ }
69
+
70
+ return {
71
+ show: showRef,
72
+ hide,
73
+ }
74
+ }
75
+ })
76
+ </script>
@@ -0,0 +1,36 @@
1
+ .m-message-provider__container {
2
+ z-index: 5000;
3
+ position: fixed;
4
+ height: 0;
5
+ overflow: visible;
6
+ display: flex;
7
+ flex-direction: column;
8
+ align-items: center;
9
+ }
10
+
11
+ .m-message-provider__container--top {
12
+ top: 12px;
13
+ left: 0;
14
+ right: 0;
15
+ }
16
+
17
+ .m-message__wrapper {
18
+ margin: 0 0 8px 0;
19
+ z-index: 0;
20
+ transform-origin: top center;
21
+ display: flex;
22
+ align-items: center;
23
+ }
24
+
25
+ .m-message {
26
+ box-sizing: border-box;
27
+ display: flex;
28
+ align-items: center;
29
+ padding: 10px 20px;
30
+ border-radius: 3px;
31
+ flex-wrap: nowrap;
32
+ max-width: 720px;
33
+ color: var(--gray-700);
34
+ background-color: var(--white);
35
+ box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
36
+ }
@@ -0,0 +1,142 @@
1
+ <template>
2
+ <slot />
3
+ <template v-if="messageList.length">
4
+ <Teleport :to="teleportTo ?? 'body'">
5
+ <div :class="[
6
+ `m-message-provider__container`,
7
+ `m-message-provider__container--${placement}`
8
+ ]">
9
+ <MMessage v-for="message in messageList"
10
+ :key="message.key"
11
+ :internalKey="message.key"
12
+ :content="message.content"
13
+ :timeout="message.timeout ?? timeout"
14
+ ref="messageRefs"
15
+ :on-internal-after-leave="onInternalAfterLeave" />
16
+ </div>
17
+
18
+ </Teleport>
19
+ </template>
20
+ </template>
21
+
22
+ <script lang="ts">
23
+ import {
24
+ ref,
25
+ reactive,
26
+ Teleport,
27
+ defineComponent,
28
+ provide
29
+ } from 'vue';
30
+ import type { MessageType, MessageReactive, MessageOptions, MessageApiInjection, ContentType } from './types';
31
+ import type { PropType } from 'vue';
32
+ import MMessage from './Message.vue';
33
+ import { useCachedUid } from '@/composables/useCachedUid';
34
+
35
+ export type MessageProviderInst = MessageApiInjection;
36
+
37
+ interface PrivateMessageReactive extends MessageReactive {
38
+ key: string
39
+ }
40
+
41
+ interface PrivateMessageRef extends MessageReactive {
42
+ key: string
43
+ hide: () => void
44
+ }
45
+
46
+ export default defineComponent({
47
+ name: 'MMessageProvider',
48
+ components: {
49
+ MMessage
50
+ },
51
+ props: {
52
+ teleportTo: {
53
+ type: String,
54
+ default: 'body'
55
+ },
56
+ placement: {
57
+ type: String as PropType<
58
+ | 'top'
59
+ | 'top-left'
60
+ | 'top-right'
61
+ | 'bottom'
62
+ | 'bottom-left'
63
+ | 'bottom-right'
64
+ >,
65
+ default: 'top'
66
+ },
67
+ timeout: {
68
+ type: Number,
69
+ default: 3000
70
+ }
71
+ },
72
+ setup(props, { slots }) {
73
+ const messageListRef = ref<PrivateMessageReactive[]>([]);
74
+ const messageRefs = ref<Record<string, PrivateMessageRef>>({});
75
+ const api: MessageApiInjection = {
76
+ create(content: ContentType, options?: MessageOptions) {
77
+ return create(content, { type: 'default', ...options })
78
+ },
79
+ info(content: ContentType, options?: MessageOptions) {
80
+ return create(content, { ...options, type: 'info' })
81
+ },
82
+ success(content: ContentType, options?: MessageOptions) {
83
+ return create(content, { ...options, type: 'success' })
84
+ },
85
+ warning(content: ContentType, options?: MessageOptions) {
86
+ return create(content, { ...options, type: 'warning' })
87
+ },
88
+ error(content: ContentType, options?: MessageOptions) {
89
+ return create(content, { ...options, type: 'error' })
90
+ },
91
+ loading(content: ContentType, options?: MessageOptions) {
92
+ return create(content, { ...options, type: 'loading' })
93
+ },
94
+ destroyAll
95
+ };
96
+
97
+ provide('m-message', api);
98
+
99
+ function create(
100
+ content: ContentType,
101
+ options: MessageOptions & { type: MessageType }
102
+ ): MessageReactive {
103
+ const { id } = useCachedUid('m-message');
104
+ const key = id.value;
105
+ const messageReactive = reactive({
106
+ ...options,
107
+ content,
108
+ key,
109
+ destroy: () => {
110
+ messageRefs.value[key].hide();
111
+ }
112
+ });
113
+
114
+ messageListRef.value.push(messageReactive);
115
+ return messageReactive;
116
+ }
117
+
118
+ function destroyAll(): void {
119
+ //@ts-ignore
120
+ Object.values(messageRefs.value).forEach((messageRef) => {
121
+ messageRef.hide();
122
+ });
123
+ }
124
+
125
+ function onInternalAfterLeave(key: string): void {
126
+ messageListRef.value = messageListRef.value.filter(
127
+ (message) => message.key !== key
128
+ );
129
+ delete messageRefs.value[key];
130
+ }
131
+
132
+ return Object.assign(
133
+ {
134
+ messageRefs,
135
+ messageList: messageListRef,
136
+ onInternalAfterLeave
137
+ },
138
+ api
139
+ )
140
+ }
141
+ });
142
+ </script>
@@ -0,0 +1,39 @@
1
+ import type { VNodeChild } from 'vue';
2
+
3
+ export type ContentType = string;
4
+ export type MessageType =
5
+ | 'info'
6
+ | 'success'
7
+ | 'warning'
8
+ | 'error'
9
+ | 'loading'
10
+ | 'default'
11
+
12
+ export type MessageRenderMessage = (props: any) => VNodeChild
13
+
14
+ export interface MessageOptions {
15
+ type?: MessageType
16
+ render?: MessageRenderMessage
17
+ timeout?: number
18
+ closable?: boolean
19
+ onClose?: () => void
20
+ }
21
+
22
+ export interface MessageReactive {
23
+ content: ContentType
24
+ timeout?: number
25
+ closable?: boolean
26
+ type: MessageType
27
+ onClose?: () => void
28
+ destroy: () => void
29
+ }
30
+
31
+ export interface MessageApiInjection {
32
+ create: (content: ContentType, options?: MessageOptions) => MessageReactive
33
+ info: (content: ContentType, options?: MessageOptions) => MessageReactive
34
+ success: (content: ContentType, options?: MessageOptions) => MessageReactive
35
+ warning: (content: ContentType, options?: MessageOptions) => MessageReactive
36
+ error: (content: ContentType, options?: MessageOptions) => MessageReactive
37
+ loading: (content: ContentType, options?: MessageOptions) => MessageReactive
38
+ destroyAll: () => void
39
+ }
@@ -0,0 +1,12 @@
1
+ import { inject } from 'vue'
2
+ import type { MessageApiInjection } from './types'
3
+
4
+ export function useMessage(): MessageApiInjection {
5
+ const api = inject('m-message', null);
6
+
7
+ if(api === null) {
8
+ throw new Error('m-message api is not provided, ensure the component is wrapped in <m-message-provider />.');
9
+ }
10
+
11
+ return api;
12
+ }