Skip to content
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@use 'sass:map';
@use 'sass:string';
@use '../../base' as *;
@use 'igniteui-theming/sass/animations/easings' as *;

Expand All @@ -11,6 +12,7 @@
// The --variant CSS produced by css-vars is needed also
// when dynamically switching between the input `type` attribute.
$variant: map.get($theme, '_meta', 'theme');
$mode: map.get($theme, '_meta', 'variant');
$transition-timing: .25s $out-cubic;
$material-theme: $variant == 'material';
$indigo-theme: $variant == 'indigo';
Expand Down Expand Up @@ -112,7 +114,15 @@

@if $variant == 'material' {
%form-group-display--border {
&:has(input:-webkit-autofill, input:autofill) {
&:has(
input:-webkit-autofill,
input:autofill,
input[type='date'],
input[type='time'],
input[type='datetime-local'],
input[type='month'],
input[type='week']
) {
%igx-input-group__notch--border {
border-block-start-color: transparent;
}
Expand All @@ -137,12 +147,14 @@

%form-group-display {
@include sizable();

--component-size: var(--ig-size, #{var-get($theme, 'default-size')});
--input-size: var(--component-size);
--input-icon: #{sizable(rem(14px), rem(16px), rem(16px))};

position: relative;
display: block;
color-scheme: string.unquote($mode);
color: var-get($theme, 'idle-text-color');

igx-prefix,
Expand Down Expand Up @@ -193,6 +205,7 @@

input[type='number'] {
Comment thread
simeonoff marked this conversation as resolved.
-moz-appearance: textfield;
appearance: textfield;
}

// Don't show the number spinner
Expand All @@ -218,7 +231,15 @@

@if $variant == 'material' {
&:not(%form-group-display--border) {
&:has(input:-webkit-autofill, input:autofill) {
&:has(
input:-webkit-autofill,
input:autofill,
input[type='date'],
input[type='time'],
input[type='datetime-local'],
input[type='month'],
input[type='week']
) {
%form-group-label {
--floating-label-position: -73%;

Expand All @@ -230,12 +251,36 @@
}

&:not(%form-group-display--focused, %form-group-display--filled) {
&:has(input:not(:placeholder-shown, [type='file'])) {
&:has(input:not(
:placeholder-shown,
[type='file'],
[type='date'],
[type='time'],
[type='datetime-local'],
[type='month'],
[type='week']
)) {
%form-group-label {
@include type-style('subtitle-1');
transform: translateY(0);
}
}

&:has(
input[type='date'],
input[type='time'],
input[type='datetime-local'],
input[type='month'],
input[type='week']
) {
%form-group-label {
@include type-style('caption');
}

%igx-input-group__notch {
border-block-start-color: transparent !important;
}
}
}
}
}
Expand Down Expand Up @@ -272,11 +317,31 @@
color: var-get($theme, 'input-suffix-color--filled');
background: var-get($theme, 'input-suffix-background--filled');
}

&:not(%form-group-display--readonly, %form-group-display--disabled) {
&:hover {
%form-group-input {
color: var-get($theme, 'filled-text-hover-color');
}
}

&%form-group-display--focused {
%form-group-input {
color: var-get($theme, 'focused-text-color');
}
}
}
}

%form-group-display--focused {
color: var-get($theme, 'input-prefix-color--focused');

&:not(%form-group-display--filled) {
%form-group-input {
color: var-get($theme, 'idle-text-color');
}
}

igx-prefix,
[igxPrefix] {
color: var-get($theme, 'input-prefix-color--focused');
Expand Down Expand Up @@ -364,12 +429,9 @@
&:hover {
%form-group-input--hover {
cursor: default;
color: var-get($theme, 'filled-text-color');

&:not(:focus-within) {
&::placeholder {
color: var-get($theme, 'placeholder-color');
}
&:not(:focus-within)::placeholder {
color: var-get($theme, 'placeholder-color');
}
}
}
Expand All @@ -389,6 +451,10 @@
[igxSuffix] {
@extend %form-group-suffix--disabled;
}

input::-webkit-datetime-edit {
color: var-get($theme, 'disabled-text-color');
}
}

%form-group-box-wrapper {
Expand Down Expand Up @@ -1334,7 +1400,6 @@

%form-group-input {
position: relative;
display: block;
border: none;
padding-block-start: $input-top-padding;
padding-block-end: $input-bottom-padding;
Expand All @@ -1343,13 +1408,21 @@
width: 100%;
min-width: 0;
background: transparent;
color: var-get($theme, 'filled-text-color');
color: inherit;
outline-style: none;
box-shadow: none;
overflow: hidden;
text-overflow: ellipsis;

&:not(%form-group-textarea, [type='date']) {
appearance: none;

&:not(
%form-group-textarea,
[type='date'],
[type='time'],
[type='datetime-local'],
[type='month'],
[type='week']
) {
line-height: 0 !important; /* Reset typography */
}

Expand All @@ -1363,6 +1436,16 @@
line-height: normal; /* Fix placeholder position in Safari */
}

&::-webkit-datetime-edit-fields-wrapper {
width: 100%;
padding: 0;
}

&::-webkit-datetime-edit {
color: inherit;
line-height: normal;
}

@if $variant == 'indigo' {
height: calc(var-get($theme, 'size') - 1px);

Expand Down Expand Up @@ -1427,16 +1510,12 @@
}

%form-group-input--hover {
color: var-get($theme, 'filled-text-hover-color');

&::placeholder {
color: var-get($theme, 'hover-placeholder-color');
}
}

%form-group-input--focus {
color: var-get($theme, 'focused-text-color');

&::placeholder {
color: var-get($theme, 'hover-placeholder-color');
}
Expand Down Expand Up @@ -2299,7 +2378,15 @@

// The :not selector is needed otherwise bootstrap will override the %autofill-background-fix
%form-group-display--bootstrap {
:not(:has(input:-webkit-autofill, input:autofill)) {
:not(:has(
input:-webkit-autofill,
input:autofill,
input[type='date'],
input[type='time'],
input[type='datetime-local'],
input[type='month'],
input[type='week'])
) {
%bootstrap-input {
transition: box-shadow .15s ease-out, border .15s ease-out;
}
Expand Down
20 changes: 17 additions & 3 deletions src/app/input-group-showcase/input-group-showcase.sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,28 @@ export class InputGroupShowcaseSampleComponent {
control: {
type: 'button-group',
options: ['box', 'border', 'line', 'search'],
defaultValue: 'box'
defaultValue: 'border'
}
},
type: {
label: 'Native Input Type',
control: {
type: 'select',
options: ['email', 'number', 'password', 'search', 'tel', 'text', 'url'],
defaultValue: 'text'
options: [
'email',
'number',
'date',
'time',
'datetime-local',
'month',
'week',
'password',
'search',
'tel',
'text',
'url'
],
defaultValue: 'datetime-local'
}
},
label: {
Expand Down Expand Up @@ -205,6 +218,7 @@ export class InputGroupShowcaseSampleComponent {
private updateDisabledState(isDisabled: boolean): void {
Object.keys(this.reactiveForm.controls).forEach((controlName) => {
const control = this.reactiveForm.get(controlName);

if (control) {
isDisabled ? control.disable() : control.enable();
}
Expand Down
Loading