@nypl/design-system-react-components 0.28.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/README.md +10 -10
- package/dist/components/Checkbox/Checkbox.d.ts +0 -1
- package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +8 -0
- package/dist/components/Heading/Heading.d.ts +2 -0
- package/dist/components/Logo/Logo.d.ts +1 -1
- package/dist/components/Logo/LogoSvgs.d.ts +4 -0
- package/dist/design-system-react-components.cjs.development.js +1021 -683
- 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 +1022 -684
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/theme/components/button.d.ts +1 -0
- package/dist/theme/components/card.d.ts +98 -13
- package/dist/theme/components/checkboxGroup.d.ts +1 -1
- package/dist/theme/components/global.d.ts +1 -1
- package/dist/theme/components/heading.d.ts +4 -16
- package/dist/theme/components/image.d.ts +6 -0
- package/dist/theme/components/radioGroup.d.ts +1 -1
- package/dist/theme/components/skipNavigation.d.ts +3 -0
- package/dist/theme/components/structuredContent.d.ts +0 -5
- package/dist/utils/utils.d.ts +15 -0
- package/package.json +6 -6
- package/src/components/Accordion/Accordion.stories.mdx +18 -46
- package/src/components/Accordion/Accordion.tsx +3 -2
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +12 -12
- package/src/components/Button/Button.stories.mdx +1 -1
- package/src/components/ButtonGroup/ButtonGroup.stories.mdx +33 -2
- package/src/components/ButtonGroup/ButtonGroup.tsx +2 -1
- package/src/components/Card/Card.stories.mdx +2 -4
- package/src/components/Card/Card.tsx +2 -1
- package/src/components/Chakra/Box.stories.mdx +1 -1
- package/src/components/Chakra/Center.stories.mdx +1 -1
- package/src/components/Chakra/Flex.stories.mdx +1 -1
- package/src/components/Chakra/Grid.stories.mdx +1 -1
- package/src/components/Chakra/Stack.stories.mdx +1 -1
- package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
- package/src/components/Checkbox/Checkbox.test.tsx +42 -11
- package/src/components/Checkbox/Checkbox.tsx +25 -39
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +589 -544
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +1 -1
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +1 -1
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +1540 -1420
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +12 -3
- package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +5 -0
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +36 -17
- package/src/components/Grid/SimpleGrid.stories.mdx +1 -3
- package/src/components/Heading/Heading.stories.mdx +4 -1
- package/src/components/Heading/Heading.tsx +4 -1
- package/src/components/Image/Image.stories.mdx +1 -1
- package/src/components/Logo/Logo.stories.mdx +10 -5
- package/src/components/Logo/Logo.tsx +4 -0
- package/src/components/Logo/LogoSvgs.tsx +8 -0
- package/src/components/Modal/Modal.stories.mdx +83 -90
- package/src/components/Pagination/Pagination.stories.mdx +1 -1
- package/src/components/Radio/Radio.stories.mdx +1 -1
- package/src/components/Radio/Radio.tsx +22 -31
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +405 -365
- package/src/components/RadioGroup/RadioGroup.stories.mdx +2 -1
- package/src/components/RadioGroup/RadioGroup.tsx +2 -1
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1236 -1116
- package/src/components/SearchBar/SearchBar.stories.mdx +3 -3
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +32 -10
- package/src/components/Select/Select.stories.mdx +1 -1
- package/src/components/Select/Select.tsx +24 -22
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +21 -11
- package/src/components/SkipNavigation/SkipNavigation.stories.mdx +2 -2
- package/src/components/Slider/Slider.stories.mdx +1 -1
- package/src/components/Slider/Slider.tsx +14 -14
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +66 -33
- package/src/components/StyleGuide/Buttons.stories.mdx +1 -1
- package/src/components/StyleGuide/Colors.stories.mdx +2 -2
- package/src/components/StyleGuide/Forms.stories.mdx +2 -1
- package/src/components/StyleGuide/Iconography.stories.mdx +2 -2
- package/src/components/StyleGuide/Spacing.stories.mdx +1 -1
- package/src/components/StyleGuide/Typography.stories.mdx +1 -1
- package/src/components/Table/Table.stories.mdx +1 -5
- package/src/components/Table/Table.test.tsx +33 -0
- package/src/components/Table/Table.tsx +21 -0
- package/src/components/Template/Template.stories.mdx +9 -5
- package/src/components/TextInput/TextInput.stories.mdx +1 -1
- package/src/components/TextInput/TextInput.tsx +21 -21
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +19 -9
- package/src/components/Toggle/Toggle.stories.mdx +1 -1
- package/src/components/Toggle/Toggle.tsx +22 -20
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +400 -372
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +1 -0
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +5 -0
- package/src/docs/Chakra.stories.mdx +2 -2
- package/src/theme/components/button.ts +1 -0
- package/src/theme/components/card.ts +9 -3
- package/src/theme/components/componentWrapper.ts +1 -1
- package/src/theme/components/global.ts +1 -1
- package/src/theme/components/heading.ts +3 -3
- package/src/theme/components/image.ts +1 -0
- package/src/theme/components/skipNavigation.ts +3 -0
- package/src/theme/foundations/colors.ts +6 -9
- package/src/utils/utils.ts +40 -0
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`UI Snapshots renders the text input UI snapshot correctly 1`] = `
|
|
4
4
|
<div
|
|
5
|
-
className="css-
|
|
5
|
+
className="css-1u8qly9"
|
|
6
|
+
id="myTextInput-wrapper"
|
|
6
7
|
>
|
|
7
8
|
<label
|
|
8
9
|
className="css-1xdhyk6"
|
|
@@ -31,7 +32,8 @@ exports[`UI Snapshots renders the text input UI snapshot correctly 1`] = `
|
|
|
31
32
|
|
|
32
33
|
exports[`UI Snapshots renders the text input UI snapshot correctly 2`] = `
|
|
33
34
|
<div
|
|
34
|
-
className="css-
|
|
35
|
+
className="css-1u8qly9"
|
|
36
|
+
id="myTextInput-wrapper"
|
|
35
37
|
>
|
|
36
38
|
<label
|
|
37
39
|
className="css-1xdhyk6"
|
|
@@ -56,7 +58,8 @@ exports[`UI Snapshots renders the text input UI snapshot correctly 2`] = `
|
|
|
56
58
|
|
|
57
59
|
exports[`UI Snapshots renders the text input UI snapshot correctly 3`] = `
|
|
58
60
|
<div
|
|
59
|
-
className="css-
|
|
61
|
+
className="css-1u8qly9"
|
|
62
|
+
id="myTextInput-wrapper"
|
|
60
63
|
>
|
|
61
64
|
<input
|
|
62
65
|
aria-label="Custom Input Label"
|
|
@@ -76,7 +79,8 @@ exports[`UI Snapshots renders the text input UI snapshot correctly 3`] = `
|
|
|
76
79
|
|
|
77
80
|
exports[`UI Snapshots renders the text input UI snapshot correctly 4`] = `
|
|
78
81
|
<div
|
|
79
|
-
className="css-
|
|
82
|
+
className="css-1u8qly9"
|
|
83
|
+
id="myTextInput-wrapper"
|
|
80
84
|
>
|
|
81
85
|
<label
|
|
82
86
|
className="css-1xdhyk6"
|
|
@@ -118,7 +122,8 @@ exports[`UI Snapshots renders the text input UI snapshot correctly 4`] = `
|
|
|
118
122
|
|
|
119
123
|
exports[`UI Snapshots renders the text input UI snapshot correctly 5`] = `
|
|
120
124
|
<div
|
|
121
|
-
className="css-
|
|
125
|
+
className="css-1u8qly9"
|
|
126
|
+
id="myTextInput-wrapper"
|
|
122
127
|
>
|
|
123
128
|
<label
|
|
124
129
|
className="css-1xdhyk6"
|
|
@@ -131,6 +136,7 @@ exports[`UI Snapshots renders the text input UI snapshot correctly 5`] = `
|
|
|
131
136
|
</span>
|
|
132
137
|
</label>
|
|
133
138
|
<input
|
|
139
|
+
aria-describedby="myTextInput-helperText"
|
|
134
140
|
aria-invalid={true}
|
|
135
141
|
aria-required={true}
|
|
136
142
|
className="chakra-input css-0"
|
|
@@ -160,7 +166,8 @@ exports[`UI Snapshots renders the text input UI snapshot correctly 5`] = `
|
|
|
160
166
|
|
|
161
167
|
exports[`UI Snapshots renders the text input UI snapshot correctly 6`] = `
|
|
162
168
|
<div
|
|
163
|
-
className="css-
|
|
169
|
+
className="css-1u8qly9"
|
|
170
|
+
id="myTextInput-wrapper"
|
|
164
171
|
>
|
|
165
172
|
<label
|
|
166
173
|
className="css-1xdhyk6"
|
|
@@ -189,7 +196,8 @@ exports[`UI Snapshots renders the text input UI snapshot correctly 6`] = `
|
|
|
189
196
|
|
|
190
197
|
exports[`UI Snapshots renders the text input UI snapshot correctly 7`] = `
|
|
191
198
|
<div
|
|
192
|
-
className="css-
|
|
199
|
+
className="css-1y4kn3e"
|
|
200
|
+
id="chakra-wrapper"
|
|
193
201
|
>
|
|
194
202
|
<label
|
|
195
203
|
className="css-1xdhyk6"
|
|
@@ -214,8 +222,9 @@ exports[`UI Snapshots renders the text input UI snapshot correctly 7`] = `
|
|
|
214
222
|
|
|
215
223
|
exports[`UI Snapshots renders the text input UI snapshot correctly 8`] = `
|
|
216
224
|
<div
|
|
217
|
-
className="css-
|
|
225
|
+
className="css-1u8qly9"
|
|
218
226
|
data-testid="props"
|
|
227
|
+
id="props-wrapper"
|
|
219
228
|
>
|
|
220
229
|
<label
|
|
221
230
|
className="css-1xdhyk6"
|
|
@@ -241,7 +250,8 @@ exports[`UI Snapshots renders the text input UI snapshot correctly 8`] = `
|
|
|
241
250
|
|
|
242
251
|
exports[`UI Snapshots renders the textarea UI snapshot correctly 1`] = `
|
|
243
252
|
<div
|
|
244
|
-
className="css-
|
|
253
|
+
className="css-1u8qly9"
|
|
254
|
+
id="myTextarea-wrapper"
|
|
245
255
|
>
|
|
246
256
|
<label
|
|
247
257
|
className="css-1xdhyk6"
|
|
@@ -7,10 +7,9 @@ import {
|
|
|
7
7
|
} from "@chakra-ui/react";
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
} from "
|
|
13
|
-
import { AriaAttributes } from "../../utils/interfaces";
|
|
10
|
+
import ComponentWrapper from "../ComponentWrapper/ComponentWrapper";
|
|
11
|
+
import { HelperErrorTextType } from "../HelperErrorText/HelperErrorText";
|
|
12
|
+
import { getAriaAttrs } from "../../utils/utils";
|
|
14
13
|
|
|
15
14
|
export type ToggleSizes = "default" | "small";
|
|
16
15
|
export interface ToggleProps {
|
|
@@ -71,12 +70,16 @@ export const Toggle = chakra(
|
|
|
71
70
|
size = "default",
|
|
72
71
|
...rest
|
|
73
72
|
} = props;
|
|
74
|
-
const footnote = isInvalid ? invalidText : helperText;
|
|
75
|
-
const ariaAttributes: AriaAttributes = {};
|
|
76
73
|
const styles = useMultiStyleConfig("Toggle", { isDisabled, size });
|
|
77
74
|
const switchStyles = useStyleConfig("Switch", { size });
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
const footnote = isInvalid ? invalidText : helperText;
|
|
76
|
+
const ariaAttributes = getAriaAttrs({
|
|
77
|
+
footnote,
|
|
78
|
+
id,
|
|
79
|
+
labelText,
|
|
80
|
+
name: "Toggle",
|
|
81
|
+
showLabel: true,
|
|
82
|
+
});
|
|
80
83
|
|
|
81
84
|
if (!id) {
|
|
82
85
|
console.warn(
|
|
@@ -85,14 +88,21 @@ export const Toggle = chakra(
|
|
|
85
88
|
}
|
|
86
89
|
|
|
87
90
|
return (
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
<ComponentWrapper
|
|
92
|
+
helperText={helperText}
|
|
93
|
+
helperTextStyles={styles.helperErrorText}
|
|
94
|
+
id={id}
|
|
95
|
+
invalidText={invalidText}
|
|
96
|
+
isInvalid={isInvalid}
|
|
97
|
+
{...rest}
|
|
98
|
+
>
|
|
99
|
+
<Box __css={styles}>
|
|
90
100
|
<Switch
|
|
91
101
|
id={id}
|
|
92
|
-
name={name || "default"}
|
|
93
102
|
isDisabled={isDisabled}
|
|
94
103
|
isInvalid={isInvalid}
|
|
95
104
|
isRequired={isRequired}
|
|
105
|
+
name={name || "default"}
|
|
96
106
|
ref={ref}
|
|
97
107
|
size={size === "default" ? "lg" : "sm"}
|
|
98
108
|
lineHeight="1.5"
|
|
@@ -110,15 +120,7 @@ export const Toggle = chakra(
|
|
|
110
120
|
{labelText}
|
|
111
121
|
</Switch>
|
|
112
122
|
</Box>
|
|
113
|
-
|
|
114
|
-
<HelperErrorText
|
|
115
|
-
id={`${id}-helperText`}
|
|
116
|
-
isInvalid={isInvalid}
|
|
117
|
-
text={footnote}
|
|
118
|
-
__css={styles.helperErrorText}
|
|
119
|
-
/>
|
|
120
|
-
)}
|
|
121
|
-
</>
|
|
123
|
+
</ComponentWrapper>
|
|
122
124
|
);
|
|
123
125
|
})
|
|
124
126
|
);
|