@jobber/components 6.104.1 → 6.105.1
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/Autocomplete/Autocomplete.types.d.ts +2 -0
- package/dist/Autocomplete/components/MenuList.d.ts +2 -1
- package/dist/Autocomplete/components/PersistentRegion.d.ts +2 -1
- package/dist/Autocomplete/hooks/useAutocompleteListNav.d.ts +2 -1
- package/dist/Autocomplete/index.cjs +86 -32
- package/dist/Autocomplete/index.mjs +87 -33
- package/dist/Autocomplete/tests/Autocomplete.setup.d.ts +13 -0
- package/dist/Autocomplete/useAutocomplete.d.ts +1 -0
- package/dist/Autocomplete/utils/interactionUtils.d.ts +14 -0
- package/dist/Checkbox/Checkbox.rebuilt.d.ts +2 -1
- package/dist/Checkbox/Checkbox.types.d.ts +40 -3
- package/dist/Checkbox/index.cjs +2 -2
- package/dist/Checkbox/index.mjs +2 -2
- package/dist/DatePicker-es.js +1 -1
- package/dist/InputEmail/InputEmail.types.d.ts +2 -2
- package/dist/InputEmail/hooks/useInputEmailActions.d.ts +8 -3
- package/dist/InputEmail/index.cjs +28 -3
- package/dist/InputEmail/index.mjs +28 -3
- package/dist/InputNumber/InputNumber.rebuilt.types.d.ts +2 -2
- package/dist/InputNumber/index.cjs +1 -1
- package/dist/InputNumber/index.mjs +1 -1
- package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +2 -2
- package/dist/InputPhoneNumber/hooks/useInputPhoneActions.d.ts +8 -3
- package/dist/InputPhoneNumber/index.cjs +29 -3
- package/dist/InputPhoneNumber/index.mjs +29 -3
- package/dist/InputText/InputText.types.d.ts +2 -2
- package/dist/InputText/index.cjs +28 -3
- package/dist/InputText/index.mjs +28 -3
- package/dist/InputText/useInputTextActions.d.ts +8 -3
- package/dist/InputTime/InputTime.types.d.ts +2 -2
- package/dist/InputTime/hooks/useInputTimeActions.d.ts +8 -3
- package/dist/InputTime/index.cjs +28 -3
- package/dist/InputTime/index.mjs +28 -3
- package/dist/floating-ui.react-cjs.js +115 -0
- package/dist/floating-ui.react-es.js +115 -1
- package/dist/sharedHelpers/types.d.ts +26 -0
- package/dist/styles.css +3 -0
- package/package.json +2 -2
package/dist/InputTime/index.cjs
CHANGED
|
@@ -205,7 +205,7 @@ function timeStringToDate(timeString, baseDate) {
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
function useInputTimeActions({ onChange, value, inputRef, onFocus, onBlur, onKeyDown, }) {
|
|
208
|
+
function useInputTimeActions({ onChange, value, inputRef, onFocus, onBlur, onKeyDown, onClick, onMouseDown, onMouseUp, onPointerDown, onPointerUp, }) {
|
|
209
209
|
function handleChangeEvent(event) {
|
|
210
210
|
handleChange(event.target.value);
|
|
211
211
|
}
|
|
@@ -232,6 +232,21 @@ function useInputTimeActions({ onChange, value, inputRef, onFocus, onBlur, onKey
|
|
|
232
232
|
function handleKeyDown(event) {
|
|
233
233
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
234
234
|
}
|
|
235
|
+
function handleClick(event) {
|
|
236
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
237
|
+
}
|
|
238
|
+
function handleMouseDown(event) {
|
|
239
|
+
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);
|
|
240
|
+
}
|
|
241
|
+
function handleMouseUp(event) {
|
|
242
|
+
onMouseUp === null || onMouseUp === void 0 ? void 0 : onMouseUp(event);
|
|
243
|
+
}
|
|
244
|
+
function handlePointerDown(event) {
|
|
245
|
+
onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown(event);
|
|
246
|
+
}
|
|
247
|
+
function handlePointerUp(event) {
|
|
248
|
+
onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp(event);
|
|
249
|
+
}
|
|
235
250
|
return {
|
|
236
251
|
handleChangeEvent,
|
|
237
252
|
handleChange,
|
|
@@ -239,6 +254,11 @@ function useInputTimeActions({ onChange, value, inputRef, onFocus, onBlur, onKey
|
|
|
239
254
|
handleClear,
|
|
240
255
|
handleFocus,
|
|
241
256
|
handleKeyDown,
|
|
257
|
+
handleClick,
|
|
258
|
+
handleMouseDown,
|
|
259
|
+
handleMouseUp,
|
|
260
|
+
handlePointerDown,
|
|
261
|
+
handlePointerUp,
|
|
242
262
|
};
|
|
243
263
|
}
|
|
244
264
|
|
|
@@ -249,7 +269,7 @@ function InputTimeRebuilt(_a) {
|
|
|
249
269
|
const generatedId = React.useId();
|
|
250
270
|
const id = props.id || generatedId;
|
|
251
271
|
const { inputStyle } = FormField.useFormFieldWrapperStyles(props);
|
|
252
|
-
const { handleChangeEvent, handleChange, handleBlur, handleClear, handleFocus, handleKeyDown, } = useInputTimeActions({
|
|
272
|
+
const { handleChangeEvent, handleChange, handleBlur, handleClear, handleFocus, handleKeyDown, handleClick, handleMouseDown, handleMouseUp, handlePointerDown, handlePointerUp, } = useInputTimeActions({
|
|
253
273
|
onChange,
|
|
254
274
|
value,
|
|
255
275
|
readOnly,
|
|
@@ -258,6 +278,11 @@ function InputTimeRebuilt(_a) {
|
|
|
258
278
|
onFocus: props.onFocus,
|
|
259
279
|
onBlur: props.onBlur,
|
|
260
280
|
onKeyDown: props.onKeyDown,
|
|
281
|
+
onClick: props.onClick,
|
|
282
|
+
onMouseDown: props.onMouseDown,
|
|
283
|
+
onMouseUp: props.onMouseUp,
|
|
284
|
+
onPointerDown: props.onPointerDown,
|
|
285
|
+
onPointerUp: props.onPointerUp,
|
|
261
286
|
});
|
|
262
287
|
const { setTypedTime } = useTimePredict({
|
|
263
288
|
value,
|
|
@@ -276,7 +301,7 @@ function InputTimeRebuilt(_a) {
|
|
|
276
301
|
const descriptionVisible = props.description && !props.inline;
|
|
277
302
|
const isInvalid = Boolean(props.error || props.invalid);
|
|
278
303
|
return (React.createElement(FormField.FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, name: props.name, error: props.error || "", identifier: id, descriptionIdentifier: descriptionIdentifier, invalid: props.invalid, description: props.description, clearable: (_b = props.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, type: "time", readonly: readOnly, placeholder: props.placeholder, value: dateToTimeString(value), wrapperRef: wrapperRef },
|
|
279
|
-
React.createElement("input", Object.assign({ ref: mergedRef, type: "time", name: props.name, className: inputStyle, id: id, disabled: props.disabled, readOnly: readOnly, autoComplete: autoComplete, autoFocus: props.autoFocus, max: props.max, min: props.min, value: dateToTimeString(value), onChange: handleChangeEvent, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, "data-testid": "ATL-InputTime-input", "aria-label": props["aria-label"], "aria-describedby": descriptionVisible ? descriptionIdentifier : props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"] }, dataAttrs))));
|
|
304
|
+
React.createElement("input", Object.assign({ ref: mergedRef, type: "time", name: props.name, className: inputStyle, id: id, disabled: props.disabled, readOnly: readOnly, autoComplete: autoComplete, autoFocus: props.autoFocus, max: props.max, min: props.min, value: dateToTimeString(value), onChange: handleChangeEvent, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onClick: handleClick, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, "data-testid": "ATL-InputTime-input", "aria-label": props["aria-label"], "aria-describedby": descriptionVisible ? descriptionIdentifier : props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"] }, dataAttrs))));
|
|
280
305
|
}
|
|
281
306
|
function useInputTimeRefs(inputRef) {
|
|
282
307
|
const internalRef = React.useRef(null);
|
package/dist/InputTime/index.mjs
CHANGED
|
@@ -203,7 +203,7 @@ function timeStringToDate(timeString, baseDate) {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
function useInputTimeActions({ onChange, value, inputRef, onFocus, onBlur, onKeyDown, }) {
|
|
206
|
+
function useInputTimeActions({ onChange, value, inputRef, onFocus, onBlur, onKeyDown, onClick, onMouseDown, onMouseUp, onPointerDown, onPointerUp, }) {
|
|
207
207
|
function handleChangeEvent(event) {
|
|
208
208
|
handleChange(event.target.value);
|
|
209
209
|
}
|
|
@@ -230,6 +230,21 @@ function useInputTimeActions({ onChange, value, inputRef, onFocus, onBlur, onKey
|
|
|
230
230
|
function handleKeyDown(event) {
|
|
231
231
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
232
232
|
}
|
|
233
|
+
function handleClick(event) {
|
|
234
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
235
|
+
}
|
|
236
|
+
function handleMouseDown(event) {
|
|
237
|
+
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);
|
|
238
|
+
}
|
|
239
|
+
function handleMouseUp(event) {
|
|
240
|
+
onMouseUp === null || onMouseUp === void 0 ? void 0 : onMouseUp(event);
|
|
241
|
+
}
|
|
242
|
+
function handlePointerDown(event) {
|
|
243
|
+
onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown(event);
|
|
244
|
+
}
|
|
245
|
+
function handlePointerUp(event) {
|
|
246
|
+
onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp(event);
|
|
247
|
+
}
|
|
233
248
|
return {
|
|
234
249
|
handleChangeEvent,
|
|
235
250
|
handleChange,
|
|
@@ -237,6 +252,11 @@ function useInputTimeActions({ onChange, value, inputRef, onFocus, onBlur, onKey
|
|
|
237
252
|
handleClear,
|
|
238
253
|
handleFocus,
|
|
239
254
|
handleKeyDown,
|
|
255
|
+
handleClick,
|
|
256
|
+
handleMouseDown,
|
|
257
|
+
handleMouseUp,
|
|
258
|
+
handlePointerDown,
|
|
259
|
+
handlePointerUp,
|
|
240
260
|
};
|
|
241
261
|
}
|
|
242
262
|
|
|
@@ -247,7 +267,7 @@ function InputTimeRebuilt(_a) {
|
|
|
247
267
|
const generatedId = useId();
|
|
248
268
|
const id = props.id || generatedId;
|
|
249
269
|
const { inputStyle } = useFormFieldWrapperStyles(props);
|
|
250
|
-
const { handleChangeEvent, handleChange, handleBlur, handleClear, handleFocus, handleKeyDown, } = useInputTimeActions({
|
|
270
|
+
const { handleChangeEvent, handleChange, handleBlur, handleClear, handleFocus, handleKeyDown, handleClick, handleMouseDown, handleMouseUp, handlePointerDown, handlePointerUp, } = useInputTimeActions({
|
|
251
271
|
onChange,
|
|
252
272
|
value,
|
|
253
273
|
readOnly,
|
|
@@ -256,6 +276,11 @@ function InputTimeRebuilt(_a) {
|
|
|
256
276
|
onFocus: props.onFocus,
|
|
257
277
|
onBlur: props.onBlur,
|
|
258
278
|
onKeyDown: props.onKeyDown,
|
|
279
|
+
onClick: props.onClick,
|
|
280
|
+
onMouseDown: props.onMouseDown,
|
|
281
|
+
onMouseUp: props.onMouseUp,
|
|
282
|
+
onPointerDown: props.onPointerDown,
|
|
283
|
+
onPointerUp: props.onPointerUp,
|
|
259
284
|
});
|
|
260
285
|
const { setTypedTime } = useTimePredict({
|
|
261
286
|
value,
|
|
@@ -274,7 +299,7 @@ function InputTimeRebuilt(_a) {
|
|
|
274
299
|
const descriptionVisible = props.description && !props.inline;
|
|
275
300
|
const isInvalid = Boolean(props.error || props.invalid);
|
|
276
301
|
return (React__default.createElement(FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, name: props.name, error: props.error || "", identifier: id, descriptionIdentifier: descriptionIdentifier, invalid: props.invalid, description: props.description, clearable: (_b = props.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, type: "time", readonly: readOnly, placeholder: props.placeholder, value: dateToTimeString(value), wrapperRef: wrapperRef },
|
|
277
|
-
React__default.createElement("input", Object.assign({ ref: mergedRef, type: "time", name: props.name, className: inputStyle, id: id, disabled: props.disabled, readOnly: readOnly, autoComplete: autoComplete, autoFocus: props.autoFocus, max: props.max, min: props.min, value: dateToTimeString(value), onChange: handleChangeEvent, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, "data-testid": "ATL-InputTime-input", "aria-label": props["aria-label"], "aria-describedby": descriptionVisible ? descriptionIdentifier : props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"] }, dataAttrs))));
|
|
302
|
+
React__default.createElement("input", Object.assign({ ref: mergedRef, type: "time", name: props.name, className: inputStyle, id: id, disabled: props.disabled, readOnly: readOnly, autoComplete: autoComplete, autoFocus: props.autoFocus, max: props.max, min: props.min, value: dateToTimeString(value), onChange: handleChangeEvent, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onClick: handleClick, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, "data-testid": "ATL-InputTime-input", "aria-label": props["aria-label"], "aria-describedby": descriptionVisible ? descriptionIdentifier : props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"] }, dataAttrs))));
|
|
278
303
|
}
|
|
279
304
|
function useInputTimeRefs(inputRef) {
|
|
280
305
|
const internalRef = useRef(null);
|
|
@@ -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,
|
|
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 };
|
|
@@ -82,6 +82,32 @@ export interface FocusEvents<Target = HTMLElement> {
|
|
|
82
82
|
*/
|
|
83
83
|
readonly onBlur?: (event: React.FocusEvent<Target>) => void;
|
|
84
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Mouse event handlers for input elements.
|
|
87
|
+
* Generic interface that can be specialized for different element types.
|
|
88
|
+
*/
|
|
89
|
+
export interface MouseEvents<Target = HTMLElement> {
|
|
90
|
+
/**
|
|
91
|
+
* Mouse down event handler.
|
|
92
|
+
*/
|
|
93
|
+
readonly onMouseDown?: (event: React.MouseEvent<Target>) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Mouse up event handler.
|
|
96
|
+
*/
|
|
97
|
+
readonly onMouseUp?: (event: React.MouseEvent<Target>) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Pointer down event handler.
|
|
100
|
+
*/
|
|
101
|
+
readonly onPointerDown?: (event: React.PointerEvent<Target>) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Pointer up event handler.
|
|
104
|
+
*/
|
|
105
|
+
readonly onPointerUp?: (event: React.PointerEvent<Target>) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Click event handler.
|
|
108
|
+
*/
|
|
109
|
+
readonly onClick?: (event: React.MouseEvent<Target>) => void;
|
|
110
|
+
}
|
|
85
111
|
/**
|
|
86
112
|
* Keyboard event handlers for input elements.
|
|
87
113
|
* Generic interface that can be specialized for different element types.
|
package/dist/styles.css
CHANGED
|
@@ -99,11 +99,13 @@
|
|
|
99
99
|
padding: var(--space-small) 0 var(--space-smaller) var(--space-small);
|
|
100
100
|
border-bottom: 1px solid hsl(200, 13%, 87%);
|
|
101
101
|
border-bottom: var(--border-base) solid var(--color-border);
|
|
102
|
+
cursor: default;
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
.Twgjn26oldE- {
|
|
105
106
|
padding: 8px 16px;
|
|
106
107
|
padding: var(--space-small) var(--space-base);
|
|
108
|
+
cursor: default;
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
.mc1-CEwZtHE- {
|
|
@@ -132,6 +134,7 @@
|
|
|
132
134
|
.vxk57ZhP8GU- {
|
|
133
135
|
padding: 8px 0 4px 8px;
|
|
134
136
|
padding: var(--space-small) 0 var(--space-smaller) var(--space-small);
|
|
137
|
+
cursor: default;
|
|
135
138
|
}
|
|
136
139
|
|
|
137
140
|
.j4h-0Mxa5gk- {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.105.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -538,5 +538,5 @@
|
|
|
538
538
|
"> 1%",
|
|
539
539
|
"IE 10"
|
|
540
540
|
],
|
|
541
|
-
"gitHead": "
|
|
541
|
+
"gitHead": "2e40c551d4af9f4de5d134287b55928b73a518b9"
|
|
542
542
|
}
|