@nuxt/ui 3.0.0-alpha.5 → 3.0.0-alpha.7

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 (49) hide show
  1. package/README.md +4 -2
  2. package/dist/module.d.mts +19 -5
  3. package/dist/module.d.ts +19 -5
  4. package/dist/module.json +2 -1
  5. package/dist/module.mjs +514 -338
  6. package/dist/runtime/components/Accordion.vue +13 -5
  7. package/dist/runtime/components/Alert.vue +2 -2
  8. package/dist/runtime/components/Breadcrumb.vue +16 -8
  9. package/dist/runtime/components/Button.vue +4 -2
  10. package/dist/runtime/components/Carousel.vue +306 -0
  11. package/dist/runtime/components/Checkbox.vue +3 -6
  12. package/dist/runtime/components/CommandPalette.vue +27 -18
  13. package/dist/runtime/components/ContextMenu.vue +33 -9
  14. package/dist/runtime/components/ContextMenuContent.vue +36 -8
  15. package/dist/runtime/components/DropdownMenu.vue +33 -9
  16. package/dist/runtime/components/DropdownMenuContent.vue +38 -8
  17. package/dist/runtime/components/Form.vue +6 -2
  18. package/dist/runtime/components/Input.vue +6 -4
  19. package/dist/runtime/components/InputMenu.vue +40 -24
  20. package/dist/runtime/components/LinkBase.vue +4 -2
  21. package/dist/runtime/components/Modal.vue +2 -2
  22. package/dist/runtime/components/NavigationMenu.vue +80 -43
  23. package/dist/runtime/components/Pagination.vue +2 -2
  24. package/dist/runtime/components/RadioGroup.vue +22 -3
  25. package/dist/runtime/components/Select.vue +22 -10
  26. package/dist/runtime/components/SelectMenu.vue +43 -31
  27. package/dist/runtime/components/Slideover.vue +2 -2
  28. package/dist/runtime/components/Table.vue +232 -0
  29. package/dist/runtime/components/Tabs.vue +15 -7
  30. package/dist/runtime/components/Toast.vue +2 -2
  31. package/dist/runtime/components/Toaster.vue +1 -1
  32. package/dist/runtime/composables/defineShortcuts.js +1 -1
  33. package/dist/runtime/composables/useComponentIcons.d.ts +3 -0
  34. package/dist/runtime/composables/useModal.d.ts +1 -1
  35. package/dist/runtime/composables/useSlideover.d.ts +1 -1
  36. package/dist/runtime/index.css +1 -1
  37. package/dist/runtime/keyframes.css +1 -0
  38. package/dist/runtime/plugins/colors.js +11 -7
  39. package/dist/runtime/types/form.d.ts +3 -1
  40. package/dist/runtime/types/index.d.ts +2 -0
  41. package/dist/runtime/types/index.js +2 -0
  42. package/dist/runtime/utils/form.d.ts +7 -1
  43. package/dist/runtime/utils/form.js +25 -1
  44. package/dist/runtime/utils/index.d.ts +1 -0
  45. package/dist/runtime/utils/index.js +3 -0
  46. package/dist/runtime/utils/link.d.ts +1 -1
  47. package/package.json +30 -14
  48. package/dist/runtime/types/component.d.ts +0 -17
  49. package/dist/runtime/types/component.js +0 -0
@@ -1,9 +1,11 @@
1
+ import type { StandardSchema } from '@standard-schema/spec';
1
2
  import type { ComputedRef, Ref } from 'vue';
2
3
  import type { ZodSchema } from 'zod';
3
4
  import type { Schema as JoiSchema } from 'joi';
4
5
  import type { ObjectSchema as YupObjectSchema } from 'yup';
5
6
  import type { GenericSchema as ValibotSchema, GenericSchemaAsync as ValibotSchemaAsync, SafeParser as ValibotSafeParser, SafeParserAsync as ValibotSafeParserAsync } from 'valibot';
6
7
  import type { GetObjectField } from './utils';
8
+ import type { Struct as SuperstructSchema } from 'superstruct';
7
9
  export interface Form<T> {
8
10
  validate(opts?: {
9
11
  name: string | string[];
@@ -17,7 +19,7 @@ export interface Form<T> {
17
19
  submit(): Promise<void>;
18
20
  disabled: ComputedRef<boolean>;
19
21
  }
20
- export type FormSchema<T extends Record<string, any>> = ZodSchema | YupObjectSchema<T> | ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any> | JoiSchema<T>;
22
+ export type FormSchema<T extends Record<string, any>> = ZodSchema | YupObjectSchema<T> | ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any> | JoiSchema<T> | SuperstructSchema<any, any> | StandardSchema;
21
23
  export type FormInputEvents = 'input' | 'blur' | 'change';
22
24
  export interface FormError<P extends string = string> {
23
25
  name: P;
@@ -7,6 +7,7 @@ export * from '../components/Badge.vue';
7
7
  export * from '../components/Breadcrumb.vue';
8
8
  export * from '../components/Button.vue';
9
9
  export * from '../components/Card.vue';
10
+ export * from '../components/Carousel.vue';
10
11
  export * from '../components/Checkbox.vue';
11
12
  export * from '../components/Chip.vue';
12
13
  export * from '../components/Collapsible.vue';
@@ -34,6 +35,7 @@ export * from '../components/Skeleton.vue';
34
35
  export * from '../components/Slideover.vue';
35
36
  export * from '../components/Slider.vue';
36
37
  export * from '../components/Switch.vue';
38
+ export * from '../components/Table.vue';
37
39
  export * from '../components/Tabs.vue';
38
40
  export * from '../components/Textarea.vue';
39
41
  export * from '../components/Toast.vue';
@@ -7,6 +7,7 @@ export * from "../components/Badge.vue";
7
7
  export * from "../components/Breadcrumb.vue";
8
8
  export * from "../components/Button.vue";
9
9
  export * from "../components/Card.vue";
10
+ export * from "../components/Carousel.vue";
10
11
  export * from "../components/Checkbox.vue";
11
12
  export * from "../components/Chip.vue";
12
13
  export * from "../components/Collapsible.vue";
@@ -34,6 +35,7 @@ export * from "../components/Skeleton.vue";
34
35
  export * from "../components/Slideover.vue";
35
36
  export * from "../components/Slider.vue";
36
37
  export * from "../components/Switch.vue";
38
+ export * from "../components/Table.vue";
37
39
  export * from "../components/Tabs.vue";
38
40
  export * from "../components/Textarea.vue";
39
41
  export * from "../components/Toast.vue";
@@ -1,15 +1,21 @@
1
+ import type { StandardSchema } from '@standard-schema/spec';
1
2
  import type { ZodSchema } from 'zod';
2
3
  import type { ValidationError as JoiError, Schema as JoiSchema } from 'joi';
3
4
  import type { ObjectSchema as YupObjectSchema, ValidationError as YupError } from 'yup';
4
5
  import type { GenericSchema as ValibotSchema, GenericSchemaAsync as ValibotSchemaAsync, SafeParser as ValibotSafeParser, SafeParserAsync as ValibotSafeParserAsync } from 'valibot';
6
+ import type { Struct } from 'superstruct';
5
7
  import type { FormError } from '../types/form';
6
8
  export declare function isYupSchema(schema: any): schema is YupObjectSchema<any>;
7
9
  export declare function isYupError(error: any): error is YupError;
8
10
  export declare function getYupErrors(state: any, schema: YupObjectSchema<any>): Promise<FormError[]>;
11
+ export declare function isSuperStructSchema(schema: any): schema is Struct<any, any>;
9
12
  export declare function isZodSchema(schema: any): schema is ZodSchema;
10
13
  export declare function getZodErrors(state: any, schema: ZodSchema): Promise<FormError[]>;
11
14
  export declare function isJoiSchema(schema: any): schema is JoiSchema;
12
15
  export declare function isJoiError(error: any): error is JoiError;
13
16
  export declare function getJoiErrors(state: any, schema: JoiSchema): Promise<FormError[]>;
14
17
  export declare function isValibotSchema(schema: any): schema is ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any>;
15
- export declare function getValibotError(state: any, schema: ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any>): Promise<FormError[]>;
18
+ export declare function getValibotErrors(state: any, schema: ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any>): Promise<FormError[]>;
19
+ export declare function isStandardSchema(schema: any): schema is StandardSchema;
20
+ export declare function getStandardErrors(state: any, schema: StandardSchema): Promise<FormError[]>;
21
+ export declare function getSuperStructErrors(state: any, schema: Struct<any, any>): Promise<FormError[]>;
@@ -19,6 +19,9 @@ export async function getYupErrors(state, schema) {
19
19
  }
20
20
  }
21
21
  }
22
+ export function isSuperStructSchema(schema) {
23
+ return "schema" in schema && typeof schema.coercer === "function" && typeof schema.validator === "function" && typeof schema.refiner === "function";
24
+ }
22
25
  export function isZodSchema(schema) {
23
26
  return schema.parse !== void 0;
24
27
  }
@@ -56,7 +59,7 @@ export async function getJoiErrors(state, schema) {
56
59
  export function isValibotSchema(schema) {
57
60
  return "_run" in schema || typeof schema === "function" && "schema" in schema;
58
61
  }
59
- export async function getValibotError(state, schema) {
62
+ export async function getValibotErrors(state, schema) {
60
63
  const result = await ("_run" in schema ? schema._run({ typed: false, value: state }, {}) : schema(state));
61
64
  return result.issues?.map((issue) => ({
62
65
  // We know that the key for a form schema is always a string or a number
@@ -64,3 +67,24 @@ export async function getValibotError(state, schema) {
64
67
  message: issue.message
65
68
  })) || [];
66
69
  }
70
+ export function isStandardSchema(schema) {
71
+ return "~standard" in schema;
72
+ }
73
+ export async function getStandardErrors(state, schema) {
74
+ const result = await schema["~validate"]({ value: state });
75
+ return result.issues?.map((issue) => ({
76
+ name: issue.path?.map((item) => typeof item === "object" ? item.key : item).join(".") || "",
77
+ message: issue.message
78
+ })) || [];
79
+ }
80
+ export async function getSuperStructErrors(state, schema) {
81
+ const [err] = schema.validate(state);
82
+ if (err) {
83
+ const errors = err.failures();
84
+ return errors.map((error) => ({
85
+ message: error.message,
86
+ name: error.path.join(".")
87
+ }));
88
+ }
89
+ return [];
90
+ }
@@ -3,3 +3,4 @@ export declare function omit<Data extends object, Keys extends keyof Data>(data:
3
3
  export declare function get(object: Record<string, any> | undefined, path: (string | number)[] | string, defaultValue?: any): any;
4
4
  export declare function set(object: Record<string, any>, path: (string | number)[] | string, value: any): void;
5
5
  export declare function looseToNumber(val: any): any;
6
+ export declare function escapeRegExp(string: string): string;
@@ -45,3 +45,6 @@ export function looseToNumber(val) {
45
45
  const n = Number.parseFloat(val);
46
46
  return Number.isNaN(n) ? val : n;
47
47
  }
48
+ export function escapeRegExp(string) {
49
+ return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
50
+ }
@@ -4,6 +4,7 @@ export declare function pickLinkProps(link: LinkProps & {
4
4
  title?: string;
5
5
  }): {
6
6
  type: any;
7
+ title: any;
7
8
  active: any;
8
9
  activeClass: any;
9
10
  ariaCurrentValue: any;
@@ -25,5 +26,4 @@ export declare function pickLinkProps(link: LinkProps & {
25
26
  replace: any;
26
27
  target: any;
27
28
  to: any;
28
- title: any;
29
29
  };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@nuxt/ui",
3
3
  "description": "A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.",
4
- "version": "3.0.0-alpha.5",
5
- "packageManager": "pnpm@9.11.0",
4
+ "version": "3.0.0-alpha.7",
5
+ "packageManager": "pnpm@9.12.2",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/nuxt/ui.git"
@@ -38,51 +38,67 @@
38
38
  "docs": "DEV=true nuxi dev docs",
39
39
  "docs:build": "nuxi build docs",
40
40
  "docs:prepare": "nuxt-component-meta docs",
41
+ "docs:typecheck": "nuxi typecheck docs",
41
42
  "lint": "eslint .",
42
43
  "lint:fix": "eslint . --fix",
43
- "typecheck": "vue-tsc --noEmit && nuxi typecheck playground && nuxi typecheck docs",
44
+ "typecheck": "vue-tsc --noEmit && nuxi typecheck playground",
44
45
  "test": "vitest",
45
46
  "release": "release-it --preRelease=alpha --npm.tag=next"
46
47
  },
47
48
  "dependencies": {
48
- "@nuxt/fonts": "^0.9.2",
49
- "@nuxt/icon": "^1.5.2",
49
+ "@nuxt/fonts": "^0.10.2",
50
+ "@nuxt/icon": "^1.5.6",
50
51
  "@nuxt/kit": "^3.13.2",
51
52
  "@nuxt/schema": "^3.13.2",
52
53
  "@nuxtjs/color-mode": "^3.5.1",
53
- "@tailwindcss/postcss": "4.0.0-alpha.24",
54
- "@tailwindcss/vite": "4.0.0-alpha.24",
54
+ "@tailwindcss/postcss": "4.0.0-alpha.29",
55
+ "@tailwindcss/vite": "4.0.0-alpha.29",
56
+ "@tanstack/vue-table": "^8.20.5",
55
57
  "@vueuse/core": "^11.1.0",
56
58
  "@vueuse/integrations": "^11.1.0",
57
59
  "defu": "^6.1.4",
60
+ "embla-carousel-auto-height": "^8.3.0",
61
+ "embla-carousel-auto-scroll": "^8.3.0",
62
+ "embla-carousel-autoplay": "^8.3.0",
63
+ "embla-carousel-class-names": "^8.3.0",
64
+ "embla-carousel-fade": "^8.3.0",
65
+ "embla-carousel-vue": "^8.3.0",
66
+ "embla-carousel-wheel-gestures": "^8.0.1",
58
67
  "fuse.js": "^7.0.0",
59
68
  "ohash": "^1.1.4",
60
- "radix-vue": "^1.9.6",
69
+ "radix-vue": "^1.9.7",
61
70
  "scule": "^1.3.0",
62
71
  "tailwind-variants": "^0.2.1",
63
- "tailwindcss": "4.0.0-alpha.24",
72
+ "tailwindcss": "4.0.0-alpha.29",
64
73
  "vaul-vue": "^0.2.0"
65
74
  },
66
75
  "devDependencies": {
67
76
  "@nuxt/eslint-config": "^0.5.7",
68
77
  "@nuxt/module-builder": "^0.8.4",
69
- "@nuxt/test-utils": "^3.14.2",
70
- "@release-it/conventional-changelog": "^8.0.2",
78
+ "@nuxt/test-utils": "^3.14.4",
79
+ "@release-it/conventional-changelog": "^9.0.1",
80
+ "@standard-schema/spec": "1.0.0-beta.1",
71
81
  "@vue/test-utils": "^2.4.6",
82
+ "embla-carousel": "^8.3.0",
72
83
  "eslint": "^9.11.1",
73
84
  "happy-dom": "^15.7.4",
74
85
  "joi": "^17.13.3",
75
86
  "nuxt": "^3.13.2",
76
- "release-it": "^17.6.0",
87
+ "release-it": "^17.10.0",
88
+ "superstruct": "^2.0.2",
77
89
  "valibot": "^0.42.1",
78
- "vitest": "^2.1.1",
90
+ "vitest": "^2.1.3",
79
91
  "vitest-environment-nuxt": "^1.0.1",
80
92
  "vue-tsc": "^2.1.6",
81
93
  "yup": "^1.4.0",
82
94
  "zod": "^3.23.8"
83
95
  },
96
+ "peerDependencies": {
97
+ "typescript": "^5.6.3"
98
+ },
84
99
  "resolutions": {
85
100
  "@nuxt/ui": "workspace:*",
86
- "happy-dom": "14.12.3"
101
+ "happy-dom": "14.12.3",
102
+ "rollup": "^4.24.0"
87
103
  }
88
104
  }
@@ -1,17 +0,0 @@
1
- export type ComponentProps<T> = T extends new () => {
2
- $props: infer P;
3
- } ? NonNullable<P> : T extends (props: infer P, ...args: any) => any ? P : Record<string, never>;
4
- export type ComponentSlots<T> = T extends new () => {
5
- $slots: infer S;
6
- } ? NonNullable<S> : T extends (props: any, ctx: {
7
- slots: infer S;
8
- attrs: any;
9
- emit: any;
10
- }, ...args: any) => any ? NonNullable<S> : Record<string, never>;
11
- export type ComponentEmit<T> = T extends new () => {
12
- $emit: infer E;
13
- } ? NonNullable<E> : T extends (props: any, ctx: {
14
- slots: any;
15
- attrs: any;
16
- emit: infer E;
17
- }, ...args: any) => any ? NonNullable<E> : Record<string, never>;
File without changes