mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-06 12:17:13 +08:00
feat(autoComplete): css in js (#233)
Co-authored-by: Lecong Zhang <50313260+tskirby@users.noreply.github.com>
This commit is contained in:
parent
8355f8f25a
commit
94d14115e5
@ -1,8 +0,0 @@
|
|||||||
/* istanbul ignore file */
|
|
||||||
import AutoComplete from './src/main.vue'
|
|
||||||
|
|
||||||
AutoComplete.install = function (Vue) {
|
|
||||||
Vue.component(AutoComplete.name, AutoComplete)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default AutoComplete
|
|
@ -1,5 +1,5 @@
|
|||||||
@import './mixins/mixins.scss';
|
// @import './mixins/mixins.scss';
|
||||||
|
|
||||||
@include b(auto-complete-menu) {
|
// @include b(auto-complete-menu) {
|
||||||
@include fade-in-scale-up-transition(auto-complete-menu, $original-transition: (background-color .3s $--n-ease-in-out-cubic-bezier));
|
// @include fade-in-scale-up-transition(auto-complete-menu, $original-transition: (background-color .3s $--n-ease-in-out-cubic-bezier));
|
||||||
}
|
// }
|
8
src/autoComplete/index.js
Normal file
8
src/autoComplete/index.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/* istanbul ignore file */
|
||||||
|
import AutoComplete from './src/AutoComplete.vue'
|
||||||
|
|
||||||
|
AutoComplete.install = function (Vue, naive) {
|
||||||
|
Vue.component(naive.componentPrefix + AutoComplete.name, AutoComplete)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AutoComplete
|
@ -36,7 +36,7 @@
|
|||||||
ref="content"
|
ref="content"
|
||||||
class="n-positioning-content"
|
class="n-positioning-content"
|
||||||
>
|
>
|
||||||
<transition name="n-auto-complete-menu-transition">
|
<transition name="n-fade-in-scale-up-transition">
|
||||||
<n-base-select-menu
|
<n-base-select-menu
|
||||||
v-if="active"
|
v-if="active"
|
||||||
ref="contentInner"
|
ref="contentInner"
|
||||||
@ -71,9 +71,11 @@ import themeable from '../../_mixins/themeable'
|
|||||||
import asformitem from '../../_mixins/asformitem'
|
import asformitem from '../../_mixins/asformitem'
|
||||||
import NBaseSelectMenu from '../../_base/select-menu'
|
import NBaseSelectMenu from '../../_base/select-menu'
|
||||||
import { mapAutoCompleteOptionsToSelectOptions } from './utils'
|
import { mapAutoCompleteOptionsToSelectOptions } from './utils'
|
||||||
|
import usecssr from '../../_mixins/usecssr'
|
||||||
|
import styles from './styles'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'NAutoComplete',
|
name: 'AutoComplete',
|
||||||
components: {
|
components: {
|
||||||
NInput,
|
NInput,
|
||||||
NBaseSelectMenu
|
NBaseSelectMenu
|
||||||
@ -87,7 +89,8 @@ export default {
|
|||||||
detachable,
|
detachable,
|
||||||
zindexable,
|
zindexable,
|
||||||
placeable,
|
placeable,
|
||||||
asformitem()
|
asformitem(),
|
||||||
|
usecssr(styles)
|
||||||
],
|
],
|
||||||
props: {
|
props: {
|
||||||
placeholder: {
|
placeholder: {
|
11
src/autoComplete/src/styles/index.js
Normal file
11
src/autoComplete/src/styles/index.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import themedBaseStyle from './themed-base.cssr.js'
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
key: 'syntheticTheme',
|
||||||
|
watch: [
|
||||||
|
'syntheticTheme'
|
||||||
|
],
|
||||||
|
CNode: themedBaseStyle
|
||||||
|
}
|
||||||
|
]
|
13
src/autoComplete/src/styles/themed-base.cssr.js
Normal file
13
src/autoComplete/src/styles/themed-base.cssr.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { c, cTB } from '../../../_utils/cssr'
|
||||||
|
import fadeInScaleUpTransition from '../../../styles/_transitions/fade-in-scale-up.js'
|
||||||
|
|
||||||
|
export default c([
|
||||||
|
({ props }) => {
|
||||||
|
const { easeInOutCubicBezier } = props.$base
|
||||||
|
return cTB('auto-complete-menu', [
|
||||||
|
fadeInScaleUpTransition({
|
||||||
|
originalTransition: `background-color .3s ${easeInOutCubicBezier}`
|
||||||
|
})
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
9
src/autoComplete/styles/dark.js
Normal file
9
src/autoComplete/styles/dark.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import create from '../../styles/_utils/create-component-base'
|
||||||
|
|
||||||
|
export default create({
|
||||||
|
theme: 'dark',
|
||||||
|
name: 'AutoComplete',
|
||||||
|
getDerivedVariables ({ base, derived }) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
})
|
9
src/autoComplete/styles/light.js
Normal file
9
src/autoComplete/styles/light.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import create from '../../styles/_utils/create-component-base'
|
||||||
|
|
||||||
|
export default create({
|
||||||
|
theme: 'light',
|
||||||
|
name: 'AutoComplete',
|
||||||
|
getDerivedVariables ({ base, derived }) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
})
|
@ -58,7 +58,7 @@ import Menu from './Menu'
|
|||||||
import Avatar from './avatar'
|
import Avatar from './avatar'
|
||||||
import Result from './Result'
|
import Result from './Result'
|
||||||
import Thing from './Thing'
|
import Thing from './Thing'
|
||||||
import AutoComplete from './AutoComplete'
|
import AutoComplete from './autoComplete'
|
||||||
import Empty from './Empty'
|
import Empty from './Empty'
|
||||||
import Element from './element'
|
import Element from './element'
|
||||||
import Log from './Log'
|
import Log from './Log'
|
||||||
@ -107,6 +107,8 @@ import transferLightStyle from './transfer/styles/light'
|
|||||||
import transferDarkStyle from './transfer/styles/dark'
|
import transferDarkStyle from './transfer/styles/dark'
|
||||||
import typographyDarkStyle from './typography/styles/light'
|
import typographyDarkStyle from './typography/styles/light'
|
||||||
import typographyLightStyle from './typography/styles/dark'
|
import typographyLightStyle from './typography/styles/dark'
|
||||||
|
import autoComplateLightStyle from './autoComplete/styles/light'
|
||||||
|
import autoComplateDarkStyle from './autoComplete/styles/dark'
|
||||||
import backTopLightStyle from './backTop/styles/light'
|
import backTopLightStyle from './backTop/styles/light'
|
||||||
import backTopDarkStyle from './backTop/styles/dark'
|
import backTopDarkStyle from './backTop/styles/dark'
|
||||||
|
|
||||||
@ -238,6 +240,8 @@ export default create({
|
|||||||
transferDarkStyle,
|
transferDarkStyle,
|
||||||
typographyLightStyle,
|
typographyLightStyle,
|
||||||
typographyDarkStyle,
|
typographyDarkStyle,
|
||||||
|
autoComplateLightStyle,
|
||||||
|
autoComplateDarkStyle,
|
||||||
backTopLightStyle,
|
backTopLightStyle,
|
||||||
backTopDarkStyle,
|
backTopDarkStyle,
|
||||||
// Can be remove after refactoring
|
// Can be remove after refactoring
|
||||||
|
Loading…
Reference in New Issue
Block a user