@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
package/hooks/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { useAutoHeight } from './use-auto-height';
2
+ export { useControlledState } from './use-controlled-state';
3
+ export { useIsMobile } from './use-mobile';
@@ -0,0 +1,99 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+
5
+ type AutoHeightOptions = {
6
+ includeParentBox?: boolean;
7
+ includeSelfBox?: boolean;
8
+ };
9
+
10
+ export function useAutoHeight<T extends HTMLElement = HTMLDivElement>(
11
+ deps: React.DependencyList = [],
12
+ options: AutoHeightOptions = {
13
+ includeParentBox: true,
14
+ includeSelfBox: false,
15
+ },
16
+ ) {
17
+ const ref = React.useRef<T | null>(null);
18
+ const roRef = React.useRef<ResizeObserver | null>(null);
19
+ const [height, setHeight] = React.useState(0);
20
+
21
+ const measure = React.useCallback(() => {
22
+ const el = ref.current;
23
+ if (!el) return 0;
24
+
25
+ const base = el.getBoundingClientRect().height || 0;
26
+
27
+ let extra = 0;
28
+
29
+ if (options.includeParentBox && el.parentElement) {
30
+ const cs = getComputedStyle(el.parentElement);
31
+ const paddingY =
32
+ (parseFloat(cs.paddingTop || '0') || 0) + (parseFloat(cs.paddingBottom || '0') || 0);
33
+ const borderY =
34
+ (parseFloat(cs.borderTopWidth || '0') || 0) +
35
+ (parseFloat(cs.borderBottomWidth || '0') || 0);
36
+ const isBorderBox = cs.boxSizing === 'border-box';
37
+ if (isBorderBox) {
38
+ extra += paddingY + borderY;
39
+ }
40
+ }
41
+
42
+ if (options.includeSelfBox) {
43
+ const cs = getComputedStyle(el);
44
+ const paddingY =
45
+ (parseFloat(cs.paddingTop || '0') || 0) + (parseFloat(cs.paddingBottom || '0') || 0);
46
+ const borderY =
47
+ (parseFloat(cs.borderTopWidth || '0') || 0) +
48
+ (parseFloat(cs.borderBottomWidth || '0') || 0);
49
+ const isBorderBox = cs.boxSizing === 'border-box';
50
+ if (isBorderBox) {
51
+ extra += paddingY + borderY;
52
+ }
53
+ }
54
+
55
+ const dpr = typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1;
56
+ const total = Math.ceil((base + extra) * dpr) / dpr;
57
+
58
+ return total;
59
+ }, [options.includeParentBox, options.includeSelfBox]);
60
+
61
+ React.useLayoutEffect(() => {
62
+ const el = ref.current;
63
+ if (!el) return;
64
+
65
+ setHeight(measure());
66
+
67
+ if (roRef.current) {
68
+ roRef.current.disconnect();
69
+ roRef.current = null;
70
+ }
71
+
72
+ const ro = new ResizeObserver(() => {
73
+ const next = measure();
74
+ requestAnimationFrame(() => setHeight(next));
75
+ });
76
+
77
+ ro.observe(el);
78
+ if (options.includeParentBox && el.parentElement) {
79
+ ro.observe(el.parentElement);
80
+ }
81
+
82
+ roRef.current = ro;
83
+
84
+ return () => {
85
+ ro.disconnect();
86
+ roRef.current = null;
87
+ };
88
+ // eslint-disable-next-line react-hooks/exhaustive-deps
89
+ }, deps);
90
+
91
+ React.useLayoutEffect(() => {
92
+ if (height === 0) {
93
+ const next = measure();
94
+ if (next !== 0) setHeight(next);
95
+ }
96
+ }, [height, measure]);
97
+
98
+ return { ref, height } as const;
99
+ }
@@ -0,0 +1,32 @@
1
+ import * as React from 'react';
2
+
3
+ interface CommonControlledStateProps<T> {
4
+ value?: T;
5
+ defaultValue?: T;
6
+ }
7
+
8
+ export function useControlledState<T, Rest extends unknown[] = []>(
9
+ props: CommonControlledStateProps<T> & {
10
+ onChange?: (value: T, ...args: Rest) => void;
11
+ },
12
+ ): readonly [T, (next: T, ...args: Rest) => void] {
13
+ const { value, defaultValue, onChange } = props;
14
+
15
+ const [state, setInternalState] = React.useState<T>(
16
+ value !== undefined ? value : (defaultValue as T),
17
+ );
18
+
19
+ React.useEffect(() => {
20
+ if (value !== undefined) setInternalState(value);
21
+ }, [value]);
22
+
23
+ const setState = React.useCallback(
24
+ (next: T, ...args: Rest) => {
25
+ setInternalState(next);
26
+ onChange?.(next, ...args);
27
+ },
28
+ [onChange],
29
+ );
30
+
31
+ return [state, setState] as const;
32
+ }
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+
3
+ const MOBILE_BREAKPOINT = 768;
4
+
5
+ export function useIsMobile() {
6
+ const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined);
7
+
8
+ React.useEffect(() => {
9
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
10
+ const onChange = () => {
11
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
12
+ };
13
+ mql.addEventListener('change', onChange);
14
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
15
+ return () => mql.removeEventListener('change', onChange);
16
+ }, []);
17
+
18
+ return !!isMobile;
19
+ }
package/index.ts ADDED
@@ -0,0 +1,58 @@
1
+ // Auto-generated file. Do not edit manually.
2
+ export * from './components/ui/Accordion';
3
+ export * from './components/ui/Alert';
4
+ export * from './components/ui/AlertDialog';
5
+ export * from './components/ui/AspectRatio';
6
+ export * from './components/ui/Avatar';
7
+ export * from './components/ui/Badge';
8
+ export * from './components/ui/Breadcrumb';
9
+ export * from './components/ui/Button';
10
+ export * from './components/ui/Calendar';
11
+ export * from './components/ui/Card';
12
+ export * from './components/ui/Carousel';
13
+ export * from './components/ui/Chart';
14
+ export * from './components/ui/Checkbox';
15
+ export * from './components/ui/CircleProcess';
16
+ export * from './components/ui/Collapsible';
17
+ export * from './components/ui/Command';
18
+ export * from './components/ui/Container';
19
+ export * from './components/ui/ContextMenu';
20
+ export * from './components/ui/Dialog';
21
+ export * from './components/ui/Drawer';
22
+ export * from './components/ui/DropdownMenu';
23
+ export * from './components/ui/Dropzone';
24
+ export * from './components/ui/Form';
25
+ export * from './components/ui/HStack';
26
+ export * from './components/ui/HoverCard';
27
+ export * from './components/ui/Icons';
28
+ export * from './components/ui/ImageWithFallback';
29
+ export * from './components/ui/Input';
30
+ export * from './components/ui/InputOtp';
31
+ export * from './components/ui/Label';
32
+ export * from './components/ui/Marquee';
33
+ export * from './components/ui/Menubar';
34
+ export * from './components/ui/NavigationMenu';
35
+ export * from './components/ui/NoData';
36
+ export * from './components/ui/Pagination';
37
+ export * from './components/ui/Popover';
38
+ export * from './components/ui/Progress';
39
+ export * from './components/ui/RadioGroup';
40
+ export * from './components/ui/Resizable';
41
+ export * from './components/ui/ScrollArea';
42
+ export * from './components/ui/Select';
43
+ export * from './components/ui/Separator';
44
+ export * from './components/ui/Sheet';
45
+ export * from './components/ui/Sidebar';
46
+ export * from './components/ui/Skeleton';
47
+ export * from './components/ui/Slider';
48
+ export * from './components/ui/Slot';
49
+ export * from './components/ui/Sonner';
50
+ export * from './components/ui/Switch';
51
+ export * from './components/ui/Table';
52
+ export * from './components/ui/Tabs';
53
+ export * from './components/ui/Text';
54
+ export * from './components/ui/Textarea';
55
+ export * from './components/ui/Toggle';
56
+ export * from './components/ui/ToggleGroup';
57
+ export * from './components/ui/Tooltip';
58
+ export * from './components/ui/VStack';
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+
3
+ export function getStrictContext<T>(name: string) {
4
+ const Context = React.createContext<T | undefined>(undefined);
5
+
6
+ function useContext() {
7
+ const context = React.useContext(Context);
8
+ if (context === undefined) {
9
+ throw new Error(`use${name} must be used within a ${name}Provider`);
10
+ }
11
+ return context;
12
+ }
13
+
14
+ return [Context.Provider, useContext] as const;
15
+ }
package/lib/utils.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { clsx, type ClassValue } from 'clsx';
2
+ import { twMerge } from 'tailwind-merge';
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs));
6
+ }
7
+
8
+ export function onMutateError(error: unknown) {
9
+ console.error('Mutation error:', error);
10
+ }
package/package.json ADDED
@@ -0,0 +1,107 @@
1
+ {
2
+ "name": "@luanthnh/cntt-ui",
3
+ "version": "0.1.5",
4
+ "type": "module",
5
+ "sideEffects": [
6
+ "**/*.css"
7
+ ],
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "types": "./dist/index.d.ts"
15
+ },
16
+ "./globals.css": "./globals.css"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "scripts": {
22
+ "generate:exports": "tsx scripts/generate-exports.ts",
23
+ "prebuild": "pnpm generate:exports",
24
+ "dev": "storybook dev -p 6006",
25
+ "build": "tsup",
26
+ "build:storybook": "storybook build"
27
+ },
28
+ "dependencies": {
29
+ "@base-ui-components/react": "1.0.0-rc.0",
30
+ "@hookform/resolvers": "^5.2.2",
31
+ "@radix-ui/react-accordion": "^1.2.1",
32
+ "@radix-ui/react-alert-dialog": "^1.1.2",
33
+ "@radix-ui/react-aspect-ratio": "^1.1.0",
34
+ "@radix-ui/react-avatar": "^1.1.1",
35
+ "@radix-ui/react-checkbox": "^1.1.2",
36
+ "@radix-ui/react-collapsible": "^1.1.1",
37
+ "@radix-ui/react-context-menu": "^2.2.2",
38
+ "@radix-ui/react-dialog": "^1.1.2",
39
+ "@radix-ui/react-dropdown-menu": "^2.1.2",
40
+ "@radix-ui/react-hover-card": "^1.1.2",
41
+ "@radix-ui/react-label": "^2.1.0",
42
+ "@radix-ui/react-menubar": "^1.1.2",
43
+ "@radix-ui/react-navigation-menu": "^1.2.1",
44
+ "@radix-ui/react-popover": "^1.1.2",
45
+ "@radix-ui/react-progress": "^1.1.0",
46
+ "@radix-ui/react-radio-group": "^1.2.1",
47
+ "@radix-ui/react-scroll-area": "^1.2.1",
48
+ "@radix-ui/react-select": "^2.1.2",
49
+ "@radix-ui/react-separator": "^1.1.0",
50
+ "@radix-ui/react-slider": "^1.2.1",
51
+ "@radix-ui/react-slot": "^1.1.0",
52
+ "@radix-ui/react-switch": "^1.1.1",
53
+ "@radix-ui/react-tabs": "^1.1.1",
54
+ "@radix-ui/react-toggle": "^1.1.0",
55
+ "@radix-ui/react-toggle-group": "^1.1.0",
56
+ "@radix-ui/react-tooltip": "^1.1.4",
57
+ "class-variance-authority": "^0.7.1",
58
+ "clsx": "^2.1.1",
59
+ "cmdk": "1.0.0",
60
+ "date-fns": "^4.1.0",
61
+ "embla-carousel-react": "^8.5.1",
62
+ "framer-motion": "^11.13.1",
63
+ "input-otp": "^1.4.1",
64
+ "lenis": "^1.1.18",
65
+ "lucide-react": "^0.462.0",
66
+ "motion": "^11.11.17",
67
+ "next-themes": "^0.4.3",
68
+ "radix-ui": "^1.4.3",
69
+ "react-day-picker": "^9.13.0",
70
+ "react-dropzone": "^14.3.8",
71
+ "react-hook-form": "^7.69.0",
72
+ "react-resizable-panels": "^4.0.15",
73
+ "recharts": "^2.13.3",
74
+ "sonner": "^1.7.0",
75
+ "tailwind-merge": "^2.5.5",
76
+ "tailwindcss-animate": "^1.0.7",
77
+ "tempus": "1.0.0-dev.17",
78
+ "vaul": "^1.1.1",
79
+ "zod": "^4.2.1"
80
+ },
81
+ "peerDependencies": {
82
+ "react": ">=18",
83
+ "react-dom": ">=18"
84
+ },
85
+ "devDependencies": {
86
+ "@storybook/addon-essentials": "^8.6.15",
87
+ "@storybook/addon-interactions": "^8.6.15",
88
+ "@storybook/addon-onboarding": "^1.0.11",
89
+ "@storybook/blocks": "^8.6.15",
90
+ "@storybook/react": "^8.6.15",
91
+ "@storybook/react-vite": "^8.6.15",
92
+ "@storybook/test": "^8.6.15",
93
+ "@tailwindcss/typography": "^0.5.15",
94
+ "@tailwindcss/vite": "^4.0.0",
95
+ "@types/react": "^19.2.7",
96
+ "@types/react-dom": "^19.2.3",
97
+ "@vitejs/plugin-react": "^5.1.2",
98
+ "react": "19.2.3",
99
+ "react-dom": "19.2.3",
100
+ "storybook": "^8.6.15",
101
+ "tailwindcss": "^4.0.0",
102
+ "tsup": "^8.5.1",
103
+ "tsx": "^4.21.0",
104
+ "typescript": "^5.9.3",
105
+ "vite": "^7.3.0"
106
+ }
107
+ }
@@ -0,0 +1,32 @@
1
+ import fs from 'fs/promises';
2
+ import path from 'path';
3
+
4
+ async function generateExports() {
5
+ const componentsDir = path.join(process.cwd(), 'components/ui');
6
+ const componentDirs = await fs.readdir(componentsDir, { withFileTypes: true });
7
+
8
+ const exports = [];
9
+
10
+ for (const dir of componentDirs) {
11
+ if (dir.isDirectory()) {
12
+ const componentName = dir.name;
13
+ const indexPath = path.join(dir.path, dir.name, 'index.tsx');
14
+
15
+ try {
16
+ await fs.access(indexPath);
17
+ exports.push(`export * from "./components/ui/${componentName}"`);
18
+ } catch {
19
+ console.warn(`No index.tsx found for component: ${componentName}`);
20
+ }
21
+ }
22
+ }
23
+
24
+ const content = `// Auto-generated file. Do not edit manually.
25
+ ${exports.join('\n')}
26
+ `;
27
+
28
+ await fs.writeFile(path.join(process.cwd(), 'index.ts'), content);
29
+ console.log('Exports generated successfully!');
30
+ }
31
+
32
+ generateExports().catch(console.error);
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "baseUrl": ".",
5
+ "ignoreDeprecations": "5.0",
6
+ "paths": {
7
+ "@/*": ["./*"]
8
+ },
9
+ "incremental": false
10
+ },
11
+ "include": ["**/*.ts", "**/*.tsx", "types/*.d.ts", "lib", "scripts", "hooks", "components"]
12
+ }