hrm_ui_lib 1.4.4-alpha.13 → 1.4.4-alpha.16
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/package.json +1 -1
- package/Button-57f239a1.js +0 -441
- package/Button-84b9199a.js +0 -441
- package/Button-b5310812.js +0 -436
- package/Button-cd119aae.js +0 -438
package/package.json
CHANGED
package/Button-57f239a1.js
DELETED
|
@@ -1,441 +0,0 @@
|
|
|
1
|
-
import { _ as _extends } from './extends-0166c96c.js';
|
|
2
|
-
import { _ as _defineProperty } from './defineProperty-c0de2685.js';
|
|
3
|
-
import { _ as _objectWithoutProperties } from './objectWithoutProperties-8770803c.js';
|
|
4
|
-
import React, { useState, useId, useEffect, forwardRef, useRef, useMemo } from 'react';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
|
-
import 'dayjs';
|
|
7
|
-
import { Loader } from './helperComponents/Loader/Loader.js';
|
|
8
|
-
import './consts/index.js';
|
|
9
|
-
import './hooks/useScreenSize.js';
|
|
10
|
-
import 'react-hook-form';
|
|
11
|
-
import { _ as _slicedToArray } from './slicedToArray-5c7da176.js';
|
|
12
|
-
import { useIsMobile } from './hooks/useGetIsMobile.js';
|
|
13
|
-
import { motion } from 'framer-motion';
|
|
14
|
-
import { AnimatePresenceWrapper } from './helperComponents/AnimatePresenceWrapper/AnimatePresenceWrapper.js';
|
|
15
|
-
import { useOnOutsideClick } from './hooks/useOnOutsideClick.js';
|
|
16
|
-
import { useHideBodyScroll } from './hooks/useHideBodyScroll.js';
|
|
17
|
-
import 'react-syntax-highlighter';
|
|
18
|
-
import { IconDismiss } from './components/SVGIcons/IconDismiss.js';
|
|
19
|
-
import { Positions } from './components/Tooltip/types.js';
|
|
20
|
-
import { Text } from './components/Text/Text.js';
|
|
21
|
-
import { Tooltip } from './components/Tooltip/Tooltip.js';
|
|
22
|
-
import { noop } from './utils/helpers.js';
|
|
23
|
-
import { Link } from './components/Link/Link.js';
|
|
24
|
-
import { PopoverDesktop } from './components/Popover/PopoverDesktop.js';
|
|
25
|
-
import { IconInfo } from './components/SVGIcons/IconInfo.js';
|
|
26
|
-
import { IconDynamicComponent } from './helperComponents/IconDynamicComponent/IconDynamicComponent.js';
|
|
27
|
-
import { LITE_LOADER_TYPES, ICON_SIZE_MAPPING, ICON_TYPE_MAPPING } from './components/Button/consts.js';
|
|
28
|
-
|
|
29
|
-
var _excluded$3 = ["size", "className", "iconProps", "buttonActionType", "disabled", "isLoading", "formId", "dataId", "onClick", "refHandler"];
|
|
30
|
-
var ButtonIcon = function ButtonIcon(props) {
|
|
31
|
-
var _props$size = props.size,
|
|
32
|
-
size = _props$size === void 0 ? 'medium' : _props$size,
|
|
33
|
-
_props$className = props.className,
|
|
34
|
-
className = _props$className === void 0 ? '' : _props$className,
|
|
35
|
-
iconProps = props.iconProps,
|
|
36
|
-
_props$buttonActionTy = props.buttonActionType,
|
|
37
|
-
buttonActionType = _props$buttonActionTy === void 0 ? 'button' : _props$buttonActionTy,
|
|
38
|
-
disabled = props.disabled,
|
|
39
|
-
isLoading = props.isLoading,
|
|
40
|
-
formId = props.formId,
|
|
41
|
-
_props$dataId = props.dataId,
|
|
42
|
-
dataId = _props$dataId === void 0 ? '' : _props$dataId,
|
|
43
|
-
onClick = props.onClick,
|
|
44
|
-
_props$refHandler = props.refHandler,
|
|
45
|
-
refHandler = _props$refHandler === void 0 ? null : _props$refHandler,
|
|
46
|
-
rest = _objectWithoutProperties(props, _excluded$3);
|
|
47
|
-
return /*#__PURE__*/React.createElement("button", _extends({
|
|
48
|
-
ref: refHandler,
|
|
49
|
-
"data-id": dataId,
|
|
50
|
-
disabled: disabled,
|
|
51
|
-
type: buttonActionType,
|
|
52
|
-
className: classNames('btn-icon', "btn-icon--".concat(size), className),
|
|
53
|
-
onClick: onClick,
|
|
54
|
-
form: formId
|
|
55
|
-
}, rest), isLoading ? /*#__PURE__*/React.createElement(Loader, {
|
|
56
|
-
size: size,
|
|
57
|
-
type: 'dark'
|
|
58
|
-
}) : /*#__PURE__*/React.createElement(iconProps.Component, {
|
|
59
|
-
size: size,
|
|
60
|
-
type: disabled ? 'disabled' : 'tertiary'
|
|
61
|
-
}));
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
var ModalContent = function ModalContent(_ref) {
|
|
65
|
-
var title = _ref.title,
|
|
66
|
-
subtitle = _ref.subtitle,
|
|
67
|
-
dataIdPrefix = _ref.dataIdPrefix,
|
|
68
|
-
closeIcon = _ref.closeIcon,
|
|
69
|
-
onClose = _ref.onClose,
|
|
70
|
-
children = _ref.children,
|
|
71
|
-
_ref$withFooter = _ref.withFooter,
|
|
72
|
-
withFooter = _ref$withFooter === void 0 ? true : _ref$withFooter,
|
|
73
|
-
confirmBtnTooltipText = _ref.confirmBtnTooltipText,
|
|
74
|
-
buttonProps = _ref.buttonProps,
|
|
75
|
-
onSubmit = _ref.onSubmit;
|
|
76
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, title ? /*#__PURE__*/React.createElement("div", {
|
|
77
|
-
className: "modal__header"
|
|
78
|
-
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, {
|
|
79
|
-
lineHeight: "large",
|
|
80
|
-
size: "large",
|
|
81
|
-
weight: 'bolder',
|
|
82
|
-
dataId: dataIdPrefix ? "".concat(dataIdPrefix, "-modal-title") : ''
|
|
83
|
-
}, title), subtitle ? /*#__PURE__*/React.createElement(Text, {
|
|
84
|
-
className: 'mt-12',
|
|
85
|
-
dataId: dataIdPrefix ? "".concat(dataIdPrefix, "-modal-title") : ''
|
|
86
|
-
}, subtitle) : null), closeIcon ? /*#__PURE__*/React.createElement(ButtonIcon, {
|
|
87
|
-
className: 'modal__close ml-16',
|
|
88
|
-
dataId: dataIdPrefix ? "".concat(dataIdPrefix, "-modal-close-button") : '',
|
|
89
|
-
iconProps: {
|
|
90
|
-
Component: IconDismiss
|
|
91
|
-
},
|
|
92
|
-
onClick: onClose
|
|
93
|
-
}) : null) : null, /*#__PURE__*/React.createElement("div", {
|
|
94
|
-
className: "modal__content scrollbar scrollbar--vertical"
|
|
95
|
-
}, children), withFooter && buttonProps ? /*#__PURE__*/React.createElement("div", {
|
|
96
|
-
className: "modal__footer"
|
|
97
|
-
}, buttonProps.cancel && /*#__PURE__*/React.createElement(Button, _extends({
|
|
98
|
-
type: "tertiary",
|
|
99
|
-
className: "modal__footer__btn mr-16",
|
|
100
|
-
onClick: onClose,
|
|
101
|
-
dataId: dataIdPrefix ? "".concat(dataIdPrefix, "-modal-cancel-button") : ''
|
|
102
|
-
}, buttonProps.cancel || {})), confirmBtnTooltipText ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
103
|
-
text: confirmBtnTooltipText,
|
|
104
|
-
id: 'confirm-btn-tooltip',
|
|
105
|
-
position: Positions.TOP_CENTER
|
|
106
|
-
}) : null, /*#__PURE__*/React.createElement(Button, _extends({
|
|
107
|
-
id: 'confirm-btn-tooltip',
|
|
108
|
-
className: 'modal__footer__btn',
|
|
109
|
-
type: "primary",
|
|
110
|
-
onClick: onSubmit ? onSubmit : noop,
|
|
111
|
-
dataId: dataIdPrefix ? "".concat(dataIdPrefix, "-modal-confirm-button") : ''
|
|
112
|
-
}, buttonProps.confirm))) : null);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
var _excluded$2 = ["isOpen", "onClose", "className", "size", "closeOnOutsideClick"];
|
|
116
|
-
var DESKTOP_ANIMATION = {
|
|
117
|
-
initial: {
|
|
118
|
-
opacity: 0.5,
|
|
119
|
-
scale: 0.65
|
|
120
|
-
},
|
|
121
|
-
animate: {
|
|
122
|
-
opacity: 1,
|
|
123
|
-
scale: [0.95, 1]
|
|
124
|
-
},
|
|
125
|
-
exit: {
|
|
126
|
-
opacity: 0,
|
|
127
|
-
scale: 0.7,
|
|
128
|
-
transition: {
|
|
129
|
-
duration: 0.2
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
transition: {
|
|
133
|
-
duration: 0.4,
|
|
134
|
-
type: 'spring',
|
|
135
|
-
damping: 55,
|
|
136
|
-
stiffness: 700
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
var MOBILE_ANIMATION = {
|
|
140
|
-
initial: {
|
|
141
|
-
height: 0,
|
|
142
|
-
bottom: 0
|
|
143
|
-
},
|
|
144
|
-
animate: {
|
|
145
|
-
height: 'auto',
|
|
146
|
-
bottom: 10
|
|
147
|
-
},
|
|
148
|
-
exit: {
|
|
149
|
-
height: 0,
|
|
150
|
-
bottom: 0
|
|
151
|
-
},
|
|
152
|
-
transition: {
|
|
153
|
-
duration: 0.6
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
var Modal = function Modal(props) {
|
|
157
|
-
var isOpen = props.isOpen,
|
|
158
|
-
onClose = props.onClose,
|
|
159
|
-
_props$className = props.className,
|
|
160
|
-
className = _props$className === void 0 ? '' : _props$className,
|
|
161
|
-
_props$size = props.size,
|
|
162
|
-
size = _props$size === void 0 ? 'medium' : _props$size,
|
|
163
|
-
_props$closeOnOutside = props.closeOnOutsideClick,
|
|
164
|
-
closeOnOutsideClick = _props$closeOnOutside === void 0 ? true : _props$closeOnOutside,
|
|
165
|
-
rest = _objectWithoutProperties(props, _excluded$2);
|
|
166
|
-
var isMobile = useIsMobile();
|
|
167
|
-
var _useState = useState(null),
|
|
168
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
169
|
-
containerRef = _useState2[0],
|
|
170
|
-
setContainerRef = _useState2[1];
|
|
171
|
-
useOnOutsideClick(containerRef, onClose, closeOnOutsideClick && isOpen, useId());
|
|
172
|
-
useHideBodyScroll(isOpen);
|
|
173
|
-
return /*#__PURE__*/React.createElement(AnimatePresenceWrapper, null, isOpen ? /*#__PURE__*/React.createElement(motion.div, {
|
|
174
|
-
className: classNames('modal', "modal--".concat(size), className),
|
|
175
|
-
initial: {
|
|
176
|
-
opacity: 0
|
|
177
|
-
},
|
|
178
|
-
animate: {
|
|
179
|
-
opacity: 1
|
|
180
|
-
},
|
|
181
|
-
exit: {
|
|
182
|
-
opacity: 0
|
|
183
|
-
},
|
|
184
|
-
transition: {
|
|
185
|
-
duration: 0.4
|
|
186
|
-
}
|
|
187
|
-
}, /*#__PURE__*/React.createElement(motion.div, _extends({
|
|
188
|
-
className: classNames('modal__container', {
|
|
189
|
-
modal__container_mobile: isMobile
|
|
190
|
-
}),
|
|
191
|
-
ref: setContainerRef
|
|
192
|
-
}, isMobile ? MOBILE_ANIMATION : DESKTOP_ANIMATION), /*#__PURE__*/React.createElement(ModalContent, _extends({}, rest, {
|
|
193
|
-
onClose: onClose
|
|
194
|
-
})))) : null);
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
var PopoverMobile = function PopoverMobile(props) {
|
|
198
|
-
var dataId = props.dataId,
|
|
199
|
-
text = props.text,
|
|
200
|
-
linkAddons = props.linkAddons,
|
|
201
|
-
mobileTitle = props.mobileTitle,
|
|
202
|
-
hideMessage = props.hideMessage,
|
|
203
|
-
_props$clicked = props.clicked,
|
|
204
|
-
clicked = _props$clicked === void 0 ? false : _props$clicked,
|
|
205
|
-
children = props.children;
|
|
206
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Modal, {
|
|
207
|
-
closeIcon: true,
|
|
208
|
-
title: mobileTitle,
|
|
209
|
-
onClose: hideMessage,
|
|
210
|
-
isOpen: clicked
|
|
211
|
-
}, clicked && /*#__PURE__*/React.createElement(React.Fragment, null, linkAddons ? /*#__PURE__*/React.createElement(Link, {
|
|
212
|
-
dataId: linkAddons.dataId,
|
|
213
|
-
url: linkAddons.url,
|
|
214
|
-
beforeLink: linkAddons.beforeLink,
|
|
215
|
-
afterLink: linkAddons.afterLink,
|
|
216
|
-
target: linkAddons.target,
|
|
217
|
-
className: 'popover__link'
|
|
218
|
-
}, text) : /*#__PURE__*/React.createElement(Text, {
|
|
219
|
-
dataId: "".concat(dataId, "-text"),
|
|
220
|
-
type: "primary",
|
|
221
|
-
weight: "regular",
|
|
222
|
-
lineHeight: "medium",
|
|
223
|
-
size: "small"
|
|
224
|
-
}, text))), children);
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
var _excluded$1 = ["elemRef", "id", "clicked"];
|
|
228
|
-
var Popover = function Popover(props) {
|
|
229
|
-
var elemRef = props.elemRef,
|
|
230
|
-
id = props.id,
|
|
231
|
-
clicked = props.clicked,
|
|
232
|
-
rest = _objectWithoutProperties(props, _excluded$1);
|
|
233
|
-
var isMobile = useIsMobile();
|
|
234
|
-
var _useState = useState(clicked),
|
|
235
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
236
|
-
isClicked = _useState2[0],
|
|
237
|
-
setIsClicked = _useState2[1];
|
|
238
|
-
var _useState3 = useState(elemRef || null),
|
|
239
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
240
|
-
parent = _useState4[0],
|
|
241
|
-
setElement = _useState4[1];
|
|
242
|
-
var showMessage = function showMessage() {
|
|
243
|
-
return setIsClicked(true);
|
|
244
|
-
};
|
|
245
|
-
var hideMessage = function hideMessage() {
|
|
246
|
-
return setIsClicked(false);
|
|
247
|
-
};
|
|
248
|
-
useEffect(function () {
|
|
249
|
-
if (parent) {
|
|
250
|
-
parent.addEventListener('click', showMessage);
|
|
251
|
-
}
|
|
252
|
-
}, [parent]);
|
|
253
|
-
useEffect(function () {
|
|
254
|
-
if (id) {
|
|
255
|
-
var element = document.getElementById(id.toString());
|
|
256
|
-
setElement(element);
|
|
257
|
-
}
|
|
258
|
-
}, [id]);
|
|
259
|
-
useEffect(function () {
|
|
260
|
-
if (clicked !== undefined && clicked !== isClicked) {
|
|
261
|
-
setIsClicked(clicked);
|
|
262
|
-
}
|
|
263
|
-
}, [clicked, isClicked]);
|
|
264
|
-
useEffect(function () {
|
|
265
|
-
return function () {
|
|
266
|
-
return setIsClicked(false);
|
|
267
|
-
};
|
|
268
|
-
}, []);
|
|
269
|
-
return isMobile ? /*#__PURE__*/React.createElement(PopoverMobile, _extends({}, rest, {
|
|
270
|
-
clicked: isClicked,
|
|
271
|
-
hideMessage: hideMessage
|
|
272
|
-
})) : /*#__PURE__*/React.createElement(PopoverDesktop, _extends({}, rest, {
|
|
273
|
-
parent: parent,
|
|
274
|
-
clicked: isClicked,
|
|
275
|
-
showMessage: showMessage,
|
|
276
|
-
hideMessage: hideMessage
|
|
277
|
-
}));
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
var Checkbox = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
281
|
-
var label = props.label,
|
|
282
|
-
disabled = props.disabled,
|
|
283
|
-
_props$required = props.required,
|
|
284
|
-
required = _props$required === void 0 ? false : _props$required,
|
|
285
|
-
link = props.link,
|
|
286
|
-
name = props.name,
|
|
287
|
-
setFieldValue = props.setFieldValue,
|
|
288
|
-
selectedValue = props.selectedValue,
|
|
289
|
-
value = props.value,
|
|
290
|
-
_props$className = props.className,
|
|
291
|
-
className = _props$className === void 0 ? '' : _props$className,
|
|
292
|
-
_props$iconProps = props.iconProps,
|
|
293
|
-
iconProps = _props$iconProps === void 0 ? {
|
|
294
|
-
name: 'checkmark'
|
|
295
|
-
} : _props$iconProps,
|
|
296
|
-
_props$dataId = props.dataId,
|
|
297
|
-
dataId = _props$dataId === void 0 ? '' : _props$dataId,
|
|
298
|
-
onClick = props.onClick,
|
|
299
|
-
beforeLink = props.beforeLink,
|
|
300
|
-
afterLink = props.afterLink,
|
|
301
|
-
_props$helperText = props.helperText,
|
|
302
|
-
helperText = _props$helperText === void 0 ? '' : _props$helperText,
|
|
303
|
-
popoverAddons = props.popoverAddons,
|
|
304
|
-
isInvalid = props.isInvalid;
|
|
305
|
-
var localRef = useRef(null);
|
|
306
|
-
var inputRef = ref && Object.keys(ref).length ? ref : localRef;
|
|
307
|
-
var isChecked = !!value || selectedValue;
|
|
308
|
-
var changeHandler = function changeHandler() {
|
|
309
|
-
if (name && setFieldValue) {
|
|
310
|
-
setFieldValue(name, !isChecked, {
|
|
311
|
-
shouldValidate: !isChecked
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
if (onClick) {
|
|
315
|
-
onClick(!isChecked);
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
var checkboxLabelPopover = popoverAddons ? /*#__PURE__*/React.createElement(Popover, _extends({
|
|
319
|
-
id: "".concat(popoverAddons.id)
|
|
320
|
-
}, popoverAddons), /*#__PURE__*/React.createElement("div", {
|
|
321
|
-
id: "".concat(popoverAddons.id)
|
|
322
|
-
}, /*#__PURE__*/React.createElement(IconInfo, {
|
|
323
|
-
dataId: "".concat(dataId, "-icon"),
|
|
324
|
-
type: "information",
|
|
325
|
-
size: "xsmall",
|
|
326
|
-
className: 'ml-4 pointer',
|
|
327
|
-
onClick: function onClick(e) {
|
|
328
|
-
e.stopPropagation();
|
|
329
|
-
changeHandler();
|
|
330
|
-
}
|
|
331
|
-
}))) : null;
|
|
332
|
-
var checkboxLabel = useMemo(function () {
|
|
333
|
-
if (!label) {
|
|
334
|
-
return null;
|
|
335
|
-
}
|
|
336
|
-
if (typeof label !== 'string') {
|
|
337
|
-
return label;
|
|
338
|
-
}
|
|
339
|
-
if (!link) {
|
|
340
|
-
return /*#__PURE__*/React.createElement(Text, {
|
|
341
|
-
type: disabled ? 'disabled' : 'primary',
|
|
342
|
-
className: "controller__label"
|
|
343
|
-
}, /*#__PURE__*/React.createElement(React.Fragment, null, label, required && /*#__PURE__*/React.createElement("sup", null, "*")));
|
|
344
|
-
}
|
|
345
|
-
return /*#__PURE__*/React.createElement(Text, {
|
|
346
|
-
type: disabled ? 'disabled' : 'primary',
|
|
347
|
-
className: "controller__label"
|
|
348
|
-
}, /*#__PURE__*/React.createElement(React.Fragment, null, beforeLink && /*#__PURE__*/React.createElement("span", {
|
|
349
|
-
className: "mr-4"
|
|
350
|
-
}, beforeLink), /*#__PURE__*/React.createElement(Link, {
|
|
351
|
-
dataId: dataId,
|
|
352
|
-
url: link,
|
|
353
|
-
target: "_blank"
|
|
354
|
-
}, label), afterLink && /*#__PURE__*/React.createElement("span", {
|
|
355
|
-
className: "ml-4"
|
|
356
|
-
}, afterLink), required && /*#__PURE__*/React.createElement("sup", null, "*")));
|
|
357
|
-
}, [label, link]);
|
|
358
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("label", {
|
|
359
|
-
className: classNames('controller', _defineProperty({
|
|
360
|
-
'controller--checkbox': true,
|
|
361
|
-
'controller--disabled': disabled,
|
|
362
|
-
'controller--error': isInvalid
|
|
363
|
-
}, className, !!className))
|
|
364
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
365
|
-
"data-id": dataId,
|
|
366
|
-
type: "checkbox",
|
|
367
|
-
ref: inputRef,
|
|
368
|
-
tabIndex: 0,
|
|
369
|
-
onChange: changeHandler,
|
|
370
|
-
checked: Boolean(isChecked),
|
|
371
|
-
disabled: disabled
|
|
372
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
373
|
-
className: "controller__icon"
|
|
374
|
-
}, /*#__PURE__*/React.createElement(IconDynamicComponent, {
|
|
375
|
-
componentName: iconProps.name,
|
|
376
|
-
size: "xxsmall",
|
|
377
|
-
type: disabled ? 'disabled' : 'inverse',
|
|
378
|
-
className: "controller__mark"
|
|
379
|
-
})), checkboxLabel ? /*#__PURE__*/React.createElement("div", {
|
|
380
|
-
className: "controller__right"
|
|
381
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
382
|
-
className: "flexbox"
|
|
383
|
-
}, checkboxLabel, checkboxLabelPopover), helperText ? /*#__PURE__*/React.createElement(Text, {
|
|
384
|
-
size: "small",
|
|
385
|
-
type: disabled ? 'disabled' : 'secondary'
|
|
386
|
-
}, helperText) : null) : null));
|
|
387
|
-
});
|
|
388
|
-
Checkbox.displayName = 'Checkbox';
|
|
389
|
-
|
|
390
|
-
var _excluded = ["buttonText", "type", "size", "className", "iconProps", "buttonActionType", "disabled", "isLoading", "formId", "dataId", "onClick", "refHandler", "children"];
|
|
391
|
-
var Button = function Button(props) {
|
|
392
|
-
var buttonText = props.buttonText,
|
|
393
|
-
_props$type = props.type,
|
|
394
|
-
type = _props$type === void 0 ? 'primary' : _props$type,
|
|
395
|
-
_props$size = props.size,
|
|
396
|
-
size = _props$size === void 0 ? 'large' : _props$size,
|
|
397
|
-
_props$className = props.className,
|
|
398
|
-
className = _props$className === void 0 ? '' : _props$className,
|
|
399
|
-
iconProps = props.iconProps,
|
|
400
|
-
_props$buttonActionTy = props.buttonActionType,
|
|
401
|
-
buttonActionType = _props$buttonActionTy === void 0 ? 'button' : _props$buttonActionTy,
|
|
402
|
-
disabled = props.disabled,
|
|
403
|
-
isLoading = props.isLoading,
|
|
404
|
-
formId = props.formId,
|
|
405
|
-
_props$dataId = props.dataId,
|
|
406
|
-
dataId = _props$dataId === void 0 ? '' : _props$dataId,
|
|
407
|
-
onClick = props.onClick,
|
|
408
|
-
_props$refHandler = props.refHandler,
|
|
409
|
-
refHandler = _props$refHandler === void 0 ? null : _props$refHandler,
|
|
410
|
-
children = props.children,
|
|
411
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
412
|
-
var justIcon = !buttonText && !children && iconProps !== undefined;
|
|
413
|
-
var clickHandler = function clickHandler(e) {
|
|
414
|
-
if (disabled || isLoading) {
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
onClick === null || onClick === void 0 || onClick(e);
|
|
418
|
-
};
|
|
419
|
-
return /*#__PURE__*/React.createElement("button", _extends({
|
|
420
|
-
ref: refHandler,
|
|
421
|
-
"data-id": dataId,
|
|
422
|
-
disabled: disabled,
|
|
423
|
-
type: buttonActionType,
|
|
424
|
-
className: classNames('btn', "btn--".concat(type), "btn--".concat(size), _defineProperty({
|
|
425
|
-
'btn--icon': justIcon
|
|
426
|
-
}, "btn--icon-".concat((iconProps === null || iconProps === void 0 ? void 0 : iconProps.alignment) || 'left'), !isLoading && !justIcon && (iconProps === null || iconProps === void 0 ? void 0 : iconProps.Component)), className),
|
|
427
|
-
onClick: clickHandler,
|
|
428
|
-
form: formId
|
|
429
|
-
}, rest), isLoading ? /*#__PURE__*/React.createElement(Loader, {
|
|
430
|
-
size: size,
|
|
431
|
-
type: LITE_LOADER_TYPES.indexOf(type) === -1 ? 'dark' : 'lite'
|
|
432
|
-
}) : /*#__PURE__*/React.createElement(React.Fragment, null, iconProps !== null && iconProps !== void 0 && iconProps.Component ? /*#__PURE__*/React.createElement(iconProps.Component, {
|
|
433
|
-
size: ICON_SIZE_MAPPING[size],
|
|
434
|
-
type: ICON_TYPE_MAPPING[iconProps.type || type],
|
|
435
|
-
className: "btn__icon"
|
|
436
|
-
}) : null, buttonText || children ? /*#__PURE__*/React.createElement("span", {
|
|
437
|
-
className: "btn__text"
|
|
438
|
-
}, buttonText || children) : null));
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
export { Button as B, Checkbox as C, Modal as M, Popover as P, ButtonIcon as a, MOBILE_ANIMATION as b, ModalContent as c, PopoverMobile as d };
|