@nypl/design-system-react-components 3.2.0-rc → 3.2.0-rc-searchtext

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
@@ -10,8 +10,8 @@ Storybook documentation
10
10
 
11
11
  - [V3 Production - deployed to Github Pages](https://nypl.github.io/nypl-design-system/reservoir/v3/?path=/docs/welcome--docs)
12
12
  - [Development/QA - deployed to Vercel](https://nypl-design-system.vercel.app/?path=/docs/welcome--docs)
13
- - [V2 Production - deployed to Vercel](TODO)
14
- - [V1 Production - deployed to Vercel](https://nypl-design-system-git-reservoir-v173-nypl.vercel.app/)
13
+ - [V2 Production - deployed to Github Pages](https://nypl.github.io/nypl-design-system/reservoir/v2)
14
+ - [V1 Production - deployed to Github Pages](https://nypl.github.io/nypl-design-system/reservoir/v1)
15
15
 
16
16
  | Table of Contents | |
17
17
  | ----------------- | ----------------------------------------------------------------------------------- |
@@ -73,7 +73,6 @@ import {
73
73
  DSProvider,
74
74
  TemplateAppContainer,
75
75
  } from "@nypl/design-system-react-components";
76
- ...
77
76
  ```
78
77
 
79
78
  Otherwise, it can be imported in the app's main SCSS file:
@@ -83,17 +82,10 @@ Otherwise, it can be imported in the app's main SCSS file:
83
82
  @import "@nypl/design-system-react-components/dist/styles.css";
84
83
 
85
84
  body {
86
- ....
85
+ // ...
87
86
  }
88
87
  ```
89
88
 
90
- Note: Using tilde to import scss/css is no longer a best practice for apps using _recent_ versions of webpack or parcel.
91
-
92
- ```scss
93
- // No longer a best practice:
94
- @import "~@nypl/design-system-react-components/dist/styles.css";
95
- ```
96
-
97
89
  For apps using parcel, prepend the string import with `npm:` such as :
98
90
 
99
91
  ```scss
@@ -114,17 +106,17 @@ function NewComponent(props) {
114
106
  }
115
107
  ```
116
108
 
117
- Sometimes you may have conflicts, perhaps with `React-Router`. In that case, you can alias your imports:
109
+ Sometimes you may have conflicts, perhaps with Next.js' `Link` router component. In that case, you can alias your imports:
118
110
 
119
111
  ```jsx
120
- import * as DS from "@nypl/design-system-react-components";
121
- import { Link } from "react-router";
112
+ import { Link as DSLink } from "@nypl/design-system-react-components";
113
+ import { Link } from "next/link";
122
114
 
123
115
  function NewComponent(props) {
124
116
  return (
125
- <DS.Link>
126
- <Link to="/license">public domain</Link>
127
- </DS.Link>
117
+ <DSLink as={Link} type="action" href="#">
118
+ Next Page
119
+ </DSLink>
128
120
  );
129
121
  }
130
122
  ```
@@ -139,7 +131,7 @@ The list of re-exported Chakra components can be found in the main [index.ts](/s
139
131
 
140
132
  Find more information about the Design System's internal use of Chakra to create and refactor components in the Storybook documentation page. The following two links have the same information but in different formats for your reading preference:
141
133
 
142
- - [MDX format](/src/docs/Chakra.stories.mdx)
134
+ - [MDX format](/src/docs/Chakra.mdx)
143
135
  - [Storybook page](https://nypl.github.io/nypl-design-system/reservoir/v3/?path=/docs/chakra-ui--docs)
144
136
 
145
137
  Chakra was integrated into the Design System in version `0.25.0`. For those looking to update to a version greater than or equal `0.25.0`, check out our [Chakra Migration Guide](/CHAKRA_MIGRATION_GUIDE.md).
@@ -164,11 +156,11 @@ The development Storybook documentation is deployed to [Vercel](https://nypl-des
164
156
 
165
157
  **Version 2.x**
166
158
 
167
- The Storybook documentation for DS version 2.x is deployed to [Vercel](TODO). If you are using a DS version less than 3.0, this is the Storybook documentation you should be referencing. While the DS team will continue to support version 2.x, we will not be adding new features or components to this version. We highly recommend updating to version 3.x for design update and bug fixes.
159
+ The Storybook documentation for DS version 2.x is deployed to [Vercel](https://nypl.github.io/nypl-design-system/reservoir/v2). If you are using a DS version less than 3.0, this is the Storybook documentation you should be referencing. While the DS team will continue to support version 2.x, we will not be adding new features or components to this version. We highly recommend updating to version 3.x for design update and bug fixes.
168
160
 
169
161
  **Version 1.x**
170
162
 
171
- The Storybook documentation for DS version 1.x is deployed to [Vercel](https://nypl-design-system-git-reservoir-v173-nypl.vercel.app/). If you are using a DS version less than 2.0, this is the Storybook documentation you should be referencing. We highly recommend updating to version 3.x for design update and bug fixes.
163
+ The Storybook documentation for DS version 1.x is deployed to [Vercel](https://nypl.github.io/nypl-design-system/reservoir/v1). If you are using a DS version less than 2.0, this is the Storybook documentation you should be referencing. We highly recommend updating to version 3.x for design update and bug fixes.
172
164
 
173
165
  **Preview Sites**
174
166
 
@@ -176,12 +168,12 @@ Preview Storybook documentation sites are deployed to Vercel on every commit pus
176
168
 
177
169
  ### React Component Documentation
178
170
 
179
- When actively developing components or fixing bugs, make sure that the related stories are created or updated. This means updating the respective `[component-name].stories.mdx` file. For information on how to write stories, check out the [Anatomy of a Story](https://github.com/NYPL/nypl-design-system/wiki/Anatomy-of-a-Story) wiki page.
171
+ When actively developing components or fixing bugs, make sure that the related stories are created or updated. This means updating the respective `[component-name].mdx` file. For information on how to write stories, check out the [Anatomy of a Story](https://github.com/NYPL/nypl-design-system/wiki/Anatomy-of-a-Story) wiki page.
180
172
 
181
173
  For stand-alone document pages in Storybook, you need to:
182
174
 
183
- 1. create the `[page-name].stories.mdx` file in `src/docs/`
184
- 2. add the file reference to the `.storybook/main.cjs` file in the `stories` array
175
+ 1. create the `[page-name].mdx` file in `src/docs/`
176
+ 2. add the file reference to the `.storybook/main.ts` file in the `stories` array
185
177
 
186
178
  ### React Component Versions
187
179
 
@@ -221,7 +213,7 @@ We make use of:
221
213
  - `jest-axe` for running [`axe-core`](https://github.com/dequelabs/axe-core) on _every_ component's unit test file. This is part of the automated tests that run in Github Actions through the `npm test` command.
222
214
  - `@storybook/addon-a11y` for real-time accessibility testing in the browser through Storybook. _Every_ component has a tab that displays violations, passes, and incomplete checks performed by `axe-core`.
223
215
 
224
- If applicable, DS components have section(s) on accessibility in their Storybook documentation. For example, in the `Slider`'s [Storybook file](/src/components/Slider/Slider.stories.mdx), there are two "Accessibility" sections for each of the two `Slider` types, "single" and "range". This gives an explanation on additional changes we made to make the combination of elements in the `Slider` component accessible.
216
+ If applicable, DS components have section(s) on accessibility in their Storybook documentation. For example, in the `Slider`'s [Storybook file](/src/components/Slider/Slider.mdx), there are two "Accessibility" sections for each of the two `Slider` types, "single" and "range". This gives an explanation on additional changes we made to make the combination of elements in the `Slider` component accessible.
225
217
 
226
218
  ### Product Requirements
227
219
 
@@ -259,7 +251,7 @@ Follow the [contribution document](/.github/CONTRIBUTING.md) to follow git branc
259
251
 
260
252
  ### Node Version
261
253
 
262
- We recommend using Node version 18.x. The Github Actions for linting, automated testing, deploying to Github Pages, and releasing to npm are all running on Node 18.x.
254
+ The DS uses Node version 18.x and we do not support any Node versions below 18.x. The Github Actions for linting, automated testing, deploying to Github Pages, and releasing to npm are all running on Node 18.x.
263
255
 
264
256
  If you are using `nvm`, the local `.nvmrc` file (using `18.x`) can be use to set your local Node version with the `nvm use` command. Make sure your machine has Node version 18.x installed through `nvm` already.
265
257
 
@@ -268,7 +260,8 @@ If you are using `nvm`, the local `.nvmrc` file (using `18.x`) can be use to set
268
260
  There are currently two main branches for the DS:
269
261
 
270
262
  - `development` is the main and default branch for the DS. All new feature and bug fix pull requests should be made against this branch.
271
- - `release` is the branch used to deploy the static Storybook instance to Github Pages, the DS' production Storybook instance.
263
+ - `release` is the production branch used to create Github releases, tags, and npm releases.
264
+ - `gh-pages` is the branch used to deploy the static Storybook instance to Github Pages, the DS' production Storybook instance.
272
265
 
273
266
  When a new version of the DS is ready for release, the `development` branch is merged into the `release` branch through a pull request. Once merged, Github Actions will run to deploy the static Storybook as well as publish the new version to npm. Here is a [pull request](https://github.com/NYPL/nypl-design-system/pull/1532) that follows the convention outlined in [How to Run a Release](https://github.com/NYPL/nypl-design-system/wiki/How-to-Run-a-Release).
274
267
 
@@ -306,63 +299,6 @@ The release candidate version passed QA and is ready for production! What do we
306
299
  6. Push the changes to Github and create a new pull request from `development` that points to the `release` branch.
307
300
  7. Once approved and merged, a Github Action will run that will automatically deploy the static Storybook to Github Pages and publish the new version to npm.
308
301
 
309
- ## Local App Development
310
-
311
- Sometimes, you may want to test out a new feature or bug fix in a local app rather than publishing a release candidate version to npm. While this is possible, it is not always straightforward.
312
-
313
- _Please note that the following instructions depend on the node version for both the Design System and the local app. If the node versions are different, the instructions may not work. This is a limitation of npm._
314
-
315
- ### Developing with npm install
316
-
317
- To develop with a local version of the Design System:
318
-
319
- 1. In the root of the consuming application directory, run:
320
-
321
- ```sh
322
- $ npm install --no-save [../path/to/design-system]
323
- ```
324
-
325
- ### Developing with npm link
326
-
327
- To develop with a local version of the Design System:
328
-
329
- 1. In the Design System directory, run:
330
-
331
- ```sh
332
- $ npm link
333
- ```
334
-
335
- 2. Go to the consuming application directory and run:
336
-
337
- ```sh
338
- $ npm link @nypl/design-system-react-components
339
- ```
340
-
341
- 3. Go back to the Design System directory and run the following command. It allows the local Design System to be rebuilt and exported automatically:
342
-
343
- ```sh
344
- $ npm start
345
- ```
346
-
347
- #### Error Troubleshooting
348
-
349
- It's possible when running `npm link` that you'll get an `Invalid Hook` issue. If this occurs, it's most likely caused by having two versions of React when trying to run the application while the NYPL DS package is linked. This [Duplicate React](https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react) issue is covered by the React team.
350
-
351
- To be more specific, you should run the following in your local DS directory, where `[../path/to/application]` is the local directory of the consuming application.
352
-
353
- ```sh
354
- $ npm link [../path/to/application]/node_modules/react
355
- ```
356
-
357
- Now you should be able to run `npm start` in the DS directory and `npm run dev` (or whatever your application uses) in the application directory and not get an `Invalid Hook` error.
358
-
359
- #### npm Unlink
360
-
361
- To unlink the DS codebase:
362
-
363
- 1. Run `npm unlink` in the Design System directory.
364
- 2. Run `npm unlink --no-save @nypl/design-system-react-components` in the consuming application.
365
-
366
302
  ## Typescript Usage
367
303
 
368
304
  The Reservoir Design System is built with Typescript. Check out the Design System's [Typescript documentation](/TYPESCRIPT.md) for more information on why we chose to build React components in Typescript and the benefits and the gotchas we encountered.
@@ -443,9 +379,9 @@ $ npm test -- --updateSnapshot
443
379
 
444
380
  Each snapshot file also includes a link to its [Jest Snapshot documentation](https://jestjs.io/docs/snapshot-testing) which is recommended to read!
445
381
 
446
- ### Storybook Jest Addon
382
+ ### Storybook Test Addon
447
383
 
448
- Through the [`@storybook/addon-jest`](https://www.npmjs.com/package/@storybook/addon-jest) plugin, we can see a component's suite of unit tests right Storybook. In the "Addons" panel, a "Test" tab will display all the tests for the current component and whether they pass or fail.
384
+ Through the [`@storybook/test`](https://www.npmjs.com/package/@storybook/test) plugin, we can see a component's suite of unit tests right Storybook. In the "Addons" panel, a "Test" tab will display all the tests for the current component and whether they pass or fail.
449
385
 
450
386
  After writing new tests, run `npm run test:generate-output` to create a new JSON file that is used by Storybook. This JSON file contains all the test suites for all the components and Storybook picks this up and automatically combines a component with its relevant unit tests. Make sure to commit this file although new builds on Github Pages will recreate this file for the production Storybook instance.
451
387
 
@@ -457,28 +393,6 @@ You can also use the Design System styles in your project through the `unpkg` CD
457
393
  <link
458
394
  href="https://unpkg.com/@nypl/design-system-react-components/dist/styles.css"
459
395
  />
460
- <script src="https://unpkg.com/@nypl/design-system-react-components/dist/design-system-react-components.umd.cjs" />
396
+ <script src="https://unpkg.com/@nypl/design-system-react-components/dist/design-system-react-components.cjs" />
461
397
  <script src="https://unpkg.com/@nypl/design-system-react-components/dist/design-system-react-components.js" />
462
398
  ```
463
-
464
- If you need to reference a particular version you can do do by including the version number in the URL.
465
-
466
- For version < 2.1.0:
467
-
468
- ```html
469
- <link
470
- href="https://unpkg.com/@nypl/design-system-react-components@2.0.0/dist/styles.css"
471
- />
472
- <script src="https://unpkg.com/@nypl/design-system-react-components@2.0.0/dist/design-system-react-components.cjs.production.min.js" />
473
- <script src="https://unpkg.com/@nypl/design-system-react-components@2.0.0/dist/design-system-react-components.esm.js" />
474
- ```
475
-
476
- For version >= 2.1.0:
477
-
478
- ```html
479
- <link
480
- href="https://unpkg.com/@nypl/design-system-react-components@2.1.1/dist/styles.css"
481
- />
482
- <script src="https://unpkg.com/@nypl/design-system-react-components@2.1.1/dist/design-system-react-components.umd.cjs" />
483
- <script src="https://unpkg.com/@nypl/design-system-react-components@2.1.1/dist/design-system-react-components.js" />
484
- ```