diff --git a/package-lock.json b/package-lock.json index ef871c212b..a6d091da5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3809,9 +3809,9 @@ } }, "node_modules/@carbon/colors": { - "version": "11.27.0", - "resolved": "https://registry.npmjs.org/@carbon/colors/-/colors-11.27.0.tgz", - "integrity": "sha512-4H1Lfuw1WJYndoCSn+HOoA8JPW0old41FtuKgK+okc/QXmTpw21tK7KL6D+Yu68JEWAksEPssKUeggLAgWkYjA==", + "version": "11.28.0", + "resolved": "https://registry.npmjs.org/@carbon/colors/-/colors-11.28.0.tgz", + "integrity": "sha512-zmNJk5Ec453aL3bk9RRSmM+dkVbyVMvUuKd6szJCOWLoqBFBXbd3PDRZO0AZeHp/Iel9sBRf1gUYej1BJ/5+hw==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -3819,9 +3819,9 @@ } }, "node_modules/@carbon/feature-flags": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@carbon/feature-flags/-/feature-flags-0.23.0.tgz", - "integrity": "sha512-p98iYUNHPvBQ543hAZ2fbBedYegy3N58eemcqsexWaX0mDdbJNwZCc1fN/HtLvrgKqt70Mal/FKJHlocNRyaNA==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@carbon/feature-flags/-/feature-flags-0.23.1.tgz", + "integrity": "sha512-PUpAyPQ/ktG1FLCLs4yJC8zKupHnZa8ApOn/lzgln63bz6nTRIc7NBMhb/T/ulFe1ixdvQnrb6jgn2Nw159+6A==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -3829,13 +3829,13 @@ } }, "node_modules/@carbon/grid": { - "version": "11.28.0", - "resolved": "https://registry.npmjs.org/@carbon/grid/-/grid-11.28.0.tgz", - "integrity": "sha512-J0E8gGYOOlNfKB4Omks9fJdAI5CmzWF6JvCDndTCcpq58By1atQt9n1C1jvo8iHf84ZDoU1Vd6+ZB9u4fXKdNg==", + "version": "11.29.0", + "resolved": "https://registry.npmjs.org/@carbon/grid/-/grid-11.29.0.tgz", + "integrity": "sha512-SAJhTexN6TjbItcUczOqhzgHBGXLhvUhlTdyqj+wzUH0tqEN8g6gLp+1sn9+rL+kV4obSb/7bdSESZtwQr/tQg==", "dev": true, "hasInstallScript": true, "dependencies": { - "@carbon/layout": "^11.27.0", + "@carbon/layout": "^11.28.0", "@ibm/telemetry-js": "^1.5.0" } }, @@ -3850,9 +3850,9 @@ "integrity": "sha512-6XaySbscz1ubJ/3GtyXB8qJpcAL8kcIzBA6JZpFCcha43tuB1Kps87ADj/v3yx0sLPxyIzRWgkw2n1bnkAcsNA==" }, "node_modules/@carbon/layout": { - "version": "11.27.0", - "resolved": "https://registry.npmjs.org/@carbon/layout/-/layout-11.27.0.tgz", - "integrity": "sha512-o2++xUe2Wfg1nzneLl8ucbep9ObUE6vEgwlifVdOpvCti6zlsRjti5ojtYpx3v0yW2Qh7TJH8OYN7CyZDLeZUw==", + "version": "11.28.0", + "resolved": "https://registry.npmjs.org/@carbon/layout/-/layout-11.28.0.tgz", + "integrity": "sha512-Yl0Dsxs00EgAaCKpZCXgebuf9BwiBK66a1Oiao6D12p3ViciZ4L18mlRgOPBcDlolP2tUtncz48TlfkWC097hQ==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -3860,9 +3860,9 @@ } }, "node_modules/@carbon/motion": { - "version": "11.23.0", - "resolved": "https://registry.npmjs.org/@carbon/motion/-/motion-11.23.0.tgz", - "integrity": "sha512-zPxO/lp9FaHET967NHTbQ7pvmqATIQcsiM8WxzNuF2UUNlw6oRL/LMro1eZC9OgKAnyTXRUoxdtYphMhFOXWpA==", + "version": "11.24.0", + "resolved": "https://registry.npmjs.org/@carbon/motion/-/motion-11.24.0.tgz", + "integrity": "sha512-JtsSQ3DgVqZXpOdKthetUi5Tp94jkWffgxgrEylbNYErITNt7PeSF6YTXnqtSldk/dUCBkfD1kXkfH1NAxrr1w==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -3896,15 +3896,15 @@ } }, "node_modules/@carbon/styles/node_modules/@carbon/themes": { - "version": "11.42.0", - "resolved": "https://registry.npmjs.org/@carbon/themes/-/themes-11.42.0.tgz", - "integrity": "sha512-f9MslPl8tti9lfx3PLK9GwkJH2D1BXd2nqdLQu0yOELoN92aQiv2eU7ZfJZm6Kuvn1vNoKJpbBey8MmWhEGA8Q==", + "version": "11.43.0", + "resolved": "https://registry.npmjs.org/@carbon/themes/-/themes-11.43.0.tgz", + "integrity": "sha512-iBDxHVn1y7QYKVCeBqMjLzryDl5mUG2C67KQbJqGqCfYMKI8L+dkw6KmeeWUYv8rhRhqZq27mm+AODchXO0zcw==", "dev": true, "hasInstallScript": true, "dependencies": { - "@carbon/colors": "^11.27.0", - "@carbon/layout": "^11.27.0", - "@carbon/type": "^11.32.0", + "@carbon/colors": "^11.28.0", + "@carbon/layout": "^11.28.0", + "@carbon/type": "^11.33.0", "@ibm/telemetry-js": "^1.5.0", "color": "^4.0.0" } @@ -3922,14 +3922,14 @@ } }, "node_modules/@carbon/type": { - "version": "11.32.0", - "resolved": "https://registry.npmjs.org/@carbon/type/-/type-11.32.0.tgz", - "integrity": "sha512-av09976fl4YlaO4HEDs0RG17sg5X0TJbb9m9HfugZjNKDHFbWo87oGLmvgh4J+/ewkC40Wnp24rAewPEaYKFGw==", + "version": "11.33.0", + "resolved": "https://registry.npmjs.org/@carbon/type/-/type-11.33.0.tgz", + "integrity": "sha512-v3lfot0vcHNw6WDe32ap3ewpMGwUqhZ6z56sN11jzngRrWVPFgA9U7NciuoylFw301l2htJuZu0dBS2F4ViCXQ==", "dev": true, "hasInstallScript": true, "dependencies": { - "@carbon/grid": "^11.28.0", - "@carbon/layout": "^11.27.0", + "@carbon/grid": "^11.29.0", + "@carbon/layout": "^11.28.0", "@ibm/telemetry-js": "^1.5.0" } }, @@ -37859,30 +37859,30 @@ } }, "@carbon/colors": { - "version": "11.27.0", - "resolved": "https://registry.npmjs.org/@carbon/colors/-/colors-11.27.0.tgz", - "integrity": "sha512-4H1Lfuw1WJYndoCSn+HOoA8JPW0old41FtuKgK+okc/QXmTpw21tK7KL6D+Yu68JEWAksEPssKUeggLAgWkYjA==", + "version": "11.28.0", + "resolved": "https://registry.npmjs.org/@carbon/colors/-/colors-11.28.0.tgz", + "integrity": "sha512-zmNJk5Ec453aL3bk9RRSmM+dkVbyVMvUuKd6szJCOWLoqBFBXbd3PDRZO0AZeHp/Iel9sBRf1gUYej1BJ/5+hw==", "dev": true, "requires": { "@ibm/telemetry-js": "^1.5.0" } }, "@carbon/feature-flags": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@carbon/feature-flags/-/feature-flags-0.23.0.tgz", - "integrity": "sha512-p98iYUNHPvBQ543hAZ2fbBedYegy3N58eemcqsexWaX0mDdbJNwZCc1fN/HtLvrgKqt70Mal/FKJHlocNRyaNA==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@carbon/feature-flags/-/feature-flags-0.23.1.tgz", + "integrity": "sha512-PUpAyPQ/ktG1FLCLs4yJC8zKupHnZa8ApOn/lzgln63bz6nTRIc7NBMhb/T/ulFe1ixdvQnrb6jgn2Nw159+6A==", "dev": true, "requires": { "@ibm/telemetry-js": "^1.5.0" } }, "@carbon/grid": { - "version": "11.28.0", - "resolved": "https://registry.npmjs.org/@carbon/grid/-/grid-11.28.0.tgz", - "integrity": "sha512-J0E8gGYOOlNfKB4Omks9fJdAI5CmzWF6JvCDndTCcpq58By1atQt9n1C1jvo8iHf84ZDoU1Vd6+ZB9u4fXKdNg==", + "version": "11.29.0", + "resolved": "https://registry.npmjs.org/@carbon/grid/-/grid-11.29.0.tgz", + "integrity": "sha512-SAJhTexN6TjbItcUczOqhzgHBGXLhvUhlTdyqj+wzUH0tqEN8g6gLp+1sn9+rL+kV4obSb/7bdSESZtwQr/tQg==", "dev": true, "requires": { - "@carbon/layout": "^11.27.0", + "@carbon/layout": "^11.28.0", "@ibm/telemetry-js": "^1.5.0" } }, @@ -37897,18 +37897,18 @@ "integrity": "sha512-6XaySbscz1ubJ/3GtyXB8qJpcAL8kcIzBA6JZpFCcha43tuB1Kps87ADj/v3yx0sLPxyIzRWgkw2n1bnkAcsNA==" }, "@carbon/layout": { - "version": "11.27.0", - "resolved": "https://registry.npmjs.org/@carbon/layout/-/layout-11.27.0.tgz", - "integrity": "sha512-o2++xUe2Wfg1nzneLl8ucbep9ObUE6vEgwlifVdOpvCti6zlsRjti5ojtYpx3v0yW2Qh7TJH8OYN7CyZDLeZUw==", + "version": "11.28.0", + "resolved": "https://registry.npmjs.org/@carbon/layout/-/layout-11.28.0.tgz", + "integrity": "sha512-Yl0Dsxs00EgAaCKpZCXgebuf9BwiBK66a1Oiao6D12p3ViciZ4L18mlRgOPBcDlolP2tUtncz48TlfkWC097hQ==", "dev": true, "requires": { "@ibm/telemetry-js": "^1.5.0" } }, "@carbon/motion": { - "version": "11.23.0", - "resolved": "https://registry.npmjs.org/@carbon/motion/-/motion-11.23.0.tgz", - "integrity": "sha512-zPxO/lp9FaHET967NHTbQ7pvmqATIQcsiM8WxzNuF2UUNlw6oRL/LMro1eZC9OgKAnyTXRUoxdtYphMhFOXWpA==", + "version": "11.24.0", + "resolved": "https://registry.npmjs.org/@carbon/motion/-/motion-11.24.0.tgz", + "integrity": "sha512-JtsSQ3DgVqZXpOdKthetUi5Tp94jkWffgxgrEylbNYErITNt7PeSF6YTXnqtSldk/dUCBkfD1kXkfH1NAxrr1w==", "dev": true, "requires": { "@ibm/telemetry-js": "^1.5.0" @@ -37932,14 +37932,14 @@ }, "dependencies": { "@carbon/themes": { - "version": "11.42.0", - "resolved": "https://registry.npmjs.org/@carbon/themes/-/themes-11.42.0.tgz", - "integrity": "sha512-f9MslPl8tti9lfx3PLK9GwkJH2D1BXd2nqdLQu0yOELoN92aQiv2eU7ZfJZm6Kuvn1vNoKJpbBey8MmWhEGA8Q==", + "version": "11.43.0", + "resolved": "https://registry.npmjs.org/@carbon/themes/-/themes-11.43.0.tgz", + "integrity": "sha512-iBDxHVn1y7QYKVCeBqMjLzryDl5mUG2C67KQbJqGqCfYMKI8L+dkw6KmeeWUYv8rhRhqZq27mm+AODchXO0zcw==", "dev": true, "requires": { - "@carbon/colors": "^11.27.0", - "@carbon/layout": "^11.27.0", - "@carbon/type": "^11.32.0", + "@carbon/colors": "^11.28.0", + "@carbon/layout": "^11.28.0", + "@carbon/type": "^11.33.0", "@ibm/telemetry-js": "^1.5.0", "color": "^4.0.0" } @@ -37959,13 +37959,13 @@ } }, "@carbon/type": { - "version": "11.32.0", - "resolved": "https://registry.npmjs.org/@carbon/type/-/type-11.32.0.tgz", - "integrity": "sha512-av09976fl4YlaO4HEDs0RG17sg5X0TJbb9m9HfugZjNKDHFbWo87oGLmvgh4J+/ewkC40Wnp24rAewPEaYKFGw==", + "version": "11.33.0", + "resolved": "https://registry.npmjs.org/@carbon/type/-/type-11.33.0.tgz", + "integrity": "sha512-v3lfot0vcHNw6WDe32ap3ewpMGwUqhZ6z56sN11jzngRrWVPFgA9U7NciuoylFw301l2htJuZu0dBS2F4ViCXQ==", "dev": true, "requires": { - "@carbon/grid": "^11.28.0", - "@carbon/layout": "^11.27.0", + "@carbon/grid": "^11.29.0", + "@carbon/layout": "^11.28.0", "@ibm/telemetry-js": "^1.5.0" } }, diff --git a/src/input/input.directive.ts b/src/input/input.directive.ts index 4e526ba8d0..5cd6329f55 100644 --- a/src/input/input.directive.ts +++ b/src/input/input.directive.ts @@ -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; + } + } diff --git a/src/input/input.stories.ts b/src/input/input.stories.ts index 37a94bf988..380bb21ed9 100644 --- a/src/input/input.stories.ts +++ b/src/input/input.stories.ts @@ -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; @@ -22,6 +52,8 @@ const Template = (args) => ({ [invalidText]="invalidText" [warn]="warn" [disabled]="disabled" + [fluid]="fluid" + [skeleton]="skeleton" [warnText]="warnText"> {{label}} ({ ` }); 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, diff --git a/src/input/password-input-label.component.ts b/src/input/password-input-label.component.ts index a61a674939..ff26b75128 100644 --- a/src/input/password-input-label.component.ts +++ b/src/input/password-input-label.component.ts @@ -31,13 +31,17 @@ import { BaseIconButton } from "carbon-components-angular/button"; @Component({ selector: "cds-password-label, ibm-password-label", template: ` + + +
+
-
+
-
-
- {{ helperText }} - -
-
- {{ invalidText }} - + +
+
+ {{ invalidText }} + +
+
+ {{ warnText }} + +
+
+ +
+ {{ helperText }} + +
-
- {{ warnText }} - -
+
+ {{ invalidText }} + +
+ +
+ {{ warnText }} + +
+
` }) @@ -197,6 +215,11 @@ export class PasswordInputLabelComponent extends BaseIconButton implements After */ @Input() showPasswordLabel = "Show password"; + /** + * Experimental: enable fluid state + */ + @Input() fluid = false; + /** * Reference to the wrapper element. */ @@ -212,6 +235,14 @@ export class PasswordInputLabelComponent extends BaseIconButton implements After return this.wrapper?.nativeElement.querySelector("input")?.readOnly ?? false; } + @HostBinding("class.cds--text-input--fluid") get fluidClass() { + return this.fluid && !this.skeleton; + } + + @HostBinding("class.cds--text-input--fluid__skeleton") get fluidSkeletonClass() { + return this.fluid && this.skeleton; + } + /** * Constructor for PasswordInputLabelComponent. * @param changeDetectorRef - Reference to ChangeDetectorRef. diff --git a/src/input/password.directive.ts b/src/input/password.directive.ts index b7305e2c8b..b92def3d16 100644 --- a/src/input/password.directive.ts +++ b/src/input/password.directive.ts @@ -51,7 +51,7 @@ export class PasswordInput implements AfterViewInit { @HostBinding("class.cds--text-input") inputClass = true; @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; /** @@ -65,6 +65,10 @@ export class PasswordInput implements AfterViewInit { */ @Input() size: "sm" | "md" | "lg" = "md"; + @HostBinding("attr.data-invalid") get getInvalidAttribute() { + return this.invalid ? true : undefined; + } + private _type = "password"; constructor(protected elementRef: ElementRef, protected renderer: Renderer2) { } diff --git a/src/input/password.stories.ts b/src/input/password.stories.ts index 13a66a39e7..5112651764 100644 --- a/src/input/password.stories.ts +++ b/src/input/password.stories.ts @@ -11,6 +11,36 @@ export default { imports: [InputModule, FormsModule] }) ], + 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: PasswordInputLabelComponent } as Meta; @@ -23,6 +53,8 @@ const Template = (args) => ({ [invalidText]="invalidText" [warn]="warn" [disabled]="disabled" + [fluid]="fluid" + [skeleton]="skeleton" [warnText]="warnText"> {{ label }} ({ ` }); 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) => ({ diff --git a/src/input/text-input-label.component.ts b/src/input/text-input-label.component.ts index f4a512c282..46cf0cd934 100644 --- a/src/input/text-input-label.component.ts +++ b/src/input/text-input-label.component.ts @@ -1,12 +1,12 @@ import { - Component, - Input, AfterViewInit, + ChangeDetectorRef, + Component, ElementRef, HostBinding, + Input, TemplateRef, - ViewChild, - ChangeDetectorRef + ViewChild } from "@angular/core"; /** @@ -28,57 +28,77 @@ import { @Component({ selector: "cds-text-label, ibm-text-label", template: ` + + +
+
-
- - - - - - - - -
-
- {{helperText}} - -
-
- {{invalidText}} - -
-
- {{warnText}} - +
+
+ + + + + + + + + + +
+
+ {{invalidText}} + +
+
+ {{warnText}} + +
+
+
+ +
+ {{helperText}} + +
+
+ {{invalidText}} + +
+
+ {{warnText}} + +
+
` }) @@ -133,15 +153,30 @@ export class TextInputLabelComponent implements AfterViewInit { */ @Input() ariaLabel: string; + /** + * Experimental: enable fluid state + */ + @Input() fluid = false; + // @ts-ignore @ViewChild("wrapper", { static: false }) wrapper: ElementRef; @HostBinding("class.cds--form-item") labelClass = true; + @HostBinding("class.cds--text-input-wrapper") textInputWrapper = true; + @HostBinding("class.cds--text-input-wrapper--readonly") get isReadonly() { return this.wrapper?.nativeElement.querySelector("input")?.readOnly ?? false; } + @HostBinding("class.cds--text-input--fluid") get fluidClass() { + return this.fluid && !this.skeleton; + } + + @HostBinding("class.cds--text-input--fluid__skeleton") get fluidSkeletonClass() { + return this.fluid && this.skeleton; + } + /** * Creates an instance of Label. */