@porsche-design-system/components-react 3.15.2 → 3.16.0-rc.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/cjs/lib/components/flyout.wrapper.cjs +3 -3
  3. package/esm/lib/components/carousel.wrapper.d.ts +2 -2
  4. package/esm/lib/components/flyout.wrapper.d.ts +8 -0
  5. package/esm/lib/components/flyout.wrapper.mjs +3 -3
  6. package/esm/lib/components/modal.wrapper.d.ts +2 -2
  7. package/esm/lib/components/pagination.wrapper.d.ts +1 -1
  8. package/esm/lib/types.d.ts +4 -4
  9. package/package.json +2 -2
  10. package/ssr/cjs/components/dist/styles/esm/styles-entry.cjs +347 -320
  11. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/components/flyout.wrapper.cjs +4 -4
  12. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout-navigation-item.cjs +5 -1
  13. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout-navigation.cjs +5 -1
  14. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout.cjs +11 -5
  15. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/modal.cjs +13 -7
  16. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/multi-select.cjs +1 -1
  17. package/ssr/esm/components/dist/styles/esm/styles-entry.mjs +347 -320
  18. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/flyout.wrapper.mjs +4 -4
  19. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout-navigation-item.mjs +5 -1
  20. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout-navigation.mjs +5 -1
  21. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout.mjs +11 -5
  22. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/modal.mjs +13 -7
  23. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/multi-select.mjs +1 -1
  24. package/ssr/esm/lib/components/flyout.wrapper.d.ts +8 -0
  25. package/ssr/esm/lib/components/modal.wrapper.d.ts +2 -2
  26. package/ssr/esm/lib/dsr-components/banner.d.ts +8 -0
  27. package/ssr/esm/lib/dsr-components/flyout.d.ts +1 -3
  28. package/ssr/esm/lib/types.d.ts +4 -4
@@ -5,14 +5,14 @@ import { useEventCallback, usePrefix, useTheme, useBrowserLayoutEffect, useMerge
5
5
  import { syncRef } from '../../utils.mjs';
6
6
  import { DSRFlyout } from '../dsr-components/flyout.mjs';
7
7
 
8
- const PFlyout = forwardRef(({ aria, onDismiss, open = false, position = 'end', theme, className, children, ...rest }, ref) => {
8
+ const PFlyout = forwardRef(({ aria, disableBackdropClick = false, onDismiss, open = false, position = 'end', theme, className, children, ...rest }, ref) => {
9
9
  const elementRef = useRef();
10
10
  useEventCallback(elementRef, 'dismiss', onDismiss);
11
11
  const WebComponentTag = usePrefix('p-flyout');
12
- const propsToSync = [aria, open, position, theme || useTheme()];
12
+ const propsToSync = [aria, disableBackdropClick, open, position, theme || useTheme()];
13
13
  useBrowserLayoutEffect(() => {
14
14
  const { current } = elementRef;
15
- ['aria', 'open', 'position', 'theme'].forEach((propName, i) => (current[propName] = propsToSync[i]));
15
+ ['aria', 'disableBackdropClick', 'open', 'position', 'theme'].forEach((propName, i) => (current[propName] = propsToSync[i]));
16
16
  }, propsToSync);
17
17
  // @ts-ignore
18
18
  if (!process.browser) {
@@ -23,7 +23,7 @@ const PFlyout = forwardRef(({ aria, onDismiss, open = false, position = 'end', t
23
23
  // @ts-ignore
24
24
  ...(!process.browser
25
25
  ? {
26
- children: (jsx(DSRFlyout, { aria, open, position, theme: theme || useTheme(), children })),
26
+ children: (jsx(DSRFlyout, { aria, disableBackdropClick, open, position, theme: theme || useTheme(), children })),
27
27
  }
28
28
  : {
29
29
  children,
@@ -86,7 +86,11 @@ class DSRFlyoutNavigationItem extends Component {
86
86
  render() {
87
87
  splitChildren(this.props.children);
88
88
  const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$Q(this.open, this.theme)));
89
- return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs(Fragment, { children: [jsx(PButtonPure, { className: "button", type: "button", size: "medium", alignLabel: "start", stretch: true, icon: "arrow-head-right", active: this.open, aria: { 'aria-expanded': this.open }, theme: this.theme, children: this.props.label }), jsxs("div", { className: "scroller", inert: this.open ? null : '', children: [jsxs("div", { className: "header", children: [jsx(PButtonPure, { className: "back", type: "button", size: "medium", icon: "arrow-head-left", hideLabel: true, theme: this.theme, children: "Back" }), jsx("h2", { className: "heading", children: this.props.label })] }), jsx("div", { className: "content", children: jsx("slot", {}) })] })] })] }), this.props.children] }));
89
+ return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs(Fragment, { children: [jsx(PButtonPure, { className: "button", type: "button", size: "medium", alignLabel: "start", stretch: true, icon: "arrow-head-right", active: this.open, aria: { 'aria-expanded': this.open }, theme: this.theme, children: this.props.label }), jsxs("div", { className: "scroller",
90
+ // "inert" will be known from React 19 onwards, see https://github.com/facebook/react/pull/24730
91
+ // eslint-disable-next-line
92
+ /* @ts-ignore */
93
+ inert: this.open ? null : '', children: [jsxs("div", { className: "header", children: [jsx(PButtonPure, { className: "back", type: "button", size: "medium", icon: "arrow-head-left", hideLabel: true, theme: this.theme, children: "Back" }), jsx("h2", { className: "heading", children: this.props.label })] }), jsx("div", { className: "content", children: jsx("slot", {}) })] })] })] }), this.props.children] }));
90
94
  }
91
95
  }
92
96
 
@@ -84,7 +84,11 @@ class DSRFlyoutNavigation extends Component {
84
84
  render() {
85
85
  splitChildren(this.props.children);
86
86
  const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$R(this.props.open, !!this.props.activeIdentifier, this.props.theme)));
87
- return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs("dialog", { inert: this.props.open ? null : '', tabIndex: -1, children: [jsx("div", { className: "header", children: jsx(PButtonPure, { className: "dismiss", type: "button", size: "medium", icon: "close", hideLabel: true, theme: this.props.theme, children: "Dismiss flyout" }) }), jsx("div", { className: "scroller", children: jsx("nav", { className: "content", ...parseAndGetAriaAttributes(this.props.aria), children: jsx("slot", {}) }) })] })] }), this.props.children] }));
87
+ return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs("dialog", {
88
+ // "inert" will be known from React 19 onwards, see https://github.com/facebook/react/pull/24730
89
+ // eslint-disable-next-line
90
+ /* @ts-ignore */
91
+ inert: this.props.open ? null : '', tabIndex: -1, children: [jsx("div", { className: "header", children: jsx(PButtonPure, { className: "dismiss", type: "button", size: "medium", icon: "close", hideLabel: true, theme: this.props.theme, children: "Dismiss flyout" }) }), jsx("div", { className: "scroller", children: jsx("nav", { className: "content", ...parseAndGetAriaAttributes(this.props.aria), children: jsx("slot", {}) }) })] })] }), this.props.children] }));
88
92
  }
89
93
  }
90
94
 
@@ -78,11 +78,9 @@ import { parseAndGetAriaAttributes } from '../../../../../../components/dist/uti
78
78
  class DSRFlyout extends Component {
79
79
  host;
80
80
  dialog;
81
- wrapper;
82
- dismissBtn;
81
+ scroller;
83
82
  header;
84
83
  footer;
85
- subFooter;
86
84
  hasHeader;
87
85
  hasFooter;
88
86
  hasSubFooter;
@@ -95,8 +93,16 @@ class DSRFlyout extends Component {
95
93
  const hasHeader = namedSlotChildren.filter(({ props: { slot } }) => slot === 'header').length > 0;
96
94
  const hasFooter = namedSlotChildren.filter(({ props: { slot } }) => slot === 'footer').length > 0;
97
95
  const hasSubFooter = namedSlotChildren.filter(({ props: { slot } }) => slot === 'sub-footer').length > 0;
98
- const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$P(this.props.open, (positionDeprecationMap[this.props.position] || this.props.position), hasFooter, hasSubFooter, this.props.theme)));
99
- return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx("dialog", { inert: this.props.open ? null : '', tabIndex: -1, ...parseAndGetAriaAttributes(this.props.aria), children: jsxs("div", { className: "wrapper", ...(hasSubFooter && { onScroll: this.props.updateShadow }), children: [jsxs("div", { className: "header", children: [jsx(PButtonPure, { className: "dismiss", type: "button", hideLabel: true, icon: "close", theme: this.props.theme, children: "Dismiss flyout" }), hasHeader && jsx("slot", { name: "header" })] }, "header"), jsx("div", { className: "content", children: jsx("slot", {}) }), hasFooter && (jsx("div", { className: "footer", children: jsx("slot", { name: "footer" }) }, "footer")), hasSubFooter && (jsx("div", { className: "sub-footer", children: jsx("slot", { name: "sub-footer" }) }, "sub-footer"))] }) })] }), this.props.children] }));
96
+ const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$P(this.props.open, (positionDeprecationMap[this.props.position] || this.props.position), hasHeader, hasFooter, hasSubFooter, this.props.theme)));
97
+ return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx("dialog", {
98
+ // "inert" will be known from React 19 onwards, see https://github.com/facebook/react/pull/24730
99
+ // eslint-disable-next-line
100
+ /* @ts-ignore */
101
+ inert: this.props.open ? null : '', tabIndex: -1, ...parseAndGetAriaAttributes({
102
+ 'aria-modal': true,
103
+ 'aria-hidden': !this.props.open,
104
+ ...parseAndGetAriaAttributes(this.props.aria),
105
+ }), children: jsx("div", { className: "scroller", children: jsxs("div", { className: "flyout", children: [jsx(PButtonPure, { className: "dismiss", type: "button", hideLabel: true, icon: "close", theme: this.props.theme, children: "Dismiss flyout" }), hasHeader && jsx("slot", { name: "header" }), jsx("slot", {}), hasFooter && jsx("slot", { name: "footer" }), hasSubFooter && jsx("slot", { name: "sub-footer" })] }) }) })] }), this.props.children] }));
100
106
  }
101
107
  }
102
108
 
@@ -79,17 +79,23 @@ class DSRModal extends Component {
79
79
  host;
80
80
  render() {
81
81
  const { children, namedSlotChildren, otherChildren } = splitChildren(this.props.children);
82
- const hasHeader = (this.props.heading || namedSlotChildren.filter(({ props: { slot } }) => slot === 'heading').length > 0);
82
+ const hasHeader = (this.props.heading || namedSlotChildren.filter(({ props: { slot } }) => slot === 'heading').length > 0) || namedSlotChildren.filter(({ props: { slot } }) => slot === 'header').length > 0;
83
83
  const hasFooter = namedSlotChildren.filter(({ props: { slot } }) => slot === 'footer').length > 0;
84
84
  const hasDismissButton = this.props.disableCloseButton ? false : this.props.dismissButton;
85
+ // TODO: why do we validate only when opened?
85
86
  if (this.props.open) ;
86
87
  const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$C(this.props.open, this.props.backdrop, this.props.fullscreen, hasDismissButton, hasHeader, hasFooter, this.props.theme)));
87
- return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx(Fragment, { children: jsx("div", { className: "scroll-container", children: jsxs("div", { className: "root", role: "dialog", ...parseAndGetAriaAttributes({
88
- 'aria-modal': true,
89
- 'aria-label': this.props.heading,
90
- 'aria-hidden': !this.props.open,
91
- ...parseAndGetAriaAttributes(this.props.aria),
92
- }), tabIndex: -1, inert: this.props.open ? null : '', children: [hasDismissButton && (jsx("div", { className: "controls", children: jsx(PButtonPure, { className: "dismiss", type: "button", hideLabel: true, icon: "close", theme: this.props.theme, children: "Dismiss modal" }) })), hasHeader && (jsx("div", { className: "header", children: this.props.heading ? jsx("h2", { children: this.props.heading }) : jsx("slot", { name: "heading" }) }, "heading")), jsx("div", { className: "content", children: jsx("slot", {}) }), hasFooter && (jsx("div", { className: "footer", children: jsx("slot", { name: "footer" }) }, "footer"))] }) }) })] }), this.props.children] }));
88
+ return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx("dialog", {
89
+ // "inert" will be known from React 19 onwards, see https://github.com/facebook/react/pull/24730
90
+ // eslint-disable-next-line
91
+ /* @ts-ignore */
92
+ inert: this.props.open ? null : '', tabIndex: -1, ...parseAndGetAriaAttributes({
93
+ 'aria-modal': true,
94
+ 'aria-label': this.props.heading,
95
+ 'aria-hidden': !this.props.open,
96
+ ...parseAndGetAriaAttributes(this.props.aria),
97
+ }), children: jsx("div", { className: "scroller", children: jsxs("div", { className: "modal", children: [hasDismissButton && (jsx(PButtonPure, { className: "dismiss", type: "button", hideLabel: true, icon: "close", theme: this.props.theme, children: "Dismiss modal" })), hasHeader &&
98
+ (this.props.heading ? (jsx("h2", { children: this.props.heading })) : namedSlotChildren.filter(({ props: { slot } }) => slot === 'heading').length > 0 ? (jsx("slot", { name: "heading" })) : (jsx("slot", { name: "header" }))), jsx("slot", {}), hasFooter && jsx("slot", { name: "footer" })] }) }) })] }), this.props.children] }));
93
99
  }
94
100
  }
95
101
 
@@ -102,7 +102,7 @@ class DSRMultiSelect extends Component {
102
102
  const dropdownId = 'list';
103
103
  const inputId = 'filter';
104
104
  const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$z('down', this.props.isOpen, this.props.disabled, this.props.hideLabel, this.props.state, this.props.isWithinForm, this.props.isNativePopoverCase, this.props.theme)));
105
- return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs("div", { className: "root", children: [jsx(Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: inputId, isRequired: this.props.required, isDisabled: this.props.disabled }), this.props.currentValue && (jsxs("span", { id: optionsSelectedId, className: "sr-only", children: [getSelectedOptions(this.props.multiSelectOptions).length, " options selected"] })), jsxs("div", { className: `wrapper${this.props.disabled ? ' disabled' : ''}`, children: [jsx("input", { id: inputId, role: "combobox", autoComplete: "off", disabled: this.props.disabled, required: this.props.required, "aria-invalid": this.props.state === 'error' ? 'true' : null }), jsx(PIcon, { className: "icon", name: "arrow-head-down", theme: this.props.theme, "aria-hidden": "true" }), this.props.currentValue && (jsx(PButtonPure, { className: "button", icon: "close", hideLabel: "true", theme: this.props.theme, disabled: this.props.disabled, children: "Reset selection" })), jsx("div", { ...(this.props.isNativePopoverCase && {
105
+ return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs("div", { className: "root", children: [jsx(Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: inputId, isRequired: this.props.required, isDisabled: this.props.disabled }), this.props.currentValue && (jsxs("span", { id: optionsSelectedId, className: "sr-only", children: [getSelectedOptions(this.props.multiSelectOptions).length, " options selected"] })), jsxs("div", { className: `wrapper${this.props.disabled ? ' disabled' : ''}`, children: [jsx("input", { id: inputId, role: "combobox", autoComplete: "off", disabled: this.props.disabled, required: this.props.required, "aria-invalid": this.props.state === 'error' ? 'true' : null }), jsx(PIcon, { className: "icon", name: "arrow-head-down", theme: this.props.theme, "aria-hidden": "true" }), this.props.currentValue && (jsx(PButtonPure, { className: "button", icon: "close", hideLabel: true, theme: this.props.theme, disabled: this.props.disabled, children: "Reset selection" })), jsx("div", { ...(this.props.isNativePopoverCase && {
106
106
  popover: 'auto',
107
107
  className: 'popover',
108
108
  ...(this.props.popoverElement?.matches(':popover-open') && {
@@ -5,6 +5,10 @@ export type PFlyoutProps = Omit<HTMLAttributes<{}>, 'color'> & {
5
5
  * Add ARIA attributes.
6
6
  */
7
7
  aria?: SelectedAriaAttributes<FlyoutAriaAttribute>;
8
+ /**
9
+ * If true, the flyout will not be closable via backdrop click.
10
+ */
11
+ disableBackdropClick?: boolean;
8
12
  /**
9
13
  * Emitted when the component requests to be dismissed.
10
14
  */
@@ -27,6 +31,10 @@ export declare const PFlyout: import("react").ForwardRefExoticComponent<Omit<HTM
27
31
  * Add ARIA attributes.
28
32
  */
29
33
  aria?: SelectedAriaAttributes<FlyoutAriaAttribute>;
34
+ /**
35
+ * If true, the flyout will not be closable via backdrop click.
36
+ */
37
+ disableBackdropClick?: boolean;
30
38
  /**
31
39
  * Emitted when the component requests to be dismissed.
32
40
  */
@@ -27,7 +27,7 @@ export type PModalProps = Omit<HTMLAttributes<{}>, 'color'> & {
27
27
  */
28
28
  fullscreen?: BreakpointCustomizable<boolean>;
29
29
  /**
30
- * The title of the modal
30
+ * @deprecated since v3.0.0, will be removed with next major release, use `header` slot instead The title of the modal
31
31
  */
32
32
  heading?: string;
33
33
  /**
@@ -74,7 +74,7 @@ export declare const PModal: import("react").ForwardRefExoticComponent<Omit<HTML
74
74
  */
75
75
  fullscreen?: BreakpointCustomizable<boolean>;
76
76
  /**
77
- * The title of the modal
77
+ * @deprecated since v3.0.0, will be removed with next major release, use `header` slot instead The title of the modal
78
78
  */
79
79
  heading?: string;
80
80
  /**
@@ -0,0 +1,8 @@
1
+ import { Component } from 'react';
2
+ export declare class DSRBanner extends Component<any> {
3
+ host: HTMLElement;
4
+ private inlineNotificationElement;
5
+ private closeBtn;
6
+ private get hasDismissButton();
7
+ render(): JSX.Element;
8
+ }
@@ -2,11 +2,9 @@ import { Component } from 'react';
2
2
  export declare class DSRFlyout extends Component<any> {
3
3
  host: HTMLElement;
4
4
  private dialog;
5
- private wrapper;
6
- private dismissBtn;
5
+ private scroller;
7
6
  private header;
8
7
  private footer;
9
- private subFooter;
10
8
  private hasHeader;
11
9
  private hasFooter;
12
10
  private hasSubFooter;
@@ -451,7 +451,7 @@ export type BreakpointValues<T> = {
451
451
  } & {
452
452
  base: T;
453
453
  };
454
- export type BreakpointCustomizable<T> = T | BreakpointValues<T> | string;
454
+ export type BreakpointCustomizable<T> = T | BreakpointValues<T>;
455
455
  declare const LINK_TARGETS: readonly [
456
456
  "_self",
457
457
  "_blank",
@@ -616,7 +616,7 @@ export type PorscheDesignSystem = {
616
616
  prefixes: string[];
617
617
  };
618
618
  };
619
- export type SelectedAriaAttributes<T extends keyof AriaAttributes> = Pick<AriaAttributes, T> | string;
619
+ export type SelectedAriaAttributes<T extends keyof AriaAttributes> = Pick<AriaAttributes, T>;
620
620
  declare const ACCORDION_SIZES: readonly [
621
621
  "small",
622
622
  "medium"
@@ -692,7 +692,7 @@ declare const CAROUSEL_ARIA_ATTRIBUTES: readonly [
692
692
  "aria-label"
693
693
  ];
694
694
  export type CarouselAriaAttribute = (typeof CAROUSEL_ARIA_ATTRIBUTES)[number];
695
- export type CarouselInternationalization = Partial<Record<"prev" | "next" | "first" | "last" | "slideLabel" | "slide", string>> | string;
695
+ export type CarouselInternationalization = Partial<Record<"prev" | "next" | "first" | "last" | "slideLabel" | "slide", string>>;
696
696
  /** @deprecated */
697
697
  export type CarouselUpdateEvent = {
698
698
  activeIndex: number;
@@ -1143,7 +1143,7 @@ export type PaginationUpdateEvent = {
1143
1143
  previousPage: number;
1144
1144
  };
1145
1145
  export type PaginationUpdateEventDetail = PaginationUpdateEvent;
1146
- export type PaginationInternationalization = Partial<Record<"root" | "prev" | "next" | "page", string>> | string;
1146
+ export type PaginationInternationalization = Partial<Record<"root" | "prev" | "next" | "page", string>>;
1147
1147
  declare const PIN_CODE_TYPES: readonly [
1148
1148
  "number",
1149
1149
  "password"