Skip to content

Commit

Permalink
Merge pull request #20 from bhcha/main
Browse files Browse the repository at this point in the history
add : textarea
  • Loading branch information
bhcha authored Aug 2, 2024
2 parents 9a1c20b + 75c2673 commit a0446d8
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 50 deletions.
1 change: 0 additions & 1 deletion src/components/container/InputContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export class InputContainer extends LitParents {

static get properties() {
return {

id: {type: String},
class: {type: String},
width: {type: String},
Expand Down
9 changes: 7 additions & 2 deletions src/components/input/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ class LInput extends InputContainer {
};
}

createRenderRoot() {
const root = super.createRenderRoot();
console.log('root', root);
return root
}

render() {
let isLabelLeft = (this['label-align'] && this['label-align'] === 'left');

Expand All @@ -69,7 +75,6 @@ class LInput extends InputContainer {
feedback-type="${ifDefined(this['feedback-type'])}"
feedback-visible-type="${ifDefined(this['feedback-visible-type'])}"
>
<input
slot="input"
type="${this['type'] === 'planText' ? 'text' : this['type']}"
Expand All @@ -92,7 +97,7 @@ class LInput extends InputContainer {
placeholder="${ifDefined(this['placeholder'])}"
pattern="${ifDefined(this['pattern'])}"
value="${ifDefined(this['value'])}"
@blur="${this['validate']}"
@blur="${super.validate}"
>
</l-input-container>
Expand Down
8 changes: 4 additions & 4 deletions src/components/input/Textarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ class LTextarea extends InputContainer {
};
}


render() {
let isLabelLeft = (this['label-align'] && this['label-align'] === 'left');

// type, pattern 삭제
return html`
<l-input-container
width="${ifDefined(this['width'])}"
Expand Down Expand Up @@ -88,10 +90,8 @@ class LTextarea extends InputContainer {
?disabled=${this['disabled']}
?readonly=${this['readonly']}
placeholder="${ifDefined(this['placeholder'])}"
pattern="${ifDefined(this['pattern'])}"
value="${ifDefined(this['value'])}"
@blur="${this['validate']}"
></textarea>
@blur="${super.validate}"
>${ifDefined(this['value'])}</textarea>
</l-input-container>
`;
Expand Down
18 changes: 18 additions & 0 deletions stories/Input.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,24 @@ export default {
subcategory: "text",
}
},
'valid-trigger-type': {
control: {type: 'select'},
options: ['blur', 'change', 'focus'],
table: {
category: "attribures",
subcategory: "validate",
defaultValue: {summary: 'blur'},
}
},
'valid-length-type': {
control: {type: 'select'},
options: ['length', 'byte'],
table: {
category: "attribures",
subcategory: "validate",
defaultValue: {summary: 'length'},
}
},
maxlength: {
control: {type: 'number'},
table: {
Expand Down
43 changes: 0 additions & 43 deletions stories/Textarea.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,6 @@ export default {
subcategory: "validate",
}
},
pattern: {
control: {type: 'text'},
table: {
category: "attribures",
subcategory: "validate",
},
description: "ex) [0-9]{3}-[0-9]{4}-[0-9]{4}",
},

required: {
control: 'boolean',
Expand Down Expand Up @@ -286,41 +278,6 @@ InputRequireValidity.args = {
readonly: false,
};

export const InputPatternValidity = Template.bind({});
InputPatternValidity.args = {
id: 'input01',
name: 'name',
width: '100%',
label: 'Phone',
'label-align': 'top',
'label-width': 'auto',
'label-text-align': 'left',
feedback: 'invalid pattern',
'feedback-type': 'error',
'feedback-visible-type': 'invalid',
pattern: '[0-9]{3}-[0-9]{4}-[0-9]{4}',
required: false,
disabled: false,
readonly: false,
};

export const InputPatternAndRequireValidity = Template.bind({});
InputPatternAndRequireValidity.args = {
id: 'input01',
name: 'name',
width: '100%',
label: 'Phone',
'label-align': 'top',
'label-width': 'auto',
'label-text-align': 'left',
feedback: 'invalid value',
'feedback-type': 'error',
'feedback-visible-type': 'invalid',
pattern: '[0-9]{3}-[0-9]{4}-[0-9]{4}',
required: true,
disabled: false,
readonly: false,
};

const sizeTemplate = (args) => {
return html`
Expand Down

0 comments on commit a0446d8

Please sign in to comment.