@nypl/design-system-react-components 0.25.11 → 0.25.12

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 (96) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +4 -16
  3. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -0
  4. package/dist/components/Icons/IconTypes.d.ts +9 -7
  5. package/dist/components/Logo/LogoSvgs.d.ts +6 -0
  6. package/dist/components/Logo/LogoTypes.d.ts +6 -0
  7. package/dist/components/Pagination/Pagination.d.ts +6 -2
  8. package/dist/components/SearchBar/SearchBar.d.ts +1 -1
  9. package/dist/components/Template/Template.d.ts +1 -1
  10. package/dist/design-system-react-components.cjs.development.js +947 -438
  11. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  12. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  13. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  14. package/dist/design-system-react-components.esm.js +948 -439
  15. package/dist/design-system-react-components.esm.js.map +1 -1
  16. package/dist/styles.css +1 -1
  17. package/dist/theme/components/breadcrumb.d.ts +3 -0
  18. package/dist/theme/components/checkbox.d.ts +0 -2
  19. package/dist/theme/components/fieldset.d.ts +2 -0
  20. package/dist/theme/components/global.d.ts +15 -14
  21. package/dist/theme/components/globalMixins.d.ts +8 -8
  22. package/dist/theme/components/list.d.ts +6 -0
  23. package/dist/theme/components/notification.d.ts +3 -0
  24. package/dist/theme/components/radio.d.ts +3 -2
  25. package/dist/theme/components/select.d.ts +2 -9
  26. package/dist/theme/components/slider.d.ts +8 -4
  27. package/dist/theme/components/textInput.d.ts +8 -12
  28. package/dist/theme/components/toggle.d.ts +6 -2
  29. package/dist/theme/foundations/global.d.ts +31 -3
  30. package/dist/utils/utils.d.ts +10 -0
  31. package/package.json +1 -1
  32. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +18 -1
  33. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +10 -0
  34. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -0
  35. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +99 -0
  36. package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
  37. package/src/components/Checkbox/Checkbox.tsx +1 -0
  38. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +6 -6
  39. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +18 -18
  40. package/src/components/Fieldset/Fieldset.stories.mdx +1 -1
  41. package/src/components/Icons/Icon.stories.mdx +1 -1
  42. package/src/components/Icons/IconTypes.tsx +8 -6
  43. package/src/components/List/List.stories.mdx +1 -1
  44. package/src/components/Logo/Logo.stories.mdx +1 -1
  45. package/src/components/Logo/LogoSvgs.tsx +12 -0
  46. package/src/components/Logo/LogoTypes.tsx +6 -0
  47. package/src/components/Notification/Notification.stories.mdx +6 -1
  48. package/src/components/Notification/Notification.test.tsx +20 -9
  49. package/src/components/Notification/Notification.tsx +6 -4
  50. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +103 -8
  51. package/src/components/Pagination/Pagination.stories.mdx +54 -12
  52. package/src/components/Pagination/Pagination.test.tsx +63 -5
  53. package/src/components/Pagination/Pagination.tsx +45 -23
  54. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +3 -3
  55. package/src/components/Radio/Radio.stories.mdx +1 -1
  56. package/src/components/Radio/Radio.tsx +1 -0
  57. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +5 -5
  58. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +18 -18
  59. package/src/components/SearchBar/SearchBar.Test.tsx +20 -2
  60. package/src/components/SearchBar/SearchBar.stories.mdx +4 -4
  61. package/src/components/SearchBar/SearchBar.tsx +3 -2
  62. package/src/components/Select/Select.stories.mdx +1 -1
  63. package/src/components/Slider/Slider.stories.mdx +1 -1
  64. package/src/components/Slider/Slider.tsx +4 -1
  65. package/src/components/StyleGuide/Bidirectionality.stories.mdx +4 -4
  66. package/src/components/StyleGuide/Colors.stories.mdx +33 -18
  67. package/src/components/Template/Template.stories.mdx +1 -1
  68. package/src/components/Template/Template.tsx +2 -6
  69. package/src/components/Template/__snapshots__/Template.test.tsx.snap +2 -2
  70. package/src/components/Toggle/Toggle.stories.mdx +1 -1
  71. package/src/components/Toggle/Toggle.tsx +2 -1
  72. package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +4 -4
  73. package/src/docs/Chakra.stories.mdx +1 -1
  74. package/src/styles/base/_place-holder.scss +2 -0
  75. package/src/styles.scss +0 -2
  76. package/src/theme/components/breadcrumb.ts +4 -0
  77. package/src/theme/components/checkbox.ts +3 -7
  78. package/src/theme/components/fieldset.ts +2 -0
  79. package/src/theme/components/global.ts +18 -15
  80. package/src/theme/components/globalMixins.ts +8 -8
  81. package/src/theme/components/list.ts +4 -0
  82. package/src/theme/components/notification.ts +3 -0
  83. package/src/theme/components/radio.ts +3 -6
  84. package/src/theme/components/select.ts +3 -3
  85. package/src/theme/components/slider.ts +12 -9
  86. package/src/theme/components/textInput.ts +2 -2
  87. package/src/theme/components/toggle.ts +41 -37
  88. package/src/theme/foundations/colors.ts +19 -12
  89. package/src/theme/foundations/global.ts +17 -5
  90. package/src/theme/foundations/typography.ts +1 -1
  91. package/src/utils/componentCategories.ts +1 -1
  92. package/src/utils/utils.ts +28 -0
  93. package/dist/components/Pagination/Pagination.stories.d.ts +0 -13
  94. package/src/components/Pagination/Pagination.stories.tsx +0 -54
  95. package/src/styles/base/_03-base.scss +0 -25
  96. package/src/styles/base/_04-focus.scss +0 -22
@@ -11,19 +11,19 @@ describe("Pagination Accessibility", () => {
11
11
 
12
12
  it("passes axe accessibility on the first page", async () => {
13
13
  const { container } = render(
14
- <Pagination pageCount={20} initialPage={1} getPageHref={getPageHref} />
14
+ <Pagination pageCount={20} currentPage={1} getPageHref={getPageHref} />
15
15
  );
16
16
  expect(await axe(container)).toHaveNoViolations();
17
17
  });
18
18
  it("passes axe accessibility on a middle page", async () => {
19
19
  const { container } = render(
20
- <Pagination pageCount={20} initialPage={10} getPageHref={getPageHref} />
20
+ <Pagination pageCount={20} currentPage={10} getPageHref={getPageHref} />
21
21
  );
22
22
  expect(await axe(container)).toHaveNoViolations();
23
23
  });
24
24
  it("passes axe accessibility on the last page", async () => {
25
25
  const { container } = render(
26
- <Pagination pageCount={20} initialPage={20} getPageHref={getPageHref} />
26
+ <Pagination pageCount={20} currentPage={20} getPageHref={getPageHref} />
27
27
  );
28
28
  expect(await axe(container)).toHaveNoViolations();
29
29
  });
@@ -166,7 +166,7 @@ describe("Pagination", () => {
166
166
  expect(screen.queryByRole("navigation")).not.toBeInTheDocument();
167
167
  });
168
168
 
169
- it("Renders the UI snapshot correctly", () => {
169
+ it("renders the UI snapshot correctly", () => {
170
170
  const firstPage = renderer
171
171
  .create(
172
172
  <Pagination
@@ -230,7 +230,7 @@ describe("Pagination", () => {
230
230
 
231
231
  // In this scenario, we need to update the current page ourselves
232
232
  // since we stay on the same page.
233
- it("When page item is selected, runs the onPageChange callback", () => {
233
+ it("when page item is selected, runs the onPageChange callback", () => {
234
234
  const onPageChange = (page: number) => (currentPage = page);
235
235
  let currentPage = 5;
236
236
  const { rerender } = render(
@@ -304,5 +304,63 @@ describe("Pagination", () => {
304
304
  userEvent.click(links[2]);
305
305
  expect(currentPage).toEqual(6);
306
306
  });
307
+
308
+ it("uses the currentPage prop to update the selected page", () => {
309
+ const onPageChange = (page: number) => console.log(page);
310
+ const { rerender } = render(
311
+ <Pagination currentPage={1} onPageChange={onPageChange} pageCount={5} />
312
+ );
313
+
314
+ let links = screen.getAllByRole("link");
315
+ let page1 = links[0].getAttribute("aria-current");
316
+ let page2 = links[1].getAttribute("aria-current");
317
+ let page3 = links[2].getAttribute("aria-current");
318
+
319
+ // Only the current page has `aria-current="page"` for accessibility.
320
+ expect(page1).toEqual("page");
321
+ expect(page2).toEqual(null);
322
+ expect(page3).toEqual(null);
323
+
324
+ rerender(
325
+ <Pagination currentPage={3} onPageChange={onPageChange} pageCount={5} />
326
+ );
327
+
328
+ links = screen.getAllByRole("link");
329
+ // links[0] is now "Previous"
330
+ page1 = links[1].getAttribute("aria-current");
331
+ page2 = links[2].getAttribute("aria-current");
332
+ page3 = links[3].getAttribute("aria-current");
333
+
334
+ expect(page1).toEqual(null);
335
+ expect(page2).toEqual(null);
336
+ expect(page3).toEqual("page");
337
+ });
338
+
339
+ it("logs a warning if both `getPageHref` and `onPageChange` props are both passed", () => {
340
+ const getPageHref = (page: number) => `page=${page}`;
341
+ const onPageChange = (page: number) => console.log(page);
342
+ const warn = jest.spyOn(console, "warn");
343
+ render(
344
+ <Pagination
345
+ pageCount={10}
346
+ onPageChange={onPageChange}
347
+ getPageHref={getPageHref}
348
+ />
349
+ );
350
+ expect(warn).toHaveBeenCalledWith(
351
+ "NYPL Reservoir Pagination: Props for both `getPageHref` and `onPageChange` are passed. Will default to using `getPageHref`."
352
+ );
353
+ });
354
+
355
+ it("logs a warning if both `getPageHref` and `currentPage` props are both passed", () => {
356
+ const getPageHref = (page: number) => `page=${page}`;
357
+ const warn = jest.spyOn(console, "warn");
358
+ render(
359
+ <Pagination pageCount={10} currentPage={2} getPageHref={getPageHref} />
360
+ );
361
+ expect(warn).toHaveBeenCalledWith(
362
+ "NYPL Reservoir Pagination: The `currentPage` prop does not work with the `getPageHref` prop. Use `currentPage` with `onPageChange` instead."
363
+ );
364
+ });
307
365
  });
308
366
  });
@@ -1,4 +1,4 @@
1
- import React, { useState } from "react";
1
+ import React, { useState, useRef } from "react";
2
2
  import { Box, useMultiStyleConfig } from "@chakra-ui/react";
3
3
 
4
4
  import Link from "../Link/Link";
@@ -10,14 +10,18 @@ import generateUUID from "../../helpers/generateUUID";
10
10
  export interface PaginationProps {
11
11
  /** Additional className. */
12
12
  className?: string;
13
+ /** The currentPage can be used to programatically force the selected page to change
14
+ * without the user explicitly requesting it – for example, if the user should be
15
+ * brought back to the first page of a set of results after a new search. */
16
+ currentPage?: number;
13
17
  /** The callback function that takes a page number and returns a string
14
18
  * to use for a link's `href` attribute. This is used when the current
15
19
  * page should refresh when navigating. */
16
20
  getPageHref?: undefined | ((pageNumber: number) => string);
17
21
  /** ID that other components can cross reference for accessibility purposes. */
18
22
  id?: string;
19
- /** The current page selected. */
20
- initialPage: number;
23
+ /** The initially selected page (default value is 1). */
24
+ initialPage?: number;
21
25
  /** The callback function called when an item is selected and the current
22
26
  * page should not refresh. */
23
27
  onPageChange?: (selected: number) => void;
@@ -31,16 +35,28 @@ export interface PaginationProps {
31
35
  const Pagination: React.FC<PaginationProps> = (props: PaginationProps) => {
32
36
  const {
33
37
  className,
38
+ currentPage,
34
39
  getPageHref,
35
40
  id = generateUUID(),
36
41
  initialPage = 1,
37
42
  onPageChange,
38
43
  pageCount,
39
44
  } = props;
40
- const [currentPage, setCurrentPage] = useState<number>(initialPage);
45
+ const refCurrentPage = useRef(currentPage);
46
+ const [selectedPage, setSelectedPage] = useState<number>(initialPage);
41
47
  const styles = useMultiStyleConfig("Pagination", {});
42
- const previousPageNumber = currentPage - 1;
43
- const nextPageNumber = currentPage + 1;
48
+ const previousPageNumber = selectedPage - 1;
49
+ const nextPageNumber = selectedPage + 1;
50
+
51
+ // If the parent passes down a new currentPage, and an onPageChange
52
+ // function exists, then set the internal state – selectedPage –
53
+ // to the new currentPage and update the refCurrentPage with that value.
54
+ React.useEffect(() => {
55
+ if (onPageChange && currentPage !== refCurrentPage.current) {
56
+ setSelectedPage(currentPage);
57
+ refCurrentPage.current = currentPage;
58
+ }
59
+ }, [currentPage, onPageChange]);
44
60
 
45
61
  // If there are 0 or 1 page, the pagination should not show.
46
62
  if (pageCount <= 1) {
@@ -48,7 +64,13 @@ const Pagination: React.FC<PaginationProps> = (props: PaginationProps) => {
48
64
  }
49
65
  if (getPageHref && onPageChange) {
50
66
  console.warn(
51
- "Props for both `getPageHref` and `onPageChange` are passed. Will default to using `getPageHref`."
67
+ "NYPL Reservoir Pagination: Props for both `getPageHref` and `onPageChange` are passed. Will default to using `getPageHref`."
68
+ );
69
+ }
70
+
71
+ if (getPageHref && currentPage) {
72
+ console.warn(
73
+ "NYPL Reservoir Pagination: The `currentPage` prop does not work with the `getPageHref` prop. Use `currentPage` with `onPageChange` instead."
52
74
  );
53
75
  }
54
76
 
@@ -59,22 +81,22 @@ const Pagination: React.FC<PaginationProps> = (props: PaginationProps) => {
59
81
  * This function is only called when clicking on a link should
60
82
  * not update the URL or refresh the page.
61
83
  */
62
- const selectPage = (e: Event, selectedPage: number) => {
84
+ const handlePageClick = (e: Event, clickedPage: number) => {
63
85
  e.preventDefault && e.preventDefault();
64
- if (currentPage === selectedPage) return;
65
- setCurrentPage(selectedPage);
66
- onPageChange && onPageChange(selectedPage);
86
+ if (selectedPage === clickedPage) return;
87
+ setSelectedPage(clickedPage);
88
+ onPageChange && onPageChange(clickedPage);
67
89
  };
68
90
  // Select the previous page.
69
91
  const previousPage = (e: Event) => {
70
- if (currentPage > 1) {
71
- selectPage(e, previousPageNumber);
92
+ if (selectedPage > 1) {
93
+ handlePageClick(e, previousPageNumber);
72
94
  }
73
95
  };
74
96
  // Select the next page.
75
97
  const nextPage = (e: Event) => {
76
- if (currentPage < pageCount) {
77
- selectPage(e, nextPageNumber);
98
+ if (selectedPage < pageCount) {
99
+ handlePageClick(e, previousPageNumber);
78
100
  }
79
101
  };
80
102
  /**
@@ -87,9 +109,9 @@ const Pagination: React.FC<PaginationProps> = (props: PaginationProps) => {
87
109
  * "#" and call the `onPageChange` prop through the `onClick` callback.
88
110
  */
89
111
  const getLinkElement = (type: string, item?: number) => {
90
- const isCurrentPage = currentPage === item;
112
+ const isSelectedPage = selectedPage === item;
91
113
  // The current page link has different styles.
92
- const currentStyles = isCurrentPage
114
+ const currentStyles = isSelectedPage
93
115
  ? {
94
116
  color: "ui.black",
95
117
  pointerEvent: "none",
@@ -100,8 +122,8 @@ const Pagination: React.FC<PaginationProps> = (props: PaginationProps) => {
100
122
  href: changeUrls ? getPageHref(item) : "#",
101
123
  attributes: {
102
124
  "aria-label": `Page ${item}`,
103
- "aria-current": isCurrentPage ? "page" : null,
104
- onClick: changeUrls ? undefined : (e) => selectPage(e, item),
125
+ "aria-current": isSelectedPage ? "page" : null,
126
+ onClick: changeUrls ? undefined : (e) => handlePageClick(e, item),
105
127
  },
106
128
  text: item,
107
129
  },
@@ -210,11 +232,11 @@ const Pagination: React.FC<PaginationProps> = (props: PaginationProps) => {
210
232
  };
211
233
 
212
234
  // Don't display the previous link when you're on the first page.
213
- const previousLiLink = currentPage !== 1 && (
235
+ const previousLiLink = selectedPage !== 1 && (
214
236
  <li key="previous">{getLinkElement("previous")}</li>
215
237
  );
216
- /// Don't display the next link when you're on the last page.
217
- const nextLiLink = currentPage !== pageCount && (
238
+ // Don't display the next link when you're on the last page.
239
+ const nextLiLink = selectedPage !== pageCount && (
218
240
  <li key="next">{getLinkElement("next")}</li>
219
241
  );
220
242
 
@@ -229,7 +251,7 @@ const Pagination: React.FC<PaginationProps> = (props: PaginationProps) => {
229
251
  >
230
252
  <List type={ListTypes.Unordered} inline noStyling id={`${id}-list`}>
231
253
  {previousLiLink}
232
- {getPaginationNumbers(currentPage)}
254
+ {getPaginationNumbers(selectedPage)}
233
255
  {nextLiLink}
234
256
  </List>
235
257
  </Box>
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Pagination Rendering Renders the UI snapshot correctly 1`] = `
3
+ exports[`Pagination Rendering renders the UI snapshot correctly 1`] = `
4
4
  <nav
5
5
  aria-label="Pagination"
6
6
  className="css-0"
@@ -108,7 +108,7 @@ exports[`Pagination Rendering Renders the UI snapshot correctly 1`] = `
108
108
  </nav>
109
109
  `;
110
110
 
111
- exports[`Pagination Rendering Renders the UI snapshot correctly 2`] = `
111
+ exports[`Pagination Rendering renders the UI snapshot correctly 2`] = `
112
112
  <nav
113
113
  aria-label="Pagination"
114
114
  className="css-0"
@@ -216,7 +216,7 @@ exports[`Pagination Rendering Renders the UI snapshot correctly 2`] = `
216
216
  </nav>
217
217
  `;
218
218
 
219
- exports[`Pagination Rendering Renders the UI snapshot correctly 3`] = `
219
+ exports[`Pagination Rendering renders the UI snapshot correctly 3`] = `
220
220
  <nav
221
221
  aria-label="Pagination"
222
222
  className="css-0"
@@ -53,7 +53,7 @@ import DSProvider from "../../theme/provider";
53
53
  | Component Version | DS Version |
54
54
  | ----------------- | ---------- |
55
55
  | Added | `0.22.0` |
56
- | Latest | `0.25.10` |
56
+ | Latest | `0.25.12` |
57
57
 
58
58
  <Description of={Radio} />
59
59
 
@@ -95,6 +95,7 @@ const Radio = React.forwardRef<HTMLInputElement, RadioProps>((props, ref?) => {
95
95
  onChange={onChange}
96
96
  value={value}
97
97
  ref={ref}
98
+ alignItems="flex-start"
98
99
  __css={styles}
99
100
  {...attributes}
100
101
  >
@@ -2,7 +2,7 @@
2
2
 
3
3
  exports[`Radio Button renders the UI snapshot correctly 1`] = `
4
4
  <label
5
- className="chakra-radio css-1pw4d56"
5
+ className="chakra-radio css-13p0l12"
6
6
  >
7
7
  <input
8
8
  checked={false}
@@ -50,7 +50,7 @@ exports[`Radio Button renders the UI snapshot correctly 1`] = `
50
50
 
51
51
  exports[`Radio Button renders the UI snapshot correctly 2`] = `
52
52
  <label
53
- className="chakra-radio css-1pw4d56"
53
+ className="chakra-radio css-13p0l12"
54
54
  data-checked=""
55
55
  >
56
56
  <input
@@ -101,7 +101,7 @@ exports[`Radio Button renders the UI snapshot correctly 2`] = `
101
101
 
102
102
  exports[`Radio Button renders the UI snapshot correctly 3`] = `
103
103
  <label
104
- className="chakra-radio css-1pw4d56"
104
+ className="chakra-radio css-13p0l12"
105
105
  >
106
106
  <input
107
107
  aria-required={true}
@@ -150,7 +150,7 @@ exports[`Radio Button renders the UI snapshot correctly 3`] = `
150
150
 
151
151
  exports[`Radio Button renders the UI snapshot correctly 4`] = `
152
152
  <label
153
- className="chakra-radio css-1pw4d56"
153
+ className="chakra-radio css-13p0l12"
154
154
  data-invalid=""
155
155
  >
156
156
  <input
@@ -202,7 +202,7 @@ exports[`Radio Button renders the UI snapshot correctly 4`] = `
202
202
 
203
203
  exports[`Radio Button renders the UI snapshot correctly 5`] = `
204
204
  <label
205
- className="chakra-radio css-1pw4d56"
205
+ className="chakra-radio css-13p0l12"
206
206
  data-disabled=""
207
207
  >
208
208
  <input
@@ -19,7 +19,7 @@ exports[`Radio Button renders the UI snapshot correctly 1`] = `
19
19
  role="radiogroup"
20
20
  >
21
21
  <label
22
- className="chakra-radio css-1pw4d56"
22
+ className="chakra-radio css-13p0l12"
23
23
  >
24
24
  <input
25
25
  checked={false}
@@ -66,7 +66,7 @@ exports[`Radio Button renders the UI snapshot correctly 1`] = `
66
66
  </span>
67
67
  </label>
68
68
  <label
69
- className="chakra-radio css-1pw4d56"
69
+ className="chakra-radio css-13p0l12"
70
70
  >
71
71
  <input
72
72
  checked={false}
@@ -135,7 +135,7 @@ exports[`Radio Button renders the UI snapshot correctly 2`] = `
135
135
  role="radiogroup"
136
136
  >
137
137
  <label
138
- className="chakra-radio css-1pw4d56"
138
+ className="chakra-radio css-13p0l12"
139
139
  >
140
140
  <input
141
141
  checked={false}
@@ -182,7 +182,7 @@ exports[`Radio Button renders the UI snapshot correctly 2`] = `
182
182
  </span>
183
183
  </label>
184
184
  <label
185
- className="chakra-radio css-1pw4d56"
185
+ className="chakra-radio css-13p0l12"
186
186
  >
187
187
  <input
188
188
  checked={false}
@@ -251,7 +251,7 @@ exports[`Radio Button renders the UI snapshot correctly 3`] = `
251
251
  role="radiogroup"
252
252
  >
253
253
  <label
254
- className="chakra-radio css-1pw4d56"
254
+ className="chakra-radio css-13p0l12"
255
255
  >
256
256
  <input
257
257
  checked={false}
@@ -298,7 +298,7 @@ exports[`Radio Button renders the UI snapshot correctly 3`] = `
298
298
  </span>
299
299
  </label>
300
300
  <label
301
- className="chakra-radio css-1pw4d56"
301
+ className="chakra-radio css-13p0l12"
302
302
  >
303
303
  <input
304
304
  checked={false}
@@ -367,7 +367,7 @@ exports[`Radio Button renders the UI snapshot correctly 4`] = `
367
367
  role="radiogroup"
368
368
  >
369
369
  <label
370
- className="chakra-radio css-1pw4d56"
370
+ className="chakra-radio css-13p0l12"
371
371
  >
372
372
  <input
373
373
  checked={false}
@@ -414,7 +414,7 @@ exports[`Radio Button renders the UI snapshot correctly 4`] = `
414
414
  </span>
415
415
  </label>
416
416
  <label
417
- className="chakra-radio css-1pw4d56"
417
+ className="chakra-radio css-13p0l12"
418
418
  >
419
419
  <input
420
420
  checked={false}
@@ -499,7 +499,7 @@ exports[`Radio Button renders the UI snapshot correctly 5`] = `
499
499
  role="radiogroup"
500
500
  >
501
501
  <label
502
- className="chakra-radio css-1pw4d56"
502
+ className="chakra-radio css-13p0l12"
503
503
  >
504
504
  <input
505
505
  checked={false}
@@ -546,7 +546,7 @@ exports[`Radio Button renders the UI snapshot correctly 5`] = `
546
546
  </span>
547
547
  </label>
548
548
  <label
549
- className="chakra-radio css-1pw4d56"
549
+ className="chakra-radio css-13p0l12"
550
550
  >
551
551
  <input
552
552
  checked={false}
@@ -610,7 +610,7 @@ exports[`Radio Button renders the UI snapshot correctly 6`] = `
610
610
  role="radiogroup"
611
611
  >
612
612
  <label
613
- className="chakra-radio css-1pw4d56"
613
+ className="chakra-radio css-13p0l12"
614
614
  >
615
615
  <input
616
616
  checked={false}
@@ -657,7 +657,7 @@ exports[`Radio Button renders the UI snapshot correctly 6`] = `
657
657
  </span>
658
658
  </label>
659
659
  <label
660
- className="chakra-radio css-1pw4d56"
660
+ className="chakra-radio css-13p0l12"
661
661
  >
662
662
  <input
663
663
  checked={false}
@@ -726,7 +726,7 @@ exports[`Radio Button renders the UI snapshot correctly 7`] = `
726
726
  role="radiogroup"
727
727
  >
728
728
  <label
729
- className="chakra-radio css-1pw4d56"
729
+ className="chakra-radio css-13p0l12"
730
730
  >
731
731
  <input
732
732
  aria-required={true}
@@ -774,7 +774,7 @@ exports[`Radio Button renders the UI snapshot correctly 7`] = `
774
774
  </span>
775
775
  </label>
776
776
  <label
777
- className="chakra-radio css-1pw4d56"
777
+ className="chakra-radio css-13p0l12"
778
778
  >
779
779
  <input
780
780
  aria-required={true}
@@ -844,7 +844,7 @@ exports[`Radio Button renders the UI snapshot correctly 8`] = `
844
844
  role="radiogroup"
845
845
  >
846
846
  <label
847
- className="chakra-radio css-1pw4d56"
847
+ className="chakra-radio css-13p0l12"
848
848
  data-invalid=""
849
849
  >
850
850
  <input
@@ -895,7 +895,7 @@ exports[`Radio Button renders the UI snapshot correctly 8`] = `
895
895
  </span>
896
896
  </label>
897
897
  <label
898
- className="chakra-radio css-1pw4d56"
898
+ className="chakra-radio css-13p0l12"
899
899
  data-invalid=""
900
900
  >
901
901
  <input
@@ -968,7 +968,7 @@ exports[`Radio Button renders the UI snapshot correctly 9`] = `
968
968
  role="radiogroup"
969
969
  >
970
970
  <label
971
- className="chakra-radio css-1pw4d56"
971
+ className="chakra-radio css-13p0l12"
972
972
  data-disabled=""
973
973
  >
974
974
  <input
@@ -1019,7 +1019,7 @@ exports[`Radio Button renders the UI snapshot correctly 9`] = `
1019
1019
  </span>
1020
1020
  </label>
1021
1021
  <label
1022
- className="chakra-radio css-1pw4d56"
1022
+ className="chakra-radio css-13p0l12"
1023
1023
  data-disabled=""
1024
1024
  >
1025
1025
  <input
@@ -217,6 +217,25 @@ describe("SearchBar", () => {
217
217
  expect(searchBarSubmit).toHaveBeenCalledTimes(1);
218
218
  });
219
219
 
220
+ it("renders a default placeholder", () => {
221
+ const textInputProps: TextInputProps = {
222
+ labelText: "Item Search",
223
+ name: "textInputName",
224
+ };
225
+
226
+ render(
227
+ <SearchBar
228
+ id="requiredState"
229
+ isDisabled
230
+ labelText={labelText}
231
+ onSubmit={jest.fn()}
232
+ textInputProps={textInputProps}
233
+ />
234
+ );
235
+
236
+ expect(screen.getByPlaceholderText("Search terms")).toBeInTheDocument();
237
+ });
238
+
220
239
  it("renders 'required' in the placeholder text", () => {
221
240
  const { rerender } = render(
222
241
  <SearchBar
@@ -247,8 +266,7 @@ describe("SearchBar", () => {
247
266
  ).toBeInTheDocument();
248
267
  });
249
268
 
250
- // TODO: Fix the `Select` component before enabling this test
251
- it.skip("renders the UI snapshot correctly", () => {
269
+ it("renders the UI snapshot correctly", () => {
252
270
  const basic = renderer
253
271
  .create(
254
272
  <SearchBar
@@ -60,7 +60,7 @@ import DSProvider from "../../theme/provider";
60
60
  | Component Version | DS Version |
61
61
  | ----------------- | ---------- |
62
62
  | Added | `0.0.4` |
63
- | Latest | `0.25.11` |
63
+ | Latest | `0.25.12` |
64
64
 
65
65
  <Description of={SearchBar} />
66
66
 
@@ -166,9 +166,9 @@ const selectProps = {
166
166
  ### TextInput Component
167
167
 
168
168
  To render the `TextInput` component, an object must be passed to the
169
- `textInputProps` prop. It _must_ include `labelText`, `name`, and `placeholder`
170
- properties. The `labelText` value won't be rendered but will be used for its
171
- `aria-label` attribute. Optional properties to pass include `onChange` and `value`.
169
+ `textInputProps` prop. It _must_ include `labelText` and `name` properties. The
170
+ `labelText` value won't be rendered but will be used for its `aria-label`
171
+ attribute. Optional properties to pass include `onChange`, `placeholder`, and `value`.
172
172
 
173
173
  ```
174
174
  const textInputProps = {
@@ -27,7 +27,7 @@ export interface SelectProps extends BaseProps {
27
27
  optionsData: string[];
28
28
  }
29
29
  export interface TextInputProps extends BaseProps {
30
- placeholder: string;
30
+ placeholder?: string;
31
31
  value?: string;
32
32
  }
33
33
 
@@ -108,7 +108,8 @@ export default function SearchBar(props: SearchBarProps) {
108
108
  };
109
109
  const footnote = isInvalid ? invalidText : helperText;
110
110
  const finalAriaLabel = footnote ? `${labelText} - ${footnote}` : labelText;
111
- const textInputPlaceholder = `${textInputProps?.placeholder} ${
111
+ const inputPlaceholder = textInputProps?.placeholder || "Search terms";
112
+ const textInputPlaceholder = `${inputPlaceholder} ${
112
113
  isRequired ? "(Required)" : ""
113
114
  }`;
114
115
  const buttonType = noBrandButtonType
@@ -67,7 +67,7 @@ export const enumValues = getStorybookEnumValues(SelectTypes, "SelectTypes");
67
67
  | Component Version | DS Version |
68
68
  | ----------------- | ---------- |
69
69
  | Added | `0.7.0` |
70
- | Latest | `0.25.11` |
70
+ | Latest | `0.25.12` |
71
71
 
72
72
  <Description of={Select} />
73
73
 
@@ -76,7 +76,7 @@ import DSProvider from "../../theme/provider";
76
76
  | Component Version | DS Version |
77
77
  | ----------------- | ---------- |
78
78
  | Added | `0.25.4` |
79
- | Latest | `0.25.10` |
79
+ | Latest | `0.25.12` |
80
80
 
81
81
  <Description of={Slider} />
82
82
 
@@ -120,8 +120,8 @@ export default function Slider(props: React.PropsWithChildren<SliderProps>) {
120
120
  const styles = useMultiStyleConfig("CustomSlider", {
121
121
  isDisabled,
122
122
  isInvalid: finalIsInvalid,
123
- isRangeSlider,
124
123
  showBoxes,
124
+ showValues,
125
125
  });
126
126
  // Props that the `Slider` and `RangeSlider` Chakra
127
127
  // components both use.
@@ -138,6 +138,9 @@ export default function Slider(props: React.PropsWithChildren<SliderProps>) {
138
138
  // *final* value once a user stops dragging the slider.
139
139
  onChangeEnd: (val) => onChange && onChange(val),
140
140
  step,
141
+ // Additional margins so slider thumbs don't overflow past the
142
+ // edge when the value boxes or min/max values are hidden.
143
+ sx: styles.sliderContainer,
141
144
  };
142
145
  // Props that the two `TextInput` components use.
143
146
  const textInputSharedProps = {
@@ -51,11 +51,11 @@ implementation is `dir="rtl"`.
51
51
 
52
52
  The placement of this attribute can be added at the root `<html>` element but can
53
53
  also be placed in specific DOM elements within a page to target specific page sections.
54
- For example, if you only want to target NYPL DS components within the `nypl-ds` class,
55
- the `dir` attribute can be added to that element:
54
+ For example, if you only want to target NYPL DS components within your top-level
55
+ `app` class, the `dir` attribute can be added to that element:
56
56
 
57
57
  ```jsx
58
- <div className="app nypl-ds" dir="rtl">
58
+ <div className="app" dir="rtl">
59
59
  ...
60
60
  </div>
61
61
  ```
@@ -66,7 +66,7 @@ do the following:
66
66
 
67
67
  ```jsx
68
68
  // don't do this
69
- <div className="app nypl-ds" dir="rtl">
69
+ <div className="app" dir="rtl">
70
70
  <div dir="rtl">
71
71
  <p dir="rtl">
72
72
  Some text <button dir="rtl">Button</button>