@pedidopago/ui 1.3.13 → 1.3.16
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/components/Button/styles.js +1 -1
- package/dist/components/ColorPicker/utils/parsers.js +18 -18
- package/dist/components/DatePicker/components/DatePickerContent.d.ts.map +1 -1
- package/dist/components/DatePicker/components/DatePickerContent.js +3 -2
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +7 -6
- package/dist/components/DatePicker/styles.d.ts.map +1 -1
- package/dist/components/DatePicker/styles.js +4 -6
- package/dist/components/Dropzone/utils/accepts.js +8 -8
- package/dist/components/Icon/scripts/build.js +2 -2
- package/dist/components/Icon/scripts/extractor.js +5 -5
- package/dist/components/Icon/scripts/writers.js +9 -9
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.js +1 -4
- package/dist/components/Modal/styles.d.ts +2 -0
- package/dist/components/Modal/styles.d.ts.map +1 -1
- package/dist/components/Modal/styles.js +1 -1
- package/dist/components/MultipleSelect/components/OptionsArea/index.js +10 -10
- package/dist/components/MultipleSelect/components/OptionsArea/{OptionsArea.d.ts → styles.d.ts} +1 -1
- package/dist/components/MultipleSelect/components/OptionsArea/styles.d.ts.map +1 -0
- package/dist/components/MultipleSelect/components/OptionsArea/{OptionsArea.js → styles.js} +0 -0
- package/dist/components/MultipleSelect/components/SelectArea/styles.js +1 -1
- package/dist/components/Rating/components/GradientIcon/scripts/build.js +4 -4
- package/dist/components/Rating/components/GradientIcon/scripts/extractor.js +5 -5
- package/dist/components/Rating/components/GradientIcon/scripts/writers.js +9 -9
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +20 -16
- package/dist/components/Select/styles.d.ts.map +1 -1
- package/dist/components/Select/styles.js +3 -3
- package/dist/components/Select/types.d.ts +3 -1
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/components/Skeleton/styles.d.ts.map +1 -1
- package/dist/components/Skeleton/styles.js +3 -3
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/Switch/index.js +23 -68
- package/dist/components/Switch/styles.d.ts.map +1 -1
- package/dist/components/Switch/styles.js +8 -23
- package/dist/components/Switch/switch.test.js +10 -33
- package/dist/components/Switch/types.d.ts +3 -6
- package/dist/components/Switch/types.d.ts.map +1 -1
- package/dist/shared/hooks/useBreakpoint.js +5 -5
- package/dist/utils/GenerateKey.js +6 -6
- package/dist/utils/brightnessColorChange.js +6 -6
- package/dist/utils/colorCheck.js +24 -24
- package/dist/utils/getColorValue.js +8 -8
- package/dist/utils/invertColor.js +5 -5
- package/package.json +1 -1
- package/dist/components/MultipleSelect/components/OptionsArea/OptionsArea.d.ts.map +0 -1
- package/dist/components/MultipleSelect/components/SelectArea/Label.d.ts +0 -7
- package/dist/components/MultipleSelect/components/SelectArea/Label.d.ts.map +0 -1
- package/dist/components/MultipleSelect/components/SelectArea/Label.js +0 -36
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Skeleton/styles.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIlD,eAAO,MAAM,eAAe;;;+
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Skeleton/styles.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIlD,eAAO,MAAM,eAAe;;;+IAmG1B,CAAC"}
|
|
@@ -15,7 +15,7 @@ var _colorCheck = require("../../utils/colorCheck");
|
|
|
15
15
|
|
|
16
16
|
var _invertColor = require("../../utils/invertColor");
|
|
17
17
|
|
|
18
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
18
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
@@ -34,9 +34,9 @@ var SkeletonElement = _styled.default.div(function (props) {
|
|
|
34
34
|
wave: (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n transform-origin: 0px 55%;\n\n &::after {\n content: '';\n inset: 0px;\n position: absolute;\n animation: 1.6s linear 0.5s infinite normal none running move;\n transform: translateX(-100%);\n background: linear-gradient(\n 90deg,\n transparent,\n ", ",\n transparent\n );\n }\n\n @keyframes move {\n 0% {\n transform: translateX(-100%);\n }\n 40% {\n transform: translateX(100%);\n }\n 100% {\n transform: translateX(100%);\n }\n }\n "])), (0, _colorCheck.parseHexColorToRgba)(waveColor, waveColorOpacity)),
|
|
35
35
|
pulse: (0, _react.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n animation: 1.6s linear 0.5s infinite normal none running pulse;\n\n @keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.4;\n }\n 100% {\n opacity: 1;\n }\n }\n "])))
|
|
36
36
|
};
|
|
37
|
-
var unloadedCss = (0, _react.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: block;\n position: relative;\n user-select: none;\n pointer-events: none;\n cursor: default;\n background: padding-box ", ";\n border-radius: ", ";\n
|
|
37
|
+
var unloadedCss = (0, _react.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: block;\n position: relative;\n user-select: none;\n pointer-events: none;\n cursor: default;\n background: padding-box ", ";\n border-radius: ", ";\n height: ", ";\n color: transparent;\n\n ", ";\n\n * {\n visibility: hidden;\n color: transparent;\n }\n "])), skeletonColor, borderRadiusByVariant[props.variant || 'text'], typeof props.height === 'number' ? props.height + 'px' : props.height || '', props.animation !== 'static' ? animationsCss[props.animation || 'wave'] : '');
|
|
38
38
|
var loadedCss = (0, _react.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: block;\n background: transparent;\n\n transition: all 300ms ease;\n "])));
|
|
39
|
-
return props.isLoaded ? loadedCss : unloadedCss;
|
|
39
|
+
return (0, _react.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n width: ", ";\n\n ", "\n "])), props.fullWidth ? '100%' : typeof props.width === 'number' ? props.width + 'px' : props.width || '', props.isLoaded ? loadedCss : unloadedCss);
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
exports.SkeletonElement = SkeletonElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,EAAE,EAAkD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,EAAE,EAAkD,MAAM,OAAO,CAAC;AAKrF,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,WAAW,CAgDhC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -7,10 +7,10 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
-
var _styles = require("./styles");
|
|
11
|
-
|
|
12
10
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
13
11
|
|
|
12
|
+
var _styles = require("./styles");
|
|
13
|
+
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -28,83 +28,38 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
28
28
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
29
|
|
|
30
30
|
var SwitchInput = function SwitchInput(_ref) {
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
_ref$alert = _ref.alert,
|
|
35
|
-
alert = _ref$alert === void 0 ? false : _ref$alert,
|
|
36
|
-
SwitchType = _ref.SwitchType,
|
|
31
|
+
var disabled = _ref.disabled,
|
|
32
|
+
helperText = _ref.helperText,
|
|
33
|
+
type = _ref.type,
|
|
37
34
|
onChangeValue = _ref.onChangeValue,
|
|
38
|
-
_ref$defaultValue = _ref.defaultValue,
|
|
39
|
-
defaultValue = _ref$defaultValue === void 0 ? false : _ref$defaultValue,
|
|
40
35
|
_ref$checked = _ref.checked,
|
|
41
|
-
checked = _ref$checked === void 0 ? false : _ref$checked
|
|
42
|
-
onError = _ref.onError;
|
|
36
|
+
checked = _ref$checked === void 0 ? false : _ref$checked;
|
|
43
37
|
|
|
44
|
-
var _useState = (0, _react.useState)(
|
|
38
|
+
var _useState = (0, _react.useState)(checked),
|
|
45
39
|
_useState2 = _slicedToArray(_useState, 2),
|
|
46
40
|
isActive = _useState2[0],
|
|
47
41
|
setIsActive = _useState2[1];
|
|
48
42
|
|
|
49
43
|
(0, _react.useEffect)(function () {
|
|
50
|
-
|
|
44
|
+
setIsActive(checked);
|
|
51
45
|
}, [checked]);
|
|
52
|
-
(0, _react.useEffect)(function () {
|
|
53
|
-
!!defaultValue && setIsActive(defaultValue);
|
|
54
|
-
}, [defaultValue]);
|
|
55
|
-
(0, _react.useEffect)(function () {
|
|
56
|
-
!!onChangeValue && onChangeValue(isActive);
|
|
57
|
-
}, [isActive, onChangeValue]);
|
|
58
|
-
(0, _react.useEffect)(function () {
|
|
59
|
-
if (disabled || alert) {
|
|
60
|
-
setIsActive(false);
|
|
61
|
-
}
|
|
62
|
-
}, [disabled, setIsActive, alert]);
|
|
63
46
|
|
|
64
47
|
function handleOnKeyDown(e) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
switch (e.code) {
|
|
73
|
-
case 'Enter':
|
|
74
|
-
case 'Space':
|
|
75
|
-
setIsActive(function (o) {
|
|
76
|
-
return !o;
|
|
77
|
-
});
|
|
78
|
-
break;
|
|
79
|
-
|
|
80
|
-
case 'ArrowLeft':
|
|
81
|
-
case 'ArrowDown':
|
|
82
|
-
setIsActive(false);
|
|
83
|
-
break;
|
|
84
|
-
|
|
85
|
-
case 'ArrowRight':
|
|
86
|
-
case 'ArrowUp':
|
|
87
|
-
setIsActive(true);
|
|
88
|
-
break;
|
|
89
|
-
|
|
90
|
-
default:
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
48
|
+
switch (e.code) {
|
|
49
|
+
case 'Enter':
|
|
50
|
+
case 'Space':
|
|
51
|
+
return setIsActive(function (o) {
|
|
52
|
+
onChangeValue === null || onChangeValue === void 0 ? void 0 : onChangeValue(!o);
|
|
53
|
+
return !o;
|
|
54
|
+
});
|
|
93
55
|
}
|
|
94
56
|
}
|
|
95
57
|
|
|
96
58
|
function handleOnClick() {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
setIsActive(false);
|
|
102
|
-
!!onError && onError('try click with disabled');
|
|
103
|
-
} else {
|
|
104
|
-
setIsActive(function (o) {
|
|
105
|
-
return !o;
|
|
106
|
-
});
|
|
107
|
-
}
|
|
59
|
+
setIsActive(function (o) {
|
|
60
|
+
onChangeValue === null || onChangeValue === void 0 ? void 0 : onChangeValue(!o);
|
|
61
|
+
return !o;
|
|
62
|
+
});
|
|
108
63
|
}
|
|
109
64
|
|
|
110
65
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.SwitchWrapper, {
|
|
@@ -115,18 +70,18 @@ var SwitchInput = function SwitchInput(_ref) {
|
|
|
115
70
|
onClick: handleOnClick,
|
|
116
71
|
onKeyDown: handleOnKeyDown,
|
|
117
72
|
disabled: disabled,
|
|
118
|
-
isActive:
|
|
73
|
+
isActive: isActive,
|
|
119
74
|
tabIndex: 0,
|
|
120
|
-
|
|
75
|
+
type: type,
|
|
121
76
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SwitchToken, {
|
|
122
77
|
className: "switch-token",
|
|
123
78
|
children: isActive && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
124
79
|
name: "check"
|
|
125
80
|
})
|
|
126
81
|
})
|
|
127
|
-
}),
|
|
82
|
+
}), helperText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.HelpText, {
|
|
128
83
|
disabled: disabled,
|
|
129
|
-
children:
|
|
84
|
+
children: helperText
|
|
130
85
|
})]
|
|
131
86
|
});
|
|
132
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/styles.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,eAAO,MAAM,aAAa;;;uHAOzB,CAAC;AAEF,eAAO,MAAM,MAAM;;;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/styles.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,eAAO,MAAM,aAAa;;;uHAOzB,CAAC;AAEF,eAAO,MAAM,MAAM;;;uHAqBlB,CAAC;AAEF,eAAO,MAAM,WAAW;;;uHAgBvB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;yHAGpB,CAAC"}
|
|
@@ -27,10 +27,7 @@ exports.SwitchWrapper = SwitchWrapper;
|
|
|
27
27
|
var Switch = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n box-sizing: border-box;\n padding: 4px 2px;\n position: relative;\n outline: 0;\n\n width: 40px;\n height: 24px;\n border-radius: 80px;\n cursor: pointer;\n\n border: 2px solid\n ", ";\n\n transition: all ease-in-out 0.2s;\n\n ", "\n\n ", "\n"])), function (_ref2) {
|
|
28
28
|
var theme = _ref2.theme,
|
|
29
29
|
isActive = _ref2.isActive;
|
|
30
|
-
return
|
|
31
|
-
dark: isActive ? theme.colors.body.light : theme.colors.neutral.neutral5,
|
|
32
|
-
light: isActive ? theme.colors.body.light : theme.colors.neutral.neutral2
|
|
33
|
-
}[theme.colorMode];
|
|
30
|
+
return isActive ? theme.colors.body.light : theme.colors.neutral.neutral2;
|
|
34
31
|
}, function (_ref3) {
|
|
35
32
|
var isActive = _ref3.isActive,
|
|
36
33
|
disabled = _ref3.disabled;
|
|
@@ -44,10 +41,7 @@ exports.Switch = Switch;
|
|
|
44
41
|
|
|
45
42
|
var SwitchToken = _styled.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n width: 16px;\n height: 16px;\n border-radius: 80px;\n transition: all ease-in-out 0.2s;\n\n justify-content: center;\n align-items: center;\n\n svg {\n width: 80%;\n height: 80%;\n }\n\n background-color: ", ";\n"])), function (_ref5) {
|
|
46
43
|
var theme = _ref5.theme;
|
|
47
|
-
return
|
|
48
|
-
dark: theme.colors.neutral.neutral2,
|
|
49
|
-
light: theme.colors.neutral.neutral4
|
|
50
|
-
}[theme.colorMode];
|
|
44
|
+
return theme.colors.neutral.neutral4;
|
|
51
45
|
});
|
|
52
46
|
|
|
53
47
|
exports.SwitchToken = SwitchToken;
|
|
@@ -68,25 +62,16 @@ function SwitchEffects(_ref7) {
|
|
|
68
62
|
|
|
69
63
|
function ActiveEffects(_ref8) {
|
|
70
64
|
var theme = _ref8.theme,
|
|
71
|
-
|
|
65
|
+
type = _ref8.type;
|
|
72
66
|
if (!theme) return '';
|
|
73
|
-
var idleColor =
|
|
74
|
-
var hoverColor =
|
|
75
|
-
var focusColor =
|
|
76
|
-
return (0, _react.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n border-color: ", ";\n background-color: ", ";\n div.switch-token {\n transform: translateX(16px);\n background-color: ", ";\n }\n svg {\n color: ", ";\n }\n\n :hover {\n background-color: ", ";\n border-color: ", ";\n\n svg {\n color: ", ";\n }\n }\n\n :focus {\n background-color: ", ";\n border-color: ", ";\n box-shadow: 0 0 0 2px
|
|
67
|
+
var idleColor = type ? theme.colors[type].default : theme.colors.primary.default;
|
|
68
|
+
var hoverColor = type ? (0, _colorFunctions.hoverFunction)(theme.colors[type].default) : theme.colors.primary.hover;
|
|
69
|
+
var focusColor = type ? (0, _colorFunctions.focusFunction)(theme.colors[type].default) : theme.colors.primary.focus;
|
|
70
|
+
return (0, _react.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n border-color: ", ";\n background-color: ", ";\n div.switch-token {\n transform: translateX(16px);\n background-color: ", ";\n }\n svg {\n color: ", ";\n }\n\n :hover {\n background-color: ", ";\n border-color: ", ";\n\n svg {\n color: ", ";\n }\n }\n\n :focus {\n background-color: ", ";\n border-color: ", ";\n box-shadow: 0 0 0 2px ", ";\n\n svg {\n color: ", ";\n }\n }\n "])), idleColor, idleColor, theme.colors.body.light, idleColor, hoverColor, hoverColor, hoverColor, focusColor, focusColor, type ? theme.colors[type].blurred : theme.colors.primary.disabled, focusColor);
|
|
77
71
|
}
|
|
78
72
|
|
|
79
73
|
function disabledStyle(_ref9) {
|
|
80
74
|
var theme = _ref9.theme;
|
|
81
75
|
if (!theme) return '';
|
|
82
|
-
return (0, _react.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n border-color: ", ";\n\n background-color: ", ";\n\n div {\n background-color: ", ";\n }\n "])),
|
|
83
|
-
dark: theme.colors.neutral.neutral4,
|
|
84
|
-
light: theme.colors.neutral.neutral2
|
|
85
|
-
}[theme.colorMode], {
|
|
86
|
-
dark: theme.colors.neutral.neutral5,
|
|
87
|
-
light: theme.colors.neutral.neutral1
|
|
88
|
-
}[theme.colorMode], {
|
|
89
|
-
dark: theme.colors.neutral.neutral3,
|
|
90
|
-
light: theme.colors.neutral.neutral2
|
|
91
|
-
}[theme.colorMode]);
|
|
76
|
+
return (0, _react.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n border-color: ", ";\n\n background-color: ", ";\n\n div {\n background-color: ", ";\n }\n "])), theme.colors.neutral.neutral2, theme.colors.neutral.neutral1, theme.colors.neutral.neutral2);
|
|
92
77
|
}
|
|
@@ -52,9 +52,7 @@ describe('Switch', function () {
|
|
|
52
52
|
var onError = jest.fn();
|
|
53
53
|
|
|
54
54
|
var _setup3 = setup({
|
|
55
|
-
onChangeValue: onChangeValue
|
|
56
|
-
onError: onError,
|
|
57
|
-
alert: true
|
|
55
|
+
onChangeValue: onChangeValue
|
|
58
56
|
}),
|
|
59
57
|
SwitchElement = _setup3.SwitchElement;
|
|
60
58
|
|
|
@@ -188,9 +186,7 @@ describe('Switch', function () {
|
|
|
188
186
|
var keysToTest = ['Enter', 'Space'];
|
|
189
187
|
|
|
190
188
|
var _setup8 = setup({
|
|
191
|
-
onChangeValue: onChangeValue
|
|
192
|
-
alert: true,
|
|
193
|
-
onError: onError
|
|
189
|
+
onChangeValue: onChangeValue
|
|
194
190
|
}),
|
|
195
191
|
SwitchElement = _setup8.SwitchElement;
|
|
196
192
|
|
|
@@ -209,8 +205,7 @@ describe('Switch', function () {
|
|
|
209
205
|
|
|
210
206
|
var _setup9 = setup({
|
|
211
207
|
onChangeValue: onChangeValue,
|
|
212
|
-
disabled: true
|
|
213
|
-
onError: onError
|
|
208
|
+
disabled: true
|
|
214
209
|
}),
|
|
215
210
|
SwitchElement = _setup9.SwitchElement;
|
|
216
211
|
|
|
@@ -227,48 +222,30 @@ describe('Switch', function () {
|
|
|
227
222
|
expect(onError).toBeCalledWith('try click with disabled');
|
|
228
223
|
});
|
|
229
224
|
it('Should render the HelpText', function () {
|
|
230
|
-
var
|
|
225
|
+
var helperText = 'Quer batata no almoço?';
|
|
231
226
|
|
|
232
227
|
var _setup10 = setup({
|
|
233
|
-
|
|
228
|
+
helperText: helperText
|
|
234
229
|
}),
|
|
235
230
|
SwitchWrapper = _setup10.SwitchWrapper;
|
|
236
231
|
|
|
237
232
|
var helpTextElement = SwitchWrapper.querySelector('span');
|
|
238
|
-
expect(helpTextElement === null || helpTextElement === void 0 ? void 0 : helpTextElement.innerHTML).toEqual(
|
|
239
|
-
});
|
|
240
|
-
it('Should receive a defaultValue state', function () {
|
|
241
|
-
var _setup11 = setup({
|
|
242
|
-
defaultValue: true
|
|
243
|
-
}),
|
|
244
|
-
SwitchElement = _setup11.SwitchElement;
|
|
245
|
-
|
|
246
|
-
var checkedIcon = SwitchElement.querySelector('svg');
|
|
247
|
-
expect(checkedIcon).toBeInTheDocument();
|
|
248
|
-
});
|
|
249
|
-
it('Should receive a false defaultValue state', function () {
|
|
250
|
-
var _setup12 = setup({
|
|
251
|
-
defaultValue: false
|
|
252
|
-
}),
|
|
253
|
-
SwitchElement = _setup12.SwitchElement;
|
|
254
|
-
|
|
255
|
-
var checkedIcon = SwitchElement.querySelector('svg');
|
|
256
|
-
expect(checkedIcon).not.toBeInTheDocument();
|
|
233
|
+
expect(helpTextElement === null || helpTextElement === void 0 ? void 0 : helpTextElement.innerHTML).toEqual(helperText);
|
|
257
234
|
});
|
|
258
235
|
it('Should receive a checked state', function () {
|
|
259
|
-
var
|
|
236
|
+
var _setup11 = setup({
|
|
260
237
|
checked: true
|
|
261
238
|
}),
|
|
262
|
-
SwitchElement =
|
|
239
|
+
SwitchElement = _setup11.SwitchElement;
|
|
263
240
|
|
|
264
241
|
var checkedIcon = SwitchElement.querySelector('svg');
|
|
265
242
|
expect(checkedIcon).toBeInTheDocument();
|
|
266
243
|
});
|
|
267
244
|
it('Should receive a false checked state', function () {
|
|
268
|
-
var
|
|
245
|
+
var _setup12 = setup({
|
|
269
246
|
checked: false
|
|
270
247
|
}),
|
|
271
|
-
SwitchElement =
|
|
248
|
+
SwitchElement = _setup12.SwitchElement;
|
|
272
249
|
|
|
273
250
|
var checkedIcon = SwitchElement.querySelector('svg');
|
|
274
251
|
expect(checkedIcon).not.toBeInTheDocument();
|
|
@@ -3,16 +3,13 @@ export declare type IStyleProps = {
|
|
|
3
3
|
theme?: Theme;
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
isActive?: boolean;
|
|
6
|
-
|
|
6
|
+
type?: 'success' | 'error' | 'warning' | 'informative' | 'critical' | 'success_secondary' | 'warning_secondary';
|
|
7
7
|
};
|
|
8
8
|
export declare type IInputProps = {
|
|
9
9
|
disabled?: boolean;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
SwitchType?: 'success' | 'error' | 'warning' | 'informative' | 'critical' | 'success_secondary' | 'warning_secondary';
|
|
13
|
-
onError?: (error: string) => void;
|
|
10
|
+
helperText?: string;
|
|
11
|
+
type?: 'success' | 'error' | 'warning' | 'informative' | 'critical' | 'success_secondary' | 'warning_secondary';
|
|
14
12
|
onChangeValue?: (value: boolean) => void;
|
|
15
|
-
defaultValue?: boolean;
|
|
16
13
|
checked?: boolean;
|
|
17
14
|
};
|
|
18
15
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,oBAAY,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,oBAAY,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EACD,SAAS,GACT,OAAO,GACP,SAAS,GACT,aAAa,GACb,UAAU,GACV,mBAAmB,GACnB,mBAAmB,CAAC;CACzB,CAAC;AAEF,oBAAY,WAAW,GAAG;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EACD,SAAS,GACT,OAAO,GACP,SAAS,GACT,aAAa,GACb,UAAU,GACV,mBAAmB,GACnB,mBAAmB,CAAC;IACxB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC"}
|
|
@@ -21,11 +21,11 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
21
21
|
|
|
22
22
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* Checks if the screen width matches the breakpoint in a certain direction everytime the screen resizes.
|
|
26
|
-
* @param breakpoint The target breakpoint to compare. Can use one of the specified breakpoints or a custom one passing a number.
|
|
27
|
-
* @param direction The direction to compare. "Down" will return true if the screen width is shorter than the breakpoint. "Up" will return true if it's larger.
|
|
28
|
-
* @returns If the screen width matches the breakpoint in a certain direction.
|
|
24
|
+
/**
|
|
25
|
+
* Checks if the screen width matches the breakpoint in a certain direction everytime the screen resizes.
|
|
26
|
+
* @param breakpoint The target breakpoint to compare. Can use one of the specified breakpoints or a custom one passing a number.
|
|
27
|
+
* @param direction The direction to compare. "Down" will return true if the screen width is shorter than the breakpoint. "Up" will return true if it's larger.
|
|
28
|
+
* @returns If the screen width matches the breakpoint in a certain direction.
|
|
29
29
|
*/
|
|
30
30
|
function useBreakpoint(breakpoint) {
|
|
31
31
|
var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'down';
|
|
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.generateKey = generateKey;
|
|
7
7
|
exports.s4 = s4;
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* Generates a random hexadecimal string with length 4.
|
|
11
|
-
* @returns hexadecimal string.
|
|
9
|
+
/**
|
|
10
|
+
* Generates a random hexadecimal string with length 4.
|
|
11
|
+
* @returns hexadecimal string.
|
|
12
12
|
*/
|
|
13
13
|
function s4() {
|
|
14
14
|
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Generates a unique key using Date and pseudo random numbers.
|
|
18
|
-
* @returns A unique key.
|
|
16
|
+
/**
|
|
17
|
+
* Generates a unique key using Date and pseudo random numbers.
|
|
18
|
+
* @returns A unique key.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
|
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.brightnessColorChange = brightnessColorChange;
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Change the brightness of a color
|
|
10
|
-
* @param color : color to change;
|
|
11
|
-
* @param percent : percent of brightness;
|
|
12
|
-
* @returns : new color with changed brightness;
|
|
13
|
-
* @see https://stackoverflow.com/questions/5560248/programmatically-lighten-or-darken-a-hex-color-or-rgb-and-blend-colors
|
|
8
|
+
/**
|
|
9
|
+
* Change the brightness of a color
|
|
10
|
+
* @param color : color to change;
|
|
11
|
+
* @param percent : percent of brightness;
|
|
12
|
+
* @returns : new color with changed brightness;
|
|
13
|
+
* @see https://stackoverflow.com/questions/5560248/programmatically-lighten-or-darken-a-hex-color-or-rgb-and-blend-colors
|
|
14
14
|
*/
|
|
15
15
|
function brightnessColorChange(color, percent) {
|
|
16
16
|
var f = parseInt(color.slice(1), 16);
|
package/dist/utils/colorCheck.js
CHANGED
|
@@ -17,22 +17,22 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
17
17
|
|
|
18
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* Verifies if the provided color is a valid hex color.
|
|
22
|
-
* @param color : color value;
|
|
23
|
-
* @returns : true if color is valid, false otherwise;
|
|
24
|
-
* @see https://stackoverflow.com/questions/8027423/how-to-check-if-a-string-is-a-valid-hex-color-representation/8027444#8027444
|
|
20
|
+
/**
|
|
21
|
+
* Verifies if the provided color is a valid hex color.
|
|
22
|
+
* @param color : color value;
|
|
23
|
+
* @returns : true if color is valid, false otherwise;
|
|
24
|
+
* @see https://stackoverflow.com/questions/8027423/how-to-check-if-a-string-is-a-valid-hex-color-representation/8027444#8027444
|
|
25
25
|
*/
|
|
26
26
|
var isHexColor = function isHexColor(color) {
|
|
27
27
|
var hexColorWithSixLetters = /^#[0-9A-F]{6}$/i;
|
|
28
28
|
var hexColorWithThreeLetters = /^#([0-9A-F]{3}){1,2}$/i;
|
|
29
29
|
return hexColorWithSixLetters.test(color) || hexColorWithThreeLetters.test(color);
|
|
30
30
|
};
|
|
31
|
-
/**
|
|
32
|
-
* Verifies if the provided color is a valid rgb or hsl color.
|
|
33
|
-
* @param color : color value;
|
|
34
|
-
* @returns : true if color is valid, false otherwise;
|
|
35
|
-
* @see https://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion
|
|
31
|
+
/**
|
|
32
|
+
* Verifies if the provided color is a valid rgb or hsl color.
|
|
33
|
+
* @param color : color value;
|
|
34
|
+
* @returns : true if color is valid, false otherwise;
|
|
35
|
+
* @see https://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
38
|
|
|
@@ -42,11 +42,11 @@ var isRgbHslColor = function isRgbHslColor(color) {
|
|
|
42
42
|
var regexModel = /^(rgb|hsl)(a?)[(]\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*(?:,\s*([\d.]+)\s*)?[)]$/;
|
|
43
43
|
return regexModel.test(color);
|
|
44
44
|
};
|
|
45
|
-
/**
|
|
46
|
-
* Verifies if the provided color is a valid theme color and returns the theme color value.
|
|
47
|
-
* @param color : theme color tag value;
|
|
48
|
-
* @param themeColors : theme colors object;
|
|
49
|
-
* @returns : theme color value if color is valid, null otherwise;
|
|
45
|
+
/**
|
|
46
|
+
* Verifies if the provided color is a valid theme color and returns the theme color value.
|
|
47
|
+
* @param color : theme color tag value;
|
|
48
|
+
* @param themeColors : theme colors object;
|
|
49
|
+
* @returns : theme color value if color is valid, null otherwise;
|
|
50
50
|
*/
|
|
51
51
|
|
|
52
52
|
|
|
@@ -65,11 +65,11 @@ var stripThemeColors = function stripThemeColors(color, themeColors) {
|
|
|
65
65
|
|
|
66
66
|
return null;
|
|
67
67
|
};
|
|
68
|
-
/**
|
|
69
|
-
* Convert a hex color to rgba color.
|
|
70
|
-
* @param color : hex color value;
|
|
71
|
-
* @param opacity : opacity value;
|
|
72
|
-
* @returns : rgba color value;
|
|
68
|
+
/**
|
|
69
|
+
* Convert a hex color to rgba color.
|
|
70
|
+
* @param color : hex color value;
|
|
71
|
+
* @param opacity : opacity value;
|
|
72
|
+
* @returns : rgba color value;
|
|
73
73
|
*/
|
|
74
74
|
|
|
75
75
|
|
|
@@ -82,10 +82,10 @@ var parseHexColorToRgba = function parseHexColorToRgba(color, opacity) {
|
|
|
82
82
|
|
|
83
83
|
return 'rgba(0, 0, 0, 0)';
|
|
84
84
|
};
|
|
85
|
-
/**
|
|
86
|
-
* Convert a hsl array color to string
|
|
87
|
-
* @param color : hsl color array;
|
|
88
|
-
* @returns : hsl color value;
|
|
85
|
+
/**
|
|
86
|
+
* Convert a hsl array color to string
|
|
87
|
+
* @param color : hsl color array;
|
|
88
|
+
* @returns : hsl color value;
|
|
89
89
|
*/
|
|
90
90
|
|
|
91
91
|
|
|
@@ -7,14 +7,14 @@ exports.getColorValue = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _colorCheck = require("../utils/colorCheck");
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* This function takes a color string and returns the color value related to the theme or the original color string
|
|
12
|
-
* @param color : color value;
|
|
13
|
-
* @param theme : theme object;
|
|
14
|
-
* @param defaultValue : default value if color is not valid;
|
|
15
|
-
* @returns color value;
|
|
16
|
-
* @example
|
|
17
|
-
* getColorValue('primary.default', props.theme); // returns '#22E0A1'
|
|
10
|
+
/**
|
|
11
|
+
* This function takes a color string and returns the color value related to the theme or the original color string
|
|
12
|
+
* @param color : color value;
|
|
13
|
+
* @param theme : theme object;
|
|
14
|
+
* @param defaultValue : default value if color is not valid;
|
|
15
|
+
* @returns color value;
|
|
16
|
+
* @example
|
|
17
|
+
* getColorValue('primary.default', props.theme); // returns '#22E0A1'
|
|
18
18
|
*/
|
|
19
19
|
var getColorValue = function getColorValue(color, theme, defaultValue) {
|
|
20
20
|
if ((0, _colorCheck.isHexColor)(color) || (0, _colorCheck.isRgbHslColor)(color)) return color;
|
|
@@ -11,11 +11,11 @@ var padZero = function padZero(str) {
|
|
|
11
11
|
var zeros = new Array(len).join('0');
|
|
12
12
|
return (zeros + str).slice(-len);
|
|
13
13
|
};
|
|
14
|
-
/**
|
|
15
|
-
* Invert the provided color or return black or white if the color is darken or lighten
|
|
16
|
-
* @param hex : hex color
|
|
17
|
-
* @param bw : black or white
|
|
18
|
-
* @returns : hex color
|
|
14
|
+
/**
|
|
15
|
+
* Invert the provided color or return black or white if the color is darken or lighten
|
|
16
|
+
* @param hex : hex color
|
|
17
|
+
* @param bw : black or white
|
|
18
|
+
* @returns : hex color
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsArea.d.ts","sourceRoot":"","sources":["../../../../../src/components/MultipleSelect/components/OptionsArea/OptionsArea.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,eAAO,MAAM,kBAAkB;;;uHAwC9B,CAAC;AA+BF,eAAO,MAAM,iBAAiB;;;gIAe7B,CAAC;AAEF,eAAO,MAAM,IAAI;;;yHAGhB,CAAC;AAEF,eAAO,MAAM,UAAU;;;mHAErB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { IStyleProps } from '../../types';
|
|
3
|
-
export declare const Label: import("@emotion/styled").StyledComponent<{
|
|
4
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
5
|
-
as?: import("react").ElementType<any> | undefined;
|
|
6
|
-
} & IStyleProps, import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, {}>;
|
|
7
|
-
//# sourceMappingURL=Label.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../../src/components/MultipleSelect/components/SelectArea/Label.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,eAAO,MAAM,KAAK;;;gIAyBjB,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Label = void 0;
|
|
7
|
-
|
|
8
|
-
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
|
-
|
|
10
|
-
var _react = require("@emotion/react");
|
|
11
|
-
|
|
12
|
-
var _templateObject, _templateObject2;
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
17
|
-
|
|
18
|
-
var Label = _styled.default.label(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n box-sizing: border-box;\n\n color: ", ";\n transition: all ease-in-out 0.2s;\n\n font-weight: ", ";\n font-size: ", ";\n\n padding: 0 8px;\n\n ", ";\n"])), function (_ref) {
|
|
19
|
-
var theme = _ref.theme;
|
|
20
|
-
return {
|
|
21
|
-
dark: theme.colors.neutral.white,
|
|
22
|
-
light: theme.colors.neutral.neutral5
|
|
23
|
-
}[theme.colorMode];
|
|
24
|
-
}, function (_ref2) {
|
|
25
|
-
var theme = _ref2.theme;
|
|
26
|
-
return theme.fontWeight['500'];
|
|
27
|
-
}, function (_ref3) {
|
|
28
|
-
var theme = _ref3.theme;
|
|
29
|
-
return theme.fontSizes.xxs;
|
|
30
|
-
}, function (_ref4) {
|
|
31
|
-
var animate = _ref4.animate,
|
|
32
|
-
theme = _ref4.theme;
|
|
33
|
-
return animate ? (0, _react.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n transform: translate(-12px, -11px) scale(0.8);\n background-color: ", ";\n height: 20px;\n "])), theme.colorMode === 'dark' ? theme.colors.neutral.black : theme.colors.neutral.white) : '';
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
exports.Label = Label;
|