@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
|
@@ -13,11 +13,17 @@ var _Skeleton = _interopRequireDefault(require("../Skeleton"));
|
|
|
13
13
|
|
|
14
14
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
15
15
|
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
|
|
16
18
|
var _excluded = ["placeholder", "type", "disabled", "isLoading", "label", "labelBackground", "withIcon", "hiddenContent", "helperText", "alert", "withAddon", "addonContent"];
|
|
17
19
|
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
29
|
|
|
@@ -68,49 +74,70 @@ var Input = function Input(_ref) {
|
|
|
68
74
|
setHiddenInfo(!hiddenInfo);
|
|
69
75
|
}
|
|
70
76
|
|
|
71
|
-
return /*#__PURE__*/
|
|
77
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.InputGroupElement, {
|
|
72
78
|
hasValueOnInput: Icon || placeholder || rest.value ? true : hasValueOnInput,
|
|
73
79
|
alert: alert,
|
|
74
80
|
withAddon: withAddon,
|
|
75
81
|
hasDisabled: disabled,
|
|
76
|
-
labelBackground: labelBackground
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
82
|
+
labelBackground: labelBackground,
|
|
83
|
+
children: isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Skeleton.default, {
|
|
84
|
+
variant: "rectangle",
|
|
85
|
+
height: 50,
|
|
86
|
+
animation: "wave"
|
|
87
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
88
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.InputColumn, {
|
|
89
|
+
children: [withAddon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.AddonElement, {
|
|
90
|
+
alert: alert,
|
|
91
|
+
hasDisabled: disabled,
|
|
92
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.AddonContent, {
|
|
93
|
+
children: addonContent
|
|
94
|
+
})
|
|
95
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.InputContent, {
|
|
96
|
+
withAddon: withAddon,
|
|
97
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.InputLabel, {
|
|
98
|
+
hasDisabled: disabled,
|
|
99
|
+
children: label
|
|
100
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.InputContentRow, {
|
|
101
|
+
children: [Icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.InputIcon, {
|
|
102
|
+
children: Icon
|
|
103
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Input, _objectSpread({
|
|
104
|
+
type: hiddenInfo ? 'password' : type,
|
|
105
|
+
"aria-label": label,
|
|
106
|
+
withIcon: Icon,
|
|
107
|
+
hiddenContent: hiddenContent,
|
|
108
|
+
disabled: disabled,
|
|
109
|
+
alert: alert,
|
|
110
|
+
onChange: function onChange(e) {
|
|
111
|
+
return handleInputChange(e.target.value);
|
|
112
|
+
},
|
|
113
|
+
placeholder: placeholder
|
|
114
|
+
}, rest)), hiddenContent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.InputIcon, {
|
|
115
|
+
clickable: true,
|
|
116
|
+
onClick: handleHiddenChange,
|
|
117
|
+
children: hiddenInfo ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
118
|
+
name: "eye"
|
|
119
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
120
|
+
name: "eye-off"
|
|
121
|
+
})
|
|
122
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Fieldset, {
|
|
123
|
+
"aria-hidden": true,
|
|
124
|
+
hasDisabled: disabled,
|
|
125
|
+
withAddon: withAddon,
|
|
126
|
+
alert: alert,
|
|
127
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Legend, {
|
|
128
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.LegendText, {
|
|
129
|
+
children: label
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
})]
|
|
133
|
+
})]
|
|
134
|
+
})]
|
|
135
|
+
}), helperText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.HelperText, {
|
|
136
|
+
alert: alert,
|
|
137
|
+
children: helperText
|
|
138
|
+
})]
|
|
139
|
+
})
|
|
140
|
+
});
|
|
114
141
|
};
|
|
115
142
|
|
|
116
143
|
var _default = Input;
|
|
@@ -10,6 +10,8 @@ var _ = _interopRequireDefault(require("."));
|
|
|
10
10
|
|
|
11
11
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
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
|
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; }
|
|
@@ -18,10 +20,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
18
20
|
|
|
19
21
|
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; }
|
|
20
22
|
|
|
21
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
22
|
-
|
|
23
23
|
var setup = function setup(props) {
|
|
24
|
-
var utils = (0, _testUtils.render)( /*#__PURE__*/
|
|
24
|
+
var utils = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, _objectSpread({
|
|
25
25
|
"data-testid": "input-component"
|
|
26
26
|
}, props)));
|
|
27
27
|
var input = utils.getByLabelText(props.label);
|
|
@@ -58,7 +58,7 @@ describe('Input', function () {
|
|
|
58
58
|
|
|
59
59
|
var _setup3 = setup({
|
|
60
60
|
label: 'E-mail',
|
|
61
|
-
withIcon: /*#__PURE__*/
|
|
61
|
+
withIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
62
62
|
name: "search",
|
|
63
63
|
color: "neutral.neutral4"
|
|
64
64
|
})
|
|
@@ -15,6 +15,8 @@ var _allIcons = require("../Icon/utils/allIcons");
|
|
|
15
15
|
|
|
16
16
|
var _invertColor = require("../../utils/invertColor");
|
|
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
|
var LabelInput = function LabelInput(_ref) {
|
|
@@ -34,17 +36,18 @@ var LabelInput = function LabelInput(_ref) {
|
|
|
34
36
|
|
|
35
37
|
var backgroundColor = LabelType ? theme.colors[LabelType].blurred : Color || (theme.colorMode === 'dark' ? theme.colors.neutral.neutral5 : theme.colors.neutral.neutral1);
|
|
36
38
|
var color = (0, _invertColor.invertColor)(backgroundColor || '#fff', true);
|
|
37
|
-
return /*#__PURE__*/
|
|
39
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.LabelWrapper, {
|
|
38
40
|
backgroundColor: backgroundColor,
|
|
39
41
|
color: color,
|
|
40
|
-
"data-testid": "label-wrapper"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
"data-testid": "label-wrapper",
|
|
43
|
+
children: [Icon && IconSide === 'left' && iconExists() && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
44
|
+
name: Icon,
|
|
45
|
+
size: "16px"
|
|
46
|
+
}), Label || 'default', Icon && IconSide === 'right' && iconExists() && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
47
|
+
name: Icon,
|
|
48
|
+
size: "16px"
|
|
49
|
+
})]
|
|
50
|
+
});
|
|
48
51
|
};
|
|
49
52
|
|
|
50
53
|
var _default = LabelInput;
|
|
@@ -6,6 +6,8 @@ require("@testing-library/jest-dom/extend-expect");
|
|
|
6
6
|
|
|
7
7
|
var _ = _interopRequireDefault(require("."));
|
|
8
8
|
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
|
|
9
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
12
|
|
|
11
13
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
@@ -19,7 +21,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
19
21
|
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; }
|
|
20
22
|
|
|
21
23
|
var setup = function setup(props) {
|
|
22
|
-
var utils = (0, _testUtils.render)( /*#__PURE__*/
|
|
24
|
+
var utils = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, _objectSpread({}, props)));
|
|
23
25
|
var LabelWrapper = utils.getByTestId('label-wrapper');
|
|
24
26
|
return _objectSpread({
|
|
25
27
|
LabelWrapper: LabelWrapper
|
|
@@ -7,9 +7,15 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _styles = require("./styles");
|
|
9
9
|
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
|
|
10
12
|
var _excluded = ["title", "item", "maxHeight", "children"];
|
|
11
13
|
|
|
12
|
-
function
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
13
19
|
|
|
14
20
|
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; }
|
|
15
21
|
|
|
@@ -22,9 +28,14 @@ var List = function List(_ref) {
|
|
|
22
28
|
children = _ref.children,
|
|
23
29
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
24
30
|
|
|
25
|
-
return item ? /*#__PURE__*/
|
|
26
|
-
|
|
27
|
-
})
|
|
31
|
+
return item ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StyledListItem, _objectSpread(_objectSpread({}, rest), {}, {
|
|
32
|
+
children: children
|
|
33
|
+
})) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.StyledList, _objectSpread(_objectSpread({}, rest), {}, {
|
|
34
|
+
maxHeight: maxHeight,
|
|
35
|
+
children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StyledListTitle, {
|
|
36
|
+
children: title
|
|
37
|
+
}), children]
|
|
38
|
+
}));
|
|
28
39
|
};
|
|
29
40
|
|
|
30
41
|
var _default = List;
|
|
@@ -8,44 +8,62 @@ var _ = _interopRequireDefault(require("."));
|
|
|
8
8
|
|
|
9
9
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
10
10
|
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
|
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
14
|
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
19
|
+
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; }
|
|
20
|
+
|
|
13
21
|
var setup = function setup(props) {
|
|
14
|
-
var utils = (0, _testUtils.render)( /*#__PURE__*/
|
|
22
|
+
var utils = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, _objectSpread(_objectSpread({}, props), {}, {
|
|
23
|
+
children: props.children
|
|
24
|
+
})));
|
|
15
25
|
return utils;
|
|
16
26
|
};
|
|
17
27
|
|
|
18
28
|
describe('List', function () {
|
|
19
29
|
it('should to render list component', function () {
|
|
20
30
|
var utils = setup({
|
|
21
|
-
children: /*#__PURE__*/
|
|
22
|
-
item: true
|
|
23
|
-
|
|
31
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
32
|
+
item: true,
|
|
33
|
+
children: "Item 1"
|
|
34
|
+
})
|
|
24
35
|
});
|
|
25
36
|
expect(utils.container).toBeInTheDocument();
|
|
26
37
|
});
|
|
27
38
|
it('should to render list component with an icon', function () {
|
|
28
39
|
var utils = setup({
|
|
29
|
-
children: /*#__PURE__*/
|
|
30
|
-
item: true
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.default, {
|
|
41
|
+
item: true,
|
|
42
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
43
|
+
name: "check"
|
|
44
|
+
}), " Item 1"]
|
|
45
|
+
})
|
|
34
46
|
});
|
|
35
47
|
expect(utils.container).toBeInTheDocument();
|
|
36
48
|
expect(utils.container.querySelector('svg')).toBeInTheDocument();
|
|
37
49
|
});
|
|
38
50
|
it('should to render list with multiply items', function () {
|
|
39
51
|
var utils = setup({
|
|
40
|
-
children: /*#__PURE__*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
53
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
54
|
+
item: true,
|
|
55
|
+
children: " item 1"
|
|
56
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
57
|
+
item: true,
|
|
58
|
+
children: " item 2"
|
|
59
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
60
|
+
item: true,
|
|
61
|
+
children: " item 3"
|
|
62
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
63
|
+
item: true,
|
|
64
|
+
children: " item 4"
|
|
65
|
+
})]
|
|
66
|
+
})
|
|
49
67
|
});
|
|
50
68
|
expect(utils.container).toBeInTheDocument();
|
|
51
69
|
expect(utils.container.querySelectorAll('li').length).toBe(4);
|
|
@@ -11,6 +11,8 @@ var _Skeleton = _interopRequireDefault(require("../../../components/Skeleton"));
|
|
|
11
11
|
|
|
12
12
|
var _styles = require("../styles");
|
|
13
13
|
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
|
|
16
18
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -41,32 +43,53 @@ var Submenu = function Submenu(_ref) {
|
|
|
41
43
|
return setSubnav(!subnav);
|
|
42
44
|
};
|
|
43
45
|
|
|
44
|
-
return /*#__PURE__*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
47
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.SidebarLink, {
|
|
48
|
+
href: item === null || item === void 0 ? void 0 : item.path,
|
|
49
|
+
onClick: showSubnav,
|
|
50
|
+
"data-testid": "submenu-item",
|
|
51
|
+
disabled: disabled,
|
|
52
|
+
isLoading: isLoading,
|
|
53
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
54
|
+
children: isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Skeleton.default, {
|
|
55
|
+
width: 200
|
|
56
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
57
|
+
children: [item === null || item === void 0 ? void 0 : item.icon, /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SidebarLabel, {
|
|
58
|
+
children: item === null || item === void 0 ? void 0 : item.title
|
|
59
|
+
})]
|
|
60
|
+
})
|
|
61
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
62
|
+
children: item !== null && item !== void 0 && item.subnav && subnav ? item === null || item === void 0 ? void 0 : item.iconOpened : item === null || item === void 0 ? void 0 : item.iconClosed
|
|
63
|
+
})]
|
|
64
|
+
}), subnav && (item === null || item === void 0 ? void 0 : (_item$subnav = item.subnav) === null || _item$subnav === void 0 ? void 0 : _item$subnav.map(function (subnavItem, index) {
|
|
65
|
+
if (isLoading) {
|
|
66
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.DropdownLink, {
|
|
67
|
+
href: subnavItem.path,
|
|
68
|
+
disabled: disabled,
|
|
69
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Skeleton.default, {
|
|
70
|
+
width: 200
|
|
71
|
+
})
|
|
72
|
+
}, index);
|
|
73
|
+
} else {
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.DropdownLink, {
|
|
75
|
+
href: subnavItem.path,
|
|
76
|
+
disabled: disabled,
|
|
77
|
+
target: "_blank",
|
|
78
|
+
children: [(subnavItem === null || subnavItem === void 0 ? void 0 : subnavItem.leftIcon) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
79
|
+
children: [subnavItem === null || subnavItem === void 0 ? void 0 : subnavItem.icon, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.SidebarLabel, {
|
|
80
|
+
children: [" ", subnavItem.title, " "]
|
|
81
|
+
})]
|
|
82
|
+
}), (subnavItem === null || subnavItem === void 0 ? void 0 : subnavItem.rightIcon) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
83
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.SidebarLabel, {
|
|
84
|
+
children: [" ", subnavItem.title, " "]
|
|
85
|
+
}), subnavItem === null || subnavItem === void 0 ? void 0 : subnavItem.icon]
|
|
86
|
+
}), !(subnavItem !== null && subnavItem !== void 0 && subnavItem.icon) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SidebarLabel, {
|
|
87
|
+
children: subnavItem.title
|
|
88
|
+
})]
|
|
89
|
+
}, index);
|
|
90
|
+
}
|
|
91
|
+
}))]
|
|
92
|
+
});
|
|
70
93
|
};
|
|
71
94
|
|
|
72
95
|
var _default = Submenu;
|
|
@@ -9,6 +9,10 @@ var _Submenu = _interopRequireDefault(require("./components/Submenu"));
|
|
|
9
9
|
|
|
10
10
|
var _styles = require("./styles");
|
|
11
11
|
|
|
12
|
+
var _react = require("react");
|
|
13
|
+
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
12
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
17
|
|
|
14
18
|
var Menu = function Menu(_ref) {
|
|
@@ -17,17 +21,22 @@ var Menu = function Menu(_ref) {
|
|
|
17
21
|
disabled = _ref.disabled,
|
|
18
22
|
_ref$anchor = _ref.anchor,
|
|
19
23
|
anchor = _ref$anchor === void 0 ? 'left' : _ref$anchor;
|
|
20
|
-
return /*#__PURE__*/
|
|
21
|
-
|
|
22
|
-
}, /*#__PURE__*/React.createElement(_styles.SidebarWrap, null, MenuData && (MenuData === null || MenuData === void 0 ? void 0 : MenuData.map(function (item, index) {
|
|
23
|
-
return /*#__PURE__*/React.createElement(_Submenu.default, {
|
|
24
|
-
item: item,
|
|
25
|
-
isLoading: isLoading,
|
|
26
|
-
disabled: disabled,
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
25
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SidebarNav, {
|
|
27
26
|
anchor: anchor,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SidebarWrap, {
|
|
28
|
+
children: MenuData && (MenuData === null || MenuData === void 0 ? void 0 : MenuData.map(function (item, index) {
|
|
29
|
+
return /*#__PURE__*/(0, _react.createElement)(_Submenu.default, {
|
|
30
|
+
item: item,
|
|
31
|
+
isLoading: isLoading,
|
|
32
|
+
disabled: disabled,
|
|
33
|
+
anchor: anchor,
|
|
34
|
+
key: index
|
|
35
|
+
});
|
|
36
|
+
}))
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
});
|
|
31
40
|
};
|
|
32
41
|
|
|
33
42
|
var _default = Menu;
|
|
@@ -8,6 +8,8 @@ var _ = _interopRequireDefault(require("."));
|
|
|
8
8
|
|
|
9
9
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
10
10
|
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
|
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
14
|
|
|
13
15
|
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; }
|
|
@@ -16,21 +18,19 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
16
18
|
|
|
17
19
|
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; }
|
|
18
20
|
|
|
19
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
20
|
-
|
|
21
21
|
var setup = function setup(props) {
|
|
22
22
|
var data = [{
|
|
23
23
|
title: 'Dashboard',
|
|
24
24
|
path: '/dashboard',
|
|
25
|
-
icon: /*#__PURE__*/
|
|
25
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
26
26
|
name: "home",
|
|
27
27
|
size: "15"
|
|
28
28
|
}),
|
|
29
|
-
iconOpened: /*#__PURE__*/
|
|
29
|
+
iconOpened: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
30
30
|
name: "chevron-down",
|
|
31
31
|
size: "15"
|
|
32
32
|
}),
|
|
33
|
-
iconClosed: /*#__PURE__*/
|
|
33
|
+
iconClosed: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
34
34
|
name: "chevron-right",
|
|
35
35
|
size: "15"
|
|
36
36
|
}),
|
|
@@ -40,7 +40,7 @@ var setup = function setup(props) {
|
|
|
40
40
|
path: '/dashboard/account'
|
|
41
41
|
}]
|
|
42
42
|
}];
|
|
43
|
-
var utils = (0, _testUtils.render)( /*#__PURE__*/
|
|
43
|
+
var utils = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, _objectSpread({
|
|
44
44
|
"data-testid": "component-menu",
|
|
45
45
|
MenuData: data
|
|
46
46
|
}, props)));
|
|
@@ -64,14 +64,14 @@ describe('Menu', function () {
|
|
|
64
64
|
var _renderIcon$baseEleme, _container$parentElem;
|
|
65
65
|
|
|
66
66
|
var _setup2 = setup({
|
|
67
|
-
iconClosed: /*#__PURE__*/
|
|
67
|
+
iconClosed: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
68
68
|
name: "chevron-right",
|
|
69
69
|
size: "15"
|
|
70
70
|
})
|
|
71
71
|
}),
|
|
72
72
|
container = _setup2.container;
|
|
73
73
|
|
|
74
|
-
var renderIcon = (0, _testUtils.render)( /*#__PURE__*/
|
|
74
|
+
var renderIcon = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
75
75
|
name: "chevron-right",
|
|
76
76
|
size: "15"
|
|
77
77
|
}));
|
|
@@ -96,7 +96,7 @@ describe('Menu', function () {
|
|
|
96
96
|
title: 'Organização',
|
|
97
97
|
path: '/organizacao'
|
|
98
98
|
}];
|
|
99
|
-
var utils = (0, _testUtils.render)( /*#__PURE__*/
|
|
99
|
+
var utils = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
100
100
|
disabled: true,
|
|
101
101
|
MenuData: data
|
|
102
102
|
}));
|
|
@@ -114,7 +114,7 @@ describe('Menu', function () {
|
|
|
114
114
|
path: '/organizacao/submenu'
|
|
115
115
|
}]
|
|
116
116
|
}];
|
|
117
|
-
var utils = (0, _testUtils.render)( /*#__PURE__*/
|
|
117
|
+
var utils = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
118
118
|
isLoading: true,
|
|
119
119
|
MenuData: data
|
|
120
120
|
}));
|
|
@@ -130,7 +130,7 @@ describe('Menu', function () {
|
|
|
130
130
|
path: '/organizacao/submenu'
|
|
131
131
|
}]
|
|
132
132
|
}];
|
|
133
|
-
var utils = (0, _testUtils.render)( /*#__PURE__*/
|
|
133
|
+
var utils = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
134
134
|
MenuData: data,
|
|
135
135
|
anchor: 'top'
|
|
136
136
|
}));
|
|
@@ -146,7 +146,7 @@ describe('Menu', function () {
|
|
|
146
146
|
path: '/organizacao/submenu'
|
|
147
147
|
}]
|
|
148
148
|
}];
|
|
149
|
-
var utils = (0, _testUtils.render)( /*#__PURE__*/
|
|
149
|
+
var utils = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
150
150
|
MenuData: data,
|
|
151
151
|
anchor: 'bottom'
|
|
152
152
|
}));
|
|
@@ -162,7 +162,7 @@ describe('Menu', function () {
|
|
|
162
162
|
path: '/organizacao/submenu'
|
|
163
163
|
}]
|
|
164
164
|
}];
|
|
165
|
-
var utils = (0, _testUtils.render)( /*#__PURE__*/
|
|
165
|
+
var utils = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
166
166
|
MenuData: data,
|
|
167
167
|
anchor: 'left'
|
|
168
168
|
}));
|
|
@@ -178,7 +178,7 @@ describe('Menu', function () {
|
|
|
178
178
|
path: '/organizacao/submenu'
|
|
179
179
|
}]
|
|
180
180
|
}];
|
|
181
|
-
var utils = (0, _testUtils.render)( /*#__PURE__*/
|
|
181
|
+
var utils = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
182
182
|
MenuData: data,
|
|
183
183
|
anchor: 'right'
|
|
184
184
|
}));
|