Skip to content

feat(time-picker): add disabled styles for values #6458

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

Merged
merged 8 commits into from
Jan 20, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,18 @@
@extend %time-picker__item !optional;
}

@include e(item, $mod: selected) {
@include e(item, $m: selected) {
@extend %time-picker__item--selected !optional;
}

@include e(item, $m: active) {
@extend %time-picker__item--active !optional;
}

@include e(item, $m: disabled) {
@extend %time-picker__item--disabled !optional;
}

// HOUR
@include e(hourList) {
@extend %time-picker__hourList !optional;
Expand Down Expand Up @@ -77,3 +81,4 @@
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
/// @param {Color} $hover-text-color [null] - The hover text color of a open time picker.
/// @param {Color} $selected-text-color [null] - The text color of a selected item in time picker.
/// @param {Color} $active-item-background [null] - The background color for current item in focused column inside the time picker.
/// @param {Color} $disabled-text-color [null] - The text color for disabled values.
/// @param {Color} $disabled-item-background [null] - The background color for disabled values .
/// @param {Color} $header-background [null] - The header background color of a time picker.
/// @param {Color} $header-hour-text-color [null] - The header hour text color of a time picker.
/// @param {Color} $header-time-period-color [null] - The header AM/PM text color of a time picker.
Expand Down Expand Up @@ -52,6 +54,8 @@
$hover-text-color: null,
$selected-text-color: null,
$active-item-background: null,
$disabled-text-color: null,
$disabled-item-background: null,
$header-background: null,
$header-hour-text-color: null,
$header-time-period-color: null,
Expand Down Expand Up @@ -102,6 +106,12 @@
}
}

@if not($disabled-text-color) and $disabled-item-background {
@if type-of($disabled-item-background) == 'color' {
$disabled-text-color: rgba(text-contrast($disabled-item-background), .6);
}
}

@if not($modal-shadow) {
$elevation: map-get($time-picker-schema, 'modal-elevation');
$modal-shadow: igx-elevation($elevations, $elevation);
Expand All @@ -119,6 +129,8 @@
hover-text-color: $hover-text-color,
selected-text-color: $selected-text-color,
active-item-background: $active-item-background,
disabled-text-color: $disabled-text-color,
disabled-item-background: $disabled-item-background,
header-background: $header-background,
header-hour-text-color: $header-hour-text-color,
header-time-period-color: $header-time-period-color,
Expand Down Expand Up @@ -263,6 +275,12 @@
background: --var($theme, 'active-item-background');
}

%time-picker__item--disabled {
color: --var($theme, 'disabled-text-color');
background: --var($theme, 'disabled-item-background');
pointer-events: none;
}

%time-picker__header {
background: --var($theme, 'header-background');
padding: rem(24px) rem(16px);
Expand Down Expand Up @@ -334,3 +352,4 @@
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
/// @prop {Map} hover-text-color [igx-color: ('secondary', 500)] - The hover text color of a open time picker.
/// @prop {Map} selected-text-color [igx-color: ('secondary', 500)] - The text color of a selected item in time picker.
/// @prop {Map} active-item-background [igx-color: ('grays', 100)] - The background color for current item in focused column inside the time picker.
/// @prop {Map} disabled-text-color [igx-color: ('grays', 500), hexrgba: (), rgba: .6] - The text color for disabled values.
/// @prop {Map} disabled-item-background [igx-color: ('grays', 100)] - The background color for disabled values .
/// @prop {Map} header-background [igx-color: ('secondary', 500)] - The header background color of a time picker.
/// @prop {Map} header-hour-text-color [igx-contrast-color: ('secondary', 500)] - The header hour text color of a time picker.
/// @prop {Map} header-time-period-color [igx-contrast-color: ('secondary', 500), rgba: .8] - The header AM/PM text color of a time picker.
Expand Down Expand Up @@ -47,6 +49,14 @@ $_light-time-picker: extend(
igx-color: ('grays', 100)
),

disabled-text-color: (
igx-color: ('grays', 500),
hexrgba: (),
rgba: .5
),

disabled-item-background: transparent,

header-background: (
igx-color: ('secondary', 500)
),
Expand Down Expand Up @@ -74,3 +84,4 @@ $_light-time-picker: extend(
/// @requires $_light-time-picker
/// @requires $_fluent-shape-time-picker
$_fluent-time-picker: extend($_light-time-picker, $_fluent-shape-time-picker);