@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.
Files changed (238) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +47 -11
  3. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +4 -0
  4. package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -0
  5. package/dist/components/Button/Button.d.ts +9 -8
  6. package/dist/components/Button/ButtonTypes.d.ts +2 -1
  7. package/dist/components/Card/Card.d.ts +36 -52
  8. package/dist/components/Card/CardTypes.d.ts +0 -15
  9. package/dist/components/Checkbox/Checkbox.d.ts +8 -9
  10. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +2 -2
  11. package/dist/components/DatePicker/DatePicker.d.ts +36 -36
  12. package/dist/components/Fieldset/Fieldset.d.ts +25 -0
  13. package/dist/components/HelperErrorText/HelperErrorText.d.ts +4 -0
  14. package/dist/components/HorizontalRule/HorizontalRule.d.ts +10 -3
  15. package/dist/components/Icons/Icon.d.ts +4 -0
  16. package/dist/components/Icons/IconSvgs.d.ts +11 -0
  17. package/dist/components/Icons/IconTypes.d.ts +11 -0
  18. package/dist/components/Image/Image.d.ts +19 -9
  19. package/dist/components/Image/ImageTypes.d.ts +20 -0
  20. package/dist/components/Link/Link.d.ts +4 -0
  21. package/dist/components/List/List.d.ts +7 -1
  22. package/dist/components/Notification/Notification.d.ts +6 -4
  23. package/dist/components/Pagination/Pagination.d.ts +16 -13
  24. package/dist/components/Pagination/Pagination.stories.d.ts +2 -0
  25. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +29 -0
  26. package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +8 -0
  27. package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
  28. package/dist/components/SearchBar/SearchBar.d.ts +3 -3
  29. package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +18 -14
  30. package/dist/components/Slider/Slider.d.ts +57 -0
  31. package/dist/components/Tabs/Tabs.d.ts +1 -1
  32. package/dist/components/TextInput/TextInput.d.ts +10 -0
  33. package/dist/design-system-react-components.cjs.development.js +3058 -936
  34. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  35. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  36. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  37. package/dist/design-system-react-components.esm.js +3049 -921
  38. package/dist/design-system-react-components.esm.js.map +1 -1
  39. package/dist/index.d.ts +12 -6
  40. package/dist/resources.scss +180 -170
  41. package/dist/styles.css +1 -1
  42. package/dist/theme/components/breadcrumb.d.ts +9 -0
  43. package/dist/theme/components/button.d.ts +22 -8
  44. package/dist/theme/components/card.d.ts +168 -0
  45. package/dist/theme/components/checkbox.d.ts +5 -1
  46. package/dist/theme/components/checkboxGroup.d.ts +12 -0
  47. package/dist/theme/components/datePicker.d.ts +16 -0
  48. package/dist/theme/components/fieldset.d.ts +27 -0
  49. package/dist/theme/components/global.d.ts +23 -13
  50. package/dist/theme/components/globalMixins.d.ts +9 -1
  51. package/dist/theme/components/heading.d.ts +5 -0
  52. package/dist/theme/components/image.d.ts +31 -0
  53. package/dist/theme/components/label.d.ts +5 -3
  54. package/dist/theme/components/link.d.ts +4 -0
  55. package/dist/theme/components/list.d.ts +5 -1
  56. package/dist/theme/components/notification.d.ts +4 -14
  57. package/dist/theme/components/pagination.d.ts +19 -0
  58. package/dist/theme/components/progressIndicator.d.ts +50 -0
  59. package/dist/theme/components/radioGroup.d.ts +12 -0
  60. package/dist/theme/components/select.d.ts +11 -2
  61. package/dist/theme/components/skeletonLoader.d.ts +98 -0
  62. package/dist/theme/components/slider.d.ts +51 -0
  63. package/dist/theme/components/textInput.d.ts +8 -0
  64. package/dist/theme/foundations/breakpoints.d.ts +8 -8
  65. package/dist/theme/foundations/global.d.ts +6 -1
  66. package/package.json +72 -84
  67. package/src/__tests__/setup.ts +2 -2
  68. package/src/components/Accordion/Accordion.stories.mdx +39 -42
  69. package/src/components/Autosuggest/Autosuggest.stories.mdx +3 -3
  70. package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -0
  71. package/src/components/Autosuggest/_Autosuggest.scss +5 -5
  72. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +24 -8
  73. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +33 -0
  74. package/src/components/Breadcrumbs/Breadcrumbs.tsx +5 -1
  75. package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -0
  76. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +298 -1
  77. package/src/components/Button/Button.stories.mdx +15 -10
  78. package/src/components/Button/Button.test.tsx +21 -7
  79. package/src/components/Button/Button.tsx +18 -33
  80. package/src/components/Button/ButtonTypes.tsx +1 -0
  81. package/src/components/Button/__snapshots__/Button.test.tsx.snap +41 -10
  82. package/src/components/Card/Card.stories.mdx +296 -259
  83. package/src/components/Card/Card.test.tsx +156 -84
  84. package/src/components/Card/Card.tsx +195 -145
  85. package/src/components/Card/CardTypes.tsx +0 -17
  86. package/src/components/Card/__snapshots__/Card.test.tsx.snap +410 -0
  87. package/src/components/CardEdition/CardEdition.stories.tsx +15 -47
  88. package/src/components/CardEdition/_CardEdition.scss +22 -23
  89. package/src/components/Chakra/Box.stories.mdx +14 -15
  90. package/src/components/Chakra/Center.stories.mdx +15 -8
  91. package/src/components/Chakra/Grid.stories.mdx +16 -7
  92. package/src/components/Chakra/Stack.stories.mdx +35 -18
  93. package/src/components/Checkbox/Checkbox.stories.mdx +33 -11
  94. package/src/components/Checkbox/Checkbox.test.tsx +30 -3
  95. package/src/components/Checkbox/Checkbox.tsx +27 -27
  96. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +90 -2
  97. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +82 -2
  98. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -1
  99. package/src/components/CheckboxGroup/CheckboxGroup.tsx +14 -15
  100. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +44 -80
  101. package/src/components/DatePicker/DatePicker.stories.mdx +163 -62
  102. package/src/components/DatePicker/DatePicker.test.tsx +248 -65
  103. package/src/components/DatePicker/DatePicker.tsx +158 -130
  104. package/src/components/DatePicker/_DatePicker.scss +33 -67
  105. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +818 -0
  106. package/src/components/Fieldset/Fieldset.stories.mdx +55 -0
  107. package/src/components/Fieldset/Fieldset.test.tsx +125 -0
  108. package/src/components/Fieldset/Fieldset.tsx +52 -0
  109. package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +68 -0
  110. package/src/components/Form/Form.stories.mdx +4 -5
  111. package/src/components/Form/Form.tsx +1 -0
  112. package/src/components/Grid/SimpleGrid.stories.mdx +32 -39
  113. package/src/components/Grid/SimpleGrid.test.tsx +4 -4
  114. package/src/components/Heading/Heading.stories.mdx +3 -4
  115. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -1
  116. package/src/components/HelperErrorText/HelperErrorText.tsx +5 -1
  117. package/src/components/Hero/HeroTypes.tsx +1 -0
  118. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +7 -7
  119. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +6 -5
  120. package/src/components/HorizontalRule/HorizontalRule.test.tsx +17 -0
  121. package/src/components/HorizontalRule/HorizontalRule.tsx +21 -4
  122. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +5 -5
  123. package/src/components/Icons/Icon.stories.mdx +11 -3
  124. package/src/components/Icons/Icon.test.tsx +18 -0
  125. package/src/components/Icons/Icon.tsx +6 -0
  126. package/src/components/Icons/IconSvgs.tsx +22 -0
  127. package/src/components/Icons/IconTypes.tsx +11 -0
  128. package/src/components/Image/Image.stories.mdx +220 -0
  129. package/src/components/Image/Image.test.tsx +131 -29
  130. package/src/components/Image/Image.tsx +84 -56
  131. package/src/components/Image/ImageTypes.ts +22 -0
  132. package/src/components/Image/__snapshots__/Image.test.tsx.snap +190 -0
  133. package/src/components/Input/Input.stories.tsx +20 -64
  134. package/src/components/Input/_Input.scss +23 -14
  135. package/src/components/Link/Link.tsx +4 -1
  136. package/src/components/List/List.stories.mdx +1 -1
  137. package/src/components/List/List.tsx +11 -4
  138. package/src/components/Modal/Modal.stories.mdx +3 -3
  139. package/src/components/Modal/_Modal.scss +2 -2
  140. package/src/components/Notification/Notification.stories.mdx +1 -3
  141. package/src/components/Notification/Notification.tsx +24 -9
  142. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +2 -0
  143. package/src/components/Pagination/Pagination.stories.mdx +26 -27
  144. package/src/components/Pagination/Pagination.stories.tsx +11 -16
  145. package/src/components/Pagination/Pagination.test.tsx +276 -146
  146. package/src/components/Pagination/Pagination.tsx +174 -154
  147. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +285 -0
  148. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +292 -0
  149. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +225 -0
  150. package/src/components/ProgressIndicator/ProgressIndicator.tsx +126 -0
  151. package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +8 -0
  152. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +357 -0
  153. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +3 -0
  154. package/src/components/RadioGroup/RadioGroup.stories.mdx +3 -4
  155. package/src/components/RadioGroup/RadioGroup.tsx +11 -16
  156. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +39 -71
  157. package/src/components/SearchBar/SearchBar.Test.tsx +66 -21
  158. package/src/components/SearchBar/SearchBar.stories.mdx +114 -10
  159. package/src/components/SearchBar/SearchBar.tsx +15 -5
  160. package/src/components/Select/SelectTypes.tsx +1 -0
  161. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +28 -59
  162. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +97 -177
  163. package/src/components/SkeletonLoader/SkeletonLoader.tsx +74 -71
  164. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +739 -0
  165. package/src/components/Slider/Slider.stories.mdx +529 -0
  166. package/src/components/Slider/Slider.test.tsx +653 -0
  167. package/src/components/Slider/Slider.tsx +303 -0
  168. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +1946 -0
  169. package/src/components/StyleGuide/Bidirectionality.stories.mdx +1 -1
  170. package/src/components/StyleGuide/Breakpoints.stories.mdx +21 -7
  171. package/src/components/StyleGuide/Buttons.stories.mdx +69 -15
  172. package/src/components/StyleGuide/ColorCard.tsx +0 -1
  173. package/src/components/StyleGuide/DesignTokens.stories.mdx +170 -0
  174. package/src/components/StyleGuide/Iconography.stories.mdx +51 -62
  175. package/src/components/Tabs/Tabs.tsx +5 -5
  176. package/src/components/Template/Template.stories.mdx +11 -16
  177. package/src/components/TextInput/TextInput.stories.mdx +1 -1
  178. package/src/components/TextInput/TextInput.tsx +23 -6
  179. package/src/components/TextInput/TextInputTypes.tsx +2 -0
  180. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +2 -3
  181. package/src/docs/Chakra.stories.mdx +2 -2
  182. package/src/index.ts +20 -12
  183. package/src/resources.scss +5 -5
  184. package/src/styles/base/{_02-breakpoints.scss → _01-breakpoints.scss} +9 -10
  185. package/src/styles/base/{_03-mixins.scss → _02-mixins.scss} +16 -5
  186. package/src/styles/base/{_04-base.scss → _03-base.scss} +7 -2
  187. package/src/styles/base/{_05-focus.scss → _04-focus.scss} +0 -15
  188. package/src/styles/base/_place-holder.scss +14 -3
  189. package/src/styles/{03-space → space}/_space-inline.scss +14 -14
  190. package/src/styles/{03-space → space}/_space-inset.scss +10 -10
  191. package/src/styles/space/_space-stack.scss +116 -0
  192. package/src/styles.scss +13 -55
  193. package/src/theme/components/breadcrumb.ts +10 -0
  194. package/src/theme/components/button.ts +18 -12
  195. package/src/theme/components/card.ts +174 -0
  196. package/src/theme/components/checkbox.ts +7 -2
  197. package/src/theme/components/checkboxGroup.ts +8 -0
  198. package/src/theme/components/datePicker.ts +17 -0
  199. package/src/theme/components/fieldset.ts +18 -0
  200. package/src/theme/components/global.ts +26 -15
  201. package/src/theme/components/globalMixins.ts +9 -1
  202. package/src/theme/components/heading.ts +5 -0
  203. package/src/theme/components/image.ts +116 -0
  204. package/src/theme/components/label.ts +3 -10
  205. package/src/theme/components/link.ts +4 -0
  206. package/src/theme/components/list.ts +6 -3
  207. package/src/theme/components/notification.ts +12 -14
  208. package/src/theme/components/pagination.ts +20 -0
  209. package/src/theme/components/progressIndicator.ts +62 -0
  210. package/src/theme/components/radioGroup.ts +8 -0
  211. package/src/theme/components/select.ts +5 -2
  212. package/src/theme/components/skeletonLoader.ts +107 -0
  213. package/src/theme/components/slider.ts +79 -0
  214. package/src/theme/components/textInput.ts +2 -0
  215. package/src/theme/foundations/breakpoints.ts +8 -8
  216. package/src/theme/foundations/global.ts +6 -1
  217. package/src/theme/index.ts +22 -4
  218. package/src/utils/componentCategories.ts +4 -3
  219. package/dist/components/Image/Image.stories.d.ts +0 -18
  220. package/dist/theme/components/customCheckboxGroup.d.ts +0 -18
  221. package/dist/theme/components/customRadioGroup.d.ts +0 -18
  222. package/src/components/Button/_Button.scss +0 -32
  223. package/src/components/Card/_Card.scss +0 -308
  224. package/src/components/Image/Image.stories.tsx +0 -54
  225. package/src/components/Image/_Image.scss +0 -38
  226. package/src/components/Pagination/_Pagination.scss +0 -40
  227. package/src/components/SkeletonLoader/_SkeletonLoader.scss +0 -142
  228. package/src/styles/01-colors/_colors-brand.scss +0 -62
  229. package/src/styles/01-colors/_colors-utility.scss +0 -67
  230. package/src/styles/02-typography/_type-scale.css +0 -11
  231. package/src/styles/02-typography/_type-weight.css +0 -7
  232. package/src/styles/02-typography/_typefaces.css +0 -4
  233. package/src/styles/03-space/_space-stack.scss +0 -116
  234. package/src/styles/03-space/_space.css +0 -30
  235. package/src/styles/base/_card-grid.scss +0 -77
  236. package/src/styles/base/_typography.scss +0 -11
  237. package/src/theme/components/customCheckboxGroup.ts +0 -12
  238. 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.1` |
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
@@ -114,7 +114,7 @@ describe("Checkbox", () => {
114
114
  // The "group" role here is for the `fieldset` element.
115
115
  expect(screen.getByRole("group")).toHaveAttribute(
116
116
  "id",
117
- "checkbox-group-some-id"
117
+ "some-id-checkbox-group"
118
118
  );
119
119
  });
120
120
 
@@ -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 all the custom elements in this component.
117
- const styles = useMultiStyleConfig("CustomCheckboxGroup", {});
117
+ // Get the Chakra-based styles for the custom elements in this component.
118
+ const styles = useMultiStyleConfig("CheckboxGroup", {});
118
119
 
119
120
  return (
120
- <Box as="fieldset" id={`checkbox-group-${id}`} __css={styles}>
121
- <legend className={showLabel ? "" : "sr-only"}>
122
- <span>{labelText}</span>
123
- {optReqFlag && (
124
- <Box as="span" __css={styles.required}>
125
- {isRequired ? "Required" : "Optional"}
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
- </Box>
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-column"
6
+ id="column-checkbox-group"
7
7
  >
8
- <legend
9
- className=""
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
- </span>
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-row"
151
+ id="row-checkbox-group"
156
152
  >
157
- <legend
158
- className=""
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
- </span>
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-noLabel"
296
+ id="noLabel-checkbox-group"
305
297
  >
306
- <legend
307
- className="sr-only"
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
- </span>
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-helperText"
441
+ id="helperText-checkbox-group"
454
442
  >
455
- <legend
456
- className=""
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
- </span>
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-invalidText"
599
+ id="invalidText-checkbox-group"
616
600
  >
617
- <legend
618
- className=""
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
- </span>
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-optReq"
744
+ id="optReq-checkbox-group"
765
745
  >
766
- <legend
767
- className=""
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-required"
884
+ id="required-checkbox-group"
909
885
  >
910
- <legend
911
- className=""
912
- >
913
- <span>
914
- required
915
- </span>
916
- <span
886
+ <legend>
887
+ required
888
+ <div
917
889
  className="css-0"
918
890
  >
919
- Required
920
- </span>
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-invalid"
1029
+ id="invalid-checkbox-group"
1058
1030
  >
1059
- <legend
1060
- className=""
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
- </span>
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-disabled"
1180
+ id="disabled-checkbox-group"
1213
1181
  >
1214
- <legend
1215
- className=""
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
- </span>
1188
+ </div>
1225
1189
  </legend>
1226
1190
  <div
1227
1191
  aria-label={null}