wini-web-components 1.5.8 → 1.6.0

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.
@@ -1,5 +1,4 @@
1
1
  import React, { CSSProperties, ReactNode } from 'react';
2
- import './select1.css';
3
2
  export interface OptionsItem {
4
3
  id: string | number;
5
4
  parentId?: string;
@@ -89,11 +89,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
89
89
  };
90
90
  Object.defineProperty(exports, "__esModule", { value: true });
91
91
  exports.Select1 = void 0;
92
+ var select1_module_css_1 = __importDefault(require("./select1.module.css"));
92
93
  var free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
93
94
  var react_fontawesome_1 = require("@fortawesome/react-fontawesome");
94
95
  var react_1 = __importStar(require("react"));
95
96
  var react_dom_1 = __importDefault(require("react-dom"));
96
- require("./select1.css");
97
97
  var text_1 = require("../text/text");
98
98
  ;
99
99
  var Select1 = /** @class */ (function (_super) {
@@ -207,7 +207,7 @@ var Select1 = /** @class */ (function (_super) {
207
207
  children = ((_a = this.state.search) !== null && _a !== void 0 ? _a : this.state.options).filter(function (e) { return e.parentId === item.id; });
208
208
  //
209
209
  return react_1.default.createElement("div", { key: item.id, className: 'col', style: { width: '100%' } },
210
- react_1.default.createElement("div", { className: "select-tile row ".concat(item.disabled ? "disabled" : ""), style: { paddingLeft: item.parentId ? '4.4rem' : undefined, backgroundColor: this.state.selected === item.id ? "var(--selected-background)" : undefined }, onClick: children.length ? function () {
210
+ react_1.default.createElement("div", { className: "".concat(select1_module_css_1.default['select-tile'], " row ").concat(item.disabled ? select1_module_css_1.default["disabled"] : ""), style: { paddingLeft: item.parentId ? '4.4rem' : undefined, backgroundColor: this.state.selected === item.id ? "var(--selected-background)" : undefined }, onClick: children.length ? function () {
211
211
  if (_this.state.search) {
212
212
  _this.setState(__assign(__assign({}, _this.state), { search: _this.state.search.map(function (e) {
213
213
  if (e.id === item.id)
@@ -245,7 +245,7 @@ var Select1 = /** @class */ (function (_super) {
245
245
  this.inputRef.current.value = "".concat((_d = (_c = this.state.options.find(function (e) { return e.id === _this.state.value; })) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : "");
246
246
  //
247
247
  if (this.state.isOpen && prevState.isOpen !== this.state.isOpen) {
248
- var thisPopupRect = (_e = document.body.querySelector('.select1-popup')) === null || _e === void 0 ? void 0 : _e.getBoundingClientRect();
248
+ var thisPopupRect = (_e = document.body.querySelector(':scope > .col[class*="select1-popup"]')) === null || _e === void 0 ? void 0 : _e.getBoundingClientRect();
249
249
  if (thisPopupRect) {
250
250
  var style = void 0;
251
251
  if (thisPopupRect.right > document.body.offsetWidth) {
@@ -279,7 +279,7 @@ var Select1 = /** @class */ (function (_super) {
279
279
  var _this = this;
280
280
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
281
281
  var _value = this.state.options.find(function (e) { return e.id === _this.state.value; });
282
- return react_1.default.createElement("div", { id: this.props.id, 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 () {
282
+ return react_1.default.createElement("div", { id: this.props.id, ref: this.containerRef, className: "".concat(select1_module_css_1.default['select1-container'], " row ").concat(this.props.disabled ? select1_module_css_1.default['disabled'] : '', " ").concat(((_a = this.props.helperText) === null || _a === void 0 ? void 0 : _a.length) && select1_module_css_1.default['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 () {
283
283
  var _a, _b, _c;
284
284
  if (!_this.state.isOpen) {
285
285
  _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() }));
@@ -297,17 +297,17 @@ var Select1 = /** @class */ (function (_super) {
297
297
  if (_this.state.value)
298
298
  _this.setState(__assign(__assign({}, _this.state), { isOpen: true, value: undefined }));
299
299
  } },
300
- react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faXmarkCircle, style: { fontSize: '1.6rem', color: "var(--neutral-text-color-subtitle)" } })) : react_1.default.createElement("div", { className: 'row', style: { display: (this.containerRef.current && this.containerRef.current.getBoundingClientRect().width >= 120) ? "flex" : "none" } },
300
+ react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faXmarkCircle, style: { fontSize: '1.6rem', color: "var(--neutral-text-color-subtitle)" } })) : react_1.default.createElement("div", { className: 'row', style: { display: (!this.containerRef.current || this.containerRef.current.getBoundingClientRect().width >= 120) ? "flex" : "none" } },
301
301
  react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: this.state.isOpen ? free_solid_svg_icons_1.faChevronUp : free_solid_svg_icons_1.faChevronDown, style: { fontSize: '1.1rem', color: "var(--neutral-text-color-subtitle)" } })),
302
302
  this.state.isOpen &&
303
- react_dom_1.default.createPortal(react_1.default.createElement("div", { className: "select1-popup col ".concat((_e = this.props.popupClassName) !== null && _e !== void 0 ? _e : ""), style: (_f = this.state.style) !== null && _f !== void 0 ? _f : {
303
+ react_dom_1.default.createPortal(react_1.default.createElement("div", { className: "".concat(select1_module_css_1.default['select1-popup'], " col ").concat((_e = this.props.popupClassName) !== null && _e !== void 0 ? _e : ""), style: (_f = this.state.style) !== null && _f !== void 0 ? _f : {
304
304
  top: this.state.offset.y + this.state.offset.height + 2 + 'px',
305
305
  left: this.state.offset.x + 'px',
306
306
  width: this.state.offset.width,
307
307
  }, onMouseOver: function (ev) { return _this.setState(__assign(__assign({}, _this.state), { onSelect: ev.target })); }, onMouseOut: function () { return _this.setState(__assign(__assign({}, _this.state), { onSelect: null })); } },
308
- react_1.default.createElement("div", { className: 'col select-body' },
308
+ react_1.default.createElement("div", { className: "col ".concat(select1_module_css_1.default['select-body']) },
309
309
  ((_g = this.state.search) !== null && _g !== void 0 ? _g : this.state.options).filter(function (e) { return !e.parentId; }).map(function (item) { return _this.renderOptions(item); }),
310
- (((_h = this.state.search) === null || _h === void 0 ? void 0 : _h.length) === 0 || ((_j = this.props.options) === null || _j === void 0 ? void 0 : _j.length) === 0) && (react_1.default.createElement("div", { className: 'no-results-found' }, "No result found")))), document.body));
310
+ (((_h = this.state.search) === null || _h === void 0 ? void 0 : _h.length) === 0 || ((_j = this.props.options) === null || _j === void 0 ? void 0 : _j.length) === 0) && (react_1.default.createElement("div", { className: select1_module_css_1.default['no-results-found'] }, "No result found")))), document.body));
311
311
  };
312
312
  return Select1;
313
313
  }(react_1.default.Component));