@jobber/components 6.90.4 → 6.91.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/dist/AtlantisThemeContext-es.js +1 -1
- package/dist/Autocomplete/index.cjs +12 -15
- package/dist/Autocomplete/index.mjs +13 -16
- package/dist/Banner/index.cjs +1 -6
- package/dist/Banner/index.mjs +1 -6
- package/dist/Banner-cjs.js +2 -2
- package/dist/Banner-es.js +2 -2
- package/dist/Card/index.cjs +1 -4
- package/dist/Card/index.mjs +1 -4
- package/dist/Chip/index.cjs +1 -3
- package/dist/Chip/index.mjs +1 -3
- package/dist/Chip-cjs.js +3 -3
- package/dist/Chip-es.js +3 -3
- package/dist/Chips/InternalChipDismissible/hooks/index.cjs +1 -0
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +1 -0
- package/dist/Chips/InternalChipDismissible/index.cjs +1 -3
- package/dist/Chips/InternalChipDismissible/index.mjs +1 -3
- package/dist/Chips/index.cjs +1 -3
- package/dist/Chips/index.mjs +1 -3
- package/dist/Combobox/components/ComboboxActivator/index.cjs +1 -3
- package/dist/Combobox/components/ComboboxActivator/index.mjs +1 -3
- package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.cjs +1 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.mjs +1 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.cjs +1 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.mjs +1 -1
- package/dist/Combobox/components/ComboboxContent/index.cjs +1 -3
- package/dist/Combobox/components/ComboboxContent/index.mjs +1 -3
- package/dist/Combobox/components/ComboboxTrigger/index.cjs +1 -3
- package/dist/Combobox/components/ComboboxTrigger/index.mjs +1 -3
- package/dist/Combobox/index.cjs +1 -6
- package/dist/Combobox/index.mjs +1 -6
- package/dist/Combobox-cjs.js +2 -2
- package/dist/Combobox-es.js +2 -2
- package/dist/ComboboxContent-cjs.js +3 -4
- package/dist/ComboboxContent-es.js +4 -5
- package/dist/ComboboxLoadMore-cjs.js +2 -2
- package/dist/ComboboxLoadMore-es.js +2 -2
- package/dist/ConfirmationModal/index.cjs +1 -3
- package/dist/ConfirmationModal/index.mjs +1 -3
- package/dist/ConfirmationModal-cjs.js +2 -2
- package/dist/ConfirmationModal-es.js +2 -2
- package/dist/ContentBlock/index.cjs +1 -6
- package/dist/ContentBlock/index.mjs +1 -6
- package/dist/ContentBlock-cjs.js +2 -2
- package/dist/ContentBlock-es.js +2 -2
- package/dist/DataDump/index.cjs +1 -4
- package/dist/DataDump/index.mjs +1 -4
- package/dist/DataList/components/DataListActions/index.cjs +1 -5
- package/dist/DataList/components/DataListActions/index.mjs +1 -5
- package/dist/DataList/components/DataListActionsMenu/index.cjs +1 -5
- package/dist/DataList/components/DataListActionsMenu/index.mjs +1 -5
- package/dist/DataList/components/DataListBulkActions/index.cjs +1 -5
- package/dist/DataList/components/DataListBulkActions/index.mjs +1 -5
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +1 -6
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +1 -6
- package/dist/DataList/components/DataListFilters/index.cjs +1 -7
- package/dist/DataList/components/DataListFilters/index.mjs +1 -7
- package/dist/DataList/components/DataListHeader/index.cjs +1 -5
- package/dist/DataList/components/DataListHeader/index.mjs +1 -5
- package/dist/DataList/components/DataListHeaderTile/components/index.cjs +1 -2
- package/dist/DataList/components/DataListHeaderTile/components/index.mjs +1 -2
- package/dist/DataList/components/DataListHeaderTile/index.cjs +1 -3
- package/dist/DataList/components/DataListHeaderTile/index.mjs +1 -3
- package/dist/DataList/components/DataListItem/index.cjs +1 -5
- package/dist/DataList/components/DataListItem/index.mjs +1 -5
- package/dist/DataList/components/DataListItemActions/index.cjs +1 -5
- package/dist/DataList/components/DataListItemActions/index.mjs +1 -5
- package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +1 -5
- package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +1 -5
- package/dist/DataList/components/DataListItems/index.cjs +1 -5
- package/dist/DataList/components/DataListItems/index.mjs +1 -5
- package/dist/DataList/components/DataListLayout/index.cjs +1 -5
- package/dist/DataList/components/DataListLayout/index.mjs +1 -5
- package/dist/DataList/components/DataListLayoutActions/index.cjs +1 -5
- package/dist/DataList/components/DataListLayoutActions/index.mjs +1 -5
- package/dist/DataList/components/DataListLoadMore/index.cjs +1 -1
- package/dist/DataList/components/DataListLoadMore/index.mjs +1 -1
- package/dist/DataList/components/DataListOverflowFade/index.cjs +1 -1
- package/dist/DataList/components/DataListOverflowFade/index.mjs +1 -1
- package/dist/DataList/components/DataListSearch/index.cjs +1 -2
- package/dist/DataList/components/DataListSearch/index.mjs +1 -2
- package/dist/DataList/components/DataListStatusBar/index.cjs +1 -3
- package/dist/DataList/components/DataListStatusBar/index.mjs +1 -3
- package/dist/DataList/index.cjs +1 -7
- package/dist/DataList/index.mjs +1 -7
- package/dist/DataListActionsMenu-cjs.js +5 -8
- package/dist/DataListActionsMenu-es.js +5 -8
- package/dist/DataListHeaderTile-cjs.js +2 -2
- package/dist/DataListHeaderTile-es.js +2 -2
- package/dist/DataListLoadMore-cjs.js +2 -2
- package/dist/DataListLoadMore-es.js +2 -2
- package/dist/DataListOverflowFade-cjs.js +3 -3
- package/dist/DataListOverflowFade-es.js +3 -3
- package/dist/DataListSearch-cjs.js +2 -2
- package/dist/DataListSearch-es.js +2 -2
- package/dist/DataListSortingOptions-cjs.js +3 -4
- package/dist/DataListSortingOptions-es.js +3 -4
- package/dist/DataTable/index.cjs +4 -6
- package/dist/DataTable/index.mjs +4 -6
- package/dist/DataTable/test-utilities/index.cjs +1 -7
- package/dist/DataTable/test-utilities/index.mjs +1 -7
- package/dist/DataTable-cjs.js +4 -4
- package/dist/DataTable-es.js +4 -4
- package/dist/DatePicker/index.cjs +1 -1
- package/dist/DatePicker/index.mjs +1 -1
- package/dist/DatePicker-cjs.js +2 -2
- package/dist/DatePicker-es.js +3 -3
- package/dist/Disclosure/index.cjs +1 -6
- package/dist/Disclosure/index.mjs +1 -6
- package/dist/Disclosure-cjs.js +3 -3
- package/dist/Disclosure-es.js +3 -3
- package/dist/FormField/FormFieldWrapper.d.ts +1 -1
- package/dist/FormField/index.cjs +1 -0
- package/dist/FormField/index.mjs +1 -0
- package/dist/FormField-cjs.js +2 -21
- package/dist/FormField-es.js +2 -21
- package/dist/FormatFile/index.cjs +1 -3
- package/dist/FormatFile/index.mjs +1 -3
- package/dist/Gallery/index.cjs +1 -6
- package/dist/Gallery/index.mjs +1 -6
- package/dist/InputDate/index.cjs +1 -2
- package/dist/InputDate/index.mjs +1 -2
- package/dist/InputEmail/index.cjs +1 -0
- package/dist/InputEmail/index.mjs +1 -0
- package/dist/InputNumber/index.cjs +1 -0
- package/dist/InputNumber/index.mjs +1 -0
- package/dist/InputPassword/index.cjs +1 -0
- package/dist/InputPassword/index.mjs +1 -0
- package/dist/InputPassword-cjs.js +1 -0
- package/dist/InputPassword-es.js +1 -0
- package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +1 -1
- package/dist/InputPhoneNumber/index.cjs +1 -0
- package/dist/InputPhoneNumber/index.mjs +1 -0
- package/dist/InputText/InputText.d.ts +2 -2
- package/dist/InputText/index.cjs +3 -3
- package/dist/InputText/index.mjs +3 -3
- package/dist/InputTime/index.cjs +1 -0
- package/dist/InputTime/index.mjs +2 -1
- package/dist/InternalChipDismissible-cjs.js +1 -0
- package/dist/InternalChipDismissible-es.js +1 -0
- package/dist/LightBox/index.cjs +1 -6
- package/dist/LightBox/index.mjs +1 -6
- package/dist/LightBox-cjs.js +12 -74
- package/dist/LightBox-es.js +12 -74
- package/dist/Menu/index.cjs +1 -4
- package/dist/Menu/index.mjs +1 -4
- package/dist/Menu-cjs.js +5 -37
- package/dist/Menu-es.js +6 -38
- package/dist/Modal/index.cjs +4 -6
- package/dist/Modal/index.mjs +5 -7
- package/dist/Page/index.cjs +2 -10
- package/dist/Page/index.mjs +2 -10
- package/dist/Page-cjs.js +5 -5
- package/dist/Page-es.js +5 -5
- package/dist/Popover/index.cjs +1 -1
- package/dist/Popover/index.mjs +1 -1
- package/dist/Popover-cjs.js +2 -2
- package/dist/Popover-es.js +3 -3
- package/dist/RecurringSelect/index.cjs +1 -0
- package/dist/RecurringSelect/index.mjs +1 -0
- package/dist/Select/index.cjs +1 -0
- package/dist/Select/index.mjs +1 -0
- package/dist/SideDrawer/index.cjs +1 -5
- package/dist/SideDrawer/index.mjs +1 -5
- package/dist/SideDrawer-cjs.js +7 -10
- package/dist/SideDrawer-es.js +7 -10
- package/dist/Tabs/index.cjs +0 -1
- package/dist/Tabs/index.mjs +0 -1
- package/dist/Tabs-cjs.js +76 -2
- package/dist/Tabs-es.js +76 -2
- package/dist/Tooltip/index.cjs +1 -2
- package/dist/Tooltip/index.mjs +1 -2
- package/dist/Tooltip-cjs.js +3 -4
- package/dist/Tooltip-es.js +4 -5
- package/dist/_baseEach-es.js +1 -1
- package/dist/_commonjsHelpers-cjs.js +0 -26
- package/dist/_commonjsHelpers-es.js +1 -26
- package/dist/_isIterateeCall-es.js +1 -1
- package/dist/debounce-es.js +2 -2
- package/dist/floating-ui.react-es.js +1 -1
- package/dist/helpers-cjs.js +21 -2
- package/dist/helpers-es.js +1 -1
- package/dist/index.cjs +1 -9
- package/dist/index.mjs +1 -9
- package/dist/isObjectLike-es.js +1 -1
- package/dist/isSymbol-es.js +1 -1
- package/dist/isTypedArray-es.js +1 -1
- package/dist/keysIn-es.js +1 -1
- package/dist/omit-es.js +1 -1
- package/dist/useScrollToActive-cjs.js +3 -45
- package/dist/useScrollToActive-es.js +5 -47
- package/package.json +3 -3
- package/rollup.config.mjs +0 -15
- package/dist/throttle-cjs.js +0 -80
- package/dist/throttle-es.js +0 -77
- package/dist/useDebounce-cjs.js +0 -4416
- package/dist/useDebounce-es.js +0 -4413
- package/dist/useFocusTrap-cjs.js +0 -75
- package/dist/useFocusTrap-es.js +0 -73
- package/dist/useInView-cjs.js +0 -26
- package/dist/useInView-es.js +0 -24
- package/dist/useIsMounted-cjs.js +0 -51
- package/dist/useIsMounted-es.js +0 -49
- package/dist/useOnKeyDown-cjs.js +0 -41
- package/dist/useOnKeyDown-es.js +0 -39
- package/dist/useRefocusOnActivator-cjs.js +0 -33
- package/dist/useRefocusOnActivator-es.js +0 -31
- package/dist/useResizeObserver-cjs.js +0 -1131
- package/dist/useResizeObserver-es.js +0 -1128
- package/dist/useSafeLayoutEffect-cjs.js +0 -14
- package/dist/useSafeLayoutEffect-es.js +0 -12
package/dist/_baseEach-es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as _MapCache, d as _Uint8Array, e as eq_1, c as _Stack, a as _isIndex, i as identity_1 } from './identity-es.js';
|
|
2
|
-
import { b as _Symbol,
|
|
2
|
+
import { b as _Symbol, i as isObjectLike_1, a as isObject_1 } from './isObjectLike-es.js';
|
|
3
3
|
import { e as _getAllKeys, k as keys_1, b as _baseGet, f as _castPath, g as _toKey, h as _isKey } from './_baseGet-es.js';
|
|
4
4
|
import { a as _getTag } from './_getTag-es.js';
|
|
5
5
|
import { c as isBufferExports, d as isTypedArray_1, a as isArray_1, i as isArguments_1, m as isLength_1, b as isArrayLike_1 } from './isTypedArray-es.js';
|
|
@@ -6,31 +6,5 @@ function getDefaultExportFromCjs (x) {
|
|
|
6
6
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
function getAugmentedNamespace(n) {
|
|
10
|
-
if (n.__esModule) return n;
|
|
11
|
-
var f = n.default;
|
|
12
|
-
if (typeof f == "function") {
|
|
13
|
-
var a = function a () {
|
|
14
|
-
if (this instanceof a) {
|
|
15
|
-
return Reflect.construct(f, arguments, this.constructor);
|
|
16
|
-
}
|
|
17
|
-
return f.apply(this, arguments);
|
|
18
|
-
};
|
|
19
|
-
a.prototype = f.prototype;
|
|
20
|
-
} else a = {};
|
|
21
|
-
Object.defineProperty(a, '__esModule', {value: true});
|
|
22
|
-
Object.keys(n).forEach(function (k) {
|
|
23
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
24
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return n[k];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
return a;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
9
|
exports.commonjsGlobal = commonjsGlobal;
|
|
35
|
-
exports.getAugmentedNamespace = getAugmentedNamespace;
|
|
36
10
|
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
|
@@ -4,29 +4,4 @@ function getDefaultExportFromCjs (x) {
|
|
|
4
4
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
if (n.__esModule) return n;
|
|
9
|
-
var f = n.default;
|
|
10
|
-
if (typeof f == "function") {
|
|
11
|
-
var a = function a () {
|
|
12
|
-
if (this instanceof a) {
|
|
13
|
-
return Reflect.construct(f, arguments, this.constructor);
|
|
14
|
-
}
|
|
15
|
-
return f.apply(this, arguments);
|
|
16
|
-
};
|
|
17
|
-
a.prototype = f.prototype;
|
|
18
|
-
} else a = {};
|
|
19
|
-
Object.defineProperty(a, '__esModule', {value: true});
|
|
20
|
-
Object.keys(n).forEach(function (k) {
|
|
21
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
22
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function () {
|
|
25
|
-
return n[k];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
return a;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { getAugmentedNamespace as a, commonjsGlobal as c, getDefaultExportFromCjs as g };
|
|
7
|
+
export { commonjsGlobal as c, getDefaultExportFromCjs as g };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as identity_1, e as eq_1, a as _isIndex } from './identity-es.js';
|
|
2
2
|
import { _ as _overRest, a as _setToString } from './_setToString-es.js';
|
|
3
3
|
import { b as isArrayLike_1 } from './isTypedArray-es.js';
|
|
4
|
-
import {
|
|
4
|
+
import { a as isObject_1 } from './isObjectLike-es.js';
|
|
5
5
|
|
|
6
6
|
var identity = identity_1,
|
|
7
7
|
overRest = _overRest,
|
package/dist/debounce-es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as getDefaultExportFromCjs } from './_commonjsHelpers-es.js';
|
|
2
|
-
import { c as _root,
|
|
2
|
+
import { c as _root, a as isObject_1 } from './isObjectLike-es.js';
|
|
3
3
|
import { i as isSymbol_1 } from './isSymbol-es.js';
|
|
4
4
|
|
|
5
5
|
var root = _root;
|
|
@@ -326,4 +326,4 @@ var debounce_1 = debounce;
|
|
|
326
326
|
|
|
327
327
|
var debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(debounce_1);
|
|
328
328
|
|
|
329
|
-
export {
|
|
329
|
+
export { debounce_1 as a, debounce$1 as d };
|
|
@@ -7261,4 +7261,4 @@ function useTransitionStyles(context, props) {
|
|
|
7261
7261
|
};
|
|
7262
7262
|
}
|
|
7263
7263
|
|
|
7264
|
-
export { FloatingPortal as F,
|
|
7264
|
+
export { FloatingPortal as F, useDismiss as a, useInteractions as b, autoUpdate as c, shift as d, arrow as e, flip as f, useFloatingParentNodeId as g, useFloatingNodeId as h, FloatingTree as i, FloatingNode as j, autoPlacement as k, limitShift as l, useRole as m, FloatingFocusManager as n, offset as o, FloatingOverlay as p, useListNavigation as q, useTransitionStyles as r, size as s, FloatingArrow as t, useFloating as u };
|
package/dist/helpers-cjs.js
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var jobberHooks = require('@jobber/hooks');
|
|
4
|
+
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
var n = Object.create(null);
|
|
7
|
+
if (e) {
|
|
8
|
+
Object.keys(e).forEach(function (k) {
|
|
9
|
+
if (k !== 'default') {
|
|
10
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return e[k]; }
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var jobberHooks__namespace = /*#__PURE__*/_interopNamespaceDefault(jobberHooks);
|
|
4
23
|
|
|
5
24
|
const mockContainerWidth = (exactWidth) => {
|
|
6
|
-
jest.spyOn(
|
|
25
|
+
jest.spyOn(jobberHooks__namespace, "useResizeObserver").mockReturnValue([
|
|
7
26
|
{ current: null },
|
|
8
27
|
{
|
|
9
28
|
width: 1200,
|
package/dist/helpers-es.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,7 @@ var Countdown = require('./Countdown-cjs.js');
|
|
|
30
30
|
var DataDump = require('./DataDump-cjs.js');
|
|
31
31
|
var DataList = require('./DataList-cjs.js');
|
|
32
32
|
var DataTable = require('./DataTable-cjs.js');
|
|
33
|
-
require('
|
|
33
|
+
require('@jobber/hooks');
|
|
34
34
|
require('./DataTableTable-cjs.js');
|
|
35
35
|
var reactTable = require('@tanstack/react-table');
|
|
36
36
|
var DatePicker = require('./DatePicker-cjs.js');
|
|
@@ -110,17 +110,12 @@ require('./_setToString-cjs.js');
|
|
|
110
110
|
require('./floating-ui.react-cjs.js');
|
|
111
111
|
require('react-dom');
|
|
112
112
|
require('classnames');
|
|
113
|
-
require('./useDebounce-cjs.js');
|
|
114
113
|
require('./maxHeight-cjs.js');
|
|
115
114
|
require('./tslib.es6-cjs.js');
|
|
116
|
-
require('./useIsMounted-cjs.js');
|
|
117
|
-
require('./useSafeLayoutEffect-cjs.js');
|
|
118
|
-
require('./useOnKeyDown-cjs.js');
|
|
119
115
|
require('color');
|
|
120
116
|
require('react-router-dom');
|
|
121
117
|
require('./getMappedAtlantisSpaceToken-cjs.js');
|
|
122
118
|
require('react-hook-form');
|
|
123
|
-
require('./useInView-cjs.js');
|
|
124
119
|
require('./useChildComponent-cjs.js');
|
|
125
120
|
require('./InternalChipDismissible-cjs.js');
|
|
126
121
|
require('./useScrollToActive-cjs.js');
|
|
@@ -136,8 +131,6 @@ require('./ComboboxContentList-cjs.js');
|
|
|
136
131
|
require('./ComboboxOption-cjs.js');
|
|
137
132
|
require('./ComboboxLoadMore-cjs.js');
|
|
138
133
|
require('./ComboboxContentHeader-cjs.js');
|
|
139
|
-
require('./useRefocusOnActivator-cjs.js');
|
|
140
|
-
require('./useFocusTrap-cjs.js');
|
|
141
134
|
require('./constants-cjs.js');
|
|
142
135
|
require('./ComboboxAction-cjs.js');
|
|
143
136
|
require('./ComboboxTrigger-cjs.js');
|
|
@@ -178,7 +171,6 @@ require('./DataListLoadMore-cjs.js');
|
|
|
178
171
|
require('./DataListAction-cjs.js');
|
|
179
172
|
require('./DataListLayoutActions-cjs.js');
|
|
180
173
|
require('./DataListStatusBar-cjs.js');
|
|
181
|
-
require('./throttle-cjs.js');
|
|
182
174
|
require('./clsx-cjs.js');
|
|
183
175
|
require('./omit-cjs.js');
|
|
184
176
|
require('./useFormFieldFocus-cjs.js');
|
package/dist/index.mjs
CHANGED
|
@@ -28,7 +28,7 @@ export { C as Countdown } from './Countdown-es.js';
|
|
|
28
28
|
export { D as DataDump } from './DataDump-es.js';
|
|
29
29
|
export { D as DataList } from './DataList-es.js';
|
|
30
30
|
export { D as DataTable } from './DataTable-es.js';
|
|
31
|
-
import '
|
|
31
|
+
import '@jobber/hooks';
|
|
32
32
|
import './DataTableTable-es.js';
|
|
33
33
|
export { createColumnHelper } from '@tanstack/react-table';
|
|
34
34
|
export { D as DatePicker } from './DatePicker-es.js';
|
|
@@ -108,17 +108,12 @@ import './_setToString-es.js';
|
|
|
108
108
|
import './floating-ui.react-es.js';
|
|
109
109
|
import 'react-dom';
|
|
110
110
|
import 'classnames';
|
|
111
|
-
import './useDebounce-es.js';
|
|
112
111
|
import './maxHeight-es.js';
|
|
113
112
|
import './tslib.es6-es.js';
|
|
114
|
-
import './useIsMounted-es.js';
|
|
115
|
-
import './useSafeLayoutEffect-es.js';
|
|
116
|
-
import './useOnKeyDown-es.js';
|
|
117
113
|
import 'color';
|
|
118
114
|
import 'react-router-dom';
|
|
119
115
|
import './getMappedAtlantisSpaceToken-es.js';
|
|
120
116
|
import 'react-hook-form';
|
|
121
|
-
import './useInView-es.js';
|
|
122
117
|
import './useChildComponent-es.js';
|
|
123
118
|
import './InternalChipDismissible-es.js';
|
|
124
119
|
import './useScrollToActive-es.js';
|
|
@@ -134,8 +129,6 @@ import './ComboboxContentList-es.js';
|
|
|
134
129
|
import './ComboboxOption-es.js';
|
|
135
130
|
import './ComboboxLoadMore-es.js';
|
|
136
131
|
import './ComboboxContentHeader-es.js';
|
|
137
|
-
import './useRefocusOnActivator-es.js';
|
|
138
|
-
import './useFocusTrap-es.js';
|
|
139
132
|
import './constants-es.js';
|
|
140
133
|
import './ComboboxAction-es.js';
|
|
141
134
|
import './ComboboxTrigger-es.js';
|
|
@@ -176,7 +169,6 @@ import './DataListLoadMore-es.js';
|
|
|
176
169
|
import './DataListAction-es.js';
|
|
177
170
|
import './DataListLayoutActions-es.js';
|
|
178
171
|
import './DataListStatusBar-es.js';
|
|
179
|
-
import './throttle-es.js';
|
|
180
172
|
import './clsx-es.js';
|
|
181
173
|
import './omit-es.js';
|
|
182
174
|
import './useFormFieldFocus-es.js';
|
package/dist/isObjectLike-es.js
CHANGED
|
@@ -187,4 +187,4 @@ function isObjectLike(value) {
|
|
|
187
187
|
|
|
188
188
|
var isObjectLike_1 = isObjectLike;
|
|
189
189
|
|
|
190
|
-
export { _baseGetTag as _,
|
|
190
|
+
export { _baseGetTag as _, isObject_1 as a, _Symbol as b, _root as c, _freeGlobal as d, isObjectLike_1 as i };
|
package/dist/isSymbol-es.js
CHANGED
package/dist/isTypedArray-es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _baseGetTag,
|
|
1
|
+
import { _ as _baseGetTag, a as isObject_1, c as _root, i as isObjectLike_1, d as _freeGlobal } from './isObjectLike-es.js';
|
|
2
2
|
|
|
3
3
|
var baseGetTag$2 = _baseGetTag,
|
|
4
4
|
isObject$1 = isObject_1;
|
package/dist/keysIn-es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as _root,
|
|
1
|
+
import { c as _root, a as isObject_1, _ as _baseGetTag, i as isObjectLike_1 } from './isObjectLike-es.js';
|
|
2
2
|
import { d as _Uint8Array, e as eq_1, f as _arrayLikeKeys } from './identity-es.js';
|
|
3
3
|
import { e as _overArg, _ as _isPrototype, b as isArrayLike_1 } from './isTypedArray-es.js';
|
|
4
4
|
import { _ as _baseAssignValue } from './_baseAssignValue-es.js';
|
package/dist/omit-es.js
CHANGED
|
@@ -3,7 +3,7 @@ import { k as keys_1, c as _getSymbols, _ as _arrayPush, s as stubArray_1, d as
|
|
|
3
3
|
import { c as _Stack } from './identity-es.js';
|
|
4
4
|
import { _ as _copyObject, k as keysIn_1, e as _getPrototype, f as _cloneArrayBuffer, b as _cloneTypedArray, a as _cloneBufferExports, c as _copyArray, d as _initCloneObject, g as _assignValue, i as isPlainObject_1 } from './keysIn-es.js';
|
|
5
5
|
import { a as _getTag } from './_getTag-es.js';
|
|
6
|
-
import { b as _Symbol,
|
|
6
|
+
import { b as _Symbol, i as isObjectLike_1, a as isObject_1 } from './isObjectLike-es.js';
|
|
7
7
|
import { l as _nodeUtilExports, k as _baseUnary, c as isBufferExports, a as isArray_1 } from './isTypedArray-es.js';
|
|
8
8
|
import { _ as _baseFlatten } from './_baseFlatten-es.js';
|
|
9
9
|
import { _ as _overRest, a as _setToString } from './_setToString-es.js';
|
|
@@ -9,6 +9,7 @@ var isTypedArray = require('./isTypedArray-cjs.js');
|
|
|
9
9
|
var isSymbol$1 = require('./isSymbol-cjs.js');
|
|
10
10
|
var identity$1 = require('./identity-cjs.js');
|
|
11
11
|
var _isIterateeCall = require('./_isIterateeCall-cjs.js');
|
|
12
|
+
var jobberHooks = require('@jobber/hooks');
|
|
12
13
|
var debounce = require('./debounce-cjs.js');
|
|
13
14
|
var Icon = require('./Icon-cjs.js');
|
|
14
15
|
var floatingUi_react = require('./floating-ui.react-cjs.js');
|
|
@@ -248,49 +249,6 @@ var sortBy_1 = sortBy;
|
|
|
248
249
|
|
|
249
250
|
var sortBy$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(sortBy_1);
|
|
250
251
|
|
|
251
|
-
var useLiveAnnounce$1 = {};
|
|
252
|
-
|
|
253
|
-
Object.defineProperty(useLiveAnnounce$1, "__esModule", { value: true });
|
|
254
|
-
var useLiveAnnounce_2 = useLiveAnnounce$1.useLiveAnnounce = useLiveAnnounce;
|
|
255
|
-
const react_1 = React;
|
|
256
|
-
/**
|
|
257
|
-
* Announce a message on voice over whenever you do an action. This is
|
|
258
|
-
* especially helpful when you have an action that adds or deletes an element
|
|
259
|
-
* from the screen.
|
|
260
|
-
*/
|
|
261
|
-
function useLiveAnnounce() {
|
|
262
|
-
const [announcedMessage, setAnnouncedMessage] = (0, react_1.useState)("");
|
|
263
|
-
(0, react_1.useEffect)(() => {
|
|
264
|
-
let target;
|
|
265
|
-
if (announcedMessage) {
|
|
266
|
-
target = createAnnouncedElement();
|
|
267
|
-
setTimeout(() => target.append(announcedMessage), 100);
|
|
268
|
-
}
|
|
269
|
-
return () => target === null || target === void 0 ? void 0 : target.remove();
|
|
270
|
-
}, [announcedMessage]);
|
|
271
|
-
return {
|
|
272
|
-
liveAnnounce: (message) => {
|
|
273
|
-
setAnnouncedMessage(message);
|
|
274
|
-
},
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
// eslint-disable-next-line max-statements
|
|
278
|
-
function createAnnouncedElement() {
|
|
279
|
-
const el = document.createElement("div");
|
|
280
|
-
el.style.position = "absolute";
|
|
281
|
-
el.style.width = "1px";
|
|
282
|
-
el.style.height = "1px";
|
|
283
|
-
el.style.overflow = "hidden";
|
|
284
|
-
el.style.clipPath = " inset(100%)";
|
|
285
|
-
el.style.whiteSpace = " nowrap";
|
|
286
|
-
el.style.top = "0";
|
|
287
|
-
el.setAttribute("role", "status");
|
|
288
|
-
el.setAttribute("aria-atomic", "true");
|
|
289
|
-
el.setAttribute("aria-live", "assertive");
|
|
290
|
-
document.body.appendChild(el);
|
|
291
|
-
return el;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
252
|
/**
|
|
295
253
|
* Recursively finds a focusable element (div or button) in the specified direction
|
|
296
254
|
*/
|
|
@@ -316,7 +274,7 @@ function useInternalChipDismissible({ children, selected, onChange, onClick, onC
|
|
|
316
274
|
const visibleChipOptions = chipOptions.filter(chip => selected.includes(chip.value));
|
|
317
275
|
const sortedVisibleChipOptions = sortBy$1(visibleChipOptions, chip => selected.indexOf(chip.value));
|
|
318
276
|
const availableChipOptions = chipOptions.filter(chip => !selected.includes(chip.value));
|
|
319
|
-
const { liveAnnounce } =
|
|
277
|
+
const { liveAnnounce } = jobberHooks.useLiveAnnounce();
|
|
320
278
|
const actions = {
|
|
321
279
|
handleChipRemove: (value) => {
|
|
322
280
|
return () => {
|
|
@@ -386,7 +344,7 @@ function useInternalChipDismissibleInput({ options, isLoadingMore = false, onCus
|
|
|
386
344
|
const [shouldCancelEnter, setShouldCancelEnter] = React.useState(false);
|
|
387
345
|
const canAddCustomOption = onCustomOptionSelect !== undefined && !isLoadingMore;
|
|
388
346
|
const maxOptionIndex = allOptions.length - 1;
|
|
389
|
-
const { liveAnnounce } =
|
|
347
|
+
const { liveAnnounce } = jobberHooks.useLiveAnnounce();
|
|
390
348
|
React.useEffect(() => {
|
|
391
349
|
setAllOptions(generateOptions(options, searchValue, canAddCustomOption));
|
|
392
350
|
}, [options]);
|
|
@@ -7,9 +7,10 @@ import { b as isArrayLike_1, k as _baseUnary, a as isArray_1 } from './isTypedAr
|
|
|
7
7
|
import { i as isSymbol_1 } from './isSymbol-es.js';
|
|
8
8
|
import { i as identity_1 } from './identity-es.js';
|
|
9
9
|
import { _ as _baseRest, a as _isIterateeCall } from './_isIterateeCall-es.js';
|
|
10
|
-
import {
|
|
10
|
+
import { useLiveAnnounce } from '@jobber/hooks';
|
|
11
|
+
import { d as debounce } from './debounce-es.js';
|
|
11
12
|
import { I as Icon } from './Icon-es.js';
|
|
12
|
-
import { u as useFloating, o as offset, f as flip,
|
|
13
|
+
import { u as useFloating, o as offset, f as flip, s as size, c as autoUpdate } from './floating-ui.react-es.js';
|
|
13
14
|
import { c as calculateMaxHeight } from './maxHeight-es.js';
|
|
14
15
|
|
|
15
16
|
var baseEach = _baseEach,
|
|
@@ -246,49 +247,6 @@ var sortBy_1 = sortBy;
|
|
|
246
247
|
|
|
247
248
|
var sortBy$1 = /*@__PURE__*/getDefaultExportFromCjs(sortBy_1);
|
|
248
249
|
|
|
249
|
-
var useLiveAnnounce$1 = {};
|
|
250
|
-
|
|
251
|
-
Object.defineProperty(useLiveAnnounce$1, "__esModule", { value: true });
|
|
252
|
-
var useLiveAnnounce_2 = useLiveAnnounce$1.useLiveAnnounce = useLiveAnnounce;
|
|
253
|
-
const react_1 = React__default;
|
|
254
|
-
/**
|
|
255
|
-
* Announce a message on voice over whenever you do an action. This is
|
|
256
|
-
* especially helpful when you have an action that adds or deletes an element
|
|
257
|
-
* from the screen.
|
|
258
|
-
*/
|
|
259
|
-
function useLiveAnnounce() {
|
|
260
|
-
const [announcedMessage, setAnnouncedMessage] = (0, react_1.useState)("");
|
|
261
|
-
(0, react_1.useEffect)(() => {
|
|
262
|
-
let target;
|
|
263
|
-
if (announcedMessage) {
|
|
264
|
-
target = createAnnouncedElement();
|
|
265
|
-
setTimeout(() => target.append(announcedMessage), 100);
|
|
266
|
-
}
|
|
267
|
-
return () => target === null || target === void 0 ? void 0 : target.remove();
|
|
268
|
-
}, [announcedMessage]);
|
|
269
|
-
return {
|
|
270
|
-
liveAnnounce: (message) => {
|
|
271
|
-
setAnnouncedMessage(message);
|
|
272
|
-
},
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
// eslint-disable-next-line max-statements
|
|
276
|
-
function createAnnouncedElement() {
|
|
277
|
-
const el = document.createElement("div");
|
|
278
|
-
el.style.position = "absolute";
|
|
279
|
-
el.style.width = "1px";
|
|
280
|
-
el.style.height = "1px";
|
|
281
|
-
el.style.overflow = "hidden";
|
|
282
|
-
el.style.clipPath = " inset(100%)";
|
|
283
|
-
el.style.whiteSpace = " nowrap";
|
|
284
|
-
el.style.top = "0";
|
|
285
|
-
el.setAttribute("role", "status");
|
|
286
|
-
el.setAttribute("aria-atomic", "true");
|
|
287
|
-
el.setAttribute("aria-live", "assertive");
|
|
288
|
-
document.body.appendChild(el);
|
|
289
|
-
return el;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
250
|
/**
|
|
293
251
|
* Recursively finds a focusable element (div or button) in the specified direction
|
|
294
252
|
*/
|
|
@@ -314,7 +272,7 @@ function useInternalChipDismissible({ children, selected, onChange, onClick, onC
|
|
|
314
272
|
const visibleChipOptions = chipOptions.filter(chip => selected.includes(chip.value));
|
|
315
273
|
const sortedVisibleChipOptions = sortBy$1(visibleChipOptions, chip => selected.indexOf(chip.value));
|
|
316
274
|
const availableChipOptions = chipOptions.filter(chip => !selected.includes(chip.value));
|
|
317
|
-
const { liveAnnounce } =
|
|
275
|
+
const { liveAnnounce } = useLiveAnnounce();
|
|
318
276
|
const actions = {
|
|
319
277
|
handleChipRemove: (value) => {
|
|
320
278
|
return () => {
|
|
@@ -384,7 +342,7 @@ function useInternalChipDismissibleInput({ options, isLoadingMore = false, onCus
|
|
|
384
342
|
const [shouldCancelEnter, setShouldCancelEnter] = useState(false);
|
|
385
343
|
const canAddCustomOption = onCustomOptionSelect !== undefined && !isLoadingMore;
|
|
386
344
|
const maxOptionIndex = allOptions.length - 1;
|
|
387
|
-
const { liveAnnounce } =
|
|
345
|
+
const { liveAnnounce } = useLiveAnnounce();
|
|
388
346
|
useEffect(() => {
|
|
389
347
|
setAllOptions(generateOptions(options, searchValue, canAddCustomOption));
|
|
390
348
|
}, [options]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.91.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -473,7 +473,7 @@
|
|
|
473
473
|
],
|
|
474
474
|
"dependencies": {
|
|
475
475
|
"@floating-ui/react": "^0.27.5",
|
|
476
|
-
"@jobber/formatters": "^0.
|
|
476
|
+
"@jobber/formatters": "^0.5.0",
|
|
477
477
|
"@tanstack/react-table": "8.5.13",
|
|
478
478
|
"@types/color": "^3.0.1",
|
|
479
479
|
"@types/lodash": "^4.14.136",
|
|
@@ -541,5 +541,5 @@
|
|
|
541
541
|
"> 1%",
|
|
542
542
|
"IE 10"
|
|
543
543
|
],
|
|
544
|
-
"gitHead": "
|
|
544
|
+
"gitHead": "dfeb4b6ca90a32b9ad3ab44e5a0dd110c6a113fc"
|
|
545
545
|
}
|
package/rollup.config.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/* eslint-disable import/no-default-export */
|
|
2
|
-
import { fileURLToPath } from "url";
|
|
3
|
-
import { dirname, resolve } from "path";
|
|
4
2
|
import typescript from "@rollup/plugin-typescript";
|
|
5
3
|
import postcss from "rollup-plugin-postcss";
|
|
6
4
|
import commonjs from "@rollup/plugin-commonjs";
|
|
@@ -12,10 +10,6 @@ import tools from "@csstools/postcss-global-data";
|
|
|
12
10
|
import presetenv from "postcss-preset-env";
|
|
13
11
|
import multiInput from "rollup-plugin-multi-input";
|
|
14
12
|
import nodePolyfills from "rollup-plugin-polyfill-node";
|
|
15
|
-
import alias from "@rollup/plugin-alias";
|
|
16
|
-
|
|
17
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
18
|
-
const __dirname = dirname(__filename);
|
|
19
13
|
|
|
20
14
|
/**
|
|
21
15
|
* When PREBUILD_CSS is supplied, only build the main index.ts file.
|
|
@@ -31,15 +25,6 @@ export default {
|
|
|
31
25
|
input: PREBUILD_CSS ? "src/index.ts" : `src/**/index.{ts,tsx}`,
|
|
32
26
|
plugins: [
|
|
33
27
|
nodePolyfills(),
|
|
34
|
-
alias({
|
|
35
|
-
entries: [
|
|
36
|
-
{
|
|
37
|
-
find: /@jobber\/hooks\/(.*)/,
|
|
38
|
-
replacement: (_, p1) =>
|
|
39
|
-
resolve(__dirname, `../hooks/dist/${p1}/${p1}.js`),
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
}),
|
|
43
28
|
nodeResolve(),
|
|
44
29
|
multiInput.default(),
|
|
45
30
|
typescript({
|
package/dist/throttle-cjs.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _commonjsHelpers = require('./_commonjsHelpers-cjs.js');
|
|
4
|
-
var debounce$1 = require('./debounce-cjs.js');
|
|
5
|
-
var isObjectLike = require('./isObjectLike-cjs.js');
|
|
6
|
-
|
|
7
|
-
var debounce = debounce$1.debounce_1,
|
|
8
|
-
isObject = isObjectLike.isObject_1;
|
|
9
|
-
|
|
10
|
-
/** Error message constants. */
|
|
11
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Creates a throttled function that only invokes `func` at most once per
|
|
15
|
-
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
16
|
-
* method to cancel delayed `func` invocations and a `flush` method to
|
|
17
|
-
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
18
|
-
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
19
|
-
* timeout. The `func` is invoked with the last arguments provided to the
|
|
20
|
-
* throttled function. Subsequent calls to the throttled function return the
|
|
21
|
-
* result of the last `func` invocation.
|
|
22
|
-
*
|
|
23
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
24
|
-
* invoked on the trailing edge of the timeout only if the throttled function
|
|
25
|
-
* is invoked more than once during the `wait` timeout.
|
|
26
|
-
*
|
|
27
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
28
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
29
|
-
*
|
|
30
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
31
|
-
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
32
|
-
*
|
|
33
|
-
* @static
|
|
34
|
-
* @memberOf _
|
|
35
|
-
* @since 0.1.0
|
|
36
|
-
* @category Function
|
|
37
|
-
* @param {Function} func The function to throttle.
|
|
38
|
-
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
39
|
-
* @param {Object} [options={}] The options object.
|
|
40
|
-
* @param {boolean} [options.leading=true]
|
|
41
|
-
* Specify invoking on the leading edge of the timeout.
|
|
42
|
-
* @param {boolean} [options.trailing=true]
|
|
43
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
44
|
-
* @returns {Function} Returns the new throttled function.
|
|
45
|
-
* @example
|
|
46
|
-
*
|
|
47
|
-
* // Avoid excessively updating the position while scrolling.
|
|
48
|
-
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
49
|
-
*
|
|
50
|
-
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
51
|
-
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
52
|
-
* jQuery(element).on('click', throttled);
|
|
53
|
-
*
|
|
54
|
-
* // Cancel the trailing throttled invocation.
|
|
55
|
-
* jQuery(window).on('popstate', throttled.cancel);
|
|
56
|
-
*/
|
|
57
|
-
function throttle(func, wait, options) {
|
|
58
|
-
var leading = true,
|
|
59
|
-
trailing = true;
|
|
60
|
-
|
|
61
|
-
if (typeof func != 'function') {
|
|
62
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
63
|
-
}
|
|
64
|
-
if (isObject(options)) {
|
|
65
|
-
leading = 'leading' in options ? !!options.leading : leading;
|
|
66
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
67
|
-
}
|
|
68
|
-
return debounce(func, wait, {
|
|
69
|
-
'leading': leading,
|
|
70
|
-
'maxWait': wait,
|
|
71
|
-
'trailing': trailing
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
var throttle_1 = throttle;
|
|
76
|
-
|
|
77
|
-
var throttle$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(throttle_1);
|
|
78
|
-
|
|
79
|
-
exports.throttle = throttle$1;
|
|
80
|
-
exports.throttle_1 = throttle_1;
|
package/dist/throttle-es.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { g as getDefaultExportFromCjs } from './_commonjsHelpers-es.js';
|
|
2
|
-
import { d as debounce_1 } from './debounce-es.js';
|
|
3
|
-
import { i as isObject_1 } from './isObjectLike-es.js';
|
|
4
|
-
|
|
5
|
-
var debounce = debounce_1,
|
|
6
|
-
isObject = isObject_1;
|
|
7
|
-
|
|
8
|
-
/** Error message constants. */
|
|
9
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Creates a throttled function that only invokes `func` at most once per
|
|
13
|
-
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
14
|
-
* method to cancel delayed `func` invocations and a `flush` method to
|
|
15
|
-
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
16
|
-
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
17
|
-
* timeout. The `func` is invoked with the last arguments provided to the
|
|
18
|
-
* throttled function. Subsequent calls to the throttled function return the
|
|
19
|
-
* result of the last `func` invocation.
|
|
20
|
-
*
|
|
21
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
22
|
-
* invoked on the trailing edge of the timeout only if the throttled function
|
|
23
|
-
* is invoked more than once during the `wait` timeout.
|
|
24
|
-
*
|
|
25
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
26
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
27
|
-
*
|
|
28
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
29
|
-
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
30
|
-
*
|
|
31
|
-
* @static
|
|
32
|
-
* @memberOf _
|
|
33
|
-
* @since 0.1.0
|
|
34
|
-
* @category Function
|
|
35
|
-
* @param {Function} func The function to throttle.
|
|
36
|
-
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
37
|
-
* @param {Object} [options={}] The options object.
|
|
38
|
-
* @param {boolean} [options.leading=true]
|
|
39
|
-
* Specify invoking on the leading edge of the timeout.
|
|
40
|
-
* @param {boolean} [options.trailing=true]
|
|
41
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
42
|
-
* @returns {Function} Returns the new throttled function.
|
|
43
|
-
* @example
|
|
44
|
-
*
|
|
45
|
-
* // Avoid excessively updating the position while scrolling.
|
|
46
|
-
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
47
|
-
*
|
|
48
|
-
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
49
|
-
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
50
|
-
* jQuery(element).on('click', throttled);
|
|
51
|
-
*
|
|
52
|
-
* // Cancel the trailing throttled invocation.
|
|
53
|
-
* jQuery(window).on('popstate', throttled.cancel);
|
|
54
|
-
*/
|
|
55
|
-
function throttle(func, wait, options) {
|
|
56
|
-
var leading = true,
|
|
57
|
-
trailing = true;
|
|
58
|
-
|
|
59
|
-
if (typeof func != 'function') {
|
|
60
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
61
|
-
}
|
|
62
|
-
if (isObject(options)) {
|
|
63
|
-
leading = 'leading' in options ? !!options.leading : leading;
|
|
64
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
65
|
-
}
|
|
66
|
-
return debounce(func, wait, {
|
|
67
|
-
'leading': leading,
|
|
68
|
-
'maxWait': wait,
|
|
69
|
-
'trailing': trailing
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
var throttle_1 = throttle;
|
|
74
|
-
|
|
75
|
-
var throttle$1 = /*@__PURE__*/getDefaultExportFromCjs(throttle_1);
|
|
76
|
-
|
|
77
|
-
export { throttle_1 as a, throttle$1 as t };
|