@redsift/popovers 9.2.3-patch → 9.2.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.
Files changed (171) hide show
  1. package/coverage/clover.xml +763 -0
  2. package/coverage/coverage-final.json +53 -0
  3. package/coverage/lcov-report/base.css +224 -0
  4. package/coverage/lcov-report/block-navigation.js +87 -0
  5. package/coverage/lcov-report/dialog/Dialog.tsx.html +271 -0
  6. package/coverage/lcov-report/dialog/context.ts.html +97 -0
  7. package/coverage/lcov-report/dialog/index.html +191 -0
  8. package/coverage/lcov-report/dialog/index.ts.html +100 -0
  9. package/coverage/lcov-report/dialog/types.ts.html +241 -0
  10. package/coverage/lcov-report/dialog/useDialog.tsx.html +346 -0
  11. package/coverage/lcov-report/dialog/useDialogContext.tsx.html +121 -0
  12. package/coverage/lcov-report/dialog-content/DialogContent.tsx.html +484 -0
  13. package/coverage/lcov-report/dialog-content/index.html +146 -0
  14. package/coverage/lcov-report/dialog-content/index.ts.html +91 -0
  15. package/coverage/lcov-report/dialog-content/intl/index.html +116 -0
  16. package/coverage/lcov-report/dialog-content/intl/index.ts.html +106 -0
  17. package/coverage/lcov-report/dialog-content/styles.ts.html +256 -0
  18. package/coverage/lcov-report/dialog-content-actions/DialogContentActions.tsx.html +205 -0
  19. package/coverage/lcov-report/dialog-content-actions/index.html +146 -0
  20. package/coverage/lcov-report/dialog-content-actions/index.ts.html +91 -0
  21. package/coverage/lcov-report/dialog-content-actions/styles.ts.html +139 -0
  22. package/coverage/lcov-report/dialog-content-body/DialogContentBody.tsx.html +232 -0
  23. package/coverage/lcov-report/dialog-content-body/index.html +146 -0
  24. package/coverage/lcov-report/dialog-content-body/index.ts.html +91 -0
  25. package/coverage/lcov-report/dialog-content-body/styles.ts.html +259 -0
  26. package/coverage/lcov-report/dialog-content-header/DialogContentHeader.tsx.html +280 -0
  27. package/coverage/lcov-report/dialog-content-header/index.html +146 -0
  28. package/coverage/lcov-report/dialog-content-header/index.ts.html +91 -0
  29. package/coverage/lcov-report/dialog-content-header/styles.ts.html +193 -0
  30. package/coverage/lcov-report/dialog-trigger/DialogTrigger.tsx.html +217 -0
  31. package/coverage/lcov-report/dialog-trigger/index.html +131 -0
  32. package/coverage/lcov-report/dialog-trigger/index.ts.html +91 -0
  33. package/coverage/lcov-report/favicon.png +0 -0
  34. package/coverage/lcov-report/index.html +341 -0
  35. package/coverage/lcov-report/popover/Popover.tsx.html +295 -0
  36. package/coverage/lcov-report/popover/context.ts.html +97 -0
  37. package/coverage/lcov-report/popover/index.html +191 -0
  38. package/coverage/lcov-report/popover/index.ts.html +100 -0
  39. package/coverage/lcov-report/popover/types.ts.html +283 -0
  40. package/coverage/lcov-report/popover/usePopover.tsx.html +415 -0
  41. package/coverage/lcov-report/popover/usePopoverContext.tsx.html +121 -0
  42. package/coverage/lcov-report/popover-content/PopoverContent.tsx.html +229 -0
  43. package/coverage/lcov-report/popover-content/index.html +146 -0
  44. package/coverage/lcov-report/popover-content/index.ts.html +94 -0
  45. package/coverage/lcov-report/popover-content/styles.ts.html +370 -0
  46. package/coverage/lcov-report/popover-trigger/PopoverTrigger.tsx.html +202 -0
  47. package/coverage/lcov-report/popover-trigger/index.html +131 -0
  48. package/coverage/lcov-report/popover-trigger/index.ts.html +91 -0
  49. package/coverage/lcov-report/prettify.css +1 -0
  50. package/coverage/lcov-report/prettify.js +2 -0
  51. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  52. package/coverage/lcov-report/sorter.js +196 -0
  53. package/coverage/lcov-report/toast/Toast.tsx.html +373 -0
  54. package/coverage/lcov-report/toast/index.html +161 -0
  55. package/coverage/lcov-report/toast/index.ts.html +91 -0
  56. package/coverage/lcov-report/toast/intl/index.html +116 -0
  57. package/coverage/lcov-report/toast/intl/index.ts.html +106 -0
  58. package/coverage/lcov-report/toast/styles.ts.html +193 -0
  59. package/coverage/lcov-report/toast/types.ts.html +217 -0
  60. package/coverage/lcov-report/toast-container/ToastContainer.tsx.html +217 -0
  61. package/coverage/lcov-report/toast-container/index.html +161 -0
  62. package/coverage/lcov-report/toast-container/index.ts.html +94 -0
  63. package/coverage/lcov-report/toast-container/styles.ts.html +2284 -0
  64. package/coverage/lcov-report/toast-container/useToast.tsx.html +469 -0
  65. package/coverage/lcov-report/tooltip/Tooltip.tsx.html +250 -0
  66. package/coverage/lcov-report/tooltip/context.ts.html +97 -0
  67. package/coverage/lcov-report/tooltip/index.html +191 -0
  68. package/coverage/lcov-report/tooltip/index.ts.html +100 -0
  69. package/coverage/lcov-report/tooltip/types.ts.html +250 -0
  70. package/coverage/lcov-report/tooltip/useTooltip.tsx.html +358 -0
  71. package/coverage/lcov-report/tooltip/useTooltipContext.tsx.html +121 -0
  72. package/coverage/lcov-report/tooltip-content/TooltipContent.tsx.html +313 -0
  73. package/coverage/lcov-report/tooltip-content/index.html +146 -0
  74. package/coverage/lcov-report/tooltip-content/index.ts.html +91 -0
  75. package/coverage/lcov-report/tooltip-content/styles.ts.html +337 -0
  76. package/coverage/lcov-report/tooltip-trigger/TooltipTrigger.tsx.html +211 -0
  77. package/coverage/lcov-report/tooltip-trigger/index.html +131 -0
  78. package/coverage/lcov-report/tooltip-trigger/index.ts.html +91 -0
  79. package/coverage/lcov.info +1510 -0
  80. package/coverage/storybook/coverage-storybook.json +58724 -0
  81. package/dist/package.json +96 -0
  82. package/index.ts +1 -0
  83. package/jest.config.js +3 -0
  84. package/package.json +2 -3
  85. package/rollup.config.js +13 -0
  86. package/src/components/dialog/Dialog.stories.tsx +264 -0
  87. package/src/components/dialog/Dialog.test.tsx +116 -0
  88. package/src/components/dialog/Dialog.tsx +62 -0
  89. package/src/components/dialog/context.ts +4 -0
  90. package/src/components/dialog/index.ts +5 -0
  91. package/src/components/dialog/types.ts +52 -0
  92. package/src/components/dialog/useDialog.tsx +87 -0
  93. package/src/components/dialog/useDialogContext.tsx +12 -0
  94. package/src/components/dialog-content/DialogContent.stories.tsx +348 -0
  95. package/src/components/dialog-content/DialogContent.tsx +133 -0
  96. package/src/components/dialog-content/index.ts +2 -0
  97. package/src/components/dialog-content/intl/en-US.json +3 -0
  98. package/src/components/dialog-content/intl/fr-FR.json +3 -0
  99. package/src/components/dialog-content/intl/index.ts +7 -0
  100. package/src/components/dialog-content/styles.ts +57 -0
  101. package/src/components/dialog-content/types.ts +10 -0
  102. package/src/components/dialog-content-actions/DialogContentActions.test.tsx +68 -0
  103. package/src/components/dialog-content-actions/DialogContentActions.tsx +40 -0
  104. package/src/components/dialog-content-actions/index.ts +2 -0
  105. package/src/components/dialog-content-actions/styles.ts +18 -0
  106. package/src/components/dialog-content-actions/types.ts +11 -0
  107. package/src/components/dialog-content-body/DialogContentBody.test.tsx +63 -0
  108. package/src/components/dialog-content-body/DialogContentBody.tsx +49 -0
  109. package/src/components/dialog-content-body/index.ts +2 -0
  110. package/src/components/dialog-content-body/styles.ts +58 -0
  111. package/src/components/dialog-content-body/types.ts +14 -0
  112. package/src/components/dialog-content-header/DialogContentHeader.test.tsx +63 -0
  113. package/src/components/dialog-content-header/DialogContentHeader.tsx +65 -0
  114. package/src/components/dialog-content-header/index.ts +2 -0
  115. package/src/components/dialog-content-header/styles.ts +36 -0
  116. package/src/components/dialog-content-header/types.ts +21 -0
  117. package/src/components/dialog-trigger/DialogTrigger.tsx +44 -0
  118. package/src/components/dialog-trigger/index.ts +2 -0
  119. package/src/components/dialog-trigger/types.ts +9 -0
  120. package/src/components/popover/Popover.stories.tsx +129 -0
  121. package/src/components/popover/Popover.test.tsx +102 -0
  122. package/src/components/popover/Popover.tsx +70 -0
  123. package/src/components/popover/context.ts +4 -0
  124. package/src/components/popover/index.ts +5 -0
  125. package/src/components/popover/types.ts +66 -0
  126. package/src/components/popover/usePopover.tsx +110 -0
  127. package/src/components/popover/usePopoverContext.tsx +12 -0
  128. package/src/components/popover-content/PopoverContent.tsx +48 -0
  129. package/src/components/popover-content/index.ts +3 -0
  130. package/src/components/popover-content/styles.ts +95 -0
  131. package/src/components/popover-content/types.ts +11 -0
  132. package/src/components/popover-trigger/PopoverTrigger.tsx +39 -0
  133. package/src/components/popover-trigger/index.ts +2 -0
  134. package/src/components/popover-trigger/types.ts +9 -0
  135. package/src/components/toast/Toast.stories.tsx +68 -0
  136. package/src/components/toast/Toast.test.tsx +63 -0
  137. package/src/components/toast/Toast.tsx +96 -0
  138. package/src/components/toast/index.ts +2 -0
  139. package/src/components/toast/intl/en-US.json +3 -0
  140. package/src/components/toast/intl/fr-FR.json +3 -0
  141. package/src/components/toast/intl/index.ts +7 -0
  142. package/src/components/toast/styles.ts +36 -0
  143. package/src/components/toast/types.ts +44 -0
  144. package/src/components/toast-container/ToastContainer.stories.tsx +349 -0
  145. package/src/components/toast-container/ToastContainer.tsx +44 -0
  146. package/src/components/toast-container/index.ts +3 -0
  147. package/src/components/toast-container/styles.ts +733 -0
  148. package/src/components/toast-container/types.ts +110 -0
  149. package/src/components/toast-container/useToast.test.tsx +111 -0
  150. package/src/components/toast-container/useToast.tsx +128 -0
  151. package/src/components/tooltip/Tooltip.stories.tsx +196 -0
  152. package/src/components/tooltip/Tooltip.test.tsx +119 -0
  153. package/src/components/tooltip/Tooltip.tsx +55 -0
  154. package/src/components/tooltip/context.ts +4 -0
  155. package/src/components/tooltip/index.ts +5 -0
  156. package/src/components/tooltip/types.ts +55 -0
  157. package/src/components/tooltip/useTooltip.tsx +93 -0
  158. package/src/components/tooltip/useTooltipContext.tsx +12 -0
  159. package/src/components/tooltip-content/TooltipContent.tsx +76 -0
  160. package/src/components/tooltip-content/index.ts +2 -0
  161. package/src/components/tooltip-content/styles.ts +84 -0
  162. package/src/components/tooltip-content/types.ts +14 -0
  163. package/src/components/tooltip-trigger/TooltipTrigger.tsx +42 -0
  164. package/src/components/tooltip-trigger/index.ts +2 -0
  165. package/src/components/tooltip-trigger/types.ts +9 -0
  166. package/src/index.ts +16 -0
  167. package/tsconfig.json +3 -0
  168. /package/{CONTRIBUTING.md → dist/CONTRIBUTING.md} +0 -0
  169. /package/{index.d.ts → dist/index.d.ts} +0 -0
  170. /package/{index.js → dist/index.js} +0 -0
  171. /package/{index.js.map → dist/index.js.map} +0 -0
@@ -0,0 +1,349 @@
1
+ import React from 'react';
2
+
3
+ import { ToastContainer, useToast } from '.';
4
+ import { Button, Flexbox } from '@redsift/design-system';
5
+
6
+ export default {
7
+ title: 'Popovers/Toast/ToastContainer',
8
+ component: ToastContainer,
9
+ };
10
+
11
+ export const Simple = () => {
12
+ const { notify } = useToast();
13
+
14
+ return (
15
+ <>
16
+ <Flexbox>
17
+ <Button
18
+ onClick={() =>
19
+ notify({
20
+ content: 'This is a success',
21
+ variant: 'success',
22
+ })
23
+ }
24
+ >
25
+ Success
26
+ </Button>
27
+ <Button
28
+ onClick={() =>
29
+ notify({
30
+ title: 'This is a warning',
31
+ content: 'Cupcake ipsum dolor sit amet.',
32
+ variant: 'warning',
33
+ })
34
+ }
35
+ >
36
+ Warning
37
+ </Button>
38
+ <Button
39
+ onClick={() =>
40
+ notify({
41
+ title: 'This is an error',
42
+ content:
43
+ 'Cupcake ipsum dolor sit amet. Cookie chocolate cake muffin chocolate bar powder cake chupa chups. Gummies chocolate cake cupcake chupa chups sesame snaps soufflé soufflé gingerbread blueie. Caramels chocolate bar soufflé sesame snaps tiramisu. Cookie muffin pie cake cupcake sweet.',
44
+ variant: 'error',
45
+ })
46
+ }
47
+ >
48
+ Error
49
+ </Button>
50
+ <Button
51
+ onClick={() =>
52
+ notify({
53
+ title: 'This is an info',
54
+ content:
55
+ 'Cupcake ipsum dolor sit amet. Cookie chocolate cake muffin chocolate bar powder cake chupa chups.',
56
+ variant: 'info',
57
+ })
58
+ }
59
+ >
60
+ Info
61
+ </Button>
62
+ </Flexbox>
63
+ <ToastContainer />
64
+ </>
65
+ );
66
+ };
67
+
68
+ export const AllVariants = () => {
69
+ const { notify, success, warning, error, info, loading } = useToast();
70
+
71
+ return (
72
+ <>
73
+ <Flexbox
74
+ flexDirection="row"
75
+ flexWrap="wrap"
76
+ justifyContent="center"
77
+ alignItems="flex-start"
78
+ marginTop="96px"
79
+ >
80
+ <Button
81
+ variant="secondary"
82
+ onClick={() =>
83
+ notify({
84
+ content: 'Default',
85
+ })
86
+ }
87
+ >
88
+ Default
89
+ </Button>
90
+ <Button
91
+ variant="secondary"
92
+ onClick={() =>
93
+ success({
94
+ content: 'Success',
95
+ })
96
+ }
97
+ >
98
+ Success
99
+ </Button>
100
+ <Button
101
+ variant="secondary"
102
+ onClick={() =>
103
+ warning({
104
+ content: 'Warning',
105
+ })
106
+ }
107
+ >
108
+ Warning
109
+ </Button>
110
+ <Button
111
+ variant="secondary"
112
+ onClick={() =>
113
+ error({
114
+ content: 'Error',
115
+ })
116
+ }
117
+ >
118
+ Error
119
+ </Button>
120
+ <Button
121
+ variant="secondary"
122
+ onClick={() =>
123
+ info({
124
+ content: 'Info',
125
+ })
126
+ }
127
+ >
128
+ Info
129
+ </Button>
130
+ <Button
131
+ variant="secondary"
132
+ onClick={() =>
133
+ loading({
134
+ content: 'Loading',
135
+ })
136
+ }
137
+ >
138
+ Loading
139
+ </Button>
140
+ </Flexbox>
141
+ <ToastContainer />
142
+ </>
143
+ );
144
+ };
145
+
146
+ export const AllPlacements = () => {
147
+ const { notify } = useToast();
148
+
149
+ return (
150
+ <>
151
+ <Flexbox
152
+ flexDirection="row"
153
+ flexWrap="wrap"
154
+ justifyContent="center"
155
+ alignItems="flex-start"
156
+ marginTop="96px"
157
+ >
158
+ <Button
159
+ variant="secondary"
160
+ onClick={() =>
161
+ notify({
162
+ content: 'Top-left',
163
+ placement: 'top-left',
164
+ })
165
+ }
166
+ >
167
+ Top-left
168
+ </Button>
169
+ <Button
170
+ variant="secondary"
171
+ onClick={() =>
172
+ notify({
173
+ content: 'Top-center',
174
+ placement: 'top-center',
175
+ })
176
+ }
177
+ >
178
+ Top-center
179
+ </Button>
180
+ <Button
181
+ variant="secondary"
182
+ onClick={() =>
183
+ notify({
184
+ content: 'Top-right',
185
+ placement: 'top-right',
186
+ })
187
+ }
188
+ >
189
+ Top-right
190
+ </Button>
191
+ <Button
192
+ variant="secondary"
193
+ onClick={() =>
194
+ notify({
195
+ content: 'Bottom-left',
196
+ placement: 'bottom-left',
197
+ })
198
+ }
199
+ >
200
+ Bottom-left
201
+ </Button>
202
+ <Button
203
+ variant="secondary"
204
+ onClick={() =>
205
+ notify({
206
+ content: 'Bottom-center',
207
+ placement: 'bottom-center',
208
+ })
209
+ }
210
+ >
211
+ Bottom-center
212
+ </Button>
213
+ <Button
214
+ variant="secondary"
215
+ onClick={() =>
216
+ notify({
217
+ content: 'Bottom-right',
218
+ placement: 'bottom-right',
219
+ })
220
+ }
221
+ >
222
+ Bottom-right
223
+ </Button>
224
+ </Flexbox>
225
+ <ToastContainer />
226
+ </>
227
+ );
228
+ };
229
+
230
+ export const Dismiss = () => {
231
+ const toastId = React.useRef<number | string | null>(null);
232
+ const { notify, dismiss } = useToast();
233
+
234
+ return (
235
+ <>
236
+ <Flexbox>
237
+ <Button
238
+ onClick={() => {
239
+ toastId.current = notify({
240
+ content: 'Saved!',
241
+ autoClose: false,
242
+ closeButton: false,
243
+ });
244
+ }}
245
+ >
246
+ Notify
247
+ </Button>
248
+ <Button
249
+ onClick={() => {
250
+ if (toastId.current) {
251
+ dismiss(toastId.current);
252
+ }
253
+ }}
254
+ >
255
+ Dismiss
256
+ </Button>
257
+ <Button
258
+ onClick={() => {
259
+ dismiss();
260
+ }}
261
+ >
262
+ Dismiss all
263
+ </Button>
264
+ </Flexbox>
265
+ <ToastContainer />
266
+ </>
267
+ );
268
+ };
269
+
270
+ export const Update = () => {
271
+ const toastId = React.useRef<number | string | null>(null);
272
+ const { notify, update } = useToast();
273
+
274
+ return (
275
+ <>
276
+ <Flexbox>
277
+ <Button
278
+ onClick={() => {
279
+ toastId.current = notify({
280
+ content: 'Saving...',
281
+ variant: 'loading',
282
+ autoClose: false,
283
+ closeButton: false,
284
+ });
285
+ }}
286
+ >
287
+ Notify
288
+ </Button>
289
+ <Button
290
+ onClick={() => {
291
+ if (toastId.current) {
292
+ update(toastId.current, {
293
+ content: 'Saved!',
294
+ autoClose: 5000,
295
+ });
296
+ }
297
+ }}
298
+ >
299
+ Update
300
+ </Button>
301
+ </Flexbox>
302
+ <ToastContainer />
303
+ </>
304
+ );
305
+ };
306
+
307
+ export const WithPromise = () => {
308
+ const { promise } = useToast();
309
+
310
+ return (
311
+ <>
312
+ <Flexbox>
313
+ <Button
314
+ variant="secondary"
315
+ color="success"
316
+ onClick={() => {
317
+ const resolveAfter3Sec = new Promise((resolve) =>
318
+ setTimeout(resolve, 3000)
319
+ );
320
+ promise(resolveAfter3Sec, {
321
+ pending: { content: 'Promise is pending' },
322
+ success: { content: 'Promise resolved!' },
323
+ error: { content: 'Promise rejected!' },
324
+ });
325
+ }}
326
+ >
327
+ Successful promise
328
+ </Button>
329
+ <Button
330
+ variant="secondary"
331
+ color="error"
332
+ onClick={() => {
333
+ const failAfter3Sec = new Promise((_, reject) =>
334
+ setTimeout(reject, 3000)
335
+ );
336
+ promise(failAfter3Sec, {
337
+ pending: { content: 'Promise is pending' },
338
+ success: { content: 'Promise resolved!' },
339
+ error: { content: 'Promise rejected!' },
340
+ });
341
+ }}
342
+ >
343
+ Failing promise
344
+ </Button>
345
+ </Flexbox>
346
+ <ToastContainer />
347
+ </>
348
+ );
349
+ };
@@ -0,0 +1,44 @@
1
+ import React, { forwardRef, RefObject } from 'react';
2
+ import { Slide } from 'react-toastify';
3
+
4
+ import { Comp } from '@redsift/design-system';
5
+ import { ReactToastify, StyledToastContainer } from './styles';
6
+ import { ToastContainerProps } from './types';
7
+
8
+ const COMPONENT_NAME = 'ToastContainer';
9
+ const CLASSNAME = 'redsift-toast-container';
10
+ const DEFAULT_PROPS: Partial<ToastContainerProps> = {
11
+ autoClose: 5000,
12
+ closeOnClick: false,
13
+ draggable: true,
14
+ pauseOnFocusLoss: true,
15
+ pauseOnHover: true,
16
+ placement: 'top-right',
17
+ };
18
+
19
+ /**
20
+ * The ToastContainer component.
21
+ */
22
+ export const ToastContainer: Comp<ToastContainerProps, HTMLDivElement> =
23
+ forwardRef((props, ref) => {
24
+ const { placement, ...forwardedProps } = props;
25
+
26
+ return (
27
+ <ReactToastify>
28
+ <StyledToastContainer
29
+ {...forwardedProps}
30
+ className={ToastContainer.className}
31
+ closeButton={false}
32
+ icon={false}
33
+ newestOnTop={placement!.includes('bottom')}
34
+ position={placement}
35
+ ref={ref as RefObject<HTMLDivElement>}
36
+ theme="colored"
37
+ transition={Slide}
38
+ />
39
+ </ReactToastify>
40
+ );
41
+ });
42
+ ToastContainer.className = CLASSNAME;
43
+ ToastContainer.defaultProps = DEFAULT_PROPS;
44
+ ToastContainer.displayName = COMPONENT_NAME;
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export * from './ToastContainer';
3
+ export * from './useToast';