@nypl/design-system-react-components 0.25.9 → 0.25.12
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 +96 -0
- package/README.md +4 -16
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/Fieldset/Fieldset.d.ts +1 -3
- package/dist/components/Form/Form.d.ts +13 -12
- package/dist/components/Form/FormTypes.d.ts +2 -2
- package/dist/components/HorizontalRule/HorizontalRule.d.ts +1 -1
- package/dist/components/Icons/IconTypes.d.ts +9 -7
- package/dist/components/List/List.d.ts +1 -1
- package/dist/components/Logo/LogoSvgs.d.ts +23 -1
- package/dist/components/Logo/LogoTypes.d.ts +23 -1
- package/dist/components/Notification/Notification.d.ts +2 -0
- package/dist/components/Pagination/Pagination.d.ts +6 -2
- package/dist/components/RadioGroup/RadioGroup.d.ts +3 -3
- package/dist/components/SearchBar/SearchBar.d.ts +6 -6
- package/dist/components/Select/Select.d.ts +4 -0
- package/dist/components/Table/Table.d.ts +9 -3
- package/dist/components/Template/Template.d.ts +24 -5
- package/dist/design-system-react-components.cjs.development.js +2063 -548
- 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 +2056 -554
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/resources.scss +0 -2
- package/dist/styles.css +1 -1
- package/dist/theme/components/breadcrumb.d.ts +4 -1
- package/dist/theme/components/checkbox.d.ts +0 -2
- package/dist/theme/components/customTable.d.ts +12 -3
- package/dist/theme/components/fieldset.d.ts +2 -0
- package/dist/theme/components/global.d.ts +15 -14
- package/dist/theme/components/globalMixins.d.ts +8 -8
- package/dist/theme/components/list.d.ts +6 -0
- package/dist/theme/components/notification.d.ts +16 -4
- package/dist/theme/components/radio.d.ts +3 -2
- package/dist/theme/components/searchBar.d.ts +4 -0
- package/dist/theme/components/select.d.ts +2 -9
- package/dist/theme/components/slider.d.ts +8 -4
- package/dist/theme/components/structuredContent.d.ts +9 -9
- package/dist/theme/components/textInput.d.ts +10 -12
- package/dist/theme/components/toggle.d.ts +6 -2
- package/dist/theme/foundations/global.d.ts +31 -3
- package/dist/utils/utils.d.ts +10 -0
- package/package.json +40 -36
- package/src/components/Accordion/Accordion.stories.mdx +1 -1
- package/src/components/Accordion/Accordion.test.tsx +45 -1
- package/src/components/Accordion/Accordion.tsx +20 -8
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +243 -0
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +30 -2
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +25 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +9 -3
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +104 -5
- package/src/components/Card/Card.stories.mdx +1 -1
- package/src/components/Card/Card.tsx +4 -1
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +1 -1
- package/src/components/Chakra/Flex.stories.mdx +113 -0
- package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
- package/src/components/Checkbox/Checkbox.tsx +1 -0
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +6 -6
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +1 -1
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +18 -18
- package/src/components/DatePicker/DatePicker.stories.mdx +1 -1
- package/src/components/DatePicker/DatePicker.test.tsx +6 -6
- package/src/components/DatePicker/DatePicker.tsx +12 -10
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +28 -20
- package/src/components/Fieldset/Fieldset.stories.mdx +1 -1
- package/src/components/Fieldset/Fieldset.tsx +2 -4
- package/src/components/Form/Form.stories.mdx +34 -16
- package/src/components/Form/Form.test.tsx +92 -3
- package/src/components/Form/Form.tsx +25 -21
- package/src/components/Form/FormTypes.tsx +2 -2
- package/src/components/Form/__snapshots__/Form.test.tsx.snap +0 -1
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -1
- package/src/components/Hero/Hero.stories.mdx +1 -1
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +3 -2
- package/src/components/HorizontalRule/HorizontalRule.tsx +2 -2
- package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +4 -4
- package/src/components/Icons/Icon.stories.mdx +1 -1
- package/src/components/Icons/Icon.test.tsx +1 -1
- package/src/components/Icons/Icon.tsx +1 -1
- package/src/components/Icons/IconTypes.tsx +8 -6
- package/src/components/List/List.stories.mdx +24 -5
- package/src/components/List/List.test.tsx +1 -1
- package/src/components/List/List.tsx +2 -2
- package/src/components/List/__snapshots__/List.test.tsx.snap +3 -1
- package/src/components/Logo/Logo.stories.mdx +7 -5
- package/src/components/Logo/LogoSvgs.tsx +45 -1
- package/src/components/Logo/LogoTypes.tsx +22 -0
- package/src/components/Notification/Notification.stories.mdx +73 -1
- package/src/components/Notification/Notification.test.tsx +64 -5
- package/src/components/Notification/Notification.tsx +21 -11
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +103 -8
- package/src/components/Pagination/Pagination.stories.mdx +54 -12
- package/src/components/Pagination/Pagination.test.tsx +63 -5
- package/src/components/Pagination/Pagination.tsx +46 -24
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +3 -3
- package/src/components/Radio/Radio.stories.mdx +1 -1
- package/src/components/Radio/Radio.tsx +1 -0
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +5 -5
- package/src/components/RadioGroup/RadioGroup.stories.mdx +1 -1
- package/src/components/RadioGroup/RadioGroup.test.tsx +13 -11
- package/src/components/RadioGroup/RadioGroup.tsx +88 -89
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +18 -18
- package/src/components/SearchBar/SearchBar.Test.tsx +124 -28
- package/src/components/SearchBar/SearchBar.stories.mdx +9 -6
- package/src/components/SearchBar/SearchBar.tsx +24 -23
- package/src/components/Select/Select.stories.mdx +1 -1
- package/src/components/Select/Select.test.tsx +89 -0
- package/src/components/Select/Select.tsx +11 -2
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +545 -0
- package/src/components/Slider/Slider.stories.mdx +1 -1
- package/src/components/Slider/Slider.tsx +4 -1
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +7 -0
- package/src/components/StructuredContent/StructuredContent.stories.mdx +1 -1
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +4 -4
- package/src/components/StyleGuide/Colors.stories.mdx +33 -18
- package/src/components/Table/Table.stories.mdx +118 -19
- package/src/components/Table/Table.test.tsx +80 -3
- package/src/components/Table/Table.tsx +26 -16
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +1179 -0
- package/src/components/Tabs/Tabs.stories.mdx +1 -1
- package/src/components/Tabs/Tabs.test.tsx +21 -5
- package/src/components/Tabs/Tabs.tsx +35 -20
- package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +195 -0
- package/src/components/Template/Template.stories.mdx +79 -4
- package/src/components/Template/Template.test.tsx +65 -3
- package/src/components/Template/Template.tsx +60 -14
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +94 -1
- package/src/components/TextInput/TextInput.stories.mdx +1 -1
- package/src/components/Toggle/Toggle.stories.mdx +1 -1
- package/src/components/Toggle/Toggle.tsx +2 -1
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +4 -4
- package/src/docs/Chakra.stories.mdx +1 -1
- package/src/index.ts +8 -2
- package/src/styles/base/_place-holder.scss +2 -0
- package/src/styles.scss +0 -2
- package/src/theme/components/breadcrumb.ts +5 -1
- package/src/theme/components/checkbox.ts +3 -7
- package/src/theme/components/customTable.ts +16 -3
- package/src/theme/components/fieldset.ts +2 -0
- package/src/theme/components/global.ts +19 -16
- package/src/theme/components/globalMixins.ts +8 -8
- package/src/theme/components/list.ts +6 -2
- package/src/theme/components/notification.ts +21 -8
- package/src/theme/components/radio.ts +3 -6
- package/src/theme/components/searchBar.ts +4 -0
- package/src/theme/components/select.ts +3 -3
- package/src/theme/components/slider.ts +12 -9
- package/src/theme/components/structuredContent.ts +26 -6
- package/src/theme/components/textInput.ts +3 -2
- package/src/theme/components/toggle.ts +42 -38
- package/src/theme/foundations/colors.ts +19 -12
- package/src/theme/foundations/global.ts +17 -5
- package/src/theme/foundations/typography.ts +2 -2
- package/src/utils/componentCategories.ts +2 -1
- package/src/utils/utils.ts +28 -0
- package/dist/components/Pagination/Pagination.stories.d.ts +0 -13
- package/src/components/Pagination/Pagination.stories.tsx +0 -54
- package/src/styles/base/_03-base.scss +0 -25
- package/src/styles/base/_04-focus.scss +0 -22
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 1`] = `
|
|
4
4
|
<nav
|
|
5
|
-
aria-label="
|
|
5
|
+
aria-label="Breadcrumb"
|
|
6
6
|
className="chakra-breadcrumb css-0"
|
|
7
7
|
id="breadcrumbs-test"
|
|
8
8
|
>
|
|
@@ -101,7 +101,7 @@ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 1`] = `
|
|
|
101
101
|
|
|
102
102
|
exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 2`] = `
|
|
103
103
|
<nav
|
|
104
|
-
aria-label="
|
|
104
|
+
aria-label="Breadcrumb"
|
|
105
105
|
className="chakra-breadcrumb css-0"
|
|
106
106
|
id="breadcrumbs-test"
|
|
107
107
|
>
|
|
@@ -200,7 +200,7 @@ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 2`] = `
|
|
|
200
200
|
|
|
201
201
|
exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 3`] = `
|
|
202
202
|
<nav
|
|
203
|
-
aria-label="
|
|
203
|
+
aria-label="Breadcrumb"
|
|
204
204
|
className="chakra-breadcrumb css-0"
|
|
205
205
|
id="breadcrumbs-test"
|
|
206
206
|
>
|
|
@@ -299,7 +299,7 @@ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 3`] = `
|
|
|
299
299
|
|
|
300
300
|
exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 4`] = `
|
|
301
301
|
<nav
|
|
302
|
-
aria-label="
|
|
302
|
+
aria-label="Breadcrumb"
|
|
303
303
|
className="chakra-breadcrumb css-0"
|
|
304
304
|
id="breadcrumbs-test"
|
|
305
305
|
>
|
|
@@ -398,7 +398,106 @@ exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 4`] = `
|
|
|
398
398
|
|
|
399
399
|
exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 5`] = `
|
|
400
400
|
<nav
|
|
401
|
-
aria-label="
|
|
401
|
+
aria-label="Breadcrumb"
|
|
402
|
+
className="chakra-breadcrumb css-0"
|
|
403
|
+
id="breadcrumbs-test"
|
|
404
|
+
>
|
|
405
|
+
<ol
|
|
406
|
+
className="chakra-breadcrumb__list css-0"
|
|
407
|
+
>
|
|
408
|
+
<li
|
|
409
|
+
className="chakra-breadcrumb__list-item css-18biwo"
|
|
410
|
+
>
|
|
411
|
+
<a
|
|
412
|
+
className="chakra-breadcrumb__link css-0"
|
|
413
|
+
href="#string1"
|
|
414
|
+
>
|
|
415
|
+
<span
|
|
416
|
+
className="breadcrumb-label"
|
|
417
|
+
>
|
|
418
|
+
string1
|
|
419
|
+
</span>
|
|
420
|
+
</a>
|
|
421
|
+
<span
|
|
422
|
+
className="css-t4q1nq"
|
|
423
|
+
role="presentation"
|
|
424
|
+
>
|
|
425
|
+
/
|
|
426
|
+
</span>
|
|
427
|
+
</li>
|
|
428
|
+
<li
|
|
429
|
+
className="chakra-breadcrumb__list-item css-18biwo"
|
|
430
|
+
>
|
|
431
|
+
<a
|
|
432
|
+
className="chakra-breadcrumb__link css-0"
|
|
433
|
+
href="#string2"
|
|
434
|
+
>
|
|
435
|
+
<svg
|
|
436
|
+
aria-hidden={true}
|
|
437
|
+
className="chakra-icon breadcrumbs-icon css-onkibi"
|
|
438
|
+
focusable={false}
|
|
439
|
+
id="breadcrumbs-test__backarrow"
|
|
440
|
+
role="img"
|
|
441
|
+
title="arrow icon"
|
|
442
|
+
viewBox="0 0 24 24"
|
|
443
|
+
>
|
|
444
|
+
<g
|
|
445
|
+
stroke="currentColor"
|
|
446
|
+
strokeWidth="1.5"
|
|
447
|
+
>
|
|
448
|
+
<path
|
|
449
|
+
d="M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
|
|
450
|
+
fill="none"
|
|
451
|
+
strokeLinecap="round"
|
|
452
|
+
/>
|
|
453
|
+
<path
|
|
454
|
+
d="M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
|
|
455
|
+
fill="currentColor"
|
|
456
|
+
strokeLinecap="round"
|
|
457
|
+
/>
|
|
458
|
+
<circle
|
|
459
|
+
cx="12"
|
|
460
|
+
cy="12"
|
|
461
|
+
fill="none"
|
|
462
|
+
r="11.25"
|
|
463
|
+
strokeMiterlimit="10"
|
|
464
|
+
/>
|
|
465
|
+
</g>
|
|
466
|
+
</svg>
|
|
467
|
+
<span
|
|
468
|
+
className="breadcrumb-label"
|
|
469
|
+
>
|
|
470
|
+
string2
|
|
471
|
+
</span>
|
|
472
|
+
</a>
|
|
473
|
+
<span
|
|
474
|
+
className="css-t4q1nq"
|
|
475
|
+
role="presentation"
|
|
476
|
+
>
|
|
477
|
+
/
|
|
478
|
+
</span>
|
|
479
|
+
</li>
|
|
480
|
+
<li
|
|
481
|
+
className="chakra-breadcrumb__list-item css-18biwo"
|
|
482
|
+
>
|
|
483
|
+
<span
|
|
484
|
+
aria-current="page"
|
|
485
|
+
className="chakra-breadcrumb__link css-0"
|
|
486
|
+
>
|
|
487
|
+
<span
|
|
488
|
+
className="breadcrumb-label"
|
|
489
|
+
>
|
|
490
|
+
string3
|
|
491
|
+
</span>
|
|
492
|
+
</span>
|
|
493
|
+
</li>
|
|
494
|
+
</ol>
|
|
495
|
+
</nav>
|
|
496
|
+
`;
|
|
497
|
+
|
|
498
|
+
exports[`Breadcrumbs Snapshot Renders the UI snapshot correctly 6`] = `
|
|
499
|
+
<nav
|
|
500
|
+
aria-label="Breadcrumb"
|
|
402
501
|
className="chakra-breadcrumb css-1f2fw9u"
|
|
403
502
|
id="breadcrumbs-test"
|
|
404
503
|
>
|
|
@@ -222,7 +222,10 @@ export default function Card(props: React.PropsWithChildren<CardProps>) {
|
|
|
222
222
|
child.props.children
|
|
223
223
|
);
|
|
224
224
|
const elem = React.cloneElement(child, {
|
|
225
|
-
additionalStyles:
|
|
225
|
+
additionalStyles: {
|
|
226
|
+
...styles.heading,
|
|
227
|
+
...child.props.additionalStyles,
|
|
228
|
+
},
|
|
226
229
|
key,
|
|
227
230
|
center,
|
|
228
231
|
// Override the child text with the potential `CardLinkOverlay`.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Box, Flex, Spacer, VStack } from "@chakra-ui/react";
|
|
2
|
+
import { Canvas, Meta, Story } from "@storybook/addon-docs";
|
|
3
|
+
|
|
4
|
+
import Heading from "../Heading/Heading";
|
|
5
|
+
import { HeadingLevels } from "../Heading/HeadingTypes";
|
|
6
|
+
import Link from "../Link/Link";
|
|
7
|
+
import { LinkTypes } from "../Link/LinkTypes";
|
|
8
|
+
import { getCategory } from "../../utils/componentCategories";
|
|
9
|
+
import DSProvider from "../../theme/provider";
|
|
10
|
+
|
|
11
|
+
<Meta title={getCategory("Flex")} component={Flex} />
|
|
12
|
+
|
|
13
|
+
# Flex
|
|
14
|
+
|
|
15
|
+
| Component Version | DS Version |
|
|
16
|
+
| ----------------- | ---------- |
|
|
17
|
+
| Added | `0.25.10` |
|
|
18
|
+
| Latest | `0.25.10` |
|
|
19
|
+
|
|
20
|
+
Note: This needs the use of the `DSProvider` component. See the
|
|
21
|
+
[README](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/chakra-ui--page#dsprovider)
|
|
22
|
+
for more information.
|
|
23
|
+
|
|
24
|
+
This component is directly exported from Chakra UI. The `Flex` component is
|
|
25
|
+
useful for simple layouts and can be used along with Chakra's `Spacer` component.
|
|
26
|
+
The combination can be used to create a container where the children span the
|
|
27
|
+
entire width of the container.
|
|
28
|
+
|
|
29
|
+
Details about available props and related child components can be found on the
|
|
30
|
+
[Flex component](https://chakra-ui.com/docs/layout/flex) page on the Chakra UI site.
|
|
31
|
+
|
|
32
|
+
<Canvas>
|
|
33
|
+
<Story
|
|
34
|
+
name="Flex"
|
|
35
|
+
args={{
|
|
36
|
+
alignItems: "baseline",
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
{(args) => (
|
|
40
|
+
<Flex {...args}>
|
|
41
|
+
<Box w="20" h="20" bg="brand.primary" />
|
|
42
|
+
<Box w="20" h="20" bg="brand.secondary" />
|
|
43
|
+
<Box w="20" h="20" bg="brand.primary" />
|
|
44
|
+
<Box w="20" h="20" bg="brand.secondary" />
|
|
45
|
+
<Box w="20" h="20" bg="brand.primary" />
|
|
46
|
+
</Flex>
|
|
47
|
+
)}
|
|
48
|
+
</Story>
|
|
49
|
+
</Canvas>
|
|
50
|
+
|
|
51
|
+
## Examples
|
|
52
|
+
|
|
53
|
+
Use the `justify` prop to move the children around.
|
|
54
|
+
|
|
55
|
+
<Canvas>
|
|
56
|
+
<DSProvider>
|
|
57
|
+
<VStack align="stretch">
|
|
58
|
+
<div>
|
|
59
|
+
<p>`justify` set to "center"</p>
|
|
60
|
+
<Flex alignItems="baseline" justify="center">
|
|
61
|
+
<Box w="20" h="20" bg="brand.primary" />
|
|
62
|
+
<Box w="20" h="20" bg="brand.secondary" />
|
|
63
|
+
<Box w="20" h="20" bg="brand.primary" />
|
|
64
|
+
<Box w="20" h="20" bg="brand.secondary" />
|
|
65
|
+
<Box w="20" h="20" bg="brand.primary" />
|
|
66
|
+
</Flex>
|
|
67
|
+
</div>
|
|
68
|
+
<div>
|
|
69
|
+
<p>`justify` set to "space-between"</p>
|
|
70
|
+
<Flex alignItems="baseline" justify="space-between">
|
|
71
|
+
<Box w="20" h="20" bg="brand.primary" />
|
|
72
|
+
<Box w="20" h="20" bg="brand.secondary" />
|
|
73
|
+
<Box w="20" h="20" bg="brand.primary" />
|
|
74
|
+
<Box w="20" h="20" bg="brand.secondary" />
|
|
75
|
+
<Box w="20" h="20" bg="brand.primary" />
|
|
76
|
+
</Flex>
|
|
77
|
+
</div>
|
|
78
|
+
</VStack>
|
|
79
|
+
</DSProvider>
|
|
80
|
+
</Canvas>
|
|
81
|
+
|
|
82
|
+
## With Spacer
|
|
83
|
+
|
|
84
|
+
A common use-case is displaying a row with two children where the first aligns
|
|
85
|
+
left and the second aligns right. Add the `Spacer` component between the children.
|
|
86
|
+
This is similar to setting `justify="space-between"` on the `Flex` parent but
|
|
87
|
+
the `Spacer` component is more flexible for most situations.
|
|
88
|
+
|
|
89
|
+
<Canvas>
|
|
90
|
+
<DSProvider>
|
|
91
|
+
<Flex alignItems="baseline">
|
|
92
|
+
<Heading id="row-heading" level={HeadingLevels.Three}>
|
|
93
|
+
Heading
|
|
94
|
+
</Heading>
|
|
95
|
+
<Spacer />
|
|
96
|
+
<Link href="#viewmore" type={LinkTypes.Forwards}>
|
|
97
|
+
View more
|
|
98
|
+
</Link>
|
|
99
|
+
</Flex>
|
|
100
|
+
</DSProvider>
|
|
101
|
+
</Canvas>
|
|
102
|
+
|
|
103
|
+
```jsx
|
|
104
|
+
<Flex alignItems="baseline">
|
|
105
|
+
<Heading id="row-heading" level={HeadingLevels.Three}>
|
|
106
|
+
Heading
|
|
107
|
+
</Heading>
|
|
108
|
+
<Spacer />
|
|
109
|
+
<Link href="#viewmore" type={LinkTypes.Forwards}>
|
|
110
|
+
View more
|
|
111
|
+
</Link>
|
|
112
|
+
</Flex>
|
|
113
|
+
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Checkbox Renders the UI snapshot correctly 1`] = `
|
|
4
4
|
<label
|
|
5
|
-
className="chakra-checkbox css-
|
|
5
|
+
className="chakra-checkbox css-g8du1g"
|
|
6
6
|
onClick={[Function]}
|
|
7
7
|
>
|
|
8
8
|
<input
|
|
@@ -65,7 +65,7 @@ exports[`Checkbox Renders the UI snapshot correctly 1`] = `
|
|
|
65
65
|
|
|
66
66
|
exports[`Checkbox Renders the UI snapshot correctly 2`] = `
|
|
67
67
|
<label
|
|
68
|
-
className="chakra-checkbox css-
|
|
68
|
+
className="chakra-checkbox css-g8du1g"
|
|
69
69
|
data-checked=""
|
|
70
70
|
onClick={[Function]}
|
|
71
71
|
>
|
|
@@ -131,7 +131,7 @@ exports[`Checkbox Renders the UI snapshot correctly 2`] = `
|
|
|
131
131
|
|
|
132
132
|
exports[`Checkbox Renders the UI snapshot correctly 3`] = `
|
|
133
133
|
<label
|
|
134
|
-
className="chakra-checkbox css-
|
|
134
|
+
className="chakra-checkbox css-g8du1g"
|
|
135
135
|
data-checked=""
|
|
136
136
|
onClick={[Function]}
|
|
137
137
|
>
|
|
@@ -219,7 +219,7 @@ exports[`Checkbox Renders the UI snapshot correctly 3`] = `
|
|
|
219
219
|
|
|
220
220
|
exports[`Checkbox Renders the UI snapshot correctly 4`] = `
|
|
221
221
|
<label
|
|
222
|
-
className="chakra-checkbox css-
|
|
222
|
+
className="chakra-checkbox css-g8du1g"
|
|
223
223
|
onClick={[Function]}
|
|
224
224
|
>
|
|
225
225
|
<input
|
|
@@ -282,7 +282,7 @@ exports[`Checkbox Renders the UI snapshot correctly 4`] = `
|
|
|
282
282
|
|
|
283
283
|
exports[`Checkbox Renders the UI snapshot correctly 5`] = `
|
|
284
284
|
<label
|
|
285
|
-
className="chakra-checkbox css-
|
|
285
|
+
className="chakra-checkbox css-g8du1g"
|
|
286
286
|
data-invalid=""
|
|
287
287
|
onClick={[Function]}
|
|
288
288
|
>
|
|
@@ -348,7 +348,7 @@ exports[`Checkbox Renders the UI snapshot correctly 5`] = `
|
|
|
348
348
|
|
|
349
349
|
exports[`Checkbox Renders the UI snapshot correctly 6`] = `
|
|
350
350
|
<label
|
|
351
|
-
className="chakra-checkbox css-
|
|
351
|
+
className="chakra-checkbox css-g8du1g"
|
|
352
352
|
data-disabled=""
|
|
353
353
|
onClick={[Function]}
|
|
354
354
|
>
|
|
@@ -20,7 +20,7 @@ exports[`Checkbox renders the UI snapshot correctly 1`] = `
|
|
|
20
20
|
id="column"
|
|
21
21
|
>
|
|
22
22
|
<label
|
|
23
|
-
className="chakra-checkbox css-
|
|
23
|
+
className="chakra-checkbox css-g8du1g"
|
|
24
24
|
onClick={[Function]}
|
|
25
25
|
>
|
|
26
26
|
<input
|
|
@@ -81,7 +81,7 @@ exports[`Checkbox renders the UI snapshot correctly 1`] = `
|
|
|
81
81
|
</span>
|
|
82
82
|
</label>
|
|
83
83
|
<label
|
|
84
|
-
className="chakra-checkbox css-
|
|
84
|
+
className="chakra-checkbox css-g8du1g"
|
|
85
85
|
onClick={[Function]}
|
|
86
86
|
>
|
|
87
87
|
<input
|
|
@@ -165,7 +165,7 @@ exports[`Checkbox renders the UI snapshot correctly 2`] = `
|
|
|
165
165
|
id="row"
|
|
166
166
|
>
|
|
167
167
|
<label
|
|
168
|
-
className="chakra-checkbox css-
|
|
168
|
+
className="chakra-checkbox css-g8du1g"
|
|
169
169
|
onClick={[Function]}
|
|
170
170
|
>
|
|
171
171
|
<input
|
|
@@ -226,7 +226,7 @@ exports[`Checkbox renders the UI snapshot correctly 2`] = `
|
|
|
226
226
|
</span>
|
|
227
227
|
</label>
|
|
228
228
|
<label
|
|
229
|
-
className="chakra-checkbox css-
|
|
229
|
+
className="chakra-checkbox css-g8du1g"
|
|
230
230
|
onClick={[Function]}
|
|
231
231
|
>
|
|
232
232
|
<input
|
|
@@ -310,7 +310,7 @@ exports[`Checkbox renders the UI snapshot correctly 3`] = `
|
|
|
310
310
|
id="noLabel"
|
|
311
311
|
>
|
|
312
312
|
<label
|
|
313
|
-
className="chakra-checkbox css-
|
|
313
|
+
className="chakra-checkbox css-g8du1g"
|
|
314
314
|
onClick={[Function]}
|
|
315
315
|
>
|
|
316
316
|
<input
|
|
@@ -371,7 +371,7 @@ exports[`Checkbox renders the UI snapshot correctly 3`] = `
|
|
|
371
371
|
</span>
|
|
372
372
|
</label>
|
|
373
373
|
<label
|
|
374
|
-
className="chakra-checkbox css-
|
|
374
|
+
className="chakra-checkbox css-g8du1g"
|
|
375
375
|
onClick={[Function]}
|
|
376
376
|
>
|
|
377
377
|
<input
|
|
@@ -455,7 +455,7 @@ exports[`Checkbox renders the UI snapshot correctly 4`] = `
|
|
|
455
455
|
id="helperText"
|
|
456
456
|
>
|
|
457
457
|
<label
|
|
458
|
-
className="chakra-checkbox css-
|
|
458
|
+
className="chakra-checkbox css-g8du1g"
|
|
459
459
|
onClick={[Function]}
|
|
460
460
|
>
|
|
461
461
|
<input
|
|
@@ -516,7 +516,7 @@ exports[`Checkbox renders the UI snapshot correctly 4`] = `
|
|
|
516
516
|
</span>
|
|
517
517
|
</label>
|
|
518
518
|
<label
|
|
519
|
-
className="chakra-checkbox css-
|
|
519
|
+
className="chakra-checkbox css-g8du1g"
|
|
520
520
|
onClick={[Function]}
|
|
521
521
|
>
|
|
522
522
|
<input
|
|
@@ -616,7 +616,7 @@ exports[`Checkbox renders the UI snapshot correctly 5`] = `
|
|
|
616
616
|
id="invalidText"
|
|
617
617
|
>
|
|
618
618
|
<label
|
|
619
|
-
className="chakra-checkbox css-
|
|
619
|
+
className="chakra-checkbox css-g8du1g"
|
|
620
620
|
onClick={[Function]}
|
|
621
621
|
>
|
|
622
622
|
<input
|
|
@@ -677,7 +677,7 @@ exports[`Checkbox renders the UI snapshot correctly 5`] = `
|
|
|
677
677
|
</span>
|
|
678
678
|
</label>
|
|
679
679
|
<label
|
|
680
|
-
className="chakra-checkbox css-
|
|
680
|
+
className="chakra-checkbox css-g8du1g"
|
|
681
681
|
onClick={[Function]}
|
|
682
682
|
>
|
|
683
683
|
<input
|
|
@@ -756,7 +756,7 @@ exports[`Checkbox renders the UI snapshot correctly 6`] = `
|
|
|
756
756
|
id="optReq"
|
|
757
757
|
>
|
|
758
758
|
<label
|
|
759
|
-
className="chakra-checkbox css-
|
|
759
|
+
className="chakra-checkbox css-g8du1g"
|
|
760
760
|
onClick={[Function]}
|
|
761
761
|
>
|
|
762
762
|
<input
|
|
@@ -817,7 +817,7 @@ exports[`Checkbox renders the UI snapshot correctly 6`] = `
|
|
|
817
817
|
</span>
|
|
818
818
|
</label>
|
|
819
819
|
<label
|
|
820
|
-
className="chakra-checkbox css-
|
|
820
|
+
className="chakra-checkbox css-g8du1g"
|
|
821
821
|
onClick={[Function]}
|
|
822
822
|
>
|
|
823
823
|
<input
|
|
@@ -901,7 +901,7 @@ exports[`Checkbox renders the UI snapshot correctly 7`] = `
|
|
|
901
901
|
id="required"
|
|
902
902
|
>
|
|
903
903
|
<label
|
|
904
|
-
className="chakra-checkbox css-
|
|
904
|
+
className="chakra-checkbox css-g8du1g"
|
|
905
905
|
onClick={[Function]}
|
|
906
906
|
>
|
|
907
907
|
<input
|
|
@@ -962,7 +962,7 @@ exports[`Checkbox renders the UI snapshot correctly 7`] = `
|
|
|
962
962
|
</span>
|
|
963
963
|
</label>
|
|
964
964
|
<label
|
|
965
|
-
className="chakra-checkbox css-
|
|
965
|
+
className="chakra-checkbox css-g8du1g"
|
|
966
966
|
onClick={[Function]}
|
|
967
967
|
>
|
|
968
968
|
<input
|
|
@@ -1046,7 +1046,7 @@ exports[`Checkbox renders the UI snapshot correctly 8`] = `
|
|
|
1046
1046
|
id="invalid"
|
|
1047
1047
|
>
|
|
1048
1048
|
<label
|
|
1049
|
-
className="chakra-checkbox css-
|
|
1049
|
+
className="chakra-checkbox css-g8du1g"
|
|
1050
1050
|
data-invalid=""
|
|
1051
1051
|
onClick={[Function]}
|
|
1052
1052
|
>
|
|
@@ -1110,7 +1110,7 @@ exports[`Checkbox renders the UI snapshot correctly 8`] = `
|
|
|
1110
1110
|
</span>
|
|
1111
1111
|
</label>
|
|
1112
1112
|
<label
|
|
1113
|
-
className="chakra-checkbox css-
|
|
1113
|
+
className="chakra-checkbox css-g8du1g"
|
|
1114
1114
|
data-invalid=""
|
|
1115
1115
|
onClick={[Function]}
|
|
1116
1116
|
>
|
|
@@ -1197,7 +1197,7 @@ exports[`Checkbox renders the UI snapshot correctly 9`] = `
|
|
|
1197
1197
|
id="disabled"
|
|
1198
1198
|
>
|
|
1199
1199
|
<label
|
|
1200
|
-
className="chakra-checkbox css-
|
|
1200
|
+
className="chakra-checkbox css-g8du1g"
|
|
1201
1201
|
data-disabled=""
|
|
1202
1202
|
onClick={[Function]}
|
|
1203
1203
|
>
|
|
@@ -1261,7 +1261,7 @@ exports[`Checkbox renders the UI snapshot correctly 9`] = `
|
|
|
1261
1261
|
</span>
|
|
1262
1262
|
</label>
|
|
1263
1263
|
<label
|
|
1264
|
-
className="chakra-checkbox css-
|
|
1264
|
+
className="chakra-checkbox css-g8du1g"
|
|
1265
1265
|
data-disabled=""
|
|
1266
1266
|
onClick={[Function]}
|
|
1267
1267
|
>
|
|
@@ -9,7 +9,7 @@ import { DatePickerTypes } from "./DatePickerTypes";
|
|
|
9
9
|
import { TextInputRefType } from "../TextInput/TextInput";
|
|
10
10
|
|
|
11
11
|
/** This adds a "0" padding for date values under "10". */
|
|
12
|
-
const
|
|
12
|
+
const strPad = (n) => String("0" + n).slice(-2);
|
|
13
13
|
const monthArray = [
|
|
14
14
|
"January",
|
|
15
15
|
"February",
|
|
@@ -49,8 +49,8 @@ describe("DatePicker", () => {
|
|
|
49
49
|
/** Returns today's year, month, and day values. */
|
|
50
50
|
const getTodaysValues = () => {
|
|
51
51
|
const year = todaysDate.getFullYear();
|
|
52
|
-
const month =
|
|
53
|
-
const day =
|
|
52
|
+
const month = strPad(todaysDate.getMonth() + 1);
|
|
53
|
+
const day = strPad(todaysDate.getDate());
|
|
54
54
|
return [year, month, day];
|
|
55
55
|
};
|
|
56
56
|
/** Returns today's date in string format based on the DatePicker type. */
|
|
@@ -328,9 +328,9 @@ describe("DatePicker", () => {
|
|
|
328
328
|
expect(screen.getByDisplayValue(newDayValue)).toBeInTheDocument();
|
|
329
329
|
|
|
330
330
|
const { startDate } = dateObject;
|
|
331
|
-
const valueFromOnChange = `${startDate.getFullYear()}-${
|
|
331
|
+
const valueFromOnChange = `${startDate.getFullYear()}-${strPad(
|
|
332
332
|
startDate.getMonth() + 1
|
|
333
|
-
)}-${
|
|
333
|
+
)}-${strPad(startDate.getDate())}`;
|
|
334
334
|
expect(newDayValue).toEqual(valueFromOnChange);
|
|
335
335
|
});
|
|
336
336
|
|
|
@@ -724,7 +724,7 @@ describe("DatePicker", () => {
|
|
|
724
724
|
// We are two months ahead but still selecting the midmonth day.
|
|
725
725
|
userEvent.click(screen.getByText(midMonthDay));
|
|
726
726
|
// So only the month should change accordingly.
|
|
727
|
-
const newMonthValue = `${newDayValue.substr(0, 5)}${
|
|
727
|
+
const newMonthValue = `${newDayValue.substr(0, 5)}${strPad(
|
|
728
728
|
"10"
|
|
729
729
|
)}${newDayValue.substr(7)}`;
|
|
730
730
|
expect(screen.getByDisplayValue(newMonthValue)).toBeInTheDocument();
|
|
@@ -4,20 +4,20 @@ import ReactDatePicker from "react-datepicker";
|
|
|
4
4
|
import { DatePickerTypes } from "./DatePickerTypes";
|
|
5
5
|
import Fieldset from "../Fieldset/Fieldset";
|
|
6
6
|
import { FormRow, FormField } from "../Form/Form";
|
|
7
|
-
import {
|
|
7
|
+
import { FormGaps } from "../Form/FormTypes";
|
|
8
8
|
import HelperErrorText, {
|
|
9
9
|
HelperErrorTextType,
|
|
10
10
|
} from "../HelperErrorText/HelperErrorText";
|
|
11
|
+
import { helperTextMargin } from "../../theme/components/global";
|
|
11
12
|
import TextInput, {
|
|
12
13
|
InputProps,
|
|
13
14
|
TextInputRefType,
|
|
14
15
|
} from "../TextInput/TextInput";
|
|
15
16
|
import generateUUID from "../../helpers/generateUUID";
|
|
16
|
-
import { useMultiStyleConfig } from "@chakra-ui/
|
|
17
|
+
import { Box, useMultiStyleConfig } from "@chakra-ui/react";
|
|
17
18
|
|
|
18
19
|
// The object shape for the DatePicker's start and end date state values.
|
|
19
|
-
|
|
20
|
-
interface FullDateType {
|
|
20
|
+
export interface FullDateType {
|
|
21
21
|
/** Date object that gets returned for the onChange
|
|
22
22
|
* function only for date ranges. */
|
|
23
23
|
endDate?: Date;
|
|
@@ -217,7 +217,7 @@ const DateRangeRow: React.FC<DateRangeRowProps> = ({
|
|
|
217
217
|
children,
|
|
218
218
|
}) =>
|
|
219
219
|
isDateRange ? (
|
|
220
|
-
<FormRow id={`${id}-form-row`} gap={
|
|
220
|
+
<FormRow id={`${id}-form-row`} gap={FormGaps.ExtraSmall}>
|
|
221
221
|
{children}
|
|
222
222
|
</FormRow>
|
|
223
223
|
) : (
|
|
@@ -417,11 +417,13 @@ const DatePicker = React.forwardRef<TextInputRefType, DatePickerProps>(
|
|
|
417
417
|
)}
|
|
418
418
|
</DateRangeRow>
|
|
419
419
|
{helperText && isDateRange && showHelperInvalidText && (
|
|
420
|
-
<
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
420
|
+
<Box __css={helperTextMargin}>
|
|
421
|
+
<HelperErrorText
|
|
422
|
+
id={`${id}-helper-text`}
|
|
423
|
+
isInvalid={false}
|
|
424
|
+
text={helperText}
|
|
425
|
+
/>
|
|
426
|
+
</Box>
|
|
425
427
|
)}
|
|
426
428
|
</DatePickerWrapper>
|
|
427
429
|
);
|