pallote-react 0.14.1 → 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 +3 -75
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -1,9 +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';
|
|
6
|
-
import { Link as Link$1 } from 'react-router-dom';
|
|
4
|
+
import { CalendarBlank, Clock, CaretUpDown, ArrowSquareOut } from '@phosphor-icons/react';
|
|
7
5
|
import SyntaxHighlighter from 'react-syntax-highlighter';
|
|
8
6
|
|
|
9
7
|
const Color = ({
|
|
@@ -193,76 +191,6 @@ Text.propTypes = {
|
|
|
193
191
|
children: PropTypes.node
|
|
194
192
|
};
|
|
195
193
|
|
|
196
|
-
const Alert = ({
|
|
197
|
-
color = 'success',
|
|
198
|
-
variant = 'toast',
|
|
199
|
-
title,
|
|
200
|
-
subtitle,
|
|
201
|
-
dense,
|
|
202
|
-
noIcon,
|
|
203
|
-
show,
|
|
204
|
-
onClose,
|
|
205
|
-
className,
|
|
206
|
-
...props
|
|
207
|
-
}) => {
|
|
208
|
-
const [shouldRender, setRender] = useState(show);
|
|
209
|
-
const [container] = useState(() => {
|
|
210
|
-
let el = document.getElementById('alerts');
|
|
211
|
-
if (!el) {
|
|
212
|
-
el = document.createElement('div');
|
|
213
|
-
el.id = 'alerts';
|
|
214
|
-
document.body.appendChild(el);
|
|
215
|
-
}
|
|
216
|
-
return el;
|
|
217
|
-
});
|
|
218
|
-
useEffect(() => {
|
|
219
|
-
if (show) setRender(true);
|
|
220
|
-
}, [show]);
|
|
221
|
-
const onAnimationEnd = () => {
|
|
222
|
-
if (!show) setRender(false);
|
|
223
|
-
};
|
|
224
|
-
let alert = /*#__PURE__*/React.createElement("div", _extends({
|
|
225
|
-
className: classnames(['alert', {
|
|
226
|
-
[`alert-${color}`]: color,
|
|
227
|
-
[`alert-${variant}`]: variant,
|
|
228
|
-
'alert-slideIn': show,
|
|
229
|
-
'alert-slideOut': !show,
|
|
230
|
-
'alert-dense': dense,
|
|
231
|
-
'alert-noIcon': noIcon
|
|
232
|
-
}, className]),
|
|
233
|
-
onAnimationEnd: onAnimationEnd
|
|
234
|
-
}, props), /*#__PURE__*/React.createElement("div", {
|
|
235
|
-
className: classnames('alert_content')
|
|
236
|
-
}, title ? /*#__PURE__*/React.createElement(Text, {
|
|
237
|
-
className: classnames('alert_title'),
|
|
238
|
-
variant: dense ? 'caption' : 'body',
|
|
239
|
-
weight: "bold"
|
|
240
|
-
}, title) : null, subtitle ? /*#__PURE__*/React.createElement(Text, {
|
|
241
|
-
variant: dense ? 'overline' : 'caption',
|
|
242
|
-
className: classnames('alert_subtitle')
|
|
243
|
-
}, subtitle) : null), onClose ? /*#__PURE__*/React.createElement(X, {
|
|
244
|
-
className: classnames('alert_close'),
|
|
245
|
-
onClick: onClose,
|
|
246
|
-
size: dense ? 14 : 16
|
|
247
|
-
}) : null);
|
|
248
|
-
if (variant === 'notice') {
|
|
249
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, alert);
|
|
250
|
-
} else {
|
|
251
|
-
return /*#__PURE__*/createPortal(shouldRender && alert, container);
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
Alert.propTypes = {
|
|
255
|
-
color: PropTypes.oneOf(['success', 'info', 'warning', 'error']),
|
|
256
|
-
variant: PropTypes.oneOf(['bar', 'toast', 'notice']),
|
|
257
|
-
title: PropTypes.string.isRequired,
|
|
258
|
-
subtitle: PropTypes.string,
|
|
259
|
-
dense: PropTypes.bool,
|
|
260
|
-
noIcon: PropTypes.bool,
|
|
261
|
-
show: PropTypes.bool,
|
|
262
|
-
onClose: PropTypes.func,
|
|
263
|
-
className: PropTypes.node
|
|
264
|
-
};
|
|
265
|
-
|
|
266
194
|
const Breadcrumbs = ({
|
|
267
195
|
items,
|
|
268
196
|
separator = "slash",
|
|
@@ -916,7 +844,7 @@ const NavItem = ({
|
|
|
916
844
|
if (dropdown) {
|
|
917
845
|
Component = 'button';
|
|
918
846
|
} else {
|
|
919
|
-
Component = component ||
|
|
847
|
+
Component = component || "a";
|
|
920
848
|
}
|
|
921
849
|
return /*#__PURE__*/React.createElement("div", {
|
|
922
850
|
className: classnames(['nav_item', {
|
|
@@ -1394,4 +1322,4 @@ Textarea.propTypes = {
|
|
|
1394
1322
|
className: PropTypes.node
|
|
1395
1323
|
};
|
|
1396
1324
|
|
|
1397
|
-
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 };
|