@charcoal-ui/react 4.0.0-beta.3 → 4.0.0-beta.5

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 (176) hide show
  1. package/dist/_lib/useClassNames.d.ts +2 -2
  2. package/dist/_lib/useClassNames.d.ts.map +1 -1
  3. package/dist/components/Checkbox/CheckboxInput/index.d.ts +11 -0
  4. package/dist/components/Checkbox/CheckboxInput/index.d.ts.map +1 -0
  5. package/dist/components/Checkbox/CheckboxWithLabel.d.ts +9 -0
  6. package/dist/components/Checkbox/CheckboxWithLabel.d.ts.map +1 -0
  7. package/dist/components/Checkbox/index.d.ts +12 -21
  8. package/dist/components/Checkbox/index.d.ts.map +1 -1
  9. package/dist/components/Clickable/index.d.ts +10 -13
  10. package/dist/components/Clickable/index.d.ts.map +1 -1
  11. package/dist/components/DropdownSelector/Popover/index.d.ts +1 -2
  12. package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
  13. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  14. package/dist/components/FieldLabel/index.d.ts +1 -0
  15. package/dist/components/FieldLabel/index.d.ts.map +1 -1
  16. package/dist/components/IconButton/index.d.ts +7 -5
  17. package/dist/components/IconButton/index.d.ts.map +1 -1
  18. package/dist/components/LoadingSpinner/index.d.ts +1 -0
  19. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  20. package/dist/components/Modal/Dialog/index.d.ts +6 -24
  21. package/dist/components/Modal/Dialog/index.d.ts.map +1 -1
  22. package/dist/components/Modal/ModalPlumbing.d.ts +10 -3
  23. package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
  24. package/dist/components/Modal/index.d.ts +2 -2
  25. package/dist/components/Modal/index.d.ts.map +1 -1
  26. package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
  27. package/dist/components/Radio/index.d.ts +6 -8
  28. package/dist/components/Radio/index.d.ts.map +1 -1
  29. package/dist/components/SegmentedControl/index.d.ts +1 -0
  30. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  31. package/dist/components/Switch/SwitchInput/index.d.ts +9 -0
  32. package/dist/components/Switch/SwitchInput/index.d.ts.map +1 -0
  33. package/dist/components/Switch/SwitchWithLabel.d.ts +9 -0
  34. package/dist/components/Switch/SwitchWithLabel.d.ts.map +1 -0
  35. package/dist/components/Switch/index.d.ts +4 -15
  36. package/dist/components/Switch/index.d.ts.map +1 -1
  37. package/dist/components/TagItem/index.d.ts +14 -15
  38. package/dist/components/TagItem/index.d.ts.map +1 -1
  39. package/dist/components/TextArea/index.d.ts +28 -18
  40. package/dist/components/TextArea/index.d.ts.map +1 -1
  41. package/dist/components/TextField/index.d.ts +32 -19
  42. package/dist/components/TextField/index.d.ts.map +1 -1
  43. package/dist/core/CharcoalProvider.d.ts +1 -1
  44. package/dist/core/CharcoalProvider.d.ts.map +1 -1
  45. package/dist/index.cjs.js +456 -1079
  46. package/dist/index.cjs.js.map +1 -1
  47. package/dist/index.css +790 -0
  48. package/dist/index.css.map +1 -1
  49. package/dist/index.d.ts +1 -2
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.esm.js +454 -1075
  52. package/dist/index.esm.js.map +1 -1
  53. package/dist/styled.d.ts +4 -4
  54. package/package.json +17 -19
  55. package/src/_lib/useClassNames.ts +3 -9
  56. package/src/components/Checkbox/CheckboxInput/__snapshots__/index.story.storyshot +77 -0
  57. package/src/components/Checkbox/CheckboxInput/index.css +111 -0
  58. package/src/components/Checkbox/CheckboxInput/index.story.tsx +51 -0
  59. package/src/components/Checkbox/CheckboxInput/index.tsx +47 -0
  60. package/src/components/Checkbox/CheckboxWithLabel.tsx +24 -0
  61. package/src/components/Checkbox/__snapshots__/index.story.storyshot +103 -538
  62. package/src/components/Checkbox/index.css +21 -0
  63. package/src/components/Checkbox/index.story.tsx +48 -78
  64. package/src/components/Checkbox/index.tsx +32 -162
  65. package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -78
  66. package/src/components/Clickable/index.css +41 -0
  67. package/src/components/Clickable/index.story.tsx +1 -1
  68. package/src/components/Clickable/index.tsx +25 -85
  69. package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +10 -135
  70. package/src/components/DropdownSelector/Popover/index.tsx +1 -2
  71. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +308 -1014
  72. package/src/components/DropdownSelector/index.tsx +9 -38
  73. package/src/components/FieldLabel/index.css +35 -0
  74. package/src/components/FieldLabel/index.tsx +15 -105
  75. package/src/components/IconButton/__snapshots__/index.story.storyshot +18 -296
  76. package/src/components/IconButton/index.css +118 -0
  77. package/src/components/IconButton/index.story.tsx +16 -39
  78. package/src/components/IconButton/index.tsx +41 -118
  79. package/src/components/LoadingSpinner/__snapshots__/LoadingSpinnerIcon.story.storyshot +2 -17
  80. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +79 -29
  81. package/src/components/LoadingSpinner/index.css +42 -0
  82. package/src/components/LoadingSpinner/index.story.tsx +18 -7
  83. package/src/components/LoadingSpinner/index.tsx +26 -52
  84. package/src/components/Modal/Dialog/index.css +44 -0
  85. package/src/components/Modal/Dialog/index.tsx +13 -57
  86. package/src/components/Modal/ModalPlumbing.css +40 -0
  87. package/src/components/Modal/ModalPlumbing.tsx +22 -61
  88. package/src/components/Modal/__snapshots__/index.story.storyshot +459 -1881
  89. package/src/components/Modal/index.css +36 -0
  90. package/src/components/Modal/index.tsx +27 -74
  91. package/src/components/Modal/useCustomModalOverlay.tsx +5 -4
  92. package/src/components/Radio/__snapshots__/index.story.storyshot +51 -776
  93. package/src/components/Radio/index.css +97 -0
  94. package/src/components/Radio/index.story.tsx +20 -30
  95. package/src/components/Radio/index.test.tsx +0 -1
  96. package/src/components/Radio/index.tsx +60 -170
  97. package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +30 -260
  98. package/src/components/SegmentedControl/index.css +50 -0
  99. package/src/components/SegmentedControl/index.tsx +20 -89
  100. package/src/components/Switch/SwitchInput/index.css +82 -0
  101. package/src/components/Switch/SwitchInput/index.tsx +40 -0
  102. package/src/components/Switch/SwitchWithLabel.tsx +24 -0
  103. package/src/components/Switch/__snapshots__/index.story.storyshot +34 -538
  104. package/src/components/Switch/index.css +23 -0
  105. package/src/components/Switch/index.story.tsx +15 -18
  106. package/src/components/Switch/index.tsx +43 -140
  107. package/src/components/TagItem/__snapshots__/index.story.storyshot +212 -1063
  108. package/src/components/TagItem/index.css +140 -0
  109. package/src/components/TagItem/index.story.tsx +44 -161
  110. package/src/components/TagItem/index.tsx +76 -220
  111. package/src/components/TextArea/TextArea.story.tsx +62 -24
  112. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +1024 -792
  113. package/src/components/TextArea/index.tsx +68 -89
  114. package/src/components/TextField/TextField.story.tsx +77 -67
  115. package/src/components/TextField/__snapshots__/TextField.story.storyshot +1152 -1274
  116. package/src/components/TextField/index.tsx +77 -103
  117. package/src/components/a11y.test.tsx +1 -1
  118. package/src/core/CharcoalProvider.tsx +1 -1
  119. package/src/index.ts +0 -7
  120. package/src/type.d.ts +6 -0
  121. package/dist/components/Button/index.story.d.ts +0 -22
  122. package/dist/components/Button/index.story.d.ts.map +0 -1
  123. package/dist/components/Button/index.test.d.ts +0 -2
  124. package/dist/components/Button/index.test.d.ts.map +0 -1
  125. package/dist/components/Checkbox/index.story.d.ts +0 -8
  126. package/dist/components/Checkbox/index.story.d.ts.map +0 -1
  127. package/dist/components/Clickable/index.story.d.ts +0 -6
  128. package/dist/components/Clickable/index.story.d.ts.map +0 -1
  129. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +0 -9
  130. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +0 -1
  131. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +0 -8
  132. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +0 -1
  133. package/dist/components/DropdownSelector/Popover/index.story.d.ts +0 -5
  134. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +0 -1
  135. package/dist/components/DropdownSelector/index.story.d.ts +0 -19
  136. package/dist/components/DropdownSelector/index.story.d.ts.map +0 -1
  137. package/dist/components/Icon/index.story.d.ts +0 -6
  138. package/dist/components/Icon/index.story.d.ts.map +0 -1
  139. package/dist/components/IconButton/index.story.d.ts +0 -9
  140. package/dist/components/IconButton/index.story.d.ts.map +0 -1
  141. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +0 -8
  142. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +0 -1
  143. package/dist/components/LoadingSpinner/index.story.d.ts +0 -6
  144. package/dist/components/LoadingSpinner/index.story.d.ts.map +0 -1
  145. package/dist/components/Modal/index.story.d.ts +0 -21
  146. package/dist/components/Modal/index.story.d.ts.map +0 -1
  147. package/dist/components/MultiSelect/context.d.ts +0 -14
  148. package/dist/components/MultiSelect/context.d.ts.map +0 -1
  149. package/dist/components/MultiSelect/index.d.ts +0 -36
  150. package/dist/components/MultiSelect/index.d.ts.map +0 -1
  151. package/dist/components/MultiSelect/index.story.d.ts +0 -82
  152. package/dist/components/MultiSelect/index.story.d.ts.map +0 -1
  153. package/dist/components/MultiSelect/index.test.d.ts +0 -2
  154. package/dist/components/MultiSelect/index.test.d.ts.map +0 -1
  155. package/dist/components/Radio/index.story.d.ts +0 -26
  156. package/dist/components/Radio/index.story.d.ts.map +0 -1
  157. package/dist/components/Radio/index.test.d.ts +0 -2
  158. package/dist/components/Radio/index.test.d.ts.map +0 -1
  159. package/dist/components/SegmentedControl/index.story.d.ts +0 -7
  160. package/dist/components/SegmentedControl/index.story.d.ts.map +0 -1
  161. package/dist/components/Switch/index.story.d.ts +0 -9
  162. package/dist/components/Switch/index.story.d.ts.map +0 -1
  163. package/dist/components/TagItem/index.story.d.ts +0 -16
  164. package/dist/components/TagItem/index.story.d.ts.map +0 -1
  165. package/dist/components/TextArea/TextArea.story.d.ts +0 -9
  166. package/dist/components/TextArea/TextArea.story.d.ts.map +0 -1
  167. package/dist/components/TextField/TextField.story.d.ts +0 -22
  168. package/dist/components/TextField/TextField.story.d.ts.map +0 -1
  169. package/dist/components/a11y.test.d.ts +0 -2
  170. package/dist/components/a11y.test.d.ts.map +0 -1
  171. package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +0 -13
  172. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +0 -1066
  173. package/src/components/MultiSelect/context.ts +0 -23
  174. package/src/components/MultiSelect/index.story.tsx +0 -216
  175. package/src/components/MultiSelect/index.test.tsx +0 -263
  176. package/src/components/MultiSelect/index.tsx +0 -281
@@ -1,5 +1,7 @@
1
1
  import { forwardRef, useImperativeHandle, useRef, memo } from 'react'
2
- import styled, { keyframes } from 'styled-components'
2
+ import { useClassNames } from '../../_lib/useClassNames'
3
+
4
+ import './index.css'
3
5
 
4
6
  export type LoadingSpinnerProps = {
5
7
  readonly size?: number
@@ -10,68 +12,33 @@ export type LoadingSpinnerProps = {
10
12
 
11
13
  const LoadingSpinner = forwardRef<HTMLDivElement, LoadingSpinnerProps>(
12
14
  function LoadingSpinnerInner(
13
- { size = 48, padding = 16, transparent = false, className },
15
+ { size = 48, padding = 16, transparent = false, ...props },
14
16
  ref
15
17
  ) {
18
+ const classNames = useClassNames(
19
+ 'charcoal-loading-spinner',
20
+ props.className
21
+ )
22
+
16
23
  return (
17
- <LoadingSpinnerRoot
18
- size={size}
19
- padding={padding}
20
- transparent={transparent}
21
- className={className}
24
+ <div
25
+ role="progressbar"
26
+ style={{
27
+ '--charcoal-loading-spinner-size': `${size}px`,
28
+ '--charcoal-loading-spinner-padding': `${padding}px`,
29
+ }}
30
+ data-transparent={transparent}
31
+ className={classNames}
22
32
  ref={ref}
23
33
  >
24
34
  <LoadingSpinnerIcon />
25
- </LoadingSpinnerRoot>
35
+ </div>
26
36
  )
27
37
  }
28
38
  )
29
39
 
30
40
  export default memo(LoadingSpinner)
31
41
 
32
- const LoadingSpinnerRoot = styled.div.attrs({ role: 'progressbar' })<{
33
- size: number
34
- padding: number
35
- transparent: boolean
36
- }>`
37
- box-sizing: content-box;
38
- margin: auto;
39
- padding: ${(props) => props.padding}px;
40
- border-radius: 8px;
41
- font-size: ${(props) => props.size}px;
42
- width: ${(props) => props.size}px;
43
- height: ${(props) => props.size}px;
44
- opacity: 0.84;
45
- color: var(--charcoal-text4);
46
- background-color: ${({ transparent }) =>
47
- `var(--charcoal-${transparent ? 'transparent' : 'background1'})`};
48
- `
49
-
50
- const scaleOut = keyframes`
51
- from {
52
- transform: scale(0);
53
- opacity: 1;
54
- }
55
-
56
- to {
57
- transform: scale(1);
58
- opacity: 0;
59
- }
60
- `
61
-
62
- const Icon = styled.div.attrs({ role: 'presentation' })<{ once: boolean }>`
63
- width: 1em;
64
- height: 1em;
65
- border-radius: 1em;
66
- background-color: currentColor;
67
- animation: ${scaleOut} 1s both ease-out;
68
- animation-iteration-count: ${(p) => (p.once ? 1 : 'infinite')};
69
-
70
- &[data-reset-animation] {
71
- animation: none;
72
- }
73
- `
74
-
75
42
  type Props = {
76
43
  once?: boolean
77
44
  }
@@ -96,6 +63,13 @@ export const LoadingSpinnerIcon = forwardRef<LoadingSpinnerIconHandler, Props>(
96
63
  },
97
64
  }))
98
65
 
99
- return <Icon ref={iconRef} once={once} />
66
+ return (
67
+ <div
68
+ role="presentation"
69
+ ref={iconRef}
70
+ data-once={once}
71
+ className="charcoal-loading-spinner-icon"
72
+ />
73
+ )
100
74
  }
101
75
  )
@@ -0,0 +1,44 @@
1
+ .charcoal-modal-dialog {
2
+ margin: auto;
3
+ position: relative;
4
+ height: fit-content;
5
+ width: 440px;
6
+
7
+ background-color: var(--charcoal-surface1);
8
+ border-radius: 24px;
9
+ }
10
+
11
+ .charcoal-modal-dialog[data-size='S'] {
12
+ width: 336px;
13
+ }
14
+
15
+ .charcoal-modal-dialog[data-size='M'] {
16
+ width: 440px;
17
+ }
18
+
19
+ .charcoal-modal-dialog[data-size='L'] {
20
+ width: 648px;
21
+ }
22
+
23
+ @media (max-width: 743px) {
24
+ .charcoal-modal-dialog {
25
+ max-width: 440px;
26
+ width: calc(100% - 48px);
27
+ }
28
+
29
+ .charcoal-modal-dialog[data-bottom-sheet='true'],
30
+ .charcoal-modal-dialog[data-bottom-sheet='full'] {
31
+ max-width: unset;
32
+ width: 100%;
33
+ border-radius: 0;
34
+ margin: auto 0 0 0;
35
+ }
36
+
37
+ .charcoal-modal-dialog[data-bottom-sheet='full'] {
38
+ min-height: 100%;
39
+ }
40
+ }
41
+
42
+ .charcoal-modal-dialog:focus {
43
+ outline: none;
44
+ }
@@ -1,18 +1,19 @@
1
1
  import { forwardRef } from 'react'
2
2
  import * as React from 'react'
3
- import styled, { css } from 'styled-components'
4
3
  import { useDialog } from '@react-aria/dialog'
5
- import { columnSystem, COLUMN_UNIT, GUTTER_UNIT } from '@charcoal-ui/foundation'
6
- import { unreachable } from '../../../_lib'
7
- import { maxWidth } from '@charcoal-ui/utils'
8
- import { animated } from 'react-spring'
9
4
  import { useForwardedRef } from '../../../_lib/useForwardedRef'
10
5
  import { Size, BottomSheet } from '..'
11
6
 
7
+ import './index.css'
8
+ import { useClassNames } from '../../../_lib/useClassNames'
9
+
12
10
  export const Dialog = forwardRef<
13
11
  HTMLDivElement,
14
- React.ComponentProps<typeof AnimatedStyledDialogDiv>
15
- >(function Dialog(props, forwardRef) {
12
+ React.ComponentPropsWithoutRef<'div'> & {
13
+ size: Size
14
+ bottomSheet: BottomSheet
15
+ }
16
+ >(function Dialog({ size, bottomSheet, css, className, ...props }, forwardRef) {
16
17
  const ref = useForwardedRef(forwardRef)
17
18
  const { dialogProps } = useDialog(
18
19
  {
@@ -21,62 +22,17 @@ export const Dialog = forwardRef<
21
22
  ref
22
23
  )
23
24
 
25
+ const classNames = useClassNames('charcoal-modal-dialog', className)
24
26
  return (
25
- <AnimatedStyledDialogDiv
26
- {...props}
27
+ <div
28
+ className={classNames}
27
29
  role={dialogProps.role}
30
+ data-bottom-sheet={bottomSheet}
28
31
  tabIndex={dialogProps.tabIndex}
29
32
  aria-labelledby={dialogProps['aria-labelledby']}
30
33
  onBlur={dialogProps.onBlur}
31
34
  ref={ref}
35
+ {...props}
32
36
  />
33
37
  )
34
38
  })
35
-
36
- const AnimatedStyledDialogDiv = animated(styled.div<{
37
- size: Size
38
- bottomSheet: BottomSheet
39
- }>`
40
- margin: auto;
41
- position: relative;
42
- height: fit-content;
43
- width: ${(p) => {
44
- switch (p.size) {
45
- case 'S': {
46
- return columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2
47
- }
48
- case 'M': {
49
- return columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2
50
- }
51
- case 'L': {
52
- return columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2
53
- }
54
- default: {
55
- return unreachable(p.size)
56
- }
57
- }
58
- }}px;
59
-
60
- background-color: var(--charcoal-surface1);
61
- border-radius: 24px;
62
-
63
- @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {
64
- max-width: 440px;
65
- width: calc(100% - 48px);
66
- ${(p) =>
67
- p.bottomSheet !== false &&
68
- css`
69
- max-width: unset;
70
- width: 100%;
71
- border-radius: 0;
72
- margin: auto 0 0 0;
73
- ${p.bottomSheet === 'full' &&
74
- css`
75
- min-height: 100%;
76
- `}
77
- `}
78
- }
79
- :focus {
80
- outline: none;
81
- }
82
- `)
@@ -0,0 +1,40 @@
1
+ .charcoal-modal-header-root {
2
+ height: 64px;
3
+ display: grid;
4
+ align-content: center;
5
+ justify-content: center;
6
+ }
7
+
8
+ @media (max-width: 743px) {
9
+ .charcoal-modal-header-root[data-bottom-sheet='true'],
10
+ .charcoal-modal-header-root[data-bottom-sheet='full'] {
11
+ height: 48px;
12
+ }
13
+ }
14
+
15
+ .charcoal-modal-header-title {
16
+ color: var(--charcoal-text1);
17
+ font-size: 16px;
18
+ line-height: 24px;
19
+ font-weight: bold;
20
+ display: flow-root;
21
+ }
22
+
23
+ .charcoal-modal-align {
24
+ padding-left: 16px;
25
+ padding-right: 16px;
26
+ }
27
+
28
+ .charcoal-modal-body {
29
+ padding-bottom: 40px;
30
+ }
31
+
32
+ .charcoal-modal-buttons {
33
+ display: grid;
34
+ grid-auto-flow: row;
35
+ grid-row-gap: 8px;
36
+
37
+ padding-top: 16px;
38
+ padding-left: 16px;
39
+ padding-right: 16px;
40
+ }
@@ -1,71 +1,32 @@
1
- import { BottomSheet, ModalContext, ModalTitle } from '.'
2
- import styled, { css } from 'styled-components'
3
- import { useContext } from 'react'
4
- import { maxWidth } from '@charcoal-ui/utils'
1
+ import { ModalContext } from '.'
2
+ import { forwardRef, useContext } from 'react'
3
+ import { useClassNames } from '../../_lib/useClassNames'
4
+
5
+ import './ModalPlumbing.css'
5
6
 
6
7
  export function ModalHeader() {
7
8
  const modalCtx = useContext(ModalContext)
8
9
  return (
9
- <ModalHeaderRoot $bottomSheet={modalCtx.bottomSheet}>
10
- <StyledModalTitle />
11
- </ModalHeaderRoot>
10
+ <div
11
+ className="charcoal-modal-header-root"
12
+ data-bottom-sheet={modalCtx.bottomSheet}
13
+ >
14
+ <div className="charcoal-modal-header-title">{modalCtx.title}</div>
15
+ </div>
12
16
  )
13
17
  }
14
18
 
15
- const ModalHeaderRoot = styled.div<{
16
- $bottomSheet: BottomSheet
17
- }>`
18
- height: 64px;
19
- display: grid;
20
- align-content: center;
21
- justify-content: center;
22
- @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {
23
- ${(p) =>
24
- p.$bottomSheet !== false &&
25
- css`
26
- height: 48px;
27
- `}
28
- }
29
- `
30
-
31
- const StyledModalTitle = styled(ModalTitle)`
32
- color: var(--charcoal-text1);
33
- font-size: 16px;
34
- line-height: 24px;
35
- font-weight: bold;
36
- display: flow-root;
37
-
38
- &::before {
39
- display: block;
40
- width: 0;
41
- height: 0;
42
- content: '';
43
- margin-top: -4px;
44
- }
45
- &::after {
46
- display: block;
47
- width: 0;
48
- height: 0;
49
- content: '';
50
- margin-bottom: -4px;
51
- }
52
- `
19
+ export const ModalAlign = createDivComponent('charcoal-modal-align')
53
20
 
54
- export const ModalAlign = styled.div`
55
- padding-left: 16px;
56
- padding-right: 16px;
57
- `
21
+ export const ModalBody = createDivComponent('charcoal-modal-body')
58
22
 
59
- export const ModalBody = styled.div`
60
- padding-bottom: 40px;
61
- `
23
+ export const ModalButtons = createDivComponent('charcoal-modal-buttons')
62
24
 
63
- export const ModalButtons = styled.div`
64
- display: grid;
65
- grid-auto-flow: row;
66
- grid-row-gap: 8px;
67
-
68
- padding-top: 16px;
69
- padding-left: 16px;
70
- padding-right: 16px;
71
- `
25
+ function createDivComponent(mainClassName: string) {
26
+ return forwardRef<HTMLDivElement, React.ComponentPropsWithRef<'div'>>(
27
+ function DivComponent({ className, ...props }, ref) {
28
+ const classNames = useClassNames(mainClassName, className)
29
+ return <div className={classNames} ref={ref} {...props} />
30
+ }
31
+ )
32
+ }