This repository was archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
feat(input): new Input component with 'input' slot #326
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
docs/src/examples/components/Input/Variations/InputExampleClearable.shorthand.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import React from 'react' | ||
| import { Input } from '@stardust-ui/react' | ||
|
|
||
| const InputExampleClearableShorthand = () => <Input clearable placeholder="Search..." /> | ||
| const InputExampleClearable = () => <Input clearable placeholder="Search..." /> | ||
|
|
||
| export default InputExampleClearableShorthand | ||
| export default InputExampleClearable | ||
4 changes: 2 additions & 2 deletions
4
docs/src/examples/components/Input/Variations/InputExampleFluid.shorthand.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import React from 'react' | ||
| import { Input } from '@stardust-ui/react' | ||
|
|
||
| const InputExample = () => <Input fluid icon="search" placeholder="Search..." /> | ||
| const InputExampleFluid = () => <Input fluid icon="search" placeholder="Search..." /> | ||
|
|
||
| export default InputExample | ||
| export default InputExampleFluid |
11 changes: 11 additions & 0 deletions
11
docs/src/examples/components/Input/Variations/InputExampleInlineIconClearable.shorthand.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import React from 'react' | ||
| import { Input } from '@stardust-ui/react' | ||
|
|
||
| const InputExampleInline = () => ( | ||
| <div> | ||
| Some text inline with the <Input inline icon="search" clearable placeholder="input name" /> and | ||
| more text. | ||
| </div> | ||
| ) | ||
|
|
||
| export default InputExampleInline |
49 changes: 49 additions & 0 deletions
49
docs/src/examples/components/Input/Variations/InputExampleInputSlot.shorthand.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import React from 'react' | ||
| import { Grid, Input, Text } from '@stardust-ui/react' | ||
|
|
||
| const inputStyles = { color: 'blue', background: 'yellow' } | ||
| const InputExampleInputSlot = () => ( | ||
| <Grid columns="1fr 2fr" styles={{ justifyItems: 'start', alignItems: 'center', gap: '10px' }}> | ||
| <Text content="Input default:" /> | ||
| <Input placeholder="Search..." role="presentation" /> | ||
|
|
||
| <Text content="Input with input slot as props:" /> | ||
| <Input | ||
| placeholder="Search..." | ||
| role="presentation" | ||
| input={{ | ||
| // will override component's 'placeholder' attribute | ||
| placeholder: 'Placeholder Override...', | ||
|
|
||
| // will override component's 'role' attribute | ||
| role: 'checkbox', | ||
|
|
||
| // will set custom styles for input DOM element | ||
| styles: inputStyles, | ||
| }} | ||
| /> | ||
|
|
||
| <Text content="Wrapped Input with existing component:" /> | ||
| <Input | ||
| placeholder="Search..." | ||
| role="presentation" | ||
| input={ | ||
bmdalex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <Text | ||
| as="input" | ||
| placeholder="Placeholder Override..." | ||
| role="checkbox" | ||
| styles={inputStyles} | ||
| /> | ||
| } | ||
| /> | ||
|
|
||
| <Text content="Wrapped Input with custom element:" /> | ||
| <Input | ||
| placeholder="Search..." | ||
| role="presentation" | ||
| input={<input placeholder="Placeholder Override..." role="checkbox" style={inputStyles} />} | ||
| /> | ||
| </Grid> | ||
| ) | ||
|
|
||
| export default InputExampleInputSlot | ||
41 changes: 41 additions & 0 deletions
41
docs/src/examples/components/Input/Variations/InputExampleTargeting.shorthand.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import React from 'react' | ||
| import { Grid, Input, Text } from '@stardust-ui/react' | ||
|
|
||
| // This object contains properties that will be applied to the input | ||
| const propsForInput = { placeholder: 'Search...', id: 'inputId', role: 'checkbox' } | ||
bmdalex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const propsTargettingWrapper = { | ||
| placeholder: 'Wrapper placeholder...', | ||
| id: 'wrapperId', | ||
| role: 'presentation', | ||
| } | ||
|
|
||
| // This object contains properties that will be applied to the wrapper | ||
| const propsForWrapper = { dir: 'ltr', tabIndex: -1, styles: { padding: '5px', background: 'red' } } | ||
| const propsTargettingInput = { | ||
| dir: 'rtl', | ||
| tabIndex: 0, | ||
| styles: { color: 'blue', background: 'yellow' }, | ||
| } | ||
|
|
||
| const InputExampleTargeting = () => ( | ||
| <Grid columns="1fr 1fr" styles={{ justifyItems: 'start', alignItems: 'center', gap: '10px' }}> | ||
| <Text content="Input with props that will be applied to either the input or the wrapper:" /> | ||
| <Input {...propsForInput} {...propsForWrapper} /> | ||
|
|
||
| <Text content="Input with input slot props that have to be applied to the input element:" /> | ||
| <Input {...propsForInput} {...propsForWrapper} input={propsTargettingInput} /> | ||
|
|
||
| <Text content="Input with wrapper slot props that have to be applied to the wrapper element:" /> | ||
| <Input {...propsForInput} {...propsForWrapper} wrapper={propsTargettingWrapper} /> | ||
|
|
||
| <Text content="Input with input and wrapper slot props that have to be applied to the input and wrapper elements, respectively:" /> | ||
| <Input | ||
| {...propsForInput} | ||
| {...propsForWrapper} | ||
| input={propsTargettingInput} | ||
| wrapper={propsTargettingWrapper} | ||
| /> | ||
| </Grid> | ||
| ) | ||
|
|
||
| export default InputExampleTargeting | ||
45 changes: 45 additions & 0 deletions
45
docs/src/examples/components/Input/Variations/InputExampleWrapperSlot.shorthand.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import React from 'react' | ||
| import { Grid, Input, Text } from '@stardust-ui/react' | ||
|
|
||
| const InputExampleWrapperSlot = () => ( | ||
| <Grid columns="1fr 2fr" styles={{ justifyItems: 'start', alignItems: 'center', gap: '10px' }}> | ||
| <Text content="Input default:" /> | ||
| <Input | ||
| placeholder="Search..." | ||
| tabIndex={-1} | ||
| styles={{ color: 'blue', backgroundColor: 'yellow' }} | ||
| /> | ||
|
|
||
| <Text content="Wrapped Input with props:" /> | ||
| <Input | ||
| placeholder="Search..." | ||
| tabIndex={-1} | ||
| styles={{ color: 'blue', backgroundColor: 'yellow' }} | ||
| wrapper={{ | ||
| // will override component's 'tabIndex' attribute | ||
| tabIndex: 0, | ||
|
|
||
| // will set custom styles for wrapper element | ||
| styles: { padding: '5px', backgroundColor: 'red' }, | ||
| }} | ||
| /> | ||
|
|
||
| <Text content="Wrapped Input with existing component:" /> | ||
| <Input | ||
| placeholder="Search..." | ||
| tabIndex={-1} | ||
| styles={{ color: 'blue', backgroundColor: 'yellow' }} | ||
| wrapper={<Text tabIndex={0} styles={{ padding: '5px', backgroundColor: 'red' }} />} | ||
| /> | ||
|
|
||
| <Text content="Wrapped Input with custom element:" /> | ||
| <Input | ||
| placeholder="Search..." | ||
| tabIndex={-1} | ||
| styles={{ color: 'blue', backgroundColor: 'yellow' }} | ||
| wrapper={<span tabIndex={0} style={{ padding: '5px', backgroundColor: 'red' }} />} | ||
| /> | ||
| </Grid> | ||
| ) | ||
|
|
||
| export default InputExampleWrapperSlot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.