From 51eda02443e43929c730a34f9f4bd6bfbb7813da Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Wed, 17 Feb 2021 10:34:20 -0800 Subject: [PATCH] feat(combo-box): support warning state --- COMPONENT_INDEX.md | 2 ++ docs/src/COMPONENT_API.json | 20 ++++++++++++++++++++ docs/src/pages/components/ComboBox.svx | 9 +++++++++ src/ComboBox/ComboBox.svelte | 19 +++++++++++++++++-- types/ComboBox/ComboBox.d.ts | 12 ++++++++++++ 5 files changed, 60 insertions(+), 2 deletions(-) diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index eaf8dd9a..3e67fd12 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -617,6 +617,8 @@ export interface ComboBoxItem { | helperText | let | No | string | "" | Specify the helper text | | invalidText | let | No | string | "" | Specify the invalid state text | | invalid | let | No | boolean | false | Set to `true` to indicate an invalid state | +| warn | let | No | boolean | false | Set to `true` to indicate an warning state | +| warnText | let | No | string | "" | Specify the warning state text | | light | let | No | boolean | false | Set to `true` to enable the light variant | | shouldFilterItem | let | No | (item: ComboBoxItem, value: string) => boolean | () => true | Determine if an item should be filtered given the current combobox value | | translateWithId | let | No | (id: any) => string | -- | Override the default translation ids | diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index 7f93e654..0bbfa839 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -1258,6 +1258,26 @@ "constant": false, "reactive": false }, + { + "name": "warn", + "kind": "let", + "description": "Set to `true` to indicate an warning state", + "type": "boolean", + "value": "false", + "isFunction": false, + "constant": false, + "reactive": false + }, + { + "name": "warnText", + "kind": "let", + "description": "Specify the warning state text", + "type": "string", + "value": "\"\"", + "isFunction": false, + "constant": false, + "reactive": false + }, { "name": "light", "kind": "let", diff --git a/docs/src/pages/components/ComboBox.svx b/docs/src/pages/components/ComboBox.svx index 42936b24..02137516 100644 --- a/docs/src/pages/components/ComboBox.svx +++ b/docs/src/pages/components/ComboBox.svx @@ -59,6 +59,15 @@ items={[ {id: "2", text: "Fax"} ]} /> +### Warning state + + + ### Disabled {/if} {/if} + {#if !invalid && warn} + + {/if} {#if inputValue} {/if} - {#if !invalid && helperText} + {#if !invalid && helperText && !warn}