playbook_ui 8.1.0 → 8.2.0.pre.alpha3

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.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -0
  3. data/app/pb_kits/playbook/_playbook.scss +1 -0
  4. data/app/pb_kits/playbook/data/menu.yml +2 -1
  5. data/app/pb_kits/playbook/index.js +1 -0
  6. data/app/pb_kits/playbook/pb_avatar/_avatar.jsx +14 -2
  7. data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +1 -1
  8. data/app/pb_kits/playbook/pb_avatar/avatar.rb +5 -2
  9. data/app/pb_kits/playbook/pb_avatar/avatar.test.js +5 -2
  10. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_default.html.erb +5 -0
  11. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_default.jsx +5 -0
  12. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_status.html.erb +4 -0
  13. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_status.jsx +4 -0
  14. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +6 -0
  15. data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +2 -1
  16. data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.rb +2 -0
  17. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.html.erb +4 -0
  18. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.jsx +4 -0
  19. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.html.erb +2 -0
  20. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.jsx +2 -0
  21. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_on_click.jsx +2 -0
  22. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_onclick.html.erb +2 -0
  23. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.html.erb +8 -0
  24. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.jsx +8 -0
  25. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_tooltip.html.erb +2 -0
  26. data/app/pb_kits/playbook/pb_avatar_action_button/pb_avatar_action_button.test.js +31 -0
  27. data/app/pb_kits/playbook/pb_button/_button.jsx +6 -0
  28. data/app/pb_kits/playbook/pb_button/button.test.js +91 -0
  29. data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +0 -1
  30. data/app/pb_kits/playbook/pb_button_toolbar/button_toolbar.test.js +46 -0
  31. data/app/pb_kits/playbook/pb_caption/_caption.jsx +3 -2
  32. data/app/pb_kits/playbook/pb_caption/caption.rb +1 -1
  33. data/app/pb_kits/playbook/pb_card/_card.jsx +18 -3
  34. data/app/pb_kits/playbook/pb_card/card.html.erb +1 -1
  35. data/app/pb_kits/playbook/pb_card/card.rb +3 -0
  36. data/app/pb_kits/playbook/pb_card/docs/_card_tag.html.erb +25 -0
  37. data/app/pb_kits/playbook/pb_card/docs/_card_tag.jsx +59 -0
  38. data/app/pb_kits/playbook/pb_card/docs/example.yml +2 -0
  39. data/app/pb_kits/playbook/pb_card/docs/index.js +1 -0
  40. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +31 -9
  41. data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +28 -19
  42. data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +11 -3
  43. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +6 -1
  44. data/app/pb_kits/playbook/pb_checkbox/checkbox.test.js +94 -0
  45. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_custom.jsx +0 -1
  46. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +7 -0
  47. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.jsx +16 -0
  48. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +2 -0
  49. data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
  50. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.test.js +17 -0
  51. data/app/pb_kits/playbook/pb_dashboard/commonSettings.js +2 -2
  52. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +2 -2
  53. data/app/pb_kits/playbook/pb_dialog/_close_icon.jsx +23 -0
  54. data/app/pb_kits/playbook/pb_dialog/_dialog.html.erb +10 -0
  55. data/app/pb_kits/playbook/pb_dialog/_dialog.jsx +142 -0
  56. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +133 -0
  57. data/app/pb_kits/playbook/pb_dialog/_dialog_context.jsx +3 -0
  58. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.jsx +21 -0
  59. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.jsx +36 -0
  60. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.jsx +68 -0
  61. data/app/pb_kits/playbook/pb_dialog/dialog.rb +47 -0
  62. data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +23 -0
  63. data/app/pb_kits/playbook/pb_dialog/dialog_header.rb +31 -0
  64. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.jsx +53 -0
  65. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.md +2 -0
  66. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default.jsx +27 -0
  67. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_scrollable.jsx +27 -0
  68. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_scrollable.md +2 -0
  69. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_separators.jsx +119 -0
  70. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_separators.md +2 -0
  71. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_should_close_on_overlay.jsx +28 -0
  72. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_should_close_on_overlay.md +2 -0
  73. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_sizes.jsx +93 -0
  74. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +10 -0
  75. data/app/pb_kits/playbook/pb_dialog/docs/index.js +6 -0
  76. data/app/pb_kits/playbook/pb_form/_form.scss +5 -1
  77. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
  78. data/app/pb_kits/playbook/pb_form/form_builder.rb +4 -2
  79. data/app/pb_kits/playbook/pb_form/form_builder/action_area.rb +14 -7
  80. data/app/pb_kits/playbook/pb_form/form_with.rb +0 -1
  81. data/app/pb_kits/playbook/pb_form/simple_form.html.erb +2 -4
  82. data/app/pb_kits/playbook/pb_form/simple_form.rb +4 -0
  83. data/app/pb_kits/playbook/pb_online_status/_online_status.jsx +2 -0
  84. data/app/pb_kits/playbook/pb_online_status/online_status.html.erb +1 -1
  85. data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +1 -1
  86. data/app/pb_kits/playbook/plugins/pb_chart.js +1 -1
  87. data/app/pb_kits/playbook/react_rails_kits.js +4 -0
  88. data/app/pb_kits/playbook/tokens/_border_radius.scss +0 -10
  89. data/app/pb_kits/playbook/tokens/_colors.scss +0 -25
  90. data/app/pb_kits/playbook/tokens/_line_height.scss +0 -9
  91. data/app/pb_kits/playbook/tokens/_opacity.scss +0 -9
  92. data/app/pb_kits/playbook/tokens/_positioning.scss +0 -9
  93. data/app/pb_kits/playbook/tokens/_screen_sizes.scss +0 -9
  94. data/app/pb_kits/playbook/tokens/_shadows.scss +0 -9
  95. data/app/pb_kits/playbook/tokens/_spacing.scss +0 -10
  96. data/app/pb_kits/playbook/tokens/_typography.scss +0 -25
  97. data/app/pb_kits/playbook/tokens/exports/_border_radius.scss +10 -0
  98. data/app/pb_kits/playbook/tokens/exports/_colors.scss +26 -0
  99. data/app/pb_kits/playbook/tokens/exports/_line_height.scss +10 -0
  100. data/app/pb_kits/playbook/tokens/exports/_opacity.scss +10 -0
  101. data/app/pb_kits/playbook/tokens/exports/_positioning.scss +10 -0
  102. data/app/pb_kits/playbook/tokens/exports/_screen_sizes.scss +10 -0
  103. data/app/pb_kits/playbook/tokens/exports/_shadows.scss +10 -0
  104. data/app/pb_kits/playbook/tokens/exports/_spacing.scss +10 -0
  105. data/app/pb_kits/playbook/tokens/exports/_typography.scss +24 -0
  106. data/app/pb_kits/playbook/utilities/test-utils.js +6 -0
  107. data/dist/reset.css +1 -0
  108. data/lib/playbook/version.rb +2 -1
  109. metadata +56 -16
  110. data/app/pb_kits/playbook/pb_form/form_builder/action_area.html.erb +0 -3
@@ -2,3 +2,4 @@ export { default as CheckboxDefault } from './_checkbox_default.jsx'
2
2
  export { default as CheckboxCustom } from './_checkbox_custom.jsx'
3
3
  export { default as CheckboxError } from './_checkbox_error.jsx'
4
4
  export { default as CheckboxChecked } from './_checkbox_checked.jsx'
5
+ export { default as CheckboxIndeterminate } from './_checkbox_indeterminate.jsx'
@@ -0,0 +1,17 @@
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,5 +1,5 @@
1
- import colors from '../tokens/_colors.scss'
2
- import typography from '../tokens/_typography.scss'
1
+ import colors from '../tokens/exports/_colors.scss'
2
+ import typography from '../tokens/exports/_typography.scss'
3
3
 
4
4
  const dataColors = [
5
5
  colors.data_1,
@@ -1,5 +1,5 @@
1
- import colors from '../tokens/_colors.scss'
2
- import typography from '../tokens/_typography.scss'
1
+ import colors from '../tokens/exports/_colors.scss'
2
+ import typography from '../tokens/exports/_typography.scss'
3
3
 
4
4
  import Highcharts from 'highcharts'
5
5
 
@@ -0,0 +1,23 @@
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
+ }
@@ -0,0 +1,10 @@
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 %>
@@ -0,0 +1,142 @@
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
@@ -0,0 +1,133 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react'
2
+
3
+ export const DialogContext = React.createContext()
@@ -0,0 +1,21 @@
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
@@ -0,0 +1,36 @@
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
@@ -0,0 +1,68 @@
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