@pingux/astro 2.152.0 → 2.153.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
|
@@ -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
|
});
|
|
@@ -30,6 +30,7 @@ var baseIconButton = {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
var hintButton = _objectSpread({}, baseIconButton);
|
|
33
|
+
var modalCloseButton = _objectSpread({}, baseIconButton);
|
|
33
34
|
var iconButtons = {
|
|
34
35
|
base: _objectSpread({}, baseIconButton),
|
|
35
36
|
inverted: {
|
|
@@ -65,6 +66,7 @@ var iconButtons = {
|
|
|
65
66
|
}
|
|
66
67
|
}),
|
|
67
68
|
modalCloseButton: _objectSpread({}, baseIconButton),
|
|
69
|
+
modalHeaderCloseButton: _objectSpread({}, baseIconButton),
|
|
68
70
|
messageCloseButton: _objectSpread(_objectSpread({}, baseIconButton), {}, {
|
|
69
71
|
'&.is-hovered': {
|
|
70
72
|
backgroundColor: '#455469'
|
|
@@ -263,6 +265,7 @@ var buttons = {
|
|
|
263
265
|
}
|
|
264
266
|
},
|
|
265
267
|
iconButtons: iconButtons,
|
|
268
|
+
modalCloseButton: modalCloseButton,
|
|
266
269
|
listBoxLink: {
|
|
267
270
|
color: 'blue-400',
|
|
268
271
|
'&.is-pressed': {
|
|
@@ -373,11 +373,7 @@ var invertedIconButton = _objectSpread(_objectSpread({}, baseIconButtonStyle), {
|
|
|
373
373
|
},
|
|
374
374
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
|
375
375
|
});
|
|
376
|
-
var modalCloseButton = _objectSpread(
|
|
377
|
-
position: 'absolute',
|
|
378
|
-
top: 32,
|
|
379
|
-
right: 18
|
|
380
|
-
});
|
|
376
|
+
var modalCloseButton = _objectSpread({}, baseIconButton);
|
|
381
377
|
var onyxIconButton = _objectSpread(_objectSpread({}, baseIconButton), {}, {
|
|
382
378
|
path: {
|
|
383
379
|
fill: 'blue'
|
|
@@ -453,6 +449,11 @@ var iconButtons = {
|
|
|
453
449
|
display: 'inline-flex'
|
|
454
450
|
}),
|
|
455
451
|
modalCloseButton: modalCloseButton,
|
|
452
|
+
modalHeaderCloseButton: _objectSpread(_objectSpread({}, modalCloseButton), {}, {
|
|
453
|
+
top: '50%',
|
|
454
|
+
transform: 'translateY(-50%)',
|
|
455
|
+
right: '16px'
|
|
456
|
+
}),
|
|
456
457
|
badge: {
|
|
457
458
|
deleteButton: _objectSpread(_objectSpread({}, baseIconButton), {}, {
|
|
458
459
|
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'
|
|
@@ -117,13 +110,30 @@ var modal = {
|
|
|
117
110
|
bg: 'backgroundBase',
|
|
118
111
|
borderRadius: '1em 1em 0px 0px'
|
|
119
112
|
},
|
|
120
|
-
container: {
|
|
121
|
-
justifyContent: 'start'
|
|
122
|
-
},
|
|
123
113
|
header: {
|
|
124
|
-
pt: 'lg',
|
|
125
114
|
bg: 'backgroundBase',
|
|
126
|
-
|
|
115
|
+
borderBottom: '1px solid',
|
|
116
|
+
borderBottomColor: 'gray-200',
|
|
117
|
+
borderRadius: '1em 1em 0px 0px',
|
|
118
|
+
px: 'lg',
|
|
119
|
+
py: 'md'
|
|
120
|
+
},
|
|
121
|
+
bodyContainer: {
|
|
122
|
+
p: 'lg'
|
|
123
|
+
},
|
|
124
|
+
body: {
|
|
125
|
+
p: 'lg'
|
|
126
|
+
},
|
|
127
|
+
footer: {
|
|
128
|
+
borderTop: '1px solid',
|
|
129
|
+
borderTopColor: 'gray-200',
|
|
130
|
+
borderRadius: '0px 0px 1em 1em',
|
|
131
|
+
p: 'lg'
|
|
132
|
+
},
|
|
133
|
+
footerContainer: {
|
|
134
|
+
borderTop: '1px solid',
|
|
135
|
+
borderTopColor: 'gray-200',
|
|
136
|
+
borderRadius: '0px 0px 1em 1em'
|
|
127
137
|
}
|
|
128
138
|
};
|
|
129
139
|
var listBox = {
|