diff --git a/packages/calcite-components/src/components/pagination/pagination.scss b/packages/calcite-components/src/components/pagination/pagination.scss index 3e99f956fe9..3b34d4e7e6e 100644 --- a/packages/calcite-components/src/components/pagination/pagination.scss +++ b/packages/calcite-components/src/components/pagination/pagination.scss @@ -1,42 +1,88 @@ +@import "~@esri/calcite-design-tokens/dist/scss/core"; + +/** + * CSS Custom Properties + * + * These properties can be overridden using the component's tag as selector. + * + + * @prop --calcite-pagination-background-color-active: Specifies the background color of the pagination items while active. + * @prop --calcite-pagination-background-color-hover: Specifies the background color of the pagination items while hovered. + * @prop --calcite-pagination-background-color: Specifies the background color of the pagination items. + * @prop --calcite-pagination-border-color-hover: Specifies the border color the pagination items while hovered. + * @prop --calcite-pagination-border-color-selected: Specifies the border color of the pagination items when selected. + * @prop --calcite-pagination-text-color-hover: Specifies the text color of the pagination items items while hovered. + * @prop --calcite-pagination-text-color-selected: Specifies the text color of the pagination items when selected. + * @prop --calcite-pagination-text-color: Specifies the text color of the pagination items. + * @prop --calcite-pagination-arrow-background-color-active: Specifies the background color of the arrow items while active. + * @prop --calcite-pagination-arrow-background-color-hover: Specifies the background color of the arrow items while hovered. + * @prop --calcite-pagination-arrow-background-color: Specifies the background color of the arrow items. + * @prop --calcite-pagination-arrow-icon-color-active: Specifies the icon color of the arrow items while active. + * @prop --calcite-pagination-arrow-icon-color-hover: Specifies the icon color of the arrow items while hovered. + * @prop --calcite-pagination-arrow-icon-color: Specifies the icon color of the arrow items. + * + */ +/** + * Local props + * These properties are intended for internal component use only. It is not recommended that these properties be overwritten. + * + * --calcite-internal-pagination-item-size + * --calcite-internal-pagination-item-space +*/ :host { @apply flex; writing-mode: horizontal-tb; + --calcite-pagination-background-color-active: transparent; + --calcite-pagination-background-color-hover: transparent; + --calcite-pagination-background-color: transparent; + --calcite-pagination-border-color-hover: var(--calcite-color-border-2); + --calcite-pagination-border-color-selected: var(--calcite-color-brand); + --calcite-pagination-text-color-hover: var(--calcite-color-text-1); + --calcite-pagination-text-color-selected: var(--calcite-color-text-1); + --calcite-pagination-text-color: var(--calcite-color-text-3); + --calcite-pagination-arrow-background-color-active: var(--calcite-color-foreground-3); + --calcite-pagination-arrow-background-color-hover: var(--calcite-color-foreground-2); + --calcite-pagination-arrow-background-color: var(--calcite-pagination-background-color); + --calcite-pagination-arrow-icon-color-active: var(--calcite-color-brand); + --calcite-pagination-arrow-icon-color-hover: var(--calcite-color-brand); + --calcite-pagination-arrow-icon-color: var(--calcite-pagination-text-color); } :host([scale="s"]) { + --calcite-internal-pagination-item-size: var(--calcite-size-xxl); + --calcite-internal-pagination-item-space: var(--calcite-size-xxs); + & .chevron, & .page, & .ellipsis { - @apply text-n2h h-6 px-1; - min-inline-size: theme("width.6"); + @apply text-n2h; } } :host([scale="m"]) { + --calcite-internal-pagination-item-size: var(--calcite-size-xxxl); + --calcite-internal-pagination-item-space: var(--calcite-size-sm); + & .chevron, & .page, & .ellipsis { - @apply text-n1h h-8 px-2; - min-inline-size: theme("width.8"); + @apply text-n1h; } } :host([scale="l"]) { + --calcite-internal-pagination-item-size: #{$calcite-size-44}; + --calcite-internal-pagination-item-space: var(--calcite-size-md); + & .chevron, & .page, & .ellipsis { - @apply text-0h h-11; - min-inline-size: theme("width.11"); + @apply text-0h; } & .chevron { @apply px-2.5; } - - & .page, - & .ellipsis { - @apply px-3; - } } // focus styles @@ -50,10 +96,7 @@ .chevron, .page, .ellipsis { - @apply p-0 - m-0 - text-0h - text-color-3 + @apply text-0h font-inherit box-border flex @@ -61,8 +104,14 @@ border-none border-opacity-0 justify-center - align-baseline - bg-transparent; + align-baseline; + padding: 0; + margin: 0; + min-inline-size: var(--calcite-internal-pagination-item-size); + block-size: var(--calcite-internal-pagination-item-size); + padding-inline: var(--calcite-internal-pagination-item-space); + color: var(--calcite-pagination-text-color); + background-color: var(--calcite-pagination-background-color); } .chevron, @@ -71,29 +120,39 @@ border-block: 2px solid transparent; &:hover { - @apply text-color-1 transition-default; + @apply transition-default; + color: var(--calcite-pagination-text-color-hover); + background-color: var(--calcite-pagination-background-color-hover); + } + &:active { + background-color: var(--calcite-pagination-background-color-active); } } .page { &:hover { - @apply border-b-color-2; + border-block-end-color: var(--calcite-pagination-border-color-hover); } + &.selected { - @apply text-color-1 border-b-color-brand font-medium; + font-weight: var(--calcite-font-weight-medium); + color: var(--calcite-pagination-text-color-selected); + border-block-end-color: var(--calcite-pagination-border-color-selected); } } .chevron { + background-color: var(--calcite-pagination-arrow-background-color); &:hover { - @apply bg-foreground-2; - color: theme("backgroundColor.brand"); + background-color: var(--calcite-pagination-arrow-background-color-hover); + color: var(--calcite-pagination-arrow-icon-color-hover); } &:active { - @apply bg-foreground-3; + background-color: var(--calcite-pagination-arrow-background-color-active); + color: var(--calcite-pagination-arrow-icon-color-active); } &.disabled { - @apply pointer-events-none bg-transparent; + @apply pointer-events-none; & > calcite-icon { @apply opacity-disabled; } diff --git a/packages/calcite-components/src/components/pagination/pagination.stories.ts b/packages/calcite-components/src/components/pagination/pagination.stories.ts index 8043fcdd94e..8cf02792fb9 100644 --- a/packages/calcite-components/src/components/pagination/pagination.stories.ts +++ b/packages/calcite-components/src/components/pagination/pagination.stories.ts @@ -88,31 +88,62 @@ export const responsiveTinyNumberLastPage_TestOnly = (): string => createBreakpointStories(getResponsiveTemplate({ totalItems: 12, pageSize: 1, type: "last" })); export const darkModeFrenchLocaleAndLargeScaleGetsMediumChevron_TestOnly = (): string => html` - - +
+ + +
`; darkModeFrenchLocaleAndLargeScaleGetsMediumChevron_TestOnly.parameters = { modes: modesDarkDefault }; -export const arabicNumberingSystemAndRTL_TestOnly = (): string => - html` - `; +export const arabicNumberingSystemAndRTL_TestOnly = (): string => html` +
+ + +
+`; arabicNumberingSystemAndRTL_TestOnly.parameters = { chromatic: { diffThreshold: 1 }, }; + +export const theming_TestOnly = (): string => html` +
+ +
+`; diff --git a/packages/calcite-components/src/demos/pagination.html b/packages/calcite-components/src/demos/pagination.html index 76090b9c009..8f2855623f5 100644 --- a/packages/calcite-components/src/demos/pagination.html +++ b/packages/calcite-components/src/demos/pagination.html @@ -27,15 +27,251 @@ padding: 15px; flex: 1; } + + .themed-example { + --calcite-pagination-text-color: green; + --calcite-pagination-text-color-hover: darkgreen; + --calcite-pagination-text-color-selected: teal; + --calcite-pagination-background-color: lightyellow; + --calcite-pagination-background-color-hover: yellow; + --calcite-pagination-background-color-active: gold; + --calcite-pagination-border-color-selected: green; + --calcite-pagination-border-color-hover: orange; + --calcite-pagination-arrow-icon-color: blue; + --calcite-pagination-arrow-icon-color-hover: pink; + --calcite-pagination-arrow-icon-color-active: red; + --calcite-pagination-arrow-background-color: lightyellow; + --calcite-pagination-arrow-background-color-hover: orange; + --calcite-pagination-arrow-background-color-active: gold; + }

Pagination

+ -
+
+
+
+ + + + + scale = s + breakpoint = xxsmall +
+ +
+ breakpoint = xsmall +
+ +
+ breakpoint = small +
+ +
+ breakpoint = medium +
+ +
+ breakpoint = large +
+ +
+ scale = m + breakpoint = xxsmall +
+ +
+ breakpoint = xsmall +
+ +
+ breakpoint = small +
+ +
+ breakpoint = medium +
+ +
+ breakpoint = large +
+ +
+ scale = l + breakpoint = xxsmall +
+ +
+ breakpoint = xsmall +
+ +
+ breakpoint = small +
+ +
+ breakpoint = medium +
+ +
+ breakpoint = large +
+ +
+
+
small
@@ -43,7 +279,7 @@

Pagination

- Hello +
@@ -51,6 +287,37 @@

Pagination

+ +
+
themed
+ +
+ +
+
+ +
+ +
+ +
+
+
medium
@@ -59,7 +326,7 @@

Pagination

- Hello +
@@ -75,7 +342,7 @@

Pagination

- Hello +
@@ -98,8 +365,7 @@

Pagination

>
- Hello +
@@ -131,8 +397,7 @@

Pagination

>
- Hello +
@@ -164,8 +429,7 @@

Pagination

>
- Hello +
@@ -204,7 +468,7 @@

Pagination

page-size="100" start-item="1" scale="s" - >Hello + > @@ -243,7 +507,7 @@

Pagination

page-size="100" start-item="1" scale="m" - >Hello + > @@ -282,7 +546,7 @@

Pagination

page-size="100" start-item="1" scale="l" - >Hello + >