Skip to content

Commit

Permalink
feat: add _list_ attribute to text-field (#532)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurishkamat authored Aug 23, 2021
1 parent 952218d commit 4f50b6a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
2 changes: 0 additions & 2 deletions packages/components/src/components/checkbox/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@
### Depends on

- [scale-icon-action-success](../icons/action-success)
- [scale-icon-action-indeterminate](../icons/action-indeterminate)

### Graph
```mermaid
graph TD;
scale-checkbox --> scale-icon-action-success
scale-checkbox --> scale-icon-action-indeterminate
scale-data-grid --> scale-checkbox
style scale-checkbox fill:#f9f,stroke:#333,stroke-width:4px
```
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/components/data-grid/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ graph TD;
scale-menu-flyout-item --> scale-icon-action-success
scale-menu-flyout-item --> scale-icon-navigation-right
scale-checkbox --> scale-icon-action-success
scale-checkbox --> scale-icon-action-indeterminate
scale-dropdown --> scale-icon-navigation-collapse-down
scale-tag --> scale-icon-action-close
style scale-data-grid fill:#f9f,stroke:#333,stroke-width:4px
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/components/text-field/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
| `helperText` | `helper-text` | (optional) Input helper text | `string` | `''` |
| `inputId` | `input-id` | (optional) Input checkbox id | `string` | `undefined` |
| `label` | `label` | (optional) Input label | `string` | `''` |
| `list` | `list` | (optional) input list | `string` | `undefined` |
| `maxLength` | `max-length` | (optional) Input max length | `number` | `undefined` |
| `minLength` | `min-length` | (optional) Input min length | `number` | `undefined` |
| `name` | `name` | (optional) Input name | `string` | `''` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ describe('TextField', () => {
input-id ="input-text-field1"
transparent ="true"
styles ="styles"
</scale-text-field>`,
list="datalist"
></scale-text-field>`,
});

expect(specPage.rootInstance.type).toBe('email');
Expand All @@ -64,6 +65,7 @@ describe('TextField', () => {
expect(specPage.rootInstance.styles).toBe('styles');
expect(specPage.rootInstance.inputId).toBe('input-text-field1');
expect(specPage.rootInstance.hasFocus).toBe(false);
expect(specPage.rootInstance.list).toBe('datalist');
});

it('should handle focus with right hasFocus state', async () => {
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/components/text-field/text-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export class TextField {
@Prop() inputId?: string;
/** (optional) input background transparent */
@Prop() transparent?: boolean;
/** (optional) input list */
@Prop() list?: string;

/** (optional) Injected CSS styles */
@Prop() styles?: string;
Expand Down Expand Up @@ -100,6 +102,7 @@ export class TextField {
// because we get unwanted `scaleChange` events
// because how we keep this.value up-to-date for type="select"
// `this.value = selectedValue`

emitChange() {
this.scaleChange.emit({
value: this.value == null ? this.value : this.value.toString(),
Expand Down Expand Up @@ -160,6 +163,7 @@ export class TextField {
minLength={this.minLength}
maxLength={this.maxLength}
id={this.inputId}
list={this.list}
onInput={this.handleInput}
onChange={this.handleChange}
onFocus={this.handleFocus}
Expand Down

0 comments on commit 4f50b6a

Please sign in to comment.