@tenancy.nz/ui 1.2.4 → 1.2.6
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/dist/cjs/components/AvatarCropDialog.cjs +21 -9
- package/dist/cjs/components/AvatarInput.cjs +11 -2
- package/dist/cjs/components/Switch.cjs +4 -0
- package/dist/cjs/components/Switch.styled.cjs +10 -12
- package/dist/esm/components/AvatarCropDialog.js +22 -10
- package/dist/esm/components/AvatarInput.js +11 -2
- package/dist/esm/components/Switch.js +4 -0
- package/dist/esm/components/Switch.styled.js +10 -12
- package/package.json +1 -1
|
@@ -32,8 +32,8 @@ function AvatarCropDialog(_ref) {
|
|
|
32
32
|
} : _ref$onDelete,
|
|
33
33
|
_ref$droppedFile = _ref.droppedFile,
|
|
34
34
|
droppedFile = _ref$droppedFile === void 0 ? null : _ref$droppedFile;
|
|
35
|
-
var
|
|
36
|
-
return theme.breakpoints.
|
|
35
|
+
var isMobile = useMediaQuery(function (theme) {
|
|
36
|
+
return theme.breakpoints.down("md");
|
|
37
37
|
});
|
|
38
38
|
var _useState = React.useState({
|
|
39
39
|
aspect: 1,
|
|
@@ -75,9 +75,13 @@ function AvatarCropDialog(_ref) {
|
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
77
|
var handleCropChange = function handleCropChange(newCrop) {
|
|
78
|
-
|
|
78
|
+
setCrop(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, newCrop), {}, {
|
|
79
|
+
height: newCrop.width,
|
|
80
|
+
aspect: 1
|
|
81
|
+
}));
|
|
79
82
|
};
|
|
80
|
-
var handleImageLoaded = function handleImageLoaded(
|
|
83
|
+
var handleImageLoaded = function handleImageLoaded(e) {
|
|
84
|
+
var image = e.target;
|
|
81
85
|
var width = image.width;
|
|
82
86
|
if (window.innerHeight * 0.7 < image.height) {
|
|
83
87
|
width = image.width * (window.innerHeight * 0.7 / image.height);
|
|
@@ -147,21 +151,29 @@ function AvatarCropDialog(_ref) {
|
|
|
147
151
|
},
|
|
148
152
|
circularCrop: true,
|
|
149
153
|
onChange: handleCropChange,
|
|
150
|
-
onImageLoaded: handleImageLoaded,
|
|
151
154
|
keepSelection: true
|
|
152
155
|
}, /* @__PURE__ */React.createElement("img", {
|
|
153
|
-
src: droppedFile
|
|
154
|
-
|
|
156
|
+
src: droppedFile,
|
|
157
|
+
onLoad: handleImageLoaded
|
|
158
|
+
})))), /* @__PURE__ */React.createElement(ModalActions.default, {
|
|
159
|
+
sx: {
|
|
160
|
+
flexDirection: {
|
|
161
|
+
xs: "column",
|
|
162
|
+
md: "row",
|
|
163
|
+
gap: "16px"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}, /* @__PURE__ */React.createElement(Button.default, {
|
|
155
167
|
onClick: handleCancel,
|
|
156
168
|
variant: "outlined",
|
|
157
169
|
loading: cancelling,
|
|
158
170
|
color: "primaryAlt",
|
|
159
|
-
|
|
171
|
+
fill: isMobile
|
|
160
172
|
}, "Cancel"), /* @__PURE__ */React.createElement(Button.default, {
|
|
161
173
|
onClick: handleImageSave,
|
|
162
174
|
loading: saving,
|
|
163
175
|
color: "primaryAlt",
|
|
164
|
-
|
|
176
|
+
fill: isMobile
|
|
165
177
|
}, "Save")), /* @__PURE__ */React.createElement(Confirmation.default, {
|
|
166
178
|
open: confirmDelete,
|
|
167
179
|
onCancel: function onCancel() {
|
|
@@ -169,12 +169,21 @@ function AvatarInput(_ref) {
|
|
|
169
169
|
align: isNotMobile ? "left" : "center",
|
|
170
170
|
weight: "500",
|
|
171
171
|
color: "textPrimary"
|
|
172
|
-
}, isDragReject ? "The selected file(s) will not be accepted" : dropzoneDescription))))), (savedImage || value) && /* @__PURE__ */React.createElement(
|
|
172
|
+
}, isDragReject ? "The selected file(s) will not be accepted" : dropzoneDescription))))), (savedImage || value) && /* @__PURE__ */React.createElement(Box, {
|
|
173
|
+
sx: {
|
|
174
|
+
position: "absolute",
|
|
175
|
+
top: "50%",
|
|
176
|
+
right: "25px",
|
|
177
|
+
zIndex: 9,
|
|
178
|
+
transform: "translateY(-50%)"
|
|
179
|
+
}
|
|
180
|
+
}, /* @__PURE__ */React.createElement(IconButton.default, {
|
|
173
181
|
color: "error",
|
|
182
|
+
size: "large",
|
|
174
183
|
onClick: function onClick() {
|
|
175
184
|
return setConfirmDelete(true);
|
|
176
185
|
}
|
|
177
|
-
}, /* @__PURE__ */React.createElement(DeleteIcon, null))), droppedFile && /* @__PURE__ */React.createElement(Modal.default, {
|
|
186
|
+
}, /* @__PURE__ */React.createElement(DeleteIcon, null)))), droppedFile && /* @__PURE__ */React.createElement(Modal.default, {
|
|
178
187
|
open: open,
|
|
179
188
|
onClose: function onClose() {
|
|
180
189
|
return setOpen(false);
|
|
@@ -54,8 +54,12 @@ function Switch(_ref) {
|
|
|
54
54
|
margin: "none",
|
|
55
55
|
size: size
|
|
56
56
|
}, label), /* @__PURE__ */React.createElement(Switch_styled.StyledSwitchTrack, {
|
|
57
|
+
color: color,
|
|
58
|
+
checked: !!checked,
|
|
57
59
|
size: size
|
|
58
60
|
}, /* @__PURE__ */React.createElement(Switch_styled.StyledSwitchKnob, {
|
|
61
|
+
color: color,
|
|
62
|
+
checked: !!checked,
|
|
59
63
|
size: size
|
|
60
64
|
})));
|
|
61
65
|
}
|
|
@@ -5,7 +5,7 @@ var react = require('@emotion/react');
|
|
|
5
5
|
var styled = require('@emotion/styled');
|
|
6
6
|
var object = require('../utils/helpers/object.cjs');
|
|
7
7
|
|
|
8
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
|
|
8
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16;
|
|
9
9
|
var StyledSwitch = styled.label(_templateObject || (_templateObject = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n ", "\n"])), function (_ref) {
|
|
10
10
|
var disabled = _ref.disabled;
|
|
11
11
|
return react.css(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n position: relative;\n cursor: pointer;\n display: inline-flex;\n gap: 20px;\n align-items: center;\n ", "\n "])), disabled && react.css(_templateObject3 || (_templateObject3 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n opacity: 0.5;\n pointer-events: none;\n "]))));
|
|
@@ -16,21 +16,19 @@ var StyledSwitchLabel = styled.span(_templateObject4 || (_templateObject4 = _rol
|
|
|
16
16
|
return react.css(_templateObject5 || (_templateObject5 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n font-size: 13px;\n font-weight: 600;\n color: ", ";\n\n ", "\n "])), object.getObjectProp(theme, "palette.text.primary"), required && react.css(_templateObject6 || (_templateObject6 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n &:after {\n content: '*';\n color: ", ";\n }\n "])), object.getObjectProp(theme, "palette.error.main")));
|
|
17
17
|
});
|
|
18
18
|
var StyledSwitchKnob = styled.span(_templateObject7 || (_templateObject7 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n ", "\n"])), function (_ref3) {
|
|
19
|
-
var
|
|
19
|
+
var checked = _ref3.checked,
|
|
20
|
+
size = _ref3.size,
|
|
20
21
|
theme = _ref3.theme;
|
|
21
|
-
return react.css(_templateObject8 || (_templateObject8 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n border-radius: 99999px;\n box-shadow: ", ";\n background: #fff;\n position: absolute;\n transition:\n translate 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,\n transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n\n ", "\n\n ", "\n "])), object.getObjectProp(theme, "shadows.1"), size === "medium" && react.css(_templateObject9 || (_templateObject9 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n width: 20px;\n height: 20px;\n top: 2px;\n left: 2px;\n "]))), size === "small" && react.css(_templateObject0 || (_templateObject0 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n width: 14px;\n height: 14px;\n top: 2px;\n left: 2px;\n "]))));
|
|
22
|
+
return react.css(_templateObject8 || (_templateObject8 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n border-radius: 99999px;\n box-shadow: ", ";\n background: #fff;\n position: absolute;\n transition:\n translate 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,\n transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n\n ", "\n\n ", "\n\n ", "\n "])), object.getObjectProp(theme, "shadows.1"), size === "medium" && react.css(_templateObject9 || (_templateObject9 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n width: 20px;\n height: 20px;\n top: 2px;\n left: 2px;\n "]))), size === "small" && react.css(_templateObject0 || (_templateObject0 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n width: 14px;\n height: 14px;\n top: 2px;\n left: 2px;\n "]))), checked && react.css(_templateObject1 || (_templateObject1 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n transform: translateX(", "px);\n "])), size === "small" ? "20" : "20"));
|
|
22
23
|
});
|
|
23
|
-
var StyledSwitchTrack = styled.span(
|
|
24
|
-
var
|
|
24
|
+
var StyledSwitchTrack = styled.span(_templateObject10 || (_templateObject10 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n ", "\n"])), function (_ref4) {
|
|
25
|
+
var checked = _ref4.checked,
|
|
26
|
+
color = _ref4.color,
|
|
27
|
+
size = _ref4.size,
|
|
25
28
|
theme = _ref4.theme;
|
|
26
|
-
return react.css(
|
|
27
|
-
});
|
|
28
|
-
var StyledSwitchInput = styled.input(_templateObject13 || (_templateObject13 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n ", "\n"])), function (_ref5) {
|
|
29
|
-
var color = _ref5.color,
|
|
30
|
-
size = _ref5.size,
|
|
31
|
-
theme = _ref5.theme;
|
|
32
|
-
return react.css(_templateObject14 || (_templateObject14 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n top: 0;\n z-index: -1;\n visibility: hidden;\n opacity: 0;\n\n &:checked ~ ", " {\n background: ", ";\n }\n\n &:checked ~ ", " ", " {\n transform: translateX(", "px);\n }\n "])), StyledSwitchTrack, object.getObjectProp(theme, "palette.".concat(color, ".main")), StyledSwitchTrack, StyledSwitchKnob, size === "small" ? "20" : "20");
|
|
29
|
+
return react.css(_templateObject11 || (_templateObject11 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n position: relative;\n\n transition: background 150ms linear;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n\n &:focus {\n box-shadow: 0px 0px 6px #1f1c4f;\n }\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n "])), size === "medium" && react.css(_templateObject12 || (_templateObject12 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n height: 24px;\n width: 44px;\n border-radius: 12px;\n "]))), size === "small" && react.css(_templateObject13 || (_templateObject13 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n height: 18px;\n width: 38px;\n border-radius: 11px;\n "]))), !checked && react.css(_templateObject14 || (_templateObject14 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n background: ", ";\n "])), object.getObjectProp(theme, "palette.grey.300")), checked && react.css(_templateObject15 || (_templateObject15 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n background: ", ";\n "])), object.getObjectProp(theme, "palette.".concat(color, ".main"))));
|
|
33
30
|
});
|
|
31
|
+
var StyledSwitchInput = styled.input(_templateObject16 || (_templateObject16 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n top: 0;\n z-index: -1;\n visibility: hidden;\n opacity: 0;\n margin: 0 !important;\n padding: 0 !important;\n"])));
|
|
34
32
|
|
|
35
33
|
exports.StyledSwitch = StyledSwitch;
|
|
36
34
|
exports.StyledSwitchInput = StyledSwitchInput;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { slicedToArray as _slicedToArray } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
1
|
+
import { slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
@@ -28,8 +28,8 @@ function AvatarCropDialog(_ref) {
|
|
|
28
28
|
} : _ref$onDelete,
|
|
29
29
|
_ref$droppedFile = _ref.droppedFile,
|
|
30
30
|
droppedFile = _ref$droppedFile === void 0 ? null : _ref$droppedFile;
|
|
31
|
-
var
|
|
32
|
-
return theme.breakpoints.
|
|
31
|
+
var isMobile = useMediaQuery(function (theme) {
|
|
32
|
+
return theme.breakpoints.down("md");
|
|
33
33
|
});
|
|
34
34
|
var _useState = useState({
|
|
35
35
|
aspect: 1,
|
|
@@ -71,9 +71,13 @@ function AvatarCropDialog(_ref) {
|
|
|
71
71
|
});
|
|
72
72
|
};
|
|
73
73
|
var handleCropChange = function handleCropChange(newCrop) {
|
|
74
|
-
|
|
74
|
+
setCrop(_objectSpread2(_objectSpread2({}, newCrop), {}, {
|
|
75
|
+
height: newCrop.width,
|
|
76
|
+
aspect: 1
|
|
77
|
+
}));
|
|
75
78
|
};
|
|
76
|
-
var handleImageLoaded = function handleImageLoaded(
|
|
79
|
+
var handleImageLoaded = function handleImageLoaded(e) {
|
|
80
|
+
var image = e.target;
|
|
77
81
|
var width = image.width;
|
|
78
82
|
if (window.innerHeight * 0.7 < image.height) {
|
|
79
83
|
width = image.width * (window.innerHeight * 0.7 / image.height);
|
|
@@ -143,21 +147,29 @@ function AvatarCropDialog(_ref) {
|
|
|
143
147
|
},
|
|
144
148
|
circularCrop: true,
|
|
145
149
|
onChange: handleCropChange,
|
|
146
|
-
onImageLoaded: handleImageLoaded,
|
|
147
150
|
keepSelection: true
|
|
148
151
|
}, /* @__PURE__ */React.createElement("img", {
|
|
149
|
-
src: droppedFile
|
|
150
|
-
|
|
152
|
+
src: droppedFile,
|
|
153
|
+
onLoad: handleImageLoaded
|
|
154
|
+
})))), /* @__PURE__ */React.createElement(ModalActions, {
|
|
155
|
+
sx: {
|
|
156
|
+
flexDirection: {
|
|
157
|
+
xs: "column",
|
|
158
|
+
md: "row",
|
|
159
|
+
gap: "16px"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}, /* @__PURE__ */React.createElement(Button, {
|
|
151
163
|
onClick: handleCancel,
|
|
152
164
|
variant: "outlined",
|
|
153
165
|
loading: cancelling,
|
|
154
166
|
color: "primaryAlt",
|
|
155
|
-
|
|
167
|
+
fill: isMobile
|
|
156
168
|
}, "Cancel"), /* @__PURE__ */React.createElement(Button, {
|
|
157
169
|
onClick: handleImageSave,
|
|
158
170
|
loading: saving,
|
|
159
171
|
color: "primaryAlt",
|
|
160
|
-
|
|
172
|
+
fill: isMobile
|
|
161
173
|
}, "Save")), /* @__PURE__ */React.createElement(Confirmation, {
|
|
162
174
|
open: confirmDelete,
|
|
163
175
|
onCancel: function onCancel() {
|
|
@@ -165,12 +165,21 @@ function AvatarInput(_ref) {
|
|
|
165
165
|
align: isNotMobile ? "left" : "center",
|
|
166
166
|
weight: "500",
|
|
167
167
|
color: "textPrimary"
|
|
168
|
-
}, isDragReject ? "The selected file(s) will not be accepted" : dropzoneDescription))))), (savedImage || value) && /* @__PURE__ */React.createElement(
|
|
168
|
+
}, isDragReject ? "The selected file(s) will not be accepted" : dropzoneDescription))))), (savedImage || value) && /* @__PURE__ */React.createElement(Box, {
|
|
169
|
+
sx: {
|
|
170
|
+
position: "absolute",
|
|
171
|
+
top: "50%",
|
|
172
|
+
right: "25px",
|
|
173
|
+
zIndex: 9,
|
|
174
|
+
transform: "translateY(-50%)"
|
|
175
|
+
}
|
|
176
|
+
}, /* @__PURE__ */React.createElement(IconButton, {
|
|
169
177
|
color: "error",
|
|
178
|
+
size: "large",
|
|
170
179
|
onClick: function onClick() {
|
|
171
180
|
return setConfirmDelete(true);
|
|
172
181
|
}
|
|
173
|
-
}, /* @__PURE__ */React.createElement(DeleteIcon, null))), droppedFile && /* @__PURE__ */React.createElement(Modal, {
|
|
182
|
+
}, /* @__PURE__ */React.createElement(DeleteIcon, null)))), droppedFile && /* @__PURE__ */React.createElement(Modal, {
|
|
174
183
|
open: open,
|
|
175
184
|
onClose: function onClose() {
|
|
176
185
|
return setOpen(false);
|
|
@@ -50,8 +50,12 @@ function Switch(_ref) {
|
|
|
50
50
|
margin: "none",
|
|
51
51
|
size: size
|
|
52
52
|
}, label), /* @__PURE__ */React.createElement(StyledSwitchTrack, {
|
|
53
|
+
color: color,
|
|
54
|
+
checked: !!checked,
|
|
53
55
|
size: size
|
|
54
56
|
}, /* @__PURE__ */React.createElement(StyledSwitchKnob, {
|
|
57
|
+
color: color,
|
|
58
|
+
checked: !!checked,
|
|
55
59
|
size: size
|
|
56
60
|
})));
|
|
57
61
|
}
|
|
@@ -3,7 +3,7 @@ import { css } from '@emotion/react';
|
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
import { getObjectProp } from '../utils/helpers/object.js';
|
|
5
5
|
|
|
6
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
|
|
6
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16;
|
|
7
7
|
var StyledSwitch = styled.label(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref) {
|
|
8
8
|
var disabled = _ref.disabled;
|
|
9
9
|
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n cursor: pointer;\n display: inline-flex;\n gap: 20px;\n align-items: center;\n ", "\n "])), disabled && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n opacity: 0.5;\n pointer-events: none;\n "]))));
|
|
@@ -14,20 +14,18 @@ var StyledSwitchLabel = styled.span(_templateObject4 || (_templateObject4 = _tag
|
|
|
14
14
|
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: 13px;\n font-weight: 600;\n color: ", ";\n\n ", "\n "])), getObjectProp(theme, "palette.text.primary"), required && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n &:after {\n content: '*';\n color: ", ";\n }\n "])), getObjectProp(theme, "palette.error.main")));
|
|
15
15
|
});
|
|
16
16
|
var StyledSwitchKnob = styled.span(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref3) {
|
|
17
|
-
var
|
|
17
|
+
var checked = _ref3.checked,
|
|
18
|
+
size = _ref3.size,
|
|
18
19
|
theme = _ref3.theme;
|
|
19
|
-
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n border-radius: 99999px;\n box-shadow: ", ";\n background: #fff;\n position: absolute;\n transition:\n translate 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,\n transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n\n ", "\n\n ", "\n "])), getObjectProp(theme, "shadows.1"), size === "medium" && css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n width: 20px;\n height: 20px;\n top: 2px;\n left: 2px;\n "]))), size === "small" && css(_templateObject0 || (_templateObject0 = _taggedTemplateLiteral(["\n width: 14px;\n height: 14px;\n top: 2px;\n left: 2px;\n "]))));
|
|
20
|
+
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n border-radius: 99999px;\n box-shadow: ", ";\n background: #fff;\n position: absolute;\n transition:\n translate 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,\n transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n\n ", "\n\n ", "\n\n ", "\n "])), getObjectProp(theme, "shadows.1"), size === "medium" && css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n width: 20px;\n height: 20px;\n top: 2px;\n left: 2px;\n "]))), size === "small" && css(_templateObject0 || (_templateObject0 = _taggedTemplateLiteral(["\n width: 14px;\n height: 14px;\n top: 2px;\n left: 2px;\n "]))), checked && css(_templateObject1 || (_templateObject1 = _taggedTemplateLiteral(["\n transform: translateX(", "px);\n "])), size === "small" ? "20" : "20"));
|
|
20
21
|
});
|
|
21
|
-
var StyledSwitchTrack = styled.span(
|
|
22
|
-
var
|
|
22
|
+
var StyledSwitchTrack = styled.span(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref4) {
|
|
23
|
+
var checked = _ref4.checked,
|
|
24
|
+
color = _ref4.color,
|
|
25
|
+
size = _ref4.size,
|
|
23
26
|
theme = _ref4.theme;
|
|
24
|
-
return css(
|
|
25
|
-
});
|
|
26
|
-
var StyledSwitchInput = styled.input(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref5) {
|
|
27
|
-
var color = _ref5.color,
|
|
28
|
-
size = _ref5.size,
|
|
29
|
-
theme = _ref5.theme;
|
|
30
|
-
return css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n top: 0;\n z-index: -1;\n visibility: hidden;\n opacity: 0;\n\n &:checked ~ ", " {\n background: ", ";\n }\n\n &:checked ~ ", " ", " {\n transform: translateX(", "px);\n }\n "])), StyledSwitchTrack, getObjectProp(theme, "palette.".concat(color, ".main")), StyledSwitchTrack, StyledSwitchKnob, size === "small" ? "20" : "20");
|
|
27
|
+
return css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n position: relative;\n\n transition: background 150ms linear;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n\n &:focus {\n box-shadow: 0px 0px 6px #1f1c4f;\n }\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n "])), size === "medium" && css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n height: 24px;\n width: 44px;\n border-radius: 12px;\n "]))), size === "small" && css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n height: 18px;\n width: 38px;\n border-radius: 11px;\n "]))), !checked && css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n background: ", ";\n "])), getObjectProp(theme, "palette.grey.300")), checked && css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n background: ", ";\n "])), getObjectProp(theme, "palette.".concat(color, ".main"))));
|
|
31
28
|
});
|
|
29
|
+
var StyledSwitchInput = styled.input(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n top: 0;\n z-index: -1;\n visibility: hidden;\n opacity: 0;\n margin: 0 !important;\n padding: 0 !important;\n"])));
|
|
32
30
|
|
|
33
31
|
export { StyledSwitch, StyledSwitchInput, StyledSwitchKnob, StyledSwitchLabel, StyledSwitchTrack };
|