@papillonbits/components 1.13.1 → 1.14.0
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/build/index.js +1 -12
- package/build/primer/Alert/Alert.js +82 -94
- package/build/primer/Alert/Alert.prop.js +19 -25
- package/build/primer/Alert/index.js +2 -19
- package/build/primer/Blankslate/Blankslate.js +22 -26
- package/build/primer/Blankslate/Blankslate.prop.js +11 -17
- package/build/primer/Blankslate/index.js +2 -19
- package/build/primer/Breadcrumb/Breadcrumb.js +59 -61
- package/build/primer/Breadcrumb/Breadcrumb.prop.js +14 -20
- package/build/primer/Breadcrumb/index.js +2 -19
- package/build/primer/Button/Button.js +63 -72
- package/build/primer/Button/Button.prop.js +27 -33
- package/build/primer/Button/index.js +2 -49
- package/build/primer/Dropdown/Dropdown.js +79 -85
- package/build/primer/Dropdown/Dropdown.prop.js +15 -21
- package/build/primer/Dropdown/index.js +2 -19
- package/build/primer/ErrorBoundary/ErrorBoundary.js +35 -55
- package/build/primer/ErrorBoundary/ErrorBoundary.prop.js +4 -10
- package/build/primer/ErrorBoundary/index.js +1 -12
- package/build/primer/Form/Checkbox/Checkbox.js +29 -39
- package/build/primer/Form/Checkbox/Checkbox.prop.js +15 -21
- package/build/primer/Form/Checkbox/index.js +2 -19
- package/build/primer/Form/Input/Input.js +29 -43
- package/build/primer/Form/Input/Input.prop.js +19 -25
- package/build/primer/Form/Input/index.js +2 -25
- package/build/primer/Form/Radio/Radio.js +26 -38
- package/build/primer/Form/Radio/Radio.prop.js +14 -20
- package/build/primer/Form/Radio/index.js +2 -19
- package/build/primer/Form/index.js +11 -17
- package/build/primer/Grid/DisplayTable/DisplayTable.js +44 -54
- package/build/primer/Grid/DisplayTable/DisplayTable.prop.js +7 -13
- package/build/primer/Grid/DisplayTable/index.js +1 -12
- package/build/primer/Grid/FlexGrid/FlexGrid.js +186 -207
- package/build/primer/Grid/FlexGrid/FlexGrid.prop.js +24 -30
- package/build/primer/Grid/FlexGrid/index.js +2 -25
- package/build/primer/Grid/index.js +7 -13
- package/build/primer/Icon/Icon.js +35 -52
- package/build/primer/Icon/Icon.part.js +1287 -1294
- package/build/primer/Icon/Icon.prop.js +20 -26
- package/build/primer/Icon/index.js +2 -25
- package/build/primer/Label/Label.js +22 -28
- package/build/primer/Label/Label.prop.js +11 -17
- package/build/primer/Label/index.js +1 -12
- package/build/primer/Loader/Loader.js +38 -45
- package/build/primer/Loader/Loader.prop.js +7 -13
- package/build/primer/Loader/index.js +2 -19
- package/build/primer/Navigation/Menu/Menu.js +52 -59
- package/build/primer/Navigation/Menu/Menu.prop.js +16 -22
- package/build/primer/Navigation/Menu/index.js +1 -12
- package/build/primer/Navigation/TabNav/TabNav.js +89 -94
- package/build/primer/Navigation/TabNav/TabNav.prop.js +19 -25
- package/build/primer/Navigation/TabNav/index.js +2 -19
- package/build/primer/Navigation/UnderlineNav/UnderlineNav.js +82 -86
- package/build/primer/Navigation/UnderlineNav/UnderlineNav.prop.js +21 -27
- package/build/primer/Navigation/UnderlineNav/index.js +2 -25
- package/build/primer/Navigation/index.js +10 -16
- package/build/primer/Pagination/PreviousNext/PreviousNext.js +53 -54
- package/build/primer/Pagination/PreviousNext/PreviousNext.prop.js +22 -28
- package/build/primer/Pagination/PreviousNext/index.js +2 -19
- package/build/primer/Pagination/index.js +4 -10
- package/build/primer/Popover/Popover.js +59 -50
- package/build/primer/Popover/Popover.prop.js +16 -22
- package/build/primer/Popover/index.js +2 -25
- package/build/primer/Progress/Progress.js +20 -26
- package/build/primer/Progress/Progress.prop.js +7 -13
- package/build/primer/Progress/index.js +2 -19
- package/build/primer/Select/Select.js +43 -51
- package/build/primer/Select/Select.prop.js +12 -18
- package/build/primer/Select/index.js +2 -19
- package/build/primer/SelectMenu/SelectMenu.js +65 -74
- package/build/primer/SelectMenu/SelectMenu.prop.js +14 -20
- package/build/primer/SelectMenu/index.js +1 -12
- package/build/primer/Subhead/Subhead.js +16 -23
- package/build/primer/Subhead/Subhead.prop.js +6 -12
- package/build/primer/Subhead/index.js +1 -12
- package/build/primer/Toast/Toast.js +39 -46
- package/build/primer/Toast/Toast.prop.js +10 -16
- package/build/primer/Toast/index.js +2 -19
- package/build/primer/index.js +58 -64
- package/package.json +4 -4
|
@@ -1,66 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
onChange = _ref.onChange,
|
|
24
|
-
_ref$state = _ref.state,
|
|
25
|
-
state = _ref$state === void 0 ? _Select.defaultProps.state : _ref$state;
|
|
26
|
-
var indexItems = (0, _array.getIndexItems)(items);
|
|
27
|
-
var handleOnChange = function handleOnChange(event) {
|
|
28
|
-
var indexItem = indexItems.find(function (item) {
|
|
29
|
-
return item.text === event.target.value;
|
|
30
|
-
});
|
|
31
|
-
var newIndexItems = (0, _array.getIndexItemsWithSelected)(indexItems, indexItem);
|
|
1
|
+
import "core-js/modules/es.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/es.iterator.find.js";
|
|
3
|
+
import "core-js/modules/es.iterator.map.js";
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
import { v1 as uuidv1 } from 'uuid';
|
|
6
|
+
import layoutStyles from '@papillonbits/css/build/primer/utilities/layout.scss';
|
|
7
|
+
import { getIndexItems, getIndexItemsWithSelected } from '@papillonbits/library/array';
|
|
8
|
+
import { propTypes, defaultProps, selectState } from './Select.prop';
|
|
9
|
+
import styles from './Select.scss';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
export function Select({
|
|
12
|
+
id = defaultProps.id,
|
|
13
|
+
className = defaultProps.className,
|
|
14
|
+
selectedText,
|
|
15
|
+
items,
|
|
16
|
+
onChange,
|
|
17
|
+
state = defaultProps.state
|
|
18
|
+
}) {
|
|
19
|
+
const indexItems = getIndexItems(items);
|
|
20
|
+
const handleOnChange = event => {
|
|
21
|
+
const indexItem = indexItems.find(item => item.text === event.target.value);
|
|
22
|
+
const newIndexItems = getIndexItemsWithSelected(indexItems, indexItem);
|
|
32
23
|
onChange({
|
|
33
24
|
selectedText: indexItem.text,
|
|
34
|
-
items: newIndexItems.map(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
}(newIndexItem);
|
|
43
|
-
})
|
|
25
|
+
items: newIndexItems.map(newIndexItem => (({
|
|
26
|
+
text: newIndexItemText,
|
|
27
|
+
isSelected: newIndexItemIsSelected
|
|
28
|
+
}) => ({
|
|
29
|
+
text: newIndexItemText,
|
|
30
|
+
isSelected: newIndexItemIsSelected
|
|
31
|
+
}))(newIndexItem))
|
|
44
32
|
});
|
|
45
33
|
};
|
|
46
|
-
return /*#__PURE__*/(
|
|
47
|
-
className: (
|
|
48
|
-
children: /*#__PURE__*/(
|
|
34
|
+
return /*#__PURE__*/_jsx("div", {
|
|
35
|
+
className: cx(className, styles.select),
|
|
36
|
+
children: /*#__PURE__*/_jsx("select", {
|
|
49
37
|
id: id,
|
|
50
38
|
readOnly: false,
|
|
51
39
|
onChange: handleOnChange,
|
|
52
|
-
className: (
|
|
40
|
+
className: cx(styles['select-menu'], layoutStyles['width-full'], {
|
|
41
|
+
[styles['select-inactive']]: state === selectState.inactive
|
|
42
|
+
}),
|
|
53
43
|
value: selectedText,
|
|
54
|
-
children: items && indexItems.map(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
children: items && indexItems.map(indexItem => {
|
|
45
|
+
const {
|
|
46
|
+
text,
|
|
47
|
+
isSelected
|
|
48
|
+
} = indexItem;
|
|
49
|
+
return /*#__PURE__*/_jsx("option", {
|
|
58
50
|
value: text,
|
|
59
51
|
selected: isSelected,
|
|
60
52
|
children: text
|
|
61
|
-
}, (
|
|
53
|
+
}, uuidv1());
|
|
62
54
|
})
|
|
63
55
|
})
|
|
64
56
|
});
|
|
65
57
|
}
|
|
66
|
-
Select.propTypes =
|
|
58
|
+
Select.propTypes = propTypes;
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.selectState = exports.propTypes = exports.defaultProps = void 0;
|
|
7
|
-
var _propTypes = require("prop-types");
|
|
8
|
-
var selectState = exports.selectState = {
|
|
1
|
+
import { string, arrayOf, oneOf, shape, bool, func } from 'prop-types';
|
|
2
|
+
export const selectState = {
|
|
9
3
|
active: 'active',
|
|
10
4
|
inactive: 'inactive'
|
|
11
5
|
};
|
|
12
|
-
|
|
13
|
-
id:
|
|
14
|
-
className:
|
|
15
|
-
selectedText:
|
|
16
|
-
items:
|
|
17
|
-
text:
|
|
18
|
-
isSelected:
|
|
6
|
+
export const propTypes = {
|
|
7
|
+
id: string,
|
|
8
|
+
className: string,
|
|
9
|
+
selectedText: string.isRequired,
|
|
10
|
+
items: arrayOf(shape({
|
|
11
|
+
text: string,
|
|
12
|
+
isSelected: bool
|
|
19
13
|
})).isRequired,
|
|
20
|
-
onChange:
|
|
21
|
-
state:
|
|
14
|
+
onChange: func.isRequired,
|
|
15
|
+
state: oneOf(Object.keys(selectState))
|
|
22
16
|
};
|
|
23
|
-
|
|
17
|
+
export const defaultProps = {
|
|
24
18
|
id: null,
|
|
25
19
|
className: null,
|
|
26
20
|
state: selectState.active
|
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Select", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Select.Select;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "selectState", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _Select2.selectState;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _Select = require("./Select");
|
|
19
|
-
var _Select2 = require("./Select.prop");
|
|
1
|
+
export { Select } from './Select';
|
|
2
|
+
export { selectState } from './Select.prop';
|
|
@@ -1,95 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
_onClick = _ref.onClick;
|
|
30
|
-
var _useState = (0, _hooks.useState)((0, _array.getIndexItems)(items)),
|
|
31
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
32
|
-
indexItems = _useState2[0],
|
|
33
|
-
setIndexItems = _useState2[1];
|
|
34
|
-
var haspopup = ariaAttr.haspopup;
|
|
35
|
-
var details = (0, _hooks.useRef)(null);
|
|
36
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("details", {
|
|
1
|
+
import "core-js/modules/es.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/es.iterator.map.js";
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import { v1 as uuidv1 } from 'uuid';
|
|
5
|
+
import { getIndexItems, getIndexItemsWithSelected } from '@papillonbits/library/array';
|
|
6
|
+
import { useRef, useState } from '@papillonbits/library/hooks';
|
|
7
|
+
import utilityStyles from '@papillonbits/css/build/primer/utilities/margin.scss';
|
|
8
|
+
import detailsStyles from '@papillonbits/css/build/primer/utilities/details.scss';
|
|
9
|
+
import { propTypes, defaultProps } from './SelectMenu.prop';
|
|
10
|
+
import styles from './SelectMenu.scss';
|
|
11
|
+
import buttonStyles from '../Button/Button.scss';
|
|
12
|
+
import { Icon, iconSize } from '../Icon';
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
export function SelectMenu({
|
|
15
|
+
className = defaultProps.className,
|
|
16
|
+
summary,
|
|
17
|
+
icon,
|
|
18
|
+
title = defaultProps.title,
|
|
19
|
+
ariaAttr,
|
|
20
|
+
items,
|
|
21
|
+
onClick
|
|
22
|
+
}) {
|
|
23
|
+
const [indexItems, setIndexItems] = useState(getIndexItems(items));
|
|
24
|
+
const {
|
|
25
|
+
haspopup
|
|
26
|
+
} = ariaAttr;
|
|
27
|
+
const details = useRef(null);
|
|
28
|
+
return /*#__PURE__*/_jsxs("details", {
|
|
37
29
|
ref: details,
|
|
38
|
-
className: (
|
|
39
|
-
children: [/*#__PURE__*/(
|
|
40
|
-
className: (
|
|
30
|
+
className: cx(className, detailsStyles['details-reset'], detailsStyles['details-overlay']),
|
|
31
|
+
children: [/*#__PURE__*/_jsxs("summary", {
|
|
32
|
+
className: cx(buttonStyles.btn, buttonStyles['btn-outline']),
|
|
41
33
|
"aria-haspopup": haspopup,
|
|
42
|
-
children: [summary, " ", /*#__PURE__*/(
|
|
43
|
-
className: (
|
|
34
|
+
children: [summary, " ", /*#__PURE__*/_jsx(Icon, {
|
|
35
|
+
className: cx(utilityStyles['ml-2']),
|
|
44
36
|
icon: icon,
|
|
45
|
-
size:
|
|
37
|
+
size: iconSize.small
|
|
46
38
|
})]
|
|
47
|
-
}), /*#__PURE__*/(
|
|
48
|
-
className:
|
|
49
|
-
children: /*#__PURE__*/(
|
|
50
|
-
className:
|
|
51
|
-
children: [title && /*#__PURE__*/(
|
|
52
|
-
className:
|
|
53
|
-
children: [/*#__PURE__*/(
|
|
54
|
-
className:
|
|
39
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
40
|
+
className: styles.SelectMenu,
|
|
41
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
42
|
+
className: styles['SelectMenu-modal'],
|
|
43
|
+
children: [title && /*#__PURE__*/_jsxs("header", {
|
|
44
|
+
className: styles['SelectMenu-header'],
|
|
45
|
+
children: [/*#__PURE__*/_jsx("h3", {
|
|
46
|
+
className: styles['SelectMenu-title'],
|
|
55
47
|
children: title
|
|
56
|
-
}), /*#__PURE__*/(
|
|
57
|
-
className:
|
|
48
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
49
|
+
className: styles['SelectMenu-closeButton'],
|
|
58
50
|
type: "button"
|
|
59
51
|
})]
|
|
60
|
-
}), /*#__PURE__*/(
|
|
61
|
-
className:
|
|
62
|
-
children: indexItems.map(
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
53
|
+
className: styles['SelectMenu-list'],
|
|
54
|
+
children: indexItems.map(indexItem => {
|
|
55
|
+
const {
|
|
56
|
+
text
|
|
57
|
+
} = indexItem;
|
|
58
|
+
return /*#__PURE__*/_jsx("button", {
|
|
65
59
|
type: "button",
|
|
66
|
-
onClick:
|
|
60
|
+
onClick: e => {
|
|
67
61
|
e.preventDefault();
|
|
68
|
-
|
|
62
|
+
const newIndexItems = getIndexItemsWithSelected(indexItems, indexItem);
|
|
69
63
|
setIndexItems(newIndexItems);
|
|
70
|
-
|
|
71
|
-
ariaAttr
|
|
72
|
-
items: newIndexItems.map(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
};
|
|
80
|
-
}(newIndexItem);
|
|
81
|
-
}) // eslint-disable-line
|
|
64
|
+
onClick({
|
|
65
|
+
ariaAttr,
|
|
66
|
+
items: newIndexItems.map(newIndexItem => (({
|
|
67
|
+
text,
|
|
68
|
+
isSelected
|
|
69
|
+
}) => ({
|
|
70
|
+
text,
|
|
71
|
+
isSelected
|
|
72
|
+
}))(newIndexItem)) // eslint-disable-line
|
|
82
73
|
});
|
|
83
74
|
details.current.removeAttribute('open');
|
|
84
75
|
},
|
|
85
|
-
className:
|
|
76
|
+
className: styles['SelectMenu-item'],
|
|
86
77
|
role: "menuitem",
|
|
87
78
|
children: text
|
|
88
|
-
}, (
|
|
79
|
+
}, uuidv1());
|
|
89
80
|
})
|
|
90
81
|
})]
|
|
91
82
|
})
|
|
92
83
|
})]
|
|
93
84
|
});
|
|
94
85
|
}
|
|
95
|
-
SelectMenu.propTypes =
|
|
86
|
+
SelectMenu.propTypes = propTypes;
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
className: _propTypes.string,
|
|
11
|
-
summary: _propTypes.string.isRequired,
|
|
12
|
-
icon: (0, _propTypes.oneOf)(Object.keys(_Icon.iconName)),
|
|
13
|
-
title: _propTypes.string,
|
|
14
|
-
ariaAttr: (0, _propTypes.shape)({
|
|
15
|
-
haspopup: _propTypes.bool
|
|
1
|
+
import { string, oneOf, shape, bool, arrayOf, func } from 'prop-types';
|
|
2
|
+
import { iconName } from '../Icon/Icon.prop';
|
|
3
|
+
export const propTypes = {
|
|
4
|
+
className: string,
|
|
5
|
+
summary: string.isRequired,
|
|
6
|
+
icon: oneOf(Object.keys(iconName)),
|
|
7
|
+
title: string,
|
|
8
|
+
ariaAttr: shape({
|
|
9
|
+
haspopup: bool
|
|
16
10
|
}).isRequired,
|
|
17
|
-
items:
|
|
18
|
-
text:
|
|
19
|
-
isSelected:
|
|
11
|
+
items: arrayOf(shape({
|
|
12
|
+
text: string,
|
|
13
|
+
isSelected: bool
|
|
20
14
|
})).isRequired,
|
|
21
|
-
onClick:
|
|
15
|
+
onClick: func.isRequired
|
|
22
16
|
};
|
|
23
|
-
|
|
17
|
+
export const defaultProps = {
|
|
24
18
|
className: null,
|
|
25
19
|
title: null
|
|
26
20
|
};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "SelectMenu", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _SelectMenu.SelectMenu;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _SelectMenu = require("./SelectMenu");
|
|
1
|
+
export { SelectMenu } from './SelectMenu';
|
|
@@ -1,27 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
heading = _ref.heading,
|
|
17
|
-
_ref$isSpacious = _ref.isSpacious,
|
|
18
|
-
isSpacious = _ref$isSpacious === void 0 ? _Subhead.defaultProps.isSpacious : _ref$isSpacious;
|
|
19
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
20
|
-
className: (0, _classnames["default"])(className, _Subhead2["default"].Subhead, (0, _defineProperty2["default"])({}, _Subhead2["default"]['Subhead--spacious'], isSpacious === true)),
|
|
21
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22
|
-
className: _Subhead2["default"]['Subhead-heading'],
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import { propTypes, defaultProps } from './Subhead.prop';
|
|
3
|
+
import styles from './Subhead.scss';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
export function Subhead({
|
|
6
|
+
className = defaultProps.className,
|
|
7
|
+
heading,
|
|
8
|
+
isSpacious = defaultProps.isSpacious
|
|
9
|
+
}) {
|
|
10
|
+
return /*#__PURE__*/_jsx("div", {
|
|
11
|
+
className: cx(className, styles.Subhead, {
|
|
12
|
+
[styles['Subhead--spacious']]: isSpacious === true
|
|
13
|
+
}),
|
|
14
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
15
|
+
className: styles['Subhead-heading'],
|
|
23
16
|
children: heading
|
|
24
17
|
})
|
|
25
18
|
});
|
|
26
19
|
}
|
|
27
|
-
Subhead.propTypes =
|
|
20
|
+
Subhead.propTypes = propTypes;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.propTypes = exports.defaultProps = void 0;
|
|
7
|
-
var _propTypes = require("prop-types");
|
|
8
|
-
var propTypes = exports.propTypes = {
|
|
9
|
-
className: _propTypes.string,
|
|
10
|
-
heading: _propTypes.string.isRequired,
|
|
11
|
-
isSpacious: _propTypes.bool
|
|
1
|
+
import { string, bool } from 'prop-types';
|
|
2
|
+
export const propTypes = {
|
|
3
|
+
className: string,
|
|
4
|
+
heading: string.isRequired,
|
|
5
|
+
isSpacious: bool
|
|
12
6
|
};
|
|
13
|
-
|
|
7
|
+
export const defaultProps = {
|
|
14
8
|
className: null,
|
|
15
9
|
isSpacious: false
|
|
16
10
|
};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Subhead", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Subhead.Subhead;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _Subhead = require("./Subhead");
|
|
1
|
+
export { Subhead } from './Subhead';
|
|
@@ -1,55 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
icon: _Icon.iconName.Info16
|
|
33
|
-
}), variant === _Toast.toastVariant.success && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
|
|
34
|
-
icon: _Icon.iconName.Check16
|
|
35
|
-
}), variant === _Toast.toastVariant.warning && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
|
|
36
|
-
icon: _Icon.iconName.Alert16
|
|
37
|
-
}), variant === _Toast.toastVariant.error && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
|
|
38
|
-
icon: _Icon.iconName.Stop16
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import paddingStyles from '@papillonbits/css/build/primer/utilities/padding.scss';
|
|
3
|
+
import { propTypes, defaultProps, toastVariant } from './Toast.prop';
|
|
4
|
+
import styles from './Toast.scss';
|
|
5
|
+
import { Icon, iconName, iconSize } from '../Icon';
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
export function Toast({
|
|
8
|
+
className = defaultProps.className,
|
|
9
|
+
variant = defaultProps.variant,
|
|
10
|
+
text,
|
|
11
|
+
isDismissable = defaultProps.isDismissable,
|
|
12
|
+
onClick = defaultProps.onClick
|
|
13
|
+
}) {
|
|
14
|
+
return /*#__PURE__*/_jsx("div", {
|
|
15
|
+
className: cx(className, paddingStyles['p-1']),
|
|
16
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
17
|
+
className: cx(styles.Toast, {
|
|
18
|
+
[styles['Toast--success']]: variant === toastVariant.success,
|
|
19
|
+
[styles['Toast--warning']]: variant === toastVariant.warning,
|
|
20
|
+
[styles['Toast--error']]: variant === toastVariant.error
|
|
21
|
+
}),
|
|
22
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
23
|
+
className: styles['Toast-icon'],
|
|
24
|
+
children: [variant === toastVariant.info && /*#__PURE__*/_jsx(Icon, {
|
|
25
|
+
icon: iconName.Info16
|
|
26
|
+
}), variant === toastVariant.success && /*#__PURE__*/_jsx(Icon, {
|
|
27
|
+
icon: iconName.Check16
|
|
28
|
+
}), variant === toastVariant.warning && /*#__PURE__*/_jsx(Icon, {
|
|
29
|
+
icon: iconName.Alert16
|
|
30
|
+
}), variant === toastVariant.error && /*#__PURE__*/_jsx(Icon, {
|
|
31
|
+
icon: iconName.Stop16
|
|
39
32
|
})]
|
|
40
|
-
}), /*#__PURE__*/(
|
|
41
|
-
className:
|
|
33
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
34
|
+
className: styles['Toast-content'],
|
|
42
35
|
children: text
|
|
43
|
-
}), isDismissable && /*#__PURE__*/(
|
|
36
|
+
}), isDismissable && /*#__PURE__*/_jsx("button", {
|
|
44
37
|
type: "button",
|
|
45
|
-
className:
|
|
38
|
+
className: styles['Toast-dismissButton'],
|
|
46
39
|
onClick: onClick,
|
|
47
|
-
children: /*#__PURE__*/(
|
|
48
|
-
icon:
|
|
49
|
-
size:
|
|
40
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
41
|
+
icon: iconName.X16,
|
|
42
|
+
size: iconSize.small
|
|
50
43
|
})
|
|
51
44
|
})]
|
|
52
45
|
})
|
|
53
46
|
});
|
|
54
47
|
}
|
|
55
|
-
Toast.propTypes =
|
|
48
|
+
Toast.propTypes = propTypes;
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.toastVariant = exports.propTypes = exports.defaultProps = void 0;
|
|
7
|
-
var _propTypes = require("prop-types");
|
|
8
|
-
var toastVariant = exports.toastVariant = {
|
|
1
|
+
import { string, oneOf, bool, func } from 'prop-types';
|
|
2
|
+
export const toastVariant = {
|
|
9
3
|
info: 'info',
|
|
10
4
|
success: 'success',
|
|
11
5
|
warning: 'warning',
|
|
12
6
|
error: 'error'
|
|
13
7
|
};
|
|
14
|
-
|
|
15
|
-
className:
|
|
16
|
-
variant:
|
|
17
|
-
text:
|
|
18
|
-
isDismissable:
|
|
19
|
-
onClick:
|
|
8
|
+
export const propTypes = {
|
|
9
|
+
className: string,
|
|
10
|
+
variant: oneOf(Object.keys(toastVariant)),
|
|
11
|
+
text: string.isRequired,
|
|
12
|
+
isDismissable: bool,
|
|
13
|
+
onClick: func
|
|
20
14
|
};
|
|
21
|
-
|
|
15
|
+
export const defaultProps = {
|
|
22
16
|
className: null,
|
|
23
17
|
variant: toastVariant.info,
|
|
24
18
|
isDismissable: false,
|
|
25
|
-
onClick:
|
|
19
|
+
onClick: () => {}
|
|
26
20
|
};
|
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Toast", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Toast.Toast;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "toastVariant", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _Toast2.toastVariant;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _Toast = require("./Toast");
|
|
19
|
-
var _Toast2 = require("./Toast.prop");
|
|
1
|
+
export { Toast } from './Toast';
|
|
2
|
+
export { toastVariant } from './Toast.prop';
|