@teammodlr/ui-kit 2.0.4 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/dropdown/Dropdown.vue.d.ts +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/messageprovider/Message.vue.d.ts +1 -1
- package/lib/components/messageprovider/MessageProvider.vue.d.ts +1 -1
- package/lib/components/pagination/Pagination.vue.d.ts +75 -0
- package/lib/components/pagination/style/Pagination.css.d.ts +10 -0
- package/lib/components/pagination/style/index.d.ts +1 -0
- package/lib/components/select/Select.vue.d.ts +1 -1
- package/lib/components/table/TableHead.vue.d.ts +11 -1
- package/lib/components/tooltip/Tooltip.vue.d.ts +2 -0
- package/lib/components/tooltip/style/Tooltip.css.d.ts +4 -0
- package/lib/composables/usePopperV2.d.ts +231 -0
- package/lib/index.cjs.js +4 -4
- package/lib/index.es.js +2336 -2097
- package/lib/style.css +1 -1
- package/package.json +11 -11
- package/src/components/colorpicker/ColorPicker.vue +4 -3
- package/src/components/form/examples/basic.vue +1 -1
- package/src/components/index.ts +1 -0
- package/src/components/pagination/Pagination.vue +230 -0
- package/src/components/pagination/examples/basic.vue +18 -0
- package/src/components/pagination/examples/index.stories.ts +15 -0
- package/src/components/pagination/examples/index.ts +1 -0
- package/src/components/pagination/style/Pagination.css.ts +88 -0
- package/src/components/pagination/style/index.ts +1 -0
- package/src/components/radio/Radio.vue +1 -1
- package/src/components/radiobutton/RadioButton.vue +2 -2
- package/src/components/table/Table.vue +4 -0
- package/src/components/table/TableHead.vue +26 -2
- package/src/components/table/examples/basic.vue +4 -0
- package/src/components/table/examples/empty.vue +44 -0
- package/src/components/table/examples/index.stories.ts +2 -1
- package/src/components/table/examples/index.ts +1 -0
- package/src/components/tooltip/Tooltip.vue +7 -5
- package/src/components/tooltip/examples/index.stories.ts +2 -1
- package/src/components/tooltip/examples/index.ts +1 -0
- package/src/components/tooltip/examples/placement.vue +9 -0
- package/src/components/tooltip/style/Tooltip.css.ts +44 -1
- package/src/composables/useInput.ts +2 -2
- package/src/composables/usePopper.ts +1 -1
- package/src/composables/usePopperV2.ts +89 -0
- package/src/examples/cards/cards.stories.ts +2 -2
- package/src/types/popper.d.ts +14 -0
- package/src/components/table/Table.css +0 -45
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<th>
|
|
2
|
+
<th :style="computedStyles">
|
|
3
3
|
<slot />
|
|
4
4
|
</th>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
8
|
-
import { defineComponent } from "vue";
|
|
8
|
+
import { computed, defineComponent } from "vue";
|
|
9
9
|
|
|
10
10
|
export default defineComponent({
|
|
11
11
|
name: "TableHead",
|
|
@@ -16,6 +16,30 @@ export default defineComponent({
|
|
|
16
16
|
sortable: {
|
|
17
17
|
type: Boolean,
|
|
18
18
|
default: false
|
|
19
|
+
},
|
|
20
|
+
width: {
|
|
21
|
+
type: [Number, String]
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
setup(props) {
|
|
25
|
+
|
|
26
|
+
const computedWidth = computed(() => {
|
|
27
|
+
if (isNaN(Number(props.width))) {
|
|
28
|
+
return props.width;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return `${props.width}px`;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const computedStyles = computed(() => {
|
|
35
|
+
// if string is passed, return it
|
|
36
|
+
return {
|
|
37
|
+
width: computedWidth.value
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
computedStyles
|
|
19
43
|
}
|
|
20
44
|
}
|
|
21
45
|
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MTable
|
|
3
|
+
:headers="headers"
|
|
4
|
+
:items="items"
|
|
5
|
+
>
|
|
6
|
+
<template #actions="{ item }">
|
|
7
|
+
<MButton
|
|
8
|
+
color="blue"
|
|
9
|
+
secondary
|
|
10
|
+
size="sm"
|
|
11
|
+
>
|
|
12
|
+
Edit - {{ item.name }}
|
|
13
|
+
</MButton>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<template #empty>
|
|
17
|
+
Nothing here
|
|
18
|
+
</template>
|
|
19
|
+
</MTable>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { ref } from "vue";
|
|
24
|
+
import type { TableHeadItem } from "../types";
|
|
25
|
+
|
|
26
|
+
let headers = ref<TableHeadItem[]>([
|
|
27
|
+
{
|
|
28
|
+
name: "Name",
|
|
29
|
+
key: "name",
|
|
30
|
+
width: 500
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "Age",
|
|
34
|
+
key: "age",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "Actions",
|
|
38
|
+
key: "actions",
|
|
39
|
+
align: "right"
|
|
40
|
+
}
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
let items = ref([]);
|
|
44
|
+
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import MTable from "../Table.vue";
|
|
2
2
|
import MButton from "../../button/Button.vue";
|
|
3
3
|
import {
|
|
4
|
-
MTableBasic
|
|
4
|
+
MTableBasic, MTableEmpty
|
|
5
5
|
} from "./index";
|
|
6
6
|
|
|
7
7
|
import {
|
|
@@ -17,3 +17,4 @@ export default {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const Basic = createStory(MTableBasic);
|
|
20
|
+
export const Empty = createStory(MTableEmpty);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span
|
|
3
3
|
v-bind="$attrs"
|
|
4
|
+
style="display: inline-flex"
|
|
4
5
|
@mouseenter="() => { isOpen = true }"
|
|
5
6
|
@mouseleave="() => { isOpen = false }"
|
|
6
7
|
ref="wrapper"
|
|
@@ -69,13 +70,13 @@ export default defineComponent({
|
|
|
69
70
|
const offset = computed(() => {
|
|
70
71
|
switch(placement.value) {
|
|
71
72
|
case 'top':
|
|
72
|
-
return [
|
|
73
|
+
return [8, 0];
|
|
73
74
|
case 'bottom':
|
|
74
|
-
return [
|
|
75
|
+
return [-8, 0];
|
|
75
76
|
case 'left':
|
|
76
|
-
return [
|
|
77
|
+
return [0, 8];
|
|
77
78
|
case 'right':
|
|
78
|
-
return [
|
|
79
|
+
return [0, 8];
|
|
79
80
|
}
|
|
80
81
|
});
|
|
81
82
|
|
|
@@ -109,7 +110,8 @@ export default defineComponent({
|
|
|
109
110
|
transferTo,
|
|
110
111
|
isOpen,
|
|
111
112
|
computedClasses,
|
|
112
|
-
zIndex
|
|
113
|
+
zIndex,
|
|
114
|
+
style
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
117
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import MTooltip from "../Tooltip.vue";
|
|
2
2
|
import MButton from "@/components/button/Button.vue";
|
|
3
3
|
import {
|
|
4
|
-
MTooltipBasic
|
|
4
|
+
MTooltipBasic, MTooltipPlacement
|
|
5
5
|
} from "./index";
|
|
6
6
|
|
|
7
7
|
import {
|
|
@@ -19,3 +19,4 @@ export default {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export const Basic = createStory(MTooltipBasic);
|
|
22
|
+
export const Placement = createStory(MTooltipPlacement);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {createVar, style} from '@vanilla-extract/css';
|
|
1
|
+
import {createVar, globalKeyframes, style} from '@vanilla-extract/css';
|
|
2
2
|
import { themeVars } from "../../../styles/theme.css";
|
|
3
3
|
|
|
4
4
|
|
|
@@ -7,6 +7,15 @@ export const vars = {
|
|
|
7
7
|
color: createVar(),
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
export const wrapper = style({
|
|
11
|
+
position: 'relative',
|
|
12
|
+
display: 'inline-flex'
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const container = style({
|
|
16
|
+
zIndex: 50,
|
|
17
|
+
});
|
|
18
|
+
|
|
10
19
|
export const tooltip = style({
|
|
11
20
|
vars: {
|
|
12
21
|
[vars.backgroundColor]: themeVars.color.gray[900],
|
|
@@ -14,6 +23,7 @@ export const tooltip = style({
|
|
|
14
23
|
},
|
|
15
24
|
zIndex: 50,
|
|
16
25
|
transition: 'opacity 0.3s, ease',
|
|
26
|
+
position: 'fixed',
|
|
17
27
|
fontSize: "13px",
|
|
18
28
|
fontWeight: 'normal',
|
|
19
29
|
color: vars.color,
|
|
@@ -46,3 +56,36 @@ export const reverse = style({
|
|
|
46
56
|
[vars.color]: themeVars.color.gray[900],
|
|
47
57
|
}
|
|
48
58
|
});
|
|
59
|
+
|
|
60
|
+
const fadeOutAnimation = "fade-out-animation";
|
|
61
|
+
globalKeyframes(fadeOutAnimation, {
|
|
62
|
+
'from': {
|
|
63
|
+
opacity: 1,
|
|
64
|
+
},
|
|
65
|
+
'to': {
|
|
66
|
+
opacity: 0,
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const fadeInAnimation = "fade-in-animation";
|
|
71
|
+
globalKeyframes(fadeInAnimation, {
|
|
72
|
+
'0%': {
|
|
73
|
+
opacity: 0,
|
|
74
|
+
},
|
|
75
|
+
'100%': {
|
|
76
|
+
opacity: 1,
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export const fadeEnter = style({
|
|
81
|
+
animationName: fadeInAnimation,
|
|
82
|
+
animationDuration: '0.125s',
|
|
83
|
+
animationTimingFunction: 'ease-in-out',
|
|
84
|
+
transition: themeVars.transition.default,
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
export const fadeLeave = style({
|
|
88
|
+
animationName: fadeOutAnimation,
|
|
89
|
+
animationDuration: '0.2s',
|
|
90
|
+
animationTimingFunction: 'ease-in-out',
|
|
91
|
+
})
|
|
@@ -104,9 +104,9 @@ export const useInput = (props: any, { focus, emit, withListeners = true }: {
|
|
|
104
104
|
validate,
|
|
105
105
|
setError,
|
|
106
106
|
//@ts-ignore
|
|
107
|
-
formDisabled: form
|
|
107
|
+
formDisabled: form?.disabled.value || false,
|
|
108
108
|
//@ts-ignore
|
|
109
|
-
formLoading: form
|
|
109
|
+
formLoading: form?.loading.value || false,
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
112
|
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ref, onMounted, watchEffect, unref } from 'vue'
|
|
2
|
+
import type { Ref } from 'vue'
|
|
3
|
+
import { popperGenerator, defaultModifiers } from '@popperjs/core/lib/popper-lite'
|
|
4
|
+
import type { Instance, VirtualElement } from '@popperjs/core'
|
|
5
|
+
import flip from '@popperjs/core/lib/modifiers/flip'
|
|
6
|
+
import offset from '@popperjs/core/lib/modifiers/offset'
|
|
7
|
+
import preventOverflow from '@popperjs/core/lib/modifiers/preventOverflow'
|
|
8
|
+
import computeStyles from '@popperjs/core/lib/modifiers/computeStyles'
|
|
9
|
+
import eventListeners from '@popperjs/core/lib/modifiers/eventListeners'
|
|
10
|
+
import type { PopperOptions } from 'src/types/popper'
|
|
11
|
+
import { unrefElement } from '@vueuse/core'
|
|
12
|
+
import type { MaybeElement } from '@vueuse/core'
|
|
13
|
+
|
|
14
|
+
export const createPopper = popperGenerator({
|
|
15
|
+
defaultModifiers: [
|
|
16
|
+
...defaultModifiers,
|
|
17
|
+
offset,
|
|
18
|
+
flip,
|
|
19
|
+
preventOverflow,
|
|
20
|
+
computeStyles,
|
|
21
|
+
eventListeners
|
|
22
|
+
]
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export function usePopper ({
|
|
26
|
+
locked = false,
|
|
27
|
+
overflowPadding = 8,
|
|
28
|
+
offsetDistance = 8,
|
|
29
|
+
offsetSkid = 0,
|
|
30
|
+
gpuAcceleration = true,
|
|
31
|
+
adaptive = true,
|
|
32
|
+
scroll = true,
|
|
33
|
+
resize = true,
|
|
34
|
+
placement,
|
|
35
|
+
strategy
|
|
36
|
+
}: PopperOptions, virtualReference?: Ref<Element | VirtualElement>) {
|
|
37
|
+
const reference = ref<MaybeElement>(null)
|
|
38
|
+
const popper = ref<MaybeElement>(null)
|
|
39
|
+
const instance = ref<Instance | null>(null)
|
|
40
|
+
|
|
41
|
+
onMounted(() => {
|
|
42
|
+
watchEffect((onInvalidate) => {
|
|
43
|
+
if (!popper.value) { return }
|
|
44
|
+
if (!reference.value && !virtualReference?.value) { return }
|
|
45
|
+
|
|
46
|
+
const popperEl = unrefElement(popper)
|
|
47
|
+
const referenceEl = virtualReference?.value || unrefElement(reference)
|
|
48
|
+
|
|
49
|
+
// if (!(referenceEl instanceof HTMLElement)) { return }
|
|
50
|
+
if (!(popperEl instanceof HTMLElement)) { return }
|
|
51
|
+
if (!referenceEl) { return }
|
|
52
|
+
|
|
53
|
+
instance.value = createPopper(referenceEl, popperEl, {
|
|
54
|
+
placement,
|
|
55
|
+
strategy,
|
|
56
|
+
modifiers: [{
|
|
57
|
+
name: 'flip',
|
|
58
|
+
enabled: !locked
|
|
59
|
+
}, {
|
|
60
|
+
name: 'preventOverflow',
|
|
61
|
+
options: {
|
|
62
|
+
padding: overflowPadding
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
name: 'offset',
|
|
66
|
+
options: {
|
|
67
|
+
offset: [offsetSkid, offsetDistance]
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
name: 'computeStyles',
|
|
71
|
+
options: {
|
|
72
|
+
adaptive,
|
|
73
|
+
gpuAcceleration
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
name: 'eventListeners',
|
|
77
|
+
options: {
|
|
78
|
+
scroll,
|
|
79
|
+
resize
|
|
80
|
+
}
|
|
81
|
+
}]
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
onInvalidate(instance.value.destroy)
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
return [reference, popper, instance] as const
|
|
89
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Sidebar from "./sidebar.vue";
|
|
2
|
-
import {createStory} from "
|
|
2
|
+
import {createStory} from "../../__storybook__";
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
component: Sidebar,
|
|
6
6
|
title: 'Examples/Cards/Sidebar'
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export const Basic = createStory(Sidebar);
|
|
9
|
+
export const Basic = createStory(Sidebar);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Placement, PositioningStrategy } from '@popperjs/core'
|
|
2
|
+
|
|
3
|
+
export interface PopperOptions {
|
|
4
|
+
locked?: boolean
|
|
5
|
+
overflowPadding?: number
|
|
6
|
+
offsetDistance?: number
|
|
7
|
+
offsetSkid?: number
|
|
8
|
+
placement?: Placement
|
|
9
|
+
strategy?: PositioningStrategy
|
|
10
|
+
gpuAcceleration?: boolean
|
|
11
|
+
adaptive?: boolean
|
|
12
|
+
scroll?: boolean
|
|
13
|
+
resize?: boolean
|
|
14
|
+
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
.m-table__wrapper {
|
|
2
|
-
width: 100%;
|
|
3
|
-
overflow-x: auto;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.m-table {
|
|
7
|
-
--table-cell-padding: 10px 15px;
|
|
8
|
-
border-collapse: collapse;
|
|
9
|
-
width: 100%;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.m-table thead tr {
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.m-table thead tr th {
|
|
17
|
-
padding: var(--table-cell-padding);
|
|
18
|
-
text-align: left;
|
|
19
|
-
font-weight: 500;
|
|
20
|
-
background-color: var(--gray-150);
|
|
21
|
-
white-space: nowrap;
|
|
22
|
-
color: var(--gray-700);
|
|
23
|
-
font-size: 14px;
|
|
24
|
-
line-height: 15px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.m-table tbody tr:first-child td {
|
|
28
|
-
border-top: none;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.m-table tbody tr td {
|
|
32
|
-
padding: var(--table-cell-padding);
|
|
33
|
-
border-top: 1px solid var(--gray-150);
|
|
34
|
-
font-size: 15px;
|
|
35
|
-
line-height: 15px;
|
|
36
|
-
vertical-align: middle;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.m-table.m-table--striped tbody tr:nth-child(even) td {
|
|
40
|
-
background-color: var(--gray-50);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.m-table.m-table--hover tbody tr:hover td {
|
|
44
|
-
background-color: var(--gray-50);
|
|
45
|
-
}
|