Textarea

Definition

<cst-textarea>
<sub-theme/>
<sub-font/>
<sub-style/>
<sub-access/>
<sub-label/>
<sub-lr-icon/>
<sub-lr-icon/>
<sub-lr-label/>
<sub-lr-label/>
<sub-help-icon/>
<sub-feature-flag/>
</cst-textarea>

Example

<cst-textarea id="" value="">
<sub-theme name="" clr-var1="" clr-var2=""/>
<sub-font name="" font-var1="" font-var2=""/>
<sub-style name="" width="" height=""/>
<sub-access can-view="" can-modify=""/>
<sub-label text="" position=""/>
<sub-lr-icon name="" position="" title="" link=""/>
<sub-lr-icon name="" position="" title="" link=""/>
<sub-lr-label text="Rs" position="right"/>
<sub-lr-label text="" position=""/>
<sub-help-icon name="" position="" title="" link="">
<sub-feature-flag char-count-hide="">
</cst-textarea>

OR

<cst-element name="textarea" schema="" schema-prop="" value=""/>

Attributes

AttributeValueDescription
idstring typeIdentifier for component.
valuestring typeSpecifies the value for component.(two way bind attribute)
readonlyboolean typeSpecifies that an input field is read-only.
requiredboolean typeSpecifies if input field must be filled.
disabledboolean typeSpecifies if component should be disabled.(aurelia ext attribute)
autofocusboolean typeSpecifies if component should be focused when loaded.
placeholderstring typeSpecifies a short hint that describes expected value.
maxlengthnumber typeSpecifies maximum number of characters allowed in component's value.
rowsnumber typeSpecifies the visible number of lines in a text area.
classcst-mat-filled (default)
cst-mat-outline
cst-mat-standard
Specifies class to be applied(Multiple classes can be given with space).

sub-theme

object typeSpecifies theme to be used for component.

sub-font

object typeSpecifies fonts to be used for component.

sub-style

object typeSpecifies style to be applied to component.

sub-label

object typeSpecifies label to be displayed.

sub-lr-icons

array typeSpecifies icons to be displayed.

sub-lr-labels

array type

Specifies fixed text to be displayed in text field. Ref

sub-help-icon

object typeSpecifies help icon to be displayed.

sub-feature-flag

objectSpecifies what features to enable/disable.
otherany typeAny other info.
schemaobject type Specifies JSON schema.
schema-propstring typeSpecifies property to be used to pick schema.

Sub element attributes

sub-theme

PropertyValueDescription
nameprimary(default)/secondary/customName of the theme.
clr-labelstring typeIf custom then specific/ named color variables

sub-font

PropertyValueDescription
nameroboto (default)/customName of the font
font-textstring typeIf custom then specific/ named font variables.
font-labelstring type
font-errorstring type

sub-style

PropertyValueDescription
namematerial/skeuomorphic(standard/filled/shaped-filled/outlined/shaped-outlined)Name of design to be used.
widthpercentage/pixels/string(x-small,small,medium,large,x-large)Gives width/any other prop value

sub-label

PropertyValueDescription
textstring typeLabel text.
positionleft/top/center(default)Position of the label.

sub-lr-icons

(a.k.a left right icons)

PropertyValueDescription
namestring typeIcon name.
positionleft/rightPosition of the icon.
titlestring typeIcon tooltip
linkstring typeLink to be opened on click of icon.

sub-lr-labels

(a.k.a left right labels)

PropertyValueDescription
textstring typeLabel text.
positionleft/rightPosition of the label.

sub-help-icon

PropertyValueDescription
namestring typeIcon name.
positionleft/rightPosition of the icon.
titlestring typeIcon tooltip
linkstring typeLink to be opened on click.

sub-feature-flag

PropertyValueDescription
char-count-hideboolean typeSpecifies to hide character count.

Schema Examples

Full schema

Fetch appropriate based on schemaProp

let schema = {
type: "object",
required: ["customerRemark"], //= required
properties: {
customerRemark: {
type: "string",
maxlength: 50,
required: true/false,
title:"Remark",//= label
cstAttr: {
raw:{ //loop & add to element
readonly: true,
disabled : true,
autofocus : false,
class:'outline cst-class1'
placeholder: ' Enter'
},
others:{
},
subStyle:{ //loop & add to element style
name: '',
width:'',
height:'',
fontSize:''
}
subLabel:{
position:'',
text:''
},
subLrIcons:[{
name:'',
position:'',
title:'',
link
}],
subLrLabels: [{
text: '',
position: ''
}],
subHelpIcon: {
name: '',
position: '',
title:'',
link:''
},
subFeatureFlag: {
charCountHide: true
},
subTheme:{
name:'',
clrLabel:''
},
subFont:{
name:'',
fontText:'',
fontLabel:'',
fontError:''
}
}
}
}
}
let schemaProp = 'customerRemark';
let value = 'ABC'
let finalSchema = schemaProp ? schema.properties[schemaProp] : schema;

Exact schema

let schema = {
type: "string",
maxLength: 50,
title: "Remark", //= label
cstAttr: {
}
}
let schemaProp = '';
let value = 'ABC'
let finalSchema = schemaProp ? schema.properties[schemaProp] : schema;

Nested object

Nested object schemaProp

let schema = {};
let schemaProp = 'EMDDetails.customerRemark';
let value = 'ABC'
var finalSchema = schema;
let schemaPropSplits = schemaProp.split('.');
for(let prop of schemaPropSplits){
finalSchema = finalSchema.properties[schemaProp];
}

Material Measurement Guidelines

Filled Text (Without Value)

  • Total Width = 280px
  • Total Height(Without Helper text) = 56px
  • Helper Text Height = 16px
  • Padding left and right = 12px
  • Border = 1px

Spec

Filled Text (With Value)

  • Total Width = 280px
  • Total Height(Without Helper text) = 56px
  • Padding left and right = 12px
  • Border = 2px
  • Label Height = 20px
  • Icon Dimensions = 24X24

Spec

Outlined Text (Without Value)

  • Total Width = 280px
  • Total Height(Without Helper text) = 56px
  • Helper Text Height = 16px
  • Padding left and right = 12px
  • Border = 1px

Spec

Outlined Text (With Value)

  • Total Width = 280px
  • Total Height(Without Helper text) = 56px
  • Padding left = 14px
  • Padding right = 8px
  • Border = 2px
  • Label Height = 20px
  • Label margin left/right = 4px
  • Icon Dimensions = 24X24

Spec

Events

AttributeDescription
onblurFires when the element looses focus.
onchangeFires when the element's value changes.
onfocusFires when the element gets focus.
oninvalidScript to be run when an element is invalid.
onresetFires when reset button is clicked.
onkeydown/ onkeyup/ onkeypressFires when user presses a key.(currently not)
onvalidateCustom validate hook, must return error message else considered valid; will be called onchange.

Event Method signature

method(parentRefObj, evtObj, elm, others)

Parameters description

ParameterValueDescription
parentRefObj
parentRefObj = {
parentContext,
loopParentContext,
doubleLoopParentContext
}
Parent Context references
evtObjobjectEvent object
elmobjectElement value
othersanyOther value

OverRidable Classes

  • cst-ovr-textarea-elm
  • cst-ovr-textarea
  • cst-ovr-textarea-label
  • cst-ovr-textarea-helper-text
  • cst-ovr-textarea-error-text
  • cst-ovr-textarea-left-icon
  • cst-ovr-textarea-right-icon
  • cst-ovr-textarea-left-label
  • cst-ovr-textarea-right-label

Unit Test Screenshots

Responsiveness Test Screenshots

Design Images

Demo link

Points

  • event callback consistency (evtObj, elm, others,...) //check other libs
  • over-rideable classes (cst-ovr-elm) for label, textarea, icons, helper text, error text //check other libs
  • Show state indication (filled/ empty/ error/ right / focus) + color
  • Help text for *Required, error labels, text count
  • if large helper text wrap (mobile/ web)
  • if multiple errors show one, remaining on hover of error icon
  • fonts (text - Subtitle 1 - Regular 16, Label - Caption - Regular 12)
  • EXT trigger cases
  • Check logging, security, performance & flexibility