@aircall/ds 0.45.0 → 0.45.1
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/globals.css +1 -1
- package/dist/index.js +16 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10681,7 +10681,7 @@ const _excluded$16 = [
|
|
|
10681
10681
|
"aria-describedby",
|
|
10682
10682
|
"aria-invalid"
|
|
10683
10683
|
];
|
|
10684
|
-
const _excluded2$11 = ["className"];
|
|
10684
|
+
const _excluded2$11 = ["className", "onChange"];
|
|
10685
10685
|
const _excluded3$10 = ["className", "children"];
|
|
10686
10686
|
const _excluded4$9 = ["className", "children"];
|
|
10687
10687
|
/**
|
|
@@ -10746,6 +10746,12 @@ const NumericInput = React.forwardRef((componentProps, forwardRef) => {
|
|
|
10746
10746
|
});
|
|
10747
10747
|
NumericInput.displayName = "NumericInput";
|
|
10748
10748
|
/**
|
|
10749
|
+
* Normalizes input text by stripping leading zeros when typing positive or negative integers.
|
|
10750
|
+
*/
|
|
10751
|
+
function normalizeNumericInputText(value) {
|
|
10752
|
+
return value.replace(/^(-?)0+(?=\d)/, "$1");
|
|
10753
|
+
}
|
|
10754
|
+
/**
|
|
10749
10755
|
* The text input part. Renders a bare `<input>` (direct child of `NumericInput`)
|
|
10750
10756
|
* carrying `data-slot="input-group-control"` so the shell's focus halo applies.
|
|
10751
10757
|
* The input's `aria-label` deliberately overrides the group's label for the input control.
|
|
@@ -10758,11 +10764,18 @@ NumericInput.displayName = "NumericInput";
|
|
|
10758
10764
|
* ```
|
|
10759
10765
|
*/
|
|
10760
10766
|
const NumericInputControl = React.forwardRef((componentProps, forwardRef) => {
|
|
10761
|
-
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded2$11);
|
|
10767
|
+
const { className, onChange } = componentProps, props = _objectWithoutProperties(componentProps, _excluded2$11);
|
|
10768
|
+
const handleChange = (event) => {
|
|
10769
|
+
const raw = event.target.value;
|
|
10770
|
+
const normalized = normalizeNumericInputText(raw);
|
|
10771
|
+
if (normalized !== raw) event.target.value = normalized;
|
|
10772
|
+
onChange === null || onChange === void 0 || onChange(event);
|
|
10773
|
+
};
|
|
10762
10774
|
return /* @__PURE__ */ jsx(NumberField.Input, _objectSpread2({
|
|
10763
10775
|
ref: forwardRef,
|
|
10764
10776
|
"data-slot": "input-group-control",
|
|
10765
|
-
className: cn("text-foreground placeholder:text-muted-foreground min-w-0 flex-1 rounded-none border-0 bg-transparent px-3 py-2 text-base shadow-none outline-none disabled:opacity-100 md:text-sm", className)
|
|
10777
|
+
className: cn("text-foreground placeholder:text-muted-foreground min-w-0 flex-1 rounded-none border-0 bg-transparent px-3 py-2 text-base shadow-none outline-none disabled:opacity-100 md:text-sm", className),
|
|
10778
|
+
onChange: handleChange
|
|
10766
10779
|
}, props));
|
|
10767
10780
|
});
|
|
10768
10781
|
NumericInputControl.displayName = "NumericInputControl";
|