@spaced-out/ui-design-system 0.1.15 → 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 +15 -0
- package/CONTRIBUTING.md +52 -6
- package/README.md +144 -8
- package/gulpfile.js +1 -0
- package/lib/components/Avatar/Avatar.module.css +8 -2
- package/lib/components/AvatarGroup/AvatarGroup.js +25 -14
- package/lib/components/AvatarGroup/AvatarGroup.js.flow +118 -103
- 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/Checkbox/Checkbox.js +15 -10
- package/lib/components/Checkbox/Checkbox.js.flow +121 -100
- package/lib/components/Checkbox/Checkbox.module.css +4 -1
- package/lib/components/Checkbox/CheckboxGroup.js +4 -3
- package/lib/components/Checkbox/CheckboxGroup.js.flow +76 -65
- 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/RadioButton/RadioButton.js +15 -9
- package/lib/components/RadioButton/RadioButton.js.flow +91 -70
- package/lib/components/RadioButton/RadioButton.module.css +4 -1
- package/lib/components/RadioButton/RadioGroup.js +4 -3
- package/lib/components/RadioButton/RadioGroup.js.flow +56 -47
- 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/Toast/Toast.js +8 -10
- package/lib/components/Toast/Toast.js.flow +19 -27
- package/lib/components/Toast/Toast.module.css +8 -0
- package/lib/components/Toggle/Toggle.js +11 -7
- package/lib/components/Toggle/Toggle.js.flow +16 -12
- package/lib/components/Toggle/Toggle.module.css +2 -0
- 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/click-away.js.flow +1 -1
- package/lib/utils/index.js +93 -0
- package/lib/utils/index.js.flow +10 -0
- package/package.json +2 -1
|
@@ -12,17 +12,22 @@ 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
|
|
|
15
|
-
const CircularLoader = _ref => {
|
|
15
|
+
const CircularLoader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
16
16
|
let {
|
|
17
17
|
size = 'medium',
|
|
18
18
|
className,
|
|
19
|
-
colorToken = 'colorFillPrimary'
|
|
19
|
+
colorToken = 'colorFillPrimary',
|
|
20
|
+
ariaLabel = 'Loading'
|
|
20
21
|
} = _ref;
|
|
21
22
|
return /*#__PURE__*/React.createElement("div", {
|
|
22
23
|
className: (0, _classify.default)(_CircularLoaderModule.default.container, {
|
|
23
24
|
[_CircularLoaderModule.default.mediumContainer]: size === 'medium',
|
|
24
25
|
[_CircularLoaderModule.default.smallContainer]: size === 'small'
|
|
25
|
-
}, className)
|
|
26
|
+
}, className),
|
|
27
|
+
ref: ref,
|
|
28
|
+
"aria-label": ariaLabel,
|
|
29
|
+
role: "alert",
|
|
30
|
+
"aria-busy": "true"
|
|
26
31
|
}, /*#__PURE__*/React.createElement("div", {
|
|
27
32
|
className: _CircularLoaderModule.default.spinLoader,
|
|
28
33
|
"aria-hidden": "true"
|
|
@@ -37,5 +42,5 @@ const CircularLoader = _ref => {
|
|
|
37
42
|
'--color': COLORS[colorToken]
|
|
38
43
|
}
|
|
39
44
|
})));
|
|
40
|
-
};
|
|
45
|
+
});
|
|
41
46
|
exports.CircularLoader = CircularLoader;
|
|
@@ -11,34 +11,48 @@ import css from './CircularLoader.module.css';
|
|
|
11
11
|
export type CircularLoaderProps = {
|
|
12
12
|
size?: 'large' | 'medium' | 'small',
|
|
13
13
|
className?: string,
|
|
14
|
+
ariaLabel?: string,
|
|
14
15
|
// TODO: update it to permissible colors
|
|
15
16
|
colorToken?: $Keys<typeof COLORS>,
|
|
16
17
|
};
|
|
17
18
|
|
|
18
|
-
export const CircularLoader
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
css.container,
|
|
26
|
-
{
|
|
27
|
-
[css.mediumContainer]: size === 'medium',
|
|
28
|
-
[css.smallContainer]: size === 'small',
|
|
29
|
-
},
|
|
19
|
+
export const CircularLoader: React$AbstractComponent<
|
|
20
|
+
CircularLoaderProps,
|
|
21
|
+
HTMLDivElement,
|
|
22
|
+
> = React.forwardRef<CircularLoaderProps, HTMLDivElement>(
|
|
23
|
+
(
|
|
24
|
+
{
|
|
25
|
+
size = 'medium',
|
|
30
26
|
className,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
colorToken = 'colorFillPrimary',
|
|
28
|
+
ariaLabel = 'Loading',
|
|
29
|
+
}: CircularLoaderProps,
|
|
30
|
+
ref,
|
|
31
|
+
): React.Node => (
|
|
32
|
+
<div
|
|
33
|
+
className={classify(
|
|
34
|
+
css.container,
|
|
35
|
+
{
|
|
36
|
+
[css.mediumContainer]: size === 'medium',
|
|
37
|
+
[css.smallContainer]: size === 'small',
|
|
38
|
+
},
|
|
39
|
+
className,
|
|
40
|
+
)}
|
|
41
|
+
ref={ref}
|
|
42
|
+
aria-label={ariaLabel}
|
|
43
|
+
role="alert"
|
|
44
|
+
aria-busy="true"
|
|
45
|
+
>
|
|
46
|
+
<div className={css.spinLoader} aria-hidden="true">
|
|
47
|
+
<div
|
|
48
|
+
className={css.outerCircle}
|
|
49
|
+
style={{'--color': COLORS[colorToken]}}
|
|
50
|
+
></div>
|
|
51
|
+
<div
|
|
52
|
+
className={css.ellipse}
|
|
53
|
+
style={{'--color': COLORS[colorToken]}}
|
|
54
|
+
></div>
|
|
55
|
+
</div>
|
|
42
56
|
</div>
|
|
43
|
-
|
|
57
|
+
),
|
|
44
58
|
);
|
|
@@ -42,7 +42,7 @@ const CollapsibleCardContent = _ref2 => {
|
|
|
42
42
|
}, children);
|
|
43
43
|
};
|
|
44
44
|
exports.CollapsibleCardContent = CollapsibleCardContent;
|
|
45
|
-
const CollapsibleCard = _ref3 => {
|
|
45
|
+
const CollapsibleCard = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
46
46
|
let {
|
|
47
47
|
id,
|
|
48
48
|
isOpen,
|
|
@@ -57,7 +57,8 @@ const CollapsibleCard = _ref3 => {
|
|
|
57
57
|
const [collapsibleCardIsOpen, setCollapsibleCardIsOpen] = React.useState(Boolean(isOpen));
|
|
58
58
|
return /*#__PURE__*/React.createElement("div", {
|
|
59
59
|
"data-testid": "CollapsibleCard",
|
|
60
|
-
className: (0, _classify.default)(_CollapsibleCardModule.default.wrapper, classNames?.wrapper)
|
|
60
|
+
className: (0, _classify.default)(_CollapsibleCardModule.default.wrapper, classNames?.wrapper),
|
|
61
|
+
ref: ref
|
|
61
62
|
}, /*#__PURE__*/React.createElement(_Button.UnstyledButton, {
|
|
62
63
|
className: (0, _classify.default)(_CollapsibleCardModule.default.header, {
|
|
63
64
|
[_CollapsibleCardModule.default.isOpen]: collapsibleCardIsOpen
|
|
@@ -86,5 +87,5 @@ const CollapsibleCard = _ref3 => {
|
|
|
86
87
|
})), collapsibleCardIsOpen && /*#__PURE__*/React.createElement("div", {
|
|
87
88
|
className: (0, _classify.default)(_CollapsibleCardModule.default.content, classNames?.content)
|
|
88
89
|
}, children));
|
|
89
|
-
};
|
|
90
|
+
});
|
|
90
91
|
exports.CollapsibleCard = CollapsibleCard;
|
|
@@ -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;
|