@nypl/design-system-react-components 0.25.1 → 0.25.5

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 +118 -1
  2. package/README.md +98 -50
  3. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +4 -0
  4. package/dist/components/Button/Button.d.ts +13 -8
  5. package/dist/components/Button/ButtonTypes.d.ts +2 -1
  6. package/dist/components/Card/Card.d.ts +36 -52
  7. package/dist/components/Card/CardTypes.d.ts +0 -15
  8. package/dist/components/Checkbox/Checkbox.d.ts +17 -13
  9. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +4 -2
  10. package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +15 -0
  11. package/dist/components/DatePicker/DatePicker.d.ts +36 -34
  12. package/dist/components/Fieldset/Fieldset.d.ts +25 -0
  13. package/dist/components/Heading/Heading.d.ts +4 -4
  14. package/dist/components/HelperErrorText/HelperErrorText.d.ts +17 -14
  15. package/dist/components/HorizontalRule/HorizontalRule.d.ts +10 -9
  16. package/dist/components/Icons/Icon.d.ts +8 -0
  17. package/dist/components/Icons/IconSvgs.d.ts +11 -0
  18. package/dist/components/Icons/IconTypes.d.ts +11 -0
  19. package/dist/components/Image/Image.d.ts +19 -9
  20. package/dist/components/Image/ImageTypes.d.ts +20 -0
  21. package/dist/components/Link/Link.d.ts +4 -0
  22. package/dist/components/List/List.d.ts +19 -14
  23. package/dist/components/Notification/Notification.d.ts +37 -16
  24. package/dist/components/Pagination/Pagination.d.ts +16 -13
  25. package/dist/components/Pagination/Pagination.stories.d.ts +2 -0
  26. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +29 -0
  27. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +8 -0
  28. package/dist/components/Radio/Radio.d.ts +2 -0
  29. package/dist/components/RadioGroup/RadioGroup.d.ts +4 -2
  30. package/dist/components/SearchBar/SearchBar.d.ts +3 -3
  31. package/dist/components/Select/Select.d.ts +2 -0
  32. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +18 -14
  33. package/dist/components/Slider/Slider.d.ts +57 -0
  34. package/dist/components/StyleGuide/ColorCard.d.ts +12 -0
  35. package/dist/components/Tabs/Tabs.d.ts +1 -1
  36. package/dist/components/TextInput/TextInput.d.ts +12 -0
  37. package/dist/components/VideoPlayer/VideoPlayer.d.ts +6 -8
  38. package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +2 -2
  39. package/dist/design-system-react-components.cjs.development.js +6131 -3715
  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 +6124 -3699
  44. package/dist/design-system-react-components.esm.js.map +1 -1
  45. package/dist/hooks/tests/useCarouselStyles.test.d.ts +1 -0
  46. package/dist/hooks/useCarouselStyles.d.ts +16 -0
  47. package/dist/hooks/useNYPLTheme.d.ts +54 -0
  48. package/dist/hooks/useWindowSize.d.ts +10 -0
  49. package/dist/index.d.ts +13 -8
  50. package/dist/resources.scss +180 -170
  51. package/dist/styles.css +1 -1
  52. package/dist/theme/components/button.d.ts +22 -8
  53. package/dist/theme/components/card.d.ts +168 -0
  54. package/dist/theme/components/checkbox.d.ts +5 -1
  55. package/dist/theme/components/checkboxGroup.d.ts +12 -0
  56. package/dist/theme/components/componentWrapper.d.ts +11 -0
  57. package/dist/theme/components/datePicker.d.ts +16 -0
  58. package/dist/theme/components/fieldset.d.ts +27 -0
  59. package/dist/theme/components/global.d.ts +23 -13
  60. package/dist/theme/components/globalMixins.d.ts +9 -1
  61. package/dist/theme/components/heading.d.ts +5 -0
  62. package/dist/theme/components/helperErrorText.d.ts +10 -0
  63. package/dist/theme/components/hero.d.ts +1 -0
  64. package/dist/theme/components/horizontalRule.d.ts +14 -0
  65. package/dist/theme/components/image.d.ts +31 -0
  66. package/dist/theme/components/label.d.ts +5 -3
  67. package/dist/theme/components/link.d.ts +4 -0
  68. package/dist/theme/components/list.d.ts +89 -0
  69. package/dist/theme/components/notification.d.ts +75 -0
  70. package/dist/theme/components/pagination.d.ts +19 -0
  71. package/dist/theme/components/progressIndicator.d.ts +50 -0
  72. package/dist/theme/components/radioGroup.d.ts +12 -0
  73. package/dist/theme/components/select.d.ts +11 -2
  74. package/dist/theme/components/skeletonLoader.d.ts +98 -0
  75. package/dist/theme/components/slider.d.ts +51 -0
  76. package/dist/theme/components/tabs.d.ts +54 -3
  77. package/dist/theme/components/textInput.d.ts +8 -1
  78. package/dist/theme/components/videoPlayer.d.ts +40 -0
  79. package/dist/theme/foundations/breakpoints.d.ts +8 -8
  80. package/dist/theme/foundations/global.d.ts +6 -1
  81. package/dist/theme/foundations/radii.d.ts +5 -0
  82. package/dist/theme/foundations/spacing.d.ts +16 -16
  83. package/package.json +72 -83
  84. package/src/__tests__/setup.ts +2 -2
  85. package/src/components/Accordion/Accordion.stories.mdx +39 -44
  86. package/src/components/Autosuggest/Autosuggest.stories.mdx +3 -3
  87. package/src/components/Autosuggest/Autosuggest.stories.tsx +2 -1
  88. package/src/components/Autosuggest/_Autosuggest.scss +5 -5
  89. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +14 -10
  90. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +23 -0
  91. package/src/components/Breadcrumbs/Breadcrumbs.tsx +5 -1
  92. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +199 -1
  93. package/src/components/Button/Button.stories.mdx +15 -10
  94. package/src/components/Button/Button.test.tsx +21 -7
  95. package/src/components/Button/Button.tsx +22 -34
  96. package/src/components/Button/ButtonTypes.tsx +1 -0
  97. package/src/components/Button/__snapshots__/Button.test.tsx.snap +41 -10
  98. package/src/components/Card/Card.stories.mdx +296 -259
  99. package/src/components/Card/Card.test.tsx +156 -84
  100. package/src/components/Card/Card.tsx +195 -145
  101. package/src/components/Card/CardTypes.tsx +0 -17
  102. package/src/components/Card/__snapshots__/Card.test.tsx.snap +410 -0
  103. package/src/components/CardEdition/CardEdition.stories.tsx +15 -47
  104. package/src/components/CardEdition/_CardEdition.scss +22 -23
  105. package/src/components/Chakra/Box.stories.mdx +15 -16
  106. package/src/components/Chakra/Center.stories.mdx +31 -16
  107. package/src/components/Chakra/Grid.stories.mdx +28 -15
  108. package/src/components/Chakra/Stack.stories.mdx +35 -18
  109. package/src/components/Checkbox/Checkbox.stories.mdx +33 -11
  110. package/src/components/Checkbox/Checkbox.test.tsx +47 -2
  111. package/src/components/Checkbox/Checkbox.tsx +39 -33
  112. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +90 -2
  113. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +82 -2
  114. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +29 -2
  115. package/src/components/CheckboxGroup/CheckboxGroup.tsx +22 -18
  116. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +47 -81
  117. package/src/components/ComponentWrapper/ComponentWrapper.tsx +63 -0
  118. package/src/components/DatePicker/DatePicker.stories.mdx +163 -62
  119. package/src/components/DatePicker/DatePicker.test.tsx +264 -64
  120. package/src/components/DatePicker/DatePicker.tsx +159 -128
  121. package/src/components/DatePicker/_DatePicker.scss +33 -67
  122. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +818 -0
  123. package/src/components/Fieldset/Fieldset.stories.mdx +55 -0
  124. package/src/components/Fieldset/Fieldset.test.tsx +125 -0
  125. package/src/components/Fieldset/Fieldset.tsx +52 -0
  126. package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +68 -0
  127. package/src/components/Form/Form.stories.mdx +24 -6
  128. package/src/components/Form/Form.test.tsx +1 -1
  129. package/src/components/Form/Form.tsx +1 -0
  130. package/src/components/Grid/SimpleGrid.stories.mdx +32 -39
  131. package/src/components/Grid/SimpleGrid.test.tsx +4 -4
  132. package/src/components/Heading/Heading.stories.mdx +3 -4
  133. package/src/components/Heading/Heading.tsx +5 -5
  134. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +124 -0
  135. package/src/components/HelperErrorText/HelperErrorText.test.tsx +39 -44
  136. package/src/components/HelperErrorText/HelperErrorText.tsx +37 -39
  137. package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +25 -0
  138. package/src/components/Hero/Hero.stories.mdx +12 -2
  139. package/src/components/Hero/Hero.tsx +1 -1
  140. package/src/components/Hero/HeroTypes.tsx +1 -0
  141. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +7 -7
  142. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +8 -6
  143. package/src/components/HorizontalRule/HorizontalRule.test.tsx +33 -28
  144. package/src/components/HorizontalRule/HorizontalRule.tsx +27 -29
  145. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +27 -9
  146. package/src/components/Icons/Icon.stories.mdx +12 -4
  147. package/src/components/Icons/Icon.test.tsx +18 -0
  148. package/src/components/Icons/Icon.tsx +16 -1
  149. package/src/components/Icons/IconSvgs.tsx +22 -0
  150. package/src/components/Icons/IconTypes.tsx +11 -0
  151. package/src/components/Image/Image.stories.mdx +220 -0
  152. package/src/components/Image/Image.test.tsx +131 -29
  153. package/src/components/Image/Image.tsx +84 -56
  154. package/src/components/Image/ImageTypes.ts +22 -0
  155. package/src/components/Image/__snapshots__/Image.test.tsx.snap +190 -0
  156. package/src/components/Input/Input.stories.tsx +23 -67
  157. package/src/components/Input/Input.test.tsx +4 -4
  158. package/src/components/Input/_Input.scss +23 -14
  159. package/src/components/Link/Link.tsx +4 -1
  160. package/src/components/List/List.stories.mdx +124 -49
  161. package/src/components/List/List.test.tsx +142 -63
  162. package/src/components/List/List.tsx +89 -93
  163. package/src/components/List/__snapshots__/List.test.tsx.snap +109 -0
  164. package/src/components/Modal/Modal.stories.mdx +3 -3
  165. package/src/components/Modal/_Modal.scss +2 -2
  166. package/src/components/Notification/Notification.stories.mdx +109 -112
  167. package/src/components/Notification/Notification.test.tsx +99 -110
  168. package/src/components/Notification/Notification.tsx +156 -159
  169. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +159 -8
  170. package/src/components/Pagination/Pagination.stories.mdx +26 -27
  171. package/src/components/Pagination/Pagination.stories.tsx +11 -16
  172. package/src/components/Pagination/Pagination.test.tsx +276 -146
  173. package/src/components/Pagination/Pagination.tsx +174 -154
  174. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +285 -0
  175. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +292 -0
  176. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +225 -0
  177. package/src/components/ProgressIndicator/ProgressIndicator.tsx +126 -0
  178. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +8 -0
  179. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +357 -0
  180. package/src/components/Radio/Radio.test.tsx +20 -4
  181. package/src/components/Radio/Radio.tsx +6 -3
  182. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +3 -0
  183. package/src/components/RadioGroup/RadioGroup.stories.mdx +3 -4
  184. package/src/components/RadioGroup/RadioGroup.test.tsx +24 -1
  185. package/src/components/RadioGroup/RadioGroup.tsx +19 -19
  186. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +42 -72
  187. package/src/components/SearchBar/SearchBar.Test.tsx +20 -1
  188. package/src/components/SearchBar/SearchBar.stories.mdx +113 -8
  189. package/src/components/SearchBar/SearchBar.tsx +20 -10
  190. package/src/components/Select/Select.test.tsx +12 -0
  191. package/src/components/Select/Select.tsx +5 -2
  192. package/src/components/Select/SelectTypes.tsx +1 -0
  193. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +28 -59
  194. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +97 -177
  195. package/src/components/SkeletonLoader/SkeletonLoader.tsx +74 -71
  196. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +739 -0
  197. package/src/components/Slider/Slider.stories.mdx +529 -0
  198. package/src/components/Slider/Slider.test.tsx +653 -0
  199. package/src/components/Slider/Slider.tsx +303 -0
  200. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +1946 -0
  201. package/src/components/StyleGuide/Bidirectionality.stories.mdx +1 -1
  202. package/src/components/StyleGuide/Breakpoints.stories.mdx +34 -10
  203. package/src/components/StyleGuide/Buttons.stories.mdx +89 -73
  204. package/src/components/StyleGuide/ColorCard.tsx +46 -0
  205. package/src/components/StyleGuide/Colors.stories.mdx +171 -311
  206. package/src/components/StyleGuide/DesignTokens.stories.mdx +170 -0
  207. package/src/components/StyleGuide/Forms.stories.mdx +9 -7
  208. package/src/components/StyleGuide/Iconography.stories.mdx +85 -91
  209. package/src/components/StyleGuide/Spacing.stories.mdx +31 -23
  210. package/src/components/StyleGuide/Typography.stories.mdx +202 -189
  211. package/src/components/StyleGuide/UIDocCard.tsx +1 -1
  212. package/src/components/Tabs/Tabs.stories.mdx +73 -11
  213. package/src/components/Tabs/Tabs.tsx +87 -64
  214. package/src/components/Template/Template.stories.mdx +25 -27
  215. package/src/components/TextInput/TextInput.stories.mdx +1 -1
  216. package/src/components/TextInput/TextInput.test.tsx +22 -2
  217. package/src/components/TextInput/TextInput.tsx +28 -8
  218. package/src/components/TextInput/TextInputTypes.tsx +2 -0
  219. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +17 -4
  220. package/src/components/VideoPlayer/VideoPlayer.test.tsx +54 -53
  221. package/src/components/VideoPlayer/VideoPlayer.tsx +50 -51
  222. package/src/components/VideoPlayer/VideoPlayerTypes.tsx +2 -2
  223. package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +91 -0
  224. package/src/docs/Chakra.stories.mdx +244 -63
  225. package/src/docs/Intro.stories.mdx +5 -2
  226. package/src/hooks/tests/useCarouselStyles.test.ts +140 -0
  227. package/src/hooks/tests/useNYPLTheme.test.tsx +36 -0
  228. package/src/hooks/useCarouselStyles.ts +34 -0
  229. package/src/hooks/useNYPLTheme.ts +67 -0
  230. package/src/hooks/useWindowSize.ts +40 -0
  231. package/src/index.ts +22 -19
  232. package/src/resources.scss +5 -5
  233. package/src/styles/base/{_02-breakpoints.scss → _01-breakpoints.scss} +9 -10
  234. package/src/styles/base/{_03-mixins.scss → _02-mixins.scss} +16 -5
  235. package/src/styles/base/{_04-base.scss → _03-base.scss} +7 -2
  236. package/src/styles/base/{_05-focus.scss → _04-focus.scss} +0 -15
  237. package/src/styles/base/_place-holder.scss +14 -3
  238. package/src/styles/{03-space → space}/_space-inline.scss +14 -14
  239. package/src/styles/{03-space → space}/_space-inset.scss +10 -10
  240. package/src/styles/space/_space-stack.scss +116 -0
  241. package/src/styles.scss +13 -60
  242. package/src/theme/components/button.ts +21 -15
  243. package/src/theme/components/card.ts +174 -0
  244. package/src/theme/components/checkbox.ts +8 -3
  245. package/src/theme/components/checkboxGroup.ts +8 -0
  246. package/src/theme/components/componentWrapper.ts +10 -0
  247. package/src/theme/components/datePicker.ts +17 -0
  248. package/src/theme/components/fieldset.ts +18 -0
  249. package/src/theme/components/global.ts +26 -15
  250. package/src/theme/components/globalMixins.ts +9 -1
  251. package/src/theme/components/heading.ts +10 -5
  252. package/src/theme/components/helperErrorText.ts +9 -0
  253. package/src/theme/components/hero.ts +4 -3
  254. package/src/theme/components/horizontalRule.ts +13 -0
  255. package/src/theme/components/icon.ts +9 -9
  256. package/src/theme/components/image.ts +116 -0
  257. package/src/theme/components/label.ts +3 -10
  258. package/src/theme/components/link.ts +5 -1
  259. package/src/theme/components/list.ts +73 -0
  260. package/src/theme/components/notification.ts +93 -0
  261. package/src/theme/components/pagination.ts +20 -0
  262. package/src/theme/components/progressIndicator.ts +62 -0
  263. package/src/theme/components/radio.ts +2 -2
  264. package/src/theme/components/radioGroup.ts +8 -0
  265. package/src/theme/components/select.ts +6 -3
  266. package/src/theme/components/skeletonLoader.ts +107 -0
  267. package/src/theme/components/slider.ts +79 -0
  268. package/src/theme/components/statusBadge.ts +1 -2
  269. package/src/theme/components/tabs.ts +49 -19
  270. package/src/theme/components/template.ts +8 -8
  271. package/src/theme/components/textInput.ts +5 -4
  272. package/src/theme/components/videoPlayer.ts +49 -0
  273. package/src/theme/foundations/breakpoints.ts +8 -8
  274. package/src/theme/foundations/global.ts +6 -1
  275. package/src/theme/foundations/radii.ts +6 -0
  276. package/src/theme/foundations/spacing.ts +24 -24
  277. package/src/theme/index.ts +41 -10
  278. package/src/utils/componentCategories.ts +4 -3
  279. package/dist/components/HelperErrorText/HelperErrorText.stories.d.ts +0 -16
  280. package/dist/components/Image/Image.stories.d.ts +0 -18
  281. package/dist/components/List/List.stories.d.ts +0 -7
  282. package/dist/theme/components/customCheckboxGroup.d.ts +0 -18
  283. package/dist/theme/components/customRadioGroup.d.ts +0 -18
  284. package/src/components/Button/_Button.scss +0 -32
  285. package/src/components/Card/_Card.scss +0 -308
  286. package/src/components/HelperErrorText/HelperErrorText.stories.tsx +0 -48
  287. package/src/components/HelperErrorText/_HelperErrorText.scss +0 -9
  288. package/src/components/HorizontalRule/_HorizontalRule.scss +0 -15
  289. package/src/components/Image/Image.stories.tsx +0 -54
  290. package/src/components/Image/_Image.scss +0 -38
  291. package/src/components/List/List.stories.tsx +0 -139
  292. package/src/components/List/_List.scss +0 -76
  293. package/src/components/Notification/_Notification.scss +0 -110
  294. package/src/components/Pagination/_Pagination.scss +0 -40
  295. package/src/components/SkeletonLoader/_SkeletonLoader.scss +0 -142
  296. package/src/components/VideoPlayer/_VideoPlayer.scss +0 -38
  297. package/src/styles/01-colors/_colors-brand.scss +0 -62
  298. package/src/styles/01-colors/_colors-utility.scss +0 -67
  299. package/src/styles/02-typography/_type-scale.css +0 -11
  300. package/src/styles/02-typography/_type-weight.css +0 -7
  301. package/src/styles/02-typography/_typefaces.css +0 -4
  302. package/src/styles/03-space/_space-stack.scss +0 -116
  303. package/src/styles/03-space/_space.css +0 -30
  304. package/src/styles/base/_card-grid.scss +0 -78
  305. package/src/styles/base/_typography.scss +0 -11
  306. package/src/theme/components/customCheckboxGroup.ts +0 -12
  307. package/src/theme/components/customRadioGroup.ts +0 -12
@@ -6,8 +6,6 @@ import Label from "../Label/Label";
6
6
  import Button from "../Button/Button";
7
7
  import { ButtonTypes } from "../Button/ButtonTypes";
8
8
  import HelperErrorText from "../HelperErrorText/HelperErrorText";
9
- // eslint-disable-next-line id-blacklist
10
- import { text, boolean, select, number } from "@storybook/addon-knobs";
11
9
  import { action } from "@storybook/addon-actions";
12
10
  import { getCategory } from "../../utils/componentCategories";
13
11
 
@@ -16,47 +14,24 @@ export default {
16
14
  component: Input,
17
15
  };
18
16
 
19
- let showLabel, showHelperText;
20
-
21
17
  export const input = () => (
22
18
  <>
23
- {boolean("Show Label", true) ? (showLabel = true) : (showLabel = false)}
24
- {showLabel && (
25
- <Label
26
- htmlFor="inputID"
27
- optReqFlag={select(
28
- "Optional/Required Flag",
29
- ["Required", "Optional", ""],
30
- "Required"
31
- )}
32
- id={"label"}
33
- >
34
- {text("Input Label", "Choose your islander name: ")}
35
- </Label>
36
- )}
19
+ <Label htmlFor="inputID" optReqFlag="Required" id={"label"}>
20
+ Choose your islander name:
21
+ </Label>
37
22
  <Input
38
23
  id="inputID"
39
24
  ariaLabel="Input Label"
40
25
  ariaLabelledBy={"helperText"}
41
- required={boolean("Input Required", false)}
42
- placeholder={text("Input Placeholder", "CoolPerson99")}
43
- type={select("Input Type", InputTypes, InputTypes.text)}
44
- disabled={boolean("Disabled", false)}
26
+ required={false}
27
+ placeholder="CoolPerson99"
28
+ type={InputTypes.text}
29
+ disabled={false}
45
30
  ></Input>
46
- {boolean("Show Helper Text", true)
47
- ? (showHelperText = true)
48
- : (showHelperText = false)}
49
- {showHelperText && (
50
- <HelperErrorText
51
- isError={boolean("Helper Text Errored", false)}
52
- id={"helperText"}
53
- >
54
- {text(
55
- "Helper Text Content",
56
- "Once you pick a name for your islander it cannot be changed, so choose wisely!"
57
- )}
58
- </HelperErrorText>
59
- )}
31
+ <HelperErrorText isInvalid={false} id={"helperText"}>
32
+ Once you pick a name for your islander it cannot be changed, so choose
33
+ wisely!
34
+ </HelperErrorText>
60
35
  </>
61
36
  );
62
37
 
@@ -64,8 +39,7 @@ input.storyName = "Input";
64
39
  input.parameters = {
65
40
  design: {
66
41
  type: "figma",
67
- url:
68
- "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11895%3A547",
42
+ url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11895%3A547",
69
43
  },
70
44
  jest: ["Input.test.tsx"],
71
45
  };
@@ -74,12 +48,7 @@ let groupErrored;
74
48
 
75
49
  export const inputGroup = () => (
76
50
  <fieldset className="fieldset">
77
- {boolean("Input Group Errored", false)
78
- ? (groupErrored = true)
79
- : (groupErrored = false)}
80
- <legend className="legend">
81
- {text("Input Group Label", "Construction Time Request Form: ")}
82
- </legend>
51
+ <legend className="legend">Construction Time Request Form:</legend>
83
52
  <div className="input-group">
84
53
  <div style={{ flex: "1" }}>
85
54
  <Label htmlFor="input1" id={"label1"}>
@@ -87,17 +56,13 @@ export const inputGroup = () => (
87
56
  </Label>
88
57
  <Input
89
58
  id="input1"
90
- ariaLabelledBy={
91
- groupErrored
92
- ? "helperText1 sharedHelperText label1"
93
- : "helperText1 label1"
94
- }
59
+ ariaLabelledBy="helperText1 sharedHelperText label1"
95
60
  errored={groupErrored ? true : false}
96
61
  required={true}
97
62
  type={InputTypes.text}
98
63
  ></Input>
99
- <HelperErrorText isError={false} id={"helperText1"}>
100
- {text("Input 1 Helper Text", "E.g., 10am")}
64
+ <HelperErrorText isInvalid={false} id={"helperText1"}>
65
+ "E.g., 10am"
101
66
  </HelperErrorText>
102
67
  </div>
103
68
 
@@ -112,23 +77,15 @@ export const inputGroup = () => (
112
77
  ? "helperText2 sharedHelperText label2"
113
78
  : "helperText2 label2"
114
79
  }
115
- errored={groupErrored ? true : false}
80
+ errored={false}
116
81
  required={true}
117
82
  type={InputTypes.text}
118
83
  ></Input>
119
- <HelperErrorText isError={false} id={"helperText2"}>
120
- {text("Input 2 Helper Text", "E.g., 11am")}
84
+ <HelperErrorText isInvalid={false} id={"helperText2"}>
85
+ E.g., 11am
121
86
  </HelperErrorText>
122
87
  </div>
123
88
  </div>
124
- {groupErrored && (
125
- <HelperErrorText isError={true} id={"sharedHelperText"}>
126
- {text(
127
- "Additional Error Text",
128
- "Sorry villager! Those times are not available right now."
129
- )}
130
- </HelperErrorText>
131
- )}
132
89
  <Button
133
90
  onClick={action("clicked")}
134
91
  id="button"
@@ -144,8 +101,7 @@ inputGroup.storyName = "Input Group";
144
101
  inputGroup.parameters = {
145
102
  design: {
146
103
  type: "figma",
147
- url:
148
- "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11895%3A547",
104
+ url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11895%3A547",
149
105
  },
150
106
  jest: ["Input.test.tsx"],
151
107
  };
@@ -165,11 +121,11 @@ export const inputAttributes = () => (
165
121
  attributes={{
166
122
  onBlur: action("onBlur"),
167
123
  onChange: action("onChange"),
168
- maxLength: number("maxLength", 10),
169
- tabIndex: number("tabIndex", 0),
124
+ maxLength: 10,
125
+ tabIndex: 0,
170
126
  }}
171
127
  ></Input>
172
- <HelperErrorText isError={false} id="helperText-attrs">
128
+ <HelperErrorText isInvalid={false} id="helperText-attrs">
173
129
  {"Change the max length for 'text' input as an example! And note " +
174
130
  "the actions being called for the passed object in the `attributes` props."}
175
131
  </HelperErrorText>
@@ -98,7 +98,7 @@ describe("Input with Label", () => {
98
98
  placeholder="Input Placeholder"
99
99
  type={InputTypes.text}
100
100
  />
101
- <HelperErrorText isError={false} id="helperText">
101
+ <HelperErrorText isInvalid={false} id="helperText">
102
102
  Helper Text Content
103
103
  </HelperErrorText>
104
104
  </>
@@ -140,7 +140,7 @@ describe("Input Group", () => {
140
140
  required={true}
141
141
  type={InputTypes.text}
142
142
  ></Input>
143
- <HelperErrorText isError={false} id={"helperText1"}>
143
+ <HelperErrorText isInvalid={false} id={"helperText1"}>
144
144
  Input 1 Helper Text
145
145
  </HelperErrorText>
146
146
  </>
@@ -155,12 +155,12 @@ describe("Input Group", () => {
155
155
  required={true}
156
156
  type={InputTypes.text}
157
157
  ></Input>
158
- <HelperErrorText isError={false} id={"helperText2"}>
158
+ <HelperErrorText isInvalid={false} id={"helperText2"}>
159
159
  Input 2 Helper Text
160
160
  </HelperErrorText>
161
161
  </>
162
162
  </>
163
- <HelperErrorText isError={true} id={"sharedHelperText"}>
163
+ <HelperErrorText isInvalid={true} id={"sharedHelperText"}>
164
164
  Additional Error Text
165
165
  </HelperErrorText>
166
166
  </fieldset>
@@ -1,10 +1,10 @@
1
1
  $break-input-mobile: 400px;
2
2
 
3
3
  .input {
4
- @include space-inset-xs;
5
- @include space-stack-xs;
4
+ padding: var(--nypl-space-xs);
5
+ margin-bottom: var(--nypl-space-xs);
6
6
 
7
- border: 1px solid var(--ui-gray-medium);
7
+ border: 1px solid var(--nypl-colors-ui-gray-medium);
8
8
 
9
9
  &[type="text"],
10
10
  &[type="number"],
@@ -17,43 +17,43 @@ $break-input-mobile: 400px;
17
17
 
18
18
  + .label {
19
19
  display: unset;
20
- margin-left: var(--space-s);
20
+ margin-left: var(--nypl-space-s);
21
21
  }
22
22
  }
23
23
 
24
24
  &::-webkit-input-placeholder {
25
- color: var(--ui-gray-dark);
25
+ color: var(--nypl-colors-ui-gray-dark);
26
26
  }
27
27
 
28
28
  &:-moz-placeholder {
29
- color: var(--ui-gray-dark);
29
+ color: var(--nypl-colors-ui-gray-dark);
30
30
  }
31
31
 
32
32
  &:-ms-input-placeholder {
33
- color: var(--ui-gray-dark);
33
+ color: var(--nypl-colors-ui-gray-dark);
34
34
  }
35
35
 
36
36
  &:hover {
37
- border-color: var(--ui-gray-dark);
37
+ border-color: var(--nypl-colors-ui-gray-dark);
38
38
  }
39
39
 
40
40
  &:disabled {
41
- background-color: var(--ui-gray-xx-light-cool);
42
- color: var(--ui-gray-xdark);
41
+ background-color: var(--nypl-colors-ui-gray-xx-light-cool);
42
+ color: var(--nypl-colors-ui-gray-xdark);
43
43
  }
44
44
 
45
45
  &:active,
46
46
  &:focus,
47
47
  &:active:hover,
48
48
  &:focus:hover {
49
- border: 1px solid var(--ui-focus);
49
+ border: 1px solid var(--nypl-colors-ui-focus);
50
50
  box-shadow: 0;
51
- outline: 1px solid var(--ui-focus);
51
+ outline: 1px solid var(--nypl-colors-ui-focus);
52
52
  z-index: 9999;
53
53
  }
54
54
 
55
55
  &--error {
56
- border: 1px solid var(--ui-error-primary);
56
+ border: 1px solid var(--nypl-colors-ui-error-primary);
57
57
  }
58
58
  }
59
59
 
@@ -63,7 +63,16 @@ $break-input-mobile: 400px;
63
63
  justify-content: space-between;
64
64
 
65
65
  > *:not(:last-child) {
66
- @include space-inline-m;
66
+ margin-right: var(--nypl-space-m);
67
67
  }
68
68
  }
69
69
  }
70
+
71
+ // Used in `Input.stories.tsx`
72
+ .fieldset {
73
+ @include fieldset-reset;
74
+ }
75
+ .legend {
76
+ border: 0;
77
+ font-weight: 500;
78
+ }
@@ -7,6 +7,8 @@ import { IconRotationTypes, IconNames, IconAlign } from "../Icons/IconTypes";
7
7
  import generateUUID from "../../helpers/generateUUID";
8
8
 
9
9
  export interface LinkProps {
10
+ /** Optionally pass in additional Chakra-based styles. */
11
+ additionalStyles?: { [key: string]: any };
10
12
  /** Additional attributes, such as `rel=nofollow`, to pass to the `<a>` tag. */
11
13
  attributes?: { [key: string]: any };
12
14
  /** Any child node passed to the component. */
@@ -65,6 +67,7 @@ function getWithDirectionIcon(children, type: LinkTypes) {
65
67
  const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
66
68
  (props, ref: any) => {
67
69
  const {
70
+ additionalStyles = {},
68
71
  attributes,
69
72
  children,
70
73
  className,
@@ -130,7 +133,7 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
130
133
  className={className}
131
134
  ref={ref}
132
135
  {...linkProps}
133
- __css={style}
136
+ __css={{ ...style, ...additionalStyles }}
134
137
  >
135
138
  {newChildren}
136
139
  </Box>
@@ -3,22 +3,17 @@ 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";
10
- import Card from "../Card/Card";
9
+
11
10
  import Heading from "../Heading/Heading";
11
+ import { HeadingLevels } from "../Heading/HeadingTypes";
12
12
  import Image from "../Image/Image";
13
13
  import Link from "../Link/Link";
14
14
  import { LinkTypes } from "../Link/LinkTypes";
15
15
  import List from "./List";
16
16
  import { ListTypes } from "./ListTypes";
17
- import {
18
- animalCrossingDefinitions,
19
- cardsList,
20
- listRenderer,
21
- } from "./List.stories.tsx";
22
17
  import { getCategory } from "../../utils/componentCategories";
23
18
 
24
19
  <Meta
@@ -34,16 +29,15 @@ import { getCategory } from "../../utils/componentCategories";
34
29
  jest: ["List.test.tsx"],
35
30
  }}
36
31
  argTypes={{
37
- blockName: { table: { disable: true } },
38
- modifiers: { table: { disable: true } },
39
32
  children: { table: { disable: true } },
40
- definitions: { table: { disable: true } },
41
- itemGroups: { table: { disable: true } },
33
+ className: { table: { disable: true } },
34
+ id: { table: { disable: true } },
42
35
  listItems: { table: { disable: true } },
43
36
  type: {
44
37
  control: {
45
38
  type: "radio",
46
39
  },
40
+ options: Object.keys(ListTypes),
47
41
  },
48
42
  }}
49
43
  />
@@ -53,33 +47,119 @@ import { getCategory } from "../../utils/componentCategories";
53
47
  | Component Version | DS Version |
54
48
  | ----------------- | ---------- |
55
49
  | Added | `0.7.0` |
56
- | Latest | `0.23.2` |
50
+ | Latest | `0.25.2` |
57
51
 
58
52
  <Description of={List} />
59
53
 
60
- <Preview withToolbar>
54
+ export const animalCrossingDefinitions = [
55
+ {
56
+ term: "Mahi-mahi",
57
+ definition:
58
+ 'The mahi-mahi is an ocean fish known for its wide, somewhat-cute face. It can reach over six feet long. It is known by different names including "dolphinfish," even though it has no relation to dolphins. They live in only in warm, tropical waters...which perhaps explains the relaxed, happy look on their faces.',
59
+ },
60
+ {
61
+ term: "Golden trout",
62
+ definition:
63
+ "The golden trout is a beautifully colored fish that can only live in very clean waters. They are difficult to come across since they are found only in high mountain streams. As a side note, I find it much easier to appreciate fish that aren't such prima donnas about everything.",
64
+ },
65
+ {
66
+ term: "Rainbowfish",
67
+ definition:
68
+ 'The rainbowfish is a tropical fish known for its metallic colors and beautiful fins. There are over 50 different species, each unique and pleasing color. I must say, it does make me wish for feathers of a more exciting hue than "underbaked brownie."',
69
+ },
70
+ {
71
+ term: "Suckerfish",
72
+ definition:
73
+ "The suckerfish is a curious fish that likes to attach itself with its sucker mouth to larger marine animals. The benefit to the suckerfish is that it gets to eat smaller parasites and dead skin off the host's body. Amusingly, some people have used suckerfish on cords to catch large turtles with the fish's own suction! I imagine this practice is the cause of some awkward conversations between fish and turtle, eh wot?",
74
+ },
75
+ ];
76
+ export const itemGroups = [
77
+ "Art",
78
+ "Bushes",
79
+ "Clothing",
80
+ "DIY Recipes",
81
+ "Flowers",
82
+ "Fossils",
83
+ "Fruits",
84
+ "Furniture",
85
+ "Materials",
86
+ "NPC",
87
+ "Songs",
88
+ "Tools",
89
+ "Villagers",
90
+ ];
91
+ export const definitions = [
92
+ {
93
+ term: "Balrogs",
94
+ definition:
95
+ 'Demonic creatures of fire and shadow, Balrogs were fallen Maiar, loyal to the first Dark Lord, Morgoth. They participated in the wars of the First Age of Middle-earth but were mostly destroyed during the War of Wrath which ended the Age. By the Third Age, the only remaining Balrog was "Durin\'s Bane," the Balrog of Moria, killed by Gandalf.',
96
+ },
97
+ {
98
+ term: "Dwarves",
99
+ definition:
100
+ "The race of Dwarves preferred to live in mountains and caves, settling in places such as Erebor (the Lonely Mountain), the Iron Hills, the Blue Mountains, and Moria (Khazad-dûm) in the Misty Mountains. Aulë the Smith created Dwarves; he also invented the Dwarven language, known as Khuzdul. Dwarves mined and worked precious metals throughout the mountains of Middle-earth. The seven different groups of Dwarf-folk originated in the locations where the Seven Fathers of the Dwarves first awoke before the First Age.",
101
+ },
102
+ {
103
+ term: "Elves",
104
+ definition:
105
+ 'The Elves, or Firstborn, were the first of Eru\'s Children to awaken. Born under the stars before the ascension of the Moon and the Sun, they retain a special love for light and an inner spirit endowed with unique gifts. They call themselves the Quendi, or "Speakers", for they were the first to utter words; and, even now, no race understands language and song like the Firstborn. Fair and fine featured, brilliant and proud, immortal and strong, tall and agile, they are the most blessed of the Free Peoples. They can see as well under moon or starlight as a man at the height of day. They cannot become sick or scarred, but if an Elf should die, from violence or losing the will to live from grief, their spirit goes to the halls of Mandos, and as they are bound to Arda and cannot leave until the world is broken and remade. Elven skill and agility is legendary: for instance, walking atop freshly fallen snow without leaving a trace of their passing. On a clear day they can see ten miles with perfect clarity and detail up to 100 miles. These gifts come at great cost, though: they are strongly bound to Fate (see Mandos) and hated by Morgoth. No other race has been blessed and cursed more than the Quendi.',
106
+ },
107
+ {
108
+ term: "Ents",
109
+ definition:
110
+ "Ents were an ancient race of tree-like creatures, having become like the trees that they shepherd. They were created by Yavanna and given life by Ilúvatar. By the Third Age, they were a dwindling race, having long ago lost their mates, the Entwives.",
111
+ },
112
+ {
113
+ term: "Hobbits",
114
+ definition:
115
+ 'Hobbits are a race of Middle-earth, also known as "halflings" on account of their short stature, roughly half the size of men. They are characterized by curly hair on their heads and leathery feet that have furry insteps, for which they did not wear shoes. Many hobbits live in the Shire as well as Bree, and they once lived in the vales of the Anduin. They are fond of an unadventurous life of farming, eating, and socializing. There were three types of Hobbits: The Harfoots were the most numerous. The Stoors had an affinity for water, boats and swimming; the Fallohides were an adventurous people. The origin of hobbits is unclear, but of all the races they have the closest affinity to men, and in the Prologue to The Lord of the Rings Tolkien calls them relatives of men.',
116
+ },
117
+ ];
118
+
119
+ <Canvas withToolbar>
61
120
  <Story
62
121
  name="List"
63
122
  args={{
64
123
  id: "nypl-list",
124
+ noStyling: false,
125
+ title: "Middle-Earth Peoples",
65
126
  type: ListTypes.Unordered,
66
- title: "",
67
127
  }}
68
128
  >
69
- {(args) => listRenderer(args)}}
129
+ {(args) => (
130
+ <List {...args} type={ListTypes[args.type]}>
131
+ {ListTypes[args.type] !== ListTypes.Definition
132
+ ? itemGroups.map((item, i) => <li key={i}>{item}</li>)
133
+ : definitions.map((item, i) => [
134
+ <dt key={`dt_${i}`}>{item.term}</dt>,
135
+ <dd key={`dd_${i}`}>{item.definition}</dd>,
136
+ ])}
137
+ </List>
138
+ )}
70
139
  </Story>
71
- </Preview>
140
+ </Canvas>
72
141
 
73
142
  <ArgsTable story="List" />
74
143
 
75
144
  ## Definition List
76
145
 
77
- <Preview withToolbar>
146
+ To render a definition list, pass in `ListTypes.Definition` to the `type` prop.
147
+ The optional `title` prop will now render above the definition list element.
148
+ This type of list renders `dt` and `dd` elements.
149
+
150
+ ```jsx
151
+ <List type={ListTypes.Definition}>
152
+ <dt>Term</dt>
153
+ <dd>Definition</dd>
154
+ </List>
155
+ ```
156
+
157
+ <Canvas>
78
158
  <Story
79
159
  name="Definition List"
80
160
  args={{
81
161
  id: "nypl-list2",
82
- type: ListTypes.Definition,
162
+ noStyling: false,
83
163
  title: "Middle-Earth Peoples",
84
164
  }}
85
165
  argTypes={{
@@ -93,39 +173,30 @@ import { getCategory } from "../../utils/componentCategories";
93
173
  },
94
174
  }}
95
175
  >
96
- {(args) => listRenderer(args)}}
97
- </Story>
98
- </Preview>
99
-
100
- ## Ordered Card List
101
-
102
- <Preview withToolbar>
103
- <Story
104
- name="Ordered Card List"
105
- args={{
106
- id: "nypl-list3",
107
- }}
108
- argTypes={{
109
- type: { table: { disable: true } },
110
- title: { table: { disable: true } },
111
- }}
112
- >
113
- {(args) => <List type={ListTypes.Ordered}>{cardsList}</List>}
176
+ {(args) => (
177
+ <List {...args} type={ListTypes.Definition}>
178
+ {definitions.map((item, i) => [
179
+ <dt key={`dt_${i}`}>{item.term}</dt>,
180
+ <dd key={`dd_${i}`}>{item.definition}</dd>,
181
+ ])}
182
+ </List>
183
+ )}
114
184
  </Story>
115
- </Preview>
185
+ </Canvas>
116
186
 
117
187
  ## Definition List of Links
118
188
 
119
- <Preview withToolbar>
189
+ An example with HTML elements inside of the `dd` elements.
190
+
191
+ <Canvas>
120
192
  <Story
121
193
  name="Definition List of Links"
122
194
  args={{
123
- type: ListTypes.Definition,
195
+ noStyling: false,
124
196
  title: "Details",
125
197
  }}
126
198
  argTypes={{
127
199
  type: { table: { disable: true } },
128
- title: { table: { disable: true } },
129
200
  }}
130
201
  parameters={{
131
202
  design: {
@@ -136,7 +207,7 @@ import { getCategory } from "../../utils/componentCategories";
136
207
  }}
137
208
  >
138
209
  {(args) => (
139
- <List title="Details" type={ListTypes.Definition}>
210
+ <List {...args} type={ListTypes.Definition}>
140
211
  <dt>Authors</dt>
141
212
  <dd>
142
213
  <a href="#">Chirwa, Ephraim Wadonda, author</a>
@@ -175,7 +246,7 @@ import { getCategory } from "../../utils/componentCategories";
175
246
  </List>
176
247
  )}
177
248
  </Story>
178
- </Preview>
249
+ </Canvas>
179
250
 
180
251
  ## Lists with Data Props
181
252
 
@@ -183,6 +254,8 @@ If `li` or `dt`/`dd` elements cannot be passed as children to the `List` element
183
254
  an array with data can be passed into the `listItems` prop. Note: either
184
255
  children elements or the `listItems` prop should be passed but not both.
185
256
 
257
+ ### Unordered and Ordered
258
+
186
259
  For lists of type `ListTypes.Unordered` (ul) or `ListTypes.Ordered` (ol), `li`
187
260
  list item elements can be passed as children. If that's not possible but the
188
261
  data to render is stored as an array of strings, then that data array can be
@@ -202,6 +275,8 @@ const fishArray = ["Mahi-mahi", "Golden trout", "Rainbowfish", "Suckerfish"];
202
275
  <List type={ListTypes.Unordered} listItems={fishArray} />
203
276
  ```
204
277
 
278
+ ### Definition
279
+
205
280
  For lists of type `ListTypes.Definition` (dl), `dt` and `dd` elements can be
206
281
  passed as children. If that's not possible but the data to render is stored as
207
282
  an array of objects, then that data array can be passed into `listItems`. The
@@ -240,24 +315,24 @@ const fishDefinitions = [
240
315
  }
241
316
  ];
242
317
  <List
243
- type={ListTypes.Definition}
244
- title="Animal Crossing Fish"
245
318
  listItems={fishDefinitions}
319
+ title="Animal Crossing Fish"
320
+ type={ListTypes.Definition}
246
321
  />
247
322
  ```
248
323
 
249
- <Preview>
324
+ <Canvas>
250
325
  <Story
251
326
  name="List with Data Props"
252
327
  args={{
253
- type: ListTypes.Definition,
254
- title: "Animal Crossing Fish",
255
328
  listItems: animalCrossingDefinitions,
329
+ noStyling: false,
330
+ title: "Animal Crossing Fish",
256
331
  }}
257
332
  argTypes={{
258
333
  type: { table: { disable: true } },
259
334
  }}
260
335
  >
261
- {(args) => <List {...args} />}
336
+ {(args) => <List {...args} type={ListTypes.Definition} />}
262
337
  </Story>
263
- </Preview>
338
+ </Canvas>