@porsche-design-system/components-react 4.3.0 → 4.4.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.
@@ -7,20 +7,21 @@ var hooks = require('../../hooks.cjs');
7
7
  var utils = require('../../utils.cjs');
8
8
  var popover = require('../dsr-components/popover.cjs');
9
9
 
10
- const PPopover = /*#__PURE__*/ react.forwardRef(({ aria, description, direction = 'bottom', className, children, ...rest }, ref) => {
10
+ const PPopover = /*#__PURE__*/ react.forwardRef(({ aria, compact, description, direction = 'bottom', onDismiss, open, className, children, ...rest }, ref) => {
11
11
  const elementRef = react.useRef(undefined);
12
+ hooks.useEventCallback(elementRef, 'dismiss', onDismiss);
12
13
  const WebComponentTag = hooks.usePrefix('p-popover');
13
- const propsToSync = [aria, description, direction];
14
+ const propsToSync = [aria, compact, description, direction, open];
14
15
  hooks.useBrowserLayoutEffect(() => {
15
16
  const { current } = elementRef;
16
- ['aria', 'description', 'direction'].forEach((propName, i) => (current[propName] = propsToSync[i]));
17
+ ['aria', 'compact', 'description', 'direction', 'open'].forEach((propName, i) => (current[propName] = propsToSync[i]));
17
18
  }, propsToSync);
18
19
  const props = {
19
20
  ...rest,
20
21
  // @ts-ignore
21
22
  ...(!process.browser
22
23
  ? {
23
- children: (jsxRuntime.jsx(popover.DSRPopover, { aria, description, direction, children })),
24
+ children: (jsxRuntime.jsx(popover.DSRPopover, { aria, compact, description, direction, open, children })),
24
25
  }
25
26
  : {
26
27
  children,
@@ -1,37 +1,82 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
- var react = require('react');
5
- require('../../provider.cjs');
6
4
  var splitChildren = require('../../splitChildren.cjs');
5
+ var react = require('react');
7
6
  var minifyCss = require('../../minifyCss.cjs');
8
7
  var stylesEntry = require('../../../../../../components/dist/styles/esm/styles-entry.cjs');
9
8
  var utilsEntry = require('../../../../../../components/dist/utils/esm/utils-entry.cjs');
10
- var icon_wrapper = require('../components/icon.wrapper.cjs');
11
9
 
12
10
  /**
13
- * @slot {"name": "", "description": "Default slot for the popover content." }
11
+ * @slot {"name": "", "description": "Default slot for the popover content. Ignored when the `description` prop is set, which takes precedence." }
14
12
  * @slot {"name": "button", "description": "Renders a custom trigger button. When used, the default info button is replaced." }
13
+ *
14
+ * @controlled {"props": ["open"], "event": "dismiss"}
15
15
  */
16
+ // The panel is a native `[popover="manual"]` element that the component promotes to the `#top-layer` itself, so it
17
+ // always renders above surrounding content regardless of ancestor stacking contexts. The component supports two modes:
18
+ // - uncontrolled: `open` is omitted and the component owns visibility via the internal `isOpen` state (toggled by the
19
+ // default info button or a slotted trigger); dismissal closes it directly.
20
+ // - controlled: `open` is a boolean and the consumer owns visibility via a slotted `button`; dismissal only emits
21
+ // `dismiss` and the consumer flips `open`. See `isControlled` / `effectiveOpen` for how the two are reconciled.
16
22
  class DSRPopover extends react.Component {
17
23
  host;
18
24
  isOpen = false;
19
- popover;
20
- button;
21
- slottedButton;
22
- arrow;
25
+ // The `[popover]` panel element on the #top-layer that holds the content and the arrow.
26
+ refPopover;
27
+ // The default info button rendered in the Shadow DOM (only present when no `button` slot is used).
28
+ refButton;
29
+ // The `<slot name="button">` element (only present when a custom trigger is projected); its assigned element is the
30
+ // actual trigger, see `triggerElement`.
31
+ refSlotButton;
32
+ // The visual arrow pointing from the panel to the trigger; positioned by Floating UI's `arrow` middleware.
33
+ refArrow;
34
+ // Teardown for the active Floating UI `autoUpdate` subscription; `undefined` while not positioning.
23
35
  cleanUpAutoUpdate;
24
- hasNativePopoverSupport = utilsEntry.getHasNativePopoverSupport();
25
- // TODO: This should be updated when slot is changed
26
- hasSlottedButton;
36
+ // The trigger element `autoUpdate` is currently anchored to, so it can be rebound when the trigger identity changes.
37
+ boundTriggerElement;
38
+ // Tracks whether the document-level dismiss listeners (outside click / Escape / pointer) are currently registered.
39
+ hasDismissListeners = false;
40
+ // Tracks whether a pointer button is currently pressed. Lets `onFocusout` defer pointer-driven focus loss (a click on
41
+ // an outside element, already handled by `onClickOutside`) to that handler, so a single outside pointer interaction
42
+ // emits `dismiss` once instead of twice. `onFocusout` then only dismisses on keyboard focus moves (Tab / Shift+Tab).
43
+ isPointerInteraction = false;
44
+ // Tracks whether the current pointer gesture *started* inside the trigger or panel. A `click` only fires on the
45
+ // nearest common ancestor of `mousedown`/`mouseup`, so pressing inside the panel (e.g. starting a text selection),
46
+ // dragging out and releasing outside retargets the resulting `click` to an ancestor *outside* the popover. Without
47
+ // this flag `onClickOutside` would then wrongly dismiss. Captured at `pointerdown` time (where `composedPath()` is
48
+ // still valid) and consumed on the following `click`, so dismissal only happens when the gesture started outside too.
49
+ isPointerDownInside = false;
50
+ // Keeps the panel on the #top-layer during its fade-out (Chromium via `overlay`; Safari/Firefox via a deferred hide).
51
+ topLayer = utilsEntry.createTopLayerController({
52
+ getElement: () => this.props.refPopover,
53
+ isShown: () => !!this.props.refPopover?.matches(':popover-open'),
54
+ show: () => this.props.refPopover?.showPopover(),
55
+ hide: () => this.props.refPopover?.hidePopover(),
56
+ });
57
+ get isControlled() {
58
+ // Controlled mode is opted into purely by passing a boolean `open`; an omitted (`undefined`) prop means the
59
+ // component manages its own visibility.
60
+ return typeof this.props.open === 'boolean';
61
+ }
62
+ get effectiveOpen() {
63
+ // Single source of truth for "is the panel currently open", regardless of mode: the consumer-owned `open` prop in
64
+ // controlled mode, the internal `isOpen` state otherwise. All render/positioning/dismissal logic reads this.
65
+ return this.props.isControlled ? this.props.open : this.props.isOpen;
66
+ }
67
+ get triggerElement() {
68
+ // Resolves the element that actually acts as the trigger: the default info button in the Shadow DOM, or — when a
69
+ // custom trigger is projected through the `button` slot — the assigned light-DOM element itself (not the `<slot>`).
70
+ // Using the assigned element gives Floating UI an accurate anchor rect and lets `:host` use `display: contents`.
71
+ // Kept correct across dynamic slot changes by the `observeChildren` re-render in `connectedCallback`.
72
+ return this.props.refButton ?? ((this.props.refSlotButton)?.assignedElements()[0]);
73
+ }
27
74
  render() {
28
75
  const { namedSlotChildren} = splitChildren.splitChildren(this.props.children);
29
76
  const hasSlottedButton = namedSlotChildren.filter(({ props: { slot } }) => slot === 'button').length > 0;
30
- const style = minifyCss.minifyCss(stylesEntry.getPopoverCss()).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');
31
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [hasSlottedButton ? (jsxRuntime.jsx("slot", { name: "button" })) : (jsxRuntime.jsxs("button", { type: "button", ...utilsEntry.parseAndGetAriaAttributes({
32
- ...utilsEntry.parseAndGetAriaAttributes(this.props.aria),
33
- ...{ 'aria-expanded': this.props.isOpen },
34
- }), children: [jsxRuntime.jsx(icon_wrapper.PIcon, { className: "icon", name: "information" }), jsxRuntime.jsx("span", { className: "label", children: "More information" })] })), this.props.isOpen && (jsxRuntime.jsxs("div", { popover: "auto", children: [jsxRuntime.jsx("div", { className: "arrow" }), jsxRuntime.jsx("div", { className: "content", children: this.props.description ? jsxRuntime.jsx("p", { children: this.props.description }) : jsxRuntime.jsx("slot", {}) })] }))] })] }), this.props.children] }));
77
+ const id = 'popover';
78
+ const style = minifyCss.minifyCss(stylesEntry.getPopoverCss(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'));
79
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [hasSlottedButton ? (jsxRuntime.jsx("slot", { name: "button" })) : (jsxRuntime.jsx("button", { type: "button", "aria-label": "More information", "aria-details": id, ...utilsEntry.parseAndGetAriaAttributes(this.props.aria), "aria-expanded": this.props.effectiveOpen ? 'true' : 'false' })), jsxRuntime.jsxs("div", { id: id, popover: "manual", inert: !this.props.effectiveOpen, children: [jsxRuntime.jsx("div", { className: "arrow" }), this.props.description ? jsxRuntime.jsx("p", { children: this.props.description }) : jsxRuntime.jsx("slot", {})] })] })] }), this.props.children] }));
35
80
  }
36
81
  }
37
82
 
@@ -3847,7 +3847,7 @@ const OPTION_LIST_SAFE_ZONE = 6;
3847
3847
 
3848
3848
  const getCDNBaseURL = () => global.PORSCHE_DESIGN_SYSTEM_CDN_URL + "/porsche-design-system";
3849
3849
 
3850
- const prefix = `[Porsche Design System v${"4.3.0"}]` // this part isn't covered by unit tests
3850
+ const prefix = `[Porsche Design System v${"4.4.0-rc.0"}]` // this part isn't covered by unit tests
3851
3851
  ;
3852
3852
  const consoleError = (...messages) => {
3853
3853
  console.error(prefix, ...messages);
@@ -3982,11 +3982,11 @@ const cssVarSummaryTopDeprecated = '--p-accordion-position-sticky-top'; // depre
3982
3982
  /**
3983
3983
  * @css-variable {"name": "--p-accordion-px", "description": "Horizontal padding of the accordion.", "defaultValue": "16px"}
3984
3984
  */
3985
- const cssVarPaddingInline$1 = '--p-accordion-px';
3985
+ const cssVarPaddingInline$2 = '--p-accordion-px';
3986
3986
  /**
3987
3987
  * @css-variable {"name": "--p-accordion-py", "description": "Vertical padding of the accordion.", "defaultValue": "16px"}
3988
3988
  */
3989
- const cssVarPaddingBlock = '--p-accordion-py';
3989
+ const cssVarPaddingBlock$1 = '--p-accordion-py';
3990
3990
  const iconMarker = getInlineSVGBackgroundImage(`<path d="m12 15.125h-.001l-.005-.006-6.494-5.476.642-.768 5.858 4.94 5.858-4.94.642.769-6.497 5.477z"/>`);
3991
3991
  const backgroundMap$1 = {
3992
3992
  canvas: ref(colorCanvas),
@@ -4067,7 +4067,7 @@ const getComponentCss$1a = (alignMarker, background, isCompact, indent, isOpen,
4067
4067
  gridTemplate: `repeat(2, auto) / ${hasSummaryBefore ? 'auto ' : ''}${isIconAlignedStart ? 'auto minmax(0, 1fr)' : 'minmax(0, 1fr) auto'}${hasSummaryAfter ? ' auto ' : ''}`,
4068
4068
  columnGap: gap,
4069
4069
  alignItems: 'center',
4070
- padding: `${ref(cssVarPaddingBlock, background === 'none' ? '0' : paddingBlock)} ${ref(cssVarPaddingInline$1, background === 'none' ? '0' : paddingInline)}`,
4070
+ padding: `${ref(cssVarPaddingBlock$1, background === 'none' ? '0' : paddingBlock)} ${ref(cssVarPaddingInline$2, background === 'none' ? '0' : paddingInline)}`,
4071
4071
  background: backgroundMap$1[background],
4072
4072
  ...(background === 'frosted' && {
4073
4073
  WebkitBackdropFilter: ref(blurFrosted),
@@ -4077,7 +4077,7 @@ const getComponentCss$1a = (alignMarker, background, isCompact, indent, isOpen,
4077
4077
  ...forcedColorsMediaQuery({
4078
4078
  outline: '1px solid CanvasText',
4079
4079
  outlineOffset: background === 'none' ? '0' : '-1px',
4080
- padding: `${ref(cssVarPaddingBlock, paddingBlock)} ${ref(cssVarPaddingInline$1, paddingInline)}`,
4080
+ padding: `${ref(cssVarPaddingBlock$1, paddingBlock)} ${ref(cssVarPaddingInline$2, paddingInline)}`,
4081
4081
  }),
4082
4082
  '&::details-content': addImportantToEachRule({
4083
4083
  display: 'contents', // allows <details> to be used as grid layout
@@ -4102,8 +4102,8 @@ const getComponentCss$1a = (alignMarker, background, isCompact, indent, isOpen,
4102
4102
  opacity: 1,
4103
4103
  paddingTop,
4104
4104
  zIndex: 2, // Ensure details are above summary when using custom padding
4105
- paddingInline: `${ref(cssVarPaddingInline$1, background === 'none' ? '0' : paddingInline)}`,
4106
- marginInline: `calc(-1 * ${ref(cssVarPaddingInline$1, background === 'none' ? '0' : paddingInline)})`,
4105
+ paddingInline: `${ref(cssVarPaddingInline$2, background === 'none' ? '0' : paddingInline)}`,
4106
+ marginInline: `calc(-1 * ${ref(cssVarPaddingInline$2, background === 'none' ? '0' : paddingInline)})`,
4107
4107
  // as soon as all browsers support calc-size(auto) to be transitionable, we can remove the grid-template-rows rule and animation
4108
4108
  gridTemplateRows: '1fr',
4109
4109
  visibility: 'inherit', // since `::details-content` and `allow-discrete` transition doesn't work in Safari we need to take care ourselves for visibility state to be a11y compliant
@@ -4120,8 +4120,8 @@ const getComponentCss$1a = (alignMarker, background, isCompact, indent, isOpen,
4120
4120
  gridTemplateColumns: 'subgrid',
4121
4121
  alignItems: 'center',
4122
4122
  cursor: 'pointer',
4123
- padding: `${ref(cssVarPaddingBlock, background === 'none' ? '0' : paddingBlock)} ${ref(cssVarPaddingInline$1, background === 'none' ? '0' : paddingInline)}`,
4124
- margin: `calc(-1 * ${ref(cssVarPaddingBlock, background === 'none' ? '0' : paddingBlock)}) calc(-1 * ${ref(cssVarPaddingInline$1, background === 'none' ? '0' : paddingInline)})`,
4123
+ padding: `${ref(cssVarPaddingBlock$1, background === 'none' ? '0' : paddingBlock)} ${ref(cssVarPaddingInline$2, background === 'none' ? '0' : paddingInline)}`,
4124
+ margin: `calc(-1 * ${ref(cssVarPaddingBlock$1, background === 'none' ? '0' : paddingBlock)}) calc(-1 * ${ref(cssVarPaddingInline$2, background === 'none' ? '0' : paddingInline)})`,
4125
4125
  ...(isSticky &&
4126
4126
  (background === 'canvas' || background === 'surface') && {
4127
4127
  position: 'sticky',
@@ -5205,7 +5205,7 @@ const getComponentCss$14 = (isSidebarStartOpen, isSidebarEndOpen, background) =>
5205
5205
  /**
5206
5206
  * @css-variable {"name": "--p-carousel-px", "description": "Defines the logical inline start and end padding of the carousel, the extra space is used to show parts of the next/previous slide. When used then the prop `width` has no effect anymore.", "defaultValue": ""}
5207
5207
  */
5208
- const cssVarPaddingInline = '--p-carousel-px';
5208
+ const cssVarPaddingInline$1 = '--p-carousel-px';
5209
5209
  /**
5210
5210
  * @css-variable {"name": "--p-carousel-ps", "description": "Defines the logical inline start padding of the carousel, the extra space is used to show parts of the next/previous slide. Needs to be used in combination with `--p-carousel-px` or `--p-carousel-pe`. When used then the prop `width` has no effect anymore.", "defaultValue": ""}
5211
5211
  */
@@ -5324,17 +5324,17 @@ const getComponentCss$13 = (gradient, hasHeading, hasDescription, hasControlsSlo
5324
5324
  },
5325
5325
  header: {
5326
5326
  display: 'grid',
5327
- paddingInlineStart: ref(cssVarPaddingInlineStart, ref(cssVarPaddingInline, spacingMap[width].base)),
5328
- paddingInlineEnd: ref(cssVarPaddingInlineEnd, ref(cssVarPaddingInline, spacingMap[width].base)),
5327
+ paddingInlineStart: ref(cssVarPaddingInlineStart, ref(cssVarPaddingInline$1, spacingMap[width].base)),
5328
+ paddingInlineEnd: ref(cssVarPaddingInlineEnd, ref(cssVarPaddingInline$1, spacingMap[width].base)),
5329
5329
  [mediaQueryS]: {
5330
5330
  gridTemplateColumns: 'minmax(0px,1fr) auto',
5331
- paddingInlineStart: ref(cssVarPaddingInlineStart, ref(cssVarPaddingInline, spacingMap[width].s)),
5332
- paddingInlineEnd: ref(cssVarPaddingInlineEnd, ref(cssVarPaddingInline, spacingMap[width].s)),
5331
+ paddingInlineStart: ref(cssVarPaddingInlineStart, ref(cssVarPaddingInline$1, spacingMap[width].s)),
5332
+ paddingInlineEnd: ref(cssVarPaddingInlineEnd, ref(cssVarPaddingInline$1, spacingMap[width].s)),
5333
5333
  ...(hasNavigation && { columnGap: ref(spacingStaticMd) }),
5334
5334
  },
5335
5335
  [mediaQueryXXL]: {
5336
- paddingInlineStart: ref(cssVarPaddingInlineStart, ref(cssVarPaddingInline, spacingMap[width].xxl)),
5337
- paddingInlineEnd: ref(cssVarPaddingInlineEnd, ref(cssVarPaddingInline, spacingMap[width].xxl)),
5336
+ paddingInlineStart: ref(cssVarPaddingInlineStart, ref(cssVarPaddingInline$1, spacingMap[width].xxl)),
5337
+ paddingInlineEnd: ref(cssVarPaddingInlineEnd, ref(cssVarPaddingInline$1, spacingMap[width].xxl)),
5338
5338
  },
5339
5339
  },
5340
5340
  nav: {
@@ -5371,15 +5371,15 @@ const getComponentCss$13 = (gradient, hasHeading, hasDescription, hasControlsSlo
5371
5371
  // !important is necessary to override inline styles set by splide library
5372
5372
  ...addImportantToEachRule({
5373
5373
  paddingBlock: '0px',
5374
- paddingInlineStart: ref(cssVarPaddingInlineStart, ref(cssVarPaddingInline, spacingMap[width].base)),
5375
- paddingInlineEnd: ref(cssVarPaddingInlineEnd, ref(cssVarPaddingInline, spacingMap[width].base)),
5374
+ paddingInlineStart: ref(cssVarPaddingInlineStart, ref(cssVarPaddingInline$1, spacingMap[width].base)),
5375
+ paddingInlineEnd: ref(cssVarPaddingInlineEnd, ref(cssVarPaddingInline$1, spacingMap[width].base)),
5376
5376
  [mediaQueryS]: {
5377
- paddingInlineStart: ref(cssVarPaddingInlineStart, ref(cssVarPaddingInline, spacingMap[width].s)),
5378
- paddingInlineEnd: ref(cssVarPaddingInlineEnd, ref(cssVarPaddingInline, spacingMap[width].s)),
5377
+ paddingInlineStart: ref(cssVarPaddingInlineStart, ref(cssVarPaddingInline$1, spacingMap[width].s)),
5378
+ paddingInlineEnd: ref(cssVarPaddingInlineEnd, ref(cssVarPaddingInline$1, spacingMap[width].s)),
5379
5379
  },
5380
5380
  [mediaQueryXXL]: {
5381
- paddingInlineStart: ref(cssVarPaddingInlineStart, ref(cssVarPaddingInline, spacingMap[width].xxl)),
5382
- paddingInlineEnd: ref(cssVarPaddingInlineEnd, ref(cssVarPaddingInline, spacingMap[width].xxl)),
5381
+ paddingInlineStart: ref(cssVarPaddingInlineStart, ref(cssVarPaddingInline$1, spacingMap[width].xxl)),
5382
+ paddingInlineEnd: ref(cssVarPaddingInlineEnd, ref(cssVarPaddingInline$1, spacingMap[width].xxl)),
5383
5383
  },
5384
5384
  }),
5385
5385
  '&--draggable': {
@@ -5657,8 +5657,20 @@ const getFunctionalComponentLabelAfterStyles = () => {
5657
5657
  const labelAfterStyles = {
5658
5658
  display: 'inline-block',
5659
5659
  verticalAlign: 'top',
5660
+ // The inline-start spacing is applied to the assigned elements via `::slotted(*)` (not to the `<slot>` box or via
5661
+ // `:empty`), so it only exists when the "label-after" slot actually has content — an empty slot renders no margin.
5662
+ // `::slotted()` alone would fail for a slotted `p-popover`, whose `:host` uses `display: contents` (a `contents` box
5663
+ // has no margins). To fix that, we also set `display: inline-block` on the slotted element: since `::slotted()` is a
5664
+ // rule from the *outer* shadow tree, its normal declarations win over the popover's own (inner-tree) normal
5665
+ // `:host { display: contents }` in the shadow-tree cascade — this is a cascade/context precedence, not specificity.
5666
+ // The re-established inline-block box then has something for `margin-inline-start` to apply to.
5667
+ // Note: relies on `p-popover`'s `:host { display: contents }` staying non-`!important`; an inner `!important` would
5668
+ // beat this outer normal declaration. Keeping inline flow (vs. flex/gap) lets label-after follow a wrapped label's
5669
+ // last line. `:host(:has([slot="label-after"]))` would be an alternative but lacks reliable Chrome support for now.
5660
5670
  '&::slotted(*)': {
5661
5671
  ...addImportantToEachRule({
5672
+ display: 'inline-block',
5673
+ verticalAlign: 'top',
5662
5674
  marginInlineStart: ref(spacingStaticXs$1),
5663
5675
  }),
5664
5676
  },
@@ -7044,7 +7056,7 @@ const getComponentCss$W = (size) => {
7044
7056
  /**
7045
7057
  * @css-variable {"name": "--p-flyout-width", "description": "Width of the flyout.", "defaultValue": "auto"}
7046
7058
  */
7047
- const cssVariableWidth$2 = '--p-flyout-width';
7059
+ const cssVariableWidth$3 = '--p-flyout-width';
7048
7060
  /**
7049
7061
  * @css-variable {"name": "--p-flyout-sticky-top", "description": "@experimental Exposes the header's height as a read-only CSS variable, set automatically by the component. Slotted sticky content can use this value to offset their top position correctly."}
7050
7062
  */
@@ -7127,7 +7139,7 @@ const getComponentCss$V = (isOpen, background, backdrop, position, hasHeader, ha
7127
7139
  },
7128
7140
  }
7129
7141
  : {
7130
- width: ref(cssVariableWidth$2, 'auto'),
7142
+ width: ref(cssVariableWidth$3, 'auto'),
7131
7143
  minWidth: '320px',
7132
7144
  maxWidth: '100vw',
7133
7145
  clipPath: isPositionStart
@@ -7900,7 +7912,7 @@ const getComponentCss$D = (icon, iconSource, variant, hideLabel, hasSlottedAncho
7900
7912
  * @css-variable {"name": "--p-modal-spacing-top", "description": "Spacing of the modal to the top.", "defaultValue": "clamp(16px, 10vh, 192px)"}
7901
7913
  * @css-variable {"name": "--p-modal-spacing-bottom", "description": "Spacing of the modal to the bottom.", "defaultValue": "clamp(16px, 10vh, 192px)"}
7902
7914
  */
7903
- const cssVariableWidth$1 = '--p-modal-width';
7915
+ const cssVariableWidth$2 = '--p-modal-width';
7904
7916
  const cssVariableSpacingTop = '--p-modal-spacing-top'; // TODO: maybe --p-modal-spacing-block-start would be more precise?
7905
7917
  const cssVariableSpacingBottom = '--p-modal-spacing-bottom'; // TODO: maybe --p-modal-spacing-block-end would be more precise?
7906
7918
  /**
@@ -7960,7 +7972,7 @@ const getComponentCss$C = (isOpen, background, backdrop, fullscreen, hasDismissB
7960
7972
  clipPath: 'none', // fullscreen has square corners, so disable corner clipping
7961
7973
  }
7962
7974
  : {
7963
- width: ref(cssVariableWidth$1, 'auto'),
7975
+ width: ref(cssVariableWidth$2, 'auto'),
7964
7976
  minWidth: '276px', // to be in sync with "Porsche Grid" on viewport = 320px: calc(${gridColumnWidthBase} * 6 + ${gridGap} * 5)
7965
7977
  maxWidth: '1535.5px', // to be in sync with "Porsche Grid" on viewport >= 1920px: `calc(${gridColumnWidthXXL} * 14 + ${gridGap} * 13)`
7966
7978
  placeSelf: 'center',
@@ -7986,11 +7998,11 @@ const getSvgUrl = (model) => {
7986
7998
  /**
7987
7999
  * @css-variable {"name": "--p-model-signature-width", "description": "Overrides the width of the model signature.", "defaultValue": ""}
7988
8000
  */
7989
- const cssVariableWidth = '--p-model-signature-width';
8001
+ const cssVariableWidth$1 = '--p-model-signature-width';
7990
8002
  /**
7991
8003
  * @css-variable {"name": "--p-model-signature-height", "description": "Overrides the height of the model signature.", "defaultValue": "auto"}
7992
8004
  */
7993
- const cssVariableHeight = '--p-model-signature-height';
8005
+ const cssVariableHeight$1 = '--p-model-signature-height';
7994
8006
  /**
7995
8007
  * @css-variable {"name": "--p-model-signature-color", "description": "Overrides the fill color of the model signature. Overrides the `color` property when set.", "defaultValue": ""}
7996
8008
  */
@@ -8013,8 +8025,8 @@ const getComponentCss$B = (model, safeZone, size, color) => {
8013
8025
  maxWidth: '100%',
8014
8026
  maxHeight: '100%',
8015
8027
  // width + height style can't be !important atm to be backwards compatible with e.g. `<p-model-signature size="inherit" style="height: 50px"/>`
8016
- width: ref(cssVariableWidth, isSizeInherit ? 'auto' : `${width}px`),
8017
- height: ref(cssVariableHeight, 'auto'),
8028
+ width: ref(cssVariableWidth$1, isSizeInherit ? 'auto' : `${width}px`),
8029
+ height: ref(cssVariableHeight$1, 'auto'),
8018
8030
  ...addImportantToEachRule({
8019
8031
  mask: `url(${getSvgUrl(model)}) no-repeat left top / contain`,
8020
8032
  aspectRatio: `${width} / ${safeZone ? 36 : height}`, // 36px is the max-height for SVG model signature creation
@@ -8345,97 +8357,201 @@ const getComponentCss$w = (hideLabel, state, isDisabled, isLoading, length, isCo
8345
8357
  });
8346
8358
  };
8347
8359
 
8360
+ // Minimum gap (in px) kept between the panel and the viewport edges. Used both as Floating UI `shift`/`flip` padding
8361
+ // and to inset the panel's default max-width/height (`100dvw/dvh - 2 * POPOVER_SAFE_ZONE`) so it never touches the edge.
8348
8362
  const POPOVER_SAFE_ZONE = 8;
8349
8363
 
8350
- const getComponentCss$v = () => {
8351
- const shadowColor = 'rgba(0,0,0,0.3)';
8352
- return getCss({
8364
+ /**
8365
+ * @css-variable {"name": "--p-popover-w", "description": "Width of the popover.", "defaultValue": "max-content"}
8366
+ */
8367
+ const cssVariableWidth = '--p-popover-w';
8368
+ /**
8369
+ * @css-variable {"name": "--p-popover-h", "description": "Height of the popover.", "defaultValue": "auto"}
8370
+ */
8371
+ const cssVariableHeight = '--p-popover-h';
8372
+ /**
8373
+ * @css-variable {"name": "--p-popover-min-w", "description": "Min width of the popover.", "defaultValue": "0px"}
8374
+ */
8375
+ const cssVariableMinWidth = '--p-popover-min-w';
8376
+ /**
8377
+ * @css-variable {"name": "--p-popover-min-h", "description": "Min height of the popover.", "defaultValue": "auto"}
8378
+ */
8379
+ const cssVariableMinHeight = '--p-popover-min-h';
8380
+ /**
8381
+ * @css-variable {"name": "--p-popover-max-w", "description": "Max width of the popover.", "defaultValue": "min(calc(100dvw - 16px), 48ch)"}
8382
+ */
8383
+ const cssVariableMaxWidth = '--p-popover-max-w';
8384
+ /**
8385
+ * @css-variable {"name": "--p-popover-max-h", "description": "Max height of the popover.", "defaultValue": "calc(100dvh - 16px)"}
8386
+ */
8387
+ const cssVariableMaxHeight = '--p-popover-max-h';
8388
+ /**
8389
+ * @css-variable {"name": "--p-popover-px", "description": "Horizontal padding of the popover. It is recommended to apply an existing Porsche Design System spacing token, e.g. the CSS declaration `--p-popover-px: var(--p-spacing-static-md)`, the Tailwind CSS arbitrary property `[--p-popover-px:var(--spacing-static-md)]` or the equivalent SCSS/JS token.", "defaultValue": "16px"}
8390
+ */
8391
+ const cssVarPaddingInline = '--p-popover-px';
8392
+ /**
8393
+ * @css-variable {"name": "--p-popover-py", "description": "Vertical padding of the popover. It is recommended to apply an existing Porsche Design System spacing token, e.g. the CSS declaration `--p-popover-py: var(--p-spacing-static-sm)`, the Tailwind CSS arbitrary property `[--p-popover-py:var(--spacing-static-sm)]` or the equivalent SCSS/JS token.", "defaultValue": "12px"}
8394
+ */
8395
+ const cssVarPaddingBlock = '--p-popover-py';
8396
+ /**
8397
+ * @css-variable {"name": "--p-popover-radius", "description": "Border radius of the popover. It is recommended to apply an existing Porsche Design System border-radius token, e.g. the CSS declaration `--p-popover-radius: var(--p-radius-lg)`, the Tailwind CSS arbitrary property `[--p-popover-radius:var(--radius-lg)]` or the equivalent SCSS/JS token.", "defaultValue": "12px"}
8398
+ */
8399
+ const cssVarRadius = '--p-popover-radius';
8400
+ const iconInfo = getInlineSVGBackgroundImage(`<path d="M12.5 10v6h-1v-6zm0-2v1h-1V8zM12 4a8 8 0 0 1 0 16 8 8 0 0 1 0-16m0-1c-4.95 0-9 4.05-9 9s4.05 9 9 9 9-4.05 9-9-4.05-9-9-9"/>`);
8401
+ /**
8402
+ * Builds the popover's scoped CSS.
8403
+ * @param isOpen - The effective open state; drives the fade-in/fade-out direction and the `@starting-style` append.
8404
+ * @param isCompact - Reduces padding/spacing and uses smaller radii (mirrors the `compact` prop).
8405
+ * @returns The component CSS string, with a trailing `@starting-style` rule appended while opening.
8406
+ */
8407
+ const getComponentCss$v = (isOpen, isCompact) => {
8408
+ // fade-in on open (via `@starting-style` below), fade-out on close. While closing, the panel keeps `display: grid`
8409
+ // (Chromium via `overlay` + `display` `allow-discrete`; Safari/Firefox via the deferred `hidePopover()`), so
8410
+ // `display: none` only describes the fully-closed terminal state. Tabbability / a11y-tree removal during the fade-out
8411
+ // is handled immediately via the `inert` attribute on the panel (see popover.tsx), so no `visibility` toggle is needed.
8412
+ const transition = getTransition('opacity', 'short', isOpen ? 'in' : 'out');
8413
+ const css = getCss({
8353
8414
  '@global': {
8354
- '@keyframes fade-in': {
8355
- from: {
8356
- opacity: 0,
8357
- },
8358
- to: {
8359
- opacity: 1,
8360
- },
8361
- },
8362
8415
  ':host': {
8363
- position: 'relative', // ensures correct reference for floating ui fallback positioning in older browsers
8364
- display: 'inline-block',
8365
- verticalAlign: 'top',
8366
- ...addImportantToEachRule({
8367
- ...hostHiddenStyles,
8368
- }),
8416
+ // `display: contents` so the host box does not participate in visual DOM rendering — the popover mimics the
8417
+ // native `[popover]` element, so the slotted trigger (or default info button) lays out directly in the parent
8418
+ // flow. Enabled by anchoring Floating UI to the assigned trigger element (see `triggerElement` in popover.tsx)
8419
+ // instead of the `<slot>` box, so the slot no longer needs a layout box of its own.
8420
+ display: 'contents',
8421
+ ...addImportantToEachRule(hostHiddenStyles),
8369
8422
  },
8370
- 'slot[name="button"]': {
8423
+ 'slot:not([name]), p': {
8371
8424
  display: 'block',
8372
- },
8373
- ...preventFoucOfNestedElementsStyles,
8374
- p: {
8375
- font: `${ref(fontWeightNormal$1)} ${ref(typescaleSm$1)} / ${ref(leadingNormal$1)} ${ref(fontPorscheNext$1)}`,
8376
- margin: 0,
8425
+ margin: 0, // reset ua-style for paragraphs
8426
+ minWidth: 0, // allow the grid item to shrink below its content size (needed for correct clamping via --p-popover-max-w)
8427
+ minHeight: 0, // allow the grid item to shrink below its content size so overflow scrolls instead of expanding the panel (needed for --p-popover-max-h)
8428
+ maxWidth: 'inherit',
8429
+ maxHeight: 'inherit',
8430
+ boxSizing: 'border-box',
8431
+ padding: `${ref(cssVarPaddingBlock, isCompact ? ref(spacingStaticXs$1) : `calc(12 * ${ref(spacingStatic2Xs)})`)} ${ref(cssVarPaddingInline, isCompact ? ref(spacingStaticSm$1) : ref(spacingStaticMd))}`,
8432
+ overflow: 'hidden auto',
8433
+ overscrollBehaviorY: 'none',
8377
8434
  },
8378
8435
  button: {
8379
8436
  all: 'unset',
8380
- display: 'block',
8437
+ display: 'inline-grid',
8438
+ verticalAlign: 'top',
8381
8439
  font: `${ref(typescaleSm$1)} ${ref(fontPorscheNext$1)}`, // needed for correct width/height definition based on ex-unit
8382
- width: ref(leadingNormal$1), // width needed to improve ssr support
8383
- height: ref(leadingNormal$1), // height needed to improve ssr support
8440
+ width: ref(leadingNormal$1),
8441
+ height: ref(leadingNormal$1),
8384
8442
  borderRadius: ref(radiusFull),
8385
8443
  cursor: 'pointer',
8386
- backgroundColor: ref(colorFrosted),
8444
+ background: ref(colorFrosted),
8387
8445
  transition: getTransition('background-color'),
8388
8446
  WebkitBackdropFilter: ref(blurFrosted),
8389
8447
  backdropFilter: ref(blurFrosted),
8390
8448
  ...hoverMediaQuery({
8391
8449
  '&:hover': {
8392
- backgroundColor: ref(colorFrostedSoft),
8450
+ background: ref(colorFrostedSoft),
8393
8451
  },
8394
8452
  }),
8395
8453
  '&:focus-visible': getFocusBaseStyles(),
8454
+ '&::after': {
8455
+ content: '""',
8456
+ WebkitMask: `${iconInfo} center/contain no-repeat`, // necessary for Sogou browser support :-)
8457
+ mask: `${iconInfo} center/contain no-repeat`,
8458
+ background: ref(colorPrimary),
8459
+ ...forcedColorsMediaQuery({
8460
+ background: 'CanvasText',
8461
+ }),
8462
+ },
8396
8463
  },
8397
8464
  '[popover]': {
8398
8465
  all: 'unset',
8399
- position: 'absolute',
8400
- pointerEvents: 'none',
8401
- filter: `drop-shadow(0 0 16px ${shadowColor})`,
8466
+ position: 'fixed', // matches floating ui's `fixed` strategy; required for correct top-layer positioning in Safari
8467
+ top: 0,
8468
+ left: 0,
8469
+ filter: 'drop-shadow(0 0 16px rgba(0,0,0,.3))',
8402
8470
  backdropFilter: 'drop-shadow(0 0 transparent)', // workaround for Firefox bug not rendering PDS frosted glass correctly when nested inside CSS filter: https://bugzilla.mozilla.org/show_bug.cgi?id=1797051
8403
- animation: `${ref(cssVariableAnimationDuration, ref(durationSm))} fade-in ${ref(easeInOut)} forwards`,
8404
- '&:not(:popover-open)': {
8405
- display: 'none', // ensures popover is not flickering when closed in some situations
8471
+ borderRadius: ref(cssVarRadius, isCompact ? ref(radiusLg) : ref(radiusXl)),
8472
+ // Fallback for engines without CSS relative color syntax (< Chromium 119 / Safari 16.4 / Firefox 128): the
8473
+ // `hsl(from …)` override below would be an invalid value and get dropped, leaving the panel with no background.
8474
+ // The plain `light-dark()` token renders correct white (light) / near-black (dark) as graceful degradation.
8475
+ background: ref(colorCanvas),
8476
+ // Relative color syntax: lightens ONLY the dark scheme (light `#fff` clamps at l=100 → stays white; dark
8477
+ // `l≈1.2%` → `≈15.2%`). Feature-test string kept in sync with `spinner-styles.ts` (one relative-color feature
8478
+ // covers all color functions).
8479
+ '@supports (color: oklch(from red l c h))': {
8480
+ background: `hsl(from ${ref(colorCanvas)} h 0% calc(l + 14))`,
8481
+ },
8482
+ font: `${ref(fontWeightNormal$1)} ${ref(typescaleSm$1)} / ${ref(leadingNormal$1)} ${ref(fontPorscheNext$1)}`,
8483
+ color: ref(colorPrimary),
8484
+ width: ref(cssVariableWidth, 'max-content'),
8485
+ height: ref(cssVariableHeight, 'auto'),
8486
+ minWidth: ref(cssVariableMinWidth, '0px'),
8487
+ minHeight: ref(cssVariableMinHeight, 'auto'),
8488
+ maxWidth: ref(cssVariableMaxWidth, `min(calc(100dvw - ${POPOVER_SAFE_ZONE * 2}px), 48ch)`),
8489
+ maxHeight: ref(cssVariableMaxHeight, `calc(100dvh - ${POPOVER_SAFE_ZONE * 2}px)`),
8490
+ opacity: isOpen ? 1 : 0,
8491
+ transition,
8492
+ // keep the popover on the #top-layer while the fade-out runs (Chromium only; see `overlayTransitionSupportsQuery`)
8493
+ ...overlayTransitionSupportsQuery({
8494
+ transition: `${transition},${getTransition('overlay', 'short', isOpen ? 'in' : 'out')} allow-discrete,${getTransition('display', 'short', isOpen ? 'in' : 'out')} allow-discrete`,
8495
+ }),
8496
+ // Unlike `opacity` (driven by the `isOpen` render flag), `overlay` and `display` are toggled via the
8497
+ // `:popover-open` UA state instead of `isOpen`. Both are owned by the browser: they only flip once
8498
+ // `showPopover()` / `hidePopover()` actually promote/remove the element to/from the #top-layer. Driving them
8499
+ // from `isOpen` would desync from that native state — e.g. Safari/Firefox defer `hidePopover()` until the
8500
+ // fade-out ends (see `createTopLayerController`), so `display` must stay `grid` while `:popover-open` is still
8501
+ // truthy; an `isOpen`-based `display: none` would hide the panel instantly and kill the fade. Binding to
8502
+ // `:popover-open` keeps CSS in lockstep with the browser across all engines, while the Chromium-only
8503
+ // `allow-discrete` transition above animates the discrete `overlay`/`display` switch during the fade-out.
8504
+ overlay: 'none',
8505
+ display: 'none',
8506
+ '&:popover-open': {
8507
+ overlay: 'auto',
8508
+ display: 'grid',
8509
+ },
8510
+ ...forcedColorsMediaQuery({
8511
+ outline: '2px solid CanvasText',
8512
+ outlineOffset: '-2px',
8513
+ }),
8514
+ '&::backdrop': {
8515
+ display: 'none', // reset ua-style
8406
8516
  },
8407
8517
  },
8408
8518
  },
8409
- label: getHiddenTextJssStyle(),
8410
- icon: {
8411
- transform: 'translate3d(0,0,0)', // Fixes movement on hover in Safari
8412
- },
8413
8519
  arrow: {
8414
8520
  position: 'absolute',
8415
8521
  width: '24px',
8416
8522
  height: '12px',
8417
8523
  clipPath: 'polygon(50% 0, 100% 110%, 0 110%)',
8418
- background: ref(colorCanvas),
8524
+ background: 'inherit',
8419
8525
  ...forcedColorsMediaQuery({
8420
8526
  background: 'CanvasText',
8421
8527
  }),
8422
8528
  },
8423
- content: {
8424
- maxWidth: `min(calc(100dvw - ${POPOVER_SAFE_ZONE * 2}px), 48ch)`,
8425
- width: 'max-content', // ensures in older browsers correct width
8426
- boxSizing: 'border-box',
8427
- padding: `${ref(spacingStaticSm$1)} ${ref(spacingStaticMd)}`,
8428
- pointerEvents: 'auto',
8429
- borderRadius: ref(radiusXl),
8430
- background: ref(colorCanvas),
8431
- font: `${ref(fontWeightNormal$1)} ${ref(typescaleSm$1)} / ${ref(leadingNormal$1)} ${ref(fontPorscheNext$1)}`,
8432
- color: ref(colorPrimary),
8433
- ...forcedColorsMediaQuery({
8434
- outline: '2px solid CanvasText',
8435
- outlineOffset: '-2px',
8436
- }),
8437
- },
8438
8529
  });
8530
+ // Fade-IN: `@starting-style` supplies the opacity the browser transitions *from* on the first rendered frame, i.e. the
8531
+ // moment the panel leaves `display: none` via `:popover-open` (triggered by `showPopover()`). Without it the panel
8532
+ // snaps to full opacity, because its computed `opacity` is already `1` by the time it is promoted out of `display:
8533
+ // none`. The fade-OUT needs no starting style (a rendered prior state already exists). Appended as raw CSS because the
8534
+ // JSS conditional-rule plugin only supports `@media`/`@supports`/`@container`, not `@starting-style`. Unsupported
8535
+ // engines (< Chromium 117 / Safari 17.5 / Firefox 129) ignore the unknown at-rule and skip the entry fade (graceful
8536
+ // degradation). Formatting mirrors JSS output so the unit-test CSS parser can read it.
8537
+ //
8538
+ // ALTERNATIVE APPROACH (not implemented) — mirror the `dialog-base` (p-modal/p-flyout) pattern and drop `@starting-style`:
8539
+ // • Keep the panel permanently rendered (never `display: none`); collapse the closed state via `visibility: hidden`
8540
+ // + `width/height: 0` instead. Because the element stays rendered, `opacity` fades normally in BOTH directions with
8541
+ // no `@starting-style`, and an initial `open=true` computes straight to `opacity: 1` (appears instantly, no entry
8542
+ // fade) — which fixes the one downside of the current approach (initial `open=true` fades in on page load).
8543
+ // • Caveat: drive `visibility` + `width/height` from the `isOpen` flag with a CLOSE-ONLY delayed transition
8544
+ // (`… 0s linear ${isOpen ? '0s' : motionDurationMap.short}`), NOT from `:popover-open`. `:popover-open` drops
8545
+ // immediately on Chromium (only Safari/FF defer `hidePopover()`), so `:popover-open`-bound dimensions would collapse
8546
+ // to 0 at the START of the Chromium fade-out and clip the panel mid-fade. The delay keeps size/visibility through
8547
+ // the fade and collapses them only afterwards. `:popover-open` then remains solely for `overlay` + the Chromium
8548
+ // `allow-discrete` top-layer retention.
8549
+ // • `visibility: hidden` still occupies layout (can cause scrollbars), which is why it must be paired with
8550
+ // `width/height: 0`. `inert` is still required either way (visibility is delayed, so the panel stays visible/
8551
+ // tabbable during the fade-out).
8552
+ // • Trade-off: removes the `@starting-style` raw-CSS append + the initial-load fade, at the cost of reintroducing the
8553
+ // delayed `visibility` plus delayed `width/height` and tighter coupling to the motion duration.
8554
+ return isOpen ? `${css}\n@starting-style {\n [popover] {\n opacity: 0;\n }\n}` : css;
8439
8555
  };
8440
8556
 
8441
8557
  const cssVarInternalRadioGroupOptionScaling = '--_p-radio-group-option-a';
@@ -3480,7 +3480,7 @@ const hasShowPickerSupport = () => (hasDocument &&
3480
3480
  'showPicker' in HTMLInputElement.prototype &&
3481
3481
  CSS.supports('selector(::-webkit-calendar-picker-indicator)'));
3482
3482
 
3483
- const prefix = `[Porsche Design System v${"4.3.0"}]` // this part isn't covered by unit tests
3483
+ const prefix = `[Porsche Design System v${"4.4.0-rc.0"}]` // this part isn't covered by unit tests
3484
3484
  ;
3485
3485
  const consoleError$1 = (...messages) => {
3486
3486
  console.error(prefix, ...messages);