@pollinations/ui 0.1.0-alpha.14 → 0.1.0-alpha.15

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 (70) hide show
  1. package/README.md +5 -3
  2. package/dist/app-user-menu/sdk.js +50 -752
  3. package/dist/app-user-menu/sdk.js.map +1 -1
  4. package/dist/auth/index.js +91 -1131
  5. package/dist/auth/index.js.map +1 -1
  6. package/dist/auth/sdk.js +9 -211
  7. package/dist/auth/sdk.js.map +1 -1
  8. package/dist/chunk-3VM5R3OI.js +50 -0
  9. package/dist/chunk-3VM5R3OI.js.map +1 -0
  10. package/dist/chunk-7GDUPN6U.js +115 -0
  11. package/dist/chunk-7GDUPN6U.js.map +1 -0
  12. package/dist/{app-user-menu/sdk.cjs → chunk-7WXDUAJU.js} +96 -751
  13. package/dist/chunk-7WXDUAJU.js.map +1 -0
  14. package/dist/chunk-7XDOOFTL.js +105 -0
  15. package/dist/chunk-7XDOOFTL.js.map +1 -0
  16. package/dist/chunk-DD7MHUFD.js +93 -0
  17. package/dist/chunk-DD7MHUFD.js.map +1 -0
  18. package/dist/chunk-FLQFOTMR.js +107 -0
  19. package/dist/chunk-FLQFOTMR.js.map +1 -0
  20. package/dist/chunk-IS4CNKV3.js +252 -0
  21. package/dist/chunk-IS4CNKV3.js.map +1 -0
  22. package/dist/chunk-IX6BJNHM.js +58 -0
  23. package/dist/chunk-IX6BJNHM.js.map +1 -0
  24. package/dist/chunk-K2H3JFQK.js +576 -0
  25. package/dist/chunk-K2H3JFQK.js.map +1 -0
  26. package/dist/chunk-LKUZU37X.js +15 -0
  27. package/dist/chunk-LKUZU37X.js.map +1 -0
  28. package/dist/chunk-QAR2WP3L.js +364 -0
  29. package/dist/chunk-QAR2WP3L.js.map +1 -0
  30. package/dist/chunk-QFR7XRUE.js +534 -0
  31. package/dist/chunk-QFR7XRUE.js.map +1 -0
  32. package/dist/chunk-TVPFAM3B.js +88 -0
  33. package/dist/chunk-TVPFAM3B.js.map +1 -0
  34. package/dist/chunk-ZLD4VLUG.js +112 -0
  35. package/dist/chunk-ZLD4VLUG.js.map +1 -0
  36. package/dist/gen/index.js +49 -494
  37. package/dist/gen/index.js.map +1 -1
  38. package/dist/index.browser.min.js +1 -1
  39. package/dist/index.browser.min.js.map +1 -1
  40. package/dist/index.js +576 -2629
  41. package/dist/index.js.map +1 -1
  42. package/dist/markdown.js +45 -599
  43. package/dist/markdown.js.map +1 -1
  44. package/dist/wallet/index.js +17 -374
  45. package/dist/wallet/index.js.map +1 -1
  46. package/package.json +10 -16
  47. package/dist/Button-BGqClaBr.d.cts +0 -29
  48. package/dist/Chip-v-ADv6cz.d.cts +0 -18
  49. package/dist/Dialog-D3Nqt8cE.d.cts +0 -66
  50. package/dist/app-user-menu/sdk.cjs.map +0 -1
  51. package/dist/app-user-menu/sdk.d.cts +0 -29
  52. package/dist/auth/index.cjs +0 -1537
  53. package/dist/auth/index.cjs.map +0 -1
  54. package/dist/auth/index.d.cts +0 -114
  55. package/dist/auth/sdk.cjs +0 -250
  56. package/dist/auth/sdk.cjs.map +0 -1
  57. package/dist/auth/sdk.d.cts +0 -40
  58. package/dist/gen/index.cjs +0 -718
  59. package/dist/gen/index.cjs.map +0 -1
  60. package/dist/gen/index.d.cts +0 -91
  61. package/dist/index.cjs +0 -5365
  62. package/dist/index.cjs.map +0 -1
  63. package/dist/index.d.cts +0 -1051
  64. package/dist/markdown.cjs +0 -838
  65. package/dist/markdown.cjs.map +0 -1
  66. package/dist/markdown.d.cts +0 -16
  67. package/dist/types-CCy9JNu9.d.cts +0 -6
  68. package/dist/wallet/index.cjs +0 -433
  69. package/dist/wallet/index.cjs.map +0 -1
  70. package/dist/wallet/index.d.cts +0 -53
@@ -0,0 +1,88 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-LKUZU37X.js";
4
+
5
+ // src/primitives/Typography.tsx
6
+ import { jsx } from "react/jsx-runtime";
7
+ var headingSizeClasses = {
8
+ display: "polli:font-heading polli:text-5xl polli:leading-none",
9
+ title: "polli:font-heading polli:text-4xl polli:leading-none",
10
+ section: "polli:font-subheading polli:text-2xl polli:leading-tight",
11
+ subsection: "polli:font-subheading polli:text-xl polli:leading-tight",
12
+ card: "polli:font-subheading polli:text-lg polli:leading-tight"
13
+ };
14
+ var textSizeClasses = {
15
+ body: "polli:text-base polli:leading-relaxed",
16
+ sm: "polli:text-sm polli:leading-6",
17
+ xs: "polli:text-xs polli:leading-normal",
18
+ micro: "polli:text-micro polli:leading-normal"
19
+ };
20
+ var textToneClasses = {
21
+ base: "polli:text-theme-text-base",
22
+ strong: "polli:text-theme-text-strong",
23
+ soft: "polli:text-theme-text-soft",
24
+ muted: "polli:text-theme-text-muted"
25
+ };
26
+ var textWeightClasses = {
27
+ normal: "polli:font-normal",
28
+ medium: "polli:font-medium",
29
+ semibold: "polli:font-semibold",
30
+ bold: "polli:font-bold"
31
+ };
32
+ function headingClassName(size, className) {
33
+ return cn(
34
+ "polli:break-words polli:text-theme-text-strong",
35
+ headingSizeClasses[size],
36
+ className
37
+ );
38
+ }
39
+ function textClassName({
40
+ size,
41
+ tone,
42
+ weight,
43
+ className
44
+ }) {
45
+ return cn(
46
+ "polli:break-words polli:font-body",
47
+ textSizeClasses[size],
48
+ textToneClasses[tone],
49
+ textWeightClasses[weight],
50
+ className
51
+ );
52
+ }
53
+ function Heading({
54
+ as,
55
+ size = "section",
56
+ className,
57
+ children,
58
+ ...rest
59
+ }) {
60
+ const Component = as || "h2";
61
+ return /* @__PURE__ */ jsx(Component, { ...rest, className: headingClassName(size, className), children });
62
+ }
63
+ function Text({
64
+ as,
65
+ size = "body",
66
+ tone = "base",
67
+ weight = "normal",
68
+ className,
69
+ children,
70
+ ...rest
71
+ }) {
72
+ const Component = as || "p";
73
+ return /* @__PURE__ */ jsx(
74
+ Component,
75
+ {
76
+ ...rest,
77
+ className: textClassName({ size, tone, weight, className }),
78
+ children
79
+ }
80
+ );
81
+ }
82
+
83
+ export {
84
+ headingClassName,
85
+ Heading,
86
+ Text
87
+ };
88
+ //# sourceMappingURL=chunk-TVPFAM3B.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/primitives/Typography.tsx"],"sourcesContent":["import type {\n ComponentPropsWithoutRef,\n ElementType,\n PropsWithChildren,\n} from \"react\";\nimport { cn } from \"../lib/cn.ts\";\n\ntype HeadingSize = \"display\" | \"title\" | \"section\" | \"subsection\" | \"card\";\n\ntype TextSize = \"body\" | \"sm\" | \"xs\" | \"micro\";\ntype TextTone = \"base\" | \"strong\" | \"soft\" | \"muted\";\ntype TextWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\n\nconst headingSizeClasses: Record<HeadingSize, string> = {\n display: \"polli:font-heading polli:text-5xl polli:leading-none\",\n title: \"polli:font-heading polli:text-4xl polli:leading-none\",\n section: \"polli:font-subheading polli:text-2xl polli:leading-tight\",\n subsection: \"polli:font-subheading polli:text-xl polli:leading-tight\",\n card: \"polli:font-subheading polli:text-lg polli:leading-tight\",\n};\n\nconst textSizeClasses: Record<TextSize, string> = {\n body: \"polli:text-base polli:leading-relaxed\",\n sm: \"polli:text-sm polli:leading-6\",\n xs: \"polli:text-xs polli:leading-normal\",\n micro: \"polli:text-micro polli:leading-normal\",\n};\n\nconst textToneClasses: Record<TextTone, string> = {\n base: \"polli:text-theme-text-base\",\n strong: \"polli:text-theme-text-strong\",\n soft: \"polli:text-theme-text-soft\",\n muted: \"polli:text-theme-text-muted\",\n};\n\nconst textWeightClasses: Record<TextWeight, string> = {\n normal: \"polli:font-normal\",\n medium: \"polli:font-medium\",\n semibold: \"polli:font-semibold\",\n bold: \"polli:font-bold\",\n};\n\nexport function headingClassName(size: HeadingSize, className?: string) {\n return cn(\n \"polli:break-words polli:text-theme-text-strong\",\n headingSizeClasses[size],\n className,\n );\n}\n\nfunction textClassName({\n size,\n tone,\n weight,\n className,\n}: {\n size: TextSize;\n tone: TextTone;\n weight: TextWeight;\n className?: string;\n}) {\n return cn(\n \"polli:break-words polli:font-body\",\n textSizeClasses[size],\n textToneClasses[tone],\n textWeightClasses[weight],\n className,\n );\n}\n\ntype HeadingOwnProps<T extends ElementType> = PropsWithChildren<{\n as?: T;\n size?: HeadingSize;\n className?: string;\n}>;\n\nexport type HeadingProps<T extends ElementType = \"h2\"> = HeadingOwnProps<T> &\n Omit<ComponentPropsWithoutRef<T>, keyof HeadingOwnProps<T>>;\n\nexport function Heading<T extends ElementType = \"h2\">({\n as,\n size = \"section\",\n className,\n children,\n ...rest\n}: HeadingProps<T>) {\n const Component = as || \"h2\";\n return (\n <Component {...rest} className={headingClassName(size, className)}>\n {children}\n </Component>\n );\n}\n\ntype TextOwnProps<T extends ElementType> = PropsWithChildren<{\n as?: T;\n size?: TextSize;\n tone?: TextTone;\n weight?: TextWeight;\n className?: string;\n}>;\n\nexport type TextProps<T extends ElementType = \"p\"> = TextOwnProps<T> &\n Omit<ComponentPropsWithoutRef<T>, keyof TextOwnProps<T>>;\n\nexport function Text<T extends ElementType = \"p\">({\n as,\n size = \"body\",\n tone = \"base\",\n weight = \"normal\",\n className,\n children,\n ...rest\n}: TextProps<T>) {\n const Component = as || \"p\";\n return (\n <Component\n {...rest}\n className={textClassName({ size, tone, weight, className })}\n >\n {children}\n </Component>\n );\n}\n"],"mappings":";;;;;AAwFQ;AA3ER,IAAM,qBAAkD;AAAA,EACpD,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,MAAM;AACV;AAEA,IAAM,kBAA4C;AAAA,EAC9C,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACX;AAEA,IAAM,kBAA4C;AAAA,EAC9C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AACX;AAEA,IAAM,oBAAgD;AAAA,EAClD,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,MAAM;AACV;AAEO,SAAS,iBAAiB,MAAmB,WAAoB;AACpE,SAAO;AAAA,IACH;AAAA,IACA,mBAAmB,IAAI;AAAA,IACvB;AAAA,EACJ;AACJ;AAEA,SAAS,cAAc;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,GAKG;AACC,SAAO;AAAA,IACH;AAAA,IACA,gBAAgB,IAAI;AAAA,IACpB,gBAAgB,IAAI;AAAA,IACpB,kBAAkB,MAAM;AAAA,IACxB;AAAA,EACJ;AACJ;AAWO,SAAS,QAAsC;AAAA,EAClD;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,GAAG;AACP,GAAoB;AAChB,QAAM,YAAY,MAAM;AACxB,SACI,oBAAC,aAAW,GAAG,MAAM,WAAW,iBAAiB,MAAM,SAAS,GAC3D,UACL;AAER;AAaO,SAAS,KAAkC;AAAA,EAC9C;AAAA,EACA,OAAO;AAAA,EACP,OAAO;AAAA,EACP,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,GAAG;AACP,GAAiB;AACb,QAAM,YAAY,MAAM;AACxB,SACI;AAAA,IAAC;AAAA;AAAA,MACI,GAAG;AAAA,MACJ,WAAW,cAAc,EAAE,MAAM,MAAM,QAAQ,UAAU,CAAC;AAAA,MAEzD;AAAA;AAAA,EACL;AAER;","names":[]}
@@ -0,0 +1,112 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-LKUZU37X.js";
4
+
5
+ // src/primitives/TabButton.tsx
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ var tabButtonBaseClass = "polli-control polli:inline-flex polli:items-center polli:justify-center polli:rounded-full polli:font-medium polli:leading-normal polli:transition-colors polli:duration-200";
8
+ var tabButtonSizeClass = {
9
+ xs: "polli:px-2.5 polli:py-1 polli:text-xs",
10
+ lg: "polli:px-5 polli:py-2 polli:text-lg",
11
+ md: "polli:px-4 polli:py-1.5 polli:text-base",
12
+ sm: "polli:px-3 polli:py-1.5 polli:text-sm"
13
+ };
14
+ var variantClasses = {
15
+ // The default tab look: borderless and monochrome. Selected uses `bg-active`
16
+ // — the same light resting fill as the site's normal buttons. Both states
17
+ // deepen to `bg-hover` and use the theme's hover label color. Non-selected
18
+ // uses the quiet `bg-subtle` token until then.
19
+ soft: {
20
+ base: "",
21
+ active: "polli:bg-theme-bg-active polli:text-theme-text-strong polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover",
22
+ mixed: "polli:bg-theme-bg-active/45 polli:text-theme-text-strong polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover",
23
+ inactive: "polli:bg-theme-bg-subtle polli:text-theme-text-base polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover"
24
+ },
25
+ // Transparent until hovered or selected — for multi-select toggles and
26
+ // inline rows where a filled idle pill would read as a hard selection.
27
+ ghost: {
28
+ base: "polli:border polli:border-transparent",
29
+ active: "polli:bg-theme-bg-active polli:text-theme-text-strong polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover",
30
+ mixed: "polli:bg-theme-bg-active/45 polli:text-theme-text-strong polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover",
31
+ inactive: "polli:bg-transparent polli:text-theme-text-base polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover"
32
+ }
33
+ };
34
+ var intentClasses = {
35
+ amber: {
36
+ active: "polli:bg-paid-pale polli:text-paid-deep",
37
+ inactive: "polli:bg-transparent polli:text-theme-text-base polli:hover:bg-paid-pale/60"
38
+ },
39
+ green: {
40
+ active: "polli:bg-tier-pale polli:text-tier-deep",
41
+ inactive: "polli:bg-transparent polli:text-tier-deep polli:hover:bg-tier-pale/60"
42
+ },
43
+ // Site navigation: the current page is the one full brand pill; hover
44
+ // only previews it, so "where you are" never doubles up.
45
+ brand: {
46
+ active: "polli:bg-brand-accent polli:font-bold polli:text-brand-dark",
47
+ inactive: "polli:bg-transparent polli:font-bold polli:text-theme-text-strong polli:hover:bg-brand-accent/60 polli:hover:text-brand-dark"
48
+ }
49
+ };
50
+ function TabButton({
51
+ as,
52
+ active,
53
+ onClick,
54
+ children,
55
+ icon,
56
+ size = "md",
57
+ variant = "soft",
58
+ intent,
59
+ detail,
60
+ ariaLabel,
61
+ disabled = false,
62
+ className,
63
+ ...rest
64
+ }) {
65
+ const Component = as || "button";
66
+ const isButton = Component === "button";
67
+ const colors = intent === "neutral" ? variantClasses.soft : intent ? {
68
+ ...intentClasses[intent],
69
+ mixed: intentClasses[intent].active
70
+ } : variantClasses[variant];
71
+ const handleClick = disabled ? (event) => {
72
+ event.preventDefault();
73
+ event.stopPropagation();
74
+ } : onClick;
75
+ return /* @__PURE__ */ jsxs(
76
+ Component,
77
+ {
78
+ ...rest,
79
+ ...isButton ? { type: "button", disabled } : {},
80
+ ...!isButton && disabled ? { "aria-disabled": true, tabIndex: -1 } : {},
81
+ ...Component === "a" && disabled ? { href: void 0 } : {},
82
+ onClick: handleClick,
83
+ ...ariaLabel !== void 0 ? { "aria-label": ariaLabel } : {},
84
+ ...isButton ? { "aria-pressed": active } : { "aria-current": active === true ? "page" : void 0 },
85
+ className: cn(
86
+ tabButtonBaseClass,
87
+ variantClasses[variant].base,
88
+ active === "mixed" ? colors.mixed : active ? colors.active : colors.inactive,
89
+ disabled && "polli:pointer-events-none polli:cursor-not-allowed polli:opacity-50",
90
+ tabButtonSizeClass[size],
91
+ className
92
+ ),
93
+ children: [
94
+ icon && /* @__PURE__ */ jsx(
95
+ "span",
96
+ {
97
+ "aria-hidden": "true",
98
+ className: "polli:mr-1.5 polli:flex polli:size-4 polli:shrink-0 polli:[&>svg]:size-full",
99
+ children: icon
100
+ }
101
+ ),
102
+ children,
103
+ detail != null && /* @__PURE__ */ jsx("span", { className: "polli:ml-1 polli:font-normal polli:opacity-70", children: detail })
104
+ ]
105
+ }
106
+ );
107
+ }
108
+
109
+ export {
110
+ TabButton
111
+ };
112
+ //# sourceMappingURL=chunk-ZLD4VLUG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/primitives/TabButton.tsx"],"sourcesContent":["import type {\n ComponentPropsWithoutRef,\n ElementType,\n MouseEvent as ReactMouseEvent,\n ReactNode,\n} from \"react\";\nimport { cn } from \"../lib/cn.ts\";\n\ntype TabButtonOwnProps = {\n /** `mixed`: a group toggle where only some of its items are selected. */\n active: boolean | \"mixed\";\n /** Omit when rendering as a link (`as`) and navigation carries the change. */\n onClick?: () => void;\n children: ReactNode;\n /** Leading icon, sized to the label like Button's. */\n icon?: ReactNode;\n size?: \"lg\" | \"md\" | \"sm\" | \"xs\";\n variant?: \"soft\" | \"ghost\";\n /**\n * `amber` and `green` fill the selected pill with the wallet's pale paid\n * and Quest Pollen chip colours, which read at the same strength together.\n * `brand` is site navigation: bold labels, the brand accent for the\n * current page and a lighter preview of it on hover.\n */\n intent?: \"neutral\" | \"amber\" | \"green\" | \"brand\";\n /** Muted secondary text after the label, e.g. a model's creator. */\n detail?: ReactNode;\n ariaLabel?: string;\n disabled?: boolean;\n className?: string;\n};\n\n/**\n * Polymorphic like Button, so a tab that navigates can render a real anchor\n * instead of a click handler — middle-click, right-click and crawlers all\n * depend on that. Defaults to <button>, so existing call sites are unchanged.\n */\nexport type TabButtonProps<T extends ElementType = \"button\"> =\n TabButtonOwnProps & { as?: T } & Omit<\n ComponentPropsWithoutRef<T>,\n keyof TabButtonOwnProps | \"as\"\n >;\n\n/**\n * Shared pill shape (no colors) — used by every TabButton variant.\n *\n * `transition-colors`, not `transition-all`: only background and text colour\n * change between the variants, and `all` additionally animates any layout\n * property that happens to differ — which is the usual cause of a control\n * jittering under the pointer on hover.\n */\nconst tabButtonBaseClass =\n \"polli-control polli:inline-flex polli:items-center polli:justify-center polli:rounded-full polli:font-medium polli:leading-normal polli:transition-colors polli:duration-200\";\n\nconst tabButtonSizeClass = {\n xs: \"polli:px-2.5 polli:py-1 polli:text-xs\",\n lg: \"polli:px-5 polli:py-2 polli:text-lg\",\n md: \"polli:px-4 polli:py-1.5 polli:text-base\",\n sm: \"polli:px-3 polli:py-1.5 polli:text-sm\",\n} as const;\n\nconst variantClasses = {\n // The default tab look: borderless and monochrome. Selected uses `bg-active`\n // — the same light resting fill as the site's normal buttons. Both states\n // deepen to `bg-hover` and use the theme's hover label color. Non-selected\n // uses the quiet `bg-subtle` token until then.\n soft: {\n base: \"\",\n active: \"polli:bg-theme-bg-active polli:text-theme-text-strong polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover\",\n mixed: \"polli:bg-theme-bg-active/45 polli:text-theme-text-strong polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover\",\n inactive:\n \"polli:bg-theme-bg-subtle polli:text-theme-text-base polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover\",\n },\n // Transparent until hovered or selected — for multi-select toggles and\n // inline rows where a filled idle pill would read as a hard selection.\n ghost: {\n base: \"polli:border polli:border-transparent\",\n active: \"polli:bg-theme-bg-active polli:text-theme-text-strong polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover\",\n mixed: \"polli:bg-theme-bg-active/45 polli:text-theme-text-strong polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover\",\n inactive:\n \"polli:bg-transparent polli:text-theme-text-base polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover\",\n },\n} as const;\n\n// Wallet chip pairs: selected fills with the pale tint and deep label; hover\n// previews that fill. Unselected green keeps its green label so it stays\n// recognisable next to amber; unselected amber keeps the neutral label.\nconst intentClasses = {\n amber: {\n active: \"polli:bg-paid-pale polli:text-paid-deep\",\n inactive:\n \"polli:bg-transparent polli:text-theme-text-base polli:hover:bg-paid-pale/60\",\n },\n green: {\n active: \"polli:bg-tier-pale polli:text-tier-deep\",\n inactive:\n \"polli:bg-transparent polli:text-tier-deep polli:hover:bg-tier-pale/60\",\n },\n // Site navigation: the current page is the one full brand pill; hover\n // only previews it, so \"where you are\" never doubles up.\n brand: {\n active: \"polli:bg-brand-accent polli:font-bold polli:text-brand-dark\",\n inactive:\n \"polli:bg-transparent polli:font-bold polli:text-theme-text-strong polli:hover:bg-brand-accent/60 polli:hover:text-brand-dark\",\n },\n} as const;\n\nexport function TabButton<T extends ElementType = \"button\">({\n as,\n active,\n onClick,\n children,\n icon,\n size = \"md\",\n variant = \"soft\",\n intent,\n detail,\n ariaLabel,\n disabled = false,\n className,\n ...rest\n}: TabButtonProps<T>) {\n const Component: ElementType = as || \"button\";\n const isButton = Component === \"button\";\n const colors =\n intent === \"neutral\"\n ? variantClasses.soft\n : intent\n ? {\n ...intentClasses[intent],\n mixed: intentClasses[intent].active,\n }\n : variantClasses[variant];\n const handleClick = disabled\n ? (event: ReactMouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n }\n : onClick;\n\n return (\n <Component\n {...rest}\n {...(isButton ? { type: \"button\", disabled } : {})}\n {...(!isButton && disabled\n ? { \"aria-disabled\": true, tabIndex: -1 }\n : {})}\n {...(Component === \"a\" && disabled ? { href: undefined } : {})}\n onClick={handleClick}\n {...(ariaLabel !== undefined ? { \"aria-label\": ariaLabel } : {})}\n // aria-pressed is for toggles; a link that navigates announces its\n // selected state with aria-current instead.\n {...(isButton\n ? { \"aria-pressed\": active }\n : { \"aria-current\": active === true ? \"page\" : undefined })}\n className={cn(\n tabButtonBaseClass,\n variantClasses[variant].base,\n active === \"mixed\"\n ? colors.mixed\n : active\n ? colors.active\n : colors.inactive,\n disabled &&\n \"polli:pointer-events-none polli:cursor-not-allowed polli:opacity-50\",\n tabButtonSizeClass[size],\n className,\n )}\n >\n {icon && (\n <span\n aria-hidden=\"true\"\n className=\"polli:mr-1.5 polli:flex polli:size-4 polli:shrink-0 polli:[&>svg]:size-full\"\n >\n {icon}\n </span>\n )}\n {children}\n {detail != null && (\n <span className=\"polli:ml-1 polli:font-normal polli:opacity-70\">\n {detail}\n </span>\n )}\n </Component>\n );\n}\n"],"mappings":";;;;;AA6IQ,SA6BQ,KA7BR;AA1FR,IAAM,qBACF;AAEJ,IAAM,qBAAqB;AAAA,EACvB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,I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