From cb9c8db5ba53f8d75230877791c6de2c45fa24dc Mon Sep 17 00:00:00 2001 From: Netfan Date: Sat, 11 Jan 2025 20:42:38 +0800 Subject: [PATCH] feat: improve `tippy` demo (#5357) --- .../common-ui/src/components/tippy/index.ts | 27 +- .../src/router/routes/modules/examples.ts | 2 +- playground/src/views/examples/tippy/index.vue | 275 +++++++++++------- 3 files changed, 191 insertions(+), 113 deletions(-) diff --git a/packages/effects/common-ui/src/components/tippy/index.ts b/packages/effects/common-ui/src/components/tippy/index.ts index 344a7bdaf..6080e5820 100644 --- a/packages/effects/common-ui/src/components/tippy/index.ts +++ b/packages/effects/common-ui/src/components/tippy/index.ts @@ -10,25 +10,26 @@ import { usePreferences } from '@vben-core/preferences'; import useTippyDirective from './directive'; import 'tippy.js/dist/tippy.css'; +import 'tippy.js/dist/backdrop.css'; import 'tippy.js/themes/light.css'; import 'tippy.js/animations/scale.css'; -import 'tippy.js/animations/scale-subtle.css'; -import 'tippy.js/animations/scale-extreme.css'; +import 'tippy.js/animations/shift-toward.css'; import 'tippy.js/animations/shift-away.css'; import 'tippy.js/animations/perspective.css'; const { isDark } = usePreferences(); -export type TippyProps = Props & { - animation?: - | 'fade' - | 'perspective' - | 'scale' - | 'scale-extreme' - | 'scale-subtle' - | 'shift-away' - | boolean; - theme?: 'auto' | 'dark' | 'light'; -}; +export type TippyProps = Partial< + Props & { + animation?: + | 'fade' + | 'perspective' + | 'scale' + | 'shift-away' + | 'shift-toward' + | boolean; + theme?: 'auto' | 'dark' | 'light'; + } +>; export function initTippy(app: App, options?: DefaultProps) { setDefaultProps({ diff --git a/playground/src/router/routes/modules/examples.ts b/playground/src/router/routes/modules/examples.ts index 796897870..449bbc2c1 100644 --- a/playground/src/router/routes/modules/examples.ts +++ b/playground/src/router/routes/modules/examples.ts @@ -253,7 +253,7 @@ const routes: RouteRecordRaw[] = [ path: '/examples/tippy', component: () => import('#/views/examples/tippy/index.vue'), meta: { - icon: 'material-symbols:chat-bubble', + icon: 'mdi:message-settings-outline', title: 'Tippy', }, }, diff --git a/playground/src/views/examples/tippy/index.vue b/playground/src/views/examples/tippy/index.vue index d73c4559d..ff7985ddf 100644 --- a/playground/src/views/examples/tippy/index.vue +++ b/playground/src/views/examples/tippy/index.vue @@ -1,5 +1,7 @@