@porsche-design-system/components-react 3.30.0 → 3.31.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 +12 -0
- package/package.json +2 -2
- package/ssr/cjs/components/dist/styles/esm/styles-entry.cjs +1106 -845
- package/ssr/cjs/components/dist/utils/esm/utils-entry.cjs +115 -14
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-base.cjs +1 -1
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/radio-group-option.cjs +0 -1
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/segmented-control.cjs +2 -1
- package/ssr/esm/components/dist/styles/esm/styles-entry.mjs +1106 -845
- package/ssr/esm/components/dist/utils/esm/utils-entry.mjs +114 -15
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-base.mjs +1 -1
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/radio-group-option.mjs +0 -1
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/segmented-control.mjs +2 -1
- package/ssr/esm/lib/dsr-components/input-base.d.ts +0 -1
|
@@ -3284,7 +3284,8 @@ const fontFamily = "'Porsche Next','Arial Narrow',Arial,'Heiti SC',SimHei,sans-s
|
|
|
3284
3284
|
|
|
3285
3285
|
const fontHyphenationStyle = {
|
|
3286
3286
|
overflowWrap: 'break-word',
|
|
3287
|
-
|
|
3287
|
+
// @ts-ignore
|
|
3288
|
+
hyphens: 'var(--p-hyphens, auto)',
|
|
3288
3289
|
};
|
|
3289
3290
|
|
|
3290
3291
|
const fontLineHeight = 'calc(6px + 2.125ex)';
|
|
@@ -3445,6 +3446,12 @@ const hasShowPickerSupport = () => (hasDocument &&
|
|
|
3445
3446
|
'showPicker' in HTMLInputElement.prototype &&
|
|
3446
3447
|
CSS.supports('selector(::-webkit-calendar-picker-indicator)'));
|
|
3447
3448
|
|
|
3449
|
+
const prefix = `[Porsche Design System v${"3.31.0-rc.0"}]` // this part isn't covered by unit tests
|
|
3450
|
+
;
|
|
3451
|
+
const consoleError$1 = (...messages) => {
|
|
3452
|
+
console.error(prefix, ...messages); // eslint-disable-line no-console
|
|
3453
|
+
};
|
|
3454
|
+
|
|
3448
3455
|
// This class is shared since the popover needs to register a scroll listener to this node in order to hide the popover when the table is scrolled
|
|
3449
3456
|
const scrollAreaClass = 'scroll-area';
|
|
3450
3457
|
const isScrollable = (isPrevHidden, isNextHidden) => {
|
|
@@ -3536,7 +3543,96 @@ const formatObjectOutput = (value) => {
|
|
|
3536
3543
|
.replace(/(})/g, ' $1') // add space before following: }
|
|
3537
3544
|
.replace(/^"(.+)"$/, '$1'); // remove wrapping double quotes
|
|
3538
3545
|
};
|
|
3539
|
-
|
|
3546
|
+
const formatArrayOutput = (value) => {
|
|
3547
|
+
return (
|
|
3548
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
3549
|
+
JSON.stringify(value.map((x) => (x === undefined ? `${x}` : x))) // wrap undefined in quotes to not convert it to null
|
|
3550
|
+
.replace(/'/g, '') // remove single quotes
|
|
3551
|
+
// eslint-disable-next-line @typescript-eslint/quotes
|
|
3552
|
+
.replace(/"/g, "'") // replace double quotes with single quotes
|
|
3553
|
+
.replace(/'(undefined)'/, '$1') // remove quotes around undefined
|
|
3554
|
+
.replace(/,/g, ', ') // add space after comma
|
|
3555
|
+
);
|
|
3556
|
+
};
|
|
3557
|
+
const printErrorMessage = ({ propName, propValue, // TODO: might be nicer if this is always a string
|
|
3558
|
+
propType, componentName, }) => {
|
|
3559
|
+
consoleError$1(`Invalid property '${propName}' with value '${internalValidateProps.formatObjectOutput(propValue)}' supplied to ${componentName}, expected one of: ${propType}`);
|
|
3560
|
+
};
|
|
3561
|
+
const isValueNotOfType = (propValue, propType) => {
|
|
3562
|
+
return propValue !== undefined && typeof propValue !== propType;
|
|
3563
|
+
};
|
|
3564
|
+
const validateValueOfType = (propName, propValue, propType) => {
|
|
3565
|
+
if (internalValidateProps.isValueNotOfType(propValue, propType)) {
|
|
3566
|
+
return { propName, propValue, propType };
|
|
3567
|
+
}
|
|
3568
|
+
return undefined;
|
|
3569
|
+
};
|
|
3570
|
+
const getBreakpointCustomizableStructure = (allowedValues) => {
|
|
3571
|
+
return breakpointCustomizableTemplate.replace(/value/g, allowedValues !== 'boolean' && allowedValues !== 'number'
|
|
3572
|
+
? internalValidateProps
|
|
3573
|
+
.formatArrayOutput(allowedValues)
|
|
3574
|
+
.replace(/\[/g, '(') // starting inline type literal array
|
|
3575
|
+
.replace(/]/g, ')[]') // ending inline type literal array
|
|
3576
|
+
.replace(/,/g, ' |') // replace commas with a pipe
|
|
3577
|
+
: allowedValues);
|
|
3578
|
+
};
|
|
3579
|
+
const getAriaStructure = (allowedAriaAttributes) => {
|
|
3580
|
+
return (internalValidateProps
|
|
3581
|
+
.formatObjectOutput(allowedAriaAttributes.reduce((prev, key) => ({
|
|
3582
|
+
...prev,
|
|
3583
|
+
[key]: 'value',
|
|
3584
|
+
}), {}))
|
|
3585
|
+
.replace(/":/g, '"?:') // add optional modifier on keys before colon
|
|
3586
|
+
// eslint-disable-next-line @typescript-eslint/quotes
|
|
3587
|
+
.replace(/"/g, "'") // replace double quotes with single quotes
|
|
3588
|
+
);
|
|
3589
|
+
};
|
|
3590
|
+
const getShapeStructure = (shapeStructure) => {
|
|
3591
|
+
return internalValidateProps
|
|
3592
|
+
.formatObjectOutput(Object.keys(shapeStructure).reduce((prev, key) => ({ ...prev, [key]: shapeStructure[key].name }), {}))
|
|
3593
|
+
.replace(/"/g, ''); // remove double quotes
|
|
3594
|
+
};
|
|
3595
|
+
const isBreakpointCustomizableValueInvalid = (value, allowedValues) => {
|
|
3596
|
+
return allowedValues === 'boolean' || allowedValues === 'number'
|
|
3597
|
+
? internalValidateProps.isValueNotOfType(value, allowedValues)
|
|
3598
|
+
: !allowedValues.includes(value);
|
|
3599
|
+
};
|
|
3600
|
+
/**
|
|
3601
|
+
* Validates an array using a provided validator function and returns the first encountered validation error.
|
|
3602
|
+
*
|
|
3603
|
+
* @param {string} propName - The name of the property being validated.
|
|
3604
|
+
* @param {any} arr - The input to be validated.
|
|
3605
|
+
* @param {ValidatorFunction} validator - The validator function that checks each array item.
|
|
3606
|
+
* @returns {ValidationError | undefined} The first encountered validation error object, or undefined if the array is valid.
|
|
3607
|
+
*/
|
|
3608
|
+
const isValidArray = (propName, arr, validator) => {
|
|
3609
|
+
const validationError = Array.isArray(arr)
|
|
3610
|
+
? validator(propName, arr.find((item) => validator(propName, item)))
|
|
3611
|
+
: {
|
|
3612
|
+
propName,
|
|
3613
|
+
propValue: arr,
|
|
3614
|
+
propType: validator(propName, null).propType, // Get propType by passing in null which will always result in error
|
|
3615
|
+
};
|
|
3616
|
+
if (validationError) {
|
|
3617
|
+
return { ...validationError, propType: `${validationError.propType}[]` };
|
|
3618
|
+
}
|
|
3619
|
+
return undefined;
|
|
3620
|
+
};
|
|
3621
|
+
const internalValidateProps = {
|
|
3622
|
+
isValueNotOfType,
|
|
3623
|
+
formatArrayOutput,
|
|
3624
|
+
formatObjectOutput,
|
|
3625
|
+
printErrorMessage,
|
|
3626
|
+
validateValueOfType,
|
|
3627
|
+
isValidArray,
|
|
3628
|
+
isBreakpointCustomizableValueInvalid,
|
|
3629
|
+
getBreakpointCustomizableStructure,
|
|
3630
|
+
getAriaStructure,
|
|
3631
|
+
getShapeStructure,
|
|
3632
|
+
};
|
|
3633
|
+
const breakpointCustomizableTemplate = `value, ${internalValidateProps
|
|
3634
|
+
.formatObjectOutput(breakpoints.reduce((prev, key) => ({ ...prev, [key + (key !== 'base' ? '?' : '')]: 'value' }), {}))
|
|
3635
|
+
.replace(/"/g, '')}`;
|
|
3540
3636
|
const getButtonPureAriaAttributes = (isDisabled, isLoading, aria) => {
|
|
3541
3637
|
return {
|
|
3542
3638
|
...parseAndGetAriaAttributes(aria),
|
|
@@ -3591,17 +3687,6 @@ const getDisplayTagType = (host, size, tag) => {
|
|
|
3591
3687
|
}
|
|
3592
3688
|
return displaySizeToTagMap[size] || 'h1';
|
|
3593
3689
|
};
|
|
3594
|
-
/**
|
|
3595
|
-
* Updates the state of the drilldown and its children based on the provided activeItem and value.
|
|
3596
|
-
*
|
|
3597
|
-
* @param {string | undefined} activeItem - The drilldown-item element which is currently active (which has the activeIdentifier as identifier). If undefined, updates the root element.
|
|
3598
|
-
* @param {boolean} value - The new state value to apply.
|
|
3599
|
-
* @returns {void}
|
|
3600
|
-
*/
|
|
3601
|
-
const updateDrilldownItemState = (activeItem, value) => {
|
|
3602
|
-
activeItem.secondary = value;
|
|
3603
|
-
traverseTreeAndUpdateState(activeItem.parentElement, 'primary', value);
|
|
3604
|
-
};
|
|
3605
3690
|
/**
|
|
3606
3691
|
* Recursively updates the state of a drilldown item's parent elements by traversing up the DOM tree.
|
|
3607
3692
|
*
|
|
@@ -3612,9 +3697,23 @@ const updateDrilldownItemState = (activeItem, value) => {
|
|
|
3612
3697
|
const traverseTreeAndUpdateState = (activeItem, prop, value) => {
|
|
3613
3698
|
if (isElementOfKind(activeItem, 'p-drilldown-item')) {
|
|
3614
3699
|
activeItem[prop] = value;
|
|
3615
|
-
traverseTreeAndUpdateState(activeItem.parentElement, 'cascade', value);
|
|
3700
|
+
internalDrilldown.traverseTreeAndUpdateState(activeItem.parentElement, 'cascade', value);
|
|
3616
3701
|
}
|
|
3617
3702
|
};
|
|
3703
|
+
const internalDrilldown = {
|
|
3704
|
+
traverseTreeAndUpdateState,
|
|
3705
|
+
};
|
|
3706
|
+
/**
|
|
3707
|
+
* Updates the state of the drilldown and its children based on the provided activeItem and value.
|
|
3708
|
+
*
|
|
3709
|
+
* @param {string | undefined} activeItem - The drilldown-item element which is currently active (which has the activeIdentifier as identifier). If undefined, updates the root element.
|
|
3710
|
+
* @param {boolean} value - The new state value to apply.
|
|
3711
|
+
* @returns {void}
|
|
3712
|
+
*/
|
|
3713
|
+
const updateDrilldownItemState = (activeItem, value) => {
|
|
3714
|
+
activeItem.secondary = value;
|
|
3715
|
+
internalDrilldown.traverseTreeAndUpdateState(activeItem.parentElement, 'primary', value);
|
|
3716
|
+
};
|
|
3618
3717
|
const getFieldsetAriaAttributes = (isRequired, isInvalid, aria) => {
|
|
3619
3718
|
const ariaAttrs = parseAndGetAriaAttributes(aria);
|
|
3620
3719
|
return {
|
|
@@ -3907,6 +4006,7 @@ exports.buildFlagUrl = buildFlagUrl;
|
|
|
3907
4006
|
exports.buildIconUrl = buildIconUrl;
|
|
3908
4007
|
exports.buildImgSrc = buildImgSrc;
|
|
3909
4008
|
exports.buildSrcSet = buildSrcSet;
|
|
4009
|
+
exports.consoleError = consoleError$1;
|
|
3910
4010
|
exports.createPaginationItems = createPaginationItems;
|
|
3911
4011
|
exports.createRange = createRange;
|
|
3912
4012
|
exports.crestSize = crestSize;
|
|
@@ -3950,6 +4050,7 @@ exports.hasSpecificDirectChildTag = hasSpecificDirectChildTag;
|
|
|
3950
4050
|
exports.hasVisibleIcon = hasVisibleIcon;
|
|
3951
4051
|
exports.hasWindow = hasWindow$1;
|
|
3952
4052
|
exports.headerSlot = headerSlot;
|
|
4053
|
+
exports.internalDrilldown = internalDrilldown;
|
|
3953
4054
|
exports.isCurrentInput = isCurrentInput;
|
|
3954
4055
|
exports.isCustomDropdown = isCustomDropdown;
|
|
3955
4056
|
exports.isDisabledOrLoading = isDisabledOrLoading;
|
package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-base.cjs
CHANGED
|
@@ -17,7 +17,7 @@ id, label: label$1, description, loading, initialLoading, required, disabled, st
|
|
|
17
17
|
// onWheel,
|
|
18
18
|
// onChange,
|
|
19
19
|
// onBlur,
|
|
20
|
-
onKeyDown,
|
|
20
|
+
// onKeyDown,
|
|
21
21
|
// refElement,
|
|
22
22
|
start, end, }) => {
|
|
23
23
|
const { namedSlotChildren } = splitChildren.splitChildren(children);
|
|
@@ -23,7 +23,6 @@ class DSRRadioGroupOption extends react.Component {
|
|
|
23
23
|
const style = minifyCss.minifyCss(stylesEntry.getRadioGroupOptionCss(isDisabled, isLoading, state, theme));
|
|
24
24
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label, hasDescription: false, host: null, label: this.props.label, htmlFor: id, isDisabled: isDisabled, isLoading: isLoading, stopClickPropagation: true }), jsxRuntime.jsxs("div", { className: "wrapper", children: [jsxRuntime.jsx("input", { id: id, type: "radio", name: name, checked: isSelected, disabled: isDisabled || isLoading, value: this.props.value, onClick: (e) => {
|
|
25
25
|
e.stopPropagation();
|
|
26
|
-
e.stopImmediatePropagation();
|
|
27
26
|
}, onBlur: this.props.onBlur, "aria-describedby": isLoading ? loadingMessage.loadingId : `${stateMessage.messageId}`, "aria-invalid": state === 'error' ? 'true' : null, "aria-disabled": isDisabled || isLoading ? 'true' : null }), isOptionLoading && !this.props.loadingParent && (jsxRuntime.jsx(spinner_wrapper.PSpinner, { className: "spinner", size: "inherit", theme: theme, "aria-hidden": "true" }))] }), !this.props.loadingParent && (jsxRuntime.jsx(loadingMessage.LoadingMessage, { loading: isOptionLoading, initialLoading: this.props.initialLoading }))] }) })] }) }));
|
|
28
27
|
}
|
|
29
28
|
}
|
|
@@ -27,7 +27,8 @@ class DSRSegmentedControl extends react.Component {
|
|
|
27
27
|
const manipulatedChildren = children.map((child) => typeof child === 'object' && 'props' in child && otherChildren.includes(child)
|
|
28
28
|
? { ...child, props: { ...child.props, selected: child.props?.value === this.props.value, backgroundColor: this.props.backgroundColor, theme: this.props.theme } }
|
|
29
29
|
: child);
|
|
30
|
-
const
|
|
30
|
+
const { minWidth, maxWidth } = { minWidth: 100, maxWidth: 100 };
|
|
31
|
+
const style = minifyCss.minifyCss(stylesEntry.getSegmentedControlCss(minWidth, maxWidth, this.props.columns, this.props.compact));
|
|
31
32
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("slot", {}) })] }), manipulatedChildren] }));
|
|
32
33
|
}
|
|
33
34
|
}
|