@gyramais/gyra-design 0.1.0
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/.eslintrc.json +14 -0
- package/.storybook/main.ts +20 -0
- package/.storybook/preview.ts +45 -0
- package/README.md +31 -0
- package/dist/index.js +2 -0
- package/package.json +83 -0
- package/postcss.config.js +6 -0
- package/rollup.config.js +104 -0
- package/scripts/build-utils.js +16 -0
- package/src/components/Avatar/Avatar.stories.tsx +26 -0
- package/src/components/Avatar/Avatar.tsx +36 -0
- package/src/components/Avatar/index.css +9 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Button/Button.stories.tsx +99 -0
- package/src/components/Button/Button.tsx +71 -0
- package/src/components/Button/index.css +168 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Card/Card.stories.tsx +126 -0
- package/src/components/Card/Card.tsx +111 -0
- package/src/components/Card/index.css +96 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/Chart/Chart.stories.tsx +61 -0
- package/src/components/Chart/Chart.tsx +192 -0
- package/src/components/Chart/index.css +15 -0
- package/src/components/Chart/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +46 -0
- package/src/components/Checkbox/Checkbox.tsx +46 -0
- package/src/components/Checkbox/index.css +29 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Col/Col.stories.tsx +33 -0
- package/src/components/Col/Col.tsx +45 -0
- package/src/components/Col/index.css +57 -0
- package/src/components/Col/index.ts +1 -0
- package/src/components/Collapse/Collapse.stories.tsx +86 -0
- package/src/components/Collapse/Collapse.tsx +34 -0
- package/src/components/Collapse/CollapseIcon.tsx +33 -0
- package/src/components/Collapse/index.css +14 -0
- package/src/components/Collapse/index.ts +2 -0
- package/src/components/Divider/Divider.stories.tsx +45 -0
- package/src/components/Divider/Divider.tsx +42 -0
- package/src/components/Divider/index.css +20 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/Drawer/Drawer.stories.tsx +51 -0
- package/src/components/Drawer/Drawer.tsx +40 -0
- package/src/components/Drawer/index.css +15 -0
- package/src/components/Drawer/index.ts +1 -0
- package/src/components/DropdownMenu/DropdownMenu.stories.tsx +66 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +91 -0
- package/src/components/DropdownMenu/index.css +18 -0
- package/src/components/DropdownMenu/index.ts +1 -0
- package/src/components/Filter/Filter.stories.tsx +94 -0
- package/src/components/Filter/Filter.tsx +213 -0
- package/src/components/Filter/index.css +81 -0
- package/src/components/Filter/index.ts +1 -0
- package/src/components/Form/Form.tsx +11 -0
- package/src/components/Form/Item.tsx +33 -0
- package/src/components/Form/index.css +4 -0
- package/src/components/Form/index.ts +1 -0
- package/src/components/HoverCard/HoverCard.stories.tsx +48 -0
- package/src/components/HoverCard/HoverCard.tsx +54 -0
- package/src/components/HoverCard/index.css +15 -0
- package/src/components/HoverCard/index.ts +1 -0
- package/src/components/Icon/Icon.stories.tsx +23 -0
- package/src/components/Icon/Icon.tsx +36 -0
- package/src/components/Icon/index.css +3 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/IconDisplay/IconDisplay.stories.tsx +27 -0
- package/src/components/IconDisplay/IconDisplay.tsx +29 -0
- package/src/components/IconDisplay/index.css +18 -0
- package/src/components/IconDisplay/index.ts +1 -0
- package/src/components/Information/Information.stories.tsx +25 -0
- package/src/components/Information/Information.tsx +50 -0
- package/src/components/Information/index.css +34 -0
- package/src/components/Information/index.ts +1 -0
- package/src/components/Input/Input.stories.tsx +38 -0
- package/src/components/Input/Input.tsx +91 -0
- package/src/components/Input/index.css +74 -0
- package/src/components/Input/index.ts +1 -0
- package/src/components/Label/Label.tsx +26 -0
- package/src/components/Label/index.ts +1 -0
- package/src/components/Layout/Content.tsx +29 -0
- package/src/components/Layout/Header.tsx +29 -0
- package/src/components/Layout/Layout.stories.tsx +54 -0
- package/src/components/Layout/Layout.tsx +32 -0
- package/src/components/Layout/Sider.tsx +29 -0
- package/src/components/Layout/index.css +37 -0
- package/src/components/Layout/index.ts +4 -0
- package/src/components/List/List.stories.tsx +58 -0
- package/src/components/List/List.tsx +98 -0
- package/src/components/List/index.css +54 -0
- package/src/components/List/index.ts +1 -0
- package/src/components/Loading/Loading.stories.tsx +23 -0
- package/src/components/Loading/Loading.tsx +51 -0
- package/src/components/Loading/index.css +36 -0
- package/src/components/Loading/index.ts +1 -0
- package/src/components/Logo/Logo.stories.tsx +34 -0
- package/src/components/Logo/Logo.tsx +39 -0
- package/src/components/Logo/index.css +9 -0
- package/src/components/Logo/index.ts +1 -0
- package/src/components/Menubar/Menubar.stories.tsx +55 -0
- package/src/components/Menubar/Menubar.tsx +118 -0
- package/src/components/Menubar/index.css +96 -0
- package/src/components/Menubar/index.ts +1 -0
- package/src/components/Row/Row.stories.tsx +33 -0
- package/src/components/Row/Row.tsx +48 -0
- package/src/components/Row/index.css +116 -0
- package/src/components/Row/index.ts +1 -0
- package/src/components/Switch/Switch.stories.tsx +39 -0
- package/src/components/Switch/Switch.tsx +36 -0
- package/src/components/Switch/index.css +37 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Table/Table.stories.tsx +85 -0
- package/src/components/Table/Table.tsx +123 -0
- package/src/components/Table/index.css +74 -0
- package/src/components/Table/index.ts +1 -0
- package/src/components/Tabs/Tabs.stories.tsx +49 -0
- package/src/components/Tabs/Tabs.tsx +76 -0
- package/src/components/Tabs/index.css +89 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Tag/Tag.stories.tsx +41 -0
- package/src/components/Tag/Tag.tsx +39 -0
- package/src/components/Tag/index.css +31 -0
- package/src/components/Tag/index.ts +1 -0
- package/src/components/Text/Text.stories.tsx +41 -0
- package/src/components/Toast/Toast.stories.tsx +47 -0
- package/src/components/Toast/Toast.tsx +13 -0
- package/src/components/Toast/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +44 -0
- package/src/components/Tooltip/Tooltip.tsx +60 -0
- package/src/components/Tooltip/index.css +15 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/index.css +176 -0
- package/src/index.ts +38 -0
- package/src/shadcn/checkbox.tsx +28 -0
- package/src/shadcn/dropdown-menu.tsx +200 -0
- package/src/shadcn/form.tsx +178 -0
- package/src/shadcn/hover-card.tsx +31 -0
- package/src/shadcn/label.tsx +26 -0
- package/src/shadcn/lib/utils.ts +6 -0
- package/src/shadcn/menubar.tsx +248 -0
- package/src/shadcn/switch.tsx +25 -0
- package/src/shadcn/table.tsx +117 -0
- package/src/shadcn/tabs.tsx +55 -0
- package/src/shadcn/tooltip.tsx +30 -0
- package/src/theme.ts +123 -0
- package/tailwind.config.js +9 -0
- package/tsconfig.json +32 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
3
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
+
import {
|
|
5
|
+
Controller,
|
|
6
|
+
ControllerProps,
|
|
7
|
+
FieldPath,
|
|
8
|
+
FieldValues,
|
|
9
|
+
FormProvider,
|
|
10
|
+
useFormContext,
|
|
11
|
+
useForm,
|
|
12
|
+
} from 'react-hook-form';
|
|
13
|
+
|
|
14
|
+
import { cn } from './lib/utils';
|
|
15
|
+
import { Label } from './label';
|
|
16
|
+
|
|
17
|
+
const Form = FormProvider;
|
|
18
|
+
|
|
19
|
+
type FormFieldContextValue<
|
|
20
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
21
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
|
|
22
|
+
> = {
|
|
23
|
+
name: TName
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const FormFieldContext = React.createContext<FormFieldContextValue>(
|
|
27
|
+
{} as FormFieldContextValue
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const FormField = <
|
|
31
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
32
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
|
|
33
|
+
>({
|
|
34
|
+
...props
|
|
35
|
+
}: ControllerProps<TFieldValues, TName>) => {
|
|
36
|
+
return (
|
|
37
|
+
<FormFieldContext.Provider value={{ name: props.name }}>
|
|
38
|
+
<Controller {...props} />
|
|
39
|
+
</FormFieldContext.Provider>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const useFormField = () => {
|
|
44
|
+
const fieldContext = React.useContext(FormFieldContext);
|
|
45
|
+
const itemContext = React.useContext(FormItemContext);
|
|
46
|
+
const { getFieldState, formState } = useFormContext();
|
|
47
|
+
|
|
48
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
49
|
+
|
|
50
|
+
if (!fieldContext) {
|
|
51
|
+
throw new Error('useFormField should be used within <FormField>');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { id } = itemContext;
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
id,
|
|
58
|
+
name: fieldContext.name,
|
|
59
|
+
formItemId: `${id}-form-item`,
|
|
60
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
61
|
+
formMessageId: `${id}-form-item-message`,
|
|
62
|
+
...fieldState,
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
type FormItemContextValue = {
|
|
67
|
+
id: string
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const FormItemContext = React.createContext<FormItemContextValue>(
|
|
71
|
+
{} as FormItemContextValue
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const FormItem = React.forwardRef<
|
|
75
|
+
HTMLDivElement,
|
|
76
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
77
|
+
>(({ className, ...props }, ref) => {
|
|
78
|
+
const id = React.useId();
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<FormItemContext.Provider value={{ id }}>
|
|
82
|
+
<div ref={ref} className={cn('space-y-2', className)} {...props} />
|
|
83
|
+
</FormItemContext.Provider>
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
FormItem.displayName = 'FormItem';
|
|
87
|
+
|
|
88
|
+
const FormLabel = React.forwardRef<
|
|
89
|
+
React.ElementRef<typeof LabelPrimitive.Root>,
|
|
90
|
+
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
|
|
91
|
+
>(({ className, ...props }, ref) => {
|
|
92
|
+
const { error, formItemId } = useFormField();
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<Label
|
|
96
|
+
ref={ref}
|
|
97
|
+
className={cn(error && 'text-destructive', className)}
|
|
98
|
+
htmlFor={formItemId}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
});
|
|
103
|
+
FormLabel.displayName = 'FormLabel';
|
|
104
|
+
|
|
105
|
+
const FormControl = React.forwardRef<
|
|
106
|
+
React.ElementRef<typeof Slot>,
|
|
107
|
+
React.ComponentPropsWithoutRef<typeof Slot>
|
|
108
|
+
>(({ ...props }, ref) => {
|
|
109
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<Slot
|
|
113
|
+
ref={ref}
|
|
114
|
+
id={formItemId}
|
|
115
|
+
aria-describedby={
|
|
116
|
+
!error
|
|
117
|
+
? `${formDescriptionId}`
|
|
118
|
+
: `${formDescriptionId} ${formMessageId}`
|
|
119
|
+
}
|
|
120
|
+
aria-invalid={!!error}
|
|
121
|
+
{...props}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
});
|
|
125
|
+
FormControl.displayName = 'FormControl';
|
|
126
|
+
|
|
127
|
+
const FormDescription = React.forwardRef<
|
|
128
|
+
HTMLParagraphElement,
|
|
129
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
|
130
|
+
>(({ className, ...props }, ref) => {
|
|
131
|
+
const { formDescriptionId } = useFormField();
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<p
|
|
135
|
+
ref={ref}
|
|
136
|
+
id={formDescriptionId}
|
|
137
|
+
className={cn('text-sm text-muted-foreground', className)}
|
|
138
|
+
{...props}
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
FormDescription.displayName = 'FormDescription';
|
|
143
|
+
|
|
144
|
+
const FormMessage = React.forwardRef<
|
|
145
|
+
HTMLParagraphElement,
|
|
146
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
|
147
|
+
>(({ className, children, ...props }, ref) => {
|
|
148
|
+
const { error, formMessageId } = useFormField();
|
|
149
|
+
const body = error ? String(error?.message) : children;
|
|
150
|
+
|
|
151
|
+
if (!body) {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<p
|
|
157
|
+
ref={ref}
|
|
158
|
+
id={formMessageId}
|
|
159
|
+
className={cn('text-sm font-medium text-destructive', className)}
|
|
160
|
+
{...props}
|
|
161
|
+
>
|
|
162
|
+
{body}
|
|
163
|
+
</p>
|
|
164
|
+
);
|
|
165
|
+
});
|
|
166
|
+
FormMessage.displayName = 'FormMessage';
|
|
167
|
+
|
|
168
|
+
export {
|
|
169
|
+
useForm,
|
|
170
|
+
useFormField,
|
|
171
|
+
Form,
|
|
172
|
+
FormItem,
|
|
173
|
+
FormLabel,
|
|
174
|
+
FormControl,
|
|
175
|
+
FormDescription,
|
|
176
|
+
FormMessage,
|
|
177
|
+
FormField,
|
|
178
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card"
|
|
5
|
+
|
|
6
|
+
import { cn } from "./lib/utils"
|
|
7
|
+
|
|
8
|
+
const HoverCard = HoverCardPrimitive.Root
|
|
9
|
+
|
|
10
|
+
const HoverCardTrigger = HoverCardPrimitive.Trigger
|
|
11
|
+
|
|
12
|
+
const HoverCardContent = React.forwardRef<
|
|
13
|
+
React.ElementRef<typeof HoverCardPrimitive.Content>,
|
|
14
|
+
React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>
|
|
15
|
+
>(({ id, className, side = "bottom", align = "center", sideOffset = 4, ...props }, ref) => (
|
|
16
|
+
<HoverCardPrimitive.Content
|
|
17
|
+
ref={ref}
|
|
18
|
+
id={id}
|
|
19
|
+
align={align}
|
|
20
|
+
side={side}
|
|
21
|
+
sideOffset={sideOffset}
|
|
22
|
+
className={cn(
|
|
23
|
+
"z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
))
|
|
29
|
+
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName
|
|
30
|
+
|
|
31
|
+
export { HoverCard, HoverCardTrigger, HoverCardContent }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
5
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
6
|
+
|
|
7
|
+
import { cn } from './lib/utils';
|
|
8
|
+
|
|
9
|
+
const labelVariants = cva(
|
|
10
|
+
'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
const Label = React.forwardRef<
|
|
14
|
+
React.ElementRef<typeof LabelPrimitive.Root>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
|
|
16
|
+
VariantProps<typeof labelVariants>
|
|
17
|
+
>(({ className, ...props }, ref) => (
|
|
18
|
+
<LabelPrimitive.Root
|
|
19
|
+
ref={ref}
|
|
20
|
+
className={cn(labelVariants(), className)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
));
|
|
24
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
25
|
+
|
|
26
|
+
export { Label };
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as MenubarPrimitive from "@radix-ui/react-menubar"
|
|
5
|
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "./lib/utils"
|
|
8
|
+
|
|
9
|
+
const MenubarMenu = MenubarPrimitive.Menu
|
|
10
|
+
|
|
11
|
+
const MenubarGroup = MenubarPrimitive.Group
|
|
12
|
+
|
|
13
|
+
const MenubarPortal = MenubarPrimitive.Portal
|
|
14
|
+
|
|
15
|
+
const MenubarSub = MenubarPrimitive.Sub
|
|
16
|
+
|
|
17
|
+
const MenubarRadioGroup = MenubarPrimitive.RadioGroup
|
|
18
|
+
|
|
19
|
+
const Menubar = React.forwardRef<
|
|
20
|
+
React.ElementRef<typeof MenubarPrimitive.Root>,
|
|
21
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>
|
|
22
|
+
>(({ id, className, ...props }, ref) => (
|
|
23
|
+
<MenubarPrimitive.Root
|
|
24
|
+
ref={ref}
|
|
25
|
+
id={id}
|
|
26
|
+
className={cn(
|
|
27
|
+
"flex h-10 items-center space-x-1 rounded-md border bg-background p-1",
|
|
28
|
+
className
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
))
|
|
33
|
+
Menubar.displayName = MenubarPrimitive.Root.displayName
|
|
34
|
+
|
|
35
|
+
const MenubarTrigger = React.forwardRef<
|
|
36
|
+
React.ElementRef<typeof MenubarPrimitive.Trigger>,
|
|
37
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>
|
|
38
|
+
>(({ id, className, ...props }, ref) => (
|
|
39
|
+
<MenubarPrimitive.Trigger
|
|
40
|
+
ref={ref}
|
|
41
|
+
id={id}
|
|
42
|
+
className={cn(
|
|
43
|
+
"flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
|
44
|
+
className
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
))
|
|
49
|
+
MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName
|
|
50
|
+
|
|
51
|
+
const MenubarSubTrigger = React.forwardRef<
|
|
52
|
+
React.ElementRef<typeof MenubarPrimitive.SubTrigger>,
|
|
53
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & {
|
|
54
|
+
inset?: boolean
|
|
55
|
+
}
|
|
56
|
+
>(({ id, className, inset, children, ...props }, ref) => (
|
|
57
|
+
<MenubarPrimitive.SubTrigger
|
|
58
|
+
ref={ref}
|
|
59
|
+
id={id}
|
|
60
|
+
className={cn(
|
|
61
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
|
62
|
+
inset && "pl-8",
|
|
63
|
+
className
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
>
|
|
67
|
+
{children}
|
|
68
|
+
<ChevronRight className="ml-auto h-4 w-4" />
|
|
69
|
+
</MenubarPrimitive.SubTrigger>
|
|
70
|
+
))
|
|
71
|
+
MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName
|
|
72
|
+
|
|
73
|
+
const MenubarSubContent = React.forwardRef<
|
|
74
|
+
React.ElementRef<typeof MenubarPrimitive.SubContent>,
|
|
75
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent>
|
|
76
|
+
>(({ id, className, ...props }, ref) => (
|
|
77
|
+
<MenubarPrimitive.SubContent
|
|
78
|
+
ref={ref}
|
|
79
|
+
id={id}
|
|
80
|
+
className={cn(
|
|
81
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
82
|
+
className
|
|
83
|
+
)}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
))
|
|
87
|
+
MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName
|
|
88
|
+
|
|
89
|
+
const MenubarContent = React.forwardRef<
|
|
90
|
+
React.ElementRef<typeof MenubarPrimitive.Content>,
|
|
91
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>
|
|
92
|
+
>(
|
|
93
|
+
(
|
|
94
|
+
{ id, className, align = "start", alignOffset = -4, sideOffset = 8, ...props },
|
|
95
|
+
ref
|
|
96
|
+
) => (
|
|
97
|
+
<MenubarPrimitive.Portal>
|
|
98
|
+
<MenubarPrimitive.Content
|
|
99
|
+
ref={ref}
|
|
100
|
+
id={id}
|
|
101
|
+
align={align}
|
|
102
|
+
alignOffset={alignOffset}
|
|
103
|
+
sideOffset={sideOffset}
|
|
104
|
+
className={cn(
|
|
105
|
+
"z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
106
|
+
className
|
|
107
|
+
)}
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
110
|
+
</MenubarPrimitive.Portal>
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
MenubarContent.displayName = MenubarPrimitive.Content.displayName
|
|
114
|
+
|
|
115
|
+
const MenubarItem = React.forwardRef<
|
|
116
|
+
React.ElementRef<typeof MenubarPrimitive.Item>,
|
|
117
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & {
|
|
118
|
+
inset?: boolean
|
|
119
|
+
}
|
|
120
|
+
>(({ id, className, inset, ...props }, ref) => (
|
|
121
|
+
<MenubarPrimitive.Item
|
|
122
|
+
ref={ref}
|
|
123
|
+
id={id}
|
|
124
|
+
className={cn(
|
|
125
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
126
|
+
inset && "pl-8",
|
|
127
|
+
className
|
|
128
|
+
)}
|
|
129
|
+
{...props}
|
|
130
|
+
/>
|
|
131
|
+
))
|
|
132
|
+
MenubarItem.displayName = MenubarPrimitive.Item.displayName
|
|
133
|
+
|
|
134
|
+
const MenubarCheckboxItem = React.forwardRef<
|
|
135
|
+
React.ElementRef<typeof MenubarPrimitive.CheckboxItem>,
|
|
136
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem>
|
|
137
|
+
>(({ id, className, children, checked, ...props }, ref) => (
|
|
138
|
+
<MenubarPrimitive.CheckboxItem
|
|
139
|
+
ref={ref}
|
|
140
|
+
id={id}
|
|
141
|
+
className={cn(
|
|
142
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
143
|
+
className
|
|
144
|
+
)}
|
|
145
|
+
checked={checked}
|
|
146
|
+
{...props}
|
|
147
|
+
>
|
|
148
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
149
|
+
<MenubarPrimitive.ItemIndicator>
|
|
150
|
+
<Check className="h-4 w-4" />
|
|
151
|
+
</MenubarPrimitive.ItemIndicator>
|
|
152
|
+
</span>
|
|
153
|
+
{children}
|
|
154
|
+
</MenubarPrimitive.CheckboxItem>
|
|
155
|
+
))
|
|
156
|
+
MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName
|
|
157
|
+
|
|
158
|
+
const MenubarRadioItem = React.forwardRef<
|
|
159
|
+
React.ElementRef<typeof MenubarPrimitive.RadioItem>,
|
|
160
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem>
|
|
161
|
+
>(({ id, className, children, ...props }, ref) => (
|
|
162
|
+
<MenubarPrimitive.RadioItem
|
|
163
|
+
ref={ref}
|
|
164
|
+
id={id}
|
|
165
|
+
className={cn(
|
|
166
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
167
|
+
className
|
|
168
|
+
)}
|
|
169
|
+
{...props}
|
|
170
|
+
>
|
|
171
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
172
|
+
<MenubarPrimitive.ItemIndicator>
|
|
173
|
+
<Circle className="h-2 w-2 fill-current" />
|
|
174
|
+
</MenubarPrimitive.ItemIndicator>
|
|
175
|
+
</span>
|
|
176
|
+
{children}
|
|
177
|
+
</MenubarPrimitive.RadioItem>
|
|
178
|
+
))
|
|
179
|
+
MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName
|
|
180
|
+
|
|
181
|
+
const MenubarLabel = React.forwardRef<
|
|
182
|
+
React.ElementRef<typeof MenubarPrimitive.Label>,
|
|
183
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Label> & {
|
|
184
|
+
inset?: boolean
|
|
185
|
+
}
|
|
186
|
+
>(({ id, className, inset, ...props }, ref) => (
|
|
187
|
+
<MenubarPrimitive.Label
|
|
188
|
+
ref={ref}
|
|
189
|
+
id={id}
|
|
190
|
+
className={cn(
|
|
191
|
+
"px-2 py-1.5 text-sm font-semibold",
|
|
192
|
+
inset && "pl-8",
|
|
193
|
+
className
|
|
194
|
+
)}
|
|
195
|
+
{...props}
|
|
196
|
+
/>
|
|
197
|
+
))
|
|
198
|
+
MenubarLabel.displayName = MenubarPrimitive.Label.displayName
|
|
199
|
+
|
|
200
|
+
const MenubarSeparator = React.forwardRef<
|
|
201
|
+
React.ElementRef<typeof MenubarPrimitive.Separator>,
|
|
202
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator>
|
|
203
|
+
>(({ id, className, ...props }, ref) => (
|
|
204
|
+
<MenubarPrimitive.Separator
|
|
205
|
+
ref={ref}
|
|
206
|
+
id={id}
|
|
207
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
208
|
+
{...props}
|
|
209
|
+
/>
|
|
210
|
+
))
|
|
211
|
+
MenubarSeparator.displayName = MenubarPrimitive.Separator.displayName
|
|
212
|
+
|
|
213
|
+
const MenubarShortcut = ({
|
|
214
|
+
id,
|
|
215
|
+
className,
|
|
216
|
+
...props
|
|
217
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
218
|
+
return (
|
|
219
|
+
<span
|
|
220
|
+
id={id}
|
|
221
|
+
className={cn(
|
|
222
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
223
|
+
className
|
|
224
|
+
)}
|
|
225
|
+
{...props}
|
|
226
|
+
/>
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
MenubarShortcut.displayname = "MenubarShortcut"
|
|
230
|
+
|
|
231
|
+
export {
|
|
232
|
+
Menubar,
|
|
233
|
+
MenubarMenu,
|
|
234
|
+
MenubarTrigger,
|
|
235
|
+
MenubarContent,
|
|
236
|
+
MenubarItem,
|
|
237
|
+
MenubarSeparator,
|
|
238
|
+
MenubarLabel,
|
|
239
|
+
MenubarCheckboxItem,
|
|
240
|
+
MenubarRadioGroup,
|
|
241
|
+
MenubarRadioItem,
|
|
242
|
+
MenubarPortal,
|
|
243
|
+
MenubarSubContent,
|
|
244
|
+
MenubarSubTrigger,
|
|
245
|
+
MenubarGroup,
|
|
246
|
+
MenubarSub,
|
|
247
|
+
MenubarShortcut,
|
|
248
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as SwitchPrimitives from "@radix-ui/react-switch"
|
|
5
|
+
|
|
6
|
+
import { cn } from "./lib/utils"
|
|
7
|
+
|
|
8
|
+
const Switch = React.forwardRef<
|
|
9
|
+
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
10
|
+
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
|
|
11
|
+
>(({ className, ...props }, ref) => (
|
|
12
|
+
<SwitchPrimitives.Root
|
|
13
|
+
className={cn(
|
|
14
|
+
'switch-root',
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
ref={ref}
|
|
19
|
+
>
|
|
20
|
+
<SwitchPrimitives.Thumb className="switch-thumb" />
|
|
21
|
+
</SwitchPrimitives.Root>
|
|
22
|
+
))
|
|
23
|
+
Switch.displayName = SwitchPrimitives.Root.displayName
|
|
24
|
+
|
|
25
|
+
export { Switch }
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "./lib/utils"
|
|
4
|
+
|
|
5
|
+
const Table = React.forwardRef<
|
|
6
|
+
HTMLTableElement,
|
|
7
|
+
React.HTMLAttributes<HTMLTableElement>
|
|
8
|
+
>(({ className, ...props }, ref) => (
|
|
9
|
+
<div className="relative w-full overflow-auto">
|
|
10
|
+
<table
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn("w-full caption-bottom text-sm", className)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
16
|
+
))
|
|
17
|
+
Table.displayName = "Table"
|
|
18
|
+
|
|
19
|
+
const TableHeader = React.forwardRef<
|
|
20
|
+
HTMLTableSectionElement,
|
|
21
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
22
|
+
>(({ className, ...props }, ref) => (
|
|
23
|
+
<thead ref={ref} className={cn(className)} {...props} />
|
|
24
|
+
))
|
|
25
|
+
TableHeader.displayName = "TableHeader"
|
|
26
|
+
|
|
27
|
+
const TableBody = React.forwardRef<
|
|
28
|
+
HTMLTableSectionElement,
|
|
29
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
30
|
+
>(({ className, ...props }, ref) => (
|
|
31
|
+
<tbody
|
|
32
|
+
ref={ref}
|
|
33
|
+
className={cn("[&_tr:last-child]:border-0", className)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
))
|
|
37
|
+
TableBody.displayName = "TableBody"
|
|
38
|
+
|
|
39
|
+
const TableFooter = React.forwardRef<
|
|
40
|
+
HTMLTableSectionElement,
|
|
41
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
42
|
+
>(({ className, ...props }, ref) => (
|
|
43
|
+
<tfoot
|
|
44
|
+
ref={ref}
|
|
45
|
+
className={cn(
|
|
46
|
+
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
47
|
+
className
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
))
|
|
52
|
+
TableFooter.displayName = "TableFooter"
|
|
53
|
+
|
|
54
|
+
const TableRow = React.forwardRef<
|
|
55
|
+
HTMLTableRowElement,
|
|
56
|
+
React.HTMLAttributes<HTMLTableRowElement>
|
|
57
|
+
>(({ className, ...props }, ref) => (
|
|
58
|
+
<tr
|
|
59
|
+
ref={ref}
|
|
60
|
+
className={cn(
|
|
61
|
+
"transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
62
|
+
className
|
|
63
|
+
)}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
))
|
|
67
|
+
TableRow.displayName = "TableRow"
|
|
68
|
+
|
|
69
|
+
const TableHead = React.forwardRef<
|
|
70
|
+
HTMLTableCellElement,
|
|
71
|
+
React.ThHTMLAttributes<HTMLTableCellElement>
|
|
72
|
+
>(({ className, ...props }, ref) => (
|
|
73
|
+
<th
|
|
74
|
+
ref={ref}
|
|
75
|
+
className={cn(
|
|
76
|
+
"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
|
|
77
|
+
className
|
|
78
|
+
)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
))
|
|
82
|
+
TableHead.displayName = "TableHead"
|
|
83
|
+
|
|
84
|
+
const TableCell = React.forwardRef<
|
|
85
|
+
HTMLTableCellElement,
|
|
86
|
+
React.TdHTMLAttributes<HTMLTableCellElement>
|
|
87
|
+
>(({ className, ...props }, ref) => (
|
|
88
|
+
<td
|
|
89
|
+
ref={ref}
|
|
90
|
+
className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)}
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
))
|
|
94
|
+
TableCell.displayName = "TableCell"
|
|
95
|
+
|
|
96
|
+
const TableCaption = React.forwardRef<
|
|
97
|
+
HTMLTableCaptionElement,
|
|
98
|
+
React.HTMLAttributes<HTMLTableCaptionElement>
|
|
99
|
+
>(({ className, ...props }, ref) => (
|
|
100
|
+
<caption
|
|
101
|
+
ref={ref}
|
|
102
|
+
className={cn("mt-4 text-sm text-muted-foreground", className)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
))
|
|
106
|
+
TableCaption.displayName = "TableCaption"
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
Table,
|
|
110
|
+
TableHeader,
|
|
111
|
+
TableBody,
|
|
112
|
+
TableFooter,
|
|
113
|
+
TableHead,
|
|
114
|
+
TableRow,
|
|
115
|
+
TableCell,
|
|
116
|
+
TableCaption,
|
|
117
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs"
|
|
5
|
+
|
|
6
|
+
import { cn } from "./lib/utils"
|
|
7
|
+
|
|
8
|
+
const Tabs = TabsPrimitive.Root
|
|
9
|
+
|
|
10
|
+
const TabsList = React.forwardRef<
|
|
11
|
+
React.ElementRef<typeof TabsPrimitive.List>,
|
|
12
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
|
13
|
+
>(({ className, ...props }, ref) => (
|
|
14
|
+
<TabsPrimitive.List
|
|
15
|
+
ref={ref}
|
|
16
|
+
className={cn(
|
|
17
|
+
"inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
))
|
|
23
|
+
TabsList.displayName = TabsPrimitive.List.displayName
|
|
24
|
+
|
|
25
|
+
const TabsTrigger = React.forwardRef<
|
|
26
|
+
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
|
27
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
|
28
|
+
>(({ className, ...props }, ref) => (
|
|
29
|
+
<TabsPrimitive.Trigger
|
|
30
|
+
ref={ref}
|
|
31
|
+
className={cn(
|
|
32
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
33
|
+
className
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
))
|
|
38
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
|
|
39
|
+
|
|
40
|
+
const TabsContent = React.forwardRef<
|
|
41
|
+
React.ElementRef<typeof TabsPrimitive.Content>,
|
|
42
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
|
|
43
|
+
>(({ className, ...props }, ref) => (
|
|
44
|
+
<TabsPrimitive.Content
|
|
45
|
+
ref={ref}
|
|
46
|
+
className={cn(
|
|
47
|
+
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
48
|
+
className
|
|
49
|
+
)}
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
))
|
|
53
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName
|
|
54
|
+
|
|
55
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent }
|