@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
@@ -2,7 +2,8 @@
2
2
 
3
3
  exports[`Slider Range Slider renders the UI snapshot correctly 1`] = `
4
4
  <div
5
- className="css-1xdhyk6"
5
+ className="css-1u8qly9"
6
+ id="defaultRangeSlider-wrapper"
6
7
  >
7
8
  <label
8
9
  className="css-1xdhyk6"
@@ -15,7 +16,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 1`] = `
15
16
  className="css-0"
16
17
  >
17
18
  <div
18
- className="css-bunm4f"
19
+ className="css-ho21zx"
20
+ id="defaultRangeSlider-textInput-start-wrapper"
19
21
  >
20
22
  <input
21
23
  aria-label="Label - start value"
@@ -138,7 +140,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 1`] = `
138
140
  100
139
141
  </div>
140
142
  <div
141
- className="css-1ebeaqx"
143
+ className="css-1f1uedm"
144
+ id="defaultRangeSlider-textInput-end-wrapper"
142
145
  >
143
146
  <input
144
147
  aria-label="Label - end value"
@@ -174,7 +177,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 1`] = `
174
177
 
175
178
  exports[`Slider Range Slider renders the UI snapshot correctly 2`] = `
176
179
  <div
177
- className="css-1xdhyk6"
180
+ className="css-1u8qly9"
181
+ id="errored-wrapper"
178
182
  >
179
183
  <label
180
184
  className="css-1xdhyk6"
@@ -187,7 +191,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 2`] = `
187
191
  className="css-0"
188
192
  >
189
193
  <div
190
- className="css-bunm4f"
194
+ className="css-ho21zx"
195
+ id="errored-textInput-start-wrapper"
191
196
  >
192
197
  <input
193
198
  aria-invalid={true}
@@ -311,7 +316,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 2`] = `
311
316
  100
312
317
  </div>
313
318
  <div
314
- className="css-1ebeaqx"
319
+ className="css-1f1uedm"
320
+ id="errored-textInput-end-wrapper"
315
321
  >
316
322
  <input
317
323
  aria-invalid={true}
@@ -348,7 +354,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 2`] = `
348
354
 
349
355
  exports[`Slider Range Slider renders the UI snapshot correctly 3`] = `
350
356
  <div
351
- className="css-1xdhyk6"
357
+ className="css-1u8qly9"
358
+ id="required-wrapper"
352
359
  >
353
360
  <label
354
361
  className="css-1xdhyk6"
@@ -364,7 +371,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 3`] = `
364
371
  className="css-0"
365
372
  >
366
373
  <div
367
- className="css-bunm4f"
374
+ className="css-ho21zx"
375
+ id="required-textInput-start-wrapper"
368
376
  >
369
377
  <input
370
378
  aria-label="Label - start value"
@@ -488,7 +496,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 3`] = `
488
496
  100
489
497
  </div>
490
498
  <div
491
- className="css-1ebeaqx"
499
+ className="css-1f1uedm"
500
+ id="required-textInput-end-wrapper"
492
501
  >
493
502
  <input
494
503
  aria-label="Label - end value"
@@ -525,7 +534,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 3`] = `
525
534
 
526
535
  exports[`Slider Range Slider renders the UI snapshot correctly 4`] = `
527
536
  <div
528
- className="css-1xdhyk6"
537
+ className="css-1u8qly9"
538
+ id="disabled-wrapper"
529
539
  >
530
540
  <label
531
541
  className="css-1xdhyk6"
@@ -538,7 +548,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 4`] = `
538
548
  className="css-0"
539
549
  >
540
550
  <div
541
- className="css-bunm4f"
551
+ className="css-ho21zx"
552
+ id="disabled-textInput-start-wrapper"
542
553
  >
543
554
  <input
544
555
  aria-label="Label - start value"
@@ -663,7 +674,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 4`] = `
663
674
  100
664
675
  </div>
665
676
  <div
666
- className="css-1ebeaqx"
677
+ className="css-1f1uedm"
678
+ id="disabled-textInput-end-wrapper"
667
679
  >
668
680
  <input
669
681
  aria-label="Label - end value"
@@ -699,13 +711,15 @@ exports[`Slider Range Slider renders the UI snapshot correctly 4`] = `
699
711
 
700
712
  exports[`Slider Range Slider renders the UI snapshot correctly 5`] = `
701
713
  <div
702
- className="css-1xdhyk6"
714
+ className="css-1u8qly9"
715
+ id="noLabels-wrapper"
703
716
  >
704
717
  <div
705
718
  className="css-0"
706
719
  >
707
720
  <div
708
- className="css-bunm4f"
721
+ className="css-ho21zx"
722
+ id="noLabels-textInput-start-wrapper"
709
723
  >
710
724
  <input
711
725
  aria-label="Label - start value"
@@ -828,7 +842,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 5`] = `
828
842
  100
829
843
  </div>
830
844
  <div
831
- className="css-1ebeaqx"
845
+ className="css-1f1uedm"
846
+ id="noLabels-textInput-end-wrapper"
832
847
  >
833
848
  <input
834
849
  aria-label="Label - end value"
@@ -852,7 +867,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 5`] = `
852
867
 
853
868
  exports[`Slider Range Slider renders the UI snapshot correctly 6`] = `
854
869
  <div
855
- className="css-1xdhyk6"
870
+ className="css-1u8qly9"
871
+ id="noVisibleValues-wrapper"
856
872
  >
857
873
  <label
858
874
  className="css-1xdhyk6"
@@ -976,7 +992,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 6`] = `
976
992
 
977
993
  exports[`Slider Range Slider renders the UI snapshot correctly 7`] = `
978
994
  <div
979
- className="css-1xdhyk6"
995
+ className="css-1u8qly9"
996
+ id="onlySlider-wrapper"
980
997
  >
981
998
  <div
982
999
  className="css-0"
@@ -1081,7 +1098,8 @@ exports[`Slider Range Slider renders the UI snapshot correctly 7`] = `
1081
1098
 
1082
1099
  exports[`Slider Single Slider renders the UI snapshot correctly 1`] = `
1083
1100
  <div
1084
- className="css-1xdhyk6"
1101
+ className="css-1u8qly9"
1102
+ id="defaultSlider-wrapper"
1085
1103
  >
1086
1104
  <label
1087
1105
  className="css-1xdhyk6"
@@ -1174,7 +1192,8 @@ exports[`Slider Single Slider renders the UI snapshot correctly 1`] = `
1174
1192
  100
1175
1193
  </div>
1176
1194
  <div
1177
- className="css-1ebeaqx"
1195
+ className="css-1f1uedm"
1196
+ id="defaultSlider-textInput-end-wrapper"
1178
1197
  >
1179
1198
  <input
1180
1199
  aria-label="Label"
@@ -1210,7 +1229,8 @@ exports[`Slider Single Slider renders the UI snapshot correctly 1`] = `
1210
1229
 
1211
1230
  exports[`Slider Single Slider renders the UI snapshot correctly 2`] = `
1212
1231
  <div
1213
- className="css-1xdhyk6"
1232
+ className="css-1u8qly9"
1233
+ id="errored-wrapper"
1214
1234
  >
1215
1235
  <label
1216
1236
  className="css-1xdhyk6"
@@ -1303,7 +1323,8 @@ exports[`Slider Single Slider renders the UI snapshot correctly 2`] = `
1303
1323
  100
1304
1324
  </div>
1305
1325
  <div
1306
- className="css-1ebeaqx"
1326
+ className="css-1f1uedm"
1327
+ id="errored-textInput-end-wrapper"
1307
1328
  >
1308
1329
  <input
1309
1330
  aria-invalid={true}
@@ -1340,7 +1361,8 @@ exports[`Slider Single Slider renders the UI snapshot correctly 2`] = `
1340
1361
 
1341
1362
  exports[`Slider Single Slider renders the UI snapshot correctly 3`] = `
1342
1363
  <div
1343
- className="css-1xdhyk6"
1364
+ className="css-1u8qly9"
1365
+ id="required-wrapper"
1344
1366
  >
1345
1367
  <label
1346
1368
  className="css-1xdhyk6"
@@ -1436,7 +1458,8 @@ exports[`Slider Single Slider renders the UI snapshot correctly 3`] = `
1436
1458
  100
1437
1459
  </div>
1438
1460
  <div
1439
- className="css-1ebeaqx"
1461
+ className="css-1f1uedm"
1462
+ id="required-textInput-end-wrapper"
1440
1463
  >
1441
1464
  <input
1442
1465
  aria-label="Label"
@@ -1473,7 +1496,8 @@ exports[`Slider Single Slider renders the UI snapshot correctly 3`] = `
1473
1496
 
1474
1497
  exports[`Slider Single Slider renders the UI snapshot correctly 4`] = `
1475
1498
  <div
1476
- className="css-1xdhyk6"
1499
+ className="css-1u8qly9"
1500
+ id="disabled-wrapper"
1477
1501
  >
1478
1502
  <label
1479
1503
  className="css-1xdhyk6"
@@ -1568,7 +1592,8 @@ exports[`Slider Single Slider renders the UI snapshot correctly 4`] = `
1568
1592
  100
1569
1593
  </div>
1570
1594
  <div
1571
- className="css-1ebeaqx"
1595
+ className="css-1f1uedm"
1596
+ id="disabled-textInput-end-wrapper"
1572
1597
  >
1573
1598
  <input
1574
1599
  aria-label="Label"
@@ -1604,7 +1629,8 @@ exports[`Slider Single Slider renders the UI snapshot correctly 4`] = `
1604
1629
 
1605
1630
  exports[`Slider Single Slider renders the UI snapshot correctly 5`] = `
1606
1631
  <div
1607
- className="css-1xdhyk6"
1632
+ className="css-1u8qly9"
1633
+ id="noLabels-wrapper"
1608
1634
  >
1609
1635
  <div
1610
1636
  className="css-0"
@@ -1690,7 +1716,8 @@ exports[`Slider Single Slider renders the UI snapshot correctly 5`] = `
1690
1716
  100
1691
1717
  </div>
1692
1718
  <div
1693
- className="css-1ebeaqx"
1719
+ className="css-1f1uedm"
1720
+ id="noLabels-textInput-end-wrapper"
1694
1721
  >
1695
1722
  <input
1696
1723
  aria-label="Label"
@@ -1714,7 +1741,8 @@ exports[`Slider Single Slider renders the UI snapshot correctly 5`] = `
1714
1741
 
1715
1742
  exports[`Slider Single Slider renders the UI snapshot correctly 6`] = `
1716
1743
  <div
1717
- className="css-1xdhyk6"
1744
+ className="css-1u8qly9"
1745
+ id="noVisibleValues-wrapper"
1718
1746
  >
1719
1747
  <label
1720
1748
  className="css-1xdhyk6"
@@ -1814,7 +1842,8 @@ exports[`Slider Single Slider renders the UI snapshot correctly 6`] = `
1814
1842
 
1815
1843
  exports[`Slider Single Slider renders the UI snapshot correctly 7`] = `
1816
1844
  <div
1817
- className="css-1xdhyk6"
1845
+ className="css-1u8qly9"
1846
+ id="onlySlider-wrapper"
1818
1847
  >
1819
1848
  <div
1820
1849
  className="css-0"
@@ -1895,7 +1924,8 @@ exports[`Slider Single Slider renders the UI snapshot correctly 7`] = `
1895
1924
 
1896
1925
  exports[`Slider Single Slider renders the UI snapshot correctly 8`] = `
1897
1926
  <div
1898
- className="css-kle7zy"
1927
+ className="css-1y4kn3e"
1928
+ id="chakra-wrapper"
1899
1929
  >
1900
1930
  <label
1901
1931
  className="css-1xdhyk6"
@@ -1988,7 +2018,8 @@ exports[`Slider Single Slider renders the UI snapshot correctly 8`] = `
1988
2018
  100
1989
2019
  </div>
1990
2020
  <div
1991
- className="css-1ebeaqx"
2021
+ className="css-1f1uedm"
2022
+ id="chakra-textInput-end-wrapper"
1992
2023
  >
1993
2024
  <input
1994
2025
  aria-label="Label"
@@ -2024,8 +2055,9 @@ exports[`Slider Single Slider renders the UI snapshot correctly 8`] = `
2024
2055
 
2025
2056
  exports[`Slider Single Slider renders the UI snapshot correctly 9`] = `
2026
2057
  <div
2027
- className="css-1xdhyk6"
2058
+ className="css-1u8qly9"
2028
2059
  data-testid="props"
2060
+ id="props-wrapper"
2029
2061
  >
2030
2062
  <label
2031
2063
  className="css-1xdhyk6"
@@ -2118,7 +2150,8 @@ exports[`Slider Single Slider renders the UI snapshot correctly 9`] = `
2118
2150
  100
2119
2151
  </div>
2120
2152
  <div
2121
- className="css-1ebeaqx"
2153
+ className="css-1f1uedm"
2154
+ id="props-textInput-end-wrapper"
2122
2155
  >
2123
2156
  <input
2124
2157
  aria-label="Label"
@@ -21,7 +21,7 @@ import DSProvider from "../../theme/provider";
21
21
 
22
22
  ## General Information
23
23
 
24
- Use the [Button](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/form-elements-button--basic)
24
+ Use the [Button](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/docs/components-form-elements-button--button-with-controls)
25
25
  component to render form buttons.
26
26
 
27
27
  ```jsx
@@ -197,5 +197,5 @@ Section colors are branding colors only in use at NYPL.
197
197
 
198
198
  For additional spacing information, please refer to the Figma Main file.
199
199
 
200
- - [NYPL Brand Colors](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=15454%3A47007)
201
- - [NYPL UI Colors](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=14989%3A37)
200
+ - [NYPL Brand Colors](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=15454%3A47007)
201
+ - [NYPL UI Colors](https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=47083%3A27674)
@@ -18,7 +18,8 @@ import { getCategory } from "../../utils/componentCategories";
18
18
 
19
19
  ## General Information
20
20
 
21
- Use the [Form](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/form-elements-form--form) component to control the placement and spacing for standard HTML forms.
21
+ Use the [Form](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/docs/components-form-elements-form--form-with-controls)
22
+ component to control the placement and spacing for standard HTML forms.
22
23
 
23
24
  ## Form Layout
24
25
 
@@ -20,7 +20,7 @@ import DSProvider from "../../theme/provider";
20
20
 
21
21
  ## General Information
22
22
 
23
- Use the Reservoir Design System (DS) [Icon](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/icon--control-props)
23
+ Use the Reservoir Design System (DS) [Icon](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/docs/components-media-icons-icon--icon-with-controls)
24
24
  component to render and control icons as `<svg>` elements within consuming apps.
25
25
 
26
26
  The DS utilizes the `Filled` icons available in the [Material UI Design System](https://material-ui.com/components/material-icons/).
@@ -28,7 +28,7 @@ The DS utilizes the `Filled` icons available in the [Material UI Design System](
28
28
  ## Icon Examples
29
29
 
30
30
  The graphic of the `Icon` component is handled through the `name` prop. To see
31
- all graphic options for `Icon`, please refer to the [Icon](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/icon--control-props)
31
+ all graphic options for `Icon`, please refer to the [Icon](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/docs/components-media-icons-icon--icon-with-controls)
32
32
  Storybook page.
33
33
 
34
34
  <Canvas>
@@ -68,7 +68,7 @@ between elements, both horizontal and vertical, should be `2rem`.
68
68
 
69
69
  Form input components should have a `2rem` space between each form input
70
70
  component. This includes both vertical (column) and horizontal (row) stacking.
71
- The DS [Form](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/components-form-elements-form--form-with-controls)
71
+ The DS [Form](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/docs/components-form-elements-form--form-with-controls)
72
72
  component has correct spacing incorporated into its UI structure and should
73
73
  always be used when building forms. Please note that the spacing in the `Form`
74
74
  component is identical to the spacing in the `Grid` component.
@@ -205,7 +205,7 @@ black on a white background.
205
205
 
206
206
  In cases where specific colors must be applied to text elements, the DS
207
207
  provides CSS variables for the full NYPL color palette. Refer to the
208
- [Colors](https://nypl.github.io/nypl-design-system/storybook-static/?path=/docs/style-guide-colors--colors-brand)
208
+ [Colors](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/docs/style-guide-colors--page)
209
209
  section of the Style Guide for details.
210
210
 
211
211
  ## Font Weight
@@ -37,7 +37,7 @@ import { getCategory } from "../../utils/componentCategories";
37
37
  | Component Version | DS Version |
38
38
  | ----------------- | ---------- |
39
39
  | Added | `0.25.9` |
40
- | Latest | `0.28.0` |
40
+ | Latest | `1.0.2` |
41
41
 
42
42
  ## Table of Contents
43
43
 
@@ -209,7 +209,6 @@ export const charactersData = [
209
209
  [
210
210
  "Isabelle",
211
211
  "-",
212
- ,
213
212
  <Image
214
213
  alt="Isabelle"
215
214
  size="small"
@@ -219,7 +218,6 @@ export const charactersData = [
219
218
  [
220
219
  "K.K.",
221
220
  "Slider",
222
- ,
223
221
  <Image
224
222
  alt="K.K Slider"
225
223
  size="small"
@@ -244,7 +242,6 @@ export const charactersData = [
244
242
  [
245
243
  "Isabelle",
246
244
  "-",
247
- ,
248
245
  <Image
249
246
  alt="Isabelle"
250
247
  size="small"
@@ -254,7 +251,6 @@ export const charactersData = [
254
251
  [
255
252
  "K.K.",
256
253
  "Slider",
257
- ,
258
254
  <Image
259
255
  alt="K.K Slider"
260
256
  size="small"
@@ -15,6 +15,14 @@ export const columnHeaders = [
15
15
  "Zipcode",
16
16
  "State",
17
17
  ];
18
+ export const columnHeadersUneven = [
19
+ "First Name",
20
+ "Last Name",
21
+ "Nick Name",
22
+ "Address1",
23
+ "City",
24
+ "Zipcode",
25
+ ];
18
26
  export const tableData = [
19
27
  ["Tom", "Nook", "Tanukichi", "Main Street", "New York", "23458", "NY"],
20
28
  ["Isabelle", "-", "Shizue", "Walnut Street", "New York", "23458", "NY"],
@@ -29,6 +37,12 @@ export const tableData = [
29
37
  "NY",
30
38
  ],
31
39
  ];
40
+ export const tableDataUneven = [
41
+ ["Tom", "Nook", "Tanukichi", "Main Street", "New York", "23458", "NY"],
42
+ ["Isabelle", "-", "Shizue", "Walnut Street", "New York", "23458", "NY"],
43
+ ["K.K.", "Slider", "Totakeke", "Niper Place", "New York", "98765", "NY"],
44
+ ["Sonny", "Resetti", "Risetto san", "Village Road", "New York", "09873"],
45
+ ];
32
46
  export const characterHeaders = ["First Name", "Last Name", "Avatar"];
33
47
  export const charactersData = [
34
48
  [
@@ -115,6 +129,25 @@ describe("Table", () => {
115
129
  );
116
130
  });
117
131
 
132
+ it("logs a warning when the columns in each `tableData` row are not identical", async () => {
133
+ const warn = jest.spyOn(console, "warn");
134
+ render(<Table tableData={tableDataUneven} columnHeaders={columnHeaders} />);
135
+ expect(warn).toHaveBeenCalledWith(
136
+ "NYPL Reservoir Table: The number of columns in each row of the data table are not identical. " +
137
+ "The `Table` component may not render properly."
138
+ );
139
+ });
140
+
141
+ it("logs a warning when the column headers `columnHeaders` is not equal the number of columns in the data table", async () => {
142
+ const warn = jest.spyOn(console, "warn");
143
+ render(<Table tableData={tableData} columnHeaders={columnHeadersUneven} />);
144
+ expect(warn).toHaveBeenCalledWith(
145
+ "NYPL Reservoir Table: The number of column headers in the `columnHeaders` prop is not equal " +
146
+ "to the number of columns in the data table. " +
147
+ "The `Table` component may not render properly."
148
+ );
149
+ });
150
+
118
151
  it("renders JSX elements from the data array", () => {
119
152
  render(
120
153
  <Table
@@ -100,6 +100,16 @@ export const Table = chakra((props: React.PropsWithChildren<TableProps>) => {
100
100
  return null;
101
101
  }
102
102
 
103
+ for (let i = 1; i < tableData.length; i++) {
104
+ if (tableData[0].length !== tableData[i].length) {
105
+ console.warn(
106
+ "NYPL Reservoir Table: The number of columns in each row of the data table are not identical. " +
107
+ "The `Table` component may not render properly."
108
+ );
109
+ break;
110
+ }
111
+ }
112
+
103
113
  return (
104
114
  <ChakraTbody>
105
115
  {tableData.map((row, index) => (
@@ -119,6 +129,17 @@ export const Table = chakra((props: React.PropsWithChildren<TableProps>) => {
119
129
  );
120
130
  };
121
131
 
132
+ for (let j = 0; j < tableData.length; j++) {
133
+ if (columnHeaders.length !== tableData[j].length) {
134
+ console.warn(
135
+ "NYPL Reservoir Table: The number of column headers in the `columnHeaders` prop is not equal " +
136
+ "to the number of columns in the data table. " +
137
+ "The `Table` component may not render properly."
138
+ );
139
+ break;
140
+ }
141
+ }
142
+
122
143
  return (
123
144
  <ChakraTable id={id} sx={styles} className={className} {...rest}>
124
145
  {tableCaption}
@@ -138,7 +138,7 @@ import { TemplateAppContainer } from "@nypl/design-system-react-components";
138
138
  sidebar: "left",
139
139
  renderFooterElement: true,
140
140
  renderHeaderElement: true,
141
- renderSkipNavigation: false,
141
+ renderSkipNavigation: true,
142
142
  }}
143
143
  argTypes={{
144
144
  aboveHeader: { control: false },
@@ -599,7 +599,7 @@ This is best viewed in the Storybook "Canvas" and not "Docs" section.
599
599
  <Accordion accordionData={faqContent} />
600
600
  <HorizontalRule />
601
601
  <p>Fill out the form!</p>
602
- <Form id="form1" action="/end/point">
602
+ <Form action="/end/point" id="form1">
603
603
  <FormField>
604
604
  <TextInput
605
605
  helperText="Make sure to complete this field."
@@ -618,13 +618,17 @@ This is best viewed in the Storybook "Canvas" and not "Docs" section.
618
618
  </FormField>
619
619
  <FormRow>
620
620
  <FormField>
621
- <TextInput labelText="Phone Field" type="tel" />
621
+ <TextInput
622
+ id="phone-field"
623
+ labelText="Phone Field"
624
+ type="tel"
625
+ />
622
626
  </FormField>
623
627
  <FormField>
624
- <TextInput labelText="URL Field" type="url" />
628
+ <TextInput id="url-field" labelText="URL Field" type="url" />
625
629
  </FormField>
626
630
  <FormField>
627
- <TextInput labelText="Age" type="number" />
631
+ <TextInput id="age-field" labelText="Age" type="number" />
628
632
  </FormField>
629
633
  </FormRow>
630
634
  <FormField>
@@ -51,7 +51,7 @@ import DSProvider from "../../theme/provider";
51
51
  | Component Version | DS Version |
52
52
  | ----------------- | ---------- |
53
53
  | Added | `0.22.0` |
54
- | Latest | `0.28.0` |
54
+ | Latest | `1.0.2` |
55
55
 
56
56
  ## Table of Contents
57
57
 
@@ -1,5 +1,4 @@
1
1
  import {
2
- Box,
3
2
  chakra,
4
3
  Input as ChakraInput,
5
4
  Textarea as ChakraTextarea,
@@ -7,10 +6,10 @@ import {
7
6
  } from "@chakra-ui/react";
8
7
  import * as React from "react";
9
8
 
9
+ import ComponentWrapper from "../ComponentWrapper/ComponentWrapper";
10
10
  import Label from "../Label/Label";
11
- import HelperErrorText, {
12
- HelperErrorTextType,
13
- } from "../HelperErrorText/HelperErrorText";
11
+ import { HelperErrorTextType } from "../HelperErrorText/HelperErrorText";
12
+ import { getAriaAttrs } from "../../utils/utils";
14
13
 
15
14
  // HTML Input types as defined by MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input
16
15
  export type TextInputTypes =
@@ -147,7 +146,13 @@ export const TextInput = chakra(
147
146
  let footnote: HelperErrorTextType = isInvalid
148
147
  ? finalInvalidText
149
148
  : helperText;
150
- let ariaAttributes = {};
149
+ const ariaAttributes = getAriaAttrs({
150
+ footnote,
151
+ id,
152
+ labelText,
153
+ name: "TextInput",
154
+ showLabel,
155
+ });
151
156
  let fieldOutput;
152
157
  let options;
153
158
 
@@ -157,13 +162,6 @@ export const TextInput = chakra(
157
162
  );
158
163
  }
159
164
 
160
- if (!showLabel) {
161
- ariaAttributes["aria-label"] =
162
- labelText && footnote ? `${labelText} - ${footnote}` : labelText;
163
- } else if (helperText) {
164
- ariaAttributes["aria-describedby"] = `${id}-helperText`;
165
- }
166
-
167
165
  if (type === "tel" || type === "url" || type === "email") {
168
166
  const example = TextInputFormats[type] || "";
169
167
  footnote = (
@@ -213,7 +211,16 @@ export const TextInput = chakra(
213
211
  }
214
212
 
215
213
  return (
216
- <Box __css={styles} className={className} {...rest}>
214
+ <ComponentWrapper
215
+ className={className}
216
+ helperText={helperText}
217
+ id={id}
218
+ invalidText={finalInvalidText}
219
+ isInvalid={isInvalid}
220
+ showHelperInvalidText={showHelperInvalidText && !isHidden}
221
+ __css={styles}
222
+ {...rest}
223
+ >
217
224
  {labelText && showLabel && !isHidden && (
218
225
  <Label
219
226
  htmlFor={id}
@@ -224,14 +231,7 @@ export const TextInput = chakra(
224
231
  </Label>
225
232
  )}
226
233
  {fieldOutput}
227
- {footnote && showHelperInvalidText && !isHidden && (
228
- <HelperErrorText
229
- id={`${id}-helperText`}
230
- isInvalid={isInvalid}
231
- text={footnote}
232
- />
233
- )}
234
- </Box>
234
+ </ComponentWrapper>
235
235
  );
236
236
  }
237
237
  )