From 038dd3ad82da5e45a7fc40cb6f3834497eb2b936 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Sat, 23 Jan 2021 05:47:26 -0800 Subject: [PATCH] feat(dropdown): support warning state --- COMPONENT_INDEX.md | 8 ++++- docs/src/COMPONENT_API.json | 42 +++++++++++++++++++++++++- docs/src/pages/components/Dropdown.svx | 12 ++++++++ src/Dropdown/Dropdown.svelte | 21 ++++++++++--- src/ListBox/ListBox.svelte | 10 ++++++ types/Dropdown/Dropdown.d.ts | 12 ++++++++ types/FluidForm/FluidForm.d.ts | 1 + types/ListBox/ListBox.d.ts | 12 ++++++++ 8 files changed, 112 insertions(+), 6 deletions(-) diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 2b93f979..a76b2f09 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -983,6 +983,8 @@ export interface DropdownItem { | titleText | let | No | string | "" | Specify the title text | | invalid | let | No | boolean | false | Set to `true` to indicate an invalid state | | invalidText | let | No | string | "" | Specify the invalid state text | +| warn | let | No | boolean | false | Set to `true` to indicate an warning state | +| warnText | let | No | string | "" | Specify the warning state text | | helperText | let | No | string | "" | Specify the helper text | | label | let | No | string | -- | Specify the list box label | | translateWithId | let | No | (id: any) => string | -- | Override the default translation ids | @@ -1234,7 +1236,9 @@ None. ### Events -None. +| Event name | Type | Detail | +| :--------- | :-------- | :----- | +| submit | forwarded | -- | ## `Form` @@ -1807,6 +1811,8 @@ None. | disabled | let | No | boolean | false | Set to `true` to disable the list box | | invalid | let | No | boolean | false | Set to `true` to indicate an invalid state | | invalidText | let | No | string | "" | Specify the invalid state text | +| warn | let | No | boolean | false | Set to `true` to indicate an warning state | +| warnText | let | No | string | "" | Specify the warning state text | ### Slots diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index b26e021e..4f6c0ff1 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -1125,6 +1125,26 @@ "isFunction": false, "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 } ], "slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }], @@ -3799,6 +3819,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": "helperText", "kind": "let", @@ -4506,7 +4546,7 @@ "filePath": "/src/FluidForm/FluidForm.svelte", "props": [], "slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }], - "events": [], + "events": [{ "type": "forwarded", "name": "submit", "element": "Form" }], "typedefs": [], "rest_props": { "type": "InlineComponent", "name": "Form" } }, diff --git a/docs/src/pages/components/Dropdown.svx b/docs/src/pages/components/Dropdown.svx index 0aff004d..70654277 100644 --- a/docs/src/pages/components/Dropdown.svx +++ b/docs/src/pages/components/Dropdown.svx @@ -51,6 +51,18 @@ Use the `itemToString` prop to format the display of individual items. {id: "1", text: "Email"}, {id: "2", text: "Fax"}]}" /> +### Invalid state + + + +### Warning state + + + ### Disabled state {#if invalid} {/if} + {#if !invalid && warn} + + {/if}