@porsche-design-system/components-react 2.18.0-rc.0 → 2.18.0-rc.1

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.
@@ -21,6 +21,10 @@ export declare type PCarouselProps = Omit<HTMLAttributes<{}>, 'color'> & {
21
21
  * Emitted when carousel's content slides.
22
22
  */
23
23
  onCarouselChange?: (event: CustomEvent<CarouselChangeEvent>) => void;
24
+ /**
25
+ * Whether the slides should rewind from last to first slide and vice versa.
26
+ */
27
+ rewind?: boolean;
24
28
  /**
25
29
  * Sets the amount of slides visible at the same time.
26
30
  */
@@ -55,6 +59,10 @@ export declare const PCarousel: import("react").ForwardRefExoticComponent<Omit<H
55
59
  * Emitted when carousel's content slides.
56
60
  */
57
61
  onCarouselChange?: (event: CustomEvent<CarouselChangeEvent>) => void;
62
+ /**
63
+ * Whether the slides should rewind from last to first slide and vice versa.
64
+ */
65
+ rewind?: boolean;
58
66
  /**
59
67
  * Sets the amount of slides visible at the same time.
60
68
  */
@@ -7,14 +7,14 @@ var react = require('react');
7
7
  var hooks = require('../../hooks.js');
8
8
  var utils = require('../../utils.js');
9
9
 
10
- const PCarousel = /*#__PURE__*/ react.forwardRef(({ description, disablePagination = false, heading, intl = {}, onCarouselChange, slidesPerPage = 1, theme = 'light', wrapContent, className, ...rest }, ref) => {
10
+ const PCarousel = /*#__PURE__*/ react.forwardRef(({ description, disablePagination = false, heading, intl = {}, onCarouselChange, rewind = true, slidesPerPage = 1, theme = 'light', wrapContent, className, ...rest }, ref) => {
11
11
  const elementRef = react.useRef();
12
12
  hooks.useEventCallback(elementRef, 'carouselChange', onCarouselChange);
13
13
  const WebComponentTag = hooks.usePrefix('p-carousel');
14
- const propsToSync = [description, disablePagination, heading, intl, slidesPerPage, theme, wrapContent];
14
+ const propsToSync = [description, disablePagination, heading, intl, rewind, slidesPerPage, theme, wrapContent];
15
15
  hooks.useBrowserLayoutEffect(() => {
16
16
  const { current } = elementRef;
17
- ['description', 'disablePagination', 'heading', 'intl', 'slidesPerPage', 'theme', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
17
+ ['description', 'disablePagination', 'heading', 'intl', 'rewind', 'slidesPerPage', 'theme', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
18
18
  }, propsToSync);
19
19
  const props = {
20
20
  ...rest,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@porsche-design-system/components-react",
3
- "version": "2.18.0-rc.0",
3
+ "version": "2.18.0-rc.1",
4
4
  "description": "Porsche Design System is a component library designed to help developers create the best experience for software or services distributed by Dr. Ing. h.c. F. Porsche AG.",
5
5
  "keywords": [
6
6
  "porsche",
@@ -17,7 +17,7 @@
17
17
  "license": "SEE LICENSE IN LICENSE",
18
18
  "homepage": "https://designsystem.porsche.com",
19
19
  "dependencies": {
20
- "@porsche-design-system/components-js": "2.18.0-rc.0"
20
+ "@porsche-design-system/components-js": "2.18.0-rc.1"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": ">=17.0.0 <19.0.0",
@@ -6173,9 +6173,8 @@ const getComponentCss$M = (wrapContent, disablePagination, theme) => {
6173
6173
  gap: pxToRemWithUnit(32),
6174
6174
  },
6175
6175
  }),
6176
- 'h2,::slotted([slot=heading])': addImportantToEachRule(Object.assign(Object.assign({}, headingMedium), { margin: 0, color: baseColor })),
6177
- // NOTE: might come back in later version '::slotted([slot=post-heading])'
6178
- p: Object.assign(Object.assign({}, textSmall), { margin: 0, color: baseColor, gridColumn: 1 }),
6176
+ 'h2,::slotted([slot=heading])': addImportantToEachRule(Object.assign(Object.assign({}, headingMedium), { margin: 0, color: baseColor, maxWidth: pxToRemWithUnit(900) })),
6177
+ 'p,::slotted([slot=description])': addImportantToEachRule(Object.assign(Object.assign({}, textSmall), { margin: 0, color: baseColor, maxWidth: pxToRemWithUnit(550), gridColumn: 1 })),
6179
6178
  }, splide: {
6180
6179
  overflow: 'hidden',
6181
6180
  // visibility: 'hidden',
@@ -8,14 +8,14 @@ var hooks = require('../../hooks.js');
8
8
  var utils = require('../../utils.js');
9
9
  var carousel = require('../dsr-components/carousel.js');
10
10
 
11
- const PCarousel = /*#__PURE__*/ react.forwardRef(({ description, disablePagination = false, heading, intl = {}, onCarouselChange, slidesPerPage = 1, theme = 'light', wrapContent, className, children, ...rest }, ref) => {
11
+ const PCarousel = /*#__PURE__*/ react.forwardRef(({ description, disablePagination = false, heading, intl = {}, onCarouselChange, rewind = true, slidesPerPage = 1, theme = 'light', wrapContent, className, children, ...rest }, ref) => {
12
12
  const elementRef = react.useRef();
13
13
  hooks.useEventCallback(elementRef, 'carouselChange', onCarouselChange);
14
14
  const WebComponentTag = hooks.usePrefix('p-carousel');
15
- const propsToSync = [description, disablePagination, heading, intl, slidesPerPage, theme, wrapContent];
15
+ const propsToSync = [description, disablePagination, heading, intl, rewind, slidesPerPage, theme, wrapContent];
16
16
  hooks.useBrowserLayoutEffect(() => {
17
17
  const { current } = elementRef;
18
- ['description', 'disablePagination', 'heading', 'intl', 'slidesPerPage', 'theme', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
18
+ ['description', 'disablePagination', 'heading', 'intl', 'rewind', 'slidesPerPage', 'theme', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
19
19
  }, propsToSync);
20
20
  // @ts-ignore
21
21
  if (!process.browser) {
@@ -26,7 +26,7 @@ const PCarousel = /*#__PURE__*/ react.forwardRef(({ description, disablePaginati
26
26
  // @ts-ignore
27
27
  ...(!process.browser
28
28
  ? {
29
- children: (jsxRuntime.jsx(carousel.DSRCarousel, { ...{ description, disablePagination, heading, intl, slidesPerPage, theme, wrapContent, children } })),
29
+ children: (jsxRuntime.jsx(carousel.DSRCarousel, { ...{ description, disablePagination, heading, intl, rewind, slidesPerPage, theme, wrapContent, children } })),
30
30
  }
31
31
  : {
32
32
  children,
@@ -32,7 +32,8 @@ class DSRCarousel extends react.Component {
32
32
  // 'aria-controls': 'splide-track', // TODO: cross shadow dom? use native button tag instead of p-button-pure?
33
33
  };
34
34
  const style = minifyCss.minifyCss(stripFocusAndHoverStyles.stripFocusAndHoverStyles(stylesEntry.getCarouselCss(this.props.wrapContent, this.props.disablePagination, this.props.theme)));
35
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "header", children: [this.props.heading ? jsxRuntime.jsx("h2", { children: this.props.heading }) : jsxRuntime.jsx("slot", { name: "heading" }), this.props.description && jsxRuntime.jsx("p", { children: this.props.description }), jsxRuntime.jsxs("div", { className: "nav", children: [jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { ...btnProps, icon: "arrow-head-left" }), jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { ...btnProps, icon: "arrow-head-right" })] })] }), jsxRuntime.jsx("div", { id: "splide", className: "splide", "aria-label": this.props.heading || ((_a = namedSlottedChildren.find(({ props: { slot } }) => slot === 'heading')) === null || _a === void 0 ? void 0 : _a.props.children), children: jsxRuntime.jsx("div", { className: "splide__track", children: jsxRuntime.jsx("div", { className: "splide__list", children: defaultChildren.map((_, i) => (jsxRuntime.jsx("div", { className: "splide__slide", children: jsxRuntime.jsx("slot", { name: `slide-${i}` }) }, i))) }) }) }), this.props.disablePagination !== true && jsxRuntime.jsx("div", { className: "pagination" })] })] }), this.props.children] }));
35
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "header", children: [this.props.heading ? jsxRuntime.jsx("h2", { children: this.props.heading }) : jsxRuntime.jsx("slot", { name: "heading" }), (this.props.description || namedSlottedChildren.filter(({ props: { slot } }) => slot === 'description').length > 0) &&
36
+ ((this.props.description && jsxRuntime.jsx("p", { children: this.props.description })) || jsxRuntime.jsx("slot", { name: "description" })), jsxRuntime.jsxs("div", { className: "nav", children: [jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { ...btnProps, icon: "arrow-left" }), jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { ...btnProps, icon: "arrow-right" })] })] }), jsxRuntime.jsx("div", { id: "splide", className: "splide", "aria-label": this.props.heading || ((_a = namedSlottedChildren.find(({ props: { slot } }) => slot === 'heading')) === null || _a === void 0 ? void 0 : _a.props.children), children: jsxRuntime.jsx("div", { className: "splide__track", children: jsxRuntime.jsx("div", { className: "splide__list", children: defaultChildren.map((_, i) => (jsxRuntime.jsx("div", { className: "splide__slide", children: jsxRuntime.jsx("slot", { name: `slide-${i}` }) }, i))) }) }) }), this.props.disablePagination !== true && jsxRuntime.jsx("div", { className: "pagination" })] })] }), this.props.children] }));
36
37
  }
37
38
  }
38
39
 
@@ -6169,9 +6169,8 @@ const getComponentCss$M = (wrapContent, disablePagination, theme) => {
6169
6169
  gap: pxToRemWithUnit(32),
6170
6170
  },
6171
6171
  }),
6172
- 'h2,::slotted([slot=heading])': addImportantToEachRule(Object.assign(Object.assign({}, headingMedium), { margin: 0, color: baseColor })),
6173
- // NOTE: might come back in later version '::slotted([slot=post-heading])'
6174
- p: Object.assign(Object.assign({}, textSmall), { margin: 0, color: baseColor, gridColumn: 1 }),
6172
+ 'h2,::slotted([slot=heading])': addImportantToEachRule(Object.assign(Object.assign({}, headingMedium), { margin: 0, color: baseColor, maxWidth: pxToRemWithUnit(900) })),
6173
+ 'p,::slotted([slot=description])': addImportantToEachRule(Object.assign(Object.assign({}, textSmall), { margin: 0, color: baseColor, maxWidth: pxToRemWithUnit(550), gridColumn: 1 })),
6175
6174
  }, splide: {
6176
6175
  overflow: 'hidden',
6177
6176
  // visibility: 'hidden',
@@ -4,14 +4,14 @@ 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 = /*#__PURE__*/ forwardRef(({ description, disablePagination = false, heading, intl = {}, onCarouselChange, slidesPerPage = 1, theme = 'light', wrapContent, className, children, ...rest }, ref) => {
7
+ const PCarousel = /*#__PURE__*/ forwardRef(({ description, disablePagination = false, heading, intl = {}, onCarouselChange, rewind = true, slidesPerPage = 1, theme = 'light', wrapContent, className, children, ...rest }, ref) => {
8
8
  const elementRef = useRef();
9
9
  useEventCallback(elementRef, 'carouselChange', onCarouselChange);
10
10
  const WebComponentTag = usePrefix('p-carousel');
11
- const propsToSync = [description, disablePagination, heading, intl, slidesPerPage, theme, wrapContent];
11
+ const propsToSync = [description, disablePagination, heading, intl, rewind, slidesPerPage, theme, wrapContent];
12
12
  useBrowserLayoutEffect(() => {
13
13
  const { current } = elementRef;
14
- ['description', 'disablePagination', 'heading', 'intl', 'slidesPerPage', 'theme', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
14
+ ['description', 'disablePagination', 'heading', 'intl', 'rewind', 'slidesPerPage', 'theme', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
15
15
  }, propsToSync);
16
16
  // @ts-ignore
17
17
  if (!process.browser) {
@@ -22,7 +22,7 @@ const PCarousel = /*#__PURE__*/ forwardRef(({ description, disablePagination = f
22
22
  // @ts-ignore
23
23
  ...(!process.browser
24
24
  ? {
25
- children: (jsx(DSRCarousel, { ...{ description, disablePagination, heading, intl, slidesPerPage, theme, wrapContent, children } })),
25
+ children: (jsx(DSRCarousel, { ...{ description, disablePagination, heading, intl, rewind, slidesPerPage, theme, wrapContent, children } })),
26
26
  }
27
27
  : {
28
28
  children,
@@ -28,7 +28,8 @@ class DSRCarousel extends Component {
28
28
  // 'aria-controls': 'splide-track', // TODO: cross shadow dom? use native button tag instead of p-button-pure?
29
29
  };
30
30
  const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$M(this.props.wrapContent, this.props.disablePagination, this.props.theme)));
31
- return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "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 && jsx("p", { children: this.props.description }), jsxs("div", { className: "nav", children: [jsx(PButtonPure, { ...btnProps, icon: "arrow-head-left" }), jsx(PButtonPure, { ...btnProps, icon: "arrow-head-right" })] })] }), jsx("div", { id: "splide", className: "splide", "aria-label": this.props.heading || ((_a = namedSlottedChildren.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: defaultChildren.map((_, i) => (jsx("div", { className: "splide__slide", children: jsx("slot", { name: `slide-${i}` }) }, i))) }) }) }), this.props.disablePagination !== true && jsx("div", { className: "pagination" })] })] }), this.props.children] }));
31
+ return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "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 || namedSlottedChildren.filter(({ props: { slot } }) => slot === 'description').length > 0) &&
32
+ ((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 = namedSlottedChildren.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: defaultChildren.map((_, i) => (jsx("div", { className: "splide__slide", children: jsx("slot", { name: `slide-${i}` }) }, i))) }) }) }), this.props.disablePagination !== true && jsx("div", { className: "pagination" })] })] }), this.props.children] }));
32
33
  }
33
34
  }
34
35
 
@@ -21,6 +21,10 @@ export declare type PCarouselProps = Omit<HTMLAttributes<{}>, 'color'> & {
21
21
  * Emitted when carousel's content slides.
22
22
  */
23
23
  onCarouselChange?: (event: CustomEvent<CarouselChangeEvent>) => void;
24
+ /**
25
+ * Whether the slides should rewind from last to first slide and vice versa.
26
+ */
27
+ rewind?: boolean;
24
28
  /**
25
29
  * Sets the amount of slides visible at the same time.
26
30
  */
@@ -55,6 +59,10 @@ export declare const PCarousel: import("react").ForwardRefExoticComponent<Omit<H
55
59
  * Emitted when carousel's content slides.
56
60
  */
57
61
  onCarouselChange?: (event: CustomEvent<CarouselChangeEvent>) => void;
62
+ /**
63
+ * Whether the slides should rewind from last to first slide and vice versa.
64
+ */
65
+ rewind?: boolean;
58
66
  /**
59
67
  * Sets the amount of slides visible at the same time.
60
68
  */