playbook_ui 11.7.0.pre.alpha.pre.guagechart1 → 11.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/index.js +1 -1
- data/app/pb_kits/playbook/pb_date_picker/{_date_picker.jsx → _date_picker.tsx} +58 -66
- data/app/pb_kits/playbook/pb_date_picker/{date_picker_helper.js → date_picker_helper.ts} +37 -16
- data/app/pb_kits/playbook/pb_date_picker/plugins/timeSelect.ts +171 -0
- data/app/pb_kits/playbook/pb_date_range_stacked/{_date_range_stacked.jsx → _date_range_stacked.tsx} +5 -6
- data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.test.js +127 -0
- data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +90 -0
- data/app/pb_kits/playbook/pb_date_stacked/date_stacked.test.js +151 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_align.jsx +1 -1
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold.jsx +1 -1
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_not_current_year.jsx +1 -1
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_reverse.jsx +1 -1
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_sizes.jsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/{_close_icon.jsx → _close_icon.tsx} +1 -3
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +217 -0
- data/app/pb_kits/playbook/pb_dialog/_dialog_context.tsx +3 -0
- data/app/pb_kits/playbook/pb_dialog/child_kits/{_dialog_body.jsx → _dialog_body.tsx} +6 -2
- data/app/pb_kits/playbook/pb_dialog/child_kits/{_dialog_footer.jsx → _dialog_footer.tsx} +8 -11
- data/app/pb_kits/playbook/pb_dialog/child_kits/{_dialog_header.jsx → _dialog_header.tsx} +12 -15
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.tsx +33 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnails.tsx +1 -3
- data/app/pb_kits/playbook/pb_lightbox/Carousel/index.tsx +3 -1
- data/app/pb_kits/playbook/pb_lightbox/{_lightbox_header.tsx → Header/_lightbox_header.tsx} +8 -8
- data/app/pb_kits/playbook/pb_lightbox/{_lightbox_header_icon.tsx → Header/_lightbox_header_icon.tsx} +2 -2
- data/app/pb_kits/playbook/pb_lightbox/_lightbox.tsx +2 -1
- data/app/pb_kits/playbook/pb_lightbox/lightbox.scss +8 -60
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +5 -5
- data/app/pb_kits/playbook/pb_title/_title.tsx +1 -1
- data/app/pb_kits/playbook/playbook-rails.js +1 -1
- data/app/pb_kits/playbook/tokens/_spacing.scss +2 -0
- data/app/pb_kits/playbook/utilities/_spacing.scss +1 -0
- data/lib/playbook/spacing.rb +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +19 -17
- data/app/pb_kits/playbook/pb_date_picker/plugins/timeSelect.js +0 -137
- data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.jsx +0 -103
- data/app/pb_kits/playbook/pb_dialog/_dialog.jsx +0 -223
- data/app/pb_kits/playbook/pb_dialog/_dialog_context.jsx +0 -3
@@ -0,0 +1,90 @@
|
|
1
|
+
import React from "react";
|
2
|
+
|
3
|
+
import classnames from "classnames";
|
4
|
+
import DateTime from "../pb_kit/dateTime";
|
5
|
+
import { buildCss, buildDataProps } from "../utilities/props";
|
6
|
+
import { globalProps } from "../utilities/globalProps";
|
7
|
+
|
8
|
+
import Caption from "../pb_caption/_caption";
|
9
|
+
import Title from "../pb_title/_title";
|
10
|
+
|
11
|
+
type DateStackedProps = {
|
12
|
+
align?: "left" | "center" | "right";
|
13
|
+
bold?: boolean;
|
14
|
+
className?: string | string[];
|
15
|
+
dark?: boolean;
|
16
|
+
data?: string;
|
17
|
+
date: string;
|
18
|
+
size?: "sm" | "md";
|
19
|
+
id?: string;
|
20
|
+
reverse?: boolean;
|
21
|
+
};
|
22
|
+
|
23
|
+
const sizes: {sm: 4, md: 3} = {
|
24
|
+
sm: 4,
|
25
|
+
md: 3,
|
26
|
+
};
|
27
|
+
|
28
|
+
const DateStacked = (props: DateStackedProps) => {
|
29
|
+
const {
|
30
|
+
align = "left",
|
31
|
+
bold = false,
|
32
|
+
reverse = false,
|
33
|
+
className,
|
34
|
+
dark = false,
|
35
|
+
date,
|
36
|
+
data={},
|
37
|
+
size = "sm",
|
38
|
+
} = props;
|
39
|
+
const classes = classnames(
|
40
|
+
buildCss("pb_date_stacked_kit", align, size, {
|
41
|
+
dark: dark,
|
42
|
+
reverse: reverse,
|
43
|
+
}),
|
44
|
+
globalProps(props),
|
45
|
+
className
|
46
|
+
);
|
47
|
+
|
48
|
+
const currentYear = new Date().getFullYear().toString();
|
49
|
+
const dateTimestamp = new DateTime({ value: date });
|
50
|
+
const inputYear = dateTimestamp.toYear().toString();
|
51
|
+
const dataProps = buildDataProps(data)
|
52
|
+
|
53
|
+
return (
|
54
|
+
<>
|
55
|
+
{bold == false ? (
|
56
|
+
<div {...dataProps} className={classes}>
|
57
|
+
<div className="pb_date_stacked_day_month">
|
58
|
+
<Caption text={dateTimestamp.toMonth().toUpperCase()} />
|
59
|
+
<Title
|
60
|
+
dark={dark}
|
61
|
+
size={sizes[size]}
|
62
|
+
text={dateTimestamp.toDay()}
|
63
|
+
/>
|
64
|
+
</div>
|
65
|
+
{currentYear != inputYear && <Caption size="xs">{inputYear}</Caption>}
|
66
|
+
</div>
|
67
|
+
) : (
|
68
|
+
<div {...dataProps} className={classes}>
|
69
|
+
<div className="pb_date_stacked_day_month">
|
70
|
+
<Title
|
71
|
+
bold
|
72
|
+
dark={dark}
|
73
|
+
size="4"
|
74
|
+
text={dateTimestamp.toMonth()}
|
75
|
+
/>
|
76
|
+
<Title
|
77
|
+
bold
|
78
|
+
dark={dark}
|
79
|
+
size="4"
|
80
|
+
text={dateTimestamp.toDay()}
|
81
|
+
/>
|
82
|
+
{currentYear != inputYear && <Title size="4">{inputYear}</Title>}
|
83
|
+
</div>
|
84
|
+
</div>
|
85
|
+
)}
|
86
|
+
</>
|
87
|
+
);
|
88
|
+
};
|
89
|
+
|
90
|
+
export default DateStacked;
|
@@ -0,0 +1,151 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
3
|
+
|
4
|
+
import DateStacked from './_date_stacked'
|
5
|
+
|
6
|
+
const TEST_DATE = "01/01/2020 00:00:000 GMT-0500";
|
7
|
+
jest.setSystemTime(new Date(TEST_DATE));
|
8
|
+
const futureDate = new Date(
|
9
|
+
new Date().getFullYear() - 4,
|
10
|
+
new Date().getMonth(),
|
11
|
+
new Date().getDate(),
|
12
|
+
new Date().getHours(),
|
13
|
+
new Date().getMinutes()
|
14
|
+
);
|
15
|
+
|
16
|
+
const testId = "datestacked-kit";
|
17
|
+
|
18
|
+
describe("DateStacked Kit", () => {
|
19
|
+
test("renders DateStacked className", () => {
|
20
|
+
render(
|
21
|
+
<DateStacked
|
22
|
+
align="left"
|
23
|
+
data={{ testid: testId }}
|
24
|
+
date={new Date()}
|
25
|
+
size="sm"
|
26
|
+
/>
|
27
|
+
)
|
28
|
+
|
29
|
+
const kit = screen.getByTestId(testId)
|
30
|
+
expect(kit).toHaveClass("pb_date_stacked_kit_left_sm")
|
31
|
+
})
|
32
|
+
|
33
|
+
test("renders top text", () => {
|
34
|
+
render(
|
35
|
+
<DateStacked
|
36
|
+
align="left"
|
37
|
+
data={{ testid: testId }}
|
38
|
+
date={new Date()}
|
39
|
+
size="sm"
|
40
|
+
/>
|
41
|
+
)
|
42
|
+
|
43
|
+
const kit = screen.getByTestId(testId)
|
44
|
+
const text = kit.querySelector(".pb_caption_kit_md")
|
45
|
+
expect(text.textContent).toEqual("JAN")
|
46
|
+
})
|
47
|
+
|
48
|
+
test("renders bottom text", () => {
|
49
|
+
render(
|
50
|
+
<DateStacked
|
51
|
+
align="left"
|
52
|
+
data={{ testid: testId }}
|
53
|
+
date={new Date()}
|
54
|
+
size="sm"
|
55
|
+
/>
|
56
|
+
)
|
57
|
+
|
58
|
+
const kit = screen.getByTestId(testId)
|
59
|
+
const text = kit.querySelector(".pb_title_kit_size_4")
|
60
|
+
expect(text.textContent).toEqual("1")
|
61
|
+
})
|
62
|
+
|
63
|
+
test("renders correct size", () => {
|
64
|
+
render(
|
65
|
+
<DateStacked
|
66
|
+
align="left"
|
67
|
+
data={{ testid: testId }}
|
68
|
+
date={new Date()}
|
69
|
+
size="md"
|
70
|
+
/>
|
71
|
+
)
|
72
|
+
|
73
|
+
const kit = screen.getByTestId(testId)
|
74
|
+
expect(kit).toHaveClass("pb_date_stacked_kit_left_md")
|
75
|
+
})
|
76
|
+
|
77
|
+
test("renders year when non-current year", () => {
|
78
|
+
render(
|
79
|
+
<DateStacked
|
80
|
+
align="left"
|
81
|
+
data={{ testid: testId }}
|
82
|
+
date={futureDate}
|
83
|
+
size="sm"
|
84
|
+
/>
|
85
|
+
)
|
86
|
+
|
87
|
+
const kit = screen.getByTestId(testId)
|
88
|
+
const text = kit.querySelector(".pb_caption_kit_xs")
|
89
|
+
expect(text.textContent).toEqual("2016")
|
90
|
+
})
|
91
|
+
|
92
|
+
test("renders correct className when order reversed", () => {
|
93
|
+
render(
|
94
|
+
<DateStacked
|
95
|
+
align="left"
|
96
|
+
data={{ testid: testId }}
|
97
|
+
date={futureDate}
|
98
|
+
reverse
|
99
|
+
size="sm"
|
100
|
+
/>
|
101
|
+
)
|
102
|
+
const kit = screen.getByTestId(testId)
|
103
|
+
expect(kit).toHaveClass("pb_date_stacked_kit_left_sm_reverse")
|
104
|
+
})
|
105
|
+
|
106
|
+
test("renders bold prop", () => {
|
107
|
+
render(
|
108
|
+
<DateStacked
|
109
|
+
align="left"
|
110
|
+
bold
|
111
|
+
data={{ testid: testId }}
|
112
|
+
date={futureDate}
|
113
|
+
size="md"
|
114
|
+
/>
|
115
|
+
)
|
116
|
+
|
117
|
+
const kit = screen.getByTestId(testId)
|
118
|
+
const text = kit.querySelector(".pb_title_kit_size_4")
|
119
|
+
expect(text).toBeInTheDocument()
|
120
|
+
})
|
121
|
+
|
122
|
+
test("renders center alignment prop", () => {
|
123
|
+
render(
|
124
|
+
<DateStacked
|
125
|
+
align="center"
|
126
|
+
data={{ testid: testId }}
|
127
|
+
date={futureDate}
|
128
|
+
size="md"
|
129
|
+
/>
|
130
|
+
)
|
131
|
+
|
132
|
+
const kit = screen.getByTestId(testId)
|
133
|
+
expect(kit).toHaveClass("pb_date_stacked_kit_center_md")
|
134
|
+
})
|
135
|
+
|
136
|
+
test("renders right alignment prop", () => {
|
137
|
+
render(
|
138
|
+
<DateStacked
|
139
|
+
align="right"
|
140
|
+
data={{ testid: testId }}
|
141
|
+
date={futureDate}
|
142
|
+
size="md"
|
143
|
+
/>
|
144
|
+
)
|
145
|
+
|
146
|
+
const kit = screen.getByTestId(testId)
|
147
|
+
expect(kit).toHaveClass("pb_date_stacked_kit_right_md")
|
148
|
+
})
|
149
|
+
|
150
|
+
|
151
|
+
})
|
@@ -0,0 +1,217 @@
|
|
1
|
+
/* eslint-disable react/jsx-handler-names */
|
2
|
+
/* eslint-disable react/no-multi-comp */
|
3
|
+
|
4
|
+
import React, { useState } from "react";
|
5
|
+
import classnames from "classnames";
|
6
|
+
import Modal from "react-modal";
|
7
|
+
|
8
|
+
import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props";
|
9
|
+
import { globalProps } from "../utilities/globalProps";
|
10
|
+
|
11
|
+
import Body from "../pb_body/_body";
|
12
|
+
import Button from "../pb_button/_button";
|
13
|
+
import DialogHeader from "./child_kits/_dialog_header";
|
14
|
+
import DialogFooter from "./child_kits/_dialog_footer";
|
15
|
+
import DialogBody from "./child_kits/_dialog_body";
|
16
|
+
import Flex from "../pb_flex/_flex";
|
17
|
+
import IconCircle from "../pb_icon_circle/_icon_circle";
|
18
|
+
import Title from "../pb_title/_title";
|
19
|
+
import { DialogContext } from "./_dialog_context";
|
20
|
+
|
21
|
+
type DialogProps = {
|
22
|
+
aria?: { [key: string]: string };
|
23
|
+
cancelButton?: string;
|
24
|
+
children: React.ReactNode | React.ReactNode[] | string;
|
25
|
+
className?: string;
|
26
|
+
closeable: boolean;
|
27
|
+
confirmButton?: string;
|
28
|
+
data?: object;
|
29
|
+
id?: string;
|
30
|
+
loading?: boolean;
|
31
|
+
onCancel?: () => void;
|
32
|
+
onChange?: () => void;
|
33
|
+
onClose?: () => void;
|
34
|
+
onConfirm?: () => void;
|
35
|
+
opened: boolean;
|
36
|
+
portalClassName?: string;
|
37
|
+
shouldCloseOnOverlayClick: boolean;
|
38
|
+
size?: "sm" | "md" | "lg" | "status_size" | "content";
|
39
|
+
status?: "info" | "caution" | "delete" | "error" | "success";
|
40
|
+
text?: string;
|
41
|
+
title?: string;
|
42
|
+
trigger?: string;
|
43
|
+
};
|
44
|
+
|
45
|
+
const Dialog = (props: DialogProps) => {
|
46
|
+
const {
|
47
|
+
aria = {},
|
48
|
+
cancelButton,
|
49
|
+
confirmButton,
|
50
|
+
className,
|
51
|
+
data = {},
|
52
|
+
id,
|
53
|
+
size = "md",
|
54
|
+
children,
|
55
|
+
loading = false,
|
56
|
+
opened,
|
57
|
+
onCancel = () => {},
|
58
|
+
onConfirm = () => {},
|
59
|
+
onClose = () => {},
|
60
|
+
portalClassName,
|
61
|
+
shouldCloseOnOverlayClick = true,
|
62
|
+
status,
|
63
|
+
text,
|
64
|
+
title,
|
65
|
+
trigger,
|
66
|
+
} = props;
|
67
|
+
const ariaProps = buildAriaProps(aria);
|
68
|
+
const dataProps = buildDataProps(data);
|
69
|
+
const dialogClassNames = {
|
70
|
+
base: classnames("pb_dialog", buildCss("pb_dialog", size)),
|
71
|
+
afterOpen: "pb_dialog_after_open",
|
72
|
+
beforeClose: "pb_dialog_before_close",
|
73
|
+
};
|
74
|
+
|
75
|
+
const overlayClassNames = {
|
76
|
+
base: "pb_dialog_overlay",
|
77
|
+
afterOpen: "pb_dialog_overlay_after_open",
|
78
|
+
beforeClose: "pb_dialog_overlay_before_close",
|
79
|
+
};
|
80
|
+
|
81
|
+
const classes = classnames(
|
82
|
+
buildCss("pb_dialog_wrapper"),
|
83
|
+
globalProps(props),
|
84
|
+
className
|
85
|
+
);
|
86
|
+
|
87
|
+
const [triggerOpened, setTriggerOpened] = useState(false),
|
88
|
+
modalIsOpened = trigger ? triggerOpened : opened;
|
89
|
+
|
90
|
+
const api = {
|
91
|
+
onClose: trigger
|
92
|
+
? function () {
|
93
|
+
setTriggerOpened(false);
|
94
|
+
}
|
95
|
+
: onClose,
|
96
|
+
};
|
97
|
+
|
98
|
+
if (trigger) {
|
99
|
+
const modalTrigger = document.querySelector(trigger);
|
100
|
+
modalTrigger.addEventListener(
|
101
|
+
"click",
|
102
|
+
() => {
|
103
|
+
setTriggerOpened(true);
|
104
|
+
document
|
105
|
+
.querySelector("#cancel-button")
|
106
|
+
.addEventListener("click", () => {
|
107
|
+
setTriggerOpened(false);
|
108
|
+
});
|
109
|
+
},
|
110
|
+
{ once: true }
|
111
|
+
);
|
112
|
+
}
|
113
|
+
|
114
|
+
type sweetAlertStatusProps = {
|
115
|
+
[key: string]: {
|
116
|
+
icon: string,
|
117
|
+
variant: "default" | "yellow" | "red" | "green" | "royal" | "blue" | "purple" | "teal",
|
118
|
+
size: "sm" | "md" | "lg" | "base" | "xs" | "xl";
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
const sweetAlertStatus: sweetAlertStatusProps = {
|
123
|
+
default: {
|
124
|
+
icon: "exclamation-circle",
|
125
|
+
variant: "default",
|
126
|
+
size: "lg",
|
127
|
+
},
|
128
|
+
info: {
|
129
|
+
icon: "info-circle",
|
130
|
+
variant: "default",
|
131
|
+
size: "lg",
|
132
|
+
},
|
133
|
+
caution: {
|
134
|
+
icon: "exclamation-triangle",
|
135
|
+
variant: "yellow",
|
136
|
+
size: "lg",
|
137
|
+
},
|
138
|
+
delete: {
|
139
|
+
icon: "trash-alt",
|
140
|
+
variant: "red",
|
141
|
+
size: "lg",
|
142
|
+
},
|
143
|
+
error: {
|
144
|
+
icon: "times-circle",
|
145
|
+
variant: "red",
|
146
|
+
size: "lg",
|
147
|
+
},
|
148
|
+
success: {
|
149
|
+
icon: "check-circle",
|
150
|
+
variant: "green",
|
151
|
+
size: "lg",
|
152
|
+
},
|
153
|
+
};
|
154
|
+
|
155
|
+
return (
|
156
|
+
<DialogContext.Provider value={api}>
|
157
|
+
<div {...ariaProps} {...dataProps} className={classes}>
|
158
|
+
<Modal
|
159
|
+
ariaHideApp={false}
|
160
|
+
className={dialogClassNames}
|
161
|
+
closeTimeoutMS={200}
|
162
|
+
contentLabel="Minimal Modal Example"
|
163
|
+
id={id}
|
164
|
+
isOpen={modalIsOpened}
|
165
|
+
onRequestClose={onClose}
|
166
|
+
overlayClassName={overlayClassNames}
|
167
|
+
portalClassName={portalClassName}
|
168
|
+
shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}
|
169
|
+
>
|
170
|
+
<>
|
171
|
+
{title && !status ? <Dialog.Header>{title}</Dialog.Header> : null}
|
172
|
+
{!status && text ? <Dialog.Body>{text}</Dialog.Body> : null}
|
173
|
+
{status && (
|
174
|
+
<Dialog.Body padding="md">
|
175
|
+
<Flex align="center" orientation="column">
|
176
|
+
<IconCircle
|
177
|
+
icon={sweetAlertStatus[status].icon}
|
178
|
+
size={sweetAlertStatus[status].size}
|
179
|
+
variant={sweetAlertStatus[status].variant}
|
180
|
+
/>
|
181
|
+
<Title marginTop="sm" size={3}>
|
182
|
+
{title}
|
183
|
+
</Title>
|
184
|
+
<Body marginTop="xs" text={text} />
|
185
|
+
</Flex>
|
186
|
+
</Dialog.Body>
|
187
|
+
)}
|
188
|
+
{cancelButton && confirmButton ? (
|
189
|
+
<Dialog.Footer>
|
190
|
+
<Button
|
191
|
+
loading={loading}
|
192
|
+
onClick={onConfirm}
|
193
|
+
htmlType="button"
|
194
|
+
variant="primary">
|
195
|
+
{confirmButton}
|
196
|
+
</Button>
|
197
|
+
<Button
|
198
|
+
id="cancel-button"
|
199
|
+
onClick={onCancel}
|
200
|
+
variant="link"
|
201
|
+
htmlType="button">
|
202
|
+
{cancelButton}
|
203
|
+
</Button>
|
204
|
+
</Dialog.Footer>
|
205
|
+
) : null}
|
206
|
+
{children}
|
207
|
+
</>
|
208
|
+
</Modal>
|
209
|
+
</div>
|
210
|
+
</DialogContext.Provider>
|
211
|
+
);
|
212
|
+
};
|
213
|
+
Dialog.Header = DialogHeader;
|
214
|
+
Dialog.Body = DialogBody;
|
215
|
+
Dialog.Footer = DialogFooter;
|
216
|
+
|
217
|
+
export default Dialog;
|
@@ -1,10 +1,14 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
3
|
import { buildCss } from '../../utilities/props'
|
6
4
|
import { globalProps } from '../../utilities/globalProps'
|
7
5
|
|
6
|
+
type DialogBodyProps = {
|
7
|
+
children: React.ReactNode | React.ReactNode[] | string,
|
8
|
+
padding?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
|
9
|
+
className?: string
|
10
|
+
}
|
11
|
+
|
8
12
|
// Body component
|
9
13
|
const DialogBody = (props: DialogBodyProps) => {
|
10
14
|
const { children, padding = "sm", className } = props
|
@@ -1,10 +1,8 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
3
|
|
6
4
|
import { buildCss } from '../../utilities/props'
|
7
|
-
import { globalProps } from '../../utilities/globalProps'
|
5
|
+
import { GlobalProps, globalProps } from '../../utilities/globalProps'
|
8
6
|
|
9
7
|
import Flex from '../../pb_flex/_flex'
|
10
8
|
import SectionSeparator from '../../pb_section_separator/_section_separator'
|
@@ -12,17 +10,16 @@ import SectionSeparator from '../../pb_section_separator/_section_separator'
|
|
12
10
|
|
13
11
|
type DialogFooterProps = {
|
14
12
|
aria?: object,
|
15
|
-
children:
|
13
|
+
children: React.ReactChild[] | React.ReactChild | string,
|
16
14
|
className?: string,
|
17
|
-
closeable: boolean,
|
18
15
|
data?: object,
|
19
16
|
id?: string,
|
20
17
|
padding?: string,
|
21
18
|
paddingBottom?: string,
|
22
19
|
paddingX?: string,
|
23
|
-
separator
|
24
|
-
spacing?:
|
25
|
-
}
|
20
|
+
separator?: boolean,
|
21
|
+
spacing?: "none" | "between" | "around" | "evenly",
|
22
|
+
} & GlobalProps
|
26
23
|
|
27
24
|
// Footer component
|
28
25
|
const DialogFooter = (props: DialogFooterProps) => {
|
@@ -41,9 +38,9 @@ const DialogFooter = (props: DialogFooterProps) => {
|
|
41
38
|
|
42
39
|
return (
|
43
40
|
<>
|
44
|
-
|
45
|
-
<SectionSeparator />
|
46
|
-
|
41
|
+
{separator &&
|
42
|
+
<SectionSeparator aria={{dd: 'ff'}} className="dd" data={{dd: 'ff'}} id="d" text="ss"/>
|
43
|
+
}
|
47
44
|
<Flex
|
48
45
|
className={classnames(footerCSS, footerSpacing, className)}
|
49
46
|
spacing={spacing}
|
@@ -1,9 +1,7 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React, { useContext } from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
3
|
import { buildAriaProps, buildCss, buildDataProps } from '../../utilities/props'
|
6
|
-
import { globalProps } from '../../utilities/globalProps'
|
4
|
+
import { globalProps, GlobalProps } from '../../utilities/globalProps'
|
7
5
|
|
8
6
|
import { CloseIcon } from '../_close_icon'
|
9
7
|
import { DialogContext } from '../_dialog_context'
|
@@ -11,18 +9,18 @@ import Flex from '../../pb_flex/_flex'
|
|
11
9
|
import SectionSeparator from '../../pb_section_separator/_section_separator'
|
12
10
|
|
13
11
|
type DialogHeaderProps = {
|
14
|
-
aria?:
|
15
|
-
children:
|
12
|
+
aria?: {[key: string]: string},
|
13
|
+
children: React.ReactNode[] | React.ReactNode | string,
|
16
14
|
className?: string,
|
17
|
-
closeable
|
15
|
+
closeable?: boolean,
|
18
16
|
data?: object,
|
19
17
|
id?: string,
|
20
18
|
padding?: string,
|
21
|
-
separator
|
22
|
-
spacing?:
|
19
|
+
separator?: boolean,
|
20
|
+
spacing?: "none" | "between" | "around" | "evenly",
|
23
21
|
text?: string,
|
24
22
|
title?: string,
|
25
|
-
}
|
23
|
+
} & GlobalProps
|
26
24
|
|
27
25
|
const DialogHeader = (props: DialogHeaderProps) => {
|
28
26
|
const {
|
@@ -53,16 +51,15 @@ const DialogHeader = (props: DialogHeaderProps) => {
|
|
53
51
|
spacing={spacing}
|
54
52
|
>
|
55
53
|
{children}
|
56
|
-
|
54
|
+
{closeable &&
|
57
55
|
<CloseIcon
|
58
|
-
|
59
|
-
onClose={api.onClose}
|
56
|
+
onClose={api.onClose}
|
60
57
|
/>
|
61
|
-
|
58
|
+
}
|
62
59
|
</Flex>
|
63
|
-
|
60
|
+
{separator &&
|
64
61
|
<SectionSeparator />
|
65
|
-
|
62
|
+
}
|
66
63
|
</>
|
67
64
|
)
|
68
65
|
}
|