@kvdbil/components 8.4.1 → 8.4.2
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.
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components"),o=require("../../theme.js");function i(p){return p&&typeof p=="object"&&"default"in p?p:{default:p}}var r=i(e),n=i(t);const l=n.default.div`
|
|
2
2
|
position: relative;
|
|
3
|
-
height:
|
|
4
|
-
|
|
5
|
-
background-color: ${r.default.colors.primary.main};
|
|
3
|
+
min-height: 500px;
|
|
4
|
+
background-color: ${o.default.colors.primary.main};
|
|
6
5
|
background-size: cover;
|
|
7
|
-
|
|
6
|
+
display: flex;
|
|
7
|
+
`,a=n.default.div`
|
|
8
|
+
pointer-events: ${({$pointerEvents:p})=>p};
|
|
8
9
|
position: relative;
|
|
9
10
|
display: flex;
|
|
11
|
+
flex-direction: ${({$direction:p})=>p};
|
|
12
|
+
align-items: ${({$align:p})=>p};
|
|
13
|
+
justify-content: ${({$justify:p})=>p};
|
|
10
14
|
padding: 50px;
|
|
11
15
|
z-index: 1;
|
|
12
|
-
|
|
16
|
+
flex: 1;
|
|
17
|
+
`,d=n.default.iframe`
|
|
13
18
|
position: absolute;
|
|
14
19
|
width: 100%;
|
|
15
20
|
height: 100%;
|
|
16
21
|
top: 0;
|
|
17
22
|
left: 0;
|
|
18
|
-
`,c=
|
|
23
|
+
`,s=p=>typeof p=="number",u=p=>typeof p=="string",c=n.default.img`
|
|
19
24
|
position: absolute;
|
|
20
25
|
top: 0;
|
|
21
26
|
left: 0;
|
|
22
27
|
height: 100%;
|
|
23
28
|
width: 100%;
|
|
24
29
|
object-fit: cover;
|
|
25
|
-
background-color: ${
|
|
26
|
-
|
|
30
|
+
background-color: ${o.default.colors.primary.main};
|
|
31
|
+
object-position: ${({$positionX:p,$positionY:$})=>s(p)&&s($)?`${p}% ${$}%`:u(p)&&u($)?`${p} ${$}`:p||$?`${(s(p)?`${p}%`:p)||"50%"} ${(s($)?`${$}%`:$)||"50%"}`:"50% 50%"};
|
|
32
|
+
`;function f(p){const{imageProps:$,containerStyle:g,videoProps:m,children:v,align:b,direction:h,justify:x}=p,{autoplay:j=0,controls:w=0,disablekb:k=0,end:y,loop:E=0,modestbranding:q=1,start:P=0,showInfo:z=0}=(m==null?void 0:m.ytConfig)||{};return r.default.createElement(l,{style:g},m?r.default.createElement(d,{"data-testid":"hero-video",title:"video-frame",src:`${m.src}?disabledkb=${k}&autoplay=${j}&controls=${w}&loop=${E}&modestbranding=${q}&start=${P}&showInfo=${z}${y?`&end=${y}`:""}`,width:"100%",height:"100%",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0}):r.default.createElement(c,{$positionX:$==null?void 0:$.x,$positionY:$==null?void 0:$.y,src:$==null?void 0:$.src,alt:"Hero background"}),r.default.createElement(a,{$pointerEvents:m?"none":"auto",$align:b||"flex-start",$direction:h||"column",$justify:x||"flex-start"},v))}exports.Hero=f,exports.default=f;
|
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"react";import n from"styled-components";import c from"../../theme.js";const w=n.div`
|
|
2
2
|
position: relative;
|
|
3
|
-
height:
|
|
4
|
-
|
|
5
|
-
background-color: ${i.colors.primary.main};
|
|
3
|
+
min-height: 500px;
|
|
4
|
+
background-color: ${c.colors.primary.main};
|
|
6
5
|
background-size: cover;
|
|
7
|
-
|
|
6
|
+
display: flex;
|
|
7
|
+
`,j=n.div`
|
|
8
|
+
pointer-events: ${({$pointerEvents:e})=>e};
|
|
8
9
|
position: relative;
|
|
9
10
|
display: flex;
|
|
11
|
+
flex-direction: ${({$direction:e})=>e};
|
|
12
|
+
align-items: ${({$align:e})=>e};
|
|
13
|
+
justify-content: ${({$justify:e})=>e};
|
|
10
14
|
padding: 50px;
|
|
11
15
|
z-index: 1;
|
|
12
|
-
|
|
16
|
+
flex: 1;
|
|
17
|
+
`,k=n.iframe`
|
|
13
18
|
position: absolute;
|
|
14
19
|
width: 100%;
|
|
15
20
|
height: 100%;
|
|
16
21
|
top: 0;
|
|
17
22
|
left: 0;
|
|
18
|
-
`,
|
|
23
|
+
`,i=e=>typeof e=="number",s=e=>typeof e=="string",E=({$positionX:e,$positionY:t})=>{if(i(e)&&i(t))return`${e}% ${t}%`;if(s(e)&&s(t))return`${e} ${t}`;if(e||t){const l=i(e)?`${e}%`:e,o=i(t)?`${t}%`:t;return`${l||"50%"} ${o||"50%"}`}return"50% 50%"},I=n.img`
|
|
19
24
|
position: absolute;
|
|
20
25
|
top: 0;
|
|
21
26
|
left: 0;
|
|
22
27
|
height: 100%;
|
|
23
28
|
width: 100%;
|
|
24
29
|
object-fit: cover;
|
|
25
|
-
background-color: ${
|
|
26
|
-
|
|
30
|
+
background-color: ${c.colors.primary.main};
|
|
31
|
+
object-position: ${E};
|
|
32
|
+
`;function d(e){const{imageProps:t,containerStyle:l,videoProps:o,children:u,align:m,direction:f,justify:p}=e,{autoplay:g=0,controls:y=0,disablekb:b=0,end:a,loop:h=0,modestbranding:v=1,start:$=0,showInfo:x=0}=(o==null?void 0:o.ytConfig)||{};return r.createElement(w,{style:l},o?r.createElement(k,{"data-testid":"hero-video",title:"video-frame",src:`${o.src}?disabledkb=${b}&autoplay=${g}&controls=${y}&loop=${h}&modestbranding=${v}&start=${$}&showInfo=${x}${a?`&end=${a}`:""}`,width:"100%",height:"100%",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0}):r.createElement(I,{$positionX:t==null?void 0:t.x,$positionY:t==null?void 0:t.y,src:t==null?void 0:t.src,alt:"Hero background"}),r.createElement(j,{$pointerEvents:o?"none":"auto",$align:m||"flex-start",$direction:f||"column",$justify:p||"flex-start"},u))}export{d as Hero,d as default};
|
package/package.json
CHANGED
|
@@ -1,17 +1,37 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { CSSProperties } from 'styled-components';
|
|
3
|
+
declare type Justify = Exclude<CSSProperties['justifyContent'], number>;
|
|
4
|
+
declare type Align = Exclude<CSSProperties['alignItems'], number>;
|
|
5
|
+
declare type Direction = CSSProperties['flexDirection'];
|
|
6
|
+
declare type ObjectPositionX = number | 'center' | 'left' | 'right';
|
|
7
|
+
declare type ObjectPositionY = number | 'center' | 'top' | 'bottom';
|
|
2
8
|
export interface HeroBaseProps {
|
|
3
9
|
children?: ReactNode;
|
|
4
10
|
containerStyle?: Record<string, string>;
|
|
5
11
|
videoProps?: VideoProps;
|
|
6
12
|
imageProps?: ImageProps;
|
|
13
|
+
justify?: Justify;
|
|
14
|
+
align?: Align;
|
|
15
|
+
direction?: Direction;
|
|
7
16
|
}
|
|
17
|
+
declare type YouTubeVideoProps = {
|
|
18
|
+
autoplay: 0 | 1;
|
|
19
|
+
controls: 0 | 1;
|
|
20
|
+
disablekb: 0 | 1;
|
|
21
|
+
end: number;
|
|
22
|
+
loop: 0 | 1;
|
|
23
|
+
modestbranding: 0 | 1;
|
|
24
|
+
start: number;
|
|
25
|
+
showInfo: 0 | 1;
|
|
26
|
+
};
|
|
8
27
|
declare type ImageProps = {
|
|
9
28
|
src: string;
|
|
10
|
-
x?:
|
|
11
|
-
y?:
|
|
29
|
+
x?: ObjectPositionX;
|
|
30
|
+
y?: ObjectPositionY;
|
|
12
31
|
};
|
|
13
32
|
declare type VideoProps = {
|
|
14
33
|
src: string;
|
|
34
|
+
ytConfig?: Partial<YouTubeVideoProps>;
|
|
15
35
|
};
|
|
16
36
|
export interface ImageBannerProps extends HeroBaseProps {
|
|
17
37
|
imageProps: ImageProps;
|