@elvia/elvis-spotlight 1.5.1 → 1.5.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 CHANGED
@@ -1,6 +1,26 @@
1
1
  {
2
2
  "$schema": "../../changelogSchema.json",
3
3
  "content": [
4
+ {
5
+ "date": "28.06.23",
6
+ "version": "1.5.3",
7
+ "changelog": [
8
+ {
9
+ "type": "patch",
10
+ "changes": ["The component prop interface now correctly accepts all native properties in React."]
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ "date": "15.06.23",
16
+ "version": "1.5.2 ",
17
+ "changelog": [
18
+ {
19
+ "type": "patch",
20
+ "changes": ["Updated internal dependencies."]
21
+ }
22
+ ]
23
+ },
4
24
  {
5
25
  "date": "09.05.23",
6
26
  "version": "1.5.1",
@@ -2,5 +2,5 @@
2
2
  * THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN.
3
3
  * DO NOT MAKE CHANGES TO THIS FILE DIRECTLY
4
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,{useRef}from"react";import{SpotlightArea,SpotlightCircle,SpotlightRect}from"./styledComponents";import{useCurrentTheme}from"@elvia/elvis-toolbox";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,p=useRef(null),q=useCurrentTheme(p),r=q.currentTheme;return useLockBodyScroll(void 0===g||g),o?/*#__PURE__*/React.createElement("div",_extends({className:"".concat(l?l:""),style:m},n,{ref:p}),/*#__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("rect",{fill:"rgba(0,0,0,".concat("light"===r?.25:.5,")"),width:"100%",height:"100%",mask:"url(#hole)"}))):/*#__PURE__*/React.createElement("div",null)};export default Spotlight;
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,{useRef}from"react";import{SpotlightArea,SpotlightCircle,SpotlightRect}from"./styledComponents";import{useCurrentTheme}from"@elvia/elvis-toolbox";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,p=useRef(null),q=useCurrentTheme(p),r=q.currentTheme;return useLockBodyScroll(void 0===g||g),o?/*#__PURE__*/React.createElement("div",_extends({className:l,style:m},n,{ref:p}),/*#__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("rect",{fill:"rgba(0,0,0,".concat("light"===r?.25:.5,")"),width:"100%",height:"100%",mask:"url(#hole)"}))):/*#__PURE__*/React.createElement("div",null)};export default Spotlight;
6
6
  //# sourceMappingURL=elvia-spotlight.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["elvia-spotlight.tsx"],"names":["React","useRef","SpotlightArea","SpotlightCircle","SpotlightRect","useCurrentTheme","useLockBodyScroll","Spotlight","position","shape","radius","hasLockBodyScroll","transitionDuration","rectangleProps","width","height","borderRadius","className","inlineStyle","rest","hasPosition","horizontal","vertical","spotlightDivRef","currentTheme"],"mappings":";;;;4zBAAA,MAAOA,MAAK,EAAQC,MAAM,KAAQ,OAAO,CACzC,OAASC,aAAa,CAAEC,eAAe,CAAEC,aAAa,KAAQ,oBAAoB,CAClF,OAASC,eAAe,KAAQ,sBAAsB,CAEtD,OAASC,iBAAiB,KAAQ,qBAAqB,CAGvD,GAAMC,UAA6B,CAAG,WAUhC,IATJC,EAAQ,GAARA,QAAQ,KACRC,KAAK,CAALA,CAAK,YAAG,QAAQ,OAChBC,MAAM,CAANA,CAAM,YAAG,GAAG,OACZC,iBAAiB,KACjBC,kBAAkB,CAAlBA,CAAkB,YAAG,OAAO,OAC5BC,cAAc,CAAdA,CAAc,YAAG,CAAEC,KAAK,CAAE,GAAG,CAAEC,MAAM,CAAE,GAAG,CAAEC,YAAY,CAAE,CAAE,CAAC,GAC7DC,CAAS,GAATA,SAAS,CACTC,CAAW,GAAXA,WAAW,CACRC,CAAI,uCAEDC,CAAW,CAAGZ,CAAQ,EAAI,SAAAA,CAAQ,CAACa,UAAwB,EAAI,SAAAb,CAAQ,CAACc,QAAsB,CAC9FC,CAAe,CAAGtB,MAAM,CAAiB,IAAI,CAAC,GAC3BI,eAAe,CAACkB,CAAe,CAAC,CAAjDC,CAAY,GAAZA,YAAY,CAGpB,MAFAlB,kBAAiB,eAAmB,CAE7Bc,CAAW,cAChB,oCAAK,SAAS,WAAKH,CAAS,CAAGA,CAAS,CAAG,EAAE,CAAG,CAAC,KAAK,CAAEC,CAAY,EAAKC,CAAI,EAAE,GAAG,CAAEI,CAAgB,gBAClG,oBAAC,aAAa,mBACZ,6CACE,4BAAM,EAAE,CAAC,MAAM,eACb,4BAAM,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAG,CACrC,QAAQ,GAAlBd,CAAkB,cACjB,oBAAC,eAAe,EACd,kBAAkB,CAAEG,CAAmB,CACvC,CAAC,CAAEF,CAAO,CACV,EAAE,CAAEF,CAAQ,CAACa,UAAW,CACxB,EAAE,CAAEb,CAAQ,CAACc,QAAS,CACtB,IAAI,CAAC,OAAO,EACZ,cAEF,oBAAC,aAAa,EACZ,kBAAkB,CAAEV,CAAmB,CACvC,KAAK,CAAEC,CAAc,CAACC,KAAM,CAC5B,MAAM,CAAED,CAAc,CAACE,MAAO,CAC9B,CAAC,CAAEP,CAAQ,CAACa,UAAW,CACvB,CAAC,CAAEb,CAAQ,CAACc,QAAS,CACrB,EAAE,CAAET,CAAc,CAACG,YAAa,CAChC,EAAE,CAAEH,CAAc,CAACG,YAAa,CAChC,IAAI,CAAC,OAAO,EAEf,CACI,CACF,cACP,4BACE,IAAI,sBAAiC,OAAO,GAAxBQ,CAAwB,CAAG,GAAI,CAAG,EAAG,KAAI,CAC7D,KAAK,CAAC,MAAM,CACZ,MAAM,CAAC,MAAM,CACb,IAAI,CAAC,YAAY,EACjB,CACY,CACZ,cAEN,+BAEJ,CAAC,CAED,cAAejB,UAAS","file":"elvia-spotlight.js","sourcesContent":["import React, { FC, useRef } from 'react';\nimport { SpotlightArea, SpotlightCircle, SpotlightRect } from './styledComponents';\nimport { useCurrentTheme } from '@elvia/elvis-toolbox';\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 const spotlightDivRef = useRef<HTMLDivElement>(null);\n const { currentTheme } = useCurrentTheme(spotlightDivRef);\n useLockBodyScroll(hasLockBodyScroll);\n\n return hasPosition ? (\n <div className={`${className ? className : ''}`} style={inlineStyle} {...rest} ref={spotlightDivRef}>\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 <rect\n fill={`rgba(0,0,0,${currentTheme === 'light' ? 0.25 : 0.5})`}\n width=\"100%\"\n height=\"100%\"\n mask=\"url(#hole)\"\n />\n </SpotlightArea>\n </div>\n ) : (\n <div></div>\n );\n};\n\nexport default Spotlight;\n"]}
1
+ {"version":3,"sources":["elvia-spotlight.tsx"],"names":["React","useRef","SpotlightArea","SpotlightCircle","SpotlightRect","useCurrentTheme","useLockBodyScroll","Spotlight","position","shape","radius","hasLockBodyScroll","transitionDuration","rectangleProps","width","height","borderRadius","className","inlineStyle","rest","hasPosition","horizontal","vertical","spotlightDivRef","currentTheme"],"mappings":";;;;4zBAAA,MAAOA,MAAK,EAAQC,MAAM,KAAQ,OAAO,CACzC,OAASC,aAAa,CAAEC,eAAe,CAAEC,aAAa,KAAQ,oBAAoB,CAClF,OAASC,eAAe,KAAQ,sBAAsB,CAEtD,OAASC,iBAAiB,KAAQ,qBAAqB,CAGvD,GAAMC,UAA6B,CAAG,WAUhC,IATJC,EAAQ,GAARA,QAAQ,KACRC,KAAK,CAALA,CAAK,YAAG,QAAQ,OAChBC,MAAM,CAANA,CAAM,YAAG,GAAG,OACZC,iBAAiB,KACjBC,kBAAkB,CAAlBA,CAAkB,YAAG,OAAO,OAC5BC,cAAc,CAAdA,CAAc,YAAG,CAAEC,KAAK,CAAE,GAAG,CAAEC,MAAM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,MAAM,CAAC,MAAM,CACb,IAAI,CAAC,YAAY,EACjB,CACY,CACZ,cAEN,+BAEJ,CAAC,CAED,cAAejB,UAAS","file":"elvia-spotlight.js","sourcesContent":["import React, { FC, useRef } from 'react';\nimport { SpotlightArea, SpotlightCircle, SpotlightRect } from './styledComponents';\nimport { useCurrentTheme } from '@elvia/elvis-toolbox';\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 const spotlightDivRef = useRef<HTMLDivElement>(null);\n const { currentTheme } = useCurrentTheme(spotlightDivRef);\n useLockBodyScroll(hasLockBodyScroll);\n\n return hasPosition ? (\n <div className={className} style={inlineStyle} {...rest} ref={spotlightDivRef}>\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 <rect\n fill={`rgba(0,0,0,${currentTheme === 'light' ? 0.25 : 0.5})`}\n width=\"100%\"\n height=\"100%\"\n mask=\"url(#hole)\"\n />\n </SpotlightArea>\n </div>\n ) : (\n <div></div>\n );\n};\n\nexport default Spotlight;\n"]}
@@ -1,4 +1,5 @@
1
1
  import { BaseProps, HasTransitionDuration } from '@elvia/elvis-toolbox';
2
+ import { ComponentPropsWithoutRef } from 'react';
2
3
  export type SpotlightShape = 'circle' | 'rectangle';
3
4
  export interface SpotlightPosition {
4
5
  vertical: number;
@@ -9,7 +10,7 @@ export interface SpotlightRectangleProps {
9
10
  height?: number;
10
11
  borderRadius?: number;
11
12
  }
12
- export interface SpotlightProps extends BaseProps, HasTransitionDuration {
13
+ export interface SpotlightProps extends ComponentPropsWithoutRef<'div'>, BaseProps, HasTransitionDuration {
13
14
  position?: SpotlightPosition;
14
15
  shape?: SpotlightShape;
15
16
  radius?: number;
@@ -1 +1 @@
1
- {"version":3,"sources":["elvia-spotlight.types.tsx"],"names":[],"mappings":";;;;AAAA","file":"elvia-spotlight.types.js","sourcesContent":["import { BaseProps, HasTransitionDuration } from '@elvia/elvis-toolbox';\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 BaseProps, HasTransitionDuration {\n position?: SpotlightPosition;\n shape?: SpotlightShape;\n radius?: number;\n rectangleProps?: SpotlightRectangleProps;\n hasLockBodyScroll?: boolean;\n}\n"]}
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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elvia/elvis-spotlight",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "main": "web_component.js",
5
5
  "license": "MIT",
6
6
  "homepage": "https://design.elvia.io/components/spotlight",
@@ -13,8 +13,8 @@
13
13
  "dist/**/*"
14
14
  ],
15
15
  "dependencies": {
16
- "@elvia/elvis-component-wrapper": "^4.1.2",
17
- "@elvia/elvis-toolbox": "^8.0.0",
16
+ "@elvia/elvis-component-wrapper": "^4.1.3",
17
+ "@elvia/elvis-toolbox": "^9.2.0",
18
18
  "styled-components": "^5.3.3"
19
19
  },
20
20
  "peerDependencies": {