@elvia/elvis-spotlight 1.6.1 → 1.6.3
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.json +22 -0
- package/dist/main/web-component.js +96 -0
- package/dist/react/{js/elvia-spotlight.d.ts → elvia-spotlight.d.ts} +1 -1
- package/dist/react/elvia-spotlight.js +71 -0
- package/dist/react/{js/elvia-spotlight.types.d.ts → elvia-spotlight.types.d.ts} +3 -1
- package/dist/react/elvia-spotlight.types.js +0 -0
- package/package.json +5 -7
- package/react.d.ts +2 -5
- package/react.js +1 -1
- package/dist/react/js/config.d.ts +0 -2
- package/dist/react/js/config.js +0 -6
- package/dist/react/js/config.js.map +0 -1
- package/dist/react/js/elvia-spotlight.js +0 -6
- package/dist/react/js/elvia-spotlight.js.map +0 -1
- package/dist/react/js/elvia-spotlight.types.js +0 -6
- package/dist/react/js/elvia-spotlight.types.js.map +0 -1
- package/dist/react/js/styledComponents.js +0 -6
- package/dist/react/js/styledComponents.js.map +0 -1
- package/dist/react/js/useLockBodyScroll.js +0 -7
- package/dist/react/js/useLockBodyScroll.js.map +0 -1
- package/dist/web_component/js/elvia-spotlight.js +0 -149
- package/web_component.js +0 -1
- /package/dist/react/{js/styledComponents.d.ts → styledComponents.d.ts} +0 -0
- /package/dist/react/{js/useLockBodyScroll.d.ts → useLockBodyScroll.d.ts} +0 -0
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "../../changelogSchema.json",
|
|
3
3
|
"content": [
|
|
4
|
+
{
|
|
5
|
+
"date": "11.03.24",
|
|
6
|
+
"version": "1.6.3",
|
|
7
|
+
"changelog": [
|
|
8
|
+
{
|
|
9
|
+
"type": "bug_fix",
|
|
10
|
+
"changes": [
|
|
11
|
+
"Fixed a problem where the spotlight background would not resize when the window was resized."
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"date": "06.10.23",
|
|
18
|
+
"version": "1.6.2",
|
|
19
|
+
"changelog": [
|
|
20
|
+
{
|
|
21
|
+
"type": "patch",
|
|
22
|
+
"changes": ["Updated internal dependencies."]
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
4
26
|
{
|
|
5
27
|
"date": "30.08.23",
|
|
6
28
|
"version": "1.6.1",
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// components/elvis-spotlight/src/react/config.ts
|
|
2
|
+
import * as ReactComponent from "../../react.js";
|
|
3
|
+
import { ElvisComponentWrapper } from "@elvia/elvis-component-wrapper";
|
|
4
|
+
var ElviaComponent = class _ElviaComponent extends ElvisComponentWrapper {
|
|
5
|
+
static get observedAttributes() {
|
|
6
|
+
return ["position", "shape", "radius", "rectangleprops", "haslockbodyscroll", "transitionduration", "classname", "inlinestyle"];
|
|
7
|
+
}
|
|
8
|
+
static getComponentData() {
|
|
9
|
+
return { "name": "Spotlight", "attributes": [{ "name": "position", "type": "object" }, { "name": "shape", "type": "string" }, { "name": "radius", "type": "number" }, { "name": "rectangleProps", "type": "object" }, { "name": "hasLockBodyScroll", "type": "boolean" }, { "name": "transitionDuration", "type": "string" }, { "name": "className", "type": "string" }, { "name": "inlineStyle", "type": "object" }] };
|
|
10
|
+
}
|
|
11
|
+
set position(newValue) {
|
|
12
|
+
super.setProps({ "position": newValue });
|
|
13
|
+
}
|
|
14
|
+
get position() {
|
|
15
|
+
return super.getProps()["position"];
|
|
16
|
+
}
|
|
17
|
+
set shape(newValue) {
|
|
18
|
+
super.setProps({ "shape": newValue });
|
|
19
|
+
}
|
|
20
|
+
get shape() {
|
|
21
|
+
return super.getProps()["shape"];
|
|
22
|
+
}
|
|
23
|
+
set radius(newValue) {
|
|
24
|
+
super.setProps({ "radius": newValue });
|
|
25
|
+
}
|
|
26
|
+
get radius() {
|
|
27
|
+
return super.getProps()["radius"];
|
|
28
|
+
}
|
|
29
|
+
set rectangleProps(newValue) {
|
|
30
|
+
super.setProps({ "rectangleprops": newValue });
|
|
31
|
+
}
|
|
32
|
+
get rectangleProps() {
|
|
33
|
+
return super.getProps()["rectangleprops"];
|
|
34
|
+
}
|
|
35
|
+
set rectangleprops(newValue) {
|
|
36
|
+
super.setProps({ "rectangleprops": newValue });
|
|
37
|
+
}
|
|
38
|
+
get rectangleprops() {
|
|
39
|
+
return super.getProps()["rectangleprops"];
|
|
40
|
+
}
|
|
41
|
+
set hasLockBodyScroll(newValue) {
|
|
42
|
+
super.setProps({ "haslockbodyscroll": newValue });
|
|
43
|
+
}
|
|
44
|
+
get hasLockBodyScroll() {
|
|
45
|
+
return super.getProps()["haslockbodyscroll"];
|
|
46
|
+
}
|
|
47
|
+
set haslockbodyscroll(newValue) {
|
|
48
|
+
super.setProps({ "haslockbodyscroll": newValue });
|
|
49
|
+
}
|
|
50
|
+
get haslockbodyscroll() {
|
|
51
|
+
return super.getProps()["haslockbodyscroll"];
|
|
52
|
+
}
|
|
53
|
+
set transitionDuration(newValue) {
|
|
54
|
+
super.setProps({ "transitionduration": newValue });
|
|
55
|
+
}
|
|
56
|
+
get transitionDuration() {
|
|
57
|
+
return super.getProps()["transitionduration"];
|
|
58
|
+
}
|
|
59
|
+
set transitionduration(newValue) {
|
|
60
|
+
super.setProps({ "transitionduration": newValue });
|
|
61
|
+
}
|
|
62
|
+
get transitionduration() {
|
|
63
|
+
return super.getProps()["transitionduration"];
|
|
64
|
+
}
|
|
65
|
+
set className(newValue) {
|
|
66
|
+
super.setProps({ "classname": newValue });
|
|
67
|
+
}
|
|
68
|
+
get className() {
|
|
69
|
+
return super.getProps()["classname"];
|
|
70
|
+
}
|
|
71
|
+
set classname(newValue) {
|
|
72
|
+
super.setProps({ "classname": newValue });
|
|
73
|
+
}
|
|
74
|
+
get classname() {
|
|
75
|
+
return super.getProps()["classname"];
|
|
76
|
+
}
|
|
77
|
+
set inlineStyle(newValue) {
|
|
78
|
+
super.setProps({ "inlinestyle": newValue });
|
|
79
|
+
}
|
|
80
|
+
get inlineStyle() {
|
|
81
|
+
return super.getProps()["inlinestyle"];
|
|
82
|
+
}
|
|
83
|
+
set inlinestyle(newValue) {
|
|
84
|
+
super.setProps({ "inlinestyle": newValue });
|
|
85
|
+
}
|
|
86
|
+
get inlinestyle() {
|
|
87
|
+
return super.getProps()["inlinestyle"];
|
|
88
|
+
}
|
|
89
|
+
constructor() {
|
|
90
|
+
super(_ElviaComponent, ReactComponent["Spotlight"]);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
window.customElements.define(`elvia-spotlight`, ElviaComponent);
|
|
94
|
+
export {
|
|
95
|
+
ElviaComponent as default
|
|
96
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// components/elvis-spotlight/src/react/elvia-spotlight.tsx
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
// components/elvis-spotlight/src/react/styledComponents.tsx
|
|
5
|
+
import styled from "styled-components";
|
|
6
|
+
var SpotlightArea = styled.svg.withConfig({
|
|
7
|
+
displayName: "SpotlightArea",
|
|
8
|
+
componentId: "sc-env4mw-0"
|
|
9
|
+
})`position:fixed;top:0;left:0;z-index:99999;width:100vw;height:100vh;`;
|
|
10
|
+
var SpotlightCircle = styled.circle.withConfig({
|
|
11
|
+
displayName: "SpotlightCircle",
|
|
12
|
+
componentId: "sc-env4mw-1"
|
|
13
|
+
})`transition:all ${({
|
|
14
|
+
transitionDuration
|
|
15
|
+
}) => transitionDuration} ease-in-out;`;
|
|
16
|
+
var SpotlightRect = styled.rect.withConfig({
|
|
17
|
+
displayName: "SpotlightRect",
|
|
18
|
+
componentId: "sc-env4mw-2"
|
|
19
|
+
})`transition:all ${({
|
|
20
|
+
transitionDuration
|
|
21
|
+
}) => transitionDuration} ease-in-out;`;
|
|
22
|
+
var SpotlightMask = styled.rect.withConfig({
|
|
23
|
+
displayName: "SpotlightMask",
|
|
24
|
+
componentId: "sc-env4mw-3"
|
|
25
|
+
})`--ewc-spotlight-mask-fill:0.25;.e-color-background-3 &&,.e-theme-dark &&,.e-color-background-3 &&{--ewc-spotlight-mask-fill:0.5;}fill:rgba(0,0,0,var(--ewc-spotlight-mask-fill));width:100vw;height:100vh;`;
|
|
26
|
+
|
|
27
|
+
// components/elvis-spotlight/src/react/useLockBodyScroll.tsx
|
|
28
|
+
import { useEffect } from "react";
|
|
29
|
+
function useLockBodyScroll(removeLockBodyScroll) {
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const originalStyleOverflowBody = window.getComputedStyle(document.body).overflow;
|
|
32
|
+
const originalStyleOverflowHtml = window.getComputedStyle(document.documentElement).overflow;
|
|
33
|
+
if (!removeLockBodyScroll) {
|
|
34
|
+
document.body.style.overflow = originalStyleOverflowBody;
|
|
35
|
+
document.documentElement.style.overflow = originalStyleOverflowHtml;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
document.body.style.overflow = "hidden";
|
|
39
|
+
document.documentElement.style.overflow = "hidden";
|
|
40
|
+
return () => {
|
|
41
|
+
document.body.style.overflow = originalStyleOverflowBody;
|
|
42
|
+
document.documentElement.style.overflow = originalStyleOverflowHtml;
|
|
43
|
+
};
|
|
44
|
+
}, [removeLockBodyScroll]);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// components/elvis-spotlight/src/react/elvia-spotlight.tsx
|
|
48
|
+
var Spotlight = ({
|
|
49
|
+
position,
|
|
50
|
+
shape = "circle",
|
|
51
|
+
radius = 200,
|
|
52
|
+
hasLockBodyScroll = true,
|
|
53
|
+
transitionDuration = "350ms",
|
|
54
|
+
rectangleProps = {
|
|
55
|
+
width: 200,
|
|
56
|
+
height: 200,
|
|
57
|
+
borderRadius: 8
|
|
58
|
+
},
|
|
59
|
+
className,
|
|
60
|
+
inlineStyle,
|
|
61
|
+
...rest
|
|
62
|
+
}) => {
|
|
63
|
+
const hasPosition = position && position.horizontal !== void 0 && position.vertical !== void 0;
|
|
64
|
+
useLockBodyScroll(hasLockBodyScroll);
|
|
65
|
+
return hasPosition ? /* @__PURE__ */ React.createElement("div", { className, style: inlineStyle, ...rest }, /* @__PURE__ */ React.createElement(SpotlightArea, null, /* @__PURE__ */ React.createElement("defs", null, /* @__PURE__ */ React.createElement("mask", { id: "hole" }, /* @__PURE__ */ React.createElement("rect", { width: "100%", height: "100%", fill: "white" }), shape === "circle" ? /* @__PURE__ */ React.createElement(SpotlightCircle, { transitionDuration, r: radius, cx: position.horizontal, cy: position.vertical, fill: "black" }) : /* @__PURE__ */ React.createElement(SpotlightRect, { transitionDuration, width: rectangleProps.width, height: rectangleProps.height, x: position.horizontal, y: position.vertical, rx: rectangleProps.borderRadius, ry: rectangleProps.borderRadius, fill: "black" }))), /* @__PURE__ */ React.createElement(SpotlightMask, { mask: "url(#hole)" }))) : /* @__PURE__ */ React.createElement("div", null);
|
|
66
|
+
};
|
|
67
|
+
var elvia_spotlight_default = Spotlight;
|
|
68
|
+
export {
|
|
69
|
+
Spotlight,
|
|
70
|
+
elvia_spotlight_default as default
|
|
71
|
+
};
|
|
@@ -10,10 +10,12 @@ export interface SpotlightRectangleProps {
|
|
|
10
10
|
height?: number;
|
|
11
11
|
borderRadius?: number;
|
|
12
12
|
}
|
|
13
|
-
export interface
|
|
13
|
+
export interface BaseSpotlightProps extends BaseProps, HasTransitionDuration {
|
|
14
14
|
position?: SpotlightPosition;
|
|
15
15
|
shape?: SpotlightShape;
|
|
16
16
|
radius?: number;
|
|
17
17
|
rectangleProps?: SpotlightRectangleProps;
|
|
18
18
|
hasLockBodyScroll?: boolean;
|
|
19
19
|
}
|
|
20
|
+
export interface SpotlightProps extends BaseSpotlightProps, ComponentPropsWithoutRef<'div'> {
|
|
21
|
+
}
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elvia/elvis-spotlight",
|
|
3
|
-
"version": "1.6.
|
|
4
|
-
"main": "web_component.js",
|
|
3
|
+
"version": "1.6.3",
|
|
5
4
|
"license": "MIT",
|
|
6
5
|
"homepage": "https://design.elvia.io/components/spotlight",
|
|
6
|
+
"source": "src/react/elvia-spotlight.tsx",
|
|
7
|
+
"main": "dist/main/web-component.js",
|
|
7
8
|
"files": [
|
|
8
|
-
"web_component.js",
|
|
9
9
|
"react.js",
|
|
10
10
|
"react.d.ts",
|
|
11
|
-
"
|
|
12
|
-
"README.md",
|
|
13
|
-
"dist/**/*"
|
|
11
|
+
"dist"
|
|
14
12
|
],
|
|
15
13
|
"dependencies": {
|
|
16
14
|
"@elvia/elvis-component-wrapper": "^4.1.3",
|
|
17
|
-
"@elvia/elvis-toolbox": "^
|
|
15
|
+
"@elvia/elvis-toolbox": "^11.0.0",
|
|
18
16
|
"styled-components": "^5.3.3"
|
|
19
17
|
},
|
|
20
18
|
"peerDependencies": {
|
package/react.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export type { SpotlightProps } from './dist/react/js/elvia-spotlight.types';
|
|
4
|
-
export type * from './dist/react/js/elvia-spotlight';
|
|
5
|
-
export type * from './dist/react/js/elvia-spotlight.types';
|
|
1
|
+
export * from './dist/react/elvia-spotlight';
|
|
2
|
+
export * from './dist/react/elvia-spotlight.types';
|
package/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './dist/react/elvia-spotlight.js';
|
package/dist/react/js/config.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN.
|
|
3
|
-
* DO NOT MAKE CHANGES TO THIS FILE DIRECTLY
|
|
4
|
-
*/
|
|
5
|
-
export var config={name:"Spotlight",attributes:[{name:"position",type:"object"},{name:"shape",type:"string"},{name:"radius",type:"number"},{name:"rectangleProps",type:"object"},{name:"hasLockBodyScroll",type:"boolean"},{name:"transitionDuration",type:"string"},{name:"className",type:"string"},{name:"inlineStyle",type:"object"}]};
|
|
6
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["config.ts"],"names":["config","name","attributes","type"],"mappings":";;;;AAEA,MAAO,IAAM,CAAAA,MAAuB,CAAG,CACrCC,IAAI,CAAE,WAAW,CACjBC,UAAU,CAAE,CACV,CAAED,IAAI,CAAE,UAAU,CAAEE,IAAI,CAAE,QAAS,CAAC,CACpC,CAAEF,IAAI,CAAE,OAAO,CAAEE,IAAI,CAAE,QAAS,CAAC,CACjC,CAAEF,IAAI,CAAE,QAAQ,CAAEE,IAAI,CAAE,QAAS,CAAC,CAClC,CAAEF,IAAI,CAAE,gBAAgB,CAAEE,IAAI,CAAE,QAAS,CAAC,CAC1C,CAAEF,IAAI,CAAE,mBAAmB,CAAEE,IAAI,CAAE,SAAU,CAAC,CAC9C,CAAEF,IAAI,CAAE,oBAAoB,CAAEE,IAAI,CAAE,QAAS,CAAC,CAC9C,CAAEF,IAAI,CAAE,WAAW,CAAEE,IAAI,CAAE,QAAS,CAAC,CACrC,CAAEF,IAAI,CAAE,aAAa,CAAEE,IAAI,CAAE,QAAS,CAAC,CAE3C,CAAC","file":"config.js","sourcesContent":["import { ComponentConfig } from '@elvia/elvis-toolbox';\n\nexport const config: ComponentConfig = {\n name: 'Spotlight',\n attributes: [\n { name: 'position', type: 'object' },\n { name: 'shape', type: 'string' },\n { name: 'radius', type: 'number' },\n { name: 'rectangleProps', type: 'object' },\n { name: 'hasLockBodyScroll', type: 'boolean' },\n { name: 'transitionDuration', type: 'string' },\n { name: 'className', type: 'string' },\n { name: 'inlineStyle', type: 'object' },\n ],\n};\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN.
|
|
3
|
-
* DO NOT MAKE CHANGES TO THIS FILE DIRECTLY
|
|
4
|
-
*/
|
|
5
|
-
var _excluded=["position","shape","radius","hasLockBodyScroll","transitionDuration","rectangleProps","className","inlineStyle"];function _extends(){return _extends=Object.assign?Object.assign.bind():function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}import React from"react";import{SpotlightArea,SpotlightCircle,SpotlightMask,SpotlightRect}from"./styledComponents";import{useLockBodyScroll}from"./useLockBodyScroll";var Spotlight=function(a){var b=a.position,c=a.shape,d=void 0===c?"circle":c,e=a.radius,f=void 0===e?200:e,g=a.hasLockBodyScroll,h=a.transitionDuration,i=void 0===h?"350ms":h,j=a.rectangleProps,k=void 0===j?{width:200,height:200,borderRadius:8}:j,l=a.className,m=a.inlineStyle,n=_objectWithoutProperties(a,_excluded),o=b&&void 0!==b.horizontal&&void 0!==b.vertical;return useLockBodyScroll(void 0===g||g),o?/*#__PURE__*/React.createElement("div",_extends({className:l,style:m},n),/*#__PURE__*/React.createElement(SpotlightArea,null,/*#__PURE__*/React.createElement("defs",null,/*#__PURE__*/React.createElement("mask",{id:"hole"},/*#__PURE__*/React.createElement("rect",{width:"100%",height:"100%",fill:"white"}),"circle"===d?/*#__PURE__*/React.createElement(SpotlightCircle,{transitionDuration:i,r:f,cx:b.horizontal,cy:b.vertical,fill:"black"}):/*#__PURE__*/React.createElement(SpotlightRect,{transitionDuration:i,width:k.width,height:k.height,x:b.horizontal,y:b.vertical,rx:k.borderRadius,ry:k.borderRadius,fill:"black"}))),/*#__PURE__*/React.createElement(SpotlightMask,{mask:"url(#hole)"}))):/*#__PURE__*/React.createElement("div",null)};export default Spotlight;
|
|
6
|
-
//# sourceMappingURL=elvia-spotlight.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["elvia-spotlight.tsx"],"names":["React","SpotlightArea","SpotlightCircle","SpotlightMask","SpotlightRect","useLockBodyScroll","Spotlight","a","position","c","shape","e","radius","g","hasLockBodyScroll","h","transitionDuration","j","rectangleProps","width","height","borderRadius","className","inlineStyle","rest","_objectWithoutProperties","_excluded","hasPosition","horizontal","vertical","createElement","_extends","style","id","fill","r","cx","cy","x","y","rx","ry","mask"],"mappings":";;;;4zBAAA,MAAO,CAAAA,KAAK,KAAc,OAAO,CACjC,OAASC,aAAa,CAAEC,eAAe,CAAEC,aAAa,CAAEC,aAAa,KAAQ,oBAAoB,CAEjG,OAASC,iBAAiB,KAAQ,qBAAqB,CAGvD,GAAM,CAAAC,SAA6B,CAAG,QAAAA,CAAAC,CAAA,CAUhC,IATJ,CAAAC,CAAQ,CAAAD,CAAA,CAARC,QAAQ,CAAAC,CAAA,CAAAF,CAAA,CACRG,KAAK,CAALA,CAAK,UAAAD,CAAA,CAAG,QAAQ,CAAAA,CAAA,CAAAE,CAAA,CAAAJ,CAAA,CAChBK,MAAM,CAANA,CAAM,UAAAD,CAAA,CAAG,GAAG,CAAAA,CAAA,CAAAE,CAAA,CAAAN,CAAA,CACZO,iBAAiB,CAAAC,CAAA,CAAAR,CAAA,CACjBS,kBAAkB,CAAlBA,CAAkB,UAAAD,CAAA,CAAG,OAAO,CAAAA,CAAA,CAAAE,CAAA,CAAAV,CAAA,CAC5BW,cAAc,CAAdA,CAAc,UAAAD,CAAA,CAAG,CAAEE,KAAK,CAAE,GAAG,CAAEC,MAAM,CAAE,GAAG,CAAEC,YAAY,CAAE,CAAE,CAAC,CAAAJ,CAAA,CAC7DK,CAAS,CAAAf,CAAA,CAATe,SAAS,CACTC,CAAW,CAAAhB,CAAA,CAAXgB,WAAW,CACRC,CAAI,CAAAC,wBAAA,CAAAlB,CAAA,CAAAmB,SAAA,EAEDC,CAAW,CAAGnB,CAAQ,EAAI,SAAAA,CAAQ,CAACoB,UAAwB,EAAI,SAAApB,CAAQ,CAACqB,QAAsB,CAGpG,MAFA,CAAAxB,iBAAiB,UAAAQ,CAAA,EAAAA,CAAkB,CAAC,CAE7Bc,CAAW,cAChB3B,KAAA,CAAA8B,aAAA,OAAAC,QAAA,EAAKT,SAAS,CAAEA,CAAU,CAACU,KAAK,CAAET,CAAY,EAAKC,CAAI,eACrDxB,KAAA,CAAA8B,aAAA,CAAC7B,aAAa,mBACZD,KAAA,CAAA8B,aAAA,0BACE9B,KAAA,CAAA8B,aAAA,SAAMG,EAAE,CAAC,MAAM,eACbjC,KAAA,CAAA8B,aAAA,SAAMX,KAAK,CAAC,MAAM,CAACC,MAAM,CAAC,MAAM,CAACc,IAAI,CAAC,OAAO,CAAE,CAAC,CACrC,QAAQ,GAAlBxB,CAAkB,cACjBV,KAAA,CAAA8B,aAAA,CAAC5B,eAAe,EACdc,kBAAkB,CAAEA,CAAmB,CACvCmB,CAAC,CAAEvB,CAAO,CACVwB,EAAE,CAAE5B,CAAQ,CAACoB,UAAW,CACxBS,EAAE,CAAE7B,CAAQ,CAACqB,QAAS,CACtBK,IAAI,CAAC,OAAO,CACb,CAAC,cAEFlC,KAAA,CAAA8B,aAAA,CAAC1B,aAAa,EACZY,kBAAkB,CAAEA,CAAmB,CACvCG,KAAK,CAAED,CAAc,CAACC,KAAM,CAC5BC,MAAM,CAAEF,CAAc,CAACE,MAAO,CAC9BkB,CAAC,CAAE9B,CAAQ,CAACoB,UAAW,CACvBW,CAAC,CAAE/B,CAAQ,CAACqB,QAAS,CACrBW,EAAE,CAAEtB,CAAc,CAACG,YAAa,CAChCoB,EAAE,CAAEvB,CAAc,CAACG,YAAa,CAChCa,IAAI,CAAC,OAAO,CACb,CAEC,CACF,CAAC,cACPlC,KAAA,CAAA8B,aAAA,CAAC3B,aAAa,EAACuC,IAAI,CAAC,YAAY,CAAE,CACrB,CACZ,CAAC,cAEN1C,KAAA,CAAA8B,aAAA,WAAU,CAEd,CAAC,CAED,cAAe,CAAAxB,SAAS","file":"elvia-spotlight.js","sourcesContent":["import React, { FC } from 'react';\nimport { SpotlightArea, SpotlightCircle, SpotlightMask, SpotlightRect } from './styledComponents';\n\nimport { useLockBodyScroll } from './useLockBodyScroll';\nimport { SpotlightProps } from './elvia-spotlight.types';\n\nconst Spotlight: FC<SpotlightProps> = ({\n position,\n shape = 'circle',\n radius = 200,\n hasLockBodyScroll = true,\n transitionDuration = '350ms',\n rectangleProps = { width: 200, height: 200, borderRadius: 8 },\n className,\n inlineStyle,\n ...rest\n}) => {\n const hasPosition = position && position.horizontal !== undefined && position.vertical !== undefined;\n useLockBodyScroll(hasLockBodyScroll);\n\n return hasPosition ? (\n <div className={className} style={inlineStyle} {...rest}>\n <SpotlightArea>\n <defs>\n <mask id=\"hole\">\n <rect width=\"100%\" height=\"100%\" fill=\"white\" />\n {shape === 'circle' ? (\n <SpotlightCircle\n transitionDuration={transitionDuration}\n r={radius}\n cx={position.horizontal}\n cy={position.vertical}\n fill=\"black\"\n />\n ) : (\n <SpotlightRect\n transitionDuration={transitionDuration}\n width={rectangleProps.width}\n height={rectangleProps.height}\n x={position.horizontal}\n y={position.vertical}\n rx={rectangleProps.borderRadius}\n ry={rectangleProps.borderRadius}\n fill=\"black\"\n />\n )}\n </mask>\n </defs>\n <SpotlightMask mask=\"url(#hole)\" />\n </SpotlightArea>\n </div>\n ) : (\n <div></div>\n );\n};\n\nexport default Spotlight;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["elvia-spotlight.types.tsx"],"names":[],"mappings":";;;;AAAA","file":"elvia-spotlight.types.js","sourcesContent":["import { BaseProps, HasTransitionDuration } from '@elvia/elvis-toolbox';\nimport { ComponentPropsWithoutRef } from 'react';\n\nexport type SpotlightShape = 'circle' | 'rectangle';\n\nexport interface SpotlightPosition {\n vertical: number;\n horizontal: number;\n}\n\nexport interface SpotlightRectangleProps {\n width?: number;\n height?: number;\n borderRadius?: number;\n}\n\nexport interface SpotlightProps extends ComponentPropsWithoutRef<'div'>, BaseProps, HasTransitionDuration {\n position?: SpotlightPosition;\n shape?: SpotlightShape;\n radius?: number;\n rectangleProps?: SpotlightRectangleProps;\n hasLockBodyScroll?: boolean;\n}\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN.
|
|
3
|
-
* DO NOT MAKE CHANGES TO THIS FILE DIRECTLY
|
|
4
|
-
*/
|
|
5
|
-
import styled from"styled-components";export var SpotlightArea=styled.svg.withConfig({displayName:"styledComponents__SpotlightArea",componentId:"sc-env4mw-0"})(["position:fixed;top:0;left:0;z-index:99999;width:100vw;height:100vh;"]);export var SpotlightCircle=styled.circle.withConfig({displayName:"styledComponents__SpotlightCircle",componentId:"sc-env4mw-1"})(["transition:all "," ease-in-out;"],function(a){var b=a.transitionDuration;return b});export var SpotlightRect=styled.rect.withConfig({displayName:"styledComponents__SpotlightRect",componentId:"sc-env4mw-2"})(["transition:all "," ease-in-out;"],function(a){var b=a.transitionDuration;return b});export var SpotlightMask=styled.rect.withConfig({displayName:"styledComponents__SpotlightMask",componentId:"sc-env4mw-3"})(["--ewc-spotlight-mask-fill:0.25;.e-color-background-3 &&,.e-theme-dark &&,.e-color-background-3 &&{--ewc-spotlight-mask-fill:0.5;}fill:rgba(0,0,0,var(--ewc-spotlight-mask-fill));width:100%;height:100%;"]);
|
|
6
|
-
//# sourceMappingURL=styledComponents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["styledComponents.tsx"],"names":["styled","SpotlightArea","svg","withConfig","displayName","componentId","SpotlightCircle","circle","a","transitionDuration","SpotlightRect","rect","SpotlightMask"],"mappings":";;;;AAAA,MAAO,CAAAA,MAAM,KAAM,mBAAmB,CAEtC,MAAO,IAAM,CAAAC,aAAa,CAAGD,MAAM,CAACE,GAAG,CAAAC,UAAA,EAAAC,WAAA,mCAAAC,WAAA,yFAOtC,CAMD,MAAO,IAAM,CAAAC,eAAe,CAAGN,MAAM,CAACO,MAAM,CAAAJ,UAAA,EAAAC,WAAA,qCAAAC,WAAA,qDACxB,SAAAG,CAAA,KAAG,CAAAC,CAAkB,CAAAD,CAAA,CAAlBC,kBAAkB,OAAO,CAAAA,CAAkB,EACjE,CAKD,MAAO,IAAM,CAAAC,aAAa,CAAGV,MAAM,CAACW,IAAI,CAAAR,UAAA,EAAAC,WAAA,mCAAAC,WAAA,qDACpB,SAAAG,CAAA,KAAG,CAAAC,CAAkB,CAAAD,CAAA,CAAlBC,kBAAkB,OAAO,CAAAA,CAAkB,EACjE,CAED,MAAO,IAAM,CAAAG,aAAa,CAAGZ,MAAM,CAACW,IAAI,CAAAR,UAAA,EAAAC,WAAA,mCAAAC,WAAA,8NAWvC","file":"styledComponents.js","sourcesContent":["import styled from 'styled-components';\n\nexport const SpotlightArea = styled.svg`\n position: fixed;\n top: 0;\n left: 0;\n z-index: 99999;\n width: 100vw;\n height: 100vh;\n`;\n\ninterface SpotlightCircleProps {\n transitionDuration: string;\n}\n\nexport const SpotlightCircle = styled.circle<SpotlightCircleProps>`\n transition: all ${({ transitionDuration }) => transitionDuration} ease-in-out;\n`;\ninterface SpotlightRectProps {\n transitionDuration: string;\n}\n\nexport const SpotlightRect = styled.rect<SpotlightRectProps>`\n transition: all ${({ transitionDuration }) => transitionDuration} ease-in-out;\n`;\n\nexport const SpotlightMask = styled.rect`\n --ewc-spotlight-mask-fill: 0.25;\n .e-color-background-3 &&,\n .e-theme-dark &&,\n .e-color-background-3 && {\n --ewc-spotlight-mask-fill: 0.5;\n }\n\n fill: rgba(0, 0, 0, var(--ewc-spotlight-mask-fill));\n width: 100%;\n height: 100%;\n`;\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN.
|
|
3
|
-
* DO NOT MAKE CHANGES TO THIS FILE DIRECTLY
|
|
4
|
-
*/
|
|
5
|
-
import{useEffect}from"react";// eslint-disable-next-line
|
|
6
|
-
export function useLockBodyScroll(a){useEffect(function(){var b=window.getComputedStyle(document.body).overflow,c=window.getComputedStyle(document.documentElement).overflow;return a?(document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden",function(){document.body.style.overflow=b,document.documentElement.style.overflow=c}):(document.body.style.overflow=b,void(document.documentElement.style.overflow=c))},[a])}
|
|
7
|
-
//# sourceMappingURL=useLockBodyScroll.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["useLockBodyScroll.tsx"],"names":["useEffect","useLockBodyScroll","removeLockBodyScroll","originalStyleOverflowBody","window","getComputedStyle","document","body","overflow","originalStyleOverflowHtml","documentElement","style"],"mappings":";;;;AAAA,OAASA,SAAS,KAAQ,OAAO,CAEjC;AACA,MAAO,SAAS,CAAAC,iBAAiBA,CAACC,CAA6B,CAAE,CAC/DF,SAAS,CAAC,UAAM,IACR,CAAAG,CAAyB,CAAGC,MAAM,CAACC,gBAAgB,CAACC,QAAQ,CAACC,IAAI,CAAC,CAACC,QAAQ,CAC3EC,CAAyB,CAAGL,MAAM,CAACC,gBAAgB,CAACC,QAAQ,CAACI,eAAe,CAAC,CAACF,QAAQ,OACvF,CAAAN,CAAoB,EAKzBI,QAAQ,CAACC,IAAI,CAACI,KAAK,CAACH,QAAQ,CAAG,QAAQ,CACvCF,QAAQ,CAACI,eAAe,CAACC,KAAK,CAACH,QAAQ,CAAG,QAAQ,CAE3C,UAAM,CACXF,QAAQ,CAACC,IAAI,CAACI,KAAK,CAACH,QAAQ,CAAGL,CAAyB,CACxDG,QAAQ,CAACI,eAAe,CAACC,KAAK,CAACH,QAAQ,CAAGC,CAC5C,CAAC,GAVCH,QAAQ,CAACC,IAAI,CAACI,KAAK,CAACH,QAAQ,CAAGL,CAAyB,MACxDG,QAAQ,CAACI,eAAe,CAACC,KAAK,CAACH,QAAQ,CAAGC,CAAyB,EAUvE,CAAC,CAAE,CAACP,CAAoB,CAAC,CAC3B","file":"useLockBodyScroll.js","sourcesContent":["import { useEffect } from 'react';\n\n// eslint-disable-next-line\nexport function useLockBodyScroll(removeLockBodyScroll: boolean) {\n useEffect(() => {\n const originalStyleOverflowBody = window.getComputedStyle(document.body).overflow;\n const originalStyleOverflowHtml = window.getComputedStyle(document.documentElement).overflow;\n if (!removeLockBodyScroll) {\n document.body.style.overflow = originalStyleOverflowBody;\n document.documentElement.style.overflow = originalStyleOverflowHtml;\n return;\n }\n document.body.style.overflow = 'hidden';\n document.documentElement.style.overflow = 'hidden';\n\n return () => {\n document.body.style.overflow = originalStyleOverflowBody;\n document.documentElement.style.overflow = originalStyleOverflowHtml;\n };\n }, [removeLockBodyScroll]);\n}\n"]}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN.
|
|
3
|
-
* DO NOT MAKE CHANGES TO THIS FILE DIRECTLY
|
|
4
|
-
*/
|
|
5
|
-
import * as ReactComponent from '../../../react.js';
|
|
6
|
-
import { ElvisComponentWrapper } from '@elvia/elvis-component-wrapper';
|
|
7
|
-
export default class ElviaComponent extends ElvisComponentWrapper {
|
|
8
|
-
static get observedAttributes() {
|
|
9
|
-
return ["position", "shape", "radius", "rectangleprops", "haslockbodyscroll", "transitionduration", "classname", "inlinestyle"];
|
|
10
|
-
}
|
|
11
|
-
static getComponentData() {
|
|
12
|
-
return {
|
|
13
|
-
"name": "Spotlight",
|
|
14
|
-
"attributes": [{
|
|
15
|
-
"name": "position",
|
|
16
|
-
"type": "object"
|
|
17
|
-
}, {
|
|
18
|
-
"name": "shape",
|
|
19
|
-
"type": "string"
|
|
20
|
-
}, {
|
|
21
|
-
"name": "radius",
|
|
22
|
-
"type": "number"
|
|
23
|
-
}, {
|
|
24
|
-
"name": "rectangleProps",
|
|
25
|
-
"type": "object"
|
|
26
|
-
}, {
|
|
27
|
-
"name": "hasLockBodyScroll",
|
|
28
|
-
"type": "boolean"
|
|
29
|
-
}, {
|
|
30
|
-
"name": "transitionDuration",
|
|
31
|
-
"type": "string"
|
|
32
|
-
}, {
|
|
33
|
-
"name": "className",
|
|
34
|
-
"type": "string"
|
|
35
|
-
}, {
|
|
36
|
-
"name": "inlineStyle",
|
|
37
|
-
"type": "object"
|
|
38
|
-
}]
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
set position(newValue) {
|
|
42
|
-
super.setProps({
|
|
43
|
-
'position': newValue
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
get position() {
|
|
47
|
-
return super.getProps()['position'];
|
|
48
|
-
}
|
|
49
|
-
set shape(newValue) {
|
|
50
|
-
super.setProps({
|
|
51
|
-
'shape': newValue
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
get shape() {
|
|
55
|
-
return super.getProps()['shape'];
|
|
56
|
-
}
|
|
57
|
-
set radius(newValue) {
|
|
58
|
-
super.setProps({
|
|
59
|
-
'radius': newValue
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
get radius() {
|
|
63
|
-
return super.getProps()['radius'];
|
|
64
|
-
}
|
|
65
|
-
set rectangleProps(newValue) {
|
|
66
|
-
super.setProps({
|
|
67
|
-
'rectangleprops': newValue
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
get rectangleProps() {
|
|
71
|
-
return super.getProps()['rectangleprops'];
|
|
72
|
-
}
|
|
73
|
-
set rectangleprops(newValue) {
|
|
74
|
-
super.setProps({
|
|
75
|
-
'rectangleprops': newValue
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
get rectangleprops() {
|
|
79
|
-
return super.getProps()['rectangleprops'];
|
|
80
|
-
}
|
|
81
|
-
set hasLockBodyScroll(newValue) {
|
|
82
|
-
super.setProps({
|
|
83
|
-
'haslockbodyscroll': newValue
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
get hasLockBodyScroll() {
|
|
87
|
-
return super.getProps()['haslockbodyscroll'];
|
|
88
|
-
}
|
|
89
|
-
set haslockbodyscroll(newValue) {
|
|
90
|
-
super.setProps({
|
|
91
|
-
'haslockbodyscroll': newValue
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
get haslockbodyscroll() {
|
|
95
|
-
return super.getProps()['haslockbodyscroll'];
|
|
96
|
-
}
|
|
97
|
-
set transitionDuration(newValue) {
|
|
98
|
-
super.setProps({
|
|
99
|
-
'transitionduration': newValue
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
get transitionDuration() {
|
|
103
|
-
return super.getProps()['transitionduration'];
|
|
104
|
-
}
|
|
105
|
-
set transitionduration(newValue) {
|
|
106
|
-
super.setProps({
|
|
107
|
-
'transitionduration': newValue
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
get transitionduration() {
|
|
111
|
-
return super.getProps()['transitionduration'];
|
|
112
|
-
}
|
|
113
|
-
set className(newValue) {
|
|
114
|
-
super.setProps({
|
|
115
|
-
'classname': newValue
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
get className() {
|
|
119
|
-
return super.getProps()['classname'];
|
|
120
|
-
}
|
|
121
|
-
set classname(newValue) {
|
|
122
|
-
super.setProps({
|
|
123
|
-
'classname': newValue
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
get classname() {
|
|
127
|
-
return super.getProps()['classname'];
|
|
128
|
-
}
|
|
129
|
-
set inlineStyle(newValue) {
|
|
130
|
-
super.setProps({
|
|
131
|
-
'inlinestyle': newValue
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
get inlineStyle() {
|
|
135
|
-
return super.getProps()['inlinestyle'];
|
|
136
|
-
}
|
|
137
|
-
set inlinestyle(newValue) {
|
|
138
|
-
super.setProps({
|
|
139
|
-
'inlinestyle': newValue
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
get inlinestyle() {
|
|
143
|
-
return super.getProps()['inlinestyle'];
|
|
144
|
-
}
|
|
145
|
-
constructor() {
|
|
146
|
-
super(ElviaComponent, ReactComponent['Spotlight']);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
window.customElements.define(`elvia-spotlight`, ElviaComponent);
|
package/web_component.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Spotlight } from './dist/web_component/js/elvia-spotlight';
|
|
File without changes
|
|
File without changes
|