@dax-ui/nextjs 0.0.0-stage → 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # @dax-ui/nextjs
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - First public release: design tokens, theme and UIProvider, Button, TextField, the
8
+ @dax-ui/react bundle, and @dax-ui/nextjs for Next.js App Router.
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+ - @dax-ui/theme@0.1.0
package/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2026 Digital Auxilius. All rights reserved.
2
+
3
+ This software and its source code are proprietary. They are made publicly available
4
+ for viewing and installation only. No license is granted to use, copy, modify, merge,
5
+ publish, distribute, sublicense or sell copies of this software, in whole or in part,
6
+ except under a separate written agreement with Digital Auxilius.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
9
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
10
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
11
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY ARISING FROM, OUT OF OR
12
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,112 @@
1
- # Temporary Holding Version
1
+ # @dax-ui/nextjs
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ dax-ui setup for **Next.js App Router** (Next 13 to 16). Next.js apps use this package's
4
+ `UIProvider` instead of the one in `@dax-ui/theme`. On top of the theme, it:
5
+
6
+ - collects component styles into `<head>` during server rendering, instead of a separate
7
+ `<style>` tag beside every component;
8
+ - applies the saved light/dark mode before the page paints, so it never flashes the
9
+ wrong mode.
10
+
11
+ Everything MUI/Emotion needs for this is included; the app only needs Next.js and React.
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pnpm add @dax-ui/nextjs
17
+ ```
18
+
19
+ Then add the components you use, e.g. `pnpm add @dax-ui/button @dax-ui/text-field`.
20
+
21
+ ## Usage
22
+
23
+ Render `UIProvider` once, directly inside `<body>` of the root layout:
24
+
25
+ ```tsx
26
+ // app/layout.tsx
27
+ import { UIProvider } from '@dax-ui/nextjs';
28
+
29
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
30
+ return (
31
+ <html lang="en" suppressHydrationWarning>
32
+ <body>
33
+ <UIProvider>{children}</UIProvider>
34
+ </body>
35
+ </html>
36
+ );
37
+ }
38
+ ```
39
+
40
+ `suppressHydrationWarning` on `<html>` is required: the color-mode script sets a class on
41
+ it before React loads.
42
+
43
+ Components work in server and client components alike:
44
+
45
+ ```tsx
46
+ // app/page.tsx (a server component)
47
+ import { Button } from '@dax-ui/button';
48
+
49
+ export default function Page() {
50
+ return <Button>Get started</Button>;
51
+ }
52
+ ```
53
+
54
+ ### Custom theme
55
+
56
+ A theme object can't be passed from a server component (it contains functions), so build
57
+ it in a small client file:
58
+
59
+ ```tsx
60
+ // app/providers.tsx
61
+ 'use client';
62
+ import { UIProvider, createAppTheme } from '@dax-ui/nextjs';
63
+
64
+ const appTheme = createAppTheme({ shape: { borderRadius: 12 } });
65
+
66
+ export function Providers({ children }: { children: React.ReactNode }) {
67
+ return <UIProvider theme={appTheme}>{children}</UIProvider>;
68
+ }
69
+ ```
70
+
71
+ and render `<Providers>` in `app/layout.tsx` instead of `<UIProvider>`.
72
+
73
+ ### With Tailwind CSS or plain CSS
74
+
75
+ Set `enableCssLayer` so the app's own styles override MUI's without `!important`:
76
+
77
+ ```tsx
78
+ <UIProvider enableCssLayer>{children}</UIProvider>
79
+ ```
80
+
81
+ ### Light/dark toggle (in a client component)
82
+
83
+ ```tsx
84
+ 'use client';
85
+ import { useColorScheme } from '@dax-ui/nextjs';
86
+
87
+ export function ModeToggle() {
88
+ const { mode, setMode } = useColorScheme();
89
+ return <button onClick={() => setMode(mode === 'dark' ? 'light' : 'dark')}>Toggle mode</button>;
90
+ }
91
+ ```
92
+
93
+ ## Exports
94
+
95
+ | Export | What it is |
96
+ | --- | --- |
97
+ | `UIProvider` | The Next.js App Router provider; props below |
98
+ | `useColorScheme`, `createAppTheme`, `styled`, `useTheme`, `theme`, `themeOptions`, `Theme`, `ThemeOptions` | Re-exported from [`@dax-ui/theme`](https://www.npmjs.com/package/@dax-ui/theme), so Next.js apps don't need to install it separately |
99
+
100
+ Pages Router isn't supported yet.
101
+
102
+ ## Props
103
+
104
+ <!-- props:start UIProvider -->
105
+ | Prop | Type | Default | Description |
106
+ | --- | --- | --- | --- |
107
+ | `children` *(required)* | `ReactNode` | | The app. Every @dax-ui component must render inside the provider. |
108
+ | `defaultMode` | `"light" \| "dark" \| "system"` | `system` | Color mode on first visit. `system` follows the OS setting. After that, the user's choice made through `useColorScheme().setMode()` is remembered. |
109
+ | `disableCssBaseline` | `boolean` | `false` | Skips MUI's CSS reset (`CssBaseline`), for apps that already ship their own. |
110
+ | `enableCssLayer` | `boolean` | `false` | Wraps MUI's generated styles in `@layer mui`, so the app's own CSS or Tailwind utilities override them without `!important`. |
111
+ | `theme` | `Theme` | `theme` | Replaces the default theme, e.g. `createAppTheme({ ...overrides })`. |
112
+ <!-- props:end -->
package/lib/index.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import * as react from 'react';
2
+ import { UIProviderProps as UIProviderProps$1 } from '@dax-ui/theme';
3
+ export { Theme, ThemeOptions, createAppTheme, styled, theme, themeOptions, useColorScheme, useTheme } from '@dax-ui/theme';
4
+
5
+ interface UIProviderProps extends UIProviderProps$1 {
6
+ /**
7
+ * Wraps MUI's generated styles in `@layer mui`, so the app's own CSS or Tailwind
8
+ * utilities override them without `!important`.
9
+ * @default false
10
+ */
11
+ enableCssLayer?: boolean;
12
+ }
13
+ /**
14
+ * `UIProvider` for Next.js App Router. Render it once in `app/layout.tsx`, directly
15
+ * inside `<body>`. On top of `@dax-ui/theme`'s `UIProvider`, it collects component styles
16
+ * into `<head>` during server rendering (instead of a `<style>` tag beside every
17
+ * component), and applies the saved color mode before the page paints.
18
+ */
19
+ declare function UIProvider({ enableCssLayer, defaultMode, ...rest }: UIProviderProps): react.JSX.Element;
20
+
21
+ export { UIProvider, type UIProviderProps };
package/lib/index.js ADDED
@@ -0,0 +1,28 @@
1
+ "use client";
2
+
3
+ // src/UIProvider.tsx
4
+ import { AppRouterCacheProvider } from "@mui/material-nextjs/v16-appRouter";
5
+ import {
6
+ ColorSchemeScript,
7
+ UIProvider as BaseUIProvider
8
+ } from "@dax-ui/theme";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ function UIProvider({ enableCssLayer = false, defaultMode = "system", ...rest }) {
11
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
12
+ /* @__PURE__ */ jsx(ColorSchemeScript, { defaultMode }),
13
+ /* @__PURE__ */ jsx(AppRouterCacheProvider, { options: { enableCssLayer }, children: /* @__PURE__ */ jsx(BaseUIProvider, { defaultMode, ...rest }) })
14
+ ] });
15
+ }
16
+
17
+ // src/index.ts
18
+ import { createAppTheme, styled, theme, themeOptions, useColorScheme, useTheme } from "@dax-ui/theme";
19
+ export {
20
+ UIProvider,
21
+ createAppTheme,
22
+ styled,
23
+ theme,
24
+ themeOptions,
25
+ useColorScheme,
26
+ useTheme
27
+ };
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/UIProvider.tsx","../src/index.ts"],"sourcesContent":["// The v14-v16 entry points of @mui/material-nextjs all re-export the v13 one, so\n// this single import supports every Next.js version in our peer range (13-16).\nimport { AppRouterCacheProvider } from '@mui/material-nextjs/v16-appRouter';\nimport {\n ColorSchemeScript,\n UIProvider as BaseUIProvider,\n type UIProviderProps as BaseUIProviderProps,\n} from '@dax-ui/theme';\n\nexport interface UIProviderProps extends BaseUIProviderProps {\n /**\n * Wraps MUI's generated styles in `@layer mui`, so the app's own CSS or Tailwind\n * utilities override them without `!important`.\n * @default false\n */\n enableCssLayer?: boolean;\n}\n\n/**\n * `UIProvider` for Next.js App Router. Render it once in `app/layout.tsx`, directly\n * inside `<body>`. On top of `@dax-ui/theme`'s `UIProvider`, it collects component styles\n * into `<head>` during server rendering (instead of a `<style>` tag beside every\n * component), and applies the saved color mode before the page paints.\n */\nexport function UIProvider({ enableCssLayer = false, defaultMode = 'system', ...rest }: UIProviderProps) {\n return (\n <>\n <ColorSchemeScript defaultMode={defaultMode} />\n <AppRouterCacheProvider options={{ enableCssLayer }}>\n <BaseUIProvider defaultMode={defaultMode} {...rest} />\n </AppRouterCacheProvider>\n </>\n );\n}\n","export { UIProvider } from './UIProvider';\nexport type { UIProviderProps } from './UIProvider';\n// The rest of @dax-ui/theme, so Next.js apps need only this package plus components.\nexport { createAppTheme, styled, theme, themeOptions, useColorScheme, useTheme } from '@dax-ui/theme';\nexport type { Theme, ThemeOptions } from '@dax-ui/theme';\n"],"mappings":";;;AAEA,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA,cAAc;AAAA,OAET;AAmBH,mBACE,KADF;AAFG,SAAS,WAAW,EAAE,iBAAiB,OAAO,cAAc,UAAU,GAAG,KAAK,GAAoB;AACvG,SACE,iCACE;AAAA,wBAAC,qBAAkB,aAA0B;AAAA,IAC7C,oBAAC,0BAAuB,SAAS,EAAE,eAAe,GAChD,8BAAC,kBAAe,aAA2B,GAAG,MAAM,GACtD;AAAA,KACF;AAEJ;;;AC9BA,SAAS,gBAAgB,QAAQ,OAAO,cAAc,gBAAgB,gBAAgB;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,62 @@
1
1
  {
2
2
  "name": "@dax-ui/nextjs",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "dax-ui setup for Next.js App Router: UIProvider with server-rendered styles",
5
+ "keywords": [
6
+ "dax-ui",
7
+ "react",
8
+ "design-system",
9
+ "nextjs",
10
+ "app-router",
11
+ "mui",
12
+ "ssr"
13
+ ],
14
+ "author": "Digital Auxilius",
15
+ "homepage": "https://github.com/FaaizHussain26/DAX-UI/tree/main/packages/nextjs#readme",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/FaaizHussain26/DAX-UI.git",
19
+ "directory": "packages/nextjs"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/FaaizHussain26/DAX-UI/issues"
23
+ },
24
+ "license": "UNLICENSED",
25
+ "type": "module",
26
+ "sideEffects": false,
27
+ "main": "lib/index.js",
28
+ "types": "lib/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./lib/index.d.ts",
32
+ "default": "./lib/index.js"
33
+ },
34
+ "./package.json": "./package.json"
35
+ },
36
+ "files": [
37
+ "lib",
38
+ "CHANGELOG.md"
39
+ ],
40
+ "dependencies": {
41
+ "@emotion/cache": "^11.14.0",
42
+ "@emotion/react": "^11.14.0",
43
+ "@emotion/server": "^11.11.0",
44
+ "@mui/material-nextjs": "^9.5.0",
45
+ "@dax-ui/theme": "^0.1.0"
46
+ },
47
+ "peerDependencies": {
48
+ "next": "^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
49
+ "react": "^18.0.0 || ^19.0.0",
50
+ "react-dom": "^18.0.0 || ^19.0.0"
51
+ },
52
+ "devDependencies": {
53
+ "next": "^16.4.3",
54
+ "@dax-ui/builder": "^0.0.0"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "scripts": {
60
+ "build": "builder"
61
+ }
6
62
  }