@nypl/design-system-react-components 4.0.0-remove-matchMedia-test → 4.0.1-rc

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 (152) hide show
  1. package/README.md +125 -201
  2. package/dist/design-system-react-components.cjs +58 -58
  3. package/dist/design-system-react-components.js +17467 -18102
  4. package/dist/readme/componentheader.png +0 -0
  5. package/dist/src/components/Accordion/Accordion.d.ts +7 -9
  6. package/dist/src/components/AlphabetFilter/AlphabetFilter.d.ts +2 -6
  7. package/dist/src/components/AudioPlayer/AudioPlayer.d.ts +4 -13
  8. package/dist/src/components/Banner/Banner.d.ts +9 -16
  9. package/dist/src/components/Breadcrumbs/Breadcrumbs.d.ts +7 -11
  10. package/dist/src/components/Button/Button.d.ts +10 -17
  11. package/dist/src/components/ButtonGroup/ButtonGroup.d.ts +2 -6
  12. package/dist/src/components/ButtonGroup/ButtonGroupContext.d.ts +3 -0
  13. package/dist/src/components/Card/Card.d.ts +3 -7
  14. package/dist/src/components/Checkbox/Checkbox.d.ts +3 -12
  15. package/dist/src/components/CheckboxGroup/CheckboxGroup.d.ts +4 -8
  16. package/dist/src/components/CheckboxGroup/CheckboxGroupContext.d.ts +10 -0
  17. package/dist/src/components/ComponentWrapper/ComponentWrapper.d.ts +2 -7
  18. package/dist/src/components/DatePicker/DatePicker.d.ts +4 -8
  19. package/dist/src/components/FeaturedContent/FeaturedContent.d.ts +3 -7
  20. package/dist/src/components/FeedbackBox/FeedbackBox.d.ts +2 -6
  21. package/dist/src/components/Fieldset/Fieldset.d.ts +2 -6
  22. package/dist/src/components/FilterBarInline/FilterBarInline.d.ts +2 -6
  23. package/dist/src/components/FilterBarPopup/FilterBarPopup.d.ts +2 -6
  24. package/dist/src/components/Form/Form.d.ts +10 -15
  25. package/dist/src/components/Grid/SimpleGrid.d.ts +2 -6
  26. package/dist/src/components/Heading/Heading.d.ts +2 -9
  27. package/dist/src/components/HelperErrorText/HelperErrorText.d.ts +2 -7
  28. package/dist/src/components/Hero/Hero.d.ts +11 -13
  29. package/dist/src/components/HorizontalRule/HorizontalRule.d.ts +2 -6
  30. package/dist/src/components/Icons/Icon.d.ts +5 -9
  31. package/dist/src/components/Icons/IconSvgs.d.ts +3 -0
  32. package/dist/src/components/Icons/iconVariables.d.ts +3 -3
  33. package/dist/src/components/Image/Image.d.ts +2 -14
  34. package/dist/src/components/Label/Label.d.ts +3 -9
  35. package/dist/src/components/Link/Link.d.ts +8 -18
  36. package/dist/src/components/List/List.d.ts +5 -14
  37. package/dist/src/components/Logo/Logo.d.ts +2 -6
  38. package/dist/src/components/Menu/Menu.d.ts +2 -6
  39. package/dist/src/components/Modal/Modal.d.ts +8 -11
  40. package/dist/src/components/MultiSelect/MultiSelect.d.ts +9 -10
  41. package/dist/src/components/MultiSelect/MultiSelectItemsCountButton.d.ts +2 -5
  42. package/dist/src/components/MultiSelectGroup/MultiSelectGroup.d.ts +2 -6
  43. package/dist/src/components/NewsletterSignup/NewsletterSignup.d.ts +6 -11
  44. package/dist/src/components/Notification/Notification.d.ts +9 -13
  45. package/dist/src/components/Pagination/Pagination.d.ts +2 -6
  46. package/dist/src/components/ProgressIndicator/ProgressIndicator.d.ts +3 -5
  47. package/dist/src/components/Radio/Radio.d.ts +4 -13
  48. package/dist/src/components/RadioGroup/RadioGroup.d.ts +6 -9
  49. package/dist/src/components/RadioGroup/RadioGroupContext.d.ts +10 -0
  50. package/dist/src/components/SearchBar/SearchBar.d.ts +5 -15
  51. package/dist/src/components/Select/Select.d.ts +6 -18
  52. package/dist/src/components/SkeletonLoader/SkeletonLoader.d.ts +2 -6
  53. package/dist/src/components/SkipNavigation/SkipNavigation.d.ts +2 -6
  54. package/dist/src/components/Slider/Slider.d.ts +3 -7
  55. package/dist/src/components/SocialMediaLinks/SocialMediaLinks.d.ts +4 -8
  56. package/dist/src/components/StatusBadge/StatusBadge.d.ts +5 -9
  57. package/dist/src/components/StructuredContent/StructuredContent.d.ts +2 -6
  58. package/dist/src/components/StyledList/StyledList.d.ts +2 -8
  59. package/dist/src/components/SubNav/SubNav.d.ts +4 -13
  60. package/dist/src/components/Table/Table.d.ts +2 -10
  61. package/dist/src/components/Tabs/Tabs.d.ts +2 -4
  62. package/dist/src/components/TagSet/TagSet.d.ts +2 -9
  63. package/dist/src/components/TagSet/TagSetExplore.d.ts +3 -2
  64. package/dist/src/components/TagSet/TagSetFilter.d.ts +3 -4
  65. package/dist/src/components/Template/Template.d.ts +31 -41
  66. package/dist/src/components/Text/Text.d.ts +3 -11
  67. package/dist/src/components/TextInput/TextInput.d.ts +9 -34
  68. package/dist/src/components/Toggle/Toggle.d.ts +3 -10
  69. package/dist/src/components/Tooltip/Tooltip.d.ts +2 -8
  70. package/dist/src/components/VideoPlayer/VideoPlayer.d.ts +2 -6
  71. package/dist/src/hooks/useMultiSelect.d.ts +5 -1
  72. package/dist/src/hooks/useSafeId.d.ts +6 -0
  73. package/dist/src/index.d.ts +14 -16
  74. package/dist/src/theme/components/breadcrumb.d.ts +13 -5
  75. package/dist/src/theme/components/button.d.ts +12 -0
  76. package/dist/src/theme/components/datePicker.d.ts +4 -0
  77. package/dist/src/theme/components/feedbackBox.d.ts +15 -3
  78. package/dist/src/theme/components/fieldset.d.ts +1 -1
  79. package/dist/src/theme/components/global.d.ts +18 -5
  80. package/dist/src/theme/components/heading.d.ts +6 -72
  81. package/dist/src/theme/components/helperErrorText.d.ts +5 -14
  82. package/dist/src/theme/components/hero.d.ts +19 -16
  83. package/dist/src/theme/components/horizontalRule.d.ts +0 -2
  84. package/dist/src/theme/components/icon.d.ts +2 -5
  85. package/dist/src/theme/components/label.d.ts +0 -1
  86. package/dist/src/theme/components/list.d.ts +1 -11
  87. package/dist/src/theme/components/newsletterSignup.d.ts +4 -4
  88. package/dist/src/theme/components/notification.d.ts +3 -3
  89. package/dist/src/theme/components/notificationContent.d.ts +3 -3
  90. package/dist/src/theme/components/notificationHeading.d.ts +3 -3
  91. package/dist/src/theme/components/radioGroup.d.ts +1 -1
  92. package/dist/src/theme/components/searchBar.d.ts +3 -3
  93. package/dist/src/theme/components/select.d.ts +7 -3
  94. package/dist/src/theme/components/slider.d.ts +5 -1
  95. package/dist/src/theme/components/socialmedialinks.d.ts +2 -2
  96. package/dist/src/theme/components/structuredContent.d.ts +2 -69
  97. package/dist/src/theme/components/styledList.d.ts +0 -1
  98. package/dist/src/theme/components/subnav.d.ts +3 -2
  99. package/dist/src/theme/components/{customTable.d.ts → table.d.ts} +7 -13
  100. package/dist/src/theme/components/template.d.ts +92 -45
  101. package/dist/src/theme/components/text.d.ts +1 -3
  102. package/dist/src/theme/foundations/colors.d.ts +1 -1
  103. package/dist/src/theme/foundations/global.d.ts +0 -12
  104. package/dist/src/theme/foundations/spacing.d.ts +16 -0
  105. package/dist/src/theme/sharedStyles.d.ts +4 -0
  106. package/dist/src/theme/sharedTypes.d.ts +4 -0
  107. package/dist/src/utils/utils.d.ts +9 -3
  108. package/dist/styles.css +1 -1
  109. package/dist/template/templateChildBreakout.png +0 -0
  110. package/dist/template/templateChildContent.png +0 -0
  111. package/dist/template/templateChildFullContent.png +0 -0
  112. package/dist/template/templateChildFullContentBottom.png +0 -0
  113. package/dist/template/templateChildFullContentTop.png +0 -0
  114. package/dist/template/templateChildFullFooter.png +0 -0
  115. package/dist/template/templateChildFullHeader.png +0 -0
  116. package/dist/template/templateChildFullInside.png +0 -0
  117. package/dist/template/templateChildFullOutside.png +0 -0
  118. package/dist/template/templateChildSidebar.png +0 -0
  119. package/dist/template/templateFluidColumns1.png +0 -0
  120. package/dist/template/templateFluidColumns2.png +0 -0
  121. package/dist/template/templateFluidColumns3.png +0 -0
  122. package/dist/template/templateFluidColumns4.png +0 -0
  123. package/dist/template/templateFullPageLayout.png +0 -0
  124. package/dist/template/templateRegions.png +0 -0
  125. package/dist/template/templateRegionsFooter.png +0 -0
  126. package/dist/template/templateRegionsHeader.png +0 -0
  127. package/dist/template/templateRegionsMain.png +0 -0
  128. package/dist/template/templateSidebarNone.png +0 -0
  129. package/dist/template/templateVariantFull.png +0 -0
  130. package/dist/template/templateVariantNarrow.png +0 -0
  131. package/dist/template/templateVariantSidebarLeft.png +0 -0
  132. package/dist/template/templateVariantSidebarRight.png +0 -0
  133. package/dist/useNextjsImage/aspectRatio.png +0 -0
  134. package/dist/useNextjsImage/containedImageExamples.png +0 -0
  135. package/dist/useNextjsImage/croppedImageExamples.png +0 -0
  136. package/dist/useNextjsImage/customWidth.png +0 -0
  137. package/dist/useNextjsImage/fallbackImageDark.png +0 -0
  138. package/dist/useNextjsImage/fallbackImageLight.png +0 -0
  139. package/dist/useNextjsImage/focalPointExamples01.png +0 -0
  140. package/dist/useNextjsImage/focalPointExamples02.png +0 -0
  141. package/package.json +14 -18
  142. package/dist/src/hooks/useCarouselStyles.d.ts +0 -17
  143. package/dist/src/hooks/useWindowSize.d.ts +0 -10
  144. package/dist/src/theme/components/filterBar.d.ts +0 -46
  145. package/dist/template/templateBottom.png +0 -0
  146. package/dist/template/templateBreakout.png +0 -0
  147. package/dist/template/templateMain.png +0 -0
  148. package/dist/template/templateMainNarrow.png +0 -0
  149. package/dist/template/templateMainWide.png +0 -0
  150. package/dist/template/templateSidebarLeft.png +0 -0
  151. package/dist/template/templateSidebarRight.png +0 -0
  152. package/dist/template/templateTop.png +0 -0
Binary file
@@ -1,20 +1,18 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
2
- import React, { ButtonHTMLAttributes } from "react";
3
- export type AccordionTypes = "default" | "warning" | "error";
1
+ /// <reference types="react" />
2
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
3
+ export declare const accordionVariantsArray: readonly ["default", "warning", "error"];
4
+ export type AccordionVariants = typeof accordionVariantsArray[number];
4
5
  export interface AccordionDataProps {
5
- accordionType?: AccordionTypes;
6
6
  ariaLabel?: string;
7
7
  /** Ref to the DOM element of the AccordionButton. */
8
8
  buttonInteractionRef?: any;
9
9
  label: string | JSX.Element;
10
10
  panel: string | React.ReactNode;
11
+ variant?: AccordionVariants;
11
12
  }
12
- type HTMLButtonAttributes = Pick<ButtonHTMLAttributes<HTMLButtonElement>, "aria-label">;
13
- export interface AccordionProps extends HTMLButtonAttributes {
14
- /** Array of data to display, and an optional accordionType */
13
+ export interface AccordionProps extends Omit<BoxProps, "onChange"> {
14
+ /** Array of data to display, and an optional variant */
15
15
  accordionData: AccordionDataProps[];
16
- /** ID that other components can cross reference for accessibility purposes */
17
- id?: string;
18
16
  /** Whether the accordion is open by default only on its initial rendering */
19
17
  isDefaultOpen?: boolean;
20
18
  /** Whether the contents of the Accordion should always be rendered.
@@ -1,11 +1,9 @@
1
1
  import React from "react";
2
- import { ChakraComponent } from "@chakra-ui/react";
3
- export interface AlphabetFilterProps {
2
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
3
+ export interface AlphabetFilterProps extends Omit<BoxProps, "onClick"> {
4
4
  /** Array of letters to specify which `Button` components should be set in an `enabled`
5
5
  * state. By default, all buttons are `enabled`. */
6
6
  activeLetters?: string[];
7
- /** A class name for the AlphabetFilter parent div. */
8
- className?: string;
9
7
  /** The currentLetter can be used to programatically set the selected letter without the
10
8
  * user explicitly requesting it. */
11
9
  currentLetter?: string;
@@ -15,8 +13,6 @@ export interface AlphabetFilterProps {
15
13
  * a DS Heading component that can be passed in.
16
14
  */
17
15
  headingText?: string | JSX.Element;
18
- /** ID that other components can cross reference for accessibility purposes. */
19
- id?: string;
20
16
  /** Adds the `disabled` prop to the AlphabetFilter when true. */
21
17
  isDisabled?: boolean;
22
18
  /** The callback function called when a letter button or the Show All button is clicked. */
@@ -1,32 +1,23 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
1
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
2
2
  import React from "react";
3
3
  declare const thirdPartyServices: readonly ["libsyn", "soundcloud", "spotify"];
4
4
  export type ThirdPartyAudioType = typeof thirdPartyServices[number];
5
5
  export type AudioType = ThirdPartyAudioType | "file";
6
- export interface AudioPlayerProps {
6
+ export interface AudioPlayerProps extends BoxProps {
7
7
  /** Required string used to specify the type of audio playback. */
8
8
  audioType: AudioType;
9
- /** Optional className you can add in addition to `audio-player`. */
10
- className?: string;
11
9
  /** Optional string to set the text for the audio player description. */
12
10
  descriptionText?: string;
13
- /** Optional string to set a code snippet provided by Libsyn, SoundCloud or Spotify; the
14
- * `AudioPlayer` component will accept the `embedCode` prop or the `filePath` prop.
11
+ /** Optional string to set a code snippet provided by Libsyn, SoundCloud or
12
+ * Spotify; the `AudioPlayer` component will accept the `embedCode` prop.
15
13
  */
16
14
  embedCode?: string;
17
- /** Optional string to set the audio file, the path can be relative or absolute
18
- * referring to a locally hosted file, or a fully qualified URL pointing to a locally hosted file
19
- * or to another domain altogether.
20
- * TODO: This prop won't be used until a future version.
21
- */
22
15
  /** Optional string value used to set the text for a `Heading` component, or
23
16
  * a DS Heading component that can be passed in.
24
17
  */
25
18
  headingText?: string | JSX.Element;
26
19
  /** Optional string to set the text for a `HelperErrorText` component. */
27
20
  helperText?: string;
28
- /** ID that other components can cross reference for accessibility purposes. */
29
- id?: string;
30
21
  /** Optional title to added to the `<iframe>` element for improved accessibility. If omitted, a
31
22
  * generic title will be added.
32
23
  */
@@ -1,17 +1,13 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
1
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
2
2
  import React from "react";
3
- export declare const bannerTypesArray: readonly ["informative", "negative", "neutral", "positive", "recommendation", "warning"];
4
- export type BannerTypes = typeof bannerTypesArray[number];
5
- export declare const bannerBgColorsArray: readonly ["brand.primary-05", "section.blogs.primary-05", "section.books-and-more.primary-05", "section.connect.primary-05", "section.education.primary-05", "section.locations.primary-05", "section.research.primary-05", "section.research-library.lpa-05", "section.research-library.schomburg-05", "section.research-library.schwarzman-05", "section.whats-on.primary-05", "dark.brand.primary-05", "dark.section.blogs.primary-05", "dark.section.books-and-more.primary-05", "dark.section.connect.primary-05", "dark.section.education.primary-05", "dark.section.locations.primary-05", "dark.section.research.secondary-05", "dark.section.research-library.lpa-05", "dark.section.research-library.schomburg-05", "dark.section.research-library.schwarzman-05", "dark.section.whats-on.primary-05"];
6
- export type BannerBgColors = typeof bannerBgColorsArray[number];
7
- export declare const bannerHighlightColorsArray: readonly ["brand.primary", "section.blogs.primary", "section.books-and-more.primary", "section.connect.primary", "section.education.primary", "section.locations.primary", "section.research.primary", "section.research-library-lpa.primary", "section.research-library-schomburg.primary", "section.research-library-schwarzman.primary", "section.whats-on.primary", "dark.brand.primary", "dark.section.blogs.primary", "dark.section.books-and-more.primary", "dark.section.connect.primary", "dark.section.education.primary", "dark.section.locations.primary", "dark.section.research.secondary", "dark.section.research-library-lpa.primary", "dark.section.research-library-schomburg.primary", "dark.section.research-library-schwarzman.primary", "dark.section.whats-on.primary"];
8
- export type BannerHighlightColors = typeof bannerHighlightColorsArray[number];
9
- export interface BannerProps {
3
+ import { messageVariantsArray, bgColorsArray, highlightColorsArray } from "../../theme/sharedTypes";
4
+ export type BannerVariants = typeof messageVariantsArray[number];
5
+ export type BannerBgColors = typeof bgColorsArray[number];
6
+ export type BannerHighlightColors = typeof highlightColorsArray[number];
7
+ export interface BannerProps extends Omit<BoxProps, "content"> {
10
8
  /** Used to set the color of the background for the full component.
11
9
  * Refer to how color values are defined and typed in the DS Icon component. */
12
10
  backgroundColor?: BannerBgColors;
13
- /** Additional `className` to add. */
14
- className?: string;
15
11
  /** Used to populate the body content of the component. */
16
12
  content: string | JSX.Element;
17
13
  /** Used to populate the heading element within the component. A string
@@ -23,19 +19,16 @@ export interface BannerProps {
23
19
  highlightColor?: BannerHighlightColors;
24
20
  /** Optional custom `Icon` that will override the default `Icon`. */
25
21
  icon?: JSX.Element;
26
- /** ID that other components can cross reference for accessibility purposes. */
27
- id?: string;
28
22
  /** Optional prop to control whether a `Banner` can be dismissed
29
23
  * (closed) by a user. */
30
24
  isDismissible?: boolean;
31
25
  /** Used to control the component's semantic coloring and iconography. */
32
- type?: BannerTypes;
26
+ variant?: BannerVariants;
33
27
  }
34
28
  /**
35
- * The `Banner` component is a non-modal semantic dialog used to communicate a
29
+ * The `Banner` component is a non-modal, semantic dialog used to communicate a
36
30
  * general status event or to promote a feature, providing contextual feedback
37
- * messages for typical user actions. They are displayed contextually within a
38
- * page flow and they will often prompt a user to take action.
31
+ * messages for typical user actions within a page flow.
39
32
  */
40
33
  export declare const Banner: ChakraComponent<React.ForwardRefExoticComponent<BannerProps & React.RefAttributes<HTMLDivElement>>, BannerProps>;
41
34
  export default Banner;
@@ -1,23 +1,19 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
1
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
2
2
  import React from "react";
3
- export declare const breadcrumbTypeArray: readonly ["blogs", "booksAndMore", "brand", "connect", "digitalCollections", "education", "locations", "research", "whatsOn"];
4
- export type BreadcrumbsTypes = typeof breadcrumbTypeArray[number];
3
+ export declare const breadcrumbVariantsArray: readonly ["blogs", "booksAndMore", "brand", "connect", "digitalCollections", "education", "locations", "research", "whatsOn"];
4
+ export type BreadcrumbsVariants = typeof breadcrumbVariantsArray[number];
5
5
  export interface BreadcrumbsDataProps {
6
6
  url: string;
7
7
  text: string | React.ReactNode;
8
8
  linkProps?: any;
9
9
  }
10
- export interface BreadcrumbProps {
10
+ export interface BreadcrumbProps extends BoxProps {
11
11
  /** Breadcrumb links as an array */
12
12
  breadcrumbsData: BreadcrumbsDataProps[];
13
- /** Used to control how the `Hero` component will be rendered. */
14
- breadcrumbsType?: BreadcrumbsTypes;
15
- /** className you can add in addition to 'input' */
16
- className?: string;
17
- /** ID that other components can cross reference for accessibility purposes */
18
- id?: string;
19
13
  /** Custom Link component for apps with internal routing, defaults to BreadcrumbLink if not passed */
20
- customLinkComponent?: any;
14
+ customLinkComponent?: React.ElementType;
15
+ /** Used to control how the `Breadcrumbs` component will be rendered. */
16
+ variant?: BreadcrumbsVariants;
21
17
  }
22
18
  /**
23
19
  * The `Breadcrumbs` component is a navigation element that provides a
@@ -1,34 +1,27 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
2
- import React from "react";
1
+ import { BoxProps, ChakraComponent, ChakraProps } from "@chakra-ui/react";
2
+ import { sizesArray } from "../../theme/sharedTypes";
3
+ import React, { ButtonHTMLAttributes } from "react";
3
4
  export declare const buttonElementTypeArray: readonly ["submit", "button", "reset"];
4
5
  export declare const buttonSizesArray: readonly ["small", "medium", "large"];
5
- export declare const buttonTypesArray: readonly ["primary", "secondary", "text", "callout", "pill", "noBrand"];
6
+ export declare const buttonVariantsArray: readonly ["primary", "secondary", "text", "callout", "pill", "iconOnly", "noBrand"];
6
7
  export type ButtonElementType = typeof buttonElementTypeArray[number];
7
- export type ButtonSizes = typeof buttonSizesArray[number];
8
- export type ButtonTypes = typeof buttonTypesArray[number];
9
- export interface ButtonProps {
10
- /** The button variation to render based on the `ButtonTypes` type. */
11
- buttonType?: ButtonTypes;
12
- /** Additional className to use. */
13
- className?: string;
14
- /** ID that other components can cross reference for accessibility purposes. */
15
- id: string;
8
+ export type ButtonVariants = typeof buttonVariantsArray[number];
9
+ export type ButtonSizes = typeof sizesArray[number];
10
+ export interface ButtonProps extends Pick<BoxProps, keyof ChakraProps>, Omit<ButtonHTMLAttributes<HTMLButtonElement>, "color"> {
16
11
  /** Adds 'disabled' property to the button. */
17
12
  isDisabled?: boolean;
18
13
  /** Trigger the Button's action through the `mouseDown` event handler instead
19
14
  * of `onClick`. `false` by default. */
20
15
  mouseDown?: boolean;
21
- /** The action to perform on the `<button>`'s onClick function. */
22
- onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
23
16
  /** Visibly hidden text that will only be read by screenreaders. */
24
17
  screenreaderOnlyText?: string;
25
18
  /** The size of the `Button`. */
26
19
  size?: ButtonSizes;
27
- /** The HTML button type attribute. */
28
- type?: ButtonElementType;
20
+ /** The button variation to render based on the `ButtonVariants` type. */
21
+ variant?: ButtonVariants;
29
22
  }
30
23
  /**
31
- * Renders a simple `button` element with custom variant styles.
24
+ * Renders a simple `button` element with custom `variant` styles.
32
25
  */
33
26
  export declare const Button: ChakraComponent<React.ForwardRefExoticComponent<React.PropsWithChildren<ButtonProps> & React.RefAttributes<HTMLButtonElement>>, React.PropsWithChildren<ButtonProps>>;
34
27
  export default Button;
@@ -1,15 +1,11 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
1
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
2
2
  import React from "react";
3
3
  import { LayoutTypes } from "../../helpers/types";
4
4
  export declare const buttonGroupWidthsArray: readonly ["default", "full"];
5
5
  export type ButtonGroupWidths = typeof buttonGroupWidthsArray[number];
6
- export interface ButtonGroupProps {
6
+ export interface ButtonGroupProps extends BoxProps {
7
7
  /** Sets the width to "default" (for "fit-content") or "full". */
8
8
  buttonWidth?: ButtonGroupWidths;
9
- /** Additional className to use. */
10
- className?: string;
11
- /** ID that other components can cross reference for accessibility purposes. */
12
- id?: string;
13
9
  /** Set's the disabled state to all the internal `Button` components. */
14
10
  isDisabled?: boolean;
15
11
  /** Renders the layout of `Button` components in a row or column. */
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const ButtonGroupContext: import("react").Context<boolean>;
3
+ export declare const useButtonGroup: () => boolean;
@@ -1,7 +1,7 @@
1
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
1
2
  import React from "react";
2
- import { ChakraComponent } from "@chakra-ui/react";
3
- import { LayoutTypes } from "../../helpers/types";
4
3
  import { ComponentImageProps } from "../Image/Image";
4
+ import { LayoutTypes } from "../../helpers/types";
5
5
  interface CardBaseProps {
6
6
  /** Optional value to control the alignment of the text and elements. */
7
7
  isCentered?: boolean;
@@ -9,11 +9,7 @@ interface CardBaseProps {
9
9
  * Default is `"column"`. */
10
10
  layout?: LayoutTypes;
11
11
  }
12
- interface CardWrapperProps {
13
- /** Optional CSS class name to add. */
14
- className?: string;
15
- /** ID that other components can cross reference for accessibility purposes. */
16
- id?: string;
12
+ interface CardWrapperProps extends BoxProps {
17
13
  /** Main link to use when the full `Card` component should be clickable. */
18
14
  mainActionLink?: string;
19
15
  /** Additional object for styling the `Card`'s `div` wrapper. */
@@ -1,5 +1,5 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
2
- import React from "react";
1
+ import { BoxProps, ChakraComponent, ChakraProps } from "@chakra-ui/react";
2
+ import React, { InputHTMLAttributes } from "react";
3
3
  import { HelperErrorTextType } from "../HelperErrorText/HelperErrorText";
4
4
  interface CheckboxIconProps {
5
5
  /** When using the Checkbox as a "controlled" form element, you can specify
@@ -10,13 +10,9 @@ interface CheckboxIconProps {
10
10
  /** Adds the indeterminate state to the `Checkbox`. */
11
11
  isIndeterminate?: boolean;
12
12
  }
13
- export interface CheckboxProps extends CheckboxIconProps {
14
- /** className you can add in addition to 'input' */
15
- className?: string;
13
+ export interface CheckboxProps extends Pick<BoxProps, keyof ChakraProps>, CheckboxIconProps, Omit<InputHTMLAttributes<HTMLInputElement>, "color" | "height" | "width"> {
16
14
  /** Optional string to populate the HelperErrorText for standard state */
17
15
  helperText?: HelperErrorTextType;
18
- /** ID that other components can cross reference for accessibility purposes */
19
- id: string;
20
16
  /** Optional string to populate the HelperErrorText for the error state
21
17
  * when `isInvalid` is true. */
22
18
  invalidText?: HelperErrorTextType;
@@ -31,11 +27,6 @@ export interface CheckboxProps extends CheckboxIconProps {
31
27
  /** The checkbox's label. This will serve as the text content for a `<label>`
32
28
  * element if `showlabel` is true, or an "aria-label" if `showLabel` is false. */
33
29
  labelText: string | JSX.Element;
34
- /** The name prop indicates into which group of checkboxes this checkbox
35
- * belongs. If none is specified, 'default' will be used */
36
- name?: string;
37
- /** The action to perform on the `<input>`'s onChange function */
38
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
39
30
  /** Offers the ability to hide the helper/invalid text. */
40
31
  showHelperInvalidText?: boolean;
41
32
  /** Offers the ability to show the checkbox's label onscreen or hide it.
@@ -1,16 +1,12 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
1
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
2
2
  import React from "react";
3
3
  import { HelperErrorTextType } from "../HelperErrorText/HelperErrorText";
4
4
  import { LayoutTypes } from "../../helpers/types";
5
- export interface CheckboxGroupProps {
6
- /** Any child node passed to the component. */
7
- children: React.ReactNode;
5
+ export interface CheckboxGroupProps extends Omit<BoxProps, "onChange"> {
8
6
  /** Populates the initial value of the input */
9
7
  defaultValue?: string[];
10
8
  /** Optional string to populate the HelperErrorText for standard state */
11
9
  helperText?: HelperErrorTextType;
12
- /** ID that other components can cross reference for accessibility purposes */
13
- id: string;
14
10
  /** Optional string to populate the HelperErrorText for error state */
15
11
  invalidText?: HelperErrorTextType;
16
12
  /** Adds the 'disabled' prop to the input when true. */
@@ -45,8 +41,8 @@ export interface CheckboxGroupProps {
45
41
  /**
46
42
  * Wrapper component to wrap `Checkbox` components. Can be displayed in a
47
43
  * column or in a row. The `CheckboxGroup` component renders all the necessary
48
- * wrapping and associated text elements, but the checkbox input elements
49
- * _need_ to be child `Checkbox` components from the NYPL Design System.
44
+ * wrapping and associated text elements. We highly recommend using DS
45
+ * `Checkbox` components as children.
50
46
  */
51
47
  export declare const CheckboxGroup: ChakraComponent<React.ForwardRefExoticComponent<React.PropsWithChildren<CheckboxGroupProps> & React.RefAttributes<HTMLDivElement>>, React.PropsWithChildren<CheckboxGroupProps>>;
52
48
  export default CheckboxGroup;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ interface CheckboxGroupContextValue {
3
+ isDisabled: boolean;
4
+ isInvalid: boolean;
5
+ isRequired: boolean;
6
+ name: string;
7
+ }
8
+ export declare const CheckboxGroupContext: import("react").Context<CheckboxGroupContextValue>;
9
+ export declare const useCheckboxGroup: () => CheckboxGroupContextValue;
10
+ export {};
@@ -1,10 +1,7 @@
1
+ import { BoxProps } from "@chakra-ui/react";
1
2
  import React from "react";
2
3
  import { HelperErrorTextType } from "../HelperErrorText/HelperErrorText";
3
- export interface ComponentWrapperProps {
4
- /** The UI elements that will be wrapped by this component */
5
- children: React.ReactNode;
6
- /** A class name for the `div` parent element. */
7
- className?: string;
4
+ export interface ComponentWrapperProps extends BoxProps {
8
5
  /** Optional string to set the text for the component's description */
9
6
  descriptionText?: string | JSX.Element;
10
7
  /** Optional string value used to set the text for a `Heading` component, or
@@ -17,8 +14,6 @@ export interface ComponentWrapperProps {
17
14
  helperTextStyles?: {
18
15
  [key: string]: any;
19
16
  };
20
- /** ID that other components can cross reference for accessibility purposes */
21
- id?: string;
22
17
  /** Optional string to populate the `HelperErrorText` for the error state
23
18
  * when `isInvalid` is true. */
24
19
  invalidText?: HelperErrorTextType;
@@ -1,4 +1,4 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
1
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
2
2
  import React from "react";
3
3
  import { HelperErrorTextType } from "../HelperErrorText/HelperErrorText";
4
4
  import { InputProps, TextInputRefType } from "../TextInput/TextInput";
@@ -11,15 +11,11 @@ export interface FullDateType {
11
11
  /** Date object that gets returned for the onChange function. */
12
12
  startDate: Date | null;
13
13
  }
14
- interface DateRangeRowProps {
15
- /** ID that other components can cross reference for accessibility purposes. */
16
- id: string;
14
+ interface DateRangeRowProps extends BoxProps {
17
15
  /** Whether to render a single date input or two for a range of two dates. */
18
16
  isDateRange?: boolean;
19
17
  }
20
- interface DatePickerWrapperProps extends DateRangeRowProps {
21
- /** Additional className. */
22
- className?: string;
18
+ interface DatePickerWrapperProps extends Omit<BoxProps, "onChange">, DateRangeRowProps {
23
19
  /** Adds the 'required' property to the input element(s). */
24
20
  isRequired?: boolean;
25
21
  /** Passed to the `TextInput` component to render a label associated with an input field. */
@@ -42,7 +38,7 @@ export interface CustomTextInputProps extends Partial<InputProps> {
42
38
  /** Data value used by the ReactDatePicker plugin and the custom TextInput component. */
43
39
  value?: string;
44
40
  }
45
- export interface DatePickerProps extends DatePickerWrapperProps {
41
+ export interface DatePickerProps extends Omit<DatePickerWrapperProps, "onChange"> {
46
42
  /** The date format to display. Defaults to "yyyy-MM-dd".
47
43
  * Must be in ISO-8601 format. */
48
44
  dateFormat?: string;
@@ -1,21 +1,17 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
1
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
2
2
  import React from "react";
3
3
  import { ImageProps } from "../Image/Image";
4
4
  export declare const featuredContentWidthArray: string[];
5
5
  export type FeaturedContentWidthType = typeof featuredContentWidthArray[number];
6
6
  export declare const featuredContentPositionArray: readonly ["start", "end"];
7
7
  export type FeaturedContentPositionType = typeof featuredContentPositionArray[number];
8
- export interface FeaturedContentImageProps extends ImageProps {
8
+ export interface FeaturedContentImageProps extends Omit<ImageProps, "position"> {
9
9
  /** String value that specifies the width of the image rendered within the component. */
10
10
  width?: FeaturedContentWidthType;
11
11
  /** String value that specifies the position of the image rendered within the component. */
12
12
  position?: FeaturedContentPositionType;
13
13
  }
14
- export interface FeaturedContentProps {
15
- /** Optional CSS class name to add. */
16
- className?: string;
17
- /** ID that other components can cross reference for accessibility purposes. */
18
- id?: string;
14
+ export interface FeaturedContentProps extends BoxProps {
19
15
  /** The text content rendered in the component. DS components and native HTML can be passed in this prop. */
20
16
  textContent: string | JSX.Element;
21
17
  /** Whether component will fill the full width of the browser window, instead of just its parent element.
@@ -1,10 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { ChakraComponent } from "@chakra-ui/react";
2
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
3
3
  export declare const feedbackBoxViewTypeArray: readonly ["form", "confirmation", "error"];
4
4
  export type FeedbackBoxViewType = typeof feedbackBoxViewTypeArray[number];
5
- export interface FeedbackBoxProps {
6
- /** Additional class name to add. */
7
- className?: string;
5
+ export interface FeedbackBoxProps extends Omit<BoxProps, "onSubmit"> {
8
6
  /** Used to add additional information to the default confirmation message in
9
7
  * the confirmation view. */
10
8
  confirmationText?: string | JSX.Element;
@@ -14,8 +12,6 @@ export interface FeedbackBoxProps {
14
12
  /** A data object containing key/value pairs that will be added to the form
15
13
  * field submitted data. */
16
14
  hiddenFields?: any;
17
- /** ID that other components can cross reference for accessibility purposes */
18
- id?: string;
19
15
  /** Toggles the invalid state for the comment field. */
20
16
  isInvalidComment?: boolean;
21
17
  /** Toggles the invalid state for the email field. */
@@ -1,10 +1,6 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
1
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
2
2
  import React from "react";
3
- export interface FieldsetProps {
4
- /** Additional class name to add. */
5
- className?: string;
6
- /** ID that other components can cross reference for accessibility purposes */
7
- id: string;
3
+ export interface FieldsetProps extends BoxProps {
8
4
  /** Flag to show or hide the text in the `legend` element. False by default. */
9
5
  isLegendHidden?: boolean;
10
6
  /** Flag to render "required" in the `legend`. True by default. */
@@ -1,13 +1,9 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
1
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
2
2
  import React from "react";
3
3
  import { LayoutTypes } from "../../helpers/types";
4
4
  import { MultiSelectWidths, SelectedItems as MultiSelectItems } from "../MultiSelect/MultiSelect";
5
5
  export type FilterBarItemsType = (boolean | number | number[] | string | string[] | MultiSelectItems)[];
6
- export interface FilterBarInlineProps {
7
- /** The className of the FilterBarInline. */
8
- className?: string;
9
- /** ID that other components can cross reference for accessibility purposes. */
10
- id?: string;
6
+ export interface FilterBarInlineProps extends BoxProps {
11
7
  /** Optional string value used to set the text for a `Heading` component, or
12
8
  * a DS Heading component that can be passed in.
13
9
  */
@@ -1,17 +1,13 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
1
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
2
2
  import React from "react";
3
3
  import { LayoutTypes } from "../../helpers/types";
4
4
  import { MultiSelectWidths } from "../MultiSelect/MultiSelect";
5
5
  import { FilterBarItemsType } from "../FilterBarInline/FilterBarInline";
6
- export interface FilterBarPopupProps {
7
- /** The className of the FilterBarInline. */
8
- className?: string;
6
+ export interface FilterBarPopupProps extends BoxProps {
9
7
  /** Optional string value used to set the text for a `Heading` component, or
10
8
  * a DS Heading component that can be passed in.
11
9
  */
12
10
  heading?: string | JSX.Element;
13
- /** ID that other components can cross reference for accessibility purposes. */
14
- id?: string;
15
11
  /** Only used for internal purposes. */
16
12
  isOpen?: boolean;
17
13
  /** Function for the global `Clear Filters` button. If passed the `Clear Filters` button will render. */
@@ -1,30 +1,25 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
2
- import React from "react";
1
+ import { BoxProps, ChakraComponent, ChakraProps } from "@chakra-ui/react";
2
+ import React, { FormHTMLAttributes } from "react";
3
3
  import { GridGaps } from "../Grid/SimpleGrid";
4
- interface FormBaseProps {
5
- /** className to be applied to FormRow, FormField, and Form */
6
- className?: string;
4
+ interface FormBaseProps extends Pick<BoxProps, "id" | "className" | keyof ChakraProps> {
7
5
  /** Optional spacing size; if omitted, the default `large` (2rem / 32px)
8
6
  * spacing will be used; ```IMPORTANT: for general form layout, this prop
9
7
  * should not be used``` */
10
8
  gap?: GridGaps;
11
- /** ID that other components can cross reference (internal use) */
12
- id: string;
13
9
  }
14
10
  export interface FormChildProps extends Partial<FormBaseProps> {
15
11
  }
16
- export interface FormProps extends FormBaseProps {
17
- /** Optional form `action` attribute */
18
- action?: string;
19
- /** Optional form `method` attribute */
20
- method?: "get" | "post";
21
- /** Function to call for the `onSubmit` form event. */
22
- onSubmit?: (e: React.FormEvent<any>) => void;
12
+ export interface FormProps extends FormBaseProps, Omit<FormHTMLAttributes<HTMLFormElement>, "color"> {
23
13
  }
24
14
  /** FormRow child-component */
25
15
  export declare const FormRow: ChakraComponent<React.ForwardRefExoticComponent<React.PropsWithChildren<FormChildProps> & React.RefAttributes<HTMLDivElement>>, FormChildProps>;
26
16
  /** FormField child-component */
27
17
  export declare const FormField: ChakraComponent<React.ForwardRefExoticComponent<React.PropsWithChildren<FormChildProps> & React.RefAttributes<HTMLDivElement>>, FormChildProps>;
28
- /** Main Form component */
18
+ /**
19
+ * The `Form` component renders a standard `<form>` element and should be used
20
+ * to handle layout and spacing for child input fields. `FormRow` and `FormField`
21
+ * components should be used to build the `<form>` structure and to arrange input
22
+ * fields as needed.
23
+ */
29
24
  export declare const Form: ChakraComponent<React.ForwardRefExoticComponent<React.PropsWithChildren<FormProps> & React.RefAttributes<HTMLDivElement & HTMLFormElement>>, React.PropsWithChildren<FormProps>>;
30
25
  export default Form;
@@ -1,10 +1,8 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
1
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
2
2
  import React from "react";
3
3
  export declare const gridGapsArray: readonly ["grid.xxs", "grid.xs", "grid.s", "grid.m", "grid.l", "grid.xl", "grid.xxl"];
4
4
  export type GridGaps = typeof gridGapsArray[number];
5
- export interface SimpleGridProps {
6
- /** Additional class name. */
7
- className?: string;
5
+ export interface SimpleGridProps extends BoxProps {
8
6
  /** Optional numeric value to override the default column count; the default
9
7
  * column count is 3. */
10
8
  columns?: number;
@@ -12,8 +10,6 @@ export interface SimpleGridProps {
12
10
  * will be used; `IMPORTANT: for standard grid layouts, this prop should
13
11
  * not be used.` */
14
12
  gap?: GridGaps;
15
- /** ID that other components can cross reference for accessibility purposes */
16
- id?: string;
17
13
  }
18
14
  export declare const SimpleGrid: ChakraComponent<React.ForwardRefExoticComponent<React.PropsWithChildren<SimpleGridProps> & React.RefAttributes<HTMLDivElement>>, React.PropsWithChildren<SimpleGridProps>>;
19
15
  export default SimpleGrid;
@@ -1,15 +1,10 @@
1
- import { ChakraComponent, HeadingProps as ChakraHeadingProps } from "@chakra-ui/react";
1
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
2
2
  import React from "react";
3
3
  export declare const headingSizesArray: readonly ["display1", "heading1", "heading2", "heading3", "heading4", "heading5", "heading6", "heading7", "heading8"];
4
4
  export declare const headingLevelsArray: readonly ["h1", "h2", "h3", "h4", "h5", "h6"];
5
5
  export type HeadingSizes = typeof headingSizesArray[number];
6
6
  export type HeadingLevels = typeof headingLevelsArray[number];
7
- export interface HeadingProps extends ChakraHeadingProps {
8
- /** Optional className that appears in addition to `heading` */
9
- className?: string;
10
- /** Optional ID that other components can cross reference for accessibility
11
- * purposes */
12
- id?: string;
7
+ export interface HeadingProps extends BoxProps {
13
8
  /** Optional prop used to show capitalized text */
14
9
  isCapitalized?: boolean;
15
10
  /** Optional prop used to show upper case text */
@@ -19,8 +14,6 @@ export interface HeadingProps extends ChakraHeadingProps {
19
14
  /** Optional number 1-6 used to create the `<h*>` tag; if prop is not passed,
20
15
  * `Heading` will default to `<h2>` */
21
16
  level?: HeadingLevels;
22
- /** Optional prop used to remove default spacing */
23
- noSpace?: boolean;
24
17
  /** String to populate the overline element */
25
18
  overline?: string;
26
19
  /** Optional size used to override the default styles of the native HTML `<h>`
@@ -1,12 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { ChakraComponent } from "@chakra-ui/react";
2
+ import { BoxProps, ChakraComponent } from "@chakra-ui/react";
3
3
  export type HelperErrorTextType = string | JSX.Element;
4
- type HTMLDivAttributes = Pick<React.HTMLAttributes<HTMLDivElement>, "aria-atomic" | "aria-live">;
5
- export interface HelperErrorTextProps extends HTMLDivAttributes {
6
- /** Additional className to add. */
7
- className?: string;
8
- /** Unique ID for accessibility purposes. */
9
- id?: string;
4
+ export interface HelperErrorTextProps extends BoxProps {
10
5
  /** Toggles between helper and invalid styling. */
11
6
  isInvalid?: boolean;
12
7
  /** Offers the ability to render or not render the content passed in