@indielayer/ui 1.0.0-alpha.3 → 1.0.0-alpha.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/README.md +25 -87
- package/lib/components/badge/Badge.vue.d.ts +5 -0
- package/lib/components/checkbox/Checkbox.vue.d.ts +1 -1
- package/lib/components/drawer/Drawer.vue.d.ts +3 -3
- package/lib/components/icon/Icon.vue.d.ts +5 -1
- package/lib/components/input/Input.vue.d.ts +4 -1
- package/lib/components/menu/Menu.vue.d.ts +16 -4
- package/lib/components/menu/MenuItem.vue.d.ts +18 -6
- package/lib/components/radio/Radio.vue.d.ts +1 -1
- package/lib/components/select/Select.vue.d.ts +1 -1
- package/lib/components/slider/Slider.vue.d.ts +1 -1
- package/lib/components/tab/Tab.vue.d.ts +8 -3
- package/lib/components/tab/TabGroup.vue.d.ts +20 -0
- package/lib/components/table/Table.vue.d.ts +1 -0
- package/lib/components/textarea/Textarea.vue.d.ts +6 -1
- package/lib/components/toggle/Toggle.vue.d.ts +1 -1
- package/lib/composables/colors.d.ts +1 -1
- package/lib/composables/css.d.ts +4 -4
- package/lib/create.d.ts +1 -0
- package/lib/index.cjs.js +2 -2
- package/lib/index.es.js +277 -88
- package/lib/style.css +1 -1
- package/lib/version.d.ts +1 -1
- package/package.json +15 -15
- package/src/components/badge/Badge.vue +13 -0
- package/src/components/button/Button.vue +4 -4
- package/src/components/checkbox/Checkbox.vue +1 -1
- package/src/components/container/Container.vue +1 -1
- package/src/components/icon/Icon.vue +77 -10
- package/src/components/input/Input.vue +5 -3
- package/src/components/link/Link.vue +1 -1
- package/src/components/menu/Menu.vue +8 -2
- package/src/components/menu/MenuItem.vue +25 -12
- package/src/components/modal/Modal.vue +3 -1
- package/src/components/radio/Radio.vue +4 -4
- package/src/components/scroll/Scroll.vue +1 -1
- package/src/components/select/Select.vue +0 -0
- package/src/components/tab/Tab.vue +52 -8
- package/src/components/tab/TabGroup.vue +25 -7
- package/src/components/table/Table.vue +2 -0
- package/src/components/textarea/Textarea.vue +4 -1
- package/src/components/toggle/Toggle.vue +1 -1
- package/src/create.ts +4 -2
- package/src/version.ts +1 -1
- package/volar.d.ts +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { defineComponent, reactive, computed, provide, type PropType, ref, watch, onMounted } from 'vue'
|
|
2
|
+
import { defineComponent, reactive, computed, provide, type PropType, ref, watch, onMounted, watchEffect } from 'vue'
|
|
3
3
|
import { injectTabKey } from '../../composables/keys'
|
|
4
|
+
import { useCommon } from '../../composables/common'
|
|
4
5
|
import { useCSS } from '../../composables/css'
|
|
5
6
|
import { useColors } from '../../composables/colors'
|
|
6
7
|
|
|
@@ -9,21 +10,27 @@ import { useResizeObserver, useThrottleFn } from '@vueuse/core'
|
|
|
9
10
|
import XScroll from '../../components/scroll/Scroll.vue'
|
|
10
11
|
|
|
11
12
|
export default defineComponent({
|
|
12
|
-
name: '
|
|
13
|
+
name: 'XTabGroup',
|
|
13
14
|
|
|
14
15
|
components: {
|
|
15
16
|
XScroll,
|
|
16
17
|
},
|
|
17
18
|
|
|
18
19
|
props: {
|
|
20
|
+
...useCommon.props(),
|
|
19
21
|
...useColors.props('primary'),
|
|
20
22
|
modelValue: [String, Number],
|
|
21
23
|
variant: {
|
|
22
24
|
type: String as PropType<'line' | 'block'>,
|
|
23
25
|
default: 'line',
|
|
24
26
|
},
|
|
27
|
+
align: {
|
|
28
|
+
type: String as PropType<'left' | 'center' | 'right'>,
|
|
29
|
+
default: 'left',
|
|
30
|
+
},
|
|
25
31
|
ghost: Boolean,
|
|
26
32
|
grow: Boolean,
|
|
33
|
+
exact: Boolean,
|
|
27
34
|
},
|
|
28
35
|
|
|
29
36
|
emits: ['update:modelValue'],
|
|
@@ -35,14 +42,23 @@ export default defineComponent({
|
|
|
35
42
|
const tabsRef = ref<HTMLElement>()
|
|
36
43
|
const tabsContentRef = ref<HTMLElement>()
|
|
37
44
|
|
|
45
|
+
const active = ref()
|
|
46
|
+
|
|
47
|
+
watchEffect(() => {
|
|
48
|
+
active.value = props.modelValue
|
|
49
|
+
})
|
|
50
|
+
|
|
38
51
|
const state = reactive({
|
|
39
|
-
active: computed(() =>
|
|
52
|
+
active: computed(() => active.value),
|
|
40
53
|
variant: computed(() => props.variant),
|
|
41
54
|
ghost: computed(() => props.ghost),
|
|
42
55
|
grow: computed(() => props.grow),
|
|
56
|
+
exact: computed(() => props.exact),
|
|
57
|
+
size: computed(() => props.size),
|
|
43
58
|
})
|
|
44
59
|
|
|
45
60
|
function activateTab(tab: string | number) {
|
|
61
|
+
active.value = tab
|
|
46
62
|
emit('update:modelValue', tab)
|
|
47
63
|
}
|
|
48
64
|
|
|
@@ -70,14 +86,14 @@ export default defineComponent({
|
|
|
70
86
|
if (scrollRef.value.scrollEl) scrollRef.value.scrollEl.scrollTo({ left: center, behavior: 'smooth' })
|
|
71
87
|
}, 100)
|
|
72
88
|
|
|
73
|
-
useResizeObserver(wrapperRef, () => { updateTracker(
|
|
89
|
+
useResizeObserver(wrapperRef, () => { updateTracker(active.value) })
|
|
74
90
|
|
|
75
|
-
watch(() =>
|
|
91
|
+
watch(() => active.value, (value) => {
|
|
76
92
|
updateTracker(value)
|
|
77
93
|
})
|
|
78
94
|
|
|
79
95
|
onMounted(() => {
|
|
80
|
-
updateTracker(
|
|
96
|
+
updateTracker(active.value)
|
|
81
97
|
})
|
|
82
98
|
|
|
83
99
|
const css = useCSS('tabs')
|
|
@@ -131,7 +147,9 @@ export default defineComponent({
|
|
|
131
147
|
:class="{
|
|
132
148
|
'border-b border-gray-200 dark:border-gray-700': variant === 'line',
|
|
133
149
|
'space-x-8': variant === 'line' && !grow,
|
|
134
|
-
'z-[1]': variant === 'block'
|
|
150
|
+
'z-[1]': variant === 'block',
|
|
151
|
+
'justify-center': align === 'center',
|
|
152
|
+
'justify-end': align === 'right'
|
|
135
153
|
}"
|
|
136
154
|
>
|
|
137
155
|
<slot></slot>
|
|
@@ -14,6 +14,7 @@ export type Header = {
|
|
|
14
14
|
align?: Align,
|
|
15
15
|
value: string,
|
|
16
16
|
text: string,
|
|
17
|
+
width: string | number
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export default defineComponent({
|
|
@@ -136,6 +137,7 @@ export default defineComponent({
|
|
|
136
137
|
:text-align="header.align"
|
|
137
138
|
:sort="getSort(header.value, sort)"
|
|
138
139
|
:sortable="header.sortable"
|
|
140
|
+
:width="header.width"
|
|
139
141
|
@click="header.sortable ? sortHeader(header) : null"
|
|
140
142
|
>
|
|
141
143
|
{{ header.text }}
|
|
@@ -23,6 +23,7 @@ export default defineComponent({
|
|
|
23
23
|
type: String,
|
|
24
24
|
default: 'ltr',
|
|
25
25
|
},
|
|
26
|
+
rows: Number,
|
|
26
27
|
max: Number,
|
|
27
28
|
maxlength: Number,
|
|
28
29
|
min: Number,
|
|
@@ -34,6 +35,7 @@ export default defineComponent({
|
|
|
34
35
|
},
|
|
35
36
|
preventEnter: Boolean,
|
|
36
37
|
inputClass: String,
|
|
38
|
+
block: Boolean,
|
|
37
39
|
},
|
|
38
40
|
|
|
39
41
|
emits: useInputtable.emits(),
|
|
@@ -99,7 +101,7 @@ export default defineComponent({
|
|
|
99
101
|
<template>
|
|
100
102
|
<label
|
|
101
103
|
class="inline-block relative align-bottom text-left"
|
|
102
|
-
:class="{ 'mb-3': isInsideForm }"
|
|
104
|
+
:class="{ 'mb-3': isInsideForm, 'w-full': block }"
|
|
103
105
|
>
|
|
104
106
|
<p
|
|
105
107
|
v-if="label"
|
|
@@ -140,6 +142,7 @@ export default defineComponent({
|
|
|
140
142
|
:maxlength="maxlength"
|
|
141
143
|
:min="min"
|
|
142
144
|
:dir="dir"
|
|
145
|
+
:rows="rows"
|
|
143
146
|
:minlength="minlength"
|
|
144
147
|
:name="name"
|
|
145
148
|
:placeholder="placeholder"
|
package/src/create.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { App } from 'vue'
|
|
2
2
|
import type { ColorLibrary } from './composables/colors'
|
|
3
|
-
import { injectColorsKey } from './composables/keys'
|
|
3
|
+
import { injectColorsKey, injectIconsKey } from './composables/keys'
|
|
4
4
|
|
|
5
5
|
export interface IndielayerUIOptions {
|
|
6
6
|
prefix?: string,
|
|
7
7
|
components?: any,
|
|
8
|
-
colors?: ColorLibrary
|
|
8
|
+
colors?: ColorLibrary,
|
|
9
|
+
icons?: any
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
const defaultOptions: IndielayerUIOptions = {
|
|
@@ -26,6 +27,7 @@ const create = (createOptions: IndielayerUIOptions = {}) => {
|
|
|
26
27
|
})
|
|
27
28
|
|
|
28
29
|
app.provide(injectColorsKey, options.colors)
|
|
30
|
+
app.provide(injectIconsKey, options.icons)
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
return {
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.0.0-alpha.
|
|
1
|
+
export default '1.0.0-alpha.7'
|
package/volar.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ declare module 'vue' {
|
|
|
40
40
|
XTableHeader: typeof import('@indielayer/ui')['XTableHeader']
|
|
41
41
|
XTableRow: typeof import('@indielayer/ui')['XTableRow']
|
|
42
42
|
XTab: typeof import('@indielayer/ui')['XTab']
|
|
43
|
-
|
|
43
|
+
XTabGroup: typeof import('@indielayer/ui')['XTabGroup']
|
|
44
44
|
XTag: typeof import('@indielayer/ui')['XTag']
|
|
45
45
|
XTextarea: typeof import('@indielayer/ui')['XTextarea']
|
|
46
46
|
XToggle: typeof import('@indielayer/ui')['XToggle']
|