@occmundial/occ-atomic 2.0.0 → 3.0.0-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +62 -0
- package/build/Autocomplete/Autocomplete.js +2 -5
- package/build/Autocomplete/Autocomplete.test.js +17 -9
- package/build/Autocomplete/styles.js +5 -5
- package/build/Button/Button.js +28 -7
- package/build/Droplist/Droplist.js +37 -49
- package/build/Droplist/Droplist.test.js +2 -2
- package/build/Droplist/__snapshots__/Droplist.test.js.snap +57 -25
- package/build/Droplist/styles.js +62 -32
- package/build/Fab/__snapshots__/Fab.test.js.snap +1 -0
- package/build/Text/styles.js +2 -1
- package/build/TextField/TextField.js +77 -104
- package/build/TextField/TextField.test.js +7 -15
- package/build/TextField/__snapshots__/TextField.test.js.snap +59 -145
- package/build/TextField/styles.js +81 -149
- package/build/tokens/colors.json +38 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
# [3.0.0-beta.1](https://github.com/occmundial/occ-atomic/compare/v2.0.0...v3.0.0-beta.1) (2024-05-27)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Add events to Button ([cbac2b8](https://github.com/occmundial/occ-atomic/commit/cbac2b8a19cc93c76529a2aa4f91a685a5b7f9c7))
|
7
|
+
* Change icon size ([2b6affe](https://github.com/occmundial/occ-atomic/commit/2b6affe0c6a40c080ebd9281dc8b4901aaffe4c4))
|
8
|
+
* Change text component for html tags for text in droplist ([50f4972](https://github.com/occmundial/occ-atomic/commit/50f4972c306351416efe83700a6d4dcffa83f259))
|
9
|
+
* Resolve merge conflicts ([b771fab](https://github.com/occmundial/occ-atomic/commit/b771fab5304a66febe94bc808eb383f7b1d47741))
|
10
|
+
* Update snapshots ([6f32f65](https://github.com/occmundial/occ-atomic/commit/6f32f65188207312c1fa26ce2e4ffd4338ac99cf))
|
11
|
+
|
12
|
+
|
13
|
+
### Features
|
14
|
+
|
15
|
+
* Update Autocomplete styles ([fa449be](https://github.com/occmundial/occ-atomic/commit/fa449be2322c75857e6350ee9dee596cd441b033))
|
16
|
+
* Update droplist styles with new design tokens ([27fdaf2](https://github.com/occmundial/occ-atomic/commit/27fdaf288e82a8493eb05d0315f4385585e71a04))
|
17
|
+
* Update TextField styles ([0d0218e](https://github.com/occmundial/occ-atomic/commit/0d0218ea0df146da1b07482676eb99ad57d186b7))
|
18
|
+
|
19
|
+
|
20
|
+
### BREAKING CHANGES
|
21
|
+
|
22
|
+
* Remove the lockHeight and searchField properties
|
23
|
+
|
1
24
|
# [2.0.0](https://github.com/occmundial/occ-atomic/compare/v1.39.1...v2.0.0) (2024-05-27)
|
2
25
|
|
3
26
|
|
@@ -55,6 +78,45 @@
|
|
55
78
|
|
56
79
|
* The themes of the Button component have changed to match the styles of the button in the new design system. The current themes have slightly different names to the new ones but they all have a corresponding new theme that matches, except for the ghostPink theme.
|
57
80
|
|
81
|
+
# [2.0.0-beta.19](https://github.com/occmundial/occ-atomic/compare/v2.0.0-beta.18...v2.0.0-beta.19) (2024-05-27)
|
82
|
+
|
83
|
+
|
84
|
+
### Features
|
85
|
+
|
86
|
+
* Update Autocomplete styles ([fa449be](https://github.com/occmundial/occ-atomic/commit/fa449be2322c75857e6350ee9dee596cd441b033))
|
87
|
+
|
88
|
+
# [2.0.0-beta.18](https://github.com/occmundial/occ-atomic/compare/v2.0.0-beta.17...v2.0.0-beta.18) (2024-05-21)
|
89
|
+
|
90
|
+
|
91
|
+
### Bug Fixes
|
92
|
+
|
93
|
+
* Change icon size ([2b6affe](https://github.com/occmundial/occ-atomic/commit/2b6affe0c6a40c080ebd9281dc8b4901aaffe4c4))
|
94
|
+
* Change text component for html tags for text in droplist ([50f4972](https://github.com/occmundial/occ-atomic/commit/50f4972c306351416efe83700a6d4dcffa83f259))
|
95
|
+
* Resolve merge conflicts ([b771fab](https://github.com/occmundial/occ-atomic/commit/b771fab5304a66febe94bc808eb383f7b1d47741))
|
96
|
+
* Update snapshots ([6f32f65](https://github.com/occmundial/occ-atomic/commit/6f32f65188207312c1fa26ce2e4ffd4338ac99cf))
|
97
|
+
|
98
|
+
|
99
|
+
### Features
|
100
|
+
|
101
|
+
* Update droplist styles with new design tokens ([27fdaf2](https://github.com/occmundial/occ-atomic/commit/27fdaf288e82a8493eb05d0315f4385585e71a04))
|
102
|
+
|
103
|
+
# [2.0.0-beta.17](https://github.com/occmundial/occ-atomic/compare/v2.0.0-beta.16...v2.0.0-beta.17) (2024-05-21)
|
104
|
+
|
105
|
+
|
106
|
+
### Bug Fixes
|
107
|
+
|
108
|
+
* Add events to Button ([cbac2b8](https://github.com/occmundial/occ-atomic/commit/cbac2b8a19cc93c76529a2aa4f91a685a5b7f9c7))
|
109
|
+
|
110
|
+
|
111
|
+
### Features
|
112
|
+
|
113
|
+
* Update TextField styles ([0d0218e](https://github.com/occmundial/occ-atomic/commit/0d0218ea0df146da1b07482676eb99ad57d186b7))
|
114
|
+
|
115
|
+
|
116
|
+
### BREAKING CHANGES
|
117
|
+
|
118
|
+
* Remove the lockHeight and searchField properties
|
119
|
+
|
58
120
|
# [2.0.0-beta.16](https://github.com/occmundial/occ-atomic/compare/v2.0.0-beta.15...v2.0.0-beta.16) (2024-05-14)
|
59
121
|
|
60
122
|
|
@@ -243,7 +243,8 @@ Autocomplete.propTypes = {
|
|
243
243
|
className: _propTypes["default"].string,
|
244
244
|
inputClassName: _propTypes["default"].string,
|
245
245
|
disabled: _propTypes["default"].bool,
|
246
|
-
testId: _propTypes["default"].string
|
246
|
+
testId: _propTypes["default"].string,
|
247
|
+
disableAutoComplete: _propTypes["default"].bool
|
247
248
|
}).isRequired,
|
248
249
|
|
249
250
|
/** Object with the props for the Droplist component. Check their descriptions in the Droplist docs. */
|
@@ -279,9 +280,6 @@ Autocomplete.propTypes = {
|
|
279
280
|
/** Function to call on mouse down (Droplist item). */
|
280
281
|
onMouseDown: _propTypes["default"].func,
|
281
282
|
onRef: _propTypes["default"].func,
|
282
|
-
|
283
|
-
/** Disables native autoComplete on browsers. */
|
284
|
-
disableAutoComplete: _propTypes["default"].bool,
|
285
283
|
id: _propTypes["default"].string,
|
286
284
|
className: _propTypes["default"].string,
|
287
285
|
style: _propTypes["default"].object,
|
@@ -292,7 +290,6 @@ Autocomplete.propTypes = {
|
|
292
290
|
Autocomplete.defaultProps = {
|
293
291
|
textfieldProps: {},
|
294
292
|
droplistProps: {},
|
295
|
-
disableAutoComplete: false,
|
296
293
|
showInitialData: false
|
297
294
|
};
|
298
295
|
var _default = Autocomplete;
|
@@ -36,7 +36,7 @@ var items = [{
|
|
36
36
|
textRight: '(6)',
|
37
37
|
id: 4
|
38
38
|
}];
|
39
|
-
describe(
|
39
|
+
describe('Autocomplete', function () {
|
40
40
|
it('matches the snapshot', function () {
|
41
41
|
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Autocomplete["default"], {
|
42
42
|
droplistProps: {
|
@@ -64,7 +64,7 @@ describe("Autocomplete", function () {
|
|
64
64
|
expect(wrapper.find('.input').at(0).length).toBe(1);
|
65
65
|
expect(wrapper.find('.droplist').at(0).length).toBe(1);
|
66
66
|
});
|
67
|
-
it(
|
67
|
+
it("hides the droplist when there's no value or the input has no focus", function () {
|
68
68
|
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_Autocomplete["default"], {
|
69
69
|
textfieldProps: {
|
70
70
|
valueProp: 'a',
|
@@ -147,14 +147,17 @@ describe("Autocomplete", function () {
|
|
147
147
|
},
|
148
148
|
droplistProps: {
|
149
149
|
items: items,
|
150
|
-
className: 'droplist'
|
150
|
+
className: 'droplist',
|
151
|
+
testId: 'test-component'
|
151
152
|
},
|
152
153
|
classes: classes
|
153
154
|
}));
|
154
155
|
wrapper.setState({
|
155
156
|
focus: true
|
156
157
|
});
|
157
|
-
wrapper.find(
|
158
|
+
wrapper.find({
|
159
|
+
"data-testid": 'test-component__droplist-item-0'
|
160
|
+
}).simulate('mousedown');
|
158
161
|
expect(onMouseDown.mock.calls[0][0]).toEqual({
|
159
162
|
id: 1,
|
160
163
|
text: 'Administrador',
|
@@ -164,7 +167,9 @@ describe("Autocomplete", function () {
|
|
164
167
|
focus: true,
|
165
168
|
value: 'a'
|
166
169
|
});
|
167
|
-
wrapper.find(
|
170
|
+
wrapper.find({
|
171
|
+
"data-testid": 'test-component__droplist-item-1'
|
172
|
+
}).simulate('mousedown');
|
168
173
|
expect(onMouseDown.mock.calls[1][0]).toEqual({
|
169
174
|
id: 2,
|
170
175
|
text: 'Administrador Sr',
|
@@ -202,14 +207,17 @@ describe("Autocomplete", function () {
|
|
202
207
|
},
|
203
208
|
droplistProps: {
|
204
209
|
items: items,
|
205
|
-
className: 'droplist'
|
210
|
+
className: 'droplist',
|
211
|
+
testId: "test-component"
|
206
212
|
},
|
207
213
|
classes: classes
|
208
214
|
}));
|
209
215
|
wrapper.setState({
|
210
216
|
focus: true
|
211
217
|
});
|
212
|
-
wrapper.find(
|
218
|
+
wrapper.find({
|
219
|
+
"data-testid": 'test-component__droplist-item-0'
|
220
|
+
}).simulate('mousedown');
|
213
221
|
expect(onMouseDown.mock.calls.length).toBe(1);
|
214
222
|
});
|
215
223
|
it('calls the onFocus function', function () {
|
@@ -247,7 +255,7 @@ describe("Autocomplete", function () {
|
|
247
255
|
expect(onBlur.mock.calls.length).toBe(1);
|
248
256
|
});
|
249
257
|
});
|
250
|
-
describe(
|
258
|
+
describe('AutocompleteJSS', function () {
|
251
259
|
it('matches the snapshot', function () {
|
252
260
|
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
|
253
261
|
droplistProps: {
|
@@ -258,7 +266,7 @@ describe("AutocompleteJSS", function () {
|
|
258
266
|
expect(wrapper).toMatchSnapshot();
|
259
267
|
});
|
260
268
|
});
|
261
|
-
describe(
|
269
|
+
describe('Autocomplete styles', function () {
|
262
270
|
it('matches the snapshot', function () {
|
263
271
|
expect(_styles["default"]).toMatchSnapshot();
|
264
272
|
});
|
@@ -7,8 +7,6 @@ exports["default"] = void 0;
|
|
7
7
|
|
8
8
|
var _idx = _interopRequireDefault(require("idx"));
|
9
9
|
|
10
|
-
var _spacing = _interopRequireDefault(require("../subatomic/spacing"));
|
11
|
-
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13
11
|
|
14
12
|
var _default = {
|
@@ -20,10 +18,12 @@ var _default = {
|
|
20
18
|
zIndex: 2,
|
21
19
|
top: function top(props) {
|
22
20
|
return (0, _idx["default"])(props, function (_) {
|
23
|
-
return _.textfieldProps.
|
21
|
+
return _.textfieldProps.assistiveText;
|
24
22
|
}) || (0, _idx["default"])(props, function (_) {
|
25
|
-
return _.textfieldProps.
|
26
|
-
})
|
23
|
+
return _.textfieldProps.counter;
|
24
|
+
}) && (0, _idx["default"])(props, function (_) {
|
25
|
+
return _.textfieldProps.maxLength;
|
26
|
+
}) ? 'calc(100% - 21px)' : 'calc(100% + 8px)';
|
27
27
|
},
|
28
28
|
left: 0,
|
29
29
|
width: '100%'
|
package/build/Button/Button.js
CHANGED
@@ -17,6 +17,8 @@ var _Icon = _interopRequireDefault(require("../Icon"));
|
|
17
17
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
19
19
|
|
20
|
+
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); }
|
21
|
+
|
20
22
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
21
23
|
|
22
24
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
@@ -66,6 +68,9 @@ var Button = /*#__PURE__*/function (_React$Component) {
|
|
66
68
|
target = _this$props.target,
|
67
69
|
rel = _this$props.rel,
|
68
70
|
onClick = _this$props.onClick,
|
71
|
+
onMouseDown = _this$props.onMouseDown,
|
72
|
+
onMouseUp = _this$props.onMouseUp,
|
73
|
+
onMouseOut = _this$props.onMouseOut,
|
69
74
|
theme = _this$props.theme,
|
70
75
|
size = _this$props.size,
|
71
76
|
block = _this$props.block,
|
@@ -112,26 +117,33 @@ var Button = /*#__PURE__*/function (_React$Component) {
|
|
112
117
|
width: iconSize,
|
113
118
|
height: iconSize
|
114
119
|
})) : null;
|
120
|
+
var eventProps = !disabled ? {
|
121
|
+
onClick: onClick,
|
122
|
+
onMouseDown: onMouseDown,
|
123
|
+
onMouseUp: onMouseUp,
|
124
|
+
onMouseOut: onMouseOut
|
125
|
+
} : {};
|
115
126
|
|
116
127
|
if (href) {
|
117
|
-
return /*#__PURE__*/_react["default"].createElement("a", {
|
128
|
+
return /*#__PURE__*/_react["default"].createElement("a", _extends({
|
118
129
|
className: classNames,
|
119
130
|
href: !disabled ? href : '',
|
120
131
|
target: target,
|
121
|
-
rel: rel
|
122
|
-
|
132
|
+
rel: rel
|
133
|
+
}, eventProps, {
|
123
134
|
id: id,
|
124
135
|
style: style,
|
125
136
|
"data-testid": testId
|
126
|
-
}, content, loadingLayer);
|
137
|
+
}), content, loadingLayer);
|
127
138
|
} else {
|
128
|
-
return /*#__PURE__*/_react["default"].createElement("button", {
|
139
|
+
return /*#__PURE__*/_react["default"].createElement("button", _extends({
|
129
140
|
className: classNames,
|
130
|
-
|
141
|
+
disabled: disabled
|
142
|
+
}, eventProps, {
|
131
143
|
id: id,
|
132
144
|
style: style,
|
133
145
|
"data-testid": testId
|
134
|
-
}, content, loadingLayer);
|
146
|
+
}), content, loadingLayer);
|
135
147
|
}
|
136
148
|
}
|
137
149
|
}]);
|
@@ -176,6 +188,15 @@ Button.propTypes = {
|
|
176
188
|
/** The function to call when the button is clicked. */
|
177
189
|
onClick: _propTypes["default"].func,
|
178
190
|
|
191
|
+
/** The function to call when the mouse is down on the button. */
|
192
|
+
onMouseDown: _propTypes["default"].func,
|
193
|
+
|
194
|
+
/** The function to call when the mouse is up on the button. */
|
195
|
+
onMouseUp: _propTypes["default"].func,
|
196
|
+
|
197
|
+
/** The function to call when the mouse moves out of the button. */
|
198
|
+
onMouseOut: _propTypes["default"].func,
|
199
|
+
|
179
200
|
/** Optionally, you can set the href property and use it like a link. */
|
180
201
|
href: _propTypes["default"].string,
|
181
202
|
|
@@ -21,11 +21,9 @@ var _Text = _interopRequireDefault(require("../Text"));
|
|
21
21
|
|
22
22
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
23
23
|
|
24
|
-
var _colors = _interopRequireDefault(require("../subatomic/colors"));
|
25
|
-
|
26
24
|
var _functions = require("./functions");
|
27
25
|
|
28
|
-
var
|
26
|
+
var _colors = _interopRequireDefault(require("../tokens/colors.json"));
|
29
27
|
|
30
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
31
29
|
|
@@ -54,9 +52,6 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
54
52
|
var arrowDown = 40;
|
55
53
|
var arrowUp = 38;
|
56
54
|
var enter = 13;
|
57
|
-
var inkLighter = _colors["default"].inkLighter,
|
58
|
-
ink = _colors["default"].ink;
|
59
|
-
var iconSmall = _iconSizes["default"].small;
|
60
55
|
/**
|
61
56
|
* The Droplist component displays a list and filters it with the prop 'term'.
|
62
57
|
* The value of 'term' es highlighted in every item that matches.
|
@@ -408,7 +403,7 @@ var Droplist = /*#__PURE__*/function (_React$Component) {
|
|
408
403
|
term = _this$props5.term,
|
409
404
|
testId = _this$props5.testId;
|
410
405
|
var itemsDOM = items.map(function (item, i) {
|
411
|
-
var index = (0, _functions.compareText)(item[itemTextKey], term);
|
406
|
+
var index = term ? (0, _functions.compareText)(item[itemTextKey], term) : -1;
|
412
407
|
|
413
408
|
if (index >= 0) {
|
414
409
|
var text = (0, _functions.separateText)(item[itemTextKey], index, term);
|
@@ -423,65 +418,58 @@ var Droplist = /*#__PURE__*/function (_React$Component) {
|
|
423
418
|
onMouseUp: function onMouseUp(e) {
|
424
419
|
return _this4.onMouseUp(item, e);
|
425
420
|
},
|
426
|
-
className: "".concat(classes.item).concat(selectedGroup && currentItem === i ? " ".concat(classes.onFocus) : '').concat(!item.disabled ? " ".concat(classes.itemPointer) :
|
421
|
+
className: "".concat(classes.item).concat(selectedGroup && currentItem === i ? " ".concat(classes.onFocus) : '').concat(!item.disabled ? " ".concat(classes.itemPointer) : " ".concat(classes.disabled))
|
427
422
|
}, testId && {
|
428
423
|
'data-testid': "".concat(testId, "__droplist-item-").concat(i)
|
429
|
-
}), /*#__PURE__*/_react["default"].createElement("div",
|
424
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
425
|
+
className: classes.itemContainer
|
426
|
+
}, item.iconName && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
430
427
|
iconName: item.iconName,
|
431
|
-
width:
|
432
|
-
height:
|
428
|
+
width: 24,
|
429
|
+
height: 24,
|
433
430
|
display: "inline-block",
|
434
431
|
className: classes.icon,
|
435
|
-
colors: [item.disabled ?
|
436
|
-
}), /*#__PURE__*/_react["default"].createElement(
|
437
|
-
className: item.
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
low: item.disabled
|
443
|
-
}, text[1].length ? text[1] : ''), text[2].length ? text[2] : '', item.extraText && /*#__PURE__*/_react["default"].createElement(_Text["default"], {
|
444
|
-
tag: "span",
|
445
|
-
strong: true,
|
446
|
-
low: item.disabled,
|
447
|
-
className: "".concat(classes.extraText).concat(!item.disabled ? " ".concat(classes.extraTextColor) : '')
|
432
|
+
colors: [item.disabled ? _colors["default"].icon["default"].disabled : _colors["default"].icon["default"]["default"]]
|
433
|
+
}), /*#__PURE__*/_react["default"].createElement("p", {
|
434
|
+
className: "".concat(classes.text, " ").concat(classes.mainText).concat(item.disabled ? " ".concat(classes.corpDisabled) : '')
|
435
|
+
}, text[0].length ? text[0] : '', /*#__PURE__*/_react["default"].createElement("b", {
|
436
|
+
className: "".concat(classes.highlighted).concat(item.disabled ? " ".concat(classes.corpDisabled) : '')
|
437
|
+
}, text[1].length ? text[1] : ''), text[2].length ? text[2] : '', item.extraText && /*#__PURE__*/_react["default"].createElement("span", {
|
438
|
+
className: "".concat(classes.text, " ").concat(classes.extraText).concat(item.disabled ? " ".concat(classes.corpDisabled) : '')
|
448
439
|
}, item.extraText))), item[itemTextRightKey] && /*#__PURE__*/_react["default"].createElement("span", {
|
449
|
-
className: classes.
|
450
|
-
},
|
451
|
-
tag: "span",
|
452
|
-
low: true
|
453
|
-
}, item[itemTextRightKey])));
|
440
|
+
className: "".concat(classes.text, " ").concat(classes.rightText).concat(item.disabled ? " ".concat(classes.corpDisabled) : '')
|
441
|
+
}, item[itemTextRightKey]));
|
454
442
|
} else {
|
455
443
|
return /*#__PURE__*/_react["default"].createElement("div", _extends({
|
456
444
|
key: item[itemIdKey],
|
457
|
-
onClick: function
|
445
|
+
onClick: !item.disabled ? function (e) {
|
458
446
|
return _this4.onClick(item, e);
|
459
|
-
},
|
447
|
+
} : null,
|
460
448
|
onMouseDown: function onMouseDown(e) {
|
461
449
|
return _this4.onMouseDown(item, e);
|
462
450
|
},
|
463
451
|
onMouseUp: function onMouseUp(e) {
|
464
452
|
return _this4.onMouseUp(item, e);
|
465
453
|
},
|
466
|
-
className: "".concat(classes.item).concat(selectedGroup && currentItem === i ? " ".concat(classes.onFocus) : '')
|
454
|
+
className: "".concat(classes.item).concat(selectedGroup && currentItem === i ? " ".concat(classes.onFocus) : '').concat(!item.disabled ? " ".concat(classes.itemPointer) : " ".concat(classes.disabled))
|
467
455
|
}, testId && {
|
468
456
|
'data-testid': "".concat(testId, "__droplist-item-").concat(i)
|
469
|
-
}), /*#__PURE__*/_react["default"].createElement("div",
|
457
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
458
|
+
className: classes.itemContainer
|
459
|
+
}, item.iconName && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
470
460
|
iconName: item.iconName,
|
471
|
-
width:
|
472
|
-
height:
|
461
|
+
width: 24,
|
462
|
+
height: 24,
|
473
463
|
display: "inline-block",
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
464
|
+
className: classes.icon,
|
465
|
+
colors: [item.disabled ? _colors["default"].icon["default"].disabled : _colors["default"].icon["default"]["default"]]
|
466
|
+
}), /*#__PURE__*/_react["default"].createElement("p", {
|
467
|
+
className: "".concat(classes.text, " ").concat(classes.mainText).concat(item.disabled ? " ".concat(classes.corpDisabled) : '')
|
468
|
+
}, item[itemTextKey], item.extraText && /*#__PURE__*/_react["default"].createElement("span", {
|
469
|
+
className: "".concat(classes.text, " ").concat(classes.extraText)
|
479
470
|
}, item.extraText))), item[itemTextRightKey] && /*#__PURE__*/_react["default"].createElement("span", {
|
480
|
-
className: classes.
|
481
|
-
},
|
482
|
-
tag: "span",
|
483
|
-
low: true
|
484
|
-
}, item[itemTextRightKey])));
|
471
|
+
className: "".concat(classes.text, " ").concat(classes.rightText).concat(item.disabled ? " ".concat(classes.corpDisabled) : '')
|
472
|
+
}, item[itemTextRightKey]));
|
485
473
|
}
|
486
474
|
});
|
487
475
|
return itemsDOM;
|
@@ -510,11 +498,11 @@ var Droplist = /*#__PURE__*/function (_React$Component) {
|
|
510
498
|
}, groups ? items.map(function (group, index) {
|
511
499
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
512
500
|
key: group[groupIdKey]
|
513
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
514
|
-
small: true,
|
515
|
-
mid: true,
|
501
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
516
502
|
className: classes.group
|
517
|
-
},
|
503
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
504
|
+
className: "".concat(classes.text, " ").concat(classes.groupText)
|
505
|
+
}, group[groupNameKey])), _this5.renderList(group[groupItemsKey], currentGroup === index));
|
518
506
|
}) : this.renderList(items, true));
|
519
507
|
}
|
520
508
|
}]);
|
@@ -119,7 +119,7 @@ describe("Droplist", function () {
|
|
119
119
|
itemIdKey: "id",
|
120
120
|
classes: classes
|
121
121
|
}));
|
122
|
-
expect(wrapper.find('.block>div').at(0).text()).toBe('
|
122
|
+
expect(wrapper.find('.block>div').at(0).text()).toBe('PaísesMéxico(3405)');
|
123
123
|
});
|
124
124
|
it('filters the items', function () {
|
125
125
|
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_Droplist["default"], {
|
@@ -151,7 +151,7 @@ describe("Droplist", function () {
|
|
151
151
|
itemIdKey: "id",
|
152
152
|
classes: classes
|
153
153
|
}));
|
154
|
-
expect(wrapper.find('.item').at(0).find('b').
|
154
|
+
expect(wrapper.find('.item').at(0).find('b').exists()).toBe(false);
|
155
155
|
wrapper.setProps({
|
156
156
|
term: 'Administrador'
|
157
157
|
});
|
@@ -5,59 +5,91 @@ exports[`Droplist matches the snapshot 1`] = `ShallowWrapper {}`;
|
|
5
5
|
exports[`Droplist styles matches the snapshot 1`] = `
|
6
6
|
Object {
|
7
7
|
"block": Object {
|
8
|
-
"background": "#
|
9
|
-
"border": "1px solid #
|
10
|
-
"borderRadius":
|
8
|
+
"background": "#fff",
|
9
|
+
"border": "1px solid #D3D4DC",
|
10
|
+
"borderRadius": "4px",
|
11
|
+
"boxShadow": "0 9px 12px -5px rgba(8,13,56,0.12), 0 10px 32px 0 rgba(9,61,173,0.12)",
|
11
12
|
"overflow": "hidden",
|
13
|
+
"padding": "8px",
|
12
14
|
},
|
13
|
-
"
|
14
|
-
"
|
15
|
+
"corpDisabled": Object {
|
16
|
+
"color": "#878A9F",
|
15
17
|
},
|
16
|
-
"
|
17
|
-
"
|
18
|
+
"disabled": Object {
|
19
|
+
"pointerEvents": "none",
|
20
|
+
},
|
21
|
+
"extraText": Object {
|
22
|
+
"color": "#083CAE",
|
23
|
+
"display": "inline-block",
|
24
|
+
"font": "400 10px/1.5 'OccText', sans-serif",
|
25
|
+
"marginLeft": "4px",
|
18
26
|
},
|
19
27
|
"group": Object {
|
28
|
+
"display": "inline-block",
|
20
29
|
"padding": Array [
|
21
|
-
|
22
|
-
|
23
|
-
|
30
|
+
"8px",
|
31
|
+
"16px",
|
32
|
+
0,
|
24
33
|
],
|
25
34
|
},
|
26
|
-
"
|
27
|
-
"
|
28
|
-
"position": "absolute",
|
29
|
-
"top": 12,
|
35
|
+
"groupText": Object {
|
36
|
+
"font": "400 14px/1.5 'OccText', sans-serif",
|
30
37
|
},
|
31
|
-
"
|
32
|
-
"
|
33
|
-
"
|
38
|
+
"highlighted": Object {
|
39
|
+
"background": "hsl(221 91.2% 35.7% / 0.05)",
|
40
|
+
"font": "400 16px/1.5 'OccText', sans-serif",
|
41
|
+
},
|
42
|
+
"icon": Object {
|
43
|
+
"marginRight": "8px",
|
34
44
|
},
|
35
45
|
"item": Object {
|
46
|
+
"&:active, &:focus": Object {
|
47
|
+
"& > $rightText": Object {
|
48
|
+
"color": "#080D39",
|
49
|
+
},
|
50
|
+
"background": "hsl(221 91.2% 35.7% / 0.1)",
|
51
|
+
},
|
36
52
|
"&:hover": Object {
|
37
|
-
"background": "
|
53
|
+
"background": "hsl(221 91.2% 35.7% / 0.05)",
|
38
54
|
},
|
55
|
+
"alignItems": "center",
|
56
|
+
"borderRadius": "4px",
|
39
57
|
"display": "flex",
|
40
58
|
"justifyContent": "space-between",
|
41
59
|
"padding": Array [
|
42
|
-
|
43
|
-
|
60
|
+
"12px",
|
61
|
+
"16px",
|
44
62
|
],
|
45
63
|
"position": "relative",
|
46
64
|
"transition": "0.1s all",
|
47
65
|
},
|
66
|
+
"itemContainer": Object {
|
67
|
+
"alignItems": "center",
|
68
|
+
"display": "flex",
|
69
|
+
},
|
48
70
|
"itemPointer": Object {
|
49
71
|
"cursor": "pointer",
|
50
72
|
},
|
73
|
+
"mainText": Object {
|
74
|
+
"color": "#080D39",
|
75
|
+
"display": "inline-block",
|
76
|
+
"font": "400 16px/1.5 'OccText', sans-serif",
|
77
|
+
},
|
51
78
|
"onFocus": Object {
|
52
79
|
"&:hover": Object {
|
53
|
-
"background": "
|
80
|
+
"background": "hsl(221 91.2% 35.7% / 0.1)",
|
54
81
|
},
|
55
|
-
"background": "
|
82
|
+
"background": "hsl(221 91.2% 35.7% / 0.1)",
|
56
83
|
},
|
57
84
|
"right": Object {
|
58
|
-
"
|
59
|
-
|
60
|
-
|
85
|
+
"marginLeft": "16px",
|
86
|
+
},
|
87
|
+
"rightText": Object {
|
88
|
+
"color": "#5A5D7B",
|
89
|
+
"font": "400 14px/1.5 'OccText', sans-serif",
|
90
|
+
},
|
91
|
+
"text": Object {
|
92
|
+
"margin": 0,
|
61
93
|
},
|
62
94
|
}
|
63
95
|
`;
|