@nypl/design-system-react-components 3.0.0-react-chakra-rc2 → 3.0.0-react-chakra-rc3
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.
- package/dist/design-system-react-components.cjs +55 -55
- package/dist/design-system-react-components.js +13121 -13355
- package/dist/src/__tests__/mediaMatchMock.d.ts +79 -0
- package/dist/src/components/Link/Link.d.ts +4 -6
- package/dist/src/components/MultiSelect/MultiSelectItemsCountButton.d.ts +3 -0
- package/dist/src/components/Tabs/Tabs.d.ts +2 -2
- package/dist/src/index.d.ts +16 -4
- package/dist/src/theme/components/featuredContent.d.ts +4 -4
- package/dist/src/theme/components/heading.d.ts +15 -210
- package/dist/src/theme/components/menu.d.ts +18 -6
- package/dist/src/theme/components/skeletonLoader.d.ts +51 -60
- package/dist/src/theme/components/structuredContent.d.ts +5 -72
- package/dist/src/theme/components/tabs.d.ts +2 -4
- package/package.json +1 -1
- package/dist/src/components/NewsletterSignup/NewsletterSignup.d.ts +0 -49
- package/dist/src/components/SocialMediaLinks/SocialMediaLinks.d.ts +0 -43
- 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
|
|
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;
|
|
@@ -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
18
|
onClear?: () => 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
|
|
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
|
|
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[];
|
package/dist/src/index.d.ts
CHANGED
|
@@ -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
|
-
|
|
49
|
-
|
|
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
|
-
|
|
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";
|
|
@@ -39,10 +39,10 @@ declare const FeaturedContent: {
|
|
|
39
39
|
alignItems: string;
|
|
40
40
|
display: string;
|
|
41
41
|
flexDirection: {
|
|
42
|
-
|
|
42
|
+
base: "column-reverse";
|
|
43
43
|
md: "row-reverse";
|
|
44
44
|
} | {
|
|
45
|
-
|
|
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
|
-
|
|
83
|
+
base: "320px";
|
|
84
84
|
md: "auto";
|
|
85
85
|
};
|
|
86
86
|
width: {
|
|
87
|
-
|
|
87
|
+
base: "100%";
|
|
88
88
|
md: string;
|
|
89
89
|
};
|
|
90
90
|
};
|