@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
package/lib/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._alert_1sdha_2[data-v-35ce54d8]{color:var(--x-alert-text);background-color:var(--x-alert-bg);border-color:var(--x-alert-border)}._alert--glow_1sdha_1[data-v-35ce54d8]{box-shadow:0 0 #000,0 0 #000,0 10px 15px -3px var(--x-alert-glow),0 4px 6px -4px var(--x-alert-glow)}.dark ._alert_1sdha_2[data-v-35ce54d8]{color:var(--x-dark-alert-text, var(--x-alert-text));background-color:var(--x-dark-alert-bg, var(--x-alert-bg));border-color:var(--x-dark-alert-border, var(--x-alert-border))}._avatar_v7jzc_2[data-v-243016db]{color:var(--x-avatar-text);background-color:var(--x-avatar-bg);border-color:var(--x-avatar-border)}.dark ._avatar_v7jzc_2[data-v-243016db]{color:var(--x-dark-avatar-text, var(--x-avatar-text));background-color:var(--x-dark-avatar-bg, var(--x-avatar-bg));border-color:var(--x-dark-avatar-border, var(--x-avatar-border))}._button_1sbr9_2[data-v-
|
|
1
|
+
._alert_1sdha_2[data-v-35ce54d8]{color:var(--x-alert-text);background-color:var(--x-alert-bg);border-color:var(--x-alert-border)}._alert--glow_1sdha_1[data-v-35ce54d8]{box-shadow:0 0 #000,0 0 #000,0 10px 15px -3px var(--x-alert-glow),0 4px 6px -4px var(--x-alert-glow)}.dark ._alert_1sdha_2[data-v-35ce54d8]{color:var(--x-dark-alert-text, var(--x-alert-text));background-color:var(--x-dark-alert-bg, var(--x-alert-bg));border-color:var(--x-dark-alert-border, var(--x-alert-border))}._avatar_v7jzc_2[data-v-243016db]{color:var(--x-avatar-text);background-color:var(--x-avatar-bg);border-color:var(--x-avatar-border)}.dark ._avatar_v7jzc_2[data-v-243016db]{color:var(--x-dark-avatar-text, var(--x-avatar-text));background-color:var(--x-dark-avatar-bg, var(--x-avatar-bg));border-color:var(--x-dark-avatar-border, var(--x-avatar-border))}._button_1sbr9_2[data-v-6cb75733]{color:var(--x-button-text);background-color:var(--x-button-bg);border-color:var(--x-button-border)}._button--glow_1sbr9_1[data-v-6cb75733]{box-shadow:0 0 #000,0 0 #000,0 10px 15px -3px var(--x-button-glow),0 4px 6px -4px var(--x-button-glow)}._button_1sbr9_2[data-v-6cb75733]:hover{color:var(--x-button-text-hover, var(--x-button-text));background-color:var(--x-button-bg-hover, var(--x-button-bg));border-color:var(--x-button-border-hover, var(--x-button-border))}._button_1sbr9_2[data-v-6cb75733]:active{color:var(--x-button-text-active, var(--x-button-text));background-color:var(--x-button-bg-active, var(--x-button-bg));border-color:var(--x-button-border-active, var(--x-button-border))}.dark ._button_1sbr9_2[data-v-6cb75733]{color:var(--x-dark-button-text, var(--x-button-text));background-color:var(--x-dark-button-bg, var(--x-button-bg));border-color:var(--x-dark-button-border, var(--x-button-border))}.dark ._button_1sbr9_2[data-v-6cb75733]:hover{color:var(--x-dark-button-text-hover, var(--x-dark-button-text, var(--x-button-text)));background-color:var(--x-dark-button-bg-hover, var(--x-dark-button-bg, var(--x-button-bg)));border-color:var(--x-dark-button-border-hover, var(--x-dark-button-border, var(--x-button-border)))}.dark ._button_1sbr9_2[data-v-6cb75733]:active{color:var(--x-dark-button-text-active, var(--x-dark-button-text));background-color:var(--x-dark-button-bg-active, var(--x-dark-button-bg, var(--x-button-bg)));border-color:var(--x-dark-button-border-active, var(--x-dark-button-border, var(--x-button-border)))}._button-group_s7fyl_2:not(._button-group--rounded_s7fyl_1)>:first-child{border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;border-left-width:1px}._button-group_s7fyl_2:not(._button-group--rounded_s7fyl_1)>:last-child{border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}._button-group--rounded_s7fyl_1>:first-of-type{border-top-left-radius:9999px;border-bottom-left-radius:9999px;border-left-width:1px}._button-group--rounded_s7fyl_1>:last-child{border-top-right-radius:9999px;border-bottom-right-radius:9999px}._checkbox--glow_1dz66_1[data-v-05f49cb5]{box-shadow:0 0 #000,0 0 #000,0 10px 15px -3px var(--x-glow),0 4px 6px -4px var(--x-glow)}._scrollWrap_1k3q9_2[data-v-7362ac18]:before,._scrollWrap_1k3q9_2[data-v-7362ac18]:after{content:"";pointer-events:none;position:absolute;z-index:1;transition:box-shadow .2s}._scrollWrap_1k3q9_2._horizontal_1k3q9_11[data-v-7362ac18]:before,._scrollWrap_1k3q9_2._horizontal_1k3q9_11[data-v-7362ac18]:after{top:0;bottom:0;width:20px}._scrollWrap_1k3q9_2._vertical_1k3q9_17[data-v-7362ac18]:before,._scrollWrap_1k3q9_2._vertical_1k3q9_17[data-v-7362ac18]:after{right:0;left:0;height:20px}._scrollWrap_1k3q9_2._horizontal_1k3q9_11[data-v-7362ac18]:before{left:0}._scrollWrap_1k3q9_2._horizontal_1k3q9_11[data-v-7362ac18]:after{right:0}._scrollWrap_1k3q9_2._vertical_1k3q9_17[data-v-7362ac18]:before{top:0}._scrollWrap_1k3q9_2._vertical_1k3q9_17[data-v-7362ac18]:after{bottom:0}._scrollWrap_1k3q9_2._shadow-left_1k3q9_36[data-v-7362ac18]:before{box-shadow:inset 12px 0 10px -10px #00000012}._scrollWrap_1k3q9_2._shadow-right_1k3q9_40[data-v-7362ac18]:after{box-shadow:inset -12px 0 10px -10px #00000012}._scrollWrap_1k3q9_2._shadow-top_1k3q9_44[data-v-7362ac18]:before{box-shadow:inset 0 12px 10px -10px #00000012}._scrollWrap_1k3q9_2._shadow-bottom_1k3q9_48[data-v-7362ac18]:after{box-shadow:inset 0 -12px 10px -10px #00000012}._hideScroll_1k3q9_53[data-v-7362ac18]{-ms-overflow-style:auto;scrollbar-width:none}._hideScroll_1k3q9_53[data-v-7362ac18]::-webkit-scrollbar{display:none}._link--shadow_1tilo_1[data-v-af336fea]{box-shadow:inset 0 -.315em 0 0 var(--x-shadow)}._link--shadow_1tilo_1[data-v-af336fea]:hover{box-shadow:inset 0 -1.125em 0 0 var(--x-shadow)}.dark ._link--shadow_1tilo_1[data-v-af336fea]{box-shadow:inset 0 -.315em 0 0 var(--x-dark-shadow)}.dark ._link--shadow_1tilo_1[data-v-af336fea]:hover{box-shadow:inset 0 -1.125em 0 0 var(--x-dark-shadow)}._menu-item_1v1kj_2[data-v-295f8cb3]{color:var(--x-text);background-color:var(--x-bg)}._menu-item_1v1kj_2[data-v-295f8cb3]:before{content:"";position:absolute;left:-1px;height:100%;width:1px;background-color:transparent}._menu-item_1v1kj_2[data-v-295f8cb3]:hover{color:var(--x-text-hover, var(--x-text));background-color:var(--x-bg-hover, var(--x-bg))}.dark ._menu-item_1v1kj_2[data-v-295f8cb3]{color:var(--x-dark-text);background:var(--x-dark-bg)}.dark ._menu-item_1v1kj_2[data-v-295f8cb3]:hover{color:var(--x-dark-text-hover, var(--x-dark-text));background-color:var(--x-dark-bg-hover, var(--x-dark-bg))}.x-menu-inner ._menu-item_1v1kj_2[data-v-295f8cb3]:hover:before,.x-menu-inner ._menu-item--active_1v1kj_1[data-v-295f8cb3]:before{background-color:var(--x-border-hover)}._popover_2vipi_2 ._popoverContent_2vipi_3{visibility:hidden;transition-duration:.1s;transition-timing-function:cubic-bezier(.4,0,1,1)}._popover_2vipi_2 ._popoverTop_2vipi_8{--tw-translate-y: .5rem}._popover_2vipi_2 ._popoverRight_2vipi_11{--tw-translate-x: -.5rem}._popover_2vipi_2 ._popoverBottom_2vipi_14{--tw-translate-y: -.25rem}._popover_2vipi_2 ._popoverLeft_2vipi_17{--tw-translate-x: .5rem}._popover_2vipi_2._hover_2vipi_21:hover ._popoverContent_2vipi_3,._popover_2vipi_2._is-open_2vipi_22 ._popoverContent_2vipi_3{visibility:visible;transition-duration:.15s;transition-timing-function:cubic-bezier(0,0,.2,1)}._popover_2vipi_2._hover_2vipi_21:hover ._popoverTop_2vipi_8,._popover_2vipi_2._is-open_2vipi_22 ._popoverTop_2vipi_8{--tw-translate-y: .25rem}._popover_2vipi_2._hover_2vipi_21:hover ._popoverRight_2vipi_11,._popover_2vipi_2._is-open_2vipi_22 ._popoverRight_2vipi_11{--tw-translate-x: 0px}._popover_2vipi_2._hover_2vipi_21:hover ._popoverBottom_2vipi_14,._popover_2vipi_2._is-open_2vipi_22 ._popoverBottom_2vipi_14{--tw-translate-y: .25rem}._popover_2vipi_2._hover_2vipi_21:hover ._popoverLeft_2vipi_17,._popover_2vipi_2._is-open_2vipi_22 ._popoverLeft_2vipi_17{--tw-translate-x: 0px}._radio--glow_14rlz_1[data-v-4e34dad2]{box-shadow:0 0 #000,0 0 #000,0 10px 15px -3px var(--x-glow),0 4px 6px -4px var(--x-glow)}
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.0.0-alpha.
|
|
1
|
+
declare const _default: "1.0.0-alpha.7";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indielayer/ui",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"description": "Indielayer UI Components with Tailwind CSS build for Vue 3",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "João Teixeira",
|
|
@@ -40,6 +40,18 @@
|
|
|
40
40
|
"./tailwind.preset.js": "./lib/tailwind.preset.js"
|
|
41
41
|
},
|
|
42
42
|
"sideEffects": false,
|
|
43
|
+
"scripts": {
|
|
44
|
+
"dev": "pnpm build-only && chokidar \"./src/**\" -c \"pnpm build-only\"",
|
|
45
|
+
"dev2": "vite build --watch",
|
|
46
|
+
"build": "pnpm generate && vite build",
|
|
47
|
+
"build-prod": "pnpm build && pnpm gen-types",
|
|
48
|
+
"typecheck": "vue-tsc --noEmit",
|
|
49
|
+
"build-only": "vite build",
|
|
50
|
+
"generate": "pnpm gen-version",
|
|
51
|
+
"gen-types": "vue-tsc --declaration --emitDeclarationOnly",
|
|
52
|
+
"gen-version": "node .scripts/gen-version.js",
|
|
53
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
54
|
+
},
|
|
43
55
|
"peerDependencies": {
|
|
44
56
|
"tailwindcss": "^3.0.0",
|
|
45
57
|
"vue": "^3.0.0"
|
|
@@ -62,7 +74,7 @@
|
|
|
62
74
|
"postcss": "^8.4.4",
|
|
63
75
|
"start-server-and-test": "^1.14.0",
|
|
64
76
|
"tailwindcss": "^3.0.0",
|
|
65
|
-
"typescript": "
|
|
77
|
+
"typescript": "~4.6.3",
|
|
66
78
|
"vite": "^2.9.5",
|
|
67
79
|
"vue": "^3.2.33",
|
|
68
80
|
"vue-tsc": "^0.34.15"
|
|
@@ -83,17 +95,5 @@
|
|
|
83
95
|
},
|
|
84
96
|
"publishConfig": {
|
|
85
97
|
"access": "public"
|
|
86
|
-
},
|
|
87
|
-
"scripts": {
|
|
88
|
-
"dev": "pnpm build-only && chokidar \"./src/**\" -c \"pnpm build-only\"",
|
|
89
|
-
"dev2": "vite build --watch",
|
|
90
|
-
"build": "pnpm generate && vite build",
|
|
91
|
-
"build-prod": "pnpm build && pnpm gen-types",
|
|
92
|
-
"typecheck": "vue-tsc --noEmit",
|
|
93
|
-
"build-only": "vite build",
|
|
94
|
-
"generate": "pnpm gen-version",
|
|
95
|
-
"gen-types": "vue-tsc --declaration --emitDeclarationOnly",
|
|
96
|
-
"gen-version": "node .scripts/gen-version.js",
|
|
97
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
98
98
|
}
|
|
99
|
-
}
|
|
99
|
+
}
|
|
@@ -22,6 +22,8 @@ export default defineComponent({
|
|
|
22
22
|
type: String as PropType<'left' | 'right'>,
|
|
23
23
|
default: 'right',
|
|
24
24
|
},
|
|
25
|
+
offsetX: [Number, String],
|
|
26
|
+
offsetY: [Number, String],
|
|
25
27
|
animated: Boolean,
|
|
26
28
|
outlined: Boolean,
|
|
27
29
|
icon: String,
|
|
@@ -57,8 +59,18 @@ export default defineComponent({
|
|
|
57
59
|
return classes
|
|
58
60
|
})
|
|
59
61
|
|
|
62
|
+
const offsetStyle = computed(() => {
|
|
63
|
+
const style: any = {}
|
|
64
|
+
|
|
65
|
+
if (props.offsetX) style[props.align === 'left' ? 'marginLeft' : 'marginRight'] = props.offsetX + 'px'
|
|
66
|
+
if (props.offsetY) style[props.position === 'top' ? 'marginTop' : 'marginBottom'] = props.offsetY + 'px'
|
|
67
|
+
|
|
68
|
+
return style
|
|
69
|
+
})
|
|
70
|
+
|
|
60
71
|
return {
|
|
61
72
|
styles,
|
|
73
|
+
offsetStyle,
|
|
62
74
|
positionClasses,
|
|
63
75
|
}
|
|
64
76
|
},
|
|
@@ -76,6 +88,7 @@ export default defineComponent({
|
|
|
76
88
|
<div
|
|
77
89
|
v-if="show"
|
|
78
90
|
class="absolute rounded-full z-10 bg-[color:var(--x-badge-bg)]"
|
|
91
|
+
:style="offsetStyle"
|
|
79
92
|
:class="[
|
|
80
93
|
positionClasses,
|
|
81
94
|
{
|
|
@@ -105,11 +105,11 @@ export default defineComponent({
|
|
|
105
105
|
hover: { bg: !props.loading ? gray[100] : '' },
|
|
106
106
|
active: { bg: !props.loading ? gray[200] : '' },
|
|
107
107
|
dark: {
|
|
108
|
-
bg: gray[
|
|
108
|
+
bg: gray[800],
|
|
109
109
|
text: 'white',
|
|
110
110
|
border: gray[600],
|
|
111
|
-
hover: { bg: !props.loading ? gray[
|
|
112
|
-
active: { bg: !props.loading ? gray[
|
|
111
|
+
hover: { bg: !props.loading ? gray[700] : '' },
|
|
112
|
+
active: { bg: !props.loading ? gray[600] : '' },
|
|
113
113
|
},
|
|
114
114
|
}))
|
|
115
115
|
}
|
|
@@ -381,7 +381,7 @@ export default defineComponent({
|
|
|
381
381
|
:icon="iconRight"
|
|
382
382
|
class="shrink-0"
|
|
383
383
|
:class="[
|
|
384
|
-
[$slots.default ? '
|
|
384
|
+
[$slots.default ? 'ml-2' : 'm-0.5'],
|
|
385
385
|
{
|
|
386
386
|
invisible: loading,
|
|
387
387
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { computed, defineComponent, inject } from 'vue'
|
|
2
|
+
import { computed, defineComponent, inject, ref, watchEffect } from 'vue'
|
|
3
3
|
import { useCommon } from '../../composables/common'
|
|
4
4
|
import { injectIconsKey } from '../../composables/keys'
|
|
5
5
|
|
|
@@ -24,7 +24,7 @@ export default defineComponent({
|
|
|
24
24
|
},
|
|
25
25
|
|
|
26
26
|
setup(props) {
|
|
27
|
-
const icons: any = inject(injectIconsKey, {})
|
|
27
|
+
const icons: any = inject(injectIconsKey, () => {}, false)
|
|
28
28
|
const sizeClasses = computed(() => {
|
|
29
29
|
if (props.size === 'xs') return 'h-3 w-3'
|
|
30
30
|
else if (props.size === 'sm') return 'h-4 w-4'
|
|
@@ -34,8 +34,66 @@ export default defineComponent({
|
|
|
34
34
|
return 'h-5 w-5'
|
|
35
35
|
})
|
|
36
36
|
|
|
37
|
+
const isWrapSVG = ref(false)
|
|
38
|
+
const computedIcon = ref('')
|
|
39
|
+
const computedFilled = ref(props.filled)
|
|
40
|
+
const computedViewBox = ref(props.viewBox)
|
|
41
|
+
const attrs = ref({})
|
|
42
|
+
|
|
43
|
+
watchEffect(() => {
|
|
44
|
+
const injectedIcon = icons[props.icon]
|
|
45
|
+
|
|
46
|
+
isWrapSVG.value = false
|
|
47
|
+
computedIcon.value = injectedIcon
|
|
48
|
+
|
|
49
|
+
if (injectedIcon) {
|
|
50
|
+
if (typeof injectedIcon === 'string') {
|
|
51
|
+
if (injectedIcon.startsWith('<svg')) {
|
|
52
|
+
isWrapSVG.value = true
|
|
53
|
+
|
|
54
|
+
const { content, attributes } = getSVG(injectedIcon)
|
|
55
|
+
|
|
56
|
+
attrs.value = attributes
|
|
57
|
+
computedIcon.value = content
|
|
58
|
+
} else {
|
|
59
|
+
isWrapSVG.value = false
|
|
60
|
+
computedIcon.value = injectedIcon
|
|
61
|
+
}
|
|
62
|
+
} else if (typeof injectedIcon === 'object') {
|
|
63
|
+
computedIcon.value = injectedIcon.icon
|
|
64
|
+
computedFilled.value = injectedIcon.filled || props.filled
|
|
65
|
+
computedViewBox.value = injectedIcon.viewBox || injectedIcon.viewbox || props.viewBox
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
computedIcon.value = props.icon
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
function getSVG(svgString: string) {
|
|
73
|
+
svgString = svgString.trim()
|
|
74
|
+
const content = svgString.substring(svgString.indexOf('>') + 1, svgString.lastIndexOf('</svg>'))
|
|
75
|
+
const attrsRaw = svgString.substring(svgString.indexOf('<svg') + 4, svgString.indexOf('>')).trim().match(/[\w-]+="[^"]*"/g)
|
|
76
|
+
|
|
77
|
+
const attributes: Record<string, string | null> = {}
|
|
78
|
+
|
|
79
|
+
attrsRaw?.forEach((a) => {
|
|
80
|
+
const [attribute, value] = a.split('=')
|
|
81
|
+
|
|
82
|
+
if (!['height', 'width', 'class'].includes(attribute)) attributes[attribute] = value.replace(/(^"|"$)/g, '')
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
attributes,
|
|
87
|
+
content,
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
37
91
|
return {
|
|
38
|
-
|
|
92
|
+
attrs,
|
|
93
|
+
isWrapSVG,
|
|
94
|
+
computedIcon,
|
|
95
|
+
computedFilled,
|
|
96
|
+
computedViewBox,
|
|
39
97
|
sizeClasses,
|
|
40
98
|
}
|
|
41
99
|
},
|
|
@@ -44,13 +102,22 @@ export default defineComponent({
|
|
|
44
102
|
|
|
45
103
|
<template>
|
|
46
104
|
<svg
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
105
|
+
v-if="isWrapSVG"
|
|
106
|
+
class="inline"
|
|
107
|
+
:class="sizeClasses"
|
|
108
|
+
v-bind="attrs"
|
|
109
|
+
v-html="computedIcon"
|
|
110
|
+
/>
|
|
111
|
+
<svg
|
|
112
|
+
v-else
|
|
53
113
|
xmlns="http://www.w3.org/2000/svg"
|
|
54
|
-
|
|
114
|
+
class="inline"
|
|
115
|
+
:class="[sizeClasses, { 'stroke-2': !computedFilled}]"
|
|
116
|
+
:stroke-linejoin="computedFilled ? undefined : 'round'"
|
|
117
|
+
:stroke-linecap="computedFilled ? undefined : 'round'"
|
|
118
|
+
:stroke="computedFilled ? undefined : 'currentColor'"
|
|
119
|
+
:fill="computedFilled ? 'currentColor' : 'none'"
|
|
120
|
+
:viewBox="computedViewBox"
|
|
121
|
+
v-html="computedIcon"
|
|
55
122
|
/>
|
|
56
123
|
</template>
|
|
@@ -39,6 +39,7 @@ export default defineComponent({
|
|
|
39
39
|
default: 'text',
|
|
40
40
|
},
|
|
41
41
|
inputClass: String,
|
|
42
|
+
block: Boolean,
|
|
42
43
|
},
|
|
43
44
|
|
|
44
45
|
emits: useInputtable.emits(),
|
|
@@ -74,9 +75,10 @@ export default defineComponent({
|
|
|
74
75
|
if (!e.target) return
|
|
75
76
|
|
|
76
77
|
const target = (e.target as HTMLInputElement)
|
|
77
|
-
const value = Number(target.value)
|
|
78
78
|
|
|
79
79
|
if (props.type === 'number') {
|
|
80
|
+
const value = Number(target.value)
|
|
81
|
+
|
|
80
82
|
if (typeof props.min !== 'undefined') {
|
|
81
83
|
if (value < props.min) target.value = props.min.toString()
|
|
82
84
|
}
|
|
@@ -111,7 +113,7 @@ export default defineComponent({
|
|
|
111
113
|
<template>
|
|
112
114
|
<label
|
|
113
115
|
class="inline-block relative align-bottom text-left"
|
|
114
|
-
:class="{ 'mb-3': isInsideForm }"
|
|
116
|
+
:class="{ 'mb-3': isInsideForm, 'w-full': block }"
|
|
115
117
|
>
|
|
116
118
|
<p
|
|
117
119
|
v-if="label"
|
|
@@ -156,7 +158,7 @@ export default defineComponent({
|
|
|
156
158
|
:placeholder="placeholder"
|
|
157
159
|
:readonly="readonly"
|
|
158
160
|
:type="currentType"
|
|
159
|
-
:value="modelValue"
|
|
161
|
+
:value="modelValue || ''"
|
|
160
162
|
v-bind="$attrs"
|
|
161
163
|
v-on="inputListeners"
|
|
162
164
|
@change="onChange"
|
|
@@ -51,7 +51,7 @@ export default defineComponent({
|
|
|
51
51
|
<component
|
|
52
52
|
:is="to ? 'router-link' : tag"
|
|
53
53
|
:to="to"
|
|
54
|
-
class="transition duration-300 ease-in-out cursor-pointer
|
|
54
|
+
class="transition duration-300 ease-in-out cursor-pointer inline-flex
|
|
55
55
|
text-[color:var(--x-text)]
|
|
56
56
|
dark:text-[color:var(--x-dark-text)]
|
|
57
57
|
"
|
|
@@ -27,8 +27,14 @@ export default defineComponent({
|
|
|
27
27
|
collapseIcon: String,
|
|
28
28
|
expanded: Boolean,
|
|
29
29
|
disabled: Boolean,
|
|
30
|
-
rounded:
|
|
31
|
-
|
|
30
|
+
rounded: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: true,
|
|
33
|
+
},
|
|
34
|
+
filled: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: true,
|
|
37
|
+
},
|
|
32
38
|
},
|
|
33
39
|
|
|
34
40
|
emits: ['expand'],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { defineComponent, ref, computed, watch, onMounted, onBeforeUnmount } from 'vue'
|
|
3
|
+
import { useMutationObserver } from '@vueuse/core'
|
|
3
4
|
import { useCSS } from '../../composables/css'
|
|
4
5
|
import { useColors } from '../../composables/colors'
|
|
5
6
|
import { useCommon } from '../../composables/common'
|
|
@@ -34,8 +35,14 @@ export default defineComponent({
|
|
|
34
35
|
icon: String,
|
|
35
36
|
iconRight: String,
|
|
36
37
|
loading: Boolean,
|
|
37
|
-
rounded:
|
|
38
|
-
|
|
38
|
+
rounded: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: true,
|
|
41
|
+
},
|
|
42
|
+
filled: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: true,
|
|
45
|
+
},
|
|
39
46
|
selected: Boolean,
|
|
40
47
|
disabled: Boolean,
|
|
41
48
|
},
|
|
@@ -46,32 +53,33 @@ export default defineComponent({
|
|
|
46
53
|
const elRef = ref()
|
|
47
54
|
const isActive = ref(false)
|
|
48
55
|
|
|
49
|
-
const filled = computed(() => props.filled || props.item
|
|
56
|
+
const filled = computed(() => props.filled || props.item?.filled)
|
|
50
57
|
const cItem = computed(() => ({
|
|
51
58
|
...props,
|
|
52
59
|
...props.item,
|
|
53
60
|
}))
|
|
54
61
|
|
|
55
62
|
const htmlTag = cItem.value.to || cItem.value.href ? 'x-link' : 'div'
|
|
56
|
-
const isSupported = window && 'MutationObserver' in window
|
|
57
|
-
const classObserver = isSupported ? new MutationObserver(check) : null
|
|
58
63
|
|
|
59
64
|
onMounted(() => {
|
|
60
65
|
if (!elRef.value) return
|
|
61
66
|
|
|
62
67
|
check()
|
|
63
68
|
|
|
64
|
-
if (
|
|
69
|
+
if (htmlTag === 'x-link') useMutationObserver(elRef.value.$el, check, {
|
|
65
70
|
attributes: true,
|
|
66
71
|
attributeFilter: ['class'],
|
|
67
72
|
})
|
|
68
73
|
})
|
|
69
74
|
|
|
70
|
-
onBeforeUnmount(() => {
|
|
71
|
-
if (classObserver) classObserver.disconnect()
|
|
72
|
-
})
|
|
73
|
-
|
|
74
75
|
function onItemClick(e: Event) {
|
|
76
|
+
if (cItem.value.disabled) {
|
|
77
|
+
e.stopPropagation()
|
|
78
|
+
e.preventDefault()
|
|
79
|
+
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
|
|
75
83
|
cItem.value.onClick && cItem.value.onClick(e)
|
|
76
84
|
emit('click', e)
|
|
77
85
|
}
|
|
@@ -100,7 +108,12 @@ export default defineComponent({
|
|
|
100
108
|
const color = colors.getPalette(cItem.value.color || 'gray')
|
|
101
109
|
const gray = colors.getPalette('gray')
|
|
102
110
|
|
|
103
|
-
if (cItem.value.disabled) return css.
|
|
111
|
+
if (cItem.value.disabled) return css.variables({
|
|
112
|
+
text: gray[300],
|
|
113
|
+
dark: {
|
|
114
|
+
text: gray[600],
|
|
115
|
+
},
|
|
116
|
+
})
|
|
104
117
|
|
|
105
118
|
if (filled.value) {
|
|
106
119
|
if (isActive.value) {
|
|
@@ -193,7 +206,7 @@ export default defineComponent({
|
|
|
193
206
|
:href="cItem.href"
|
|
194
207
|
:target="cItem.target"
|
|
195
208
|
:color="cItem.color"
|
|
196
|
-
class="relative flex items-center whitespace-nowrap px-3 mt-1"
|
|
209
|
+
class="relative !flex items-center whitespace-nowrap px-3 mt-1"
|
|
197
210
|
:style="cssVariables"
|
|
198
211
|
:class="[
|
|
199
212
|
$style['menu-item'],
|
|
@@ -4,12 +4,14 @@ import { computed, defineComponent, ref, watch, type PropType } from 'vue'
|
|
|
4
4
|
import { onClickOutside, useEventListener } from '@vueuse/core'
|
|
5
5
|
|
|
6
6
|
import XScroll from '../../components/scroll/Scroll.vue'
|
|
7
|
+
import XIcon from '../icon/Icon.vue'
|
|
7
8
|
|
|
8
9
|
export default defineComponent({
|
|
9
10
|
name: 'XModal',
|
|
10
11
|
|
|
11
12
|
components: {
|
|
12
13
|
XScroll,
|
|
14
|
+
XIcon,
|
|
13
15
|
},
|
|
14
16
|
|
|
15
17
|
props: {
|
|
@@ -144,7 +146,7 @@ export default defineComponent({
|
|
|
144
146
|
>
|
|
145
147
|
<div
|
|
146
148
|
v-if="showClose"
|
|
147
|
-
class="absolute p-1 top-4 right-4 rounded-full bg-opacity-10 hover:bg-opacity-30 cursor-pointer"
|
|
149
|
+
class="flex absolute p-1 top-4 z-10 right-4 rounded-full bg-opacity-10 hover:bg-opacity-30 cursor-pointer"
|
|
148
150
|
:class="[
|
|
149
151
|
$slots.image ? 'bg-gray-900 text-white' : 'bg-gray-500 text-gray-800 dark:text-gray-300'
|
|
150
152
|
]"
|
|
@@ -131,10 +131,11 @@ export default defineComponent({
|
|
|
131
131
|
<template>
|
|
132
132
|
<label
|
|
133
133
|
ref="elRef"
|
|
134
|
-
|
|
134
|
+
tabindex="0"
|
|
135
|
+
class="inline-block mb-1 relative cursor-pointer focus:outline-none group"
|
|
135
136
|
:aria-selected="selected ? 'true' : 'false'"
|
|
136
137
|
:aria-disabled="(disabled || loading) ? 'true' : undefined"
|
|
137
|
-
|
|
138
|
+
:style="styles"
|
|
138
139
|
@keypress.prevent.stop.space="$emit('update:modelValue', value)"
|
|
139
140
|
>
|
|
140
141
|
<div
|
|
@@ -150,13 +151,12 @@ export default defineComponent({
|
|
|
150
151
|
class="invisible absolute"
|
|
151
152
|
/>
|
|
152
153
|
<div
|
|
153
|
-
class="rounded-full flex justify-center items-center flex-shrink-0 border-2
|
|
154
|
+
class="rounded-full flex justify-center items-center flex-shrink-0 border-2 outline-offset-2 outline-slate-300 dark:outline-slate-500 group-focus:outline-1 group-focus:outline
|
|
154
155
|
border-[color:var(--x-border)]
|
|
155
156
|
bg-[color:var(--x-bg)]
|
|
156
157
|
dark:border-[color:var(--x-dark-border)]
|
|
157
158
|
dark:bg-[color:var(--x-dark-bg)]
|
|
158
159
|
"
|
|
159
|
-
:style="styles"
|
|
160
160
|
:class="[
|
|
161
161
|
[glow && !disabled && !loading ? $style['radio--glow'] : ''],
|
|
162
162
|
{
|
|
@@ -25,7 +25,7 @@ export default defineComponent({
|
|
|
25
25
|
|
|
26
26
|
if (props.horizontal && props.mousewheel)
|
|
27
27
|
useEventListener(scrollEl, 'wheel', (e: WheelEvent) => {
|
|
28
|
-
if (!scrollEl.value) return
|
|
28
|
+
if (!scrollEl.value || scrollEl.value.scrollWidth <= scrollEl.value.clientWidth) return
|
|
29
29
|
|
|
30
30
|
e.preventDefault()
|
|
31
31
|
scrollEl.value.scrollLeft += e.deltaY + e.deltaX
|
|
File without changes
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { defineComponent, inject, reactive, computed, toRefs, ref, onMounted } from 'vue'
|
|
2
|
+
import { defineComponent, inject, reactive, computed, toRefs, ref, onMounted, onBeforeUnmount } from 'vue'
|
|
3
|
+
import { useMutationObserver } from '@vueuse/core'
|
|
3
4
|
import { injectTabKey } from '../../composables/keys'
|
|
4
5
|
import { useCommon } from '../../composables/common'
|
|
6
|
+
import XIcon from '../icon/Icon.vue'
|
|
7
|
+
import XLink from '../link/Link.vue'
|
|
5
8
|
|
|
6
9
|
export default defineComponent({
|
|
7
10
|
name: 'XTab',
|
|
8
11
|
|
|
12
|
+
components: {
|
|
13
|
+
XIcon,
|
|
14
|
+
XLink,
|
|
15
|
+
},
|
|
16
|
+
|
|
9
17
|
props: {
|
|
10
18
|
...useCommon.props(),
|
|
11
19
|
value: {
|
|
12
20
|
type: [String, Number],
|
|
13
|
-
required: true,
|
|
14
21
|
},
|
|
15
22
|
tag: {
|
|
16
23
|
type: String,
|
|
@@ -20,11 +27,14 @@ export default defineComponent({
|
|
|
20
27
|
label: String,
|
|
21
28
|
icon: String,
|
|
22
29
|
disabled: Boolean,
|
|
30
|
+
exact: Boolean,
|
|
23
31
|
},
|
|
24
32
|
|
|
25
33
|
setup(props) {
|
|
34
|
+
const cValue = computed(() => props.to || props.value )
|
|
26
35
|
const cLabel = computed(() => props.label || props.value)
|
|
27
36
|
const teleportTo = ref(null)
|
|
37
|
+
const elRef = ref()
|
|
28
38
|
|
|
29
39
|
const tabs = inject(injectTabKey, {
|
|
30
40
|
tabsContentRef: ref(null),
|
|
@@ -36,24 +46,56 @@ export default defineComponent({
|
|
|
36
46
|
}),
|
|
37
47
|
})
|
|
38
48
|
|
|
49
|
+
const cExact = computed(() => tabs.state.exact || props.exact)
|
|
50
|
+
const cSize = computed(() => props.size || tabs.state.size)
|
|
51
|
+
|
|
39
52
|
onMounted(() => {
|
|
40
53
|
teleportTo.value = tabs.tabsContentRef.value
|
|
54
|
+
|
|
55
|
+
if (props.to) {
|
|
56
|
+
check()
|
|
57
|
+
useMutationObserver(elRef.value.$el, check, {
|
|
58
|
+
attributes: true,
|
|
59
|
+
attributeFilter: ['class'],
|
|
60
|
+
})
|
|
61
|
+
}
|
|
41
62
|
})
|
|
42
63
|
|
|
64
|
+
function check() {
|
|
65
|
+
if (elRef.value && elRef.value.$el && (props.to)) {
|
|
66
|
+
const active = elRef.value?.$el.classList.contains(cExact.value ? 'router-link-exact-active' : 'router-link-active')
|
|
67
|
+
|
|
68
|
+
if (active) tabs.activateTab(cValue.value)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
43
72
|
const state = reactive({
|
|
44
|
-
selected: computed(() => tabs.state.active ===
|
|
73
|
+
selected: computed(() => tabs.state.active === cValue.value),
|
|
45
74
|
})
|
|
46
75
|
|
|
47
76
|
function onClickTab() {
|
|
48
|
-
tabs.activateTab(
|
|
77
|
+
if (!props.to) tabs.activateTab(cValue.value)
|
|
49
78
|
}
|
|
50
79
|
|
|
80
|
+
const sizeClasses = computed(() => {
|
|
81
|
+
if (cSize.value === 'xs') return 'text-xs'
|
|
82
|
+
else if (cSize.value === 'sm') return 'text-sm'
|
|
83
|
+
else if (cSize.value === 'lg') return 'text-lg'
|
|
84
|
+
else if (cSize.value === 'xl') return 'text-xl'
|
|
85
|
+
|
|
86
|
+
return ''
|
|
87
|
+
})
|
|
88
|
+
|
|
51
89
|
return {
|
|
52
90
|
...toRefs(state),
|
|
53
91
|
variant: tabs.state.variant,
|
|
54
92
|
grow: tabs.state.grow,
|
|
93
|
+
elRef,
|
|
55
94
|
cLabel,
|
|
95
|
+
cValue,
|
|
96
|
+
cSize,
|
|
56
97
|
tabs,
|
|
98
|
+
sizeClasses,
|
|
57
99
|
teleportTo,
|
|
58
100
|
onClickTab,
|
|
59
101
|
}
|
|
@@ -62,12 +104,14 @@ export default defineComponent({
|
|
|
62
104
|
</script>
|
|
63
105
|
|
|
64
106
|
<template>
|
|
65
|
-
<li :data-value="
|
|
107
|
+
<li :data-value="cValue" class="shrink-0 font-medium" :class="{ 'flex-1': grow }">
|
|
66
108
|
<component
|
|
67
|
-
:is="to ? '
|
|
109
|
+
:is="to ? 'x-link' : tag"
|
|
110
|
+
ref="elRef"
|
|
68
111
|
:to="to"
|
|
69
112
|
class="py-2 transition-colors duration-150 ease-in-out whitespace-nowrap text-center"
|
|
70
113
|
:class="[
|
|
114
|
+
sizeClasses,
|
|
71
115
|
{
|
|
72
116
|
'px-8': variant === 'block',
|
|
73
117
|
'text-[color:var(--x-tabs-text)] dark:text-[color:var(--x-dark-tabs-text)]': selected,
|
|
@@ -84,11 +128,11 @@ export default defineComponent({
|
|
|
84
128
|
name="tab"
|
|
85
129
|
:label="label"
|
|
86
130
|
:value="value"
|
|
87
|
-
:size="
|
|
131
|
+
:size="cSize"
|
|
88
132
|
:icon="icon"
|
|
89
133
|
>
|
|
90
134
|
<div class="flex items-center justify-center">
|
|
91
|
-
<
|
|
135
|
+
<XIcon v-if="icon" :icon="icon" :size="cSize" class="mr-1.5 shrink-0" />
|
|
92
136
|
<span>{{ cLabel }}</span>
|
|
93
137
|
</div>
|
|
94
138
|
</slot>
|