@porsche-design-system/components-react 3.12.0 → 3.13.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 +18 -4
- package/cjs/lib/components/link-tile-product.wrapper.cjs +3 -3
- package/esm/lib/components/link-tile-product.wrapper.d.ts +14 -6
- package/esm/lib/components/link-tile-product.wrapper.mjs +3 -3
- package/package.json +2 -2
- package/ssr/cjs/components/dist/styles/esm/styles-entry.cjs +32 -14
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/components/link-tile-product.wrapper.cjs +4 -4
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/link-tile-product.cjs +2 -2
- package/ssr/esm/components/dist/styles/esm/styles-entry.mjs +32 -14
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/link-tile-product.wrapper.mjs +4 -4
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/link-tile-product.mjs +2 -2
- package/ssr/esm/lib/components/link-tile-product.wrapper.d.ts +14 -6
package/CHANGELOG.md
CHANGED
|
@@ -14,14 +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.13.0-rc.0] - 2024-02-19
|
|
18
|
+
|
|
19
|
+
#### Added
|
|
20
|
+
|
|
21
|
+
- `Link Tile Product`: Prop `price-original` to be able to visualize sale and original price
|
|
22
|
+
([#3040](https://github.com/porsche-design-system/porsche-design-system/pull/3040))
|
|
23
|
+
|
|
24
|
+
#### Changed
|
|
25
|
+
|
|
26
|
+
- Validation of `getInitialStyles()` partial is temporarily disabled
|
|
27
|
+
([#3049](https://github.com/porsche-design-system/porsche-design-system/pull/3049))
|
|
28
|
+
|
|
17
29
|
### [3.12.0] - 2024-02-12
|
|
18
30
|
|
|
19
31
|
### [3.12.0-rc.1] - 2024-02-08
|
|
20
32
|
|
|
21
33
|
#### Fixed
|
|
22
34
|
|
|
23
|
-
- `Checkbox Wrapper`, `Radio Button Wrapper`: Safari visually reflects input status (checked/unchecked) when
|
|
24
|
-
|
|
35
|
+
- `Checkbox Wrapper`, `Radio Button Wrapper`: Safari visually reflects input status (checked/unchecked) when used in
|
|
36
|
+
another Shadow DOM or changed programmatically
|
|
37
|
+
([#3028](https://github.com/porsche-design-system/porsche-design-system/pull/3028))
|
|
25
38
|
|
|
26
39
|
### [3.12.0-rc.0] - 2024-02-05
|
|
27
40
|
|
|
@@ -33,8 +46,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
33
46
|
#### Changed
|
|
34
47
|
|
|
35
48
|
- `Icon`: Visual appearance of `information-filled`, `information`, `success-filled`, `success`, `bookmark`, `compare`,
|
|
36
|
-
`configurate`, `heart-filled`, `heart`, `menu-lines`, `success`, `search`, `locate`, `star`, `shopping-bag-filled`,
|
|
37
|
-
`shopping-bag`, `user-filled` and `user`
|
|
49
|
+
`configurate`, `heart-filled`, `heart`, `menu-lines`, `success`, `search`, `locate`, `star`, `shopping-bag-filled`,
|
|
50
|
+
`shopping-bag`, `user-filled` and `user`
|
|
51
|
+
([#3025](https://github.com/porsche-design-system/porsche-design-system/pull/3025))
|
|
38
52
|
- All components (expect some form elements) have improved focus styling based on `:focus-visible`
|
|
39
53
|
([#3011](https://github.com/porsche-design-system/porsche-design-system/pull/3011))
|
|
40
54
|
- Several components are using CSS property `inset|inset-inline|inset-block` instead of `top|bottom|left|right` for
|
|
@@ -6,14 +6,14 @@ var react = require('react');
|
|
|
6
6
|
var hooks = require('../../hooks.cjs');
|
|
7
7
|
var utils = require('../../utils.cjs');
|
|
8
8
|
|
|
9
|
-
const PLinkTileProduct = react.forwardRef(({ aspectRatio = '3:4', description, heading, href, likeButton = true, liked = false, onLike, price, rel, target = '_self', theme, className, ...rest }, ref) => {
|
|
9
|
+
const PLinkTileProduct = react.forwardRef(({ aspectRatio = '3:4', description, heading, href, likeButton = true, liked = false, onLike, price, priceOriginal, rel, target = '_self', theme, className, ...rest }, ref) => {
|
|
10
10
|
const elementRef = react.useRef();
|
|
11
11
|
hooks.useEventCallback(elementRef, 'like', onLike);
|
|
12
12
|
const WebComponentTag = hooks.usePrefix('p-link-tile-product');
|
|
13
|
-
const propsToSync = [aspectRatio, description, heading, href, likeButton, liked, price, rel, target, theme || hooks.useTheme()];
|
|
13
|
+
const propsToSync = [aspectRatio, description, heading, href, likeButton, liked, price, priceOriginal, rel, target, theme || hooks.useTheme()];
|
|
14
14
|
hooks.useBrowserLayoutEffect(() => {
|
|
15
15
|
const { current } = elementRef;
|
|
16
|
-
['aspectRatio', 'description', 'heading', 'href', 'likeButton', 'liked', 'price', 'rel', 'target', 'theme'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
16
|
+
['aspectRatio', 'description', 'heading', 'href', 'likeButton', 'liked', 'price', 'priceOriginal', 'rel', 'target', 'theme'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
17
17
|
}, propsToSync);
|
|
18
18
|
const props = {
|
|
19
19
|
...rest,
|
|
@@ -6,11 +6,11 @@ export type PLinkTileProductProps = Omit<HTMLAttributes<{}>, 'color'> & {
|
|
|
6
6
|
*/
|
|
7
7
|
aspectRatio?: BreakpointCustomizable<LinkTileProductAspectRatio>;
|
|
8
8
|
/**
|
|
9
|
-
* Additional product description
|
|
9
|
+
* Additional product description.
|
|
10
10
|
*/
|
|
11
11
|
description?: string;
|
|
12
12
|
/**
|
|
13
|
-
* Product heading
|
|
13
|
+
* Product heading.
|
|
14
14
|
*/
|
|
15
15
|
heading: string;
|
|
16
16
|
/**
|
|
@@ -30,9 +30,13 @@ export type PLinkTileProductProps = Omit<HTMLAttributes<{}>, 'color'> & {
|
|
|
30
30
|
*/
|
|
31
31
|
onLike?: (event: CustomEvent<LinkTileProductLikeEventDetail>) => void;
|
|
32
32
|
/**
|
|
33
|
-
* Product price
|
|
33
|
+
* Product retail price (with or without discount).
|
|
34
34
|
*/
|
|
35
35
|
price: string;
|
|
36
|
+
/**
|
|
37
|
+
* Shows original price (recommended retail price) with line-through. Needs prop "price" to be defined, otherwise this prop has no effect.
|
|
38
|
+
*/
|
|
39
|
+
priceOriginal?: string;
|
|
36
40
|
/**
|
|
37
41
|
* Specifies the relationship of the target object to the link object.
|
|
38
42
|
*/
|
|
@@ -52,11 +56,11 @@ export declare const PLinkTileProduct: import("react").ForwardRefExoticComponent
|
|
|
52
56
|
*/
|
|
53
57
|
aspectRatio?: BreakpointCustomizable<LinkTileProductAspectRatio> | undefined;
|
|
54
58
|
/**
|
|
55
|
-
* Additional product description
|
|
59
|
+
* Additional product description.
|
|
56
60
|
*/
|
|
57
61
|
description?: string | undefined;
|
|
58
62
|
/**
|
|
59
|
-
* Product heading
|
|
63
|
+
* Product heading.
|
|
60
64
|
*/
|
|
61
65
|
heading: string;
|
|
62
66
|
/**
|
|
@@ -76,9 +80,13 @@ export declare const PLinkTileProduct: import("react").ForwardRefExoticComponent
|
|
|
76
80
|
*/
|
|
77
81
|
onLike?: ((event: CustomEvent<LinkTileProductLikeEventDetail>) => void) | undefined;
|
|
78
82
|
/**
|
|
79
|
-
* Product price
|
|
83
|
+
* Product retail price (with or without discount).
|
|
80
84
|
*/
|
|
81
85
|
price: string;
|
|
86
|
+
/**
|
|
87
|
+
* Shows original price (recommended retail price) with line-through. Needs prop "price" to be defined, otherwise this prop has no effect.
|
|
88
|
+
*/
|
|
89
|
+
priceOriginal?: string | undefined;
|
|
82
90
|
/**
|
|
83
91
|
* Specifies the relationship of the target object to the link object.
|
|
84
92
|
*/
|
|
@@ -4,14 +4,14 @@ 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 PLinkTileProduct = forwardRef(({ aspectRatio = '3:4', description, heading, href, likeButton = true, liked = false, onLike, price, rel, target = '_self', theme, className, ...rest }, ref) => {
|
|
7
|
+
const PLinkTileProduct = forwardRef(({ aspectRatio = '3:4', description, heading, href, likeButton = true, liked = false, onLike, price, priceOriginal, rel, target = '_self', theme, className, ...rest }, ref) => {
|
|
8
8
|
const elementRef = useRef();
|
|
9
9
|
useEventCallback(elementRef, 'like', onLike);
|
|
10
10
|
const WebComponentTag = usePrefix('p-link-tile-product');
|
|
11
|
-
const propsToSync = [aspectRatio, description, heading, href, likeButton, liked, price, rel, target, theme || useTheme()];
|
|
11
|
+
const propsToSync = [aspectRatio, description, heading, href, likeButton, liked, price, priceOriginal, rel, target, theme || useTheme()];
|
|
12
12
|
useBrowserLayoutEffect(() => {
|
|
13
13
|
const { current } = elementRef;
|
|
14
|
-
['aspectRatio', 'description', 'heading', 'href', 'likeButton', 'liked', 'price', 'rel', 'target', 'theme'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
14
|
+
['aspectRatio', 'description', 'heading', 'href', 'likeButton', 'liked', 'price', 'priceOriginal', 'rel', 'target', 'theme'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
15
15
|
}, propsToSync);
|
|
16
16
|
const props = {
|
|
17
17
|
...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.13.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.13.0-rc.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"react": ">=17.0.0 <19.0.0",
|
|
@@ -6598,9 +6598,9 @@ const getMultilineEllipsis = (lineClamp) => {
|
|
|
6598
6598
|
overflow: 'hidden',
|
|
6599
6599
|
};
|
|
6600
6600
|
};
|
|
6601
|
-
const getComponentCss$D = (hasLikeButton, hasSlottedAnchor, aspectRatio, theme) => {
|
|
6602
|
-
const { primaryColor, contrastHighColor, backgroundSurfaceColor } = getThemedColors(theme);
|
|
6603
|
-
const { primaryColor: primaryColorDark, contrastHighColor: contrastHighColorDark, backgroundSurfaceColor: backgroundSurfaceColorDark, } = getThemedColors('dark');
|
|
6601
|
+
const getComponentCss$D = (hasLikeButton, hasSlottedAnchor, hasPriceOriginal, hasDescription, aspectRatio, theme) => {
|
|
6602
|
+
const { primaryColor, contrastHighColor, contrastMediumColor, backgroundSurfaceColor } = getThemedColors(theme);
|
|
6603
|
+
const { primaryColor: primaryColorDark, contrastHighColor: contrastHighColorDark, contrastMediumColor: contrastMediumColorDark, backgroundSurfaceColor: backgroundSurfaceColorDark, } = getThemedColors('dark');
|
|
6604
6604
|
return getCss({
|
|
6605
6605
|
'@global': {
|
|
6606
6606
|
':host': {
|
|
@@ -6638,6 +6638,14 @@ const getComponentCss$D = (hasLikeButton, hasSlottedAnchor, aspectRatio, theme)
|
|
|
6638
6638
|
},
|
|
6639
6639
|
},
|
|
6640
6640
|
}),
|
|
6641
|
+
...(hasPriceOriginal && {
|
|
6642
|
+
s: {
|
|
6643
|
+
color: contrastMediumColor,
|
|
6644
|
+
...prefersColorSchemeDarkMediaQuery(theme, {
|
|
6645
|
+
color: contrastMediumColorDark,
|
|
6646
|
+
}),
|
|
6647
|
+
},
|
|
6648
|
+
}),
|
|
6641
6649
|
},
|
|
6642
6650
|
root: {
|
|
6643
6651
|
display: 'flex',
|
|
@@ -6696,25 +6704,35 @@ const getComponentCss$D = (hasLikeButton, hasSlottedAnchor, aspectRatio, theme)
|
|
|
6696
6704
|
textAlign: 'center',
|
|
6697
6705
|
},
|
|
6698
6706
|
heading: {
|
|
6707
|
+
margin: '0 0 2px', // ua-style reset
|
|
6699
6708
|
...headingSmallStyle,
|
|
6700
6709
|
...fontHyphenationStyle,
|
|
6701
6710
|
...getMultilineEllipsis(3),
|
|
6702
|
-
margin: '0 0 2px',
|
|
6703
6711
|
},
|
|
6704
6712
|
price: {
|
|
6705
|
-
...textXSmallStyle,
|
|
6706
|
-
...getMultilineEllipsis(2),
|
|
6707
|
-
margin: 0, // ua-style reset
|
|
6708
|
-
},
|
|
6709
|
-
description: {
|
|
6710
|
-
...textXXSmallStyle,
|
|
6711
|
-
...getMultilineEllipsis(2),
|
|
6712
6713
|
margin: 0, // ua-style reset
|
|
6713
|
-
|
|
6714
|
-
...
|
|
6715
|
-
|
|
6714
|
+
...textXSmallStyle,
|
|
6715
|
+
...(hasPriceOriginal && {
|
|
6716
|
+
display: 'flex',
|
|
6717
|
+
flexWrap: 'wrap',
|
|
6718
|
+
justifyContent: 'center',
|
|
6719
|
+
columnGap: spacingFluidXSmall,
|
|
6716
6720
|
}),
|
|
6717
6721
|
},
|
|
6722
|
+
...(hasDescription && {
|
|
6723
|
+
description: {
|
|
6724
|
+
margin: 0, // ua-style reset
|
|
6725
|
+
...textXXSmallStyle,
|
|
6726
|
+
...getMultilineEllipsis(2),
|
|
6727
|
+
color: contrastHighColor,
|
|
6728
|
+
...prefersColorSchemeDarkMediaQuery(theme, {
|
|
6729
|
+
color: contrastHighColorDark,
|
|
6730
|
+
}),
|
|
6731
|
+
},
|
|
6732
|
+
}),
|
|
6733
|
+
...(hasPriceOriginal && {
|
|
6734
|
+
'sr-only': getHiddenTextJssStyle(),
|
|
6735
|
+
}),
|
|
6718
6736
|
});
|
|
6719
6737
|
};
|
|
6720
6738
|
|
|
@@ -7,14 +7,14 @@ var hooks = require('../../hooks.cjs');
|
|
|
7
7
|
var utils = require('../../utils.cjs');
|
|
8
8
|
var linkTileProduct = require('../dsr-components/link-tile-product.cjs');
|
|
9
9
|
|
|
10
|
-
const PLinkTileProduct = react.forwardRef(({ aspectRatio = '3:4', description, heading, href, likeButton = true, liked = false, onLike, price, rel, target = '_self', theme, className, children, ...rest }, ref) => {
|
|
10
|
+
const PLinkTileProduct = react.forwardRef(({ aspectRatio = '3:4', description, heading, href, likeButton = true, liked = false, onLike, price, priceOriginal, rel, target = '_self', theme, className, children, ...rest }, ref) => {
|
|
11
11
|
const elementRef = react.useRef();
|
|
12
12
|
hooks.useEventCallback(elementRef, 'like', onLike);
|
|
13
13
|
const WebComponentTag = hooks.usePrefix('p-link-tile-product');
|
|
14
|
-
const propsToSync = [aspectRatio, description, heading, href, likeButton, liked, price, rel, target, theme || hooks.useTheme()];
|
|
14
|
+
const propsToSync = [aspectRatio, description, heading, href, likeButton, liked, price, priceOriginal, rel, target, theme || hooks.useTheme()];
|
|
15
15
|
hooks.useBrowserLayoutEffect(() => {
|
|
16
16
|
const { current } = elementRef;
|
|
17
|
-
['aspectRatio', 'description', 'heading', 'href', 'likeButton', 'liked', 'price', 'rel', 'target', 'theme'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
17
|
+
['aspectRatio', 'description', 'heading', 'href', 'likeButton', 'liked', 'price', 'priceOriginal', 'rel', 'target', 'theme'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
18
18
|
}, propsToSync);
|
|
19
19
|
// @ts-ignore
|
|
20
20
|
if (!process.browser) {
|
|
@@ -25,7 +25,7 @@ const PLinkTileProduct = react.forwardRef(({ aspectRatio = '3:4', description, h
|
|
|
25
25
|
// @ts-ignore
|
|
26
26
|
...(!process.browser
|
|
27
27
|
? {
|
|
28
|
-
children: (jsxRuntime.jsx(linkTileProduct.DSRLinkTileProduct, { aspectRatio, description, heading, href, likeButton, liked, price, rel, target, theme: theme || hooks.useTheme(), children })),
|
|
28
|
+
children: (jsxRuntime.jsx(linkTileProduct.DSRLinkTileProduct, { aspectRatio, description, heading, href, likeButton, liked, price, priceOriginal, rel, target, theme: theme || hooks.useTheme(), children })),
|
|
29
29
|
}
|
|
30
30
|
: {
|
|
31
31
|
children,
|
|
@@ -84,8 +84,8 @@ class DSRLinkTileProduct extends react.Component {
|
|
|
84
84
|
const headingId = 'heading';
|
|
85
85
|
const priceId = 'price';
|
|
86
86
|
const descriptionId = 'description';
|
|
87
|
-
const style = minifyCss.minifyCss(stripFocusAndHoverStyles.stripFocusAndHoverStyles(stylesEntry.getLinkTileProductCss(this.props.likeButton, !this.props.href, this.props.aspectRatio, this.props.theme)));
|
|
88
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { className: "root", children: [this.props.href ? (jsxRuntime.jsx("a", { className: "anchor", href: this.props.href, target: this.props.target, rel: this.props.rel, "aria-labelledby": `${headingId} ${priceId}`, "aria-describedby": `${headerId} ${descriptionId}` })) : (jsxRuntime.jsx("slot", { name: utilsEntry.anchorSlot })), jsxRuntime.jsxs("div", { id: headerId, className: "header", children: [jsxRuntime.jsx("slot", { name: utilsEntry.headerSlot }), this.props.likeButton && (jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { className: "button", type: "button", icon: this.props.liked ? 'heart-filled' : 'heart', hideLabel: true, theme: this.props.theme, children: this.props.liked ? 'Remove from wishlist' : 'Add to wishlist' }))] }), jsxRuntime.jsx("div", { className: "image", children: jsxRuntime.jsx("slot", {}) }), jsxRuntime.jsxs("div", { className: "wrapper", children: [jsxRuntime.jsx("h3", { id: headingId, className: "heading", children: this.props.heading }), jsxRuntime.jsx("p", { id: priceId, className: "price", children: this.props.price }), jsxRuntime.jsx("p", { id: descriptionId, className: "description", children: this.props.description })] })] })] }), this.props.children] }));
|
|
87
|
+
const style = minifyCss.minifyCss(stripFocusAndHoverStyles.stripFocusAndHoverStyles(stylesEntry.getLinkTileProductCss(this.props.likeButton, !this.props.href, !!this.props.priceOriginal, !!this.props.description, this.props.aspectRatio, this.props.theme)));
|
|
88
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { className: "root", children: [this.props.href ? (jsxRuntime.jsx("a", { className: "anchor", href: this.props.href, target: this.props.target, rel: this.props.rel, "aria-labelledby": `${headingId} ${priceId}`, "aria-describedby": `${headerId} ${descriptionId}` })) : (jsxRuntime.jsx("slot", { name: utilsEntry.anchorSlot })), jsxRuntime.jsxs("div", { id: headerId, className: "header", children: [jsxRuntime.jsx("slot", { name: utilsEntry.headerSlot }), this.props.likeButton && (jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { className: "button", type: "button", icon: this.props.liked ? 'heart-filled' : 'heart', hideLabel: true, theme: this.props.theme, children: this.props.liked ? 'Remove from wishlist' : 'Add to wishlist' }))] }), jsxRuntime.jsx("div", { className: "image", children: jsxRuntime.jsx("slot", {}) }), jsxRuntime.jsxs("div", { className: "wrapper", children: [this.props.heading && (jsxRuntime.jsx("h3", { id: headingId, className: "heading", children: this.props.heading })), this.props.price && (jsxRuntime.jsx("p", { id: priceId, className: "price", children: this.props.priceOriginal ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "sr-only", children: "sale price" }), this.props.price, jsxRuntime.jsx("span", { className: "sr-only", children: "original price" }), jsxRuntime.jsx("s", { children: this.props.priceOriginal })] })) : (this.props.price) })), this.props.description && (jsxRuntime.jsx("p", { id: descriptionId, className: "description", children: this.props.description }))] })] })] }), this.props.children] }));
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -6596,9 +6596,9 @@ const getMultilineEllipsis = (lineClamp) => {
|
|
|
6596
6596
|
overflow: 'hidden',
|
|
6597
6597
|
};
|
|
6598
6598
|
};
|
|
6599
|
-
const getComponentCss$D = (hasLikeButton, hasSlottedAnchor, aspectRatio, theme) => {
|
|
6600
|
-
const { primaryColor, contrastHighColor, backgroundSurfaceColor } = getThemedColors(theme);
|
|
6601
|
-
const { primaryColor: primaryColorDark, contrastHighColor: contrastHighColorDark, backgroundSurfaceColor: backgroundSurfaceColorDark, } = getThemedColors('dark');
|
|
6599
|
+
const getComponentCss$D = (hasLikeButton, hasSlottedAnchor, hasPriceOriginal, hasDescription, aspectRatio, theme) => {
|
|
6600
|
+
const { primaryColor, contrastHighColor, contrastMediumColor, backgroundSurfaceColor } = getThemedColors(theme);
|
|
6601
|
+
const { primaryColor: primaryColorDark, contrastHighColor: contrastHighColorDark, contrastMediumColor: contrastMediumColorDark, backgroundSurfaceColor: backgroundSurfaceColorDark, } = getThemedColors('dark');
|
|
6602
6602
|
return getCss({
|
|
6603
6603
|
'@global': {
|
|
6604
6604
|
':host': {
|
|
@@ -6636,6 +6636,14 @@ const getComponentCss$D = (hasLikeButton, hasSlottedAnchor, aspectRatio, theme)
|
|
|
6636
6636
|
},
|
|
6637
6637
|
},
|
|
6638
6638
|
}),
|
|
6639
|
+
...(hasPriceOriginal && {
|
|
6640
|
+
s: {
|
|
6641
|
+
color: contrastMediumColor,
|
|
6642
|
+
...prefersColorSchemeDarkMediaQuery(theme, {
|
|
6643
|
+
color: contrastMediumColorDark,
|
|
6644
|
+
}),
|
|
6645
|
+
},
|
|
6646
|
+
}),
|
|
6639
6647
|
},
|
|
6640
6648
|
root: {
|
|
6641
6649
|
display: 'flex',
|
|
@@ -6694,25 +6702,35 @@ const getComponentCss$D = (hasLikeButton, hasSlottedAnchor, aspectRatio, theme)
|
|
|
6694
6702
|
textAlign: 'center',
|
|
6695
6703
|
},
|
|
6696
6704
|
heading: {
|
|
6705
|
+
margin: '0 0 2px', // ua-style reset
|
|
6697
6706
|
...headingSmallStyle,
|
|
6698
6707
|
...fontHyphenationStyle,
|
|
6699
6708
|
...getMultilineEllipsis(3),
|
|
6700
|
-
margin: '0 0 2px',
|
|
6701
6709
|
},
|
|
6702
6710
|
price: {
|
|
6703
|
-
...textXSmallStyle,
|
|
6704
|
-
...getMultilineEllipsis(2),
|
|
6705
|
-
margin: 0, // ua-style reset
|
|
6706
|
-
},
|
|
6707
|
-
description: {
|
|
6708
|
-
...textXXSmallStyle,
|
|
6709
|
-
...getMultilineEllipsis(2),
|
|
6710
6711
|
margin: 0, // ua-style reset
|
|
6711
|
-
|
|
6712
|
-
...
|
|
6713
|
-
|
|
6712
|
+
...textXSmallStyle,
|
|
6713
|
+
...(hasPriceOriginal && {
|
|
6714
|
+
display: 'flex',
|
|
6715
|
+
flexWrap: 'wrap',
|
|
6716
|
+
justifyContent: 'center',
|
|
6717
|
+
columnGap: spacingFluidXSmall,
|
|
6714
6718
|
}),
|
|
6715
6719
|
},
|
|
6720
|
+
...(hasDescription && {
|
|
6721
|
+
description: {
|
|
6722
|
+
margin: 0, // ua-style reset
|
|
6723
|
+
...textXXSmallStyle,
|
|
6724
|
+
...getMultilineEllipsis(2),
|
|
6725
|
+
color: contrastHighColor,
|
|
6726
|
+
...prefersColorSchemeDarkMediaQuery(theme, {
|
|
6727
|
+
color: contrastHighColorDark,
|
|
6728
|
+
}),
|
|
6729
|
+
},
|
|
6730
|
+
}),
|
|
6731
|
+
...(hasPriceOriginal && {
|
|
6732
|
+
'sr-only': getHiddenTextJssStyle(),
|
|
6733
|
+
}),
|
|
6716
6734
|
});
|
|
6717
6735
|
};
|
|
6718
6736
|
|
|
@@ -5,14 +5,14 @@ import { useEventCallback, usePrefix, useTheme, useBrowserLayoutEffect, useMerge
|
|
|
5
5
|
import { syncRef } from '../../utils.mjs';
|
|
6
6
|
import { DSRLinkTileProduct } from '../dsr-components/link-tile-product.mjs';
|
|
7
7
|
|
|
8
|
-
const PLinkTileProduct = forwardRef(({ aspectRatio = '3:4', description, heading, href, likeButton = true, liked = false, onLike, price, rel, target = '_self', theme, className, children, ...rest }, ref) => {
|
|
8
|
+
const PLinkTileProduct = forwardRef(({ aspectRatio = '3:4', description, heading, href, likeButton = true, liked = false, onLike, price, priceOriginal, rel, target = '_self', theme, className, children, ...rest }, ref) => {
|
|
9
9
|
const elementRef = useRef();
|
|
10
10
|
useEventCallback(elementRef, 'like', onLike);
|
|
11
11
|
const WebComponentTag = usePrefix('p-link-tile-product');
|
|
12
|
-
const propsToSync = [aspectRatio, description, heading, href, likeButton, liked, price, rel, target, theme || useTheme()];
|
|
12
|
+
const propsToSync = [aspectRatio, description, heading, href, likeButton, liked, price, priceOriginal, rel, target, theme || useTheme()];
|
|
13
13
|
useBrowserLayoutEffect(() => {
|
|
14
14
|
const { current } = elementRef;
|
|
15
|
-
['aspectRatio', 'description', 'heading', 'href', 'likeButton', 'liked', 'price', 'rel', 'target', 'theme'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
15
|
+
['aspectRatio', 'description', 'heading', 'href', 'likeButton', 'liked', 'price', 'priceOriginal', 'rel', 'target', 'theme'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
16
16
|
}, propsToSync);
|
|
17
17
|
// @ts-ignore
|
|
18
18
|
if (!process.browser) {
|
|
@@ -23,7 +23,7 @@ const PLinkTileProduct = forwardRef(({ aspectRatio = '3:4', description, heading
|
|
|
23
23
|
// @ts-ignore
|
|
24
24
|
...(!process.browser
|
|
25
25
|
? {
|
|
26
|
-
children: (jsx(DSRLinkTileProduct, { aspectRatio, description, heading, href, likeButton, liked, price, rel, target, theme: theme || useTheme(), children })),
|
|
26
|
+
children: (jsx(DSRLinkTileProduct, { aspectRatio, description, heading, href, likeButton, liked, price, priceOriginal, rel, target, theme: theme || useTheme(), children })),
|
|
27
27
|
}
|
|
28
28
|
: {
|
|
29
29
|
children,
|
|
@@ -82,8 +82,8 @@ class DSRLinkTileProduct extends Component {
|
|
|
82
82
|
const headingId = 'heading';
|
|
83
83
|
const priceId = 'price';
|
|
84
84
|
const descriptionId = 'description';
|
|
85
|
-
const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$D(this.props.likeButton, !this.props.href, this.props.aspectRatio, this.props.theme)));
|
|
86
|
-
return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs("div", { className: "root", children: [this.props.href ? (jsx("a", { className: "anchor", href: this.props.href, target: this.props.target, rel: this.props.rel, "aria-labelledby": `${headingId} ${priceId}`, "aria-describedby": `${headerId} ${descriptionId}` })) : (jsx("slot", { name: anchorSlot })), jsxs("div", { id: headerId, className: "header", children: [jsx("slot", { name: headerSlot }), this.props.likeButton && (jsx(PButtonPure, { className: "button", type: "button", icon: this.props.liked ? 'heart-filled' : 'heart', hideLabel: true, theme: this.props.theme, children: this.props.liked ? 'Remove from wishlist' : 'Add to wishlist' }))] }), jsx("div", { className: "image", children: jsx("slot", {}) }), jsxs("div", { className: "wrapper", children: [jsx("h3", { id: headingId, className: "heading", children: this.props.heading }), jsx("p", { id: priceId, className: "price", children: this.props.price }), jsx("p", { id: descriptionId, className: "description", children: this.props.description })] })] })] }), this.props.children] }));
|
|
85
|
+
const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$D(this.props.likeButton, !this.props.href, !!this.props.priceOriginal, !!this.props.description, this.props.aspectRatio, this.props.theme)));
|
|
86
|
+
return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs("div", { className: "root", children: [this.props.href ? (jsx("a", { className: "anchor", href: this.props.href, target: this.props.target, rel: this.props.rel, "aria-labelledby": `${headingId} ${priceId}`, "aria-describedby": `${headerId} ${descriptionId}` })) : (jsx("slot", { name: anchorSlot })), jsxs("div", { id: headerId, className: "header", children: [jsx("slot", { name: headerSlot }), this.props.likeButton && (jsx(PButtonPure, { className: "button", type: "button", icon: this.props.liked ? 'heart-filled' : 'heart', hideLabel: true, theme: this.props.theme, children: this.props.liked ? 'Remove from wishlist' : 'Add to wishlist' }))] }), jsx("div", { className: "image", children: jsx("slot", {}) }), jsxs("div", { className: "wrapper", children: [this.props.heading && (jsx("h3", { id: headingId, className: "heading", children: this.props.heading })), this.props.price && (jsx("p", { id: priceId, className: "price", children: this.props.priceOriginal ? (jsxs(Fragment, { children: [jsx("span", { className: "sr-only", children: "sale price" }), this.props.price, jsx("span", { className: "sr-only", children: "original price" }), jsx("s", { children: this.props.priceOriginal })] })) : (this.props.price) })), this.props.description && (jsx("p", { id: descriptionId, className: "description", children: this.props.description }))] })] })] }), this.props.children] }));
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -6,11 +6,11 @@ export type PLinkTileProductProps = Omit<HTMLAttributes<{}>, 'color'> & {
|
|
|
6
6
|
*/
|
|
7
7
|
aspectRatio?: BreakpointCustomizable<LinkTileProductAspectRatio>;
|
|
8
8
|
/**
|
|
9
|
-
* Additional product description
|
|
9
|
+
* Additional product description.
|
|
10
10
|
*/
|
|
11
11
|
description?: string;
|
|
12
12
|
/**
|
|
13
|
-
* Product heading
|
|
13
|
+
* Product heading.
|
|
14
14
|
*/
|
|
15
15
|
heading: string;
|
|
16
16
|
/**
|
|
@@ -30,9 +30,13 @@ export type PLinkTileProductProps = Omit<HTMLAttributes<{}>, 'color'> & {
|
|
|
30
30
|
*/
|
|
31
31
|
onLike?: (event: CustomEvent<LinkTileProductLikeEventDetail>) => void;
|
|
32
32
|
/**
|
|
33
|
-
* Product price
|
|
33
|
+
* Product retail price (with or without discount).
|
|
34
34
|
*/
|
|
35
35
|
price: string;
|
|
36
|
+
/**
|
|
37
|
+
* Shows original price (recommended retail price) with line-through. Needs prop "price" to be defined, otherwise this prop has no effect.
|
|
38
|
+
*/
|
|
39
|
+
priceOriginal?: string;
|
|
36
40
|
/**
|
|
37
41
|
* Specifies the relationship of the target object to the link object.
|
|
38
42
|
*/
|
|
@@ -52,11 +56,11 @@ export declare const PLinkTileProduct: import("react").ForwardRefExoticComponent
|
|
|
52
56
|
*/
|
|
53
57
|
aspectRatio?: BreakpointCustomizable<LinkTileProductAspectRatio>;
|
|
54
58
|
/**
|
|
55
|
-
* Additional product description
|
|
59
|
+
* Additional product description.
|
|
56
60
|
*/
|
|
57
61
|
description?: string;
|
|
58
62
|
/**
|
|
59
|
-
* Product heading
|
|
63
|
+
* Product heading.
|
|
60
64
|
*/
|
|
61
65
|
heading: string;
|
|
62
66
|
/**
|
|
@@ -76,9 +80,13 @@ export declare const PLinkTileProduct: import("react").ForwardRefExoticComponent
|
|
|
76
80
|
*/
|
|
77
81
|
onLike?: (event: CustomEvent<LinkTileProductLikeEventDetail>) => void;
|
|
78
82
|
/**
|
|
79
|
-
* Product price
|
|
83
|
+
* Product retail price (with or without discount).
|
|
80
84
|
*/
|
|
81
85
|
price: string;
|
|
86
|
+
/**
|
|
87
|
+
* Shows original price (recommended retail price) with line-through. Needs prop "price" to be defined, otherwise this prop has no effect.
|
|
88
|
+
*/
|
|
89
|
+
priceOriginal?: string;
|
|
82
90
|
/**
|
|
83
91
|
* Specifies the relationship of the target object to the link object.
|
|
84
92
|
*/
|