@pollinations/ui 0.1.0-alpha.0 → 0.1.0-alpha.10

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 (117) hide show
  1. package/README.md +162 -87
  2. package/dist/Button-BGqClaBr.d.cts +29 -0
  3. package/dist/Button-BGqClaBr.d.ts +29 -0
  4. package/dist/Chip-v-ADv6cz.d.cts +18 -0
  5. package/dist/Chip-v-ADv6cz.d.ts +18 -0
  6. package/dist/Dialog-D3Nqt8cE.d.cts +66 -0
  7. package/dist/Dialog-D3Nqt8cE.d.ts +66 -0
  8. package/dist/app-user-menu/sdk.cjs +938 -0
  9. package/dist/app-user-menu/sdk.cjs.map +1 -0
  10. package/dist/app-user-menu/sdk.d.cts +29 -0
  11. package/dist/app-user-menu/sdk.d.ts +29 -0
  12. package/dist/app-user-menu/sdk.js +917 -0
  13. package/dist/app-user-menu/sdk.js.map +1 -0
  14. package/dist/app.css +20 -32
  15. package/dist/auth/index.cjs +1372 -86
  16. package/dist/auth/index.cjs.map +1 -1
  17. package/dist/auth/index.d.cts +91 -6
  18. package/dist/auth/index.d.ts +91 -6
  19. package/dist/auth/index.js +1369 -85
  20. package/dist/auth/index.js.map +1 -1
  21. package/dist/auth/sdk.cjs +93 -64
  22. package/dist/auth/sdk.cjs.map +1 -1
  23. package/dist/auth/sdk.d.cts +2 -15
  24. package/dist/auth/sdk.d.ts +2 -15
  25. package/dist/auth/sdk.js +92 -61
  26. package/dist/auth/sdk.js.map +1 -1
  27. package/dist/brand/badge-made-with.svg +1 -0
  28. package/dist/brand/lockup-horizontal-black.png +0 -0
  29. package/dist/brand/lockup-horizontal-black.svg +4 -0
  30. package/dist/brand/lockup-horizontal-white.png +0 -0
  31. package/dist/brand/lockup-horizontal-white.svg +4 -0
  32. package/dist/brand/lockup-horizontal.svg +4 -0
  33. package/dist/brand/lockup-stacked-black.png +0 -0
  34. package/dist/brand/lockup-stacked-black.svg +4 -0
  35. package/dist/brand/lockup-stacked-white.png +0 -0
  36. package/dist/brand/lockup-stacked-white.svg +4 -0
  37. package/dist/brand/lockup-stacked.svg +4 -0
  38. package/dist/brand/mark-black.png +0 -0
  39. package/dist/brand/mark-black.svg +1 -0
  40. package/dist/brand/mark-white.png +0 -0
  41. package/dist/brand/mark-white.svg +1 -0
  42. package/dist/brand/mark.svg +1 -0
  43. package/dist/brand/polli/polli-lockup-horizontal-black.png +0 -0
  44. package/dist/brand/polli/polli-lockup-horizontal-white.png +0 -0
  45. package/dist/brand/polli/polli-lockup-stacked-black.png +0 -0
  46. package/dist/brand/polli/polli-lockup-stacked-white.png +0 -0
  47. package/dist/brand/polli/polli.png +0 -0
  48. package/dist/brand/wordmark-black.png +0 -0
  49. package/dist/brand/wordmark-black.svg +1 -0
  50. package/dist/brand/wordmark-white.png +0 -0
  51. package/dist/brand/wordmark-white.svg +1 -0
  52. package/dist/brand/wordmark.svg +1 -0
  53. package/dist/fonts/geist-pixel-square.woff2 +0 -0
  54. package/dist/gen/index.cjs +718 -0
  55. package/dist/gen/index.cjs.map +1 -0
  56. package/dist/gen/index.d.cts +91 -0
  57. package/dist/gen/index.d.ts +91 -0
  58. package/dist/gen/index.js +688 -0
  59. package/dist/gen/index.js.map +1 -0
  60. package/dist/index.browser.min.js +2 -0
  61. package/dist/index.browser.min.js.map +1 -0
  62. package/dist/index.cjs +4250 -1517
  63. package/dist/index.cjs.map +1 -1
  64. package/dist/index.d.cts +794 -221
  65. package/dist/index.d.ts +794 -221
  66. package/dist/index.js +4154 -1493
  67. package/dist/index.js.map +1 -1
  68. package/dist/licenses/Geist-OFL.txt +93 -0
  69. package/dist/markdown.cjs +836 -0
  70. package/dist/markdown.cjs.map +1 -0
  71. package/dist/markdown.d.cts +16 -0
  72. package/dist/markdown.d.ts +16 -0
  73. package/dist/markdown.js +807 -0
  74. package/dist/markdown.js.map +1 -0
  75. package/dist/styles.css +1 -1
  76. package/dist/theme.css +94 -0
  77. package/dist/types-CCy9JNu9.d.cts +6 -0
  78. package/dist/types-CCy9JNu9.d.ts +6 -0
  79. package/dist/wallet/index.cjs +298 -68
  80. package/dist/wallet/index.cjs.map +1 -1
  81. package/dist/wallet/index.d.cts +30 -7
  82. package/dist/wallet/index.d.ts +30 -7
  83. package/dist/wallet/index.js +297 -68
  84. package/dist/wallet/index.js.map +1 -1
  85. package/package.json +104 -102
  86. package/dist/Button-BvLF_Km2.d.cts +0 -26
  87. package/dist/Button-DQAZzvyQ.d.ts +0 -26
  88. package/dist/Chip-C5impfYd.d.ts +0 -20
  89. package/dist/Chip-SM52sUbZ.d.cts +0 -20
  90. package/dist/assets/logo-wordmark.svg +0 -1
  91. package/dist/assets/logo.svg +0 -4
  92. package/dist/compositions/app-user.cjs +0 -497
  93. package/dist/compositions/app-user.cjs.map +0 -1
  94. package/dist/compositions/app-user.d.cts +0 -18
  95. package/dist/compositions/app-user.d.ts +0 -18
  96. package/dist/compositions/app-user.js +0 -469
  97. package/dist/compositions/app-user.js.map +0 -1
  98. package/dist/modality/index.cjs +0 -86
  99. package/dist/modality/index.cjs.map +0 -1
  100. package/dist/modality/index.d.cts +0 -26
  101. package/dist/modality/index.d.ts +0 -26
  102. package/dist/modality/index.js +0 -59
  103. package/dist/modality/index.js.map +0 -1
  104. package/dist/models/index.cjs +0 -508
  105. package/dist/models/index.cjs.map +0 -1
  106. package/dist/models/index.d.cts +0 -22
  107. package/dist/models/index.d.ts +0 -22
  108. package/dist/models/index.js +0 -486
  109. package/dist/models/index.js.map +0 -1
  110. package/dist/theme-VMRlhqST.d.cts +0 -9
  111. package/dist/theme-VMRlhqST.d.ts +0 -9
  112. package/dist/wallet/sdk.cjs +0 -206
  113. package/dist/wallet/sdk.cjs.map +0 -1
  114. package/dist/wallet/sdk.d.cts +0 -33
  115. package/dist/wallet/sdk.d.ts +0 -33
  116. package/dist/wallet/sdk.js +0 -175
  117. package/dist/wallet/sdk.js.map +0 -1
@@ -1,30 +1,53 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
1
2
  import { FC, ReactNode } from 'react';
2
- import { a as ChipProps } from '../Chip-SM52sUbZ.cjs';
3
- import '../theme-VMRlhqST.cjs';
3
+ import { a as ChipProps } from '../Chip-v-ADv6cz.cjs';
4
+
5
+ type AccountPollenSource = {
6
+ type: "wallet";
7
+ /** Undefined while the balance is unavailable. */
8
+ balances?: {
9
+ paid: number;
10
+ quest: number;
11
+ };
12
+ } | {
13
+ type: "budget";
14
+ /** The app's remaining budget, never the owner's wallet total. `null` = unlimited. */
15
+ remaining?: number | null;
16
+ generationEnabled?: boolean;
17
+ };
18
+ /** Icon + amount; unlimited, exhausted, or empty states become a badge. */
19
+ declare function AccountPollen({ source, topUpHref, }: {
20
+ source: AccountPollenSource;
21
+ /** Shown in the empty-wallet badge. A menu keeps recovery links in its dropdown. */
22
+ topUpHref?: string;
23
+ }): react_jsx_runtime.JSX.Element | null;
4
24
 
5
25
  type WalletChipProps = Omit<ChipProps, "intent">;
6
26
  declare const PaidChip: FC<WalletChipProps>;
7
27
  declare const TierChip: FC<WalletChipProps>;
8
28
 
9
- declare const PAID_BALANCE_CHART_COLOR = "var(--polli-color-paid-pale)";
10
- declare const TIER_BALANCE_CHART_COLOR = "var(--polli-color-tier-pale)";
29
+ declare const PAID_BALANCE_CHART_COLOR = "var(--polli-color-paid-soft)";
30
+ declare const TIER_BALANCE_CHART_COLOR = "var(--polli-color-tier-soft)";
11
31
 
12
32
  declare function formatPollen(value: number): string;
13
33
 
14
34
  type WalletBalanceKind = "paid" | "tier";
15
- type WalletDotProps = {
35
+ type WalletKindIconProps = {
16
36
  kind: WalletBalanceKind;
17
37
  className?: string;
18
38
  };
19
- declare const WalletDot: FC<WalletDotProps>;
39
+ /** The paid/Quest marker: a card for paid balance or sprout for Quest Pollen. */
40
+ declare const WalletKindIcon: FC<WalletKindIconProps>;
20
41
  type WalletBalanceCardProps = {
42
+ tone?: "balance" | "neutral";
21
43
  kind: WalletBalanceKind;
22
44
  label: ReactNode;
23
45
  value: ReactNode;
46
+ icon?: ReactNode;
24
47
  info?: ReactNode;
25
48
  footer?: ReactNode;
26
49
  className?: string;
27
50
  };
28
51
  declare const WalletBalanceCard: FC<WalletBalanceCardProps>;
29
52
 
30
- export { PAID_BALANCE_CHART_COLOR, PaidChip, TIER_BALANCE_CHART_COLOR, TierChip, WalletBalanceCard, type WalletBalanceCardProps, type WalletChipProps, WalletDot, type WalletDotProps, formatPollen };
53
+ export { AccountPollen, PAID_BALANCE_CHART_COLOR, PaidChip, TIER_BALANCE_CHART_COLOR, TierChip, WalletBalanceCard, type WalletBalanceCardProps, type WalletChipProps, WalletKindIcon, type WalletKindIconProps, formatPollen };
@@ -1,30 +1,53 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
1
2
  import { FC, ReactNode } from 'react';
2
- import { a as ChipProps } from '../Chip-C5impfYd.js';
3
- import '../theme-VMRlhqST.js';
3
+ import { a as ChipProps } from '../Chip-v-ADv6cz.js';
4
+
5
+ type AccountPollenSource = {
6
+ type: "wallet";
7
+ /** Undefined while the balance is unavailable. */
8
+ balances?: {
9
+ paid: number;
10
+ quest: number;
11
+ };
12
+ } | {
13
+ type: "budget";
14
+ /** The app's remaining budget, never the owner's wallet total. `null` = unlimited. */
15
+ remaining?: number | null;
16
+ generationEnabled?: boolean;
17
+ };
18
+ /** Icon + amount; unlimited, exhausted, or empty states become a badge. */
19
+ declare function AccountPollen({ source, topUpHref, }: {
20
+ source: AccountPollenSource;
21
+ /** Shown in the empty-wallet badge. A menu keeps recovery links in its dropdown. */
22
+ topUpHref?: string;
23
+ }): react_jsx_runtime.JSX.Element | null;
4
24
 
5
25
  type WalletChipProps = Omit<ChipProps, "intent">;
6
26
  declare const PaidChip: FC<WalletChipProps>;
7
27
  declare const TierChip: FC<WalletChipProps>;
8
28
 
9
- declare const PAID_BALANCE_CHART_COLOR = "var(--polli-color-paid-pale)";
10
- declare const TIER_BALANCE_CHART_COLOR = "var(--polli-color-tier-pale)";
29
+ declare const PAID_BALANCE_CHART_COLOR = "var(--polli-color-paid-soft)";
30
+ declare const TIER_BALANCE_CHART_COLOR = "var(--polli-color-tier-soft)";
11
31
 
12
32
  declare function formatPollen(value: number): string;
13
33
 
14
34
  type WalletBalanceKind = "paid" | "tier";
15
- type WalletDotProps = {
35
+ type WalletKindIconProps = {
16
36
  kind: WalletBalanceKind;
17
37
  className?: string;
18
38
  };
19
- declare const WalletDot: FC<WalletDotProps>;
39
+ /** The paid/Quest marker: a card for paid balance or sprout for Quest Pollen. */
40
+ declare const WalletKindIcon: FC<WalletKindIconProps>;
20
41
  type WalletBalanceCardProps = {
42
+ tone?: "balance" | "neutral";
21
43
  kind: WalletBalanceKind;
22
44
  label: ReactNode;
23
45
  value: ReactNode;
46
+ icon?: ReactNode;
24
47
  info?: ReactNode;
25
48
  footer?: ReactNode;
26
49
  className?: string;
27
50
  };
28
51
  declare const WalletBalanceCard: FC<WalletBalanceCardProps>;
29
52
 
30
- export { PAID_BALANCE_CHART_COLOR, PaidChip, TIER_BALANCE_CHART_COLOR, TierChip, WalletBalanceCard, type WalletBalanceCardProps, type WalletChipProps, WalletDot, type WalletDotProps, formatPollen };
53
+ export { AccountPollen, PAID_BALANCE_CHART_COLOR, PaidChip, TIER_BALANCE_CHART_COLOR, TierChip, WalletBalanceCard, type WalletBalanceCardProps, type WalletChipProps, WalletKindIcon, type WalletKindIconProps, formatPollen };
@@ -1,7 +1,10 @@
1
1
  // src/lib/cn.ts
2
2
  import { clsx } from "clsx";
3
3
  import { extendTailwindMerge } from "tailwind-merge";
4
- var twMerge = extendTailwindMerge({ prefix: "polli" });
4
+ var twMerge = extendTailwindMerge({
5
+ prefix: "polli",
6
+ extend: { theme: { text: ["micro"] } }
7
+ });
5
8
  function cn(...inputs) {
6
9
  return twMerge(clsx(...inputs));
7
10
  }
@@ -9,20 +12,23 @@ function cn(...inputs) {
9
12
  // src/primitives/Chip.tsx
10
13
  import { jsx } from "react/jsx-runtime";
11
14
  var chipSizes = {
12
- sm: "polli:px-2 polli:py-0.5 polli:text-xs",
13
- md: "polli:px-2.5 polli:py-0.5 polli:text-sm",
14
- lg: "polli:px-3 polli:py-1 polli:text-sm"
15
+ icon: "polli:h-5 polli:w-5 polli:p-0 polli:text-xs",
16
+ sm: "polli:h-5 polli:px-2 polli:text-xs",
17
+ md: "polli:h-6 polli:px-2.5 polli:text-sm",
18
+ lg: "polli:h-7 polli:px-3 polli:text-sm"
15
19
  };
16
20
  var intentClasses = {
17
21
  news: "polli:bg-intent-news-bg-light polli:text-intent-news-text",
22
+ new: "polli:bg-intent-new-bg-light polli:text-intent-new-text",
23
+ free: "polli:bg-intent-free-bg-light polli:text-intent-free-text",
18
24
  alpha: "polli:bg-intent-alpha-bg-light polli:text-intent-alpha-text",
19
- neutral: "polli:border polli:border-gray-400/70 polli:bg-gray-100/80 polli:text-gray-900",
20
- success: "polli:border polli:border-intent-success-border polli:bg-intent-success-bg-light polli:text-intent-success-text",
21
- warning: "polli:border polli:border-intent-warning-border polli:bg-intent-warning-bg-light polli:text-intent-warning-text",
22
- danger: "polli:border polli:border-intent-danger-border polli:bg-intent-danger-bg-light polli:text-intent-danger-text"
25
+ neutral: "polli:bg-ink-100/80 polli:text-ink-900",
26
+ success: "polli:bg-intent-success-bg-bright/15 polli:text-intent-success-text",
27
+ warning: "polli:bg-intent-warning-bg-light polli:text-intent-warning-text",
28
+ info: "polli:bg-intent-info-bg-light polli:text-intent-info-text",
29
+ danger: "polli:bg-intent-danger-bg-light polli:text-intent-danger-text"
23
30
  };
24
31
  var Chip = ({
25
- theme,
26
32
  intent,
27
33
  size = "md",
28
34
  className,
@@ -34,9 +40,8 @@ var Chip = ({
34
40
  "span",
35
41
  {
36
42
  ...rest,
37
- "data-theme": theme,
38
43
  className: cn(
39
- "polli:inline-flex polli:shrink-0 polli:items-center polli:gap-1 polli:rounded-lg polli:font-medium polli:leading-normal",
44
+ "polli:inline-flex polli:shrink-0 polli:items-center polli:justify-center polli:gap-1 polli:rounded-lg polli:font-medium polli:leading-none",
40
45
  chipSizes[size],
41
46
  intentClass,
42
47
  className
@@ -46,22 +51,95 @@ var Chip = ({
46
51
  );
47
52
  };
48
53
 
49
- // src/modules/wallet/chips.tsx
50
- import { jsx as jsx2 } from "react/jsx-runtime";
51
- var PaidChip = ({
52
- className,
53
- children,
54
- ...props
55
- }) => /* @__PURE__ */ jsx2(Chip, { ...props, className: cn("polli-wallet-chip-paid", className), children });
56
- var TierChip = ({
54
+ // src/lib/link.ts
55
+ function isExternalHref(href, origin = globalThis.location?.origin) {
56
+ if (typeof href !== "string" || !/^(https?:)?\/\//i.test(href))
57
+ return false;
58
+ if (!origin) return true;
59
+ try {
60
+ return new URL(href, origin).origin !== origin;
61
+ } catch {
62
+ return false;
63
+ }
64
+ }
65
+
66
+ // src/primitives/icons/index.tsx
67
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
68
+ var strokeProps = {
69
+ fill: "none",
70
+ stroke: "currentColor",
71
+ strokeWidth: 2,
72
+ strokeLinecap: "round",
73
+ strokeLinejoin: "round"
74
+ };
75
+ function ExternalLinkIcon(props) {
76
+ return /* @__PURE__ */ jsx2("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", ...strokeProps, ...props, children: /* @__PURE__ */ jsx2("path", { d: "M7 17 17 7M9 7h8v8" }) });
77
+ }
78
+ function WalletIcon(props) {
79
+ return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", ...strokeProps, ...props, children: [
80
+ /* @__PURE__ */ jsx2("path", { d: "M3 7a2 2 0 0 1 2-2h13a2 2 0 0 1 2 2v2H5a2 2 0 0 0-2 2V7Z" }),
81
+ /* @__PURE__ */ jsx2("path", { d: "M3 11a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6Z" }),
82
+ /* @__PURE__ */ jsx2("circle", { cx: "17", cy: "14", r: "1.25", fill: "currentColor" })
83
+ ] });
84
+ }
85
+ function CardIcon(props) {
86
+ return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", ...strokeProps, ...props, children: [
87
+ /* @__PURE__ */ jsx2("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
88
+ /* @__PURE__ */ jsx2("path", { d: "M2 10h20" })
89
+ ] });
90
+ }
91
+ function SproutIcon(props) {
92
+ return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", ...strokeProps, ...props, children: [
93
+ /* @__PURE__ */ jsx2("path", { d: "M7 20h10" }),
94
+ /* @__PURE__ */ jsx2("path", { d: "M10 20c5.5-2.5.8-6.4 3-10" }),
95
+ /* @__PURE__ */ jsx2("path", { d: "M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z" }),
96
+ /* @__PURE__ */ jsx2("path", { d: "M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z" })
97
+ ] });
98
+ }
99
+ function KeyIcon(props) {
100
+ return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", ...strokeProps, ...props, children: [
101
+ /* @__PURE__ */ jsx2("circle", { cx: "7.5", cy: "15.5", r: "5.5" }),
102
+ /* @__PURE__ */ jsx2("path", { d: "m21 2-9.6 9.6" }),
103
+ /* @__PURE__ */ jsx2("path", { d: "m15.5 7.5 3 3L22 7l-3-3" })
104
+ ] });
105
+ }
106
+
107
+ // src/primitives/InlineLink.tsx
108
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
109
+ function InlineLink({
110
+ as,
111
+ external,
112
+ showIcon = true,
113
+ size = "inherit",
114
+ tone = "accent",
57
115
  className,
58
116
  children,
59
- ...props
60
- }) => /* @__PURE__ */ jsx2(Chip, { ...props, className: cn("polli-wallet-chip-tier", className), children });
61
-
62
- // src/modules/wallet/colors.ts
63
- var PAID_BALANCE_CHART_COLOR = "var(--polli-color-paid-pale)";
64
- var TIER_BALANCE_CHART_COLOR = "var(--polli-color-tier-pale)";
117
+ ...linkProps
118
+ }) {
119
+ const Component = as || "a";
120
+ const isExternal = external ?? isExternalHref(linkProps.href);
121
+ return /* @__PURE__ */ jsxs2(
122
+ Component,
123
+ {
124
+ target: isExternal && as !== "button" ? "_blank" : void 0,
125
+ rel: isExternal && as !== "button" ? "noopener noreferrer" : void 0,
126
+ className: ["polli-link", className].filter(Boolean).join(" "),
127
+ "data-size": size,
128
+ "data-tone": tone,
129
+ ...linkProps,
130
+ children: [
131
+ children,
132
+ showIcon && isExternal && /* @__PURE__ */ jsx3(
133
+ ExternalLinkIcon,
134
+ {
135
+ "aria-hidden": "true",
136
+ className: "polli-link-external-icon"
137
+ }
138
+ )
139
+ ]
140
+ }
141
+ );
142
+ }
65
143
 
66
144
  // src/modules/wallet/format-pollen.ts
67
145
  var BUDGET = 5;
@@ -93,7 +171,7 @@ function formatPollen(value) {
93
171
  }
94
172
 
95
173
  // src/modules/wallet/wallet-display.tsx
96
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
174
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
97
175
  var walletPanelClasses = {
98
176
  paid: "polli-wallet-panel-paid",
99
177
  tier: "polli-wallet-panel-tier"
@@ -102,68 +180,219 @@ var walletTextClasses = {
102
180
  paid: "polli-wallet-text-paid",
103
181
  tier: "polli-wallet-text-tier"
104
182
  };
105
- var WalletDot = ({ kind, className }) => /* @__PURE__ */ jsx3(
106
- "span",
107
- {
108
- className: cn(
109
- "polli:h-2 polli:w-2 polli:rounded-full",
110
- kind === "paid" ? "polli-wallet-dot-paid" : "polli-wallet-dot-tier",
111
- className
112
- ),
113
- "aria-hidden": "true"
114
- }
115
- );
183
+ var walletKindIcons = {
184
+ paid: CardIcon,
185
+ tier: SproutIcon
186
+ };
187
+ var WalletKindIcon = ({
188
+ kind,
189
+ className
190
+ }) => {
191
+ const Icon = walletKindIcons[kind];
192
+ return /* @__PURE__ */ jsx4(
193
+ Icon,
194
+ {
195
+ "aria-hidden": "true",
196
+ className: cn(
197
+ "polli:h-3.5 polli:w-3.5 polli:shrink-0",
198
+ walletTextClasses[kind],
199
+ className
200
+ )
201
+ }
202
+ );
203
+ };
116
204
  var WalletBalanceCard = ({
205
+ tone = "balance",
117
206
  kind,
118
207
  label,
119
208
  value,
209
+ icon,
120
210
  info,
121
211
  footer,
122
212
  className
123
- }) => /* @__PURE__ */ jsxs(
124
- "div",
125
- {
126
- className: cn(
127
- "polli:rounded-xl polli:p-4",
128
- walletPanelClasses[kind],
129
- className
130
- ),
131
- children: [
132
- /* @__PURE__ */ jsxs("span", { className: "polli:flex polli:items-center polli:gap-2", children: [
133
- /* @__PURE__ */ jsx3(WalletDot, { kind }),
134
- /* @__PURE__ */ jsx3(
135
- "span",
213
+ }) => {
214
+ const Icon = walletKindIcons[kind];
215
+ const textColor = tone === "neutral" ? "polli:text-theme-text-strong" : walletTextClasses[kind];
216
+ return /* @__PURE__ */ jsxs3(
217
+ "div",
218
+ {
219
+ className: cn(
220
+ "polli:min-w-0 polli:rounded-card polli:p-3.5 polli:sm:p-5",
221
+ tone === "neutral" ? "polli:bg-surface-opaque" : walletPanelClasses[kind],
222
+ className
223
+ ),
224
+ children: [
225
+ /* @__PURE__ */ jsxs3("span", { className: "polli:flex polli:items-center polli:gap-2", children: [
226
+ icon ?? /* @__PURE__ */ jsx4(
227
+ Icon,
228
+ {
229
+ "aria-hidden": "true",
230
+ className: cn(
231
+ "polli:h-3.5 polli:w-3.5 polli:shrink-0",
232
+ textColor
233
+ )
234
+ }
235
+ ),
236
+ /* @__PURE__ */ jsx4(
237
+ "span",
238
+ {
239
+ className: cn(
240
+ "polli:text-sm polli:font-bold polli:uppercase polli:tracking-wide",
241
+ textColor
242
+ ),
243
+ children: label
244
+ }
245
+ ),
246
+ info
247
+ ] }),
248
+ /* @__PURE__ */ jsx4(
249
+ "div",
136
250
  {
137
251
  className: cn(
138
- "polli:text-sm polli:font-bold polli:uppercase polli:tracking-wide",
139
- walletTextClasses[kind]
252
+ "polli-wallet-balance-value polli:[overflow-wrap:anywhere] polli:mt-1 polli:font-bold polli:leading-none polli:tracking-tight polli:tabular-nums",
253
+ textColor
140
254
  ),
141
- children: label
255
+ children: value
256
+ }
257
+ ),
258
+ footer && /* @__PURE__ */ jsx4("div", { className: "polli:mt-1.5 polli:text-sm polli:font-bold polli:tabular-nums polli:text-intent-success-text", children: footer })
259
+ ]
260
+ }
261
+ );
262
+ };
263
+
264
+ // src/modules/wallet/AccountPollen.tsx
265
+ import { Fragment, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
266
+ function isEmpty(amount) {
267
+ return amount != null && amount <= 0;
268
+ }
269
+ var labels = {
270
+ "limit-reached": "Limit reached",
271
+ "no-pollen": "No Pollen",
272
+ unlimited: "Unlimited"
273
+ };
274
+ function PollenStatusBadge({
275
+ state,
276
+ topUpHref
277
+ }) {
278
+ const Icon = state === "no-pollen" ? WalletIcon : KeyIcon;
279
+ const label = labels[state];
280
+ return /* @__PURE__ */ jsxs4(
281
+ Chip,
282
+ {
283
+ size: "sm",
284
+ intent: state === "unlimited" ? "info" : "danger",
285
+ "aria-label": label,
286
+ children: [
287
+ /* @__PURE__ */ jsx5(
288
+ Icon,
289
+ {
290
+ "aria-hidden": "true",
291
+ className: "polli:h-3.5 polli:w-3.5 polli:shrink-0"
142
292
  }
143
293
  ),
144
- info
145
- ] }),
146
- /* @__PURE__ */ jsx3(
147
- "div",
148
- {
149
- className: cn(
150
- "polli-wallet-balance-value polli:mt-1 polli:font-bold polli:leading-none polli:tracking-tight polli:tabular-nums",
151
- walletTextClasses[kind]
294
+ label,
295
+ state === "no-pollen" && topUpHref && /* @__PURE__ */ jsxs4(Fragment, { children: [
296
+ /* @__PURE__ */ jsx5("span", { "aria-hidden": "true", children: "\xB7" }),
297
+ /* @__PURE__ */ jsx5(
298
+ InlineLink,
299
+ {
300
+ href: topUpHref,
301
+ "aria-label": `${label}. Top up`,
302
+ children: "Top up"
303
+ }
304
+ )
305
+ ] })
306
+ ]
307
+ }
308
+ );
309
+ }
310
+ function AccountPollen({
311
+ source,
312
+ topUpHref
313
+ }) {
314
+ if (source.type === "budget") {
315
+ if (source.generationEnabled === false) return null;
316
+ const unlimited = source.remaining === null;
317
+ if (!unlimited && source.remaining === void 0) return null;
318
+ if (unlimited) return /* @__PURE__ */ jsx5(PollenStatusBadge, { state: "unlimited" });
319
+ const remaining = source.remaining;
320
+ if (isEmpty(remaining))
321
+ return /* @__PURE__ */ jsx5(PollenStatusBadge, { state: "limit-reached" });
322
+ return /* @__PURE__ */ jsxs4(
323
+ "span",
324
+ {
325
+ title: "App budget left",
326
+ className: "polli:inline-flex polli:items-center polli:gap-1 polli:tabular-nums",
327
+ children: [
328
+ /* @__PURE__ */ jsx5(
329
+ KeyIcon,
330
+ {
331
+ "aria-hidden": "true",
332
+ className: "polli:h-3.5 polli:w-3.5 polli:shrink-0"
333
+ }
152
334
  ),
153
- children: value
154
- }
155
- ),
156
- footer && /* @__PURE__ */ jsx3("div", { className: "polli:mt-1.5 polli:text-sm polli:font-bold polli:tabular-nums polli:text-intent-success-text", children: footer })
157
- ]
335
+ /* @__PURE__ */ jsx5("span", { className: "polli:sr-only", children: "App budget: " }),
336
+ formatPollen(remaining),
337
+ " pollen"
338
+ ]
339
+ }
340
+ );
158
341
  }
159
- );
342
+ const { balances } = source;
343
+ if (!balances) return null;
344
+ if (isEmpty(balances.paid) && isEmpty(balances.quest))
345
+ return /* @__PURE__ */ jsx5(PollenStatusBadge, { state: "no-pollen", topUpHref });
346
+ return /* @__PURE__ */ jsx5("span", { className: "polli:inline-flex polli:items-center polli:gap-2 polli:tabular-nums", children: ["quest", "paid"].map((kind) => {
347
+ const amount = balances[kind];
348
+ return /* @__PURE__ */ jsxs4(
349
+ "span",
350
+ {
351
+ className: "polli:inline-flex polli:items-center polli:gap-1",
352
+ children: [
353
+ /* @__PURE__ */ jsx5(
354
+ WalletKindIcon,
355
+ {
356
+ kind: kind === "paid" ? "paid" : "tier"
357
+ }
358
+ ),
359
+ /* @__PURE__ */ jsxs4("span", { className: "polli:sr-only", children: [
360
+ kind === "paid" ? "Paid" : "Quest",
361
+ " Pollen:",
362
+ " "
363
+ ] }),
364
+ formatPollen(Math.max(0, amount))
365
+ ]
366
+ },
367
+ kind
368
+ );
369
+ }) });
370
+ }
371
+
372
+ // src/modules/wallet/chips.tsx
373
+ import { jsx as jsx6 } from "react/jsx-runtime";
374
+ var PaidChip = ({
375
+ className,
376
+ children,
377
+ ...props
378
+ }) => /* @__PURE__ */ jsx6(Chip, { ...props, className: cn("polli-wallet-chip-paid", className), children });
379
+ var TierChip = ({
380
+ className,
381
+ children,
382
+ ...props
383
+ }) => /* @__PURE__ */ jsx6(Chip, { ...props, className: cn("polli-wallet-chip-tier", className), children });
384
+
385
+ // src/modules/wallet/colors.ts
386
+ var PAID_BALANCE_CHART_COLOR = "var(--polli-color-paid-soft)";
387
+ var TIER_BALANCE_CHART_COLOR = "var(--polli-color-tier-soft)";
160
388
  export {
389
+ AccountPollen,
161
390
  PAID_BALANCE_CHART_COLOR,
162
391
  PaidChip,
163
392
  TIER_BALANCE_CHART_COLOR,
164
393
  TierChip,
165
394
  WalletBalanceCard,
166
- WalletDot,
395
+ WalletKindIcon,
167
396
  formatPollen
168
397
  };
169
398
  //# sourceMappingURL=index.js.map