@srcroot/ui 0.0.60 → 0.0.62

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 (32) hide show
  1. package/dist/index.js +8 -1
  2. package/package.json +1 -1
  3. package/src/registry/analytics/google-analytics.tsx +25 -23
  4. package/src/registry/analytics/google-tag-manager.tsx +54 -49
  5. package/src/registry/analytics/meta-pixel.tsx +29 -25
  6. package/src/registry/analytics/microsoft-clarity.tsx +19 -17
  7. package/src/registry/analytics/tiktok-pixel.tsx +15 -13
  8. package/src/registry/ui/alert.tsx +50 -48
  9. package/src/registry/ui/aspect-ratio.tsx +27 -25
  10. package/src/registry/ui/badge.tsx +40 -37
  11. package/src/registry/ui/breadcrumb.tsx +106 -106
  12. package/src/registry/ui/button-group.tsx +52 -46
  13. package/src/registry/ui/card.tsx +68 -58
  14. package/src/registry/ui/container.tsx +34 -31
  15. package/src/registry/ui/empty-state.tsx +32 -30
  16. package/src/registry/ui/form-field.tsx +79 -68
  17. package/src/registry/ui/image.tsx +128 -120
  18. package/src/registry/ui/input-group.tsx +78 -72
  19. package/src/registry/ui/kbd.tsx +46 -44
  20. package/src/registry/ui/loading-spinner.tsx +84 -80
  21. package/src/registry/ui/marquee.tsx +43 -45
  22. package/src/registry/ui/native-select.tsx +42 -40
  23. package/src/registry/ui/pagination.tsx +115 -101
  24. package/src/registry/ui/radio.tsx +96 -66
  25. package/src/registry/ui/skeleton.tsx +15 -14
  26. package/src/registry/ui/slot.tsx +56 -55
  27. package/src/registry/ui/text.tsx +42 -41
  28. package/src/registry/ui/google-analytics.tsx +0 -38
  29. package/src/registry/ui/google-tag-manager.tsx +0 -64
  30. package/src/registry/ui/meta-pixel.tsx +0 -46
  31. package/src/registry/ui/microsoft-clarity.tsx +0 -33
  32. package/src/registry/ui/tiktok-pixel.tsx +0 -36
@@ -1,61 +1,62 @@
1
- import * as React from "react"
2
- import { cva, type VariantProps } from "class-variance-authority"
3
- import { cn } from "@/lib/utils"
1
+ "use client";
2
+ import * as React from "react";
3
+ import { cva, type VariantProps } from "class-variance-authority";
4
+ import { cn } from "@/lib/utils";
4
5
 
5
6
  const textVariants = cva("", {
6
- variants: {
7
- variant: {
8
- h1: "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",
9
- h2: "scroll-m-20 text-3xl font-semibold tracking-tight",
10
- h3: "scroll-m-20 text-2xl font-semibold tracking-tight",
11
- h4: "scroll-m-20 text-xl font-semibold tracking-tight",
12
- h5: "scroll-m-20 text-lg font-semibold tracking-tight",
13
- h6: "scroll-m-20 text-base font-semibold tracking-tight",
14
- p: "leading-7 [&:not(:first-child)]:mt-6",
15
- lead: "text-xl text-muted-foreground",
16
- large: "text-lg font-semibold",
17
- small: "text-sm font-medium leading-none",
18
- muted: "text-sm text-muted-foreground",
19
- code: "relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",
20
- },
7
+ variants: {
8
+ variant: {
9
+ h1: "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",
10
+ h2: "scroll-m-20 text-3xl font-semibold tracking-tight",
11
+ h3: "scroll-m-20 text-2xl font-semibold tracking-tight",
12
+ h4: "scroll-m-20 text-xl font-semibold tracking-tight",
13
+ h5: "scroll-m-20 text-lg font-semibold tracking-tight",
14
+ h6: "scroll-m-20 text-base font-semibold tracking-tight",
15
+ p: "leading-7 [&:not(:first-child)]:mt-6",
16
+ lead: "text-xl text-muted-foreground",
17
+ large: "text-lg font-semibold",
18
+ small: "text-sm font-medium leading-none",
19
+ muted: "text-sm text-muted-foreground",
20
+ code: "relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",
21
21
  },
22
- defaultVariants: {
23
- variant: "p",
24
- },
25
- })
22
+ },
23
+ defaultVariants: {
24
+ variant: "p",
25
+ },
26
+ });
26
27
 
27
- type TextVariants = VariantProps<typeof textVariants>
28
+ type TextVariants = VariantProps<typeof textVariants>;
28
29
 
29
30
  interface TextProps extends TextVariants {
30
- className?: string
31
- children?: React.ReactNode
32
- as?: "p" | "span" | "div" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "label"
31
+ className?: string;
32
+ children?: React.ReactNode;
33
+ as?: "p" | "span" | "div" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "label";
33
34
  }
34
35
 
35
36
  /**
36
37
  * Text component for typography
37
- *
38
+ *
38
39
  * @example
39
40
  * // As a heading
40
41
  * <Text as="h1" variant="h1">Page Title</Text>
41
- *
42
+ *
42
43
  * // Using heading styles on a different element
43
44
  * <Text as="span" variant="h2">Styled as H2</Text>
44
- *
45
+ *
45
46
  * // Muted text
46
47
  * <Text variant="muted">Secondary information</Text>
47
48
  */
48
49
  const Text = React.forwardRef<HTMLElement, TextProps>(
49
- ({ as: Component = "p", className, variant, ...props }, ref) => {
50
- return (
51
- <Component
52
- ref={ref as any}
53
- className={cn(textVariants({ variant }), className)}
54
- {...props}
55
- />
56
- )
57
- }
58
- )
59
- Text.displayName = "Text"
50
+ ({ as: Component = "p", className, variant, ...props }, ref) => {
51
+ return (
52
+ <Component
53
+ ref={ref as any}
54
+ className={cn(textVariants({ variant }), className)}
55
+ {...props}
56
+ />
57
+ );
58
+ },
59
+ );
60
+ Text.displayName = "Text";
60
61
 
61
- export { Text, textVariants }
62
+ export { Text, textVariants };
@@ -1,38 +0,0 @@
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;
@@ -1,64 +0,0 @@
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;
@@ -1,46 +0,0 @@
1
- "use client"
2
-
3
- import Script from 'next/script';
4
- import type { FC } from 'react';
5
-
6
- interface MetaPixelProps {
7
- pixelIds: string[]; // ← array now
8
- }
9
-
10
- const MetaPixel: FC<MetaPixelProps> = ({ pixelIds }) => {
11
- return (
12
- <>
13
- <Script
14
- id="fb-script-multi"
15
- strategy="afterInteractive"
16
- dangerouslySetInnerHTML={{
17
- __html: `
18
- !function(f,b,e,v,n,t,s)
19
- {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
20
- n.callMethod.apply(n,arguments):n.queue.push(arguments)};
21
- if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
22
- n.queue=[];t=b.createElement(e);t.async=!0;
23
- t.src=v;s=b.getElementsByTagName(e)[0];
24
- s.parentNode.insertBefore(t,s)}(window, document,'script',
25
- 'https://connect.facebook.net/en_US/fbevents.js');
26
- ${pixelIds.map(id => `fbq('init', '${id}');`).join('\n')}
27
- fbq('track', 'PageView');
28
- `,
29
- }}
30
- />
31
-
32
- {/* One noscript tag per pixel */}
33
- {pixelIds.map(id => (
34
- <noscript key={id}>
35
- <img
36
- height="1" width="1" style={{ display: 'none' }}
37
- src={`https://www.facebook.com/tr?id=${id}&ev=PageView&noscript=1`}
38
- alt=""
39
- />
40
- </noscript>
41
- ))}
42
- </>
43
- );
44
- };
45
-
46
- export default MetaPixel;
@@ -1,33 +0,0 @@
1
- "use client"
2
-
3
- import Script from 'next/script';
4
- import type { FC } from 'react';
5
-
6
- interface MicrosoftClarityProps {
7
- clarityIds: string[];
8
- }
9
-
10
- const MicrosoftClarity: FC<MicrosoftClarityProps> = ({ clarityIds }) => {
11
- return (
12
- <>
13
- {clarityIds.map((id) => (
14
- <Script
15
- key={id}
16
- id={`microsoft-clarity-init-${id}`}
17
- strategy="afterInteractive"
18
- dangerouslySetInnerHTML={{
19
- __html: `
20
- (function(c,l,a,r,i,t,y){
21
- c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
22
- t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
23
- y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
24
- })(window, document, "clarity", "script", "${id}");
25
- `,
26
- }}
27
- />
28
- ))}
29
- </>
30
- );
31
- };
32
-
33
- export default MicrosoftClarity;
@@ -1,36 +0,0 @@
1
- "use client"
2
-
3
- import Script from 'next/script';
4
- import type { FC } from 'react';
5
-
6
- interface TikTokPixelProps {
7
- pixelIds: string[]; // ← array
8
- }
9
-
10
- const TikTokPixel: FC<TikTokPixelProps> = ({ pixelIds }) => {
11
- return (
12
- <Script
13
- id="tiktok-script-multi"
14
- strategy="afterInteractive"
15
- dangerouslySetInnerHTML={{
16
- __html: `
17
- !function (w, d, t) {
18
- w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];
19
- ttq.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie","holdConsent","revokeConsent","grantConsent"],
20
- ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};
21
- for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);
22
- ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,ttq.methods[n]);return e},
23
- ttq.load=function(e,n){var r="https://analytics.tiktok.com/i18n/pixel/events.js";
24
- ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=r,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};
25
- var s=document.createElement("script");s.type="text/javascript",s.async=!0,s.src=r+"?sdkid="+e+"&lib="+t;
26
- var p=document.getElementsByTagName("script")[0];p.parentNode.insertBefore(s,p)};
27
- ${pixelIds.map(id => `ttq.load('${id}');`).join('\n')}
28
- ttq.page();
29
- }(window, document, 'ttq');
30
- `,
31
- }}
32
- />
33
- );
34
- };
35
-
36
- export default TikTokPixel;