{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "definitions": {
        "SelectOption": {
            "properties": {
                "label": {
                    "type": "string"
                },
                "value": {
                }
            },
            "required": [
                "label",
                "value"
            ],
            "type": "object"
        }
    },
    "description": "# drayman-select\n\nSelect field powered by [Angular Material](https://material.angular.io/) and [ngx-mat-select-search](https://github.com/bithost-gmbh/ngx-mat-select-search) libraries.\nIt can render a set of provided options (by specifying `options` field) or load them from a remote resource (by providing `loadOptions` function).\n\n## Example of usage\n\n### Loading from remote resource\n![](media://drayman-select.gif)\n\n```typescript\nimport axios from 'axios';\n\nmodule.exports = async ({ forceUpdate }) => {\n     let selectedMovie;\n     let movies = [];\n\n     return () => {\n         const options: DraymanSelect = {\n             options: movies.map(x => ({ value: x.id, label: x.title })),\n             label: 'Movie title',\n             onSearchChange: async ({ value }) => {\n                 if (!value) {\n                     movies = [];\n                 } else {\n                     const result = await axios.get(`https://api.themoviedb.org/3/search/movie?api_key=API_KEY&query=${value}`);\n                     movies = result.data.results;\n                 }\n                 await forceUpdate();\n             },\n             onValueChange: async ({ value }) => {\n                 selectedMovie = movies.find(x => x.id === value);\n                 await forceUpdate();\n             },\n             value: selectedMovie?.id,\n         }\n         return (\n             <container key=\"wrapper\" style={{ padding: '0 30px' }}>\n                 <drayman-select key=\"movie-select\" {...options} />\n                 {selectedMovie &&\n                     <html key=\"movie-info\">\n                         <h3>{selectedMovie.title}</h3>\n                         <img src={`https://image.tmdb.org/t/p/w200${selectedMovie.poster_path}`} />\n                         <p><b>📅 {selectedMovie.release_date}</b></p>\n                         <p><b>⭐ {selectedMovie.vote_average} / 10</b></p>\n                         <p><i>📝 {selectedMovie.overview}</i></p>\n                     </html>\n                 }\n             </container>\n         );\n     }\n}\n```\n\n### Rendering provided options\n![](media://drayman-select-basic.gif)\n\n```typescript\nmodule.exports = async ({ forceUpdate }) => {\n     let colorHex;\n\n     return () => {\n         const options: DraymanSelect = {\n             label: 'Color',\n             options: [\n                 { label: 'Red', value: '#e0091e' },\n                 { label: 'Green', value: '#2e8b57' },\n                 { label: 'Blue', value: '#3b90ff' },\n             ],\n             onValueChange: async ({ value }) => {\n                 colorHex = value;\n                 await forceUpdate();\n             },\n             value: colorHex,\n         }\n         return (\n             <container key=\"wrapper\" style={{ padding: '0 30px' }}>\n                 <drayman-select key=\"color-select\" {...options} />\n                 {colorHex &&\n                     <html key=\"color-info\">\n                         <div style={{ 'background-color': colorHex, width: '100px', height: '100px' }}></div>\n                         <p>Selected color hex: {colorHex}</p>\n                     </html>\n                 }\n             </container>\n         );\n     }\n}\n```",
    "properties": {
        "disabled": {
            "description": "Whether the control is disabled.",
            "type": "boolean"
        },
        "error": {
            "description": "Error text to be shown underneath the form field control.",
            "type": "string"
        },
        "helpText": {
            "description": "Hint text to be shown underneath the form field control.",
            "type": "string"
        },
        "label": {
            "description": "The floating label for a field.",
            "type": "string"
        },
        "multiple": {
            "description": "Whether the user should be allowed to select multiple options.",
            "type": "boolean"
        },
        "onSearchChange": {
            "description": "This function can be used to override default selection search algorithm.\nAccepts value of the search input. Can be `null`.\nIf this function is not defined, options will be filtered client-side.",
            "type": "object"
        },
        "onValueChange": {
            "description": "Executed with an input value from user.",
            "type": "object"
        },
        "onValueChangeStart": {
            "description": "Executed when user starts typing.",
            "type": "object"
        },
        "options": {
            "description": "Array of options that populate the select menu.",
            "items": {
                "$ref": "#/definitions/SelectOption"
            },
            "type": "array"
        },
        "placeholder": {
            "description": "The placeholder text.",
            "type": "string"
        },
        "updateOnBlur": {
            "description": "Wether value of the field should be emitted when user is blurred out of the control.",
            "type": "boolean"
        },
        "value": {
            "description": "Value of the input."
        }
    },
    "type": "object"
}

