@councilbox/councilbox-ui 1.0.1 → 2.0.0
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/dist/HOCs/useDynamicStyles.js +99 -0
- package/dist/HOCs/useRipple.js +91 -0
- package/dist/build-index.js +8 -0
- package/dist/components/1.Introduction.stories.mdx +2 -1
- package/dist/components/2.Changelog.stories.mdx +3 -0
- package/dist/components/3.Guide.stories.mdx +56 -0
- package/dist/components/Accordion/Accordion.css +39 -1
- package/dist/components/Accordion/Accordion.js +84 -45
- package/dist/components/Accordion/Accordion.stories.js +4 -2
- package/dist/components/Accordion/AccordionOld.css +16 -0
- package/dist/components/Accordion/AccordionOld.js +115 -0
- package/dist/components/Accordion/DesignAccordion.stories.js +38 -0
- package/dist/components/Alert/Alert.css +5 -0
- package/dist/components/Alert/Alert.js +17 -6
- package/dist/components/Avatar/Avatar.css +3 -3
- package/dist/components/Avatar/Avatar.js +36 -20
- package/dist/components/Avatar/AvatarOld.js +138 -0
- package/dist/components/Avatar/DesignAvatar.stories.js +1 -1
- package/dist/components/Block/Block.js +17 -2
- package/dist/components/ButtonBasic/ButtonBasic.css +264 -20
- package/dist/components/ButtonBasic/ButtonBasic.js +85 -110
- package/dist/components/ButtonBasic/ButtonBasicOld.css +41 -0
- package/dist/components/ButtonBasic/ButtonBasicOld.js +231 -0
- package/dist/components/Checkbox/Checkbox.css +101 -22
- package/dist/components/Checkbox/Checkbox.js +119 -63
- package/dist/components/Checkbox/CheckboxOld.css +31 -0
- package/dist/components/Checkbox/CheckboxOld.js +112 -0
- package/dist/components/DragDrop/DragDrop.js +24 -9
- package/dist/components/DrawerPanel/DesignDrawerPanel.js +4 -2
- package/dist/components/DrawerPanel/DrawerPanel.css +76 -36
- package/dist/components/DrawerPanel/DrawerPanel.js +137 -115
- package/dist/components/DrawerPanel/DrawerPanelOld.css +56 -0
- package/dist/components/DrawerPanel/DrawerPanelOld.js +233 -0
- package/dist/components/DropDown/DesignDropDown.stories.js +146 -17
- package/dist/components/DropDown/DropDown.css +96 -1
- package/dist/components/DropDown/DropDown.js +363 -82
- package/dist/components/DropDown/DropDown.stories.js +1 -0
- package/dist/components/DropDown/DropDownOld.css +3 -0
- package/dist/components/DropDown/DropDownOld.js +186 -0
- package/dist/components/DropDown/PopoverPlayground.css +22 -0
- package/dist/components/DropDown/PopoverPlayground.js +235 -0
- package/dist/components/EnhancedTable/EnhancedTable.js +5 -6
- package/dist/components/FabButton/DesignFabButton.stories.js +3 -1
- package/dist/components/FabButton/FabButton.js +25 -5
- package/dist/components/Grid/DesignGrid.stories.js +9 -3
- package/dist/components/Grid/Grid.css +325 -0
- package/dist/components/Grid/Grid.js +57 -16
- package/dist/components/Grid/GridItem.js +31 -13
- package/dist/components/Grid/GridItemOld.js +43 -0
- package/dist/components/Grid/GridOld.css +0 -0
- package/dist/components/Grid/GridOld.js +53 -0
- package/dist/components/Header/Header.js +95 -116
- package/dist/components/IconButton/DesignIconButton.stories.js +22 -2
- package/dist/components/IconButton/IconButton.css +121 -1
- package/dist/components/IconButton/IconButton.js +98 -53
- package/dist/components/IconButton/IconButtonOld.css +0 -0
- package/dist/components/IconButton/IconButtonOld.js +138 -0
- package/dist/components/IconButtonSquare/IconButtonSquare.js +20 -90
- package/dist/components/IconButtonSquare/IconButtonSquareOld.css +43 -0
- package/dist/components/IconButtonSquare/IconButtonSquareOld.js +133 -0
- package/dist/components/InputAutocomplete/InputAutocomplete.css +109 -0
- package/dist/components/InputAutocomplete/InputAutocomplete.js +316 -77
- package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +118 -6
- package/dist/components/InputAutocomplete/InputAutocompleteOld.css +5 -0
- package/dist/components/InputAutocomplete/InputAutocompleteOld.js +178 -0
- package/dist/components/InputPassword/InputPassword.js +10 -20
- package/dist/components/InputText/InputText.css +442 -1
- package/dist/components/InputText/InputText.js +298 -239
- package/dist/components/InputText/InputText.stories.js +12 -3
- package/dist/components/InputText/InputTextOld.css +10 -0
- package/dist/components/InputText/InputTextOld.js +340 -0
- package/dist/components/InputTextArea/DesignInputTextArea.stories.js +30 -4
- package/dist/components/InputTextArea/InputTextArea.js +13 -6
- package/dist/components/LoadingSection/LoadingSection.css +44 -2
- package/dist/components/LoadingSection/LoadingSection.js +63 -9
- package/dist/components/MenuItem/DesignMenuItem.stories.js +1 -0
- package/dist/components/MenuItem/MenuItem.css +31 -6
- package/dist/components/MenuItem/MenuItem.js +95 -50
- package/dist/components/MenuItem/MenuItemOld.js +139 -0
- package/dist/components/MenuLateralLeft/MenuLateralLeft.js +60 -40
- package/dist/components/MenuLateralRight/MenuLateralRight.js +23 -8
- package/dist/components/Modal/DesignModal.stories.js +54 -0
- package/dist/components/Modal/Modal.css +81 -2
- package/dist/components/Modal/Modal.js +112 -80
- package/dist/components/Modal/Modal.stories.js +13 -2
- package/dist/components/Modal/ModalOld.css +3 -0
- package/dist/components/Modal/ModalOld.js +230 -0
- package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +9 -1
- package/dist/components/PaginationFooter/PaginationFooter.css +73 -0
- package/dist/components/PaginationFooter/PaginationFooter.js +45 -87
- package/dist/components/RadioButton/Radio.css +115 -16
- package/dist/components/RadioButton/Radio.js +70 -94
- package/dist/components/RadioButton/Radio.stories.js +42 -18
- package/dist/components/RadioButton/RadioOld.css +31 -0
- package/dist/components/RadioButton/RadioOld.js +142 -0
- package/dist/components/Ripple/DesignRipple.js +77 -0
- package/dist/components/Ripple/Ripple.stories.js +45 -0
- package/dist/components/Scrollbar/Scrollbar.js +21 -6
- package/dist/components/SelectInput/DesignSelectInput.js +62 -23
- package/dist/components/SelectInput/SelectInput.css +128 -10
- package/dist/components/SelectInput/SelectInput.js +233 -246
- package/dist/components/SelectInput/SelectInputOld.css +17 -0
- package/dist/components/SelectInput/SelectInputOld.js +325 -0
- package/dist/components/Stars/Stars.css +28 -28
- package/dist/components/Stars/Stars.js +22 -12
- package/dist/components/Stepper/Stepper.css +1 -0
- package/dist/components/Stepper/Stepper.js +81 -24
- package/dist/components/Table/DesignTable.stories.js +1 -0
- package/dist/components/Table/Table.css +56 -53
- package/dist/components/Table/Table.js +55 -75
- package/dist/components/Table/TableOld.css +79 -0
- package/dist/components/Table/TableOld.js +165 -0
- package/dist/components/Tabs/DesignTabs.js +37 -12
- package/dist/components/Tabs/Tabs.css +39 -4
- package/dist/components/Tabs/Tabs.js +194 -30
- package/dist/components/Tabs/Tabs.stories.js +8 -1
- package/dist/components/Tabs/TabsOld.js +92 -0
- package/dist/components/Tag/Tag.js +19 -9
- package/dist/components/Toggle/Toggle.css +122 -3
- package/dist/components/Toggle/Toggle.js +95 -68
- package/dist/components/Tooltip/DesignTooltip.stories.js +48 -0
- package/dist/components/Tooltip/Tooltip.css +75 -0
- package/dist/components/Tooltip/Tooltip.js +126 -0
- package/dist/components/Tooltip/Tooltip.stories.js +40 -0
- package/dist/components/Typography/Typography.css +9 -0
- package/dist/components/Typography/Typography.js +30 -21
- package/dist/components/Typography/TypographyOld.js +132 -0
- package/dist/styles/colorConsts.css +24 -0
- package/dist/styles/main.css +41 -49
- package/dist/styles/scpacingConsts.css +26 -0
- package/dist/styles/zIndexConsts.css +9 -0
- package/package.json +2 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
13
|
+
|
|
14
|
+
require("../../styles/main.css");
|
|
15
|
+
|
|
16
|
+
require("./IconButtonSquare.css");
|
|
17
|
+
|
|
18
|
+
var _TouchRipple = _interopRequireDefault(require("@mui/material/ButtonBase/TouchRipple"));
|
|
19
|
+
|
|
20
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
21
|
+
|
|
22
|
+
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
23
|
+
|
|
24
|
+
var _excluded = ["text", "icon", "active", "badge", "onClick", "styles", "tooltip", "placementTooltip", "variant", "fontWeight", "textVisibleMenuMobile", "className", "stylesText", "stylesBadge", "disabled"];
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
28
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
29
|
+
|
|
30
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
|
+
|
|
32
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
33
|
+
|
|
34
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
35
|
+
|
|
36
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
37
|
+
|
|
38
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
39
|
+
|
|
40
|
+
var IconButtonSquare = function IconButtonSquare(_ref) {
|
|
41
|
+
var text = _ref.text,
|
|
42
|
+
icon = _ref.icon,
|
|
43
|
+
active = _ref.active,
|
|
44
|
+
badge = _ref.badge,
|
|
45
|
+
onClick = _ref.onClick,
|
|
46
|
+
styles = _ref.styles,
|
|
47
|
+
tooltip = _ref.tooltip,
|
|
48
|
+
placementTooltip = _ref.placementTooltip,
|
|
49
|
+
variant = _ref.variant,
|
|
50
|
+
fontWeight = _ref.fontWeight,
|
|
51
|
+
textVisibleMenuMobile = _ref.textVisibleMenuMobile,
|
|
52
|
+
className = _ref.className,
|
|
53
|
+
stylesText = _ref.stylesText,
|
|
54
|
+
stylesBadge = _ref.stylesBadge,
|
|
55
|
+
disabled = _ref.disabled,
|
|
56
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
57
|
+
|
|
58
|
+
var rippleRef = _react.default.useRef(null);
|
|
59
|
+
|
|
60
|
+
var onRippleStart = function onRippleStart(e) {
|
|
61
|
+
rippleRef.current.start(e);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var onRippleStop = function onRippleStop(e) {
|
|
65
|
+
rippleRef.current.stop(e);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement(_IconButton.default, _extends({
|
|
69
|
+
onMouseDown: onRippleStart,
|
|
70
|
+
onMouseUp: onRippleStop,
|
|
71
|
+
disableRipple: true,
|
|
72
|
+
className: className,
|
|
73
|
+
disabled: disabled,
|
|
74
|
+
sx: _objectSpread({
|
|
75
|
+
width: '4.75rem',
|
|
76
|
+
height: '4.75rem',
|
|
77
|
+
background: active ? 'white' : 'transparent',
|
|
78
|
+
borderRadius: '0',
|
|
79
|
+
'&:focus': {
|
|
80
|
+
outline: 'none!important'
|
|
81
|
+
},
|
|
82
|
+
padding: textVisibleMenuMobile && '8px 20px'
|
|
83
|
+
}, styles),
|
|
84
|
+
onClick: onClick
|
|
85
|
+
}, props), /*#__PURE__*/_react.default.createElement(_TouchRipple.default, {
|
|
86
|
+
ref: rippleRef,
|
|
87
|
+
center: false
|
|
88
|
+
}), /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
89
|
+
title: tooltip || '',
|
|
90
|
+
placement: placementTooltip
|
|
91
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
92
|
+
className: "cbx-iconButtonSquare-container ".concat(textVisibleMenuMobile ? 'menuMobile' : '')
|
|
93
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
94
|
+
className: "cbx-iconButtonSquare-containerIcon ".concat(active ? 'cbx-iconButtonSquare-containerIcon-active' : '')
|
|
95
|
+
}, badge && /*#__PURE__*/_react.default.createElement("div", {
|
|
96
|
+
style: _objectSpread({}, stylesBadge),
|
|
97
|
+
className: "cbx-iconButtonSquare-red-dot ".concat(text ? '' : 'cbx-iconButtonSquare-red-dot-noText')
|
|
98
|
+
}), icon), text && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
99
|
+
variant: variant || 'XS',
|
|
100
|
+
color: active ? 'var(--primary)' : 'var(--gray3)',
|
|
101
|
+
fontWeight: fontWeight,
|
|
102
|
+
styles: _objectSpread({
|
|
103
|
+
overflow: 'hidden',
|
|
104
|
+
whiteSpace: 'nowrap',
|
|
105
|
+
textOverflow: 'ellipsis',
|
|
106
|
+
maxWidth: textVisibleMenuMobile ? '4.5rem' : '3.25rem'
|
|
107
|
+
}, stylesText)
|
|
108
|
+
}, text)))));
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
IconButtonSquare.displayName = "IconButtonSquare";
|
|
112
|
+
IconButtonSquare.propTypes = {
|
|
113
|
+
text: _propTypes.default.any,
|
|
114
|
+
icon: _propTypes.default.node,
|
|
115
|
+
active: _propTypes.default.bool,
|
|
116
|
+
badge: _propTypes.default.bool,
|
|
117
|
+
onClick: _propTypes.default.func,
|
|
118
|
+
styles: _propTypes.default.object,
|
|
119
|
+
tooltip: _propTypes.default.string,
|
|
120
|
+
placementTooltip: _propTypes.default.string
|
|
121
|
+
};
|
|
122
|
+
IconButtonSquare.defaultProps = {
|
|
123
|
+
text: '',
|
|
124
|
+
icon: undefined,
|
|
125
|
+
active: false,
|
|
126
|
+
badge: false,
|
|
127
|
+
onClick: Function.prototype,
|
|
128
|
+
styles: {},
|
|
129
|
+
tooltip: '',
|
|
130
|
+
placementTooltip: 'bottom'
|
|
131
|
+
};
|
|
132
|
+
var _default = IconButtonSquare;
|
|
133
|
+
exports.default = _default;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
.cbx-inputAutocomplete-icon-button {
|
|
2
|
+
opacity: 0;
|
|
3
|
+
transition: opacity 0.3s ease-in-out;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.cbx-inputAutocomplete-container:hover .cbx-inputAutocomplete-icon-button {
|
|
7
|
+
opacity: 1;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.cbx-inputText-container-disabled.cbx-inputText-container-select.cbx-inputText-container:after {
|
|
11
|
+
border-left: 0px solid transparent;
|
|
12
|
+
border-right: 0px solid transparent;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.cbx-input.cbx-inputText-select {
|
|
16
|
+
padding: 1.031rem 0.875rem;
|
|
17
|
+
min-height: 3.5rem;
|
|
18
|
+
padding-right: 2rem;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.cbx-inputText-container-disabled .cbx-input.cbx-inputText-select {
|
|
23
|
+
cursor: auto;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.cbx-inputAutocomplete-container {
|
|
27
|
+
position: relative;
|
|
28
|
+
width: 15rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.cbx-inputAutocomplete-options-container {
|
|
32
|
+
background-color: rgb(255, 255, 255);
|
|
33
|
+
color: rgba(0, 0, 0, 0.87);
|
|
34
|
+
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
35
|
+
border-radius: 0.25rem;
|
|
36
|
+
box-shadow: rgba(0, 0, 0, 0) 0px 5px 5px -3px, rgba(0, 0, 0, 0.30) 0px 2px 2px 0px, rgba(0, 0, 0, 0) 0px 3px 14px 2px;
|
|
37
|
+
position: absolute;
|
|
38
|
+
overflow: hidden auto;
|
|
39
|
+
min-width: 1rem;
|
|
40
|
+
min-height: 1rem;
|
|
41
|
+
max-height: calc(100% - 2rem);
|
|
42
|
+
max-width: calc(100% - 2rem);
|
|
43
|
+
outline: 0px;
|
|
44
|
+
opacity: 1;
|
|
45
|
+
transform: none;
|
|
46
|
+
min-width: 15rem;
|
|
47
|
+
transition: opacity 248ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 165ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
48
|
+
transform-origin: 7.5rem 0px;
|
|
49
|
+
pointer-events: auto;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.cbx-inputAutocomplete-options-container.cbx-inputAutocomplete-options-container-open {
|
|
53
|
+
animation: dropdownOpen 150ms ease-out forwards;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.cbx-inputAutocomplete-options-container.cbx-inputAutocomplete-options-container-close {
|
|
57
|
+
animation: dropdownClose 150ms ease-out forwards;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.cbx-inputAutocomplete-presentation {
|
|
61
|
+
position: fixed;
|
|
62
|
+
z-index: var(--zIdxAutocomplete);
|
|
63
|
+
inset: 0px;
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.cbx-inputAutocomplete-options {
|
|
68
|
+
list-style: none;
|
|
69
|
+
margin: 0px;
|
|
70
|
+
padding: 0.5rem 0px;
|
|
71
|
+
position: relative;
|
|
72
|
+
outline: 0px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.cbx-inputAutocomplete-backdrop {
|
|
76
|
+
position: fixed;
|
|
77
|
+
display: flex;
|
|
78
|
+
-webkit-box-align: center;
|
|
79
|
+
align-items: center;
|
|
80
|
+
-webkit-box-pack: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
inset: 0px;
|
|
83
|
+
background-color: transparent;
|
|
84
|
+
-webkit-tap-highlight-color: transparent;
|
|
85
|
+
z-index: -1;
|
|
86
|
+
pointer-events: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@keyframes dropdownOpen {
|
|
90
|
+
0% {
|
|
91
|
+
opacity: 0;
|
|
92
|
+
transform: scale(0.75, 0.5625);
|
|
93
|
+
}
|
|
94
|
+
100% {
|
|
95
|
+
opacity: 1;
|
|
96
|
+
transform: scale(1, 1);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@keyframes dropdownClose {
|
|
101
|
+
0% {
|
|
102
|
+
opacity: 1;
|
|
103
|
+
transform: scale(1, 1);
|
|
104
|
+
}
|
|
105
|
+
100% {
|
|
106
|
+
opacity: 0;
|
|
107
|
+
transform: scale(0.75, 0.5625);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -9,9 +9,9 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
require("
|
|
12
|
+
var _reactDom = require("react-dom");
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
require("../../styles/main.css");
|
|
15
15
|
|
|
16
16
|
require("./InputAutocomplete.css");
|
|
17
17
|
|
|
@@ -19,7 +19,11 @@ var _InputText = _interopRequireDefault(require("../InputText/InputText"));
|
|
|
19
19
|
|
|
20
20
|
var _MenuItem = _interopRequireDefault(require("../MenuItem/MenuItem"));
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _IconButton = _interopRequireDefault(require("../IconButton/IconButton"));
|
|
23
|
+
|
|
24
|
+
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
25
|
+
|
|
26
|
+
var _excluded = ["children", "className", "onChange", "onInputChange", "label", "value", "inputValue", "style", "styles", "sx", "prefixClass", "options", "getOptionLabel", "getOptionSelected", "defaultValue", "filterOptions", "freeSolo", "clearOnBlur", "selectOnFocus"];
|
|
23
27
|
|
|
24
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
29
|
|
|
@@ -31,97 +35,332 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
31
35
|
|
|
32
36
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
33
37
|
|
|
38
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
39
|
+
|
|
40
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
41
|
+
|
|
42
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
43
|
+
|
|
44
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
45
|
+
|
|
46
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
47
|
+
|
|
48
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
|
+
|
|
34
50
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
35
51
|
|
|
36
52
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
37
53
|
|
|
38
|
-
var top100Films = [{
|
|
39
|
-
label: 'The Shawshank Redemption The Shawshank Redemption',
|
|
40
|
-
year: 1994
|
|
41
|
-
}, {
|
|
42
|
-
label: 'The Godfather',
|
|
43
|
-
year: 1972
|
|
44
|
-
}, {
|
|
45
|
-
label: 'The Godfather: Part II',
|
|
46
|
-
year: 1974
|
|
47
|
-
}, {
|
|
48
|
-
label: 'The Dark Knight',
|
|
49
|
-
year: 2008
|
|
50
|
-
}, {
|
|
51
|
-
label: '12 Angry Men',
|
|
52
|
-
year: 1957
|
|
53
|
-
}, {
|
|
54
|
-
label: "Schindler's List",
|
|
55
|
-
year: 1993
|
|
56
|
-
}, {
|
|
57
|
-
label: 'Pulp Fiction',
|
|
58
|
-
year: 1994
|
|
59
|
-
}];
|
|
60
|
-
|
|
61
54
|
var InputAutocomplete = function InputAutocomplete(_ref) {
|
|
62
|
-
var
|
|
63
|
-
id = _ref.id,
|
|
55
|
+
var children = _ref.children,
|
|
64
56
|
className = _ref.className,
|
|
65
57
|
onChange = _ref.onChange,
|
|
58
|
+
onInputChange = _ref.onInputChange,
|
|
66
59
|
label = _ref.label,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
helperText = _ref.helperText,
|
|
72
|
-
fullWidth = _ref.fullWidth,
|
|
60
|
+
value = _ref.value,
|
|
61
|
+
propInputValue = _ref.inputValue,
|
|
62
|
+
style = _ref.style,
|
|
63
|
+
styles = _ref.styles,
|
|
73
64
|
sx = _ref.sx,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
propPrefixClass = _ref.prefixClass,
|
|
66
|
+
options = _ref.options,
|
|
67
|
+
_ref$getOptionLabel = _ref.getOptionLabel,
|
|
68
|
+
getOptionLabel = _ref$getOptionLabel === void 0 ? function (option) {
|
|
69
|
+
return option.label || option.text || option.translation || option.value;
|
|
70
|
+
} : _ref$getOptionLabel,
|
|
71
|
+
_ref$getOptionSelecte = _ref.getOptionSelected,
|
|
72
|
+
getOptionSelected = _ref$getOptionSelecte === void 0 ? function (option, valueSelected) {
|
|
73
|
+
return option === valueSelected;
|
|
74
|
+
} : _ref$getOptionSelecte,
|
|
75
|
+
defaultValue = _ref.defaultValue,
|
|
76
|
+
filterOptions = _ref.filterOptions,
|
|
77
|
+
_ref$freeSolo = _ref.freeSolo,
|
|
78
|
+
freeSolo = _ref$freeSolo === void 0 ? false : _ref$freeSolo,
|
|
79
|
+
_ref$clearOnBlur = _ref.clearOnBlur,
|
|
80
|
+
clearOnBlur = _ref$clearOnBlur === void 0 ? true : _ref$clearOnBlur,
|
|
81
|
+
_ref$selectOnFocus = _ref.selectOnFocus,
|
|
82
|
+
selectOnFocus = _ref$selectOnFocus === void 0 ? false : _ref$selectOnFocus,
|
|
77
83
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
78
84
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
var _useDynamicStyles = (0, _useDynamicStyles2.default)(sx),
|
|
86
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
87
|
+
dynamicPrefixClass = _useDynamicStyles.prefixClass;
|
|
88
|
+
|
|
89
|
+
var prefixClass = propPrefixClass || dynamicPrefixClass;
|
|
90
|
+
|
|
91
|
+
var _React$useState = _react.default.useState(false),
|
|
92
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
93
|
+
isOpen = _React$useState2[0],
|
|
94
|
+
setIsOpen = _React$useState2[1];
|
|
95
|
+
|
|
96
|
+
var _React$useState3 = _react.default.useState(false),
|
|
97
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
98
|
+
isClosing = _React$useState4[0],
|
|
99
|
+
setIsClosing = _React$useState4[1];
|
|
100
|
+
|
|
101
|
+
var _React$useState5 = _react.default.useState(value || null),
|
|
102
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
103
|
+
selectedValue = _React$useState6[0],
|
|
104
|
+
setSelectedValue = _React$useState6[1];
|
|
105
|
+
|
|
106
|
+
var _React$useState7 = _react.default.useState(propInputValue || ''),
|
|
107
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
108
|
+
inputValue = _React$useState8[0],
|
|
109
|
+
setInputValue = _React$useState8[1];
|
|
110
|
+
|
|
111
|
+
var _React$useState9 = _react.default.useState(options),
|
|
112
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
113
|
+
filteredOptions = _React$useState10[0],
|
|
114
|
+
setFilteredOptions = _React$useState10[1];
|
|
115
|
+
|
|
116
|
+
var selectRef = _react.default.useRef(null);
|
|
117
|
+
|
|
118
|
+
var dropdownRef = _react.default.useRef(null);
|
|
119
|
+
|
|
120
|
+
var shouldShowDropdown = isOpen && filteredOptions.length > 0;
|
|
121
|
+
|
|
122
|
+
_react.default.useEffect(function () {
|
|
123
|
+
if (propInputValue !== undefined) {
|
|
124
|
+
setInputValue(propInputValue);
|
|
125
|
+
}
|
|
126
|
+
}, [propInputValue]);
|
|
127
|
+
|
|
128
|
+
_react.default.useEffect(function () {
|
|
129
|
+
setSelectedValue(value);
|
|
130
|
+
}, [value]);
|
|
131
|
+
|
|
132
|
+
_react.default.useEffect(function () {
|
|
133
|
+
var newFilteredOptions = options;
|
|
134
|
+
|
|
135
|
+
if (filterOptions) {
|
|
136
|
+
newFilteredOptions = filterOptions(options, {
|
|
137
|
+
inputValue: inputValue
|
|
138
|
+
});
|
|
139
|
+
} else {
|
|
140
|
+
newFilteredOptions = options.filter(function (option) {
|
|
141
|
+
var optionLabel = getOptionLabel(option);
|
|
142
|
+
return optionLabel.toLowerCase().includes(inputValue.toLowerCase());
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
setFilteredOptions(newFilteredOptions);
|
|
147
|
+
}, [inputValue, options]);
|
|
148
|
+
|
|
149
|
+
var closeDropdown = function closeDropdown() {
|
|
150
|
+
setIsClosing(true);
|
|
151
|
+
setTimeout(function () {
|
|
152
|
+
setIsOpen(false);
|
|
153
|
+
setIsClosing(false);
|
|
154
|
+
}, 150);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
var handleOptionClick = function handleOptionClick(e, option) {
|
|
158
|
+
var optionLabel = getOptionLabel(option);
|
|
159
|
+
|
|
160
|
+
if (props.inputValue === undefined) {
|
|
161
|
+
setInputValue(optionLabel);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (props.value === undefined) {
|
|
165
|
+
setSelectedValue(option);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (onChange) {
|
|
169
|
+
onChange(e, option);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
closeDropdown();
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
var handleInputChange = function handleInputChange(e) {
|
|
176
|
+
var newInputValue = e.target.value;
|
|
177
|
+
|
|
178
|
+
if (props.inputValue === undefined) {
|
|
179
|
+
setInputValue(newInputValue);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (onInputChange) {
|
|
183
|
+
onInputChange(e, newInputValue);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
setIsOpen(true);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
var handleInputBlur = function handleInputBlur(e) {
|
|
190
|
+
if (!freeSolo) {
|
|
191
|
+
var matchedOption = options.find(function (option) {
|
|
192
|
+
return getOptionLabel(option).toLowerCase() === inputValue.toLowerCase();
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
if (matchedOption) {
|
|
196
|
+
if (props.value === undefined) {
|
|
197
|
+
setSelectedValue(matchedOption);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (props.inputValue === undefined) {
|
|
201
|
+
setInputValue(getOptionLabel(matchedOption));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (onChange) {
|
|
205
|
+
onChange(e, matchedOption);
|
|
206
|
+
}
|
|
207
|
+
} else if (props.inputValue === undefined) {
|
|
208
|
+
setInputValue(selectedValue ? getOptionLabel(selectedValue) : '');
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (clearOnBlur) {
|
|
213
|
+
closeDropdown();
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
var handleInputFocus = function handleInputFocus(e) {
|
|
218
|
+
if (selectOnFocus) {
|
|
219
|
+
e.target.select();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
setIsOpen(true);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
var updateDropdownPosition = function updateDropdownPosition() {
|
|
226
|
+
var _selectRef$current, _selectRef$current2, _selectRef$current2$c;
|
|
227
|
+
|
|
228
|
+
if (selectRef.current && selectRef !== null && selectRef !== void 0 && (_selectRef$current = selectRef.current) !== null && _selectRef$current !== void 0 && _selectRef$current.children[0] && selectRef !== null && selectRef !== void 0 && (_selectRef$current2 = selectRef.current) !== null && _selectRef$current2 !== void 0 && (_selectRef$current2$c = _selectRef$current2.children[0]) !== null && _selectRef$current2$c !== void 0 && _selectRef$current2$c.children[0] && dropdownRef.current) {
|
|
229
|
+
var _selectRef$current3, _selectRef$current3$c, _selectRef$current3$c2;
|
|
230
|
+
|
|
231
|
+
var selectRect = selectRef === null || selectRef === void 0 ? void 0 : (_selectRef$current3 = selectRef.current) === null || _selectRef$current3 === void 0 ? void 0 : (_selectRef$current3$c = _selectRef$current3.children[0]) === null || _selectRef$current3$c === void 0 ? void 0 : (_selectRef$current3$c2 = _selectRef$current3$c.children[0]) === null || _selectRef$current3$c2 === void 0 ? void 0 : _selectRef$current3$c2.getBoundingClientRect();
|
|
232
|
+
var dropdownHeight = dropdownRef.current.offsetHeight + 15;
|
|
233
|
+
var isOverflowingBelow = selectRect.bottom + dropdownHeight > window.innerHeight;
|
|
234
|
+
var topPosition = isOverflowingBelow ? window.innerHeight - dropdownHeight : selectRect.bottom;
|
|
235
|
+
dropdownRef.current.style.top = "".concat(topPosition, "px");
|
|
236
|
+
dropdownRef.current.style.left = "".concat(selectRect.left, "px");
|
|
237
|
+
dropdownRef.current.style.width = "".concat(selectRect.width, "px");
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
_react.default.useEffect(function () {
|
|
242
|
+
updateDropdownPosition();
|
|
243
|
+
}, [isOpen]);
|
|
244
|
+
|
|
245
|
+
_react.default.useEffect(function () {
|
|
246
|
+
var handleResize = function handleResize() {
|
|
247
|
+
if (isOpen) {
|
|
248
|
+
updateDropdownPosition();
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
window.addEventListener('resize', handleResize);
|
|
253
|
+
return function () {
|
|
254
|
+
window.removeEventListener('resize', handleResize);
|
|
255
|
+
};
|
|
256
|
+
}, [isOpen]);
|
|
257
|
+
|
|
258
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
259
|
+
className: prefixClass("cbx-inputAutocomplete-container ".concat(isOpen ? 'cbx-inputAutocomplete-container-open' : '')),
|
|
260
|
+
onClick: function onClick() {
|
|
261
|
+
if (isOpen && !inputValue) {
|
|
262
|
+
closeDropdown();
|
|
263
|
+
} else {
|
|
264
|
+
setIsOpen(true);
|
|
98
265
|
}
|
|
99
|
-
}, sx),
|
|
100
|
-
freeSolo: true,
|
|
101
|
-
options: top100Films,
|
|
102
|
-
renderInput: function renderInput(params) {
|
|
103
|
-
return /*#__PURE__*/_react.default.createElement(_InputText.default, _extends({}, params, {
|
|
104
|
-
error: error,
|
|
105
|
-
label: label,
|
|
106
|
-
helper: helper,
|
|
107
|
-
success: success,
|
|
108
|
-
helperText: helperText,
|
|
109
|
-
endAdornment: endAdornment,
|
|
110
|
-
variant: variant,
|
|
111
|
-
fullWidth: fullWidth,
|
|
112
|
-
required: required,
|
|
113
|
-
width: width
|
|
114
|
-
}));
|
|
115
266
|
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
267
|
+
style: _objectSpread(_objectSpread(_objectSpread({
|
|
268
|
+
width: props.fullWidth && '100%'
|
|
269
|
+
}, styles), style), stylesInLine),
|
|
270
|
+
ref: selectRef
|
|
271
|
+
}, /*#__PURE__*/_react.default.createElement(_InputText.default, _extends({
|
|
272
|
+
label: label,
|
|
273
|
+
value: inputValue,
|
|
274
|
+
className: "".concat(className, " cbx-inputPassword-button-spacing"),
|
|
275
|
+
shrink: !!inputValue || !!selectedValue,
|
|
276
|
+
prefixClass: prefixClass,
|
|
277
|
+
fullWidth: props.fullWidth,
|
|
278
|
+
onChange: handleInputChange,
|
|
279
|
+
onFocus: handleInputFocus,
|
|
280
|
+
onBlur: handleInputBlur,
|
|
281
|
+
defaultValue: defaultValue,
|
|
282
|
+
InputProps: {
|
|
283
|
+
endAdornment: inputValue && /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
284
|
+
prefixClass: prefixClass,
|
|
285
|
+
className: "cbx-inputAutocomplete-icon-button",
|
|
286
|
+
onClick: function onClick(e) {
|
|
287
|
+
e.stopPropagation();
|
|
288
|
+
e.preventDefault();
|
|
289
|
+
setFilteredOptions(options);
|
|
290
|
+
|
|
291
|
+
if (props.inputValue === undefined) {
|
|
292
|
+
setInputValue('');
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (onInputChange) {
|
|
296
|
+
onInputChange(e, '');
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
icon: /*#__PURE__*/_react.default.createElement("i", {
|
|
300
|
+
className: "ri-close-fill",
|
|
301
|
+
tabIndex: "-1"
|
|
302
|
+
})
|
|
303
|
+
})
|
|
120
304
|
}
|
|
121
|
-
}, props
|
|
305
|
+
}, props, {
|
|
306
|
+
type: 'autocomplete'
|
|
307
|
+
})), isOpen && /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement("div", {
|
|
308
|
+
className: prefixClass('cbx-inputAutocomplete-presentation')
|
|
309
|
+
}, /*#__PURE__*/_react.default.createElement(OutsideClickHandler, {
|
|
310
|
+
excludedRefs: [selectRef, dropdownRef],
|
|
311
|
+
onOutsideClick: function onOutsideClick() {
|
|
312
|
+
closeDropdown();
|
|
313
|
+
}
|
|
314
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
315
|
+
className: prefixClass("cbx-inputAutocomplete-options-container ".concat(shouldShowDropdown && !isClosing ? 'cbx-inputAutocomplete-options-container-open' : 'cbx-inputAutocomplete-options-container-close')),
|
|
316
|
+
ref: dropdownRef
|
|
317
|
+
}, /*#__PURE__*/_react.default.createElement("ul", {
|
|
318
|
+
className: prefixClass('cbx-inputAutocomplete-options')
|
|
319
|
+
}, filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.map(function (item, index) {
|
|
320
|
+
return /*#__PURE__*/_react.default.createElement(_MenuItem.default, _extends({}, item, {
|
|
321
|
+
value: item.value || getOptionLabel(item),
|
|
322
|
+
key: "".concat(item.value || getOptionLabel(item), "-").concat(index),
|
|
323
|
+
onClick: function onClick(e) {
|
|
324
|
+
handleOptionClick(e, item);
|
|
325
|
+
},
|
|
326
|
+
active: getOptionSelected(item, selectedValue),
|
|
327
|
+
fullWidth: props.fullWidth
|
|
328
|
+
}), getOptionLabel(item));
|
|
329
|
+
})))), document.body));
|
|
122
330
|
};
|
|
123
331
|
|
|
124
332
|
InputAutocomplete.displayName = "InputAutocomplete";
|
|
333
|
+
|
|
334
|
+
var OutsideClickHandler = function OutsideClickHandler(_ref2) {
|
|
335
|
+
var children = _ref2.children,
|
|
336
|
+
excludedRefs = _ref2.excludedRefs,
|
|
337
|
+
onOutsideClick = _ref2.onOutsideClick;
|
|
338
|
+
|
|
339
|
+
var wrapperRef = _react.default.useRef(null);
|
|
340
|
+
|
|
341
|
+
_react.default.useEffect(function () {
|
|
342
|
+
var handleClickOutside = function handleClickOutside(event) {
|
|
343
|
+
var clickedExcluded = excludedRefs.some(function (ref) {
|
|
344
|
+
return ref.current && ref.current.contains(event.target);
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
if (wrapperRef.current && !wrapperRef.current.contains(event.target) && !clickedExcluded) {
|
|
348
|
+
onOutsideClick();
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
353
|
+
return function () {
|
|
354
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
355
|
+
};
|
|
356
|
+
}, [excludedRefs, onOutsideClick]);
|
|
357
|
+
|
|
358
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
359
|
+
ref: wrapperRef
|
|
360
|
+
}, children);
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
OutsideClickHandler.displayName = "OutsideClickHandler";
|
|
125
364
|
InputAutocomplete.propTypes = {
|
|
126
365
|
label: _propTypes.default.string,
|
|
127
366
|
helper: _propTypes.default.string,
|