Skip to content

Commit

Permalink
Merge pull request #98 from BrightspaceUI/dbatiste/use-lit-d2l-input-…
Browse files Browse the repository at this point in the history
…textarea

Update d2l-input-textarea to use the Lit implementation from core.
  • Loading branch information
dbatiste authored Jan 26, 2021
2 parents d45f333 + 0406119 commit 07070c6
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 820 deletions.
5 changes: 1 addition & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": "brightspace/polymer-3-config",
"globals": {
"fastdom": false
}
"extends": "brightspace/polymer-3-config"
}
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
node_modules
reports
package-lock.json

node_modules
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
*d2l-input-checkbox* @dlockhart
*d2l-input-search* @dbatiste @dlockhart
*d2l-input-text* @dlockhart @awikkerink
*d2l-input-textarea* @mdgbayly
*d2l-input-textarea* @mdgbayly @dbatiste
*d2l-input-radio* @mdgbayly
49 changes: 0 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1 @@
> Deprecated: use [BrightspaceUI/core](https://github.com/BrightspaceUI/core) instead.
The only component that isn't available in `@brightspace-ui/core` is `<d2l-input-textarea>`, so it remains here. It wasn't migrated due to its reliance on Polymer style mixins, and places that rely on overriding those mixins. Mixins aren't something that Lit supports. However, if you don't need `<d2l-input-textarea>`'s auto-grow functionality, [use the styles from core](https://github.com/BrightspaceUI/core/tree/master/components/inputs#text-areas).

### d2l-input-textarea

<img src="/screenshots/textarea.gif?raw=true" width="250">

Import `d2l-input-textarea.html`:

```html
<script type="module">
import 'node_modules/d2l-inputs/d2l-input-textarea.js';
</script>
```

A `<d2l-input-textarea>` custom element can now be used in your application:


```html
<d2l-input-textarea name="myInput" value="input value"></d2l-input-textarea>
```

Many of the same attributes from native [`<textarea>` are available](https://developer.mozilla.org/en/docs/Web/HTML/Element/textarea):

```html
<d2l-input-textarea disabled></d2l-input-textarea>
```

These attributes may also be used:
* `no-border` removes border styling from the text area.
* `hover-styles` applies (square) hover styling to the text area.

<img src="/screenshots/textarea-noborder.gif?raw=true" width="250">

```html
<d2l-input-textarea no-border hover-styles></d2l-input-textarea>
```

The `d2l-input-textarea` component dispatches an event (`change`) when text is entered/changed/removed:

```html
<script>
textarea.addEventListener('change', (e) => {
// e.target.value contains the text value
console.log(e.target.value);
});
</script>
```
When the input is cleared, the same event will be fired with an empty value.
107 changes: 0 additions & 107 deletions d2l-input-text-behavior.js

This file was deleted.

Loading

0 comments on commit 07070c6

Please sign in to comment.