@nypl/design-system-react-components 0.28.0 → 1.0.2

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.
Files changed (99) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +10 -10
  3. package/dist/components/Checkbox/Checkbox.d.ts +0 -1
  4. package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +8 -0
  5. package/dist/components/Heading/Heading.d.ts +2 -0
  6. package/dist/components/Logo/Logo.d.ts +1 -1
  7. package/dist/components/Logo/LogoSvgs.d.ts +4 -0
  8. package/dist/design-system-react-components.cjs.development.js +1021 -683
  9. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  10. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  11. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  12. package/dist/design-system-react-components.esm.js +1022 -684
  13. package/dist/design-system-react-components.esm.js.map +1 -1
  14. package/dist/theme/components/button.d.ts +1 -0
  15. package/dist/theme/components/card.d.ts +98 -13
  16. package/dist/theme/components/checkboxGroup.d.ts +1 -1
  17. package/dist/theme/components/global.d.ts +1 -1
  18. package/dist/theme/components/heading.d.ts +4 -16
  19. package/dist/theme/components/image.d.ts +6 -0
  20. package/dist/theme/components/radioGroup.d.ts +1 -1
  21. package/dist/theme/components/skipNavigation.d.ts +3 -0
  22. package/dist/theme/components/structuredContent.d.ts +0 -5
  23. package/dist/utils/utils.d.ts +15 -0
  24. package/package.json +6 -6
  25. package/src/components/Accordion/Accordion.stories.mdx +18 -46
  26. package/src/components/Accordion/Accordion.tsx +3 -2
  27. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +12 -12
  28. package/src/components/Button/Button.stories.mdx +1 -1
  29. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +33 -2
  30. package/src/components/ButtonGroup/ButtonGroup.tsx +2 -1
  31. package/src/components/Card/Card.stories.mdx +2 -4
  32. package/src/components/Card/Card.tsx +2 -1
  33. package/src/components/Chakra/Box.stories.mdx +1 -1
  34. package/src/components/Chakra/Center.stories.mdx +1 -1
  35. package/src/components/Chakra/Flex.stories.mdx +1 -1
  36. package/src/components/Chakra/Grid.stories.mdx +1 -1
  37. package/src/components/Chakra/Stack.stories.mdx +1 -1
  38. package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
  39. package/src/components/Checkbox/Checkbox.test.tsx +42 -11
  40. package/src/components/Checkbox/Checkbox.tsx +25 -39
  41. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +589 -544
  42. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +1 -1
  43. package/src/components/CheckboxGroup/CheckboxGroup.tsx +1 -1
  44. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +1540 -1420
  45. package/src/components/ComponentWrapper/ComponentWrapper.tsx +12 -3
  46. package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +5 -0
  47. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +36 -17
  48. package/src/components/Grid/SimpleGrid.stories.mdx +1 -3
  49. package/src/components/Heading/Heading.stories.mdx +4 -1
  50. package/src/components/Heading/Heading.tsx +4 -1
  51. package/src/components/Image/Image.stories.mdx +1 -1
  52. package/src/components/Logo/Logo.stories.mdx +10 -5
  53. package/src/components/Logo/Logo.tsx +4 -0
  54. package/src/components/Logo/LogoSvgs.tsx +8 -0
  55. package/src/components/Modal/Modal.stories.mdx +83 -90
  56. package/src/components/Pagination/Pagination.stories.mdx +1 -1
  57. package/src/components/Radio/Radio.stories.mdx +1 -1
  58. package/src/components/Radio/Radio.tsx +22 -31
  59. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +405 -365
  60. package/src/components/RadioGroup/RadioGroup.stories.mdx +2 -1
  61. package/src/components/RadioGroup/RadioGroup.tsx +2 -1
  62. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1236 -1116
  63. package/src/components/SearchBar/SearchBar.stories.mdx +3 -3
  64. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +32 -10
  65. package/src/components/Select/Select.stories.mdx +1 -1
  66. package/src/components/Select/Select.tsx +24 -22
  67. package/src/components/Select/__snapshots__/Select.test.tsx.snap +21 -11
  68. package/src/components/SkipNavigation/SkipNavigation.stories.mdx +2 -2
  69. package/src/components/Slider/Slider.stories.mdx +1 -1
  70. package/src/components/Slider/Slider.tsx +14 -14
  71. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +66 -33
  72. package/src/components/StyleGuide/Buttons.stories.mdx +1 -1
  73. package/src/components/StyleGuide/Colors.stories.mdx +2 -2
  74. package/src/components/StyleGuide/Forms.stories.mdx +2 -1
  75. package/src/components/StyleGuide/Iconography.stories.mdx +2 -2
  76. package/src/components/StyleGuide/Spacing.stories.mdx +1 -1
  77. package/src/components/StyleGuide/Typography.stories.mdx +1 -1
  78. package/src/components/Table/Table.stories.mdx +1 -5
  79. package/src/components/Table/Table.test.tsx +33 -0
  80. package/src/components/Table/Table.tsx +21 -0
  81. package/src/components/Template/Template.stories.mdx +9 -5
  82. package/src/components/TextInput/TextInput.stories.mdx +1 -1
  83. package/src/components/TextInput/TextInput.tsx +21 -21
  84. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +19 -9
  85. package/src/components/Toggle/Toggle.stories.mdx +1 -1
  86. package/src/components/Toggle/Toggle.tsx +22 -20
  87. package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +400 -372
  88. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +1 -0
  89. package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +5 -0
  90. package/src/docs/Chakra.stories.mdx +2 -2
  91. package/src/theme/components/button.ts +1 -0
  92. package/src/theme/components/card.ts +9 -3
  93. package/src/theme/components/componentWrapper.ts +1 -1
  94. package/src/theme/components/global.ts +1 -1
  95. package/src/theme/components/heading.ts +3 -3
  96. package/src/theme/components/image.ts +1 -0
  97. package/src/theme/components/skipNavigation.ts +3 -0
  98. package/src/theme/foundations/colors.ts +6 -9
  99. package/src/utils/utils.ts +40 -0
package/CHANGELOG.md CHANGED
@@ -8,6 +8,45 @@ Currently, this repo is in Prerelease. When it is released, this project will ad
8
8
 
9
9
  ## Prerelease
10
10
 
11
+ ## 1.0.2 (June 1, 2022)
12
+
13
+ ### Adds
14
+
15
+ - Adds `noSpace` prop to the `Heading` component.
16
+ - Adds validation for equal headers and data column to the `Table` component.
17
+ - Adds `className`, `helperTextStyles`, and `showHelperInvalidText` props to the `ComponentWrapper` component.
18
+
19
+ ### Updates
20
+
21
+ - Updates the `fontSize` and `padding` attributes in the single variant of the `Accordion` component.
22
+ - Updates all QA urls from Tugboat QA to Vercel.
23
+ - Updates the `Logo` component to include new variants for `Apple App Store`, `Clever Badge` and `Google Play`.
24
+ - Pins the Chakra UI "react" and "system" packages to a certain range since Chakra v2 uses React 18 and creates backwards compatibility issues.
25
+ - Updates buttons setup as icon only to get the same hover styles as `secondary` button in the `Button` component.
26
+ - Updates and refactors the `Checkbox`, `Radio`, `Select`, `Slider`, `TextInput` and `Toggle` components to use the `ComponentWrapper` component for similar DOM structure.
27
+ - Updates how `CheckboxGroup` and `RadioGroup` handle `Checkbox` and `Radio` components when `isFullWidth` is true and there is JSX as labels.
28
+
29
+ ### Fixes
30
+
31
+ - Fixes how `Image`s are rendered with a non-default `aspectRatio` value and with a `caption` value or a `credit` value or both.
32
+ - Fixes the extra margin added by the `SkipNavigation` component.
33
+ - Updates various component implementations in Storybook documentation pages to remove inadvertent console errors and warnings.
34
+ - Fixes sizing in the `Card` component for the "body" and "right" sections when the `isAlignedRightActions` prop is set to `true`.
35
+ - Allows `Button`s in the `ButtonGroup` to manage their own `isDisabled` state.
36
+ - Fixes how the `onChange` prop is set in `Checkbox` so it only gets called once per rendering.
37
+
38
+ ## 1.0.1 (May 31, 2022)
39
+
40
+ _NOTE_: This version number was previously released in 2019 and is marked as deprecated in npm. The next version bump from `1.0.0` is `1.0.2`.
41
+
42
+ ## 1.0.0 (May 12, 2022)
43
+
44
+ This is the first stable release of the NYPL Reservoir Design System! We've been looking forward to this moment for over two years.
45
+
46
+ ### Updates
47
+
48
+ - Updates all links throughout the documentation to point to the new production URLs.
49
+
11
50
  ## 0.28.0 (May 9, 2022)
12
51
 
13
52
  ### Adds
package/README.md CHANGED
@@ -10,8 +10,8 @@ _Note: This library is still in beta. Until we release the stable `1.0.0` versio
10
10
 
11
11
  Storybook documentation
12
12
 
13
- - [Production - deployed to Github Pages](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/introduction--page)
14
- - [Development - deployed to Tugboat QA](https://development-6y1v6na1ceqnmojvc5akrm5ewys3cshs.tugboat.qa/?path=/story/introduction--page)
13
+ - [Production - deployed to Github Pages](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/story/welcome--page)
14
+ - [Development/QA - deployed to Vercel](https://nypl-design-system.vercel.app/?path=/story/welcome--page)
15
15
 
16
16
  | Table of Contents | |
17
17
  | ----------------- | ----------------------------------------------------------------------------------- |
@@ -194,7 +194,7 @@ The list of re-exported Chakra components can be found in the main [index.ts](/s
194
194
  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:
195
195
 
196
196
  - [MDX format](/src/docs/Chakra.stories.mdx)
197
- - [Storybook page](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/chakra-ui--page)
197
+ - [Storybook page](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/story/chakra-ui--page)
198
198
 
199
199
  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).
200
200
 
@@ -216,7 +216,7 @@ You can check out a working Codepen with unpkg [here](https://codepen.io/edwingu
216
216
 
217
217
  ## Storybook
218
218
 
219
- The Reservoir Design System leverages Storybook to document all the React components and style guidelines. The Storybook documentation can be found [here](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/introduction--page). For your convenience, the Reservoir Design System components have been organized into logical categories based on both form and function. Please refer to the COMPONENTS section in the Storybook sidebar.
219
+ The Reservoir Design System leverages Storybook to document all the React components and style guidelines. The Storybook documentation can be found [here](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/story/welcome--page). For your convenience, the Reservoir Design System components have been organized into logical categories based on both form and function. Please refer to the COMPONENTS section in the Storybook sidebar.
220
220
 
221
221
  ### Documentation Instances
222
222
 
@@ -224,17 +224,17 @@ There are currently two main instances of the Reservoir Design System Storybook
224
224
 
225
225
  **Production**
226
226
 
227
- The production Storybook documentation is deployed to [Github Pages](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/introduction--page). This is the main instance we use to share the latest stable release of the Reservoir Design System. This documentation site is deployed through [Github Actions](/.github/workflows/gh-pages.yml) only on merges to the `release` branch.
227
+ The production Storybook documentation is deployed to [Github Pages](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/story/welcome--page). This is the main instance we use to share the latest stable release of the Reservoir Design System. This documentation site is deployed through [Github Actions](/.github/workflows/gh-pages.yml) only on merges to the `release` branch.
228
228
 
229
229
  As of July, 2021, the Github Pages production site gets deployed every two weeks on the same schedule as npm releases.
230
230
 
231
231
  **Development**
232
232
 
233
- The development Storybook documentation is deployed to [Tugboat QA](https://development-6y1v6na1ceqnmojvc5akrm5ewys3cshs.tugboat.qa/?path=/story/introduction--page). This development site has all the working updates that get merged to the `development` branch. This means that this site is constantly being updated as pull requests are being merged in. This site is used to see the lastest changes during a working sprint before a production release is made.
233
+ The development Storybook documentation is deployed to [Vercel](https://nypl-design-system.vercel.app/?path=/story/welcome--page). This development site has all the working updates that get merged to the `development` branch. This means that this site is constantly being updated as pull requests are being merged in. This site is used to see the lastest changes during a working sprint before a production release is made.
234
234
 
235
235
  **Preview Sites**
236
236
 
237
- Preview Storybook documentation sites are deployed to Tugboat QA for every pull request. They follow a pattern such as `pr[number]-[hash].tugboat.qa` where `[number]` is the number of the pull request it is deploying. For example, for pull request #101, Tugboat will deploy a "preview" site to `pr101-wldudndlk24kas42.tugboat.qa`. Since these "preview" sites are brought up only for pull requests, this means that the URL varies and that those instances are eventually shut off. They are not meant to be used as long-term sites but rather for reviewing working changes within the team.
237
+ Preview Storybook documentation sites are deployed to Vercel on every commit push to every branch in this repository. They follow a pattern such as `nypl-design-system-[hash]-nypl.vercel.app` where `[hash]` is a random hash created by Vercel. This means that the URL varies and that those instances are eventually shut off. They are not meant to be used as long-term sites but rather for reviewing working changes within the team.
238
238
 
239
239
  ### React Component Documentation
240
240
 
@@ -261,13 +261,13 @@ To help consuming application developers understand which version of the DS is r
261
261
 
262
262
  ### Static Build
263
263
 
264
- There should be no need to run the static Storybook instance while actively developing -- it's used exclusively for building out the `gh-pages` environment and deploying it to [Github Pages](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/introduction--page). In the event that you do run the static Storybook npm script, run:
264
+ There should be no need to run the static Storybook instance while actively developing -- it's used exclusively for building out the `gh-pages` environment and deploying it to [Github Pages](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/story/welcome--page). In the event that you do run the static Storybook npm script, run:
265
265
 
266
266
  ```sh
267
- $ npm run build-storybook
267
+ $ npm run build-storybook:v1
268
268
  ```
269
269
 
270
- You can then view `/storybook-static/index.html` in your browser. _Make sure not to commit this directory_.
270
+ You can then view `/reservoir/v1/index.html` in your browser. _Make sure not to commit this directory_.
271
271
 
272
272
  ## Typescript Usage
273
273
 
@@ -43,6 +43,5 @@ export interface CheckboxProps extends CheckboxIconProps {
43
43
  /** Populates the value of the input */
44
44
  value?: string;
45
45
  }
46
- export declare const onChangeDefault: () => void;
47
46
  export declare const Checkbox: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>, {}>;
48
47
  export default Checkbox;
@@ -3,12 +3,18 @@ import { HelperErrorTextType } from "../HelperErrorText/HelperErrorText";
3
3
  export interface ComponentWrapperProps {
4
4
  /** The UI elements that will be wrapped by this component */
5
5
  children: React.ReactNode;
6
+ /** A class name for the `div` parent element. */
7
+ className?: string;
6
8
  /** Optional string to set the text for the component's description */
7
9
  descriptionText?: string;
8
10
  /** Optional string to set the text for a `Heading` component */
9
11
  headingText?: string;
10
12
  /** Optional string to set the text for a `HelperErrorText` component */
11
13
  helperText?: HelperErrorTextType;
14
+ /** Styles that target the helper text. */
15
+ helperTextStyles?: {
16
+ [key: string]: any;
17
+ };
12
18
  /** ID that other components can cross reference for accessibility purposes */
13
19
  id?: string;
14
20
  /** Optional string to populate the `HelperErrorText` for the error state
@@ -16,6 +22,8 @@ export interface ComponentWrapperProps {
16
22
  invalidText?: HelperErrorTextType;
17
23
  /** Sets invalid text in the error state. */
18
24
  isInvalid?: boolean;
25
+ /** Offers the ability to hide the helper/invalid text. */
26
+ showHelperInvalidText?: boolean;
19
27
  }
20
28
  export declare const ComponentWrapper: import("@chakra-ui/react").ChakraComponent<(props: React.PropsWithChildren<ComponentWrapperProps>) => JSX.Element, {}>;
21
29
  export default ComponentWrapper;
@@ -12,6 +12,8 @@ export interface HeadingProps {
12
12
  /** Optional size used to override the default styles of the semantic HTM
13
13
  * `<h>` elements */
14
14
  size?: HeadingSizes;
15
+ /** Optional prop used to remove default spacing */
16
+ noSpace?: boolean;
15
17
  /** Inner text of the `<h*>` element */
16
18
  text?: string;
17
19
  /** Optional URL that header points to; when `url` prop is passed to
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- export declare type LogoNames = "bplBlack" | "bplWhite" | "cleverColor" | "cleverWhite" | "firstbookColor" | "firstbookColorNegative" | "lpaBlack" | "lpaColor" | "lpaWhite" | "mlnBlack" | "mlnWhite" | "nyplFullBlack" | "nyplFullWhite" | "nyplLionBlack" | "nyplLionWhite" | "openebooksColor" | "openebooksNegative" | "openebooksWithTextColor" | "openebooksWithTextNegative" | "qplAltBlack" | "qplAltWhite" | "qplBlack" | "qplColor" | "qplWhite" | "reservoirIconColor" | "reservoirVerticalColor" | "schomburgBlack" | "schomburgCircleBlack" | "schomburgCircleColor" | "schomburgCircleWhite" | "schomburgColor" | "schomburgWhite" | "simplyeBlack" | "simplyeWhite" | "simplyeColor" | "snflBlack" | "snflWhite" | "treasuresColor" | "treasuresColorNegative";
2
+ export declare type LogoNames = "appleAppStoreBlack" | "appleAppStoreWhite" | "bplBlack" | "bplWhite" | "cleverBadgeColor" | "cleverColor" | "cleverWhite" | "firstbookColor" | "firstbookColorNegative" | "googlePlayBlack" | "lpaBlack" | "lpaColor" | "lpaWhite" | "mlnBlack" | "mlnWhite" | "nyplFullBlack" | "nyplFullWhite" | "nyplLionBlack" | "nyplLionWhite" | "openebooksColor" | "openebooksNegative" | "openebooksWithTextColor" | "openebooksWithTextNegative" | "qplAltBlack" | "qplAltWhite" | "qplBlack" | "qplColor" | "qplWhite" | "reservoirIconColor" | "reservoirVerticalColor" | "schomburgBlack" | "schomburgCircleBlack" | "schomburgCircleColor" | "schomburgCircleWhite" | "schomburgColor" | "schomburgWhite" | "simplyeBlack" | "simplyeWhite" | "simplyeColor" | "snflBlack" | "snflWhite" | "treasuresColor" | "treasuresColorNegative";
3
3
  export declare type LogoSizes = "default" | "xxsmall" | "xsmall" | "small" | "medium" | "large";
4
4
  export interface LogoProps {
5
5
  /** Optional className that will be added to the parent element */
@@ -1,10 +1,14 @@
1
1
  declare const _default: {
2
+ appleAppStoreBlack: string;
3
+ appleAppStoreWhite: string;
2
4
  bplBlack: string;
3
5
  bplWhite: string;
6
+ cleverBadgeColor: string;
4
7
  cleverColor: string;
5
8
  cleverWhite: string;
6
9
  firstbookColor: string;
7
10
  firstbookColorNegative: string;
11
+ googlePlayBlack: string;
8
12
  lpaBlack: string;
9
13
  lpaColor: string;
10
14
  lpaWhite: string;