@ugurdemirel/landcraft 0.1.16 → 0.1.18

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 (67) hide show
  1. package/README.md +2 -3
  2. package/dist/cjs/components/Badge.cjs +1 -1
  3. package/dist/cjs/components/Badge.cjs.map +1 -1
  4. package/dist/cjs/components/Button.cjs +1 -1
  5. package/dist/cjs/components/Button.cjs.map +1 -1
  6. package/dist/cjs/components/CTA/variants/Inverse.cjs +1 -2
  7. package/dist/cjs/components/CTA/variants/Inverse.cjs.map +1 -1
  8. package/dist/cjs/components/CTA/variants/Panel.cjs +1 -2
  9. package/dist/cjs/components/CTA/variants/Panel.cjs.map +1 -1
  10. package/dist/cjs/components/Features/FeatureCard.cjs +1 -1
  11. package/dist/cjs/components/Features/FeatureCard.cjs.map +1 -1
  12. package/dist/cjs/components/Hero/variants/Statement.cjs +1 -2
  13. package/dist/cjs/components/Hero/variants/Statement.cjs.map +1 -1
  14. package/dist/cjs/components/MegaMenu/MegaMenu.cjs +1 -1
  15. package/dist/cjs/components/MegaMenu/MegaMenu.cjs.map +1 -1
  16. package/dist/cjs/components/Navbar/Navbar.cjs +1 -1
  17. package/dist/cjs/components/Navbar/Navbar.cjs.map +1 -1
  18. package/dist/cjs/components/Pricing/parts.cjs +1 -2
  19. package/dist/cjs/components/Pricing/parts.cjs.map +1 -1
  20. package/dist/cjs/components/Pricing/variants/Bento.cjs +1 -1
  21. package/dist/cjs/components/Pricing/variants/Bento.cjs.map +1 -1
  22. package/dist/cjs/components/Pricing/variants/Cards.cjs +1 -1
  23. package/dist/cjs/components/Pricing/variants/Cards.cjs.map +1 -1
  24. package/dist/cjs/components/Testimonials/TestimonialCard.cjs +1 -1
  25. package/dist/cjs/components/Testimonials/TestimonialCard.cjs.map +1 -1
  26. package/dist/cjs/components/Testimonials/variants/Carousel.cjs +1 -1
  27. package/dist/cjs/components/Testimonials/variants/Carousel.cjs.map +1 -1
  28. package/dist/cjs/index.cjs +1 -1
  29. package/dist/es/components/Badge.js +21 -17
  30. package/dist/es/components/Badge.js.map +1 -1
  31. package/dist/es/components/Button.js +29 -29
  32. package/dist/es/components/Button.js.map +1 -1
  33. package/dist/es/components/CTA/variants/Inverse.js +37 -42
  34. package/dist/es/components/CTA/variants/Inverse.js.map +1 -1
  35. package/dist/es/components/CTA/variants/Panel.js +51 -56
  36. package/dist/es/components/CTA/variants/Panel.js.map +1 -1
  37. package/dist/es/components/Features/FeatureCard.js +13 -14
  38. package/dist/es/components/Features/FeatureCard.js.map +1 -1
  39. package/dist/es/components/Hero/variants/Statement.js +37 -42
  40. package/dist/es/components/Hero/variants/Statement.js.map +1 -1
  41. package/dist/es/components/MegaMenu/MegaMenu.js +93 -88
  42. package/dist/es/components/MegaMenu/MegaMenu.js.map +1 -1
  43. package/dist/es/components/Navbar/Navbar.js +30 -26
  44. package/dist/es/components/Navbar/Navbar.js.map +1 -1
  45. package/dist/es/components/Pricing/parts.js +33 -34
  46. package/dist/es/components/Pricing/parts.js.map +1 -1
  47. package/dist/es/components/Pricing/variants/Bento.js +16 -17
  48. package/dist/es/components/Pricing/variants/Bento.js.map +1 -1
  49. package/dist/es/components/Pricing/variants/Cards.js +10 -11
  50. package/dist/es/components/Pricing/variants/Cards.js.map +1 -1
  51. package/dist/es/components/Testimonials/TestimonialCard.js +10 -11
  52. package/dist/es/components/Testimonials/TestimonialCard.js.map +1 -1
  53. package/dist/es/components/Testimonials/variants/Carousel.js +10 -11
  54. package/dist/es/components/Testimonials/variants/Carousel.js.map +1 -1
  55. package/dist/es/index.js +89 -93
  56. package/dist/es/index.js.map +1 -1
  57. package/dist/index.d.ts +8 -33
  58. package/dist/styles.css +0 -3
  59. package/package.json +1 -1
  60. package/dist/cjs/utils/contrast.cjs +0 -2
  61. package/dist/cjs/utils/contrast.cjs.map +0 -1
  62. package/dist/cjs/utils/useTokenForeground.cjs +0 -3
  63. package/dist/cjs/utils/useTokenForeground.cjs.map +0 -1
  64. package/dist/es/utils/contrast.js +0 -48
  65. package/dist/es/utils/contrast.js.map +0 -1
  66. package/dist/es/utils/useTokenForeground.js +0 -28
  67. package/dist/es/utils/useTokenForeground.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TestimonialCard.js","sources":["../../../../src/components/Testimonials/TestimonialCard.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { getContrastText } from \"../../utils/contrast\";\nimport { Quote, Star } from \"../../icons\";\nimport { initials } from \"./parts\";\nimport type { TestimonialCardProps } from \"./types\";\n\nexport const TestimonialCard = forwardRef<HTMLElement, TestimonialCardProps>(\n function TestimonialCard({ className, testimonial, ...props }, ref) {\n const { quote, author, role, company, avatar, accent, rating } = testimonial;\n const badgeStyle = accent\n ? { backgroundColor: accent, color: getContrastText(accent, \"#111111\", \"#ffffff\") }\n : undefined;\n\n return (\n <figure\n ref={ref}\n className={cn(\n \"mb-4 flex flex-col break-inside-avoid rounded-2xl border border-border bg-surface p-7\",\n className,\n )}\n {...props}\n >\n <div className=\"mb-5 flex items-center justify-between\">\n <Quote className={cn(\"h-6 w-6\", accent ? undefined : \"text-primary/30\")} style={accent ? { color: accent } : undefined} />\n {rating ? (\n <span className=\"flex items-center gap-0.5 text-amber-500\" aria-label={`${rating} / 5`}>\n {Array.from({ length: 5 }).map((_, i) => (\n <Star key={i} className=\"h-3.5 w-3.5\" />\n ))}\n </span>\n ) : null}\n </div>\n <blockquote className=\"flex-1 text-[15px] leading-7 text-foreground/85\">{quote}</blockquote>\n <figcaption className=\"mt-6 flex items-center gap-3\">\n {avatar ? (\n avatar\n ) : (\n <span\n style={badgeStyle}\n className={cn(\n \"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-xs font-bold\",\n !accent && \"bg-primary-soft text-primary\",\n )}\n >\n {initials(author)}\n </span>\n )}\n <div>\n <div className=\"text-sm font-semibold text-foreground\">{author}</div>\n {(role || company) && (\n <div className=\"text-xs text-muted-foreground\">\n {[role, company].filter(Boolean).join(\" · \")}\n </div>\n )}\n </div>\n </figcaption>\n </figure>\n );\n },\n);"],"names":["TestimonialCard","forwardRef","className","testimonial","props","ref","quote","author","role","company","avatar","accent","rating","badgeStyle","getContrastText","jsxs","cn","jsx","Quote","_","i","Star"],"mappings":";;;;;;AAOO,MAAMA,IAAkBC;AAAA,EAC7B,SAAyB,EAAE,WAAAC,GAAW,aAAAC,GAAa,GAAGC,EAAA,GAASC,GAAK;AAClE,UAAM,EAAE,OAAAC,GAAO,QAAAC,GAAQ,MAAAC,GAAM,SAAAC,GAAS,QAAAC,GAAQ,QAAAC,GAAQ,QAAAC,MAAWT,GAC3DU,IAAaF,IACf,EAAE,iBAAiBA,GAAQ,OAAOG,EAAgBH,GAAQ,WAAW,SAAS,EAAA,IAC9E;AAEJ,WACE,gBAAAI;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAV;AAAA,QACA,WAAWW;AAAA,UACT;AAAA,UACAd;AAAA,QAAA;AAAA,QAED,GAAGE;AAAA,QAEJ,UAAA;AAAA,UAAA,gBAAAW,EAAC,OAAA,EAAI,WAAU,0CACb,UAAA;AAAA,YAAA,gBAAAE,EAACC,GAAA,EAAM,WAAWF,EAAG,WAAWL,IAAS,SAAY,iBAAiB,GAAG,OAAOA,IAAS,EAAE,OAAOA,EAAA,IAAW,QAAW;AAAA,YACvHC,IACC,gBAAAK,EAAC,QAAA,EAAK,WAAU,4CAA2C,cAAY,GAAGL,CAAM,QAC7E,UAAA,MAAM,KAAK,EAAE,QAAQ,EAAA,CAAG,EAAE,IAAI,CAACO,GAAGC,MACjC,gBAAAH,EAACI,GAAA,EAAa,WAAU,cAAA,GAAbD,CAA2B,CACvC,EAAA,CACH,IACE;AAAA,UAAA,GACN;AAAA,UACA,gBAAAH,EAAC,cAAA,EAAW,WAAU,mDAAmD,UAAAX,GAAM;AAAA,UAC/E,gBAAAS,EAAC,cAAA,EAAW,WAAU,gCACnB,UAAA;AAAA,YAAAL,KAGC,gBAAAO;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,OAAOJ;AAAA,gBACP,WAAWG;AAAA,kBACT;AAAA,kBACA,CAACL,KAAU;AAAA,gBAAA;AAAA,gBAGZ,YAASJ,CAAM;AAAA,cAAA;AAAA,YAAA;AAAA,8BAGnB,OAAA,EACC,UAAA;AAAA,cAAA,gBAAAU,EAAC,OAAA,EAAI,WAAU,yCAAyC,UAAAV,GAAO;AAAA,eAC7DC,KAAQC,MACR,gBAAAQ,EAAC,OAAA,EAAI,WAAU,iCACZ,UAAA,CAACT,GAAMC,CAAO,EAAE,OAAO,OAAO,EAAE,KAAK,KAAK,EAAA,CAC7C;AAAA,YAAA,EAAA,CAEJ;AAAA,UAAA,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
1
+ {"version":3,"file":"TestimonialCard.js","sources":["../../../../src/components/Testimonials/TestimonialCard.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Quote, Star } from \"../../icons\";\nimport { initials } from \"./parts\";\nimport type { TestimonialCardProps } from \"./types\";\n\nexport const TestimonialCard = forwardRef<HTMLElement, TestimonialCardProps>(\n function TestimonialCard({ className, testimonial, ...props }, ref) {\n const { quote, author, role, company, avatar, accent, rating } = testimonial;\n const badgeStyle = accent\n ? { backgroundColor: accent, color: `contrast-color(${accent})` }\n : undefined;\n\n return (\n <figure\n ref={ref}\n className={cn(\n \"mb-4 flex flex-col break-inside-avoid rounded-2xl border border-border bg-surface p-7\",\n className,\n )}\n {...props}\n >\n <div className=\"mb-5 flex items-center justify-between\">\n <Quote className={cn(\"h-6 w-6\", accent ? undefined : \"text-primary/30\")} style={accent ? { color: accent } : undefined} />\n {rating ? (\n <span className=\"flex items-center gap-0.5 text-amber-500\" aria-label={`${rating} / 5`}>\n {Array.from({ length: 5 }).map((_, i) => (\n <Star key={i} className=\"h-3.5 w-3.5\" />\n ))}\n </span>\n ) : null}\n </div>\n <blockquote className=\"flex-1 text-[15px] leading-7 text-foreground/85\">{quote}</blockquote>\n <figcaption className=\"mt-6 flex items-center gap-3\">\n {avatar ? (\n avatar\n ) : (\n <span\n style={badgeStyle}\n className={cn(\n \"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-xs font-bold\",\n !accent && \"bg-primary-soft text-primary\",\n )}\n >\n {initials(author)}\n </span>\n )}\n <div>\n <div className=\"text-sm font-semibold text-foreground\">{author}</div>\n {(role || company) && (\n <div className=\"text-xs text-muted-foreground\">\n {[role, company].filter(Boolean).join(\" · \")}\n </div>\n )}\n </div>\n </figcaption>\n </figure>\n );\n },\n);"],"names":["TestimonialCard","forwardRef","className","testimonial","props","ref","quote","author","role","company","avatar","accent","rating","badgeStyle","jsxs","cn","jsx","Quote","_","i","Star"],"mappings":";;;;;AAMO,MAAMA,IAAkBC;AAAA,EAC7B,SAAyB,EAAE,WAAAC,GAAW,aAAAC,GAAa,GAAGC,EAAA,GAASC,GAAK;AAClE,UAAM,EAAE,OAAAC,GAAO,QAAAC,GAAQ,MAAAC,GAAM,SAAAC,GAAS,QAAAC,GAAQ,QAAAC,GAAQ,QAAAC,MAAWT,GAC3DU,IAAaF,IACf,EAAE,iBAAiBA,GAAQ,OAAO,kBAAkBA,CAAM,IAAA,IAC1D;AAEJ,WACE,gBAAAG;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAT;AAAA,QACA,WAAWU;AAAA,UACT;AAAA,UACAb;AAAA,QAAA;AAAA,QAED,GAAGE;AAAA,QAEJ,UAAA;AAAA,UAAA,gBAAAU,EAAC,OAAA,EAAI,WAAU,0CACb,UAAA;AAAA,YAAA,gBAAAE,EAACC,GAAA,EAAM,WAAWF,EAAG,WAAWJ,IAAS,SAAY,iBAAiB,GAAG,OAAOA,IAAS,EAAE,OAAOA,EAAA,IAAW,QAAW;AAAA,YACvHC,IACC,gBAAAI,EAAC,QAAA,EAAK,WAAU,4CAA2C,cAAY,GAAGJ,CAAM,QAC7E,UAAA,MAAM,KAAK,EAAE,QAAQ,EAAA,CAAG,EAAE,IAAI,CAACM,GAAGC,MACjC,gBAAAH,EAACI,GAAA,EAAa,WAAU,cAAA,GAAbD,CAA2B,CACvC,EAAA,CACH,IACE;AAAA,UAAA,GACN;AAAA,UACA,gBAAAH,EAAC,cAAA,EAAW,WAAU,mDAAmD,UAAAV,GAAM;AAAA,UAC/E,gBAAAQ,EAAC,cAAA,EAAW,WAAU,gCACnB,UAAA;AAAA,YAAAJ,KAGC,gBAAAM;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,OAAOH;AAAA,gBACP,WAAWE;AAAA,kBACT;AAAA,kBACA,CAACJ,KAAU;AAAA,gBAAA;AAAA,gBAGZ,YAASJ,CAAM;AAAA,cAAA;AAAA,YAAA;AAAA,8BAGnB,OAAA,EACC,UAAA;AAAA,cAAA,gBAAAS,EAAC,OAAA,EAAI,WAAU,yCAAyC,UAAAT,GAAO;AAAA,eAC7DC,KAAQC,MACR,gBAAAO,EAAC,OAAA,EAAI,WAAU,iCACZ,UAAA,CAACR,GAAMC,CAAO,EAAE,OAAO,OAAO,EAAE,KAAK,KAAK,EAAA,CAC7C;AAAA,YAAA,EAAA,CAEJ;AAAA,UAAA,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
@@ -2,16 +2,15 @@
2
2
  import { jsxs as n, jsx as r } from "react/jsx-runtime";
3
3
  import { forwardRef as b, useState as g } from "react";
4
4
  import { cn as i } from "../../../utils/cn.js";
5
- import { getContrastText as x } from "../../../utils/contrast.js";
6
- import { Quote as h, ChevronLeft as p, ChevronRight as v } from "../../../icons.js";
7
- import { initials as N } from "../parts.js";
8
- const y = b(
5
+ import { Quote as x, ChevronLeft as h, ChevronRight as p } from "../../../icons.js";
6
+ import { initials as v } from "../parts.js";
7
+ const N = b(
9
8
  ({ className: d, items: o, ...u }, f) => {
10
- const [a, l] = g(0), e = o[a % o.length], m = e.accent ? { backgroundColor: e.accent, color: x(e.accent, "#111111", "#ffffff") } : void 0, s = (c) => l((t) => (t + c + o.length) % o.length);
9
+ const [a, l] = g(0), e = o[a % o.length], m = e.accent ? { backgroundColor: e.accent, color: `contrast-color(${e.accent})` } : void 0, s = (c) => l((t) => (t + c + o.length) % o.length);
11
10
  return /* @__PURE__ */ n("div", { className: i("mx-auto w-full max-w-3xl", d), ref: f, ...u, children: [
12
11
  /* @__PURE__ */ n("figure", { className: "relative rounded-2xl border border-border bg-surface p-10 text-center sm:p-14", children: [
13
12
  /* @__PURE__ */ r(
14
- h,
13
+ x,
15
14
  {
16
15
  className: i("mx-auto mb-6 h-8 w-8", e.accent ? void 0 : "text-primary/25"),
17
16
  style: e.accent ? { color: e.accent } : void 0,
@@ -28,7 +27,7 @@ const y = b(
28
27
  "inline-flex h-11 w-11 items-center justify-center rounded-full text-xs font-bold",
29
28
  !e.accent && "bg-foreground text-background"
30
29
  ),
31
- children: N(e.author)
30
+ children: v(e.author)
32
31
  }
33
32
  ),
34
33
  /* @__PURE__ */ n("div", { className: "text-left", children: [
@@ -45,7 +44,7 @@ const y = b(
45
44
  "aria-label": "Previous testimonial",
46
45
  onClick: () => s(-1),
47
46
  className: "inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-border bg-surface text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
48
- children: /* @__PURE__ */ r(p, { className: "h-4 w-4" })
47
+ children: /* @__PURE__ */ r(h, { className: "h-4 w-4" })
49
48
  }
50
49
  ),
51
50
  /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: o.map((c, t) => /* @__PURE__ */ r(
@@ -69,15 +68,15 @@ const y = b(
69
68
  "aria-label": "Next testimonial",
70
69
  onClick: () => s(1),
71
70
  className: "inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-border bg-surface text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
72
- children: /* @__PURE__ */ r(v, { className: "h-4 w-4" })
71
+ children: /* @__PURE__ */ r(p, { className: "h-4 w-4" })
73
72
  }
74
73
  )
75
74
  ] })
76
75
  ] });
77
76
  }
78
77
  );
79
- y.displayName = "TestimonialsCarousel";
78
+ N.displayName = "TestimonialsCarousel";
80
79
  export {
81
- y as TestimonialsCarousel
80
+ N as TestimonialsCarousel
82
81
  };
83
82
  //# sourceMappingURL=Carousel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Carousel.js","sources":["../../../../../src/components/Testimonials/variants/Carousel.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, useState, type HTMLAttributes } from \"react\";\nimport { cn } from \"../../../utils/cn\";\nimport { getContrastText } from \"../../../utils/contrast\";\nimport { ChevronLeft, ChevronRight, Quote } from \"../../../icons\";\nimport { initials } from \"../parts\";\nimport type { Testimonial } from \"../types\";\n\ninterface CarouselProps extends HTMLAttributes<HTMLDivElement> {\n items: Testimonial[];\n}\n\nexport const TestimonialsCarousel = forwardRef<HTMLDivElement, CarouselProps>(\n ({ className, items, ...props }, ref) => {\n const [index, setIndex] = useState(0);\n const item = items[index % items.length];\n const badgeStyle = item.accent\n ? { backgroundColor: item.accent, color: getContrastText(item.accent, \"#111111\", \"#ffffff\") }\n : undefined;\n\n const go = (dir: 1 | -1) => setIndex((i) => (i + dir + items.length) % items.length);\n\n return (\n <div className={cn(\"mx-auto w-full max-w-3xl\", className)} ref={ref} {...props}>\n <figure className=\"relative rounded-2xl border border-border bg-surface p-10 text-center sm:p-14\">\n <Quote\n className={cn(\"mx-auto mb-6 h-8 w-8\", item.accent ? undefined : \"text-primary/25\")}\n style={item.accent ? { color: item.accent } : undefined}\n aria-hidden\n />\n <blockquote className=\"font-display text-balance text-xl font-medium leading-relaxed tracking-tight text-foreground sm:text-2xl\">\n {item.quote}\n </blockquote>\n <figcaption className=\"mt-8 flex items-center justify-center gap-3\">\n {item.avatar ? (\n item.avatar\n ) : (\n <span\n style={badgeStyle}\n className={cn(\n \"inline-flex h-11 w-11 items-center justify-center rounded-full text-xs font-bold\",\n !item.accent && \"bg-foreground text-background\",\n )}\n >\n {initials(item.author)}\n </span>\n )}\n <div className=\"text-left\">\n <div className=\"text-sm font-semibold text-foreground\">{item.author}</div>\n <div className=\"text-xs text-muted-foreground\">\n {[item.role, item.company].filter(Boolean).join(\" · \")}\n </div>\n </div>\n </figcaption>\n </figure>\n\n <div className=\"mt-6 flex items-center justify-center gap-4\">\n <button\n type=\"button\"\n aria-label=\"Previous testimonial\"\n onClick={() => go(-1)}\n className=\"inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-border bg-surface text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <ChevronLeft className=\"h-4 w-4\" />\n </button>\n <div className=\"flex items-center gap-1.5\">\n {items.map((_, i) => (\n <button\n key={i}\n type=\"button\"\n aria-label={`Testimonial ${i + 1}`}\n aria-current={i === index}\n onClick={() => setIndex(i)}\n className={cn(\n \"h-1.5 cursor-pointer rounded-full transition-all duration-200\",\n i === index ? \"w-6 bg-foreground\" : \"w-1.5 bg-foreground/25 hover:bg-foreground/50\",\n )}\n />\n ))}\n </div>\n <button\n type=\"button\"\n aria-label=\"Next testimonial\"\n onClick={() => go(1)}\n className=\"inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-border bg-surface text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <ChevronRight className=\"h-4 w-4\" />\n </button>\n </div>\n </div>\n );\n },\n);\nTestimonialsCarousel.displayName = \"TestimonialsCarousel\";"],"names":["TestimonialsCarousel","forwardRef","className","items","props","ref","index","setIndex","useState","item","badgeStyle","getContrastText","go","dir","i","jsxs","cn","jsx","Quote","initials","ChevronLeft","_","ChevronRight"],"mappings":";;;;;;AAYO,MAAMA,IAAuBC;AAAA,EAClC,CAAC,EAAE,WAAAC,GAAW,OAAAC,GAAO,GAAGC,EAAA,GAASC,MAAQ;AACvC,UAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAS,CAAC,GAC9BC,IAAON,EAAMG,IAAQH,EAAM,MAAM,GACjCO,IAAaD,EAAK,SACpB,EAAE,iBAAiBA,EAAK,QAAQ,OAAOE,EAAgBF,EAAK,QAAQ,WAAW,SAAS,MACxF,QAEEG,IAAK,CAACC,MAAgBN,EAAS,CAACO,OAAOA,IAAID,IAAMV,EAAM,UAAUA,EAAM,MAAM;AAEnF,WACE,gBAAAY,EAAC,SAAI,WAAWC,EAAG,4BAA4Bd,CAAS,GAAG,KAAAG,GAAW,GAAGD,GACvE,UAAA;AAAA,MAAA,gBAAAW,EAAC,UAAA,EAAO,WAAU,iFAChB,UAAA;AAAA,QAAA,gBAAAE;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,WAAWF,EAAG,wBAAwBP,EAAK,SAAS,SAAY,iBAAiB;AAAA,YACjF,OAAOA,EAAK,SAAS,EAAE,OAAOA,EAAK,WAAW;AAAA,YAC9C,eAAW;AAAA,UAAA;AAAA,QAAA;AAAA,QAEb,gBAAAQ,EAAC,cAAA,EAAW,WAAU,4GACnB,YAAK,OACR;AAAA,QACA,gBAAAF,EAAC,cAAA,EAAW,WAAU,+CACnB,UAAA;AAAA,UAAAN,EAAK,SACJA,EAAK,SAEL,gBAAAQ;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,OAAOP;AAAA,cACP,WAAWM;AAAA,gBACT;AAAA,gBACA,CAACP,EAAK,UAAU;AAAA,cAAA;AAAA,cAGjB,UAAAU,EAASV,EAAK,MAAM;AAAA,YAAA;AAAA,UAAA;AAAA,UAGzB,gBAAAM,EAAC,OAAA,EAAI,WAAU,aACb,UAAA;AAAA,YAAA,gBAAAE,EAAC,OAAA,EAAI,WAAU,yCAAyC,UAAAR,EAAK,QAAO;AAAA,YACpE,gBAAAQ,EAAC,OAAA,EAAI,WAAU,iCACZ,WAACR,EAAK,MAAMA,EAAK,OAAO,EAAE,OAAO,OAAO,EAAE,KAAK,KAAK,EAAA,CACvD;AAAA,UAAA,EAAA,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA,GACF;AAAA,MAEA,gBAAAM,EAAC,OAAA,EAAI,WAAU,+CACb,UAAA;AAAA,QAAA,gBAAAE;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,cAAW;AAAA,YACX,SAAS,MAAML,EAAG,EAAE;AAAA,YACpB,WAAU;AAAA,YAEV,UAAA,gBAAAK,EAACG,GAAA,EAAY,WAAU,UAAA,CAAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAEnC,gBAAAH,EAAC,SAAI,WAAU,6BACZ,YAAM,IAAI,CAACI,GAAGP,MACb,gBAAAG;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,MAAK;AAAA,YACL,cAAY,eAAeH,IAAI,CAAC;AAAA,YAChC,gBAAcA,MAAMR;AAAA,YACpB,SAAS,MAAMC,EAASO,CAAC;AAAA,YACzB,WAAWE;AAAA,cACT;AAAA,cACAF,MAAMR,IAAQ,sBAAsB;AAAA,YAAA;AAAA,UACtC;AAAA,UARKQ;AAAA,QAAA,CAUR,GACH;AAAA,QACA,gBAAAG;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,cAAW;AAAA,YACX,SAAS,MAAML,EAAG,CAAC;AAAA,YACnB,WAAU;AAAA,YAEV,UAAA,gBAAAK,EAACK,GAAA,EAAa,WAAU,UAAA,CAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACpC,EAAA,CACF;AAAA,IAAA,GACF;AAAA,EAEJ;AACF;AACAtB,EAAqB,cAAc;"}
1
+ {"version":3,"file":"Carousel.js","sources":["../../../../../src/components/Testimonials/variants/Carousel.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, useState, type HTMLAttributes } from \"react\";\nimport { cn } from \"../../../utils/cn\";\nimport { ChevronLeft, ChevronRight, Quote } from \"../../../icons\";\nimport { initials } from \"../parts\";\nimport type { Testimonial } from \"../types\";\n\ninterface CarouselProps extends HTMLAttributes<HTMLDivElement> {\n items: Testimonial[];\n}\n\nexport const TestimonialsCarousel = forwardRef<HTMLDivElement, CarouselProps>(\n ({ className, items, ...props }, ref) => {\n const [index, setIndex] = useState(0);\n const item = items[index % items.length];\n const badgeStyle = item.accent\n ? { backgroundColor: item.accent, color: `contrast-color(${item.accent})` }\n : undefined;\n\n const go = (dir: 1 | -1) => setIndex((i) => (i + dir + items.length) % items.length);\n\n return (\n <div className={cn(\"mx-auto w-full max-w-3xl\", className)} ref={ref} {...props}>\n <figure className=\"relative rounded-2xl border border-border bg-surface p-10 text-center sm:p-14\">\n <Quote\n className={cn(\"mx-auto mb-6 h-8 w-8\", item.accent ? undefined : \"text-primary/25\")}\n style={item.accent ? { color: item.accent } : undefined}\n aria-hidden\n />\n <blockquote className=\"font-display text-balance text-xl font-medium leading-relaxed tracking-tight text-foreground sm:text-2xl\">\n {item.quote}\n </blockquote>\n <figcaption className=\"mt-8 flex items-center justify-center gap-3\">\n {item.avatar ? (\n item.avatar\n ) : (\n <span\n style={badgeStyle}\n className={cn(\n \"inline-flex h-11 w-11 items-center justify-center rounded-full text-xs font-bold\",\n !item.accent && \"bg-foreground text-background\",\n )}\n >\n {initials(item.author)}\n </span>\n )}\n <div className=\"text-left\">\n <div className=\"text-sm font-semibold text-foreground\">{item.author}</div>\n <div className=\"text-xs text-muted-foreground\">\n {[item.role, item.company].filter(Boolean).join(\" · \")}\n </div>\n </div>\n </figcaption>\n </figure>\n\n <div className=\"mt-6 flex items-center justify-center gap-4\">\n <button\n type=\"button\"\n aria-label=\"Previous testimonial\"\n onClick={() => go(-1)}\n className=\"inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-border bg-surface text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <ChevronLeft className=\"h-4 w-4\" />\n </button>\n <div className=\"flex items-center gap-1.5\">\n {items.map((_, i) => (\n <button\n key={i}\n type=\"button\"\n aria-label={`Testimonial ${i + 1}`}\n aria-current={i === index}\n onClick={() => setIndex(i)}\n className={cn(\n \"h-1.5 cursor-pointer rounded-full transition-all duration-200\",\n i === index ? \"w-6 bg-foreground\" : \"w-1.5 bg-foreground/25 hover:bg-foreground/50\",\n )}\n />\n ))}\n </div>\n <button\n type=\"button\"\n aria-label=\"Next testimonial\"\n onClick={() => go(1)}\n className=\"inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-border bg-surface text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <ChevronRight className=\"h-4 w-4\" />\n </button>\n </div>\n </div>\n );\n },\n);\nTestimonialsCarousel.displayName = \"TestimonialsCarousel\";"],"names":["TestimonialsCarousel","forwardRef","className","items","props","ref","index","setIndex","useState","item","badgeStyle","go","dir","i","jsxs","cn","jsx","Quote","initials","ChevronLeft","_","ChevronRight"],"mappings":";;;;;AAWO,MAAMA,IAAuBC;AAAA,EAClC,CAAC,EAAE,WAAAC,GAAW,OAAAC,GAAO,GAAGC,EAAA,GAASC,MAAQ;AACvC,UAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAS,CAAC,GAC9BC,IAAON,EAAMG,IAAQH,EAAM,MAAM,GACjCO,IAAaD,EAAK,SACpB,EAAE,iBAAiBA,EAAK,QAAQ,OAAO,kBAAkBA,EAAK,MAAM,IAAA,IACpE,QAEEE,IAAK,CAACC,MAAgBL,EAAS,CAACM,OAAOA,IAAID,IAAMT,EAAM,UAAUA,EAAM,MAAM;AAEnF,WACE,gBAAAW,EAAC,SAAI,WAAWC,EAAG,4BAA4Bb,CAAS,GAAG,KAAAG,GAAW,GAAGD,GACvE,UAAA;AAAA,MAAA,gBAAAU,EAAC,UAAA,EAAO,WAAU,iFAChB,UAAA;AAAA,QAAA,gBAAAE;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,WAAWF,EAAG,wBAAwBN,EAAK,SAAS,SAAY,iBAAiB;AAAA,YACjF,OAAOA,EAAK,SAAS,EAAE,OAAOA,EAAK,WAAW;AAAA,YAC9C,eAAW;AAAA,UAAA;AAAA,QAAA;AAAA,QAEb,gBAAAO,EAAC,cAAA,EAAW,WAAU,4GACnB,YAAK,OACR;AAAA,QACA,gBAAAF,EAAC,cAAA,EAAW,WAAU,+CACnB,UAAA;AAAA,UAAAL,EAAK,SACJA,EAAK,SAEL,gBAAAO;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,OAAON;AAAA,cACP,WAAWK;AAAA,gBACT;AAAA,gBACA,CAACN,EAAK,UAAU;AAAA,cAAA;AAAA,cAGjB,UAAAS,EAAST,EAAK,MAAM;AAAA,YAAA;AAAA,UAAA;AAAA,UAGzB,gBAAAK,EAAC,OAAA,EAAI,WAAU,aACb,UAAA;AAAA,YAAA,gBAAAE,EAAC,OAAA,EAAI,WAAU,yCAAyC,UAAAP,EAAK,QAAO;AAAA,YACpE,gBAAAO,EAAC,OAAA,EAAI,WAAU,iCACZ,WAACP,EAAK,MAAMA,EAAK,OAAO,EAAE,OAAO,OAAO,EAAE,KAAK,KAAK,EAAA,CACvD;AAAA,UAAA,EAAA,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA,GACF;AAAA,MAEA,gBAAAK,EAAC,OAAA,EAAI,WAAU,+CACb,UAAA;AAAA,QAAA,gBAAAE;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,cAAW;AAAA,YACX,SAAS,MAAML,EAAG,EAAE;AAAA,YACpB,WAAU;AAAA,YAEV,UAAA,gBAAAK,EAACG,GAAA,EAAY,WAAU,UAAA,CAAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAEnC,gBAAAH,EAAC,SAAI,WAAU,6BACZ,YAAM,IAAI,CAACI,GAAGP,MACb,gBAAAG;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,MAAK;AAAA,YACL,cAAY,eAAeH,IAAI,CAAC;AAAA,YAChC,gBAAcA,MAAMP;AAAA,YACpB,SAAS,MAAMC,EAASM,CAAC;AAAA,YACzB,WAAWE;AAAA,cACT;AAAA,cACAF,MAAMP,IAAQ,sBAAsB;AAAA,YAAA;AAAA,UACtC;AAAA,UARKO;AAAA,QAAA,CAUR,GACH;AAAA,QACA,gBAAAG;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,cAAW;AAAA,YACX,SAAS,MAAML,EAAG,CAAC;AAAA,YACnB,WAAU;AAAA,YAEV,UAAA,gBAAAK,EAACK,GAAA,EAAa,WAAU,UAAA,CAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACpC,EAAA,CACF;AAAA,IAAA,GACF;AAAA,EAEJ;AACF;AACArB,EAAqB,cAAc;"}
package/dist/es/index.js CHANGED
@@ -1,110 +1,106 @@
1
1
  import { Button as e } from "./components/Button.js";
2
2
  import { Slot as a } from "./components/Slot.js";
3
3
  import { Badge as m } from "./components/Badge.js";
4
- import { Card as f, CardContent as n, CardDescription as i, CardFooter as C, CardHeader as d, CardTitle as l } from "./components/Card.js";
5
- import { Section as c, SectionHeader as g } from "./components/Section.js";
4
+ import { Card as f, CardContent as n, CardDescription as i, CardFooter as l, CardHeader as C, CardTitle as d } from "./components/Card.js";
5
+ import { Section as s, SectionHeader as S } from "./components/Section.js";
6
6
  import { Modal as h } from "./components/Modal.js";
7
7
  import { Prose as w, ProseLead as k } from "./components/Prose.js";
8
- import { Container as T, Stack as A } from "./components/Container.js";
9
- import { cn as B } from "./utils/cn.js";
10
- import { getContrastText as D } from "./utils/contrast.js";
11
- import { useTokenForeground as v } from "./utils/useTokenForeground.js";
12
- import { iso2ToFlagEmoji as b } from "./utils/iso2Flag.js";
13
- import { ArrowDown as H, ArrowRight as U, ArrowUp as y, ArrowUpRight as E, BarChart as N, Box as Q, Check as j, ChevronDown as X, ChevronLeft as Z, ChevronRight as q, Clock as z, Code as I, Cpu as J, Database as K, DollarSign as O, ExternalLink as V, Gauge as W, Globe as Y, Layers as _, Lock as $, Mail as oo, Menu as ro, Palette as eo, Play as to, Plus as ao, Quote as po, Rocket as mo, Send as xo, ShieldCheck as fo, Sliders as no, Smartphone as io, Star as Co, Terminal as lo, Users as so, X as co, Zap as go } from "./icons.js";
14
- import { AccordionShowcase as ho } from "./components/AccordionShowcase/AccordionShowcase.js";
15
- import { BlogCard as wo } from "./components/Blog/BlogCard.js";
16
- import { BlogSection as Fo } from "./components/Blog/BlogSection.js";
17
- import { CTA as Ao } from "./components/CTA/CTA.js";
18
- import { FAQ as Bo } from "./components/FAQ/FAQ.js";
19
- import { FeatureCard as Do } from "./components/Features/FeatureCard.js";
20
- import { FeatureGrid as vo } from "./components/Features/FeatureGrid.js";
21
- import { FeatureShowcase as bo } from "./components/FeatureShowcase/FeatureShowcase.js";
22
- import { Footer as Ho } from "./components/Footer/Footer.js";
23
- import { Hero as yo } from "./components/Hero/Hero.js";
24
- import { LanguageSwitcher as No } from "./components/LanguageSwitcher/LanguageSwitcher.js";
25
- import { LogoCloud as jo } from "./components/LogoCloud/LogoCloud.js";
26
- import { MegaMenu as Zo } from "./components/MegaMenu/MegaMenu.js";
27
- import { Navbar as zo } from "./components/Navbar/Navbar.js";
28
- import { Newsletter as Jo } from "./components/Newsletter/Newsletter.js";
29
- import { Pricing as Oo } from "./components/Pricing/Pricing.js";
30
- import { Stats as Wo } from "./components/Stats/Stats.js";
31
- import { TestimonialCard as _o } from "./components/Testimonials/TestimonialCard.js";
32
- import { Testimonials as or } from "./components/Testimonials/Testimonials.js";
8
+ import { Container as F, Stack as L } from "./components/Container.js";
9
+ import { cn as P } from "./utils/cn.js";
10
+ import { iso2ToFlagEmoji as D } from "./utils/iso2Flag.js";
11
+ import { ArrowDown as v, ArrowRight as R, ArrowUp as b, ArrowUpRight as G, BarChart as H, Box as U, Check as y, ChevronDown as E, ChevronLeft as N, ChevronRight as Q, Clock as j, Code as X, Cpu as Z, Database as q, DollarSign as z, ExternalLink as I, Gauge as J, Globe as K, Layers as O, Lock as V, Mail as W, Menu as Y, Palette as _, Play as $, Plus as oo, Quote as ro, Rocket as eo, Send as to, ShieldCheck as ao, Sliders as po, Smartphone as mo, Star as xo, Terminal as fo, Users as no, X as io, Zap as lo } from "./icons.js";
12
+ import { AccordionShowcase as co } from "./components/AccordionShowcase/AccordionShowcase.js";
13
+ import { BlogCard as So } from "./components/Blog/BlogCard.js";
14
+ import { BlogSection as ho } from "./components/Blog/BlogSection.js";
15
+ import { CTA as wo } from "./components/CTA/CTA.js";
16
+ import { FAQ as Ao } from "./components/FAQ/FAQ.js";
17
+ import { FeatureCard as Lo } from "./components/Features/FeatureCard.js";
18
+ import { FeatureGrid as Po } from "./components/Features/FeatureGrid.js";
19
+ import { FeatureShowcase as Do } from "./components/FeatureShowcase/FeatureShowcase.js";
20
+ import { Footer as vo } from "./components/Footer/Footer.js";
21
+ import { Hero as bo } from "./components/Hero/Hero.js";
22
+ import { LanguageSwitcher as Ho } from "./components/LanguageSwitcher/LanguageSwitcher.js";
23
+ import { LogoCloud as yo } from "./components/LogoCloud/LogoCloud.js";
24
+ import { MegaMenu as No } from "./components/MegaMenu/MegaMenu.js";
25
+ import { Navbar as jo } from "./components/Navbar/Navbar.js";
26
+ import { Newsletter as Zo } from "./components/Newsletter/Newsletter.js";
27
+ import { Pricing as zo } from "./components/Pricing/Pricing.js";
28
+ import { Stats as Jo } from "./components/Stats/Stats.js";
29
+ import { TestimonialCard as Oo } from "./components/Testimonials/TestimonialCard.js";
30
+ import { Testimonials as Wo } from "./components/Testimonials/Testimonials.js";
33
31
  export {
34
- ho as AccordionShowcase,
35
- H as ArrowDown,
36
- U as ArrowRight,
37
- y as ArrowUp,
38
- E as ArrowUpRight,
32
+ co as AccordionShowcase,
33
+ v as ArrowDown,
34
+ R as ArrowRight,
35
+ b as ArrowUp,
36
+ G as ArrowUpRight,
39
37
  m as Badge,
40
- N as BarChart,
41
- wo as BlogCard,
42
- Fo as BlogSection,
43
- Q as Box,
38
+ H as BarChart,
39
+ So as BlogCard,
40
+ ho as BlogSection,
41
+ U as Box,
44
42
  e as Button,
45
- Ao as CTA,
43
+ wo as CTA,
46
44
  f as Card,
47
45
  n as CardContent,
48
46
  i as CardDescription,
49
- C as CardFooter,
50
- d as CardHeader,
51
- l as CardTitle,
52
- j as Check,
53
- X as ChevronDown,
54
- Z as ChevronLeft,
55
- q as ChevronRight,
56
- z as Clock,
57
- I as Code,
58
- T as Container,
59
- J as Cpu,
60
- K as Database,
61
- O as DollarSign,
62
- V as ExternalLink,
63
- Bo as FAQ,
64
- Do as FeatureCard,
65
- vo as FeatureGrid,
66
- bo as FeatureShowcase,
67
- Ho as Footer,
68
- W as Gauge,
69
- Y as Globe,
70
- yo as Hero,
71
- No as LanguageSwitcher,
72
- _ as Layers,
73
- $ as Lock,
74
- jo as LogoCloud,
75
- oo as Mail,
76
- Zo as MegaMenu,
77
- ro as Menu,
47
+ l as CardFooter,
48
+ C as CardHeader,
49
+ d as CardTitle,
50
+ y as Check,
51
+ E as ChevronDown,
52
+ N as ChevronLeft,
53
+ Q as ChevronRight,
54
+ j as Clock,
55
+ X as Code,
56
+ F as Container,
57
+ Z as Cpu,
58
+ q as Database,
59
+ z as DollarSign,
60
+ I as ExternalLink,
61
+ Ao as FAQ,
62
+ Lo as FeatureCard,
63
+ Po as FeatureGrid,
64
+ Do as FeatureShowcase,
65
+ vo as Footer,
66
+ J as Gauge,
67
+ K as Globe,
68
+ bo as Hero,
69
+ Ho as LanguageSwitcher,
70
+ O as Layers,
71
+ V as Lock,
72
+ yo as LogoCloud,
73
+ W as Mail,
74
+ No as MegaMenu,
75
+ Y as Menu,
78
76
  h as Modal,
79
- zo as Navbar,
80
- Jo as Newsletter,
81
- eo as Palette,
82
- to as Play,
83
- ao as Plus,
84
- Oo as Pricing,
77
+ jo as Navbar,
78
+ Zo as Newsletter,
79
+ _ as Palette,
80
+ $ as Play,
81
+ oo as Plus,
82
+ zo as Pricing,
85
83
  w as Prose,
86
84
  k as ProseLead,
87
- po as Quote,
88
- mo as Rocket,
89
- c as Section,
90
- g as SectionHeader,
91
- xo as Send,
92
- fo as ShieldCheck,
93
- no as Sliders,
85
+ ro as Quote,
86
+ eo as Rocket,
87
+ s as Section,
88
+ S as SectionHeader,
89
+ to as Send,
90
+ ao as ShieldCheck,
91
+ po as Sliders,
94
92
  a as Slot,
95
- io as Smartphone,
96
- A as Stack,
97
- Co as Star,
98
- Wo as Stats,
99
- lo as Terminal,
100
- _o as TestimonialCard,
101
- or as Testimonials,
102
- so as Users,
103
- co as X,
104
- go as Zap,
105
- B as cn,
106
- D as getContrastText,
107
- b as iso2ToFlagEmoji,
108
- v as useTokenForeground
93
+ mo as Smartphone,
94
+ L as Stack,
95
+ xo as Star,
96
+ Jo as Stats,
97
+ fo as Terminal,
98
+ Oo as TestimonialCard,
99
+ Wo as Testimonials,
100
+ no as Users,
101
+ io as X,
102
+ lo as Zap,
103
+ P as cn,
104
+ D as iso2ToFlagEmoji
109
105
  };
110
106
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -160,23 +160,6 @@ export declare function cn(...inputs: ClassValue[]): string;
160
160
 
161
161
  export declare const Code: (props: IconProps) => JSX_2.Element;
162
162
 
163
- /**
164
- * Contrast utilities.
165
- *
166
- * The library ships paired semantic tokens (e.g. --color-primary /
167
- * --color-on-primary) so explicit pairings stay safe. For the few places where
168
- * a *dynamic* color paints a background (a `customColor` prop, a token-based
169
- * highlight card...) we pick the text color that yields the **best WCAG
170
- * contrast ratio** at runtime.
171
- *
172
- * Inputs may be hex colors, bare RGB channels ("21 128 61"), rgb() functions
173
- * (`rgb(21 128 61 / 0.95)`) or CSS variable references
174
- * (`rgb(var(--color-primary) / 0.85)`). Variable references are resolved
175
- * against the live stylesheet before computing luminance, so a re-themed
176
- * palette never produces a low-contrast combination.
177
- */
178
- export declare type ColorInput = string;
179
-
180
163
  /**
181
164
  * Shared layout wrapper — the single source of the container + gutter rules
182
165
  * used across Section, Footer, CTA, templates…
@@ -341,15 +324,6 @@ export declare interface FooterProps extends Omit<HTMLAttributes<HTMLElement>, "
341
324
 
342
325
  export declare const Gauge: (props: IconProps) => JSX_2.Element;
343
326
 
344
- /**
345
- * Returns the more readable of the two candidate text colors for a given
346
- * background. Both candidates are evaluated with the WCAG contrast formula and
347
- * the winning (highest ratio) color is returned — not a fixed luminance
348
- * breakpoint — so mid-luminance backgrounds (amber, pastels, light violet…)
349
- * always fall on the correct side.
350
- */
351
- export declare function getContrastText(bg: ColorInput, light?: string, dark?: string): string;
352
-
353
327
  export declare const Globe: (props: IconProps) => JSX_2.Element;
354
328
 
355
329
  export declare const Hero: ForwardRefExoticComponent<HeroProps & RefAttributes<HTMLElement>>;
@@ -460,6 +434,8 @@ export declare interface MegaMenuFeatured {
460
434
  cta?: string;
461
435
  /** Background color for the card; glyph text color is computed for contrast. */
462
436
  accent?: string;
437
+ /** When true, the card opens in a new tab (`target="_blank"` with `rel="noopener noreferrer"`). */
438
+ external?: boolean;
463
439
  }
464
440
 
465
441
  export declare interface MegaMenuItem {
@@ -471,12 +447,16 @@ export declare interface MegaMenuItem {
471
447
  featured?: MegaMenuFeatured;
472
448
  /** Small pill rendered next to the trigger label. */
473
449
  badge?: string;
450
+ /** When true, a plain link item opens in a new tab (`target="_blank"` with `rel="noopener noreferrer"`). */
451
+ external?: boolean;
474
452
  }
475
453
 
476
454
  export declare interface MegaMenuLink {
477
455
  label: string;
478
456
  href: string;
479
457
  description?: string;
458
+ /** When true, the link opens in a new tab (`target="_blank"` with `rel="noopener noreferrer"`). */
459
+ external?: boolean;
480
460
  }
481
461
 
482
462
  export declare interface MegaMenuProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
@@ -559,6 +539,8 @@ declare type NavbarVariant = "classic" | "floating" | "inverse";
559
539
  export declare interface NavLink {
560
540
  label: string;
561
541
  href: string;
542
+ /** When true, the link opens in a new tab (`target="_blank"` with `rel="noopener noreferrer"`). */
543
+ external?: boolean;
562
544
  }
563
545
 
564
546
  export declare const Newsletter: {
@@ -745,13 +727,6 @@ export declare interface TestimonialsProps extends HTMLAttributes<HTMLDivElement
745
727
 
746
728
  export declare const Users: (props: IconProps) => JSX_2.Element;
747
729
 
748
- /**
749
- * Reads a `--color-*` token from the live stylesheet and returns a text color
750
- * that is always readable against it. Recomputes whenever the palette changes
751
- * at runtime (e.g. the Storybook theme switcher or an app-level theme swap).
752
- */
753
- export declare function useTokenForeground(variable: string, fallback?: string): string;
754
-
755
730
  export declare const X: (props: IconProps) => JSX_2.Element;
756
731
 
757
732
  export declare const Zap: (props: IconProps) => JSX_2.Element;
package/dist/styles.css CHANGED
@@ -2774,9 +2774,6 @@
2774
2774
  .text-white {
2775
2775
  color: var(--color-white);
2776
2776
  }
2777
- .lowercase {
2778
- text-transform: lowercase;
2779
- }
2780
2777
  .uppercase {
2781
2778
  text-transform: uppercase;
2782
2779
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ugurdemirel/landcraft",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function m(n){return typeof window>"u"?"":window.getComputedStyle(document.documentElement).getPropertyValue(n).trim()}function d(n){let t=n;const r=t.match(/var\(--[\w-]+/g)??[];for(const e of r){const o=e.replace(/^var\(/,""),a=m(o);a&&(t=t.split(e).join(a))}return t}function p(n){var s;let t=n.trim();if(/^#([0-9a-f]{3}){1,2}$/i.test(t))return t.length===4&&(t="#"+t.slice(1).split("").map(c=>c+c).join("")),{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16)};const o=((s=d(t).replace(/[()/;,]/g," ").match(/-?\d+(\.\d+)?/g))==null?void 0:s.map(Number))??[];if(o.length<3)return null;const[a,u,f]=o;return{r:Math.max(0,Math.min(255,Math.round(a))),g:Math.max(0,Math.min(255,Math.round(u))),b:Math.max(0,Math.min(255,Math.round(f)))}}function i(n){const t=p(n);if(!t)return 0;const r=[t.r,t.g,t.b].map(e=>e/255).map(e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4));return .2126*r[0]+.7152*r[1]+.0722*r[2]}function l(n,t){const[r,e]=n>t?[n,t]:[t,n];return(r+.05)/(e+.05)}function g(n,t="#ffffff",r="#0f172a"){const e=i(n),o=i(t),a=i(r);return l(e,o)>=l(e,a)?t:r}exports.getContrastText=g;
2
- //# sourceMappingURL=contrast.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contrast.cjs","sources":["../../../src/utils/contrast.ts"],"sourcesContent":["/**\n * Contrast utilities.\n *\n * The library ships paired semantic tokens (e.g. --color-primary /\n * --color-on-primary) so explicit pairings stay safe. For the few places where\n * a *dynamic* color paints a background (a `customColor` prop, a token-based\n * highlight card...) we pick the text color that yields the **best WCAG\n * contrast ratio** at runtime.\n *\n * Inputs may be hex colors, bare RGB channels (\"21 128 61\"), rgb() functions\n * (`rgb(21 128 61 / 0.95)`) or CSS variable references\n * (`rgb(var(--color-primary) / 0.85)`). Variable references are resolved\n * against the live stylesheet before computing luminance, so a re-themed\n * palette never produces a low-contrast combination.\n */\n\nexport type ColorInput = string;\n\nfunction readVariable(name: string): string {\n if (typeof window === \"undefined\") return \"\";\n return window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(name)\n .trim();\n}\n\n/** Resolve `var(--x)` references against the live stylesheet. */\nfunction resolveVars(input: string): string {\n let str = input;\n const refs = str.match(/var\\(--[\\w-]+/g) ?? [];\n for (const ref of refs) {\n const name = ref.replace(/^var\\(/, \"\");\n const resolved = readVariable(name);\n if (resolved) str = str.split(ref).join(resolved);\n }\n return str;\n}\n\ninterface RGB {\n r: number;\n g: number;\n b: number;\n}\n\nfunction channels(color: ColorInput): RGB | null {\n let str = color.trim();\n\n if (/^#([0-9a-f]{3}){1,2}$/i.test(str)) {\n if (str.length === 4) {\n str =\n \"#\" +\n str\n .slice(1)\n .split(\"\")\n .map((c) => c + c)\n .join(\"\");\n }\n return {\n r: parseInt(str.slice(1, 3), 16),\n g: parseInt(str.slice(3, 5), 16),\n b: parseInt(str.slice(5, 7), 16),\n };\n }\n\n const resolved = resolveVars(str);\n\n // Normalize rgb()/rgba() separators (\"r g b / a\", \"r, g, b\") and bare channels.\n const normalized = resolved.replace(/[()/;,]/g, \" \");\n const parts = normalized.match(/-?\\d+(\\.\\d+)?/g)?.map(Number) ?? [];\n if (parts.length < 3) return null;\n // Alpha (4th component) is ignored: these colors paint opaque surfaces and\n // mixing against an unknown backdrop can't be modelled reliably.\n const [r, g, b] = parts;\n return {\n r: Math.max(0, Math.min(255, Math.round(r))),\n g: Math.max(0, Math.min(255, Math.round(g))),\n b: Math.max(0, Math.min(255, Math.round(b))),\n };\n}\n\nfunction relativeLuminance(color: ColorInput): number {\n const c = channels(color);\n if (!c) return 0;\n const lin = [c.r, c.g, c.b]\n .map((v) => v / 255)\n .map((v) => (v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4)));\n return 0.2126 * lin[0] + 0.7152 * lin[1] + 0.0722 * lin[2];\n}\n\nfunction contrastRatio(lumA: number, lumB: number): number {\n const [hi, lo] = lumA > lumB ? [lumA, lumB] : [lumB, lumA];\n return (hi + 0.05) / (lo + 0.05);\n}\n\n/**\n * Returns the more readable of the two candidate text colors for a given\n * background. Both candidates are evaluated with the WCAG contrast formula and\n * the winning (highest ratio) color is returned — not a fixed luminance\n * breakpoint — so mid-luminance backgrounds (amber, pastels, light violet…)\n * always fall on the correct side.\n */\nexport function getContrastText(bg: ColorInput, light = \"#ffffff\", dark = \"#0f172a\"): string {\n const lumBg = relativeLuminance(bg);\n const lumLight = relativeLuminance(light);\n const lumDark = relativeLuminance(dark);\n return contrastRatio(lumBg, lumLight) >= contrastRatio(lumBg, lumDark) ? light : dark;\n}"],"names":["readVariable","name","resolveVars","input","str","refs","ref","resolved","channels","color","parts","_a","r","g","b","relativeLuminance","c","lin","v","contrastRatio","lumA","lumB","hi","lo","getContrastText","bg","light","dark","lumBg","lumLight","lumDark"],"mappings":"gFAkBA,SAASA,EAAaC,EAAsB,CAC1C,OAAI,OAAO,OAAW,IAAoB,GACnC,OACJ,iBAAiB,SAAS,eAAe,EACzC,iBAAiBA,CAAI,EACrB,KAAA,CACL,CAGA,SAASC,EAAYC,EAAuB,CAC1C,IAAIC,EAAMD,EACV,MAAME,EAAOD,EAAI,MAAM,gBAAgB,GAAK,CAAA,EAC5C,UAAWE,KAAOD,EAAM,CACtB,MAAMJ,EAAOK,EAAI,QAAQ,SAAU,EAAE,EAC/BC,EAAWP,EAAaC,CAAI,EAC9BM,IAAUH,EAAMA,EAAI,MAAME,CAAG,EAAE,KAAKC,CAAQ,EAClD,CACA,OAAOH,CACT,CAQA,SAASI,EAASC,EAA+B,OAC/C,IAAIL,EAAMK,EAAM,KAAA,EAEhB,GAAI,yBAAyB,KAAKL,CAAG,EACnC,OAAIA,EAAI,SAAW,IACjBA,EACE,IACAA,EACG,MAAM,CAAC,EACP,MAAM,EAAE,EACR,IAAK,GAAM,EAAI,CAAC,EAChB,KAAK,EAAE,GAEP,CACL,EAAG,SAASA,EAAI,MAAM,EAAG,CAAC,EAAG,EAAE,EAC/B,EAAG,SAASA,EAAI,MAAM,EAAG,CAAC,EAAG,EAAE,EAC/B,EAAG,SAASA,EAAI,MAAM,EAAG,CAAC,EAAG,EAAE,CAAA,EAQnC,MAAMM,IAAQC,EAJGT,EAAYE,CAAG,EAGJ,QAAQ,WAAY,GAAG,EAC1B,MAAM,gBAAgB,IAAjC,YAAAO,EAAoC,IAAI,UAAW,CAAA,EACjE,GAAID,EAAM,OAAS,EAAG,OAAO,KAG7B,KAAM,CAACE,EAAGC,EAAGC,CAAC,EAAIJ,EAClB,MAAO,CACL,EAAG,KAAK,IAAI,EAAG,KAAK,IAAI,IAAK,KAAK,MAAME,CAAC,CAAC,CAAC,EAC3C,EAAG,KAAK,IAAI,EAAG,KAAK,IAAI,IAAK,KAAK,MAAMC,CAAC,CAAC,CAAC,EAC3C,EAAG,KAAK,IAAI,EAAG,KAAK,IAAI,IAAK,KAAK,MAAMC,CAAC,CAAC,CAAC,CAAA,CAE/C,CAEA,SAASC,EAAkBN,EAA2B,CACpD,MAAMO,EAAIR,EAASC,CAAK,EACxB,GAAI,CAACO,EAAG,MAAO,GACf,MAAMC,EAAM,CAACD,EAAE,EAAGA,EAAE,EAAGA,EAAE,CAAC,EACvB,IAAKE,GAAMA,EAAI,GAAG,EAClB,IAAKA,GAAOA,GAAK,OAAUA,EAAI,MAAQ,KAAK,KAAKA,EAAI,MAAS,MAAO,GAAG,CAAE,EAC7E,MAAO,OAASD,EAAI,CAAC,EAAI,MAASA,EAAI,CAAC,EAAI,MAASA,EAAI,CAAC,CAC3D,CAEA,SAASE,EAAcC,EAAcC,EAAsB,CACzD,KAAM,CAACC,EAAIC,CAAE,EAAIH,EAAOC,EAAO,CAACD,EAAMC,CAAI,EAAI,CAACA,EAAMD,CAAI,EACzD,OAAQE,EAAK,MAASC,EAAK,IAC7B,CASO,SAASC,EAAgBC,EAAgBC,EAAQ,UAAWC,EAAO,UAAmB,CAC3F,MAAMC,EAAQb,EAAkBU,CAAE,EAC5BI,EAAWd,EAAkBW,CAAK,EAClCI,EAAUf,EAAkBY,CAAI,EACtC,OAAOR,EAAcS,EAAOC,CAAQ,GAAKV,EAAcS,EAAOE,CAAO,EAAIJ,EAAQC,CACnF"}
@@ -1,3 +0,0 @@
1
- "use client";
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),s=require("./contrast.cjs");function c(e){return typeof window>"u"?"":window.getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function f(e,n="#ffffff"){const[d,i]=u.useState(()=>{const t=c(e);return t?s.getContrastText(t):n});return u.useEffect(()=>{const t=()=>{const o=c(e);i(o?s.getContrastText(o):n)};t();const r=new MutationObserver(t);return r.observe(document.documentElement,{attributes:!0,attributeFilter:["style","class"]}),()=>r.disconnect()},[e,n]),d}exports.useTokenForeground=f;
3
- //# sourceMappingURL=useTokenForeground.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTokenForeground.cjs","sources":["../../../src/utils/useTokenForeground.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useState } from \"react\";\nimport { getContrastText } from \"./contrast\";\n\nfunction readChannel(variable: string): string {\n if (typeof window === \"undefined\") return \"\";\n return window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(variable)\n .trim();\n}\n\n/**\n * Reads a `--color-*` token from the live stylesheet and returns a text color\n * that is always readable against it. Recomputes whenever the palette changes\n * at runtime (e.g. the Storybook theme switcher or an app-level theme swap).\n */\nexport function useTokenForeground(variable: string, fallback = \"#ffffff\"): string {\n const [text, setText] = useState<string>(() => {\n const value = readChannel(variable);\n return value ? getContrastText(value) : fallback;\n });\n\n useEffect(() => {\n const update = () => {\n const value = readChannel(variable);\n setText(value ? getContrastText(value) : fallback);\n };\n update();\n const observer = new MutationObserver(update);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"style\", \"class\"],\n });\n return () => observer.disconnect();\n }, [variable, fallback]);\n\n return text;\n}"],"names":["readChannel","variable","useTokenForeground","fallback","text","setText","useState","value","getContrastText","useEffect","update","observer"],"mappings":"qIAIA,SAASA,EAAYC,EAA0B,CAC7C,OAAI,OAAO,OAAW,IAAoB,GACnC,OACJ,iBAAiB,SAAS,eAAe,EACzC,iBAAiBA,CAAQ,EACzB,KAAA,CACL,CAOO,SAASC,EAAmBD,EAAkBE,EAAW,UAAmB,CACjF,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAAA,SAAiB,IAAM,CAC7C,MAAMC,EAAQP,EAAYC,CAAQ,EAClC,OAAOM,EAAQC,EAAAA,gBAAgBD,CAAK,EAAIJ,CAC1C,CAAC,EAEDM,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAS,IAAM,CACnB,MAAMH,EAAQP,EAAYC,CAAQ,EAClCI,EAAQE,EAAQC,EAAAA,gBAAgBD,CAAK,EAAIJ,CAAQ,CACnD,EACAO,EAAA,EACA,MAAMC,EAAW,IAAI,iBAAiBD,CAAM,EAC5C,OAAAC,EAAS,QAAQ,SAAS,gBAAiB,CACzC,WAAY,GACZ,gBAAiB,CAAC,QAAS,OAAO,CAAA,CACnC,EACM,IAAMA,EAAS,WAAA,CACxB,EAAG,CAACV,EAAUE,CAAQ,CAAC,EAEhBC,CACT"}
@@ -1,48 +0,0 @@
1
- function m(e) {
2
- return typeof window > "u" ? "" : window.getComputedStyle(document.documentElement).getPropertyValue(e).trim();
3
- }
4
- function d(e) {
5
- let t = e;
6
- const r = t.match(/var\(--[\w-]+/g) ?? [];
7
- for (const n of r) {
8
- const o = n.replace(/^var\(/, ""), a = m(o);
9
- a && (t = t.split(n).join(a));
10
- }
11
- return t;
12
- }
13
- function p(e) {
14
- var s;
15
- let t = e.trim();
16
- if (/^#([0-9a-f]{3}){1,2}$/i.test(t))
17
- return t.length === 4 && (t = "#" + t.slice(1).split("").map((c) => c + c).join("")), {
18
- r: parseInt(t.slice(1, 3), 16),
19
- g: parseInt(t.slice(3, 5), 16),
20
- b: parseInt(t.slice(5, 7), 16)
21
- };
22
- const o = ((s = d(t).replace(/[()/;,]/g, " ").match(/-?\d+(\.\d+)?/g)) == null ? void 0 : s.map(Number)) ?? [];
23
- if (o.length < 3) return null;
24
- const [a, l, u] = o;
25
- return {
26
- r: Math.max(0, Math.min(255, Math.round(a))),
27
- g: Math.max(0, Math.min(255, Math.round(l))),
28
- b: Math.max(0, Math.min(255, Math.round(u)))
29
- };
30
- }
31
- function i(e) {
32
- const t = p(e);
33
- if (!t) return 0;
34
- const r = [t.r, t.g, t.b].map((n) => n / 255).map((n) => n <= 0.03928 ? n / 12.92 : Math.pow((n + 0.055) / 1.055, 2.4));
35
- return 0.2126 * r[0] + 0.7152 * r[1] + 0.0722 * r[2];
36
- }
37
- function f(e, t) {
38
- const [r, n] = e > t ? [e, t] : [t, e];
39
- return (r + 0.05) / (n + 0.05);
40
- }
41
- function h(e, t = "#ffffff", r = "#0f172a") {
42
- const n = i(e), o = i(t), a = i(r);
43
- return f(n, o) >= f(n, a) ? t : r;
44
- }
45
- export {
46
- h as getContrastText
47
- };
48
- //# sourceMappingURL=contrast.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contrast.js","sources":["../../../src/utils/contrast.ts"],"sourcesContent":["/**\n * Contrast utilities.\n *\n * The library ships paired semantic tokens (e.g. --color-primary /\n * --color-on-primary) so explicit pairings stay safe. For the few places where\n * a *dynamic* color paints a background (a `customColor` prop, a token-based\n * highlight card...) we pick the text color that yields the **best WCAG\n * contrast ratio** at runtime.\n *\n * Inputs may be hex colors, bare RGB channels (\"21 128 61\"), rgb() functions\n * (`rgb(21 128 61 / 0.95)`) or CSS variable references\n * (`rgb(var(--color-primary) / 0.85)`). Variable references are resolved\n * against the live stylesheet before computing luminance, so a re-themed\n * palette never produces a low-contrast combination.\n */\n\nexport type ColorInput = string;\n\nfunction readVariable(name: string): string {\n if (typeof window === \"undefined\") return \"\";\n return window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(name)\n .trim();\n}\n\n/** Resolve `var(--x)` references against the live stylesheet. */\nfunction resolveVars(input: string): string {\n let str = input;\n const refs = str.match(/var\\(--[\\w-]+/g) ?? [];\n for (const ref of refs) {\n const name = ref.replace(/^var\\(/, \"\");\n const resolved = readVariable(name);\n if (resolved) str = str.split(ref).join(resolved);\n }\n return str;\n}\n\ninterface RGB {\n r: number;\n g: number;\n b: number;\n}\n\nfunction channels(color: ColorInput): RGB | null {\n let str = color.trim();\n\n if (/^#([0-9a-f]{3}){1,2}$/i.test(str)) {\n if (str.length === 4) {\n str =\n \"#\" +\n str\n .slice(1)\n .split(\"\")\n .map((c) => c + c)\n .join(\"\");\n }\n return {\n r: parseInt(str.slice(1, 3), 16),\n g: parseInt(str.slice(3, 5), 16),\n b: parseInt(str.slice(5, 7), 16),\n };\n }\n\n const resolved = resolveVars(str);\n\n // Normalize rgb()/rgba() separators (\"r g b / a\", \"r, g, b\") and bare channels.\n const normalized = resolved.replace(/[()/;,]/g, \" \");\n const parts = normalized.match(/-?\\d+(\\.\\d+)?/g)?.map(Number) ?? [];\n if (parts.length < 3) return null;\n // Alpha (4th component) is ignored: these colors paint opaque surfaces and\n // mixing against an unknown backdrop can't be modelled reliably.\n const [r, g, b] = parts;\n return {\n r: Math.max(0, Math.min(255, Math.round(r))),\n g: Math.max(0, Math.min(255, Math.round(g))),\n b: Math.max(0, Math.min(255, Math.round(b))),\n };\n}\n\nfunction relativeLuminance(color: ColorInput): number {\n const c = channels(color);\n if (!c) return 0;\n const lin = [c.r, c.g, c.b]\n .map((v) => v / 255)\n .map((v) => (v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4)));\n return 0.2126 * lin[0] + 0.7152 * lin[1] + 0.0722 * lin[2];\n}\n\nfunction contrastRatio(lumA: number, lumB: number): number {\n const [hi, lo] = lumA > lumB ? [lumA, lumB] : [lumB, lumA];\n return (hi + 0.05) / (lo + 0.05);\n}\n\n/**\n * Returns the more readable of the two candidate text colors for a given\n * background. Both candidates are evaluated with the WCAG contrast formula and\n * the winning (highest ratio) color is returned — not a fixed luminance\n * breakpoint — so mid-luminance backgrounds (amber, pastels, light violet…)\n * always fall on the correct side.\n */\nexport function getContrastText(bg: ColorInput, light = \"#ffffff\", dark = \"#0f172a\"): string {\n const lumBg = relativeLuminance(bg);\n const lumLight = relativeLuminance(light);\n const lumDark = relativeLuminance(dark);\n return contrastRatio(lumBg, lumLight) >= contrastRatio(lumBg, lumDark) ? light : dark;\n}"],"names":["readVariable","name","resolveVars","input","str","refs","ref","resolved","channels","color","_a","parts","r","g","b","relativeLuminance","c","lin","v","contrastRatio","lumA","lumB","hi","lo","getContrastText","bg","light","dark","lumBg","lumLight","lumDark"],"mappings":"AAkBA,SAASA,EAAaC,GAAsB;AAC1C,SAAI,OAAO,SAAW,MAAoB,KACnC,OACJ,iBAAiB,SAAS,eAAe,EACzC,iBAAiBA,CAAI,EACrB,KAAA;AACL;AAGA,SAASC,EAAYC,GAAuB;AAC1C,MAAIC,IAAMD;AACV,QAAME,IAAOD,EAAI,MAAM,gBAAgB,KAAK,CAAA;AAC5C,aAAWE,KAAOD,GAAM;AACtB,UAAMJ,IAAOK,EAAI,QAAQ,UAAU,EAAE,GAC/BC,IAAWP,EAAaC,CAAI;AAClC,IAAIM,MAAUH,IAAMA,EAAI,MAAME,CAAG,EAAE,KAAKC,CAAQ;AAAA,EAClD;AACA,SAAOH;AACT;AAQA,SAASI,EAASC,GAA+B;AA1BjD,MAAAC;AA2BE,MAAIN,IAAMK,EAAM,KAAA;AAEhB,MAAI,yBAAyB,KAAKL,CAAG;AACnC,WAAIA,EAAI,WAAW,MACjBA,IACE,MACAA,EACG,MAAM,CAAC,EACP,MAAM,EAAE,EACR,IAAI,CAAC,MAAM,IAAI,CAAC,EAChB,KAAK,EAAE,IAEP;AAAA,MACL,GAAG,SAASA,EAAI,MAAM,GAAG,CAAC,GAAG,EAAE;AAAA,MAC/B,GAAG,SAASA,EAAI,MAAM,GAAG,CAAC,GAAG,EAAE;AAAA,MAC/B,GAAG,SAASA,EAAI,MAAM,GAAG,CAAC,GAAG,EAAE;AAAA,IAAA;AAQnC,QAAMO,MAAQD,IAJGR,EAAYE,CAAG,EAGJ,QAAQ,YAAY,GAAG,EAC1B,MAAM,gBAAgB,MAAjC,gBAAAM,EAAoC,IAAI,YAAW,CAAA;AACjE,MAAIC,EAAM,SAAS,EAAG,QAAO;AAG7B,QAAM,CAACC,GAAGC,GAAGC,CAAC,IAAIH;AAClB,SAAO;AAAA,IACL,GAAG,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,KAAK,MAAMC,CAAC,CAAC,CAAC;AAAA,IAC3C,GAAG,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,KAAK,MAAMC,CAAC,CAAC,CAAC;AAAA,IAC3C,GAAG,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,KAAK,MAAMC,CAAC,CAAC,CAAC;AAAA,EAAA;AAE/C;AAEA,SAASC,EAAkBN,GAA2B;AACpD,QAAMO,IAAIR,EAASC,CAAK;AACxB,MAAI,CAACO,EAAG,QAAO;AACf,QAAMC,IAAM,CAACD,EAAE,GAAGA,EAAE,GAAGA,EAAE,CAAC,EACvB,IAAI,CAACE,MAAMA,IAAI,GAAG,EAClB,IAAI,CAACA,MAAOA,KAAK,UAAUA,IAAI,QAAQ,KAAK,KAAKA,IAAI,SAAS,OAAO,GAAG,CAAE;AAC7E,SAAO,SAASD,EAAI,CAAC,IAAI,SAASA,EAAI,CAAC,IAAI,SAASA,EAAI,CAAC;AAC3D;AAEA,SAASE,EAAcC,GAAcC,GAAsB;AACzD,QAAM,CAACC,GAAIC,CAAE,IAAIH,IAAOC,IAAO,CAACD,GAAMC,CAAI,IAAI,CAACA,GAAMD,CAAI;AACzD,UAAQE,IAAK,SAASC,IAAK;AAC7B;AASO,SAASC,EAAgBC,GAAgBC,IAAQ,WAAWC,IAAO,WAAmB;AAC3F,QAAMC,IAAQb,EAAkBU,CAAE,GAC5BI,IAAWd,EAAkBW,CAAK,GAClCI,IAAUf,EAAkBY,CAAI;AACtC,SAAOR,EAAcS,GAAOC,CAAQ,KAAKV,EAAcS,GAAOE,CAAO,IAAIJ,IAAQC;AACnF;"}
@@ -1,28 +0,0 @@
1
- "use client";
2
- import { useState as f, useEffect as i } from "react";
3
- import { getContrastText as u } from "./contrast.js";
4
- function s(t) {
5
- return typeof window > "u" ? "" : window.getComputedStyle(document.documentElement).getPropertyValue(t).trim();
6
- }
7
- function w(t, n = "#ffffff") {
8
- const [c, d] = f(() => {
9
- const e = s(t);
10
- return e ? u(e) : n;
11
- });
12
- return i(() => {
13
- const e = () => {
14
- const r = s(t);
15
- d(r ? u(r) : n);
16
- };
17
- e();
18
- const o = new MutationObserver(e);
19
- return o.observe(document.documentElement, {
20
- attributes: !0,
21
- attributeFilter: ["style", "class"]
22
- }), () => o.disconnect();
23
- }, [t, n]), c;
24
- }
25
- export {
26
- w as useTokenForeground
27
- };
28
- //# sourceMappingURL=useTokenForeground.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTokenForeground.js","sources":["../../../src/utils/useTokenForeground.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useState } from \"react\";\nimport { getContrastText } from \"./contrast\";\n\nfunction readChannel(variable: string): string {\n if (typeof window === \"undefined\") return \"\";\n return window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(variable)\n .trim();\n}\n\n/**\n * Reads a `--color-*` token from the live stylesheet and returns a text color\n * that is always readable against it. Recomputes whenever the palette changes\n * at runtime (e.g. the Storybook theme switcher or an app-level theme swap).\n */\nexport function useTokenForeground(variable: string, fallback = \"#ffffff\"): string {\n const [text, setText] = useState<string>(() => {\n const value = readChannel(variable);\n return value ? getContrastText(value) : fallback;\n });\n\n useEffect(() => {\n const update = () => {\n const value = readChannel(variable);\n setText(value ? getContrastText(value) : fallback);\n };\n update();\n const observer = new MutationObserver(update);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"style\", \"class\"],\n });\n return () => observer.disconnect();\n }, [variable, fallback]);\n\n return text;\n}"],"names":["readChannel","variable","useTokenForeground","fallback","text","setText","useState","value","getContrastText","useEffect","update","observer"],"mappings":";;AAIA,SAASA,EAAYC,GAA0B;AAC7C,SAAI,OAAO,SAAW,MAAoB,KACnC,OACJ,iBAAiB,SAAS,eAAe,EACzC,iBAAiBA,CAAQ,EACzB,KAAA;AACL;AAOO,SAASC,EAAmBD,GAAkBE,IAAW,WAAmB;AACjF,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAiB,MAAM;AAC7C,UAAMC,IAAQP,EAAYC,CAAQ;AAClC,WAAOM,IAAQC,EAAgBD,CAAK,IAAIJ;AAAA,EAC1C,CAAC;AAED,SAAAM,EAAU,MAAM;AACd,UAAMC,IAAS,MAAM;AACnB,YAAMH,IAAQP,EAAYC,CAAQ;AAClC,MAAAI,EAAQE,IAAQC,EAAgBD,CAAK,IAAIJ,CAAQ;AAAA,IACnD;AACA,IAAAO,EAAA;AACA,UAAMC,IAAW,IAAI,iBAAiBD,CAAM;AAC5C,WAAAC,EAAS,QAAQ,SAAS,iBAAiB;AAAA,MACzC,YAAY;AAAA,MACZ,iBAAiB,CAAC,SAAS,OAAO;AAAA,IAAA,CACnC,GACM,MAAMA,EAAS,WAAA;AAAA,EACxB,GAAG,CAACV,GAAUE,CAAQ,CAAC,GAEhBC;AACT;"}