@pedidopago/ui 1.3.2 → 1.3.5
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/index.d.ts.map +1 -1
- package/dist/components/Alert/index.js +2 -3
- package/dist/components/Alert/styles.d.ts +1 -1
- package/dist/components/Alert/styles.d.ts.map +1 -1
- package/dist/components/Alert/styles.js +1 -3
- package/dist/components/Alert/types.d.ts +1 -1
- package/dist/components/Alert/types.d.ts.map +1 -1
- package/dist/components/Button/Button.test.js +1 -1
- package/dist/components/Button/index.d.ts +3 -4
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +14 -18
- package/dist/components/Button/styles.d.ts +3 -3
- package/dist/components/Button/styles.d.ts.map +1 -1
- package/dist/components/Button/styles.js +42 -43
- package/dist/components/Button/types.d.ts +10 -13
- package/dist/components/Button/types.d.ts.map +1 -1
- package/dist/components/DateInput/styles.d.ts.map +1 -1
- package/dist/components/DateInput/styles.js +1 -1
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +10 -10
- package/dist/components/Input/styles.d.ts.map +1 -1
- package/dist/components/Input/styles.js +22 -18
- package/dist/components/Modal/ModalExample.d.ts +4 -0
- package/dist/components/Modal/ModalExample.d.ts.map +1 -0
- package/dist/components/Modal/ModalExample.js +66 -0
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.js +11 -13
- package/dist/components/Modal/modal.test.js +11 -9
- package/dist/components/MultipleSelect/MultipleSelect.test.js +9 -9
- package/dist/components/MultipleSelect/components/OptionsArea/index.js +4 -4
- package/dist/components/MultipleSelect/components/SelectArea/index.js +4 -4
- package/dist/components/MultipleSelect/index.d.ts.map +1 -1
- package/dist/components/MultipleSelect/index.js +1 -1
- package/dist/components/MultipleSelect/types.d.ts +1 -1
- package/dist/components/MultipleSelect/types.d.ts.map +1 -1
- package/dist/components/Pagination/index.d.ts.map +1 -1
- package/dist/components/Pagination/index.js +23 -10
- package/dist/components/Pagination/styles.js +3 -2
- package/dist/components/ReactPortal/index.d.ts +8 -0
- package/dist/components/ReactPortal/index.d.ts.map +1 -0
- package/dist/components/ReactPortal/index.js +58 -0
- package/dist/components/ReactPortal/reactPortal.test.d.ts +2 -0
- package/dist/components/ReactPortal/reactPortal.test.d.ts.map +1 -0
- package/dist/components/ReactPortal/reactPortal.test.js +26 -0
- package/dist/components/ReactPortal/utils/createWrapperAndApprendToBody.d.ts +2 -0
- package/dist/components/ReactPortal/utils/createWrapperAndApprendToBody.d.ts.map +1 -0
- package/dist/components/ReactPortal/utils/createWrapperAndApprendToBody.js +13 -0
- package/dist/components/Select/components/OptionsSelect/index.d.ts +4 -0
- package/dist/components/Select/components/OptionsSelect/index.d.ts.map +1 -0
- package/dist/components/Select/components/OptionsSelect/index.js +91 -0
- package/dist/components/Select/components/OptionsSelect/styles.d.ts +265 -0
- package/dist/components/Select/components/OptionsSelect/styles.d.ts.map +1 -0
- package/dist/components/Select/components/OptionsSelect/styles.js +32 -0
- package/dist/components/Select/components/OptionsSelect/types.d.ts +16 -0
- package/dist/components/Select/components/OptionsSelect/types.d.ts.map +1 -0
- package/dist/components/Select/components/OptionsSelect/types.js +1 -0
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +62 -28
- package/dist/components/Select/select.test.js +14 -0
- package/dist/components/Select/styles.d.ts +5 -7
- package/dist/components/Select/styles.d.ts.map +1 -1
- package/dist/components/Select/styles.js +26 -16
- package/dist/components/Select/types.d.ts +7 -2
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/components/Table/styles.d.ts.map +1 -1
- package/dist/components/Table/styles.js +8 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/package.json +2 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ModalExample = ModalExample;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _ = require(".");
|
|
11
|
+
|
|
12
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
|
13
|
+
|
|
14
|
+
var _Flex = _interopRequireDefault(require("../Flex"));
|
|
15
|
+
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
|
|
28
|
+
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."); }
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
+
|
|
38
|
+
function ModalExample(props) {
|
|
39
|
+
var _useState = (0, _react.useState)(false),
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
modalOpen = _useState2[0],
|
|
42
|
+
setModalOpen = _useState2[1];
|
|
43
|
+
|
|
44
|
+
function handleModal() {
|
|
45
|
+
setModalOpen(!modalOpen);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
49
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
50
|
+
onClick: handleModal,
|
|
51
|
+
children: "Abrir modal"
|
|
52
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Modal, _objectSpread(_objectSpread({}, props), {}, {
|
|
53
|
+
maxWidth: props.maxWidth || '350px',
|
|
54
|
+
open: props.open || modalOpen,
|
|
55
|
+
onClose: handleModal,
|
|
56
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Flex.default, {
|
|
57
|
+
justifyContent: "center",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
style: {
|
|
60
|
+
height: '350px'
|
|
61
|
+
},
|
|
62
|
+
children: "Eu sou um modal :)"
|
|
63
|
+
})
|
|
64
|
+
}))]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ModalProps } from './types';
|
|
3
|
-
export declare
|
|
3
|
+
export declare const Modal: ({ open, left, top, anchorX, anchorY, offsetX, offsetY, hideScrollBar, hideOverlay, disableScrollOnOpen, maxWidth, maxHeight, onClose, ...rest }: ModalProps) => JSX.Element;
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,KAAK,oJAef,UAAU,gBA+EZ,CAAC"}
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.Modal =
|
|
7
|
-
|
|
8
|
-
var _styles = require("./styles");
|
|
6
|
+
exports.Modal = void 0;
|
|
9
7
|
|
|
10
8
|
var _react = require("react");
|
|
11
9
|
|
|
@@ -13,7 +11,9 @@ var _useDisableBodyScroll = require("../../shared/hooks/useDisableBodyScroll");
|
|
|
13
11
|
|
|
14
12
|
var _useKeyPress = require("../../shared/hooks/useKeyPress");
|
|
15
13
|
|
|
16
|
-
var
|
|
14
|
+
var _ReactPortal = require("../ReactPortal");
|
|
15
|
+
|
|
16
|
+
var _styles = require("./styles");
|
|
17
17
|
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
19
|
|
|
@@ -29,9 +29,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
29
29
|
|
|
30
30
|
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; }
|
|
31
31
|
|
|
32
|
-
function Modal(_ref) {
|
|
33
|
-
var _containerRef$current, _containerRef$current2;
|
|
34
|
-
|
|
32
|
+
var Modal = function Modal(_ref) {
|
|
35
33
|
var open = _ref.open,
|
|
36
34
|
_ref$left = _ref.left,
|
|
37
35
|
left = _ref$left === void 0 ? '50vw' : _ref$left,
|
|
@@ -56,9 +54,6 @@ function Modal(_ref) {
|
|
|
56
54
|
onClose = _ref.onClose,
|
|
57
55
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
58
56
|
|
|
59
|
-
var _useWindowSize = (0, _useWindowSize2.useWindowSize)(),
|
|
60
|
-
windowHeight = _useWindowSize.height;
|
|
61
|
-
|
|
62
57
|
var containerRef = (0, _react.useRef)(null);
|
|
63
58
|
(0, _useKeyPress.useKeyPress)('Escape', function () {
|
|
64
59
|
return onClose && onClose();
|
|
@@ -114,7 +109,8 @@ function Modal(_ref) {
|
|
|
114
109
|
return "translate(".concat(percentageX, "%, ").concat(percentageY, "%)");
|
|
115
110
|
}
|
|
116
111
|
|
|
117
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
112
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ReactPortal.ReactPortal, {
|
|
113
|
+
wrapperId: "portal-root",
|
|
118
114
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Overlay, {
|
|
119
115
|
style: {
|
|
120
116
|
opacity: open && !hideOverlay ? 0.1 : 0,
|
|
@@ -127,7 +123,7 @@ function Modal(_ref) {
|
|
|
127
123
|
ref: containerRef,
|
|
128
124
|
open: open,
|
|
129
125
|
maxWidth: typeof maxWidth === 'number' ? "".concat(maxWidth, "px") : maxWidth,
|
|
130
|
-
maxHeight:
|
|
126
|
+
maxHeight: typeof maxHeight === 'number' ? "".concat(maxHeight, "px") : maxHeight,
|
|
131
127
|
left: "calc(".concat(left, " + ").concat(offsetX, ")"),
|
|
132
128
|
top: "calc(".concat(top, " + ").concat(offsetY, ")"),
|
|
133
129
|
anchorTranslate: getAnchorTranslate(),
|
|
@@ -140,4 +136,6 @@ function Modal(_ref) {
|
|
|
140
136
|
}))
|
|
141
137
|
})]
|
|
142
138
|
});
|
|
143
|
-
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
exports.Modal = Modal;
|
|
@@ -17,12 +17,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
17
17
|
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
18
|
|
|
19
19
|
function setup(props) {
|
|
20
|
-
var
|
|
20
|
+
var _document$getElementB, _document$getElementB2;
|
|
21
|
+
|
|
22
|
+
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ThemeContext.PPUIThemeProvider, {
|
|
21
23
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Modal, _objectSpread({}, props))
|
|
22
24
|
}));
|
|
23
25
|
return {
|
|
24
|
-
overlay:
|
|
25
|
-
modal:
|
|
26
|
+
overlay: (_document$getElementB = document.getElementById('portal-root')) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.childNodes[0],
|
|
27
|
+
modal: (_document$getElementB2 = document.getElementById('portal-root')) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.childNodes[1]
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -98,7 +100,7 @@ describe('Modal', function () {
|
|
|
98
100
|
})
|
|
99
101
|
});
|
|
100
102
|
expect(modal.modal).toHaveStyle({
|
|
101
|
-
transform: 'translate(0%, -50%)
|
|
103
|
+
transform: 'translate(0%, -50%)'
|
|
102
104
|
});
|
|
103
105
|
});
|
|
104
106
|
it('should display modal with anchorX set to right', function () {
|
|
@@ -111,7 +113,7 @@ describe('Modal', function () {
|
|
|
111
113
|
})
|
|
112
114
|
});
|
|
113
115
|
expect(modal.modal).toHaveStyle({
|
|
114
|
-
transform: 'translate(-100%, -50%)
|
|
116
|
+
transform: 'translate(-100%, -50%)'
|
|
115
117
|
});
|
|
116
118
|
});
|
|
117
119
|
it('should display modal with anchorX set to center', function () {
|
|
@@ -124,7 +126,7 @@ describe('Modal', function () {
|
|
|
124
126
|
})
|
|
125
127
|
});
|
|
126
128
|
expect(modal.modal).toHaveStyle({
|
|
127
|
-
transform: 'translate(-50%, -50%)
|
|
129
|
+
transform: 'translate(-50%, -50%)'
|
|
128
130
|
});
|
|
129
131
|
});
|
|
130
132
|
it('should display modal with anchorY set to top', function () {
|
|
@@ -137,7 +139,7 @@ describe('Modal', function () {
|
|
|
137
139
|
})
|
|
138
140
|
});
|
|
139
141
|
expect(modal.modal).toHaveStyle({
|
|
140
|
-
transform: 'translate(-50%, 0%)
|
|
142
|
+
transform: 'translate(-50%, 0%)'
|
|
141
143
|
});
|
|
142
144
|
});
|
|
143
145
|
it('should display modal with anchorY set to bottom', function () {
|
|
@@ -150,7 +152,7 @@ describe('Modal', function () {
|
|
|
150
152
|
})
|
|
151
153
|
});
|
|
152
154
|
expect(modal.modal).toHaveStyle({
|
|
153
|
-
transform: 'translate(-50%, -100%)
|
|
155
|
+
transform: 'translate(-50%, -100%)'
|
|
154
156
|
});
|
|
155
157
|
});
|
|
156
158
|
it('should display modal with anchorY set to center', function () {
|
|
@@ -163,7 +165,7 @@ describe('Modal', function () {
|
|
|
163
165
|
})
|
|
164
166
|
});
|
|
165
167
|
expect(modal.modal).toHaveStyle({
|
|
166
|
-
transform: 'translate(-50%, -50%)
|
|
168
|
+
transform: 'translate(-50%, -50%)'
|
|
167
169
|
});
|
|
168
170
|
});
|
|
169
171
|
it('should display modal with maxWidth', function () {
|
|
@@ -32,28 +32,28 @@ var doIt = function doIt(func, times) {
|
|
|
32
32
|
|
|
33
33
|
var setup = function setup(props) {
|
|
34
34
|
var mockData = [{
|
|
35
|
-
|
|
35
|
+
label: 'batata01',
|
|
36
36
|
value: 'Batata01'
|
|
37
37
|
}, {
|
|
38
|
-
|
|
38
|
+
label: 'batata02',
|
|
39
39
|
value: 'Batata02'
|
|
40
40
|
}, {
|
|
41
|
-
|
|
41
|
+
label: 'batata03',
|
|
42
42
|
value: 'Batata03'
|
|
43
43
|
}, {
|
|
44
|
-
|
|
44
|
+
label: 'batata04',
|
|
45
45
|
value: 'Batata04'
|
|
46
46
|
}, {
|
|
47
|
-
|
|
47
|
+
label: 'batata05',
|
|
48
48
|
value: 'Batata05'
|
|
49
49
|
}, {
|
|
50
|
-
|
|
50
|
+
label: 'batata06',
|
|
51
51
|
value: 'Batata06'
|
|
52
52
|
}, {
|
|
53
|
-
|
|
53
|
+
label: 'batata07',
|
|
54
54
|
value: 'Batata07'
|
|
55
55
|
}, {
|
|
56
|
-
|
|
56
|
+
label: 'batata08',
|
|
57
57
|
value: 'Batata08'
|
|
58
58
|
}];
|
|
59
59
|
var utils = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, _objectSpread({
|
|
@@ -283,7 +283,7 @@ describe('SelectInput', function () {
|
|
|
283
283
|
maxSelects: 5,
|
|
284
284
|
disabled: true,
|
|
285
285
|
defaultSelectedOptions: [{
|
|
286
|
-
|
|
286
|
+
label: 'test',
|
|
287
287
|
value: 'Teste'
|
|
288
288
|
}]
|
|
289
289
|
}),
|
|
@@ -55,10 +55,10 @@ function OptionsArea(_ref) {
|
|
|
55
55
|
(0, _react.useEffect)(function () {
|
|
56
56
|
if (data.length > 0) {
|
|
57
57
|
var selectedOptionsNames = selectedOptions.map(function (option) {
|
|
58
|
-
return option.
|
|
58
|
+
return option.label;
|
|
59
59
|
});
|
|
60
60
|
var newDataWithoutChosen = data.map(function (option) {
|
|
61
|
-
return !selectedOptionsNames.includes(option.
|
|
61
|
+
return !selectedOptionsNames.includes(option.label) ? option : [];
|
|
62
62
|
}).flat();
|
|
63
63
|
var newDataToShow = AutoComplete ? newDataWithoutChosen.map(function (option) {
|
|
64
64
|
return option.value.includes(AutoCompleteState) ? option : [];
|
|
@@ -138,8 +138,8 @@ function OptionsArea(_ref) {
|
|
|
138
138
|
onKeyDown: function onKeyDown(e) {
|
|
139
139
|
return e.key === 'Enter' && chooseOption(option);
|
|
140
140
|
},
|
|
141
|
-
children: option.
|
|
142
|
-
}, "".concat(option.
|
|
141
|
+
children: option.label
|
|
142
|
+
}, "".concat(option.label).concat(index));
|
|
143
143
|
}), AutoCompleteState.length > 0 && dataToShow.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_OptionsArea.Span, {
|
|
144
144
|
children: "Sem Resultados"
|
|
145
145
|
})]
|
|
@@ -51,17 +51,17 @@ function SelectArea(_ref) {
|
|
|
51
51
|
return removeSelectedOption(e, option);
|
|
52
52
|
},
|
|
53
53
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectedOptionsArea.SelectedOptionText, {
|
|
54
|
-
children: option.
|
|
54
|
+
children: option.label
|
|
55
55
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
56
56
|
name: "x-circle",
|
|
57
57
|
size: "12px"
|
|
58
58
|
})]
|
|
59
|
-
}, option.
|
|
59
|
+
}, option.label);
|
|
60
60
|
}) : selectedOptions.map(function (option) {
|
|
61
61
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectedOptionsArea.SelectedSingleOption, {
|
|
62
62
|
"data-testid": "select-area--selected-option",
|
|
63
|
-
children: option.
|
|
64
|
-
}, option.
|
|
63
|
+
children: option.label
|
|
64
|
+
}, option.label);
|
|
65
65
|
})
|
|
66
66
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ButtonsArea.ButtonsArea, {
|
|
67
67
|
disabled: disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MultipleSelect/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,EAAE,EAOH,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MultipleSelect/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,EAAE,EAOH,MAAM,OAAO,CAAC;AAEf,OAAO,EAAa,iBAAiB,EAAc,MAAM,SAAS,CAAC;AAEnE,aAAK,KAAK,GAAG,wBAAwB,CAAC,GAAG,CAAC,CAAC;AAI3C,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,iBAAiB,GAAG,KAAK,CAuIjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -99,7 +99,7 @@ var MultipleSelect = function MultipleSelect(_ref) {
|
|
|
99
99
|
var newSelectedOptions = _toConsumableArray(selectedOptions);
|
|
100
100
|
|
|
101
101
|
var indexToRemove = selectedOptions.findIndex(function (chosenOption) {
|
|
102
|
-
return chosenOption.
|
|
102
|
+
return chosenOption.label === option.label;
|
|
103
103
|
});
|
|
104
104
|
newSelectedOptions.splice(indexToRemove, 1);
|
|
105
105
|
setSelectedOptions(newSelectedOptions);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { ExtendThemeProps } from 'src';
|
|
3
3
|
export declare type SelectData = {
|
|
4
|
-
|
|
4
|
+
label: string;
|
|
5
5
|
value: string;
|
|
6
6
|
};
|
|
7
7
|
export declare type AlertType = 'informative' | 'success' | 'error' | 'warning' | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/MultipleSelect/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAEvC,oBAAY,UAAU,GAAG;IACvB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/MultipleSelect/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAEvC,oBAAY,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAEpF,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC1B,sBAAsB,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC3C,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAClD,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Pagination/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Pagination/index.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,kBAAmC,EACnC,cAAgC,EAChC,UAAU,EACV,WAAW,EACX,IAAc,EACd,KAAiB,EACjB,OAAoB,EACpB,KAAK,GACN,EAAE,gBAAgB,sBA2HlB"}
|
|
@@ -11,11 +11,13 @@ var _Icon = _interopRequireDefault(require("../Icon"));
|
|
|
11
11
|
|
|
12
12
|
var _colorToGray = require("../../utils/colorToGray");
|
|
13
13
|
|
|
14
|
+
var _useColorMode2 = require("../../shared/theme/hooks/useColorMode");
|
|
15
|
+
|
|
14
16
|
var _usePagination = require("./hooks/usePagination");
|
|
15
17
|
|
|
16
18
|
var _styles = require("./styles");
|
|
17
19
|
|
|
18
|
-
var
|
|
20
|
+
var _theme = require("../../shared/theme");
|
|
19
21
|
|
|
20
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
23
|
|
|
@@ -70,7 +72,12 @@ function Pagination(_ref) {
|
|
|
70
72
|
nextButtonDisabled = _useState6[0],
|
|
71
73
|
setNextButtonDisabled = _useState6[1];
|
|
72
74
|
|
|
73
|
-
var
|
|
75
|
+
var _useTheme = (0, _theme.useTheme)(),
|
|
76
|
+
theme = _useTheme.theme;
|
|
77
|
+
|
|
78
|
+
var _useColorMode = (0, _useColorMode2.useColorMode)(),
|
|
79
|
+
colorMode = _useColorMode.colorMode;
|
|
80
|
+
|
|
74
81
|
(0, _react.useEffect)(function () {
|
|
75
82
|
if (activePage !== count) {
|
|
76
83
|
setNextButtonDisabled(false);
|
|
@@ -89,12 +96,18 @@ function Pagination(_ref) {
|
|
|
89
96
|
var themeColor = theme.colors.primary.default;
|
|
90
97
|
|
|
91
98
|
var _convertColor = (0, _colorToGray.convertColor)(color || themeColor),
|
|
92
|
-
|
|
99
|
+
neutral2 = _convertColor.neutral2,
|
|
100
|
+
neutral5 = _convertColor.neutral5;
|
|
101
|
+
|
|
102
|
+
var grayColorByTheme = {
|
|
103
|
+
dark: neutral5,
|
|
104
|
+
light: neutral2
|
|
105
|
+
}[colorMode] || neutral2;
|
|
93
106
|
|
|
94
|
-
var
|
|
95
|
-
h =
|
|
96
|
-
s =
|
|
97
|
-
l =
|
|
107
|
+
var _grayColorByTheme = _slicedToArray(grayColorByTheme, 3),
|
|
108
|
+
h = _grayColorByTheme[0],
|
|
109
|
+
s = _grayColorByTheme[1],
|
|
110
|
+
l = _grayColorByTheme[2];
|
|
98
111
|
|
|
99
112
|
var grayColor = "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)");
|
|
100
113
|
var saturationColor = "hsl(".concat(h, ", ", 12, "%, ", 39, "%)");
|
|
@@ -105,7 +118,7 @@ function Pagination(_ref) {
|
|
|
105
118
|
numberOfPageColor: numberOfPageColor,
|
|
106
119
|
themeColor: themeColor
|
|
107
120
|
};
|
|
108
|
-
}, [color]),
|
|
121
|
+
}, [color, theme]),
|
|
109
122
|
grayColor = _useMemo.grayColor,
|
|
110
123
|
numberOfPageColor = _useMemo.numberOfPageColor,
|
|
111
124
|
saturationColor = _useMemo.saturationColor,
|
|
@@ -179,7 +192,7 @@ function Pagination(_ref) {
|
|
|
179
192
|
disabled: previousButtonDisabled || isDisabled,
|
|
180
193
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
181
194
|
name: previousButtonIcon,
|
|
182
|
-
size:
|
|
195
|
+
size: 22
|
|
183
196
|
})
|
|
184
197
|
}), size === 'large' && LargeView(), size === 'small' && SmallView(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.NextNavigationButton, {
|
|
185
198
|
shape: shape,
|
|
@@ -190,7 +203,7 @@ function Pagination(_ref) {
|
|
|
190
203
|
disabled: nextButtonDisabled || isDisabled,
|
|
191
204
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
192
205
|
name: nextButtonIcon,
|
|
193
|
-
size:
|
|
206
|
+
size: 22
|
|
194
207
|
})
|
|
195
208
|
})]
|
|
196
209
|
});
|
|
@@ -77,8 +77,9 @@ var NextNavigationButton = _styled.default.button(_templateObject16 || (_templat
|
|
|
77
77
|
exports.NextNavigationButton = NextNavigationButton;
|
|
78
78
|
|
|
79
79
|
var SmallPageInfo = _styled.default.span(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n font-weight: 600;\n display: block;\n min-width: 60px;\n font-size: 16px;\n line-height: 1.5;\n color: ", ";\n margin: 0 24px;\n"])), function (_ref7) {
|
|
80
|
-
var
|
|
81
|
-
|
|
80
|
+
var grayColor = _ref7.grayColor,
|
|
81
|
+
theme = _ref7.theme;
|
|
82
|
+
return grayColor || theme.colors.tertiary.default;
|
|
82
83
|
});
|
|
83
84
|
|
|
84
85
|
exports.SmallPageInfo = SmallPageInfo;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface ReactPortalProps {
|
|
3
|
+
wrapperId: string;
|
|
4
|
+
children: ReactNode | ReactNode[] | JSX.Element | JSX.Element[];
|
|
5
|
+
}
|
|
6
|
+
export declare function ReactPortal({ children, wrapperId }: ReactPortalProps): import("react").ReactPortal | null;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ReactPortal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAC;AAI7D,UAAU,gBAAgB;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;CACjE;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAyB,EAAE,EAAE,gBAAgB,sCAsBpF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ReactPortal = ReactPortal;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _reactDom = require("react-dom");
|
|
11
|
+
|
|
12
|
+
var _createWrapperAndApprendToBody = require("./utils/createWrapperAndApprendToBody");
|
|
13
|
+
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
16
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
+
|
|
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."); }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
|
+
|
|
28
|
+
function ReactPortal(_ref) {
|
|
29
|
+
var children = _ref.children,
|
|
30
|
+
_ref$wrapperId = _ref.wrapperId,
|
|
31
|
+
wrapperId = _ref$wrapperId === void 0 ? 'portal-root' : _ref$wrapperId;
|
|
32
|
+
|
|
33
|
+
var _useState = (0, _react.useState)(null),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
wrapperElement = _useState2[0],
|
|
36
|
+
setWrapperElement = _useState2[1];
|
|
37
|
+
|
|
38
|
+
(0, _react.useLayoutEffect)(function () {
|
|
39
|
+
var element = document.getElementById(wrapperId);
|
|
40
|
+
var systemCreated = false;
|
|
41
|
+
|
|
42
|
+
if (!element) {
|
|
43
|
+
systemCreated = true;
|
|
44
|
+
element = (0, _createWrapperAndApprendToBody.createWrapperAndAppendToBody)(wrapperId);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
setWrapperElement(element);
|
|
48
|
+
return function () {
|
|
49
|
+
if (systemCreated && element.parentNode) {
|
|
50
|
+
element.parentNode.removeChild(element);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}, [wrapperId]);
|
|
54
|
+
if (wrapperElement === null) return null;
|
|
55
|
+
return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
56
|
+
children: children
|
|
57
|
+
}), wrapperElement);
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactPortal.test.d.ts","sourceRoot":"","sources":["../../../src/components/ReactPortal/reactPortal.test.tsx"],"names":[],"mappings":"AAEA,OAAO,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _testUtils = require("../../shared/tests/test-utils");
|
|
4
|
+
|
|
5
|
+
var _ = require(".");
|
|
6
|
+
|
|
7
|
+
require("@testing-library/jest-dom");
|
|
8
|
+
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
|
|
11
|
+
function setup() {
|
|
12
|
+
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ReactPortal, {
|
|
13
|
+
wrapperId: "portal-test",
|
|
14
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
15
|
+
children: "Teste"
|
|
16
|
+
})
|
|
17
|
+
}));
|
|
18
|
+
return document.body.querySelector('#portal-test');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe('ReactPortal test', function () {
|
|
22
|
+
it('Should render a div inside body', function () {
|
|
23
|
+
var divPortal = setup();
|
|
24
|
+
expect(divPortal).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createWrapperAndApprendToBody.d.ts","sourceRoot":"","sources":["../../../../src/components/ReactPortal/utils/createWrapperAndApprendToBody.ts"],"names":[],"mappings":"AAAA,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,kBAK7D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createWrapperAndAppendToBody = createWrapperAndAppendToBody;
|
|
7
|
+
|
|
8
|
+
function createWrapperAndAppendToBody(wrapperId) {
|
|
9
|
+
var wrapperElement = document.createElement('div');
|
|
10
|
+
wrapperElement.setAttribute('id', wrapperId);
|
|
11
|
+
document.body.appendChild(wrapperElement);
|
|
12
|
+
return wrapperElement;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Select/components/OptionsSelect/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,eAAO,MAAM,aAAa,+GAqDzB,CAAC"}
|