@una-ui/nuxt 0.23.0-beta.1 → 0.25.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@una-ui/nuxt",
3
3
  "configKey": "una",
4
- "version": "0.23.0-beta.1",
4
+ "version": "0.25.0-beta.1",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.0.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -7,7 +7,7 @@ import 'unocss';
7
7
  import 'unocss-preset-animations';
8
8
 
9
9
  const name = "@una-ui/nuxt";
10
- const version = "0.23.0-beta.1";
10
+ const version = "0.25.0-beta.1";
11
11
 
12
12
  const module = defineNuxtModule({
13
13
  meta: {
@@ -225,7 +225,7 @@ defineExpose({
225
225
  :colspan="header.colSpan"
226
226
  :data-pinned="header.column.getIsPinned()"
227
227
  :una="una"
228
- v-bind="props._tableHead"
228
+ v-bind="{ ...props._tableHead, ...header.column.columnDef.meta }"
229
229
  >
230
230
  <Button
231
231
  v-if="header.column.columnDef.enableSorting || (header.column.columnDef.enableSorting !== false && enableSorting)"
@@ -290,7 +290,7 @@ defineExpose({
290
290
  :una="una"
291
291
  :colspan="header.colSpan"
292
292
  :data-pinned="header.column.getIsPinned()"
293
- v-bind="props._tableHead"
293
+ v-bind="{ ...props._tableHead, ...header.column.columnDef.meta }"
294
294
  >
295
295
  <slot
296
296
  v-if="header.id !== 'selection' && ((header.column.columnDef.enableColumnFilter !== false && enableColumnFilters) || header.column.columnDef.enableColumnFilter)"
@@ -344,7 +344,7 @@ defineExpose({
344
344
  :key="cell.id"
345
345
  :data-pinned="cell.column.getIsPinned()"
346
346
  :una="una"
347
- v-bind="props._tableCell"
347
+ v-bind="{ ...props._tableCell, ...cell.column.columnDef.meta }"
348
348
  >
349
349
  <slot
350
350
  :name="`${cell.column.id}-cell`"
@@ -411,7 +411,7 @@ defineExpose({
411
411
  v-if="header.column.columnDef.footer"
412
412
  :colspan="header.colSpan"
413
413
  :una="una"
414
- v-bind="props._tableHead"
414
+ v-bind="{ ...props._tableHead, ...header.column.columnDef.meta }"
415
415
  >
416
416
  <slot :name="`${header.id}-footer`" :column="header.column">
417
417
  <FlexRender
@@ -9,8 +9,8 @@ const props = defineProps<NTableBodyProps>()
9
9
  <tbody
10
10
  :class="cn(
11
11
  'table-body',
12
- props.class,
13
12
  props?.una?.tableBody,
13
+ props.class,
14
14
  )"
15
15
  v-bind="$attrs"
16
16
  >
@@ -9,8 +9,8 @@ const props = defineProps<NTableCaptionProps>()
9
9
  <caption
10
10
  :class="cn(
11
11
  'table-caption',
12
- props.class,
13
12
  props?.una?.tableCaption,
13
+ props.class,
14
14
  )"
15
15
  v-bind="$attrs"
16
16
  >
@@ -10,10 +10,10 @@ const props = defineProps<NTableCellProps>()
10
10
  :class="
11
11
  cn(
12
12
  'table-cell',
13
+ props?.una?.tableCell,
14
+ props.class,
13
15
  { 'table-cell-pinned': dataPinned },
14
16
  dataPinned === 'left' ? 'table-cell-pinned-left' : 'table-cell-pinned-right',
15
- props.class,
16
- props?.una?.tableCell,
17
17
  )
18
18
  "
19
19
  v-bind="$attrs"
@@ -20,6 +20,7 @@ const delegatedProps = computed(() => {
20
20
  <TableRow
21
21
  :class="cn(
22
22
  'table-empty-row',
23
+ props.una?.tableRow,
23
24
  )"
24
25
  v-bind="delegatedProps._tableRow"
25
26
  >
@@ -27,6 +28,7 @@ const delegatedProps = computed(() => {
27
28
  :class="
28
29
  cn(
29
30
  'table-empty-cell',
31
+ props.una?.tableCell,
30
32
  )
31
33
  "
32
34
  :colspan="props.colspan"
@@ -35,6 +37,7 @@ const delegatedProps = computed(() => {
35
37
  <div
36
38
  :class="cn(
37
39
  'table-empty',
40
+ props.una?.tableEmpty,
38
41
  props.class,
39
42
  )"
40
43
  v-bind="omitProps(delegatedProps, ['_tableRow', '_tableCell', 'colspan'])"
@@ -9,8 +9,8 @@ const props = defineProps<NTableFooterProps>()
9
9
  <tfoot
10
10
  :class="cn(
11
11
  'table-footer',
12
- props.class,
13
12
  props.una?.tableFooter,
13
+ props.class,
14
14
  )"
15
15
  >
16
16
  <slot />
@@ -9,6 +9,7 @@ const props = defineProps<NTableHeadProps>()
9
9
  <th
10
10
  :class="cn(
11
11
  'table-head',
12
+ props.una?.tableHead,
12
13
  props.class,
13
14
  { 'table-head-pinned': props.dataPinned },
14
15
  props.dataPinned === 'left' ? 'table-head-pinned-left' : 'table-head-pinned-right',
@@ -9,8 +9,8 @@ const props = defineProps<NTableHeaderProps>()
9
9
  <thead
10
10
  :class="cn(
11
11
  'table-header',
12
- props.class,
13
12
  props?.una?.tableHeader,
13
+ props.class,
14
14
  )"
15
15
  v-bind="$attrs"
16
16
  >
@@ -19,6 +19,7 @@ const delegatedProps = computed(() => {
19
19
  <TableRow
20
20
  :class="cn(
21
21
  'table-loading-row',
22
+ props.una?.tableRow,
22
23
  )"
23
24
  data-loading="true"
24
25
  v-bind="delegatedProps._tableRow"
@@ -27,6 +28,7 @@ const delegatedProps = computed(() => {
27
28
  :class="
28
29
  cn(
29
30
  'table-loading-cell',
31
+ props.una?.tableCell,
30
32
  )
31
33
  "
32
34
  :colspan="0"
@@ -34,7 +36,10 @@ const delegatedProps = computed(() => {
34
36
  >
35
37
  <div
36
38
  v-if="enabled"
37
- class="table-loading"
39
+ :class="cn(
40
+ 'table-loading',
41
+ props.una?.tableLoading,
42
+ )"
38
43
  >
39
44
  <slot>
40
45
  <Progress
@@ -12,8 +12,8 @@ const props = defineProps<NTableRootProps>()
12
12
  <table
13
13
  :class="cn(
14
14
  'table-root',
15
- props.class,
16
15
  props.una?.tableRoot,
16
+ props.class,
17
17
  )"
18
18
  >
19
19
  <slot />
@@ -9,8 +9,8 @@ const props = defineProps<NTableRowProps>()
9
9
  <tr
10
10
  :class="cn(
11
11
  'table-row',
12
- props.class,
13
12
  props.una?.tableRow,
13
+ props.class,
14
14
  )"
15
15
  v-bind="$attrs"
16
16
  >
@@ -122,8 +122,8 @@ const isBaseVariant = computed(() => props.btn?.includes('~'))
122
122
  { 'accordion-button-padding': !unstyle },
123
123
  una?.accordionButton,
124
124
  ]"
125
- accordion="button"
126
125
  :una="{
126
+ btn: 'h-auto accordion-button',
127
127
  btnLabel: 'accordion-label',
128
128
  }"
129
129
  >
@@ -14,7 +14,7 @@ const props = withDefaults(defineProps<NAvatarGroupProps>(), {
14
14
  <template>
15
15
  <div
16
16
  avatar-group
17
- v-bind="$attrs"
17
+ v-bind="{ ...$attrs, size }"
18
18
  :class="una?.avatarGroup"
19
19
  >
20
20
  <NAvatarGroupDefaultSlot
@@ -1,117 +1,74 @@
1
1
  <script setup lang="ts">
2
2
  import type { NSwitchProps } from '../../types'
3
- import { Switch } from '@headlessui/vue'
4
- import { useVModel } from '@vueuse/core'
5
- import { computed } from 'vue'
3
+ import {
4
+ SwitchRoot,
5
+ type SwitchRootEmits,
6
+ SwitchThumb,
7
+ useForwardPropsEmits,
8
+ } from 'radix-vue'
9
+ import { cn } from '../../utils'
6
10
  import NIcon from '../elements/Icon.vue'
7
11
 
8
- defineOptions({
9
- inheritAttrs: false,
12
+ const props = withDefaults(defineProps<NSwitchProps>(), {
13
+ size: 'md',
14
+ switchChecked: 'primary',
15
+ switchUnchecked: 'gray',
10
16
  })
11
17
 
12
- const props = defineProps<NSwitchProps>()
18
+ const emit = defineEmits<SwitchRootEmits>()
13
19
 
14
- const emit = defineEmits<{ (...args: any): void }>()
15
-
16
- const on = useVModel(props, 'modelValue', emit, { passive: true })
17
-
18
- const _switch = computed(() => props.switch)
19
-
20
- const outsetClassVariants = computed(() => {
21
- const switchWrapper = {
22
- false: 'switch-inset',
23
- true: 'switch-outset',
24
- }
25
-
26
- const switchTrack = {
27
- false: 'switch-track-inset',
28
- true: 'switch-track-outset',
29
- }
30
-
31
- const switchThumb = {
32
- false: 'left-0.125em',
33
- true: 'left-0 border-base border',
34
- }
35
-
36
- return {
37
- switchWrapper: switchWrapper[!props.outset ? 'false' : 'true'],
38
- switchTrack: switchTrack[!props.outset ? 'false' : 'true'],
39
- switchThumb: switchThumb[!props.outset ? 'false' : 'true'],
40
- }
41
- })
42
-
43
- const onClassVariants = computed(() => {
44
- const switchTrack = {
45
- true: `${props.una?.switchTrackOn ?? ''} switch-track-on`,
46
- false: `${props.una?.switchTrackOff ?? ''} switch-track-off`,
47
- }
48
-
49
- const switchThumb = {
50
- true: `${props.una?.switchThumbOn ?? ''} switch-thumb-on`,
51
- false: `${props.una?.switchThumbOff ?? ''} switch-thumb-off`,
52
- }
53
-
54
- const switchIcon = {
55
- true: `${props.onIcon ?? ''} switch-icon-on`,
56
- false: `${props.offIcon ?? ''} switch-icon-off`,
57
- }
58
-
59
- return {
60
- switchTrack: switchTrack[on.value ? 'true' : 'false'],
61
- switchThumb: switchThumb[on.value ? 'true' : 'false'],
62
- switchIcon: switchIcon[on.value ? 'true' : 'false'],
63
- }
64
- })
20
+ const forwarded = useForwardPropsEmits(props, emit)
65
21
  </script>
66
22
 
67
23
  <template>
68
- <Switch
69
- v-model="on"
70
- class="switch"
71
- :class="[
72
- { 'switch-disabled': disabled || loading },
73
- outsetClassVariants?.switchWrapper,
74
- ]"
75
- :switch="_switch"
76
- v-bind="$attrs"
77
- :disabled="disabled"
24
+ <SwitchRoot
25
+ v-slot="{ checked }"
26
+ v-bind="forwarded"
27
+ :class="cn(
28
+ 'peer switch',
29
+ una?.switch,
30
+ checked
31
+ ? una?.switchChecked
32
+ : una?.switchUnchecked,
33
+ )"
34
+ :disabled="disabled || loading"
35
+ :switch-unchecked
36
+ :switch-checked
37
+ :size
78
38
  >
79
- <span class="sr-only">Track</span>
80
- <span
81
- aria-hidden="true"
82
- switch="track"
83
- :class="[
84
- una?.switchTrack,
85
- onClassVariants?.switchTrack,
86
- outsetClassVariants?.switchTrack,
87
- ]"
88
- />
89
-
90
- <span class="sr-only">Thumb</span>
91
- <span
92
- aria-hidden="true"
93
- switch="thumb"
94
- :class="[
39
+ <SwitchThumb
40
+ :class="cn(
41
+ 'switch-thumb',
95
42
  una?.switchThumb,
96
- onClassVariants?.switchThumb,
97
- outsetClassVariants?.switchThumb,
98
- ]"
43
+ checked
44
+ ? 'switch-thumb-checked'
45
+ : 'switch-thumb-unchecked',
46
+ checked
47
+ ? una?.switchThumbChecked
48
+ : una?.switchThumbUnchecked,
49
+ )"
99
50
  >
100
- <span class="sr-only">Icon</span>
101
- <slot v-if="!loading" name="icon" :on="on">
51
+ <slot v-if="!loading" name="icon" :checked>
102
52
  <NIcon
103
- switch="icon-base"
104
- :name="onClassVariants?.switchIcon"
105
- :class="una?.switchIconBase"
53
+ :name="(checked ? checkedIcon : uncheckedIcon) || icon"
54
+ :class="cn(
55
+ 'switch-icon',
56
+ una?.switchIcon,
57
+ checked
58
+ ? ['switch-icon-checked', una?.switchIconChecked]
59
+ : ['switch-icon-unchecked', una?.switchIconUnchecked],
60
+ )"
106
61
  />
107
62
  </slot>
108
- <slot v-else name="loading-icon" :on="on">
63
+ <slot v-else name="loading-icon" :checked>
109
64
  <NIcon
110
- switch="loading"
111
- :class="una?.switchLoading"
112
- :name="una?.switchloadingicon ?? 'switch-loading-icon'"
65
+ :class="cn(
66
+ 'switch-icon switch-loading-icon',
67
+ una?.switchLoading,
68
+ )"
69
+ :name="una?.switchLoadingIconName || 'switch-loading-icon-name'"
113
70
  />
114
71
  </slot>
115
- </span>
116
- </Switch>
72
+ </SwitchThumb>
73
+ </SwitchRoot>
117
74
  </template>
@@ -5,6 +5,7 @@ import { cn } from '../../../utils'
5
5
  const props = withDefaults(defineProps<NBreadcrumbEllipsisProps>(), {
6
6
  icon: 'breadcrumb-ellipsis-icon',
7
7
  size: 'sm',
8
+ square: 9,
8
9
  })
9
10
  </script>
10
11
 
@@ -1,69 +1,77 @@
1
- export interface NSwitchProps {
1
+ import type { SwitchRootProps } from 'radix-vue';
2
+ import type { HTMLAttributes } from 'vue';
3
+ export interface NSwitchProps extends SwitchRootProps {
2
4
  /**
3
- * Value of the switch.
5
+ * Add a loading indicator to the switch.
6
+ * This will also disable the switch.
4
7
  *
5
- * @default null
8
+ * @default false
6
9
  */
7
- modelValue?: boolean;
10
+ loading?: boolean;
8
11
  /**
9
- * Disable the switch from being clicked.
12
+ * Allows you to display an icon. Equivalent of setting both `onIcon` and `offIcon`.
10
13
  *
11
- * @default false
14
+ * @example
15
+ * icon="i-heroicons-question-20-solid"
12
16
  */
13
- disabled?: boolean;
17
+ icon?: HTMLAttributes['class'];
14
18
  /**
15
- * Add a loading indicator to the switch.
16
- * This will also disable the switch.
19
+ * Allows you to display an icon when the switch is on.
20
+ * Accepts icon name and utility classes
17
21
  *
18
- * @default false
22
+ * @example
23
+ * on-icon="i-heroicons-check-20-solid text-white"
19
24
  */
20
- loading?: boolean;
25
+ checkedIcon?: HTMLAttributes['class'];
21
26
  /**
22
- * Display the slider thumb outside of the track.
27
+ * Allows you to display an icon when the switch is off.
28
+ * Accepts icon name and utility classes
23
29
  *
24
- * @default false
30
+ * @example
31
+ * off-icon="i-heroicons-x-mark-20-solid text-white"
25
32
  */
26
- outset?: boolean;
33
+ uncheckedIcon?: HTMLAttributes['class'];
27
34
  /**
28
- * Allows you to add `UnaUI` switch preset properties,
29
- * Think of it as a shortcut for adding options or variants to the preset if available.
35
+ * Allows you to change the size of the input.
36
+ *
37
+ * @default md
30
38
  *
31
39
  * @example
32
- * switch="xl green focus"
40
+ * size="sm" | size="2cm" | size="2rem" | size="2px"
33
41
  */
34
- switch?: string;
42
+ size?: HTMLAttributes['class'];
35
43
  /**
36
- * Allows you to display an icon when the switch is on.
37
- * Accepts icon name and utility classes
44
+ * Allows you to add `UnaUI` switch preset properties,
45
+ * Think of it as a shortcut for adding options or variants to the preset if available.
38
46
  *
39
47
  * @example
40
- * icon="i-heroicons-check-20-solid text-white"
48
+ * switch-checked="green"
41
49
  */
42
- onIcon?: string;
50
+ switchChecked?: HTMLAttributes['class'];
43
51
  /**
44
- * Allows you to display an icon when the switch is off.
45
- * Accepts icon name and utility classes
52
+ * Allows you to add `UnaUI` switch preset properties,
53
+ * Think of it as a shortcut for adding options or variants to the preset if available.
46
54
  *
47
55
  * @example
48
- * icon="i-heroicons-x-mark-20-solid text-white"
56
+ * switch-unchecked="gray"
49
57
  */
50
- offIcon?: string;
58
+ switchUnchecked?: HTMLAttributes['class'];
51
59
  /**
52
60
  * `UnaUI` preset configuration
53
61
  *
54
62
  * @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/switch.ts
55
63
  */
56
64
  una?: {
57
- switchThumb?: string;
58
- switchThumbOn?: string;
59
- switchThumbOff?: string;
60
- switchTrack?: string;
61
- switchTrackOn?: string;
62
- switchTrackOff?: string;
63
- switchIconBase?: string;
64
- switchIconOn?: string;
65
- switchIconOff?: string;
66
- switchLoading?: string;
67
- switchloadingicon?: string;
65
+ switch?: HTMLAttributes['class'];
66
+ switchChecked?: HTMLAttributes['class'];
67
+ switchUnchecked?: HTMLAttributes['class'];
68
+ switchThumb?: HTMLAttributes['class'];
69
+ switchThumbChecked?: HTMLAttributes['class'];
70
+ switchThumbUnchecked?: HTMLAttributes['class'];
71
+ switchIcon?: HTMLAttributes['class'];
72
+ switchIconChecked?: HTMLAttributes['class'];
73
+ switchIconUnchecked?: HTMLAttributes['class'];
74
+ switchLoading?: HTMLAttributes['class'];
75
+ switchLoadingIconName?: HTMLAttributes['class'];
68
76
  };
69
77
  }
@@ -137,7 +137,7 @@ export interface NTableEmptyProps {
137
137
  colspan?: number;
138
138
  _tableCell?: NTableCellProps;
139
139
  _tableRow?: NTableRowProps;
140
- una?: Pick<NTableUnaProps, 'tableEmpty'>;
140
+ una?: Pick<NTableUnaProps, 'tableEmpty' | 'tableRow' | 'tableCell'>;
141
141
  }
142
142
  export interface NTableLoadingProps {
143
143
  enabled?: boolean;
@@ -145,7 +145,7 @@ export interface NTableLoadingProps {
145
145
  colspan?: number;
146
146
  _tableCell?: NTableCellProps;
147
147
  _tableRow?: NTableRowProps;
148
- una?: Pick<NTableUnaProps, 'tableLoading'>;
148
+ una?: Pick<NTableUnaProps, 'tableLoading' | 'tableRow' | 'tableCell'>;
149
149
  }
150
150
  export interface NTableCaptionProps {
151
151
  class?: HTMLAttributes['class'];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@una-ui/nuxt",
3
3
  "type": "module",
4
- "version": "0.23.0-beta.1",
4
+ "version": "0.25.0-beta.1",
5
5
  "description": "Nuxt module for @una-ui",
6
6
  "author": "Phojie Rengel <phojrengel@gmail.com>",
7
7
  "license": "MIT",
@@ -26,35 +26,35 @@
26
26
  "dist"
27
27
  ],
28
28
  "dependencies": {
29
- "@headlessui/vue": "^1.7.22",
29
+ "@headlessui/vue": "^1.7.23",
30
30
  "@iconify-json/heroicons": "^1.2.0",
31
- "@iconify-json/lucide": "^1.2.2",
31
+ "@iconify-json/lucide": "^1.2.6",
32
32
  "@iconify-json/radix-icons": "^1.2.0",
33
- "@iconify-json/tabler": "^1.2.0",
34
- "@nuxt/kit": "^3.13.1",
35
- "@nuxtjs/color-mode": "^3.4.4",
33
+ "@iconify-json/tabler": "^1.2.4",
34
+ "@nuxt/kit": "^3.13.2",
35
+ "@nuxtjs/color-mode": "^3.5.1",
36
36
  "@tanstack/vue-table": "^8.20.5",
37
- "@unocss/core": "^0.62.4",
38
- "@unocss/nuxt": "^0.62.4",
39
- "@unocss/preset-attributify": "^0.62.4",
40
- "@unocss/preset-icons": "^0.62.4",
41
- "@vueuse/core": "^10.11.1",
42
- "@vueuse/integrations": "^10.11.1",
43
- "@vueuse/nuxt": "^10.11.1",
37
+ "@unocss/core": "^0.63.1",
38
+ "@unocss/nuxt": "^0.63.1",
39
+ "@unocss/preset-attributify": "^0.63.1",
40
+ "@unocss/preset-icons": "^0.63.1",
41
+ "@vueuse/core": "^11.1.0",
42
+ "@vueuse/integrations": "^11.1.0",
43
+ "@vueuse/nuxt": "^11.1.0",
44
44
  "clsx": "^2.1.1",
45
- "ohash": "^1.1.3",
46
- "radix-vue": "^1.9.5",
45
+ "ohash": "^1.1.4",
46
+ "radix-vue": "^1.9.6",
47
47
  "tailwind-merge": "^2.5.2",
48
- "typescript": "^5.5.4",
49
- "unocss": "^0.62.4",
48
+ "typescript": "^5.6.2",
49
+ "unocss": "^0.63.1",
50
50
  "unocss-preset-animations": "^1.1.0",
51
- "@una-ui/extractor-vue-script": "^0.23.0-beta.1",
52
- "@una-ui/preset": "^0.23.0-beta.1"
51
+ "@una-ui/extractor-vue-script": "^0.25.0-beta.1",
52
+ "@una-ui/preset": "^0.25.0-beta.1"
53
53
  },
54
54
  "devDependencies": {
55
- "@nuxt/module-builder": "^0.8.1",
56
- "@nuxt/schema": "^3.13.1",
57
- "nuxt": "^3.13.1"
55
+ "@nuxt/module-builder": "^0.8.4",
56
+ "@nuxt/schema": "^3.13.2",
57
+ "nuxt": "^3.13.2"
58
58
  },
59
59
  "publishConfig": {
60
60
  "access": "public"