From ae147f962ed6ff0bbb5c89def6b216814243ffb4 Mon Sep 17 00:00:00 2001 From: Giovanni Gonzaga Date: Wed, 4 Apr 2018 11:28:10 +0200 Subject: [PATCH] move Password and Confirmation inputs to Input folder for clarity --- src/ConfirmationInput/Examples.md | 20 ----------- src/ConfirmationInput/README.md | 18 ---------- src/ConfirmationInput/index.ts | 2 -- .../ConfirmationInput.tsx | 0 src/Input/Examples.md | 35 +++++++++++++++++++ .../PasswordInput.tsx | 0 src/Input/index.ts | 3 ++ src/PasswordInput/Examples.md | 13 ------- src/PasswordInput/README.md | 3 -- src/PasswordInput/index.ts | 2 -- src/index.ts | 8 ++--- test/scripts/__snapshots__/build.test.ts.snap | 12 +++---- 12 files changed, 44 insertions(+), 72 deletions(-) delete mode 100644 src/ConfirmationInput/Examples.md delete mode 100644 src/ConfirmationInput/README.md delete mode 100644 src/ConfirmationInput/index.ts rename src/{ConfirmationInput => Input}/ConfirmationInput.tsx (100%) rename src/{PasswordInput => Input}/PasswordInput.tsx (100%) delete mode 100644 src/PasswordInput/Examples.md delete mode 100644 src/PasswordInput/README.md delete mode 100644 src/PasswordInput/index.ts diff --git a/src/ConfirmationInput/Examples.md b/src/ConfirmationInput/Examples.md deleted file mode 100644 index 0653b8cee..000000000 --- a/src/ConfirmationInput/Examples.md +++ /dev/null @@ -1,20 +0,0 @@ -### Examples - -```js -initialState = {}; - -const onConfirm = value => console.log(`confirmed: ${value}`); -const onClear = () => console.log('cleared!'); -const onChange = value => setState({ value }); - -const initialValue = state.value; - -
- - -``` diff --git a/src/ConfirmationInput/README.md b/src/ConfirmationInput/README.md deleted file mode 100644 index 0468dc8dc..000000000 --- a/src/ConfirmationInput/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# ConfirmationInput - -An input field that allows to confirm its content - -## Props -|Name|Type|Default|Description| -|----|----|-------|-----------| -| **initialValue** | String | | *optional*. Initial value | -| **onChange** | Function | "onChange" | *optional*. Called when input box content is changed | -| **onConfirm** | Function | "onConfirm" | *optional*. Called when confirming input content | -| **onClear** | Function | "onClear" | *optional*. Called when clearing confirmed content | -| **placeholder** | String | | *optional*. Input placeholder | -| **disabled** | Boolean | | *optional*. True if disabled | -| **text** | Struct{clear: ?String, toConfirm: ?String} | | **required**. Labels for 'clear' and 'toConfirm' buttons | -| **icon** | Struct{clear: ?String, toConfirm: ?String} | | **required**. Icons for 'clear' and 'toConfirm' buttons | -| **className** | String | | *optional*. Additional `className` for wrapper element | -| **id** | String | | *optional*. Custom `id` for wrapper element | -| **style** | Object | | *optional*. Inline-style overrides for wrapper element | \ No newline at end of file diff --git a/src/ConfirmationInput/index.ts b/src/ConfirmationInput/index.ts deleted file mode 100644 index d1ba78ebf..000000000 --- a/src/ConfirmationInput/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { ConfirmationInput } from './ConfirmationInput'; -export default ConfirmationInput; diff --git a/src/ConfirmationInput/ConfirmationInput.tsx b/src/Input/ConfirmationInput.tsx similarity index 100% rename from src/ConfirmationInput/ConfirmationInput.tsx rename to src/Input/ConfirmationInput.tsx diff --git a/src/Input/Examples.md b/src/Input/Examples.md index 1520b505d..ca42a6c62 100644 --- a/src/Input/Examples.md +++ b/src/Input/Examples.md @@ -44,3 +44,38 @@ const wrapperProps = { style: { marginRight: '10px', width: '150px' } }; ``` + +#### Password Input + +```js +initialState = { value: '' }; + +const onChange = value => setState({ value }); + + +``` + +#### Confirmation Input + +```js +initialState = {}; + +const onConfirm = value => console.log(`confirmed: ${value}`); +const onClear = () => console.log('cleared!'); +const onChange = value => setState({ value }); + +const initialValue = state.value; + +
+ + +``` diff --git a/src/PasswordInput/PasswordInput.tsx b/src/Input/PasswordInput.tsx similarity index 100% rename from src/PasswordInput/PasswordInput.tsx rename to src/Input/PasswordInput.tsx diff --git a/src/Input/index.ts b/src/Input/index.ts index 02f2ff93f..acd562c1d 100644 --- a/src/Input/index.ts +++ b/src/Input/index.ts @@ -1,2 +1,5 @@ import { Input } from './Input'; +import { ConfirmationInput } from './ConfirmationInput'; +import { PasswordInput } from './PasswordInput'; +export { ConfirmationInput, PasswordInput, Input }; export default Input; diff --git a/src/PasswordInput/Examples.md b/src/PasswordInput/Examples.md deleted file mode 100644 index 8d12dea8c..000000000 --- a/src/PasswordInput/Examples.md +++ /dev/null @@ -1,13 +0,0 @@ -### Examples - -```js -initialState = { value: '' }; - -const onChange = value => setState({ value }); - - -``` diff --git a/src/PasswordInput/README.md b/src/PasswordInput/README.md deleted file mode 100644 index 6f4e919c0..000000000 --- a/src/PasswordInput/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# PasswordInput - -A password input field that allows to show/hide the password diff --git a/src/PasswordInput/index.ts b/src/PasswordInput/index.ts deleted file mode 100644 index 0f9804e0f..000000000 --- a/src/PasswordInput/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { PasswordInput } from './PasswordInput'; -export default PasswordInput; diff --git a/src/index.ts b/src/index.ts index 4fd39bf8e..6e5ad3a1d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -31,8 +31,6 @@ export { Button }; export { StatefulButton } from './Button'; import MoreOrLess from './MoreOrLess'; export { MoreOrLess }; -import ConfirmationInput from './ConfirmationInput'; -export { ConfirmationInput }; import Badge from './Badge'; export { Badge }; import NavBar from './NavBar'; @@ -62,7 +60,5 @@ import DateField from './DateField'; export { DateField }; import Image from './Image'; export { Image }; -import Input from './Input'; -export { Input }; -import PasswordInput from './PasswordInput'; -export { PasswordInput }; +import { Input, PasswordInput, ConfirmationInput } from './Input'; +export { Input, PasswordInput, ConfirmationInput }; diff --git a/test/scripts/__snapshots__/build.test.ts.snap b/test/scripts/__snapshots__/build.test.ts.snap index 438b54a97..1b13cbbfc 100644 --- a/test/scripts/__snapshots__/build.test.ts.snap +++ b/test/scripts/__snapshots__/build.test.ts.snap @@ -24,10 +24,6 @@ Array [ "Button/button.css", "Button/index.d.ts", "Button/index.js", - "ConfirmationInput/ConfirmationInput.d.ts", - "ConfirmationInput/ConfirmationInput.js", - "ConfirmationInput/index.d.ts", - "ConfirmationInput/index.js", "DateField/DateField.d.ts", "DateField/DateField.js", "DateField/dateField.css", @@ -76,8 +72,12 @@ Array [ "Image/getUrl.js", "Image/index.d.ts", "Image/index.js", + "Input/ConfirmationInput.d.ts", + "Input/ConfirmationInput.js", "Input/Input.d.ts", "Input/Input.js", + "Input/PasswordInput.d.ts", + "Input/PasswordInput.js", "Input/index.d.ts", "Input/index.js", "Input/input.css", @@ -134,10 +134,6 @@ Array [ "Panel/index.js", "Panel/panel.css", "Panel/tabbedPanel.css", - "PasswordInput/PasswordInput.d.ts", - "PasswordInput/PasswordInput.js", - "PasswordInput/index.d.ts", - "PasswordInput/index.js", "Popover/Popover.d.ts", "Popover/Popover.js", "Popover/examples.css",