@nypl/design-system-react-components 0.25.2 → 0.25.6
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 +101 -0
- package/README.md +47 -11
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -0
- package/dist/components/Button/Button.d.ts +9 -8
- package/dist/components/Button/ButtonTypes.d.ts +2 -1
- package/dist/components/Card/Card.d.ts +36 -52
- package/dist/components/Card/CardTypes.d.ts +0 -15
- package/dist/components/Checkbox/Checkbox.d.ts +8 -9
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +2 -2
- package/dist/components/DatePicker/DatePicker.d.ts +36 -36
- package/dist/components/Fieldset/Fieldset.d.ts +25 -0
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +4 -0
- package/dist/components/HorizontalRule/HorizontalRule.d.ts +10 -3
- package/dist/components/Icons/Icon.d.ts +4 -0
- package/dist/components/Icons/IconSvgs.d.ts +11 -0
- package/dist/components/Icons/IconTypes.d.ts +11 -0
- package/dist/components/Image/Image.d.ts +19 -9
- package/dist/components/Image/ImageTypes.d.ts +20 -0
- package/dist/components/Link/Link.d.ts +4 -0
- package/dist/components/List/List.d.ts +7 -1
- package/dist/components/Notification/Notification.d.ts +6 -4
- package/dist/components/Pagination/Pagination.d.ts +16 -13
- package/dist/components/Pagination/Pagination.stories.d.ts +2 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +29 -0
- package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +8 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
- package/dist/components/SearchBar/SearchBar.d.ts +3 -3
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +18 -14
- package/dist/components/Slider/Slider.d.ts +57 -0
- package/dist/components/Tabs/Tabs.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +10 -0
- package/dist/design-system-react-components.cjs.development.js +3058 -936
- 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 +3049 -921
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +12 -6
- package/dist/resources.scss +180 -170
- package/dist/styles.css +1 -1
- package/dist/theme/components/breadcrumb.d.ts +9 -0
- package/dist/theme/components/button.d.ts +22 -8
- package/dist/theme/components/card.d.ts +168 -0
- package/dist/theme/components/checkbox.d.ts +5 -1
- package/dist/theme/components/checkboxGroup.d.ts +12 -0
- package/dist/theme/components/datePicker.d.ts +16 -0
- package/dist/theme/components/fieldset.d.ts +27 -0
- package/dist/theme/components/global.d.ts +23 -13
- package/dist/theme/components/globalMixins.d.ts +9 -1
- package/dist/theme/components/heading.d.ts +5 -0
- package/dist/theme/components/image.d.ts +31 -0
- package/dist/theme/components/label.d.ts +5 -3
- package/dist/theme/components/link.d.ts +4 -0
- package/dist/theme/components/list.d.ts +5 -1
- package/dist/theme/components/notification.d.ts +4 -14
- package/dist/theme/components/pagination.d.ts +19 -0
- package/dist/theme/components/progressIndicator.d.ts +50 -0
- package/dist/theme/components/radioGroup.d.ts +12 -0
- package/dist/theme/components/select.d.ts +11 -2
- package/dist/theme/components/skeletonLoader.d.ts +98 -0
- package/dist/theme/components/slider.d.ts +51 -0
- package/dist/theme/components/textInput.d.ts +8 -0
- package/dist/theme/foundations/breakpoints.d.ts +8 -8
- package/dist/theme/foundations/global.d.ts +6 -1
- package/package.json +72 -84
- package/src/__tests__/setup.ts +2 -2
- package/src/components/Accordion/Accordion.stories.mdx +39 -42
- package/src/components/Autosuggest/Autosuggest.stories.mdx +3 -3
- package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -0
- package/src/components/Autosuggest/_Autosuggest.scss +5 -5
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +24 -8
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +33 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +5 -1
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +298 -1
- package/src/components/Button/Button.stories.mdx +15 -10
- package/src/components/Button/Button.test.tsx +21 -7
- package/src/components/Button/Button.tsx +18 -33
- package/src/components/Button/ButtonTypes.tsx +1 -0
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +41 -10
- package/src/components/Card/Card.stories.mdx +296 -259
- package/src/components/Card/Card.test.tsx +156 -84
- package/src/components/Card/Card.tsx +195 -145
- package/src/components/Card/CardTypes.tsx +0 -17
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +410 -0
- package/src/components/CardEdition/CardEdition.stories.tsx +15 -47
- package/src/components/CardEdition/_CardEdition.scss +22 -23
- package/src/components/Chakra/Box.stories.mdx +14 -15
- package/src/components/Chakra/Center.stories.mdx +15 -8
- package/src/components/Chakra/Grid.stories.mdx +16 -7
- package/src/components/Chakra/Stack.stories.mdx +35 -18
- package/src/components/Checkbox/Checkbox.stories.mdx +33 -11
- package/src/components/Checkbox/Checkbox.test.tsx +30 -3
- package/src/components/Checkbox/Checkbox.tsx +27 -27
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +90 -2
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +82 -2
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -1
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +14 -15
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +44 -80
- package/src/components/DatePicker/DatePicker.stories.mdx +163 -62
- package/src/components/DatePicker/DatePicker.test.tsx +248 -65
- package/src/components/DatePicker/DatePicker.tsx +158 -130
- package/src/components/DatePicker/_DatePicker.scss +33 -67
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +818 -0
- package/src/components/Fieldset/Fieldset.stories.mdx +55 -0
- package/src/components/Fieldset/Fieldset.test.tsx +125 -0
- package/src/components/Fieldset/Fieldset.tsx +52 -0
- package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +68 -0
- package/src/components/Form/Form.stories.mdx +4 -5
- package/src/components/Form/Form.tsx +1 -0
- package/src/components/Grid/SimpleGrid.stories.mdx +32 -39
- package/src/components/Grid/SimpleGrid.test.tsx +4 -4
- package/src/components/Heading/Heading.stories.mdx +3 -4
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -1
- package/src/components/HelperErrorText/HelperErrorText.tsx +5 -1
- package/src/components/Hero/HeroTypes.tsx +1 -0
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +7 -7
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +6 -5
- package/src/components/HorizontalRule/HorizontalRule.test.tsx +17 -0
- package/src/components/HorizontalRule/HorizontalRule.tsx +21 -4
- package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +5 -5
- package/src/components/Icons/Icon.stories.mdx +11 -3
- package/src/components/Icons/Icon.test.tsx +18 -0
- package/src/components/Icons/Icon.tsx +6 -0
- package/src/components/Icons/IconSvgs.tsx +22 -0
- package/src/components/Icons/IconTypes.tsx +11 -0
- package/src/components/Image/Image.stories.mdx +220 -0
- package/src/components/Image/Image.test.tsx +131 -29
- package/src/components/Image/Image.tsx +84 -56
- package/src/components/Image/ImageTypes.ts +22 -0
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +190 -0
- package/src/components/Input/Input.stories.tsx +20 -64
- package/src/components/Input/_Input.scss +23 -14
- package/src/components/Link/Link.tsx +4 -1
- package/src/components/List/List.stories.mdx +1 -1
- package/src/components/List/List.tsx +11 -4
- package/src/components/Modal/Modal.stories.mdx +3 -3
- package/src/components/Modal/_Modal.scss +2 -2
- package/src/components/Notification/Notification.stories.mdx +1 -3
- package/src/components/Notification/Notification.tsx +24 -9
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +2 -0
- package/src/components/Pagination/Pagination.stories.mdx +26 -27
- package/src/components/Pagination/Pagination.stories.tsx +11 -16
- package/src/components/Pagination/Pagination.test.tsx +276 -146
- package/src/components/Pagination/Pagination.tsx +174 -154
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +285 -0
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +292 -0
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +225 -0
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +126 -0
- package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +8 -0
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +357 -0
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +3 -0
- package/src/components/RadioGroup/RadioGroup.stories.mdx +3 -4
- package/src/components/RadioGroup/RadioGroup.tsx +11 -16
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +39 -71
- package/src/components/SearchBar/SearchBar.Test.tsx +66 -21
- package/src/components/SearchBar/SearchBar.stories.mdx +114 -10
- package/src/components/SearchBar/SearchBar.tsx +15 -5
- package/src/components/Select/SelectTypes.tsx +1 -0
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +28 -59
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +97 -177
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +74 -71
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +739 -0
- package/src/components/Slider/Slider.stories.mdx +529 -0
- package/src/components/Slider/Slider.test.tsx +653 -0
- package/src/components/Slider/Slider.tsx +303 -0
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +1946 -0
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +1 -1
- package/src/components/StyleGuide/Breakpoints.stories.mdx +21 -7
- package/src/components/StyleGuide/Buttons.stories.mdx +69 -15
- package/src/components/StyleGuide/ColorCard.tsx +0 -1
- package/src/components/StyleGuide/DesignTokens.stories.mdx +170 -0
- package/src/components/StyleGuide/Iconography.stories.mdx +51 -62
- package/src/components/Tabs/Tabs.tsx +5 -5
- package/src/components/Template/Template.stories.mdx +11 -16
- package/src/components/TextInput/TextInput.stories.mdx +1 -1
- package/src/components/TextInput/TextInput.tsx +23 -6
- package/src/components/TextInput/TextInputTypes.tsx +2 -0
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +2 -3
- package/src/docs/Chakra.stories.mdx +2 -2
- package/src/index.ts +20 -12
- package/src/resources.scss +5 -5
- package/src/styles/base/{_02-breakpoints.scss → _01-breakpoints.scss} +9 -10
- package/src/styles/base/{_03-mixins.scss → _02-mixins.scss} +16 -5
- package/src/styles/base/{_04-base.scss → _03-base.scss} +7 -2
- package/src/styles/base/{_05-focus.scss → _04-focus.scss} +0 -15
- package/src/styles/base/_place-holder.scss +14 -3
- package/src/styles/{03-space → space}/_space-inline.scss +14 -14
- package/src/styles/{03-space → space}/_space-inset.scss +10 -10
- package/src/styles/space/_space-stack.scss +116 -0
- package/src/styles.scss +13 -55
- package/src/theme/components/breadcrumb.ts +10 -0
- package/src/theme/components/button.ts +18 -12
- package/src/theme/components/card.ts +174 -0
- package/src/theme/components/checkbox.ts +7 -2
- package/src/theme/components/checkboxGroup.ts +8 -0
- package/src/theme/components/datePicker.ts +17 -0
- package/src/theme/components/fieldset.ts +18 -0
- package/src/theme/components/global.ts +26 -15
- package/src/theme/components/globalMixins.ts +9 -1
- package/src/theme/components/heading.ts +5 -0
- package/src/theme/components/image.ts +116 -0
- package/src/theme/components/label.ts +3 -10
- package/src/theme/components/link.ts +4 -0
- package/src/theme/components/list.ts +6 -3
- package/src/theme/components/notification.ts +12 -14
- package/src/theme/components/pagination.ts +20 -0
- package/src/theme/components/progressIndicator.ts +62 -0
- package/src/theme/components/radioGroup.ts +8 -0
- package/src/theme/components/select.ts +5 -2
- package/src/theme/components/skeletonLoader.ts +107 -0
- package/src/theme/components/slider.ts +79 -0
- package/src/theme/components/textInput.ts +2 -0
- package/src/theme/foundations/breakpoints.ts +8 -8
- package/src/theme/foundations/global.ts +6 -1
- package/src/theme/index.ts +22 -4
- package/src/utils/componentCategories.ts +4 -3
- package/dist/components/Image/Image.stories.d.ts +0 -18
- package/dist/theme/components/customCheckboxGroup.d.ts +0 -18
- package/dist/theme/components/customRadioGroup.d.ts +0 -18
- package/src/components/Button/_Button.scss +0 -32
- package/src/components/Card/_Card.scss +0 -308
- package/src/components/Image/Image.stories.tsx +0 -54
- package/src/components/Image/_Image.scss +0 -38
- package/src/components/Pagination/_Pagination.scss +0 -40
- package/src/components/SkeletonLoader/_SkeletonLoader.scss +0 -142
- package/src/styles/01-colors/_colors-brand.scss +0 -62
- package/src/styles/01-colors/_colors-utility.scss +0 -67
- package/src/styles/02-typography/_type-scale.css +0 -11
- package/src/styles/02-typography/_type-weight.css +0 -7
- package/src/styles/02-typography/_typefaces.css +0 -4
- package/src/styles/03-space/_space-stack.scss +0 -116
- package/src/styles/03-space/_space.css +0 -30
- package/src/styles/base/_card-grid.scss +0 -77
- package/src/styles/base/_typography.scss +0 -11
- package/src/theme/components/customCheckboxGroup.ts +0 -12
- package/src/theme/components/customRadioGroup.ts +0 -12
|
@@ -39,7 +39,7 @@ import Checkbox from "../Checkbox/Checkbox";
|
|
|
39
39
|
| Component Version | DS Version |
|
|
40
40
|
| ----------------- | ---------- |
|
|
41
41
|
| Added | `0.25.1` |
|
|
42
|
-
| Latest | `0.25.
|
|
42
|
+
| Latest | `0.25.3` |
|
|
43
43
|
|
|
44
44
|
<Description of={CheckboxGroup} />
|
|
45
45
|
|
|
@@ -48,8 +48,8 @@ import Checkbox from "../Checkbox/Checkbox";
|
|
|
48
48
|
name="CheckboxGroup"
|
|
49
49
|
args={{
|
|
50
50
|
defaultValue: ["4"],
|
|
51
|
-
invalidText: "This is the error text :(",
|
|
52
51
|
helperText: "This is the helper text for the full group.",
|
|
52
|
+
invalidText: "This is the error text :(",
|
|
53
53
|
isDisabled: false,
|
|
54
54
|
isInvalid: false,
|
|
55
55
|
isRequired: false,
|
|
@@ -57,6 +57,7 @@ import Checkbox from "../Checkbox/Checkbox";
|
|
|
57
57
|
layout: CheckboxGroupLayoutTypes.Column,
|
|
58
58
|
name: "checkbox-story",
|
|
59
59
|
optReqFlag: true,
|
|
60
|
+
showHelperInvalidText: true,
|
|
60
61
|
showLabel: true,
|
|
61
62
|
}}
|
|
62
63
|
>
|
|
@@ -143,6 +144,85 @@ a row.
|
|
|
143
144
|
</DSProvider>
|
|
144
145
|
</Canvas>
|
|
145
146
|
|
|
147
|
+
## Indeterminate Example
|
|
148
|
+
|
|
149
|
+
The "indeterminate" state can be used when a group of checkboxes are not all
|
|
150
|
+
checked or unchecked. In the following example, if only one child checkebox is
|
|
151
|
+
checked, the parent checkbox will be in the "indeterminate" state. Once both
|
|
152
|
+
children are checked, the parent will be in the "checked" state.
|
|
153
|
+
|
|
154
|
+
The following working example can be used in your application to keep track of
|
|
155
|
+
the checked and indeterminate states - taken and modified from Chakra's
|
|
156
|
+
[Checkbox](https://chakra-ui.com/docs/form/checkbox#indeterminate) documentation.
|
|
157
|
+
Note that this example is specifically using NYPL DS `Checkbox` and
|
|
158
|
+
`CheckboxGroup` components.
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
export function IndeterminateExample() {
|
|
162
|
+
const [checkedItems, setCheckedItems] = React.useState([false, false]);
|
|
163
|
+
const allChecked = checkedItems.every(Boolean);
|
|
164
|
+
const isIndeterminate = checkedItems.some(Boolean) && !allChecked;
|
|
165
|
+
return (
|
|
166
|
+
<CheckboxGroup
|
|
167
|
+
labelText="Indeterminate Example"
|
|
168
|
+
name="indeterminate-example"
|
|
169
|
+
>
|
|
170
|
+
<Checkbox
|
|
171
|
+
isChecked={allChecked}
|
|
172
|
+
isIndeterminate={isIndeterminate}
|
|
173
|
+
onChange={(e) => setCheckedItems([e.target.checked, e.target.checked])}
|
|
174
|
+
labelText="Parent Checkbox"
|
|
175
|
+
/>
|
|
176
|
+
<Checkbox
|
|
177
|
+
isChecked={checkedItems[0]}
|
|
178
|
+
onChange={(e) => setCheckedItems([e.target.checked, checkedItems[1]])}
|
|
179
|
+
labelText="Child Checkbox 1"
|
|
180
|
+
/>
|
|
181
|
+
<Checkbox
|
|
182
|
+
isChecked={checkedItems[1]}
|
|
183
|
+
onChange={(e) => setCheckedItems([checkedItems[0], e.target.checked])}
|
|
184
|
+
labelText="Child Checkbox 2"
|
|
185
|
+
/>
|
|
186
|
+
</CheckboxGroup>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
export function IndeterminateExample() {
|
|
192
|
+
const [checkedItems, setCheckedItems] = React.useState([false, false]);
|
|
193
|
+
const allChecked = checkedItems.every(Boolean);
|
|
194
|
+
const isIndeterminate = checkedItems.some(Boolean) && !allChecked;
|
|
195
|
+
return (
|
|
196
|
+
<CheckboxGroup
|
|
197
|
+
labelText="Indeterminate Example"
|
|
198
|
+
name="indeterminate-example"
|
|
199
|
+
>
|
|
200
|
+
<Checkbox
|
|
201
|
+
isChecked={allChecked}
|
|
202
|
+
isIndeterminate={isIndeterminate}
|
|
203
|
+
onChange={(e) => setCheckedItems([e.target.checked, e.target.checked])}
|
|
204
|
+
labelText="Parent Checkbox"
|
|
205
|
+
/>
|
|
206
|
+
<Checkbox
|
|
207
|
+
isChecked={checkedItems[0]}
|
|
208
|
+
onChange={(e) => setCheckedItems([e.target.checked, checkedItems[1]])}
|
|
209
|
+
labelText="Child Checkbox 1"
|
|
210
|
+
/>
|
|
211
|
+
<Checkbox
|
|
212
|
+
isChecked={checkedItems[1]}
|
|
213
|
+
onChange={(e) => setCheckedItems([checkedItems[0], e.target.checked])}
|
|
214
|
+
labelText="Child Checkbox 2"
|
|
215
|
+
/>
|
|
216
|
+
</CheckboxGroup>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
<Canvas>
|
|
221
|
+
<DSProvider>
|
|
222
|
+
<IndeterminateExample />
|
|
223
|
+
</DSProvider>
|
|
224
|
+
</Canvas>
|
|
225
|
+
|
|
146
226
|
## Getting Checkbox Data Values
|
|
147
227
|
|
|
148
228
|
### Controlled Component using `name`, `defaultValue`, and `onChange` props
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import {
|
|
3
3
|
Box,
|
|
4
|
-
Stack,
|
|
5
4
|
CheckboxGroup as ChakraCheckboxGroup,
|
|
5
|
+
Stack,
|
|
6
6
|
useMultiStyleConfig,
|
|
7
7
|
} from "@chakra-ui/react";
|
|
8
8
|
|
|
@@ -11,18 +11,19 @@ import generateUUID from "../../helpers/generateUUID";
|
|
|
11
11
|
import { spacing } from "../../theme/foundations/spacing";
|
|
12
12
|
import { CheckboxGroupLayoutTypes } from "./CheckboxGroupLayoutTypes";
|
|
13
13
|
import Checkbox from "../Checkbox/Checkbox";
|
|
14
|
+
import Fieldset from "../Fieldset/Fieldset";
|
|
14
15
|
|
|
15
16
|
export interface CheckboxGroupProps {
|
|
16
17
|
/** Any child node passed to the component. */
|
|
17
18
|
children: React.ReactNode;
|
|
18
19
|
/** Populates the initial value of the input */
|
|
19
20
|
defaultValue?: string[];
|
|
20
|
-
/** Optional string to populate the HelperErrorText for error state */
|
|
21
|
-
invalidText?: string;
|
|
22
21
|
/** Optional string to populate the HelperErrorText for standard state */
|
|
23
22
|
helperText?: string;
|
|
24
23
|
/** ID that other components can cross reference for accessibility purposes */
|
|
25
24
|
id?: string;
|
|
25
|
+
/** Optional string to populate the HelperErrorText for error state */
|
|
26
|
+
invalidText?: string;
|
|
26
27
|
/** Adds the 'disabled' prop to the input when true. */
|
|
27
28
|
isDisabled?: boolean;
|
|
28
29
|
/** A`dds the 'aria-invalid' attribute to the input and
|
|
@@ -113,19 +114,16 @@ const CheckboxGroup = React.forwardRef<HTMLInputElement, CheckboxGroupProps>(
|
|
|
113
114
|
}
|
|
114
115
|
});
|
|
115
116
|
|
|
116
|
-
// Get the Chakra-based styles for
|
|
117
|
-
const styles = useMultiStyleConfig("
|
|
117
|
+
// Get the Chakra-based styles for the custom elements in this component.
|
|
118
|
+
const styles = useMultiStyleConfig("CheckboxGroup", {});
|
|
118
119
|
|
|
119
120
|
return (
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
</Box>
|
|
127
|
-
)}
|
|
128
|
-
</legend>
|
|
121
|
+
<Fieldset
|
|
122
|
+
id={`${id}-checkbox-group`}
|
|
123
|
+
isLegendHidden={!showLabel}
|
|
124
|
+
legendText={labelText}
|
|
125
|
+
optReqFlag={optReqFlag}
|
|
126
|
+
>
|
|
129
127
|
<ChakraCheckboxGroup {...checkboxProps}>
|
|
130
128
|
<Stack
|
|
131
129
|
id={id}
|
|
@@ -134,6 +132,7 @@ const CheckboxGroup = React.forwardRef<HTMLInputElement, CheckboxGroupProps>(
|
|
|
134
132
|
spacing={spacingProp}
|
|
135
133
|
ref={ref}
|
|
136
134
|
aria-label={!showLabel ? labelText : null}
|
|
135
|
+
sx={styles.stack}
|
|
137
136
|
>
|
|
138
137
|
{newChildren}
|
|
139
138
|
</Stack>
|
|
@@ -145,7 +144,7 @@ const CheckboxGroup = React.forwardRef<HTMLInputElement, CheckboxGroupProps>(
|
|
|
145
144
|
</HelperErrorText>
|
|
146
145
|
</Box>
|
|
147
146
|
)}
|
|
148
|
-
</
|
|
147
|
+
</Fieldset>
|
|
149
148
|
);
|
|
150
149
|
}
|
|
151
150
|
);
|
|
@@ -3,19 +3,15 @@
|
|
|
3
3
|
exports[`Checkbox renders the UI snapshot correctly 1`] = `
|
|
4
4
|
<fieldset
|
|
5
5
|
className="css-0"
|
|
6
|
-
id="checkbox-group
|
|
6
|
+
id="column-checkbox-group"
|
|
7
7
|
>
|
|
8
|
-
<legend
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<span>
|
|
12
|
-
column
|
|
13
|
-
</span>
|
|
14
|
-
<span
|
|
8
|
+
<legend>
|
|
9
|
+
column
|
|
10
|
+
<div
|
|
15
11
|
className="css-0"
|
|
16
12
|
>
|
|
17
13
|
Optional
|
|
18
|
-
</
|
|
14
|
+
</div>
|
|
19
15
|
</legend>
|
|
20
16
|
<div
|
|
21
17
|
aria-label={null}
|
|
@@ -152,19 +148,15 @@ exports[`Checkbox renders the UI snapshot correctly 1`] = `
|
|
|
152
148
|
exports[`Checkbox renders the UI snapshot correctly 2`] = `
|
|
153
149
|
<fieldset
|
|
154
150
|
className="css-0"
|
|
155
|
-
id="checkbox-group
|
|
151
|
+
id="row-checkbox-group"
|
|
156
152
|
>
|
|
157
|
-
<legend
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
<span>
|
|
161
|
-
row
|
|
162
|
-
</span>
|
|
163
|
-
<span
|
|
153
|
+
<legend>
|
|
154
|
+
row
|
|
155
|
+
<div
|
|
164
156
|
className="css-0"
|
|
165
157
|
>
|
|
166
158
|
Optional
|
|
167
|
-
</
|
|
159
|
+
</div>
|
|
168
160
|
</legend>
|
|
169
161
|
<div
|
|
170
162
|
aria-label={null}
|
|
@@ -301,19 +293,15 @@ exports[`Checkbox renders the UI snapshot correctly 2`] = `
|
|
|
301
293
|
exports[`Checkbox renders the UI snapshot correctly 3`] = `
|
|
302
294
|
<fieldset
|
|
303
295
|
className="css-0"
|
|
304
|
-
id="checkbox-group
|
|
296
|
+
id="noLabel-checkbox-group"
|
|
305
297
|
>
|
|
306
|
-
<legend
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
<span>
|
|
310
|
-
no label
|
|
311
|
-
</span>
|
|
312
|
-
<span
|
|
298
|
+
<legend>
|
|
299
|
+
no label
|
|
300
|
+
<div
|
|
313
301
|
className="css-0"
|
|
314
302
|
>
|
|
315
303
|
Optional
|
|
316
|
-
</
|
|
304
|
+
</div>
|
|
317
305
|
</legend>
|
|
318
306
|
<div
|
|
319
307
|
aria-label="no label"
|
|
@@ -450,19 +438,15 @@ exports[`Checkbox renders the UI snapshot correctly 3`] = `
|
|
|
450
438
|
exports[`Checkbox renders the UI snapshot correctly 4`] = `
|
|
451
439
|
<fieldset
|
|
452
440
|
className="css-0"
|
|
453
|
-
id="checkbox-group
|
|
441
|
+
id="helperText-checkbox-group"
|
|
454
442
|
>
|
|
455
|
-
<legend
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
<span>
|
|
459
|
-
helperText
|
|
460
|
-
</span>
|
|
461
|
-
<span
|
|
443
|
+
<legend>
|
|
444
|
+
helperText
|
|
445
|
+
<div
|
|
462
446
|
className="css-0"
|
|
463
447
|
>
|
|
464
448
|
Optional
|
|
465
|
-
</
|
|
449
|
+
</div>
|
|
466
450
|
</legend>
|
|
467
451
|
<div
|
|
468
452
|
aria-label={null}
|
|
@@ -612,19 +596,15 @@ exports[`Checkbox renders the UI snapshot correctly 4`] = `
|
|
|
612
596
|
exports[`Checkbox renders the UI snapshot correctly 5`] = `
|
|
613
597
|
<fieldset
|
|
614
598
|
className="css-0"
|
|
615
|
-
id="checkbox-group
|
|
599
|
+
id="invalidText-checkbox-group"
|
|
616
600
|
>
|
|
617
|
-
<legend
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
<span>
|
|
621
|
-
invalidText
|
|
622
|
-
</span>
|
|
623
|
-
<span
|
|
601
|
+
<legend>
|
|
602
|
+
invalidText
|
|
603
|
+
<div
|
|
624
604
|
className="css-0"
|
|
625
605
|
>
|
|
626
606
|
Optional
|
|
627
|
-
</
|
|
607
|
+
</div>
|
|
628
608
|
</legend>
|
|
629
609
|
<div
|
|
630
610
|
aria-label={null}
|
|
@@ -761,14 +741,10 @@ exports[`Checkbox renders the UI snapshot correctly 5`] = `
|
|
|
761
741
|
exports[`Checkbox renders the UI snapshot correctly 6`] = `
|
|
762
742
|
<fieldset
|
|
763
743
|
className="css-0"
|
|
764
|
-
id="checkbox-group
|
|
744
|
+
id="optReq-checkbox-group"
|
|
765
745
|
>
|
|
766
|
-
<legend
|
|
767
|
-
|
|
768
|
-
>
|
|
769
|
-
<span>
|
|
770
|
-
no optional or required label
|
|
771
|
-
</span>
|
|
746
|
+
<legend>
|
|
747
|
+
no optional or required label
|
|
772
748
|
</legend>
|
|
773
749
|
<div
|
|
774
750
|
aria-label={null}
|
|
@@ -905,19 +881,15 @@ exports[`Checkbox renders the UI snapshot correctly 6`] = `
|
|
|
905
881
|
exports[`Checkbox renders the UI snapshot correctly 7`] = `
|
|
906
882
|
<fieldset
|
|
907
883
|
className="css-0"
|
|
908
|
-
id="checkbox-group
|
|
884
|
+
id="required-checkbox-group"
|
|
909
885
|
>
|
|
910
|
-
<legend
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
<span>
|
|
914
|
-
required
|
|
915
|
-
</span>
|
|
916
|
-
<span
|
|
886
|
+
<legend>
|
|
887
|
+
required
|
|
888
|
+
<div
|
|
917
889
|
className="css-0"
|
|
918
890
|
>
|
|
919
|
-
|
|
920
|
-
</
|
|
891
|
+
Optional
|
|
892
|
+
</div>
|
|
921
893
|
</legend>
|
|
922
894
|
<div
|
|
923
895
|
aria-label={null}
|
|
@@ -1054,19 +1026,15 @@ exports[`Checkbox renders the UI snapshot correctly 7`] = `
|
|
|
1054
1026
|
exports[`Checkbox renders the UI snapshot correctly 8`] = `
|
|
1055
1027
|
<fieldset
|
|
1056
1028
|
className="css-0"
|
|
1057
|
-
id="checkbox-group
|
|
1029
|
+
id="invalid-checkbox-group"
|
|
1058
1030
|
>
|
|
1059
|
-
<legend
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
<span>
|
|
1063
|
-
invalid
|
|
1064
|
-
</span>
|
|
1065
|
-
<span
|
|
1031
|
+
<legend>
|
|
1032
|
+
invalid
|
|
1033
|
+
<div
|
|
1066
1034
|
className="css-0"
|
|
1067
1035
|
>
|
|
1068
1036
|
Optional
|
|
1069
|
-
</
|
|
1037
|
+
</div>
|
|
1070
1038
|
</legend>
|
|
1071
1039
|
<div
|
|
1072
1040
|
aria-label={null}
|
|
@@ -1209,19 +1177,15 @@ exports[`Checkbox renders the UI snapshot correctly 8`] = `
|
|
|
1209
1177
|
exports[`Checkbox renders the UI snapshot correctly 9`] = `
|
|
1210
1178
|
<fieldset
|
|
1211
1179
|
className="css-0"
|
|
1212
|
-
id="checkbox-group
|
|
1180
|
+
id="disabled-checkbox-group"
|
|
1213
1181
|
>
|
|
1214
|
-
<legend
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
<span>
|
|
1218
|
-
disabled
|
|
1219
|
-
</span>
|
|
1220
|
-
<span
|
|
1182
|
+
<legend>
|
|
1183
|
+
disabled
|
|
1184
|
+
<div
|
|
1221
1185
|
className="css-0"
|
|
1222
1186
|
>
|
|
1223
1187
|
Optional
|
|
1224
|
-
</
|
|
1188
|
+
</div>
|
|
1225
1189
|
</legend>
|
|
1226
1190
|
<div
|
|
1227
1191
|
aria-label={null}
|