@porsche-design-system/components-react 2.15.0 → 2.16.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.
@@ -0,0 +1,72 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import type { BreakpointCustomizable, CarouselInternationalization, CarouselChangeEvent, Theme } from '../types';
3
+ export declare type PCarouselProps = HTMLAttributes<{}> & {
4
+ /**
5
+ * Defines the description used in the carousel.
6
+ */
7
+ description?: string;
8
+ /**
9
+ * If true, the carousel will not show pagination bullets at the bottom.
10
+ */
11
+ disablePagination?: BreakpointCustomizable<boolean>;
12
+ /**
13
+ * Defines the heading used in the carousel.
14
+ */
15
+ heading?: string;
16
+ /**
17
+ * Override the default wordings that are used for aria-labels on the next/prev buttons and pagination.
18
+ */
19
+ intl?: CarouselInternationalization;
20
+ /**
21
+ * Emitted when carousel's content slides.
22
+ */
23
+ onCarouselChange?: (event: CustomEvent<CarouselChangeEvent>) => void;
24
+ /**
25
+ * Sets the amount of slides visible at the same time.
26
+ */
27
+ slidesPerPage?: BreakpointCustomizable<number>;
28
+ /**
29
+ * Adapts the color when used on dark background.
30
+ */
31
+ theme?: Theme;
32
+ /**
33
+ * Whether the content should receive a padding to the sides to be aligned on the grid when used full width and not within content-wrapper.
34
+ */
35
+ wrapContent?: boolean;
36
+ };
37
+ export declare const PCarousel: import("react").ForwardRefExoticComponent<HTMLAttributes<{}> & {
38
+ /**
39
+ * Defines the description used in the carousel.
40
+ */
41
+ description?: string;
42
+ /**
43
+ * If true, the carousel will not show pagination bullets at the bottom.
44
+ */
45
+ disablePagination?: BreakpointCustomizable<boolean>;
46
+ /**
47
+ * Defines the heading used in the carousel.
48
+ */
49
+ heading?: string;
50
+ /**
51
+ * Override the default wordings that are used for aria-labels on the next/prev buttons and pagination.
52
+ */
53
+ intl?: CarouselInternationalization;
54
+ /**
55
+ * Emitted when carousel's content slides.
56
+ */
57
+ onCarouselChange?: (event: CustomEvent<CarouselChangeEvent>) => void;
58
+ /**
59
+ * Sets the amount of slides visible at the same time.
60
+ */
61
+ slidesPerPage?: BreakpointCustomizable<number>;
62
+ /**
63
+ * Adapts the color when used on dark background.
64
+ */
65
+ theme?: Theme;
66
+ /**
67
+ * Whether the content should receive a padding to the sides to be aligned on the grid when used full width and not within content-wrapper.
68
+ */
69
+ wrapContent?: boolean;
70
+ } & {
71
+ children?: import("react").ReactNode;
72
+ } & import("react").RefAttributes<HTMLElement>>;
@@ -3,6 +3,7 @@ export * from './banner.wrapper';
3
3
  export * from './button.wrapper';
4
4
  export * from './button-group.wrapper';
5
5
  export * from './button-pure.wrapper';
6
+ export * from './carousel.wrapper';
6
7
  export * from './checkbox-wrapper.wrapper';
7
8
  export * from './content-wrapper.wrapper';
8
9
  export * from './divider.wrapper';
@@ -22,6 +23,7 @@ export * from './modal.wrapper';
22
23
  export * from './pagination.wrapper';
23
24
  export * from './popover.wrapper';
24
25
  export * from './radio-button-wrapper.wrapper';
26
+ export * from './scroller.wrapper';
25
27
  export * from './segmented-control.wrapper';
26
28
  export * from './segmented-control-item.wrapper';
27
29
  export * from './select-wrapper.wrapper';
@@ -0,0 +1,40 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import type { GradientColorTheme, ScrollIndicatorPosition, ScrollToPosition, ThemeExtendedElectric } from '../types';
3
+ export declare type PScrollerProps = HTMLAttributes<{}> & {
4
+ /**
5
+ * Adapts the background gradient color of prev and next button.
6
+ */
7
+ gradientColorScheme?: GradientColorTheme;
8
+ /**
9
+ * Sets the vertical position of scroll indicator icon
10
+ */
11
+ scrollIndicatorPosition?: ScrollIndicatorPosition;
12
+ /**
13
+ * Scrolls the scroll area to the left either smooth or immediately
14
+ */
15
+ scrollToPosition?: ScrollToPosition;
16
+ /**
17
+ * Adapts the color when used on dark background.
18
+ */
19
+ theme?: ThemeExtendedElectric;
20
+ };
21
+ export declare const PScroller: import("react").ForwardRefExoticComponent<HTMLAttributes<{}> & {
22
+ /**
23
+ * Adapts the background gradient color of prev and next button.
24
+ */
25
+ gradientColorScheme?: GradientColorTheme;
26
+ /**
27
+ * Sets the vertical position of scroll indicator icon
28
+ */
29
+ scrollIndicatorPosition?: ScrollIndicatorPosition;
30
+ /**
31
+ * Scrolls the scroll area to the left either smooth or immediately
32
+ */
33
+ scrollToPosition?: ScrollToPosition;
34
+ /**
35
+ * Adapts the color when used on dark background.
36
+ */
37
+ theme?: ThemeExtendedElectric;
38
+ } & {
39
+ children?: import("react").ReactNode;
40
+ } & import("react").RefAttributes<HTMLElement>>;
@@ -1,10 +1,14 @@
1
1
  import { HTMLAttributes } from 'react';
2
- import type { StepChangeEvent, Theme } from '../types';
2
+ import type { StepChangeEvent, BreakpointCustomizable, StepperHorizontalSize, Theme } from '../types';
3
3
  export declare type PStepperHorizontalProps = HTMLAttributes<{}> & {
4
4
  /**
5
5
  * Emitted when active step is changed.
6
6
  */
7
7
  onStepChange?: (event: CustomEvent<StepChangeEvent>) => void;
8
+ /**
9
+ * The text size.
10
+ */
11
+ size?: BreakpointCustomizable<StepperHorizontalSize>;
8
12
  /**
9
13
  * Adapts the tag color depending on the theme.
10
14
  */
@@ -15,6 +19,10 @@ export declare const PStepperHorizontal: import("react").ForwardRefExoticCompone
15
19
  * Emitted when active step is changed.
16
20
  */
17
21
  onStepChange?: (event: CustomEvent<StepChangeEvent>) => void;
22
+ /**
23
+ * The text size.
24
+ */
25
+ size?: BreakpointCustomizable<StepperHorizontalSize>;
18
26
  /**
19
27
  * Adapts the tag color depending on the theme.
20
28
  */
package/lib/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Options } from '@splidejs/splide';
1
2
  export declare type IconName = "360" | "accessibility" | "active-cabin-ventilation" | "add" | "adjust" | "arrow-double-down" | "arrow-double-left" | "arrow-double-right" | "arrow-double-up" | "arrow-down" | "arrow-first" | "arrow-head-down" | "arrow-head-left" | "arrow-head-right" | "arrow-head-up" | "arrow-last" | "arrow-left" | "arrow-right" | "arrow-up" | "augmented-reality" | "battery-empty" | "battery-full" | "bell" | "bookmark" | "broadcast" | "calculator" | "calendar" | "camera" | "car" | "car-battery" | "card" | "charging-active" | "charging-state" | "charging-station" | "chart" | "chat" | "check" | "city" | "climate" | "climate-control" | "clock" | "close" | "closed-caption" | "co2-emission" | "compare" | "configurate" | "country-road" | "cubic-capacity" | "delete" | "disable" | "document" | "download" | "duration" | "edit" | "email" | "exclamation" | "external" | "filter" | "flash" | "fuel-station" | "garage" | "gift" | "globe" | "grid" | "highway" | "home" | "horn" | "image" | "increase" | "information" | "key" | "leaf" | "leather" | "light" | "list" | "locate" | "lock" | "lock-open" | "logo-baidu" | "logo-delicious" | "logo-digg" | "logo-facebook" | "logo-foursquare" | "logo-gmail" | "logo-google" | "logo-hatena" | "logo-instagram" | "logo-kaixin" | "logo-kakaotalk" | "logo-linkedin" | "logo-naver" | "logo-pinterest" | "logo-qq" | "logo-qq-share" | "logo-reddit" | "logo-skyrock" | "logo-sohu" | "logo-tecent" | "logo-telegram" | "logo-tiktok" | "logo-tumblr" | "logo-twitter" | "logo-viber" | "logo-vk" | "logo-wechat" | "logo-weibo" | "logo-whatsapp" | "logo-xing" | "logo-yahoo" | "logo-youku" | "logo-youtube" | "logout" | "map" | "menu-dots-horizontal" | "menu-dots-vertical" | "menu-lines" | "minus" | "mobile" | "moon" | "oil-can" | "parking-brake" | "parking-light" | "pause" | "phone" | "pin" | "play" | "plug" | "plus" | "preheating" | "printer" | "purchase" | "question" | "racing-flag" | "refresh" | "replay" | "reset" | "route" | "rss" | "save" | "screen" | "search" | "send" | "share" | "shopping-bag" | "shopping-cart" | "sidelights" | "snowflake" | "sort" | "stack" | "star" | "steering-wheel" | "stopwatch" | "subtract" | "success" | "sun" | "switch" | "tablet" | "tachometer" | "truck" | "upload" | "user" | "user-group" | "user-manual" | "video" | "view" | "view-off" | "volume-off" | "volume-up" | "warning" | "weight" | "wifi" | "work" | "wrench" | "wrenches" | "zoom-in" | "zoom-out";
2
3
  declare const FORM_STATES: readonly [
3
4
  "none",
@@ -35,8 +36,12 @@ export declare type GradientColorTheme = typeof GRADIENT_COLOR_THEMES[number];
35
36
  export declare type ScrollToPosition = {
36
37
  scrollPosition: number;
37
38
  isSmooth?: boolean;
38
- };
39
- export declare type PrevNextButtonJssStyle = any;
39
+ } | string;
40
+ declare const SCROLL_INDICATOR_POSITIONS: readonly [
41
+ "top",
42
+ "center"
43
+ ];
44
+ export declare type ScrollIndicatorPosition = typeof SCROLL_INDICATOR_POSITIONS[number];
40
45
  declare const THEMES: readonly [
41
46
  "light",
42
47
  "dark"
@@ -359,6 +364,11 @@ declare const BUTTON_GROUP_DIRECTIONS: readonly [
359
364
  ];
360
365
  export declare type ButtonGroupDirectionType = typeof BUTTON_GROUP_DIRECTIONS[number];
361
366
  export declare type ButtonGroupDirection = BreakpointCustomizable<ButtonGroupDirectionType>;
367
+ export declare type CarouselInternationalization = Partial<Pick<Options["i18n"], "prev" | "next" | "first" | "last" | "slideLabel" | "slide">>;
368
+ export declare type CarouselChangeEvent = {
369
+ activeIndex: number;
370
+ previousIndex: number;
371
+ };
362
372
  declare const CONTENT_WRAPPER_BACKGROUND_COLORS: readonly [
363
373
  "transparent",
364
374
  "default"
@@ -610,6 +620,11 @@ declare const SPINNER_ARIA_ATTRIBUTES: readonly [
610
620
  "aria-label"
611
621
  ];
612
622
  export declare type SpinnerAriaAttributes = typeof SPINNER_ARIA_ATTRIBUTES[number];
623
+ declare const STEPPER_HORIZONTAL_SIZES: readonly [
624
+ "small",
625
+ "medium"
626
+ ];
627
+ export declare type StepperHorizontalSize = typeof STEPPER_HORIZONTAL_SIZES[number];
613
628
  export declare type StepChangeEvent = {
614
629
  activeStepIndex: number;
615
630
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@porsche-design-system/components-react",
3
- "version": "2.15.0",
3
+ "version": "2.16.0",
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.15.0"
20
+ "@porsche-design-system/components-js": "2.16.0"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": ">=17.0.0 <19.0.0",
package/public-api.js CHANGED
@@ -183,6 +183,23 @@ const PButtonPure = /*#__PURE__*/ react.forwardRef(({ active = false, alignLabel
183
183
  return jsxRuntime.jsx(Tag, { ...props });
184
184
  });
185
185
 
186
+ const PCarousel = /*#__PURE__*/ react.forwardRef(({ description, disablePagination = false, heading, intl = {}, onCarouselChange, slidesPerPage = 1, theme = 'light', wrapContent, className, ...rest }, ref) => {
187
+ const elementRef = react.useRef();
188
+ useEventCallback(elementRef, 'carouselChange', onCarouselChange);
189
+ const Tag = usePrefix('p-carousel');
190
+ const propsToSync = [description, disablePagination, heading, intl, slidesPerPage, theme, wrapContent];
191
+ useBrowserLayoutEffect(() => {
192
+ const { current } = elementRef;
193
+ ['description', 'disablePagination', 'heading', 'intl', 'slidesPerPage', 'theme', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
194
+ }, propsToSync);
195
+ const props = {
196
+ ...rest,
197
+ class: useMergedClass(elementRef, className),
198
+ ref: syncRef(elementRef, ref)
199
+ };
200
+ return jsxRuntime.jsx(Tag, { ...props });
201
+ });
202
+
186
203
  const PCheckboxWrapper = /*#__PURE__*/ react.forwardRef(({ hideLabel = false, label = '', message = '', state = 'none', className, ...rest }, ref) => {
187
204
  const elementRef = react.useRef();
188
205
  const Tag = usePrefix('p-checkbox-wrapper');
@@ -491,6 +508,22 @@ const PRadioButtonWrapper = /*#__PURE__*/ react.forwardRef(({ hideLabel = false,
491
508
  return jsxRuntime.jsx(Tag, { ...props });
492
509
  });
493
510
 
511
+ const PScroller = /*#__PURE__*/ react.forwardRef(({ gradientColorScheme = 'default', scrollIndicatorPosition = 'center', scrollToPosition, theme = 'light', className, ...rest }, ref) => {
512
+ const elementRef = react.useRef();
513
+ const Tag = usePrefix('p-scroller');
514
+ const propsToSync = [gradientColorScheme, scrollIndicatorPosition, scrollToPosition, theme];
515
+ useBrowserLayoutEffect(() => {
516
+ const { current } = elementRef;
517
+ ['gradientColorScheme', 'scrollIndicatorPosition', 'scrollToPosition', 'theme'].forEach((propName, i) => (current[propName] = propsToSync[i]));
518
+ }, propsToSync);
519
+ const props = {
520
+ ...rest,
521
+ class: useMergedClass(elementRef, className),
522
+ ref: syncRef(elementRef, ref)
523
+ };
524
+ return jsxRuntime.jsx(Tag, { ...props });
525
+ });
526
+
494
527
  const PSegmentedControl = /*#__PURE__*/ react.forwardRef(({ backgroundColor = 'background-default', onSegmentedControlChange, theme = 'light', value, className, ...rest }, ref) => {
495
528
  const elementRef = react.useRef();
496
529
  useEventCallback(elementRef, 'segmentedControlChange', onSegmentedControlChange);
@@ -556,13 +589,15 @@ const PSpinner = /*#__PURE__*/ react.forwardRef(({ aria, size = 'small', theme =
556
589
  return jsxRuntime.jsx(Tag, { ...props });
557
590
  });
558
591
 
559
- const PStepperHorizontal = /*#__PURE__*/ react.forwardRef(({ onStepChange, theme = 'light', className, ...rest }, ref) => {
592
+ const PStepperHorizontal = /*#__PURE__*/ react.forwardRef(({ onStepChange, size = 'small', theme = 'light', className, ...rest }, ref) => {
560
593
  const elementRef = react.useRef();
561
594
  useEventCallback(elementRef, 'stepChange', onStepChange);
562
595
  const Tag = usePrefix('p-stepper-horizontal');
596
+ const propsToSync = [size, theme];
563
597
  useBrowserLayoutEffect(() => {
564
- elementRef.current.theme = theme;
565
- }, [theme]);
598
+ const { current } = elementRef;
599
+ ['size', 'theme'].forEach((propName, i) => (current[propName] = propsToSync[i]));
600
+ }, propsToSync);
566
601
  const props = {
567
602
  ...rest,
568
603
  class: useMergedClass(elementRef, className),
@@ -872,6 +907,7 @@ exports.PBanner = PBanner;
872
907
  exports.PButton = PButton;
873
908
  exports.PButtonGroup = PButtonGroup;
874
909
  exports.PButtonPure = PButtonPure;
910
+ exports.PCarousel = PCarousel;
875
911
  exports.PCheckboxWrapper = PCheckboxWrapper;
876
912
  exports.PContentWrapper = PContentWrapper;
877
913
  exports.PDivider = PDivider;
@@ -891,6 +927,7 @@ exports.PModal = PModal;
891
927
  exports.PPagination = PPagination;
892
928
  exports.PPopover = PPopover;
893
929
  exports.PRadioButtonWrapper = PRadioButtonWrapper;
930
+ exports.PScroller = PScroller;
894
931
  exports.PSegmentedControl = PSegmentedControl;
895
932
  exports.PSegmentedControlItem = PSegmentedControlItem;
896
933
  exports.PSelectWrapper = PSelectWrapper;