@useblu/ocean-react 1.55.0 → 1.55.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/CHANGELOG.md +6 -0
- package/Chips/Chips.d.ts +1 -0
- package/Chips/Chips.d.ts.map +1 -1
- package/index.es.js +11 -7
- package/index.es.js.map +1 -1
- package/index.js +11 -7
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -46431,7 +46431,7 @@ var CardListItem = function (_a) {
|
|
|
46431
46431
|
|
|
46432
46432
|
var Options = function (_a) {
|
|
46433
46433
|
var options = _a.options, selectedOptions = _a.selectedOptions, clearLabel = _a.clearLabel, filterLabel = _a.filterLabel, multiChoice = _a.multiChoice, onSelect = _a.onSelect, filterOptions = _a.filterOptions, clearOptions = _a.clearOptions;
|
|
46434
|
-
var columns = multiChoice ? Math.ceil(
|
|
46434
|
+
var columns = multiChoice ? Math.ceil(options.length / 5) : 1;
|
|
46435
46435
|
return (e__default["default"].createElement("div", { className: "ods-chips__options", "data-testid": "ods-chips-option" },
|
|
46436
46436
|
e__default["default"].createElement("div", { className: classNames('ods-chips__options--content', "ods-chips__options--content--columns-".concat(columns)) }, options.map(function (_a) {
|
|
46437
46437
|
var label = _a.label, value = _a.value;
|
|
@@ -46449,7 +46449,7 @@ var Options = function (_a) {
|
|
|
46449
46449
|
};
|
|
46450
46450
|
|
|
46451
46451
|
var Chips = function (_a) {
|
|
46452
|
-
var label = _a.label, icon = _a.icon, disabled = _a.disabled, defaultValue = _a.defaultValue, _b = _a.options, options = _b === void 0 ? [] : _b, _c = _a.multiChoice, multiChoice = _c === void 0 ? false : _c, _d = _a.clearLabel, clearLabel = _d === void 0 ? 'Limpar' : _d, _e = _a.filterLabel, filterLabel = _e === void 0 ? 'Filtrar' : _e, initialCounter = _a.initialCounter, selectedValue = _a.selectedValue, onClick = _a.onClick, onChange = _a.onChange, onClose = _a.onClose;
|
|
46452
|
+
var label = _a.label, icon = _a.icon, disabled = _a.disabled, defaultValue = _a.defaultValue, _b = _a.options, options = _b === void 0 ? [] : _b, _c = _a.multiChoice, multiChoice = _c === void 0 ? false : _c, _d = _a.clearLabel, clearLabel = _d === void 0 ? 'Limpar' : _d, _e = _a.filterLabel, filterLabel = _e === void 0 ? 'Filtrar' : _e, initialCounter = _a.initialCounter, actived = _a.actived, selectedValue = _a.selectedValue, onClick = _a.onClick, onChange = _a.onChange, onClose = _a.onClose;
|
|
46453
46453
|
var wrapperRef = e.useRef(null);
|
|
46454
46454
|
var _f = e__default["default"].useState(0), counter = _f[0], setCounter = _f[1];
|
|
46455
46455
|
var _g = e__default["default"].useState(false), selectionIsOpen = _g[0], setSelectionIsOpen = _g[1];
|
|
@@ -46458,9 +46458,9 @@ var Chips = function (_a) {
|
|
|
46458
46458
|
var target = event.target;
|
|
46459
46459
|
if (wrapperRef.current && !wrapperRef.current.contains(target)) {
|
|
46460
46460
|
setSelectionIsOpen(false);
|
|
46461
|
+
if (onClose)
|
|
46462
|
+
onClose();
|
|
46461
46463
|
}
|
|
46462
|
-
if (onClose)
|
|
46463
|
-
onClose();
|
|
46464
46464
|
}
|
|
46465
46465
|
e.useEffect(function () {
|
|
46466
46466
|
if (selectedValue && selectedValue !== selectedOptions && !multiChoice) {
|
|
@@ -46485,6 +46485,8 @@ var Chips = function (_a) {
|
|
|
46485
46485
|
if (!multiChoice) {
|
|
46486
46486
|
setSelectedOptions({ label: labelProp, value: value });
|
|
46487
46487
|
setSelectionIsOpen(false);
|
|
46488
|
+
if (onClose)
|
|
46489
|
+
onClose();
|
|
46488
46490
|
if (onChange) {
|
|
46489
46491
|
onChange({ label: labelProp, value: value });
|
|
46490
46492
|
}
|
|
@@ -46515,9 +46517,10 @@ var Chips = function (_a) {
|
|
|
46515
46517
|
setSelectedOptions([]);
|
|
46516
46518
|
setCounter(0);
|
|
46517
46519
|
setSelectionIsOpen(false);
|
|
46518
|
-
if (
|
|
46520
|
+
if (onClose)
|
|
46521
|
+
onClose();
|
|
46522
|
+
if (onChange)
|
|
46519
46523
|
onChange([]);
|
|
46520
|
-
}
|
|
46521
46524
|
};
|
|
46522
46525
|
var filterOptions = function () {
|
|
46523
46526
|
setSelectionIsOpen(false);
|
|
@@ -46530,7 +46533,8 @@ var Chips = function (_a) {
|
|
|
46530
46533
|
'ods-chips__button--active': selectionIsOpen ||
|
|
46531
46534
|
(Array.isArray(selectedOptions)
|
|
46532
46535
|
? selectedOptions.length > 0
|
|
46533
|
-
: selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.value)
|
|
46536
|
+
: selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.value) ||
|
|
46537
|
+
actived
|
|
46534
46538
|
}) },
|
|
46535
46539
|
icon || undefined,
|
|
46536
46540
|
e__default["default"].createElement("p", { className: "ods-chips__label" }, displayValue()),
|