Skip to content

Commit a372757

Browse files
author
Chris Hart
committed
feat(ui-text-input): add controlled TextInput
refs: INSTUI-1762 Test plan: - Verify a new ui-text-input package exists in the docs - Verify the example on the ui-text-input package docs page - Verify the package contains a single TextInputControlled component - Verify the TextInputControlled example Change-Id: I010d39d50b0fe02f79b71b7c20f48c966f811d43 Reviewed-on: https://gerrit.instructure.com/182641 Tested-by: Jenkins Reviewed-by: Jennifer Stern <jstern@instructure.com> QA-Review: Daniel Sasaki <dsasaki@instructure.com> Product-Review: Chris Hart <chart@instructure.com>
1 parent 1d863e3 commit a372757

File tree

21 files changed

+1101
-0
lines changed

21 files changed

+1101
-0
lines changed

packages/__docs__/components.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export TimeInput from '@instructure/ui-forms/lib/components/TimeInput'
4848
export * from '@instructure/ui-form-field/lib/components'
4949

5050
export { NumberInput as NumberInputControlled } from '@instructure/ui-number-input/lib/components'
51+
export { TextInput as TextInputControlled } from '@instructure/ui-text-input/lib/components'
5152

5253
export * from '@instructure/ui-i18n/lib/components'
5354
export * from '@instructure/ui-layout/lib/components'

packages/__docs__/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@instructure/ui-portal": "^5.43.0",
5656
"@instructure/ui-svg-images": "^5.43.0",
5757
"@instructure/ui-tabs": "^5.43.0",
58+
"@instructure/ui-text-input": "^5",
5859
"@instructure/ui-themeable": "^5.43.0",
5960
"@instructure/ui-themes": "^5.43.0",
6061
"@instructure/ui-toggle-details": "^5.43.0",

packages/__docs__/resolve.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ module.exports = {
4545
'@instructure/ui-menu$': path.resolve(__dirname, '../ui-menu/src/'),
4646
'@instructure/ui-motion$': path.resolve(__dirname, '../ui-motion/src/'),
4747
'@instructure/ui-navigation$': path.resolve(__dirname, '../ui-navigation/src/'),
48+
'@instructure/ui-text-input$': path.resolve(__dirname, '../ui-text-input/src/'),
4849
'@instructure/ui-overlays$': path.resolve(__dirname, '../ui-overlays/src/'),
4950
'@instructure/ui-pagination$': path.resolve(__dirname, '../ui-pagination/src/'),
5051
'@instructure/ui-pages$': path.resolve(__dirname, '../ui-pages/src/'),
@@ -81,6 +82,7 @@ module.exports = {
8182
'@instructure/ui-portal/lib': path.resolve(__dirname, '../ui-portal/src'),
8283
'@instructure/ui-svg-images/lib': path.resolve(__dirname, '../ui-svg-images/src'),
8384
'@instructure/ui-tabs/lib': path.resolve(__dirname, '../ui-tabs/src'),
85+
'@instructure/ui-text-input/lib': path.resolve(__dirname, '../ui-text-input/src'),
8486
'@instructure/ui-toggle-details/lib': path.resolve(__dirname, '../ui-toggle-details/src'),
8587
'@instructure/ui-tree-browser/lib': path.resolve(__dirname, '../ui-tree-browser/src'),
8688
'@instructure/ui-utils/lib': path.resolve(__dirname, '../ui-utils/src'),

packages/ui-text-input/.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/node_modules/**
2+
/lib/**
3+
/es/**

packages/ui-text-input/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
lib/
2+
.babel-cache/
3+
es/

packages/ui-text-input/.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**/.*
2+
**/__tests__
3+
**/__testfixtures__
4+
*.config.js
5+
*.conf.js

packages/ui-text-input/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
See the instructure-ui mono-repo [change log](#CHANGELOG) for past changes.

packages/ui-text-input/README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
category: packages
3+
---
4+
5+
## ui-text-input
6+
7+
[![npm][npm]][npm-url]
8+
[![build-status][build-status]][build-status-url]
9+
[![MIT License][license-badge]][LICENSE]
10+
[![Code of Conduct][coc-badge]][coc]
11+
12+
A UI component library made by Instructure Inc.
13+
14+
### Installation
15+
16+
```sh
17+
yarn add @instructure/ui-text-input
18+
```
19+
20+
### Components
21+
The `ui-text-input` package contains the following:
22+
- [TextInputControlled](#TextInputControlled)
23+
24+
```javascript
25+
---
26+
example: true
27+
render: false
28+
---
29+
class ControlledTextInputExample extends React.Component {
30+
constructor (props) {
31+
super(props)
32+
33+
this.state = {
34+
value: 'Mint chocolate chip'
35+
}
36+
}
37+
38+
handleChange = (e, value) => this.setState({ value })
39+
40+
render () {
41+
return (
42+
<View as="div">
43+
<TextInputControlled
44+
label="What is your favorite ice cream flavor?"
45+
value={this.state.value}
46+
onChange={this.handleChange}
47+
/>
48+
<View as="div" margin="medium none none">
49+
<code>this.state.value = {this.state.value}</code>
50+
</View>
51+
</View>
52+
)
53+
}
54+
}
55+
56+
render(<ControlledTextInputExample />)
57+
```
58+
59+
[npm]: https://img.shields.io/npm/v/@instructure/ui-text-input.svg
60+
[npm-url]: https://npmjs.com/package/@instructure/ui-text-input
61+
62+
[build-status]: https://travis-ci.org/instructure/instructure-ui.svg?branch=master
63+
[build-status-url]: https://travis-ci.org/instructure/instructure-ui "Travis CI"
64+
65+
[license-badge]: https://img.shields.io/npm/l/instructure-ui.svg?style=flat-square
66+
[license]: https://github.com/instructure/instructure-ui/blob/master/LICENSE
67+
68+
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
69+
[coc]: https://github.com/instructure/instructure-ui/blob/master/CODE_OF_CONDUCT.md
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2015 - present Instructure, Inc.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
module.exports = {
26+
presets: [[
27+
require('@instructure/ui-babel-preset'),
28+
{
29+
coverage: Boolean(process.env.COVERAGE),
30+
esModules: Boolean(process.env.ES_MODULES)
31+
}
32+
]]
33+
}

packages/ui-text-input/package.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "@instructure/ui-text-input",
3+
"version": "5.42.0",
4+
"description": "A UI component library made by Instructure Inc.",
5+
"author": "Instructure, Inc. Engineering and Product Design",
6+
"main": "./lib/index.js",
7+
"module": "./es/index.js",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/instructure/instructure-ui.git"
11+
},
12+
"homepage": "https://instructure.github.io/instructure-ui/",
13+
"bugs": "https://github.com/instructure/instructure-ui/issues",
14+
"scripts": {
15+
"lint": "ui-test --lint",
16+
"lint:fix": "ui-test --lint --fix",
17+
"clean": "ui-build --clean",
18+
"build": "ui-build",
19+
"build:watch": "ui-build --watch"
20+
},
21+
"license": "MIT",
22+
"devDependencies": {
23+
"@instructure/ui-babel-preset": "^5",
24+
"@instructure/ui-test-utils": "^5"
25+
},
26+
"dependencies": {
27+
"@babel/runtime": "^7",
28+
"@instructure/ui-form-field": "^5",
29+
"@instructure/ui-icons": "^5",
30+
"@instructure/ui-themeable": "^5",
31+
"@instructure/ui-testable": "^5",
32+
"@instructure/ui-utils": "^5",
33+
"@instructure/uid": "^5",
34+
"classnames": "^2",
35+
"prop-types": "^15",
36+
"react": "^0.14.9 || ^15 || ^16"
37+
},
38+
"publishConfig": {
39+
"access": "public"
40+
},
41+
"sideEffects": false
42+
}

0 commit comments

Comments
 (0)