@vonage/vivid-react
Version:
Vivid wrapped for easy React usage & IDE autocomplete support & typescript typings
991 lines (986 loc) • 22.7 kB
JavaScript
/*
* DO NOT EDIT THIS FILE. IT IS GENERATED
*/
/*
Code in this file were generated using following JSON:
{
"kind": "class",
"description": "",
"name": "Select",
"cssProperties": [
{
"name": "--vvd-select-accent-primary",
"default": "var(--vvd-color-canvas-text)"
},
{
"name": "--vvd-select-accent-primary-text",
"default": "var(--vvd-color-canvas)"
},
{
"name": "--vvd-select-accent-primary-increment",
"default": "var(--vvd-color-neutral-800)"
},
{
"name": "--vvd-select-accent-intermediate",
"default": "var(--vvd-color-neutral-500)"
},
{
"name": "--vvd-select-accent-faint",
"default": "var(--vvd-color-neutral-50)"
},
{
"name": "--vvd-select-accent-soft",
"default": "var(--vvd-color-neutral-100)"
},
{
"name": "--vvd-select-accent-firm",
"default": "var(--vvd-color-canvas-text)"
},
{
"name": "--vvd-select-accent-fierce",
"default": "var(--vvd-color-neutral-700)"
}
],
"slots": [
{
"description": "Default slot.",
"name": ""
},
{
"description": "The preferred way to add an icon to the select control.",
"name": "icon"
},
{
"description": "Slot to add meta content to the select control.",
"name": "meta"
},
{
"description": "Describes how to use the select. Alternative to the `helper-text` attribute.",
"name": "helper-text"
}
],
"members": [
{
"kind": "field",
"name": "multiple",
"type": {
"text": "boolean"
},
"description": "Indicates if the listbox is in multi-selection mode.",
"privacy": "public"
},
{
"kind": "method",
"name": "setSelectedOptions",
"privacy": "public",
"description": "Sets an option as selected and gives it focus.",
"inheritedFrom": {
"name": "Listbox",
"module": "src/shared/foundation/listbox/listbox.ts"
}
},
{
"kind": "field",
"name": "open",
"type": {
"text": "boolean"
},
"default": "false",
"description": "The open attribute.",
"privacy": "public"
},
{
"kind": "field",
"name": "scale",
"type": {
"text": "SelectSize | undefined"
},
"description": "The size the select should have.",
"privacy": "public"
},
{
"kind": "field",
"name": "appearance",
"type": {
"text": "SelectAppearance | undefined"
},
"description": "The appearance attribute.",
"privacy": "public"
},
{
"kind": "field",
"name": "shape",
"type": {
"text": "SelectShape | undefined"
},
"description": "The shape attribute.",
"privacy": "public"
},
{
"kind": "field",
"name": "fixedDropdown",
"type": {
"text": "boolean"
},
"default": "false",
"description": "The fixed-dropdown attribute.",
"privacy": "public"
},
{
"kind": "field",
"name": "placeholder",
"type": {
"text": "string | undefined"
},
"description": "The placeholder attribute.",
"privacy": "public"
},
{
"kind": "field",
"name": "displayValue",
"type": {
"text": "string"
},
"readonly": true
},
{
"kind": "method",
"name": "_newDefaultSelectedIndex",
"privacy": "protected",
"return": {
"type": {
"text": "number | null"
}
},
"parameters": [
{
"name": "prev",
"type": {
"text": "ListboxOption[]"
}
},
{
"name": "next",
"type": {
"text": "ListboxOption[]"
}
},
{
"name": "currentSelectIndex",
"type": {
"text": "number"
}
}
],
"inheritedFrom": {
"name": "Listbox",
"module": "src/shared/foundation/listbox/listbox.ts"
}
},
{
"kind": "method",
"name": "_isDefaultSelected",
"privacy": "protected",
"parameters": [
{
"name": "option",
"type": {
"text": "ListboxOption"
}
}
],
"inheritedFrom": {
"name": "Listbox",
"module": "src/shared/foundation/listbox/listbox.ts"
}
},
{
"kind": "method",
"name": "slottedOptionsChanged",
"parameters": [
{
"name": "prev",
"type": {
"text": "Element[] | undefined"
}
},
{
"name": "next",
"type": {
"text": "Element[]"
}
}
]
},
{
"kind": "method",
"name": "formResetCallback"
},
{
"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": "validate",
"inheritedFrom": {
"name": "WithErrorText",
"module": "src/shared/patterns/form-elements/with-error-text.ts"
}
},
{
"kind": "field",
"name": "successText",
"type": {
"text": "string | undefined"
},
"description": "Provides a custom success message. Any current error state will be overridden.",
"privacy": "public",
"inheritedFrom": {
"name": "WithSuccessText",
"module": "src/shared/patterns/form-elements/with-success-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": "'host'",
"type": {
"text": "'host'"
},
"inheritedFrom": {
"name": "HostSemantics",
"module": "src/shared/aria/host-semantics.ts"
}
},
{
"kind": "field",
"name": "iconTrailing",
"type": {
"text": "boolean"
},
"default": "false",
"description": "Indicates the icon affix alignment.",
"privacy": "public",
"inheritedFrom": {
"name": "AffixIconWithTrailing",
"module": "src/shared/patterns/affix.ts"
}
},
{
"kind": "field",
"name": "icon",
"type": {
"text": "string | undefined"
},
"description": "A decorative icon the custom element should have.",
"privacy": "public",
"inheritedFrom": {
"name": "AffixIcon",
"module": "src/shared/patterns/affix.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"
},
"description": "Sets the element's disabled state. A disabled element will not be included during form submission.",
"privacy": "public",
"default": "false",
"inheritedFrom": {
"name": "Listbox",
"module": "src/shared/foundation/listbox/listbox.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": "length",
"type": {
"text": "number"
},
"description": "The number of options.",
"privacy": "public",
"readonly": true,
"inheritedFrom": {
"name": "Listbox",
"module": "src/shared/foundation/listbox/listbox.ts"
}
},
{
"kind": "field",
"name": "options",
"type": {
"text": "ListboxOption[]"
},
"description": "The list of options.",
"privacy": "public",
"inheritedFrom": {
"name": "Listbox",
"module": "src/shared/foundation/listbox/listbox.ts"
}
},
{
"kind": "field",
"name": "selectedIndex",
"type": {
"text": "number"
},
"default": "-1",
"description": "The index of the selected option.",
"privacy": "public",
"inheritedFrom": {
"name": "Listbox",
"module": "src/shared/foundation/listbox/listbox.ts"
}
},
{
"kind": "field",
"name": "selectedOptions",
"type": {
"text": "ListboxOption[]"
},
"default": "[]",
"description": "A collection of the selected options.",
"privacy": "public",
"inheritedFrom": {
"name": "Listbox",
"module": "src/shared/foundation/listbox/listbox.ts"
}
},
{
"kind": "field",
"name": "slottedOptionFilter",
"static": true,
"description": "A static filter to include only selectable options.",
"parameters": [
{
"description": "element to filter",
"name": "n"
}
],
"privacy": "public",
"inheritedFrom": {
"name": "Listbox",
"module": "src/shared/foundation/listbox/listbox.ts"
}
},
{
"kind": "method",
"name": "getNextSelectableIndex",
"privacy": "protected",
"parameters": [
{
"name": "fromIndex",
"type": {
"text": "number"
}
}
],
"inheritedFrom": {
"name": "Listbox",
"module": "src/shared/foundation/listbox/listbox.ts"
}
},
{
"kind": "method",
"name": "_validSelectedIndex",
"privacy": "protected",
"return": {
"type": {
"text": "number"
}
},
"parameters": [
{
"name": "index",
"type": {
"text": "number"
}
}
],
"inheritedFrom": {
"name": "Listbox",
"module": "src/shared/foundation/listbox/listbox.ts"
}
},
{
"kind": "method",
"name": "selectFirstOption",
"return": {
"type": {
"text": "void"
}
},
"description": "Moves focus to the first selectable option.",
"privacy": "public",
"inheritedFrom": {
"name": "Listbox",
"module": "src/shared/foundation/listbox/listbox.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": "Fires a custom 'input' event when the value updates",
"name": "input"
},
{
"type": {
"text": "CustomEvent<HTMLElement>"
},
"description": "Fires a custom 'change' event when the value updates",
"name": "change"
}
],
"attributes": [
{
"name": "multiple",
"type": {
"text": "boolean"
},
"description": "Indicates if the listbox is in multi-selection mode.",
"fieldName": "multiple"
},
{
"name": "open",
"type": {
"text": "boolean"
},
"default": "false",
"description": "The open attribute.",
"fieldName": "open"
},
{
"name": "scale",
"type": {
"text": "SelectSize | undefined"
},
"description": "The size the select should have.",
"fieldName": "scale"
},
{
"name": "appearance",
"type": {
"text": "SelectAppearance | undefined"
},
"description": "The appearance attribute.",
"fieldName": "appearance"
},
{
"name": "shape",
"type": {
"text": "SelectShape | undefined"
},
"description": "The shape attribute.",
"fieldName": "shape"
},
{
"name": "fixed-dropdown",
"type": {
"text": "boolean"
},
"default": "false",
"description": "The fixed-dropdown attribute.",
"fieldName": "fixedDropdown"
},
{
"name": "placeholder",
"type": {
"text": "string | undefined"
},
"description": "The placeholder attribute.",
"fieldName": "placeholder"
},
{
"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": "success-text",
"type": {
"text": "string | undefined"
},
"description": "Provides a custom success message. Any current error state will be overridden.",
"fieldName": "successText",
"inheritedFrom": {
"name": "WithSuccessText",
"module": "src/shared/patterns/form-elements/with-success-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": "icon-trailing",
"type": {
"text": "boolean"
},
"default": "false",
"description": "Indicates the icon affix alignment.",
"fieldName": "iconTrailing",
"inheritedFrom": {
"name": "AffixIconWithTrailing",
"module": "src/shared/patterns/affix.ts"
}
},
{
"name": "icon",
"type": {
"text": "string | undefined"
},
"description": "A decorative icon the custom element should have.",
"fieldName": "icon",
"inheritedFrom": {
"name": "AffixIcon",
"module": "src/shared/patterns/affix.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"
},
"description": "Sets the element's disabled state. A disabled element will not be included during form submission.",
"fieldName": "disabled",
"default": "false",
"inheritedFrom": {
"name": "Listbox",
"module": "src/shared/foundation/listbox/listbox.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": "WithLightDOMFeedback",
"module": "/src/shared/feedback/mixins"
},
{
"name": "WithContextualHelp",
"module": "/src/shared/patterns"
},
{
"name": "WithErrorText",
"module": "/src/shared/patterns"
},
{
"name": "WithSuccessText",
"module": "/src/shared/patterns"
},
{
"name": "FormElement",
"module": "/src/shared/patterns"
},
{
"name": "HostSemantics",
"module": "/src/shared/aria/host-semantics"
},
{
"name": "AffixIconWithTrailing",
"module": "/src/shared/patterns"
},
{
"name": "FormAssociated",
"module": "/src/shared/foundation/form-associated/form-associated"
}
],
"superclass": {
"name": "Listbox",
"module": "/src/shared/foundation/listbox/listbox"
},
"vividComponent": {
"public": true,
"name": "select",
"vueModels": [
{
"name": "modelValue",
"propName": "value",
"eventNames": [
"input"
],
"valueMapping": "event.currentTarget.value"
}
]
},
"vividTesting": {
"selectors": [],
"actions": [
{
"name": "selectOptionByValue",
"args": [
"selectOptionByValue"
]
},
{
"name": "selectOptionByText",
"args": [
"selectOptionByText"
]
}
],
"queries": [],
"refs": []
}
}
*/
import wrapper from '@vonage/vivid-react-wrapper'
import { registerSelect } from '@vonage/vivid'
registerSelect('vvd3')
const VwcSelect = wrapper(`vvd3-select`, {
events: [{"name":"change","propName":"onChange"},{"name":"input","propName":"onInput"}],
attributes: [],
properties: ['disabled', 'errorText', 'helperText', 'icon', 'iconTrailing', 'initialValue', 'label', 'name', 'required', 'successText', 'value', 'multiple', 'open', 'scale', 'appearance', 'shape', 'fixedDropdown', 'placeholder', 'helperText', 'errorText', 'validate', 'successText', 'label', '_vividAriaBehaviour', 'iconTrailing', 'icon', 'value', 'currentValue', 'initialValue', 'disabled', 'name', 'required', 'options', 'selectedIndex', 'selectedOptions', 'slottedOptionFilter', 'VIVID_VERSION', 'componentName']
})
VwcSelect.displayName = 'VwcSelect'
export default VwcSelect