@councilbox/councilbox-ui 2.0.22 → 2.0.24

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.
@@ -16,7 +16,7 @@ a.noStyles:hover{
16
16
  `}</style>
17
17
 
18
18
 
19
- # Librería de componentes ui-councilbox NEW v2.0.22 &#127881;
19
+ # Librería de componentes ui-councilbox NEW v2.0.24 &#127881;
20
20
 
21
21
  <h2>Componentes:</h2>
22
22
  <div><a class='noStyles' href='/story/components-accordion--default'>Accordion</a></div>
@@ -25,6 +25,16 @@ a.noStyles:hover{
25
25
  <div>Fix zIndex label InputText y SelectInput</div>
26
26
  </div>
27
27
 
28
+ <h2>v2.0.24</h2>
29
+ <div>Fix boton desplegar Autocomplete</div>
30
+
31
+ <h2>v2.0.23</h2>
32
+ <div>Fix Tabs controlados y no controlados</div>
33
+ <div>Fix Checkbox controlados y no controlados</div>
34
+ <div>Fix height del DrawerPanel</div>
35
+ <div>Fix tamaño del Autocomplete</div>
36
+ <div>Add disableBackdropClick en Modal</div>
37
+
28
38
  <h2>v2.0.22</h2>
29
39
  <div>Fix EnhanceTable</div>
30
40
 
@@ -60,6 +60,8 @@ var Checkbox = function Checkbox(_ref) {
60
60
  onClick = _ref.onClick,
61
61
  props = _objectWithoutProperties(_ref, _excluded);
62
62
 
63
+ var inputRef = _react.default.useRef(null);
64
+
63
65
  var _useDynamicStyles = (0, _useDynamicStyles2.default)(sx),
64
66
  stylesInLine = _useDynamicStyles.stylesInLine,
65
67
  prefixClass = _useDynamicStyles.prefixClass;
@@ -71,15 +73,22 @@ var Checkbox = function Checkbox(_ref) {
71
73
  addRipple = _useRipple2[0],
72
74
  ripples = _useRipple2[1];
73
75
 
74
- var _React$useState = _react.default.useState(checkedProp),
76
+ var isControlled = checkedProp !== undefined;
77
+
78
+ var _React$useState = _react.default.useState(!!checkedProp),
75
79
  _React$useState2 = _slicedToArray(_React$useState, 2),
76
80
  internalState = _React$useState2[0],
77
81
  setInternalState = _React$useState2[1];
78
82
 
83
+ var checked = isControlled ? checkedProp : internalState;
84
+
79
85
  var handleChange = function handleChange(event) {
80
86
  if (disabled) return;
81
87
  var newChecked = event.target.checked;
82
- setInternalState(newChecked);
88
+
89
+ if (!isControlled) {
90
+ setInternalState(newChecked);
91
+ }
83
92
 
84
93
  if (onChange) {
85
94
  onChange(event, newChecked);
@@ -87,8 +96,10 @@ var Checkbox = function Checkbox(_ref) {
87
96
  };
88
97
 
89
98
  _react.default.useEffect(function () {
90
- setInternalState(checkedProp);
91
- }, [checkedProp]);
99
+ if (inputRef.current) {
100
+ inputRef.current.indeterminate = indeterminate;
101
+ }
102
+ }, [indeterminate]);
92
103
 
93
104
  return /*#__PURE__*/_react.default.createElement("label", _extends({
94
105
  className: prefixClass('cbx-checkbox'),
@@ -97,28 +108,29 @@ var Checkbox = function Checkbox(_ref) {
97
108
  className: prefixClass("cbx-checkbox-container ".concat(disabled ? 'cbx-checkbox-container-disabled' : '', " ").concat(!disabled ? 'cbx-ripple' : '')),
98
109
  onClick: addRipple
99
110
  }, /*#__PURE__*/_react.default.createElement("input", {
111
+ ref: inputRef,
100
112
  type: "checkbox",
101
- checked: internalState,
113
+ checked: checked,
102
114
  onChange: handleChange,
103
- onClick: function onClick(event) {
104
- event.stopPropagation();
115
+ onClick: function onClick(e) {
116
+ return e.stopPropagation();
105
117
  },
106
- onKeyDown: function onKeyDown(event) {
107
- if (event.key === ' ') {
108
- event.preventDefault();
118
+ onKeyDown: function onKeyDown(e) {
119
+ if (e.key === ' ') {
120
+ e.preventDefault();
109
121
  handleChange({
110
122
  target: {
111
- checked: !internalState
123
+ checked: !checked
112
124
  }
113
125
  });
114
126
  }
115
127
  },
116
128
  tabIndex: 0
117
- }), !disabled && ripples, internalState ? indeterminate ? /*#__PURE__*/_react.default.createElement("svg", {
129
+ }), !disabled && ripples, checked ? indeterminate ? /*#__PURE__*/_react.default.createElement("svg", {
130
+ className: prefixClass('cbx-checkbox-checked'),
118
131
  focusable: "false",
119
132
  "aria-hidden": "true",
120
- viewBox: "0 0 24 24",
121
- className: prefixClass('cbx-checkbox-checked')
133
+ viewBox: "0 0 24 24"
122
134
  }, /*#__PURE__*/_react.default.createElement("path", {
123
135
  d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"
124
136
  })) : /*#__PURE__*/_react.default.createElement("svg", {
@@ -140,14 +152,14 @@ var Checkbox = function Checkbox(_ref) {
140
152
  }, /*#__PURE__*/_react.default.createElement("path", {
141
153
  d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
142
154
  }))), /*#__PURE__*/_react.default.createElement(_Typography.default, {
143
- component: 'span',
155
+ component: "span",
144
156
  style: {
145
- margin: '0',
157
+ margin: 0,
146
158
  transition: '0.2s',
147
159
  marginLeft: '.5rem'
148
160
  },
149
- color: disabled ? 'var(--gray3)' : internalState ? 'var(--primary)' : 'var(--gray4)',
150
- fontWeight: disabled ? '700' : internalState ? '700' : '400',
161
+ color: disabled ? 'var(--gray3)' : checked ? 'var(--primary)' : 'var(--gray4)',
162
+ fontWeight: disabled ? '700' : checked ? '700' : '400',
151
163
  prefixClass: prefixClass
152
164
  }, label));
153
165
  };
@@ -70,6 +70,7 @@
70
70
  align-items: center;
71
71
  background-color: var(--primary);
72
72
  height: 4rem;
73
+ min-height: 4rem;
73
74
  }
74
75
 
75
76
  .cbx-drawerPanel-title {
@@ -26,6 +26,8 @@
26
26
  opacity: 0;
27
27
  transition: opacity 0.3s ease-in-out;
28
28
  margin-right: var(--spacing20);
29
+ position: absolute !important;
30
+ right: .30rem;
29
31
  }
30
32
 
31
33
  .cbx-inputAutocomplete-container:hover .cbx-inputAutocomplete-icon-button {
@@ -117,6 +119,10 @@
117
119
  pointer-events: none;
118
120
  }
119
121
 
122
+ .cbx-inputText-autocomplete.shrink {
123
+ padding-right: 3.875rem;
124
+ }
125
+
120
126
  @keyframes dropdownOpen {
121
127
  0% {
122
128
  opacity: 0;
@@ -268,6 +268,17 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
268
268
  }));
269
269
  };
270
270
 
271
+ var _handleOpen = function handleOpen() {
272
+ if (!uiState.showDropdown) {
273
+ setUIstate(_objectSpread(_objectSpread({}, uiState), {}, {
274
+ showDropdown: true,
275
+ showSearchInput: true
276
+ }));
277
+ } else {
278
+ closeDropdown();
279
+ }
280
+ };
281
+
271
282
  var updateDropdownPosition = function updateDropdownPosition() {
272
283
  var _selectRef$current, _selectRef$current2, _selectRef$current2$c;
273
284
 
@@ -405,7 +416,13 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
405
416
  tabIndex: -1
406
417
  })),
407
418
  endAdornmentClass: 'cbx-inputAutocomplete-endAdornment'
408
- }, InputProps)
419
+ }, InputProps),
420
+ handleOpen: function handleOpen() {
421
+ if ((options === null || options === void 0 ? void 0 : options.length) > 0) {
422
+ _handleOpen();
423
+ }
424
+ },
425
+ options: options
409
426
  }, props, {
410
427
  type: 'autocomplete'
411
428
  })), (uiState.showDropdown || loading) && (positions.top || positions.bottom) && /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement("div", {
@@ -435,7 +435,7 @@ textarea.cbx-inputText.cbx-inputText-standard~.cbx-inputText-fieldset-standard {
435
435
  margin-left: .5rem;
436
436
  }
437
437
 
438
- .cbx-inputText-container-standard .cbx-inputText-startAdornmentContainer{
438
+ .cbx-inputText-container-standard .cbx-inputText-startAdornmentContainer {
439
439
  margin-left: 0rem;
440
440
  margin-right: .5rem;
441
441
  }
@@ -445,6 +445,14 @@ textarea.cbx-inputText.cbx-inputText-standard~.cbx-inputText-fieldset-standard {
445
445
  color: var(--gray3);
446
446
  }
447
447
 
448
- .cbx-inputText-icon-startAdornment .cbx-inputText-label{
449
- left: 40px;
448
+ .cbx-inputText-icon-startAdornment .cbx-inputText-label {
449
+ left: 40px;
450
+ }
451
+
452
+ .cbx-inputText-autocomplete-button-open {
453
+ position: absolute;
454
+ right: 0.313rem;
455
+ width: 1.25rem;
456
+ height: 2.125rem;
457
+ cursor: pointer;
450
458
  }
@@ -17,7 +17,7 @@ var _Typography = _interopRequireDefault(require("../Typography/Typography"));
17
17
 
18
18
  var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
19
19
 
20
- var _excluded = ["value", "defaultValue", "id", "placeholder", "autoComplete", "shrink", "helperText", "error", "helper", "disabled", "label", "startAdornment", "endAdornment", "success", "multiline", "onChange", "variant", "type", "fullWidth", "rows", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "sx", "style", "prefixClass", "children", "onClick", "className", "readOnly", "required", "width", "renderValue", "InputProps"];
20
+ var _excluded = ["value", "defaultValue", "id", "placeholder", "autoComplete", "shrink", "helperText", "error", "helper", "disabled", "label", "startAdornment", "endAdornment", "success", "multiline", "onChange", "variant", "type", "fullWidth", "rows", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "sx", "style", "prefixClass", "children", "onClick", "className", "readOnly", "required", "width", "renderValue", "InputProps", "handleOpen", "options"];
21
21
 
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
23
 
@@ -88,6 +88,8 @@ var InputText = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
88
88
  width = _ref.width,
89
89
  renderValue = _ref.renderValue,
90
90
  InputProps = _ref.InputProps,
91
+ handleOpen = _ref.handleOpen,
92
+ options = _ref.options,
91
93
  props = _objectWithoutProperties(_ref, _excluded);
92
94
 
93
95
  var _useDynamicStyles = (0, _useDynamicStyles2.default)(sx),
@@ -355,7 +357,10 @@ var InputText = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
355
357
  "aria-label": 'Input'
356
358
  }, props)), (getVariant() === 'filled' || getVariant() === 'standard') && /*#__PURE__*/_react.default.createElement("span", {
357
359
  className: prefixClass('cbx-inputText-bar')
358
- }), !renderValue && getLabel(), /*#__PURE__*/_react.default.createElement("fieldset", {
360
+ }), !renderValue && getLabel(), type === 'autocomplete' && (options === null || options === void 0 ? void 0 : options.length) > 0 && /*#__PURE__*/_react.default.createElement("div", {
361
+ className: prefixClass('cbx-inputText-autocomplete-button-open'),
362
+ onClick: handleOpen
363
+ }), /*#__PURE__*/_react.default.createElement("fieldset", {
359
364
  className: prefixClass("cbx-inputText-fieldset cbx-inputText-fieldset-".concat(getVariant(), " ").concat(isInputHover ? 'hover' : '', " ").concat(isInputFocused ? 'focused' : '', " ").concat(inputValue && !isInputFocused ? 'focusedNo value' : '', " ").concat(!label ? 'noLabel' : '', " ").concat(inputShrink && !isInputFocused ? 'focusedNo value shrink' : '')),
360
365
  "aria-label": 'Input fieldset'
361
366
  }, /*#__PURE__*/_react.default.createElement("legend", {
@@ -21,7 +21,7 @@ var _CouncilboxThemeContext = require("../ThemeProvider/CouncilboxThemeContext")
21
21
 
22
22
  var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
23
23
 
24
- var _excluded = ["title", "fullWidth", "id", "fullScreen", "buttonAccept", "buttonCancel", "open", "requestClose", "loadingAction", "acceptAction", "cancelAction", "body", "bodyText", "hideAccept", "extraActions", "classNameDialog", "PaperProps", "widthModal", "actions", "sx", "buttonCancelProps", "buttonAcceptProps", "breakpointsButtons", "hasScrollbar", "scrollbarHeight", "prefixClass", "style", "styles", "customButtons", "className"];
24
+ var _excluded = ["title", "fullWidth", "id", "fullScreen", "buttonAccept", "buttonCancel", "open", "requestClose", "loadingAction", "acceptAction", "cancelAction", "body", "bodyText", "hideAccept", "extraActions", "classNameDialog", "PaperProps", "widthModal", "actions", "sx", "buttonCancelProps", "buttonAcceptProps", "breakpointsButtons", "hasScrollbar", "scrollbarHeight", "prefixClass", "style", "styles", "customButtons", "className", "disableBackdropClick"];
25
25
 
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
27
 
@@ -81,6 +81,7 @@ var Modal = function Modal(_ref) {
81
81
  styles = _ref.styles,
82
82
  customButtons = _ref.customButtons,
83
83
  className = _ref.className,
84
+ disableBackdropClick = _ref.disableBackdropClick,
84
85
  props = _objectWithoutProperties(_ref, _excluded);
85
86
 
86
87
  var _React$useState = _react.default.useState(false),
@@ -161,8 +162,10 @@ var Modal = function Modal(_ref) {
161
162
  }, buttonAcceptProps))));
162
163
 
163
164
  var handleBackgroundClick = function handleBackgroundClick(e) {
164
- e.stopPropagation();
165
- requestClose(false);
165
+ if (!disableBackdropClick) {
166
+ e.stopPropagation();
167
+ requestClose(false);
168
+ }
166
169
  };
167
170
 
168
171
  var handleContentClick = function handleContentClick(e) {
@@ -57,7 +57,7 @@ var data = [{
57
57
  var DesignDrawerPanel = function DesignDrawerPanel(_ref) {
58
58
  var variant = _ref.variant;
59
59
 
60
- var _React$useState = _react.default.useState(0),
60
+ var _React$useState = _react.default.useState(2),
61
61
  _React$useState2 = _slicedToArray(_React$useState, 2),
62
62
  selectTab = _React$useState2[0],
63
63
  setSelectTab = _React$useState2[1];
@@ -97,25 +97,37 @@ var Tabs = function Tabs(_ref) {
97
97
  isEllipsisActive = _React$useState10[0],
98
98
  setIsEllipsisActive = _React$useState10[1];
99
99
 
100
+ var isControlled = value !== undefined;
101
+
100
102
  var getInitialTabIndex = function getInitialTabIndex() {
101
103
  return Math.max(itemsTab.findIndex(function (i) {
102
104
  return i.value === value;
103
105
  }), 0);
104
106
  };
105
107
 
106
- var _React$useState11 = _react.default.useState(getInitialTabIndex),
108
+ var _React$useState11 = _react.default.useState(getInitialTabIndex()),
107
109
  _React$useState12 = _slicedToArray(_React$useState11, 2),
108
- activeTabIndex = _React$useState12[0],
109
- setActiveTabIndex = _React$useState12[1];
110
+ internalTabIndex = _React$useState12[0],
111
+ setInternalTabIndex = _React$useState12[1];
112
+
113
+ var activeTabIndex = isControlled ? value : internalTabIndex;
110
114
 
111
115
  var handleTabClick = function handleTabClick(e, index, valueItem) {
112
- setActiveTabIndex(index);
116
+ if (!isControlled) {
117
+ setInternalTabIndex(index);
118
+ }
113
119
 
114
120
  if (onChange) {
115
121
  onChange(index, valueItem);
116
122
  }
117
123
  };
118
124
 
125
+ _react.default.useEffect(function () {
126
+ if (!isControlled) {
127
+ setInternalTabIndex(getInitialTabIndex());
128
+ }
129
+ }, [itemsTab]);
130
+
119
131
  var showButtons = function showButtons(direction, scrollLeftNumber) {
120
132
  var container = tabsContainerRef === null || tabsContainerRef === void 0 ? void 0 : tabsContainerRef.current;
121
133
 
@@ -272,7 +284,7 @@ Tabs.propTypes = {
272
284
  variant: _propTypes.default.string
273
285
  };
274
286
  Tabs.defaultProps = {
275
- value: 0,
287
+ value: undefined,
276
288
  onChange: undefined,
277
289
  itemsTab: [],
278
290
  variant: ''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@councilbox/councilbox-ui",
3
- "version": "2.0.22",
3
+ "version": "2.0.24",
4
4
  "main": "dist/build-index.js",
5
5
  "files": [
6
6
  "dist",