From 9ab46f23302ba3fb0bcbe1fcc64016a04920a8ac Mon Sep 17 00:00:00 2001 From: Tom Dye Date: Fri, 22 Mar 2019 17:35:48 +0000 Subject: [PATCH 1/2] add helpertext to select --- src/select/example/index.ts | 27 +++++++++++++++ src/select/index.ts | 58 ++++++++++++++------------------- src/select/tests/unit/Select.ts | 24 ++++++++++++-- 3 files changed, 73 insertions(+), 36 deletions(-) diff --git a/src/select/example/index.ts b/src/select/example/index.ts index 496a4d325b..4c156cb83c 100644 --- a/src/select/example/index.ts +++ b/src/select/example/index.ts @@ -103,6 +103,33 @@ export default class App extends WidgetBase { this._value3 = option; this.invalidate(); } + }), + v('br'), + w(Select, { + key: 'select4', + ...this.getOptionSettings(), + getOptionSelected: (option: any) => !!this._value1 && option.value === this._value1, + label: 'Native select with helper text', + options: this._selectOptions, + useNativeElement: true, + value: this._value1, + onChange: (option: any) => { + this._value1 = option.value; + this.invalidate(); + }, + helperText: 'pick a value' + }), + w(Select, { + key: 'select5', + ...this.getOptionSettings(), + label: 'Custom select box with helper text', + options: this._moreSelectOptions, + value: this._value2, + onChange: (option: any) => { + this._value2 = option.value; + this.invalidate(); + }, + helperText: 'pick a value' }) ]); } diff --git a/src/select/index.ts b/src/select/index.ts index 1fd2f66d81..3678b00d68 100644 --- a/src/select/index.ts +++ b/src/select/index.ts @@ -9,12 +9,14 @@ import { v, w } from '@dojo/framework/widget-core/d'; import { uuid } from '@dojo/framework/core/util'; import { find } from '@dojo/framework/shim/array'; import { formatAriaProperties, Keys } from '../common/util'; -import { CustomAriaProperties, LabeledProperties, InputProperties } from '../common/interfaces'; +import { CustomAriaProperties, InputProperties } from '../common/interfaces'; import Icon from '../icon/index'; import Label from '../label/index'; import Listbox from '../listbox/index'; +import HelperText from '../helper-text/index'; import * as css from '../theme/select.m.css'; import { customElement } from '@dojo/framework/widget-core/decorators/customElement'; +import { helperText } from '../theme/text-input.m.css'; /** * @type SelectProperties @@ -32,13 +34,14 @@ import { customElement } from '@dojo/framework/widget-core/decorators/customElem * @property useNativeElement Use the native