@nypl/design-system-react-components 1.1.1 → 1.2.0-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.
- package/dist/components/Accordion/Accordion.d.ts +3 -0
- package/dist/components/AlphabetFilter/AlphabetFilter.d.ts +23 -0
- package/dist/components/AudioPlayer/AudioPlayer.d.ts +43 -0
- package/dist/components/Button/Button.d.ts +3 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +2 -0
- package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +1 -1
- package/dist/components/Icons/Icon.d.ts +1 -1
- package/dist/components/Logo/Logo.d.ts +1 -1
- package/dist/components/Logo/LogoSvgs.d.ts +1 -0
- package/dist/components/Slider/Slider.d.ts +2 -0
- package/dist/components/TagSet/TagSet.d.ts +32 -0
- package/dist/components/TagSet/TagSetExplore.d.ts +27 -0
- package/dist/components/TagSet/TagSetFilter.d.ts +26 -0
- package/dist/design-system-react-components.cjs.development.js +1492 -781
- package/dist/design-system-react-components.cjs.development.js.map +1 -1
- package/dist/design-system-react-components.cjs.production.min.js +1 -1
- package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
- package/dist/design-system-react-components.esm.js +1493 -784
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/theme/components/alphabetFilter.d.ts +32 -0
- package/dist/theme/components/audioPlayer.d.ts +9 -0
- package/dist/theme/components/button.d.ts +24 -102
- package/dist/theme/components/customTable.d.ts +8 -0
- package/dist/theme/components/header/headerSearchButton.d.ts +1 -2
- package/dist/theme/components/header/headerSearchForm.d.ts +5 -0
- package/dist/theme/components/icon.d.ts +15144 -648
- package/dist/theme/components/tagSet.d.ts +115 -0
- package/dist/theme/components/tooltip.d.ts +1 -0
- package/dist/theme/foundations/radii.d.ts +4 -0
- package/dist/theme/foundations/spacing.d.ts +14 -0
- package/package.json +2 -1
- package/CHANGELOG.md +0 -1611
|
@@ -12,6 +12,9 @@ export interface AccordionProps {
|
|
|
12
12
|
id?: string;
|
|
13
13
|
/** Whether the accordion is open by default only on its initial rendering */
|
|
14
14
|
isDefaultOpen?: boolean;
|
|
15
|
+
/** Whether the contents of the Accordion should always be rendered.
|
|
16
|
+
* Useful for form-components. `false` by default. */
|
|
17
|
+
isAlwaysRendered?: boolean;
|
|
15
18
|
/** Sets max height of accordion panel. This value should be entered with the
|
|
16
19
|
* formatting of a CSS height attribute (ex. 100px, 8rem). If height of content
|
|
17
20
|
* within accordion panel is greater than height set by panelMaxHeight, a
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface AlphabetFilterProps {
|
|
3
|
+
/** Array of letters to specify which `Button` components should be set in an `enabled`
|
|
4
|
+
* state. By default, all buttons are `enabled`. */
|
|
5
|
+
activeLetters?: string[];
|
|
6
|
+
/** A class name for the AlphabetFilter parent div. */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** The currentLetter can be used to programatically set the selected letter without the
|
|
9
|
+
* user explicitly requesting it. */
|
|
10
|
+
currentLetter?: string;
|
|
11
|
+
/** Value used to set the text for a `Text` component that will be displayed above the letter buttons. */
|
|
12
|
+
descriptionText?: string | JSX.Element;
|
|
13
|
+
/** Value used to set the text for a `Heading` component. */
|
|
14
|
+
headingText?: string;
|
|
15
|
+
/** ID that other components can cross reference for accessibility purposes. */
|
|
16
|
+
id?: string;
|
|
17
|
+
/** Adds the `disabled` prop to the AlphabetFilter when true. */
|
|
18
|
+
isDisabled?: boolean;
|
|
19
|
+
/** The callback function called when a letter button or the Show All button is clicked. */
|
|
20
|
+
onClick: (filterValue: string) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const AlphabetFilter: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<AlphabetFilterProps & React.RefAttributes<HTMLDivElement>>, {}>;
|
|
23
|
+
export default AlphabetFilter;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const thirdPartyServices: readonly ["libsyn", "soundcloud", "spotify"];
|
|
3
|
+
export declare type ThirdPartyAudioType = typeof thirdPartyServices[number];
|
|
4
|
+
export declare type AudioType = ThirdPartyAudioType | "file";
|
|
5
|
+
export interface AudioPlayerProps {
|
|
6
|
+
/** Required string used to specify the type of audio playback. */
|
|
7
|
+
audioType: AudioType;
|
|
8
|
+
/** Optional className you can add in addition to `audio-player`. */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Optional string to set the text for the audio player description. */
|
|
11
|
+
descriptionText?: string;
|
|
12
|
+
/** Optional string to set a code snippet provided by Libsyn, SoundCloud or Spotify; the
|
|
13
|
+
* `AudioPlayer` component will accept the `embedCode` prop or the `filePath` prop.
|
|
14
|
+
*/
|
|
15
|
+
embedCode?: string;
|
|
16
|
+
/** Optional string to set the audio file, the path can be relative or absolute
|
|
17
|
+
* referring to a locally hosted file, or a fully qualified URL pointing to a locally hosted file
|
|
18
|
+
* or to another domain altogether.
|
|
19
|
+
* TODO: This prop won't be used until a future version.
|
|
20
|
+
*/
|
|
21
|
+
/** Optional string to set the text for a `Heading` component. */
|
|
22
|
+
headingText?: string;
|
|
23
|
+
/** Optional string to set the text for a `HelperErrorText` component. */
|
|
24
|
+
helperText?: string;
|
|
25
|
+
/** ID that other components can cross reference for accessibility purposes. */
|
|
26
|
+
id?: string;
|
|
27
|
+
/** Optional title to added to the `<iframe>` element for improved accessibility. If omitted, a
|
|
28
|
+
* generic title will be added.
|
|
29
|
+
*/
|
|
30
|
+
iframeTitle?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Renders an audio player from 3rd party services such as Libsyn, SoundCloud, and Spotify.
|
|
34
|
+
*/
|
|
35
|
+
export declare const AudioPlayer: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<AudioPlayerProps & {
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
} & React.RefAttributes<HTMLDivElement>>, {}>;
|
|
38
|
+
/**
|
|
39
|
+
* Parse the embedCode string to a DOM object for proper formatted HTML element.
|
|
40
|
+
* We are only interested in the iframe element.
|
|
41
|
+
*/
|
|
42
|
+
export declare function parseIframeEmbedCode(embedCode: string | undefined): HTMLIFrameElement | undefined;
|
|
43
|
+
export default AudioPlayer;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export declare type ButtonElementType = "submit" | "button" | "reset";
|
|
3
|
+
export declare type ButtonSizes = "small" | "medium" | "large";
|
|
3
4
|
export declare type ButtonTypes = "primary" | "secondary" | "text" | "callout" | "pill" | "noBrand" | "link";
|
|
4
5
|
interface ButtonProps {
|
|
5
6
|
/** The button variation to render based on the `ButtonTypes` type.*/
|
|
@@ -15,6 +16,8 @@ interface ButtonProps {
|
|
|
15
16
|
mouseDown?: boolean;
|
|
16
17
|
/** The action to perform on the `<button>`'s onClick function. */
|
|
17
18
|
onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
19
|
+
/** The size of the `Button`. */
|
|
20
|
+
size?: ButtonSizes;
|
|
18
21
|
/** The HTML button type attribute. */
|
|
19
22
|
type?: ButtonElementType;
|
|
20
23
|
}
|
|
@@ -38,6 +38,8 @@ export interface CheckboxGroupProps {
|
|
|
38
38
|
/** Whether or not to display the "(Required)" text in the label text.
|
|
39
39
|
* True by default. */
|
|
40
40
|
showRequiredLabel?: boolean;
|
|
41
|
+
/** The values to programmatically update the selected `Checkbox`es. */
|
|
42
|
+
value?: string[];
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
43
45
|
* Wrapper component to wrap `Checkbox` components. Can be displayed in a
|
|
@@ -6,7 +6,7 @@ export interface ComponentWrapperProps {
|
|
|
6
6
|
/** A class name for the `div` parent element. */
|
|
7
7
|
className?: string;
|
|
8
8
|
/** Optional string to set the text for the component's description */
|
|
9
|
-
descriptionText?: string;
|
|
9
|
+
descriptionText?: string | JSX.Element;
|
|
10
10
|
/** Optional string to set the text for a `Heading` component */
|
|
11
11
|
headingText?: string;
|
|
12
12
|
/** Optional string to set the text for a `HelperErrorText` component */
|
|
@@ -3,7 +3,7 @@ export declare type IconAlign = "left" | "right" | "none";
|
|
|
3
3
|
export declare type IconColors = "ui.black" | "ui.white" | "brand.primary" | "brand.secondary" | "section.blogs.primary" | "section.blogs.secondary" | "section.books-and-more.primary" | "section.books-and-more.secondary" | "section.education.primary" | "section.education.secondary" | "section.locations.primary" | "section.locations.secondary" | "section.research.primary" | "section.research.secondary" | "section.research-library.lpa" | "section.research-library.schomburg" | "section.research-library.schwartzman" | "section.whats-on.primary" | "section.whats-on.secondary";
|
|
4
4
|
export declare type IconNames = "accessibilityFull" | "accessibilityPartial" | "actionCheckCircle" | "actionCheckCircleFilled" | "actionExit" | "actionHelpDefault" | "actionHelpOutline" | "actionLaunch" | "actionPower" | "actionRegistration" | "actionSettings" | "alertNotificationImportant" | "alertWarningFilled" | "alertWarningOutline" | "arrow" | "building" | "check" | "clock" | "close" | "decorativeEnvelope" | "decorativeLibraryCard" | "decorativeShoppingBag" | "download" | "errorFilled" | "errorOutline" | "fileTypeAudio" | "fileTypeDoc" | "fileTypeGenericDoc" | "fileTypeImage" | "fileTypePdf" | "fileTypeSpreadsheet" | "fileTypeVideo" | "headset" | "legacyAccountFilled" | "legacyAccountUnfilled" | "legacySocialFacebook" | "legacySocialInstagram" | "legacySocialTwitter" | "legacySocialYoutube" | "locator" | "minus" | "plus" | "search" | "socialFacebook" | "socialInstagram" | "socialTumblr" | "socialTwitter" | "socialYoutube" | "speakerNotes" | "utilityAccountFilled" | "utilityAccountUnfilled" | "utilityHamburger" | "utilitySearch";
|
|
5
5
|
export declare type IconRotationTypes = "rotate0" | "rotate90" | "rotate180" | "rotate270";
|
|
6
|
-
export declare type IconSizes = "default" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge";
|
|
6
|
+
export declare type IconSizes = "default" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge";
|
|
7
7
|
export declare type IconTypes = "default" | "breadcrumbs";
|
|
8
8
|
export interface IconProps {
|
|
9
9
|
/** Aligns the icon. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare type LogoNames = "appleAppStoreBlack" | "appleAppStoreWhite" | "bplBlack" | "bplWhite" | "cleverBadgeColor" | "cleverColor" | "cleverWhite" | "firstbookColor" | "firstbookColorNegative" | "googlePlayBlack" | "lpaBlack" | "lpaColor" | "lpaWhite" | "mlnBlack" | "mlnColor" | "mlnWhite" | "nyplFullBlack" | "nyplFullWhite" | "nyplLionBlack" | "nyplLionWhite" | "nyplTextBlack" | "nyplTextWhite" | "openebooksColor" | "openebooksNegative" | "openebooksWithTextColor" | "openebooksWithTextNegative" | "qplAltBlack" | "qplAltWhite" | "qplBlack" | "qplColor" | "qplWhite" | "reservoirIconColor" | "reservoirVerticalColor" | "schomburgBlack" | "schomburgCircleBlack" | "schomburgCircleColor" | "schomburgCircleWhite" | "schomburgColor" | "schomburgWhite" | "simplyeBlack" | "simplyeWhite" | "simplyeColor" | "snflBlack" | "snflWhite" | "treasuresColor" | "treasuresColorNegative";
|
|
2
|
+
export declare type LogoNames = "appleAppStoreBlack" | "appleAppStoreWhite" | "bplBlack" | "bplWhite" | "cleverBadgeColor" | "cleverColor" | "cleverWhite" | "firstbookColor" | "firstbookColorNegative" | "googlePlayBlack" | "lpaBlack" | "lpaColor" | "lpaWhite" | "mlnBlack" | "mlnColor" | "mlnWhite" | "nycdoeColor" | "nyplFullBlack" | "nyplFullWhite" | "nyplLionBlack" | "nyplLionWhite" | "nyplTextBlack" | "nyplTextWhite" | "openebooksColor" | "openebooksNegative" | "openebooksWithTextColor" | "openebooksWithTextNegative" | "qplAltBlack" | "qplAltWhite" | "qplBlack" | "qplColor" | "qplWhite" | "reservoirIconColor" | "reservoirVerticalColor" | "schomburgBlack" | "schomburgCircleBlack" | "schomburgCircleColor" | "schomburgCircleWhite" | "schomburgColor" | "schomburgWhite" | "simplyeBlack" | "simplyeWhite" | "simplyeColor" | "snflBlack" | "snflWhite" | "treasuresColor" | "treasuresColorNegative";
|
|
3
3
|
export declare type LogoSizes = "default" | "xxsmall" | "xsmall" | "small" | "medium" | "large";
|
|
4
4
|
export interface LogoProps {
|
|
5
5
|
/** Optional className that will be added to the parent element */
|
|
@@ -49,6 +49,8 @@ export interface SliderProps {
|
|
|
49
49
|
showValues?: boolean;
|
|
50
50
|
/** The amount to increase or decrease when using the slider thumb(s). */
|
|
51
51
|
step?: number;
|
|
52
|
+
/** The value(s) to programmatically update the Slider or RangeSlider. */
|
|
53
|
+
value?: number | number[];
|
|
52
54
|
}
|
|
53
55
|
/**
|
|
54
56
|
* The `Slider` component renders a singular value slider or a range slider
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TagSetExploreProps } from "./TagSetExplore";
|
|
3
|
+
import { TagSetFilterProps } from "./TagSetFilter";
|
|
4
|
+
export interface BaseTagSetProps {
|
|
5
|
+
/** Additional class for the component. */
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare type TagSetTypeProps = TagSetFilterProps | TagSetExploreProps;
|
|
9
|
+
export declare type TagSetProps = BaseTagSetProps & TagSetTypeProps;
|
|
10
|
+
export declare function isFilterType(type: TagSetProps["type"]): type is "filter";
|
|
11
|
+
/**
|
|
12
|
+
* This helper component wrapper renders a DS `Tooltip` component if the text is
|
|
13
|
+
* long or a React fragment. This assumes that the `label` prop is a rather
|
|
14
|
+
* simple single root JSX element, such as `<Link ...>....</Link>`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const TooltipWrapper: ({ label, children, }: React.PropsWithChildren<{
|
|
17
|
+
label: any;
|
|
18
|
+
}>) => JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* The `TagSet` component renders a group of individual tags which have two
|
|
21
|
+
* variants: "explore" and "filter". The "explore" tags are meant to be used for
|
|
22
|
+
* exploratory linkable elements, whereas the "filter" tags are used to display
|
|
23
|
+
* the filter values that were selected through another UI. Only "filter" tags
|
|
24
|
+
* can be dismissible.
|
|
25
|
+
*
|
|
26
|
+
* The width of a single tag will never be greater than 200px. If necessary, a
|
|
27
|
+
* tag’s label text will be truncated to keep a tag’s width at or below 200px.
|
|
28
|
+
* The full label text will be automatically revealed when the tag is hovered
|
|
29
|
+
* with a DS `Tooltip` component.
|
|
30
|
+
*/
|
|
31
|
+
export declare const TagSet: import("@chakra-ui/react").ChakraComponent<React.ElementType<TagSetProps>, TagSetProps>;
|
|
32
|
+
export default TagSet;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IconNames } from "../Icons/Icon";
|
|
3
|
+
export interface TagSetExploreDataProps {
|
|
4
|
+
/** The name of the SVG `Icon` to render before the tag label. */
|
|
5
|
+
iconName?: IconNames;
|
|
6
|
+
/** The content to display; should be a link-type component. */
|
|
7
|
+
label: JSX.Element;
|
|
8
|
+
}
|
|
9
|
+
export interface TagSetExploreProps {
|
|
10
|
+
/** ID that other components can cross reference for accessibility purposes. */
|
|
11
|
+
id?: string;
|
|
12
|
+
/** Whether the tags should be removable. */
|
|
13
|
+
isDismissible?: never;
|
|
14
|
+
/** The function to perform when a tag is clicked when `isDismissible` is true. */
|
|
15
|
+
onClick?: never;
|
|
16
|
+
/** The array of data to display as tags. */
|
|
17
|
+
tagSetData: TagSetExploreDataProps[];
|
|
18
|
+
/** The `TagSet` variant to render; "filter" by default. */
|
|
19
|
+
type: "explore";
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The "explore" `TagSet` variant will always display the tags passed as data.
|
|
23
|
+
* The `label` property in the `tagSetData` prop should be set to a link-type
|
|
24
|
+
* JSX component for linking to specific content.
|
|
25
|
+
*/
|
|
26
|
+
export declare const TagSetExplore: import("@chakra-ui/react").ChakraComponent<(props: TagSetExploreProps) => JSX.Element, {}>;
|
|
27
|
+
export default TagSetExplore;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IconNames } from "../Icons/Icon";
|
|
3
|
+
export interface TagSetFilterDataProps {
|
|
4
|
+
/** The name of the SVG `Icon` to render before the tag label. */
|
|
5
|
+
iconName?: IconNames;
|
|
6
|
+
/** The string label to display. */
|
|
7
|
+
label: string;
|
|
8
|
+
}
|
|
9
|
+
export interface TagSetFilterProps {
|
|
10
|
+
/** ID that other components can cross reference for accessibility purposes. */
|
|
11
|
+
id?: string;
|
|
12
|
+
/** Whether the tags should be removable. */
|
|
13
|
+
isDismissible?: boolean;
|
|
14
|
+
/** The function to perform when a tag is clicked when `isDismissible` is true. */
|
|
15
|
+
onClick?: (tagLabel: string) => void;
|
|
16
|
+
/** The array of data to display as tags. */
|
|
17
|
+
tagSetData: TagSetFilterDataProps[];
|
|
18
|
+
/** The `TagSet` variant to render; "filter" by default. */
|
|
19
|
+
type: "filter";
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The "filter" `TagSet` variant will display tags that can be removed when
|
|
23
|
+
* `isDismissible` is true and they are clicked.
|
|
24
|
+
*/
|
|
25
|
+
export declare const TagSetFilter: import("@chakra-ui/react").ChakraComponent<(props: TagSetFilterProps) => JSX.Element, {}>;
|
|
26
|
+
export default TagSetFilter;
|