Skip to content

Commit

Permalink
feat: fluid state for text input and password (#3011)
Browse files Browse the repository at this point in the history
Signed-off-by: Akshat Patel <akshat@live.ca>
Co-authored-by: Akshat Patel <38994122+Akshat55@users.noreply.github.com>
Co-authored-by: Akshat Patel <akshat@live.ca>
  • Loading branch information
3 people authored Nov 6, 2024
1 parent 6c61aa8 commit fa4f99d
Show file tree
Hide file tree
Showing 7 changed files with 265 additions and 173 deletions.
108 changes: 54 additions & 54 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/input/input.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,14 @@ export class TextInput {
}

@HostBinding("class.cds--text-input--invalid") @Input() invalid = false;
@HostBinding("class.cds--text-input__field-wrapper--warning") @Input() warn = false;
@HostBinding("class.cds--text-input--warning") @Input() warn = false;
@HostBinding("class.cds--skeleton") @Input() skeleton = false;
@HostBinding("class.cds--text-input--light") get isLightTheme() {
return this.theme === "light";
}

@HostBinding("attr.data-invalid") get getInvalidAttribute() {
return this.invalid ? true : undefined;
}

}
64 changes: 36 additions & 28 deletions src/input/input.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,36 @@ export default {
imports: [InputModule]
})
],
args: {
disabled: false,
invalid: false,
invalidText: "Invalid entry",
warn: false,
warnText: "This is a warning!",
label: "Text input label",
helperText: "Optional helper text",
placeholder: "Placeholder",
autocomplete: "on",
theme: "dark",
size: "md",
readonly: false,
fluid: false,
skeleton: false
},
argTypes: {
autocomplete: {
options: ["on", "off"],
control: "radio"
},
theme: {
options: ["light", "dark"],
control: "radio"
},
size: {
options: ["sm", "md", "lg"],
control: "select"
}
},
component: TextInputLabelComponent
} as Meta;

Expand All @@ -22,6 +52,8 @@ const Template = (args) => ({
[invalidText]="invalidText"
[warn]="warn"
[disabled]="disabled"
[fluid]="fluid"
[skeleton]="skeleton"
[warnText]="warnText">
{{label}}
<input
Expand All @@ -38,35 +70,11 @@ const Template = (args) => ({
`
});
export const Basic = Template.bind({});
Basic.args = {
disabled: false,
invalid: false,
invalidText: "Invalid entry",
warn: false,
warnText: "This is a warning!",
label: "Text input label",
helperText: "Optional helper text",
placeholder: "Placeholder",
autocomplete: "on",
theme: "dark",
size: "md",
readonly: false
};
Basic.argTypes = {
autocomplete: {
options: ["on", "off"],
control: "radio"
},
theme: {
options: ["light", "dark"],
control: "radio"
},
size: {
options: ["sm", "md", "lg"],
control: "select"
}
};

export const Fluid = Template.bind({});
Fluid.args = {
fluid: true
};

const SkeletonTemplate = (args) => ({
props: args,
Expand Down
Loading

0 comments on commit fa4f99d

Please sign in to comment.