@jobber/components 7.12.2 → 7.13.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.
|
@@ -625,8 +625,9 @@ function useInputNumberExperimentalContext(consumer) {
|
|
|
625
625
|
}
|
|
626
626
|
return context;
|
|
627
627
|
}
|
|
628
|
+
// eslint-disable-next-line max-statements
|
|
628
629
|
function InputNumberExperimentalInternal(props, ref) {
|
|
629
|
-
const { align, autocomplete, children, description, disabled, error, id: idProp, inline, invalid, keyboard, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, placeholder, prefix, readonly, showMiniLabel = true, size = "default", suffix, value, } = props;
|
|
630
|
+
const { align, autocomplete, children, description, disabled, error, id: idProp, inline, invalid, keyboard, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, placeholder, prefix, readonly, showMiniLabel = true, size = "default", suffix, value, } = props;
|
|
630
631
|
const generatedId = React.useId();
|
|
631
632
|
const id = idProp !== null && idProp !== void 0 ? idProp : generatedId;
|
|
632
633
|
const innerInputRef = React.useRef(null);
|
|
@@ -637,6 +638,9 @@ function InputNumberExperimentalInternal(props, ref) {
|
|
|
637
638
|
const handleValueCommitted = React.useCallback((newValue) => {
|
|
638
639
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue !== null && newValue !== void 0 ? newValue : undefined);
|
|
639
640
|
}, [onChange]);
|
|
641
|
+
const handleValueChange = React.useCallback((newValue) => {
|
|
642
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue !== null && newValue !== void 0 ? newValue : undefined);
|
|
643
|
+
}, [onValueChange]);
|
|
640
644
|
const handleKeyDown = React.useCallback((event) => {
|
|
641
645
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
642
646
|
if (event.key === "Enter" &&
|
|
@@ -698,7 +702,7 @@ function InputNumberExperimentalInternal(props, ref) {
|
|
|
698
702
|
const fieldInvalid = invalid || Boolean(error);
|
|
699
703
|
return (React.createElement(FieldRoot, { className: classnames(styles.container, inline && styles.inline), disabled: disabled, invalid: fieldInvalid, name: name },
|
|
700
704
|
React.createElement(InputNumberExperimentalContext.Provider, { value: contextValue },
|
|
701
|
-
React.createElement(NumberFieldInput.NumberFieldRoot, { allowOutOfRange: true, format: DEFAULT_FORMAT, id: id, max: max, min: min, onValueCommitted: handleValueCommitted, readOnly: readonly, value: value !== null && value !== void 0 ? value : null },
|
|
705
|
+
React.createElement(NumberFieldInput.NumberFieldRoot, { allowOutOfRange: true, format: DEFAULT_FORMAT, id: id, max: max, min: min, onValueChange: handleValueChange, onValueCommitted: handleValueCommitted, readOnly: readonly, value: value !== null && value !== void 0 ? value : null },
|
|
702
706
|
React.createElement(NumberFieldInput.NumberFieldGroup, { className: classnames(styles.wrapper, align && styles[align], disabled && styles.disabled, size !== "default" && styles[size]) }, isUsingCompoundPattern
|
|
703
707
|
? children
|
|
704
708
|
: renderDefaultComposition({ prefix, suffix, size })))),
|
|
@@ -605,8 +605,9 @@ function useInputNumberExperimentalContext(consumer) {
|
|
|
605
605
|
}
|
|
606
606
|
return context;
|
|
607
607
|
}
|
|
608
|
+
// eslint-disable-next-line max-statements
|
|
608
609
|
function InputNumberExperimentalInternal(props, ref) {
|
|
609
|
-
const { align, autocomplete, children, description, disabled, error, id: idProp, inline, invalid, keyboard, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, placeholder, prefix, readonly, showMiniLabel = true, size = "default", suffix, value, } = props;
|
|
610
|
+
const { align, autocomplete, children, description, disabled, error, id: idProp, inline, invalid, keyboard, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, placeholder, prefix, readonly, showMiniLabel = true, size = "default", suffix, value, } = props;
|
|
610
611
|
const generatedId = useId();
|
|
611
612
|
const id = idProp !== null && idProp !== void 0 ? idProp : generatedId;
|
|
612
613
|
const innerInputRef = useRef(null);
|
|
@@ -617,6 +618,9 @@ function InputNumberExperimentalInternal(props, ref) {
|
|
|
617
618
|
const handleValueCommitted = useCallback((newValue) => {
|
|
618
619
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue !== null && newValue !== void 0 ? newValue : undefined);
|
|
619
620
|
}, [onChange]);
|
|
621
|
+
const handleValueChange = useCallback((newValue) => {
|
|
622
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue !== null && newValue !== void 0 ? newValue : undefined);
|
|
623
|
+
}, [onValueChange]);
|
|
620
624
|
const handleKeyDown = useCallback((event) => {
|
|
621
625
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
622
626
|
if (event.key === "Enter" &&
|
|
@@ -678,7 +682,7 @@ function InputNumberExperimentalInternal(props, ref) {
|
|
|
678
682
|
const fieldInvalid = invalid || Boolean(error);
|
|
679
683
|
return (React__default.createElement(FieldRoot, { className: classnames(styles.container, inline && styles.inline), disabled: disabled, invalid: fieldInvalid, name: name },
|
|
680
684
|
React__default.createElement(InputNumberExperimentalContext.Provider, { value: contextValue },
|
|
681
|
-
React__default.createElement(NumberFieldRoot, { allowOutOfRange: true, format: DEFAULT_FORMAT, id: id, max: max, min: min, onValueCommitted: handleValueCommitted, readOnly: readonly, value: value !== null && value !== void 0 ? value : null },
|
|
685
|
+
React__default.createElement(NumberFieldRoot, { allowOutOfRange: true, format: DEFAULT_FORMAT, id: id, max: max, min: min, onValueChange: handleValueChange, onValueCommitted: handleValueCommitted, readOnly: readonly, value: value !== null && value !== void 0 ? value : null },
|
|
682
686
|
React__default.createElement(NumberFieldGroup, { className: classnames(styles.wrapper, align && styles[align], disabled && styles.disabled, size !== "default" && styles[size]) }, isUsingCompoundPattern
|
|
683
687
|
? children
|
|
684
688
|
: renderDefaultComposition({ prefix, suffix, size })))),
|
|
@@ -64,15 +64,18 @@ export interface InputNumberExperimentalProps {
|
|
|
64
64
|
readonly name?: string;
|
|
65
65
|
readonly onBlur?: (event?: FocusEvent<HTMLInputElement>) => void;
|
|
66
66
|
/**
|
|
67
|
-
* Fires when the user
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* completed input rather than on every keystroke.
|
|
71
|
-
*
|
|
72
|
-
* - Emits `number` for parseable committed input.
|
|
73
|
-
* - Emits `undefined` when the field is committed empty.
|
|
67
|
+
* Fires when the user commits a value (blur, Enter, stepper, arrow step).
|
|
68
|
+
* Use for side effects that shouldn't run per keystroke. Emits `undefined`
|
|
69
|
+
* when committed empty. For per-keystroke updates, see `onValueChange`.
|
|
74
70
|
*/
|
|
75
71
|
readonly onChange?: (newValue: number | undefined) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Fires on every parsed value change (typing, paste, stepper, arrow step).
|
|
74
|
+
* Emits `undefined` when the field is empty. Prefer `onChange` for side
|
|
75
|
+
* effects; reach for this only when UI must reflect in-progress input
|
|
76
|
+
* (e.g. a live-updating subtotal).
|
|
77
|
+
*/
|
|
78
|
+
readonly onValueChange?: (newValue: number | undefined) => void;
|
|
76
79
|
/**
|
|
77
80
|
* Derived from `onKeyDown` — fires when the user presses Enter without
|
|
78
81
|
* any modifier keys (Shift/Ctrl/Meta).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.13.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -583,5 +583,5 @@
|
|
|
583
583
|
"> 1%",
|
|
584
584
|
"IE 10"
|
|
585
585
|
],
|
|
586
|
-
"gitHead": "
|
|
586
|
+
"gitHead": "54cf83958f2d29a8c4ccc7f96f4a406717cc4c51"
|
|
587
587
|
}
|