@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
|
@@ -120,77 +120,83 @@ const AlertIcon = ({
|
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
-
export const InContextAlert
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
123
|
+
export const InContextAlert: React$AbstractComponent<
|
|
124
|
+
InContextAlertProps,
|
|
125
|
+
HTMLDivElement,
|
|
126
|
+
> = React.forwardRef<InContextAlertProps, HTMLDivElement>(
|
|
127
|
+
(props: InContextAlertProps, ref): React.Node => {
|
|
128
|
+
const {
|
|
129
|
+
classNames,
|
|
130
|
+
semantic = ALERT_SEMANTIC.neutral,
|
|
131
|
+
dismissable,
|
|
132
|
+
children,
|
|
133
|
+
selfDismiss = false,
|
|
134
|
+
leftIconName = '',
|
|
135
|
+
onCloseClick,
|
|
136
|
+
actionText = '',
|
|
137
|
+
onAction,
|
|
138
|
+
leftIconType,
|
|
139
|
+
} = props;
|
|
140
|
+
const [dismissed, setDismissed] = React.useState(false);
|
|
141
|
+
const closeClickHandler = (e) => {
|
|
142
|
+
onCloseClick && onCloseClick(e);
|
|
143
|
+
selfDismiss && setDismissed(true);
|
|
144
|
+
};
|
|
141
145
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
<
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
{
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
146
|
+
return (
|
|
147
|
+
<>
|
|
148
|
+
{!dismissed && (
|
|
149
|
+
<div
|
|
150
|
+
className={classify(
|
|
151
|
+
css.alertContainer,
|
|
152
|
+
{
|
|
153
|
+
[css.neutral]: semantic === ALERT_SEMANTIC.neutral,
|
|
154
|
+
[css.success]: semantic === ALERT_SEMANTIC.success,
|
|
155
|
+
[css.information]: semantic === ALERT_SEMANTIC.information,
|
|
156
|
+
[css.warning]: semantic === ALERT_SEMANTIC.warning,
|
|
157
|
+
[css.danger]: semantic === ALERT_SEMANTIC.danger,
|
|
158
|
+
},
|
|
159
|
+
classNames?.wrapper,
|
|
160
|
+
)}
|
|
161
|
+
ref={ref}
|
|
162
|
+
>
|
|
163
|
+
<AlertIcon
|
|
164
|
+
semantic={semantic}
|
|
165
|
+
leftIconName={leftIconName}
|
|
166
|
+
leftIconType={leftIconType}
|
|
167
|
+
/>
|
|
168
|
+
{React.Children.count(children) > 0 && (
|
|
169
|
+
<SubTitleExtraSmall className={classify(classNames?.alertText)}>
|
|
170
|
+
<Truncate line={2}>{children}</Truncate>
|
|
171
|
+
</SubTitleExtraSmall>
|
|
172
|
+
)}
|
|
173
|
+
{!!(actionText || dismissable) && (
|
|
174
|
+
<div
|
|
175
|
+
className={classify(
|
|
176
|
+
css.actionContainer,
|
|
177
|
+
classNames?.actionContainer,
|
|
178
|
+
)}
|
|
179
|
+
>
|
|
180
|
+
{!!actionText && (
|
|
181
|
+
<Link onClick={onAction} color="primary">
|
|
182
|
+
{actionText}
|
|
183
|
+
</Link>
|
|
184
|
+
)}
|
|
185
|
+
{!!dismissable && (
|
|
186
|
+
<ClickableIcon
|
|
187
|
+
color={TEXT_COLORS.primary}
|
|
188
|
+
name="close"
|
|
189
|
+
size="small"
|
|
190
|
+
type="regular"
|
|
191
|
+
onClick={closeClickHandler}
|
|
192
|
+
className={css.closeIcon}
|
|
193
|
+
/>
|
|
194
|
+
)}
|
|
195
|
+
</div>
|
|
196
|
+
)}
|
|
197
|
+
</div>
|
|
198
|
+
)}
|
|
199
|
+
</>
|
|
200
|
+
);
|
|
201
|
+
},
|
|
202
|
+
);
|
|
@@ -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 InlineDropdown = _ref => {
|
|
21
|
+
const InlineDropdown = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
22
22
|
let {
|
|
23
23
|
anchorPosition = 'bottom-start',
|
|
24
24
|
size = 'medium',
|
|
@@ -31,7 +31,8 @@ const InlineDropdown = _ref => {
|
|
|
31
31
|
children,
|
|
32
32
|
...restButtonProps
|
|
33
33
|
} = _ref;
|
|
34
|
-
const menuBtnRef = React.useRef();
|
|
34
|
+
const menuBtnRef = React.useRef(null);
|
|
35
|
+
React.useImperativeHandle(ref, () => menuBtnRef.current);
|
|
35
36
|
const {
|
|
36
37
|
x,
|
|
37
38
|
y,
|
|
@@ -96,5 +97,5 @@ const InlineDropdown = _ref => {
|
|
|
96
97
|
size: menu.size || 'medium'
|
|
97
98
|
}))));
|
|
98
99
|
});
|
|
99
|
-
};
|
|
100
|
+
});
|
|
100
101
|
exports.InlineDropdown = InlineDropdown;
|
|
@@ -45,96 +45,105 @@ export type InlineDropdownProps = {
|
|
|
45
45
|
...
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
export const InlineDropdown
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
export const InlineDropdown: React$AbstractComponent<
|
|
49
|
+
InlineDropdownProps,
|
|
50
|
+
HTMLDivElement,
|
|
51
|
+
> = React.forwardRef<InlineDropdownProps, HTMLDivElement>(
|
|
52
|
+
(
|
|
53
|
+
{
|
|
54
|
+
anchorPosition = 'bottom-start',
|
|
55
|
+
size = 'medium',
|
|
56
|
+
onOptionSelect,
|
|
57
|
+
menu,
|
|
58
|
+
classNames,
|
|
59
|
+
disabled,
|
|
60
|
+
onMenuOpen,
|
|
61
|
+
onMenuClose,
|
|
62
|
+
children,
|
|
63
|
+
...restButtonProps
|
|
64
|
+
}: InlineDropdownProps,
|
|
65
|
+
ref,
|
|
66
|
+
): React.Node => {
|
|
67
|
+
const menuBtnRef = React.useRef(null);
|
|
68
|
+
React.useImperativeHandle(ref, () => menuBtnRef.current);
|
|
69
|
+
const {x, y, reference, floating, strategy} = useFloating({
|
|
70
|
+
strategy: 'absolute',
|
|
71
|
+
placement: anchorPosition,
|
|
72
|
+
whileElementsMounted: autoUpdate,
|
|
73
|
+
middleware: [shift(), flip(), offset(parseInt(spaceXXSmall))],
|
|
74
|
+
});
|
|
67
75
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
const onMenuToggle = (isOpen: boolean) => {
|
|
77
|
+
isOpen ? onMenuOpen && onMenuOpen() : onMenuClose && onMenuClose();
|
|
78
|
+
};
|
|
71
79
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
className={classify(
|
|
78
|
-
css.inlineDropdownContainer,
|
|
79
|
-
classNames?.dropdownContainer,
|
|
80
|
-
)}
|
|
81
|
-
ref={menuBtnRef}
|
|
82
|
-
>
|
|
83
|
-
<UnstyledButton
|
|
84
|
-
{...restButtonProps}
|
|
85
|
-
disabled={disabled}
|
|
86
|
-
ref={reference}
|
|
87
|
-
onClick={(e) => {
|
|
88
|
-
e.stopPropagation();
|
|
89
|
-
onOpen();
|
|
90
|
-
}}
|
|
80
|
+
return (
|
|
81
|
+
<ClickAway onChange={onMenuToggle}>
|
|
82
|
+
{({isOpen, onOpen, cancelNext, clickAway}) => (
|
|
83
|
+
<div
|
|
84
|
+
data-testid="InlineDropdown"
|
|
91
85
|
className={classify(
|
|
92
|
-
css.
|
|
93
|
-
|
|
94
|
-
[css.disabled]: disabled,
|
|
95
|
-
},
|
|
96
|
-
css[size],
|
|
97
|
-
classNames?.buttonWrapper,
|
|
86
|
+
css.inlineDropdownContainer,
|
|
87
|
+
classNames?.dropdownContainer,
|
|
98
88
|
)}
|
|
89
|
+
ref={menuBtnRef}
|
|
99
90
|
>
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
})}
|
|
108
|
-
/>
|
|
109
|
-
</UnstyledButton>
|
|
110
|
-
{isOpen && menu && (
|
|
111
|
-
<div
|
|
112
|
-
onClickCapture={cancelNext}
|
|
113
|
-
ref={floating}
|
|
114
|
-
style={{
|
|
115
|
-
display: 'flex',
|
|
116
|
-
position: strategy,
|
|
117
|
-
top: y ?? spaceNone,
|
|
118
|
-
left: x ?? spaceNone,
|
|
91
|
+
<UnstyledButton
|
|
92
|
+
{...restButtonProps}
|
|
93
|
+
disabled={disabled}
|
|
94
|
+
ref={reference}
|
|
95
|
+
onClick={(e) => {
|
|
96
|
+
e.stopPropagation();
|
|
97
|
+
onOpen();
|
|
119
98
|
}}
|
|
99
|
+
className={classify(
|
|
100
|
+
css.inlineButton,
|
|
101
|
+
{
|
|
102
|
+
[css.disabled]: disabled,
|
|
103
|
+
},
|
|
104
|
+
css[size],
|
|
105
|
+
classNames?.buttonWrapper,
|
|
106
|
+
)}
|
|
120
107
|
>
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
clickAway();
|
|
130
|
-
}
|
|
131
|
-
}}
|
|
132
|
-
size={menu.size || 'medium'}
|
|
108
|
+
<Truncate>{children}</Truncate>
|
|
109
|
+
<Icon
|
|
110
|
+
name={isOpen ? 'caret-up' : 'caret-down'}
|
|
111
|
+
size="small"
|
|
112
|
+
type="solid"
|
|
113
|
+
className={classify({
|
|
114
|
+
[css.disabled]: disabled,
|
|
115
|
+
})}
|
|
133
116
|
/>
|
|
134
|
-
</
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
117
|
+
</UnstyledButton>
|
|
118
|
+
{isOpen && menu && (
|
|
119
|
+
<div
|
|
120
|
+
onClickCapture={cancelNext}
|
|
121
|
+
ref={floating}
|
|
122
|
+
style={{
|
|
123
|
+
display: 'flex',
|
|
124
|
+
position: strategy,
|
|
125
|
+
top: y ?? spaceNone,
|
|
126
|
+
left: x ?? spaceNone,
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
<Menu
|
|
130
|
+
{...menu}
|
|
131
|
+
onSelect={(option) => {
|
|
132
|
+
onOptionSelect && onOptionSelect(option);
|
|
133
|
+
if (
|
|
134
|
+
!menu.optionsVariant ||
|
|
135
|
+
menu.optionsVariant === 'normal'
|
|
136
|
+
) {
|
|
137
|
+
clickAway();
|
|
138
|
+
}
|
|
139
|
+
}}
|
|
140
|
+
size={menu.size || 'medium'}
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
</div>
|
|
145
|
+
)}
|
|
146
|
+
</ClickAway>
|
|
147
|
+
);
|
|
148
|
+
},
|
|
149
|
+
);
|
|
@@ -11,7 +11,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
11
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); }
|
|
12
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; }
|
|
13
13
|
|
|
14
|
-
const LinearLoader = _ref => {
|
|
14
|
+
const LinearLoader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
15
15
|
let {
|
|
16
16
|
value,
|
|
17
17
|
size = 'medium',
|
|
@@ -22,12 +22,13 @@ const LinearLoader = _ref => {
|
|
|
22
22
|
[_LinearLoaderModule.default.large]: size === 'large',
|
|
23
23
|
[_LinearLoaderModule.default.medium]: size === 'medium',
|
|
24
24
|
[_LinearLoaderModule.default.small]: size === 'small'
|
|
25
|
-
}, className)
|
|
25
|
+
}, className),
|
|
26
|
+
ref: ref
|
|
26
27
|
}, /*#__PURE__*/React.createElement("div", {
|
|
27
28
|
className: _LinearLoaderModule.default.progressBar,
|
|
28
29
|
style: {
|
|
29
30
|
width: `${value + '%'}`
|
|
30
31
|
}
|
|
31
32
|
}));
|
|
32
|
-
};
|
|
33
|
+
});
|
|
33
34
|
exports.LinearLoader = LinearLoader;
|
|
@@ -13,22 +13,24 @@ export type LinearLoaderProps = {
|
|
|
13
13
|
className?: string,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export const LinearLoader
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}: LinearLoaderProps): React.Node => (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
16
|
+
export const LinearLoader: React$AbstractComponent<
|
|
17
|
+
LinearLoaderProps,
|
|
18
|
+
HTMLDivElement,
|
|
19
|
+
> = React.forwardRef<LinearLoaderProps, HTMLDivElement>(
|
|
20
|
+
({value, size = 'medium', className}: LinearLoaderProps, ref): React.Node => (
|
|
21
|
+
<div
|
|
22
|
+
className={classify(
|
|
23
|
+
css.lineContainer,
|
|
24
|
+
{
|
|
25
|
+
[css.large]: size === 'large',
|
|
26
|
+
[css.medium]: size === 'medium',
|
|
27
|
+
[css.small]: size === 'small',
|
|
28
|
+
},
|
|
29
|
+
className,
|
|
30
|
+
)}
|
|
31
|
+
ref={ref}
|
|
32
|
+
>
|
|
33
|
+
<div className={css.progressBar} style={{width: `${value + '%'}`}}></div>
|
|
34
|
+
</div>
|
|
35
|
+
),
|
|
34
36
|
);
|
|
@@ -65,9 +65,16 @@ const Link = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
65
65
|
disabled,
|
|
66
66
|
...props
|
|
67
67
|
} = _ref;
|
|
68
|
+
const linkRef = React.useRef(null);
|
|
69
|
+
React.useImperativeHandle(ref, () => linkRef.current);
|
|
70
|
+
React.useEffect(() => {
|
|
71
|
+
if (disabled) {
|
|
72
|
+
linkRef.current?.blur();
|
|
73
|
+
}
|
|
74
|
+
}, [disabled]);
|
|
68
75
|
return /*#__PURE__*/React.createElement("a", _extends({}, props, {
|
|
69
76
|
tabIndex: disabled ? -1 : tabIndex,
|
|
70
|
-
|
|
77
|
+
ref: linkRef,
|
|
71
78
|
"data-testid": "Link",
|
|
72
79
|
className: (0, _classify.default)(_typographyModule.default.link, _typographyModule.default[as], _typographyModule.default[color], {
|
|
73
80
|
[_typographyModule.default.underline]: underline,
|
|
@@ -72,40 +72,48 @@ export type LinkProps = {
|
|
|
72
72
|
...
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
export const Link: React$AbstractComponent<
|
|
76
|
-
LinkProps,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
color = TEXT_COLORS.clickable,
|
|
82
|
-
children,
|
|
83
|
-
className,
|
|
84
|
-
as = 'buttonTextExtraSmall',
|
|
85
|
-
underline = true,
|
|
86
|
-
tabIndex = 0,
|
|
87
|
-
disabled,
|
|
88
|
-
...props
|
|
89
|
-
}: LinkProps,
|
|
90
|
-
ref,
|
|
91
|
-
) => (
|
|
92
|
-
<a
|
|
93
|
-
{...props}
|
|
94
|
-
tabIndex={disabled ? -1 : tabIndex}
|
|
95
|
-
innerref={ref}
|
|
96
|
-
data-testid="Link"
|
|
97
|
-
className={classify(
|
|
98
|
-
css.link,
|
|
99
|
-
css[as],
|
|
100
|
-
css[color],
|
|
101
|
-
{
|
|
102
|
-
[css.underline]: underline,
|
|
103
|
-
[css.disabled]: disabled,
|
|
104
|
-
},
|
|
75
|
+
export const Link: React$AbstractComponent<LinkProps, HTMLAnchorElement> =
|
|
76
|
+
React.forwardRef<LinkProps, HTMLAnchorElement>(
|
|
77
|
+
(
|
|
78
|
+
{
|
|
79
|
+
color = TEXT_COLORS.clickable,
|
|
80
|
+
children,
|
|
105
81
|
className,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
82
|
+
as = 'buttonTextExtraSmall',
|
|
83
|
+
underline = true,
|
|
84
|
+
tabIndex = 0,
|
|
85
|
+
disabled,
|
|
86
|
+
...props
|
|
87
|
+
}: LinkProps,
|
|
88
|
+
ref,
|
|
89
|
+
) => {
|
|
90
|
+
const linkRef = React.useRef(null);
|
|
91
|
+
React.useImperativeHandle(ref, () => linkRef.current);
|
|
92
|
+
React.useEffect(() => {
|
|
93
|
+
if (disabled) {
|
|
94
|
+
linkRef.current?.blur();
|
|
95
|
+
}
|
|
96
|
+
}, [disabled]);
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<a
|
|
100
|
+
{...props}
|
|
101
|
+
tabIndex={disabled ? -1 : tabIndex}
|
|
102
|
+
ref={linkRef}
|
|
103
|
+
data-testid="Link"
|
|
104
|
+
className={classify(
|
|
105
|
+
css.link,
|
|
106
|
+
css[as],
|
|
107
|
+
css[color],
|
|
108
|
+
{
|
|
109
|
+
[css.underline]: underline,
|
|
110
|
+
[css.disabled]: disabled,
|
|
111
|
+
},
|
|
112
|
+
className,
|
|
113
|
+
)}
|
|
114
|
+
>
|
|
115
|
+
{children}
|
|
116
|
+
</a>
|
|
117
|
+
);
|
|
118
|
+
},
|
|
119
|
+
);
|
|
@@ -22,7 +22,7 @@ const NOTIFICATION_SEMANTIC = Object.freeze({
|
|
|
22
22
|
exports.NOTIFICATION_SEMANTIC = NOTIFICATION_SEMANTIC;
|
|
23
23
|
// Base Notification will not have any state.
|
|
24
24
|
|
|
25
|
-
const BaseNotification = props => {
|
|
25
|
+
const BaseNotification = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
26
26
|
const {
|
|
27
27
|
classNames,
|
|
28
28
|
semantic = NOTIFICATION_SEMANTIC.success,
|
|
@@ -38,7 +38,8 @@ const BaseNotification = props => {
|
|
|
38
38
|
[_NotificationModule.default.information]: semantic === NOTIFICATION_SEMANTIC.information,
|
|
39
39
|
[_NotificationModule.default.danger]: semantic === NOTIFICATION_SEMANTIC.danger,
|
|
40
40
|
[_NotificationModule.default.dismissable]: dismissable
|
|
41
|
-
}, classNames?.wrapper)
|
|
41
|
+
}, classNames?.wrapper),
|
|
42
|
+
ref: ref
|
|
42
43
|
}, iconLeftName ? /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
43
44
|
name: iconLeftName,
|
|
44
45
|
color: _typography.TEXT_COLORS.inversePrimary,
|
|
@@ -55,8 +56,8 @@ const BaseNotification = props => {
|
|
|
55
56
|
onClick: onCloseClick,
|
|
56
57
|
className: _NotificationModule.default.closeIcon
|
|
57
58
|
}));
|
|
58
|
-
};
|
|
59
|
-
const Notification = props => {
|
|
59
|
+
});
|
|
60
|
+
const Notification = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
60
61
|
const {
|
|
61
62
|
classNames,
|
|
62
63
|
semantic = NOTIFICATION_SEMANTIC.success,
|
|
@@ -78,7 +79,8 @@ const Notification = props => {
|
|
|
78
79
|
iconLeftType: iconLeftType,
|
|
79
80
|
semantic: semantic,
|
|
80
81
|
dismissable: dismissable,
|
|
81
|
-
onCloseClick: closeClickHandler
|
|
82
|
+
onCloseClick: closeClickHandler,
|
|
83
|
+
ref: ref
|
|
82
84
|
}, children));
|
|
83
|
-
};
|
|
85
|
+
});
|
|
84
86
|
exports.Notification = Notification;
|