@nozle-js/react 0.10.2 → 0.12.0
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 +50 -1
- package/dist/chunk-NLPONQ5O.js +246 -0
- package/dist/chunk-NLPONQ5O.js.map +1 -0
- package/dist/index.cjs +2691 -1134
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +876 -78
- package/dist/index.d.ts +876 -78
- package/dist/index.js +2254 -964
- package/dist/index.js.map +1 -1
- package/dist/styles/preset.cjs.map +1 -1
- package/dist/styles/preset.d.cts +4 -0
- package/dist/styles/preset.d.ts +4 -0
- package/dist/styles/preset.js.map +1 -1
- package/dist/themes.cjs +230 -0
- package/dist/themes.cjs.map +1 -0
- package/dist/themes.d.cts +27 -0
- package/dist/themes.d.ts +27 -0
- package/dist/themes.js +126 -0
- package/dist/themes.js.map +1 -0
- package/dist/tokens-Bm4VWWb0.d.cts +82 -0
- package/dist/tokens-Bm4VWWb0.d.ts +82 -0
- package/package.json +22 -6
package/README.md
CHANGED
|
@@ -13,9 +13,11 @@ React components for Nozle's public catalog, checkout, and customer billing port
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npm install @nozle-js/react@0.
|
|
16
|
+
npm install @nozle-js/react@0.11.0 @tanstack/react-query react react-dom @stripe/stripe-js @stripe/react-stripe-js
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
The billing hooks (`useSubscription`, `useUsage`, `useInvoices` and the others) read your backend through `BillingProvider billingEndpoint`, served by `createBillingHandler` from `@nozle-js/node`; see [Hooks](https://docs.nozle.dev/sdks/react/hooks). Components need no Tailwind or host CSS. Style them with `appearance` on `BillingProvider` or on a component, using a theme from `@nozle-js/react/themes`, your own variables and per-element overrides; see [Styling](https://docs.nozle.dev/sdks/react/styling).
|
|
20
|
+
|
|
19
21
|
## Merchant-backed checkout
|
|
20
22
|
|
|
21
23
|
```tsx
|
|
@@ -50,6 +52,53 @@ The merchant endpoint authenticates the user, derives the Nozle customer from th
|
|
|
50
52
|
|
|
51
53
|
`createCheckout` returns a `stripe`, `razorpay`, `hosted`, `processing`, `completed`, or `scheduled` result. Nozle payment fulfillment determines activation; Razorpay requires capture. A browser redirect or callback alone does not prove activation.
|
|
52
54
|
|
|
55
|
+
## Pricing table and plan families
|
|
56
|
+
|
|
57
|
+
`PricingTable` shows one card per plan family. A family groups the billing intervals of one offer (for example Pro monthly and Pro yearly) and carries the pricing table settings you set in the Nozle dashboard (Developers → Customize SDK). `GET /api/v1/plans` returns them as `families` next to `plans`:
|
|
58
|
+
|
|
59
|
+
| Family field | Effect |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| `show_on_pricing: false` | The family is hidden. Plans with `pending_deletion: true` are left out, and a family without plans is hidden |
|
|
62
|
+
| `pricing_position` | Cards are ordered by it, ascending. Families without a position follow in API order |
|
|
63
|
+
| `pricing_highlighted` | The card is highlighted (at most one). The `highlightPlan` prop, a family code or plan code, overrides it |
|
|
64
|
+
| `badge_text` / `cta_text` | Badge on the highlighted card (default "Most Popular"; the `highlightLabel` prop replaces it) and button text (default "Get {name}") |
|
|
65
|
+
| `features[].show_on_pricing: false` | The feature is left out of the card |
|
|
66
|
+
| `features[].display_position` | Features are ordered by it, then by name |
|
|
67
|
+
| `features[].show_description` | The feature's description appears as a muted line under the bullet |
|
|
68
|
+
|
|
69
|
+
The interval switch offers the intervals of the visible families (Weekly, Monthly, Quarterly, Every 6 months, Annual) and is hidden when there is only one. Each card shows the family's plan for the selected interval as a per-month price (`$40.83 /mo`) with its billing line (`Billed $490 yearly · save 17%`, saving against the family's monthly plan), and a family without a plan for that interval shows its nearest interval. Feature values come from the selected plan's entitlements, for example `Projects: 20` or `Storage (GB: 10, Tier: fast)`. The button and checkout use the selected plan's code.
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
<PricingTable
|
|
73
|
+
returnUrl={window.location.href}
|
|
74
|
+
defaultInterval="yearly"
|
|
75
|
+
locale="en-GB"
|
|
76
|
+
features={{
|
|
77
|
+
pro: ["Priority support", { label: "API access", description: "REST and GraphQL" }],
|
|
78
|
+
}}
|
|
79
|
+
onSelect={(plan, family) => console.log(plan.code, family?.code)}
|
|
80
|
+
/>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
- `defaultInterval` picks the first interval (`"annual"` also works). Otherwise Monthly when offered, else the first one. `showToggle={false}` hides the switch.
|
|
84
|
+
- `features` is a record keyed by family code (or plan code) that replaces the catalog features of that card, or an array aligned to the rendered cards.
|
|
85
|
+
- `contactSalesPlans` takes family codes as well as plan codes: the card shows "Custom" and a "Contact Sales" button.
|
|
86
|
+
- Cards follow the `appearance` theme like the other components: the highlighted family uses `colorHighlight` (default `colorPrimary`) and `highlightStyle`, and a theme's `planCardLayout: "panel"` lays family cards out as panels with the same billing line. The default highlight (`#4f46e5` in the `light` theme) keeps its white text at WCAG AA contrast; if you set your own `colorHighlight`, check that `colorHighlightForeground` on it reaches 4.5:1.
|
|
87
|
+
- `annualDiscountLabel` replaces the computed "Save N%" on the Annual option.
|
|
88
|
+
- `locale` (default `en-US`) formats prices and feature values. Prices are exact in the currency's minor units (`¥1,500` for 1500 JPY), and whole amounts show no decimals (`$20`).
|
|
89
|
+
- Pass `plans` and `families` to render without fetching. With `plans` alone, or with an older API that returns no `families`, each plan is its own card as before, sorted by price (or by `sort`), with its price per its own interval (`$14.99 /quarter`, no per-month price or billing line) and what the plan gives as its features.
|
|
90
|
+
|
|
91
|
+
For a custom pricing page, use the same rules with `usePlans()`:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
const { plans, families } = usePlans();
|
|
95
|
+
const intervals = getAvailableIntervals({ plans, families });
|
|
96
|
+
const cards = getPricingCards({ plans, families }, { interval: "yearly", locale: "en-US" });
|
|
97
|
+
// cards[i]: { family, plan, name, price, pricePeriod, billing, features, highlighted, badge, cta, ... }
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`getPricingIntervalOptions(catalog)` returns the switch options with their labels and best saving, and `getDefaultInterval(catalog, preferred?)` the interval to start on.
|
|
101
|
+
|
|
53
102
|
## Payment providers: Stripe and Razorpay
|
|
54
103
|
|
|
55
104
|
Your merchant backend returns whatever result Nozle gives for the customer's connected provider, and `CheckoutButton` handles each `type`:
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
// src/appearance/tokens.ts
|
|
2
|
+
var CSS_VAR = {
|
|
3
|
+
colorPrimary: "--nozle-primary",
|
|
4
|
+
colorPrimaryForeground: "--nozle-primary-foreground",
|
|
5
|
+
colorBackground: "--nozle-background",
|
|
6
|
+
colorCard: "--nozle-card",
|
|
7
|
+
colorForeground: "--nozle-foreground",
|
|
8
|
+
colorMuted: "--nozle-muted",
|
|
9
|
+
colorMutedForeground: "--nozle-muted-foreground",
|
|
10
|
+
colorAccent: "--nozle-accent",
|
|
11
|
+
colorAccentForeground: "--nozle-accent-foreground",
|
|
12
|
+
colorBorder: "--nozle-border",
|
|
13
|
+
colorDanger: "--nozle-destructive",
|
|
14
|
+
colorWarning: "--nozle-warning",
|
|
15
|
+
colorSuccess: "--nozle-success",
|
|
16
|
+
colorSecondary: "--nozle-secondary",
|
|
17
|
+
colorInput: "--nozle-input",
|
|
18
|
+
colorHighlight: "--nozle-highlight",
|
|
19
|
+
colorHighlightForeground: "--nozle-highlight-foreground",
|
|
20
|
+
fontFamily: "--nozle-font",
|
|
21
|
+
fontFamilyNumbers: "--nozle-font-numbers",
|
|
22
|
+
labelFont: "--nozle-label-font",
|
|
23
|
+
labelTextTransform: "--nozle-label-transform",
|
|
24
|
+
labelLetterSpacing: "--nozle-label-spacing",
|
|
25
|
+
fontTitle: "--nozle-font-title",
|
|
26
|
+
fontHeading: "--nozle-font-heading",
|
|
27
|
+
fontMetric: "--nozle-font-metric",
|
|
28
|
+
fontBody: "--nozle-font-body",
|
|
29
|
+
fontMeta: "--nozle-font-meta",
|
|
30
|
+
fontAction: "--nozle-font-action",
|
|
31
|
+
borderRadius: "--nozle-radius",
|
|
32
|
+
borderWidth: "--nozle-border-width",
|
|
33
|
+
shadow: "--nozle-shadow",
|
|
34
|
+
buttonRadius: "--nozle-button-radius",
|
|
35
|
+
buttonBorderWidth: "--nozle-button-border-width",
|
|
36
|
+
buttonBorderColor: "--nozle-button-border",
|
|
37
|
+
buttonShadow: "--nozle-button-shadow"
|
|
38
|
+
};
|
|
39
|
+
var LIGHT = {
|
|
40
|
+
colorPrimary: "#4f46e5",
|
|
41
|
+
colorPrimaryForeground: "#ffffff",
|
|
42
|
+
colorBackground: "#ffffff",
|
|
43
|
+
colorCard: "#ffffff",
|
|
44
|
+
colorForeground: "#111827",
|
|
45
|
+
colorMuted: "#f3f4f6",
|
|
46
|
+
colorAccent: "#eef2ff",
|
|
47
|
+
colorAccentForeground: "#3730a3",
|
|
48
|
+
colorBorder: "#e5e7eb",
|
|
49
|
+
colorDanger: "#dc2626",
|
|
50
|
+
colorWarning: "#d97706",
|
|
51
|
+
colorSuccess: "#16a34a",
|
|
52
|
+
fontFamily: "system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
53
|
+
borderRadius: "12px",
|
|
54
|
+
borderWidth: "1px",
|
|
55
|
+
shadow: "0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04)"
|
|
56
|
+
};
|
|
57
|
+
var ALIASES = {
|
|
58
|
+
colorPrimary: ["--nozle-pricing-highlight", "--nozle-portal-accent"],
|
|
59
|
+
colorBackground: ["--nozle-pricing-bg", "--nozle-portal-background"],
|
|
60
|
+
colorCard: ["--nozle-pricing-card-bg"],
|
|
61
|
+
colorForeground: ["--nozle-portal-text"],
|
|
62
|
+
colorMuted: ["--nozle-portal-muted-background"],
|
|
63
|
+
colorMutedForeground: ["--nozle-portal-muted"],
|
|
64
|
+
colorBorder: ["--nozle-pricing-border", "--nozle-portal-border"],
|
|
65
|
+
borderRadius: ["--nozle-pricing-radius"]
|
|
66
|
+
};
|
|
67
|
+
function chain(key, last = LIGHT[key]) {
|
|
68
|
+
return [CSS_VAR[key], ...ALIASES[key] ?? []].reduceRight(
|
|
69
|
+
(fallback, name) => `var(${name}, ${fallback})`,
|
|
70
|
+
last
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
var soft = (color, base, percent) => `color-mix(in srgb, ${color} ${percent}%, ${base})`;
|
|
74
|
+
var primary = chain("colorPrimary");
|
|
75
|
+
var card = chain("colorCard");
|
|
76
|
+
var danger = chain("colorDanger");
|
|
77
|
+
var warning = chain("colorWarning");
|
|
78
|
+
var success = chain("colorSuccess");
|
|
79
|
+
var foreground = chain("colorForeground");
|
|
80
|
+
var primaryForeground = chain("colorPrimaryForeground");
|
|
81
|
+
var font = chain("fontFamily");
|
|
82
|
+
var DERIVED_MUTED_FOREGROUND = `color-mix(in srgb, ${foreground} 62%, ${card})`;
|
|
83
|
+
var T = {
|
|
84
|
+
primary,
|
|
85
|
+
primaryForeground,
|
|
86
|
+
highlight: `var(--nozle-highlight, ${primary})`,
|
|
87
|
+
highlightForeground: `var(--nozle-highlight-foreground, ${primaryForeground})`,
|
|
88
|
+
background: chain("colorBackground"),
|
|
89
|
+
card,
|
|
90
|
+
foreground,
|
|
91
|
+
muted: chain("colorMuted"),
|
|
92
|
+
mutedForeground: chain("colorMutedForeground", DERIVED_MUTED_FOREGROUND),
|
|
93
|
+
accent: chain("colorAccent"),
|
|
94
|
+
secondary: `var(--nozle-secondary, ${chain("colorMuted")})`,
|
|
95
|
+
input: `var(--nozle-input, ${chain("colorBorder")})`,
|
|
96
|
+
accentForeground: chain("colorAccentForeground"),
|
|
97
|
+
border: chain("colorBorder"),
|
|
98
|
+
danger,
|
|
99
|
+
warning,
|
|
100
|
+
success,
|
|
101
|
+
font,
|
|
102
|
+
fontNumbers: "var(--nozle-font-numbers, inherit)",
|
|
103
|
+
labelFont: `var(--nozle-label-font, 600 12px/1.4 ${font})`,
|
|
104
|
+
fontTitle: `var(--nozle-font-title, 700 20px/1.25 ${font})`,
|
|
105
|
+
fontHeading: `var(--nozle-font-heading, 600 16px/1.35 ${font})`,
|
|
106
|
+
fontMetric: `var(--nozle-font-metric, 700 28px/1.1 var(--nozle-font-numbers, ${font}))`,
|
|
107
|
+
fontBody: `var(--nozle-font-body, 400 14px/1.5 ${font})`,
|
|
108
|
+
fontMeta: `var(--nozle-font-meta, 400 12px/1.4 ${font})`,
|
|
109
|
+
fontAction: `var(--nozle-font-action, 600 14px/1.4 ${font})`,
|
|
110
|
+
labelTransform: "var(--nozle-label-transform, none)",
|
|
111
|
+
labelSpacing: "var(--nozle-label-spacing, normal)",
|
|
112
|
+
radius: chain("borderRadius"),
|
|
113
|
+
borderWidth: chain("borderWidth"),
|
|
114
|
+
shadow: chain("shadow"),
|
|
115
|
+
/** Tinted backgrounds and borders for notices, derived from the matching colour. */
|
|
116
|
+
dangerSoft: soft(danger, card, 10),
|
|
117
|
+
dangerBorder: soft(danger, card, 30),
|
|
118
|
+
warningSoft: soft(warning, card, 12),
|
|
119
|
+
warningBorder: soft(warning, card, 35),
|
|
120
|
+
/** Status text: the status colour mixed with the text colour, so it stays readable on its soft background. */
|
|
121
|
+
dangerText: soft(danger, foreground, 70),
|
|
122
|
+
warningText: soft(warning, foreground, 70),
|
|
123
|
+
successText: soft(success, foreground, 70),
|
|
124
|
+
successSoft: soft(success, card, 12),
|
|
125
|
+
primarySoft: soft(primary, card, 10),
|
|
126
|
+
primaryHover: soft(primary, "black", 88),
|
|
127
|
+
skeleton: soft(foreground, card, 8),
|
|
128
|
+
/** Table header band and the lighter line between table rows. */
|
|
129
|
+
tableHeader: soft(chain("colorMuted"), card, 50),
|
|
130
|
+
rowLine: soft(chain("colorBorder"), card, 70)
|
|
131
|
+
};
|
|
132
|
+
var text = {
|
|
133
|
+
title: { font: T.fontTitle, color: T.foreground },
|
|
134
|
+
heading: { font: T.fontHeading, color: T.foreground },
|
|
135
|
+
metric: { font: T.fontMetric, fontVariantNumeric: "tabular-nums", color: T.foreground },
|
|
136
|
+
body: { font: T.fontBody, color: T.foreground },
|
|
137
|
+
secondary: { font: T.fontBody, color: T.mutedForeground },
|
|
138
|
+
meta: { font: T.fontMeta, color: T.mutedForeground },
|
|
139
|
+
label: {
|
|
140
|
+
font: T.labelFont,
|
|
141
|
+
letterSpacing: T.labelSpacing,
|
|
142
|
+
textTransform: T.labelTransform,
|
|
143
|
+
color: T.mutedForeground
|
|
144
|
+
},
|
|
145
|
+
action: { font: T.fontAction }
|
|
146
|
+
};
|
|
147
|
+
var border = (color = T.border) => `${T.borderWidth} solid ${color}`;
|
|
148
|
+
var buttonBorderWidth = `var(--nozle-button-border-width, ${T.borderWidth})`;
|
|
149
|
+
var primaryButtonBorder = (color) => `${buttonBorderWidth} solid var(--nozle-button-border, ${color})`;
|
|
150
|
+
var buttonBorder = (color) => `${buttonBorderWidth} solid ${color}`;
|
|
151
|
+
var buttonRadius = (fallback) => `var(--nozle-button-radius, ${fallback})`;
|
|
152
|
+
var buttonShadow = "var(--nozle-button-shadow, none)";
|
|
153
|
+
function addTheme(target, theme) {
|
|
154
|
+
if (!theme) return;
|
|
155
|
+
Object.assign(target.variables, theme.variables);
|
|
156
|
+
if (theme.planCardLayout) target.planCardLayout = theme.planCardLayout;
|
|
157
|
+
for (const [key, value] of Object.entries(theme.elements ?? {})) {
|
|
158
|
+
const current = target.elements[key] ?? {};
|
|
159
|
+
target.elements[key] = typeof value === "string" ? { ...current, className: [current.className, value].filter(Boolean).join(" ") } : { ...current, style: { ...current.style, ...value } };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function mergeAppearance(...layers) {
|
|
163
|
+
const resolved = { variables: {}, elements: {} };
|
|
164
|
+
for (const layer of layers) {
|
|
165
|
+
if (!layer) continue;
|
|
166
|
+
const themes = Array.isArray(layer.theme) ? layer.theme : [layer.theme];
|
|
167
|
+
themes.forEach((theme) => addTheme(resolved, theme));
|
|
168
|
+
addTheme(resolved, layer);
|
|
169
|
+
}
|
|
170
|
+
return resolved;
|
|
171
|
+
}
|
|
172
|
+
function toCssVars(variables) {
|
|
173
|
+
const style = {};
|
|
174
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
175
|
+
if (value == null || value === "") continue;
|
|
176
|
+
if (key === "colorScheme") style.colorScheme = value;
|
|
177
|
+
else style[CSS_VAR[key]] = value;
|
|
178
|
+
}
|
|
179
|
+
return style;
|
|
180
|
+
}
|
|
181
|
+
var surface = {
|
|
182
|
+
...text.body,
|
|
183
|
+
background: T.card,
|
|
184
|
+
border: border(),
|
|
185
|
+
borderRadius: T.radius,
|
|
186
|
+
boxShadow: T.shadow,
|
|
187
|
+
padding: "1.25rem"
|
|
188
|
+
};
|
|
189
|
+
var table = {
|
|
190
|
+
frame: {
|
|
191
|
+
...text.body,
|
|
192
|
+
background: T.card,
|
|
193
|
+
border: border(),
|
|
194
|
+
borderRadius: T.radius,
|
|
195
|
+
overflowX: "auto",
|
|
196
|
+
minWidth: 0,
|
|
197
|
+
maxWidth: "100%"
|
|
198
|
+
},
|
|
199
|
+
table: { width: "100%", borderCollapse: "collapse", font: "inherit" },
|
|
200
|
+
head: (numeric = false) => ({
|
|
201
|
+
height: "44px",
|
|
202
|
+
padding: "0 20px",
|
|
203
|
+
textAlign: numeric ? "right" : "left",
|
|
204
|
+
verticalAlign: "middle",
|
|
205
|
+
...text.label,
|
|
206
|
+
whiteSpace: "nowrap",
|
|
207
|
+
background: T.tableHeader,
|
|
208
|
+
borderBottom: border()
|
|
209
|
+
}),
|
|
210
|
+
/** `last`: the final body row, whose line the frame already draws. */
|
|
211
|
+
cell: (numeric = false, last = false) => ({
|
|
212
|
+
height: "48px",
|
|
213
|
+
padding: "14px 20px",
|
|
214
|
+
verticalAlign: "middle",
|
|
215
|
+
whiteSpace: "nowrap",
|
|
216
|
+
textAlign: numeric ? "right" : "left",
|
|
217
|
+
borderBottom: last ? "none" : border(T.rowLine),
|
|
218
|
+
...numeric && { fontFamily: T.fontNumbers, fontVariantNumeric: "tabular-nums" }
|
|
219
|
+
}),
|
|
220
|
+
foot: (numeric = false) => ({
|
|
221
|
+
...table.cell(numeric, true),
|
|
222
|
+
borderTop: border(),
|
|
223
|
+
background: T.tableHeader,
|
|
224
|
+
fontWeight: 600
|
|
225
|
+
})
|
|
226
|
+
};
|
|
227
|
+
function buttonStyle(variant = "primary", busy = false) {
|
|
228
|
+
const colors = {
|
|
229
|
+
primary: { background: T.primary, color: T.primaryForeground, border: primaryButtonBorder(T.primary), boxShadow: buttonShadow },
|
|
230
|
+
secondary: { background: T.secondary, color: T.foreground, border: buttonBorder(T.input) },
|
|
231
|
+
outline: { background: "transparent", color: T.primary, border: buttonBorder(T.primary) }
|
|
232
|
+
};
|
|
233
|
+
return {
|
|
234
|
+
...colors[variant],
|
|
235
|
+
padding: "0.75rem 1.5rem",
|
|
236
|
+
borderRadius: buttonRadius(`calc(${T.radius} * 0.75)`),
|
|
237
|
+
...text.action,
|
|
238
|
+
cursor: busy ? "wait" : "pointer",
|
|
239
|
+
opacity: busy ? 0.7 : 1,
|
|
240
|
+
transition: "filter 0.15s ease"
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export { DERIVED_MUTED_FOREGROUND, LIGHT, T, border, buttonRadius, buttonStyle, mergeAppearance, primaryButtonBorder, surface, table, text, toCssVars };
|
|
245
|
+
//# sourceMappingURL=chunk-NLPONQ5O.js.map
|
|
246
|
+
//# sourceMappingURL=chunk-NLPONQ5O.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/appearance/tokens.ts"],"names":[],"mappings":";AAsJA,IAAM,OAAA,GAAoC;AAAA,EACxC,YAAA,EAAc,iBAAA;AAAA,EACd,sBAAA,EAAwB,4BAAA;AAAA,EACxB,eAAA,EAAiB,oBAAA;AAAA,EACjB,SAAA,EAAW,cAAA;AAAA,EACX,eAAA,EAAiB,oBAAA;AAAA,EACjB,UAAA,EAAY,eAAA;AAAA,EACZ,oBAAA,EAAsB,0BAAA;AAAA,EACtB,WAAA,EAAa,gB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,CAAA,CAAE,OAAO,CAAA,EAAG,WAAW,YAAA,EAAa;AAAA,IAC9H,SAAA,EAAW,EAAE,UAAA,EAAY,CAAA,CAAE,SAAA,EAAW,KAAA,EAAO,CAAA,CAAE,UAAA,EAAY,MAAA,EAAQ,YAAA,CAAa,CAAA,CAAE,KAAK,CAAA,EAAE;AAAA,IACzF,OAAA,EAAS,EAAE,UAAA,EAAY,aAAA,EAAe,KAAA,EAAO,CAAA,CAAE,OAAA,EAAS,MAAA,EAAQ,YAAA,CAAa,CAAA,CAAE,OAAO,CAAA;AAAE,GAC1F;AACA,EAAA,OAAO;AAAA,IACL,GAAG,OAAO,OAAO,CAAA;AAAA,IACjB,OAAA,EAAS,gBAAA;AAAA,IACT,YAAA,EAAc,YAAA,CAAa,CAAA,KAAA,EAAQ,CAAA,CAAE,MAAM,CAAA,QAAA,CAAU,CAAA;AAAA,IACrD,GAAG,IAAA,CAAK,MAAA;AAAA,IACR,MAAA,EAAQ,OAAO,MAAA,GAAS,SAAA;AAAA,IACxB,OAAA,EAAS,OAAO,GAAA,GAAM,CAAA;AAAA,IACtB,UAAA,EAAY;AAAA,GACd;AACF","file":"chunk-NLPONQ5O.js","sourcesContent":["import type { CSSProperties } from \"react\";\n\n/** Design tokens. Every value is a CSS value, for example `#4f46e5`, `oklch(...)` or `var(--primary)`. */\nexport interface Variables {\n colorPrimary?: string;\n colorPrimaryForeground?: string;\n colorBackground?: string;\n colorCard?: string;\n colorForeground?: string;\n colorMuted?: string;\n colorMutedForeground?: string;\n colorAccent?: string;\n colorAccentForeground?: string;\n colorBorder?: string;\n colorDanger?: string;\n colorWarning?: string;\n colorSuccess?: string;\n /** Fill of secondary buttons. Defaults to `colorMuted`. */\n colorSecondary?: string;\n /** Border of secondary buttons and other controls. Defaults to `colorBorder`. */\n colorInput?: string;\n /** The highlighted pricing card (`highlightPlan`). Defaults to `colorPrimary`. */\n colorHighlight?: string;\n /** Text on a filled highlighted card. Defaults to `colorPrimaryForeground`. */\n colorHighlightForeground?: string;\n fontFamily?: string;\n /** Font of numbers in tables. Defaults to the surrounding font. */\n fontFamilyNumbers?: string;\n /** CSS `font` shorthand of small labels: table headers and plan card status labels. */\n labelFont?: string;\n /** `text-transform` of small labels, for example `uppercase`. */\n labelTextTransform?: string;\n /** `letter-spacing` of small labels. */\n labelLetterSpacing?: string;\n /** CSS `font` shorthand of titles: dialog and portal titles. Default `700 20px/1.25` in `fontFamily`. */\n fontTitle?: string;\n /** CSS `font` shorthand of headings: plan names and section headings. Default `600 16px/1.35` in `fontFamily`. */\n fontHeading?: string;\n /**\n * CSS `font` shorthand of large numbers: prices, balances and totals, shown in tabular figures.\n * Default `700 28px/1.1` in `fontFamilyNumbers`, else `fontFamily`.\n */\n fontMetric?: string;\n /** CSS `font` shorthand of body text and descriptions. Default `400 14px/1.5` in `fontFamily`. */\n fontBody?: string;\n /** CSS `font` shorthand of small text: dates, intervals and hints. Default `400 12px/1.4` in `fontFamily`. */\n fontMeta?: string;\n /** CSS `font` shorthand of buttons and links. Default `600 14px/1.4` in `fontFamily`. */\n fontAction?: string;\n borderRadius?: string;\n borderWidth?: string;\n shadow?: string;\n /** Corner radius of buttons. Defaults to a fraction of `borderRadius`. */\n buttonRadius?: string;\n /** Border width of buttons. Defaults to `borderWidth`. */\n buttonBorderWidth?: string;\n /** Border colour of primary buttons. Defaults to the button's fill colour. */\n buttonBorderColor?: string;\n /** Shadow of primary buttons only, for example a hard offset. Defaults to none. */\n buttonShadow?: string;\n /** Sets the CSS `color-scheme` of the component, so native controls follow the theme. */\n colorScheme?: \"light\" | \"dark\" | \"light dark\";\n}\n\nexport type ElementKey =\n | \"pricingTable\"\n | \"pricingTable__toggle\"\n | \"pricingTable__toggleButton\"\n | \"pricingTable__grid\"\n | \"planCard\"\n | \"planCard__header\"\n | \"planCard__badge\"\n | \"planCard__name\"\n | \"planCard__description\"\n | \"planCard__price\"\n | \"planCard__features\"\n | \"planCard__feature\"\n | \"planCard__cta\"\n | \"planComparison\"\n | \"planComparison__table\"\n | \"planComparison__row\"\n | \"planComparison__cell\"\n | \"creditBalance\"\n | \"creditBalance__amount\"\n | \"creditHistory\"\n | \"creditHistory__table\"\n | \"creditHistory__row\"\n | \"usageBreakdown\"\n | \"usageBreakdown__row\"\n | \"usageTrend\"\n | \"usageTrend__bar\"\n | \"usageMeter\"\n | \"usageMeter__label\"\n | \"usageMeter__value\"\n | \"usageMeter__track\"\n | \"usageMeter__fill\"\n | \"usageDashboard\"\n | \"usageAlert\"\n | \"usageAlert__dismiss\"\n | \"currentPlan\"\n | \"currentPlan__name\"\n | \"currentPlan__status\"\n | \"currentPlan__price\"\n | \"currentPlan__scheduled\"\n | \"currentPlan__notice\"\n | \"currentPlan__usage\"\n | \"currentPlan__details\"\n | \"planBadge\"\n | \"paymentMethod\"\n | \"checkoutButton\"\n | \"upgradeButton\"\n | \"checkout\"\n | \"checkout__submit\"\n | \"checkout__error\"\n | \"upgradeModal\"\n | \"upgradeModal__dialog\"\n | \"upgradeModal__actions\"\n | \"upgradePrompt\"\n | \"lockedOverlay\"\n | \"lockedOverlay__panel\"\n | \"billingPortal\"\n | \"billingPortal__section\"\n | \"billingPortal__card\"\n | \"billingPortal__table\"\n | \"billingPortal__error\"\n | \"cancellationControl\"\n | \"planChangeControl\"\n | \"poweredBy\";\n\n/** A string adds a class name; an object adds inline styles. */\nexport type Elements = Partial<Record<ElementKey, string | CSSProperties>>;\n\nexport interface Theme {\n variables?: Variables;\n elements?: Elements;\n /**\n * How plan cards are laid out. `card` (default): name, description, price and ticked features.\n * `panel`: the name in a header band with the plan's status on the right, then price,\n * description and plain feature lines.\n */\n planCardLayout?: \"card\" | \"panel\";\n}\n\n/** A theme (or a stack of themes, last wins) plus your own variables and elements on top. */\nexport interface Appearance extends Theme {\n theme?: Theme | Theme[];\n}\n\ntype ColorKey = Exclude<keyof Variables, \"colorScheme\">;\n\nconst CSS_VAR: Record<ColorKey, string> = {\n colorPrimary: \"--nozle-primary\",\n colorPrimaryForeground: \"--nozle-primary-foreground\",\n colorBackground: \"--nozle-background\",\n colorCard: \"--nozle-card\",\n colorForeground: \"--nozle-foreground\",\n colorMuted: \"--nozle-muted\",\n colorMutedForeground: \"--nozle-muted-foreground\",\n colorAccent: \"--nozle-accent\",\n colorAccentForeground: \"--nozle-accent-foreground\",\n colorBorder: \"--nozle-border\",\n colorDanger: \"--nozle-destructive\",\n colorWarning: \"--nozle-warning\",\n colorSuccess: \"--nozle-success\",\n colorSecondary: \"--nozle-secondary\",\n colorInput: \"--nozle-input\",\n colorHighlight: \"--nozle-highlight\",\n colorHighlightForeground: \"--nozle-highlight-foreground\",\n fontFamily: \"--nozle-font\",\n fontFamilyNumbers: \"--nozle-font-numbers\",\n labelFont: \"--nozle-label-font\",\n labelTextTransform: \"--nozle-label-transform\",\n labelLetterSpacing: \"--nozle-label-spacing\",\n fontTitle: \"--nozle-font-title\",\n fontHeading: \"--nozle-font-heading\",\n fontMetric: \"--nozle-font-metric\",\n fontBody: \"--nozle-font-body\",\n fontMeta: \"--nozle-font-meta\",\n fontAction: \"--nozle-font-action\",\n borderRadius: \"--nozle-radius\",\n borderWidth: \"--nozle-border-width\",\n shadow: \"--nozle-shadow\",\n buttonRadius: \"--nozle-button-radius\",\n buttonBorderWidth: \"--nozle-button-border-width\",\n buttonBorderColor: \"--nozle-button-border\",\n buttonShadow: \"--nozle-button-shadow\",\n};\n\n/** The light values every component falls back to when nothing else sets a token. */\n// The highlight colours default to the primary colours, the muted text to a mix of the text and card\n// colours, the text roles to sizes in `fontFamily`, and the button values to the general ones or to\n// each button's own, so they have no value of their own here.\ntype DerivedKey =\n | \"colorMutedForeground\"\n | \"colorHighlight\"\n | \"colorHighlightForeground\"\n | \"colorSecondary\"\n | \"colorInput\"\n | \"fontFamilyNumbers\"\n | \"labelFont\"\n | \"labelTextTransform\"\n | \"labelLetterSpacing\"\n | \"fontTitle\"\n | \"fontHeading\"\n | \"fontMetric\"\n | \"fontBody\"\n | \"fontMeta\"\n | \"fontAction\"\n | \"buttonRadius\"\n | \"buttonBorderWidth\"\n | \"buttonBorderColor\"\n | \"buttonShadow\";\n\nexport const LIGHT: Required<Omit<Variables, \"colorScheme\" | DerivedKey>> = {\n colorPrimary: \"#4f46e5\",\n colorPrimaryForeground: \"#ffffff\",\n colorBackground: \"#ffffff\",\n colorCard: \"#ffffff\",\n colorForeground: \"#111827\",\n colorMuted: \"#f3f4f6\",\n colorAccent: \"#eef2ff\",\n colorAccentForeground: \"#3730a3\",\n colorBorder: \"#e5e7eb\",\n colorDanger: \"#dc2626\",\n colorWarning: \"#d97706\",\n colorSuccess: \"#16a34a\",\n fontFamily: \"system-ui, -apple-system, 'Segoe UI', sans-serif\",\n borderRadius: \"12px\",\n borderWidth: \"1px\",\n shadow: \"0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04)\",\n};\n\n// Variable names from earlier releases, still read after the --nozle-* name.\nconst ALIASES: Partial<Record<ColorKey, string[]>> = {\n colorPrimary: [\"--nozle-pricing-highlight\", \"--nozle-portal-accent\"],\n colorBackground: [\"--nozle-pricing-bg\", \"--nozle-portal-background\"],\n colorCard: [\"--nozle-pricing-card-bg\"],\n colorForeground: [\"--nozle-portal-text\"],\n colorMuted: [\"--nozle-portal-muted-background\"],\n colorMutedForeground: [\"--nozle-portal-muted\"],\n colorBorder: [\"--nozle-pricing-border\", \"--nozle-portal-border\"],\n borderRadius: [\"--nozle-pricing-radius\"],\n};\n\nfunction chain(key: ColorKey, last: string = LIGHT[key as Exclude<ColorKey, DerivedKey>]): string {\n return [CSS_VAR[key], ...(ALIASES[key] ?? [])].reduceRight(\n (fallback, name) => `var(${name}, ${fallback})`,\n last,\n );\n}\n\nconst soft = (color: string, base: string, percent: number) =>\n `color-mix(in srgb, ${color} ${percent}%, ${base})`;\n\nconst primary = chain(\"colorPrimary\");\nconst card = chain(\"colorCard\");\nconst danger = chain(\"colorDanger\");\nconst warning = chain(\"colorWarning\");\nconst success = chain(\"colorSuccess\");\nconst foreground = chain(\"colorForeground\");\nconst primaryForeground = chain(\"colorPrimaryForeground\");\nconst font = chain(\"fontFamily\");\n\n/**\n * Muted text when `colorMutedForeground` is not set: the text colour mixed into the card colour, so\n * changing `colorForeground` recolours muted text too.\n */\nexport const DERIVED_MUTED_FOREGROUND = `color-mix(in srgb, ${foreground} 62%, ${card})`;\n\n/** CSS values for component styles: each reads its token, then older names, then the light value. */\nexport const T = {\n primary,\n primaryForeground,\n highlight: `var(--nozle-highlight, ${primary})`,\n highlightForeground: `var(--nozle-highlight-foreground, ${primaryForeground})`,\n background: chain(\"colorBackground\"),\n card,\n foreground,\n muted: chain(\"colorMuted\"),\n mutedForeground: chain(\"colorMutedForeground\", DERIVED_MUTED_FOREGROUND),\n accent: chain(\"colorAccent\"),\n secondary: `var(--nozle-secondary, ${chain(\"colorMuted\")})`,\n input: `var(--nozle-input, ${chain(\"colorBorder\")})`,\n accentForeground: chain(\"colorAccentForeground\"),\n border: chain(\"colorBorder\"),\n danger,\n warning,\n success,\n font,\n fontNumbers: \"var(--nozle-font-numbers, inherit)\",\n labelFont: `var(--nozle-label-font, 600 12px/1.4 ${font})`,\n fontTitle: `var(--nozle-font-title, 700 20px/1.25 ${font})`,\n fontHeading: `var(--nozle-font-heading, 600 16px/1.35 ${font})`,\n fontMetric: `var(--nozle-font-metric, 700 28px/1.1 var(--nozle-font-numbers, ${font}))`,\n fontBody: `var(--nozle-font-body, 400 14px/1.5 ${font})`,\n fontMeta: `var(--nozle-font-meta, 400 12px/1.4 ${font})`,\n fontAction: `var(--nozle-font-action, 600 14px/1.4 ${font})`,\n labelTransform: \"var(--nozle-label-transform, none)\",\n labelSpacing: \"var(--nozle-label-spacing, normal)\",\n radius: chain(\"borderRadius\"),\n borderWidth: chain(\"borderWidth\"),\n shadow: chain(\"shadow\"),\n /** Tinted backgrounds and borders for notices, derived from the matching colour. */\n dangerSoft: soft(danger, card, 10),\n dangerBorder: soft(danger, card, 30),\n warningSoft: soft(warning, card, 12),\n warningBorder: soft(warning, card, 35),\n /** Status text: the status colour mixed with the text colour, so it stays readable on its soft background. */\n dangerText: soft(danger, foreground, 70),\n warningText: soft(warning, foreground, 70),\n successText: soft(success, foreground, 70),\n successSoft: soft(success, card, 12),\n primarySoft: soft(primary, card, 10),\n primaryHover: soft(primary, \"black\", 88),\n skeleton: soft(foreground, card, 8),\n /** Table header band and the lighter line between table rows. */\n tableHeader: soft(chain(\"colorMuted\"), card, 50),\n rowLine: soft(chain(\"colorBorder\"), card, 70),\n} as const;\n\n/**\n * Text roles. Each sets the role's font (a `font` shorthand variable) and its default colour; a\n * component may change the colour, for example to a status colour or the text on a filled card.\n * `font` comes first because the shorthand resets the longhands after it.\n */\nexport const text = {\n title: { font: T.fontTitle, color: T.foreground },\n heading: { font: T.fontHeading, color: T.foreground },\n metric: { font: T.fontMetric, fontVariantNumeric: \"tabular-nums\", color: T.foreground },\n body: { font: T.fontBody, color: T.foreground },\n secondary: { font: T.fontBody, color: T.mutedForeground },\n meta: { font: T.fontMeta, color: T.mutedForeground },\n label: {\n font: T.labelFont,\n letterSpacing: T.labelSpacing,\n textTransform: T.labelTransform as CSSProperties[\"textTransform\"],\n color: T.mutedForeground,\n },\n action: { font: T.fontAction },\n} satisfies Record<string, CSSProperties>;\n\n/** `border` shorthand using the theme's border width and colour. */\nexport const border = (color: string = T.border) => `${T.borderWidth} solid ${color}`;\n\nconst buttonBorderWidth = `var(--nozle-button-border-width, ${T.borderWidth})`;\n\n/** `border` shorthand for a primary button: `buttonBorderColor` first, then `color`. */\nexport const primaryButtonBorder = (color: string) => `${buttonBorderWidth} solid var(--nozle-button-border, ${color})`;\n\n/** `border` shorthand for any other button. */\nexport const buttonBorder = (color: string) => `${buttonBorderWidth} solid ${color}`;\n\n/** Button corner radius: the `buttonRadius` token, else `fallback`. */\nexport const buttonRadius = (fallback: string) => `var(--nozle-button-radius, ${fallback})`;\n\nexport const buttonShadow = \"var(--nozle-button-shadow, none)\";\n\nexport interface ResolvedAppearance {\n variables: Variables;\n planCardLayout?: \"card\" | \"panel\";\n elements: Partial<Record<ElementKey, { className?: string; style?: CSSProperties }>>;\n}\n\nfunction addTheme(target: ResolvedAppearance, theme: Theme | undefined) {\n if (!theme) return;\n Object.assign(target.variables, theme.variables);\n if (theme.planCardLayout) target.planCardLayout = theme.planCardLayout;\n for (const [key, value] of Object.entries(theme.elements ?? {}) as [ElementKey, string | CSSProperties][]) {\n const current = target.elements[key] ?? {};\n target.elements[key] =\n typeof value === \"string\"\n ? { ...current, className: [current.className, value].filter(Boolean).join(\" \") }\n : { ...current, style: { ...current.style, ...value } };\n }\n}\n\n/**\n * Merges appearances in order, each later one winning: for each, its theme (or themes, in order) then\n * its own variables and elements. Pass the provider's appearance first, then the component's.\n */\nexport function mergeAppearance(...layers: (Appearance | undefined)[]): ResolvedAppearance {\n const resolved: ResolvedAppearance = { variables: {}, elements: {} };\n for (const layer of layers) {\n if (!layer) continue;\n const themes = Array.isArray(layer.theme) ? layer.theme : [layer.theme];\n themes.forEach((theme) => addTheme(resolved, theme));\n addTheme(resolved, layer);\n }\n return resolved;\n}\n\n/** Inline CSS custom properties for a set of variables; `colorScheme` becomes `color-scheme`. */\nexport function toCssVars(variables: Variables): CSSProperties {\n const style: Record<string, string> = {};\n for (const [key, value] of Object.entries(variables)) {\n if (value == null || value === \"\") continue;\n if (key === \"colorScheme\") style.colorScheme = value;\n else style[CSS_VAR[key as ColorKey]] = value;\n }\n return style as CSSProperties;\n}\n\n/** The card frame shared by the data components. */\nexport const surface: CSSProperties = {\n ...text.body,\n background: T.card,\n border: border(),\n borderRadius: T.radius,\n boxShadow: T.shadow,\n padding: \"1.25rem\",\n};\n\n/** Tables, after the Nozle dashboard table: a bordered frame, a tinted header band with small\n * uppercase labels, roomy rows, and numbers right-aligned in tabular figures. */\nexport const table = {\n frame: {\n ...text.body,\n background: T.card,\n border: border(),\n borderRadius: T.radius,\n overflowX: \"auto\",\n minWidth: 0,\n maxWidth: \"100%\",\n } as CSSProperties,\n table: { width: \"100%\", borderCollapse: \"collapse\", font: \"inherit\" } as CSSProperties,\n head: (numeric = false): CSSProperties => ({\n height: \"44px\",\n padding: \"0 20px\",\n textAlign: numeric ? \"right\" : \"left\",\n verticalAlign: \"middle\",\n ...text.label,\n whiteSpace: \"nowrap\",\n background: T.tableHeader,\n borderBottom: border(),\n }),\n /** `last`: the final body row, whose line the frame already draws. */\n cell: (numeric = false, last = false): CSSProperties => ({\n height: \"48px\",\n padding: \"14px 20px\",\n verticalAlign: \"middle\",\n whiteSpace: \"nowrap\",\n textAlign: numeric ? \"right\" : \"left\",\n borderBottom: last ? \"none\" : border(T.rowLine),\n ...(numeric && { fontFamily: T.fontNumbers, fontVariantNumeric: \"tabular-nums\" }),\n }),\n foot: (numeric = false): CSSProperties => ({\n ...table.cell(numeric, true),\n borderTop: border(),\n background: T.tableHeader,\n fontWeight: 600,\n }),\n};\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"outline\";\n\n/** Button look shared by every component, from the theme tokens. */\nexport function buttonStyle(variant: ButtonVariant = \"primary\", busy = false): CSSProperties {\n const colors: Record<ButtonVariant, CSSProperties> = {\n primary: { background: T.primary, color: T.primaryForeground, border: primaryButtonBorder(T.primary), boxShadow: buttonShadow },\n secondary: { background: T.secondary, color: T.foreground, border: buttonBorder(T.input) },\n outline: { background: \"transparent\", color: T.primary, border: buttonBorder(T.primary) },\n };\n return {\n ...colors[variant],\n padding: \"0.75rem 1.5rem\",\n borderRadius: buttonRadius(`calc(${T.radius} * 0.75)`),\n ...text.action,\n cursor: busy ? \"wait\" : \"pointer\",\n opacity: busy ? 0.7 : 1,\n transition: \"filter 0.15s ease\",\n };\n}\n"]}
|