@porsche-design-system/components-react 2.16.3 → 2.17.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 +14 -0
- package/LICENSE +3 -3
- package/esm/public-api.js +19 -5
- package/hooks.d.ts +0 -1
- package/jsdom-polyfill/index.js +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/link-tile.wrapper.d.ts +112 -0
- package/lib/types.d.ts +23 -0
- package/package.json +2 -2
- package/provider.d.ts +1 -4
- package/public-api.js +19 -4
|
@@ -18,6 +18,7 @@ export * from './inline-notification.wrapper';
|
|
|
18
18
|
export * from './link.wrapper';
|
|
19
19
|
export * from './link-pure.wrapper';
|
|
20
20
|
export * from './link-social.wrapper';
|
|
21
|
+
export * from './link-tile.wrapper';
|
|
21
22
|
export * from './marque.wrapper';
|
|
22
23
|
export * from './modal.wrapper';
|
|
23
24
|
export * from './pagination.wrapper';
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import type { LinkTileAlign, SelectedAriaAttributes, LinkAriaAttributes, BreakpointCustomizable, LinkTileAspectRatio, LinkTileSize, LinkTarget, LinkTileWeight } from '../types';
|
|
3
|
+
export declare type PLinkTileProps = Omit<HTMLAttributes<{}>, 'color'> & {
|
|
4
|
+
/**
|
|
5
|
+
* Alignment of link and description.
|
|
6
|
+
*/
|
|
7
|
+
align?: LinkTileAlign;
|
|
8
|
+
/**
|
|
9
|
+
* Add ARIA attributes.
|
|
10
|
+
*/
|
|
11
|
+
aria?: SelectedAriaAttributes<LinkAriaAttributes>;
|
|
12
|
+
/**
|
|
13
|
+
* Aspect ratio of the link-tile.
|
|
14
|
+
*/
|
|
15
|
+
aspectRatio?: BreakpointCustomizable<LinkTileAspectRatio>;
|
|
16
|
+
/**
|
|
17
|
+
* Displays the tile-link as compact version with description and link icon only.
|
|
18
|
+
*/
|
|
19
|
+
compact?: BreakpointCustomizable<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Description text.
|
|
22
|
+
*/
|
|
23
|
+
description: string;
|
|
24
|
+
/**
|
|
25
|
+
* Special download attribute to open native browser download dialog if target url points to a downloadable file.
|
|
26
|
+
*/
|
|
27
|
+
download?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Show gradient.
|
|
30
|
+
*/
|
|
31
|
+
gradient?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* href of the `<a>`.
|
|
34
|
+
*/
|
|
35
|
+
href: string;
|
|
36
|
+
/**
|
|
37
|
+
* Label of the <a />.
|
|
38
|
+
*/
|
|
39
|
+
label: string;
|
|
40
|
+
/**
|
|
41
|
+
* Specifies the relationship of the target object to the link object.
|
|
42
|
+
*/
|
|
43
|
+
rel?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Font size of the description.
|
|
46
|
+
*/
|
|
47
|
+
size?: BreakpointCustomizable<LinkTileSize>;
|
|
48
|
+
/**
|
|
49
|
+
* Target attribute where the link should be opened.
|
|
50
|
+
*/
|
|
51
|
+
target?: LinkTarget;
|
|
52
|
+
/**
|
|
53
|
+
* Font weight of the description.
|
|
54
|
+
*/
|
|
55
|
+
weight?: BreakpointCustomizable<LinkTileWeight>;
|
|
56
|
+
};
|
|
57
|
+
export declare const PLinkTile: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<{}>, "color"> & {
|
|
58
|
+
/**
|
|
59
|
+
* Alignment of link and description.
|
|
60
|
+
*/
|
|
61
|
+
align?: LinkTileAlign;
|
|
62
|
+
/**
|
|
63
|
+
* Add ARIA attributes.
|
|
64
|
+
*/
|
|
65
|
+
aria?: SelectedAriaAttributes<LinkAriaAttributes>;
|
|
66
|
+
/**
|
|
67
|
+
* Aspect ratio of the link-tile.
|
|
68
|
+
*/
|
|
69
|
+
aspectRatio?: BreakpointCustomizable<LinkTileAspectRatio>;
|
|
70
|
+
/**
|
|
71
|
+
* Displays the tile-link as compact version with description and link icon only.
|
|
72
|
+
*/
|
|
73
|
+
compact?: BreakpointCustomizable<boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* Description text.
|
|
76
|
+
*/
|
|
77
|
+
description: string;
|
|
78
|
+
/**
|
|
79
|
+
* Special download attribute to open native browser download dialog if target url points to a downloadable file.
|
|
80
|
+
*/
|
|
81
|
+
download?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Show gradient.
|
|
84
|
+
*/
|
|
85
|
+
gradient?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* href of the `<a>`.
|
|
88
|
+
*/
|
|
89
|
+
href: string;
|
|
90
|
+
/**
|
|
91
|
+
* Label of the <a />.
|
|
92
|
+
*/
|
|
93
|
+
label: string;
|
|
94
|
+
/**
|
|
95
|
+
* Specifies the relationship of the target object to the link object.
|
|
96
|
+
*/
|
|
97
|
+
rel?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Font size of the description.
|
|
100
|
+
*/
|
|
101
|
+
size?: BreakpointCustomizable<LinkTileSize>;
|
|
102
|
+
/**
|
|
103
|
+
* Target attribute where the link should be opened.
|
|
104
|
+
*/
|
|
105
|
+
target?: LinkTarget;
|
|
106
|
+
/**
|
|
107
|
+
* Font weight of the description.
|
|
108
|
+
*/
|
|
109
|
+
weight?: BreakpointCustomizable<LinkTileWeight>;
|
|
110
|
+
} & {
|
|
111
|
+
children?: import("react").ReactNode;
|
|
112
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
package/lib/types.d.ts
CHANGED
|
@@ -563,6 +563,29 @@ declare const LINK_ARIA_ATTRIBUTES: readonly [
|
|
|
563
563
|
];
|
|
564
564
|
export declare type LinkAriaAttributes = typeof LINK_ARIA_ATTRIBUTES[number];
|
|
565
565
|
export declare type SocialIconName = Extract<IconName, "logo-facebook" | "logo-google" | "logo-instagram" | "logo-linkedin" | "logo-pinterest" | "logo-twitter" | "logo-wechat" | "logo-whatsapp" | "logo-xing" | "logo-youtube" | "logo-baidu" | "logo-delicious" | "logo-digg" | "logo-foursquare" | "logo-gmail" | "logo-hatena" | "logo-kaixin" | "logo-kakaotalk" | "logo-naver" | "logo-qq-share" | "logo-qq" | "logo-reddit" | "logo-skyrock" | "logo-sohu" | "logo-tecent" | "logo-telegram" | "logo-tiktok" | "logo-tumblr" | "logo-viber" | "logo-vk" | "logo-weibo" | "logo-yahoo" | "logo-youku">;
|
|
566
|
+
declare const LINK_TILE_WEIGHTS: readonly [
|
|
567
|
+
"regular",
|
|
568
|
+
"semibold"
|
|
569
|
+
];
|
|
570
|
+
export declare type LinkTileWeight = typeof LINK_TILE_WEIGHTS[number];
|
|
571
|
+
declare const LINK_TILE_SIZES: readonly [
|
|
572
|
+
"default",
|
|
573
|
+
"inherit"
|
|
574
|
+
];
|
|
575
|
+
export declare type LinkTileSize = typeof LINK_TILE_SIZES[number];
|
|
576
|
+
declare const LINK_TILE_ALIGNS: readonly [
|
|
577
|
+
"top",
|
|
578
|
+
"bottom"
|
|
579
|
+
];
|
|
580
|
+
export declare type LinkTileAlign = typeof LINK_TILE_ALIGNS[number];
|
|
581
|
+
declare const LINK_TILE_ASPECT_RATIOS: readonly [
|
|
582
|
+
"1:1",
|
|
583
|
+
"4:3",
|
|
584
|
+
"3:4",
|
|
585
|
+
"16:9",
|
|
586
|
+
"9:16"
|
|
587
|
+
];
|
|
588
|
+
export declare type LinkTileAspectRatio = typeof LINK_TILE_ASPECT_RATIOS[number];
|
|
566
589
|
declare const MARQUE_SIZES: readonly [
|
|
567
590
|
"responsive",
|
|
568
591
|
"small",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@porsche-design-system/components-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.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": "2.
|
|
20
|
+
"@porsche-design-system/components-js": "2.17.0-rc.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"react": ">=17.0.0 <19.0.0",
|
package/provider.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
2
|
export declare const PorscheDesignSystemContext: import("react").Context<{
|
|
3
3
|
prefix: any;
|
|
4
|
-
usesSkeletons: any;
|
|
5
4
|
}>;
|
|
6
|
-
export declare const hasSkeleton: () => boolean;
|
|
7
5
|
declare type Props = {
|
|
8
6
|
prefix?: string;
|
|
9
|
-
usesSkeletons?: boolean;
|
|
10
7
|
};
|
|
11
|
-
export declare const PorscheDesignSystemProvider: ({ prefix,
|
|
8
|
+
export declare const PorscheDesignSystemProvider: ({ prefix, ...props }: PropsWithChildren<Props>) => JSX.Element;
|
|
12
9
|
export {};
|
package/public-api.js
CHANGED
|
@@ -9,14 +9,12 @@ var react = require('react');
|
|
|
9
9
|
// to warn users about missing PorscheDesignSystemProvider, we set the default values as undefined
|
|
10
10
|
const PorscheDesignSystemContext = react.createContext({
|
|
11
11
|
prefix: undefined,
|
|
12
|
-
usesSkeletons: undefined,
|
|
13
12
|
});
|
|
14
|
-
const
|
|
15
|
-
const PorscheDesignSystemProvider = ({ prefix = '', usesSkeletons = hasSkeleton(), ...props }) => {
|
|
13
|
+
const PorscheDesignSystemProvider = ({ prefix = '', ...props }) => {
|
|
16
14
|
react.useEffect(() => {
|
|
17
15
|
componentsJs.load({ prefix });
|
|
18
16
|
}, [prefix]);
|
|
19
|
-
return jsxRuntime.jsx(PorscheDesignSystemContext.Provider, { value: { prefix
|
|
17
|
+
return jsxRuntime.jsx(PorscheDesignSystemContext.Provider, { value: { prefix }, ...props });
|
|
20
18
|
};
|
|
21
19
|
|
|
22
20
|
const splitToArray = (str) => str.split(' ').filter((str) => str);
|
|
@@ -426,6 +424,22 @@ const PLinkSocial = /*#__PURE__*/ react.forwardRef(({ hideLabel = false, href, i
|
|
|
426
424
|
return jsxRuntime.jsx(Tag, { ...props });
|
|
427
425
|
});
|
|
428
426
|
|
|
427
|
+
const PLinkTile = /*#__PURE__*/ react.forwardRef(({ align = 'bottom', aria, aspectRatio = '4:3', compact = false, description, download, gradient = true, href, label, rel, size = 'default', target = '_self', weight = 'semibold', className, ...rest }, ref) => {
|
|
428
|
+
const elementRef = react.useRef();
|
|
429
|
+
const Tag = usePrefix('p-link-tile');
|
|
430
|
+
const propsToSync = [align, aria, aspectRatio, compact, description, download, gradient, href, label, rel, size, target, weight];
|
|
431
|
+
useBrowserLayoutEffect(() => {
|
|
432
|
+
const { current } = elementRef;
|
|
433
|
+
['align', 'aria', 'aspectRatio', 'compact', 'description', 'download', 'gradient', 'href', 'label', 'rel', 'size', 'target', 'weight'].forEach((propName, i) => (current[propName] = propsToSync[i]));
|
|
434
|
+
}, propsToSync);
|
|
435
|
+
const props = {
|
|
436
|
+
...rest,
|
|
437
|
+
class: useMergedClass(elementRef, className),
|
|
438
|
+
ref: syncRef(elementRef, ref)
|
|
439
|
+
};
|
|
440
|
+
return jsxRuntime.jsx(Tag, { ...props });
|
|
441
|
+
});
|
|
442
|
+
|
|
429
443
|
const PMarque = /*#__PURE__*/ react.forwardRef(({ aria, href, size = 'responsive', target = '_self', trademark = true, className, ...rest }, ref) => {
|
|
430
444
|
const elementRef = react.useRef();
|
|
431
445
|
const Tag = usePrefix('p-marque');
|
|
@@ -922,6 +936,7 @@ exports.PInlineNotification = PInlineNotification;
|
|
|
922
936
|
exports.PLink = PLink;
|
|
923
937
|
exports.PLinkPure = PLinkPure;
|
|
924
938
|
exports.PLinkSocial = PLinkSocial;
|
|
939
|
+
exports.PLinkTile = PLinkTile;
|
|
925
940
|
exports.PMarque = PMarque;
|
|
926
941
|
exports.PModal = PModal;
|
|
927
942
|
exports.PPagination = PPagination;
|