Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions core/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -691,19 +691,16 @@ ion-datetime,event,ionFocus,void,true
ion-datetime,css-prop,--background,ionic
ion-datetime,css-prop,--background,ios
ion-datetime,css-prop,--background,md
ion-datetime,css-prop,--background-rgb,ionic
ion-datetime,css-prop,--background-rgb,ios
ion-datetime,css-prop,--background-rgb,md
ion-datetime,css-prop,--title-color,ionic
ion-datetime,css-prop,--focus-ring-color,ionic
ion-datetime,css-prop,--focus-ring-width,ionic
ion-datetime,css-prop,--title-color,ios
ion-datetime,css-prop,--title-color,md
ion-datetime,css-prop,--wheel-fade-background-rgb,ionic
ion-datetime,css-prop,--wheel-fade-background-rgb,ios
ion-datetime,css-prop,--wheel-fade-background-rgb,md
ion-datetime,css-prop,--wheel-highlight-background,ionic
ion-datetime,css-prop,--wheel-highlight-background,ios
ion-datetime,css-prop,--wheel-highlight-background,md
ion-datetime,css-prop,--wheel-highlight-border-radius,ionic
ion-datetime,css-prop,--wheel-highlight-border-radius,ios
ion-datetime,css-prop,--wheel-highlight-border-radius,md
ion-datetime,part,calendar-day
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
@import "../../themes/native/native.globals";

// Datetime
// Datetime: Common Styles
// --------------------------------------------------

:host {
/**
* @prop --background: The primary background of the datetime component.
* @prop --background-rgb: The primary background of the datetime component in RGB format.
* @prop --title-color: The text color of the title.
*
* @prop --wheel-highlight-background: The background of the highlight under the selected
* item when using a wheel style layout, or in the month/year picker for grid style layouts.
* @prop --wheel-highlight-border-radius: The border radius of the highlight under the selected
* item when using a wheel style layout, or in the month/year picker for grid style layouts.
* @prop --wheel-fade-background-rgb: The color of the gradient covering non-selected items
* when using a wheel style layout, or in the month/year picker for grid style layouts. Must
* be in RGB format, e.g. `255, 255, 255`.
*/

display: flex;

flex-flow: column;
Expand All @@ -32,19 +21,6 @@
height: auto;
}

:host(.datetime-size-fixed:not(.datetime-prefer-wheel)) {
max-width: 350px;
}

/**
* This ensures that the picker is appropriately
* sized and never truncates the text.
*/
:host(.datetime-size-fixed.datetime-prefer-wheel) {
min-width: 350px;
max-width: max-content;
}

:host(.datetime-size-cover) {
width: 100%;
}
Expand All @@ -68,6 +44,7 @@

opacity: 1;
}

/**
* Changing the physical order of the
* picker columns in the DOM is added
Expand Down Expand Up @@ -157,7 +134,6 @@
* Disabled buttons should have full opacity
* in readonly mode
*/

.calendar-day[disabled]:not(.calendar-day-constrained),
.datetime-action-buttons ion-button[disabled] {
opacity: 1;
Expand Down Expand Up @@ -213,12 +189,9 @@
justify-content: space-between;
}

:host .calendar-action-buttons ion-button {
--background: transparent;
}

// Calendar / Header / Days of Week
// -----------------------------------

:host .calendar-days-of-week {
display: grid;
grid-template-columns: repeat(7, 1fr);
Expand All @@ -237,6 +210,7 @@

// Calendar / Body
// -----------------------------------

:host .calendar-body {
/**
* Show all calendar months inline
Expand Down Expand Up @@ -330,7 +304,6 @@
* and horizontally within its grid cell.
*/
.calendar-day {
@include border-radius(50%);
@include padding(0px);
@include margin(0px);

Expand All @@ -348,25 +321,15 @@
background: none;
color: currentColor;

font-family: $font-family-base;

cursor: pointer;

appearance: none;

z-index: 0;
}

:host .calendar-day[disabled] {
.calendar-day[disabled] {
pointer-events: none;

opacity: 0.4;
}

.calendar-day:focus {
background: current-color(base, 0.2);

box-shadow: 0px 0px 0px 4px current-color(base, 0.2);
}

// Time / Header
Expand All @@ -378,32 +341,17 @@
justify-content: space-between;
}

:host(.datetime-presentation-time) .datetime-time {
@include padding(0);
}

:host ion-popover {
--height: 200px;
}

:host .time-header {
display: flex;

align-items: center;
}

:host .time-body {
@include border-radius(8px);
@include padding(6px, 12px, 6px, 12px);

display: flex;

border: none;

background: var(--ion-color-step-300, var(--ion-background-color-step-300, #edeef0));

color: $text-color;

font-family: inherit;
font-size: inherit;

Expand All @@ -412,19 +360,12 @@
appearance: none;
}

:host .time-body-active {
color: current-color(base);
}

:host(.in-item) {
position: static;
}

// Year Picker
// -----------------------------------
:host(.show-month-and-year) .calendar-action-buttons .calendar-month-year-toggle {
color: #{current-color(base)};
}

.calendar-month-year {
min-width: 0;
Expand All @@ -444,28 +385,9 @@
cursor: pointer;

z-index: 1;

&::after {
@include button-state();

transition: opacity 15ms linear, background-color 15ms linear;

z-index: -1;
}

&.ion-focused::after {
background: currentColor;
}

&:disabled {
opacity: 0.3;
pointer-events: none;
}
}

.calendar-month-year-toggle ion-icon {
@include padding(0, 0, 0, 4px);

flex-shrink: 0;
}

Expand All @@ -474,12 +396,3 @@

align-items: center;
}

// Picker Custom Variables
// -----------------------------------

ion-picker {
--highlight-background: var(--wheel-highlight-background);
--highlight-border-radius: var(--wheel-highlight-border-radius);
--fade-background-rgb: var(--wheel-fade-background-rgb);
}
140 changes: 140 additions & 0 deletions core/src/components/datetime/datetime.ionic.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
@use "../../themes/ionic/ionic.globals.scss" as globals;
@use "./datetime.common";

// Ionic Datetime
// --------------------------------------------------

:host {
/**
* @prop --focus-ring-color: The color of the ring around the focused element.
* @prop --focus-ring-width: The width of the ring around the focused element.
*/
--background: #{globals.$ionic-color-base-white};
--focus-ring-color: #{globals.$ionic-state-focus-1};
--focus-ring-width: #{globals.$ionic-border-radius-050};
}

// Calendar Header
// -----------------------------------

.calendar-action-buttons {
@include globals.padding(globals.$ionic-space-200, null);

align-items: center;

height: globals.$ionic-scale-1400;

box-sizing: border-box;
}

.calendar-month-year {
flex: 1 0 0;
}

// Month year toggle should match the
// default round clear button style
.calendar-month-year-toggle {
@include globals.border-radius(globals.$ionic-border-radius-full);
@include globals.typography(globals.$ionic-action-lg);
@include globals.padding(globals.$ionic-space-200, globals.$ionic-space-400);

min-width: globals.$ionic-scale-1600;
min-height: globals.$ionic-scale-1000;

border: var(--focus-ring-width) globals.$ionic-border-style-solid transparent;

color: globals.$ionic-color-primary-base;
}

// Hovered Month Year Toggle
@media (any-hover: hover) {
.calendar-month-year-toggle:hover {
background: globals.$ionic-color-neutral-200;
}
}

// Focused Month Year Toggle
.calendar-month-year-toggle.ion-focused {
border-color: var(--focus-ring-color);
}

// Activated Month Year Toggle
.calendar-month-year-toggle.ion-activated {
background: globals.$ionic-color-neutral-200;
}

// TODO(ROU-11119): Rewrite this when we replace the ion-button with a native button
.calendar-next-prev ion-button.button-has-icon-only {
--color: #{globals.$ionic-color-neutral-1000};
--background-activated: #{globals.$ionic-color-neutral-200};
--background-hover: #{globals.$ionic-color-neutral-200};
--background-hover-opacity: 1;
}

// TODO(ROU-11119): Rewrite this when we replace the ion-button with a native button
.calendar-next-prev ion-button.button-has-icon-only.ion-focused::part(native) {
border: globals.$ionic-border-size-050 globals.$ionic-border-style-solid globals.$ionic-state-focus-1;

outline: none;
}

// Calendar Days of Week
// -----------------------------------

.calendar-days-of-week {
@include globals.typography(globals.$ionic-overline-medium);

align-content: center;

height: globals.$ionic-scale-1200;

color: globals.$ionic-color-neutral-800;
}

// Calendar Day
// -----------------------------------

.calendar-day {
@include globals.border-radius(globals.$ionic-border-radius-full);
@include globals.padding(globals.$ionic-space-100);
@include globals.typography(globals.$ionic-action-md);

width: globals.$ionic-scale-1200;
min-width: globals.$ionic-scale-1200;

height: globals.$ionic-scale-1200;

color: globals.$ionic-color-neutral-1200;
}

// Disabled Day
.calendar-day[disabled]:not(.calendar-day-constrained) {
color: globals.$ionic-color-neutral-500;
}

// Current Day
.calendar-day.calendar-day-today {
color: globals.$ionic-color-primary-base;
}

// Selected Day
.calendar-day.calendar-day-active {
background: globals.$ionic-color-primary-100;
}

// Focused Day
.calendar-day:focus-visible {
border: var(--focus-ring-width) globals.$ionic-border-style-solid var(--focus-ring-color);
}

// Hovered Day
@media (any-hover: hover) {
.calendar-day:not([disabled]):not(:active):hover {
background: globals.$ionic-color-primary-200;
}
}

// Pressed Day
.calendar-day:active {
background: globals.$ionic-color-primary-300;
}
5 changes: 4 additions & 1 deletion core/src/components/datetime/datetime.ios.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
@import "./datetime.scss";
@import "./datetime.native.scss";
@import "./datetime.ios.vars.scss";
@import "../../themes/native/native.globals.ios";

// iOS Datetime
// --------------------------------------------------

:host {
--background: #{ion-color(light, base)};
--background-rgb: #{ion-color(light, base, null, true)};
Expand Down
4 changes: 3 additions & 1 deletion core/src/components/datetime/datetime.ios.vars.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@use "../../themes/native/native.globals" as globals;

// iOS Datetime
// --------------------------------------------------

/// @prop - Border color for dividers between header and footer
$datetime-ios-border-color: 0.55px solid $background-color-step-200;
$datetime-ios-border-color: 0.55px solid globals.$background-color-step-200;

/// @prop - Padding for content
$datetime-ios-padding: 16px;
Expand Down
Loading