@jobber/components 2.74.0 → 2.75.1-pre.4
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
CHANGED
|
@@ -8,6 +8,17 @@ menu: Changelog
|
|
|
8
8
|
All notable changes to this project will be documented in this file.
|
|
9
9
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
10
10
|
|
|
11
|
+
# [2.75.0](https://github.com/GetJobber/atlantis/compare/@jobber/components@2.74.0...@jobber/components@2.75.0) (2022-01-28)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* Announce chip deletion and addition JOB-41252 ([#848](https://github.com/GetJobber/atlantis/issues/848)) ([f251b42](https://github.com/GetJobber/atlantis/commit/f251b42c5aa98ee07f7e16d3605a6bd965a8231b))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
11
22
|
# [2.74.0](https://github.com/GetJobber/atlantis/compare/@jobber/components@2.73.0...@jobber/components@2.74.0) (2022-01-26)
|
|
12
23
|
|
|
13
24
|
|
|
@@ -4,7 +4,7 @@ export declare function useInternalChipDismissible({ children, selected, onChang
|
|
|
4
4
|
ref: import("react").RefObject<HTMLDivElement>;
|
|
5
5
|
sortedVisibleChipOptions: import("../../Chip").ChipProps[];
|
|
6
6
|
availableChipOptions: import("../../Chip").ChipProps[];
|
|
7
|
-
handleChipRemove: (
|
|
7
|
+
handleChipRemove: (chip: import("../../Chip").ChipProps) => () => void;
|
|
8
8
|
handleChipAdd: (value: string) => void;
|
|
9
9
|
handleCustomAdd: ((value: string) => void) | undefined;
|
|
10
10
|
handleChipClick: (value: string) => ((event: MouseEvent<HTMLButtonElement, globalThis.MouseEvent>) => void) | undefined;
|
package/dist/Chips/index.js
CHANGED
|
@@ -225,9 +225,13 @@ function useInternalChipDismissible(_a) {
|
|
|
225
225
|
return selected.indexOf(chip.value);
|
|
226
226
|
});
|
|
227
227
|
var availableChipOptions = chipOptions.filter(function (chip) { return !selected.includes(chip.value); });
|
|
228
|
+
var liveAnnounce = hooks.useLiveAnnounce().liveAnnounce;
|
|
228
229
|
var actions = {
|
|
229
|
-
handleChipRemove: function (
|
|
230
|
-
return function () {
|
|
230
|
+
handleChipRemove: function (chip) {
|
|
231
|
+
return function () {
|
|
232
|
+
liveAnnounce(chip.label + " Removed");
|
|
233
|
+
onChange(selected.filter(function (val) { return val !== chip.value; }));
|
|
234
|
+
};
|
|
231
235
|
},
|
|
232
236
|
handleChipAdd: function (value) { return onChange(__chunk_1.__spread(selected, [value])); },
|
|
233
237
|
handleCustomAdd: onCustomAdd,
|
|
@@ -237,10 +241,12 @@ function useInternalChipDismissible(_a) {
|
|
|
237
241
|
return function (event) { return onClick(event, value); };
|
|
238
242
|
},
|
|
239
243
|
handleEmptyBackspace: function () {
|
|
240
|
-
actions.handleChipRemove(
|
|
244
|
+
actions.handleChipRemove(sortedVisibleChipOptions[selected.length - 1])();
|
|
241
245
|
},
|
|
242
246
|
};
|
|
243
|
-
return __chunk_1.__assign(__chunk_1.__assign({}, actions), { ref: ref,
|
|
247
|
+
return __chunk_1.__assign(__chunk_1.__assign({}, actions), { ref: ref,
|
|
248
|
+
sortedVisibleChipOptions: sortedVisibleChipOptions,
|
|
249
|
+
availableChipOptions: availableChipOptions });
|
|
244
250
|
}
|
|
245
251
|
|
|
246
252
|
var menuId = uuid.v1();
|
|
@@ -253,6 +259,7 @@ function useInternalChipDismissibleInput(_a) {
|
|
|
253
259
|
var _g = __chunk_1.__read(React.useState(false), 2), shouldCancelBlur = _g[0], setShouldCancelBlur = _g[1];
|
|
254
260
|
var canAddCustomOption = onCustomOptionSelect !== undefined && !isLoadingMore;
|
|
255
261
|
var maxOptionIndex = allOptions.length - 1;
|
|
262
|
+
var liveAnnounce = hooks.useLiveAnnounce().liveAnnounce;
|
|
256
263
|
React.useEffect(function () {
|
|
257
264
|
setAllOptions(generateOptions(options, searchValue, canAddCustomOption));
|
|
258
265
|
}, [options]);
|
|
@@ -297,6 +304,7 @@ function useInternalChipDismissibleInput(_a) {
|
|
|
297
304
|
var setValue = selected.custom ? onCustomOptionSelect : onOptionSelect;
|
|
298
305
|
if (setValue) {
|
|
299
306
|
setValue(selected.value);
|
|
307
|
+
liveAnnounce(selected.label + " Added");
|
|
300
308
|
actions.handleReset();
|
|
301
309
|
(_a = computed.inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
302
310
|
}
|
|
@@ -456,7 +464,7 @@ function InternalChipDismissibleInput(props) {
|
|
|
456
464
|
function InternalChipDismissible(props) {
|
|
457
465
|
var _a = useInternalChipDismissible(props), availableChipOptions = _a.availableChipOptions, wrapperRef = _a.ref, sortedVisibleChipOptions = _a.sortedVisibleChipOptions, handleChipClick = _a.handleChipClick, handleChipAdd = _a.handleChipAdd, handleChipRemove = _a.handleChipRemove, handleCustomAdd = _a.handleCustomAdd, handleEmptyBackspace = _a.handleEmptyBackspace;
|
|
458
466
|
return (React__default.createElement("div", { ref: wrapperRef, className: styles$1.wrapper, "data-testid": "dismissible-chips" },
|
|
459
|
-
sortedVisibleChipOptions.map(function (chip) { return (React__default.createElement(ChipDismissible, __chunk_1.__assign({ key: chip.value }, chip, { onClick: handleChipClick(chip.value), onRequestRemove: handleChipRemove(chip
|
|
467
|
+
sortedVisibleChipOptions.map(function (chip) { return (React__default.createElement(ChipDismissible, __chunk_1.__assign({ key: chip.value }, chip, { onClick: handleChipClick(chip.value), onRequestRemove: handleChipRemove(chip) }))); }),
|
|
460
468
|
React__default.createElement(InternalChipDismissibleInput, { activator: props.activator, attachTo: wrapperRef, isLoadingMore: props.isLoadingMore, options: availableChipOptions, onOptionSelect: handleChipAdd, onCustomOptionSelect: handleCustomAdd, onEmptyBackspace: handleEmptyBackspace, onSearch: props.onSearch, onLoadMore: props.onLoadMore })));
|
|
461
469
|
}
|
|
462
470
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.75.1-pre.4+9e2ce96",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"dist/*"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@jobber/design": "^0.21.
|
|
20
|
+
"@jobber/design": "^0.21.1-pre.46+9e2ce96",
|
|
21
21
|
"@jobber/formatters": "^0.2.0",
|
|
22
|
-
"@jobber/hooks": "^1.
|
|
22
|
+
"@jobber/hooks": "^1.11.0",
|
|
23
23
|
"@popperjs/core": "^2.0.6",
|
|
24
24
|
"@std-proposal/temporal": "0.0.1",
|
|
25
25
|
"@types/color": "^3.0.1",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"> 1%",
|
|
86
86
|
"IE 10"
|
|
87
87
|
],
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "9e2ce96cf5d3c14207b2e869acfebfff4862b7cb"
|
|
89
89
|
}
|