@porsche-design-system/components-react 4.4.0-rc.0 → 4.4.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 (32) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +2 -2
  3. package/ssr/cjs/components/dist/styles/esm/styles-entry.cjs +164 -68
  4. package/ssr/cjs/components/dist/utils/esm/utils-entry.cjs +1 -1
  5. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/banner.cjs +15 -5
  6. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/dialog-base.cjs +3 -7
  7. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/drilldown.cjs +3 -0
  8. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/fc-dismiss-button.cjs +16 -0
  9. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout.cjs +14 -1
  10. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/inline-notification.cjs +2 -2
  11. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/modal.cjs +14 -1
  12. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/popover.cjs +5 -1
  13. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/sheet.cjs +14 -1
  14. package/ssr/esm/components/dist/styles/esm/styles-entry.mjs +164 -69
  15. package/ssr/esm/components/dist/utils/esm/utils-entry.mjs +1 -1
  16. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/banner.mjs +15 -5
  17. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/dialog-base.mjs +3 -7
  18. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/drilldown.mjs +3 -0
  19. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/fc-dismiss-button.mjs +14 -0
  20. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout.mjs +14 -1
  21. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/inline-notification.mjs +2 -2
  22. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/modal.mjs +14 -1
  23. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/popover.mjs +5 -1
  24. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/sheet.mjs +14 -1
  25. package/ssr/esm/lib/dsr-components/banner.d.ts +2 -0
  26. package/ssr/esm/lib/dsr-components/dialog-base.d.ts +2 -2
  27. package/ssr/esm/lib/dsr-components/drilldown.d.ts +1 -0
  28. package/ssr/esm/lib/dsr-components/fc-dismiss-button.d.ts +16 -0
  29. package/ssr/esm/lib/dsr-components/flyout.d.ts +1 -0
  30. package/ssr/esm/lib/dsr-components/modal.d.ts +1 -0
  31. package/ssr/esm/lib/dsr-components/popover.d.ts +1 -0
  32. package/ssr/esm/lib/dsr-components/sheet.d.ts +1 -0
@@ -1,12 +1,8 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import 'react';
3
- import '../../provider.mjs';
4
- import { PButton } from '../components/button.wrapper.mjs';
2
+ import { FCDismissButton } from './fc-dismiss-button.mjs';
5
3
 
6
- const DialogBase = ({ children,
7
- // host,
8
- inert, containerClass, ariaAttributes, dismissable = false, header, footer, subFooter, }) => {
9
- return (jsx("dialog", { inert: inert, tabIndex: -1, ...(ariaAttributes ?? {}), children: jsx("div", { className: "scroller", children: jsxs("div", { className: containerClass, children: [dismissable && (jsx(PButton, { className: "dismiss", compact: true, type: "button", hideLabel: true, icon: "close", children: `Dismiss ${containerClass}` })), header, children, footer, subFooter] }) }) }));
4
+ const DialogBase = ({ children, inert, containerClass, ariaAttributes, onMouseDown, dismissable = false, header, footer, subFooter, }) => {
5
+ return (jsx("dialog", { inert: inert, tabIndex: -1, ...(ariaAttributes ?? {}), children: jsx("div", { className: "scroller", children: jsxs("div", { className: containerClass, children: [dismissable && jsx(FCDismissButton, { label: `Dismiss ${containerClass}` }), header, children, footer, subFooter] }) }) }));
10
6
  };
11
7
 
12
8
  export { DialogBase };
@@ -24,6 +24,9 @@ class DSRDrilldown extends Component {
24
24
  dialog;
25
25
  drawer;
26
26
  isDesktop = false;
27
+ // Tracks whether the current pointer gesture started inside the drawer (not on the backdrop). Lets `onClickDialog`
28
+ // skip dismissal when a selection is dragged out of the drawer and released on the backdrop.
29
+ isPointerDownInside = false;
27
30
  async componentWillLoad() {
28
31
  this.props.defineDrilldownItemElements();
29
32
  const activeItem = this.props.drilldownItemElements.find((item) => item.identifier === this.props.activeIdentifier);
@@ -0,0 +1,14 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+
3
+ /**
4
+ * Shared dismiss/close button used across dialog-based (flyout/modal/sheet) and notification-based
5
+ * (banner/inline-notification/toast) components. Renders a native `<button className="dismiss">` with the close icon
6
+ * inlined as a CSS mask (see `fc-dismiss-button-styles.ts`) — so it needs neither a nested `p-button` nor a `p-icon`
7
+ * (avoiding the async CDN icon fetch). Each consumer supplies the variant/positioning styling via the `.dismiss` class.
8
+ * The visible label text is visually hidden but exposed to assistive technology as the accessible name.
9
+ */
10
+ const FCDismissButton = ({ label, ariaDescription, }) => {
11
+ return (jsx("button", { className: "dismiss", type: "button", ...(ariaDescription ? { 'aria-description': ariaDescription } : {}), children: jsx("span", { children: label }) }));
12
+ };
13
+
14
+ export { FCDismissButton };
@@ -23,6 +23,9 @@ class DSRFlyout extends Component {
23
23
  hasHeader;
24
24
  hasFooter;
25
25
  hasSubFooter;
26
+ // Tracks whether the current pointer gesture started inside the panel (not on the backdrop). Lets `onClickDialog`
27
+ // skip dismissal when a selection is dragged out of the panel and released on the backdrop.
28
+ isPointerDownInside = false;
26
29
  topLayer = createTopLayerController({
27
30
  getElement: () => this.props.dialog,
28
31
  isShown: () => !!this.props.dialog?.open,
@@ -35,7 +38,17 @@ class DSRFlyout extends Component {
35
38
  const hasFooter = namedSlotChildren.filter(({ props: { slot } }) => slot === 'footer').length > 0;
36
39
  const hasSubFooter = namedSlotChildren.filter(({ props: { slot } }) => slot === 'sub-footer').length > 0;
37
40
  const style = minifyCss(getComponentCss$V(this.props.open, this.props.background, this.props.backdrop, this.props.position, hasHeader, hasFooter, hasSubFooter, this.props.footerBehavior, this.props.fullscreen));
38
- return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx(DialogBase, { host: null, dismissable: true, containerClass: "flyout", header: hasHeader ? jsx("slot", { name: "header" }) : undefined, footer: hasFooter ? jsx("slot", { name: "footer" }) : undefined, subFooter: hasSubFooter ? jsx("slot", { name: "sub-footer" }) : undefined, ariaAttributes: parseAndGetAriaAttributes({
41
+ return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx(DialogBase
42
+ // `inert` (not `aria-hidden`) removes the panel from the a11y tree AND prevents focus while closed / during the
43
+ // fade-out. Using `aria-hidden` here triggers a browser warning when a focusable descendant still holds focus
44
+ // during the closing transition ("Blocked aria-hidden on an element because its descendant retained focus").
45
+ // `inert` avoids that and mirrors the pattern used by `p-modal` / `p-popover` / `p-drilldown`.
46
+ , {
47
+ // `inert` (not `aria-hidden`) removes the panel from the a11y tree AND prevents focus while closed / during the
48
+ // fade-out. Using `aria-hidden` here triggers a browser warning when a focusable descendant still holds focus
49
+ // during the closing transition ("Blocked aria-hidden on an element because its descendant retained focus").
50
+ // `inert` avoids that and mirrors the pattern used by `p-modal` / `p-popover` / `p-drilldown`.
51
+ inert: !this.props.open, dismissable: true, containerClass: "flyout", header: hasHeader ? jsx("slot", { name: "header" }) : undefined, footer: hasFooter ? jsx("slot", { name: "footer" }) : undefined, subFooter: hasSubFooter ? jsx("slot", { name: "sub-footer" }) : undefined, ariaAttributes: parseAndGetAriaAttributes({
39
52
  'aria-modal': true,
40
53
  ...{ 'aria-label': hasHeader ? namedSlotChildren.find(({ props: { slot } }) => slot === 'header')?.props.children : 'Flyout' },
41
54
  ...parseAndGetAriaAttributes(this.props.aria),
@@ -5,8 +5,8 @@ import { splitChildren } from '../../splitChildren.mjs';
5
5
  import { minifyCss } from '../../minifyCss.mjs';
6
6
  import { getInlineNotificationCss as getComponentCss$S } from '../../../../../../components/dist/styles/esm/styles-entry.mjs';
7
7
  import { getInlineNotificationAriaAttributes } from '../../../../../../components/dist/utils/esm/utils-entry.mjs';
8
+ import { FCDismissButton } from './fc-dismiss-button.mjs';
8
9
  import { NotificationBase } from './notification-base.mjs';
9
- import { PButton } from '../components/button.wrapper.mjs';
10
10
  import { PButtonPure } from '../components/button-pure.wrapper.mjs';
11
11
 
12
12
  /**
@@ -24,7 +24,7 @@ class DSRInlineNotification extends Component {
24
24
  return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx(NotificationBase, { ...getInlineNotificationAriaAttributes(this.props.state, headingText), heading: this.props.heading, headingTag: this.props.headingTag, hasHeadingSlot: hasHeadingSlot, description: this.props.description, ...(this.props.actionLabel && {
25
25
  actionLabel: (jsx(PButtonPure, { className: "action", icon: this.props.actionIcon, loading: this.props.actionLoading, children: this.props.actionLabel })),
26
26
  }), ...(this.props.dismissButton && {
27
- dismissButton: (jsx(PButton, { className: "dismiss", type: "button", variant: "secondary", icon: "close", hideLabel: true, compact: true, ...(headingText ? { aria: { 'aria-description': headingText } } : {}), children: "Close notification" })),
27
+ dismissButton: (jsx(FCDismissButton, { label: "Close notification", ariaDescription: headingText || undefined })),
28
28
  }) })] }), this.props.children] }));
29
29
  }
30
30
  }
@@ -20,6 +20,9 @@ class DSRModal extends Component {
20
20
  footer;
21
21
  hasHeader;
22
22
  hasFooter;
23
+ // Tracks whether the current pointer gesture started inside the panel (not on the backdrop). Lets `onClickDialog`
24
+ // skip dismissal when a selection is dragged out of the panel and released on the backdrop.
25
+ isPointerDownInside = false;
23
26
  topLayer = createTopLayerController({
24
27
  getElement: () => this.props.dialog,
25
28
  isShown: () => !!this.props.dialog?.open,
@@ -33,7 +36,17 @@ class DSRModal extends Component {
33
36
  this.props.disableCloseButton ? false : this.props.dismissButton;
34
37
  // TODO: why do we validate only when opened?
35
38
  const style = minifyCss(getComponentCss$C(this.props.open, this.props.background, this.props.backdrop, this.props.fullscreen, this.props.dismissButton, hasHeader, hasFooter));
36
- return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx(DialogBase, { host: null, inert: !this.props.open, dismissable: this.props.dismissButton ?? undefined, containerClass: "modal", header: hasHeader ? jsx("slot", { name: "header" }) : undefined, footer: hasFooter ? jsx("slot", { name: "footer" }) : undefined, ariaAttributes: parseAndGetAriaAttributes({
39
+ return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx(DialogBase
40
+ // `inert` (not `aria-hidden`) removes the panel from the a11y tree AND prevents focus while closed / during the
41
+ // fade-out. Using `aria-hidden` here triggers a browser warning when a focusable descendant still holds focus
42
+ // during the closing transition ("Blocked aria-hidden on an element because its descendant retained focus").
43
+ // `inert` avoids that and mirrors the pattern used by `p-flyout` / `p-popover` / `p-drilldown`.
44
+ , {
45
+ // `inert` (not `aria-hidden`) removes the panel from the a11y tree AND prevents focus while closed / during the
46
+ // fade-out. Using `aria-hidden` here triggers a browser warning when a focusable descendant still holds focus
47
+ // during the closing transition ("Blocked aria-hidden on an element because its descendant retained focus").
48
+ // `inert` avoids that and mirrors the pattern used by `p-flyout` / `p-popover` / `p-drilldown`.
49
+ inert: !this.props.open, dismissable: this.props.dismissButton ?? undefined, containerClass: "modal", header: hasHeader ? jsx("slot", { name: "header" }) : undefined, footer: hasFooter ? jsx("slot", { name: "footer" }) : undefined, ariaAttributes: parseAndGetAriaAttributes({
37
50
  'aria-modal': true,
38
51
  ...(hasHeader && { 'aria-label': this.props.ariaLabel }),
39
52
  ...parseAndGetAriaAttributes(this.props.aria),
@@ -20,6 +20,10 @@ import { createTopLayerController, parseAndGetAriaAttributes } from '../../../..
20
20
  class DSRPopover extends Component {
21
21
  host;
22
22
  isOpen = false;
23
+ // Tracks the component's first render. While `true`, the entry transition (`@starting-style`) is suppressed so an
24
+ // initially-open popover (`open=true` on page load) appears instantly instead of fading in; flipped to `false` in
25
+ // `componentDidLoad`, so every later (user-triggered) open keeps the fade-in.
26
+ isInitialRender = true;
23
27
  // The `[popover]` panel element on the #top-layer that holds the content and the arrow.
24
28
  refPopover;
25
29
  // The default info button rendered in the Shadow DOM (only present when no `button` slot is used).
@@ -73,7 +77,7 @@ class DSRPopover extends Component {
73
77
  const { namedSlotChildren} = splitChildren(this.props.children);
74
78
  const hasSlottedButton = namedSlotChildren.filter(({ props: { slot } }) => slot === 'button').length > 0;
75
79
  const id = 'popover';
76
- const style = minifyCss(getComponentCss$v(this.props.effectiveOpen, this.props.compact).replace(/(:host {[\S\s]+?})[\S\s]+(button {[\S\s]+?})[\S\s]+(.icon {[\S\s]+?})[\S\s]+(.label {[\S\s]+?})[\S\s]+/, '$1\n$2\n$3\n$4'));
80
+ const style = minifyCss(getComponentCss$v(this.props.effectiveOpen, this.props.compact, this.props.isInitialRender).replace(/(:host {[\S\s]+?})[\S\s]+(button {[\S\s]+?})[\S\s]+(.icon {[\S\s]+?})[\S\s]+(.label {[\S\s]+?})[\S\s]+/, '$1\n$2\n$3\n$4'));
77
81
  return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs(Fragment, { children: [hasSlottedButton ? (jsx("slot", { name: "button" })) : (jsx("button", { type: "button", "aria-label": "More information", "aria-details": id, ...parseAndGetAriaAttributes(this.props.aria), "aria-expanded": this.props.effectiveOpen ? 'true' : 'false' })), jsxs("div", { id: id, popover: "manual", inert: !this.props.effectiveOpen, children: [jsx("div", { className: "arrow" }), this.props.description ? jsx("p", { children: this.props.description }) : jsx("slot", {})] })] })] }), this.props.children] }));
78
82
  }
79
83
  }
@@ -17,6 +17,9 @@ class DSRSheet extends Component {
17
17
  dialog;
18
18
  scroller;
19
19
  hasHeader;
20
+ // Tracks whether the current pointer gesture started inside the panel (not on the backdrop). Lets `onClickDialog`
21
+ // skip dismissal when a selection is dragged out of the panel and released on the backdrop.
22
+ isPointerDownInside = false;
20
23
  topLayer = createTopLayerController({
21
24
  getElement: () => this.props.dialog,
22
25
  isShown: () => !!this.props.dialog?.open,
@@ -28,7 +31,17 @@ class DSRSheet extends Component {
28
31
  const hasHeader = namedSlotChildren.filter(({ props: { slot } }) => slot === 'header').length > 0;
29
32
  if (this.props.open) ;
30
33
  const style = minifyCss(getComponentCss$n(this.props.open, this.props.background, this.props.dismissButton));
31
- return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx(DialogBase, { host: null, inert: !this.props.open, dismissable: this.props.dismissButton ?? undefined, containerClass: "sheet", header: hasHeader ? jsx("slot", { name: "header" }) : undefined, ariaAttributes: parseAndGetAriaAttributes({
34
+ return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx(DialogBase
35
+ // `inert` (not `aria-hidden`) removes the panel from the a11y tree AND prevents focus while closed / during the
36
+ // fade-out. Using `aria-hidden` here triggers a browser warning when a focusable descendant still holds focus
37
+ // during the closing transition ("Blocked aria-hidden on an element because its descendant retained focus").
38
+ // `inert` avoids that and mirrors the pattern used by `p-modal` / `p-popover` / `p-drilldown`.
39
+ , {
40
+ // `inert` (not `aria-hidden`) removes the panel from the a11y tree AND prevents focus while closed / during the
41
+ // fade-out. Using `aria-hidden` here triggers a browser warning when a focusable descendant still holds focus
42
+ // during the closing transition ("Blocked aria-hidden on an element because its descendant retained focus").
43
+ // `inert` avoids that and mirrors the pattern used by `p-modal` / `p-popover` / `p-drilldown`.
44
+ inert: !this.props.open, dismissable: this.props.dismissButton ?? undefined, containerClass: "sheet", header: hasHeader ? jsx("slot", { name: "header" }) : undefined, ariaAttributes: parseAndGetAriaAttributes({
32
45
  'aria-modal': true,
33
46
  ...(hasHeader && {
34
47
  'aria-label': namedSlotChildren.filter(({ props: { slot } }) => slot === 'header').length > 0 && namedSlotChildren.find(({ props: { slot } }) => slot === 'header')?.props.children,
@@ -13,6 +13,8 @@ export declare class DSRBanner extends Component<any> {
13
13
  private refDismiss;
14
14
  private hasHeadingSlot;
15
15
  private hasDescriptionSlot;
16
+ private hasKeydownListener;
17
+ private isInitialRender;
16
18
  private topLayer;
17
19
  render(): JSX.Element;
18
20
  }
@@ -3,13 +3,13 @@ import type { FC } from 'react';
3
3
  import type { JSX } from 'react';
4
4
  type DialogBaseProps = {
5
5
  children?: JSX.Element;
6
- host: HTMLElement;
7
- inert?: boolean;
6
+ inert: boolean;
8
7
  dialogRef?: (el: HTMLDialogElement) => void;
9
8
  scrollerRef?: (el: HTMLDivElement) => void;
10
9
  containerClass: 'flyout' | 'modal' | 'sheet';
11
10
  onCancel?: (e: Event) => void;
12
11
  onClick?: (e: MouseEvent) => void;
12
+ onMouseDown?: (e: MouseEvent) => void;
13
13
  onTransitionEnd?: (e: TransitionEvent) => void;
14
14
  onDismiss?: () => void;
15
15
  ariaAttributes?: AriaAttributes;
@@ -16,6 +16,7 @@ export declare class DSRDrilldown extends Component<any> {
16
16
  private dialog;
17
17
  private drawer;
18
18
  private isDesktop;
19
+ private isPointerDownInside;
19
20
  componentWillLoad(): Promise<void>;
20
21
  render(): JSX.Element;
21
22
  }
@@ -0,0 +1,16 @@
1
+ import type { FC } from 'react';
2
+ type FCDismissButtonProps = {
3
+ /** Accessible (visually hidden) label of the dismiss button. */
4
+ label: string;
5
+ /** Optional value forwarded as `aria-description` to provide additional context (e.g. the notification heading). */
6
+ ariaDescription?: string;
7
+ };
8
+ /**
9
+ * Shared dismiss/close button used across dialog-based (flyout/modal/sheet) and notification-based
10
+ * (banner/inline-notification/toast) components. Renders a native `<button className="dismiss">` with the close icon
11
+ * inlined as a CSS mask (see `fc-dismiss-button-styles.ts`) — so it needs neither a nested `p-button` nor a `p-icon`
12
+ * (avoiding the async CDN icon fetch). Each consumer supplies the variant/positioning styling via the `.dismiss` class.
13
+ * The visible label text is visually hidden but exposed to assistive technology as the accessible name.
14
+ */
15
+ export declare const FCDismissButton: FC<FCDismissButtonProps>;
16
+ export {};
@@ -17,6 +17,7 @@ export declare class DSRFlyout extends Component<any> {
17
17
  private hasHeader;
18
18
  private hasFooter;
19
19
  private hasSubFooter;
20
+ private isPointerDownInside;
20
21
  private topLayer;
21
22
  render(): JSX.Element;
22
23
  }
@@ -14,6 +14,7 @@ export declare class DSRModal extends Component<any> {
14
14
  private footer;
15
15
  private hasHeader;
16
16
  private hasFooter;
17
+ private isPointerDownInside;
17
18
  private topLayer;
18
19
  render(): JSX.Element;
19
20
  }
@@ -9,6 +9,7 @@ import type { JSX } from 'react';
9
9
  export declare class DSRPopover extends Component<any> {
10
10
  host: HTMLElement;
11
11
  private isOpen;
12
+ private isInitialRender;
12
13
  private refPopover;
13
14
  private refButton;
14
15
  private refSlotButton;
@@ -11,6 +11,7 @@ export declare class DSRSheet extends Component<any> {
11
11
  private dialog;
12
12
  private scroller;
13
13
  private hasHeader;
14
+ private isPointerDownInside;
14
15
  private topLayer;
15
16
  render(): JSX.Element;
16
17
  }