@bjj/nuxt-layer-shadcn-ui 0.11.7 → 0.11.8

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 (35) hide show
  1. package/app/components/ui/Accordion/index.vue +2 -2
  2. package/app/components/ui/AdminLayout/Navbar.vue +4 -0
  3. package/app/components/ui/AdminLayout/index.vue +8 -0
  4. package/app/components/ui/AsyncDataTable/index.vue +6 -0
  5. package/app/components/ui/Avatar/index.vue +4 -0
  6. package/app/components/ui/Badge/index.vue +4 -0
  7. package/app/components/ui/Button/index.vue +2 -2
  8. package/app/components/ui/ButtonGroup/index.vue +7 -2
  9. package/app/components/ui/Card/index.vue +6 -0
  10. package/app/components/ui/CopyButton/index.vue +4 -0
  11. package/app/components/ui/DataTable/index.vue +7 -13
  12. package/app/components/ui/Divider/index.vue +4 -0
  13. package/app/components/ui/Drawer/index.vue +8 -0
  14. package/app/components/ui/FormItem/index.vue +5 -0
  15. package/app/components/ui/Help/index.vue +6 -1
  16. package/app/components/ui/InfiniteDataTable/index.vue +6 -0
  17. package/app/components/ui/Input/index.vue +5 -5
  18. package/app/components/ui/Markdown/index.vue +4 -0
  19. package/app/components/ui/Modal/index.vue +8 -0
  20. package/app/components/ui/ModalContent/index.vue +5 -1
  21. package/app/components/ui/PageCard/index.vue +15 -5
  22. package/app/components/ui/Popover/index.vue +5 -0
  23. package/app/components/ui/RadioGroup/index.vue +1 -1
  24. package/app/components/ui/ScrollArea/index.vue +4 -0
  25. package/app/components/ui/SearchSelect/index.vue +6 -0
  26. package/app/components/ui/Select/index.vue +7 -0
  27. package/app/components/ui/StaticDataTable/index.vue +5 -0
  28. package/app/components/ui/Steps/index.vue +2 -2
  29. package/app/components/ui/Surface/index.vue +4 -0
  30. package/app/components/ui/Tabs/index.vue +2 -2
  31. package/app/components/ui/Tag/index.vue +6 -2
  32. package/app/components/ui/Tooltip/index.vue +4 -0
  33. package/app/components/ui/Upload/index.vue +1 -1
  34. package/app/components/ui/WebLink/index.vue +4 -0
  35. package/package.json +2 -2
@@ -22,8 +22,8 @@ const emit = defineEmits<{
22
22
  }>()
23
23
 
24
24
  defineSlots<{
25
- title?: (props: { item: AccordionItem, open: boolean }) => unknown
26
- content?: (props: { item: AccordionItem, open: boolean }) => unknown
25
+ title?: (props: { item: AccordionItem, open: boolean }) => any
26
+ content?: (props: { item: AccordionItem, open: boolean }) => any
27
27
  }>()
28
28
 
29
29
  const rootProps = computed<AccordionRootProps>(() => {
@@ -5,6 +5,10 @@ const props = defineProps<{
5
5
  class?: ClassValue
6
6
  }>()
7
7
 
8
+ defineSlots<{
9
+ default?: () => any
10
+ }>()
11
+
8
12
  const mergedClass = computed(() =>
9
13
  cn(
10
14
  `
@@ -21,6 +21,14 @@ const props = withDefaults(defineProps<AdminLayoutProps>(), {
21
21
  contentClass: undefined,
22
22
  })
23
23
 
24
+ defineSlots<{
25
+ 'default'?: () => any
26
+ 'header'?: () => any
27
+ 'footer'?: () => any
28
+ 'navbar-left'?: () => any
29
+ 'navbar-right'?: () => any
30
+ }>()
31
+
24
32
  const mergedContentClass = computed(() =>
25
33
  cn('flex-1 overflow-auto', props.contentClass),
26
34
  )
@@ -31,6 +31,12 @@ const emit = defineEmits<{
31
31
  'rowClick': [row: TData, index: number, event: MouseEvent]
32
32
  }>()
33
33
 
34
+ defineSlots<{
35
+ toolbar?: () => any
36
+ empty?: () => any
37
+ [key: string]: ((props?: any) => any) | undefined
38
+ }>()
39
+
34
40
  const { t } = useI18n()
35
41
  const T = useTranslations('components.ui.AsyncDataTable')
36
42
  const { isMobile } = useDevice()
@@ -15,6 +15,10 @@ const props = withDefaults(defineProps<AvatarProps>(), {
15
15
  class: undefined,
16
16
  })
17
17
 
18
+ defineSlots<{
19
+ default?: () => any
20
+ }>()
21
+
18
22
  // Map our size names to shadcn avatar variant sizes
19
23
  const sizeClasses: Record<string, string> = {
20
24
  small: 'size-8 text-xs',
@@ -3,6 +3,10 @@ import { Badge as ShadcnBadge } from '../../shadcn/badge'
3
3
  import type { BadgeProps } from './types'
4
4
 
5
5
  defineProps<BadgeProps>()
6
+
7
+ defineSlots<{
8
+ default?: () => any
9
+ }>()
6
10
  </script>
7
11
 
8
12
  <template>
@@ -31,9 +31,9 @@ const mergedClass = computed(() => cn(
31
31
  ))
32
32
 
33
33
  const isLink = computed(() => !!props.href || !!props.to)
34
- const hasIcon = computed(() => !!$slots.icon || !!props.icon)
34
+ const hasIcon = computed(() => !!slots.icon || !!props.icon)
35
35
  const isIconEnd = computed(() => props.iconPosition === 'end')
36
- const $slots = defineSlots<{
36
+ const slots = defineSlots<{
37
37
  default?: () => any
38
38
  icon?: () => any
39
39
  }>()
@@ -3,12 +3,17 @@ import type { ButtonGroupProps } from './types'
3
3
 
4
4
  const props = defineProps<ButtonGroupProps>()
5
5
 
6
+ defineSlots<{
7
+ default?: () => any
8
+ }>()
9
+
6
10
  const mergedClass = computed(() => cn(`
11
+ [&>*:first-child]:rounded-l-md
12
+ [&>*:last-child]:rounded-r-md
7
13
  inline-flex items-center
8
14
  *:rounded-none *:border-r-0
9
- [&>*:first-child]:rounded-l-md
10
15
  [&>*:focus-visible]:relative [&>*:focus-visible]:z-10
11
- [&>*:last-child]:rounded-r-md [&>*:last-child]:border-r
16
+ [&>*:last-child]:border-r
12
17
  `, props.class))
13
18
  </script>
14
19
 
@@ -9,6 +9,12 @@ import {
9
9
  import type { CardProps } from './types'
10
10
 
11
11
  defineProps<CardProps>()
12
+
13
+ defineSlots<{
14
+ default?: () => any
15
+ header?: () => any
16
+ footer?: () => any
17
+ }>()
12
18
  </script>
13
19
 
14
20
  <template>
@@ -5,6 +5,10 @@ defineOptions({ inheritAttrs: false })
5
5
 
6
6
  const props = defineProps<CopyButtonProps>()
7
7
 
8
+ defineSlots<{
9
+ default?: () => any
10
+ }>()
11
+
8
12
  const T = useTranslations('components.ui.CopyButton')
9
13
 
10
14
  const isCopied = ref(false)
@@ -38,19 +38,13 @@ const emit = defineEmits<{
38
38
 
39
39
  const selection = defineModel<TData | TData[] | null>('selection', { default: null })
40
40
 
41
- defineSlots<
42
- Record<string, (_: {
43
- column: DataTableColumn
44
- row: TData
45
- value: unknown
46
- index: number
47
- }) => any> & {
48
- empty?: () => any
49
- footer?: () => any
50
- bodyStart?: () => any
51
- bodyEnd?: () => any
52
- } & Record<`header-${string}`, (_: { column: DataTableColumn }) => any>
53
- >()
41
+ defineSlots<{
42
+ empty?: () => any
43
+ footer?: () => any
44
+ bodyStart?: () => any
45
+ bodyEnd?: () => any
46
+ [key: string]: ((props?: any) => any) | undefined
47
+ }>()
54
48
 
55
49
  const T = useTranslations('components.ui.DataTable')
56
50
  const { formatDateTime } = useDate()
@@ -5,6 +5,10 @@ import type { DividerProps } from './types'
5
5
  withDefaults(defineProps<DividerProps>(), {
6
6
  type: 'horizontal',
7
7
  })
8
+
9
+ defineSlots<{
10
+ default?: () => any
11
+ }>()
8
12
  </script>
9
13
 
10
14
  <template>
@@ -38,6 +38,14 @@ const emit = defineEmits<{
38
38
  'cancel': []
39
39
  }>()
40
40
 
41
+ defineSlots<{
42
+ default?: () => any
43
+ trigger?: () => any
44
+ header?: () => any
45
+ footer?: () => any
46
+ footerLeft?: () => any
47
+ }>()
48
+
41
49
  const { t } = useI18n()
42
50
 
43
51
  const resolvedConfirmText = computed(
@@ -10,6 +10,11 @@ import type { FormItemProps } from './types'
10
10
 
11
11
  const props = defineProps<FormItemProps>()
12
12
 
13
+ defineSlots<{
14
+ default?: () => any
15
+ description?: () => any
16
+ }>()
17
+
13
18
  useFormItemInvalid(() => !!props.error)
14
19
 
15
20
  const errorArray = computed(() => {
@@ -7,11 +7,16 @@ const props = withDefaults(defineProps<HelpProps>(), {
7
7
  class: undefined,
8
8
  })
9
9
 
10
+ defineSlots<{
11
+ default?: () => any
12
+ }>()
13
+
10
14
  const mergedClass = computed(() =>
11
15
  cn(
12
16
  `
13
- flex items-center justify-center text-muted-foreground transition-colors
17
+ text-muted-foreground
14
18
  hover:text-foreground
19
+ flex items-center justify-center transition-colors
15
20
  `,
16
21
  props.class,
17
22
  ),
@@ -17,6 +17,12 @@ const emit = defineEmits<{
17
17
  'rowClick': [row: TData, index: number, event: MouseEvent]
18
18
  }>()
19
19
 
20
+ defineSlots<{
21
+ footer?: () => any
22
+ bodyEnd?: () => any
23
+ [key: string]: ((props?: any) => any) | undefined
24
+ }>()
25
+
20
26
  const { t } = useI18n()
21
27
  const T = useTranslations('components.ui.InfiniteDataTable')
22
28
 
@@ -18,9 +18,9 @@ const emit = defineEmits<{
18
18
 
19
19
  const isInvalid = useFormItemInvalid(() => props.invalid)
20
20
 
21
- const $slots = defineSlots<{
22
- prefix?: () => unknown
23
- suffix?: () => unknown
21
+ const slots = defineSlots<{
22
+ prefix?: () => any
23
+ suffix?: () => any
24
24
  }>()
25
25
 
26
26
  // Internal value tracks the actual input content, independent of parent's modelValue
@@ -57,7 +57,7 @@ function clearInput () {
57
57
  :data-disabled="disabled || undefined"
58
58
  >
59
59
  <InputGroupAddon
60
- v-if="$slots.prefix"
60
+ v-if="slots.prefix"
61
61
  align="inline-start"
62
62
  >
63
63
  <slot name="prefix" />
@@ -86,7 +86,7 @@ function clearInput () {
86
86
  </InputGroupButton>
87
87
  </InputGroupAddon>
88
88
  <InputGroupAddon
89
- v-if="$slots.suffix"
89
+ v-if="slots.suffix"
90
90
  align="inline-end"
91
91
  >
92
92
  <slot name="suffix" />
@@ -2,6 +2,10 @@
2
2
  import type { MarkdownProps } from './types'
3
3
 
4
4
  defineProps<MarkdownProps>()
5
+
6
+ defineSlots<{
7
+ default?: () => any
8
+ }>()
5
9
  </script>
6
10
 
7
11
  <template>
@@ -39,6 +39,14 @@ const emit = defineEmits<{
39
39
  'cancel': []
40
40
  }>()
41
41
 
42
+ defineSlots<{
43
+ default?: () => any
44
+ trigger?: () => any
45
+ header?: () => any
46
+ footer?: () => any
47
+ footerLeft?: () => any
48
+ }>()
49
+
42
50
  const { t } = useI18n()
43
51
 
44
52
  const resolvedConfirmText = computed(
@@ -27,6 +27,10 @@ const props = withDefaults(defineProps<ModalContentProps>(), {
27
27
  content: undefined,
28
28
  })
29
29
 
30
+ defineSlots<{
31
+ default?: () => any
32
+ }>()
33
+
30
34
  const iconName = computed(() => {
31
35
  if (props.icon) return props.icon
32
36
  if (props.type) return typeIconNameMap[props.type]
@@ -44,7 +48,7 @@ function isHTMLElement (value: unknown): value is HTMLElement {
44
48
  </script>
45
49
 
46
50
  <template>
47
- <div class="flex w-full items-center gap-4">
51
+ <div class="gap-4 flex w-full items-center">
48
52
  <!-- Icon -->
49
53
  <Icon
50
54
  v-if="iconName"
@@ -10,6 +10,14 @@ const props = withDefaults(defineProps<PageCardProps>(), {
10
10
  class: undefined,
11
11
  })
12
12
 
13
+ defineSlots<{
14
+ default?: () => any
15
+ title?: () => any
16
+ subtitle?: () => any
17
+ actions?: () => any
18
+ footer?: () => any
19
+ }>()
20
+
13
21
  const route = useRoute()
14
22
  const router = useRouter()
15
23
  const { isMobile } = useDevice()
@@ -52,8 +60,9 @@ const hasTitle = computed(() => !!props.title)
52
60
  <div
53
61
  v-else
54
62
  class="
55
- flex items-center gap-2
63
+ gap-2
56
64
  sm:gap-3
65
+ flex items-center
57
66
  "
58
67
  >
59
68
  <Button
@@ -66,7 +75,7 @@ const hasTitle = computed(() => !!props.title)
66
75
  <div class="flex-1">
67
76
  <h3
68
77
  v-if="!!$slots.title || !!title"
69
- class="text-lg leading-none font-semibold tracking-tight"
78
+ class="text-lg font-semibold tracking-tight leading-none"
70
79
  >
71
80
  <slot name="title">
72
81
  {{ title }}
@@ -84,8 +93,9 @@ const hasTitle = computed(() => !!props.title)
84
93
  <div
85
94
  v-if="!!$slots.actions"
86
95
  class="
87
- flex items-center gap-2
96
+ gap-2
88
97
  sm:gap-3
98
+ flex items-center
89
99
  "
90
100
  >
91
101
  <slot name="actions" />
@@ -96,7 +106,7 @@ const hasTitle = computed(() => !!props.title)
96
106
  <!-- Skeleton content -->
97
107
  <div
98
108
  v-if="!ready"
99
- class="flex flex-col gap-2"
109
+ class="gap-2 flex flex-col"
100
110
  >
101
111
  <Skeleton height="1rem" />
102
112
  <Skeleton
@@ -116,7 +126,7 @@ const hasTitle = computed(() => !!props.title)
116
126
  >
117
127
  <div
118
128
  v-if="loading"
119
- class="absolute inset-0 z-50 flex items-center justify-center"
129
+ class="inset-0 absolute z-50 flex items-center justify-center"
120
130
  >
121
131
  <Loading class="size-8" />
122
132
  </div>
@@ -13,6 +13,11 @@ const props = withDefaults(defineProps<PopoverProps>(), {
13
13
  class: undefined,
14
14
  })
15
15
 
16
+ defineSlots<{
17
+ default?: () => any
18
+ trigger?: () => any
19
+ }>()
20
+
16
21
  const { isMobile } = useDevice()
17
22
 
18
23
  // Force click trigger on mobile devices for better touch experience
@@ -21,7 +21,7 @@ const emit = defineEmits<{
21
21
  }>()
22
22
 
23
23
  defineSlots<{
24
- label?: (props: { item: RadioGroupItem, checked: boolean }) => unknown
24
+ label?: (props: { item: RadioGroupItem, checked: boolean }) => any
25
25
  }>()
26
26
 
27
27
  const model = computed({
@@ -7,6 +7,10 @@ import type { ScrollAreaProps } from './types'
7
7
 
8
8
  const props = defineProps<ScrollAreaProps>()
9
9
 
10
+ defineSlots<{
11
+ default?: () => any
12
+ }>()
13
+
10
14
  const rootRef = ref<InstanceType<typeof ShadcnScrollArea>>()
11
15
  const viewportEl = ref<HTMLElement>()
12
16
 
@@ -28,6 +28,12 @@ const emit = defineEmits<{
28
28
  'update:modelValue': [value: TValue | undefined]
29
29
  }>()
30
30
 
31
+ defineSlots<{
32
+ value?: (props: { option?: Option, options?: Option[] }) => any
33
+ option?: (props: { option: Option, selected: boolean }) => any
34
+ footer?: () => any
35
+ }>()
36
+
31
37
  const model = computed({
32
38
  get: () => props.modelValue,
33
39
  set: value => emit('update:modelValue', value),
@@ -46,6 +46,13 @@ const emit = defineEmits<{
46
46
  'close': []
47
47
  }>()
48
48
 
49
+ defineSlots<{
50
+ value?: (props: { option?: Option, options?: Option[] }) => any
51
+ option?: (props: { option: Option, selected: boolean }) => any
52
+ listEnd?: () => any
53
+ footer?: () => any
54
+ }>()
55
+
49
56
  const open = ref(false)
50
57
 
51
58
  watch(open, value => {
@@ -26,6 +26,11 @@ const emit = defineEmits<{
26
26
  'rowClick': [row: TData, index: number, event: MouseEvent]
27
27
  }>()
28
28
 
29
+ defineSlots<{
30
+ toolbar?: () => any
31
+ [key: string]: ((props?: any) => any) | undefined
32
+ }>()
33
+
29
34
  const T = useTranslations('components.ui.StaticDataTable')
30
35
  const { isMobile } = useDevice()
31
36
 
@@ -24,8 +24,8 @@ const emit = defineEmits<{
24
24
  }>()
25
25
 
26
26
  defineSlots<{
27
- title?: (props: { item: StepsItem, step: number, state: StepsState }) => unknown
28
- description?: (props: { item: StepsItem, step: number, state: StepsState }) => unknown
27
+ title?: (props: { item: StepsItem, step: number, state: StepsState }) => any
28
+ description?: (props: { item: StepsItem, step: number, state: StepsState }) => any
29
29
  }>()
30
30
 
31
31
  const isVertical = computed(() => props.orientation === 'vertical')
@@ -212,6 +212,10 @@ const props = withDefaults(defineProps<SurfaceProps>(), {
212
212
  class: undefined,
213
213
  })
214
214
 
215
+ defineSlots<{
216
+ default?: () => any
217
+ }>()
218
+
215
219
  const mergedClass = computed(() =>
216
220
  cn(
217
221
  surfaceVariants({
@@ -22,8 +22,8 @@ const emit = defineEmits<{
22
22
  }>()
23
23
 
24
24
  defineSlots<{
25
- title?: (props: { item: TabsItem, active: boolean }) => unknown
26
- content?: (props: { item: TabsItem, active: boolean }) => unknown
25
+ title?: (props: { item: TabsItem, active: boolean }) => any
26
+ content?: (props: { item: TabsItem, active: boolean }) => any
27
27
  }>()
28
28
 
29
29
  const hasItemContent = computed(() => props.items.some(item => !!item.content))
@@ -3,7 +3,7 @@ import { cva } from 'class-variance-authority'
3
3
  import type { TagProps } from './types'
4
4
 
5
5
  const tagVariants = cva(
6
- 'inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium',
6
+ 'gap-1 rounded-md px-2 py-1 text-xs font-medium inline-flex items-center',
7
7
  {
8
8
  variants: {
9
9
  variant: {
@@ -25,7 +25,7 @@ const tagVariants = cva(
25
25
  compoundVariants: [
26
26
  // solid — full color background
27
27
  { variant: 'solid', color: 'default', class: `
28
- border-transparent bg-accent text-accent-foreground
28
+ bg-accent text-accent-foreground border-transparent
29
29
  ` },
30
30
  { variant: 'solid', color: 'primary', class: `
31
31
  border-primary bg-primary text-primary-foreground
@@ -107,6 +107,10 @@ const props = withDefaults(defineProps<TagProps>(), {
107
107
  class: undefined,
108
108
  })
109
109
 
110
+ defineSlots<{
111
+ default?: () => any
112
+ }>()
113
+
110
114
  const mergedClass = computed(() =>
111
115
  cn(tagVariants({ color: props.color, variant: props.variant }), props.class),
112
116
  )
@@ -16,6 +16,10 @@ const props = withDefaults(defineProps<TooltipProps>(), {
16
16
 
17
17
  const emit = defineEmits<{ open: [], close: []}>()
18
18
 
19
+ defineSlots<{
20
+ default?: () => any
21
+ }>()
22
+
19
23
  const { isMobile } = useDevice()
20
24
 
21
25
  const sanitizedText = computed(() => props.text ? safeHtml(props.text) : '')
@@ -125,7 +125,7 @@ const hintLines = computed(() => {
125
125
  })
126
126
 
127
127
  defineSlots<{
128
- hint?: (props: { lines: string[] }) => unknown
128
+ hint?: (props: { lines: string[] }) => any
129
129
  }>()
130
130
 
131
131
  const triggerLabel = computed(() => {
@@ -10,6 +10,10 @@ const props = withDefaults(defineProps<WebLinkProps>(), {
10
10
  class: undefined,
11
11
  })
12
12
 
13
+ defineSlots<{
14
+ default?: () => any
15
+ }>()
16
+
13
17
  const localePath = useLocalePath()
14
18
 
15
19
  const isExternal = computed(() => props.href ? isUrl(props.href) : false)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bjj/nuxt-layer-shadcn-ui",
3
- "version": "0.11.7",
3
+ "version": "0.11.8",
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": "1ca191320ed436a93b6d7ed5e7f04fba3e09a730"
45
+ "gitHead": "6c93065163612f8b07a290db5e793e3fd651a6cf"
46
46
  }