@firecms/ui 3.0.0-canary.242 → 3.0.0-canary.244

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/ui",
3
3
  "type": "module",
4
- "version": "3.0.0-canary.242",
4
+ "version": "3.0.0-canary.244",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/firecmsco"
@@ -116,7 +116,7 @@
116
116
  "index.css",
117
117
  "tailwind.config.js"
118
118
  ],
119
- "gitHead": "61c5737585c7126aadfb189c4f0c113943d001b0",
119
+ "gitHead": "6b3dcdc942e0fd64e3023b5361c34ec2ac2bb1d3",
120
120
  "publishConfig": {
121
121
  "access": "public"
122
122
  }
@@ -38,33 +38,35 @@ export type SelectProps<T extends SelectValue = string> = {
38
38
  padding?: boolean,
39
39
  invisible?: boolean,
40
40
  children?: React.ReactNode;
41
+ dataType?: "string" | "number" | "boolean";
41
42
  };
42
43
 
43
44
  export const Select = forwardRef<HTMLDivElement, SelectProps>(({
44
- inputRef,
45
- open,
46
- name,
47
- fullWidth = false,
48
- id,
49
- onOpenChange,
50
- value,
51
- onChange,
52
- onValueChange,
53
- className,
54
- inputClassName,
55
- placeholder,
56
- renderValue,
57
- label,
58
- size = "large",
59
- error,
60
- disabled,
61
- padding = true,
62
- position = "item-aligned",
63
- endAdornment,
64
- invisible,
65
- children,
66
- ...props
67
- }, ref) => {
45
+ inputRef,
46
+ open,
47
+ name,
48
+ fullWidth = false,
49
+ id,
50
+ onOpenChange,
51
+ value,
52
+ onChange,
53
+ onValueChange,
54
+ className,
55
+ inputClassName,
56
+ placeholder,
57
+ renderValue,
58
+ label,
59
+ size = "large",
60
+ error,
61
+ disabled,
62
+ padding = true,
63
+ position = "item-aligned",
64
+ endAdornment,
65
+ invisible,
66
+ children,
67
+ dataType = "string",
68
+ ...props
69
+ }, ref) => {
68
70
 
69
71
  const [openInternal, setOpenInternal] = useState(open ?? false);
70
72
 
@@ -73,11 +75,14 @@ export const Select = forwardRef<HTMLDivElement, SelectProps>(({
73
75
  }, [open]);
74
76
 
75
77
  const onValueChangeInternal = useCallback((newValue: string) => {
76
- // Convert string value to appropriate type
78
+
77
79
  let typedValue: SelectValue = newValue;
78
- if (newValue === "true") typedValue = true;
79
- else if (newValue === "false") typedValue = false;
80
- else if (!isNaN(Number(newValue)) && newValue.trim() !== '') typedValue = Number(newValue);
80
+ if (dataType === "boolean") {
81
+ if (newValue === "true") typedValue = true;
82
+ else if (newValue === "false") typedValue = false;
83
+ } else if (dataType === "number") {
84
+ if (!isNaN(Number(newValue)) && newValue.trim() !== "") typedValue = Number(newValue);
85
+ }
81
86
 
82
87
  onValueChange?.(typedValue as any);
83
88
  if (onChange) {