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