@firecms/ui 3.0.0-canary.228 → 3.0.0-canary.231
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/components/Select.d.ts +2 -1
- package/dist/index.es.js +11 -9
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +11 -9
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Select.tsx +29 -26
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.
|
4
|
+
"version": "3.0.0-canary.231",
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
6
6
|
"funding": {
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
@@ -115,7 +115,7 @@
|
|
115
115
|
"index.css",
|
116
116
|
"tailwind.config.js"
|
117
117
|
],
|
118
|
-
"gitHead": "
|
118
|
+
"gitHead": "c38a44b87565537d51e654a0565b0921c933c55e",
|
119
119
|
"publishConfig": {
|
120
120
|
"access": "public"
|
121
121
|
}
|
@@ -41,30 +41,30 @@ export type SelectProps<T extends SelectValue = string> = {
|
|
41
41
|
};
|
42
42
|
|
43
43
|
export const Select = forwardRef<HTMLDivElement, SelectProps>(({
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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) => {
|
68
68
|
|
69
69
|
const [openInternal, setOpenInternal] = useState(open ?? false);
|
70
70
|
|
@@ -77,7 +77,7 @@ export const Select = forwardRef<HTMLDivElement, SelectProps>(({
|
|
77
77
|
let typedValue: SelectValue = newValue;
|
78
78
|
if (newValue === "true") typedValue = true;
|
79
79
|
else if (newValue === "false") typedValue = false;
|
80
|
-
else if (!isNaN(Number(newValue)) && newValue.trim() !==
|
80
|
+
else if (!isNaN(Number(newValue)) && newValue.trim() !== "") typedValue = Number(newValue);
|
81
81
|
|
82
82
|
onValueChange?.(typedValue as any);
|
83
83
|
if (onChange) {
|
@@ -228,13 +228,15 @@ export type SelectItemProps<T extends SelectValue = string> = {
|
|
228
228
|
children?: React.ReactNode,
|
229
229
|
disabled?: boolean,
|
230
230
|
className?: string,
|
231
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void
|
231
232
|
};
|
232
233
|
|
233
234
|
export function SelectItem<T extends SelectValue = string>({
|
234
235
|
value,
|
235
236
|
children,
|
236
237
|
disabled,
|
237
|
-
className
|
238
|
+
className,
|
239
|
+
onClick
|
238
240
|
}: SelectItemProps<T>) {
|
239
241
|
// Convert value to string for Radix UI
|
240
242
|
const stringValue = String(value);
|
@@ -243,6 +245,7 @@ export function SelectItem<T extends SelectValue = string>({
|
|
243
245
|
key={stringValue}
|
244
246
|
value={stringValue}
|
245
247
|
disabled={disabled}
|
248
|
+
onClick={onClick}
|
246
249
|
className={cls(
|
247
250
|
"w-full",
|
248
251
|
"relative flex items-center p-2 rounded-md text-sm text-surface-accent-700 dark:text-surface-accent-300",
|