@propellerads/switch 2.1.1 → 2.3.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 +8 -0
- package/dist/index.esm.js +10 -2
- package/dist/index.esm.min.js +1 -1
- package/package.json +8 -5
package/CHANGELOG.md
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled, { keyframes } from 'styled-components';
|
|
4
|
-
import { hslToHsla, black, actionColor, fontSmall, gray50, gray95
|
|
4
|
+
import { hslToHsla, black, actionColor, fontSmall, gray50, gray95 } from '@propellerads/stylevariables';
|
|
5
5
|
|
|
6
6
|
function _taggedTemplateLiteral(strings, raw) {
|
|
7
7
|
if (!raw) {
|
|
@@ -49,7 +49,15 @@ var black15 = hslToHsla(black, '0.15');
|
|
|
49
49
|
var black25 = hslToHsla(black, '0.5');
|
|
50
50
|
var action50 = hslToHsla(actionColor, '0.5');
|
|
51
51
|
var StyledSwitch = styled.div(_templateObject2());
|
|
52
|
-
var SwitchControl = styled.div(_templateObject3(), fontSmall, gray50, gray95, black15, switchOn, black25,
|
|
52
|
+
var SwitchControl = styled.div(_templateObject3(), fontSmall, gray50, gray95, black15, switchOn, black25, function (props) {
|
|
53
|
+
var _props$theme, _props$theme$actionCo;
|
|
54
|
+
|
|
55
|
+
return (props === null || props === void 0 ? void 0 : (_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : (_props$theme$actionCo = _props$theme.actionColor) === null || _props$theme$actionCo === void 0 ? void 0 : _props$theme$actionCo.main) || actionColor;
|
|
56
|
+
}, action50, switchOn, function (props) {
|
|
57
|
+
var _props$theme2, _props$theme2$actionC;
|
|
58
|
+
|
|
59
|
+
return hslToHsla((props === null || props === void 0 ? void 0 : (_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : (_props$theme2$actionC = _props$theme2.actionColor) === null || _props$theme2$actionC === void 0 ? void 0 : _props$theme2$actionC.main) || actionColor, '0.3');
|
|
60
|
+
});
|
|
53
61
|
|
|
54
62
|
var Switch = function Switch(_ref) {
|
|
55
63
|
var model = _ref.model,
|
package/dist/index.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import n from"react";import e from"prop-types";import t,{keyframes as o}from"styled-components";import{hslToHsla as i,black as r,actionColor as
|
|
1
|
+
import n from"react";import e from"prop-types";import t,{keyframes as o}from"styled-components";import{hslToHsla as i,black as r,actionColor as l,fontSmall as a,gray50 as s,gray95 as c}from"@propellerads/stylevariables";function d(n,e){return e||(e=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(e)}}))}function u(){var n=d(["\n display: block;\n font-size: ","px;\n color: ",";\n \n label {\n position: relative;\n display: block;\n width: 40px;\n height: 20px;\n cursor: pointer;\n\n &:before {\n position: absolute;\n width: 40px;\n height: 20px;\n content: '';\n transition: background .1s ease;\n border-radius: 50px;\n background: ",";\n box-shadow: inset 0 0 3px ",";\n }\n\n &:after {\n position: absolute;\n z-index: 2;\n top: 4px;\n left: 4px;\n width: 12px;\n height: 12px;\n content: '';\n transition: all .2s ease;\n animation: "," .3s ease-out;\n border-radius: 50px;\n background: white;\n box-shadow: 0 0 3px 0 ",";\n }\n }\n \n input {\n &[type=checkbox] {\n display: none;\n visibility: hidden;\n\n &:disabled + label {\n cursor: not-allowed;\n }\n \n &:checked + label:before {\n background: ",";\n box-shadow: inset 0 0 1px ",";\n }\n\n &:checked + label:after {\n left: 24px;\n animation: "," .2s ease-out;\n }\n \n &:checked:disabled + label:before {\n background: ",";\n }\n }\n }\n"]);return u=function(){return n},n}function p(){var n=d(["\n display: flex;\n align-items: center;\n"]);return p=function(){return n},n}function b(){var n=d(["\n 50% {\n transform: scaleX(1.1);\n }\n"]);return b=function(){return n},n}var m=o(b()),f=i(r,"0.15"),h=i(r,"0.5"),x=i(l,"0.5"),v=t.div(p()),y=t.div(u(),a,s,c,f,m,h,(function(n){var e,t;return(null==n||null===(e=n.theme)||void 0===e||null===(t=e.actionColor)||void 0===t?void 0:t.main)||l}),x,m,(function(n){var e,t;return i((null==n||null===(e=n.theme)||void 0===e||null===(t=e.actionColor)||void 0===t?void 0:t.main)||l,"0.3")})),g=function(e){var t=e.model,o=e.commonStyle,i=e.activeStyle,r=e.elementId,l=e.isDisabled,a=e.onChange;return n.createElement(v,{className:o},n.createElement(y,{className:i},n.createElement("input",{type:"checkbox",checked:t,onChange:function(){a(!t)},id:r,disabled:l}),n.createElement("label",{htmlFor:r,role:"presentation"})))};g.propTypes={model:e.bool.isRequired,commonStyle:e.string,activeStyle:e.string,elementId:e.string,isDisabled:e.bool,onChange:e.func.isRequired},g.defaultProps={commonStyle:"",activeStyle:"",elementId:"",isDisabled:!1};export default g;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@propellerads/switch",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"main": "dist/index.esm.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"files": [
|
|
@@ -26,11 +26,14 @@
|
|
|
26
26
|
"@babel/plugin-transform-react-jsx": "^7.9.4",
|
|
27
27
|
"@babel/preset-env": "^7.9.5",
|
|
28
28
|
"@babel/preset-react": "^7.9.4",
|
|
29
|
-
"react": "^16.13.1",
|
|
30
29
|
"rollup": "^2.6.1",
|
|
31
30
|
"rollup-plugin-babel": "^4.4.0",
|
|
32
|
-
"rollup-plugin-terser": "^5.3.0"
|
|
33
|
-
"styled-components": "^5.1.0"
|
|
31
|
+
"rollup-plugin-terser": "^5.3.0"
|
|
34
32
|
},
|
|
35
|
-
"
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"prop-types": "15.7.2",
|
|
35
|
+
"react": "^17.0.2",
|
|
36
|
+
"styled-components": "5.1.1"
|
|
37
|
+
},
|
|
38
|
+
"gitHead": "3674f12aa67f614687ba2d22b2e55d426e1181ef"
|
|
36
39
|
}
|