@councilbox/councilbox-ui 2.0.56 → 2.0.58
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/build-index.js +0 -7
- package/dist/components/1.Introduction.stories.mdx +1 -1
- package/dist/components/2.Changelog.stories.mdx +17 -0
- package/dist/components/Checkbox/Checkbox.css +6 -0
- package/dist/components/Checkbox/Checkbox.js +3 -1
- package/dist/components/DragDrop/DragDrop.css +9 -8
- package/dist/components/DragDrop/DragDrop.js +3 -1
- package/dist/components/DrawerPanel/DrawerPanel.js +1 -1
- package/dist/components/Grid/Grid.js +1 -0
- package/dist/components/Grid/GridItem.js +2 -1
- package/dist/components/InputAutocomplete/InputAutocomplete.js +92 -18
- package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +90 -1
- package/dist/components/InputText/InputText.css +0 -10
- package/dist/components/InputText/InputText.stories.js +15 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/RichTextInput/DesignRichTextInput.stories.js +1 -7
- package/dist/components/Scrollbar/Scrollbar.css +19 -60
- package/dist/components/Scrollbar/Scrollbar.js +62 -384
- package/dist/components/SelectInput/SelectInput.js +12 -6
- package/dist/components/Stepper/Stepper.js +2 -1
- package/dist/components/Table/TableRow.js +1 -0
- package/dist/components/Toast/Toast.js +1 -1
- package/dist/components/Toggle/Toggle.js +1 -1
- package/package.json +1 -2
- package/ScrollbarOld.js +0 -3
- package/dist/components/ScrollbarOld/DesignScrollbarOld.js +0 -24
- package/dist/components/ScrollbarOld/ScrollbarOld.css +0 -38
- package/dist/components/ScrollbarOld/ScrollbarOld.js +0 -104
- package/dist/components/ScrollbarOld/ScrollbarOld.stories.js +0 -37
package/dist/build-index.js
CHANGED
|
@@ -201,12 +201,6 @@ Object.defineProperty(exports, "Scrollbar", {
|
|
|
201
201
|
return _Scrollbar["default"];
|
|
202
202
|
}
|
|
203
203
|
});
|
|
204
|
-
Object.defineProperty(exports, "ScrollbarOld", {
|
|
205
|
-
enumerable: true,
|
|
206
|
-
get: function get() {
|
|
207
|
-
return _ScrollbarOld["default"];
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
204
|
Object.defineProperty(exports, "SelectInput", {
|
|
211
205
|
enumerable: true,
|
|
212
206
|
get: function get() {
|
|
@@ -411,7 +405,6 @@ var _DateTimePicker = _interopRequireDefault(require("./components/DateTimePicke
|
|
|
411
405
|
var _DateRangePicker = _interopRequireDefault(require("./components/DateRangePicker/DateRangePicker"));
|
|
412
406
|
var _TimePicker = _interopRequireDefault(require("./components/TimePicker/TimePicker"));
|
|
413
407
|
var _Scrollbar = _interopRequireDefault(require("./components/Scrollbar/Scrollbar"));
|
|
414
|
-
var _ScrollbarOld = _interopRequireDefault(require("./components/ScrollbarOld/ScrollbarOld"));
|
|
415
408
|
var _RichTextInput = _interopRequireDefault(require("./components/RichTextInput/RichTextInput"));
|
|
416
409
|
var _ToastProvider = _interopRequireDefault(require("./components/Toast/ToastProvider"));
|
|
417
410
|
var _useToast = require("./components/Toast/useToast");
|
|
@@ -16,7 +16,7 @@ a.noStyles:hover{
|
|
|
16
16
|
`}</style>
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
# Librería de componentes ui-councilbox NEW v2.0.
|
|
19
|
+
# Librería de componentes ui-councilbox NEW v2.0.58 🎉
|
|
20
20
|
|
|
21
21
|
<h2>Componentes:</h2>
|
|
22
22
|
<div><a class='noStyles' href='/story/components-accordion--default'>Accordion</a></div>
|
|
@@ -25,6 +25,23 @@ a.noStyles:hover{
|
|
|
25
25
|
<div>Fix zIndex label InputText y SelectInput</div>
|
|
26
26
|
</div>
|
|
27
27
|
|
|
28
|
+
<h2>v2.0.59</h2>
|
|
29
|
+
<div>Fix Checkbox in tables</div>
|
|
30
|
+
<div>Fix Radio in tables</div>
|
|
31
|
+
<div></div>
|
|
32
|
+
|
|
33
|
+
<h2>v2.0.58</h2>
|
|
34
|
+
<div>Version Fix Master no Scrollbar</div>
|
|
35
|
+
<div>Remove new Scrollbar</div>
|
|
36
|
+
<div>Fix error Enter in Modal</div>
|
|
37
|
+
<div>Fix DragDrop in Chrome</div>
|
|
38
|
+
|
|
39
|
+
<h2>v2.0.57</h2>
|
|
40
|
+
<div>Fix Autocomplete multiple</div>
|
|
41
|
+
<div>Fix Label InputText with startAdorment</div>
|
|
42
|
+
<div>Fix SelectInput position</div>
|
|
43
|
+
<div>Fix errors components</div>
|
|
44
|
+
|
|
28
45
|
<h2>v2.0.56</h2>
|
|
29
46
|
<div>Fix Pickers errors</div>
|
|
30
47
|
<div>Fix RichTextInput errors</div>
|
|
@@ -100,9 +100,11 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
100
100
|
ref: inputRef,
|
|
101
101
|
type: "checkbox",
|
|
102
102
|
checked: checked,
|
|
103
|
+
disabled: disabled,
|
|
103
104
|
onChange: handleChange,
|
|
104
105
|
onClick: onChange ? function (e) {
|
|
105
|
-
|
|
106
|
+
e.stopPropagation();
|
|
107
|
+
addRipple(e);
|
|
106
108
|
} : undefined,
|
|
107
109
|
"aria-label": !label && !ariaLabelledby ? ariaLabel || 'Checkbox' : undefined,
|
|
108
110
|
"aria-labelledby": ariaLabelledby || undefined
|
|
@@ -40,15 +40,16 @@
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.cbx-dragDrop-input {
|
|
43
|
+
display: block!important;
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100%;
|
|
43
46
|
position: absolute;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
white-space: nowrap;
|
|
51
|
-
border: 0;
|
|
47
|
+
top: 0;
|
|
48
|
+
left: 0;
|
|
49
|
+
right: 0;
|
|
50
|
+
bottom: 0;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
opacity: 0;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
.cbx-dragDrop-visually-hidden {
|
|
@@ -105,7 +105,9 @@ var DragDrop = function DragDrop(_ref) {
|
|
|
105
105
|
}, resolvedLabel), /*#__PURE__*/_react["default"].createElement("input", _extends({
|
|
106
106
|
id: inputId,
|
|
107
107
|
"aria-labelledby": labelId
|
|
108
|
-
}, getInputProps(),
|
|
108
|
+
}, getInputProps(), {
|
|
109
|
+
title: ''
|
|
110
|
+
}, inputProps, {
|
|
109
111
|
className: prefixClass('cbx-dragDrop-input')
|
|
110
112
|
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
111
113
|
onClick: function onClick(e) {
|
|
@@ -219,7 +219,7 @@ var DrawerPanel = function DrawerPanel(_ref) {
|
|
|
219
219
|
className: prefixClass('cbx-drawerPanel-moreButton')
|
|
220
220
|
}, moreButton)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
221
221
|
className: prefixClass('cbx-drawerPanel-tabs-container')
|
|
222
|
-
}, tabs.length > 0 && /*#__PURE__*/_react["default"].createElement("div", {
|
|
222
|
+
}, Array.isArray(tabs) && tabs.length > 0 && /*#__PURE__*/_react["default"].createElement("div", {
|
|
223
223
|
className: prefixClass(isMobile ? 'cbx-drawerPanel-tabs-block-mobile' : 'cbx-drawerPanel-tabs-block')
|
|
224
224
|
}, /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
225
225
|
onChange: function onChange(index, e) {
|
|
@@ -60,6 +60,7 @@ var Grid = function Grid(_ref) {
|
|
|
60
60
|
className: prefixClass("cbx-grid-container ".concat(className)),
|
|
61
61
|
onClick: onClick,
|
|
62
62
|
onKeyDown: onClick ? function (e) {
|
|
63
|
+
if (e.target !== e.currentTarget) return;
|
|
63
64
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
64
65
|
e.preventDefault();
|
|
65
66
|
onClick(e);
|
|
@@ -37,12 +37,13 @@ var GridItem = function GridItem(_ref) {
|
|
|
37
37
|
dynamicPrefixClass = _useDynamicStyles.prefixClass;
|
|
38
38
|
var prefixClass = propPrefixClass || dynamicPrefixClass;
|
|
39
39
|
return /*#__PURE__*/_react["default"].createElement("div", _extends({
|
|
40
|
-
className: prefixClass("cbx-grid-container-item xs-".concat(xs, " sm-").concat(sm, " md-").concat(md, " lg-").concat(lg, " xl-").concat(xl, " ").concat(className)),
|
|
40
|
+
className: prefixClass("cbx-grid-container-item xs-".concat(xs, " sm-").concat(sm, " md-").concat(md, " lg-").concat(lg, " xl-").concat(xl, " ").concat(className || '')),
|
|
41
41
|
style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, spacingStyle), style), stylesInLine), {}, {
|
|
42
42
|
alignContent: alignContent
|
|
43
43
|
}),
|
|
44
44
|
onClick: onClick,
|
|
45
45
|
onKeyDown: onClick ? function (e) {
|
|
46
|
+
if (e.target !== e.currentTarget) return;
|
|
46
47
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
47
48
|
e.preventDefault();
|
|
48
49
|
onClick(e);
|
|
@@ -19,10 +19,14 @@ var _autoDetectScroll = require("../../utils/autoDetectScroll");
|
|
|
19
19
|
var _utils = require("../../utils");
|
|
20
20
|
var _useFallbackId = _interopRequireDefault(require("../../utils/useFallbackId"));
|
|
21
21
|
var _useA11yGuard2 = require("../../HOCs/useA11yGuard");
|
|
22
|
-
var _excluded = ["children", "className", "onChange", "onInputChange", "label", "value", "autoComplete", "inputValue", "style", "styles", "sx", "loadingText", "loading", "prefixClass", "options", "disabled", "getOptionLabel", "clearable", "getOptionSelected", "defaultValue", "filterOptions", "freeSolo", "InputProps", "clearOnBlur", "selectOnFocus", "id"];
|
|
22
|
+
var _excluded = ["children", "className", "onChange", "onInputChange", "label", "value", "autoComplete", "inputValue", "style", "styles", "sx", "loadingText", "loading", "prefixClass", "options", "disabled", "getOptionLabel", "clearable", "multiple", "getOptionValue", "renderValue", "getOptionSelected", "defaultValue", "filterOptions", "freeSolo", "InputProps", "clearOnBlur", "selectOnFocus", "id"];
|
|
23
23
|
/* eslint-disable no-tabs */
|
|
24
24
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
25
25
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
26
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
27
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
28
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
29
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
26
30
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
31
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28
32
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -36,6 +40,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
36
40
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
37
41
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) { o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
38
42
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } } return t; }
|
|
43
|
+
var EMPTY_OPTIONS = [];
|
|
39
44
|
var InputAutocomplete = function InputAutocomplete(_ref) {
|
|
40
45
|
var children = _ref.children,
|
|
41
46
|
className = _ref.className,
|
|
@@ -54,7 +59,7 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
|
|
|
54
59
|
_ref$loading = _ref.loading,
|
|
55
60
|
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
56
61
|
propPrefixClass = _ref.prefixClass,
|
|
57
|
-
|
|
62
|
+
optionsProp = _ref.options,
|
|
58
63
|
disabled = _ref.disabled,
|
|
59
64
|
_ref$getOptionLabel = _ref.getOptionLabel,
|
|
60
65
|
getOptionLabel = _ref$getOptionLabel === void 0 ? function (option) {
|
|
@@ -68,9 +73,17 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
|
|
|
68
73
|
} : _ref$getOptionLabel,
|
|
69
74
|
_ref$clearable = _ref.clearable,
|
|
70
75
|
clearable = _ref$clearable === void 0 ? true : _ref$clearable,
|
|
76
|
+
_ref$multiple = _ref.multiple,
|
|
77
|
+
multiple = _ref$multiple === void 0 ? false : _ref$multiple,
|
|
78
|
+
_ref$getOptionValue = _ref.getOptionValue,
|
|
79
|
+
getOptionValue = _ref$getOptionValue === void 0 ? function (option) {
|
|
80
|
+
var _ref2, _option$value;
|
|
81
|
+
return (_ref2 = (_option$value = option === null || option === void 0 ? void 0 : option.value) !== null && _option$value !== void 0 ? _option$value : option === null || option === void 0 ? void 0 : option.id) !== null && _ref2 !== void 0 ? _ref2 : option;
|
|
82
|
+
} : _ref$getOptionValue,
|
|
83
|
+
renderValue = _ref.renderValue,
|
|
71
84
|
_ref$getOptionSelecte = _ref.getOptionSelected,
|
|
72
85
|
getOptionSelected = _ref$getOptionSelecte === void 0 ? function (option, valueSelected) {
|
|
73
|
-
return option === valueSelected;
|
|
86
|
+
return multiple ? Array.isArray(valueSelected) && valueSelected.includes(getOptionValue(option)) : option === valueSelected;
|
|
74
87
|
} : _ref$getOptionSelecte,
|
|
75
88
|
defaultValue = _ref.defaultValue,
|
|
76
89
|
filterOptions = _ref.filterOptions,
|
|
@@ -84,6 +97,21 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
|
|
|
84
97
|
selectOnFocus = _ref$selectOnFocus === void 0 ? !freeSolo : _ref$selectOnFocus,
|
|
85
98
|
id = _ref.id,
|
|
86
99
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
100
|
+
var options = Array.isArray(optionsProp) ? optionsProp : EMPTY_OPTIONS;
|
|
101
|
+
var getDisplayLabel = function getDisplayLabel(val) {
|
|
102
|
+
if (multiple) {
|
|
103
|
+
if (renderValue) {
|
|
104
|
+
return renderValue(val) || '';
|
|
105
|
+
}
|
|
106
|
+
return (Array.isArray(val) ? val : []).map(function (v) {
|
|
107
|
+
var matchedOption = options.find(function (option) {
|
|
108
|
+
return getOptionValue(option) === v;
|
|
109
|
+
});
|
|
110
|
+
return matchedOption ? getOptionLabel(matchedOption) : v;
|
|
111
|
+
}).join(', ');
|
|
112
|
+
}
|
|
113
|
+
return val ? getOptionLabel(val) : '';
|
|
114
|
+
};
|
|
87
115
|
var _React$useState = _react["default"].useState(false),
|
|
88
116
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
89
117
|
isOpen = _React$useState2[0],
|
|
@@ -126,11 +154,11 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
|
|
|
126
154
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
127
155
|
isClosing = _React$useState8[0],
|
|
128
156
|
setIsClosing = _React$useState8[1];
|
|
129
|
-
var _React$useState9 = _react["default"].useState(value || null),
|
|
157
|
+
var _React$useState9 = _react["default"].useState(value || (multiple ? [] : null)),
|
|
130
158
|
_React$useState0 = _slicedToArray(_React$useState9, 2),
|
|
131
159
|
internalValue = _React$useState0[0],
|
|
132
160
|
setInternalValue = _React$useState0[1];
|
|
133
|
-
var _React$useState1 = _react["default"].useState(propInputValue ||
|
|
161
|
+
var _React$useState1 = _react["default"].useState(propInputValue || getDisplayLabel(value) || ''),
|
|
134
162
|
_React$useState10 = _slicedToArray(_React$useState1, 2),
|
|
135
163
|
internalInputValue = _React$useState10[0],
|
|
136
164
|
setInternalInputValue = _React$useState10[1];
|
|
@@ -202,6 +230,26 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
|
|
|
202
230
|
}
|
|
203
231
|
};
|
|
204
232
|
var handleOptionClick = function handleOptionClick(e, option) {
|
|
233
|
+
if (multiple) {
|
|
234
|
+
var optionValue = getOptionValue(option);
|
|
235
|
+
var currentValues = Array.isArray(selectedValue) ? selectedValue : [];
|
|
236
|
+
var isSelected = currentValues.includes(optionValue);
|
|
237
|
+
var newValues = isSelected ? currentValues.filter(function (v) {
|
|
238
|
+
return v !== optionValue;
|
|
239
|
+
}) : [].concat(_toConsumableArray(currentValues), [optionValue]);
|
|
240
|
+
if (onChange) {
|
|
241
|
+
onChange(_objectSpread(_objectSpread({}, e), {}, {
|
|
242
|
+
preventDefault: function preventDefault() {},
|
|
243
|
+
stopPropagation: function stopPropagation() {},
|
|
244
|
+
target: {
|
|
245
|
+
value: newValues
|
|
246
|
+
}
|
|
247
|
+
}));
|
|
248
|
+
} else {
|
|
249
|
+
setInternalValue(newValues);
|
|
250
|
+
}
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
205
253
|
var optionLabel = getOptionLabel(option);
|
|
206
254
|
updateInputValue(e, optionLabel);
|
|
207
255
|
updateValue(e, option);
|
|
@@ -216,10 +264,10 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
|
|
|
216
264
|
updateInputValue(e, newInputValue);
|
|
217
265
|
};
|
|
218
266
|
var handleInputBlur = function handleInputBlur(e) {
|
|
219
|
-
handleInputChange(e,
|
|
267
|
+
handleInputChange(e, getDisplayLabel(selectedValue));
|
|
220
268
|
if (clearOnBlur) {
|
|
221
269
|
if (!freeSolo) {
|
|
222
|
-
handleInputChange(e,
|
|
270
|
+
handleInputChange(e, getDisplayLabel(selectedValue));
|
|
223
271
|
}
|
|
224
272
|
}
|
|
225
273
|
closeDropdown(false);
|
|
@@ -260,7 +308,7 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
|
|
|
260
308
|
var updateDropdownPosition = function updateDropdownPosition() {
|
|
261
309
|
var _selectRef$current, _selectRef$current2, _selectRef$current2$c;
|
|
262
310
|
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]) {
|
|
263
|
-
var _selectRef$current3, _selectRef$current3$c, _selectRef$current3$c2;
|
|
311
|
+
var _selectRef$current3, _selectRef$current3$c, _selectRef$current3$c2, _dropdownRef$current;
|
|
264
312
|
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();
|
|
265
313
|
var isOverflowingBelow = selectRect.bottom > window.innerHeight * 0.60;
|
|
266
314
|
var newPositions = _objectSpread({}, positions);
|
|
@@ -271,7 +319,11 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
|
|
|
271
319
|
delete newPositions.bottom;
|
|
272
320
|
newPositions.top = "".concat(selectRect.bottom, "px");
|
|
273
321
|
}
|
|
274
|
-
|
|
322
|
+
var viewportMargin = 16;
|
|
323
|
+
var dropdownWidth = ((_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : _dropdownRef$current.offsetWidth) || selectRect.width;
|
|
324
|
+
var isOverflowingRight = selectRect.left + dropdownWidth > window.innerWidth - viewportMargin;
|
|
325
|
+
var leftPosition = Math.max(viewportMargin, Math.min(isOverflowingRight ? selectRect.right - dropdownWidth : selectRect.left, window.innerWidth - dropdownWidth - viewportMargin));
|
|
326
|
+
newPositions.left = "".concat(leftPosition, "px");
|
|
275
327
|
newPositions.width = "".concat(selectRect.width, "px");
|
|
276
328
|
setPositions(_objectSpread({}, newPositions));
|
|
277
329
|
}
|
|
@@ -279,6 +331,11 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
|
|
|
279
331
|
_react["default"].useEffect(function () {
|
|
280
332
|
updateDropdownPosition();
|
|
281
333
|
}, [shouldShowDropdown, document.body.clientHeight > window.innerHeight]);
|
|
334
|
+
_react["default"].useLayoutEffect(function () {
|
|
335
|
+
if (shouldShowDropdown && dropdownRef.current) {
|
|
336
|
+
updateDropdownPosition();
|
|
337
|
+
}
|
|
338
|
+
}, [shouldShowDropdown, positions.top, positions.bottom]);
|
|
282
339
|
_react["default"].useEffect(function () {
|
|
283
340
|
var referenceEl = (0, _autoDetectScroll.unwrapElement)(inputRef.current);
|
|
284
341
|
var ancestors = (0, _autoDetectScroll.getOverflowAncestors)(referenceEl) || [];
|
|
@@ -291,14 +348,18 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
|
|
|
291
348
|
}, [inputRef.current]);
|
|
292
349
|
_react["default"].useEffect(function () {
|
|
293
350
|
if (propInputValue === undefined) {
|
|
294
|
-
if (
|
|
351
|
+
if (multiple) {
|
|
352
|
+
if (!searchTextRef.current) {
|
|
353
|
+
setInternalInputValue(getDisplayLabel(value) || '');
|
|
354
|
+
}
|
|
355
|
+
} else if (value) {
|
|
295
356
|
var newLabel = getOptionLabel(value);
|
|
296
357
|
setInternalInputValue(newLabel || '');
|
|
297
358
|
} else {
|
|
298
359
|
setInternalInputValue('');
|
|
299
360
|
}
|
|
300
361
|
}
|
|
301
|
-
}, [value]);
|
|
362
|
+
}, [value, multiple]);
|
|
302
363
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
303
364
|
className: prefixClass("cbx-inputAutocomplete-container ".concat(isOpen ? 'cbx-inputAutocomplete-container-open' : '', " ").concat(uiState.showSearchInput ? 'cbx-inputAutocomplete-container-open' : '')),
|
|
304
365
|
style: _objectSpread(_objectSpread(_objectSpread({
|
|
@@ -367,8 +428,18 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
|
|
|
367
428
|
e.stopPropagation();
|
|
368
429
|
e.preventDefault();
|
|
369
430
|
searchTextRef.current = '';
|
|
370
|
-
|
|
371
|
-
|
|
431
|
+
if (multiple) {
|
|
432
|
+
var summary = getDisplayLabel(selectedValue);
|
|
433
|
+
if (props.inputValue === undefined) {
|
|
434
|
+
setInternalInputValue(summary);
|
|
435
|
+
}
|
|
436
|
+
if (onInputChange) {
|
|
437
|
+
onInputChange(e, summary);
|
|
438
|
+
}
|
|
439
|
+
} else {
|
|
440
|
+
updateInputValue(e, '');
|
|
441
|
+
updateValue(e, null);
|
|
442
|
+
}
|
|
372
443
|
inputRef.current.focus();
|
|
373
444
|
},
|
|
374
445
|
icon: /*#__PURE__*/_react["default"].createElement("i", {
|
|
@@ -428,10 +499,10 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
|
|
|
428
499
|
}, loadingText))))), document.body));
|
|
429
500
|
};
|
|
430
501
|
InputAutocomplete.displayName = "InputAutocomplete";
|
|
431
|
-
var OutsideClickHandler = function OutsideClickHandler(
|
|
432
|
-
var children =
|
|
433
|
-
excludedRefs =
|
|
434
|
-
onOutsideClick =
|
|
502
|
+
var OutsideClickHandler = function OutsideClickHandler(_ref3) {
|
|
503
|
+
var children = _ref3.children,
|
|
504
|
+
excludedRefs = _ref3.excludedRefs,
|
|
505
|
+
onOutsideClick = _ref3.onOutsideClick;
|
|
435
506
|
var wrapperRef = _react["default"].useRef(null);
|
|
436
507
|
_react["default"].useEffect(function () {
|
|
437
508
|
var handleClickOutside = function handleClickOutside(event) {
|
|
@@ -462,7 +533,10 @@ InputAutocomplete.propTypes = {
|
|
|
462
533
|
disabled: _propTypes["default"].bool,
|
|
463
534
|
error: _propTypes["default"].node,
|
|
464
535
|
success: _propTypes["default"].bool,
|
|
465
|
-
fullWidth: _propTypes["default"].bool
|
|
536
|
+
fullWidth: _propTypes["default"].bool,
|
|
537
|
+
multiple: _propTypes["default"].bool,
|
|
538
|
+
getOptionValue: _propTypes["default"].func,
|
|
539
|
+
renderValue: _propTypes["default"].func
|
|
466
540
|
};
|
|
467
541
|
InputAutocomplete.defaultProps = {
|
|
468
542
|
label: '',
|
|
@@ -3,10 +3,22 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] = exports.Success = exports.Helper = exports.ErrorTemplate = exports.Disabled = exports.Default = void 0;
|
|
6
|
+
exports["default"] = exports.Success = exports.Multiple = exports.Helper = exports.ErrorTemplate = exports.Disabled = exports.Default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _InputAutocomplete = _interopRequireDefault(require("./InputAutocomplete"));
|
|
9
|
+
var _Checkbox = _interopRequireDefault(require("../Checkbox/Checkbox"));
|
|
9
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
12
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
13
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
15
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
16
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
17
|
+
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."); }
|
|
18
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
19
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
|
|
20
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
21
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
10
22
|
var _default = {
|
|
11
23
|
title: 'Components/Input Autocomplete',
|
|
12
24
|
component: _InputAutocomplete["default"],
|
|
@@ -180,4 +192,81 @@ ErrorTemplate.args = {
|
|
|
180
192
|
label: 'Pulp Fiction',
|
|
181
193
|
value: 1994
|
|
182
194
|
}]
|
|
195
|
+
};
|
|
196
|
+
var ALL = '__all__';
|
|
197
|
+
var PEOPLE = [{
|
|
198
|
+
id: 1,
|
|
199
|
+
name: 'Ada Lovelace'
|
|
200
|
+
}, {
|
|
201
|
+
id: 2,
|
|
202
|
+
name: 'Alan Turing'
|
|
203
|
+
}, {
|
|
204
|
+
id: 3,
|
|
205
|
+
name: 'Grace Hopper'
|
|
206
|
+
}, {
|
|
207
|
+
id: 4,
|
|
208
|
+
name: 'Katherine Johnson'
|
|
209
|
+
}, {
|
|
210
|
+
id: 5,
|
|
211
|
+
name: 'Linus Torvalds'
|
|
212
|
+
}];
|
|
213
|
+
var multipleRowStyle = {
|
|
214
|
+
display: 'flex',
|
|
215
|
+
alignItems: 'center',
|
|
216
|
+
width: '100%'
|
|
217
|
+
};
|
|
218
|
+
var MultipleTemplate = function MultipleTemplate(args) {
|
|
219
|
+
var _React$useState = _react["default"].useState(args.value || []),
|
|
220
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
221
|
+
value = _React$useState2[0],
|
|
222
|
+
setValue = _React$useState2[1];
|
|
223
|
+
var allSelected = value.length === PEOPLE.length;
|
|
224
|
+
var options = [].concat(_toConsumableArray(allSelected ? [] : [{
|
|
225
|
+
id: ALL,
|
|
226
|
+
isAllOption: true
|
|
227
|
+
}]), PEOPLE);
|
|
228
|
+
var handleChange = function handleChange(ev) {
|
|
229
|
+
var newValues = ev.target.value;
|
|
230
|
+
setValue(newValues.includes(ALL) ? PEOPLE.map(function (person) {
|
|
231
|
+
return person.id;
|
|
232
|
+
}) : newValues);
|
|
233
|
+
};
|
|
234
|
+
return /*#__PURE__*/_react["default"].createElement(_InputAutocomplete["default"], _extends({}, args, {
|
|
235
|
+
multiple: true,
|
|
236
|
+
options: options,
|
|
237
|
+
value: value,
|
|
238
|
+
onChange: handleChange,
|
|
239
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
240
|
+
return option.isAllOption ? 'Select all' : option.name;
|
|
241
|
+
},
|
|
242
|
+
getOptionSelected: function getOptionSelected(option) {
|
|
243
|
+
return option.isAllOption ? allSelected : value.includes(option.id);
|
|
244
|
+
},
|
|
245
|
+
renderValue: function renderValue(selected) {
|
|
246
|
+
return selected.length === PEOPLE.length ? 'All' : selected.map(function (id) {
|
|
247
|
+
var _PEOPLE$find;
|
|
248
|
+
return (_PEOPLE$find = PEOPLE.find(function (person) {
|
|
249
|
+
return person.id === id;
|
|
250
|
+
})) === null || _PEOPLE$find === void 0 ? void 0 : _PEOPLE$find.name;
|
|
251
|
+
}).join(', ');
|
|
252
|
+
},
|
|
253
|
+
renderOption: function renderOption(option) {
|
|
254
|
+
var checked = option.isAllOption ? allSelected : value.includes(option.id);
|
|
255
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
256
|
+
style: multipleRowStyle
|
|
257
|
+
}, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
258
|
+
checked: checked,
|
|
259
|
+
label: option.isAllOption ? 'Select all' : option.name
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
262
|
+
}));
|
|
263
|
+
};
|
|
264
|
+
MultipleTemplate.displayName = "MultipleTemplate";
|
|
265
|
+
var Multiple = MultipleTemplate.bind({});
|
|
266
|
+
exports.Multiple = Multiple;
|
|
267
|
+
Multiple.args = {
|
|
268
|
+
variant: 'outlined',
|
|
269
|
+
label: 'People',
|
|
270
|
+
noOptionsText: 'No results',
|
|
271
|
+
value: [1, 3]
|
|
183
272
|
};
|
|
@@ -432,16 +432,6 @@ textarea.cbx-inputText.cbx-inputText-standard~.cbx-inputText-fieldset-standard {
|
|
|
432
432
|
transform: translate(40px, 13px) scale(1);
|
|
433
433
|
}
|
|
434
434
|
|
|
435
|
-
.cbx-inputText-icon-startAdornment .cbx-input:focus~.cbx-inputText-label,
|
|
436
|
-
.cbx-inputText-icon-startAdornment .cbx-input.shrink~.cbx-inputText-label,
|
|
437
|
-
.cbx-inputText-icon-startAdornment .cbx-input:not(:placeholder-shown)~.cbx-inputText-label {
|
|
438
|
-
transform: translate(40px, -9px) scale(0.75);
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
.cbx-inputText-icon-startAdornment .cbx-inputText-fieldset legend {
|
|
442
|
-
margin-left: 1.625rem;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
435
|
.cbx-inputText-autocomplete-button-open {
|
|
446
436
|
position: absolute;
|
|
447
437
|
right: 0.313rem;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] = exports.Success = exports.Helper = exports.ErrorTemplate = exports.Disabled = exports.Default = void 0;
|
|
6
|
+
exports["default"] = exports.Success = exports.StartAdornment = exports.Helper = exports.ErrorTemplate = exports.EndAdornment = exports.Disabled = exports.Default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _InputText = _interopRequireDefault(require("./InputText"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
@@ -83,4 +83,18 @@ ErrorTemplate.args = {
|
|
|
83
83
|
value: 'Occaecat',
|
|
84
84
|
// placeholder: 'Occaecat',
|
|
85
85
|
error: 'Error'
|
|
86
|
+
};
|
|
87
|
+
var StartAdornment = Template.bind({});
|
|
88
|
+
exports.StartAdornment = StartAdornment;
|
|
89
|
+
StartAdornment.args = {
|
|
90
|
+
label: 'Occaecat',
|
|
91
|
+
placeholder: 'Occaecat',
|
|
92
|
+
startAdornment: 'ri-search-line'
|
|
93
|
+
};
|
|
94
|
+
var EndAdornment = Template.bind({});
|
|
95
|
+
exports.EndAdornment = EndAdornment;
|
|
96
|
+
EndAdornment.args = {
|
|
97
|
+
label: 'Occaecat',
|
|
98
|
+
placeholder: 'Occaecat',
|
|
99
|
+
endAdornment: 'ri-search-line'
|
|
86
100
|
};
|
|
@@ -107,7 +107,7 @@ var Modal = function Modal(_ref) {
|
|
|
107
107
|
var contentRef = _react["default"].useRef(null);
|
|
108
108
|
var adjustedScrollbarHeight = _react["default"].useMemo(function () {
|
|
109
109
|
if (isFirefox) {
|
|
110
|
-
if (scrollbarHeight && scrollbarHeight.endsWith('%')) {
|
|
110
|
+
if (typeof scrollbarHeight === 'string' && scrollbarHeight.endsWith('%')) {
|
|
111
111
|
return "".concat(parseFloat(scrollbarHeight) * 1, "vh");
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -29,13 +29,7 @@ var DesignRichTextInput = function DesignRichTextInput() {
|
|
|
29
29
|
style: {
|
|
30
30
|
height: '100%'
|
|
31
31
|
}
|
|
32
|
-
}, /*#__PURE__*/_react["default"].createElement(_Scrollbar["default"], {
|
|
33
|
-
sx: {
|
|
34
|
-
'.cbx-scrollbarNew-view': {
|
|
35
|
-
width: '100%'
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
32
|
+
}, /*#__PURE__*/_react["default"].createElement(_Scrollbar["default"], null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
39
33
|
style: {
|
|
40
34
|
width: '100%'
|
|
41
35
|
}
|