@nexub/react 4.9.0 → 5.0.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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.9.0",
2
+ "version": "5.0.0",
3
3
  "standard": "WCAG 2.2 Level AA",
4
4
  "method": {
5
5
  "automated": "axe-core rules tagged wcag2a, wcag2aa, wcag21a, wcag21aa and wcag22aa, run on every Storybook story in light and dark on every pull request; a new violation fails the build.",
@@ -45,8 +45,10 @@ export interface ThemeProviderProps {
45
45
  seed?: string;
46
46
  /** Accent family the seed recolours: 'primary' (default) or 'tertiary' (product brand). */
47
47
  seedTarget?: 'primary' | 'tertiary';
48
+ /** Expression set on <html> when it has no data-expression. Needs `@nexub/themes/vivid` for Vivid. @default 'vivid' */
49
+ defaultExpression?: 'vivid' | 'calm';
48
50
  }
49
- export declare function ThemeProvider({ children, defaultTheme, storageKey, defaultGlass, glassStorageKey, seed, seedTarget, }: ThemeProviderProps): React.JSX.Element;
51
+ export declare function ThemeProvider({ children, defaultTheme, storageKey, defaultGlass, glassStorageKey, seed, seedTarget, defaultExpression, }: ThemeProviderProps): React.JSX.Element;
50
52
  export declare function useTheme(): ThemeContextValue;
51
53
  export interface ThemeScriptProps {
52
54
  /** Must match ThemeProvider's `storageKey`. Defaults to 'nexub-theme'. */
@@ -1,6 +1,5 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { warnOnce } from "../../utils/deprecated.js";
4
3
  import * as React from "react";
5
4
  import { useIsomorphicLayoutEffect } from "../../hooks/useIsomorphicLayoutEffect.js";
6
5
  const GLASS_MODES = ["clear", "balanced", "tinted", "off"];
@@ -105,17 +104,14 @@ function ThemeProvider({
105
104
  defaultGlass = "balanced",
106
105
  glassStorageKey = "nexub-glass",
107
106
  seed,
108
- seedTarget = "primary"
107
+ seedTarget = "primary",
108
+ defaultExpression = "vivid"
109
109
  }) {
110
110
  useSeedTheme(seed, seedTarget);
111
- React.useEffect(() => {
112
- if (React.version.startsWith("18.")) warnOnce("react-18", "React 18 support is deprecated; 5.0 requires React 19.");
113
- if (!document.documentElement.closest("[data-expression]") && !document.querySelector("[data-expression]"))
114
- warnOnce(
115
- "expression-default",
116
- `In 5.0 the Vivid expression becomes the default. Set data-expression="calm" on <html> to keep today's look, or data-expression="vivid" to opt in now.`
117
- );
118
- }, []);
111
+ useIsomorphicLayoutEffect(() => {
112
+ const html = document.documentElement;
113
+ if (!html.hasAttribute("data-expression")) html.setAttribute("data-expression", defaultExpression);
114
+ }, [defaultExpression]);
119
115
  const [theme, setThemeState] = React.useState(defaultTheme);
120
116
  const [systemTheme, setSystemTheme] = React.useState("light");
121
117
  const [glass, setGlassState] = React.useState(defaultGlass);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexub/react",
3
- "version": "4.9.0",
3
+ "version": "5.0.0",
4
4
  "description": "React component library for Nexub Design System — 90+ accessible, themeable UI components built on Radix UI primitives.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -81,13 +81,13 @@
81
81
  "date-fns": "^4.4.0",
82
82
  "react-day-picker": "^10.0.2",
83
83
  "tailwind-merge": "^3.7.0",
84
- "@nexub/core": "4.9.0",
85
- "@nexub/icons": "4.9.0"
84
+ "@nexub/core": "5.0.0",
85
+ "@nexub/icons": "5.0.0"
86
86
  },
87
87
  "peerDependencies": {
88
- "react": ">=18 <20",
89
- "react-dom": ">=18 <20",
90
- "@nexub/tokens": "^4.9.0"
88
+ "react": ">=19 <20",
89
+ "react-dom": ">=19 <20",
90
+ "@nexub/tokens": "^5.0.0"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@playwright/test": "1.64.0",
@@ -113,8 +113,8 @@
113
113
  "vaul": "1.1.2",
114
114
  "vite": "^8.3.5",
115
115
  "vitest": "^5.0.5",
116
- "@nexub/themes": "4.9.0",
117
- "@nexub/tokens": "4.9.0"
116
+ "@nexub/themes": "5.0.0",
117
+ "@nexub/tokens": "5.0.0"
118
118
  },
119
119
  "scripts": {
120
120
  "build": "rm -rf dist && tsup && tsc -p tsconfig.build.json && rm -f dist/vendor/*.d.ts && node scripts/check-dts.mjs && tailwindcss -i src/styles.css -o dist/styles.css --minify && cp -R ../themes/src/fonts dist/fonts",
@@ -1,8 +0,0 @@
1
- /**
2
- * Warns once per component, outside production, that it is deprecated and removed in 3.0
3
- * (GOVERNANCE.md: a removal needs a development warning in a 2.x minor first).
4
- * Bundlers replace `process.env.NODE_ENV`, so production builds drop the call's body.
5
- */
6
- export declare function warnDeprecated(name: string, replacement: string): void;
7
- /** Warns once per key, outside production (same rules as warnDeprecated). Used for 4.9 → 5.0 notices. */
8
- export declare function warnOnce(key: string, message: string): void;
@@ -1,27 +0,0 @@
1
- const warned = /* @__PURE__ */ new Set();
2
- function warnDeprecated(name, replacement) {
3
- try {
4
- if (process.env.NODE_ENV === "production") return;
5
- } catch {
6
- return;
7
- }
8
- if (warned.has(name)) return;
9
- warned.add(name);
10
- console.warn(
11
- `[@nexub/react] ${name} is deprecated and will be removed in 3.0. Use ${replacement} instead.`
12
- );
13
- }
14
- function warnOnce(key, message) {
15
- try {
16
- if (process.env.NODE_ENV === "production") return;
17
- } catch {
18
- return;
19
- }
20
- if (warned.has(key)) return;
21
- warned.add(key);
22
- console.warn(`[@nexub/react] ${message}`);
23
- }
24
- export {
25
- warnDeprecated,
26
- warnOnce
27
- };