@useblu/ocean-react 1.54.0 → 1.55.0
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 +12 -0
- package/Chips/Chips.d.ts +2 -0
- package/Chips/Chips.d.ts.map +1 -1
- package/Chips/Options.d.ts +1 -1
- package/Chips/Options.d.ts.map +1 -1
- package/index.es.js +18 -8
- package/index.es.js.map +1 -1
- package/index.js +18 -8
- package/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.55.0](https://github.com/ocean-ds/ocean-web/compare/v1.54.1...v1.55.0) (2024-03-27)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- selected value at chips ([#1094](https://github.com/ocean-ds/ocean-web/issues/1094)) ([07c6c58](https://github.com/ocean-ds/ocean-web/commit/07c6c58a1492489c1b83e357d96139a68cb24d05))
|
|
11
|
+
|
|
12
|
+
## [1.54.1](https://github.com/ocean-ds/ocean-web/compare/v1.54.0...v1.54.1) (2024-03-26)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- adjust optins columns ([#1093](https://github.com/ocean-ds/ocean-web/issues/1093)) ([b49ed7c](https://github.com/ocean-ds/ocean-web/commit/b49ed7cc28408a1cce4a2f6366b7c8799bff563e))
|
|
17
|
+
|
|
6
18
|
# [1.54.0](https://github.com/ocean-ds/ocean-web/compare/v1.53.0...v1.54.0) (2024-03-25)
|
|
7
19
|
|
|
8
20
|
### Features
|
package/Chips/Chips.d.ts
CHANGED
|
@@ -13,8 +13,10 @@ interface IChips {
|
|
|
13
13
|
clearLabel?: string;
|
|
14
14
|
filterLabel?: string;
|
|
15
15
|
initialCounter?: number;
|
|
16
|
+
selectedValue?: ChipValue;
|
|
16
17
|
onClick?: () => void;
|
|
17
18
|
onChange?: (value: ChipValue[] | ChipValue) => void;
|
|
19
|
+
onClose?: () => void;
|
|
18
20
|
}
|
|
19
21
|
declare const Chips: React.FunctionComponent<IChips>;
|
|
20
22
|
export default Chips;
|
package/Chips/Chips.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chips.d.ts","sourceRoot":"","sources":["../../src/Chips/Chips.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAMjD,oBAAY,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzD,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Chips.d.ts","sourceRoot":"","sources":["../../src/Chips/Chips.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAMjD,oBAAY,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzD,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,KAAK,IAAI,CAAC;IACpD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAuJ1C,CAAC;AAIF,eAAe,KAAK,CAAC"}
|
package/Chips/Options.d.ts
CHANGED
package/Chips/Options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Options.d.ts","sourceRoot":"","sources":["../../src/Chips/Options.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,UAAU,QAAQ;IAChB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1B,eAAe,
|
|
1
|
+
{"version":3,"file":"Options.d.ts","sourceRoot":"","sources":["../../src/Chips/Options.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,UAAU,QAAQ;IAChB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1B,eAAe,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,QAAQ,CAiE9C,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/index.es.js
CHANGED
|
@@ -46421,13 +46421,17 @@ var CardListItem = function (_a) {
|
|
|
46421
46421
|
};
|
|
46422
46422
|
|
|
46423
46423
|
var Options = function (_a) {
|
|
46424
|
-
var options = _a.options,
|
|
46424
|
+
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;
|
|
46425
46425
|
var columns = multiChoice ? Math.ceil(10 / 5) : 1;
|
|
46426
46426
|
return (e.createElement("div", { className: "ods-chips__options", "data-testid": "ods-chips-option" },
|
|
46427
46427
|
e.createElement("div", { className: classNames('ods-chips__options--content', "ods-chips__options--content--columns-".concat(columns)) }, options.map(function (_a) {
|
|
46428
46428
|
var label = _a.label, value = _a.value;
|
|
46429
|
-
return (e.createElement("button", { key: label, type: "button", value: value, onClick: function () { return onSelect(label, value); }, className:
|
|
46430
|
-
|
|
46429
|
+
return (e.createElement("button", { key: label, type: "button", value: value, onClick: function () { return onSelect(label, value); }, className: classNames('ods-chips__options--option', {
|
|
46430
|
+
'ods-chips__options--option--selected': !multiChoice &&
|
|
46431
|
+
!Array.isArray(selectedOptions) &&
|
|
46432
|
+
selectedOptions.value === value
|
|
46433
|
+
}) },
|
|
46434
|
+
multiChoice && Array.isArray(selectedOptions) && (e.createElement(Checkbox, { checked: !!selectedOptions.find(function (option) { return option.value === value; }), readOnly: true })),
|
|
46431
46435
|
label));
|
|
46432
46436
|
})),
|
|
46433
46437
|
multiChoice && (e.createElement("div", { className: "ods-chips__options--footer" },
|
|
@@ -46436,7 +46440,7 @@ var Options = function (_a) {
|
|
|
46436
46440
|
};
|
|
46437
46441
|
|
|
46438
46442
|
var Chips = function (_a) {
|
|
46439
|
-
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, onClick = _a.onClick, onChange = _a.onChange;
|
|
46443
|
+
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;
|
|
46440
46444
|
var wrapperRef = useRef(null);
|
|
46441
46445
|
var _f = e.useState(0), counter = _f[0], setCounter = _f[1];
|
|
46442
46446
|
var _g = e.useState(false), selectionIsOpen = _g[0], setSelectionIsOpen = _g[1];
|
|
@@ -46446,7 +46450,14 @@ var Chips = function (_a) {
|
|
|
46446
46450
|
if (wrapperRef.current && !wrapperRef.current.contains(target)) {
|
|
46447
46451
|
setSelectionIsOpen(false);
|
|
46448
46452
|
}
|
|
46453
|
+
if (onClose)
|
|
46454
|
+
onClose();
|
|
46449
46455
|
}
|
|
46456
|
+
useEffect(function () {
|
|
46457
|
+
if (selectedValue && selectedValue !== selectedOptions && !multiChoice) {
|
|
46458
|
+
setSelectedOptions(selectedValue);
|
|
46459
|
+
}
|
|
46460
|
+
}, [selectedValue]);
|
|
46450
46461
|
useEffect(function () {
|
|
46451
46462
|
document.addEventListener('mousedown', handleClickOutside);
|
|
46452
46463
|
return function () {
|
|
@@ -46501,9 +46512,8 @@ var Chips = function (_a) {
|
|
|
46501
46512
|
};
|
|
46502
46513
|
var filterOptions = function () {
|
|
46503
46514
|
setSelectionIsOpen(false);
|
|
46504
|
-
if (
|
|
46505
|
-
|
|
46506
|
-
}
|
|
46515
|
+
if (onClose)
|
|
46516
|
+
onClose();
|
|
46507
46517
|
};
|
|
46508
46518
|
return (e.createElement("div", { className: "ods-chips", ref: wrapperRef },
|
|
46509
46519
|
e.createElement("button", { type: "button", onClick: handleClickChips, disabled: disabled, className: classNames('ods-chips__button', {
|
|
@@ -46518,7 +46528,7 @@ var Chips = function (_a) {
|
|
|
46518
46528
|
(counter > 0 || initialCounter) && (e.createElement(Badge, { color: "brand", className: "ods-chips__badge" }, initialCounter !== null && initialCounter !== void 0 ? initialCounter : counter)),
|
|
46519
46529
|
options && (options === null || options === void 0 ? void 0 : options.length) > 0 && !selectionIsOpen && e.createElement(J, null),
|
|
46520
46530
|
options && (options === null || options === void 0 ? void 0 : options.length) > 0 && selectionIsOpen && e.createElement(re, null)),
|
|
46521
|
-
selectionIsOpen && options && (e.createElement(Options, { options: options, onSelect: handleSelectOption, selectedOptions:
|
|
46531
|
+
selectionIsOpen && options && (e.createElement(Options, { options: options, onSelect: handleSelectOption, selectedOptions: selectedOptions, clearLabel: clearLabel, filterLabel: filterLabel, multiChoice: multiChoice, clearOptions: clearOptions, filterOptions: filterOptions }))));
|
|
46522
46532
|
};
|
|
46523
46533
|
Chips.displayName = 'Chips';
|
|
46524
46534
|
|