Skip to content
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

feat(date-picker): add component tokens #8822

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
:host {
alisonailea marked this conversation as resolved.
Show resolved Hide resolved
@apply cursor-pointer flex relative text-color-3;
@apply cursor-pointer flex relative;
color: var(--calcite-internal-day-text-color, var(--calcite-color-text-3));
anveshmekala marked this conversation as resolved.
Show resolved Hide resolved
}

@include disabled();
Expand Down Expand Up @@ -42,11 +43,11 @@
@mixin range-part-middle() {
&:before {
inset-inline-end: 50%;
border-radius: 0;
border-radius: var(--calcite-corner-radius);
}
&:after {
inset-inline-start: 50%;
border-radius: 0;
border-radius: var(--calcite-corner-radius);
alisonailea marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand All @@ -69,77 +70,79 @@
}

.day {
@apply text-n2h
text-color-3
flex
@apply flex
focus-base
items-center
justify-center
rounded-full
anveshmekala marked this conversation as resolved.
Show resolved Hide resolved
leading-none
transition-default
z-default;
transition-default;
color: var(--calcite-internal-day-text-color);
alisonailea marked this conversation as resolved.
Show resolved Hide resolved
font-size: var(--calcite-internal-day-font-size, var(--calcite-font-size));
z-index: var(--calcite-z-index);
background: none;
background-color: var(--calcite-internal-day-background-color, var(--calcite-color-background-none));
anveshmekala marked this conversation as resolved.
Show resolved Hide resolved
box-shadow: 0 0 0 2px transparent;
block-size: var(--calcite-internal-day-size);
inline-size: var(--calcite-internal-day-size);
}

.text {
@apply mt-px mb-0;
margin-inline-start: theme("spacing.0");
@apply mb-0;
margin-block-start: var(--calcite-spacing-px);
}

:host([scale="s"]) {
--calcite-internal-day-size: 27px;

.day-v-wrapper {
@apply py-0.5;
padding-block: var(--calcite-spacing-base);
}
.day-wrapper {
@apply p-0;
}
.day {
@apply text-n2;
--calcite-internal-day-font-size: var(--calcite-font-size-sm);
}
}

:host([scale="m"]) {
--calcite-internal-day-size: 33px;

.day-v-wrapper {
@apply py-1;
padding-block: var(--calcite-spacing-xxs);
}
.day-wrapper {
@apply p-0;
}
.day {
@apply text-n1;
--calcite-internal-day-font-size: var(--calcite-font-size);
}
}

:host([scale="l"]) {
--calcite-internal-day-size: 43px;

.day-v-wrapper {
@apply py-1;
padding-block: var(--calcite-spacing-xxs);
}
.day-wrapper {
@apply px-1;
padding-inline: var(--calcite-spacing-xxs);
}
.day {
@apply text-0;
--calcite-internal-day-font-size: var(--calcite-font-size-md);
}
}

:host(:not([current-month])) .day {
@apply opacity-disabled;
opacity: var(--calcite-opacity-disabled);
}

:host(:hover:not([disabled]):not([selected])),
:host([active]:not([range]):not([selected])) {
& .day {
@apply bg-foreground-2 text-color-1;
--calcite-internal-day-background-color: var(--calcite-color-foreground-2);
color: var(--calcite-internal-day-text-color-active, var(--calcite-color-text-1));
}
}

Expand All @@ -153,9 +156,9 @@
}

:host([selected]) .day {
@apply font-medium;
background-color: var(--calcite-color-brand);
color: var(--calcite-color-foreground-1);
font-weight: var(--calcite-font-weight-medium);
color: var(--calcite-internal-day-text-color-selected, var(--calcite-color-text-inverse));
--calcite-internal-day-background-color: var(--calcite-color-brand);
}

:host(:focus:not([disabled])),
Expand All @@ -171,9 +174,8 @@
.day-wrapper {
@include range-part-middle();
}

.day {
@apply text-color-1;
color: var(--calcite-internal-day-text-color-active, var(--calcite-color-text-1));
}
}

Expand All @@ -191,7 +193,7 @@
.day-wrapper {
&:before,
&:after {
@apply bg-foreground-2;
background-color: var(--calcite-color-foreground-2);
anveshmekala marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down Expand Up @@ -240,7 +242,7 @@

@media (forced-colors: active) {
.day {
@apply rounded-none;
border-radius: var(--calcite-corner-radius);
alisonailea marked this conversation as resolved.
Show resolved Hide resolved
}

:host([selected]) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
@include base-component();

.calendar {
@apply mb-1;
margin-block-end: var(--calcite-spacing-xxs);
}

.week-headers {
@apply border-color-3
flex
border-0
border-t
border-solid
py-0
px-1;
@apply flex border-solid py-0;
border-width: var(--calcite-border-width-none);
border-block-start-width: var(--calcite-border-width-sm);
border-color: var(--calcite-internal-date-picker-month-week-headers-border-color, var(--calcite-color-border-3));
padding-inline: var(--calcite-spacing-xxs);
}

.week-header {
@apply text-color-3
text-center
font-bold;
@apply text-center px-0;
color: var(--calcite-internal-date-picker-month-week-headers-text-color, var(--calcite-color-text-3));
font-weight: var(--calcite-font-weight-semibold);
inline-size: calc(100% / 7);
line-height: var(--calcite-font-line-height-fixed-base);
}

.day {
Expand All @@ -33,23 +32,37 @@
}

:host([scale="s"]) .week-header {
@apply text-n2h px-0 pt-2 pb-3;
font-size: var(--calcite-font-size-sm);
padding-block-start: var(--calcite-spacing-sm);
padding-block-end: var(--calcite-spacing-md);
}

:host([scale="m"]) .week-header {
@apply text-n2h px-0 pt-3 pb-4;
font-size: var(--calcite-font-size-sm);
padding-block-start: var(--calcite-spacing-md);
padding-block-end: var(--calcite-spacing-xl);
}

:host([scale="l"]) .week-header {
@apply text-n1h px-0 pt-4 pb-5;
font-size: var(--calcite-font-size);
padding-block-start: var(--calcite-spacing-xl);
padding-block-end: var(--calcite-spacing-xxl);
}

.week-days {
@apply flex
flex-row
py-0;
padding-inline: 6px;
padding-inline: var(--calcite-spacing-xs);
&:focus {
@apply outline-none;
}
}

calcite-date-picker-day {
--calcite-internal-day-text-color: var(--calcite-internal-date-picker-month-day-text-color);
--calcite-internal-day-text-color-active: var(--calcite-internal-date-picker-month-day-text-color-active);
--calcite-internal-day-text-color-selected: var(--calcite-internal-date-picker-month-day-text-selected);
--calcite-internal-day-font-size: var(--calcite-internal-date-picker-month-day-font-size);
--calcite-internal-day-background-color: var(--calcite-internal-date-picker-month-day-background-color);
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
/**
* CSS Custom Properties
*
* These properties can be overridden using the component's tag as selector.
*
* @prop --calcite-date-picker-border-radius: Specifies the border radius of the component.
* @prop --calcite-date-picker-border-color: Specifies the border color of the component.
* @prop --calcite-date-picker-week-headers-border-color: Specifies the border color of week headers.
* @prop --calcite-date-picker-week-headers-text-color: Specifies the text color of week headers.
* @prop --calcite-date-picker-day-text-color: Specifies the text color of day.
* @prop --calcite-date-picker-day-text-color-active: Specifies the text color of day when active.
* @prop --calcite-date-picker-day-text-selected: Specifies the text color of day when selected.
* @prop --calcite-date-picker-day-font-size: Specifies the font size of the day.
* @prop --calcite-date-picker-day-background-color: Specifies the background color of the day.
*/

:host {
@extend %component-host;
@apply align-top
border
border-color-1
border-solid
inline-block
overflow-visible
rounded-none
w-auto;
border-radius: var(--calcite-date-picker-border-radius, var(--calcite-corner-radius));
border-color: var(--calcite-date-picker-border-color, var(--calcite-color-border-1));
border-width: var(--calcite-border-width-sm);
}

:host([scale="s"]) {
Expand All @@ -28,4 +44,14 @@
max-inline-size: 600px;
}

calcite-date-picker-month {
--calcite-internal-date-picker-month-week-headers-border-color: var(--calcite-date-picker-week-headers-border-color);
--calcite-internal-date-picker-month-week-headers-text-color: var(--calcite-date-picker-week-headers-text-color);
--calcite-internal-date-picker-month-day-text-color: var(--calcite-date-picker-day-text-color);
--calcite-internal-date-picker-month-day-text-color-active: var(--calcite-date-picker-day-text-color-active);
--calcite-internal-date-picker-month-day-text-selected: var(--calcite-date-picker-day-text-selected);
--calcite-internal-date-picker-month-day-font-size: var(--calcite-date-picker-day-font-size);
--calcite-internal-date-picker-month-day-background-color: var(--calcite-date-picker-day-background-color);
}

@include base-component();
Loading