@nypl/design-system-react-components 1.1.2 → 1.2.0-rc-2

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.
@@ -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;
@@ -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 */
@@ -15,6 +15,7 @@ declare const _default: {
15
15
  mlnBlack: string;
16
16
  mlnColor: string;
17
17
  mlnWhite: string;
18
+ nycdoeColor: string;
18
19
  nyplFullBlack: string;
19
20
  nyplFullWhite: string;
20
21
  nyplLionBlack: string;
@@ -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;