@spaced-out/ui-design-system 0.1.16 → 0.1.17
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/.cspell/custom-words.txt +3 -0
- package/.flowconfig +1 -1
- package/CHANGELOG.md +7 -0
- package/CONTRIBUTING.md +52 -6
- package/README.md +144 -8
- package/gulpfile.js +1 -0
- package/lib/components/AvatarGroup/AvatarGroup.js +4 -3
- package/lib/components/AvatarGroup/AvatarGroup.js.flow +119 -110
- package/lib/components/Badge/Badge.js +4 -3
- package/lib/components/Badge/Badge.js.flow +21 -21
- package/lib/components/Badge/index.js +11 -7
- package/lib/components/Badge/index.js.flow +1 -2
- package/lib/components/Banner/Banner.js +3 -2
- package/lib/components/Banner/Banner.js.flow +42 -35
- package/lib/components/Button/Button.js +50 -10
- package/lib/components/Button/Button.js.flow +87 -23
- package/lib/components/Button/Button.module.css +14 -0
- package/lib/components/ButtonTabs/ButtonTab/ButtonTab.js +3 -2
- package/lib/components/ButtonTabs/ButtonTab/ButtonTab.js.flow +48 -38
- package/lib/components/ButtonTabs/ButtonTabs.js +3 -2
- package/lib/components/ButtonTabs/ButtonTabs.js.flow +50 -41
- package/lib/components/Card/Card.js +16 -7
- package/lib/components/Card/Card.js.flow +73 -55
- package/lib/components/Chip/Chip.js +3 -2
- package/lib/components/Chip/Chip.js.flow +66 -59
- package/lib/components/CircularLoader/CircularLoader.js +9 -4
- package/lib/components/CircularLoader/CircularLoader.js.flow +38 -24
- package/lib/components/CollapsibleCard/CollapsibleCard.js +4 -3
- package/lib/components/CollapsibleCard/CollapsibleCard.js.flow +68 -59
- package/lib/components/Dropdown/Dropdown.js +4 -3
- package/lib/components/Dropdown/Dropdown.js.flow +83 -74
- package/lib/components/EmptyState/EmptyState.js +4 -3
- package/lib/components/EmptyState/EmptyState.js.flow +53 -44
- package/lib/components/ErrorMessage/ErrorMessage.js +4 -3
- package/lib/components/ErrorMessage/ErrorMessage.js.flow +58 -49
- package/lib/components/InContextAlert/InContextAlert.js +4 -3
- package/lib/components/InContextAlert/InContextAlert.js.flow +79 -73
- package/lib/components/InlineDropdown/InlineDropdown.js +4 -3
- package/lib/components/InlineDropdown/InlineDropdown.js.flow +94 -85
- package/lib/components/LinearLoader/LinearLoader.js +4 -3
- package/lib/components/LinearLoader/LinearLoader.js.flow +20 -18
- package/lib/components/Link/Link.js +8 -1
- package/lib/components/Link/Link.js.flow +44 -36
- package/lib/components/Notification/Notification.js +8 -6
- package/lib/components/Notification/Notification.js.flow +96 -84
- package/lib/components/OptionButton/OptionButton.js +7 -4
- package/lib/components/OptionButton/OptionButton.js.flow +69 -59
- package/lib/components/PageTitle/PageTitle.js +4 -3
- package/lib/components/PageTitle/PageTitle.js.flow +46 -44
- package/lib/components/Pagination/PaginationItem.js +2 -2
- package/lib/components/Pagination/PaginationItem.js.flow +2 -2
- package/lib/components/SearchInput/SearchInput.js +3 -2
- package/lib/components/SearchInput/SearchInput.js.flow +59 -50
- package/lib/components/SideMenuLink/SideMenuLink.js +4 -3
- package/lib/components/SideMenuLink/SideMenuLink.js.flow +54 -45
- package/lib/components/StatusIndicator/StatusIndicator.js +3 -2
- package/lib/components/StatusIndicator/StatusIndicator.js.flow +32 -23
- package/lib/components/SubMenu/SubMenu.js +4 -3
- package/lib/components/SubMenu/SubMenu.js.flow +41 -38
- package/lib/components/Table/StaticTable.js +3 -0
- package/lib/components/Table/StaticTable.js.flow +3 -0
- package/lib/components/Table/Table.js +10 -0
- package/lib/components/Table/Table.js.flow +10 -0
- package/lib/components/Table/hooks.js +1 -0
- package/lib/components/Table/hooks.js.flow +1 -0
- package/lib/components/Tabs/TabList/TabList.js +3 -2
- package/lib/components/Tabs/TabList/TabList.js.flow +127 -117
- package/lib/components/Toggle/index.js +11 -7
- package/lib/components/Toggle/index.js.flow +1 -1
- package/lib/components/Tooltip/Tooltip.js.flow +2 -2
- package/lib/components/index.js +511 -0
- package/lib/components/index.js.flow +48 -0
- package/lib/index.js +60 -0
- package/lib/index.js.flow +7 -0
- package/lib/styles/index.css +15 -0
- package/lib/styles/index.js +104 -0
- package/lib/styles/index.js.flow +12 -0
- package/lib/styles/typography.module.css +0 -1
- package/lib/styles/utils.module.css +26 -0
- package/lib/types/index.js +38 -0
- package/lib/types/index.js.flow +5 -0
- package/lib/utils/index.js +93 -0
- package/lib/utils/index.js.flow +10 -0
- package/package.json +2 -1
|
@@ -69,65 +69,74 @@ export const CollapsibleCardContent = ({
|
|
|
69
69
|
<div className={classify(css.contentContainer, className)}>{children}</div>
|
|
70
70
|
);
|
|
71
71
|
|
|
72
|
-
export const CollapsibleCard
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
)}
|
|
100
|
-
onClick={(e) => {
|
|
101
|
-
onChange?.(e, !collapsibleCardIsOpen, id);
|
|
102
|
-
setCollapsibleCardIsOpen(!collapsibleCardIsOpen);
|
|
103
|
-
}}
|
|
72
|
+
export const CollapsibleCard: React$AbstractComponent<
|
|
73
|
+
CollapsibleCardProps,
|
|
74
|
+
HTMLDivElement,
|
|
75
|
+
> = React.forwardRef<CollapsibleCardProps, HTMLDivElement>(
|
|
76
|
+
(
|
|
77
|
+
{
|
|
78
|
+
id,
|
|
79
|
+
isOpen,
|
|
80
|
+
onChange,
|
|
81
|
+
classNames,
|
|
82
|
+
title,
|
|
83
|
+
children,
|
|
84
|
+
semantic = 'neutral',
|
|
85
|
+
headerIconName,
|
|
86
|
+
headerIconType = 'solid',
|
|
87
|
+
}: CollapsibleCardProps,
|
|
88
|
+
ref,
|
|
89
|
+
): React.Node => {
|
|
90
|
+
const [collapsibleCardIsOpen, setCollapsibleCardIsOpen] = React.useState(
|
|
91
|
+
Boolean(isOpen),
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<div
|
|
96
|
+
data-testid="CollapsibleCard"
|
|
97
|
+
className={classify(css.wrapper, classNames?.wrapper)}
|
|
98
|
+
ref={ref}
|
|
104
99
|
>
|
|
105
|
-
<
|
|
106
|
-
{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
className={css[semantic]}
|
|
113
|
-
/>
|
|
114
|
-
</div>
|
|
100
|
+
<UnstyledButton
|
|
101
|
+
className={classify(
|
|
102
|
+
css.header,
|
|
103
|
+
{
|
|
104
|
+
[css.isOpen]: collapsibleCardIsOpen,
|
|
105
|
+
},
|
|
106
|
+
classNames?.title,
|
|
115
107
|
)}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
108
|
+
onClick={(e) => {
|
|
109
|
+
onChange?.(e, !collapsibleCardIsOpen, id);
|
|
110
|
+
setCollapsibleCardIsOpen(!collapsibleCardIsOpen);
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
<div className={css.headerContent}>
|
|
114
|
+
{!!headerIconName && (
|
|
115
|
+
<div className={classify(css.iconContainer, css[semantic])}>
|
|
116
|
+
<Icon
|
|
117
|
+
name={headerIconName}
|
|
118
|
+
type={headerIconType}
|
|
119
|
+
size="small"
|
|
120
|
+
className={css[semantic]}
|
|
121
|
+
/>
|
|
122
|
+
</div>
|
|
123
|
+
)}
|
|
124
|
+
|
|
125
|
+
<Truncate>{title}</Truncate>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
{collapsibleCardIsOpen ? (
|
|
129
|
+
<Icon name="chevron-up" color="secondary" size="small" />
|
|
130
|
+
) : (
|
|
131
|
+
<Icon name="chevron-down" color="secondary" size="small" />
|
|
132
|
+
)}
|
|
133
|
+
</UnstyledButton>
|
|
134
|
+
{collapsibleCardIsOpen && (
|
|
135
|
+
<div className={classify(css.content, classNames?.content)}>
|
|
136
|
+
{children}
|
|
137
|
+
</div>
|
|
124
138
|
)}
|
|
125
|
-
</
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
</div>
|
|
130
|
-
)}
|
|
131
|
-
</div>
|
|
132
|
-
);
|
|
133
|
-
};
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
},
|
|
142
|
+
);
|
|
@@ -18,7 +18,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
18
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
20
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
-
const Dropdown = _ref => {
|
|
21
|
+
const Dropdown = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
22
22
|
let {
|
|
23
23
|
size = 'medium',
|
|
24
24
|
classNames,
|
|
@@ -72,7 +72,8 @@ const Dropdown = _ref => {
|
|
|
72
72
|
onContainerClick: e => {
|
|
73
73
|
e.stopPropagation();
|
|
74
74
|
onOpen();
|
|
75
|
-
}
|
|
75
|
+
},
|
|
76
|
+
ref: ref
|
|
76
77
|
})), isOpen && menu && /*#__PURE__*/React.createElement("div", {
|
|
77
78
|
onClickCapture: cancelNext,
|
|
78
79
|
ref: floating,
|
|
@@ -93,5 +94,5 @@ const Dropdown = _ref => {
|
|
|
93
94
|
size: menu.size || size
|
|
94
95
|
}))));
|
|
95
96
|
});
|
|
96
|
-
};
|
|
97
|
+
});
|
|
97
98
|
exports.Dropdown = Dropdown;
|
|
@@ -38,81 +38,90 @@ export type DropdownProps = {
|
|
|
38
38
|
...
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
export const Dropdown
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
export const Dropdown: React$AbstractComponent<
|
|
42
|
+
DropdownProps,
|
|
43
|
+
HTMLInputElement,
|
|
44
|
+
> = React.forwardRef<DropdownProps, HTMLInputElement>(
|
|
45
|
+
(
|
|
46
|
+
{
|
|
47
|
+
size = 'medium',
|
|
48
|
+
classNames,
|
|
49
|
+
placeholder = 'Select...',
|
|
50
|
+
onChange,
|
|
51
|
+
menu,
|
|
52
|
+
onMenuOpen,
|
|
53
|
+
onMenuClose,
|
|
54
|
+
dropdownInputText = '',
|
|
55
|
+
...inputProps
|
|
56
|
+
}: DropdownProps,
|
|
57
|
+
ref,
|
|
58
|
+
): React.Node => {
|
|
59
|
+
const dropdownRef = React.useRef();
|
|
60
|
+
const {x, y, reference, floating, strategy} = useFloating({
|
|
61
|
+
strategy: 'absolute',
|
|
62
|
+
placement: 'bottom-start',
|
|
63
|
+
whileElementsMounted: autoUpdate,
|
|
64
|
+
middleware: [flip(), offset(parseInt(spaceXXSmall))],
|
|
65
|
+
});
|
|
59
66
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
const onMenuToggle = (isOpen: boolean) => {
|
|
68
|
+
isOpen ? onMenuOpen && onMenuOpen() : onMenuClose && onMenuClose();
|
|
69
|
+
};
|
|
63
70
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}}
|
|
85
|
-
/>
|
|
86
|
-
|
|
87
|
-
{isOpen && menu && (
|
|
88
|
-
<div
|
|
89
|
-
onClickCapture={cancelNext}
|
|
90
|
-
ref={floating}
|
|
91
|
-
style={{
|
|
92
|
-
position: strategy,
|
|
93
|
-
top: y ?? spaceNone,
|
|
94
|
-
left: x ?? spaceNone,
|
|
95
|
-
width: sizeFluid,
|
|
96
|
-
backgroundColor: colorBackgroundTertiary,
|
|
71
|
+
return (
|
|
72
|
+
<ClickAway onChange={onMenuToggle}>
|
|
73
|
+
{({isOpen, onOpen, cancelNext, clickAway}) => (
|
|
74
|
+
<div
|
|
75
|
+
data-testid="Dropdown"
|
|
76
|
+
className={classify(css.dropdownContainer, classNames?.wrapper)}
|
|
77
|
+
ref={dropdownRef}
|
|
78
|
+
>
|
|
79
|
+
<Input
|
|
80
|
+
{...inputProps}
|
|
81
|
+
boxRef={reference}
|
|
82
|
+
size={size}
|
|
83
|
+
placeholder={placeholder}
|
|
84
|
+
value={dropdownInputText}
|
|
85
|
+
classNames={{box: css.inputBox}}
|
|
86
|
+
iconRightName={isOpen ? 'angle-up' : 'angle-down'}
|
|
87
|
+
readOnly
|
|
88
|
+
onContainerClick={(e) => {
|
|
89
|
+
e.stopPropagation();
|
|
90
|
+
onOpen();
|
|
97
91
|
}}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
92
|
+
ref={ref}
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
{isOpen && menu && (
|
|
96
|
+
<div
|
|
97
|
+
onClickCapture={cancelNext}
|
|
98
|
+
ref={floating}
|
|
99
|
+
style={{
|
|
100
|
+
position: strategy,
|
|
101
|
+
top: y ?? spaceNone,
|
|
102
|
+
left: x ?? spaceNone,
|
|
103
|
+
width: sizeFluid,
|
|
104
|
+
backgroundColor: colorBackgroundTertiary,
|
|
109
105
|
}}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
106
|
+
>
|
|
107
|
+
<Menu
|
|
108
|
+
{...menu}
|
|
109
|
+
onSelect={(option) => {
|
|
110
|
+
onChange && onChange(option);
|
|
111
|
+
if (
|
|
112
|
+
!menu.optionsVariant ||
|
|
113
|
+
menu.optionsVariant === 'normal'
|
|
114
|
+
) {
|
|
115
|
+
clickAway();
|
|
116
|
+
}
|
|
117
|
+
}}
|
|
118
|
+
size={menu.size || size}
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
)}
|
|
122
|
+
</div>
|
|
123
|
+
)}
|
|
124
|
+
</ClickAway>
|
|
125
|
+
);
|
|
126
|
+
},
|
|
127
|
+
);
|
|
@@ -12,7 +12,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
-
const EmptyState = _ref => {
|
|
15
|
+
const EmptyState = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
16
16
|
let {
|
|
17
17
|
classNames,
|
|
18
18
|
children,
|
|
@@ -24,7 +24,8 @@ const EmptyState = _ref => {
|
|
|
24
24
|
} = _ref;
|
|
25
25
|
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
26
26
|
"data-testid": "EmptyState",
|
|
27
|
-
className: (0, _classify.default)(_EmptyStateModule.default.wrapper, classNames?.wrapper)
|
|
27
|
+
className: (0, _classify.default)(_EmptyStateModule.default.wrapper, classNames?.wrapper),
|
|
28
|
+
ref: ref
|
|
28
29
|
}), !!imageVariant && !customImageUrl && /*#__PURE__*/React.createElement("div", {
|
|
29
30
|
className: (0, _classify.default)(_EmptyStateModule.default.image, classNames?.image)
|
|
30
31
|
}, imageVariant === 'calendar' && /*#__PURE__*/React.createElement(_EmptyImages.CalendarEmptyImage, null), imageVariant === 'data' && /*#__PURE__*/React.createElement(_EmptyImages.DataEmptyImage, null), imageVariant === 'file' && /*#__PURE__*/React.createElement(_EmptyImages.FileEmptyImage, null), imageVariant === 'message' && /*#__PURE__*/React.createElement(_EmptyImages.MessageEmptyImage, null), imageVariant === 'upload' && /*#__PURE__*/React.createElement(_EmptyImages.UploadEmptyImage, null)), customImageUrl && /*#__PURE__*/React.createElement("img", {
|
|
@@ -38,5 +39,5 @@ const EmptyState = _ref => {
|
|
|
38
39
|
}, description), !!children && /*#__PURE__*/React.createElement("div", {
|
|
39
40
|
className: (0, _classify.default)(_EmptyStateModule.default.childrenWrapper, classNames?.children)
|
|
40
41
|
}, children));
|
|
41
|
-
};
|
|
42
|
+
});
|
|
42
43
|
exports.EmptyState = EmptyState;
|
|
@@ -33,48 +33,57 @@ export type EmptyStateProps = {
|
|
|
33
33
|
...
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
export const EmptyState
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
36
|
+
export const EmptyState: React$AbstractComponent<
|
|
37
|
+
EmptyStateProps,
|
|
38
|
+
HTMLDivElement,
|
|
39
|
+
> = React.forwardRef<EmptyStateProps, HTMLDivElement>(
|
|
40
|
+
(
|
|
41
|
+
{
|
|
42
|
+
classNames,
|
|
43
|
+
children,
|
|
44
|
+
imageVariant,
|
|
45
|
+
title,
|
|
46
|
+
description,
|
|
47
|
+
customImageUrl,
|
|
48
|
+
...props
|
|
49
|
+
}: EmptyStateProps,
|
|
50
|
+
ref,
|
|
51
|
+
): React.Node => (
|
|
52
|
+
<div
|
|
53
|
+
{...props}
|
|
54
|
+
data-testid="EmptyState"
|
|
55
|
+
className={classify(css.wrapper, classNames?.wrapper)}
|
|
56
|
+
ref={ref}
|
|
57
|
+
>
|
|
58
|
+
{!!imageVariant && !customImageUrl && (
|
|
59
|
+
<div className={classify(css.image, classNames?.image)}>
|
|
60
|
+
{imageVariant === 'calendar' && <CalendarEmptyImage />}
|
|
61
|
+
{imageVariant === 'data' && <DataEmptyImage />}
|
|
62
|
+
{imageVariant === 'file' && <FileEmptyImage />}
|
|
63
|
+
{imageVariant === 'message' && <MessageEmptyImage />}
|
|
64
|
+
{imageVariant === 'upload' && <UploadEmptyImage />}
|
|
65
|
+
</div>
|
|
66
|
+
)}
|
|
67
|
+
{customImageUrl && (
|
|
68
|
+
<img
|
|
69
|
+
className={classify(css.image, classNames?.image)}
|
|
70
|
+
src={customImageUrl}
|
|
71
|
+
alt="Empty State"
|
|
72
|
+
/>
|
|
73
|
+
)}
|
|
74
|
+
{!!title && (
|
|
75
|
+
<div className={classify(css.title, classNames?.title)}>{title}</div>
|
|
76
|
+
)}
|
|
77
|
+
{!!description && (
|
|
78
|
+
<div className={classify(css.description, classNames?.description)}>
|
|
79
|
+
{description}
|
|
80
|
+
</div>
|
|
81
|
+
)}
|
|
82
|
+
{!!children && (
|
|
83
|
+
<div className={classify(css.childrenWrapper, classNames?.children)}>
|
|
84
|
+
{children}
|
|
85
|
+
</div>
|
|
86
|
+
)}
|
|
87
|
+
</div>
|
|
88
|
+
),
|
|
80
89
|
);
|
|
@@ -12,7 +12,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
-
const ErrorMessage = _ref => {
|
|
15
|
+
const ErrorMessage = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
16
16
|
let {
|
|
17
17
|
classNames,
|
|
18
18
|
children,
|
|
@@ -25,7 +25,8 @@ const ErrorMessage = _ref => {
|
|
|
25
25
|
} = _ref;
|
|
26
26
|
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
27
27
|
"data-testid": "ErrorMessage",
|
|
28
|
-
className: (0, _classify.default)(_ErrorMessageModule.default.wrapper, classNames?.wrapper)
|
|
28
|
+
className: (0, _classify.default)(_ErrorMessageModule.default.wrapper, classNames?.wrapper),
|
|
29
|
+
ref: ref
|
|
29
30
|
}), !!imageVariant && !customImageUrl && /*#__PURE__*/React.createElement("div", {
|
|
30
31
|
className: (0, _classify.default)(_ErrorMessageModule.default.image, classNames?.image)
|
|
31
32
|
}, imageVariant === 'unauthorized' && /*#__PURE__*/React.createElement(_ErrorImages.UnauthorizedImage, null), imageVariant === 'forbidden' && /*#__PURE__*/React.createElement(_ErrorImages.ForbiddenImage, null), imageVariant === 'notFound' && /*#__PURE__*/React.createElement(_ErrorImages.NotFoundImage, null), imageVariant === 'serverError' && /*#__PURE__*/React.createElement(_ErrorImages.ServerErrorImage, null)), customImageUrl && /*#__PURE__*/React.createElement("img", {
|
|
@@ -41,5 +42,5 @@ const ErrorMessage = _ref => {
|
|
|
41
42
|
}, description), !!children && /*#__PURE__*/React.createElement("div", {
|
|
42
43
|
className: (0, _classify.default)(_ErrorMessageModule.default.childrenWrapper, classNames?.children)
|
|
43
44
|
}, children));
|
|
44
|
-
};
|
|
45
|
+
});
|
|
45
46
|
exports.ErrorMessage = ErrorMessage;
|
|
@@ -34,53 +34,62 @@ export type ErrorMessageProps = {
|
|
|
34
34
|
...
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
export const ErrorMessage
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
37
|
+
export const ErrorMessage: React$AbstractComponent<
|
|
38
|
+
ErrorMessageProps,
|
|
39
|
+
HTMLDivElement,
|
|
40
|
+
> = React.forwardRef<ErrorMessageProps, HTMLDivElement>(
|
|
41
|
+
(
|
|
42
|
+
{
|
|
43
|
+
classNames,
|
|
44
|
+
children,
|
|
45
|
+
imageVariant,
|
|
46
|
+
title,
|
|
47
|
+
description,
|
|
48
|
+
customImageUrl,
|
|
49
|
+
heading,
|
|
50
|
+
...props
|
|
51
|
+
}: ErrorMessageProps,
|
|
52
|
+
ref,
|
|
53
|
+
): React.Node => (
|
|
54
|
+
<div
|
|
55
|
+
{...props}
|
|
56
|
+
data-testid="ErrorMessage"
|
|
57
|
+
className={classify(css.wrapper, classNames?.wrapper)}
|
|
58
|
+
ref={ref}
|
|
59
|
+
>
|
|
60
|
+
{!!imageVariant && !customImageUrl && (
|
|
61
|
+
<div className={classify(css.image, classNames?.image)}>
|
|
62
|
+
{imageVariant === 'unauthorized' && <UnauthorizedImage />}
|
|
63
|
+
{imageVariant === 'forbidden' && <ForbiddenImage />}
|
|
64
|
+
{imageVariant === 'notFound' && <NotFoundImage />}
|
|
65
|
+
{imageVariant === 'serverError' && <ServerErrorImage />}
|
|
66
|
+
</div>
|
|
67
|
+
)}
|
|
68
|
+
{customImageUrl && (
|
|
69
|
+
<img
|
|
70
|
+
className={classify(css.image, classNames?.image)}
|
|
71
|
+
src={customImageUrl}
|
|
72
|
+
alt="Empty State"
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
75
|
+
{!!heading && (
|
|
76
|
+
<div className={classify(css.heading, classNames?.heading)}>
|
|
77
|
+
{heading}
|
|
78
|
+
</div>
|
|
79
|
+
)}
|
|
80
|
+
{!!title && (
|
|
81
|
+
<div className={classify(css.title, classNames?.title)}>{title}</div>
|
|
82
|
+
)}
|
|
83
|
+
{!!description && (
|
|
84
|
+
<div className={classify(css.description, classNames?.description)}>
|
|
85
|
+
{description}
|
|
86
|
+
</div>
|
|
87
|
+
)}
|
|
88
|
+
{!!children && (
|
|
89
|
+
<div className={classify(css.childrenWrapper, classNames?.children)}>
|
|
90
|
+
{children}
|
|
91
|
+
</div>
|
|
92
|
+
)}
|
|
93
|
+
</div>
|
|
94
|
+
),
|
|
86
95
|
);
|
|
@@ -75,7 +75,7 @@ const AlertIcon = _ref => {
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
|
-
const InContextAlert = props => {
|
|
78
|
+
const InContextAlert = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
79
79
|
const {
|
|
80
80
|
classNames,
|
|
81
81
|
semantic = ALERT_SEMANTIC.neutral,
|
|
@@ -100,7 +100,8 @@ const InContextAlert = props => {
|
|
|
100
100
|
[_InContextAlertModule.default.information]: semantic === ALERT_SEMANTIC.information,
|
|
101
101
|
[_InContextAlertModule.default.warning]: semantic === ALERT_SEMANTIC.warning,
|
|
102
102
|
[_InContextAlertModule.default.danger]: semantic === ALERT_SEMANTIC.danger
|
|
103
|
-
}, classNames?.wrapper)
|
|
103
|
+
}, classNames?.wrapper),
|
|
104
|
+
ref: ref
|
|
104
105
|
}, /*#__PURE__*/React.createElement(AlertIcon, {
|
|
105
106
|
semantic: semantic,
|
|
106
107
|
leftIconName: leftIconName,
|
|
@@ -122,5 +123,5 @@ const InContextAlert = props => {
|
|
|
122
123
|
onClick: closeClickHandler,
|
|
123
124
|
className: _InContextAlertModule.default.closeIcon
|
|
124
125
|
}))));
|
|
125
|
-
};
|
|
126
|
+
});
|
|
126
127
|
exports.InContextAlert = InContextAlert;
|