@una-ui/nuxt 0.50.4 → 0.51.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.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@una-ui/nuxt",
3
3
  "configKey": "una",
4
- "version": "0.50.4",
4
+ "version": "0.51.0",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.0.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -8,7 +8,7 @@ import 'unocss';
8
8
  import 'unocss-preset-animations';
9
9
 
10
10
  const name = "@una-ui/nuxt";
11
- const version = "0.50.4";
11
+ const version = "0.51.0";
12
12
 
13
13
  const module = defineNuxtModule({
14
14
  meta: {
@@ -7,8 +7,10 @@ import type {
7
7
  GroupingState,
8
8
  Header,
9
9
  PaginationState,
10
+ Row,
10
11
  RowSelectionState,
11
12
  SortingState,
13
+ Table,
12
14
  VisibilityState,
13
15
  } from '@tanstack/vue-table'
14
16
  import type { NTableProps } from '../../../types'
@@ -44,7 +46,12 @@ const props = withDefaults(defineProps <NTableProps<TData, TValue>>(), {
44
46
  enableSortingRemoval: true,
45
47
  })
46
48
 
47
- const emit = defineEmits(['select', 'selectAll', 'expand'])
49
+ const emit = defineEmits<{
50
+ select: [row: TData]
51
+ selectAll: [rows: TData[]]
52
+ expand: [row: TData]
53
+ row: [event: Event, row: TData]
54
+ }>()
48
55
 
49
56
  const slots = defineSlots()
50
57
 
@@ -73,22 +80,28 @@ const columnsWithMisc = computed(() => {
73
80
  {
74
81
  accessorKey: 'selection',
75
82
  header: props.enableMultiRowSelection
76
- ? ({ table }: any) => h(Checkbox, {
83
+ ? ({ table }: { table: Table<TData> }) => h(Checkbox, {
77
84
  'modelValue': table.getIsAllPageRowsSelected() || (table.getIsSomePageRowsSelected() && 'indeterminate'),
78
85
  'onUpdate:modelValue': (value: boolean | 'indeterminate' | null) => {
79
86
  table.toggleAllPageRowsSelected(!!value)
80
- emit('selectAll', table.getRowModel().rows)
87
+ emit('selectAll', table.getRowModel().rows.map(row => row.original))
81
88
  },
82
89
  'areaLabel': 'Select all rows',
90
+ 'onClick': (event: Event) => {
91
+ event.stopPropagation()
92
+ },
83
93
  })
84
94
  : '',
85
- cell: ({ row }: any) => h(Checkbox, {
95
+ cell: ({ row }: { row: Row<TData> }) => h(Checkbox, {
86
96
  'modelValue': row.getIsSelected() ?? false,
87
97
  'onUpdate:modelValue': (value: boolean | 'indeterminate' | null) => {
88
98
  row.toggleSelected(!!value)
89
- emit('select', row)
99
+ emit('select', row.original)
90
100
  },
91
101
  'areaLabel': 'Select row',
102
+ 'onClick': (event: Event) => {
103
+ event.stopPropagation()
104
+ },
92
105
  }),
93
106
  enableSorting: false,
94
107
  },
@@ -340,6 +353,7 @@ defineExpose({
340
353
  :data-state="row.getIsSelected() && 'selected'"
341
354
  :una
342
355
  v-bind="props._tableRow"
356
+ @click="emit('row', $event, row.original)"
343
357
  >
344
358
  <slot
345
359
  name="row"
@@ -1,19 +1,25 @@
1
1
  <script setup lang="ts">
2
2
  import type { NTableBodyProps } from '../../../types'
3
+ import { reactiveOmit } from '@vueuse/core'
4
+ import { Primitive } from 'reka-ui'
3
5
  import { cn } from '../../../utils'
4
6
 
5
- const props = defineProps<NTableBodyProps>()
7
+ const props = withDefaults(defineProps<NTableBodyProps>(), {
8
+ as: 'tbody',
9
+ })
10
+
11
+ const rootProps = reactiveOmit(props, ['una', 'class'])
6
12
  </script>
7
13
 
8
14
  <template>
9
- <tbody
15
+ <Primitive
10
16
  :class="cn(
11
17
  'table-body',
12
18
  props?.una?.tableBody,
13
19
  props.class,
14
20
  )"
15
- v-bind="$attrs"
21
+ v-bind="{ ...rootProps, ...$attrs }"
16
22
  >
17
23
  <slot />
18
- </tbody>
24
+ </Primitive>
19
25
  </template>
@@ -1,19 +1,25 @@
1
1
  <script setup lang="ts">
2
2
  import type { NTableCaptionProps } from '../../../types'
3
+ import { reactiveOmit } from '@vueuse/core'
4
+ import { Primitive } from 'reka-ui'
3
5
  import { cn } from '../../../utils'
4
6
 
5
- const props = defineProps<NTableCaptionProps>()
7
+ const props = withDefaults(defineProps<NTableCaptionProps>(), {
8
+ as: 'caption',
9
+ })
10
+
11
+ const rootProps = reactiveOmit(props, ['una', 'class'])
6
12
  </script>
7
13
 
8
14
  <template>
9
- <caption
15
+ <Primitive
10
16
  :class="cn(
11
17
  'table-caption',
12
18
  props?.una?.tableCaption,
13
19
  props.class,
14
20
  )"
15
- v-bind="$attrs"
21
+ v-bind="{ ...rootProps, ...$attrs } "
16
22
  >
17
23
  <slot />
18
- </caption>
24
+ </Primitive>
19
25
  </template>
@@ -1,12 +1,18 @@
1
1
  <script setup lang="ts">
2
2
  import type { NTableCellProps } from '../../../types'
3
+ import { reactiveOmit } from '@vueuse/core'
4
+ import { Primitive } from 'reka-ui'
3
5
  import { cn } from '../../../utils'
4
6
 
5
- const props = defineProps<NTableCellProps>()
7
+ const props = withDefaults(defineProps<NTableCellProps>(), {
8
+ as: 'td',
9
+ })
10
+
11
+ const rootProps = reactiveOmit(props, ['una', 'class'])
6
12
  </script>
7
13
 
8
14
  <template>
9
- <td
15
+ <Primitive
10
16
  :class="
11
17
  cn(
12
18
  'table-cell',
@@ -16,8 +22,8 @@ const props = defineProps<NTableCellProps>()
16
22
  dataPinned === 'left' ? 'table-cell-pinned-left' : 'table-cell-pinned-right',
17
23
  )
18
24
  "
19
- v-bind="$attrs"
25
+ v-bind="{ ...rootProps, ...$attrs }"
20
26
  >
21
27
  <slot />
22
- </td>
28
+ </Primitive>
23
29
  </template>
@@ -1,18 +1,25 @@
1
1
  <script setup lang="ts">
2
2
  import type { NTableFooterProps } from '../../../types'
3
+ import { reactiveOmit } from '@vueuse/core'
4
+ import { Primitive } from 'reka-ui'
3
5
  import { cn } from '../../../utils'
4
6
 
5
- const props = defineProps<NTableFooterProps>()
7
+ const props = withDefaults(defineProps<NTableFooterProps>(), {
8
+ as: 'tfoot',
9
+ })
10
+
11
+ const rootProps = reactiveOmit(props, ['una', 'class'])
6
12
  </script>
7
13
 
8
14
  <template>
9
- <tfoot
15
+ <Primitive
10
16
  :class="cn(
11
17
  'table-footer',
12
18
  props.una?.tableFooter,
13
19
  props.class,
14
20
  )"
21
+ v-bind="{ ...rootProps, ...$attrs }"
15
22
  >
16
23
  <slot />
17
- </tfoot>
24
+ </Primitive>
18
25
  </template>
@@ -1,12 +1,18 @@
1
1
  <script setup lang="ts">
2
2
  import type { NTableHeadProps } from '../../../types'
3
+ import { reactiveOmit } from '@vueuse/core'
4
+ import { Primitive } from 'reka-ui'
3
5
  import { cn } from '../../../utils'
4
6
 
5
- const props = defineProps<NTableHeadProps>()
7
+ const props = withDefaults(defineProps<NTableHeadProps>(), {
8
+ as: 'th',
9
+ })
10
+
11
+ const rootProps = reactiveOmit(props, ['una', 'class'])
6
12
  </script>
7
13
 
8
14
  <template>
9
- <th
15
+ <Primitive
10
16
  :class="cn(
11
17
  'table-head',
12
18
  props.una?.tableHead,
@@ -14,8 +20,8 @@ const props = defineProps<NTableHeadProps>()
14
20
  { 'table-head-pinned': props.dataPinned },
15
21
  props.dataPinned === 'left' ? 'table-head-pinned-left' : 'table-head-pinned-right',
16
22
  )"
17
- v-bind="$attrs"
23
+ v-bind="{ ...rootProps, ...$attrs }"
18
24
  >
19
25
  <slot />
20
- </th>
26
+ </Primitive>
21
27
  </template>
@@ -1,19 +1,25 @@
1
1
  <script setup lang="ts">
2
2
  import type { NTableHeaderProps } from '../../../types'
3
+ import { reactiveOmit } from '@vueuse/core'
4
+ import { Primitive } from 'reka-ui'
3
5
  import { cn } from '../../../utils'
4
6
 
5
- const props = defineProps<NTableHeaderProps>()
7
+ const props = withDefaults(defineProps<NTableHeaderProps>(), {
8
+ as: 'thead',
9
+ })
10
+
11
+ const rootProps = reactiveOmit(props, ['una', 'class'])
6
12
  </script>
7
13
 
8
14
  <template>
9
- <thead
15
+ <Primitive
10
16
  :class="cn(
11
17
  'table-header',
12
18
  props?.una?.tableHeader,
13
19
  props.class,
14
20
  )"
15
- v-bind="$attrs"
21
+ v-bind="{ ...rootProps, ...$attrs }"
16
22
  >
17
23
  <slot />
18
- </thead>
24
+ </Primitive>
19
25
  </template>
@@ -1,19 +1,25 @@
1
1
  <script setup lang="ts">
2
2
  import type { NTableRowProps } from '../../../types'
3
+ import { reactiveOmit } from '@vueuse/core'
4
+ import { Primitive } from 'reka-ui'
3
5
  import { cn } from '../../../utils'
4
6
 
5
- const props = defineProps<NTableRowProps>()
7
+ const props = withDefaults(defineProps<NTableRowProps>(), {
8
+ as: 'tr',
9
+ })
10
+
11
+ const rootProps = reactiveOmit(props, ['una', 'class'])
6
12
  </script>
7
13
 
8
14
  <template>
9
- <tr
15
+ <Primitive
10
16
  :class="cn(
11
17
  'table-row',
12
18
  props.una?.tableRow,
13
19
  props.class,
14
20
  )"
15
- v-bind="$attrs"
21
+ v-bind="{ ...rootProps, ...$attrs }"
16
22
  >
17
23
  <slot />
18
- </tr>
24
+ </Primitive>
19
25
  </template>
@@ -10,7 +10,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
10
10
  required: false;
11
11
  };
12
12
  modelValue: {
13
- type: (NumberConstructor | StringConstructor | BooleanConstructor)[];
13
+ type: (NumberConstructor | BooleanConstructor | StringConstructor)[];
14
14
  required: false;
15
15
  };
16
16
  id: {
@@ -38,7 +38,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
38
38
  required: false;
39
39
  };
40
40
  modelValue: {
41
- type: (NumberConstructor | StringConstructor | BooleanConstructor)[];
41
+ type: (NumberConstructor | BooleanConstructor | StringConstructor)[];
42
42
  required: false;
43
43
  };
44
44
  id: {
@@ -1,2 +1,2 @@
1
- declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
1
+ declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
1
+ declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
2
2
  export default _default;
@@ -125,5 +125,17 @@ export interface NButtonProps extends BaseExtensionProps {
125
125
  btnLeading?: string;
126
126
  btnLoadingIcon?: string;
127
127
  };
128
+ /**
129
+ * Support for `@click` event handler.
130
+ *
131
+ * This property is explicitly defined to provide proper TypeScript support when:
132
+ * 1. Using the component with dynamic properties (e.g., v-bind="props")
133
+ * 2. Passing event handlers via object syntax in parent components
134
+ * 3. Using camelCase event handlers in JSX/TSX contexts
135
+ *
136
+ * Without this definition, TypeScript would raise type errors when trying to pass
137
+ * an onClick handler to the component through object properties.
138
+ */
139
+ onClick?: (e: Event) => void;
128
140
  }
129
141
  export {};
@@ -1,4 +1,5 @@
1
1
  import type { ColumnDef, CoreOptions, GroupColumnDef } from '@tanstack/vue-table';
2
+ import type { PrimitiveProps } from 'reka-ui';
2
3
  import type { HTMLAttributes } from 'vue';
3
4
  import type { NProgressProps } from './progress.js';
4
5
  import type { NScrollAreaProps, NScrollAreaUnaProps } from './scroll-area.js';
@@ -122,28 +123,28 @@ export interface NTableProps<TData, TValue> extends Omit<CoreOptions<TData>, 'da
122
123
  */
123
124
  una?: NTableUnaProps & NScrollAreaUnaProps;
124
125
  }
125
- export interface NTableBodyProps {
126
+ export interface NTableBodyProps extends PrimitiveProps {
126
127
  class?: HTMLAttributes['class'];
127
128
  una?: Pick<NTableUnaProps, 'tableBody'>;
128
129
  }
129
- export interface NTableHeadProps {
130
+ export interface NTableHeadProps extends PrimitiveProps {
130
131
  class?: HTMLAttributes['class'];
131
132
  dataPinned?: 'left' | 'right' | false;
132
133
  una?: Pick<NTableUnaProps, 'tableHead'>;
133
134
  }
134
- export interface NTableHeaderProps {
135
+ export interface NTableHeaderProps extends PrimitiveProps {
135
136
  class?: HTMLAttributes['class'];
136
137
  una?: Pick<NTableUnaProps, 'tableHeader'>;
137
138
  }
138
- export interface NTableFooterProps {
139
+ export interface NTableFooterProps extends PrimitiveProps {
139
140
  class?: HTMLAttributes['class'];
140
141
  una?: Pick<NTableUnaProps, 'tableFooter'>;
141
142
  }
142
- export interface NTableRowProps {
143
+ export interface NTableRowProps extends PrimitiveProps {
143
144
  class?: HTMLAttributes['class'];
144
145
  una?: Pick<NTableUnaProps, 'tableRow'>;
145
146
  }
146
- export interface NTableCellProps {
147
+ export interface NTableCellProps extends PrimitiveProps {
147
148
  class?: HTMLAttributes['class'];
148
149
  dataPinned?: 'left' | 'right' | false;
149
150
  una?: Pick<NTableUnaProps, 'tableCell'>;
@@ -165,7 +166,7 @@ export interface NTableLoadingProps {
165
166
  _tableProgress?: NProgressProps;
166
167
  una?: Pick<NTableUnaProps, 'tableLoading' | 'tableLoadingCell' | 'tableLoadingRow'>;
167
168
  }
168
- export interface NTableCaptionProps {
169
+ export interface NTableCaptionProps extends PrimitiveProps {
169
170
  class?: HTMLAttributes['class'];
170
171
  una?: Pick<NTableUnaProps, 'tableCaption'>;
171
172
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@una-ui/nuxt",
3
3
  "type": "module",
4
- "version": "0.50.4",
4
+ "version": "0.51.0",
5
5
  "description": "Nuxt module for @una-ui",
6
6
  "author": "Phojie Rengel <phojrengel@gmail.com>",
7
7
  "license": "MIT",
@@ -59,8 +59,8 @@
59
59
  "typescript": "5.6.3",
60
60
  "unocss": "^66.0.0",
61
61
  "unocss-preset-animations": "^1.1.1",
62
- "@una-ui/extractor-vue-script": "^0.50.4",
63
- "@una-ui/preset": "^0.50.4"
62
+ "@una-ui/extractor-vue-script": "^0.51.0",
63
+ "@una-ui/preset": "^0.51.0"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@iconify-json/lucide": "^1.2.34",