@jobber/components 6.17.2 → 6.17.3-MIKEfix-d-ae9bfc6.2
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/Chips/InternalChipDismissible/hooks/useInternalChipDismissibleInput.d.ts +2 -1
- package/dist/Chips/InternalChipDismissible/index.cjs +1 -1
- package/dist/Chips/InternalChipDismissible/index.mjs +1 -1
- package/dist/Chips/index.cjs +1 -1
- package/dist/Chips/index.mjs +1 -1
- package/dist/InternalChipDismissible-cjs.js +7 -7
- package/dist/InternalChipDismissible-es.js +7 -7
- package/dist/useScrollToActive-cjs.js +7 -5
- package/dist/useScrollToActive-es.js +7 -5
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ChangeEvent, KeyboardEvent } from "react";
|
|
2
2
|
import { ChipDismissibleInputOptionProps, ChipDismissibleInputProps } from "../InternalChipDismissibleTypes";
|
|
3
|
+
import { ChipProps } from "../../Chip";
|
|
3
4
|
export declare function useInternalChipDismissibleInput({ options, isLoadingMore, onCustomOptionSelect, onOptionSelect, onSearch, }: ChipDismissibleInputProps): {
|
|
4
5
|
menuOpen: boolean;
|
|
5
6
|
searchValue: string;
|
|
@@ -23,5 +24,5 @@ export declare function useInternalChipDismissibleInput({ options, isLoadingMore
|
|
|
23
24
|
handleSetActiveOnMouseOver: (index: number) => () => void;
|
|
24
25
|
handleSelectOption: (selected: ChipDismissibleInputOptionProps) => void;
|
|
25
26
|
handleKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
26
|
-
handleDebouncedSearch: import("lodash").DebouncedFunc<() => void>;
|
|
27
|
+
handleDebouncedSearch: import("lodash").DebouncedFunc<(newSearchValue: string, newOptions?: ChipProps[]) => void>;
|
|
27
28
|
};
|
|
@@ -20,6 +20,7 @@ require('../../Icon-cjs.js');
|
|
|
20
20
|
require('@jobber/design');
|
|
21
21
|
require('react-popper');
|
|
22
22
|
require('classnames');
|
|
23
|
+
require('../../useSafeLayoutEffect-cjs.js');
|
|
23
24
|
require('../../Text-cjs.js');
|
|
24
25
|
require('../../Typography-cjs.js');
|
|
25
26
|
require('../../Button-cjs.js');
|
|
@@ -33,7 +34,6 @@ require('../../useChildComponent-cjs.js');
|
|
|
33
34
|
require('../../Tooltip-cjs.js');
|
|
34
35
|
require('react-dom');
|
|
35
36
|
require('framer-motion');
|
|
36
|
-
require('../../useSafeLayoutEffect-cjs.js');
|
|
37
37
|
require('../../useIsMounted-cjs.js');
|
|
38
38
|
require('../../tslib.es6-cjs.js');
|
|
39
39
|
|
|
@@ -18,6 +18,7 @@ import '../../Icon-es.js';
|
|
|
18
18
|
import '@jobber/design';
|
|
19
19
|
import 'react-popper';
|
|
20
20
|
import 'classnames';
|
|
21
|
+
import '../../useSafeLayoutEffect-es.js';
|
|
21
22
|
import '../../Text-es.js';
|
|
22
23
|
import '../../Typography-es.js';
|
|
23
24
|
import '../../Button-es.js';
|
|
@@ -31,6 +32,5 @@ import '../../useChildComponent-es.js';
|
|
|
31
32
|
import '../../Tooltip-es.js';
|
|
32
33
|
import 'react-dom';
|
|
33
34
|
import 'framer-motion';
|
|
34
|
-
import '../../useSafeLayoutEffect-es.js';
|
|
35
35
|
import '../../useIsMounted-es.js';
|
|
36
36
|
import '../../tslib.es6-es.js';
|
package/dist/Chips/index.cjs
CHANGED
|
@@ -23,6 +23,7 @@ require('../Icon-cjs.js');
|
|
|
23
23
|
require('@jobber/design');
|
|
24
24
|
require('react-popper');
|
|
25
25
|
require('classnames');
|
|
26
|
+
require('../useSafeLayoutEffect-cjs.js');
|
|
26
27
|
require('../Text-cjs.js');
|
|
27
28
|
require('../Typography-cjs.js');
|
|
28
29
|
require('../Button-cjs.js');
|
|
@@ -36,7 +37,6 @@ require('../useChildComponent-cjs.js');
|
|
|
36
37
|
require('../Tooltip-cjs.js');
|
|
37
38
|
require('react-dom');
|
|
38
39
|
require('framer-motion');
|
|
39
|
-
require('../useSafeLayoutEffect-cjs.js');
|
|
40
40
|
require('../useIsMounted-cjs.js');
|
|
41
41
|
require('../_polyfill-node.process-cjs.js');
|
|
42
42
|
|
package/dist/Chips/index.mjs
CHANGED
|
@@ -21,6 +21,7 @@ import '../Icon-es.js';
|
|
|
21
21
|
import '@jobber/design';
|
|
22
22
|
import 'react-popper';
|
|
23
23
|
import 'classnames';
|
|
24
|
+
import '../useSafeLayoutEffect-es.js';
|
|
24
25
|
import '../Text-es.js';
|
|
25
26
|
import '../Typography-es.js';
|
|
26
27
|
import '../Button-es.js';
|
|
@@ -34,7 +35,6 @@ import '../useChildComponent-es.js';
|
|
|
34
35
|
import '../Tooltip-es.js';
|
|
35
36
|
import 'react-dom';
|
|
36
37
|
import 'framer-motion';
|
|
37
|
-
import '../useSafeLayoutEffect-es.js';
|
|
38
38
|
import '../useIsMounted-es.js';
|
|
39
39
|
import '../_polyfill-node.process-es.js';
|
|
40
40
|
|
|
@@ -7,6 +7,7 @@ require('@jobber/design');
|
|
|
7
7
|
require('react-popper');
|
|
8
8
|
var debounce = require('./debounce-cjs.js');
|
|
9
9
|
var classnames = require('classnames');
|
|
10
|
+
var useSafeLayoutEffect = require('./useSafeLayoutEffect-cjs.js');
|
|
10
11
|
var Text = require('./Text-cjs.js');
|
|
11
12
|
var Button = require('./Button-cjs.js');
|
|
12
13
|
var Spinner = require('./Spinner-cjs.js');
|
|
@@ -22,19 +23,18 @@ function InternalChip({ label, active = false, disabled = false, invalid = false
|
|
|
22
23
|
var styles = {"wrapper":"XRnU90M2-fs-","input":"Dq-yFHd1zK0-","menu":"F7CpurjKzBI-","menuList":"J8USVG1tjPs-","menuListOption":"_9SAK31TqNDY-","loadingIndicator":"s5vFJVv0t0Q-","activeOption":"_8d0w-JzgzS4-","spinning":"hDJGLX6kE-U-"};
|
|
23
24
|
|
|
24
25
|
function InternalChipDismissibleInput(props) {
|
|
25
|
-
const { activator = React.createElement(Button.Button, { icon: "add", type: "secondary", ariaLabel: "Add" }), attachTo, isLoadingMore = false, onLoadMore, } = props;
|
|
26
|
+
const { activator = React.createElement(Button.Button, { icon: "add", type: "secondary", ariaLabel: "Add" }), attachTo, isLoadingMore = false, onLoadMore, options, } = props;
|
|
26
27
|
const { activeIndex, allOptions, hasAvailableOptions, inputRef, menuId, menuOpen, searchValue, generateDescendantId, handleBlur, handleOpenMenu, handleSearchChange, handleCancelBlur, handleEnableBlur, handleSetActiveOnMouseOver, handleKeyDown, handleSelectOption, handleDebouncedSearch, } = useScrollToActive.useInternalChipDismissibleInput(props);
|
|
27
28
|
const menuRef = useScrollToActive.useScrollToActive(activeIndex);
|
|
28
29
|
const { ref: visibleChildRef, isInView } = useScrollToActive.useInView();
|
|
29
30
|
const { styles: popperStyles, attributes, update, setPositionedElementRef, } = useScrollToActive.useRepositionMenu(attachTo);
|
|
31
|
+
useSafeLayoutEffect.useSafeLayoutEffect_1(() => {
|
|
32
|
+
update === null || update === void 0 ? void 0 : update();
|
|
33
|
+
}, [allOptions, menuOpen, update, options]);
|
|
30
34
|
React.useEffect(() => {
|
|
31
|
-
|
|
32
|
-
update();
|
|
33
|
-
}, [allOptions]);
|
|
34
|
-
React.useEffect(() => {
|
|
35
|
-
handleDebouncedSearch();
|
|
35
|
+
handleDebouncedSearch(searchValue, options);
|
|
36
36
|
return handleDebouncedSearch.cancel;
|
|
37
|
-
}, [searchValue]);
|
|
37
|
+
}, [searchValue, options]);
|
|
38
38
|
React.useEffect(() => {
|
|
39
39
|
isInView && onLoadMore && onLoadMore(searchValue);
|
|
40
40
|
}, [isInView]);
|
|
@@ -5,6 +5,7 @@ import '@jobber/design';
|
|
|
5
5
|
import 'react-popper';
|
|
6
6
|
import { d as debounce } from './debounce-es.js';
|
|
7
7
|
import classnames from 'classnames';
|
|
8
|
+
import { u as useSafeLayoutEffect_1 } from './useSafeLayoutEffect-es.js';
|
|
8
9
|
import { T as Text } from './Text-es.js';
|
|
9
10
|
import { B as Button } from './Button-es.js';
|
|
10
11
|
import { S as Spinner } from './Spinner-es.js';
|
|
@@ -20,19 +21,18 @@ function InternalChip({ label, active = false, disabled = false, invalid = false
|
|
|
20
21
|
var styles = {"wrapper":"XRnU90M2-fs-","input":"Dq-yFHd1zK0-","menu":"F7CpurjKzBI-","menuList":"J8USVG1tjPs-","menuListOption":"_9SAK31TqNDY-","loadingIndicator":"s5vFJVv0t0Q-","activeOption":"_8d0w-JzgzS4-","spinning":"hDJGLX6kE-U-"};
|
|
21
22
|
|
|
22
23
|
function InternalChipDismissibleInput(props) {
|
|
23
|
-
const { activator = React.createElement(Button, { icon: "add", type: "secondary", ariaLabel: "Add" }), attachTo, isLoadingMore = false, onLoadMore, } = props;
|
|
24
|
+
const { activator = React.createElement(Button, { icon: "add", type: "secondary", ariaLabel: "Add" }), attachTo, isLoadingMore = false, onLoadMore, options, } = props;
|
|
24
25
|
const { activeIndex, allOptions, hasAvailableOptions, inputRef, menuId, menuOpen, searchValue, generateDescendantId, handleBlur, handleOpenMenu, handleSearchChange, handleCancelBlur, handleEnableBlur, handleSetActiveOnMouseOver, handleKeyDown, handleSelectOption, handleDebouncedSearch, } = useInternalChipDismissibleInput(props);
|
|
25
26
|
const menuRef = useScrollToActive(activeIndex);
|
|
26
27
|
const { ref: visibleChildRef, isInView } = useInView();
|
|
27
28
|
const { styles: popperStyles, attributes, update, setPositionedElementRef, } = useRepositionMenu(attachTo);
|
|
29
|
+
useSafeLayoutEffect_1(() => {
|
|
30
|
+
update === null || update === void 0 ? void 0 : update();
|
|
31
|
+
}, [allOptions, menuOpen, update, options]);
|
|
28
32
|
useEffect(() => {
|
|
29
|
-
|
|
30
|
-
update();
|
|
31
|
-
}, [allOptions]);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
handleDebouncedSearch();
|
|
33
|
+
handleDebouncedSearch(searchValue, options);
|
|
34
34
|
return handleDebouncedSearch.cancel;
|
|
35
|
-
}, [searchValue]);
|
|
35
|
+
}, [searchValue, options]);
|
|
36
36
|
useEffect(() => {
|
|
37
37
|
isInView && onLoadMore && onLoadMore(searchValue);
|
|
38
38
|
}, [isInView]);
|
|
@@ -374,6 +374,12 @@ function useInternalChipDismissibleInput({ options, isLoadingMore = false, onCus
|
|
|
374
374
|
nextOptionIndex: activeIndex < maxOptionIndex ? activeIndex + 1 : 0,
|
|
375
375
|
previousOptionIndex: activeIndex > 0 ? activeIndex - 1 : maxOptionIndex,
|
|
376
376
|
};
|
|
377
|
+
function handleSearch(newSearchValue, newOptions = []) {
|
|
378
|
+
onSearch && onSearch(newSearchValue);
|
|
379
|
+
setAllOptions(generateOptions(newOptions, newSearchValue, canAddCustomOption));
|
|
380
|
+
setShouldCancelEnter(false);
|
|
381
|
+
}
|
|
382
|
+
const handleDebouncedSearch = debounce.debounce(handleSearch, 300);
|
|
377
383
|
const actions = {
|
|
378
384
|
generateDescendantId: (index) => `${computed.menuId}-${index}`,
|
|
379
385
|
handleReset: () => {
|
|
@@ -446,11 +452,7 @@ function useInternalChipDismissibleInput({ options, isLoadingMore = false, onCus
|
|
|
446
452
|
}
|
|
447
453
|
handleKeydownEvents(callbacks, event);
|
|
448
454
|
},
|
|
449
|
-
handleDebouncedSearch
|
|
450
|
-
onSearch && onSearch(searchValue);
|
|
451
|
-
setAllOptions(generateOptions(options, searchValue, canAddCustomOption));
|
|
452
|
-
setShouldCancelEnter(false);
|
|
453
|
-
}, 300),
|
|
455
|
+
handleDebouncedSearch,
|
|
454
456
|
};
|
|
455
457
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, actions), { activeIndex,
|
|
456
458
|
allOptions }), computed), { menuOpen,
|
|
@@ -372,6 +372,12 @@ function useInternalChipDismissibleInput({ options, isLoadingMore = false, onCus
|
|
|
372
372
|
nextOptionIndex: activeIndex < maxOptionIndex ? activeIndex + 1 : 0,
|
|
373
373
|
previousOptionIndex: activeIndex > 0 ? activeIndex - 1 : maxOptionIndex,
|
|
374
374
|
};
|
|
375
|
+
function handleSearch(newSearchValue, newOptions = []) {
|
|
376
|
+
onSearch && onSearch(newSearchValue);
|
|
377
|
+
setAllOptions(generateOptions(newOptions, newSearchValue, canAddCustomOption));
|
|
378
|
+
setShouldCancelEnter(false);
|
|
379
|
+
}
|
|
380
|
+
const handleDebouncedSearch = debounce(handleSearch, 300);
|
|
375
381
|
const actions = {
|
|
376
382
|
generateDescendantId: (index) => `${computed.menuId}-${index}`,
|
|
377
383
|
handleReset: () => {
|
|
@@ -444,11 +450,7 @@ function useInternalChipDismissibleInput({ options, isLoadingMore = false, onCus
|
|
|
444
450
|
}
|
|
445
451
|
handleKeydownEvents(callbacks, event);
|
|
446
452
|
},
|
|
447
|
-
handleDebouncedSearch
|
|
448
|
-
onSearch && onSearch(searchValue);
|
|
449
|
-
setAllOptions(generateOptions(options, searchValue, canAddCustomOption));
|
|
450
|
-
setShouldCancelEnter(false);
|
|
451
|
-
}, 300),
|
|
453
|
+
handleDebouncedSearch,
|
|
452
454
|
};
|
|
453
455
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, actions), { activeIndex,
|
|
454
456
|
allOptions }), computed), { menuOpen,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.17.2",
|
|
3
|
+
"version": "6.17.3-MIKEfix-d-ae9bfc6.2+ae9bfc6d",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -489,5 +489,5 @@
|
|
|
489
489
|
"> 1%",
|
|
490
490
|
"IE 10"
|
|
491
491
|
],
|
|
492
|
-
"gitHead": "
|
|
492
|
+
"gitHead": "ae9bfc6d0046773a38cf39e361070c6ea3c2a48d"
|
|
493
493
|
}
|