Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add fluid state for text input and password #3011

Merged
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
Loading