playbook_ui 8.1.0.pre.alpha1 → 8.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -9
- data/app/pb_kits/playbook/_playbook.scss +0 -2
- data/app/pb_kits/playbook/data/menu.yml +1 -2
- data/app/pb_kits/playbook/index.js +0 -2
- data/app/pb_kits/playbook/pb_avatar/_avatar.jsx +2 -14
- data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +1 -1
- data/app/pb_kits/playbook/pb_avatar/avatar.rb +2 -5
- data/app/pb_kits/playbook/pb_avatar/avatar.test.js +2 -5
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_default.html.erb +0 -5
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_default.jsx +0 -5
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_status.html.erb +0 -4
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_status.jsx +0 -4
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +0 -6
- data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +1 -2
- data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.rb +0 -2
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.html.erb +0 -4
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.jsx +0 -4
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.html.erb +0 -2
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.jsx +0 -2
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_on_click.jsx +0 -2
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_onclick.html.erb +0 -2
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.html.erb +0 -8
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.jsx +0 -8
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_tooltip.html.erb +0 -2
- data/app/pb_kits/playbook/pb_badge/_badge.jsx +1 -26
- data/app/pb_kits/playbook/pb_button/_button.jsx +0 -6
- data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +1 -0
- data/app/pb_kits/playbook/pb_caption/_caption.jsx +2 -3
- data/app/pb_kits/playbook/pb_caption/caption.rb +1 -1
- data/app/pb_kits/playbook/pb_card/_card.jsx +3 -18
- data/app/pb_kits/playbook/pb_card/card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_card/card.rb +0 -3
- data/app/pb_kits/playbook/pb_card/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_card/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_dashboard/commonSettings.js +2 -2
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +2 -2
- data/app/pb_kits/playbook/pb_form/_form.scss +1 -5
- data/app/pb_kits/playbook/pb_form/form_builder.rb +2 -4
- data/app/pb_kits/playbook/pb_form/form_builder/action_area.html.erb +3 -0
- data/app/pb_kits/playbook/pb_form/form_builder/action_area.rb +7 -14
- data/app/pb_kits/playbook/pb_form/simple_form.html.erb +4 -2
- data/app/pb_kits/playbook/pb_form/simple_form.rb +0 -4
- data/app/pb_kits/playbook/pb_online_status/_online_status.jsx +0 -2
- data/app/pb_kits/playbook/pb_online_status/online_status.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +3 -4
- data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +0 -3
- data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +0 -3
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +1 -6
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx +2 -25
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default.jsx +0 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.jsx +3 -7
- data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +1 -1
- data/app/pb_kits/playbook/plugins/pb_chart.js +1 -1
- data/app/pb_kits/playbook/react_rails_kits.js +0 -4
- data/app/pb_kits/playbook/tokens/_border_radius.scss +10 -0
- data/app/pb_kits/playbook/tokens/_colors.scss +25 -0
- data/app/pb_kits/playbook/tokens/_line_height.scss +9 -0
- data/app/pb_kits/playbook/tokens/_opacity.scss +9 -0
- data/app/pb_kits/playbook/tokens/_positioning.scss +9 -0
- data/app/pb_kits/playbook/tokens/_screen_sizes.scss +9 -0
- data/app/pb_kits/playbook/tokens/_shadows.scss +9 -0
- data/app/pb_kits/playbook/tokens/_spacing.scss +10 -0
- data/app/pb_kits/playbook/tokens/_typography.scss +25 -0
- data/app/pb_kits/playbook/utilities/test-utils.js +0 -6
- data/lib/playbook/version.rb +1 -1
- metadata +13 -58
- data/app/pb_kits/playbook/pb_avatar_action_button/pb_avatar_action_button.test.js +0 -31
- data/app/pb_kits/playbook/pb_button/button.test.js +0 -91
- data/app/pb_kits/playbook/pb_button_toolbar/button_toolbar.test.js +0 -46
- data/app/pb_kits/playbook/pb_card/docs/_card_tag.html.erb +0 -25
- data/app/pb_kits/playbook/pb_card/docs/_card_tag.jsx +0 -59
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.test.js +0 -17
- data/app/pb_kits/playbook/pb_dialog/_close_icon.jsx +0 -23
- data/app/pb_kits/playbook/pb_dialog/_dialog.html.erb +0 -10
- data/app/pb_kits/playbook/pb_dialog/_dialog.jsx +0 -142
- data/app/pb_kits/playbook/pb_dialog/_dialog.scss +0 -133
- data/app/pb_kits/playbook/pb_dialog/_dialog_context.jsx +0 -3
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.jsx +0 -21
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.jsx +0 -36
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.jsx +0 -68
- data/app/pb_kits/playbook/pb_dialog/dialog.rb +0 -47
- data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +0 -23
- data/app/pb_kits/playbook/pb_dialog/dialog_header.rb +0 -31
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.jsx +0 -53
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.md +0 -2
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default.jsx +0 -27
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_scrollable.jsx +0 -27
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_scrollable.md +0 -2
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_separators.jsx +0 -119
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_separators.md +0 -2
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_should_close_on_overlay.jsx +0 -28
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_should_close_on_overlay.md +0 -2
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_sizes.jsx +0 -93
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +0 -10
- data/app/pb_kits/playbook/pb_dialog/docs/index.js +0 -6
- data/app/pb_kits/playbook/pb_inline/_inline.jsx +0 -83
- data/app/pb_kits/playbook/pb_inline/_inline.scss +0 -58
- data/app/pb_kits/playbook/pb_inline/docs/_inline_default.jsx +0 -36
- data/app/pb_kits/playbook/pb_inline/docs/_inline_input_options.jsx +0 -58
- data/app/pb_kits/playbook/pb_inline/docs/_inline_text_options.jsx +0 -99
- data/app/pb_kits/playbook/pb_inline/docs/example.yml +0 -5
- data/app/pb_kits/playbook/pb_inline/docs/index.js +0 -3
- data/app/pb_kits/playbook/pb_inline/inline.test.jsx +0 -21
- data/app/pb_kits/playbook/tokens/exports/_border_radius.scss +0 -10
- data/app/pb_kits/playbook/tokens/exports/_colors.scss +0 -26
- data/app/pb_kits/playbook/tokens/exports/_line_height.scss +0 -10
- data/app/pb_kits/playbook/tokens/exports/_opacity.scss +0 -10
- data/app/pb_kits/playbook/tokens/exports/_positioning.scss +0 -10
- data/app/pb_kits/playbook/tokens/exports/_screen_sizes.scss +0 -10
- data/app/pb_kits/playbook/tokens/exports/_shadows.scss +0 -10
- data/app/pb_kits/playbook/tokens/exports/_spacing.scss +0 -10
- data/app/pb_kits/playbook/tokens/exports/_typography.scss +0 -24
- data/dist/reset.css +0 -1
@@ -1,17 +0,0 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import { render, screen } from '../utilities/test-utils'
|
3
|
-
|
4
|
-
import CircleIconButton from './_circle_icon_button'
|
5
|
-
|
6
|
-
test('default test', () => {
|
7
|
-
render(
|
8
|
-
<CircleIconButton
|
9
|
-
data={{ testid: 'default-test' }}
|
10
|
-
icon="plus"
|
11
|
-
/>
|
12
|
-
)
|
13
|
-
|
14
|
-
const kit = screen.getByTestId('default-test')
|
15
|
-
|
16
|
-
expect(kit).toHaveClass('pb_circle_icon_button_kit')
|
17
|
-
})
|
@@ -1,23 +0,0 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
|
-
import React from 'react'
|
4
|
-
import { Icon } from '../'
|
5
|
-
|
6
|
-
type CloseIconProps = {
|
7
|
-
onClose: () => mixed,
|
8
|
-
}
|
9
|
-
|
10
|
-
export const CloseIcon = (props: CloseIconProps) => {
|
11
|
-
const { onClose } = props
|
12
|
-
return (
|
13
|
-
<div
|
14
|
-
className="pb_dialog_close_icon"
|
15
|
-
onClick={onClose}
|
16
|
-
>
|
17
|
-
<Icon
|
18
|
-
fixedWidth
|
19
|
-
icon="times"
|
20
|
-
/>
|
21
|
-
</div>
|
22
|
-
)
|
23
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<%= content_tag(:div,
|
2
|
-
id: object.id,
|
3
|
-
data: object.data,
|
4
|
-
class: object.classname,
|
5
|
-
aria: object.aria,
|
6
|
-
dark: object.dark) do %>
|
7
|
-
<% if object.children %>
|
8
|
-
<%= pb_rails("dialog/dialog_header", props: { children: object.children }) %>
|
9
|
-
<% end %>
|
10
|
-
<% end %>
|
@@ -1,142 +0,0 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
|
-
import React, { useState } from 'react'
|
4
|
-
import classnames from 'classnames'
|
5
|
-
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
6
|
-
import { globalProps } from '../utilities/globalProps.js'
|
7
|
-
import Modal from 'react-modal'
|
8
|
-
import { Button } from '../'
|
9
|
-
import DialogHeader from './child_kits/_dialog_header'
|
10
|
-
import DialogFooter from './child_kits/_dialog_footer'
|
11
|
-
import DialogBody from './child_kits/_dialog_body'
|
12
|
-
import { DialogContext } from './_dialog_context'
|
13
|
-
|
14
|
-
type DialogProps = {
|
15
|
-
aria?: object,
|
16
|
-
cancelButton?: string,
|
17
|
-
children: array<React.ReactNode> | React.ReactNode | string,
|
18
|
-
className?: string,
|
19
|
-
closeable: boolean,
|
20
|
-
confirmButton?: string,
|
21
|
-
data?: object,
|
22
|
-
id?: string,
|
23
|
-
onCancel?: () => void,
|
24
|
-
onChange?: () => void,
|
25
|
-
onClose?: () => void,
|
26
|
-
onConfirm?: () => void,
|
27
|
-
opened: boolean,
|
28
|
-
shouldCloseOnOverlayClick: boolean,
|
29
|
-
size?: "sm" | "md" | "lg" | "content",
|
30
|
-
text?: string,
|
31
|
-
title?: string,
|
32
|
-
trigger?: string
|
33
|
-
}
|
34
|
-
|
35
|
-
const Dialog = (props: DialogProps) => {
|
36
|
-
const {
|
37
|
-
aria = {},
|
38
|
-
cancelButton,
|
39
|
-
confirmButton,
|
40
|
-
className,
|
41
|
-
data = {},
|
42
|
-
id,
|
43
|
-
size = 'md',
|
44
|
-
children,
|
45
|
-
opened,
|
46
|
-
onCancel = () => {},
|
47
|
-
onConfirm = () => {},
|
48
|
-
onClose = () => {},
|
49
|
-
shouldCloseOnOverlayClick = true,
|
50
|
-
text,
|
51
|
-
title,
|
52
|
-
trigger,
|
53
|
-
} = props
|
54
|
-
const ariaProps = buildAriaProps(aria)
|
55
|
-
const dataProps = buildDataProps(data)
|
56
|
-
|
57
|
-
const dialogClassNames = {
|
58
|
-
base: classnames('pb_dialog', buildCss('pb_dialog', size)),
|
59
|
-
afterOpen: 'pb_dialog_after_open',
|
60
|
-
beforeClose: 'pb_dialog_before_close',
|
61
|
-
}
|
62
|
-
|
63
|
-
const overlayClassNames = {
|
64
|
-
base: 'pb_dialog_overlay',
|
65
|
-
afterOpen: 'pb_dialog_overlay_after_open',
|
66
|
-
beforeClose: 'pb_dialog_overlay_before_close',
|
67
|
-
}
|
68
|
-
|
69
|
-
const classes = classnames(
|
70
|
-
buildCss('pb_dialog_wrapper'),
|
71
|
-
globalProps(props),
|
72
|
-
className
|
73
|
-
)
|
74
|
-
|
75
|
-
const api = {
|
76
|
-
onClose: trigger ? function(){
|
77
|
-
setTriggerOpened(false)
|
78
|
-
} : onClose,
|
79
|
-
}
|
80
|
-
|
81
|
-
const [triggerOpened, setTriggerOpened] = useState(false),
|
82
|
-
modalIsOpened = trigger ? triggerOpened : opened
|
83
|
-
|
84
|
-
if (trigger) {
|
85
|
-
const modalTrigger = document.querySelector(trigger)
|
86
|
-
modalTrigger.addEventListener('click', () => {
|
87
|
-
setTriggerOpened(true)
|
88
|
-
document.querySelector('#cancel-button').addEventListener('click', () => {
|
89
|
-
setTriggerOpened(false)
|
90
|
-
})
|
91
|
-
}, { once: true })
|
92
|
-
}
|
93
|
-
|
94
|
-
return (
|
95
|
-
<DialogContext.Provider value={api}>
|
96
|
-
<div
|
97
|
-
{...ariaProps}
|
98
|
-
{...dataProps}
|
99
|
-
className={classes}
|
100
|
-
id={id}
|
101
|
-
>
|
102
|
-
<Modal
|
103
|
-
ariaHideApp={false}
|
104
|
-
className={dialogClassNames}
|
105
|
-
closeTimeoutMS={200}
|
106
|
-
contentLabel="Minimal Modal Example"
|
107
|
-
isOpen={modalIsOpened}
|
108
|
-
onRequestClose={onClose}
|
109
|
-
overlayClassName={overlayClassNames}
|
110
|
-
shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}
|
111
|
-
>
|
112
|
-
<If condition={title}>
|
113
|
-
<Dialog.Header>{title}</Dialog.Header>
|
114
|
-
</If>
|
115
|
-
<If condition={text}>
|
116
|
-
<Dialog.Body>{text}</Dialog.Body>
|
117
|
-
</If>
|
118
|
-
|
119
|
-
<If condition={cancelButton && confirmButton}>
|
120
|
-
<Dialog.Footer>
|
121
|
-
<Button onClick={onConfirm}>{confirmButton}</Button>
|
122
|
-
<Button
|
123
|
-
id="cancel-button"
|
124
|
-
onClick={onCancel}
|
125
|
-
variant="link"
|
126
|
-
>
|
127
|
-
{cancelButton}
|
128
|
-
</Button>
|
129
|
-
</Dialog.Footer>
|
130
|
-
</If>
|
131
|
-
|
132
|
-
{children}
|
133
|
-
</Modal>
|
134
|
-
</div>
|
135
|
-
</DialogContext.Provider>
|
136
|
-
)
|
137
|
-
}
|
138
|
-
Dialog.Header = DialogHeader
|
139
|
-
Dialog.Body = DialogBody
|
140
|
-
Dialog.Footer = DialogFooter
|
141
|
-
|
142
|
-
export default Dialog
|
@@ -1,133 +0,0 @@
|
|
1
|
-
@import "../tokens/positioning";
|
2
|
-
@import "../tokens/colors";
|
3
|
-
@import "../pb_card/card_mixin";
|
4
|
-
@import "../tokens/shadows";
|
5
|
-
@import "../tokens/border_radius";
|
6
|
-
@import "../tokens/spacing";
|
7
|
-
@import "../tokens/animation-curves";
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
// Dialog Animations
|
12
|
-
|
13
|
-
@keyframes modalFadeIn {
|
14
|
-
from {
|
15
|
-
transform: translate3d(0, -100%, 0);
|
16
|
-
opacity: 0;
|
17
|
-
}
|
18
|
-
to {
|
19
|
-
transform: translate3d(0, 0, 0);
|
20
|
-
opacity: 1;
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
@keyframes modalFadeOut {
|
25
|
-
from {
|
26
|
-
transform: translate3d(0, 0, 0);
|
27
|
-
opacity: 1;
|
28
|
-
}
|
29
|
-
to {
|
30
|
-
transform: translate3d(0, -50%, 0);
|
31
|
-
opacity: 0;
|
32
|
-
}
|
33
|
-
}
|
34
|
-
|
35
|
-
@keyframes overlayFade {
|
36
|
-
from {
|
37
|
-
opacity: 0;
|
38
|
-
transform: translateY(0);
|
39
|
-
}
|
40
|
-
to {
|
41
|
-
opacity: 1;
|
42
|
-
transform: translateY(0);
|
43
|
-
}
|
44
|
-
}
|
45
|
-
|
46
|
-
@keyframes overlayFadeOut {
|
47
|
-
from {
|
48
|
-
opacity: 1;
|
49
|
-
}
|
50
|
-
to {
|
51
|
-
opacity: 0;
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
// Dialog Styles
|
56
|
-
|
57
|
-
.pb_dialog {
|
58
|
-
|
59
|
-
// Local Variables
|
60
|
-
$gutter: $space_lg;
|
61
|
-
$small: 300px;
|
62
|
-
$medium: 500px;
|
63
|
-
$large: 800px;
|
64
|
-
$animation-duration: 0.2s;
|
65
|
-
$z-index: 100;
|
66
|
-
$opacity_visible: 1;
|
67
|
-
$opacity_hidden: 0;
|
68
|
-
|
69
|
-
@include pb_card;
|
70
|
-
box-shadow: $shadow_deepest;
|
71
|
-
border: 0;
|
72
|
-
max-height: calc(100vh - #{$gutter * 2});
|
73
|
-
max-width: calc(100vw - #{$gutter * 2});
|
74
|
-
overflow: scroll;
|
75
|
-
animation-name: modalFadeIn;
|
76
|
-
animation-duration: $animation-duration;
|
77
|
-
outline: none;
|
78
|
-
animation-timing-function: $easeInOutQuint;
|
79
|
-
|
80
|
-
&[class*="_sm"] {
|
81
|
-
width: $small;
|
82
|
-
}
|
83
|
-
|
84
|
-
&[class*="_md"] {
|
85
|
-
width: $medium;
|
86
|
-
}
|
87
|
-
|
88
|
-
&[class*="_lg"] {
|
89
|
-
width: $large;
|
90
|
-
}
|
91
|
-
|
92
|
-
&_body_open {
|
93
|
-
overflow: hidden;
|
94
|
-
}
|
95
|
-
|
96
|
-
&_after_open {
|
97
|
-
opacity: $opacity_visible;
|
98
|
-
}
|
99
|
-
|
100
|
-
&_before_close {
|
101
|
-
animation-name: modalFadeOut;
|
102
|
-
animation-duration: $animation-duration;
|
103
|
-
opacity: $opacity_hidden;
|
104
|
-
}
|
105
|
-
|
106
|
-
&_close_icon {
|
107
|
-
cursor: pointer;
|
108
|
-
}
|
109
|
-
|
110
|
-
&_overlay {
|
111
|
-
position: fixed;
|
112
|
-
top: 0;
|
113
|
-
left: 0;
|
114
|
-
right: 0;
|
115
|
-
bottom: 0;
|
116
|
-
display: flex;
|
117
|
-
align-items: center;
|
118
|
-
justify-content: center;
|
119
|
-
background-color: rgba($bg_dark, $opacity_4);
|
120
|
-
z-index: $z-index;
|
121
|
-
animation-name: overlayFade;
|
122
|
-
animation-duration: $animation-duration;
|
123
|
-
|
124
|
-
&_after_open {
|
125
|
-
opacity: $opacity_visible;
|
126
|
-
}
|
127
|
-
&_before_close {
|
128
|
-
animation-name: overlayFadeOut;
|
129
|
-
animation-duration: $animation-duration;
|
130
|
-
opacity: $opacity_hidden;
|
131
|
-
}
|
132
|
-
}
|
133
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
|
-
import React from 'react'
|
4
|
-
import classnames from 'classnames'
|
5
|
-
import { buildCss } from '../../utilities/props'
|
6
|
-
import { globalProps } from '../../utilities/globalProps.js'
|
7
|
-
|
8
|
-
// Body component
|
9
|
-
const DialogBody = (props: DialogBodyProps) => {
|
10
|
-
const { children, padding = 'sm', className } = props
|
11
|
-
const bodyCSS = buildCss('dialog_body')
|
12
|
-
const bodySpacing = globalProps(props, { padding })
|
13
|
-
|
14
|
-
return (
|
15
|
-
<div className={classnames(bodyCSS, bodySpacing, className)}>
|
16
|
-
{children}
|
17
|
-
</div>
|
18
|
-
)
|
19
|
-
}
|
20
|
-
|
21
|
-
export default DialogBody
|
@@ -1,36 +0,0 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
|
-
import React from 'react'
|
4
|
-
import classnames from 'classnames'
|
5
|
-
import { buildCss } from '../../utilities/props'
|
6
|
-
import { globalProps } from '../../utilities/globalProps.js'
|
7
|
-
import { Flex, SectionSeparator } from '../../'
|
8
|
-
|
9
|
-
// Footer component
|
10
|
-
const DialogFooter = (props: DialogFooterProps) => {
|
11
|
-
const {
|
12
|
-
children,
|
13
|
-
padding = 'sm',
|
14
|
-
className,
|
15
|
-
spacing = 'between',
|
16
|
-
separator = false,
|
17
|
-
} = props
|
18
|
-
const footerCSS = buildCss('dialog_footer')
|
19
|
-
const footerSpacing = globalProps(props, { padding })
|
20
|
-
|
21
|
-
return (
|
22
|
-
<>
|
23
|
-
<If condition={separator}>
|
24
|
-
<SectionSeparator />
|
25
|
-
</If>
|
26
|
-
<Flex
|
27
|
-
className={classnames(footerCSS, footerSpacing, className)}
|
28
|
-
spacing={spacing}
|
29
|
-
>
|
30
|
-
{children}
|
31
|
-
</Flex>
|
32
|
-
</>
|
33
|
-
)
|
34
|
-
}
|
35
|
-
|
36
|
-
export default DialogFooter
|
@@ -1,68 +0,0 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
|
-
import React, { useContext } from 'react'
|
4
|
-
import classnames from 'classnames'
|
5
|
-
import { buildAriaProps, buildCss, buildDataProps } from '../../utilities/props'
|
6
|
-
import { globalProps } from '../../utilities/globalProps.js'
|
7
|
-
import { Flex, SectionSeparator } from '../../'
|
8
|
-
import { CloseIcon } from '../_close_icon'
|
9
|
-
import { DialogContext } from '../_dialog_context'
|
10
|
-
|
11
|
-
type DialogHeaderProps = {
|
12
|
-
aria?: object,
|
13
|
-
children: array<React.ReactNode> | React.ReactNode | string,
|
14
|
-
className?: string,
|
15
|
-
closeable: boolean,
|
16
|
-
data?: object,
|
17
|
-
id?: string,
|
18
|
-
padding?: string,
|
19
|
-
separator: boolean,
|
20
|
-
spacing?: string,
|
21
|
-
text?: string,
|
22
|
-
title?: string,
|
23
|
-
}
|
24
|
-
|
25
|
-
const DialogHeader = (props: DialogHeaderProps) => {
|
26
|
-
const {
|
27
|
-
aria = {},
|
28
|
-
children,
|
29
|
-
className,
|
30
|
-
data = {},
|
31
|
-
padding = 'sm',
|
32
|
-
spacing = 'between',
|
33
|
-
closeable = true,
|
34
|
-
separator = true,
|
35
|
-
} = props
|
36
|
-
|
37
|
-
const ariaProps = buildAriaProps(aria)
|
38
|
-
const dataProps = buildDataProps(data)
|
39
|
-
const api = useContext(DialogContext)
|
40
|
-
const headerCSS = buildCss('dialog_header')
|
41
|
-
const headerSpacing = globalProps(props, { padding })
|
42
|
-
|
43
|
-
/* eslint-disable react/jsx-handler-names */
|
44
|
-
|
45
|
-
return (
|
46
|
-
<>
|
47
|
-
<Flex
|
48
|
-
{...ariaProps}
|
49
|
-
{...dataProps}
|
50
|
-
className={classnames(headerCSS, headerSpacing, className)}
|
51
|
-
spacing={spacing}
|
52
|
-
>
|
53
|
-
{children}
|
54
|
-
<If condition={closeable}>
|
55
|
-
<CloseIcon
|
56
|
-
className="close-icon"
|
57
|
-
onClose={api.onClose}
|
58
|
-
/>
|
59
|
-
</If>
|
60
|
-
</Flex>
|
61
|
-
<If condition={separator}>
|
62
|
-
<SectionSeparator />
|
63
|
-
</If>
|
64
|
-
</>
|
65
|
-
)
|
66
|
-
}
|
67
|
-
|
68
|
-
export default DialogHeader
|