@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
@@ -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
- isInvalid={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
64
  <HelperErrorText isInvalid={false} id={"helperText1"}>
100
- {text("Input 1 Helper Text", "E.g., 10am")}
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
84
  <HelperErrorText isInvalid={false} id={"helperText2"}>
120
- {text("Input 2 Helper Text", "E.g., 11am")}
85
+ E.g., 11am
121
86
  </HelperErrorText>
122
87
  </div>
123
88
  </div>
124
- {groupErrored && (
125
- <HelperErrorText isInvalid={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,8 +121,8 @@ 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
128
  <HelperErrorText isInvalid={false} id="helperText-attrs">
@@ -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>
@@ -47,7 +47,7 @@ import { getCategory } from "../../utils/componentCategories";
47
47
  | Component Version | DS Version |
48
48
  | ----------------- | ---------- |
49
49
  | Added | `0.7.0` |
50
- | Latest | `0.25.3` |
50
+ | Latest | `0.25.2` |
51
51
 
52
52
  <Description of={List} />
53
53
 
@@ -11,17 +11,21 @@ interface DefinitionProps {
11
11
  definition: string;
12
12
  }
13
13
  export interface ListProps {
14
+ /** Optionally pass in additional Chakra-based styles. */
15
+ additionalStyles?: { [key: string]: any };
14
16
  /** ClassName you can add in addition to 'list' */
15
17
  className?: string;
16
18
  /** ID that other components can cross reference for accessibility purposes */
17
19
  id?: string;
20
+ /** Display the list in a row. */
21
+ inline?: boolean;
18
22
  /** Data to render if children are not passed. For `ListTypes.Ordered` and
19
23
  * `ListTypes.Unordered` `List` types, the data structure is an array of
20
24
  * strings to renders as `li` items. For `ListTypes.Definition` `List` types,
21
25
  * the data structure is an array of objects with `term` and `definition`
22
26
  * properties to render `dt` and `dd` elements, respectively.
23
27
  */
24
- listItems?: (string | DefinitionProps)[];
28
+ listItems?: (string | JSX.Element | DefinitionProps)[];
25
29
  /** Remove list styling. */
26
30
  noStyling?: boolean;
27
31
  /** An optional title that will appear over the list. This prop only applies
@@ -38,15 +42,18 @@ export interface ListProps {
38
42
  */
39
43
  export default function List(props: React.PropsWithChildren<ListProps>) {
40
44
  const {
45
+ additionalStyles = {},
41
46
  children,
42
47
  className,
43
48
  id = generateUUID(),
49
+ inline = false,
44
50
  listItems,
45
51
  noStyling = false,
46
52
  title,
47
53
  type = ListTypes.Unordered,
48
54
  } = props;
49
- const styles = useStyleConfig("List", { noStyling, variant: type });
55
+ const styles = useStyleConfig("List", { inline, noStyling, variant: type });
56
+ const finalStyles = { ...styles, ...additionalStyles };
50
57
  let listElement = null;
51
58
 
52
59
  // Either li/dt/dd children elements must be passed or the `listItems`
@@ -122,14 +129,14 @@ export default function List(props: React.PropsWithChildren<ListProps>) {
122
129
  if (type === ListTypes.Ordered || type === ListTypes.Unordered) {
123
130
  checkListChildrenError(type);
124
131
  listElement = (
125
- <Box as={type as As} id={id} className={className} __css={styles}>
132
+ <Box as={type as As} id={id} className={className} __css={finalStyles}>
126
133
  {listChildrenElms(type)}
127
134
  </Box>
128
135
  );
129
136
  } else if (type === ListTypes.Definition) {
130
137
  checkDefinitionChildrenError();
131
138
  listElement = (
132
- <Box as="section" id={id} className={className} __css={styles}>
139
+ <Box as="section" id={id} className={className} __css={finalStyles}>
133
140
  {title && (
134
141
  <Heading id={`${id}-heading`} level={HeadingLevels.Two}>
135
142
  {title}
@@ -3,7 +3,7 @@ import {
3
3
  Meta,
4
4
  Story,
5
5
  ArgsTable,
6
- Preview,
6
+ Canvas,
7
7
  Description,
8
8
  } from "@storybook/addon-docs/blocks";
9
9
  import Modal from "./Modal";
@@ -118,11 +118,11 @@ export const ModalStory = (args) => {
118
118
  );
119
119
  };
120
120
 
121
- <Preview withToolbar>
121
+ <Canvas withToolbar>
122
122
  <Story name="Basic" args={{ open: false }}>
123
123
  {(args) => <ModalStory {...args} />}
124
124
  </Story>
125
- </Preview>
125
+ </Canvas>
126
126
 
127
127
  <ArgsTable story="Basic" />
128
128
 
@@ -5,9 +5,9 @@
5
5
  }
6
6
 
7
7
  .modal {
8
- @include space-inset-s;
8
+ padding: var(--nypl-space-s);
9
9
 
10
- background-color: var(--ui-gray-x-light-warm);
10
+ background-color: var(--nypl-colors-ui-gray-x-light-warm);
11
11
  height: 100vh;
12
12
  left: 0;
13
13
  overflow-y: auto;
@@ -39,7 +39,7 @@ import DSProvider from "../../theme/provider";
39
39
  | Component Version | DS Version |
40
40
  | ----------------- | ---------- |
41
41
  | Added | `0.23.2` |
42
- | Latest | `0.25.2` |
42
+ | Latest | `0.25.4` |
43
43
 
44
44
  <Description of={Notification} />
45
45
 
@@ -204,9 +204,7 @@ The default icon can be overridden by using the `icon` prop to pass a custom `Ic
204
204
  <Notification
205
205
  icon={
206
206
  <Icon
207
- align={IconAlign.Left}
208
207
  name={IconNames.Check}
209
- size={IconSizes.Large}
210
208
  color={IconColors.SectionResearchSecondary}
211
209
  />
212
210
  }
@@ -11,7 +11,7 @@ import { NotificationTypes } from "./NotificationTypes";
11
11
  import generateUUID from "../../helpers/generateUUID";
12
12
 
13
13
  interface BaseProps {
14
- /** Optional prop to control text alignment of the `Notification` content */
14
+ /** Optional prop to control text alignment in `NotificationContent` */
15
15
  alignText?: boolean;
16
16
  /** Optional prop to control horizontal alignment of the `Notification` content */
17
17
  centered?: boolean;
@@ -22,7 +22,12 @@ interface BaseProps {
22
22
  notificationType?: NotificationTypes;
23
23
  }
24
24
 
25
- export interface NotificationProps extends BaseProps {
25
+ // Used for `NotificationHeading` and `Notification`
26
+ type BasePropsWithoutAlignText = Omit<BaseProps, "alignText">;
27
+ // Used for `NotificationContent`
28
+ type BasePropsWithoutCentered = Omit<BaseProps, "centered">;
29
+
30
+ export interface NotificationProps extends BasePropsWithoutAlignText {
26
31
  /** Additional `className` to add. */
27
32
  className?: string;
28
33
  /** Optional prop to control whether a `Notification` can be dismissed
@@ -43,7 +48,9 @@ export interface NotificationProps extends BaseProps {
43
48
  /**
44
49
  * NotificationHeading child-component.
45
50
  */
46
- export function NotificationHeading(props: React.PropsWithChildren<BaseProps>) {
51
+ export function NotificationHeading(
52
+ props: React.PropsWithChildren<BasePropsWithoutAlignText>
53
+ ) {
47
54
  const { centered, children, icon, notificationType } = props;
48
55
  const styles = useMultiStyleConfig("NotificationHeading", {
49
56
  centered,
@@ -62,7 +69,9 @@ export function NotificationHeading(props: React.PropsWithChildren<BaseProps>) {
62
69
  /**
63
70
  * NotificationContent child-component.
64
71
  */
65
- export function NotificationContent(props: React.PropsWithChildren<BaseProps>) {
72
+ export function NotificationContent(
73
+ props: React.PropsWithChildren<BasePropsWithoutCentered>
74
+ ) {
66
75
  const { alignText, children, icon, notificationType } = props;
67
76
  const styles = useMultiStyleConfig("NotificationContent", {
68
77
  alignText,
@@ -100,8 +109,17 @@ export default function Notification(props: NotificationProps) {
100
109
  notificationType,
101
110
  });
102
111
  const iconElement = () => {
112
+ const baseIconProps = {
113
+ decorative: false,
114
+ size: IconSizes.Large,
115
+ additionalStyles: styles.icon,
116
+ };
103
117
  // If a custom icon is passed, add specific `Notification` styles.
104
- if (icon) return React.cloneElement(icon, { sx: styles.icon });
118
+ if (icon)
119
+ return React.cloneElement(icon, {
120
+ id: `${id}-custom-notification-icon`,
121
+ ...baseIconProps,
122
+ });
105
123
  const iconProps = {
106
124
  [NotificationTypes.Announcement]: {
107
125
  name: IconNames.SpeakerNotes,
@@ -115,9 +133,7 @@ export default function Notification(props: NotificationProps) {
115
133
  return notificationType !== NotificationTypes.Standard ? (
116
134
  <Icon
117
135
  id={`${id}-notification-icon`}
118
- decorative={false}
119
- size={IconSizes.Large}
120
- additionalStyles={styles.icon}
136
+ {...baseIconProps}
121
137
  {...iconProps[notificationType]}
122
138
  />
123
139
  ) : null;
@@ -133,7 +149,6 @@ export default function Notification(props: NotificationProps) {
133
149
  decorative={false}
134
150
  name={IconNames.Close}
135
151
  size={IconSizes.Large}
136
- additionalStyles={styles.dismissibleIcon}
137
152
  />
138
153
  </Button>
139
154
  );
@@ -49,6 +49,7 @@ exports[`Notification renders the UI snapshot correctly 2`] = `
49
49
  focusable={false}
50
50
  id="notificationID2-notification-icon"
51
51
  role="img"
52
+ title="speaker_notes icon"
52
53
  viewBox="0 0 24 24"
53
54
  >
54
55
  <g
@@ -111,6 +112,7 @@ exports[`Notification renders the UI snapshot correctly 3`] = `
111
112
  focusable={false}
112
113
  id="notificationID3-notification-icon"
113
114
  role="img"
115
+ title="error_filled icon"
114
116
  viewBox="0 0 24 24"
115
117
  >
116
118
  <g
@@ -15,11 +15,6 @@ import { getCategory } from "../../utils/componentCategories";
15
15
  title={getCategory("Pagination")}
16
16
  component={Pagination}
17
17
  decorators={[withDesign, withQuery]}
18
- argTypes={{
19
- blockName: { table: { disable: true } },
20
- modifiers: { table: { disable: true } },
21
- className: { table: { disable: true } },
22
- }}
23
18
  parameters={{
24
19
  design: {
25
20
  type: "figma",
@@ -28,6 +23,11 @@ import { getCategory } from "../../utils/componentCategories";
28
23
  },
29
24
  jest: ["Pagination.test.tsx"],
30
25
  }}
26
+ argTypes={{
27
+ id: { table: { disable: true } },
28
+ getPageHref: { table: { disable: true } },
29
+ onPageChange: { table: { disable: true } },
30
+ }}
31
31
  />
32
32
 
33
33
  # Pagination
@@ -35,7 +35,7 @@ import { getCategory } from "../../utils/componentCategories";
35
35
  | Component Version | DS Version |
36
36
  | ----------------- | ---------- |
37
37
  | Added | `0.0.10` |
38
- | Latest | `0.22.2` |
38
+ | Latest | `0.25.3` |
39
39
 
40
40
  <Description of={Pagination} />
41
41
 
@@ -49,17 +49,20 @@ Pagination uses anchor tags because it is navigating between URLs.
49
49
 
50
50
  In order to update the URL with a query parameter, the parent component must
51
51
  declare and pass a `getPageHref` function to the `Pagination` component. This
52
- function should return a string with the desired URL that the pagination links
53
- should go to. Note that this will refresh the browser on every click.
52
+ function takes a `selectedPage` number argument for the selected page and it
53
+ should return a string with the desired URL that the pagination links should go
54
+ to. Note that this will refresh the browser on every click.
54
55
 
55
56
  In the following example, the `getPageHref` function will compute a new URL that
56
57
  has `&page=` as a URL query. In your own application this query parameter can be
57
58
  named anything but you have to pick up the value in the wrapper component.
58
59
 
59
- ```jsx
60
+ ```tsx
60
61
  // Example in a search results page.
61
- const getPageHref = (page) => {
62
- return `${location.origin}?q=celeste&page=${page}`;
62
+ const getPageHref = (selectedPage: number) => {
63
+ // This should be updated for your router system, if any, including the
64
+ // base or origin URL.
65
+ return `${location.origin}?q=celeste&page=${selectedPage}`;
63
66
  };
64
67
  ```
65
68
 
@@ -67,8 +70,8 @@ const getPageHref = (page) => {
67
70
  <Story
68
71
  name="Pagination with URL Updates"
69
72
  args={{
70
- currentPage: 4,
71
- pageCount: 100,
73
+ initialPage: 1,
74
+ pageCount: 10,
72
75
  }}
73
76
  >
74
77
  {(args) => stories.PaginationGetPageHref(args)}
@@ -82,29 +85,25 @@ const getPageHref = (page) => {
82
85
  It is preferred to use the `Pagination` component with the `getPageHref`
83
86
  function passed as a prop and that the URL is updated whenever a page is
84
87
  changed. However, the optional `onPageChange` prop is available in case URL
85
- updating is not desired. The parent component must now keep track of the state
86
- of the current page value.
88
+ updating is not desired.
87
89
 
88
- the `getPageHref` function will compute a new URL that
89
- has `&page=` as a URL query. In your own application this query parameter can be
90
- named anything but you have to pick up the value in the wrapper component.
90
+ In the following example, the `onPageChange` function gets the current page as
91
+ its only function argument. This is computed internally in the `Pagination`
92
+ component through its own state.
91
93
 
92
- In the following example, the `onPageChange` function is keeping track of the
93
- current page through the use of React's `useState` feature.
94
-
95
- ```jsx
94
+ ```tsx
96
95
  // Example in a search results page.
97
- const [computedCurrentPage, setComputedCurrentPage] = useState(
98
- args.currentPage
99
- );
100
- const onPageChange = (page: number) => setComputedCurrentPage(page);
96
+ const onPageChange = (currentPage: number) => {
97
+ console.log(`Current page: ${currentPage}`);
98
+ // Do what you need to with the `currentPage` value.
99
+ };
101
100
  ```
102
101
 
103
102
  <Canvas withToolbar>
104
103
  <Story
105
104
  name="Pagination with Unchanging URL"
106
105
  args={{
107
- currentPage: 7,
106
+ initialPage: 7,
108
107
  pageCount: 100,
109
108
  }}
110
109
  >
@@ -1,17 +1,19 @@
1
- import React, { useEffect, useState } from "react";
1
+ import React from "react";
2
2
  import { Story } from "@storybook/react/types-6-0";
3
3
 
4
4
  import Pagination, { PaginationProps } from "./Pagination";
5
5
 
6
6
  /**
7
7
  * PaginationGetPageHref will refresh the browser as a new page is selected.
8
+ * In this example, `getPageHref` creates the `href` attribute for each
9
+ * page URL.
8
10
  */
9
11
  export const PaginationGetPageHref: Story<PaginationProps> = (args) => {
10
12
  // This uses the `addon-queryparams` Storybook addon.
11
13
  const urlParams = new URLSearchParams(document.location.search);
12
14
  const pageParam = urlParams.get("page");
13
15
  const getPageNumber = (page: number, pageCount: number) => {
14
- return page > 0 && page < pageCount ? page : 1;
16
+ return page > 0 && page <= pageCount ? page : 1;
15
17
  };
16
18
  const computedCurrentPage =
17
19
  pageParam &&
@@ -20,15 +22,14 @@ export const PaginationGetPageHref: Story<PaginationProps> = (args) => {
20
22
  const location = window.location;
21
23
  // Passing this function into `Pagination` makes the URL to change
22
24
  // and refreshes the page.
23
- const getPageHref = (page) => {
24
- const currentStoryId = urlParams.get("id");
25
- return `${location.origin}?path=/story/${currentStoryId}&page=${page}`;
25
+ const getPageHref = (selectedPage) => {
26
+ return `${location.href}&page=${selectedPage}`;
26
27
  };
27
28
 
28
29
  return (
29
30
  <Pagination
30
31
  pageCount={args.pageCount}
31
- currentPage={computedCurrentPage || args.currentPage}
32
+ initialPage={computedCurrentPage || args.initialPage}
32
33
  getPageHref={getPageHref}
33
34
  />
34
35
  );
@@ -39,20 +40,14 @@ export const PaginationGetPageHref: Story<PaginationProps> = (args) => {
39
40
  * selected but will not change the URL or refresh the page.
40
41
  */
41
42
  export const PaginationOnPageChange: Story<PaginationProps> = (args) => {
42
- const [computedCurrentPage, setComputedCurrentPage] = useState(
43
- args.currentPage
44
- );
45
- const onPageChange = (page: number) => setComputedCurrentPage(page);
46
-
47
- // Allows storybook controls to control `currentPage` prop.
48
- useEffect(() => {
49
- setComputedCurrentPage(args.currentPage);
50
- }, [args.currentPage]);
43
+ const onPageChange = (currentPage: number) => {
44
+ console.log(`Current page: ${currentPage}`);
45
+ };
51
46
 
52
47
  return (
53
48
  <Pagination
54
49
  pageCount={args.pageCount}
55
- currentPage={computedCurrentPage}
50
+ initialPage={args.initialPage}
56
51
  onPageChange={onPageChange}
57
52
  />
58
53
  );