-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from Infineon/127-text-input
127 text input
- Loading branch information
Showing
7 changed files
with
263 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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,21 @@ | ||
# ifx-text-input | ||
|
||
|
||
|
||
<!-- Auto Generated Below --> | ||
|
||
|
||
## Properties | ||
|
||
| Property | Attribute | Description | Type | Default | | ||
| -------------- | --------------- | ----------- | --------- | --------------- | | ||
| `disabled` | `disabled` | | `boolean` | `false` | | ||
| `error` | `error` | | `boolean` | `false` | | ||
| `errorMessage` | `error-message` | | `string` | `""` | | ||
| `placeholder` | `placeholder` | | `string` | `"Placeholder"` | | ||
| `success` | `success` | | `boolean` | `false` | | ||
|
||
|
||
---------------------------------------------- | ||
|
||
*Built with [StencilJS](https://stenciljs.com/)* |
This file contains 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,152 @@ | ||
@use "../../../node_modules/@infineon/design-system-tokens/dist/tokens"; | ||
|
||
.textInput__container { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
padding: 0px; | ||
|
||
//width: 588px; | ||
height: 64px; | ||
|
||
flex: none; | ||
order: 0; | ||
align-self: stretch; | ||
flex-grow: 0; | ||
|
||
&.disabled { | ||
& .textInput__top-wrapper { | ||
& label { | ||
color: #BFBBBB; | ||
} | ||
} | ||
|
||
& .textInput__bottom-wrapper { | ||
input { | ||
border: 1px solid #BFBBBB; | ||
|
||
&::placeholder { | ||
color: #BFBBBB; | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
& .textInput__top-wrapper { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: flex-start; | ||
padding: 0px; | ||
gap: 4px; | ||
|
||
flex: none; | ||
order: 0; | ||
align-self: stretch; | ||
flex-grow: 0; | ||
|
||
& label { | ||
font-style: normal; | ||
font-weight: 400; | ||
font-size: 16px; | ||
line-height: 24px; | ||
|
||
display: flex; | ||
align-items: center; | ||
|
||
color: tokens.$color-text-black; | ||
|
||
flex: none; | ||
order: 0; | ||
flex-grow: 0; | ||
} | ||
} | ||
|
||
& .textInput__bottom-wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
padding: 0px; | ||
gap: 4px; | ||
|
||
flex: none; | ||
order: 1; | ||
align-self: stretch; | ||
flex-grow: 0; | ||
|
||
& input { | ||
box-sizing: border-box; | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
padding: 8px 16px; | ||
gap: 6px; | ||
|
||
height: 40px; | ||
|
||
background-color: tokens.$color-text-white; | ||
color: #1D1D1D; | ||
|
||
border: 1px solid #8D8786; | ||
border-radius: 1px; | ||
|
||
flex: none; | ||
order: 0; | ||
align-self: stretch; | ||
flex-grow: 0; | ||
|
||
&.error { | ||
border: 1px solid #CD002F; | ||
&:focus { | ||
outline: none; | ||
} | ||
} | ||
|
||
&.success { | ||
border: 1px solid #4CA460; | ||
&:focus { | ||
outline: none; | ||
} | ||
} | ||
|
||
|
||
&:focus:not(.error, .success) { | ||
outline: none; | ||
border: 1px solid #0A8276; | ||
} | ||
|
||
&:hover:not(:disabled, .error, .success) { | ||
border: 1px solid #3C3A39; | ||
} | ||
|
||
&::placeholder { | ||
font-style: normal; | ||
font-weight: 400; | ||
font-size: 16px; | ||
line-height: 24px; | ||
|
||
color: #8D8786; | ||
|
||
flex: none; | ||
order: 1; | ||
flex-grow: 1; | ||
} | ||
} | ||
|
||
& .textInput__bottom-wrapper-error { | ||
font-style: normal; | ||
font-weight: 400; | ||
font-size: 12px; | ||
line-height: 16px; | ||
|
||
letter-spacing: 0.2px; | ||
|
||
color: #CD002F; | ||
|
||
flex: none; | ||
order: 1; | ||
align-self: stretch; | ||
flex-grow: 0; | ||
} | ||
} | ||
} |
This file contains 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,23 @@ | ||
export default { | ||
title: "Components/TextInput", | ||
args: { | ||
error: false, | ||
disabled: false, | ||
success: false, | ||
placeholder: 'Placeholder', | ||
errorMessage: "", | ||
}, | ||
|
||
argTypes: { | ||
|
||
}, | ||
}; | ||
|
||
|
||
const DefaultTemplate = (args) => | ||
`<ifx-text-input disabled="${args.disabled}" error="${args.error}" success="${args.success}" error-message="${args.errorMessage}">Text field</ifx-text-input>`; | ||
|
||
|
||
export const Default = DefaultTemplate.bind({}); | ||
|
||
|
This file contains 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,40 @@ | ||
import { Component, h, Element, Prop } from '@stencil/core'; | ||
|
||
@Component({ | ||
tag: 'ifx-text-input', | ||
styleUrl: '../../index.scss', | ||
shadow: true | ||
}) | ||
|
||
export class TextInput { | ||
@Element() el; | ||
@Prop() placeholder: string = "Placeholder" | ||
@Prop() error: boolean = false; | ||
@Prop() errorMessage: string = ""; | ||
@Prop() success: boolean = false; | ||
@Prop() disabled: boolean = false; | ||
|
||
render() { | ||
return ( | ||
<div class={`textInput__container ${this.disabled ? 'disabled' : ""}`}> | ||
<div class="textInput__top-wrapper"> | ||
<label htmlFor="text-field"> | ||
<slot /> | ||
</label> | ||
</div> | ||
<div class="textInput__bottom-wrapper"> | ||
<input | ||
disabled={this.disabled} | ||
type="text" | ||
id='text-field' | ||
placeholder={this.placeholder} | ||
class={`${this.error ? 'error' : ""} ${this.success ? "success" : ""}`}/> | ||
{this.error && | ||
<div class="textInput__bottom-wrapper-error"> | ||
{this.errorMessage} | ||
</div>} | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
This file contains 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 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