@nypl/design-system-react-components 1.0.7 → 1.0.8

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/CHANGELOG.md CHANGED
@@ -8,6 +8,27 @@ Currently, this repo is in Prerelease. When it is released, this project will ad
8
8
 
9
9
  ## Prerelease
10
10
 
11
+ ## 1.0.8 (August 11, 2022)
12
+
13
+ ### Adds
14
+
15
+ - Adds new color values under ui:
16
+ - `bg.default`, `bg.hover`, `bg.active`, `border.default`, `border.hover`, `typography.heading`, and `typography.body`.
17
+ - Adds new colors values under ui.gray:
18
+ - `xxxx-dark` and `xxx-dark`.
19
+ - Adds UI fills colors for dark mode in the codebase and also exported in the `useNYPLTheme` hook.
20
+ - Adds an optional `panelMaxHeight` prop to the `Accordion` component that determines the height of the panel and displays a scrollbar if content exceeds it.
21
+
22
+ ### Updates
23
+
24
+ - Updates color value for `xx-dark`.
25
+ - Updates the style of the TOC on the `Style Guide` pages to match the style of the TOC on the component pages.
26
+ - Updates the `Template` components to use CSS grid instead of flexbox.
27
+ - Updates the `Template` documentation with the new pattern for using individual `Template` components that go above the main `TemplateContent` component.
28
+ - Updates the `Placeholder` component's CSS to better display in the `Template` components.
29
+ - Updates how HTML attributes are passed down in the `Image` component to the HTML `img` element.
30
+ - Updates the `Accordion` so that its panel content only renders when the `Accordion` is open.
31
+
11
32
  ## 1.0.7 (July 29, 2022)
12
33
 
13
34
  ### Updates
@@ -12,6 +12,11 @@ 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
+ /** Sets max height of accordion panel. This value should be entered with the
16
+ * formatting of a CSS height attribute (ex. 100px, 8rem). If height of content
17
+ * within accordion panel is greater than height set by panelMaxHeight, a
18
+ * scrollbar will appear for accordion panel. */
19
+ panelMaxHeight?: string;
15
20
  }
16
21
  /**
17
22
  * Accordion component that shows content on toggle. Can be used to display
@@ -1,8 +1,8 @@
1
- import React from "react";
1
+ import React, { ImgHTMLAttributes } from "react";
2
2
  export declare type ImageRatios = "fourByThree" | "oneByTwo" | "original" | "sixteenByNine" | "square" | "threeByFour" | "threeByTwo" | "twoByOne";
3
3
  export declare type ImageSizes = "default" | "xxsmall" | "xsmall" | "small" | "medium" | "large";
4
4
  export declare type ImageTypes = "default" | "circle";
5
- export interface ComponentImageProps {
5
+ export interface ComponentImageProps extends Partial<HTMLImageElement> {
6
6
  /** String value used to populate the `alt` attribute of the internal `Image`
7
7
  * component's `img` element. @NOTE if an image is used, this value must be passed. */
8
8
  alt?: string;
@@ -37,7 +37,7 @@ interface ImageWrapperProps {
37
37
  /** Optional value to control the size of the image */
38
38
  size?: ImageSizes;
39
39
  }
40
- export interface ImageProps extends ImageWrapperProps {
40
+ export interface ImageProps extends ImageWrapperProps, ImgHTMLAttributes<HTMLImageElement> {
41
41
  /** Optionally pass in additional Chakra-based styles only for the figure. */
42
42
  additionalFigureStyles?: {
43
43
  [key: string]: any;
@@ -1,29 +1,33 @@
1
1
  import * as React from "react";
2
- export interface ColorCardProps {
3
- /** The backgroundColor of the color card. */
4
- backgroundColor: string;
5
- /** The name of a color's javascript theme object. */
6
- colorName: string;
7
- /** The name of the color that the current color is based on. */
8
- colorSource: string;
2
+ export interface DataTableProps {
3
+ /** Contrast and WCAG compliance data related to the color gray.xxxx-dark when
4
+ * used with the current color. */
5
+ dataBgPageColor: string[];
6
+ /** Contrast and WCAG compliance data related to the color gray.xxx-dark when
7
+ * used with the current color. */
8
+ dataBgDefaultColor: string[];
9
9
  /** Contrast and WCAG compliance data related to the color black when used
10
10
  * with the current color. */
11
- dataBlack: string[];
11
+ dataBlackColor: string[];
12
+ /** Contrast and WCAG compliance data related to the default color for
13
+ * heading elements when used with the current color. */
14
+ dataHeadingColor?: string[];
15
+ /** Contrast and WCAG compliance data related to the default color for basic
16
+ * text elements when used with the current color. */
17
+ dataBodyColor?: string[];
12
18
  /** Contrast and WCAG compliance data related to the color white when used
13
19
  * with the current color. */
14
- dataWhite: string[];
20
+ dataWhiteColor: string[];
15
21
  /** The color to use for text in the color card. */
16
22
  textColor: string;
17
23
  }
18
- export interface DataTableProps {
19
- /** Contrast and WCAG compliance data related to the color black when used
20
- * with the current color. */
21
- dataBlack: string[];
22
- /** Contrast and WCAG compliance data related to the color white when used
23
- * with the current color. */
24
- dataWhite: string[];
25
- /** color to use for text in color card */
26
- textColor: string;
24
+ export interface ColorCardProps extends DataTableProps {
25
+ /** The backgroundColor of the color card. */
26
+ backgroundColor: string;
27
+ /** The name of a color's javascript theme object. */
28
+ colorName: string;
29
+ /** The name of the color that the current color is based on. */
30
+ colorSource: string;
27
31
  }
28
32
  export declare const DataTable: (props: React.PropsWithChildren<DataTableProps>) => JSX.Element;
29
33
  export declare const ColorCard: (props: React.PropsWithChildren<ColorCardProps>) => JSX.Element;
@@ -28,6 +28,8 @@ export interface TemplateAppContainerProps extends TemplateFooterProps, Template
28
28
  /** ID used for the `main` HTML element. Defaults to "mainContent". Useful
29
29
  * anchor for the application skip navigation. */
30
30
  contentId?: string;
31
+ /** DOM that will be rendered in the `TemplateContentBottom` component section. */
32
+ contentBottom?: React.ReactElement;
31
33
  /** DOM that will be rendered in the `TemplateContentPrimary` component section. */
32
34
  contentPrimary?: React.ReactElement;
33
35
  /** DOM that will be rendered in the `TemplateContentSidebar` component section. */
@@ -66,9 +68,10 @@ declare const TemplateAboveHeader: (props: React.PropsWithChildren<TemplateProps
66
68
  */
67
69
  declare const TemplateHeader: ({ children, renderHeaderElement, }: React.PropsWithChildren<TemplateHeaderProps>) => JSX.Element;
68
70
  /**
69
- * This optional component should be used inside the `TemplateHeader` component.
70
- * This is meant to render its children from edge to edge and is most useful
71
- * for the `Breadcrumbs` and `Hero` components, and other banner-like components.
71
+ * This component should be used inside the `Template` component to contain both
72
+ * the `TemplateAboveHeader` and `TemplateHeader` components. This is meant to
73
+ * render its children from edge to edge and is most useful for the headers,
74
+ * `Breadcrumbs`, and `Hero` components or other banner-like components.
72
75
  */
73
76
  declare const TemplateBreakout: (props: React.PropsWithChildren<TemplateProps>) => JSX.Element;
74
77
  /**
@@ -88,6 +91,13 @@ declare const TemplateContent: (props: React.PropsWithChildren<TemplateContentPr
88
91
  * above the primary component and the sidebar component (if any).
89
92
  */
90
93
  declare const TemplateContentTop: (props: React.PropsWithChildren<TemplateProps>) => JSX.Element;
94
+ /**
95
+ * This optional component must be used inside the `TemplateContent` component
96
+ * and after the `TemplateContentPrimary` or `TemplateContentSidebar` component.
97
+ * This renders content in the main width of the container and should always
98
+ * render below the primary component and the sidebar component (if any).
99
+ */
100
+ declare const TemplateContentBottom: (props: React.PropsWithChildren<TemplateProps>) => JSX.Element;
91
101
  /**
92
102
  * This component is used to render content in a column when there must be a
93
103
  * sidebar component on either its left or right side. It must go inside the
@@ -126,5 +136,5 @@ declare const TemplateFooter: ({ children, renderFooterElement, }: React.PropsWi
126
136
  export declare const TemplateAppContainer: import("@chakra-ui/react").ChakraComponent<React.ForwardRefExoticComponent<TemplateAppContainerProps & {
127
137
  children?: React.ReactNode;
128
138
  } & React.RefAttributes<HTMLDivElement>>, {}>;
129
- export { Template, TemplateAboveHeader, TemplateHeader, TemplateBreakout, TemplateContent, TemplateContentTop, TemplateContentPrimary, TemplateContentSidebar, TemplateFooter, };
139
+ export { Template, TemplateAboveHeader, TemplateBreakout, TemplateContent, TemplateContentBottom, TemplateContentPrimary, TemplateContentSidebar, TemplateContentTop, TemplateFooter, TemplateHeader, };
130
140
  export default TemplateAppContainer;