@srcroot/ui 0.0.54 → 0.0.56

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 (107) hide show
  1. package/README.md +151 -151
  2. package/dist/index.d.ts +0 -0
  3. package/dist/index.js +55 -1
  4. package/package.json +7 -2
  5. package/src/registry/analytics/google-analytics.tsx +36 -39
  6. package/src/registry/analytics/google-tag-manager.tsx +62 -65
  7. package/src/registry/analytics/meta-pixel.tsx +44 -47
  8. package/src/registry/analytics/microsoft-clarity.tsx +31 -34
  9. package/src/registry/analytics/tiktok-pixel.tsx +34 -37
  10. package/src/registry/lib/utils.ts +0 -0
  11. package/src/registry/themes/v3/blue.css +157 -157
  12. package/src/registry/themes/v3/glass.css +153 -153
  13. package/src/registry/themes/v3/gray.css +157 -157
  14. package/src/registry/themes/v3/green.css +157 -157
  15. package/src/registry/themes/v3/neutral.css +157 -157
  16. package/src/registry/themes/v3/orange.css +157 -157
  17. package/src/registry/themes/v3/rose.css +157 -157
  18. package/src/registry/themes/v3/slate.css +157 -157
  19. package/src/registry/themes/v3/stone.css +157 -157
  20. package/src/registry/themes/v3/violet.css +186 -186
  21. package/src/registry/themes/v3/zinc.css +157 -157
  22. package/src/registry/themes/v4/blue.css +184 -184
  23. package/src/registry/themes/v4/glass.css +180 -180
  24. package/src/registry/themes/v4/gray.css +184 -184
  25. package/src/registry/themes/v4/green.css +184 -184
  26. package/src/registry/themes/v4/neutral.css +184 -184
  27. package/src/registry/themes/v4/orange.css +184 -184
  28. package/src/registry/themes/v4/rose.css +184 -184
  29. package/src/registry/themes/v4/slate.css +184 -184
  30. package/src/registry/themes/v4/stone.css +184 -184
  31. package/src/registry/themes/v4/violet.css +184 -184
  32. package/src/registry/themes/v4/zinc.css +184 -184
  33. package/src/registry/ui/accordion.tsx +164 -165
  34. package/src/registry/ui/alert-dialog.tsx +213 -214
  35. package/src/registry/ui/alert.tsx +73 -76
  36. package/src/registry/ui/aspect-ratio.tsx +44 -47
  37. package/src/registry/ui/avatar.tsx +96 -97
  38. package/src/registry/ui/badge.tsx +52 -55
  39. package/src/registry/ui/breadcrumb.tsx +147 -150
  40. package/src/registry/ui/button-group.tsx +64 -67
  41. package/src/registry/ui/button.tsx +71 -72
  42. package/src/registry/ui/calendar.tsx +514 -515
  43. package/src/registry/ui/card.tsx +88 -91
  44. package/src/registry/ui/carousel.tsx +214 -214
  45. package/src/registry/ui/chart.tsx +373 -373
  46. package/src/registry/ui/chatbot.tsx +86 -13
  47. package/src/registry/ui/checkbox.tsx +93 -94
  48. package/src/registry/ui/collapsible.tsx +107 -108
  49. package/src/registry/ui/combobox.tsx +171 -171
  50. package/src/registry/ui/command.tsx +300 -300
  51. package/src/registry/ui/container.tsx +44 -47
  52. package/src/registry/ui/context-menu.tsx +221 -221
  53. package/src/registry/ui/date-picker.tsx +228 -228
  54. package/src/registry/ui/dialog.tsx +269 -270
  55. package/src/registry/ui/drawer.tsx +10 -4
  56. package/src/registry/ui/dropdown-menu.tsx +529 -530
  57. package/src/registry/ui/empty-state.tsx +0 -2
  58. package/src/registry/ui/file-upload.tsx +0 -0
  59. package/src/registry/ui/floating-dock.tsx +0 -0
  60. package/src/registry/ui/form-field.tsx +91 -94
  61. package/src/registry/ui/google-analytics.tsx +38 -0
  62. package/src/registry/ui/google-tag-manager.tsx +64 -0
  63. package/src/registry/ui/hover-card.tsx +223 -223
  64. package/src/registry/ui/image.tsx +144 -147
  65. package/src/registry/ui/input-group.tsx +82 -85
  66. package/src/registry/ui/input.tsx +125 -125
  67. package/src/registry/ui/kbd.tsx +60 -63
  68. package/src/registry/ui/label.tsx +36 -37
  69. package/src/registry/ui/loading-spinner.tsx +108 -111
  70. package/src/registry/ui/map.tsx +0 -0
  71. package/src/registry/ui/marquee.tsx +2 -0
  72. package/src/registry/ui/menubar.tsx +246 -246
  73. package/src/registry/ui/meta-pixel.tsx +46 -0
  74. package/src/registry/ui/microsoft-clarity.tsx +33 -0
  75. package/src/registry/ui/native-select.tsx +49 -52
  76. package/src/registry/ui/otp-input.tsx +152 -155
  77. package/src/registry/ui/pagination.tsx +149 -152
  78. package/src/registry/ui/patterns.tsx +28 -0
  79. package/src/registry/ui/popover.tsx +226 -227
  80. package/src/registry/ui/progress.tsx +51 -52
  81. package/src/registry/ui/radio.tsx +99 -102
  82. package/src/registry/ui/resizable.tsx +314 -314
  83. package/src/registry/ui/scroll-animation.tsx +45 -0
  84. package/src/registry/ui/scroll-area.tsx +121 -122
  85. package/src/registry/ui/scroll-to-top.tsx +0 -0
  86. package/src/registry/ui/search.tsx +147 -150
  87. package/src/registry/ui/select.tsx +292 -293
  88. package/src/registry/ui/separator.tsx +46 -47
  89. package/src/registry/ui/sheet.tsx +6 -3
  90. package/src/registry/ui/sidebar.tsx +628 -628
  91. package/src/registry/ui/skeleton.tsx +26 -29
  92. package/src/registry/ui/slider.tsx +196 -197
  93. package/src/registry/ui/slot.tsx +69 -72
  94. package/src/registry/ui/star-rating.tsx +131 -134
  95. package/src/registry/ui/switch.tsx +72 -73
  96. package/src/registry/ui/table-of-contents.tsx +96 -96
  97. package/src/registry/ui/table.tsx +138 -139
  98. package/src/registry/ui/tabs.tsx +124 -125
  99. package/src/registry/ui/text.tsx +61 -64
  100. package/src/registry/ui/textarea.tsx +41 -42
  101. package/src/registry/ui/theme-switcher.tsx +66 -66
  102. package/src/registry/ui/tiktok-pixel.tsx +36 -0
  103. package/src/registry/ui/toast.tsx +97 -98
  104. package/src/registry/ui/toggle-group.tsx +129 -129
  105. package/src/registry/ui/toggle.tsx +72 -72
  106. package/src/registry/ui/tooltip.tsx +143 -144
  107. package/src/registry/ui/whatsapp.tsx +0 -0
@@ -1,5 +1,3 @@
1
- "use client"
2
-
3
1
  import { cn } from "@/lib/utils"
4
2
 
5
3
  interface EmptyStateProps extends React.HTMLAttributes<HTMLDivElement> {
File without changes
File without changes
@@ -1,94 +1,91 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import { Label } from "@/components/ui/label"
5
- import { cn } from "@/lib/utils"
6
-
7
- export interface FormFieldProps extends React.HTMLAttributes<HTMLDivElement> {
8
- /**
9
- * The label for the field
10
- */
11
- label?: React.ReactNode
12
- /**
13
- * Helper text description
14
- */
15
- description?: React.ReactNode
16
- /**
17
- * Error message
18
- */
19
- error?: React.ReactNode
20
- /**
21
- * Whether the field is required (shows asterisk)
22
- */
23
- required?: boolean
24
- /**
25
- * The ID of the input element, used for label association
26
- */
27
- htmlFor?: string
28
- }
29
-
30
- /**
31
- * FormField wrapper for consistent label and error placement
32
- *
33
- * @example
34
- * <FormField
35
- * label="Email"
36
- * description="We'll never share your email."
37
- * error={errors.email}
38
- * required
39
- * >
40
- * <Input placeholder="user@example.com" />
41
- * </FormField>
42
- */
43
- const FormField = React.forwardRef<HTMLDivElement, FormFieldProps>(
44
- ({ className, label, description, error, required, htmlFor, children, ...props }, ref) => {
45
- const id = htmlFor || React.useId()
46
-
47
- // Clone child to inject id and error state if it's a valid React element
48
- const childWithProps = React.isValidElement(children)
49
- ? React.cloneElement(children as React.ReactElement<any>, {
50
- id: id,
51
- error: !!error,
52
- "aria-describedby": error ? `${id}-error` : description ? `${id}-desc` : undefined,
53
- })
54
- : children
55
-
56
- return (
57
- <div
58
- ref={ref}
59
- className={cn("space-y-2", className)}
60
- {...props}
61
- >
62
- {label && (
63
- <Label htmlFor={id} required={required}>
64
- {label}
65
- </Label>
66
- )}
67
-
68
- {childWithProps}
69
-
70
- {description && !error && (
71
- <p
72
- id={`${id}-desc`}
73
- className="text-[0.8rem] text-muted-foreground"
74
- >
75
- {description}
76
- </p>
77
- )}
78
-
79
- {error && (
80
- <p
81
- id={`${id}-error`}
82
- className="text-[0.8rem] font-medium text-destructive"
83
- >
84
- {error}
85
- </p>
86
- )}
87
- </div>
88
- )
89
- }
90
- )
91
- FormField.displayName = "FormField"
92
-
93
- export { FormField }
94
-
1
+ import * as React from "react"
2
+ import { Label } from "@/components/ui/label"
3
+ import { cn } from "@/lib/utils"
4
+
5
+ export interface FormFieldProps extends React.HTMLAttributes<HTMLDivElement> {
6
+ /**
7
+ * The label for the field
8
+ */
9
+ label?: React.ReactNode
10
+ /**
11
+ * Helper text description
12
+ */
13
+ description?: React.ReactNode
14
+ /**
15
+ * Error message
16
+ */
17
+ error?: React.ReactNode
18
+ /**
19
+ * Whether the field is required (shows asterisk)
20
+ */
21
+ required?: boolean
22
+ /**
23
+ * The ID of the input element, used for label association
24
+ */
25
+ htmlFor?: string
26
+ }
27
+
28
+ /**
29
+ * FormField wrapper for consistent label and error placement
30
+ *
31
+ * @example
32
+ * <FormField
33
+ * label="Email"
34
+ * description="We'll never share your email."
35
+ * error={errors.email}
36
+ * required
37
+ * >
38
+ * <Input placeholder="user@example.com" />
39
+ * </FormField>
40
+ */
41
+ const FormField = React.forwardRef<HTMLDivElement, FormFieldProps>(
42
+ ({ className, label, description, error, required, htmlFor, children, ...props }, ref) => {
43
+ const id = htmlFor || React.useId()
44
+
45
+ // Clone child to inject id and error state if it's a valid React element
46
+ const childWithProps = React.isValidElement(children)
47
+ ? React.cloneElement(children as React.ReactElement<any>, {
48
+ id: id,
49
+ error: !!error,
50
+ "aria-describedby": error ? `${id}-error` : description ? `${id}-desc` : undefined,
51
+ })
52
+ : children
53
+
54
+ return (
55
+ <div
56
+ ref={ref}
57
+ className={cn("space-y-2", className)}
58
+ {...props}
59
+ >
60
+ {label && (
61
+ <Label htmlFor={id} required={required}>
62
+ {label}
63
+ </Label>
64
+ )}
65
+
66
+ {childWithProps}
67
+
68
+ {description && !error && (
69
+ <p
70
+ id={`${id}-desc`}
71
+ className="text-[0.8rem] text-muted-foreground"
72
+ >
73
+ {description}
74
+ </p>
75
+ )}
76
+
77
+ {error && (
78
+ <p
79
+ id={`${id}-error`}
80
+ className="text-[0.8rem] font-medium text-destructive"
81
+ >
82
+ {error}
83
+ </p>
84
+ )}
85
+ </div>
86
+ )
87
+ }
88
+ )
89
+ FormField.displayName = "FormField"
90
+
91
+ export { FormField }
@@ -0,0 +1,38 @@
1
+ "use client"
2
+
3
+ import Script from 'next/script';
4
+ import type { FC } from 'react';
5
+
6
+ interface GoogleAnalyticsProps {
7
+ gaIds: string[];
8
+ }
9
+
10
+ const GoogleAnalytics: FC<GoogleAnalyticsProps> = ({ gaIds }) => {
11
+ if (gaIds.length === 0) {
12
+ return null;
13
+ }
14
+
15
+ return (
16
+ <>
17
+ <Script
18
+ id="ga4-script"
19
+ strategy="afterInteractive"
20
+ src={`https://www.googletagmanager.com/gtag/js?id=${gaIds[0]}`}
21
+ />
22
+ <Script
23
+ id="ga4-init"
24
+ strategy="afterInteractive"
25
+ dangerouslySetInnerHTML={{
26
+ __html: `
27
+ window.dataLayer = window.dataLayer || [];
28
+ function gtag(){dataLayer.push(arguments);}
29
+ gtag('js', new Date());
30
+ ${gaIds.map((id) => `gtag('config', '${id}', { page_path: window.location.pathname });`).join('\n')}
31
+ `,
32
+ }}
33
+ />
34
+ </>
35
+ );
36
+ };
37
+
38
+ export default GoogleAnalytics;
@@ -0,0 +1,64 @@
1
+ "use client"
2
+
3
+ import Script from 'next/script';
4
+ import type { FC, ReactNode } from 'react';
5
+
6
+ interface GTMContainer {
7
+ gtmId: string;
8
+ tagServerUrl?: string;
9
+ }
10
+
11
+ interface GoogleTagManagerProps {
12
+ containers: GTMContainer[];
13
+ }
14
+
15
+ const GoogleTagManager: FC<GoogleTagManagerProps> = ({ containers }) => {
16
+ const defaultServer = 'https://www.googletagmanager.com';
17
+
18
+ // Group containers by tagServer to avoid duplicate script loads
19
+ const scriptsMap = containers.reduce((map, container) => {
20
+ const server = container.tagServerUrl || defaultServer;
21
+ if (!map.has(server)) {
22
+ map.set(server, []);
23
+ }
24
+ map.get(server)!.push(container.gtmId);
25
+ return map;
26
+ }, new Map<string, string[]>());
27
+
28
+ const scriptElements: ReactNode[] = Array.from(scriptsMap.entries()).map(([server, ids]) => (
29
+ <Script
30
+ key={server}
31
+ id={`gtm-script-${server}`}
32
+ strategy="afterInteractive"
33
+ dangerouslySetInnerHTML={{
34
+ __html: `
35
+ ${ids
36
+ .map(
37
+ id => `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s);j.async=true;j.src="${server}/gtm.js?"+i;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','${id}');`
38
+ )
39
+ .join('')}
40
+ `,
41
+ }}
42
+ />
43
+ ));
44
+
45
+ return (
46
+ <>
47
+ {scriptElements}
48
+
49
+ <noscript>
50
+ {containers.map(({ gtmId, tagServerUrl = defaultServer }) => (
51
+ <iframe
52
+ key={gtmId}
53
+ src={`${tagServerUrl}/ns.html?id=${gtmId}`}
54
+ height="0"
55
+ width="0"
56
+ style={{ display: 'none', visibility: 'hidden' }}
57
+ />
58
+ ))}
59
+ </noscript>
60
+ </>
61
+ );
62
+ };
63
+
64
+ export default GoogleTagManager;