@porsche-design-system/components-react 3.33.0-rc.0 → 3.34.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.
- package/CHANGELOG.md +15 -0
- package/cjs/lib/components/segmented-control.wrapper.cjs +3 -3
- package/esm/lib/components/segmented-control.wrapper.d.ts +8 -0
- package/esm/lib/components/segmented-control.wrapper.mjs +3 -3
- package/package.json +2 -2
- package/ssr/cjs/components/dist/styles/esm/styles-entry.cjs +17 -7
- package/ssr/cjs/components/dist/utils/esm/utils-entry.cjs +1 -1
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/components/segmented-control.wrapper.cjs +4 -4
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/accordion.cjs +1 -1
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/segmented-control.cjs +6 -4
- package/ssr/esm/components/dist/styles/esm/styles-entry.mjs +17 -7
- package/ssr/esm/components/dist/utils/esm/utils-entry.mjs +1 -1
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/segmented-control.wrapper.mjs +4 -4
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/accordion.mjs +1 -1
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/segmented-control.mjs +6 -4
- package/ssr/esm/lib/components/segmented-control.wrapper.d.ts +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -14,12 +14,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0),
|
|
|
14
14
|
|
|
15
15
|
## [Unreleased]
|
|
16
16
|
|
|
17
|
+
## [3.34.0-rc.0] - 2026-04-01
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- `Segmented Control`: `noWrap` property to render items inline with optional scroller
|
|
22
|
+
([#4244](https://github.com/porsche-design-system/porsche-design-system/pull/4244))
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- `Accordion`: missing `delegatesFocus`
|
|
27
|
+
([#4238](https://github.com/porsche-design-system/porsche-design-system/pull/4238))
|
|
28
|
+
|
|
29
|
+
## [3.33.0] - 2026-03-09
|
|
30
|
+
|
|
17
31
|
## [3.33.0-rc.0] - 2026-03-04
|
|
18
32
|
|
|
19
33
|
### Added
|
|
20
34
|
|
|
21
35
|
- `Tag`: new `variant` property to define background colors which complies now with PDS `v4`
|
|
22
36
|
([#4227](https://github.com/porsche-design-system/porsche-design-system/pull/4227))
|
|
37
|
+
- `Checkbox`: add warning for Firefox form restore bug
|
|
23
38
|
|
|
24
39
|
### Changed
|
|
25
40
|
|
|
@@ -6,17 +6,17 @@ var react = require('react');
|
|
|
6
6
|
var hooks = require('../../hooks.cjs');
|
|
7
7
|
var utils = require('../../utils.cjs');
|
|
8
8
|
|
|
9
|
-
const PSegmentedControl = /*#__PURE__*/ react.forwardRef(({ backgroundColor, columns = 'auto', compact = false, description = '', disabled = false, form, hideLabel = false, label = '', message = '', name, onBlur, onChange, onSegmentedControlChange, onUpdate, required = false, state = 'none', theme, value, className, ...rest }, ref) => {
|
|
9
|
+
const PSegmentedControl = /*#__PURE__*/ react.forwardRef(({ backgroundColor, columns = 'auto', compact = false, description = '', disabled = false, form, hideLabel = false, label = '', message = '', name, noWrap = false, onBlur, onChange, onSegmentedControlChange, onUpdate, required = false, state = 'none', theme, value, className, ...rest }, ref) => {
|
|
10
10
|
const elementRef = react.useRef(undefined);
|
|
11
11
|
hooks.useEventCallback(elementRef, 'blur', onBlur);
|
|
12
12
|
hooks.useEventCallback(elementRef, 'change', onChange);
|
|
13
13
|
hooks.useEventCallback(elementRef, 'segmentedControlChange', onSegmentedControlChange);
|
|
14
14
|
hooks.useEventCallback(elementRef, 'update', onUpdate);
|
|
15
15
|
const WebComponentTag = hooks.usePrefix('p-segmented-control');
|
|
16
|
-
const propsToSync = [backgroundColor, columns, compact, description, disabled, form, hideLabel, label, message, name, required, state, theme || hooks.useTheme(), value];
|
|
16
|
+
const propsToSync = [backgroundColor, columns, compact, description, disabled, form, hideLabel, label, message, name, noWrap, required, state, theme || hooks.useTheme(), value];
|
|
17
17
|
hooks.useBrowserLayoutEffect(() => {
|
|
18
18
|
const { current } = elementRef;
|
|
19
|
-
['backgroundColor', 'columns', 'compact', 'description', 'disabled', 'form', 'hideLabel', 'label', 'message', 'name', 'required', 'state', 'theme', 'value'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
19
|
+
['backgroundColor', 'columns', 'compact', 'description', 'disabled', 'form', 'hideLabel', 'label', 'message', 'name', 'noWrap', 'required', 'state', 'theme', 'value'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
20
20
|
}, propsToSync);
|
|
21
21
|
const props = {
|
|
22
22
|
...rest,
|
|
@@ -41,6 +41,10 @@ export type PSegmentedControlProps = BaseProps & {
|
|
|
41
41
|
* The name of the segmented-control.
|
|
42
42
|
*/
|
|
43
43
|
name?: string;
|
|
44
|
+
/**
|
|
45
|
+
* If true, prevents items from wrapping to new rows and renders them in a single scrollable row instead.
|
|
46
|
+
*/
|
|
47
|
+
noWrap?: boolean;
|
|
44
48
|
/**
|
|
45
49
|
* Emitted when the segmented-control has lost focus.
|
|
46
50
|
*/
|
|
@@ -115,6 +119,10 @@ export declare const PSegmentedControl: import("react").ForwardRefExoticComponen
|
|
|
115
119
|
* The name of the segmented-control.
|
|
116
120
|
*/
|
|
117
121
|
name?: string;
|
|
122
|
+
/**
|
|
123
|
+
* If true, prevents items from wrapping to new rows and renders them in a single scrollable row instead.
|
|
124
|
+
*/
|
|
125
|
+
noWrap?: boolean;
|
|
118
126
|
/**
|
|
119
127
|
* Emitted when the segmented-control has lost focus.
|
|
120
128
|
*/
|
|
@@ -4,17 +4,17 @@ import { forwardRef, useRef } from 'react';
|
|
|
4
4
|
import { useEventCallback, usePrefix, useTheme, useBrowserLayoutEffect, useMergedClass } from '../../hooks.mjs';
|
|
5
5
|
import { syncRef } from '../../utils.mjs';
|
|
6
6
|
|
|
7
|
-
const PSegmentedControl = /*#__PURE__*/ forwardRef(({ backgroundColor, columns = 'auto', compact = false, description = '', disabled = false, form, hideLabel = false, label = '', message = '', name, onBlur, onChange, onSegmentedControlChange, onUpdate, required = false, state = 'none', theme, value, className, ...rest }, ref) => {
|
|
7
|
+
const PSegmentedControl = /*#__PURE__*/ forwardRef(({ backgroundColor, columns = 'auto', compact = false, description = '', disabled = false, form, hideLabel = false, label = '', message = '', name, noWrap = false, onBlur, onChange, onSegmentedControlChange, onUpdate, required = false, state = 'none', theme, value, className, ...rest }, ref) => {
|
|
8
8
|
const elementRef = useRef(undefined);
|
|
9
9
|
useEventCallback(elementRef, 'blur', onBlur);
|
|
10
10
|
useEventCallback(elementRef, 'change', onChange);
|
|
11
11
|
useEventCallback(elementRef, 'segmentedControlChange', onSegmentedControlChange);
|
|
12
12
|
useEventCallback(elementRef, 'update', onUpdate);
|
|
13
13
|
const WebComponentTag = usePrefix('p-segmented-control');
|
|
14
|
-
const propsToSync = [backgroundColor, columns, compact, description, disabled, form, hideLabel, label, message, name, required, state, theme || useTheme(), value];
|
|
14
|
+
const propsToSync = [backgroundColor, columns, compact, description, disabled, form, hideLabel, label, message, name, noWrap, required, state, theme || useTheme(), value];
|
|
15
15
|
useBrowserLayoutEffect(() => {
|
|
16
16
|
const { current } = elementRef;
|
|
17
|
-
['backgroundColor', 'columns', 'compact', 'description', 'disabled', 'form', 'hideLabel', 'label', 'message', 'name', 'required', 'state', 'theme', 'value'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
17
|
+
['backgroundColor', 'columns', 'compact', 'description', 'disabled', 'form', 'hideLabel', 'label', 'message', 'name', 'noWrap', 'required', 'state', 'theme', 'value'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
18
18
|
}, propsToSync);
|
|
19
19
|
const props = {
|
|
20
20
|
...rest,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@porsche-design-system/components-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.34.0-rc.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": "3.
|
|
20
|
+
"@porsche-design-system/components-js": "3.34.0-rc.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"ag-grid-community": ">= 35.0.0 <36.0.0",
|
|
@@ -3643,7 +3643,7 @@ const hasShowPickerSupport = () => (hasDocument &&
|
|
|
3643
3643
|
'showPicker' in HTMLInputElement.prototype &&
|
|
3644
3644
|
CSS.supports('selector(::-webkit-calendar-picker-indicator)'));
|
|
3645
3645
|
|
|
3646
|
-
const prefix = `[Porsche Design System v${"3.
|
|
3646
|
+
const prefix = `[Porsche Design System v${"3.34.0-rc.0"}]` // this part isn't covered by unit tests
|
|
3647
3647
|
;
|
|
3648
3648
|
const consoleError = (...messages) => {
|
|
3649
3649
|
console.error(prefix, ...messages); // eslint-disable-line no-console
|
|
@@ -10293,7 +10293,10 @@ const getComponentCss$v = (compact, isDisabled, isSelected, state, hasIcon, hasS
|
|
|
10293
10293
|
}),
|
|
10294
10294
|
});
|
|
10295
10295
|
};
|
|
10296
|
-
|
|
10296
|
+
|
|
10297
|
+
const MIN_ITEM_WIDTH = 46;
|
|
10298
|
+
const MAX_ITEM_WIDTH = 220;
|
|
10299
|
+
const getComponentCss$u = (minWidth, maxWidth, columns, disabled, hideLabel, state, theme, noWrap) => {
|
|
10297
10300
|
return getCss({
|
|
10298
10301
|
'@global': {
|
|
10299
10302
|
':host': {
|
|
@@ -10308,11 +10311,13 @@ const getComponentCss$u = (minWidth, maxWidth, columns, disabled, hideLabel, sta
|
|
|
10308
10311
|
'slot:not([name])': {
|
|
10309
10312
|
display: 'grid',
|
|
10310
10313
|
gridAutoRows: '1fr', // for equal height
|
|
10311
|
-
...
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
:
|
|
10315
|
-
|
|
10314
|
+
...(noWrap
|
|
10315
|
+
? { gridAutoFlow: 'column', gridAutoColumns: 'max-content' }
|
|
10316
|
+
: buildResponsiveStyles(columns, (col) => ({
|
|
10317
|
+
gridTemplateColumns: col === 'auto'
|
|
10318
|
+
? `repeat(auto-fit, ${(maxWidth > MAX_ITEM_WIDTH && MAX_ITEM_WIDTH) || (maxWidth < MIN_ITEM_WIDTH && minWidth) || maxWidth}px)`
|
|
10319
|
+
: `repeat(${col}, minmax(0, 1fr))`,
|
|
10320
|
+
}))),
|
|
10316
10321
|
gap: '6px',
|
|
10317
10322
|
},
|
|
10318
10323
|
},
|
|
@@ -10330,6 +10335,11 @@ const getComponentCss$u = (minWidth, maxWidth, columns, disabled, hideLabel, sta
|
|
|
10330
10335
|
}),
|
|
10331
10336
|
// .message
|
|
10332
10337
|
...getFunctionalComponentStateMessageStyles(theme, state),
|
|
10338
|
+
...(noWrap && {
|
|
10339
|
+
scroller: {
|
|
10340
|
+
margin: `-${spacingStaticXSmall} 0`,
|
|
10341
|
+
},
|
|
10342
|
+
}),
|
|
10333
10343
|
});
|
|
10334
10344
|
};
|
|
10335
10345
|
|
|
@@ -3446,7 +3446,7 @@ const hasShowPickerSupport = () => (hasDocument &&
|
|
|
3446
3446
|
'showPicker' in HTMLInputElement.prototype &&
|
|
3447
3447
|
CSS.supports('selector(::-webkit-calendar-picker-indicator)'));
|
|
3448
3448
|
|
|
3449
|
-
const prefix = `[Porsche Design System v${"3.
|
|
3449
|
+
const prefix = `[Porsche Design System v${"3.34.0-rc.0"}]` // this part isn't covered by unit tests
|
|
3450
3450
|
;
|
|
3451
3451
|
const consoleError$1 = (...messages) => {
|
|
3452
3452
|
console.error(prefix, ...messages); // eslint-disable-line no-console
|
|
@@ -7,24 +7,24 @@ var hooks = require('../../hooks.cjs');
|
|
|
7
7
|
var utils = require('../../utils.cjs');
|
|
8
8
|
var segmentedControl = require('../dsr-components/segmented-control.cjs');
|
|
9
9
|
|
|
10
|
-
const PSegmentedControl = /*#__PURE__*/ react.forwardRef(({ backgroundColor, columns = 'auto', compact = false, description = '', disabled = false, form, hideLabel = false, label = '', message = '', name, onBlur, onChange, onSegmentedControlChange, onUpdate, required = false, state = 'none', theme, value, className, children, ...rest }, ref) => {
|
|
10
|
+
const PSegmentedControl = /*#__PURE__*/ react.forwardRef(({ backgroundColor, columns = 'auto', compact = false, description = '', disabled = false, form, hideLabel = false, label = '', message = '', name, noWrap = false, onBlur, onChange, onSegmentedControlChange, onUpdate, required = false, state = 'none', theme, value, className, children, ...rest }, ref) => {
|
|
11
11
|
const elementRef = react.useRef(undefined);
|
|
12
12
|
hooks.useEventCallback(elementRef, 'blur', onBlur);
|
|
13
13
|
hooks.useEventCallback(elementRef, 'change', onChange);
|
|
14
14
|
hooks.useEventCallback(elementRef, 'segmentedControlChange', onSegmentedControlChange);
|
|
15
15
|
hooks.useEventCallback(elementRef, 'update', onUpdate);
|
|
16
16
|
const WebComponentTag = hooks.usePrefix('p-segmented-control');
|
|
17
|
-
const propsToSync = [backgroundColor, columns, compact, description, disabled, form, hideLabel, label, message, name, required, state, theme || hooks.useTheme(), value];
|
|
17
|
+
const propsToSync = [backgroundColor, columns, compact, description, disabled, form, hideLabel, label, message, name, noWrap, required, state, theme || hooks.useTheme(), value];
|
|
18
18
|
hooks.useBrowserLayoutEffect(() => {
|
|
19
19
|
const { current } = elementRef;
|
|
20
|
-
['backgroundColor', 'columns', 'compact', 'description', 'disabled', 'form', 'hideLabel', 'label', 'message', 'name', 'required', 'state', 'theme', 'value'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
20
|
+
['backgroundColor', 'columns', 'compact', 'description', 'disabled', 'form', 'hideLabel', 'label', 'message', 'name', 'noWrap', 'required', 'state', 'theme', 'value'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
21
21
|
}, propsToSync);
|
|
22
22
|
const props = {
|
|
23
23
|
...rest,
|
|
24
24
|
// @ts-ignore
|
|
25
25
|
...(!process.browser
|
|
26
26
|
? {
|
|
27
|
-
children: (jsxRuntime.jsx(segmentedControl.DSRSegmentedControl, { backgroundColor, columns, compact, description, disabled, form, hideLabel, label, message, name, required, state, theme: theme || hooks.useTheme(), value, children })),
|
|
27
|
+
children: (jsxRuntime.jsx(segmentedControl.DSRSegmentedControl, { backgroundColor, columns, compact, description, disabled, form, hideLabel, label, message, name, noWrap, required, state, theme: theme || hooks.useTheme(), value, children })),
|
|
28
28
|
}
|
|
29
29
|
: {
|
|
30
30
|
children,
|
package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/accordion.cjs
CHANGED
|
@@ -22,7 +22,7 @@ class DSRAccordion extends react.Component {
|
|
|
22
22
|
const contentId = 'accordion-panel';
|
|
23
23
|
const Heading = this.props.tag || this.props.headingTag;
|
|
24
24
|
const style = minifyCss.minifyCss(stylesEntry.getAccordionCss(this.props.size, this.props.compact, this.props.open, this.props.theme, this.props.sticky));
|
|
25
|
-
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: [jsxRuntime.jsx(Heading, { className: "heading", children: jsxRuntime.jsxs("button", { id: buttonId, type: "button", "aria-expanded": this.props.open ? 'true' : 'false', "aria-controls": contentId, children: [this.props.heading || jsxRuntime.jsx("slot", { name: "heading" }), jsxRuntime.jsx("span", { className: "icon-container", children: jsxRuntime.jsx(icon_wrapper.PIcon, { className: "icon", name: this.props.open ? 'minus' : 'plus', theme: this.props.theme, size: "xx-small", "aria-hidden": "true" }) })] }) }), jsxRuntime.jsx("div", { id: contentId, className: "collapsible", role: "region", "aria-labelledby": buttonId, children: jsxRuntime.jsx("div", { children: jsxRuntime.jsx("slot", {}) }) })] })] }), this.props.children] }));
|
|
25
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Heading, { className: "heading", children: jsxRuntime.jsxs("button", { id: buttonId, type: "button", "aria-expanded": this.props.open ? 'true' : 'false', "aria-controls": contentId, children: [this.props.heading || jsxRuntime.jsx("slot", { name: "heading" }), jsxRuntime.jsx("span", { className: "icon-container", children: jsxRuntime.jsx(icon_wrapper.PIcon, { className: "icon", name: this.props.open ? 'minus' : 'plus', theme: this.props.theme, size: "xx-small", "aria-hidden": "true" }) })] }) }), jsxRuntime.jsx("div", { id: contentId, className: "collapsible", role: "region", "aria-labelledby": buttonId, children: jsxRuntime.jsx("div", { children: jsxRuntime.jsx("slot", {}) }) })] })] }), this.props.children] }));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var splitChildren = require('../../splitChildren.cjs');
|
|
5
4
|
var react = require('react');
|
|
5
|
+
require('../../provider.cjs');
|
|
6
|
+
var splitChildren = require('../../splitChildren.cjs');
|
|
6
7
|
var minifyCss = require('../../minifyCss.cjs');
|
|
7
8
|
var stylesEntry = require('../../../../../../components/dist/styles/esm/styles-entry.cjs');
|
|
8
9
|
var utilsEntry = require('../../../../../../components/dist/utils/esm/utils-entry.cjs');
|
|
9
10
|
var label = require('./label.cjs');
|
|
10
11
|
var stateMessage = require('./state-message.cjs');
|
|
12
|
+
var scroller_wrapper = require('../components/scroller.wrapper.cjs');
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* @slot {"name": "label", "description": "Shows a label. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."}
|
|
@@ -35,9 +37,9 @@ class DSRSegmentedControl extends react.Component {
|
|
|
35
37
|
const manipulatedChildren = children.map((child) => typeof child === 'object' && 'props' in child && otherChildren.includes(child)
|
|
36
38
|
? { ...child, props: { ...child.props, selected: child.props?.value === this.props.value, backgroundColor: this.props.backgroundColor, theme: this.props.theme } }
|
|
37
39
|
: child);
|
|
38
|
-
const
|
|
39
|
-
const style = minifyCss.minifyCss(stylesEntry.getSegmentedControlCss(minWidth, maxWidth, this.props.columns, this.props.disabled, this.props.hideLabel, this.props.state, this.props.theme));
|
|
40
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("fieldset", { inert: this.props.disabled, disabled: this.props.disabled, ...utilsEntry.getFieldsetAriaAttributes(this.props.required, this.props.state === 'error'), "aria-labelledby": utilsEntry.labelId, "aria-describedby": utilsEntry.descriptionId, className: "root", children: [jsxRuntime.jsx(label.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, tag: "div", label: this.props.label, description: this.props.description, isRequired: this.props.required, isDisabled: this.props.disabled }), jsxRuntime.jsx("slot", {}), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, theme: this.props.theme, host: null })] })] }), manipulatedChildren] }));
|
|
40
|
+
const itemWidths = this.props.noWrap ? undefined : { minWidth: 100, maxWidth: 100 };
|
|
41
|
+
const style = minifyCss.minifyCss(stylesEntry.getSegmentedControlCss(itemWidths?.minWidth, itemWidths?.maxWidth, this.props.columns, this.props.disabled, this.props.hideLabel, this.props.state, this.props.theme, this.props.noWrap));
|
|
42
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("fieldset", { inert: this.props.disabled, disabled: this.props.disabled, ...utilsEntry.getFieldsetAriaAttributes(this.props.required, this.props.state === 'error'), "aria-labelledby": utilsEntry.labelId, "aria-describedby": utilsEntry.descriptionId, className: "root", children: [jsxRuntime.jsx(label.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, tag: "div", label: this.props.label, description: this.props.description, isRequired: this.props.required, isDisabled: this.props.disabled }), this.props.noWrap ? (jsxRuntime.jsx(scroller_wrapper.PScroller, { theme: this.props.theme, className: "scroller", children: jsxRuntime.jsx("slot", {}) })) : (jsxRuntime.jsx("slot", {})), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, theme: this.props.theme, host: null })] })] }), manipulatedChildren] }));
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
|
|
@@ -3641,7 +3641,7 @@ const hasShowPickerSupport = () => (hasDocument &&
|
|
|
3641
3641
|
'showPicker' in HTMLInputElement.prototype &&
|
|
3642
3642
|
CSS.supports('selector(::-webkit-calendar-picker-indicator)'));
|
|
3643
3643
|
|
|
3644
|
-
const prefix = `[Porsche Design System v${"3.
|
|
3644
|
+
const prefix = `[Porsche Design System v${"3.34.0-rc.0"}]` // this part isn't covered by unit tests
|
|
3645
3645
|
;
|
|
3646
3646
|
const consoleError = (...messages) => {
|
|
3647
3647
|
console.error(prefix, ...messages); // eslint-disable-line no-console
|
|
@@ -10291,7 +10291,10 @@ const getComponentCss$v = (compact, isDisabled, isSelected, state, hasIcon, hasS
|
|
|
10291
10291
|
}),
|
|
10292
10292
|
});
|
|
10293
10293
|
};
|
|
10294
|
-
|
|
10294
|
+
|
|
10295
|
+
const MIN_ITEM_WIDTH = 46;
|
|
10296
|
+
const MAX_ITEM_WIDTH = 220;
|
|
10297
|
+
const getComponentCss$u = (minWidth, maxWidth, columns, disabled, hideLabel, state, theme, noWrap) => {
|
|
10295
10298
|
return getCss({
|
|
10296
10299
|
'@global': {
|
|
10297
10300
|
':host': {
|
|
@@ -10306,11 +10309,13 @@ const getComponentCss$u = (minWidth, maxWidth, columns, disabled, hideLabel, sta
|
|
|
10306
10309
|
'slot:not([name])': {
|
|
10307
10310
|
display: 'grid',
|
|
10308
10311
|
gridAutoRows: '1fr', // for equal height
|
|
10309
|
-
...
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
:
|
|
10313
|
-
|
|
10312
|
+
...(noWrap
|
|
10313
|
+
? { gridAutoFlow: 'column', gridAutoColumns: 'max-content' }
|
|
10314
|
+
: buildResponsiveStyles(columns, (col) => ({
|
|
10315
|
+
gridTemplateColumns: col === 'auto'
|
|
10316
|
+
? `repeat(auto-fit, ${(maxWidth > MAX_ITEM_WIDTH && MAX_ITEM_WIDTH) || (maxWidth < MIN_ITEM_WIDTH && minWidth) || maxWidth}px)`
|
|
10317
|
+
: `repeat(${col}, minmax(0, 1fr))`,
|
|
10318
|
+
}))),
|
|
10314
10319
|
gap: '6px',
|
|
10315
10320
|
},
|
|
10316
10321
|
},
|
|
@@ -10328,6 +10333,11 @@ const getComponentCss$u = (minWidth, maxWidth, columns, disabled, hideLabel, sta
|
|
|
10328
10333
|
}),
|
|
10329
10334
|
// .message
|
|
10330
10335
|
...getFunctionalComponentStateMessageStyles(theme, state),
|
|
10336
|
+
...(noWrap && {
|
|
10337
|
+
scroller: {
|
|
10338
|
+
margin: `-${spacingStaticXSmall} 0`,
|
|
10339
|
+
},
|
|
10340
|
+
}),
|
|
10331
10341
|
});
|
|
10332
10342
|
};
|
|
10333
10343
|
|
|
@@ -3444,7 +3444,7 @@ const hasShowPickerSupport = () => (hasDocument &&
|
|
|
3444
3444
|
'showPicker' in HTMLInputElement.prototype &&
|
|
3445
3445
|
CSS.supports('selector(::-webkit-calendar-picker-indicator)'));
|
|
3446
3446
|
|
|
3447
|
-
const prefix = `[Porsche Design System v${"3.
|
|
3447
|
+
const prefix = `[Porsche Design System v${"3.34.0-rc.0"}]` // this part isn't covered by unit tests
|
|
3448
3448
|
;
|
|
3449
3449
|
const consoleError$1 = (...messages) => {
|
|
3450
3450
|
console.error(prefix, ...messages); // eslint-disable-line no-console
|
|
@@ -5,24 +5,24 @@ import { useEventCallback, usePrefix, useTheme, useBrowserLayoutEffect, useMerge
|
|
|
5
5
|
import { syncRef } from '../../utils.mjs';
|
|
6
6
|
import { DSRSegmentedControl } from '../dsr-components/segmented-control.mjs';
|
|
7
7
|
|
|
8
|
-
const PSegmentedControl = /*#__PURE__*/ forwardRef(({ backgroundColor, columns = 'auto', compact = false, description = '', disabled = false, form, hideLabel = false, label = '', message = '', name, onBlur, onChange, onSegmentedControlChange, onUpdate, required = false, state = 'none', theme, value, className, children, ...rest }, ref) => {
|
|
8
|
+
const PSegmentedControl = /*#__PURE__*/ forwardRef(({ backgroundColor, columns = 'auto', compact = false, description = '', disabled = false, form, hideLabel = false, label = '', message = '', name, noWrap = false, onBlur, onChange, onSegmentedControlChange, onUpdate, required = false, state = 'none', theme, value, className, children, ...rest }, ref) => {
|
|
9
9
|
const elementRef = useRef(undefined);
|
|
10
10
|
useEventCallback(elementRef, 'blur', onBlur);
|
|
11
11
|
useEventCallback(elementRef, 'change', onChange);
|
|
12
12
|
useEventCallback(elementRef, 'segmentedControlChange', onSegmentedControlChange);
|
|
13
13
|
useEventCallback(elementRef, 'update', onUpdate);
|
|
14
14
|
const WebComponentTag = usePrefix('p-segmented-control');
|
|
15
|
-
const propsToSync = [backgroundColor, columns, compact, description, disabled, form, hideLabel, label, message, name, required, state, theme || useTheme(), value];
|
|
15
|
+
const propsToSync = [backgroundColor, columns, compact, description, disabled, form, hideLabel, label, message, name, noWrap, required, state, theme || useTheme(), value];
|
|
16
16
|
useBrowserLayoutEffect(() => {
|
|
17
17
|
const { current } = elementRef;
|
|
18
|
-
['backgroundColor', 'columns', 'compact', 'description', 'disabled', 'form', 'hideLabel', 'label', 'message', 'name', 'required', 'state', 'theme', 'value'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
18
|
+
['backgroundColor', 'columns', 'compact', 'description', 'disabled', 'form', 'hideLabel', 'label', 'message', 'name', 'noWrap', 'required', 'state', 'theme', 'value'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
19
19
|
}, propsToSync);
|
|
20
20
|
const props = {
|
|
21
21
|
...rest,
|
|
22
22
|
// @ts-ignore
|
|
23
23
|
...(!process.browser
|
|
24
24
|
? {
|
|
25
|
-
children: (jsx(DSRSegmentedControl, { backgroundColor, columns, compact, description, disabled, form, hideLabel, label, message, name, required, state, theme: theme || useTheme(), value, children })),
|
|
25
|
+
children: (jsx(DSRSegmentedControl, { backgroundColor, columns, compact, description, disabled, form, hideLabel, label, message, name, noWrap, required, state, theme: theme || useTheme(), value, children })),
|
|
26
26
|
}
|
|
27
27
|
: {
|
|
28
28
|
children,
|
package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/accordion.mjs
CHANGED
|
@@ -20,7 +20,7 @@ class DSRAccordion extends Component {
|
|
|
20
20
|
const contentId = 'accordion-panel';
|
|
21
21
|
const Heading = this.props.tag || this.props.headingTag;
|
|
22
22
|
const style = minifyCss(getComponentCss$1p(this.props.size, this.props.compact, this.props.open, this.props.theme, this.props.sticky));
|
|
23
|
-
return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs(Fragment, { children: [jsx(Heading, { className: "heading", children: jsxs("button", { id: buttonId, type: "button", "aria-expanded": this.props.open ? 'true' : 'false', "aria-controls": contentId, children: [this.props.heading || jsx("slot", { name: "heading" }), jsx("span", { className: "icon-container", children: jsx(PIcon, { className: "icon", name: this.props.open ? 'minus' : 'plus', theme: this.props.theme, size: "xx-small", "aria-hidden": "true" }) })] }) }), jsx("div", { id: contentId, className: "collapsible", role: "region", "aria-labelledby": buttonId, children: jsx("div", { children: jsx("slot", {}) }) })] })] }), this.props.children] }));
|
|
23
|
+
return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs(Fragment, { children: [jsx(Heading, { className: "heading", children: jsxs("button", { id: buttonId, type: "button", "aria-expanded": this.props.open ? 'true' : 'false', "aria-controls": contentId, children: [this.props.heading || jsx("slot", { name: "heading" }), jsx("span", { className: "icon-container", children: jsx(PIcon, { className: "icon", name: this.props.open ? 'minus' : 'plus', theme: this.props.theme, size: "xx-small", "aria-hidden": "true" }) })] }) }), jsx("div", { id: contentId, className: "collapsible", role: "region", "aria-labelledby": buttonId, children: jsx("div", { children: jsx("slot", {}) }) })] })] }), this.props.children] }));
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { splitChildren } from '../../splitChildren.mjs';
|
|
3
2
|
import { Component } from 'react';
|
|
3
|
+
import '../../provider.mjs';
|
|
4
|
+
import { splitChildren } from '../../splitChildren.mjs';
|
|
4
5
|
import { minifyCss } from '../../minifyCss.mjs';
|
|
5
6
|
import { getSegmentedControlCss as getComponentCss$u } from '../../../../../../components/dist/styles/esm/styles-entry.mjs';
|
|
6
7
|
import { descriptionId, labelId, getFieldsetAriaAttributes } from '../../../../../../components/dist/utils/esm/utils-entry.mjs';
|
|
7
8
|
import { Label } from './label.mjs';
|
|
8
9
|
import { StateMessage } from './state-message.mjs';
|
|
10
|
+
import { PScroller } from '../components/scroller.wrapper.mjs';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* @slot {"name": "label", "description": "Shows a label. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."}
|
|
@@ -33,9 +35,9 @@ class DSRSegmentedControl extends Component {
|
|
|
33
35
|
const manipulatedChildren = children.map((child) => typeof child === 'object' && 'props' in child && otherChildren.includes(child)
|
|
34
36
|
? { ...child, props: { ...child.props, selected: child.props?.value === this.props.value, backgroundColor: this.props.backgroundColor, theme: this.props.theme } }
|
|
35
37
|
: child);
|
|
36
|
-
const
|
|
37
|
-
const style = minifyCss(getComponentCss$u(minWidth, maxWidth, this.props.columns, this.props.disabled, this.props.hideLabel, this.props.state, this.props.theme));
|
|
38
|
-
return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs("fieldset", { inert: this.props.disabled, disabled: this.props.disabled, ...getFieldsetAriaAttributes(this.props.required, this.props.state === 'error'), "aria-labelledby": labelId, "aria-describedby": descriptionId, 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, tag: "div", label: this.props.label, description: this.props.description, isRequired: this.props.required, isDisabled: this.props.disabled }), jsx("slot", {}), jsx(StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, theme: this.props.theme, host: null })] })] }), manipulatedChildren] }));
|
|
38
|
+
const itemWidths = this.props.noWrap ? undefined : { minWidth: 100, maxWidth: 100 };
|
|
39
|
+
const style = minifyCss(getComponentCss$u(itemWidths?.minWidth, itemWidths?.maxWidth, this.props.columns, this.props.disabled, this.props.hideLabel, this.props.state, this.props.theme, this.props.noWrap));
|
|
40
|
+
return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs("fieldset", { inert: this.props.disabled, disabled: this.props.disabled, ...getFieldsetAriaAttributes(this.props.required, this.props.state === 'error'), "aria-labelledby": labelId, "aria-describedby": descriptionId, 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, tag: "div", label: this.props.label, description: this.props.description, isRequired: this.props.required, isDisabled: this.props.disabled }), this.props.noWrap ? (jsx(PScroller, { theme: this.props.theme, className: "scroller", children: jsx("slot", {}) })) : (jsx("slot", {})), jsx(StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, theme: this.props.theme, host: null })] })] }), manipulatedChildren] }));
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -41,6 +41,10 @@ export type PSegmentedControlProps = BaseProps & {
|
|
|
41
41
|
* The name of the segmented-control.
|
|
42
42
|
*/
|
|
43
43
|
name?: string;
|
|
44
|
+
/**
|
|
45
|
+
* If true, prevents items from wrapping to new rows and renders them in a single scrollable row instead.
|
|
46
|
+
*/
|
|
47
|
+
noWrap?: boolean;
|
|
44
48
|
/**
|
|
45
49
|
* Emitted when the segmented-control has lost focus.
|
|
46
50
|
*/
|
|
@@ -115,6 +119,10 @@ export declare const PSegmentedControl: import("react").ForwardRefExoticComponen
|
|
|
115
119
|
* The name of the segmented-control.
|
|
116
120
|
*/
|
|
117
121
|
name?: string;
|
|
122
|
+
/**
|
|
123
|
+
* If true, prevents items from wrapping to new rows and renders them in a single scrollable row instead.
|
|
124
|
+
*/
|
|
125
|
+
noWrap?: boolean;
|
|
118
126
|
/**
|
|
119
127
|
* Emitted when the segmented-control has lost focus.
|
|
120
128
|
*/
|