From 8fa7e1e41bd38214ef1fe15b7c2ea2659208c3e0 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 10 Sep 2025 15:56:47 +0200 Subject: [PATCH] fix(FilePicker): make move primary and copy secondary Needed to bump peer dependency for nextcloud-vue to 8.24+ for `variant` prop. Signed-off-by: Ferdinand Thiessen --- lib/components/types.ts | 17 ++++++++++++----- lib/filepicker-builder.ts | 6 +++--- package-lock.json | 2 +- package.json | 2 +- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/components/types.ts b/lib/components/types.ts index 9c08f616c..d4948fcd0 100644 --- a/lib/components/types.ts +++ b/lib/components/types.ts @@ -17,10 +17,16 @@ export enum DialogSeverity { */ export interface IDialogButton { /** Label of the button */ - label: string, + label: string /** Callback on button click */ - callback: () => void, + callback: () => void + + /** + * Disabled state of the button + * @default false + */ + disabled?: boolean /** * Optional Icon for the button @@ -30,15 +36,16 @@ export interface IDialogButton { /** * Button type + * @deprecated - use `variant` instead * @see https://nextcloud-vue-components.netlify.app/#/Components/NcButton */ type?: 'primary' | 'secondary' | 'error' | 'warning' | 'success' /** - * Disabled state of the button - * @default false + * Button type + * @see https://nextcloud-vue-components.netlify.app/#/Components/NcButton */ - disabled?: boolean + variant?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success' } /** diff --git a/lib/filepicker-builder.ts b/lib/filepicker-builder.ts index 0f377dd67..fabe6658b 100644 --- a/lib/filepicker-builder.ts +++ b/lib/filepicker-builder.ts @@ -224,16 +224,16 @@ export class FilePickerBuilder { buttons.push({ callback: () => {}, label: target ? t('Copy to {target}', { target }) : t('Copy'), - type: 'primary', icon: IconCopy, + variant: type === FilePickerType.Copy ? 'primary' : 'secondary', }) } - if (type === FilePickerType.Move || type === FilePickerType.CopyMove) { + if (type === FilePickerType.CopyMove || type === FilePickerType.Move) { buttons.push({ callback: () => {}, label: target ? t('Move to {target}', { target }) : t('Move'), - type: type === FilePickerType.Move ? 'primary' : 'secondary', icon: IconMove, + variant: 'primary', // move is always primary - also on copy-move }) } return buttons diff --git a/package-lock.json b/package-lock.json index 67322b445..30f117154 100644 --- a/package-lock.json +++ b/package-lock.json @@ -61,7 +61,7 @@ "npm": "^10.0.0" }, "peerDependencies": { - "@nextcloud/vue": "^8.23.1", + "@nextcloud/vue": "^8.24.0", "vue": "^2.7.16" } }, diff --git a/package.json b/package.json index 89e798b48..66c282e0e 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "dist" ], "peerDependencies": { - "@nextcloud/vue": "^8.23.1", + "@nextcloud/vue": "^8.24.0", "vue": "^2.7.16" }, "dependencies": {