@jobber/components 8.14.1 → 8.16.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/Autocomplete-es.js +1 -1
- package/dist/BottomSheet-cjs.js +109 -77
- package/dist/BottomSheet-es.js +103 -75
- package/dist/Card/index.cjs +2 -3
- package/dist/Card/index.mjs +2 -3
- package/dist/DataDump/index.cjs +2 -3
- package/dist/DataDump/index.mjs +2 -3
- package/dist/InputNumberExperimental-cjs.js +16 -17
- package/dist/InputNumberExperimental-es.js +2 -3
- package/dist/Menu/index.cjs +2 -3
- package/dist/Menu/index.mjs +2 -3
- package/dist/Menu-cjs.js +11 -56
- package/dist/Menu-es.js +4 -49
- package/dist/MenuSubmenuTrigger-cjs.js +1608 -1793
- package/dist/MenuSubmenuTrigger-es.js +1340 -1522
- package/dist/Modal/index.mjs +1 -1
- package/dist/NumberFieldInput-cjs.js +53 -54
- package/dist/NumberFieldInput-es.js +2 -3
- package/dist/Page/index.cjs +2 -3
- package/dist/Page/index.mjs +2 -3
- package/dist/{DrawerRoot-cjs.js → ScrollAreaViewport-cjs.js} +5488 -4449
- package/dist/{DrawerRoot-es.js → ScrollAreaViewport-es.js} +5423 -4393
- package/dist/{useValueChanged-cjs.js → clamp-cjs.js} +573 -321
- package/dist/{useValueChanged-es.js → clamp-es.js} +569 -322
- package/dist/floating-ui.react-es.js +1 -1
- package/dist/index.cjs +2 -3
- package/dist/index.mjs +2 -3
- package/dist/primitives/BottomSheet/BottomSheet.d.ts +15 -16
- package/dist/primitives/BottomSheet/BottomSheet.types.d.ts +27 -0
- package/dist/primitives/BottomSheet/BottomSheet.utils.d.ts +6 -0
- package/dist/primitives/BottomSheet/index.cjs +8 -3
- package/dist/primitives/BottomSheet/index.d.ts +1 -0
- package/dist/primitives/BottomSheet/index.mjs +8 -3
- package/dist/primitives/InputNumberExperimental/index.cjs +2 -3
- package/dist/primitives/InputNumberExperimental/index.mjs +2 -3
- package/dist/primitives/index.cjs +8 -9
- package/dist/primitives/index.mjs +8 -9
- package/dist/styles.css +62 -1
- package/dist/unstyledPrimitives/index.cjs +6373 -5868
- package/dist/unstyledPrimitives/index.d.ts +2 -0
- package/dist/unstyledPrimitives/index.mjs +6325 -5822
- package/dist/useRenderElement-cjs.js +30 -30
- package/dist/useRenderElement-es.js +31 -31
- package/package.json +2 -2
- package/dist/useBaseUiId-cjs.js +0 -275
- package/dist/useBaseUiId-es.js +0 -251
package/dist/Modal/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { H as Heading } from '../Heading-es.js';
|
|
|
7
7
|
import { B as Button } from '../Button-es.js';
|
|
8
8
|
import { B as ButtonDismiss } from '../ButtonDismiss-es.js';
|
|
9
9
|
import { n as noop } from '../noop-es.js';
|
|
10
|
-
import { b as useFloatingNodeId, u as useFloating, c as useDismiss,
|
|
10
|
+
import { b as useFloatingNodeId, u as useFloating, c as useDismiss, h as useRole, d as useInteractions, a as useFloatingParentNodeId, e as FloatingTree, f as FloatingNode, F as FloatingPortal, i as FloatingFocusManager, j as FloatingOverlay } from '../floating-ui.react-es.js';
|
|
11
11
|
import { b as identity } from '../identity-es.js';
|
|
12
12
|
import { A as AtlantisPortalContent } from '../AtlantisPortalContent-es.js';
|
|
13
13
|
import '../Typography-es.js';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var
|
|
4
|
+
var clamp = require('./clamp-cjs.js');
|
|
5
5
|
var useRenderElement = require('./useRenderElement-cjs.js');
|
|
6
6
|
var floatingUi_utils_dom = require('./floating-ui.utils.dom-cjs.js');
|
|
7
|
-
var useBaseUiId = require('./useBaseUiId-cjs.js');
|
|
8
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
8
|
var ReactDOM = require('react-dom');
|
|
10
9
|
|
|
@@ -206,8 +205,8 @@ function useField(params) {
|
|
|
206
205
|
validityData,
|
|
207
206
|
setValidityData
|
|
208
207
|
} = useFieldRootContext();
|
|
209
|
-
const getValue =
|
|
210
|
-
|
|
208
|
+
const getValue = clamp.useStableCallback(params.getValue);
|
|
209
|
+
clamp.useIsoLayoutEffect(() => {
|
|
211
210
|
if (!enabled) {
|
|
212
211
|
return;
|
|
213
212
|
}
|
|
@@ -222,7 +221,7 @@ function useField(params) {
|
|
|
222
221
|
}));
|
|
223
222
|
}
|
|
224
223
|
}, [enabled, setValidityData, value, validityData.initialValue, getValue]);
|
|
225
|
-
|
|
224
|
+
clamp.useIsoLayoutEffect(() => {
|
|
226
225
|
if (!enabled || !id) {
|
|
227
226
|
return;
|
|
228
227
|
}
|
|
@@ -246,7 +245,7 @@ function useField(params) {
|
|
|
246
245
|
}
|
|
247
246
|
});
|
|
248
247
|
}, [commit, controlRef, enabled, formRef, getValue, id, invalid, markedDirtyRef, name, validityData, value]);
|
|
249
|
-
|
|
248
|
+
clamp.useIsoLayoutEffect(() => {
|
|
250
249
|
const fields = formRef.current.fields;
|
|
251
250
|
return () => {
|
|
252
251
|
if (id) {
|
|
@@ -284,19 +283,19 @@ function useLabelableId(params = {}) {
|
|
|
284
283
|
controlId,
|
|
285
284
|
registerControlId
|
|
286
285
|
} = useLabelableContext();
|
|
287
|
-
const defaultId =
|
|
286
|
+
const defaultId = clamp.useBaseUiId(id);
|
|
288
287
|
const controlIdForEffect = implicit ? controlId : undefined;
|
|
289
288
|
const controlSourceRef = useRenderElement.useRefWithInit(() => Symbol('labelable-control'));
|
|
290
289
|
const hasRegisteredRef = React__namespace.useRef(false);
|
|
291
290
|
const hadExplicitIdRef = React__namespace.useRef(id != null);
|
|
292
|
-
const unregisterControlId =
|
|
291
|
+
const unregisterControlId = clamp.useStableCallback(() => {
|
|
293
292
|
if (!hasRegisteredRef.current || registerControlId === useRenderElement.NOOP) {
|
|
294
293
|
return;
|
|
295
294
|
}
|
|
296
295
|
hasRegisteredRef.current = false;
|
|
297
296
|
registerControlId(controlSourceRef.current, undefined);
|
|
298
297
|
});
|
|
299
|
-
|
|
298
|
+
clamp.useIsoLayoutEffect(() => {
|
|
300
299
|
if (registerControlId === useRenderElement.NOOP) {
|
|
301
300
|
return undefined;
|
|
302
301
|
}
|
|
@@ -359,7 +358,7 @@ function formatNumberMaxPrecision(value, locale, options) {
|
|
|
359
358
|
}
|
|
360
359
|
|
|
361
360
|
const EMPTY = 0;
|
|
362
|
-
class Interval extends
|
|
361
|
+
class Interval extends clamp.Timeout {
|
|
363
362
|
static create() {
|
|
364
363
|
return new Interval();
|
|
365
364
|
}
|
|
@@ -386,7 +385,7 @@ class Interval extends useValueChanged.Timeout {
|
|
|
386
385
|
*/
|
|
387
386
|
function useInterval() {
|
|
388
387
|
const timeout = useRenderElement.useRefWithInit(Interval.create).current;
|
|
389
|
-
|
|
388
|
+
clamp.useOnMount(timeout.disposeEffect);
|
|
390
389
|
return timeout;
|
|
391
390
|
}
|
|
392
391
|
|
|
@@ -685,7 +684,7 @@ function toValidatedNumber(value, {
|
|
|
685
684
|
if (value === null) {
|
|
686
685
|
return value;
|
|
687
686
|
}
|
|
688
|
-
const clampedValue = shouldClamp ?
|
|
687
|
+
const clampedValue = shouldClamp ? clamp.clamp(value, minWithDefault, maxWithDefault) : value;
|
|
689
688
|
if (step != null && snapOnStep) {
|
|
690
689
|
if (step === 0) {
|
|
691
690
|
return removeFloatingPointErrors(clampedValue, format);
|
|
@@ -752,27 +751,27 @@ const NumberFieldRoot = /*#__PURE__*/React__namespace.forwardRef(function Number
|
|
|
752
751
|
const id = useLabelableId({
|
|
753
752
|
id: idProp
|
|
754
753
|
});
|
|
755
|
-
const [valueUnwrapped, setValueUnwrapped] =
|
|
754
|
+
const [valueUnwrapped, setValueUnwrapped] = clamp.useControlled({
|
|
756
755
|
controlled: valueProp,
|
|
757
756
|
default: defaultValue,
|
|
758
757
|
name: 'NumberField',
|
|
759
758
|
state: 'value'
|
|
760
759
|
});
|
|
761
760
|
const value = valueUnwrapped ?? null;
|
|
762
|
-
const valueRef =
|
|
763
|
-
|
|
761
|
+
const valueRef = clamp.useValueAsRef(value);
|
|
762
|
+
clamp.useIsoLayoutEffect(() => {
|
|
764
763
|
setFilled(value !== null);
|
|
765
764
|
}, [setFilled, value]);
|
|
766
765
|
const forceRender = useForcedRerendering();
|
|
767
|
-
const formatOptionsRef =
|
|
766
|
+
const formatOptionsRef = clamp.useValueAsRef(format);
|
|
768
767
|
const hasPendingCommitRef = React__namespace.useRef(false);
|
|
769
|
-
const onValueCommitted =
|
|
768
|
+
const onValueCommitted = clamp.useStableCallback((nextValue, eventDetails) => {
|
|
770
769
|
hasPendingCommitRef.current = false;
|
|
771
770
|
onValueCommittedProp?.(nextValue, eventDetails);
|
|
772
771
|
});
|
|
773
|
-
const startTickTimeout =
|
|
772
|
+
const startTickTimeout = clamp.useTimeout();
|
|
774
773
|
const tickInterval = useInterval();
|
|
775
|
-
const intentionalTouchCheckTimeout =
|
|
774
|
+
const intentionalTouchCheckTimeout = clamp.useTimeout();
|
|
776
775
|
const isPressedRef = React__namespace.useRef(false);
|
|
777
776
|
const movesAfterTouchRef = React__namespace.useRef(0);
|
|
778
777
|
const allowInputSyncRef = React__namespace.useRef(true);
|
|
@@ -790,7 +789,7 @@ const NumberFieldRoot = /*#__PURE__*/React__namespace.forwardRef(function Number
|
|
|
790
789
|
return formatNumber(value, locale, format);
|
|
791
790
|
});
|
|
792
791
|
const [inputMode, setInputMode] = React__namespace.useState('numeric');
|
|
793
|
-
const getAllowedNonNumericKeys =
|
|
792
|
+
const getAllowedNonNumericKeys = clamp.useStableCallback(() => {
|
|
794
793
|
const {
|
|
795
794
|
decimal,
|
|
796
795
|
group,
|
|
@@ -835,7 +834,7 @@ const NumberFieldRoot = /*#__PURE__*/React__namespace.forwardRef(function Number
|
|
|
835
834
|
}
|
|
836
835
|
return keys;
|
|
837
836
|
});
|
|
838
|
-
const getStepAmount =
|
|
837
|
+
const getStepAmount = clamp.useStableCallback(event => {
|
|
839
838
|
if (event?.altKey) {
|
|
840
839
|
return smallStep;
|
|
841
840
|
}
|
|
@@ -844,13 +843,13 @@ const NumberFieldRoot = /*#__PURE__*/React__namespace.forwardRef(function Number
|
|
|
844
843
|
}
|
|
845
844
|
return step;
|
|
846
845
|
});
|
|
847
|
-
const setValue =
|
|
846
|
+
const setValue = clamp.useStableCallback((unvalidatedValue, details) => {
|
|
848
847
|
const eventWithOptionalKeyState = details.event;
|
|
849
848
|
const dir = details.direction;
|
|
850
849
|
const reason = details.reason;
|
|
851
850
|
// Only allow out-of-range values for direct text entry (native-like behavior).
|
|
852
851
|
// Step-based interactions (keyboard arrows, buttons, wheel, scrub) still clamp to min/max.
|
|
853
|
-
const shouldClampValue = !allowOutOfRange || !(reason ===
|
|
852
|
+
const shouldClampValue = !allowOutOfRange || !(reason === clamp.inputChange || reason === clamp.inputBlur || reason === clamp.inputPaste || reason === clamp.inputClear || reason === clamp.none);
|
|
854
853
|
const validatedValue = toValidatedNumber(unvalidatedValue, {
|
|
855
854
|
step: dir ? getStepAmount(eventWithOptionalKeyState) * dir : undefined,
|
|
856
855
|
format: formatOptionsRef.current,
|
|
@@ -865,7 +864,7 @@ const NumberFieldRoot = /*#__PURE__*/React__namespace.forwardRef(function Number
|
|
|
865
864
|
// Determine whether we should notify about a change even if the numeric value is unchanged.
|
|
866
865
|
// This is needed when the user input is clamped/snapped to the same current value, or when
|
|
867
866
|
// the source value differs but validation normalizes to the existing value.
|
|
868
|
-
const isInputReason = details.reason ===
|
|
867
|
+
const isInputReason = details.reason === clamp.inputChange || details.reason === clamp.inputClear || details.reason === clamp.inputBlur || details.reason === clamp.inputPaste || details.reason === clamp.none;
|
|
869
868
|
const shouldFireChange = validatedValue !== value || isInputReason && (unvalidatedValue !== value || allowInputSyncRef.current === false);
|
|
870
869
|
if (shouldFireChange) {
|
|
871
870
|
lastChangedValueRef.current = validatedValue;
|
|
@@ -890,7 +889,7 @@ const NumberFieldRoot = /*#__PURE__*/React__namespace.forwardRef(function Number
|
|
|
890
889
|
forceRender();
|
|
891
890
|
return shouldFireChange;
|
|
892
891
|
});
|
|
893
|
-
const incrementValue =
|
|
892
|
+
const incrementValue = clamp.useStableCallback((amount, {
|
|
894
893
|
direction,
|
|
895
894
|
currentValue,
|
|
896
895
|
event,
|
|
@@ -899,18 +898,18 @@ const NumberFieldRoot = /*#__PURE__*/React__namespace.forwardRef(function Number
|
|
|
899
898
|
const prevValue = currentValue == null ? valueRef.current : currentValue;
|
|
900
899
|
const nextValue = typeof prevValue === 'number' ? prevValue + amount * direction : Math.max(0, min ?? 0);
|
|
901
900
|
const nativeEvent = event;
|
|
902
|
-
return setValue(nextValue,
|
|
901
|
+
return setValue(nextValue, clamp.createChangeEventDetails(reason, nativeEvent, undefined, {
|
|
903
902
|
direction
|
|
904
903
|
}));
|
|
905
904
|
});
|
|
906
|
-
const stopAutoChange =
|
|
905
|
+
const stopAutoChange = clamp.useStableCallback(() => {
|
|
907
906
|
intentionalTouchCheckTimeout.clear();
|
|
908
907
|
startTickTimeout.clear();
|
|
909
908
|
tickInterval.clear();
|
|
910
909
|
unsubscribeFromGlobalContextMenuRef.current();
|
|
911
910
|
movesAfterTouchRef.current = 0;
|
|
912
911
|
});
|
|
913
|
-
const startAutoChange =
|
|
912
|
+
const startAutoChange = clamp.useStableCallback((isIncrement, triggerEvent) => {
|
|
914
913
|
stopAutoChange();
|
|
915
914
|
if (!inputRef.current) {
|
|
916
915
|
return;
|
|
@@ -930,8 +929,8 @@ const NumberFieldRoot = /*#__PURE__*/React__namespace.forwardRef(function Number
|
|
|
930
929
|
isPressedRef.current = false;
|
|
931
930
|
stopAutoChange();
|
|
932
931
|
const committed = lastChangedValueRef.current ?? valueRef.current;
|
|
933
|
-
const commitReason = isIncrement ?
|
|
934
|
-
onValueCommitted(committed,
|
|
932
|
+
const commitReason = isIncrement ? clamp.incrementPress : clamp.decrementPress;
|
|
933
|
+
onValueCommitted(committed, clamp.createGenericEventDetails(commitReason, event));
|
|
935
934
|
}, {
|
|
936
935
|
once: true
|
|
937
936
|
});
|
|
@@ -966,7 +965,7 @@ const NumberFieldRoot = /*#__PURE__*/React__namespace.forwardRef(function Number
|
|
|
966
965
|
// ESLint is disabled because it needs to run even if the parsed value hasn't changed, since the
|
|
967
966
|
// value still can be formatted differently.
|
|
968
967
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
969
|
-
|
|
968
|
+
clamp.useIsoLayoutEffect(function syncFormattedInputValueOnValueChange() {
|
|
970
969
|
// This ensures the value is only updated on blur rather than every keystroke, but still
|
|
971
970
|
// allows the input value to be updated when the value is changed externally.
|
|
972
971
|
if (!allowInputSyncRef.current) {
|
|
@@ -977,8 +976,8 @@ const NumberFieldRoot = /*#__PURE__*/React__namespace.forwardRef(function Number
|
|
|
977
976
|
setInputValue(nextInputValue);
|
|
978
977
|
}
|
|
979
978
|
});
|
|
980
|
-
|
|
981
|
-
if (!
|
|
979
|
+
clamp.useIsoLayoutEffect(function setDynamicInputModeForIOS() {
|
|
980
|
+
if (!clamp.isIOS) {
|
|
982
981
|
return;
|
|
983
982
|
}
|
|
984
983
|
|
|
@@ -1005,7 +1004,7 @@ const NumberFieldRoot = /*#__PURE__*/React__namespace.forwardRef(function Number
|
|
|
1005
1004
|
function handleWheel(event) {
|
|
1006
1005
|
if (
|
|
1007
1006
|
// Allow pinch-zooming.
|
|
1008
|
-
event.ctrlKey ||
|
|
1007
|
+
event.ctrlKey || clamp.ownerDocument(inputRef.current).activeElement !== inputRef.current) {
|
|
1009
1008
|
return;
|
|
1010
1009
|
}
|
|
1011
1010
|
|
|
@@ -1090,7 +1089,7 @@ const NumberFieldRoot = /*#__PURE__*/React__namespace.forwardRef(function Number
|
|
|
1090
1089
|
// Handle browser autofill.
|
|
1091
1090
|
const nextValue = event.currentTarget.valueAsNumber;
|
|
1092
1091
|
const parsedValue = Number.isNaN(nextValue) ? null : nextValue;
|
|
1093
|
-
const details =
|
|
1092
|
+
const details = clamp.createChangeEventDetails(clamp.none, event.nativeEvent);
|
|
1094
1093
|
setDirty(parsedValue !== validityData.initialValue);
|
|
1095
1094
|
setValue(parsedValue, details);
|
|
1096
1095
|
if (shouldValidateOnChange()) {
|
|
@@ -1112,7 +1111,7 @@ const NumberFieldRoot = /*#__PURE__*/React__namespace.forwardRef(function Number
|
|
|
1112
1111
|
required: required,
|
|
1113
1112
|
"aria-hidden": true,
|
|
1114
1113
|
tabIndex: -1,
|
|
1115
|
-
style: name ?
|
|
1114
|
+
style: name ? clamp.visuallyHiddenInput : clamp.visuallyHidden
|
|
1116
1115
|
})]
|
|
1117
1116
|
});
|
|
1118
1117
|
});
|
|
@@ -1195,7 +1194,7 @@ function useNumberFieldButton(params) {
|
|
|
1195
1194
|
// The increment value function needs to know the current input value to increment it
|
|
1196
1195
|
// correctly.
|
|
1197
1196
|
valueRef.current = parsedValue;
|
|
1198
|
-
setValue(parsedValue,
|
|
1197
|
+
setValue(parsedValue, clamp.createChangeEventDetails(pressReason, nativeEvent, undefined, {
|
|
1199
1198
|
direction: isIncrement ? 1 : -1
|
|
1200
1199
|
}));
|
|
1201
1200
|
}
|
|
@@ -1236,7 +1235,7 @@ function useNumberFieldButton(params) {
|
|
|
1236
1235
|
});
|
|
1237
1236
|
const committed = lastChangedValueRef.current ?? valueRef.current;
|
|
1238
1237
|
if (committed !== prev) {
|
|
1239
|
-
onValueCommitted(committed,
|
|
1238
|
+
onValueCommitted(committed, clamp.createGenericEventDetails(pressReason, event.nativeEvent));
|
|
1240
1239
|
}
|
|
1241
1240
|
},
|
|
1242
1241
|
onPointerDown(event) {
|
|
@@ -1394,7 +1393,7 @@ const NumberFieldIncrement = /*#__PURE__*/React__namespace.forwardRef(function N
|
|
|
1394
1393
|
const {
|
|
1395
1394
|
getButtonProps,
|
|
1396
1395
|
buttonRef
|
|
1397
|
-
} =
|
|
1396
|
+
} = clamp.useButton({
|
|
1398
1397
|
disabled,
|
|
1399
1398
|
native: nativeButton,
|
|
1400
1399
|
focusableWhenDisabled: true
|
|
@@ -1478,7 +1477,7 @@ const NumberFieldDecrement = /*#__PURE__*/React__namespace.forwardRef(function N
|
|
|
1478
1477
|
const {
|
|
1479
1478
|
getButtonProps,
|
|
1480
1479
|
buttonRef
|
|
1481
|
-
} =
|
|
1480
|
+
} = clamp.useButton({
|
|
1482
1481
|
disabled,
|
|
1483
1482
|
native: nativeButton,
|
|
1484
1483
|
focusableWhenDisabled: true
|
|
@@ -1565,7 +1564,7 @@ const NumberFieldInput = /*#__PURE__*/React__namespace.forwardRef(function Numbe
|
|
|
1565
1564
|
name,
|
|
1566
1565
|
getValue: () => value ?? null
|
|
1567
1566
|
});
|
|
1568
|
-
|
|
1567
|
+
clamp.useValueChanged(value, previousValue => {
|
|
1569
1568
|
const validateOnChange = shouldValidateOnChange();
|
|
1570
1569
|
clearErrors(name);
|
|
1571
1570
|
if (validateOnChange) {
|
|
@@ -1623,11 +1622,11 @@ const NumberFieldInput = /*#__PURE__*/React__namespace.forwardRef(function Numbe
|
|
|
1623
1622
|
const hadPendingProgrammaticChange = hasPendingCommitRef.current;
|
|
1624
1623
|
allowInputSyncRef.current = true;
|
|
1625
1624
|
if (inputValue.trim() === '') {
|
|
1626
|
-
setValue(null,
|
|
1625
|
+
setValue(null, clamp.createChangeEventDetails(clamp.inputClear, event.nativeEvent));
|
|
1627
1626
|
if (validationMode === 'onBlur') {
|
|
1628
1627
|
validation.commit(null);
|
|
1629
1628
|
}
|
|
1630
|
-
onValueCommitted(null,
|
|
1629
|
+
onValueCommitted(null, clamp.createGenericEventDetails(clamp.inputClear, event.nativeEvent));
|
|
1631
1630
|
return;
|
|
1632
1631
|
}
|
|
1633
1632
|
const formatOptions = formatOptionsRef.current;
|
|
@@ -1640,7 +1639,7 @@ const NumberFieldInput = /*#__PURE__*/React__namespace.forwardRef(function Numbe
|
|
|
1640
1639
|
const hasExplicitPrecision = formatOptions?.maximumFractionDigits != null || formatOptions?.minimumFractionDigits != null;
|
|
1641
1640
|
const maxFrac = formatOptions?.maximumFractionDigits;
|
|
1642
1641
|
const committed = hasExplicitPrecision && typeof maxFrac === 'number' ? Number(parsedValue.toFixed(maxFrac)) : parsedValue;
|
|
1643
|
-
const nextEventDetails =
|
|
1642
|
+
const nextEventDetails = clamp.createGenericEventDetails(clamp.inputBlur, event.nativeEvent);
|
|
1644
1643
|
const shouldUpdateValue = value !== committed;
|
|
1645
1644
|
const shouldCommit = hadManualInput || shouldUpdateValue || hadPendingProgrammaticChange;
|
|
1646
1645
|
if (validationMode === 'onBlur') {
|
|
@@ -1648,7 +1647,7 @@ const NumberFieldInput = /*#__PURE__*/React__namespace.forwardRef(function Numbe
|
|
|
1648
1647
|
}
|
|
1649
1648
|
if (shouldUpdateValue) {
|
|
1650
1649
|
blockRevalidationRef.current = true;
|
|
1651
|
-
setValue(committed,
|
|
1650
|
+
setValue(committed, clamp.createChangeEventDetails(clamp.inputBlur, event.nativeEvent));
|
|
1652
1651
|
}
|
|
1653
1652
|
if (shouldCommit) {
|
|
1654
1653
|
onValueCommitted(committed, nextEventDetails);
|
|
@@ -1671,7 +1670,7 @@ const NumberFieldInput = /*#__PURE__*/React__namespace.forwardRef(function Numbe
|
|
|
1671
1670
|
const targetValue = event.target.value;
|
|
1672
1671
|
if (targetValue.trim() === '') {
|
|
1673
1672
|
setInputValue(targetValue);
|
|
1674
|
-
setValue(null,
|
|
1673
|
+
setValue(null, clamp.createChangeEventDetails(clamp.inputClear, event.nativeEvent));
|
|
1675
1674
|
return;
|
|
1676
1675
|
}
|
|
1677
1676
|
|
|
@@ -1694,7 +1693,7 @@ const NumberFieldInput = /*#__PURE__*/React__namespace.forwardRef(function Numbe
|
|
|
1694
1693
|
const parsedValue = parseNumber(targetValue, locale, formatOptionsRef.current);
|
|
1695
1694
|
setInputValue(targetValue);
|
|
1696
1695
|
if (parsedValue !== null) {
|
|
1697
|
-
setValue(parsedValue,
|
|
1696
|
+
setValue(parsedValue, clamp.createChangeEventDetails(clamp.inputChange, event.nativeEvent));
|
|
1698
1697
|
}
|
|
1699
1698
|
},
|
|
1700
1699
|
onKeyDown(event) {
|
|
@@ -1754,14 +1753,14 @@ const NumberFieldInput = /*#__PURE__*/React__namespace.forwardRef(function Numbe
|
|
|
1754
1753
|
const amount = getStepAmount(event) ?? DEFAULT_STEP;
|
|
1755
1754
|
|
|
1756
1755
|
// Prevent insertion of text or caret from moving.
|
|
1757
|
-
|
|
1758
|
-
const commitDetails =
|
|
1756
|
+
clamp.stopEvent(event);
|
|
1757
|
+
const commitDetails = clamp.createGenericEventDetails(clamp.keyboard, nativeEvent);
|
|
1759
1758
|
if (event.key === 'ArrowUp') {
|
|
1760
1759
|
incrementValue(amount, {
|
|
1761
1760
|
direction: 1,
|
|
1762
1761
|
currentValue: parsedValue,
|
|
1763
1762
|
event: nativeEvent,
|
|
1764
|
-
reason:
|
|
1763
|
+
reason: clamp.keyboard
|
|
1765
1764
|
});
|
|
1766
1765
|
onValueCommitted(lastChangedValueRef.current ?? valueRef.current, commitDetails);
|
|
1767
1766
|
} else if (event.key === 'ArrowDown') {
|
|
@@ -1769,14 +1768,14 @@ const NumberFieldInput = /*#__PURE__*/React__namespace.forwardRef(function Numbe
|
|
|
1769
1768
|
direction: -1,
|
|
1770
1769
|
currentValue: parsedValue,
|
|
1771
1770
|
event: nativeEvent,
|
|
1772
|
-
reason:
|
|
1771
|
+
reason: clamp.keyboard
|
|
1773
1772
|
});
|
|
1774
1773
|
onValueCommitted(lastChangedValueRef.current ?? valueRef.current, commitDetails);
|
|
1775
1774
|
} else if (event.key === 'Home' && min != null) {
|
|
1776
|
-
setValue(min,
|
|
1775
|
+
setValue(min, clamp.createChangeEventDetails(clamp.keyboard, nativeEvent));
|
|
1777
1776
|
onValueCommitted(lastChangedValueRef.current ?? valueRef.current, commitDetails);
|
|
1778
1777
|
} else if (event.key === 'End' && max != null) {
|
|
1779
|
-
setValue(max,
|
|
1778
|
+
setValue(max, clamp.createChangeEventDetails(clamp.keyboard, nativeEvent));
|
|
1780
1779
|
onValueCommitted(lastChangedValueRef.current ?? valueRef.current, commitDetails);
|
|
1781
1780
|
}
|
|
1782
1781
|
},
|
|
@@ -1792,7 +1791,7 @@ const NumberFieldInput = /*#__PURE__*/React__namespace.forwardRef(function Numbe
|
|
|
1792
1791
|
const parsedValue = parseNumber(pastedData, locale, formatOptionsRef.current);
|
|
1793
1792
|
if (parsedValue !== null) {
|
|
1794
1793
|
allowInputSyncRef.current = false;
|
|
1795
|
-
setValue(parsedValue,
|
|
1794
|
+
setValue(parsedValue, clamp.createChangeEventDetails(clamp.inputPaste, event.nativeEvent));
|
|
1796
1795
|
setInputValue(pastedData);
|
|
1797
1796
|
}
|
|
1798
1797
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { a as useStableCallback,
|
|
3
|
-
import { N as NOOP, f as formatErrorMessage, E as EMPTY_OBJECT,
|
|
2
|
+
import { a as useStableCallback, d as useIsoLayoutEffect, u as useBaseUiId, f as useOnMount, T as Timeout, g as clamp, h as useControlled, i as useValueAsRef, b as useTimeout, j as isIOS, k as createChangeEventDetails, n as none, v as visuallyHiddenInput, l as visuallyHidden, m as inputChange, o as inputClear, p as inputBlur, q as inputPaste, r as createGenericEventDetails, s as ownerDocument, w as incrementPress, x as decrementPress, y as useButton, z as useValueChanged, A as stopEvent, B as keyboard } from './clamp-es.js';
|
|
3
|
+
import { N as NOOP, f as formatErrorMessage, E as EMPTY_OBJECT, a as useRefWithInit, b as useMergedRefs, u as useRenderElement } from './useRenderElement-es.js';
|
|
4
4
|
import { b as isElement, k as getWindow } from './floating-ui.utils.dom-es.js';
|
|
5
|
-
import { u as useBaseUiId, a as useButton } from './useBaseUiId-es.js';
|
|
6
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
6
|
import * as ReactDOM from 'react-dom';
|
|
8
7
|
|
package/dist/Page/index.cjs
CHANGED
|
@@ -28,12 +28,11 @@ require('../useFormFieldFocus-cjs.js');
|
|
|
28
28
|
require('../maxHeight-cjs.js');
|
|
29
29
|
require('../useRenderElement-cjs.js');
|
|
30
30
|
require('../BottomSheet-cjs.js');
|
|
31
|
-
require('../
|
|
32
|
-
require('../
|
|
31
|
+
require('../ScrollAreaViewport-cjs.js');
|
|
32
|
+
require('../clamp-cjs.js');
|
|
33
33
|
require('../OverlaySeparator-cjs.js');
|
|
34
34
|
require('../Separator-cjs.js');
|
|
35
35
|
require('../MenuSubmenuTrigger-cjs.js');
|
|
36
|
-
require('../useBaseUiId-cjs.js');
|
|
37
36
|
require('../filterDataAttributes-cjs.js');
|
|
38
37
|
|
|
39
38
|
|
package/dist/Page/index.mjs
CHANGED
|
@@ -26,10 +26,9 @@ import '../useFormFieldFocus-es.js';
|
|
|
26
26
|
import '../maxHeight-es.js';
|
|
27
27
|
import '../useRenderElement-es.js';
|
|
28
28
|
import '../BottomSheet-es.js';
|
|
29
|
-
import '../
|
|
30
|
-
import '../
|
|
29
|
+
import '../ScrollAreaViewport-es.js';
|
|
30
|
+
import '../clamp-es.js';
|
|
31
31
|
import '../OverlaySeparator-es.js';
|
|
32
32
|
import '../Separator-es.js';
|
|
33
33
|
import '../MenuSubmenuTrigger-es.js';
|
|
34
|
-
import '../useBaseUiId-es.js';
|
|
35
34
|
import '../filterDataAttributes-es.js';
|