@porsche-design-system/components-react 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -9
- package/esm/lib/components/carousel.wrapper.js +3 -3
- package/esm/lib/components/pagination.wrapper.js +3 -3
- package/lib/components/carousel.wrapper.d.ts +8 -0
- package/lib/components/carousel.wrapper.js +3 -3
- package/lib/components/pagination.wrapper.d.ts +10 -2
- package/lib/components/pagination.wrapper.js +3 -3
- package/lib/types.d.ts +199 -199
- package/package.json +2 -2
- package/ssr/components/dist/styles/esm/styles-entry.js +80 -37
- package/ssr/components/dist/utils/esm/utils-entry.js +55 -89
- package/ssr/components-react/projects/react-ssr-wrapper/src/lib/components/carousel.wrapper.js +4 -4
- package/ssr/components-react/projects/react-ssr-wrapper/src/lib/components/pagination.wrapper.js +4 -4
- package/ssr/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/carousel.js +5 -4
- package/ssr/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/pagination.js +7 -6
- package/ssr/esm/components/dist/styles/esm/styles-entry.js +80 -37
- package/ssr/esm/components/dist/utils/esm/utils-entry.js +55 -89
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/carousel.wrapper.js +4 -4
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/pagination.wrapper.js +4 -4
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/carousel.js +5 -4
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/pagination.js +8 -7
- package/ssr/lib/components/carousel.wrapper.d.ts +8 -0
- package/ssr/lib/components/pagination.wrapper.d.ts +10 -2
- package/ssr/lib/dsr-components/pagination.d.ts +0 -1
- package/ssr/lib/types.d.ts +199 -199
|
@@ -313,14 +313,17 @@ const hasVisibleIcon = (iconName, iconSource) => {
|
|
|
313
313
|
};
|
|
314
314
|
|
|
315
315
|
const childrenMutationMap = new Map();
|
|
316
|
-
const getObservedNode = (mutatedNode) => childrenMutationMap.has(mutatedNode) ? mutatedNode : getObservedNode(mutatedNode.parentNode);
|
|
317
316
|
hasWindow &&
|
|
318
317
|
new MutationObserver((mutations) => {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
318
|
+
// there may be race conditions in jsdom-polyfill tests where the map is already empty when a mutation happens
|
|
319
|
+
if (childrenMutationMap.size) {
|
|
320
|
+
const mapKeys = Array.from(childrenMutationMap.keys());
|
|
321
|
+
mutations
|
|
322
|
+
// remove duplicates so we execute callback only once per node
|
|
323
|
+
.filter((mutation, idx, arr) => arr.findIndex((m) => m.target === mutation.target) === idx)
|
|
324
|
+
// find node in map that contains the mutated element to find and invoke its callback
|
|
325
|
+
.forEach((mutation) => { var _a; return (_a = childrenMutationMap.get(mapKeys.find((node) => node.contains(mutation.target)))) === null || _a === void 0 ? void 0 : _a(); });
|
|
326
|
+
}
|
|
324
327
|
});
|
|
325
328
|
|
|
326
329
|
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
|
@@ -4350,6 +4353,11 @@ const getComponentCss$U = (icon, iconSource, variant, hideLabel, disabled, loadi
|
|
|
4350
4353
|
|
|
4351
4354
|
const carouselTransitionDuration = 400;
|
|
4352
4355
|
const bulletActiveClass = 'bullet--active';
|
|
4356
|
+
const paginationInfiniteStartCaseClass = 'pagination--infinite';
|
|
4357
|
+
const bulletInfiniteClass = 'bullet--infinite';
|
|
4358
|
+
const paginationBulletSize = '8px';
|
|
4359
|
+
const paginationInfiniteBulletSize = '4px';
|
|
4360
|
+
const paginationActiveBulletSize = '20px';
|
|
4353
4361
|
const selectorHeading = 'h2,::slotted([slot=heading])';
|
|
4354
4362
|
const selectorDescription = 'p,::slotted([slot=description])';
|
|
4355
4363
|
const mediaQueryS = getMediaQueryMin('s');
|
|
@@ -4357,13 +4365,13 @@ const mediaQueryXXL = getMediaQueryMin('xxl');
|
|
|
4357
4365
|
// we need an explicit grid template, therefor we need to calculate the button group width
|
|
4358
4366
|
const buttonSize$1 = `calc(${spacingStaticSmall} * 2 + ${fontLineHeight})`;
|
|
4359
4367
|
// + 2px, compensates hover offset of button-pure
|
|
4360
|
-
const buttonGroupWidth = `calc(${buttonSize$1} *
|
|
4368
|
+
const buttonGroupWidth = `calc(${buttonSize$1} * 3 + ${spacingStaticXSmall} + 2px)`;
|
|
4361
4369
|
const spacingMap = {
|
|
4362
4370
|
basic: gridBasicOffset,
|
|
4363
4371
|
extended: gridExtendedOffset,
|
|
4364
4372
|
};
|
|
4365
|
-
const getComponentCss$T = (width, hasPagination, alignHeader, theme) => {
|
|
4366
|
-
const { primaryColor, contrastMediumColor } = getThemedColors(theme);
|
|
4373
|
+
const getComponentCss$T = (width, hasPagination, isInfinitePagination, alignHeader, theme) => {
|
|
4374
|
+
const { primaryColor, contrastMediumColor, focusColor } = getThemedColors(theme);
|
|
4367
4375
|
const { canvasTextColor } = getHighContrastColors();
|
|
4368
4376
|
const isHeaderAlignCenter = alignHeader === 'center';
|
|
4369
4377
|
return getCss(Object.assign({ '@global': {
|
|
@@ -4393,12 +4401,23 @@ const getComponentCss$T = (width, hasPagination, alignHeader, theme) => {
|
|
|
4393
4401
|
gap: spacingStaticXSmall,
|
|
4394
4402
|
gridArea: '1 / 3 / 3 / auto',
|
|
4395
4403
|
alignItems: 'end',
|
|
4404
|
+
justifyContent: 'end',
|
|
4405
|
+
justifySelf: 'end',
|
|
4396
4406
|
},
|
|
4397
4407
|
}, btn: {
|
|
4398
4408
|
padding: spacingStaticSmall,
|
|
4409
|
+
}, 'skip-link': {
|
|
4410
|
+
opacity: 0,
|
|
4411
|
+
pointerEvents: 'none',
|
|
4412
|
+
'&:focus': {
|
|
4413
|
+
opacity: 1,
|
|
4414
|
+
pointerEvents: 'all',
|
|
4415
|
+
},
|
|
4399
4416
|
}, splide: {
|
|
4400
4417
|
overflow: 'hidden',
|
|
4401
4418
|
// visibility: 'hidden',
|
|
4419
|
+
padding: '4px 0',
|
|
4420
|
+
margin: '-4px 0',
|
|
4402
4421
|
'&__track': Object.assign(Object.assign({ cursor: 'grab' }, addImportantToEachRule({
|
|
4403
4422
|
padding: `0 ${spacingMap[width].base}`,
|
|
4404
4423
|
[getMediaQueryMax('xs')]: {
|
|
@@ -4415,26 +4434,58 @@ const getComponentCss$T = (width, hasPagination, alignHeader, theme) => {
|
|
|
4415
4434
|
WebkitUserSelect: 'none',
|
|
4416
4435
|
WebkitTouchCallout: 'none',
|
|
4417
4436
|
} }),
|
|
4418
|
-
'&__list': Object.assign({ display: 'flex'
|
|
4419
|
-
'&__slide': Object.assign(Object.assign({ position: 'relative', flexShrink: 0 }, getBackfaceVisibilityJssStyle()), { transform: 'translateZ(0)'
|
|
4437
|
+
'&__list': Object.assign({ display: 'flex' }, getBackfaceVisibilityJssStyle()),
|
|
4438
|
+
'&__slide': Object.assign(Object.assign({ position: 'relative', flexShrink: 0 }, getBackfaceVisibilityJssStyle()), { transform: 'translateZ(0)', borderRadius: borderRadiusLarge, overflow: 'hidden', '&:focus-visible': {
|
|
4439
|
+
outline: `${borderWidthBase} solid ${focusColor}`,
|
|
4440
|
+
outlineOffset: '2px',
|
|
4441
|
+
} }),
|
|
4420
4442
|
'&__sr': getHiddenTextJssStyle(), // appears in the DOM when sliding
|
|
4421
|
-
} }, (hasPagination && {
|
|
4422
|
-
pagination: Object.assign(Object.assign({}, buildResponsiveStyles(hasPagination, (hasPaginationValue) => ({
|
|
4443
|
+
} }, (hasPagination && Object.assign(Object.assign({ ['pagination-container']: Object.assign(Object.assign({}, buildResponsiveStyles(hasPagination, (hasPaginationValue) => ({
|
|
4423
4444
|
display: hasPaginationValue ? 'flex' : 'none',
|
|
4424
|
-
}))), { justifyContent: 'center',
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4445
|
+
}))), { position: 'relative', justifyContent: isInfinitePagination ? 'flex-start' : 'center', width: `calc(${paginationActiveBulletSize} + ${paginationBulletSize} * 4 + ${spacingStaticSmall} * 4)`, left: 'calc(50% - 42px)', overflowX: 'hidden' }), pagination: {
|
|
4446
|
+
display: 'flex',
|
|
4447
|
+
alignItems: 'center',
|
|
4448
|
+
width: 'fit-content',
|
|
4449
|
+
height: paginationBulletSize,
|
|
4450
|
+
gap: spacingStaticSmall,
|
|
4451
|
+
transition: `transform ${carouselTransitionDuration}ms`,
|
|
4452
|
+
}, bullet: Object.assign({ borderRadius: borderRadiusSmall, background: isHighContrastMode ? canvasTextColor : contrastMediumColor }, (isInfinitePagination
|
|
4453
|
+
? {
|
|
4454
|
+
width: '0px',
|
|
4455
|
+
height: '0px',
|
|
4456
|
+
transition: `background-color ${carouselTransitionDuration}ms, width ${carouselTransitionDuration}ms, height ${carouselTransitionDuration}ms`,
|
|
4457
|
+
}
|
|
4458
|
+
: {
|
|
4459
|
+
width: paginationBulletSize,
|
|
4460
|
+
height: paginationBulletSize,
|
|
4461
|
+
transition: `background-color ${carouselTransitionDuration}ms, width ${carouselTransitionDuration}ms`,
|
|
4462
|
+
})) }, (isInfinitePagination && {
|
|
4463
|
+
[`${paginationInfiniteStartCaseClass}`]: {
|
|
4464
|
+
['& > .bullet:nth-child(-n+4)']: {
|
|
4465
|
+
width: paginationBulletSize,
|
|
4466
|
+
height: paginationBulletSize,
|
|
4467
|
+
},
|
|
4436
4468
|
},
|
|
4437
|
-
|
|
4469
|
+
[`${bulletInfiniteClass}`]: Object.assign(Object.assign({}, addImportantToEachRule({
|
|
4470
|
+
width: paginationInfiniteBulletSize,
|
|
4471
|
+
height: paginationInfiniteBulletSize,
|
|
4472
|
+
})), { '& ~ span': {
|
|
4473
|
+
width: paginationBulletSize,
|
|
4474
|
+
height: paginationBulletSize,
|
|
4475
|
+
}, [`& ~ .${bulletInfiniteClass} ~ span`]: {
|
|
4476
|
+
width: '0px',
|
|
4477
|
+
height: '0px',
|
|
4478
|
+
} }),
|
|
4479
|
+
})), { [`${bulletActiveClass}`]: Object.assign({ background: isHighContrastMode ? canvasTextColor : primaryColor, height: paginationBulletSize, width: addImportantToRule(paginationActiveBulletSize) }, (isInfinitePagination && {
|
|
4480
|
+
'& ~ span': {
|
|
4481
|
+
width: paginationBulletSize,
|
|
4482
|
+
height: paginationBulletSize,
|
|
4483
|
+
},
|
|
4484
|
+
[`& ~ .${bulletInfiniteClass} ~ span`]: {
|
|
4485
|
+
width: '0px',
|
|
4486
|
+
height: '0px',
|
|
4487
|
+
},
|
|
4488
|
+
})) }))));
|
|
4438
4489
|
};
|
|
4439
4490
|
|
|
4440
4491
|
const getThemedFormStateColors = (theme, state) => {
|
|
@@ -5328,7 +5379,7 @@ const getComponentCss$v = (maxNumberOfPageLinks, theme) => {
|
|
|
5328
5379
|
return getCss({
|
|
5329
5380
|
'@global': {
|
|
5330
5381
|
':host': Object.assign({ display: 'block' }, addImportantToEachRule(hostHiddenStyles)),
|
|
5331
|
-
nav: Object.assign({ display: 'flex', justifyContent: 'center' }, buildResponsiveStyles(maxNumberOfPageLinks, (n) => ({
|
|
5382
|
+
nav: Object.assign({ display: 'flex', justifyContent: 'center', userSelect: 'none' }, buildResponsiveStyles(maxNumberOfPageLinks, (n) => ({
|
|
5332
5383
|
counterReset: `size ${n}`,
|
|
5333
5384
|
}))),
|
|
5334
5385
|
ul: {
|
|
@@ -5352,16 +5403,8 @@ const getComponentCss$v = (maxNumberOfPageLinks, theme) => {
|
|
|
5352
5403
|
},
|
|
5353
5404
|
},
|
|
5354
5405
|
span: Object.assign(Object.assign(Object.assign(Object.assign({ display: 'flex', justifyContent: 'center', alignItems: 'center', transition: ['color', 'border-color', 'background-color'].map(getTransition).join(), position: 'relative', width: buttonSize, height: buttonSize, boxSizing: 'border-box' }, textSmallStyle), { whiteSpace: 'nowrap', cursor: 'pointer', color: primaryColor, outline: 0, borderRadius: borderRadiusSmall, borderColor: 'transparent' }), hoverMediaQuery({
|
|
5355
|
-
'&:not([aria-disabled]):not(.ellipsis):hover': Object.assign(Object.assign({}, frostedGlassStyle), {
|
|
5356
|
-
})), { '&:not(.ellipsis):focus::before': Object.assign(Object.assign({ content: '""', position: 'absolute' }, getInsetJssStyle(-4)), { border: `${borderWidthBase} solid ${focusColor}`, borderRadius: borderRadiusMedium }), '&:
|
|
5357
|
-
borderColor: 'transparent',
|
|
5358
|
-
}, '&[aria-current]': {
|
|
5359
|
-
disabledCursorStyle,
|
|
5360
|
-
color: primaryColor,
|
|
5361
|
-
border: `${borderWidthBase} solid ${primaryColor}`,
|
|
5362
|
-
borderRadius: borderRadiusSmall,
|
|
5363
|
-
'&:not(.ellipsis):focus::before': Object.assign({}, getInsetJssStyle(-6)),
|
|
5364
|
-
}, '&[aria-disabled]': Object.assign(Object.assign({}, disabledCursorStyle), { color: disabledColor }) }),
|
|
5406
|
+
'&:not([aria-disabled]):not(.ellipsis):hover': Object.assign(Object.assign({}, frostedGlassStyle), { background: hoverColor }),
|
|
5407
|
+
})), { '&:not(.ellipsis):focus:focus-visible::before': Object.assign(Object.assign({ content: '""', position: 'absolute' }, getInsetJssStyle(-4)), { border: `${borderWidthBase} solid ${focusColor}`, borderRadius: borderRadiusMedium }), '&[aria-current]': Object.assign(Object.assign({}, disabledCursorStyle), { color: primaryColor, border: `${borderWidthBase} solid ${primaryColor}`, '&:not(.ellipsis):focus::before': getInsetJssStyle(-6) }), '&[aria-disabled]': Object.assign(Object.assign({}, disabledCursorStyle), { color: disabledColor }) }),
|
|
5365
5408
|
},
|
|
5366
5409
|
ellipsis: Object.assign(Object.assign({}, disabledCursorStyle), { '&::after': {
|
|
5367
5410
|
content: '"…"',
|
|
@@ -156,14 +156,17 @@ const hasVisibleIcon = (iconName, iconSource) => {
|
|
|
156
156
|
};
|
|
157
157
|
|
|
158
158
|
const childrenMutationMap = new Map();
|
|
159
|
-
const getObservedNode = (mutatedNode) => childrenMutationMap.has(mutatedNode) ? mutatedNode : getObservedNode(mutatedNode.parentNode);
|
|
160
159
|
hasWindow &&
|
|
161
160
|
new MutationObserver((mutations) => {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
161
|
+
// there may be race conditions in jsdom-polyfill tests where the map is already empty when a mutation happens
|
|
162
|
+
if (childrenMutationMap.size) {
|
|
163
|
+
const mapKeys = Array.from(childrenMutationMap.keys());
|
|
164
|
+
mutations
|
|
165
|
+
// remove duplicates so we execute callback only once per node
|
|
166
|
+
.filter((mutation, idx, arr) => arr.findIndex((m) => m.target === mutation.target) === idx)
|
|
167
|
+
// find node in map that contains the mutated element to find and invoke its callback
|
|
168
|
+
.forEach((mutation) => { var _a; return (_a = childrenMutationMap.get(mapKeys.find((node) => node.contains(mutation.target)))) === null || _a === void 0 ? void 0 : _a(); });
|
|
169
|
+
}
|
|
167
170
|
});
|
|
168
171
|
|
|
169
172
|
const isTouchDevice = () => {
|
|
@@ -2757,7 +2760,7 @@ function convertCase(style) {
|
|
|
2757
2760
|
*/
|
|
2758
2761
|
|
|
2759
2762
|
|
|
2760
|
-
function camelCase
|
|
2763
|
+
function camelCase() {
|
|
2761
2764
|
function onProcessStyle(style) {
|
|
2762
2765
|
if (Array.isArray(style)) {
|
|
2763
2766
|
// Handle rules like @font-face, which can have multiple styles in an array
|
|
@@ -3627,7 +3630,7 @@ createJss({
|
|
|
3627
3630
|
plugins: [
|
|
3628
3631
|
jssGlobal(),
|
|
3629
3632
|
jssNested(),
|
|
3630
|
-
camelCase
|
|
3633
|
+
camelCase(),
|
|
3631
3634
|
jssPluginSortMediaQueries({ combineMediaQueries: true }),
|
|
3632
3635
|
],
|
|
3633
3636
|
});
|
|
@@ -3681,7 +3684,11 @@ const getButtonAriaAttributes = (isDisabled, isLoading, aria) => {
|
|
|
3681
3684
|
};
|
|
3682
3685
|
getMediaQueryMin('s');
|
|
3683
3686
|
getMediaQueryMin('xxl');
|
|
3684
|
-
|
|
3687
|
+
// Infinite bullets will be shown if the total number of bullets is greater than this value
|
|
3688
|
+
const INFINITE_BULLET_THRESHOLD = 5;
|
|
3689
|
+
const isInfinitePagination = (amountOfPages) => {
|
|
3690
|
+
return amountOfPages > INFINITE_BULLET_THRESHOLD;
|
|
3691
|
+
};
|
|
3685
3692
|
|
|
3686
3693
|
const CDN_BASE_URL$3 = (typeof window !== 'undefined' && window.PORSCHE_DESIGN_SYSTEM_CDN === 'cn' ? 'https://cdn.ui.porsche.cn' : 'https://cdn.ui.porsche.com') + '/porsche-design-system/crest';
|
|
3687
3694
|
const CRESTS_MANIFEST = { "porscheCrest": { "1x": { "png": "porsche-crest.min.d76137cf8cf94822b7aedb534ba88418@1x.png", "webp": "porsche-crest.min.0d0cc89ae5ee57c4c15bd0dbbcbfe5d0@1x.webp" }, "2x": { "png": "porsche-crest.min.8a292fbd35a5155789ddd011585e05c4@2x.png", "webp": "porsche-crest.min.2245c45e99be5a46b4b56e73c43d5c63@2x.webp" }, "3x": { "png": "porsche-crest.min.18d6f02003b0829bac939fade88fd4e6@3x.png", "webp": "porsche-crest.min.19b429278b158b5cb5aa6ce80751e3fe@3x.webp" } } };
|
|
@@ -3810,38 +3817,21 @@ const getSvgUrl = (model) => {
|
|
|
3810
3817
|
return `${cdnBaseUrl}/${MODEL_SIGNATURES_MANIFEST[model]}`;
|
|
3811
3818
|
};
|
|
3812
3819
|
const modelSignatureHeight = 36;
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
PAGE
|
|
3816
|
-
ELLIPSIS
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
};
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
FIRST_ELLIPSIS: -1,
|
|
3823
|
-
SECOND_ELLIPSIS: -2,
|
|
3824
|
-
PREVIOUS_PAGE_LINK: -4,
|
|
3825
|
-
NEXT_PAGE_LINK: -5,
|
|
3826
|
-
};
|
|
3827
|
-
// TODO: merge factories
|
|
3828
|
-
const createFirstEllipsis = (pageNumber) => ({
|
|
3829
|
-
type: itemTypes.ELLIPSIS,
|
|
3830
|
-
key: itemKeys.FIRST_ELLIPSIS,
|
|
3831
|
-
value: pageNumber,
|
|
3832
|
-
isActive: false,
|
|
3833
|
-
});
|
|
3834
|
-
const createSecondEllipsis = (pageNumber) => ({
|
|
3835
|
-
type: itemTypes.ELLIPSIS,
|
|
3836
|
-
key: itemKeys.SECOND_ELLIPSIS,
|
|
3837
|
-
value: pageNumber,
|
|
3820
|
+
var ItemType;
|
|
3821
|
+
(function (ItemType) {
|
|
3822
|
+
ItemType[ItemType["PAGE"] = 0] = "PAGE";
|
|
3823
|
+
ItemType[ItemType["ELLIPSIS"] = 1] = "ELLIPSIS";
|
|
3824
|
+
ItemType[ItemType["PREVIOUS"] = 2] = "PREVIOUS";
|
|
3825
|
+
ItemType[ItemType["NEXT"] = 3] = "NEXT";
|
|
3826
|
+
})(ItemType || (ItemType = {}));
|
|
3827
|
+
const ellipsisItem = {
|
|
3828
|
+
type: ItemType.ELLIPSIS,
|
|
3838
3829
|
isActive: false,
|
|
3839
|
-
}
|
|
3830
|
+
};
|
|
3840
3831
|
const createPreviousPageLink = (options) => {
|
|
3841
3832
|
const { activePage } = options;
|
|
3842
3833
|
return {
|
|
3843
|
-
type:
|
|
3844
|
-
key: itemKeys.PREVIOUS_PAGE_LINK,
|
|
3834
|
+
type: ItemType.PREVIOUS,
|
|
3845
3835
|
value: Math.max(1, activePage - 1),
|
|
3846
3836
|
isActive: activePage > 1,
|
|
3847
3837
|
};
|
|
@@ -3849,78 +3839,58 @@ const createPreviousPageLink = (options) => {
|
|
|
3849
3839
|
const createNextPageLink = (options) => {
|
|
3850
3840
|
const { activePage, pageTotal } = options;
|
|
3851
3841
|
return {
|
|
3852
|
-
type:
|
|
3853
|
-
key: itemKeys.NEXT_PAGE_LINK,
|
|
3842
|
+
type: ItemType.NEXT,
|
|
3854
3843
|
value: Math.min(pageTotal, activePage + 1),
|
|
3855
3844
|
isActive: activePage < pageTotal,
|
|
3856
3845
|
};
|
|
3857
3846
|
};
|
|
3858
3847
|
const createPageFunctionFactory = (options) => {
|
|
3859
|
-
const { activePage } = options;
|
|
3860
3848
|
return (pageNumber) => ({
|
|
3861
|
-
type:
|
|
3862
|
-
key: pageNumber,
|
|
3849
|
+
type: ItemType.PAGE,
|
|
3863
3850
|
value: pageNumber,
|
|
3864
|
-
isActive: pageNumber === activePage,
|
|
3851
|
+
isActive: pageNumber === options.activePage,
|
|
3865
3852
|
});
|
|
3866
3853
|
};
|
|
3867
3854
|
const createRange = (start, end) => Array.from(Array(end - start + 1)).map((_, i) => i + start);
|
|
3868
3855
|
const createPaginationModel = (options) => {
|
|
3869
|
-
|
|
3870
|
-
if (options == null) {
|
|
3871
|
-
throw new Error('createPaginationModel(): options object should be a passed');
|
|
3872
|
-
}
|
|
3873
|
-
const { pageTotal, activePage, pageRange } = options;
|
|
3856
|
+
const { pageTotal, activePage, pageRange, showLastPage } = options;
|
|
3874
3857
|
const boundaryPagesRange = 1;
|
|
3875
3858
|
const ellipsisSize = 1;
|
|
3876
|
-
const paginationModel = [];
|
|
3859
|
+
const paginationModel = [createPreviousPageLink(options)];
|
|
3877
3860
|
const createPage = createPageFunctionFactory(options);
|
|
3878
|
-
paginationModel.push(createPreviousPageLink(options));
|
|
3879
3861
|
// Simplify generation of pages if number of available items is equal or greater than total pages to show
|
|
3880
3862
|
if (1 + 2 * ellipsisSize + 2 * pageRange + 2 * boundaryPagesRange >= pageTotal) {
|
|
3881
3863
|
const allPages = createRange(1, pageTotal).map(createPage);
|
|
3882
3864
|
paginationModel.push(...allPages);
|
|
3883
3865
|
}
|
|
3884
3866
|
else {
|
|
3885
|
-
//
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
const
|
|
3889
|
-
|
|
3890
|
-
const
|
|
3891
|
-
|
|
3892
|
-
const
|
|
3893
|
-
|
|
3894
|
-
const
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
const
|
|
3901
|
-
const
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
// Calculate and add ellipsis after group of main pages
|
|
3908
|
-
const secondEllipsisPageNumber = mainPagesEnd + 1;
|
|
3909
|
-
const showPageInsteadOfSecondEllipsis = secondEllipsisPageNumber === lastPagesStart - 1;
|
|
3910
|
-
const createSecondEllipsisOrPage = showPageInsteadOfSecondEllipsis ? createPage : createSecondEllipsis;
|
|
3911
|
-
const secondEllipsis = createSecondEllipsisOrPage(secondEllipsisPageNumber);
|
|
3912
|
-
paginationModel.push(secondEllipsis);
|
|
3913
|
-
// Add group of last pages
|
|
3914
|
-
paginationModel.push(...lastPages);
|
|
3867
|
+
// Add first page
|
|
3868
|
+
paginationModel.push(createPage(1));
|
|
3869
|
+
// Calculate group of middle pages
|
|
3870
|
+
const middlePagesStart = Math.min(Math.max(activePage - pageRange, 2 + ellipsisSize), pageTotal - ellipsisSize - 2 * pageRange - (showLastPage ? 1 : 0));
|
|
3871
|
+
const middlePagesEnd = middlePagesStart + 2 * pageRange;
|
|
3872
|
+
const middlePages = createRange(middlePagesStart, middlePagesEnd).map(createPage);
|
|
3873
|
+
// Calculate and add ellipsis before group of middle pages
|
|
3874
|
+
const firstEllipsisPageNumber = middlePagesStart - 1;
|
|
3875
|
+
const showPageInsteadOfFirstEllipsis = firstEllipsisPageNumber === 2;
|
|
3876
|
+
const firstEllipsisOrPage = showPageInsteadOfFirstEllipsis ? createPage(firstEllipsisPageNumber) : ellipsisItem;
|
|
3877
|
+
paginationModel.push(firstEllipsisOrPage);
|
|
3878
|
+
// Add group of middle pages
|
|
3879
|
+
paginationModel.push(...middlePages);
|
|
3880
|
+
// Calculate and add ellipsis after group of middle pages
|
|
3881
|
+
const lastEllipsisPageNumber = middlePagesEnd + 1;
|
|
3882
|
+
const showPageInsteadOfLastEllipsis = lastEllipsisPageNumber === pageTotal - (showLastPage ? 1 : 0);
|
|
3883
|
+
const lastEllipsisOrPage = showPageInsteadOfLastEllipsis ? createPage(lastEllipsisPageNumber) : ellipsisItem;
|
|
3884
|
+
paginationModel.push(lastEllipsisOrPage);
|
|
3885
|
+
// Add last page
|
|
3886
|
+
if (showLastPage) {
|
|
3887
|
+
paginationModel.push(createPage(pageTotal));
|
|
3888
|
+
}
|
|
3915
3889
|
}
|
|
3916
3890
|
paginationModel.push(createNextPageLink(options));
|
|
3917
3891
|
return paginationModel;
|
|
3918
3892
|
};
|
|
3919
3893
|
const getCurrentActivePage = (activePage, totalPages) => {
|
|
3920
|
-
// exception tests
|
|
3921
|
-
if (activePage === undefined || totalPages === undefined) {
|
|
3922
|
-
throw new Error('getCurrentActivePage(): activePage and totalPages props must be provided');
|
|
3923
|
-
}
|
|
3924
3894
|
// Obviously we can't be on a negative or 0 page.
|
|
3925
3895
|
if (activePage < 1) {
|
|
3926
3896
|
activePage = 1;
|
|
@@ -3932,10 +3902,6 @@ const getCurrentActivePage = (activePage, totalPages) => {
|
|
|
3932
3902
|
return activePage;
|
|
3933
3903
|
};
|
|
3934
3904
|
const getTotalPages = (totalItemsCount, itemsPerPage) => {
|
|
3935
|
-
// exception test
|
|
3936
|
-
if (totalItemsCount === undefined || itemsPerPage === undefined) {
|
|
3937
|
-
throw new Error('getTotalPages(): totalItemsCount and itemsPerPage props must be provided');
|
|
3938
|
-
}
|
|
3939
3905
|
if (totalItemsCount < 1) {
|
|
3940
3906
|
totalItemsCount = 1;
|
|
3941
3907
|
}
|
|
@@ -4086,4 +4052,4 @@ const getTextTagType = (host, tag) => {
|
|
|
4086
4052
|
}
|
|
4087
4053
|
};
|
|
4088
4054
|
|
|
4089
|
-
export { DISPLAY_TAGS, HEADING_TAGS, HEADLINE_TAGS, TEXT_TAGS, _hasShowPickerSupport, attributeMutationMap, buildCrestSrcSet, buildIconUrl, buildSrcSet, cdnBaseUrl, childrenMutationMap, createPaginationModel, createRange, crestCdnBaseUrl, crestInnerManifest, crestSize, displaySizeToTagMap, getButtonAriaAttributes, getButtonAttributes, getButtonBaseAriaAttributes, getButtonPureAriaAttributes, getClosestHTMLElement, getContentAriaAttributes, getCurrentActivePage, getDirectChildHTMLElement, getDisplayTagType, getFilterInputAriaAttributes, getHTMLElement, getHeadingTagType, getHeadlineTagType, getHighlightedOptionMapIndex, getIconColor, getInlineNotificationIconName, getInnerManifest, getLinkButtonThemeForIcon, getRole, getSelectWrapperDropdownButtonAriaAttributes, getSelectedOptionMap, getStepperHorizontalIconName, getSvgUrl, getSwitchButtonAriaAttributes, getTextTagType, getThemeForIcon, getTotalPages, hasDocument, hasLocateAction, hasSpecificSlottedTag, hasVisibleIcon, hasWindow, isCustomDropdown, isDisabledOrLoading, isHighContrastMode, isListTypeOrdered, isScrollable, isSortable, isStateCompleteOrWarning, isThemeDark, isTouchDevice, isType, isUrl, isWithinForm,
|
|
4055
|
+
export { DISPLAY_TAGS, HEADING_TAGS, HEADLINE_TAGS, ItemType, TEXT_TAGS, _hasShowPickerSupport, attributeMutationMap, buildCrestSrcSet, buildIconUrl, buildSrcSet, cdnBaseUrl, childrenMutationMap, createPaginationModel, createRange, crestCdnBaseUrl, crestInnerManifest, crestSize, displaySizeToTagMap, getButtonAriaAttributes, getButtonAttributes, getButtonBaseAriaAttributes, getButtonPureAriaAttributes, getClosestHTMLElement, getContentAriaAttributes, getCurrentActivePage, getDirectChildHTMLElement, getDisplayTagType, getFilterInputAriaAttributes, getHTMLElement, getHeadingTagType, getHeadlineTagType, getHighlightedOptionMapIndex, getIconColor, getInlineNotificationIconName, getInnerManifest, getLinkButtonThemeForIcon, getRole, getSelectWrapperDropdownButtonAriaAttributes, getSelectedOptionMap, getStepperHorizontalIconName, getSvgUrl, getSwitchButtonAriaAttributes, getTextTagType, getThemeForIcon, getTotalPages, hasDocument, hasLocateAction, hasSpecificSlottedTag, hasVisibleIcon, hasWindow, isCustomDropdown, isDisabledOrLoading, isHighContrastMode, isInfinitePagination, isListTypeOrdered, isScrollable, isSortable, isStateCompleteOrWarning, isThemeDark, isTouchDevice, isType, isUrl, isWithinForm, modelSignatureHeight, parseAndGetAriaAttributes, parseJSONAttribute, resizeMap, showCustomCalendarOrTimeIndicator, supportsConstructableStylesheets, tempDiv, tempIcon, tempLabel };
|
package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/carousel.wrapper.js
CHANGED
|
@@ -4,15 +4,15 @@ import { useEventCallback, usePrefix, useBrowserLayoutEffect, useMergedClass } f
|
|
|
4
4
|
import { syncRef } from '../../utils.js';
|
|
5
5
|
import { DSRCarousel } from '../dsr-components/carousel.js';
|
|
6
6
|
|
|
7
|
-
const PCarousel = forwardRef(({ activeSlideIndex = 0, alignHeader = 'left', description, disablePagination, heading, intl, onCarouselChange, onUpdate, pagination = true, rewind = true, slidesPerPage = 1, theme = 'light', width = 'basic', wrapContent, className, children, ...rest }, ref) => {
|
|
7
|
+
const PCarousel = forwardRef(({ activeSlideIndex = 0, alignHeader = 'left', description, disablePagination, heading, intl, onCarouselChange, onUpdate, pagination = true, rewind = true, skipLinkTarget, slidesPerPage = 1, theme = 'light', width = 'basic', wrapContent, className, children, ...rest }, ref) => {
|
|
8
8
|
const elementRef = useRef();
|
|
9
9
|
useEventCallback(elementRef, 'carouselChange', onCarouselChange);
|
|
10
10
|
useEventCallback(elementRef, 'update', onUpdate);
|
|
11
11
|
const WebComponentTag = usePrefix('p-carousel');
|
|
12
|
-
const propsToSync = [activeSlideIndex, alignHeader, description, disablePagination, heading, intl, pagination, rewind, slidesPerPage, theme, width, wrapContent];
|
|
12
|
+
const propsToSync = [activeSlideIndex, alignHeader, description, disablePagination, heading, intl, pagination, rewind, skipLinkTarget, slidesPerPage, theme, width, wrapContent];
|
|
13
13
|
useBrowserLayoutEffect(() => {
|
|
14
14
|
const { current } = elementRef;
|
|
15
|
-
['activeSlideIndex', 'alignHeader', 'description', 'disablePagination', 'heading', 'intl', 'pagination', 'rewind', 'slidesPerPage', 'theme', 'width', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
15
|
+
['activeSlideIndex', 'alignHeader', 'description', 'disablePagination', 'heading', 'intl', 'pagination', 'rewind', 'skipLinkTarget', 'slidesPerPage', 'theme', 'width', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
16
16
|
}, propsToSync);
|
|
17
17
|
// @ts-ignore
|
|
18
18
|
if (!process.browser) {
|
|
@@ -23,7 +23,7 @@ const PCarousel = forwardRef(({ activeSlideIndex = 0, alignHeader = 'left', desc
|
|
|
23
23
|
// @ts-ignore
|
|
24
24
|
...(!process.browser
|
|
25
25
|
? {
|
|
26
|
-
children: (jsx(DSRCarousel, { ...{ activeSlideIndex, alignHeader, description, disablePagination, heading, intl, pagination, rewind, slidesPerPage, theme, width, wrapContent, children } })),
|
|
26
|
+
children: (jsx(DSRCarousel, { ...{ activeSlideIndex, alignHeader, description, disablePagination, heading, intl, pagination, rewind, skipLinkTarget, slidesPerPage, theme, width, wrapContent, children } })),
|
|
27
27
|
}
|
|
28
28
|
: {
|
|
29
29
|
children,
|
package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/pagination.wrapper.js
CHANGED
|
@@ -4,15 +4,15 @@ import { useEventCallback, usePrefix, useBrowserLayoutEffect, useMergedClass } f
|
|
|
4
4
|
import { syncRef } from '../../utils.js';
|
|
5
5
|
import { DSRPagination } from '../dsr-components/pagination.js';
|
|
6
6
|
|
|
7
|
-
const PPagination = forwardRef(({ activePage = 1, allyLabel, allyLabelNext, allyLabelPage, allyLabelPrev, intl = { root: 'Pagination', prev: 'Previous page', next: 'Next page', page: 'Page', }, itemsPerPage = 1, maxNumberOfPageLinks = { base: 5, xs: 7, }, onPageChange, onUpdate, theme = 'light', totalItemsCount = 1, className, ...rest }, ref) => {
|
|
7
|
+
const PPagination = forwardRef(({ activePage = 1, allyLabel, allyLabelNext, allyLabelPage, allyLabelPrev, intl = { root: 'Pagination', prev: 'Previous page', next: 'Next page', page: 'Page', }, itemsPerPage = 1, maxNumberOfPageLinks = { base: 5, xs: 7, }, onPageChange, onUpdate, showLastPage = true, theme = 'light', totalItemsCount = 1, className, ...rest }, ref) => {
|
|
8
8
|
const elementRef = useRef();
|
|
9
9
|
useEventCallback(elementRef, 'pageChange', onPageChange);
|
|
10
10
|
useEventCallback(elementRef, 'update', onUpdate);
|
|
11
11
|
const WebComponentTag = usePrefix('p-pagination');
|
|
12
|
-
const propsToSync = [activePage, allyLabel, allyLabelNext, allyLabelPage, allyLabelPrev, intl, itemsPerPage, maxNumberOfPageLinks, theme, totalItemsCount];
|
|
12
|
+
const propsToSync = [activePage, allyLabel, allyLabelNext, allyLabelPage, allyLabelPrev, intl, itemsPerPage, maxNumberOfPageLinks, showLastPage, theme, totalItemsCount];
|
|
13
13
|
useBrowserLayoutEffect(() => {
|
|
14
14
|
const { current } = elementRef;
|
|
15
|
-
['activePage', 'allyLabel', 'allyLabelNext', 'allyLabelPage', 'allyLabelPrev', 'intl', 'itemsPerPage', 'maxNumberOfPageLinks', 'theme', 'totalItemsCount'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
15
|
+
['activePage', 'allyLabel', 'allyLabelNext', 'allyLabelPage', 'allyLabelPrev', 'intl', 'itemsPerPage', 'maxNumberOfPageLinks', 'showLastPage', 'theme', 'totalItemsCount'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
16
16
|
}, propsToSync);
|
|
17
17
|
// @ts-ignore
|
|
18
18
|
if (!process.browser) {
|
|
@@ -23,7 +23,7 @@ const PPagination = forwardRef(({ activePage = 1, allyLabel, allyLabelNext, ally
|
|
|
23
23
|
// @ts-ignore
|
|
24
24
|
...(!process.browser
|
|
25
25
|
? {
|
|
26
|
-
children: (jsx(DSRPagination, { ...{ activePage, allyLabel, allyLabelNext, allyLabelPage, allyLabelPrev, intl, itemsPerPage, maxNumberOfPageLinks, theme, totalItemsCount } })),
|
|
26
|
+
children: (jsx(DSRPagination, { ...{ activePage, allyLabel, allyLabelNext, allyLabelPage, allyLabelPrev, intl, itemsPerPage, maxNumberOfPageLinks, showLastPage, theme, totalItemsCount } })),
|
|
27
27
|
}
|
|
28
28
|
: {
|
|
29
29
|
suppressHydrationWarning: true,
|
package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/carousel.js
CHANGED
|
@@ -23,7 +23,7 @@ import '../components/headline.wrapper.js';
|
|
|
23
23
|
import '../components/icon.wrapper.js';
|
|
24
24
|
import '../components/inline-notification.wrapper.js';
|
|
25
25
|
import '../components/link.wrapper.js';
|
|
26
|
-
import '../components/link-pure.wrapper.js';
|
|
26
|
+
import { PLinkPure } from '../components/link-pure.wrapper.js';
|
|
27
27
|
import '../components/link-social.wrapper.js';
|
|
28
28
|
import '../components/link-tile.wrapper.js';
|
|
29
29
|
import '../components/link-tile-model-signature.wrapper.js';
|
|
@@ -65,6 +65,7 @@ import { Component } from 'react';
|
|
|
65
65
|
import { minifyCss } from '../../minifyCss.js';
|
|
66
66
|
import { stripFocusAndHoverStyles } from '../../stripFocusAndHoverStyles.js';
|
|
67
67
|
import { getCarouselCss as getComponentCss$T } from '../../../../../../components/dist/styles/esm/styles-entry.js';
|
|
68
|
+
import { isInfinitePagination } from '../../../../../../components/dist/utils/esm/utils-entry.js';
|
|
68
69
|
|
|
69
70
|
class DSRCarousel extends Component {
|
|
70
71
|
constructor() {
|
|
@@ -87,9 +88,9 @@ class DSRCarousel extends Component {
|
|
|
87
88
|
? typeof this.props.disablePagination === 'object'
|
|
88
89
|
? Object.fromEntries(Object.entries(this.props.disablePagination).map(([key, value]) => [key, !value]))
|
|
89
90
|
: !this.props.disablePagination
|
|
90
|
-
: this.props.pagination, this.props.alignHeader, this.props.theme)));
|
|
91
|
-
return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs(Fragment, { children: [jsxs("div", { className: "header", children: [this.props.heading ? jsx("h2", { children: this.props.heading }) : jsx("slot", { name: "heading" }), (this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0) &&
|
|
92
|
-
((this.props.description && jsx("p", { children: this.props.description })) || jsx("slot", { name: "description" })), jsxs("div", { className: "nav", children: [jsx(PButtonPure, { ...btnProps, icon: "arrow-left" }), jsx(PButtonPure, { ...btnProps, icon: "arrow-right" })] })] }), jsx("div", { id: "splide", className: "splide", "aria-label": this.props.heading || ((_a = namedSlotChildren.find(({ props: { slot } }) => slot === 'heading')) === null || _a === void 0 ? void 0 : _a.props.children), children: jsx("div", { className: "splide__track", children: jsx("div", { className: "splide__list", children: otherChildren.map((_, i) => (jsx("div", { className: "splide__slide", children: jsx("slot", { name: `slide-${i}` }) }, i))) }) }) }), (this.props.disablePagination ? this.props.disablePagination !== true : this.props.pagination) && (jsx("div", { className: "pagination" }))] })] }), this.props.children] }));
|
|
91
|
+
: this.props.pagination, isInfinitePagination(this.props.amountOfPages), this.props.alignHeader, this.props.theme)));
|
|
92
|
+
return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs(Fragment, { children: [jsxs("div", { className: "header", children: [this.props.heading ? jsx("h2", { id: "heading", children: this.props.heading }) : jsx("slot", { name: "heading" }), (this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0) &&
|
|
93
|
+
((this.props.description && jsx("p", { children: this.props.description })) || jsx("slot", { name: "description" })), jsxs("div", { className: "nav", children: [this.props.skipLinkTarget && (jsx(PLinkPure, { href: this.props.skipLinkTarget, theme: this.props.theme, icon: "arrow-last", className: "btn skip-link", alignLabel: "left", hideLabel: true, "aria-describedby": this.props.heading ? 'heading' : null, children: "Skip carousel entries" })), jsx(PButtonPure, { ...btnProps, icon: "arrow-left" }), jsx(PButtonPure, { ...btnProps, icon: "arrow-right" })] })] }), jsx("div", { id: "splide", className: "splide", "aria-label": this.props.heading || ((_a = namedSlotChildren.find(({ props: { slot } }) => slot === 'heading')) === null || _a === void 0 ? void 0 : _a.props.children), children: jsx("div", { className: "splide__track", children: jsx("div", { className: "splide__list", children: otherChildren.map((_, i) => (jsx("div", { className: "splide__slide", tabIndex: 0, children: jsx("slot", { name: `slide-${i}` }) }, i))) }) }) }), (this.props.disablePagination ? this.props.disablePagination !== true : this.props.pagination) && (jsx("div", { className: "pagination-container", children: jsx("div", { className: "pagination" }) }))] })] }), this.props.children] }));
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
|
package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/pagination.js
CHANGED
|
@@ -64,7 +64,7 @@ import { Component } from 'react';
|
|
|
64
64
|
import { minifyCss } from '../../minifyCss.js';
|
|
65
65
|
import { stripFocusAndHoverStyles } from '../../stripFocusAndHoverStyles.js';
|
|
66
66
|
import { getPaginationCss as getComponentCss$v } from '../../../../../../components/dist/styles/esm/styles-entry.js';
|
|
67
|
-
import { getTotalPages, createPaginationModel, getCurrentActivePage,
|
|
67
|
+
import { getTotalPages, createPaginationModel, getCurrentActivePage, ItemType } from '../../../../../../components/dist/utils/esm/utils-entry.js';
|
|
68
68
|
|
|
69
69
|
class DSRPagination extends Component {
|
|
70
70
|
constructor() {
|
|
@@ -77,6 +77,7 @@ class DSRPagination extends Component {
|
|
|
77
77
|
activePage: getCurrentActivePage(this.props.activePage, pageTotal),
|
|
78
78
|
pageTotal,
|
|
79
79
|
pageRange: this.props.breakpointMaxNumberOfPageLinks === 7 ? 1 : 0,
|
|
80
|
+
showLastPage: this.props.showLastPage,
|
|
80
81
|
});
|
|
81
82
|
const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$v(this.props.maxNumberOfPageLinks, this.props.theme)));
|
|
82
83
|
return (jsx(Fragment, { children: jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx("nav", { role: "navigation", "aria-label": this.props.allyLabel || this.props.intl.root, children: jsx("ul", { children: paginationModel.map((pageModel) => {
|
|
@@ -91,14 +92,14 @@ class DSRPagination extends Component {
|
|
|
91
92
|
'aria-hidden': 'true',
|
|
92
93
|
};
|
|
93
94
|
switch (type) {
|
|
94
|
-
case
|
|
95
|
-
return (jsx("li", { children: jsx("span", { ...spanProps, "aria-
|
|
96
|
-
case
|
|
95
|
+
case ItemType.PREVIOUS:
|
|
96
|
+
return (jsx("li", { children: jsx("span", { ...spanProps, "aria-label": this.props.allyLabelPrev || this.props.intl.prev, "aria-disabled": isActive ? null : 'true', children: jsx(PIcon, { name: "arrow-left", ...iconProps }) }) }, "prev"));
|
|
97
|
+
case ItemType.ELLIPSIS:
|
|
97
98
|
return (jsx("li", { children: jsx("span", { className: "ellipsis" }) }, "ellipsis"));
|
|
98
|
-
case
|
|
99
|
+
case ItemType.PAGE:
|
|
99
100
|
return (jsx("li", { children: jsx("span", { ...spanProps, tabIndex: 0, "aria-label": `${this.props.allyLabelPage || this.props.intl.page} ${value}`, "aria-current": isActive ? 'page' : null, children: value }) }, value));
|
|
100
|
-
case
|
|
101
|
-
return (jsx("li", { children: jsx("span", { ...spanProps, "aria-
|
|
101
|
+
case ItemType.NEXT:
|
|
102
|
+
return (jsx("li", { children: jsx("span", { ...spanProps, "aria-label": this.props.allyLabelNext || this.props.intl.next, "aria-disabled": isActive ? null : 'true', children: jsx(PIcon, { name: "arrow-right", ...iconProps }) }) }, "next"));
|
|
102
103
|
}
|
|
103
104
|
}) }) })] }) }));
|
|
104
105
|
}
|
|
@@ -41,6 +41,10 @@ export type PCarouselProps = Omit<HTMLAttributes<{}>, 'color'> & {
|
|
|
41
41
|
* Whether the slides should rewind from last to first slide and vice versa.
|
|
42
42
|
*/
|
|
43
43
|
rewind?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Defines target of skip link (to skip carousel entries).
|
|
46
|
+
*/
|
|
47
|
+
skipLinkTarget?: string;
|
|
44
48
|
/**
|
|
45
49
|
* Sets the amount of slides visible at the same time. Can be set to `auto` if you want to define different widths per slide via CSS.
|
|
46
50
|
*/
|
|
@@ -100,6 +104,10 @@ export declare const PCarousel: import("react").ForwardRefExoticComponent<Omit<H
|
|
|
100
104
|
* Whether the slides should rewind from last to first slide and vice versa.
|
|
101
105
|
*/
|
|
102
106
|
rewind?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Defines target of skip link (to skip carousel entries).
|
|
109
|
+
*/
|
|
110
|
+
skipLinkTarget?: string;
|
|
103
111
|
/**
|
|
104
112
|
* Sets the amount of slides visible at the same time. Can be set to `auto` if you want to define different widths per slide via CSS.
|
|
105
113
|
*/
|
|
@@ -30,7 +30,7 @@ export type PPaginationProps = Omit<HTMLAttributes<{}>, 'color'> & {
|
|
|
30
30
|
*/
|
|
31
31
|
itemsPerPage?: number;
|
|
32
32
|
/**
|
|
33
|
-
* The maximum number of page links rendered
|
|
33
|
+
* The maximum number of page links rendered.
|
|
34
34
|
*/
|
|
35
35
|
maxNumberOfPageLinks?: BreakpointCustomizable<PaginationMaxNumberOfPageLinks>;
|
|
36
36
|
/**
|
|
@@ -41,6 +41,10 @@ export type PPaginationProps = Omit<HTMLAttributes<{}>, 'color'> & {
|
|
|
41
41
|
* Emitted when the page changes.
|
|
42
42
|
*/
|
|
43
43
|
onUpdate?: (event: CustomEvent<PaginationUpdateEvent>) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Show or hide the button to jump to the last page.
|
|
46
|
+
*/
|
|
47
|
+
showLastPage?: boolean;
|
|
44
48
|
/**
|
|
45
49
|
* Adapts the color when used on dark background.
|
|
46
50
|
*/
|
|
@@ -80,7 +84,7 @@ export declare const PPagination: import("react").ForwardRefExoticComponent<Omit
|
|
|
80
84
|
*/
|
|
81
85
|
itemsPerPage?: number;
|
|
82
86
|
/**
|
|
83
|
-
* The maximum number of page links rendered
|
|
87
|
+
* The maximum number of page links rendered.
|
|
84
88
|
*/
|
|
85
89
|
maxNumberOfPageLinks?: BreakpointCustomizable<PaginationMaxNumberOfPageLinks>;
|
|
86
90
|
/**
|
|
@@ -91,6 +95,10 @@ export declare const PPagination: import("react").ForwardRefExoticComponent<Omit
|
|
|
91
95
|
* Emitted when the page changes.
|
|
92
96
|
*/
|
|
93
97
|
onUpdate?: (event: CustomEvent<PaginationUpdateEvent>) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Show or hide the button to jump to the last page.
|
|
100
|
+
*/
|
|
101
|
+
showLastPage?: boolean;
|
|
94
102
|
/**
|
|
95
103
|
* Adapts the color when used on dark background.
|
|
96
104
|
*/
|