@nypl/design-system-react-components 0.26.0 → 0.28.0
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 +56 -0
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -5
- package/dist/components/Button/Button.d.ts +2 -10
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
- package/dist/components/Card/Card.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.d.ts +10 -8
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/Form/Form.d.ts +2 -2
- package/dist/components/Grid/SimpleGrid.d.ts +6 -3
- package/dist/components/Heading/Heading.d.ts +2 -5
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +1 -5
- package/dist/components/Hero/Hero.d.ts +13 -9
- package/dist/components/Icons/Icon.d.ts +6 -5
- package/dist/components/Icons/IconSvgs.d.ts +21 -21
- package/dist/components/Image/Image.d.ts +8 -5
- package/dist/components/Link/Link.d.ts +1 -9
- package/dist/components/List/List.d.ts +7 -11
- package/dist/components/Logo/Logo.d.ts +2 -5
- package/dist/components/Logo/LogoSvgs.d.ts +39 -39
- package/dist/components/Modal/Modal.d.ts +28 -8
- package/dist/components/Notification/Notification.d.ts +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.d.ts +3 -2
- package/dist/components/Select/Select.d.ts +2 -5
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
- package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
- package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
- package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Template/Template.d.ts +2 -0
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +21 -9
- package/dist/components/Toggle/Toggle.d.ts +1 -5
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
- package/dist/design-system-react-components.cjs.development.js +977 -1213
- 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 +976 -1276
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/helpers/types.d.ts +1 -0
- package/dist/index.d.ts +27 -48
- package/dist/styles.css +1 -1
- package/dist/theme/components/buttonGroup.d.ts +11 -0
- package/dist/theme/components/card.d.ts +104 -8
- package/dist/theme/components/componentWrapper.d.ts +4 -3
- package/dist/theme/components/customTable.d.ts +11 -14
- package/dist/theme/components/fieldset.d.ts +4 -3
- package/dist/theme/components/helperErrorText.d.ts +4 -3
- package/dist/theme/components/hero.d.ts +1 -1
- package/dist/theme/components/horizontalRule.d.ts +4 -3
- package/dist/theme/components/icon.d.ts +47743 -1
- package/dist/theme/components/image.d.ts +563 -10
- package/dist/theme/components/label.d.ts +4 -3
- package/dist/theme/components/list.d.ts +6 -7
- package/dist/theme/components/logo.d.ts +474 -1
- package/dist/theme/components/notification.d.ts +20 -16
- package/dist/theme/components/progressIndicator.d.ts +6 -4
- package/dist/theme/components/select.d.ts +4 -10
- package/dist/theme/components/skeletonLoader.d.ts +14 -10
- package/dist/theme/components/skipNavigation.d.ts +22 -0
- package/dist/theme/components/slider.d.ts +7 -6
- package/dist/theme/components/structuredContent.d.ts +10 -9
- package/dist/theme/components/text.d.ts +7 -1
- package/dist/theme/components/toggle.d.ts +6 -4
- package/dist/theme/provider.d.ts +2 -4
- package/dist/utils/componentCategories.d.ts +1 -1
- package/dist/utils/interfaces.d.ts +5 -0
- package/dist/utils/utils.d.ts +2 -18
- package/package.json +15 -16
- package/src/__tests__/setup.ts +3 -3
- package/src/__tests__/utils/utils.test.ts +1 -23
- package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
- package/src/components/Accordion/Accordion.stories.mdx +43 -44
- package/src/components/Accordion/Accordion.test.tsx +5 -13
- package/src/components/Accordion/Accordion.tsx +14 -18
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
- package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
- package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
- package/src/components/Button/Button.stories.mdx +89 -126
- package/src/components/Button/Button.test.tsx +16 -30
- package/src/components/Button/Button.tsx +14 -20
- package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
- package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
- package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
- package/src/components/Card/Card.stories.mdx +143 -177
- package/src/components/Card/Card.test.tsx +36 -97
- package/src/components/Card/Card.tsx +78 -74
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +1 -1
- package/src/components/Chakra/Box.stories.mdx +2 -6
- package/src/components/Chakra/Center.stories.mdx +5 -23
- package/src/components/Chakra/Flex.stories.mdx +4 -6
- package/src/components/Chakra/Stack.stories.mdx +9 -10
- package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
- package/src/components/Checkbox/Checkbox.test.tsx +2 -2
- package/src/components/Checkbox/Checkbox.tsx +20 -13
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +9 -9
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +6 -17
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -7
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +33 -29
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +24 -35
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +3 -10
- package/src/components/DatePicker/DatePicker.stories.mdx +23 -37
- package/src/components/DatePicker/DatePicker.test.tsx +21 -19
- package/src/components/DatePicker/DatePicker.tsx +57 -49
- package/src/components/Form/Form.stories.mdx +46 -31
- package/src/components/Form/Form.test.tsx +1 -18
- package/src/components/Form/Form.tsx +7 -7
- package/src/components/Grid/SimpleGrid.stories.mdx +73 -49
- package/src/components/Grid/SimpleGrid.test.tsx +7 -9
- package/src/components/Grid/SimpleGrid.tsx +14 -11
- package/src/components/Heading/Heading.stories.mdx +27 -72
- package/src/components/Heading/Heading.test.tsx +18 -44
- package/src/components/Heading/Heading.tsx +7 -10
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -3
- package/src/components/HelperErrorText/HelperErrorText.tsx +1 -5
- package/src/components/Hero/Hero.stories.mdx +219 -216
- package/src/components/Hero/Hero.test.tsx +107 -223
- package/src/components/Hero/Hero.tsx +63 -61
- package/src/components/Icons/Icon.stories.mdx +172 -118
- package/src/components/Icons/Icon.test.tsx +8 -16
- package/src/components/Icons/Icon.tsx +75 -29
- package/src/components/Icons/IconSvgs.tsx +42 -42
- package/src/components/Image/Image.stories.mdx +45 -132
- package/src/components/Image/Image.test.tsx +16 -31
- package/src/components/Image/Image.tsx +28 -12
- package/src/components/Link/Link.stories.mdx +30 -94
- package/src/components/Link/Link.test.tsx +25 -75
- package/src/components/Link/Link.tsx +43 -56
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +1 -2
- package/src/components/List/List.stories.mdx +20 -31
- package/src/components/List/List.test.tsx +24 -43
- package/src/components/List/List.tsx +25 -36
- package/src/components/Logo/Logo.stories.mdx +94 -50
- package/src/components/Logo/Logo.test.tsx +10 -19
- package/src/components/Logo/Logo.tsx +50 -17
- package/src/components/Logo/LogoSvgs.tsx +78 -78
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +4 -4
- package/src/components/Modal/Modal.stories.mdx +245 -139
- package/src/components/Modal/Modal.test.tsx +147 -10
- package/src/components/Modal/Modal.tsx +140 -20
- package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +25 -0
- package/src/components/Notification/Notification.stories.mdx +10 -28
- package/src/components/Notification/Notification.test.tsx +9 -12
- package/src/components/Notification/Notification.tsx +34 -37
- package/src/components/Pagination/Pagination.stories.mdx +3 -4
- package/src/components/Pagination/Pagination.tsx +15 -10
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +27 -53
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +9 -10
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -21
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -10
- package/src/components/Radio/Radio.stories.mdx +1 -1
- package/src/components/Radio/Radio.tsx +9 -6
- package/src/components/RadioGroup/RadioGroup.stories.mdx +15 -16
- package/src/components/RadioGroup/RadioGroup.test.tsx +2 -8
- package/src/components/RadioGroup/RadioGroup.tsx +28 -24
- package/src/components/SearchBar/SearchBar.stories.mdx +1 -1
- package/src/components/SearchBar/SearchBar.test.tsx +1 -1
- package/src/components/SearchBar/SearchBar.tsx +14 -22
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1 -13
- package/src/components/Select/Select.stories.mdx +10 -25
- package/src/components/Select/Select.test.tsx +6 -7
- package/src/components/Select/Select.tsx +28 -35
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +24 -24
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +17 -56
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -21
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +9 -8
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +33 -33
- package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
- package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
- package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
- package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
- package/src/components/Slider/Slider.stories.mdx +19 -53
- package/src/components/Slider/Slider.test.tsx +2 -2
- package/src/components/Slider/Slider.tsx +10 -12
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2 -9
- package/src/components/StatusBadge/StatusBadge.stories.mdx +6 -21
- package/src/components/StatusBadge/StatusBadge.test.tsx +2 -3
- package/src/components/StatusBadge/StatusBadge.tsx +3 -10
- package/src/components/StructuredContent/StructuredContent.stories.mdx +30 -58
- package/src/components/StructuredContent/StructuredContent.test.tsx +42 -44
- package/src/components/StructuredContent/StructuredContent.tsx +9 -18
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -23
- package/src/components/StyleGuide/Buttons.stories.mdx +62 -62
- package/src/components/StyleGuide/ColorCard.tsx +2 -4
- package/src/components/StyleGuide/Colors.stories.mdx +7 -8
- package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
- package/src/components/StyleGuide/Forms.stories.mdx +0 -1
- package/src/components/StyleGuide/Iconography.stories.mdx +59 -77
- package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
- package/src/components/StyleGuide/Typography.stories.mdx +15 -18
- package/src/components/Table/Table.stories.mdx +85 -1
- package/src/components/Table/Table.test.tsx +57 -1
- package/src/components/Table/Table.tsx +7 -4
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +121 -0
- package/src/components/Tabs/Tabs.stories.mdx +1 -1
- package/src/components/Tabs/Tabs.test.tsx +2 -2
- package/src/components/Tabs/Tabs.tsx +26 -27
- package/src/components/Template/Template.stories.mdx +49 -54
- package/src/components/Template/Template.tsx +9 -3
- package/src/components/Text/Text.stories.mdx +5 -11
- package/src/components/Text/Text.test.tsx +3 -6
- package/src/components/Text/Text.tsx +3 -5
- package/src/components/TextInput/TextInput.stories.mdx +10 -22
- package/src/components/TextInput/TextInput.test.tsx +32 -62
- package/src/components/TextInput/TextInput.tsx +61 -30
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +1 -0
- package/src/components/Toggle/Toggle.stories.mdx +5 -16
- package/src/components/Toggle/Toggle.test.tsx +2 -3
- package/src/components/Toggle/Toggle.tsx +9 -10
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +13 -29
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -23
- package/src/components/VideoPlayer/VideoPlayer.tsx +13 -10
- package/src/docs/Chakra.stories.mdx +14 -11
- package/src/docs/Welcome.stories.mdx +23 -43
- package/src/helpers/types.ts +1 -0
- package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
- package/src/hooks/useNYPLTheme.stories.mdx +3 -6
- package/src/index.ts +52 -46
- package/src/styles.scss +0 -1
- package/src/theme/components/buttonGroup.ts +10 -0
- package/src/theme/components/card.ts +50 -15
- package/src/theme/components/componentWrapper.ts +5 -1
- package/src/theme/components/customTable.ts +8 -2
- package/src/theme/components/fieldset.ts +5 -1
- package/src/theme/components/helperErrorText.ts +5 -1
- package/src/theme/components/hero.ts +2 -2
- package/src/theme/components/horizontalRule.ts +5 -1
- package/src/theme/components/icon.ts +7 -1
- package/src/theme/components/image.ts +14 -3
- package/src/theme/components/label.ts +5 -1
- package/src/theme/components/list.ts +8 -2
- package/src/theme/components/logo.ts +5 -1
- package/src/theme/components/notification.ts +38 -14
- package/src/theme/components/progressIndicator.ts +10 -5
- package/src/theme/components/select.ts +5 -6
- package/src/theme/components/skeletonLoader.ts +8 -2
- package/src/theme/components/skipNavigation.ts +26 -0
- package/src/theme/components/slider.ts +13 -1
- package/src/theme/components/structuredContent.ts +11 -1
- package/src/theme/components/text.ts +12 -5
- package/src/theme/components/toggle.ts +9 -3
- package/src/theme/index.ts +4 -0
- package/src/theme/provider.tsx +1 -1
- package/src/utils/componentCategories.ts +13 -5
- package/src/utils/interfaces.ts +5 -0
- package/src/utils/utils.ts +2 -32
- package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
- package/dist/components/Button/ButtonTypes.d.ts +0 -8
- package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
- package/dist/components/Form/FormTypes.d.ts +0 -2
- package/dist/components/Grid/GridTypes.d.ts +0 -9
- package/dist/components/Heading/HeadingTypes.d.ts +0 -14
- package/dist/components/Hero/HeroTypes.d.ts +0 -12
- package/dist/components/Icons/IconTypes.d.ts +0 -77
- package/dist/components/Image/ImageTypes.d.ts +0 -22
- package/dist/components/Link/LinkTypes.d.ts +0 -8
- package/dist/components/List/ListTypes.d.ts +0 -5
- package/dist/components/Logo/LogoTypes.d.ts +0 -54
- package/dist/components/Notification/NotificationTypes.d.ts +0 -5
- package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
- package/dist/components/Select/SelectTypes.d.ts +0 -8
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
- package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
- package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
- package/dist/components/Text/TextTypes.d.ts +0 -6
- package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
- package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
- package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
- package/dist/helpers/enums.d.ts +0 -4
- package/dist/utils/siteSections.d.ts +0 -2
- package/src/components/Accordion/AccordionTypes.tsx +0 -5
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
- package/src/components/Button/ButtonTypes.tsx +0 -8
- package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
- package/src/components/Form/FormTypes.tsx +0 -3
- package/src/components/Grid/GridTypes.tsx +0 -9
- package/src/components/Heading/HeadingTypes.tsx +0 -15
- package/src/components/Hero/HeroTypes.tsx +0 -20
- package/src/components/Icons/IconTypes.tsx +0 -83
- package/src/components/Image/ImageTypes.ts +0 -24
- package/src/components/Link/LinkTypes.tsx +0 -8
- package/src/components/List/ListTypes.tsx +0 -5
- package/src/components/Logo/LogoTypes.tsx +0 -56
- package/src/components/Modal/_Modal.scss +0 -18
- package/src/components/Notification/NotificationTypes.tsx +0 -5
- package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
- package/src/components/Select/SelectTypes.tsx +0 -10
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
- package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
- package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
- package/src/components/Text/TextTypes.tsx +0 -6
- package/src/components/TextInput/TextInputTypes.tsx +0 -48
- package/src/components/Toggle/ToggleTypes.tsx +0 -4
- package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
- package/src/helpers/enums.ts +0 -4
- package/src/utils/siteSections.ts +0 -10
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import { As, Box, chakra, useStyleConfig } from "@chakra-ui/react";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
|
-
import { ListTypes } from "./ListTypes";
|
|
5
4
|
import Heading from "../Heading/Heading";
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
export type ListTypes = "ol" | "ul" | "dl";
|
|
7
7
|
interface DescriptionProps {
|
|
8
8
|
term: string;
|
|
9
9
|
description: string | JSX.Element;
|
|
10
10
|
}
|
|
11
11
|
export interface ListProps {
|
|
12
|
-
/** Optionally pass in additional Chakra-based styles. */
|
|
13
|
-
additionalStyles?: { [key: string]: any };
|
|
14
12
|
/** ClassName you can add in addition to 'list' */
|
|
15
13
|
className?: string;
|
|
16
14
|
/** ID that other components can cross reference for accessibility purposes */
|
|
17
15
|
id?: string;
|
|
18
16
|
/** Display the list in a row. */
|
|
19
17
|
inline?: boolean;
|
|
20
|
-
/** Data to render if children are not passed. For `
|
|
21
|
-
* `
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
18
|
+
/** Data to render if children are not passed. For `listTypes` orderd `"ol"`
|
|
19
|
+
* and unordered `"ul"` `List` types, the data structure is an array of strings
|
|
20
|
+
* to renders as `li` items. For descroption `"dl"` `List` types, the data
|
|
21
|
+
* structure is an array of objects with `term` and `description` properties
|
|
22
|
+
* to render `dt` and `dd` elements, respectively.
|
|
25
23
|
*/
|
|
26
24
|
listItems?: (string | JSX.Element | DescriptionProps)[];
|
|
27
25
|
/** Remove list styling. */
|
|
@@ -29,7 +27,7 @@ export interface ListProps {
|
|
|
29
27
|
/** An optional title that will appear over the list. This prop only applies
|
|
30
28
|
* to Description Lists. */
|
|
31
29
|
title?: string;
|
|
32
|
-
/** The type of list:
|
|
30
|
+
/** The type of list: "ol", "ul", or "dl". "ul" by default. */
|
|
33
31
|
type: ListTypes;
|
|
34
32
|
}
|
|
35
33
|
|
|
@@ -40,7 +38,6 @@ export interface ListProps {
|
|
|
40
38
|
*/
|
|
41
39
|
export const List = chakra((props: React.PropsWithChildren<ListProps>) => {
|
|
42
40
|
const {
|
|
43
|
-
additionalStyles = {},
|
|
44
41
|
children,
|
|
45
42
|
className,
|
|
46
43
|
id,
|
|
@@ -48,16 +45,15 @@ export const List = chakra((props: React.PropsWithChildren<ListProps>) => {
|
|
|
48
45
|
listItems,
|
|
49
46
|
noStyling = false,
|
|
50
47
|
title,
|
|
51
|
-
type =
|
|
48
|
+
type = "ul",
|
|
52
49
|
...rest
|
|
53
50
|
} = props;
|
|
54
51
|
const styles = useStyleConfig("List", { inline, noStyling, variant: type });
|
|
55
|
-
const finalStyles = { ...styles, ...additionalStyles };
|
|
56
52
|
let listElement = null;
|
|
57
53
|
|
|
58
54
|
// Either li/dt/dd children elements must be passed or the `listItems`
|
|
59
55
|
// prop must be used.
|
|
60
|
-
if (children &&
|
|
56
|
+
if (children && listItems && listItems?.length > 0) {
|
|
61
57
|
console.warn(
|
|
62
58
|
"NYPL Reservoir List: Pass in either `<li>`, `<dt>`, or `<dd>` " +
|
|
63
59
|
"children or use the `listItems` data prop. Do not use both."
|
|
@@ -75,17 +71,20 @@ export const List = chakra((props: React.PropsWithChildren<ListProps>) => {
|
|
|
75
71
|
/**
|
|
76
72
|
* This returns either the `children` elements passed to the `List` component
|
|
77
73
|
* first, otherwise it will check and render the data passed into the
|
|
78
|
-
* `listItems` props based on the `ListType` type. If it is of type
|
|
79
|
-
* or
|
|
80
|
-
* combination of `dt` and `dd` elements for the
|
|
74
|
+
* `listItems` props based on the `ListType` type. If it is of type unordered
|
|
75
|
+
* or ordered, it will return `li` elements. Otherwise, it will return a
|
|
76
|
+
* combination of `dt` and `dd` elements for the description type.
|
|
81
77
|
*/
|
|
82
78
|
const listChildrenElms = (listType: ListTypes) => {
|
|
83
79
|
if (children) {
|
|
84
80
|
return children;
|
|
85
81
|
}
|
|
86
|
-
if (
|
|
82
|
+
if (!listItems) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
if (listType === "ol" || listType === "ul") {
|
|
87
86
|
return listItems.map((item, i) => <li key={i}>{item}</li>);
|
|
88
|
-
} else if (listType ===
|
|
87
|
+
} else if (listType === "dl") {
|
|
89
88
|
return (listItems as DescriptionProps[]).map((item, i) => [
|
|
90
89
|
<dt key={`${i}-term`}>{item.term}</dt>,
|
|
91
90
|
<dd key={`${i}-des`}>{item.description}</dd>,
|
|
@@ -98,7 +97,7 @@ export const List = chakra((props: React.PropsWithChildren<ListProps>) => {
|
|
|
98
97
|
* children are different HTML elements.
|
|
99
98
|
*/
|
|
100
99
|
const checkListChildrenError = (listType: ListTypes) => {
|
|
101
|
-
React.Children.map(children, (child: React.ReactElement) => {
|
|
100
|
+
React.Children.map(children as JSX.Element, (child: React.ReactElement) => {
|
|
102
101
|
if (child && child?.type !== "li" && child?.props?.mdxType !== "li") {
|
|
103
102
|
console.warn(
|
|
104
103
|
`NYPL Reservoir List: Direct children of \`List\` (${listType}) must be \`<li>\`s.`
|
|
@@ -111,7 +110,7 @@ export const List = chakra((props: React.PropsWithChildren<ListProps>) => {
|
|
|
111
110
|
* children are different HTML elements.
|
|
112
111
|
*/
|
|
113
112
|
const checkDescriptionChildrenError = () => {
|
|
114
|
-
React.Children.map(children,
|
|
113
|
+
React.Children.map(children as JSX.Element, (child: React.ReactElement) => {
|
|
115
114
|
if (
|
|
116
115
|
child.type !== "dt" &&
|
|
117
116
|
child.type !== "dd" &&
|
|
@@ -128,34 +127,24 @@ export const List = chakra((props: React.PropsWithChildren<ListProps>) => {
|
|
|
128
127
|
});
|
|
129
128
|
};
|
|
130
129
|
|
|
131
|
-
if (type ===
|
|
130
|
+
if (type === "ol" || type === "ul") {
|
|
132
131
|
checkListChildrenError(type);
|
|
133
132
|
listElement = (
|
|
134
133
|
<Box
|
|
135
134
|
as={type as As}
|
|
136
135
|
id={id}
|
|
137
136
|
className={className}
|
|
138
|
-
__css={
|
|
137
|
+
__css={styles}
|
|
139
138
|
{...rest}
|
|
140
139
|
>
|
|
141
140
|
{listChildrenElms(type)}
|
|
142
141
|
</Box>
|
|
143
142
|
);
|
|
144
|
-
} else if (type ===
|
|
143
|
+
} else if (type === "dl") {
|
|
145
144
|
checkDescriptionChildrenError();
|
|
146
145
|
listElement = (
|
|
147
|
-
<Box
|
|
148
|
-
|
|
149
|
-
id={id}
|
|
150
|
-
className={className}
|
|
151
|
-
__css={finalStyles}
|
|
152
|
-
{...rest}
|
|
153
|
-
>
|
|
154
|
-
{title && (
|
|
155
|
-
<Heading id={`${id}-heading`} level={HeadingLevels.Two}>
|
|
156
|
-
{title}
|
|
157
|
-
</Heading>
|
|
158
|
-
)}
|
|
146
|
+
<Box as="section" id={id} className={className} __css={styles} {...rest}>
|
|
147
|
+
{title && <Heading id={`${id}-heading`}>{title}</Heading>}
|
|
159
148
|
<dl>{listChildrenElms(type)}</dl>
|
|
160
149
|
</Box>
|
|
161
150
|
);
|
|
@@ -8,18 +8,11 @@ import {
|
|
|
8
8
|
import { withDesign } from "storybook-addon-designs";
|
|
9
9
|
|
|
10
10
|
import Logo from "./Logo";
|
|
11
|
-
import { LogoNames, LogoSizes } from "./LogoTypes";
|
|
12
11
|
import logoSvgs from "./LogoSvgs";
|
|
13
12
|
import Heading from "../Heading/Heading";
|
|
14
|
-
import { HeadingLevels } from "../Heading/HeadingTypes";
|
|
15
13
|
import List from "../List/List";
|
|
16
|
-
import { ListTypes } from "../List/ListTypes";
|
|
17
14
|
import SimpleGrid from "../Grid/SimpleGrid";
|
|
18
15
|
import { getCategory } from "../../utils/componentCategories";
|
|
19
|
-
import { getStorybookEnumValues } from "../../utils/utils";
|
|
20
|
-
|
|
21
|
-
export const namesEnumValues = getStorybookEnumValues(LogoNames, "LogoNames");
|
|
22
|
-
export const sizesEnumValues = getStorybookEnumValues(LogoSizes, "LogoSizes");
|
|
23
16
|
|
|
24
17
|
<Meta
|
|
25
18
|
title={getCategory("Logo")}
|
|
@@ -36,14 +29,8 @@ export const sizesEnumValues = getStorybookEnumValues(LogoSizes, "LogoSizes");
|
|
|
36
29
|
children: { table: { disable: true } },
|
|
37
30
|
className: { control: false },
|
|
38
31
|
id: { control: false },
|
|
39
|
-
name: {
|
|
40
|
-
control: { type: "select" },
|
|
41
|
-
options: namesEnumValues.options,
|
|
42
|
-
},
|
|
43
32
|
size: {
|
|
44
|
-
|
|
45
|
-
table: { defaultValue: { summary: "LogoSizes.Medium" } },
|
|
46
|
-
options: sizesEnumValues.options,
|
|
33
|
+
table: { defaultValue: { summary: "medium" } },
|
|
47
34
|
},
|
|
48
35
|
title: {
|
|
49
36
|
control: false,
|
|
@@ -57,7 +44,7 @@ export const sizesEnumValues = getStorybookEnumValues(LogoSizes, "LogoSizes");
|
|
|
57
44
|
| Component Version | DS Version |
|
|
58
45
|
| ----------------- | ---------- |
|
|
59
46
|
| Added | `0.25.9` |
|
|
60
|
-
| Latest | `0.
|
|
47
|
+
| Latest | `0.28.0` |
|
|
61
48
|
|
|
62
49
|
## Table of Contents
|
|
63
50
|
|
|
@@ -78,20 +65,19 @@ export const sizesEnumValues = getStorybookEnumValues(LogoSizes, "LogoSizes");
|
|
|
78
65
|
<Story
|
|
79
66
|
name="Logo with Controls"
|
|
80
67
|
args={{
|
|
81
|
-
additionalStyles: undefined,
|
|
82
68
|
className: undefined,
|
|
83
69
|
decorative: true,
|
|
84
70
|
id: "logo-id",
|
|
85
|
-
name: "
|
|
86
|
-
size: "
|
|
71
|
+
name: "nyplFullBlack",
|
|
72
|
+
size: "large",
|
|
87
73
|
title: undefined,
|
|
88
74
|
}}
|
|
89
75
|
>
|
|
90
76
|
{(args) => (
|
|
91
77
|
<div
|
|
92
78
|
style={
|
|
93
|
-
args.name.indexOf("
|
|
94
|
-
args.name.indexOf("
|
|
79
|
+
args.name.indexOf("white") !== -1 ||
|
|
80
|
+
args.name.indexOf("negative") !== -1
|
|
95
81
|
? {
|
|
96
82
|
backgroundColor: "var(--nypl-colors-ui-gray-xdark)",
|
|
97
83
|
display: "inline-block",
|
|
@@ -101,11 +87,7 @@ export const sizesEnumValues = getStorybookEnumValues(LogoSizes, "LogoSizes");
|
|
|
101
87
|
: undefined
|
|
102
88
|
}
|
|
103
89
|
>
|
|
104
|
-
<Logo
|
|
105
|
-
name={namesEnumValues.getValue(args.name)}
|
|
106
|
-
size={sizesEnumValues.getValue(args.size)}
|
|
107
|
-
title={args.title}
|
|
108
|
-
/>
|
|
90
|
+
<Logo {...args} />
|
|
109
91
|
</div>
|
|
110
92
|
)}
|
|
111
93
|
</Story>
|
|
@@ -117,7 +99,7 @@ export const logoRow = (logo, opts = {}) => {
|
|
|
117
99
|
// We'll use this setup function to render all the logos in a list item.
|
|
118
100
|
// Some logos display better with a dark background.
|
|
119
101
|
const styles = { textAlign: "center" };
|
|
120
|
-
const { size =
|
|
102
|
+
const { size = "large", displayValue } = opts;
|
|
121
103
|
let key = logo;
|
|
122
104
|
if (logo.indexOf("White") !== -1 || logo.indexOf("Negative") !== -1) {
|
|
123
105
|
styles.backgroundColor = "var(--nypl-colors-ui-gray-xdark)";
|
|
@@ -125,26 +107,77 @@ export const logoRow = (logo, opts = {}) => {
|
|
|
125
107
|
styles.paddingBottom = "var(--nypl-space-l)";
|
|
126
108
|
styles.paddingTop = "var(--nypl-space-l)";
|
|
127
109
|
}
|
|
128
|
-
if (size !==
|
|
110
|
+
if (size !== "large") {
|
|
129
111
|
key += `-${size}`;
|
|
130
112
|
}
|
|
131
113
|
return (
|
|
132
114
|
<div style={styles} key={key}>
|
|
133
|
-
<Heading level=
|
|
134
|
-
<Logo name={
|
|
115
|
+
<Heading level="four">{displayValue}</Heading>
|
|
116
|
+
<Logo name={logo} size={size} />
|
|
135
117
|
</div>
|
|
136
118
|
);
|
|
137
119
|
};
|
|
138
120
|
export const logos = [];
|
|
139
121
|
export const sizes = [];
|
|
140
|
-
|
|
141
|
-
|
|
122
|
+
export const logoNameValues = [
|
|
123
|
+
"bplBlack",
|
|
124
|
+
"bplWhite",
|
|
125
|
+
"cleverColor",
|
|
126
|
+
"cleverWhite",
|
|
127
|
+
"firstbookColor",
|
|
128
|
+
"firstbookColorNegative",
|
|
129
|
+
"lpaColor",
|
|
130
|
+
"lpaBlack",
|
|
131
|
+
"lpaWhite",
|
|
132
|
+
"mlnBlack",
|
|
133
|
+
"mlnWhite",
|
|
134
|
+
"nyplFullBlack",
|
|
135
|
+
"nyplFullWhite",
|
|
136
|
+
"nyplLionBlack",
|
|
137
|
+
"nyplLionWhite",
|
|
138
|
+
"openebooksColor",
|
|
139
|
+
"openebooksNegative",
|
|
140
|
+
"openebooksWithTextColor",
|
|
141
|
+
"openebooksWithTextNegative",
|
|
142
|
+
"qplColor",
|
|
143
|
+
"qplBlack",
|
|
144
|
+
"qplWhite",
|
|
145
|
+
"qplAltBlack",
|
|
146
|
+
"qplAltWhite",
|
|
147
|
+
"reservoirIconColor",
|
|
148
|
+
"reservoirVerticalColor",
|
|
149
|
+
"schomburgColor",
|
|
150
|
+
"schomburgBlack",
|
|
151
|
+
"schomburgWhite",
|
|
152
|
+
"schomburgCircleColor",
|
|
153
|
+
"schomburgCircleBlack",
|
|
154
|
+
"schomburgCircleWhite",
|
|
155
|
+
"simplyeColor",
|
|
156
|
+
"simplyeBlack",
|
|
157
|
+
"simplyeWhite",
|
|
158
|
+
"snflBlack",
|
|
159
|
+
"snflWhite",
|
|
160
|
+
"treasuresColor",
|
|
161
|
+
"treasuresColorNegative",
|
|
162
|
+
];
|
|
163
|
+
export const logoSizeValues = [
|
|
164
|
+
"default",
|
|
165
|
+
"xxsmall",
|
|
166
|
+
"xsmall",
|
|
167
|
+
"small",
|
|
168
|
+
"medium",
|
|
169
|
+
"large",
|
|
170
|
+
];
|
|
171
|
+
for (const logo in logoNameValues) {
|
|
172
|
+
logos.push(
|
|
173
|
+
logoRow(logoNameValues[logo], { displayValue: logoNameValues[logo] })
|
|
174
|
+
);
|
|
142
175
|
}
|
|
143
|
-
for (const logoSize in
|
|
176
|
+
for (const logoSize in logoSizeValues) {
|
|
144
177
|
sizes.push(
|
|
145
|
-
logoRow("
|
|
146
|
-
displayValue:
|
|
147
|
-
size:
|
|
178
|
+
logoRow("nyplFullBlack", {
|
|
179
|
+
displayValue: logoSizeValues[logoSize],
|
|
180
|
+
size: logoSizeValues[logoSize],
|
|
148
181
|
})
|
|
149
182
|
);
|
|
150
183
|
}
|
|
@@ -155,11 +188,11 @@ export const allLogosGrid = (list) => (
|
|
|
155
188
|
|
|
156
189
|
## Accessibility
|
|
157
190
|
|
|
158
|
-
For accessibility purposes, every Reservoir Design System (DS) `Logo` will
|
|
159
|
-
render the `svg` element with its `svg` file name in the `title` element. The
|
|
160
|
-
default text in the `title` element is the logo's code name. Pass in better
|
|
161
|
-
descriptive text in the `title` prop when using the `Logo` component in your
|
|
162
|
-
application. This will give screenreaders a better descriptive title for the
|
|
191
|
+
For accessibility purposes, every Reservoir Design System (DS) `Logo` will
|
|
192
|
+
render the `svg` element with its `svg` file name in the `title` element. The
|
|
193
|
+
default text in the `title` element is the logo's code name. Pass in better
|
|
194
|
+
descriptive text in the `title` prop when using the `Logo` component in your
|
|
195
|
+
application. This will give screenreaders a better descriptive title for the
|
|
163
196
|
`svg` graphic.
|
|
164
197
|
|
|
165
198
|
`Logos`s are decorative by default. This means that they are presentational and
|
|
@@ -174,15 +207,16 @@ Resources:
|
|
|
174
207
|
|
|
175
208
|
## Logo Sizes
|
|
176
209
|
|
|
177
|
-
Update the size of the `Logo` component by passing the `size` prop with a value
|
|
178
|
-
|
|
210
|
+
Update the size of the `Logo` component by passing the `size` prop with a value
|
|
211
|
+
from the `LogoSizes` type. The values are `"default"`, `"xxsmall"`, `"xsmall"`,
|
|
212
|
+
`"small"`, `"medium"`, and `"large"`.
|
|
179
213
|
|
|
180
|
-
Note: `
|
|
214
|
+
Note: `"default"` sets the width to `100%` and the rendered logo will expand to
|
|
181
215
|
fill the full width of the parent element.
|
|
182
216
|
|
|
183
217
|
```jsx
|
|
184
218
|
// Example
|
|
185
|
-
<Logo name=
|
|
219
|
+
<Logo name="nyplFullBlack" size="large" />
|
|
186
220
|
```
|
|
187
221
|
|
|
188
222
|
<Canvas>
|
|
@@ -191,11 +225,21 @@ fill the full width of the parent element.
|
|
|
191
225
|
|
|
192
226
|
## All Logos
|
|
193
227
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
228
|
+
Update the icon of the `Logo` component by passing the `name` prop with a value
|
|
229
|
+
from the `LogoNames` type. The values are `"bplBlack"`, `"bplWhite"`,
|
|
230
|
+
`"cleverColor"`, `"cleverWhite"`, `"firstbookColor"`, `"firstbookColorNegative"`,
|
|
231
|
+
`"lpaBlack"`, `"lpaColor"`, `"lpaWhite"`, `"mlnBlack"`, `"mlnWhite"`,
|
|
232
|
+
`"nyplFullBlack"`, `"nyplFullWhite"`, `"nyplLionBlack"`, `"nyplLionWhite"`,
|
|
233
|
+
`"openebooksColor"`, `"openebooksNegative"`, `"openebooksWithTextColor"`,
|
|
234
|
+
`"openebooksWithTextNegative"`, `"qplAltBlack"`, `"qplAltWhite"`, `"qplBlack"`,
|
|
235
|
+
`"qplColor"`, `"qplWhite"`, `"reservoirIconColor"`, `"reservoirVerticalColor"`,
|
|
236
|
+
`"schomburgBlack"`, `"schomburgCircleBlack"`, `"schomburgCircleColor"`,
|
|
237
|
+
`"schomburgCircleWhite"`, `"schomburgColor"`, `"schomburgWhite"`, `"simplyeBlack"`,
|
|
238
|
+
`"simplyeWhite"`, `"simplyeColor"`, `"snflBlack"`, `"snflWhite"`, `"treasuresColor"`,
|
|
239
|
+
`"treasuresColorNegative"`.
|
|
240
|
+
|
|
241
|
+
If you feel a necessary logo should be added to the `Logo` component, please
|
|
242
|
+
reach out to the DS team.
|
|
199
243
|
|
|
200
244
|
<Canvas withToolbar>
|
|
201
245
|
<Story name="All Logos">{allLogosGrid(logos)}</Story>
|
|
@@ -225,7 +269,7 @@ child to the `Logo` component.
|
|
|
225
269
|
<Story
|
|
226
270
|
name="Custom Logos"
|
|
227
271
|
args={{
|
|
228
|
-
size:
|
|
272
|
+
size: "large",
|
|
229
273
|
}}
|
|
230
274
|
>
|
|
231
275
|
{(args) => (
|
|
@@ -4,11 +4,10 @@ import { axe } from "jest-axe";
|
|
|
4
4
|
import renderer from "react-test-renderer";
|
|
5
5
|
|
|
6
6
|
import Logo from "./Logo";
|
|
7
|
-
import { LogoNames, LogoSizes } from "./LogoTypes";
|
|
8
7
|
|
|
9
8
|
describe("Logo Accessibility", () => {
|
|
10
9
|
it("passes axe accessibility test", async () => {
|
|
11
|
-
const { container } = render(<Logo name=
|
|
10
|
+
const { container } = render(<Logo name="nyplFullBlack" />);
|
|
12
11
|
expect(await axe(container)).toHaveNoViolations();
|
|
13
12
|
});
|
|
14
13
|
});
|
|
@@ -17,7 +16,7 @@ describe("Logo", () => {
|
|
|
17
16
|
it("consoles a warning if both name and children are passed to Logo", () => {
|
|
18
17
|
const warn = jest.spyOn(console, "warn");
|
|
19
18
|
render(
|
|
20
|
-
<Logo name=
|
|
19
|
+
<Logo name="nyplFullBlack">
|
|
21
20
|
<svg viewBox="0 0 24 14" xmlns="http://www.w3.org/2000/svg">
|
|
22
21
|
<path
|
|
23
22
|
fillRule="evenodd"
|
|
@@ -51,7 +50,7 @@ describe("Logo", () => {
|
|
|
51
50
|
});
|
|
52
51
|
|
|
53
52
|
it("renders a logo based on the logo `name` prop", () => {
|
|
54
|
-
const { container } = render(<Logo name=
|
|
53
|
+
const { container } = render(<Logo name="nyplFullBlack" />);
|
|
55
54
|
expect(container.querySelector("svg")).toBeInTheDocument();
|
|
56
55
|
});
|
|
57
56
|
|
|
@@ -60,13 +59,13 @@ describe("Logo", () => {
|
|
|
60
59
|
// In order to test this, we can check the `title` attribute in the svg
|
|
61
60
|
// element itself. Inspect the `Logo` in Storybook to see the `title` element.
|
|
62
61
|
it("renders a title element", () => {
|
|
63
|
-
const { container, rerender } = render(<Logo name=
|
|
62
|
+
const { container, rerender } = render(<Logo name="nyplFullBlack" />);
|
|
64
63
|
expect(container.querySelector("svg")).toHaveAttribute(
|
|
65
64
|
"title",
|
|
66
|
-
"
|
|
65
|
+
"nyplFullBlack logo"
|
|
67
66
|
);
|
|
68
67
|
|
|
69
|
-
rerender(<Logo name=
|
|
68
|
+
rerender(<Logo name="nyplFullBlack" title="title content" />);
|
|
70
69
|
expect(container.querySelector("svg")).toHaveAttribute(
|
|
71
70
|
"title",
|
|
72
71
|
"title content"
|
|
@@ -90,31 +89,23 @@ describe("Logo", () => {
|
|
|
90
89
|
|
|
91
90
|
it("renders the UI snapshot correctly", () => {
|
|
92
91
|
const standard = renderer
|
|
93
|
-
.create(<Logo id="test-logo" name=
|
|
92
|
+
.create(<Logo id="test-logo" name="nyplFullBlack" />)
|
|
94
93
|
.toJSON();
|
|
95
94
|
const withCustomSize = renderer
|
|
96
|
-
.create(
|
|
97
|
-
<Logo
|
|
98
|
-
id="test-logo-size"
|
|
99
|
-
name={LogoNames.NYPLBlack}
|
|
100
|
-
size={LogoSizes.Large}
|
|
101
|
-
/>
|
|
102
|
-
)
|
|
95
|
+
.create(<Logo id="test-logo-size" name="nyplFullBlack" size="large" />)
|
|
103
96
|
.toJSON();
|
|
104
97
|
const withChakraProps = renderer
|
|
105
98
|
.create(
|
|
106
99
|
<Logo
|
|
107
100
|
id="chakra"
|
|
108
|
-
name=
|
|
101
|
+
name="nyplFullBlack"
|
|
109
102
|
p="20px"
|
|
110
103
|
color="ui.error.primary"
|
|
111
104
|
/>
|
|
112
105
|
)
|
|
113
106
|
.toJSON();
|
|
114
107
|
const withOtherProps = renderer
|
|
115
|
-
.create(
|
|
116
|
-
<Logo id="props" name={LogoNames.NYPLBlack} data-testid="props" />
|
|
117
|
-
)
|
|
108
|
+
.create(<Logo id="props" name="nyplFullBlack" data-testid="props" />)
|
|
118
109
|
.toJSON();
|
|
119
110
|
|
|
120
111
|
expect(standard).toMatchSnapshot();
|
|
@@ -6,12 +6,56 @@ import {
|
|
|
6
6
|
} from "@chakra-ui/react";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
|
|
9
|
-
import { LogoNames, LogoSizes } from "./LogoTypes";
|
|
10
9
|
import logoSvgs from "./LogoSvgs";
|
|
11
10
|
|
|
11
|
+
export type LogoNames =
|
|
12
|
+
| "bplBlack"
|
|
13
|
+
| "bplWhite"
|
|
14
|
+
| "cleverColor"
|
|
15
|
+
| "cleverWhite"
|
|
16
|
+
| "firstbookColor"
|
|
17
|
+
| "firstbookColorNegative"
|
|
18
|
+
| "lpaBlack"
|
|
19
|
+
| "lpaColor"
|
|
20
|
+
| "lpaWhite"
|
|
21
|
+
| "mlnBlack"
|
|
22
|
+
| "mlnWhite"
|
|
23
|
+
| "nyplFullBlack"
|
|
24
|
+
| "nyplFullWhite"
|
|
25
|
+
| "nyplLionBlack"
|
|
26
|
+
| "nyplLionWhite"
|
|
27
|
+
| "openebooksColor"
|
|
28
|
+
| "openebooksNegative"
|
|
29
|
+
| "openebooksWithTextColor"
|
|
30
|
+
| "openebooksWithTextNegative"
|
|
31
|
+
| "qplAltBlack"
|
|
32
|
+
| "qplAltWhite"
|
|
33
|
+
| "qplBlack"
|
|
34
|
+
| "qplColor"
|
|
35
|
+
| "qplWhite"
|
|
36
|
+
| "reservoirIconColor"
|
|
37
|
+
| "reservoirVerticalColor"
|
|
38
|
+
| "schomburgBlack"
|
|
39
|
+
| "schomburgCircleBlack"
|
|
40
|
+
| "schomburgCircleColor"
|
|
41
|
+
| "schomburgCircleWhite"
|
|
42
|
+
| "schomburgColor"
|
|
43
|
+
| "schomburgWhite"
|
|
44
|
+
| "simplyeBlack"
|
|
45
|
+
| "simplyeWhite"
|
|
46
|
+
| "simplyeColor"
|
|
47
|
+
| "snflBlack"
|
|
48
|
+
| "snflWhite"
|
|
49
|
+
| "treasuresColor"
|
|
50
|
+
| "treasuresColorNegative";
|
|
51
|
+
export type LogoSizes =
|
|
52
|
+
| "default"
|
|
53
|
+
| "xxsmall"
|
|
54
|
+
| "xsmall"
|
|
55
|
+
| "small"
|
|
56
|
+
| "medium"
|
|
57
|
+
| "large";
|
|
12
58
|
export interface LogoProps {
|
|
13
|
-
/** Optionally pass in additional Chakra-based styles. */
|
|
14
|
-
additionalStyles?: { [key: string]: any };
|
|
15
59
|
/** Optional className that will be added to the parent element */
|
|
16
60
|
className?: string;
|
|
17
61
|
/** Logos designated as decorative will be ignored by screenreaders. False
|
|
@@ -35,13 +79,12 @@ export interface LogoProps {
|
|
|
35
79
|
*/
|
|
36
80
|
export const Logo = chakra((props: React.PropsWithChildren<LogoProps>) => {
|
|
37
81
|
const {
|
|
38
|
-
additionalStyles = {},
|
|
39
82
|
children,
|
|
40
83
|
className,
|
|
41
84
|
decorative = false,
|
|
42
85
|
id,
|
|
43
86
|
name,
|
|
44
|
-
size =
|
|
87
|
+
size = "medium",
|
|
45
88
|
title = `${name} logo`,
|
|
46
89
|
...rest
|
|
47
90
|
} = props;
|
|
@@ -78,13 +121,7 @@ export const Logo = chakra((props: React.PropsWithChildren<LogoProps>) => {
|
|
|
78
121
|
// render the SVG child with NYPL-theme styling.
|
|
79
122
|
if (name) {
|
|
80
123
|
const SvgComponent: any = logoSvgs[name];
|
|
81
|
-
return
|
|
82
|
-
<ChakraIcon
|
|
83
|
-
as={SvgComponent}
|
|
84
|
-
{...logoProps}
|
|
85
|
-
__css={{ ...styles, ...additionalStyles }}
|
|
86
|
-
/>
|
|
87
|
-
);
|
|
124
|
+
return <ChakraIcon as={SvgComponent} {...logoProps} __css={styles} />;
|
|
88
125
|
}
|
|
89
126
|
|
|
90
127
|
// If no `name` prop was passed, we expect a child SVG element to be passed.
|
|
@@ -104,11 +141,7 @@ export const Logo = chakra((props: React.PropsWithChildren<LogoProps>) => {
|
|
|
104
141
|
);
|
|
105
142
|
}
|
|
106
143
|
|
|
107
|
-
return
|
|
108
|
-
<Box __css={styles} {...rest}>
|
|
109
|
-
{childSVG}
|
|
110
|
-
</Box>
|
|
111
|
-
);
|
|
144
|
+
return <Box __css={styles}>{childSVG}</Box>;
|
|
112
145
|
});
|
|
113
146
|
|
|
114
147
|
export default Logo;
|