wini-web-components 1.0.1 → 1.0.3

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.
@@ -12,6 +12,7 @@ interface SelectMultipleProps {
12
12
  helperTextColor?: string;
13
13
  style?: CSSProperties;
14
14
  handleSearch?: (e: string) => Promise<Array<OptionsItem>>;
15
+ hideClearValueButton?: boolean;
15
16
  }
16
17
  interface SelectMultipleState {
17
18
  value: Array<string | number>;
@@ -275,7 +275,7 @@ var SelectMultiple = /** @class */ (function (_super) {
275
275
  else
276
276
  _this.setState(__assign(__assign({}, _this.state), { isOpen: false, onSelect: null }));
277
277
  } })),
278
- react_1.default.createElement("button", { type: 'button', className: 'row', style: { padding: '0.4rem' }, onClick: function (ev) {
278
+ this.props.hideClearValueButton && react_1.default.createElement("button", { type: 'button', className: 'row', style: { padding: '0.4rem' }, onClick: function (ev) {
279
279
  ev.stopPropagation();
280
280
  if (_this.state.value.length)
281
281
  _this.setState(__assign(__assign({}, _this.state), { isOpen: true, value: [] }));
@@ -17,6 +17,7 @@ interface Select1Props {
17
17
  helperTextColor?: string;
18
18
  style?: CSSProperties;
19
19
  handleSearch?: (e: string) => Promise<Array<OptionsItem>>;
20
+ hideClearValueButton?: boolean;
20
21
  }
21
22
  interface Select1State {
22
23
  value?: string | number;
@@ -230,9 +230,11 @@ var Select1 = /** @class */ (function (_super) {
230
230
  var _this = this;
231
231
  var _a, _b, _c, _d, _e, _f, _g, _h;
232
232
  return react_1.default.createElement("div", { ref: this.containerRef, className: "select1-container row ".concat(this.props.disabled ? 'disabled' : '', " ").concat(((_a = this.props.helperText) === null || _a === void 0 ? void 0 : _a.length) && 'helper-text', " ").concat((_b = this.props.className) !== null && _b !== void 0 ? _b : 'body-3'), "helper-text": this.props.helperText, style: this.props.style ? __assign(__assign({}, { '--helper-text-color': (_c = this.props.helperTextColor) !== null && _c !== void 0 ? _c : '#e14337' }), this.props.style) : { '--helper-text-color': (_d = this.props.helperTextColor) !== null && _d !== void 0 ? _d : '#e14337' }, onClick: function () {
233
- var _a, _b;
234
- if (!_this.state.isOpen)
233
+ var _a, _b, _c;
234
+ if (!_this.state.isOpen) {
235
235
  _this.setState(__assign(__assign({}, _this.state), { isOpen: true, style: undefined, offset: (_b = (_a = _this.containerRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect() }));
236
+ (_c = _this.inputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
237
+ }
236
238
  } },
237
239
  react_1.default.createElement("div", { className: 'row', style: { flexWrap: 'wrap', flex: 1, width: '100%', gap: '0.6rem 0.4rem' } },
238
240
  react_1.default.createElement("input", { ref: this.inputRef, onChange: this.search, placeholder: this.props.placeholder, onBlur: function (ev) {
@@ -241,7 +243,7 @@ var Select1 = /** @class */ (function (_super) {
241
243
  else
242
244
  _this.setState(__assign(__assign({}, _this.state), { isOpen: false, onSelect: null }));
243
245
  } })),
244
- react_1.default.createElement("button", { type: 'button', className: 'row', style: { padding: '0.4rem' }, onClick: function (ev) {
246
+ this.props.hideClearValueButton && react_1.default.createElement("button", { type: 'button', className: 'row', style: { padding: '0.4rem' }, onClick: function (ev) {
245
247
  ev.stopPropagation();
246
248
  if (_this.state.value)
247
249
  _this.setState(__assign(__assign({}, _this.state), { isOpen: true, value: undefined }));
@@ -11,6 +11,7 @@ type TbCellProps = {
11
11
  className?: string;
12
12
  style?: CSSProperties;
13
13
  align?: CellAlignItems | string;
14
+ onClick?: React.MouseEventHandler<HTMLTableDataCellElement>;
14
15
  };
15
16
  export declare class TbCell extends React.Component<TbCellProps> {
16
17
  render(): React.ReactNode;
@@ -45,7 +45,7 @@ var TbCell = /** @class */ (function (_super) {
45
45
  }
46
46
  TbCell.prototype.render = function () {
47
47
  var _a, _b;
48
- return react_1.default.createElement("td", { style: this.props.style, "align-cell": (_a = this.props.align) !== null && _a !== void 0 ? _a : CellAlignItems.start, className: "tb-cell ".concat((_b = this.props.className) !== null && _b !== void 0 ? _b : '', " ").concat(this.props.fixed ? 'tb-cell-fixed' : '') }, this.props.children);
48
+ return react_1.default.createElement("td", { onClick: this.props.onClick, style: this.props.style, "align-cell": (_a = this.props.align) !== null && _a !== void 0 ? _a : CellAlignItems.start, className: "tb-cell ".concat((_b = this.props.className) !== null && _b !== void 0 ? _b : '', " ").concat(this.props.fixed ? 'tb-cell-fixed' : '') }, this.props.children);
49
49
  };
50
50
  return TbCell;
51
51
  }(react_1.default.Component));
@@ -68,7 +68,7 @@ var TbRow = /** @class */ (function (_super) {
68
68
  return wValue ? typeof wValue === 'number' ? "".concat(wValue, "px") : wValue : '60px';
69
69
  }).join(" + "), ")");
70
70
  }
71
- return react_1.default.createElement(TbCell, { key: "tb-cell-".concat(i), align: e.props.align, children: e.props.children, fixed: e.props.fixed, style: e.props.fixed ? (_this.props.children && i === _this.props.children.length - 1) ? __assign({ right: 0 }, ((_a = e.props.style) !== null && _a !== void 0 ? _a : {})) : __assign({ left: ox }, ((_b = e.props.style) !== null && _b !== void 0 ? _b : {})) : e.props.style, className: e.props.className });
71
+ return react_1.default.createElement(TbCell, { key: "tb-cell-".concat(i), align: e.props.align, children: e.props.children, fixed: e.props.fixed, onClick: e.props.onClick, style: e.props.fixed ? (_this.props.children && i === _this.props.children.length - 1) ? __assign({ right: 0 }, ((_a = e.props.style) !== null && _a !== void 0 ? _a : {})) : __assign({ left: ox }, ((_b = e.props.style) !== null && _b !== void 0 ? _b : {})) : e.props.style, className: e.props.className });
72
72
  }));
73
73
  };
74
74
  return TbRow;
@@ -89,7 +89,7 @@ var TbHeader = /** @class */ (function (_super) {
89
89
  if (_this.props.children && i > 0 && i < (_this.props.children.length - 1)) {
90
90
  ox = "calc(".concat(_this.props.children.slice(0, i).map(function (tb) { var _a; return ((_a = tb.props.style) === null || _a === void 0 ? void 0 : _a.width) ? typeof tb.props.style.width === 'number' ? "".concat(tb.props.style.width, "px") : tb.props.style.width : '60px'; }).join(" + "), ")");
91
91
  }
92
- return react_1.default.createElement(TbCell, { key: "tb-cell-".concat(i), align: e.props.align, children: e.props.children, fixed: e.props.fixed, style: e.props.fixed ? (_this.props.children && i === _this.props.children.length - 1) ? __assign({ right: 0 }, ((_a = e.props.style) !== null && _a !== void 0 ? _a : {})) : __assign({ left: ox }, ((_b = e.props.style) !== null && _b !== void 0 ? _b : {})) : e.props.style, className: e.props.className });
92
+ return react_1.default.createElement(TbCell, { key: "tb-cell-".concat(i), align: e.props.align, children: e.props.children, onClick: e.props.onClick, fixed: e.props.fixed, style: e.props.fixed ? (_this.props.children && i === _this.props.children.length - 1) ? __assign({ right: 0 }, ((_a = e.props.style) !== null && _a !== void 0 ? _a : {})) : __assign({ left: ox }, ((_b = e.props.style) !== null && _b !== void 0 ? _b : {})) : e.props.style, className: e.props.className });
93
93
  })));
94
94
  };
95
95
  return TbHeader;