pallote-react 0.14.2 → 0.14.3
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.
- package/index.js +2 -73
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import {
|
|
5
|
-
import { X, CalendarBlank, Clock, CaretUpDown, ArrowSquareOut } from '@phosphor-icons/react';
|
|
4
|
+
import { CalendarBlank, Clock, CaretUpDown, ArrowSquareOut } from '@phosphor-icons/react';
|
|
6
5
|
import SyntaxHighlighter from 'react-syntax-highlighter';
|
|
7
6
|
|
|
8
7
|
const Color = ({
|
|
@@ -192,76 +191,6 @@ Text.propTypes = {
|
|
|
192
191
|
children: PropTypes.node
|
|
193
192
|
};
|
|
194
193
|
|
|
195
|
-
const Alert = ({
|
|
196
|
-
color = 'success',
|
|
197
|
-
variant = 'toast',
|
|
198
|
-
title,
|
|
199
|
-
subtitle,
|
|
200
|
-
dense,
|
|
201
|
-
noIcon,
|
|
202
|
-
show,
|
|
203
|
-
onClose,
|
|
204
|
-
className,
|
|
205
|
-
...props
|
|
206
|
-
}) => {
|
|
207
|
-
const [shouldRender, setRender] = useState(show);
|
|
208
|
-
const [container] = useState(() => {
|
|
209
|
-
let el = document.getElementById('alerts');
|
|
210
|
-
if (!el) {
|
|
211
|
-
el = document.createElement('div');
|
|
212
|
-
el.id = 'alerts';
|
|
213
|
-
document.body.appendChild(el);
|
|
214
|
-
}
|
|
215
|
-
return el;
|
|
216
|
-
});
|
|
217
|
-
useEffect(() => {
|
|
218
|
-
if (show) setRender(true);
|
|
219
|
-
}, [show]);
|
|
220
|
-
const onAnimationEnd = () => {
|
|
221
|
-
if (!show) setRender(false);
|
|
222
|
-
};
|
|
223
|
-
let alert = /*#__PURE__*/React.createElement("div", _extends({
|
|
224
|
-
className: classnames(['alert', {
|
|
225
|
-
[`alert-${color}`]: color,
|
|
226
|
-
[`alert-${variant}`]: variant,
|
|
227
|
-
'alert-slideIn': show,
|
|
228
|
-
'alert-slideOut': !show,
|
|
229
|
-
'alert-dense': dense,
|
|
230
|
-
'alert-noIcon': noIcon
|
|
231
|
-
}, className]),
|
|
232
|
-
onAnimationEnd: onAnimationEnd
|
|
233
|
-
}, props), /*#__PURE__*/React.createElement("div", {
|
|
234
|
-
className: classnames('alert_content')
|
|
235
|
-
}, title ? /*#__PURE__*/React.createElement(Text, {
|
|
236
|
-
className: classnames('alert_title'),
|
|
237
|
-
variant: dense ? 'caption' : 'body',
|
|
238
|
-
weight: "bold"
|
|
239
|
-
}, title) : null, subtitle ? /*#__PURE__*/React.createElement(Text, {
|
|
240
|
-
variant: dense ? 'overline' : 'caption',
|
|
241
|
-
className: classnames('alert_subtitle')
|
|
242
|
-
}, subtitle) : null), onClose ? /*#__PURE__*/React.createElement(X, {
|
|
243
|
-
className: classnames('alert_close'),
|
|
244
|
-
onClick: onClose,
|
|
245
|
-
size: dense ? 14 : 16
|
|
246
|
-
}) : null);
|
|
247
|
-
if (variant === 'notice') {
|
|
248
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, alert);
|
|
249
|
-
} else {
|
|
250
|
-
return /*#__PURE__*/createPortal(shouldRender && alert, container);
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
Alert.propTypes = {
|
|
254
|
-
color: PropTypes.oneOf(['success', 'info', 'warning', 'error']),
|
|
255
|
-
variant: PropTypes.oneOf(['bar', 'toast', 'notice']),
|
|
256
|
-
title: PropTypes.string.isRequired,
|
|
257
|
-
subtitle: PropTypes.string,
|
|
258
|
-
dense: PropTypes.bool,
|
|
259
|
-
noIcon: PropTypes.bool,
|
|
260
|
-
show: PropTypes.bool,
|
|
261
|
-
onClose: PropTypes.func,
|
|
262
|
-
className: PropTypes.node
|
|
263
|
-
};
|
|
264
|
-
|
|
265
194
|
const Breadcrumbs = ({
|
|
266
195
|
items,
|
|
267
196
|
separator = "slash",
|
|
@@ -1393,4 +1322,4 @@ Textarea.propTypes = {
|
|
|
1393
1322
|
className: PropTypes.node
|
|
1394
1323
|
};
|
|
1395
1324
|
|
|
1396
|
-
export {
|
|
1325
|
+
export { Breadcrumbs, Button, Buttons, Card, CardActions, CardContent, CardHeader, CardMedia, Checkbox, Checkboxes, Color, Display, Divider, Grid, Input, InputLabel, Link, List, ListItem, Nav, NavBar, NavItem, Radio, RadioButtons, Section, SectionContent, SectionHeader, Select, Snippet, Status, Switch, Tag, Text, Textarea };
|