@papillonbits/components 1.13.1 → 1.14.1
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,78 +1,69 @@
|
|
|
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
|
-
_ref$size = _ref.size,
|
|
33
|
-
size = _ref$size === void 0 ? _Button.defaultProps.size : _ref$size,
|
|
34
|
-
_ref$state = _ref.state,
|
|
35
|
-
state = _ref$state === void 0 ? _Button.defaultProps.state : _ref$state,
|
|
36
|
-
_ref$icon = _ref.icon,
|
|
37
|
-
icon = _ref$icon === void 0 ? _Button.defaultProps.icon : _ref$icon,
|
|
38
|
-
_onClick = _ref.onClick,
|
|
39
|
-
_ref$inputType = _ref.inputType,
|
|
40
|
-
inputType = _ref$inputType === void 0 ? _Button.defaultProps.inputType : _ref$inputType,
|
|
41
|
-
_ref$autoFocus = _ref.autoFocus,
|
|
42
|
-
autoFocus = _ref$autoFocus === void 0 ? _Button.defaultProps.autoFocus : _ref$autoFocus;
|
|
43
|
-
var stateProps = state === _Button.buttonState.inactive ? _objectSpread({}, {
|
|
44
|
-
disabled: 'true',
|
|
45
|
-
'aria-disabled': 'true'
|
|
46
|
-
}) : null;
|
|
47
|
-
var fileInputRef = (0, _hooks.useRef)(null);
|
|
48
|
-
if (element === _Button.buttonElement.button) {
|
|
49
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", _objectSpread(_objectSpread({
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import { useRef } from '@papillonbits/library/hooks';
|
|
3
|
+
import utilityStyles from '@papillonbits/css/build/primer/utilities/margin.scss';
|
|
4
|
+
import { propTypes, defaultProps, buttonElement, buttonVariant, buttonSize, buttonState, iconAlignment, buttonInputType } from './Button.prop';
|
|
5
|
+
import styles from './Button.scss';
|
|
6
|
+
import { Icon, iconSize } from '../Icon';
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
export function Button({
|
|
9
|
+
dataTest = defaultProps.dataTest,
|
|
10
|
+
id = defaultProps.id,
|
|
11
|
+
className = defaultProps.className,
|
|
12
|
+
element = defaultProps.element,
|
|
13
|
+
href = defaultProps.href,
|
|
14
|
+
text,
|
|
15
|
+
variant = defaultProps.variant,
|
|
16
|
+
size = defaultProps.size,
|
|
17
|
+
state = defaultProps.state,
|
|
18
|
+
icon = defaultProps.icon,
|
|
19
|
+
onClick,
|
|
20
|
+
inputType = defaultProps.inputType,
|
|
21
|
+
autoFocus = defaultProps.autoFocus
|
|
22
|
+
}) {
|
|
23
|
+
const stateProps = state === buttonState.inactive ? {
|
|
24
|
+
...{
|
|
25
|
+
disabled: 'true',
|
|
26
|
+
'aria-disabled': 'true'
|
|
27
|
+
}
|
|
28
|
+
} : null;
|
|
29
|
+
const fileInputRef = useRef(null);
|
|
30
|
+
if (element === buttonElement.button) {
|
|
31
|
+
return /*#__PURE__*/_jsxs("button", {
|
|
50
32
|
"data-test": dataTest,
|
|
51
33
|
id: id,
|
|
52
|
-
className: (
|
|
34
|
+
className: cx(className, styles.btn, {
|
|
35
|
+
[styles['btn-sm']]: size === buttonSize.small,
|
|
36
|
+
[styles['btn-large']]: size === buttonSize.large,
|
|
37
|
+
[styles['btn-primary']]: variant === buttonVariant.primary,
|
|
38
|
+
[styles['btn-danger']]: variant === buttonVariant.danger,
|
|
39
|
+
[styles['btn-outline']]: variant === buttonVariant.outline,
|
|
40
|
+
[styles['btn-blue']]: variant === buttonVariant.blue,
|
|
41
|
+
[styles['btn-orange']]: variant === buttonVariant.orange,
|
|
42
|
+
[styles['button-inactive']]: state === buttonState.inactive
|
|
43
|
+
}),
|
|
53
44
|
type: "button",
|
|
54
45
|
autoFocus: autoFocus // eslint-disable-line
|
|
55
46
|
,
|
|
56
|
-
onClick:
|
|
57
|
-
if (inputType ===
|
|
47
|
+
onClick: () => {
|
|
48
|
+
if (inputType === buttonInputType.file) {
|
|
58
49
|
fileInputRef.current.click();
|
|
59
50
|
}
|
|
60
51
|
if (!inputType) {
|
|
61
|
-
|
|
52
|
+
onClick();
|
|
62
53
|
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
children: [
|
|
66
|
-
className:
|
|
54
|
+
},
|
|
55
|
+
...stateProps,
|
|
56
|
+
children: [icon?.alignment === iconAlignment.left && /*#__PURE__*/_jsx(Icon, {
|
|
57
|
+
className: utilityStyles['mr-2'],
|
|
67
58
|
icon: icon.name,
|
|
68
|
-
size:
|
|
69
|
-
}), text,
|
|
70
|
-
className:
|
|
59
|
+
size: iconSize.small
|
|
60
|
+
}), text, icon?.alignment === iconAlignment.right && /*#__PURE__*/_jsx(Icon, {
|
|
61
|
+
className: utilityStyles['ml-2'],
|
|
71
62
|
icon: icon.name,
|
|
72
|
-
size:
|
|
73
|
-
}), inputType && inputType ===
|
|
74
|
-
onChange:
|
|
75
|
-
|
|
63
|
+
size: iconSize.small
|
|
64
|
+
}), inputType && inputType === buttonInputType.file && /*#__PURE__*/_jsx("input", {
|
|
65
|
+
onChange: () => {
|
|
66
|
+
onClick(fileInputRef.current.files);
|
|
76
67
|
},
|
|
77
68
|
ref: fileInputRef,
|
|
78
69
|
type: "file",
|
|
@@ -83,17 +74,17 @@ function Button(_ref) {
|
|
|
83
74
|
display: 'none'
|
|
84
75
|
}
|
|
85
76
|
})]
|
|
86
|
-
})
|
|
77
|
+
});
|
|
87
78
|
}
|
|
88
|
-
if (element ===
|
|
89
|
-
return /*#__PURE__*/(
|
|
90
|
-
className: (
|
|
79
|
+
if (element === buttonElement.a) {
|
|
80
|
+
return /*#__PURE__*/_jsx("a", {
|
|
81
|
+
className: cx(className, styles.btn),
|
|
91
82
|
href: href,
|
|
92
83
|
role: "button",
|
|
93
|
-
onClick:
|
|
94
|
-
|
|
84
|
+
onClick: onClick,
|
|
85
|
+
...stateProps,
|
|
95
86
|
children: text
|
|
96
|
-
})
|
|
87
|
+
});
|
|
97
88
|
}
|
|
98
89
|
}
|
|
99
|
-
Button.propTypes =
|
|
90
|
+
Button.propTypes = propTypes;
|
|
@@ -1,64 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.propTypes = exports.iconAlignment = exports.defaultProps = exports.buttonVariant = exports.buttonState = exports.buttonSize = exports.buttonInputType = exports.buttonElement = void 0;
|
|
7
|
-
var _propTypes = require("prop-types");
|
|
8
|
-
var _Icon = require("../Icon/Icon.prop");
|
|
9
|
-
var buttonElement = exports.buttonElement = {
|
|
1
|
+
import { string, oneOf, shape, func, bool } from 'prop-types';
|
|
2
|
+
import { iconName } from '../Icon/Icon.prop';
|
|
3
|
+
export const buttonElement = {
|
|
10
4
|
button: 'button',
|
|
11
5
|
a: 'a'
|
|
12
6
|
};
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export const buttonVariant = {
|
|
8
|
+
default: 'default',
|
|
15
9
|
primary: 'primary',
|
|
16
10
|
danger: 'danger',
|
|
17
11
|
outline: 'outline',
|
|
18
12
|
blue: 'blue',
|
|
19
13
|
orange: 'orange'
|
|
20
14
|
};
|
|
21
|
-
|
|
15
|
+
export const buttonSize = {
|
|
22
16
|
small: 'small',
|
|
23
17
|
normal: 'normal',
|
|
24
18
|
large: 'large'
|
|
25
19
|
};
|
|
26
|
-
|
|
20
|
+
export const buttonState = {
|
|
27
21
|
active: 'active',
|
|
28
22
|
inactive: 'inactive'
|
|
29
23
|
};
|
|
30
|
-
|
|
24
|
+
export const iconAlignment = {
|
|
31
25
|
left: 'left',
|
|
32
26
|
right: 'right'
|
|
33
27
|
};
|
|
34
|
-
|
|
28
|
+
export const buttonInputType = {
|
|
35
29
|
file: 'file'
|
|
36
30
|
};
|
|
37
|
-
|
|
38
|
-
dataTest:
|
|
39
|
-
id:
|
|
40
|
-
className:
|
|
41
|
-
element:
|
|
42
|
-
href:
|
|
43
|
-
text:
|
|
44
|
-
variant:
|
|
45
|
-
size:
|
|
46
|
-
state:
|
|
47
|
-
icon:
|
|
48
|
-
name:
|
|
49
|
-
alignment:
|
|
31
|
+
export const propTypes = {
|
|
32
|
+
dataTest: string,
|
|
33
|
+
id: string,
|
|
34
|
+
className: string,
|
|
35
|
+
element: oneOf(Object.keys(buttonElement)),
|
|
36
|
+
href: string,
|
|
37
|
+
text: string.isRequired,
|
|
38
|
+
variant: oneOf(Object.keys(buttonVariant)),
|
|
39
|
+
size: oneOf(Object.keys(buttonSize)),
|
|
40
|
+
state: oneOf(Object.keys(buttonState)),
|
|
41
|
+
icon: shape({
|
|
42
|
+
name: oneOf(Object.keys(iconName)).isRequired,
|
|
43
|
+
alignment: oneOf(Object.keys(iconAlignment))
|
|
50
44
|
}),
|
|
51
|
-
onClick:
|
|
52
|
-
inputType:
|
|
53
|
-
autoFocus:
|
|
45
|
+
onClick: func.isRequired,
|
|
46
|
+
inputType: oneOf(Object.keys(buttonInputType)),
|
|
47
|
+
autoFocus: bool
|
|
54
48
|
};
|
|
55
|
-
|
|
49
|
+
export const defaultProps = {
|
|
56
50
|
dataTest: null,
|
|
57
51
|
id: null,
|
|
58
52
|
className: null,
|
|
59
53
|
element: buttonElement.button,
|
|
60
54
|
href: null,
|
|
61
|
-
variant: buttonVariant
|
|
55
|
+
variant: buttonVariant.default,
|
|
62
56
|
size: buttonSize.normal,
|
|
63
57
|
state: buttonState.active,
|
|
64
58
|
icon: null,
|
|
@@ -1,49 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Button", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Button.Button;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "buttonElement", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _Button2.buttonElement;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "buttonInputType", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _Button2.buttonInputType;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "buttonSize", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _Button2.buttonSize;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "buttonState", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _Button2.buttonState;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "buttonVariant", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function get() {
|
|
39
|
-
return _Button2.buttonVariant;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "iconAlignment", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function get() {
|
|
45
|
-
return _Button2.iconAlignment;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
var _Button = require("./Button");
|
|
49
|
-
var _Button2 = require("./Button.prop");
|
|
1
|
+
export { Button } from './Button';
|
|
2
|
+
export { buttonElement, buttonVariant, buttonSize, buttonState, iconAlignment, buttonInputType } from './Button.prop';
|
|
@@ -1,104 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var _ariaAttr$haspopup;
|
|
25
|
-
var _ref$className = _ref.className,
|
|
26
|
-
className = _ref$className === void 0 ? _Dropdown.defaultProps.className : _ref$className,
|
|
27
|
-
summary = _ref.summary,
|
|
28
|
-
_ref$ariaAttr = _ref.ariaAttr,
|
|
29
|
-
ariaAttr = _ref$ariaAttr === void 0 ? _Dropdown.defaultProps.ariaAttr : _ref$ariaAttr,
|
|
30
|
-
items = _ref.items,
|
|
31
|
-
_onClick = _ref.onClick,
|
|
32
|
-
_ref$state = _ref.state,
|
|
33
|
-
state = _ref$state === void 0 ? _Dropdown.defaultProps.state : _ref$state;
|
|
34
|
-
var details = (0, _hooks.useRef)(null);
|
|
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 detailsUtilityStyles from '@papillonbits/css/build/primer/utilities/details.scss';
|
|
6
|
+
import displayStyles from '@papillonbits/css/build/primer/utilities/visibility-display.scss';
|
|
7
|
+
import layoutStyles from '@papillonbits/css/build/primer/utilities/layout.scss';
|
|
8
|
+
import flexboxStyles from '@papillonbits/css/build/primer/utilities/flexbox.scss';
|
|
9
|
+
import { getIndexItems, getIndexItemsWithSelected } from '@papillonbits/library/array';
|
|
10
|
+
import { useRef } from '@papillonbits/library/hooks';
|
|
11
|
+
import buttonStyles from '../Button/Button.scss';
|
|
12
|
+
import { propTypes, defaultProps, dropdownState } from './Dropdown.prop';
|
|
13
|
+
import styles from './Dropdown.scss';
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
export function Dropdown({
|
|
16
|
+
className = defaultProps.className,
|
|
17
|
+
summary,
|
|
18
|
+
ariaAttr = defaultProps.ariaAttr,
|
|
19
|
+
items,
|
|
20
|
+
onClick,
|
|
21
|
+
state = defaultProps.state
|
|
22
|
+
}) {
|
|
23
|
+
const details = useRef(null);
|
|
35
24
|
if (!items) {
|
|
36
25
|
return null;
|
|
37
26
|
}
|
|
38
|
-
|
|
39
|
-
return /*#__PURE__*/(
|
|
27
|
+
const indexItems = getIndexItems(items);
|
|
28
|
+
return /*#__PURE__*/_jsx("div", {
|
|
40
29
|
className: className,
|
|
41
|
-
children: /*#__PURE__*/(
|
|
30
|
+
children: /*#__PURE__*/_jsxs("details", {
|
|
42
31
|
ref: details,
|
|
43
|
-
className: (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
32
|
+
className: cx(styles.dropdown, detailsUtilityStyles['details-reset'], detailsUtilityStyles['details-overlay'], displayStyles['d-inline-block'], {
|
|
33
|
+
[styles['dropdown-inactive']]: state === dropdownState.inactive
|
|
34
|
+
}),
|
|
35
|
+
children: [/*#__PURE__*/_jsx("summary", {
|
|
36
|
+
className: cx(buttonStyles.btn),
|
|
37
|
+
"aria-haspopup": ariaAttr?.haspopup ?? false,
|
|
38
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
39
|
+
className: cx(displayStyles['d-flex'], flexboxStyles['flex-justify-between'], flexboxStyles['flex-items-center'], {
|
|
40
|
+
[styles['dropdown-inactive']]: state === dropdownState.inactive
|
|
41
|
+
}),
|
|
42
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
50
43
|
children: summary
|
|
51
|
-
}), " ", /*#__PURE__*/(
|
|
52
|
-
className:
|
|
44
|
+
}), " ", /*#__PURE__*/_jsx("div", {
|
|
45
|
+
className: styles['dropdown-caret']
|
|
53
46
|
})]
|
|
54
47
|
})
|
|
55
|
-
}), /*#__PURE__*/(
|
|
56
|
-
className: (
|
|
57
|
-
children: indexItems.map(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
}), /*#__PURE__*/_jsx("ul", {
|
|
49
|
+
className: cx(styles['dropdown-menu'], styles['dropdown-menu-se'], layoutStyles['width-full']),
|
|
50
|
+
children: indexItems.map(indexItem => {
|
|
51
|
+
const {
|
|
52
|
+
href,
|
|
53
|
+
text,
|
|
54
|
+
isSelected
|
|
55
|
+
} = indexItem;
|
|
56
|
+
const itemOtherProps = isSelected ? {
|
|
57
|
+
...{
|
|
58
|
+
'aria-current': ariaAttr?.current
|
|
59
|
+
}
|
|
60
|
+
} : null;
|
|
61
|
+
return /*#__PURE__*/_jsx("li", {
|
|
62
|
+
children: /*#__PURE__*/_jsx("a", {
|
|
63
|
+
onClick: e => {
|
|
67
64
|
e.preventDefault();
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
const newIndexItems = getIndexItemsWithSelected(indexItems, indexItem);
|
|
66
|
+
onClick({
|
|
70
67
|
summary: text,
|
|
71
|
-
ariaAttr
|
|
72
|
-
items: newIndexItems.map(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
};
|
|
88
|
-
}(newIndexItem);
|
|
89
|
-
})
|
|
68
|
+
ariaAttr,
|
|
69
|
+
items: newIndexItems.map(newIndexItem => (({
|
|
70
|
+
id: newIndexItemId,
|
|
71
|
+
href: newIndexItemHref,
|
|
72
|
+
text: newIndexItemText,
|
|
73
|
+
'date-modified': dateModified,
|
|
74
|
+
'date-created': dateCreated,
|
|
75
|
+
isSelected: newIndexItemIsSelected
|
|
76
|
+
}) => ({
|
|
77
|
+
id: newIndexItemId,
|
|
78
|
+
href: newIndexItemHref,
|
|
79
|
+
text: newIndexItemText,
|
|
80
|
+
'date-modified': dateModified,
|
|
81
|
+
'date-created': dateCreated,
|
|
82
|
+
isSelected: newIndexItemIsSelected
|
|
83
|
+
}))(newIndexItem))
|
|
90
84
|
});
|
|
91
85
|
details.current.removeAttribute('open');
|
|
92
86
|
},
|
|
93
|
-
className:
|
|
94
|
-
href: href
|
|
95
|
-
|
|
87
|
+
className: styles['dropdown-item'],
|
|
88
|
+
href: href,
|
|
89
|
+
...itemOtherProps,
|
|
96
90
|
children: text
|
|
97
|
-
})
|
|
98
|
-
}, (
|
|
91
|
+
})
|
|
92
|
+
}, uuidv1());
|
|
99
93
|
})
|
|
100
94
|
})]
|
|
101
95
|
})
|
|
102
96
|
});
|
|
103
97
|
}
|
|
104
|
-
Dropdown.propTypes =
|
|
98
|
+
Dropdown.propTypes = propTypes;
|
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.propTypes = exports.dropdownState = exports.defaultProps = void 0;
|
|
7
|
-
var _propTypes = require("prop-types");
|
|
8
|
-
var dropdownState = exports.dropdownState = {
|
|
1
|
+
import { string, arrayOf, oneOf, shape, bool, func } from 'prop-types';
|
|
2
|
+
export const dropdownState = {
|
|
9
3
|
active: 'active',
|
|
10
4
|
inactive: 'inactive'
|
|
11
5
|
};
|
|
12
|
-
|
|
13
|
-
className:
|
|
14
|
-
summary:
|
|
15
|
-
ariaAttr:
|
|
16
|
-
haspopup:
|
|
17
|
-
current:
|
|
6
|
+
export const propTypes = {
|
|
7
|
+
className: string,
|
|
8
|
+
summary: string.isRequired,
|
|
9
|
+
ariaAttr: shape({
|
|
10
|
+
haspopup: bool,
|
|
11
|
+
current: string
|
|
18
12
|
}),
|
|
19
|
-
items:
|
|
20
|
-
href:
|
|
21
|
-
text:
|
|
22
|
-
isSelected:
|
|
13
|
+
items: arrayOf(shape({
|
|
14
|
+
href: string,
|
|
15
|
+
text: string,
|
|
16
|
+
isSelected: bool
|
|
23
17
|
})).isRequired,
|
|
24
|
-
onClick:
|
|
25
|
-
state:
|
|
18
|
+
onClick: func.isRequired,
|
|
19
|
+
state: oneOf(Object.keys(dropdownState))
|
|
26
20
|
};
|
|
27
|
-
|
|
21
|
+
export const defaultProps = {
|
|
28
22
|
className: null,
|
|
29
23
|
ariaAttr: {
|
|
30
24
|
haspopup: false,
|
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Dropdown", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Dropdown.Dropdown;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "dropdownState", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _Dropdown2.dropdownState;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _Dropdown = require("./Dropdown");
|
|
19
|
-
var _Dropdown2 = require("./Dropdown.prop");
|
|
1
|
+
export { Dropdown } from './Dropdown';
|
|
2
|
+
export { dropdownState } from './Dropdown.prop';
|