@pingux/astro 2.152.0 → 2.153.0-alpha.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/lib/cjs/components/IconButton/IconButton.styles.d.ts +38 -0
- package/lib/cjs/components/IconButton/IconButton.styles.js +8 -7
- package/lib/cjs/components/Modal/Convenience/ModalBody.stories.d.ts +7 -0
- package/lib/cjs/components/Modal/Convenience/ModalBody.stories.js +30 -0
- package/lib/cjs/components/Modal/Convenience/ModalFooter.stories.d.ts +5 -0
- package/lib/cjs/components/Modal/Convenience/ModalFooter.stories.js +35 -0
- package/lib/cjs/components/Modal/Convenience/ModalHeader.stories.d.ts +5 -0
- package/lib/cjs/components/Modal/Convenience/ModalHeader.stories.js +36 -0
- package/lib/cjs/components/Modal/Modal.js +14 -4
- package/lib/cjs/components/Modal/Modal.stories.d.ts +2 -0
- package/lib/cjs/components/Modal/Modal.stories.js +84 -48
- package/lib/cjs/components/Modal/Modal.styles.d.ts +42 -26
- package/lib/cjs/components/Modal/Modal.styles.js +39 -27
- package/lib/cjs/components/Modal/ModalBody.d.ts +9 -0
- package/lib/cjs/components/Modal/ModalBody.js +34 -0
- package/lib/cjs/components/Modal/ModalBody.test.d.ts +1 -0
- package/lib/cjs/components/Modal/ModalBody.test.js +64 -0
- package/lib/cjs/components/Modal/ModalFooter.d.ts +4 -0
- package/lib/cjs/components/Modal/ModalFooter.js +48 -0
- package/lib/cjs/components/Modal/ModalFooter.test.d.ts +1 -0
- package/lib/cjs/components/Modal/ModalFooter.test.js +98 -0
- package/lib/cjs/components/Modal/ModalHeader.d.ts +4 -0
- package/lib/cjs/components/Modal/ModalHeader.js +61 -0
- package/lib/cjs/components/Modal/ModalHeader.test.d.ts +1 -0
- package/lib/cjs/components/Modal/ModalHeader.test.js +96 -0
- package/lib/cjs/components/Modal/index.d.ts +3 -0
- package/lib/cjs/components/Modal/index.js +22 -1
- package/lib/cjs/components/Modal/tests/Modal.integration.test.js +4 -0
- package/lib/cjs/components/Modal/tests/Modal.unit.test.js +4 -0
- package/lib/cjs/index.d.ts +1 -1
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.d.ts +36 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +3 -0
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +54 -18
- package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +32 -6
- package/lib/cjs/styles/themes/next-gen/variants/button.js +6 -5
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +22 -12
- package/lib/cjs/styles/themes/next-gen/variants/variants.js +23 -13
- package/lib/cjs/types/Modal.d.ts +19 -0
- package/lib/components/IconButton/IconButton.styles.js +9 -8
- package/lib/components/Modal/Convenience/ModalBody.stories.js +20 -0
- package/lib/components/Modal/Convenience/ModalFooter.stories.js +25 -0
- package/lib/components/Modal/Convenience/ModalHeader.stories.js +26 -0
- package/lib/components/Modal/Modal.js +14 -4
- package/lib/components/Modal/Modal.stories.js +82 -48
- package/lib/components/Modal/Modal.styles.js +37 -26
- package/lib/components/Modal/ModalBody.js +20 -0
- package/lib/components/Modal/ModalBody.test.js +61 -0
- package/lib/components/Modal/ModalFooter.js +34 -0
- package/lib/components/Modal/ModalFooter.test.js +95 -0
- package/lib/components/Modal/ModalHeader.js +47 -0
- package/lib/components/Modal/ModalHeader.test.js +93 -0
- package/lib/components/Modal/index.js +4 -1
- package/lib/components/Modal/tests/Modal.integration.test.js +4 -0
- package/lib/components/Modal/tests/Modal.unit.test.js +4 -0
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +3 -0
- package/lib/styles/themes/next-gen/variants/button.js +6 -5
- package/lib/styles/themes/next-gen/variants/variants.js +23 -13
- package/package.json +1 -1
|
@@ -199,6 +199,7 @@ test('should only hide the top-most overlay', function () {
|
|
|
199
199
|
});
|
|
200
200
|
test('should render a close button if hasCloseButton is true', function () {
|
|
201
201
|
getComponent({
|
|
202
|
+
title: 'Lorem Ipsum',
|
|
202
203
|
hasCloseButton: true
|
|
203
204
|
});
|
|
204
205
|
expect(_testWrapper.screen.queryByRole('button')).toBeInTheDocument();
|
|
@@ -210,6 +211,7 @@ test('should render a custom close button if hasCloseButton is true and custom b
|
|
|
210
211
|
});
|
|
211
212
|
};
|
|
212
213
|
getComponent({
|
|
214
|
+
title: 'Lorem Ipsum',
|
|
213
215
|
hasCloseButton: true,
|
|
214
216
|
closeButton: (0, _react2.jsx)(MyButton, null)
|
|
215
217
|
});
|
|
@@ -218,6 +220,7 @@ test('should render a custom close button if hasCloseButton is true and custom b
|
|
|
218
220
|
});
|
|
219
221
|
test('shouldn\'t auto focus the first tabbable element', function () {
|
|
220
222
|
getComponent({
|
|
223
|
+
title: 'Lorem Ipsum',
|
|
221
224
|
hasCloseButton: true
|
|
222
225
|
});
|
|
223
226
|
var button = _testWrapper.screen.queryByRole('button');
|
|
@@ -225,6 +228,7 @@ test('shouldn\'t auto focus the first tabbable element', function () {
|
|
|
225
228
|
});
|
|
226
229
|
test('should auto focus the first tabbable element if "hasAutoFocus" is true', function () {
|
|
227
230
|
getComponent({
|
|
231
|
+
title: 'Lorem Ipsum',
|
|
228
232
|
hasCloseButton: true,
|
|
229
233
|
hasAutoFocus: true
|
|
230
234
|
});
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -225,5 +225,5 @@ export { default as OnyxDarkTheme } from './styles/themeOverrides/nextGenDarkMod
|
|
|
225
225
|
export { default as NextGenTheme } from './styles/themes/next-gen';
|
|
226
226
|
export { default as OnyxTheme } from './styles/themes/next-gen';
|
|
227
227
|
export * from './types';
|
|
228
|
-
export { OverlayProvider, useOverlayPosition, useOverlayTrigger } from 'react-aria';
|
|
228
|
+
export { OverlayProvider, useOverlayPosition, useOverlayTrigger, } from 'react-aria';
|
|
229
229
|
export { Cell, Column, TableBody as DataTableBody, Cell as DataTableCell, Column as DataTableColumn, TableHeader as DataTableHeader, Row as DataTableRow, Item, Row, Section, TableBody as TBody, TableHeader as THead, useOverlayTriggerState, useTreeData, } from 'react-stately';
|
|
@@ -285,6 +285,24 @@ declare const buttons: {
|
|
|
285
285
|
};
|
|
286
286
|
};
|
|
287
287
|
};
|
|
288
|
+
modalHeaderCloseButton: {
|
|
289
|
+
path: {
|
|
290
|
+
fill: string;
|
|
291
|
+
};
|
|
292
|
+
'&.is-hovered': {
|
|
293
|
+
path: {
|
|
294
|
+
fill: string;
|
|
295
|
+
};
|
|
296
|
+
backgroundColor: string;
|
|
297
|
+
};
|
|
298
|
+
'&.is-pressed': {
|
|
299
|
+
backgroundColor: string;
|
|
300
|
+
borderColor: string;
|
|
301
|
+
path: {
|
|
302
|
+
fill: string;
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
};
|
|
288
306
|
messageCloseButton: {
|
|
289
307
|
'&.is-hovered': {
|
|
290
308
|
backgroundColor: string;
|
|
@@ -301,6 +319,24 @@ declare const buttons: {
|
|
|
301
319
|
};
|
|
302
320
|
};
|
|
303
321
|
};
|
|
322
|
+
modalCloseButton: {
|
|
323
|
+
path: {
|
|
324
|
+
fill: string;
|
|
325
|
+
};
|
|
326
|
+
'&.is-hovered': {
|
|
327
|
+
path: {
|
|
328
|
+
fill: string;
|
|
329
|
+
};
|
|
330
|
+
backgroundColor: string;
|
|
331
|
+
};
|
|
332
|
+
'&.is-pressed': {
|
|
333
|
+
backgroundColor: string;
|
|
334
|
+
borderColor: string;
|
|
335
|
+
path: {
|
|
336
|
+
fill: string;
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
};
|
|
304
340
|
listBoxLink: {
|
|
305
341
|
color: string;
|
|
306
342
|
'&.is-pressed': {
|
|
@@ -37,6 +37,7 @@ var baseIconButton = {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
var hintButton = _objectSpread({}, baseIconButton);
|
|
40
|
+
var modalCloseButton = _objectSpread({}, baseIconButton);
|
|
40
41
|
var iconButtons = {
|
|
41
42
|
base: _objectSpread({}, baseIconButton),
|
|
42
43
|
inverted: {
|
|
@@ -72,6 +73,7 @@ var iconButtons = {
|
|
|
72
73
|
}
|
|
73
74
|
}),
|
|
74
75
|
modalCloseButton: _objectSpread({}, baseIconButton),
|
|
76
|
+
modalHeaderCloseButton: _objectSpread({}, baseIconButton),
|
|
75
77
|
messageCloseButton: _objectSpread(_objectSpread({}, baseIconButton), {}, {
|
|
76
78
|
'&.is-hovered': {
|
|
77
79
|
backgroundColor: '#455469'
|
|
@@ -270,6 +272,7 @@ var buttons = {
|
|
|
270
272
|
}
|
|
271
273
|
},
|
|
272
274
|
iconButtons: iconButtons,
|
|
275
|
+
modalCloseButton: modalCloseButton,
|
|
273
276
|
listBoxLink: {
|
|
274
277
|
color: 'blue-400',
|
|
275
278
|
'&.is-pressed': {
|
|
@@ -1223,9 +1223,38 @@ declare const _default: {
|
|
|
1223
1223
|
boxShadow: string;
|
|
1224
1224
|
};
|
|
1225
1225
|
modalCloseButton: {
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1226
|
+
path: {
|
|
1227
|
+
fill: string;
|
|
1228
|
+
};
|
|
1229
|
+
'&.is-hovered': {
|
|
1230
|
+
backgroundColor: string;
|
|
1231
|
+
path: {
|
|
1232
|
+
fill: string;
|
|
1233
|
+
};
|
|
1234
|
+
};
|
|
1235
|
+
'&.is-pressed': {
|
|
1236
|
+
backgroundColor: string;
|
|
1237
|
+
path: {
|
|
1238
|
+
fill: string;
|
|
1239
|
+
};
|
|
1240
|
+
};
|
|
1241
|
+
'&.is-focused': {
|
|
1242
|
+
outline: string;
|
|
1243
|
+
outlineColor: string;
|
|
1244
|
+
outlineOffset: string;
|
|
1245
|
+
};
|
|
1246
|
+
p: string;
|
|
1247
|
+
transition: string;
|
|
1248
|
+
outline: string;
|
|
1249
|
+
borderRadius: string;
|
|
1250
|
+
border: string;
|
|
1251
|
+
cursor: string;
|
|
1252
|
+
boxShadow: string;
|
|
1253
|
+
};
|
|
1254
|
+
modalHeaderCloseButton: {
|
|
1255
|
+
top: string;
|
|
1256
|
+
transform: string;
|
|
1257
|
+
right: string;
|
|
1229
1258
|
path: {
|
|
1230
1259
|
fill: string;
|
|
1231
1260
|
};
|
|
@@ -1540,9 +1569,6 @@ declare const _default: {
|
|
|
1540
1569
|
};
|
|
1541
1570
|
};
|
|
1542
1571
|
modalCloseButton: {
|
|
1543
|
-
position: string;
|
|
1544
|
-
top: number;
|
|
1545
|
-
right: number;
|
|
1546
1572
|
path: {
|
|
1547
1573
|
fill: string;
|
|
1548
1574
|
};
|
|
@@ -4561,17 +4587,10 @@ declare const _default: {
|
|
|
4561
4587
|
modal: {
|
|
4562
4588
|
content: {
|
|
4563
4589
|
boxShadow: string;
|
|
4564
|
-
px: string;
|
|
4565
|
-
pb: string;
|
|
4566
|
-
pt: number;
|
|
4567
4590
|
borderRadius: string;
|
|
4568
4591
|
opacity: number;
|
|
4569
|
-
top: string;
|
|
4570
|
-
transform: string;
|
|
4571
4592
|
transition: string;
|
|
4572
4593
|
m: string[];
|
|
4573
|
-
maxHeight: string;
|
|
4574
|
-
overflowY: string;
|
|
4575
4594
|
'&.is-open-no-transition': {
|
|
4576
4595
|
opacity: string;
|
|
4577
4596
|
transform: string;
|
|
@@ -4607,13 +4626,30 @@ declare const _default: {
|
|
|
4607
4626
|
bg: string;
|
|
4608
4627
|
borderRadius: string;
|
|
4609
4628
|
};
|
|
4610
|
-
container: {
|
|
4611
|
-
justifyContent: string;
|
|
4612
|
-
};
|
|
4613
4629
|
header: {
|
|
4614
|
-
pt: string;
|
|
4615
4630
|
bg: string;
|
|
4616
|
-
|
|
4631
|
+
borderBottom: string;
|
|
4632
|
+
borderBottomColor: string;
|
|
4633
|
+
borderRadius: string;
|
|
4634
|
+
px: string;
|
|
4635
|
+
py: string;
|
|
4636
|
+
};
|
|
4637
|
+
bodyContainer: {
|
|
4638
|
+
p: string;
|
|
4639
|
+
};
|
|
4640
|
+
body: {
|
|
4641
|
+
p: string;
|
|
4642
|
+
};
|
|
4643
|
+
footer: {
|
|
4644
|
+
borderTop: string;
|
|
4645
|
+
borderTopColor: string;
|
|
4646
|
+
borderRadius: string;
|
|
4647
|
+
p: string;
|
|
4648
|
+
};
|
|
4649
|
+
footerContainer: {
|
|
4650
|
+
borderTop: string;
|
|
4651
|
+
borderTopColor: string;
|
|
4652
|
+
borderRadius: string;
|
|
4617
4653
|
};
|
|
4618
4654
|
};
|
|
4619
4655
|
navBar: {
|
|
@@ -926,9 +926,38 @@ declare const buttons: {
|
|
|
926
926
|
boxShadow: string;
|
|
927
927
|
};
|
|
928
928
|
modalCloseButton: {
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
929
|
+
path: {
|
|
930
|
+
fill: string;
|
|
931
|
+
};
|
|
932
|
+
'&.is-hovered': {
|
|
933
|
+
backgroundColor: string;
|
|
934
|
+
path: {
|
|
935
|
+
fill: string;
|
|
936
|
+
};
|
|
937
|
+
};
|
|
938
|
+
'&.is-pressed': {
|
|
939
|
+
backgroundColor: string;
|
|
940
|
+
path: {
|
|
941
|
+
fill: string;
|
|
942
|
+
};
|
|
943
|
+
};
|
|
944
|
+
'&.is-focused': {
|
|
945
|
+
outline: string;
|
|
946
|
+
outlineColor: string;
|
|
947
|
+
outlineOffset: string;
|
|
948
|
+
};
|
|
949
|
+
p: string;
|
|
950
|
+
transition: string;
|
|
951
|
+
outline: string;
|
|
952
|
+
borderRadius: string;
|
|
953
|
+
border: string;
|
|
954
|
+
cursor: string;
|
|
955
|
+
boxShadow: string;
|
|
956
|
+
};
|
|
957
|
+
modalHeaderCloseButton: {
|
|
958
|
+
top: string;
|
|
959
|
+
transform: string;
|
|
960
|
+
right: string;
|
|
932
961
|
path: {
|
|
933
962
|
fill: string;
|
|
934
963
|
};
|
|
@@ -1243,9 +1272,6 @@ declare const buttons: {
|
|
|
1243
1272
|
};
|
|
1244
1273
|
};
|
|
1245
1274
|
modalCloseButton: {
|
|
1246
|
-
position: string;
|
|
1247
|
-
top: number;
|
|
1248
|
-
right: number;
|
|
1249
1275
|
path: {
|
|
1250
1276
|
fill: string;
|
|
1251
1277
|
};
|
|
@@ -381,11 +381,7 @@ var invertedIconButton = _objectSpread(_objectSpread({}, baseIconButtonStyle), {
|
|
|
381
381
|
},
|
|
382
382
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
|
383
383
|
});
|
|
384
|
-
var modalCloseButton = _objectSpread(
|
|
385
|
-
position: 'absolute',
|
|
386
|
-
top: 32,
|
|
387
|
-
right: 18
|
|
388
|
-
});
|
|
384
|
+
var modalCloseButton = _objectSpread({}, baseIconButton);
|
|
389
385
|
var onyxIconButton = _objectSpread(_objectSpread({}, baseIconButton), {}, {
|
|
390
386
|
path: {
|
|
391
387
|
fill: 'blue'
|
|
@@ -461,6 +457,11 @@ var iconButtons = {
|
|
|
461
457
|
display: 'inline-flex'
|
|
462
458
|
}),
|
|
463
459
|
modalCloseButton: modalCloseButton,
|
|
460
|
+
modalHeaderCloseButton: _objectSpread(_objectSpread({}, modalCloseButton), {}, {
|
|
461
|
+
top: '50%',
|
|
462
|
+
transform: 'translateY(-50%)',
|
|
463
|
+
right: '16px'
|
|
464
|
+
}),
|
|
464
465
|
badge: {
|
|
465
466
|
deleteButton: _objectSpread(_objectSpread({}, baseIconButton), {}, {
|
|
466
467
|
borderRadius: '50%',
|
|
@@ -1015,17 +1015,10 @@ declare const _default: {
|
|
|
1015
1015
|
modal: {
|
|
1016
1016
|
content: {
|
|
1017
1017
|
boxShadow: string;
|
|
1018
|
-
px: string;
|
|
1019
|
-
pb: string;
|
|
1020
|
-
pt: number;
|
|
1021
1018
|
borderRadius: string;
|
|
1022
1019
|
opacity: number;
|
|
1023
|
-
top: string;
|
|
1024
|
-
transform: string;
|
|
1025
1020
|
transition: string;
|
|
1026
1021
|
m: string[];
|
|
1027
|
-
maxHeight: string;
|
|
1028
|
-
overflowY: string;
|
|
1029
1022
|
'&.is-open-no-transition': {
|
|
1030
1023
|
opacity: string;
|
|
1031
1024
|
transform: string;
|
|
@@ -1061,13 +1054,30 @@ declare const _default: {
|
|
|
1061
1054
|
bg: string;
|
|
1062
1055
|
borderRadius: string;
|
|
1063
1056
|
};
|
|
1064
|
-
container: {
|
|
1065
|
-
justifyContent: string;
|
|
1066
|
-
};
|
|
1067
1057
|
header: {
|
|
1068
|
-
pt: string;
|
|
1069
1058
|
bg: string;
|
|
1070
|
-
|
|
1059
|
+
borderBottom: string;
|
|
1060
|
+
borderBottomColor: string;
|
|
1061
|
+
borderRadius: string;
|
|
1062
|
+
px: string;
|
|
1063
|
+
py: string;
|
|
1064
|
+
};
|
|
1065
|
+
bodyContainer: {
|
|
1066
|
+
p: string;
|
|
1067
|
+
};
|
|
1068
|
+
body: {
|
|
1069
|
+
p: string;
|
|
1070
|
+
};
|
|
1071
|
+
footer: {
|
|
1072
|
+
borderTop: string;
|
|
1073
|
+
borderTopColor: string;
|
|
1074
|
+
borderRadius: string;
|
|
1075
|
+
p: string;
|
|
1076
|
+
};
|
|
1077
|
+
footerContainer: {
|
|
1078
|
+
borderTop: string;
|
|
1079
|
+
borderTopColor: string;
|
|
1080
|
+
borderRadius: string;
|
|
1071
1081
|
};
|
|
1072
1082
|
};
|
|
1073
1083
|
navBar: {
|
|
@@ -83,17 +83,10 @@ var modalSize = {
|
|
|
83
83
|
var modal = {
|
|
84
84
|
content: {
|
|
85
85
|
boxShadow: '0px 8px 16px 0px rgba(0, 0, 0, 0.5)',
|
|
86
|
-
|
|
87
|
-
pb: 'lg',
|
|
88
|
-
pt: 0,
|
|
89
|
-
borderRadius: '4px',
|
|
86
|
+
borderRadius: '1em',
|
|
90
87
|
opacity: 0,
|
|
91
|
-
top: '0',
|
|
92
|
-
transform: 'translate(0, -50px)',
|
|
93
88
|
transition: 'opacity 300ms ease, transform 500ms ease-out',
|
|
94
89
|
m: ['sm', 'sm', '1.75rem auto'],
|
|
95
|
-
maxHeight: 'calc(100vh - 3.5rem)',
|
|
96
|
-
overflowY: 'auto',
|
|
97
90
|
'&.is-open-no-transition': {
|
|
98
91
|
opacity: '100%',
|
|
99
92
|
transform: 'none'
|
|
@@ -129,13 +122,30 @@ var modal = {
|
|
|
129
122
|
bg: 'backgroundBase',
|
|
130
123
|
borderRadius: '1em 1em 0px 0px'
|
|
131
124
|
},
|
|
132
|
-
container: {
|
|
133
|
-
justifyContent: 'start'
|
|
134
|
-
},
|
|
135
125
|
header: {
|
|
136
|
-
pt: 'lg',
|
|
137
126
|
bg: 'backgroundBase',
|
|
138
|
-
|
|
127
|
+
borderBottom: '1px solid',
|
|
128
|
+
borderBottomColor: 'gray-200',
|
|
129
|
+
borderRadius: '1em 1em 0px 0px',
|
|
130
|
+
px: 'lg',
|
|
131
|
+
py: 'md'
|
|
132
|
+
},
|
|
133
|
+
bodyContainer: {
|
|
134
|
+
p: 'lg'
|
|
135
|
+
},
|
|
136
|
+
body: {
|
|
137
|
+
p: 'lg'
|
|
138
|
+
},
|
|
139
|
+
footer: {
|
|
140
|
+
borderTop: '1px solid',
|
|
141
|
+
borderTopColor: 'gray-200',
|
|
142
|
+
borderRadius: '0px 0px 1em 1em',
|
|
143
|
+
p: 'lg'
|
|
144
|
+
},
|
|
145
|
+
footerContainer: {
|
|
146
|
+
borderTop: '1px solid',
|
|
147
|
+
borderTopColor: 'gray-200',
|
|
148
|
+
borderRadius: '0px 0px 1em 1em'
|
|
139
149
|
}
|
|
140
150
|
};
|
|
141
151
|
var listBox = {
|
package/lib/cjs/types/Modal.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export interface ModalProps extends DOMAttributes, TestingAttributes {
|
|
|
33
33
|
* `() => void`
|
|
34
34
|
*/
|
|
35
35
|
onClose?: () => void;
|
|
36
|
+
onSubmit?: () => void;
|
|
37
|
+
onCancel?: () => void;
|
|
36
38
|
/**
|
|
37
39
|
* When a user interacts with the argument element outside of the overlay ref, return true if
|
|
38
40
|
* onClose should be called. This gives you a chance to filter out interaction with elements that
|
|
@@ -59,3 +61,20 @@ export interface ModalProps extends DOMAttributes, TestingAttributes {
|
|
|
59
61
|
containerProps?: object;
|
|
60
62
|
headerContainerProps?: object;
|
|
61
63
|
}
|
|
64
|
+
export type ModalHeaderProps = {
|
|
65
|
+
titleProps?: object;
|
|
66
|
+
containerProps?: object;
|
|
67
|
+
closeButton?: ReactNode;
|
|
68
|
+
hasCloseButton?: boolean;
|
|
69
|
+
onClose?: () => void;
|
|
70
|
+
title?: ReactNode;
|
|
71
|
+
hasNoSeparator?: boolean;
|
|
72
|
+
};
|
|
73
|
+
export type ModalFooterProps = {
|
|
74
|
+
onSubmit?: () => void;
|
|
75
|
+
onCancel?: () => void;
|
|
76
|
+
children?: ReactNode;
|
|
77
|
+
footerProps?: object;
|
|
78
|
+
primaryButtonText?: string;
|
|
79
|
+
secondaryButtonText?: string;
|
|
80
|
+
};
|
|
@@ -17,7 +17,7 @@ import { copyButton } from '../CopyText/CopyText.styles';
|
|
|
17
17
|
import { containedIcon } from '../DatePicker/DatePicker.styles';
|
|
18
18
|
import { hintButton } from '../HelpHint/HelpHint.styles';
|
|
19
19
|
import { messageCloseButton } from '../Messages/Message.styles';
|
|
20
|
-
import { modalCloseButton } from '../Modal/Modal.styles';
|
|
20
|
+
import { closeButton, modalCloseButton } from '../Modal/Modal.styles';
|
|
21
21
|
import { button } from '../TooltipTrigger/Tooltip.styles';
|
|
22
22
|
export var base = {
|
|
23
23
|
justifyContent: 'center',
|
|
@@ -43,7 +43,7 @@ export var base = {
|
|
|
43
43
|
boxShadow: 'standard'
|
|
44
44
|
},
|
|
45
45
|
'&.is-pressed': {
|
|
46
|
-
|
|
46
|
+
path: {
|
|
47
47
|
fill: 'white'
|
|
48
48
|
},
|
|
49
49
|
bg: 'active',
|
|
@@ -71,7 +71,7 @@ var bidirectional = {
|
|
|
71
71
|
var inverted = _objectSpread(_objectSpread({}, base), {}, {
|
|
72
72
|
bg: 'active',
|
|
73
73
|
borderColor: 'active',
|
|
74
|
-
|
|
74
|
+
path: {
|
|
75
75
|
fill: 'white'
|
|
76
76
|
},
|
|
77
77
|
'&.is-hovered': {
|
|
@@ -108,29 +108,29 @@ var applicationPortal = _objectSpread(_objectSpread({}, base), {}, {
|
|
|
108
108
|
background: 'transparent',
|
|
109
109
|
'&.is-focused': _objectSpread({}, defaultFocus),
|
|
110
110
|
'&.is-hovered': {
|
|
111
|
-
|
|
111
|
+
path: {
|
|
112
112
|
fill: 'active'
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
'&.is-pressed': {
|
|
116
|
-
|
|
116
|
+
path: {
|
|
117
117
|
fill: 'active'
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
var applicationPortalPinned = _objectSpread(_objectSpread({}, base), {}, {
|
|
122
|
-
|
|
122
|
+
path: {
|
|
123
123
|
fill: 'success.bright'
|
|
124
124
|
},
|
|
125
125
|
background: 'transparent',
|
|
126
126
|
'&.is-focused': _objectSpread({}, defaultFocus),
|
|
127
127
|
'&.is-hovered': {
|
|
128
|
-
|
|
128
|
+
path: {
|
|
129
129
|
fill: 'active'
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
'&.is-pressed': {
|
|
133
|
-
|
|
133
|
+
path: {
|
|
134
134
|
fill: 'active'
|
|
135
135
|
}
|
|
136
136
|
}
|
|
@@ -187,6 +187,7 @@ export default {
|
|
|
187
187
|
inverted: inverted,
|
|
188
188
|
messageCloseButton: _objectSpread(_objectSpread({}, base), messageCloseButton),
|
|
189
189
|
modalCloseButton: _objectSpread(_objectSpread({}, base), modalCloseButton),
|
|
190
|
+
modalHeaderCloseButton: _objectSpread(_objectSpread({}, base), closeButton),
|
|
190
191
|
invertedBadgeDeleteButton: invertedBadgeDeleteButton,
|
|
191
192
|
invertedSquare: invertedSquare,
|
|
192
193
|
square: square,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withDesign } from 'storybook-addon-designs';
|
|
3
|
+
import DocsLayout from '../../../../.storybook/storybookDocsLayout';
|
|
4
|
+
import { Box, ModalBody, Text } from '../../../index';
|
|
5
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/Modal/Convenience/ModalBody',
|
|
8
|
+
component: ModalBody,
|
|
9
|
+
decorators: [withDesign],
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
page: function page() {
|
|
13
|
+
return ___EmotionJSX(DocsLayout, null);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export var Default = function Default() {
|
|
19
|
+
return ___EmotionJSX(ModalBody, null, ___EmotionJSX(Box, null, ___EmotionJSX(Text, null, "Do you want to continue with this action that you\u2018re performing?")));
|
|
20
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withDesign } from 'storybook-addon-designs';
|
|
3
|
+
import DocsLayout from '../../../../.storybook/storybookDocsLayout';
|
|
4
|
+
import { useModalState } from '../../../hooks';
|
|
5
|
+
import { ModalFooter } from '../../../index';
|
|
6
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Components/Modal/Convenience/ModalFooter',
|
|
9
|
+
component: ModalFooter,
|
|
10
|
+
decorators: [withDesign],
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
page: function page() {
|
|
14
|
+
return ___EmotionJSX(DocsLayout, null);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export var Default = function Default() {
|
|
20
|
+
var state = useModalState();
|
|
21
|
+
return ___EmotionJSX(ModalFooter, {
|
|
22
|
+
onSubmit: state.close,
|
|
23
|
+
onCancel: state.close
|
|
24
|
+
});
|
|
25
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withDesign } from 'storybook-addon-designs';
|
|
3
|
+
import DocsLayout from '../../../../.storybook/storybookDocsLayout';
|
|
4
|
+
import { useModalState } from '../../../hooks';
|
|
5
|
+
import { ModalHeader } from '../../../index';
|
|
6
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Components/Modal/Convenience/ModalHeader',
|
|
9
|
+
component: ModalHeader,
|
|
10
|
+
decorators: [withDesign],
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
page: function page() {
|
|
14
|
+
return ___EmotionJSX(DocsLayout, null);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export var Default = function Default() {
|
|
20
|
+
var state = useModalState();
|
|
21
|
+
return ___EmotionJSX(ModalHeader, {
|
|
22
|
+
hasCloseButton: true,
|
|
23
|
+
onClose: state.close,
|
|
24
|
+
title: "Continue"
|
|
25
|
+
});
|
|
26
|
+
};
|
|
@@ -7,9 +7,11 @@ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-st
|
|
|
7
7
|
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
8
8
|
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
9
9
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
10
|
+
import _toArray from "@babel/runtime-corejs3/helpers/esm/toArray";
|
|
10
11
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
11
12
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
|
12
13
|
var _excluded = ["className", "closeButton", "hasAutoFocus", "hasCloseButton", "id", "isClosedOnBlur", "isDismissable", "isKeyboardDismissDisabled", "isOpen", "role", "size", "state", "title", "onClose", "shouldCloseOnInteractOutside", "children", "contentProps", "containerProps", "headerContainerProps"];
|
|
14
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
13
15
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
16
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
17
|
import React, { forwardRef } from 'react';
|
|
@@ -21,6 +23,7 @@ import Box from '../Box';
|
|
|
21
23
|
import Icon from '../Icon';
|
|
22
24
|
import IconButton from '../IconButton';
|
|
23
25
|
import Text from '../Text';
|
|
26
|
+
import ModalHeader from './ModalHeader';
|
|
24
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
25
28
|
var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
26
29
|
var _useStatusClasses2;
|
|
@@ -84,7 +87,12 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
84
87
|
var isOpenNoTransition = (state === null || state === void 0 ? void 0 : state.isTransitioning) === undefined && isOpen === true;
|
|
85
88
|
var _useStatusClasses = useStatusClasses(className, (_useStatusClasses2 = {}, _defineProperty(_useStatusClasses2, "is-".concat(size || 'custom'), size), _defineProperty(_useStatusClasses2, "isOpen", isOpen), _defineProperty(_useStatusClasses2, "isTransitioning", state === null || state === void 0 ? void 0 : state.isTransitioning), _defineProperty(_useStatusClasses2, "isOpenNoTransition", isOpenNoTransition), _useStatusClasses2)),
|
|
86
89
|
classNames = _useStatusClasses.classNames;
|
|
87
|
-
var
|
|
90
|
+
var _React$Children$toArr = React.Children.toArray(children),
|
|
91
|
+
_React$Children$toArr2 = _toArray(_React$Children$toArr),
|
|
92
|
+
header = _React$Children$toArr2[0],
|
|
93
|
+
siblings = _sliceInstanceProperty(_React$Children$toArr2).call(_React$Children$toArr2, 1);
|
|
94
|
+
var hasHeaderConvenienceComponent = /*#__PURE__*/React.isValidElement(header) && header.type === ModalHeader;
|
|
95
|
+
var titleContent = !hasHeaderConvenienceComponent && title && (isOnyx ? ___EmotionJSX(Box, {
|
|
88
96
|
variant: "modal.header"
|
|
89
97
|
}, ___EmotionJSX(Text, _extends({}, titleProps, {
|
|
90
98
|
variant: "modalTitle",
|
|
@@ -107,7 +115,7 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
107
115
|
}, propsContentProps, dialogProps, modalProps, {
|
|
108
116
|
ref: modalRef,
|
|
109
117
|
"aria-modal": true
|
|
110
|
-
}), ___EmotionJSX(Box, _extends({
|
|
118
|
+
}), titleContent && ___EmotionJSX(Box, _extends({
|
|
111
119
|
variant: "modal.headingContainer"
|
|
112
120
|
}, headerContainerProps), hasCloseButton && (closeButton !== null && closeButton !== void 0 ? closeButton : ___EmotionJSX(IconButton, {
|
|
113
121
|
"aria-label": "Close modal window",
|
|
@@ -119,8 +127,10 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
119
127
|
title: {
|
|
120
128
|
name: 'Close Icon'
|
|
121
129
|
}
|
|
122
|
-
}))), titleContent), ___EmotionJSX(Box, {
|
|
123
|
-
pt: "md"
|
|
130
|
+
}))), titleContent), isOnyx ? children : ___EmotionJSX(Box, {
|
|
131
|
+
pt: "md",
|
|
132
|
+
px: "lg",
|
|
133
|
+
pb: "lg"
|
|
124
134
|
}, children)))));
|
|
125
135
|
});
|
|
126
136
|
Modal.defaultProps = {
|