playbook_ui 13.34.0.pre.alpha.PLAY14143373 → 13.34.1.pre.alpha.PLAY14043436
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +0 -1
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +3 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +20 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default.jsx +1 -5
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.jsx +46 -0
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_dialog/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_icon/_icon.scss +1 -1
- data/app/pb_kits/playbook/pb_lightbox/Carousel/index.tsx +0 -1
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_compound_component.jsx +0 -1
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_current_photo.jsx +0 -1
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_custom_header.jsx +0 -1
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_default.jsx +0 -1
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_multiple.jsx +0 -1
- data/dist/chunks/{_typeahead-COUJ88EA.js → _typeahead-BUOMinLQ.js} +1 -1
- data/dist/chunks/_weekday_stacked-wqYpGCEo.js +45 -0
- data/dist/chunks/vendor.js +1 -0
- data/dist/playbook-doc.js +1 -0
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +4 -0
- data/lib/playbook/version.rb +2 -2
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7b3b2595256945a61f10d2d9b0720cee7acfe59d9714a13bc05954b59ed0cbc
|
4
|
+
data.tar.gz: 38eb03146799d4a742ec2d42d23d0135f0b1ceab60c2d5b46aa16952756bce75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c15cb70edee85bcd089c3540f02d77525e41942dcf81f7d538a603a0656ba91115f509c01e61deb7032ac9a3813b1f45e3c9112e48021407f5b9d8760969772
|
7
|
+
data.tar.gz: 8eb55b6abc6e6698faa5918dd00254bc1970382984375a66539c3c9816830dbda1d9def279870b3ef66495fd095a91750fba746f2f5eceb81f69b417994d9a79
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { ensureAccessible, renderKit } from '../utilities/test-utils'
|
2
2
|
import { DateTimeStacked } from 'playbook-ui'
|
3
3
|
|
4
|
-
/* eslint-disable jsx-control-statements/jsx-jcs-no-undef */
|
5
4
|
const currentDate = new Date()
|
6
5
|
|
7
6
|
const datetime = new Date('Wed Mar 31 2021 12:00:00 GMT-0500'),
|
@@ -183,7 +183,7 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
183
183
|
onRequestClose={onClose}
|
184
184
|
overlayClassName={overlayClassNames}
|
185
185
|
portalClassName={portalClassName}
|
186
|
-
shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}
|
186
|
+
shouldCloseOnOverlayClick={shouldCloseOnOverlayClick && !loading}
|
187
187
|
>
|
188
188
|
<>
|
189
189
|
{title && !status ? <Dialog.Header>{title}</Dialog.Header> : null}
|
@@ -215,6 +215,7 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
215
215
|
{cancelButton && confirmButton ? (
|
216
216
|
<Dialog.Footer>
|
217
217
|
<Button
|
218
|
+
disabled={loading}
|
218
219
|
htmlType="button"
|
219
220
|
loading={loading}
|
220
221
|
onClick={onConfirm}
|
@@ -223,6 +224,7 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
223
224
|
{confirmButton}
|
224
225
|
</Button>
|
225
226
|
<Button
|
227
|
+
disabled={loading}
|
226
228
|
htmlType="button"
|
227
229
|
id="cancel-button"
|
228
230
|
onClick={onCancel}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, {useState} from 'react'
|
2
|
-
import { render, cleanup, waitFor, fireEvent } from "../utilities/test-utils";
|
2
|
+
import { render, cleanup, waitFor, fireEvent, screen } from "../utilities/test-utils";
|
3
3
|
import { Dialog, Button } from 'playbook-ui'
|
4
4
|
|
5
5
|
const text="Hello Body Text, Nice to meet ya."
|
@@ -110,3 +110,22 @@ test("renders the right placement dialog", async () => {
|
|
110
110
|
cleanup()
|
111
111
|
});
|
112
112
|
|
113
|
+
test('renders loading dialog with disabled buttons', async () => {
|
114
|
+
|
115
|
+
const { queryByText } = render(<DialogTest />);
|
116
|
+
|
117
|
+
fireEvent.click(queryByText('Open Dialog'));
|
118
|
+
|
119
|
+
await waitFor(() => expect(queryByText("Okay")).toHaveTextContent(confirmButton));
|
120
|
+
await waitFor(() => expect(queryByText("Cancel Button")).toHaveTextContent(cancelButton));
|
121
|
+
|
122
|
+
fireEvent.click(queryByText('Okay'));
|
123
|
+
|
124
|
+
const loadingIconDiv = document.querySelector('.loading-icon');
|
125
|
+
expect(loadingIconDiv).toBeInTheDocument();
|
126
|
+
|
127
|
+
const cancelBtn = screen.getByRole('button', { name: cancelButton });
|
128
|
+
expect(cancelBtn).toBeDisabled();
|
129
|
+
|
130
|
+
cleanup()
|
131
|
+
})
|
@@ -5,21 +5,17 @@ const DialogDefault = () => {
|
|
5
5
|
const [isOpen, setIsOpen] = useState(false)
|
6
6
|
const close = () => setIsOpen(false)
|
7
7
|
const open = () => setIsOpen(true)
|
8
|
-
const [isLoading, setIsLoading] = useState(false)
|
9
8
|
|
10
9
|
return (
|
11
10
|
<>
|
12
11
|
<Button onClick={open}>{'Open Dialog'}</Button>
|
13
12
|
<Dialog
|
14
13
|
cancelButton="Cancel Button"
|
15
|
-
className="wrapper"
|
16
14
|
confirmButton="Okay"
|
17
|
-
loading={isLoading}
|
18
15
|
onCancel={close}
|
19
16
|
onClose={close}
|
20
|
-
onConfirm={
|
17
|
+
onConfirm={close}
|
21
18
|
opened={isOpen}
|
22
|
-
portalClassName="portal"
|
23
19
|
size="sm"
|
24
20
|
text="Hello Body Text, Nice to meet ya."
|
25
21
|
title="Header Title is the Title Prop"
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { Button, Dialog } from 'playbook-ui'
|
3
|
+
|
4
|
+
const DialogLoading = () => {
|
5
|
+
const [isOpen, setIsOpen] = useState(false)
|
6
|
+
const close = () => {
|
7
|
+
if (!isLoading) {
|
8
|
+
setIsOpen(false)
|
9
|
+
}
|
10
|
+
}
|
11
|
+
const open = () => setIsOpen(true)
|
12
|
+
const [isLoading, setIsLoading] = useState(false)
|
13
|
+
const submit = async () => {
|
14
|
+
setIsLoading(true)
|
15
|
+
|
16
|
+
try {
|
17
|
+
await new Promise((r) => setTimeout(r, 3000))
|
18
|
+
setIsOpen(false)
|
19
|
+
} catch (error) {
|
20
|
+
console.error("An error occurred.")
|
21
|
+
} finally {
|
22
|
+
setIsLoading(false)
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
return (
|
27
|
+
<>
|
28
|
+
<Button onClick={open}>{'Open Dialog'}</Button>
|
29
|
+
<Dialog
|
30
|
+
cancelButton="Cancel"
|
31
|
+
className="wrapper"
|
32
|
+
confirmButton="Okay"
|
33
|
+
loading={isLoading}
|
34
|
+
onCancel={close}
|
35
|
+
onClose={close}
|
36
|
+
onConfirm={submit}
|
37
|
+
opened={isOpen}
|
38
|
+
size="sm"
|
39
|
+
text="Make a 3 second request?"
|
40
|
+
title="Loading Example"
|
41
|
+
/>
|
42
|
+
</>
|
43
|
+
)
|
44
|
+
}
|
45
|
+
|
46
|
+
export default DialogLoading
|
@@ -8,3 +8,4 @@ export { default as DialogStatus } from './_dialog_status.jsx'
|
|
8
8
|
export { default as DialogStackedAlert } from './_dialog_stacked_alert.jsx'
|
9
9
|
export { default as DialogFullHeight } from './_dialog_full_height.jsx'
|
10
10
|
export { default as DialogFullHeightPlacement } from './_dialog_full_height_placement.jsx'
|
11
|
+
export { default as DialogLoading } from './_dialog_loading.jsx'
|