@councilbox/councilbox-ui 2.0.7 → 2.0.8

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.7 &#127881;
19
+ # Librería de componentes ui-councilbox NEW v2.0.8 &#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,12 @@ a.noStyles:hover{
25
25
  <div>Fix zIndex label InputText y SelectInput</div>
26
26
  </div>
27
27
 
28
+ <h2>v2.0.8</h2>
29
+ <div>Fix IconButton tooltip</div>
30
+ <div>Fix IconButton hoverColor</div>
31
+ <div>Cambiado hoverColor en MenuLateralRight</div>
32
+ <div>Fix InputAutocomplete</div>
33
+
28
34
  <h2>v2.0.7</h2>
29
35
  <div>Fix button del Accordion</div>
30
36
 
@@ -23,6 +23,7 @@
23
23
  color: var(--gray3);
24
24
  position: relative;
25
25
  background: transparent;
26
+ transition: .2s;
26
27
  }
27
28
 
28
29
  .cbx-IconButton:focus {
@@ -33,6 +34,10 @@
33
34
  background-color: rgba(0, 0, 0, 0.04) !important;
34
35
  }
35
36
 
37
+ .cbx-IconButton:hover.cbx-IconButton-hoverColor:hover {
38
+ background-color: var(--hover-color) !important;
39
+ }
40
+
36
41
  .cbx-IconButton.cbx-IconButton-rounded {
37
42
  color: var(--primary);
38
43
  border: 0.125rem solid var(--primary);
@@ -107,13 +107,6 @@ var IconButton = function IconButton(_ref) {
107
107
  }
108
108
  };
109
109
 
110
- var getIcon = function getIcon() {
111
- return /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
112
- title: tooltip || '',
113
- placement: placementTooltip
114
- }, icon);
115
- };
116
-
117
110
  var getText = function getText() {
118
111
  return /*#__PURE__*/_react.default.createElement("div", {
119
112
  style: {
@@ -131,12 +124,9 @@ var IconButton = function IconButton(_ref) {
131
124
  }, text));
132
125
  };
133
126
 
134
- var circleRadius = 20; // Ajustamos el radio para que encaje bien con el botón
135
-
136
- var circumference = 2 * Math.PI * circleRadius; // Circunferencia del círculo
137
-
138
- var progressValue = Math.max(0, Math.min(progress || 0, 100)); // Limitar el progreso entre 0 y 100
139
-
127
+ var circleRadius = 20;
128
+ var circumference = 2 * Math.PI * circleRadius;
129
+ var progressValue = Math.max(0, Math.min(progress || 0, 100));
140
130
  var dashOffset = circumference - progressValue / 100 * circumference;
141
131
 
142
132
  var getProgressAuto = function getProgressAuto() {
@@ -210,29 +200,40 @@ var IconButton = function IconButton(_ref) {
210
200
  }));
211
201
  };
212
202
 
213
- return /*#__PURE__*/_react.default.createElement("button", _extends({
214
- id: id,
215
- disabled: disabled,
216
- className: prefixClass("cbx-IconButton ".concat(className || '', " ").concat(type === 'fab' ? 'cbx-IconButton-fabButton' : '', " ").concat(type === 'square' ? 'cbx-IconButton-squareButton' : '', " ").concat(type === 'rounded' || rounded ? 'cbx-IconButton-rounded' : '', " ").concat(disabled ? 'cbx-IconButton-disabled' : '', " ").concat(active ? 'cbx-IconButton-active' : '')),
217
- type: "button",
218
- onClick: function onClick(e) {
219
- return onClickButton(e);
220
- },
221
- style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({
222
- backgroundColor: backgroundColor
223
- }, styles), style), stylesInLine), {}, {
224
- position: 'relative'
225
- })
226
- }, props), progressAuto ? getProgressAuto() : progress && getProgress(), badge ? /*#__PURE__*/_react.default.createElement("div", {
227
- className: prefixClass('cbx-IconButton-containerBadge')
228
- }, /*#__PURE__*/_react.default.createElement("div", {
229
- className: prefixClass('cbx-IconButton-badge')
230
- }), icon ? getIcon() : '', text && getText()) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, icon ? getIcon() : '', text && getText()), !disabled && /*#__PURE__*/_react.default.createElement("div", {
231
- className: prefixClass('cbx-ripple cbx-IconButton-containerRipple')
232
- }, ripples));
203
+ var getButton = function getButton() {
204
+ return /*#__PURE__*/_react.default.createElement("button", _extends({
205
+ id: id,
206
+ disabled: disabled,
207
+ className: prefixClass("cbx-IconButton ".concat(className || '', " ").concat(type === 'fab' ? 'cbx-IconButton-fabButton' : '', " ").concat(type === 'square' ? 'cbx-IconButton-squareButton' : '', " ").concat(type === 'rounded' || rounded ? 'cbx-IconButton-rounded' : '', " ").concat(disabled ? 'cbx-IconButton-disabled' : '', " ").concat(active ? 'cbx-IconButton-active' : '', " ").concat(hoverColor ? 'cbx-IconButton-hoverColor' : '')),
208
+ type: "button",
209
+ onClick: function onClick(e) {
210
+ return onClickButton(e);
211
+ },
212
+ style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({
213
+ backgroundColor: backgroundColor
214
+ }, styles), style), stylesInLine), {}, {
215
+ position: 'relative',
216
+ '--hover-color': hoverColor
217
+ })
218
+ }, props), progressAuto ? getProgressAuto() : progress && getProgress(), badge ? /*#__PURE__*/_react.default.createElement("div", {
219
+ className: prefixClass('cbx-IconButton-containerBadge')
220
+ }, /*#__PURE__*/_react.default.createElement("div", {
221
+ className: prefixClass('cbx-IconButton-badge')
222
+ }), icon || '', text && getText()) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, icon || '', text && getText()), !disabled && /*#__PURE__*/_react.default.createElement("div", {
223
+ className: prefixClass('cbx-ripple cbx-IconButton-containerRipple')
224
+ }, ripples));
225
+ };
226
+
227
+ var getTooltip = function getTooltip() {
228
+ return /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
229
+ title: tooltip || '',
230
+ placement: placementTooltip
231
+ }, getButton());
232
+ };
233
+
234
+ return tooltip ? getTooltip() : getButton();
233
235
  };
234
236
 
235
- IconButton.displayName = "IconButton";
236
237
  IconButton.propTypes = {
237
238
  id: _propTypes.default.string,
238
239
  className: _propTypes.default.string,
@@ -29,7 +29,7 @@ var _autoDetectScroll = require("../../utils/autoDetectScroll");
29
29
 
30
30
  var _utils = require("../../utils");
31
31
 
32
- 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"];
32
+ 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"];
33
33
 
34
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
35
 
@@ -64,8 +64,8 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
64
64
  onInputChange = _ref.onInputChange,
65
65
  label = _ref.label,
66
66
  value = _ref.value,
67
- _ref$autocomplete = _ref.autocomplete,
68
- autocomplete = _ref$autocomplete === void 0 ? 'off' : _ref$autocomplete,
67
+ _ref$autoComplete = _ref.autoComplete,
68
+ autoComplete = _ref$autoComplete === void 0 ? 'off' : _ref$autoComplete,
69
69
  propInputValue = _ref.inputValue,
70
70
  style = _ref.style,
71
71
  styles = _ref.styles,
@@ -316,7 +316,7 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
316
316
  shrink: !!inputValue || !!selectedValue,
317
317
  prefixClass: prefixClass,
318
318
  fullWidth: props.fullWidth,
319
- autocomplete: autocomplete,
319
+ autoComplete: autoComplete,
320
320
  disabled: disabled,
321
321
  ref: inputRef,
322
322
  onKeyDown: function onKeyDown(e) {
@@ -356,7 +356,8 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
356
356
  icon: /*#__PURE__*/_react.default.createElement("i", {
357
357
  className: "ri-close-fill",
358
358
  tabIndex: "-1"
359
- })
359
+ }),
360
+ tabIndex: -1
360
361
  }))
361
362
  }, InputProps)
362
363
  }, props, {
@@ -376,7 +377,7 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
376
377
  className: prefixClass("cbx-inputAutocomplete-options-container ".concat(uiState.showDropdown && !isClosing ? 'cbx-inputAutocomplete-options-container-open' : 'cbx-inputAutocomplete-options-container-close')),
377
378
  style: _objectSpread({}, positions),
378
379
  onKeyDown: function onKeyDown(e) {
379
- if (e.keyCode === 9) {
380
+ if (e.key === 9) {
380
381
  closeDropdown();
381
382
  }
382
383
 
@@ -212,12 +212,10 @@ var MenuLateralRight = function MenuLateralRight(_ref) {
212
212
  badge: item.badge,
213
213
  onClick: item.action,
214
214
  placementTooltip: 'left',
215
+ hoverColor: item.active && '#272762',
215
216
  styles: _objectSpread({}, item.active ? {
216
217
  color: 'white',
217
- backgroundColor: 'var(--primary)',
218
- '&&:hover': {
219
- backgroundColor: '#272762'
220
- }
218
+ backgroundColor: 'var(--primary)'
221
219
  } : {}),
222
220
  sx: item.sx,
223
221
  rounded: true
@@ -226,6 +226,8 @@ var SelectInput = function SelectInput(_ref) {
226
226
 
227
227
  var enhancedChildren = _react.default.Children.map(children, function (child, index) {
228
228
  if ( /*#__PURE__*/_react.default.isValidElement(child)) {
229
+ var _dropdownRef$current;
230
+
229
231
  return /*#__PURE__*/_react.default.cloneElement(child, {
230
232
  key: child.key || "".concat(child.props.value, "-").concat(index),
231
233
  active: checkSelectedOptions(child.props.value),
@@ -233,7 +235,9 @@ var SelectInput = function SelectInput(_ref) {
233
235
  onClick: function onClick(event) {
234
236
  return handleOptionClick(child, event);
235
237
  },
236
- fullWidth: fullWidth
238
+ fullWidth: fullWidth,
239
+ tabIndex: isOpen ? 0 : -1,
240
+ className: "".concat(child.props.className || '', " ").concat(isOpen && ((_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : _dropdownRef$current.querySelector("[data-index=\"".concat(index, "\"]"))) === document.activeElement ? 'cbx-selectInput-option-focused' : '').trim()
237
241
  });
238
242
  }
239
243
 
@@ -292,26 +296,50 @@ var SelectInput = function SelectInput(_ref) {
292
296
  readOnly: true,
293
297
  prefixClass: prefixClass,
294
298
  fullWidth: fullWidth || width !== '100%',
295
- disabled: disabled
299
+ disabled: disabled,
300
+ tabIndex: disabled ? -1 : 0
296
301
  }, props, {
302
+ onFocus: function onFocus() {
303
+ if (!isOpen) setIsOpen(false);
304
+ },
297
305
  onKeyDown: function onKeyDown(e) {
298
- e.preventDefault();
299
306
  e.stopPropagation();
300
307
 
301
- if (e.key === 'ArrowDown') {
302
- setIsOpen(true);
303
- }
308
+ switch (e.key) {
309
+ case 'ArrowDown':
310
+ case 'ArrowUp':
311
+ setIsOpen(true);
312
+ handleKeyDown(e);
313
+ break;
314
+
315
+ case 'Enter':
316
+ case ' ':
317
+ if (!isOpen) {
318
+ setIsOpen(true);
319
+ } else {
320
+ var _optionContainerRef$c;
321
+
322
+ var activeOption = (_optionContainerRef$c = optionContainerRef.current) === null || _optionContainerRef$c === void 0 ? void 0 : _optionContainerRef$c.querySelector('.cbx-selectInput-option-focused');
323
+
324
+ if (activeOption) {
325
+ activeOption.click();
326
+ }
327
+ }
304
328
 
305
- if (e.key === 'ArrowUp') {
306
- e.preventDefault();
307
- setIsOpen(true);
308
- }
329
+ e.preventDefault();
330
+ break;
309
331
 
310
- if (e.key === 'Escape') {
311
- closeDropdown();
312
- }
332
+ case 'Escape':
333
+ if (isOpen) closeDropdown();
334
+ break;
313
335
 
314
- handleKeyDown(e);
336
+ case 'Tab':
337
+ if (isOpen) closeDropdown();
338
+ break;
339
+
340
+ default:
341
+ break;
342
+ }
315
343
  },
316
344
  type: 'select'
317
345
  })), isOpen && /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@councilbox/councilbox-ui",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "main": "dist/build-index.js",
5
5
  "files": [
6
6
  "dist",