Skip to content

Commit 8cf930b

Browse files
Merge branch 'PelayoFelgueroso-link-primary' of https://github.com/dxc-technology/halstack-react into PelayoFelgueroso-link-primary
2 parents c439bc6 + 80301db commit 8cf930b

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

apps/website/screens/components/paginator/code/PaginatorCodePage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ const sections = [
4646
</td>
4747
<td>
4848
An array of numbers representing the items per page options. If undefined, the select with items per page
49-
options will not be displayed.
49+
options will not be displayed. If there are 100 or more options, the select will be virtualized for better
50+
performance.
5051
</td>
5152
<td>-</td>
5253
</tr>

packages/lib/src/paginator/Paginator.stories.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Meta, StoryObj } from "@storybook/react";
22
import ExampleContainer from "../../.storybook/components/ExampleContainer";
33
import Title from "../../.storybook/components/Title";
44
import DxcPaginator from "./Paginator";
5+
import { userEvent, within } from "@storybook/test";
56

67
export default {
78
title: "Paginator",
@@ -28,6 +29,10 @@ const Paginator = () => (
2829
<Title title="Default with items per page options" theme="light" level={4} />
2930
<DxcPaginator itemsPerPageOptions={[5, 10, 15]} />
3031
</ExampleContainer>
32+
<ExampleContainer>
33+
<Title title="Default with items per page options virtualized" theme="light" level={4} />
34+
<DxcPaginator itemsPerPageOptions={Array.from({ length: 10000 }, (_, i) => i + 1)} />
35+
</ExampleContainer>
3136
<ExampleContainer>
3237
<Title title="Default with show go to page selector" theme="light" level={4} />
3338
<DxcPaginator showGoToPage />
@@ -76,6 +81,13 @@ type Story = StoryObj<typeof DxcPaginator>;
7681

7782
export const Chromatic: Story = {
7883
render: Paginator,
84+
play: async ({ canvasElement }) => {
85+
const canvas = within(canvasElement);
86+
const virtualizedSelect = canvas.getAllByRole("combobox")[1];
87+
if (virtualizedSelect) {
88+
await userEvent.click(virtualizedSelect);
89+
}
90+
},
7991
};
8092

8193
export const ResponsivePaginator: Story = {
@@ -84,4 +96,11 @@ export const ResponsivePaginator: Story = {
8496
viewport: { viewports: customViewports, defaultViewport: "resizedScreen" },
8597
chromatic: { viewports: [400] },
8698
},
99+
play: async ({ canvasElement }) => {
100+
const canvas = within(canvasElement);
101+
const virtualizedSelect = canvas.getAllByRole("combobox")[1];
102+
if (virtualizedSelect) {
103+
await userEvent.click(virtualizedSelect);
104+
}
105+
},
87106
};

packages/lib/src/paginator/Paginator.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ const DxcPaginator = ({
102102
value={itemsPerPage.toString()}
103103
size="fillParent"
104104
tabIndex={tabIndex}
105+
virtualizedHeight={itemsPerPageOptions.length >= 100 ? "304px" : undefined}
105106
/>
106107
</SelectContainer>
107108
</ItemsPerPageContainer>

packages/lib/src/radio-group/utils.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ export function getRadioInputStyles(
2121
: "var(--color-fg-neutral-stronger)";
2222
default:
2323
return status === "default"
24-
? "var(--color-fg-secondary-medium)"
24+
? "var(--color-fg-primary-strong)"
2525
: status === "hover"
26-
? "var(--color-fg-secondary-strong)"
27-
: "var(--color-fg-secondary-stronger)";
26+
? "var(--color-fg-primary-stronger)"
27+
: "var(--color-fg-primary-stronger)";
2828
}
2929
}
3030

0 commit comments

Comments
 (0)