1 | import { getUniqueId } from './uniqueId.js';
|
2 | import { string, node, shape, oneOfType, element, bool, func } from 'prop-types';
|
3 | import { a as _objectSpread, c as _objectWithoutPropertiesLoose, g as _extends } from './chunk-1f79df9b.js';
|
4 | import Box from 'reakit/Box';
|
5 | import 'reakit/Block';
|
6 | import 'reakit/Inline';
|
7 | import 'reakit/InlineBlock';
|
8 | import Flex from 'reakit/Flex';
|
9 | import 'reakit/InlineFlex';
|
10 | import 'reakit/Grid';
|
11 | import { createElement } from 'react';
|
12 | import { cardCardPropTypes, cardCardDefaultProps } from './Card/CardCard.js';
|
13 | import _Callout, { CalloutTitle, CalloutIcon, CalloutHeader, CalloutContent, CalloutFooter } from './Callout/styled.js';
|
14 | import CalloutClose, { calloutClosePropTypes } from './Callout/CalloutClose.js';
|
15 |
|
16 | var Callout = function Callout(_ref) {
|
17 | var a11yDescriptionId = _ref.a11yDescriptionId,
|
18 | a11yTitleId = _ref.a11yTitleId,
|
19 | children = _ref.children,
|
20 | closeButtonProps = _ref.closeButtonProps,
|
21 | footer = _ref.footer,
|
22 | hasTint = _ref.hasTint,
|
23 | icon = _ref.icon,
|
24 | onClickClose = _ref.onClickClose,
|
25 | showCloseButton = _ref.showCloseButton,
|
26 | title = _ref.title,
|
27 | type = _ref.type,
|
28 | props = _objectWithoutPropertiesLoose(_ref, ["a11yDescriptionId", "a11yTitleId", "children", "closeButtonProps", "footer", "hasTint", "icon", "onClickClose", "showCloseButton", "title", "type"]);
|
29 |
|
30 | return createElement(_Callout, _extends({
|
31 | a11yDescriptionId: a11yDescriptionId,
|
32 | a11yTitleId: a11yTitleId,
|
33 | hasTint: hasTint,
|
34 | type: type
|
35 | }, props), createElement(Flex, null, (type || icon) && createElement(CalloutTitle, null, createElement(CalloutIcon, {
|
36 | icon: type || icon,
|
37 | color: type
|
38 | })), createElement(Box, null, title && createElement(CalloutHeader, null, typeof title === 'string' ? createElement(CalloutTitle, {
|
39 | id: a11yTitleId
|
40 | }, title) : title), createElement(CalloutContent, {
|
41 | id: a11yDescriptionId
|
42 | }, children), footer && createElement(CalloutFooter, null, footer))), showCloseButton && createElement(CalloutClose, _extends({
|
43 | onClickClose: onClickClose
|
44 | }, closeButtonProps)));
|
45 | };
|
46 | var calloutPropTypes = _objectSpread({
|
47 | a11yDescriptionId: string,
|
48 | a11yTitleId: string,
|
49 | children: node.isRequired,
|
50 | className: string,
|
51 | closeButtonProps: shape(calloutClosePropTypes),
|
52 | footer: oneOfType([string, element]),
|
53 | hasTint: bool,
|
54 | icon: string,
|
55 | onClickClose: func,
|
56 | showCloseButton: bool,
|
57 | title: oneOfType([string, element]),
|
58 | type: string
|
59 | }, cardCardPropTypes);
|
60 | Callout.propTypes = calloutPropTypes;
|
61 | var calloutDefaultProps = _objectSpread({}, cardCardDefaultProps, {
|
62 | a11yDescriptionId: getUniqueId('Callout'),
|
63 | a11yTitleId: getUniqueId('Callout'),
|
64 | children: undefined,
|
65 | className: undefined,
|
66 | closeButtonProps: {},
|
67 | footer: undefined,
|
68 | hasTint: false,
|
69 | icon: undefined,
|
70 | onClickClose: undefined,
|
71 | showCloseButton: false,
|
72 | title: undefined,
|
73 | type: undefined
|
74 | });
|
75 | Callout.defaultProps = calloutDefaultProps;
|
76 |
|
77 | var C = Callout;
|
78 |
|
79 | export { C as a, calloutPropTypes as b, calloutDefaultProps as c };
|