@pedidopago/ui 1.1.0 → 1.1.1
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/Alert/alert.test.js +9 -1
- package/dist/components/Alert/index.js +47 -35
- package/dist/components/Avatar/avatar.test.js +9 -1
- package/dist/components/Avatar/index.js +47 -27
- package/dist/components/Badge/badge.test.js +9 -1
- package/dist/components/Badge/index.js +24 -15
- package/dist/components/Button/Button.test.js +19 -7
- package/dist/components/Button/index.js +28 -16
- package/dist/components/Card/ButtonCard/index.js +24 -10
- package/dist/components/Card/Expansion/index.js +24 -17
- package/dist/components/Card/card.test.js +9 -1
- package/dist/components/Card/index.js +43 -19
- package/dist/components/CheckboxInput/checkbox-input.test.js +9 -1
- package/dist/components/CheckboxInput/components/MultipleCheckbox.js +58 -43
- package/dist/components/CheckboxInput/index.js +29 -18
- package/dist/components/ColorPicker/colorpicker.test.js +9 -1
- package/dist/components/ColorPicker/components/ColorHue.js +17 -10
- package/dist/components/ColorPicker/components/ColorInput.js +3 -1
- package/dist/components/ColorPicker/components/ColorPickerBox.js +13 -9
- package/dist/components/ColorPicker/components/ColorPointer.js +3 -1
- package/dist/components/ColorPicker/components/ColorSelector.js +8 -2
- package/dist/components/ColorPicker/index.js +44 -34
- package/dist/components/DatePicker/components/DatePickerContent.js +113 -79
- package/dist/components/DatePicker/components/DateYearPicker.js +45 -32
- package/dist/components/DatePicker/datepicker.test.js +9 -1
- package/dist/components/DatePicker/index.js +40 -29
- package/dist/components/Dialog/dialog-example.js +21 -13
- package/dist/components/Dialog/dialog.test.js +5 -1
- package/dist/components/Dialog/index.js +59 -46
- package/dist/components/Dropzone/dropzone.test.js +9 -1
- package/dist/components/Dropzone/index.js +122 -97
- package/dist/components/Flex/flex.test.js +128 -14
- package/dist/components/Flex/index.js +11 -3
- package/dist/components/Grid/grid.test.js +86 -81
- package/dist/components/Grid/index.js +11 -3
- package/dist/components/Icon/icon.test.js +3 -3
- package/dist/components/Icon/index.js +8 -2
- package/dist/components/IconItem/IconItem.test.js +9 -1
- package/dist/components/IconItem/index.js +33 -18
- package/dist/components/ImageItem/imageFake.js +13 -9
- package/dist/components/ImageItem/index.js +36 -24
- package/dist/components/ImageItem/input.test.js +10 -7
- package/dist/components/Input/index.js +67 -40
- package/dist/components/Input/input.test.js +4 -4
- package/dist/components/Label/index.js +12 -9
- package/dist/components/Label/input.test.js +3 -1
- package/dist/components/List/index.js +15 -4
- package/dist/components/List/list.test.js +36 -18
- package/dist/components/Menu/components/Submenu.js +49 -26
- package/dist/components/Menu/index.js +19 -10
- package/dist/components/Menu/menu.test.js +14 -14
- package/dist/components/Modal/index.js +24 -19
- package/dist/components/Modal/modal.test.js +44 -12
- package/dist/components/Pagination/index.js +54 -45
- package/dist/components/Pagination/pagination.test.js +13 -11
- package/dist/components/Progress/Circle/index.js +38 -29
- package/dist/components/Progress/Linear/index.js +24 -17
- package/dist/components/Progress/index.js +4 -2
- package/dist/components/Progress/progress.test.js +9 -1
- package/dist/components/RadioInput/components/ChoiceList/index.js +28 -20
- package/dist/components/RadioInput/index.js +27 -22
- package/dist/components/RadioInput/radio-input.test.js +118 -87
- package/dist/components/Rating/components/GradientIcon/index.js +24 -17
- package/dist/components/Rating/components/RatingWithMultipleValues/RatingWithMultipleValues.js +24 -22
- package/dist/components/Rating/components/RatingWithSingleValue/RatingWithSingleValue.js +21 -17
- package/dist/components/Rating/index.js +29 -26
- package/dist/components/Rating/rating.test.js +3 -1
- package/dist/components/SelectInput/components/OptionsArea/index.js +37 -32
- package/dist/components/SelectInput/components/SelectArea/index.js +46 -34
- package/dist/components/SelectInput/index.js +26 -23
- package/dist/components/SelectInput/selectInput.test.js +10 -4
- package/dist/components/Skeleton/index.js +11 -1
- package/dist/components/Skeleton/skeleton.test.js +3 -1
- package/dist/components/Slider/components/SliderPointer.js +23 -17
- package/dist/components/Slider/components/SliderRail.js +8 -2
- package/dist/components/Slider/components/SliderSelector.js +86 -78
- package/dist/components/Slider/index.js +28 -16
- package/dist/components/Slider/slider.test.js +9 -1
- package/dist/components/Spinner/index.js +3 -1
- package/dist/components/Spinner/spinner.test.js +9 -1
- package/dist/components/Steps/index.js +25 -17
- package/dist/components/Steps/steps.test.js +3 -1
- package/dist/components/Switch/index.js +23 -17
- package/dist/components/Switch/input.test.js +3 -1
- package/dist/components/Table/components/MenuItem.js +16 -13
- package/dist/components/Table/index.js +139 -99
- package/dist/components/Table/table.test.js +3 -1
- package/dist/components/Tabs/TabsExample.js +37 -23
- package/dist/components/Tabs/components/Tab.js +12 -3
- package/dist/components/Tabs/components/TabPanel.js +8 -3
- package/dist/components/Tabs/components/Tabs.js +33 -23
- package/dist/components/Tabs/tabs.test.js +103 -83
- package/dist/components/Tag/index.js +21 -16
- package/dist/components/Tag/tag.test.js +9 -7
- package/dist/components/TextAreaInput/index.js +25 -15
- package/dist/components/TextAreaInput/text-area-input.test.js +8 -2
- package/dist/components/Thumbnail/index.js +71 -60
- package/dist/components/Thumbnail/thumbnail.test.js +9 -1
- package/dist/components/Timeline/components/Timeline.js +9 -5
- package/dist/components/Timeline/components/TimelineContent.js +31 -15
- package/dist/components/Timeline/components/TimelineItem.js +11 -1
- package/dist/components/Timeline/components/TimelineSeparator.js +9 -4
- package/dist/components/Timeline/timeline.test.js +105 -76
- package/dist/components/Toast/button-example.js +10 -5
- package/dist/components/Toast/components/Toast.js +16 -11
- package/dist/components/Toast/contexts/ToastProvider.js +6 -3
- package/dist/components/Toast/index.js +90 -62
- package/dist/components/Toast/toast.test.js +11 -1
- package/dist/components/Tooltip/componenteTeste.js +42 -14
- package/dist/components/Tooltip/index.js +56 -46
- package/dist/components/Tooltip/tooltip.test.js +13 -8
- package/dist/components/Typography/index.js +11 -3
- package/dist/components/Typography/typography.test.js +3 -1
- package/dist/shared/components/FocusLock/index.js +11 -4
- package/dist/shared/tests/test-utils.js +6 -3
- package/dist/shared/theme/button-example.js +6 -3
- package/dist/shared/theme/contexts/ThemeContext.js +12 -6
- package/dist/shared/theme/theme.test.js +25 -11
- package/package.json +1 -1
|
@@ -17,6 +17,8 @@ var _getColorsProps = require("../../utils/get-colors-props");
|
|
|
17
17
|
|
|
18
18
|
var _styles = require("../../styles");
|
|
19
19
|
|
|
20
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
+
|
|
20
22
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
23
|
|
|
22
24
|
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."); }
|
|
@@ -73,26 +75,32 @@ var ChoiceList = function ChoiceList(_ref) {
|
|
|
73
75
|
onChange(e.currentTarget.value);
|
|
74
76
|
};
|
|
75
77
|
|
|
76
|
-
return /*#__PURE__*/
|
|
77
|
-
theme: theme
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
78
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.ThemeProvider, {
|
|
79
|
+
theme: theme,
|
|
80
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RadioGroup.Provider, {
|
|
81
|
+
value: {
|
|
82
|
+
handleRadioClick: handleRadioClick,
|
|
83
|
+
isRadioSelected: isRadioSelected,
|
|
84
|
+
groupColor: color || theme.colors.primary.default,
|
|
85
|
+
groupName: name,
|
|
86
|
+
groupFormRegister: formRegister,
|
|
87
|
+
isDisabled: isDisabled
|
|
88
|
+
},
|
|
89
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ChoiceWrapper, {
|
|
90
|
+
role: "radiogroup",
|
|
91
|
+
children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ChoiceLabel, {
|
|
92
|
+
colorProps: colors,
|
|
93
|
+
children: label
|
|
94
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ListWrapper, {
|
|
95
|
+
alignDirection: alignDirection,
|
|
96
|
+
children: children
|
|
97
|
+
}), helpText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.HelpText, {
|
|
98
|
+
textColor: colors.black,
|
|
99
|
+
children: helpText
|
|
100
|
+
})]
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
});
|
|
96
104
|
};
|
|
97
105
|
|
|
98
106
|
var _default = ChoiceList;
|
|
@@ -17,9 +17,9 @@ var _getColorsProps = require("./utils/get-colors-props");
|
|
|
17
17
|
|
|
18
18
|
var _styles = require("./styles");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
var _excluded = ["isDisabled", "id", "name", "value", "children", "color", "defaultChecked", "onChange"];
|
|
23
23
|
|
|
24
24
|
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
25
|
|
|
@@ -80,26 +80,31 @@ var RadioInput = function RadioInput(_ref) {
|
|
|
80
80
|
checkedColor = _useMemo.checkedColor,
|
|
81
81
|
colors = _useMemo.colors;
|
|
82
82
|
|
|
83
|
-
return /*#__PURE__*/
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
+
})
|
|
107
|
+
});
|
|
103
108
|
};
|
|
104
109
|
|
|
105
110
|
var _default = RadioInput;
|
|
@@ -10,17 +10,20 @@ var _ChoiceList = _interopRequireDefault(require("./components/ChoiceList"));
|
|
|
10
10
|
|
|
11
11
|
var _ = _interopRequireDefault(require("."));
|
|
12
12
|
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
|
|
13
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
16
|
|
|
15
17
|
describe('Radio Input', function () {
|
|
16
18
|
it('should render input', function () {
|
|
17
19
|
var fn = jest.fn();
|
|
18
20
|
|
|
19
|
-
var _render = (0, _testUtils.render)( /*#__PURE__*/
|
|
21
|
+
var _render = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
20
22
|
onChange: fn,
|
|
21
23
|
value: "test",
|
|
22
|
-
id: "test"
|
|
23
|
-
|
|
24
|
+
id: "test",
|
|
25
|
+
children: "Radio Test"
|
|
26
|
+
})),
|
|
24
27
|
container = _render.container;
|
|
25
28
|
|
|
26
29
|
var radio = container.querySelector('input[type="radio"]');
|
|
@@ -29,11 +32,12 @@ describe('Radio Input', function () {
|
|
|
29
32
|
it('should check input on Click on input', function () {
|
|
30
33
|
var fn = jest.fn();
|
|
31
34
|
|
|
32
|
-
var _render2 = (0, _testUtils.render)( /*#__PURE__*/
|
|
35
|
+
var _render2 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
33
36
|
onChange: fn,
|
|
34
37
|
value: "test",
|
|
35
|
-
id: "test"
|
|
36
|
-
|
|
38
|
+
id: "test",
|
|
39
|
+
children: "Radio Test"
|
|
40
|
+
})),
|
|
37
41
|
container = _render2.container;
|
|
38
42
|
|
|
39
43
|
var radio = container.querySelector('input[type="radio"]');
|
|
@@ -45,11 +49,12 @@ describe('Radio Input', function () {
|
|
|
45
49
|
it('should check input on Click label', function () {
|
|
46
50
|
var fn = jest.fn();
|
|
47
51
|
|
|
48
|
-
var _render3 = (0, _testUtils.render)( /*#__PURE__*/
|
|
52
|
+
var _render3 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
49
53
|
onChange: fn,
|
|
50
54
|
value: "test",
|
|
51
|
-
id: "test"
|
|
52
|
-
|
|
55
|
+
id: "test",
|
|
56
|
+
children: "Radio Test"
|
|
57
|
+
})),
|
|
53
58
|
container = _render3.container,
|
|
54
59
|
getByText = _render3.getByText;
|
|
55
60
|
|
|
@@ -63,12 +68,13 @@ describe('Radio Input', function () {
|
|
|
63
68
|
it('should checked input if defaultChecked is provided', function () {
|
|
64
69
|
var fn = jest.fn();
|
|
65
70
|
|
|
66
|
-
var _render4 = (0, _testUtils.render)( /*#__PURE__*/
|
|
71
|
+
var _render4 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
67
72
|
onChange: fn,
|
|
68
73
|
value: "test",
|
|
69
74
|
id: "test",
|
|
70
|
-
defaultChecked: true
|
|
71
|
-
|
|
75
|
+
defaultChecked: true,
|
|
76
|
+
children: "Radio Test"
|
|
77
|
+
})),
|
|
72
78
|
container = _render4.container;
|
|
73
79
|
|
|
74
80
|
var radio = container.querySelector('input[type="radio"]');
|
|
@@ -77,11 +83,12 @@ describe('Radio Input', function () {
|
|
|
77
83
|
it('should call onChange on Click input', function () {
|
|
78
84
|
var fn = jest.fn();
|
|
79
85
|
|
|
80
|
-
var _render5 = (0, _testUtils.render)( /*#__PURE__*/
|
|
86
|
+
var _render5 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
81
87
|
onChange: fn,
|
|
82
88
|
value: "test",
|
|
83
|
-
id: "test"
|
|
84
|
-
|
|
89
|
+
id: "test",
|
|
90
|
+
children: "Radio Test"
|
|
91
|
+
})),
|
|
85
92
|
container = _render5.container;
|
|
86
93
|
|
|
87
94
|
var radio = container.querySelector('input[type="radio"]');
|
|
@@ -92,20 +99,24 @@ describe('Radio Input', function () {
|
|
|
92
99
|
});
|
|
93
100
|
it('should ChoiceList control radio childrens', function () {
|
|
94
101
|
var fn = jest.fn();
|
|
95
|
-
(0, _testUtils.render)( /*#__PURE__*/
|
|
102
|
+
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChoiceList.default, {
|
|
96
103
|
onChange: fn,
|
|
97
104
|
value: "test1",
|
|
98
|
-
name: "test-name"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
+
}));
|
|
109
120
|
|
|
110
121
|
var sut = _react.screen.getAllByRole('radio');
|
|
111
122
|
|
|
@@ -115,21 +126,25 @@ describe('Radio Input', function () {
|
|
|
115
126
|
});
|
|
116
127
|
it('Should ChoiceList change checked radio children is defaultValue is provided', function () {
|
|
117
128
|
var fn = jest.fn();
|
|
118
|
-
(0, _testUtils.render)( /*#__PURE__*/
|
|
129
|
+
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChoiceList.default, {
|
|
119
130
|
onChange: fn,
|
|
120
131
|
value: "",
|
|
121
132
|
name: "test-name",
|
|
122
|
-
defaultValue: "test3"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
+
}));
|
|
133
148
|
|
|
134
149
|
var sut = _react.screen.getAllByRole('radio');
|
|
135
150
|
|
|
@@ -144,22 +159,26 @@ describe('Radio Input', function () {
|
|
|
144
159
|
});
|
|
145
160
|
it('Should ChoiceList disabled radio children is isDisabled is provided', function () {
|
|
146
161
|
var fn = jest.fn();
|
|
147
|
-
(0, _testUtils.render)( /*#__PURE__*/
|
|
162
|
+
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChoiceList.default, {
|
|
148
163
|
onChange: fn,
|
|
149
164
|
value: "",
|
|
150
165
|
isDisabled: true,
|
|
151
166
|
name: "test-name",
|
|
152
|
-
defaultValue: "test3"
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
167
|
+
defaultValue: "test3",
|
|
168
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
169
|
+
value: "test1",
|
|
170
|
+
id: "test",
|
|
171
|
+
children: "Radio Test 1"
|
|
172
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
173
|
+
value: "test2",
|
|
174
|
+
id: "test",
|
|
175
|
+
children: "Radio Test 2"
|
|
176
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
177
|
+
value: "test3",
|
|
178
|
+
id: "test",
|
|
179
|
+
children: "Radio Test 3"
|
|
180
|
+
})]
|
|
181
|
+
}));
|
|
163
182
|
|
|
164
183
|
var sut = _react.screen.getAllByRole('radio');
|
|
165
184
|
|
|
@@ -169,63 +188,75 @@ describe('Radio Input', function () {
|
|
|
169
188
|
});
|
|
170
189
|
it('should render helpText if helpText is provided', function () {
|
|
171
190
|
var fn = jest.fn();
|
|
172
|
-
(0, _testUtils.render)( /*#__PURE__*/
|
|
191
|
+
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChoiceList.default, {
|
|
173
192
|
onChange: fn,
|
|
174
193
|
value: "",
|
|
175
194
|
name: "test-name",
|
|
176
195
|
defaultValue: "test3",
|
|
177
|
-
helpText: "Help Text"
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
196
|
+
helpText: "Help Text",
|
|
197
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
198
|
+
value: "test1",
|
|
199
|
+
id: "test",
|
|
200
|
+
children: "Radio Test 1"
|
|
201
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
202
|
+
value: "test2",
|
|
203
|
+
id: "test",
|
|
204
|
+
children: "Radio Test 2"
|
|
205
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
206
|
+
value: "test3",
|
|
207
|
+
id: "test",
|
|
208
|
+
children: "Radio Test 3"
|
|
209
|
+
})]
|
|
210
|
+
}));
|
|
188
211
|
expect(_react.screen.getByText('Help Text')).toBeInTheDocument();
|
|
189
212
|
});
|
|
190
213
|
it('should render label if label is provided', function () {
|
|
191
214
|
var fn = jest.fn();
|
|
192
|
-
(0, _testUtils.render)( /*#__PURE__*/
|
|
215
|
+
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChoiceList.default, {
|
|
193
216
|
onChange: fn,
|
|
194
217
|
value: "",
|
|
195
218
|
label: "any_label",
|
|
196
219
|
name: "test-name",
|
|
197
220
|
defaultValue: "test3",
|
|
198
|
-
helpText: "Help Text"
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
221
|
+
helpText: "Help Text",
|
|
222
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
223
|
+
value: "test1",
|
|
224
|
+
id: "test",
|
|
225
|
+
children: "Radio Test 1"
|
|
226
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
227
|
+
value: "test2",
|
|
228
|
+
id: "test",
|
|
229
|
+
children: "Radio Test 2"
|
|
230
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
231
|
+
value: "test3",
|
|
232
|
+
id: "test",
|
|
233
|
+
children: "Radio Test 3"
|
|
234
|
+
})]
|
|
235
|
+
}));
|
|
209
236
|
expect(_react.screen.getByRole('radiogroup').children[0].tagName.toLowerCase()).toBe('label');
|
|
210
237
|
});
|
|
211
238
|
it('should not render label if label not provided', function () {
|
|
212
239
|
var fn = jest.fn();
|
|
213
|
-
(0, _testUtils.render)( /*#__PURE__*/
|
|
240
|
+
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChoiceList.default, {
|
|
214
241
|
onChange: fn,
|
|
215
242
|
value: "",
|
|
216
243
|
name: "test-name",
|
|
217
244
|
defaultValue: "test3",
|
|
218
|
-
helpText: "Help Text"
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
245
|
+
helpText: "Help Text",
|
|
246
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
247
|
+
value: "test1",
|
|
248
|
+
id: "test",
|
|
249
|
+
children: "Radio Test 1"
|
|
250
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
251
|
+
value: "test2",
|
|
252
|
+
id: "test",
|
|
253
|
+
children: "Radio Test 2"
|
|
254
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
255
|
+
value: "test3",
|
|
256
|
+
id: "test",
|
|
257
|
+
children: "Radio Test 3"
|
|
258
|
+
})]
|
|
259
|
+
}));
|
|
229
260
|
expect(_react.screen.getByRole('radiogroup').children[0].tagName.toLowerCase()).not.toBe('label');
|
|
230
261
|
});
|
|
231
262
|
});
|
|
@@ -15,9 +15,15 @@ var _theme = require("../../../../shared/theme");
|
|
|
15
15
|
|
|
16
16
|
var _allIcons = require("./utils/allIcons");
|
|
17
17
|
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
18
20
|
var _excluded = ["name", "fillState", "primaryColor", "secondaryColor", "strokeColor", "size", "disabled"];
|
|
19
21
|
|
|
20
|
-
function
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
21
27
|
|
|
22
28
|
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; }
|
|
23
29
|
|
|
@@ -52,22 +58,23 @@ var Icon = function Icon(_ref) {
|
|
|
52
58
|
var htmlParsedPrimaryColor = html.replace(/#133113/g, primaryColor);
|
|
53
59
|
var htmlParsedSecondaryColor = htmlParsedPrimaryColor.replace(/#311331/g, secondaryColor);
|
|
54
60
|
var parsedHtml = htmlParsedSecondaryColor;
|
|
55
|
-
return /*#__PURE__*/
|
|
56
|
-
theme: theme
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.ThemeProvider, {
|
|
62
|
+
theme: theme,
|
|
63
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.IconComponent, _objectSpread({
|
|
64
|
+
style: {
|
|
65
|
+
fill: fillState === 'filled' ? primaryColor : fillState === 'halfFilled' ? "url(#".concat(name, "_gradient)") : secondaryColor
|
|
66
|
+
},
|
|
67
|
+
strokeColor: strokeColor,
|
|
68
|
+
xmlns: xmlns,
|
|
69
|
+
name: name,
|
|
70
|
+
viewBox: viewBox,
|
|
71
|
+
width: size || width,
|
|
72
|
+
height: size || height,
|
|
73
|
+
dangerouslySetInnerHTML: {
|
|
74
|
+
__html: parsedHtml
|
|
75
|
+
}
|
|
76
|
+
}, rest))
|
|
77
|
+
});
|
|
71
78
|
};
|
|
72
79
|
|
|
73
80
|
var _default = Icon;
|
package/dist/components/Rating/components/RatingWithMultipleValues/RatingWithMultipleValues.js
CHANGED
|
@@ -15,6 +15,8 @@ var _GradientIcon = _interopRequireDefault(require("../GradientIcon"));
|
|
|
15
15
|
|
|
16
16
|
var _svgDataTratamentFunction = require("../../utils/svgDataTratamentFunction");
|
|
17
17
|
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
21
|
|
|
20
22
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -111,29 +113,29 @@ function RatingWithMultipleValues(_ref) {
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
|
|
114
|
-
return /*#__PURE__*/
|
|
116
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.RatingWrapper, {
|
|
115
117
|
disabled: disabled,
|
|
116
118
|
onMouseLeave: RatingWrapperMouseLeave,
|
|
117
119
|
ref: RatingWrapperRef,
|
|
118
|
-
"data-testid": "rating-wrapper"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
})
|
|
138
|
-
})
|
|
120
|
+
"data-testid": "rating-wrapper",
|
|
121
|
+
children: icons.map(function (icon) {
|
|
122
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GradientIcon.default, {
|
|
123
|
+
size: size,
|
|
124
|
+
"data-testid": "rating-icon-".concat(icon.id),
|
|
125
|
+
name: name,
|
|
126
|
+
primaryColor: primaryColor,
|
|
127
|
+
secondaryColor: secondaryColor,
|
|
128
|
+
strokeColor: strokeColor,
|
|
129
|
+
onMouseMove: function onMouseMove(e) {
|
|
130
|
+
return handleMouseMove(e, icon.id);
|
|
131
|
+
},
|
|
132
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
133
|
+
return handleMouseMove(e, icon.id);
|
|
134
|
+
},
|
|
135
|
+
onClick: handleClick,
|
|
136
|
+
fillState: icon.fillState,
|
|
137
|
+
disabled: disabled
|
|
138
|
+
}, icon.id);
|
|
139
|
+
})
|
|
140
|
+
});
|
|
139
141
|
}
|
|
@@ -11,6 +11,8 @@ var _icons = require("./icons");
|
|
|
11
11
|
|
|
12
12
|
var _react = require("react");
|
|
13
13
|
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
14
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
17
|
|
|
16
18
|
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."); }
|
|
@@ -49,21 +51,23 @@ function RatingWithSingleValue(_ref) {
|
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
return /*#__PURE__*/
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
55
|
+
children: _icons.icons.map(function (icon) {
|
|
56
|
+
icon.icon.props.width = size;
|
|
57
|
+
icon.icon.props.height = size;
|
|
58
|
+
|
|
59
|
+
icon.icon.props.onClick = function () {
|
|
60
|
+
return handleClick(icon.id);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.RatingWrapper, {
|
|
64
|
+
disabled: disabled,
|
|
65
|
+
"data-testid": "rating-wrapper",
|
|
66
|
+
active: icon.id === currentValue,
|
|
67
|
+
primaryColor: primaryColor,
|
|
68
|
+
secondaryColor: secondaryColor,
|
|
69
|
+
children: icon.icon
|
|
70
|
+
}, icon.id);
|
|
71
|
+
})
|
|
72
|
+
});
|
|
69
73
|
}
|