@redsift/popovers 8.0.1 → 8.0.3
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/index.js.map → index.js.map} +1 -1
- package/package.json +3 -2
- package/coverage/clover.xml +0 -738
- package/coverage/coverage-final.json +0 -53
- package/coverage/lcov-report/Tooltip.tsx.html +0 -235
- package/coverage/lcov-report/TooltipContent.tsx.html +0 -235
- package/coverage/lcov-report/TooltipTrigger.tsx.html +0 -241
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/context.ts.html +0 -97
- package/coverage/lcov-report/dialog/Dialog.tsx.html +0 -271
- package/coverage/lcov-report/dialog/context.ts.html +0 -97
- package/coverage/lcov-report/dialog/index.html +0 -191
- package/coverage/lcov-report/dialog/index.ts.html +0 -100
- package/coverage/lcov-report/dialog/types.ts.html +0 -253
- package/coverage/lcov-report/dialog/useDialog.tsx.html +0 -346
- package/coverage/lcov-report/dialog/useDialogContext.tsx.html +0 -121
- package/coverage/lcov-report/dialog-content/DialogContent.tsx.html +0 -487
- package/coverage/lcov-report/dialog-content/index.html +0 -146
- package/coverage/lcov-report/dialog-content/index.ts.html +0 -91
- package/coverage/lcov-report/dialog-content/intl/index.html +0 -116
- package/coverage/lcov-report/dialog-content/intl/index.ts.html +0 -106
- package/coverage/lcov-report/dialog-content/styles.ts.html +0 -301
- package/coverage/lcov-report/dialog-content-actions/DialogContentActions.tsx.html +0 -205
- package/coverage/lcov-report/dialog-content-actions/index.html +0 -146
- package/coverage/lcov-report/dialog-content-actions/index.ts.html +0 -91
- package/coverage/lcov-report/dialog-content-actions/styles.ts.html +0 -139
- package/coverage/lcov-report/dialog-content-body/DialogContentBody.tsx.html +0 -232
- package/coverage/lcov-report/dialog-content-body/index.html +0 -146
- package/coverage/lcov-report/dialog-content-body/index.ts.html +0 -91
- package/coverage/lcov-report/dialog-content-body/styles.ts.html +0 -259
- package/coverage/lcov-report/dialog-content-header/DialogContentHeader.tsx.html +0 -328
- package/coverage/lcov-report/dialog-content-header/index.html +0 -146
- package/coverage/lcov-report/dialog-content-header/index.ts.html +0 -91
- package/coverage/lcov-report/dialog-content-header/styles.ts.html +0 -193
- package/coverage/lcov-report/dialog-trigger/DialogTrigger.tsx.html +0 -214
- package/coverage/lcov-report/dialog-trigger/index.html +0 -131
- package/coverage/lcov-report/dialog-trigger/index.ts.html +0 -91
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -341
- package/coverage/lcov-report/index.ts.html +0 -97
- package/coverage/lcov-report/popover/Popover.tsx.html +0 -244
- package/coverage/lcov-report/popover/context.ts.html +0 -97
- package/coverage/lcov-report/popover/index.html +0 -191
- package/coverage/lcov-report/popover/index.ts.html +0 -100
- package/coverage/lcov-report/popover/types.ts.html +0 -244
- package/coverage/lcov-report/popover/usePopover.tsx.html +0 -295
- package/coverage/lcov-report/popover/usePopoverContext.tsx.html +0 -121
- package/coverage/lcov-report/popover-content/PopoverContent.tsx.html +0 -268
- package/coverage/lcov-report/popover-content/index.html +0 -146
- package/coverage/lcov-report/popover-content/index.ts.html +0 -91
- package/coverage/lcov-report/popover-content/styles.ts.html +0 -166
- package/coverage/lcov-report/popover-trigger/PopoverTrigger.tsx.html +0 -214
- package/coverage/lcov-report/popover-trigger/index.html +0 -131
- package/coverage/lcov-report/popover-trigger/index.ts.html +0 -91
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/styles.ts.html +0 -391
- package/coverage/lcov-report/toast/Toast.tsx.html +0 -451
- package/coverage/lcov-report/toast/index.html +0 -161
- package/coverage/lcov-report/toast/index.ts.html +0 -91
- package/coverage/lcov-report/toast/intl/index.html +0 -116
- package/coverage/lcov-report/toast/intl/index.ts.html +0 -106
- package/coverage/lcov-report/toast/styles.ts.html +0 -214
- package/coverage/lcov-report/toast/types.ts.html +0 -217
- package/coverage/lcov-report/toast-container/ToastContainer.tsx.html +0 -217
- package/coverage/lcov-report/toast-container/index.html +0 -161
- package/coverage/lcov-report/toast-container/index.ts.html +0 -94
- package/coverage/lcov-report/toast-container/styles.ts.html +0 -2323
- package/coverage/lcov-report/toast-container/useToast.tsx.html +0 -469
- package/coverage/lcov-report/toast-provider/ToastProvider.tsx.html +0 -256
- package/coverage/lcov-report/toast-provider/context.ts.html +0 -106
- package/coverage/lcov-report/toast-provider/index.html +0 -161
- package/coverage/lcov-report/toast-provider/index.ts.html +0 -97
- package/coverage/lcov-report/toast-provider/useToast.tsx.html +0 -109
- package/coverage/lcov-report/tooltip/Tooltip.tsx.html +0 -250
- package/coverage/lcov-report/tooltip/context.ts.html +0 -97
- package/coverage/lcov-report/tooltip/index.html +0 -191
- package/coverage/lcov-report/tooltip/index.ts.html +0 -100
- package/coverage/lcov-report/tooltip/types.ts.html +0 -250
- package/coverage/lcov-report/tooltip/useTooltip.tsx.html +0 -352
- package/coverage/lcov-report/tooltip/useTooltipContext.tsx.html +0 -121
- package/coverage/lcov-report/tooltip-content/TooltipContent.tsx.html +0 -313
- package/coverage/lcov-report/tooltip-content/index.html +0 -146
- package/coverage/lcov-report/tooltip-content/index.ts.html +0 -91
- package/coverage/lcov-report/tooltip-content/styles.ts.html +0 -337
- package/coverage/lcov-report/tooltip-trigger/TooltipTrigger.tsx.html +0 -211
- package/coverage/lcov-report/tooltip-trigger/index.html +0 -131
- package/coverage/lcov-report/tooltip-trigger/index.ts.html +0 -91
- package/coverage/lcov-report/types.ts.html +0 -226
- package/coverage/lcov-report/useTooltip.tsx.html +0 -277
- package/coverage/lcov-report/useTooltipContext.tsx.html +0 -121
- package/coverage/lcov-report/useTooltipOpen.tsx.html +0 -559
- package/coverage/lcov.info +0 -1330
- package/dist/package.json +0 -96
- package/index.ts +0 -1
- package/jest.config.js +0 -3
- package/rollup.config.js +0 -13
- package/src/components/dialog/Dialog.stories.tsx +0 -201
- package/src/components/dialog/Dialog.test.tsx +0 -116
- package/src/components/dialog/Dialog.tsx +0 -62
- package/src/components/dialog/context.ts +0 -4
- package/src/components/dialog/index.ts +0 -5
- package/src/components/dialog/types.ts +0 -56
- package/src/components/dialog/useDialog.tsx +0 -87
- package/src/components/dialog/useDialogContext.tsx +0 -12
- package/src/components/dialog-content/DialogContent.stories.tsx +0 -337
- package/src/components/dialog-content/DialogContent.tsx +0 -134
- package/src/components/dialog-content/index.ts +0 -2
- package/src/components/dialog-content/intl/en-US.json +0 -3
- package/src/components/dialog-content/intl/fr-FR.json +0 -3
- package/src/components/dialog-content/intl/index.ts +0 -7
- package/src/components/dialog-content/styles.ts +0 -72
- package/src/components/dialog-content/types.ts +0 -11
- package/src/components/dialog-content-actions/DialogContentActions.test.tsx +0 -68
- package/src/components/dialog-content-actions/DialogContentActions.tsx +0 -40
- package/src/components/dialog-content-actions/index.ts +0 -2
- package/src/components/dialog-content-actions/styles.ts +0 -18
- package/src/components/dialog-content-actions/types.ts +0 -11
- package/src/components/dialog-content-body/DialogContentBody.test.tsx +0 -63
- package/src/components/dialog-content-body/DialogContentBody.tsx +0 -49
- package/src/components/dialog-content-body/index.ts +0 -2
- package/src/components/dialog-content-body/styles.ts +0 -58
- package/src/components/dialog-content-body/types.ts +0 -14
- package/src/components/dialog-content-header/DialogContentHeader.test.tsx +0 -63
- package/src/components/dialog-content-header/DialogContentHeader.tsx +0 -81
- package/src/components/dialog-content-header/index.ts +0 -2
- package/src/components/dialog-content-header/styles.ts +0 -36
- package/src/components/dialog-content-header/types.ts +0 -23
- package/src/components/dialog-trigger/DialogTrigger.tsx +0 -43
- package/src/components/dialog-trigger/index.ts +0 -2
- package/src/components/dialog-trigger/types.ts +0 -9
- package/src/components/popover/Popover.stories.tsx +0 -158
- package/src/components/popover/Popover.test.tsx +0 -102
- package/src/components/popover/Popover.tsx +0 -53
- package/src/components/popover/context.ts +0 -4
- package/src/components/popover/index.ts +0 -5
- package/src/components/popover/types.ts +0 -53
- package/src/components/popover/usePopover.tsx +0 -70
- package/src/components/popover/usePopoverContext.tsx +0 -12
- package/src/components/popover-content/PopoverContent.tsx +0 -61
- package/src/components/popover-content/index.ts +0 -2
- package/src/components/popover-content/styles.ts +0 -27
- package/src/components/popover-content/types.ts +0 -11
- package/src/components/popover-trigger/PopoverTrigger.tsx +0 -43
- package/src/components/popover-trigger/index.ts +0 -2
- package/src/components/popover-trigger/types.ts +0 -9
- package/src/components/toast/Toast.stories.tsx +0 -75
- package/src/components/toast/Toast.test.tsx +0 -63
- package/src/components/toast/Toast.tsx +0 -122
- package/src/components/toast/index.ts +0 -2
- package/src/components/toast/intl/en-US.json +0 -3
- package/src/components/toast/intl/fr-FR.json +0 -3
- package/src/components/toast/intl/index.ts +0 -7
- package/src/components/toast/styles.ts +0 -43
- package/src/components/toast/types.ts +0 -44
- package/src/components/toast-container/ToastContainer.stories.tsx +0 -349
- package/src/components/toast-container/ToastContainer.tsx +0 -44
- package/src/components/toast-container/index.ts +0 -3
- package/src/components/toast-container/styles.ts +0 -746
- package/src/components/toast-container/types.ts +0 -110
- package/src/components/toast-container/useToast.test.tsx +0 -111
- package/src/components/toast-container/useToast.tsx +0 -128
- package/src/components/tooltip/Tooltip.stories.tsx +0 -200
- package/src/components/tooltip/Tooltip.test.tsx +0 -119
- package/src/components/tooltip/Tooltip.tsx +0 -55
- package/src/components/tooltip/context.ts +0 -4
- package/src/components/tooltip/index.ts +0 -5
- package/src/components/tooltip/types.ts +0 -55
- package/src/components/tooltip/useTooltip.tsx +0 -89
- package/src/components/tooltip/useTooltipContext.tsx +0 -12
- package/src/components/tooltip-content/TooltipContent.tsx +0 -76
- package/src/components/tooltip-content/index.ts +0 -2
- package/src/components/tooltip-content/styles.ts +0 -84
- package/src/components/tooltip-content/types.ts +0 -14
- package/src/components/tooltip-trigger/TooltipTrigger.tsx +0 -42
- package/src/components/tooltip-trigger/index.ts +0 -2
- package/src/components/tooltip-trigger/types.ts +0 -9
- package/src/index.ts +0 -14
- package/tsconfig.json +0 -3
- package/{dist/CONTRIBUTING.md → CONTRIBUTING.md} +0 -0
- package/{dist/index.d.ts → index.d.ts} +0 -0
- package/{dist/index.js → index.js} +2 -2
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
import { mdiArrowRight, mdiInformationOutline } from '@redsift/icons';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import { Flexbox, Button, Text, Number } from '@redsift/design-system';
|
|
5
|
-
import { DialogContent } from '.';
|
|
6
|
-
import { Dialog } from '../dialog';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'Popovers/Dialog/DialogContent',
|
|
10
|
-
component: DialogContent,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const Simple = () => (
|
|
14
|
-
<Flexbox padding="32px" style={{ backgroundColor: '#EFEFEF' }}>
|
|
15
|
-
<Dialog isOpen>
|
|
16
|
-
<DialogContent>
|
|
17
|
-
<DialogContent.Body>
|
|
18
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
19
|
-
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
20
|
-
</DialogContent.Body>
|
|
21
|
-
</DialogContent>
|
|
22
|
-
</Dialog>
|
|
23
|
-
</Flexbox>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
export const Empty = () => (
|
|
27
|
-
<Flexbox padding="32px" style={{ backgroundColor: '#EFEFEF' }}>
|
|
28
|
-
<Dialog isOpen hasCloseButton={false}>
|
|
29
|
-
<DialogContent />
|
|
30
|
-
</Dialog>
|
|
31
|
-
</Flexbox>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
export const Dismissable = () => (
|
|
35
|
-
<Flexbox padding="32px" style={{ backgroundColor: '#EFEFEF' }}>
|
|
36
|
-
<Dialog isOpen hasCloseButton={true}>
|
|
37
|
-
<DialogContent>
|
|
38
|
-
<DialogContent.Header />
|
|
39
|
-
<DialogContent.Body>
|
|
40
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
41
|
-
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
42
|
-
</DialogContent.Body>
|
|
43
|
-
</DialogContent>
|
|
44
|
-
</Dialog>
|
|
45
|
-
</Flexbox>
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
export const WithHeader = () => (
|
|
49
|
-
<Flexbox padding="32px" style={{ backgroundColor: '#EFEFEF' }}>
|
|
50
|
-
<Dialog isOpen>
|
|
51
|
-
<DialogContent>
|
|
52
|
-
<DialogContent.Header header="DialogContent Header" />
|
|
53
|
-
<DialogContent.Body>
|
|
54
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
55
|
-
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
56
|
-
</DialogContent.Body>
|
|
57
|
-
</DialogContent>
|
|
58
|
-
</Dialog>
|
|
59
|
-
</Flexbox>
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
export const WithSubheader = () => (
|
|
63
|
-
<Flexbox padding="32px" style={{ backgroundColor: '#EFEFEF' }}>
|
|
64
|
-
<Dialog isOpen>
|
|
65
|
-
<DialogContent>
|
|
66
|
-
<DialogContent.Header
|
|
67
|
-
header="DialogContent Header"
|
|
68
|
-
subheader="Subheader"
|
|
69
|
-
/>
|
|
70
|
-
<DialogContent.Body>
|
|
71
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
72
|
-
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
73
|
-
</DialogContent.Body>
|
|
74
|
-
</DialogContent>
|
|
75
|
-
</Dialog>
|
|
76
|
-
</Flexbox>
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
export const WithIcon = () => (
|
|
80
|
-
<Flexbox padding="32px" style={{ backgroundColor: '#EFEFEF' }}>
|
|
81
|
-
<Dialog isOpen hasCloseButton={false}>
|
|
82
|
-
<DialogContent>
|
|
83
|
-
<DialogContent.Header
|
|
84
|
-
header="DialogContent Header"
|
|
85
|
-
subheader="Subheader"
|
|
86
|
-
icon={mdiInformationOutline}
|
|
87
|
-
/>
|
|
88
|
-
<DialogContent.Body>
|
|
89
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
90
|
-
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
91
|
-
</DialogContent.Body>
|
|
92
|
-
</DialogContent>
|
|
93
|
-
</Dialog>
|
|
94
|
-
</Flexbox>
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
export const WithDescription = () => (
|
|
98
|
-
<Flexbox padding="32px" style={{ backgroundColor: '#EFEFEF' }}>
|
|
99
|
-
<Dialog isOpen>
|
|
100
|
-
<DialogContent>
|
|
101
|
-
<DialogContent.Header
|
|
102
|
-
header="DialogContent Header"
|
|
103
|
-
subheader="Subheader"
|
|
104
|
-
>
|
|
105
|
-
<Flexbox flexDirection="column" alignItems="flex-start" gap="8px">
|
|
106
|
-
<Text>
|
|
107
|
-
<Number value={102} as="b" /> mails have been detected from this
|
|
108
|
-
domain.
|
|
109
|
-
</Text>
|
|
110
|
-
<Button variant="secondary" rightIcon={mdiArrowRight}>
|
|
111
|
-
More details
|
|
112
|
-
</Button>
|
|
113
|
-
</Flexbox>
|
|
114
|
-
</DialogContent.Header>
|
|
115
|
-
<DialogContent.Body>
|
|
116
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
117
|
-
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
118
|
-
</DialogContent.Body>
|
|
119
|
-
</DialogContent>
|
|
120
|
-
</Dialog>
|
|
121
|
-
</Flexbox>
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
export const WithActions = () => (
|
|
125
|
-
<Flexbox padding="32px" style={{ backgroundColor: '#EFEFEF' }}>
|
|
126
|
-
<Dialog isOpen>
|
|
127
|
-
<DialogContent>
|
|
128
|
-
<DialogContent.Header
|
|
129
|
-
header="DialogContent Header"
|
|
130
|
-
subheader="Subheader"
|
|
131
|
-
>
|
|
132
|
-
<Text>
|
|
133
|
-
<Number value={102} as="b" /> mails have been detected from this
|
|
134
|
-
domain.
|
|
135
|
-
</Text>
|
|
136
|
-
</DialogContent.Header>
|
|
137
|
-
<DialogContent.Body>
|
|
138
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
139
|
-
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
140
|
-
</DialogContent.Body>
|
|
141
|
-
<DialogContent.Actions justifyContent="space-between">
|
|
142
|
-
<Button variant="unstyled">Previous</Button>
|
|
143
|
-
<Flexbox>
|
|
144
|
-
<Button variant="secondary">Cancel</Button>
|
|
145
|
-
<Button>Next</Button>
|
|
146
|
-
</Flexbox>
|
|
147
|
-
</DialogContent.Actions>
|
|
148
|
-
</DialogContent>
|
|
149
|
-
</Dialog>
|
|
150
|
-
</Flexbox>
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
export const Small = () => (
|
|
154
|
-
<Flexbox padding="32px" style={{ backgroundColor: '#EFEFEF' }}>
|
|
155
|
-
<Dialog isOpen size="small">
|
|
156
|
-
<DialogContent>
|
|
157
|
-
<DialogContent.Header
|
|
158
|
-
header="DialogContent Header"
|
|
159
|
-
subheader="Subheader"
|
|
160
|
-
>
|
|
161
|
-
<Text>
|
|
162
|
-
<Number value={102} as="b" /> mails have been detected from this
|
|
163
|
-
domain.
|
|
164
|
-
</Text>
|
|
165
|
-
</DialogContent.Header>
|
|
166
|
-
<DialogContent.Body>
|
|
167
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
168
|
-
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
169
|
-
</DialogContent.Body>
|
|
170
|
-
<DialogContent.Actions justifyContent="space-between">
|
|
171
|
-
<Button variant="unstyled">Previous</Button>
|
|
172
|
-
<Flexbox>
|
|
173
|
-
<Button variant="secondary">Cancel</Button>
|
|
174
|
-
<Button>Next</Button>
|
|
175
|
-
</Flexbox>
|
|
176
|
-
</DialogContent.Actions>
|
|
177
|
-
</DialogContent>
|
|
178
|
-
</Dialog>
|
|
179
|
-
</Flexbox>
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
export const Medium = () => (
|
|
183
|
-
<Flexbox padding="32px" style={{ backgroundColor: '#EFEFEF' }}>
|
|
184
|
-
<Dialog isOpen size="medium">
|
|
185
|
-
<DialogContent>
|
|
186
|
-
<DialogContent.Header
|
|
187
|
-
header="DialogContent Header"
|
|
188
|
-
subheader="Subheader"
|
|
189
|
-
>
|
|
190
|
-
<Text>
|
|
191
|
-
<Number value={102} as="b" /> mails have been detected from this
|
|
192
|
-
domain.
|
|
193
|
-
</Text>
|
|
194
|
-
</DialogContent.Header>
|
|
195
|
-
<DialogContent.Body>
|
|
196
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
197
|
-
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
198
|
-
</DialogContent.Body>
|
|
199
|
-
<DialogContent.Actions justifyContent="space-between">
|
|
200
|
-
<Button variant="unstyled">Previous</Button>
|
|
201
|
-
<Flexbox>
|
|
202
|
-
<Button variant="secondary">Cancel</Button>
|
|
203
|
-
<Button>Next</Button>
|
|
204
|
-
</Flexbox>
|
|
205
|
-
</DialogContent.Actions>
|
|
206
|
-
</DialogContent>
|
|
207
|
-
</Dialog>
|
|
208
|
-
</Flexbox>
|
|
209
|
-
);
|
|
210
|
-
|
|
211
|
-
export const Large = () => (
|
|
212
|
-
<Flexbox padding="32px" style={{ backgroundColor: '#EFEFEF' }}>
|
|
213
|
-
<Dialog isOpen size="large">
|
|
214
|
-
<DialogContent>
|
|
215
|
-
<DialogContent.Header
|
|
216
|
-
header="DialogContent Header"
|
|
217
|
-
subheader="Subheader"
|
|
218
|
-
>
|
|
219
|
-
<Text>
|
|
220
|
-
<Number value={102} as="b" /> mails have been detected from this
|
|
221
|
-
domain.
|
|
222
|
-
</Text>
|
|
223
|
-
</DialogContent.Header>
|
|
224
|
-
<DialogContent.Body>
|
|
225
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
226
|
-
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
227
|
-
</DialogContent.Body>
|
|
228
|
-
<DialogContent.Actions justifyContent="space-between">
|
|
229
|
-
<Button variant="unstyled">Previous</Button>
|
|
230
|
-
<Flexbox>
|
|
231
|
-
<Button variant="secondary">Cancel</Button>
|
|
232
|
-
<Button>Next</Button>
|
|
233
|
-
</Flexbox>
|
|
234
|
-
</DialogContent.Actions>
|
|
235
|
-
</DialogContent>
|
|
236
|
-
</Dialog>
|
|
237
|
-
</Flexbox>
|
|
238
|
-
);
|
|
239
|
-
|
|
240
|
-
export const InitialFocusOnHeader = () => (
|
|
241
|
-
<Flexbox padding="32px" style={{ backgroundColor: '#EFEFEF' }}>
|
|
242
|
-
<Dialog isOpen initialFocus="header">
|
|
243
|
-
<DialogContent>
|
|
244
|
-
<DialogContent.Header
|
|
245
|
-
header="DialogContent Header"
|
|
246
|
-
subheader="Subheader"
|
|
247
|
-
>
|
|
248
|
-
<Text>
|
|
249
|
-
<Number value={102} as="b" /> mails have been detected from this
|
|
250
|
-
domain.
|
|
251
|
-
</Text>
|
|
252
|
-
</DialogContent.Header>
|
|
253
|
-
<DialogContent.Body>
|
|
254
|
-
{Array.from({ length: 100 }).map((e, i) => (
|
|
255
|
-
<p key={i}>
|
|
256
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
257
|
-
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
258
|
-
</p>
|
|
259
|
-
))}
|
|
260
|
-
</DialogContent.Body>
|
|
261
|
-
<DialogContent.Actions justifyContent="space-between">
|
|
262
|
-
<Button variant="unstyled">Previous</Button>
|
|
263
|
-
<Flexbox>
|
|
264
|
-
<Button variant="secondary">Cancel</Button>
|
|
265
|
-
<Button>Next</Button>
|
|
266
|
-
</Flexbox>
|
|
267
|
-
</DialogContent.Actions>
|
|
268
|
-
</DialogContent>
|
|
269
|
-
</Dialog>
|
|
270
|
-
</Flexbox>
|
|
271
|
-
);
|
|
272
|
-
|
|
273
|
-
export const InitialFocusOnBody = () => (
|
|
274
|
-
<Flexbox padding="32px" style={{ backgroundColor: '#EFEFEF' }}>
|
|
275
|
-
<Dialog isOpen initialFocus="body">
|
|
276
|
-
<DialogContent>
|
|
277
|
-
<DialogContent.Header
|
|
278
|
-
header="DialogContent Header"
|
|
279
|
-
subheader="Subheader"
|
|
280
|
-
>
|
|
281
|
-
<Text>
|
|
282
|
-
<Number value={102} as="b" /> mails have been detected from this
|
|
283
|
-
domain.
|
|
284
|
-
</Text>
|
|
285
|
-
</DialogContent.Header>
|
|
286
|
-
<DialogContent.Body>
|
|
287
|
-
{Array.from({ length: 100 }).map((e, i) => (
|
|
288
|
-
<p key={i}>
|
|
289
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
290
|
-
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
291
|
-
</p>
|
|
292
|
-
))}
|
|
293
|
-
</DialogContent.Body>
|
|
294
|
-
<DialogContent.Actions justifyContent="space-between">
|
|
295
|
-
<Button variant="unstyled">Previous</Button>
|
|
296
|
-
<Flexbox>
|
|
297
|
-
<Button variant="secondary">Cancel</Button>
|
|
298
|
-
<Button>Next</Button>
|
|
299
|
-
</Flexbox>
|
|
300
|
-
</DialogContent.Actions>
|
|
301
|
-
</DialogContent>
|
|
302
|
-
</Dialog>
|
|
303
|
-
</Flexbox>
|
|
304
|
-
);
|
|
305
|
-
|
|
306
|
-
export const InitialFocusOnActions = () => (
|
|
307
|
-
<Flexbox padding="32px" style={{ backgroundColor: '#EFEFEF' }}>
|
|
308
|
-
<Dialog isOpen initialFocus="actions">
|
|
309
|
-
<DialogContent>
|
|
310
|
-
<DialogContent.Header
|
|
311
|
-
header="DialogContent Header"
|
|
312
|
-
subheader="Subheader"
|
|
313
|
-
>
|
|
314
|
-
<Text>
|
|
315
|
-
<Number value={102} as="b" /> mails have been detected from this
|
|
316
|
-
domain.
|
|
317
|
-
</Text>
|
|
318
|
-
</DialogContent.Header>
|
|
319
|
-
<DialogContent.Body>
|
|
320
|
-
{Array.from({ length: 100 }).map((e, i) => (
|
|
321
|
-
<p key={i}>
|
|
322
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
323
|
-
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
324
|
-
</p>
|
|
325
|
-
))}
|
|
326
|
-
</DialogContent.Body>
|
|
327
|
-
<DialogContent.Actions justifyContent="space-between">
|
|
328
|
-
<Button variant="unstyled">Previous</Button>
|
|
329
|
-
<Flexbox>
|
|
330
|
-
<Button variant="secondary">Cancel</Button>
|
|
331
|
-
<Button>Next</Button>
|
|
332
|
-
</Flexbox>
|
|
333
|
-
</DialogContent.Actions>
|
|
334
|
-
</DialogContent>
|
|
335
|
-
</Dialog>
|
|
336
|
-
</Flexbox>
|
|
337
|
-
);
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import {
|
|
4
|
-
useMergeRefs,
|
|
5
|
-
FloatingPortal,
|
|
6
|
-
FloatingFocusManager,
|
|
7
|
-
useTransitionStyles,
|
|
8
|
-
} from '@floating-ui/react';
|
|
9
|
-
import { mdiClose } from '@redsift/icons';
|
|
10
|
-
|
|
11
|
-
import { useLocalizedStringFormatter } from 'react-aria';
|
|
12
|
-
import intlMessages from './intl';
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
Comp,
|
|
16
|
-
IconButton,
|
|
17
|
-
isComponent,
|
|
18
|
-
partitionComponents,
|
|
19
|
-
} from '@redsift/design-system';
|
|
20
|
-
import { DialogContentProps } from './types';
|
|
21
|
-
import { useDialogContext } from '../dialog';
|
|
22
|
-
import { StyledDialogContent, StyledFloatingOverlay } from './styles';
|
|
23
|
-
import { DialogContentActions } from '../dialog-content-actions';
|
|
24
|
-
import { DialogContentBody } from '../dialog-content-body';
|
|
25
|
-
import { DialogContentHeader } from '../dialog-content-header';
|
|
26
|
-
|
|
27
|
-
const COMPONENT_NAME = 'DialogContent';
|
|
28
|
-
const CLASSNAME = 'redsift-dialog-content';
|
|
29
|
-
const DEFAULT_PROPS: Partial<DialogContentProps> = {};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* The DialogContent component.
|
|
33
|
-
*/
|
|
34
|
-
export const BaseDialogContent: Comp<DialogContentProps, HTMLDivElement> =
|
|
35
|
-
forwardRef((props, ref) => {
|
|
36
|
-
const { children, className, ...forwardedProps } = props;
|
|
37
|
-
const {
|
|
38
|
-
context: floatingContext,
|
|
39
|
-
getFloatingProps,
|
|
40
|
-
refs,
|
|
41
|
-
labelId,
|
|
42
|
-
descriptionId,
|
|
43
|
-
handleOpen,
|
|
44
|
-
hasCloseButton,
|
|
45
|
-
initialFocus: propsInitialFocus,
|
|
46
|
-
size,
|
|
47
|
-
headerRef,
|
|
48
|
-
bodyRef,
|
|
49
|
-
actionsRef,
|
|
50
|
-
} = useDialogContext();
|
|
51
|
-
const { isMounted, styles } = useTransitionStyles(floatingContext);
|
|
52
|
-
const dialogRef = useMergeRefs([refs.setFloating, ref]);
|
|
53
|
-
|
|
54
|
-
const stringFormatter = useLocalizedStringFormatter(intlMessages);
|
|
55
|
-
|
|
56
|
-
const [[header], [body], [actions]] = partitionComponents(
|
|
57
|
-
React.Children.toArray(children),
|
|
58
|
-
[
|
|
59
|
-
isComponent('DialogContentHeader'),
|
|
60
|
-
isComponent('DialogContentBody'),
|
|
61
|
-
isComponent('DialogContentActions'),
|
|
62
|
-
]
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
const initialFocus:
|
|
66
|
-
| number
|
|
67
|
-
| React.MutableRefObject<HTMLElement | null>
|
|
68
|
-
| undefined =
|
|
69
|
-
propsInitialFocus === 'header'
|
|
70
|
-
? headerRef
|
|
71
|
-
: propsInitialFocus === 'body'
|
|
72
|
-
? bodyRef
|
|
73
|
-
: propsInitialFocus === 'actions'
|
|
74
|
-
? actionsRef
|
|
75
|
-
: propsInitialFocus
|
|
76
|
-
? propsInitialFocus
|
|
77
|
-
: undefined;
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<FloatingPortal id="redsift-app-container">
|
|
81
|
-
{isMounted && (
|
|
82
|
-
<StyledFloatingOverlay lockScroll style={styles}>
|
|
83
|
-
<FloatingFocusManager
|
|
84
|
-
context={floatingContext}
|
|
85
|
-
initialFocus={initialFocus ? initialFocus : undefined}
|
|
86
|
-
>
|
|
87
|
-
<StyledDialogContent
|
|
88
|
-
className={classNames(DialogContent.className, className)}
|
|
89
|
-
{...forwardedProps}
|
|
90
|
-
ref={dialogRef}
|
|
91
|
-
aria-labelledby={labelId}
|
|
92
|
-
aria-describedby={descriptionId}
|
|
93
|
-
{...getFloatingProps(props)}
|
|
94
|
-
style={styles}
|
|
95
|
-
$size={size!}
|
|
96
|
-
>
|
|
97
|
-
{header || hasCloseButton ? (
|
|
98
|
-
<div className={`${BaseDialogContent.className}__header`}>
|
|
99
|
-
{header}
|
|
100
|
-
|
|
101
|
-
{hasCloseButton ? (
|
|
102
|
-
<IconButton
|
|
103
|
-
aria-label={stringFormatter.format('close')}
|
|
104
|
-
className={`${BaseDialogContent.className}-header__icon-button`}
|
|
105
|
-
color="question"
|
|
106
|
-
icon={mdiClose}
|
|
107
|
-
onClick={() => handleOpen(false)}
|
|
108
|
-
/>
|
|
109
|
-
) : null}
|
|
110
|
-
</div>
|
|
111
|
-
) : null}
|
|
112
|
-
|
|
113
|
-
{body || actions ? (
|
|
114
|
-
<div className={`${BaseDialogContent.className}__content`}>
|
|
115
|
-
{body}
|
|
116
|
-
{actions}
|
|
117
|
-
</div>
|
|
118
|
-
) : null}
|
|
119
|
-
</StyledDialogContent>
|
|
120
|
-
</FloatingFocusManager>
|
|
121
|
-
</StyledFloatingOverlay>
|
|
122
|
-
)}
|
|
123
|
-
</FloatingPortal>
|
|
124
|
-
);
|
|
125
|
-
});
|
|
126
|
-
BaseDialogContent.className = CLASSNAME;
|
|
127
|
-
BaseDialogContent.defaultProps = DEFAULT_PROPS;
|
|
128
|
-
BaseDialogContent.displayName = COMPONENT_NAME;
|
|
129
|
-
|
|
130
|
-
export const DialogContent = Object.assign(BaseDialogContent, {
|
|
131
|
-
Header: DialogContentHeader,
|
|
132
|
-
Body: DialogContentBody,
|
|
133
|
-
Actions: DialogContentActions,
|
|
134
|
-
});
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { FloatingOverlay } from '@floating-ui/react';
|
|
2
|
-
import styled, { css } from 'styled-components';
|
|
3
|
-
import { DialogSize } from '../dialog/types';
|
|
4
|
-
import { StyledDialogContentProps } from './types';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Component style.
|
|
8
|
-
*/
|
|
9
|
-
export const StyledDialogContent = styled.div<StyledDialogContentProps>`
|
|
10
|
-
background-color: var(--redsift-color-neutral-white);
|
|
11
|
-
box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2);
|
|
12
|
-
color: var(--redsift-color-neutral-black);
|
|
13
|
-
display: flex;
|
|
14
|
-
filter: drop-shadow(0px 4px 5px rgba(0, 0, 0, 0.14))
|
|
15
|
-
drop-shadow(0px 1px 10px rgba(0, 0, 0, 0.12));
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
font-family: var(--redsift-typography-dialog-font-family);
|
|
18
|
-
font-size: var(--redsift-typography-dialog-font-size);
|
|
19
|
-
font-weight: var(--redsift-typography-dialog-font-weight);
|
|
20
|
-
line-height: var(--redsift-typography-dialog-line-height);
|
|
21
|
-
margin: 32px;
|
|
22
|
-
max-width: calc(100vw - 48px);
|
|
23
|
-
padding: 24px;
|
|
24
|
-
width: 540px;
|
|
25
|
-
z-index: var(--redsift-layout-z-index-dialog);
|
|
26
|
-
|
|
27
|
-
${({ $size }) => {
|
|
28
|
-
switch ($size) {
|
|
29
|
-
case DialogSize.small:
|
|
30
|
-
return css`
|
|
31
|
-
width: 540px;
|
|
32
|
-
`;
|
|
33
|
-
case DialogSize.large:
|
|
34
|
-
return css`
|
|
35
|
-
width: 800px;
|
|
36
|
-
`;
|
|
37
|
-
case DialogSize.medium:
|
|
38
|
-
default:
|
|
39
|
-
return css`
|
|
40
|
-
width: 700px;
|
|
41
|
-
`;
|
|
42
|
-
}
|
|
43
|
-
}}
|
|
44
|
-
|
|
45
|
-
&:focus-visible {
|
|
46
|
-
outline: none;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.redsift-dialog-content__header {
|
|
50
|
-
align-items: flex-start;
|
|
51
|
-
display: flex;
|
|
52
|
-
justify-content: space-between;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.redsift-card-header__icon-button {
|
|
56
|
-
margin-top: 8px;
|
|
57
|
-
margin-left: auto;
|
|
58
|
-
margin-right: 8px;
|
|
59
|
-
|
|
60
|
-
[dir='rtl'] & {
|
|
61
|
-
margin-left: 8px;
|
|
62
|
-
margin-right: auto;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
66
|
-
|
|
67
|
-
export const StyledFloatingOverlay = styled(FloatingOverlay)`
|
|
68
|
-
background: rgba(0, 0, 0, 0.8);
|
|
69
|
-
display: grid;
|
|
70
|
-
place-items: center;
|
|
71
|
-
z-index: var(--redsift-layout-z-index-overlay);
|
|
72
|
-
`;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
2
|
-
import { DialogSize } from '../dialog/types';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Component props.
|
|
6
|
-
*/
|
|
7
|
-
export interface DialogContentProps extends ComponentProps<'div'> {}
|
|
8
|
-
|
|
9
|
-
export type StyledDialogContentProps = DialogContentProps & {
|
|
10
|
-
$size: DialogSize;
|
|
11
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { act, render, waitFor } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import { DialogContentActions } from '.';
|
|
5
|
-
import { Dialog } from '../dialog';
|
|
6
|
-
|
|
7
|
-
const DialogActionsWrapper = ({ children }: { children: React.ReactNode }) => {
|
|
8
|
-
return (
|
|
9
|
-
<Dialog isOpen>
|
|
10
|
-
<Dialog.Content>{children}</Dialog.Content>
|
|
11
|
-
</Dialog>
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
describe('DialogContentActions', () => {
|
|
16
|
-
it('handles default', async () => {
|
|
17
|
-
const { getByText } = render(
|
|
18
|
-
<DialogContentActions>Actions</DialogContentActions>,
|
|
19
|
-
{
|
|
20
|
-
wrapper: DialogActionsWrapper,
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
await act(async () => {});
|
|
24
|
-
await waitFor(() => {
|
|
25
|
-
expect(getByText('Actions')).toBeVisible();
|
|
26
|
-
});
|
|
27
|
-
expect(getByText('Actions')).toBeVisible();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('supports custom className', async () => {
|
|
31
|
-
const { getByText } = render(
|
|
32
|
-
<DialogContentActions className="test-class">
|
|
33
|
-
Actions
|
|
34
|
-
</DialogContentActions>,
|
|
35
|
-
{ wrapper: DialogActionsWrapper }
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
await act(async () => {});
|
|
39
|
-
await waitFor(() => {
|
|
40
|
-
expect(getByText('Actions')).toBeVisible();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const component = getByText('Actions');
|
|
44
|
-
expect(component).toHaveAttribute(
|
|
45
|
-
'class',
|
|
46
|
-
expect.stringContaining(DialogContentActions.className!)
|
|
47
|
-
);
|
|
48
|
-
expect(component).toHaveAttribute(
|
|
49
|
-
'class',
|
|
50
|
-
expect.stringContaining('test-class')
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('supports custom data attributes', async () => {
|
|
55
|
-
const { getByText } = render(
|
|
56
|
-
<DialogContentActions data-testid="test">Actions</DialogContentActions>,
|
|
57
|
-
{ wrapper: DialogActionsWrapper }
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
await act(async () => {});
|
|
61
|
-
await waitFor(() => {
|
|
62
|
-
expect(getByText('Actions')).toBeVisible();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const component = getByText('Actions');
|
|
66
|
-
expect(component).toHaveAttribute('data-testid', 'test');
|
|
67
|
-
});
|
|
68
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import { useMergeRefs } from '@floating-ui/react';
|
|
4
|
-
|
|
5
|
-
import { Comp } from '@redsift/design-system';
|
|
6
|
-
import { StyledDialogContentActions } from './styles';
|
|
7
|
-
import { DialogContentActionsProps } from './types';
|
|
8
|
-
import { useDialogContext } from '../dialog';
|
|
9
|
-
|
|
10
|
-
const COMPONENT_NAME = 'DialogContentActions';
|
|
11
|
-
const CLASSNAME = 'redsift-dialog-content-actions';
|
|
12
|
-
const DEFAULT_PROPS: Partial<DialogContentActionsProps> = {
|
|
13
|
-
flexDirection: 'row',
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* The DialogContentActions component.
|
|
18
|
-
*/
|
|
19
|
-
export const DialogContentActions: Comp<
|
|
20
|
-
DialogContentActionsProps,
|
|
21
|
-
HTMLDivElement
|
|
22
|
-
> = forwardRef((props, ref) => {
|
|
23
|
-
const { children, className, ...forwardedProps } = props;
|
|
24
|
-
|
|
25
|
-
const { actionsRef, initialFocus } = useDialogContext();
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<StyledDialogContentActions
|
|
29
|
-
{...forwardedProps}
|
|
30
|
-
className={classNames(DialogContentActions.className, className)}
|
|
31
|
-
ref={useMergeRefs([ref, actionsRef])}
|
|
32
|
-
tabIndex={initialFocus === 'actions' ? -1 : undefined}
|
|
33
|
-
>
|
|
34
|
-
{children}
|
|
35
|
-
</StyledDialogContentActions>
|
|
36
|
-
);
|
|
37
|
-
});
|
|
38
|
-
DialogContentActions.className = CLASSNAME;
|
|
39
|
-
DialogContentActions.defaultProps = DEFAULT_PROPS;
|
|
40
|
-
DialogContentActions.displayName = COMPONENT_NAME;
|