grevlingui 0.0.1 → 0.1.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.
- package/Buttons/Buttons.css +13 -0
- package/Buttons/MenuButton.js +70 -0
- package/Buttons/SettingsButton.js +86 -0
- package/CheckBox.js +50 -0
- package/Menu/Menu.css +91 -0
- package/Menu/Menu.js +101 -0
- package/README.md +12 -65
- package/Radio/RadioButton.js +61 -0
- package/Radio/RadioGroup.js +37 -0
- package/Radio/index.js +21 -0
- package/ToggleSwitch.js +61 -0
- package/index.js +44 -17
- package/package.json +8 -4
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MenuButton = void 0;
|
|
7
|
+
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
+
|
|
20
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
|
|
22
|
+
const MenuButton = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
open,
|
|
25
|
+
setOpen,
|
|
26
|
+
transitionTime,
|
|
27
|
+
c,
|
|
28
|
+
backgroundColor,
|
|
29
|
+
stageDelay,
|
|
30
|
+
styles,
|
|
31
|
+
className
|
|
32
|
+
} = _ref;
|
|
33
|
+
const [flip, setFlip] = (0, _react.useState)(false);
|
|
34
|
+
|
|
35
|
+
const renderPath = (_ref2, center) => {
|
|
36
|
+
let [d1, d2] = _ref2;
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement("path", {
|
|
38
|
+
style: {
|
|
39
|
+
transitionProperty: 'd',
|
|
40
|
+
transitionDuration: "".concat(transitionTime, "ms"),
|
|
41
|
+
transitionDelay: open && center || !(open || center) ? '' : "".concat(stageDelay, "ms")
|
|
42
|
+
},
|
|
43
|
+
d: open ? d2 : d1,
|
|
44
|
+
fill: c,
|
|
45
|
+
className: 'mainShape'
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const icon = /*#__PURE__*/_react.default.createElement("svg", {
|
|
50
|
+
className: "xburgerButton",
|
|
51
|
+
viewBox: "0 0 132.29166 132.29167",
|
|
52
|
+
height: "30",
|
|
53
|
+
width: "30"
|
|
54
|
+
}, renderPath(flip ? ["m 3.3906325,100.69908 125.3180175,0.008 -0.001,18.59162 -125.3180167,-0.008 z", "M 28.846694,14.020461 117.45992,106.30873 104.83715,119.455 16.223931,27.166726 Z"] : ["m 4.0263095,14.267981 125.3180305,-0.01822 0.003,18.591625 -125.3180367,0.01823 z", "M 16.175122,106.15278 104.78835,13.864516 117.41112,27.010786 28.79789,119.29905 Z"], false), renderPath(["M 3.4245129,57.752314 H 128.74254 V 76.343939 H 3.4245129 Z", "M 67.752314,57.752314 H 67.752314 V 76.343939 H 67.752314 Z"], true), renderPath(flip ? ["m 4.0263095,14.267981 125.3180305,-0.01822 0.003,18.591625 -125.3180367,0.01823 z", "M 16.175122,106.15278 104.78835,13.864516 117.41112,27.010786 28.79789,119.29905 Z"] : ["m 3.3906325,100.69908 125.3180175,0.008 -0.001,18.59162 -125.3180167,-0.008 z", "M 28.846694,14.020461 117.45992,106.30873 104.83715,119.455 16.223931,27.166726 Z"], false));
|
|
55
|
+
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
57
|
+
className: "thingy"
|
|
58
|
+
}, flip), /*#__PURE__*/_react.default.createElement("button", {
|
|
59
|
+
className: "xburgerMenuButton styleOverride ".concat(className),
|
|
60
|
+
onClick: () => {
|
|
61
|
+
if (open) setFlip(f => !f);
|
|
62
|
+
setOpen(!open);
|
|
63
|
+
},
|
|
64
|
+
style: _objectSpread(_objectSpread({}, styles), {}, {
|
|
65
|
+
backgroundColor
|
|
66
|
+
})
|
|
67
|
+
}, icon));
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
exports.MenuButton = MenuButton;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SettingsButton = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
require("./Buttons.css");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
+
|
|
18
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
|
|
20
|
+
const SettingsButton = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
open,
|
|
23
|
+
setOpen,
|
|
24
|
+
transitionTime = 300,
|
|
25
|
+
c,
|
|
26
|
+
backgroundColor,
|
|
27
|
+
stageDelay,
|
|
28
|
+
styles,
|
|
29
|
+
className,
|
|
30
|
+
rounding = 7
|
|
31
|
+
} = _ref;
|
|
32
|
+
const rArray = open ? [0, 0] : [20, 35];
|
|
33
|
+
|
|
34
|
+
const getRekt = (deg, animate) => /*#__PURE__*/_react.default.createElement("rect", {
|
|
35
|
+
style: {
|
|
36
|
+
transitionProperty: 'x, width',
|
|
37
|
+
transitionDuration: "".concat(transitionTime, "ms, ").concat(transitionTime, "ms"),
|
|
38
|
+
transitionDelay: open ? '' : "".concat(stageDelay, "ms, ").concat(stageDelay, "ms")
|
|
39
|
+
},
|
|
40
|
+
x: animate && open ? 40 : 0,
|
|
41
|
+
y: "41",
|
|
42
|
+
height: "18",
|
|
43
|
+
fill: c !== null && c !== void 0 ? c : 'white',
|
|
44
|
+
width: animate && open ? 20 : 100,
|
|
45
|
+
transform: "rotate(".concat(deg, " 50 50)"),
|
|
46
|
+
rx: rounding
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const getCircle = (r, color) => /*#__PURE__*/_react.default.createElement("circle", {
|
|
50
|
+
style: {
|
|
51
|
+
transitionProperty: 'r',
|
|
52
|
+
transitionDuration: "".concat(transitionTime, "ms"),
|
|
53
|
+
transitionDelay: open ? "".concat(stageDelay, "ms") : ''
|
|
54
|
+
},
|
|
55
|
+
fill: color !== null && color !== void 0 ? color : 'black',
|
|
56
|
+
cx: "50",
|
|
57
|
+
cy: "50",
|
|
58
|
+
r: r
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement("button", {
|
|
62
|
+
className: "settingsButton styleOverride ".concat(className),
|
|
63
|
+
onClick: () => {
|
|
64
|
+
setOpen(!open);
|
|
65
|
+
},
|
|
66
|
+
style: _objectSpread(_objectSpread({}, styles), {}, {
|
|
67
|
+
backgroundColor
|
|
68
|
+
})
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
70
|
+
viewBox: "0 0 100 100",
|
|
71
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
72
|
+
}, /*#__PURE__*/_react.default.createElement("mask", {
|
|
73
|
+
id: "gearMask"
|
|
74
|
+
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
75
|
+
x: "0",
|
|
76
|
+
y: "0",
|
|
77
|
+
height: "100",
|
|
78
|
+
width: "100",
|
|
79
|
+
fill: "white"
|
|
80
|
+
}), getCircle(rArray[0])), /*#__PURE__*/_react.default.createElement("g", {
|
|
81
|
+
mask: "url(#gearMask)",
|
|
82
|
+
id: "settingsButtonShapes"
|
|
83
|
+
}, getRekt(0, true), getRekt(45), getRekt(90, true), getRekt(135), getCircle(rArray[1], c !== null && c !== void 0 ? c : 'white'))));
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
exports.SettingsButton = SettingsButton;
|
package/CheckBox.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CheckBox = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const CheckBox = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
checked,
|
|
15
|
+
setChecked,
|
|
16
|
+
label,
|
|
17
|
+
color
|
|
18
|
+
} = _ref;
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
20
|
+
style: {
|
|
21
|
+
display: 'inline-block'
|
|
22
|
+
}
|
|
23
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
24
|
+
className: "checkBox ".concat(checked ? ' checked' : ''),
|
|
25
|
+
style: {
|
|
26
|
+
display: 'flex',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'flex-start',
|
|
29
|
+
cursor: 'default'
|
|
30
|
+
},
|
|
31
|
+
onClick: () => setChecked(!checked)
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
33
|
+
viewBox: "0 0 132.29166 132.29167",
|
|
34
|
+
height: "35",
|
|
35
|
+
width: "35"
|
|
36
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
37
|
+
style: {
|
|
38
|
+
transition: 'd 250ms'
|
|
39
|
+
},
|
|
40
|
+
d: checked ? "m 11.120115,58.317116 7.120334,6.317823 6.026283,5.413084 26.863979,23.785172 0.08968,-0.0065 73.610599,-75.912909 0.19168,-0.208115 0.23209,-0.218791 0.25933,-0.293027 1.0137,-1.034147 -0.0487,17.386797 -74.521188,89.035537 -0.04318,-0.001 -40.699193,-50.569883 z" : "m 10.924959,17.515864 7.384214,-8.0947911 2.070114,7.0942151 0.0095,90.248492 89.714263,0.33483 0.54025,-90.469474 -90.263871,-0.113848 -2.070115,-7.0942151 96.390046,-0.033179 8.52678,11.0587641 -0.17363,92.233642 -9.78754,10.89971 -92.027722,-0.27385 -10.358292,-9.04231 z",
|
|
41
|
+
fill: color,
|
|
42
|
+
className: 'mainShape'
|
|
43
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
44
|
+
style: {
|
|
45
|
+
marginLeft: '10px'
|
|
46
|
+
}
|
|
47
|
+
}, label)));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
exports.CheckBox = CheckBox;
|
package/Menu/Menu.css
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
.xburgerMenuButton {
|
|
2
|
+
font-size: 1.3em;
|
|
3
|
+
padding: 0;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
height: 50px;
|
|
6
|
+
width: 50px;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
outline: none;
|
|
11
|
+
border: none;
|
|
12
|
+
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
|
|
13
|
+
border-radius: .5rem;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.xburgerMenu {
|
|
17
|
+
padding-top: 80px;
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 0;
|
|
20
|
+
bottom: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.xburgerMenu.fader {
|
|
24
|
+
left: 0;
|
|
25
|
+
right: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.slider.xburgerMenu {
|
|
29
|
+
left: calc(100vw + 20px);
|
|
30
|
+
right: calc(-80vw - 20px);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.left.slider.xburgerMenu {
|
|
34
|
+
left: calc(-80vw - 20px);
|
|
35
|
+
right: calc(100vw + 20px);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.button {
|
|
39
|
+
position: absolute;
|
|
40
|
+
top: 1rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.button:not(.left) {
|
|
44
|
+
right: 1rem;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.left.button {
|
|
48
|
+
left: 1rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.xburgerTouchOutsideSensor {
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: 0;
|
|
54
|
+
left: 0;
|
|
55
|
+
right: 0;
|
|
56
|
+
bottom: 0;
|
|
57
|
+
opacity: 0;
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.xburgerTouchOutsideSensor.show {
|
|
62
|
+
opacity: 1;
|
|
63
|
+
pointer-events: unset;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.slider.xburgerMenu.show {
|
|
67
|
+
left: 0;
|
|
68
|
+
right: 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.partial.slider.xburgerMenu.show:not(.left) {
|
|
72
|
+
left: 20vw;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.partial.left.slider.xburgerMenu.show {
|
|
76
|
+
right: 20vw;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
.xburgerMenu a * {
|
|
81
|
+
pointer-events: none; /* allow menu item click detection to close menu*/
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.fader.xburgerMenu {
|
|
85
|
+
opacity: 1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.fader.xburgerMenu:not(.show) {
|
|
89
|
+
opacity: 0;
|
|
90
|
+
pointer-events: none;
|
|
91
|
+
}
|
package/Menu/Menu.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Menu = void 0;
|
|
7
|
+
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
require("./Menu.css");
|
|
13
|
+
|
|
14
|
+
var _MenuButton = require("../Buttons/MenuButton");
|
|
15
|
+
|
|
16
|
+
var _SettingsButton = require("../Buttons/SettingsButton");
|
|
17
|
+
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
22
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
+
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
|
+
|
|
26
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
+
|
|
28
|
+
const Menu = _ref => {
|
|
29
|
+
let {
|
|
30
|
+
children,
|
|
31
|
+
onCloseClickOverride,
|
|
32
|
+
shouldCloseOnClick,
|
|
33
|
+
transitionTime,
|
|
34
|
+
zIndex,
|
|
35
|
+
color,
|
|
36
|
+
bgColor,
|
|
37
|
+
menuBgColor,
|
|
38
|
+
backdropColor,
|
|
39
|
+
settings,
|
|
40
|
+
renderButton,
|
|
41
|
+
className,
|
|
42
|
+
fullSlider,
|
|
43
|
+
fader,
|
|
44
|
+
left
|
|
45
|
+
} = _ref;
|
|
46
|
+
const [show, setShow] = (0, _react.useState)(false);
|
|
47
|
+
const tt = transitionTime !== null && transitionTime !== void 0 ? transitionTime : 400,
|
|
48
|
+
zi = zIndex !== null && zIndex !== void 0 ? zIndex : 2,
|
|
49
|
+
c = color,
|
|
50
|
+
bgc = bgColor,
|
|
51
|
+
bdc = backdropColor !== null && backdropColor !== void 0 ? backdropColor : '#e3e6e850';
|
|
52
|
+
console.log('menu c', c);
|
|
53
|
+
let button;
|
|
54
|
+
if (renderButton) button = renderButton(show, setShow, tt, c, bgc);else {
|
|
55
|
+
const Button = settings ? _SettingsButton.SettingsButton : _MenuButton.MenuButton;
|
|
56
|
+
button = /*#__PURE__*/_react.default.createElement(Button, {
|
|
57
|
+
className: "button ".concat(left ? 'left' : ''),
|
|
58
|
+
open: !!(show || onCloseClickOverride),
|
|
59
|
+
setOpen: setShow,
|
|
60
|
+
transitionTime: tt * .6,
|
|
61
|
+
stageDelay: tt * .1,
|
|
62
|
+
c: c,
|
|
63
|
+
backgroundColor: bgColor,
|
|
64
|
+
styles: {
|
|
65
|
+
zIndex: zi + 2,
|
|
66
|
+
backgroundColor: bgc
|
|
67
|
+
} // rounding={2}
|
|
68
|
+
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
let container;
|
|
72
|
+
const style = {
|
|
73
|
+
zIndex: zi + 1,
|
|
74
|
+
color: c,
|
|
75
|
+
backgroundColor: menuBgColor !== null && menuBgColor !== void 0 ? menuBgColor : bgc
|
|
76
|
+
};
|
|
77
|
+
if (fader) container = /*#__PURE__*/_react.default.createElement("div", {
|
|
78
|
+
className: "xburgerMenu fader ".concat(show ? ' show' : '', " ").concat(className),
|
|
79
|
+
onClick: e => shouldCloseOnClick && shouldCloseOnClick(e) && setShow(false),
|
|
80
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
81
|
+
transition: "opacity ".concat(tt, "ms ease-out")
|
|
82
|
+
})
|
|
83
|
+
}, children);else container = /*#__PURE__*/_react.default.createElement("div", {
|
|
84
|
+
className: "xburgerMenu slider ".concat(fullSlider ? '' : 'partial', " ").concat(show ? ' show' : '', " ").concat(left ? 'left' : '', " ").concat(className),
|
|
85
|
+
onClick: e => shouldCloseOnClick && shouldCloseOnClick(e) && setShow(false),
|
|
86
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
87
|
+
transition: "left ".concat(tt, "ms ease-out, right ").concat(tt, "ms ease-out")
|
|
88
|
+
})
|
|
89
|
+
}, children);
|
|
90
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
+
className: "xburgerTouchOutsideSensor ".concat(show ? ' show' : ''),
|
|
92
|
+
onClick: () => setShow(false),
|
|
93
|
+
style: {
|
|
94
|
+
transition: "opacity ".concat(tt, "ms ease-out"),
|
|
95
|
+
zIndex: zi,
|
|
96
|
+
backgroundColor: bdc
|
|
97
|
+
}
|
|
98
|
+
}), button, container);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
exports.Menu = Menu;
|
package/README.md
CHANGED
|
@@ -1,70 +1,17 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Grevlingui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Gui elements for basic mobile web app stuff
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Components:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Menu
|
|
8
|
+
- SettingsButton
|
|
9
|
+
- MenuButton
|
|
10
|
+
- RadioButton
|
|
11
|
+
- RadioGroup
|
|
12
|
+
- CheckBox
|
|
13
|
+
- ToggleSwitch
|
|
8
14
|
|
|
9
|
-
###
|
|
15
|
+
### Usage and examples:
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
|
13
|
-
|
|
14
|
-
The page will reload when you make changes.\
|
|
15
|
-
You may also see any lint errors in the console.
|
|
16
|
-
|
|
17
|
-
### `npm test`
|
|
18
|
-
|
|
19
|
-
Launches the test runner in the interactive watch mode.\
|
|
20
|
-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
21
|
-
|
|
22
|
-
### `npm run build`
|
|
23
|
-
|
|
24
|
-
Builds the app for production to the `build` folder.\
|
|
25
|
-
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
26
|
-
|
|
27
|
-
The build is minified and the filenames include the hashes.\
|
|
28
|
-
Your app is ready to be deployed!
|
|
29
|
-
|
|
30
|
-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
31
|
-
|
|
32
|
-
### `npm run eject`
|
|
33
|
-
|
|
34
|
-
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
|
35
|
-
|
|
36
|
-
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
37
|
-
|
|
38
|
-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
|
39
|
-
|
|
40
|
-
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
|
41
|
-
|
|
42
|
-
## Learn More
|
|
43
|
-
|
|
44
|
-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
45
|
-
|
|
46
|
-
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
47
|
-
|
|
48
|
-
### Code Splitting
|
|
49
|
-
|
|
50
|
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
|
51
|
-
|
|
52
|
-
### Analyzing the Bundle Size
|
|
53
|
-
|
|
54
|
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
|
55
|
-
|
|
56
|
-
### Making a Progressive Web App
|
|
57
|
-
|
|
58
|
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
|
59
|
-
|
|
60
|
-
### Advanced Configuration
|
|
61
|
-
|
|
62
|
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
|
63
|
-
|
|
64
|
-
### Deployment
|
|
65
|
-
|
|
66
|
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
|
67
|
-
|
|
68
|
-
### `npm run build` fails to minify
|
|
69
|
-
|
|
70
|
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
|
17
|
+
todo
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RadioButton = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const RadioButton = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
active,
|
|
15
|
+
text,
|
|
16
|
+
className,
|
|
17
|
+
color
|
|
18
|
+
} = _ref;
|
|
19
|
+
|
|
20
|
+
const renderCircle = (r, className, mask, fill) => /*#__PURE__*/_react.default.createElement("circle", {
|
|
21
|
+
style: {
|
|
22
|
+
transition: "r 300ms"
|
|
23
|
+
},
|
|
24
|
+
cx: "67",
|
|
25
|
+
cy: "67",
|
|
26
|
+
r: r,
|
|
27
|
+
fill: fill,
|
|
28
|
+
className: className,
|
|
29
|
+
mask: mask
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
33
|
+
style: {
|
|
34
|
+
display: 'flex',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
justifyContent: 'flex-start',
|
|
37
|
+
cursor: 'default'
|
|
38
|
+
},
|
|
39
|
+
className: "radioButton ".concat(active ? ' active' : '')
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
41
|
+
className: "".concat(className || ''),
|
|
42
|
+
viewBox: "0 0 132.29 132.29",
|
|
43
|
+
height: "35",
|
|
44
|
+
width: "35"
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement("mask", {
|
|
46
|
+
id: "mask"
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
48
|
+
x: "0",
|
|
49
|
+
y: "0",
|
|
50
|
+
width: "200",
|
|
51
|
+
height: "200",
|
|
52
|
+
fill: "white"
|
|
53
|
+
}), renderCircle(55, 'black', undefined, '#000')), renderCircle(65, 'mainShape', 'url(#mask)', color), renderCircle(active ? 40 : 0, 'mainShape', undefined, color)), /*#__PURE__*/_react.default.createElement("span", {
|
|
54
|
+
style: {
|
|
55
|
+
marginLeft: '10px',
|
|
56
|
+
color
|
|
57
|
+
}
|
|
58
|
+
}, text));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.RadioButton = RadioButton;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RadioGroup = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _RadioButton = require("./RadioButton");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
const RadioGroup = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
options,
|
|
17
|
+
selected,
|
|
18
|
+
onSelect,
|
|
19
|
+
color
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
22
|
+
className: "radioGroup"
|
|
23
|
+
}, options.map((option, i) => /*#__PURE__*/_react.default.createElement("div", {
|
|
24
|
+
key: i
|
|
25
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
26
|
+
onClick: () => onSelect(option.key),
|
|
27
|
+
style: {
|
|
28
|
+
display: 'inline-block'
|
|
29
|
+
}
|
|
30
|
+
}, /*#__PURE__*/_react.default.createElement(_RadioButton.RadioButton, {
|
|
31
|
+
active: option.key === selected,
|
|
32
|
+
text: option.label,
|
|
33
|
+
color: color
|
|
34
|
+
})))));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.RadioGroup = RadioGroup;
|
package/Radio/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "RadioButton", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _RadioButton.RadioButton;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "RadioGroup", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _RadioGroup.RadioGroup;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _RadioButton = require("./RadioButton");
|
|
20
|
+
|
|
21
|
+
var _RadioGroup = require("./RadioGroup");
|
package/ToggleSwitch.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ToggleSwitch = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const ToggleSwitch = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
active,
|
|
15
|
+
onChange,
|
|
16
|
+
label,
|
|
17
|
+
transitionTime,
|
|
18
|
+
easing,
|
|
19
|
+
color
|
|
20
|
+
} = _ref;
|
|
21
|
+
const tt = transitionTime || 100,
|
|
22
|
+
e = easing || 'ease-out';
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
24
|
+
style: {
|
|
25
|
+
display: 'inline-block'
|
|
26
|
+
}
|
|
27
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
28
|
+
className: "toggleSwitch ".concat(active ? 'active' : ''),
|
|
29
|
+
style: {
|
|
30
|
+
display: 'flex',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
justifyContent: 'flex-start',
|
|
33
|
+
cursor: 'default'
|
|
34
|
+
},
|
|
35
|
+
onClick: () => onChange(!active)
|
|
36
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
37
|
+
viewBox: "0 0 132.29166 132.29167",
|
|
38
|
+
height: "55",
|
|
39
|
+
width: "55" // height="35" width="35"
|
|
40
|
+
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
42
|
+
d: "m 38.052687,47.864419 h 54.916086 c 27.034327,2.305319 25.559797,39.054731 0,40.30747 H 38.075448 C 10.11119,87.499017 11.297192,48.014766 38.052687,47.864419 Z",
|
|
43
|
+
className: 'track'
|
|
44
|
+
}), /*#__PURE__*/_react.default.createElement("circle", {
|
|
45
|
+
className: "toggleSwitch ".concat(active ? 'active' : ''),
|
|
46
|
+
fill: active ? 'dodgerblue' : 'grey',
|
|
47
|
+
cx: active ? 94.778557 : 35.651833,
|
|
48
|
+
cy: "68.430901",
|
|
49
|
+
r: "34",
|
|
50
|
+
style: {
|
|
51
|
+
transition: "cx ".concat(tt, "ms ").concat(e, ", fill ").concat(tt, "ms ").concat(e)
|
|
52
|
+
}
|
|
53
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
54
|
+
style: {
|
|
55
|
+
marginLeft: '10px',
|
|
56
|
+
color
|
|
57
|
+
}
|
|
58
|
+
}, label)));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.ToggleSwitch = ToggleSwitch;
|
package/index.js
CHANGED
|
@@ -3,9 +3,50 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
Object.defineProperty(exports, "CheckBox", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _CheckBox.CheckBox;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "Menu", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _Menu.Menu;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "MenuButton", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _MenuButton.MenuButton;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "RadioButton", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _Radio.RadioButton;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "RadioGroup", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _Radio.RadioGroup;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "SettingsButton", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _SettingsButton.SettingsButton;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "ToggleSwitch", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _ToggleSwitch.ToggleSwitch;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
7
48
|
|
|
8
|
-
var _Menu =
|
|
49
|
+
var _Menu = require("./Menu/Menu");
|
|
9
50
|
|
|
10
51
|
var _SettingsButton = require("./Buttons/SettingsButton");
|
|
11
52
|
|
|
@@ -15,18 +56,4 @@ var _Radio = require("./Radio");
|
|
|
15
56
|
|
|
16
57
|
var _CheckBox = require("./CheckBox");
|
|
17
58
|
|
|
18
|
-
var _ToggleSwitch = require("./ToggleSwitch");
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
|
-
const _exports = {
|
|
23
|
-
Menu: _Menu.default,
|
|
24
|
-
SettingsButton: _SettingsButton.SettingsButton,
|
|
25
|
-
MenuButton: _MenuButton.MenuButton,
|
|
26
|
-
RadioButton: _Radio.RadioButton,
|
|
27
|
-
RadioGroup: _Radio.RadioGroup,
|
|
28
|
-
CheckBox: _CheckBox.CheckBox,
|
|
29
|
-
ToggleSwitch: _ToggleSwitch.ToggleSwitch
|
|
30
|
-
};
|
|
31
|
-
var _default = _exports;
|
|
32
|
-
exports.default = _default;
|
|
59
|
+
var _ToggleSwitch = require("./ToggleSwitch");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grevlingui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "GUI elements",
|
|
5
5
|
"main": "index.jsx",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -9,11 +9,15 @@
|
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|
|
11
11
|
"react",
|
|
12
|
+
"gui",
|
|
12
13
|
"gui elements",
|
|
13
|
-
"
|
|
14
|
+
"menu",
|
|
15
|
+
"buttons",
|
|
16
|
+
"checkbox",
|
|
17
|
+
"toggle",
|
|
18
|
+
"drawer",
|
|
14
19
|
"mobile"
|
|
15
20
|
],
|
|
16
|
-
"files": [ "index.js", "index.css", "README.md" ],
|
|
17
21
|
"author": "Sigve Grevling",
|
|
18
22
|
"license": "MIT"
|
|
19
23
|
}
|