@codefast/ui 0.3.16-canary.3 → 0.4.0-canary.4
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/CHANGELOG.md +60 -0
- package/README.md +27 -16
- package/dist/components/accordion.d.mts +7 -22
- package/dist/components/accordion.mjs +26 -29
- package/dist/components/alert-dialog.d.mts +27 -26
- package/dist/components/alert-dialog.mjs +53 -45
- package/dist/components/alert.d.mts +12 -2
- package/dist/components/alert.mjs +15 -6
- package/dist/components/aspect-ratio.d.mts +2 -2
- package/dist/components/aspect-ratio.mjs +2 -3
- package/dist/components/avatar.d.mts +41 -5
- package/dist/components/avatar.mjs +40 -10
- package/dist/components/badge.mjs +4 -4
- package/dist/components/breadcrumb.d.mts +1 -0
- package/dist/components/breadcrumb.mjs +11 -10
- package/dist/components/button-group.d.mts +1 -1
- package/dist/components/button-group.mjs +6 -7
- package/dist/components/button.d.mts +0 -1
- package/dist/components/button.mjs +7 -7
- package/dist/components/calendar.d.mts +6 -2
- package/dist/components/calendar.mjs +39 -43
- package/dist/components/card.d.mts +4 -2
- package/dist/components/card.mjs +9 -9
- package/dist/components/carousel.d.mts +16 -4
- package/dist/components/carousel.mjs +24 -11
- package/dist/components/chart.d.mts +8 -3
- package/dist/components/chart.mjs +21 -15
- package/dist/components/checkbox-cards.mjs +4 -4
- package/dist/components/checkbox-group.mjs +3 -4
- package/dist/components/checkbox.d.mts +2 -2
- package/dist/components/checkbox.mjs +6 -7
- package/dist/components/collapsible.d.mts +4 -4
- package/dist/components/collapsible.mjs +4 -5
- package/dist/components/command.d.mts +11 -1
- package/dist/components/command.mjs +35 -32
- package/dist/components/context-menu.d.mts +22 -15
- package/dist/components/context-menu.mjs +44 -39
- package/dist/components/dialog.d.mts +19 -23
- package/dist/components/dialog.mjs +48 -47
- package/dist/components/direction.d.mts +24 -0
- package/dist/components/direction.mjs +18 -0
- package/dist/components/drawer.d.mts +2 -20
- package/dist/components/drawer.mjs +17 -25
- package/dist/components/dropdown-menu.d.mts +22 -15
- package/dist/components/dropdown-menu.mjs +41 -37
- package/dist/components/empty.mjs +5 -5
- package/dist/components/field.d.mts +1 -1
- package/dist/components/field.mjs +11 -12
- package/dist/components/form.d.mts +6 -7
- package/dist/components/form.mjs +6 -7
- package/dist/components/hover-card.d.mts +5 -5
- package/dist/components/hover-card.mjs +14 -12
- package/dist/components/input-group.d.mts +1 -1
- package/dist/components/input-group.mjs +12 -7
- package/dist/components/input-number.d.mts +3 -1
- package/dist/components/input-number.mjs +49 -27
- package/dist/components/input-otp.mjs +9 -7
- package/dist/components/input-password.mjs +1 -4
- package/dist/components/input-search.mjs +3 -5
- package/dist/components/input.mjs +1 -2
- package/dist/components/item.mjs +9 -9
- package/dist/components/kbd.mjs +1 -1
- package/dist/components/label.d.mts +2 -2
- package/dist/components/label.mjs +3 -4
- package/dist/components/menubar.d.mts +22 -16
- package/dist/components/menubar.mjs +54 -47
- package/dist/components/native-select.d.mts +5 -1
- package/dist/components/native-select.mjs +9 -6
- package/dist/components/navigation-menu.d.mts +30 -8
- package/dist/components/navigation-menu.mjs +33 -23
- package/dist/components/pagination.d.mts +6 -0
- package/dist/components/pagination.mjs +26 -11
- package/dist/components/popover.d.mts +40 -7
- package/dist/components/popover.mjs +46 -14
- package/dist/components/progress-circle.d.mts +1 -1
- package/dist/components/progress-circle.mjs +1 -2
- package/dist/components/progress.d.mts +2 -2
- package/dist/components/progress.mjs +5 -6
- package/dist/components/radio-cards.d.mts +3 -3
- package/dist/components/radio-cards.mjs +11 -11
- package/dist/components/radio-group.d.mts +3 -3
- package/dist/components/radio-group.mjs +9 -9
- package/dist/components/radio.mjs +2 -3
- package/dist/components/resizable.mjs +3 -8
- package/dist/components/scroll-area.d.mts +5 -5
- package/dist/components/scroll-area.mjs +13 -10
- package/dist/components/select.d.mts +14 -14
- package/dist/components/select.mjs +47 -47
- package/dist/components/separator.d.mts +2 -2
- package/dist/components/separator.mjs +3 -4
- package/dist/components/sheet.d.mts +13 -14
- package/dist/components/sheet.mjs +41 -39
- package/dist/components/sidebar.d.mts +2 -3
- package/dist/components/sidebar.mjs +46 -46
- package/dist/components/skeleton.mjs +1 -1
- package/dist/components/slider.d.mts +2 -2
- package/dist/components/slider.mjs +9 -11
- package/dist/components/sonner.mjs +11 -3
- package/dist/components/spinner.mjs +6 -7
- package/dist/components/switch.d.mts +5 -2
- package/dist/components/switch.mjs +7 -7
- package/dist/components/table.mjs +10 -10
- package/dist/components/tabs.d.mts +8 -5
- package/dist/components/tabs.mjs +18 -12
- package/dist/components/textarea.mjs +1 -1
- package/dist/components/toggle-group.d.mts +9 -6
- package/dist/components/toggle-group.mjs +19 -20
- package/dist/components/toggle.d.mts +2 -3
- package/dist/components/toggle.mjs +4 -6
- package/dist/components/tooltip.d.mts +7 -6
- package/dist/components/tooltip.mjs +19 -17
- package/dist/hooks/use-animated-value.mjs +0 -1
- package/dist/hooks/use-copy-to-clipboard.mjs +0 -1
- package/dist/hooks/use-is-mobile.mjs +0 -1
- package/dist/hooks/use-media-query.mjs +0 -1
- package/dist/hooks/use-mutation-observer.mjs +0 -1
- package/dist/hooks/use-pagination.mjs +0 -1
- package/dist/index.d.mts +15 -13
- package/dist/index.mjs +18 -16
- package/dist/primitives/checkbox-group.d.mts +9 -10
- package/dist/primitives/checkbox-group.mjs +14 -19
- package/dist/primitives/input-number.d.mts +3 -3
- package/dist/primitives/input-number.mjs +3 -5
- package/dist/primitives/input.d.mts +4 -4
- package/dist/primitives/input.mjs +2 -3
- package/dist/primitives/progress-circle.d.mts +3 -3
- package/dist/primitives/progress-circle.mjs +2 -3
- package/dist/variants/alert.d.mts +1 -1
- package/dist/variants/alert.mjs +3 -13
- package/dist/variants/badge.d.mts +6 -4
- package/dist/variants/badge.mjs +7 -34
- package/dist/variants/button-group.d.mts +2 -2
- package/dist/variants/button-group.mjs +3 -14
- package/dist/variants/button.d.mts +12 -10
- package/dist/variants/button.mjs +15 -57
- package/dist/variants/empty.d.mts +1 -1
- package/dist/variants/empty.mjs +2 -7
- package/dist/variants/field.d.mts +3 -3
- package/dist/variants/field.mjs +4 -22
- package/dist/variants/input-group.d.mts +9 -9
- package/dist/variants/input-group.mjs +11 -70
- package/dist/variants/input-number.d.mts +45 -0
- package/dist/variants/input-number.mjs +40 -0
- package/dist/variants/item.d.mts +5 -4
- package/dist/variants/item.mjs +9 -31
- package/dist/variants/navigation-menu.d.mts +1 -1
- package/dist/variants/navigation-menu.mjs +1 -5
- package/dist/variants/progress-circle.d.mts +1 -1
- package/dist/variants/progress-circle.mjs +1 -5
- package/dist/variants/scroll-area.d.mts +2 -2
- package/dist/variants/scroll-area.mjs +3 -8
- package/dist/variants/separator.mjs +6 -6
- package/dist/variants/sheet.d.mts +4 -4
- package/dist/variants/sheet.mjs +5 -38
- package/dist/variants/sidebar.d.mts +4 -4
- package/dist/variants/sidebar.mjs +6 -23
- package/dist/variants/tabs.d.mts +18 -0
- package/dist/variants/tabs.mjs +15 -0
- package/dist/variants/toggle.d.mts +4 -4
- package/dist/variants/toggle.mjs +9 -27
- package/package.json +27 -44
- package/src/components/accordion.tsx +26 -68
- package/src/components/alert-dialog.tsx +70 -86
- package/src/components/alert.tsx +27 -19
- package/src/components/aspect-ratio.tsx +1 -4
- package/src/components/avatar.tsx +99 -12
- package/src/components/badge.tsx +5 -8
- package/src/components/breadcrumb.tsx +18 -24
- package/src/components/button-group.tsx +10 -20
- package/src/components/button.tsx +8 -19
- package/src/components/calendar.tsx +77 -132
- package/src/components/card.tsx +16 -22
- package/src/components/carousel.tsx +38 -56
- package/src/components/chart.tsx +41 -92
- package/src/components/checkbox-cards.tsx +10 -30
- package/src/components/checkbox-group.tsx +5 -28
- package/src/components/checkbox.tsx +5 -26
- package/src/components/collapsible.tsx +1 -4
- package/src/components/command.tsx +52 -65
- package/src/components/context-menu.tsx +46 -125
- package/src/components/dialog.tsx +49 -101
- package/src/components/direction.tsx +32 -0
- package/src/components/drawer.tsx +17 -79
- package/src/components/dropdown-menu.tsx +39 -118
- package/src/components/empty.tsx +6 -20
- package/src/components/field.tsx +19 -52
- package/src/components/form.tsx +19 -61
- package/src/components/hover-card.tsx +4 -27
- package/src/components/input-group.tsx +13 -52
- package/src/components/input-number.tsx +55 -75
- package/src/components/input-otp.tsx +19 -38
- package/src/components/input-password.tsx +5 -29
- package/src/components/input-search.tsx +6 -23
- package/src/components/input.tsx +1 -17
- package/src/components/item.tsx +17 -31
- package/src/components/kbd.tsx +2 -14
- package/src/components/label.tsx +2 -10
- package/src/components/menubar.tsx +34 -125
- package/src/components/native-select.tsx +21 -30
- package/src/components/navigation-menu.tsx +34 -94
- package/src/components/pagination.tsx +28 -34
- package/src/components/popover.tsx +66 -35
- package/src/components/progress-circle.tsx +7 -25
- package/src/components/progress.tsx +3 -16
- package/src/components/radio-cards.tsx +8 -27
- package/src/components/radio-group.tsx +7 -27
- package/src/components/radio.tsx +3 -24
- package/src/components/resizable.tsx +5 -26
- package/src/components/scroll-area.tsx +12 -32
- package/src/components/select.tsx +36 -59
- package/src/components/separator.tsx +4 -18
- package/src/components/sheet.tsx +37 -74
- package/src/components/sidebar.tsx +47 -177
- package/src/components/skeleton.tsx +1 -3
- package/src/components/slider.tsx +7 -36
- package/src/components/sonner.tsx +16 -6
- package/src/components/spinner.tsx +6 -15
- package/src/components/switch.tsx +8 -30
- package/src/components/table.tsx +18 -35
- package/src/components/tabs.tsx +16 -34
- package/src/components/textarea.tsx +1 -15
- package/src/components/toggle-group.tsx +34 -38
- package/src/components/toggle.tsx +4 -13
- package/src/components/tooltip.tsx +11 -37
- package/src/css/foundation/base.css +50 -0
- package/src/css/foundation/motion.css +36 -0
- package/src/css/foundation/source.css +3 -0
- package/src/css/foundation/tokens.css +71 -0
- package/src/css/foundation/variants.css +113 -0
- package/src/css/preset.css +5 -214
- package/src/css/style.css +1 -1
- package/src/hooks/use-animated-value.ts +1 -7
- package/src/hooks/use-copy-to-clipboard.ts +1 -6
- package/src/hooks/use-is-mobile.ts +0 -2
- package/src/hooks/use-media-query.ts +0 -2
- package/src/hooks/use-mutation-observer.ts +0 -3
- package/src/hooks/use-pagination.ts +0 -2
- package/src/index.ts +39 -80
- package/src/primitives/checkbox-group.tsx +25 -39
- package/src/primitives/input-number.tsx +17 -63
- package/src/primitives/input.tsx +8 -24
- package/src/primitives/progress-circle.tsx +13 -43
- package/src/variants/alert.ts +3 -14
- package/src/variants/badge.ts +8 -35
- package/src/variants/button-group.ts +5 -18
- package/src/variants/button.ts +21 -58
- package/src/variants/empty.ts +2 -11
- package/src/variants/field.ts +6 -19
- package/src/variants/input-group.ts +12 -64
- package/src/variants/input-number.ts +65 -0
- package/src/variants/item.ts +10 -32
- package/src/variants/navigation-menu.ts +1 -8
- package/src/variants/progress-circle.ts +1 -2
- package/src/variants/scroll-area.ts +3 -9
- package/src/variants/separator.ts +6 -7
- package/src/variants/sheet.ts +6 -39
- package/src/variants/sidebar.ts +7 -27
- package/src/variants/tabs.ts +34 -0
- package/src/variants/toggle.ts +9 -28
- /package/src/css/{amber.css → themes/amber.css} +0 -0
- /package/src/css/{blue.css → themes/blue.css} +0 -0
- /package/src/css/{cyan.css → themes/cyan.css} +0 -0
- /package/src/css/{emerald.css → themes/emerald.css} +0 -0
- /package/src/css/{fuchsia.css → themes/fuchsia.css} +0 -0
- /package/src/css/{gray.css → themes/gray.css} +0 -0
- /package/src/css/{green.css → themes/green.css} +0 -0
- /package/src/css/{indigo.css → themes/indigo.css} +0 -0
- /package/src/css/{lime.css → themes/lime.css} +0 -0
- /package/src/css/{neutral.css → themes/neutral.css} +0 -0
- /package/src/css/{orange.css → themes/orange.css} +0 -0
- /package/src/css/{pink.css → themes/pink.css} +0 -0
- /package/src/css/{purple.css → themes/purple.css} +0 -0
- /package/src/css/{red.css → themes/red.css} +0 -0
- /package/src/css/{rose.css → themes/rose.css} +0 -0
- /package/src/css/{sky.css → themes/sky.css} +0 -0
- /package/src/css/{slate.css → themes/slate.css} +0 -0
- /package/src/css/{stone.css → themes/stone.css} +0 -0
- /package/src/css/{teal.css → themes/teal.css} +0 -0
- /package/src/css/{violet.css → themes/violet.css} +0 -0
- /package/src/css/{yellow.css → themes/yellow.css} +0 -0
- /package/src/css/{zinc.css → themes/zinc.css} +0 -0
package/src/index.ts
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
Accordion,
|
|
3
|
-
AccordionContent,
|
|
4
|
-
AccordionIcon,
|
|
5
|
-
AccordionItem,
|
|
6
|
-
AccordionTrigger,
|
|
7
|
-
} from "#/components/accordion";
|
|
1
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "#/components/accordion";
|
|
8
2
|
export type {
|
|
9
3
|
AccordionContentProps,
|
|
10
|
-
AccordionIconProps,
|
|
11
4
|
AccordionItemProps,
|
|
12
5
|
AccordionProps,
|
|
13
6
|
AccordionTriggerProps,
|
|
14
7
|
} from "#/components/accordion";
|
|
15
|
-
export { Alert, AlertDescription, AlertTitle } from "#/components/alert";
|
|
16
|
-
export type { AlertDescriptionProps, AlertProps, AlertTitleProps } from "#/components/alert";
|
|
8
|
+
export { Alert, AlertAction, AlertDescription, AlertTitle } from "#/components/alert";
|
|
9
|
+
export type { AlertActionProps, AlertDescriptionProps, AlertProps, AlertTitleProps } from "#/components/alert";
|
|
17
10
|
export {
|
|
18
11
|
AlertDialog,
|
|
19
12
|
AlertDialogAction,
|
|
@@ -23,6 +16,7 @@ export {
|
|
|
23
16
|
AlertDialogDescription,
|
|
24
17
|
AlertDialogFooter,
|
|
25
18
|
AlertDialogHeader,
|
|
19
|
+
AlertDialogMedia,
|
|
26
20
|
AlertDialogTitle,
|
|
27
21
|
AlertDialogTrigger,
|
|
28
22
|
} from "#/components/alert-dialog";
|
|
@@ -34,22 +28,26 @@ export type {
|
|
|
34
28
|
AlertDialogDescriptionProps,
|
|
35
29
|
AlertDialogFooterProps,
|
|
36
30
|
AlertDialogHeaderProps,
|
|
31
|
+
AlertDialogMediaProps,
|
|
37
32
|
AlertDialogProps,
|
|
38
33
|
AlertDialogTitleProps,
|
|
39
34
|
AlertDialogTriggerProps,
|
|
40
35
|
} from "#/components/alert-dialog";
|
|
41
36
|
export { AspectRatio } from "#/components/aspect-ratio";
|
|
42
37
|
export type { AspectRatioProps } from "#/components/aspect-ratio";
|
|
43
|
-
export { Avatar, AvatarFallback, AvatarImage } from "#/components/avatar";
|
|
44
|
-
export type {
|
|
38
|
+
export { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage } from "#/components/avatar";
|
|
39
|
+
export type {
|
|
40
|
+
AvatarBadgeProps,
|
|
41
|
+
AvatarFallbackProps,
|
|
42
|
+
AvatarGroupCountProps,
|
|
43
|
+
AvatarGroupProps,
|
|
44
|
+
AvatarImageProps,
|
|
45
|
+
AvatarProps,
|
|
46
|
+
} from "#/components/avatar";
|
|
45
47
|
export { Badge } from "#/components/badge";
|
|
46
48
|
export type { BadgeProps } from "#/components/badge";
|
|
47
49
|
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText } from "#/components/button-group";
|
|
48
|
-
export type {
|
|
49
|
-
ButtonGroupProps,
|
|
50
|
-
ButtonGroupSeparatorProps,
|
|
51
|
-
ButtonGroupTextProps,
|
|
52
|
-
} from "#/components/button-group";
|
|
50
|
+
export type { ButtonGroupProps, ButtonGroupSeparatorProps, ButtonGroupTextProps } from "#/components/button-group";
|
|
53
51
|
export {
|
|
54
52
|
Breadcrumb,
|
|
55
53
|
BreadcrumbEllipsis,
|
|
@@ -71,15 +69,7 @@ export type {
|
|
|
71
69
|
export { Button } from "#/components/button";
|
|
72
70
|
export type { ButtonProps } from "#/components/button";
|
|
73
71
|
export { Calendar, CalendarDayButton } from "#/components/calendar";
|
|
74
|
-
export {
|
|
75
|
-
Card,
|
|
76
|
-
CardAction,
|
|
77
|
-
CardContent,
|
|
78
|
-
CardDescription,
|
|
79
|
-
CardFooter,
|
|
80
|
-
CardHeader,
|
|
81
|
-
CardTitle,
|
|
82
|
-
} from "#/components/card";
|
|
72
|
+
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "#/components/card";
|
|
83
73
|
export type {
|
|
84
74
|
CardActionProps,
|
|
85
75
|
CardContentProps,
|
|
@@ -130,11 +120,7 @@ export type { CheckboxCardsItemProps, CheckboxCardsProps } from "#/components/ch
|
|
|
130
120
|
export { CheckboxGroup, CheckboxGroupItem } from "#/components/checkbox-group";
|
|
131
121
|
export type { CheckboxGroupItemProps, CheckboxGroupProps } from "#/components/checkbox-group";
|
|
132
122
|
export { Collapsible, CollapsibleContent, CollapsibleTrigger } from "#/components/collapsible";
|
|
133
|
-
export type {
|
|
134
|
-
CollapsibleContentProps,
|
|
135
|
-
CollapsibleProps,
|
|
136
|
-
CollapsibleTriggerProps,
|
|
137
|
-
} from "#/components/collapsible";
|
|
123
|
+
export type { CollapsibleContentProps, CollapsibleProps, CollapsibleTriggerProps } from "#/components/collapsible";
|
|
138
124
|
export {
|
|
139
125
|
Command,
|
|
140
126
|
CommandDialog,
|
|
@@ -215,9 +201,10 @@ export type {
|
|
|
215
201
|
DialogTitleProps,
|
|
216
202
|
DialogTriggerProps,
|
|
217
203
|
} from "#/components/dialog";
|
|
204
|
+
export { DirectionProvider, useDirection } from "#/components/direction";
|
|
205
|
+
export type { DirectionProviderProps } from "#/components/direction";
|
|
218
206
|
export {
|
|
219
207
|
Drawer,
|
|
220
|
-
DrawerBody,
|
|
221
208
|
DrawerClose,
|
|
222
209
|
DrawerContent,
|
|
223
210
|
DrawerDescription,
|
|
@@ -227,7 +214,6 @@ export {
|
|
|
227
214
|
DrawerTrigger,
|
|
228
215
|
} from "#/components/drawer";
|
|
229
216
|
export type {
|
|
230
|
-
DrawerBodyProps,
|
|
231
217
|
DrawerCloseProps,
|
|
232
218
|
DrawerContentProps,
|
|
233
219
|
DrawerDescriptionProps,
|
|
@@ -271,14 +257,7 @@ export type {
|
|
|
271
257
|
DropdownMenuSubTriggerProps,
|
|
272
258
|
DropdownMenuTriggerProps,
|
|
273
259
|
} from "#/components/dropdown-menu";
|
|
274
|
-
export {
|
|
275
|
-
Empty,
|
|
276
|
-
EmptyContent,
|
|
277
|
-
EmptyDescription,
|
|
278
|
-
EmptyHeader,
|
|
279
|
-
EmptyMedia,
|
|
280
|
-
EmptyTitle,
|
|
281
|
-
} from "#/components/empty";
|
|
260
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "#/components/empty";
|
|
282
261
|
export type {
|
|
283
262
|
EmptyContentProps,
|
|
284
263
|
EmptyDescriptionProps,
|
|
@@ -330,12 +309,7 @@ export type {
|
|
|
330
309
|
FormMessageProps,
|
|
331
310
|
FormProps,
|
|
332
311
|
} from "#/components/form";
|
|
333
|
-
export {
|
|
334
|
-
HoverCard,
|
|
335
|
-
HoverCardArrow,
|
|
336
|
-
HoverCardContent,
|
|
337
|
-
HoverCardTrigger,
|
|
338
|
-
} from "#/components/hover-card";
|
|
312
|
+
export { HoverCard, HoverCardArrow, HoverCardContent, HoverCardTrigger } from "#/components/hover-card";
|
|
339
313
|
export type {
|
|
340
314
|
HoverCardArrowProps,
|
|
341
315
|
HoverCardContentProps,
|
|
@@ -448,25 +422,25 @@ export type {
|
|
|
448
422
|
export {
|
|
449
423
|
NavigationMenu,
|
|
450
424
|
NavigationMenuContent,
|
|
425
|
+
NavigationMenuIndicator,
|
|
451
426
|
NavigationMenuItem,
|
|
452
427
|
NavigationMenuLink,
|
|
453
428
|
NavigationMenuList,
|
|
454
429
|
NavigationMenuTrigger,
|
|
430
|
+
NavigationMenuViewport,
|
|
455
431
|
} from "#/components/navigation-menu";
|
|
456
432
|
export type {
|
|
457
433
|
NavigationMenuContentProps,
|
|
434
|
+
NavigationMenuIndicatorProps,
|
|
458
435
|
NavigationMenuItemProps,
|
|
459
436
|
NavigationMenuLinkProps,
|
|
460
437
|
NavigationMenuListProps,
|
|
461
438
|
NavigationMenuProps,
|
|
462
439
|
NavigationMenuTriggerProps,
|
|
440
|
+
NavigationMenuViewportProps,
|
|
463
441
|
} from "#/components/navigation-menu";
|
|
464
442
|
export { NativeSelect, NativeSelectOptGroup, NativeSelectOption } from "#/components/native-select";
|
|
465
|
-
export type {
|
|
466
|
-
NativeSelectOptGroupProps,
|
|
467
|
-
NativeSelectOptionProps,
|
|
468
|
-
NativeSelectProps,
|
|
469
|
-
} from "#/components/native-select";
|
|
443
|
+
export type { NativeSelectOptGroupProps, NativeSelectOptionProps, NativeSelectProps } from "#/components/native-select";
|
|
470
444
|
export {
|
|
471
445
|
Pagination,
|
|
472
446
|
PaginationContent,
|
|
@@ -490,13 +464,19 @@ export {
|
|
|
490
464
|
PopoverAnchor,
|
|
491
465
|
PopoverArrow,
|
|
492
466
|
PopoverContent,
|
|
467
|
+
PopoverDescription,
|
|
468
|
+
PopoverHeader,
|
|
469
|
+
PopoverTitle,
|
|
493
470
|
PopoverTrigger,
|
|
494
471
|
} from "#/components/popover";
|
|
495
472
|
export type {
|
|
496
473
|
PopoverAnchorProps,
|
|
497
474
|
PopoverArrowProps,
|
|
498
475
|
PopoverContentProps,
|
|
476
|
+
PopoverDescriptionProps,
|
|
477
|
+
PopoverHeaderProps,
|
|
499
478
|
PopoverProps,
|
|
479
|
+
PopoverTitleProps,
|
|
500
480
|
PopoverTriggerProps,
|
|
501
481
|
} from "#/components/popover";
|
|
502
482
|
export { Progress } from "#/components/progress";
|
|
@@ -510,11 +490,7 @@ export type { RadioCardsItemProps, RadioCardsProps } from "#/components/radio-ca
|
|
|
510
490
|
export { RadioGroup, RadioGroupItem } from "#/components/radio-group";
|
|
511
491
|
export type { RadioGroupItemProps, RadioGroupProps } from "#/components/radio-group";
|
|
512
492
|
export { ResizableGroup, ResizablePanel, ResizableSeparator } from "#/components/resizable";
|
|
513
|
-
export type {
|
|
514
|
-
ResizableGroupProps,
|
|
515
|
-
ResizablePanelProps,
|
|
516
|
-
ResizableSeparatorProps,
|
|
517
|
-
} from "#/components/resizable";
|
|
493
|
+
export type { ResizableGroupProps, ResizablePanelProps, ResizableSeparatorProps } from "#/components/resizable";
|
|
518
494
|
export { ScrollArea, ScrollAreaScrollbar } from "#/components/scroll-area";
|
|
519
495
|
export type { ScrollAreaProps, ScrollAreaScrollbarProps } from "#/components/scroll-area";
|
|
520
496
|
export {
|
|
@@ -647,25 +623,14 @@ export type {
|
|
|
647
623
|
TableRowProps,
|
|
648
624
|
} from "#/components/table";
|
|
649
625
|
export { Tabs, TabsContent, TabsList, TabsTrigger } from "#/components/tabs";
|
|
650
|
-
export type {
|
|
651
|
-
TabsContentProps,
|
|
652
|
-
TabsListProps,
|
|
653
|
-
TabsProps,
|
|
654
|
-
TabsTriggerProps,
|
|
655
|
-
} from "#/components/tabs";
|
|
626
|
+
export type { TabsContentProps, TabsListProps, TabsProps, TabsTriggerProps } from "#/components/tabs";
|
|
656
627
|
export { Textarea } from "#/components/textarea";
|
|
657
628
|
export type { TextareaProps } from "#/components/textarea";
|
|
658
629
|
export { Toggle } from "#/components/toggle";
|
|
659
630
|
export type { ToggleProps } from "#/components/toggle";
|
|
660
631
|
export { ToggleGroup, ToggleGroupItem } from "#/components/toggle-group";
|
|
661
632
|
export type { ToggleGroupItemProps, ToggleGroupProps } from "#/components/toggle-group";
|
|
662
|
-
export {
|
|
663
|
-
Tooltip,
|
|
664
|
-
TooltipArrow,
|
|
665
|
-
TooltipContent,
|
|
666
|
-
TooltipProvider,
|
|
667
|
-
TooltipTrigger,
|
|
668
|
-
} from "#/components/tooltip";
|
|
633
|
+
export { Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger } from "#/components/tooltip";
|
|
669
634
|
export type {
|
|
670
635
|
TooltipArrowProps,
|
|
671
636
|
TooltipContentProps,
|
|
@@ -692,16 +657,8 @@ export { emptyMediaVariants } from "#/variants/empty";
|
|
|
692
657
|
export type { EmptyMediaVariants } from "#/variants/empty";
|
|
693
658
|
export { fieldVariants } from "#/variants/field";
|
|
694
659
|
export type { FieldVariants } from "#/variants/field";
|
|
695
|
-
export {
|
|
696
|
-
|
|
697
|
-
inputGroupButtonVariants,
|
|
698
|
-
inputGroupVariants,
|
|
699
|
-
} from "#/variants/input-group";
|
|
700
|
-
export type {
|
|
701
|
-
InputGroupAddonVariants,
|
|
702
|
-
InputGroupButtonVariants,
|
|
703
|
-
InputGroupVariants,
|
|
704
|
-
} from "#/variants/input-group";
|
|
660
|
+
export { inputGroupAddonVariants, inputGroupButtonVariants, inputGroupVariants } from "#/variants/input-group";
|
|
661
|
+
export type { InputGroupAddonVariants, InputGroupButtonVariants, InputGroupVariants } from "#/variants/input-group";
|
|
705
662
|
export { itemMediaVariants, itemVariants } from "#/variants/item";
|
|
706
663
|
export type { ItemMediaVariants, ItemVariants } from "#/variants/item";
|
|
707
664
|
export { navigationMenuTriggerVariants } from "#/variants/navigation-menu";
|
|
@@ -716,5 +673,7 @@ export { sheetContentVariants } from "#/variants/sheet";
|
|
|
716
673
|
export type { SheetContentVariants } from "#/variants/sheet";
|
|
717
674
|
export { sidebarMenuButtonVariants } from "#/variants/sidebar";
|
|
718
675
|
export type { SidebarMenuButtonVariants } from "#/variants/sidebar";
|
|
676
|
+
export { tabsListVariants } from "#/variants/tabs";
|
|
677
|
+
export type { TabsListVariants } from "#/variants/tabs";
|
|
719
678
|
export { toggleVariants } from "#/variants/toggle";
|
|
720
679
|
export type { ToggleVariants } from "#/variants/toggle";
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Checkbox as CheckboxPrimitive } from "radix-ui";
|
|
2
|
+
import { Checkbox } from "radix-ui";
|
|
3
|
+
import { Direction } from "radix-ui";
|
|
4
|
+
import { Context } from "radix-ui/internal";
|
|
5
|
+
import { RovingFocus } from "radix-ui/internal";
|
|
6
|
+
import { useControllableState } from "radix-ui/internal";
|
|
2
7
|
import type { ComponentProps, JSX } from "react";
|
|
3
|
-
|
|
4
|
-
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
5
|
-
import { createCheckboxScope } from "@radix-ui/react-checkbox";
|
|
6
|
-
import { createContextScope } from "@radix-ui/react-context";
|
|
7
|
-
import { useDirection } from "@radix-ui/react-direction";
|
|
8
|
-
import * as RovingFocusGroup from "@radix-ui/react-roving-focus";
|
|
9
|
-
import { createRovingFocusGroupScope } from "@radix-ui/react-roving-focus";
|
|
10
|
-
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
11
8
|
import { useCallback } from "react";
|
|
12
9
|
|
|
13
10
|
/* -----------------------------------------------------------------------------
|
|
@@ -23,16 +20,16 @@ type ScopedProps<P> = P & {
|
|
|
23
20
|
/**
|
|
24
21
|
* Optional scope for the CheckboxGroup component
|
|
25
22
|
*/
|
|
26
|
-
__scopeCheckboxGroup?: Scope;
|
|
23
|
+
__scopeCheckboxGroup?: Context.Scope;
|
|
27
24
|
};
|
|
28
25
|
|
|
29
|
-
const [createCheckboxGroupContext, createCheckboxGroupScope] = createContextScope(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
);
|
|
26
|
+
const [createCheckboxGroupContext, createCheckboxGroupScope] = Context.createContextScope(CHECKBOX_GROUP_NAME, [
|
|
27
|
+
RovingFocus.createRovingFocusGroupScope,
|
|
28
|
+
Checkbox.createCheckboxScope,
|
|
29
|
+
]);
|
|
33
30
|
|
|
34
|
-
const useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
35
|
-
const useCheckboxScope = createCheckboxScope();
|
|
31
|
+
const useRovingFocusGroupScope = RovingFocus.createRovingFocusGroupScope();
|
|
32
|
+
const useCheckboxScope = Checkbox.createCheckboxScope();
|
|
36
33
|
|
|
37
34
|
/**
|
|
38
35
|
* Context values shared between CheckboxGroup components
|
|
@@ -90,7 +87,7 @@ interface CheckboxGroupBaseProps {
|
|
|
90
87
|
/**
|
|
91
88
|
* Direction for roving focus navigation
|
|
92
89
|
*/
|
|
93
|
-
dir?:
|
|
90
|
+
dir?: RovingFocus.RovingFocusGroupProps["dir"];
|
|
94
91
|
|
|
95
92
|
/**
|
|
96
93
|
* Whether the entire checkbox group is disabled
|
|
@@ -100,7 +97,7 @@ interface CheckboxGroupBaseProps {
|
|
|
100
97
|
/**
|
|
101
98
|
* Whether focus should loop to the start/end when reaching the boundaries
|
|
102
99
|
*/
|
|
103
|
-
loop?:
|
|
100
|
+
loop?: RovingFocus.RovingFocusGroupProps["loop"];
|
|
104
101
|
|
|
105
102
|
/**
|
|
106
103
|
* Name attribute for the checkbox group form field
|
|
@@ -116,7 +113,7 @@ interface CheckboxGroupBaseProps {
|
|
|
116
113
|
/**
|
|
117
114
|
* Orientation of the checkbox group (horizontal or vertical)
|
|
118
115
|
*/
|
|
119
|
-
orientation?:
|
|
116
|
+
orientation?: RovingFocus.RovingFocusGroupProps["orientation"];
|
|
120
117
|
|
|
121
118
|
/**
|
|
122
119
|
* Whether at least one checkbox must be selected
|
|
@@ -155,14 +152,14 @@ function CheckboxGroup({
|
|
|
155
152
|
...props
|
|
156
153
|
}: ScopedProps<CheckboxGroupProps>): JSX.Element {
|
|
157
154
|
/**
|
|
158
|
-
* Scope for the RovingFocusGroup component
|
|
155
|
+
* Context.Scope for the RovingFocusGroup component
|
|
159
156
|
*/
|
|
160
157
|
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeCheckboxGroup);
|
|
161
158
|
|
|
162
159
|
/**
|
|
163
160
|
* Direction for layout and navigation
|
|
164
161
|
*/
|
|
165
|
-
const direction = useDirection(dir);
|
|
162
|
+
const direction = Direction.useDirection(dir);
|
|
166
163
|
|
|
167
164
|
/**
|
|
168
165
|
* State for managing selected checkbox values
|
|
@@ -215,15 +212,9 @@ function CheckboxGroup({
|
|
|
215
212
|
onItemCheck={handleItemCheck}
|
|
216
213
|
onItemUncheck={handleItemUncheck}
|
|
217
214
|
>
|
|
218
|
-
<
|
|
219
|
-
asChild
|
|
220
|
-
{...rovingFocusGroupScope}
|
|
221
|
-
dir={direction}
|
|
222
|
-
loop={loop}
|
|
223
|
-
orientation={orientation}
|
|
224
|
-
>
|
|
215
|
+
<RovingFocus.Root asChild {...rovingFocusGroupScope} dir={direction} loop={loop} orientation={orientation}>
|
|
225
216
|
<div data-disabled={disabled ? "" : undefined} dir={direction} role="group" {...props} />
|
|
226
|
-
</
|
|
217
|
+
</RovingFocus.Root>
|
|
227
218
|
</CheckboxGroupContextProvider>
|
|
228
219
|
);
|
|
229
220
|
}
|
|
@@ -274,12 +265,12 @@ function CheckboxGroupItem({
|
|
|
274
265
|
const isDisabled = context.disabled || disabled;
|
|
275
266
|
|
|
276
267
|
/**
|
|
277
|
-
* Scope for the RovingFocusGroup component
|
|
268
|
+
* Context.Scope for the RovingFocusGroup component
|
|
278
269
|
*/
|
|
279
270
|
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeCheckboxGroup);
|
|
280
271
|
|
|
281
272
|
/**
|
|
282
|
-
* Scope for the Checkbox component
|
|
273
|
+
* Context.Scope for the Checkbox component
|
|
283
274
|
*/
|
|
284
275
|
const checkboxScope = useCheckboxScope(__scopeCheckboxGroup);
|
|
285
276
|
|
|
@@ -289,12 +280,7 @@ function CheckboxGroupItem({
|
|
|
289
280
|
const checked = context.value?.includes(props.value);
|
|
290
281
|
|
|
291
282
|
return (
|
|
292
|
-
<
|
|
293
|
-
asChild
|
|
294
|
-
{...rovingFocusGroupScope}
|
|
295
|
-
active={checked}
|
|
296
|
-
focusable={!isDisabled}
|
|
297
|
-
>
|
|
283
|
+
<RovingFocus.Item asChild {...rovingFocusGroupScope} active={checked} focusable={!isDisabled}>
|
|
298
284
|
<CheckboxPrimitive.Root
|
|
299
285
|
aria-label={props.value}
|
|
300
286
|
checked={checked}
|
|
@@ -311,7 +297,7 @@ function CheckboxGroupItem({
|
|
|
311
297
|
}
|
|
312
298
|
}}
|
|
313
299
|
/>
|
|
314
|
-
</
|
|
300
|
+
</RovingFocus.Item>
|
|
315
301
|
);
|
|
316
302
|
}
|
|
317
303
|
|
|
@@ -336,7 +322,7 @@ function CheckboxGroupIndicator({
|
|
|
336
322
|
...props
|
|
337
323
|
}: ScopedProps<CheckboxGroupIndicatorProps>): JSX.Element {
|
|
338
324
|
/**
|
|
339
|
-
* Scope for the Checkbox component
|
|
325
|
+
* Context.Scope for the Checkbox component
|
|
340
326
|
*/
|
|
341
327
|
const checkboxScope = useCheckboxScope(__scopeCheckboxGroup);
|
|
342
328
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { composeEventHandlers } from "radix-ui/internal";
|
|
2
|
+
import { Context } from "radix-ui/internal";
|
|
3
|
+
import { useControllableState } from "radix-ui/internal";
|
|
2
4
|
import type {
|
|
3
5
|
ComponentProps,
|
|
4
6
|
FocusEventHandler,
|
|
@@ -9,10 +11,6 @@ import type {
|
|
|
9
11
|
PointerEventHandler,
|
|
10
12
|
RefObject,
|
|
11
13
|
} from "react";
|
|
12
|
-
|
|
13
|
-
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
14
|
-
import { createContextScope } from "@radix-ui/react-context";
|
|
15
|
-
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
16
14
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
17
15
|
|
|
18
16
|
import * as InputPrimitive from "#/primitives/input";
|
|
@@ -34,10 +32,10 @@ type ScopedProps<P> = P & {
|
|
|
34
32
|
/**
|
|
35
33
|
* Optional scope for the InputNumber component context
|
|
36
34
|
*/
|
|
37
|
-
__scopeInputNumber?: Scope;
|
|
35
|
+
__scopeInputNumber?: Context.Scope;
|
|
38
36
|
};
|
|
39
37
|
|
|
40
|
-
const [createInputNumberContext, createInputNumberScope] = createContextScope(NUMBER_INPUT_NAME, [
|
|
38
|
+
const [createInputNumberContext, createInputNumberScope] = Context.createContextScope(NUMBER_INPUT_NAME, [
|
|
41
39
|
createInputScope,
|
|
42
40
|
]);
|
|
43
41
|
const useInputScope = createInputScope();
|
|
@@ -232,7 +230,7 @@ function InputNumber(numberInputProps: ScopedProps<InputNumberProps>): JSX.Eleme
|
|
|
232
230
|
} = numberInputProps;
|
|
233
231
|
|
|
234
232
|
/**
|
|
235
|
-
* Scope for the input component
|
|
233
|
+
* Context.Scope for the input component
|
|
236
234
|
*/
|
|
237
235
|
const inputScope = useInputScope(__scopeInputNumber);
|
|
238
236
|
|
|
@@ -253,10 +251,7 @@ function InputNumber(numberInputProps: ScopedProps<InputNumberProps>): JSX.Eleme
|
|
|
253
251
|
/**
|
|
254
252
|
* Separators used for number formatting based on locale
|
|
255
253
|
*/
|
|
256
|
-
const { decimalSeparator, thousandSeparator } = useMemo(
|
|
257
|
-
() => getNumberFormatSeparators(locale),
|
|
258
|
-
[locale],
|
|
259
|
-
);
|
|
254
|
+
const { decimalSeparator, thousandSeparator } = useMemo(() => getNumberFormatSeparators(locale), [locale]);
|
|
260
255
|
|
|
261
256
|
/**
|
|
262
257
|
* Formats a number value into a string representation
|
|
@@ -295,11 +290,7 @@ function InputNumber(numberInputProps: ScopedProps<InputNumberProps>): JSX.Eleme
|
|
|
295
290
|
return Number.NaN;
|
|
296
291
|
}
|
|
297
292
|
|
|
298
|
-
const normalizedValue = normalizeInputValue(
|
|
299
|
-
cleanedValue,
|
|
300
|
-
thousandSeparator,
|
|
301
|
-
decimalSeparator,
|
|
302
|
-
);
|
|
293
|
+
const normalizedValue = normalizeInputValue(cleanedValue, thousandSeparator, decimalSeparator);
|
|
303
294
|
let parsedValue = Number.parseFloat(normalizedValue);
|
|
304
295
|
|
|
305
296
|
if (formatOptions.style === "percent") {
|
|
@@ -403,16 +394,7 @@ const NUMBER_INPUT_FIELD_NAME = "InputNumberField";
|
|
|
403
394
|
*/
|
|
404
395
|
type InputNumberFieldProps = Omit<
|
|
405
396
|
ComponentProps<typeof InputPrimitive.Field>,
|
|
406
|
-
| "
|
|
407
|
-
| "disabled"
|
|
408
|
-
| "id"
|
|
409
|
-
| "max"
|
|
410
|
-
| "min"
|
|
411
|
-
| "onChange"
|
|
412
|
-
| "prefix"
|
|
413
|
-
| "readOnly"
|
|
414
|
-
| "step"
|
|
415
|
-
| "value"
|
|
397
|
+
"defaultValue" | "disabled" | "id" | "max" | "min" | "onChange" | "prefix" | "readOnly" | "step" | "value"
|
|
416
398
|
>;
|
|
417
399
|
|
|
418
400
|
/**
|
|
@@ -595,10 +577,7 @@ function InputNumberField({
|
|
|
595
577
|
*/
|
|
596
578
|
const combinedKeyDownHandler = useCallback<KeyboardEventHandler<HTMLInputElement>>(
|
|
597
579
|
(event) => {
|
|
598
|
-
composeEventHandlers(
|
|
599
|
-
onKeyDown,
|
|
600
|
-
chain(handleKeyDownPrevent, handleKeyDown, handleKeyDownEnter),
|
|
601
|
-
)(event);
|
|
580
|
+
composeEventHandlers(onKeyDown, chain(handleKeyDownPrevent, handleKeyDown, handleKeyDownEnter))(event);
|
|
602
581
|
},
|
|
603
582
|
[onKeyDown, handleKeyDown, handleKeyDownEnter, handleKeyDownPrevent],
|
|
604
583
|
);
|
|
@@ -712,17 +691,8 @@ function NumberStepperButton({
|
|
|
712
691
|
...props
|
|
713
692
|
}: ScopedProps<NumberStepperButtonProps>): JSX.Element {
|
|
714
693
|
// Destructures relevant context values for the button functionality.
|
|
715
|
-
const {
|
|
716
|
-
|
|
717
|
-
ariaIncrementLabel,
|
|
718
|
-
disabled,
|
|
719
|
-
id,
|
|
720
|
-
max,
|
|
721
|
-
min,
|
|
722
|
-
onDecrement,
|
|
723
|
-
onIncrement,
|
|
724
|
-
value,
|
|
725
|
-
} = useInputNumberContext(NUMBER_STEPPER_BUTTON_NAME, __scopeInputNumber);
|
|
694
|
+
const { ariaDecrementLabel, ariaIncrementLabel, disabled, id, max, min, onDecrement, onIncrement, value } =
|
|
695
|
+
useInputNumberContext(NUMBER_STEPPER_BUTTON_NAME, __scopeInputNumber);
|
|
726
696
|
|
|
727
697
|
const isDisabled = useMemo(() => {
|
|
728
698
|
const atMin = min !== undefined && value !== undefined && value <= min;
|
|
@@ -829,10 +799,7 @@ function NumberStepperButton({
|
|
|
829
799
|
/**
|
|
830
800
|
* @since 0.3.16-canary.0
|
|
831
801
|
*/
|
|
832
|
-
type InputNumberIncrementButtonProps = Omit<
|
|
833
|
-
ComponentProps<typeof NumberStepperButton>,
|
|
834
|
-
"operation"
|
|
835
|
-
>;
|
|
802
|
+
type InputNumberIncrementButtonProps = Omit<ComponentProps<typeof NumberStepperButton>, "operation">;
|
|
836
803
|
|
|
837
804
|
/**
|
|
838
805
|
* @since 0.3.16-canary.0
|
|
@@ -848,10 +815,7 @@ function InputNumberIncrementButton(props: InputNumberIncrementButtonProps): JSX
|
|
|
848
815
|
/**
|
|
849
816
|
* @since 0.3.16-canary.0
|
|
850
817
|
*/
|
|
851
|
-
type InputNumberDecrementButtonProps = Omit<
|
|
852
|
-
ComponentProps<typeof NumberStepperButton>,
|
|
853
|
-
"operation"
|
|
854
|
-
>;
|
|
818
|
+
type InputNumberDecrementButtonProps = Omit<ComponentProps<typeof NumberStepperButton>, "operation">;
|
|
855
819
|
|
|
856
820
|
/**
|
|
857
821
|
* @since 0.3.16-canary.0
|
|
@@ -870,9 +834,7 @@ function InputNumberDecrementButton(props: InputNumberDecrementButtonProps): JSX
|
|
|
870
834
|
* @param callbacks - Array of callback functions that will be executed in order
|
|
871
835
|
* @returns A single function that executes all callbacks
|
|
872
836
|
*/
|
|
873
|
-
function chain<T extends Array<unknown>>(
|
|
874
|
-
...callbacks: Array<(...args: T) => void>
|
|
875
|
-
): (...args: T) => void {
|
|
837
|
+
function chain<T extends Array<unknown>>(...callbacks: Array<(...args: T) => void>): (...args: T) => void {
|
|
876
838
|
return (...args: T) => {
|
|
877
839
|
for (const callback of callbacks) {
|
|
878
840
|
callback(...args);
|
|
@@ -932,11 +894,7 @@ function getNumberFormatSeparators(locale?: string): NumberFormatSeparators {
|
|
|
932
894
|
* @param decimalSeparator - The decimal separator to convert to standard dot notation
|
|
933
895
|
* @returns Normalized string value ready for numeric conversion
|
|
934
896
|
*/
|
|
935
|
-
function normalizeInputValue(
|
|
936
|
-
value: string,
|
|
937
|
-
thousandSeparator: string,
|
|
938
|
-
decimalSeparator: string,
|
|
939
|
-
): string {
|
|
897
|
+
function normalizeInputValue(value: string, thousandSeparator: string, decimalSeparator: string): string {
|
|
940
898
|
return value
|
|
941
899
|
.replaceAll(new RegExp(`\\${thousandSeparator}`, "g"), "")
|
|
942
900
|
.replace(new RegExp(`\\${decimalSeparator}`), ".")
|
|
@@ -981,11 +939,7 @@ function isNumberKey(key: string): boolean {
|
|
|
981
939
|
* @param max - The maximum allowed value (defaults to Infinity)
|
|
982
940
|
* @returns The clamped value
|
|
983
941
|
*/
|
|
984
|
-
function clamp(
|
|
985
|
-
value: number,
|
|
986
|
-
min = Number.NEGATIVE_INFINITY,
|
|
987
|
-
max = Number.POSITIVE_INFINITY,
|
|
988
|
-
): number {
|
|
942
|
+
function clamp(value: number, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFINITY): number {
|
|
989
943
|
return Math.min(Math.max(value, min), max);
|
|
990
944
|
}
|
|
991
945
|
|
package/src/primitives/input.tsx
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
JSX,
|
|
5
|
-
PointerEventHandler,
|
|
6
|
-
PropsWithChildren,
|
|
7
|
-
ReactNode,
|
|
8
|
-
RefObject,
|
|
9
|
-
} from "react";
|
|
10
|
-
|
|
11
|
-
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
12
|
-
import { createContextScope } from "@radix-ui/react-context";
|
|
1
|
+
import { useComposedRefs } from "radix-ui/internal";
|
|
2
|
+
import { Context } from "radix-ui/internal";
|
|
3
|
+
import type { ComponentProps, JSX, PointerEventHandler, PropsWithChildren, ReactNode, RefObject } from "react";
|
|
13
4
|
import { useRef } from "react";
|
|
14
5
|
|
|
15
6
|
/* -----------------------------------------------------------------------------
|
|
@@ -23,12 +14,12 @@ const INPUT_NAME = "Input";
|
|
|
23
14
|
*/
|
|
24
15
|
type ScopedProps<P> = P & {
|
|
25
16
|
/**
|
|
26
|
-
* Scope for the Input component context
|
|
17
|
+
* Context.Scope for the Input component context
|
|
27
18
|
*/
|
|
28
|
-
__scopeInput?: Scope;
|
|
19
|
+
__scopeInput?: Context.Scope;
|
|
29
20
|
};
|
|
30
21
|
|
|
31
|
-
const [createInputContext, createInputScope] = createContextScope(INPUT_NAME);
|
|
22
|
+
const [createInputContext, createInputScope] = Context.createContextScope(INPUT_NAME);
|
|
32
23
|
|
|
33
24
|
/**
|
|
34
25
|
* Context value for the Input component
|
|
@@ -181,12 +172,7 @@ function Input(inputProps: ScopedProps<InputProps>): JSX.Element {
|
|
|
181
172
|
};
|
|
182
173
|
|
|
183
174
|
return (
|
|
184
|
-
<InputContextProvider
|
|
185
|
-
disabled={disabled}
|
|
186
|
-
inputRef={inputRef}
|
|
187
|
-
readOnly={readOnly}
|
|
188
|
-
scope={__scopeInput}
|
|
189
|
-
>
|
|
175
|
+
<InputContextProvider disabled={disabled} inputRef={inputRef} readOnly={readOnly} scope={__scopeInput}>
|
|
190
176
|
<div
|
|
191
177
|
data-disabled={disabled}
|
|
192
178
|
data-readonly={readOnly}
|
|
@@ -229,9 +215,7 @@ function InputField({ __scopeInput, ...props }: ScopedProps<InputFieldProps>): J
|
|
|
229
215
|
*/
|
|
230
216
|
const composedInputRef = useComposedRefs(inputRef);
|
|
231
217
|
|
|
232
|
-
return
|
|
233
|
-
<input ref={composedInputRef} disabled={disabled} readOnly={readOnly} type="text" {...props} />
|
|
234
|
-
);
|
|
218
|
+
return <input ref={composedInputRef} disabled={disabled} readOnly={readOnly} type="text" {...props} />;
|
|
235
219
|
}
|
|
236
220
|
|
|
237
221
|
/* -----------------------------------------------------------------------------
|