@pingux/astro 2.148.0-alpha.0 → 2.148.0-alpha.2
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 +13 -4
- package/lib/cjs/components/Modal/Modal.stories.d.ts +1 -0
- package/lib/cjs/components/Modal/Modal.stories.js +67 -50
- package/lib/cjs/components/Modal/Modal.styles.d.ts +43 -26
- package/lib/cjs/components/Modal/Modal.styles.js +41 -28
- 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 +46 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +3 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +18 -1
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.js +18 -1
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +59 -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 +27 -12
- package/lib/cjs/styles/themes/next-gen/variants/variants.js +28 -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 +13 -4
- package/lib/components/Modal/Modal.stories.js +67 -51
- package/lib/components/Modal/Modal.styles.js +39 -27
- 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/themeOverrides/nextGenDarkMode/variants/variants.js +18 -1
- package/lib/styles/themes/next-gen/variants/button.js +6 -5
- package/lib/styles/themes/next-gen/variants/variants.js +28 -13
- package/package.json +1 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { render, screen } from '../../utils/testUtils/testWrapper';
|
|
5
|
+
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
|
6
|
+
import ModalHeader from './ModalHeader';
|
|
7
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
8
|
+
var defaultProps = {
|
|
9
|
+
hasCloseButton: true
|
|
10
|
+
};
|
|
11
|
+
var getComponent = function getComponent() {
|
|
12
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13
|
+
return render(___EmotionJSX(ModalHeader, _extends({}, defaultProps, props)));
|
|
14
|
+
};
|
|
15
|
+
// Needs to be added to each components test file
|
|
16
|
+
universalComponentTests({
|
|
17
|
+
renderComponent: function renderComponent(props) {
|
|
18
|
+
return ___EmotionJSX(ModalHeader, props);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
describe('ModalHeader', function () {
|
|
22
|
+
test('rendered', function () {
|
|
23
|
+
getComponent({
|
|
24
|
+
title: 'Lorem Ipsum'
|
|
25
|
+
});
|
|
26
|
+
screen.getByRole('heading', {
|
|
27
|
+
name: /lorem ipsum/i
|
|
28
|
+
});
|
|
29
|
+
screen.getByRole('button', {
|
|
30
|
+
name: /close modal window/i
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
test('trigger on close', function () {
|
|
34
|
+
var mockOnClose = jest.fn();
|
|
35
|
+
getComponent({
|
|
36
|
+
title: 'Lorem Ipsum',
|
|
37
|
+
onClose: mockOnClose
|
|
38
|
+
});
|
|
39
|
+
var closeButton = screen.getByRole('button', {
|
|
40
|
+
name: /close modal window/i
|
|
41
|
+
});
|
|
42
|
+
userEvent.click(closeButton);
|
|
43
|
+
expect(mockOnClose).toHaveBeenCalled();
|
|
44
|
+
});
|
|
45
|
+
test('does not render close button', function () {
|
|
46
|
+
getComponent({
|
|
47
|
+
title: 'Lorem Ipsum',
|
|
48
|
+
hasCloseButton: false
|
|
49
|
+
});
|
|
50
|
+
screen.getByRole('heading', {
|
|
51
|
+
name: /lorem ipsum/i
|
|
52
|
+
});
|
|
53
|
+
var closeButton = screen.queryByRole('button', {
|
|
54
|
+
name: /close modal window/i
|
|
55
|
+
});
|
|
56
|
+
expect(closeButton).not.toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
test('custom close button', function () {
|
|
59
|
+
var CustomCloseButton = function CustomCloseButton() {
|
|
60
|
+
return ___EmotionJSX("button", {
|
|
61
|
+
type: "button"
|
|
62
|
+
}, "Custom Close");
|
|
63
|
+
};
|
|
64
|
+
getComponent({
|
|
65
|
+
title: 'Lorem Ipsum',
|
|
66
|
+
closeButton: ___EmotionJSX(CustomCloseButton, null)
|
|
67
|
+
});
|
|
68
|
+
screen.getByRole('heading', {
|
|
69
|
+
name: /lorem ipsum/i
|
|
70
|
+
});
|
|
71
|
+
screen.getByRole('button', {
|
|
72
|
+
name: /custom close/i
|
|
73
|
+
});
|
|
74
|
+
expect(screen.getByRole('button', {
|
|
75
|
+
name: /custom close/i
|
|
76
|
+
})).toBeInTheDocument();
|
|
77
|
+
expect(screen.getByRole('button', {
|
|
78
|
+
name: /custom close/i
|
|
79
|
+
})).toHaveAttribute('type', 'button');
|
|
80
|
+
});
|
|
81
|
+
test('title as React node', function () {
|
|
82
|
+
var TitleNode = function TitleNode() {
|
|
83
|
+
return ___EmotionJSX("div", {
|
|
84
|
+
"data-testid": "custom-node"
|
|
85
|
+
}, "Custom Node");
|
|
86
|
+
};
|
|
87
|
+
getComponent({
|
|
88
|
+
title: ___EmotionJSX(TitleNode, null)
|
|
89
|
+
});
|
|
90
|
+
screen.getByTestId('custom-node');
|
|
91
|
+
screen.getByText(/custom node/i);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -78,6 +78,8 @@ test('keyboard interaction with the trigger should open the modal', function ()
|
|
|
78
78
|
test('close button should close the modal', function () {
|
|
79
79
|
getComposedComponent({
|
|
80
80
|
isDefaultOpen: true
|
|
81
|
+
}, {
|
|
82
|
+
title: 'Lorem Ipsum'
|
|
81
83
|
});
|
|
82
84
|
|
|
83
85
|
// Target the close button
|
|
@@ -87,6 +89,8 @@ test('close button should close the modal', function () {
|
|
|
87
89
|
test('keyboard interactions on the close button should close the modal', function () {
|
|
88
90
|
getComposedComponent({
|
|
89
91
|
isDefaultOpen: true
|
|
92
|
+
}, {
|
|
93
|
+
title: 'Lorem Ipsum'
|
|
90
94
|
});
|
|
91
95
|
|
|
92
96
|
// Target the close button
|
|
@@ -198,6 +198,7 @@ test('should only hide the top-most overlay', function () {
|
|
|
198
198
|
});
|
|
199
199
|
test('should render a close button if hasCloseButton is true', function () {
|
|
200
200
|
getComponent({
|
|
201
|
+
title: 'Lorem Ipsum',
|
|
201
202
|
hasCloseButton: true
|
|
202
203
|
});
|
|
203
204
|
expect(screen.queryByRole('button')).toBeInTheDocument();
|
|
@@ -209,6 +210,7 @@ test('should render a custom close button if hasCloseButton is true and custom b
|
|
|
209
210
|
});
|
|
210
211
|
};
|
|
211
212
|
getComponent({
|
|
213
|
+
title: 'Lorem Ipsum',
|
|
212
214
|
hasCloseButton: true,
|
|
213
215
|
closeButton: ___EmotionJSX(MyButton, null)
|
|
214
216
|
});
|
|
@@ -217,6 +219,7 @@ test('should render a custom close button if hasCloseButton is true and custom b
|
|
|
217
219
|
});
|
|
218
220
|
test('shouldn\'t auto focus the first tabbable element', function () {
|
|
219
221
|
getComponent({
|
|
222
|
+
title: 'Lorem Ipsum',
|
|
220
223
|
hasCloseButton: true
|
|
221
224
|
});
|
|
222
225
|
var button = screen.queryByRole('button');
|
|
@@ -224,6 +227,7 @@ test('shouldn\'t auto focus the first tabbable element', function () {
|
|
|
224
227
|
});
|
|
225
228
|
test('should auto focus the first tabbable element if "hasAutoFocus" is true', function () {
|
|
226
229
|
getComponent({
|
|
230
|
+
title: 'Lorem Ipsum',
|
|
227
231
|
hasCloseButton: true,
|
|
228
232
|
hasAutoFocus: true
|
|
229
233
|
});
|
|
@@ -35,6 +35,7 @@ var baseIconButton = {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
var hintButton = _objectSpread({}, baseIconButton);
|
|
38
|
+
var modalCloseButton = _objectSpread({}, baseIconButton);
|
|
38
39
|
var iconButtons = {
|
|
39
40
|
base: _objectSpread({}, baseIconButton),
|
|
40
41
|
inverted: _objectSpread(_objectSpread({}, baseIconButton), {}, {
|
|
@@ -78,6 +79,7 @@ var iconButtons = {
|
|
|
78
79
|
}
|
|
79
80
|
}),
|
|
80
81
|
modalCloseButton: _objectSpread({}, baseIconButton),
|
|
82
|
+
modalHeaderCloseButton: _objectSpread({}, baseIconButton),
|
|
81
83
|
messageCloseButton: _objectSpread(_objectSpread({}, baseIconButton), {}, {
|
|
82
84
|
'&.is-hovered': {
|
|
83
85
|
backgroundColor: '#455469'
|
|
@@ -276,6 +278,7 @@ var buttons = {
|
|
|
276
278
|
}
|
|
277
279
|
},
|
|
278
280
|
iconButtons: iconButtons,
|
|
281
|
+
modalCloseButton: modalCloseButton,
|
|
279
282
|
listBoxLink: {
|
|
280
283
|
color: 'blue-400',
|
|
281
284
|
'&.is-pressed': {
|
|
@@ -46,9 +46,26 @@ var modal = {
|
|
|
46
46
|
bg: 'background.base'
|
|
47
47
|
},
|
|
48
48
|
headingContainer: {
|
|
49
|
+
borderBottom: '1px solid',
|
|
50
|
+
borderBottomColor: 'border.base',
|
|
49
51
|
bg: 'background.base'
|
|
50
52
|
},
|
|
51
|
-
|
|
53
|
+
header: {
|
|
54
|
+
borderBottom: '1px solid',
|
|
55
|
+
borderBottomColor: 'border.base',
|
|
56
|
+
bg: 'background.base'
|
|
57
|
+
},
|
|
58
|
+
body: {
|
|
59
|
+
bg: 'background.base'
|
|
60
|
+
},
|
|
61
|
+
footer: {
|
|
62
|
+
borderTop: '1px solid',
|
|
63
|
+
borderTopColor: 'border.base',
|
|
64
|
+
bg: 'background.base'
|
|
65
|
+
},
|
|
66
|
+
footerContainer: {
|
|
67
|
+
borderTop: '1px solid',
|
|
68
|
+
borderTopColor: 'border.base',
|
|
52
69
|
bg: 'background.base'
|
|
53
70
|
}
|
|
54
71
|
};
|
|
@@ -348,11 +348,7 @@ var baseIconButton = {
|
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
};
|
|
351
|
-
var modalCloseButton = _objectSpread(
|
|
352
|
-
position: 'absolute',
|
|
353
|
-
top: 32,
|
|
354
|
-
right: 18
|
|
355
|
-
});
|
|
351
|
+
var modalCloseButton = _objectSpread({}, baseIconButton);
|
|
356
352
|
var onyxIconButton = _objectSpread(_objectSpread(_objectSpread({}, baseIconButton), secondary), {}, {
|
|
357
353
|
path: {
|
|
358
354
|
fill: 'blue'
|
|
@@ -443,6 +439,11 @@ var iconButtons = {
|
|
|
443
439
|
display: 'inline-flex'
|
|
444
440
|
}),
|
|
445
441
|
modalCloseButton: modalCloseButton,
|
|
442
|
+
modalHeaderCloseButton: _objectSpread(_objectSpread({}, modalCloseButton), {}, {
|
|
443
|
+
top: '50%',
|
|
444
|
+
transform: 'translateY(-50%)',
|
|
445
|
+
right: '16px'
|
|
446
|
+
}),
|
|
446
447
|
badge: {
|
|
447
448
|
deleteButton: _objectSpread(_objectSpread({}, baseIconButton), {}, {
|
|
448
449
|
borderRadius: '50%',
|
|
@@ -71,17 +71,10 @@ var modalSize = {
|
|
|
71
71
|
var modal = {
|
|
72
72
|
content: {
|
|
73
73
|
boxShadow: '0px 8px 16px 0px rgba(0, 0, 0, 0.5)',
|
|
74
|
-
|
|
75
|
-
pb: 'lg',
|
|
76
|
-
pt: 0,
|
|
77
|
-
borderRadius: '4px',
|
|
74
|
+
borderRadius: '1em',
|
|
78
75
|
opacity: 0,
|
|
79
|
-
top: '0',
|
|
80
|
-
transform: 'translate(0, -50px)',
|
|
81
76
|
transition: 'opacity 300ms ease, transform 500ms ease-out',
|
|
82
77
|
m: ['sm', 'sm', '1.75rem auto'],
|
|
83
|
-
maxHeight: 'calc(100vh - 3.5rem)',
|
|
84
|
-
overflowY: 'auto',
|
|
85
78
|
'&.is-open-no-transition': {
|
|
86
79
|
opacity: '100%',
|
|
87
80
|
transform: 'none'
|
|
@@ -111,13 +104,35 @@ var modal = {
|
|
|
111
104
|
maxWidth: modalSize.full
|
|
112
105
|
}
|
|
113
106
|
},
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
headingContainer: {
|
|
108
|
+
borderBottom: '1px solid',
|
|
109
|
+
borderBottomColor: 'gray-200',
|
|
110
|
+
bg: 'background.base',
|
|
111
|
+
borderRadius: '1em 1em 0px 0px'
|
|
116
112
|
},
|
|
117
113
|
header: {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
borderBottom: '1px solid',
|
|
115
|
+
borderBottomColor: 'gray-200',
|
|
116
|
+
borderRadius: '1em 1em 0px 0px',
|
|
117
|
+
px: 'lg',
|
|
118
|
+
py: 'md'
|
|
119
|
+
},
|
|
120
|
+
bodyContainer: {
|
|
121
|
+
p: 'lg'
|
|
122
|
+
},
|
|
123
|
+
body: {
|
|
124
|
+
p: 'lg'
|
|
125
|
+
},
|
|
126
|
+
footer: {
|
|
127
|
+
borderTop: '1px solid',
|
|
128
|
+
borderTopColor: 'gray-200',
|
|
129
|
+
borderRadius: '0px 0px 1em 1em',
|
|
130
|
+
p: 'lg'
|
|
131
|
+
},
|
|
132
|
+
footerContainer: {
|
|
133
|
+
borderTop: '1px solid',
|
|
134
|
+
borderTopColor: 'gray-200',
|
|
135
|
+
borderRadius: '0px 0px 1em 1em'
|
|
121
136
|
}
|
|
122
137
|
};
|
|
123
138
|
var listBox = {
|