ordering-ui-external 1.5.2 → 1.5.4
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/_modules/styles/Switch/index.js +46 -0
- package/_modules/styles/Switch/styles.js +23 -0
- package/_modules/themes/five/src/components/BusinessListingSearch/index.js +1 -1
- package/package.json +1 -1
- package/src/styles/Switch/index.js +39 -0
- package/src/styles/Switch/styles.js +58 -0
- package/src/themes/five/src/components/BusinessListingSearch/index.js +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Switch = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _styles = require("./styles");
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
16
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
var Switch = function Switch(props) {
|
|
19
|
+
var defaultChecked = props.defaultChecked,
|
|
20
|
+
disabled = props.disabled,
|
|
21
|
+
onChange = props.onChange,
|
|
22
|
+
className = props.className,
|
|
23
|
+
notAsync = props.notAsync;
|
|
24
|
+
var _useState = (0, _react.useState)(false),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
checked = _useState2[0],
|
|
27
|
+
setChecked = _useState2[1];
|
|
28
|
+
(0, _react.useEffect)(function () {
|
|
29
|
+
setChecked(defaultChecked);
|
|
30
|
+
}, [defaultChecked]);
|
|
31
|
+
var handleCheckBoxChange = function handleCheckBoxChange(evt) {
|
|
32
|
+
if (!notAsync) {
|
|
33
|
+
setChecked(evt.target.checked);
|
|
34
|
+
}
|
|
35
|
+
onChange && onChange(evt.target.checked);
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_styles.ToggleSwitchContainer, {
|
|
38
|
+
className: className,
|
|
39
|
+
disabled: disabled
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
41
|
+
type: "checkbox",
|
|
42
|
+
checked: checked,
|
|
43
|
+
onChange: handleCheckBoxChange
|
|
44
|
+
}), /*#__PURE__*/_react.default.createElement(_styles.Slider, null));
|
|
45
|
+
};
|
|
46
|
+
exports.Switch = Switch;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ToggleSwitchContainer = exports.Slider = void 0;
|
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
13
|
+
var ToggleSwitchContainer = _styledComponents.default.label(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n display: inline-block;\n width: 40px;\n height: 26px;\n margin-bottom: 0px;\n\n ", "\n\n input {\n opacity: 0;\n width: 0;\n height: 0;\n\n &:checked + span {\n background-color: ", ";\n }\n &:focus + span {\n box-shadow: 0 0 1px ", ";\n }\n &:checked + span:before {\n -webkit-transform: translateX(13px);\n -ms-transform: translateX(13px);\n transform: translateX(13px);\n }\n }\n"])), function (_ref) {
|
|
14
|
+
var disabled = _ref.disabled;
|
|
15
|
+
return disabled && (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n opacity: 0.6;\n pointer-events: none;\n "])));
|
|
16
|
+
}, function (props) {
|
|
17
|
+
return props.theme.colors.primary;
|
|
18
|
+
}, function (props) {
|
|
19
|
+
return props.theme.colors.primary;
|
|
20
|
+
});
|
|
21
|
+
exports.ToggleSwitchContainer = ToggleSwitchContainer;
|
|
22
|
+
var Slider = _styledComponents.default.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: #ccc;\n -webkit-transition: .4s;\n transition: .4s;\n border-radius: 15px;\n\n &:before {\n position: absolute;\n content: \"\";\n height: 20px;\n width: 20px;\n left: 3px;\n bottom: 3px;\n background-color: white;\n -webkit-transition: .4s;\n transition: .4s;\n border-radius: 50%;\n }\n"])));
|
|
23
|
+
exports.Slider = Slider;
|
|
@@ -277,7 +277,7 @@ var BusinessListingSearchUI = function BusinessListingSearchUI(props) {
|
|
|
277
277
|
});
|
|
278
278
|
})))), /*#__PURE__*/_react.default.createElement(_styles.ProductsList, null, (_businessesSearchList6 = businessesSearchList.businesses) === null || _businessesSearchList6 === void 0 ? void 0 : _businessesSearchList6.filter(function (business) {
|
|
279
279
|
var _business$categories;
|
|
280
|
-
return (business === null || business === void 0 ? void 0 : (_business$categories = business.categories) === null || _business$categories === void 0 ? void 0 : _business$categories.length)
|
|
280
|
+
return (business === null || business === void 0 ? void 0 : (_business$categories = business.categories) === null || _business$categories === void 0 ? void 0 : _business$categories.length) >= 0;
|
|
281
281
|
}).map(function (business) {
|
|
282
282
|
var _theme$images, _theme$images$dummies, _theme$images2, _theme$images2$dummie, _orderState$options8, _orderState$options9, _business$categories2;
|
|
283
283
|
return /*#__PURE__*/_react.default.createElement(_styles.SingleBusinessSearch, {
|
package/package.json
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
ToggleSwitchContainer,
|
|
5
|
+
Slider
|
|
6
|
+
} from './styles'
|
|
7
|
+
|
|
8
|
+
export const Switch = (props) => {
|
|
9
|
+
const {
|
|
10
|
+
defaultChecked,
|
|
11
|
+
disabled,
|
|
12
|
+
onChange,
|
|
13
|
+
className,
|
|
14
|
+
notAsync
|
|
15
|
+
} = props
|
|
16
|
+
const [checked, setChecked] = useState(false)
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
setChecked(defaultChecked)
|
|
20
|
+
}, [defaultChecked])
|
|
21
|
+
|
|
22
|
+
const handleCheckBoxChange = (evt) => {
|
|
23
|
+
if (!notAsync) {
|
|
24
|
+
setChecked(evt.target.checked)
|
|
25
|
+
}
|
|
26
|
+
onChange && onChange(evt.target.checked)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<ToggleSwitchContainer className={className} disabled={disabled}>
|
|
31
|
+
<input
|
|
32
|
+
type='checkbox'
|
|
33
|
+
checked={checked}
|
|
34
|
+
onChange={handleCheckBoxChange}
|
|
35
|
+
/>
|
|
36
|
+
<Slider />
|
|
37
|
+
</ToggleSwitchContainer>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const ToggleSwitchContainer = styled.label`
|
|
4
|
+
position: relative;
|
|
5
|
+
display: inline-block;
|
|
6
|
+
width: 40px;
|
|
7
|
+
height: 26px;
|
|
8
|
+
margin-bottom: 0px;
|
|
9
|
+
|
|
10
|
+
${({ disabled }) => disabled && css`
|
|
11
|
+
opacity: 0.6;
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
`}
|
|
14
|
+
|
|
15
|
+
input {
|
|
16
|
+
opacity: 0;
|
|
17
|
+
width: 0;
|
|
18
|
+
height: 0;
|
|
19
|
+
|
|
20
|
+
&:checked + span {
|
|
21
|
+
background-color: ${props => props.theme.colors.primary};
|
|
22
|
+
}
|
|
23
|
+
&:focus + span {
|
|
24
|
+
box-shadow: 0 0 1px ${props => props.theme.colors.primary};
|
|
25
|
+
}
|
|
26
|
+
&:checked + span:before {
|
|
27
|
+
-webkit-transform: translateX(13px);
|
|
28
|
+
-ms-transform: translateX(13px);
|
|
29
|
+
transform: translateX(13px);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`
|
|
33
|
+
|
|
34
|
+
export const Slider = styled.span`
|
|
35
|
+
position: absolute;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
top: 0;
|
|
38
|
+
left: 0;
|
|
39
|
+
right: 0;
|
|
40
|
+
bottom: 0;
|
|
41
|
+
background-color: #ccc;
|
|
42
|
+
-webkit-transition: .4s;
|
|
43
|
+
transition: .4s;
|
|
44
|
+
border-radius: 15px;
|
|
45
|
+
|
|
46
|
+
&:before {
|
|
47
|
+
position: absolute;
|
|
48
|
+
content: "";
|
|
49
|
+
height: 20px;
|
|
50
|
+
width: 20px;
|
|
51
|
+
left: 3px;
|
|
52
|
+
bottom: 3px;
|
|
53
|
+
background-color: white;
|
|
54
|
+
-webkit-transition: .4s;
|
|
55
|
+
transition: .4s;
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
}
|
|
58
|
+
`
|
|
@@ -321,7 +321,7 @@ export const BusinessListingSearchUI = (props) => {
|
|
|
321
321
|
</BusinessList>
|
|
322
322
|
</BusinessListWrapper>
|
|
323
323
|
<ProductsList>
|
|
324
|
-
{businessesSearchList.businesses?.filter(business => business?.categories?.length
|
|
324
|
+
{businessesSearchList.businesses?.filter(business => business?.categories?.length >= 0).map(business => (
|
|
325
325
|
<SingleBusinessSearch key={`card-${business?.id}`}>
|
|
326
326
|
<BusinessInfo>
|
|
327
327
|
{(business?.logo || theme.images?.dummies?.businessLogo) && (
|