@nswds/app 1.126.16 → 2.0.1

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 CHANGED
@@ -1 +1,88 @@
1
1
  # NSW Application Design System
2
+
3
+ Components, patterns and design tokens for building accessible NSW Government applications with Next.js.
4
+
5
+ Documentation: https://app.designsystem.nsw.gov.au
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @nswds/app
11
+ ```
12
+
13
+ ### Peer dependencies
14
+
15
+ `@nswds/app` does not bundle React or Next.js — it expects your application to
16
+ provide them, so that only one copy of React is ever loaded:
17
+
18
+ | Package | Required version |
19
+ | ------------- | ---------------- |
20
+ | `react` | `^19.2.6` |
21
+ | `react-dom` | `^19.2.6` |
22
+ | `next` | `^16.2.6` |
23
+ | `next-themes` | `^0.4.6` |
24
+
25
+ npm 7 and later install missing peer dependencies automatically. If your project
26
+ is on an older version of React or Next.js, `npm install` will report an
27
+ `ERESOLVE` conflict — upgrade rather than using `--legacy-peer-deps`, since two
28
+ copies of React break hooks at runtime.
29
+
30
+ Everything else the components need is a regular dependency and is installed for
31
+ you.
32
+
33
+ ## Usage
34
+
35
+ Import the stylesheet once, in your root layout. It ships pre-compiled, so you do
36
+ not need Tailwind CSS configured in your own project:
37
+
38
+ ```tsx
39
+ // app/layout.tsx
40
+ import '@nswds/app/globals.css'
41
+ ```
42
+
43
+ Components are then imported from the package root:
44
+
45
+ ```tsx
46
+ import { Button } from '@nswds/app'
47
+
48
+ export default function Page() {
49
+ return <Button>Continue</Button>
50
+ }
51
+ ```
52
+
53
+ ### Theming
54
+
55
+ Light and dark themes are keyed on a `data-theme` attribute, so `ThemeProvider`
56
+ must be configured with `attribute='data-theme'` — the `next-themes` default of
57
+ `class` will not apply the design system's dark theme:
58
+
59
+ ```tsx
60
+ 'use client'
61
+
62
+ import { ThemeProvider } from '@nswds/app'
63
+
64
+ export function Providers({ children }: { children: React.ReactNode }) {
65
+ return (
66
+ <ThemeProvider
67
+ attribute='data-theme'
68
+ defaultTheme='system'
69
+ enableSystem
70
+ disableTransitionOnChange
71
+ >
72
+ {children}
73
+ </ThemeProvider>
74
+ )
75
+ }
76
+ ```
77
+
78
+ Add `suppressHydrationWarning` to your `<html>` element, as `next-themes` sets
79
+ the attribute before React hydrates.
80
+
81
+ To read or change the theme, import `useTheme` from `next-themes` directly — it
82
+ is not re-exported here. This is why `next-themes` is a peer dependency: the
83
+ provider above and your `useTheme` call must resolve to the same copy, or the
84
+ hook reads a different React context and silently returns default values.
85
+
86
+ ```tsx
87
+ import { useTheme } from 'next-themes'
88
+ ```
package/dist/index.cjs CHANGED
@@ -14470,7 +14470,7 @@ function FormatToggle({ format, setFormat }) {
14470
14470
 
14471
14471
  // package.json
14472
14472
  var package_default = {
14473
- version: "1.126.16"};
14473
+ version: "2.0.1"};
14474
14474
  var SluggerContext = React5__namespace.default.createContext(null);
14475
14475
  function flattenText(nodes) {
14476
14476
  if (nodes == null || typeof nodes === "boolean") return "";