@nypl/design-system-react-components 0.26.1 → 1.0.0

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 (307) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +7 -7
  3. package/dist/components/Accordion/Accordion.d.ts +1 -1
  4. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  5. package/dist/components/Button/Button.d.ts +2 -10
  6. package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
  7. package/dist/components/Card/Card.d.ts +2 -2
  8. package/dist/components/Checkbox/Checkbox.d.ts +10 -8
  9. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  10. package/dist/components/DatePicker/DatePicker.d.ts +1 -1
  11. package/dist/components/Form/Form.d.ts +2 -2
  12. package/dist/components/Grid/SimpleGrid.d.ts +6 -3
  13. package/dist/components/Heading/Heading.d.ts +2 -5
  14. package/dist/components/HelperErrorText/HelperErrorText.d.ts +1 -5
  15. package/dist/components/Hero/Hero.d.ts +13 -9
  16. package/dist/components/Icons/Icon.d.ts +6 -5
  17. package/dist/components/Icons/IconSvgs.d.ts +21 -21
  18. package/dist/components/Image/Image.d.ts +8 -5
  19. package/dist/components/Link/Link.d.ts +1 -9
  20. package/dist/components/List/List.d.ts +7 -11
  21. package/dist/components/Logo/Logo.d.ts +2 -5
  22. package/dist/components/Logo/LogoSvgs.d.ts +39 -39
  23. package/dist/components/Modal/Modal.d.ts +28 -8
  24. package/dist/components/Notification/Notification.d.ts +1 -1
  25. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
  26. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  27. package/dist/components/SearchBar/SearchBar.d.ts +3 -2
  28. package/dist/components/Select/Select.d.ts +2 -5
  29. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
  30. package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
  31. package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
  32. package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
  33. package/dist/components/Table/Table.d.ts +1 -1
  34. package/dist/components/Template/Template.d.ts +2 -0
  35. package/dist/components/Text/Text.d.ts +1 -1
  36. package/dist/components/TextInput/TextInput.d.ts +21 -9
  37. package/dist/components/Toggle/Toggle.d.ts +1 -5
  38. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  39. package/dist/design-system-react-components.cjs.development.js +983 -1222
  40. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  41. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  42. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  43. package/dist/design-system-react-components.esm.js +982 -1285
  44. package/dist/design-system-react-components.esm.js.map +1 -1
  45. package/dist/helpers/types.d.ts +1 -0
  46. package/dist/index.d.ts +27 -48
  47. package/dist/styles.css +1 -1
  48. package/dist/theme/components/buttonGroup.d.ts +11 -0
  49. package/dist/theme/components/card.d.ts +104 -8
  50. package/dist/theme/components/componentWrapper.d.ts +4 -3
  51. package/dist/theme/components/customTable.d.ts +11 -14
  52. package/dist/theme/components/fieldset.d.ts +4 -3
  53. package/dist/theme/components/helperErrorText.d.ts +4 -3
  54. package/dist/theme/components/hero.d.ts +1 -1
  55. package/dist/theme/components/horizontalRule.d.ts +4 -3
  56. package/dist/theme/components/icon.d.ts +47743 -1
  57. package/dist/theme/components/image.d.ts +563 -10
  58. package/dist/theme/components/label.d.ts +4 -3
  59. package/dist/theme/components/list.d.ts +6 -7
  60. package/dist/theme/components/logo.d.ts +474 -1
  61. package/dist/theme/components/notification.d.ts +20 -16
  62. package/dist/theme/components/progressIndicator.d.ts +6 -4
  63. package/dist/theme/components/select.d.ts +4 -10
  64. package/dist/theme/components/skeletonLoader.d.ts +14 -10
  65. package/dist/theme/components/skipNavigation.d.ts +22 -0
  66. package/dist/theme/components/slider.d.ts +7 -6
  67. package/dist/theme/components/structuredContent.d.ts +10 -9
  68. package/dist/theme/components/text.d.ts +7 -1
  69. package/dist/theme/components/toggle.d.ts +6 -4
  70. package/dist/theme/provider.d.ts +2 -4
  71. package/dist/utils/componentCategories.d.ts +1 -1
  72. package/dist/utils/interfaces.d.ts +5 -0
  73. package/dist/utils/utils.d.ts +2 -18
  74. package/package.json +15 -16
  75. package/src/__tests__/setup.ts +3 -3
  76. package/src/__tests__/utils/utils.test.ts +1 -23
  77. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
  78. package/src/components/Accordion/Accordion.stories.mdx +43 -44
  79. package/src/components/Accordion/Accordion.test.tsx +5 -13
  80. package/src/components/Accordion/Accordion.tsx +14 -18
  81. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
  82. package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
  83. package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
  84. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
  85. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
  86. package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
  87. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
  88. package/src/components/Button/Button.stories.mdx +89 -126
  89. package/src/components/Button/Button.test.tsx +16 -30
  90. package/src/components/Button/Button.tsx +14 -20
  91. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
  92. package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
  93. package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
  94. package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
  95. package/src/components/Card/Card.stories.mdx +144 -178
  96. package/src/components/Card/Card.test.tsx +36 -97
  97. package/src/components/Card/Card.tsx +78 -74
  98. package/src/components/Chakra/Box.stories.mdx +3 -7
  99. package/src/components/Chakra/Center.stories.mdx +6 -24
  100. package/src/components/Chakra/Flex.stories.mdx +5 -7
  101. package/src/components/Chakra/Grid.stories.mdx +1 -1
  102. package/src/components/Chakra/Stack.stories.mdx +10 -11
  103. package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
  104. package/src/components/Checkbox/Checkbox.test.tsx +2 -2
  105. package/src/components/Checkbox/Checkbox.tsx +20 -13
  106. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +6 -17
  107. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -7
  108. package/src/components/CheckboxGroup/CheckboxGroup.tsx +33 -29
  109. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -11
  110. package/src/components/ComponentWrapper/ComponentWrapper.tsx +3 -10
  111. package/src/components/DatePicker/DatePicker.stories.mdx +23 -37
  112. package/src/components/DatePicker/DatePicker.test.tsx +21 -19
  113. package/src/components/DatePicker/DatePicker.tsx +57 -49
  114. package/src/components/Form/Form.stories.mdx +46 -31
  115. package/src/components/Form/Form.test.tsx +1 -18
  116. package/src/components/Form/Form.tsx +7 -7
  117. package/src/components/Grid/SimpleGrid.stories.mdx +73 -49
  118. package/src/components/Grid/SimpleGrid.test.tsx +7 -9
  119. package/src/components/Grid/SimpleGrid.tsx +14 -11
  120. package/src/components/Heading/Heading.stories.mdx +27 -72
  121. package/src/components/Heading/Heading.test.tsx +18 -44
  122. package/src/components/Heading/Heading.tsx +7 -10
  123. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -3
  124. package/src/components/HelperErrorText/HelperErrorText.tsx +1 -5
  125. package/src/components/Hero/Hero.stories.mdx +219 -216
  126. package/src/components/Hero/Hero.test.tsx +107 -223
  127. package/src/components/Hero/Hero.tsx +63 -61
  128. package/src/components/Icons/Icon.stories.mdx +172 -118
  129. package/src/components/Icons/Icon.test.tsx +8 -16
  130. package/src/components/Icons/Icon.tsx +75 -29
  131. package/src/components/Icons/IconSvgs.tsx +42 -42
  132. package/src/components/Image/Image.stories.mdx +45 -132
  133. package/src/components/Image/Image.test.tsx +16 -31
  134. package/src/components/Image/Image.tsx +28 -12
  135. package/src/components/Link/Link.stories.mdx +30 -94
  136. package/src/components/Link/Link.test.tsx +25 -75
  137. package/src/components/Link/Link.tsx +43 -56
  138. package/src/components/Link/__snapshots__/Link.test.tsx.snap +1 -2
  139. package/src/components/List/List.stories.mdx +20 -31
  140. package/src/components/List/List.test.tsx +24 -43
  141. package/src/components/List/List.tsx +25 -36
  142. package/src/components/Logo/Logo.stories.mdx +94 -50
  143. package/src/components/Logo/Logo.test.tsx +10 -19
  144. package/src/components/Logo/Logo.tsx +50 -17
  145. package/src/components/Logo/LogoSvgs.tsx +78 -78
  146. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +4 -4
  147. package/src/components/Modal/Modal.stories.mdx +245 -139
  148. package/src/components/Modal/Modal.test.tsx +147 -10
  149. package/src/components/Modal/Modal.tsx +140 -20
  150. package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +25 -0
  151. package/src/components/Notification/Notification.stories.mdx +10 -28
  152. package/src/components/Notification/Notification.test.tsx +9 -12
  153. package/src/components/Notification/Notification.tsx +34 -37
  154. package/src/components/Pagination/Pagination.stories.mdx +3 -4
  155. package/src/components/Pagination/Pagination.tsx +15 -10
  156. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +27 -53
  157. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +9 -10
  158. package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -21
  159. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -10
  160. package/src/components/Radio/Radio.stories.mdx +1 -1
  161. package/src/components/Radio/Radio.tsx +9 -6
  162. package/src/components/RadioGroup/RadioGroup.stories.mdx +15 -16
  163. package/src/components/RadioGroup/RadioGroup.test.tsx +2 -8
  164. package/src/components/RadioGroup/RadioGroup.tsx +28 -24
  165. package/src/components/SearchBar/SearchBar.stories.mdx +4 -4
  166. package/src/components/SearchBar/SearchBar.test.tsx +1 -1
  167. package/src/components/SearchBar/SearchBar.tsx +14 -22
  168. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1 -13
  169. package/src/components/Select/Select.stories.mdx +10 -25
  170. package/src/components/Select/Select.test.tsx +6 -7
  171. package/src/components/Select/Select.tsx +28 -35
  172. package/src/components/Select/__snapshots__/Select.test.tsx.snap +24 -24
  173. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +17 -56
  174. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -21
  175. package/src/components/SkeletonLoader/SkeletonLoader.tsx +9 -8
  176. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +33 -33
  177. package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
  178. package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
  179. package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
  180. package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
  181. package/src/components/Slider/Slider.stories.mdx +19 -53
  182. package/src/components/Slider/Slider.test.tsx +2 -2
  183. package/src/components/Slider/Slider.tsx +10 -12
  184. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2 -9
  185. package/src/components/StatusBadge/StatusBadge.stories.mdx +6 -21
  186. package/src/components/StatusBadge/StatusBadge.test.tsx +2 -3
  187. package/src/components/StatusBadge/StatusBadge.tsx +3 -10
  188. package/src/components/StructuredContent/StructuredContent.stories.mdx +30 -58
  189. package/src/components/StructuredContent/StructuredContent.test.tsx +42 -44
  190. package/src/components/StructuredContent/StructuredContent.tsx +9 -18
  191. package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -23
  192. package/src/components/StyleGuide/Buttons.stories.mdx +63 -63
  193. package/src/components/StyleGuide/ColorCard.tsx +2 -4
  194. package/src/components/StyleGuide/Colors.stories.mdx +9 -10
  195. package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
  196. package/src/components/StyleGuide/Forms.stories.mdx +2 -2
  197. package/src/components/StyleGuide/Iconography.stories.mdx +60 -78
  198. package/src/components/StyleGuide/Spacing.stories.mdx +1 -2
  199. package/src/components/StyleGuide/Typography.stories.mdx +16 -19
  200. package/src/components/Table/Table.stories.mdx +85 -1
  201. package/src/components/Table/Table.test.tsx +57 -1
  202. package/src/components/Table/Table.tsx +7 -4
  203. package/src/components/Table/__snapshots__/Table.test.tsx.snap +121 -0
  204. package/src/components/Tabs/Tabs.stories.mdx +1 -1
  205. package/src/components/Tabs/Tabs.test.tsx +2 -2
  206. package/src/components/Tabs/Tabs.tsx +26 -27
  207. package/src/components/Template/Template.stories.mdx +49 -54
  208. package/src/components/Template/Template.tsx +9 -3
  209. package/src/components/Text/Text.stories.mdx +5 -11
  210. package/src/components/Text/Text.test.tsx +3 -6
  211. package/src/components/Text/Text.tsx +3 -5
  212. package/src/components/TextInput/TextInput.stories.mdx +10 -22
  213. package/src/components/TextInput/TextInput.test.tsx +32 -62
  214. package/src/components/TextInput/TextInput.tsx +61 -30
  215. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +1 -0
  216. package/src/components/Toggle/Toggle.stories.mdx +5 -16
  217. package/src/components/Toggle/Toggle.test.tsx +2 -3
  218. package/src/components/Toggle/Toggle.tsx +9 -10
  219. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +13 -29
  220. package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -23
  221. package/src/components/VideoPlayer/VideoPlayer.tsx +13 -10
  222. package/src/docs/Chakra.stories.mdx +14 -11
  223. package/src/docs/Welcome.stories.mdx +23 -43
  224. package/src/helpers/types.ts +1 -0
  225. package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
  226. package/src/hooks/useNYPLTheme.stories.mdx +3 -6
  227. package/src/index.ts +52 -46
  228. package/src/styles.scss +0 -1
  229. package/src/theme/components/buttonGroup.ts +10 -0
  230. package/src/theme/components/card.ts +50 -15
  231. package/src/theme/components/componentWrapper.ts +5 -1
  232. package/src/theme/components/customTable.ts +8 -2
  233. package/src/theme/components/fieldset.ts +5 -1
  234. package/src/theme/components/helperErrorText.ts +5 -1
  235. package/src/theme/components/hero.ts +2 -2
  236. package/src/theme/components/horizontalRule.ts +5 -1
  237. package/src/theme/components/icon.ts +7 -1
  238. package/src/theme/components/image.ts +14 -3
  239. package/src/theme/components/label.ts +5 -1
  240. package/src/theme/components/list.ts +8 -2
  241. package/src/theme/components/logo.ts +5 -1
  242. package/src/theme/components/notification.ts +38 -14
  243. package/src/theme/components/progressIndicator.ts +10 -5
  244. package/src/theme/components/select.ts +5 -6
  245. package/src/theme/components/skeletonLoader.ts +8 -2
  246. package/src/theme/components/skipNavigation.ts +26 -0
  247. package/src/theme/components/slider.ts +13 -1
  248. package/src/theme/components/structuredContent.ts +11 -1
  249. package/src/theme/components/text.ts +12 -5
  250. package/src/theme/components/toggle.ts +9 -3
  251. package/src/theme/foundations/colors.ts +6 -9
  252. package/src/theme/index.ts +4 -0
  253. package/src/theme/provider.tsx +1 -1
  254. package/src/utils/componentCategories.ts +13 -5
  255. package/src/utils/interfaces.ts +5 -0
  256. package/src/utils/utils.ts +2 -32
  257. package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
  258. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
  259. package/dist/components/Button/ButtonTypes.d.ts +0 -8
  260. package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
  261. package/dist/components/Form/FormTypes.d.ts +0 -2
  262. package/dist/components/Grid/GridTypes.d.ts +0 -9
  263. package/dist/components/Heading/HeadingTypes.d.ts +0 -14
  264. package/dist/components/Hero/HeroTypes.d.ts +0 -12
  265. package/dist/components/Icons/IconTypes.d.ts +0 -77
  266. package/dist/components/Image/ImageTypes.d.ts +0 -22
  267. package/dist/components/Link/LinkTypes.d.ts +0 -8
  268. package/dist/components/List/ListTypes.d.ts +0 -5
  269. package/dist/components/Logo/LogoTypes.d.ts +0 -54
  270. package/dist/components/Notification/NotificationTypes.d.ts +0 -5
  271. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
  272. package/dist/components/Select/SelectTypes.d.ts +0 -8
  273. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
  274. package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
  275. package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
  276. package/dist/components/Text/TextTypes.d.ts +0 -6
  277. package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
  278. package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
  279. package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
  280. package/dist/helpers/enums.d.ts +0 -4
  281. package/dist/utils/siteSections.d.ts +0 -2
  282. package/src/components/Accordion/AccordionTypes.tsx +0 -5
  283. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
  284. package/src/components/Button/ButtonTypes.tsx +0 -8
  285. package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
  286. package/src/components/Form/FormTypes.tsx +0 -3
  287. package/src/components/Grid/GridTypes.tsx +0 -9
  288. package/src/components/Heading/HeadingTypes.tsx +0 -15
  289. package/src/components/Hero/HeroTypes.tsx +0 -20
  290. package/src/components/Icons/IconTypes.tsx +0 -83
  291. package/src/components/Image/ImageTypes.ts +0 -24
  292. package/src/components/Link/LinkTypes.tsx +0 -8
  293. package/src/components/List/ListTypes.tsx +0 -5
  294. package/src/components/Logo/LogoTypes.tsx +0 -56
  295. package/src/components/Modal/_Modal.scss +0 -18
  296. package/src/components/Notification/NotificationTypes.tsx +0 -5
  297. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
  298. package/src/components/Select/SelectTypes.tsx +0 -10
  299. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
  300. package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
  301. package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
  302. package/src/components/Text/TextTypes.tsx +0 -6
  303. package/src/components/TextInput/TextInputTypes.tsx +0 -48
  304. package/src/components/Toggle/ToggleTypes.tsx +0 -4
  305. package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
  306. package/src/helpers/enums.ts +0 -4
  307. package/src/utils/siteSections.ts +0 -10
@@ -1,5 +1,11 @@
1
+ interface TextBaseStyle {
2
+ isBold: boolean;
3
+ isItalic: boolean;
4
+ noSpace: boolean;
5
+ variant: string;
6
+ }
1
7
  declare const Text: {
2
- baseStyle: (props: any) => {
8
+ baseStyle: ({ isBold, isItalic, noSpace, variant }: TextBaseStyle) => {
3
9
  fontStyle: string;
4
10
  fontWeight: string;
5
11
  marginBottom: string;
@@ -1,10 +1,12 @@
1
+ import { ToggleSizes } from "../../components/Toggle/Toggle";
2
+ interface ToggleBaseStyle {
3
+ isDisabled: boolean;
4
+ size: ToggleSizes;
5
+ }
1
6
  declare const _default: {
2
7
  Toggle: {
3
8
  parts: string[];
4
- baseStyle: ({ isDisabled, size }: {
5
- isDisabled: any;
6
- size: any;
7
- }) => {
9
+ baseStyle: ({ isDisabled, size }: ToggleBaseStyle) => {
8
10
  label: {
9
11
  alignItems: string;
10
12
  display: string;
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
- declare const DSProvider: ({ children }: {
3
- children: any;
4
- }) => JSX.Element;
1
+ import React from "react";
2
+ declare const DSProvider: ({ children }: React.PropsWithChildren<{}>) => JSX.Element;
5
3
  export default DSProvider;
@@ -1 +1 @@
1
- export declare const getCategory: (component: any) => any;
1
+ export declare const getCategory: (component: string) => string;
@@ -0,0 +1,5 @@
1
+ export interface AriaAttributes {
2
+ "aria-label"?: string;
3
+ "aria-describedby"?: string;
4
+ "aria-labelledby"?: string;
5
+ }
@@ -4,29 +4,13 @@
4
4
  * `step` between values.
5
5
  */
6
6
  export declare const range: (start: number, stop: number, step?: number) => number[];
7
- /**
8
- * Map an enum value to a component's Chakra theme variant object. If a wrong
9
- * value is passed (typically in non-Typescript scenarios), then the "fallback"
10
- * value, if provided, will be used.
11
- */
12
- export declare const getVariant: (variant: any, collection: any, fallback?: any) => any;
13
- /**
14
- * Given an enum object and its name, this will return (1) an array `options`
15
- * of all values with the enum name as the prefix, and (2) a function that
16
- * returns the correct enum value given a string from the `options` array.
17
- * @NOTE this is only used for Storybook documentation.
18
- */
19
- export declare const getStorybookEnumValues: (enumObject: any, name: any) => {
20
- options: string[];
21
- getValue: (key: any) => any;
22
- };
23
7
  /**
24
8
  * Given a pagination's pageCount, this will return (1) a page number,
25
9
  * derived from the current URL, and (2) a function that, when passed to
26
10
  * Pagination component, makes the URL change and refreshes the page.
27
11
  * @NOTE this is only used for Storybook documentation.
28
12
  */
29
- export declare const getStorybookHrefProps: (pageCount: any) => {
13
+ export declare const getStorybookHrefProps: (pageCount: number) => {
30
14
  computedCurrentPage: number;
31
- getPageHref: (selectedPage: any) => string;
15
+ getPageHref: (selectedPage: number) => string;
32
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nypl/design-system-react-components",
3
- "version": "0.26.1",
3
+ "version": "1.0.0",
4
4
  "description": "NYPL Reservoir Design System React Components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,7 +33,7 @@
33
33
  "analyze": "size-limit --why",
34
34
  "generate-sass-resources": "gulp",
35
35
  "storybook": "start-storybook -p 6006 -s ./.storybook/public",
36
- "build-storybook:v0": "npm run prebuild:storybook && build-storybook -c .storybook -o ./reservoir/v0",
36
+ "build-storybook:v1": "npm run prebuild:storybook && build-storybook -c .storybook -o ./reservoir/v1",
37
37
  "prebuild:storybook": "npm run test:generate-output"
38
38
  },
39
39
  "lint-staged": {
@@ -57,27 +57,28 @@
57
57
  }
58
58
  ],
59
59
  "dependencies": {
60
- "@chakra-ui/react": ">=1.7.1",
61
- "@chakra-ui/system": ">=1.8.1",
62
- "@emotion/react": "11.4.1",
63
- "@emotion/styled": "11.3.0",
64
- "framer-motion": "4.1.17",
60
+ "@chakra-ui/react": ">=1.8.5",
61
+ "@chakra-ui/system": ">=1.11.0",
62
+ "@emotion/react": ">=11.4.1",
63
+ "@emotion/styled": ">=11.3.0",
64
+ "framer-motion": "^4.1.17",
65
65
  "he": "1.2.0",
66
66
  "react-datepicker": "4.1.1",
67
67
  "system-font-css": "2.0.2",
68
68
  "typescript": "4.3.5"
69
69
  },
70
70
  "peerDependencies": {
71
- "@chakra-ui/react": ">=1.7.1",
72
- "@chakra-ui/system": ">=1.8.1",
71
+ "@chakra-ui/react": ">=1.8.0",
72
+ "@chakra-ui/system": ">=1.10.0",
73
73
  "@emotion/react": ">=11.4.1",
74
74
  "@emotion/styled": ">=11.3.0",
75
- "framer-motion": ">=4.1.17",
75
+ "framer-motion": "^4.1.17",
76
76
  "react": ">=16.13.0",
77
77
  "react-dom": ">=16.13.0"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@babel/core": "7.14.6",
81
+ "@chakra-ui/storybook-addon": "1.0.3",
81
82
  "@mdx-js/react": "1.6.22",
82
83
  "@size-limit/preset-small-lib": "5.0.1",
83
84
  "@storybook/addon-a11y": "6.4.19",
@@ -86,7 +87,6 @@
86
87
  "@storybook/addon-essentials": "6.4.19",
87
88
  "@storybook/addon-jest": "6.4.19",
88
89
  "@storybook/addon-links": "6.4.19",
89
- "@storybook/addon-queryparams": "6.2.9",
90
90
  "@storybook/addons": "6.4.19",
91
91
  "@storybook/react": "6.4.19",
92
92
  "@svgr/rollup": "5.5.0",
@@ -124,12 +124,11 @@
124
124
  "node-sass-glob-importer": "5.3.2",
125
125
  "normalize.css": "8.0.1",
126
126
  "prettier": "2.4.1",
127
- "react": "16.14.0",
127
+ "react": "17.0.2",
128
128
  "react-autosuggest": "10.0.2",
129
- "react-docgen-typescript-loader": "3.1.0",
130
- "react-dom": "16.14.0",
131
- "react-router-dom": "5.2.0",
132
- "react-test-renderer": "16.14.0",
129
+ "react-docgen-typescript-loader": "3.7.2",
130
+ "react-dom": "17.0.2",
131
+ "react-test-renderer": "17.0.2",
133
132
  "rollup-plugin-postcss": "4.0.0",
134
133
  "rollup-plugin-svg": "2.0.0",
135
134
  "sass": "1.35.1",
@@ -14,10 +14,10 @@ const exposedProperties = ["window", "navigator", "document"];
14
14
 
15
15
  (global as any).window = window;
16
16
  (global as any).document = window.document;
17
- Object.keys(document.defaultView).forEach((property) => {
18
- if (typeof global[property] === "undefined") {
17
+ Object.keys((document as Document).defaultView).forEach((property) => {
18
+ if (typeof (global as any)[property] === "undefined") {
19
19
  exposedProperties.push(property);
20
- global[property] = document.defaultView[property];
20
+ (global as any)[property] = (document as any).defaultView[property];
21
21
  }
22
22
  });
23
23
 
@@ -1,5 +1,4 @@
1
- import { getStorybookEnumValues, range } from "../../utils/utils";
2
- import { ButtonTypes } from "../../components/Button/ButtonTypes";
1
+ import { range } from "../../utils/utils";
3
2
 
4
3
  describe("range", () => {
5
4
  it("returns an array of values not including the stop argument", () => {
@@ -17,24 +16,3 @@ describe("range", () => {
17
16
  expect(range(2, 20, 5)).toEqual([2, 7, 12, 17]);
18
17
  });
19
18
  });
20
-
21
- describe("getStorybookEnumValues", () => {
22
- const enumValues = getStorybookEnumValues(ButtonTypes, "ButtonTypes");
23
-
24
- it("returns an array of values from the enum passed", () => {
25
- expect(enumValues.options).toEqual([
26
- "ButtonTypes.Primary",
27
- "ButtonTypes.Secondary",
28
- "ButtonTypes.Callout",
29
- "ButtonTypes.Pill",
30
- "ButtonTypes.Link",
31
- "ButtonTypes.NoBrand",
32
- ]);
33
- });
34
-
35
- it("returns a function with the value of the argument passed", () => {
36
- expect(enumValues.getValue("ButtonTypes.Primary")).toEqual("primary");
37
- expect(enumValues.getValue("ButtonTypes.Callout")).toEqual("callout");
38
- expect(enumValues.getValue("ButtonTypes.NoBrand")).toEqual("noBrand");
39
- });
40
- });
@@ -13,20 +13,28 @@ import { getCategory } from "../../utils/componentCategories";
13
13
 
14
14
  ## General Information
15
15
 
16
- An application's "skip navigation link" is used to skip to the primary or main
17
- content of a page. This link is located at the top of the page and is usually
18
- visually hidden until a user focuses on the link. For most applications at
19
- NYPL, the [NYPL Header](https://github.com/NYPL/dgx-header-component) is used
20
- and this component already renders a skip navigation link.
21
-
22
- The link must target an existing anchor on the page and is typically the `id`
23
- `"#mainContent"` set on the `main` HTML element on the page. While the DS does not
24
- currently, as of `v0.25.13`, provide a skip navigation link, it does provide the
25
- anchor element for the link through the `TemplateAppContainer` component.
26
-
27
- The `TemplateAppContainer` component renders as a `main` HTML element with a
28
- default `id` of `"mainContent"`. This should be used as the anchor element that
29
- the skip navigation link points to.
16
+ An application's "skip navigation" is used to skip to the primary or main
17
+ content of a page. This component usually contains one link that is located at
18
+ the top of the page and is visually hidden until a user focuses on the link.
19
+ In the case of NYPL applications, the skip navigation contains two links; the
20
+ first link points to the main content of the page and the second link points to
21
+ accessibility information on [NYPL.org/accessibility](https://nypl.org/accessibility).
22
+ For most digitial applications on the NYPL.org platform, the [NYPL Header](https://github.com/NYPL/dgx-header-component)
23
+ is used and this component already renders a skip navigation area with links.
24
+
25
+ In the Reservoir Design System (DS), the `SkipNavigation` component renders two
26
+ links.
27
+
28
+ The first link points to the `"#mainContent"` anchor which an NYPL page
29
+ is expected to have. The `TemplateAppContainer` component renders as a `main`
30
+ HTML element with a default `id` of `"mainContent"`. While it's possible to
31
+ update the target of the skip link and the id of the `<main>` element, this is
32
+ not recommended. When using the DS' `SkipNavigation` and `TemplateAppContainer`
33
+ components, this accessibility combination is automatically handled. When not
34
+ using the `TemplateAppContainer` component, make sure to render a `main` HTML
35
+ element with an `id` of `"mainContent"`.
36
+
37
+ The second link points to additional accessibility information on [NYPL.org/accessibility](https://nypl.org/accessibility).
30
38
 
31
39
  ## Resources
32
40
 
@@ -9,11 +9,7 @@ import ReactDOMServer from "react-dom/server";
9
9
  import { withDesign } from "storybook-addon-designs";
10
10
 
11
11
  import Accordion from "./Accordion";
12
- import { AccordionTypes } from "./AccordionTypes";
13
12
  import Card, { CardHeading, CardContent } from "../Card/Card";
14
- import { HeadingLevels } from "../Heading/HeadingTypes";
15
- import { ImageRatios } from "../Image/ImageTypes";
16
- import { LayoutTypes } from "../../helpers/enums";
17
13
  import { getCategory } from "../../utils/componentCategories";
18
14
 
19
15
  <Meta
@@ -39,7 +35,7 @@ import { getCategory } from "../../utils/componentCategories";
39
35
  | Component Version | DS Version |
40
36
  | ----------------- | ---------- |
41
37
  | Added | `0.1.0` |
42
- | Latest | `0.26.0` |
38
+ | Latest | `0.28.0` |
43
39
 
44
40
  ## Table of Contents
45
41
 
@@ -66,22 +62,25 @@ Note that you can pass in a string or DOM elements into the `panel` property in
66
62
  object. This approach is needed because, internally, we deal with the logic to render
67
63
  the necessary icon, Chakra components, and styles. Additionally, the `accordionType`
68
64
  prop can be used to change the accordion button's background color. It takes a value
69
- from the AccordionTypes enum: AccordionTypes.Default is `ui.white`, AccordionTypes.Warning
70
- is `ui.status.primary`, and AccordionTypes.Error is `ui.status.secondary`.
65
+ of `"default"` for `"ui.white"`, `"warning"` for `"ui.status.primary"`, and
66
+ `"error"` for `"ui.status.secondary"`.
71
67
 
72
68
  ```jsx
73
69
  const accordionData = [
74
70
  {
71
+ accordionType: "default",
75
72
  label: "Tom Nook",
76
73
  panel: (
77
74
  <Card
78
- layout={CardLayouts.Row}
75
+ layout="row"
79
76
  center
80
- imageSrc="https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png"
81
- imageAlt="Alt text"
82
- imageAspectRatio={ImageRatios.TwoByOne}
77
+ imageProps={{
78
+ alt: "Alt text",
79
+ aspectRatio: "twoByOne",
80
+ src: "https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
81
+ }}
83
82
  >
84
- <CardHeading level={HeadingLevels.Four} id="heading1">
83
+ <CardHeading level="four" id="heading1">
85
84
  Tom Nook
86
85
  </CardHeading>
87
86
  <CardContent>
@@ -107,19 +106,19 @@ const accordionData = [
107
106
  args={{
108
107
  accordionData: [
109
108
  {
110
- accordionType: AccordionTypes.Default,
109
+ accordionType: "default",
111
110
  label: "Tom Nook",
112
111
  panel: (
113
112
  <Card
114
113
  imageProps={{
115
114
  alt: "Alt text",
116
- aspectRatio: ImageRatios.TwoByOne,
115
+ aspectRatio: "twoByOne",
117
116
  src: "https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
118
117
  }}
119
118
  isCentered
120
- layout={LayoutTypes.Row}
119
+ layout="row"
121
120
  >
122
- <CardHeading level={HeadingLevels.Four} id="heading1">
121
+ <CardHeading level="four" id="heading1">
123
122
  Tom Nook
124
123
  </CardHeading>
125
124
  <CardContent>
@@ -144,19 +143,19 @@ const accordionData = [
144
143
  ```jsx
145
144
  const accordionData = [
146
145
  {
147
- accordionType: AccordionTypes.Default,
146
+ accordionType: "default",
148
147
  label: "Tom Nook",
149
148
  panel: (
150
149
  <Card
151
150
  imageProps={{
152
151
  alt: "Alt text",
153
- aspectRatio: ImageRatios.TwoByOne,
152
+ aspectRatio: "twoByOne",
154
153
  src: "https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
155
154
  }}
156
155
  isCentered
157
- layout={LayoutTypes.Row}
156
+ layout="row"
158
157
  >
159
- <CardHeading level={HeadingLevels.Four} id="heading1">
158
+ <CardHeading level="four" id="heading1">
160
159
  Tom Nook
161
160
  </CardHeading>
162
161
  <CardContent>
@@ -192,19 +191,19 @@ Resources:
192
191
 
193
192
  export const faqContent = [
194
193
  {
195
- accordionType: AccordionTypes.Default,
194
+ accordionType: "default",
196
195
  label: "Tom Nook",
197
196
  panel: (
198
197
  <Card
199
198
  imageProps={{
200
199
  alt: "Alt text",
201
- aspectRatio: ImageRatios.TwoByOne,
200
+ aspectRatio: "twoByOne",
202
201
  src: "https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
203
202
  }}
204
203
  isCentered
205
- layout={LayoutTypes.Row}
204
+ layout="row"
206
205
  >
207
- <CardHeading level={HeadingLevels.Four} id="heading1-tom">
206
+ <CardHeading level="four" id="heading1-tom">
208
207
  Tom Nook
209
208
  </CardHeading>
210
209
  <CardContent>
@@ -215,19 +214,19 @@ export const faqContent = [
215
214
  ),
216
215
  },
217
216
  {
218
- accordionType: AccordionTypes.Warning,
217
+ accordionType: "warning",
219
218
  label: "Isabelle",
220
219
  panel: (
221
220
  <Card
222
221
  imageProps={{
223
222
  alt: "Alt text",
224
- aspectRatio: ImageRatios.TwoByOne,
223
+ aspectRatio: "twoByOne",
225
224
  src: "https://play.nintendo.com/images/AC_Isabelle_7XU6aGu.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
226
225
  }}
227
226
  isCentered
228
- layout={LayoutTypes.Row}
227
+ layout="row"
229
228
  >
230
- <CardHeading level={HeadingLevels.Four} id="heading1-isabelle">
229
+ <CardHeading level="four" id="heading1-isabelle">
231
230
  Isabelle
232
231
  </CardHeading>
233
232
  <CardContent>
@@ -240,19 +239,19 @@ export const faqContent = [
240
239
  ),
241
240
  },
242
241
  {
243
- accordionType: AccordionTypes.Error,
242
+ accordionType: "error",
244
243
  label: "K.K. Slider",
245
244
  panel: (
246
245
  <Card
247
246
  imageProps={{
248
247
  alt: "Alt text",
249
- aspectRatio: ImageRatios.TwoByOne,
248
+ aspectRatio: "twoByOne",
250
249
  src: "https://play.nintendo.com/images/AC_KK_jh4yj5t.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
251
250
  }}
252
251
  isCentered
253
- layout={LayoutTypes.Row}
252
+ layout="row"
254
253
  >
255
- <CardHeading level={HeadingLevels.Four} id="heading1-kkslider">
254
+ <CardHeading level="four" id="heading1-kkslider">
256
255
  K.K. Slider
257
256
  </CardHeading>
258
257
  <CardContent>
@@ -280,19 +279,19 @@ one object in the array passed into the `accordionData` prop.
280
279
  ```jsx
281
280
  export const faqContent = [
282
281
  {
283
- accordionType: AccordionTypes.Default,
282
+ accordionType: "default",
284
283
  label: "Tom Nook",
285
284
  panel: (
286
285
  <Card
287
286
  imageProps={{
288
287
  alt: "Alt text",
289
- aspectRatio: ImageRatios.TwoByOne,
288
+ aspectRatio: "twoByOne",
290
289
  src: "https://play.nintendo.com/images/AC_Tom_FRYtwIN.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
291
290
  }}
292
291
  isCentered
293
- layout={LayoutTypes.Row}
292
+ layout="row"
294
293
  >
295
- <CardHeading level={HeadingLevels.Four} id="heading1-tom">
294
+ <CardHeading level="four" id="heading1-tom">
296
295
  Tom Nook
297
296
  </CardHeading>
298
297
  <CardContent>
@@ -303,19 +302,19 @@ export const faqContent = [
303
302
  ),
304
303
  },
305
304
  {
306
- accordionType: AccordionTypes.Warning,
305
+ accordionType: "warning",
307
306
  label: "Isabelle",
308
307
  panel: (
309
308
  <Card
310
309
  imageProps={{
311
310
  alt: "Alt text",
312
- aspectRatio: ImageRatios.TwoByOne,
311
+ aspectRatio: "twoByOne",
313
312
  src: "https://play.nintendo.com/images/AC_Isabelle_7XU6aGu.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
314
313
  }}
315
314
  isCentered
316
- layout={LayoutTypes.Row}
315
+ layout="row"
317
316
  >
318
- <CardHeading level={HeadingLevels.Four} id="heading1-isabelle">
317
+ <CardHeading level="four" id="heading1-isabelle">
319
318
  Isabelle
320
319
  </CardHeading>
321
320
  <CardContent>
@@ -328,19 +327,19 @@ export const faqContent = [
328
327
  ),
329
328
  },
330
329
  {
331
- accordionType: AccordionTypes.Error,
330
+ accordionType: "error",
332
331
  label: "K.K. Slider",
333
332
  panel: (
334
333
  <Card
335
334
  imageProps={{
336
335
  alt: "Alt text",
337
- aspectRatio: ImageRatios.TwoByOne,
336
+ aspectRatio: "twoByOne",
338
337
  src: "https://play.nintendo.com/images/AC_KK_jh4yj5t.17345b1513ac044897cfc243542899dce541e8dc.9afde10b.png",
339
338
  }}
340
339
  isCentered
341
- layout={LayoutTypes.Row}
340
+ layout="row"
342
341
  >
343
- <CardHeading level={HeadingLevels.Four} id="heading1-kkslider">
342
+ <CardHeading level="four" id="heading1-kkslider">
344
343
  K.K. Slider
345
344
  </CardHeading>
346
345
  <CardContent>
@@ -5,11 +5,7 @@ import renderer from "react-test-renderer";
5
5
  import userEvent from "@testing-library/user-event";
6
6
 
7
7
  import Accordion from "./Accordion";
8
- import { AccordionTypes } from "./AccordionTypes";
9
8
  import Card, { CardContent, CardHeading } from "../Card/Card";
10
- import { HeadingLevels } from "../Heading/HeadingTypes";
11
- import { ImageRatios } from "../Image/ImageTypes";
12
- import { LayoutTypes } from "../../helpers/enums";
13
9
 
14
10
  describe("Accordion Accessibility", () => {
15
11
  it("passes axe accessibility test for one item", async () => {
@@ -166,13 +162,13 @@ describe("Accordion", () => {
166
162
  id="card"
167
163
  imageProps={{
168
164
  alt: "Alt text",
169
- aspectRatio: ImageRatios.TwoByOne,
165
+ aspectRatio: "twoByOne",
170
166
  src: "https://cdn.onebauer.media/one/media/6176/76fd/405b/ab5f/f20f/2d52/gerri-1500-1.jpg?format=jpg&quality=80&width=850&ratio=1-1&resize=aspectfit",
171
167
  }}
172
168
  isCentered
173
- layout={LayoutTypes.Row}
169
+ layout="row"
174
170
  >
175
- <CardHeading id="heading1" level={HeadingLevels.Four}>
171
+ <CardHeading id="heading1" level="four">
176
172
  Gerry Kellman
177
173
  </CardHeading>
178
174
  <CardContent>
@@ -196,9 +192,7 @@ describe("Accordion", () => {
196
192
  const withError = renderer
197
193
  .create(
198
194
  <Accordion
199
- accordionData={[
200
- { ...accordionData[0], accordionType: AccordionTypes.Error },
201
- ]}
195
+ accordionData={[{ ...accordionData[0], accordionType: "error" }]}
202
196
  id="accordian"
203
197
  isDefaultOpen
204
198
  />
@@ -207,9 +201,7 @@ describe("Accordion", () => {
207
201
  const withWarning = renderer
208
202
  .create(
209
203
  <Accordion
210
- accordionData={[
211
- { ...accordionData[0], accordionType: AccordionTypes.Warning },
212
- ]}
204
+ accordionData={[{ ...accordionData[0], accordionType: "warning" }]}
213
205
  id="accordian"
214
206
  isDefaultOpen
215
207
  />
@@ -1,22 +1,21 @@
1
1
  import {
2
2
  Accordion as ChakraAccordion,
3
- AccordionItem,
4
3
  AccordionButton,
4
+ AccordionItem,
5
5
  AccordionPanel,
6
6
  Box,
7
7
  chakra,
8
8
  } from "@chakra-ui/react";
9
9
  import * as React from "react";
10
10
 
11
- import { AccordionTypes } from "./AccordionTypes";
12
11
  import Icon from "../Icons/Icon";
13
- import { IconNames, IconSizes } from "../Icons/IconTypes";
12
+
13
+ export type AccordionTypes = "default" | "warning" | "error";
14
14
  export interface AccordionDataProps {
15
15
  accordionType?: AccordionTypes;
16
16
  label: string;
17
17
  panel: string | React.ReactNode;
18
18
  }
19
-
20
19
  export interface AccordionProps {
21
20
  /** Array of data to display, and an optional accordionType */
22
21
  accordionData: AccordionDataProps[];
@@ -30,14 +29,10 @@ export interface AccordionProps {
30
29
  * Get the minus or plus icon depending on whether the accordion
31
30
  * is open or closed.
32
31
  */
33
- const getIcon = (isExpanded = false, index, id) => {
34
- const iconName = isExpanded ? IconNames.Minus : IconNames.Plus;
32
+ const getIcon = (isExpanded = false, index: number, id: string) => {
33
+ const iconName = isExpanded ? "minus" : "plus";
35
34
  return (
36
- <Icon
37
- id={`accordion-${id}-icon-${index}`}
38
- name={iconName}
39
- size={IconSizes.Small}
40
- />
35
+ <Icon id={`accordion-${id}-icon-${index}`} name={iconName} size="small" />
41
36
  );
42
37
  };
43
38
 
@@ -46,15 +41,15 @@ const getIcon = (isExpanded = false, index, id) => {
46
41
  * array. This automatically creates the `AccordionButton` and `AccordionPanel`
47
42
  * combination that is required for the Chakra `Accordion` component.
48
43
  */
49
- const getElementsFromData = (data = [], id) => {
44
+ const getElementsFromData = (data: AccordionDataProps[] = [], id: string) => {
50
45
  const colorMap = {
51
- [AccordionTypes.Default]: "ui.white",
52
- [AccordionTypes.Warning]: "ui.status.primary",
53
- [AccordionTypes.Error]: "ui.status.secondary",
46
+ default: "ui.white",
47
+ warning: "ui.status.primary",
48
+ error: "ui.status.secondary",
54
49
  };
55
50
  // For FAQ-style multiple accordions, the button should be bigger.
56
51
  // Otherwise, use the default.
57
- const multiplePadding = data?.length > 1 ? 4 : null;
52
+ const multiplePadding = data?.length > 1 ? "4" : "initial";
58
53
 
59
54
  return data.map((content, index) => {
60
55
  // This is done to support both string and DOM element input.
@@ -124,11 +119,12 @@ export const Accordion = chakra((props: AccordionProps) => {
124
119
  const { accordionData, id, isDefaultOpen = false, ...rest } = props;
125
120
 
126
121
  // Pass `0` to open the first accordion in the 0-index based array.
127
- const openFirstAccordion = isDefaultOpen ? 0 : undefined;
122
+ const openFirstAccordion = isDefaultOpen ? [0] : undefined;
123
+
128
124
  return (
129
125
  <ChakraAccordion
130
126
  id={id}
131
- defaultIndex={[openFirstAccordion]}
127
+ defaultIndex={openFirstAccordion}
132
128
  allowMultiple
133
129
  {...rest}
134
130
  >