@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.
- package/dist/_lib/useClassNames.d.ts +2 -2
- package/dist/_lib/useClassNames.d.ts.map +1 -1
- package/dist/components/Checkbox/CheckboxInput/index.d.ts +11 -0
- package/dist/components/Checkbox/CheckboxInput/index.d.ts.map +1 -0
- package/dist/components/Checkbox/CheckboxWithLabel.d.ts +9 -0
- package/dist/components/Checkbox/CheckboxWithLabel.d.ts.map +1 -0
- package/dist/components/Checkbox/index.d.ts +12 -21
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Clickable/index.d.ts +10 -13
- package/dist/components/Clickable/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/Popover/index.d.ts +1 -2
- package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.d.ts.map +1 -1
- package/dist/components/FieldLabel/index.d.ts +1 -0
- package/dist/components/FieldLabel/index.d.ts.map +1 -1
- package/dist/components/IconButton/index.d.ts +7 -5
- package/dist/components/IconButton/index.d.ts.map +1 -1
- package/dist/components/LoadingSpinner/index.d.ts +1 -0
- package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
- package/dist/components/Modal/Dialog/index.d.ts +6 -24
- package/dist/components/Modal/Dialog/index.d.ts.map +1 -1
- package/dist/components/Modal/ModalPlumbing.d.ts +10 -3
- package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts +2 -2
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
- package/dist/components/Radio/index.d.ts +6 -8
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/SegmentedControl/index.d.ts +1 -0
- package/dist/components/SegmentedControl/index.d.ts.map +1 -1
- package/dist/components/Switch/SwitchInput/index.d.ts +9 -0
- package/dist/components/Switch/SwitchInput/index.d.ts.map +1 -0
- package/dist/components/Switch/SwitchWithLabel.d.ts +9 -0
- package/dist/components/Switch/SwitchWithLabel.d.ts.map +1 -0
- package/dist/components/Switch/index.d.ts +4 -15
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/TagItem/index.d.ts +14 -15
- package/dist/components/TagItem/index.d.ts.map +1 -1
- package/dist/components/TextArea/index.d.ts +28 -18
- package/dist/components/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts +32 -19
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/core/CharcoalProvider.d.ts +1 -1
- package/dist/core/CharcoalProvider.d.ts.map +1 -1
- package/dist/index.cjs.js +456 -1079
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +790 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +454 -1075
- package/dist/index.esm.js.map +1 -1
- package/dist/styled.d.ts +4 -4
- package/package.json +17 -19
- package/src/_lib/useClassNames.ts +3 -9
- package/src/components/Checkbox/CheckboxInput/__snapshots__/index.story.storyshot +77 -0
- package/src/components/Checkbox/CheckboxInput/index.css +111 -0
- package/src/components/Checkbox/CheckboxInput/index.story.tsx +51 -0
- package/src/components/Checkbox/CheckboxInput/index.tsx +47 -0
- package/src/components/Checkbox/CheckboxWithLabel.tsx +24 -0
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +103 -538
- package/src/components/Checkbox/index.css +21 -0
- package/src/components/Checkbox/index.story.tsx +48 -78
- package/src/components/Checkbox/index.tsx +32 -162
- package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -78
- package/src/components/Clickable/index.css +41 -0
- package/src/components/Clickable/index.story.tsx +1 -1
- package/src/components/Clickable/index.tsx +25 -85
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +10 -135
- package/src/components/DropdownSelector/Popover/index.tsx +1 -2
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +308 -1014
- package/src/components/DropdownSelector/index.tsx +9 -38
- package/src/components/FieldLabel/index.css +35 -0
- package/src/components/FieldLabel/index.tsx +15 -105
- package/src/components/IconButton/__snapshots__/index.story.storyshot +18 -296
- package/src/components/IconButton/index.css +118 -0
- package/src/components/IconButton/index.story.tsx +16 -39
- package/src/components/IconButton/index.tsx +41 -118
- package/src/components/LoadingSpinner/__snapshots__/LoadingSpinnerIcon.story.storyshot +2 -17
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +79 -29
- package/src/components/LoadingSpinner/index.css +42 -0
- package/src/components/LoadingSpinner/index.story.tsx +18 -7
- package/src/components/LoadingSpinner/index.tsx +26 -52
- package/src/components/Modal/Dialog/index.css +44 -0
- package/src/components/Modal/Dialog/index.tsx +13 -57
- package/src/components/Modal/ModalPlumbing.css +40 -0
- package/src/components/Modal/ModalPlumbing.tsx +22 -61
- package/src/components/Modal/__snapshots__/index.story.storyshot +459 -1881
- package/src/components/Modal/index.css +36 -0
- package/src/components/Modal/index.tsx +27 -74
- package/src/components/Modal/useCustomModalOverlay.tsx +5 -4
- package/src/components/Radio/__snapshots__/index.story.storyshot +51 -776
- package/src/components/Radio/index.css +97 -0
- package/src/components/Radio/index.story.tsx +20 -30
- package/src/components/Radio/index.test.tsx +0 -1
- package/src/components/Radio/index.tsx +60 -170
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +30 -260
- package/src/components/SegmentedControl/index.css +50 -0
- package/src/components/SegmentedControl/index.tsx +20 -89
- package/src/components/Switch/SwitchInput/index.css +82 -0
- package/src/components/Switch/SwitchInput/index.tsx +40 -0
- package/src/components/Switch/SwitchWithLabel.tsx +24 -0
- package/src/components/Switch/__snapshots__/index.story.storyshot +34 -538
- package/src/components/Switch/index.css +23 -0
- package/src/components/Switch/index.story.tsx +15 -18
- package/src/components/Switch/index.tsx +43 -140
- package/src/components/TagItem/__snapshots__/index.story.storyshot +212 -1063
- package/src/components/TagItem/index.css +140 -0
- package/src/components/TagItem/index.story.tsx +44 -161
- package/src/components/TagItem/index.tsx +76 -220
- package/src/components/TextArea/TextArea.story.tsx +62 -24
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +1024 -792
- package/src/components/TextArea/index.tsx +68 -89
- package/src/components/TextField/TextField.story.tsx +77 -67
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +1152 -1274
- package/src/components/TextField/index.tsx +77 -103
- package/src/components/a11y.test.tsx +1 -1
- package/src/core/CharcoalProvider.tsx +1 -1
- package/src/index.ts +0 -7
- package/src/type.d.ts +6 -0
- package/dist/components/Button/index.story.d.ts +0 -22
- package/dist/components/Button/index.story.d.ts.map +0 -1
- package/dist/components/Button/index.test.d.ts +0 -2
- package/dist/components/Button/index.test.d.ts.map +0 -1
- package/dist/components/Checkbox/index.story.d.ts +0 -8
- package/dist/components/Checkbox/index.story.d.ts.map +0 -1
- package/dist/components/Clickable/index.story.d.ts +0 -6
- package/dist/components/Clickable/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/ListItem/index.story.d.ts +0 -9
- package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/MenuList/index.story.d.ts +0 -8
- package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/Popover/index.story.d.ts +0 -5
- package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/index.story.d.ts +0 -19
- package/dist/components/DropdownSelector/index.story.d.ts.map +0 -1
- package/dist/components/Icon/index.story.d.ts +0 -6
- package/dist/components/Icon/index.story.d.ts.map +0 -1
- package/dist/components/IconButton/index.story.d.ts +0 -9
- package/dist/components/IconButton/index.story.d.ts.map +0 -1
- package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +0 -8
- package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +0 -1
- package/dist/components/LoadingSpinner/index.story.d.ts +0 -6
- package/dist/components/LoadingSpinner/index.story.d.ts.map +0 -1
- package/dist/components/Modal/index.story.d.ts +0 -21
- package/dist/components/Modal/index.story.d.ts.map +0 -1
- package/dist/components/MultiSelect/context.d.ts +0 -14
- package/dist/components/MultiSelect/context.d.ts.map +0 -1
- package/dist/components/MultiSelect/index.d.ts +0 -36
- package/dist/components/MultiSelect/index.d.ts.map +0 -1
- package/dist/components/MultiSelect/index.story.d.ts +0 -82
- package/dist/components/MultiSelect/index.story.d.ts.map +0 -1
- package/dist/components/MultiSelect/index.test.d.ts +0 -2
- package/dist/components/MultiSelect/index.test.d.ts.map +0 -1
- package/dist/components/Radio/index.story.d.ts +0 -26
- package/dist/components/Radio/index.story.d.ts.map +0 -1
- package/dist/components/Radio/index.test.d.ts +0 -2
- package/dist/components/Radio/index.test.d.ts.map +0 -1
- package/dist/components/SegmentedControl/index.story.d.ts +0 -7
- package/dist/components/SegmentedControl/index.story.d.ts.map +0 -1
- package/dist/components/Switch/index.story.d.ts +0 -9
- package/dist/components/Switch/index.story.d.ts.map +0 -1
- package/dist/components/TagItem/index.story.d.ts +0 -16
- package/dist/components/TagItem/index.story.d.ts.map +0 -1
- package/dist/components/TextArea/TextArea.story.d.ts +0 -9
- package/dist/components/TextArea/TextArea.story.d.ts.map +0 -1
- package/dist/components/TextField/TextField.story.d.ts +0 -22
- package/dist/components/TextField/TextField.story.d.ts.map +0 -1
- package/dist/components/a11y.test.d.ts +0 -2
- package/dist/components/a11y.test.d.ts.map +0 -1
- package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +0 -13
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +0 -1066
- package/src/components/MultiSelect/context.ts +0 -23
- package/src/components/MultiSelect/index.story.tsx +0 -216
- package/src/components/MultiSelect/index.test.tsx +0 -263
- package/src/components/MultiSelect/index.tsx +0 -281
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { forwardRef, useImperativeHandle, useRef, memo } from 'react'
|
|
2
|
-
import
|
|
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,
|
|
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
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
</
|
|
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
|
|
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.
|
|
15
|
-
|
|
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
|
-
<
|
|
26
|
-
{
|
|
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 {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
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
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
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
|
|
55
|
-
padding-left: 16px;
|
|
56
|
-
padding-right: 16px;
|
|
57
|
-
`
|
|
21
|
+
export const ModalBody = createDivComponent('charcoal-modal-body')
|
|
58
22
|
|
|
59
|
-
export const
|
|
60
|
-
padding-bottom: 40px;
|
|
61
|
-
`
|
|
23
|
+
export const ModalButtons = createDivComponent('charcoal-modal-buttons')
|
|
62
24
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
+
}
|