colibri-ui 0.8.84 → 0.8.86
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/Accordion/Accordion.module.css +4 -0
- package/Accordion/index.js +15 -23
- package/Autocomplete/Autocomplete.js +101 -132
- package/Avatar/Avatar.module.css +6 -0
- package/Avatar/index.js +102 -89
- package/Badge/Badge.module.css +2 -1
- package/Badge/Control/index.js +5 -3
- package/Badge/index.js +16 -16
- package/Button/index.js +23 -20
- package/Button/tokens.js +2 -2
- package/Calendar/Calendar.js +171 -269
- package/Card/Card.js +26 -32
- package/Checkbox/index.js +46 -43
- package/Chip/Chip.module.css +2 -1
- package/Chip/index.js +15 -15
- package/ClickOutside/index.js +10 -13
- package/CodeField/CodeField.js +113 -170
- package/Counter/Counter.module.css +2 -1
- package/Counter/index.js +21 -20
- package/Datepicker/components/DatePicker/index.js +81 -102
- package/Datepicker/index.js +17 -16
- package/DotsLoader/index.js +23 -15
- package/Drawer/Drawer.js +75 -97
- package/Drawer/Drawer.module.css +2 -1
- package/Dropdown/index.js +55 -68
- package/Dropzone/Dropzone.js +78 -168
- package/Dropzone/Dropzone.module.css +2 -1
- package/Editable/Editable.js +44 -57
- package/Grid/Item/index.js +11 -13
- package/Grid/index.js +15 -21
- package/Icons/ArrowNext.js +7 -8
- package/Icons/Cart.js +7 -8
- package/Icons/Check.js +7 -8
- package/Icons/Chevron.js +7 -8
- package/Icons/Close.js +6 -6
- package/Icons/Copy.js +7 -8
- package/Icons/Cross.js +6 -6
- package/Icons/CrossFill.js +7 -8
- package/Icons/Edit.js +7 -8
- package/Icons/Exit.js +7 -8
- package/Icons/EyeClosed.js +7 -8
- package/Icons/EyeOpen.js +7 -8
- package/Icons/Help.js +6 -6
- package/Icons/Info.js +7 -8
- package/Icons/Minus.js +7 -8
- package/Icons/More.js +7 -8
- package/Icons/Plus.js +7 -8
- package/Icons/Setting.js +7 -8
- package/Icons/Shield.js +7 -8
- package/Icons/Trash.js +7 -8
- package/Icons/User.js +7 -8
- package/Image/Image.module.css +4 -0
- package/Image/index.d.ts +1 -1
- package/Image/index.js +44 -37
- package/Input/index.d.ts +1 -1
- package/Input/index.js +37 -25
- package/Input/index.props.d.ts +1 -1
- package/InputRadio/index.js +32 -24
- package/List/List.js +81 -76
- package/Menu/Menu.module.css +2 -1
- package/Menu/components/MenuItem/index.js +17 -14
- package/Menu/index.js +22 -23
- package/Modal/components/Body/index.js +9 -8
- package/Modal/components/Close/Close.module.css +4 -0
- package/Modal/components/Close/index.js +13 -14
- package/Modal/components/Content/index.js +5 -6
- package/Modal/components/Footer/index.js +5 -3
- package/Modal/components/Header/index.js +13 -12
- package/Modal/components/Title/index.js +10 -9
- package/Modal/context.js +3 -3
- package/Modal/index.js +46 -68
- package/MultiSelect/components/MenuOverlay/index.js +48 -61
- package/MultiSelect/components/MenuOverlayItem/index.js +13 -14
- package/MultiSelect/index.js +72 -100
- package/MultiSelect/index.module.css +2 -1
- package/MultiSelect/utils/index.js +8 -18
- package/NumberInput/NumberInput.js +80 -112
- package/Portal/index.js +6 -10
- package/Progress/Progress.js +45 -58
- package/RadioGroup/Radio.js +29 -32
- package/RadioGroup/index.js +43 -46
- package/Rating/Rating.js +50 -63
- package/Select/components/MenuOverlay/index.js +16 -25
- package/Select/components/MenuOverlayItem/index.js +13 -11
- package/Select/index.js +39 -48
- package/Select/index.module.css +2 -1
- package/Separator/index.js +5 -6
- package/Sheet/Sheet.js +89 -121
- package/Sheet/Sheet.module.css +4 -2
- package/Skeleton/index.js +25 -30
- package/Slider/Slider.js +83 -119
- package/Status/index.js +17 -18
- package/Switch/Switch.module.css +2 -1
- package/Switch/index.js +22 -15
- package/TabsMenu/Tab/Tab.js +14 -10
- package/TabsMenu/Tab/Tab.module.css +2 -1
- package/TabsMenu/index.js +25 -26
- package/TabsPanels/Panel/index.js +6 -4
- package/TabsPanels/index.js +13 -10
- package/TextArea/index.d.ts +1 -1
- package/TextArea/index.js +30 -19
- package/Theme/breakpoints.js +5 -11
- package/Theme/colors/theme_buenos_aires.js +14 -14
- package/Theme/colors/theme_jaipur.js +14 -14
- package/Theme/global.css +0 -1
- package/Theme/index.js +1 -1
- package/TimeSelect/Label/index.js +11 -13
- package/TimeSelect/helpers.js +23 -42
- package/TimeSelect/index.js +32 -38
- package/Tooltip/index.js +36 -42
- package/Typography/index.js +17 -13
- package/Typography/index.props.d.ts +3 -0
- package/base/BaseInput/index.js +10 -8
- package/base/FormField/index.d.ts +1 -1
- package/base/FormField/index.js +27 -22
- package/base/FormField/index.props.d.ts +4 -0
- package/base/InputRoot/index.js +27 -27
- package/esm/Accordion/Accordion.module.css +4 -0
- package/esm/Accordion/index.js +15 -21
- package/esm/Autocomplete/Autocomplete.js +101 -130
- package/esm/Avatar/Avatar.module.css +6 -0
- package/esm/Avatar/index.js +102 -88
- package/esm/Badge/Badge.module.css +2 -1
- package/esm/Badge/Control/index.js +5 -3
- package/esm/Badge/index.js +16 -15
- package/esm/Button/index.js +23 -19
- package/esm/Button/tokens.js +2 -2
- package/esm/Calendar/Calendar.js +171 -267
- package/esm/Card/Card.js +26 -32
- package/esm/Checkbox/index.js +46 -42
- package/esm/Chip/Chip.module.css +2 -1
- package/esm/Chip/index.js +15 -14
- package/esm/ClickOutside/index.js +10 -13
- package/esm/CodeField/CodeField.js +113 -169
- package/esm/Counter/Counter.module.css +2 -1
- package/esm/Counter/index.js +21 -19
- package/esm/Datepicker/components/DatePicker/index.js +81 -101
- package/esm/Datepicker/index.js +17 -16
- package/esm/DotsLoader/index.js +23 -14
- package/esm/Drawer/Drawer.js +75 -96
- package/esm/Drawer/Drawer.module.css +2 -1
- package/esm/Dropdown/index.js +55 -66
- package/esm/Dropzone/Dropzone.js +78 -165
- package/esm/Dropzone/Dropzone.module.css +2 -1
- package/esm/Editable/Editable.js +44 -56
- package/esm/Grid/Item/index.js +11 -12
- package/esm/Grid/index.js +15 -21
- package/esm/Icons/ArrowNext.js +7 -8
- package/esm/Icons/Cart.js +7 -8
- package/esm/Icons/Check.js +7 -8
- package/esm/Icons/Chevron.js +7 -8
- package/esm/Icons/Close.js +6 -6
- package/esm/Icons/Copy.js +7 -8
- package/esm/Icons/Cross.js +6 -6
- package/esm/Icons/CrossFill.js +7 -8
- package/esm/Icons/Edit.js +7 -8
- package/esm/Icons/Exit.js +7 -8
- package/esm/Icons/EyeClosed.js +7 -8
- package/esm/Icons/EyeOpen.js +7 -8
- package/esm/Icons/Help.js +6 -6
- package/esm/Icons/Info.js +7 -8
- package/esm/Icons/Minus.js +7 -8
- package/esm/Icons/More.js +7 -8
- package/esm/Icons/Plus.js +7 -8
- package/esm/Icons/Setting.js +7 -8
- package/esm/Icons/Shield.js +7 -8
- package/esm/Icons/Trash.js +7 -8
- package/esm/Icons/User.js +7 -8
- package/esm/Image/Image.module.css +4 -0
- package/esm/Image/index.d.ts +1 -1
- package/esm/Image/index.js +44 -36
- package/esm/Input/index.d.ts +1 -1
- package/esm/Input/index.js +38 -26
- package/esm/Input/index.props.d.ts +1 -1
- package/esm/InputRadio/index.js +32 -23
- package/esm/List/List.js +81 -75
- package/esm/Menu/Menu.module.css +2 -1
- package/esm/Menu/components/MenuItem/index.js +17 -13
- package/esm/Menu/index.js +22 -23
- package/esm/Modal/components/Body/index.js +9 -7
- package/esm/Modal/components/Close/Close.module.css +4 -0
- package/esm/Modal/components/Close/index.js +13 -14
- package/esm/Modal/components/Content/index.js +5 -6
- package/esm/Modal/components/Footer/index.js +5 -3
- package/esm/Modal/components/Header/index.js +13 -11
- package/esm/Modal/components/Title/index.js +10 -9
- package/esm/Modal/context.js +3 -3
- package/esm/Modal/index.js +50 -70
- package/esm/MultiSelect/components/MenuOverlay/index.js +48 -60
- package/esm/MultiSelect/components/MenuOverlayItem/index.js +13 -14
- package/esm/MultiSelect/index.js +72 -97
- package/esm/MultiSelect/index.module.css +2 -1
- package/esm/MultiSelect/utils/index.js +8 -14
- package/esm/NumberInput/NumberInput.js +80 -111
- package/esm/Portal/index.js +6 -9
- package/esm/Progress/Progress.js +45 -58
- package/esm/RadioGroup/Radio.js +29 -32
- package/esm/RadioGroup/index.js +43 -45
- package/esm/Rating/Rating.js +50 -63
- package/esm/Select/components/MenuOverlay/index.js +16 -24
- package/esm/Select/components/MenuOverlayItem/index.js +13 -11
- package/esm/Select/index.js +39 -46
- package/esm/Select/index.module.css +2 -1
- package/esm/Separator/index.js +5 -6
- package/esm/Sheet/Sheet.js +89 -119
- package/esm/Sheet/Sheet.module.css +4 -2
- package/esm/Skeleton/index.js +25 -30
- package/esm/Slider/Slider.js +83 -119
- package/esm/Status/index.js +17 -17
- package/esm/Switch/Switch.module.css +2 -1
- package/esm/Switch/index.js +22 -14
- package/esm/TabsMenu/Tab/Tab.js +14 -9
- package/esm/TabsMenu/Tab/Tab.module.css +2 -1
- package/esm/TabsMenu/index.js +25 -26
- package/esm/TabsPanels/Panel/index.js +6 -4
- package/esm/TabsPanels/index.js +13 -10
- package/esm/TextArea/index.d.ts +1 -1
- package/esm/TextArea/index.js +31 -20
- package/esm/Theme/breakpoints.js +5 -11
- package/esm/Theme/colors/theme_buenos_aires.js +14 -14
- package/esm/Theme/colors/theme_jaipur.js +14 -14
- package/esm/Theme/global.css +0 -1
- package/esm/Theme/index.js +1 -1
- package/esm/TimeSelect/Label/index.js +11 -13
- package/esm/TimeSelect/helpers.js +22 -37
- package/esm/TimeSelect/index.js +32 -38
- package/esm/Tooltip/index.js +36 -41
- package/esm/Typography/index.js +17 -12
- package/esm/Typography/index.props.d.ts +3 -0
- package/esm/base/BaseInput/index.js +10 -8
- package/esm/base/FormField/index.d.ts +1 -1
- package/esm/base/FormField/index.js +27 -21
- package/esm/base/FormField/index.props.d.ts +4 -0
- package/esm/base/InputRoot/index.js +27 -26
- package/esm/helpers/date/index.js +4 -8
- package/esm/hooks/useMediaSizes/index.js +9 -15
- package/esm/hooks/useModalStack/index.js +6 -9
- package/esm/hooks/useOnClickOutside/index.js +6 -6
- package/esm/hooks/useScrollLock/index.js +10 -9
- package/esm/hooks/useTrapFocus/index.js +8 -10
- package/esm/lib/keyboard.js +2 -4
- package/helpers/date/index.js +21 -32
- package/hooks/useMediaSizes/index.js +9 -15
- package/hooks/useModalStack/index.js +6 -9
- package/hooks/useOnClickOutside/index.js +6 -6
- package/hooks/useScrollLock/index.js +10 -9
- package/hooks/useTrapFocus/index.js +8 -10
- package/lib/keyboard.js +2 -4
- package/package.json +5 -1
package/Card/Card.js
CHANGED
|
@@ -9,26 +9,18 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
10
10
|
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
14
|
-
classNames[_key] = arguments[_key];
|
|
15
|
-
}
|
|
16
|
-
return classNames.filter(Boolean).join(" ");
|
|
17
|
-
};
|
|
12
|
+
const cx = (...classNames) => classNames.filter(Boolean).join(" ");
|
|
18
13
|
/** Root card container. */
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
backgroundType = _a$backgroundType === void 0 ? "none" : _a$backgroundType,
|
|
30
|
-
className = _a.className,
|
|
31
|
-
children = _a.children,
|
|
14
|
+
const Card = /*#__PURE__*/React.forwardRef(function CardRoot(_a, ref) {
|
|
15
|
+
var {
|
|
16
|
+
size = "m",
|
|
17
|
+
view = "default",
|
|
18
|
+
orientation = "horizontal",
|
|
19
|
+
selected = false,
|
|
20
|
+
backgroundType = "none",
|
|
21
|
+
className,
|
|
22
|
+
children
|
|
23
|
+
} = _a,
|
|
32
24
|
rest = tslib.__rest(_a, ["size", "view", "orientation", "selected", "backgroundType", "className", "children"]);
|
|
33
25
|
return /*#__PURE__*/React__default.default.createElement("div", Object.assign({}, rest, {
|
|
34
26
|
ref: ref,
|
|
@@ -36,28 +28,30 @@ var Card = /*#__PURE__*/React.forwardRef(function CardRoot(_a, ref) {
|
|
|
36
28
|
}), children);
|
|
37
29
|
});
|
|
38
30
|
/** Clipped card area that normally contains media and CardInnerContent. */
|
|
39
|
-
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
const CardContent = /*#__PURE__*/React.forwardRef(function CardContentRoot(_a, ref) {
|
|
32
|
+
var {
|
|
33
|
+
aspectRatio,
|
|
34
|
+
orientation = "horizontal",
|
|
35
|
+
className,
|
|
36
|
+
style,
|
|
37
|
+
children
|
|
38
|
+
} = _a,
|
|
46
39
|
rest = tslib.__rest(_a, ["aspectRatio", "orientation", "className", "style", "children"]);
|
|
47
40
|
return /*#__PURE__*/React__default.default.createElement("div", Object.assign({}, rest, {
|
|
48
41
|
ref: ref,
|
|
49
42
|
className: cx(styles__default.default.content, styles__default.default[orientation], className),
|
|
50
43
|
style: Object.assign(Object.assign({}, style), {
|
|
51
|
-
aspectRatio
|
|
44
|
+
aspectRatio
|
|
52
45
|
})
|
|
53
46
|
}), children);
|
|
54
47
|
});
|
|
55
48
|
/** Content layer rendered over an image or another CardContent background. */
|
|
56
|
-
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
const CardInnerContent = /*#__PURE__*/React.forwardRef(function CardInnerContentRoot(_a, ref) {
|
|
50
|
+
var {
|
|
51
|
+
orientation = "horizontal",
|
|
52
|
+
className,
|
|
53
|
+
children
|
|
54
|
+
} = _a,
|
|
61
55
|
rest = tslib.__rest(_a, ["orientation", "className", "children"]);
|
|
62
56
|
return /*#__PURE__*/React__default.default.createElement("div", Object.assign({}, rest, {
|
|
63
57
|
ref: ref,
|
package/Checkbox/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
3
|
var React = require('react');
|
|
5
4
|
var clsx = require('clsx');
|
|
6
5
|
var index = require('../Typography/index.js');
|
|
@@ -8,51 +7,55 @@ var styles = require('./Checkbox.module.css');
|
|
|
8
7
|
|
|
9
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
9
|
|
|
11
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
|
|
12
10
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
13
11
|
var clsx__default = /*#__PURE__*/_interopDefault(clsx);
|
|
14
12
|
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
14
|
+
const Checkbox = ({
|
|
15
|
+
id,
|
|
16
|
+
name,
|
|
17
|
+
value,
|
|
18
|
+
label,
|
|
19
|
+
hint,
|
|
20
|
+
checked,
|
|
21
|
+
onChange,
|
|
22
|
+
onFocus,
|
|
23
|
+
onBlur,
|
|
24
|
+
variant = "primary",
|
|
25
|
+
className,
|
|
26
|
+
disabled,
|
|
27
|
+
hasError
|
|
28
|
+
}) => (/*#__PURE__*/React__default.default.createElement("div", {
|
|
29
|
+
className: styles__default.default.root
|
|
30
|
+
}, /*#__PURE__*/React__default.default.createElement("label", {
|
|
31
|
+
className: styles__default.default.label,
|
|
32
|
+
htmlFor: id
|
|
33
|
+
}, /*#__PURE__*/React__default.default.createElement("input", {
|
|
34
|
+
className: clsx__default.default(styles__default.default.control, styles__default.default[`control_variant_${variant}`], className),
|
|
35
|
+
type: "checkbox",
|
|
36
|
+
id: id,
|
|
37
|
+
name: name,
|
|
38
|
+
value: value,
|
|
39
|
+
checked: checked,
|
|
40
|
+
onChange: onChange,
|
|
41
|
+
onFocus: onFocus,
|
|
42
|
+
onBlur: onBlur,
|
|
43
|
+
disabled: disabled
|
|
44
|
+
}), /*#__PURE__*/React__default.default.createElement("span", {
|
|
45
|
+
className: clsx__default.default(styles__default.default["fake-checkbox"], styles__default.default[`variant_${variant}`], {
|
|
46
|
+
[styles__default.default[`variant_${variant}_disabled`]]: Boolean(disabled),
|
|
47
|
+
[styles__default.default[`variant_${variant}_error`]]: Boolean(hasError),
|
|
48
|
+
[styles__default.default[`variant_${variant}_checked`]]: Boolean(checked),
|
|
49
|
+
[styles__default.default.checked]: Boolean(checked)
|
|
50
|
+
})
|
|
51
|
+
}), /*#__PURE__*/React__default.default.createElement("span", {
|
|
52
|
+
className: styles__default.default.text
|
|
53
|
+
}, label)), hint && (/*#__PURE__*/React__default.default.createElement(index.Typography, {
|
|
54
|
+
className: clsx__default.default({
|
|
55
|
+
[styles__default.default.hint_error]: hasError
|
|
56
|
+
}),
|
|
57
|
+
variant: hasError ? "alert" : "secondary",
|
|
58
|
+
tag: "span"
|
|
59
|
+
}, hint))));
|
|
57
60
|
|
|
58
61
|
exports.Checkbox = Checkbox;
|
package/Chip/Chip.module.css
CHANGED
package/Chip/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
3
|
var tslib = require('tslib');
|
|
5
4
|
var React = require('react');
|
|
6
5
|
var clsx = require('clsx');
|
|
@@ -8,29 +7,30 @@ var styles = require('./Chip.module.css');
|
|
|
8
7
|
|
|
9
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
9
|
|
|
11
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
|
|
12
10
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
13
11
|
var clsx__default = /*#__PURE__*/_interopDefault(clsx);
|
|
14
12
|
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
variant = _a$variant === void 0 ? "primary" : _a$variant,
|
|
14
|
+
const Chip = _a => {
|
|
15
|
+
var {
|
|
16
|
+
children,
|
|
17
|
+
iconEnd,
|
|
18
|
+
isActive,
|
|
19
|
+
onClick,
|
|
20
|
+
onClickIcon,
|
|
21
|
+
size = "m",
|
|
22
|
+
testID = "chip",
|
|
23
|
+
variant = "primary"
|
|
24
|
+
} = _a,
|
|
28
25
|
props = tslib.__rest(_a, ["children", "iconEnd", "isActive", "onClick", "onClickIcon", "size", "testID", "variant"]);
|
|
29
26
|
return /*#__PURE__*/React__default.default.createElement("span", Object.assign({
|
|
30
27
|
className: styles__default.default.chip,
|
|
31
28
|
"data-testid": testID
|
|
32
29
|
}, props), /*#__PURE__*/React__default.default.createElement("span", {
|
|
33
|
-
className: clsx__default.default(styles__default.default.inner, styles__default.default[
|
|
30
|
+
className: clsx__default.default(styles__default.default.inner, styles__default.default[`inner_variant_${variant}`], {
|
|
31
|
+
[styles__default.default["inner_active"]]: iconEnd || isActive,
|
|
32
|
+
[styles__default.default["inner_inactive"]]: !iconEnd && !isActive
|
|
33
|
+
}),
|
|
34
34
|
"data-size": size
|
|
35
35
|
}, /*#__PURE__*/React__default.default.createElement("span", {
|
|
36
36
|
className: styles__default.default.content,
|
package/ClickOutside/index.js
CHANGED
|
@@ -6,27 +6,24 @@ var index = require('../hooks/useOnClickOutside/index.js');
|
|
|
6
6
|
/**
|
|
7
7
|
* Merges multiple refs (callback or object) into a single ref callback.
|
|
8
8
|
*/
|
|
9
|
-
function useMergedRefs() {
|
|
10
|
-
|
|
11
|
-
refs
|
|
12
|
-
}
|
|
13
|
-
return React.useCallback(function (node) {
|
|
14
|
-
for (var _i = 0, _refs = refs; _i < _refs.length; _i++) {
|
|
15
|
-
var ref = _refs[_i];
|
|
9
|
+
function useMergedRefs(...refs) {
|
|
10
|
+
return React.useCallback(node => {
|
|
11
|
+
for (const ref of refs) {
|
|
16
12
|
if (!ref) continue;
|
|
17
13
|
if (typeof ref === "function") ref(node);else ref.current = node;
|
|
18
14
|
}
|
|
19
15
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
16
|
}, refs);
|
|
21
17
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
const ClickOutside = ({
|
|
19
|
+
children,
|
|
20
|
+
onClick
|
|
21
|
+
}) => {
|
|
25
22
|
var _a;
|
|
26
|
-
|
|
23
|
+
const localRef = React.useRef(null);
|
|
27
24
|
index.useOnClickOutside(localRef, onClick);
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
const childRef = /*#__PURE__*/React.isValidElement(children) ? (_a = children.props) === null || _a === void 0 ? void 0 : _a.ref : undefined;
|
|
26
|
+
const mergedRef = useMergedRefs(localRef, childRef);
|
|
30
27
|
if (! /*#__PURE__*/React.isValidElement(children)) return null;
|
|
31
28
|
return /*#__PURE__*/React.cloneElement(children, {
|
|
32
29
|
ref: mergedRef
|