Skip to content

Commit 0875c90

Browse files
authored
fix: hide fixed unknown Pagination story controls (#22008)
* fix: lock unknown Pagination story controls * fix: hide unused Pagination story controls * refactor: use different method to hide controls
1 parent 8ddef80 commit 0875c90

2 files changed

Lines changed: 20 additions & 12 deletions

File tree

packages/react/src/components/Pagination/Pagination.stories.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright IBM Corp. 2016, 2023
2+
* Copyright IBM Corp. 2016, 2026
33
*
44
* This source code is licensed under the Apache-2.0 license found in the
55
* LICENSE file in the root directory of this source tree.
@@ -183,17 +183,24 @@ PaginationWithCustomPageSizesLabel.storyName =
183183
'Pagination with custom page sizes label';
184184

185185
export const PaginationUnknownPages = (args) => {
186+
const { pageInputDisabled, pagesUnknown, totalItems, ...rest } = args ?? {};
187+
186188
return (
187189
<div>
188190
<Pagination
189191
{...props()}
190-
pagesUnknown={true}
191-
totalItems={undefined}
192192
page={1}
193-
{...args}
193+
{...rest}
194+
pagesUnknown
195+
totalItems={undefined}
194196
/>
195197
</div>
196198
);
197199
};
198200

199201
PaginationUnknownPages.storyName = 'Unknown pages and items';
202+
PaginationUnknownPages.parameters = {
203+
controls: {
204+
exclude: ['pageInputDisabled', 'pagesUnknown', 'totalItems'],
205+
},
206+
};

packages/web-components/src/components/pagination/pagination.stories.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright IBM Corp. 2019, 2025
2+
* Copyright IBM Corp. 2019, 2026
33
*
44
* This source code is licensed under the Apache-2.0 license found in the
55
* LICENSE file in the root directory of this source tree.
@@ -211,9 +211,13 @@ export const MultiplePaginationComponents = {
211211
export const PaginationUnknownPages = {
212212
name: 'Unknown pages and items',
213213
args: {
214-
pagesUnknown: true,
215214
totalItems: undefined,
216215
},
216+
parameters: {
217+
controls: {
218+
exclude: ['pageInputDisabled', 'pagesUnknown', 'totalItems'],
219+
},
220+
},
217221
render: (args) => {
218222
const {
219223
backwardText,
@@ -222,12 +226,9 @@ export const PaginationUnknownPages = {
222226
isLastPage,
223227
itemsPerPageText,
224228
page,
225-
pageInputDisabled,
226229
pageSize,
227230
pageSizeInputDisabled,
228-
pagesUnknown,
229231
size,
230-
totalItems,
231232
} = args ?? {};
232233

233234
return html`
@@ -239,11 +240,11 @@ export const PaginationUnknownPages = {
239240
items-per-page-text=${itemsPerPageText}
240241
page=${page}
241242
page-size=${pageSize}
242-
?page-input-disabled=${pageInputDisabled}
243+
?page-input-disabled=${false}
243244
?page-size-input-disabled=${pageSizeInputDisabled}
244245
size=${size}
245-
?pages-unknown=${pagesUnknown}
246-
total-items=${totalItems}
246+
?pages-unknown=${true}
247+
.totalItems=${undefined}
247248
@cds-page-sizes-select-changed=${(event: CustomEvent) => {
248249
action('cds-page-sizes-select-changed')(event.detail);
249250
}}

0 commit comments

Comments
 (0)