diff --git a/projects/core/styles/mixins/textfield.less b/projects/core/styles/mixins/textfield.less index 5e505f5f66c5..9363ff1bfa90 100644 --- a/projects/core/styles/mixins/textfield.less +++ b/projects/core/styles/mixins/textfield.less @@ -110,7 +110,7 @@ :host[data-size='m']:not(._label-outside) &, :host-context(tui-primitive-textfield[data-size='m']:not(._label-outside)):not(tui-primitive-textfield) { - padding-top: 1.125rem; + padding-top: 1rem; // Workaround for raising placeholder in temporary autofill &:-webkit-autofill + .t-content .t-placeholder { @@ -156,6 +156,7 @@ :host[data-size='m'] & { font: var(--tui-font-text-xs); + line-height: 1.25rem; transform: translateY(-0.5rem); letter-spacing: 0.025rem; } diff --git a/projects/demo/src/modules/components/input/input.template.html b/projects/demo/src/modules/components/input/input.template.html index 35d334efebbc..c339d49eba9a 100644 --- a/projects/demo/src/modules/components/input/input.template.html +++ b/projects/demo/src/modules/components/input/input.template.html @@ -276,13 +276,7 @@ [documentationPropertyValues]="iconVariants" [(documentationPropertyValue)]="icon" > - Icon content. If content is a string, it is used as stringified svg or a name of icon registered in - - SvgService - + Icon content. If content is a string, it is used as stringified svg or a name of an icon expandable mode + + Icon content. If content is a string, it is used as stringified svg or a name of an icon + diff --git a/projects/kit/components/text-area/text-area.component.ts b/projects/kit/components/text-area/text-area.component.ts index a03bb3d59f44..c9e76fcd4526 100644 --- a/projects/kit/components/text-area/text-area.component.ts +++ b/projects/kit/components/text-area/text-area.component.ts @@ -127,9 +127,19 @@ export class TuiTextAreaComponent return this.controller.size; } + @HostBinding('style.--border-start.rem') + get borderStart(): number { + return this.iconLeftContent ? 1.75 : 0; + } + @HostBinding('style.--border-end.rem') - get border(): number { - return tuiGetBorder(false, this.hasCleaner, this.hasTooltip); + get borderEnd(): number { + return tuiGetBorder( + !!this.iconContent, + this.hasCleaner, + this.hasTooltip, + this.hasCustomContent, + ); } get hasCleaner(): boolean { @@ -138,7 +148,10 @@ export class TuiTextAreaComponent @HostBinding('class._has-tooltip') get hasTooltip(): boolean { - return !!this.hintOptions?.content && !this.computedDisabled; + return ( + !!this.hintOptions?.content && + (this.controller.options.hintOnDisabled || !this.computedDisabled) + ); } @HostBinding('class._has-value') @@ -155,6 +168,20 @@ export class TuiTextAreaComponent return this.placeholderRaisable || (!this.hasValue && !this.hasExampleText); } + get hasCustomContent(): boolean { + return !!this.controller.customContent; + } + + get iconLeftContent(): PolymorpheusContent< + TuiContextWithImplicit + > { + return this.controller.iconLeft; + } + + get iconContent(): PolymorpheusContent> { + return this.controller.icon; + } + get iconCleaner(): PolymorpheusContent> { return this.controller.options.iconCleaner; } @@ -187,13 +214,6 @@ export class TuiTextAreaComponent return this.value.slice(this.maxLength || Infinity); } - get showHint(): boolean { - return ( - !!this.hintOptions?.content && - (this.controller.options.hintOnDisabled || !this.computedDisabled) - ); - } - @HostListener('focusin', ['true']) @HostListener('focusout', ['false']) onFocused(focused: boolean): void { diff --git a/projects/kit/components/text-area/text-area.style.less b/projects/kit/components/text-area/text-area.style.less index 5fbfcc640cbc..559065aa97a1 100644 --- a/projects/kit/components/text-area/text-area.style.less +++ b/projects/kit/components/text-area/text-area.style.less @@ -7,9 +7,8 @@ position: relative; z-index: 0; display: flex; - font: var(--tui-font-text-m); flex-direction: column; - min-height: var(--tui-textarea-height, @height); + min-height: var(--tui-textarea-height); border-radius: var(--tui-radius-m); color: var(--tui-text-01); @@ -18,15 +17,23 @@ } &[data-size='s'] { + --tui-height: var(--tui-height-s); --tui-textarea-height: 4.5625rem; font: var(--tui-font-text-s); } &[data-size='m'] { + --tui-height: var(--tui-height-m); --tui-textarea-height: 5.5rem; font: var(--tui-font-text-s); } + &[data-size='l'] { + --tui-height: var(--tui-height-l); + --tui-textarea-height: @height; + font: var(--tui-font-text-m); + } + &[data-size='m']._has-counter { --tui-textarea-height: 6.625rem; } @@ -73,27 +80,19 @@ width: 100%; height: 100%; min-height: inherit; - padding-bottom: 0.4375rem; box-sizing: border-box; - - :host[data-size='s'] & { - padding-top: 0.375rem; - } - - :host[data-size='m']._label-outside & { - padding-top: 0.75rem; - } + padding: calc((var(--tui-height) - 1.25rem) / 2) 0; :host[data-size='l']._label-outside & { - padding-top: 1rem; + padding: calc((var(--tui-height) - 1.5rem) / 2) 0; } :host[data-size='m']:not(._label-outside) & { - padding-top: 1.25rem; + padding: calc((var(--tui-height) - 2.25rem) / 2) 0; } :host[data-size='l']:not(._label-outside) & { - padding-top: 1.625rem; + padding: calc((var(--tui-height) - 2.625rem) / 2) 0; } } @@ -118,16 +117,25 @@ .t-box { display: flex; - min-height: 100%; + min-height: calc(100% - 1rem); width: 100%; :host:not(._expandable) & { - height: 100%; + height: calc(100% - 1rem); } :host._has-counter._expandable & { margin-bottom: 1.25rem; } + + // For placeholder + :host[data-size='m']:not(._label-outside) & { + border-top: 1rem solid transparent; + } + + :host[data-size='l']:not(._label-outside) & { + border-top: 1.25rem solid transparent; + } } .t-pseudo-content { @@ -141,6 +149,7 @@ border-inline-start-width: var(--border-start, 0); border-inline-end-width: var(--border-end, 0); + :host[data-size='s'] &, :host[data-size='m'] & { padding: 0 0.75rem; } @@ -187,6 +196,7 @@ opacity: 1; } + :host[data-size='s'] &, :host[data-size='m'] & { padding: 0 0.75rem; } @@ -210,9 +220,9 @@ .t-placeholder { .textfield-placeholder(); position: absolute; + top: calc(var(--tui-height) / 2 - 0.625rem); left: 0; max-width: 100%; - padding: 0 1rem; border: solid transparent; border-width: 0 var(--border-end, 0) 0 var(--border-start, 0); border-inline-start-width: var(--border-start, 0); @@ -220,17 +230,15 @@ box-sizing: border-box; :host[data-size='s'] & { - top: 0.375rem; padding: 0 0.75rem; } :host[data-size='m'] & { - top: 0.75rem; padding: 0 0.75rem; } :host[data-size='l'] & { - top: 1.12rem; + padding: 0 1rem; } :host._label-outside & { @@ -245,10 +253,16 @@ display: flex; justify-content: flex-end; pointer-events: none; - padding: 1rem 0.75rem; + padding: calc((var(--tui-height) - 1.5rem) / 2) 0.75rem; +} - :host[data-size='m'] & { - padding: 0.75rem; +.t-icon { + .input-icon(); + + &_left { + margin: 0 auto 0 0; + margin-inline-start: 0; + margin-inline-end: auto; } } diff --git a/projects/kit/components/text-area/text-area.template.html b/projects/kit/components/text-area/text-area.template.html index 1f1e8272d580..2eeed7037292 100644 --- a/projects/kit/components/text-area/text-area.template.html +++ b/projects/kit/components/text-area/text-area.template.html @@ -65,6 +65,23 @@
+
+ +
+ + + +
+ +