@simplybusiness/mobius 5.32.1 → 5.32.2

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/esm/index.js CHANGED
@@ -3185,8 +3185,18 @@ import classNames38 from "classnames/dedupe";
3185
3185
  import { forwardRef as forwardRef35 } from "react";
3186
3186
  import { jsx as jsx45 } from "react/jsx-runtime";
3187
3187
  var NumberField = forwardRef35((props, ref) => {
3188
- const { minValue, maxValue, step, defaultValue, className, ...otherProps } = props;
3189
- const containerClasses = classNames38("mobius-number-field", className);
3188
+ const {
3189
+ minValue,
3190
+ maxValue,
3191
+ step,
3192
+ defaultValue,
3193
+ hideSpinButtons,
3194
+ className,
3195
+ ...otherProps
3196
+ } = props;
3197
+ const containerClasses = classNames38("mobius-number-field", className, {
3198
+ "--hide-spin-buttons": hideSpinButtons
3199
+ });
3190
3200
  const handleBeforeInput = (event) => {
3191
3201
  const { data } = event.nativeEvent;
3192
3202
  if (step != null && Number.isInteger(step) && data === ".") {
@@ -11,6 +11,8 @@ export interface NumberFieldProps extends Omit<TextFieldProps, "type" | "default
11
11
  step?: number;
12
12
  /** The default value for the input. */
13
13
  defaultValue?: number;
14
+ /** Flag to hide the spin buttons. */
15
+ hideSpinButtons?: boolean;
14
16
  }
15
17
  export type NumberFieldRef = Ref<NumberFieldElementType>;
16
18
  export declare const NumberField: ForwardedRefComponent<NumberFieldProps, NumberFieldElementType>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simplybusiness/mobius",
3
3
  "license": "UNLICENSED",
4
- "version": "5.32.1",
4
+ "version": "5.32.2",
5
5
  "description": "Core library of Mobius react components",
6
6
  "repository": {
7
7
  "type": "git",
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "dependencies": {
85
85
  "@floating-ui/react": "^0.27.12",
86
- "@simplybusiness/icons": "^4.31.2",
86
+ "@simplybusiness/icons": "^4.32.0",
87
87
  "classnames": "^2.5.1",
88
88
  "dialog-polyfill": "^0.5.6",
89
89
  "lodash.debounce": "^4.0.8",
@@ -5,6 +5,18 @@
5
5
  &:where(.--is-optional) > :where(.mobius-label)::after {
6
6
  content: " (optional)";
7
7
  }
8
+
9
+ &.--hide-spin-buttons {
10
+ &::-webkit-outer-spin-button,
11
+ &::-webkit-inner-spin-button {
12
+ -webkit-appearance: none;
13
+ margin: 0;
14
+ }
15
+ & {
16
+ appearance: textfield;
17
+ -moz-appearance: textfield;
18
+ }
19
+ }
8
20
  }
9
21
 
10
22
  .mobius-number-field__input-wrapper {
@@ -24,6 +24,8 @@ export interface NumberFieldProps
24
24
  step?: number; // ??
25
25
  /** The default value for the input. */
26
26
  defaultValue?: number;
27
+ /** Flag to hide the spin buttons. */
28
+ hideSpinButtons?: boolean;
27
29
  }
28
30
 
29
31
  export type NumberFieldRef = Ref<NumberFieldElementType>;
@@ -32,10 +34,19 @@ export const NumberField: ForwardedRefComponent<
32
34
  NumberFieldProps,
33
35
  NumberFieldElementType
34
36
  > = forwardRef((props: NumberFieldProps, ref: NumberFieldRef) => {
35
- const { minValue, maxValue, step, defaultValue, className, ...otherProps } =
36
- props;
37
+ const {
38
+ minValue,
39
+ maxValue,
40
+ step,
41
+ defaultValue,
42
+ hideSpinButtons,
43
+ className,
44
+ ...otherProps
45
+ } = props;
37
46
 
38
- const containerClasses = classNames("mobius-number-field", className);
47
+ const containerClasses = classNames("mobius-number-field", className, {
48
+ "--hide-spin-buttons": hideSpinButtons,
49
+ });
39
50
 
40
51
  const handleBeforeInput = (
41
52
  event: React.FormEvent<NumberFieldElementType>,