@bjj/nuxt-layer-shadcn-ui 0.12.4 → 0.12.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.
@@ -25,6 +25,8 @@ const meta = {
25
25
  multiple: { control: 'boolean' },
26
26
  maxCount: { control: 'number' },
27
27
  maxSize: { control: 'number' },
28
+ hideTriggerOnMax: { control: 'boolean' },
29
+ hideHint: { control: 'boolean' },
28
30
  directory: { control: 'boolean' },
29
31
  text: { control: 'text' },
30
32
  icon: { control: 'text' },
@@ -38,6 +40,8 @@ const meta = {
38
40
  multiple: false,
39
41
  maxCount: undefined,
40
42
  maxSize: undefined,
43
+ hideTriggerOnMax: false,
44
+ hideHint: false,
41
45
  directory: false,
42
46
  text: '',
43
47
  icon: '',
@@ -15,6 +15,8 @@ const props = withDefaults(defineProps<UploadProps>(), {
15
15
  maxSize: undefined,
16
16
  text: undefined,
17
17
  icon: undefined,
18
+ hideTriggerOnMax: false,
19
+ hideHint: false,
18
20
  directory: false,
19
21
  class: undefined,
20
22
  })
@@ -74,7 +76,9 @@ const canPickMore = computed(() =>
74
76
 
75
77
  const canRemove = computed(() => !props.disabled && !props.readonly)
76
78
 
77
- const showTrigger = computed(() => !props.readonly)
79
+ const showTrigger = computed(() =>
80
+ !props.readonly && !(props.hideTriggerOnMax && reachedMax.value),
81
+ )
78
82
 
79
83
  const emptyStateClass = 'py-2 text-xs text-muted-foreground'
80
84
 
@@ -454,7 +458,10 @@ async function onDrop (e: DragEvent) {
454
458
  <Icon :name="iconName" />
455
459
  {{ triggerLabel }}
456
460
  </Button>
457
- <div class="text-xs text-muted-foreground py-1.5">
461
+ <div
462
+ v-if="!hideHint"
463
+ class="text-xs text-muted-foreground py-1.5"
464
+ >
458
465
  <slot
459
466
  name="hint"
460
467
  :lines="hintLines"
@@ -488,7 +495,10 @@ async function onDrop (e: DragEvent) {
488
495
  <div class="text-foreground font-medium">
489
496
  {{ triggerLabel }}
490
497
  </div>
491
- <div class="text-xs text-muted-foreground">
498
+ <div
499
+ v-if="!hideHint"
500
+ class="text-xs text-muted-foreground"
501
+ >
492
502
  <slot
493
503
  name="hint"
494
504
  :lines="hintLines"
@@ -656,7 +666,7 @@ async function onDrop (e: DragEvent) {
656
666
  </div>
657
667
 
658
668
  <div
659
- v-if="showTrigger"
669
+ v-if="showTrigger && !hideHint"
660
670
  class="mt-2 text-xs text-muted-foreground"
661
671
  >
662
672
  <slot
@@ -18,19 +18,38 @@ export type UploadBeforeUpload
18
18
  export type UploadHandler = (files: (File | Blob)[]) => Promise<unknown>
19
19
 
20
20
  export interface UploadProps {
21
+ /** Trigger appearance: button, thumbnail grid box, or drag-and-drop area */
21
22
  variant?: UploadVariant
23
+ /** Accepted file types, same format as the native `<input accept>` (also enforced on drag-drop) */
22
24
  accept?: string
25
+ /** Called per file before upload; return `false` to skip, or a `File | Blob` to replace it */
23
26
  beforeUpload?: UploadBeforeUpload
27
+ /** Uploads the accepted files; rejection marks them as error */
24
28
  upload?: UploadHandler
29
+ /** Disable the trigger and file removal */
25
30
  disabled?: boolean
31
+ /** Hide the trigger and only display the file list */
26
32
  readonly?: boolean
33
+ /** Show the invalid (error) style */
27
34
  invalid?: boolean
35
+ /** Controlled file list, used with `v-model:fileList` */
28
36
  fileList?: UploadFile[]
37
+ /** Allow selecting multiple files at once */
29
38
  multiple?: boolean
39
+ /** Maximum number of files */
30
40
  maxCount?: number
41
+ /** Maximum size per file in bytes */
31
42
  maxSize?: number
43
+ /** Custom trigger text */
32
44
  text?: string
45
+ /** Custom trigger icon */
33
46
  icon?: string | Component
47
+ /** Hide the upload trigger instead of disabling it when maxCount is reached */
48
+ hideTriggerOnMax?: boolean
49
+ /** Hide the hint lines below the trigger */
50
+ hideHint?: boolean
51
+ /** Allow selecting a directory and upload its contents */
34
52
  directory?: boolean
53
+ /** Class of the root element */
35
54
  class?: ClassValue
36
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bjj/nuxt-layer-shadcn-ui",
3
- "version": "0.12.4",
3
+ "version": "0.12.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": "e945f62a29770cb80be3cb2d0abe0a8b031706c3"
45
+ "gitHead": "1e5b160073c61a6301d43cf82a69d6c2cf80f17f"
46
46
  }