UNPKG

@vonage/vivid-react

Version:

Vivid wrapped for easy React usage & IDE autocomplete support & typescript typings

941 lines (936 loc) 20.4 kB
/* * DO NOT EDIT THIS FILE. IT IS GENERATED */ /* Code in this file were generated using following JSON: { "kind": "class", "description": "", "name": "FilePicker", "slots": [ { "description": "Describes how to use the file-picker. Alternative to the `helper-text` attribute.", "name": "helper-text" } ], "members": [ { "kind": "field", "name": "#dropzone", "privacy": "private", "type": { "text": "Dropzone | undefined" } }, { "kind": "field", "name": "files", "type": { "text": "File[]" }, "description": "Files that have been added to the file picker and passed validation.", "privacy": "public", "readonly": true }, { "kind": "field", "name": "rejectedFiles", "type": { "text": "File[]" }, "description": "Files that have been rejected by the file picker for failing validation.", "privacy": "public", "readonly": true }, { "kind": "method", "name": "#syncSingleFileState" }, { "kind": "field", "name": "singleFile", "type": { "text": "boolean" }, "default": "false", "description": "Single file state.", "privacy": "public" }, { "kind": "method", "name": "singleFileChanged" }, { "kind": "field", "name": "maxFiles", "type": { "text": "number | undefined" }, "description": "The max files that can be selected.", "privacy": "public" }, { "kind": "method", "name": "maxFilesChanged", "return": { "type": { "text": "void" } }, "parameters": [ { "name": "_oldValue", "type": { "text": "number" } }, { "name": "newValue", "type": { "text": "number" } } ] }, { "kind": "field", "name": "maxFileSize", "type": { "text": "number" }, "default": "256", "description": "The max file size that can be selected.", "privacy": "public" }, { "kind": "method", "name": "maxFileSizeChanged", "return": { "type": { "text": "void" } }, "parameters": [ { "name": "_oldValue", "type": { "text": "number" } }, { "name": "newValue", "type": { "text": "number" } } ] }, { "kind": "field", "name": "accept", "type": { "text": "string | undefined" }, "description": "List of accepted files types", "privacy": "public" }, { "kind": "method", "name": "acceptChanged", "return": { "type": { "text": "void" } }, "parameters": [ { "name": "_oldValue", "type": { "text": "string" } }, { "name": "newValue", "type": { "text": "string" } } ] }, { "kind": "field", "name": "size", "type": { "text": "FilePickerSize | undefined" }, "description": "The size the file-uploader should have.", "privacy": "public" }, { "kind": "field", "name": "invalidFileTypeError", "type": { "text": "string | undefined" }, "description": "Overrides the localized error message for invalid file type", "privacy": "public" }, { "kind": "method", "name": "invalidFileTypeErrorChanged", "return": { "type": { "text": "void" } }, "parameters": [ { "name": "_oldValue", "type": { "text": "string" } }, { "name": "newValue", "type": { "text": "string" } } ] }, { "kind": "field", "name": "maxFilesExceededError", "type": { "text": "string | undefined" }, "description": "Overrides the localized error message for max file exceed", "privacy": "public" }, { "kind": "method", "name": "maxFilesExceededErrorChanged", "return": { "type": { "text": "void" } }, "parameters": [ { "name": "_oldValue", "type": { "text": "string" } }, { "name": "newValue", "type": { "text": "string" } } ] }, { "kind": "field", "name": "fileTooBigError", "type": { "text": "string | undefined" }, "description": "Overrides the localized error message for file too big", "privacy": "public" }, { "kind": "method", "name": "fileTooBigErrorChanged", "return": { "type": { "text": "void" } }, "parameters": [ { "name": "_oldValue", "type": { "text": "string" } }, { "name": "newValue", "type": { "text": "string" } } ] }, { "kind": "method", "name": "nameChanged", "parameters": [ { "name": "previous", "type": { "text": "string" } }, { "name": "next", "type": { "text": "string" } } ] }, { "kind": "field", "name": "buttonTag", "type": { "text": "string" }, "privacy": "private", "default": "'vwc-button'", "description": "Used internally to hold the tag that button is registered at." }, { "kind": "field", "name": "iconTag", "type": { "text": "string" }, "privacy": "private", "default": "'vwc-icon'", "description": "Used internally to hold the tag that icon is registered at." }, { "kind": "field", "name": "#localizeErrorMessage", "privacy": "private" }, { "kind": "field", "name": "#localizeFileSizeNumberAndUnits", "privacy": "private" }, { "kind": "method", "name": "#addRemoveButtonToFilesPreview" }, { "kind": "method", "name": "#chooseFile", "return": { "type": { "text": "void" } } }, { "kind": "method", "name": "#updateHiddenFileInput", "return": { "type": { "text": "void" } } }, { "kind": "method", "name": "#keepOnlyNewestFile" }, { "kind": "method", "name": "#handleFilesChanged", "return": { "type": { "text": "void" } } }, { "kind": "method", "name": "#updateFormValue" }, { "kind": "method", "name": "#setValueToAFakePathLikeNativeInput" }, { "kind": "field", "name": "setFormValue" }, { "kind": "method", "name": "#getCustomValidationError", "return": { "type": { "text": "string | null" } } }, { "kind": "method", "name": "validate", "return": { "type": { "text": "void" } }, "description": "{@inheritDoc (FormAssociated:interface).validate}", "inheritedFrom": { "name": "WithErrorText", "module": "src/shared/patterns/form-elements/with-error-text.ts" } }, { "kind": "method", "name": "formResetCallback", "return": { "type": { "text": "void" } } }, { "kind": "method", "name": "#formatNumbersInMessage", "parameters": [ { "name": "message", "type": { "text": "string" } } ] }, { "kind": "method", "name": "removeAllFiles", "description": "Removes all files from the File Picker." }, { "kind": "field", "name": "autoDiscover", "type": { "text": "boolean" }, "default": "false" }, { "kind": "field", "name": "helperText", "type": { "text": "string | undefined" }, "description": "Provides additional information to help the user enter the correct information.\nTo add HTML to the helper text, use the helper-text slot instead.", "privacy": "public", "inheritedFrom": { "name": "WithFeedback", "module": "src/shared/feedback/mixins.ts" } }, { "kind": "field", "name": "errorText", "type": { "text": "string | undefined" }, "description": "Provides a custom error message. Any current error state will be overridden.", "privacy": "public", "inheritedFrom": { "name": "WithErrorText", "module": "src/shared/patterns/form-elements/with-error-text.ts" } }, { "kind": "field", "name": "#blockValidateCalls", "privacy": "private", "type": { "text": "boolean" }, "default": "false", "inheritedFrom": { "name": "WithErrorText", "module": "src/shared/patterns/form-elements/with-error-text.ts" } }, { "kind": "field", "name": "#originalValidateFn", "privacy": "private", "type": { "text": "() => void" }, "inheritedFrom": { "name": "WithErrorText", "module": "src/shared/patterns/form-elements/with-error-text.ts" } }, { "kind": "method", "name": "#forceCustomError", "parameters": [ { "name": "errorMessage", "type": { "text": "string" } } ], "inheritedFrom": { "name": "WithErrorText", "module": "src/shared/patterns/form-elements/with-error-text.ts" } }, { "kind": "method", "name": "#clearCustomErrorAndRevalidate", "inheritedFrom": { "name": "WithErrorText", "module": "src/shared/patterns/form-elements/with-error-text.ts" } }, { "kind": "field", "name": "label", "type": { "text": "string | undefined" }, "description": "The label for the form element.", "inheritedFrom": { "name": "FormElement", "module": "src/shared/patterns/form-elements/form-element.ts" } }, { "kind": "field", "name": "#handleInvalidEvent", "privacy": "private", "inheritedFrom": { "name": "FormElement", "module": "src/shared/patterns/form-elements/form-element.ts" } }, { "kind": "field", "name": "_vividAriaBehaviour", "default": "'delegate'", "type": { "text": "'delegate'" }, "inheritedFrom": { "name": "DelegatesAria", "module": "src/shared/aria/delegates-aria.ts" } }, { "kind": "field", "name": "validity", "type": { "text": "ValidityState" }, "description": "Returns the validity state of the element", "readonly": true, "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "kind": "field", "name": "form", "type": { "text": "HTMLFormElement | null" }, "description": "Retrieve a reference to the associated form.\nReturns null if not associated to any form.", "readonly": true, "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "kind": "field", "name": "validationMessage", "type": { "text": "string" }, "description": "Retrieve the localized validation message,\nor custom validation message if set.", "readonly": true, "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "kind": "field", "name": "willValidate", "type": { "text": "boolean" }, "description": "Whether the element will be validated when the\nform is submitted", "readonly": true, "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "kind": "field", "name": "labels", "type": { "text": "ReadonlyArray<Node>" }, "description": "A reference to all associated label elements", "readonly": true, "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "kind": "field", "name": "value", "type": { "text": "string" }, "description": "The current value of the element.", "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "kind": "field", "name": "currentValue", "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "kind": "field", "name": "initialValue", "type": { "text": "string" }, "description": "The default value of the element. This value sets the `value` property\nonly when the `value` property has not been explicitly set.", "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "kind": "field", "name": "disabled", "type": { "text": "boolean" }, "default": "false", "description": "Sets the element's disabled state. A disabled element will not be included during form submission.", "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "kind": "field", "name": "name", "type": { "text": "string" }, "description": "The name of the element. This element's value will be surfaced during form submission under the provided name.", "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "kind": "field", "name": "required", "type": { "text": "boolean" }, "description": "Require the field to be completed prior to form submission.", "default": "false", "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "kind": "method", "name": "checkValidity", "return": { "type": { "text": "boolean" } }, "description": "Return the current validity of the element.", "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "kind": "method", "name": "reportValidity", "return": { "type": { "text": "boolean" } }, "description": "Return the current validity of the element.\nIf false, fires an invalid event at the element.", "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "kind": "field", "name": "VIVID_VERSION", "static": true, "default": "__PACKAGE_VERSION__", "description": "The current version of the Vivid library, which is useful for debugging.\nIt can be accessed from any Vivid element via `<el>.constructor.VIVID_VERSION`.", "type": { "text": "string" }, "inheritedFrom": { "name": "VividElement", "module": "src/shared/foundation/vivid-element/vivid-element.ts" } }, { "kind": "field", "name": "componentName", "type": { "text": "string" }, "static": true, "description": "Core component name, without prefix", "inheritedFrom": { "name": "VividElement", "module": "src/shared/foundation/vivid-element/vivid-element.ts" } } ], "events": [ { "type": { "text": "CustomEvent<undefined>" }, "description": "Emitted when a file is added or removed.", "name": "change" } ], "attributes": [ { "name": "single-file", "type": { "text": "boolean" }, "default": "false", "description": "Single file state.", "fieldName": "singleFile" }, { "name": "max-files", "type": { "text": "number | undefined" }, "description": "The max files that can be selected.", "fieldName": "maxFiles" }, { "name": "max-file-size", "type": { "text": "number" }, "default": "256", "description": "The max file size that can be selected.", "fieldName": "maxFileSize" }, { "name": "accept", "type": { "text": "string | undefined" }, "description": "List of accepted files types", "fieldName": "accept" }, { "name": "size", "type": { "text": "FilePickerSize | undefined" }, "description": "The size the file-uploader should have.", "fieldName": "size" }, { "name": "invalid-file-type-error", "type": { "text": "string | undefined" }, "description": "Overrides the localized error message for invalid file type", "fieldName": "invalidFileTypeError" }, { "name": "max-files-exceeded-error", "type": { "text": "string | undefined" }, "description": "Overrides the localized error message for max file exceed", "fieldName": "maxFilesExceededError" }, { "name": "file-too-big-error", "type": { "text": "string | undefined" }, "description": "Overrides the localized error message for file too big", "fieldName": "fileTooBigError" }, { "name": "helper-text", "type": { "text": "string | undefined" }, "description": "Provides additional information to help the user enter the correct information.\nTo add HTML to the helper text, use the helper-text slot instead.", "fieldName": "helperText", "inheritedFrom": { "name": "WithFeedback", "module": "src/shared/feedback/mixins.ts" } }, { "name": "error-text", "type": { "text": "string | undefined" }, "description": "Provides a custom error message. Any current error state will be overridden.", "fieldName": "errorText", "inheritedFrom": { "name": "WithErrorText", "module": "src/shared/patterns/form-elements/with-error-text.ts" } }, { "name": "label", "type": { "text": "string | undefined" }, "description": "The label for the form element.", "fieldName": "label", "inheritedFrom": { "name": "FormElement", "module": "src/shared/patterns/form-elements/form-element.ts" } }, { "name": "current-value", "type": { "text": "string" }, "description": "The current value of the element.", "fieldName": "value", "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "name": "value", "type": { "text": "string" }, "description": "The default value of the element. This value sets the `value` property\nonly when the `value` property has not been explicitly set.", "fieldName": "initialValue", "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "name": "disabled", "type": { "text": "boolean" }, "default": "false", "description": "Sets the element's disabled state. A disabled element will not be included during form submission.", "fieldName": "disabled", "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "name": "name", "type": { "text": "string" }, "description": "The name of the element. This element's value will be surfaced during form submission under the provided name.", "fieldName": "name", "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } }, { "name": "required", "type": { "text": "boolean" }, "description": "Require the field to be completed prior to form submission.", "default": "false", "fieldName": "required", "inheritedFrom": { "name": "FormAssociated", "module": "src/shared/foundation/form-associated/form-associated.ts" } } ], "mixins": [ { "name": "WithFeedback", "module": "/src/shared/feedback/mixins" }, { "name": "WithErrorText", "module": "/src/shared/patterns" }, { "name": "FormElement", "module": "/src/shared/patterns" }, { "name": "DelegatesAria", "module": "/src/shared/aria/delegates-aria" }, { "name": "Localized", "module": "/src/shared/patterns" }, { "name": "FormAssociated", "module": "/src/shared/foundation/form-associated/form-associated" } ], "superclass": { "name": "VividElement", "module": "/src/shared/foundation/vivid-element/vivid-element" }, "vividComponent": { "public": true, "name": "file-picker" } } */ import wrapper from '@vonage/vivid-react-wrapper' import { registerFilePicker } from '@vonage/vivid' registerFilePicker('vvd3') const VwcFilePicker = wrapper(`vvd3-file-picker`, { events: [{"name":"change","propName":"onChange"}], attributes: [], properties: ['singleFile', 'maxFiles', 'maxFileSize', 'accept', 'size', 'invalidFileTypeError', 'maxFilesExceededError', 'fileTooBigError', 'setFormValue', 'autoDiscover', 'helperText', 'errorText', 'label', '_vividAriaBehaviour', 'value', 'currentValue', 'initialValue', 'disabled', 'name', 'required', 'VIVID_VERSION', 'componentName'] }) VwcFilePicker.displayName = 'VwcFilePicker' export default VwcFilePicker