@una-ui/nuxt 0.31.0-beta.1 → 0.32.0-beta.1

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.
Files changed (43) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +23 -1
  3. package/dist/runtime/components/data/table/TableLoading.vue +0 -1
  4. package/dist/runtime/components/elements/Button.vue +2 -1
  5. package/dist/runtime/components/elements/Link.vue.d.ts +6 -1
  6. package/dist/runtime/components/elements/Progress.vue +1 -1
  7. package/dist/runtime/components/elements/Toggle.vue +2 -1
  8. package/dist/runtime/components/elements/dialog/DialogClose.vue +3 -1
  9. package/dist/runtime/components/elements/dialog/DialogContent.vue +1 -1
  10. package/dist/runtime/components/elements/dropdown-menu/DropdownMenuItem.vue +4 -2
  11. package/dist/runtime/components/elements/dropdown-menu/DropdownMenuSubTrigger.vue +3 -1
  12. package/dist/runtime/components/elements/pagination/PaginationListItem.vue +3 -1
  13. package/dist/runtime/components/forms/Form/FormControl.vue +16 -0
  14. package/dist/runtime/components/forms/Form/FormDescription.vue +22 -0
  15. package/dist/runtime/components/forms/Form/FormField.vue +156 -0
  16. package/dist/runtime/components/forms/Form/FormItem.vue +23 -0
  17. package/dist/runtime/components/forms/Form/FormLabel.vue +23 -0
  18. package/dist/runtime/components/forms/Form/FormMessage.vue +24 -0
  19. package/dist/runtime/components/forms/Input.vue +25 -15
  20. package/dist/runtime/components/overlays/Toaster.vue +39 -0
  21. package/dist/runtime/components/overlays/toast/Toast.vue +124 -0
  22. package/dist/runtime/components/overlays/toast/ToastAction.vue +41 -0
  23. package/dist/runtime/components/overlays/toast/ToastClose.vue +35 -0
  24. package/dist/runtime/components/overlays/toast/ToastDescription.vue +27 -0
  25. package/dist/runtime/components/overlays/toast/ToastInfo.vue +18 -0
  26. package/dist/runtime/components/overlays/toast/ToastProvider.vue +14 -0
  27. package/dist/runtime/components/overlays/toast/ToastTitle.vue +27 -0
  28. package/dist/runtime/components/overlays/toast/ToastViewport.vue +25 -0
  29. package/dist/runtime/components/slots/FormFieldDefault.d.ts +64 -0
  30. package/dist/runtime/components/slots/FormFieldDefault.js +62 -0
  31. package/dist/runtime/composables/useFormField.d.ts +11 -0
  32. package/dist/runtime/composables/useFormField.js +25 -0
  33. package/dist/runtime/composables/useToast.d.ts +26 -0
  34. package/dist/runtime/composables/useToast.js +98 -0
  35. package/dist/runtime/types/form.d.ts +98 -0
  36. package/dist/runtime/types/form.js +0 -0
  37. package/dist/runtime/types/index.d.ts +2 -0
  38. package/dist/runtime/types/index.js +2 -0
  39. package/dist/runtime/types/toast.d.ts +122 -0
  40. package/dist/runtime/types/toast.js +0 -0
  41. package/dist/runtime/utils/injectionKeys.d.ts +2 -0
  42. package/dist/runtime/utils/injectionKeys.js +1 -0
  43. package/package.json +17 -14
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@una-ui/nuxt",
3
3
  "configKey": "una",
4
- "version": "0.31.0-beta.1",
4
+ "version": "0.32.0-beta.1",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.0.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -7,7 +7,7 @@ import 'unocss';
7
7
  import 'unocss-preset-animations';
8
8
 
9
9
  const name = "@una-ui/nuxt";
10
- const version = "0.31.0-beta.1";
10
+ const version = "0.32.0-beta.1";
11
11
 
12
12
  const module = defineNuxtModule({
13
13
  meta: {
@@ -148,6 +148,20 @@ const module = defineNuxtModule({
148
148
  watch: nuxt.options.dev,
149
149
  priority: 10
150
150
  });
151
+ addComponentsDir({
152
+ path: resolve(runtimeDir, "components", "overlays"),
153
+ prefix: options.prefix,
154
+ global: options.global,
155
+ watch: nuxt.options.dev,
156
+ priority: 10
157
+ });
158
+ addComponentsDir({
159
+ path: resolve(runtimeDir, "components/overlays", "toast"),
160
+ prefix: options.prefix,
161
+ global: options.global,
162
+ watch: nuxt.options.dev,
163
+ priority: 10
164
+ });
151
165
  if (options.themeable) {
152
166
  addPlugin(resolve(runtimeDir, "plugins", "theme.client"));
153
167
  addPlugin(resolve(runtimeDir, "plugins", "theme.server"));
@@ -163,6 +177,14 @@ const module = defineNuxtModule({
163
177
  await installModule("radix-vue/nuxt", {
164
178
  prefix: options.prefix
165
179
  });
180
+ await installModule("@vee-validate/nuxt", {
181
+ componentNames: {
182
+ Form: `${options.prefix}Form`,
183
+ // Field: `${options.prefix}FormField`,
184
+ FieldArray: `${options.prefix}FormFieldArray`,
185
+ ErrorMessage: `${options.prefix}FormErrorMessage`
186
+ }
187
+ });
166
188
  addImportsDir(resolve(runtimeDir, "composables"));
167
189
  }
168
190
  });
@@ -48,7 +48,6 @@ const delegatedProps = computed(() => {
48
48
  v-bind="props._tableProgress"
49
49
  :class="cn(
50
50
  props._tableProgress?.class,
51
- 'bg-transparent',
52
51
  )"
53
52
  />
54
53
  </slot>
@@ -28,6 +28,8 @@ const mergeVariants = computed(() => {
28
28
  }
29
29
  })
30
30
 
31
+ const loadingPlacement = computed(() => props.loadingPlacement === 'leading' && props.icon ? 'label' : props.loadingPlacement)
32
+
31
33
  const btnVariants = ['solid', 'outline', 'soft', 'ghost', 'link', 'text'] as const
32
34
 
33
35
  const hasVariant = computed(() =>
@@ -91,7 +93,6 @@ const [DefineTemplate, ReuseTemplate] = createReusableTemplate()
91
93
  </slot>
92
94
 
93
95
  <ReuseTemplate v-if="loading && loadingPlacement === 'label'" />
94
-
95
96
  <slot v-else>
96
97
  <NIcon
97
98
  v-if="label && icon"
@@ -30,6 +30,7 @@ declare global {
30
30
  dir: any;
31
31
  };
32
32
  const __VLS_unref: typeof import('vue').unref;
33
+ const __VLS_placeholder: any;
33
34
  const __VLS_nativeElements: {
34
35
  a: HTMLAnchorElement;
35
36
  abbr: HTMLElement;
@@ -231,6 +232,11 @@ declare global {
231
232
  };
232
233
  } ? NonNullable<P> : never : T extends (props: infer P, ...args: any) => any ? P : {};
233
234
  type __VLS_IsFunction<T, K> = K extends keyof T ? __VLS_IsAny<T[K]> extends false ? unknown extends T[K] ? false : true : false : false;
235
+ type __VLS_NormalizeComponentEvent<Props, Events, onEvent extends keyof Props, Event extends keyof Events, CamelizedEvent extends keyof Events> = (__VLS_IsFunction<Props, onEvent> extends true ? Props : __VLS_IsFunction<Events, Event> extends true ? {
236
+ [K in onEvent]?: Events[Event];
237
+ } : __VLS_IsFunction<Events, CamelizedEvent> extends true ? {
238
+ [K in onEvent]?: Events[CamelizedEvent];
239
+ } : Props) & Record<string, unknown>;
234
240
  type __VLS_UnionToIntersection<U> = (U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never;
235
241
  type __VLS_OverloadUnionInner<T, U = unknown> = U & T extends (...args: infer A) => infer R ? U extends T ? never : __VLS_OverloadUnionInner<T, Pick<T, keyof T> & U & ((...args: A) => R)> | ((...args: A) => R) : never;
236
242
  type __VLS_OverloadUnion<T> = Exclude<__VLS_OverloadUnionInner<(() => never) & T>, T extends () => never ? never : () => never>;
@@ -286,7 +292,6 @@ declare global {
286
292
  function __VLS_makeOptional<T>(t: T): {
287
293
  [K in keyof T]?: T[K];
288
294
  };
289
- function __VLS_nonNullable<T>(t: T): T extends null | undefined ? never : T;
290
295
  function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K): T extends new (...args: any) => any ? (props: (K extends {
291
296
  $props: infer Props;
292
297
  } ? Props : any) & Record<string, unknown>, ctx?: any) => __VLS_Element & {
@@ -63,5 +63,5 @@ const delegatedProps = computed(() => {
63
63
  </template>
64
64
 
65
65
  <style scoped>
66
- .increase.progress-indeterminate{animation:progress-increase 2s ease-in-out infinite}.decrease.progress-indeterminate{animation:progress-indeterminate-decrease 2s ease-in-out .9s infinite}@keyframes progress-decrease{0%{left:-90%;width:90%}to{left:110%;width:10%}}@keyframes progress-increase{0%{left:-5%;width:5%}to{left:130%;width:150%}}
66
+ .increase.progress-indeterminate{animation:progress-indeterminate-increase 2s ease-in-out infinite}.decrease.progress-indeterminate{animation:progress-indeterminate-decrease 2s ease-in-out .5s infinite}@keyframes progress-indeterminate-decrease{0%{left:-90%;width:90%}to{left:110%;width:10%}}@keyframes progress-indeterminate-increase{0%{left:-5%;width:5%}to{left:130%;width:150%}}
67
67
  </style>
@@ -13,6 +13,7 @@ const props = withDefaults(defineProps<NToggleProps>(), {
13
13
  })
14
14
 
15
15
  const emits = defineEmits<ToggleEmits>()
16
+ const slots = defineSlots<any>()
16
17
 
17
18
  const delegatedProps = computed(() => {
18
19
  const { class: _, ...delegated } = props
@@ -34,7 +35,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
34
35
  :toggle-on
35
36
  :as="Button"
36
37
  >
37
- <template v-for="(_, name) in $slots" #[name]="slotData">
38
+ <template v-for="(_, name) in slots" #[name]="slotData">
38
39
  <slot :name="name" v-bind="slotData" />
39
40
  </template>
40
41
  </Toggle>
@@ -12,6 +12,8 @@ const props = withDefaults(defineProps<NDialogCloseProps>(), {
12
12
  label: 'i-close',
13
13
  })
14
14
 
15
+ const slots = defineSlots<any>()
16
+
15
17
  const delegatedProps = reactiveOmit(props, 'class')
16
18
  </script>
17
19
 
@@ -25,7 +27,7 @@ const delegatedProps = reactiveOmit(props, 'class')
25
27
  v-bind="delegatedProps"
26
28
  :class="cn('dialog-close', props.class)"
27
29
  >
28
- <template v-for="(_, name) in $slots" #[name]="slotData">
30
+ <template v-for="(_, name) in slots" #[name]="slotData">
29
31
  <slot :name="name" v-bind="slotData" />
30
32
  </template>
31
33
  </Button>
@@ -42,7 +42,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
42
42
  @interact-outside="event => {
43
43
  if (preventClose) return event.preventDefault()
44
44
  }"
45
- @escape-key-down="event => {
45
+ @escape-key-down="(event:any) => {
46
46
  if (preventClose) return event.preventDefault()
47
47
  }"
48
48
  >
@@ -10,6 +10,8 @@ const props = withDefaults(defineProps<NDropdownMenuItemProps>(), {
10
10
  dropdownMenuItem: '~',
11
11
  })
12
12
 
13
+ const slots = defineSlots<any>()
14
+
13
15
  const delegatedProps = computed(() => {
14
16
  const { class: _, ...delegated } = props
15
17
 
@@ -29,7 +31,7 @@ const forwardedProps = useForwardProps(delegatedProps)
29
31
  :dropdown-menu-item
30
32
  :class="cn(
31
33
  'dropdown-menu-item-base w-full justify-start font-normal rounded-sm px-2',
32
- forwardedProps.inset && !(forwardedProps.leading || $slots.leading) && 'pl-8',
34
+ forwardedProps.inset && !(forwardedProps.leading || slots.leading) && 'pl-8',
33
35
  props.class,
34
36
  )"
35
37
  btn="~"
@@ -39,7 +41,7 @@ const forwardedProps = useForwardProps(delegatedProps)
39
41
  ...forwardedProps.una,
40
42
  }"
41
43
  >
42
- <template v-for="(_, name) in $slots" #[name]="slotData">
44
+ <template v-for="(_, name) in slots" #[name]="slotData">
43
45
  <slot :name="name" v-bind="slotData" />
44
46
  </template>
45
47
 
@@ -12,6 +12,8 @@ const props = withDefaults(defineProps<NDropdownMenuSubTriggerProps>(), {
12
12
  dropdownMenuItem: '~',
13
13
  })
14
14
 
15
+ const slots = defineSlots<any>()
16
+
15
17
  const delegatedProps = computed(() => {
16
18
  const { class: _, ...delegated } = props
17
19
 
@@ -31,7 +33,7 @@ const forwardedProps = useForwardProps(delegatedProps)
31
33
  :dropdown-menu-item
32
34
  :class="cn(
33
35
  'dropdown-menu-sub-trigger w-full justify-start font-normal rounded-sm px-2',
34
- forwardedProps.inset && !(forwardedProps.leading || $slots.leading) && 'pl-8',
36
+ forwardedProps.inset && !(forwardedProps.leading || slots.leading) && 'pl-8',
35
37
  props.class,
36
38
  )"
37
39
  btn="~"
@@ -11,6 +11,8 @@ const props = withDefaults(defineProps<NPaginationListItemProps>(), {
11
11
  square: true,
12
12
  })
13
13
 
14
+ const slots = defineSlots<any>()
15
+
14
16
  const delegatedProps = computed(() => {
15
17
  const { value: __, class: _, ...delegated } = props
16
18
 
@@ -38,7 +40,7 @@ const forwardedProps = useForwardProps(delegatedProps)
38
40
  props.class,
39
41
  )"
40
42
  >
41
- <template v-for="(_, name) in $slots" #[name]="slotData">
43
+ <template v-for="(_, name) in slots" #[name]="slotData">
42
44
  <slot :name="name" v-bind="slotData" />
43
45
  </template>
44
46
  </Button>
@@ -0,0 +1,16 @@
1
+ <script lang="ts" setup>
2
+ import { Slot } from 'radix-vue'
3
+ import { useFormField } from '../../../composables/useFormField'
4
+
5
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
6
+ </script>
7
+
8
+ <template>
9
+ <Slot
10
+ :id="formItemId"
11
+ :aria-describedby="!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`"
12
+ :aria-invalid="!!error"
13
+ >
14
+ <slot />
15
+ </Slot>
16
+ </template>
@@ -0,0 +1,22 @@
1
+ <script lang="ts" setup>
2
+ import type { NFormDescriptionProps } from '../../../types'
3
+ import { useFormField } from '../../../composables/useFormField'
4
+ import { cn } from '../../../utils'
5
+
6
+ const props = defineProps<NFormDescriptionProps>()
7
+
8
+ const { formDescriptionId } = useFormField()
9
+ </script>
10
+
11
+ <template>
12
+ <p
13
+ :id="formDescriptionId"
14
+ :class="cn(
15
+ 'form-description',
16
+ props.una?.formDescription,
17
+ props.class,
18
+ )"
19
+ >
20
+ <slot />
21
+ </p>
22
+ </template>
@@ -0,0 +1,156 @@
1
+ <script setup lang="ts">
2
+ import type { NFormFieldProps } from '../../../types'
3
+ import { Field } from 'vee-validate'
4
+ import { computed } from 'vue'
5
+ import { cn } from '../../../utils'
6
+ import FormFieldDefaultSlot from '../../slots/FormFieldDefault'
7
+ import FormControl from './FormControl.vue'
8
+ import FormDescription from './FormDescription.vue'
9
+ import FormItem from './FormItem.vue'
10
+ import FormLabel from './FormLabel.vue'
11
+ import FormMessage from './FormMessage.vue'
12
+
13
+ defineOptions({
14
+ inheritAttrs: false,
15
+ })
16
+
17
+ const props = defineProps<NFormFieldProps>()
18
+
19
+ const statusClassVariants = computed(() => {
20
+ const text = {
21
+ info: 'text-info',
22
+ success: 'text-success',
23
+ warning: 'text-warning',
24
+ error: 'text-error',
25
+ default: 'text-muted',
26
+ }
27
+
28
+ return text[props.status ?? 'default']
29
+ })
30
+ </script>
31
+
32
+ <template>
33
+ <Field
34
+ v-slot="{ componentField, errorMessage }"
35
+ :name
36
+ >
37
+ <FormItem
38
+ :class="cn(
39
+ props.class,
40
+ )"
41
+ >
42
+ <slot name="top">
43
+ <div
44
+ :class="cn(
45
+ 'form-field-top-wrapper',
46
+ una?.formFieldTopWrapper,
47
+ )"
48
+ >
49
+ <div
50
+ v-if="label || hint || description"
51
+ :class="cn(
52
+ 'form-field-top-wrapper',
53
+ una?.formFieldTopWrapper,
54
+ )"
55
+ >
56
+ <div
57
+ v-if="label || hint"
58
+ :class="cn(
59
+ 'form-field-top-wrapper-inner',
60
+ una?.formFieldTopWrapperInner,
61
+ )"
62
+ >
63
+ <div
64
+ :class="cn(
65
+ 'form-field-label-wrapper',
66
+ una?.formFieldLabelWrapper,
67
+ )"
68
+ >
69
+ <slot name="label">
70
+ <FormLabel
71
+ :una
72
+ >
73
+ <span>
74
+ {{ label }}
75
+ </span>
76
+
77
+ <span
78
+ v-if="required"
79
+ :class="cn(
80
+ 'form-field-label-required',
81
+ una?.formFieldLabelRequired,
82
+ )"
83
+ />
84
+ </FormLabel>
85
+ </slot>
86
+ </div>
87
+
88
+ <slot name="hint">
89
+ <span
90
+ v-if="hint"
91
+ :class="cn(
92
+ 'form-field-hint',
93
+ una?.formFieldHint,
94
+ )"
95
+ >
96
+ {{ hint }}
97
+ </span>
98
+ </slot>
99
+ </div>
100
+
101
+ <slot name="description">
102
+ <FormDescription
103
+ v-if="description"
104
+ :una
105
+ >
106
+ {{ description }}
107
+ </FormDescription>
108
+ </slot>
109
+ </div>
110
+ </div>
111
+ </slot>
112
+
113
+ <FormControl>
114
+ <FormFieldDefaultSlot
115
+ :status="!errorMessage ? status : 'error'"
116
+ v-bind="componentField"
117
+ >
118
+ <slot />
119
+ </FormFieldDefaultSlot>
120
+ </FormControl>
121
+
122
+ <slot name="bottom">
123
+ <div
124
+ :class="cn(
125
+ 'form-field-bottom-wrapper',
126
+ una?.formFieldBottomWrapper,
127
+ )"
128
+ >
129
+ <slot name="message">
130
+ <div
131
+ v-if="message && !errorMessage"
132
+ :class="cn(
133
+ 'form-field-message-wrapper',
134
+ una?.formFieldMessageWrapper,
135
+ )"
136
+ >
137
+ <FormDescription
138
+ :class="cn(
139
+ 'form-field-message',
140
+ una?.formMessage,
141
+ statusClassVariants,
142
+ )"
143
+ >
144
+ {{ message }}
145
+ </FormDescription>
146
+ </div>
147
+
148
+ <FormMessage
149
+ v-else
150
+ />
151
+ </slot>
152
+ </div>
153
+ </slot>
154
+ </FormItem>
155
+ </Field>
156
+ </template>
@@ -0,0 +1,23 @@
1
+ <script lang="ts" setup>
2
+ import type { NFormItemProps } from '../../../types'
3
+ import { provide } from 'vue'
4
+ import { cn, randomId } from '../../../utils'
5
+ import { FORM_ITEM_INJECTION_KEY } from '../../../utils/injectionKeys'
6
+
7
+ const props = defineProps<NFormItemProps>()
8
+
9
+ const id = randomId('form')
10
+ provide(FORM_ITEM_INJECTION_KEY, id)
11
+ </script>
12
+
13
+ <template>
14
+ <div
15
+ :class="cn(
16
+ 'form-item',
17
+ props.una?.formItem,
18
+ props.class,
19
+ )"
20
+ >
21
+ <slot />
22
+ </div>
23
+ </template>
@@ -0,0 +1,23 @@
1
+ <script lang="ts" setup>
2
+ import type { NFormLabelProps } from '../../../types'
3
+ import { useFormField } from '../../../composables/useFormField'
4
+ import { cn } from '../../../utils'
5
+ import Label from '../../elements/Label.vue'
6
+
7
+ const props = defineProps<NFormLabelProps>()
8
+
9
+ const { formItemId } = useFormField()
10
+ </script>
11
+
12
+ <template>
13
+ <Label
14
+ :class="cn(
15
+ 'form-label',
16
+ props.una?.formLabel,
17
+ props.class,
18
+ )"
19
+ :for="formItemId"
20
+ >
21
+ <slot />
22
+ </Label>
23
+ </template>
@@ -0,0 +1,24 @@
1
+ <script lang="ts" setup>
2
+ import type { NFormMessageProps } from '../../../types'
3
+ import { ErrorMessage } from 'vee-validate'
4
+ import { toValue } from 'vue'
5
+ import { useFormField } from '../../../composables/useFormField'
6
+ import { cn } from '../../../utils'
7
+
8
+ const props = defineProps<NFormMessageProps>()
9
+
10
+ const { name, formMessageId } = useFormField()
11
+ </script>
12
+
13
+ <template>
14
+ <ErrorMessage
15
+ :id="formMessageId"
16
+ as="p"
17
+ :name="toValue(name)"
18
+ :class="cn(
19
+ 'form-message',
20
+ props.una?.formMessage,
21
+ props.class,
22
+ )"
23
+ />
24
+ </template>
@@ -21,7 +21,7 @@ const slots = defineSlots<{
21
21
  trailing?: any
22
22
  }>()
23
23
 
24
- const id = computed(() => props.id ?? randomId('input'))
24
+ const id = props.id ?? randomId('input')
25
25
 
26
26
  const isLeading = computed(() => props.leading || slots.leading)
27
27
  const isTrailing = computed(() => props.trailing || slots.trailing || props.status || props.loading)
@@ -113,9 +113,11 @@ onMounted(() => {
113
113
 
114
114
  <template>
115
115
  <div
116
- input="wrapper"
117
- :size="size"
118
- :class="una?.inputWrapper"
116
+ :size
117
+ :class="cn(
118
+ 'input-wrapper',
119
+ una?.inputWrapper,
120
+ )"
119
121
  >
120
122
  <div
121
123
  v-if="isLeading"
@@ -129,27 +131,29 @@ onMounted(() => {
129
131
  <NIcon
130
132
  v-if="leading"
131
133
  :name="leading"
132
- input="leading"
133
- :class="una?.inputLeading"
134
+ :class="cn(
135
+ 'input-leading',
136
+ una?.inputLeading,
137
+ )"
134
138
  @click="emit('leading')"
135
139
  />
136
140
  </slot>
137
141
  </div>
138
142
 
139
- <Component
143
+ <component
140
144
  :is="props.type !== 'textarea' ? 'input' : 'textarea'"
141
- :id="id"
145
+ :id
142
146
  ref="textarea"
143
147
  :value="modelValue"
144
148
  :type="props.type !== 'textarea' ? props.type : undefined"
145
- class="input"
146
149
  :class="cn(
150
+ 'input',
147
151
  type === 'textarea' ? 'input-textarea' : 'input-input',
148
152
  statusClassVariants.input,
149
153
  reverseClassVariants.input,
150
154
  una?.input,
151
155
  )"
152
- :input="input"
156
+ :input
153
157
  :resize="type === 'textarea' ? resize : undefined"
154
158
  :rows="type === 'textarea' ? rows : undefined"
155
159
  :cols="type === 'textarea' ? cols : undefined"
@@ -167,22 +171,28 @@ onMounted(() => {
167
171
  >
168
172
  <NIcon
169
173
  v-if="loading"
170
- input="loading"
171
174
  :name="una?.inputLoadingIcon ?? 'input-loading-icon'"
172
- :class="una?.inputLoading"
175
+ :class="cn(
176
+ 'input-loading',
177
+ una?.inputLoading,
178
+ )"
173
179
  />
174
180
 
175
181
  <NIcon
176
182
  v-else-if="status"
177
- input="status-icon-base"
178
183
  :name="statusClassVariants.icon"
184
+ :class="cn(
185
+ 'input-status-icon-base',
186
+ )"
179
187
  />
180
188
 
181
189
  <slot v-else name="trailing">
182
190
  <NIcon
183
191
  v-if="trailing"
184
- input="trailing"
185
- :class="una?.inputTrailing"
192
+ :class="cn(
193
+ 'input-trailing',
194
+ una?.inputTrailing,
195
+ )"
186
196
  :name="trailing"
187
197
  @click="emit('trailing')"
188
198
  />
@@ -0,0 +1,39 @@
1
+ <script setup lang="ts">
2
+ import type { NToasterProps } from '../../types'
3
+ import { reactivePick } from '@vueuse/core'
4
+ import { useToast } from '../../composables/useToast'
5
+ import Toast from './toast/Toast.vue'
6
+ import ToastProvider from './toast/ToastProvider.vue'
7
+ import ToastViewport from './toast/ToastViewport.vue'
8
+
9
+ defineOptions({
10
+ inheritAttrs: false,
11
+ })
12
+
13
+ const props = defineProps<NToasterProps>()
14
+ const slots = defineSlots<any>()
15
+
16
+ const rootProps = reactivePick(props, ['duration', 'label', 'swipeDirection', 'swipeThreshold'])
17
+
18
+ const { toasts } = useToast()
19
+ </script>
20
+
21
+ <template>
22
+ <ToastProvider
23
+ v-bind="rootProps"
24
+ >
25
+ <slot>
26
+ <Toast
27
+ v-for="t in toasts"
28
+ :key="t.id"
29
+ v-bind="{ ..._toast, ...$attrs, ...t }"
30
+ >
31
+ <template v-for="(_, name) in slots" #[name]="slotData">
32
+ <slot :name="name" v-bind="slotData" />
33
+ </template>
34
+ </Toast>
35
+ </slot>
36
+
37
+ <ToastViewport v-bind="_toastViewport" />
38
+ </ToastProvider>
39
+ </template>