@nuxt/ui 3.0.0-alpha.8 → 3.0.0-alpha.9
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/.nuxt/ui/button.ts +1 -1
- package/.nuxt/ui/card.ts +1 -1
- package/.nuxt/ui/carousel.ts +2 -2
- package/.nuxt/ui/container.ts +1 -1
- package/.nuxt/ui/index.ts +2 -0
- package/.nuxt/ui/input-menu.ts +3 -3
- package/.nuxt/ui/input-number.ts +204 -0
- package/.nuxt/ui/input.ts +2 -2
- package/.nuxt/ui/navigation-menu.ts +1 -1
- package/.nuxt/ui/pin-input.ts +145 -0
- package/.nuxt/ui/select-menu.ts +8 -13
- package/.nuxt/ui/select.ts +2 -2
- package/.nuxt/ui/table.ts +1 -0
- package/.nuxt/ui/tabs.ts +1 -1
- package/.nuxt/ui/textarea.ts +2 -2
- package/.nuxt/ui/toaster.ts +1 -1
- package/.nuxt/ui/tooltip.ts +1 -1
- package/README.md +52 -12
- package/cli/commands/{init.mjs → make/component.mjs} +4 -4
- package/cli/commands/make/index.mjs +14 -0
- package/cli/commands/make/locale.mjs +64 -0
- package/cli/index.mjs +2 -2
- package/cli/templates.mjs +46 -1
- package/cli/utils.mjs +14 -0
- package/dist/chunks/component-meta.cjs +7320 -3335
- package/dist/chunks/component-meta.mjs +7320 -3335
- package/dist/client/devtools/200.html +1 -1
- package/dist/client/devtools/404.html +1 -1
- package/dist/client/devtools/_nuxt/{hKiujHsR.js → BDC8ywlR.js} +1 -1
- package/dist/client/devtools/_nuxt/{DM3_wAgz.js → BT004Uxp.js} +22 -31
- package/dist/client/devtools/_nuxt/{Bj9hdafK.js → C1H2Soz3.js} +1 -1
- package/dist/client/devtools/_nuxt/builds/latest.json +1 -1
- package/dist/client/devtools/_nuxt/builds/meta/f98c13ea-d751-4b37-8ce3-94e99708745f.json +1 -0
- package/dist/client/devtools/_nuxt/entry.Bx6WJjrx.css +1 -0
- package/dist/client/devtools/_nuxt/error-404.Cq4qshcf.css +1 -0
- package/dist/client/devtools/_nuxt/error-500.ax1aM34m.css +1 -0
- package/dist/client/devtools/index.html +1 -1
- package/dist/module.cjs +13 -12
- package/dist/module.json +1 -1
- package/dist/module.mjs +13 -12
- package/dist/runtime/components/Alert.vue +4 -1
- package/dist/runtime/components/App.vue +11 -5
- package/dist/runtime/components/Breadcrumb.vue +8 -3
- package/dist/runtime/components/Carousel.vue +11 -7
- package/dist/runtime/components/CommandPalette.vue +5 -3
- package/dist/runtime/components/ContextMenuContent.vue +2 -0
- package/dist/runtime/components/DropdownMenuContent.vue +2 -0
- package/dist/runtime/components/Form.vue +18 -20
- package/dist/runtime/components/FormField.vue +7 -3
- package/dist/runtime/components/InputMenu.vue +97 -21
- package/dist/runtime/components/InputNumber.vue +192 -0
- package/dist/runtime/components/Link.vue +19 -5
- package/dist/runtime/components/Modal.vue +12 -3
- package/dist/runtime/components/NavigationMenu.vue +4 -2
- package/dist/runtime/components/Pagination.vue +12 -5
- package/dist/runtime/components/PinInput.vue +96 -0
- package/dist/runtime/components/Popover.vue +17 -1
- package/dist/runtime/components/Select.vue +1 -1
- package/dist/runtime/components/SelectMenu.vue +106 -30
- package/dist/runtime/components/Slideover.vue +12 -3
- package/dist/runtime/components/Table.vue +11 -1
- package/dist/runtime/components/Textarea.vue +1 -1
- package/dist/runtime/components/Toast.vue +4 -1
- package/dist/runtime/components/Toaster.vue +22 -14
- package/dist/runtime/composables/defineLocale.d.ts +9 -0
- package/dist/runtime/composables/defineLocale.js +4 -0
- package/dist/runtime/composables/useFormField.d.ts +4 -1
- package/dist/runtime/composables/useFormField.js +1 -1
- package/dist/runtime/composables/useLocale.d.ts +4 -0
- package/dist/runtime/composables/useLocale.js +10 -0
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/locale/ar.d.ts +2 -0
- package/dist/runtime/locale/ar.js +47 -0
- package/dist/runtime/locale/cs.d.ts +2 -0
- package/dist/runtime/locale/cs.js +46 -0
- package/dist/runtime/locale/de.d.ts +2 -0
- package/dist/runtime/locale/de.js +46 -0
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +46 -0
- package/dist/runtime/locale/es.d.ts +2 -0
- package/dist/runtime/locale/es.js +46 -0
- package/dist/runtime/locale/fa_ir.d.ts +2 -0
- package/dist/runtime/locale/fa_ir.js +47 -0
- package/dist/runtime/locale/fr.d.ts +2 -0
- package/dist/runtime/locale/fr.js +46 -0
- package/dist/runtime/locale/index.d.ts +12 -0
- package/dist/runtime/locale/index.js +12 -0
- package/dist/runtime/locale/it.d.ts +2 -0
- package/dist/runtime/locale/it.js +46 -0
- package/dist/runtime/locale/pl.d.ts +2 -0
- package/dist/runtime/locale/pl.js +46 -0
- package/dist/runtime/locale/ru.d.ts +2 -0
- package/dist/runtime/locale/ru.js +46 -0
- package/dist/runtime/locale/zh_hans.d.ts +2 -0
- package/dist/runtime/locale/zh_hans.js +46 -0
- package/dist/runtime/locale/zh_hant.d.ts +2 -0
- package/dist/runtime/locale/zh_hant.js +46 -0
- package/dist/runtime/types/form.d.ts +7 -2
- package/dist/runtime/types/index.d.ts +3 -0
- package/dist/runtime/types/index.js +3 -0
- package/dist/runtime/types/locale.d.ts +48 -0
- package/dist/runtime/types/locale.js +0 -0
- package/dist/runtime/utils/form.d.ts +5 -9
- package/dist/runtime/utils/form.js +115 -50
- package/dist/runtime/utils/link.d.ts +1 -1
- package/dist/runtime/utils/locale.d.ts +15 -0
- package/dist/runtime/utils/locale.js +25 -0
- package/dist/shared/{ui.BU7wzH0D.cjs → ui.BPnAe4QS.cjs} +194 -36
- package/dist/shared/{ui.BufKhDiD.mjs → ui.d52SSCwA.mjs} +194 -36
- package/dist/unplugin.cjs +1 -1
- package/dist/unplugin.d.cts +5 -3
- package/dist/unplugin.d.mts +5 -3
- package/dist/unplugin.d.ts +5 -3
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +33 -26
- package/dist/client/devtools/_nuxt/builds/meta/e6b425f7-b919-4014-915b-0ea07c316790.json +0 -1
- package/dist/client/devtools/_nuxt/entry.DaJP-ZMB.css +0 -24
- package/dist/client/devtools/_nuxt/error-404.B0Nmv3fV.css +0 -1
- package/dist/client/devtools/_nuxt/error-500.C8fgTxVz.css +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[](https://ui.nuxt.com)
|
|
2
2
|
|
|
3
|
-
# Nuxt UI
|
|
3
|
+
# Nuxt UI
|
|
4
4
|
|
|
5
5
|
[![npm version][npm-version-src]][npm-version-href]
|
|
6
6
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
@@ -9,9 +9,14 @@
|
|
|
9
9
|
|
|
10
10
|
We're thrilled to introduce Nuxt UI v3, a significant upgrade to our UI library that delivers extensive improvements and robust new capabilities. This major update harnesses the combined strengths of [Radix Vue](https://www.radix-vue.com/), [Tailwind CSS v4](https://tailwindcss.com/blog/tailwindcss-v4-alpha), and [Tailwind Variants](https://www.tailwind-variants.org/) to offer developers an unparalleled set of tools for creating sophisticated, accessible, and highly performant user interfaces.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
> [!NOTE]
|
|
13
|
+
> You are on the `v3` development branch, check out the [dev branch](https://github.com/nuxt/ui) for Nuxt UI v2.
|
|
14
|
+
|
|
15
|
+
## Documentation
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
Visit https://ui3.nuxt.dev to explore the documentation.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
15
20
|
|
|
16
21
|
```bash [pnpm]
|
|
17
22
|
pnpm add @nuxt/ui@next
|
|
@@ -29,10 +34,9 @@ npm install @nuxt/ui@next
|
|
|
29
34
|
bun add @nuxt/ui@next
|
|
30
35
|
```
|
|
31
36
|
|
|
32
|
-
|
|
33
|
-
> Make sure you have `typescript` installed in your dev dependencies.
|
|
37
|
+
### Nuxt
|
|
34
38
|
|
|
35
|
-
|
|
39
|
+
1. Add the Nuxt UI module in your `nuxt.config.ts`:
|
|
36
40
|
|
|
37
41
|
```ts [nuxt.config.ts]
|
|
38
42
|
export default defineNuxtConfig({
|
|
@@ -40,18 +44,54 @@ export default defineNuxtConfig({
|
|
|
40
44
|
})
|
|
41
45
|
```
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
2. Import Tailwind CSS and Nuxt UI in your CSS:
|
|
44
48
|
|
|
45
|
-
```
|
|
46
|
-
<style>
|
|
49
|
+
```css [assets/css/main.css]
|
|
47
50
|
@import "tailwindcss";
|
|
48
51
|
@import "@nuxt/ui";
|
|
49
|
-
</style>
|
|
50
52
|
```
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
Learn more in the [installation guide](https://ui3.nuxt.dev/getting-started/installation/nuxt).
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
### Vue
|
|
57
|
+
|
|
58
|
+
1. Add the Nuxt UI Vite plugin in your `vite.config.ts`:
|
|
59
|
+
|
|
60
|
+
```ts [vite.config.ts]
|
|
61
|
+
import { defineConfig } from 'vite'
|
|
62
|
+
import vue from '@vitejs/plugin-vue'
|
|
63
|
+
import ui from '@nuxt/ui/vite'
|
|
64
|
+
|
|
65
|
+
export default defineConfig({
|
|
66
|
+
plugins: [
|
|
67
|
+
vue(),
|
|
68
|
+
ui()
|
|
69
|
+
]
|
|
70
|
+
})
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
2. Use the Nuxt UI Vue plugin in your `main.ts`:
|
|
74
|
+
|
|
75
|
+
```ts [main.ts]
|
|
76
|
+
import { createApp } from 'vue'
|
|
77
|
+
import ui from '@nuxt/ui/vue-plugin'
|
|
78
|
+
import App from './App.vue'
|
|
79
|
+
|
|
80
|
+
const app = createApp(App)
|
|
81
|
+
|
|
82
|
+
app.use(ui)
|
|
83
|
+
|
|
84
|
+
app.mount('#app')
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
3. Import Tailwind CSS and Nuxt UI in your CSS:
|
|
88
|
+
|
|
89
|
+
```css [assets/main.css]
|
|
90
|
+
@import "tailwindcss";
|
|
91
|
+
@import "@nuxt/ui";
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Learn more in the [installation guide](https://ui3.nuxt.dev/getting-started/installation/vue).
|
|
55
95
|
|
|
56
96
|
## Credits
|
|
57
97
|
|
|
@@ -3,13 +3,13 @@ import { resolve } from 'pathe'
|
|
|
3
3
|
import { defineCommand } from 'citty'
|
|
4
4
|
import { consola } from 'consola'
|
|
5
5
|
import { splitByCase, upperFirst, camelCase, kebabCase } from 'scule'
|
|
6
|
-
import { appendFile, sortFile } from '
|
|
7
|
-
import templates from '
|
|
6
|
+
import { appendFile, sortFile } from '../../utils.mjs'
|
|
7
|
+
import templates from '../../templates.mjs'
|
|
8
8
|
|
|
9
9
|
export default defineCommand({
|
|
10
10
|
meta: {
|
|
11
|
-
name: '
|
|
12
|
-
description: '
|
|
11
|
+
name: 'component',
|
|
12
|
+
description: 'Make a new component.'
|
|
13
13
|
},
|
|
14
14
|
args: {
|
|
15
15
|
name: {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineCommand } from 'citty'
|
|
2
|
+
import component from './component.mjs'
|
|
3
|
+
import locale from './locale.mjs'
|
|
4
|
+
|
|
5
|
+
export default defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: 'make',
|
|
8
|
+
description: 'Commands to create new Nuxt UI entities.'
|
|
9
|
+
},
|
|
10
|
+
subCommands: {
|
|
11
|
+
component,
|
|
12
|
+
locale
|
|
13
|
+
}
|
|
14
|
+
})
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { existsSync, promises as fsp } from 'node:fs'
|
|
2
|
+
import { resolve } from 'pathe'
|
|
3
|
+
import { consola } from 'consola'
|
|
4
|
+
import { appendFile, sortFile, normalizeLocale } from '../../utils.mjs'
|
|
5
|
+
import { defineCommand } from 'citty'
|
|
6
|
+
|
|
7
|
+
export default defineCommand({
|
|
8
|
+
meta: {
|
|
9
|
+
name: 'locale',
|
|
10
|
+
description: 'Make a new locale.'
|
|
11
|
+
},
|
|
12
|
+
args: {
|
|
13
|
+
code: {
|
|
14
|
+
description: 'Locale code to create. For example: en.',
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
name: {
|
|
18
|
+
description: 'Locale name to create. For example: English.',
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
dir: {
|
|
22
|
+
description: 'Locale direction. For example: rtl.',
|
|
23
|
+
default: 'ltr'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
async setup({ args }) {
|
|
27
|
+
const path = resolve('.')
|
|
28
|
+
const localePath = resolve(path, `src/runtime/locale`)
|
|
29
|
+
|
|
30
|
+
const originLocaleFilePath = resolve(localePath, 'en.ts')
|
|
31
|
+
const newLocaleFilePath = resolve(localePath, `${args.code}.ts`)
|
|
32
|
+
|
|
33
|
+
// Validate locale code
|
|
34
|
+
if (existsSync(newLocaleFilePath)) {
|
|
35
|
+
consola.error(`🚨 ${args.code} already exists!`)
|
|
36
|
+
process.exit(1)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!['ltr', 'rtl'].includes(args.dir)) {
|
|
40
|
+
consola.error(`🚨 Direction ${args.dir} not supported!`)
|
|
41
|
+
process.exit(1)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (!args.code.match(/^[a-z]{2}(?:_[a-z]{2,4})?$/)) {
|
|
45
|
+
consola.error(`🚨 ${args.code} is not a valid locale code!\nExample: en or en_us`)
|
|
46
|
+
process.exit(1)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Create new locale export
|
|
50
|
+
const localeExportFile = resolve(localePath, `index.ts`)
|
|
51
|
+
await appendFile(localeExportFile, `export { default as ${args.code} } from './${args.code}'`)
|
|
52
|
+
await sortFile(localeExportFile)
|
|
53
|
+
|
|
54
|
+
// Create new locale file
|
|
55
|
+
await fsp.copyFile(originLocaleFilePath, newLocaleFilePath)
|
|
56
|
+
const localeFile = await fsp.readFile(newLocaleFilePath, 'utf-8')
|
|
57
|
+
const rewrittenLocaleFile = localeFile
|
|
58
|
+
.replace(/name: '(.*)',/, `name: '${args.name}',`)
|
|
59
|
+
.replace(/code: '(.*)',/, `code: '${normalizeLocale(args.code)}',${(args.dir && args.dir !== 'ltr') ? `\n dir: '${args.dir}',` : ''}`)
|
|
60
|
+
await fsp.writeFile(newLocaleFilePath, rewrittenLocaleFile)
|
|
61
|
+
|
|
62
|
+
consola.success(`🪄 Generated ${newLocaleFilePath}`)
|
|
63
|
+
}
|
|
64
|
+
})
|
package/cli/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { defineCommand, runMain } from 'citty'
|
|
3
|
-
import
|
|
3
|
+
import make from './commands/make/index.mjs'
|
|
4
4
|
|
|
5
5
|
const main = defineCommand({
|
|
6
6
|
meta: {
|
|
@@ -8,7 +8,7 @@ const main = defineCommand({
|
|
|
8
8
|
description: 'Nuxt UI CLI'
|
|
9
9
|
},
|
|
10
10
|
subCommands: {
|
|
11
|
-
|
|
11
|
+
make
|
|
12
12
|
}
|
|
13
13
|
})
|
|
14
14
|
|
package/cli/templates.mjs
CHANGED
|
@@ -163,9 +163,54 @@ describe('${upperName}', () => {
|
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
const doc = ({ name, pro }) => {
|
|
167
|
+
const kebabName = kebabCase(name)
|
|
168
|
+
const upperName = splitByCase(name).map(p => upperFirst(p)).join('')
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
filename: `docs/content/${pro ? 'pro' : '3.components'}/${kebabName}.md`,
|
|
172
|
+
contents: `---
|
|
173
|
+
description:
|
|
174
|
+
links: ${pro
|
|
175
|
+
? ''
|
|
176
|
+
: `
|
|
177
|
+
- label: ${upperName}
|
|
178
|
+
icon: i-custom-radix-vue
|
|
179
|
+
to: https://www.radix-vue.com/components/${kebabName}.html`}
|
|
180
|
+
- label: GitHub
|
|
181
|
+
icon: i-simple-icons-github
|
|
182
|
+
to: https://github.com/nuxt/${pro ? 'ui-pro' : 'ui'}/tree/v3/src/runtime/components/${upperName}.vue
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Usage
|
|
186
|
+
|
|
187
|
+
## Examples
|
|
188
|
+
|
|
189
|
+
## API
|
|
190
|
+
|
|
191
|
+
### Props
|
|
192
|
+
|
|
193
|
+
:component-props
|
|
194
|
+
|
|
195
|
+
### Slots
|
|
196
|
+
|
|
197
|
+
:component-slots
|
|
198
|
+
|
|
199
|
+
### Emits
|
|
200
|
+
|
|
201
|
+
:component-emits
|
|
202
|
+
|
|
203
|
+
## Theme
|
|
204
|
+
|
|
205
|
+
:component-theme
|
|
206
|
+
`
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
166
210
|
export default {
|
|
167
211
|
playground,
|
|
168
212
|
component,
|
|
169
213
|
theme,
|
|
170
|
-
test
|
|
214
|
+
test,
|
|
215
|
+
doc
|
|
171
216
|
}
|
package/cli/utils.mjs
CHANGED
|
@@ -15,3 +15,17 @@ export async function appendFile(path, contents) {
|
|
|
15
15
|
await fsp.writeFile(path, file.trim() + '\n' + contents + '\n')
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
export function normalizeLocale(locale) {
|
|
20
|
+
if (!locale) {
|
|
21
|
+
return ''
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (locale.includes('_')) {
|
|
25
|
+
return locale.split('_')
|
|
26
|
+
.map((part, index) => index === 0 ? part.toLowerCase() : part.toUpperCase())
|
|
27
|
+
.join('-')
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return locale.toLowerCase()
|
|
31
|
+
}
|