diff --git a/playground/pages/alert.vue b/playground/pages/alert.vue new file mode 100644 index 0000000..da83031 --- /dev/null +++ b/playground/pages/alert.vue @@ -0,0 +1,11 @@ + diff --git a/src/runtime/components/atoms/alert.vue b/src/runtime/components/atoms/alert.vue new file mode 100644 index 0000000..8b7b0ed --- /dev/null +++ b/src/runtime/components/atoms/alert.vue @@ -0,0 +1,197 @@ + + + \ No newline at end of file diff --git a/src/runtime/types/alert.ts b/src/runtime/types/alert.ts new file mode 100644 index 0000000..a0883b3 --- /dev/null +++ b/src/runtime/types/alert.ts @@ -0,0 +1,12 @@ +import { alert } from "../ui-configs"; +import type { NestedKeyOf, ExtractDeepKey, ExtractDeepObject } from '.' +import type { Button } from './button' +import colors from '#mei-ui-colors' +import type { AppConfig } from 'nuxt/schema' + +export type AlertColor = keyof typeof alert.color | ExtractDeepKey | typeof colors[number] +export type AlertVariant = keyof typeof alert.variant | ExtractDeepKey | NestedKeyOf | NestedKeyOf> + +export interface AlertAction extends Button { + click?: Function +} diff --git a/src/runtime/types/index.ts b/src/runtime/types/index.ts index cba63dc..28858d0 100644 --- a/src/runtime/types/index.ts +++ b/src/runtime/types/index.ts @@ -9,3 +9,4 @@ export * from "./kbd"; export * from "./dropdown"; export * from "./avatar"; export * from "./input"; +export * from "./alert"; \ No newline at end of file diff --git a/src/runtime/ui-configs/alert.ts b/src/runtime/ui-configs/alert.ts new file mode 100644 index 0000000..2a503ec --- /dev/null +++ b/src/runtime/ui-configs/alert.ts @@ -0,0 +1,40 @@ +export default { + wrapper: 'w-full relative overflow-hidden', + inner: 'w-0 flex-1', + title: 'text-sm font-medium', + description: 'mt-1 text-sm leading-4 opacity-90', + actions: 'flex items-center gap-2 mt-3 flex-shrink-0', + shadow: '', + rounded: 'rounded-lg', + padding: 'p-4', + gap: 'gap-3', + icon: { + base: 'flex-shrink-0 w-5 h-5' + }, + avatar: { + base: 'flex-shrink-0 self-center', + size: 'md' as const + }, + color: { + white: { + solid: 'text-gray-900 dark:text-white bg-white dark:bg-gray-900 ring-1 ring-gray-200 dark:ring-gray-800' + } + }, + variant: { + solid: 'bg-{color}-500 dark:bg-{color}-400 text-white dark:text-gray-900', + outline: 'text-{color}-500 dark:text-{color}-400 ring-1 ring-inset ring-{color}-500 dark:ring-{color}-400', + soft: 'bg-{color}-50 dark:bg-{color}-400 dark:bg-opacity-10 text-{color}-500 dark:text-{color}-400', + subtle: 'bg-{color}-50 dark:bg-{color}-400 dark:bg-opacity-10 text-{color}-500 dark:text-{color}-400 ring-1 ring-inset ring-{color}-500 dark:ring-{color}-400 ring-opacity-25 dark:ring-opacity-25' + }, + default: { + color: 'white', + variant: 'solid', + icon: null, + closeButton: null, + actionButton: { + size: 'xs' as const, + color: 'primary' as const, + variant: 'link' as const + } + } +} diff --git a/src/runtime/ui-configs/index.ts b/src/runtime/ui-configs/index.ts index 2fb795a..0ef2d61 100644 --- a/src/runtime/ui-configs/index.ts +++ b/src/runtime/ui-configs/index.ts @@ -12,3 +12,4 @@ export { default as avatar } from "./avatar"; export { default as modal } from "./modal"; export { default as card } from "./card"; export { default as input } from "./input"; +export { default as alert } from "./alert"; \ No newline at end of file