@nypl/design-system-react-components 0.25.12 → 0.25.13
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 +63 -1
- package/dist/components/Accordion/Accordion.d.ts +5 -3
- package/dist/components/Accordion/AccordionTypes.d.ts +5 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +3 -3
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -1
- package/dist/components/Card/Card.d.ts +11 -20
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +4 -2
- package/dist/components/Heading/Heading.d.ts +4 -4
- package/dist/components/Heading/HeadingTypes.d.ts +1 -1
- package/dist/components/Hero/Hero.d.ts +7 -4
- package/dist/components/Icons/IconTypes.d.ts +1 -0
- package/dist/components/Image/Image.d.ts +25 -7
- package/dist/components/Image/ImageTypes.d.ts +4 -4
- package/dist/components/Logo/LogoTypes.d.ts +2 -2
- package/dist/components/Notification/Notification.d.ts +4 -4
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +4 -2
- package/dist/components/Select/Select.d.ts +2 -2
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -3
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -4
- package/dist/components/StructuredContent/StructuredContent.d.ts +9 -22
- package/dist/components/Tabs/Tabs.d.ts +3 -3
- package/dist/components/Template/Template.d.ts +13 -5
- package/dist/components/Text/Text.d.ts +3 -3
- package/dist/components/Text/TextTypes.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +2 -2
- package/dist/components/Toggle/Toggle.d.ts +6 -7
- package/dist/components/Toggle/{ToggleSizes.d.ts → ToggleTypes.d.ts} +1 -1
- package/dist/design-system-react-components.cjs.development.js +505 -422
- 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 +514 -435
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/helpers/enums.d.ts +4 -0
- package/dist/index.d.ts +7 -8
- package/dist/theme/components/accordion.d.ts +7 -12
- package/dist/theme/components/breadcrumb.d.ts +3 -0
- package/dist/theme/components/card.d.ts +4 -4
- package/dist/theme/components/checkbox.d.ts +1 -0
- package/dist/theme/components/checkboxGroup.d.ts +3 -1
- package/dist/theme/components/global.d.ts +2 -1
- package/dist/theme/components/hero.d.ts +1 -1
- package/dist/theme/components/image.d.ts +1 -1
- package/dist/theme/components/notification.d.ts +4 -4
- package/dist/theme/components/pagination.d.ts +2 -5
- package/dist/theme/components/radio.d.ts +1 -0
- package/dist/theme/components/radioGroup.d.ts +3 -1
- package/dist/theme/components/select.d.ts +3 -0
- package/dist/theme/components/toggle.d.ts +13 -1
- package/package.json +1 -1
- package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +34 -0
- package/src/components/Accordion/Accordion.stories.mdx +150 -66
- package/src/components/Accordion/Accordion.test.tsx +44 -17
- package/src/components/Accordion/Accordion.tsx +50 -20
- package/src/components/Accordion/AccordionTypes.tsx +5 -0
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +244 -2
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +17 -15
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +6 -6
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +6 -6
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -1
- package/src/components/Card/Card.stories.mdx +236 -165
- package/src/components/Card/Card.test.tsx +36 -18
- package/src/components/Card/Card.tsx +84 -59
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +25 -65
- package/src/components/Chakra/Center.stories.mdx +2 -2
- package/src/components/Checkbox/Checkbox.stories.mdx +13 -1
- package/src/components/Checkbox/Checkbox.test.tsx +58 -2
- package/src/components/Checkbox/Checkbox.tsx +6 -1
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +76 -0
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +73 -9
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +79 -9
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +10 -7
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +169 -0
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +1 -1
- package/src/components/DatePicker/DatePicker.test.tsx +5 -2
- package/src/components/DatePicker/DatePicker.tsx +5 -2
- package/src/components/Form/Form.stories.mdx +47 -9
- package/src/components/Form/Form.test.tsx +1 -1
- package/src/components/Form/Form.tsx +3 -1
- package/src/components/Grid/SimpleGrid.stories.mdx +53 -35
- package/src/components/Grid/SimpleGrid.test.tsx +15 -9
- package/src/components/Heading/Heading.stories.mdx +21 -23
- package/src/components/Heading/Heading.test.tsx +7 -7
- package/src/components/Heading/Heading.tsx +10 -14
- package/src/components/Heading/HeadingTypes.tsx +1 -1
- package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +1 -1
- package/src/components/Hero/Hero.stories.mdx +27 -27
- package/src/components/Hero/Hero.test.tsx +113 -58
- package/src/components/Hero/Hero.tsx +43 -20
- package/src/components/HorizontalRule/HorizontalRule.test.tsx +6 -4
- package/src/components/HorizontalRule/HorizontalRule.tsx +3 -2
- package/src/components/Icons/Icon.stories.mdx +50 -18
- package/src/components/Icons/Icon.test.tsx +13 -2
- package/src/components/Icons/Icon.tsx +11 -6
- package/src/components/Icons/IconTypes.tsx +1 -0
- package/src/components/Image/Image.stories.mdx +133 -68
- package/src/components/Image/Image.test.tsx +32 -48
- package/src/components/Image/Image.tsx +46 -26
- package/src/components/Image/ImageTypes.ts +4 -4
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +60 -13
- package/src/components/Link/Link.tsx +8 -1
- package/src/components/List/List.stories.mdx +1 -1
- package/src/components/List/List.test.tsx +7 -4
- package/src/components/List/List.tsx +7 -4
- package/src/components/Logo/Logo.stories.mdx +13 -13
- package/src/components/Logo/Logo.test.tsx +12 -2
- package/src/components/Logo/Logo.tsx +10 -5
- package/src/components/Logo/LogoTypes.tsx +1 -1
- package/src/components/Notification/Notification.stories.mdx +5 -5
- package/src/components/Notification/Notification.tsx +10 -10
- package/src/components/Pagination/Pagination.stories.mdx +4 -3
- package/src/components/Pagination/Pagination.test.tsx +30 -2
- package/src/components/Pagination/Pagination.tsx +6 -3
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +1 -1
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +6 -2
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +3 -1
- package/src/components/Radio/Radio.stories.mdx +13 -1
- package/src/components/Radio/Radio.test.tsx +56 -2
- package/src/components/Radio/Radio.tsx +6 -1
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +61 -0
- package/src/components/RadioGroup/RadioGroup.stories.mdx +73 -9
- package/src/components/RadioGroup/RadioGroup.test.tsx +72 -7
- package/src/components/RadioGroup/RadioGroup.tsx +10 -7
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +140 -0
- package/src/components/SearchBar/SearchBar.stories.mdx +1 -1
- package/src/components/SearchBar/SearchBar.tsx +3 -3
- package/src/components/Select/Select.stories.mdx +26 -16
- package/src/components/Select/Select.test.tsx +1 -36
- package/src/components/Select/Select.tsx +4 -16
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +12 -14
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +6 -8
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +5 -7
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
- package/src/components/Slider/Slider.stories.mdx +41 -8
- package/src/components/Slider/Slider.tsx +4 -4
- package/src/components/StatusBadge/StatusBadge.test.tsx +3 -1
- package/src/components/StatusBadge/StatusBadge.tsx +1 -1
- package/src/components/StructuredContent/StructuredContent.stories.mdx +103 -54
- package/src/components/StructuredContent/StructuredContent.test.tsx +129 -102
- package/src/components/StructuredContent/StructuredContent.tsx +43 -53
- package/src/components/StyleGuide/ColorCard.tsx +3 -3
- package/src/components/StyleGuide/Typography.stories.mdx +17 -12
- package/src/components/Table/Table.test.tsx +1 -1
- package/src/components/Table/Table.tsx +3 -1
- package/src/components/Tabs/Tabs.stories.mdx +8 -8
- package/src/components/Tabs/Tabs.test.tsx +13 -11
- package/src/components/Tabs/Tabs.tsx +18 -15
- package/src/components/Template/Template.stories.mdx +62 -25
- package/src/components/Template/Template.test.tsx +35 -5
- package/src/components/Template/Template.tsx +26 -13
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +4 -2
- package/src/components/Text/Text.stories.mdx +13 -15
- package/src/components/Text/Text.test.tsx +6 -15
- package/src/components/Text/Text.tsx +7 -12
- package/src/components/Text/TextTypes.tsx +1 -1
- package/src/components/TextInput/TextInput.stories.mdx +9 -9
- package/src/components/TextInput/TextInput.test.tsx +28 -27
- package/src/components/TextInput/TextInput.tsx +4 -4
- package/src/components/Toggle/Toggle.stories.mdx +12 -22
- package/src/components/Toggle/Toggle.test.tsx +15 -2
- package/src/components/Toggle/Toggle.tsx +8 -9
- package/src/components/Toggle/{ToggleSizes.tsx → ToggleTypes.tsx} +1 -1
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +64 -0
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -6
- package/src/components/VideoPlayer/VideoPlayer.tsx +14 -7
- package/src/docs/{Intro.stories.mdx → Welcome.stories.mdx} +5 -9
- package/src/{components/Card/CardTypes.tsx → helpers/enums.ts} +2 -2
- package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
- package/src/hooks/useCarouselStyles.stories.mdx +10 -0
- package/src/hooks/useNYPLTheme.ts +1 -1
- package/src/index.ts +7 -14
- package/src/theme/components/accordion.ts +7 -12
- package/src/theme/components/breadcrumb.ts +3 -0
- package/src/theme/components/card.ts +29 -20
- package/src/theme/components/checkboxGroup.ts +3 -1
- package/src/theme/components/global.ts +4 -3
- package/src/theme/components/hero.ts +1 -1
- package/src/theme/components/icon.ts +5 -2
- package/src/theme/components/image.ts +1 -1
- package/src/theme/components/list.ts +1 -1
- package/src/theme/components/notification.ts +5 -5
- package/src/theme/components/pagination.ts +2 -5
- package/src/theme/components/progressIndicator.ts +3 -3
- package/src/theme/components/radioGroup.ts +3 -1
- package/src/theme/components/select.ts +6 -0
- package/src/theme/components/toggle.ts +26 -3
- package/src/utils/componentCategories.ts +27 -19
- package/dist/components/Card/CardTypes.d.ts +0 -4
- package/dist/components/CheckboxGroup/CheckboxGroupLayoutTypes.d.ts +0 -4
- package/dist/components/RadioGroup/RadioGroupLayoutTypes.d.ts +0 -4
- package/src/components/CheckboxGroup/CheckboxGroupLayoutTypes.tsx +0 -4
- package/src/components/RadioGroup/RadioGroupLayoutTypes.tsx +0 -4
|
@@ -181,17 +181,20 @@ describe("VideoPlayer", () => {
|
|
|
181
181
|
|
|
182
182
|
render(<VideoPlayer />);
|
|
183
183
|
expect(warn).toHaveBeenCalledWith(
|
|
184
|
-
"VideoPlayer
|
|
184
|
+
"NYPL Reservoir VideoPlayer: Pass in either the `embedCode` prop or " +
|
|
185
|
+
"both the `videoType` and `videoId` props; none were passed."
|
|
185
186
|
);
|
|
186
187
|
|
|
187
188
|
render(<VideoPlayer videoId="http://vimeo.com/474719268" />);
|
|
188
189
|
expect(warn).toHaveBeenCalledWith(
|
|
189
|
-
"
|
|
190
|
+
"NYPL Reservoir VideoPlayer: The `videoType` prop is also required. " +
|
|
191
|
+
"Only the `videoId` prop was set."
|
|
190
192
|
);
|
|
191
193
|
|
|
192
194
|
render(<VideoPlayer videoType={VideoPlayerTypes.Vimeo} />);
|
|
193
195
|
expect(warn).toHaveBeenCalledWith(
|
|
194
|
-
"
|
|
196
|
+
"NYPL Reservoir VideoPlayer: The `videoId` prop is also required. " +
|
|
197
|
+
"Only the `videoType` prop was set."
|
|
195
198
|
);
|
|
196
199
|
|
|
197
200
|
render(
|
|
@@ -202,7 +205,8 @@ describe("VideoPlayer", () => {
|
|
|
202
205
|
/>
|
|
203
206
|
);
|
|
204
207
|
expect(warn).toHaveBeenCalledWith(
|
|
205
|
-
"VideoPlayer
|
|
208
|
+
"NYPL Reservoir VideoPlayer: Pass in either the `embedCode` prop or " +
|
|
209
|
+
"both the `videoType` and `videoId` props; all were set."
|
|
206
210
|
);
|
|
207
211
|
|
|
208
212
|
render(
|
|
@@ -212,7 +216,8 @@ describe("VideoPlayer", () => {
|
|
|
212
216
|
/>
|
|
213
217
|
);
|
|
214
218
|
expect(warn).toHaveBeenCalledWith(
|
|
215
|
-
"VideoPlayer
|
|
219
|
+
"NYPL Reservoir VideoPlayer: Pass in either the `embedCode` prop or " +
|
|
220
|
+
"both the `videoType` and `videoId` props; all were set."
|
|
216
221
|
);
|
|
217
222
|
|
|
218
223
|
render(
|
|
@@ -222,7 +227,14 @@ describe("VideoPlayer", () => {
|
|
|
222
227
|
/>
|
|
223
228
|
);
|
|
224
229
|
expect(warn).toHaveBeenCalledWith(
|
|
225
|
-
"VideoPlayer
|
|
230
|
+
"NYPL Reservoir VideoPlayer: Pass in either the `embedCode` prop or " +
|
|
231
|
+
"both the `videoType` and `videoId` props; all were set."
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
const embedCode = `<iframe src="https://player./video/421404144?h=5467db7edd"></iframe>`;
|
|
235
|
+
render(<VideoPlayer embedCode={embedCode} />);
|
|
236
|
+
expect(warn).toHaveBeenCalledWith(
|
|
237
|
+
"NYPL Reservoir VideoPlayer: The `embedCode` prop is not configured properly."
|
|
226
238
|
);
|
|
227
239
|
});
|
|
228
240
|
});
|
|
@@ -78,27 +78,32 @@ export default function VideoPlayer(
|
|
|
78
78
|
: embedCode;
|
|
79
79
|
|
|
80
80
|
const errorMessage =
|
|
81
|
-
"<strong>Error:</strong> This video player has not been configured
|
|
81
|
+
"<strong>Error:</strong> This video player has not been configured " +
|
|
82
|
+
"properly. Please contact the site administrator.";
|
|
82
83
|
|
|
83
84
|
let isInvalid = false;
|
|
84
85
|
if (!embedCodeFinal && !videoType && !videoId) {
|
|
85
86
|
console.warn(
|
|
86
|
-
"VideoPlayer
|
|
87
|
+
"NYPL Reservoir VideoPlayer: Pass in either the `embedCode` prop or " +
|
|
88
|
+
"both the `videoType` and `videoId` props; none were passed."
|
|
87
89
|
);
|
|
88
90
|
isInvalid = true;
|
|
89
91
|
} else if (!embedCodeFinal && !videoType) {
|
|
90
92
|
console.warn(
|
|
91
|
-
"
|
|
93
|
+
"NYPL Reservoir VideoPlayer: The `videoType` prop is also required. " +
|
|
94
|
+
"Only the `videoId` prop was set."
|
|
92
95
|
);
|
|
93
96
|
isInvalid = true;
|
|
94
97
|
} else if (!embedCodeFinal && !videoId) {
|
|
95
98
|
console.warn(
|
|
96
|
-
"
|
|
99
|
+
"NYPL Reservoir VideoPlayer: The `videoId` prop is also required. " +
|
|
100
|
+
"Only the `videoType` prop was set."
|
|
97
101
|
);
|
|
98
102
|
isInvalid = true;
|
|
99
103
|
} else if (embedCodeFinal && (videoType || videoId)) {
|
|
100
104
|
console.warn(
|
|
101
|
-
"VideoPlayer
|
|
105
|
+
"NYPL Reservoir VideoPlayer: Pass in either the `embedCode` prop or " +
|
|
106
|
+
"both the `videoType` and `videoId` props; all were set."
|
|
102
107
|
);
|
|
103
108
|
isInvalid = true;
|
|
104
109
|
}
|
|
@@ -111,7 +116,9 @@ export default function VideoPlayer(
|
|
|
111
116
|
videoId.includes("youtube") ||
|
|
112
117
|
videoId.includes("vimeo"))
|
|
113
118
|
) {
|
|
114
|
-
console.warn(
|
|
119
|
+
console.warn(
|
|
120
|
+
"NYPL Reservoir VideoPlayer: The `videoId` prop is not configured properly."
|
|
121
|
+
);
|
|
115
122
|
isInvalid = true;
|
|
116
123
|
}
|
|
117
124
|
|
|
@@ -123,7 +130,7 @@ export default function VideoPlayer(
|
|
|
123
130
|
!embedCodeFinal.includes("</iframe"))
|
|
124
131
|
) {
|
|
125
132
|
console.warn(
|
|
126
|
-
"
|
|
133
|
+
"NYPL Reservoir VideoPlayer: The `embedCode` prop is not configured properly."
|
|
127
134
|
);
|
|
128
135
|
isInvalid = true;
|
|
129
136
|
}
|
|
@@ -6,7 +6,7 @@ import Heading from "../components/Heading/Heading.tsx";
|
|
|
6
6
|
import Image from "../components/Image/Image.tsx";
|
|
7
7
|
import DSProvider from "../theme/provider";
|
|
8
8
|
|
|
9
|
-
<Meta title="
|
|
9
|
+
<Meta title="Welcome" />
|
|
10
10
|
|
|
11
11
|
# NYPL Design System
|
|
12
12
|
|
|
@@ -15,16 +15,12 @@ export const heroForegroundColor = `var(--nypl-colors-ui-white)`;
|
|
|
15
15
|
|
|
16
16
|
<DSProvider>
|
|
17
17
|
<Hero
|
|
18
|
-
heroType={HeroTypes.FiftyFifty}
|
|
19
|
-
subHeaderText="With 92 locations across the Bronx, Manhattan, and Staten Island, The New York Public Library is an essential part of neighborhoods across the city. Visit us today."
|
|
20
|
-
image={
|
|
21
|
-
<Image
|
|
22
|
-
src="https://cdn-d8.nypl.org/s3fs-public/styles/2_1_960/public/2020-07/SASB_06_29_2020_Lions_mask-00207%20copy_0.jpeg?h=c8e955ed&itok=n_GLQgoe"
|
|
23
|
-
alt=""
|
|
24
|
-
/>
|
|
25
|
-
}
|
|
26
18
|
backgroundColor={heroBackgroundColor}
|
|
27
19
|
foregroundColor={heroForegroundColor}
|
|
20
|
+
heroType={HeroTypes.FiftyFifty}
|
|
21
|
+
imageAlt="NYPL Lion with mask on"
|
|
22
|
+
imageSrc="https://cdn-d8.nypl.org/s3fs-public/styles/2_1_960/public/2020-07/SASB_06_29_2020_Lions_mask-00207%20copy_0.jpeg?h=c8e955ed&itok=n_GLQgoe"
|
|
23
|
+
subHeaderText="With 92 locations across the Bronx, Manhattan, and Staten Island, The New York Public Library is an essential part of neighborhoods across the city. Visit us today."
|
|
28
24
|
/>
|
|
29
25
|
</DSProvider>
|
|
30
26
|
|
|
@@ -10,7 +10,7 @@ describe("useNYPLTheme", () => {
|
|
|
10
10
|
const { result } = renderHook(() => useNYPLTheme());
|
|
11
11
|
|
|
12
12
|
expect(warn).toHaveBeenCalledWith(
|
|
13
|
-
"
|
|
13
|
+
"NYPL Reservoir useNYPLTheme: hook must be used inside of `<DSProvider />`."
|
|
14
14
|
);
|
|
15
15
|
expect(result.current).toEqual({});
|
|
16
16
|
});
|
|
@@ -9,7 +9,7 @@ function useNYPLTheme() {
|
|
|
9
9
|
const theme = useTheme();
|
|
10
10
|
if (!theme || Object.keys(theme).length === 0) {
|
|
11
11
|
console.warn(
|
|
12
|
-
"
|
|
12
|
+
"NYPL Reservoir useNYPLTheme: hook must be used inside of `<DSProvider />`."
|
|
13
13
|
);
|
|
14
14
|
return {};
|
|
15
15
|
}
|
package/src/index.ts
CHANGED
|
@@ -17,8 +17,9 @@ export {
|
|
|
17
17
|
VStack,
|
|
18
18
|
} from "@chakra-ui/react";
|
|
19
19
|
export { default as Accordion } from "./components/Accordion/Accordion";
|
|
20
|
+
export { AccordionTypes } from "./components/Accordion/AccordionTypes";
|
|
20
21
|
export { default as Breadcrumbs } from "./components/Breadcrumbs/Breadcrumbs";
|
|
21
|
-
export {
|
|
22
|
+
export { BreadcrumbsTypes } from "./components/Breadcrumbs/BreadcrumbsTypes";
|
|
22
23
|
export { default as Button } from "./components/Button/Button";
|
|
23
24
|
export { ButtonTypes } from "./components/Button/ButtonTypes";
|
|
24
25
|
export {
|
|
@@ -27,10 +28,8 @@ export {
|
|
|
27
28
|
CardContent,
|
|
28
29
|
CardHeading,
|
|
29
30
|
} from "./components/Card/Card";
|
|
30
|
-
export { CardLayouts } from "./components/Card/CardTypes";
|
|
31
31
|
export { default as Checkbox } from "./components/Checkbox/Checkbox";
|
|
32
32
|
export { default as CheckboxGroup } from "./components/CheckboxGroup/CheckboxGroup";
|
|
33
|
-
export { CheckboxGroupLayoutTypes } from "./components/CheckboxGroup/CheckboxGroupLayoutTypes";
|
|
34
33
|
export {
|
|
35
34
|
default as DatePicker,
|
|
36
35
|
FullDateType,
|
|
@@ -42,10 +41,7 @@ export { default as Form, FormField, FormRow } from "./components/Form/Form";
|
|
|
42
41
|
export { FormGaps } from "./components/Form/FormTypes";
|
|
43
42
|
export { GridGaps } from "./components/Grid/GridTypes";
|
|
44
43
|
export { default as Heading } from "./components/Heading/Heading";
|
|
45
|
-
export {
|
|
46
|
-
HeadingDisplaySizes,
|
|
47
|
-
HeadingLevels,
|
|
48
|
-
} from "./components/Heading/HeadingTypes";
|
|
44
|
+
export { HeadingSizes, HeadingLevels } from "./components/Heading/HeadingTypes";
|
|
49
45
|
export { default as HelperErrorText } from "./components/HelperErrorText/HelperErrorText";
|
|
50
46
|
export { default as Hero } from "./components/Hero/Hero";
|
|
51
47
|
export { HeroTypes } from "./components/Hero/HeroTypes";
|
|
@@ -66,6 +62,7 @@ export {
|
|
|
66
62
|
ImageTypes,
|
|
67
63
|
} from "./components/Image/ImageTypes";
|
|
68
64
|
export { default as Label } from "./components/Label/Label";
|
|
65
|
+
export { LayoutTypes } from "./helpers/enums";
|
|
69
66
|
export { default as Link } from "./components/Link/Link";
|
|
70
67
|
export { LinkTypes } from "./components/Link/LinkTypes";
|
|
71
68
|
export { default as List } from "./components/List/List";
|
|
@@ -83,15 +80,11 @@ export {
|
|
|
83
80
|
} from "./components/ProgressIndicator/ProgressIndicatorTypes";
|
|
84
81
|
export { default as Radio } from "./components/Radio/Radio";
|
|
85
82
|
export { default as RadioGroup } from "./components/RadioGroup/RadioGroup";
|
|
86
|
-
export { RadioGroupLayoutTypes } from "./components/RadioGroup/RadioGroupLayoutTypes";
|
|
87
83
|
export { default as SearchBar } from "./components/SearchBar/SearchBar";
|
|
88
84
|
export { default as Select } from "./components/Select/Select";
|
|
89
85
|
export { default as SimpleGrid } from "./components/Grid/SimpleGrid";
|
|
90
86
|
export { default as SkeletonLoader } from "./components/SkeletonLoader/SkeletonLoader";
|
|
91
|
-
export {
|
|
92
|
-
SkeletonLoaderImageRatios,
|
|
93
|
-
SkeletonLoaderLayouts,
|
|
94
|
-
} from "./components/SkeletonLoader/SkeletonLoaderTypes";
|
|
87
|
+
export { SkeletonLoaderImageRatios } from "./components/SkeletonLoader/SkeletonLoaderTypes";
|
|
95
88
|
export { default as Slider } from "./components/Slider/Slider";
|
|
96
89
|
export { default as StatusBadge } from "./components/StatusBadge/StatusBadge";
|
|
97
90
|
export { StatusBadgeTypes } from "./components/StatusBadge/StatusBadgeTypes";
|
|
@@ -117,14 +110,14 @@ export {
|
|
|
117
110
|
TemplateFooter,
|
|
118
111
|
} from "./components/Template/Template";
|
|
119
112
|
export { default as Text } from "./components/Text/Text";
|
|
120
|
-
export {
|
|
113
|
+
export { TextSizes } from "./components/Text/TextTypes";
|
|
121
114
|
export {
|
|
122
115
|
default as TextInput,
|
|
123
116
|
TextInputRefType,
|
|
124
117
|
} from "./components/TextInput/TextInput";
|
|
125
118
|
export { TextInputTypes } from "./components/TextInput/TextInputTypes";
|
|
126
119
|
export { default as Toggle } from "./components/Toggle/Toggle";
|
|
127
|
-
export { ToggleSizes } from "./components/Toggle/
|
|
120
|
+
export { ToggleSizes } from "./components/Toggle/ToggleTypes";
|
|
128
121
|
export { default as useNYPLTheme } from "./hooks/useNYPLTheme";
|
|
129
122
|
export { default as VideoPlayer } from "./components/VideoPlayer/VideoPlayer";
|
|
130
123
|
export {
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
const containerStyles = {
|
|
2
|
-
|
|
3
|
-
borderRightWidth: "1px",
|
|
4
|
-
borderColor: "ui.gray.medium",
|
|
2
|
+
border: "none",
|
|
5
3
|
width: "100%",
|
|
6
4
|
};
|
|
7
5
|
const buttonStyles = {
|
|
8
|
-
|
|
9
|
-
fontWeight:
|
|
10
|
-
_hover: {
|
|
11
|
-
bg: "ui.gray.light-cool",
|
|
12
|
-
},
|
|
6
|
+
borderWidth: "1px",
|
|
7
|
+
fontWeight: "medium",
|
|
13
8
|
};
|
|
14
9
|
const panelStyles = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
padding: "s",
|
|
11
|
+
borderLeftWidth: "1px",
|
|
12
|
+
borderRightWidth: "1px",
|
|
13
|
+
borderBottomWidth: "1px",
|
|
19
14
|
};
|
|
20
15
|
|
|
21
16
|
const Accordion = {
|
|
@@ -6,7 +6,7 @@ const imageSizes = {
|
|
|
6
6
|
large: { flex: { md: "0 0 360px" } },
|
|
7
7
|
};
|
|
8
8
|
// This is complicated and can be refactored later...
|
|
9
|
-
const getBodyPaddingStyles = ({ border, hasImage,
|
|
9
|
+
const getBodyPaddingStyles = ({ border, hasImage, imageIsAtEnd, isRow }) => {
|
|
10
10
|
let bodyPadding = null;
|
|
11
11
|
if (border) {
|
|
12
12
|
bodyPadding = "s";
|
|
@@ -22,7 +22,7 @@ const getBodyPaddingStyles = ({ border, hasImage, imageAtEnd, isRow }) => {
|
|
|
22
22
|
base: "0 var(--nypl-space-s) var(--nypl-space-s)",
|
|
23
23
|
md: "var(--nypl-space-s) var(--nypl-space-s) var(--nypl-space-s) 0",
|
|
24
24
|
};
|
|
25
|
-
if (
|
|
25
|
+
if (imageIsAtEnd) {
|
|
26
26
|
bodyPadding = {
|
|
27
27
|
base: "var(--nypl-space-s) var(--nypl-space-s) 0",
|
|
28
28
|
md: "var(--nypl-space-s) 0 var(--nypl-space-s) var(--nypl-space-s)",
|
|
@@ -34,8 +34,14 @@ const getBodyPaddingStyles = ({ border, hasImage, imageAtEnd, isRow }) => {
|
|
|
34
34
|
const Card = {
|
|
35
35
|
parts: ["body", "heading"],
|
|
36
36
|
baseStyle: (props) => {
|
|
37
|
-
const {
|
|
38
|
-
|
|
37
|
+
const {
|
|
38
|
+
border,
|
|
39
|
+
hasImage,
|
|
40
|
+
imageIsAtEnd,
|
|
41
|
+
isCentered,
|
|
42
|
+
layout,
|
|
43
|
+
mainActionLink,
|
|
44
|
+
} = props;
|
|
39
45
|
const isRow = layout === "row";
|
|
40
46
|
const layoutStyles = isRow
|
|
41
47
|
? {
|
|
@@ -46,7 +52,7 @@ const Card = {
|
|
|
46
52
|
},
|
|
47
53
|
maxWidth: "100%",
|
|
48
54
|
textAlign: "left",
|
|
49
|
-
alignItems:
|
|
55
|
+
alignItems: isCentered ? "center" : null,
|
|
50
56
|
}
|
|
51
57
|
: {};
|
|
52
58
|
const baseBorderStyles = border
|
|
@@ -58,11 +64,11 @@ const Card = {
|
|
|
58
64
|
const bodyPadding = getBodyPaddingStyles({
|
|
59
65
|
border,
|
|
60
66
|
hasImage,
|
|
61
|
-
|
|
67
|
+
imageIsAtEnd,
|
|
62
68
|
isRow,
|
|
63
69
|
});
|
|
64
70
|
let bodyMargin = null;
|
|
65
|
-
if (
|
|
71
|
+
if (isCentered) {
|
|
66
72
|
bodyMargin = "auto";
|
|
67
73
|
if (isRow) {
|
|
68
74
|
bodyMargin = "0";
|
|
@@ -72,7 +78,7 @@ const Card = {
|
|
|
72
78
|
alignItems: "flex-start",
|
|
73
79
|
display: "flex",
|
|
74
80
|
flexFlow: "column wrap",
|
|
75
|
-
textAlign:
|
|
81
|
+
textAlign: isCentered ? "center" : null,
|
|
76
82
|
heading: {
|
|
77
83
|
marginBottom: "xs",
|
|
78
84
|
a: mainActionLink ? { color: "ui.black" } : null,
|
|
@@ -91,13 +97,15 @@ const Card = {
|
|
|
91
97
|
|
|
92
98
|
const CardActions = {
|
|
93
99
|
baseStyle: (props) => {
|
|
94
|
-
const { bottomBorder,
|
|
100
|
+
const { bottomBorder, isCentered, layout, topBorder } = props;
|
|
95
101
|
let justifyContent = null;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
} else if (layout === "row") {
|
|
102
|
+
// Only center in the column layout.
|
|
103
|
+
if (layout === "row") {
|
|
99
104
|
justifyContent = "left";
|
|
105
|
+
} else if (isCentered) {
|
|
106
|
+
justifyContent = "center";
|
|
100
107
|
}
|
|
108
|
+
|
|
101
109
|
const topBorderStyles = topBorder
|
|
102
110
|
? {
|
|
103
111
|
borderTop: "1px solid",
|
|
@@ -135,30 +143,31 @@ const CardContent = {
|
|
|
135
143
|
};
|
|
136
144
|
|
|
137
145
|
const CardImage = {
|
|
138
|
-
baseStyle: ({
|
|
146
|
+
baseStyle: ({ imageIsAtEnd, isCentered, size, layout }) => {
|
|
139
147
|
// These sizes are only for the "row" layout.
|
|
140
|
-
const
|
|
148
|
+
const imageSize = imageSizes[size] || {};
|
|
141
149
|
const layoutStyles =
|
|
142
150
|
layout === "row"
|
|
143
151
|
? {
|
|
144
152
|
flex: { md: "0 0 225px" },
|
|
145
153
|
maxWidth: { base: "100%", md: "50%" },
|
|
146
154
|
textAlign: "left",
|
|
147
|
-
alignItems:
|
|
155
|
+
alignItems: isCentered ? "center" : null,
|
|
148
156
|
margin: {
|
|
149
|
-
base:
|
|
150
|
-
md:
|
|
157
|
+
base: imageIsAtEnd ? "var(--nypl-space-m) 0 0" : null,
|
|
158
|
+
md: imageIsAtEnd
|
|
151
159
|
? "0 0 0 var(--nypl-space-m)"
|
|
152
160
|
: "0 var(--nypl-space-m) 0 0",
|
|
153
161
|
},
|
|
154
162
|
width: { base: "100%", md: null },
|
|
155
|
-
|
|
163
|
+
marginBottom: ["xs", "xs"],
|
|
164
|
+
...imageSize,
|
|
156
165
|
}
|
|
157
166
|
: {
|
|
158
167
|
marginBottom: "xs",
|
|
159
168
|
width: "100%",
|
|
160
169
|
};
|
|
161
|
-
const
|
|
170
|
+
const imageIsAtEndStyles = imageIsAtEnd
|
|
162
171
|
? {
|
|
163
172
|
marginBottom: "0",
|
|
164
173
|
marginTop: "s",
|
|
@@ -167,7 +176,7 @@ const CardImage = {
|
|
|
167
176
|
: {};
|
|
168
177
|
|
|
169
178
|
return {
|
|
170
|
-
...
|
|
179
|
+
...imageIsAtEndStyles,
|
|
171
180
|
...layoutStyles,
|
|
172
181
|
};
|
|
173
182
|
},
|
|
@@ -2,7 +2,9 @@ import { checkboxRadioGroupStyles } from "./global";
|
|
|
2
2
|
|
|
3
3
|
const CheckboxGroup = {
|
|
4
4
|
parts: ["helper", "stack"],
|
|
5
|
-
baseStyle:
|
|
5
|
+
baseStyle: ({ isFullWidth = false }) => ({
|
|
6
|
+
...checkboxRadioGroupStyles(isFullWidth),
|
|
7
|
+
}),
|
|
6
8
|
};
|
|
7
9
|
|
|
8
10
|
export default CheckboxGroup;
|
|
@@ -21,6 +21,7 @@ const checkboxRadioLabelStyles = {
|
|
|
21
21
|
fontWeight: "text.default",
|
|
22
22
|
marginBottom: "0",
|
|
23
23
|
marginLeft: "xs",
|
|
24
|
+
width: "100%",
|
|
24
25
|
_disabled: {
|
|
25
26
|
color: "ui.gray.dark",
|
|
26
27
|
opacity: 1,
|
|
@@ -44,14 +45,14 @@ const checkboxRadioHelperStyle = {
|
|
|
44
45
|
fontStyle: "italic",
|
|
45
46
|
},
|
|
46
47
|
};
|
|
47
|
-
const checkboxRadioGroupStyles = {
|
|
48
|
+
const checkboxRadioGroupStyles = (isFullWidth = false) => ({
|
|
48
49
|
helper: {
|
|
49
50
|
marginTop: "s",
|
|
50
51
|
},
|
|
51
52
|
stack: {
|
|
52
|
-
width: "fit-content",
|
|
53
|
+
width: isFullWidth ? "100%" : "fit-content",
|
|
53
54
|
},
|
|
54
|
-
};
|
|
55
|
+
});
|
|
55
56
|
// Used in `Label` and `Fieldset`.
|
|
56
57
|
const labelLegendText = {
|
|
57
58
|
alignItems: "baseline",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const svgBase = {
|
|
2
2
|
display: "inline-block",
|
|
3
3
|
fill: "currentColor",
|
|
4
|
-
width: "
|
|
5
|
-
height: "
|
|
4
|
+
width: "auto",
|
|
5
|
+
height: "100%",
|
|
6
6
|
};
|
|
7
7
|
const align = {
|
|
8
8
|
none: {},
|
|
@@ -40,6 +40,9 @@ const size = {
|
|
|
40
40
|
height: "var(--nypl-space-m)",
|
|
41
41
|
width: "var(--nypl-space-m)",
|
|
42
42
|
},
|
|
43
|
+
default: {
|
|
44
|
+
width: "100%",
|
|
45
|
+
},
|
|
43
46
|
medium: {
|
|
44
47
|
height: "1.125rem",
|
|
45
48
|
width: "1.125rem",
|
|
@@ -85,6 +85,7 @@ const CustomImage = {
|
|
|
85
85
|
},
|
|
86
86
|
figcaption: {
|
|
87
87
|
fontStyle: "italic",
|
|
88
|
+
fontSize: "text.tag",
|
|
88
89
|
},
|
|
89
90
|
img: {
|
|
90
91
|
display: "block",
|
|
@@ -96,7 +97,6 @@ const CustomImage = {
|
|
|
96
97
|
},
|
|
97
98
|
captionWrappers: {
|
|
98
99
|
marginBottom: "xxs",
|
|
99
|
-
fontSize: "text.caption",
|
|
100
100
|
},
|
|
101
101
|
}),
|
|
102
102
|
};
|
|
@@ -10,7 +10,7 @@ const List = {
|
|
|
10
10
|
padding: noStyling ? "0" : null,
|
|
11
11
|
display: inline ? "flex" : null,
|
|
12
12
|
li: {
|
|
13
|
-
marginRight: inline ? "
|
|
13
|
+
marginRight: inline ? "xs" : null,
|
|
14
14
|
listStyleType: inline ? "none" : null,
|
|
15
15
|
_notFirst: {
|
|
16
16
|
marginTop: inline ? null : "xxs",
|
|
@@ -2,7 +2,7 @@ import { NotificationTypes } from "../../components/Notification/NotificationTyp
|
|
|
2
2
|
|
|
3
3
|
const Notification = {
|
|
4
4
|
parts: ["container", "dismissibleButton", "icon"],
|
|
5
|
-
baseStyle: ({
|
|
5
|
+
baseStyle: ({ dismissible, isCentered, noMargin, notificationType }) => {
|
|
6
6
|
let bg = "ui.status.primary";
|
|
7
7
|
if (
|
|
8
8
|
notificationType === NotificationTypes.Announcement ||
|
|
@@ -15,7 +15,7 @@ const Notification = {
|
|
|
15
15
|
display: "flex",
|
|
16
16
|
fontSize: "-1", // slightly smaller than the default size
|
|
17
17
|
position: "relative",
|
|
18
|
-
textAlign:
|
|
18
|
+
textAlign: isCentered ? "center" : null,
|
|
19
19
|
borderRadius: noMargin ? "0" : "4px",
|
|
20
20
|
margin: noMargin ? "0" : "s",
|
|
21
21
|
container: {
|
|
@@ -23,7 +23,7 @@ const Notification = {
|
|
|
23
23
|
maxWidth: "var(--nypl-breakpoint-xl)",
|
|
24
24
|
padding: "s",
|
|
25
25
|
paddingRight: dismissible ? "l" : null,
|
|
26
|
-
paddingLeft:
|
|
26
|
+
paddingLeft: isCentered && dismissible ? "l" : null,
|
|
27
27
|
width: "100%",
|
|
28
28
|
},
|
|
29
29
|
dismissibleButton: {
|
|
@@ -81,7 +81,7 @@ const NotificationContent = {
|
|
|
81
81
|
|
|
82
82
|
const NotificationHeading = {
|
|
83
83
|
parts: ["heading"],
|
|
84
|
-
baseStyle: ({
|
|
84
|
+
baseStyle: ({ icon, isCentered, notificationType }) => {
|
|
85
85
|
let color = "ui.black";
|
|
86
86
|
if (notificationType === NotificationTypes.Announcement) {
|
|
87
87
|
color = "section.research.secondary";
|
|
@@ -91,7 +91,7 @@ const NotificationHeading = {
|
|
|
91
91
|
return {
|
|
92
92
|
display: "flex",
|
|
93
93
|
marginBottom: "xxs",
|
|
94
|
-
justifyContent:
|
|
94
|
+
justifyContent: isCentered ? "center" : null,
|
|
95
95
|
heading: {
|
|
96
96
|
marginBottom: "0",
|
|
97
97
|
marginTop: icon ? "xxxs" : "0",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const Pagination = {
|
|
2
2
|
parts: ["link"],
|
|
3
3
|
baseStyle: {
|
|
4
|
-
marginBottom: "l",
|
|
5
4
|
alignItems: "stretch",
|
|
6
5
|
display: "flex",
|
|
7
6
|
width: "100%",
|
|
@@ -9,10 +8,8 @@ const Pagination = {
|
|
|
9
8
|
lineHeight: "1.15",
|
|
10
9
|
textDecoration: "none",
|
|
11
10
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
marginTop: "xxs",
|
|
15
|
-
},
|
|
11
|
+
ul: {
|
|
12
|
+
marginBottom: "0",
|
|
16
13
|
},
|
|
17
14
|
},
|
|
18
15
|
};
|
|
@@ -15,8 +15,8 @@ const ProgressIndicator = {
|
|
|
15
15
|
// Note: we have to target the SVG HTMl elements in order
|
|
16
16
|
// to override the default styles.
|
|
17
17
|
svg: {
|
|
18
|
-
height: size === ProgressIndicatorSizes.
|
|
19
|
-
width: size === ProgressIndicatorSizes.
|
|
18
|
+
height: size === ProgressIndicatorSizes.Default ? "48px" : "24px",
|
|
19
|
+
width: size === ProgressIndicatorSizes.Default ? "48px" : "24px",
|
|
20
20
|
display: "block",
|
|
21
21
|
circle: {
|
|
22
22
|
_first: {
|
|
@@ -44,7 +44,7 @@ const ProgressIndicator = {
|
|
|
44
44
|
bg: darkMode ? "ui.gray.dark" : "ui.gray.light-cool",
|
|
45
45
|
height: {
|
|
46
46
|
base: "4px",
|
|
47
|
-
md: size === ProgressIndicatorSizes.
|
|
47
|
+
md: size === ProgressIndicatorSizes.Default ? "8px" : "4px",
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
linearContainer: {
|
|
@@ -2,7 +2,9 @@ import { checkboxRadioGroupStyles } from "./global";
|
|
|
2
2
|
|
|
3
3
|
const RadioGroup = {
|
|
4
4
|
parts: ["helper", "stack"],
|
|
5
|
-
baseStyle:
|
|
5
|
+
baseStyle: ({ isFullWidth = false }) => ({
|
|
6
|
+
...checkboxRadioGroupStyles(isFullWidth),
|
|
7
|
+
}),
|
|
6
8
|
};
|
|
7
9
|
|
|
8
10
|
export default RadioGroup;
|
|
@@ -29,6 +29,12 @@ const Select = {
|
|
|
29
29
|
parts: ["select", "helper"],
|
|
30
30
|
baseStyle: {
|
|
31
31
|
marginBottom: "xs",
|
|
32
|
+
// The backgroundColor set to "ui.white" hides the arrow SVG icon when
|
|
33
|
+
// the component is focused. The background is added for dark mode and
|
|
34
|
+
// so we need to add specific selector.
|
|
35
|
+
".chakra-select__icon-wrapper": {
|
|
36
|
+
zIndex: "9999",
|
|
37
|
+
},
|
|
32
38
|
helper: {
|
|
33
39
|
...helperTextMargin,
|
|
34
40
|
},
|