@polymarbot/nuxt-layer-shadcn-ui 0.3.4 → 0.3.6

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.
@@ -22,57 +22,51 @@ withDefaults(defineProps<AdminLayoutProps>(), {
22
22
  </script>
23
23
 
24
24
  <template>
25
- <!-- Wrap with a real DOM element to avoid Vue <Transition> warning.
26
- SidebarProvider's root is reka-ui TooltipProvider (renderless), which
27
- Nuxt's layoutTransition cannot animate. `display: contents` keeps
28
- layout unaffected. -->
29
- <div class="contents">
30
- <SidebarProvider>
31
- <Sidebar
32
- :variant="variant"
33
- :collapsible="collapsible"
34
- >
35
- <SidebarHeader>
36
- <slot name="header">
37
- <SidebarDropdown
38
- v-if="headerDropdown"
39
- :profile="headerDropdown.profile"
40
- :menuItems="headerDropdown.menuItems"
41
- />
42
- </slot>
43
- </SidebarHeader>
25
+ <SidebarProvider>
26
+ <Sidebar
27
+ :variant="variant"
28
+ :collapsible="collapsible"
29
+ >
30
+ <SidebarHeader>
31
+ <slot name="header">
32
+ <SidebarDropdown
33
+ v-if="headerDropdown"
34
+ :profile="headerDropdown.profile"
35
+ :menuItems="headerDropdown.menuItems"
36
+ />
37
+ </slot>
38
+ </SidebarHeader>
44
39
 
45
- <SidebarContent>
46
- <SidebarMenus :menus="menus" />
47
- </SidebarContent>
40
+ <SidebarContent>
41
+ <SidebarMenus :menus="menus" />
42
+ </SidebarContent>
48
43
 
49
- <SidebarFooter>
50
- <slot name="footer">
51
- <SidebarDropdown
52
- v-if="footerDropdown"
53
- :profile="footerDropdown.profile"
54
- :menuItems="footerDropdown.menuItems"
55
- />
56
- </slot>
57
- </SidebarFooter>
44
+ <SidebarFooter>
45
+ <slot name="footer">
46
+ <SidebarDropdown
47
+ v-if="footerDropdown"
48
+ :profile="footerDropdown.profile"
49
+ :menuItems="footerDropdown.menuItems"
50
+ />
51
+ </slot>
52
+ </SidebarFooter>
58
53
 
59
- <SidebarRail />
60
- </Sidebar>
54
+ <SidebarRail />
55
+ </Sidebar>
61
56
 
62
- <SidebarInset class="min-w-0">
63
- <Navbar>
64
- <div class="flex flex-1 items-center gap-3">
65
- <slot name="navbar-left" />
66
- </div>
67
- <div class="flex items-center gap-3">
68
- <slot name="navbar-right" />
69
- </div>
70
- </Navbar>
71
-
72
- <div class="flex-1 overflow-auto">
73
- <slot />
57
+ <SidebarInset class="min-w-0">
58
+ <Navbar>
59
+ <div class="gap-3 flex flex-1 items-center">
60
+ <slot name="navbar-left" />
61
+ </div>
62
+ <div class="gap-3 flex items-center">
63
+ <slot name="navbar-right" />
74
64
  </div>
75
- </SidebarInset>
76
- </SidebarProvider>
77
- </div>
65
+ </Navbar>
66
+
67
+ <div class="flex-1 overflow-auto">
68
+ <slot />
69
+ </div>
70
+ </SidebarInset>
71
+ </SidebarProvider>
78
72
  </template>
@@ -29,7 +29,7 @@ const props = withDefaults(defineProps<AsyncDataTableProps<TData>>(), {
29
29
  const emit = defineEmits<{
30
30
  'update:filters': [filters: Record<string, any>]
31
31
  'update:selection': [value: TData[]]
32
- 'rowClick': [row: TData, event: MouseEvent]
32
+ 'rowClick': [row: TData, index: number, event: MouseEvent]
33
33
  }>()
34
34
 
35
35
  const T = useTranslations('components.ui.AsyncDataTable')
@@ -264,7 +264,7 @@ onMounted(() => {
264
264
  @update:selection="onSelectionChange"
265
265
  @update:sortBy="onSortByUpdate"
266
266
  @update:sortOrder="onSortOrderUpdate"
267
- @rowClick="(row: TData, event: MouseEvent) => emit('rowClick', row, event)"
267
+ @rowClick="(row: TData, index: number, event: MouseEvent) => emit('rowClick', row, index, event)"
268
268
  >
269
269
  <template
270
270
  v-for="name in Object.keys($slots).filter(n => n !== 'toolbar')"
@@ -31,7 +31,7 @@ const props = withDefaults(defineProps<DataTableProps<TData>>(), {
31
31
  const emit = defineEmits<{
32
32
  'update:sortBy': [value: string | null]
33
33
  'update:sortOrder': [value: number | null]
34
- 'rowClick': [row: TData, event: MouseEvent]
34
+ 'rowClick': [row: TData, index: number, event: MouseEvent]
35
35
  }>()
36
36
 
37
37
  const selection = defineModel<TData | TData[] | null>('selection', { default: null })
@@ -93,8 +93,8 @@ function toggleRow (row: TData) {
93
93
  }
94
94
  }
95
95
 
96
- function onRowClick (row: TData, event: MouseEvent) {
97
- emit('rowClick', row, event)
96
+ function onRowClick (row: TData, index: number, event: MouseEvent) {
97
+ emit('rowClick', row, index, event)
98
98
  if (showSelectionColumn.value) toggleRow(row)
99
99
  }
100
100
 
@@ -358,7 +358,7 @@ const selectionColumnShadowDir = computed<FrozenShadow | undefined>(() =>
358
358
  :key="index"
359
359
  :class="(showSelectionColumn || clickable) && 'cursor-pointer'"
360
360
  :data-state="isRowSelected(row) ? 'selected' : undefined"
361
- @click="onRowClick(row, $event)"
361
+ @click="onRowClick(row, index, $event)"
362
362
  >
363
363
  <!-- Selection cell: stop click to prevent double toggle with row click -->
364
364
  <TableCell
@@ -16,8 +16,8 @@ const errorArray = computed(() => {
16
16
  })
17
17
 
18
18
  const labelClass = computed(() => {
19
- if (props.orientation === 'horizontal') return '!flex-initial mt-2'
20
- if (props.orientation === 'responsive') return '@md/field-group:!flex-initial @md/field-group:mt-2'
19
+ if (props.orientation === 'horizontal') return 'justify-end text-right mt-2'
20
+ if (props.orientation === 'responsive') return '@md/field-group:justify-end @md/field-group:text-right @md/field-group:mt-2'
21
21
  return undefined
22
22
  })
23
23
  </script>
@@ -43,8 +43,14 @@ const pageReport = computed(() => {
43
43
  return T('pageReport', { first, last, total: props.total })
44
44
  })
45
45
 
46
+ const pageItemClass = computed(() => props.size === 'sm'
47
+ ? 'min-w-8 w-auto! px-1.5'
48
+ : 'min-w-9 w-auto! px-2',
49
+ )
50
+
46
51
  const activePageClass = computed(() => cn(
47
52
  buttonVariants({ variant: 'default', size: iconButtonSize.value }),
53
+ pageItemClass.value,
48
54
  `
49
55
  hover:text-primary-foreground
50
56
  dark:hover:bg-primary/90
@@ -65,7 +71,7 @@ const pageSizeMenuItems = computed<DropdownItem[]>(() =>
65
71
  <template>
66
72
  <div
67
73
  v-if="hasData"
68
- class="flex items-center gap-2"
74
+ class="gap-2 flex items-center"
69
75
  >
70
76
  <!-- Simple mode: ‹ 1/9 › -->
71
77
  <template v-if="simple">
@@ -86,7 +92,7 @@ const pageSizeMenuItems = computed<DropdownItem[]>(() =>
86
92
  <Icon name="chevron-left" />
87
93
  </Button>
88
94
  <span
89
- class="min-w-12 text-center text-sm text-muted-foreground tabular-nums"
95
+ class="min-w-12 text-sm text-muted-foreground text-center tabular-nums"
90
96
  >
91
97
  {{ page }} / {{ totalPages }}
92
98
  </span>
@@ -110,7 +116,7 @@ const pageSizeMenuItems = computed<DropdownItem[]>(() =>
110
116
 
111
117
  <!-- Full mode -->
112
118
  <template v-else>
113
- <span class="text-sm whitespace-nowrap text-muted-foreground">
119
+ <span class="text-sm text-muted-foreground whitespace-nowrap">
114
120
  {{ pageReport }}
115
121
  </span>
116
122
  <ShadcnPagination
@@ -135,7 +141,7 @@ const pageSizeMenuItems = computed<DropdownItem[]>(() =>
135
141
  :key="index"
136
142
  :value="item.value"
137
143
  :size="iconButtonSize"
138
- :class="item.value === page ? activePageClass : ''"
144
+ :class="item.value === page ? activePageClass : pageItemClass"
139
145
  >
140
146
  {{ item.value }}
141
147
  </PaginationItem>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polymarbot/nuxt-layer-shadcn-ui",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Nuxt layer providing shadcn-vue based UI components",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -42,5 +42,5 @@
42
42
  "vue-i18n": "^11",
43
43
  "vue-router": "^4 || ^5"
44
44
  },
45
- "gitHead": "39ac87e0e1062027fbe9691cdf9d091f74a8f0ad"
45
+ "gitHead": "1cab3200649169317e33b3677a1ad906b6ba4683"
46
46
  }