@jobber/components 6.103.2-JOB-140609-8386817.45 → 6.103.2-JOB-141426-ee803fd.19

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.
Files changed (87) hide show
  1. package/dist/Autocomplete/Autocomplete.types.d.ts +1 -12
  2. package/dist/Autocomplete/components/MenuList.d.ts +2 -1
  3. package/dist/Autocomplete/components/PersistentRegion.d.ts +2 -1
  4. package/dist/Autocomplete/hooks/useAutocompleteListNav.d.ts +2 -1
  5. package/dist/Autocomplete/index.cjs +85 -35
  6. package/dist/Autocomplete/index.mjs +86 -36
  7. package/dist/Autocomplete/tests/Autocomplete.setup.d.ts +13 -0
  8. package/dist/Autocomplete/useAutocomplete.d.ts +1 -0
  9. package/dist/Checkbox/Checkbox.types.d.ts +9 -2
  10. package/dist/Checkbox/index.cjs +2 -4
  11. package/dist/Checkbox/index.mjs +2 -4
  12. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +2 -2
  13. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +2 -2
  14. package/dist/Chips/InternalChipDismissible/index.cjs +2 -2
  15. package/dist/Chips/InternalChipDismissible/index.mjs +2 -2
  16. package/dist/Chips/index.cjs +2 -2
  17. package/dist/Chips/index.mjs +2 -2
  18. package/dist/DataList/components/DataListSearch/index.cjs +12 -1
  19. package/dist/DataList/components/DataListSearch/index.mjs +12 -1
  20. package/dist/DataList/index.cjs +8 -0
  21. package/dist/DataList/index.mjs +8 -0
  22. package/dist/DataTable/index.cjs +2 -2
  23. package/dist/DataTable/index.mjs +2 -2
  24. package/dist/DatePicker/index.cjs +2 -2
  25. package/dist/DatePicker/index.mjs +2 -2
  26. package/dist/DatePicker-es.js +1 -1
  27. package/dist/FormField/FormFieldTypes.d.ts +2 -0
  28. package/dist/FormField/hooks/useFormFieldWrapperStyles.d.ts +2 -7
  29. package/dist/FormField-cjs.js +6 -1
  30. package/dist/FormField-es.js +6 -2
  31. package/dist/InputDate/index.cjs +9 -5
  32. package/dist/InputDate/index.mjs +9 -5
  33. package/dist/InputDate/useInputDateActivatorActions.d.ts +8 -4
  34. package/dist/InputEmail/InputEmail.types.d.ts +20 -12
  35. package/dist/InputEmail/hooks/useInputEmailActions.d.ts +1 -1
  36. package/dist/InputEmail/hooks/useInputEmailFormField.d.ts +32 -0
  37. package/dist/InputEmail/index.cjs +44 -8
  38. package/dist/InputEmail/index.mjs +44 -8
  39. package/dist/InputNumber/InputNumber.rebuilt.types.d.ts +3 -20
  40. package/dist/InputNumber/index.cjs +3 -3
  41. package/dist/InputNumber/index.mjs +3 -3
  42. package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +27 -13
  43. package/dist/InputPhoneNumber/hooks/useInputPhoneActions.d.ts +1 -1
  44. package/dist/InputPhoneNumber/hooks/useInputPhoneFormField.d.ts +71 -0
  45. package/dist/InputPhoneNumber/index.cjs +34 -17
  46. package/dist/InputPhoneNumber/index.mjs +34 -17
  47. package/dist/InputText/InputText.types.d.ts +24 -24
  48. package/dist/InputText/index.cjs +54 -54
  49. package/dist/InputText/index.mjs +55 -55
  50. package/dist/InputText/useInputTextActions.d.ts +1 -1
  51. package/dist/InputText/useInputTextFormField.d.ts +352 -0
  52. package/dist/InputTime/InputTime.rebuilt.d.ts +1 -1
  53. package/dist/InputTime/InputTime.types.d.ts +1 -21
  54. package/dist/InputTime/index.cjs +33 -63
  55. package/dist/InputTime/index.d.ts +1 -1
  56. package/dist/InputTime/index.mjs +36 -66
  57. package/dist/List/index.cjs +2 -2
  58. package/dist/List/index.mjs +2 -2
  59. package/dist/RecurringSelect/index.cjs +2 -2
  60. package/dist/RecurringSelect/index.mjs +2 -2
  61. package/dist/Select/Select.rebuilt.d.ts +1 -1
  62. package/dist/Select/Select.types.d.ts +1 -14
  63. package/dist/Select/hooks/useSelectActions.d.ts +5 -5
  64. package/dist/Select/hooks/useSelectFormField.d.ts +34 -0
  65. package/dist/Select/index.cjs +41 -28
  66. package/dist/Select/index.d.ts +5 -7
  67. package/dist/Select/index.mjs +43 -30
  68. package/dist/Tabs-es.js +1 -1
  69. package/dist/_baseEach-cjs.js +12 -12
  70. package/dist/_baseEach-es.js +1 -1
  71. package/dist/_baseFlatten-cjs.js +2 -2
  72. package/dist/_baseFlatten-es.js +1 -1
  73. package/dist/{_getAllKeys-cjs.js → _baseGet-cjs.js} +181 -181
  74. package/dist/{_getAllKeys-es.js → _baseGet-es.js} +182 -182
  75. package/dist/debounce-es.js +1 -1
  76. package/dist/floating-ui.react-cjs.js +115 -0
  77. package/dist/floating-ui.react-es.js +115 -1
  78. package/dist/index.cjs +2 -2
  79. package/dist/index.mjs +2 -2
  80. package/dist/omit-cjs.js +14 -14
  81. package/dist/omit-es.js +1 -1
  82. package/dist/sharedHelpers/types.d.ts +0 -235
  83. package/dist/styles.css +3 -0
  84. package/dist/useScrollToActive-cjs.js +3 -3
  85. package/dist/useScrollToActive-es.js +2 -2
  86. package/package.json +2 -2
  87. package/dist/InputTime/hooks/useInputTimeActions.d.ts +0 -16
@@ -1,8 +1,152 @@
1
- import { a as isArray_1, b as isArrayLike_1 } from './isTypedArray-es.js';
1
+ import { b as isArrayLike_1, a as isArray_1 } from './isTypedArray-es.js';
2
+ import { f as _arrayLikeKeys, g as _MapCache } from './identity-es.js';
3
+ import { _ as _baseKeys } from './_getTag-es.js';
2
4
  import { i as isSymbol_1 } from './isSymbol-es.js';
3
- import { g as _MapCache, f as _arrayLikeKeys } from './identity-es.js';
4
5
  import { b as _Symbol } from './isObjectLike-es.js';
5
- import { _ as _baseKeys } from './_getTag-es.js';
6
+
7
+ /**
8
+ * A specialized version of `_.map` for arrays without support for iteratee
9
+ * shorthands.
10
+ *
11
+ * @private
12
+ * @param {Array} [array] The array to iterate over.
13
+ * @param {Function} iteratee The function invoked per iteration.
14
+ * @returns {Array} Returns the new mapped array.
15
+ */
16
+
17
+ function arrayMap$1(array, iteratee) {
18
+ var index = -1,
19
+ length = array == null ? 0 : array.length,
20
+ result = Array(length);
21
+
22
+ while (++index < length) {
23
+ result[index] = iteratee(array[index], index, array);
24
+ }
25
+ return result;
26
+ }
27
+
28
+ var _arrayMap = arrayMap$1;
29
+
30
+ var arrayLikeKeys = _arrayLikeKeys,
31
+ baseKeys = _baseKeys,
32
+ isArrayLike = isArrayLike_1;
33
+
34
+ /**
35
+ * Creates an array of the own enumerable property names of `object`.
36
+ *
37
+ * **Note:** Non-object values are coerced to objects. See the
38
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
39
+ * for more details.
40
+ *
41
+ * @static
42
+ * @since 0.1.0
43
+ * @memberOf _
44
+ * @category Object
45
+ * @param {Object} object The object to query.
46
+ * @returns {Array} Returns the array of property names.
47
+ * @example
48
+ *
49
+ * function Foo() {
50
+ * this.a = 1;
51
+ * this.b = 2;
52
+ * }
53
+ *
54
+ * Foo.prototype.c = 3;
55
+ *
56
+ * _.keys(new Foo);
57
+ * // => ['a', 'b'] (iteration order is not guaranteed)
58
+ *
59
+ * _.keys('hi');
60
+ * // => ['0', '1']
61
+ */
62
+ function keys$1(object) {
63
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
64
+ }
65
+
66
+ var keys_1 = keys$1;
67
+
68
+ /**
69
+ * A specialized version of `_.filter` for arrays without support for
70
+ * iteratee shorthands.
71
+ *
72
+ * @private
73
+ * @param {Array} [array] The array to iterate over.
74
+ * @param {Function} predicate The function invoked per iteration.
75
+ * @returns {Array} Returns the new filtered array.
76
+ */
77
+
78
+ function arrayFilter$1(array, predicate) {
79
+ var index = -1,
80
+ length = array == null ? 0 : array.length,
81
+ resIndex = 0,
82
+ result = [];
83
+
84
+ while (++index < length) {
85
+ var value = array[index];
86
+ if (predicate(value, index, array)) {
87
+ result[resIndex++] = value;
88
+ }
89
+ }
90
+ return result;
91
+ }
92
+
93
+ var _arrayFilter = arrayFilter$1;
94
+
95
+ /**
96
+ * This method returns a new empty array.
97
+ *
98
+ * @static
99
+ * @memberOf _
100
+ * @since 4.13.0
101
+ * @category Util
102
+ * @returns {Array} Returns the new empty array.
103
+ * @example
104
+ *
105
+ * var arrays = _.times(2, _.stubArray);
106
+ *
107
+ * console.log(arrays);
108
+ * // => [[], []]
109
+ *
110
+ * console.log(arrays[0] === arrays[1]);
111
+ * // => false
112
+ */
113
+
114
+ function stubArray$1() {
115
+ return [];
116
+ }
117
+
118
+ var stubArray_1 = stubArray$1;
119
+
120
+ var arrayFilter = _arrayFilter,
121
+ stubArray = stubArray_1;
122
+
123
+ /** Used for built-in method references. */
124
+ var objectProto = Object.prototype;
125
+
126
+ /** Built-in value references. */
127
+ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
128
+
129
+ /* Built-in method references for those with the same name as other `lodash` methods. */
130
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
131
+
132
+ /**
133
+ * Creates an array of the own enumerable symbols of `object`.
134
+ *
135
+ * @private
136
+ * @param {Object} object The object to query.
137
+ * @returns {Array} Returns the array of symbols.
138
+ */
139
+ var getSymbols$1 = !nativeGetSymbols ? stubArray : function(object) {
140
+ if (object == null) {
141
+ return [];
142
+ }
143
+ object = Object(object);
144
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
145
+ return propertyIsEnumerable.call(object, symbol);
146
+ });
147
+ };
148
+
149
+ var _getSymbols = getSymbols$1;
6
150
 
7
151
  /**
8
152
  * Appends the elements of `values` to `array`.
@@ -26,30 +170,45 @@ function arrayPush$1(array, values) {
26
170
 
27
171
  var _arrayPush = arrayPush$1;
28
172
 
173
+ var arrayPush = _arrayPush,
174
+ isArray$3 = isArray_1;
175
+
29
176
  /**
30
- * A specialized version of `_.map` for arrays without support for iteratee
31
- * shorthands.
177
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
178
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
179
+ * symbols of `object`.
32
180
  *
33
181
  * @private
34
- * @param {Array} [array] The array to iterate over.
35
- * @param {Function} iteratee The function invoked per iteration.
36
- * @returns {Array} Returns the new mapped array.
182
+ * @param {Object} object The object to query.
183
+ * @param {Function} keysFunc The function to get the keys of `object`.
184
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
185
+ * @returns {Array} Returns the array of property names and symbols.
37
186
  */
187
+ function baseGetAllKeys$1(object, keysFunc, symbolsFunc) {
188
+ var result = keysFunc(object);
189
+ return isArray$3(object) ? result : arrayPush(result, symbolsFunc(object));
190
+ }
38
191
 
39
- function arrayMap$1(array, iteratee) {
40
- var index = -1,
41
- length = array == null ? 0 : array.length,
42
- result = Array(length);
192
+ var _baseGetAllKeys = baseGetAllKeys$1;
43
193
 
44
- while (++index < length) {
45
- result[index] = iteratee(array[index], index, array);
46
- }
47
- return result;
194
+ var baseGetAllKeys = _baseGetAllKeys,
195
+ getSymbols = _getSymbols,
196
+ keys = keys_1;
197
+
198
+ /**
199
+ * Creates an array of own enumerable property names and symbols of `object`.
200
+ *
201
+ * @private
202
+ * @param {Object} object The object to query.
203
+ * @returns {Array} Returns the array of property names and symbols.
204
+ */
205
+ function getAllKeys(object) {
206
+ return baseGetAllKeys(object, keys, getSymbols);
48
207
  }
49
208
 
50
- var _arrayMap = arrayMap$1;
209
+ var _getAllKeys = getAllKeys;
51
210
 
52
- var isArray$3 = isArray_1,
211
+ var isArray$2 = isArray_1,
53
212
  isSymbol$2 = isSymbol_1;
54
213
 
55
214
  /** Used to match property names within property paths. */
@@ -65,7 +224,7 @@ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
65
224
  * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
66
225
  */
67
226
  function isKey$1(value, object) {
68
- if (isArray$3(value)) {
227
+ if (isArray$2(value)) {
69
228
  return false;
70
229
  }
71
230
  var type = typeof value;
@@ -210,7 +369,7 @@ var _stringToPath = stringToPath$1;
210
369
 
211
370
  var Symbol = _Symbol,
212
371
  arrayMap = _arrayMap,
213
- isArray$2 = isArray_1,
372
+ isArray$1 = isArray_1,
214
373
  isSymbol$1 = isSymbol_1;
215
374
 
216
375
  /** Used as references for various `Number` constants. */
@@ -233,7 +392,7 @@ function baseToString$1(value) {
233
392
  if (typeof value == 'string') {
234
393
  return value;
235
394
  }
236
- if (isArray$2(value)) {
395
+ if (isArray$1(value)) {
237
396
  // Recursively convert values (susceptible to call stack limits).
238
397
  return arrayMap(value, baseToString$1) + '';
239
398
  }
@@ -275,7 +434,7 @@ function toString$1(value) {
275
434
 
276
435
  var toString_1 = toString$1;
277
436
 
278
- var isArray$1 = isArray_1,
437
+ var isArray = isArray_1,
279
438
  isKey = _isKey,
280
439
  stringToPath = _stringToPath,
281
440
  toString = toString_1;
@@ -289,7 +448,7 @@ var isArray$1 = isArray_1,
289
448
  * @returns {Array} Returns the cast property path array.
290
449
  */
291
450
  function castPath$1(value, object) {
292
- if (isArray$1(value)) {
451
+ if (isArray(value)) {
293
452
  return value;
294
453
  }
295
454
  return isKey(value, object) ? [value] : stringToPath(toString(value));
@@ -344,163 +503,4 @@ function baseGet(object, path) {
344
503
 
345
504
  var _baseGet = baseGet;
346
505
 
347
- var arrayPush = _arrayPush,
348
- isArray = isArray_1;
349
-
350
- /**
351
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
352
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
353
- * symbols of `object`.
354
- *
355
- * @private
356
- * @param {Object} object The object to query.
357
- * @param {Function} keysFunc The function to get the keys of `object`.
358
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
359
- * @returns {Array} Returns the array of property names and symbols.
360
- */
361
- function baseGetAllKeys$1(object, keysFunc, symbolsFunc) {
362
- var result = keysFunc(object);
363
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
364
- }
365
-
366
- var _baseGetAllKeys = baseGetAllKeys$1;
367
-
368
- /**
369
- * A specialized version of `_.filter` for arrays without support for
370
- * iteratee shorthands.
371
- *
372
- * @private
373
- * @param {Array} [array] The array to iterate over.
374
- * @param {Function} predicate The function invoked per iteration.
375
- * @returns {Array} Returns the new filtered array.
376
- */
377
-
378
- function arrayFilter$1(array, predicate) {
379
- var index = -1,
380
- length = array == null ? 0 : array.length,
381
- resIndex = 0,
382
- result = [];
383
-
384
- while (++index < length) {
385
- var value = array[index];
386
- if (predicate(value, index, array)) {
387
- result[resIndex++] = value;
388
- }
389
- }
390
- return result;
391
- }
392
-
393
- var _arrayFilter = arrayFilter$1;
394
-
395
- /**
396
- * This method returns a new empty array.
397
- *
398
- * @static
399
- * @memberOf _
400
- * @since 4.13.0
401
- * @category Util
402
- * @returns {Array} Returns the new empty array.
403
- * @example
404
- *
405
- * var arrays = _.times(2, _.stubArray);
406
- *
407
- * console.log(arrays);
408
- * // => [[], []]
409
- *
410
- * console.log(arrays[0] === arrays[1]);
411
- * // => false
412
- */
413
-
414
- function stubArray$1() {
415
- return [];
416
- }
417
-
418
- var stubArray_1 = stubArray$1;
419
-
420
- var arrayFilter = _arrayFilter,
421
- stubArray = stubArray_1;
422
-
423
- /** Used for built-in method references. */
424
- var objectProto = Object.prototype;
425
-
426
- /** Built-in value references. */
427
- var propertyIsEnumerable = objectProto.propertyIsEnumerable;
428
-
429
- /* Built-in method references for those with the same name as other `lodash` methods. */
430
- var nativeGetSymbols = Object.getOwnPropertySymbols;
431
-
432
- /**
433
- * Creates an array of the own enumerable symbols of `object`.
434
- *
435
- * @private
436
- * @param {Object} object The object to query.
437
- * @returns {Array} Returns the array of symbols.
438
- */
439
- var getSymbols$1 = !nativeGetSymbols ? stubArray : function(object) {
440
- if (object == null) {
441
- return [];
442
- }
443
- object = Object(object);
444
- return arrayFilter(nativeGetSymbols(object), function(symbol) {
445
- return propertyIsEnumerable.call(object, symbol);
446
- });
447
- };
448
-
449
- var _getSymbols = getSymbols$1;
450
-
451
- var arrayLikeKeys = _arrayLikeKeys,
452
- baseKeys = _baseKeys,
453
- isArrayLike = isArrayLike_1;
454
-
455
- /**
456
- * Creates an array of the own enumerable property names of `object`.
457
- *
458
- * **Note:** Non-object values are coerced to objects. See the
459
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
460
- * for more details.
461
- *
462
- * @static
463
- * @since 0.1.0
464
- * @memberOf _
465
- * @category Object
466
- * @param {Object} object The object to query.
467
- * @returns {Array} Returns the array of property names.
468
- * @example
469
- *
470
- * function Foo() {
471
- * this.a = 1;
472
- * this.b = 2;
473
- * }
474
- *
475
- * Foo.prototype.c = 3;
476
- *
477
- * _.keys(new Foo);
478
- * // => ['a', 'b'] (iteration order is not guaranteed)
479
- *
480
- * _.keys('hi');
481
- * // => ['0', '1']
482
- */
483
- function keys$1(object) {
484
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
485
- }
486
-
487
- var keys_1 = keys$1;
488
-
489
- var baseGetAllKeys = _baseGetAllKeys,
490
- getSymbols = _getSymbols,
491
- keys = keys_1;
492
-
493
- /**
494
- * Creates an array of own enumerable property names and symbols of `object`.
495
- *
496
- * @private
497
- * @param {Object} object The object to query.
498
- * @returns {Array} Returns the array of property names and symbols.
499
- */
500
- function getAllKeys(object) {
501
- return baseGetAllKeys(object, keys, getSymbols);
502
- }
503
-
504
- var _getAllKeys = getAllKeys;
505
-
506
506
  export { _arrayPush as _, _arrayMap as a, _baseGet as b, _getSymbols as c, _baseGetAllKeys as d, _getAllKeys as e, _castPath as f, _toKey as g, _isKey as h, keys_1 as k, stubArray_1 as s };
@@ -326,4 +326,4 @@ var debounce_1 = debounce;
326
326
 
327
327
  var debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(debounce_1);
328
328
 
329
- export { debounce$1 as a, debounce_1 as d };
329
+ export { debounce_1 as a, debounce$1 as d };
@@ -1065,6 +1065,12 @@ function isVirtualPointerEvent(event) {
1065
1065
  // iOS VoiceOver returns 0.333• for width/height.
1066
1066
  event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'touch';
1067
1067
  }
1068
+ function isMouseLikePointerType(pointerType, strict) {
1069
+ // On some Linux machines with Chromium, mouse inputs return a `pointerType`
1070
+ // of "pen": https://github.com/floating-ui/floating-ui/issues/2015
1071
+ const values = ['mouse', 'pen'];
1072
+ return values.includes(pointerType);
1073
+ }
1068
1074
 
1069
1075
  var isClient$1 = typeof document !== 'undefined';
1070
1076
 
@@ -4562,6 +4568,114 @@ const FloatingOverlay = /*#__PURE__*/React__namespace.forwardRef(function Floati
4562
4568
  });
4563
4569
  });
4564
4570
 
4571
+ function isButtonTarget(event) {
4572
+ return isHTMLElement(event.target) && event.target.tagName === 'BUTTON';
4573
+ }
4574
+ function isAnchorTarget(event) {
4575
+ return isHTMLElement(event.target) && event.target.tagName === 'A';
4576
+ }
4577
+ function isSpaceIgnored(element) {
4578
+ return isTypeableElement(element);
4579
+ }
4580
+ /**
4581
+ * Opens or closes the floating element when clicking the reference element.
4582
+ * @see https://floating-ui.com/docs/useClick
4583
+ */
4584
+ function useClick(context, props) {
4585
+ if (props === void 0) {
4586
+ props = {};
4587
+ }
4588
+ const {
4589
+ open,
4590
+ onOpenChange,
4591
+ dataRef,
4592
+ elements: {
4593
+ domReference
4594
+ }
4595
+ } = context;
4596
+ const {
4597
+ enabled = true,
4598
+ event: eventOption = 'click',
4599
+ toggle = true,
4600
+ ignoreMouse = false,
4601
+ keyboardHandlers = true,
4602
+ stickIfOpen = true
4603
+ } = props;
4604
+ const pointerTypeRef = React__namespace.useRef();
4605
+ const didKeyDownRef = React__namespace.useRef(false);
4606
+ const reference = React__namespace.useMemo(() => ({
4607
+ onPointerDown(event) {
4608
+ pointerTypeRef.current = event.pointerType;
4609
+ },
4610
+ onMouseDown(event) {
4611
+ const pointerType = pointerTypeRef.current;
4612
+
4613
+ // Ignore all buttons except for the "main" button.
4614
+ // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
4615
+ if (event.button !== 0) return;
4616
+ if (eventOption === 'click') return;
4617
+ if (isMouseLikePointerType(pointerType) && ignoreMouse) return;
4618
+ if (open && toggle && (dataRef.current.openEvent && stickIfOpen ? dataRef.current.openEvent.type === 'mousedown' : true)) {
4619
+ onOpenChange(false, event.nativeEvent, 'click');
4620
+ } else {
4621
+ // Prevent stealing focus from the floating element
4622
+ event.preventDefault();
4623
+ onOpenChange(true, event.nativeEvent, 'click');
4624
+ }
4625
+ },
4626
+ onClick(event) {
4627
+ const pointerType = pointerTypeRef.current;
4628
+ if (eventOption === 'mousedown' && pointerTypeRef.current) {
4629
+ pointerTypeRef.current = undefined;
4630
+ return;
4631
+ }
4632
+ if (isMouseLikePointerType(pointerType) && ignoreMouse) return;
4633
+ if (open && toggle && (dataRef.current.openEvent && stickIfOpen ? dataRef.current.openEvent.type === 'click' : true)) {
4634
+ onOpenChange(false, event.nativeEvent, 'click');
4635
+ } else {
4636
+ onOpenChange(true, event.nativeEvent, 'click');
4637
+ }
4638
+ },
4639
+ onKeyDown(event) {
4640
+ pointerTypeRef.current = undefined;
4641
+ if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event)) {
4642
+ return;
4643
+ }
4644
+ if (event.key === ' ' && !isSpaceIgnored(domReference)) {
4645
+ // Prevent scrolling
4646
+ event.preventDefault();
4647
+ didKeyDownRef.current = true;
4648
+ }
4649
+ if (isAnchorTarget(event)) {
4650
+ return;
4651
+ }
4652
+ if (event.key === 'Enter') {
4653
+ if (open && toggle) {
4654
+ onOpenChange(false, event.nativeEvent, 'click');
4655
+ } else {
4656
+ onOpenChange(true, event.nativeEvent, 'click');
4657
+ }
4658
+ }
4659
+ },
4660
+ onKeyUp(event) {
4661
+ if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event) || isSpaceIgnored(domReference)) {
4662
+ return;
4663
+ }
4664
+ if (event.key === ' ' && didKeyDownRef.current) {
4665
+ didKeyDownRef.current = false;
4666
+ if (open && toggle) {
4667
+ onOpenChange(false, event.nativeEvent, 'click');
4668
+ } else {
4669
+ onOpenChange(true, event.nativeEvent, 'click');
4670
+ }
4671
+ }
4672
+ }
4673
+ }), [dataRef, domReference, eventOption, ignoreMouse, keyboardHandlers, onOpenChange, open, stickIfOpen, toggle]);
4674
+ return React__namespace.useMemo(() => enabled ? {
4675
+ reference
4676
+ } : {}, [enabled, reference]);
4677
+ }
4678
+
4565
4679
  const bubbleHandlerKeys = {
4566
4680
  pointerdown: 'onPointerDown',
4567
4681
  mousedown: 'onMouseDown',
@@ -5943,6 +6057,7 @@ exports.limitShift = limitShift;
5943
6057
  exports.offset = offset;
5944
6058
  exports.shift = shift;
5945
6059
  exports.size = size;
6060
+ exports.useClick = useClick;
5946
6061
  exports.useDismiss = useDismiss;
5947
6062
  exports.useFloating = useFloating;
5948
6063
  exports.useFloatingNodeId = useFloatingNodeId;
@@ -1044,6 +1044,12 @@ function isVirtualPointerEvent(event) {
1044
1044
  // iOS VoiceOver returns 0.333• for width/height.
1045
1045
  event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'touch';
1046
1046
  }
1047
+ function isMouseLikePointerType(pointerType, strict) {
1048
+ // On some Linux machines with Chromium, mouse inputs return a `pointerType`
1049
+ // of "pen": https://github.com/floating-ui/floating-ui/issues/2015
1050
+ const values = ['mouse', 'pen'];
1051
+ return values.includes(pointerType);
1052
+ }
1047
1053
 
1048
1054
  var isClient$1 = typeof document !== 'undefined';
1049
1055
 
@@ -4541,6 +4547,114 @@ const FloatingOverlay = /*#__PURE__*/React.forwardRef(function FloatingOverlay(p
4541
4547
  });
4542
4548
  });
4543
4549
 
4550
+ function isButtonTarget(event) {
4551
+ return isHTMLElement(event.target) && event.target.tagName === 'BUTTON';
4552
+ }
4553
+ function isAnchorTarget(event) {
4554
+ return isHTMLElement(event.target) && event.target.tagName === 'A';
4555
+ }
4556
+ function isSpaceIgnored(element) {
4557
+ return isTypeableElement(element);
4558
+ }
4559
+ /**
4560
+ * Opens or closes the floating element when clicking the reference element.
4561
+ * @see https://floating-ui.com/docs/useClick
4562
+ */
4563
+ function useClick(context, props) {
4564
+ if (props === void 0) {
4565
+ props = {};
4566
+ }
4567
+ const {
4568
+ open,
4569
+ onOpenChange,
4570
+ dataRef,
4571
+ elements: {
4572
+ domReference
4573
+ }
4574
+ } = context;
4575
+ const {
4576
+ enabled = true,
4577
+ event: eventOption = 'click',
4578
+ toggle = true,
4579
+ ignoreMouse = false,
4580
+ keyboardHandlers = true,
4581
+ stickIfOpen = true
4582
+ } = props;
4583
+ const pointerTypeRef = React.useRef();
4584
+ const didKeyDownRef = React.useRef(false);
4585
+ const reference = React.useMemo(() => ({
4586
+ onPointerDown(event) {
4587
+ pointerTypeRef.current = event.pointerType;
4588
+ },
4589
+ onMouseDown(event) {
4590
+ const pointerType = pointerTypeRef.current;
4591
+
4592
+ // Ignore all buttons except for the "main" button.
4593
+ // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
4594
+ if (event.button !== 0) return;
4595
+ if (eventOption === 'click') return;
4596
+ if (isMouseLikePointerType(pointerType) && ignoreMouse) return;
4597
+ if (open && toggle && (dataRef.current.openEvent && stickIfOpen ? dataRef.current.openEvent.type === 'mousedown' : true)) {
4598
+ onOpenChange(false, event.nativeEvent, 'click');
4599
+ } else {
4600
+ // Prevent stealing focus from the floating element
4601
+ event.preventDefault();
4602
+ onOpenChange(true, event.nativeEvent, 'click');
4603
+ }
4604
+ },
4605
+ onClick(event) {
4606
+ const pointerType = pointerTypeRef.current;
4607
+ if (eventOption === 'mousedown' && pointerTypeRef.current) {
4608
+ pointerTypeRef.current = undefined;
4609
+ return;
4610
+ }
4611
+ if (isMouseLikePointerType(pointerType) && ignoreMouse) return;
4612
+ if (open && toggle && (dataRef.current.openEvent && stickIfOpen ? dataRef.current.openEvent.type === 'click' : true)) {
4613
+ onOpenChange(false, event.nativeEvent, 'click');
4614
+ } else {
4615
+ onOpenChange(true, event.nativeEvent, 'click');
4616
+ }
4617
+ },
4618
+ onKeyDown(event) {
4619
+ pointerTypeRef.current = undefined;
4620
+ if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event)) {
4621
+ return;
4622
+ }
4623
+ if (event.key === ' ' && !isSpaceIgnored(domReference)) {
4624
+ // Prevent scrolling
4625
+ event.preventDefault();
4626
+ didKeyDownRef.current = true;
4627
+ }
4628
+ if (isAnchorTarget(event)) {
4629
+ return;
4630
+ }
4631
+ if (event.key === 'Enter') {
4632
+ if (open && toggle) {
4633
+ onOpenChange(false, event.nativeEvent, 'click');
4634
+ } else {
4635
+ onOpenChange(true, event.nativeEvent, 'click');
4636
+ }
4637
+ }
4638
+ },
4639
+ onKeyUp(event) {
4640
+ if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event) || isSpaceIgnored(domReference)) {
4641
+ return;
4642
+ }
4643
+ if (event.key === ' ' && didKeyDownRef.current) {
4644
+ didKeyDownRef.current = false;
4645
+ if (open && toggle) {
4646
+ onOpenChange(false, event.nativeEvent, 'click');
4647
+ } else {
4648
+ onOpenChange(true, event.nativeEvent, 'click');
4649
+ }
4650
+ }
4651
+ }
4652
+ }), [dataRef, domReference, eventOption, ignoreMouse, keyboardHandlers, onOpenChange, open, stickIfOpen, toggle]);
4653
+ return React.useMemo(() => enabled ? {
4654
+ reference
4655
+ } : {}, [enabled, reference]);
4656
+ }
4657
+
4544
4658
  const bubbleHandlerKeys = {
4545
4659
  pointerdown: 'onPointerDown',
4546
4660
  mousedown: 'onMouseDown',
@@ -5908,4 +6022,4 @@ function useTransitionStyles(context, props) {
5908
6022
  };
5909
6023
  }
5910
6024
 
5911
- export { FloatingPortal as F, arrow as a, autoUpdate as b, size as c, useDismiss as d, useListNavigation as e, flip as f, useInteractions as g, useFloatingParentNodeId as h, useFloatingNodeId as i, FloatingTree as j, FloatingNode as k, limitShift as l, autoPlacement as m, useRole as n, offset as o, FloatingFocusManager as p, FloatingOverlay as q, useTransitionStyles as r, shift as s, FloatingArrow as t, useFloating as u };
6025
+ export { FloatingPortal as F, arrow as a, autoUpdate as b, size as c, useDismiss as d, useListNavigation as e, flip as f, useInteractions as g, useFloatingParentNodeId as h, useFloatingNodeId as i, FloatingTree as j, FloatingNode as k, limitShift as l, autoPlacement as m, useRole as n, offset as o, FloatingFocusManager as p, FloatingOverlay as q, useClick as r, shift as s, useTransitionStyles as t, useFloating as u, FloatingArrow as v };