From 737bdf89e51b3ae572f6f5ea68c22d8cc6c5da39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=CC=81ngel=20Rolda=CC=81n=20Marti=CC=81nez?= Date: Sun, 4 Feb 2024 08:24:26 +0100 Subject: [PATCH 1/7] feat(BFormFile) add properties placement and browser as in BootstrapVue --- .../docs/src/data/components/formFile.data.ts | 44 +++++++++- .../src/components/BFormFile/BFormFile.vue | 80 +++++++++++++------ 2 files changed, 98 insertions(+), 26 deletions(-) diff --git a/apps/docs/src/data/components/formFile.data.ts b/apps/docs/src/data/components/formFile.data.ts index c75d5972c..9d27a62c4 100644 --- a/apps/docs/src/data/components/formFile.data.ts +++ b/apps/docs/src/data/components/formFile.data.ts @@ -9,103 +9,141 @@ export default { prop: 'accept', type: 'string | string[]', default: '', + description: "Value to set on the file input's `accept` attribute", }, { prop: 'autofocus', type: 'Booleanish', default: false, + description: + 'When set to `true`, attempts to auto-focus the control when it is mounted, or re-activated when in a keep-alive. Does not set the `autofocus` attribute on the control', }, { prop: 'capture', type: "'Booleanish' | 'user' | 'environment'", default: false, + description: + 'When set, will instruction the browser to use the devices camera (if supported)', }, { prop: 'directory', type: 'Booleanish', default: false, + description: 'Enable `directory` mode (on browsers that support it)', }, { prop: 'disabled', type: 'Booleanish', default: false, + description: + "When set to `true`, disables the component's functionality and places it in a disabled state", }, { prop: 'form', type: 'string', default: undefined, + description: + 'ID of the form that the form control belongs to. Sets the `form` attribute on the control', }, { prop: 'id', type: 'string', default: undefined, + description: + 'Used to set the `id` attribute on the rendered content, and used as the base to generate any additional element IDs as needed', }, { prop: 'multiple', type: 'Booleanish', default: false, + description: + 'When set, will allow multiple files to be selected. `v-model` will be an array', }, { prop: 'name', type: 'string', default: undefined, + description: 'Sets the value of the `name` attribute on the form control', }, { prop: 'noDrop', type: 'Booleanish', default: false, + description: 'Disable drag and drop mode', }, { prop: 'noTraverse', type: 'Booleanish', default: false, + description: 'Wether to returns files as a flat array when in `directory` mode', }, { prop: 'required', type: 'Booleanish', default: false, + description: 'Adds the `required` attribute to the form control', }, { prop: 'size', type: 'Size', default: undefined, + description: "Set the size of the component's appearance. 'sm', 'md' (default), or 'lg'", }, { prop: 'state', type: 'Booleanish | null', default: undefined, + description: + 'Controls the validation state appearance of the component. `true` for valid, `false` for invalid, or `null` for no validation state', }, { prop: 'modelValue', type: 'File[] | File | null', default: undefined, + description: + 'The current value of the file input. Will be a single `File` object or an array of `File` objects (if `multiple` or `directory` is set). Can be set to `null`, or an empty array to reset the file input', }, { prop: 'label', type: 'string', default: '', + description: 'Sets the label for the form group which the file input is rendered', }, { prop: 'labelClass', type: 'ClassValue', default: undefined, + description: 'Sets the styling for the label', + }, + { + prop: 'placement', + type: `'start' | 'end'`, + default: `'start'`, + description: 'Sets the placement for the file button', + }, + { + prop: 'browser', + type: 'String', + default: 'Browse', + description: 'Text content for the file browse button', }, ], emits: [ { event: 'update:modelValue', - description: '', + description: 'Updates the `v-model` value (see docs for more details)', args: [ { arg: 'value', type: 'File | File[] | null', - description: '', + description: + 'Will be a single File object in single mode or an array of File objects in multiple mode', }, ], }, { event: 'change', - description: '', + description: 'Original change event of the input', args: [ { arg: 'value', diff --git a/packages/bootstrap-vue-next/src/components/BFormFile/BFormFile.vue b/packages/bootstrap-vue-next/src/components/BFormFile/BFormFile.vue index 2b9bf43f5..36bc02e25 100644 --- a/packages/bootstrap-vue-next/src/components/BFormFile/BFormFile.vue +++ b/packages/bootstrap-vue-next/src/components/BFormFile/BFormFile.vue @@ -1,36 +1,44 @@ + + From 6502bf606334e6f56b2462753a60e66c5ced79f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=CC=81ngel=20Rolda=CC=81n=20Marti=CC=81nez?= Date: Fri, 23 Feb 2024 22:08:43 +0100 Subject: [PATCH 2/7] fix(BFormFile) add missing properties from bootstrap-vue add unit tests --- .../docs/src/data/components/formFile.data.ts | 15 +- .../src/components/BFormFile/BFormFile.vue | 31 +- .../components/BFormFile/form-file.spec.ts | 655 ++++++++++++++++++ 3 files changed, 689 insertions(+), 12 deletions(-) create mode 100644 packages/bootstrap-vue-next/src/components/BFormFile/form-file.spec.ts diff --git a/apps/docs/src/data/components/formFile.data.ts b/apps/docs/src/data/components/formFile.data.ts index 9d27a62c4..fde923b0c 100644 --- a/apps/docs/src/data/components/formFile.data.ts +++ b/apps/docs/src/data/components/formFile.data.ts @@ -1,10 +1,23 @@ -import type {ComponentReference} from './ComponentReference' +import type { ComponentReference } from './ComponentReference' export default { load: (): ComponentReference[] => [ { component: 'BFormFile', props: [ + { + prop: 'ariaLabel', + type: 'string', + default: undefined, + description: 'Sets the value of `aria-label` attribute on the rendered element', + }, + { + prop: 'ariaLabelledBy', + type: 'string', + default: undefined, + description: + 'The ID of the element that provides a label for this component. Used as the value for the `aria-labelledby` attribute', + }, { prop: 'accept', type: 'string | string[]', diff --git a/packages/bootstrap-vue-next/src/components/BFormFile/BFormFile.vue b/packages/bootstrap-vue-next/src/components/BFormFile/BFormFile.vue index 36bc02e25..afaba503a 100644 --- a/packages/bootstrap-vue-next/src/components/BFormFile/BFormFile.vue +++ b/packages/bootstrap-vue-next/src/components/BFormFile/BFormFile.vue @@ -4,10 +4,11 @@ {{ label }} -
- + +
+