From 476fef679b75cd5147db6a19425b52a6f12ff862 Mon Sep 17 00:00:00 2001 From: Stijn Van Asschodt Date: Wed, 26 Feb 2020 15:13:50 +0100 Subject: [PATCH] chore(lion-switch): show info type validator (#598) --- packages/switch/stories/index.stories.mdx | 25 ++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/switch/stories/index.stories.mdx b/packages/switch/stories/index.stories.mdx index 47c76b267..2ebe7c90d 100644 --- a/packages/switch/stories/index.stories.mdx +++ b/packages/switch/stories/index.stories.mdx @@ -1,6 +1,7 @@ import { Story, Meta, html } from '@open-wc/demoing-storybook'; import { Validator } from '@lion/validate'; +import { LionSwitch } from '../src/LionSwitch'; import '../lion-switch.js'; @@ -75,19 +76,26 @@ Simple example that illustrates where validation feedback will be displayed. return "You won't get the latest news!"; } }; + class CustomSwitch extends LionSwitch { + static get validationTypes() { + return [...super.validationTypes, 'info']; + } + } + customElements.define('custom-switch', CustomSwitch) return html` - + > `; }} ```js import { Validator } from '@lion/validate'; +import { LionSwitch } from '@lion/switch/src/LionSwitch'; const IsTrue = class extends Validator { constructor(...args) { @@ -101,13 +109,20 @@ const IsTrue = class extends Validator { return "You won't get the latest news!"; } }; + +class CustomSwitch extends LionSwitch { + static get validationTypes() { + return [...super.validationTypes, 'info']; + } +} +customElements.define('custom-switch', CustomSwitch); ``` ```html - + .validators="${[new IsTrue(null, {type: 'error'})]}" +> ```