@nypl/design-system-react-components 0.25.9 → 0.25.10

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 (78) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/components/DatePicker/DatePicker.d.ts +1 -1
  3. package/dist/components/Fieldset/Fieldset.d.ts +1 -3
  4. package/dist/components/Form/Form.d.ts +13 -12
  5. package/dist/components/Form/FormTypes.d.ts +2 -2
  6. package/dist/components/HorizontalRule/HorizontalRule.d.ts +1 -1
  7. package/dist/components/RadioGroup/RadioGroup.d.ts +3 -3
  8. package/dist/components/SearchBar/SearchBar.d.ts +5 -5
  9. package/dist/components/Table/Table.d.ts +9 -3
  10. package/dist/components/Template/Template.d.ts +23 -4
  11. package/dist/design-system-react-components.cjs.development.js +197 -89
  12. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  13. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  14. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  15. package/dist/design-system-react-components.esm.js +186 -91
  16. package/dist/design-system-react-components.esm.js.map +1 -1
  17. package/dist/index.d.ts +4 -4
  18. package/dist/resources.scss +0 -2
  19. package/dist/theme/components/breadcrumb.d.ts +1 -1
  20. package/dist/theme/components/customTable.d.ts +12 -3
  21. package/package.json +40 -36
  22. package/src/components/Accordion/Accordion.stories.mdx +1 -1
  23. package/src/components/Accordion/Accordion.test.tsx +45 -1
  24. package/src/components/Accordion/Accordion.tsx +20 -8
  25. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +243 -0
  26. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +13 -2
  27. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +15 -0
  28. package/src/components/Breadcrumbs/Breadcrumbs.tsx +9 -3
  29. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +5 -5
  30. package/src/components/Card/Card.stories.mdx +1 -1
  31. package/src/components/Card/Card.tsx +4 -1
  32. package/src/components/Chakra/Flex.stories.mdx +113 -0
  33. package/src/components/DatePicker/DatePicker.stories.mdx +1 -1
  34. package/src/components/DatePicker/DatePicker.test.tsx +6 -6
  35. package/src/components/DatePicker/DatePicker.tsx +3 -4
  36. package/src/components/Fieldset/Fieldset.stories.mdx +1 -1
  37. package/src/components/Fieldset/Fieldset.tsx +2 -4
  38. package/src/components/Form/Form.stories.mdx +34 -16
  39. package/src/components/Form/Form.test.tsx +92 -3
  40. package/src/components/Form/Form.tsx +25 -21
  41. package/src/components/Form/FormTypes.tsx +2 -2
  42. package/src/components/Form/__snapshots__/Form.test.tsx.snap +0 -1
  43. package/src/components/Hero/Hero.stories.mdx +1 -1
  44. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +3 -2
  45. package/src/components/HorizontalRule/HorizontalRule.tsx +2 -2
  46. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +4 -4
  47. package/src/components/List/List.stories.mdx +1 -1
  48. package/src/components/List/List.tsx +1 -1
  49. package/src/components/Pagination/Pagination.stories.mdx +1 -1
  50. package/src/components/Pagination/Pagination.tsx +2 -2
  51. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +5 -5
  52. package/src/components/RadioGroup/RadioGroup.stories.mdx +1 -1
  53. package/src/components/RadioGroup/RadioGroup.test.tsx +13 -11
  54. package/src/components/RadioGroup/RadioGroup.tsx +88 -89
  55. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +18 -18
  56. package/src/components/SearchBar/SearchBar.Test.tsx +106 -28
  57. package/src/components/SearchBar/SearchBar.stories.mdx +7 -4
  58. package/src/components/SearchBar/SearchBar.tsx +19 -20
  59. package/src/components/Select/Select.test.tsx +89 -0
  60. package/src/components/Select/Select.tsx +7 -1
  61. package/src/components/Select/__snapshots__/Select.test.tsx.snap +545 -0
  62. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +7 -0
  63. package/src/components/Table/Table.stories.mdx +118 -19
  64. package/src/components/Table/Table.test.tsx +80 -3
  65. package/src/components/Table/Table.tsx +26 -16
  66. package/src/components/Table/__snapshots__/Table.test.tsx.snap +1179 -0
  67. package/src/components/Tabs/Tabs.stories.mdx +1 -1
  68. package/src/components/Tabs/Tabs.test.tsx +21 -5
  69. package/src/components/Tabs/Tabs.tsx +33 -18
  70. package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +195 -0
  71. package/src/components/Template/Template.stories.mdx +79 -4
  72. package/src/components/Template/Template.test.tsx +65 -3
  73. package/src/components/Template/Template.tsx +58 -8
  74. package/src/components/Template/__snapshots__/Template.test.tsx.snap +93 -0
  75. package/src/index.ts +8 -2
  76. package/src/theme/components/breadcrumb.ts +1 -1
  77. package/src/theme/components/customTable.ts +16 -3
  78. package/src/utils/componentCategories.ts +1 -0
@@ -1,5 +1,5 @@
1
- import { useStyleConfig, Icon as Icon$2, Box, Accordion as Accordion$2, AccordionPanel, AccordionItem, AccordionButton, Breadcrumb as Breadcrumb$1, BreadcrumbItem, BreadcrumbLink, Button as Button$2, Heading as Heading$2, useMultiStyleConfig, LinkBox, LinkOverlay, Checkbox as Checkbox$2, CheckboxGroup as CheckboxGroup$2, Stack, SimpleGrid as SimpleGrid$1, Input, Textarea, extendTheme, ChakraProvider, CircularProgress, CircularProgressLabel, Progress, Radio as Radio$2, useRadioGroup, Text as Text$2, Select as Select$2, Skeleton as Skeleton$1, RangeSlider, RangeSliderTrack, RangeSliderFilledTrack, RangeSliderThumb, Slider as Slider$1, SliderTrack, SliderFilledTrack, SliderThumb, Tabs as Tabs$1, Tab, TabPanel, TabList, TabPanels, Switch as Switch$1, useTheme, Thead, Tr, Th, TableCaption, Table as Table$1, Tbody, Td } from '@chakra-ui/react';
2
- export { Box, ButtonGroup, Center, Circle, Grid, GridItem, HStack, Square, Stack, Tab, TabList, TabPanel, TabPanels, VStack } from '@chakra-ui/react';
1
+ import { useStyleConfig, Icon as Icon$2, Box, Accordion as Accordion$2, AccordionPanel, AccordionItem, AccordionButton, Breadcrumb as Breadcrumb$1, BreadcrumbItem, BreadcrumbLink, Button as Button$2, Heading as Heading$2, useMultiStyleConfig, LinkBox, LinkOverlay, Checkbox as Checkbox$2, CheckboxGroup as CheckboxGroup$2, Stack, SimpleGrid as SimpleGrid$1, Input, Textarea, extendTheme, ChakraProvider, CircularProgress, CircularProgressLabel, Progress, Radio as Radio$2, useRadioGroup, Text as Text$2, Select as Select$2, Skeleton as Skeleton$1, RangeSlider, RangeSliderTrack, RangeSliderFilledTrack, RangeSliderThumb, Slider as Slider$1, SliderTrack, SliderFilledTrack, SliderThumb, Tabs as Tabs$1, Tab, TabPanel, TabList, TabPanels, Switch as Switch$1, useTheme, TableCaption, Thead, Tr, Th, Table as Table$1, Tbody, Td } from '@chakra-ui/react';
2
+ export { Box, ButtonGroup, Center, Circle, Flex, Grid, GridItem, HStack, Spacer, Square, Stack, Tab, TabList, TabPanel, TabPanels, VStack } from '@chakra-ui/react';
3
3
  import React__default, { createElement, cloneElement, Fragment, Children, forwardRef, useState, Component, useEffect } from 'react';
4
4
  import { v4 } from 'uuid';
5
5
  import ReactDatePicker from 'react-datepicker';
@@ -1168,13 +1168,14 @@ function Icon(props) {
1168
1168
  * is open or closed.
1169
1169
  */
1170
1170
 
1171
- var getIcon = function getIcon(isExpanded) {
1171
+ var getIcon = function getIcon(isExpanded, index, id) {
1172
1172
  if (isExpanded === void 0) {
1173
1173
  isExpanded = false;
1174
1174
  }
1175
1175
 
1176
1176
  var iconName = isExpanded ? IconNames.Minus : IconNames.Plus;
1177
1177
  return createElement(Icon, {
1178
+ id: "accordion-" + id + "-icon-" + index,
1178
1179
  name: iconName,
1179
1180
  size: IconSizes.Small
1180
1181
  });
@@ -1186,7 +1187,7 @@ var getIcon = function getIcon(isExpanded) {
1186
1187
  */
1187
1188
 
1188
1189
 
1189
- var getElementsFromContentData = function getElementsFromContentData(data) {
1190
+ var getElementsFromContentData = function getElementsFromContentData(data, id) {
1190
1191
  var _data;
1191
1192
 
1192
1193
  if (data === void 0) {
@@ -1199,23 +1200,27 @@ var getElementsFromContentData = function getElementsFromContentData(data) {
1199
1200
  return data.map(function (content, index) {
1200
1201
  // This is done to support both string and DOM element input.
1201
1202
  var panel = typeof content.panel === "string" ? createElement(AccordionPanel, {
1203
+ id: id + "-panel-" + index,
1202
1204
  key: index,
1203
1205
  dangerouslySetInnerHTML: {
1204
1206
  __html: content.panel
1205
1207
  }
1206
1208
  }) : createElement(AccordionPanel, {
1209
+ id: id + "-panel-" + index,
1207
1210
  key: index
1208
1211
  }, content.panel);
1209
1212
  return createElement(AccordionItem, {
1213
+ id: id + "-item-" + index,
1210
1214
  key: index
1211
1215
  }, function (_ref) {
1212
1216
  var isExpanded = _ref.isExpanded;
1213
1217
  return createElement(Fragment, null, createElement(AccordionButton, {
1218
+ id: id + "-button-" + index,
1214
1219
  padding: multiplePadding
1215
1220
  }, createElement(Box, {
1216
1221
  flex: "1",
1217
1222
  textAlign: "left"
1218
- }, content.label), getIcon(isExpanded)), panel);
1223
+ }, content.label), getIcon(isExpanded, index, id)), panel);
1219
1224
  });
1220
1225
  });
1221
1226
  };
@@ -1237,7 +1242,7 @@ function Accordion(props) {
1237
1242
  id: id,
1238
1243
  defaultIndex: [openFirstAccordion],
1239
1244
  allowMultiple: true
1240
- }, getElementsFromContentData(contentData));
1245
+ }, getElementsFromContentData(contentData, id));
1241
1246
  }
1242
1247
 
1243
1248
  var ColorVariants;
@@ -1336,11 +1341,15 @@ function Breadcrumbs(props) {
1336
1341
  var finalStyles = _extends({}, styles, additionalStyles);
1337
1342
 
1338
1343
  var breadcrumbItems = getElementsFromData(breadcrumbsData, id);
1339
- return createElement(Breadcrumb$1, {
1344
+ var ariaAttrs = {
1345
+ "aria-label": "Breadcrumb"
1346
+ };
1347
+ return createElement(Breadcrumb$1, Object.assign({
1340
1348
  className: className,
1341
- __css: finalStyles,
1342
1349
  id: id
1343
- }, breadcrumbItems);
1350
+ }, ariaAttrs, {
1351
+ __css: finalStyles
1352
+ }), breadcrumbItems);
1344
1353
  }
1345
1354
 
1346
1355
  var ButtonTypes;
@@ -1891,7 +1900,7 @@ function Card(props) {
1891
1900
  mainActionLink: mainActionLink
1892
1901
  }, child.props.children) : child.props.children;
1893
1902
  var elem = cloneElement(child, {
1894
- additionalStyles: styles.heading,
1903
+ additionalStyles: _extends({}, styles.heading, child.props.additionalStyles),
1895
1904
  key: key,
1896
1905
  center: center,
1897
1906
  // Override the child text with the potential `CardLinkOverlay`.
@@ -2315,9 +2324,15 @@ function FormRow(props) {
2315
2324
  var count = Children.count(children);
2316
2325
  var alteredChildren = Children.map(children, function (child, i) {
2317
2326
  if (!child) return null;
2318
- return cloneElement(child, {
2319
- id: id + "-grandchild" + i
2320
- });
2327
+
2328
+ if (child.type === FormField || child.props.mdxType === "FormField") {
2329
+ return cloneElement(child, {
2330
+ id: id + "-grandchild" + i
2331
+ });
2332
+ }
2333
+
2334
+ console.warn("FormRow children must be `FormField` components.");
2335
+ return null;
2321
2336
  });
2322
2337
  return createElement(SimpleGrid, {
2323
2338
  columns: count,
@@ -2346,29 +2361,29 @@ function Form(props) {
2346
2361
  var action = props.action,
2347
2362
  children = props.children,
2348
2363
  className = props.className,
2364
+ _props$gap = props.gap,
2365
+ gap = _props$gap === void 0 ? GridGaps.Large : _props$gap,
2349
2366
  _props$id = props.id,
2350
2367
  id = _props$id === void 0 ? generateUUID() : _props$id,
2351
2368
  method = props.method,
2352
- _props$spacing = props.spacing,
2353
- spacing = _props$spacing === void 0 ? GridGaps.Large : _props$spacing;
2369
+ onSubmit = props.onSubmit;
2354
2370
  var attributes = {};
2355
2371
  action && (attributes["action"] = action);
2356
2372
  method && (method === "get" || method === "post") && (attributes["method"] = method);
2357
2373
  var alteredChildren = Children.map(children, function (child, i) {
2358
2374
  return cloneElement(child, {
2359
- gap: spacing,
2375
+ gap: gap,
2360
2376
  id: id + "-child" + i
2361
2377
  });
2362
2378
  });
2363
- return createElement(Box, Object.assign({
2364
- as: "form",
2379
+ return createElement("form", Object.assign({
2365
2380
  "aria-label": "form",
2366
- id: id
2367
- }, attributes, {
2368
- className: className
2369
- }), createElement(SimpleGrid, {
2381
+ className: className,
2382
+ id: id,
2383
+ onSubmit: onSubmit
2384
+ }, attributes), createElement(SimpleGrid, {
2370
2385
  columns: 1,
2371
- gap: spacing,
2386
+ gap: gap,
2372
2387
  id: id + "-parent"
2373
2388
  }, alteredChildren));
2374
2389
  }
@@ -3342,7 +3357,7 @@ var Breadcrumb = {
3342
3357
  marginInlineStart: "xxs"
3343
3358
  }
3344
3359
  },
3345
- "li:nth-last-child(2)": {
3360
+ "li:nth-last-of-type(2)": {
3346
3361
  display: "inline-block",
3347
3362
  span: {
3348
3363
  display: {
@@ -5451,6 +5466,15 @@ var baseStyle$3 = function baseStyle(_ref) {
5451
5466
  showRowDividers = _ref.showRowDividers,
5452
5467
  useRowHeaders = _ref.useRowHeaders;
5453
5468
  return {
5469
+ // Headers `th` can be rendered as the first cell in every row through the
5470
+ // `useRowHeaders`. Whereas the header `th` in the `thead` can be rendered
5471
+ // with a custom color, the row header `th` in the `tbody` should always
5472
+ // have text color black.
5473
+ tbody: {
5474
+ th: {
5475
+ color: "var(--nypl-colors-ui-black)"
5476
+ }
5477
+ },
5454
5478
  th: {
5455
5479
  border: showRowDividers ? undefined : "none",
5456
5480
  borderBottom: showRowDividers ? undefined : "0px",
@@ -5483,11 +5507,15 @@ var baseStyle$3 = function baseStyle(_ref) {
5483
5507
  },
5484
5508
  caption: {
5485
5509
  captionSide: "top",
5486
- textAlign: "left",
5487
- fontSize: "heading.secondary",
5488
5510
  color: "ui.black",
5489
- textTransform: "capitalize",
5490
- fontWeight: "heading.secondary"
5511
+ fontSize: "heading.secondary",
5512
+ fontWeight: "heading.secondary",
5513
+ marginBottom: "s",
5514
+ marginLeft: "0",
5515
+ marginRight: "0",
5516
+ marginTop: "0",
5517
+ padding: "0",
5518
+ textAlign: "left"
5491
5519
  }
5492
5520
  };
5493
5521
  };
@@ -6040,7 +6068,7 @@ function HorizontalRule$1(props) {
6040
6068
  _props$height = props.height,
6041
6069
  height = _props$height === void 0 ? "2px" : _props$height,
6042
6070
  _props$width = props.width,
6043
- width = _props$width === void 0 ? "auto" : _props$width;
6071
+ width = _props$width === void 0 ? "100%" : _props$width;
6044
6072
  var styles = useStyleConfig("HorizontalRule", {
6045
6073
  align: align
6046
6074
  });
@@ -6154,7 +6182,7 @@ function List$1(props) {
6154
6182
  Children.map(children, function (child) {
6155
6183
  var _child$props;
6156
6184
 
6157
- if ((child == null ? void 0 : child.type) !== "li" && (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.mdxType) !== "li") {
6185
+ if (child && (child == null ? void 0 : child.type) !== "li" && (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.mdxType) !== "li") {
6158
6186
  console.warn("Direct children of `List` (" + listType + ") should be `<li>`s.");
6159
6187
  }
6160
6188
  });
@@ -7078,8 +7106,7 @@ var Pagination$1 = function Pagination(props) {
7078
7106
  id = _props$id === void 0 ? generateUUID() : _props$id,
7079
7107
  _props$initialPage = props.initialPage,
7080
7108
  initialPage = _props$initialPage === void 0 ? 1 : _props$initialPage,
7081
- _props$onPageChange = props.onPageChange,
7082
- onPageChange = _props$onPageChange === void 0 ? function () {} : _props$onPageChange,
7109
+ onPageChange = props.onPageChange,
7083
7110
  pageCount = props.pageCount;
7084
7111
 
7085
7112
  var _useState = useState(initialPage),
@@ -7109,7 +7136,7 @@ var Pagination$1 = function Pagination(props) {
7109
7136
  e.preventDefault && e.preventDefault();
7110
7137
  if (currentPage === selectedPage) return;
7111
7138
  setCurrentPage(selectedPage);
7112
- onPageChange(selectedPage);
7139
+ onPageChange && onPageChange(selectedPage);
7113
7140
  }; // Select the previous page.
7114
7141
 
7115
7142
 
@@ -7476,16 +7503,16 @@ var RadioGroup$1 = /*#__PURE__*/forwardRef(function (props, ref) {
7476
7503
 
7477
7504
  var styles = useMultiStyleConfig("RadioGroup", {});
7478
7505
  return createElement(Fieldset, {
7479
- id: "radio-group-" + id,
7480
7506
  className: className,
7507
+ id: "radio-group-" + id,
7481
7508
  isLegendHidden: !showLabel,
7482
7509
  legendText: labelText,
7483
7510
  optReqFlag: optReqFlag
7484
7511
  }, createElement(Stack, Object.assign({
7512
+ "aria-label": !showLabel ? labelText : null,
7485
7513
  direction: [layout],
7486
7514
  spacing: spacingProp,
7487
- ref: ref,
7488
- "aria-label": !showLabel ? labelText : null
7515
+ ref: ref
7489
7516
  }, radioGroupProps, {
7490
7517
  sx: styles.stack
7491
7518
  }), newChildren), footnote && showHelperInvalidText && createElement(Box, {
@@ -7655,6 +7682,7 @@ var Select$1 = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
7655
7682
  ref: ref
7656
7683
  }, controlledProps, ariaAttributes, {
7657
7684
  icon: React__default.createElement(Icon, {
7685
+ id: id + "-icon",
7658
7686
  name: IconNames.Arrow,
7659
7687
  size: IconSizes.Medium
7660
7688
  }),
@@ -7710,8 +7738,6 @@ function SearchBar$1(props) {
7710
7738
  showHelperInvalidText: false,
7711
7739
  showLabel: false
7712
7740
  };
7713
- var helperErrorTextID = generateUUID();
7714
- var ariaDescribedby = helperErrorTextID;
7715
7741
  var footnote = isInvalid ? invalidText : helperText;
7716
7742
  var finalAriaLabel = footnote ? labelText + " - " + footnote : labelText;
7717
7743
  var textInputPlaceholder = (textInputProps == null ? void 0 : textInputProps.placeholder) + " " + (isRequired ? "(Required)" : "");
@@ -7727,9 +7753,10 @@ function SearchBar$1(props) {
7727
7753
  }; // Render the `Select` component.
7728
7754
 
7729
7755
  var selectElem = selectProps && createElement(Select$1, Object.assign({
7730
- id: generateUUID(),
7731
- name: selectProps == null ? void 0 : selectProps.name,
7756
+ id: "searchbar-select-" + id,
7732
7757
  labelText: selectProps == null ? void 0 : selectProps.labelText,
7758
+ name: selectProps == null ? void 0 : selectProps.name,
7759
+ onChange: selectProps == null ? void 0 : selectProps.onChange,
7733
7760
  type: SelectTypes.SearchBar
7734
7761
  }, stateProps), selectProps == null ? void 0 : selectProps.optionsData.map(function (option) {
7735
7762
  return createElement("option", {
@@ -7739,11 +7766,11 @@ function SearchBar$1(props) {
7739
7766
  })); // Render the `TextInput` component.
7740
7767
 
7741
7768
  var textInputNative = textInputProps && createElement(TextInput, Object.assign({
7742
- id: generateUUID(),
7769
+ id: "searchbar-textinput-" + id,
7743
7770
  labelText: textInputProps == null ? void 0 : textInputProps.labelText,
7744
- placeholder: textInputPlaceholder,
7745
- onChange: textInputProps == null ? void 0 : textInputProps.onChange,
7746
7771
  name: textInputProps == null ? void 0 : textInputProps.name,
7772
+ onChange: textInputProps == null ? void 0 : textInputProps.onChange,
7773
+ placeholder: textInputPlaceholder,
7747
7774
  type: TextInputTypes.text,
7748
7775
  variantType: selectElem ? TextInputVariants.SearchBarSelect : TextInputVariants.SearchBar,
7749
7776
  value: textInputProps == null ? void 0 : textInputProps.value
@@ -7752,16 +7779,17 @@ function SearchBar$1(props) {
7752
7779
  var buttonElem = createElement(Button, {
7753
7780
  additionalStyles: searchBarButtonStyles,
7754
7781
  buttonType: buttonType,
7755
- id: generateUUID(),
7782
+ id: "searchbar-button-" + id,
7756
7783
  isDisabled: isDisabled,
7757
7784
  onClick: buttonOnClick,
7758
7785
  type: "submit"
7759
7786
  }, createElement(Icon, {
7787
+ align: IconAlign.Left,
7788
+ id: "searchbar-icon-" + id,
7760
7789
  name: IconNames.Search,
7761
- size: IconSizes.Small,
7762
- align: IconAlign.Left
7763
- }), "Search"); // If a custom input element was passed, use that instead of the
7764
- // `TextInput` component.
7790
+ size: IconSizes.Small
7791
+ }), "Search"); // If a custom input element was passed, use that element
7792
+ // instead of the DS `TextInput` component.
7765
7793
 
7766
7794
  var textInputElem = textInputElement || textInputNative;
7767
7795
  return createElement(ComponentWrapper$1, {
@@ -7773,11 +7801,10 @@ function SearchBar$1(props) {
7773
7801
  isInvalid: isInvalid
7774
7802
  }, createElement(Box, {
7775
7803
  as: "form",
7776
- id: id + "-form",
7804
+ id: "searchbar-form-" + id,
7777
7805
  className: className,
7778
7806
  role: "search",
7779
7807
  "aria-label": finalAriaLabel,
7780
- "aria-describedby": ariaDescribedby,
7781
7808
  onSubmit: onSubmit,
7782
7809
  method: method,
7783
7810
  action: action,
@@ -8349,11 +8376,14 @@ var getElementsFromContentData$1 = function getElementsFromContentData(data, use
8349
8376
  var panels = [];
8350
8377
 
8351
8378
  if (!(data != null && data.length)) {
8352
- return {};
8379
+ return {
8380
+ tabs: [],
8381
+ panels: []
8382
+ };
8353
8383
  }
8354
8384
 
8355
8385
  if ((data == null ? void 0 : data.length) > 6) {
8356
- console.warn("We recommend to use no more than six tabs. If more than six tabs are " + "needed, consider other navigational patterns.");
8386
+ console.warn("Tabs: We recommend to use no more than six tabs. If more than six tabs " + "are needed, consider other navigational patterns.");
8357
8387
  }
8358
8388
 
8359
8389
  data.forEach(function (tab, index) {
@@ -8369,10 +8399,10 @@ var getElementsFromContentData$1 = function getElementsFromContentData(data, use
8369
8399
 
8370
8400
  if (typeof tab.content === "string") {
8371
8401
  tempPanel = createElement(TabPanel, {
8372
- key: index,
8373
8402
  dangerouslySetInnerHTML: {
8374
8403
  __html: tab.content
8375
- }
8404
+ },
8405
+ key: index
8376
8406
  });
8377
8407
  } else {
8378
8408
  tempPanel = createElement(TabPanel, {
@@ -8399,7 +8429,10 @@ var getElementsFromChildren = function getElementsFromChildren(children) {
8399
8429
  var panels = [];
8400
8430
 
8401
8431
  if (!(children != null && children.length)) {
8402
- return {};
8432
+ return {
8433
+ tabs: [],
8434
+ panels: []
8435
+ };
8403
8436
  }
8404
8437
 
8405
8438
  children.forEach(function (child) {
@@ -8408,7 +8441,7 @@ var getElementsFromChildren = function getElementsFromChildren(children) {
8408
8441
  var childTabs = Children.count(child.props.children);
8409
8442
 
8410
8443
  if (childTabs > 6) {
8411
- console.warn("We recommend to use no more than six tabs. If more than six tabs are " + "needed, consider other navigational patterns.");
8444
+ console.warn("Tabs: We recommend to use no more than six tabs. If more than six " + "tabs are needed, consider other navigational patterns.");
8412
8445
  }
8413
8446
  }
8414
8447
 
@@ -8453,7 +8486,11 @@ function Tabs(props) {
8453
8486
 
8454
8487
  var _ref = contentData ? getElementsFromContentData$1(contentData, useHash) : getElementsFromChildren(children),
8455
8488
  tabs = _ref.tabs,
8456
- panels = _ref.panels; // `tabs` is an array for the children component approach but an object for
8489
+ panels = _ref.panels;
8490
+
8491
+ if (!tabs.length || !panels.length) {
8492
+ console.warn("Tabs: Pass data in the `data` props or as children.");
8493
+ } // `tabs` is an array for the children component approach but an object for
8457
8494
  // the `contentData` prop approach. We need to get the right props key value
8458
8495
  // to set the carousel's length.
8459
8496
 
@@ -8479,43 +8516,47 @@ function Tabs(props) {
8479
8516
  }
8480
8517
  }, [goToStart, windowDimensions.width]);
8481
8518
  var previousButton = createElement(Button, {
8482
- buttonType: ButtonTypes.Primary,
8483
8519
  attributes: _extends({
8484
8520
  "aria-label": "Previous"
8485
8521
  }, styles.buttonArrows, {
8486
8522
  left: "0"
8487
8523
  }),
8524
+ buttonType: ButtonTypes.Primary,
8525
+ id: "tabs-previous-" + id,
8488
8526
  onClick: prevSlide
8489
8527
  }, createElement(Icon, {
8490
- name: IconNames.Arrow,
8491
8528
  iconRotation: IconRotationTypes.Rotate90,
8529
+ id: "tabs-previous-icon-" + id,
8530
+ name: IconNames.Arrow,
8492
8531
  size: IconSizes.Small
8493
8532
  }));
8494
8533
  var nextButton = createElement(Button, {
8495
- buttonType: ButtonTypes.Primary,
8496
8534
  attributes: _extends({
8497
8535
  "aria-label": "Next"
8498
8536
  }, styles.buttonArrows, {
8499
8537
  right: "0"
8500
8538
  }),
8539
+ buttonType: ButtonTypes.Primary,
8540
+ id: "tabs-next-" + id,
8501
8541
  onClick: nextSlide
8502
8542
  }, createElement(Icon, {
8503
- name: IconNames.Arrow,
8504
8543
  iconRotation: IconRotationTypes.Rotate270,
8544
+ id: "tabs-next-icon-" + id,
8545
+ name: IconNames.Arrow,
8505
8546
  size: IconSizes.Small
8506
8547
  }));
8507
8548
 
8508
8549
  if (children && contentData != null && contentData.length) {
8509
- console.warn("Only pass children or data in the `data` props but not both.");
8550
+ console.warn("Tabs: Only pass children or data in the `data` props but not both.");
8510
8551
  }
8511
8552
 
8512
8553
  return createElement(Tabs$1, {
8513
- id: id,
8514
- onChange: onChange,
8515
8554
  defaultIndex: defaultIndex,
8516
- variant: "enclosed",
8555
+ id: id,
8517
8556
  // The following lazy loads each panel whenever it is needed.
8518
- isLazy: true
8557
+ isLazy: true,
8558
+ onChange: onChange,
8559
+ variant: "enclosed"
8519
8560
  }, createElement(Box, {
8520
8561
  __css: styles.tablistWrapper,
8521
8562
  sx: {
@@ -8541,18 +8582,57 @@ var Template$1 = function Template(props) {
8541
8582
  }, props.children);
8542
8583
  };
8543
8584
  /**
8544
- * This optional component should be the first child of the `Template`
8545
- * component. This is rendered as an HTML `<header>` element.
8585
+ * This optional component renders its children from edge-to-edge and should
8586
+ * be used for alerts or notifications that are typically site-wide. This must
8587
+ * be rendered immediately before the `TemplateHeader` component. This is meant
8588
+ * for components that render an `aside` HTML element or HTML element with the
8589
+ * `role="complementary"` attribute. These elements should *not* be rendered
8590
+ * in the `header` HTML section since that's an accessibility violation.
8546
8591
  */
8547
8592
 
8548
8593
 
8549
- var TemplateHeader$1 = function TemplateHeader(props) {
8550
- var styles = useStyleConfig("TemplateHeader", {});
8594
+ var TemplateAboveHeader = function TemplateAboveHeader(props) {
8595
+ var styles = useStyleConfig("TemplateBreakout", {});
8551
8596
  return createElement(Box, {
8552
- as: "header",
8553
8597
  __css: styles
8554
8598
  }, props.children);
8555
8599
  };
8600
+ /**
8601
+ * This optional component should be the first child of the `Template`
8602
+ * component. This is rendered as an HTML `<header>` element. If an HTML
8603
+ * `<header>` element is already passed in a custom component as the children,
8604
+ * set `renderFooterElement` to `false`. Otherwise, the parent wrapper will
8605
+ * render an HTML `<header>` element.
8606
+ */
8607
+
8608
+
8609
+ var TemplateHeader$1 = function TemplateHeader(_ref) {
8610
+ var children = _ref.children,
8611
+ _ref$renderHeaderElem = _ref.renderHeaderElement,
8612
+ renderHeaderElement = _ref$renderHeaderElem === void 0 ? true : _ref$renderHeaderElem;
8613
+ var styles = useStyleConfig("TemplateHeader", {});
8614
+ var headerElement = createElement(Box, {
8615
+ __css: styles
8616
+ }, children); // The user wants to render the `header` HTML element.
8617
+
8618
+ if (renderHeaderElement) {
8619
+ // But if they passed in a component that renders an HTML `<header>`,
8620
+ // then log a warning.
8621
+ Children.map(children, function (child) {
8622
+ var _child$props;
8623
+
8624
+ if ((child == null ? void 0 : child.type) === "header" || (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.mdxType) === "header") {
8625
+ console.warn("`TemplateHeader`: An HTML `header` element was passed in. Set " + "`renderHeaderElement` to `false` to avoid nested HTML `header` elements.");
8626
+ }
8627
+ });
8628
+ headerElement = createElement(Box, {
8629
+ as: "header",
8630
+ __css: styles
8631
+ }, children);
8632
+ }
8633
+
8634
+ return headerElement;
8635
+ };
8556
8636
  /**
8557
8637
  * This optional component should be used inside the `TemplateHeader` component.
8558
8638
  * This is meant to render its children from edge to edge and is most useful
@@ -8586,11 +8666,11 @@ var TemplateContent$1 = function TemplateContent(props) {
8586
8666
  // `TemplateContentSidebar` components.
8587
8667
 
8588
8668
  var newChildren = Children.map(children, function (child) {
8589
- var _child$props, _child$props2;
8669
+ var _child$props2, _child$props3;
8590
8670
 
8591
8671
  var newChild = child;
8592
8672
 
8593
- if (child && (child == null ? void 0 : child.type) === TemplateContentPrimary$1 || child != null && child.props && ((_child$props = child.props) == null ? void 0 : _child$props.mdxType) === "TemplateContentPrimary" || (child == null ? void 0 : child.type) === TemplateContentSidebar$1 || child != null && child.props && ((_child$props2 = child.props) == null ? void 0 : _child$props2.mdxType) === "TemplateContentSidebar") {
8673
+ if (child && (child == null ? void 0 : child.type) === TemplateContentPrimary$1 || child != null && child.props && ((_child$props2 = child.props) == null ? void 0 : _child$props2.mdxType) === "TemplateContentPrimary" || (child == null ? void 0 : child.type) === TemplateContentSidebar$1 || child != null && child.props && ((_child$props3 = child.props) == null ? void 0 : _child$props3.mdxType) === "TemplateContentSidebar") {
8594
8674
  newChild = cloneElement(child, {
8595
8675
  sidebar: sidebar
8596
8676
  });
@@ -8665,18 +8745,18 @@ var TemplateContentSidebar$1 = function TemplateContentSidebar(props) {
8665
8745
  */
8666
8746
 
8667
8747
 
8668
- var TemplateFooter = function TemplateFooter(_ref) {
8669
- var children = _ref.children,
8670
- _ref$renderFooterElem = _ref.renderFooterElement,
8671
- renderFooterElement = _ref$renderFooterElem === void 0 ? true : _ref$renderFooterElem;
8748
+ var TemplateFooter = function TemplateFooter(_ref2) {
8749
+ var children = _ref2.children,
8750
+ _ref2$renderFooterEle = _ref2.renderFooterElement,
8751
+ renderFooterElement = _ref2$renderFooterEle === void 0 ? true : _ref2$renderFooterEle;
8672
8752
  var footerElement = createElement(Fragment, null, children); // The user wants to render the `footer` HTML element.
8673
8753
 
8674
8754
  if (renderFooterElement) {
8675
8755
  // But give a warning if one was passed.
8676
8756
  Children.map(children, function (child) {
8677
- var _child$props3;
8757
+ var _child$props4;
8678
8758
 
8679
- if ((child == null ? void 0 : child.type) === "footer" || (child == null ? void 0 : (_child$props3 = child.props) == null ? void 0 : _child$props3.mdxType) === "footer") {
8759
+ if ((child == null ? void 0 : child.type) === "footer" || (child == null ? void 0 : (_child$props4 = child.props) == null ? void 0 : _child$props4.mdxType) === "footer") {
8680
8760
  console.warn("`TemplateFooter`: An HTML `footer` element was passed in. Set " + "`renderFooterElement` to `false` to avoid nested HTML `footer` elements.");
8681
8761
  }
8682
8762
  });
@@ -8697,7 +8777,8 @@ var TemplateFooter = function TemplateFooter(_ref) {
8697
8777
 
8698
8778
 
8699
8779
  var TemplateAppContainer = function TemplateAppContainer(props) {
8700
- var breakout = props.breakout,
8780
+ var aboveHeader = props.aboveHeader,
8781
+ breakout = props.breakout,
8701
8782
  contentPrimary = props.contentPrimary,
8702
8783
  contentSidebar = props.contentSidebar,
8703
8784
  contentTop = props.contentTop,
@@ -8706,12 +8787,17 @@ var TemplateAppContainer = function TemplateAppContainer(props) {
8706
8787
  _props$sidebar2 = props.sidebar,
8707
8788
  sidebar = _props$sidebar2 === void 0 ? "none" : _props$sidebar2,
8708
8789
  _props$renderFooterEl = props.renderFooterElement,
8709
- renderFooterElement = _props$renderFooterEl === void 0 ? true : _props$renderFooterEl;
8790
+ renderFooterElement = _props$renderFooterEl === void 0 ? true : _props$renderFooterEl,
8791
+ _props$renderHeaderEl = props.renderHeaderElement,
8792
+ renderHeaderElement = _props$renderHeaderEl === void 0 ? true : _props$renderHeaderEl;
8793
+ var aboveHeaderElem = aboveHeader && createElement(TemplateAboveHeader, null, aboveHeader);
8710
8794
  var breakoutElem = breakout && createElement(TemplateBreakout$1, null, breakout);
8711
8795
  var contentTopElem = contentTop && createElement(TemplateContentTop$1, null, contentTop);
8712
8796
  var contentPrimaryElem = contentPrimary && createElement(TemplateContentPrimary$1, null, contentPrimary);
8713
8797
  var contentSidebarElem = contentSidebar && createElement(TemplateContentSidebar$1, null, contentSidebar);
8714
- return createElement(Template$1, null, (header || breakoutElem) && createElement(TemplateHeader$1, null, header, breakoutElem), createElement(TemplateContent$1, {
8798
+ return createElement(Template$1, null, aboveHeaderElem, (header || breakoutElem) && createElement(TemplateHeader$1, {
8799
+ renderHeaderElement: renderHeaderElement
8800
+ }, header, breakoutElem), createElement(TemplateContent$1, {
8715
8801
  sidebar: sidebar
8716
8802
  }, contentTopElem, sidebar === "left" && contentSidebarElem, contentPrimaryElem, sidebar === "right" && contentSidebarElem), footer && createElement(TemplateFooter, {
8717
8803
  renderFooterElement: renderFooterElement
@@ -8945,6 +9031,11 @@ function VideoPlayer$1(props) {
8945
9031
  }, embedElement)));
8946
9032
  }
8947
9033
 
9034
+ /**
9035
+ * Basic `Table` component used to organize and display tabular data in
9036
+ * rows and columns.
9037
+ */
9038
+
8948
9039
  function Table(props) {
8949
9040
  var className = props.className,
8950
9041
  columnHeaders = props.columnHeaders,
@@ -8952,12 +9043,12 @@ function Table(props) {
8952
9043
  columnHeadersTextColor = props.columnHeadersTextColor,
8953
9044
  _props$id = props.id,
8954
9045
  id = _props$id === void 0 ? generateUUID() : _props$id,
8955
- _props$useRowHeaders = props.useRowHeaders,
8956
- useRowHeaders = _props$useRowHeaders === void 0 ? false : _props$useRowHeaders,
8957
9046
  _props$showRowDivider = props.showRowDividers,
8958
9047
  showRowDividers = _props$showRowDivider === void 0 ? false : _props$showRowDivider,
8959
9048
  tableData = props.tableData,
8960
- titleText = props.titleText;
9049
+ titleText = props.titleText,
9050
+ _props$useRowHeaders = props.useRowHeaders,
9051
+ useRowHeaders = _props$useRowHeaders === void 0 ? false : _props$useRowHeaders;
8961
9052
  var customColors = {};
8962
9053
  columnHeadersBackgroundColor && (customColors["backgroundColor"] = columnHeadersBackgroundColor);
8963
9054
  columnHeadersTextColor && (customColors["color"] = columnHeadersTextColor);
@@ -8966,18 +9057,23 @@ function Table(props) {
8966
9057
  showRowDividers: showRowDividers,
8967
9058
  useRowHeaders: useRowHeaders
8968
9059
  });
8969
- var columnHeadersElems = columnHeaders && createElement(Thead, null, createElement(Tr, null, columnHeaders.map(function (child, key) {
9060
+ var tableCaption = titleText && createElement(TableCaption, null, titleText);
9061
+ var columnHeadersElems = (columnHeaders == null ? void 0 : columnHeaders.length) > 0 && createElement(Thead, null, createElement(Tr, null, columnHeaders.map(function (child, key) {
8970
9062
  return createElement(Th, {
8971
- scope: "col",
8972
9063
  key: key,
9064
+ scope: "col",
8973
9065
  sx: customColors
8974
9066
  }, child);
8975
9067
  })));
9068
+ /**
9069
+ * This renders a normal `tbody` DOM element structure if the `tableData`
9070
+ * passed is a two-dimensional array. This is to render the appropriate
9071
+ * row and column structure for a table.
9072
+ */
8976
9073
 
8977
9074
  var tableBodyElems = function tableBodyElems() {
8978
- /** tableData value should be two dimensional array */
8979
9075
  if (!Array.isArray(tableData) || tableData.length <= 0 || tableData[0].constructor !== Array) {
8980
- console.warn("Table data should be two dimensional array.");
9076
+ console.warn("Table: data should be two dimensional array.");
8981
9077
  return null;
8982
9078
  }
8983
9079
 
@@ -8995,7 +9091,6 @@ function Table(props) {
8995
9091
  }));
8996
9092
  };
8997
9093
 
8998
- var tableCaption = titleText && createElement(TableCaption, null, titleText);
8999
9094
  return createElement(Table$1, {
9000
9095
  id: id,
9001
9096
  sx: styles,
@@ -9003,5 +9098,5 @@ function Table(props) {
9003
9098
  }, tableCaption, columnHeadersElems, tableBodyElems());
9004
9099
  }
9005
9100
 
9006
- export { Accordion, Breadcrumbs, Button, ButtonTypes, Card, CardActions, CardContent, CardHeading, CardLayouts, Checkbox, CheckboxGroup, CheckboxGroupLayoutTypes, ColorVariants, DSProvider, DatePicker, DatePickerTypes, Fieldset, Form, FormField, FormRow, GridGaps as FormSpacing, GridGaps, Heading, HeadingDisplaySizes, HeadingLevels, HelperErrorText, Hero$1 as Hero, HeroTypes, HorizontalRule$1 as HorizontalRule, Icon, IconAlign, IconColors, IconNames, IconRotationTypes, IconSizes, IconTypes, Image, ImageRatios, ImageSizes, ImageTypes, Label, Link, LinkTypes, List$1 as List, ListTypes, Logo$1 as Logo, LogoColors, LogoNames, LogoSizes, Modal, Notification$1 as Notification, NotificationTypes, Pagination$1 as Pagination, ProgressIndicator$1 as ProgressIndicator, ProgressIndicatorSizes, ProgressIndicatorTypes, Radio$1 as Radio, RadioGroup$1 as RadioGroup, RadioGroupLayoutTypes, SearchBar$1 as SearchBar, Select$1 as Select, SimpleGrid, SkeletonLoader$1 as SkeletonLoader, SkeletonLoaderImageRatios, SkeletonLoaderLayouts, Slider, StatusBadge$1 as StatusBadge, StatusBadgeTypes, StructuredContent$1 as StructuredContent, StructuredContentImagePosition, Table, Tabs, Template$1 as Template, TemplateAppContainer, TemplateBreakout$1 as TemplateBreakout, TemplateContent$1 as TemplateContent, TemplateContentPrimary$1 as TemplateContentPrimary, TemplateContentSidebar$1 as TemplateContentSidebar, TemplateContentTop$1 as TemplateContentTop, TemplateFooter, TemplateHeader$1 as TemplateHeader, Text$1 as Text, TextDisplaySizes, TextInput, TextInputTypes, Toggle$2 as Toggle, ToggleSizes, VideoPlayer$1 as VideoPlayer, VideoPlayerAspectRatios, VideoPlayerTypes, useNYPLTheme };
9101
+ export { Accordion, Breadcrumbs, Button, ButtonTypes, Card, CardActions, CardContent, CardHeading, CardLayouts, Checkbox, CheckboxGroup, CheckboxGroupLayoutTypes, ColorVariants, DSProvider, DatePicker, DatePickerTypes, Fieldset, Form, FormField, GridGaps as FormGaps, FormRow, GridGaps, Heading, HeadingDisplaySizes, HeadingLevels, HelperErrorText, Hero$1 as Hero, HeroTypes, HorizontalRule$1 as HorizontalRule, Icon, IconAlign, IconColors, IconNames, IconRotationTypes, IconSizes, IconTypes, Image, ImageRatios, ImageSizes, ImageTypes, Label, Link, LinkTypes, List$1 as List, ListTypes, Logo$1 as Logo, LogoColors, LogoNames, LogoSizes, Modal, Notification$1 as Notification, NotificationTypes, Pagination$1 as Pagination, ProgressIndicator$1 as ProgressIndicator, ProgressIndicatorSizes, ProgressIndicatorTypes, Radio$1 as Radio, RadioGroup$1 as RadioGroup, RadioGroupLayoutTypes, SearchBar$1 as SearchBar, Select$1 as Select, SimpleGrid, SkeletonLoader$1 as SkeletonLoader, SkeletonLoaderImageRatios, SkeletonLoaderLayouts, Slider, StatusBadge$1 as StatusBadge, StatusBadgeTypes, StructuredContent$1 as StructuredContent, StructuredContentImagePosition, Table, Tabs, Template$1 as Template, TemplateAboveHeader, TemplateAppContainer, TemplateBreakout$1 as TemplateBreakout, TemplateContent$1 as TemplateContent, TemplateContentPrimary$1 as TemplateContentPrimary, TemplateContentSidebar$1 as TemplateContentSidebar, TemplateContentTop$1 as TemplateContentTop, TemplateFooter, TemplateHeader$1 as TemplateHeader, Text$1 as Text, TextDisplaySizes, TextInput, TextInputTypes, Toggle$2 as Toggle, ToggleSizes, VideoPlayer$1 as VideoPlayer, VideoPlayerAspectRatios, VideoPlayerTypes, useNYPLTheme };
9007
9102
  //# sourceMappingURL=design-system-react-components.esm.js.map