mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
chore: clean components
This commit is contained in:
@@ -70,7 +70,7 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
validator (value) {
|
validator (value) {
|
||||||
return ['online', 'idle', 'invisible', 'donotdisturb', 'focus'].includes(value)
|
return [null, 'online', 'idle', 'invisible', 'donotdisturb', 'focus'].includes(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div ref="container" v-on-clickaway="close">
|
<div ref="container">
|
||||||
<input :value="value" :required="required" class="absolute inset-0 w-px opacity-0 cursor-default">
|
<input :value="value" :required="required" class="absolute inset-0 w-px opacity-0 cursor-default">
|
||||||
|
|
||||||
<slot :toggle="toggle" :open="open">
|
<slot :toggle="toggle" :open="open">
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import get from 'lodash/get'
|
import get from 'lodash/get'
|
||||||
import { createPopper } from '@popperjs/core'
|
import { createPopper } from '@popperjs/core'
|
||||||
import { directive as onClickaway } from 'vue-clickaway'
|
// import { directive as onClickaway } from 'vue-clickaway'
|
||||||
|
|
||||||
import Icon from '../elements/Icon'
|
import Icon from '../elements/Icon'
|
||||||
|
|
||||||
@@ -121,9 +121,9 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
Icon
|
Icon
|
||||||
},
|
},
|
||||||
directives: {
|
// directives: {
|
||||||
onClickaway
|
// onClickaway
|
||||||
},
|
// },
|
||||||
shortcuts: {
|
shortcuts: {
|
||||||
disabled () {
|
disabled () {
|
||||||
return !this.open
|
return !this.open
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
<textarea
|
<textarea
|
||||||
:id="name"
|
:id="name"
|
||||||
ref="textarea"
|
ref="textarea"
|
||||||
v-focus="autofocus"
|
|
||||||
:name="name"
|
:name="name"
|
||||||
:value="modelValue"
|
:value="modelValue"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
@@ -18,12 +17,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Focus from '../../directives/focus'
|
// import Focus from '../../directives/focus'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
directives: {
|
// directives: {
|
||||||
focus: Focus
|
// focus: Focus
|
||||||
},
|
// },
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<component
|
<component
|
||||||
:is="$attrs && $attrs.submit ? 'form': 'div'"
|
:is="$attrs.onSubmit ? 'form': 'div'"
|
||||||
:class="[padded && rounded && 'rounded-md', !padded && rounded && 'sm:rounded-md', wrapperClass, ringClass, shadowClass, backgroundClass]"
|
:class="[padded && rounded && 'rounded-md', !padded && rounded && 'sm:rounded-md', wrapperClass, ringClass, shadowClass, backgroundClass]"
|
||||||
@submit.prevent="$attrs && $attrs.submit ? $attrs.submit() : null"
|
v-bind="$attrs"
|
||||||
>
|
>
|
||||||
|
{{ $attrs }}
|
||||||
<div
|
<div
|
||||||
v-if="$slots.header"
|
v-if="$slots.header"
|
||||||
:class="[headerClass, headerBackgroundClass, borderColorClass, !!$slots.default && 'border-b']"
|
:class="[headerClass, headerBackgroundClass, borderColorClass, !!$slots.default && 'border-b']"
|
||||||
@@ -77,6 +78,9 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'border-gray-200 dark:border-gray-700'
|
default: 'border-gray-200 dark:border-gray-700'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
setup (props, { attrs }) {
|
||||||
|
console.log('attrs', attrs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
ref="container"
|
ref="container"
|
||||||
v-on-clickaway="onClickaway"
|
|
||||||
class="inline whitespace-normal"
|
class="inline whitespace-normal"
|
||||||
@mouseover="mode === 'hover' ? mouseover() : () => {}"
|
@mouseover="mode === 'hover' ? mouseover() : () => {}"
|
||||||
@mouseleave="mode === 'hover' ? mouseleave() : () => {}"
|
@mouseleave="mode === 'hover' ? mouseleave() : () => {}"
|
||||||
@@ -18,7 +17,7 @@
|
|||||||
leave-to-class="opacity-0"
|
leave-to-class="opacity-0"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="show && ready && $scopedSlots.content"
|
v-if="show && ready && $slots.content"
|
||||||
ref="popover"
|
ref="popover"
|
||||||
class="z-30 flex bg-white rounded-md shadow ring-1 ring-gray-200 dark:ring-gray-700"
|
class="z-30 flex bg-white rounded-md shadow ring-1 ring-gray-200 dark:ring-gray-700"
|
||||||
:class="[
|
:class="[
|
||||||
@@ -38,12 +37,12 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { createPopper } from '@popperjs/core'
|
import { createPopper } from '@popperjs/core'
|
||||||
import { directive as onClickaway } from 'vue-clickaway'
|
// import { directive as onClickaway } from 'vue-clickaway'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
directives: {
|
// directives: {
|
||||||
onClickaway
|
// onClickaway
|
||||||
},
|
// },
|
||||||
props: {
|
props: {
|
||||||
darken: {
|
darken: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import focusLock from 'dom-focus-lock'
|
// import focusLock from 'dom-focus-lock'
|
||||||
|
|
||||||
import Icon from '../elements/Icon'
|
import Icon from '../elements/Icon'
|
||||||
import Card from '../layout/Card'
|
import Card from '../layout/Card'
|
||||||
@@ -164,7 +164,7 @@ export default {
|
|||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
if (this.lock) {
|
if (this.lock) {
|
||||||
focusLock.off(this.$refs.container)
|
// focusLock.off(this.$refs.container)
|
||||||
this.lock = false
|
this.lock = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -183,7 +183,7 @@ export default {
|
|||||||
document.activeElement?.blur()
|
document.activeElement?.blur()
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.$refs.container && !this.lock) {
|
if (this.$refs.container && !this.lock) {
|
||||||
focusLock.on(this.$refs.container)
|
// focusLock.on(this.$refs.container)
|
||||||
this.lock = true
|
this.lock = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -192,7 +192,7 @@ export default {
|
|||||||
this.showBackdrop = false
|
this.showBackdrop = false
|
||||||
this.showContent = false
|
this.showContent = false
|
||||||
if (this.lock) {
|
if (this.lock) {
|
||||||
focusLock.off(this.$refs.container)
|
// focusLock.off(this.$refs.container)
|
||||||
this.lock = false
|
this.lock = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div ref="container" v-on-clickaway="close" @mouseover="mouseover" @mouseleave="mouseleave">
|
<div ref="container" @mouseover="mouseover" @mouseleave="mouseleave">
|
||||||
<slot />
|
<slot />
|
||||||
|
|
||||||
<transition
|
<transition
|
||||||
@@ -44,12 +44,12 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { createPopper } from '@popperjs/core'
|
import { createPopper } from '@popperjs/core'
|
||||||
import { directive as onClickaway } from 'vue-clickaway'
|
// import { directive as onClickaway } from 'vue-clickaway'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
directives: {
|
// directives: {
|
||||||
onClickaway
|
// onClickaway
|
||||||
},
|
// },
|
||||||
props: {
|
props: {
|
||||||
text: {
|
text: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|||||||
Reference in New Issue
Block a user