@pedidopago/ui 1.3.10 → 1.3.11
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/DateInput/index.js +9 -9
- package/dist/components/RadioInput/components/ChoiceList/index.d.ts +1 -1
- package/dist/components/RadioInput/components/ChoiceList/index.d.ts.map +1 -1
- package/dist/components/RadioInput/components/ChoiceList/index.js +61 -76
- package/dist/components/RadioInput/index.d.ts.map +1 -1
- package/dist/components/RadioInput/index.js +22 -69
- package/dist/components/RadioInput/radio-input.test.js +44 -98
- package/dist/components/RadioInput/styles.d.ts.map +1 -1
- package/dist/components/RadioInput/styles.js +5 -11
- package/dist/components/RadioInput/types.d.ts +6 -34
- package/dist/components/RadioInput/types.d.ts.map +1 -1
- package/dist/components/Skeleton/index.d.ts.map +1 -1
- package/dist/components/Skeleton/index.js +4 -5
- package/dist/components/Skeleton/styles.d.ts.map +1 -1
- package/dist/components/Skeleton/styles.js +4 -2
- package/dist/components/Slider/index.d.ts.map +1 -1
- package/dist/components/Slider/index.js +3 -0
- package/dist/shared/hooks/useDisableBodyScroll.d.ts.map +1 -1
- package/dist/shared/hooks/useDisableBodyScroll.js +2 -1
- package/package.json +1 -1
|
@@ -121,14 +121,14 @@ function DateInput(_ref) {
|
|
|
121
121
|
value: currentValue ? Array.isArray(currentValue) ? "".concat(currentValue[0].toLocaleDateString(locales, localeOptions), " - ").concat(currentValue[1].toLocaleDateString(locales, localeOptions)) : new Date(currentValue).toLocaleDateString() : '',
|
|
122
122
|
onClick: toggleOptionsAreaView,
|
|
123
123
|
onMouseOver: handleRepositionModal
|
|
124
|
-
}), datePickerOpen && /*#__PURE__*/(0, _jsxRuntime.
|
|
125
|
-
children:
|
|
126
|
-
onClick: function onClick() {
|
|
127
|
-
return setDatePickerOpen(false);
|
|
128
|
-
}
|
|
129
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ReactPortal.ReactPortal, {
|
|
124
|
+
}), datePickerOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
125
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ReactPortal.ReactPortal, {
|
|
130
126
|
wrapperId: "portal-root",
|
|
131
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
127
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Overlay, {
|
|
128
|
+
onClick: function onClick() {
|
|
129
|
+
return setDatePickerOpen(false);
|
|
130
|
+
}
|
|
131
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalWrapper.ModalWrapper, {
|
|
132
132
|
open: datePickerOpen,
|
|
133
133
|
left: "".concat((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.getBoundingClientRect().left, "px"),
|
|
134
134
|
top: Number(positionContainer) < 540 ? "calc(".concat(((_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.getBoundingClientRect().bottom) || 0, "px + 10px)") : "calc(".concat(((_containerRef$current5 = containerRef.current) === null || _containerRef$current5 === void 0 ? void 0 : _containerRef$current5.getBoundingClientRect().top) || 0, "px - ", 360, "px)"),
|
|
@@ -140,8 +140,8 @@ function DateInput(_ref) {
|
|
|
140
140
|
minDate: minDate,
|
|
141
141
|
maxDate: maxDate
|
|
142
142
|
}, rest))
|
|
143
|
-
})
|
|
144
|
-
})
|
|
143
|
+
})]
|
|
144
|
+
})
|
|
145
145
|
})]
|
|
146
146
|
});
|
|
147
147
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ChoiceListContext, ChoiceListProps } from '../../types';
|
|
3
3
|
export declare const RadioGroup: import("react").Context<ChoiceListContext>;
|
|
4
4
|
declare const ChoiceList: FC<ChoiceListProps>;
|
|
5
5
|
export default ChoiceList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/RadioInput/components/ChoiceList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/RadioInput/components/ChoiceList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,EAAE,EAAsD,MAAM,OAAO,CAAC;AAE9F,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEjE,eAAO,MAAM,UAAU,4CAA4D,CAAC;AAEpF,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CA2DnC,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
|
@@ -7,104 +7,89 @@ exports.default = exports.RadioGroup = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
-
var _react2 = require("@emotion/react");
|
|
11
|
-
|
|
12
|
-
var _theme = require("../../../../shared/theme");
|
|
13
|
-
|
|
14
|
-
var _colorToGray = require("../../../../utils/colorToGray");
|
|
15
|
-
|
|
16
|
-
var _getColorsProps = require("../../utils/get-colors-props");
|
|
17
|
-
|
|
18
10
|
var _styles = require("../../styles");
|
|
19
11
|
|
|
20
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
13
|
|
|
22
|
-
|
|
14
|
+
var _excluded = ["children", "radiosName", "isDisabled", "alignDirection", "label", "helpText", "onChangeValue"];
|
|
23
15
|
|
|
24
|
-
function
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
17
|
|
|
26
|
-
function
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
27
19
|
|
|
28
|
-
function
|
|
20
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
29
21
|
|
|
30
|
-
function
|
|
22
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
31
23
|
|
|
32
|
-
function
|
|
24
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
33
25
|
|
|
34
26
|
var RadioGroup = /*#__PURE__*/(0, _react.createContext)({});
|
|
35
27
|
exports.RadioGroup = RadioGroup;
|
|
36
|
-
|
|
37
|
-
var ChoiceList = function ChoiceList(_ref) {
|
|
28
|
+
var ChoiceList = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
38
29
|
var children = _ref.children,
|
|
39
|
-
|
|
40
|
-
defaultValue = _ref.defaultValue,
|
|
30
|
+
radiosName = _ref.radiosName,
|
|
41
31
|
isDisabled = _ref.isDisabled,
|
|
42
|
-
value = _ref.value,
|
|
43
|
-
color = _ref.color,
|
|
44
32
|
_ref$alignDirection = _ref.alignDirection,
|
|
45
33
|
alignDirection = _ref$alignDirection === void 0 ? 'column' : _ref$alignDirection,
|
|
46
34
|
label = _ref.label,
|
|
47
35
|
helpText = _ref.helpText,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var colors = (0, _getColorsProps.getColorsProps)(neutral2[0]);
|
|
66
|
-
return colors;
|
|
67
|
-
}, [color]);
|
|
68
|
-
|
|
69
|
-
var isRadioSelected = function isRadioSelected(value) {
|
|
70
|
-
return selectedRadioBtn === value;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
var handleRadioClick = function handleRadioClick(e) {
|
|
74
|
-
setSelectedRadioBtn(e.currentTarget.value);
|
|
75
|
-
onChange(e.currentTarget.value);
|
|
36
|
+
onChangeValue = _ref.onChangeValue,
|
|
37
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
38
|
+
|
|
39
|
+
var handleRadioClick = function handleRadioClick(value) {
|
|
40
|
+
if (radioRef.current) {
|
|
41
|
+
var _nativeInputValueSett;
|
|
42
|
+
|
|
43
|
+
var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value');
|
|
44
|
+
nativeInputValueSetter === null || nativeInputValueSetter === void 0 ? void 0 : (_nativeInputValueSett = nativeInputValueSetter.set) === null || _nativeInputValueSett === void 0 ? void 0 : _nativeInputValueSett.call(radioRef.current, value);
|
|
45
|
+
var event = new Event('input', {
|
|
46
|
+
bubbles: true
|
|
47
|
+
});
|
|
48
|
+
radioRef.current.dispatchEvent(event);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
onChangeValue === null || onChangeValue === void 0 ? void 0 : onChangeValue(value);
|
|
76
52
|
};
|
|
77
53
|
|
|
54
|
+
var radioRef = (0, _react.useRef)(null);
|
|
55
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
56
|
+
return radioRef.current;
|
|
57
|
+
});
|
|
78
58
|
(0, _react.useEffect)(function () {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
59
|
+
var _document, _document$querySelect;
|
|
60
|
+
|
|
61
|
+
var radios = (_document = document) === null || _document === void 0 ? void 0 : (_document$querySelect = _document.querySelectorAll) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.call(_document, "input[name=".concat(radiosName, "]"));
|
|
62
|
+
radios.forEach(function (radio) {
|
|
63
|
+
if (radio.value === rest.defaultValue) radio.checked = true;
|
|
64
|
+
});
|
|
65
|
+
handleRadioClick(rest.defaultValue);
|
|
66
|
+
}, [rest.defaultValue]);
|
|
67
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RadioGroup.Provider, {
|
|
68
|
+
value: {
|
|
69
|
+
handleRadioClick: handleRadioClick,
|
|
70
|
+
groupName: radiosName,
|
|
71
|
+
isDisabled: isDisabled
|
|
72
|
+
},
|
|
73
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ChoiceWrapper, {
|
|
74
|
+
role: "radiogroup",
|
|
75
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread({
|
|
76
|
+
style: {
|
|
77
|
+
display: 'none'
|
|
78
|
+
},
|
|
79
|
+
ref: radioRef,
|
|
80
|
+
type: "text"
|
|
81
|
+
}, rest)), label && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ChoiceLabel, {
|
|
82
|
+
children: label
|
|
83
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ListWrapper, {
|
|
84
|
+
alignDirection: alignDirection,
|
|
85
|
+
children: children
|
|
86
|
+
}), helpText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.HelpText, {
|
|
87
|
+
textColor: 'neutral.black',
|
|
88
|
+
children: helpText
|
|
89
|
+
})]
|
|
105
90
|
})
|
|
106
91
|
});
|
|
107
|
-
};
|
|
108
|
-
|
|
92
|
+
});
|
|
93
|
+
ChoiceList.displayName = 'ChoiceList';
|
|
109
94
|
var _default = ChoiceList;
|
|
110
95
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RadioInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RadioInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAsB,MAAM,OAAO,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,gBAAgB,CA6BpC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -9,12 +9,6 @@ var _react = require("react");
|
|
|
9
9
|
|
|
10
10
|
var _ChoiceList = require("./components/ChoiceList");
|
|
11
11
|
|
|
12
|
-
var _theme = require("../../shared/theme");
|
|
13
|
-
|
|
14
|
-
var _colorToGray = require("../../utils/colorToGray");
|
|
15
|
-
|
|
16
|
-
var _getColorsProps = require("./utils/get-colors-props");
|
|
17
|
-
|
|
18
12
|
var _styles = require("./styles");
|
|
19
13
|
|
|
20
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -27,18 +21,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
27
21
|
|
|
28
22
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
29
23
|
|
|
30
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
31
|
-
|
|
32
|
-
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."); }
|
|
33
|
-
|
|
34
|
-
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); }
|
|
35
|
-
|
|
36
|
-
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; }
|
|
37
|
-
|
|
38
|
-
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; }
|
|
39
|
-
|
|
40
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
41
|
-
|
|
42
24
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
43
25
|
|
|
44
26
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -51,59 +33,30 @@ var RadioInput = function RadioInput(_ref) {
|
|
|
51
33
|
children = _ref.children,
|
|
52
34
|
color = _ref.color,
|
|
53
35
|
defaultChecked = _ref.defaultChecked,
|
|
54
|
-
|
|
36
|
+
onChange = _ref.onChange,
|
|
55
37
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
56
38
|
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
}, [color]),
|
|
80
|
-
checkedColor = _useMemo.checkedColor,
|
|
81
|
-
colors = _useMemo.colors;
|
|
82
|
-
|
|
83
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Wrapper, {
|
|
84
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
85
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Input, _objectSpread(_objectSpread({
|
|
86
|
-
disabled: ctx.isDisabled || isDisabled,
|
|
87
|
-
type: "radio",
|
|
88
|
-
id: id,
|
|
89
|
-
color: checkedColor,
|
|
90
|
-
colorProps: colors,
|
|
91
|
-
name: ctx !== null && ctx !== void 0 && ctx.groupName ? ctx.groupName : name,
|
|
92
|
-
value: value,
|
|
93
|
-
checked: ctx !== null && ctx !== void 0 && ctx.isRadioSelected ? ctx.isRadioSelected(value) : radioValue,
|
|
94
|
-
onChange: function onChange(e) {
|
|
95
|
-
if (ctx !== null && ctx !== void 0 && ctx.handleRadioClick) {
|
|
96
|
-
ctx.handleRadioClick(e);
|
|
97
|
-
} else {
|
|
98
|
-
setRadioValue(true);
|
|
99
|
-
_onChange === null || _onChange === void 0 ? void 0 : _onChange(e.currentTarget.value);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}, rest), ctx && ctx.groupFormRegister ? _objectSpread({}, ctx.groupFormRegister) : _objectSpread({}, rest.formRegister))), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Label, {
|
|
103
|
-
htmlFor: id,
|
|
104
|
-
children: children
|
|
105
|
-
})]
|
|
106
|
-
})
|
|
39
|
+
var _useContext = (0, _react.useContext)(_ChoiceList.RadioGroup),
|
|
40
|
+
groupName = _useContext.groupName,
|
|
41
|
+
handleRadioClick = _useContext.handleRadioClick,
|
|
42
|
+
isDisabledContext = _useContext.isDisabled;
|
|
43
|
+
|
|
44
|
+
var radioRef = (0, _react.useRef)(null);
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Wrapper, {
|
|
46
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Input, _objectSpread({
|
|
47
|
+
ref: radioRef,
|
|
48
|
+
disabled: isDisabled || isDisabledContext,
|
|
49
|
+
type: "radio",
|
|
50
|
+
id: id,
|
|
51
|
+
name: groupName || name,
|
|
52
|
+
onClick: function onClick(e) {
|
|
53
|
+
return handleRadioClick(e.currentTarget.value);
|
|
54
|
+
},
|
|
55
|
+
value: value
|
|
56
|
+
}, rest)), children && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Label, {
|
|
57
|
+
htmlFor: id,
|
|
58
|
+
children: children
|
|
59
|
+
})]
|
|
107
60
|
});
|
|
108
61
|
};
|
|
109
62
|
|
|
@@ -32,11 +32,14 @@ describe('Radio Input', function () {
|
|
|
32
32
|
it('should check input on Click on input', function () {
|
|
33
33
|
var fn = jest.fn();
|
|
34
34
|
|
|
35
|
-
var _render2 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
var _render2 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChoiceList.default, {
|
|
36
|
+
radiosName: "radio",
|
|
37
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
38
|
+
onChange: fn,
|
|
39
|
+
value: "test",
|
|
40
|
+
id: "test",
|
|
41
|
+
children: "Radio Test"
|
|
42
|
+
})
|
|
40
43
|
})),
|
|
41
44
|
container = _render2.container;
|
|
42
45
|
|
|
@@ -49,11 +52,14 @@ describe('Radio Input', function () {
|
|
|
49
52
|
it('should check input on Click label', function () {
|
|
50
53
|
var fn = jest.fn();
|
|
51
54
|
|
|
52
|
-
var _render3 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
var _render3 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChoiceList.default, {
|
|
56
|
+
radiosName: "radio",
|
|
57
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
58
|
+
onChange: fn,
|
|
59
|
+
value: "test",
|
|
60
|
+
id: "test",
|
|
61
|
+
children: "Radio Test"
|
|
62
|
+
})
|
|
57
63
|
})),
|
|
58
64
|
container = _render3.container,
|
|
59
65
|
getByText = _render3.getByText;
|
|
@@ -68,12 +74,15 @@ describe('Radio Input', function () {
|
|
|
68
74
|
it('should checked input if defaultChecked is provided', function () {
|
|
69
75
|
var fn = jest.fn();
|
|
70
76
|
|
|
71
|
-
var _render4 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
var _render4 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChoiceList.default, {
|
|
78
|
+
defaultValue: "test",
|
|
79
|
+
radiosName: "radio",
|
|
80
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
81
|
+
onChange: fn,
|
|
82
|
+
value: "test",
|
|
83
|
+
id: "test",
|
|
84
|
+
children: "Radio Test"
|
|
85
|
+
})
|
|
77
86
|
})),
|
|
78
87
|
container = _render4.container;
|
|
79
88
|
|
|
@@ -83,87 +92,27 @@ describe('Radio Input', function () {
|
|
|
83
92
|
it('should call onChange on Click input', function () {
|
|
84
93
|
var fn = jest.fn();
|
|
85
94
|
|
|
86
|
-
var _render5 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
var _render5 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChoiceList.default, {
|
|
96
|
+
onChangeValue: fn,
|
|
97
|
+
radiosName: "radio",
|
|
98
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
99
|
+
value: "test",
|
|
100
|
+
id: "test",
|
|
101
|
+
children: "Radio Test"
|
|
102
|
+
})
|
|
91
103
|
})),
|
|
92
104
|
container = _render5.container;
|
|
93
105
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
_react.fireEvent.click(radio);
|
|
106
|
+
_react.fireEvent.click(container);
|
|
97
107
|
|
|
98
108
|
expect(fn).toBeCalled();
|
|
99
109
|
});
|
|
100
|
-
it('should ChoiceList control radio childrens', function () {
|
|
101
|
-
var fn = jest.fn();
|
|
102
|
-
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChoiceList.default, {
|
|
103
|
-
onChange: fn,
|
|
104
|
-
value: "test1",
|
|
105
|
-
name: "test-name",
|
|
106
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
107
|
-
value: "test1",
|
|
108
|
-
id: "test",
|
|
109
|
-
children: "Radio Test 1"
|
|
110
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
111
|
-
value: "test2",
|
|
112
|
-
id: "test",
|
|
113
|
-
children: "Radio Test 2"
|
|
114
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
115
|
-
value: "test3",
|
|
116
|
-
id: "test",
|
|
117
|
-
children: "Radio Test 3"
|
|
118
|
-
})]
|
|
119
|
-
}));
|
|
120
|
-
|
|
121
|
-
var sut = _react.screen.getAllByRole('radio');
|
|
122
|
-
|
|
123
|
-
expect(sut[0]).toBeChecked();
|
|
124
|
-
expect(sut[1]).not.toBeChecked();
|
|
125
|
-
expect(sut[2]).not.toBeChecked();
|
|
126
|
-
});
|
|
127
|
-
it('Should ChoiceList change checked radio children is defaultValue is provided', function () {
|
|
128
|
-
var fn = jest.fn();
|
|
129
|
-
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChoiceList.default, {
|
|
130
|
-
onChange: fn,
|
|
131
|
-
value: "",
|
|
132
|
-
name: "test-name",
|
|
133
|
-
defaultValue: "test3",
|
|
134
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
135
|
-
value: "test1",
|
|
136
|
-
id: "test",
|
|
137
|
-
children: "Radio Test 1"
|
|
138
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
139
|
-
value: "test2",
|
|
140
|
-
id: "test",
|
|
141
|
-
children: "Radio Test 2"
|
|
142
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
143
|
-
value: "test3",
|
|
144
|
-
id: "test",
|
|
145
|
-
children: "Radio Test 3"
|
|
146
|
-
})]
|
|
147
|
-
}));
|
|
148
|
-
|
|
149
|
-
var sut = _react.screen.getAllByRole('radio');
|
|
150
|
-
|
|
151
|
-
expect(sut[0]).not.toBeChecked();
|
|
152
|
-
expect(sut[1]).not.toBeChecked();
|
|
153
|
-
expect(sut[2]).toBeChecked();
|
|
154
|
-
|
|
155
|
-
_react.fireEvent.click(sut[0]);
|
|
156
|
-
|
|
157
|
-
expect(sut[0]).toBeChecked();
|
|
158
|
-
expect(sut[2]).not.toBeChecked();
|
|
159
|
-
});
|
|
160
110
|
it('Should ChoiceList disabled radio children is isDisabled is provided', function () {
|
|
161
111
|
var fn = jest.fn();
|
|
162
112
|
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChoiceList.default, {
|
|
163
|
-
|
|
164
|
-
value: "",
|
|
113
|
+
onChangeValue: fn,
|
|
165
114
|
isDisabled: true,
|
|
166
|
-
|
|
115
|
+
radiosName: "test-name",
|
|
167
116
|
defaultValue: "test3",
|
|
168
117
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
169
118
|
value: "test1",
|
|
@@ -189,9 +138,8 @@ describe('Radio Input', function () {
|
|
|
189
138
|
it('should render helpText if helpText is provided', function () {
|
|
190
139
|
var fn = jest.fn();
|
|
191
140
|
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChoiceList.default, {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
name: "test-name",
|
|
141
|
+
onChangeValue: fn,
|
|
142
|
+
radiosName: "test-name",
|
|
195
143
|
defaultValue: "test3",
|
|
196
144
|
helpText: "Help Text",
|
|
197
145
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
@@ -213,10 +161,9 @@ describe('Radio Input', function () {
|
|
|
213
161
|
it('should render label if label is provided', function () {
|
|
214
162
|
var fn = jest.fn();
|
|
215
163
|
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChoiceList.default, {
|
|
216
|
-
|
|
217
|
-
value: "",
|
|
164
|
+
onChangeValue: fn,
|
|
218
165
|
label: "any_label",
|
|
219
|
-
|
|
166
|
+
radiosName: "test-name",
|
|
220
167
|
defaultValue: "test3",
|
|
221
168
|
helpText: "Help Text",
|
|
222
169
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
@@ -233,14 +180,13 @@ describe('Radio Input', function () {
|
|
|
233
180
|
children: "Radio Test 3"
|
|
234
181
|
})]
|
|
235
182
|
}));
|
|
236
|
-
expect(_react.screen.getByRole('radiogroup').children[
|
|
183
|
+
expect(_react.screen.getByRole('radiogroup').children[1].tagName.toLowerCase()).toBe('label');
|
|
237
184
|
});
|
|
238
185
|
it('should not render label if label not provided', function () {
|
|
239
186
|
var fn = jest.fn();
|
|
240
187
|
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChoiceList.default, {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
name: "test-name",
|
|
188
|
+
onChangeValue: fn,
|
|
189
|
+
radiosName: "test-name",
|
|
244
190
|
defaultValue: "test3",
|
|
245
191
|
helpText: "Help Text",
|
|
246
192
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
@@ -257,6 +203,6 @@ describe('Radio Input', function () {
|
|
|
257
203
|
children: "Radio Test 3"
|
|
258
204
|
})]
|
|
259
205
|
}));
|
|
260
|
-
expect(_react.screen.getByRole('radiogroup').children[
|
|
206
|
+
expect(_react.screen.getByRole('radiogroup').children[1].tagName.toLowerCase()).not.toBe('label');
|
|
261
207
|
});
|
|
262
208
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/RadioInput/styles.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,OAAO;;;yGAInB,CAAC;AAEF,eAAO,MAAM,KAAK;;;kHAGjB,CAAC;AAEF,eAAO,MAAM,KAAK;;;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/RadioInput/styles.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,OAAO;;;yGAInB,CAAC;AAEF,eAAO,MAAM,KAAK;;;kHAGjB,CAAC;AAEF,eAAO,MAAM,KAAK;;;sIAgEjB,CAAC;AAEF,eAAO,MAAM,aAAa;;;yGAAe,CAAC;AAE1C,eAAO,MAAM,WAAW;;;6HAOvB,CAAC;AAEF,eAAO,MAAM,WAAW;;;sIASvB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;+HASpB,CAAC"}
|
|
@@ -24,13 +24,8 @@ var Label = _styled.default.label(_templateObject2 || (_templateObject2 = _tagge
|
|
|
24
24
|
exports.Label = Label;
|
|
25
25
|
|
|
26
26
|
var Input = _styled.default.input(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref) {
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
theme = _ref.theme;
|
|
30
|
-
return (0, _react.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n appearance: none;\n display: flex;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n margin: 0;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n border: 2px solid\n ", ";\n\n cursor: pointer;\n\n + label {\n color: ", ";\n line-height: 20px;\n cursor: pointer;\n }\n\n :hover {\n border-color: ", ";\n }\n :focus {\n border-color: ", ";\n box-shadow: 0 0 0 2px ", ";\n }\n :disabled {\n cursor: default;\n border-color: ", ";\n background-color: ", ";\n + label {\n color: ", ";\n cursor: default;\n }\n }\n\n :checked {\n background-color: ", ";\n border-color: ", ";\n &:focus {\n background-color: ", ";\n border-color: ", ";\n box-shadow: 0 0 0 2px ", ";\n }\n &:hover {\n background-color: ", ";\n border-color: ", ";\n }\n &:disabled {\n background-color: ", ";\n border-color: ", ";\n + label {\n color: ", ";\n cursor: default;\n }\n &::after {\n display: none;\n }\n }\n\n &::after {\n content: '';\n display: block;\n width: 6px;\n height: 6px;\n background: #fff;\n border-radius: 50%;\n }\n }\n "])), {
|
|
31
|
-
light: theme.colors.neutral.neutral2,
|
|
32
|
-
dark: theme.colors.neutral.neutral5
|
|
33
|
-
}[theme.colorMode], theme.colorMode === 'light' ? colorProps === null || colorProps === void 0 ? void 0 : colorProps.black : theme.colors.neutral.white, theme.colors.primary.hover, colorProps === null || colorProps === void 0 ? void 0 : colorProps.focus, colorProps === null || colorProps === void 0 ? void 0 : colorProps.grayLightness, colorProps === null || colorProps === void 0 ? void 0 : colorProps.grayLightness, colorProps === null || colorProps === void 0 ? void 0 : colorProps.grayLightness, colorProps === null || colorProps === void 0 ? void 0 : colorProps.gray, color, color, colorProps === null || colorProps === void 0 ? void 0 : colorProps.saturationFocus, colorProps === null || colorProps === void 0 ? void 0 : colorProps.saturationFocus, colorProps === null || colorProps === void 0 ? void 0 : colorProps.shadowLightness, colorProps === null || colorProps === void 0 ? void 0 : colorProps.saturation, colorProps === null || colorProps === void 0 ? void 0 : colorProps.saturation, colorProps === null || colorProps === void 0 ? void 0 : colorProps.gray, colorProps === null || colorProps === void 0 ? void 0 : colorProps.gray, colorProps === null || colorProps === void 0 ? void 0 : colorProps.graySaturation);
|
|
27
|
+
var colors = _ref.theme.colors;
|
|
28
|
+
return (0, _react.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n appearance: none;\n display: flex;\n justify-content: center;\n align-items: center;\n margin: 0;\n min-width: 20px;\n height: 20px;\n border-radius: 50%;\n border: 2px solid ", ";\n transition: all ease 0.2s;\n cursor: pointer;\n\n + label {\n color: ", ";\n line-height: 20px;\n cursor: pointer;\n }\n\n :hover {\n border-color: ", ";\n }\n\n :disabled {\n cursor: default;\n border-color: ", ";\n background-color: ", ";\n + label {\n color: ", ";\n cursor: default;\n }\n }\n\n :checked {\n background-color: ", ";\n border-color: ", ";\n &:focus {\n background-color: ", ";\n border-color: ", ";\n box-shadow: 0 0 0 2px ", ";\n }\n &:hover {\n background-color: ", ";\n border-color: ", ";\n }\n &:disabled {\n background-color: ", ";\n border-color: ", ";\n + label {\n color: ", ";\n cursor: default;\n }\n }\n\n &::after {\n content: '';\n width: 6px;\n height: 6px;\n background: #fff;\n border-radius: 50%;\n }\n }\n "])), colors.neutral.neutral2, colors.neutral.black, colors.primary.hover, colors.neutral.neutral1, colors.neutral.neutral1, colors.neutral.neutral2, colors.primary.default, colors.primary.default, colors.primary.focus, colors.primary.focus, colors.primary.disabled, colors.primary.hover, colors.primary.hover, colors.neutral.neutral2, colors.neutral.neutral2, colors.neutral.neutral4);
|
|
34
29
|
});
|
|
35
30
|
|
|
36
31
|
exports.Input = Input;
|
|
@@ -48,9 +43,8 @@ var ListWrapper = _styled.default.div(_templateObject6 || (_templateObject6 = _t
|
|
|
48
43
|
exports.ListWrapper = ListWrapper;
|
|
49
44
|
|
|
50
45
|
var ChoiceLabel = _styled.default.label(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref3) {
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
return (0, _react.css)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n display: block;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: ", ";\n margin-bottom: 16px;\n "])), theme.colorMode === 'light' ? colorProps === null || colorProps === void 0 ? void 0 : colorProps.black : theme.colors.neutral.white);
|
|
46
|
+
var colors = _ref3.theme.colors;
|
|
47
|
+
return (0, _react.css)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n display: block;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: ", ";\n margin-bottom: 16px;\n "])), colors.neutral.black);
|
|
54
48
|
});
|
|
55
49
|
|
|
56
50
|
exports.ChoiceLabel = ChoiceLabel;
|
|
@@ -58,7 +52,7 @@ exports.ChoiceLabel = ChoiceLabel;
|
|
|
58
52
|
var HelpText = _styled.default.span(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref4) {
|
|
59
53
|
var theme = _ref4.theme,
|
|
60
54
|
textColor = _ref4.textColor;
|
|
61
|
-
return (0, _react.css)(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n font-size: ", ";\n color: ", ";\n font-weight:
|
|
55
|
+
return (0, _react.css)(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n font-size: ", ";\n color: ", ";\n font-weight: 500;\n display: block;\n padding-left: 30px;\n margin-top: 18px;\n "])), theme.fontSizes.xxs, textColor);
|
|
62
56
|
});
|
|
63
57
|
|
|
64
58
|
exports.HelpText = HelpText;
|
|
@@ -1,61 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare type FormRegister = {
|
|
3
|
-
onChange: ChangeEventHandler<HTMLInputElement>;
|
|
4
|
-
onBlur: ChangeEventHandler;
|
|
5
|
-
ref: Ref<any>;
|
|
6
|
-
name: string;
|
|
7
|
-
};
|
|
8
|
-
export declare type ColorProps = {
|
|
9
|
-
black: string;
|
|
10
|
-
gray: string;
|
|
11
|
-
grayLightness: string;
|
|
12
|
-
graySaturation: string;
|
|
13
|
-
focus: string;
|
|
14
|
-
focusChecked: string;
|
|
15
|
-
shadowLightness: string;
|
|
16
|
-
saturation: string;
|
|
17
|
-
saturationFocus: string;
|
|
18
|
-
};
|
|
1
|
+
import { ReactNode } from 'react';
|
|
19
2
|
export interface IRadioInputProps {
|
|
20
3
|
isDisabled?: boolean;
|
|
21
4
|
name?: string;
|
|
22
5
|
value: string;
|
|
23
6
|
id: string;
|
|
24
|
-
children
|
|
7
|
+
children?: ReactNode;
|
|
25
8
|
color?: string;
|
|
26
9
|
defaultChecked?: boolean;
|
|
27
10
|
onChange?: (value: string) => void;
|
|
28
|
-
formRegister?: FormRegister;
|
|
29
11
|
}
|
|
30
12
|
export interface ChoiceListProps {
|
|
31
|
-
|
|
13
|
+
onChangeValue?: (value: string) => void;
|
|
32
14
|
label?: string;
|
|
33
|
-
value: string;
|
|
34
15
|
defaultValue?: string;
|
|
35
16
|
isDisabled?: boolean;
|
|
36
|
-
|
|
17
|
+
radiosName: string;
|
|
37
18
|
alignDirection?: 'column' | 'row';
|
|
38
19
|
color?: string;
|
|
39
20
|
helpText?: string;
|
|
40
21
|
children: ReactNode;
|
|
41
|
-
formRegister?: FormRegister;
|
|
42
22
|
}
|
|
43
23
|
export declare type ChoiceListContext = {
|
|
44
|
-
handleRadioClick: (e:
|
|
45
|
-
|
|
24
|
+
handleRadioClick: (e: string) => void;
|
|
25
|
+
defaultValue?: string;
|
|
46
26
|
groupName: string;
|
|
47
|
-
groupColor: string;
|
|
48
|
-
groupFormRegister?: FormRegister;
|
|
49
27
|
isDisabled?: boolean;
|
|
50
28
|
};
|
|
51
29
|
export interface IStyledRadioInput {
|
|
52
|
-
color?: string;
|
|
53
|
-
colorProps?: ColorProps;
|
|
54
30
|
textColor?: string;
|
|
55
31
|
alignDirection?: 'column' | 'row';
|
|
56
|
-
disabledColor?: string;
|
|
57
|
-
disabledWithCheckedColor?: string;
|
|
58
|
-
disabledTextColor?: string;
|
|
59
|
-
disabledTextWithCheckedColor?: string;
|
|
60
32
|
}
|
|
61
33
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/RadioInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/RadioInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,oBAAY,iBAAiB,GAAG;IAC9B,gBAAgB,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;CACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Skeleton/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Skeleton/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,QAAA,MAAM,QAAQ,oCAAqC,cAAc,gBAMhE,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
var _styles = require("./styles");
|
|
11
9
|
|
|
12
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -28,9 +26,10 @@ var Skeleton = function Skeleton(_ref) {
|
|
|
28
26
|
isLoaded = _ref.isLoaded,
|
|
29
27
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
30
28
|
|
|
31
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SkeletonElement, _objectSpread(_objectSpread({}, rest), {}, {
|
|
30
|
+
isLoaded: isLoaded,
|
|
31
|
+
children: children
|
|
32
|
+
}));
|
|
34
33
|
};
|
|
35
34
|
|
|
36
35
|
var _default = Skeleton;
|
|
@@ -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;;;iJAuF1B,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;
|
|
18
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
@@ -34,7 +34,9 @@ var SkeletonElement = _styled.default.span(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
|
-
|
|
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 width: ", ";\n height: ", ";\n color: transparent;\n\n ", ";\n "])), skeletonColor, borderRadiusByVariant[props.variant || 'text'], typeof props.width === 'number' ? props.width + 'px' : props.width || '', typeof props.height === 'number' ? props.height + 'px' : props.height || '', props.animation !== 'static' ? animationsCss[props.animation || 'wave'] : '');
|
|
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;
|
|
38
40
|
});
|
|
39
41
|
|
|
40
42
|
exports.SkeletonElement = SkeletonElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,QAAA,MAAM,MAAM,yFAUT,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,QAAA,MAAM,MAAM,yFAUT,YAAY,gBAgDd,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -85,6 +85,9 @@ var Slider = function Slider(_ref) {
|
|
|
85
85
|
onChange && onChange(sliderValue);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
(0, _react.useEffect)(function () {
|
|
89
|
+
setSliderValue(value);
|
|
90
|
+
}, [value]);
|
|
88
91
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.SliderContent, {
|
|
89
92
|
direction: direction,
|
|
90
93
|
fullSize: fullSize,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDisableBodyScroll.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/useDisableBodyScroll.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,YAAa,OAAO,
|
|
1
|
+
{"version":3,"file":"useDisableBodyScroll.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/useDisableBodyScroll.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,YAAa,OAAO,SAWpD,CAAC"}
|
|
@@ -10,8 +10,9 @@ var _react = require("react");
|
|
|
10
10
|
var useDisableBodyScroll = function useDisableBodyScroll(disable) {
|
|
11
11
|
(0, _react.useEffect)(function () {
|
|
12
12
|
if (disable) {
|
|
13
|
+
var scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
14
|
+
document.body.style.paddingRight = "".concat(scrollBarWidth, "px");
|
|
13
15
|
document.body.style.overflow = 'hidden';
|
|
14
|
-
document.body.style.paddingRight = '18px';
|
|
15
16
|
} else {
|
|
16
17
|
document.body.style.overflow = '';
|
|
17
18
|
document.body.style.paddingRight = '';
|