goobs-frontend 0.8.21 → 0.8.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goobs-frontend",
3
- "version": "0.8.21",
3
+ "version": "0.8.22",
4
4
  "type": "module",
5
5
  "description": "A comprehensive React-based UI library built on Material-UI, offering a wide range of customizable components including grids, typography, buttons, cards, forms, navigation, pricing tables, steppers, tooltips, accordions, and more. Designed for building responsive and consistent user interfaces with advanced features like form validation, theming, and code syntax highlighting.",
6
6
  "license": "MIT",
@@ -5,7 +5,11 @@ import { styled } from '@mui/material/styles'
5
5
 
6
6
  export interface NumberFieldProps extends Omit<TextFieldProps, 'onChange'> {
7
7
  initialValue?: string
8
- onChange?: () => void
8
+ /**
9
+ * Now accepts a standard ChangeEvent<HTMLInputElement>
10
+ * so parent can do e.g. (event) => parseInt(event.target.value) ...
11
+ */
12
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
9
13
  backgroundcolor?: string
10
14
  outlinecolor?: string
11
15
  fontcolor?: string
@@ -58,20 +62,24 @@ const NumberField: React.FC<NumberFieldProps> = ({
58
62
  const handleChange = useCallback(
59
63
  (event: React.ChangeEvent<HTMLInputElement>) => {
60
64
  const newValue = event.target.value.replace(/[^0-9]/g, '')
65
+
61
66
  if (newValue === '') {
62
67
  setValue('')
63
- onChange?.()
68
+ onChange?.(event) // Pass empty string up
64
69
  return
65
70
  }
71
+
66
72
  const numValue = parseInt(newValue, 10)
67
73
  if (min !== undefined && numValue < min) {
68
- setValue(min.toString())
74
+ setValue(String(min))
69
75
  } else if (max !== undefined && numValue > max) {
70
- setValue(max.toString())
76
+ setValue(String(max))
71
77
  } else {
72
78
  setValue(newValue)
73
79
  }
74
- onChange?.()
80
+
81
+ // Call parent's onChange so it knows about the new event/value
82
+ onChange?.(event)
75
83
  },
76
84
  [onChange, min, max]
77
85
  )