From b28cf02ef3979c844c498a8e30ee977937984828 Mon Sep 17 00:00:00 2001 From: Tawfiek Khalaf Date: Mon, 11 Nov 2019 21:27:45 +0200 Subject: [PATCH] feat(alert): add support for textarea (#16851) resolves #14153 --- core/src/components/alert/alert-interface.ts | 2 +- core/src/components/alert/alert.scss | 5 ++ core/src/components/alert/alert.tsx | 59 +++++++++++++------ core/src/components/alert/alert.vars.scss | 3 + core/src/components/alert/readme.md | 16 ++++- .../components/alert/test/basic/index.html | 5 ++ .../components/alert/test/preview/index.html | 0 core/src/components/alert/usage/angular.md | 7 +++ core/src/components/alert/usage/javascript.md | 7 +++ core/src/interface.d.ts | 1 - 10 files changed, 83 insertions(+), 22 deletions(-) create mode 100644 core/src/components/alert/test/preview/index.html diff --git a/core/src/components/alert/alert-interface.ts b/core/src/components/alert/alert-interface.ts index 4b109ea99f..cee6826020 100644 --- a/core/src/components/alert/alert-interface.ts +++ b/core/src/components/alert/alert-interface.ts @@ -20,7 +20,7 @@ export interface AlertOptions { } export interface AlertInput { - type?: TextFieldTypes | 'checkbox' | 'radio'; + type?: TextFieldTypes | 'checkbox' | 'radio' | 'textarea'; name?: string; placeholder?: string; value?: any; diff --git a/core/src/components/alert/alert.scss b/core/src/components/alert/alert.scss index e62adb3890..99f254e35d 100644 --- a/core/src/components/alert/alert.scss +++ b/core/src/components/alert/alert.scss @@ -197,3 +197,8 @@ .alert-checkbox-inner { box-sizing: border-box; } + +textarea.alert-input { + min-height: $alert-input-min-height; + resize: none; +} diff --git a/core/src/components/alert/alert.tsx b/core/src/components/alert/alert.tsx index da9058d323..e2e9f4b1a3 100644 --- a/core/src/components/alert/alert.tsx +++ b/core/src/components/alert/alert.tsx @@ -373,25 +373,46 @@ export class Alert implements ComponentInterface, OverlayInterface { } return (
- { inputs.map(i => ( -
- i.value = (e.target as any).value} - id={i.id} - disabled={i.disabled} - tabIndex={0} - class={{ - 'alert-input': true, - 'alert-input-disabled': i.disabled || false - }} - /> -
- ))} + { inputs.map(i => { + if (i.type === 'textarea') { + return ( +
+