@luanthnh/cntt-ui 0.1.5

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.
Files changed (255) hide show
  1. package/.storybook/globals.d.ts +1 -0
  2. package/.storybook/main.ts +29 -0
  3. package/.storybook/preview.ts +32 -0
  4. package/README.md +86 -0
  5. package/assets/fonts/Montserrat-Black.eot +0 -0
  6. package/assets/fonts/Montserrat-Black.ttf +0 -0
  7. package/assets/fonts/Montserrat-Black.woff +0 -0
  8. package/assets/fonts/Montserrat-Black.woff2 +0 -0
  9. package/assets/fonts/Montserrat-BlackItalic.eot +0 -0
  10. package/assets/fonts/Montserrat-BlackItalic.ttf +0 -0
  11. package/assets/fonts/Montserrat-BlackItalic.woff +0 -0
  12. package/assets/fonts/Montserrat-BlackItalic.woff2 +0 -0
  13. package/assets/fonts/Montserrat-Bold.eot +0 -0
  14. package/assets/fonts/Montserrat-Bold.ttf +0 -0
  15. package/assets/fonts/Montserrat-Bold.woff +0 -0
  16. package/assets/fonts/Montserrat-Bold.woff2 +0 -0
  17. package/assets/fonts/Montserrat-BoldItalic.eot +0 -0
  18. package/assets/fonts/Montserrat-BoldItalic.ttf +0 -0
  19. package/assets/fonts/Montserrat-BoldItalic.woff +0 -0
  20. package/assets/fonts/Montserrat-BoldItalic.woff2 +0 -0
  21. package/assets/fonts/Montserrat-ExtraBold.eot +0 -0
  22. package/assets/fonts/Montserrat-ExtraBold.ttf +0 -0
  23. package/assets/fonts/Montserrat-ExtraBold.woff +0 -0
  24. package/assets/fonts/Montserrat-ExtraBold.woff2 +0 -0
  25. package/assets/fonts/Montserrat-ExtraBoldItalic.eot +0 -0
  26. package/assets/fonts/Montserrat-ExtraBoldItalic.ttf +0 -0
  27. package/assets/fonts/Montserrat-ExtraBoldItalic.woff +0 -0
  28. package/assets/fonts/Montserrat-ExtraBoldItalic.woff2 +0 -0
  29. package/assets/fonts/Montserrat-ExtraLight.eot +0 -0
  30. package/assets/fonts/Montserrat-ExtraLight.ttf +0 -0
  31. package/assets/fonts/Montserrat-ExtraLight.woff +0 -0
  32. package/assets/fonts/Montserrat-ExtraLight.woff2 +0 -0
  33. package/assets/fonts/Montserrat-ExtraLightItalic.eot +0 -0
  34. package/assets/fonts/Montserrat-ExtraLightItalic.ttf +0 -0
  35. package/assets/fonts/Montserrat-ExtraLightItalic.woff +0 -0
  36. package/assets/fonts/Montserrat-ExtraLightItalic.woff2 +0 -0
  37. package/assets/fonts/Montserrat-Italic.eot +0 -0
  38. package/assets/fonts/Montserrat-Italic.ttf +0 -0
  39. package/assets/fonts/Montserrat-Italic.woff +0 -0
  40. package/assets/fonts/Montserrat-Italic.woff2 +0 -0
  41. package/assets/fonts/Montserrat-Light.eot +0 -0
  42. package/assets/fonts/Montserrat-Light.ttf +0 -0
  43. package/assets/fonts/Montserrat-Light.woff +0 -0
  44. package/assets/fonts/Montserrat-Light.woff2 +0 -0
  45. package/assets/fonts/Montserrat-LightItalic.eot +0 -0
  46. package/assets/fonts/Montserrat-LightItalic.ttf +0 -0
  47. package/assets/fonts/Montserrat-LightItalic.woff +0 -0
  48. package/assets/fonts/Montserrat-LightItalic.woff2 +0 -0
  49. package/assets/fonts/Montserrat-Medium.eot +0 -0
  50. package/assets/fonts/Montserrat-Medium.ttf +0 -0
  51. package/assets/fonts/Montserrat-Medium.woff +0 -0
  52. package/assets/fonts/Montserrat-Medium.woff2 +0 -0
  53. package/assets/fonts/Montserrat-MediumItalic.eot +0 -0
  54. package/assets/fonts/Montserrat-MediumItalic.ttf +0 -0
  55. package/assets/fonts/Montserrat-MediumItalic.woff +0 -0
  56. package/assets/fonts/Montserrat-MediumItalic.woff2 +0 -0
  57. package/assets/fonts/Montserrat-Regular.eot +0 -0
  58. package/assets/fonts/Montserrat-Regular.ttf +0 -0
  59. package/assets/fonts/Montserrat-Regular.woff +0 -0
  60. package/assets/fonts/Montserrat-Regular.woff2 +0 -0
  61. package/assets/fonts/Montserrat-SemiBold.eot +0 -0
  62. package/assets/fonts/Montserrat-SemiBold.ttf +0 -0
  63. package/assets/fonts/Montserrat-SemiBold.woff +0 -0
  64. package/assets/fonts/Montserrat-SemiBold.woff2 +0 -0
  65. package/assets/fonts/Montserrat-SemiBoldItalic.eot +0 -0
  66. package/assets/fonts/Montserrat-SemiBoldItalic.ttf +0 -0
  67. package/assets/fonts/Montserrat-SemiBoldItalic.woff +0 -0
  68. package/assets/fonts/Montserrat-SemiBoldItalic.woff2 +0 -0
  69. package/assets/fonts/Montserrat-Thin.eot +0 -0
  70. package/assets/fonts/Montserrat-Thin.ttf +0 -0
  71. package/assets/fonts/Montserrat-Thin.woff +0 -0
  72. package/assets/fonts/Montserrat-Thin.woff2 +0 -0
  73. package/assets/fonts/Montserrat-ThinItalic.eot +0 -0
  74. package/assets/fonts/Montserrat-ThinItalic.ttf +0 -0
  75. package/assets/fonts/Montserrat-ThinItalic.woff +0 -0
  76. package/assets/fonts/Montserrat-ThinItalic.woff2 +0 -0
  77. package/assets/fonts/Montserrat-Variable.eot +0 -0
  78. package/assets/fonts/Montserrat-Variable.ttf +0 -0
  79. package/assets/fonts/Montserrat-Variable.woff +0 -0
  80. package/assets/fonts/Montserrat-Variable.woff2 +0 -0
  81. package/assets/fonts/Montserrat-VariableItalic.eot +0 -0
  82. package/assets/fonts/Montserrat-VariableItalic.ttf +0 -0
  83. package/assets/fonts/Montserrat-VariableItalic.woff +0 -0
  84. package/assets/fonts/Montserrat-VariableItalic.woff2 +0 -0
  85. package/assets/icons/arrow-left.svg +1 -0
  86. package/assets/icons/file.svg +1 -0
  87. package/assets/icons/globe.svg +1 -0
  88. package/assets/icons/logo-line.svg +1 -0
  89. package/assets/icons/next.svg +1 -0
  90. package/assets/icons/panel-left-expand.svg +1 -0
  91. package/assets/icons/placeholder.svg +57 -0
  92. package/assets/icons/vercel.svg +1 -0
  93. package/assets/icons/window.svg +1 -0
  94. package/assets/lotties/error-404.json +19642 -0
  95. package/assets/lotties/error.json +2414 -0
  96. package/assets/lotties/loader.json +305 -0
  97. package/components/Welcome.mdx +74 -0
  98. package/components/lenis/index.tsx +48 -0
  99. package/components/motion/auto-height.tsx +56 -0
  100. package/components/motion/cursor.tsx +108 -0
  101. package/components/motion/highlight.tsx +605 -0
  102. package/components/motion/number-ticker.tsx +55 -0
  103. package/components/motion/slot.tsx +106 -0
  104. package/components/motion/waves.tsx +417 -0
  105. package/components/primitives/tabs.tsx +174 -0
  106. package/components/ui/Accordion/index.stories.tsx +39 -0
  107. package/components/ui/Accordion/index.tsx +170 -0
  108. package/components/ui/Alert/index.stories.tsx +39 -0
  109. package/components/ui/Alert/index.tsx +60 -0
  110. package/components/ui/AlertDialog/index.stories.tsx +47 -0
  111. package/components/ui/AlertDialog/index.tsx +172 -0
  112. package/components/ui/AspectRatio/index.stories.tsx +40 -0
  113. package/components/ui/AspectRatio/index.tsx +9 -0
  114. package/components/ui/Avatar/index.stories.tsx +39 -0
  115. package/components/ui/Avatar/index.tsx +44 -0
  116. package/components/ui/Badge/index.stories.tsx +64 -0
  117. package/components/ui/Badge/index.tsx +46 -0
  118. package/components/ui/Breadcrumb/index.stories.tsx +64 -0
  119. package/components/ui/Breadcrumb/index.tsx +102 -0
  120. package/components/ui/Button/index.stories.tsx +232 -0
  121. package/components/ui/Button/index.tsx +114 -0
  122. package/components/ui/Calendar/index.stories.tsx +20 -0
  123. package/components/ui/Calendar/index.tsx +149 -0
  124. package/components/ui/Card/index.stories.tsx +39 -0
  125. package/components/ui/Card/index.tsx +65 -0
  126. package/components/ui/Carousel/index.stories.tsx +37 -0
  127. package/components/ui/Carousel/index.tsx +242 -0
  128. package/components/ui/Chart/index.stories.tsx +53 -0
  129. package/components/ui/Chart/index.tsx +322 -0
  130. package/components/ui/Checkbox/index.stories.tsx +56 -0
  131. package/components/ui/Checkbox/index.tsx +167 -0
  132. package/components/ui/CircleProcess/index.stories.tsx +29 -0
  133. package/components/ui/CircleProcess/index.tsx +50 -0
  134. package/components/ui/Collapsible/index.stories.tsx +33 -0
  135. package/components/ui/Collapsible/index.tsx +124 -0
  136. package/components/ui/Command/index.stories.tsx +65 -0
  137. package/components/ui/Command/index.tsx +161 -0
  138. package/components/ui/Container/index.stories.tsx +22 -0
  139. package/components/ui/Container/index.tsx +30 -0
  140. package/components/ui/ContextMenu/index.stories.tsx +51 -0
  141. package/components/ui/ContextMenu/index.tsx +224 -0
  142. package/components/ui/Dialog/index.stories.tsx +44 -0
  143. package/components/ui/Dialog/index.tsx +156 -0
  144. package/components/ui/Drawer/index.stories.tsx +54 -0
  145. package/components/ui/Drawer/index.tsx +124 -0
  146. package/components/ui/DropdownMenu/index.stories.tsx +83 -0
  147. package/components/ui/DropdownMenu/index.tsx +231 -0
  148. package/components/ui/Dropzone/index.stories.tsx +18 -0
  149. package/components/ui/Dropzone/index.tsx +47 -0
  150. package/components/ui/Form/date-field.tsx +77 -0
  151. package/components/ui/Form/index.stories.tsx +67 -0
  152. package/components/ui/Form/index.tsx +188 -0
  153. package/components/ui/Form/select-field.tsx +55 -0
  154. package/components/ui/Form/text-area-field.tsx +37 -0
  155. package/components/ui/Form/text-field.tsx +72 -0
  156. package/components/ui/HStack/index.stories.tsx +48 -0
  157. package/components/ui/HStack/index.tsx +73 -0
  158. package/components/ui/HoverCard/index.stories.tsx +38 -0
  159. package/components/ui/HoverCard/index.tsx +38 -0
  160. package/components/ui/Icons/index.stories.tsx +27 -0
  161. package/components/ui/Icons/index.tsx +33 -0
  162. package/components/ui/ImageWithFallback/index.stories.tsx +32 -0
  163. package/components/ui/ImageWithFallback/index.tsx +34 -0
  164. package/components/ui/Input/index.stories.tsx +47 -0
  165. package/components/ui/Input/index.tsx +21 -0
  166. package/components/ui/InputOtp/index.stories.tsx +35 -0
  167. package/components/ui/InputOtp/index.tsx +70 -0
  168. package/components/ui/Label/index.stories.tsx +18 -0
  169. package/components/ui/Label/index.tsx +21 -0
  170. package/components/ui/Marquee/index.stories.tsx +71 -0
  171. package/components/ui/Marquee/index.tsx +65 -0
  172. package/components/ui/Menubar/index.stories.tsx +116 -0
  173. package/components/ui/Menubar/index.tsx +252 -0
  174. package/components/ui/NavigationMenu/index.stories.tsx +112 -0
  175. package/components/ui/NavigationMenu/index.tsx +185 -0
  176. package/components/ui/NoData/index.stories.tsx +24 -0
  177. package/components/ui/NoData/index.tsx +19 -0
  178. package/components/ui/Pagination/index.stories.tsx +53 -0
  179. package/components/ui/Pagination/index.tsx +114 -0
  180. package/components/ui/Popover/index.stories.tsx +31 -0
  181. package/components/ui/Popover/index.tsx +42 -0
  182. package/components/ui/Progress/index.stories.tsx +35 -0
  183. package/components/ui/Progress/index.tsx +28 -0
  184. package/components/ui/RadioGroup/index.stories.tsx +28 -0
  185. package/components/ui/RadioGroup/index.tsx +45 -0
  186. package/components/ui/Resizable/index.stories.tsx +44 -0
  187. package/components/ui/Resizable/index.tsx +54 -0
  188. package/components/ui/ScrollArea/index.stories.tsx +31 -0
  189. package/components/ui/ScrollArea/index.tsx +56 -0
  190. package/components/ui/Select/index.stories.tsx +64 -0
  191. package/components/ui/Select/index.tsx +170 -0
  192. package/components/ui/Separator/index.stories.tsx +31 -0
  193. package/components/ui/Separator/index.tsx +28 -0
  194. package/components/ui/Sheet/index.stories.tsx +45 -0
  195. package/components/ui/Sheet/index.tsx +130 -0
  196. package/components/ui/Sidebar/index.stories.tsx +82 -0
  197. package/components/ui/Sidebar/index.tsx +676 -0
  198. package/components/ui/Skeleton/index.stories.tsx +36 -0
  199. package/components/ui/Skeleton/index.tsx +13 -0
  200. package/components/ui/Slider/index.stories.tsx +48 -0
  201. package/components/ui/Slider/index.tsx +82 -0
  202. package/components/ui/Slot/index.stories.tsx +29 -0
  203. package/components/ui/Slot/index.tsx +106 -0
  204. package/components/ui/Sonner/index.stories.tsx +36 -0
  205. package/components/ui/Sonner/index.tsx +31 -0
  206. package/components/ui/Switch/index.stories.tsx +33 -0
  207. package/components/ui/Switch/index.tsx +28 -0
  208. package/components/ui/Table/index.stories.tsx +74 -0
  209. package/components/ui/Table/index.tsx +95 -0
  210. package/components/ui/Tabs/index.stories.tsx +38 -0
  211. package/components/ui/Tabs/index.tsx +78 -0
  212. package/components/ui/Text/index.stories.tsx +53 -0
  213. package/components/ui/Text/index.tsx +138 -0
  214. package/components/ui/Textarea/index.stories.tsx +25 -0
  215. package/components/ui/Textarea/index.tsx +18 -0
  216. package/components/ui/Toggle/index.stories.tsx +52 -0
  217. package/components/ui/Toggle/index.tsx +46 -0
  218. package/components/ui/ToggleGroup/index.stories.tsx +52 -0
  219. package/components/ui/ToggleGroup/index.tsx +69 -0
  220. package/components/ui/Tooltip/index.stories.tsx +29 -0
  221. package/components/ui/Tooltip/index.tsx +35 -0
  222. package/components/ui/VStack/index.stories.tsx +45 -0
  223. package/components/ui/VStack/index.tsx +69 -0
  224. package/components/ui/colors.stories.tsx +148 -0
  225. package/dist/arrow-left-46B4CAEY.svg +1 -0
  226. package/dist/file-4IXBJF4J.svg +1 -0
  227. package/dist/globe-KVAXBN2U.svg +1 -0
  228. package/dist/index.cjs +6001 -0
  229. package/dist/index.cjs.map +1 -0
  230. package/dist/index.d.cts +693 -0
  231. package/dist/index.d.ts +693 -0
  232. package/dist/index.js +5714 -0
  233. package/dist/index.js.map +1 -0
  234. package/dist/logo-line-QLUD5DAV.svg +1 -0
  235. package/dist/next-HOXZBJQP.svg +1 -0
  236. package/dist/panel-left-expand-SIPFBG4J.svg +1 -0
  237. package/dist/placeholder-H3V4XYVI.svg +57 -0
  238. package/dist/vercel-KFYFHF3A.svg +1 -0
  239. package/dist/window-JNUL4Q2E.svg +1 -0
  240. package/eslint.config.js +10 -0
  241. package/globals.css +994 -0
  242. package/hooks/index.ts +3 -0
  243. package/hooks/use-auto-height.tsx +99 -0
  244. package/hooks/use-controlled-state.tsx +32 -0
  245. package/hooks/use-mobile.ts +19 -0
  246. package/index.ts +58 -0
  247. package/lib/get-strict-context.ts +15 -0
  248. package/lib/utils.ts +10 -0
  249. package/package.json +107 -0
  250. package/scripts/generate-exports.ts +32 -0
  251. package/tsconfig.json +12 -0
  252. package/tsconfig.tsbuildinfo +1 -0
  253. package/tsup.config.ts +11 -0
  254. package/types/svg.d.ts +10 -0
  255. package/vercel.json +5 -0
@@ -0,0 +1,252 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import * as MenubarPrimitive from '@radix-ui/react-menubar';
5
+ import { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
6
+
7
+ import { cn } from '@/lib/utils';
8
+
9
+ function Menubar({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Root>) {
10
+ return (
11
+ <MenubarPrimitive.Root
12
+ data-slot="menubar"
13
+ className={cn(
14
+ 'bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs',
15
+ className,
16
+ )}
17
+ {...props}
18
+ />
19
+ );
20
+ }
21
+
22
+ function MenubarMenu({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Menu>) {
23
+ return <MenubarPrimitive.Menu data-slot="menubar-menu" {...props} />;
24
+ }
25
+
26
+ function MenubarGroup({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Group>) {
27
+ return <MenubarPrimitive.Group data-slot="menubar-group" {...props} />;
28
+ }
29
+
30
+ function MenubarPortal({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Portal>) {
31
+ return <MenubarPrimitive.Portal data-slot="menubar-portal" {...props} />;
32
+ }
33
+
34
+ function MenubarRadioGroup({ ...props }: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {
35
+ return <MenubarPrimitive.RadioGroup data-slot="menubar-radio-group" {...props} />;
36
+ }
37
+
38
+ function MenubarTrigger({
39
+ className,
40
+ ...props
41
+ }: React.ComponentProps<typeof MenubarPrimitive.Trigger>) {
42
+ return (
43
+ <MenubarPrimitive.Trigger
44
+ data-slot="menubar-trigger"
45
+ className={cn(
46
+ 'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none',
47
+ className,
48
+ )}
49
+ {...props}
50
+ />
51
+ );
52
+ }
53
+
54
+ function MenubarContent({
55
+ className,
56
+ align = 'start',
57
+ alignOffset = -4,
58
+ sideOffset = 8,
59
+ ...props
60
+ }: React.ComponentProps<typeof MenubarPrimitive.Content>) {
61
+ return (
62
+ <MenubarPortal>
63
+ <MenubarPrimitive.Content
64
+ data-slot="menubar-content"
65
+ align={align}
66
+ alignOffset={alignOffset}
67
+ sideOffset={sideOffset}
68
+ className={cn(
69
+ 'bg-popover text-popover-foreground 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 z-50 min-w-[12rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-md',
70
+ className,
71
+ )}
72
+ {...props}
73
+ />
74
+ </MenubarPortal>
75
+ );
76
+ }
77
+
78
+ function MenubarItem({
79
+ className,
80
+ inset,
81
+ variant = 'default',
82
+ ...props
83
+ }: React.ComponentProps<typeof MenubarPrimitive.Item> & {
84
+ inset?: boolean;
85
+ variant?: 'default' | 'destructive';
86
+ }) {
87
+ return (
88
+ <MenubarPrimitive.Item
89
+ data-slot="menubar-item"
90
+ data-inset={inset}
91
+ data-variant={variant}
92
+ className={cn(
93
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
94
+ className,
95
+ )}
96
+ {...props}
97
+ />
98
+ );
99
+ }
100
+
101
+ function MenubarCheckboxItem({
102
+ className,
103
+ children,
104
+ checked,
105
+ ...props
106
+ }: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>) {
107
+ return (
108
+ <MenubarPrimitive.CheckboxItem
109
+ data-slot="menubar-checkbox-item"
110
+ className={cn(
111
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
112
+ className,
113
+ )}
114
+ checked={checked}
115
+ {...props}
116
+ >
117
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
118
+ <MenubarPrimitive.ItemIndicator>
119
+ <CheckIcon className="size-4" />
120
+ </MenubarPrimitive.ItemIndicator>
121
+ </span>
122
+ {children}
123
+ </MenubarPrimitive.CheckboxItem>
124
+ );
125
+ }
126
+
127
+ function MenubarRadioItem({
128
+ className,
129
+ children,
130
+ ...props
131
+ }: React.ComponentProps<typeof MenubarPrimitive.RadioItem>) {
132
+ return (
133
+ <MenubarPrimitive.RadioItem
134
+ data-slot="menubar-radio-item"
135
+ className={cn(
136
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
137
+ className,
138
+ )}
139
+ {...props}
140
+ >
141
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
142
+ <MenubarPrimitive.ItemIndicator>
143
+ <CircleIcon className="size-2 fill-current" />
144
+ </MenubarPrimitive.ItemIndicator>
145
+ </span>
146
+ {children}
147
+ </MenubarPrimitive.RadioItem>
148
+ );
149
+ }
150
+
151
+ function MenubarLabel({
152
+ className,
153
+ inset,
154
+ ...props
155
+ }: React.ComponentProps<typeof MenubarPrimitive.Label> & {
156
+ inset?: boolean;
157
+ }) {
158
+ return (
159
+ <MenubarPrimitive.Label
160
+ data-slot="menubar-label"
161
+ data-inset={inset}
162
+ className={cn('px-2 py-1.5 text-sm font-medium data-[inset]:pl-8', className)}
163
+ {...props}
164
+ />
165
+ );
166
+ }
167
+
168
+ function MenubarSeparator({
169
+ className,
170
+ ...props
171
+ }: React.ComponentProps<typeof MenubarPrimitive.Separator>) {
172
+ return (
173
+ <MenubarPrimitive.Separator
174
+ data-slot="menubar-separator"
175
+ className={cn('bg-border -mx-1 my-1 h-px', className)}
176
+ {...props}
177
+ />
178
+ );
179
+ }
180
+
181
+ function MenubarShortcut({ className, ...props }: React.ComponentProps<'span'>) {
182
+ return (
183
+ <span
184
+ data-slot="menubar-shortcut"
185
+ className={cn('text-muted-foreground ml-auto text-xs tracking-widest', className)}
186
+ {...props}
187
+ />
188
+ );
189
+ }
190
+
191
+ function MenubarSub({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Sub>) {
192
+ return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />;
193
+ }
194
+
195
+ function MenubarSubTrigger({
196
+ className,
197
+ inset,
198
+ children,
199
+ ...props
200
+ }: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & {
201
+ inset?: boolean;
202
+ }) {
203
+ return (
204
+ <MenubarPrimitive.SubTrigger
205
+ data-slot="menubar-sub-trigger"
206
+ data-inset={inset}
207
+ className={cn(
208
+ 'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[inset]:pl-8',
209
+ className,
210
+ )}
211
+ {...props}
212
+ >
213
+ {children}
214
+ <ChevronRightIcon className="ml-auto h-4 w-4" />
215
+ </MenubarPrimitive.SubTrigger>
216
+ );
217
+ }
218
+
219
+ function MenubarSubContent({
220
+ className,
221
+ ...props
222
+ }: React.ComponentProps<typeof MenubarPrimitive.SubContent>) {
223
+ return (
224
+ <MenubarPrimitive.SubContent
225
+ data-slot="menubar-sub-content"
226
+ className={cn(
227
+ 'bg-popover 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 z-50 min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg',
228
+ className,
229
+ )}
230
+ {...props}
231
+ />
232
+ );
233
+ }
234
+
235
+ export {
236
+ Menubar,
237
+ MenubarPortal,
238
+ MenubarMenu,
239
+ MenubarTrigger,
240
+ MenubarContent,
241
+ MenubarGroup,
242
+ MenubarSeparator,
243
+ MenubarLabel,
244
+ MenubarItem,
245
+ MenubarShortcut,
246
+ MenubarCheckboxItem,
247
+ MenubarRadioGroup,
248
+ MenubarRadioItem,
249
+ MenubarSub,
250
+ MenubarSubTrigger,
251
+ MenubarSubContent,
252
+ };
@@ -0,0 +1,112 @@
1
+ import React from 'react';
2
+ import Link from 'next/link';
3
+ import type { Meta, StoryObj } from '@storybook/react';
4
+
5
+ import {
6
+ NavigationMenu,
7
+ NavigationMenuContent,
8
+ NavigationMenuItem,
9
+ NavigationMenuLink,
10
+ NavigationMenuList,
11
+ NavigationMenuTrigger,
12
+ } from './index';
13
+
14
+ const meta: Meta<typeof NavigationMenu> = {
15
+ title: 'UI/NavigationMenu',
16
+ component: NavigationMenu,
17
+ tags: ['autodocs'],
18
+ };
19
+
20
+ export default meta;
21
+ type Story = StoryObj<typeof NavigationMenu>;
22
+
23
+ export const Default: Story = {
24
+ render: (args) => (
25
+ <NavigationMenu {...args}>
26
+ <NavigationMenuList>
27
+ <NavigationMenuItem>
28
+ <NavigationMenuTrigger>Item One</NavigationMenuTrigger>
29
+ <NavigationMenuContent>
30
+ <ul className="grid gap-3 p-6 md:w-100 lg:w-125 lg:grid-cols-[.75fr_1fr]">
31
+ <li className="row-span-3">
32
+ <NavigationMenuLink asChild>
33
+ <Link
34
+ className="from-primary/50 to-primary flex h-full w-full flex-col justify-end rounded-md bg-linear-to-b p-6 no-underline outline-none focus:shadow-md"
35
+ href="/"
36
+ >
37
+ <div className="mt-4 mb-2 text-lg font-medium text-white">shadcn/ui</div>
38
+ <p className="text-sm leading-tight text-white/90">
39
+ Beautifully designed components built with Radix UI and Tailwind CSS.
40
+ </p>
41
+ </Link>
42
+ </NavigationMenuLink>
43
+ </li>
44
+ <ListItem href="/" title="Introduction">
45
+ Re-usable components built using Radix UI and Tailwind CSS.
46
+ </ListItem>
47
+ <ListItem href="/" title="Installation">
48
+ How to install dependencies and structure your app.
49
+ </ListItem>
50
+ <ListItem href="/" title="Typography">
51
+ Styles for headings, paragraphs, lists...etc
52
+ </ListItem>
53
+ </ul>
54
+ </NavigationMenuContent>
55
+ </NavigationMenuItem>
56
+ <NavigationMenuItem>
57
+ <NavigationMenuTrigger>Components</NavigationMenuTrigger>
58
+ <NavigationMenuContent>
59
+ <ul className="grid w-100 gap-3 p-4 md:w-125 md:grid-cols-2 lg:w-150">
60
+ <ListItem title="Alert Dialog" href="/">
61
+ A modal dialog that interrupts the user with important content and expects a
62
+ response.
63
+ </ListItem>
64
+ <ListItem title="Hover Card" href="/">
65
+ For sighted users to preview content available behind a link.
66
+ </ListItem>
67
+ <ListItem title="Progress" href="/">
68
+ Displays an indicator showing the completion progress of a task, typically displayed
69
+ as a progress bar.
70
+ </ListItem>
71
+ <ListItem title="Scroll-area" href="/">
72
+ Visually or semantically separates content.
73
+ </ListItem>
74
+ <ListItem title="Tabs" href="/">
75
+ A set of layered sections of content—known as tab panels—that are displayed one at a
76
+ time.
77
+ </ListItem>
78
+ <ListItem title="Tooltip" href="/">
79
+ A popup that displays information related to an element when the element receives
80
+ keyboard focus or the mouse hovers over it.
81
+ </ListItem>
82
+ </ul>
83
+ </NavigationMenuContent>
84
+ </NavigationMenuItem>
85
+ <NavigationMenuItem>
86
+ <NavigationMenuLink href="/">Documentation</NavigationMenuLink>
87
+ </NavigationMenuItem>
88
+ </NavigationMenuList>
89
+ </NavigationMenu>
90
+ ),
91
+ };
92
+
93
+ const ListItem = React.forwardRef<
94
+ React.ElementRef<typeof Link>,
95
+ React.ComponentPropsWithoutRef<typeof Link>
96
+ >(({ title, children, ...props }, ref) => {
97
+ return (
98
+ <li>
99
+ <NavigationMenuLink asChild>
100
+ <Link
101
+ ref={ref}
102
+ className="hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground block space-y-1 rounded-md p-3 leading-none no-underline transition-colors outline-none select-none"
103
+ {...props}
104
+ >
105
+ <div className="text-sm leading-none font-medium">{title}</div>
106
+ <p className="text-muted-foreground line-clamp-2 text-sm leading-snug">{children}</p>
107
+ </Link>
108
+ </NavigationMenuLink>
109
+ </li>
110
+ );
111
+ });
112
+ ListItem.displayName = 'ListItem';
@@ -0,0 +1,185 @@
1
+ import * as React from 'react';
2
+ import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu';
3
+ import { cva } from 'class-variance-authority';
4
+ import { ChevronDownIcon, ChevronRightIcon } from 'lucide-react';
5
+
6
+ import { cn } from '@/lib/utils';
7
+
8
+ function NavigationMenu({
9
+ className,
10
+ viewportClassName,
11
+ children,
12
+ viewport = true,
13
+ ...props
14
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
15
+ viewport?: boolean;
16
+ viewportClassName?: string;
17
+ }) {
18
+ return (
19
+ <NavigationMenuPrimitive.Root
20
+ data-slot="navigation-menu"
21
+ data-viewport={viewport}
22
+ className={cn(
23
+ 'group/navigation-menu relative flex max-w-max flex-1 items-center justify-center',
24
+ className,
25
+ )}
26
+ {...props}
27
+ >
28
+ {children}
29
+ {viewport && <NavigationMenuViewport className={viewportClassName} />}
30
+ </NavigationMenuPrimitive.Root>
31
+ );
32
+ }
33
+
34
+ function NavigationMenuList({
35
+ className,
36
+ ...props
37
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {
38
+ return (
39
+ <NavigationMenuPrimitive.List
40
+ data-slot="navigation-menu-list"
41
+ className={cn('group flex flex-1 list-none items-center justify-center gap-1', className)}
42
+ {...props}
43
+ />
44
+ );
45
+ }
46
+
47
+ function NavigationMenuItem({
48
+ className,
49
+ ...props
50
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {
51
+ return (
52
+ <NavigationMenuPrimitive.Item
53
+ data-slot="navigation-menu-item"
54
+ className={cn('relative cursor-pointer', className)}
55
+ {...props}
56
+ />
57
+ );
58
+ }
59
+
60
+ const navigationMenuTriggerStyle = cva(
61
+ 'group bg-background hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 inline-flex h-9 w-max items-center justify-center rounded-md px-4 py-2 text-base font-medium transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50',
62
+ );
63
+
64
+ function NavigationMenuTrigger({
65
+ className,
66
+ children,
67
+ ...props
68
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
69
+ return (
70
+ <NavigationMenuPrimitive.Trigger
71
+ data-slot="navigation-menu-trigger"
72
+ className={cn(navigationMenuTriggerStyle(), 'group', className)}
73
+ {...props}
74
+ >
75
+ {children}{' '}
76
+ <ChevronDownIcon
77
+ className="relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180"
78
+ aria-hidden="true"
79
+ />
80
+ </NavigationMenuPrimitive.Trigger>
81
+ );
82
+ }
83
+
84
+ function NavigationMenuContent({
85
+ className,
86
+ ...props
87
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {
88
+ return (
89
+ <NavigationMenuPrimitive.Content
90
+ data-slot="navigation-menu-content"
91
+ className={cn(
92
+ 'data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 top-0 left-0 w-full p-2 pr-2.5 md:absolute md:w-auto',
93
+ 'group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 roup-data-[viewport=false]/navigation-menu:border-primary-100 group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none',
94
+ className,
95
+ )}
96
+ {...props}
97
+ />
98
+ );
99
+ }
100
+
101
+ function NavigationMenuViewport({
102
+ className,
103
+ ...props
104
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) {
105
+ return (
106
+ <div className={cn('absolute top-full left-0 isolate z-50 flex justify-center')}>
107
+ <NavigationMenuPrimitive.Viewport
108
+ data-slot="navigation-menu-viewport"
109
+ className={cn(
110
+ 'origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 border-primary-100 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border md:w-[var(--radix-navigation-menu-viewport-width)]',
111
+ className,
112
+ )}
113
+ {...props}
114
+ />
115
+ </div>
116
+ );
117
+ }
118
+
119
+ function NavigationMenuLink({
120
+ className,
121
+ ...props
122
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {
123
+ return (
124
+ <NavigationMenuPrimitive.Link
125
+ data-slot="navigation-menu-link"
126
+ className={cn(
127
+ "data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-ring/50 [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-base transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4",
128
+ className,
129
+ )}
130
+ {...props}
131
+ />
132
+ );
133
+ }
134
+
135
+ function NavigationMenuIndicator({
136
+ className,
137
+ ...props
138
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {
139
+ return (
140
+ <NavigationMenuPrimitive.Indicator
141
+ data-slot="navigation-menu-indicator"
142
+ className={cn(
143
+ 'data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden',
144
+ className,
145
+ )}
146
+ {...props}
147
+ >
148
+ <div className="bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" />
149
+ </NavigationMenuPrimitive.Indicator>
150
+ );
151
+ }
152
+
153
+ const NavigationMenuSubTrigger = React.forwardRef<
154
+ React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
155
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger> & {
156
+ inset?: boolean;
157
+ }
158
+ >(({ className, children, inset, ...props }, ref) => (
159
+ <NavigationMenuPrimitive.Trigger
160
+ ref={ref}
161
+ className={cn(
162
+ 'group hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground flex cursor-pointer items-center rounded-sm px-3 py-2 text-base font-medium outline-none select-none disabled:pointer-events-none disabled:opacity-50',
163
+ inset && 'pl-6',
164
+ className,
165
+ )}
166
+ {...props}
167
+ >
168
+ {children}
169
+ <ChevronRightIcon className="ml-auto h-4 w-4 shrink-0 transition-transform duration-200 group-data-[state=open]:rotate-90" />
170
+ </NavigationMenuPrimitive.Trigger>
171
+ ));
172
+
173
+ NavigationMenuSubTrigger.displayName = 'NavigationMenuSubTrigger';
174
+
175
+ export {
176
+ NavigationMenu,
177
+ NavigationMenuList,
178
+ NavigationMenuItem,
179
+ NavigationMenuContent,
180
+ NavigationMenuTrigger,
181
+ NavigationMenuLink,
182
+ NavigationMenuIndicator,
183
+ NavigationMenuViewport,
184
+ navigationMenuTriggerStyle,
185
+ };
@@ -0,0 +1,24 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import { NoData } from './index';
4
+
5
+ const meta: Meta<typeof NoData> = {
6
+ title: 'UI/NoData',
7
+ component: NoData,
8
+ tags: ['autodocs'],
9
+ };
10
+
11
+ export default meta;
12
+ type Story = StoryObj<typeof NoData>;
13
+
14
+ export const Default: Story = {
15
+ args: {
16
+ title: 'No results found',
17
+ },
18
+ };
19
+
20
+ export const Vietnamese: Story = {
21
+ args: {
22
+ title: 'Không tìm thấy dữ liệu',
23
+ },
24
+ };
@@ -0,0 +1,19 @@
1
+ import { FileX } from 'lucide-react';
2
+
3
+ import { cn } from '@/lib/utils';
4
+
5
+ interface NoDataProps {
6
+ title?: string;
7
+ className?: string;
8
+ }
9
+
10
+ export function NoData({ title = 'Không tìm thấy dữ liệu', className = '' }: NoDataProps) {
11
+ return (
12
+ <div className={cn('flex flex-col items-center justify-center p-8 text-center', className)}>
13
+ <div className="mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gradient-to-br from-[var(--primary-100)] to-[var(--primary-200)]">
14
+ <FileX className="text-primary/50 h-8 w-8" />
15
+ </div>
16
+ <h3 className="text-muted-foreground mb-2">{title}</h3>
17
+ </div>
18
+ );
19
+ }
@@ -0,0 +1,53 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import {
4
+ Pagination,
5
+ PaginationContent,
6
+ PaginationEllipsis,
7
+ PaginationItem,
8
+ PaginationLink,
9
+ PaginationNext,
10
+ PaginationPrevious,
11
+ } from './index';
12
+
13
+ const meta: Meta<typeof Pagination> = {
14
+ title: 'UI/Pagination',
15
+ component: Pagination,
16
+ tags: ['autodocs'],
17
+ };
18
+
19
+ export default meta;
20
+ type Story = StoryObj<typeof Pagination>;
21
+
22
+ export const Default: Story = {
23
+ render: (args) => (
24
+ <Pagination {...args}>
25
+ <PaginationContent>
26
+ <PaginationItem>
27
+ <PaginationPrevious href="#" size="icon" />
28
+ </PaginationItem>
29
+ <PaginationItem>
30
+ <PaginationLink href="#" size="icon">
31
+ 1
32
+ </PaginationLink>
33
+ </PaginationItem>
34
+ <PaginationItem>
35
+ <PaginationLink href="#" isActive size="icon">
36
+ 2
37
+ </PaginationLink>
38
+ </PaginationItem>
39
+ <PaginationItem>
40
+ <PaginationLink href="#" size="icon">
41
+ 3
42
+ </PaginationLink>
43
+ </PaginationItem>
44
+ <PaginationItem>
45
+ <PaginationEllipsis />
46
+ </PaginationItem>
47
+ <PaginationItem>
48
+ <PaginationNext href="#" size="icon" />
49
+ </PaginationItem>
50
+ </PaginationContent>
51
+ </Pagination>
52
+ ),
53
+ };