@nypl/design-system-react-components 0.27.0 → 0.28.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 (298) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/components/Accordion/Accordion.d.ts +1 -1
  3. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  4. package/dist/components/Button/Button.d.ts +2 -10
  5. package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
  6. package/dist/components/Card/Card.d.ts +2 -2
  7. package/dist/components/Checkbox/Checkbox.d.ts +10 -8
  8. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  9. package/dist/components/DatePicker/DatePicker.d.ts +1 -1
  10. package/dist/components/Form/Form.d.ts +2 -2
  11. package/dist/components/Grid/SimpleGrid.d.ts +6 -3
  12. package/dist/components/Heading/Heading.d.ts +2 -5
  13. package/dist/components/HelperErrorText/HelperErrorText.d.ts +1 -5
  14. package/dist/components/Hero/Hero.d.ts +13 -9
  15. package/dist/components/Icons/Icon.d.ts +6 -5
  16. package/dist/components/Icons/IconSvgs.d.ts +21 -21
  17. package/dist/components/Image/Image.d.ts +8 -5
  18. package/dist/components/Link/Link.d.ts +1 -9
  19. package/dist/components/List/List.d.ts +7 -11
  20. package/dist/components/Logo/Logo.d.ts +2 -5
  21. package/dist/components/Logo/LogoSvgs.d.ts +39 -39
  22. package/dist/components/Notification/Notification.d.ts +1 -1
  23. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
  24. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  25. package/dist/components/SearchBar/SearchBar.d.ts +3 -2
  26. package/dist/components/Select/Select.d.ts +2 -5
  27. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
  28. package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
  29. package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
  30. package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
  31. package/dist/components/Table/Table.d.ts +1 -1
  32. package/dist/components/Template/Template.d.ts +2 -0
  33. package/dist/components/Text/Text.d.ts +1 -1
  34. package/dist/components/TextInput/TextInput.d.ts +21 -9
  35. package/dist/components/Toggle/Toggle.d.ts +1 -5
  36. package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
  37. package/dist/design-system-react-components.cjs.development.js +856 -1155
  38. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  39. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  40. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  41. package/dist/design-system-react-components.esm.js +858 -1220
  42. package/dist/design-system-react-components.esm.js.map +1 -1
  43. package/dist/helpers/types.d.ts +1 -0
  44. package/dist/index.d.ts +26 -47
  45. package/dist/theme/components/buttonGroup.d.ts +11 -0
  46. package/dist/theme/components/card.d.ts +104 -8
  47. package/dist/theme/components/componentWrapper.d.ts +4 -3
  48. package/dist/theme/components/customTable.d.ts +11 -14
  49. package/dist/theme/components/fieldset.d.ts +4 -3
  50. package/dist/theme/components/helperErrorText.d.ts +4 -3
  51. package/dist/theme/components/hero.d.ts +1 -1
  52. package/dist/theme/components/horizontalRule.d.ts +4 -3
  53. package/dist/theme/components/icon.d.ts +47743 -1
  54. package/dist/theme/components/image.d.ts +563 -10
  55. package/dist/theme/components/label.d.ts +4 -3
  56. package/dist/theme/components/list.d.ts +6 -7
  57. package/dist/theme/components/logo.d.ts +474 -1
  58. package/dist/theme/components/notification.d.ts +20 -16
  59. package/dist/theme/components/progressIndicator.d.ts +6 -4
  60. package/dist/theme/components/select.d.ts +4 -4
  61. package/dist/theme/components/skeletonLoader.d.ts +14 -10
  62. package/dist/theme/components/skipNavigation.d.ts +22 -0
  63. package/dist/theme/components/slider.d.ts +7 -6
  64. package/dist/theme/components/structuredContent.d.ts +10 -9
  65. package/dist/theme/components/text.d.ts +7 -1
  66. package/dist/theme/components/toggle.d.ts +6 -4
  67. package/dist/theme/provider.d.ts +2 -4
  68. package/dist/utils/componentCategories.d.ts +1 -1
  69. package/dist/utils/interfaces.d.ts +5 -0
  70. package/dist/utils/utils.d.ts +2 -18
  71. package/package.json +2 -2
  72. package/src/__tests__/setup.ts +3 -3
  73. package/src/__tests__/utils/utils.test.ts +1 -23
  74. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
  75. package/src/components/Accordion/Accordion.stories.mdx +43 -44
  76. package/src/components/Accordion/Accordion.test.tsx +5 -13
  77. package/src/components/Accordion/Accordion.tsx +14 -18
  78. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
  79. package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
  80. package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
  81. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
  82. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
  83. package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
  84. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
  85. package/src/components/Button/Button.stories.mdx +89 -126
  86. package/src/components/Button/Button.test.tsx +16 -30
  87. package/src/components/Button/Button.tsx +14 -20
  88. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
  89. package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
  90. package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
  91. package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
  92. package/src/components/Card/Card.stories.mdx +143 -177
  93. package/src/components/Card/Card.test.tsx +36 -97
  94. package/src/components/Card/Card.tsx +78 -74
  95. package/src/components/Chakra/Box.stories.mdx +2 -6
  96. package/src/components/Chakra/Center.stories.mdx +5 -23
  97. package/src/components/Chakra/Flex.stories.mdx +4 -6
  98. package/src/components/Chakra/Stack.stories.mdx +9 -10
  99. package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
  100. package/src/components/Checkbox/Checkbox.test.tsx +2 -2
  101. package/src/components/Checkbox/Checkbox.tsx +20 -13
  102. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +6 -17
  103. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -7
  104. package/src/components/CheckboxGroup/CheckboxGroup.tsx +33 -29
  105. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -11
  106. package/src/components/ComponentWrapper/ComponentWrapper.tsx +3 -10
  107. package/src/components/DatePicker/DatePicker.stories.mdx +23 -37
  108. package/src/components/DatePicker/DatePicker.test.tsx +21 -19
  109. package/src/components/DatePicker/DatePicker.tsx +57 -49
  110. package/src/components/Form/Form.stories.mdx +46 -31
  111. package/src/components/Form/Form.test.tsx +1 -18
  112. package/src/components/Form/Form.tsx +7 -7
  113. package/src/components/Grid/SimpleGrid.stories.mdx +73 -49
  114. package/src/components/Grid/SimpleGrid.test.tsx +7 -9
  115. package/src/components/Grid/SimpleGrid.tsx +14 -11
  116. package/src/components/Heading/Heading.stories.mdx +27 -72
  117. package/src/components/Heading/Heading.test.tsx +18 -44
  118. package/src/components/Heading/Heading.tsx +7 -10
  119. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -3
  120. package/src/components/HelperErrorText/HelperErrorText.tsx +1 -5
  121. package/src/components/Hero/Hero.stories.mdx +219 -216
  122. package/src/components/Hero/Hero.test.tsx +107 -223
  123. package/src/components/Hero/Hero.tsx +63 -61
  124. package/src/components/Icons/Icon.stories.mdx +172 -118
  125. package/src/components/Icons/Icon.test.tsx +8 -16
  126. package/src/components/Icons/Icon.tsx +75 -29
  127. package/src/components/Icons/IconSvgs.tsx +42 -42
  128. package/src/components/Image/Image.stories.mdx +45 -132
  129. package/src/components/Image/Image.test.tsx +16 -31
  130. package/src/components/Image/Image.tsx +28 -12
  131. package/src/components/Link/Link.stories.mdx +30 -80
  132. package/src/components/Link/Link.test.tsx +25 -53
  133. package/src/components/Link/Link.tsx +43 -56
  134. package/src/components/Link/__snapshots__/Link.test.tsx.snap +1 -2
  135. package/src/components/List/List.stories.mdx +20 -31
  136. package/src/components/List/List.test.tsx +24 -43
  137. package/src/components/List/List.tsx +25 -36
  138. package/src/components/Logo/Logo.stories.mdx +94 -50
  139. package/src/components/Logo/Logo.test.tsx +10 -19
  140. package/src/components/Logo/Logo.tsx +50 -17
  141. package/src/components/Logo/LogoSvgs.tsx +78 -78
  142. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +4 -4
  143. package/src/components/Modal/Modal.stories.mdx +8 -9
  144. package/src/components/Modal/Modal.test.tsx +5 -10
  145. package/src/components/Modal/Modal.tsx +1 -1
  146. package/src/components/Notification/Notification.stories.mdx +10 -28
  147. package/src/components/Notification/Notification.test.tsx +9 -12
  148. package/src/components/Notification/Notification.tsx +34 -37
  149. package/src/components/Pagination/Pagination.stories.mdx +2 -2
  150. package/src/components/Pagination/Pagination.tsx +15 -10
  151. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +27 -53
  152. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +9 -10
  153. package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -21
  154. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -10
  155. package/src/components/Radio/Radio.stories.mdx +1 -1
  156. package/src/components/Radio/Radio.tsx +9 -6
  157. package/src/components/RadioGroup/RadioGroup.stories.mdx +15 -16
  158. package/src/components/RadioGroup/RadioGroup.test.tsx +2 -8
  159. package/src/components/RadioGroup/RadioGroup.tsx +28 -24
  160. package/src/components/SearchBar/SearchBar.stories.mdx +1 -1
  161. package/src/components/SearchBar/SearchBar.test.tsx +1 -1
  162. package/src/components/SearchBar/SearchBar.tsx +14 -22
  163. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +0 -12
  164. package/src/components/Select/Select.stories.mdx +8 -23
  165. package/src/components/Select/Select.test.tsx +6 -7
  166. package/src/components/Select/Select.tsx +13 -26
  167. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +17 -56
  168. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -21
  169. package/src/components/SkeletonLoader/SkeletonLoader.tsx +9 -8
  170. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +33 -33
  171. package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
  172. package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
  173. package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
  174. package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
  175. package/src/components/Slider/Slider.stories.mdx +19 -53
  176. package/src/components/Slider/Slider.test.tsx +2 -2
  177. package/src/components/Slider/Slider.tsx +10 -12
  178. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2 -9
  179. package/src/components/StatusBadge/StatusBadge.stories.mdx +6 -21
  180. package/src/components/StatusBadge/StatusBadge.test.tsx +2 -3
  181. package/src/components/StatusBadge/StatusBadge.tsx +3 -10
  182. package/src/components/StructuredContent/StructuredContent.stories.mdx +30 -58
  183. package/src/components/StructuredContent/StructuredContent.test.tsx +42 -44
  184. package/src/components/StructuredContent/StructuredContent.tsx +9 -18
  185. package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -23
  186. package/src/components/StyleGuide/Buttons.stories.mdx +62 -62
  187. package/src/components/StyleGuide/ColorCard.tsx +2 -4
  188. package/src/components/StyleGuide/Colors.stories.mdx +7 -8
  189. package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
  190. package/src/components/StyleGuide/Forms.stories.mdx +0 -1
  191. package/src/components/StyleGuide/Iconography.stories.mdx +59 -77
  192. package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
  193. package/src/components/StyleGuide/Typography.stories.mdx +15 -18
  194. package/src/components/Table/Table.stories.mdx +85 -1
  195. package/src/components/Table/Table.test.tsx +57 -1
  196. package/src/components/Table/Table.tsx +7 -4
  197. package/src/components/Table/__snapshots__/Table.test.tsx.snap +121 -0
  198. package/src/components/Tabs/Tabs.stories.mdx +1 -1
  199. package/src/components/Tabs/Tabs.test.tsx +2 -2
  200. package/src/components/Tabs/Tabs.tsx +26 -27
  201. package/src/components/Template/Template.stories.mdx +49 -54
  202. package/src/components/Template/Template.tsx +9 -3
  203. package/src/components/Text/Text.stories.mdx +5 -11
  204. package/src/components/Text/Text.test.tsx +3 -6
  205. package/src/components/Text/Text.tsx +3 -5
  206. package/src/components/TextInput/TextInput.stories.mdx +10 -22
  207. package/src/components/TextInput/TextInput.test.tsx +32 -62
  208. package/src/components/TextInput/TextInput.tsx +61 -30
  209. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +1 -0
  210. package/src/components/Toggle/Toggle.stories.mdx +5 -16
  211. package/src/components/Toggle/Toggle.test.tsx +2 -3
  212. package/src/components/Toggle/Toggle.tsx +9 -10
  213. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +13 -29
  214. package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -23
  215. package/src/components/VideoPlayer/VideoPlayer.tsx +13 -10
  216. package/src/docs/Chakra.stories.mdx +14 -11
  217. package/src/docs/Welcome.stories.mdx +23 -43
  218. package/src/helpers/types.ts +1 -0
  219. package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
  220. package/src/hooks/useNYPLTheme.stories.mdx +3 -6
  221. package/src/index.ts +51 -45
  222. package/src/theme/components/buttonGroup.ts +10 -0
  223. package/src/theme/components/card.ts +50 -15
  224. package/src/theme/components/componentWrapper.ts +5 -1
  225. package/src/theme/components/customTable.ts +8 -2
  226. package/src/theme/components/fieldset.ts +5 -1
  227. package/src/theme/components/helperErrorText.ts +5 -1
  228. package/src/theme/components/hero.ts +2 -2
  229. package/src/theme/components/horizontalRule.ts +5 -1
  230. package/src/theme/components/icon.ts +7 -1
  231. package/src/theme/components/image.ts +14 -3
  232. package/src/theme/components/label.ts +5 -1
  233. package/src/theme/components/list.ts +8 -2
  234. package/src/theme/components/logo.ts +5 -1
  235. package/src/theme/components/notification.ts +38 -14
  236. package/src/theme/components/progressIndicator.ts +10 -5
  237. package/src/theme/components/select.ts +5 -2
  238. package/src/theme/components/skeletonLoader.ts +8 -2
  239. package/src/theme/components/skipNavigation.ts +26 -0
  240. package/src/theme/components/slider.ts +13 -1
  241. package/src/theme/components/structuredContent.ts +11 -1
  242. package/src/theme/components/text.ts +12 -5
  243. package/src/theme/components/toggle.ts +9 -3
  244. package/src/theme/index.ts +4 -0
  245. package/src/theme/provider.tsx +1 -1
  246. package/src/utils/componentCategories.ts +13 -5
  247. package/src/utils/interfaces.ts +5 -0
  248. package/src/utils/utils.ts +2 -32
  249. package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
  250. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
  251. package/dist/components/Button/ButtonTypes.d.ts +0 -8
  252. package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
  253. package/dist/components/Form/FormTypes.d.ts +0 -2
  254. package/dist/components/Grid/GridTypes.d.ts +0 -9
  255. package/dist/components/Heading/HeadingTypes.d.ts +0 -14
  256. package/dist/components/Hero/HeroTypes.d.ts +0 -12
  257. package/dist/components/Icons/IconTypes.d.ts +0 -77
  258. package/dist/components/Image/ImageTypes.d.ts +0 -22
  259. package/dist/components/Link/LinkTypes.d.ts +0 -8
  260. package/dist/components/List/ListTypes.d.ts +0 -5
  261. package/dist/components/Logo/LogoTypes.d.ts +0 -54
  262. package/dist/components/Notification/NotificationTypes.d.ts +0 -5
  263. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
  264. package/dist/components/Select/SelectTypes.d.ts +0 -8
  265. package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
  266. package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
  267. package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
  268. package/dist/components/Text/TextTypes.d.ts +0 -6
  269. package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
  270. package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
  271. package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
  272. package/dist/helpers/enums.d.ts +0 -4
  273. package/dist/utils/siteSections.d.ts +0 -2
  274. package/src/components/Accordion/AccordionTypes.tsx +0 -5
  275. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
  276. package/src/components/Button/ButtonTypes.tsx +0 -8
  277. package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
  278. package/src/components/Form/FormTypes.tsx +0 -3
  279. package/src/components/Grid/GridTypes.tsx +0 -9
  280. package/src/components/Heading/HeadingTypes.tsx +0 -15
  281. package/src/components/Hero/HeroTypes.tsx +0 -20
  282. package/src/components/Icons/IconTypes.tsx +0 -83
  283. package/src/components/Image/ImageTypes.ts +0 -24
  284. package/src/components/Link/LinkTypes.tsx +0 -8
  285. package/src/components/List/ListTypes.tsx +0 -5
  286. package/src/components/Logo/LogoTypes.tsx +0 -56
  287. package/src/components/Notification/NotificationTypes.tsx +0 -5
  288. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
  289. package/src/components/Select/SelectTypes.tsx +0 -10
  290. package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
  291. package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
  292. package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
  293. package/src/components/Text/TextTypes.tsx +0 -6
  294. package/src/components/TextInput/TextInputTypes.tsx +0 -48
  295. package/src/components/Toggle/ToggleTypes.tsx +0 -4
  296. package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
  297. package/src/helpers/enums.ts +0 -4
  298. package/src/utils/siteSections.ts +0 -10
@@ -1,3 +1,10 @@
1
+ interface CustomSliderBaseStyle {
2
+ isDisabled: boolean;
3
+ isInvalid: boolean;
4
+ showBoxes: boolean;
5
+ showValues: boolean;
6
+ }
7
+
1
8
  // Margins around the static display values.
2
9
  const staticValues = {
3
10
  marginTop: "xs",
@@ -16,7 +23,12 @@ const CustomSlider = {
16
23
  "track",
17
24
  "thumb",
18
25
  ],
19
- baseStyle: ({ isDisabled, isInvalid, showBoxes, showValues }) => {
26
+ baseStyle: ({
27
+ isDisabled,
28
+ isInvalid,
29
+ showBoxes,
30
+ showValues,
31
+ }: CustomSliderBaseStyle) => {
20
32
  let baseColor = "ui.link.primary";
21
33
  if (isInvalid) {
22
34
  baseColor = "ui.error.primary";
@@ -9,9 +9,19 @@ import {
9
9
  baseUnorderedStyles,
10
10
  } from "./list";
11
11
 
12
+ interface StructuredContentBaseStyle {
13
+ hasFigureImage: boolean;
14
+ imageAspectRatio: string;
15
+ imagePosition: string;
16
+ }
17
+
12
18
  const StructuredContent = {
13
19
  parts: ["image", "imageFigure", "imageWrapper"],
14
- baseStyle: ({ hasFigureImage, imageAspectRatio, imagePosition }) => {
20
+ baseStyle: ({
21
+ hasFigureImage,
22
+ imageAspectRatio,
23
+ imagePosition,
24
+ }: StructuredContentBaseStyle) => {
15
25
  const styles: { maxWidth?: string } = {};
16
26
  const wrapperStyles = {
17
27
  float: [
@@ -1,3 +1,10 @@
1
+ interface TextBaseStyle {
2
+ isBold: boolean;
3
+ isItalic: boolean;
4
+ noSpace: boolean;
5
+ variant: string;
6
+ }
7
+
1
8
  const variants = {
2
9
  default: {},
3
10
  caption: {
@@ -11,18 +18,18 @@ const variants = {
11
18
  },
12
19
  };
13
20
  const Text = {
14
- baseStyle: (props) => {
15
- const fontWeight = props.isBold
16
- ? props.variant === "tag" || props.variant === "mini"
21
+ baseStyle: ({ isBold, isItalic, noSpace, variant }: TextBaseStyle) => {
22
+ const fontWeight = isBold
23
+ ? variant === "tag" || variant === "mini"
17
24
  ? "medium"
18
25
  : "bold"
19
26
  : null;
20
- const fontStyle = props.isItalic ? "italic" : null;
27
+ const fontStyle = isItalic ? "italic" : null;
21
28
 
22
29
  return {
23
30
  fontStyle: fontStyle,
24
31
  fontWeight: fontWeight,
25
- marginBottom: props.noSpace ? "0 !important" : null,
32
+ marginBottom: noSpace ? "0 !important" : null,
26
33
  };
27
34
  },
28
35
  variants,
@@ -1,10 +1,16 @@
1
1
  import { cssVar } from "@chakra-ui/theme-tools";
2
- import { ToggleSizes } from "../../components/Toggle/ToggleTypes";
3
2
 
4
- const toggleBaseStyle = ({ isDisabled, size }) => {
3
+ import { ToggleSizes } from "../../components/Toggle/Toggle";
4
+
5
+ interface ToggleBaseStyle {
6
+ isDisabled: boolean;
7
+ size: ToggleSizes;
8
+ }
9
+
10
+ const toggleBaseStyle = ({ isDisabled, size }: ToggleBaseStyle) => {
5
11
  const label = { alignItems: "start", display: "flex", width: "fit-content" };
6
12
  const helperErrorText = {
7
- marginLeft: size === ToggleSizes.Default ? "xxl" : "xl",
13
+ marginLeft: size === "default" ? "xxl" : "xl",
8
14
  fontStyle: isDisabled ? "italic" : null,
9
15
  };
10
16
  return {
@@ -11,6 +11,7 @@ import typography from "./foundations/typography";
11
11
  import Accordion from "./components/accordion";
12
12
  import Breadcrumb from "./components/breadcrumb";
13
13
  import Button from "./components/button";
14
+ import ButtonGroup from "./components/buttonGroup";
14
15
  import Card from "./components/card";
15
16
  import Checkbox from "./components/checkbox";
16
17
  import ComponentWrapper from "./components/componentWrapper";
@@ -35,6 +36,7 @@ import Radio from "./components/radio";
35
36
  import RadioGroup from "./components/radioGroup";
36
37
  import SearchBar from "./components/searchBar";
37
38
  import { Skeleton, SkeletonLoader } from "./components/skeletonLoader";
39
+ import SkipNavigation from "./components/skipNavigation";
38
40
  import CustomSlider from "./components/slider";
39
41
  import StatusBadge from "./components/statusBadge";
40
42
  import StructuredContent from "./components/structuredContent";
@@ -80,6 +82,7 @@ const theme = extendTheme({
80
82
  Accordion,
81
83
  Breadcrumb,
82
84
  Button,
85
+ ButtonGroup,
83
86
  ...Card,
84
87
  Checkbox,
85
88
  CheckboxGroup,
@@ -106,6 +109,7 @@ const theme = extendTheme({
106
109
  SearchBar,
107
110
  Skeleton,
108
111
  SkeletonLoader,
112
+ SkipNavigation,
109
113
  CustomSlider,
110
114
  StatusBadge,
111
115
  StructuredContent,
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { ChakraProvider } from "@chakra-ui/react";
3
3
  import theme from "./index";
4
4
 
5
- const DSProvider = ({ children }) => (
5
+ const DSProvider = ({ children }: React.PropsWithChildren<{}>) => (
6
6
  <ChakraProvider theme={theme}>{children}</ChakraProvider>
7
7
  );
8
8
 
@@ -53,6 +53,7 @@ const categories = {
53
53
  title: "Components/Form Elements",
54
54
  components: [
55
55
  "Button",
56
+ "ButtonGroup",
56
57
  "Checkbox",
57
58
  "CheckboxGroup",
58
59
  "DatePicker",
@@ -108,7 +109,14 @@ const categories = {
108
109
  },
109
110
  navigation: {
110
111
  title: "Components/Navigation",
111
- components: ["Breadcrumbs", "Link", "Menu", "Pagination", "Subnavigation"],
112
+ components: [
113
+ "Breadcrumbs",
114
+ "Link",
115
+ "Menu",
116
+ "Pagination",
117
+ "SkipNavigation",
118
+ "Subnavigation",
119
+ ],
112
120
  },
113
121
  styleguide: {
114
122
  title: "Style Guide",
@@ -131,11 +139,11 @@ const categories = {
131
139
  },
132
140
  };
133
141
 
134
- export const getCategory = (component) => {
142
+ export const getCategory = (component: string) => {
135
143
  let catPath = component;
136
- Object.keys(categories).forEach((key) => {
137
- const t = categories[key].title;
138
- const c = categories[key].components;
144
+ Object.keys(categories).forEach((key: string) => {
145
+ const t = categories[key as keyof typeof categories].title;
146
+ const c = categories[key as keyof typeof categories].components;
139
147
  if (c.includes(component)) {
140
148
  catPath = `${t}/${component}`;
141
149
  }
@@ -0,0 +1,5 @@
1
+ export interface AriaAttributes {
2
+ "aria-label"?: string;
3
+ "aria-describedby"?: string;
4
+ "aria-labelledby"?: string;
5
+ }
@@ -15,43 +15,13 @@ export const range = (start: number, stop: number, step = 1): number[] => {
15
15
  .map((x, y) => x + y * step);
16
16
  };
17
17
 
18
- /**
19
- * Map an enum value to a component's Chakra theme variant object. If a wrong
20
- * value is passed (typically in non-Typescript scenarios), then the "fallback"
21
- * value, if provided, will be used.
22
- */
23
- export const getVariant = (variant, collection, fallback = null) => {
24
- const variantMap = {};
25
- for (const type in collection) {
26
- variantMap[collection[type]] = collection[type];
27
- }
28
- return variantMap[variant] || fallback;
29
- };
30
-
31
- /**
32
- * Given an enum object and its name, this will return (1) an array `options`
33
- * of all values with the enum name as the prefix, and (2) a function that
34
- * returns the correct enum value given a string from the `options` array.
35
- * @NOTE this is only used for Storybook documentation.
36
- */
37
- export const getStorybookEnumValues = (enumObject, name) => {
38
- const options = Object.keys(enumObject).map((key) => `${name}.${key}`);
39
- const getValue = (key) => {
40
- // In case no value is passed, return the first value from the array above
41
- // as the default. Otherwise, remove the dot from the string and get the
42
- // last part to be able to get the correct enum value.
43
- return !key ? options[0] : enumObject[key.substr(key.indexOf(".") + 1)];
44
- };
45
- return { options, getValue };
46
- };
47
-
48
18
  /**
49
19
  * Given a pagination's pageCount, this will return (1) a page number,
50
20
  * derived from the current URL, and (2) a function that, when passed to
51
21
  * Pagination component, makes the URL change and refreshes the page.
52
22
  * @NOTE this is only used for Storybook documentation.
53
23
  */
54
- export const getStorybookHrefProps = (pageCount) => {
24
+ export const getStorybookHrefProps = (pageCount: number) => {
55
25
  // This uses the `addon-queryparams` Storybook addon.
56
26
  const urlParams = new URLSearchParams(document.location.search);
57
27
  const pageParam = urlParams.get("page");
@@ -66,7 +36,7 @@ export const getStorybookHrefProps = (pageCount) => {
66
36
  const location = window.location;
67
37
  // Passing this function into `Pagination` makes the URL to change
68
38
  // and refreshes the page.
69
- const getPageHref = (selectedPage) => {
39
+ const getPageHref = (selectedPage: number) => {
70
40
  return `${location.href}&page=${selectedPage}`;
71
41
  };
72
42
 
@@ -1,5 +0,0 @@
1
- export declare enum AccordionTypes {
2
- Default = "default",
3
- Warning = "warning",
4
- Error = "error"
5
- }
@@ -1,8 +0,0 @@
1
- export declare enum BreadcrumbsTypes {
2
- Blogs = "blogs",
3
- BooksAndMore = "booksAndMore",
4
- Education = "education",
5
- Locations = "locations",
6
- Research = "research",
7
- WhatsOn = "whatsOn"
8
- }
@@ -1,8 +0,0 @@
1
- export declare enum ButtonTypes {
2
- Primary = "primary",
3
- Secondary = "secondary",
4
- Callout = "callout",
5
- Pill = "pill",
6
- Link = "link",
7
- NoBrand = "noBrand"
8
- }
@@ -1,5 +0,0 @@
1
- export declare enum DatePickerTypes {
2
- Full = "full",
3
- Month = "month",
4
- Year = "year"
5
- }
@@ -1,2 +0,0 @@
1
- import { GridGaps as FormGaps } from "../Grid/GridTypes";
2
- export { FormGaps };
@@ -1,9 +0,0 @@
1
- export declare enum GridGaps {
2
- ExtraExtraSmall = "grid.xxs",
3
- ExtraSmall = "grid.xs",
4
- Small = "grid.s",
5
- Medium = "grid.m",
6
- Large = "grid.l",
7
- ExtraLarge = "grid.xl",
8
- ExtraExtraLarge = "grid.xxl"
9
- }
@@ -1,14 +0,0 @@
1
- export declare enum HeadingSizes {
2
- Primary = "primary",
3
- Secondary = "secondary",
4
- Tertiary = "tertiary",
5
- Callout = "callout"
6
- }
7
- export declare enum HeadingLevels {
8
- One = "one",
9
- Two = "two",
10
- Three = "three",
11
- Four = "four",
12
- Five = "five",
13
- Six = "six"
14
- }
@@ -1,12 +0,0 @@
1
- export declare enum HeroTypes {
2
- Primary = "primary",
3
- Secondary = "secondary",
4
- SecondaryBooksAndMore = "secondaryBooksAndMore",
5
- SecondaryLocations = "secondaryLocations",
6
- SecondaryResearch = "secondaryResearch",
7
- SecondaryWhatsOn = "secondaryWhatsOn",
8
- Tertiary = "tertiary",
9
- Campaign = "campaign",
10
- FiftyFifty = "fiftyfifty"
11
- }
12
- export declare const HeroSecondaryTypes: HeroTypes[];
@@ -1,77 +0,0 @@
1
- export declare enum IconAlign {
2
- Left = "left",
3
- Right = "right",
4
- None = "none"
5
- }
6
- export declare enum IconTypes {
7
- Default = "default",
8
- Breadcrumbs = "breadcrumbs"
9
- }
10
- export declare enum IconRotationTypes {
11
- Rotate0 = "rotate0",
12
- Rotate90 = "rotate90",
13
- Rotate180 = "rotate180",
14
- Rotate270 = "rotate270"
15
- }
16
- export declare enum IconColors {
17
- UiBlack = "ui.black",
18
- UiWhite = "ui.white",
19
- BrandPrimary = "brand.primary",
20
- BrandSecondary = "brand.secondary",
21
- SectionBlogsPrimary = "section.blogs.primary",
22
- SectionBlogsSecondary = "section.blogs.secondary",
23
- SectionBooksAndMorePrimary = "section.books-and-more.primary",
24
- SectionBooksAndMoreSecondary = "section.books-and-more.secondary",
25
- SectionEducationPrimary = "section.education.primary",
26
- SectionEducationSecondary = "section.education.secondary",
27
- SectionLocationsPrimary = "section.locations.primary",
28
- SectionLocationsSecondary = "section.locations.secondary",
29
- SectionResearchPrimary = "section.research.primary",
30
- SectionResearchSecondary = "section.research.secondary",
31
- SectionResearchLibraryLpa = "section.research-library.lpa",
32
- SectionResearchLibrarySchomburg = "section.research-library.schomburg",
33
- SectionResearchLibrarySchwartzman = "section.research-library.schwartzman",
34
- SectionWhatsOnPrimary = "section.whats-on.primary",
35
- SectionWhatsOnSecondary = "section.whats-on.secondary"
36
- }
37
- export declare enum IconSizes {
38
- Default = "default",
39
- Small = "small",
40
- Medium = "medium",
41
- Large = "large",
42
- ExtraLarge = "xlarge",
43
- ExtraExtraLarge = "xxlarge",
44
- ExtraExtraExtraLarge = "xxxlarge"
45
- }
46
- export declare enum IconNames {
47
- AccessibilityFull = "accessibility_full",
48
- AccessibilityPartial = "accessibility_partial",
49
- ActionCheckCircle = "action_check_circle",
50
- ActionHelpDefault = "action_help_default",
51
- ActionHelpOutline = "action_help_outline",
52
- AlertNotificationImportant = "alert_notification_important",
53
- ActionLaunch = "action_launch",
54
- Arrow = "arrow",
55
- Check = "check",
56
- Clock = "clock",
57
- Close = "close",
58
- Download = "download",
59
- ErrorFilled = "error_filled",
60
- ErrorOutline = "error_outline",
61
- FileTypeAudio = "file_type_audio",
62
- FileTypeDoc = "file_type_doc",
63
- FileTypeGenericDoc = "file_type_generic_doc",
64
- FileTypeImage = "file_type_image",
65
- FileTypePdf = "file_type_pdf",
66
- FileTypeSpreadsheet = "file_type_spreadsheet",
67
- FileTypeVideo = "file_type_video",
68
- Headset = "headset",
69
- Minus = "minus",
70
- Plus = "plus",
71
- Search = "search",
72
- SpeakerNotes = "speaker_notes",
73
- UtilityAccountFilled = "utility_account_filled",
74
- UtilityAccountUnfilled = "utility_account_unfilled",
75
- UtilityHamburger = "utility_hamburger",
76
- UtilitySearch = "utility_search"
77
- }
@@ -1,22 +0,0 @@
1
- export declare enum ImageRatios {
2
- FourByThree = "fourByThree",
3
- OneByTwo = "oneByTwo",
4
- Original = "original",
5
- SixteenByNine = "sixteenByNine",
6
- Square = "square",
7
- ThreeByFour = "threeByFour",
8
- ThreeByTwo = "threeByTwo",
9
- TwoByOne = "twoByOne"
10
- }
11
- export declare enum ImageSizes {
12
- Default = "default",
13
- ExtraExtraSmall = "xxsmall",
14
- ExtraSmall = "xsmall",
15
- Small = "small",
16
- Medium = "medium",
17
- Large = "large"
18
- }
19
- export declare enum ImageTypes {
20
- Default = "default",
21
- Circle = "circle"
22
- }
@@ -1,8 +0,0 @@
1
- export declare enum LinkTypes {
2
- Action = "action",
3
- Backwards = "backwards",
4
- Button = "button",
5
- Default = "default",
6
- External = "external",
7
- Forwards = "forwards"
8
- }
@@ -1,5 +0,0 @@
1
- export declare enum ListTypes {
2
- Ordered = "ol",
3
- Unordered = "ul",
4
- Description = "dl"
5
- }
@@ -1,54 +0,0 @@
1
- export declare enum LogoColors {
2
- Default = "",
3
- UiBlack = "ui.black",
4
- UiWhite = "ui.white"
5
- }
6
- export declare enum LogoSizes {
7
- Default = "default",
8
- ExtraExtraSmall = "xxsmall",
9
- ExtraSmall = "xsmall",
10
- Small = "small",
11
- Medium = "medium",
12
- Large = "large"
13
- }
14
- export declare enum LogoNames {
15
- BrooklynPublicLibraryBlack = "logo_bpl_black",
16
- BrooklynPublicLibraryWhite = "logo_bpl_white",
17
- CleverColor = "logo_clever_color",
18
- CleverWhite = "logo_clever_white",
19
- FirstBookColor = "logo_firstbook_color",
20
- FirstBookColorNegative = "logo_firstbook_color_negative",
21
- LPAColor = "logo_lpa_color",
22
- LPABlack = "logo_lpa_black",
23
- LPAWhite = "logo_lpa_white",
24
- MyLibraryNYCBlack = "logo_mln_black",
25
- MyLibraryNYCWhite = "logo_mln_white",
26
- NYPLBlack = "logo_nypl_full_black",
27
- NYPLWhite = "logo_nypl_full_white",
28
- NYPLLionBlack = "logo_nypl_lion_black",
29
- NYPLLionWhite = "logo_nypl_lion_white",
30
- OpenEBooksColor = "logo_openebooks_color",
31
- OpenEBooksNegative = "logo_openebooks_negative",
32
- OpenEBooksWithTextColor = "logo_openebooks_wtext_color",
33
- OpenEBooksWithTextNegative = "logo_openebooks_wtext_negative",
34
- QueensPublicLibraryColor = "logo_qpl_color",
35
- QueensPublicLibraryBlack = "logo_qpl_black",
36
- QueensPublicLibraryWhite = "logo_qpl_white",
37
- QueensPublicLibraryAltBlack = "logo_qpl_alt_black",
38
- QueensPublicLibraryAltWhite = "logo_qpl_alt_white",
39
- ReservoirIconColor = "logo_reservoir_icon_color",
40
- ReservoirVerticalColor = "logo_reservoir_vertical_color",
41
- SchomburgColor = "logo_schomburg_color",
42
- SchomburgBlack = "logo_schomburg_black",
43
- SchomburgWhite = "logo_schomburg_white",
44
- SchomburgCircleColor = "logo_schomburg_circle_color",
45
- SchomburgCircleBlack = "logo_schomburg_circle_black",
46
- SchomburgCircleWhite = "logo_schomburg_circle_white",
47
- SimplyEColor = "logo_simplye_color",
48
- SimplyEBlack = "logo_simplye_black",
49
- SimplyEWhite = "logo_simplye_white",
50
- SNFLBlack = "logo_snfl_black",
51
- SNFLWhite = "logo_snfl_white",
52
- TreasuresColor = "logo_treasures_color",
53
- TreasuresColorNegative = "logo_treasures_color_negative"
54
- }
@@ -1,5 +0,0 @@
1
- export declare enum NotificationTypes {
2
- Standard = "standard",
3
- Announcement = "announcement",
4
- Warning = "warning"
5
- }
@@ -1,8 +0,0 @@
1
- export declare enum ProgressIndicatorSizes {
2
- Default = "default",
3
- Small = "small"
4
- }
5
- export declare enum ProgressIndicatorTypes {
6
- Circular = "circular",
7
- Linear = "linear"
8
- }
@@ -1,8 +0,0 @@
1
- export declare enum SelectTypes {
2
- Default = "default",
3
- SearchBar = "searchbar"
4
- }
5
- export declare enum LabelPositions {
6
- Default = "default",
7
- Inline = "inline"
8
- }
@@ -1,5 +0,0 @@
1
- export declare enum SkeletonLoaderImageRatios {
2
- Landscape = "landscape",
3
- Portrait = "portrait",
4
- Square = "square"
5
- }
@@ -1,5 +0,0 @@
1
- export declare enum StatusBadgeTypes {
2
- Low = "low",
3
- Medium = "medium",
4
- High = "high"
5
- }
@@ -1,5 +0,0 @@
1
- export declare enum StructuredContentImagePosition {
2
- Left = "left",
3
- Right = "right",
4
- Center = "center"
5
- }
@@ -1,6 +0,0 @@
1
- export declare enum TextSizes {
2
- Default = "default",
3
- Caption = "caption",
4
- Tag = "tag",
5
- Mini = "mini"
6
- }
@@ -1,25 +0,0 @@
1
- export declare enum TextInputTypes {
2
- email = "email",
3
- hidden = "hidden",
4
- number = "number",
5
- password = "password",
6
- text = "text",
7
- textarea = "textarea",
8
- tel = "tel",
9
- url = "url"
10
- }
11
- export declare enum TextInputFormats {
12
- email = "jdoe@domain.com",
13
- hidden = "",
14
- number = "",
15
- password = "",
16
- text = "",
17
- tel = "(123) 123-1234",
18
- textarea = "",
19
- url = "https://domain.com"
20
- }
21
- export declare enum TextInputVariants {
22
- Default = "default",
23
- SearchBar = "searchBar",
24
- SearchBarSelect = "searchBarSelect"
25
- }
@@ -1,4 +0,0 @@
1
- export declare enum ToggleSizes {
2
- Default = "default",
3
- Small = "small"
4
- }
@@ -1,9 +0,0 @@
1
- export declare enum VideoPlayerTypes {
2
- Vimeo = "vimeo",
3
- YouTube = "youtube"
4
- }
5
- export declare enum VideoPlayerAspectRatios {
6
- FourByThree = "fourByThree",
7
- SixteenByNine = "sixteenByNine",
8
- Square = "square"
9
- }
@@ -1,4 +0,0 @@
1
- export declare enum LayoutTypes {
2
- Column = "column",
3
- Row = "row"
4
- }
@@ -1,2 +0,0 @@
1
- declare const sections: string[];
2
- export default sections;
@@ -1,5 +0,0 @@
1
- export enum AccordionTypes {
2
- Default = "default",
3
- Warning = "warning",
4
- Error = "error",
5
- }
@@ -1,8 +0,0 @@
1
- export enum BreadcrumbsTypes {
2
- Blogs = "blogs",
3
- BooksAndMore = "booksAndMore",
4
- Education = "education",
5
- Locations = "locations",
6
- Research = "research",
7
- WhatsOn = "whatsOn",
8
- }
@@ -1,8 +0,0 @@
1
- export enum ButtonTypes {
2
- Primary = "primary",
3
- Secondary = "secondary",
4
- Callout = "callout",
5
- Pill = "pill",
6
- Link = "link",
7
- NoBrand = "noBrand",
8
- }
@@ -1,5 +0,0 @@
1
- export enum DatePickerTypes {
2
- Full = "full",
3
- Month = "month",
4
- Year = "year",
5
- }
@@ -1,3 +0,0 @@
1
- import { GridGaps as FormGaps } from "../Grid/GridTypes";
2
-
3
- export { FormGaps };
@@ -1,9 +0,0 @@
1
- export enum GridGaps {
2
- ExtraExtraSmall = "grid.xxs",
3
- ExtraSmall = "grid.xs",
4
- Small = "grid.s",
5
- Medium = "grid.m",
6
- Large = "grid.l",
7
- ExtraLarge = "grid.xl",
8
- ExtraExtraLarge = "grid.xxl",
9
- }