@hashicorp/mds-next 0.9.5 → 0.9.6

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/dist/LICENSE ADDED
@@ -0,0 +1,336 @@
1
+ Mozilla Public License Version 2.0
2
+ ==================================
3
+
4
+ 1. Definitions
5
+ --------------
6
+
7
+ 1.1. “Contributor”
8
+ means each individual or legal entity that creates, contributes to the
9
+ creation of, or owns Covered Software.
10
+
11
+ 1.2. “Contributor Version”
12
+ means the combination of the Contributions of others (if any) used by a
13
+ Contributor and that particular Contributor’s Contribution.
14
+
15
+ 1.3. “Contribution”
16
+ means Covered Software of a particular Contributor.
17
+
18
+ 1.4. “Covered Software”
19
+ means Source Code Form to which the initial Contributor has attached the
20
+ notice in Exhibit A, the Executable Form of such Source Code Form, and
21
+ Modifications of such Source Code Form, in each case including portions
22
+ thereof.
23
+
24
+ 1.5. “Incompatible With Secondary Licenses”
25
+ means
26
+ (a) that the initial Contributor has attached the notice described in
27
+ Exhibit B to the Covered Software; or
28
+ (b) that the Covered Software was made available under the terms of
29
+ version 1.1 or earlier of the License, but not also under the terms of
30
+ a Secondary License.
31
+
32
+ 1.6. “Executable Form”
33
+ means any form of the work other than Source Code Form.
34
+
35
+ 1.7. “Larger Work”
36
+ means a work that combines Covered Software with other material, in a
37
+ separate file or files, that is not Covered Software.
38
+
39
+ 1.8. “License”
40
+ means this document.
41
+
42
+ 1.9. “Licensable”
43
+ means having the right to grant, to the maximum extent possible, whether
44
+ at the time of the initial grant or subsequently, any and all of the
45
+ rights conveyed by this License.
46
+
47
+ 1.10. “Modifications”
48
+ means any of the following:
49
+ (a) any file in Source Code Form that results from an addition to,
50
+ deletion from, or modification of the contents of Covered Software; or
51
+ (b) any new file in Source Code Form that contains any Covered Software.
52
+
53
+ 1.11. “Patent Claims” of a Contributor
54
+ means any patent claim(s), including without limitation, method,
55
+ process, and apparatus claims, in any patent Licensable by such
56
+ Contributor that would be infringed, but for the grant of the License,
57
+ by the making, using, selling, offering for sale, having made, import,
58
+ or transfer of either its Contributions or its Contributor Version.
59
+
60
+ 1.12. “Secondary License”
61
+ means either the GNU General Public License, Version 2.0, the GNU Lesser
62
+ General Public License, Version 2.1, the GNU Affero General Public
63
+ License, Version 3.0, or any later versions of those licenses.
64
+
65
+ 1.13. “Source Code Form”
66
+ means the form of the work preferred for making modifications.
67
+
68
+ 1.14. “You” (or “Your”)
69
+ means an individual or a legal entity exercising rights under this
70
+ License. For legal entities, “You” includes any entity that controls, is
71
+ controlled by, or is under common control with You. For purposes of this
72
+ definition, “control” means (a) the power, direct or indirect, to cause
73
+ the direction or management of such entity, whether by contract or
74
+ otherwise, or (b) ownership of more than fifty percent (50%) of the
75
+ outstanding shares or beneficial ownership of such entity.
76
+
77
+ 2. License Grants and Conditions
78
+ --------------------------------
79
+
80
+ 2.1. Grants
81
+ Each Contributor hereby grants You a world-wide, royalty-free,
82
+ non-exclusive license:
83
+
84
+ (a) under intellectual property rights (other than patent or trademark)
85
+ Licensable by such Contributor to use, reproduce, make available,
86
+ modify, display, perform, distribute, and otherwise exploit its
87
+ Contributions, either on an unmodified basis, with Modifications, or
88
+ as part of a Larger Work; and
89
+
90
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
91
+ for sale, have made, import, and otherwise transfer either its
92
+ Contributions or its Contributor Version.
93
+
94
+ 2.2. Effective Date
95
+ The licenses granted in Section 2.1 with respect to any Contribution
96
+ become effective for each Contribution on the date the Contributor first
97
+ distributes such Contribution.
98
+
99
+ 2.3. Limitations on Grant Scope
100
+ The licenses granted in this Section 2 are the only rights granted under
101
+ this License. No additional rights or licenses will be implied from the
102
+ distribution or licensing of Covered Software under this License.
103
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
104
+ Contributor:
105
+
106
+ (a) for any code that a Contributor has removed from Covered Software; or
107
+
108
+ (b) for infringements caused by: (i) Your and any other third party’s
109
+ modifications of Covered Software, or (ii) the combination of its
110
+ Contributions with other software (except as part of its Contributor
111
+ Version); or
112
+
113
+ (c) under Patent Claims infringed by Covered Software in the absence of
114
+ its Contributions.
115
+
116
+ This License does not grant any rights in the trademarks, service marks,
117
+ or logos of any Contributor (except as may be necessary to comply with
118
+ the notice requirements in Section 3.4).
119
+
120
+ 2.4. Subsequent Licenses
121
+ No Contributor makes additional grants as a result of Your choice to
122
+ distribute the Covered Software under a subsequent version of this
123
+ License (see Section 10.2) or under the terms of a Secondary License (if
124
+ permitted under the terms of Section 3.3).
125
+
126
+ 2.5. Representation
127
+ Each Contributor represents that the Contributor believes its
128
+ Contributions are its original creation(s) or it has sufficient rights to
129
+ grant the rights to its Contributions conveyed by this License.
130
+
131
+ 2.6. Fair Use
132
+ This License is not intended to limit any rights You have under
133
+ applicable copyright doctrines of fair use, fair dealing, or other
134
+ equivalents.
135
+
136
+ 2.7. Conditions
137
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
138
+ in Section 2.1.
139
+
140
+ 3. Responsibilities
141
+ -------------------
142
+
143
+ 3.1. Distribution of Source Form
144
+ All distribution of Covered Software in Source Code Form, including any
145
+ Modifications that You create or to which You contribute, must be under
146
+ the terms of this License. You must inform recipients that the Source
147
+ Code Form of the Covered Software is governed by the terms of this
148
+ License, and how they can obtain a copy of this License. You may not
149
+ attempt to alter or restrict the recipients’ rights in the Source Code
150
+ Form.
151
+
152
+ 3.2. Distribution of Executable Form
153
+ If You distribute Covered Software in Executable Form then:
154
+
155
+ (a) such Covered Software must also be made available in Source Code
156
+ Form, as described in Section 3.1, and You must inform recipients of
157
+ the Executable Form how they can obtain a copy of such Source Code
158
+ Form by reasonable means in a timely manner, at a charge no more
159
+ than the cost of distribution to the recipient; and
160
+
161
+ (b) You may distribute such Executable Form under the terms of this
162
+ License, or sublicense it under different terms, provided that the
163
+ license for the Executable Form does not attempt to limit or alter
164
+ the recipients’ rights in the Source Code Form under this License.
165
+
166
+ 3.3. Distribution of a Larger Work
167
+ You may create and distribute a Larger Work under terms of Your choice,
168
+ provided that You also comply with the requirements of this License for
169
+ the Covered Software. If the Larger Work is a combination of Covered
170
+ Software with a work governed by one or more Secondary Licenses, and the
171
+ Covered Software is not Incompatible With Secondary Licenses, this
172
+ License permits You to additionally distribute such Covered Software
173
+ under the terms of such Secondary License(s), so that the recipient of
174
+ the Larger Work may, at their option, further distribute the Covered
175
+ Software under the terms of either this License or such Secondary
176
+ License(s).
177
+
178
+ 3.4. Notices
179
+ You may not remove or alter the substance of any license notices
180
+ (including copyright notices, patent notices, disclaimers of warranty, or
181
+ limitations of liability) contained within the Source Code Form of the
182
+ Covered Software, except that You may alter any license notices to the
183
+ extent required to remedy known factual inaccuracies.
184
+
185
+ 3.5. Application of Additional Terms
186
+ You may choose to offer, and to charge a fee for, warranty, support,
187
+ indemnity or liability obligations to one or more recipients of Covered
188
+ Software. However, you may do so only on Your own behalf, and not on
189
+ behalf of any Contributor. You must make it absolutely clear that any
190
+ such warranty, support, indemnity, or liability obligation is offered by
191
+ You alone, and You hereby agree to indemnify every Contributor for any
192
+ liability incurred by such Contributor as a result of warranty, support,
193
+ indemnity or liability terms You offer. You may include additional
194
+ disclaimers of warranty and limitations of liability specific to any
195
+ jurisdiction.
196
+
197
+ 4. Inability to Comply Due to Statute or Regulation
198
+ ---------------------------------------------------
199
+
200
+ If it is impossible for You to comply with any of the terms of this
201
+ License with respect to some or all of the Covered Software due to
202
+ statute, judicial order, or regulation then You must: (a) comply with
203
+ the terms of this License to the maximum extent possible; and (b)
204
+ describe the limitations and the code they affect. Such description must
205
+ be placed in a text file included with all distributions of the Covered
206
+ Software under this License. Except to the extent prohibited by statute
207
+ or regulation, such description must be sufficiently detailed for a
208
+ recipient of ordinary skill to be able to understand it.
209
+
210
+ 5. Termination
211
+ --------------
212
+
213
+ 5.1. The rights granted under this License will terminate automatically
214
+ if You fail to comply with any of its terms. However, if You become
215
+ compliant, then the rights granted under this License from a particular
216
+ Contributor are reinstated (a) provisionally, unless and until such
217
+ Contributor explicitly and finally terminates Your grants, and (b) on an
218
+ ongoing basis, if such Contributor fails to notify You of the
219
+ non-compliance by some reasonable means prior to 60 days after You have
220
+ come back into compliance. Moreover, Your grants from a particular
221
+ Contributor are reinstated on an ongoing basis if such Contributor
222
+ notifies You of the non-compliance by some reasonable means, this is the
223
+ first time You have received notice of non-compliance with this License
224
+ from such Contributor, and You become compliant prior to 30 days after
225
+ Your receipt of the notice.
226
+
227
+ 5.2. If You initiate litigation against any entity by asserting a patent
228
+ infringement claim (excluding declaratory judgment actions,
229
+ counter-claims, and cross-claims) alleging that a Contributor Version
230
+ directly or indirectly infringes any patent, then the rights granted to
231
+ You by this License from such Contributor shall terminate as of the date
232
+ such litigation is filed.
233
+
234
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
235
+ end user license agreements (excluding distributors and resellers) which
236
+ have been validly granted by You or Your distributors under this License
237
+ prior to termination shall survive termination.
238
+
239
+ 6. Disclaimer of Warranty
240
+ -------------------------
241
+
242
+ Covered Software is provided under this License on an “as is” basis,
243
+ without warranty of any kind, either expressed, implied, or statutory,
244
+ including, without limitation, warranties that the Covered Software is
245
+ free of defects, merchantable, fit for a particular purpose or non-
246
+ infringing. The entire risk as to the quality and performance of the
247
+ Covered Software is with You. Should any Covered Software prove
248
+ defective in any respect, You (not any Contributor) assume the cost of
249
+ any necessary servicing, repair, or correction. This disclaimer of
250
+ warranty constitutes an essential part of this License. No use of any
251
+ Covered Software is authorized under this License except under this
252
+ disclaimer.
253
+
254
+ 7. Limitation of Liability
255
+ --------------------------
256
+
257
+ Under no circumstances and under no legal theory, whether tort
258
+ (including negligence), contract, or otherwise, shall any Contributor,
259
+ or anyone who distributes Covered Software as permitted above, be liable
260
+ to You for any direct, indirect, special, incidental, or consequential
261
+ damages of any character including, without limitation, damages for lost
262
+ profits, loss of goodwill, work stoppage, computer failure or
263
+ malfunction, or any and all other commercial damages or losses, even if
264
+ such party shall have been informed of the possibility of such damages.
265
+ This limitation of liability shall not apply to liability for death or
266
+ personal injury resulting from such party’s negligence to the extent
267
+ applicable law prohibits such limitation. Some jurisdictions do not
268
+ allow the exclusion or limitation of incidental or consequential
269
+ damages, so this exclusion and limitation may not apply to You.
270
+
271
+ 8. Litigation
272
+ -------------
273
+
274
+ Any litigation relating to this License may be brought only in the
275
+ courts of a jurisdiction where the defendant maintains its principal
276
+ place of business and such litigation shall be governed by laws of that
277
+ jurisdiction, without reference to its conflict-of-law provisions.
278
+ Nothing in this Section shall prevent a party’s ability to bring
279
+ cross-claims or counter-claims.
280
+
281
+ 9. Miscellaneous
282
+ ----------------
283
+
284
+ This License represents the complete agreement concerning the subject
285
+ matter hereof. If any provision of this License is held to be
286
+ unenforceable, such provision shall be reformed only to the extent
287
+ necessary to make it enforceable. Any law or regulation which provides
288
+ that the language of a contract shall be construed against the drafter
289
+ shall not be used to construe this License against a Contributor.
290
+
291
+ 10. Versions of the License
292
+ ---------------------------
293
+
294
+ 10.1. New Versions
295
+ Mozilla Foundation is the license steward. Except as provided in Section
296
+ 10.3, no one other than the license steward has the right to modify or
297
+ publish new versions of this License. Each version will be given a
298
+ distinguishing version number.
299
+
300
+ 10.2. Effect of New Versions
301
+ You may distribute the Covered Software under the terms of the version of
302
+ the License under which You originally received the Covered Software, or
303
+ under the terms of any subsequent version published by the license steward.
304
+
305
+ 10.3. Modified Versions
306
+ If you create software not governed by this License, and you want to create
307
+ a new license for such software, you may create and use a modified version
308
+ of this License if you rename the license and remove any references to the
309
+ name of the license steward (except to note that such modified license
310
+ differs from this License).
311
+
312
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
313
+ Licenses
314
+ If You choose to distribute Source Code Form that is Incompatible With
315
+ Secondary Licenses under the terms of this version of the License, the
316
+ notice described in Exhibit B of this License must be attached.
317
+
318
+ Exhibit A - Source Code Form License Notice
319
+ -------------------------------------------
320
+
321
+ This Source Code Form is subject to the terms of the Mozilla Public
322
+ License, v. 2.0. If a copy of the MPL was not distributed with this
323
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
324
+
325
+ If it is not possible or desirable to put the notice in a particular file,
326
+ then You may include the notice in a location (such as a LICENSE file in a
327
+ relevant directory) where a recipient would be likely to look for such a
328
+ notice.
329
+
330
+ You may add additional accurate notices of copyright ownership.
331
+
332
+ Exhibit B - “Incompatible With Secondary Licenses” Notice
333
+ ---------------------------------------------------------
334
+
335
+ This Source Code Form is “Incompatible With Secondary Licenses”, as
336
+ defined by the Mozilla Public License, v. 2.0.
package/dist/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # `@hashicorp/mds-next`
2
+
3
+ Next.js adapter for the Materia Design System (MDS).
4
+ This package provides **typed adapters** for `next/link` & `next/image` and **Next Font** helpers for HashiCorp’s fonts, making it easy to wire MDS into a Next.js (App Router or Pages) application.
5
+
6
+ ---
7
+
8
+ ## Features
9
+
10
+ - 🔤 **Fonts**: HashiCorp Sans (variable) + DejaVu Sans Mono via `next/font/local`
11
+ - 🔗 **Adapters**: `NextLinkAdapter` and `NextImageAdapter` with MDS prop types
12
+ - ⚙️ **Next.js** support (Next 14+, React 18)
13
+ - 🧩 Plays nicely with `@hashicorp/mds-react` and `@hashicorp/mds-tokens`
14
+
15
+ ---
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install @hashicorp/mds-next @hashicorp/mds-react @hashicorp/mds-tokens
21
+ ```
22
+
23
+ **Peer requirements**
24
+ - `next >= 14`
25
+ - `react ^18.2.0`
26
+ - `react-dom ^18.2.0`
27
+ - `@hashicorp/mds-react` and `@hashicorp/mds-tokens`
28
+
29
+ ---
30
+
31
+ ## Quickstart
32
+
33
+ ### 1) Fonts in the App Router
34
+
35
+ Add the MDS font variables to your root layout so the CSS variables are available everywhere.
36
+
37
+ ```tsx
38
+ // app/layout.tsx
39
+ import { mdsFontVariables } from "@hashicorp/mds-next/fonts"
40
+
41
+ export default function RootLayout({ children }: React.PropsWithChildren) {
42
+ return (
43
+ <html>
44
+ <body className={mdsFontVariables}>{children}</body>
45
+ </html>
46
+ )
47
+ }
48
+ ```
49
+
50
+ What you get:
51
+
52
+ - `hashicorpSans.variable` → `--hashicorp-sans`
53
+ - `dejavuSansMono.variable` → `--dejavu-sans-mono`
54
+ - `mdsFontVariables` → convenience string: `"--hashicorp-sans --dejavu-sans-mono"`
55
+
56
+ You can also import them individually:
57
+
58
+ ```tsx
59
+ import { hashicorpSans, dejavuSansMono } from "@hashicorp/mds-next/fonts"
60
+
61
+ export const fontVars = `${hashicorpSans.variable} ${dejavuSansMono.variable}`
62
+ ```
63
+
64
+ ### 2) Use the Next adapters (client components)
65
+
66
+ ```tsx
67
+ "use client"
68
+
69
+ import { MDSProvider } from '@hashicorp/mds-react/utils'
70
+ import { NextImageAdapter, NextLinkAdapter } from '@hashicorp/mds-next/adapters'
71
+
72
+ export default function Layout({ children }: { children: React.ReactNode }) {
73
+ return (
74
+ <MDSProvider
75
+ imageComponent={NextImageAdapter}
76
+ linkComponent={NextLinkAdapter}
77
+ >
78
+ {children}
79
+ </MDSProvider>
80
+ )
81
+ }
82
+ ```
83
+
84
+ - `MDSProvider` allows any MDS component that calls `useMDSImage` or `useMDSLink` to render through the Next adapters (allowing them make use of priority, placeholder, router behaviors, etc.).
85
+ - `NextLinkAdapter` wraps `next/link` and is typed with `MDSLinkProps` from `@hashicorp/mds-react`.
86
+ - `NextImageAdapter` wraps `next/image` and is typed with `MDSImageProps` from `@hashicorp/mds-react`.
87
+
88
+ > **Note:** These adapters are marked `"use client"`. Import them only in Client Components (or a client boundary) just like you would with `next/link`/`next/image`.
89
+
90
+ ---
91
+
92
+ ## API
93
+
94
+ ### Fonts (`@hashicorp/mds-next/fonts`)
95
+ - `hashicorpSans` – HashiCorp Sans variable (via `next/font/local`)
96
+ - `dejavuSansMono` – DejaVu Sans Mono (via `next/font/local`)
97
+ - `mdsFontVariables` – `"${hashicorpSans.variable} ${dejavuSansMono.variable}"`
98
+
99
+ These set CSS variables:
100
+ - `--hashicorp-sans`
101
+ - `--dejavu-sans-mono`
102
+
103
+ Use them in your own CSS or rely on MDS components that consume these variables.
104
+
105
+ ### Adapters
106
+ - `NextLinkAdapter` (from `@hashicorp/mds-next/adapters/link`)
107
+ - `NextImageAdapter` (from `@hashicorp/mds-next/adapters/image`)
108
+
109
+ Both are thin, typed wrappers over Next primitives and are intended to align with `@hashicorp/mds-react` prop shapes.
110
+
111
+ ---
112
+
113
+ ## Contributing (monorepo)
114
+
115
+ Inside the monorepo:
116
+
117
+ ```bash
118
+ # from packages/mds-next
119
+ npm install
120
+ npm run dev # watch build (JS + assets)
121
+ npm run build # one-off build
122
+ npm run typecheck
123
+ ```
124
+
125
+ This package publishes only the built `dist/` plus bundled fonts.
126
+ Consumers do **not** need to copy fonts manually.
127
+
128
+ ---
129
+
130
+ ## License
131
+
132
+ Copyright (c) HashiCorp, Inc.
133
+ SPDX-License-Identifier: MPL-2.0
134
+
135
+ See the [LICENSE](./LICENSE) file for details.
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@hashicorp/mds-next",
3
+ "version": "0.9.6",
4
+ "description": "Next.js adapter for MDS tokens (fonts, etc).",
5
+ "author": "HashiCorp",
6
+ "license": "MPL-2.0",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/hashicorp/web.git",
10
+ "directory": "packages/mds-next"
11
+ },
12
+ "homepage": "https://github.com/hashicorp/web/tree/main/packages/mds-next#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/hashicorp/web/issues"
15
+ },
16
+ "main": "./index.js",
17
+ "types": "./index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./index.d.ts",
21
+ "import": "./index.js",
22
+ "require": "./index.js",
23
+ "default": "./index.js"
24
+ },
25
+ "./adapters": {
26
+ "types": "./adapters/index.d.ts",
27
+ "import": "./adapters/index.js",
28
+ "require": "./adapters/index.js",
29
+ "default": "./adapters/index.js"
30
+ },
31
+ "./fonts": {
32
+ "types": "./fonts/index.d.ts",
33
+ "import": "./fonts/index.js",
34
+ "require": "./fonts/index.js",
35
+ "default": "./fonts/index.js"
36
+ },
37
+ "./package.json": "./package.json",
38
+ "./*": null
39
+ },
40
+ "typesVersions": {
41
+ "*": {
42
+ "adapters": [
43
+ "adapters/index.d.ts"
44
+ ],
45
+ "fonts": [
46
+ "fonts/index.d.ts"
47
+ ],
48
+ "*": [
49
+ "*"
50
+ ]
51
+ }
52
+ },
53
+ "publishConfig": {
54
+ "access": "public"
55
+ },
56
+ "peerDependencies": {
57
+ "next": ">=14",
58
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0",
59
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0",
60
+ "@hashicorp/mds-react": "^0.9.14",
61
+ "@hashicorp/mds-tokens": "^0.9.7"
62
+ },
63
+ "peerDependenciesMeta": {
64
+ "@hashicorp/mds-react": {
65
+ "optional": false
66
+ },
67
+ "@hashicorp/mds-tokens": {
68
+ "optional": false
69
+ }
70
+ }
71
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashicorp/mds-next",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Next.js adapter for MDS tokens (fonts, etc).",
5
5
  "author": "HashiCorp",
6
6
  "license": "MPL-2.0",
@@ -79,9 +79,8 @@
79
79
  "dev:js": "tsc -p tsconfig.build.json -w",
80
80
  "dev:assets": "cpx \"../mds-tokens/src/font/**/*.{woff2,woff,ttf,otf}\" dist/font -w",
81
81
  "dev": "npm-run-all -p dev:js dev:assets",
82
- "prepack": "npm run build",
83
82
  "typecheck": "tsc --noEmit",
84
- "prepublishOnly": "npm run build && node src/scripts/make-publish-manifest.js",
83
+ "prepack": "npm run build && node src/scripts/make-publish-manifest.js",
85
84
  "publish": "npm publish --access public ./dist"
86
85
  }
87
86
  }