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