@jobber/components 8.16.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.
|
@@ -611,12 +611,14 @@ var styles = {"container":"_6HZLFIOZh4s-","inline":"_-6ndFYNKKaM-","wrapper":"c2
|
|
|
611
611
|
|
|
612
612
|
/**
|
|
613
613
|
* Default formatting used only when the consumer does not pass `format`.
|
|
614
|
-
*
|
|
615
|
-
*
|
|
614
|
+
* Base UI rounds committed values to `maximumFractionDigits`, so this cap also
|
|
615
|
+
* scrubs IEEE-754 step drift (keeps `3.14 + 1` from committing
|
|
616
|
+
* `4.140000000000001`). 12 sits below that noise floor while keeping more
|
|
617
|
+
* precision than a numeric field needs.
|
|
616
618
|
*/
|
|
617
619
|
const DEFAULT_FORMAT = {
|
|
618
620
|
useGrouping: false,
|
|
619
|
-
maximumFractionDigits:
|
|
621
|
+
maximumFractionDigits: 12,
|
|
620
622
|
};
|
|
621
623
|
const InputNumberExperimentalContext = React.createContext(null);
|
|
622
624
|
function useInputNumberExperimentalContext(consumer) {
|
|
@@ -628,7 +630,7 @@ function useInputNumberExperimentalContext(consumer) {
|
|
|
628
630
|
}
|
|
629
631
|
// eslint-disable-next-line max-statements
|
|
630
632
|
function InputNumberExperimentalInternal(props, ref) {
|
|
631
|
-
const { align, autocomplete, children, description, disabled, error, format, id: idProp, inline, invalid, keyboard, loading, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, placeholder, prefix, readonly, showMiniLabel = true, size = "default", suffix, value, } = props;
|
|
633
|
+
const { align, autocomplete, children, description, disabled, error, format, id: idProp, inline, invalid, keyboard, loading, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, placeholder, prefix, readonly, showMiniLabel = true, size = "default", step = 1, suffix, value, } = props;
|
|
632
634
|
const generatedId = React.useId();
|
|
633
635
|
const id = idProp !== null && idProp !== void 0 ? idProp : generatedId;
|
|
634
636
|
const innerInputRef = React.useRef(null);
|
|
@@ -705,7 +707,7 @@ function InputNumberExperimentalInternal(props, ref) {
|
|
|
705
707
|
const fieldInvalid = invalid || Boolean(error);
|
|
706
708
|
return (React.createElement(FieldRoot, { className: classnames(styles.container, inline && styles.inline), disabled: disabled, invalid: fieldInvalid, name: name },
|
|
707
709
|
React.createElement(InputNumberExperimentalContext.Provider, { value: contextValue },
|
|
708
|
-
React.createElement(NumberFieldInput.NumberFieldRoot, { allowOutOfRange: true, format: format !== null && format !== void 0 ? format : DEFAULT_FORMAT, id: id, max: max, min: min, onValueChange: handleValueChange, onValueCommitted: handleValueCommitted, readOnly: readonly, value: value !== null && value !== void 0 ? value : null },
|
|
710
|
+
React.createElement(NumberFieldInput.NumberFieldRoot, { allowOutOfRange: true, format: format !== null && format !== void 0 ? format : DEFAULT_FORMAT, id: id, max: max, min: min, onValueChange: handleValueChange, onValueCommitted: handleValueCommitted, readOnly: readonly, step: step, value: value !== null && value !== void 0 ? value : null },
|
|
709
711
|
React.createElement(NumberFieldInput.NumberFieldGroup, { className: classnames(styles.wrapper, align && styles[align], disabled && styles.disabled, size !== "default" && styles[size]) }, isUsingCompoundPattern
|
|
710
712
|
? children
|
|
711
713
|
: renderDefaultComposition({ prefix, suffix, size })))),
|
|
@@ -760,8 +762,10 @@ function InputNumberExperimentalStepperCompound({ incrementLabel, decrementLabel
|
|
|
760
762
|
const resolvedDecrementLabel = decrementLabel !== null && decrementLabel !== void 0 ? decrementLabel : `Decrease ${labelTarget}`;
|
|
761
763
|
const rootProps = useRenderElement.mergeProps({ className: styles.stepper }, { className, style });
|
|
762
764
|
return (React.createElement("div", Object.assign({}, rootProps),
|
|
763
|
-
React.createElement(NumberFieldInput.NumberFieldIncrement, { "aria-label": resolvedIncrementLabel, className: styles.stepperButton },
|
|
764
|
-
|
|
765
|
+
React.createElement(NumberFieldInput.NumberFieldIncrement, { "aria-label": resolvedIncrementLabel, className: styles.stepperButton },
|
|
766
|
+
React.createElement(Icon.Icon, { name: "arrowUp", size: "small", customColor: "currentColor" })),
|
|
767
|
+
React.createElement(NumberFieldInput.NumberFieldDecrement, { "aria-label": resolvedDecrementLabel, className: styles.stepperButton },
|
|
768
|
+
React.createElement(Icon.Icon, { name: "arrowDown", size: "small", customColor: "currentColor" }))));
|
|
765
769
|
}
|
|
766
770
|
function AffixIconSlot({ variation, icon, size, onClick, ariaLabel, }) {
|
|
767
771
|
return (React.createElement("div", { className: classnames(styles.affixIcon, variation === "suffix" && styles.suffix) },
|
|
@@ -591,12 +591,14 @@ var styles = {"container":"_6HZLFIOZh4s-","inline":"_-6ndFYNKKaM-","wrapper":"c2
|
|
|
591
591
|
|
|
592
592
|
/**
|
|
593
593
|
* Default formatting used only when the consumer does not pass `format`.
|
|
594
|
-
*
|
|
595
|
-
*
|
|
594
|
+
* Base UI rounds committed values to `maximumFractionDigits`, so this cap also
|
|
595
|
+
* scrubs IEEE-754 step drift (keeps `3.14 + 1` from committing
|
|
596
|
+
* `4.140000000000001`). 12 sits below that noise floor while keeping more
|
|
597
|
+
* precision than a numeric field needs.
|
|
596
598
|
*/
|
|
597
599
|
const DEFAULT_FORMAT = {
|
|
598
600
|
useGrouping: false,
|
|
599
|
-
maximumFractionDigits:
|
|
601
|
+
maximumFractionDigits: 12,
|
|
600
602
|
};
|
|
601
603
|
const InputNumberExperimentalContext = createContext(null);
|
|
602
604
|
function useInputNumberExperimentalContext(consumer) {
|
|
@@ -608,7 +610,7 @@ function useInputNumberExperimentalContext(consumer) {
|
|
|
608
610
|
}
|
|
609
611
|
// eslint-disable-next-line max-statements
|
|
610
612
|
function InputNumberExperimentalInternal(props, ref) {
|
|
611
|
-
const { align, autocomplete, children, description, disabled, error, format, id: idProp, inline, invalid, keyboard, loading, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, placeholder, prefix, readonly, showMiniLabel = true, size = "default", suffix, value, } = props;
|
|
613
|
+
const { align, autocomplete, children, description, disabled, error, format, id: idProp, inline, invalid, keyboard, loading, max, maxLength, min, name, onBlur, onChange, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, placeholder, prefix, readonly, showMiniLabel = true, size = "default", step = 1, suffix, value, } = props;
|
|
612
614
|
const generatedId = useId();
|
|
613
615
|
const id = idProp !== null && idProp !== void 0 ? idProp : generatedId;
|
|
614
616
|
const innerInputRef = useRef(null);
|
|
@@ -685,7 +687,7 @@ function InputNumberExperimentalInternal(props, ref) {
|
|
|
685
687
|
const fieldInvalid = invalid || Boolean(error);
|
|
686
688
|
return (React__default.createElement(FieldRoot, { className: classnames(styles.container, inline && styles.inline), disabled: disabled, invalid: fieldInvalid, name: name },
|
|
687
689
|
React__default.createElement(InputNumberExperimentalContext.Provider, { value: contextValue },
|
|
688
|
-
React__default.createElement(NumberFieldRoot, { allowOutOfRange: true, format: format !== null && format !== void 0 ? format : DEFAULT_FORMAT, id: id, max: max, min: min, onValueChange: handleValueChange, onValueCommitted: handleValueCommitted, readOnly: readonly, value: value !== null && value !== void 0 ? value : null },
|
|
690
|
+
React__default.createElement(NumberFieldRoot, { allowOutOfRange: true, format: format !== null && format !== void 0 ? format : DEFAULT_FORMAT, id: id, max: max, min: min, onValueChange: handleValueChange, onValueCommitted: handleValueCommitted, readOnly: readonly, step: step, value: value !== null && value !== void 0 ? value : null },
|
|
689
691
|
React__default.createElement(NumberFieldGroup, { className: classnames(styles.wrapper, align && styles[align], disabled && styles.disabled, size !== "default" && styles[size]) }, isUsingCompoundPattern
|
|
690
692
|
? children
|
|
691
693
|
: renderDefaultComposition({ prefix, suffix, size })))),
|
|
@@ -740,8 +742,10 @@ function InputNumberExperimentalStepperCompound({ incrementLabel, decrementLabel
|
|
|
740
742
|
const resolvedDecrementLabel = decrementLabel !== null && decrementLabel !== void 0 ? decrementLabel : `Decrease ${labelTarget}`;
|
|
741
743
|
const rootProps = mergeProps({ className: styles.stepper }, { className, style });
|
|
742
744
|
return (React__default.createElement("div", Object.assign({}, rootProps),
|
|
743
|
-
React__default.createElement(NumberFieldIncrement, { "aria-label": resolvedIncrementLabel, className: styles.stepperButton },
|
|
744
|
-
|
|
745
|
+
React__default.createElement(NumberFieldIncrement, { "aria-label": resolvedIncrementLabel, className: styles.stepperButton },
|
|
746
|
+
React__default.createElement(Icon, { name: "arrowUp", size: "small", customColor: "currentColor" })),
|
|
747
|
+
React__default.createElement(NumberFieldDecrement, { "aria-label": resolvedDecrementLabel, className: styles.stepperButton },
|
|
748
|
+
React__default.createElement(Icon, { name: "arrowDown", size: "small", customColor: "currentColor" }))));
|
|
745
749
|
}
|
|
746
750
|
function AffixIconSlot({ variation, icon, size, onClick, ariaLabel, }) {
|
|
747
751
|
return (React__default.createElement("div", { className: classnames(styles.affixIcon, variation === "suffix" && styles.suffix) },
|
|
@@ -111,6 +111,11 @@ export interface InputNumberExperimentalProps {
|
|
|
111
111
|
/** Default `true`. When `false`, the floating mini-label is hidden. */
|
|
112
112
|
readonly showMiniLabel?: boolean;
|
|
113
113
|
readonly size?: InputNumberExperimentalSize;
|
|
114
|
+
/**
|
|
115
|
+
* Amount the stepper buttons and ArrowUp/ArrowDown keys change the value by.
|
|
116
|
+
* Default `1`.
|
|
117
|
+
*/
|
|
118
|
+
readonly step?: number;
|
|
114
119
|
readonly suffix?: InputNumberExperimentalSuffixProp;
|
|
115
120
|
/**
|
|
116
121
|
* Value of the field. Controlled-only — pair with `onChange` and drive from
|
package/dist/styles.css
CHANGED
|
@@ -4613,8 +4613,7 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
|
|
|
4613
4613
|
border: none;
|
|
4614
4614
|
color: hsl(197, 21%, 36%);
|
|
4615
4615
|
color: var(--color-text--secondary);
|
|
4616
|
-
|
|
4617
|
-
line-height: 1;
|
|
4616
|
+
line-height: 0;
|
|
4618
4617
|
background: transparent;
|
|
4619
4618
|
cursor: pointer;
|
|
4620
4619
|
-ms-flex-align: center;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.17.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -546,5 +546,5 @@
|
|
|
546
546
|
"> 1%",
|
|
547
547
|
"IE 10"
|
|
548
548
|
],
|
|
549
|
-
"gitHead": "
|
|
549
|
+
"gitHead": "202afd57218f0140cd2cf489742f99afd22e6b2c"
|
|
550
550
|
}
|