@codefast/ui 0.3.16-canary.2 → 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 +81 -0
- package/README.md +28 -17
- 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 +14 -14
- package/dist/components/alert.mjs +17 -28
- 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.d.mts +3 -15
- package/dist/components/badge.mjs +6 -48
- package/dist/components/breadcrumb.d.mts +1 -0
- package/dist/components/breadcrumb.mjs +11 -10
- package/dist/components/button-group.d.mts +3 -13
- package/dist/components/button-group.mjs +9 -31
- package/dist/components/button.d.mts +3 -26
- package/dist/components/button.mjs +9 -79
- package/dist/components/calendar.d.mts +6 -2
- package/dist/components/calendar.mjs +41 -44
- package/dist/components/card.d.mts +4 -2
- package/dist/components/card.mjs +9 -9
- package/dist/components/carousel.d.mts +16 -5
- package/dist/components/carousel.mjs +24 -11
- package/dist/components/chart.d.mts +9 -6
- 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 +3 -21
- package/dist/components/drawer.mjs +19 -27
- package/dist/components/dropdown-menu.d.mts +22 -15
- package/dist/components/dropdown-menu.mjs +41 -37
- package/dist/components/empty.d.mts +3 -13
- package/dist/components/empty.mjs +8 -23
- package/dist/components/field.d.mts +3 -14
- package/dist/components/field.mjs +14 -44
- package/dist/components/form.d.mts +7 -10
- 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 +4 -31
- package/dist/components/input-group.mjs +14 -96
- package/dist/components/input-number.d.mts +3 -1
- package/dist/components/input-number.mjs +50 -28
- 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.d.mts +4 -29
- package/dist/components/item.mjs +12 -65
- 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 -13
- package/dist/components/navigation-menu.mjs +35 -32
- package/dist/components/pagination.d.mts +7 -1
- package/dist/components/pagination.mjs +27 -12
- package/dist/components/popover.d.mts +40 -7
- package/dist/components/popover.mjs +46 -14
- package/dist/components/progress-circle.d.mts +3 -47
- package/dist/components/progress-circle.mjs +2 -48
- 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 +8 -24
- package/dist/components/scroll-area.mjs +16 -70
- package/dist/components/select.d.mts +14 -14
- package/dist/components/select.mjs +47 -47
- package/dist/components/separator.d.mts +4 -19
- package/dist/components/separator.mjs +6 -27
- package/dist/components/sheet.d.mts +18 -31
- package/dist/components/sheet.mjs +46 -87
- package/dist/components/sidebar.d.mts +3 -19
- package/dist/components/sidebar.mjs +48 -84
- 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 +11 -7
- package/dist/components/toggle-group.mjs +20 -21
- package/dist/components/toggle.d.mts +4 -24
- package/dist/components/toggle.mjs +6 -45
- 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 +38 -21
- package/dist/index.mjs +40 -23
- package/dist/lib/utils.d.mts +1 -12
- package/dist/lib/utils.mjs +1 -9
- package/dist/primitives/checkbox-group.d.mts +9 -11
- package/dist/primitives/checkbox-group.mjs +14 -19
- package/dist/primitives/input-number.d.mts +3 -4
- package/dist/primitives/input-number.mjs +3 -5
- package/dist/primitives/input.d.mts +4 -5
- package/dist/primitives/input.mjs +2 -3
- package/dist/primitives/progress-circle.d.mts +3 -4
- package/dist/primitives/progress-circle.mjs +2 -3
- package/dist/variants/alert.d.mts +18 -0
- package/dist/variants/alert.mjs +15 -0
- package/dist/variants/badge.d.mts +22 -0
- package/dist/variants/badge.mjs +19 -0
- package/dist/variants/button-group.d.mts +18 -0
- package/dist/variants/button-group.mjs +15 -0
- package/dist/variants/button.d.mts +32 -0
- package/dist/variants/button.mjs +34 -0
- package/dist/variants/empty.d.mts +18 -0
- package/dist/variants/empty.mjs +15 -0
- package/dist/variants/field.d.mts +19 -0
- package/dist/variants/field.mjs +16 -0
- package/dist/variants/input-group.d.mts +43 -0
- package/dist/variants/input-group.mjs +34 -0
- package/dist/variants/input-number.d.mts +45 -0
- package/dist/variants/input-number.mjs +40 -0
- package/dist/variants/item.d.mts +38 -0
- package/dist/variants/item.mjs +38 -0
- package/dist/variants/navigation-menu.d.mts +13 -0
- package/dist/variants/navigation-menu.mjs +8 -0
- package/dist/variants/progress-circle.d.mts +52 -0
- package/dist/variants/progress-circle.mjs +45 -0
- package/dist/variants/scroll-area.d.mts +24 -0
- package/dist/variants/scroll-area.mjs +58 -0
- package/dist/variants/separator.d.mts +23 -0
- package/dist/variants/separator.mjs +25 -0
- package/dist/variants/sheet.d.mts +20 -0
- package/dist/variants/sheet.mjs +17 -0
- package/dist/variants/sidebar.d.mts +23 -0
- package/dist/variants/sidebar.mjs +25 -0
- package/dist/variants/tabs.d.mts +18 -0
- package/dist/variants/tabs.mjs +15 -0
- package/dist/variants/toggle.d.mts +23 -0
- package/dist/variants/toggle.mjs +25 -0
- package/package.json +186 -55
- package/src/components/accordion.tsx +114 -0
- package/src/components/alert-dialog.tsx +298 -0
- package/src/components/alert.tsx +94 -0
- package/src/components/aspect-ratio.tsx +25 -0
- package/src/components/avatar.tsx +171 -0
- package/src/components/badge.tsx +35 -0
- package/src/components/breadcrumb.tsx +191 -0
- package/src/components/button-group.tsx +97 -0
- package/src/components/button.tsx +55 -0
- package/src/components/calendar.tsx +222 -0
- package/src/components/card.tsx +169 -0
- package/src/components/carousel.tsx +349 -0
- package/src/components/chart.tsx +536 -0
- package/src/components/checkbox-cards.tsx +72 -0
- package/src/components/checkbox-group.tsx +60 -0
- package/src/components/checkbox.tsx +44 -0
- package/src/components/collapsible.tsx +57 -0
- package/src/components/command.tsx +298 -0
- package/src/components/context-menu.tsx +410 -0
- package/src/components/dialog.tsx +243 -0
- package/src/components/direction.tsx +32 -0
- package/src/components/drawer.tsx +209 -0
- package/src/components/dropdown-menu.tsx +419 -0
- package/src/components/empty.tsx +155 -0
- package/src/components/field.tsx +329 -0
- package/src/components/form.tsx +258 -0
- package/src/components/hover-card.tsx +93 -0
- package/src/components/input-group.tsx +185 -0
- package/src/components/input-number.tsx +141 -0
- package/src/components/input-otp.tsx +132 -0
- package/src/components/input-password.tsx +50 -0
- package/src/components/input-search.tsx +81 -0
- package/src/components/input.tsx +36 -0
- package/src/components/item.tsx +266 -0
- package/src/components/kbd.tsx +47 -0
- package/src/components/label.tsx +36 -0
- package/src/components/menubar.tsx +440 -0
- package/src/components/native-select.tsx +87 -0
- package/src/components/navigation-menu.tsx +235 -0
- package/src/components/pagination.tsx +198 -0
- package/src/components/popover.tsx +170 -0
- package/src/components/progress-circle.tsx +185 -0
- package/src/components/progress.tsx +41 -0
- package/src/components/radio-cards.tsx +66 -0
- package/src/components/radio-group.tsx +59 -0
- package/src/components/radio.tsx +40 -0
- package/src/components/resizable.tsx +78 -0
- package/src/components/scroll-area.tsx +95 -0
- package/src/components/select.tsx +296 -0
- package/src/components/separator.tsx +60 -0
- package/src/components/sheet.tsx +241 -0
- package/src/components/sidebar.tsx +926 -0
- package/src/components/skeleton.tsx +35 -0
- package/src/components/slider.tsx +66 -0
- package/src/components/sonner.tsx +57 -0
- package/src/components/spinner.tsx +66 -0
- package/src/components/switch.tsx +44 -0
- package/src/components/table.tsx +183 -0
- package/src/components/tabs.tsx +110 -0
- package/src/components/textarea.tsx +35 -0
- package/src/components/toggle-group.tsx +137 -0
- package/src/components/toggle.tsx +30 -0
- package/src/components/tooltip.tsx +115 -0
- 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 -195
- package/src/css/style.css +1 -1
- package/src/css/{amber.css → themes/amber.css} +59 -22
- package/src/css/{blue.css → themes/blue.css} +59 -22
- package/src/css/{cyan.css → themes/cyan.css} +59 -22
- package/src/css/{emerald.css → themes/emerald.css} +59 -22
- package/src/css/{fuchsia.css → themes/fuchsia.css} +59 -22
- package/src/css/{gray.css → themes/gray.css} +59 -22
- package/src/css/{green.css → themes/green.css} +59 -22
- package/src/css/{indigo.css → themes/indigo.css} +59 -22
- package/src/css/{lime.css → themes/lime.css} +59 -22
- package/src/css/{neutral.css → themes/neutral.css} +59 -22
- package/src/css/{orange.css → themes/orange.css} +59 -22
- package/src/css/{pink.css → themes/pink.css} +59 -22
- package/src/css/{purple.css → themes/purple.css} +59 -22
- package/src/css/{red.css → themes/red.css} +59 -22
- package/src/css/{rose.css → themes/rose.css} +59 -22
- package/src/css/{sky.css → themes/sky.css} +59 -22
- package/src/css/{slate.css → themes/slate.css} +59 -22
- package/src/css/{stone.css → themes/stone.css} +59 -22
- package/src/css/{teal.css → themes/teal.css} +59 -22
- package/src/css/{violet.css → themes/violet.css} +59 -22
- package/src/css/{yellow.css → themes/yellow.css} +59 -22
- package/src/css/{zinc.css → themes/zinc.css} +59 -22
- package/src/hooks/use-animated-value.ts +91 -0
- package/src/hooks/use-copy-to-clipboard.ts +58 -0
- package/src/hooks/use-is-mobile.ts +25 -0
- package/src/hooks/use-media-query.ts +69 -0
- package/src/hooks/use-mutation-observer.ts +51 -0
- package/src/hooks/use-pagination.ts +164 -0
- package/src/index.ts +679 -0
- package/src/lib/utils.ts +5 -0
- package/src/primitives/checkbox-group.tsx +346 -0
- package/src/primitives/input-number.tsx +967 -0
- package/src/primitives/input.tsx +227 -0
- package/src/primitives/progress-circle.tsx +507 -0
- package/src/variants/alert.ts +34 -0
- package/src/variants/badge.ts +39 -0
- package/src/variants/button-group.ts +36 -0
- package/src/variants/button.ts +56 -0
- package/src/variants/empty.ts +34 -0
- package/src/variants/field.ts +37 -0
- package/src/variants/input-group.ts +80 -0
- package/src/variants/input-number.ts +65 -0
- package/src/variants/item.ts +68 -0
- package/src/variants/navigation-menu.ts +25 -0
- package/src/variants/progress-circle.ts +46 -0
- package/src/variants/scroll-area.ts +73 -0
- package/src/variants/separator.ts +40 -0
- package/src/variants/sheet.ts +37 -0
- package/src/variants/sidebar.ts +41 -0
- package/src/variants/tabs.ts +34 -0
- package/src/variants/toggle.ts +40 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +0 -6
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import type { Label as LabelPrimitive } from "radix-ui";
|
|
2
|
+
import { Slot } from "radix-ui";
|
|
3
|
+
import { Context } from "radix-ui/internal";
|
|
4
|
+
import type { ComponentProps, JSX, ReactNode } from "react";
|
|
5
|
+
import { useId } from "react";
|
|
6
|
+
import type { ControllerProps, FieldError, FieldPath, FieldValues } from "react-hook-form";
|
|
7
|
+
import { Controller, FormProvider, useFormContext, useFormState } from "react-hook-form";
|
|
8
|
+
|
|
9
|
+
import { Label } from "#/components/label";
|
|
10
|
+
import { cn } from "#/lib/utils";
|
|
11
|
+
|
|
12
|
+
/* -----------------------------------------------------------------------------
|
|
13
|
+
* Component: Form
|
|
14
|
+
* -------------------------------------------------------------------------- */
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @since 0.3.16-canary.0
|
|
18
|
+
*/
|
|
19
|
+
type FormProps = ComponentProps<typeof FormProvider>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @since 0.3.16-canary.0
|
|
23
|
+
*/
|
|
24
|
+
const Form: typeof FormProvider = FormProvider;
|
|
25
|
+
|
|
26
|
+
/* -----------------------------------------------------------------------------
|
|
27
|
+
* Context: FormField
|
|
28
|
+
* -------------------------------------------------------------------------- */
|
|
29
|
+
|
|
30
|
+
const FORM_FIELD_NAME = "FormField";
|
|
31
|
+
|
|
32
|
+
type ScopedProps<P> = P & { __scopeFormField?: Context.Scope };
|
|
33
|
+
|
|
34
|
+
const [createFormFieldContext, createFormFieldScope] = Context.createContextScope(FORM_FIELD_NAME);
|
|
35
|
+
|
|
36
|
+
interface FormFieldContextValue<
|
|
37
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
38
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
39
|
+
> {
|
|
40
|
+
name: TName;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const [FormFieldContextProvider, useFormFieldContext] = createFormFieldContext<FormFieldContextValue>(FORM_FIELD_NAME);
|
|
44
|
+
|
|
45
|
+
function useFormItem(
|
|
46
|
+
consumerName: string,
|
|
47
|
+
scope: Context.Scope,
|
|
48
|
+
): {
|
|
49
|
+
formDescriptionId: string;
|
|
50
|
+
formItemId: string;
|
|
51
|
+
formMessageId: string;
|
|
52
|
+
id: string;
|
|
53
|
+
invalid: boolean;
|
|
54
|
+
isDirty: boolean;
|
|
55
|
+
isTouched: boolean;
|
|
56
|
+
isValidating: boolean;
|
|
57
|
+
name: string;
|
|
58
|
+
error?: FieldError;
|
|
59
|
+
} {
|
|
60
|
+
const { id } = useFormItemContext(consumerName, scope);
|
|
61
|
+
const { name } = useFormFieldContext(consumerName, scope);
|
|
62
|
+
const { getFieldState } = useFormContext();
|
|
63
|
+
const formState = useFormState({ name });
|
|
64
|
+
const fieldState = getFieldState(name, formState);
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
formDescriptionId: `form-item-description-${id}`,
|
|
68
|
+
formItemId: `form-item-${id}`,
|
|
69
|
+
formMessageId: `form-item-message-${id}`,
|
|
70
|
+
id,
|
|
71
|
+
name,
|
|
72
|
+
...fieldState,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* -----------------------------------------------------------------------------
|
|
77
|
+
* Component: FormField
|
|
78
|
+
* -------------------------------------------------------------------------- */
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @since 0.3.16-canary.0
|
|
82
|
+
*/
|
|
83
|
+
type FormFieldProps<
|
|
84
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
85
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
86
|
+
> = ControllerProps<TFieldValues, TName>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @since 0.3.16-canary.0
|
|
90
|
+
*/
|
|
91
|
+
function FormField<
|
|
92
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
93
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
94
|
+
>(formFieldProps: ScopedProps<FormFieldProps<TFieldValues, TName>>): JSX.Element {
|
|
95
|
+
const { __scopeFormField, ...props } = formFieldProps;
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<FormFieldContextProvider name={props.name} scope={__scopeFormField}>
|
|
99
|
+
<Controller {...props} />
|
|
100
|
+
</FormFieldContextProvider>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* -----------------------------------------------------------------------------
|
|
105
|
+
* Context: FormItem
|
|
106
|
+
* -------------------------------------------------------------------------- */
|
|
107
|
+
|
|
108
|
+
const FORM_ITEM_NAME = "FormItem";
|
|
109
|
+
|
|
110
|
+
interface FormItemContextValue {
|
|
111
|
+
id: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const [FormItemContextProvider, useFormItemContext] = createFormFieldContext<FormItemContextValue>(FORM_ITEM_NAME);
|
|
115
|
+
|
|
116
|
+
/* -----------------------------------------------------------------------------
|
|
117
|
+
* Component: FormItem
|
|
118
|
+
* -------------------------------------------------------------------------- */
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @since 0.3.16-canary.0
|
|
122
|
+
*/
|
|
123
|
+
type FormItemProps = ComponentProps<"div">;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @since 0.3.16-canary.0
|
|
127
|
+
*/
|
|
128
|
+
function FormItem({ __scopeFormField, className, ...props }: ScopedProps<FormItemProps>): JSX.Element {
|
|
129
|
+
const id = useId();
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<FormItemContextProvider id={id} scope={__scopeFormField}>
|
|
133
|
+
<div className={cn("grid gap-2", className)} data-slot="form-item" {...props} />
|
|
134
|
+
</FormItemContextProvider>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* -----------------------------------------------------------------------------
|
|
139
|
+
* Component: FormLabel
|
|
140
|
+
* -------------------------------------------------------------------------- */
|
|
141
|
+
|
|
142
|
+
const FORM_LABEL_NAME = "FormLabel";
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @since 0.3.16-canary.0
|
|
146
|
+
*/
|
|
147
|
+
type FormLabelProps = ComponentProps<typeof LabelPrimitive.Root>;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @since 0.3.16-canary.0
|
|
151
|
+
*/
|
|
152
|
+
function FormLabel({ __scopeFormField, ...props }: ScopedProps<FormLabelProps>): JSX.Element {
|
|
153
|
+
const { error, formItemId } = useFormItem(FORM_LABEL_NAME, __scopeFormField);
|
|
154
|
+
|
|
155
|
+
return <Label data-invalid={error ? true : undefined} data-slot="form-label" htmlFor={formItemId} {...props} />;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* -----------------------------------------------------------------------------
|
|
159
|
+
* Component: FormControl
|
|
160
|
+
* -------------------------------------------------------------------------- */
|
|
161
|
+
|
|
162
|
+
const FORM_CONTROL_NAME = "FormControl";
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @since 0.3.16-canary.0
|
|
166
|
+
*/
|
|
167
|
+
type FormControlProps = ComponentProps<typeof Slot.Root>;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @since 0.3.16-canary.0
|
|
171
|
+
*/
|
|
172
|
+
function FormControl({ __scopeFormField, ...props }: ScopedProps<FormControlProps>): JSX.Element {
|
|
173
|
+
const { error, formDescriptionId, formItemId, formMessageId } = useFormItem(FORM_CONTROL_NAME, __scopeFormField);
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
<Slot.Root
|
|
177
|
+
aria-describedby={error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId}
|
|
178
|
+
aria-invalid={Boolean(error)}
|
|
179
|
+
data-slot="form-control"
|
|
180
|
+
id={formItemId}
|
|
181
|
+
{...props}
|
|
182
|
+
/>
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* -----------------------------------------------------------------------------
|
|
187
|
+
* Component: FormDescription
|
|
188
|
+
* -------------------------------------------------------------------------- */
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @since 0.3.16-canary.0
|
|
192
|
+
*/
|
|
193
|
+
type FormDescriptionProps = ComponentProps<"p">;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @since 0.3.16-canary.0
|
|
197
|
+
*/
|
|
198
|
+
function FormDescription({ __scopeFormField, className, ...props }: ScopedProps<FormDescriptionProps>): JSX.Element {
|
|
199
|
+
const { formDescriptionId } = useFormItem(FORM_MESSAGE_NAME, __scopeFormField);
|
|
200
|
+
|
|
201
|
+
return (
|
|
202
|
+
<p
|
|
203
|
+
className={cn("text-xs text-muted-foreground", className)}
|
|
204
|
+
data-slot="form-description"
|
|
205
|
+
id={formDescriptionId}
|
|
206
|
+
{...props}
|
|
207
|
+
/>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* -----------------------------------------------------------------------------
|
|
212
|
+
* Component: FormMessage
|
|
213
|
+
* -------------------------------------------------------------------------- */
|
|
214
|
+
|
|
215
|
+
const FORM_MESSAGE_NAME = "FormMessage";
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @since 0.3.16-canary.0
|
|
219
|
+
*/
|
|
220
|
+
type FormMessageProps = ComponentProps<"p">;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @since 0.3.16-canary.0
|
|
224
|
+
*/
|
|
225
|
+
function FormMessage({ __scopeFormField, children, className, ...props }: ScopedProps<FormMessageProps>): ReactNode {
|
|
226
|
+
const { error, formMessageId } = useFormItem(FORM_MESSAGE_NAME, __scopeFormField);
|
|
227
|
+
const body = error?.message ?? children;
|
|
228
|
+
|
|
229
|
+
if (!body) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return (
|
|
234
|
+
<p
|
|
235
|
+
className={cn("text-xs", error?.message ? "font-medium text-destructive" : "text-muted-foreground", className)}
|
|
236
|
+
data-slot="form-message"
|
|
237
|
+
id={formMessageId}
|
|
238
|
+
{...props}
|
|
239
|
+
>
|
|
240
|
+
{body}
|
|
241
|
+
</p>
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/* -----------------------------------------------------------------------------
|
|
246
|
+
* Exports
|
|
247
|
+
* -------------------------------------------------------------------------- */
|
|
248
|
+
|
|
249
|
+
export type {
|
|
250
|
+
FormControlProps,
|
|
251
|
+
FormDescriptionProps,
|
|
252
|
+
FormFieldProps,
|
|
253
|
+
FormItemProps,
|
|
254
|
+
FormLabelProps,
|
|
255
|
+
FormMessageProps,
|
|
256
|
+
FormProps,
|
|
257
|
+
};
|
|
258
|
+
export { createFormFieldScope, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { HoverCard as HoverCardPrimitive } from "radix-ui";
|
|
2
|
+
import type { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "#/lib/utils";
|
|
5
|
+
|
|
6
|
+
/* -----------------------------------------------------------------------------
|
|
7
|
+
* Component: HoverCard
|
|
8
|
+
* -------------------------------------------------------------------------- */
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @since 0.3.16-canary.0
|
|
12
|
+
*/
|
|
13
|
+
type HoverCardProps = ComponentProps<typeof HoverCardPrimitive.Root>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @since 0.3.16-canary.0
|
|
17
|
+
*/
|
|
18
|
+
function HoverCard({ ...props }: HoverCardProps): JSX.Element {
|
|
19
|
+
return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* -----------------------------------------------------------------------------
|
|
23
|
+
* Component: HoverCardTrigger
|
|
24
|
+
* -------------------------------------------------------------------------- */
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @since 0.3.16-canary.0
|
|
28
|
+
*/
|
|
29
|
+
type HoverCardTriggerProps = ComponentProps<typeof HoverCardPrimitive.Trigger>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @since 0.3.16-canary.0
|
|
33
|
+
*/
|
|
34
|
+
function HoverCardTrigger({ ...props }: HoverCardTriggerProps): JSX.Element {
|
|
35
|
+
return <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* -----------------------------------------------------------------------------
|
|
39
|
+
* Component: HoverCardContent
|
|
40
|
+
* -------------------------------------------------------------------------- */
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @since 0.3.16-canary.0
|
|
44
|
+
*/
|
|
45
|
+
type HoverCardContentProps = ComponentProps<typeof HoverCardPrimitive.Content>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @since 0.3.16-canary.0
|
|
49
|
+
*/
|
|
50
|
+
function HoverCardContent({
|
|
51
|
+
align = "center",
|
|
52
|
+
className,
|
|
53
|
+
sideOffset = 4,
|
|
54
|
+
...props
|
|
55
|
+
}: HoverCardContentProps): JSX.Element {
|
|
56
|
+
return (
|
|
57
|
+
<HoverCardPrimitive.Portal data-slot="hover-card-portal">
|
|
58
|
+
<HoverCardPrimitive.Content
|
|
59
|
+
align={align}
|
|
60
|
+
className={cn(
|
|
61
|
+
"z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-lg bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden ease-snappy data-open:animate-in data-open:animation-duration-popup-in data-open:fade-in-0 data-open:zoom-in-95 data-open:data-side-top:slide-in-from-bottom-2 data-open:data-side-right:slide-in-from-left-2 data-open:data-side-bottom:slide-in-from-top-2 data-open:data-side-left:slide-in-from-right-2 data-closed:animate-out data-closed:ease-exit data-closed:animation-duration-popup-out data-closed:fade-out-0 data-closed:zoom-out-95 data-closed:data-side-top:slide-out-to-bottom-2 data-closed:data-side-right:slide-out-to-left-2 data-closed:data-side-bottom:slide-out-to-top-2 data-closed:data-side-left:slide-out-to-right-2",
|
|
62
|
+
className,
|
|
63
|
+
)}
|
|
64
|
+
data-slot="hover-card-content"
|
|
65
|
+
sideOffset={sideOffset}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
</HoverCardPrimitive.Portal>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* -----------------------------------------------------------------------------
|
|
73
|
+
* Component: HoverCardArrow
|
|
74
|
+
* -------------------------------------------------------------------------- */
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @since 0.3.16-canary.0
|
|
78
|
+
*/
|
|
79
|
+
type HoverCardArrowProps = ComponentProps<typeof HoverCardPrimitive.Arrow>;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @since 0.3.16-canary.0
|
|
83
|
+
*/
|
|
84
|
+
function HoverCardArrow({ className, ...props }: HoverCardArrowProps): JSX.Element {
|
|
85
|
+
return <HoverCardPrimitive.Arrow className={cn("fill-popover", className)} data-slot="hover-card-arrow" {...props} />;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* -----------------------------------------------------------------------------
|
|
89
|
+
* Exports
|
|
90
|
+
* -------------------------------------------------------------------------- */
|
|
91
|
+
|
|
92
|
+
export { HoverCard, HoverCardArrow, HoverCardContent, HoverCardTrigger };
|
|
93
|
+
export type { HoverCardArrowProps, HoverCardContentProps, HoverCardProps, HoverCardTriggerProps };
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import type { ComponentProps, JSX } from "react";
|
|
2
|
+
|
|
3
|
+
import type { ButtonProps } from "#/components/button";
|
|
4
|
+
import { Button } from "#/components/button";
|
|
5
|
+
import type { InputProps } from "#/components/input";
|
|
6
|
+
import { Input } from "#/components/input";
|
|
7
|
+
import type { TextareaProps } from "#/components/textarea";
|
|
8
|
+
import { Textarea } from "#/components/textarea";
|
|
9
|
+
import { cn } from "#/lib/utils";
|
|
10
|
+
import type { InputGroupAddonVariants, InputGroupButtonVariants } from "#/variants/input-group";
|
|
11
|
+
import { inputGroupAddonVariants, inputGroupButtonVariants, inputGroupVariants } from "#/variants/input-group";
|
|
12
|
+
|
|
13
|
+
/* -----------------------------------------------------------------------------
|
|
14
|
+
* Component: InputGroup
|
|
15
|
+
* -------------------------------------------------------------------------- */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @since 0.3.16-canary.0
|
|
19
|
+
*/
|
|
20
|
+
type InputGroupProps = ComponentProps<"div">;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @since 0.3.16-canary.0
|
|
24
|
+
*/
|
|
25
|
+
function InputGroup({ className, ...props }: InputGroupProps): JSX.Element {
|
|
26
|
+
return <div className={inputGroupVariants({ className })} data-slot="input-group" role="group" {...props} />;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* -----------------------------------------------------------------------------
|
|
30
|
+
* Component: InputGroupAddon
|
|
31
|
+
* -------------------------------------------------------------------------- */
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @since 0.3.16-canary.0
|
|
35
|
+
*/
|
|
36
|
+
type InputGroupAddonProps = ComponentProps<"div"> & InputGroupAddonVariants;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @since 0.3.16-canary.0
|
|
40
|
+
*/
|
|
41
|
+
function InputGroupAddon({ align = "inline-start", className, ...props }: InputGroupAddonProps): JSX.Element {
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
className={inputGroupAddonVariants({ align, className })}
|
|
45
|
+
data-align={align}
|
|
46
|
+
data-slot="input-group-addon"
|
|
47
|
+
role="group"
|
|
48
|
+
onPointerDown={(event) => {
|
|
49
|
+
if ((event.target as HTMLElement).closest("button")) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
|
|
55
|
+
const control = event.currentTarget.parentElement?.querySelector("input, textarea");
|
|
56
|
+
|
|
57
|
+
if (control instanceof HTMLElement) {
|
|
58
|
+
control.focus();
|
|
59
|
+
}
|
|
60
|
+
}}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* -----------------------------------------------------------------------------
|
|
67
|
+
* Component: InputGroupButton
|
|
68
|
+
* -------------------------------------------------------------------------- */
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @since 0.3.16-canary.0
|
|
72
|
+
*/
|
|
73
|
+
type InputGroupButtonProps = Omit<ButtonProps, "size"> & InputGroupButtonVariants;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @since 0.3.16-canary.0
|
|
77
|
+
*/
|
|
78
|
+
function InputGroupButton({
|
|
79
|
+
className,
|
|
80
|
+
size = "xs",
|
|
81
|
+
type = "button",
|
|
82
|
+
variant = "ghost",
|
|
83
|
+
...props
|
|
84
|
+
}: InputGroupButtonProps): JSX.Element {
|
|
85
|
+
return (
|
|
86
|
+
<Button
|
|
87
|
+
className={inputGroupButtonVariants({ size, className })}
|
|
88
|
+
data-size={size}
|
|
89
|
+
data-slot="input-group-button"
|
|
90
|
+
type={type}
|
|
91
|
+
variant={variant}
|
|
92
|
+
{...props}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* -----------------------------------------------------------------------------
|
|
98
|
+
* Component: InputGroupText
|
|
99
|
+
* -------------------------------------------------------------------------- */
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @since 0.3.16-canary.0
|
|
103
|
+
*/
|
|
104
|
+
type InputGroupTextProps = ComponentProps<"span">;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @since 0.3.16-canary.0
|
|
108
|
+
*/
|
|
109
|
+
function InputGroupText({ className, ...props }: InputGroupTextProps): JSX.Element {
|
|
110
|
+
return (
|
|
111
|
+
<span
|
|
112
|
+
className={cn(
|
|
113
|
+
"flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
114
|
+
className,
|
|
115
|
+
)}
|
|
116
|
+
data-slot="input-group-text"
|
|
117
|
+
{...props}
|
|
118
|
+
/>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* -----------------------------------------------------------------------------
|
|
123
|
+
* Component: InputGroupInput
|
|
124
|
+
* -------------------------------------------------------------------------- */
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @since 0.3.16-canary.0
|
|
128
|
+
*/
|
|
129
|
+
type InputGroupInputProps = InputProps;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @since 0.3.16-canary.0
|
|
133
|
+
*/
|
|
134
|
+
function InputGroupInput({ className, ...props }: InputGroupInputProps): JSX.Element {
|
|
135
|
+
return (
|
|
136
|
+
<Input
|
|
137
|
+
className={cn(
|
|
138
|
+
"flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
|
|
139
|
+
className,
|
|
140
|
+
)}
|
|
141
|
+
data-slot="input-group-control"
|
|
142
|
+
{...props}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* -----------------------------------------------------------------------------
|
|
148
|
+
* Component: InputGroupTextarea
|
|
149
|
+
* -------------------------------------------------------------------------- */
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @since 0.3.16-canary.0
|
|
153
|
+
*/
|
|
154
|
+
type InputGroupTextareaProps = TextareaProps;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @since 0.3.16-canary.0
|
|
158
|
+
*/
|
|
159
|
+
function InputGroupTextarea({ className, ...props }: InputGroupTextareaProps): JSX.Element {
|
|
160
|
+
return (
|
|
161
|
+
<Textarea
|
|
162
|
+
className={cn(
|
|
163
|
+
"flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
|
|
164
|
+
className,
|
|
165
|
+
)}
|
|
166
|
+
data-slot="input-group-control"
|
|
167
|
+
{...props}
|
|
168
|
+
/>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* -----------------------------------------------------------------------------
|
|
173
|
+
* Exports
|
|
174
|
+
* -------------------------------------------------------------------------- */
|
|
175
|
+
|
|
176
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea };
|
|
177
|
+
|
|
178
|
+
export type {
|
|
179
|
+
InputGroupAddonProps,
|
|
180
|
+
InputGroupButtonProps,
|
|
181
|
+
InputGroupInputProps,
|
|
182
|
+
InputGroupProps,
|
|
183
|
+
InputGroupTextareaProps,
|
|
184
|
+
InputGroupTextProps,
|
|
185
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { ChevronDownIcon, ChevronUpIcon, MinusIcon, PlusIcon } from "lucide-react";
|
|
2
|
+
import type { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
import { Spinner } from "#/components/spinner";
|
|
5
|
+
import * as InputNumberPrimitive from "#/primitives/input-number";
|
|
6
|
+
import { buttonVariants } from "#/variants/button";
|
|
7
|
+
import type { InputNumberVariants } from "#/variants/input-number";
|
|
8
|
+
import { inputNumberVariants } from "#/variants/input-number";
|
|
9
|
+
|
|
10
|
+
/* -----------------------------------------------------------------------------
|
|
11
|
+
* Component: InputNumber
|
|
12
|
+
* -------------------------------------------------------------------------- */
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @since 0.3.16-canary.0
|
|
16
|
+
*/
|
|
17
|
+
interface InputNumberProps
|
|
18
|
+
extends
|
|
19
|
+
ComponentProps<typeof InputNumberPrimitive.Field>,
|
|
20
|
+
ComponentProps<typeof InputNumberPrimitive.Root>,
|
|
21
|
+
InputNumberVariants {}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @since 0.3.16-canary.0
|
|
25
|
+
*/
|
|
26
|
+
function InputNumber({
|
|
27
|
+
ariaDecrementLabel,
|
|
28
|
+
ariaIncrementLabel,
|
|
29
|
+
className,
|
|
30
|
+
defaultValue,
|
|
31
|
+
disabled,
|
|
32
|
+
formatOptions,
|
|
33
|
+
id,
|
|
34
|
+
loaderPosition,
|
|
35
|
+
loading,
|
|
36
|
+
max,
|
|
37
|
+
min,
|
|
38
|
+
onChange,
|
|
39
|
+
prefix,
|
|
40
|
+
readOnly,
|
|
41
|
+
spinner,
|
|
42
|
+
step,
|
|
43
|
+
suffix,
|
|
44
|
+
value,
|
|
45
|
+
variant = "stepper",
|
|
46
|
+
...props
|
|
47
|
+
}: InputNumberProps): JSX.Element {
|
|
48
|
+
const isSplit = variant === "split";
|
|
49
|
+
const { decrementButton, field, incrementButton, root, stepper, stepperButton } = inputNumberVariants({ variant });
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<InputNumberPrimitive.Root
|
|
53
|
+
ariaDecrementLabel={ariaDecrementLabel}
|
|
54
|
+
ariaIncrementLabel={ariaIncrementLabel}
|
|
55
|
+
className={root({ className })}
|
|
56
|
+
data-slot="input-number"
|
|
57
|
+
data-variant={variant}
|
|
58
|
+
defaultValue={defaultValue}
|
|
59
|
+
disabled={disabled}
|
|
60
|
+
formatOptions={formatOptions}
|
|
61
|
+
id={id}
|
|
62
|
+
loaderPosition={loaderPosition}
|
|
63
|
+
loading={loading}
|
|
64
|
+
max={max}
|
|
65
|
+
min={min}
|
|
66
|
+
prefix={prefix}
|
|
67
|
+
readOnly={readOnly}
|
|
68
|
+
spinner={spinner ?? <Spinner key="spinner" />}
|
|
69
|
+
step={step}
|
|
70
|
+
suffix={suffix}
|
|
71
|
+
value={value}
|
|
72
|
+
onChange={onChange}
|
|
73
|
+
>
|
|
74
|
+
{isSplit ? (
|
|
75
|
+
<InputNumberPrimitive.DecrementButton
|
|
76
|
+
aria-label="Decrement"
|
|
77
|
+
className={buttonVariants({
|
|
78
|
+
className: decrementButton(),
|
|
79
|
+
variant: "ghost",
|
|
80
|
+
})}
|
|
81
|
+
data-slot="input-number-decrement-button"
|
|
82
|
+
>
|
|
83
|
+
<MinusIcon />
|
|
84
|
+
</InputNumberPrimitive.DecrementButton>
|
|
85
|
+
) : null}
|
|
86
|
+
|
|
87
|
+
<InputNumberPrimitive.Field
|
|
88
|
+
autoCapitalize="none"
|
|
89
|
+
autoComplete="off"
|
|
90
|
+
autoCorrect="off"
|
|
91
|
+
className={field()}
|
|
92
|
+
spellCheck="false"
|
|
93
|
+
{...props}
|
|
94
|
+
/>
|
|
95
|
+
|
|
96
|
+
{isSplit ? (
|
|
97
|
+
<InputNumberPrimitive.IncrementButton
|
|
98
|
+
aria-label="Increment"
|
|
99
|
+
className={buttonVariants({
|
|
100
|
+
className: incrementButton(),
|
|
101
|
+
variant: "ghost",
|
|
102
|
+
})}
|
|
103
|
+
data-slot="input-number-increment-button"
|
|
104
|
+
>
|
|
105
|
+
<PlusIcon />
|
|
106
|
+
</InputNumberPrimitive.IncrementButton>
|
|
107
|
+
) : (
|
|
108
|
+
<div className={stepper()} data-slot="input-number-buttons">
|
|
109
|
+
<InputNumberPrimitive.IncrementButton
|
|
110
|
+
aria-label="Increment"
|
|
111
|
+
className={buttonVariants({
|
|
112
|
+
className: stepperButton(),
|
|
113
|
+
variant: "ghost",
|
|
114
|
+
})}
|
|
115
|
+
data-slot="input-number-increment-button"
|
|
116
|
+
>
|
|
117
|
+
<ChevronUpIcon className="size-3.5" />
|
|
118
|
+
</InputNumberPrimitive.IncrementButton>
|
|
119
|
+
|
|
120
|
+
<InputNumberPrimitive.DecrementButton
|
|
121
|
+
aria-label="Decrement"
|
|
122
|
+
className={buttonVariants({
|
|
123
|
+
className: stepperButton(),
|
|
124
|
+
variant: "ghost",
|
|
125
|
+
})}
|
|
126
|
+
data-slot="input-number-decrement-button"
|
|
127
|
+
>
|
|
128
|
+
<ChevronDownIcon className="size-3.5" />
|
|
129
|
+
</InputNumberPrimitive.DecrementButton>
|
|
130
|
+
</div>
|
|
131
|
+
)}
|
|
132
|
+
</InputNumberPrimitive.Root>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* -----------------------------------------------------------------------------
|
|
137
|
+
* Exports
|
|
138
|
+
* -------------------------------------------------------------------------- */
|
|
139
|
+
|
|
140
|
+
export { InputNumber };
|
|
141
|
+
export type { InputNumberProps };
|