@councilbox/councilbox-ui 2.0.16 → 2.0.17

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.16 &#127881;
19
+ # Librería de componentes ui-councilbox NEW v2.0.17 &#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.17</h2>
29
+ <div>Fix height Modal en firefox</div>
30
+ <div>Fix error Tooltip</div>
31
+ <div>Fix Tag ellipsis</div>
32
+ <div>Fix Icon Autocomplete</div>
33
+
28
34
  <h2>v2.0.16</h2>
29
35
  <div>Add disabled MenuItem</div>
30
36
  <div>Fix Dropdown close click items</div>
@@ -1,6 +1,31 @@
1
+
2
+ .cbx-inputAutocomplete-endAdornment {
3
+ margin-right: var(--spacing20) !important;
4
+ }
5
+ .cbx-inputAutocomplete-container:after {
6
+ position: absolute;
7
+ top: 1.313rem;
8
+ right: 0.575rem;
9
+ width: 0;
10
+ height: 0;
11
+ padding: 0;
12
+ content: '';
13
+ border-left: 0.375rem solid transparent;
14
+ border-right: 0.375rem solid transparent;
15
+ border-top: 0.375rem solid var(--gray3);
16
+ pointer-events: none;
17
+ transition: .2s;
18
+ }
19
+
20
+ .cbx-inputAutocomplete-container-open.cbx-inputAutocomplete-container:after{
21
+ transform: rotate(180deg);
22
+ }
23
+
24
+
1
25
  .cbx-inputAutocomplete-icon-button {
2
26
  opacity: 0;
3
27
  transition: opacity 0.3s ease-in-out;
28
+ margin-right: var(--spacing20);
4
29
  }
5
30
 
6
31
  .cbx-inputAutocomplete-container:hover .cbx-inputAutocomplete-icon-button {
@@ -107,44 +107,49 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
107
107
  selectOnFocus = _ref$selectOnFocus === void 0 ? !freeSolo : _ref$selectOnFocus,
108
108
  props = _objectWithoutProperties(_ref, _excluded);
109
109
 
110
+ var _React$useState = _react.default.useState(false),
111
+ _React$useState2 = _slicedToArray(_React$useState, 2),
112
+ isOpen = _React$useState2[0],
113
+ setIsOpen = _React$useState2[1];
114
+
110
115
  var _useDynamicStyles = (0, _useDynamicStyles2.default)(sx),
111
116
  stylesInLine = _useDynamicStyles.stylesInLine,
112
117
  dynamicPrefixClass = _useDynamicStyles.prefixClass;
113
118
 
114
119
  var prefixClass = propPrefixClass || dynamicPrefixClass;
115
120
 
116
- var _React$useState = _react.default.useState({
121
+ var _React$useState3 = _react.default.useState({
117
122
  showDropdown: false,
118
123
  showSearchInput: false
119
124
  }),
120
- _React$useState2 = _slicedToArray(_React$useState, 2),
121
- uiState = _React$useState2[0],
122
- setUIstate = _React$useState2[1];
125
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
126
+ uiState = _React$useState4[0],
127
+ setUIstate = _React$useState4[1];
123
128
 
124
- var _React$useState3 = _react.default.useState({
129
+ var _React$useState5 = _react.default.useState({
125
130
  top: null,
126
131
  bottom: null,
127
132
  left: '0px',
128
133
  width: '0px'
129
134
  }),
130
- _React$useState4 = _slicedToArray(_React$useState3, 2),
131
- positions = _React$useState4[0],
132
- setPositions = _React$useState4[1];
133
-
134
- var _React$useState5 = _react.default.useState(false),
135
135
  _React$useState6 = _slicedToArray(_React$useState5, 2),
136
- isClosing = _React$useState6[0],
137
- setIsClosing = _React$useState6[1];
136
+ positions = _React$useState6[0],
137
+ setPositions = _React$useState6[1];
138
138
 
139
- var _React$useState7 = _react.default.useState(value || null),
139
+ var _React$useState7 = _react.default.useState(false),
140
140
  _React$useState8 = _slicedToArray(_React$useState7, 2),
141
- internalValue = _React$useState8[0],
142
- setInternalValue = _React$useState8[1];
141
+ isClosing = _React$useState8[0],
142
+ setIsClosing = _React$useState8[1];
143
143
 
144
- var _React$useState9 = _react.default.useState(propInputValue || value && getOptionLabel(value) || ''),
144
+ var _React$useState9 = _react.default.useState(value || null),
145
145
  _React$useState10 = _slicedToArray(_React$useState9, 2),
146
- internalInputValue = _React$useState10[0],
147
- setInternalInputValue = _React$useState10[1];
146
+ internalValue = _React$useState10[0],
147
+ setInternalValue = _React$useState10[1];
148
+
149
+ var _React$useState11 = _react.default.useState(propInputValue || value && getOptionLabel(value) || ''),
150
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
151
+ internalInputValue = _React$useState12[0],
152
+ setInternalInputValue = _React$useState12[1];
148
153
 
149
154
  var searchTextRef = _react.default.useRef(freeSolo ? internalInputValue : '');
150
155
 
@@ -193,6 +198,7 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
193
198
  showDropdown: false,
194
199
  showSearchInput: !clearOnBlur
195
200
  }));
201
+ setIsOpen(false);
196
202
  setIsClosing(false);
197
203
 
198
204
  if (!freeSolo) {
@@ -303,7 +309,7 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
303
309
  }, [inputRef.current]);
304
310
 
305
311
  return /*#__PURE__*/_react.default.createElement("div", {
306
- className: prefixClass("cbx-inputAutocomplete-container ".concat(uiState.showSearchInput ? 'cbx-inputAutocomplete-container-open' : '')),
312
+ className: prefixClass("cbx-inputAutocomplete-container ".concat(isOpen ? 'cbx-inputAutocomplete-container-open' : '', " ").concat(uiState.showSearchInput ? 'cbx-inputAutocomplete-container-open' : '')),
307
313
  style: _objectSpread(_objectSpread(_objectSpread({
308
314
  width: props.fullWidth && '100%'
309
315
  }, styles), style), stylesInLine),
@@ -319,9 +325,48 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
319
325
  autoComplete: autoComplete,
320
326
  disabled: disabled,
321
327
  ref: inputRef,
328
+ onFocus: function onFocus() {
329
+ if (!isOpen) setIsOpen(false);
330
+ },
322
331
  onKeyDown: function onKeyDown(e) {
323
332
  e.stopPropagation();
324
333
 
334
+ switch (e.key) {
335
+ case 'ArrowDown':
336
+ case 'ArrowUp':
337
+ setIsOpen(true);
338
+ handleKeyDown(e);
339
+ break;
340
+
341
+ case 'Enter':
342
+ case ' ':
343
+ if (!isOpen) {
344
+ setIsOpen(true);
345
+ } else {
346
+ var _optionContainerRef$c;
347
+
348
+ var activeOption = (_optionContainerRef$c = optionContainerRef.current) === null || _optionContainerRef$c === void 0 ? void 0 : _optionContainerRef$c.querySelector('.cbx-selectInput-option-focused');
349
+
350
+ if (activeOption) {
351
+ activeOption.click();
352
+ }
353
+ }
354
+
355
+ e.preventDefault();
356
+ break;
357
+
358
+ case 'Escape':
359
+ if (isOpen) closeDropdown();
360
+ break;
361
+
362
+ case 'Tab':
363
+ if (isOpen) closeDropdown();
364
+ break;
365
+
366
+ default:
367
+ break;
368
+ }
369
+
325
370
  if (e.keyCode === 9) {
326
371
  closeDropdown();
327
372
  }
@@ -358,7 +403,8 @@ var InputAutocomplete = function InputAutocomplete(_ref) {
358
403
  tabIndex: "-1"
359
404
  }),
360
405
  tabIndex: -1
361
- }))
406
+ })),
407
+ endAdornmentClass: 'cbx-inputAutocomplete-endAdornment'
362
408
  }, InputProps)
363
409
  }, props, {
364
410
  type: 'autocomplete'
@@ -140,13 +140,13 @@ var InputText = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
140
140
 
141
141
  var getIcon = function getIcon() {
142
142
  var icon = endAdornment ? /*#__PURE__*/_react.default.createElement("i", {
143
- className: "cbx-inputText-endAdornment ".concat(endAdornment),
143
+ className: "".concat(InputProps !== null && InputProps !== void 0 && InputProps.endAdornmentClass ? InputProps.endAdornmentClass : '', " cbx-inputText-endAdornment ").concat(endAdornment),
144
144
  tabIndex: "-1"
145
145
  }) : '';
146
146
 
147
147
  if (success) {
148
148
  icon = /*#__PURE__*/_react.default.createElement("i", {
149
- className: "cbx-inputText-endAdornment ri-check-line",
149
+ className: "".concat(InputProps !== null && InputProps !== void 0 && InputProps.endAdornmentClass ? InputProps.endAdornmentClass : '', " cbx-inputText-endAdornment ri-check-line"),
150
150
  style: {
151
151
  color: 'var(--success)'
152
152
  },
@@ -156,7 +156,7 @@ var InputText = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
156
156
 
157
157
  if (error) {
158
158
  icon = /*#__PURE__*/_react.default.createElement("i", {
159
- className: 'cbx-inputText-endAdornment ri-information-line',
159
+ className: "".concat(InputProps !== null && InputProps !== void 0 && InputProps.endAdornmentClass ? InputProps.endAdornmentClass : '', " cbx-inputText-endAdornment ri-information-line"),
160
160
  style: {
161
161
  color: 'var(--error)'
162
162
  },
@@ -166,7 +166,7 @@ var InputText = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
166
166
 
167
167
  if (helper) {
168
168
  icon = /*#__PURE__*/_react.default.createElement("i", {
169
- className: 'cbx-inputText-endAdornment ri-information-line',
169
+ className: "".concat(InputProps !== null && InputProps !== void 0 && InputProps.endAdornmentClass ? InputProps.endAdornmentClass : '', " cbx-inputText-endAdornment ri-information-line"),
170
170
  tabIndex: "-1"
171
171
  });
172
172
  }
@@ -13,6 +13,7 @@
13
13
  .cbx-Modal-contentCentered {
14
14
  display: table-cell;
15
15
  vertical-align: middle;
16
+ height: 100%;
16
17
  }
17
18
 
18
19
  .cbx-Modal-content {
@@ -133,4 +133,8 @@
133
133
 
134
134
  .cbx-selectInput-container.cbx-selectInput-container-disabled .cbx-inputText-fieldset.cbx-inputText-fieldset-outlined{
135
135
  border: 0.063rem dashed var(--gray2);
136
+ }
137
+
138
+ .cbx-inputText-container-select div div {
139
+ padding-right: 1.875rem !important;
136
140
  }
@@ -17,6 +17,8 @@ var _Typography = _interopRequireDefault(require("../Typography/Typography"));
17
17
 
18
18
  var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
19
19
 
20
+ var _Tooltip = _interopRequireDefault(require("../Tooltip/Tooltip"));
21
+
20
22
  var _excluded = ["variant", "id", "className", "text", "close", "icon", "iconText", "background", "iconTypographyProps", "textTypographyProps", "styles", "borderColor", "colorText", "sx", "style"];
21
23
 
22
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -29,6 +31,18 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
29
31
 
30
32
  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; }
31
33
 
34
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
35
+
36
+ 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."); }
37
+
38
+ 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); }
39
+
40
+ 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; }
41
+
42
+ 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; }
43
+
44
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
45
+
32
46
  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; }
33
47
 
34
48
  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; }
@@ -55,6 +69,25 @@ var Tag = function Tag(_ref) {
55
69
  stylesInLine = _useDynamicStyles.stylesInLine,
56
70
  prefixClass = _useDynamicStyles.prefixClass;
57
71
 
72
+ var typographyRef = _react.default.useRef(null);
73
+
74
+ var _React$useState = _react.default.useState(false),
75
+ _React$useState2 = _slicedToArray(_React$useState, 2),
76
+ isEllipsisActive = _React$useState2[0],
77
+ setIsEllipsisActive = _React$useState2[1];
78
+
79
+ _react.default.useEffect(function () {
80
+ var timeout = setTimeout(function () {
81
+ if (typographyRef.current) {
82
+ var isEllipsis = typographyRef.current.scrollWidth > typographyRef.current.clientWidth;
83
+ setIsEllipsisActive(isEllipsis);
84
+ }
85
+ }, 0);
86
+ return function () {
87
+ return clearTimeout(timeout);
88
+ };
89
+ }, [text, typographyRef.current]);
90
+
58
91
  return /*#__PURE__*/_react.default.createElement("div", _extends({
59
92
  id: id,
60
93
  className: "".concat(prefixClass('cbx-tag-container'), " ").concat(variant === 'secondary' ? prefixClass('cbx-tag-container-secondary') : '', " ").concat(variant === 'tertiary' ? prefixClass('cbx-tag-container-tertiary') : '', " ").concat(className),
@@ -81,13 +114,17 @@ var Tag = function Tag(_ref) {
81
114
  }
82
115
  }, iconTypographyProps), iconText)), /*#__PURE__*/_react.default.createElement("div", {
83
116
  className: prefixClass('cbx-tag-block-typography')
117
+ }, /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
118
+ title: isEllipsisActive ? text : '',
119
+ placement: "right"
84
120
  }, /*#__PURE__*/_react.default.createElement(_Typography.default, _extends({
85
121
  prefixClass: prefixClass,
86
122
  color: colorText || 'var(--white)',
87
123
  styles: {
88
124
  lineHeight: '1.38rem'
89
- }
90
- }, textTypographyProps), text)), close && /*#__PURE__*/_react.default.createElement("div", {
125
+ },
126
+ ref: typographyRef
127
+ }, textTypographyProps), text))), close && /*#__PURE__*/_react.default.createElement("div", {
91
128
  className: prefixClass('cbx-tag-close'),
92
129
  onClick: function onClick() {
93
130
  return close();
@@ -206,7 +206,7 @@ var Tooltip = function Tooltip(_ref2) {
206
206
 
207
207
  var timeoutRef = _react.default.useRef(null);
208
208
 
209
- var childElement = _react.default.Children.only(children);
209
+ var childElement = /*#__PURE__*/_react.default.isValidElement(children) && !Array.isArray(children) ? _react.default.Children.only(children) : /*#__PURE__*/_react.default.createElement("span", null, children);
210
210
 
211
211
  var _React$useState = _react.default.useState(open || false),
212
212
  _React$useState2 = _slicedToArray(_React$useState, 2),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@councilbox/councilbox-ui",
3
- "version": "2.0.16",
3
+ "version": "2.0.17",
4
4
  "main": "dist/build-index.js",
5
5
  "files": [
6
6
  "dist",