@toptal/picasso-modal 2.0.10 → 3.0.0
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-package/src/Modal/Modal.d.ts +5 -5
- package/dist-package/src/Modal/Modal.d.ts.map +1 -1
- package/dist-package/src/Modal/Modal.js +22 -21
- package/dist-package/src/Modal/Modal.js.map +1 -1
- package/dist-package/src/ModalActions/ModalActions.d.ts.map +1 -1
- package/dist-package/src/ModalActions/ModalActions.js +1 -7
- package/dist-package/src/ModalActions/ModalActions.js.map +1 -1
- package/dist-package/src/ModalCompound/index.d.ts +1 -1
- package/dist-package/src/ModalContent/ModalContent.d.ts.map +1 -1
- package/dist-package/src/ModalContent/ModalContent.js +6 -10
- package/dist-package/src/ModalContent/ModalContent.js.map +1 -1
- package/dist-package/src/ModalPaper/ModalPaper.d.ts +13 -0
- package/dist-package/src/ModalPaper/ModalPaper.d.ts.map +1 -0
- package/dist-package/src/ModalPaper/ModalPaper.js +43 -0
- package/dist-package/src/ModalPaper/ModalPaper.js.map +1 -0
- package/dist-package/src/ModalPaper/index.d.ts +2 -0
- package/dist-package/src/ModalPaper/index.d.ts.map +1 -0
- package/dist-package/src/ModalPaper/index.js +2 -0
- package/dist-package/src/ModalPaper/index.js.map +1 -0
- package/dist-package/src/ModalTitle/ModalTitle.d.ts.map +1 -1
- package/dist-package/src/ModalTitle/ModalTitle.js +1 -5
- package/dist-package/src/ModalTitle/ModalTitle.js.map +1 -1
- package/package.json +9 -5
- package/src/Modal/Modal.tsx +57 -48
- package/src/Modal/__snapshots__/test.tsx.snap +111 -134
- package/src/ModalActions/ModalActions.tsx +1 -10
- package/src/ModalContent/ModalContent.tsx +24 -13
- package/src/ModalPaper/ModalPaper.tsx +70 -0
- package/src/ModalPaper/index.ts +1 -0
- package/src/ModalTitle/ModalTitle.tsx +1 -9
- package/dist-package/src/Modal/styles.d.ts +0 -4
- package/dist-package/src/Modal/styles.d.ts.map +0 -1
- package/dist-package/src/Modal/styles.js +0 -67
- package/dist-package/src/Modal/styles.js.map +0 -1
- package/dist-package/src/ModalActions/styles.d.ts +0 -3
- package/dist-package/src/ModalActions/styles.d.ts.map +0 -1
- package/dist-package/src/ModalActions/styles.js +0 -8
- package/dist-package/src/ModalActions/styles.js.map +0 -1
- package/dist-package/src/ModalContent/styles.d.ts +0 -4
- package/dist-package/src/ModalContent/styles.d.ts.map +0 -1
- package/dist-package/src/ModalContent/styles.js +0 -31
- package/dist-package/src/ModalContent/styles.js.map +0 -1
- package/dist-package/src/ModalTitle/styles.d.ts +0 -3
- package/dist-package/src/ModalTitle/styles.d.ts.map +0 -1
- package/dist-package/src/ModalTitle/styles.js +0 -8
- package/dist-package/src/ModalTitle/styles.js.map +0 -1
- package/src/Modal/styles.ts +0 -75
- package/src/ModalActions/styles.ts +0 -9
- package/src/ModalContent/styles.ts +0 -43
- package/src/ModalTitle/styles.ts +0 -9
|
@@ -9,106 +9,101 @@ exports[`Modal renders 1`] = `
|
|
|
9
9
|
class="Picasso-root"
|
|
10
10
|
/>
|
|
11
11
|
<div
|
|
12
|
-
class="
|
|
12
|
+
class="base-Modal fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center"
|
|
13
13
|
role="presentation"
|
|
14
|
-
style="position: fixed; z-index: 1300; right: 0px; bottom: 0px; top: 0px; left: 0px;"
|
|
15
14
|
>
|
|
16
15
|
<div
|
|
17
16
|
aria-hidden="true"
|
|
18
|
-
class="
|
|
19
|
-
style="
|
|
17
|
+
class="opacity-0 transition-opacity fixed -z inset-0 bg-black -webkit-tap-highlight-color bg-opacity"
|
|
18
|
+
style="transition-duration: 300ms; opacity: 1;"
|
|
20
19
|
/>
|
|
21
20
|
<div
|
|
22
|
-
data-
|
|
21
|
+
data-testid="sentinelStart"
|
|
23
22
|
tabindex="0"
|
|
24
23
|
/>
|
|
25
24
|
<div
|
|
26
|
-
class="
|
|
27
|
-
role="
|
|
28
|
-
style="
|
|
25
|
+
class="bg-white shadow-2 duration-300 delay-0 opacity-0 transition-opacity outline-none overflow-y flex flex-col m-4 sm:h-auto sm:m-8 max-w-[calc(100%_ sm:max-w-[calc(100%_ rounded-md w-[40.625rem] relative max-h-[calc(100%_ sm:max-h-[calc(100%_"
|
|
26
|
+
role="dialog"
|
|
27
|
+
style="transition-duration: 300ms; opacity: 1;"
|
|
29
28
|
tabindex="-1"
|
|
30
29
|
>
|
|
31
30
|
<div
|
|
32
|
-
class="
|
|
33
|
-
role="dialog"
|
|
31
|
+
class="pr-6 mt-8 mx-8 mb-0"
|
|
34
32
|
>
|
|
35
|
-
<
|
|
36
|
-
class="
|
|
33
|
+
<h2
|
|
34
|
+
class="m-0 text-xl text-black font-semibold"
|
|
37
35
|
>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
Title
|
|
37
|
+
</h2>
|
|
38
|
+
</div>
|
|
39
|
+
<div
|
|
40
|
+
class="flex relative flex-auto overflow-y"
|
|
41
|
+
>
|
|
44
42
|
<div
|
|
45
|
-
class="
|
|
43
|
+
class="pt-6 px-8 pb-8 overflow-auto flex-auto"
|
|
46
44
|
>
|
|
47
|
-
|
|
48
|
-
class="PicassoModalContent-modalContent"
|
|
49
|
-
>
|
|
50
|
-
Modal test content
|
|
51
|
-
</div>
|
|
45
|
+
Modal test content
|
|
52
46
|
</div>
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
</div>
|
|
48
|
+
<div
|
|
49
|
+
class="mt-0 mx-8 mb-8 text-right"
|
|
50
|
+
>
|
|
51
|
+
<button
|
|
52
|
+
aria-disabled="false"
|
|
53
|
+
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border border-solid text-black hover:border-black visited:text-black active:bg-gray active:border-black bg-white border-gray min-w h-8 py-0 px-4"
|
|
54
|
+
data-component-type="button"
|
|
55
|
+
role="button"
|
|
56
|
+
tabindex="0"
|
|
57
|
+
type="button"
|
|
55
58
|
>
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border border-solid text-black hover:border-black visited:text-black active:bg-gray active:border-black bg-white border-gray min-w h-8 py-0 px-4"
|
|
59
|
-
data-component-type="button"
|
|
60
|
-
role="button"
|
|
61
|
-
tabindex="0"
|
|
62
|
-
type="button"
|
|
63
|
-
>
|
|
64
|
-
<span
|
|
65
|
-
class="PicassoContainer-centerAlignItems PicassoContainer-flex PicassoContainer-inline font-semibold whitespace-nowrap text-button"
|
|
66
|
-
>
|
|
67
|
-
Cancel
|
|
68
|
-
</span>
|
|
69
|
-
</button>
|
|
70
|
-
<button
|
|
71
|
-
aria-disabled="false"
|
|
72
|
-
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border-none text-white visited:text-white hover:bg-[#27D496] active:bg-[#00A96C] bg-green min-w h-8 py-0 px-4"
|
|
73
|
-
data-component-type="button"
|
|
74
|
-
role="button"
|
|
75
|
-
tabindex="0"
|
|
76
|
-
type="button"
|
|
59
|
+
<span
|
|
60
|
+
class="items-center inline-flex font-semibold whitespace-nowrap text-button"
|
|
77
61
|
>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
Update
|
|
82
|
-
</span>
|
|
83
|
-
</button>
|
|
84
|
-
</div>
|
|
62
|
+
Cancel
|
|
63
|
+
</span>
|
|
64
|
+
</button>
|
|
85
65
|
<button
|
|
86
66
|
aria-disabled="false"
|
|
87
|
-
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer
|
|
67
|
+
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border-none text-white visited:text-white hover:bg-[#27D496] active:bg-[#00A96C] bg-green min-w h-8 py-0 px-4"
|
|
88
68
|
data-component-type="button"
|
|
89
|
-
data-testid="close-modal"
|
|
90
69
|
role="button"
|
|
91
70
|
tabindex="0"
|
|
92
71
|
type="button"
|
|
93
72
|
>
|
|
94
73
|
<span
|
|
95
|
-
class="
|
|
74
|
+
class="items-center inline-flex font-semibold whitespace-nowrap text-button"
|
|
96
75
|
>
|
|
97
|
-
|
|
98
|
-
class="PicassoSvgCloseMinor16-root"
|
|
99
|
-
style="min-width: 16px; min-height: 16px;"
|
|
100
|
-
viewBox="0 0 16 16"
|
|
101
|
-
>
|
|
102
|
-
<path
|
|
103
|
-
d="m8.707 8 3.5 3.5-.707.707-3.5-3.5-3.5 3.5-.707-.707 3.5-3.5-3.5-3.5.707-.707 3.5 3.5 3.5-3.5.707.707-3.5 3.5Z"
|
|
104
|
-
/>
|
|
105
|
-
</svg>
|
|
76
|
+
Update
|
|
106
77
|
</span>
|
|
107
78
|
</button>
|
|
108
79
|
</div>
|
|
80
|
+
<button
|
|
81
|
+
aria-disabled="false"
|
|
82
|
+
aria-label="Close"
|
|
83
|
+
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer rounded-full p-0 w-[1.5em] h-[1.5em] border-none text-graphite hover:bg-gray active:bg-gray focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] bg-transparent absolute top-8 right-8"
|
|
84
|
+
data-component-type="button"
|
|
85
|
+
data-testid="close-modal"
|
|
86
|
+
role="button"
|
|
87
|
+
tabindex="0"
|
|
88
|
+
type="button"
|
|
89
|
+
>
|
|
90
|
+
<span
|
|
91
|
+
class="items-center inline-flex font-semibold whitespace-nowrap text-button"
|
|
92
|
+
>
|
|
93
|
+
<svg
|
|
94
|
+
class="PicassoSvgCloseMinor16-root"
|
|
95
|
+
style="min-width: 16px; min-height: 16px;"
|
|
96
|
+
viewBox="0 0 16 16"
|
|
97
|
+
>
|
|
98
|
+
<path
|
|
99
|
+
d="m8.707 8 3.5 3.5-.707.707-3.5-3.5-3.5 3.5-.707-.707 3.5-3.5-3.5-3.5.707-.707 3.5 3.5 3.5-3.5.707.707-3.5 3.5Z"
|
|
100
|
+
/>
|
|
101
|
+
</svg>
|
|
102
|
+
</span>
|
|
103
|
+
</button>
|
|
109
104
|
</div>
|
|
110
105
|
<div
|
|
111
|
-
data-
|
|
106
|
+
data-testid="sentinelEnd"
|
|
112
107
|
tabindex="0"
|
|
113
108
|
/>
|
|
114
109
|
</div>
|
|
@@ -131,56 +126,50 @@ exports[`Modal useModal opens and closes modal 1`] = `
|
|
|
131
126
|
type="button"
|
|
132
127
|
>
|
|
133
128
|
<span
|
|
134
|
-
class="
|
|
129
|
+
class="items-center inline-flex font-semibold whitespace-nowrap text-button"
|
|
135
130
|
>
|
|
136
131
|
Show
|
|
137
132
|
</span>
|
|
138
133
|
</button>
|
|
139
134
|
<div
|
|
140
|
-
class="
|
|
135
|
+
class="base-Modal fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center"
|
|
141
136
|
role="presentation"
|
|
142
|
-
style="position: fixed; z-index: 1300; right: 0px; bottom: 0px; top: 0px; left: 0px;"
|
|
143
137
|
>
|
|
144
138
|
<div
|
|
145
139
|
aria-hidden="true"
|
|
146
|
-
class="
|
|
147
|
-
style="
|
|
140
|
+
class="opacity-0 transition-opacity fixed -z inset-0 bg-black -webkit-tap-highlight-color bg-opacity"
|
|
141
|
+
style="transition-duration: 300ms; opacity: 1;"
|
|
148
142
|
/>
|
|
149
143
|
<div
|
|
150
|
-
data-
|
|
144
|
+
data-testid="sentinelStart"
|
|
151
145
|
tabindex="0"
|
|
152
146
|
/>
|
|
153
147
|
<div
|
|
154
|
-
class="
|
|
155
|
-
role="
|
|
156
|
-
style="
|
|
148
|
+
class="bg-white shadow-2 duration-300 delay-0 opacity-0 transition-opacity outline-none overflow-y flex flex-col m-4 sm:h-auto sm:m-8 max-w-[calc(100%_ sm:max-w-[calc(100%_ rounded-md w-[40.625rem] relative max-h-[calc(100%_ sm:max-h-[calc(100%_"
|
|
149
|
+
role="dialog"
|
|
150
|
+
style="transition-duration: 300ms; opacity: 1;"
|
|
157
151
|
tabindex="-1"
|
|
158
152
|
>
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
153
|
+
<p>
|
|
154
|
+
Modal content
|
|
155
|
+
</p>
|
|
156
|
+
<button
|
|
157
|
+
aria-disabled="false"
|
|
158
|
+
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border-none text-white visited:text-white hover:bg-[#4269D6] active:bg-[#1A41AB] bg-blue min-w h-8 py-0 px-4"
|
|
159
|
+
data-component-type="button"
|
|
160
|
+
role="button"
|
|
161
|
+
tabindex="0"
|
|
162
|
+
type="button"
|
|
162
163
|
>
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
</p>
|
|
166
|
-
<button
|
|
167
|
-
aria-disabled="false"
|
|
168
|
-
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border-none text-white visited:text-white hover:bg-[#4269D6] active:bg-[#1A41AB] bg-blue min-w h-8 py-0 px-4"
|
|
169
|
-
data-component-type="button"
|
|
170
|
-
role="button"
|
|
171
|
-
tabindex="0"
|
|
172
|
-
type="button"
|
|
164
|
+
<span
|
|
165
|
+
class="items-center inline-flex font-semibold whitespace-nowrap text-button"
|
|
173
166
|
>
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
Hide
|
|
178
|
-
</span>
|
|
179
|
-
</button>
|
|
180
|
-
</div>
|
|
167
|
+
Hide
|
|
168
|
+
</span>
|
|
169
|
+
</button>
|
|
181
170
|
</div>
|
|
182
171
|
<div
|
|
183
|
-
data-
|
|
172
|
+
data-testid="sentinelEnd"
|
|
184
173
|
tabindex="0"
|
|
185
174
|
/>
|
|
186
175
|
</div>
|
|
@@ -204,7 +193,7 @@ exports[`Modal useModal opens and closes modal 2`] = `
|
|
|
204
193
|
type="button"
|
|
205
194
|
>
|
|
206
195
|
<span
|
|
207
|
-
class="
|
|
196
|
+
class="items-center inline-flex font-semibold whitespace-nowrap text-button"
|
|
208
197
|
>
|
|
209
198
|
Show
|
|
210
199
|
</span>
|
|
@@ -230,7 +219,7 @@ exports[`Modal useModal shows multiple modals at the same time 1`] = `
|
|
|
230
219
|
type="button"
|
|
231
220
|
>
|
|
232
221
|
<span
|
|
233
|
-
class="
|
|
222
|
+
class="items-center inline-flex font-semibold whitespace-nowrap text-button"
|
|
234
223
|
>
|
|
235
224
|
Show first
|
|
236
225
|
</span>
|
|
@@ -245,77 +234,65 @@ exports[`Modal useModal shows multiple modals at the same time 1`] = `
|
|
|
245
234
|
type="button"
|
|
246
235
|
>
|
|
247
236
|
<span
|
|
248
|
-
class="
|
|
237
|
+
class="items-center inline-flex font-semibold whitespace-nowrap text-button"
|
|
249
238
|
>
|
|
250
239
|
Show second
|
|
251
240
|
</span>
|
|
252
241
|
</button>
|
|
253
242
|
<div
|
|
254
243
|
aria-hidden="true"
|
|
255
|
-
class="
|
|
244
|
+
class="base-Modal fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center"
|
|
256
245
|
role="presentation"
|
|
257
|
-
style="position: fixed; z-index: 1300; right: 0px; bottom: 0px; top: 0px; left: 0px;"
|
|
258
246
|
>
|
|
259
247
|
<div
|
|
260
248
|
aria-hidden="true"
|
|
261
|
-
class="
|
|
262
|
-
style="
|
|
249
|
+
class="opacity-0 transition-opacity fixed -z inset-0 bg-black -webkit-tap-highlight-color bg-opacity"
|
|
250
|
+
style="transition-duration: 300ms; opacity: 1;"
|
|
263
251
|
/>
|
|
264
252
|
<div
|
|
265
|
-
data-
|
|
253
|
+
data-testid="sentinelStart"
|
|
266
254
|
tabindex="0"
|
|
267
255
|
/>
|
|
268
256
|
<div
|
|
269
|
-
class="
|
|
270
|
-
role="
|
|
271
|
-
style="
|
|
257
|
+
class="bg-white shadow-2 duration-300 delay-0 opacity-0 transition-opacity outline-none overflow-y flex flex-col m-4 sm:h-auto sm:m-8 max-w-[calc(100%_ sm:max-w-[calc(100%_ rounded-md w-[40.625rem] relative max-h-[calc(100%_ sm:max-h-[calc(100%_"
|
|
258
|
+
role="dialog"
|
|
259
|
+
style="transition-duration: 300ms; opacity: 1;"
|
|
272
260
|
tabindex="-1"
|
|
273
261
|
>
|
|
274
|
-
<
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
>
|
|
278
|
-
<p>
|
|
279
|
-
First modal content
|
|
280
|
-
</p>
|
|
281
|
-
</div>
|
|
262
|
+
<p>
|
|
263
|
+
First modal content
|
|
264
|
+
</p>
|
|
282
265
|
</div>
|
|
283
266
|
<div
|
|
284
|
-
data-
|
|
267
|
+
data-testid="sentinelEnd"
|
|
285
268
|
tabindex="0"
|
|
286
269
|
/>
|
|
287
270
|
</div>
|
|
288
271
|
<div
|
|
289
|
-
class="
|
|
272
|
+
class="base-Modal fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center"
|
|
290
273
|
role="presentation"
|
|
291
|
-
style="position: fixed; z-index: 1300; right: 0px; bottom: 0px; top: 0px; left: 0px;"
|
|
292
274
|
>
|
|
293
275
|
<div
|
|
294
276
|
aria-hidden="true"
|
|
295
|
-
class="
|
|
296
|
-
style="
|
|
277
|
+
class="opacity-0 transition-opacity fixed -z inset-0 bg-black -webkit-tap-highlight-color bg-opacity"
|
|
278
|
+
style="transition-duration: 300ms; opacity: 1;"
|
|
297
279
|
/>
|
|
298
280
|
<div
|
|
299
|
-
data-
|
|
281
|
+
data-testid="sentinelStart"
|
|
300
282
|
tabindex="0"
|
|
301
283
|
/>
|
|
302
284
|
<div
|
|
303
|
-
class="
|
|
304
|
-
role="
|
|
305
|
-
style="
|
|
285
|
+
class="bg-white shadow-2 duration-300 delay-0 opacity-0 transition-opacity outline-none overflow-y flex flex-col m-4 sm:h-auto sm:m-8 max-w-[calc(100%_ sm:max-w-[calc(100%_ rounded-md w-[40.625rem] relative max-h-[calc(100%_ sm:max-h-[calc(100%_"
|
|
286
|
+
role="dialog"
|
|
287
|
+
style="transition-duration: 300ms; opacity: 1;"
|
|
306
288
|
tabindex="-1"
|
|
307
289
|
>
|
|
308
|
-
<
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
>
|
|
312
|
-
<p>
|
|
313
|
-
Second modal content
|
|
314
|
-
</p>
|
|
315
|
-
</div>
|
|
290
|
+
<p>
|
|
291
|
+
Second modal content
|
|
292
|
+
</p>
|
|
316
293
|
</div>
|
|
317
294
|
<div
|
|
318
|
-
data-
|
|
295
|
+
data-testid="sentinelEnd"
|
|
319
296
|
tabindex="0"
|
|
320
297
|
/>
|
|
321
298
|
</div>
|
|
@@ -1,31 +1,22 @@
|
|
|
1
1
|
import type { ReactNode, HTMLAttributes } from 'react'
|
|
2
2
|
import React, { forwardRef } from 'react'
|
|
3
|
-
import type { Theme } from '@material-ui/core/styles'
|
|
4
|
-
import { makeStyles } from '@material-ui/core/styles'
|
|
5
3
|
import cx from 'classnames'
|
|
6
4
|
import type { BaseProps } from '@toptal/picasso-shared'
|
|
7
5
|
|
|
8
|
-
import styles from './styles'
|
|
9
|
-
|
|
10
6
|
export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
|
|
11
7
|
/** Action content (e.g. Buttons) */
|
|
12
8
|
children: ReactNode
|
|
13
9
|
}
|
|
14
10
|
|
|
15
|
-
const useStyles = makeStyles<Theme>(styles, {
|
|
16
|
-
name: 'PicassoModalAction',
|
|
17
|
-
})
|
|
18
|
-
|
|
19
11
|
export const ModalActions = forwardRef<HTMLDivElement, Props>(
|
|
20
12
|
function ModalActions(props, ref) {
|
|
21
13
|
const { children, className, style, ...rest } = props
|
|
22
|
-
const classes = useStyles()
|
|
23
14
|
|
|
24
15
|
return (
|
|
25
16
|
<div
|
|
26
17
|
{...rest}
|
|
27
18
|
ref={ref}
|
|
28
|
-
className={cx(
|
|
19
|
+
className={cx('mt-0 mx-8 mb-8 text-right', className)}
|
|
29
20
|
style={style}
|
|
30
21
|
>
|
|
31
22
|
{children}
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import type { ReactNode, HTMLAttributes } from 'react'
|
|
2
2
|
import React, { forwardRef } from 'react'
|
|
3
|
-
import type { Theme } from '@material-ui/core/styles'
|
|
4
|
-
import { makeStyles } from '@material-ui/core/styles'
|
|
5
3
|
import cx from 'classnames'
|
|
6
4
|
import type { BaseProps } from '@toptal/picasso-shared'
|
|
7
5
|
import { useCombinedRefs } from '@toptal/picasso-utils'
|
|
8
6
|
|
|
9
|
-
import styles from './styles'
|
|
10
7
|
import useScrollableShades from './hooks/use-scrollable-shades'
|
|
11
8
|
|
|
12
9
|
export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
|
|
13
10
|
/** Content of Modal */
|
|
14
11
|
children: ReactNode
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
const useStyles = makeStyles<Theme>(styles, {
|
|
18
|
-
name: 'PicassoModalContent',
|
|
19
|
-
})
|
|
20
|
-
|
|
21
13
|
export const ModalContent = forwardRef<HTMLDivElement, Props>(
|
|
22
14
|
function ModalContent(props, ref) {
|
|
23
15
|
const { children, className, style, ...rest } = props
|
|
@@ -30,17 +22,36 @@ export const ModalContent = forwardRef<HTMLDivElement, Props>(
|
|
|
30
22
|
|
|
31
23
|
const { top, bottom } = useScrollableShades(modalContentRef)
|
|
32
24
|
|
|
33
|
-
const
|
|
25
|
+
const shadeClasses =
|
|
26
|
+
'z-[1] absolute pointer-events-none right-8 left-8 h-[112px]'
|
|
27
|
+
const gradientClasses =
|
|
28
|
+
'from-white to-transparent to-100% from-0% via-[2rem] via-white'
|
|
34
29
|
|
|
35
30
|
return (
|
|
36
|
-
<div className=
|
|
37
|
-
{top &&
|
|
38
|
-
|
|
31
|
+
<div className='flex relative flex-auto overflow-y-hidden'>
|
|
32
|
+
{top && (
|
|
33
|
+
<div
|
|
34
|
+
className={cx(
|
|
35
|
+
shadeClasses,
|
|
36
|
+
gradientClasses,
|
|
37
|
+
'top-0 bg-gradient-to-b'
|
|
38
|
+
)}
|
|
39
|
+
/>
|
|
40
|
+
)}
|
|
41
|
+
{bottom && (
|
|
42
|
+
<div
|
|
43
|
+
className={cx(
|
|
44
|
+
shadeClasses,
|
|
45
|
+
gradientClasses,
|
|
46
|
+
'bottom-0 bg-gradient-to-t'
|
|
47
|
+
)}
|
|
48
|
+
/>
|
|
49
|
+
)}
|
|
39
50
|
<div
|
|
40
51
|
{...rest}
|
|
41
52
|
style={style}
|
|
42
53
|
ref={modalContentRef}
|
|
43
|
-
className={cx(
|
|
54
|
+
className={cx('pt-6 px-8 pb-8 overflow-auto flex-auto', className)}
|
|
44
55
|
>
|
|
45
56
|
{children}
|
|
46
57
|
</div>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import cx from 'classnames'
|
|
3
|
+
import type { SizeType } from '@toptal/picasso-shared'
|
|
4
|
+
import { Paper } from '@toptal/picasso-paper'
|
|
5
|
+
|
|
6
|
+
type PaperSize =
|
|
7
|
+
| SizeType<'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'>
|
|
8
|
+
| 'full-screen'
|
|
9
|
+
type Alignment = 'top' | 'centered'
|
|
10
|
+
|
|
11
|
+
interface Props extends React.HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
align: Alignment
|
|
13
|
+
children: React.ReactNode
|
|
14
|
+
/** Width of modal */
|
|
15
|
+
size: PaperSize
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const fullscreenClasses = `h-full w-full max-h-full max-w-full`
|
|
19
|
+
const defaultClasses = `m-4 sm:h-auto sm:m-8 max-w-[calc(100%_-_2rem)] sm:max-w-[calc(100%_-_6rem)] rounded-md`
|
|
20
|
+
|
|
21
|
+
const sizeBasedClasses = {
|
|
22
|
+
xsmall: `${defaultClasses} w-[20.5rem]`,
|
|
23
|
+
small: `${defaultClasses} w-[32.5rem]`,
|
|
24
|
+
medium: `${defaultClasses} w-[40.625rem]`,
|
|
25
|
+
large: `${defaultClasses} w-[50rem]`,
|
|
26
|
+
xlarge: `${defaultClasses} w-[75rem]`,
|
|
27
|
+
'full-screen': fullscreenClasses,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const alignBasedClasses = {
|
|
31
|
+
centered: 'relative',
|
|
32
|
+
top: 'absolute top-0',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const getMaxHeightClass = (size: PaperSize, align: Alignment) => {
|
|
36
|
+
if (size === 'full-screen') {
|
|
37
|
+
return 'max-h-full'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (align === 'top') {
|
|
41
|
+
return `max-h-[calc(100%_-_2rem)] sm:max-h-[calc(100%_-_4rem)]`
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return `max-h-[calc(100%_-_2rem)] sm:max-h-[calc(100%_-_6rem)]`
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const ModalPaper = React.forwardRef<HTMLDivElement, Props>(
|
|
48
|
+
function ModalPaper({ children, size, align, className, ...props }, ref) {
|
|
49
|
+
return (
|
|
50
|
+
<Paper
|
|
51
|
+
ref={ref}
|
|
52
|
+
role='dialog'
|
|
53
|
+
elevation={2}
|
|
54
|
+
className={cx(
|
|
55
|
+
className,
|
|
56
|
+
'outline-none overflow-y-auto',
|
|
57
|
+
'flex flex-col',
|
|
58
|
+
sizeBasedClasses[size],
|
|
59
|
+
alignBasedClasses[align],
|
|
60
|
+
getMaxHeightClass(size, align)
|
|
61
|
+
)}
|
|
62
|
+
{...props}
|
|
63
|
+
>
|
|
64
|
+
{children}
|
|
65
|
+
</Paper>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
export default ModalPaper
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ModalPaper } from './ModalPaper'
|
|
@@ -1,33 +1,25 @@
|
|
|
1
1
|
import type { ReactNode, HTMLAttributes } from 'react'
|
|
2
2
|
import React, { forwardRef } from 'react'
|
|
3
|
-
import type { Theme } from '@material-ui/core/styles'
|
|
4
|
-
import { makeStyles } from '@material-ui/core/styles'
|
|
5
3
|
import cx from 'classnames'
|
|
6
4
|
import type { BaseProps } from '@toptal/picasso-shared'
|
|
7
5
|
import { Typography } from '@toptal/picasso-typography'
|
|
8
6
|
|
|
9
|
-
import styles from './styles'
|
|
10
|
-
|
|
11
7
|
export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
|
|
12
8
|
/** Title content */
|
|
13
9
|
children: ReactNode
|
|
14
10
|
}
|
|
15
11
|
|
|
16
|
-
const useStyles = makeStyles<Theme>(styles, { name: 'PicassoModalTitle' })
|
|
17
|
-
|
|
18
12
|
export const ModalTitle = forwardRef<HTMLDivElement, Props>(function ModalTitle(
|
|
19
13
|
props,
|
|
20
14
|
ref
|
|
21
15
|
) {
|
|
22
16
|
const { children, className, style, ...rest } = props
|
|
23
17
|
|
|
24
|
-
const classes = useStyles()
|
|
25
|
-
|
|
26
18
|
return (
|
|
27
19
|
<div
|
|
28
20
|
{...rest}
|
|
29
21
|
ref={ref}
|
|
30
|
-
className={cx(
|
|
22
|
+
className={cx('pr-6 mt-8 mx-8 mb-0', className)}
|
|
31
23
|
style={style}
|
|
32
24
|
>
|
|
33
25
|
<Typography variant='heading' size='large'>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Theme } from '@material-ui/core/styles';
|
|
2
|
-
declare const _default: ({ screens, sizes }: Theme) => import("@material-ui/styles").StyleRules<{}, "root" | "medium" | "large" | "small" | "container" | "paper" | "xsmall" | "xlarge" | "full-screen" | "topAlignedDialog">;
|
|
3
|
-
export default _default;
|
|
4
|
-
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/Modal/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;6CAmBjB,KAAK;AAAzC,wBAuDI"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { createStyles } from '@material-ui/core/styles';
|
|
2
|
-
import { PicassoProvider } from '@toptal/picasso-provider';
|
|
3
|
-
const maxHeight = 'calc(100% - 6rem)';
|
|
4
|
-
const maxWidth = 'calc(100% - 6rem)';
|
|
5
|
-
const maxHeightForTopAligned = 'calc(100% - 4rem)';
|
|
6
|
-
const maxHeightForExtraSmall = 'calc(100% - 2rem)';
|
|
7
|
-
const maxWidthForExtraSmall = 'calc(100% - 2rem)';
|
|
8
|
-
PicassoProvider.override(() => ({
|
|
9
|
-
MuiPaper: {
|
|
10
|
-
root: {
|
|
11
|
-
color: 'unset',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
}));
|
|
15
|
-
export default ({ screens, sizes }) => createStyles({
|
|
16
|
-
root: {
|
|
17
|
-
display: 'flex',
|
|
18
|
-
flexDirection: 'column',
|
|
19
|
-
// do not remove, should be covered with test
|
|
20
|
-
// https://toptal-core.atlassian.net/browse/FX-1543
|
|
21
|
-
fontSize: '1rem',
|
|
22
|
-
},
|
|
23
|
-
container: {},
|
|
24
|
-
paper: {
|
|
25
|
-
height: 'auto',
|
|
26
|
-
maxHeight: maxHeightForExtraSmall,
|
|
27
|
-
maxWidth: maxWidthForExtraSmall,
|
|
28
|
-
margin: '1rem',
|
|
29
|
-
borderRadius: sizes.borderRadius.medium,
|
|
30
|
-
[screens('sm', 'md', 'lg', 'xl')]: {
|
|
31
|
-
margin: '2rem',
|
|
32
|
-
maxHeight,
|
|
33
|
-
maxWidth,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
xsmall: {
|
|
37
|
-
width: '20.5rem',
|
|
38
|
-
},
|
|
39
|
-
small: {
|
|
40
|
-
width: '32.5rem',
|
|
41
|
-
},
|
|
42
|
-
medium: {
|
|
43
|
-
width: '40.625rem',
|
|
44
|
-
},
|
|
45
|
-
large: {
|
|
46
|
-
width: '50rem',
|
|
47
|
-
},
|
|
48
|
-
xlarge: {
|
|
49
|
-
width: '75rem',
|
|
50
|
-
},
|
|
51
|
-
'full-screen': {
|
|
52
|
-
height: '100%',
|
|
53
|
-
width: '100%',
|
|
54
|
-
maxHeight: '100%',
|
|
55
|
-
maxWidth: '100%',
|
|
56
|
-
margin: 0,
|
|
57
|
-
borderRadius: 0,
|
|
58
|
-
},
|
|
59
|
-
topAlignedDialog: {
|
|
60
|
-
position: 'absolute',
|
|
61
|
-
top: 0,
|
|
62
|
-
[screens('sm', 'md', 'lg', 'xl')]: {
|
|
63
|
-
maxHeight: maxHeightForTopAligned,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
//# sourceMappingURL=styles.js.map
|