@smart-react-components/ui 2.1.0-alpha-6 → 2.1.0-alpha-7
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/Checkbox/CheckboxAll.js +1 -1
- package/Checkbox/index.js +1 -1
- package/Radio/index.js +1 -1
- package/components/Checkbox/CheckboxElement.js +36 -24
- package/components/Form/FormInlineLabel.d.ts +2 -1
- package/components/Form/FormInlineLabel.js +10 -7
- package/components/Radio/RadioElement.js +26 -17
- package/components/Switch/SwitchElement.js +27 -21
- package/package.json +7 -7
package/Checkbox/CheckboxAll.js
CHANGED
|
@@ -26,7 +26,7 @@ const CheckboxAll = react_1.default.forwardRef((props, forwardRef) => {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
const input = (react_1.default.createElement(HiddenInput_1.default, Object.assign({ checked: isChecked, onChange: handleOnChange, ref: forwardRef, type: "checkbox" }, (props.isDisabled && { disabled: true }), (props.name && { name: props.name }))));
|
|
29
|
-
return (react_1.default.createElement(FormInlineLabel_1.default, Object.assign({ formSize: props.size, formSizeSm: props.sizeSm, formSizeMd: props.sizeMd, formSizeLg: props.sizeLg, formSizeXl: props.sizeXl, isBlock: props.isBlock, isDisabled: props.isDisabled, labelPosition: props.position }, (0, element_props_1.default)(props, [intrinsic_styled_core_props_1.default])),
|
|
29
|
+
return (react_1.default.createElement(FormInlineLabel_1.default, Object.assign({ formSize: props.size, formSizeSm: props.sizeSm, formSizeMd: props.sizeMd, formSizeLg: props.sizeLg, formSizeXl: props.sizeXl, isBlock: props.isBlock, isDisabled: props.isDisabled, labelPosition: props.position, palette: props.palette }, (0, element_props_1.default)(props, [intrinsic_styled_core_props_1.default])),
|
|
30
30
|
react_1.default.cloneElement(props.template, {
|
|
31
31
|
checkboxSize: props.size,
|
|
32
32
|
checkboxSizeSm: props.sizeSm,
|
package/Checkbox/index.js
CHANGED
|
@@ -39,7 +39,7 @@ const Checkbox = react_1.default.forwardRef((props, forwardRef) => {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
const input = (react_1.default.createElement(HiddenInput_1.default, Object.assign({ checked: isChecked, onChange: handleOnChange, ref: forwardRef, type: "checkbox" }, (props.isDisabled && { disabled: true }), (props.isRequired && { required: true }), (props.name && { name: props.name }))));
|
|
42
|
-
return (react_1.default.createElement(FormInlineLabel_1.default, Object.assign({ formSize: props.size, formSizeSm: props.sizeSm, formSizeMd: props.sizeMd, formSizeLg: props.sizeLg, formSizeXl: props.sizeXl, isBlock: props.isBlock, isDisabled: props.isDisabled, labelPosition: props.position }, (0, element_props_1.default)(props, [intrinsic_styled_core_props_1.default])),
|
|
42
|
+
return (react_1.default.createElement(FormInlineLabel_1.default, Object.assign({ formSize: props.size, formSizeSm: props.sizeSm, formSizeMd: props.sizeMd, formSizeLg: props.sizeLg, formSizeXl: props.sizeXl, isBlock: props.isBlock, isDisabled: props.isDisabled, labelPosition: props.position, palette: props.palette }, (0, element_props_1.default)(props, [intrinsic_styled_core_props_1.default])),
|
|
43
43
|
react_1.default.cloneElement(props.template, {
|
|
44
44
|
checkboxSize: props.size,
|
|
45
45
|
checkboxSizeSm: props.sizeSm,
|
package/Radio/index.js
CHANGED
|
@@ -20,7 +20,7 @@ const Radio = react_1.default.forwardRef((props, forwardRef) => {
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
const input = (react_1.default.createElement(HiddenInput_1.default, Object.assign({ checked: props.value === props.active, onChange: handleOnChange, ref: forwardRef, type: "radio" }, (props.isDisabled && { disabled: true }), (props.isRequired && { required: true }), (props.name && { name: props.name }))));
|
|
23
|
-
return (react_1.default.createElement(FormInlineLabel_1.default, Object.assign({ formSize: props.size, formSizeSm: props.sizeSm, formSizeMd: props.sizeMd, formSizeLg: props.sizeLg, formSizeXl: props.sizeXl, isBlock: props.isBlock, isDisabled: props.isDisabled, labelPosition: props.position }, (0, element_props_1.default)(props, [intrinsic_styled_core_props_1.default])),
|
|
23
|
+
return (react_1.default.createElement(FormInlineLabel_1.default, Object.assign({ formSize: props.size, formSizeSm: props.sizeSm, formSizeMd: props.sizeMd, formSizeLg: props.sizeLg, formSizeXl: props.sizeXl, isBlock: props.isBlock, isDisabled: props.isDisabled, labelPosition: props.position, palette: props.palette }, (0, element_props_1.default)(props, [intrinsic_styled_core_props_1.default])),
|
|
24
24
|
react_1.default.cloneElement(props.template, {
|
|
25
25
|
children: (react_1.default.createElement(react_1.default.Fragment, null,
|
|
26
26
|
input,
|
|
@@ -8,14 +8,17 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const Container = styled_components_1.default.div.attrs({
|
|
10
10
|
className: 'src-checkbox-container',
|
|
11
|
-
})(({ theme }) =>
|
|
12
|
-
|
|
11
|
+
})(({ theme, palette }) => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
return `
|
|
14
|
+
border: solid 2px ${(_b = (_a = theme.$.palette[palette].checkbox) === null || _a === void 0 ? void 0 : _a.border) !== null && _b !== void 0 ? _b : theme.$.color.dynamic.accent};
|
|
13
15
|
box-sizing: border-box;
|
|
14
16
|
display: flex;
|
|
15
17
|
height: 100%;
|
|
16
18
|
justify-content: center;
|
|
17
19
|
position: relative;
|
|
18
|
-
|
|
20
|
+
`;
|
|
21
|
+
});
|
|
19
22
|
const Rectangle = styled_components_1.default.div.attrs({
|
|
20
23
|
className: 'src-checkbox-rectangle',
|
|
21
24
|
}) `
|
|
@@ -30,23 +33,28 @@ const Svg = styled_components_1.default.svg.attrs({
|
|
|
30
33
|
children: react_1.default.createElement("path", { d: "M3.5,17.2l7.6,7.6L28.5,7.3" }),
|
|
31
34
|
className: 'src-checkbox-svg',
|
|
32
35
|
viewBox: '0 0 32 32',
|
|
33
|
-
})(({ theme }) =>
|
|
36
|
+
})(({ theme, palette }) => {
|
|
37
|
+
var _a, _b, _c;
|
|
38
|
+
return `
|
|
34
39
|
flex: 0 0 auto;
|
|
35
40
|
position: relative;
|
|
36
41
|
|
|
37
42
|
> path {
|
|
38
43
|
fill: transparent;
|
|
39
|
-
stroke: ${theme.$.color.white};
|
|
44
|
+
stroke: ${(_c = (_b = (_a = theme.$.palette[palette].checkbox) === null || _a === void 0 ? void 0 : _a.active) === null || _b === void 0 ? void 0 : _b.mark) !== null && _c !== void 0 ? _c : theme.$.color.white};
|
|
40
45
|
stroke-width: 4px;
|
|
41
46
|
stroke-dasharray: 36px;
|
|
42
47
|
stroke-dashoffset: 36px;
|
|
43
48
|
transition: stroke-dashoffset 200ms 0s ease-in-out;
|
|
44
49
|
}
|
|
45
|
-
|
|
50
|
+
`;
|
|
51
|
+
});
|
|
46
52
|
const IndeterminateMark = styled_components_1.default.div.attrs({
|
|
47
53
|
className: 'src-checkbox-indeterminate-mark',
|
|
48
|
-
})(({ theme }) =>
|
|
49
|
-
|
|
54
|
+
})(({ theme, palette }) => {
|
|
55
|
+
var _a, _b, _c;
|
|
56
|
+
return `
|
|
57
|
+
background: ${(_c = (_b = (_a = theme.$.palette[palette].checkbox) === null || _a === void 0 ? void 0 : _a.active) === null || _b === void 0 ? void 0 : _b.mark) !== null && _c !== void 0 ? _c : theme.$.color.white};
|
|
50
58
|
height: 2px;
|
|
51
59
|
margin-top: -1px;
|
|
52
60
|
opacity: 0;
|
|
@@ -57,19 +65,22 @@ const IndeterminateMark = styled_components_1.default.div.attrs({
|
|
|
57
65
|
transition-timing-function: ease-in-out;
|
|
58
66
|
top: 50%;
|
|
59
67
|
width: 100%;
|
|
60
|
-
|
|
61
|
-
|
|
68
|
+
`;
|
|
69
|
+
});
|
|
70
|
+
exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ children, isIndeterminate, palette }) => ({
|
|
62
71
|
children: (react_1.default.createElement(react_1.default.Fragment, null,
|
|
63
72
|
children && children,
|
|
64
|
-
react_1.default.createElement(Container,
|
|
73
|
+
react_1.default.createElement(Container, { palette: palette },
|
|
65
74
|
react_1.default.createElement(Rectangle, null),
|
|
66
|
-
react_1.default.createElement(Svg,
|
|
67
|
-
typeof isIndeterminate !== 'undefined' && react_1.default.createElement(IndeterminateMark,
|
|
75
|
+
react_1.default.createElement(Svg, { palette: palette }),
|
|
76
|
+
typeof isIndeterminate !== 'undefined' && react_1.default.createElement(IndeterminateMark, { palette: palette })))),
|
|
68
77
|
getCheckboxSize: (v, t) => `
|
|
69
78
|
height: ${t.$.size.checkbox[v]};
|
|
70
79
|
width: ${t.$.size.checkbox[v]};
|
|
71
80
|
`,
|
|
72
|
-
}))(({ theme, isChecked, isIndeterminate, isOutline, isSoft, palette, shape }) =>
|
|
81
|
+
}))(({ theme, isChecked, isIndeterminate, isOutline, isSoft, palette, shape }) => {
|
|
82
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
83
|
+
return `
|
|
73
84
|
position: relative;
|
|
74
85
|
|
|
75
86
|
.src-checkbox-container {
|
|
@@ -77,10 +88,10 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ child
|
|
|
77
88
|
transition: border-color 200ms 0s ease-in-out;
|
|
78
89
|
|
|
79
90
|
${!isOutline
|
|
80
|
-
|
|
81
|
-
background: ${theme.$.color.dynamic.accent};
|
|
91
|
+
? `
|
|
92
|
+
background: ${(_b = (_a = theme.$.palette[palette].checkbox) === null || _a === void 0 ? void 0 : _a.background) !== null && _b !== void 0 ? _b : theme.$.color.dynamic.accent};
|
|
82
93
|
`
|
|
83
|
-
|
|
94
|
+
: ''}
|
|
84
95
|
}
|
|
85
96
|
|
|
86
97
|
.src-checkbox-rectangle {
|
|
@@ -88,21 +99,21 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ child
|
|
|
88
99
|
}
|
|
89
100
|
|
|
90
101
|
${isChecked
|
|
91
|
-
|
|
102
|
+
? `
|
|
92
103
|
.src-checkbox-container {
|
|
93
|
-
border-color: ${!isSoft ? theme.$.palette[palette].main : theme.$.palette[palette].soft};
|
|
104
|
+
border-color: ${!isSoft ? ((_e = (_d = (_c = theme.$.palette[palette].checkbox) === null || _c === void 0 ? void 0 : _c.active) === null || _d === void 0 ? void 0 : _d.border) !== null && _e !== void 0 ? _e : theme.$.palette[palette].main) : ((_j = (_h = (_g = (_f = theme.$.palette[palette].checkbox) === null || _f === void 0 ? void 0 : _f.soft) === null || _g === void 0 ? void 0 : _g.active) === null || _h === void 0 ? void 0 : _h.border) !== null && _j !== void 0 ? _j : theme.$.palette[palette].soft)};
|
|
94
105
|
|
|
95
106
|
.src-checkbox-rectangle {
|
|
96
|
-
background: ${!isSoft ? theme.$.palette[palette].main : theme.$.palette[palette].soft};
|
|
107
|
+
background: ${!isSoft ? ((_m = (_l = (_k = theme.$.palette[palette].checkbox) === null || _k === void 0 ? void 0 : _k.active) === null || _l === void 0 ? void 0 : _l.background) !== null && _m !== void 0 ? _m : theme.$.palette[palette].main) : ((_r = (_q = (_p = (_o = theme.$.palette[palette].checkbox) === null || _o === void 0 ? void 0 : _o.soft) === null || _p === void 0 ? void 0 : _p.active) === null || _q === void 0 ? void 0 : _q.background) !== null && _r !== void 0 ? _r : theme.$.palette[palette].soft)};
|
|
97
108
|
}
|
|
98
109
|
|
|
99
110
|
${!isIndeterminate
|
|
100
|
-
|
|
111
|
+
? `
|
|
101
112
|
.src-checkbox-svg > path {
|
|
102
113
|
stroke-dashoffset: 0;
|
|
103
114
|
}
|
|
104
115
|
`
|
|
105
|
-
|
|
116
|
+
: `
|
|
106
117
|
.src-checkbox-indeterminate-mark {
|
|
107
118
|
opacity: 1;
|
|
108
119
|
transform: scaleX(1);
|
|
@@ -110,5 +121,6 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ child
|
|
|
110
121
|
`}
|
|
111
122
|
}
|
|
112
123
|
`
|
|
113
|
-
|
|
114
|
-
|
|
124
|
+
: ''}
|
|
125
|
+
`;
|
|
126
|
+
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { StyledProps } from '@smart-react-components/core/styled-props';
|
|
2
|
-
import { ResponsiveProp, SizeProp } from '@smart-react-components/core/types';
|
|
2
|
+
import { PaletteProp, ResponsiveProp, SizeProp } from '@smart-react-components/core/types';
|
|
3
3
|
import { OrderPosition } from '../../types';
|
|
4
4
|
interface Props extends StyledProps, ResponsiveProp<'formSize', SizeProp> {
|
|
5
5
|
isBlock: boolean;
|
|
6
6
|
isDisabled: boolean;
|
|
7
7
|
labelPosition: OrderPosition;
|
|
8
|
+
palette: PaletteProp;
|
|
8
9
|
}
|
|
9
10
|
declare const _default: import("styled-components").StyledComponent<"label", any, StyledProps & Props, never>;
|
|
10
11
|
export default _default;
|
|
@@ -24,7 +24,9 @@ exports.default = (0, styled_components_1.default)(Label_1.default).attrs(({ isB
|
|
|
24
24
|
margin-${types_1.OrderPosition[(0, props_1.getReverseOrderPosition)(labelPosition)].toLowerCase()}: ${(0, css_1.toCSSValue)(t.$.size.form.inlineLabel[v].margin.x)(form_1.calculateFormLabelMarginX)};
|
|
25
25
|
}
|
|
26
26
|
`,
|
|
27
|
-
}))(({ theme, isBlock, isDisabled, labelPosition }) =>
|
|
27
|
+
}))(({ theme, palette, isBlock, isDisabled, labelPosition }) => {
|
|
28
|
+
var _a, _b, _c;
|
|
29
|
+
return `
|
|
28
30
|
align-items: center;
|
|
29
31
|
cursor: ${theme.$.cursor.formInlineLabel};
|
|
30
32
|
display: ${isBlock ? 'flex' : 'inline-flex'};
|
|
@@ -36,7 +38,7 @@ exports.default = (0, styled_components_1.default)(Label_1.default).attrs(({ isB
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
> span {
|
|
39
|
-
color: ${theme.$.color.dynamic.bodyFont};
|
|
41
|
+
color: ${(_c = (_b = (_a = theme.$.palette[palette].form) === null || _a === void 0 ? void 0 : _a.inlineLabel) === null || _b === void 0 ? void 0 : _b.font) !== null && _c !== void 0 ? _c : theme.$.color.dynamic.bodyFont};
|
|
40
42
|
display: inline-flex;
|
|
41
43
|
flex: 1 1 auto;
|
|
42
44
|
font-family: ${theme.$.fontFamily.form};
|
|
@@ -46,14 +48,14 @@ exports.default = (0, styled_components_1.default)(Label_1.default).attrs(({ isB
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
${isDisabled
|
|
49
|
-
|
|
51
|
+
? `
|
|
50
52
|
opacity: ${theme.$.opacity.formDisabled};
|
|
51
53
|
pointer-events: none;
|
|
52
54
|
`
|
|
53
|
-
|
|
55
|
+
: ''}
|
|
54
56
|
|
|
55
57
|
${labelPosition === types_1.OrderPosition.LEFT
|
|
56
|
-
|
|
58
|
+
? `
|
|
57
59
|
> span {
|
|
58
60
|
order: 1;
|
|
59
61
|
}
|
|
@@ -62,5 +64,6 @@ exports.default = (0, styled_components_1.default)(Label_1.default).attrs(({ isB
|
|
|
62
64
|
order: 2;
|
|
63
65
|
}
|
|
64
66
|
`
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
: ''}
|
|
68
|
+
`;
|
|
69
|
+
});
|
|
@@ -10,15 +10,18 @@ const css_1 = require("../../util/css");
|
|
|
10
10
|
const radio_1 = require("../../util/radio");
|
|
11
11
|
const Container = styled_components_1.default.div.attrs({
|
|
12
12
|
className: 'src-radio-container',
|
|
13
|
-
})(({ theme }) =>
|
|
13
|
+
})(({ theme, palette }) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
return `
|
|
14
16
|
align-items: center;
|
|
15
|
-
border: solid 2px ${theme.$.color.dynamic.accent};
|
|
17
|
+
border: solid 2px ${(_b = (_a = theme.$.palette[palette].radio) === null || _a === void 0 ? void 0 : _a.border) !== null && _b !== void 0 ? _b : theme.$.color.dynamic.accent};
|
|
16
18
|
border-radius: 100%;
|
|
17
19
|
box-sizing: border-box;
|
|
18
20
|
display: flex;
|
|
19
21
|
justify-content: center;
|
|
20
22
|
height: 100%;
|
|
21
|
-
|
|
23
|
+
`;
|
|
24
|
+
});
|
|
22
25
|
const OuterCircle = styled_components_1.default.div.attrs({
|
|
23
26
|
className: 'src-radio-outer-circle',
|
|
24
27
|
}) `
|
|
@@ -33,17 +36,20 @@ const OuterCircle = styled_components_1.default.div.attrs({
|
|
|
33
36
|
`;
|
|
34
37
|
const InnerCircle = styled_components_1.default.div.attrs({
|
|
35
38
|
className: 'src-radio-inner-circle',
|
|
36
|
-
})(({ theme }) =>
|
|
37
|
-
|
|
39
|
+
})(({ theme, palette }) => {
|
|
40
|
+
var _a, _b, _c;
|
|
41
|
+
return `
|
|
42
|
+
background: ${(_c = (_b = (_a = theme.$.palette[palette].radio) === null || _a === void 0 ? void 0 : _a.active) === null || _b === void 0 ? void 0 : _b.mark) !== null && _c !== void 0 ? _c : theme.$.color.white};
|
|
38
43
|
border-radius: 100%;
|
|
39
44
|
flex: 0 0 auto;
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
`;
|
|
46
|
+
});
|
|
47
|
+
exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ children, palette }) => ({
|
|
42
48
|
children: (react_1.default.createElement(react_1.default.Fragment, null,
|
|
43
49
|
children && children,
|
|
44
|
-
react_1.default.createElement(Container,
|
|
50
|
+
react_1.default.createElement(Container, { palette: palette },
|
|
45
51
|
react_1.default.createElement(OuterCircle, null,
|
|
46
|
-
react_1.default.createElement(InnerCircle,
|
|
52
|
+
react_1.default.createElement(InnerCircle, { palette: palette }))))),
|
|
47
53
|
getRadioSize: (v, t) => `
|
|
48
54
|
height: ${t.$.size.radio[v]};
|
|
49
55
|
width: ${t.$.size.radio[v]};
|
|
@@ -53,28 +59,31 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ child
|
|
|
53
59
|
width: ${(0, css_1.toCSSValue)(t.$.size.radio[v])(v => (0, radio_1.calculateRadioInnerCircleSize)(v))};
|
|
54
60
|
}
|
|
55
61
|
`,
|
|
56
|
-
}))(({ theme, isChecked, isOutline, isSoft, palette }) =>
|
|
62
|
+
}))(({ theme, isChecked, isOutline, isSoft, palette }) => {
|
|
63
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
64
|
+
return `
|
|
57
65
|
position: relative;
|
|
58
66
|
|
|
59
67
|
${!isOutline
|
|
60
|
-
|
|
68
|
+
? `
|
|
61
69
|
.src-radio-container {
|
|
62
|
-
background: ${theme.$.color.dynamic.accent};
|
|
70
|
+
background: ${(_b = (_a = theme.$.palette[palette].radio) === null || _a === void 0 ? void 0 : _a.background) !== null && _b !== void 0 ? _b : theme.$.color.dynamic.accent};
|
|
63
71
|
}
|
|
64
72
|
`
|
|
65
|
-
|
|
73
|
+
: ''}
|
|
66
74
|
|
|
67
75
|
.src-radio-outer-circle {
|
|
68
|
-
background: ${!isSoft ? theme.$.palette[palette].main : theme.$.palette[palette].soft};
|
|
76
|
+
background: ${!isSoft ? ((_e = (_d = (_c = theme.$.palette[palette].radio) === null || _c === void 0 ? void 0 : _c.active) === null || _d === void 0 ? void 0 : _d.background) !== null && _e !== void 0 ? _e : theme.$.palette[palette].main) : ((_j = (_h = (_g = (_f = theme.$.palette[palette].radio) === null || _f === void 0 ? void 0 : _f.soft) === null || _g === void 0 ? void 0 : _g.active) === null || _h === void 0 ? void 0 : _h.background) !== null && _j !== void 0 ? _j : theme.$.palette[palette].soft)};
|
|
69
77
|
|
|
70
78
|
${!isChecked
|
|
71
|
-
|
|
79
|
+
? `
|
|
72
80
|
height: 0;
|
|
73
81
|
width: 0;
|
|
74
82
|
`
|
|
75
|
-
|
|
83
|
+
: `
|
|
76
84
|
height: calc(100% + 4px);
|
|
77
85
|
width: calc(100% + 4px);
|
|
78
86
|
`}
|
|
79
87
|
}
|
|
80
|
-
|
|
88
|
+
`;
|
|
89
|
+
});
|
|
@@ -9,8 +9,10 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
9
9
|
const css_1 = require("../../util/css");
|
|
10
10
|
const Slider = styled_components_1.default.div.attrs({
|
|
11
11
|
className: 'switch-slider',
|
|
12
|
-
})(({ theme }) =>
|
|
13
|
-
|
|
12
|
+
})(({ theme, palette }) => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
return `
|
|
15
|
+
background: ${(_b = (_a = theme.$.palette[palette].slider) === null || _a === void 0 ? void 0 : _a.mark) !== null && _b !== void 0 ? _b : theme.$.color.white};
|
|
14
16
|
border-radius: 100%;
|
|
15
17
|
box-shadow: 0 1px 3px rgba(0,0,0,.4);
|
|
16
18
|
left: 0;
|
|
@@ -18,11 +20,12 @@ const Slider = styled_components_1.default.div.attrs({
|
|
|
18
20
|
top: 0;
|
|
19
21
|
transition: 200ms 0s ease-in-out;
|
|
20
22
|
transition-property: left, right;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
`;
|
|
24
|
+
});
|
|
25
|
+
exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ children, isChecked, palette }) => ({
|
|
23
26
|
children: (react_1.default.createElement(react_1.default.Fragment, null,
|
|
24
27
|
children,
|
|
25
|
-
react_1.default.createElement(Slider,
|
|
28
|
+
react_1.default.createElement(Slider, { palette: palette }))),
|
|
26
29
|
getCheckboxSize: (v, t) => `
|
|
27
30
|
height: ${t.$.size.switch[v].height};
|
|
28
31
|
width: ${t.$.size.switch[v].width};
|
|
@@ -38,7 +41,9 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ child
|
|
|
38
41
|
: ''}
|
|
39
42
|
}
|
|
40
43
|
`,
|
|
41
|
-
}))(({ theme, isChecked, isOutline, isSoft, palette }) =>
|
|
44
|
+
}))(({ theme, isChecked, isOutline, isSoft, palette }) => {
|
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
46
|
+
return `
|
|
42
47
|
border: solid 1px ${theme.$.color.dynamic.accent};
|
|
43
48
|
border-radius: 20px;
|
|
44
49
|
box-sizing: border-box;
|
|
@@ -47,27 +52,28 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ child
|
|
|
47
52
|
transition-property: border, box-shadow;
|
|
48
53
|
|
|
49
54
|
${!isOutline
|
|
50
|
-
|
|
51
|
-
background: ${theme.$.color.dynamic.accent};
|
|
52
|
-
box-shadow: ${theme.$.color.dynamic.accent} 0 0 0 0 inset;
|
|
55
|
+
? `
|
|
56
|
+
background: ${(_b = (_a = theme.$.palette[palette].switch) === null || _a === void 0 ? void 0 : _a.background) !== null && _b !== void 0 ? _b : theme.$.color.dynamic.accent};
|
|
57
|
+
box-shadow: ${(_d = (_c = theme.$.palette[palette].switch) === null || _c === void 0 ? void 0 : _c.background) !== null && _d !== void 0 ? _d : theme.$.color.dynamic.accent} 0 0 0 0 inset;
|
|
53
58
|
`
|
|
54
|
-
|
|
59
|
+
: ''}
|
|
55
60
|
|
|
56
61
|
${isChecked
|
|
57
|
-
|
|
62
|
+
? `
|
|
58
63
|
transition: border 400ms 0s ease-in-out, box-shadow 400ms 0s ease-in-out, background 0s 400ms ease-in-out;
|
|
59
64
|
|
|
60
65
|
${!isSoft
|
|
61
|
-
|
|
62
|
-
background: ${theme.$.palette[palette].main};
|
|
63
|
-
border-color: ${theme.$.palette[palette].main};
|
|
64
|
-
box-shadow: ${theme.$.palette[palette].main} 0 0 0 11px inset;
|
|
66
|
+
? `
|
|
67
|
+
background: ${(_g = (_f = (_e = theme.$.palette[palette].switch) === null || _e === void 0 ? void 0 : _e.active) === null || _f === void 0 ? void 0 : _f.background) !== null && _g !== void 0 ? _g : theme.$.palette[palette].main};
|
|
68
|
+
border-color: ${(_k = (_j = (_h = theme.$.palette[palette].switch) === null || _h === void 0 ? void 0 : _h.active) === null || _j === void 0 ? void 0 : _j.background) !== null && _k !== void 0 ? _k : theme.$.palette[palette].main};
|
|
69
|
+
box-shadow: ${(_o = (_m = (_l = theme.$.palette[palette].switch) === null || _l === void 0 ? void 0 : _l.active) === null || _m === void 0 ? void 0 : _m.background) !== null && _o !== void 0 ? _o : theme.$.palette[palette].main} 0 0 0 11px inset;
|
|
65
70
|
`
|
|
66
|
-
|
|
67
|
-
background: ${theme.$.palette[palette].soft};
|
|
68
|
-
border-color: ${theme.$.palette[palette].soft};
|
|
69
|
-
box-shadow: ${theme.$.palette[palette].soft} 0 0 0 11px inset;
|
|
71
|
+
: `
|
|
72
|
+
background: ${(_s = (_r = (_q = (_p = theme.$.palette[palette].switch) === null || _p === void 0 ? void 0 : _p.soft) === null || _q === void 0 ? void 0 : _q.active) === null || _r === void 0 ? void 0 : _r.background) !== null && _s !== void 0 ? _s : theme.$.palette[palette].soft};
|
|
73
|
+
border-color: ${(_w = (_v = (_u = (_t = theme.$.palette[palette].switch) === null || _t === void 0 ? void 0 : _t.soft) === null || _u === void 0 ? void 0 : _u.active) === null || _v === void 0 ? void 0 : _v.background) !== null && _w !== void 0 ? _w : theme.$.palette[palette].soft};
|
|
74
|
+
box-shadow: ${(_0 = (_z = (_y = (_x = theme.$.palette[palette].switch) === null || _x === void 0 ? void 0 : _x.soft) === null || _y === void 0 ? void 0 : _y.active) === null || _z === void 0 ? void 0 : _z.background) !== null && _0 !== void 0 ? _0 : theme.$.palette[palette].soft} 0 0 0 11px inset;
|
|
70
75
|
`}
|
|
71
76
|
`
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
: ''}
|
|
78
|
+
`;
|
|
79
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smart-react-components/ui",
|
|
3
|
-
"version": "2.1.0-alpha-
|
|
3
|
+
"version": "2.1.0-alpha-7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"description": "SRC UI includes React and Styled components.",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"test": "jest"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@smart-react-components/core": "2.1.0-alpha-
|
|
68
|
-
"@smart-react-components/router": "2.1.0-alpha-
|
|
69
|
-
"@smart-react-components/transition": "2.1.0-alpha-
|
|
67
|
+
"@smart-react-components/core": "2.1.0-alpha-6",
|
|
68
|
+
"@smart-react-components/router": "2.1.0-alpha-4",
|
|
69
|
+
"@smart-react-components/transition": "2.1.0-alpha-4",
|
|
70
70
|
"@testing-library/react": "13.4.0",
|
|
71
71
|
"@types/jest": "29.0.1",
|
|
72
72
|
"@types/react": "18.0.19",
|
|
@@ -83,9 +83,9 @@
|
|
|
83
83
|
"typescript": "4.8.3"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"@smart-react-components/core": "^2.1.0-alpha-
|
|
87
|
-
"@smart-react-components/router": "^2.1.0-alpha-
|
|
88
|
-
"@smart-react-components/transition": "^2.1.0-alpha-
|
|
86
|
+
"@smart-react-components/core": "^2.1.0-alpha-6",
|
|
87
|
+
"@smart-react-components/router": "^2.1.0-alpha-4",
|
|
88
|
+
"@smart-react-components/transition": "^2.1.0-alpha-4",
|
|
89
89
|
"react": "^18.2.0",
|
|
90
90
|
"react-dom": "^18.2.0",
|
|
91
91
|
"styled-components": "^5.3.5"
|