@nypl/design-system-react-components 0.25.2 → 0.25.6

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 (238) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +47 -11
  3. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +4 -0
  4. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -0
  5. package/dist/components/Button/Button.d.ts +9 -8
  6. package/dist/components/Button/ButtonTypes.d.ts +2 -1
  7. package/dist/components/Card/Card.d.ts +36 -52
  8. package/dist/components/Card/CardTypes.d.ts +0 -15
  9. package/dist/components/Checkbox/Checkbox.d.ts +8 -9
  10. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +2 -2
  11. package/dist/components/DatePicker/DatePicker.d.ts +36 -36
  12. package/dist/components/Fieldset/Fieldset.d.ts +25 -0
  13. package/dist/components/HelperErrorText/HelperErrorText.d.ts +4 -0
  14. package/dist/components/HorizontalRule/HorizontalRule.d.ts +10 -3
  15. package/dist/components/Icons/Icon.d.ts +4 -0
  16. package/dist/components/Icons/IconSvgs.d.ts +11 -0
  17. package/dist/components/Icons/IconTypes.d.ts +11 -0
  18. package/dist/components/Image/Image.d.ts +19 -9
  19. package/dist/components/Image/ImageTypes.d.ts +20 -0
  20. package/dist/components/Link/Link.d.ts +4 -0
  21. package/dist/components/List/List.d.ts +7 -1
  22. package/dist/components/Notification/Notification.d.ts +6 -4
  23. package/dist/components/Pagination/Pagination.d.ts +16 -13
  24. package/dist/components/Pagination/Pagination.stories.d.ts +2 -0
  25. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +29 -0
  26. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +8 -0
  27. package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
  28. package/dist/components/SearchBar/SearchBar.d.ts +3 -3
  29. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +18 -14
  30. package/dist/components/Slider/Slider.d.ts +57 -0
  31. package/dist/components/Tabs/Tabs.d.ts +1 -1
  32. package/dist/components/TextInput/TextInput.d.ts +10 -0
  33. package/dist/design-system-react-components.cjs.development.js +3058 -936
  34. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  35. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  36. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  37. package/dist/design-system-react-components.esm.js +3049 -921
  38. package/dist/design-system-react-components.esm.js.map +1 -1
  39. package/dist/index.d.ts +12 -6
  40. package/dist/resources.scss +180 -170
  41. package/dist/styles.css +1 -1
  42. package/dist/theme/components/breadcrumb.d.ts +9 -0
  43. package/dist/theme/components/button.d.ts +22 -8
  44. package/dist/theme/components/card.d.ts +168 -0
  45. package/dist/theme/components/checkbox.d.ts +5 -1
  46. package/dist/theme/components/checkboxGroup.d.ts +12 -0
  47. package/dist/theme/components/datePicker.d.ts +16 -0
  48. package/dist/theme/components/fieldset.d.ts +27 -0
  49. package/dist/theme/components/global.d.ts +23 -13
  50. package/dist/theme/components/globalMixins.d.ts +9 -1
  51. package/dist/theme/components/heading.d.ts +5 -0
  52. package/dist/theme/components/image.d.ts +31 -0
  53. package/dist/theme/components/label.d.ts +5 -3
  54. package/dist/theme/components/link.d.ts +4 -0
  55. package/dist/theme/components/list.d.ts +5 -1
  56. package/dist/theme/components/notification.d.ts +4 -14
  57. package/dist/theme/components/pagination.d.ts +19 -0
  58. package/dist/theme/components/progressIndicator.d.ts +50 -0
  59. package/dist/theme/components/radioGroup.d.ts +12 -0
  60. package/dist/theme/components/select.d.ts +11 -2
  61. package/dist/theme/components/skeletonLoader.d.ts +98 -0
  62. package/dist/theme/components/slider.d.ts +51 -0
  63. package/dist/theme/components/textInput.d.ts +8 -0
  64. package/dist/theme/foundations/breakpoints.d.ts +8 -8
  65. package/dist/theme/foundations/global.d.ts +6 -1
  66. package/package.json +72 -84
  67. package/src/__tests__/setup.ts +2 -2
  68. package/src/components/Accordion/Accordion.stories.mdx +39 -42
  69. package/src/components/Autosuggest/Autosuggest.stories.mdx +3 -3
  70. package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -0
  71. package/src/components/Autosuggest/_Autosuggest.scss +5 -5
  72. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +24 -8
  73. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +33 -0
  74. package/src/components/Breadcrumbs/Breadcrumbs.tsx +5 -1
  75. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -0
  76. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +298 -1
  77. package/src/components/Button/Button.stories.mdx +15 -10
  78. package/src/components/Button/Button.test.tsx +21 -7
  79. package/src/components/Button/Button.tsx +18 -33
  80. package/src/components/Button/ButtonTypes.tsx +1 -0
  81. package/src/components/Button/__snapshots__/Button.test.tsx.snap +41 -10
  82. package/src/components/Card/Card.stories.mdx +296 -259
  83. package/src/components/Card/Card.test.tsx +156 -84
  84. package/src/components/Card/Card.tsx +195 -145
  85. package/src/components/Card/CardTypes.tsx +0 -17
  86. package/src/components/Card/__snapshots__/Card.test.tsx.snap +410 -0
  87. package/src/components/CardEdition/CardEdition.stories.tsx +15 -47
  88. package/src/components/CardEdition/_CardEdition.scss +22 -23
  89. package/src/components/Chakra/Box.stories.mdx +14 -15
  90. package/src/components/Chakra/Center.stories.mdx +15 -8
  91. package/src/components/Chakra/Grid.stories.mdx +16 -7
  92. package/src/components/Chakra/Stack.stories.mdx +35 -18
  93. package/src/components/Checkbox/Checkbox.stories.mdx +33 -11
  94. package/src/components/Checkbox/Checkbox.test.tsx +30 -3
  95. package/src/components/Checkbox/Checkbox.tsx +27 -27
  96. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +90 -2
  97. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +82 -2
  98. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -1
  99. package/src/components/CheckboxGroup/CheckboxGroup.tsx +14 -15
  100. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +44 -80
  101. package/src/components/DatePicker/DatePicker.stories.mdx +163 -62
  102. package/src/components/DatePicker/DatePicker.test.tsx +248 -65
  103. package/src/components/DatePicker/DatePicker.tsx +158 -130
  104. package/src/components/DatePicker/_DatePicker.scss +33 -67
  105. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +818 -0
  106. package/src/components/Fieldset/Fieldset.stories.mdx +55 -0
  107. package/src/components/Fieldset/Fieldset.test.tsx +125 -0
  108. package/src/components/Fieldset/Fieldset.tsx +52 -0
  109. package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +68 -0
  110. package/src/components/Form/Form.stories.mdx +4 -5
  111. package/src/components/Form/Form.tsx +1 -0
  112. package/src/components/Grid/SimpleGrid.stories.mdx +32 -39
  113. package/src/components/Grid/SimpleGrid.test.tsx +4 -4
  114. package/src/components/Heading/Heading.stories.mdx +3 -4
  115. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -1
  116. package/src/components/HelperErrorText/HelperErrorText.tsx +5 -1
  117. package/src/components/Hero/HeroTypes.tsx +1 -0
  118. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +7 -7
  119. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +6 -5
  120. package/src/components/HorizontalRule/HorizontalRule.test.tsx +17 -0
  121. package/src/components/HorizontalRule/HorizontalRule.tsx +21 -4
  122. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +5 -5
  123. package/src/components/Icons/Icon.stories.mdx +11 -3
  124. package/src/components/Icons/Icon.test.tsx +18 -0
  125. package/src/components/Icons/Icon.tsx +6 -0
  126. package/src/components/Icons/IconSvgs.tsx +22 -0
  127. package/src/components/Icons/IconTypes.tsx +11 -0
  128. package/src/components/Image/Image.stories.mdx +220 -0
  129. package/src/components/Image/Image.test.tsx +131 -29
  130. package/src/components/Image/Image.tsx +84 -56
  131. package/src/components/Image/ImageTypes.ts +22 -0
  132. package/src/components/Image/__snapshots__/Image.test.tsx.snap +190 -0
  133. package/src/components/Input/Input.stories.tsx +20 -64
  134. package/src/components/Input/_Input.scss +23 -14
  135. package/src/components/Link/Link.tsx +4 -1
  136. package/src/components/List/List.stories.mdx +1 -1
  137. package/src/components/List/List.tsx +11 -4
  138. package/src/components/Modal/Modal.stories.mdx +3 -3
  139. package/src/components/Modal/_Modal.scss +2 -2
  140. package/src/components/Notification/Notification.stories.mdx +1 -3
  141. package/src/components/Notification/Notification.tsx +24 -9
  142. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +2 -0
  143. package/src/components/Pagination/Pagination.stories.mdx +26 -27
  144. package/src/components/Pagination/Pagination.stories.tsx +11 -16
  145. package/src/components/Pagination/Pagination.test.tsx +276 -146
  146. package/src/components/Pagination/Pagination.tsx +174 -154
  147. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +285 -0
  148. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +292 -0
  149. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +225 -0
  150. package/src/components/ProgressIndicator/ProgressIndicator.tsx +126 -0
  151. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +8 -0
  152. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +357 -0
  153. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +3 -0
  154. package/src/components/RadioGroup/RadioGroup.stories.mdx +3 -4
  155. package/src/components/RadioGroup/RadioGroup.tsx +11 -16
  156. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +39 -71
  157. package/src/components/SearchBar/SearchBar.Test.tsx +66 -21
  158. package/src/components/SearchBar/SearchBar.stories.mdx +114 -10
  159. package/src/components/SearchBar/SearchBar.tsx +15 -5
  160. package/src/components/Select/SelectTypes.tsx +1 -0
  161. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +28 -59
  162. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +97 -177
  163. package/src/components/SkeletonLoader/SkeletonLoader.tsx +74 -71
  164. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +739 -0
  165. package/src/components/Slider/Slider.stories.mdx +529 -0
  166. package/src/components/Slider/Slider.test.tsx +653 -0
  167. package/src/components/Slider/Slider.tsx +303 -0
  168. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +1946 -0
  169. package/src/components/StyleGuide/Bidirectionality.stories.mdx +1 -1
  170. package/src/components/StyleGuide/Breakpoints.stories.mdx +21 -7
  171. package/src/components/StyleGuide/Buttons.stories.mdx +69 -15
  172. package/src/components/StyleGuide/ColorCard.tsx +0 -1
  173. package/src/components/StyleGuide/DesignTokens.stories.mdx +170 -0
  174. package/src/components/StyleGuide/Iconography.stories.mdx +51 -62
  175. package/src/components/Tabs/Tabs.tsx +5 -5
  176. package/src/components/Template/Template.stories.mdx +11 -16
  177. package/src/components/TextInput/TextInput.stories.mdx +1 -1
  178. package/src/components/TextInput/TextInput.tsx +23 -6
  179. package/src/components/TextInput/TextInputTypes.tsx +2 -0
  180. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +2 -3
  181. package/src/docs/Chakra.stories.mdx +2 -2
  182. package/src/index.ts +20 -12
  183. package/src/resources.scss +5 -5
  184. package/src/styles/base/{_02-breakpoints.scss → _01-breakpoints.scss} +9 -10
  185. package/src/styles/base/{_03-mixins.scss → _02-mixins.scss} +16 -5
  186. package/src/styles/base/{_04-base.scss → _03-base.scss} +7 -2
  187. package/src/styles/base/{_05-focus.scss → _04-focus.scss} +0 -15
  188. package/src/styles/base/_place-holder.scss +14 -3
  189. package/src/styles/{03-space → space}/_space-inline.scss +14 -14
  190. package/src/styles/{03-space → space}/_space-inset.scss +10 -10
  191. package/src/styles/space/_space-stack.scss +116 -0
  192. package/src/styles.scss +13 -55
  193. package/src/theme/components/breadcrumb.ts +10 -0
  194. package/src/theme/components/button.ts +18 -12
  195. package/src/theme/components/card.ts +174 -0
  196. package/src/theme/components/checkbox.ts +7 -2
  197. package/src/theme/components/checkboxGroup.ts +8 -0
  198. package/src/theme/components/datePicker.ts +17 -0
  199. package/src/theme/components/fieldset.ts +18 -0
  200. package/src/theme/components/global.ts +26 -15
  201. package/src/theme/components/globalMixins.ts +9 -1
  202. package/src/theme/components/heading.ts +5 -0
  203. package/src/theme/components/image.ts +116 -0
  204. package/src/theme/components/label.ts +3 -10
  205. package/src/theme/components/link.ts +4 -0
  206. package/src/theme/components/list.ts +6 -3
  207. package/src/theme/components/notification.ts +12 -14
  208. package/src/theme/components/pagination.ts +20 -0
  209. package/src/theme/components/progressIndicator.ts +62 -0
  210. package/src/theme/components/radioGroup.ts +8 -0
  211. package/src/theme/components/select.ts +5 -2
  212. package/src/theme/components/skeletonLoader.ts +107 -0
  213. package/src/theme/components/slider.ts +79 -0
  214. package/src/theme/components/textInput.ts +2 -0
  215. package/src/theme/foundations/breakpoints.ts +8 -8
  216. package/src/theme/foundations/global.ts +6 -1
  217. package/src/theme/index.ts +22 -4
  218. package/src/utils/componentCategories.ts +4 -3
  219. package/dist/components/Image/Image.stories.d.ts +0 -18
  220. package/dist/theme/components/customCheckboxGroup.d.ts +0 -18
  221. package/dist/theme/components/customRadioGroup.d.ts +0 -18
  222. package/src/components/Button/_Button.scss +0 -32
  223. package/src/components/Card/_Card.scss +0 -308
  224. package/src/components/Image/Image.stories.tsx +0 -54
  225. package/src/components/Image/_Image.scss +0 -38
  226. package/src/components/Pagination/_Pagination.scss +0 -40
  227. package/src/components/SkeletonLoader/_SkeletonLoader.scss +0 -142
  228. package/src/styles/01-colors/_colors-brand.scss +0 -62
  229. package/src/styles/01-colors/_colors-utility.scss +0 -67
  230. package/src/styles/02-typography/_type-scale.css +0 -11
  231. package/src/styles/02-typography/_type-weight.css +0 -7
  232. package/src/styles/02-typography/_typefaces.css +0 -4
  233. package/src/styles/03-space/_space-stack.scss +0 -116
  234. package/src/styles/03-space/_space.css +0 -30
  235. package/src/styles/base/_card-grid.scss +0 -77
  236. package/src/styles/base/_typography.scss +0 -11
  237. package/src/theme/components/customCheckboxGroup.ts +0 -12
  238. package/src/theme/components/customRadioGroup.ts +0 -12
@@ -22,6 +22,7 @@ import Placeholder from "../Placeholder/Placeholder";
22
22
  import Hero from "../Hero/Hero";
23
23
  import { HeroTypes } from "../Hero/HeroTypes";
24
24
  import Image from "../Image/Image";
25
+ import { ImageRatios, ImageSizes } from "../Image/ImageTypes";
25
26
  import Breadcrumbs from "../Breadcrumbs/Breadcrumbs";
26
27
  import HorizontalRule from "../HorizontalRule/HorizontalRule";
27
28
  import Heading from "../Heading/Heading";
@@ -35,13 +36,7 @@ import Form, { FormRow, FormField } from "../Form/Form";
35
36
  import TextInput from "../TextInput/TextInput";
36
37
  import Button from "../Button/Button";
37
38
  import Link from "../Link/Link";
38
- import Card, {
39
- CardImage,
40
- CardHeading,
41
- CardContent,
42
- CardActions,
43
- } from "../Card/Card";
44
- import { CardImageRatios, CardImageSizes } from "../Card/CardTypes";
39
+ import Card, { CardHeading, CardContent, CardActions } from "../Card/Card";
45
40
  import Accordion from "../Accordion/Accordion";
46
41
  import { faqContent } from "../Accordion/Accordion.stories.mdx";
47
42
  import { NotificationTypes } from "../Notification/NotificationTypes";
@@ -509,13 +504,13 @@ This is best viewed in the Storybook "Canvas" and not "Docs" section.
509
504
  center
510
505
  imageSrc="https://placeimg.com/400/200/animals"
511
506
  imageAlt="Alt text"
512
- imageAspectRatio={CardImageRatios.Square}
513
- imageSize={CardImageSizes.Small}
507
+ imageAspectRatio={ImageRatios.Square}
508
+ imageSize={ImageSizes.Small}
514
509
  >
515
- <CardHeading level={HeadingLevels.Three} id="heading1">
510
+ <CardHeading level={HeadingLevels.Two} id="heading1">
516
511
  Small Animal Image
517
512
  </CardHeading>
518
- <CardHeading level={HeadingLevels.Five} id="heading2">
513
+ <CardHeading level={HeadingLevels.Three} id="heading2">
519
514
  Animal info
520
515
  </CardHeading>
521
516
  <CardContent>
@@ -530,12 +525,12 @@ This is best viewed in the Storybook "Canvas" and not "Docs" section.
530
525
  id="custom-card"
531
526
  imageAlt="Alt text"
532
527
  imageSrc="https://cdn-d8.nypl.org/s3fs-public/2020-05/NYPL_MainFacadeRev2Cam2.png"
533
- imageAspectRatio={CardImageRatios.SixteenByNine}
528
+ imageAspectRatio={ImageRatios.SixteenByNine}
534
529
  layout="horizontal"
535
530
  backgroundColor="#616161"
536
531
  foregroundColor="#FFF"
537
532
  >
538
- <CardHeading id="heading1" level={2}>
533
+ <CardHeading id="heading1-footer" level={HeadingLevels.Two}>
539
534
  Footer
540
535
  </CardHeading>
541
536
  <CardContent>
@@ -547,25 +542,25 @@ This is best viewed in the Storybook "Canvas" and not "Docs" section.
547
542
  </CardContent>
548
543
  <CardActions>
549
544
  <Link
550
- href="javascript:void(0);"
551
545
  attributes={{
552
546
  style: { color: "#FFF", textDecoration: "underline" },
553
547
  }}
548
+ href="#"
554
549
  >
555
550
  Facebook
556
551
  </Link>
557
552
  ,<Link
558
- href="javascript:void(0);"
559
553
  attributes={{
560
554
  style: { color: "#FFF", textDecoration: "underline" },
561
555
  }}
556
+ href="#"
562
557
  >
563
558
  Instagram
564
559
  </Link>,<Link
565
- href="javascript:void(0);"
566
560
  attributes={{
567
561
  style: { color: "#FFF", textDecoration: "underline" },
568
562
  }}
563
+ href="#"
569
564
  >
570
565
  Twitter
571
566
  </Link>
@@ -38,7 +38,7 @@ import DSProvider from "../../theme/provider";
38
38
  | Component Version | DS Version |
39
39
  | ----------------- | ---------- |
40
40
  | Added | `0.22.0` |
41
- | Latest | `0.25.1` |
41
+ | Latest | `0.25.4` |
42
42
 
43
43
  <Description of={TextInput} />
44
44
 
@@ -16,10 +16,14 @@ import HelperErrorText from "../HelperErrorText/HelperErrorText";
16
16
  import generateUUID from "../../helpers/generateUUID";
17
17
 
18
18
  export interface InputProps {
19
+ /** Optionally pass in additional Chakra-based styles. */
20
+ additionalStyles?: { [key: string]: any };
19
21
  /** Additional attributes to pass to the `<input>` or `<textarea>` element */
20
22
  attributes?: { [key: string]: any };
21
23
  /** A class name for the TextInput parent div. */
22
24
  className?: string;
25
+ /** The starting value of the input field. */
26
+ defaultValue?: string;
23
27
  /** Populates the HelperErrorText for the standard state */
24
28
  helperText?: string;
25
29
  /** ID that other components can cross reference for accessibility purposes */
@@ -35,6 +39,8 @@ export interface InputProps {
35
39
  /** Provides text for a `Label` component if `showLabel` is set to true;
36
40
  * populates an `aria-label` attribute if `showLabel` is set to false. */
37
41
  labelText: string;
42
+ /** Used to reference the input element in forms. */
43
+ name?: string;
38
44
  /** The action to perform on the `input`/`textarea`'s onChange function */
39
45
  onChange?: (
40
46
  event:
@@ -51,6 +57,8 @@ export interface InputProps {
51
57
  /** Offers the ability to show the "Required"/"Optional" label onscreen or
52
58
  * hide it. True by default. */
53
59
  showOptReqLabel?: boolean;
60
+ /** The amount to increase or decrease when using the number type. */
61
+ step?: number;
54
62
  /** HTML Input types as defined by MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input */
55
63
  type?: TextInputTypes;
56
64
  /** Populates the value of the input/textarea elements */
@@ -73,8 +81,10 @@ export type TextInputRefType = HTMLInputElement & HTMLTextAreaElement;
73
81
  const TextInput = React.forwardRef<TextInputRefType, InputProps>(
74
82
  (props, ref: React.Ref<TextInputRefType>) => {
75
83
  const {
84
+ additionalStyles = {},
76
85
  attributes = {},
77
86
  className,
87
+ defaultValue,
78
88
  helperText,
79
89
  id = generateUUID(),
80
90
  invalidText,
@@ -82,16 +92,19 @@ const TextInput = React.forwardRef<TextInputRefType, InputProps>(
82
92
  isInvalid = false,
83
93
  isRequired = false,
84
94
  labelText,
95
+ name,
85
96
  onChange,
86
97
  placeholder,
87
98
  showHelperInvalidText = true,
88
99
  showLabel = true,
89
100
  showOptReqLabel = true,
101
+ step = 1,
90
102
  type = TextInputTypes.text,
91
103
  value,
92
104
  variantType = TextInputVariants.Default,
93
105
  } = props;
94
106
  const styles = useMultiStyleConfig("TextInput", { variant: variantType });
107
+ const finalStyles = { ...styles, ...additionalStyles };
95
108
  const isTextArea = type === TextInputTypes.textarea;
96
109
  const isHidden = type === TextInputTypes.hidden;
97
110
  const optReqFlag = isRequired ? "Required" : "Optional";
@@ -128,33 +141,37 @@ const TextInput = React.forwardRef<TextInputRefType, InputProps>(
128
141
 
129
142
  // When the type is "hidden", the input element needs fewer attributes.
130
143
  options = isHidden
131
- ? { id, "aria-hidden": isHidden, onChange, ref }
144
+ ? { id, "aria-hidden": isHidden, name, onChange, ref }
132
145
  : {
133
- id,
134
146
  "aria-required": isRequired,
147
+ defaultValue,
148
+ id,
135
149
  isDisabled,
136
150
  isRequired,
137
151
  isInvalid,
138
152
  placeholder,
153
+ name,
139
154
  onChange,
140
155
  ref,
156
+ // The `step` attribute is useful for the number type.
157
+ step: type === TextInputTypes.number ? step : null,
141
158
  ...attributes,
142
159
  };
143
160
  // For `input` and `textarea`, all attributes are the same but `input`
144
161
  // also needs `type` and `value` to render correctly.
145
162
  if (!isTextArea) {
146
163
  options = { type, value, ...options } as any;
147
- fieldOutput = <ChakraInput {...options} __css={styles.input} />;
164
+ fieldOutput = <ChakraInput {...options} __css={finalStyles.input} />;
148
165
  } else {
149
166
  fieldOutput = (
150
- <ChakraTextarea {...options} __css={styles.textarea}>
167
+ <ChakraTextarea {...options} __css={finalStyles.textarea}>
151
168
  {value}
152
169
  </ChakraTextarea>
153
170
  );
154
171
  }
155
172
 
156
173
  return (
157
- <Box __css={styles} className={className}>
174
+ <Box __css={finalStyles} className={className}>
158
175
  {labelText && showLabel && !isHidden && (
159
176
  <Label
160
177
  htmlFor={id}
@@ -166,7 +183,7 @@ const TextInput = React.forwardRef<TextInputRefType, InputProps>(
166
183
  )}
167
184
  {fieldOutput}
168
185
  {footnote && showHelperInvalidText && !isHidden && (
169
- <Box __css={styles.helper} aria-disabled={isDisabled}>
186
+ <Box __css={finalStyles.helper} aria-disabled={isDisabled}>
170
187
  <HelperErrorText isInvalid={isInvalid} id={`${id}-helperText`}>
171
188
  {footnote}
172
189
  </HelperErrorText>
@@ -11,6 +11,7 @@ export enum TextInputTypes {
11
11
  url = "url",
12
12
  }
13
13
 
14
+ // Only used internally in `TextInput`.
14
15
  export enum TextInputFormats {
15
16
  email = "jdoe@domain.com",
16
17
  hidden = "",
@@ -23,6 +24,7 @@ export enum TextInputFormats {
23
24
  url = "https://domain.com",
24
25
  }
25
26
 
27
+ // Only used internally in `TextInput` and `SearchBar`.
26
28
  export enum TextInputVariants {
27
29
  Default = "default",
28
30
  SearchBar = "searchBar",
@@ -3,7 +3,6 @@ import {
3
3
  Story,
4
4
  Canvas,
5
5
  ArgsTable,
6
- Preview,
7
6
  Description,
8
7
  } from "@storybook/addon-docs/blocks";
9
8
  import { withDesign } from "storybook-addon-designs";
@@ -46,7 +45,7 @@ The `VideoPlayer` component is used to embed a `Vimeo` or `YouTube` video player
46
45
 
47
46
  The `aspectRatio` prop is used to control the sizing of the space allotted for the video rendering. Ultimately, the `aspectRatio` prop should be set to match the aspect ratio of the video that is being rendered. The default aspect ratio is `16:9`.
48
47
 
49
- <Preview withToolbar>
48
+ <Canvas withToolbar>
50
49
  <Story
51
50
  name="VideoPlayer"
52
51
  args={{
@@ -72,7 +71,7 @@ The `aspectRatio` prop is used to control the sizing of the space allotted for t
72
71
  />
73
72
  )}
74
73
  </Story>
75
- </Preview>
74
+ </Canvas>
76
75
 
77
76
  <ArgsTable story="VideoPlayer" />
78
77
 
@@ -87,8 +87,8 @@ wrap the elements in the `DSProvider` component.
87
87
  <Canvas>
88
88
  <DSProvider>
89
89
  <ButtonGroup>
90
- <Button disabled={false}>Enabled</Button>
91
- <Button disabled={true}>Disabled</Button>
90
+ <Button isDisabled={false}>Enabled</Button>
91
+ <Button isDisabled>Disabled</Button>
92
92
  </ButtonGroup>
93
93
  </DSProvider>
94
94
  </Canvas>
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ import "./styles.scss";
4
4
  // components for usage in consuming applications.
5
5
  export {
6
6
  Box,
7
+ ButtonGroup,
7
8
  Center,
8
9
  Circle,
9
10
  Grid,
@@ -15,7 +16,8 @@ export {
15
16
  } from "@chakra-ui/react";
16
17
  export { default as Accordion } from "./components/Accordion/Accordion";
17
18
  export { default as Breadcrumbs } from "./components/Breadcrumbs/Breadcrumbs";
18
- export { default as Button, ButtonGroup } from "./components/Button/Button";
19
+ export { ColorVariants } from "./components/Breadcrumbs/BreadcrumbsTypes";
20
+ export { default as Button } from "./components/Button/Button";
19
21
  export { ButtonTypes } from "./components/Button/ButtonTypes";
20
22
  export {
21
23
  default as Card,
@@ -23,11 +25,7 @@ export {
23
25
  CardContent,
24
26
  CardHeading,
25
27
  } from "./components/Card/Card";
26
- export {
27
- CardImageRatios,
28
- CardImageSizes,
29
- CardLayouts,
30
- } from "./components/Card/CardTypes";
28
+ export { CardLayouts } from "./components/Card/CardTypes";
31
29
  export { default as CardEdition } from "./components/CardEdition/CardEdition";
32
30
  export { default as Checkbox } from "./components/Checkbox/Checkbox";
33
31
  export { default as CheckboxGroup } from "./components/CheckboxGroup/CheckboxGroup";
@@ -35,6 +33,7 @@ export { CheckboxGroupLayoutTypes } from "./components/CheckboxGroup/CheckboxGro
35
33
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
36
34
  export { DatePickerTypes } from "./components/DatePicker/DatePickerTypes";
37
35
  export { default as DSProvider } from "./theme/provider";
36
+ export { default as Fieldset } from "./components/Fieldset/Fieldset";
38
37
  export { default as Form, FormField, FormRow } from "./components/Form/Form";
39
38
  export { FormSpacing } from "./components/Form/FormTypes";
40
39
  export { GridGaps } from "./components/Grid/GridTypes";
@@ -49,13 +48,20 @@ export { HeroTypes } from "./components/Hero/HeroTypes";
49
48
  export { default as HorizontalRule } from "./components/HorizontalRule/HorizontalRule";
50
49
  export { default as Icon } from "./components/Icons/Icon";
51
50
  export {
51
+ IconAlign,
52
+ IconColors,
52
53
  IconNames,
53
- LogoNames,
54
54
  IconRotationTypes,
55
- IconColors,
56
55
  IconSizes,
56
+ IconTypes,
57
+ LogoNames,
57
58
  } from "./components/Icons/IconTypes";
58
59
  export { default as Image } from "./components/Image/Image";
60
+ export {
61
+ ImageRatios,
62
+ ImageSizes,
63
+ ImageTypes,
64
+ } from "./components/Image/ImageTypes";
59
65
  export { default as Input } from "./components/Input/Input";
60
66
  export { InputTypes } from "./components/Input/InputTypes";
61
67
  export { default as Label } from "./components/Label/Label";
@@ -67,18 +73,21 @@ export { default as Modal } from "./components/Modal/Modal";
67
73
  export { default as Notification } from "./components/Notification/Notification";
68
74
  export { NotificationTypes } from "./components/Notification/NotificationTypes";
69
75
  export { default as Pagination } from "./components/Pagination/Pagination";
76
+ export { default as ProgressIndicator } from "./components/ProgressIndicator/ProgressIndicator";
70
77
  export { default as Radio } from "./components/Radio/Radio";
71
78
  export { default as RadioGroup } from "./components/RadioGroup/RadioGroup";
72
79
  export { RadioGroupLayoutTypes } from "./components/RadioGroup/RadioGroupLayoutTypes";
73
80
  export { default as SearchBar } from "./components/SearchBar/SearchBar";
81
+ export { default as Select } from "./components/Select/Select";
74
82
  export { default as SimpleGrid } from "./components/Grid/SimpleGrid";
75
83
  export { default as SkeletonLoader } from "./components/SkeletonLoader/SkeletonLoader";
76
84
  export {
77
85
  SkeletonLoaderImageRatios,
78
86
  SkeletonLoaderLayouts,
79
87
  } from "./components/SkeletonLoader/SkeletonLoaderTypes";
80
- export { default as Select } from "./components/Select/Select";
88
+ export { default as Slider } from "./components/Slider/Slider";
81
89
  export { default as StatusBadge } from "./components/StatusBadge/StatusBadge";
90
+ export { StatusBadgeTypes } from "./components/StatusBadge/StatusBadgeTypes";
82
91
  export {
83
92
  Tabs,
84
93
  TabList,
@@ -86,8 +95,6 @@ export {
86
95
  TabPanels,
87
96
  TabPanel,
88
97
  } from "./components/Tabs/Tabs";
89
- export { default as Text } from "./components/Text/Text";
90
- export { TextDisplaySizes } from "./components/Text/TextTypes";
91
98
  export {
92
99
  TemplateAppContainer,
93
100
  Template,
@@ -99,7 +106,8 @@ export {
99
106
  TemplateContentSidebar,
100
107
  TemplateFooter,
101
108
  } from "./components/Template/Template";
102
-
109
+ export { default as Text } from "./components/Text/Text";
110
+ export { TextDisplaySizes } from "./components/Text/TextTypes";
103
111
  export {
104
112
  default as TextInput,
105
113
  TextInputRefType,
@@ -1,6 +1,6 @@
1
1
  // Resources to export as sass mixins
2
- @import "./styles/03-space/space-inline.scss";
3
- @import "./styles/03-space/space-inset.scss";
4
- @import "./styles/03-space/space-stack.scss";
5
- @import "./styles/base/02-breakpoints.scss";
6
- @import "./styles/base/03-mixins.scss";
2
+ @import "./styles/base/01-breakpoints";
3
+ @import "./styles/base/02-mixins";
4
+ @import "./styles/space/space-inline";
5
+ @import "./styles/space/space-inset";
6
+ @import "./styles/space/space-stack";
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Breakpoint Configuration
3
3
  * @see https://github.com/Team-Sass/breakpoint/wiki
4
- *
5
4
  */
6
5
 
7
6
  // Global Breakpoints
@@ -12,17 +11,17 @@
12
11
  // Sass' breakpoint() mixin doesn't work without Sass variables.
13
12
  // CSS variables expose the breakpoint variables to consumers.
14
13
  :root {
15
- --breakpoint-small: 320px;
16
- --breakpoint-medium: 600px;
17
- --breakpoint-large: 960px;
18
- --breakpoint-xl: 1280px;
14
+ --nypl-breakpoint-small: 320px;
15
+ --nypl-breakpoint-medium: 600px;
16
+ --nypl-breakpoint-large: 960px;
17
+ --nypl-breakpoint-xl: 1280px;
19
18
  }
20
19
 
21
- $breakpoint-small: 320px;
22
- $breakpoint-medium: 600px;
23
- $breakpoint-large: 960px;
24
- $breakpoint-xl: 1280px;
20
+ $nypl-breakpoint-small: 320px;
21
+ $nypl-breakpoint-medium: 600px;
22
+ $nypl-breakpoint-large: 960px;
23
+ $nypl-breakpoint-xl: 1280px;
25
24
  // The max-width breakpoint is used when the design should be applied at
26
25
  // whatever the largest breakpoint is regardless of actual pixel value,
27
26
  // e.g. removing outer margin on body wrapper.
28
- $max-width: $breakpoint-xl;
27
+ $nypl-max-width: $nypl-breakpoint-xl;
@@ -3,7 +3,7 @@
3
3
 
4
4
  /// Mixin - Clearfix.
5
5
  /// Adds clearfix based on http://bourbon.io/docs/#clearfix
6
- /// use example = @include clearfix
6
+ /// use example = @include clearfix
7
7
 
8
8
  @mixin clearfix {
9
9
  &::after {
@@ -29,10 +29,10 @@
29
29
  /// Outer container mixin for large screens
30
30
  @mixin wrapper(
31
31
  $container-max-width: $max-width,
32
- $outer-container-break: $breakpoint-small,
32
+ $outer-container-break: $nypl-breakpoint-small,
33
33
  $v-margin: 0,
34
34
  $v-padding: 0,
35
- $h-padding: var(--space)
35
+ $h-padding: var(--nypl-space-s)
36
36
  ) {
37
37
  margin: #{$v-margin} auto;
38
38
  max-width: #{$container-max-width};
@@ -41,12 +41,12 @@
41
41
  }
42
42
 
43
43
  .container {
44
- @include space-inset-s;
44
+ padding: var(--nypl-space-s);
45
45
  }
46
46
 
47
47
  /// Use the breakout mixin for elements that should be edge-to-edge
48
48
  /// Even when a parent container uses the wrapper mixin
49
- @mixin breakout($v-padding: var(--space)) {
49
+ @mixin breakout($v-padding: var(--nypl-space-s)) {
50
50
  margin-left: calc(-50vw + 50%);
51
51
  margin-right: calc(-50vw + 50%);
52
52
  }
@@ -61,6 +61,17 @@
61
61
  word-wrap: normal;
62
62
  }
63
63
 
64
+ // Focus state mixin
65
+ @mixin focus-outline($darkBackground: false) {
66
+ outline: 2px solid var(--nypl-colors-ui-focus);
67
+ outline-offset: 2px;
68
+ z-index: 9999;
69
+
70
+ @if $darkBackground {
71
+ outline-color: var(--nypl-colors-ui-white);
72
+ }
73
+ }
74
+
64
75
  //Convert pixel values to rem
65
76
  @function to-rem($size) {
66
77
  @return $size / 16px * 1rem;
@@ -1,7 +1,8 @@
1
+ // Kept for backwards compatibility.
1
2
  .nypl-ds {
2
3
  box-sizing: border-box;
3
- color: var(--ui-black);
4
- font-family: var(--typeface-body);
4
+ color: var(--nypl-colors-ui-black);
5
+ font-family: var(--nypl-fonts-body);
5
6
 
6
7
  // Sets up the base font-size, 1rem, for the system
7
8
  font-size: 16px;
@@ -12,6 +13,10 @@
12
13
  // our breakout mixin. Fix identified here: https://cloudfour.com/thinks/breaking-out-with-viewport-units-and-calc/#one-big-dumb-caveat
13
14
  overflow-x: hidden;
14
15
 
16
+ p {
17
+ margin: 0 0 var(--nypl-space-s);
18
+ }
19
+
15
20
  *,
16
21
  *::after,
17
22
  *::before {
@@ -1,14 +1,3 @@
1
- // Focus state mixin
2
- @mixin focus-outline($darkBackground: false) {
3
- outline: 2px solid var(--ui-focus);
4
- outline-offset: 2px;
5
- z-index: 9999;
6
-
7
- @if $darkBackground {
8
- outline-color: var(--ui-white);
9
- }
10
- }
11
-
12
1
  // Apply :focus behavior to focusable elements only (For IE 11)
13
2
  .nypl-ds {
14
3
  input,
@@ -31,7 +20,3 @@
31
20
  }
32
21
  }
33
22
  }
34
-
35
- .focus {
36
- @include focus-outline;
37
- }
@@ -1,8 +1,19 @@
1
1
  .placeholder {
2
- --color-place-holder: var(--ui-gray-light-cool);
2
+ --color-place-holder: var(--nypl-colors-ui-gray-dark);
3
3
 
4
- @include space-stack-page;
5
- @include space-inset-s;
4
+ margin-bottom: var(--nypl-space-l);
5
+ @include breakpoint($nypl-breakpoint-large) {
6
+ margin-bottom: var(--nypl-space-xl);
7
+ }
8
+
9
+ &--full {
10
+ margin-bottom: var(--nypl-space-xxl);
11
+ @include breakpoint($nypl-breakpoint-large) {
12
+ margin-bottom: var(--nypl-space-xxxl);
13
+ }
14
+ }
15
+
16
+ padding: var(--nypl-space-s);
6
17
 
7
18
  align-items: center;
8
19
  border: 4px dashed var(--color-place-holder);
@@ -1,11 +1,11 @@
1
1
  /**
2
- * $space-xxs: $space / 4; // 4px
3
- * $space-xs: $space / 2; // 8px
4
- * $space-s: $space * 1; // 16px
5
- * $space-m: $space * 1.5; // 24px
6
- * $space-l: $space * 2; // 32px
7
- * $space-xl: $space * 3; // 48px
8
- * $space-xxl: $space * 4; // 64px
2
+ * --nypl-space-xxs: --nypl-space-s / 4 // 4px or 0.25rem
3
+ * --nypl-space-xs: --nypl-space-s / 2 // 8px or 0.5rem
4
+ * --nypl-space-s: --nypl-space-s * 1; // 16px or 1rem
5
+ * --nypl-space-m: --nypl-space * 1.5; // 24px or 1.5rem
6
+ * --nypl-space-l: --nypl-space * 2; // 32px or 2rem
7
+ * --nypl-space-xl: --nypl-space * 3; // 48px or 3rem
8
+ * --nypl-space-xxl: --nypl-space * 4; // 64px or 4rem
9
9
  */
10
10
 
11
11
  @mixin space-inline-none {
@@ -13,31 +13,31 @@
13
13
  }
14
14
 
15
15
  @mixin space-inline-xxs {
16
- margin-right: var(--space-xxs);
16
+ margin-right: var(--nypl-space-xxs);
17
17
  }
18
18
 
19
19
  @mixin space-inline-xs {
20
- margin-right: var(--space-xs);
20
+ margin-right: var(--nypl-space-xs);
21
21
  }
22
22
 
23
23
  @mixin space-inline-s {
24
- margin-right: var(--space-s);
24
+ margin-right: var(--nypl-space-s);
25
25
  }
26
26
 
27
27
  @mixin space-inline-m {
28
- margin-right: var(--space-m);
28
+ margin-right: var(--nypl-space-m);
29
29
  }
30
30
 
31
31
  @mixin space-inline-l {
32
- margin-right: var(--space-l);
32
+ margin-right: var(--nypl-space-l);
33
33
  }
34
34
 
35
35
  @mixin space-inline-xl {
36
- margin-right: var(--space-xl);
36
+ margin-right: var(--nypl-space-xl);
37
37
  }
38
38
 
39
39
  @mixin space-inline-xxl {
40
- margin-right: var(--space-xxl);
40
+ margin-right: var(--nypl-space-xxl);
41
41
  }
42
42
 
43
43
  @mixin get-space-inline($id) {
@@ -1,9 +1,9 @@
1
1
  /**
2
- * $space-xs: $space / 2; // 8px
3
- * $space-s: $space * 1; // 16px
4
- * $space-m: $space * 1.5; // 24px
5
- * $space-l: $space * 2; // 32px
6
- * $space-xl: $space * 3; // 48px
2
+ * --nypl-space-xs: --nypl-space-s / 2 // 8px or 0.5rem
3
+ * --nypl-space-s: --nypl-space-s * 1; // 16px or 1rem
4
+ * --nypl-space-m: --nypl-space * 1.5; // 24px or 1.5rem
5
+ * --nypl-space-l: --nypl-space * 2; // 32px or 2rem
6
+ * --nypl-space-xl: --nypl-space * 3; // 48px or 3rem
7
7
  */
8
8
 
9
9
  @mixin space-inset-none {
@@ -11,23 +11,23 @@
11
11
  }
12
12
 
13
13
  @mixin space-inset-xs {
14
- padding: var(--space-xs);
14
+ padding: var(--nypl-space-xs);
15
15
  }
16
16
 
17
17
  @mixin space-inset-s {
18
- padding: var(--space-s);
18
+ padding: var(--nypl-space-s);
19
19
  }
20
20
 
21
21
  @mixin space-inset-m {
22
- padding: var(--space-m);
22
+ padding: var(--nypl-space-m);
23
23
  }
24
24
 
25
25
  @mixin space-inset-l {
26
- padding: var(--space-l);
26
+ padding: var(--nypl-space-l);
27
27
  }
28
28
 
29
29
  @mixin space-inset-xl {
30
- padding: var(--space-xl);
30
+ padding: var(--nypl-space-xl);
31
31
  }
32
32
 
33
33
  @mixin get-space-inset($id) {