@jobber/components 7.12.1 → 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/dist/styles.css
CHANGED
|
@@ -7649,53 +7649,43 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
|
|
|
7649
7649
|
.-hmXAsAfH9U-::picker(select) {
|
|
7650
7650
|
-webkit-appearance: base-select;
|
|
7651
7651
|
appearance: base-select;
|
|
7652
|
-
|
|
7653
|
-
/* Dropdown styling */
|
|
7654
7652
|
}
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
box-shadow: var(--shadow-base);
|
|
7658
|
-
margin-top: 8px;
|
|
7659
|
-
margin-top: var(--space-small);
|
|
7660
|
-
padding: 0;
|
|
7661
|
-
border: 1px solid hsl(200, 13%, 87%);
|
|
7662
|
-
border: var(--border-base) solid var(--color-border);
|
|
7663
|
-
border-radius: 8px;
|
|
7664
|
-
border-radius: var(--radius-base);
|
|
7665
|
-
background: rgba(255, 255, 255, 1);
|
|
7666
|
-
background: var(--color-surface);
|
|
7667
|
-
}
|
|
7668
|
-
|
|
7669
|
-
/* enable transitions in the drop down */
|
|
7653
|
+
|
|
7654
|
+
/* Dropdown styling + transitions */
|
|
7670
7655
|
.-hmXAsAfH9U-::picker(select) {
|
|
7671
|
-
|
|
7672
|
-
|
|
7656
|
+
box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1), 0px 4px 12px 0px rgba(0, 0, 0, 0.05);
|
|
7657
|
+
box-shadow: var(--shadow-base);
|
|
7658
|
+
margin-top: 8px;
|
|
7659
|
+
margin-top: var(--space-small);
|
|
7660
|
+
padding: 0;
|
|
7661
|
+
border: 1px solid hsl(200, 13%, 87%);
|
|
7662
|
+
border: var(--border-base) solid var(--color-border);
|
|
7663
|
+
border-radius: 8px;
|
|
7664
|
+
border-radius: var(--radius-base);
|
|
7665
|
+
background: rgba(255, 255, 255, 1);
|
|
7666
|
+
background: var(--color-surface);
|
|
7667
|
+
transition: opacity 200ms ease,
|
|
7673
7668
|
display 200ms allow-discrete,
|
|
7674
7669
|
overlay 200ms allow-discrete,
|
|
7675
7670
|
-webkit-transform 200ms ease-out;
|
|
7676
|
-
transition:
|
|
7677
|
-
opacity var(--timing-base) ease,
|
|
7671
|
+
transition: opacity var(--timing-base) ease,
|
|
7678
7672
|
display var(--timing-base) allow-discrete,
|
|
7679
7673
|
overlay var(--timing-base) allow-discrete,
|
|
7680
7674
|
-webkit-transform var(--timing-base) ease-out;
|
|
7681
|
-
transition:
|
|
7682
|
-
opacity 200ms ease,
|
|
7675
|
+
transition: opacity 200ms ease,
|
|
7683
7676
|
transform 200ms ease-out,
|
|
7684
7677
|
display 200ms allow-discrete,
|
|
7685
7678
|
overlay 200ms allow-discrete;
|
|
7686
|
-
transition:
|
|
7687
|
-
opacity var(--timing-base) ease,
|
|
7679
|
+
transition: opacity var(--timing-base) ease,
|
|
7688
7680
|
transform var(--timing-base) ease-out,
|
|
7689
7681
|
display var(--timing-base) allow-discrete,
|
|
7690
7682
|
overlay var(--timing-base) allow-discrete;
|
|
7691
|
-
transition:
|
|
7692
|
-
opacity 200ms ease,
|
|
7683
|
+
transition: opacity 200ms ease,
|
|
7693
7684
|
transform 200ms ease-out,
|
|
7694
7685
|
display 200ms allow-discrete,
|
|
7695
7686
|
overlay 200ms allow-discrete,
|
|
7696
7687
|
-webkit-transform 200ms ease-out;
|
|
7697
|
-
transition:
|
|
7698
|
-
opacity var(--timing-base) ease,
|
|
7688
|
+
transition: opacity var(--timing-base) ease,
|
|
7699
7689
|
transform var(--timing-base) ease-out,
|
|
7700
7690
|
display var(--timing-base) allow-discrete,
|
|
7701
7691
|
overlay var(--timing-base) allow-discrete,
|
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
|
}
|