@jobber/hooks 2.19.4-edicleanu-753c899.153 → 2.19.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/dist/useCollectionQuery-cjs.js +6 -6
- package/dist/useCollectionQuery-es.js +14 -14
- package/dist/useDebounce-cjs.js +0 -1
- package/dist/useDebounce-es.js +0 -1
- package/dist/useFocusTrap-cjs.js +1 -3
- package/dist/useFocusTrap-es.js +1 -3
- package/dist/useOnKeyDown/useOnKeyDown.d.ts +1 -2
- package/dist/useResizeObserver-es.js +7 -7
- package/package.json +16 -9
|
@@ -1131,12 +1131,12 @@ var stubFalse_1 = stubFalse;
|
|
|
1131
1131
|
|
|
1132
1132
|
isBuffer$2.exports;
|
|
1133
1133
|
|
|
1134
|
-
(function (module, exports) {
|
|
1134
|
+
(function (module, exports$1) {
|
|
1135
1135
|
var root = isObjectLike$5._root,
|
|
1136
1136
|
stubFalse = stubFalse_1;
|
|
1137
1137
|
|
|
1138
1138
|
/** Detect free variable `exports`. */
|
|
1139
|
-
var freeExports = exports && !exports.nodeType && exports;
|
|
1139
|
+
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
1140
1140
|
|
|
1141
1141
|
/** Detect free variable `module`. */
|
|
1142
1142
|
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
@@ -1319,11 +1319,11 @@ var _nodeUtil = {exports: {}};
|
|
|
1319
1319
|
|
|
1320
1320
|
_nodeUtil.exports;
|
|
1321
1321
|
|
|
1322
|
-
(function (module, exports) {
|
|
1322
|
+
(function (module, exports$1) {
|
|
1323
1323
|
var freeGlobal = isObjectLike$5._freeGlobal;
|
|
1324
1324
|
|
|
1325
1325
|
/** Detect free variable `exports`. */
|
|
1326
|
-
var freeExports = exports && !exports.nodeType && exports;
|
|
1326
|
+
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
1327
1327
|
|
|
1328
1328
|
/** Detect free variable `module`. */
|
|
1329
1329
|
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
@@ -1708,11 +1708,11 @@ var _cloneBuffer = {exports: {}};
|
|
|
1708
1708
|
|
|
1709
1709
|
_cloneBuffer.exports;
|
|
1710
1710
|
|
|
1711
|
-
(function (module, exports) {
|
|
1711
|
+
(function (module, exports$1) {
|
|
1712
1712
|
var root = isObjectLike$5._root;
|
|
1713
1713
|
|
|
1714
1714
|
/** Detect free variable `exports`. */
|
|
1715
|
-
var freeExports = exports && !exports.nodeType && exports;
|
|
1715
|
+
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
1716
1716
|
|
|
1717
1717
|
/** Detect free variable `module`. */
|
|
1718
1718
|
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as apolloClient from '@apollo/client';
|
|
2
|
-
import {
|
|
2
|
+
import { c as isObject_1, b as _baseGetTag, _ as _root, i as isObjectLike_1, d as _freeGlobal, e as _Symbol, a as getDefaultExportFromCjs } from './isObjectLike-es.js';
|
|
3
3
|
import { useState, useCallback, useEffect } from 'react';
|
|
4
4
|
import { config } from '@jobber/formatters';
|
|
5
5
|
import { u as useIsMounted } from './useIsMounted-es.js';
|
|
@@ -1110,12 +1110,12 @@ var stubFalse_1 = stubFalse;
|
|
|
1110
1110
|
|
|
1111
1111
|
isBuffer$2.exports;
|
|
1112
1112
|
|
|
1113
|
-
(function (module, exports) {
|
|
1113
|
+
(function (module, exports$1) {
|
|
1114
1114
|
var root = _root,
|
|
1115
1115
|
stubFalse = stubFalse_1;
|
|
1116
1116
|
|
|
1117
1117
|
/** Detect free variable `exports`. */
|
|
1118
|
-
var freeExports = exports && !exports.nodeType && exports;
|
|
1118
|
+
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
1119
1119
|
|
|
1120
1120
|
/** Detect free variable `module`. */
|
|
1121
1121
|
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
@@ -1298,11 +1298,11 @@ var _nodeUtil = {exports: {}};
|
|
|
1298
1298
|
|
|
1299
1299
|
_nodeUtil.exports;
|
|
1300
1300
|
|
|
1301
|
-
(function (module, exports) {
|
|
1301
|
+
(function (module, exports$1) {
|
|
1302
1302
|
var freeGlobal = _freeGlobal;
|
|
1303
1303
|
|
|
1304
1304
|
/** Detect free variable `exports`. */
|
|
1305
|
-
var freeExports = exports && !exports.nodeType && exports;
|
|
1305
|
+
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
1306
1306
|
|
|
1307
1307
|
/** Detect free variable `module`. */
|
|
1308
1308
|
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
@@ -1687,11 +1687,11 @@ var _cloneBuffer = {exports: {}};
|
|
|
1687
1687
|
|
|
1688
1688
|
_cloneBuffer.exports;
|
|
1689
1689
|
|
|
1690
|
-
(function (module, exports) {
|
|
1690
|
+
(function (module, exports$1) {
|
|
1691
1691
|
var root = _root;
|
|
1692
1692
|
|
|
1693
1693
|
/** Detect free variable `exports`. */
|
|
1694
|
-
var freeExports = exports && !exports.nodeType && exports;
|
|
1694
|
+
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
1695
1695
|
|
|
1696
1696
|
/** Detect free variable `module`. */
|
|
1697
1697
|
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
@@ -2605,13 +2605,13 @@ var CLONE_DEEP_FLAG = 1,
|
|
|
2605
2605
|
* console.log(deep[0] === objects[0]);
|
|
2606
2606
|
* // => false
|
|
2607
2607
|
*/
|
|
2608
|
-
function cloneDeep(value) {
|
|
2608
|
+
function cloneDeep$1(value) {
|
|
2609
2609
|
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
|
2610
2610
|
}
|
|
2611
2611
|
|
|
2612
|
-
var cloneDeep_1 = cloneDeep;
|
|
2612
|
+
var cloneDeep_1 = cloneDeep$1;
|
|
2613
2613
|
|
|
2614
|
-
var cloneDeep
|
|
2614
|
+
var cloneDeep = /*@__PURE__*/getDefaultExportFromCjs(cloneDeep_1);
|
|
2615
2615
|
|
|
2616
2616
|
function uniqueNodes(nodes) {
|
|
2617
2617
|
const result = new Map();
|
|
@@ -2753,7 +2753,7 @@ function useCollectionQuery({ query, queryOptions, getCollectionByPath, subscrip
|
|
|
2753
2753
|
*/
|
|
2754
2754
|
function fetchMoreUpdateQueryHandler(prev, fetchMoreResult, getCollectionByPath) {
|
|
2755
2755
|
const nextCollection = getCollectionByPath(fetchMoreResult);
|
|
2756
|
-
const output = cloneDeep
|
|
2756
|
+
const output = cloneDeep(prev);
|
|
2757
2757
|
const outputCollection = getCollectionByPath(output);
|
|
2758
2758
|
if (outputCollection === undefined || nextCollection === undefined) {
|
|
2759
2759
|
return output;
|
|
@@ -2764,12 +2764,12 @@ function fetchMoreUpdateQueryHandler(prev, fetchMoreResult, getCollectionByPath)
|
|
|
2764
2764
|
if (outputCollection.edges && nextCollection.edges) {
|
|
2765
2765
|
outputCollection.edges = getUpdatedEdges(outputCollection.edges, nextCollection.edges);
|
|
2766
2766
|
}
|
|
2767
|
-
Object.assign(outputCollection, Object.assign({ pageInfo: cloneDeep
|
|
2767
|
+
Object.assign(outputCollection, Object.assign({ pageInfo: cloneDeep(nextCollection.pageInfo) }, getTotalCount(nextCollection.totalCount)));
|
|
2768
2768
|
return output;
|
|
2769
2769
|
}
|
|
2770
2770
|
function subscribeToMoreHandler(isSearching, prev, getCollectionByPath, subscriptionData, getNodeByPath) {
|
|
2771
2771
|
const node = getNodeByPath(subscriptionData);
|
|
2772
|
-
const output = cloneDeep
|
|
2772
|
+
const output = cloneDeep(prev);
|
|
2773
2773
|
const outputCollection = getCollectionByPath(output);
|
|
2774
2774
|
if (outputCollection == undefined || node == undefined)
|
|
2775
2775
|
return output;
|
|
@@ -2782,7 +2782,7 @@ function subscribeToMoreHandler(isSearching, prev, getCollectionByPath, subscrip
|
|
|
2782
2782
|
if (outputCollection.edges) {
|
|
2783
2783
|
outputCollection.edges = getUpdatedEdges(outputCollection.edges, [createEdge(node)], false);
|
|
2784
2784
|
}
|
|
2785
|
-
Object.assign(outputCollection, Object.assign({ pageInfo: cloneDeep
|
|
2785
|
+
Object.assign(outputCollection, Object.assign({ pageInfo: cloneDeep(outputCollection.pageInfo) }, getTotalCount(outputCollection.totalCount, 1)));
|
|
2786
2786
|
return output;
|
|
2787
2787
|
}
|
|
2788
2788
|
function getTotalCount(totalCount, additionalCount = 0) {
|
package/dist/useDebounce-cjs.js
CHANGED
package/dist/useDebounce-es.js
CHANGED
package/dist/useFocusTrap-cjs.js
CHANGED
|
@@ -56,9 +56,7 @@ function getElements(ref) {
|
|
|
56
56
|
"textarea",
|
|
57
57
|
'[tabindex]:not([tabindex="-1"])',
|
|
58
58
|
];
|
|
59
|
-
const elements =
|
|
60
|
-
...ref.querySelectorAll(focusables.join(", ")),
|
|
61
|
-
];
|
|
59
|
+
const elements = Array.from(ref.querySelectorAll(focusables.join(", ")));
|
|
62
60
|
// If the ref is focusable, ensure it's the first element to be focused.
|
|
63
61
|
if (ref.getAttribute("tabindex") === "0") {
|
|
64
62
|
elements.unshift(ref);
|
package/dist/useFocusTrap-es.js
CHANGED
|
@@ -54,9 +54,7 @@ function getElements(ref) {
|
|
|
54
54
|
"textarea",
|
|
55
55
|
'[tabindex]:not([tabindex="-1"])',
|
|
56
56
|
];
|
|
57
|
-
const elements =
|
|
58
|
-
...ref.querySelectorAll(focusables.join(", ")),
|
|
59
|
-
];
|
|
57
|
+
const elements = Array.from(ref.querySelectorAll(focusables.join(", ")));
|
|
60
58
|
// If the ref is focusable, ensure it's the first element to be focused.
|
|
61
59
|
if (ref.getAttribute("tabindex") === "0") {
|
|
62
60
|
elements.unshift(ref);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { XOR } from "ts-xor";
|
|
2
1
|
type SimpleKeyComparator = KeyboardEvent["key"];
|
|
3
2
|
interface VerboseKeyComparator {
|
|
4
3
|
readonly key: SimpleKeyComparator;
|
|
@@ -8,6 +7,6 @@ interface VerboseKeyComparator {
|
|
|
8
7
|
readonly metaKey?: boolean;
|
|
9
8
|
readonly [index: string]: boolean | string | undefined;
|
|
10
9
|
}
|
|
11
|
-
type KeyComparator =
|
|
10
|
+
type KeyComparator = VerboseKeyComparator | SimpleKeyComparator;
|
|
12
11
|
export declare function useOnKeyDown(callback: (event: KeyboardEvent) => void, keys: KeyComparator[] | KeyComparator): void;
|
|
13
12
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import require$$1, { useState, useMemo } from 'react';
|
|
2
|
-
import { g as getAugmentedNamespace, a as getDefaultExportFromCjs, _ as _root,
|
|
2
|
+
import { g as getAugmentedNamespace, a as getDefaultExportFromCjs, _ as _root, i as isObjectLike_1, b as _baseGetTag, c as isObject_1 } from './isObjectLike-es.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A collection of shims that provide minimal functionality of the ES6 collections.
|
|
@@ -935,9 +935,9 @@ var ResizeObserver_es = /*#__PURE__*/Object.freeze({
|
|
|
935
935
|
|
|
936
936
|
var require$$0 = /*@__PURE__*/getAugmentedNamespace(ResizeObserver_es);
|
|
937
937
|
|
|
938
|
-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
938
|
+
function _interopDefault$1 (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
939
939
|
|
|
940
|
-
var ResizeObserver = _interopDefault(require$$0);
|
|
940
|
+
var ResizeObserver = _interopDefault$1(require$$0);
|
|
941
941
|
var react = require$$1;
|
|
942
942
|
|
|
943
943
|
function useResizeObserver$1(opts) {
|
|
@@ -1434,7 +1434,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
|
|
|
1434
1434
|
* // Cancel the trailing throttled invocation.
|
|
1435
1435
|
* jQuery(window).on('popstate', throttled.cancel);
|
|
1436
1436
|
*/
|
|
1437
|
-
function throttle(func, wait, options) {
|
|
1437
|
+
function throttle$1(func, wait, options) {
|
|
1438
1438
|
var leading = true,
|
|
1439
1439
|
trailing = true;
|
|
1440
1440
|
|
|
@@ -1452,9 +1452,9 @@ function throttle(func, wait, options) {
|
|
|
1452
1452
|
});
|
|
1453
1453
|
}
|
|
1454
1454
|
|
|
1455
|
-
var throttle_1 = throttle;
|
|
1455
|
+
var throttle_1 = throttle$1;
|
|
1456
1456
|
|
|
1457
|
-
var throttle
|
|
1457
|
+
var throttle = /*@__PURE__*/getDefaultExportFromCjs(throttle_1);
|
|
1458
1458
|
|
|
1459
1459
|
const Breakpoints = {
|
|
1460
1460
|
base: 640,
|
|
@@ -1470,7 +1470,7 @@ function useResizeObserver({ widths = Breakpoints, heights = Breakpoints, } = {}
|
|
|
1470
1470
|
height: undefined,
|
|
1471
1471
|
});
|
|
1472
1472
|
const onResize = useMemo(() => {
|
|
1473
|
-
return throttle
|
|
1473
|
+
return throttle(({ width, height }) => {
|
|
1474
1474
|
if (!width || width <= 1) {
|
|
1475
1475
|
// Ignore invalid values. ResizeObserver is unexpectedly looping between 1 and the actual
|
|
1476
1476
|
// width of the element. This is only happening in playwright chromium.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/hooks",
|
|
3
|
-
"version": "2.19.4
|
|
3
|
+
"version": "2.19.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -108,12 +108,13 @@
|
|
|
108
108
|
},
|
|
109
109
|
"scripts": {
|
|
110
110
|
"build": "rollup -c rollup.config.mjs",
|
|
111
|
+
"watch": "rollup -c rollup.config.mjs --watch",
|
|
111
112
|
"clean": "rm -rf dist tsconfig.*tsbuildinfo",
|
|
112
|
-
"bootstrap": "
|
|
113
|
+
"bootstrap": "pnpm run clean && pnpm run build",
|
|
113
114
|
"entryPoints:build": "ts-node --project ../../tsconfig.bin.json ../../scripts/entryPoints.ts",
|
|
114
|
-
"entryPoints:clean": "
|
|
115
|
-
"prepack": "
|
|
116
|
-
"postpack": "
|
|
115
|
+
"entryPoints:clean": "pnpm run entryPoints:build clean",
|
|
116
|
+
"prepack": "pnpm run entryPoints:build",
|
|
117
|
+
"postpack": "pnpm run entryPoints:clean"
|
|
117
118
|
},
|
|
118
119
|
"files": [
|
|
119
120
|
"*.js",
|
|
@@ -121,11 +122,18 @@
|
|
|
121
122
|
"dist/*"
|
|
122
123
|
],
|
|
123
124
|
"devDependencies": {
|
|
124
|
-
"@apollo/
|
|
125
|
-
"@
|
|
125
|
+
"@apollo/client": "^3.14.1",
|
|
126
|
+
"@babel/runtime": "^7.29.2",
|
|
127
|
+
"@jobber/formatters": "^0.5.0",
|
|
128
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
129
|
+
"@rollup/plugin-node-resolve": "15.2.3",
|
|
130
|
+
"@rollup/plugin-typescript": "11.1.6",
|
|
126
131
|
"@types/lodash": "4.14.136",
|
|
127
132
|
"@types/uuid": "^8.3.3",
|
|
128
133
|
"jsdom-testing-mocks": "^1.9.0",
|
|
134
|
+
"react": "19.1.1",
|
|
135
|
+
"react-dom": "19.1.1",
|
|
136
|
+
"rollup-plugin-multi-input": "^1.4.1",
|
|
129
137
|
"uuid": "^8.3.2"
|
|
130
138
|
},
|
|
131
139
|
"dependencies": {
|
|
@@ -138,8 +146,7 @@
|
|
|
138
146
|
},
|
|
139
147
|
"peerDependencies": {
|
|
140
148
|
"@apollo/client": "^3.0.0",
|
|
141
|
-
"@jobber/formatters": "^0.5.0",
|
|
142
149
|
"react": "^18 || ^19.1.0"
|
|
143
150
|
},
|
|
144
|
-
"gitHead": "
|
|
151
|
+
"gitHead": "2306bc5ca1ed0a56871602085cc3c4223b9d08d8"
|
|
145
152
|
}
|