@pedidopago/ui 1.3.4 → 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/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/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +24 -19
- package/package.json +1 -1
|
@@ -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/Select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAOpB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAOpB,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,QAAA,MAAM,MAAM,kJA4KX,CAAC;AAGF,eAAe,MAAM,CAAC"}
|
|
@@ -9,6 +9,8 @@ var _react = require("react");
|
|
|
9
9
|
|
|
10
10
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
11
11
|
|
|
12
|
+
var _ReactPortal = require("../ReactPortal");
|
|
13
|
+
|
|
12
14
|
var _Typography = _interopRequireDefault(require("../Typography"));
|
|
13
15
|
|
|
14
16
|
var _OptionsSelect = require("./components/OptionsSelect");
|
|
@@ -211,27 +213,30 @@ var Select = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
211
213
|
ref: inputRef,
|
|
212
214
|
tabIndex: -1
|
|
213
215
|
}, rest))]
|
|
214
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
},
|
|
225
|
-
children: placeholder
|
|
226
|
-
}), options.map(function (option, i) {
|
|
227
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Option, {
|
|
228
|
-
sizeSelect: sizeSelect,
|
|
216
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ReactPortal.ReactPortal, {
|
|
217
|
+
wrapperId: "portal-root",
|
|
218
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OptionsSelect.OptionsSelect, {
|
|
219
|
+
open: optionsMenuOpen,
|
|
220
|
+
left: "".concat((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.getBoundingClientRect().left, "px"),
|
|
221
|
+
top: Number(positionContainer) < 470 ? "calc(".concat(((_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.getBoundingClientRect().bottom) || 0, "px + 10px)") : "calc(".concat(((_containerRef$current5 = containerRef.current) === null || _containerRef$current5 === void 0 ? void 0 : _containerRef$current5.getBoundingClientRect().top) || 0, "px - ").concat(heightModal && heightModal + 10, "px)"),
|
|
222
|
+
ref: optionsModalRef,
|
|
223
|
+
maxWidth: "".concat((_containerRef$current6 = containerRef.current) === null || _containerRef$current6 === void 0 ? void 0 : _containerRef$current6.getBoundingClientRect().width, "px"),
|
|
224
|
+
children: [!!placeholder && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.OptionPlaceholder, {
|
|
225
|
+
item: true,
|
|
229
226
|
onClick: function onClick() {
|
|
230
|
-
selectOption(
|
|
227
|
+
return selectOption(undefined);
|
|
231
228
|
},
|
|
232
|
-
children:
|
|
233
|
-
}, option
|
|
234
|
-
|
|
229
|
+
children: placeholder
|
|
230
|
+
}), options.map(function (option, i) {
|
|
231
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Option, {
|
|
232
|
+
sizeSelect: sizeSelect,
|
|
233
|
+
onClick: function onClick() {
|
|
234
|
+
selectOption(i);
|
|
235
|
+
},
|
|
236
|
+
children: option.label
|
|
237
|
+
}, option.value);
|
|
238
|
+
})]
|
|
239
|
+
})
|
|
235
240
|
})]
|
|
236
241
|
});
|
|
237
242
|
});
|