nuxt-ui-elements 0.1.13 → 0.1.14

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.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-ui-elements",
3
3
  "configKey": "uiElements",
4
- "version": "0.1.13",
4
+ "version": "0.1.14",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -36,16 +36,14 @@ const dialogConfirm = (options) => ({
36
36
  color,
37
37
  variant: "solid",
38
38
  class: {
39
- content: `bg-${color} text-inverted`,
40
- close: "!text-white hover:bg-white/10 active:bg-white/20"
39
+ content: `bg-${color} text-inverted`
41
40
  }
42
41
  })),
43
42
  {
44
43
  color: "neutral",
45
44
  variant: "solid",
46
45
  class: {
47
- content: "text-inverted bg-inverted",
48
- close: "!text-white hover:bg-white/10 active:bg-white/20"
46
+ content: "text-inverted bg-inverted"
49
47
  }
50
48
  },
51
49
  // Outline variants - dynamically generated for all theme colors
@@ -2,18 +2,8 @@ import type { AppConfig } from "@nuxt/schema";
2
2
  import theme from "#build/ui-elements/dialog-confirm";
3
3
  import type { ComponentConfig } from "../types/tv.js";
4
4
  type DialogConfirm = ComponentConfig<typeof theme, AppConfig, "dialogConfirm">;
5
- export interface DialogConfirmEmits {
6
- "update:open": [value: boolean];
7
- close: [value?: any];
8
- "after:leave": [];
9
- }
10
- export interface DialogConfirmSlots {
11
- title(props?: {}): any;
12
- description(props?: {}): any;
13
- actions(props?: {}): any;
14
- }
15
- export interface DialogConfirmProps {
16
- title: string;
5
+ interface DialogConfirmProps {
6
+ title?: string;
17
7
  description?: string;
18
8
  icon?: boolean;
19
9
  confirmLabel?: string;
@@ -23,11 +13,11 @@ export interface DialogConfirmProps {
23
13
  variant?: DialogConfirm["variants"]["variant"];
24
14
  onConfirm?: (() => void) | (() => Promise<void>);
25
15
  onDismiss?: () => void;
26
- ui?: Partial<DialogConfirm["slots"]>;
16
+ ui?: DialogConfirm["slots"];
27
17
  }
28
18
  declare const _default: typeof __VLS_export;
29
19
  export default _default;
30
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<DialogConfirmProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ declare const __VLS_export: import("vue").DefineComponent<DialogConfirmProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
21
  close: (value?: any) => any;
32
22
  "update:open": (value: boolean) => any;
33
23
  "after:leave": () => any;
@@ -35,15 +25,4 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Dialog
35
25
  onClose?: ((value?: any) => any) | undefined;
36
26
  "onUpdate:open"?: ((value: boolean) => any) | undefined;
37
27
  "onAfter:leave"?: (() => any) | undefined;
38
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
39
- title?: (props: {}) => any;
40
- } & {
41
- description?: (props: {}) => any;
42
- } & {
43
- actions?: (props: {}) => any;
44
- }>;
45
- type __VLS_WithSlots<T, S> = T & {
46
- new (): {
47
- $slots: S;
48
- };
49
- };
28
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -7,7 +7,7 @@ import { tv } from "../utils/tv";
7
7
 
8
8
  <script setup>
9
9
  const {
10
- title,
10
+ title = "",
11
11
  description = "",
12
12
  icon = true,
13
13
  confirmLabel = "Yes",
@@ -15,11 +15,13 @@ const {
15
15
  close = false,
16
16
  color = "neutral",
17
17
  variant = "solid",
18
- onConfirm,
19
- onDismiss,
20
- ui: uiProps
18
+ onConfirm = () => {
19
+ },
20
+ onDismiss = () => {
21
+ },
22
+ ui: uiProps = {}
21
23
  } = defineProps({
22
- title: { type: String, required: true },
24
+ title: { type: String, required: false },
23
25
  description: { type: String, required: false },
24
26
  icon: { type: Boolean, required: false },
25
27
  confirmLabel: { type: String, required: false },
@@ -29,7 +31,7 @@ const {
29
31
  variant: { type: null, required: false },
30
32
  onConfirm: { type: Function, required: false },
31
33
  onDismiss: { type: Function, required: false },
32
- ui: { type: Object, required: false }
34
+ ui: { type: null, required: false }
33
35
  });
34
36
  const emits = defineEmits(["update:open", "close", "after:leave"]);
35
37
  const isLoading = ref(false);
@@ -64,10 +66,6 @@ const closeButtonProps = computed(() => ({
64
66
  variant: "ghost"
65
67
  }));
66
68
  const confirmHandler = async () => {
67
- if (!onConfirm) {
68
- emits("close");
69
- return;
70
- }
71
69
  try {
72
70
  const result = onConfirm();
73
71
  const isAsync = result instanceof Promise;
@@ -121,15 +119,11 @@ const handleClose = () => {
121
119
  <UIcon v-if="dialogIcon" :name="dialogIcon" data-slot="icon" :class="ui.icon({ class: uiProps?.icon })" />
122
120
  <div class="flex-1 min-w-0">
123
121
  <DialogTitle v-if="title" data-slot="title" :class="ui.title({ class: uiProps?.title })">
124
- <slot name="title">
125
- {{ title }}
126
- </slot>
122
+ {{ title }}
127
123
  </DialogTitle>
128
124
 
129
125
  <DialogDescription v-if="description" :class="ui.description({ class: uiProps?.description })">
130
- <slot name="description">
131
- {{ description }}
132
- </slot>
126
+ {{ description }}
133
127
  </DialogDescription>
134
128
  </div>
135
129
 
@@ -137,34 +131,35 @@ const handleClose = () => {
137
131
  v-if="close"
138
132
  v-bind="closeButtonProps"
139
133
  data-slot="close"
140
- :class="ui.close({ class: uiProps?.close })"
134
+ :ui="{
135
+ base: 'text-white hover:bg-white/10 active:bg-white/20'
136
+ }"
141
137
  @click="handleClose" />
142
138
  </div>
143
139
  </template>
144
140
 
145
141
  <template #footer>
146
- <slot name="actions">
147
- <!-- Dismiss button (No) - hidden when loading, complete, or error -->
148
- <UButton
149
- v-if="dismissLabel && !isLoading && !isComplete && !isError"
150
- :label="dismissLabel"
151
- size="lg"
152
- :color="color"
153
- variant="solid"
154
- @click="dismiss" />
142
+ <UButton
143
+ v-if="dismissLabel && !isLoading && !isComplete && !isError"
144
+ :label="dismissLabel"
145
+ size="lg"
146
+ color="neutral"
147
+ variant="ghost"
148
+ :ui="{
149
+ base: 'text-white hover:bg-white/10 active:bg-white/20'
150
+ }"
151
+ @click="dismiss" />
155
152
 
156
- <!-- Confirm button (Yes) - shows loading/complete/error states -->
157
- <UButton
158
- :label="isError ? 'Error' : isComplete ? 'Complete' : confirmLabel"
159
- size="lg"
160
- color="neutral"
161
- variant="outline"
162
- :loading="isLoading"
163
- :disabled="isComplete"
164
- :leading-icon="isError ? 'i-lucide-circle-x' : isComplete ? 'i-lucide-check' : void 0"
165
- :class="{ 'animate-shake': isError }"
166
- @click="confirmHandler" />
167
- </slot>
153
+ <UButton
154
+ :label="isError ? 'Error' : isComplete ? 'Complete' : confirmLabel"
155
+ size="lg"
156
+ color="neutral"
157
+ variant="outline"
158
+ :loading="isLoading"
159
+ :disabled="isComplete"
160
+ :leading-icon="isError ? 'i-lucide-circle-x' : isComplete ? 'i-lucide-check' : void 0"
161
+ :class="{ 'animate-shake': isError }"
162
+ @click="confirmHandler" />
168
163
  </template>
169
164
  </UModal>
170
165
  </template>
@@ -2,18 +2,8 @@ import type { AppConfig } from "@nuxt/schema";
2
2
  import theme from "#build/ui-elements/dialog-confirm";
3
3
  import type { ComponentConfig } from "../types/tv.js";
4
4
  type DialogConfirm = ComponentConfig<typeof theme, AppConfig, "dialogConfirm">;
5
- export interface DialogConfirmEmits {
6
- "update:open": [value: boolean];
7
- close: [value?: any];
8
- "after:leave": [];
9
- }
10
- export interface DialogConfirmSlots {
11
- title(props?: {}): any;
12
- description(props?: {}): any;
13
- actions(props?: {}): any;
14
- }
15
- export interface DialogConfirmProps {
16
- title: string;
5
+ interface DialogConfirmProps {
6
+ title?: string;
17
7
  description?: string;
18
8
  icon?: boolean;
19
9
  confirmLabel?: string;
@@ -23,11 +13,11 @@ export interface DialogConfirmProps {
23
13
  variant?: DialogConfirm["variants"]["variant"];
24
14
  onConfirm?: (() => void) | (() => Promise<void>);
25
15
  onDismiss?: () => void;
26
- ui?: Partial<DialogConfirm["slots"]>;
16
+ ui?: DialogConfirm["slots"];
27
17
  }
28
18
  declare const _default: typeof __VLS_export;
29
19
  export default _default;
30
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<DialogConfirmProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ declare const __VLS_export: import("vue").DefineComponent<DialogConfirmProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
21
  close: (value?: any) => any;
32
22
  "update:open": (value: boolean) => any;
33
23
  "after:leave": () => any;
@@ -35,15 +25,4 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Dialog
35
25
  onClose?: ((value?: any) => any) | undefined;
36
26
  "onUpdate:open"?: ((value: boolean) => any) | undefined;
37
27
  "onAfter:leave"?: (() => any) | undefined;
38
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
39
- title?: (props: {}) => any;
40
- } & {
41
- description?: (props: {}) => any;
42
- } & {
43
- actions?: (props: {}) => any;
44
- }>;
45
- type __VLS_WithSlots<T, S> = T & {
46
- new (): {
47
- $slots: S;
48
- };
49
- };
28
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-ui-elements",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "A collection of beautiful, animated UI components for Nuxt applications",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/genu/nuxt-ui-elements.git",