@una-ui/nuxt 0.1.1-beta.1 → 0.2.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +24 -13
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +15 -5
  4. package/dist/runtime/components/elements/Avatar.vue +1 -0
  5. package/dist/runtime/components/elements/Badge.vue +7 -2
  6. package/dist/runtime/components/elements/Button.vue +9 -6
  7. package/dist/runtime/components/elements/Kbd.vue +25 -0
  8. package/dist/runtime/components/elements/Link.vue +66 -0
  9. package/dist/runtime/components/elements/Link.vue.d.ts +9 -0
  10. package/dist/runtime/components/forms/FormGroup.vue +13 -11
  11. package/dist/runtime/components/forms/Radio.vue +91 -0
  12. package/dist/runtime/components/navigation/NavLink.vue +54 -0
  13. package/dist/runtime/components/navigation/NavLinkGroup.vue +61 -0
  14. package/dist/runtime/components/slots/FormGroupDefault.mjs +2 -1
  15. package/dist/runtime/components/slots/FormGroupLabel.d.ts +23 -0
  16. package/dist/runtime/components/slots/FormGroupLabel.mjs +29 -0
  17. package/dist/runtime/types/accordion.d.ts +1 -1
  18. package/dist/runtime/types/alert.d.ts +1 -1
  19. package/dist/runtime/types/avatar.d.ts +1 -1
  20. package/dist/runtime/types/badge.d.ts +1 -0
  21. package/dist/runtime/types/button.d.ts +1 -0
  22. package/dist/runtime/types/form-group.d.ts +15 -5
  23. package/dist/runtime/types/icon.d.ts +1 -1
  24. package/dist/runtime/types/index.d.ts +5 -0
  25. package/dist/runtime/types/index.mjs +5 -0
  26. package/dist/runtime/types/kbd.d.ts +26 -0
  27. package/dist/runtime/types/kbd.mjs +0 -0
  28. package/dist/runtime/types/link.d.ts +26 -0
  29. package/dist/runtime/types/link.mjs +0 -0
  30. package/dist/runtime/types/nav-link-group.d.ts +8 -0
  31. package/dist/runtime/types/nav-link-group.mjs +0 -0
  32. package/dist/runtime/types/nav-link.d.ts +5 -0
  33. package/dist/runtime/types/nav-link.mjs +0 -0
  34. package/dist/runtime/types/radio.d.ts +90 -0
  35. package/dist/runtime/types/radio.mjs +0 -0
  36. package/package.json +18 -18
package/README.md CHANGED
@@ -1,22 +1,33 @@
1
- # 🌼 Una-UI
1
+ # Una UI
2
2
 
3
- > **Warning**: This project is heavily working in progress.
3
+ > **Warning**: This project is heavily working in progress.
4
4
 
5
- ## 📌 Todo
5
+ ## 🏗️ Release Status
6
6
 
7
- - [ ] Playground
8
- - [ ] Docs
9
- - [ ] Style Presets
10
- - [ ] UI-Components
11
- - [ ] Nuxt 3 modules
7
+ | Branch | Version | Status | Downloads |
8
+ | --- | --- | --- | --- |
9
+ | Main (Edge) | [![npm-edge][npm-edge-src]][npm-edge-href] | [![github-status][github-status-src-main]][github-status-href-main] | [![npm-edge-downloads][npm-edge-downloads-src]][npm-edge-downloads-href] |
10
+ | Release | [![npm-version][npm-version-src]][npm-version-href] | [![github-status][github-status-src-release]][github-status-href-release] | [![npm-downloads][npm-downloads-src]][npm-downloads-href] |
12
11
 
13
- <!-- [![NPM version](https://img.shields.io/npm/v/jieui?color=a1b858&label=)](https://www.npmjs.com/package/@una-ui) -->
12
+ ## 📙 Documentation
14
13
 
15
- <!-- ## Sponsors -->
16
-
17
- <!-- <p align="center">
18
- </p> -->
14
+ Visit https://www.unaui.com for full documentation.
19
15
 
20
16
  ## 🏛️ License
21
17
 
22
18
  [MIT](./LICENSE) License © 2023 [Phojie](https://github.com/phojie)
19
+
20
+ <!-- Badge Variables -->
21
+
22
+ [npm-version-src]: https://img.shields.io/npm/v/@una-ui/preset?style=flat&colorA=18181B&colorB=CA8A04
23
+ [npm-version-href]: https://npmjs.com/package/@una-ui/preset
24
+ [npm-edge-src]: https://img.shields.io/npm/v/@una-ui/preset-edge?style=flat&colorA=18181B&colorB=CA8A04
25
+ [npm-edge-href]: https://npmjs.com/package/@una-ui/preset-edge
26
+ [npm-downloads-src]: https://img.shields.io/npm/dm/@una-ui/preset?style=flat&colorA=18181B&colorB=CA8A04
27
+ [npm-downloads-href]: https://npmjs.com/package/@una-ui/preset
28
+ [npm-edge-downloads-src]: https://img.shields.io/npm/dm/@una-ui/preset-edge?style=flat&colorA=18181B&colorB=CA8A04
29
+ [npm-edge-downloads-href]: https://npmjs.com/package/@una-ui/preset-edge
30
+ [github-status-src-main]: https://img.shields.io/github/checks-status/una-ui/una-ui/main?style=flat&colorA=18181B&colorB=CA8A04
31
+ [github-status-src-release]: https://img.shields.io/github/checks-status/una-ui/una-ui/release?style=flat&colorA=18181B&colorB=CA8A04
32
+ [github-status-href-main]: https://github.com/una-ui/una-ui/actions/workflows/ci.yml
33
+ [github-status-href-release]: https://github.com/una-ui/una-ui/actions/workflows/release.yml
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@una-ui/nuxt",
3
3
  "configKey": "una",
4
- "version": "0.1.1-beta.1",
4
+ "version": "0.2.0-beta.0",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.0.0-rc.8"
7
7
  }
package/dist/module.mjs CHANGED
@@ -2,18 +2,18 @@ import { fileURLToPath } from 'node:url';
2
2
  import { defineNuxtModule, createResolver, addComponentsDir, addPlugin, installModule } from '@nuxt/kit';
3
3
  import { presetUno, presetAttributify, presetIcons, transformerDirectives, transformerVariantGroup } from 'unocss';
4
4
  import presetUna from '@una-ui/preset';
5
+ import prefixes from '@una-ui/preset/prefixes';
6
+ import extratorUna from '@una-ui/extractor-vue-script';
5
7
 
6
8
  const name = "@una-ui/nuxt";
7
- const version = "0.1.1-beta.1";
9
+ const version = "0.2.0-beta.0";
8
10
 
9
11
  function extendUnocssOptions(user = {}) {
10
12
  return {
11
13
  ...user,
12
14
  preflight: false,
13
15
  presets: [
14
- presetUno({
15
- // attributifyPseudo: true,
16
- }),
16
+ presetUno(),
17
17
  presetAttributify(),
18
18
  presetIcons({
19
19
  scale: 1.2,
@@ -25,6 +25,11 @@ function extendUnocssOptions(user = {}) {
25
25
  presetUna(),
26
26
  ...user.presets || []
27
27
  ],
28
+ extractors: [
29
+ extratorUna({
30
+ prefixes
31
+ })
32
+ ],
28
33
  transformers: [
29
34
  transformerDirectives(),
30
35
  transformerVariantGroup()
@@ -53,7 +58,6 @@ const module = defineNuxtModule({
53
58
  },
54
59
  async setup(options, nuxt) {
55
60
  const { resolve } = createResolver(import.meta.url);
56
- nuxt.options.css.unshift("@unocss/reset/tailwind-compat.css");
57
61
  nuxt.options.css.unshift("@una-ui/preset/una.css");
58
62
  const runtimeDir = resolve("./runtime");
59
63
  nuxt.options.build.transpile.push(runtimeDir);
@@ -76,6 +80,12 @@ const module = defineNuxtModule({
76
80
  global: options.global,
77
81
  watch: nuxt.options.dev
78
82
  });
83
+ addComponentsDir({
84
+ path: resolve(runtimeDir, "components", "navigation"),
85
+ prefix: options.prefix,
86
+ global: options.global,
87
+ watch: nuxt.options.dev
88
+ });
79
89
  if (options.themeable) {
80
90
  addPlugin(resolve(runtimeDir, "plugins", "theme.client"));
81
91
  addPlugin(resolve(runtimeDir, "plugins", "theme.server"));
@@ -9,6 +9,7 @@ const props = withDefaults(defineProps<NAvatarProps>(), {
9
9
 
10
10
  const { isLoading, error, isReady } = useImage({ src: props?.src ?? '' }, { delay: props.delay })
11
11
 
12
+ // TODO: sync with NAvatarProps
12
13
  const avatarVariants = ['solid', 'soft', 'outline'] as const
13
14
  const hasVariant = computed(() => avatarVariants.some(avatarVariants => props.avatar?.includes(avatarVariants)))
14
15
  const isBaseVariant = computed(() => props.avatar?.includes('~'))
@@ -1,9 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
+
3
4
  import type { NBadgeProps } from '../../types'
4
5
  import NIcon from './Icon.vue'
5
6
 
6
- const props = defineProps<NBadgeProps>()
7
+ const props = withDefaults(defineProps<NBadgeProps>(), {
8
+ una: () => ({
9
+ badgeDefaultVariant: 'badge-default-variant',
10
+ }),
11
+ })
7
12
 
8
13
  const emit = defineEmits<{ (...args: any): void }>()
9
14
 
@@ -17,7 +22,7 @@ const isBaseVariant = computed(() => props.badge?.includes('~'))
17
22
  :badge="badge"
18
23
  class="badge"
19
24
  :class="[
20
- { 'badge-default-variant': !hasVariant && !isBaseVariant },
25
+ !hasVariant && !isBaseVariant ? una?.badgeDefaultVariant : '',
21
26
  una?.badge,
22
27
  ]"
23
28
  >
@@ -3,9 +3,7 @@ import { computed } from 'vue'
3
3
  import { createReusableTemplate } from '@vueuse/core'
4
4
  import NIcon from '../elements/Icon.vue'
5
5
  import type { NButtonProps } from '../../types'
6
-
7
- // @ts-expect-error tsconfig
8
- import { NuxtLink } from '#components'
6
+ import NLink from '../elements/Link.vue'
9
7
 
10
8
  defineOptions({
11
9
  inheritAttrs: false,
@@ -14,6 +12,9 @@ defineOptions({
14
12
  const props = withDefaults(defineProps<NButtonProps>(), {
15
13
  type: 'button',
16
14
  loadingPlacement: 'leading',
15
+ una: () => ({
16
+ btnDefaultVariant: 'btn-default-variant',
17
+ }),
17
18
  })
18
19
 
19
20
  const btnVariants = ['solid', 'outline', 'soft', 'ghost', 'link', 'text'] as const
@@ -25,17 +26,18 @@ const [DefineTemplate, ReuseTemplate] = createReusableTemplate()
25
26
 
26
27
  <template>
27
28
  <Component
28
- :is="to ? NuxtLink : 'button'"
29
+ :is="to ? NLink : 'button'"
29
30
  :to="to"
30
31
  :type="to ? null : type"
31
32
  class="btn"
32
33
  :class="[
33
- { 'btn-default-variant': !hasVariant && !isBaseVariant },
34
+ !hasVariant && !isBaseVariant ? una?.btnDefaultVariant : null,
34
35
  { 'btn-reverse': reverse },
35
36
  una?.btn,
36
37
  ]"
37
38
  :disabled="to ? null : disabled || loading"
38
39
  :btn="btn"
40
+ :aria-label="icon ? label : null"
39
41
  v-bind="$attrs"
40
42
  >
41
43
  <DefineTemplate v-if="loading">
@@ -62,6 +64,7 @@ const [DefineTemplate, ReuseTemplate] = createReusableTemplate()
62
64
  </slot>
63
65
 
64
66
  <ReuseTemplate v-if="loading && loadingPlacement === 'label'" />
67
+
65
68
  <slot v-else>
66
69
  <NIcon
67
70
  v-if="label && icon"
@@ -86,7 +89,7 @@ const [DefineTemplate, ReuseTemplate] = createReusableTemplate()
86
89
  <NIcon
87
90
  v-if="trailing"
88
91
  :name="trailing"
89
- :class="una?.btnLeading"
92
+ :class="una?.btnTrailing"
90
93
  btn="trailing"
91
94
  />
92
95
  </slot>
@@ -0,0 +1,25 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import type { NKbdProps } from '../../types'
4
+
5
+ const props = defineProps<NKbdProps>()
6
+
7
+ const kbdVariants = ['solid', 'outline'] as const
8
+ const hasVariant = computed(() => kbdVariants.some(kbdVariants => props.kbd?.includes(kbdVariants)))
9
+ const isBaseVariant = computed(() => props.kbd?.includes('~'))
10
+ </script>
11
+
12
+ <template>
13
+ <kbd
14
+ class="kbd"
15
+ :kbd="kbd"
16
+ :class="[
17
+ { 'kbd-default-variant': !hasVariant && !isBaseVariant },
18
+ una?.kbd,
19
+ ]"
20
+ >
21
+ <slot>
22
+ {{ label }}
23
+ </slot>
24
+ </kbd>
25
+ </template>
@@ -0,0 +1,66 @@
1
+ <script>
2
+ import { defineComponent } from "vue";
3
+ import { isEqual } from "ohash";
4
+ import { NuxtLink } from "#components";
5
+ export default defineComponent({
6
+ inheritAttrs: false,
7
+ props: {
8
+ ...NuxtLink.props,
9
+ // config
10
+ exact: {
11
+ type: Boolean,
12
+ default: false
13
+ },
14
+ exactQuery: {
15
+ type: Boolean,
16
+ default: false
17
+ },
18
+ exactHash: {
19
+ type: Boolean,
20
+ default: false
21
+ },
22
+ // styling
23
+ inactiveClass: {
24
+ type: String,
25
+ default: void 0
26
+ }
27
+ },
28
+ setup(props) {
29
+ function resolveLinkClass(route, $route, { isActive, isExactActive }) {
30
+ if (props.exactQuery && !isEqual(route.query, $route.query))
31
+ return props.inactiveClass;
32
+ if (props.exactHash && !isEqual(route.hash, $route.hash))
33
+ return props.inactiveClass;
34
+ if (props.exact && isExactActive)
35
+ return props.exactActiveClass;
36
+ if (!props.exact && isActive)
37
+ return props.activeClass;
38
+ return props.inactiveClass;
39
+ }
40
+ return {
41
+ resolveLinkClass
42
+ };
43
+ }
44
+ });
45
+ </script>
46
+
47
+ <template>
48
+ <NuxtLink
49
+ v-slot="{ route, href, target, rel, navigate, isActive, isExactActive, isExternal }"
50
+ v-bind="$props"
51
+ class="link"
52
+ custom
53
+ >
54
+ <a
55
+ v-bind="$attrs"
56
+ :href="href"
57
+ :rel="rel"
58
+ class="link"
59
+ :target="target"
60
+ :class="resolveLinkClass(route, $route, { isActive, isExactActive })"
61
+ @click="(e) => !isExternal && navigate(e)"
62
+ >
63
+ <slot v-bind="{ isActive: exact ? isExactActive : isActive }" />
64
+ </a>
65
+ </NuxtLink>
66
+ </template>
@@ -0,0 +1,9 @@
1
+ declare const _default: import("vue").DefineComponent<any, {
2
+ resolveLinkClass: (route: any, $route: any, { isActive, isExactActive }: {
3
+ isActive: boolean;
4
+ isExactActive: boolean;
5
+ }) => any;
6
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<any>, {} | {
7
+ [x: string]: any;
8
+ }, {}>;
9
+ export default _default;
@@ -2,11 +2,14 @@
2
2
  import { computed } from 'vue'
3
3
  import type { NFormGroupProps } from '../../types'
4
4
  import NFormGroupDefaultSlot from '../slots/FormGroupDefault'
5
+ import FormGroupLabel from '../slots/FormGroupLabel'
5
6
  import { randomId } from '../../utils'
6
7
 
7
- const props = defineProps<NFormGroupProps>()
8
+ const props = withDefaults(defineProps<NFormGroupProps>(), {
9
+ for: undefined,
10
+ })
8
11
 
9
- const id = randomId('form-group')
12
+ const id = computed(() => props.id ?? randomId('form-group'))
10
13
 
11
14
  const statusClassVariants = computed(() => {
12
15
  const text = {
@@ -22,9 +25,7 @@ const statusClassVariants = computed(() => {
22
25
  </script>
23
26
 
24
27
  <template>
25
- <div
26
- form-group
27
- >
28
+ <div form-group>
28
29
  <slot name="top">
29
30
  <div
30
31
  form-group="message-wrapper"
@@ -41,9 +42,9 @@ const statusClassVariants = computed(() => {
41
42
  :class="una?.formGroupTopWrapperInner"
42
43
  >
43
44
  <slot name="label">
44
- <label
45
- v-if="label"
46
- :for="name ?? id"
45
+ <FormGroupLabel
46
+ :id="id"
47
+ :for="props.for"
47
48
  form-group="label-wrapper"
48
49
  :class="una?.formGroupLabelWrapper"
49
50
  >
@@ -58,12 +59,13 @@ const statusClassVariants = computed(() => {
58
59
  form-group="label-required"
59
60
  :class="una?.formGroupLabelRequired"
60
61
  />
61
- </label>
62
+ </FormGroupLabel>
62
63
  </slot>
63
64
 
64
65
  <slot name="hint">
65
66
  <span
66
- v-if="hint" form-group="hint"
67
+ v-if="hint"
68
+ form-group="hint"
67
69
  :class="una?.formGroupHint"
68
70
  >
69
71
  {{ hint }}
@@ -85,7 +87,7 @@ const statusClassVariants = computed(() => {
85
87
  </slot>
86
88
 
87
89
  <NFormGroupDefaultSlot
88
- :id="name ?? id"
90
+ :id="id"
89
91
  :status="status"
90
92
  >
91
93
  <slot />
@@ -0,0 +1,91 @@
1
+ <script setup lang="ts">
2
+ import { useVModel } from '@vueuse/core'
3
+ import { computed } from 'vue'
4
+ import type { NRadioProps } from '../../types'
5
+ import { randomId } from '../../utils'
6
+ import NIcon from '../elements/Icon.vue'
7
+
8
+ defineOptions({
9
+ inheritAttrs: false,
10
+ })
11
+
12
+ const props = withDefaults(
13
+ defineProps<NRadioProps>(),
14
+ {
15
+ modelValue: '',
16
+ disabled: false,
17
+ una: () => ({
18
+ radioIcon: 'radio-icon',
19
+ }),
20
+ },
21
+ )
22
+
23
+ const emit = defineEmits<{ (...args: any): void }>()
24
+
25
+ const slots = defineSlots<{
26
+ default?: void
27
+ icon?: any
28
+ }>()
29
+
30
+ const id = computed(() => props.id ?? randomId('radio'))
31
+
32
+ const model = useVModel(props, 'modelValue', emit, { passive: true })
33
+ </script>
34
+
35
+ <template>
36
+ <label
37
+ radio="wrapper"
38
+ :for="props.for ?? id"
39
+ :class="[
40
+ una?.radioWrapper,
41
+ {
42
+ 'radio-reverse': reverse,
43
+ 'radio-disabled': disabled,
44
+ },
45
+ ]"
46
+ :checked="model === value || null"
47
+ :disabled="disabled || null"
48
+ >
49
+ <input
50
+ :id="id"
51
+ v-model="model"
52
+ type="radio"
53
+ class="peer"
54
+ radio="input"
55
+ :disabled="disabled"
56
+ :name="name"
57
+ :value="value"
58
+ @keypress.enter="model = value!"
59
+ >
60
+ <div
61
+ :radio="radio"
62
+ :size="size"
63
+ class="radio radio-(peer-focus)"
64
+ :class="[
65
+ una?.radioPeerFocus,
66
+ ]"
67
+ v-bind="$attrs"
68
+ >
69
+ <div radio="icon-wrapper">
70
+ <slot name="icon">
71
+ <NIcon
72
+ :class="[
73
+ una.radioIconBase,
74
+ ]"
75
+ radio="icon-base icon-checked"
76
+ :name="una.radioIcon!"
77
+ />
78
+ </slot>
79
+ </div>
80
+ </div>
81
+ <div
82
+ v-if="slots.default || label"
83
+ radio="label"
84
+ :class="una?.radioLabel"
85
+ >
86
+ <slot>
87
+ {{ label }}
88
+ </slot>
89
+ </div>
90
+ </label>
91
+ </template>
@@ -0,0 +1,54 @@
1
+ <script setup lang="ts">
2
+ import type { NNavLinkProps } from '../../types'
3
+ import { omitProps } from '../../utils'
4
+
5
+ defineOptions({
6
+ inheritAttrs: false,
7
+ })
8
+
9
+ const props = defineProps<NNavLinkProps>()
10
+ </script>
11
+
12
+ <template>
13
+ <NButton
14
+ nav-link="~ variant"
15
+ active-class="nav-link-active"
16
+ inactive-class="nav-link-inactive"
17
+ :una="{
18
+ btnDefaultVariant: '~',
19
+ ...props.una,
20
+ }"
21
+ v-bind="{ ...omitProps(props, ['badge', 'una']), ...$attrs }"
22
+ >
23
+ <template #leading>
24
+ <NIcon
25
+ v-if="leading"
26
+ :name="leading"
27
+ :class="una?.btnLeading"
28
+ btn="leading"
29
+ />
30
+ </template>
31
+
32
+ <template #default>
33
+ <span
34
+ btn="label"
35
+ class="w-full text-left"
36
+ :class="una?.btnLabel"
37
+ >
38
+ {{ label }}
39
+ </span>
40
+ </template>
41
+
42
+ <template v-if="badge" #trailing>
43
+ <!-- TODO: move to una preset -->
44
+ <NBadge
45
+ v-bind="badge"
46
+ :una="{
47
+ badgeDefaultVariant: 'badge-outline-white',
48
+ ...props.badge?.una,
49
+ }"
50
+ class="min-w-max whitespace-nowrap rounded-full px-2.5 py-0.5 leading-5"
51
+ />
52
+ </template>
53
+ </NButton>
54
+ </template>
@@ -0,0 +1,61 @@
1
+ <script setup lang="ts">
2
+ import { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'
3
+ import type { NVerticalNav } from '../../types'
4
+ import { omitProps } from '../../utils'
5
+ import NNavLink from './NavLink.vue'
6
+
7
+ const props = defineProps<NVerticalNav>()
8
+ </script>
9
+
10
+ <template>
11
+ <div class="nav-link-group">
12
+ <template
13
+ v-for="link in props.links"
14
+ :key="link.label"
15
+ >
16
+ <NNavLink
17
+ v-if="!link.children"
18
+ v-bind="link"
19
+ />
20
+
21
+ <Disclosure
22
+ v-else
23
+ v-slot="{ open }"
24
+ :default-open="link.defaultOpen"
25
+ as="div"
26
+ >
27
+ <DisclosureButton
28
+ as="div"
29
+ :disabled="link.disabled"
30
+ >
31
+ <NNavLink
32
+ :una="{
33
+ btnTrailing: `h-5 w-5 ${open ? 'rotate-90' : ''}`,
34
+ btn: 'w-full',
35
+ }"
36
+ trailing="i-heroicons-chevron-right-20-solid"
37
+ v-bind="omitProps(link, ['children'])"
38
+ />
39
+ </DisclosureButton>
40
+
41
+ <div v-show="open">
42
+ <DisclosurePanel
43
+ as="ul"
44
+ nav-link-group="panel"
45
+ static
46
+ >
47
+ <li v-for="subLink in link.children" :key="subLink.label">
48
+ <NNavLink
49
+ v-bind="subLink"
50
+ :una="{
51
+ btnLabel: 'font-normal',
52
+ btn: 'w-full pl-8',
53
+ }"
54
+ />
55
+ </li>
56
+ </DisclosurePanel>
57
+ </div>
58
+ </Disclosure>
59
+ </template>
60
+ </div>
61
+ </template>
@@ -16,7 +16,8 @@ export default defineComponent({
16
16
  if (!children.value)
17
17
  return () => null;
18
18
  const clones = computed(() => children.value?.map((node) => {
19
- return cloneVNode(node, { id: props.id, name: props.id, status: props.status });
19
+ const mergeProps = { ...props, ...node.props };
20
+ return cloneVNode(node, mergeProps);
20
21
  }));
21
22
  return () => clones.value;
22
23
  }
@@ -0,0 +1,23 @@
1
+ import type { PropType } from 'vue';
2
+ declare const _default: import("vue").DefineComponent<{
3
+ for: {
4
+ type: PropType<string | boolean | undefined>;
5
+ required: false;
6
+ };
7
+ id: {
8
+ type: PropType<string | undefined>;
9
+ required: false;
10
+ };
11
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
12
+ [key: string]: any;
13
+ }> | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
14
+ for: {
15
+ type: PropType<string | boolean | undefined>;
16
+ required: false;
17
+ };
18
+ id: {
19
+ type: PropType<string | undefined>;
20
+ required: false;
21
+ };
22
+ }>>, {}, {}>;
23
+ export default _default;
@@ -0,0 +1,29 @@
1
+ import { computed, defineComponent, h } from "vue";
2
+ export default defineComponent({
3
+ props: {
4
+ for: {
5
+ type: [String, Boolean],
6
+ required: false
7
+ },
8
+ id: {
9
+ type: String,
10
+ required: false
11
+ }
12
+ },
13
+ setup(props, { slots }) {
14
+ return () => {
15
+ const children = slots.default?.();
16
+ if (!children)
17
+ return;
18
+ const unLabelled = computed(() => props.for === false || props.for !== void 0);
19
+ const tag = computed(() => unLabelled.value ? "div" : "label");
20
+ return h(
21
+ tag.value,
22
+ {
23
+ for: unLabelled.value ? void 0 : props.for ?? props.id
24
+ },
25
+ children
26
+ );
27
+ };
28
+ }
29
+ });
@@ -52,7 +52,7 @@ export interface NAccordionProps extends Omit<NButtonProps, 'una'> {
52
52
  */
53
53
  items: NAccordionItemProps[];
54
54
  /**
55
- * `Unaonfiguration
55
+ * `UnaUI` preset configuration
56
56
  *
57
57
  * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/accordion.ts
58
58
  */
@@ -34,7 +34,7 @@ export interface NAlertProps {
34
34
  */
35
35
  description?: string;
36
36
  /**
37
- * `Unaguration
37
+ * `UnaUI` preset configuration
38
38
  *
39
39
  * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/alert.ts
40
40
  */
@@ -56,7 +56,7 @@ export interface NAvatarProps {
56
56
  */
57
57
  skeleton?: boolean;
58
58
  /**
59
- * `Unaet configuration
59
+ * `UnaUI` preset configuration
60
60
  *
61
61
  * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/avatar.ts
62
62
  */
@@ -32,6 +32,7 @@ export interface NBadgeProps {
32
32
  * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/badge.ts
33
33
  */
34
34
  una?: {
35
+ badgeDefaultVariant?: string;
35
36
  badge?: string;
36
37
  badgeIconBase?: string;
37
38
  badgeClose?: string;
@@ -84,6 +84,7 @@ export interface NButtonProps {
84
84
  * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/button.ts
85
85
  */
86
86
  una?: {
87
+ btnDefaultVariant?: string;
87
88
  btn?: string;
88
89
  btnLabel?: string;
89
90
  btnIconLabel?: string;
@@ -12,16 +12,26 @@ export interface NFormGroupProps {
12
12
  */
13
13
  required?: boolean;
14
14
  /**
15
- * Manually set the name attribute for the form group label.
16
- * Slot children will inherit the name attribute as both `id` and `name` for accessibility.
15
+ * Manually set the for attribute.
17
16
  *
18
- * By default, the name attribute is generated randomly.
17
+ * By default, the for attribute is synced with the id attribute for accessibility reasons.
18
+ * You can disable this behavior by setting `for` to `false`.
19
19
  *
20
20
  * @default randomId
21
21
  * @example
22
- * name="email"
22
+ * for="email"
23
23
  */
24
- name?: string;
24
+ for?: string | boolean;
25
+ /**
26
+ * Manually set the id attribute.
27
+ *
28
+ * By default, the id attribute is generated randomly for accessibility reasons.
29
+ *
30
+ * @default randomId
31
+ * @example
32
+ * id="email"
33
+ */
34
+ id?: string;
25
35
  /**
26
36
  * Label for the form group.
27
37
  *
@@ -3,7 +3,7 @@ export interface NIconProps {
3
3
  * Icon name
4
4
  *
5
5
  * @example
6
- * 'heroicons-chevron-up'
6
+ * 'i-heroicons-chevron-up'
7
7
  */
8
8
  name: string;
9
9
  }
@@ -9,3 +9,8 @@ export * from './badge';
9
9
  export * from './avatar';
10
10
  export * from './avatar-group';
11
11
  export * from './indicator';
12
+ export * from './kbd';
13
+ export * from './nav-link';
14
+ export * from './nav-link-group';
15
+ export * from './link';
16
+ export * from './radio';
@@ -9,3 +9,8 @@ export * from "./badge.mjs";
9
9
  export * from "./avatar.mjs";
10
10
  export * from "./avatar-group.mjs";
11
11
  export * from "./indicator.mjs";
12
+ export * from "./kbd.mjs";
13
+ export * from "./nav-link.mjs";
14
+ export * from "./nav-link-group.mjs";
15
+ export * from "./link.mjs";
16
+ export * from "./radio.mjs";
@@ -0,0 +1,26 @@
1
+ export interface NKbdProps {
2
+ /**
3
+ * Allows you to add `UnaUI` kbd preset properties,
4
+ * Think of it as a shortcut for adding options or variants to the preset if available.
5
+ *
6
+ * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/kbd.ts
7
+ * @example
8
+ * kbd="solid-error"
9
+ */
10
+ kbd?: string;
11
+ /**
12
+ * Add a label to the kbd.
13
+ *
14
+ * @example
15
+ * label="Ctrl"
16
+ */
17
+ label?: string;
18
+ /**
19
+ * `UnaUI` preset configuration
20
+ *
21
+ * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/kbd.ts
22
+ */
23
+ una?: {
24
+ kbd?: string;
25
+ };
26
+ }
File without changes
@@ -0,0 +1,26 @@
1
+ export interface NLinkProps {
2
+ /**
3
+ * Manually enable/disable the exact match
4
+ *
5
+ * @default false
6
+ */
7
+ exact?: boolean;
8
+ /**
9
+ * Manually enable/disable the exact match for the query string
10
+ *
11
+ * @default false
12
+ */
13
+ exactQuery?: boolean;
14
+ /**
15
+ * Manually enable/disable the exact match for the hash
16
+ *
17
+ * @default false
18
+ */
19
+ exactHash?: boolean;
20
+ /**
21
+ * Active classes to apply when the link is inactive
22
+ *
23
+ * @example 'text-primary'
24
+ */
25
+ inactiveClass?: string;
26
+ }
File without changes
@@ -0,0 +1,8 @@
1
+ import type { NNavLinkProps } from './nav-link';
2
+ export interface NNavLinkGroupLink extends NNavLinkProps {
3
+ children?: NNavLinkProps[];
4
+ defaultOpen?: boolean;
5
+ }
6
+ export interface NVerticalNav {
7
+ links: NNavLinkGroupLink[];
8
+ }
File without changes
@@ -0,0 +1,5 @@
1
+ import type { NBadgeProps } from './badge';
2
+ import type { NButtonProps } from './button';
3
+ export interface NNavLinkProps extends NButtonProps {
4
+ badge?: NBadgeProps;
5
+ }
File without changes
@@ -0,0 +1,90 @@
1
+ export interface NRadioProps {
2
+ /**
3
+ * Disable the radio.
4
+ *
5
+ * @default false
6
+ */
7
+ disabled?: boolean;
8
+ /**
9
+ * Switch the position of label and radio.
10
+ *
11
+ * @default false
12
+ */
13
+ reverse?: boolean;
14
+ /**
15
+ * Allows you to add `UnaUI` radio preset properties,
16
+ * Think of it as a shortcut for adding options or variants to the preset if available.
17
+ *
18
+ * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/radio.ts
19
+ * @example
20
+ * radio="green"
21
+ */
22
+ radio?: string;
23
+ /**
24
+ * v-model binding value if the radio is checked.
25
+ *
26
+ * @default null
27
+ */
28
+ modelValue?: string | number | boolean | Record<string, any>;
29
+ /**
30
+ * Add name attribute to the radio.
31
+ *
32
+ * @default null
33
+ */
34
+ name?: string;
35
+ /**
36
+ * Manually set the id attribute.
37
+ *
38
+ * By default, the id attribute is generated randomly for accessibility reasons.
39
+ *
40
+ * @default randomId
41
+ * @example
42
+ * id="options"
43
+ */
44
+ id?: string;
45
+ /**
46
+ * Manually set the for attribute.
47
+ *
48
+ * By default, the for attribute is synced with the id attribute for accessibility reasons.
49
+ *
50
+ * @default randomId
51
+ * @example
52
+ * for="options"
53
+ */
54
+ for?: string;
55
+ /**
56
+ * Value of the radio.
57
+ *
58
+ * @example
59
+ * value="1"
60
+ */
61
+ value?: string;
62
+ /**
63
+ * Display label of the radio.
64
+ *
65
+ * @default null
66
+ */
67
+ label?: string;
68
+ /**
69
+ * Allows you to change the size of the radio.
70
+ *
71
+ * @default size="sm"
72
+ *
73
+ * @example
74
+ * size="sm" | size="2cm" | size="2rem" | size="2px"
75
+ */
76
+ size?: string;
77
+ /**
78
+ * `UnaUI` preset configuration
79
+ *
80
+ * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/radio.ts
81
+ */
82
+ una?: {
83
+ radio?: string;
84
+ radioWrapper?: string;
85
+ radioLabel?: string;
86
+ radioPeerFocus?: string;
87
+ radioIconBase?: string;
88
+ radioIcon?: string;
89
+ };
90
+ }
File without changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@una-ui/nuxt",
3
3
  "type": "module",
4
- "version": "0.1.1-beta.1",
4
+ "version": "0.2.0-beta.0",
5
5
  "description": "Nuxt module for @una-ui",
6
6
  "author": "Phojie Rengel <phojrengel@gmail.com>",
7
7
  "license": "MIT",
@@ -13,8 +13,8 @@
13
13
  },
14
14
  "exports": {
15
15
  ".": {
16
- "import": "./dist/module.mjs",
17
- "require": "./dist/module.cjs"
16
+ "require": "./dist/module.cjs",
17
+ "import": "./dist/module.mjs"
18
18
  }
19
19
  },
20
20
  "main": "./dist/module.cjs",
@@ -24,26 +24,26 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@headlessui/vue": "^1.7.16",
27
- "@iconify-json/carbon": "^1.1.19",
28
27
  "@iconify-json/heroicons": "^1.1.12",
29
- "@iconify-json/tabler": "^1.1.87",
30
- "@nuxt/kit": "^3.6.5",
28
+ "@iconify-json/tabler": "^1.1.94",
29
+ "@nuxt/kit": "^3.7.4",
31
30
  "@nuxtjs/color-mode": "^3.3.0",
32
- "@unocss/core": "^0.55.1",
33
- "@unocss/nuxt": "^0.55.1",
34
- "@unocss/preset-attributify": "^0.55.1",
35
- "@unocss/preset-icons": "^0.55.1",
36
- "@unocss/reset": "^0.55.1",
37
- "@vueuse/core": "^10.3.0",
38
- "@vueuse/integrations": "^10.3.0",
39
- "@vueuse/nuxt": "^10.3.0",
40
- "unocss": "^0.55.1",
41
- "@una-ui/preset": "^0.1.1-beta.1"
31
+ "@unocss/core": "^0.55.7",
32
+ "@unocss/nuxt": "^0.55.7",
33
+ "@unocss/preset-attributify": "^0.55.7",
34
+ "@unocss/preset-icons": "^0.55.7",
35
+ "@vueuse/core": "^10.5.0",
36
+ "@vueuse/integrations": "^10.5.0",
37
+ "@vueuse/nuxt": "^10.5.0",
38
+ "ohash": "^1.1.3",
39
+ "unocss": "^0.55.7",
40
+ "@una-ui/extractor-vue-script": "^0.2.0-beta.0",
41
+ "@una-ui/preset": "^0.2.0-beta.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@nuxt/module-builder": "^0.4.0",
45
- "@nuxt/schema": "^3.6.5",
46
- "nuxt": "^3.6.5"
45
+ "@nuxt/schema": "^3.7.4",
46
+ "nuxt": "3.7.3"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"