@papillonbits/components 1.13.0 → 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
package/build/index.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "primer", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _primer.primer;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _primer = require("./primer");
|
|
1
|
+
export { primer } from './primer';
|
|
@@ -1,115 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var _consent$action3;
|
|
24
|
-
var _ref$dataTest = _ref.dataTest,
|
|
25
|
-
dataTest = _ref$dataTest === void 0 ? _Alert.defaultProps.dataTest : _ref$dataTest,
|
|
26
|
-
_ref$className = _ref.className,
|
|
27
|
-
className = _ref$className === void 0 ? _Alert.defaultProps.className : _ref$className,
|
|
28
|
-
_ref$variant = _ref.variant,
|
|
29
|
-
variant = _ref$variant === void 0 ? _Alert.defaultProps.variant : _ref$variant,
|
|
30
|
-
children = _ref.children,
|
|
31
|
-
consent = _ref.consent;
|
|
32
|
-
var _useState = (0, _hooks.useState)(''),
|
|
33
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
34
|
-
consentValue = _useState2[0],
|
|
35
|
-
setConsentValue = _useState2[1];
|
|
36
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
37
|
-
"data-test": dataTest === null || dataTest === void 0 ? void 0 : dataTest["default"],
|
|
1
|
+
import { Fragment } from 'react';
|
|
2
|
+
import { useState } from '@papillonbits/library/hooks';
|
|
3
|
+
import utilityStyles from '@papillonbits/css/build/primer/utilities/margin.scss';
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
import { propTypes, defaultProps, alertVariant } from './Alert.prop';
|
|
6
|
+
import styles from './Alert.scss';
|
|
7
|
+
import buttonStyles from '../Button/Button.scss';
|
|
8
|
+
import { Input } from '../Form/Input';
|
|
9
|
+
import { Button, buttonVariant, buttonInputType, iconAlignment } from '../Button';
|
|
10
|
+
import { iconName } from '../Icon/Icon.prop';
|
|
11
|
+
import { Icon, iconSize } from '../Icon';
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
export function Alert({
|
|
14
|
+
dataTest = defaultProps.dataTest,
|
|
15
|
+
className = defaultProps.className,
|
|
16
|
+
variant = defaultProps.variant,
|
|
17
|
+
children,
|
|
18
|
+
consent
|
|
19
|
+
}) {
|
|
20
|
+
const [consentValue, setConsentValue] = useState('');
|
|
21
|
+
return /*#__PURE__*/_jsx("div", {
|
|
22
|
+
"data-test": dataTest?.default,
|
|
38
23
|
className: className,
|
|
39
|
-
children: /*#__PURE__*/(
|
|
40
|
-
className: (
|
|
41
|
-
children: /*#__PURE__*/(
|
|
42
|
-
className: (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
24
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
25
|
+
className: cx(styles['flash-messages']),
|
|
26
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
27
|
+
className: cx(styles.flash, {
|
|
28
|
+
[styles['flash-warn']]: variant === alertVariant.warning,
|
|
29
|
+
[styles['flash-error']]: variant === alertVariant.error,
|
|
30
|
+
[styles['flash-success']]: variant === alertVariant.success,
|
|
31
|
+
[styles['flash-consent']]: variant === alertVariant.consent
|
|
32
|
+
}),
|
|
33
|
+
children: [consent && /*#__PURE__*/_jsxs(Fragment, {
|
|
34
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
35
|
+
dataTest: dataTest?.cancel,
|
|
36
|
+
className: cx(buttonStyles.btn, buttonStyles['btn-sm'], buttonStyles.primary, styles['flash-action']),
|
|
47
37
|
text: "Cancel",
|
|
48
38
|
icon: {
|
|
49
|
-
name:
|
|
50
|
-
alignment:
|
|
39
|
+
name: iconName.XCircleFill16,
|
|
40
|
+
alignment: iconAlignment.left
|
|
51
41
|
},
|
|
52
|
-
variant:
|
|
53
|
-
inputType:
|
|
54
|
-
onClick:
|
|
55
|
-
|
|
56
|
-
consent === null || consent === void 0 || (_consent$action = consent.action) === null || _consent$action === void 0 || _consent$action.cancel();
|
|
42
|
+
variant: buttonVariant.default,
|
|
43
|
+
inputType: buttonInputType.submit,
|
|
44
|
+
onClick: () => {
|
|
45
|
+
consent?.action?.cancel();
|
|
57
46
|
setConsentValue('');
|
|
58
47
|
}
|
|
59
|
-
}), /*#__PURE__*/(
|
|
60
|
-
dataTest: dataTest
|
|
61
|
-
className: (
|
|
48
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
49
|
+
dataTest: dataTest?.approve,
|
|
50
|
+
className: cx(buttonStyles.btn, buttonStyles['btn-sm'], buttonStyles.primary, styles['flash-action']),
|
|
62
51
|
text: "Approve",
|
|
63
52
|
icon: {
|
|
64
|
-
name:
|
|
65
|
-
alignment:
|
|
53
|
+
name: iconName.CheckCircleFill16,
|
|
54
|
+
alignment: iconAlignment.left
|
|
66
55
|
},
|
|
67
|
-
variant:
|
|
68
|
-
inputType:
|
|
69
|
-
autoFocus: consent
|
|
56
|
+
variant: buttonVariant.primary,
|
|
57
|
+
inputType: buttonInputType.submit,
|
|
58
|
+
autoFocus: consent?.withInput ? false : true // eslint-disable-line
|
|
70
59
|
,
|
|
71
|
-
onClick: consent
|
|
60
|
+
onClick: consent?.withInput ? () => {
|
|
72
61
|
if (consentValue !== '') {
|
|
73
|
-
|
|
74
|
-
consent === null || consent === void 0 || (_consent$action2 = consent.action) === null || _consent$action2 === void 0 || _consent$action2.approve(consentValue);
|
|
62
|
+
consent?.action?.approve(consentValue);
|
|
75
63
|
setConsentValue('');
|
|
76
64
|
}
|
|
77
|
-
} : consent
|
|
65
|
+
} : consent?.action?.approve
|
|
78
66
|
})]
|
|
79
|
-
}), variant ===
|
|
80
|
-
className:
|
|
81
|
-
icon:
|
|
82
|
-
size:
|
|
83
|
-
}), variant ===
|
|
84
|
-
className:
|
|
85
|
-
icon:
|
|
86
|
-
size:
|
|
87
|
-
}), variant ===
|
|
88
|
-
className:
|
|
89
|
-
icon:
|
|
90
|
-
size:
|
|
91
|
-
}), variant ===
|
|
92
|
-
className:
|
|
93
|
-
icon:
|
|
94
|
-
size:
|
|
95
|
-
}), variant ===
|
|
96
|
-
className:
|
|
97
|
-
icon:
|
|
98
|
-
size:
|
|
99
|
-
}), variant ===
|
|
100
|
-
className:
|
|
101
|
-
icon:
|
|
102
|
-
size:
|
|
103
|
-
}), children,
|
|
104
|
-
dataTest: dataTest
|
|
105
|
-
className:
|
|
67
|
+
}), variant === alertVariant.info && /*#__PURE__*/_jsx(Icon, {
|
|
68
|
+
className: utilityStyles['mr-2'],
|
|
69
|
+
icon: iconName.Info16,
|
|
70
|
+
size: iconSize.small
|
|
71
|
+
}), variant === alertVariant.warning && !consent && /*#__PURE__*/_jsx(Icon, {
|
|
72
|
+
className: utilityStyles['mr-2'],
|
|
73
|
+
icon: iconName.Alert16,
|
|
74
|
+
size: iconSize.small
|
|
75
|
+
}), variant === alertVariant.warning && consent && /*#__PURE__*/_jsx(Icon, {
|
|
76
|
+
className: utilityStyles['mr-2'],
|
|
77
|
+
icon: iconName.Question16,
|
|
78
|
+
size: iconSize.small
|
|
79
|
+
}), variant === alertVariant.error && /*#__PURE__*/_jsx(Icon, {
|
|
80
|
+
className: utilityStyles['mr-2'],
|
|
81
|
+
icon: iconName.XCircle16,
|
|
82
|
+
size: iconSize.small
|
|
83
|
+
}), variant === alertVariant.success && /*#__PURE__*/_jsx(Icon, {
|
|
84
|
+
className: utilityStyles['mr-2'],
|
|
85
|
+
icon: iconName.CheckCircle16,
|
|
86
|
+
size: iconSize.small
|
|
87
|
+
}), variant === alertVariant.consent && /*#__PURE__*/_jsx(Icon, {
|
|
88
|
+
className: utilityStyles['mr-2'],
|
|
89
|
+
icon: iconName.Question16,
|
|
90
|
+
size: iconSize.small
|
|
91
|
+
}), children, consent?.withInput && /*#__PURE__*/_jsx(Input, {
|
|
92
|
+
dataTest: dataTest?.value,
|
|
93
|
+
className: styles['flash-action'],
|
|
106
94
|
value: consentValue,
|
|
107
95
|
placeholder: "",
|
|
108
96
|
ariaAttr: {},
|
|
109
|
-
onChange:
|
|
97
|
+
onChange: event => {
|
|
110
98
|
setConsentValue(event.target.value);
|
|
111
99
|
},
|
|
112
|
-
onKeyUp:
|
|
100
|
+
onKeyUp: event => {
|
|
113
101
|
setConsentValue(event.target.value);
|
|
114
102
|
},
|
|
115
103
|
autoFocus: true // eslint-disable-line
|
|
@@ -118,4 +106,4 @@ function Alert(_ref) {
|
|
|
118
106
|
})
|
|
119
107
|
});
|
|
120
108
|
}
|
|
121
|
-
Alert.propTypes =
|
|
109
|
+
Alert.propTypes = propTypes;
|
|
@@ -1,38 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.propTypes = exports.defaultProps = exports.alertVariant = void 0;
|
|
7
|
-
var _propTypes = require("prop-types");
|
|
8
|
-
var alertVariant = exports.alertVariant = {
|
|
9
|
-
"default": 'default',
|
|
1
|
+
import { string, oneOf, shape, func, bool, node } from 'prop-types';
|
|
2
|
+
export const alertVariant = {
|
|
3
|
+
default: 'default',
|
|
10
4
|
info: 'info',
|
|
11
5
|
warning: 'warning',
|
|
12
6
|
error: 'error',
|
|
13
7
|
success: 'success',
|
|
14
8
|
consent: 'consent'
|
|
15
9
|
};
|
|
16
|
-
|
|
17
|
-
dataTest:
|
|
18
|
-
|
|
19
|
-
approve:
|
|
20
|
-
cancel:
|
|
21
|
-
value:
|
|
10
|
+
export const propTypes = {
|
|
11
|
+
dataTest: shape({
|
|
12
|
+
default: string,
|
|
13
|
+
approve: string,
|
|
14
|
+
cancel: string,
|
|
15
|
+
value: string
|
|
22
16
|
}),
|
|
23
|
-
className:
|
|
24
|
-
variant:
|
|
25
|
-
children:
|
|
26
|
-
consent:
|
|
27
|
-
action:
|
|
28
|
-
approve:
|
|
29
|
-
cancel:
|
|
17
|
+
className: string,
|
|
18
|
+
variant: oneOf(Object.keys(alertVariant)),
|
|
19
|
+
children: node.isRequired,
|
|
20
|
+
consent: shape({
|
|
21
|
+
action: shape({
|
|
22
|
+
approve: func,
|
|
23
|
+
cancel: func
|
|
30
24
|
}),
|
|
31
|
-
withInput:
|
|
25
|
+
withInput: bool
|
|
32
26
|
})
|
|
33
27
|
};
|
|
34
|
-
|
|
28
|
+
export const defaultProps = {
|
|
35
29
|
dataTest: null,
|
|
36
30
|
className: null,
|
|
37
|
-
variant: alertVariant
|
|
31
|
+
variant: alertVariant.default
|
|
38
32
|
};
|
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Alert", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Alert.Alert;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "alertVariant", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _Alert2.alertVariant;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _Alert = require("./Alert");
|
|
19
|
-
var _Alert2 = require("./Alert.prop");
|
|
1
|
+
export { Alert } from './Alert';
|
|
2
|
+
export { alertVariant } from './Alert.prop';
|
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
hasCleanBackground = _ref$hasCleanBackgrou === void 0 ? _Blankslate.defaultProps.hasCleanBackground : _ref$hasCleanBackgrou;
|
|
22
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
23
|
-
className: (0, _classnames["default"])(className, _Blankslate2["default"].blankslate, (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, _Blankslate2["default"]['blankslate-narrow'], variant === _Blankslate.blankslateVariant.narrow), _Blankslate2["default"]['blankslate-capped'], variant === _Blankslate.blankslateVariant.capped === true), _Blankslate2["default"]['blankslate-spacious'], variant === _Blankslate.blankslateVariant.spacious), _Blankslate2["default"]['blankslate-large'], variant === _Blankslate.blankslateVariant.large), _Blankslate2["default"]['blankslate-clean-background'], hasCleanBackground === true)),
|
|
24
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import { propTypes, defaultProps, blankslateVariant } from './Blankslate.prop';
|
|
3
|
+
import styles from './Blankslate.scss';
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
export function Blankslate({
|
|
6
|
+
className = defaultProps.className,
|
|
7
|
+
heading,
|
|
8
|
+
text,
|
|
9
|
+
variant = defaultProps.variant,
|
|
10
|
+
hasCleanBackground = defaultProps.hasCleanBackground
|
|
11
|
+
}) {
|
|
12
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
13
|
+
className: cx(className, styles.blankslate, {
|
|
14
|
+
[styles['blankslate-narrow']]: variant === blankslateVariant.narrow,
|
|
15
|
+
[styles['blankslate-capped']]: variant === blankslateVariant.capped === true,
|
|
16
|
+
[styles['blankslate-spacious']]: variant === blankslateVariant.spacious,
|
|
17
|
+
[styles['blankslate-large']]: variant === blankslateVariant.large,
|
|
18
|
+
[styles['blankslate-clean-background']]: hasCleanBackground === true
|
|
19
|
+
}),
|
|
20
|
+
children: [/*#__PURE__*/_jsx("h3", {
|
|
25
21
|
children: heading
|
|
26
|
-
}), /*#__PURE__*/(
|
|
22
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
27
23
|
children: text
|
|
28
24
|
})]
|
|
29
25
|
});
|
|
30
26
|
}
|
|
31
|
-
Blankslate.propTypes =
|
|
27
|
+
Blankslate.propTypes = propTypes;
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.propTypes = exports.defaultProps = exports.blankslateVariant = void 0;
|
|
7
|
-
var _propTypes = require("prop-types");
|
|
8
|
-
var blankslateVariant = exports.blankslateVariant = {
|
|
9
|
-
"default": 'default',
|
|
1
|
+
import { string, oneOf, bool } from 'prop-types';
|
|
2
|
+
export const blankslateVariant = {
|
|
3
|
+
default: 'default',
|
|
10
4
|
narrow: 'narrow',
|
|
11
5
|
capped: 'capped',
|
|
12
6
|
spacious: 'spacious',
|
|
13
7
|
large: 'large'
|
|
14
8
|
};
|
|
15
|
-
|
|
16
|
-
className:
|
|
17
|
-
heading:
|
|
18
|
-
text:
|
|
19
|
-
variant:
|
|
20
|
-
hasCleanBackground:
|
|
9
|
+
export const propTypes = {
|
|
10
|
+
className: string,
|
|
11
|
+
heading: string.isRequired,
|
|
12
|
+
text: string.isRequired,
|
|
13
|
+
variant: oneOf(Object.keys(blankslateVariant)),
|
|
14
|
+
hasCleanBackground: bool
|
|
21
15
|
};
|
|
22
|
-
|
|
16
|
+
export const defaultProps = {
|
|
23
17
|
className: null,
|
|
24
|
-
variant: blankslateVariant
|
|
18
|
+
variant: blankslateVariant.default,
|
|
25
19
|
hasCleanBackground: false
|
|
26
20
|
};
|
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Blankslate", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Blankslate.Blankslate;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "blankslateVariant", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _Blankslate2.blankslateVariant;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _Blankslate = require("./Blankslate");
|
|
19
|
-
var _Blankslate2 = require("./Blankslate.prop");
|
|
1
|
+
export { Blankslate } from './Blankslate';
|
|
2
|
+
export { blankslateVariant } from './Blankslate.prop';
|
|
@@ -1,74 +1,72 @@
|
|
|
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
|
-
current = ariaAttr.current;
|
|
29
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("nav", {
|
|
30
|
-
className: (0, _classnames["default"])(className, (0, _defineProperty2["default"])({}, _Breadcrumb2["default"]['breadcrumb-inactive'], state === _Breadcrumb.breadcrumbState.inactive)),
|
|
1
|
+
import "core-js/modules/es.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/es.iterator.map.js";
|
|
3
|
+
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
4
|
+
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
5
|
+
import cx from 'classnames';
|
|
6
|
+
import { v1 as uuidv1 } from 'uuid';
|
|
7
|
+
import utilityStyles from '@papillonbits/css/build/primer/utilities/typography.scss';
|
|
8
|
+
import { getIndexItems, getIndexItemsWithSelected } from '@papillonbits/library/array';
|
|
9
|
+
import { propTypes, defaultProps, breadcrumbState } from './Breadcrumb.prop';
|
|
10
|
+
import styles from './Breadcrumb.scss';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
export function Breadcrumb({
|
|
13
|
+
className = defaultProps.className,
|
|
14
|
+
ariaAttr,
|
|
15
|
+
items,
|
|
16
|
+
onClick,
|
|
17
|
+
state = defaultProps.state
|
|
18
|
+
}) {
|
|
19
|
+
const indexItems = getIndexItems(items);
|
|
20
|
+
const {
|
|
21
|
+
label,
|
|
22
|
+
current
|
|
23
|
+
} = ariaAttr;
|
|
24
|
+
return /*#__PURE__*/_jsx("nav", {
|
|
25
|
+
className: cx(className, {
|
|
26
|
+
[styles['breadcrumb-inactive']]: state === breadcrumbState.inactive
|
|
27
|
+
}),
|
|
31
28
|
"aria-label": label,
|
|
32
|
-
children: /*#__PURE__*/(
|
|
33
|
-
children: indexItems.map(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
children: /*#__PURE__*/_jsx("ol", {
|
|
30
|
+
children: indexItems.map(indexItem => {
|
|
31
|
+
const {
|
|
32
|
+
href,
|
|
33
|
+
text,
|
|
34
|
+
isSelected
|
|
35
|
+
} = indexItem;
|
|
36
|
+
const itemOtherProps = isSelected ? {
|
|
37
|
+
...{
|
|
38
|
+
'aria-current': current
|
|
39
|
+
}
|
|
40
|
+
} : null;
|
|
41
|
+
return /*#__PURE__*/_jsx("li", {
|
|
42
|
+
onClick: e => {
|
|
42
43
|
e.preventDefault();
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
const newIndexItems = getIndexItemsWithSelected(indexItems, indexItem);
|
|
45
|
+
onClick({
|
|
45
46
|
active: text,
|
|
46
|
-
ariaAttr
|
|
47
|
-
items: newIndexItems.map(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
};
|
|
57
|
-
}(newIndexItem);
|
|
58
|
-
} // eslint-disable-line
|
|
47
|
+
ariaAttr,
|
|
48
|
+
items: newIndexItems.map(newIndexItem => (({
|
|
49
|
+
href,
|
|
50
|
+
text,
|
|
51
|
+
isSelected
|
|
52
|
+
}) => ({
|
|
53
|
+
href,
|
|
54
|
+
text,
|
|
55
|
+
isSelected
|
|
56
|
+
}))(newIndexItem) // eslint-disable-line
|
|
59
57
|
)
|
|
60
58
|
});
|
|
61
59
|
},
|
|
62
|
-
className: !isSelected ? (
|
|
63
|
-
href: href
|
|
64
|
-
|
|
65
|
-
children: isSelected ? text : /*#__PURE__*/(
|
|
60
|
+
className: !isSelected ? cx(styles['breadcrumb-item']) : cx(styles['breadcrumb-item'], styles['breadcrumb-item-selected'], utilityStyles['text-gray']),
|
|
61
|
+
href: href,
|
|
62
|
+
...itemOtherProps,
|
|
63
|
+
children: isSelected ? text : /*#__PURE__*/_jsx("a", {
|
|
66
64
|
href: href,
|
|
67
65
|
children: text
|
|
68
66
|
})
|
|
69
|
-
}
|
|
67
|
+
}, uuidv1());
|
|
70
68
|
})
|
|
71
69
|
})
|
|
72
70
|
});
|
|
73
71
|
}
|
|
74
|
-
Breadcrumb.propTypes =
|
|
72
|
+
Breadcrumb.propTypes = propTypes;
|
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.propTypes = exports.defaultProps = exports.breadcrumbState = void 0;
|
|
7
|
-
var _propTypes = require("prop-types");
|
|
8
|
-
var breadcrumbState = exports.breadcrumbState = {
|
|
1
|
+
import { arrayOf, oneOf, shape, string, bool, func } from 'prop-types';
|
|
2
|
+
export const breadcrumbState = {
|
|
9
3
|
active: 'active',
|
|
10
4
|
inactive: 'inactive'
|
|
11
5
|
};
|
|
12
|
-
|
|
13
|
-
className:
|
|
14
|
-
ariaAttr:
|
|
15
|
-
label:
|
|
16
|
-
current:
|
|
6
|
+
export const propTypes = {
|
|
7
|
+
className: string,
|
|
8
|
+
ariaAttr: shape({
|
|
9
|
+
label: string,
|
|
10
|
+
current: string
|
|
17
11
|
}).isRequired,
|
|
18
|
-
items:
|
|
19
|
-
href:
|
|
20
|
-
text:
|
|
21
|
-
isSelected:
|
|
12
|
+
items: arrayOf(shape({
|
|
13
|
+
href: string,
|
|
14
|
+
text: string,
|
|
15
|
+
isSelected: bool
|
|
22
16
|
})).isRequired,
|
|
23
|
-
onClick:
|
|
24
|
-
state:
|
|
17
|
+
onClick: func.isRequired,
|
|
18
|
+
state: oneOf(Object.keys(breadcrumbState))
|
|
25
19
|
};
|
|
26
|
-
|
|
20
|
+
export const defaultProps = {
|
|
27
21
|
className: null,
|
|
28
22
|
state: breadcrumbState.active
|
|
29
23
|
};
|
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Breadcrumb", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Breadcrumb.Breadcrumb;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "breadcrumbState", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _Breadcrumb2.breadcrumbState;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _Breadcrumb = require("./Breadcrumb");
|
|
19
|
-
var _Breadcrumb2 = require("./Breadcrumb.prop");
|
|
1
|
+
export { Breadcrumb } from './Breadcrumb';
|
|
2
|
+
export { breadcrumbState } from './Breadcrumb.prop';
|