@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
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Design tokens. Every value is a CSS value, for example `#4f46e5`, `oklch(...)` or `var(--primary)`. */
|
|
4
|
+
interface Variables {
|
|
5
|
+
colorPrimary?: string;
|
|
6
|
+
colorPrimaryForeground?: string;
|
|
7
|
+
colorBackground?: string;
|
|
8
|
+
colorCard?: string;
|
|
9
|
+
colorForeground?: string;
|
|
10
|
+
colorMuted?: string;
|
|
11
|
+
colorMutedForeground?: string;
|
|
12
|
+
colorAccent?: string;
|
|
13
|
+
colorAccentForeground?: string;
|
|
14
|
+
colorBorder?: string;
|
|
15
|
+
colorDanger?: string;
|
|
16
|
+
colorWarning?: string;
|
|
17
|
+
colorSuccess?: string;
|
|
18
|
+
/** Fill of secondary buttons. Defaults to `colorMuted`. */
|
|
19
|
+
colorSecondary?: string;
|
|
20
|
+
/** Border of secondary buttons and other controls. Defaults to `colorBorder`. */
|
|
21
|
+
colorInput?: string;
|
|
22
|
+
/** The highlighted pricing card (`highlightPlan`). Defaults to `colorPrimary`. */
|
|
23
|
+
colorHighlight?: string;
|
|
24
|
+
/** Text on a filled highlighted card. Defaults to `colorPrimaryForeground`. */
|
|
25
|
+
colorHighlightForeground?: string;
|
|
26
|
+
fontFamily?: string;
|
|
27
|
+
/** Font of numbers in tables. Defaults to the surrounding font. */
|
|
28
|
+
fontFamilyNumbers?: string;
|
|
29
|
+
/** CSS `font` shorthand of small labels: table headers and plan card status labels. */
|
|
30
|
+
labelFont?: string;
|
|
31
|
+
/** `text-transform` of small labels, for example `uppercase`. */
|
|
32
|
+
labelTextTransform?: string;
|
|
33
|
+
/** `letter-spacing` of small labels. */
|
|
34
|
+
labelLetterSpacing?: string;
|
|
35
|
+
/** CSS `font` shorthand of titles: dialog and portal titles. Default `700 20px/1.25` in `fontFamily`. */
|
|
36
|
+
fontTitle?: string;
|
|
37
|
+
/** CSS `font` shorthand of headings: plan names and section headings. Default `600 16px/1.35` in `fontFamily`. */
|
|
38
|
+
fontHeading?: string;
|
|
39
|
+
/**
|
|
40
|
+
* CSS `font` shorthand of large numbers: prices, balances and totals, shown in tabular figures.
|
|
41
|
+
* Default `700 28px/1.1` in `fontFamilyNumbers`, else `fontFamily`.
|
|
42
|
+
*/
|
|
43
|
+
fontMetric?: string;
|
|
44
|
+
/** CSS `font` shorthand of body text and descriptions. Default `400 14px/1.5` in `fontFamily`. */
|
|
45
|
+
fontBody?: string;
|
|
46
|
+
/** CSS `font` shorthand of small text: dates, intervals and hints. Default `400 12px/1.4` in `fontFamily`. */
|
|
47
|
+
fontMeta?: string;
|
|
48
|
+
/** CSS `font` shorthand of buttons and links. Default `600 14px/1.4` in `fontFamily`. */
|
|
49
|
+
fontAction?: string;
|
|
50
|
+
borderRadius?: string;
|
|
51
|
+
borderWidth?: string;
|
|
52
|
+
shadow?: string;
|
|
53
|
+
/** Corner radius of buttons. Defaults to a fraction of `borderRadius`. */
|
|
54
|
+
buttonRadius?: string;
|
|
55
|
+
/** Border width of buttons. Defaults to `borderWidth`. */
|
|
56
|
+
buttonBorderWidth?: string;
|
|
57
|
+
/** Border colour of primary buttons. Defaults to the button's fill colour. */
|
|
58
|
+
buttonBorderColor?: string;
|
|
59
|
+
/** Shadow of primary buttons only, for example a hard offset. Defaults to none. */
|
|
60
|
+
buttonShadow?: string;
|
|
61
|
+
/** Sets the CSS `color-scheme` of the component, so native controls follow the theme. */
|
|
62
|
+
colorScheme?: "light" | "dark" | "light dark";
|
|
63
|
+
}
|
|
64
|
+
type ElementKey = "pricingTable" | "pricingTable__toggle" | "pricingTable__toggleButton" | "pricingTable__grid" | "planCard" | "planCard__header" | "planCard__badge" | "planCard__name" | "planCard__description" | "planCard__price" | "planCard__features" | "planCard__feature" | "planCard__cta" | "planComparison" | "planComparison__table" | "planComparison__row" | "planComparison__cell" | "creditBalance" | "creditBalance__amount" | "creditHistory" | "creditHistory__table" | "creditHistory__row" | "usageBreakdown" | "usageBreakdown__row" | "usageTrend" | "usageTrend__bar" | "usageMeter" | "usageMeter__label" | "usageMeter__value" | "usageMeter__track" | "usageMeter__fill" | "usageDashboard" | "usageAlert" | "usageAlert__dismiss" | "currentPlan" | "currentPlan__name" | "currentPlan__status" | "currentPlan__price" | "currentPlan__scheduled" | "currentPlan__notice" | "currentPlan__usage" | "currentPlan__details" | "planBadge" | "paymentMethod" | "checkoutButton" | "upgradeButton" | "checkout" | "checkout__submit" | "checkout__error" | "upgradeModal" | "upgradeModal__dialog" | "upgradeModal__actions" | "upgradePrompt" | "lockedOverlay" | "lockedOverlay__panel" | "billingPortal" | "billingPortal__section" | "billingPortal__card" | "billingPortal__table" | "billingPortal__error" | "cancellationControl" | "planChangeControl" | "poweredBy";
|
|
65
|
+
/** A string adds a class name; an object adds inline styles. */
|
|
66
|
+
type Elements = Partial<Record<ElementKey, string | CSSProperties>>;
|
|
67
|
+
interface Theme {
|
|
68
|
+
variables?: Variables;
|
|
69
|
+
elements?: Elements;
|
|
70
|
+
/**
|
|
71
|
+
* How plan cards are laid out. `card` (default): name, description, price and ticked features.
|
|
72
|
+
* `panel`: the name in a header band with the plan's status on the right, then price,
|
|
73
|
+
* description and plain feature lines.
|
|
74
|
+
*/
|
|
75
|
+
planCardLayout?: "card" | "panel";
|
|
76
|
+
}
|
|
77
|
+
/** A theme (or a stack of themes, last wins) plus your own variables and elements on top. */
|
|
78
|
+
interface Appearance extends Theme {
|
|
79
|
+
theme?: Theme | Theme[];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type { Appearance as A, ElementKey as E, Theme as T, Variables as V, Elements as a };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Design tokens. Every value is a CSS value, for example `#4f46e5`, `oklch(...)` or `var(--primary)`. */
|
|
4
|
+
interface Variables {
|
|
5
|
+
colorPrimary?: string;
|
|
6
|
+
colorPrimaryForeground?: string;
|
|
7
|
+
colorBackground?: string;
|
|
8
|
+
colorCard?: string;
|
|
9
|
+
colorForeground?: string;
|
|
10
|
+
colorMuted?: string;
|
|
11
|
+
colorMutedForeground?: string;
|
|
12
|
+
colorAccent?: string;
|
|
13
|
+
colorAccentForeground?: string;
|
|
14
|
+
colorBorder?: string;
|
|
15
|
+
colorDanger?: string;
|
|
16
|
+
colorWarning?: string;
|
|
17
|
+
colorSuccess?: string;
|
|
18
|
+
/** Fill of secondary buttons. Defaults to `colorMuted`. */
|
|
19
|
+
colorSecondary?: string;
|
|
20
|
+
/** Border of secondary buttons and other controls. Defaults to `colorBorder`. */
|
|
21
|
+
colorInput?: string;
|
|
22
|
+
/** The highlighted pricing card (`highlightPlan`). Defaults to `colorPrimary`. */
|
|
23
|
+
colorHighlight?: string;
|
|
24
|
+
/** Text on a filled highlighted card. Defaults to `colorPrimaryForeground`. */
|
|
25
|
+
colorHighlightForeground?: string;
|
|
26
|
+
fontFamily?: string;
|
|
27
|
+
/** Font of numbers in tables. Defaults to the surrounding font. */
|
|
28
|
+
fontFamilyNumbers?: string;
|
|
29
|
+
/** CSS `font` shorthand of small labels: table headers and plan card status labels. */
|
|
30
|
+
labelFont?: string;
|
|
31
|
+
/** `text-transform` of small labels, for example `uppercase`. */
|
|
32
|
+
labelTextTransform?: string;
|
|
33
|
+
/** `letter-spacing` of small labels. */
|
|
34
|
+
labelLetterSpacing?: string;
|
|
35
|
+
/** CSS `font` shorthand of titles: dialog and portal titles. Default `700 20px/1.25` in `fontFamily`. */
|
|
36
|
+
fontTitle?: string;
|
|
37
|
+
/** CSS `font` shorthand of headings: plan names and section headings. Default `600 16px/1.35` in `fontFamily`. */
|
|
38
|
+
fontHeading?: string;
|
|
39
|
+
/**
|
|
40
|
+
* CSS `font` shorthand of large numbers: prices, balances and totals, shown in tabular figures.
|
|
41
|
+
* Default `700 28px/1.1` in `fontFamilyNumbers`, else `fontFamily`.
|
|
42
|
+
*/
|
|
43
|
+
fontMetric?: string;
|
|
44
|
+
/** CSS `font` shorthand of body text and descriptions. Default `400 14px/1.5` in `fontFamily`. */
|
|
45
|
+
fontBody?: string;
|
|
46
|
+
/** CSS `font` shorthand of small text: dates, intervals and hints. Default `400 12px/1.4` in `fontFamily`. */
|
|
47
|
+
fontMeta?: string;
|
|
48
|
+
/** CSS `font` shorthand of buttons and links. Default `600 14px/1.4` in `fontFamily`. */
|
|
49
|
+
fontAction?: string;
|
|
50
|
+
borderRadius?: string;
|
|
51
|
+
borderWidth?: string;
|
|
52
|
+
shadow?: string;
|
|
53
|
+
/** Corner radius of buttons. Defaults to a fraction of `borderRadius`. */
|
|
54
|
+
buttonRadius?: string;
|
|
55
|
+
/** Border width of buttons. Defaults to `borderWidth`. */
|
|
56
|
+
buttonBorderWidth?: string;
|
|
57
|
+
/** Border colour of primary buttons. Defaults to the button's fill colour. */
|
|
58
|
+
buttonBorderColor?: string;
|
|
59
|
+
/** Shadow of primary buttons only, for example a hard offset. Defaults to none. */
|
|
60
|
+
buttonShadow?: string;
|
|
61
|
+
/** Sets the CSS `color-scheme` of the component, so native controls follow the theme. */
|
|
62
|
+
colorScheme?: "light" | "dark" | "light dark";
|
|
63
|
+
}
|
|
64
|
+
type ElementKey = "pricingTable" | "pricingTable__toggle" | "pricingTable__toggleButton" | "pricingTable__grid" | "planCard" | "planCard__header" | "planCard__badge" | "planCard__name" | "planCard__description" | "planCard__price" | "planCard__features" | "planCard__feature" | "planCard__cta" | "planComparison" | "planComparison__table" | "planComparison__row" | "planComparison__cell" | "creditBalance" | "creditBalance__amount" | "creditHistory" | "creditHistory__table" | "creditHistory__row" | "usageBreakdown" | "usageBreakdown__row" | "usageTrend" | "usageTrend__bar" | "usageMeter" | "usageMeter__label" | "usageMeter__value" | "usageMeter__track" | "usageMeter__fill" | "usageDashboard" | "usageAlert" | "usageAlert__dismiss" | "currentPlan" | "currentPlan__name" | "currentPlan__status" | "currentPlan__price" | "currentPlan__scheduled" | "currentPlan__notice" | "currentPlan__usage" | "currentPlan__details" | "planBadge" | "paymentMethod" | "checkoutButton" | "upgradeButton" | "checkout" | "checkout__submit" | "checkout__error" | "upgradeModal" | "upgradeModal__dialog" | "upgradeModal__actions" | "upgradePrompt" | "lockedOverlay" | "lockedOverlay__panel" | "billingPortal" | "billingPortal__section" | "billingPortal__card" | "billingPortal__table" | "billingPortal__error" | "cancellationControl" | "planChangeControl" | "poweredBy";
|
|
65
|
+
/** A string adds a class name; an object adds inline styles. */
|
|
66
|
+
type Elements = Partial<Record<ElementKey, string | CSSProperties>>;
|
|
67
|
+
interface Theme {
|
|
68
|
+
variables?: Variables;
|
|
69
|
+
elements?: Elements;
|
|
70
|
+
/**
|
|
71
|
+
* How plan cards are laid out. `card` (default): name, description, price and ticked features.
|
|
72
|
+
* `panel`: the name in a header band with the plan's status on the right, then price,
|
|
73
|
+
* description and plain feature lines.
|
|
74
|
+
*/
|
|
75
|
+
planCardLayout?: "card" | "panel";
|
|
76
|
+
}
|
|
77
|
+
/** A theme (or a stack of themes, last wins) plus your own variables and elements on top. */
|
|
78
|
+
interface Appearance extends Theme {
|
|
79
|
+
theme?: Theme | Theme[];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type { Appearance as A, ElementKey as E, Theme as T, Variables as V, Elements as a };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nozle-js/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -25,18 +25,28 @@
|
|
|
25
25
|
"types": "./dist/styles/preset.d.cts",
|
|
26
26
|
"default": "./dist/styles/preset.cjs"
|
|
27
27
|
}
|
|
28
|
+
},
|
|
29
|
+
"./themes": {
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./dist/themes.d.ts",
|
|
32
|
+
"default": "./dist/themes.js"
|
|
33
|
+
},
|
|
34
|
+
"require": {
|
|
35
|
+
"types": "./dist/themes.d.cts",
|
|
36
|
+
"default": "./dist/themes.cjs"
|
|
37
|
+
}
|
|
28
38
|
}
|
|
29
39
|
},
|
|
30
40
|
"files": [
|
|
31
41
|
"dist"
|
|
32
42
|
],
|
|
33
43
|
"scripts": {
|
|
34
|
-
"build": "tsup",
|
|
44
|
+
"build": "tsup && node scripts/check-use-client.mjs",
|
|
35
45
|
"test": "vitest run",
|
|
36
46
|
"typecheck": "tsc --noEmit"
|
|
37
47
|
},
|
|
38
|
-
"dependencies": {},
|
|
39
48
|
"devDependencies": {
|
|
49
|
+
"@tanstack/react-query": "^5.101.1",
|
|
40
50
|
"@testing-library/react": "^16.3.2",
|
|
41
51
|
"@types/react": "^19.2.17",
|
|
42
52
|
"@types/react-dom": "^19.2.3",
|
|
@@ -45,18 +55,24 @@
|
|
|
45
55
|
"react-dom": "^19.2.6",
|
|
46
56
|
"tsup": "^8.4.0",
|
|
47
57
|
"typescript": "^5.8.0",
|
|
48
|
-
"vitest": "^
|
|
58
|
+
"vitest": "^4.1.12"
|
|
49
59
|
},
|
|
50
60
|
"peerDependencies": {
|
|
51
61
|
"@stripe/react-stripe-js": ">=3.0.0",
|
|
52
62
|
"@stripe/stripe-js": ">=5.0.0",
|
|
53
63
|
"react": ">=18.0.0",
|
|
54
|
-
"react-dom": ">=18.0.0"
|
|
64
|
+
"react-dom": ">=18.0.0",
|
|
65
|
+
"@tanstack/react-query": ">=5.0.0"
|
|
55
66
|
},
|
|
56
67
|
"repository": {
|
|
57
68
|
"type": "git",
|
|
58
69
|
"url": "git+https://github.com/nozle-dev/nozle-js.git",
|
|
59
70
|
"directory": "packages/react"
|
|
60
71
|
},
|
|
61
|
-
"license": "MIT"
|
|
72
|
+
"license": "MIT",
|
|
73
|
+
"overrides": {
|
|
74
|
+
"esbuild": "^0.28.2",
|
|
75
|
+
"postcss": "^8.5.23",
|
|
76
|
+
"source-map-js": "^1.2.2"
|
|
77
|
+
}
|
|
62
78
|
}
|