@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
|
@@ -6,13 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.RadioButton = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
9
|
-
var _Text = require("../Text/Text");
|
|
10
9
|
var _RadioButtonModule = _interopRequireDefault(require("./RadioButton.module.css"));
|
|
11
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
11
|
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
12
|
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
13
|
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 RadioButton = _ref => {
|
|
14
|
+
const RadioButton = /*#__PURE__*/React.forwardRef((_ref, forwardRef) => {
|
|
16
15
|
let {
|
|
17
16
|
children,
|
|
18
17
|
disabled = false,
|
|
@@ -22,18 +21,23 @@ const RadioButton = _ref => {
|
|
|
22
21
|
selectedValue,
|
|
23
22
|
onChange,
|
|
24
23
|
align = 'vertical',
|
|
25
|
-
|
|
24
|
+
classNames,
|
|
26
25
|
error = false,
|
|
27
26
|
tabIndex = 0,
|
|
27
|
+
ariaLabel = '',
|
|
28
28
|
...props
|
|
29
29
|
} = _ref;
|
|
30
30
|
const radioInput = /*#__PURE__*/React.createRef();
|
|
31
|
+
React.useImperativeHandle(forwardRef, () => radioInput.current);
|
|
31
32
|
const checked = selectedValue === value;
|
|
32
33
|
React.useEffect(() => {
|
|
33
34
|
if (radioInput.current && focused) {
|
|
34
35
|
radioInput.current.focus();
|
|
35
36
|
}
|
|
36
37
|
}, [focused]);
|
|
38
|
+
const onWrapClickHandler = () => {
|
|
39
|
+
radioInput.current?.click();
|
|
40
|
+
};
|
|
37
41
|
const onChangeHandler = e => {
|
|
38
42
|
if (!disabled) {
|
|
39
43
|
onChange && onChange(e?.target?.value);
|
|
@@ -44,11 +48,12 @@ const RadioButton = _ref => {
|
|
|
44
48
|
onChangeHandler(e);
|
|
45
49
|
}
|
|
46
50
|
};
|
|
47
|
-
return /*#__PURE__*/React.createElement("
|
|
51
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
48
52
|
className: (0, _classify.default)(_RadioButtonModule.default.container, {
|
|
49
53
|
[_RadioButtonModule.default.horizontalRadioButton]: align === 'horizontal-fixed',
|
|
50
54
|
[_RadioButtonModule.default.fluidRadioButton]: align === 'horizontal-fluid'
|
|
51
|
-
},
|
|
55
|
+
}, classNames?.wrapper),
|
|
56
|
+
onClick: onWrapClickHandler
|
|
52
57
|
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
53
58
|
type: "radio",
|
|
54
59
|
checked: checked,
|
|
@@ -64,10 +69,11 @@ const RadioButton = _ref => {
|
|
|
64
69
|
onKeyDown: onKeyDownHandler,
|
|
65
70
|
tabIndex: disabled ? -1 : tabIndex,
|
|
66
71
|
name: name,
|
|
67
|
-
value: value || ''
|
|
68
|
-
|
|
72
|
+
value: value || '',
|
|
73
|
+
"aria-label": ariaLabel || children
|
|
74
|
+
}, props)), React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
69
75
|
color: "secondary",
|
|
70
|
-
className: _RadioButtonModule.default.radioLabel
|
|
76
|
+
className: (0, _classify.default)(_RadioButtonModule.default.radioLabel, classNames?.label)
|
|
71
77
|
}, children));
|
|
72
|
-
};
|
|
78
|
+
});
|
|
73
79
|
exports.RadioButton = RadioButton;
|
|
@@ -4,7 +4,6 @@ import * as React from 'react';
|
|
|
4
4
|
|
|
5
5
|
import type {GroupAlign} from '../../types/common';
|
|
6
6
|
import classify from '../../utils/classify';
|
|
7
|
-
import {FormLabelMedium} from '../Text/Text';
|
|
8
7
|
|
|
9
8
|
import css from './RadioButton.module.css';
|
|
10
9
|
|
|
@@ -15,6 +14,8 @@ import css from './RadioButton.module.css';
|
|
|
15
14
|
* nesting labels is a bad idea.
|
|
16
15
|
*/
|
|
17
16
|
|
|
17
|
+
type ClassNames = $ReadOnly<{wrapper?: string, label?: string}>;
|
|
18
|
+
|
|
18
19
|
export type RadioButtonProps = {
|
|
19
20
|
children?: React.Node,
|
|
20
21
|
value?: string,
|
|
@@ -23,82 +24,102 @@ export type RadioButtonProps = {
|
|
|
23
24
|
name?: string,
|
|
24
25
|
selectedValue?: string,
|
|
25
26
|
align?: GroupAlign,
|
|
26
|
-
|
|
27
|
+
classNames?: ClassNames,
|
|
27
28
|
error?: boolean,
|
|
28
29
|
onChange?: (newValue: string) => mixed,
|
|
29
30
|
tabIndex?: number,
|
|
31
|
+
ariaLabel?: string,
|
|
30
32
|
};
|
|
31
33
|
|
|
32
|
-
export const RadioButton
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
export const RadioButton: React$AbstractComponent<
|
|
35
|
+
RadioButtonProps,
|
|
36
|
+
HTMLInputElement,
|
|
37
|
+
> = React.forwardRef<RadioButtonProps, HTMLInputElement>(
|
|
38
|
+
(
|
|
39
|
+
{
|
|
40
|
+
children,
|
|
41
|
+
disabled = false,
|
|
42
|
+
value = '',
|
|
43
|
+
focused = false,
|
|
44
|
+
name = 'radio',
|
|
45
|
+
selectedValue,
|
|
46
|
+
onChange,
|
|
47
|
+
align = 'vertical',
|
|
48
|
+
classNames,
|
|
49
|
+
error = false,
|
|
50
|
+
tabIndex = 0,
|
|
51
|
+
ariaLabel = '',
|
|
52
|
+
...props
|
|
53
|
+
}: RadioButtonProps,
|
|
54
|
+
forwardRef,
|
|
55
|
+
): React.Node => {
|
|
56
|
+
const radioInput = React.createRef<HTMLInputElement>();
|
|
57
|
+
React.useImperativeHandle(forwardRef, () => radioInput.current);
|
|
47
58
|
|
|
48
|
-
|
|
59
|
+
const checked = selectedValue === value;
|
|
49
60
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
if (radioInput.current && focused) {
|
|
63
|
+
radioInput.current.focus();
|
|
64
|
+
}
|
|
65
|
+
}, [focused]);
|
|
55
66
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
};
|
|
67
|
+
const onWrapClickHandler = () => {
|
|
68
|
+
radioInput.current?.click();
|
|
69
|
+
};
|
|
61
70
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
const onChangeHandler = (e) => {
|
|
72
|
+
if (!disabled) {
|
|
73
|
+
onChange && onChange(e?.target?.value);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
67
76
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
className
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
{
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
77
|
+
const onKeyDownHandler = (e) => {
|
|
78
|
+
if (e.key === 'Enter') {
|
|
79
|
+
onChangeHandler(e);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<div
|
|
85
|
+
className={classify(
|
|
86
|
+
css.container,
|
|
87
|
+
{
|
|
88
|
+
[css.horizontalRadioButton]: align === 'horizontal-fixed',
|
|
89
|
+
[css.fluidRadioButton]: align === 'horizontal-fluid',
|
|
90
|
+
},
|
|
91
|
+
classNames?.wrapper,
|
|
92
|
+
)}
|
|
93
|
+
onClick={onWrapClickHandler}
|
|
94
|
+
>
|
|
95
|
+
<input
|
|
96
|
+
type="radio"
|
|
97
|
+
checked={checked}
|
|
98
|
+
disabled={disabled}
|
|
99
|
+
className={classify(css.radio, {
|
|
100
|
+
[css.unselected]: !checked && !disabled && !error,
|
|
101
|
+
[css.selected]: checked && !disabled && !error,
|
|
102
|
+
[css.disabled]: disabled,
|
|
103
|
+
[css.error]: error && !disabled,
|
|
104
|
+
})}
|
|
105
|
+
ref={radioInput}
|
|
106
|
+
onChange={onChangeHandler}
|
|
107
|
+
onKeyDown={onKeyDownHandler}
|
|
108
|
+
tabIndex={disabled ? -1 : tabIndex}
|
|
109
|
+
name={name}
|
|
110
|
+
value={value || ''}
|
|
111
|
+
aria-label={ariaLabel || children}
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
{React.Children.count(children) > 0 && (
|
|
115
|
+
<div
|
|
116
|
+
color="secondary"
|
|
117
|
+
className={classify(css.radioLabel, classNames?.label)}
|
|
118
|
+
>
|
|
119
|
+
{children}
|
|
120
|
+
</div>
|
|
121
|
+
)}
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
},
|
|
125
|
+
);
|
|
@@ -35,6 +35,8 @@
|
|
|
35
35
|
flex-direction: row;
|
|
36
36
|
gap: spaceSmall;
|
|
37
37
|
cursor: pointer;
|
|
38
|
+
align-items: center;
|
|
39
|
+
cursor: pointer;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
.radio {
|
|
@@ -88,7 +90,8 @@
|
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
.radioLabel {
|
|
91
|
-
composes:
|
|
93
|
+
composes: formLabelMedium from '../../styles/typography.module.css';
|
|
94
|
+
composes: secondary from '../../styles/typography.module.css';
|
|
92
95
|
}
|
|
93
96
|
|
|
94
97
|
.horizontalRadioButton {
|
|
@@ -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
|
|
|
15
|
-
const RadioGroup = _ref => {
|
|
15
|
+
const RadioGroup = /*#__PURE__*/React.forwardRef((_ref, forwardRef) => {
|
|
16
16
|
let {
|
|
17
17
|
align = 'vertical',
|
|
18
18
|
name,
|
|
@@ -47,10 +47,11 @@ const RadioGroup = _ref => {
|
|
|
47
47
|
[_RadioGroupModule.default.vertical]: align === 'vertical',
|
|
48
48
|
[_RadioGroupModule.default.horizontal]: align === 'horizontal-fixed',
|
|
49
49
|
[_RadioGroupModule.default.horizontalFluid]: align === 'horizontal-fluid'
|
|
50
|
-
}, classNames?.radioGroup)
|
|
50
|
+
}, classNames?.radioGroup),
|
|
51
|
+
ref: forwardRef
|
|
51
52
|
}, childrenWithProps), error && /*#__PURE__*/React.createElement(_Text.BodySmall, {
|
|
52
53
|
color: "danger",
|
|
53
54
|
className: classNames?.errorText
|
|
54
55
|
}, errorText));
|
|
55
|
-
};
|
|
56
|
+
});
|
|
56
57
|
exports.RadioGroup = RadioGroup;
|
|
@@ -32,54 +32,63 @@ export type RadioGroupProps = {
|
|
|
32
32
|
errorText?: string,
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
export const RadioGroup
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
export const RadioGroup: React$AbstractComponent<
|
|
36
|
+
RadioGroupProps,
|
|
37
|
+
HTMLDivElement,
|
|
38
|
+
> = React.forwardRef<RadioGroupProps, HTMLDivElement>(
|
|
39
|
+
(
|
|
40
|
+
{
|
|
41
|
+
align = 'vertical',
|
|
42
|
+
name,
|
|
43
|
+
value,
|
|
44
|
+
onChange,
|
|
45
|
+
children,
|
|
46
|
+
classNames,
|
|
47
|
+
error = false,
|
|
48
|
+
errorText = '',
|
|
49
|
+
}: RadioGroupProps,
|
|
50
|
+
forwardRef,
|
|
51
|
+
): React.Node => {
|
|
52
|
+
const onChangeHandler = (value) => {
|
|
53
|
+
if (onChange) {
|
|
54
|
+
onChange(value);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
50
57
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
const childrenWithProps = React.Children.map(children, (child) => {
|
|
59
|
+
if (React.isValidElement(child)) {
|
|
60
|
+
return React.cloneElement(child, {
|
|
61
|
+
name,
|
|
62
|
+
selectedValue: value,
|
|
63
|
+
onChange: onChangeHandler,
|
|
64
|
+
align,
|
|
65
|
+
error,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return child;
|
|
69
|
+
});
|
|
63
70
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
return (
|
|
72
|
+
<div className={classify(css.radioGroupContainer, classNames?.wrapper)}>
|
|
73
|
+
<div
|
|
74
|
+
className={classify(
|
|
75
|
+
{
|
|
76
|
+
[css.vertical]: align === 'vertical',
|
|
77
|
+
[css.horizontal]: align === 'horizontal-fixed',
|
|
78
|
+
[css.horizontalFluid]: align === 'horizontal-fluid',
|
|
79
|
+
},
|
|
80
|
+
classNames?.radioGroup,
|
|
81
|
+
)}
|
|
82
|
+
ref={forwardRef}
|
|
83
|
+
>
|
|
84
|
+
{childrenWithProps}
|
|
85
|
+
</div>
|
|
86
|
+
{error && (
|
|
87
|
+
<BodySmall color="danger" className={classNames?.errorText}>
|
|
88
|
+
{errorText}
|
|
89
|
+
</BodySmall>
|
|
74
90
|
)}
|
|
75
|
-
>
|
|
76
|
-
{childrenWithProps}
|
|
77
91
|
</div>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
</BodySmall>
|
|
82
|
-
)}
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
};
|
|
92
|
+
);
|
|
93
|
+
},
|
|
94
|
+
);
|
|
@@ -13,7 +13,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
13
13
|
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); }
|
|
14
14
|
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; }
|
|
15
15
|
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); }
|
|
16
|
-
const SearchInput = _ref => {
|
|
16
|
+
const SearchInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
17
17
|
let {
|
|
18
18
|
value,
|
|
19
19
|
disabled,
|
|
@@ -33,6 +33,7 @@ const SearchInput = _ref => {
|
|
|
33
33
|
className: (0, _classify.default)(_SearchInputModule.default.searchInputWrapper, classNames?.wrapper)
|
|
34
34
|
}, /*#__PURE__*/React.createElement(_Input.Input, _extends({}, searchInputProps, {
|
|
35
35
|
type: "text",
|
|
36
|
+
ref: ref,
|
|
36
37
|
classNames: {
|
|
37
38
|
iconRight: value && !(disabled || locked) ? _SearchInputModule.default.clickable : '',
|
|
38
39
|
iconLeft: value && !disabled ? _SearchInputModule.default.primaryText : '',
|
|
@@ -55,5 +56,5 @@ const SearchInput = _ref => {
|
|
|
55
56
|
className: _SearchInputModule.default.loader,
|
|
56
57
|
size: "small"
|
|
57
58
|
})));
|
|
58
|
-
};
|
|
59
|
+
});
|
|
59
60
|
exports.SearchInput = SearchInput;
|
|
@@ -24,54 +24,63 @@ export type SearchInputProps = {
|
|
|
24
24
|
...
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export const SearchInput
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
export const SearchInput: React$AbstractComponent<
|
|
28
|
+
SearchInputProps,
|
|
29
|
+
HTMLInputElement,
|
|
30
|
+
> = React.forwardRef<SearchInputProps, HTMLInputElement>(
|
|
31
|
+
(
|
|
32
|
+
{
|
|
33
|
+
value,
|
|
34
|
+
disabled,
|
|
35
|
+
locked,
|
|
36
|
+
placeholder = 'Search...',
|
|
37
|
+
classNames,
|
|
38
|
+
onClear,
|
|
39
|
+
isLoading,
|
|
40
|
+
size,
|
|
41
|
+
iconLeftName = 'magnifying-glass',
|
|
42
|
+
...searchInputProps
|
|
43
|
+
}: SearchInputProps,
|
|
44
|
+
ref,
|
|
45
|
+
): React.Node => {
|
|
46
|
+
const handleClearClick = () => {
|
|
47
|
+
onClear?.();
|
|
48
|
+
};
|
|
42
49
|
|
|
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
|
-
|
|
50
|
+
return (
|
|
51
|
+
<div className={classify(css.searchInputWrapper, classNames?.wrapper)}>
|
|
52
|
+
<Input
|
|
53
|
+
{...searchInputProps}
|
|
54
|
+
type="text"
|
|
55
|
+
ref={ref}
|
|
56
|
+
classNames={{
|
|
57
|
+
iconRight: value && !(disabled || locked) ? css.clickable : '',
|
|
58
|
+
iconLeft: value && !disabled ? css.primaryText : '',
|
|
59
|
+
box: classNames?.box,
|
|
60
|
+
}}
|
|
61
|
+
placeholder={placeholder}
|
|
62
|
+
value={value}
|
|
63
|
+
disabled={disabled}
|
|
64
|
+
locked={locked}
|
|
65
|
+
iconLeftName={iconLeftName}
|
|
66
|
+
size={size}
|
|
67
|
+
iconRightName={value && !(disabled || locked) ? 'xmark' : 'fw'}
|
|
68
|
+
onIconRightClick={handleClearClick}
|
|
69
|
+
/>
|
|
70
|
+
{isLoading && (
|
|
71
|
+
<div
|
|
72
|
+
className={classify(css.loaderContainer, {
|
|
73
|
+
[css.small]: size === 'small',
|
|
74
|
+
})}
|
|
75
|
+
>
|
|
76
|
+
<CircularLoader
|
|
77
|
+
colorToken="colorFillPrimary"
|
|
78
|
+
className={css.loader}
|
|
79
|
+
size="small"
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
)}
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
);
|
|
@@ -112,7 +112,7 @@ const MENU_NAME_LIST = Object.freeze({
|
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
exports.MENU_NAME_LIST = MENU_NAME_LIST;
|
|
115
|
-
const SideMenuLink = _ref => {
|
|
115
|
+
const SideMenuLink = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
116
116
|
let {
|
|
117
117
|
classNames,
|
|
118
118
|
pageNameKey,
|
|
@@ -131,7 +131,8 @@ const SideMenuLink = _ref => {
|
|
|
131
131
|
[_SideMenuLinkModule.default.disabled]: disabled,
|
|
132
132
|
[_SideMenuLinkModule.default.closed]: !opened
|
|
133
133
|
}, classNames?.wrapper),
|
|
134
|
-
onClick: onChangeHandler
|
|
134
|
+
onClick: onChangeHandler,
|
|
135
|
+
ref: ref
|
|
135
136
|
}, pageNameKey && MENU_NAME_LIST[pageNameKey] ? /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
136
137
|
type: MENU_NAME_LIST[pageNameKey].iconType,
|
|
137
138
|
name: MENU_NAME_LIST[pageNameKey].iconName,
|
|
@@ -142,5 +143,5 @@ const SideMenuLink = _ref => {
|
|
|
142
143
|
color: _Text.TEXT_COLORS.inverseSecondary,
|
|
143
144
|
className: _SideMenuLinkModule.default.menuText
|
|
144
145
|
}, MENU_NAME_LIST[pageNameKey].title) : null);
|
|
145
|
-
};
|
|
146
|
+
});
|
|
146
147
|
exports.SideMenuLink = SideMenuLink;
|