import FieldStyles from "../styles/FieldStyles.wrn" import ComponentBaseStyles from "../styles/ComponentBaseStyles.wrn" component Switch { outputs { input(payload: { value?: string | number | boolean | null; values?: Array; sourceEvent?: Event; [key: string]: string | number | boolean | null | object } | string | number | boolean | null) change(payload: { value?: string | number | boolean | null; values?: Array; sourceEvent?: Event; [key: string]: string | number | boolean | null | object } | string | number | boolean | null) focus(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object }) blur(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object }) } props { size: string = "default" color: string = "primary" id: string = "" name: string = "" label: string = "Switch" hiddenLabel: boolean = false placeholder: string = "" variant: string = "normal" icon: string = "" iconPosition: string = "start" value: string = "on" checked: boolean = false helperText: string = "" cornerHint: string = "" error: string = "" inline: boolean = false readonly: boolean = false disabled: boolean = false required: boolean = false class: string = "" } functions { client function emitField(nameEvent, sourceEvent) { sourceEvent.stopPropagation(); output[nameEvent]({ checked: sourceEvent.currentTarget.checked, value: value, name: name, sourceEvent: sourceEvent }) } client function preventReadonly(sourceEvent) { if (readonly) sourceEvent.preventDefault() } } view {
{#if cornerHint}{label}{cornerHint}{/if}
{#if helperText}{helperText}{/if}{error}