@nypl/design-system-react-components 3.0.0-react-chakra-rc2 → 3.0.0-react-chakra-rc4

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 (26) hide show
  1. package/dist/design-system-react-components.cjs +57 -57
  2. package/dist/design-system-react-components.js +13642 -13856
  3. package/dist/src/__tests__/mediaMatchMock.d.ts +79 -0
  4. package/dist/src/components/Link/Link.d.ts +4 -6
  5. package/dist/src/components/MultiSelect/MultiSelect.d.ts +1 -1
  6. package/dist/src/components/MultiSelect/MultiSelectItemsCountButton.d.ts +4 -1
  7. package/dist/src/components/Tabs/Tabs.d.ts +2 -2
  8. package/dist/src/components/TagSet/TagSet.d.ts +2 -0
  9. package/dist/src/components/TagSet/TagSetExplore.d.ts +8 -4
  10. package/dist/src/components/TagSet/TagSetFilter.d.ts +6 -2
  11. package/dist/src/index.d.ts +16 -4
  12. package/dist/src/theme/components/breadcrumb.d.ts +20 -0
  13. package/dist/src/theme/components/featuredContent.d.ts +4 -4
  14. package/dist/src/theme/components/global.d.ts +11 -1
  15. package/dist/src/theme/components/heading.d.ts +15 -210
  16. package/dist/src/theme/components/menu.d.ts +18 -6
  17. package/dist/src/theme/components/multiSelectItemsCountButton.d.ts +1 -0
  18. package/dist/src/theme/components/notification.d.ts +12 -0
  19. package/dist/src/theme/components/skeletonLoader.d.ts +51 -60
  20. package/dist/src/theme/components/statusBadge.d.ts +1 -1
  21. package/dist/src/theme/components/structuredContent.d.ts +5 -72
  22. package/dist/src/theme/components/tabs.d.ts +2 -4
  23. package/package.json +1 -1
  24. package/dist/src/components/NewsletterSignup/NewsletterSignup.d.ts +0 -49
  25. package/dist/src/components/SocialMediaLinks/SocialMediaLinks.d.ts +0 -43
  26. package/dist/src/components/SocialMediaLinks/SocialMediaLinksUtils.d.ts +0 -7
@@ -0,0 +1,79 @@
1
+ /**
2
+ * NYPL Note:
3
+ * This file is directly taken from Chakra:
4
+ * https://github.com/chakra-ui/chakra-ui/blob/main/packages/media-query/tests/matchmedia-mock-plus.ts
5
+ *
6
+ * We need this to test the `useNYPLBreakpoints` hook and, unfortunately,
7
+ * this function is not exported by Chakra.
8
+ */
9
+ /**
10
+ * This mock is a combination of jest-matchmedia-mock
11
+ * https://github.com/dyakovk/jest-matchmedia-mock and
12
+ * mq-polyfill https://github.com/bigslycat/mq-polyfill.
13
+ *
14
+ * A solution which allowed resizing and a more realistic implementation of
15
+ * matchMedia was the reason for its creation. Neither project provided a good
16
+ * solution. Combining their strong points does. The class will listen for a
17
+ * resize event which is provided by a resizeTo function defined in the test:
18
+ *
19
+ * window.resizeTo = function resizeTo(width, height) {
20
+ * Object.assign(this, {
21
+ * innerWidth: width,
22
+ * innerHeight: height,
23
+ * outerWidth: width,
24
+ * outerHeight: height,
25
+ * }).dispatchEvent(new this.Event('resize'))
26
+ * }
27
+ *
28
+ * Listeners are only called if there has been a change in the match
29
+ * status for their media query.
30
+ */
31
+ type MediaQueryListener = (this: MediaQueryList) => void;
32
+ interface MediaQueryList {
33
+ readonly matches: boolean;
34
+ readonly media: string;
35
+ onchange: MediaQueryListener | null;
36
+ addListener(listener: MediaQueryListener): void;
37
+ removeListener(listener: MediaQueryListener): void;
38
+ addEventListener(type: "change", listener: MediaQueryListener): void;
39
+ removeEventListener(type: "change", listener: MediaQueryListener): void;
40
+ dispatchEvent(event: Event): boolean;
41
+ }
42
+ export default class MatchMedia {
43
+ private mediaQueries;
44
+ private prevMatchMap;
45
+ private mediaQueryList;
46
+ constructor();
47
+ private compileQuery;
48
+ private evalQuery;
49
+ /**
50
+ *
51
+ * Adds a listener function for the window resize event
52
+ * @private
53
+ */
54
+ private handleResize;
55
+ private addListener;
56
+ private removeListener;
57
+ /**
58
+ * Returns an array listing the media queries for which the matchMedia has registered listeners
59
+ * @public
60
+ */
61
+ getMediaQueries(): string[];
62
+ /**
63
+ * Returns a copy of the array of listeners for the specified media query
64
+ * @public
65
+ */
66
+ getListeners(mediaQuery: string): MediaQueryListener[];
67
+ /**
68
+ * Clears all registered media queries and their listeners
69
+ * @public
70
+ */
71
+ clear(): void;
72
+ /**
73
+ * Clears all registered media queries and their listeners,
74
+ * and destroys the implementation of `window.matchMedia`
75
+ * @public
76
+ */
77
+ destroy(): void;
78
+ }
79
+ export {};
@@ -1,10 +1,8 @@
1
- import { ChakraComponent } from "@chakra-ui/react";
1
+ import { ChakraComponent, LinkProps as ChakraLinkProps } from "@chakra-ui/react";
2
2
  import React from "react";
3
3
  export declare const linkTypesArray: readonly ["action", "backwards", "button", "buttonPrimary", "buttonSecondary", "buttonPill", "buttonCallout", "buttonNoBrand", "buttonDisabled", "default", "external", "forwards", "standalone"];
4
4
  export type LinkTypes = typeof linkTypesArray[number];
5
- export interface LinkProps {
6
- /** Any child node passed to the component. */
7
- children: React.ReactNode;
5
+ export interface LinkProps extends ChakraLinkProps {
8
6
  /** Additional class name to render in the `Link` component. */
9
7
  className?: string;
10
8
  /** Used to include or remove visited state styles. Default is true. */
@@ -28,8 +26,8 @@ export interface LinkProps {
28
26
  type?: LinkTypes;
29
27
  }
30
28
  /**
31
- * A component that uses an `href` prop or a child anchor element, to create
32
- * an anchor element with added styling and conventions.
29
+ * A component that uses an `href` prop or a child anchor `<a>` element, to
30
+ * create an anchor element with added styling and conventions.
33
31
  */
34
32
  export declare const Link: ChakraComponent<React.ForwardRefExoticComponent<React.PropsWithChildren<LinkProps> & React.RefAttributes<HTMLDivElement & HTMLAnchorElement>>, React.PropsWithChildren<LinkProps>>;
35
33
  export default Link;
@@ -21,7 +21,7 @@ export interface MultiSelectProps {
21
21
  /** The number of items that will be visible in the list when the component first loads. */
22
22
  defaultItemsVisible?: number;
23
23
  /** The action to perform for clear/reset button of MultiSelect. */
24
- onClear?: () => void;
24
+ onClearAll?: () => void;
25
25
  /** The action to perform on the checkbox's onChange function. */
26
26
  onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
27
27
  /** The action to perform for a mixed state checkbox (parent checkbox). */
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  export interface MultiSelectItemsCountButtonProps {
3
+ /** An ID string that other components can cross reference for accessibility purposes. */
3
4
  id: string;
4
5
  /** The id of the MultiSelect using this button. */
5
6
  multiSelectId: string;
@@ -9,11 +10,13 @@ export interface MultiSelectItemsCountButtonProps {
9
10
  isOpen: boolean;
10
11
  /** The selected items state (items that were checked by user). */
11
12
  selectedItemsString: string;
13
+ /** The number of selected items. */
12
14
  selectedItemsCount: number;
13
15
  /** The callback function for the menu toggle. */
14
16
  onMenuToggle?: () => void;
15
17
  /** The action to perform for clear/reset button of MultiSelect. */
16
- onClear?: () => void;
18
+ onClearAll?: () => void;
19
+ /** The action to perform for key down event. */
17
20
  onKeyDown?: () => void;
18
21
  /** Ref to the Accordion Button element. */
19
22
  accordianButtonRef: any;
@@ -5,11 +5,11 @@ export interface TabsDataProps {
5
5
  content: string | React.ReactNode;
6
6
  }
7
7
  export interface TabsProps {
8
- /** The index of the tab to display for controlled situations. */
8
+ /** The index of the tab to display on the initial render. */
9
9
  defaultIndex?: number;
10
10
  /** ID that other components can cross reference for accessibility purposes */
11
11
  id?: string;
12
- /** The callback function invoked on every tab change event. */
12
+ /** The callback function invoked after every tab change event. The argument passed to the callback is the index of the tab just selected. */
13
13
  onChange?: (index: number) => any;
14
14
  /** Array of data to display */
15
15
  tabsData?: TabsDataProps[];
@@ -5,6 +5,8 @@ import { TagSetFilterProps } from "./TagSetFilter";
5
5
  export interface BaseTagSetProps {
6
6
  /** Additional class for the component. */
7
7
  className?: string;
8
+ /** ID that other components can cross reference for accessibility purposes. */
9
+ id?: string;
8
10
  }
9
11
  export type TagSetTypeProps = TagSetFilterProps | TagSetExploreProps;
10
12
  export type TagSetProps = BaseTagSetProps & TagSetTypeProps;
@@ -3,16 +3,20 @@ import { IconNames } from "../Icons/Icon";
3
3
  export interface TagSetExploreDataProps {
4
4
  /** The name of the SVG `Icon` to render before the tag label. */
5
5
  iconName?: IconNames;
6
+ /** The ID of the tag. */
7
+ id?: string;
6
8
  /** The content to display; should be a link-type component. */
7
9
  label: JSX.Element;
8
10
  }
9
11
  export interface TagSetExploreProps {
10
- /** ID that other components can cross reference for accessibility purposes. */
11
- id?: string;
12
- /** Whether the tags should be removable. This prop is not used in the "explore" variant. */
12
+ /** Whether the tags should be removable. This prop is not used in the
13
+ * "explore" variant. */
13
14
  isDismissible?: never;
15
+ /** The function to perform when the Clear All button is clicked. This prop
16
+ * is not used in the "explore" variant. */
17
+ onClear?: never;
14
18
  /** The function to perform when a tag is clicked when `isDismissible` is
15
- * true. This prop is not used in the "explore" variant.*/
19
+ * true. This prop is not used in the "explore" variant. */
16
20
  onClick?: never;
17
21
  /** The array of data to display as tags. */
18
22
  tagSetData: TagSetExploreDataProps[];
@@ -1,10 +1,14 @@
1
- import React from "react";
1
+ /// <reference types="react" />
2
2
  import { IconNames } from "../Icons/Icon";
3
3
  export interface TagSetFilterDataProps {
4
4
  /** The name of the SVG `Icon` to render before the tag label. */
5
5
  iconName?: IconNames;
6
+ /** The ID of the tag. */
7
+ id: string;
6
8
  /** The string label to display. */
7
9
  label: string;
10
+ /** Any other properties the consuming app may need for app logic filtering. */
11
+ [key: string]: string;
8
12
  }
9
13
  export interface TagSetFilterProps {
10
14
  /** ID that other components can cross reference for accessibility purposes. */
@@ -12,7 +16,7 @@ export interface TagSetFilterProps {
12
16
  /** Whether the tags should be removable. */
13
17
  isDismissible?: boolean;
14
18
  /** The function to perform when a tag is clicked when `isDismissible` is true. */
15
- onClick?: (tagLabel: string) => void;
19
+ onClick?: (tagSet: TagSetFilterDataProps) => void;
16
20
  /** The array of data to display as tags. */
17
21
  tagSetData: TagSetFilterDataProps[];
18
22
  /** The `TagSet` variant to render; "filter" by default. */
@@ -1,4 +1,4 @@
1
- export { Box, Center, Circle, ColorModeScript, cookieStorageManager, cookieStorageManagerSSR, Flex, Grid, GridItem, HStack, localStorageManager, Spacer, Square, Stack, useColorMode, useColorModeValue, VStack, } from "@chakra-ui/react";
1
+ export { Box, Center, Circle, ColorModeScript, cookieStorageManager, cookieStorageManagerSSR, FocusLock, Flex, Grid, GridItem, HStack, localStorageManager, Spacer, Square, Stack, useColorMode, useColorModeValue, useStyleConfig, useMultiStyleConfig, VStack, } from "@chakra-ui/react";
2
2
  export { default as Accordion } from "./components/Accordion/Accordion";
3
3
  export type { AccordionTypes } from "./components/Accordion/Accordion";
4
4
  export { default as AlphabetFilter } from "./components/AlphabetFilter/AlphabetFilter";
@@ -40,13 +40,20 @@ export { default as List } from "./components/List/List";
40
40
  export type { DescriptionProps, ListTypes } from "./components/List/List";
41
41
  export { default as Logo } from "./components/Logo/Logo";
42
42
  export type { LogoNames, LogoSizes } from "./components/Logo/Logo";
43
+ export { default as MatchMedia } from "../src/__tests__/mediaMatchMock";
43
44
  export { default as Menu } from "./components/Menu/Menu";
44
45
  export type { ListItemsData, ActionItem, GroupItem, DividerItem, } from "./components/Menu/Menu";
45
46
  export { ModalTrigger, useModal } from "./components/Modal/Modal";
46
47
  export { default as MultiSelect } from "./components/MultiSelect/MultiSelect";
47
48
  export type { MultiSelectItem, SelectedItems, } from "./components/MultiSelect/MultiSelect";
48
- export { default as NewsletterSignup } from "./components/NewsletterSignup/NewsletterSignup";
49
- export type { NewsletterSignupViewType } from "./components/NewsletterSignup/NewsletterSignup";
49
+ /** The code associated with the MultiSelectGroup component will not be exported
50
+ * until the refactor of the v2 version of the MultiSelectGroup component has
51
+ * been completed.
52
+ * */
53
+ /** The code associated with the NewsletterSignup component and the
54
+ * NewsletterSignupViewType type will not be exported until the refactor of the
55
+ * component has been completed.
56
+ * */
50
57
  export { default as Notification } from "./components/Notification/Notification";
51
58
  export type { NotificationTypes } from "./components/Notification/Notification";
52
59
  export { default as Pagination } from "./components/Pagination/Pagination";
@@ -63,7 +70,9 @@ export { default as SkeletonLoader } from "./components/SkeletonLoader/SkeletonL
63
70
  export type { SkeletonLoaderImageRatios } from "./components/SkeletonLoader/SkeletonLoader";
64
71
  export { default as SkipNavigation } from "./components/SkipNavigation/SkipNavigation";
65
72
  export { default as Slider } from "./components/Slider/Slider";
66
- export { default as SocialMediaLinks } from "./components/SocialMediaLinks/SocialMediaLinks";
73
+ /** The code associated with the SocialMediaLinks component will not be exported
74
+ * until the refactor of the component has been completed.
75
+ * */
67
76
  export { default as StatusBadge } from "./components/StatusBadge/StatusBadge";
68
77
  export type { StatusBadgeTypes } from "./components/StatusBadge/StatusBadge";
69
78
  export { default as StructuredContent } from "./components/StructuredContent/StructuredContent";
@@ -82,6 +91,9 @@ export { default as Toggle } from "./components/Toggle/Toggle";
82
91
  export type { ToggleSizes } from "./components/Toggle/Toggle";
83
92
  export { default as useCarouselStyles } from "./hooks/useCarouselStyles";
84
93
  export { default as useCloseDropDown } from "./hooks/useCloseDropDown";
94
+ /** The useFilterBar hooks will not be exported until the refactor of the v2
95
+ * versions of the FilterBar component has been completed.
96
+ * */
85
97
  export { default as useMultiSelect } from "./hooks/useMultiSelect";
86
98
  export { default as useNYPLBreakpoints } from "./hooks/useNYPLBreakpoints";
87
99
  export { default as useNYPLTheme } from "./hooks/useNYPLTheme";
@@ -29,6 +29,16 @@ declare const Breadcrumb: {
29
29
  color: string;
30
30
  textDecoration: string;
31
31
  };
32
+ _focus: {
33
+ boxShadow: string;
34
+ outline: string;
35
+ outlineOffset: string;
36
+ outlineColor: any;
37
+ zIndex: string;
38
+ _dark: {
39
+ outlineColor: any;
40
+ };
41
+ };
32
42
  };
33
43
  "li:last-child": {
34
44
  fontWeight: {
@@ -102,6 +112,16 @@ declare const Breadcrumb: {
102
112
  color: string;
103
113
  };
104
114
  };
115
+ _focus: {
116
+ boxShadow: string;
117
+ outline: string;
118
+ outlineOffset: string;
119
+ outlineColor: any;
120
+ zIndex: string;
121
+ _dark: {
122
+ outlineColor: any;
123
+ };
124
+ };
105
125
  };
106
126
  "li:last-child": {
107
127
  ".chakra-breadcrumb__link": {
@@ -39,10 +39,10 @@ declare const FeaturedContent: {
39
39
  alignItems: string;
40
40
  display: string;
41
41
  flexDirection: {
42
- sm: "column-reverse";
42
+ base: "column-reverse";
43
43
  md: "row-reverse";
44
44
  } | {
45
- sm: "column";
45
+ base: "column";
46
46
  md: "row";
47
47
  };
48
48
  maxWidth: string;
@@ -80,11 +80,11 @@ declare const FeaturedContent: {
80
80
  backgroundPosition: string;
81
81
  backgroundSize: string;
82
82
  height: {
83
- sm: "320px";
83
+ base: "320px";
84
84
  md: "auto";
85
85
  };
86
86
  width: {
87
- sm: "100%";
87
+ base: "100%";
88
88
  md: string;
89
89
  };
90
90
  };
@@ -1,6 +1,16 @@
1
1
  /** Export "mixin" styles. */
2
2
  export { screenreaderOnly, wrapperStyles } from "./globalMixins";
3
3
  /** Reusable component styles. */
4
+ declare const customFocusColor: (focusColor: any, focusColorDark: any) => {
5
+ boxShadow: string;
6
+ outline: string;
7
+ outlineOffset: string;
8
+ outlineColor: any;
9
+ zIndex: string;
10
+ _dark: {
11
+ outlineColor: any;
12
+ };
13
+ };
4
14
  declare const activeFocus: (darkMode?: boolean) => {
5
15
  boxShadow: string;
6
16
  outline: string;
@@ -139,4 +149,4 @@ declare const textMargin: {
139
149
  margin: string;
140
150
  marginBottom: string;
141
151
  };
142
- export { activeFocus, checkboxRadioControlSize, checkboxRadioGroupStyles, checkboxRadioHelperErrorTextStyle, checkboxRadioHoverStyles, checkboxRadioLabelStyles, defaultElementSizes, labelLegendText, selectTextInputDisabledStyles, selectTextInputFocusStyles, textMargin, };
152
+ export { activeFocus, checkboxRadioControlSize, checkboxRadioGroupStyles, checkboxRadioHelperErrorTextStyle, checkboxRadioHoverStyles, checkboxRadioLabelStyles, customFocusColor, defaultElementSizes, labelLegendText, selectTextInputDisabledStyles, selectTextInputFocusStyles, textMargin, };