Compare commits

..

45 Commits

Author SHA1 Message Date
Benjamin Canac
55179ce71c chore(release): v3.0.0-alpha.6 2024-10-09 16:29:01 +02:00
Benjamin Canac
e6d91c94d1 docs(deps): use @nuxt/ui-pro compact url 2024-10-09 16:17:41 +02:00
Benjamin Canac
9026cf2594 chore(release-it): update 2024-10-09 16:00:30 +02:00
renovate[bot]
818ec3893c chore(deps): update all non-major dependencies (v3) (#2344)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-09 15:51:09 +02:00
Benjamin Canac
31b701d9df chore(github): pkg.pr.new compact publish 2024-10-09 15:19:01 +02:00
Benjamin Canac
bee04adf4c fix(Carousel): move embla plugins to dependencies 2024-10-09 15:10:22 +02:00
Sandro Circi
057e86cfda feat(module): implement --ui-radius CSS variable (#2341)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-10-09 14:28:29 +02:00
Benjamin Canac
68ee3f11ca feat(Carousel): implement component (#2288) 2024-10-08 17:12:43 +02:00
renovate[bot]
69a6e11c52 chore(deps): update all non-major dependencies (v3) (#2335)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-08 12:16:57 +02:00
Benjamin Canac
53a4696ed3 docs(installation): improve theme.colors section 2024-10-08 12:05:17 +02:00
Benjamin Canac
7c4ffa56ec chore(module): improve tsdoc 2024-10-08 11:58:23 +02:00
Benjamin Canac
1fc21af918 docs(installation): add warning about shamefully-hoist
TypeScript warning is no longer needed since 6e7a400d4e
2024-10-08 00:51:28 +02:00
renovate[bot]
ede20f89c4 chore(deps): update all non-major dependencies (v3) (#2331)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-07 23:47:22 +02:00
Fabian Hiller
0955c07edd feat(Form): add Standard Schema support (#2303)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-10-07 23:25:52 +02:00
renovate[bot]
aa8fa5be3a chore(deps): update all non-major dependencies (v3) (#2329)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-07 23:20:48 +02:00
renovate[bot]
cf490c3b77 chore(deps): update pnpm to v9.12.1 (v3) (#2328)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-07 15:50:04 +02:00
renovate[bot]
220f659c4c chore(deps): update devdependency @nuxt/test-utils to ^3.14.3 (v3) (#2326)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-07 15:43:17 +02:00
Benjamin Canac
f2e8762b48 docs(deps): use @nuxt/ui-pro@v2 2024-10-07 15:25:07 +02:00
renovate[bot]
c2e879feac chore(deps): update all non-major dependencies (v3) (#2311)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-07 15:18:57 +02:00
Benjamin Canac
3a7c5c2601 fix(Alert): default variant to solid for consistency 2024-10-07 14:57:46 +02:00
Benjamin Canac
9368c6a639 refactor(module)!: implement design system with CSS variables (#2298) 2024-10-07 14:48:02 +02:00
Benjamin Canac
3cf5535b2f fix(Button): center text with block prop
Resolves nuxt/ui#2317
2024-10-07 14:23:24 +02:00
renovate[bot]
cb0081e0a7 chore(deps): update all non-major dependencies (v3) (#2290)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-05 23:14:35 +02:00
Benjamin Canac
6e7a400d4e chore(deps): add typescript in peerDependencies 2024-10-05 14:38:52 +02:00
Benjamin Canac
fde75087d0 chore(github): add publish step with pkg-pr-new 2024-10-05 14:05:15 +02:00
Benjamin Canac
7c3ed81309 docs(pages): use title instead of navigation.title in og image 2024-10-02 19:09:07 +02:00
Benjamin Canac
cb44980440 docs(pages): add z-index on toc to go over code examples 2024-10-02 18:51:46 +02:00
Benjamin Canac
6c7c2f02f3 fix(Accordion): use text-left break-words instead of truncate on label 2024-10-02 18:51:32 +02:00
Benjamin Canac
a1ebf8da9a docs(Header): fix badge truncate 2024-10-02 18:47:21 +02:00
Benjamin Canac
ed77b69f5d chore(module): lint 2024-10-02 16:46:11 +02:00
Benjamin Canac
dd42e652d1 docs(deps): update @nuxt/ui-pro 2024-10-02 16:18:29 +02:00
Benjamin Canac
b82af02839 feat(module): set disableTransition option on @nuxtjs/color-mode 2024-10-02 16:18:10 +02:00
Benjamin Canac
e487f2e877 chore(release): v3.0.0-alpha.5 2024-10-02 15:58:14 +02:00
Benjamin Canac
7addc2f70d docs(getting-started): improve faq 2024-10-02 15:57:02 +02:00
Benjamin Canac
0986f5e4b7 docs(Header): display color mode button 2024-10-02 15:57:02 +02:00
Benjamin Canac
077a9210db docs(getting-started): display color-mode page 2024-10-02 15:57:02 +02:00
Benjamin Canac
9dcf903926 feat(module): enable @nuxtjs/color-mode 2024-10-02 15:57:01 +02:00
Benjamin Canac
0f86b87385 feat(module): override dark variant with class strategy 2024-10-02 15:57:01 +02:00
Sébastien Chopin
c9a2631bc3 docs: update link to downloads count badge 2024-10-02 15:53:47 +02:00
Benjamin Canac
1518d0024f chore(README): invalid documentation url 2024-10-02 14:21:54 +02:00
Benjamin Canac
421a193d20 docs(nuxt.config): invalid site.url 2024-10-02 14:21:45 +02:00
Sébastien Chopin
dd54abf243 docs: update GitHub link to v3 branch 2024-10-02 12:45:47 +02:00
Benjamin Canac
c837ca5cc0 docs(getting-started): describe Tailwind CSS @source and @plugin 2024-10-02 12:25:01 +02:00
Benjamin Canac
66a04add91 fix(Button): props specified more than once 2024-10-01 15:31:18 +02:00
Benjamin Canac
a5153d6c8d docs(deps): update @nuxt/ui-pro 2024-10-01 15:24:37 +02:00
317 changed files with 8916 additions and 7360 deletions

View File

@@ -54,3 +54,6 @@ jobs:
- name: Build
run: pnpm run build
- name: Publish
run: pnpx pkg-pr-new publish --compact --no-template --pnpm

View File

@@ -3,6 +3,14 @@
"commitMessage": "chore(release): v${version}",
"tagName": "v${version}"
},
"github": {
"release": true,
"releaseName": "v${version}",
"web": true
},
"hooks": {
"before:init": ["pnpm lint", "pnpm typecheck"]
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": {

View File

@@ -1,5 +1,45 @@
# Changelog
## [3.0.0-alpha.6](https://github.com/nuxt/ui/compare/v3.0.0-alpha.5...v3.0.0-alpha.6) (2024-10-09)
### ⚠ BREAKING CHANGES
* **module:** implement design system with CSS variables (#2298)
### Features
* **Carousel:** implement component ([#2288](https://github.com/nuxt/ui/issues/2288)) ([68ee3f1](https://github.com/nuxt/ui/commit/68ee3f11ca01b19cf890ef8105ffb87ef9bb3188))
* **Form:** add Standard Schema support ([#2303](https://github.com/nuxt/ui/issues/2303)) ([0955c07](https://github.com/nuxt/ui/commit/0955c07edd8ea5b5c39b770804b8e4c6f86d94b0))
* **module:** implement `--ui-radius` CSS variable ([#2341](https://github.com/nuxt/ui/issues/2341)) ([057e86c](https://github.com/nuxt/ui/commit/057e86cfda1ef5c7a370c99ef409d22e48772ca7))
* **module:** set `disableTransition` option on `@nuxtjs/color-mode` ([b82af02](https://github.com/nuxt/ui/commit/b82af02839b7d75344d9431fabdc42f0ac0681e1))
### Bug Fixes
* **Accordion:** use `text-left break-words` instead of `truncate` on label ([6c7c2f0](https://github.com/nuxt/ui/commit/6c7c2f02f395747a0c68a499630f502e3f02ded3))
* **Alert:** default variant to `solid` for consistency ([3a7c5c2](https://github.com/nuxt/ui/commit/3a7c5c26011bfcffcdf6ac3451adb2af1453b9db))
* **Button:** center text with `block` prop ([3cf5535](https://github.com/nuxt/ui/commit/3cf5535b2faa28b557ca55d694abdfa7d7ad0efc)), closes [nuxt/ui#2317](https://github.com/nuxt/ui/issues/2317)
* **Carousel:** move embla plugins to `dependencies` ([bee04ad](https://github.com/nuxt/ui/commit/bee04adf4cc4fd6d69e93ad94500f5ef604405e7))
### Code Refactoring
* **module:** implement design system with CSS variables ([#2298](https://github.com/nuxt/ui/issues/2298)) ([9368c6a](https://github.com/nuxt/ui/commit/9368c6a63955a2e6c2f4f900a9b91c61bb2e5a72))
## [3.0.0-alpha.5](https://github.com/nuxt/ui/compare/v3.0.0-alpha.4...v3.0.0-alpha.5) (2024-10-02)
### Features
* **module:** enable `@nuxtjs/color-mode` ([9dcf903](https://github.com/nuxt/ui/commit/9dcf903926046b6e92b4784043e374d2174e4201))
* **module:** override `dark` variant with class strategy ([0f86b87](https://github.com/nuxt/ui/commit/0f86b87385375e5bd859e84d21f8b4f06b0a99e0))
### Bug Fixes
* **Button:** props specified more than once ([66a04ad](https://github.com/nuxt/ui/commit/66a04add91389910e1336bf0be1cfeada3540f76))
## [3.0.0-alpha.4](https://github.com/nuxt/ui/compare/v3.0.0-alpha.3...v3.0.0-alpha.4) (2024-10-01)

View File

@@ -40,16 +40,18 @@ export default defineNuxtConfig({
})
```
3. Import Tailwind and Nuxt UI in your `app.vue` or in your [CSS](https://nuxt.com/docs/getting-started/styling#the-css-property):
3. Import Tailwind CSS and Nuxt UI in your `app.vue` or [CSS](https://nuxt.com/docs/getting-started/styling#the-css-property):
```css [main.css]
```vue [app.vue]
<style>
@import "tailwindcss";
@import "@nuxt/ui";
</style>
```
## Documentation
Visit https://ui3.nuxt.com to explore the documentation.
Visit https://ui3.nuxt.dev to explore the documentation.
## Credits
@@ -70,7 +72,7 @@ Licensed under the [MIT license](https://github.com/nuxt/ui/blob/dev/LICENSE.md)
[npm-version-href]: https://npmjs.com/package/@nuxt/ui
[npm-downloads-src]: https://img.shields.io/npm/dm/@nuxt/ui.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-downloads-href]: https://npmjs.com/package/@nuxt/ui
[npm-downloads-href]: https://npm.chart.dev/@nuxt/ui
[license-src]: https://img.shields.io/github/license/nuxt/ui.svg?style=flat&colorA=18181B&colorB=28CF8D
[license-href]: https://github.com/nuxt/ui/blob/main/LICENSE.md

View File

@@ -4,10 +4,13 @@ export default defineAppConfig({
expand: true,
duration: 5000
},
theme: {
radius: 0.25
},
ui: {
colors: {
primary: 'green',
gray: 'slate'
neutral: 'slate'
}
}
})

View File

@@ -1,16 +1,17 @@
<script setup lang="ts">
import { withoutTrailingSlash } from 'ufo'
import colors from 'tailwindcss/colors'
// import { debounce } from 'perfect-debounce'
// import type { ContentSearchFile } from '@nuxt/ui-pro'
import type { ContentSearchFile } from '@nuxt/ui-pro'
const route = useRoute()
const appConfig = useAppConfig()
// const colorMode = useColorMode()
const colorMode = useColorMode()
const runtimeConfig = useRuntimeConfig()
const { integrity, api } = runtimeConfig.public.content
const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation(), { default: () => [] })
const { data: files } = await useLazyFetch<any[]>(`${api.baseURL}/search${integrity ? '-' + integrity : ''}`, { default: () => [] })
const { data: files } = await useLazyFetch<ContentSearchFile[]>(`${api.baseURL}/search${integrity ? '-' + integrity : ''}`, { default: () => [] })
const searchTerm = ref('')
@@ -50,17 +51,21 @@ const links = computed(() => {
}].filter(Boolean)
})
// const color = computed(() => colorMode.value === 'dark' ? '#18181b' : 'white')
const color = computed(() => colorMode.value === 'dark' ? (colors as any)[appConfig.ui.colors.neutral][900] : 'white')
const radius = computed(() => `:root { --ui-radius: ${appConfig.theme.radius}rem; }`)
useHead({
meta: [
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
// { key: 'theme-color', name: 'theme-color', content: color }
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ key: 'theme-color', name: 'theme-color', content: color }
],
link: [
{ rel: 'icon', type: 'image/svg+xml', href: '/icon.svg' },
{ rel: 'canonical', href: `https://ui.nuxt.com${withoutTrailingSlash(route.path)}` }
],
style: [
{ innerHTML: radius, id: 'nuxt-ui-radius', tagPriority: -2 }
],
htmlAttrs: {
lang: 'en'
}
@@ -121,6 +126,6 @@ provide('navigation', navigation)
}
:root {
--container-width: 90rem;
--ui-container-width: 90rem;
}
</style>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -23,15 +23,15 @@ const route = useRoute()
<UFooter>
<template #left>
<NuxtLink v-if="route.path.startsWith('/pro')" to="https://ui.nuxt.com/pro/purchase" target="_blank" class="text-sm text-gray-500 dark:text-gray-400">
Purchase <span class="text-gray-900 dark:text-white">Nuxt UI Pro</span>
<NuxtLink v-if="route.path.startsWith('/pro')" to="https://ui.nuxt.com/pro/purchase" target="_blank" class="text-sm text-[--ui-text-muted]">
Purchase <span class="text-[--ui-text-highlighted]">Nuxt UI Pro</span>
</NuxtLink>
<NuxtLink v-else to="https://github.com/nuxt/ui" target="_blank" class="text-sm text-gray-500 dark:text-gray-400">
Published under <span class="text-gray-900 dark:text-white">MIT License</span>
<NuxtLink v-else to="https://github.com/nuxt/ui" target="_blank" class="text-sm text-[--ui-text-muted]">
Published under <span class="text-[--ui-text-highlighted]">MIT License</span>
</NuxtLink>
</template>
<!-- <UNavigationMenu :items="items" variant="link" color="gray" /> -->
<!-- <UNavigationMenu :items="items" variant="link" color="neutral" /> -->
<template #right>
<UButton
@@ -39,7 +39,7 @@ const route = useRoute()
icon="i-simple-icons-nuxtdotjs"
to="https://nuxt.com"
target="_blank"
color="gray"
color="neutral"
variant="ghost"
/>
<UButton
@@ -47,7 +47,7 @@ const route = useRoute()
icon="i-simple-icons-discord"
to="https://chat.nuxt.dev"
target="_blank"
color="gray"
color="neutral"
variant="ghost"
/>
<UButton
@@ -55,7 +55,7 @@ const route = useRoute()
icon="i-simple-icons-x"
to="https://x.com/nuxt_js"
target="_blank"
color="gray"
color="neutral"
variant="ghost"
/>
<UButton
@@ -63,7 +63,7 @@ const route = useRoute()
icon="i-simple-icons-github"
to="https://github.com/nuxt/ui"
target="_blank"
color="gray"
color="neutral"
variant="ghost"
/>
</template>

View File

@@ -11,37 +11,43 @@ const config = useRuntimeConfig().public
const navigation = inject<Ref<NavItem[]>>('navigation')
// const items = computed(() => props.links.map(({ icon, ...link }) => link))
defineShortcuts({
meta_g: () => {
window.open('https://github.com/nuxt/ui/tree/v3', '_blank')
}
})
</script>
<template>
<UHeader :ui="{ left: 'min-w-0' }">
<template #left>
<NuxtLink to="/" class="flex items-end gap-2 font-bold text-xl text-gray-900 dark:text-white min-w-0" aria-label="Nuxt UI">
<NuxtLink to="/" class="flex items-end gap-2 font-bold text-xl text-[--ui-text-highlighted] min-w-0" aria-label="Nuxt UI">
<Logo class="w-auto h-6 shrink-0" />
<UBadge :label="`v${config.version}`" variant="subtle" size="sm" class="-mb-[2px] rounded font-semibold truncate" />
<UBadge :label="`v${config.version}`" variant="subtle" size="sm" class="-mb-[2px] rounded font-semibold inline-block truncate" />
</NuxtLink>
</template>
<!-- <UNavigationMenu :items="items" variant="link" /> -->
<template #right>
<ColorPicker />
<ThemePicker />
<UTooltip text="Search" :kbds="['meta', 'K']">
<UContentSearchButton />
</UTooltip>
<!-- <UColorModeButton /> -->
<UButton
color="gray"
variant="ghost"
to="https://github.com/nuxt/ui"
target="_blank"
icon="i-simple-icons-github"
aria-label="GitHub"
/>
<UTooltip text="Open on GitHub" :kbds="['meta', 'G']">
<UButton
color="neutral"
variant="ghost"
to="https://github.com/nuxt/ui/tree/v3"
target="_blank"
icon="i-simple-icons-github"
aria-label="GitHub"
/>
</UTooltip>
</template>
<template #content>

View File

@@ -4,8 +4,8 @@
<path d="M726 92H739C742.314 92 745 89.3137 745 86V60H773V92H800V116H773V159C773 169.5 778.057 174 787 174H800V200H783C759.948 200 745 185.071 745 160V116H726V92Z" fill="currentColor" />
<path d="M591 92V154C591 168.004 585.742 179.809 578 188C570.258 196.191 559.566 200 545 200C530.434 200 518.742 196.191 511 188C503.389 179.809 498 168.004 498 154V92H514C517.412 92 520.769 92.622 523 95C525.231 97.2459 526 98.5652 526 102V154C526 162.059 526.457 167.037 530 171C533.543 174.831 537.914 176 545 176C552.217 176 555.457 174.831 559 171C562.543 167.037 563 162.059 563 154V102C563 98.5652 563.769 96.378 566 94C567.96 91.9107 570.028 91.9599 573 92C573.411 92.0055 574.586 92 575 92H591Z" fill="currentColor" />
<path d="M676 144L710 92H684C680.723 92 677.812 93.1758 676 96L660 120L645 97C643.188 94.1758 639.277 92 636 92H611L645 143L608 200H634C637.25 200 640.182 196.787 642 194L660 167L679 195C680.818 197.787 683.75 200 687 200H713L676 144Z" fill="currentColor" />
<path d="M168 200H279C282.542 200 285.932 198.756 289 197C292.068 195.244 295.23 193.041 297 190C298.77 186.959 300.002 183.51 300 179.999C299.998 176.488 298.773 173.04 297 170.001L222 41C220.23 37.96 218.067 35.7552 215 34C211.933 32.2448 207.542 31 204 31C200.458 31 197.067 32.2448 194 34C190.933 35.7552 188.77 37.96 187 41L168 74L130 9.99764C128.228 6.95784 126.068 3.75491 123 2C119.932 0.245087 116.542 0 113 0C109.458 0 106.068 0.245087 103 2C99.9323 3.75491 96.7717 6.95784 95 9.99764L2 170.001C0.226979 173.04 0.00154312 176.488 1.90993e-06 179.999C-0.0015393 183.51 0.229648 186.959 2 190C3.77035 193.04 6.93245 195.244 10 197C13.0675 198.756 16.4578 200 20 200H90C117.737 200 137.925 187.558 152 164L186 105L204 74L259 168H186L168 200ZM89 168H40L113 42L150 105L125.491 147.725C116.144 163.01 105.488 168 89 168Z" fill="var(--color-primary-DEFAULT)" />
<path d="M958 60.0001H938C933.524 60.0001 929.926 59.9395 927 63C924.074 65.8905 925 67.5792 925 72V141C925 151.372 923.648 156.899 919 162C914.352 166.931 908.468 169 899 169C889.705 169 882.648 166.931 878 162C873.352 156.899 873 151.372 873 141V72.0001C873 67.5793 872.926 65.8906 870 63.0001C867.074 59.9396 863.476 60.0001 859 60.0001H840V141C840 159.023 845.016 173.458 855 184C865.156 194.542 879.893 200 899 200C918.107 200 932.844 194.542 943 184C953.156 173.458 958 159.023 958 141V60.0001Z" fill="var(--color-primary-DEFAULT)" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M1000 60.0233L1020 60V77L1020 128V156.007L1020 181L1020 189.004C1020 192.938 1019.98 194.429 1017 197.001C1014.02 199.725 1009.56 200 1005 200H986.001V181.006L986 130.012V70.0215C986 66.1576 986.016 64.5494 989 62.023C991.819 59.6358 995.437 60.0233 1000 60.0233Z" fill="var(--color-primary-DEFAULT)" />
<path d="M168 200H279C282.542 200 285.932 198.756 289 197C292.068 195.244 295.23 193.041 297 190C298.77 186.959 300.002 183.51 300 179.999C299.998 176.488 298.773 173.04 297 170.001L222 41C220.23 37.96 218.067 35.7552 215 34C211.933 32.2448 207.542 31 204 31C200.458 31 197.067 32.2448 194 34C190.933 35.7552 188.77 37.96 187 41L168 74L130 9.99764C128.228 6.95784 126.068 3.75491 123 2C119.932 0.245087 116.542 0 113 0C109.458 0 106.068 0.245087 103 2C99.9323 3.75491 96.7717 6.95784 95 9.99764L2 170.001C0.226979 173.04 0.00154312 176.488 1.90993e-06 179.999C-0.0015393 183.51 0.229648 186.959 2 190C3.77035 193.04 6.93245 195.244 10 197C13.0675 198.756 16.4578 200 20 200H90C117.737 200 137.925 187.558 152 164L186 105L204 74L259 168H186L168 200ZM89 168H40L113 42L150 105L125.491 147.725C116.144 163.01 105.488 168 89 168Z" fill="var(--ui-primary)" />
<path d="M958 60.0001H938C933.524 60.0001 929.926 59.9395 927 63C924.074 65.8905 925 67.5792 925 72V141C925 151.372 923.648 156.899 919 162C914.352 166.931 908.468 169 899 169C889.705 169 882.648 166.931 878 162C873.352 156.899 873 151.372 873 141V72.0001C873 67.5793 872.926 65.8906 870 63.0001C867.074 59.9396 863.476 60.0001 859 60.0001H840V141C840 159.023 845.016 173.458 855 184C865.156 194.542 879.893 200 899 200C918.107 200 932.844 194.542 943 184C953.156 173.458 958 159.023 958 141V60.0001Z" fill="var(--ui-primary)" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M1000 60.0233L1020 60V77L1020 128V156.007L1020 181L1020 189.004C1020 192.938 1019.98 194.429 1017 197.001C1014.02 199.725 1009.56 200 1005 200H986.001V181.006L986 130.012V70.0215C986 66.1576 986.016 64.5494 989 62.023C991.819 59.6358 995.437 60.0233 1000 60.0233Z" fill="var(--ui-primary)" />
</svg>
</template>

View File

@@ -1,62 +0,0 @@
<template>
<UPopover mode="hover" :ui="{ content: 'p-2' }">
<template #default="{ open }">
<UButton
icon="i-heroicons-swatch-20-solid"
color="gray"
:variant="open ? 'soft' : 'ghost'"
square
aria-label="Color picker"
:ui="{ leadingIcon: 'text-primary-500 dark:text-primary-400' }"
/>
</template>
<template #content>
<fieldset class="grid grid-cols-5 gap-px">
<legend class="text-[11px] font-bold mb-1">
Primary
</legend>
<ColorPickerPill v-for="color in primaryColors" :key="color" :color="color" :selected="primary" @select="primary = color" />
</fieldset>
<USeparator class="my-2" type="dashed" />
<fieldset class="grid grid-cols-5 gap-px">
<legend class="text-[11px] font-bold mb-1">
Gray
</legend>
<ColorPickerPill v-for="color in grayColors" :key="color" :color="color" :selected="gray" @select="gray = color" />
</fieldset>
</template>
</UPopover>
</template>
<script setup lang="ts">
const appConfig = useAppConfig()
// Computed
const primaryColors = ['red', 'orange', 'amber', 'yellow', 'lime', 'green', 'emerald', 'teal', 'cyan', 'sky', 'blue', 'indigo', 'violet', 'purple', 'fuchsia', 'pink', 'rose']
const primary = computed({
get() {
return appConfig.ui.colors.primary
},
set(option) {
appConfig.ui.colors.primary = option
window.localStorage.setItem('nuxt-ui-primary', appConfig.ui.colors.primary)
}
})
const grayColors = ['slate', 'cool', 'zinc', 'neutral', 'stone']
const gray = computed({
get() {
return appConfig.ui.colors.gray
},
set(option) {
appConfig.ui.colors.gray = option
window.localStorage.setItem('nuxt-ui-gray', appConfig.ui.colors.gray)
}
})
</script>

View File

@@ -1,24 +0,0 @@
<template>
<UTooltip :text="color" class="capitalize" :portal="false">
<UButton
color="gray"
square
:variant="color === selected ? 'soft' : 'ghost'"
@click.stop.prevent="$emit('select')"
>
<span
class="inline-block w-3 h-3 rounded-full"
:class="`bg-[--color-light] dark:bg-[--color-dark]`"
:style="{
'--color-light': `var(--color-${color}-500)`,
'--color-dark': `var(--color-${color}-400)`
}"
/>
</UButton>
</UTooltip>
</template>
<script setup lang="ts">
defineProps<{ color: string, selected: string }>()
defineEmits(['select'])
</script>

View File

@@ -86,7 +86,7 @@ const options = computed(() => {
value: variant,
label: variant,
chip: key.toLowerCase().endsWith('color') ? { color: variant } : undefined
})).filter(variant => key.toLowerCase().endsWith('color') ? !['error'].includes(variant.value) : true)
}))
return {
name: key,
@@ -214,15 +214,15 @@ const { data: ast } = await useAsyncData(`component-code-${name}-${hash({ props:
<template>
<div class="my-5">
<div>
<div v-if="options.length" class="flex items-center gap-2.5 border border-gray-200 dark:border-gray-700 border-b-0 relative rounded-t-md px-4 py-2.5 overflow-x-auto">
<div v-if="options.length" class="flex items-center gap-2.5 border border-[--ui-color-neutral-200] dark:border-[--ui-color-neutral-700] border-b-0 relative rounded-t-[calc(var(--ui-radius)*1.5)] px-4 py-2.5 overflow-x-auto">
<template v-for="option in options" :key="option.name">
<UFormField
:label="option.label"
size="sm"
class="inline-flex ring ring-gray-300 dark:ring-gray-700 rounded"
class="inline-flex ring ring-[--ui-border-accented] rounded"
:ui="{
wrapper: 'bg-gray-50 dark:bg-gray-800/50 rounded-l flex border-r border-gray-300 dark:border-gray-700',
label: 'text-gray-500 dark:text-gray-400 px-2 py-1.5',
wrapper: 'bg-[--ui-bg-elevated]/50 rounded-l flex border-r border-[--ui-border-accented]',
label: 'text-[--ui-text-muted] px-2 py-1.5',
container: 'mt-0'
}"
>
@@ -231,7 +231,7 @@ const { data: ast } = await useAsyncData(`component-code-${name}-${hash({ props:
:model-value="getComponentProp(option.name)"
:items="option.items"
value-key="value"
color="gray"
color="neutral"
variant="soft"
class="rounded rounded-l-none min-w-12"
:search-input="false"
@@ -254,7 +254,7 @@ const { data: ast } = await useAsyncData(`component-code-${name}-${hash({ props:
v-else
:type="option.type?.includes('number') ? 'number' : 'text'"
:model-value="getComponentProp(option.name)"
color="gray"
color="neutral"
variant="soft"
:ui="{ base: 'rounded rounded-l-none min-w-12' }"
@update:model-value="setComponentProp(option.name, $event)"
@@ -263,7 +263,7 @@ const { data: ast } = await useAsyncData(`component-code-${name}-${hash({ props:
</template>
</div>
<div class="flex justify-center border border-b-0 border-gray-200 dark:border-gray-700 relative p-4 z-[1]" :class="[!options.length && 'rounded-t-md', props.class]">
<div class="flex justify-center border border-b-0 border-[--ui-color-neutral-200] dark:border-[--ui-color-neutral-700] relative p-4 z-[1]" :class="[!options.length && 'rounded-t-[calc(var(--ui-radius)*1.5)]', props.class]">
<component :is="name" v-bind="{ ...componentProps, ...componentEvents }">
<template v-for="slot in Object.keys(slots || {})" :key="slot" #[slot]>
<ContentSlot :name="slot" unwrap="p">

View File

@@ -114,8 +114,8 @@ const optionsValues = ref(props.options?.reduce((acc, option) => {
<template>
<div class="my-5">
<div v-if="preview">
<div class="border border-gray-200 dark:border-gray-700 relative z-[1]" :class="[{ 'border-b-0 rounded-t-md': props.source, 'rounded-md': !props.source }]">
<div v-if="props.options?.length || !!slots.options" class="flex gap-4 p-4 border-b border-gray-200 dark:border-gray-700">
<div class="border border-[--ui-color-neutral-200] dark:border-[--ui-color-neutral-700] relative z-[1]" :class="[{ 'border-b-0 rounded-t-[calc(var(--ui-radius)*1.5)]': props.source, 'rounded-[calc(var(--ui-radius)*1.5)]': !props.source }]">
<div v-if="props.options?.length || !!slots.options" class="flex gap-4 p-4 border-b border-[--ui-color-neutral-200] dark:border-[--ui-color-neutral-700]">
<slot name="options" />
<UFormField
@@ -124,10 +124,10 @@ const optionsValues = ref(props.options?.reduce((acc, option) => {
:label="option.label"
:name="option.name"
size="sm"
class="inline-flex ring ring-gray-300 dark:ring-gray-700 rounded"
class="inline-flex ring ring-[--ui-border-accented] rounded"
:ui="{
wrapper: 'bg-gray-50 dark:bg-gray-800/50 rounded-l flex border-r border-gray-300 dark:border-gray-700',
label: 'text-gray-500 dark:text-gray-400 px-2 py-1.5',
wrapper: 'bg-[--ui-bg-elevated]/50 rounded-l flex border-r border-[--ui-border-accented]',
label: 'text-[--ui-text-muted] px-2 py-1.5',
container: 'mt-0'
}"
>
@@ -137,7 +137,7 @@ const optionsValues = ref(props.options?.reduce((acc, option) => {
:items="option.items"
:search-input="false"
:value-key="option.name.toLowerCase().endsWith('color') ? 'value' : undefined"
color="gray"
color="neutral"
variant="soft"
class="rounded rounded-l-none min-w-12"
:multiple="option.multiple"
@@ -158,7 +158,7 @@ const optionsValues = ref(props.options?.reduce((acc, option) => {
<UInput
v-else
:model-value="get(optionsValues, option.name)"
color="gray"
color="neutral"
variant="soft"
:ui="{ base: 'rounded rounded-l-none min-w-12' }"
@update:model-value="set(optionsValues, option.name, $event)"

View File

@@ -77,7 +77,7 @@ const metaProps: ComputedRef<ComponentMeta['props']> = computed(() => {
<ProseTd>
<HighlightInlineType v-if="prop.type" :type="prop.type" />
<MDC v-if="prop.description" :value="prop.description" class="text-gray-600 dark:text-gray-300 mt-1" />
<MDC v-if="prop.description" :value="prop.description" class="text-[--ui-text-toned] mt-1" />
<ComponentPropsSchema v-if="prop.schema" :prop="prop" :ignore="ignore" />
</ProseTd>

View File

@@ -40,7 +40,7 @@ const schemaProps = computed(() => {
<ProseLi v-for="schemaProp in schemaProps" :key="schemaProp.name">
<HighlightInlineType :type="`${schemaProp.name}${schemaProp.required === false ? '?' : ''}: ${schemaProp.type}`" />
<MDC v-if="schemaProp.description" :value="schemaProp.description" class="text-gray-500 dark:text-gray-400 my-1" />
<MDC v-if="schemaProp.description" :value="schemaProp.description" class="text-[--ui-text-muted] my-1" />
</ProseLi>
</ProseUl>
</Collapsible>

View File

@@ -31,7 +31,7 @@ const meta = await fetchComponentMeta(name as any)
<ProseTd>
<HighlightInlineType v-if="slot.type" :type="slot.type" />
<MDC v-if="slot.description" :value="slot.description" class="text-gray-600 dark:text-gray-300 mt-1" />
<MDC v-if="slot.description" :value="slot.description" class="text-[--ui-text-toned] mt-1" />
</ProseTd>
</ProseTr>
</ProseTbody>

View File

@@ -13,7 +13,7 @@ function stripCompoundVariants(component?: any) {
if (component?.compoundVariants) {
component.compoundVariants = component.compoundVariants.filter((compoundVariant: any) => {
if (compoundVariant.color) {
if (!['primary', 'gray'].includes(compoundVariant.color)) {
if (!['primary', 'neutral'].includes(compoundVariant.color)) {
strippedCompoundVariants.value = true
return false
@@ -21,7 +21,7 @@ function stripCompoundVariants(component?: any) {
}
if (compoundVariant.highlightColor) {
if (!['primary', 'gray'].includes(compoundVariant.highlightColor)) {
if (!['primary', 'neutral'].includes(compoundVariant.highlightColor)) {
strippedCompoundVariants.value = true
return false
@@ -53,11 +53,11 @@ export default defineAppConfig(${json5.stringify(component.value, null, 2).repla
::
${strippedCompoundVariants.value
? `
? `
::callout{icon="i-simple-icons-github" to="https://github.com/nuxt/ui/blob/v3/src/theme/${name}.ts"}
Some colors in \`compoundVariants\` are omitted for readability. Check out the source code on GitHub.
::`
: ''}
: ''}
`
return parseMarkdown(md)

View File

@@ -6,10 +6,10 @@ const { data: ast } = await useAsyncData(`icons-theme`, async () => {
const md = `
\`\`\`ts [app.config.ts]
export default defineAppConfig(${json5.stringify({
ui: {
icons
}
}, null, 2).replace(/,([ |\t\n]+[}|\])])/g, '$1')})
ui: {
icons
}
}, null, 2).replace(/,([ |\t\n]+[}|\])])/g, '$1')})
\`\`\`\
`

View File

@@ -1,6 +1,6 @@
<template>
<div class="relative overflow-hidden rounded border border-dashed border-gray-400 dark:border-gray-500 opacity-75 px-4 flex items-center justify-center">
<svg class="absolute inset-0 h-full w-full stroke-gray-900/10 dark:stroke-white/10" fill="none">
<div class="relative overflow-hidden rounded-[--ui-radius] border border-dashed border-[--ui-border-accented] opacity-75 px-4 flex items-center justify-center">
<svg class="absolute inset-0 h-full w-full stroke-[--ui-border-inverted]/10" fill="none">
<defs>
<pattern
id="pattern-5c1e4f0e-62d5-498b-8ff0-cf77bb448c8e"

View File

@@ -18,7 +18,7 @@ const items = [
<template>
<UAccordion :items="items">
<template #content="{ item }">
<p class="pb-3.5 text-sm text-gray-500 dark:text-gray-400">
<p class="pb-3.5 text-sm text-[--ui-text-muted]">
This is the {{ item.label }} panel.
</p>
</template>

View File

@@ -9,7 +9,7 @@ const items = [
label: 'Colors',
icon: 'i-heroicons-swatch',
slot: 'colors',
content: 'Choose a primary and a gray color from your Tailwind CSS theme.'
content: 'Choose a primary and a neutral color from your Tailwind CSS theme.'
},
{
label: 'Components',
@@ -22,7 +22,7 @@ const items = [
<template>
<UAccordion :items="items">
<template #colors="{ item }">
<p class="text-sm pb-3.5 text-primary-500 dark:text-primary-400">
<p class="text-sm pb-3.5 text-[--ui-primary]">
{{ item.content }}
</p>
</template>

View File

@@ -8,7 +8,7 @@ const items = [
{
label: 'Colors',
icon: 'i-heroicons-swatch',
content: 'Choose a primary and a gray color from your Tailwind CSS theme.'
content: 'Choose a primary and a neutral color from your Tailwind CSS theme.'
},
{
label: 'Components',

View File

@@ -1,20 +1,20 @@
<template>
<UAvatarGroup>
<UChip inset color="green">
<UChip inset color="success">
<UAvatar
src="https://avatars.githubusercontent.com/u/739984?v=4"
alt="Benjamin Canac"
/>
</UChip>
<UChip inset color="amber">
<UChip inset color="warning">
<UAvatar
src="https://avatars.githubusercontent.com/u/25613751?v=4"
alt="Romain Hamel"
/>
</UChip>
<UChip inset color="red">
<UChip inset color="error">
<UAvatar
src="https://avatars.githubusercontent.com/u/19751938?v=4"
alt="Neil Richter"

View File

@@ -3,7 +3,7 @@
<ULink
to="https://github.com/benjamincanac"
target="_blank"
class="hover:ring-primary-500 dark:hover:ring-primary-400 transition"
class="hover:ring-[--ui-primary] transition"
raw
>
<UAvatar
@@ -15,7 +15,7 @@
<ULink
to="https://github.com/romhml"
target="_blank"
class="hover:ring-primary-500 dark:hover:ring-primary-400 transition"
class="hover:ring-[--ui-primary] transition"
raw
>
<UAvatar
@@ -27,7 +27,7 @@
<ULink
to="https://github.com/noook"
target="_blank"
class="hover:ring-primary-500 dark:hover:ring-primary-400 transition"
class="hover:ring-[--ui-primary] transition"
raw
>
<UAvatar

View File

@@ -25,7 +25,7 @@ const items = [{
<UBreadcrumb :items="items">
<template #dropdown="{ item }">
<UDropdownMenu :items="item.children">
<UButton :icon="item.icon" color="gray" variant="link" class="p-0.5" />
<UButton :icon="item.icon" color="neutral" variant="link" class="p-0.5" />
</UDropdownMenu>
</template>
</UBreadcrumb>

View File

@@ -14,7 +14,7 @@ const items = [{
<template>
<UBreadcrumb :items="items">
<template #separator>
<span class="mx-2 text-gray-500 dark:text-gray-400">/</span>
<span class="mx-2 text-[--ui-text-muted]">/</span>
</template>
</UBreadcrumb>
</template>

View File

@@ -20,11 +20,11 @@ const items = [{
<template>
<UButtonGroup>
<UButton color="gray" variant="subtle" label="Settings" />
<UButton color="neutral" variant="subtle" label="Settings" />
<UDropdownMenu :items="items">
<UButton
color="gray"
color="neutral"
variant="outline"
icon="i-heroicons-chevron-down-20-solid"
/>

View File

@@ -1,10 +1,10 @@
<template>
<UButtonGroup>
<UInput color="gray" variant="outline" placeholder="Enter token" />
<UInput color="neutral" variant="outline" placeholder="Enter token" />
<UTooltip text="Copy to clipboard">
<UButton
color="gray"
color="neutral"
variant="subtle"
icon="i-heroicons-clipboard-document"
/>

View File

@@ -0,0 +1,16 @@
<script setup lang="ts">
const items = [
'https://picsum.photos/640/640?random=1',
'https://picsum.photos/640/640?random=2',
'https://picsum.photos/640/640?random=3',
'https://picsum.photos/640/640?random=4',
'https://picsum.photos/640/640?random=5',
'https://picsum.photos/640/640?random=6'
]
</script>
<template>
<UCarousel v-slot="{ item }" arrows :items="items" class="w-full max-w-xs mx-auto">
<img :src="item" width="320" height="320" class="rounded-lg">
</UCarousel>
</template>

View File

@@ -0,0 +1,29 @@
<script setup lang="ts">
const items = [
'https://picsum.photos/640/640?random=1',
'https://picsum.photos/640/320?random=2',
'https://picsum.photos/640/640?random=3',
'https://picsum.photos/640/320?random=4',
'https://picsum.photos/640/640?random=5',
'https://picsum.photos/640/320?random=6'
]
</script>
<template>
<UCarousel
v-slot="{ item }"
auto-height
arrows
dots
:items="items"
:ui="{
container: 'transition-[height]',
controls: 'absolute -top-8 inset-x-12',
dots: '-top-7',
dot: 'w-6 h-1'
}"
class="w-full max-w-xs mx-auto"
>
<img :src="item" width="320" height="320" class="rounded-lg">
</UCarousel>
</template>

View File

@@ -0,0 +1,24 @@
<script setup lang="ts">
const items = [
'https://picsum.photos/468/468?random=1',
'https://picsum.photos/468/468?random=2',
'https://picsum.photos/468/468?random=3',
'https://picsum.photos/468/468?random=4',
'https://picsum.photos/468/468?random=5',
'https://picsum.photos/468/468?random=6'
]
</script>
<template>
<UCarousel
v-slot="{ item }"
loop
dots
arrows
auto-scroll
:items="items"
:ui="{ item: 'basis-1/3' }"
>
<img :src="item" width="234" height="234" class="rounded-lg">
</UCarousel>
</template>

View File

@@ -0,0 +1,24 @@
<script setup lang="ts">
const items = [
'https://picsum.photos/468/468?random=1',
'https://picsum.photos/468/468?random=2',
'https://picsum.photos/468/468?random=3',
'https://picsum.photos/468/468?random=4',
'https://picsum.photos/468/468?random=5',
'https://picsum.photos/468/468?random=6'
]
</script>
<template>
<UCarousel
v-slot="{ item }"
loop
arrows
dots
:autoplay="{ delay: 2000 }"
:items="items"
:ui="{ item: 'basis-1/3' }"
>
<img :src="item" width="234" height="234" class="rounded-lg">
</UCarousel>
</template>

View File

@@ -0,0 +1,25 @@
<script setup lang="ts">
const items = [
'https://picsum.photos/528/528?random=1',
'https://picsum.photos/528/528?random=2',
'https://picsum.photos/528/528?random=3',
'https://picsum.photos/528/528?random=4',
'https://picsum.photos/528/528?random=5',
'https://picsum.photos/528/528?random=6'
]
</script>
<template>
<UCarousel
v-slot="{ item }"
class-names
arrows
:items="items"
:ui="{
item: 'basis-[70%] transition-opacity [&:not(.is-snapped)]:opacity-10'
}"
class="mx-auto max-w-sm"
>
<img :src="item" width="264" height="264" class="rounded-lg">
</UCarousel>
</template>

View File

@@ -0,0 +1,16 @@
<script setup lang="ts">
const items = [
'https://picsum.photos/640/640?random=1',
'https://picsum.photos/640/640?random=2',
'https://picsum.photos/640/640?random=3',
'https://picsum.photos/640/640?random=4',
'https://picsum.photos/640/640?random=5',
'https://picsum.photos/640/640?random=6'
]
</script>
<template>
<UCarousel v-slot="{ item }" dots :items="items" class="w-full max-w-xs mx-auto">
<img :src="item" width="320" height="320" class="rounded-lg">
</UCarousel>
</template>

View File

@@ -0,0 +1,16 @@
<script setup lang="ts">
const items = [
'https://picsum.photos/640/640?random=1',
'https://picsum.photos/640/640?random=2',
'https://picsum.photos/640/640?random=3',
'https://picsum.photos/640/640?random=4',
'https://picsum.photos/640/640?random=5',
'https://picsum.photos/640/640?random=6'
]
</script>
<template>
<UCarousel v-slot="{ item }" dots :items="items" :ui="{ item: 'basis-1/3' }">
<img :src="item" width="320" height="320" class="rounded-lg">
</UCarousel>
</template>

View File

@@ -0,0 +1,23 @@
<script setup lang="ts">
const items = [
'https://picsum.photos/640/640?random=1',
'https://picsum.photos/640/640?random=2',
'https://picsum.photos/640/640?random=3',
'https://picsum.photos/640/640?random=4',
'https://picsum.photos/640/640?random=5',
'https://picsum.photos/640/640?random=6'
]
</script>
<template>
<UCarousel
v-slot="{ item }"
fade
arrows
dots
:items="items"
class="w-full max-w-xs mx-auto"
>
<img :src="item" width="320" height="320" class="rounded-lg">
</UCarousel>
</template>

View File

@@ -0,0 +1,16 @@
<script setup lang="ts">
const items = [
'https://picsum.photos/640/640?random=1',
'https://picsum.photos/640/640?random=2',
'https://picsum.photos/640/640?random=3',
'https://picsum.photos/640/640?random=4',
'https://picsum.photos/640/640?random=5',
'https://picsum.photos/640/640?random=6'
]
</script>
<template>
<UCarousel v-slot="{ item }" :items="items" class="w-full max-w-xs mx-auto">
<img :src="item" width="320" height="320" class="rounded-lg">
</UCarousel>
</template>

View File

@@ -0,0 +1,16 @@
<script setup lang="ts">
const items = [
'https://picsum.photos/468/468?random=1',
'https://picsum.photos/468/468?random=2',
'https://picsum.photos/468/468?random=3',
'https://picsum.photos/468/468?random=4',
'https://picsum.photos/468/468?random=5',
'https://picsum.photos/468/468?random=6'
]
</script>
<template>
<UCarousel v-slot="{ item }" :items="items" :ui="{ item: 'basis-1/3' }">
<img :src="item" width="234" height="234" class="rounded-lg">
</UCarousel>
</template>

View File

@@ -0,0 +1,22 @@
<script setup lang="ts">
const items = [
'https://picsum.photos/640/640?random=1',
'https://picsum.photos/640/640?random=2',
'https://picsum.photos/640/640?random=3',
'https://picsum.photos/640/640?random=4',
'https://picsum.photos/640/640?random=5',
'https://picsum.photos/640/640?random=6'
]
</script>
<template>
<UCarousel
v-slot="{ item }"
orientation="vertical"
:items="items"
class="w-full max-w-xs mx-auto"
:ui="{ container: 'h-[336px]' }"
>
<img :src="item" width="320" height="320" class="rounded-lg">
</UCarousel>
</template>

View File

@@ -0,0 +1,23 @@
<script setup lang="ts">
const items = [
'https://picsum.photos/640/640?random=1',
'https://picsum.photos/640/640?random=2',
'https://picsum.photos/640/640?random=3',
'https://picsum.photos/640/640?random=4',
'https://picsum.photos/640/640?random=5',
'https://picsum.photos/640/640?random=6'
]
</script>
<template>
<UCarousel
v-slot="{ item }"
arrows
:prev="{ color: 'primary' }"
:next="{ variant: 'solid' }"
:items="items"
class="w-full max-w-xs mx-auto"
>
<img :src="item" width="320" height="320" class="rounded-lg">
</UCarousel>
</template>

View File

@@ -0,0 +1,28 @@
<script setup lang="ts">
defineProps<{
prevIcon?: string
nextIcon?: string
}>()
const items = [
'https://picsum.photos/640/640?random=1',
'https://picsum.photos/640/640?random=2',
'https://picsum.photos/640/640?random=3',
'https://picsum.photos/640/640?random=4',
'https://picsum.photos/640/640?random=5',
'https://picsum.photos/640/640?random=6'
]
</script>
<template>
<UCarousel
v-slot="{ item }"
arrows
:prev-icon="prevIcon"
:next-icon="nextIcon"
:items="items"
class="w-full max-w-xs mx-auto"
>
<img :src="item" width="320" height="320" class="rounded-lg">
</UCarousel>
</template>

View File

@@ -0,0 +1,22 @@
<script setup lang="ts">
const items = [
'https://picsum.photos/468/468?random=1',
'https://picsum.photos/468/468?random=2',
'https://picsum.photos/468/468?random=3',
'https://picsum.photos/468/468?random=4',
'https://picsum.photos/468/468?random=5',
'https://picsum.photos/468/468?random=6'
]
</script>
<template>
<UCarousel
v-slot="{ item }"
loop
wheel-gestures
:items="items"
:ui="{ item: 'basis-1/3' }"
>
<img :src="item" width="234" height="234" class="rounded-lg">
</UCarousel>
</template>

View File

@@ -2,7 +2,7 @@
const statuses = ['online', 'away', 'busy', 'offline']
const status = ref(statuses[0])
const color = computed(() => status.value ? { online: 'green', away: 'amber', busy: 'red', offline: 'gray' }[status.value] as any : 'online')
const color = computed(() => status.value ? { online: 'success', away: 'warning', busy: 'error', offline: 'neutral' }[status.value] as any : 'online')
const show = computed(() => status.value !== 'offline')

View File

@@ -3,7 +3,7 @@
<UButton
class="group"
label="Open"
color="gray"
color="neutral"
variant="subtle"
trailing-icon="i-heroicons-chevron-down-20-solid"
:ui="{

View File

@@ -10,7 +10,7 @@ defineShortcuts({
<UCollapsible v-model:open="open" class="w-48">
<UButton
label="Open"
color="gray"
color="neutral"
variant="subtle"
trailing-icon="i-heroicons-chevron-down-20-solid"
block

View File

@@ -14,7 +14,7 @@ const users = [
<UModal v-model:open="open">
<UButton
label="Search users..."
color="gray"
color="neutral"
variant="subtle"
icon="i-heroicons-magnifying-glass"
/>

View File

@@ -13,7 +13,7 @@ const items = [{
<template>
<UContextMenu :items="items" class="w-48">
<div class="flex items-center justify-center rounded-md border border-dashed border-gray-300 dark:border-gray-700 text-sm aspect-video w-72">
<div class="flex items-center justify-center rounded-md border border-dashed border-[--ui-border-accented] text-sm aspect-video w-72">
Right click here
</div>
@@ -22,7 +22,7 @@ const items = [{
</template>
<template #refresh-trailing>
<UIcon v-if="loading" name="i-heroicons-arrow-path-20-solid" class="shrink-0 size-5 text-primary-500 dark:text-primary-400 animate-spin" />
<UIcon v-if="loading" name="i-heroicons-arrow-path-20-solid" class="shrink-0 size-5 text-[--ui-primary] animate-spin" />
</template>
</UContextMenu>
</template>

View File

@@ -21,7 +21,7 @@ const groups = computed(() => [{
<UDrawer>
<UButton
label="Search users..."
color="gray"
color="neutral"
variant="subtle"
icon="i-heroicons-magnifying-glass"
/>
@@ -32,7 +32,7 @@ const groups = computed(() => [{
:loading="status === 'pending'"
:groups="groups"
placeholder="Search users..."
class="h-96 border-t border-gray-200 dark:border-gray-800"
class="h-96 border-t border-[--ui-border]"
/>
</template>
</UDrawer>

View File

@@ -4,15 +4,15 @@ const open = ref(false)
<template>
<UDrawer v-model:open="open" title="Drawer with footer" description="This is useful when you want a form in a Drawer." :ui="{ container: 'max-w-xl mx-auto' }">
<UButton label="Open" color="gray" variant="subtle" trailing-icon="i-heroicons-chevron-up-20-solid" />
<UButton label="Open" color="neutral" variant="subtle" trailing-icon="i-heroicons-chevron-up-20-solid" />
<template #body>
<Placeholder class="h-48" />
</template>
<template #footer>
<UButton label="Submit" color="gray" class="justify-center" />
<UButton label="Cancel" color="gray" variant="outline" class="justify-center" @click="open = false" />
<UButton label="Submit" color="neutral" class="justify-center" />
<UButton label="Cancel" color="neutral" variant="outline" class="justify-center" @click="open = false" />
</template>
</UDrawer>
</template>

View File

@@ -8,7 +8,7 @@ defineShortcuts({
<template>
<UDrawer v-model:open="open">
<UButton label="Open" color="gray" variant="subtle" trailing-icon="i-heroicons-chevron-up-20-solid" />
<UButton label="Open" color="neutral" variant="subtle" trailing-icon="i-heroicons-chevron-up-20-solid" />
<template #content>
<Placeholder class="h-48 m-4" />

View File

@@ -14,10 +14,10 @@ const items = [{
<template>
<UDropdownMenu :items="items" class="w-48">
<UButton label="Open" color="gray" variant="outline" icon="i-heroicons-bars-3" />
<UButton label="Open" color="neutral" variant="outline" icon="i-heroicons-bars-3" />
<template #profile-trailing>
<UIcon name="i-heroicons-check-badge" class="shrink-0 size-5 text-primary-500 dark:text-primary-400" />
<UIcon name="i-heroicons-check-badge" class="shrink-0 size-5 text-[--ui-primary]" />
</template>
</UDropdownMenu>
</template>

View File

@@ -19,6 +19,6 @@ const items = [{
<template>
<UDropdownMenu v-model:open="open" :items="items" class="w-48">
<UButton label="Open" color="gray" variant="outline" icon="i-heroicons-bars-3" />
<UButton label="Open" color="neutral" variant="outline" icon="i-heroicons-bars-3" />
</UDropdownMenu>
</template>

View File

@@ -15,7 +15,7 @@ const validate = (state: any): FormError[] => {
const toast = useToast()
async function onSubmit(event: FormSubmitEvent<any>) {
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'green' })
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
console.log(event.data)
}
</script>

View File

@@ -45,7 +45,7 @@ const items = [
const toast = useToast()
async function onSubmit(event: FormSubmitEvent<any>) {
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'green' })
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
console.log(event.data)
}
</script>
@@ -103,11 +103,11 @@ async function onSubmit(event: FormSubmitEvent<any>) {
</div>
<div class="flex gap-2 mt-8">
<UButton color="gray" type="submit">
<UButton color="neutral" type="submit">
Submit
</UButton>
<UButton color="gray" variant="outline" @click="form?.clear()">
<UButton color="neutral" variant="outline" @click="form?.clear()">
Clear
</UButton>
</div>

View File

@@ -16,7 +16,7 @@ const state = reactive({
const toast = useToast()
async function onSubmit(event: FormSubmitEvent<any>) {
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'green' })
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
console.log(event.data)
}
</script>

View File

@@ -19,7 +19,7 @@ const state = reactive<Partial<Schema & NestedSchema>>({ })
const toast = useToast()
async function onSubmit(event: FormSubmitEvent<any>) {
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'green' })
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
console.log(event.data)
}
</script>

View File

@@ -35,7 +35,7 @@ const formItemRef = ref()
const toast = useToast()
async function onSubmit(event: FormSubmitEvent<any>) {
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'green' })
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
console.log(event.data)
}
</script>
@@ -62,11 +62,11 @@ async function onSubmit(event: FormSubmitEvent<any>) {
</UForm>
<div class="flex gap-2">
<UButton color="gray" variant="subtle" size="sm" @click="addItem()">
<UButton color="neutral" variant="subtle" size="sm" @click="addItem()">
Add Item
</UButton>
<UButton color="gray" variant="ghost" size="sm" @click="removeItem()">
<UButton color="neutral" variant="ghost" size="sm" @click="removeItem()">
Remove Item
</UButton>
</div>

View File

@@ -15,7 +15,7 @@ const validate = (state: any): FormError[] => {
const toast = useToast()
async function onSubmit(event: FormSubmitEvent<any>) {
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'green' })
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
console.log(event.data)
}

View File

@@ -16,7 +16,7 @@ const state = reactive({
const toast = useToast()
async function onSubmit(event: FormSubmitEvent<Schema>) {
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'green' })
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
console.log(event.data)
}
</script>

View File

@@ -18,7 +18,7 @@ const state = reactive({
const toast = useToast()
async function onSubmit(event: FormSubmitEvent<Schema>) {
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'green' })
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
console.log(event.data)
}
</script>

View File

@@ -16,7 +16,7 @@ const state = reactive<Partial<Schema>>({
const toast = useToast()
async function onSubmit(event: FormSubmitEvent<Schema>) {
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'green' })
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
console.log(event.data)
}
</script>

View File

@@ -33,7 +33,7 @@ const { data: users, status } = await useFetch('https://jsonplaceholder.typicode
<template #item-label="{ item }">
{{ item.label }}
<span class="text-gray-500 dark:text-gray-400">
<span class="text-[--ui-text-muted]">
{{ item.email }}
</span>
</template>

View File

@@ -4,21 +4,21 @@ const items = ref([
label: 'bug',
value: 'bug',
chip: {
color: 'red' as const
}
},
{
label: 'enhancement',
value: 'enhancement',
chip: {
color: 'blue' as const
color: 'error' as const
}
},
{
label: 'feature',
value: 'feature',
chip: {
color: 'violet' as const
color: 'success' as const
}
},
{
label: 'enhancement',
value: 'enhancement',
chip: {
color: 'info' as const
}
}
])

View File

@@ -21,7 +21,7 @@ const groups = computed(() => [{
<UModal>
<UButton
label="Search users..."
color="gray"
color="neutral"
variant="subtle"
icon="i-heroicons-magnifying-glass"
/>

View File

@@ -9,7 +9,7 @@ defineProps<{
<template>
<UModal :title="`This modal was opened programmatically ${count} times`">
<template #footer>
<UButton color="gray" label="Close" @click="modal.close()" />
<UButton color="neutral" label="Close" @click="modal.close()" />
</template>
</UModal>
</template>

View File

@@ -4,15 +4,15 @@ const open = ref(false)
<template>
<UModal v-model:open="open" title="Modal with footer" description="This is useful when you want a form in a Modal." :ui="{ footer: 'justify-end' }">
<UButton label="Open" color="gray" variant="subtle" />
<UButton label="Open" color="neutral" variant="subtle" />
<template #body>
<Placeholder class="h-48" />
</template>
<template #footer>
<UButton label="Cancel" color="gray" variant="outline" @click="open = false" />
<UButton label="Submit" color="gray" />
<UButton label="Cancel" color="neutral" variant="outline" @click="open = false" />
<UButton label="Submit" color="neutral" />
</template>
</UModal>
</template>

View File

@@ -5,16 +5,16 @@ const second = ref(false)
<template>
<UModal v-model:open="first" title="First modal" :ui="{ footer: 'justify-end' }">
<UButton color="gray" variant="subtle" label="Open" />
<UButton color="neutral" variant="subtle" label="Open" />
<template #footer>
<UButton label="Close" color="gray" variant="outline" @click="first = false" />
<UButton label="Close" color="neutral" variant="outline" @click="first = false" />
<UModal v-model:open="second" title="Second modal" :ui="{ footer: 'justify-end' }">
<UButton label="Open second" color="gray" />
<UButton label="Open second" color="neutral" />
<template #footer>
<UButton label="Close" color="gray" variant="outline" @click="second = false" />
<UButton label="Close" color="neutral" variant="outline" @click="second = false" />
</template>
</UModal>
</template>

View File

@@ -8,7 +8,7 @@ defineShortcuts({
<template>
<UModal v-model:open="open">
<UButton label="Open" color="gray" variant="subtle" />
<UButton label="Open" color="neutral" variant="subtle" />
<template #content>
<Placeholder class="h-48 m-4" />

View File

@@ -16,5 +16,5 @@ function open() {
</script>
<template>
<UButton label="Open" color="gray" variant="subtle" @click="open" />
<UButton label="Open" color="neutral" variant="subtle" @click="open" />
</template>

View File

@@ -22,7 +22,7 @@ const items = [
{
label: 'Colors',
icon: 'i-heroicons-swatch',
description: 'Choose a primary and a gray color from your Tailwind CSS theme.'
description: 'Choose a primary and a neutral color from your Tailwind CSS theme.'
},
{
label: 'Theme',

View File

@@ -1,20 +1,27 @@
<script setup lang="ts">
const labels = [{
label: 'bug',
chip: {
color: 'red' as const
const items = ref([
{
label: 'bug',
value: 'bug',
chip: {
color: 'error' as const
}
},
{
label: 'feature',
value: 'feature',
chip: {
color: 'success' as const
}
},
{
label: 'enhancement',
value: 'enhancement',
chip: {
color: 'info' as const
}
}
}, {
label: 'feature',
chip: {
color: 'green' as const
}
}, {
label: 'enhancement',
chip: {
color: 'blue' as const
}
}]
])
const label = ref([])
</script>
@@ -23,7 +30,7 @@ const label = ref([])
<UButton
icon="i-heroicons-tag"
label="Select labels"
color="gray"
color="neutral"
variant="subtle"
/>
@@ -32,7 +39,7 @@ const label = ref([])
v-model="label"
multiple
placeholder="Search labels..."
:groups="[{ id: 'labels', items: labels }]"
:groups="[{ id: 'labels', items }]"
:ui="{ input: '[&>input]:h-8' }"
/>
</template>

View File

@@ -8,7 +8,7 @@ defineShortcuts({
<template>
<UPopover v-model:open="open">
<UButton label="Open" color="gray" variant="subtle" />
<UButton label="Open" color="neutral" variant="subtle" />
<template #content>
<Placeholder class="size-48 m-4 inline-flex" />

View File

@@ -33,7 +33,7 @@ const { data: users, status } = await useFetch('https://jsonplaceholder.typicode
<template #item-label="{ item }">
{{ item.label }}
<span class="text-gray-500 dark:text-gray-400">
<span class="text-[--ui-text-muted]">
{{ item.email }}
</span>
</template>

View File

@@ -4,21 +4,21 @@ const items = ref([
label: 'bug',
value: 'bug',
chip: {
color: 'red' as const
}
},
{
label: 'enhancement',
value: 'enhancement',
chip: {
color: 'blue' as const
color: 'error' as const
}
},
{
label: 'feature',
value: 'feature',
chip: {
color: 'violet' as const
color: 'success' as const
}
},
{
label: 'enhancement',
value: 'enhancement',
chip: {
color: 'info' as const
}
}
])

View File

@@ -4,21 +4,21 @@ const items = ref([
label: 'bug',
value: 'bug',
chip: {
color: 'red' as const
}
},
{
label: 'enhancement',
value: 'enhancement',
chip: {
color: 'blue' as const
color: 'error' as const
}
},
{
label: 'feature',
value: 'feature',
chip: {
color: 'violet' as const
color: 'success' as const
}
},
{
label: 'enhancement',
value: 'enhancement',
chip: {
color: 'info' as const
}
}
])

View File

@@ -13,7 +13,7 @@ defineProps<{
</template>
<template #footer>
<UButton color="gray" label="Close" @click="slideover.close()" />
<UButton color="neutral" label="Close" @click="slideover.close()" />
</template>
</USlideover>
</template>

View File

@@ -4,15 +4,15 @@ const open = ref(false)
<template>
<USlideover v-model:open="open" title="Slideover with footer" description="This is useful when you want a form in a Slideover." :ui="{ footer: 'justify-end' }">
<UButton label="Open" color="gray" variant="subtle" />
<UButton label="Open" color="neutral" variant="subtle" />
<template #body>
<Placeholder class="h-full" />
</template>
<template #footer>
<UButton label="Cancel" color="gray" variant="outline" @click="open = false" />
<UButton label="Submit" color="gray" />
<UButton label="Cancel" color="neutral" variant="outline" @click="open = false" />
<UButton label="Submit" color="neutral" />
</template>
</USlideover>
</template>

View File

@@ -5,24 +5,24 @@ const second = ref(false)
<template>
<USlideover v-model:open="first" title="First slideover" :ui="{ footer: 'justify-end' }">
<UButton color="gray" variant="subtle" label="Open" />
<UButton color="neutral" variant="subtle" label="Open" />
<template #body>
<Placeholder class="h-full" />
</template>
<template #footer>
<UButton label="Close" color="gray" variant="outline" @click="first = false" />
<UButton label="Close" color="neutral" variant="outline" @click="first = false" />
<USlideover v-model:open="second" title="Second slideover" :ui="{ footer: 'justify-end' }">
<UButton label="Open second" color="gray" />
<UButton label="Open second" color="neutral" />
<template #body>
<Placeholder class="h-full" />
</template>
<template #footer>
<UButton label="Close" color="gray" variant="outline" @click="second = false" />
<UButton label="Close" color="neutral" variant="outline" @click="second = false" />
</template>
</USlideover>
</template>

View File

@@ -8,7 +8,7 @@ defineShortcuts({
<template>
<USlideover v-model:open="open">
<UButton label="Open" color="gray" variant="subtle" />
<UButton label="Open" color="neutral" variant="subtle" />
<template #content>
<Placeholder class="h-full m-4" />

View File

@@ -16,5 +16,5 @@ function open() {
</script>
<template>
<UButton label="Open" color="gray" variant="subtle" @click="open" />
<UButton label="Open" color="neutral" variant="subtle" @click="open" />
</template>

View File

@@ -26,7 +26,7 @@ const state = reactive({
<template>
<UTabs :items="items" variant="link" class="gap-4 w-full" :ui="{ trigger: 'flex-1' }">
<template #account="{ item }">
<p class="text-gray-500 dark:text-gray-400 mb-4">
<p class="text-[--ui-text-muted] mb-4">
{{ item.description }}
</p>
@@ -43,7 +43,7 @@ const state = reactive({
</template>
<template #password="{ item }">
<p class="text-gray-500 dark:text-gray-400 mb-4">
<p class="text-[--ui-text-muted] mb-4">
{{ item.description }}
</p>

View File

@@ -12,7 +12,7 @@ function showToast() {
actions: [{
icon: 'i-heroicons-arrow-path-20-solid',
label: 'Retry',
color: 'gray',
color: 'neutral',
variant: 'outline',
onClick: (e) => {
e?.stopPropagation()
@@ -23,5 +23,5 @@ function showToast() {
</script>
<template>
<UButton label="Show toast" color="gray" variant="outline" @click="showToast" />
<UButton label="Show toast" color="neutral" variant="outline" @click="showToast" />
</template>

View File

@@ -17,5 +17,5 @@ function showToast() {
</script>
<template>
<UButton label="Invite user" color="gray" variant="outline" @click="showToast" />
<UButton label="Invite user" color="neutral" variant="outline" @click="showToast" />
</template>

View File

@@ -16,5 +16,5 @@ function showToast() {
</script>
<template>
<UButton label="Show toast" color="gray" variant="outline" @click="showToast" />
<UButton label="Show toast" color="neutral" variant="outline" @click="showToast" />
</template>

View File

@@ -15,5 +15,5 @@ function showToast() {
</script>
<template>
<UButton label="Show toast" color="gray" variant="outline" @click="showToast" />
<UButton label="Show toast" color="neutral" variant="outline" @click="showToast" />
</template>

View File

@@ -18,5 +18,5 @@ function showToast() {
</script>
<template>
<UButton label="Show toast" color="gray" variant="outline" @click="showToast" />
<UButton label="Show toast" color="neutral" variant="outline" @click="showToast" />
</template>

View File

@@ -12,5 +12,5 @@ function showToast() {
</script>
<template>
<UButton label="Show toast" color="gray" variant="outline" @click="showToast" />
<UButton label="Show toast" color="neutral" variant="outline" @click="showToast" />
</template>

View File

@@ -14,5 +14,5 @@ function addToCalendar() {
</script>
<template>
<UButton label="Add to calendar" color="gray" variant="outline" icon="i-heroicons-plus" @click="addToCalendar" />
<UButton label="Add to calendar" color="neutral" variant="outline" icon="i-heroicons-plus" @click="addToCalendar" />
</template>

View File

@@ -15,5 +15,5 @@ function showToast() {
</script>
<template>
<UButton label="Show toast" color="gray" variant="outline" @click="showToast" />
<UButton label="Show toast" color="neutral" variant="outline" @click="showToast" />
</template>

View File

@@ -11,5 +11,5 @@ function showToast() {
</script>
<template>
<UButton label="Show toast" color="gray" variant="outline" @click="showToast" />
<UButton label="Show toast" color="neutral" variant="outline" @click="showToast" />
</template>

View File

@@ -7,16 +7,16 @@ const appConfig = useAppConfig()
<UFormField
label="toaster.duration"
size="sm"
class="inline-flex ring ring-gray-300 dark:ring-gray-700 rounded"
class="inline-flex ring ring-[--ui-border-accented] rounded"
:ui="{
wrapper: 'bg-gray-50 dark:bg-gray-800/50 rounded-l flex border-r border-gray-300 dark:border-gray-700',
label: 'text-gray-500 dark:text-gray-400 px-2 py-1.5',
wrapper: 'bg-[--ui-bg-elevated]/50 rounded-l flex border-r border-[--ui-border-accented]',
label: 'text-[--ui-text-muted] px-2 py-1.5',
container: 'mt-0'
}"
>
<UInput
v-model="appConfig.toaster.duration"
color="gray"
color="neutral"
variant="soft"
class="rounded rounded-l-none min-w-12"
:search-input="false"

View File

@@ -7,17 +7,17 @@ const appConfig = useAppConfig()
<UFormField
label="toaster.expand"
size="sm"
class="inline-flex ring ring-gray-300 dark:ring-gray-700 rounded"
class="inline-flex ring ring-[--ui-border-accented] rounded"
:ui="{
wrapper: 'bg-gray-50 dark:bg-gray-800/50 rounded-l flex border-r border-gray-300 dark:border-gray-700',
label: 'text-gray-500 dark:text-gray-400 px-2 py-1.5',
wrapper: 'bg-[--ui-bg-elevated]/50 rounded-l flex border-r border-[--ui-border-accented]',
label: 'text-[--ui-text-muted] px-2 py-1.5',
container: 'mt-0'
}"
>
<USelectMenu
v-model="appConfig.toaster.expand"
:items="[true, false]"
color="gray"
color="neutral"
variant="soft"
class="rounded rounded-l-none min-w-12"
:search-input="false"

View File

@@ -10,17 +10,17 @@ const appConfig = useAppConfig()
<UFormField
label="toaster.position"
size="sm"
class="inline-flex ring ring-gray-300 dark:ring-gray-700 rounded"
class="inline-flex ring ring-[--ui-border-accented] rounded"
:ui="{
wrapper: 'bg-gray-50 dark:bg-gray-800/50 rounded-l flex border-r border-gray-300 dark:border-gray-700',
label: 'text-gray-500 dark:text-gray-400 px-2 py-1.5',
wrapper: 'bg-[--ui-bg-elevated]/50 rounded-l flex border-r border-[--ui-border-accented]',
label: 'text-[--ui-text-muted] px-2 py-1.5',
container: 'mt-0'
}"
>
<USelectMenu
v-model="appConfig.toaster.position"
:items="positions"
color="gray"
color="neutral"
variant="soft"
class="rounded rounded-l-none min-w-12"
:search-input="false"

View File

@@ -8,6 +8,6 @@ defineShortcuts({
<template>
<UTooltip v-model:open="open" text="Open on GitHub">
<UButton label="Open" color="gray" variant="subtle" />
<UButton label="Open" color="neutral" variant="subtle" />
</UTooltip>
</template>

View File

@@ -0,0 +1,140 @@
<template>
<UPopover :ui="{ content: 'w-72 px-6 py-4 flex flex-col gap-4' }">
<template #default="{ open }">
<UButton
icon="i-heroicons-swatch"
color="neutral"
:variant="open ? 'soft' : 'ghost'"
square
aria-label="Color picker"
:ui="{ leadingIcon: 'text-[--ui-primary]' }"
/>
</template>
<template #content>
<fieldset>
<legend class="text-[11px] leading-none font-semibold mb-2">
Primary
</legend>
<div class="grid grid-cols-3 gap-1 -mx-2">
<ThemePickerButton
v-for="color in primaryColors"
:key="color"
:label="color"
:chip="color"
:selected="primary === color"
@select="primary = color"
/>
</div>
</fieldset>
<fieldset>
<legend class="text-[11px] leading-none font-semibold mb-2">
Neutral
</legend>
<div class="grid grid-cols-3 gap-1 -mx-2">
<ThemePickerButton
v-for="color in neutralColors"
:key="color"
:label="color"
:chip="color"
:selected="neutral === color"
@select="neutral = color"
/>
</div>
</fieldset>
<fieldset>
<legend class="text-[11px] leading-none font-semibold mb-2">
Radius
</legend>
<div class="grid grid-cols-5 gap-1 -mx-2">
<ThemePickerButton
v-for="r in radiuses"
:key="r"
:label="String(r)"
class="justify-center px-0"
:selected="radius === r"
@select="radius = r"
/>
</div>
</fieldset>
<fieldset>
<legend class="text-[11px] leading-none font-semibold mb-2">
Theme
</legend>
<div class="flex gap-1 -mx-2">
<ThemePickerButton
v-for="m in modes"
:key="m.label"
v-bind="m"
:selected="mode === m.label"
@select="mode = m.label"
/>
</div>
</fieldset>
</template>
</UPopover>
</template>
<script setup lang="ts">
import colors from 'tailwindcss/colors'
import { omit } from '#ui/utils'
const appConfig = useAppConfig()
const colorMode = useColorMode()
// Computed
const neutralColors = ['slate', 'gray', 'zinc', 'neutral', 'stone']
const neutral = computed({
get() {
return appConfig.ui.colors.neutral
},
set(option) {
appConfig.ui.colors.neutral = option
window.localStorage.setItem('nuxt-ui-neutral', appConfig.ui.colors.neutral)
}
})
const colorsToOmit = ['inherit', 'current', 'transparent', 'black', 'white', ...neutralColors]
const primaryColors = Object.keys(omit(colors, colorsToOmit as any))
const primary = computed({
get() {
return appConfig.ui.colors.primary
},
set(option) {
appConfig.ui.colors.primary = option
window.localStorage.setItem('nuxt-ui-primary', appConfig.ui.colors.primary)
}
})
const radiuses = [0, 0.125, 0.25, 0.375, 0.5]
const radius = computed({
get() {
return appConfig.theme.radius
},
set(option) {
appConfig.theme.radius = option
window.localStorage.setItem('nuxt-ui-radius', String(appConfig.theme.radius))
}
})
const modes = [
{ label: 'light', icon: appConfig.ui.icons.light },
{ label: 'dark', icon: appConfig.ui.icons.dark }
]
const mode = computed({
get() {
return colorMode.value
},
set(option) {
colorMode.preference = option
}
})
</script>

View File

@@ -0,0 +1,32 @@
<template>
<UButton
size="sm"
color="neutral"
:icon="icon"
:label="label"
:variant="selected ? 'soft' : 'outline'"
class="capitalize ring-[--ui-border] rounded-[--ui-radius] text-[11px]"
@click.stop.prevent="$emit('select')"
>
<template v-if="chip" #leading>
<span
class="inline-block w-2 h-2 rounded-full"
:class="`bg-[--color-light] dark:bg-[--color-dark]`"
:style="{
'--color-light': `var(--color-${chip}-500)`,
'--color-dark': `var(--color-${chip}-400)`
}"
/>
</template>
</UButton>
</template>
<script setup lang="ts">
defineProps<{
label: string
icon?: string
chip?: string
selected?: boolean
}>()
defineEmits(['select'])
</script>

View File

@@ -36,7 +36,8 @@ useSeoMeta({
})
defineOgImageComponent('Docs', {
headline: headline.value
headline: headline.value,
title: page.value.title
})
const communityLinks = computed(() => [{
@@ -90,7 +91,7 @@ const communityLinks = computed(() => [{
</UPageBody>
<template v-if="page?.body?.toc?.links?.length" #right>
<UContentToc :links="page.body.toc.links">
<UContentToc :links="page.body.toc.links" class="z-[2]">
<template #bottom>
<USeparator v-if="page.body?.toc?.links?.length" type="dashed" />

View File

@@ -16,7 +16,7 @@ const colorMode = useColorMode()
const token = 'eyJ2aWV3IjoiYm9hcmQiLCJib2FyZFN0YXR1c2VzIjpbInRyaWFnZSIsImJhY2tsb2ciLCJ0b2RvIiwiaW5fcHJvZ3Jlc3MiLCJpbl9yZXZpZXciLCJkb25lIiwicmVsZWFzZWQiXSwiYm9hcmRMaW5rZWRQcnMiOmZhbHNlLCJsaXN0R3JvdXAiOiJzdGF0ZSIsImxpc3RPcmRlciI6ImNyZWF0ZWRfYXQiLCJ0aW1lbGluZVpvb20iOiJtb250aCIsInRpbWVsaW5lT3JkZXIiOiJzdGF0ZSIsInRpbWVsaW5lRGlzcGxheSI6ImFsbF9taWxlc3RvbmVzIiwiZmlsdGVycyI6e30sIm93bmVyIjoibnV4dCIsIm5hbWUiOiJ1aSJ9'
const src = computed(() => `https://volta.net/embed/${token}?theme=${colorMode.value}&gray=${appConfig.ui.colors.gray}&primary=${appConfig.ui.colors.primary}`)
const src = computed(() => `https://volta.net/embed/${token}?theme=${colorMode.value}&gray=${appConfig.ui.colors.neutral}&primary=${appConfig.ui.colors.primary}`)
</script>
<template>

View File

@@ -1,41 +0,0 @@
export default defineNuxtPlugin({
enforce: 'post',
setup() {
const appConfig = useAppConfig()
if (import.meta.client) {
const primary = window.localStorage.getItem('nuxt-ui-primary')
if (primary) {
appConfig.ui.colors.primary = primary
}
const gray = window.localStorage.getItem('nuxt-ui-gray')
if (gray) {
appConfig.ui.colors.gray = gray
}
}
if (import.meta.server) {
useHead({
script: [
{
innerHTML: `
let html = document.querySelector('style#nuxt-ui-colors').innerHTML;
if (localStorage.getItem('nuxt-ui-primary')) {
html = html.replaceAll('${appConfig.ui.colors.primary}', localStorage.getItem('nuxt-ui-primary'))
}
if (localStorage.getItem('nuxt-ui-gray')) {
html = html.replaceAll('${appConfig.ui.colors.gray}', localStorage.getItem('nuxt-ui-gray'))
}
document.querySelector('style#nuxt-ui-colors').innerHTML = html
`.replace(/\s+/g, ' '),
type: 'text/javascript',
tagPriority: -1
}
]
})
}
}
})

Some files were not shown because too many files have changed in this diff Show More