mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-20 15:01:46 +01:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6658209b6 | ||
|
|
9c04969022 | ||
|
|
606c7b6567 | ||
|
|
7e37668940 | ||
|
|
4d61936e7e | ||
|
|
8ac9ca4978 | ||
|
|
3485092edb | ||
|
|
1cc7e2a306 | ||
|
|
3411b89191 | ||
|
|
1b869dc1fb | ||
|
|
4ae6e31bd9 | ||
|
|
69f605fa72 | ||
|
|
93ddf1d60b | ||
|
|
03c5820f5d | ||
|
|
c88bb8c56b | ||
|
|
aaabf61c01 | ||
|
|
4fd1be2892 | ||
|
|
e60911010a | ||
|
|
ea721a3705 | ||
|
|
4614aca70e | ||
|
|
ec2c1162dd | ||
|
|
64c38cb35e | ||
|
|
503885a5fe |
34
CHANGELOG.md
34
CHANGELOG.md
@@ -1,5 +1,39 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [2.18.4](https://github.com/nuxt/ui/compare/v2.18.3...v2.18.4) (2024-08-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Form:** submit event data ([#2012](https://github.com/nuxt/ui/issues/2012)) ([4d61936](https://github.com/nuxt/ui/commit/4d61936e7e90b664846a8f265825612c509511d7))
|
||||||
|
* **module:** handle nested colors from ui config ([#2008](https://github.com/nuxt/ui/issues/2008)) ([1cc7e2a](https://github.com/nuxt/ui/commit/1cc7e2a306e0f3f666b9a588f6ed02e7eabc0272))
|
||||||
|
* **module:** reduce css bundle size by fixing safelist regex ([#2005](https://github.com/nuxt/ui/issues/2005)) ([8ac9ca4](https://github.com/nuxt/ui/commit/8ac9ca49789a9a7281f7a40926e7e9a8068cc395))
|
||||||
|
* **module:** suffix types imports with `/index` ([7e37668](https://github.com/nuxt/ui/commit/7e37668940d06c5aa20b60d9bfd600d50a171014)), closes [#2018](https://github.com/nuxt/ui/issues/2018)
|
||||||
|
* **Tabs:** use `nextTick` before marker calc ([#2020](https://github.com/nuxt/ui/issues/2020)) ([9c04969](https://github.com/nuxt/ui/commit/9c049690227af8aba61a1f7c002b00c5dfeb63ff))
|
||||||
|
* **useFormGroup:** app config default input size ([#2011](https://github.com/nuxt/ui/issues/2011)) ([3485092](https://github.com/nuxt/ui/commit/3485092edb55f9ef2ca038a8c137431866d6c28a))
|
||||||
|
|
||||||
|
## [2.18.3](https://github.com/nuxt/ui/compare/v2.18.2...v2.18.3) (2024-07-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Link:** define `rel` as any ([69f605f](https://github.com/nuxt/ui/commit/69f605fa724454e4be9e4cee9666a5d57f43a129))
|
||||||
|
* **types:** only use `.ts` for index ([93ddf1d](https://github.com/nuxt/ui/commit/93ddf1d60b0ea5f99f564f3d3969c397ad91cc72))
|
||||||
|
|
||||||
|
## [2.18.2](https://github.com/nuxt/ui/compare/v2.18.1...v2.18.2) (2024-07-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Tabs:** add missing `UIcon` import ([4fd1be2](https://github.com/nuxt/ui/commit/4fd1be28922bf39584005c14982e5cd9a7d0c624))
|
||||||
|
|
||||||
|
## [2.18.1](https://github.com/nuxt/ui/compare/v2.18.0...v2.18.1) (2024-07-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **components:** use relative imports ([ea721a3](https://github.com/nuxt/ui/commit/ea721a3705cfbcef3075f8c9c1f4acf359974597))
|
||||||
|
|
||||||
## [2.18.0](https://github.com/nuxt/ui/compare/v2.17.0...v2.18.0) (2024-07-25)
|
## [2.18.0](https://github.com/nuxt/ui/compare/v2.17.0...v2.18.0) (2024-07-25)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
const { $ui } = useNuxtApp()
|
||||||
|
|
||||||
const links = [{
|
const links = [{
|
||||||
icon: 'i-simple-icons-figma',
|
icon: 'i-simple-icons-figma',
|
||||||
label: 'Figma Kit',
|
label: 'Figma Kit',
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ defineProps<{
|
|||||||
}>()
|
}>()
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
const { $ui } = useNuxtApp()
|
||||||
const { metaSymbol } = useShortcuts()
|
const { metaSymbol } = useShortcuts()
|
||||||
|
|
||||||
const nav = inject<Ref<NavItem[]>>('navigation')
|
const nav = inject<Ref<NavItem[]>>('navigation')
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { SlideoverExampleComponent } from '#components'
|
import { SlideoverExampleComponent } from '#components'
|
||||||
|
|
||||||
const slideover = useSlideover()
|
const slideover = useSlideover()
|
||||||
const count = ref(0)
|
const count = ref(0)
|
||||||
function openSlideover () {
|
function openSlideover () {
|
||||||
@@ -13,4 +14,4 @@ function openSlideover () {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UButton label="Reveal slideover" @click="openSlideover" />
|
<UButton label="Reveal slideover" @click="openSlideover" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default defineAppConfig({
|
|||||||
Try to change the `primary` and `gray` colors by clicking on the :u-icon{name="i-heroicons-swatch-20-solid" class="w-4 h-4 align-middle text-primary-500 dark:text-primary-400"} button in the header.
|
Try to change the `primary` and `gray` colors by clicking on the :u-icon{name="i-heroicons-swatch-20-solid" class="w-4 h-4 align-middle text-primary-500 dark:text-primary-400"} button in the header.
|
||||||
::
|
::
|
||||||
|
|
||||||
As this module uses Tailwind CSS under the hood, you can use any of the [Tailwind CSS colors](https://tailwindcss.com/docs/customizing-colors#color-palette-reference) or your own custom colors. By default, the `primary` color is `green` and the `gray` color is `cool`.
|
As this module uses Tailwind CSS under the hood, you can use any of the [Tailwind CSS colors](https://tailwindcss.com/docs/customizing-colors#color-palette-reference) or your own custom colors or groups, such as `brand.primary`. By default, the `primary` color is `green` and the `gray` color is `cool`.
|
||||||
|
|
||||||
When [using custom colors](https://tailwindcss.com/docs/customizing-colors#using-custom-colors) or [adding additional colors](https://tailwindcss.com/docs/customizing-colors#adding-additional-colors) through the `extend` key in your `tailwind.config.ts`, you'll need to make sure to define all the shades from `50` to `950` as most of them are used in the components config defined in [`ui.config/`](https://github.com/nuxt/ui/tree/dev/src/runtime/ui.config) directory. You can [generate your colors](https://tailwindcss.com/docs/customizing-colors#generating-colors) using tools such as https://uicolors.app/ for example.
|
When [using custom colors](https://tailwindcss.com/docs/customizing-colors#using-custom-colors) or [adding additional colors](https://tailwindcss.com/docs/customizing-colors#adding-additional-colors) through the `extend` key in your `tailwind.config.ts`, you'll need to make sure to define all the shades from `50` to `950` as most of them are used in the components config defined in [`ui.config/`](https://github.com/nuxt/ui/tree/dev/src/runtime/ui.config) directory. You can [generate your colors](https://tailwindcss.com/docs/customizing-colors#generating-colors) using tools such as https://uicolors.app/ for example.
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@iconify-json/heroicons": "^1.1.22",
|
"@iconify-json/heroicons": "^1.1.23",
|
||||||
"@iconify-json/simple-icons": "^1.1.109",
|
"@iconify-json/simple-icons": "^1.1.111",
|
||||||
"@iconify-json/vscode-icons": "^1.1.36",
|
"@iconify-json/vscode-icons": "^1.1.36",
|
||||||
"@nuxt/content": "^2.13.2",
|
"@nuxt/content": "^2.13.2",
|
||||||
"@nuxt/eslint-config": "^0.3.13",
|
"@nuxt/eslint-config": "^0.4.0",
|
||||||
"@nuxt/fonts": "^0.7.1",
|
"@nuxt/fonts": "^0.7.1",
|
||||||
"@nuxt/image": "^1.7.0",
|
"@nuxt/image": "^1.7.0",
|
||||||
"@nuxt/ui": "latest",
|
"@nuxt/ui": "latest",
|
||||||
"@nuxt/ui-pro": "npm:@nuxt/ui-pro-edge@1.3.1-28695485.b267028",
|
"@nuxt/ui-pro": "npm:@nuxt/ui-pro-edge@1.3.1-28698404.4d54eb2",
|
||||||
"@nuxtjs/plausible": "^1.0.0",
|
"@nuxtjs/plausible": "^1.0.0",
|
||||||
"@octokit/rest": "^21.0.1",
|
"@octokit/rest": "^21.0.1",
|
||||||
"@vueuse/nuxt": "^10.11.0",
|
"@vueuse/nuxt": "^10.11.0",
|
||||||
|
|||||||
@@ -443,6 +443,7 @@ const sectionRef = ref()
|
|||||||
const demoRef = ref(null)
|
const demoRef = ref(null)
|
||||||
const start = ref(0)
|
const start = ref(0)
|
||||||
|
|
||||||
|
const { $ui } = useNuxtApp()
|
||||||
const { height } = useElementSize(demoRef)
|
const { height } = useElementSize(demoRef)
|
||||||
const { top } = useElementBounding(sectionRef)
|
const { top } = useElementBounding(sectionRef)
|
||||||
const { y } = useWindowScroll()
|
const { y } = useWindowScroll()
|
||||||
|
|||||||
21
package.json
21
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@nuxt/ui",
|
"name": "@nuxt/ui",
|
||||||
"version": "2.18.0",
|
"version": "2.18.4",
|
||||||
"packageManager": "pnpm@9.5.0",
|
"packageManager": "pnpm@9.6.0",
|
||||||
"repository": "nuxt/ui",
|
"repository": "nuxt/ui",
|
||||||
"homepage": "https://ui.nuxt.com",
|
"homepage": "https://ui.nuxt.com",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -36,8 +36,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@headlessui/tailwindcss": "^0.2.1",
|
"@headlessui/tailwindcss": "^0.2.1",
|
||||||
"@headlessui/vue": "^1.7.22",
|
"@headlessui/vue": "^1.7.22",
|
||||||
"@iconify-json/heroicons": "^1.1.22",
|
"@iconify-json/heroicons": "^1.1.23",
|
||||||
"@nuxt/icon": "^1.2.1",
|
"@nuxt/icon": "^1.4.0",
|
||||||
"@nuxt/kit": "^3.12.4",
|
"@nuxt/kit": "^3.12.4",
|
||||||
"@nuxtjs/color-mode": "^3.4.2",
|
"@nuxtjs/color-mode": "^3.4.2",
|
||||||
"@nuxtjs/tailwindcss": "^6.12.1",
|
"@nuxtjs/tailwindcss": "^6.12.1",
|
||||||
@@ -55,12 +55,12 @@
|
|||||||
"pathe": "^1.1.2",
|
"pathe": "^1.1.2",
|
||||||
"scule": "^1.3.0",
|
"scule": "^1.3.0",
|
||||||
"tailwind-merge": "^2.4.0",
|
"tailwind-merge": "^2.4.0",
|
||||||
"tailwindcss": "^3.4.6"
|
"tailwindcss": "^3.4.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nuxt/eslint-config": "^0.3.13",
|
"@nuxt/eslint-config": "^0.4.0",
|
||||||
"@nuxt/module-builder": "^0.8.1",
|
"@nuxt/module-builder": "^0.8.1",
|
||||||
"@nuxt/test-utils": "^3.13.1",
|
"@nuxt/test-utils": "^3.14.0",
|
||||||
"@release-it/conventional-changelog": "^8.0.1",
|
"@release-it/conventional-changelog": "^8.0.1",
|
||||||
"@vue/test-utils": "^2.4.6",
|
"@vue/test-utils": "^2.4.6",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
@@ -72,15 +72,14 @@
|
|||||||
"valibot": "^0.36.0",
|
"valibot": "^0.36.0",
|
||||||
"valibot30": "npm:valibot@0.30.0",
|
"valibot30": "npm:valibot@0.30.0",
|
||||||
"valibot31": "npm:valibot@0.31.0",
|
"valibot31": "npm:valibot@0.31.0",
|
||||||
"vitest": "^2.0.3",
|
"vitest": "^2.0.4",
|
||||||
"vitest-environment-nuxt": "^1.0.0",
|
"vitest-environment-nuxt": "^1.0.0",
|
||||||
"vue-tsc": "^2.0.26",
|
"vue-tsc": "^2.0.29",
|
||||||
"yup": "^1.4.0",
|
"yup": "^1.4.0",
|
||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"@nuxt/ui": "workspace:*",
|
"@nuxt/ui": "workspace:*",
|
||||||
"nuxt-component-meta": "0.6.4",
|
"nuxt-component-meta": "0.6.4"
|
||||||
"vue-tsc": "2.0.26"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4402
pnpm-lock.yaml
generated
4402
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -3,10 +3,8 @@
|
|||||||
"github>nuxt/renovate-config-nuxt"
|
"github>nuxt/renovate-config-nuxt"
|
||||||
],
|
],
|
||||||
"ignoreDeps": [
|
"ignoreDeps": [
|
||||||
"@nuxt/module-builder",
|
|
||||||
"nuxt-component-meta",
|
"nuxt-component-meta",
|
||||||
"valibot30",
|
"valibot30",
|
||||||
"valibot31",
|
"valibot31"
|
||||||
"vue-tsc"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { defineNuxtModule, installModule, addComponentsDir, addImportsDir, creat
|
|||||||
import { name, version } from '../package.json'
|
import { name, version } from '../package.json'
|
||||||
import createTemplates from './templates'
|
import createTemplates from './templates'
|
||||||
import * as config from './runtime/ui.config'
|
import * as config from './runtime/ui.config'
|
||||||
import type { DeepPartial, Strategy } from './runtime/types/utils'
|
import type { DeepPartial, Strategy } from './runtime/types'
|
||||||
import installTailwind from './tailwind'
|
import installTailwind from './tailwind'
|
||||||
|
|
||||||
const _require = createRequire(import.meta.url)
|
const _require = createRequire(import.meta.url)
|
||||||
@@ -86,7 +86,7 @@ export default defineNuxtModule<ModuleOptions>({
|
|||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
|
|
||||||
await installModule('@nuxt/icon', { componentName: 'UIcon' })
|
await installModule('@nuxt/icon')
|
||||||
await installModule('@nuxtjs/color-mode', { classSuffix: '' })
|
await installModule('@nuxtjs/color-mode', { classSuffix: '' })
|
||||||
await installTailwind(options, nuxt, resolve)
|
await installTailwind(options, nuxt, resolve)
|
||||||
|
|
||||||
|
|||||||
@@ -115,10 +115,13 @@ import type { PropType, AriaAttributes } from 'vue'
|
|||||||
import { upperFirst } from 'scule'
|
import { upperFirst } from 'scule'
|
||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
import { useVModel } from '@vueuse/core'
|
import { useVModel } from '@vueuse/core'
|
||||||
import { UIcon, UButton, UProgress, UCheckbox } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
|
import UButton from '../elements/Button.vue'
|
||||||
|
import UProgress from '../elements/Progress.vue'
|
||||||
|
import UCheckbox from '../forms/Checkbox.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig, get } from '../../utils'
|
import { mergeConfig, get } from '../../utils'
|
||||||
import type { Strategy, Button, ProgressColor, ProgressAnimation } from '../../types'
|
import type { Strategy, Button, ProgressColor, ProgressAnimation } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { table } from '#ui/ui.config'
|
import { table } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -69,10 +69,11 @@
|
|||||||
import { ref, computed, toRef, defineComponent, watch } from 'vue'
|
import { ref, computed, toRef, defineComponent, watch } from 'vue'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { Disclosure as HDisclosure, DisclosureButton as HDisclosureButton, DisclosurePanel as HDisclosurePanel, provideUseId } from '@headlessui/vue'
|
import { Disclosure as HDisclosure, DisclosureButton as HDisclosureButton, DisclosurePanel as HDisclosurePanel, provideUseId } from '@headlessui/vue'
|
||||||
import { UIcon, UButton } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
|
import UButton from '../elements/Button.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig, omit } from '../../utils'
|
import { mergeConfig, omit } from '../../utils'
|
||||||
import type { AccordionItem, Strategy } from '../../types'
|
import type { AccordionItem, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { accordion, button } from '#ui/ui.config'
|
import { accordion, button } from '#ui/ui.config'
|
||||||
@@ -193,7 +194,7 @@ export default defineComponent({
|
|||||||
attrs,
|
attrs,
|
||||||
buttonRefs,
|
buttonRefs,
|
||||||
closeOthers,
|
closeOthers,
|
||||||
omit,
|
omit: (omit as any),
|
||||||
onEnter,
|
onEnter,
|
||||||
onBeforeLeave,
|
onBeforeLeave,
|
||||||
onAfterEnter,
|
onAfterEnter,
|
||||||
|
|||||||
@@ -43,9 +43,11 @@
|
|||||||
import { computed, toRef, defineComponent } from 'vue'
|
import { computed, toRef, defineComponent } from 'vue'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { UIcon, UAvatar, UButton } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
|
import UAvatar from '../elements/Avatar.vue'
|
||||||
|
import UButton from '../elements/Button.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import type { Avatar, Button, AlertColor, AlertVariant, AlertAction, Strategy } from '../../types'
|
import type { Avatar, Button, AlertColor, AlertVariant, AlertAction, Strategy } from '../../types/index'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
|
|||||||
@@ -24,10 +24,10 @@
|
|||||||
import { defineComponent, ref, computed, toRef, watch } from 'vue'
|
import { defineComponent, ref, computed, toRef, watch } from 'vue'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { UIcon } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { AvatarSize, AvatarChipColor, AvatarChipPosition, Strategy } from '../../types'
|
import type { AvatarSize, AvatarChipColor, AvatarChipPosition, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { avatar } from '#ui/ui.config'
|
import { avatar } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { twMerge, twJoin } from 'tailwind-merge'
|
|||||||
import UAvatar from './Avatar.vue'
|
import UAvatar from './Avatar.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig, getSlotsChildren } from '../../utils'
|
import { mergeConfig, getSlotsChildren } from '../../utils'
|
||||||
import type { AvatarSize, Strategy } from '../../types'
|
import type { AvatarSize, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { avatar, avatarGroup } from '#ui/ui.config'
|
import { avatar, avatarGroup } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { twMerge, twJoin } from 'tailwind-merge'
|
|||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import { useInjectButtonGroup } from '../../composables/useButtonGroup'
|
import { useInjectButtonGroup } from '../../composables/useButtonGroup'
|
||||||
import type { BadgeColor, BadgeSize, BadgeVariant, Strategy } from '../../types'
|
import type { BadgeColor, BadgeSize, BadgeVariant, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { badge } from '#ui/ui.config'
|
import { badge } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -20,11 +20,12 @@
|
|||||||
import { computed, defineComponent, toRef } from 'vue'
|
import { computed, defineComponent, toRef } from 'vue'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { UIcon, ULink } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
|
import ULink from '../elements/Link.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig, nuxtLinkProps, getNuxtLinkProps } from '../../utils'
|
import { mergeConfig, nuxtLinkProps, getNuxtLinkProps } from '../../utils'
|
||||||
import { useInjectButtonGroup } from '../../composables/useButtonGroup'
|
import { useInjectButtonGroup } from '../../composables/useButtonGroup'
|
||||||
import type { ButtonColor, ButtonSize, ButtonVariant, Strategy } from '../../types'
|
import type { ButtonColor, ButtonSize, ButtonVariant, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { button } from '#ui/ui.config'
|
import { button } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { twMerge, twJoin } from 'tailwind-merge'
|
|||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig, getSlotsChildren } from '../../utils'
|
import { mergeConfig, getSlotsChildren } from '../../utils'
|
||||||
import { useProvideButtonGroup } from '../../composables/useButtonGroup'
|
import { useProvideButtonGroup } from '../../composables/useButtonGroup'
|
||||||
import type { ButtonSize, Strategy } from '../../types'
|
import type { ButtonSize, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { button, buttonGroup } from '#ui/ui.config'
|
import { button, buttonGroup } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ import type { PropType } from 'vue'
|
|||||||
import { twMerge } from 'tailwind-merge'
|
import { twMerge } from 'tailwind-merge'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import UButton from '../elements/Button.vue'
|
import UButton from '../elements/Button.vue'
|
||||||
import type { Strategy, Button } from '../../types'
|
import type { Strategy, Button } from '../../types/index'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { useCarouselScroll } from '../../composables/useCarouselScroll'
|
import { useCarouselScroll } from '../../composables/useCarouselScroll'
|
||||||
import { useScroll, useResizeObserver, useElementSize } from '@vueuse/core'
|
import { useScroll, useResizeObserver, useElementSize } from '@vueuse/core'
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import type { PropType } from 'vue'
|
|||||||
import { twJoin } from 'tailwind-merge'
|
import { twJoin } from 'tailwind-merge'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { ChipSize, ChipColor, ChipPosition, Strategy } from '../../types'
|
import type { ChipSize, ChipColor, ChipPosition, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { chip } from '#ui/ui.config'
|
import { chip } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -61,11 +61,13 @@ import type { PropType } from 'vue'
|
|||||||
import { Menu as HMenu, MenuButton as HMenuButton, MenuItems as HMenuItems, MenuItem as HMenuItem, provideUseId } from '@headlessui/vue'
|
import { Menu as HMenu, MenuButton as HMenuButton, MenuItems as HMenuItems, MenuItem as HMenuItem, provideUseId } from '@headlessui/vue'
|
||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { UIcon, UAvatar, UKbd } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
|
import UAvatar from '../elements/Avatar.vue'
|
||||||
|
import UKbd from '../elements/Kbd.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { usePopper } from '../../composables/usePopper'
|
import { usePopper } from '../../composables/usePopper'
|
||||||
import { mergeConfig, getNuxtLinkProps } from '../../utils'
|
import { mergeConfig, getNuxtLinkProps } from '../../utils'
|
||||||
import type { DropdownItem, PopperOptions, Strategy } from '../../types'
|
import type { DropdownItem, PopperOptions, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { dropdown } from '#ui/ui.config'
|
import { dropdown } from '#ui/ui.config'
|
||||||
|
|||||||
32
src/runtime/components/elements/Icon.vue
Normal file
32
src/runtime/components/elements/Icon.vue
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<template>
|
||||||
|
<Icon v-bind="$props" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent } from 'vue'
|
||||||
|
import type { PropType } from 'vue'
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
props: {
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
mode: {
|
||||||
|
type: String as PropType<'svg' | 'css'>,
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
type: [Number, String],
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
customize: {
|
||||||
|
type: Function,
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -10,7 +10,7 @@ import type { PropType } from 'vue'
|
|||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { KbdSize, Strategy } from '../../types'
|
import type { KbdSize, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { kbd } from '#ui/ui.config'
|
import { kbd } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -31,10 +31,10 @@
|
|||||||
import { computed, defineComponent, toRef } from 'vue'
|
import { computed, defineComponent, toRef } from 'vue'
|
||||||
import type { SlotsType, PropType } from 'vue'
|
import type { SlotsType, PropType } from 'vue'
|
||||||
import { twJoin } from 'tailwind-merge'
|
import { twJoin } from 'tailwind-merge'
|
||||||
import { UIcon } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { Strategy, MeterColor, MeterSize } from '../../types'
|
import type { Strategy, MeterColor, MeterSize } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { meter } from '#ui/ui.config'
|
import { meter } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { h, cloneVNode, computed, toRef, defineComponent } from 'vue'
|
import { h, cloneVNode, computed, toRef, defineComponent } from 'vue'
|
||||||
import type { ComputedRef, VNode, SlotsType, PropType } from 'vue'
|
import type { ComputedRef, VNode, SlotsType, PropType } from 'vue'
|
||||||
import { twJoin } from 'tailwind-merge'
|
import { twJoin } from 'tailwind-merge'
|
||||||
import { UIcon } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
import Meter from './Meter.vue'
|
import Meter from './Meter.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig, getSlotsChildren } from '../../utils'
|
import { mergeConfig, getSlotsChildren } from '../../utils'
|
||||||
import type { Strategy, MeterSize } from '../../types'
|
import type { Strategy, MeterSize } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { meter, meterGroup } from '#ui/ui.config'
|
import { meter, meterGroup } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import type { PropType } from 'vue'
|
|||||||
import { twJoin } from 'tailwind-merge'
|
import { twJoin } from 'tailwind-merge'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { Strategy, ProgressSize, ProgressAnimation, ProgressColor } from '../../types'
|
import type { Strategy, ProgressSize, ProgressAnimation, ProgressColor } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { progress } from '#ui/ui.config'
|
import { progress } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import { twMerge, twJoin } from 'tailwind-merge'
|
|||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { useFormGroup } from '../../composables/useFormGroup'
|
import { useFormGroup } from '../../composables/useFormGroup'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { Strategy } from '../../types'
|
import type { Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { checkbox } from '#ui/ui.config'
|
import { checkbox } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -127,16 +127,13 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onSubmit (payload: Event) {
|
async function onSubmit (payload: Event) {
|
||||||
const event = payload as SubmitEvent
|
const event = payload as FormSubmitEvent<any>
|
||||||
try {
|
try {
|
||||||
if (props.validateOn?.includes('submit')) {
|
if (props.validateOn?.includes('submit')) {
|
||||||
await validate()
|
await validate()
|
||||||
}
|
}
|
||||||
const submitEvent: FormSubmitEvent<any> = {
|
event.data = props.state
|
||||||
...event,
|
emit('submit', event)
|
||||||
data: props.state
|
|
||||||
}
|
|
||||||
emit('submit', submitEvent)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (!(error instanceof FormException)) {
|
if (!(error instanceof FormException)) {
|
||||||
throw error
|
throw error
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import { computed, defineComponent, provide, inject, ref, toRef } from 'vue'
|
|||||||
import type { Ref, PropType } from 'vue'
|
import type { Ref, PropType } from 'vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { FormError, InjectedFormGroupValue, FormGroupSize, Strategy } from '../../types'
|
import type { FormError, InjectedFormGroupValue, FormGroupSize, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { formGroup } from '#ui/ui.config'
|
import { formGroup } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -35,13 +35,13 @@
|
|||||||
import { ref, computed, toRef, onMounted, defineComponent } from 'vue'
|
import { ref, computed, toRef, onMounted, defineComponent } from 'vue'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { UIcon } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { useFormGroup } from '../../composables/useFormGroup'
|
import { useFormGroup } from '../../composables/useFormGroup'
|
||||||
import { mergeConfig, looseToNumber } from '../../utils'
|
import { mergeConfig, looseToNumber } from '../../utils'
|
||||||
import { useInjectButtonGroup } from '../../composables/useButtonGroup'
|
import { useInjectButtonGroup } from '../../composables/useButtonGroup'
|
||||||
import type { InputSize, InputColor, InputVariant, Strategy } from '../../types'
|
import type { InputSize, InputColor, InputVariant, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { input } from '#ui/ui.config'
|
import { input } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -104,13 +104,14 @@ import {
|
|||||||
import { computedAsync, useDebounceFn } from '@vueuse/core'
|
import { computedAsync, useDebounceFn } from '@vueuse/core'
|
||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { UIcon, UAvatar } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
|
import UAvatar from '../elements/Avatar.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { usePopper } from '../../composables/usePopper'
|
import { usePopper } from '../../composables/usePopper'
|
||||||
import { useFormGroup } from '../../composables/useFormGroup'
|
import { useFormGroup } from '../../composables/useFormGroup'
|
||||||
import { get, mergeConfig } from '../../utils'
|
import { get, mergeConfig } from '../../utils'
|
||||||
import { useInjectButtonGroup } from '../../composables/useButtonGroup'
|
import { useInjectButtonGroup } from '../../composables/useButtonGroup'
|
||||||
import type { InputSize, InputColor, InputVariant, PopperOptions, Strategy } from '../../types'
|
import type { InputSize, InputColor, InputVariant, PopperOptions, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { input, inputMenu } from '#ui/ui.config'
|
import { input, inputMenu } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import { twMerge, twJoin } from 'tailwind-merge'
|
|||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { useFormGroup } from '../../composables/useFormGroup'
|
import { useFormGroup } from '../../composables/useFormGroup'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { Strategy } from '../../types'
|
import type { Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { radio } from '#ui/ui.config'
|
import { radio } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import type { PropType } from 'vue'
|
|||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { useFormGroup } from '../../composables/useFormGroup'
|
import { useFormGroup } from '../../composables/useFormGroup'
|
||||||
import { mergeConfig, get } from '../../utils'
|
import { mergeConfig, get } from '../../utils'
|
||||||
import type { Strategy } from '../../types'
|
import type { Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { radioGroup, radio } from '#ui/ui.config'
|
import { radioGroup, radio } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import { twMerge, twJoin } from 'tailwind-merge'
|
|||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { useFormGroup } from '../../composables/useFormGroup'
|
import { useFormGroup } from '../../composables/useFormGroup'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { RangeSize, RangeColor, Strategy } from '../../types'
|
import type { RangeSize, RangeColor, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { range } from '#ui/ui.config'
|
import { range } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -56,12 +56,12 @@
|
|||||||
import { computed, toRef, defineComponent } from 'vue'
|
import { computed, toRef, defineComponent } from 'vue'
|
||||||
import type { PropType, ComputedRef } from 'vue'
|
import type { PropType, ComputedRef } from 'vue'
|
||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { UIcon } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { useFormGroup } from '../../composables/useFormGroup'
|
import { useFormGroup } from '../../composables/useFormGroup'
|
||||||
import { mergeConfig, get } from '../../utils'
|
import { mergeConfig, get } from '../../utils'
|
||||||
import { useInjectButtonGroup } from '../../composables/useButtonGroup'
|
import { useInjectButtonGroup } from '../../composables/useButtonGroup'
|
||||||
import type { SelectSize, SelectColor, SelectVariant, Strategy } from '../../types'
|
import type { SelectSize, SelectColor, SelectVariant, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { select } from '#ui/ui.config'
|
import { select } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -140,13 +140,14 @@ import {
|
|||||||
import { computedAsync, useDebounceFn } from '@vueuse/core'
|
import { computedAsync, useDebounceFn } from '@vueuse/core'
|
||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { UIcon, UAvatar } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
|
import UAvatar from '../elements/Avatar.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { usePopper } from '../../composables/usePopper'
|
import { usePopper } from '../../composables/usePopper'
|
||||||
import { useFormGroup } from '../../composables/useFormGroup'
|
import { useFormGroup } from '../../composables/useFormGroup'
|
||||||
import { get, mergeConfig } from '../../utils'
|
import { get, mergeConfig } from '../../utils'
|
||||||
import { useInjectButtonGroup } from '../../composables/useButtonGroup'
|
import { useInjectButtonGroup } from '../../composables/useButtonGroup'
|
||||||
import type { SelectSize, SelectColor, SelectVariant, PopperOptions, Strategy } from '../../types'
|
import type { SelectSize, SelectColor, SelectVariant, PopperOptions, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { select, selectMenu } from '#ui/ui.config'
|
import { select, selectMenu } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import { defu } from 'defu'
|
|||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { useFormGroup } from '../../composables/useFormGroup'
|
import { useFormGroup } from '../../composables/useFormGroup'
|
||||||
import { mergeConfig, looseToNumber } from '../../utils'
|
import { mergeConfig, looseToNumber } from '../../utils'
|
||||||
import type { TextareaSize, TextareaColor, TextareaVariant, Strategy } from '../../types'
|
import type { TextareaSize, TextareaColor, TextareaVariant, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { textarea } from '#ui/ui.config'
|
import { textarea } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ import { computed, toRef, defineComponent } from 'vue'
|
|||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { Switch as HSwitch, provideUseId } from '@headlessui/vue'
|
import { Switch as HSwitch, provideUseId } from '@headlessui/vue'
|
||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { UIcon } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { useFormGroup } from '../../composables/useFormGroup'
|
import { useFormGroup } from '../../composables/useFormGroup'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { ToggleSize, ToggleColor, Strategy } from '../../types'
|
import type { ToggleSize, ToggleColor, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { toggle } from '#ui/ui.config'
|
import { toggle } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import type { PropType } from 'vue'
|
|||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { Strategy } from '../../types'
|
import type { Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { card } from '#ui/ui.config'
|
import { card } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import type { PropType } from 'vue'
|
|||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { Strategy } from '../../types'
|
import type { Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { container } from '#ui/ui.config'
|
import { container } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -22,10 +22,11 @@
|
|||||||
import { toRef, computed, defineComponent } from 'vue'
|
import { toRef, computed, defineComponent } from 'vue'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { UIcon, UAvatar } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
|
import UAvatar from '../elements/Avatar.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { Avatar, DividerSize, Strategy } from '../../types'
|
import type { Avatar, DividerSize, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { divider } from '#ui/ui.config'
|
import { divider } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import type { PropType } from 'vue'
|
|||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { Strategy } from '../../types'
|
import type { Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { skeleton } from '#ui/ui.config'
|
import { skeleton } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -37,10 +37,11 @@
|
|||||||
import { defineComponent, toRef } from 'vue'
|
import { defineComponent, toRef } from 'vue'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { UIcon, ULink } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
|
import ULink from '../elements/Link.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig, getULinkProps } from '../../utils'
|
import { mergeConfig, getULinkProps } from '../../utils'
|
||||||
import type { BreadcrumbLink, Strategy } from '../../types'
|
import type { BreadcrumbLink, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { breadcrumb } from '#ui/ui.config'
|
import { breadcrumb } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -70,11 +70,12 @@ import { useFuse } from '@vueuse/integrations/useFuse'
|
|||||||
import type { UseFuseOptions } from '@vueuse/integrations/useFuse'
|
import type { UseFuseOptions } from '@vueuse/integrations/useFuse'
|
||||||
import { twJoin } from 'tailwind-merge'
|
import { twJoin } from 'tailwind-merge'
|
||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
import { UIcon, UButton } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
|
import UButton from '../elements/Button.vue'
|
||||||
import CommandPaletteGroup from './CommandPaletteGroup.vue'
|
import CommandPaletteGroup from './CommandPaletteGroup.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { Group, Command, Button, Strategy } from '../../types'
|
import type { Group, Command, Button, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { commandPalette } from '#ui/ui.config'
|
import { commandPalette } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -73,8 +73,10 @@
|
|||||||
import { computed, defineComponent } from 'vue'
|
import { computed, defineComponent } from 'vue'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { ComboboxOption as HComboboxOption, provideUseId } from '@headlessui/vue'
|
import { ComboboxOption as HComboboxOption, provideUseId } from '@headlessui/vue'
|
||||||
import { UIcon, UAvatar, UKbd } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
import type { Command, Group } from '../../types'
|
import UAvatar from '../elements/Avatar.vue'
|
||||||
|
import UKbd from '../elements/Kbd.vue'
|
||||||
|
import type { Command, Group } from '../../types/index'
|
||||||
import { commandPalette } from '#ui/ui.config'
|
import { commandPalette } from '#ui/ui.config'
|
||||||
import { useId } from '#imports'
|
import { useId } from '#imports'
|
||||||
|
|
||||||
|
|||||||
@@ -55,10 +55,13 @@
|
|||||||
import { toRef, defineComponent, computed } from 'vue'
|
import { toRef, defineComponent, computed } from 'vue'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { UIcon, UAvatar, UBadge, ULink } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
|
import UAvatar from '../elements/Avatar.vue'
|
||||||
|
import UBadge from '../elements/Badge.vue'
|
||||||
|
import ULink from '../elements/Link.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig, getULinkProps } from '../../utils'
|
import { mergeConfig, getULinkProps } from '../../utils'
|
||||||
import type { HorizontalNavigationLink, Strategy } from '../../types'
|
import type { HorizontalNavigationLink, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { horizontalNavigation } from '#ui/ui.config'
|
import { horizontalNavigation } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ import type { RouteLocationRaw } from '#vue-router'
|
|||||||
import UButton from '../elements/Button.vue'
|
import UButton from '../elements/Button.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { Button, ButtonSize, Strategy } from '../../types'
|
import type { Button, ButtonSize, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { pagination, button } from '#ui/ui.config'
|
import { pagination, button } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -53,13 +53,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { toRef, ref, watch, onMounted, defineComponent } from 'vue'
|
import { toRef, ref, watch, onMounted, defineComponent, nextTick } from 'vue'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { TabGroup as HTabGroup, TabList as HTabList, Tab as HTab, TabPanels as HTabPanels, TabPanel as HTabPanel, provideUseId } from '@headlessui/vue'
|
import { TabGroup as HTabGroup, TabList as HTabList, Tab as HTab, TabPanels as HTabPanels, TabPanel as HTabPanel, provideUseId } from '@headlessui/vue'
|
||||||
import { useResizeObserver } from '@vueuse/core'
|
import { useResizeObserver } from '@vueuse/core'
|
||||||
|
import UIcon from '../elements/Icon.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { TabItem, Strategy } from '../../types'
|
import type { TabItem, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { tabs } from '#ui/ui.config'
|
import { tabs } from '#ui/ui.config'
|
||||||
@@ -69,6 +70,7 @@ const config = mergeConfig<typeof tabs>(appConfig.ui.strategy, appConfig.ui.tabs
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
|
UIcon,
|
||||||
HTabGroup,
|
HTabGroup,
|
||||||
HTabList,
|
HTabList,
|
||||||
HTab,
|
HTab,
|
||||||
@@ -162,7 +164,10 @@ export default defineComponent({
|
|||||||
calcMarkerSize(selectedIndex.value)
|
calcMarkerSize(selectedIndex.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => calcMarkerSize(selectedIndex.value))
|
onMounted(async () => {
|
||||||
|
await nextTick()
|
||||||
|
calcMarkerSize(selectedIndex.value)
|
||||||
|
})
|
||||||
|
|
||||||
provideUseId(() => useId())
|
provideUseId(() => useId())
|
||||||
|
|
||||||
|
|||||||
@@ -56,10 +56,14 @@
|
|||||||
import { toRef, defineComponent, computed } from 'vue'
|
import { toRef, defineComponent, computed } from 'vue'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { UIcon, UAvatar, UBadge, ULink, UDivider } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
|
import UAvatar from '../elements/Avatar.vue'
|
||||||
|
import UBadge from '../elements/Badge.vue'
|
||||||
|
import ULink from '../elements/Link.vue'
|
||||||
|
import UDivider from '../layout/Divider.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig, getULinkProps } from '../../utils'
|
import { mergeConfig, getULinkProps } from '../../utils'
|
||||||
import type { VerticalNavigationLink, Strategy } from '../../types'
|
import type { VerticalNavigationLink, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { verticalNavigation } from '#ui/ui.config'
|
import { verticalNavigation } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { twMerge, twJoin } from 'tailwind-merge'
|
|||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { usePopper } from '../../composables/usePopper'
|
import { usePopper } from '../../composables/usePopper'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { PopperOptions, Strategy } from '../../types'
|
import type { PopperOptions, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { contextMenu } from '#ui/ui.config'
|
import { contextMenu } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import type { PropType } from 'vue'
|
|||||||
import { Dialog as HDialog, DialogPanel as HDialogPanel, TransitionRoot, TransitionChild, provideUseId } from '@headlessui/vue'
|
import { Dialog as HDialog, DialogPanel as HDialogPanel, TransitionRoot, TransitionChild, provideUseId } from '@headlessui/vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { Strategy } from '../../types'
|
import type { Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { modal } from '#ui/ui.config'
|
import { modal } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -46,11 +46,13 @@
|
|||||||
import { ref, computed, toRef, onMounted, onUnmounted, watch, watchEffect, defineComponent } from 'vue'
|
import { ref, computed, toRef, onMounted, onUnmounted, watch, watchEffect, defineComponent } from 'vue'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { twMerge, twJoin } from 'tailwind-merge'
|
import { twMerge, twJoin } from 'tailwind-merge'
|
||||||
import { UIcon, UAvatar, UButton } from '#components'
|
import UIcon from '../elements/Icon.vue'
|
||||||
|
import UAvatar from '../elements/Avatar.vue'
|
||||||
|
import UButton from '../elements/Button.vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { useTimer } from '../../composables/useTimer'
|
import { useTimer } from '../../composables/useTimer'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { Avatar, Button, NotificationColor, NotificationAction, Strategy } from '../../types'
|
import type { Avatar, Button, NotificationColor, NotificationAction, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { notification } from '#ui/ui.config'
|
import { notification } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import UNotification from './Notification.vue'
|
|||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { useToast } from '../../composables/useToast'
|
import { useToast } from '../../composables/useToast'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { Notification, Strategy } from '../../types'
|
import type { Notification, Strategy } from '../../types/index'
|
||||||
import { useState } from '#imports'
|
import { useState } from '#imports'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import { Popover as HPopover, PopoverButton as HPopoverButton, PopoverPanel as H
|
|||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { usePopper } from '../../composables/usePopper'
|
import { usePopper } from '../../composables/usePopper'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { PopperOptions, Strategy } from '../../types'
|
import type { PopperOptions, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { popover } from '#ui/ui.config'
|
import { popover } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import type { WritableComputedRef, PropType } from 'vue'
|
|||||||
import { Dialog as HDialog, DialogPanel as HDialogPanel, TransitionRoot, TransitionChild, provideUseId } from '@headlessui/vue'
|
import { Dialog as HDialog, DialogPanel as HDialogPanel, TransitionRoot, TransitionChild, provideUseId } from '@headlessui/vue'
|
||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { Strategy } from '../../types'
|
import type { Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { slideover } from '#ui/ui.config'
|
import { slideover } from '#ui/ui.config'
|
||||||
@@ -165,4 +165,4 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import UKbd from '../elements/Kbd.vue'
|
|||||||
import { useUI } from '../../composables/useUI'
|
import { useUI } from '../../composables/useUI'
|
||||||
import { usePopper } from '../../composables/usePopper'
|
import { usePopper } from '../../composables/usePopper'
|
||||||
import { mergeConfig } from '../../utils'
|
import { mergeConfig } from '../../utils'
|
||||||
import type { PopperOptions, Strategy } from '../../types'
|
import type { PopperOptions, Strategy } from '../../types/index'
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import appConfig from '#build/app.config'
|
import appConfig from '#build/app.config'
|
||||||
import { tooltip } from '#ui/ui.config'
|
import { tooltip } from '#ui/ui.config'
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
import { inject, ref, computed } from 'vue'
|
import { inject, ref, computed } from 'vue'
|
||||||
import { type UseEventBusReturn, useDebounceFn } from '@vueuse/core'
|
import { type UseEventBusReturn, useDebounceFn } from '@vueuse/core'
|
||||||
import type { FormEvent, FormEventType, InjectedFormGroupValue } from '../types/form'
|
import type { FormEvent, FormEventType, InjectedFormGroupValue } from '../types/form'
|
||||||
import { mergeConfig } from '../utils'
|
|
||||||
// @ts-expect-error
|
|
||||||
import appConfig from '#build/app.config'
|
|
||||||
import { formGroup } from '#ui/ui.config'
|
|
||||||
|
|
||||||
type InputProps = {
|
type InputProps = {
|
||||||
id?: string
|
id?: string
|
||||||
@@ -16,8 +12,6 @@ type InputProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const formGroupConfig = mergeConfig<typeof formGroup>(appConfig.ui.strategy, appConfig.ui.formGroup, formGroup)
|
|
||||||
|
|
||||||
export const useFormGroup = (inputProps?: InputProps, config?: any) => {
|
export const useFormGroup = (inputProps?: InputProps, config?: any) => {
|
||||||
const formBus = inject<UseEventBusReturn<FormEvent, string> | undefined>('form-events', undefined)
|
const formBus = inject<UseEventBusReturn<FormEvent, string> | undefined>('form-events', undefined)
|
||||||
const formGroup = inject<InjectedFormGroupValue | undefined>('form-group', undefined)
|
const formGroup = inject<InjectedFormGroupValue | undefined>('form-group', undefined)
|
||||||
@@ -62,7 +56,7 @@ export const useFormGroup = (inputProps?: InputProps, config?: any) => {
|
|||||||
name: computed(() => inputProps?.name ?? formGroup?.name.value),
|
name: computed(() => inputProps?.name ?? formGroup?.name.value),
|
||||||
size: computed(() => {
|
size: computed(() => {
|
||||||
const formGroupSize = config.size[formGroup?.size.value as string] ? formGroup?.size.value : null
|
const formGroupSize = config.size[formGroup?.size.value as string] ? formGroup?.size.value : null
|
||||||
return inputProps?.size ?? formGroupSize ?? formGroupConfig?.default?.size
|
return inputProps?.size ?? formGroupSize ?? config.default?.size
|
||||||
}),
|
}),
|
||||||
color: computed(() => formGroup?.error?.value ? 'red' : inputProps?.color),
|
color: computed(() => formGroup?.error?.value ? 'red' : inputProps?.color),
|
||||||
emitFormBlur,
|
emitFormBlur,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { computed, toValue, useAttrs } from 'vue'
|
|||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import { useAppConfig } from '#imports'
|
import { useAppConfig } from '#imports'
|
||||||
import { mergeConfig, omit, get } from '../utils'
|
import { mergeConfig, omit, get } from '../utils'
|
||||||
import type { Strategy } from '../types'
|
import type { Strategy } from '../types/index'
|
||||||
|
|
||||||
export const useUI = <T>(key, $ui?: Ref<Partial<T> & { strategy?: Strategy } | undefined>, $config?: Ref<T> | T, $wrapperClass?: Ref<string>, withAppConfig: boolean = false) => {
|
export const useUI = <T>(key, $ui?: Ref<Partial<T> & { strategy?: Strategy } | undefined>, $config?: Ref<T> | T, $wrapperClass?: Ref<string>, withAppConfig: boolean = false) => {
|
||||||
const $attrs = useAttrs()
|
const $attrs = useAttrs()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { hexToRgb } from '../utils'
|
import { get, hexToRgb } from '../utils'
|
||||||
import { defineNuxtPlugin, useAppConfig, useNuxtApp, useHead } from '#imports'
|
import { defineNuxtPlugin, useAppConfig, useNuxtApp, useHead } from '#imports'
|
||||||
import colors from '#tailwind-config/theme/colors'
|
import colors from '#tailwind-config/theme/colors'
|
||||||
|
|
||||||
@@ -8,8 +8,8 @@ export default defineNuxtPlugin(() => {
|
|||||||
const nuxtApp = useNuxtApp()
|
const nuxtApp = useNuxtApp()
|
||||||
|
|
||||||
const root = computed(() => {
|
const root = computed(() => {
|
||||||
const primary: Record<string, string> | undefined = colors[appConfig.ui.primary]
|
const primary: Record<string, string> | undefined = get(colors, appConfig.ui.primary)
|
||||||
const gray: Record<string, string> | undefined = colors[appConfig.ui.gray]
|
const gray: Record<string, string> | undefined = get(colors, appConfig.ui.gray)
|
||||||
|
|
||||||
if (!primary) {
|
if (!primary) {
|
||||||
console.warn(`[@nuxt/ui] Primary color '${appConfig.ui.primary}' not found in Tailwind config`)
|
console.warn(`[@nuxt/ui] Primary color '${appConfig.ui.primary}' not found in Tailwind config`)
|
||||||
|
|||||||
@@ -8,5 +8,5 @@ export type AlertColor = keyof typeof alert.color | ExtractDeepKey<AppConfig, ['
|
|||||||
export type AlertVariant = keyof typeof alert.variant | ExtractDeepKey<AppConfig, ['ui', 'alert', 'variant']> | NestedKeyOf<typeof alert.color> | NestedKeyOf<ExtractDeepObject<AppConfig, ['ui', 'alert', 'color']>>
|
export type AlertVariant = keyof typeof alert.variant | ExtractDeepKey<AppConfig, ['ui', 'alert', 'variant']> | NestedKeyOf<typeof alert.color> | NestedKeyOf<ExtractDeepObject<AppConfig, ['ui', 'alert', 'color']>>
|
||||||
|
|
||||||
export interface AlertAction extends Button {
|
export interface AlertAction extends Button {
|
||||||
click?: Function
|
click?: (...args: any[]) => void
|
||||||
}
|
}
|
||||||
@@ -22,8 +22,8 @@ export interface Group {
|
|||||||
active?: string
|
active?: string
|
||||||
inactive?: string
|
inactive?: string
|
||||||
commands?: Command[]
|
commands?: Command[]
|
||||||
search?: Function
|
search?: (...args: any[]) => any[] | Promise<any[]>
|
||||||
filter?: Function
|
filter?: (...args: any[]) => Command[]
|
||||||
static?: Boolean
|
static?: Boolean
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
@@ -11,5 +11,5 @@ export interface DropdownItem extends NuxtLinkProps {
|
|||||||
shortcuts?: string[]
|
shortcuts?: string[]
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
class?: string
|
class?: string
|
||||||
click?: Function
|
click?: (...args: any[]) => void
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,6 @@ export interface HorizontalNavigationLink extends Link {
|
|||||||
icon?: string
|
icon?: string
|
||||||
iconClass?: string
|
iconClass?: string
|
||||||
avatar?: Avatar
|
avatar?: Avatar
|
||||||
click?: Function
|
click?: (...args: any[]) => void
|
||||||
badge?: string | number | Badge
|
badge?: string | number | Badge
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ import colors from '#ui-colors'
|
|||||||
export type NotificationColor = 'gray' | typeof colors[number]
|
export type NotificationColor = 'gray' | typeof colors[number]
|
||||||
|
|
||||||
export interface NotificationAction extends Button {
|
export interface NotificationAction extends Button {
|
||||||
click?: Function
|
click?: (...args: any[]) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Notification {
|
export interface Notification {
|
||||||
@@ -17,8 +17,8 @@ export interface Notification {
|
|||||||
closeButton?: Button
|
closeButton?: Button
|
||||||
timeout: number
|
timeout: number
|
||||||
actions?: NotificationAction[]
|
actions?: NotificationAction[]
|
||||||
click?: Function
|
click?: (...args: any[]) => void
|
||||||
callback?: Function
|
callback?: (...args: any[]) => void
|
||||||
color?: NotificationColor
|
color?: NotificationColor
|
||||||
ui?: any
|
ui?: any
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,6 @@ export interface VerticalNavigationLink extends Link {
|
|||||||
icon?: string
|
icon?: string
|
||||||
iconClass?: string
|
iconClass?: string
|
||||||
avatar?: Avatar
|
avatar?: Avatar
|
||||||
click?: Function
|
click?: (...args: any[]) => void
|
||||||
badge?: string | number | Badge
|
badge?: string | number | Badge
|
||||||
}
|
}
|
||||||
@@ -19,193 +19,193 @@ const colorsToExclude = [
|
|||||||
|
|
||||||
const safelistByComponent: Record<string, (colors: string) => TWConfig['safelist']> = {
|
const safelistByComponent: Record<string, (colors: string) => TWConfig['safelist']> = {
|
||||||
alert: (colorsAsRegex) => [{
|
alert: (colorsAsRegex) => [{
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-50`)
|
pattern: RegExp(`^bg-(${colorsAsRegex})-50$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^bg-(${colorsAsRegex})-500$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^text-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^text-(${colorsAsRegex})-500$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^ring-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^ring-(${colorsAsRegex})-500$`)
|
||||||
}],
|
}],
|
||||||
avatar: (colorsAsRegex) => [{
|
avatar: (colorsAsRegex) => [{
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^bg-(${colorsAsRegex})-500$`)
|
||||||
}],
|
}],
|
||||||
badge: (colorsAsRegex) => [{
|
badge: (colorsAsRegex) => [{
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-50`)
|
pattern: RegExp(`^bg-(${colorsAsRegex})-50$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^bg-(${colorsAsRegex})-500$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^text-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^text-(${colorsAsRegex})-500$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^ring-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^ring-(${colorsAsRegex})-500$`)
|
||||||
}],
|
}],
|
||||||
button: (colorsAsRegex) => [{
|
button: (colorsAsRegex) => [{
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-50`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-50$`),
|
||||||
variants: ['hover', 'disabled']
|
variants: ['hover', 'disabled']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-100`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-100$`),
|
||||||
variants: ['hover']
|
variants: ['hover']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark', 'dark:disabled']
|
variants: ['dark', 'dark:disabled']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-500`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-500$`),
|
||||||
variants: ['disabled', 'dark:hover']
|
variants: ['disabled', 'dark:hover']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-600`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-600$`),
|
||||||
variants: ['hover']
|
variants: ['hover']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-900`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-900$`),
|
||||||
variants: ['dark:hover']
|
variants: ['dark:hover']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-950`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-950$`),
|
||||||
variants: ['dark', 'dark:hover', 'dark:disabled']
|
variants: ['dark', 'dark:hover', 'dark:disabled']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^text-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark', 'dark:disabled']
|
variants: ['dark', 'dark:disabled']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-500`),
|
pattern: RegExp(`^text-(${colorsAsRegex})-500$`),
|
||||||
variants: ['dark:hover', 'disabled']
|
variants: ['dark:hover', 'disabled']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-600`),
|
pattern: RegExp(`^text-(${colorsAsRegex})-600$`),
|
||||||
variants: ['hover']
|
variants: ['hover']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`outline-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^outline-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark:focus-visible']
|
variants: ['dark:focus-visible']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`outline-(${colorsAsRegex})-500`),
|
pattern: RegExp(`^outline-(${colorsAsRegex})-500$`),
|
||||||
variants: ['focus-visible']
|
variants: ['focus-visible']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^ring-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark:focus-visible']
|
variants: ['dark:focus-visible']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-500`),
|
pattern: RegExp(`^ring-(${colorsAsRegex})-500$`),
|
||||||
variants: ['focus-visible']
|
variants: ['focus-visible']
|
||||||
}],
|
}],
|
||||||
input: (colorsAsRegex) => [{
|
input: (colorsAsRegex) => [{
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^text-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^text-(${colorsAsRegex})-500$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^ring-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark', 'dark:focus']
|
variants: ['dark', 'dark:focus']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-500`),
|
pattern: RegExp(`^ring-(${colorsAsRegex})-500$`),
|
||||||
variants: ['focus']
|
variants: ['focus']
|
||||||
}],
|
}],
|
||||||
radio: (colorsAsRegex) => [{
|
radio: (colorsAsRegex) => [{
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^text-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^text-(${colorsAsRegex})-500$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^ring-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark:focus-visible']
|
variants: ['dark:focus-visible']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-500`),
|
pattern: RegExp(`^ring-(${colorsAsRegex})-500$`),
|
||||||
variants: ['focus-visible']
|
variants: ['focus-visible']
|
||||||
}],
|
}],
|
||||||
checkbox: (colorsAsRegex) => [{
|
checkbox: (colorsAsRegex) => [{
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^text-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^text-(${colorsAsRegex})-500$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^ring-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark:focus-visible']
|
variants: ['dark:focus-visible']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-500`),
|
pattern: RegExp(`^ring-(${colorsAsRegex})-500$`),
|
||||||
variants: ['focus-visible']
|
variants: ['focus-visible']
|
||||||
}],
|
}],
|
||||||
toggle: (colorsAsRegex) => [{
|
toggle: (colorsAsRegex) => [{
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^bg-(${colorsAsRegex})-500$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^text-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^text-(${colorsAsRegex})-500$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^ring-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark:focus-visible']
|
variants: ['dark:focus-visible']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-500`),
|
pattern: RegExp(`^ring-(${colorsAsRegex})-500$`),
|
||||||
variants: ['focus-visible']
|
variants: ['focus-visible']
|
||||||
}],
|
}],
|
||||||
range: (colorsAsRegex) => [{
|
range: (colorsAsRegex) => [{
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^bg-(${colorsAsRegex})-500$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^text-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^text-(${colorsAsRegex})-500$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^ring-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark:focus-visible']
|
variants: ['dark:focus-visible']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`ring-(${colorsAsRegex})-500`),
|
pattern: RegExp(`^ring-(${colorsAsRegex})-500$`),
|
||||||
variants: ['focus-visible']
|
variants: ['focus-visible']
|
||||||
}],
|
}],
|
||||||
progress: (colorsAsRegex) => [{
|
progress: (colorsAsRegex) => [{
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^text-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^text-(${colorsAsRegex})-500$`)
|
||||||
}],
|
}],
|
||||||
meter: (colorsAsRegex) => [{
|
meter: (colorsAsRegex) => [{
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^bg-(${colorsAsRegex})-500$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^text-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^text-(${colorsAsRegex})-500$`)
|
||||||
}],
|
}],
|
||||||
notification: (colorsAsRegex) => [{
|
notification: (colorsAsRegex) => [{
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^bg-(${colorsAsRegex})-500$`)
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^text-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`text-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^text-(${colorsAsRegex})-500$`)
|
||||||
}],
|
}],
|
||||||
chip: (colorsAsRegex) => [{
|
chip: (colorsAsRegex) => [{
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-400`),
|
pattern: RegExp(`^bg-(${colorsAsRegex})-400$`),
|
||||||
variants: ['dark']
|
variants: ['dark']
|
||||||
}, {
|
}, {
|
||||||
pattern: new RegExp(`bg-(${colorsAsRegex})-500`)
|
pattern: RegExp(`^bg-(${colorsAsRegex})-500$`)
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,7 +324,15 @@ export const customSafelistExtractor = (prefix: string, content: string, colors:
|
|||||||
|
|
||||||
return matches.map(match => {
|
return matches.map(match => {
|
||||||
const colorOptions = match.substring(1, match.length - 1).split('|')
|
const colorOptions = match.substring(1, match.length - 1).split('|')
|
||||||
return colorOptions.map(color => `${variant ? variant + ':' : ''}` + group.pattern.source.replace(match, color))
|
return colorOptions.map(
|
||||||
|
color => {
|
||||||
|
const classesExtracted = group.pattern.source.replace(match, color).replace('^', '').replace('$', '')
|
||||||
|
if (variant) {
|
||||||
|
return `${variant}:${classesExtracted}`
|
||||||
|
}
|
||||||
|
return classesExtracted
|
||||||
|
}
|
||||||
|
)
|
||||||
}).flat()
|
}).flat()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { defu, createDefu } from 'defu'
|
import { defu, createDefu } from 'defu'
|
||||||
import { extendTailwindMerge } from 'tailwind-merge'
|
import { extendTailwindMerge } from 'tailwind-merge'
|
||||||
import type { Strategy } from '../types'
|
import type { Strategy } from '../types/index'
|
||||||
|
|
||||||
const customTwMerge = extendTailwindMerge<string, string>({
|
const customTwMerge = extendTailwindMerge<string, string>({
|
||||||
extend: {
|
extend: {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export const nuxtLinkProps = {
|
|||||||
required: false
|
required: false
|
||||||
},
|
},
|
||||||
rel: {
|
rel: {
|
||||||
type: String as PropType<NuxtLinkProps['rel']>,
|
type: String as PropType<any>,
|
||||||
default: undefined,
|
default: undefined,
|
||||||
required: false
|
required: false
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -24,17 +24,17 @@ describe('generateSafelist', () => {
|
|||||||
[
|
[
|
||||||
'default safelist',
|
'default safelist',
|
||||||
{}, [],
|
{}, [],
|
||||||
['bg-(primary)-50', 'bg-(red)-500'] // these both should be in the safelist
|
['^bg-(primary)-50$', '^bg-(red)-500$'] // these both should be in the safelist
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'safelisting single new color',
|
'safelisting single new color',
|
||||||
{}, ['myColor'],
|
{}, ['myColor'],
|
||||||
'bg-(myColor|primary)-50'
|
'^bg-(myColor|primary)-50$'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'reducing amount of theme colors',
|
'reducing amount of theme colors',
|
||||||
{ theme: { colors: { plainBlue: '#00F' } } }, ['plainBlue'],
|
{ theme: { colors: { plainBlue: '#00F' } } }, ['plainBlue'],
|
||||||
['bg-(plainBlue|primary)-50', '!', /orange/] // the word "orange" should _not_ be found in any safelist pattern
|
['^bg-(plainBlue|primary)-50$', '!', /orange/] // the word "orange" should _not_ be found in any safelist pattern
|
||||||
]
|
]
|
||||||
])('%s', async (_description, tailwindConfig: Partial<TWConfig>, safelistColors, safelistPatterns) => {
|
])('%s', async (_description, tailwindConfig: Partial<TWConfig>, safelistColors, safelistPatterns) => {
|
||||||
safelistColors.push('primary')
|
safelistColors.push('primary')
|
||||||
|
|||||||
Reference in New Issue
Block a user